@tap-payments/auth-jsconnect 2.3.78-test → 2.3.83-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 +8 -0
- package/build/@types/form.d.ts +2 -1
- package/build/api/index.d.ts +1 -0
- package/build/api/individual.d.ts +1 -0
- package/build/api/individual.js +15 -1
- package/build/api/lead.d.ts +1 -0
- package/build/assets/locales/ar.json +5 -1
- package/build/assets/locales/en.json +5 -1
- package/build/constants/dummy.d.ts +8 -0
- package/build/constants/dummy.js +8 -0
- package/build/features/app/brand/brandStore.d.ts +3 -3
- package/build/features/app/brand/brandStore.js +133 -114
- package/build/features/app/connect/connectStore.js +66 -35
- package/build/features/app/entity/entityStore.d.ts +3 -3
- package/build/features/app/entity/entityStore.js +130 -120
- package/build/features/app/tax/taxStore.d.ts +2 -2
- package/build/features/app/tax/taxStore.js +59 -55
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +3 -2
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +3 -11
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +7 -6
- package/build/features/connect/screens/Merchant/BusinessList.d.ts +10 -0
- package/build/features/connect/screens/Merchant/BusinessList.js +82 -0
- package/build/features/connect/screens/Merchant/Merchant.js +11 -6
- package/build/features/connect/screens/Merchant/validation.d.ts +7 -1
- package/build/features/connect/screens/Merchant/validation.js +6 -2
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +3 -2
- package/build/features/entity/screens/EntityName/EntityName.js +3 -2
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +4 -3
- package/package.json +1 -1
|
@@ -165,62 +165,66 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
}); });
|
|
168
|
-
export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
168
|
+
export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunkApi) {
|
|
169
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
170
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
171
|
+
var _b, settings, tax, _c, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, vatId, confirmPolicy, documentId, requestBody, data, documentBody, _d, documentBody, _e;
|
|
172
|
+
var _f, _g, _h, _j;
|
|
173
|
+
return __generator(this, function (_k) {
|
|
174
|
+
switch (_k.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
_b = thunkApi.getState(), settings = _b.settings, tax = _b.tax;
|
|
177
|
+
_c = ((_f = tax.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.entity) || {}, id = _c.id, data_status = _c.data_status, documents = _c.documents;
|
|
178
|
+
isTaxNumberNonEditable = hasNoneEditableValue(data_status, 'tax_number');
|
|
179
|
+
isConfirmPolicyNonEditable = hasNoneEditableValue(data_status, 'is_vat_acknowledged');
|
|
180
|
+
isDocumentsNonEditable = hasNoneEditableValue(data_status, 'documents');
|
|
181
|
+
document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.TAX_DOCUMENT);
|
|
182
|
+
vatId = formData.vatId, confirmPolicy = formData.confirmPolicy, documentId = formData.documentId;
|
|
183
|
+
requestBody = {
|
|
184
|
+
id: id,
|
|
185
|
+
vat_id: isTaxNumberNonEditable ? undefined : vatId,
|
|
186
|
+
step_name: TAX_STEP_NAMES.TAX_INFO,
|
|
187
|
+
is_vat_acknowledged: isConfirmPolicyNonEditable ? undefined : confirmPolicy
|
|
188
|
+
};
|
|
189
|
+
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
190
|
+
case 1:
|
|
191
|
+
data = (_k.sent()).data;
|
|
192
|
+
if ((_g = data.errors) === null || _g === void 0 ? void 0 : _g.length)
|
|
193
|
+
throw new Error(data.errors[0].description);
|
|
194
|
+
if (!(!isDocumentsNonEditable && (documentId || []).length > 0)) return [3, 5];
|
|
195
|
+
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
|
|
196
|
+
documentBody = {
|
|
197
|
+
id: document === null || document === void 0 ? void 0 : document.id,
|
|
198
|
+
images: documentId
|
|
199
|
+
};
|
|
200
|
+
_d = data;
|
|
201
|
+
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
202
|
+
case 2:
|
|
203
|
+
_d.documentData = _k.sent();
|
|
204
|
+
return [3, 5];
|
|
205
|
+
case 3:
|
|
206
|
+
documentBody = {
|
|
207
|
+
entity_id: id || '',
|
|
208
|
+
documents: [
|
|
209
|
+
{
|
|
210
|
+
type: DocumentPurpose.TAX_DOCUMENT,
|
|
211
|
+
images: documentId
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
};
|
|
215
|
+
_e = data;
|
|
216
|
+
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
217
|
+
case 4:
|
|
218
|
+
_e.documentData = _k.sent();
|
|
219
|
+
_k.label = 5;
|
|
220
|
+
case 5:
|
|
221
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
222
|
+
(_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
|
|
223
|
+
return [2, { data: data, formData: originalFormData }];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
222
226
|
});
|
|
223
|
-
});
|
|
227
|
+
});
|
|
224
228
|
export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
225
229
|
var _a, settings, tax, _b, id, infoId, payload, data, boardInfoData, boardData;
|
|
226
230
|
var _c, _d, _e, _f, _g;
|
|
@@ -15,7 +15,7 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
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 } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { BrandActivitiesValidationSchema } from './validation';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
@@ -70,8 +70,9 @@ var BrandActivities = function (_a) {
|
|
|
70
70
|
'terms'
|
|
71
71
|
]);
|
|
72
72
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
73
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
73
74
|
var onSubmit = function (data) {
|
|
74
|
-
dispatch(updateBrandActivities(data));
|
|
75
|
+
dispatch(updateBrandActivities(getFelids(data)));
|
|
75
76
|
};
|
|
76
77
|
var onBack = function () {
|
|
77
78
|
dispatch(handlePrevScreenStep());
|
|
@@ -33,7 +33,6 @@ import ExpandIcon from '../../../../components/ExpandIcon';
|
|
|
33
33
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
34
|
import { CheckIconStyled, InputLabelStyled, NameContainer } from './CustomerBase';
|
|
35
35
|
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
36
|
-
import Search from '../../../shared/Search';
|
|
37
36
|
import Input from '../../../shared/Input';
|
|
38
37
|
var InputStyled = styled(Input)(function (_a) {
|
|
39
38
|
var theme = _a.theme, readOnly = _a.readOnly;
|
|
@@ -94,17 +93,10 @@ var ExpectedCustomers = function (_a) {
|
|
|
94
93
|
dispatch(clearError());
|
|
95
94
|
onCloseList();
|
|
96
95
|
};
|
|
97
|
-
var handleSearch = function (value) {
|
|
98
|
-
var _a;
|
|
99
|
-
var filteredList = (_a = response === null || response === void 0 ? void 0 : response.expectedCustomerSales) === null || _a === void 0 ? void 0 : _a.filter(function (customer) {
|
|
100
|
-
return customer.name.en.toLowerCase().startsWith(value.toLowerCase()) || customer.name.ar.toLowerCase().startsWith(value.toLowerCase());
|
|
101
|
-
});
|
|
102
|
-
setExpectedCustomersList(filteredList);
|
|
103
|
-
};
|
|
104
96
|
var expectedCustomersValue = expectedCustomerControl.field.value;
|
|
105
97
|
var expectedCustomersSelected = expectedCustomersValue;
|
|
106
|
-
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(ExpandIcon, { anchorEl: !!anchorEl }) }),
|
|
107
|
-
|
|
108
|
-
|
|
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(ExpandIcon, { anchorEl: !!anchorEl }) }), _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) {
|
|
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(CheckIconStyled, {})] }));
|
|
100
|
+
} }) }))] }) })));
|
|
109
101
|
};
|
|
110
102
|
export default ExpectedCustomers;
|
|
@@ -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 } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { BrandValidationSchema } from './validation';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
@@ -60,8 +60,13 @@ var BrandInfo = function (_a) {
|
|
|
60
60
|
mode: 'onChange'
|
|
61
61
|
});
|
|
62
62
|
useSetFromDefaultValues(methods, data.brandData, true);
|
|
63
|
+
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
64
|
+
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
65
|
+
var noneEditable = useDataNoneEditable(data_status, ['name', 'segment.type', 'segment.teams', 'channel_services']);
|
|
66
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
67
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
63
68
|
var onSubmit = function (data) {
|
|
64
|
-
dispatch(updateBrand(data));
|
|
69
|
+
dispatch(updateBrand(getFelids(data)));
|
|
65
70
|
};
|
|
66
71
|
var onBack = function () {
|
|
67
72
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
|
|
@@ -87,10 +92,6 @@ var BrandInfo = function (_a) {
|
|
|
87
92
|
var handleMenuClick = function (flag) {
|
|
88
93
|
setListActive(flag);
|
|
89
94
|
};
|
|
90
|
-
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
91
|
-
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
92
|
-
var noneEditable = useDataNoneEditable(data_status, ['name', 'segment.type', 'segment.teams', 'channel_services']);
|
|
93
|
-
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
94
95
|
var isSegmentsListActive = listActive === ListType.SegmentsList;
|
|
95
96
|
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
96
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') }))] }))] })) })) }));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BusinessInfo } from '../../../../@types';
|
|
3
|
+
interface BusinessListProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
list: Array<BusinessInfo>;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BusinessListProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import { useTranslation } from 'react-i18next';
|
|
26
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
27
|
+
import Box from '@mui/material/Box';
|
|
28
|
+
import { styled } from '@mui/material/styles';
|
|
29
|
+
import { useLanguage } from '../../../../hooks';
|
|
30
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
31
|
+
import Text from '../../../../components/Text';
|
|
32
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
|
+
import Collapse from '../../../../components/Collapse';
|
|
34
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
35
|
+
import Input from '../../../shared/Input';
|
|
36
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
37
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
38
|
+
'& .MuiInputBase-input': {
|
|
39
|
+
cursor: 'pointer'
|
|
40
|
+
}
|
|
41
|
+
}); });
|
|
42
|
+
var BusinessContainer = styled(Box)(function () { return ({
|
|
43
|
+
display: 'flex'
|
|
44
|
+
}); });
|
|
45
|
+
var BusinessNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
46
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
47
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
48
|
+
});
|
|
49
|
+
var BusinessList = function (_a) {
|
|
50
|
+
var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
|
|
51
|
+
var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
52
|
+
var t = useTranslation().t;
|
|
53
|
+
var isAr = useLanguage().isAr;
|
|
54
|
+
var control = useFormContext().control;
|
|
55
|
+
var businessControl = useController({ control: control, name: 'business' });
|
|
56
|
+
var business = businessControl.field.value;
|
|
57
|
+
var onOpenBusinessList = function (event) {
|
|
58
|
+
var _a;
|
|
59
|
+
setAnchorEl(event.currentTarget);
|
|
60
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
61
|
+
};
|
|
62
|
+
var onCloseBusinessList = function () {
|
|
63
|
+
var _a;
|
|
64
|
+
setAnchorEl(null);
|
|
65
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
66
|
+
};
|
|
67
|
+
var getBusinessName = function (business) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return (isAr ? (_a = business === null || business === void 0 ? void 0 : business.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = business === null || business === void 0 ? void 0 : business.name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
70
|
+
};
|
|
71
|
+
var getBusinessId = function (item) {
|
|
72
|
+
return (item === null || item === void 0 ? void 0 : item.id) || '';
|
|
73
|
+
};
|
|
74
|
+
var onSelectItem = function (business) {
|
|
75
|
+
businessControl.field.onChange(business);
|
|
76
|
+
onCloseBusinessList();
|
|
77
|
+
};
|
|
78
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { label: t('select_business_label'), onClick: !!anchorEl ? onCloseBusinessList : onOpenBusinessList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_business'), value: t(getBusinessName(business)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', searchValuePath: ['id', 'name.ar', 'name.en'], list: list, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
79
|
+
return (_jsxs(_Fragment, { children: [_jsx(BusinessContainer, { children: _jsx(BusinessNameText, __assign({ isSelected: getBusinessId(item) === getBusinessId(business) }, { children: t(getBusinessName(item)) })) }), getBusinessId(item) === getBusinessId(business) && _jsx(CheckIcon, {})] }));
|
|
80
|
+
} }) }))] })) })));
|
|
81
|
+
};
|
|
82
|
+
export default React.memo(BusinessList);
|
|
@@ -29,29 +29,33 @@ import TAC from './TAC';
|
|
|
29
29
|
import BrandList from './BrandList';
|
|
30
30
|
import SalesChannels from './SalesChannels';
|
|
31
31
|
import Segments from './Segments';
|
|
32
|
+
import BusinessList from './BusinessList';
|
|
32
33
|
var ListType;
|
|
33
34
|
(function (ListType) {
|
|
34
35
|
ListType["SegmentsList"] = "SegmentsList";
|
|
35
36
|
ListType["TeamSizeList"] = "TeamSizeList";
|
|
36
37
|
ListType["BrandList"] = "BrandList";
|
|
38
|
+
ListType["BusinessList"] = "BusinessList";
|
|
37
39
|
})(ListType || (ListType = {}));
|
|
38
40
|
var Merchant = function (_a) {
|
|
39
41
|
var _b, _c;
|
|
40
42
|
var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
|
|
41
43
|
var _e = React.useState(false), isRequiredNewBrand = _e[0], setIsRequiredNewBrand = _e[1];
|
|
42
44
|
var _f = useAppSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error;
|
|
43
|
-
var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels, segment = _g.segment, teamSize = _g.teamSize;
|
|
44
|
-
var
|
|
45
|
-
var
|
|
45
|
+
var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels, segment = _g.segment, teamSize = _g.teamSize, business = _g.business;
|
|
46
|
+
var _h = responseBody || {}, brandList = _h.brand_list, businessList = _h.business_list;
|
|
47
|
+
var _j = React.useState(), listActive = _j[0], setListActive = _j[1];
|
|
48
|
+
var hasBusinessList = (businessList === null || businessList === void 0 ? void 0 : businessList.length) > 0;
|
|
46
49
|
var methods = useForm({
|
|
47
|
-
resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
|
|
50
|
+
resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand, hasBusinessList)),
|
|
48
51
|
defaultValues: {
|
|
49
52
|
brandName: brandName || ((_b = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.name) === null || _b === void 0 ? void 0 : _b.en),
|
|
50
53
|
selectedBrandItem: selectedBrandItem,
|
|
51
54
|
termAndConditionChecked: termAndConditionChecked,
|
|
52
55
|
salesChannels: salesChannels,
|
|
53
56
|
segment: segment,
|
|
54
|
-
teamSize: teamSize
|
|
57
|
+
teamSize: teamSize,
|
|
58
|
+
business: business
|
|
55
59
|
},
|
|
56
60
|
mode: 'onChange'
|
|
57
61
|
});
|
|
@@ -97,6 +101,7 @@ var Merchant = function (_a) {
|
|
|
97
101
|
var isSegmentsListActive = listActive === ListType.SegmentsList;
|
|
98
102
|
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
99
103
|
var isBrandListActive = listActive === ListType.BrandList;
|
|
100
|
-
|
|
104
|
+
var isBusinessListActive = listActive === ListType.BusinessList;
|
|
105
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: hasBrandList && !isTeamSizeListActive && !isSegmentsListActive && !isBusinessListActive, list: brandList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BusinessList, { show: hasBusinessList && (isOtherBrand || isNewBrand) && !isTeamSizeListActive && !isSegmentsListActive && !isBrandListActive, list: businessList, onListOpen: function () { return handleMenuClick(ListType.BusinessList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Segments, { show: !isTeamSizeListActive && !isBrandListActive && !isBusinessListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentsListActive && !isBrandListActive && !isBusinessListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !listActive }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
101
106
|
};
|
|
102
107
|
export default React.memo(Merchant);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
2
|
+
export declare const MerchantValidationSchema: (isNewBrand?: boolean, hasBusinessList?: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
3
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
4
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
5
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -9,8 +9,10 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
|
|
|
9
9
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
10
10
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
11
|
}>>[] | undefined>;
|
|
12
|
+
business: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
12
13
|
segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
13
14
|
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
15
|
+
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
14
16
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
17
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
16
18
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
@@ -21,8 +23,10 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
|
|
|
21
23
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
22
24
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
25
|
}>>[] | undefined>;
|
|
26
|
+
business: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
24
27
|
segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
25
28
|
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
29
|
+
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
26
30
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
27
31
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
28
32
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
@@ -33,6 +37,8 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
|
|
|
33
37
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
34
38
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
35
39
|
}>>[] | undefined>;
|
|
40
|
+
business: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
36
41
|
segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
37
42
|
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
43
|
+
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
38
44
|
}>>>;
|
|
@@ -69,8 +69,9 @@ var validationSalesChannels = function (channels) {
|
|
|
69
69
|
}
|
|
70
70
|
return true;
|
|
71
71
|
};
|
|
72
|
-
export var MerchantValidationSchema = function (isNewBrand) {
|
|
72
|
+
export var MerchantValidationSchema = function (isNewBrand, hasBusinessList) {
|
|
73
73
|
if (isNewBrand === void 0) { isNewBrand = true; }
|
|
74
|
+
if (hasBusinessList === void 0) { hasBusinessList = false; }
|
|
74
75
|
if (isNewBrand)
|
|
75
76
|
return yup.object().shape({
|
|
76
77
|
brandName: yup
|
|
@@ -88,6 +89,7 @@ export var MerchantValidationSchema = function (isNewBrand) {
|
|
|
88
89
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
|
|
89
90
|
segment: yup.object().required('alert_choose_segment'),
|
|
90
91
|
teamSize: yup.object().required('alert_choose_teamSize'),
|
|
92
|
+
business: hasBusinessList ? yup.object().required('alert_choose_business') : yup.object().optional(),
|
|
91
93
|
salesChannels: yup
|
|
92
94
|
.array()
|
|
93
95
|
.min(1, 'choose_atleast_one_channel')
|
|
@@ -128,7 +130,9 @@ export var MerchantValidationSchema = function (isNewBrand) {
|
|
|
128
130
|
}
|
|
129
131
|
})
|
|
130
132
|
.required('choose_atleast_one_channel'),
|
|
133
|
+
business: yup.object().optional(),
|
|
131
134
|
segment: yup.object().required('alert_choose_segment'),
|
|
132
|
-
teamSize: yup.object().required('alert_choose_teamSize')
|
|
135
|
+
teamSize: yup.object().required('alert_choose_teamSize'),
|
|
136
|
+
brandName: yup.string().optional()
|
|
133
137
|
});
|
|
134
138
|
};
|
|
@@ -15,7 +15,7 @@ import { FormProvider, useForm } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import Collapse from '@mui/material/Collapse';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
19
|
import { clearError, entitySelector, updateEntityCapital } from '../../../app/entity/entityStore';
|
|
20
20
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
21
21
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
@@ -58,8 +58,9 @@ var EntityCapital = function (_a) {
|
|
|
58
58
|
'capital.shares.value'
|
|
59
59
|
]);
|
|
60
60
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
61
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
61
62
|
var onSubmit = function (data) {
|
|
62
|
-
dispatch(updateEntityCapital(data));
|
|
63
|
+
dispatch(updateEntityCapital(getFelids(data)));
|
|
63
64
|
};
|
|
64
65
|
var onBack = function () {
|
|
65
66
|
dispatch(handlePrevScreenStep());
|
|
@@ -15,7 +15,7 @@ import { FormProvider, useForm } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import { getFileDetailsFromDocument, isKW, isSA } from '../../../../utils';
|
|
21
21
|
import { BusinessType, DocumentPurpose } from '../../../../@types';
|
|
@@ -83,8 +83,9 @@ var EntityName = function (_a) {
|
|
|
83
83
|
'AOA_file_id'
|
|
84
84
|
]);
|
|
85
85
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
86
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
86
87
|
var onSubmit = function (data) {
|
|
87
|
-
dispatch(updateEntityName(data));
|
|
88
|
+
dispatch(updateEntityName(getFelids(data)));
|
|
88
89
|
};
|
|
89
90
|
var handleIssueDateOpenClose = function (flag) {
|
|
90
91
|
setIssueAnchorEl(flag);
|
|
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import Form from '../../../../components/Form';
|
|
19
|
-
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
21
|
import { DocumentPurpose } from '../../../../@types';
|
|
22
22
|
import { getFileDetailsFromDocument, isSA } from '../../../../utils';
|
|
@@ -53,11 +53,12 @@ var TaxDetails = function () {
|
|
|
53
53
|
var originalReadOnly = useFormReadOnly(methods, { documentId: defaultTaxFiles });
|
|
54
54
|
var noneEditable = useDataNoneEditable(entity === null || entity === void 0 ? void 0 : entity.data_status, ['tax_number', 'documents', 'is_vat_acknowledged']);
|
|
55
55
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
56
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
56
57
|
var t = useTranslation().t;
|
|
57
58
|
var isAr = useLanguage().isAr;
|
|
58
59
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
59
60
|
var onSubmit = function (data) {
|
|
60
|
-
dispatch(updateTaxInfo(data));
|
|
61
|
+
dispatch(updateTaxInfo(getFelids(data)));
|
|
61
62
|
};
|
|
62
63
|
var onBack = function () {
|
|
63
64
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
|
|
@@ -66,6 +67,6 @@ var TaxDetails = function () {
|
|
|
66
67
|
}
|
|
67
68
|
dispatch(retrieveBoardStatus());
|
|
68
69
|
};
|
|
69
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: readOnly['vatId'] || noneEditable['tax_number'] }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: readOnly['documentId'] || noneEditable['documents'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['
|
|
70
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: readOnly['vatId'] || noneEditable['tax_number'] }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: readOnly['documentId'] || noneEditable['documents'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_vat_acknowledged'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid || uploading, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
70
71
|
};
|
|
71
72
|
export default TaxDetails;
|