@tap-payments/auth-jsconnect 2.10.14-beta → 2.10.14-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/README.md +2 -2
- package/build/@types/app.d.ts +4 -2
- package/build/@types/app.js +2 -0
- package/build/@types/form.d.ts +6 -0
- package/build/@types/index.d.ts +1 -0
- package/build/@types/index.js +1 -0
- package/build/@types/terminal.d.ts +116 -0
- package/build/@types/terminal.js +1 -0
- package/build/api/auth.d.ts +10 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/index.d.ts +7 -1
- package/build/api/index.js +3 -1
- package/build/api/lead.d.ts +1 -0
- package/build/api/terminal.d.ts +28 -0
- package/build/api/terminal.js +45 -0
- package/build/app/rootReducer.d.ts +1 -0
- package/build/app/rootReducer.js +3 -1
- package/build/app/store.d.ts +2 -0
- package/build/assets/currencies/AEDSymbol.d.ts +7 -0
- package/build/assets/currencies/AEDSymbol.js +28 -0
- package/build/assets/currencies/index.d.ts +2 -2
- package/build/assets/currencies/index.js +2 -2
- package/build/assets/currencies/utils.js +3 -1
- package/build/assets/locales/ar.json +47 -11
- package/build/assets/locales/en.json +50 -14
- package/build/components/DeviceCard/DeviceCard.d.ts +18 -0
- package/build/components/DeviceCard/DeviceCard.js +103 -0
- package/build/components/DeviceCard/index.d.ts +3 -0
- package/build/components/DeviceCard/index.js +2 -0
- package/build/components/OTPTimer/OTPTimer.d.ts +2 -1
- package/build/components/OTPTimer/OTPTimer.js +4 -4
- package/build/components/TextWithCurrency/TextWithCurrency.js +1 -1
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/api.d.ts +0 -1
- package/build/constants/api.js +0 -2
- package/build/constants/app.d.ts +13 -3
- package/build/constants/app.js +127 -6
- package/build/constants/assets.d.ts +11 -6
- package/build/constants/assets.js +118 -107
- package/build/constants/dummy.js +27 -20
- package/build/constants/flows.d.ts +15 -0
- package/build/constants/flows.js +15 -0
- package/build/constants/validation.d.ts +2 -0
- package/build/constants/validation.js +2 -0
- package/build/features/app/auth/authStore.d.ts +24 -5
- package/build/features/app/auth/authStore.js +143 -77
- package/build/features/app/business/businessStore.js +5 -4
- package/build/features/app/connectExpress/connectExpressStore.js +14 -10
- package/build/features/app/individual/individualStore.js +0 -1
- package/build/features/app/tax/taxStore.js +1 -1
- package/build/features/app/terminal/terminalStore.d.ts +110 -0
- package/build/features/app/terminal/terminalStore.js +676 -0
- package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +14 -8
- package/build/features/auth/screens/AuthenticationList/UnifiedNumber.d.ts +35 -0
- package/build/features/auth/screens/AuthenticationList/UnifiedNumber.js +80 -0
- package/build/features/auth/screens/AuthenticationList/validation.d.ts +22 -0
- package/build/features/auth/screens/AuthenticationList/validation.js +77 -1
- package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
- package/build/features/auth/screens/OTP/OTP.js +15 -3
- package/build/features/auth/screens/OTP/index.d.ts +1 -2
- package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
- package/build/features/auth/screens/Passcode/Passcode.js +82 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
- package/build/features/auth/screens/Passcode/index.d.ts +2 -0
- package/build/features/auth/screens/Passcode/index.js +2 -0
- package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
- package/build/features/auth/screens/Passcode/validation.js +4 -0
- package/build/features/business/screens/BusinessType/BusinessType.js +12 -2
- package/build/features/business/screens/BusinessType/LicenseList.js +4 -1
- 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 -7
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +14 -9
- package/build/features/connectExpress/screens/AuthenticationList/UnifiedNumber.d.ts +35 -0
- package/build/features/connectExpress/screens/AuthenticationList/UnifiedNumber.js +80 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +22 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.js +77 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +13 -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 +21 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +44 -13
- 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/featuresScreens.d.ts +1 -0
- package/build/features/featuresScreens.js +72 -0
- package/build/features/shared/Button/Button.js +2 -3
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/PushNotification/PushNotification.d.ts +11 -0
- package/build/features/shared/PushNotification/PushNotification.js +34 -0
- package/build/features/shared/PushNotification/index.d.ts +2 -0
- package/build/features/shared/PushNotification/index.js +2 -0
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
- package/build/features/terminal/Terminal.d.ts +14 -0
- package/build/features/terminal/Terminal.js +95 -0
- package/build/features/terminal/index.d.ts +1 -0
- package/build/features/terminal/index.js +1 -0
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.d.ts +3 -0
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +69 -0
- package/build/features/terminal/screens/LinkNewTerminal/index.d.ts +2 -0
- package/build/features/terminal/screens/LinkNewTerminal/index.js +2 -0
- package/build/features/terminal/screens/LinkNewTerminal/styles.d.ts +10 -0
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +28 -0
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.d.ts +3 -0
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +51 -0
- package/build/features/terminal/screens/LinkedSuccess/index.d.ts +2 -0
- package/build/features/terminal/screens/LinkedSuccess/index.js +2 -0
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.d.ts +3 -0
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +55 -0
- package/build/features/terminal/screens/LinkedTerminalInfo/index.d.ts +2 -0
- package/build/features/terminal/screens/LinkedTerminalInfo/index.js +2 -0
- package/build/features/terminal/screens/Loading/Loading.d.ts +4 -0
- package/build/features/terminal/screens/Loading/Loading.js +10 -0
- package/build/features/terminal/screens/Loading/index.d.ts +2 -0
- package/build/features/terminal/screens/Loading/index.js +2 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.d.ts +3 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +56 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.d.ts +2 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.js +2 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.d.ts +36 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.js +34 -0
- package/build/features/terminal/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/terminal/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/terminal/screens/OperatorError/index.d.ts +2 -0
- package/build/features/terminal/screens/OperatorError/index.js +2 -0
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +3 -0
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +21 -0
- package/build/features/terminal/screens/ResetPasswordSuccess/index.d.ts +2 -0
- package/build/features/terminal/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +31 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +9 -0
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +20 -0
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.d.ts +3 -0
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +153 -0
- package/build/features/terminal/screens/TerminalDeviceList/index.d.ts +2 -0
- package/build/features/terminal/screens/TerminalDeviceList/index.js +2 -0
- package/build/features/terminal/screens/TerminalDeviceList/styles.d.ts +9 -0
- package/build/features/terminal/screens/TerminalDeviceList/styles.js +13 -0
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.d.ts +3 -0
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +47 -0
- package/build/features/terminal/screens/TerminalListPage/index.d.ts +2 -0
- package/build/features/terminal/screens/TerminalListPage/index.js +2 -0
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.d.ts +3 -0
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +53 -0
- package/build/features/terminal/screens/UnlinkedSuccess/index.d.ts +2 -0
- package/build/features/terminal/screens/UnlinkedSuccess/index.js +2 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.d.ts +3 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +98 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.d.ts +2 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.js +2 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.d.ts +26 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.js +30 -0
- package/build/features/terminal/screens/Verify/OTPInput.d.ts +7 -0
- package/build/features/terminal/screens/Verify/OTPInput.js +51 -0
- package/build/features/terminal/screens/Verify/Verify.d.ts +5 -0
- package/build/features/terminal/screens/Verify/Verify.js +85 -0
- package/build/features/terminal/screens/Verify/index.d.ts +2 -0
- package/build/features/terminal/screens/Verify/index.js +2 -0
- package/build/features/terminal/screens/Verify/validation.d.ts +8 -0
- package/build/features/terminal/screens/Verify/validation.js +4 -0
- package/build/features/terminal/screens/shared/Header.d.ts +10 -0
- package/build/features/terminal/screens/shared/Header.js +30 -0
- package/build/features/terminal/screens/shared/TerminalList.d.ts +11 -0
- package/build/features/terminal/screens/shared/TerminalList.js +25 -0
- package/build/features/terminal/screens/shared/index.d.ts +5 -0
- package/build/features/terminal/screens/shared/index.js +5 -0
- package/build/features/terminal/screens/shared/styles.d.ts +196 -0
- package/build/features/terminal/screens/shared/styles.js +155 -0
- package/build/features/terminal/screens/shared/utils.d.ts +7 -0
- package/build/features/terminal/screens/shared/utils.js +24 -0
- package/build/hooks/useAppDispatch.d.ts +1 -0
- package/build/index.d.ts +3 -2
- package/build/index.js +4 -2
- package/build/theme/palette.js +12 -0
- package/build/theme/typography.js +4 -0
- package/build/utils/common.js +4 -4
- package/build/utils/string.d.ts +2 -1
- package/build/utils/string.js +10 -1
- package/package.json +2 -2
|
@@ -0,0 +1,53 @@
|
|
|
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 Box from '@mui/material/Box';
|
|
16
|
+
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
17
|
+
import { CONNECT_FLOWS } from '../../../../constants';
|
|
18
|
+
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
19
|
+
import { retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalDeviceList, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
20
|
+
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
21
|
+
import Button from '../../../shared/Button';
|
|
22
|
+
import { SuccessContainerStyled } from '../shared';
|
|
23
|
+
var UnlinkedSuccess = function () {
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
var t = useTranslation().t;
|
|
26
|
+
var isAr = useLanguage().isAr;
|
|
27
|
+
var dispatch = useAppDispatch();
|
|
28
|
+
var _d = useAppSelector(terminalSelector), error = _d.error, loading = _d.loading, _e = _d.data, selectedTerminalDevice = _e.terminalInfo.selectedTerminalDevice, responseData = _e.responseData;
|
|
29
|
+
var _f = responseData || {}, boardData = _f.boardData, authData = _f.authData;
|
|
30
|
+
var terminal = (selectedTerminalDevice || {}).terminal;
|
|
31
|
+
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;
|
|
32
|
+
var handleGoToBoard = function () {
|
|
33
|
+
var board_id = (boardData || {}).id;
|
|
34
|
+
var _a = (authData === null || authData === void 0 ? void 0 : authData.recipient) || {}, id = _a.id, type = _a.type;
|
|
35
|
+
dispatch(retrieveTerminalDeviceList());
|
|
36
|
+
dispatch(retrieveBoardStatus({ boardId: board_id }))
|
|
37
|
+
.unwrap()
|
|
38
|
+
.then(function () {
|
|
39
|
+
dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type }))
|
|
40
|
+
.unwrap()
|
|
41
|
+
.then(function () {
|
|
42
|
+
dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.board));
|
|
43
|
+
})
|
|
44
|
+
.catch(function () { });
|
|
45
|
+
})
|
|
46
|
+
.catch(function () { });
|
|
47
|
+
};
|
|
48
|
+
var handleOnBack = function () {
|
|
49
|
+
dispatch(handlePrevScreenStep());
|
|
50
|
+
};
|
|
51
|
+
return (_jsxs(SuccessContainerStyled, { children: [_jsx(SuccessScreen, { sx: { minHeight: 'unset', ml: 2.5, mr: 2.5 }, title: t('terminal_unlinked_success', { device: deviceName }), successTitle: t('terminal_go_to_board'), loading: loading, error: error || '' }), _jsx(Box, __assign({ sx: { width: '100%' } }, { children: _jsx(Button, __assign({ loading: loading, disableBack: true, onBackClicked: handleOnBack, onClick: handleGoToBoard, isAr: isAr }, { children: t('terminal_go_to_board') })) }))] }));
|
|
52
|
+
};
|
|
53
|
+
export default React.memo(UnlinkedSuccess);
|
|
@@ -0,0 +1,98 @@
|
|
|
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 { useTheme } from '@mui/material/styles';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { CONNECT_FLOWS, DEFAULT_TIMER_VALUE, ICONS_NAMES, TERMINAL_PUSH_NOTIFICATION_DURATION } from '../../../../constants';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
+
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import DeviceCard from '../../../../components/DeviceCard';
|
|
22
|
+
import OTPTimer from '../../../../components/OTPTimer';
|
|
23
|
+
import Collapse from '../../../../components/Collapse';
|
|
24
|
+
import { clearError, linkTerminalDevice, pushNotificationLinkNewTerminal, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
25
|
+
import PushNotification from '../../../shared/PushNotification';
|
|
26
|
+
import Button from '../../../shared/Button';
|
|
27
|
+
import { Container, getId, getIdLabel, LinkWithText } from '../shared';
|
|
28
|
+
import { SendRequestContainer } from './styles';
|
|
29
|
+
import { TerminalList } from '../shared';
|
|
30
|
+
var UnlinkedTerminalInfo = function () {
|
|
31
|
+
var t = useTranslation().t;
|
|
32
|
+
var typography = useTheme().typography;
|
|
33
|
+
var dispatch = useAppDispatch();
|
|
34
|
+
var isAr = useLanguage().isAr;
|
|
35
|
+
var _a = React.useState(false), isRequestSent = _a[0], setIsRequestSent = _a[1];
|
|
36
|
+
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
37
|
+
var _c = React.useState(false), success = _c[0], setSuccess = _c[1];
|
|
38
|
+
var _d = React.useState(false), failed = _d[0], setFailed = _d[1];
|
|
39
|
+
var _e = useAppSelector(terminalSelector), data = _e.data, error = _e.error;
|
|
40
|
+
var _f = data.terminalInfo, selectedTerminalDevice = _f.selectedTerminalDevice, selectedTerminal = _f.selectedTerminal, responseData = data.responseData;
|
|
41
|
+
var _g = responseData || {}, linkTerminalDeviceData = _g.linkTerminalDeviceData, terminalList = _g.terminalList;
|
|
42
|
+
var model = selectedTerminalDevice.model, linked = selectedTerminalDevice.linked, display_name = selectedTerminalDevice.display_name;
|
|
43
|
+
var _h = (model || {}).image_url, image_url = _h === void 0 ? ICONS_NAMES.device_image : _h;
|
|
44
|
+
var expiry = TERMINAL_PUSH_NOTIFICATION_DURATION;
|
|
45
|
+
var newTerminal = false;
|
|
46
|
+
React.useEffect(function () {
|
|
47
|
+
if (linkTerminalDeviceData && !isReady) {
|
|
48
|
+
setIsReady(true);
|
|
49
|
+
}
|
|
50
|
+
}, [linkTerminalDeviceData]);
|
|
51
|
+
React.useEffect(function () {
|
|
52
|
+
if (!isReady)
|
|
53
|
+
return;
|
|
54
|
+
var promise = dispatch(pushNotificationLinkNewTerminal({ newTerminal: newTerminal, onSuccess: function () { return setSuccess(true); }, onFailure: function () { return setFailed(true); } }));
|
|
55
|
+
promise
|
|
56
|
+
.unwrap()
|
|
57
|
+
.then(function (_a) {
|
|
58
|
+
var nextScreen = _a.nextScreen;
|
|
59
|
+
if (nextScreen)
|
|
60
|
+
dispatch(handleNextScreenStep(nextScreen));
|
|
61
|
+
})
|
|
62
|
+
.catch(function () { });
|
|
63
|
+
return function () {
|
|
64
|
+
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
65
|
+
};
|
|
66
|
+
}, [isReady]);
|
|
67
|
+
var getRequestSendDescription = function () {
|
|
68
|
+
if (error)
|
|
69
|
+
return t('terminal_request_denied', { device: display_name });
|
|
70
|
+
if (isRequestSent)
|
|
71
|
+
return t('terminal_new_request_will_send');
|
|
72
|
+
return t('terminal_request_will_send');
|
|
73
|
+
};
|
|
74
|
+
var handleOnSendRequest = function () {
|
|
75
|
+
setIsRequestSent(true);
|
|
76
|
+
handleOnResendClick();
|
|
77
|
+
};
|
|
78
|
+
var handleOnBack = function () {
|
|
79
|
+
if (error)
|
|
80
|
+
dispatch(clearError());
|
|
81
|
+
dispatch(handlePrevScreenStep(CONNECT_FLOWS.terminal.terminalDeviceList));
|
|
82
|
+
};
|
|
83
|
+
var handleOnSelectTerminal = function (terminal) {
|
|
84
|
+
if (error)
|
|
85
|
+
dispatch(clearError());
|
|
86
|
+
dispatch(storeSelectedTerminal(terminal));
|
|
87
|
+
};
|
|
88
|
+
var handleOnResendClick = function () {
|
|
89
|
+
if (isReady)
|
|
90
|
+
setIsReady(false);
|
|
91
|
+
if (failed)
|
|
92
|
+
setFailed(false);
|
|
93
|
+
dispatch(linkTerminalDevice());
|
|
94
|
+
};
|
|
95
|
+
var disabled = !(selectedTerminal === null || selectedTerminal === void 0 ? void 0 : selectedTerminal.id) || isRequestSent;
|
|
96
|
+
return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device: display_name }), failed: failed, success: success, expiryInSeconds: expiry }, { children: _jsxs(Container, { children: [_jsxs(Box, __assign({ sx: { ml: 2.5, mr: 2.5 } }, { children: [_jsx(LinkWithText, { children: "".concat(t('terminal_link'), " ").concat(display_name) }), _jsx(DeviceCard, { image: image_url, name: display_name, deviceId: getId(selectedTerminalDevice), deviceIdLabel: getIdLabel(selectedTerminalDevice), isLinked: linked }), _jsx(LinkWithText, { children: t('terminal_with') }), _jsx(TerminalList, { selectedTerminal: selectedTerminal, list: terminalList, onClick: handleOnSelectTerminal })] })), _jsxs(SendRequestContainer, __assign({ hasError: !!error, sx: __assign(__assign({}, typography.button_small), { fontWeight: typography.fontWeightRegular, mt: 2 }) }, { children: [getRequestSendDescription(), _jsx(Collapse, __assign({ in: isRequestSent && !error }, { children: _jsx(OTPTimer, { timeEndLabel: t('terminal_resend_request'), failed: failed, timeInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendClick }) }))] }))] }) })), _jsx(Button, __assign({ sx: { ml: 2.5, mr: 2.5, mt: 2 }, disabled: disabled, onBackClicked: handleOnBack, onClick: handleOnSendRequest, isAr: isAr }, { children: t('terminal_send_link_request') }))] })));
|
|
97
|
+
};
|
|
98
|
+
export default React.memo(UnlinkedTerminalInfo);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ResendText: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
3
|
+
align?: "left" | "right" | "inherit" | "center" | "justify" | undefined;
|
|
4
|
+
children?: import("react").ReactNode;
|
|
5
|
+
classes?: Partial<import("@mui/material/Typography").TypographyClasses> | undefined;
|
|
6
|
+
gutterBottom?: boolean | undefined;
|
|
7
|
+
noWrap?: boolean | undefined;
|
|
8
|
+
paragraph?: boolean | undefined;
|
|
9
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
10
|
+
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | undefined;
|
|
11
|
+
variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline", string>> | undefined;
|
|
12
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
|
|
13
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
14
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | ("left" | "right" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
15
|
+
interface SendRequestContainerProps {
|
|
16
|
+
hasError?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const SendRequestContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
19
|
+
children?: import("react").ReactNode;
|
|
20
|
+
component?: import("react").ElementType<any> | undefined;
|
|
21
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
22
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
23
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
24
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
25
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | ("left" | "right" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "component" | "ref" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & SendRequestContainerProps, {}, {}>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { alpha, styled } from '@mui/material/styles';
|
|
13
|
+
import Typography from '@mui/material/Typography';
|
|
14
|
+
import Box from '@mui/material/Box';
|
|
15
|
+
export var ResendText = styled(Typography)(function (_a) {
|
|
16
|
+
var _b = _a.theme, palette = _b.palette, typography = _b.typography, spacing = _b.spacing;
|
|
17
|
+
return (__assign(__assign({ cursor: 'pointer', color: palette.primary.main }, typography.caption), { fontWeight: typography.fontWeightRegular, textAlign: 'end', marginTop: spacing(0.75) }));
|
|
18
|
+
});
|
|
19
|
+
export var SendRequestContainer = styled(Box, {
|
|
20
|
+
shouldForwardProp: function (prop) { return !['hasError'].includes(prop.toString()); }
|
|
21
|
+
})(function (_a) {
|
|
22
|
+
var _b = _a.theme, typography = _b.typography, palette = _b.palette, spacing = _b.spacing, hasError = _a.hasError;
|
|
23
|
+
return (__assign(__assign(__assign(__assign({}, typography.button_small), { fontWeight: typography.fontWeightRegular, mt: 2, backgroundColor: palette.common.white, borderWidth: spacing(0.125, 0, 0.125, 0), borderStyle: 'solid', borderColor: palette.divider, padding: spacing(1.5, 2.5, 1.5, 2.5), marginTop: spacing(1), color: palette.text.primary }), typography.body1), (hasError && {
|
|
24
|
+
background: alpha(palette.error.dark, 0.3),
|
|
25
|
+
borderWidth: '1px, 0px, 1px, 0px',
|
|
26
|
+
borderStyle: 'solid',
|
|
27
|
+
borderColor: alpha(palette.error.dark, 0.7),
|
|
28
|
+
color: alpha(palette.error.main, 0.7)
|
|
29
|
+
})));
|
|
30
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import Box from '@mui/material/Box/Box';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import OTPField from '../../../shared/OTP';
|
|
17
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
|
+
import { clearError, terminalSelector, resendOTP } from '../../../app/terminal/terminalStore';
|
|
23
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
24
|
+
var theme = _a.theme;
|
|
25
|
+
return ({
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
fontFamily: theme.typography.fontFamily
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var OTPInput = function (_a) {
|
|
32
|
+
var loading = _a.loading;
|
|
33
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
34
|
+
var t = useTranslation().t;
|
|
35
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
36
|
+
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(terminalSelector).error;
|
|
38
|
+
var handleOnOTPChange = function (otp) {
|
|
39
|
+
if (error)
|
|
40
|
+
dispatch(clearError());
|
|
41
|
+
otpControl.field.onChange(otp);
|
|
42
|
+
};
|
|
43
|
+
var handleOnResendOTP = function () {
|
|
44
|
+
if (otpControl.field.value)
|
|
45
|
+
setValue('otp', '', { shouldValidate: true });
|
|
46
|
+
dispatch(resendOTP());
|
|
47
|
+
};
|
|
48
|
+
var otpValue = otpControl.field.value;
|
|
49
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
50
|
+
};
|
|
51
|
+
export default React.memo(OTPInput);
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { useAppDispatch, useSetFromDefaultValues, useSanitizedTranslation, useLanguage, useAppSelector } from '../../../../hooks';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import Box from '@mui/material/Box/Box';
|
|
19
|
+
import { styled } from '@mui/material/styles';
|
|
20
|
+
import { handleNextScreenStep } from '../../../../app/settings';
|
|
21
|
+
import { deepCopy, maskPhone } from '../../../../utils';
|
|
22
|
+
import Form from '../../../../components/Form';
|
|
23
|
+
import Text from '../../../../components/Text';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import { terminalSelector, clearError, resetOTPScreen, verifyTokenOTP } from '../../../app/terminal/terminalStore';
|
|
26
|
+
import Button from '../../../shared/Button';
|
|
27
|
+
import { OTPValidation } from './validation';
|
|
28
|
+
import OTPInput from './OTPInput';
|
|
29
|
+
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return ({
|
|
32
|
+
background: theme.palette.common.white,
|
|
33
|
+
border: '1px solid',
|
|
34
|
+
borderColor: theme.palette.divider,
|
|
35
|
+
direction: theme.direction,
|
|
36
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
37
|
+
marginBottom: theme.spacing(5.75)
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
41
|
+
var theme = _a.theme;
|
|
42
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInlineStart: theme.spacing(2.5), lineHeight: 1.75 }));
|
|
43
|
+
});
|
|
44
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexDirection: 'column'
|
|
47
|
+
}); });
|
|
48
|
+
var VerifyNumber = function (_a) {
|
|
49
|
+
var _b, _c, _d;
|
|
50
|
+
var dispatch = useAppDispatch();
|
|
51
|
+
var _e = useAppSelector(terminalSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
52
|
+
var otp = data.otpData.otp;
|
|
53
|
+
var methods = useForm({
|
|
54
|
+
resolver: yupResolver(OTPValidation),
|
|
55
|
+
defaultValues: {
|
|
56
|
+
otp: otp
|
|
57
|
+
},
|
|
58
|
+
mode: 'onChange'
|
|
59
|
+
});
|
|
60
|
+
useSetFromDefaultValues(methods, data.otpData);
|
|
61
|
+
var t = useTranslation().t;
|
|
62
|
+
var st = useSanitizedTranslation();
|
|
63
|
+
var isAr = useLanguage().isAr;
|
|
64
|
+
var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
|
|
65
|
+
var phone = (_d = (_c = (_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authData) === null || _c === void 0 ? void 0 : _c.verification_by) === null || _d === void 0 ? void 0 : _d.sent_to;
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
if (error && methods.formState.isValid && phone)
|
|
68
|
+
dispatch(clearError());
|
|
69
|
+
return function () {
|
|
70
|
+
dispatch(resetOTPScreen());
|
|
71
|
+
};
|
|
72
|
+
}, [methods.formState.isValid]);
|
|
73
|
+
var onSubmit = function (formData) {
|
|
74
|
+
dispatch(verifyTokenOTP(deepCopy(formData)))
|
|
75
|
+
.unwrap()
|
|
76
|
+
.then(function (_a) {
|
|
77
|
+
var nextScreen = _a.nextScreen;
|
|
78
|
+
dispatch(handleNextScreenStep(nextScreen));
|
|
79
|
+
})
|
|
80
|
+
.catch(function () { });
|
|
81
|
+
};
|
|
82
|
+
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
83
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
84
|
+
};
|
|
85
|
+
export default React.memo(VerifyNumber);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
interface HeaderProps {
|
|
4
|
+
onLinkClick?: () => void;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
sx?: SxProps<Theme>;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ onLinkClick, loading, title, sx }: HeaderProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { memo } from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
16
|
+
import Loader from '../../../../components/Loader';
|
|
17
|
+
import { AddIconContainer, HeadContainer, LinkButton, LinkText, TextTypography } from './styles';
|
|
18
|
+
var Header = function (_a) {
|
|
19
|
+
var onLinkClick = _a.onLinkClick, loading = _a.loading, title = _a.title, sx = _a.sx;
|
|
20
|
+
var t = useTranslation().t;
|
|
21
|
+
var getLink = function () {
|
|
22
|
+
if (!onLinkClick)
|
|
23
|
+
return;
|
|
24
|
+
if (loading)
|
|
25
|
+
return _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 14, style: { height: 28, width: 28, margin: 0 }, toggleAnimation: !!loading });
|
|
26
|
+
return (_jsxs(LinkButton, __assign({ onClick: onLinkClick }, { children: [_jsx(AddIconContainer, { children: _jsx(AddIcon, { fontSize: 'small' }) }), _jsx(LinkText, { children: t('terminal_link_terminal') })] })));
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs(HeadContainer, __assign({ sx: sx }, { children: [_jsx(TextTypography, { children: t(title !== null && title !== void 0 ? title : 'terminal_manage_terminals') }), getLink()] })));
|
|
29
|
+
};
|
|
30
|
+
export default memo(Header);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TerminalInfo } from '../../../../@types';
|
|
3
|
+
interface TerminalListProps {
|
|
4
|
+
selectedTerminal: TerminalInfo;
|
|
5
|
+
list: TerminalInfo[];
|
|
6
|
+
select?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
onClick: (device: TerminalInfo) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ list, onClick, selectedTerminal, select, loading }: TerminalListProps) => JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
5
|
+
import Icon from '../../../../components/Icon';
|
|
6
|
+
import Loader from '../../../../components/Loader';
|
|
7
|
+
import { getTerminalId, getTerminalIdLabel, getTerminalName } from './utils';
|
|
8
|
+
import { ListContainer, TerminalListContainer, TitleContainer, Image, Title, ScrollContainer, ListItem, StyledRadio, ArrowIcon } from './styles';
|
|
9
|
+
var TerminalList = function (_a) {
|
|
10
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
11
|
+
var list = _a.list, onClick = _a.onClick, selectedTerminal = _a.selectedTerminal, _k = _a.select, select = _k === void 0 ? true : _k, loading = _a.loading;
|
|
12
|
+
var t = useTranslation().t;
|
|
13
|
+
var platformImage = ((_d = (_c = (_b = list === null || list === void 0 ? void 0 : list[0]) === null || _b === void 0 ? void 0 : _b.platform) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.logo) || ICONS_NAMES.platform_image;
|
|
14
|
+
var platformName = (_j = (_h = (_g = (_f = (_e = list === null || list === void 0 ? void 0 : list[0]) === null || _e === void 0 ? void 0 : _e.platform) === null || _f === void 0 ? void 0 : _f.brand) === null || _g === void 0 ? void 0 : _g.name) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.text;
|
|
15
|
+
var getEndComponent = function (terminal) {
|
|
16
|
+
if (loading && (selectedTerminal === null || selectedTerminal === void 0 ? void 0 : selectedTerminal.id) === (terminal === null || terminal === void 0 ? void 0 : terminal.id))
|
|
17
|
+
return _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 10, style: { height: 24, width: 24 }, toggleAnimation: !!loading });
|
|
18
|
+
if (select)
|
|
19
|
+
return (_jsx(StyledRadio, { sx: { paddingInlineEnd: 0 }, disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, onChange: function () { return onClick(terminal); }, checkedIcon: _jsx(Icon, { src: ICONS_NAMES.radio_checked }), checked: (selectedTerminal === null || selectedTerminal === void 0 ? void 0 : selectedTerminal.id) === terminal.id }));
|
|
20
|
+
if (!select)
|
|
21
|
+
return _jsx(ArrowIcon, {});
|
|
22
|
+
};
|
|
23
|
+
return (_jsxs(ListContainer, { children: [_jsxs(TitleContainer, { children: [_jsx(Image, { src: platformImage, alt: 'Device' }), _jsx(Title, { children: t('terminal_devices', { name: platformName }) })] }), _jsx(ScrollContainer, { children: _jsx(TerminalListContainer, { children: (list || []).map(function (terminal, index) { return (_jsx(ListItem, { sx: { minHeight: 'unset' }, onClick: function () { return onClick(terminal); }, name: getTerminalName(terminal), deviceId: getTerminalId(terminal), deviceIdLabel: getTerminalIdLabel(terminal), endAdornment: getEndComponent(terminal) }, index)); }) }) })] }));
|
|
24
|
+
};
|
|
25
|
+
export default memo(TerminalList);
|