@tap-payments/os-micro-frontend-shared 0.1.139-test.1-test.13 → 0.1.139-test.10
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/ChargeStatusIcon/ChargeStatusIcon.d.ts +24 -2
- package/build/components/StatusIcons/ChargeStatusIcon/ChargeStatusIcon.js +24 -4
- package/build/components/StatusIcons/ChargeStatusIcon/index.d.ts +0 -2
- package/build/components/StatusIcons/ChargeStatusIcon/index.js +0 -2
- package/build/components/TableCells/CustomCells/StatusCell/StatusCell.d.ts +1 -4
- package/build/components/TableCells/CustomCells/StatusCell/StatusCell.js +5 -10
- package/build/components/TableCells/CustomCells/StatusCell/StatusCellSheet.d.ts +4 -0
- package/build/components/TableCells/CustomCells/StatusCell/StatusCellSheet.js +21 -0
- package/build/components/TableCells/CustomCells/StatusCell/StatusCellText.d.ts +6 -0
- package/build/components/TableCells/CustomCells/StatusCell/StatusCellText.js +42 -0
- package/build/components/TableCells/CustomCells/StatusCell/type.d.ts +2 -4
- package/build/components/TableCells/CustomCells/StatusCell/useStatusCell.d.ts +6 -0
- package/build/components/TableCells/CustomCells/StatusCell/useStatusCell.js +8 -0
- package/build/components/TableCells/CustomCells/StatusCell/utils.d.ts +2 -1
- package/build/components/TableCells/CustomCells/StatusCell/utils.js +2 -1
- package/package.json +2 -2
- package/build/components/StatusIcons/ChargeStatusIcon/ChargeStatusIconSheet.d.ts +0 -2
- package/build/components/StatusIcons/ChargeStatusIcon/ChargeStatusIconSheet.js +0 -11
- package/build/components/StatusIcons/ChargeStatusIcon/ChargeStatusIconText.d.ts +0 -2
- package/build/components/StatusIcons/ChargeStatusIcon/ChargeStatusIconText.js +0 -28
- package/build/components/StatusIcons/ChargeStatusIcon/type.d.ts +0 -32
- package/build/components/StatusIcons/ChargeStatusIcon/type.js +0 -1
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { SelectionProps } from '../../../types/index.js';
|
|
3
|
+
import { type ChargeStatus } from '../../TableCells';
|
|
4
|
+
export declare function ChargeStatusIcon({ chargeStatus, gatewayTooltip, acquirerTooltip, chargeTooltip, errorCode, isTextShown, gatewayCode, acquirerCode, unCapturedStyles, iconStyles, iconWrapperStyles, gatewayIconWrapperStyles, gatewayContainerStyles, gateWayIconStyles, showBadge, isSheetViewShown, selectionProps, chipIndex, }: Readonly<{
|
|
5
|
+
chargeStatus?: ChargeStatus;
|
|
6
|
+
gatewayTooltip?: string;
|
|
7
|
+
showAuthorizedStatus?: boolean;
|
|
8
|
+
chargeTooltip?: string;
|
|
9
|
+
acquirerTooltip?: string;
|
|
10
|
+
errorCode?: string;
|
|
11
|
+
isTextShown?: boolean;
|
|
12
|
+
gatewayCode?: React.ReactNode;
|
|
13
|
+
acquirerCode?: React.ReactNode;
|
|
14
|
+
unCapturedStyles?: CSSProperties;
|
|
15
|
+
iconStyles?: CSSProperties;
|
|
16
|
+
iconWrapperStyles?: CSSProperties;
|
|
17
|
+
gatewayIconWrapperStyles?: CSSProperties;
|
|
18
|
+
gatewayContainerStyles?: CSSProperties;
|
|
19
|
+
gateWayIconStyles?: CSSProperties;
|
|
20
|
+
showBadge?: boolean;
|
|
21
|
+
isSheetViewShown?: boolean;
|
|
22
|
+
selectionProps?: SelectionProps;
|
|
23
|
+
chipIndex?: number;
|
|
24
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from '@mui/material/styles';
|
|
2
3
|
import camelCase from 'lodash/camelCase';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import Tooltip from '../../Tooltip';
|
|
5
6
|
import { unCapturedStatuses } from '../../../constants/index.js';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
7
|
+
import StatusChipWithCopy from '../../StatusChipWithCopy';
|
|
8
|
+
import { capturedStatusesStyles, unCapturedStatusesStyles, statusIcons } from '../../TableCells/CustomCells/StatusCell/constant';
|
|
9
|
+
import { StatusIcon, StatusIconWrapper, TextLabel } from '../../TableCells/CustomCells/style';
|
|
10
|
+
import { AcquirerContainerAnimationVariants, ErrorCodeLabel, ErrorCodeLabelAnimationVariants, ErrorCodeVariants, ErrorCodeWrapper, GateWayIcon, GatewayIconWrapper, GatewayIconWrapperAnimationTransition, GatewaysContainer, GatewaysContainerAnimationVariants, StatusTextLabel, UnCapturedBadge, UnCapturedContainer, errorCodeLabelAnimation, TextViewWrapper, } from './style';
|
|
11
|
+
export function ChargeStatusIcon({ chargeStatus, gatewayTooltip, acquirerTooltip, chargeTooltip, errorCode, isTextShown, gatewayCode, acquirerCode, unCapturedStyles, iconStyles, iconWrapperStyles, gatewayIconWrapperStyles, gatewayContainerStyles, gateWayIconStyles, showBadge = true, isSheetViewShown = false, selectionProps = {}, chipIndex = 0, }) {
|
|
10
12
|
const unCapturedStatusStyle = chargeStatus ? unCapturedStatusesStyles[chargeStatus] : null;
|
|
13
|
+
const captureStatusStyle = chargeStatus ? capturedStatusesStyles[chargeStatus] : null;
|
|
14
|
+
const theme = useTheme();
|
|
11
15
|
const { t } = useTranslation();
|
|
12
16
|
const chargeTooltipTitle = chargeTooltip && (_jsx(_Fragment, { children: _jsx("div", { children: chargeTooltip }) }));
|
|
13
17
|
const acquirerTooltipTitle = acquirerTooltip && (_jsxs(_Fragment, { children: [_jsx("div", { children: "Acquirer" }), _jsx("div", { children: acquirerTooltip })] }));
|
|
14
18
|
const gatewayTooltipTitle = gatewayTooltip && (_jsxs(_Fragment, { children: [_jsx("div", { children: "Gateway" }), _jsx("div", { children: gatewayTooltip })] }));
|
|
15
19
|
const chargeIcon = chargeStatus && statusIcons[chargeStatus] && (_jsx("div", Object.assign({ "data-testid": "ChargeStatusIcon_ChargeIcon", style: Object.assign({ display: 'flex', alignItems: 'center', justifyContent: 'center', width: '16px', height: '16px', borderRadius: unCapturedStatusStyle ? '50%' : '' }, iconWrapperStyles) }, { children: _jsx(StatusIcon, { src: statusIcons[chargeStatus], alt: "charge-icon", "data-testid": "ChargeStatusIcon_StatusIcon", style: Object.assign({ borderRadius: unCapturedStatusStyle ? '50%' : '', width: '16px', height: '16px' }, iconStyles) }) })));
|
|
20
|
+
if (isSheetViewShown) {
|
|
21
|
+
return (_jsxs(TextViewWrapper, { children: [_jsxs(StatusChipWithCopy, Object.assign({ copyText: t(camelCase(chargeStatus)), chipIndex: chipIndex, selectionProps: selectionProps }, { children: [t(camelCase(chargeStatus)), " ", errorCode] })), unCapturedStatusStyle && (_jsxs(_Fragment, { children: [gatewayCode && (_jsxs(StatusChipWithCopy, Object.assign({ copyText: "Gateway", chipIndex: 1, selectionProps: selectionProps }, { children: ["Gateway ", gatewayCode] }))), acquirerCode && (_jsxs(StatusChipWithCopy, Object.assign({ copyText: "Acquirer", chipIndex: 2, selectionProps: selectionProps }, { children: ["Acquirer ", acquirerCode] })))] }))] }));
|
|
22
|
+
}
|
|
23
|
+
if (isTextShown) {
|
|
24
|
+
return (_jsxs(TextViewWrapper, { children: [_jsx(Tooltip, Object.assign({ title: chargeTooltipTitle }, { children: _jsxs(StatusTextLabel, Object.assign({ "data-testid": "ChargeStatusIcon_isTextShown", "data-status": camelCase(chargeStatus), sx: {
|
|
25
|
+
background: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.background) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.background) || 'transparent',
|
|
26
|
+
color: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.color) || theme.palette.info.dark,
|
|
27
|
+
borderColor: `${(unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.color) || theme.palette.info.dark}1A`,
|
|
28
|
+
} }, { children: [t(camelCase(chargeStatus)), " ", errorCode] })) })), unCapturedStatusStyle && (_jsxs(_Fragment, { children: [gatewayCode && (_jsx(Tooltip, Object.assign({ title: gatewayTooltipTitle }, { children: _jsxs(TextLabel, Object.assign({ "data-testid": "ChargeStatusIcon_isTextShown", "data-status": camelCase(chargeStatus), sx: {
|
|
29
|
+
background: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.background) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.background) || 'transparent',
|
|
30
|
+
color: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.color) || theme.palette.info.dark,
|
|
31
|
+
} }, { children: ["Gateway ", gatewayCode] })) }))), acquirerCode && (_jsx(Tooltip, Object.assign({ title: acquirerTooltipTitle }, { children: _jsxs(TextLabel, Object.assign({ "data-testid": "ChargeStatusIcon_isTextShown", "data-status": camelCase(chargeStatus), sx: {
|
|
32
|
+
background: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.background) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.background) || 'transparent',
|
|
33
|
+
color: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.color) || theme.palette.info.dark,
|
|
34
|
+
} }, { children: ["Acquirer ", acquirerCode] })) })))] }))] }));
|
|
35
|
+
}
|
|
16
36
|
return (_jsx(StatusIconWrapper, Object.assign({ "data-testid": "ChargeStatusIcon_StatusIconWrapper", style: Object.assign({}, iconWrapperStyles) }, { children: (unCapturedStatuses === null || unCapturedStatuses === void 0 ? void 0 : unCapturedStatuses.includes(chargeStatus || '')) && (chargeTooltipTitle || acquirerTooltipTitle || gatewayTooltipTitle) ? (_jsxs(UnCapturedContainer, Object.assign({ "data-testid": "ChargeStatusIcon_UnCapturedContainer", whileHover: ['animate', 'fadeIn'], style: Object.assign(Object.assign({ left: '0' }, (showBadge && {
|
|
17
37
|
paddingInline: '12px',
|
|
18
38
|
border: '1px solid #F2F2F2',
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { StatusCellProps } from './type';
|
|
2
|
-
declare function StatusCell({ statuses,
|
|
3
|
-
isChargesService?: boolean;
|
|
4
|
-
isAuthorizationsService?: boolean;
|
|
5
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function StatusCell({ statuses, centerIconKey, ...props }: StatusCellProps): import("react/jsx-runtime").JSX.Element;
|
|
6
3
|
export default StatusCell;
|
|
@@ -12,16 +12,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { TableCell } from '../../../TableCells';
|
|
14
14
|
import { StatusIcon, StatusContainer, StatusWrapper } from './style';
|
|
15
|
-
import {
|
|
15
|
+
import { useStatusCell } from './useStatusCell';
|
|
16
16
|
function StatusCell(_a) {
|
|
17
|
-
var { statuses,
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
if (tableMode === 'sheet') {
|
|
21
|
-
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StatusContainer, Object.assign({ sx: { paddingRight: '30px' } }, { children: statusesList.map((status) => status) })) })));
|
|
22
|
-
}
|
|
23
|
-
const xGapValue = isTextShown ? xGap || 120 : 40;
|
|
24
|
-
const centerIconIndex = centerIconKey ? Object.entries(statusesFilteredObject).findIndex(([key]) => key === centerIconKey) : 0;
|
|
17
|
+
var { statuses, centerIconKey } = _a, props = __rest(_a, ["statuses", "centerIconKey"]);
|
|
18
|
+
const { centerIconIndex, statusesList } = useStatusCell({ statuses, centerIconKey });
|
|
19
|
+
const xGapValue = 40;
|
|
25
20
|
return (_jsx(TableCell, Object.assign({}, props, { "data-testid": "StatusCell", sx: {
|
|
26
21
|
position: 'relative',
|
|
27
22
|
overflow: 'visible',
|
|
@@ -41,7 +36,7 @@ function StatusCell(_a) {
|
|
|
41
36
|
x: xHoverPosition,
|
|
42
37
|
zIndex: 100 - Math.abs(centerIconIndex - index),
|
|
43
38
|
},
|
|
44
|
-
}, transition: { duration: 0.3, type: 'tween', ease: 'easeOut' }, statusesCount: statusesList.length || 0 }, { children: _jsx(StatusIcon,
|
|
39
|
+
}, transition: { duration: 0.3, type: 'tween', ease: 'easeOut' }, statusesCount: statusesList.length || 0 }, { children: _jsx(StatusIcon, { children: status }) }), index));
|
|
45
40
|
}) })) })));
|
|
46
41
|
}
|
|
47
42
|
export default StatusCell;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TableCellProps } from '@mui/material/TableCell';
|
|
2
|
+
import type { StatusCellProps } from './type';
|
|
3
|
+
declare function StatusCellSheet({ statuses, ...props }: Pick<StatusCellProps, 'statuses'> & TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default StatusCellSheet;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { TableCell } from '../../../TableCells';
|
|
14
|
+
import { StatusContainer } from './style';
|
|
15
|
+
import { useStatusCell } from './useStatusCell';
|
|
16
|
+
function StatusCellSheet(_a) {
|
|
17
|
+
var { statuses } = _a, props = __rest(_a, ["statuses"]);
|
|
18
|
+
const { statusesList } = useStatusCell({ statuses });
|
|
19
|
+
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StatusContainer, Object.assign({ sx: { paddingRight: '30px' } }, { children: statusesList.map((status) => status) })) })));
|
|
20
|
+
}
|
|
21
|
+
export default StatusCellSheet;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StatusCellProps } from './type';
|
|
2
|
+
interface StatusCellTextProps extends StatusCellProps {
|
|
3
|
+
xGap?: number;
|
|
4
|
+
}
|
|
5
|
+
declare function StatusCellText({ statuses, centerIconKey, xGap, ...props }: StatusCellTextProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default StatusCellText;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { TableCell } from '../../../TableCells';
|
|
14
|
+
import { StatusIcon, StatusContainer, StatusWrapper } from './style';
|
|
15
|
+
import { useStatusCell } from './useStatusCell';
|
|
16
|
+
function StatusCellText(_a) {
|
|
17
|
+
var { statuses, centerIconKey, xGap } = _a, props = __rest(_a, ["statuses", "centerIconKey", "xGap"]);
|
|
18
|
+
const { statusesList, centerIconIndex } = useStatusCell({ statuses, centerIconKey });
|
|
19
|
+
const xGapValue = xGap || 120;
|
|
20
|
+
return (_jsx(TableCell, Object.assign({}, props, { "data-testid": "StatusCell", sx: {
|
|
21
|
+
position: 'relative',
|
|
22
|
+
overflow: 'visible',
|
|
23
|
+
} }, { children: _jsx(StatusContainer, Object.assign({ initial: "initial", whileHover: "hover", animate: "start" }, { children: statusesList.map((status, index) => {
|
|
24
|
+
if (!status)
|
|
25
|
+
return;
|
|
26
|
+
// To keep x position of each icon while hovering consistent
|
|
27
|
+
const xHoverPosition = (index - centerIconIndex) * xGapValue;
|
|
28
|
+
const isIconAfterCenterIcon = index > centerIconIndex;
|
|
29
|
+
const isIconBeforeCenterIcon = index < centerIconIndex;
|
|
30
|
+
return (_jsx(StatusWrapper, Object.assign({ variants: {
|
|
31
|
+
initial: {
|
|
32
|
+
x: isIconBeforeCenterIcon ? -5 : isIconAfterCenterIcon ? 5 : 0,
|
|
33
|
+
zIndex: isIconBeforeCenterIcon ? 100 - index : isIconAfterCenterIcon ? index : 100,
|
|
34
|
+
},
|
|
35
|
+
hover: {
|
|
36
|
+
x: xHoverPosition,
|
|
37
|
+
zIndex: 100 - Math.abs(centerIconIndex - index),
|
|
38
|
+
},
|
|
39
|
+
}, transition: { duration: 0.3, type: 'tween', ease: 'easeOut' }, statusesCount: statusesList.length || 0 }, { children: _jsx(StatusIcon, Object.assign({ isTextShown: true }, { children: status })) }), index));
|
|
40
|
+
}) })) })));
|
|
41
|
+
}
|
|
42
|
+
export default StatusCellText;
|
|
@@ -4,10 +4,8 @@ import { authorizedStatusIcons, payoutStatusIcons, refundStatusIcons } from './c
|
|
|
4
4
|
export type RefundStatusType = keyof typeof refundStatusIcons;
|
|
5
5
|
export type PayoutStatusType = keyof typeof payoutStatusIcons;
|
|
6
6
|
export type AuthorizedStatusType = keyof typeof authorizedStatusIcons;
|
|
7
|
+
export type Statuses = Record<string, React.ReactNode | undefined | null>;
|
|
7
8
|
export interface StatusCellProps extends TableCellProps {
|
|
8
|
-
statuses:
|
|
9
|
-
isTextShown?: boolean;
|
|
9
|
+
statuses: Statuses;
|
|
10
10
|
centerIconKey?: string;
|
|
11
|
-
xGap?: number;
|
|
12
|
-
tableMode?: 'default' | 'text' | 'sheet';
|
|
13
11
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StatusCellProps } from './type';
|
|
3
|
+
export declare const useStatusCell: ({ statuses, centerIconKey }: Pick<StatusCellProps, 'statuses' | 'centerIconKey'>) => {
|
|
4
|
+
statusesList: import("react").ReactNode[];
|
|
5
|
+
centerIconIndex: number;
|
|
6
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { getStatusesFilteredObject } from './utils';
|
|
3
|
+
export const useStatusCell = ({ statuses, centerIconKey }) => {
|
|
4
|
+
const statusesFilteredObject = useMemo(() => getStatusesFilteredObject(statuses), [statuses]);
|
|
5
|
+
const statusesList = useMemo(() => Object.values(statusesFilteredObject).filter(Boolean), [statusesFilteredObject]);
|
|
6
|
+
const centerIconIndex = useMemo(() => (centerIconKey ? Object.entries(statusesFilteredObject).findIndex(([key]) => key === centerIconKey) : 0), [statusesFilteredObject, centerIconKey]);
|
|
7
|
+
return { statusesList, centerIconIndex };
|
|
8
|
+
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { Statuses } from './type';
|
|
3
|
+
export declare const getStatusesFilteredObject: (statuses: Statuses) => Record<string, import("react").ReactNode>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export const getStatusesFilteredObject = (statuses) => {
|
|
2
|
-
|
|
2
|
+
const filteredList = Object.keys(statuses)
|
|
3
3
|
.filter((key) => statuses[key])
|
|
4
4
|
.reduce((acc, key) => {
|
|
5
5
|
acc[key] = statuses[key];
|
|
6
6
|
return acc;
|
|
7
7
|
}, {});
|
|
8
|
+
return statuses ? filteredList : {};
|
|
8
9
|
};
|
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.139-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.139-test.10",
|
|
5
|
+
"testVersion": 10,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import camelCase from 'lodash/camelCase';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import StatusChipWithCopy from '../../StatusChipWithCopy';
|
|
5
|
-
import { unCapturedStatusesStyles } from '../../TableCells/CustomCells/StatusCell/constant';
|
|
6
|
-
import { TextViewWrapper } from './style';
|
|
7
|
-
export function ChargeStatusIconSheet({ chargeStatus, errorCode, gatewayCode, acquirerCode, selectionProps = {}, chipIndex = 0, }) {
|
|
8
|
-
const { t } = useTranslation();
|
|
9
|
-
const unCapturedStatusStyle = chargeStatus ? unCapturedStatusesStyles[chargeStatus] : null;
|
|
10
|
-
return (_jsxs(TextViewWrapper, { children: [_jsxs(StatusChipWithCopy, Object.assign({ copyText: t(camelCase(chargeStatus)), chipIndex: chipIndex, selectionProps: selectionProps }, { children: [t(camelCase(chargeStatus)), " ", errorCode] })), unCapturedStatusStyle && (_jsxs(_Fragment, { children: [gatewayCode && (_jsxs(StatusChipWithCopy, Object.assign({ copyText: "Gateway", chipIndex: 1, selectionProps: selectionProps }, { children: ["Gateway ", gatewayCode] }))), acquirerCode && (_jsxs(StatusChipWithCopy, Object.assign({ copyText: "Acquirer", chipIndex: 2, selectionProps: selectionProps }, { children: ["Acquirer ", acquirerCode] })))] }))] }));
|
|
11
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useTheme } from '@mui/material/styles';
|
|
3
|
-
import camelCase from 'lodash/camelCase';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import Tooltip from '../../Tooltip';
|
|
6
|
-
import { capturedStatusesStyles, unCapturedStatusesStyles } from '../../TableCells/CustomCells/StatusCell/constant';
|
|
7
|
-
import { TextLabel } from '../../TableCells/CustomCells/style';
|
|
8
|
-
import { StatusTextLabel, TextViewWrapper } from './style';
|
|
9
|
-
export function ChargeStatusIconText({ chargeStatus, gatewayTooltip, acquirerTooltip, chargeTooltip, errorCode, gatewayCode, acquirerCode, }) {
|
|
10
|
-
const unCapturedStatusStyle = chargeStatus ? unCapturedStatusesStyles[chargeStatus] : null;
|
|
11
|
-
const captureStatusStyle = chargeStatus ? capturedStatusesStyles[chargeStatus] : null;
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
const { t } = useTranslation();
|
|
14
|
-
const chargeTooltipTitle = chargeTooltip && (_jsx(_Fragment, { children: _jsx("div", { children: chargeTooltip }) }));
|
|
15
|
-
const acquirerTooltipTitle = acquirerTooltip && (_jsxs(_Fragment, { children: [_jsx("div", { children: "Acquirer" }), _jsx("div", { children: acquirerTooltip })] }));
|
|
16
|
-
const gatewayTooltipTitle = gatewayTooltip && (_jsxs(_Fragment, { children: [_jsx("div", { children: "Gateway" }), _jsx("div", { children: gatewayTooltip })] }));
|
|
17
|
-
return (_jsxs(TextViewWrapper, { children: [_jsx(Tooltip, Object.assign({ title: chargeTooltipTitle }, { children: _jsxs(StatusTextLabel, Object.assign({ "data-testid": "ChargeStatusIcon_isTextShown", "data-status": camelCase(chargeStatus), sx: {
|
|
18
|
-
background: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.background) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.background) || 'transparent',
|
|
19
|
-
color: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.color) || theme.palette.info.dark,
|
|
20
|
-
borderColor: `${(unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.color) || theme.palette.info.dark}1A`,
|
|
21
|
-
} }, { children: [t(camelCase(chargeStatus)), " ", errorCode] })) })), unCapturedStatusStyle && (_jsxs(_Fragment, { children: [gatewayCode && (_jsx(Tooltip, Object.assign({ title: gatewayTooltipTitle }, { children: _jsxs(TextLabel, Object.assign({ "data-testid": "ChargeStatusIcon_isTextShown", "data-status": camelCase(chargeStatus), sx: {
|
|
22
|
-
background: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.background) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.background) || 'transparent',
|
|
23
|
-
color: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.color) || theme.palette.info.dark,
|
|
24
|
-
} }, { children: ["Gateway ", gatewayCode] })) }))), acquirerCode && (_jsx(Tooltip, Object.assign({ title: acquirerTooltipTitle }, { children: _jsxs(TextLabel, Object.assign({ "data-testid": "ChargeStatusIcon_isTextShown", "data-status": camelCase(chargeStatus), sx: {
|
|
25
|
-
background: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.background) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.background) || 'transparent',
|
|
26
|
-
color: (unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color) || (captureStatusStyle === null || captureStatusStyle === void 0 ? void 0 : captureStatusStyle.color) || theme.palette.info.dark,
|
|
27
|
-
} }, { children: ["Acquirer ", acquirerCode] })) })))] }))] }));
|
|
28
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type ChargeStatus } from '../../TableCells';
|
|
2
|
-
import { SelectionProps } from '../../../types/index.js';
|
|
3
|
-
import { CSSProperties } from 'react';
|
|
4
|
-
interface ChargeStatusIconCommon {
|
|
5
|
-
chargeStatus?: ChargeStatus;
|
|
6
|
-
errorCode?: string;
|
|
7
|
-
showAuthorizedStatus?: boolean;
|
|
8
|
-
gatewayCode?: React.ReactNode;
|
|
9
|
-
acquirerCode?: React.ReactNode;
|
|
10
|
-
}
|
|
11
|
-
export interface ChargeStatusIconSheetProps extends ChargeStatusIconCommon {
|
|
12
|
-
selectionProps?: SelectionProps;
|
|
13
|
-
chipIndex?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface ChargeStatusIconTextProps extends ChargeStatusIconCommon {
|
|
16
|
-
gatewayTooltip?: string;
|
|
17
|
-
chargeTooltip?: string;
|
|
18
|
-
acquirerTooltip?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface ChargeStatusIcon extends ChargeStatusIconCommon {
|
|
21
|
-
gatewayTooltip?: string;
|
|
22
|
-
chargeTooltip?: string;
|
|
23
|
-
acquirerTooltip?: string;
|
|
24
|
-
unCapturedStyles?: CSSProperties;
|
|
25
|
-
iconStyles?: CSSProperties;
|
|
26
|
-
iconWrapperStyles?: CSSProperties;
|
|
27
|
-
gatewayIconWrapperStyles?: CSSProperties;
|
|
28
|
-
gatewayContainerStyles?: CSSProperties;
|
|
29
|
-
gateWayIconStyles?: CSSProperties;
|
|
30
|
-
showBadge?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|