@tap-payments/auth-jsconnect 2.11.0-sandbox → 2.11.1-development
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/form.d.ts +2 -0
- package/build/api/entity.d.ts +3 -0
- package/build/api/lead.d.ts +1 -0
- package/build/assets/locales/ar.json +9 -10
- package/build/assets/locales/en.json +9 -10
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/app.d.ts +9 -1
- package/build/constants/app.js +6 -4
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/business/businessStore.js +15 -10
- package/build/features/app/connectExpress/connectExpressStore.js +19 -4
- package/build/features/app/terminal/terminalStore.d.ts +2 -1
- package/build/features/app/terminal/terminalStore.js +5 -2
- package/build/features/auth/Auth.d.ts +1 -1
- package/build/features/auth/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/business/screens/BusinessType/BusinessType.js +13 -2
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
- package/build/features/business/screens/BusinessType/LicenseList.js +15 -7
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +31 -10
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +23 -7
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
- package/build/features/entity/screens/EntityName/EntityName.js +2 -1
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +3 -3
- package/build/features/entity/screens/EntityName/validation.js +14 -3
- package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +3 -2
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +2 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +8 -3
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +3 -1
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +19 -10
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +7 -2
- package/build/features/terminal/screens/shared/TerminalList.js +3 -3
- package/build/utils/common.js +3 -3
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +2 -2
- package/build/utils/validation.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
17
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
18
|
+
import Box from '@mui/material/Box';
|
|
19
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
22
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import Tooltip from '../../../../components/Tooltip';
|
|
24
|
+
import Text from '../../../../components/Text';
|
|
25
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
26
|
+
import Input from '../../../shared/Input';
|
|
27
|
+
import { clearError, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
28
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
29
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return ({
|
|
32
|
+
display: 'flex',
|
|
33
|
+
justifyContent: 'space-between',
|
|
34
|
+
padding: theme.spacing(0, 2.5, 1, 2.5)
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
38
|
+
var theme = _a.theme;
|
|
39
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
40
|
+
});
|
|
41
|
+
export var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return ({
|
|
44
|
+
width: theme.spacing(2.75),
|
|
45
|
+
height: theme.spacing(2.125),
|
|
46
|
+
cursor: 'pointer',
|
|
47
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
48
|
+
display: 'inline-flex'
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
52
|
+
var theme = _a.theme;
|
|
53
|
+
return ({
|
|
54
|
+
width: theme.spacing(2.75),
|
|
55
|
+
height: theme.spacing(2.125),
|
|
56
|
+
cursor: 'pointer',
|
|
57
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
58
|
+
display: 'inline-flex'
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var UnifiedNumber = function (_a) {
|
|
62
|
+
var _b;
|
|
63
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
64
|
+
var t = useTranslation().t;
|
|
65
|
+
var bckError = useAppSelector(connectExpressSelector).error;
|
|
66
|
+
var control = useFormContext().control;
|
|
67
|
+
var dispatch = useAppDispatch();
|
|
68
|
+
var _c = React.useState(false), hovered = _c[0], setHovered = _c[1];
|
|
69
|
+
var handleChange = function (_a) {
|
|
70
|
+
var target = _a.target;
|
|
71
|
+
if (bckError)
|
|
72
|
+
dispatch(clearError());
|
|
73
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
74
|
+
unifiedNumberControl.field.onChange(value);
|
|
75
|
+
};
|
|
76
|
+
var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
|
|
77
|
+
var unifiedNumberValue = unifiedNumberControl.field.value || '';
|
|
78
|
+
var error = (_b = unifiedNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
79
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('v1_company_unified_number_label') }), _jsx(Tooltip, __assign({ title: t('v1_company_unified_number_description'), onMouseOver: function () { return setHovered(true); }, onMouseLeave: function () { return setHovered(false); }, onTouchStartCapture: function () { return setHovered(true); } }, { children: hovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('v1_company_unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) })] })) })));
|
|
80
|
+
};
|
|
81
|
+
export default React.memo(UnifiedNumber);
|
|
@@ -15,15 +15,18 @@ export declare const OtherThanKWOrSABusinessDataSchema: (isLeadIdPassed: boolean
|
|
|
15
15
|
export declare const BusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
16
16
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
17
17
|
selectedLicense: any;
|
|
18
|
-
|
|
18
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
19
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
19
20
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
20
21
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
21
22
|
selectedLicense: any;
|
|
22
|
-
|
|
23
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
24
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
23
25
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
26
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
25
27
|
selectedLicense: any;
|
|
26
|
-
|
|
28
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
29
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
27
30
|
}>>>;
|
|
28
31
|
export declare const KWBusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
29
32
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH,
|
|
2
|
+
import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH, BRAND_NAME_MAX_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
3
3
|
import { BusinessType } from '../../../../@types';
|
|
4
4
|
var objectElements = {
|
|
5
5
|
legal_name: yup.object().shape({
|
|
@@ -7,7 +7,7 @@ var objectElements = {
|
|
|
7
7
|
en: yup.string()
|
|
8
8
|
}),
|
|
9
9
|
license: yup.object().shape({
|
|
10
|
-
number: yup.string()
|
|
10
|
+
number: yup.string().nullable()
|
|
11
11
|
}),
|
|
12
12
|
type: yup.string()
|
|
13
13
|
};
|
|
@@ -94,22 +94,40 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
94
94
|
})
|
|
95
95
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
96
96
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
unifiedNumber: yup.string().test({
|
|
98
|
+
name: 'unifiedNumber',
|
|
99
|
+
message: '',
|
|
100
100
|
test: function (value) {
|
|
101
|
+
var _a;
|
|
101
102
|
var selectedLicense = this.parent.selectedLicense;
|
|
102
|
-
var
|
|
103
|
+
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
103
104
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
105
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
106
|
+
return false;
|
|
107
|
+
if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
108
|
+
return true;
|
|
104
109
|
if (length === 0)
|
|
110
|
+
return this.createError({ message: '' });
|
|
111
|
+
return this.createError({ message: 'unified_number_required' });
|
|
112
|
+
}
|
|
113
|
+
}),
|
|
114
|
+
licenseNumber: yup.string().test({
|
|
115
|
+
name: 'licenseNumber',
|
|
116
|
+
message: '',
|
|
117
|
+
test: function (value) {
|
|
118
|
+
var _a;
|
|
119
|
+
var selectedLicense = this.parent.selectedLicense;
|
|
120
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
121
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
122
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
123
|
+
return false;
|
|
124
|
+
if (isCR || length >= FL_MIN_LICENSE_LENGTH)
|
|
105
125
|
return true;
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
126
|
+
if (length === 0)
|
|
127
|
+
return this.createError({ message: '' });
|
|
128
|
+
return this.createError({ message: 'fl_max_length' });
|
|
110
129
|
}
|
|
111
|
-
})
|
|
112
|
-
.required(''),
|
|
130
|
+
}),
|
|
113
131
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond')
|
|
114
132
|
});
|
|
115
133
|
}
|
|
@@ -127,22 +145,40 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
127
145
|
})
|
|
128
146
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
129
147
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
148
|
+
unifiedNumber: yup.string().test({
|
|
149
|
+
name: 'unifiedNumber',
|
|
150
|
+
message: '',
|
|
133
151
|
test: function (value) {
|
|
152
|
+
var _a;
|
|
134
153
|
var selectedLicense = this.parent.selectedLicense;
|
|
135
|
-
var
|
|
154
|
+
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
136
155
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
156
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
157
|
+
return false;
|
|
158
|
+
if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
159
|
+
return true;
|
|
137
160
|
if (length === 0)
|
|
161
|
+
return this.createError({ message: '' });
|
|
162
|
+
return this.createError({ message: 'unified_number_required' });
|
|
163
|
+
}
|
|
164
|
+
}),
|
|
165
|
+
licenseNumber: yup.string().test({
|
|
166
|
+
name: 'licenseNumber',
|
|
167
|
+
message: '',
|
|
168
|
+
test: function (value) {
|
|
169
|
+
var _a;
|
|
170
|
+
var selectedLicense = this.parent.selectedLicense;
|
|
171
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
172
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
173
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
174
|
+
return false;
|
|
175
|
+
if (isCR || length >= FL_MIN_LICENSE_LENGTH)
|
|
138
176
|
return true;
|
|
139
|
-
if (
|
|
140
|
-
return
|
|
141
|
-
}
|
|
142
|
-
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
177
|
+
if (length === 0)
|
|
178
|
+
return this.createError({ message: '' });
|
|
179
|
+
return this.createError({ message: 'fl_max_length' });
|
|
143
180
|
}
|
|
144
181
|
})
|
|
145
|
-
.required('')
|
|
146
182
|
});
|
|
147
183
|
};
|
|
148
184
|
export var KWBusinessDataSchema = function (isLeadIdPassed) {
|
|
@@ -155,8 +155,9 @@ var EntityName = function (_a) {
|
|
|
155
155
|
}, [methods.formState.isValid]);
|
|
156
156
|
var disabled = !methods.formState.isValid || uploading || uploadingArticle;
|
|
157
157
|
var showLicenseNumber = isKWCountry ? isCR : true;
|
|
158
|
+
var showExpiryDate = isSACountry ? !isCR : true;
|
|
158
159
|
var showUnifiedNumber = isSACountry ? isCR : false;
|
|
159
160
|
var disableBack = settingsData.appConfig.mode === 'content';
|
|
160
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(
|
|
161
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified }), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl && showExpiryDate }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: isSACountry ? false : !isKWCountry || isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: !isSACountry, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
161
162
|
};
|
|
162
163
|
export default EntityName;
|
|
@@ -14,7 +14,7 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
|
-
import {
|
|
17
|
+
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
18
18
|
import Collapse from '../../../../components/Collapse';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
@@ -31,7 +31,7 @@ var UnifiedNumber = function (_a) {
|
|
|
31
31
|
var target = _a.target;
|
|
32
32
|
if (bckError)
|
|
33
33
|
dispatch(clearError());
|
|
34
|
-
var value =
|
|
34
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
35
35
|
unifiedNumberControl.field.onChange(value);
|
|
36
36
|
};
|
|
37
37
|
var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
|
|
@@ -6,7 +6,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
6
6
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
7
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
8
8
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
9
|
-
expiryDate:
|
|
9
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
10
10
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
11
11
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
12
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -16,7 +16,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
16
16
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
17
17
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
18
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
19
|
-
expiryDate:
|
|
19
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
20
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
21
21
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
22
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -26,7 +26,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
26
26
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
27
27
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
28
28
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
29
|
-
expiryDate:
|
|
29
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
30
30
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
31
31
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
32
|
}>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { BusinessType } from '../../../../@types';
|
|
3
|
-
import { KW_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
3
|
+
import { KW_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
4
4
|
export var EntityNameValidationSchema = function () {
|
|
5
5
|
return yup.object().shape({
|
|
6
6
|
legalName: yup
|
|
@@ -32,9 +32,20 @@ export var EntityNameValidationSchema = function () {
|
|
|
32
32
|
}
|
|
33
33
|
})
|
|
34
34
|
.required(''),
|
|
35
|
-
unifiedNumber: yup.string().
|
|
35
|
+
unifiedNumber: yup.string().test({
|
|
36
|
+
name: 'unifiedNumber',
|
|
37
|
+
message: '',
|
|
38
|
+
test: function (value) {
|
|
39
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
40
|
+
if (length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
41
|
+
return true;
|
|
42
|
+
if (length === 0)
|
|
43
|
+
return this.createError({ message: '' });
|
|
44
|
+
return this.createError({ message: 'unified_number_required' });
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
36
47
|
issuingDate: yup.string().required('choose_any_issuing_date'),
|
|
37
|
-
expiryDate: yup.string().
|
|
48
|
+
expiryDate: yup.string().optional(),
|
|
38
49
|
certificateId: yup.array().optional(),
|
|
39
50
|
articleId: yup.string().optional()
|
|
40
51
|
});
|
|
@@ -177,7 +177,7 @@ export default function FlowsButtons(_a) {
|
|
|
177
177
|
});
|
|
178
178
|
if (flowName === item.name && !isResetPassword(item.name, item.status)) {
|
|
179
179
|
var isOtherThanSAOrKWCountry = !isKWOrSA(settingsData.businessCountry.iso2);
|
|
180
|
-
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry)));
|
|
180
|
+
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry, data.terminalStepName)));
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
if (typeof settingsData.appConfig.onBoardButtonClick === 'function') {
|
|
@@ -19,6 +19,7 @@ interface SuccessFlowButtonsProps {
|
|
|
19
19
|
onClose?: () => void;
|
|
20
20
|
loading?: boolean;
|
|
21
21
|
status: 'complete' | 'incomplete';
|
|
22
|
+
terminalStepName?: string;
|
|
22
23
|
}
|
|
23
|
-
declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status }: SuccessFlowButtonsProps) => JSX.Element>;
|
|
24
|
+
declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status, terminalStepName }: SuccessFlowButtonsProps) => JSX.Element>;
|
|
24
25
|
export default _default;
|
|
@@ -45,7 +45,7 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
|
45
45
|
});
|
|
46
46
|
var SuccessFlowButtons = function (_a) {
|
|
47
47
|
var _b, _c, _d;
|
|
48
|
-
var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals, recipient = _a.recipient, onClose = _a.onClose, loading = _a.loading, status = _a.status;
|
|
48
|
+
var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals, recipient = _a.recipient, onClose = _a.onClose, loading = _a.loading, status = _a.status, terminalStepName = _a.terminalStepName;
|
|
49
49
|
var _e = useState([]), buttons = _e[0], setButtons = _e[1];
|
|
50
50
|
var t = useTranslation().t;
|
|
51
51
|
var isAr = useLanguage().isAr;
|
|
@@ -127,7 +127,8 @@ var SuccessFlowButtons = function (_a) {
|
|
|
127
127
|
email: email || '',
|
|
128
128
|
emailUrl: url,
|
|
129
129
|
brandName: shortenBrand(brandName),
|
|
130
|
-
isAuthorizedUser: is_authorized
|
|
130
|
+
isAuthorizedUser: is_authorized,
|
|
131
|
+
terminalStepName: terminalStepName
|
|
131
132
|
} }) })] }));
|
|
132
133
|
};
|
|
133
134
|
export default memo(SuccessFlowButtons);
|
|
@@ -16,8 +16,8 @@ export var QRCodeImage = styled(Icon)(function (_a) {
|
|
|
16
16
|
var spacing = _a.theme.spacing;
|
|
17
17
|
return ({
|
|
18
18
|
margin: '0px auto',
|
|
19
|
-
width: spacing(
|
|
20
|
-
height: spacing(
|
|
19
|
+
width: spacing(31.25),
|
|
20
|
+
height: spacing(31.25),
|
|
21
21
|
marginTop: spacing(2.5),
|
|
22
22
|
marginBottom: spacing(2.5)
|
|
23
23
|
});
|
|
@@ -17,9 +17,10 @@ import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
|
17
17
|
import { useTheme } from '@mui/material';
|
|
18
18
|
import { CONNECT_FLOWS, ICONS_NAMES } from '../../../../constants';
|
|
19
19
|
import DeviceCard from '../../../../components/DeviceCard';
|
|
20
|
+
import Warning from '../../../../components/Warning';
|
|
20
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
22
|
import Button from '../../../shared/Button';
|
|
22
|
-
import { terminalSelector, unlinkTerminalDevice } from '../../../app/terminal/terminalStore';
|
|
23
|
+
import { clearError, terminalSelector, unlinkTerminalDevice } from '../../../app/terminal/terminalStore';
|
|
23
24
|
import { Container, getId, getIdLabel, getPairedWith, LinkWithText } from '../shared';
|
|
24
25
|
var LinkedTerminalInfo = function () {
|
|
25
26
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -27,12 +28,16 @@ var LinkedTerminalInfo = function () {
|
|
|
27
28
|
var _h = useTheme(), spacing = _h.spacing, palette = _h.palette;
|
|
28
29
|
var dispatch = useAppDispatch();
|
|
29
30
|
var isAr = useLanguage().isAr;
|
|
30
|
-
var _j = useAppSelector(terminalSelector), selectedTerminalDevice = _j.data.terminalInfo.selectedTerminalDevice, loading = _j.loading;
|
|
31
|
+
var _j = useAppSelector(terminalSelector), error = _j.error, selectedTerminalDevice = _j.data.terminalInfo.selectedTerminalDevice, loading = _j.loading;
|
|
31
32
|
var model = selectedTerminalDevice.model, linked = selectedTerminalDevice.linked, display_name = selectedTerminalDevice.display_name, terminal = selectedTerminalDevice.terminal, platform = selectedTerminalDevice.platform;
|
|
32
33
|
var _k = (model || {}).image_url, image_url = _k === void 0 ? ICONS_NAMES.device_image : _k;
|
|
33
34
|
var deviceName = (_b = (_a = terminal === null || terminal === void 0 ? void 0 : terminal.device) === null || _a === void 0 ? void 0 : _a.display_name) !== null && _b !== void 0 ? _b : (_c = terminal === null || terminal === void 0 ? void 0 : terminal.name) === null || _c === void 0 ? void 0 : _c.en;
|
|
34
35
|
var deviceImage = (_e = (_d = platform === null || platform === void 0 ? void 0 : platform.brand) === null || _d === void 0 ? void 0 : _d.logo) !== null && _e !== void 0 ? _e : ICONS_NAMES.platform_image;
|
|
35
36
|
var deviceId = (_g = (_f = terminal === null || terminal === void 0 ? void 0 : terminal.device) === null || _f === void 0 ? void 0 : _f.id) !== null && _g !== void 0 ? _g : terminal === null || terminal === void 0 ? void 0 : terminal.legacy_id;
|
|
37
|
+
React.useEffect(function () {
|
|
38
|
+
if (error)
|
|
39
|
+
dispatch(clearError());
|
|
40
|
+
}, []);
|
|
36
41
|
var handleOnNext = function () {
|
|
37
42
|
dispatch(unlinkTerminalDevice())
|
|
38
43
|
.unwrap()
|
|
@@ -45,6 +50,6 @@ var LinkedTerminalInfo = function () {
|
|
|
45
50
|
var handleOnBack = function () {
|
|
46
51
|
dispatch(handlePrevScreenStep(CONNECT_FLOWS.terminal.terminalDeviceList));
|
|
47
52
|
};
|
|
48
|
-
return (_jsxs(ScreenContainer, __assign({ minHeight: 224, sx: { pl: 2.5, pr: 2.5 }
|
|
53
|
+
return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(DeviceCard, { badge: true, image: image_url, name: display_name, deviceId: getId(selectedTerminalDevice), deviceIdLabel: getIdLabel(selectedTerminalDevice), pairedWith: getPairedWith(selectedTerminalDevice), isLinked: linked }), _jsx(LinkWithText, { children: t('terminal_linked_with') }), _jsx(DeviceCard, { sx: { minHeight: spacing(10), borderRadius: spacing(1), background: palette.components.deviceCard.deviceInfoBackground }, image: deviceImage || '', name: deviceName || '', deviceId: deviceId !== null && deviceId !== void 0 ? deviceId : '', isLinked: linked })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Button, __assign({ loading: loading, onBackClicked: handleOnBack, onClick: handleOnNext, isAr: isAr }, { children: t('terminal_unlink') }))] })));
|
|
49
54
|
};
|
|
50
55
|
export default React.memo(LinkedTerminalInfo);
|
|
@@ -14,6 +14,8 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
16
16
|
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
17
|
+
import Button from '../../../../components/Button';
|
|
18
|
+
import Loader from '../../../../components/Loader';
|
|
17
19
|
import { ICONS_NAMES } from '../../../../constants';
|
|
18
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
19
21
|
import { linkNewTerminal, retrieveBoardDetails, retrieveBoardStatus, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
@@ -51,6 +53,6 @@ var NoTerminalDeviceLinked = function () {
|
|
|
51
53
|
})
|
|
52
54
|
.catch(function () { });
|
|
53
55
|
};
|
|
54
|
-
return (
|
|
56
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { ml: 2.5, mr: 2.5 }, minHeight: 280, justifyContent: 'space-between' }, { children: [_jsxs(NoTerminalDeviceLinkedContainer, { children: [_jsx(DeviceImage, { src: ICONS_NAMES.terminal_device }), _jsx(TitleTypography, { children: t('terminal_no_terminal_linked') }), _jsx(DescriptionTypography, { children: t('terminal_no_terminal_linked_description') })] }), _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') }))] })));
|
|
55
57
|
};
|
|
56
58
|
export default React.memo(NoTerminalDeviceLinked);
|
|
@@ -13,19 +13,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { memo } from 'react';
|
|
14
14
|
import { settingsSelector } from '../../../../app/settings';
|
|
15
15
|
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
16
|
-
import { SCOPE_AUTH } from '../../../../constants';
|
|
16
|
+
import { CONNECT_FLOWS, SCOPE_AUTH } from '../../../../constants';
|
|
17
17
|
import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
|
|
18
18
|
import { onCloseCompleteTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
19
19
|
var SuccessWithFlowButtons = function () {
|
|
20
|
+
var _a;
|
|
20
21
|
var dispatch = useAppDispatch();
|
|
21
|
-
var
|
|
22
|
+
var _b = useAppSelector(terminalSelector), data = _b.data, loading = _b.loading;
|
|
22
23
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
23
24
|
var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
25
|
+
var _c = data.responseData || {}, boardFlows = _c.boardFlows, boardData = _c.boardData, terminalData = _c.terminalData;
|
|
26
|
+
var _d = boardData || {}, entity = _d.entity, brand = _d.brand, bank = _d.bank_account, merchant = _d.merchant, user = _d.user, business = _d.business, board_id = _d.board_id, board_info_id = _d.board_info_id, name = _d.name, individuals = _d.individuals, recipient = _d.recipient, board_status = _d.board_status;
|
|
26
27
|
var onClose = function () {
|
|
27
28
|
dispatch(onCloseCompleteTerminal());
|
|
28
29
|
};
|
|
29
|
-
return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status }));
|
|
30
|
+
return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status, terminalStepName: ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.terminal_devices) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked }));
|
|
30
31
|
};
|
|
31
32
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -54,13 +54,15 @@ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/sett
|
|
|
54
54
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
55
55
|
import Button from '../../../../components/Button';
|
|
56
56
|
import Loader from '../../../../components/Loader';
|
|
57
|
-
import
|
|
57
|
+
import Warning from '../../../../components/Warning';
|
|
58
|
+
import Box from '@mui/material/Box';
|
|
59
|
+
import { clearError, resetTerminalLinkResponse, retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalList, storeSelectedTerminalDevice, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
58
60
|
import { Header, Container, TextTypography } from '../shared';
|
|
59
61
|
import DeviceList from './DeviceList';
|
|
60
62
|
var TerminalDeviceList = function () {
|
|
61
63
|
var t = useTranslation().t;
|
|
62
64
|
var dispatch = useAppDispatch();
|
|
63
|
-
var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading, terminalListLoading = _a.terminalListLoading;
|
|
65
|
+
var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading, terminalListLoading = _a.terminalListLoading, error = _a.error;
|
|
64
66
|
var _b = React.useState(false), newLinkClicked = _b[0], setNewLinkClicked = _b[1];
|
|
65
67
|
var _c = data.responseData || {}, boardFlows = _c.boardFlows, authData = _c.authData, boardData = _c.boardData, terminalData = _c.terminalData, terminalList = _c.terminalList;
|
|
66
68
|
var terminal_devices = (terminalData || {}).terminal_devices;
|
|
@@ -74,26 +76,34 @@ var TerminalDeviceList = function () {
|
|
|
74
76
|
switch (_a.label) {
|
|
75
77
|
case 0:
|
|
76
78
|
setNewLinkClicked(true);
|
|
77
|
-
return [4, retrieveTerminalListAsync()];
|
|
79
|
+
return [4, retrieveTerminalListAsync(CONNECT_FLOWS.terminal.terminalList)];
|
|
78
80
|
case 1:
|
|
79
81
|
_a.sent();
|
|
80
|
-
dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.terminalList));
|
|
81
82
|
return [2];
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
}); };
|
|
85
|
-
|
|
86
|
+
React.useEffect(function () {
|
|
87
|
+
if (error)
|
|
88
|
+
dispatch(clearError());
|
|
89
|
+
dispatch(resetTerminalLinkResponse());
|
|
90
|
+
}, []);
|
|
91
|
+
var retrieveTerminalListAsync = function (nextScreen) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
92
|
var err_1;
|
|
87
93
|
return __generator(this, function (_a) {
|
|
88
94
|
switch (_a.label) {
|
|
89
95
|
case 0:
|
|
90
|
-
if (
|
|
96
|
+
if (terminalList === null || terminalList === void 0 ? void 0 : terminalList.length) {
|
|
97
|
+
dispatch(handleNextScreenStep(nextScreen));
|
|
98
|
+
return [2];
|
|
99
|
+
}
|
|
91
100
|
_a.label = 1;
|
|
92
101
|
case 1:
|
|
93
102
|
_a.trys.push([1, 3, , 4]);
|
|
94
|
-
return [4, dispatch(retrieveTerminalList())];
|
|
103
|
+
return [4, dispatch(retrieveTerminalList()).unwrap()];
|
|
95
104
|
case 2:
|
|
96
105
|
_a.sent();
|
|
106
|
+
dispatch(handleNextScreenStep(nextScreen));
|
|
97
107
|
return [3, 4];
|
|
98
108
|
case 3:
|
|
99
109
|
err_1 = _a.sent();
|
|
@@ -113,10 +123,9 @@ var TerminalDeviceList = function () {
|
|
|
113
123
|
case 0:
|
|
114
124
|
setNewLinkClicked(false);
|
|
115
125
|
dispatch(storeSelectedTerminalDevice(terminal));
|
|
116
|
-
return [4, retrieveTerminalListAsync()];
|
|
126
|
+
return [4, retrieveTerminalListAsync(CONNECT_FLOWS.terminal.unlinkedTerminalInfo)];
|
|
117
127
|
case 1:
|
|
118
128
|
_a.sent();
|
|
119
|
-
dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.unlinkedTerminalInfo));
|
|
120
129
|
return [2];
|
|
121
130
|
}
|
|
122
131
|
});
|
|
@@ -139,6 +148,6 @@ var TerminalDeviceList = function () {
|
|
|
139
148
|
})
|
|
140
149
|
.catch(function () { });
|
|
141
150
|
};
|
|
142
|
-
return (_jsxs(ScreenContainer, __assign({ minHeight: 200, sx: { pl: 2.5, pr: 2.5 }
|
|
151
|
+
return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { onLinkClick: handleOnClickNewTerminalLink, loading: terminalListLoading && newLinkClicked }), _jsx(DeviceList, { devices: linkedDevices, onClick: handleOnClickLinkedTerminal }), !!(unLinkedDevices === null || unLinkedDevices === void 0 ? void 0 : unLinkedDevices.length) && !!(linkedDevices === null || linkedDevices === void 0 ? void 0 : linkedDevices.length) && _jsx(TextTypography, __assign({ sx: { pt: 1, pb: 1 } }, { children: t('terminal_unlinked') })), _jsx(DeviceList, { loading: terminalListLoading && !newLinkClicked, devices: unLinkedDevices, onClick: handleOnClickUnlinkedTerminal })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') })) }))] })));
|
|
143
152
|
};
|
|
144
153
|
export default React.memo(TerminalDeviceList);
|
|
@@ -12,18 +12,23 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
15
16
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
16
17
|
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
17
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
19
|
import Button from '../../../../components/Button';
|
|
19
20
|
import Warning from '../../../../components/Warning';
|
|
20
|
-
import { linkNewTerminal, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
21
|
+
import { clearError, linkNewTerminal, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
21
22
|
import { Header, Container, TerminalList } from '../shared';
|
|
22
23
|
var TerminalListPage = function () {
|
|
23
24
|
var t = useTranslation().t;
|
|
24
25
|
var dispatch = useAppDispatch();
|
|
25
26
|
var _a = useAppSelector(terminalSelector), _b = _a.data, selectedTerminal = _b.terminalInfo.selectedTerminal, responseData = _b.responseData, loading = _a.loading, error = _a.error;
|
|
26
27
|
var terminalList = (responseData || {}).terminalList;
|
|
28
|
+
React.useEffect(function () {
|
|
29
|
+
if (error)
|
|
30
|
+
dispatch(clearError());
|
|
31
|
+
}, []);
|
|
27
32
|
var handleOnSelectTerminal = function (terminal) {
|
|
28
33
|
dispatch(storeSelectedTerminal(terminal));
|
|
29
34
|
dispatch(linkNewTerminal())
|
|
@@ -37,6 +42,6 @@ var TerminalListPage = function () {
|
|
|
37
42
|
var handleOnBack = function () {
|
|
38
43
|
dispatch(handlePrevScreenStep());
|
|
39
44
|
};
|
|
40
|
-
return (_jsxs(ScreenContainer, __assign({
|
|
45
|
+
return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { title: 'terminal_select_device', sx: { pb: 0 } }), _jsx(TerminalList, { select: false, loading: loading, selectedTerminal: selectedTerminal, list: terminalList, onClick: handleOnSelectTerminal })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: t('back') })) }))] })));
|
|
41
46
|
};
|
|
42
47
|
export default React.memo(TerminalListPage);
|