@tap-payments/os-micro-frontend-shared 0.1.70-test.28 → 0.1.70-test.30-test.31
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/VoidAutoIcon.d.ts +1 -1
- package/build/components/StatusIcons/AuthorizationAutoIcons/VoidAutoIcon.js +12 -3
- package/build/components/StatusIcons/AuthorizationAutoIcons/type.d.ts +3 -0
- 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, isSheetViewShown, selectionProps]);
|
|
58
67
|
return (captureContent && (_jsx("div", Object.assign({ style: {
|
|
59
68
|
zIndex: 12,
|
|
60
69
|
} }, { children: captureContent }))));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BalanceCellProps } from './type';
|
|
2
|
-
declare function VoidAutoIcon({ voidPercentage, capturePercentage, voidCount, autoType, captureAmount, voidAmount, currency, isTextShown, remainingAmount, }: BalanceCellProps): import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
declare function VoidAutoIcon({ voidPercentage, capturePercentage, voidCount, autoType, captureAmount, voidAmount, currency, isTextShown, isSheetViewShown, selectionProps, remainingAmount, }: BalanceCellProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
export default VoidAutoIcon;
|
|
@@ -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, PercentageContainer, PiePercentage, AutoIconImage } from './style';
|
|
13
13
|
import { formatPercentage } from './utils';
|
|
14
|
-
|
|
14
|
+
import StatusChipWithCopy from '../../StatusChipWithCopy';
|
|
15
|
+
function VoidAutoIcon({ voidPercentage, capturePercentage, voidCount, autoType, captureAmount, voidAmount, currency, isTextShown, isSheetViewShown, selectionProps = {}, remainingAmount, }) {
|
|
15
16
|
var _a;
|
|
16
17
|
const isFullyUsed = Number(capturePercentage) + Number(voidPercentage) === 100 || remainingAmount <= 0;
|
|
17
18
|
const theme = useTheme();
|
|
@@ -59,7 +60,15 @@ function VoidAutoIcon({ voidPercentage, capturePercentage, voidCount, autoType,
|
|
|
59
60
|
},
|
|
60
61
|
} }, { children: _jsxs(StyledBadge, Object.assign({ compact: true, variant: BadgeVariants.NEUTRAL }, { children: [voidCount, "x"] })) })))] })) }))) : autoType === 'VOID' && !isFullyUsed ? (_jsx(Tooltip, Object.assign({ title: generateAutoTooltip('Void') }, { children: _jsx(AutoIconWrapper, { children: _jsx(AutoIconImage, { src: (_a = autoIcons.VOID) === null || _a === void 0 ? void 0 : _a.icon, alt: "auto" }) }) }))) : null;
|
|
61
62
|
const voidStatus = voidPercentage === 100 ? (_jsx(Tooltip, Object.assign({ title: t('void') }, { children: _jsx(AutoIconWrapper, { children: _jsx(AutoIconImage, { src: voidedIcon, alt: "void" }) }) }))) : (autoVoidStatus);
|
|
62
|
-
const voidContent =
|
|
63
|
+
const voidContent = useMemo(() => {
|
|
64
|
+
if (isSheetViewShown && voidStatus) {
|
|
65
|
+
return (_jsx(StatusChipWithCopy, Object.assign({ chipIndex: 5, copyText: t('void'), selectionProps: selectionProps }, { children: t('void') })));
|
|
66
|
+
}
|
|
67
|
+
if (isTextShown && voidStatus) {
|
|
68
|
+
return _jsx(VoidTextLabel, { children: t('void') });
|
|
69
|
+
}
|
|
70
|
+
return voidStatus;
|
|
71
|
+
}, [isTextShown, voidStatus, isSheetViewShown, selectionProps]);
|
|
63
72
|
return voidContent ? _jsx("div", Object.assign({ style: { zIndex: 11 } }, { children: voidContent })) : null;
|
|
64
73
|
}
|
|
65
74
|
export default VoidAutoIcon;
|
|
@@ -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
|
}
|
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.30-test.31",
|
|
5
|
+
"testVersion": 31,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|