@tap-payments/auth-jsconnect 2.4.3-test → 2.4.5-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +27 -1
- package/build/api/individual.d.ts +2 -2
- package/build/features/app/brand/brandStore.js +10 -9
- package/build/features/bank/screens/BankDetails/BankDetails.js +3 -2
- package/build/features/bank/screens/BankDetails/BankName.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/BankName.js +4 -5
- package/build/features/bank/screens/BankDetails/BankStatement.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/BankStatement.js +4 -4
- package/build/features/bank/screens/BankDetails/Beneficiary.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/Beneficiary.js +8 -10
- package/build/features/bank/screens/BankDetails/IBAN.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/IBAN.js +3 -5
- package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +0 -14
- package/build/features/brand/screens/BrandActivities/ActivitiesList.js +6 -11
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +13 -7
- package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +4 -27
- package/build/features/brand/screens/BrandActivities/CustomerBase.js +9 -18
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +6 -5
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +15 -14
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +5 -4
- package/build/features/brand/screens/BrandInfo/BrandLogo.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/BrandLogo.js +2 -2
- package/build/features/brand/screens/BrandInfo/BrandName.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/BrandName.js +3 -5
- package/build/features/brand/screens/BrandInfo/SalesChannels.js +6 -3
- package/build/features/brand/screens/BrandInfo/Segments.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/Segments.js +17 -24
- package/build/features/brand/screens/BrandInfo/TeamSize.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/TeamSize.js +18 -25
- package/build/features/entity/screens/EntityName/EntityTypeList.js +1 -1
- package/build/features/shared/CheckIcon/CheckIcon.d.ts +7 -1
- package/build/features/shared/CheckIcon/CheckIcon.js +7 -6
- package/build/features/shared/EndAdornment/EndAdornment.d.ts +10 -0
- package/build/features/shared/EndAdornment/EndAdornment.js +17 -0
- package/build/features/shared/EndAdornment/EndAdornmentExpanded.d.ts +7 -0
- package/build/features/shared/EndAdornment/EndAdornmentExpanded.js +13 -0
- package/build/features/shared/EndAdornment/index.d.ts +3 -0
- package/build/features/shared/EndAdornment/index.js +3 -0
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +2 -1
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +4 -3
- package/build/features/shared/SalesChannels/SalesChannel.d.ts +2 -1
- package/build/features/shared/SalesChannels/SalesChannel.js +2 -2
- package/build/features/shared/UploadFile/FileUpload.d.ts +2 -1
- package/build/features/shared/UploadFile/FileUpload.js +2 -2
- package/build/features/shared/UploadFile/UploadWrapper.d.ts +2 -1
- package/build/features/shared/UploadFile/UploadWrapper.js +2 -2
- package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +2 -1
- package/build/features/shared/UploadMultipleFile/UploadFile.js +2 -2
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +2 -1
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +2 -2
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useDataVerified.d.ts +6 -0
- package/build/hooks/useDataVerified.js +19 -0
- package/package.json +1 -1
|
@@ -22,21 +22,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
|
-
import Box from '@mui/material/Box';
|
|
26
25
|
import { useTranslation } from 'react-i18next';
|
|
27
26
|
import { useController, useFormContext } from 'react-hook-form';
|
|
27
|
+
import Box from '@mui/material/Box';
|
|
28
28
|
import { styled, alpha } from '@mui/material/styles';
|
|
29
|
+
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
29
30
|
import Text from '../../../../components/Text';
|
|
30
31
|
import Collapse from '../../../../components/Collapse';
|
|
31
|
-
import CheckIcon from '@mui/icons-material/Check';
|
|
32
|
-
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
|
-
import Input from '../../../shared/Input';
|
|
34
32
|
import Tooltip from '../../../../components/Tooltip';
|
|
35
33
|
import SimpleList from '../../../../components/SimpleList';
|
|
34
|
+
import Input from '../../../shared/Input';
|
|
36
35
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
37
|
-
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
38
36
|
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
39
|
-
import Search from '
|
|
37
|
+
import Search from '../../../shared/Search';
|
|
38
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
39
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
40
40
|
import { InfoIconStyled, InfoOutlinedIconStyled, LabelContainerStyled } from './ActivitiesList';
|
|
41
41
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
42
42
|
var theme = _a.theme;
|
|
@@ -59,14 +59,6 @@ export var NameContainer = styled(Text, { shouldForwardProp: function (prop) { r
|
|
|
59
59
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
60
60
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
61
61
|
});
|
|
62
|
-
export var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
63
|
-
var theme = _a.theme;
|
|
64
|
-
return ({
|
|
65
|
-
color: theme.palette.success.main,
|
|
66
|
-
display: 'flex',
|
|
67
|
-
alignItems: 'flex-end'
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
62
|
export var RemainingCheck = styled(CheckIcon)(function (_a) {
|
|
71
63
|
var theme = _a.theme;
|
|
72
64
|
return ({
|
|
@@ -80,7 +72,7 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
|
80
72
|
}); });
|
|
81
73
|
var CustomerBase = function (_a) {
|
|
82
74
|
var _b, _c;
|
|
83
|
-
var readOnly = _a.readOnly, props = __rest(_a, ["readOnly"]);
|
|
75
|
+
var readOnly = _a.readOnly, isVerified = _a.isVerified, props = __rest(_a, ["readOnly", "isVerified"]);
|
|
84
76
|
var _d = React.useState([]), customerLocationsList = _d[0], setCustomerLocationsList = _d[1];
|
|
85
77
|
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
86
78
|
var t = useTranslation().t;
|
|
@@ -92,7 +84,6 @@ var CustomerBase = function (_a) {
|
|
|
92
84
|
var _g = React.useState(false), isHovered = _g[0], setIsHovered = _g[1];
|
|
93
85
|
var brandActivities = data.brandActivities;
|
|
94
86
|
var response = brandActivities.responseBody;
|
|
95
|
-
var disabled = false;
|
|
96
87
|
var onOpenList = function (event) {
|
|
97
88
|
var _a;
|
|
98
89
|
if (readOnly)
|
|
@@ -140,8 +131,8 @@ var CustomerBase = function (_a) {
|
|
|
140
131
|
};
|
|
141
132
|
var customerLocationsValue = customerLocationsControl.field.value;
|
|
142
133
|
var customerLocationSelected = customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue[0];
|
|
143
|
-
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(BaseLabelStyled, { children: t('select_customer_base') }), _jsx(Tooltip, __assign({ title: t('customer_base_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(InputStyled, { readOnly: readOnly,
|
|
144
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue.id) }, { children: isAr ? item.name.ar : item.name.en })) })), item.id === (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(
|
|
134
|
+
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(BaseLabelStyled, { children: t('select_customer_base') }), _jsx(Tooltip, __assign({ title: t('customer_base_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(InputStyled, { readOnly: readOnly, placeholder: t('choose_expected_sales'), value: isAr ? (_b = customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.en) !== null && _c !== void 0 ? _c : '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name.en', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
|
|
135
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue.id) }, { children: isAr ? item.name.ar : item.name.en })) })), item.id === (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(CheckIcon, { isVerified: isVerified }), checkRemainingCondition(item) && item.id != (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
145
136
|
} })] }))] }) })));
|
|
146
137
|
};
|
|
147
138
|
export default React.memo(CustomerBase);
|
|
@@ -4,6 +4,7 @@ interface ExpectedCustomersProps {
|
|
|
4
4
|
onListOpen?: () => void;
|
|
5
5
|
onListClose?: () => void;
|
|
6
6
|
readOnly?: boolean;
|
|
7
|
+
isVerified?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const ExpectedCustomers: ({ readOnly, ...props }: ExpectedCustomersProps) => JSX.Element;
|
|
9
|
+
declare const ExpectedCustomers: ({ readOnly, isVerified, ...props }: ExpectedCustomersProps) => JSX.Element;
|
|
9
10
|
export default ExpectedCustomers;
|
|
@@ -29,11 +29,12 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
29
29
|
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
30
30
|
import SimpleList from '../../../../components/SimpleList';
|
|
31
31
|
import Collapse from '../../../../components/Collapse';
|
|
32
|
-
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
32
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
|
-
import { CheckIconStyled, InputLabelStyled, NameContainer } from './CustomerBase';
|
|
35
33
|
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
36
34
|
import Input from '../../../shared/Input';
|
|
35
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
36
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
37
|
+
import { InputLabelStyled, NameContainer } from './CustomerBase';
|
|
37
38
|
var InputStyled = styled(Input)(function (_a) {
|
|
38
39
|
var theme = _a.theme, readOnly = _a.readOnly;
|
|
39
40
|
return ({
|
|
@@ -55,7 +56,7 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
|
55
56
|
}); });
|
|
56
57
|
var ExpectedCustomers = function (_a) {
|
|
57
58
|
var _b, _c, _d, _e;
|
|
58
|
-
var readOnly = _a.readOnly, props = __rest(_a, ["readOnly"]);
|
|
59
|
+
var readOnly = _a.readOnly, isVerified = _a.isVerified, props = __rest(_a, ["readOnly", "isVerified"]);
|
|
59
60
|
var _f = React.useState([]), expectedCustomersList = _f[0], setExpectedCustomersList = _f[1];
|
|
60
61
|
var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
|
|
61
62
|
var t = useTranslation().t;
|
|
@@ -95,8 +96,8 @@ var ExpectedCustomers = function (_a) {
|
|
|
95
96
|
};
|
|
96
97
|
var expectedCustomersValue = expectedCustomerControl.field.value;
|
|
97
98
|
var expectedCustomersSelected = expectedCustomersValue;
|
|
98
|
-
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: readOnly, placeholder: t('choose_expected_sales'), value: isAr ? (_c = (_b = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name) === null || _b === void 0 ? void 0 : _b.ar) !== null && _c !== void 0 ? _c : '' : (_e = (_d = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name) === null || _d === void 0 ? void 0 : _d.en) !== null && _e !== void 0 ? _e : '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(
|
|
99
|
-
return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.name.ar : item.name.en })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(
|
|
99
|
+
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: readOnly, placeholder: t('choose_expected_sales'), value: isAr ? (_c = (_b = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name) === null || _b === void 0 ? void 0 : _b.ar) !== null && _c !== void 0 ? _c : '' : (_e = (_d = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name) === null || _d === void 0 ? void 0 : _d.en) !== null && _e !== void 0 ? _e : '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
100
|
+
return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.name.ar : item.name.en })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
100
101
|
} }) }))] }) })));
|
|
101
102
|
};
|
|
102
103
|
export default ExpectedCustomers;
|
|
@@ -4,6 +4,7 @@ interface ExpectedSalesRangeProps {
|
|
|
4
4
|
onListOpen?: () => void;
|
|
5
5
|
onListClose?: () => void;
|
|
6
6
|
readOnly?: boolean;
|
|
7
|
+
isVerified?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const ExpectedSalesRange: ({ show, onListClose, onListOpen, readOnly }: ExpectedSalesRangeProps) => JSX.Element;
|
|
9
|
+
declare const ExpectedSalesRange: ({ show, onListClose, onListOpen, readOnly, isVerified }: ExpectedSalesRangeProps) => JSX.Element;
|
|
9
10
|
export default ExpectedSalesRange;
|
|
@@ -9,23 +9,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx,
|
|
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
|
-
import { styled } from '@mui/material/styles';
|
|
16
14
|
import { useTranslation } from 'react-i18next';
|
|
17
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
|
+
import { findCurrencyByIso2, isExist } from '../../../../utils';
|
|
18
19
|
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
20
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
19
21
|
import SimpleList from '../../../../components/SimpleList';
|
|
20
22
|
import Collapse from '../../../../components/Collapse';
|
|
21
23
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
22
24
|
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
23
|
-
import { findCurrencyByIso2, isExist } from '../../../../utils';
|
|
24
25
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
-
import
|
|
26
|
-
import Search from '../../../../features/shared/Search';
|
|
27
|
-
import { settingsSelector } from '../../../../app/settings';
|
|
26
|
+
import Search from '../../../shared/Search';
|
|
28
27
|
import Input from '../../../shared/Input';
|
|
28
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
29
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
30
|
+
import { InputLabelStyled, NameContainer } from './CustomerBase';
|
|
29
31
|
var InputStyled = styled(Input)(function (_a) {
|
|
30
32
|
var theme = _a.theme, readOnly = _a.readOnly;
|
|
31
33
|
return ({
|
|
@@ -57,7 +59,7 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
|
57
59
|
}); });
|
|
58
60
|
var ExpectedSalesRange = function (_a) {
|
|
59
61
|
var _b, _c;
|
|
60
|
-
var show = _a.show, onListClose = _a.onListClose, onListOpen = _a.onListOpen, readOnly = _a.readOnly;
|
|
62
|
+
var show = _a.show, onListClose = _a.onListClose, onListOpen = _a.onListOpen, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
61
63
|
var _d = React.useState([]), expectedSalesRangeList = _d[0], setExpectedSalesRangeList = _d[1];
|
|
62
64
|
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
63
65
|
var _f = React.useState(''), subIndex = _f[0], setSubIndex = _f[1];
|
|
@@ -68,13 +70,12 @@ var ExpectedSalesRange = function (_a) {
|
|
|
68
70
|
var expectedSaleControl = useController({ name: 'expectedSale', control: control });
|
|
69
71
|
var _g = useAppSelector(brandSelector), data = _g.data, error = _g.error;
|
|
70
72
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
71
|
-
var brandActivities = data.brandActivities
|
|
73
|
+
var brandActivities = data.brandActivities;
|
|
72
74
|
var expectedSales = (brandActivities.responseBody || {}).expectedSales;
|
|
73
75
|
var expectedSalesRangeValue = expectedSaleControl.field.value;
|
|
74
76
|
var countryCode = settingsData.businessCountry;
|
|
75
|
-
var disabled = false;
|
|
76
77
|
var handleOpenMainMenu = function (event) {
|
|
77
|
-
if (
|
|
78
|
+
if (readOnly)
|
|
78
79
|
return;
|
|
79
80
|
setAnchorEl(event.currentTarget);
|
|
80
81
|
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
@@ -126,7 +127,7 @@ var ExpectedSalesRange = function (_a) {
|
|
|
126
127
|
}, [anchorEl, expectedSalesRangeValue]);
|
|
127
128
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
|
|
128
129
|
currency: t(findCurrencyByIso2(countryCode.iso2))
|
|
129
|
-
}) }), _jsx(InputStyled, { readOnly: readOnly,
|
|
130
|
+
}) }), _jsx(InputStyled, { readOnly: readOnly, value: isAr ? (_b = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) !== null && _c !== void 0 ? _c : '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
|
|
130
131
|
var isOnlyOneItem = !item.sub || item.sub.length === 1;
|
|
131
132
|
if (isOnlyOneItem)
|
|
132
133
|
onSelectItem(item);
|
|
@@ -136,8 +137,8 @@ var ExpectedSalesRange = function (_a) {
|
|
|
136
137
|
var _a;
|
|
137
138
|
var isOnlyOneItem = !item.sub || ((_a = item.sub) === null || _a === void 0 ? void 0 : _a.length) === 1;
|
|
138
139
|
var showCheck = item.id === (expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id) && isOnlyOneItem;
|
|
139
|
-
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(
|
|
140
|
-
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(
|
|
140
|
+
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(CheckIcon, { isVerified: isVerified }) : !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) {
|
|
141
|
+
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(CheckIcon, { isVerified: isVerified })] })));
|
|
141
142
|
} }) }))] }));
|
|
142
143
|
} })] }))] }) })));
|
|
143
144
|
};
|
|
@@ -15,7 +15,7 @@ import React from 'react';
|
|
|
15
15
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
16
|
import Form from '../../../../components/Form';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { BrandValidationSchema } from './validation';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
@@ -47,7 +47,7 @@ var BrandInfo = function (_a) {
|
|
|
47
47
|
var _d = useAppSelector(brandSelector), data = _d.data, loading = _d.loading, error = _d.error, uploadingBrandLogo = _d.uploadingBrandLogo;
|
|
48
48
|
var _e = data.brandData, brandName = _e.brandName, segment = _e.segment, teamSize = _e.teamSize, salesChannels = _e.salesChannels, brandLogoId = _e.brandLogoId, responseBody = _e.responseBody;
|
|
49
49
|
var _f = data.verify.responseBody || {}, brand = _f.brand, flows = _f.flows;
|
|
50
|
-
var _g = brand || {}, logo_details = _g.logo_details, data_status = _g.data_status;
|
|
50
|
+
var _g = brand || {}, logo_details = _g.logo_details, data_status = _g.data_status, data_verification = _g.data_verification;
|
|
51
51
|
var methods = useForm({
|
|
52
52
|
resolver: yupResolver(BrandValidationSchema()),
|
|
53
53
|
defaultValues: {
|
|
@@ -62,8 +62,9 @@ var BrandInfo = function (_a) {
|
|
|
62
62
|
useSetFromDefaultValues(methods, data.brandData, true);
|
|
63
63
|
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
64
64
|
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
65
|
-
var noneEditable = useDataNoneEditable(data_status, ['name', 'segment.type', 'segment.teams', 'channel_services']);
|
|
65
|
+
var noneEditable = useDataNoneEditable(data_status, ['name.en', 'name.ar', 'segment.type', 'segment.teams', 'channel_services']);
|
|
66
66
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
67
|
+
var dataVerified = useDataVerified(data_verification, ['logo', 'name.en', 'name.ar', 'segment.teams', 'segment.type']);
|
|
67
68
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
68
69
|
var onSubmit = function (data) {
|
|
69
70
|
dispatch(updateBrand(getFelids(data)));
|
|
@@ -94,6 +95,6 @@ var BrandInfo = function (_a) {
|
|
|
94
95
|
};
|
|
95
96
|
var isSegmentsListActive = listActive === ListType.SegmentsList;
|
|
96
97
|
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
97
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || noneEditable['name'], show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
|
|
98
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || (noneEditable['name.en'] && noneEditable['name.ar']), show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking, isVerified: dataVerified['name.en'] && dataVerified['name.ar'] }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive, isVerified: dataVerified['logo'] }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); }, isVerified: dataVerified['segment.type'] }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); }, isVerified: dataVerified['segment.teams'] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
|
|
98
99
|
};
|
|
99
100
|
export default BrandInfo;
|
|
@@ -4,6 +4,7 @@ declare type BrandLogoProps = {
|
|
|
4
4
|
show: boolean;
|
|
5
5
|
readOnly?: boolean;
|
|
6
6
|
defaultFile?: FileDetails;
|
|
7
|
+
isVerified?: boolean;
|
|
7
8
|
};
|
|
8
|
-
declare const BrandLogo: ({ show, readOnly, defaultFile }: BrandLogoProps) => JSX.Element;
|
|
9
|
+
declare const BrandLogo: ({ show, readOnly, defaultFile, isVerified }: BrandLogoProps) => JSX.Element;
|
|
9
10
|
export default BrandLogo;
|
|
@@ -28,7 +28,7 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
28
28
|
});
|
|
29
29
|
var BrandLogo = function (_a) {
|
|
30
30
|
var _b;
|
|
31
|
-
var show = _a.show, readOnly = _a.readOnly, defaultFile = _a.defaultFile;
|
|
31
|
+
var show = _a.show, readOnly = _a.readOnly, defaultFile = _a.defaultFile, isVerified = _a.isVerified;
|
|
32
32
|
var t = useTranslation().t;
|
|
33
33
|
var control = useFormContext().control;
|
|
34
34
|
var brandLogoIdControl = useController({ name: 'brandLogoId', control: control });
|
|
@@ -47,6 +47,6 @@ var BrandLogo = function (_a) {
|
|
|
47
47
|
dispatch(clearBrandLogo());
|
|
48
48
|
brandLogoIdControl.field.onChange(undefined);
|
|
49
49
|
};
|
|
50
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'brandLogoId', readOnly: readOnly, fileRemoveType: FileRemoveType.BRAND_LOGO_FILE_ID, control: control, label: t('title_brand_logo'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('description_brand_logo'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBrandLogoChange, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.BRAND_LOGO, validFileFormats: VALID_FILE_FORMATS_FOR_IMAGE, fileUploadingStatus: function (uploading) { return dispatch(uploadingBrandLogoStatus(uploading)); } }) }) })));
|
|
50
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'brandLogoId', readOnly: readOnly, fileRemoveType: FileRemoveType.BRAND_LOGO_FILE_ID, control: control, label: t('title_brand_logo'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('description_brand_logo'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBrandLogoChange, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.BRAND_LOGO, validFileFormats: VALID_FILE_FORMATS_FOR_IMAGE, fileUploadingStatus: function (uploading) { return dispatch(uploadingBrandLogoStatus(uploading)); }, isVerified: isVerified }) }) })));
|
|
51
51
|
};
|
|
52
52
|
export default BrandLogo;
|
|
@@ -4,6 +4,7 @@ interface BrandNameProps {
|
|
|
4
4
|
fetchingBrandName: (flag: boolean) => void;
|
|
5
5
|
brandNameChecking: boolean;
|
|
6
6
|
readOnly?: boolean;
|
|
7
|
+
isVerified?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName, readOnly }: BrandNameProps) => JSX.Element>;
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName, readOnly, isVerified }: BrandNameProps) => JSX.Element>;
|
|
9
10
|
export default _default;
|
|
@@ -55,17 +55,15 @@ import Box from '@mui/material/Box';
|
|
|
55
55
|
import { styled, alpha } from '@mui/material/styles';
|
|
56
56
|
import InfoIcon from '@mui/icons-material/Info';
|
|
57
57
|
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
58
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
|
59
58
|
import { FieldType } from '../../../../@types';
|
|
60
59
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
61
60
|
import Tooltip from '../../../../components/Tooltip';
|
|
62
61
|
import Collapse from '../../../../components/Collapse';
|
|
63
62
|
import Text from '../../../../components/Text';
|
|
64
63
|
import Input from '../../../shared/Input';
|
|
65
|
-
import ClearIcon from '../../../shared/ClearIcon';
|
|
66
64
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
67
|
-
import CheckIcon from '../../../shared/CheckIcon';
|
|
68
65
|
import { checkBrandNameAvailability, brandSelector } from '../../../app/brand/brandStore';
|
|
66
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
69
67
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
70
68
|
var theme = _a.theme;
|
|
71
69
|
return ({
|
|
@@ -99,7 +97,7 @@ var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
|
99
97
|
var cancelToken = null;
|
|
100
98
|
var BrandName = function (_a) {
|
|
101
99
|
var _b, _c;
|
|
102
|
-
var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName, readOnly = _a.readOnly;
|
|
100
|
+
var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
103
101
|
var dispatch = useAppDispatch();
|
|
104
102
|
var _d = React.useState(false), isHovered = _d[0], setIsHovered = _d[1];
|
|
105
103
|
var t = useTranslation().t;
|
|
@@ -138,6 +136,6 @@ var BrandName = function (_a) {
|
|
|
138
136
|
var clearBrandName = function () {
|
|
139
137
|
brandControl.field.onChange('');
|
|
140
138
|
};
|
|
141
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleBrandNameChange, value: brandNameValue || '', disabled: isNonEditable, placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment:
|
|
139
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleBrandNameChange, value: brandNameValue || '', disabled: isNonEditable, placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: brandNameValue, loading: brandNameChecking, isVerified: isVerified, error: error, onClear: clearBrandName }) })] })) })));
|
|
142
140
|
};
|
|
143
141
|
export default React.memo(BrandName);
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useController, useFormContext } from 'react-hook-form';
|
|
4
4
|
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
5
|
-
import { mapSalesChannel } from '../../../../utils';
|
|
5
|
+
import { hasVerifiedValue, mapSalesChannel } from '../../../../utils';
|
|
6
6
|
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
7
7
|
import SalesChannel from '../../../shared/SalesChannels';
|
|
8
8
|
var SalesChannels = function (_a) {
|
|
@@ -12,14 +12,17 @@ var SalesChannels = function (_a) {
|
|
|
12
12
|
var dispatch = useAppDispatch();
|
|
13
13
|
var _c = useController({ control: control, name: 'salesChannels' }), fieldState = _c.fieldState, field = _c.field;
|
|
14
14
|
var _d = useAppSelector(brandSelector), data = _d.data, error = _d.error;
|
|
15
|
+
var brand = (data.verify.responseBody || {}).brand;
|
|
16
|
+
var isChannelVerified = function (id) {
|
|
17
|
+
return hasVerifiedValue(brand === null || brand === void 0 ? void 0 : brand.data_verification, "channel_services.".concat(id));
|
|
18
|
+
};
|
|
15
19
|
var channelList = (data.verify.responseBody || {}).channel_list;
|
|
16
|
-
var isNonEditable = false;
|
|
17
20
|
var selectedSalesChannels = React.useMemo(function () { return mapSalesChannel(field.value); }, [(field.value || []).length]);
|
|
18
21
|
var onChange = function (channels) {
|
|
19
22
|
if (error)
|
|
20
23
|
dispatch(clearError());
|
|
21
24
|
field.onChange(channels);
|
|
22
25
|
};
|
|
23
|
-
return (_jsx(SalesChannel, {
|
|
26
|
+
return (_jsx(SalesChannel, { readOnly: readOnly, isChannelVerified: function (id) { return isChannelVerified(id); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
24
27
|
};
|
|
25
28
|
export default SalesChannels;
|
|
@@ -4,6 +4,7 @@ interface SegmentsProps {
|
|
|
4
4
|
onListOpen?: () => void;
|
|
5
5
|
onListClose?: () => void;
|
|
6
6
|
readOnly?: boolean;
|
|
7
|
+
isVerified?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const Segments: ({ show, onListOpen, onListClose, readOnly }: SegmentsProps) => JSX.Element;
|
|
9
|
+
declare const Segments: ({ show, onListOpen, onListClose, readOnly, isVerified }: SegmentsProps) => JSX.Element;
|
|
9
10
|
export default Segments;
|
|
@@ -10,20 +10,20 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import Collapse from '../../../../components/Collapse';
|
|
14
|
-
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
15
|
-
import Input from '../../../../features/shared/Input';
|
|
16
|
-
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
17
13
|
import React from 'react';
|
|
18
14
|
import { useTranslation } from 'react-i18next';
|
|
19
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
20
|
-
import { brandSelector } from '../../../../features/app/brand/brandStore';
|
|
21
|
-
import SimpleList from '../../../../components/SimpleList';
|
|
22
|
-
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
23
16
|
import Box from '@mui/material/Box';
|
|
24
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
25
20
|
import Text from '../../../../components/Text';
|
|
26
|
-
import
|
|
21
|
+
import Collapse from '../../../../components/Collapse';
|
|
22
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import Input from '../../../shared/Input';
|
|
25
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
26
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
27
27
|
var InputStyled = styled(Input)(function (_a) {
|
|
28
28
|
var readOnly = _a.readOnly;
|
|
29
29
|
return ({
|
|
@@ -36,27 +36,20 @@ var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop
|
|
|
36
36
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
37
37
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
|
|
38
38
|
});
|
|
39
|
-
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
40
|
-
var theme = _a.theme;
|
|
41
|
-
return ({
|
|
42
|
-
color: theme.palette.success.main,
|
|
43
|
-
display: 'flex',
|
|
44
|
-
alignItems: 'flex-end'
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
39
|
var Segments = function (_a) {
|
|
48
|
-
var _b, _c, _d
|
|
49
|
-
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly;
|
|
50
|
-
var
|
|
51
|
-
var
|
|
40
|
+
var _b, _c, _d;
|
|
41
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
42
|
+
var _e = React.useState([]), segmentList = _e[0], setSegmentList = _e[1];
|
|
43
|
+
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
52
44
|
var t = useTranslation().t;
|
|
53
45
|
var isAr = useLanguage().isAr;
|
|
54
46
|
var data = useAppSelector(brandSelector).data;
|
|
55
47
|
var control = useFormContext().control;
|
|
56
|
-
var
|
|
48
|
+
var list = (data.verify.responseBody || {}).segmentsList;
|
|
49
|
+
var segmentsList = list || [];
|
|
57
50
|
var segmentControl = useController({ control: control, name: 'segment' });
|
|
58
51
|
var segment = segmentControl.field.value;
|
|
59
|
-
var error = (
|
|
52
|
+
var error = (_b = segmentControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
60
53
|
React.useEffect(function () {
|
|
61
54
|
if ((segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.length) > 0) {
|
|
62
55
|
setSegmentList(segmentsList);
|
|
@@ -76,9 +69,9 @@ var Segments = function (_a) {
|
|
|
76
69
|
onCloseList();
|
|
77
70
|
segmentControl.field.onChange(segment);
|
|
78
71
|
};
|
|
79
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { required: true, label: t('segment_title'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(
|
|
72
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { required: true, label: t('segment_title'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }), placeholder: t('choose_any_segment'), value: (isAr ? (_c = segment === null || segment === void 0 ? void 0 : segment.name) === null || _c === void 0 ? void 0 : _c.ar : (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
80
73
|
var _a, _b;
|
|
81
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(
|
|
74
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
82
75
|
} }) }))] })) })));
|
|
83
76
|
};
|
|
84
77
|
export default Segments;
|
|
@@ -4,6 +4,7 @@ interface TeamSizeProps {
|
|
|
4
4
|
onListOpen?: () => void;
|
|
5
5
|
onListClose?: () => void;
|
|
6
6
|
readOnly?: boolean;
|
|
7
|
+
isVerified?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const TeamSize: ({ show, onListOpen, onListClose, readOnly }: TeamSizeProps) => JSX.Element;
|
|
9
|
+
declare const TeamSize: ({ show, onListOpen, onListClose, readOnly, isVerified }: TeamSizeProps) => JSX.Element;
|
|
9
10
|
export default TeamSize;
|
|
@@ -10,20 +10,20 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import Collapse from '../../../../components/Collapse';
|
|
14
|
-
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
15
|
-
import Input from '../../../../features/shared/Input';
|
|
16
|
-
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
17
13
|
import React from 'react';
|
|
18
|
-
import { useTranslation } from 'react-i18next';
|
|
19
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
20
|
-
import {
|
|
21
|
-
import SimpleList from '../../../../components/SimpleList';
|
|
22
|
-
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
23
16
|
import Box from '@mui/material/Box';
|
|
24
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
25
19
|
import Text from '../../../../components/Text';
|
|
26
|
-
import
|
|
20
|
+
import Collapse from '../../../../components/Collapse';
|
|
21
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
22
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import Input from '../../../shared/Input';
|
|
25
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
26
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
27
27
|
var InputStyled = styled(Input)(function (_a) {
|
|
28
28
|
var readOnly = _a.readOnly;
|
|
29
29
|
return ({
|
|
@@ -36,27 +36,20 @@ var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop
|
|
|
36
36
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
37
37
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
|
|
38
38
|
});
|
|
39
|
-
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
40
|
-
var theme = _a.theme;
|
|
41
|
-
return ({
|
|
42
|
-
color: theme.palette.success.main,
|
|
43
|
-
display: 'flex',
|
|
44
|
-
alignItems: 'flex-end'
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
39
|
var TeamSize = function (_a) {
|
|
48
|
-
var _b, _c, _d
|
|
49
|
-
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly;
|
|
50
|
-
var
|
|
51
|
-
var
|
|
40
|
+
var _b, _c, _d;
|
|
41
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
42
|
+
var _e = React.useState([]), teamSizeList = _e[0], setTeamSizeList = _e[1];
|
|
43
|
+
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
52
44
|
var t = useTranslation().t;
|
|
53
45
|
var isAr = useLanguage().isAr;
|
|
54
46
|
var data = useAppSelector(brandSelector).data;
|
|
55
47
|
var control = useFormContext().control;
|
|
56
|
-
var
|
|
48
|
+
var list = (data.verify.responseBody || {}).teamSizeList;
|
|
49
|
+
var teamSizesList = list || [];
|
|
57
50
|
var teamSizeControl = useController({ control: control, name: 'teamSize' });
|
|
58
51
|
var teamSize = teamSizeControl.field.value;
|
|
59
|
-
var error = (
|
|
52
|
+
var error = (_b = teamSizeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
60
53
|
React.useEffect(function () {
|
|
61
54
|
if ((teamSizesList === null || teamSizesList === void 0 ? void 0 : teamSizesList.length) > 0) {
|
|
62
55
|
setTeamSizeList(teamSizesList);
|
|
@@ -76,9 +69,9 @@ var TeamSize = function (_a) {
|
|
|
76
69
|
onCloseList();
|
|
77
70
|
teamSizeControl.field.onChange(teamSize);
|
|
78
71
|
};
|
|
79
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { required: true, label: t('team_size_title'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(
|
|
72
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { required: true, label: t('team_size_title'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }), placeholder: t('choose_team_size'), value: (isAr ? (_c = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _c === void 0 ? void 0 : _c.ar : (_d = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _d === void 0 ? void 0 : _d.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: teamSizeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
80
73
|
var _a, _b;
|
|
81
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) && _jsx(
|
|
74
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
82
75
|
} }) }))] })) })));
|
|
83
76
|
};
|
|
84
77
|
export default TeamSize;
|
|
@@ -72,7 +72,7 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({}); });
|
|
|
72
72
|
export var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
73
73
|
var theme = _a.theme;
|
|
74
74
|
return ({
|
|
75
|
-
color: theme.palette.
|
|
75
|
+
color: theme.palette.success.main,
|
|
76
76
|
display: 'flex',
|
|
77
77
|
alignItems: 'flex-end'
|
|
78
78
|
});
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
declare type CustomCheckIconProps = {
|
|
4
|
+
isVerified?: boolean;
|
|
5
|
+
sx?: SxProps<Theme>;
|
|
6
|
+
};
|
|
7
|
+
export default function CustomCheckIcon({ isVerified, sx }: CustomCheckIconProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
3
3
|
import CheckIcon from '@mui/icons-material/Check';
|
|
4
|
-
var
|
|
5
|
-
var theme = _a.theme;
|
|
4
|
+
var CheckIconStyled = styled(CheckIcon, { shouldForwardProp: function (prop) { return prop !== 'isVerified'; } })(function (_a) {
|
|
5
|
+
var theme = _a.theme, isVerified = _a.isVerified;
|
|
6
6
|
return ({
|
|
7
7
|
display: 'flex',
|
|
8
8
|
alignItems: 'flex-end',
|
|
9
|
-
color: theme.palette.success.main
|
|
9
|
+
color: isVerified ? theme.palette.success.main : alpha(theme.palette.success.dark, 0.5)
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
|
-
export default function
|
|
13
|
-
|
|
12
|
+
export default function CustomCheckIcon(_a) {
|
|
13
|
+
var _b = _a.isVerified, isVerified = _b === void 0 ? false : _b, sx = _a.sx;
|
|
14
|
+
return _jsx(CheckIconStyled, { isVerified: isVerified, sx: sx });
|
|
14
15
|
}
|