@tap-payments/os-micro-frontend-shared 0.1.70-test.28 → 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.
@@ -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
- function CaptureAutoIcon({ voidPercentage, capturePercentage, captureCount, autoType, captureAmount, voidAmount, currency, isTextShown, remainingAmount, }) {
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 = isTextShown && captureStatus ? _jsx(CaptureTextLabel, { children: t('captured') }) : captureStatus;
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
  }
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.28",
5
- "testVersion": 28,
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",