@tap-payments/auth-jsconnect 2.11.7-development → 2.11.9-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/components/DeviceCard/DeviceCard.js +8 -9
- package/build/components/TruncatedTooltipText/TruncatedTooltipText.d.ts +7 -0
- package/build/components/TruncatedTooltipText/TruncatedTooltipText.js +33 -0
- package/build/components/TruncatedTooltipText/index.d.ts +2 -0
- package/build/components/TruncatedTooltipText/index.js +2 -0
- package/build/features/app/terminal/terminalStore.js +1 -1
- package/package.json +1 -1
|
@@ -23,13 +23,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { memo } from 'react';
|
|
25
25
|
import { useTranslation } from 'react-i18next';
|
|
26
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
26
|
+
import { alpha, styled, useTheme } from '@mui/material/styles';
|
|
27
27
|
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
|
28
28
|
import Card from '@mui/material/Card';
|
|
29
29
|
import Box from '@mui/material/Box';
|
|
30
|
-
import Typography from '@mui/material/Typography';
|
|
31
30
|
import Icon from '../Icon';
|
|
32
31
|
import Loader from '../Loader';
|
|
32
|
+
import TruncatedTooltipText from '../TruncatedTooltipText';
|
|
33
33
|
var DeviceCardContainer = styled(Card, { shouldForwardProp: function (prop) { return !['showBorder'].includes(prop.toString()); } })(function (_a) {
|
|
34
34
|
var _b = _a.theme, spacing = _b.spacing, _c = _b.palette, background = _c.background, components = _c.components, showBorder = _a.showBorder;
|
|
35
35
|
return (__assign({ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: spacing(2), borderRadius: spacing(0.5), boxShadow: 'none', width: '100%', backgroundColor: background.default, minHeight: spacing(14.125), position: 'relative' }, (showBorder && {
|
|
@@ -41,7 +41,8 @@ var DeviceDetails = styled(Box)(function (_a) {
|
|
|
41
41
|
return ({
|
|
42
42
|
display: 'flex',
|
|
43
43
|
alignItems: 'center',
|
|
44
|
-
gap: spacing(3.125)
|
|
44
|
+
gap: spacing(3.125),
|
|
45
|
+
width: '90%'
|
|
45
46
|
});
|
|
46
47
|
});
|
|
47
48
|
var DeviceImage = styled(Icon)(function (_a) {
|
|
@@ -57,13 +58,10 @@ var DeviceInfo = styled(Box)(function (_a) {
|
|
|
57
58
|
return ({
|
|
58
59
|
display: 'flex',
|
|
59
60
|
flexDirection: 'column',
|
|
60
|
-
gap: spacing(1)
|
|
61
|
+
gap: spacing(1),
|
|
62
|
+
width: '80%'
|
|
61
63
|
});
|
|
62
64
|
});
|
|
63
|
-
var DeviceTitle = styled(Typography)(function (_a) {
|
|
64
|
-
var _b = _a.theme, typography = _b.typography, palette = _b.palette;
|
|
65
|
-
return (__assign(__assign({}, typography.subtitle1), { color: palette.components.deviceCard.title, fontWeight: typography.fontWeightBold }));
|
|
66
|
-
});
|
|
67
65
|
var DeviceIdInfo = styled(Box)(function (_a) {
|
|
68
66
|
var _b = _a.theme, typography = _b.typography, palette = _b.palette, spacing = _b.spacing;
|
|
69
67
|
return (__assign(__assign({}, typography.caption_small), { color: alpha(palette.text.primary, 0.6), display: 'flex', flexDirection: 'column', gap: spacing(0.5) }));
|
|
@@ -90,6 +88,7 @@ var ArrowIcon = styled(ArrowForwardIosIcon)(function (_a) {
|
|
|
90
88
|
export var DeviceCard = function (_a) {
|
|
91
89
|
var image = _a.image, name = _a.name, deviceId = _a.deviceId, deviceIdLabel = _a.deviceIdLabel, isLinked = _a.isLinked, pairedWith = _a.pairedWith, onClick = _a.onClick, badge = _a.badge, border = _a.border, arrow = _a.arrow, loading = _a.loading, endAdornment = _a.endAdornment, rest = __rest(_a, ["image", "name", "deviceId", "deviceIdLabel", "isLinked", "pairedWith", "onClick", "badge", "border", "arrow", "loading", "endAdornment"]);
|
|
92
90
|
var t = useTranslation().t;
|
|
91
|
+
var _b = useTheme(), typography = _b.typography, palette = _b.palette;
|
|
93
92
|
var getEndComponent = function () {
|
|
94
93
|
if (endAdornment)
|
|
95
94
|
return endAdornment;
|
|
@@ -98,6 +97,6 @@ export var DeviceCard = function (_a) {
|
|
|
98
97
|
if (arrow)
|
|
99
98
|
return _jsx(ArrowIcon, {});
|
|
100
99
|
};
|
|
101
|
-
return (_jsxs(DeviceCardContainer, __assign({ onClick: onClick, sx: { cursor: onClick ? 'pointer' : 'default' }, showBorder: border }, rest, { children: [_jsxs(DeviceDetails, { children: [image && _jsx(DeviceImage, { src: image, alt: 'Device' }), _jsxs(DeviceInfo, { children: [_jsx(
|
|
100
|
+
return (_jsxs(DeviceCardContainer, __assign({ onClick: onClick, sx: { cursor: onClick ? 'pointer' : 'default' }, showBorder: border }, rest, { children: [_jsxs(DeviceDetails, { children: [image && _jsx(DeviceImage, { src: image, alt: 'Device' }), _jsxs(DeviceInfo, { children: [_jsx(TruncatedTooltipText, { text: name, style: __assign(__assign({}, typography.subtitle1), { color: palette.components.deviceCard.title, fontWeight: typography.fontWeightBold }) }), _jsxs(DeviceIdInfo, { children: [pairedWith && (_jsxs("span", { children: [t('terminal_paired_with'), ": ", _jsx(DeviceIdBold, { children: pairedWith })] })), _jsxs("span", { children: [t(deviceIdLabel !== null && deviceIdLabel !== void 0 ? deviceIdLabel : 'terminal_device_id'), ": ", _jsx(DeviceIdBold, { children: deviceId })] })] })] })] }), badge && _jsx(Badge, __assign({ active: isLinked }, { children: isLinked ? t('terminal_linked') : t('terminal_unlinked') })), _jsx(Box, __assign({ display: 'flex', alignItems: 'center' }, { children: getEndComponent() }))] })));
|
|
102
101
|
};
|
|
103
102
|
export default memo(DeviceCard);
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { useRef, useState, useEffect } from 'react';
|
|
14
|
+
import Tooltip from '../Tooltip';
|
|
15
|
+
var TruncatedTooltipText = function (_a) {
|
|
16
|
+
var text = _a.text, style = _a.style;
|
|
17
|
+
var textRef = useRef(null);
|
|
18
|
+
var _b = useState(false), isTruncated = _b[0], setIsTruncated = _b[1];
|
|
19
|
+
var _c = useState(false), hasSpace = _c[0], setHasSpace = _c[1];
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
if (text.includes(' ')) {
|
|
22
|
+
setHasSpace(true);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
var el = textRef === null || textRef === void 0 ? void 0 : textRef.current;
|
|
26
|
+
if (el) {
|
|
27
|
+
setIsTruncated(el.scrollWidth > el.clientWidth);
|
|
28
|
+
}
|
|
29
|
+
}, [text]);
|
|
30
|
+
var content = (_jsx("span", __assign({ ref: textRef, style: __assign({ whiteSpace: hasSpace ? 'break-spaces' : 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'block' }, style) }, { children: text })));
|
|
31
|
+
return isTruncated ? (_jsx(Tooltip, __assign({ title: text, placement: 'top' }, { children: content }))) : (content);
|
|
32
|
+
};
|
|
33
|
+
export default TruncatedTooltipText;
|
|
@@ -255,7 +255,7 @@ export var unlinkTerminalDevice = createAsyncThunk('terminal/unlinkTerminalDevic
|
|
|
255
255
|
_a = thunkApi.getState().terminal.data.terminalInfo.selectedTerminal, id = _a.id, device = _a.device;
|
|
256
256
|
payload = {
|
|
257
257
|
deviceId: id,
|
|
258
|
-
initiator: '
|
|
258
|
+
initiator: 'connect',
|
|
259
259
|
device: {
|
|
260
260
|
id: (device === null || device === void 0 ? void 0 : device.id) || ''
|
|
261
261
|
}
|