@tap-payments/os-micro-frontend-shared 0.1.70-test.27 → 0.1.70-test.29
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/StatusIcons/AuthorizationAutoIcons/CaptureAutoIcon.d.ts +1 -1
- package/build/components/StatusIcons/AuthorizationAutoIcons/CaptureAutoIcon.js +12 -3
- package/build/components/StatusIcons/AuthorizationAutoIcons/type.d.ts +3 -0
- package/build/components/TableCells/CustomCells/StatusCell/StatusCell.js +2 -3
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BalanceCellProps } from './type';
|
|
2
|
-
declare function CaptureAutoIcon({ voidPercentage, capturePercentage, captureCount, autoType, captureAmount, voidAmount, currency, isTextShown, remainingAmount, }: BalanceCellProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function CaptureAutoIcon({ voidPercentage, capturePercentage, captureCount, autoType, captureAmount, voidAmount, currency, isTextShown, remainingAmount, isSheetViewShown, selectionProps, }: BalanceCellProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default CaptureAutoIcon;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from 'react';
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
3
|
import { useTheme } from '@mui/material/styles';
|
|
4
4
|
import { motion } from 'framer-motion';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
@@ -11,7 +11,8 @@ import { formatAmount, formatAmountWithCurrency } from '../../../utils/index.js'
|
|
|
11
11
|
import { autoIcons } from './constant';
|
|
12
12
|
import { AutoIconWrapper, BalanceCellContainer, PartialIcon, PercentageContainer, PiePercentage, AutoIconImage, FullyCapturedWrapper } from './style';
|
|
13
13
|
import { formatPercentage } from './utils';
|
|
14
|
-
|
|
14
|
+
import StatusChipWithCopy from '../../StatusChipWithCopy';
|
|
15
|
+
function CaptureAutoIcon({ voidPercentage, capturePercentage, captureCount, autoType, captureAmount, voidAmount, currency, isTextShown, remainingAmount, isSheetViewShown, selectionProps = {}, }) {
|
|
15
16
|
var _a, _b;
|
|
16
17
|
const isFullyUsed = Number(capturePercentage) + Number(voidPercentage) === 100 || remainingAmount <= 0;
|
|
17
18
|
const theme = useTheme();
|
|
@@ -54,7 +55,15 @@ function CaptureAutoIcon({ voidPercentage, capturePercentage, captureCount, auto
|
|
|
54
55
|
},
|
|
55
56
|
} }, { children: [_jsxs(PercentageContainer, Object.assign({ isCapture: true, percentage: capturePercentage }, { children: [capturePercentage, "% ", _jsx(PiePercentage, { isCapture: true, percentage: formatPercentage(capturePercentage) })] })), captureCount > 1 && (_jsxs(StyledBadge, Object.assign({ compact: true, variant: BadgeVariants.DARK }, { children: [captureCount, "x"] })))] }))] })) }))) : autoType === 'CAPTURED' && !isFullyUsed ? (_jsx(Tooltip, Object.assign({ title: generateAutoTooltip('Capture') }, { children: _jsx(AutoIconWrapper, { children: _jsx(AutoIconImage, { src: (_a = autoIcons.CAPTURED) === null || _a === void 0 ? void 0 : _a.icon, alt: "auto" }) }) }))) : (_jsx(Tooltip, Object.assign({ title: generateAutoTooltip('Capture') }, { children: _jsx(AutoIconWrapper, { children: _jsx(AutoIconImage, { src: (_b = autoIcons.CAPTURED) === null || _b === void 0 ? void 0 : _b.icon, alt: "auto" }) }) })));
|
|
56
57
|
const captureStatus = capturePercentage === 100 ? (_jsx(Tooltip, Object.assign({ title: t('captured') }, { children: _jsx(FullyCapturedWrapper, { children: _jsx(AutoIconImage, { src: capturedIcon, alt: "captured" }) }) }))) : (autoCaptureStatus);
|
|
57
|
-
const captureContent =
|
|
58
|
+
const captureContent = useMemo(() => {
|
|
59
|
+
if (isSheetViewShown && captureStatus) {
|
|
60
|
+
return (_jsx(StatusChipWithCopy, Object.assign({ chipIndex: 4, copyText: t('captured'), selectionProps: selectionProps }, { children: t('captured') })));
|
|
61
|
+
}
|
|
62
|
+
if (isTextShown && captureStatus) {
|
|
63
|
+
return _jsx(CaptureTextLabel, { children: t('captured') });
|
|
64
|
+
}
|
|
65
|
+
return captureStatus;
|
|
66
|
+
}, [isTextShown, captureStatus]);
|
|
58
67
|
return (captureContent && (_jsx("div", Object.assign({ style: {
|
|
59
68
|
zIndex: 12,
|
|
60
69
|
} }, { children: captureContent }))));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TableCellProps } from '@mui/material';
|
|
2
|
+
import { SelectionProps } from '../../../types/index.js';
|
|
2
3
|
export interface BalanceCellProps extends TableCellProps {
|
|
3
4
|
autoType?: 'VOID' | 'CAPTURED';
|
|
4
5
|
capturePercentage: number;
|
|
@@ -11,4 +12,6 @@ export interface BalanceCellProps extends TableCellProps {
|
|
|
11
12
|
voidCount: number;
|
|
12
13
|
isTextShown?: boolean;
|
|
13
14
|
remainingAmount: number;
|
|
15
|
+
isSheetViewShown?: boolean;
|
|
16
|
+
selectionProps?: SelectionProps;
|
|
14
17
|
}
|
|
@@ -9,17 +9,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { TableCell } from '../../../TableCells';
|
|
14
14
|
import { StatusIcon, StatusContainer, StatusWrapper } from './style';
|
|
15
15
|
import { getStatusesFilteredObject } from './utils';
|
|
16
|
-
import { Box } from '@mui/material';
|
|
17
16
|
function StatusCell(_a) {
|
|
18
17
|
var { statuses, isTextShown, centerIconKey, xGap, tableMode } = _a, props = __rest(_a, ["statuses", "isTextShown", "centerIconKey", "xGap", "tableMode"]);
|
|
19
18
|
const statusesFilteredObject = statuses ? getStatusesFilteredObject(statuses) : {};
|
|
20
19
|
const statusesList = Object.values(statusesFilteredObject).filter(Boolean);
|
|
21
20
|
if (tableMode === 'sheet') {
|
|
22
|
-
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StatusContainer, { children: statusesList.map((status
|
|
21
|
+
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StatusContainer, { children: statusesList.map((status) => status) }) })));
|
|
23
22
|
}
|
|
24
23
|
const xGapValue = isTextShown ? xGap || 120 : 40;
|
|
25
24
|
const centerIconIndex = centerIconKey ? Object.entries(statusesFilteredObject).findIndex(([key]) => key === centerIconKey) : 0;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.70-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.70-test.29",
|
|
5
|
+
"testVersion": 29,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|