@tap-payments/auth-jsconnect 2.11.5-sandbox → 2.11.7-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/terminal.d.ts +32 -44
- package/build/api/auth.d.ts +7 -1
- package/build/api/index.d.ts +2 -2
- package/build/api/terminal.d.ts +3 -6
- package/build/api/terminal.js +22 -12
- package/build/assets/locales/ar.json +0 -4
- package/build/assets/locales/en.json +0 -4
- package/build/components/DeviceCard/DeviceCard.js +1 -1
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/app.d.ts +2 -3
- package/build/constants/app.js +32 -22
- package/build/constants/flows.d.ts +1 -1
- package/build/constants/flows.js +1 -1
- package/build/features/app/terminal/terminalStore.d.ts +7 -7
- package/build/features/app/terminal/terminalStore.js +52 -52
- package/build/features/entity/screens/EntityName/validation.d.ts +3 -3
- package/build/features/entity/screens/EntityName/validation.js +2 -17
- package/build/features/featuresScreens.js +3 -3
- package/build/features/terminal/Terminal.js +2 -2
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +8 -9
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +5 -6
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +9 -9
- package/build/features/terminal/screens/{TerminalListPage/TerminalListPage.js → POSDeviceListPage/POSDeviceListPage.js} +9 -9
- package/build/features/terminal/screens/POSDeviceListPage/index.d.ts +2 -0
- package/build/features/terminal/screens/POSDeviceListPage/index.js +2 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +3 -3
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +1 -1
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +15 -15
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +5 -7
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +12 -11
- package/build/features/terminal/screens/shared/POSDeviceList.d.ts +11 -0
- package/build/features/terminal/screens/shared/POSDeviceList.js +28 -0
- package/build/features/terminal/screens/shared/index.d.ts +2 -2
- package/build/features/terminal/screens/shared/index.js +2 -2
- package/build/features/terminal/screens/shared/styles.d.ts +1 -1
- package/build/features/terminal/screens/shared/styles.js +1 -1
- package/build/features/terminal/screens/shared/utils.d.ts +4 -4
- package/build/features/terminal/screens/shared/utils.js +8 -9
- package/build/utils/common.js +3 -3
- package/package.json +2 -2
- package/build/features/terminal/screens/TerminalListPage/index.d.ts +0 -2
- package/build/features/terminal/screens/TerminalListPage/index.js +0 -2
- package/build/features/terminal/screens/shared/TerminalList.d.ts +0 -11
- package/build/features/terminal/screens/shared/TerminalList.js +0 -25
- /package/build/features/terminal/screens/{TerminalListPage/TerminalListPage.d.ts → POSDeviceListPage/POSDeviceListPage.d.ts} +0 -0
|
@@ -56,27 +56,27 @@ import Button from '../../../../components/Button';
|
|
|
56
56
|
import Loader from '../../../../components/Loader';
|
|
57
57
|
import Warning from '../../../../components/Warning';
|
|
58
58
|
import Box from '@mui/material/Box';
|
|
59
|
-
import { clearError, resetTerminalLinkResponse, retrieveBoardDetails, retrieveBoardStatus,
|
|
59
|
+
import { clearError, resetTerminalLinkResponse, retrieveBoardDetails, retrieveBoardStatus, retrievePOSDevices, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
60
60
|
import { Header, Container, TextTypography } from '../shared';
|
|
61
61
|
import DeviceList from './DeviceList';
|
|
62
62
|
var TerminalDeviceList = function () {
|
|
63
63
|
var t = useTranslation().t;
|
|
64
64
|
var dispatch = useAppDispatch();
|
|
65
|
-
var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading,
|
|
65
|
+
var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading, posDevicesLoading = _a.posDevicesLoading, error = _a.error;
|
|
66
66
|
var _b = React.useState(false), newLinkClicked = _b[0], setNewLinkClicked = _b[1];
|
|
67
|
-
var _c = data.responseData || {}, boardFlows = _c.boardFlows, authData = _c.authData, boardData = _c.boardData, terminalData = _c.terminalData,
|
|
68
|
-
var
|
|
67
|
+
var _c = data.responseData || {}, boardFlows = _c.boardFlows, authData = _c.authData, boardData = _c.boardData, terminalData = _c.terminalData, posDevices = _c.posDevices;
|
|
68
|
+
var list = (terminalData || {}).list;
|
|
69
69
|
var _d = React.useMemo(function () {
|
|
70
|
-
var linked =
|
|
71
|
-
var unLinked =
|
|
70
|
+
var linked = list === null || list === void 0 ? void 0 : list.filter(function (d) { return d.linked; });
|
|
71
|
+
var unLinked = list === null || list === void 0 ? void 0 : list.filter(function (d) { return !d.linked; });
|
|
72
72
|
return { linkedDevices: linked, unLinkedDevices: unLinked };
|
|
73
|
-
}, [
|
|
73
|
+
}, [list]), linkedDevices = _d.linkedDevices, unLinkedDevices = _d.unLinkedDevices;
|
|
74
74
|
var handleOnClickNewTerminalLink = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
switch (_a.label) {
|
|
77
77
|
case 0:
|
|
78
78
|
setNewLinkClicked(true);
|
|
79
|
-
return [4,
|
|
79
|
+
return [4, retrievePOSDevicesAsync(CONNECT_FLOWS.terminal.posDeviceList)];
|
|
80
80
|
case 1:
|
|
81
81
|
_a.sent();
|
|
82
82
|
return [2];
|
|
@@ -88,19 +88,19 @@ var TerminalDeviceList = function () {
|
|
|
88
88
|
dispatch(clearError());
|
|
89
89
|
dispatch(resetTerminalLinkResponse());
|
|
90
90
|
}, []);
|
|
91
|
-
var
|
|
91
|
+
var retrievePOSDevicesAsync = function (nextScreen) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
92
|
var err_1;
|
|
93
93
|
return __generator(this, function (_a) {
|
|
94
94
|
switch (_a.label) {
|
|
95
95
|
case 0:
|
|
96
|
-
if (
|
|
96
|
+
if (posDevices === null || posDevices === void 0 ? void 0 : posDevices.length) {
|
|
97
97
|
dispatch(handleNextScreenStep(nextScreen));
|
|
98
98
|
return [2];
|
|
99
99
|
}
|
|
100
100
|
_a.label = 1;
|
|
101
101
|
case 1:
|
|
102
102
|
_a.trys.push([1, 3, , 4]);
|
|
103
|
-
return [4, dispatch(
|
|
103
|
+
return [4, dispatch(retrievePOSDevices()).unwrap()];
|
|
104
104
|
case 2:
|
|
105
105
|
_a.sent();
|
|
106
106
|
dispatch(handleNextScreenStep(nextScreen));
|
|
@@ -114,7 +114,7 @@ var TerminalDeviceList = function () {
|
|
|
114
114
|
});
|
|
115
115
|
}); };
|
|
116
116
|
var handleOnClickLinkedTerminal = function (terminal) {
|
|
117
|
-
dispatch(
|
|
117
|
+
dispatch(storeSelectedTerminal(terminal));
|
|
118
118
|
dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.linkedTerminalInfo));
|
|
119
119
|
};
|
|
120
120
|
var handleOnClickUnlinkedTerminal = function (terminal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -122,8 +122,8 @@ var TerminalDeviceList = function () {
|
|
|
122
122
|
switch (_a.label) {
|
|
123
123
|
case 0:
|
|
124
124
|
setNewLinkClicked(false);
|
|
125
|
-
dispatch(
|
|
126
|
-
return [4,
|
|
125
|
+
dispatch(storeSelectedTerminal(terminal));
|
|
126
|
+
return [4, retrievePOSDevicesAsync(CONNECT_FLOWS.terminal.unlinkedTerminalInfo)];
|
|
127
127
|
case 1:
|
|
128
128
|
_a.sent();
|
|
129
129
|
return [2];
|
|
@@ -148,6 +148,6 @@ var TerminalDeviceList = function () {
|
|
|
148
148
|
})
|
|
149
149
|
.catch(function () { });
|
|
150
150
|
};
|
|
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:
|
|
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: posDevicesLoading && 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: posDevicesLoading && !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') })) }))] })));
|
|
152
152
|
};
|
|
153
153
|
export default React.memo(TerminalDeviceList);
|
|
@@ -16,23 +16,21 @@ import Box from '@mui/material/Box';
|
|
|
16
16
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
17
17
|
import { CONNECT_FLOWS } from '../../../../constants';
|
|
18
18
|
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
19
|
-
import { retrieveBoardDetails, retrieveBoardStatus,
|
|
19
|
+
import { retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalList, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
20
20
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
22
22
|
import { SuccessContainerStyled } from '../shared';
|
|
23
23
|
var UnlinkedSuccess = function () {
|
|
24
|
-
var _a, _b, _c;
|
|
25
24
|
var t = useTranslation().t;
|
|
26
25
|
var isAr = useLanguage().isAr;
|
|
27
26
|
var dispatch = useAppDispatch();
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
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;
|
|
27
|
+
var _a = useAppSelector(terminalSelector), error = _a.error, loading = _a.loading, _b = _a.data, device = _b.terminalInfo.selectedTerminal.device, responseData = _b.responseData;
|
|
28
|
+
var _c = responseData || {}, boardData = _c.boardData, authData = _c.authData;
|
|
29
|
+
var deviceName = device === null || device === void 0 ? void 0 : device.display_name;
|
|
32
30
|
var handleGoToBoard = function () {
|
|
33
31
|
var board_id = (boardData || {}).id;
|
|
34
32
|
var _a = (authData === null || authData === void 0 ? void 0 : authData.recipient) || {}, id = _a.id, type = _a.type;
|
|
35
|
-
dispatch(
|
|
33
|
+
dispatch(retrieveTerminalList());
|
|
36
34
|
dispatch(retrieveBoardStatus({ boardId: board_id }))
|
|
37
35
|
.unwrap()
|
|
38
36
|
.then(function () {
|
|
@@ -21,12 +21,12 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
21
21
|
import DeviceCard from '../../../../components/DeviceCard';
|
|
22
22
|
import OTPTimer from '../../../../components/OTPTimer';
|
|
23
23
|
import Collapse from '../../../../components/Collapse';
|
|
24
|
-
import { clearError, linkTerminalDevice, pushNotificationLinkNewTerminal,
|
|
24
|
+
import { clearError, linkTerminalDevice, pushNotificationLinkNewTerminal, storeSelectedPOS, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
25
25
|
import PushNotification from '../../../shared/PushNotification';
|
|
26
26
|
import Button from '../../../shared/Button';
|
|
27
27
|
import { Container, getId, getIdLabel, LinkWithText } from '../shared';
|
|
28
28
|
import { SendRequestContainer } from './styles';
|
|
29
|
-
import {
|
|
29
|
+
import { POSDeviceList } from '../shared';
|
|
30
30
|
var UnlinkedTerminalInfo = function () {
|
|
31
31
|
var t = useTranslation().t;
|
|
32
32
|
var typography = useTheme().typography;
|
|
@@ -37,10 +37,11 @@ var UnlinkedTerminalInfo = function () {
|
|
|
37
37
|
var _c = React.useState(false), success = _c[0], setSuccess = _c[1];
|
|
38
38
|
var _d = React.useState(false), failed = _d[0], setFailed = _d[1];
|
|
39
39
|
var _e = useAppSelector(terminalSelector), data = _e.data, error = _e.error;
|
|
40
|
-
var _f = data.terminalInfo,
|
|
41
|
-
var _g = responseData || {}, linkTerminalDeviceData = _g.linkTerminalDeviceData,
|
|
42
|
-
var
|
|
43
|
-
var _h = (model || {}).image_url, image_url = _h === void 0 ? ICONS_NAMES.device_image : _h;
|
|
40
|
+
var _f = data.terminalInfo, selectedTerminal = _f.selectedTerminal, selectedPOS = _f.selectedPOS, responseData = data.responseData;
|
|
41
|
+
var _g = responseData || {}, linkTerminalDeviceData = _g.linkTerminalDeviceData, posDevices = _g.posDevices;
|
|
42
|
+
var terminal_device = selectedTerminal.terminal_device, linked = selectedTerminal.linked;
|
|
43
|
+
var _h = ((terminal_device === null || terminal_device === void 0 ? void 0 : terminal_device.model) || {}).image_url, image_url = _h === void 0 ? ICONS_NAMES.device_image : _h;
|
|
44
|
+
var displayName = (terminal_device === null || terminal_device === void 0 ? void 0 : terminal_device.display_name) || '';
|
|
44
45
|
var expiry = TERMINAL_PUSH_NOTIFICATION_DURATION;
|
|
45
46
|
var newTerminal = false;
|
|
46
47
|
React.useEffect(function () {
|
|
@@ -66,7 +67,7 @@ var UnlinkedTerminalInfo = function () {
|
|
|
66
67
|
}, [isReady]);
|
|
67
68
|
var getRequestSendDescription = function () {
|
|
68
69
|
if (error)
|
|
69
|
-
return t('terminal_request_denied', { device:
|
|
70
|
+
return t('terminal_request_denied', { device: displayName });
|
|
70
71
|
if (isRequestSent)
|
|
71
72
|
return t('terminal_new_request_will_send');
|
|
72
73
|
return t('terminal_request_will_send');
|
|
@@ -80,10 +81,10 @@ var UnlinkedTerminalInfo = function () {
|
|
|
80
81
|
dispatch(clearError());
|
|
81
82
|
dispatch(handlePrevScreenStep(CONNECT_FLOWS.terminal.terminalDeviceList));
|
|
82
83
|
};
|
|
83
|
-
var
|
|
84
|
+
var handleOnSelectPOS = function (pos) {
|
|
84
85
|
if (error)
|
|
85
86
|
dispatch(clearError());
|
|
86
|
-
dispatch(
|
|
87
|
+
dispatch(storeSelectedPOS(pos));
|
|
87
88
|
};
|
|
88
89
|
var handleOnResendClick = function () {
|
|
89
90
|
if (isReady)
|
|
@@ -92,7 +93,7 @@ var UnlinkedTerminalInfo = function () {
|
|
|
92
93
|
setFailed(false);
|
|
93
94
|
dispatch(linkTerminalDevice());
|
|
94
95
|
};
|
|
95
|
-
var disabled = !(
|
|
96
|
-
return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device:
|
|
96
|
+
var disabled = !(selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.id) || isRequestSent;
|
|
97
|
+
return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device: displayName }), 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(displayName) }), _jsx(DeviceCard, { image: image_url, name: displayName, deviceId: getId(selectedTerminal), deviceIdLabel: getIdLabel(selectedTerminal), isLinked: linked }), _jsx(LinkWithText, { children: t('terminal_with') }), _jsx(POSDeviceList, { selectedPOS: selectedPOS, posDevices: posDevices, onClick: handleOnSelectPOS })] })), _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
|
};
|
|
98
99
|
export default React.memo(UnlinkedTerminalInfo);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { POSInfo } from '../../../../@types';
|
|
3
|
+
interface POSDeviceListProps {
|
|
4
|
+
selectedPOS: POSInfo;
|
|
5
|
+
posDevices: POSInfo[];
|
|
6
|
+
select?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
onClick: (pos: POSInfo) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ posDevices, onClick, selectedPOS, select, loading }: POSDeviceListProps) => JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { ListContainer, POSListContainer, TitleContainer, Image, Title, ScrollContainer, ListItem, StyledRadio, ArrowIcon } from './styles';
|
|
8
|
+
import { useAppSelector } from '../../../../hooks';
|
|
9
|
+
import { terminalSelector } from '../../../../features/app/terminal/terminalStore';
|
|
10
|
+
var POSDeviceList = function (_a) {
|
|
11
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
12
|
+
var posDevices = _a.posDevices, onClick = _a.onClick, selectedPOS = _a.selectedPOS, _m = _a.select, select = _m === void 0 ? true : _m, loading = _a.loading;
|
|
13
|
+
var t = useTranslation().t;
|
|
14
|
+
var responseData = useAppSelector(terminalSelector).data.responseData;
|
|
15
|
+
var terminalData = (responseData || {}).terminalData;
|
|
16
|
+
var platformImage = ((_e = (_d = (_c = (_b = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.platform) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.logo) || ICONS_NAMES.platform_image;
|
|
17
|
+
var platformName = (_l = (_k = (_j = (_h = (_g = (_f = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.platform) === null || _h === void 0 ? void 0 : _h.brand) === null || _j === void 0 ? void 0 : _j.name) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.text;
|
|
18
|
+
var getEndComponent = function (pos) {
|
|
19
|
+
if (loading && (selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.id) === (pos === null || pos === void 0 ? void 0 : pos.id))
|
|
20
|
+
return _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 10, style: { height: 24, width: 24 }, toggleAnimation: !!loading });
|
|
21
|
+
if (select)
|
|
22
|
+
return (_jsx(StyledRadio, { sx: { paddingInlineEnd: 0 }, disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, onChange: function () { return onClick(pos); }, checkedIcon: _jsx(Icon, { src: ICONS_NAMES.radio_checked }), checked: (selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.id) === pos.id }));
|
|
23
|
+
if (!select)
|
|
24
|
+
return _jsx(ArrowIcon, {});
|
|
25
|
+
};
|
|
26
|
+
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(POSListContainer, { children: (posDevices || []).map(function (device, index) { return (_jsx(ListItem, { sx: { minHeight: 'unset' }, onClick: function () { return onClick(device); }, name: device.display_name, deviceId: device.reference, deviceIdLabel: 'terminal_device_id', endAdornment: getEndComponent(device) }, index)); }) }) })] }));
|
|
27
|
+
};
|
|
28
|
+
export default memo(POSDeviceList);
|
|
@@ -78,7 +78,7 @@ export declare const ScrollContainer: import("@emotion/styled").StyledComponent<
|
|
|
78
78
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
79
79
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
80
80
|
}, 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>, {}, {}>;
|
|
81
|
-
export declare const
|
|
81
|
+
export declare const POSListContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
82
82
|
children?: import("react").ReactNode;
|
|
83
83
|
component?: import("react").ElementType<any> | undefined;
|
|
84
84
|
ref?: import("react").Ref<unknown> | undefined;
|
|
@@ -60,7 +60,7 @@ export var ScrollContainer = styled(Box)(function (_a) {
|
|
|
60
60
|
overflow: 'scroll'
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
|
-
export var
|
|
63
|
+
export var POSListContainer = styled(Box)(function (_a) {
|
|
64
64
|
var spacing = _a.theme.spacing;
|
|
65
65
|
return ({
|
|
66
66
|
display: 'flex',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const getPairedWith: (
|
|
3
|
-
export declare const getId: (
|
|
4
|
-
export declare const getIdLabel: (
|
|
1
|
+
import { TerminalInfo } from '../../../../@types';
|
|
2
|
+
export declare const getPairedWith: (terminal: TerminalInfo | undefined) => string | undefined;
|
|
3
|
+
export declare const getId: (terminal: TerminalInfo | undefined) => string;
|
|
4
|
+
export declare const getIdLabel: (terminal: TerminalInfo | undefined) => "terminal_device_id" | "terminal_serial_number";
|
|
5
5
|
export declare const getTerminalId: (terminal: TerminalInfo) => string;
|
|
6
6
|
export declare const getTerminalName: (terminal: TerminalInfo) => string;
|
|
7
7
|
export declare const getTerminalIdLabel: (terminal: TerminalInfo) => "terminal_device_id" | "terminal_id";
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export var getPairedWith = function (
|
|
2
|
-
var _a
|
|
3
|
-
return (
|
|
1
|
+
export var getPairedWith = function (terminal) {
|
|
2
|
+
var _a;
|
|
3
|
+
return (_a = terminal === null || terminal === void 0 ? void 0 : terminal.device) === null || _a === void 0 ? void 0 : _a.display_name;
|
|
4
4
|
};
|
|
5
|
-
export var getId = function (
|
|
6
|
-
|
|
7
|
-
return (_c = (_b = (_a = device === null || device === void 0 ? void 0 : device.terminal) === null || _a === void 0 ? void 0 : _a.device) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : device.serial_number;
|
|
5
|
+
export var getId = function (terminal) {
|
|
6
|
+
return ((terminal === null || terminal === void 0 ? void 0 : terminal.device) ? terminal.device.reference || terminal.device.id : terminal === null || terminal === void 0 ? void 0 : terminal.terminal_device.serial_number) || '';
|
|
8
7
|
};
|
|
9
|
-
export var getIdLabel = function (
|
|
10
|
-
var _a
|
|
11
|
-
return ((
|
|
8
|
+
export var getIdLabel = function (terminal) {
|
|
9
|
+
var _a;
|
|
10
|
+
return ((_a = terminal === null || terminal === void 0 ? void 0 : terminal.device) === null || _a === void 0 ? void 0 : _a.id) ? 'terminal_device_id' : 'terminal_serial_number';
|
|
12
11
|
};
|
|
13
12
|
export var getTerminalId = function (terminal) {
|
|
14
13
|
var _a, _b;
|
package/build/utils/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { axiosInstance } from '../api';
|
|
2
|
-
import { ENDPOINT_PATHS,
|
|
2
|
+
import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
|
|
3
3
|
import { objectHasValues } from './object';
|
|
4
4
|
import { isDisasterRecoveryEnv, isSA } from './string';
|
|
5
5
|
export var sleep = function (milliseconds) {
|
|
@@ -17,7 +17,7 @@ export var setBaseUrl = function (publicKey, region) {
|
|
|
17
17
|
var isProd = publicKey.includes('pk_live');
|
|
18
18
|
var _a = region.split('-'), country = _a[0], envType = _a[1];
|
|
19
19
|
if (!isProd) {
|
|
20
|
-
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.
|
|
20
|
+
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
if (isSA(country)) {
|
|
@@ -44,7 +44,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
|
|
|
44
44
|
window.history.replaceState({}, '', newUrl);
|
|
45
45
|
};
|
|
46
46
|
export var openConnect = function (pk, countryCode) {
|
|
47
|
-
var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL :
|
|
47
|
+
var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
|
|
48
48
|
if (countryCode) {
|
|
49
49
|
newUrl.pathname = "/".concat(countryCode.toLowerCase());
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.7-development",
|
|
4
4
|
"description": "connect library, auth",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
22
22
|
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
23
23
|
"ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
|
|
24
|
-
"push": "npm publish --access public --tag
|
|
24
|
+
"push": "npm publish --access public --tag development"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [],
|
|
27
27
|
"author": {
|
|
@@ -1,11 +0,0 @@
|
|
|
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;
|
|
@@ -1,25 +0,0 @@
|
|
|
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);
|