@tap-payments/os-micro-frontend-shared 0.1.365-test.1 → 0.1.365-test.11
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/ActivityAreaChart/ActivityAreaChart.js +39 -25
- package/build/components/ActivityAreaChart/components/ChartLegend/ChartLegend.d.ts +8 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/ChartLegend.js +31 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/LegendLabel.d.ts +6 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/LegendLabel.js +4 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/constant.d.ts +17 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/constant.js +17 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/index.d.ts +3 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/index.js +3 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/style.d.ts +8 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/style.js +23 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/type.d.ts +2 -0
- package/build/components/ActivityAreaChart/components/ChartLegend/type.js +1 -0
- package/build/components/ActivityAreaChart/components/ChartTooltip/ChartTooltip.d.ts +2 -0
- package/build/components/ActivityAreaChart/components/ChartTooltip/ChartTooltip.js +24 -0
- package/build/components/ActivityAreaChart/components/ChartTooltip/index.d.ts +1 -0
- package/build/components/ActivityAreaChart/components/ChartTooltip/index.js +1 -0
- package/build/components/ActivityAreaChart/components/LoadingChart/LoadingChart.d.ts +1 -0
- package/build/components/ActivityAreaChart/components/{LoadingChart.js → LoadingChart/LoadingChart.js} +1 -2
- package/build/components/ActivityAreaChart/components/LoadingChart/index.d.ts +1 -0
- package/build/components/ActivityAreaChart/components/LoadingChart/index.js +1 -0
- package/build/components/ActivityAreaChart/components/index.d.ts +3 -2
- package/build/components/ActivityAreaChart/components/index.js +3 -2
- package/build/components/ActivityAreaChart/styles.d.ts +3 -1
- package/build/components/ActivityAreaChart/styles.js +4 -4
- package/build/components/ActivityAreaChart/types.d.ts +13 -11
- package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.d.ts +13 -0
- package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.js +21 -0
- package/build/components/MultiDatakeyDonut/index.d.ts +2 -0
- package/build/components/MultiDatakeyDonut/index.js +2 -0
- package/build/components/MultiDatakeyDonut/style.d.ts +28 -0
- package/build/components/MultiDatakeyDonut/style.js +46 -0
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/constants/reports.d.ts +1 -18
- package/build/constants/reports.js +27 -77
- package/build/types/apps.d.ts +8 -7
- package/build/utils/navigation.d.ts +1 -1
- package/package.json +4 -4
- package/build/components/ActivityAreaChart/components/ChartTooltip.d.ts +0 -3
- package/build/components/ActivityAreaChart/components/ChartTooltip.js +0 -24
- package/build/components/ActivityAreaChart/components/LoadingChart.d.ts +0 -2
|
@@ -1,43 +1,57 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
3
|
import { Tooltip, ResponsiveContainer, Area, AreaChart } from 'recharts';
|
|
4
|
-
import {
|
|
5
|
-
import { ChartTooltip, LoadingChart } from './components';
|
|
4
|
+
import { ChartTooltip, LoadingChart, ChartLegend, LEGENDS } from './components';
|
|
6
5
|
const ActivityAreaChart = ({ data, dataKey, isLoading, dateRange, selectedCurrency }) => {
|
|
7
|
-
const theme = useTheme();
|
|
8
6
|
const [chartHovered, setChartHovered] = useState(false);
|
|
9
7
|
const [cursorPosition, setCursorPosition] = useState({ x: 0, y: 0 });
|
|
8
|
+
const [activeLegend, setActiveLegend] = useState(LEGENDS.CHARGE.key);
|
|
10
9
|
const isEmpty = (data === null || data === void 0 ? void 0 : data.length) === 0;
|
|
10
|
+
const isAmountDataKeyActive = dataKey === 'amount';
|
|
11
11
|
const handleMouseMove = (e) => {
|
|
12
12
|
if (e.activeCoordinate && e.isTooltipActive) {
|
|
13
13
|
setCursorPosition(e.activeCoordinate);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
const MemoizedChartTooltip = useMemo(() => {
|
|
17
|
-
return _jsx(ChartTooltip, { position: cursorPosition, dateRange: dateRange, selectedCurrency: selectedCurrency });
|
|
17
|
+
return (_jsx(ChartTooltip, { position: cursorPosition, dateRange: dateRange, selectedCurrency: selectedCurrency, activeLegend: activeLegend, activeDataKey: dataKey }));
|
|
18
18
|
}, [cursorPosition]);
|
|
19
19
|
if (isLoading || isEmpty) {
|
|
20
20
|
return _jsx(LoadingChart, {});
|
|
21
21
|
}
|
|
22
|
-
return (_jsx(ResponsiveContainer, { children: _jsxs(AreaChart, Object.assign({ margin: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx(ResponsiveContainer, { children: _jsxs(AreaChart, Object.assign({ margin: { top: 20 }, data: data, onMouseMove: handleMouseMove }, { children: [(data === null || data === void 0 ? void 0 : data.length) > 0 && (_jsx(Tooltip, { content: MemoizedChartTooltip, cursor: {
|
|
23
|
+
fill: '#A5A8A3',
|
|
24
|
+
stroke: '#A5A8A3',
|
|
25
|
+
strokeWidth: 1,
|
|
26
|
+
strokeOpacity: 1,
|
|
27
|
+
stopOpacity: 0.3,
|
|
28
|
+
strokeDasharray: '5 5',
|
|
29
|
+
strokeLinecap: 'round',
|
|
30
|
+
strokeLinejoin: 'round',
|
|
31
|
+
} })), activeLegend === LEGENDS.REFUNDS.key && (_jsx(Area, { dataKey: isAmountDataKeyActive ? 'refundAmount' : 'refundCount', type: "monotone", stackId: "1", fill: "#5E30EB07", stroke: LEGENDS.REFUNDS.color, activeDot: {
|
|
32
|
+
r: 5,
|
|
33
|
+
fill: LEGENDS.REFUNDS.color,
|
|
34
|
+
strokeWidth: 2,
|
|
35
|
+
stroke: 'white',
|
|
36
|
+
cursor: chartHovered ? 'pointer' : 'default',
|
|
37
|
+
onMouseOver: () => setChartHovered(true),
|
|
38
|
+
onMouseLeave: () => setChartHovered(false),
|
|
39
|
+
} }, `${activeLegend}-${LEGENDS.REFUNDS.key}`)), _jsx(Area, { dataKey: isAmountDataKeyActive ? 'chargeAmount' : 'chargedCount', type: "monotone", stackId: "1", fill: "#76BB4007", stroke: LEGENDS.TRANSACTIONS.color, activeDot: {
|
|
40
|
+
r: 5,
|
|
41
|
+
fill: LEGENDS.TRANSACTIONS.color,
|
|
42
|
+
strokeWidth: 2,
|
|
43
|
+
stroke: 'white',
|
|
44
|
+
cursor: chartHovered ? 'pointer' : 'default',
|
|
45
|
+
onMouseOver: () => setChartHovered(true),
|
|
46
|
+
onMouseLeave: () => setChartHovered(false),
|
|
47
|
+
} }, `${activeLegend}-${LEGENDS.TRANSACTIONS.key}`), activeLegend === LEGENDS.CHARGE.key && (_jsx(Area, { dataKey: "chargeRateValue", type: "monotone", stackId: "1", fill: "#1F88D007", stroke: LEGENDS.CHARGE.color, activeDot: {
|
|
48
|
+
r: 5,
|
|
49
|
+
fill: LEGENDS.CHARGE.color,
|
|
50
|
+
strokeWidth: 2,
|
|
51
|
+
stroke: 'white',
|
|
52
|
+
cursor: chartHovered ? 'pointer' : 'default',
|
|
53
|
+
onMouseOver: () => setChartHovered(true),
|
|
54
|
+
onMouseLeave: () => setChartHovered(false),
|
|
55
|
+
} }, `${activeLegend}-${LEGENDS.CHARGE.key}`))] })) }), _jsx(ChartLegend, { activeLegend: activeLegend, onSelectLegend: setActiveLegend })] }));
|
|
42
56
|
};
|
|
43
57
|
export default ActivityAreaChart;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material/Box';
|
|
2
|
+
import { LegendKey } from './type';
|
|
3
|
+
interface ChartLegendProps extends BoxProps {
|
|
4
|
+
activeLegend: LegendKey;
|
|
5
|
+
onSelectLegend: (key: LegendKey) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ChartLegend: ({ activeLegend, onSelectLegend }: ChartLegendProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import { MenuItem } from '../../../index.js';
|
|
6
|
+
import { downArrowIcon } from '../../../../constants/index.js';
|
|
7
|
+
import { LegendLabel } from './LegendLabel';
|
|
8
|
+
import { LEGENDS } from './constant';
|
|
9
|
+
import { ChartLegendContainer, StyledMenu, LegendWrapper } from './style';
|
|
10
|
+
export const ChartLegend = ({ activeLegend, onSelectLegend }) => {
|
|
11
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
12
|
+
const open = Boolean(anchorEl);
|
|
13
|
+
const active = LEGENDS[activeLegend];
|
|
14
|
+
const onOpen = (e) => {
|
|
15
|
+
setAnchorEl(e.currentTarget);
|
|
16
|
+
};
|
|
17
|
+
const onClose = () => {
|
|
18
|
+
setAnchorEl(null);
|
|
19
|
+
};
|
|
20
|
+
const onSelect = (key) => {
|
|
21
|
+
onSelectLegend(key);
|
|
22
|
+
onClose();
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs(ChartLegendContainer, Object.assign({ sx: {
|
|
25
|
+
backgroundImage: activeLegend === LEGENDS.REFUNDS.key
|
|
26
|
+
? 'linear-gradient(180deg, rgba(94, 48, 235, 0.025) 38.02%, rgba(255, 255, 255, 0) 99.99%)'
|
|
27
|
+
: 'linear-gradient(180deg, rgba(118, 187, 64, 0.025) 49.57%, rgba(255, 255, 255, 0) 100%)',
|
|
28
|
+
} }, { children: [_jsx(LegendLabel, Object.assign({}, LEGENDS.TRANSACTIONS)), _jsxs(LegendWrapper, Object.assign({ onMouseEnter: onOpen, onMouseLeave: onClose }, { children: [_jsx(LegendLabel, Object.assign({}, active)), _jsx(Box, { component: "img", src: downArrowIcon, alt: "down arrow", sx: { width: 15, marginTop: '2px' } }), _jsx(StyledMenu, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: Object.values(LEGENDS)
|
|
29
|
+
.filter((l) => l.key !== activeLegend && l.key !== LEGENDS.TRANSACTIONS.key)
|
|
30
|
+
.map((legend) => (_jsx(MenuItem, Object.assign({ hideCheckbox: true, onClick: () => onSelect(legend.key) }, { children: _createElement(LegendLabel, Object.assign({}, legend, { key: legend.key })) }), legend.key))) }))] }))] })));
|
|
31
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import { Text } from '../../../index.js';
|
|
4
|
+
export const LegendLabel = ({ label, color }) => (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: [_jsx(Box, { sx: { background: color, width: 8, height: 8, borderRadius: '50%' } }), _jsx(Text, Object.assign({ sx: { fontWeight: 500, fontSize: '11px' } }, { children: label }))] })));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const LEGENDS: {
|
|
2
|
+
readonly TRANSACTIONS: {
|
|
3
|
+
readonly key: "TRANSACTIONS";
|
|
4
|
+
readonly label: "Transactions";
|
|
5
|
+
readonly color: "rgb(118, 187, 64)";
|
|
6
|
+
};
|
|
7
|
+
readonly REFUNDS: {
|
|
8
|
+
readonly key: "REFUNDS";
|
|
9
|
+
readonly label: "Refunds";
|
|
10
|
+
readonly color: "rgb(94, 48, 235)";
|
|
11
|
+
};
|
|
12
|
+
readonly CHARGE: {
|
|
13
|
+
readonly key: "CHARGE";
|
|
14
|
+
readonly label: "Charge rate";
|
|
15
|
+
readonly color: "rgb(31, 136, 208)";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const LEGENDS = {
|
|
2
|
+
TRANSACTIONS: {
|
|
3
|
+
key: 'TRANSACTIONS',
|
|
4
|
+
label: 'Transactions',
|
|
5
|
+
color: 'rgb(118, 187, 64)',
|
|
6
|
+
},
|
|
7
|
+
REFUNDS: {
|
|
8
|
+
key: 'REFUNDS',
|
|
9
|
+
label: 'Refunds',
|
|
10
|
+
color: 'rgb(94, 48, 235)',
|
|
11
|
+
},
|
|
12
|
+
CHARGE: {
|
|
13
|
+
key: 'CHARGE',
|
|
14
|
+
label: 'Charge rate',
|
|
15
|
+
color: 'rgb(31, 136, 208)',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ChartLegendContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
5
|
+
export declare const StyledMenu: import("@emotion/styled").StyledComponent<Omit<import("../../../Menu/Menu").MenuProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
6
|
+
export declare const LegendWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
8
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Menu from '../../../Menu';
|
|
4
|
+
export const ChartLegendContainer = styled(Box)(() => ({
|
|
5
|
+
padding: '8px 16px',
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
gap: '12px',
|
|
9
|
+
position: 'relative',
|
|
10
|
+
}));
|
|
11
|
+
export const StyledMenu = styled(Menu)(() => ({
|
|
12
|
+
marginTop: '8px',
|
|
13
|
+
marginBottom: '8px',
|
|
14
|
+
maxHeight: '190px',
|
|
15
|
+
overflow: 'auto',
|
|
16
|
+
minWidth: '100px',
|
|
17
|
+
}));
|
|
18
|
+
export const LegendWrapper = styled(Box)(() => ({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
gap: '2px',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { TooltipContainer, TimeTypography, ValueTypography } from '../../styles';
|
|
5
|
+
import {
|
|
6
|
+
// getTooltipFormattedValue,
|
|
7
|
+
getFormattedDateWithTimezone, } from '../../utils';
|
|
8
|
+
import Text from '../../../Text';
|
|
9
|
+
import { LEGENDS } from '../ChartLegend';
|
|
10
|
+
export const ChartTooltip = ({ active, payload, dateRange,
|
|
11
|
+
// selectedCurrency,
|
|
12
|
+
activeLegend, }) => {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
14
|
+
const dateRangeFrom = dayjs(dateRange === null || dateRange === void 0 ? void 0 : dateRange[0]);
|
|
15
|
+
const dateRangeTo = dayjs(dateRange === null || dateRange === void 0 ? void 0 : dateRange[1]);
|
|
16
|
+
const isSingleDay = dateRangeFrom === null || dateRangeFrom === void 0 ? void 0 : dateRangeFrom.isSame(dateRangeTo, 'day');
|
|
17
|
+
if (active && (payload === null || payload === void 0 ? void 0 : payload.length)) {
|
|
18
|
+
const point = payload[0];
|
|
19
|
+
// const localizedUnitLabel = getLocalizedUnitLabel(activeDataKey, point?.value)
|
|
20
|
+
const formattedDate = ((_a = point === null || point === void 0 ? void 0 : point.payload) === null || _a === void 0 ? void 0 : _a.date) && getFormattedDateWithTimezone((_b = point === null || point === void 0 ? void 0 : point.payload) === null || _b === void 0 ? void 0 : _b.date, isSingleDay, (_c = point === null || point === void 0 ? void 0 : point.payload) === null || _c === void 0 ? void 0 : _c.hour);
|
|
21
|
+
return (_jsxs(TooltipContainer, Object.assign({ className: "chart-tooltip" }, { children: [_jsx(TimeTypography, { children: formattedDate !== null && formattedDate !== void 0 ? formattedDate : (_d = point === null || point === void 0 ? void 0 : point.payload) === null || _d === void 0 ? void 0 : _d.date }), _jsx(ValueTypography, { children: _jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '4px' } }, { children: [activeLegend === LEGENDS.CHARGE.key && (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: [_jsx(Box, { sx: { width: 12, height: 12, background: LEGENDS.CHARGE.color, borderRadius: '50%', border: `2px solid #fff`, flexShrink: 0 } }), _jsx(Text, Object.assign({ sx: { fontSize: '11px', fontWeight: 600 } }, { children: `${(_e = point.payload) === null || _e === void 0 ? void 0 : _e.chargeRate} Charge Rate` }))] }))), _jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: [_jsx(Box, { sx: { width: 12, height: 12, background: LEGENDS.TRANSACTIONS.color, borderRadius: '50%', border: `2px solid #fff`, flexShrink: 0 } }), _jsx(Text, Object.assign({ sx: { fontSize: '11px', fontWeight: 600 } }, { children: `${(_f = point.payload) === null || _f === void 0 ? void 0 : _f.chargeCount} Transactions` }))] })), activeLegend === LEGENDS.REFUNDS.key && (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: [_jsx(Box, { sx: { width: 12, height: 12, background: LEGENDS.REFUNDS.color, borderRadius: '50%', border: `2px solid #fff`, flexShrink: 0 } }), _jsx(Text, Object.assign({ sx: { fontSize: '11px', fontWeight: 600 } }, { children: `${(_g = point.payload) === null || _g === void 0 ? void 0 : _g.chargeCount} Refunds` }))] })))] })) })] })));
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartTooltip';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartTooltip';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LoadingChart: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,9 +10,8 @@ const loadingData = [
|
|
|
10
10
|
{ dataKey: 94.3882 },
|
|
11
11
|
{ dataKey: 110.406 },
|
|
12
12
|
];
|
|
13
|
-
const LoadingChart = () => {
|
|
13
|
+
export const LoadingChart = () => {
|
|
14
14
|
return (_jsx(ResponsiveContainer, { children: _jsxs(AreaChart, Object.assign({ margin: {
|
|
15
15
|
top: 40,
|
|
16
16
|
}, data: loadingData }, { children: [_jsx("defs", { children: _jsxs("linearGradient", Object.assign({ id: "loadingGradient", x1: "0", y1: "0", x2: "0", y2: "1", gradientUnits: "objectBoundingBox" }, { children: [_jsx("stop", { offset: "0.54", stopColor: "rgba(67, 67, 67, 0.035)" }), _jsx("stop", { offset: "1", stopColor: "rgba(255, 255, 255, 0)" })] })) }), _jsx(Area, { dataKey: "dataKey", type: "linear", fill: "url(#loadingGradient)", fillOpacity: 1, stroke: "#C2C2C2", strokeWidth: 1, strokeLinecap: "round", strokeDasharray: "4 4", activeDot: false })] })) }));
|
|
17
17
|
};
|
|
18
|
-
export default LoadingChart;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoadingChart';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoadingChart';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './ChartTooltip';
|
|
2
|
+
export * from './LoadingChart';
|
|
3
|
+
export * from './ChartLegend';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './ChartTooltip';
|
|
2
|
+
export * from './LoadingChart';
|
|
3
|
+
export * from './ChartLegend';
|
|
@@ -13,4 +13,6 @@ export declare const CurrencyBox: import("@emotion/styled").StyledComponent<impo
|
|
|
13
13
|
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
14
14
|
export declare const CurrencyText: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
15
15
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
16
|
-
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "classes" | "align" | "className" | "style" | "children" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> &
|
|
16
|
+
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "classes" | "align" | "className" | "style" | "children" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & {
|
|
17
|
+
component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
18
|
+
} & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Text from '../Text';
|
|
1
2
|
import { Box, Typography, styled } from '@mui/material';
|
|
2
3
|
export const TooltipContainer = styled(Box)(() => ({
|
|
3
4
|
width: 'auto',
|
|
@@ -33,14 +34,13 @@ export const ValueTypography = styled(Typography)({
|
|
|
33
34
|
export const CurrencyBox = styled(Box)({
|
|
34
35
|
display: 'flex',
|
|
35
36
|
alignItems: 'center',
|
|
36
|
-
height: '100%',
|
|
37
|
+
// height: '100%',
|
|
37
38
|
gap: '2.6px',
|
|
38
39
|
maxHeight: '19px',
|
|
39
40
|
});
|
|
40
|
-
export const CurrencyText = styled(
|
|
41
|
-
fontWeight:
|
|
41
|
+
export const CurrencyText = styled(Text)({
|
|
42
|
+
fontWeight: 600,
|
|
42
43
|
fontSize: 11,
|
|
43
44
|
lineHeight: '130%',
|
|
44
|
-
color: '#4B4847',
|
|
45
45
|
letterSpacing: '-0.14px',
|
|
46
46
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LegendKey } from './components';
|
|
1
2
|
export interface ActivityAreaChartProps {
|
|
2
3
|
data: ChartDataPoint[];
|
|
3
4
|
dataKey: string;
|
|
@@ -5,17 +6,23 @@ export interface ActivityAreaChartProps {
|
|
|
5
6
|
dateRange: [Date, Date];
|
|
6
7
|
selectedCurrency: string;
|
|
7
8
|
}
|
|
9
|
+
export interface ChartDataPoint {
|
|
10
|
+
date: string;
|
|
11
|
+
chargeCount: number;
|
|
12
|
+
chargeAmount: number;
|
|
13
|
+
chargeRate: number;
|
|
14
|
+
refundCount: number;
|
|
15
|
+
refundAmount: number;
|
|
16
|
+
hour?: number;
|
|
17
|
+
}
|
|
8
18
|
export interface ChartTooltipProps {
|
|
9
19
|
active?: boolean;
|
|
20
|
+
activeLegend: LegendKey;
|
|
21
|
+
activeDataKey: string;
|
|
10
22
|
payload?: Array<{
|
|
11
23
|
value?: number;
|
|
12
24
|
dataKey?: string;
|
|
13
|
-
payload?:
|
|
14
|
-
date?: string;
|
|
15
|
-
count?: number;
|
|
16
|
-
amount?: number;
|
|
17
|
-
hour?: number;
|
|
18
|
-
};
|
|
25
|
+
payload?: ChartDataPoint;
|
|
19
26
|
}>;
|
|
20
27
|
position?: {
|
|
21
28
|
x: number;
|
|
@@ -24,9 +31,4 @@ export interface ChartTooltipProps {
|
|
|
24
31
|
dateRange: [Date, Date];
|
|
25
32
|
selectedCurrency: string;
|
|
26
33
|
}
|
|
27
|
-
export interface ChartDataPoint {
|
|
28
|
-
date: string;
|
|
29
|
-
count: number;
|
|
30
|
-
amount: number;
|
|
31
|
-
}
|
|
32
34
|
export type PayloadItem = NonNullable<ChartTooltipProps['payload']>[number];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface DonutProps {
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
size?: number;
|
|
5
|
+
chartData: Array<{
|
|
6
|
+
name: string;
|
|
7
|
+
value: number;
|
|
8
|
+
color: string;
|
|
9
|
+
}>;
|
|
10
|
+
chartInfo?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export default function MultiDatakeyDonut({ isLoading, chartData, size, }: DonutProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ResponsiveContainer, PieChart, Pie, Cell } from 'recharts';
|
|
3
|
+
import { DonutWrapper, CenterOverlay, CenterItem, ValueText, LegendWrapper, LegendDot, LegendText } from './style';
|
|
4
|
+
import Skeleton from '../Skeleton';
|
|
5
|
+
export default function MultiDatakeyDonut({ isLoading = true, chartData,
|
|
6
|
+
// activeDataKey = 'count',
|
|
7
|
+
size = 170, }) {
|
|
8
|
+
// const chartData = [
|
|
9
|
+
// {
|
|
10
|
+
// name: 'Customer',
|
|
11
|
+
// value: activeDataKey === 'amount' ? data.customerAmount : data.customerCount,
|
|
12
|
+
// color: '#76BB40',
|
|
13
|
+
// },
|
|
14
|
+
// {
|
|
15
|
+
// name: 'Merchant',
|
|
16
|
+
// value: activeDataKey === 'amount' ? data.merchantAmount : data.merchantCount,
|
|
17
|
+
// color: '#1F88D0',
|
|
18
|
+
// },
|
|
19
|
+
// ]
|
|
20
|
+
return (_jsxs(DonutWrapper, Object.assign({ sx: { width: size, height: size } }, { children: [_jsx(ResponsiveContainer, { children: _jsxs(PieChart, { children: [_jsx(Pie, { data: [{ value: 100 }], dataKey: "value", cx: "50%", cy: "50%", innerRadius: "70%", outerRadius: "100%", fill: "#E5E7EB", stroke: "none", isAnimationActive: false }), _jsx(Pie, Object.assign({ data: chartData, dataKey: "value", cx: "50%", cy: "50%", innerRadius: "70%", outerRadius: "100%", cornerRadius: 0, stroke: "none", startAngle: 90, endAngle: -270 }, { children: chartData.map((entry) => (_jsx(Cell, { fill: entry.color }, entry.name))) }))] }) }), _jsx(CenterOverlay, { children: chartData.map((entry) => (_jsxs(CenterItem, { children: [isLoading ? _jsx(Skeleton, { width: 49, height: 7, sx: { margin: '2px' } }) : _jsx(ValueText, { children: entry.value.toLocaleString() }), isLoading ? (_jsx(Skeleton, { width: 80, height: 7 })) : (_jsxs(LegendWrapper, { children: [_jsx(LegendDot, { color: entry.color }), _jsx(LegendText, { children: entry.name })] }))] }, entry.name))) })] })));
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DonutWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
5
|
+
export declare const CenterOverlay: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
8
|
+
export declare const CenterItem: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
11
|
+
export declare const ValueText: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
12
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
13
|
+
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "classes" | "align" | "className" | "style" | "children" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & {
|
|
14
|
+
component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
15
|
+
} & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
16
|
+
export declare const LegendWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
17
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
18
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
19
|
+
export declare const LegendDot: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
20
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
21
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
22
|
+
color: string;
|
|
23
|
+
}, {}, {}>;
|
|
24
|
+
export declare const LegendText: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
25
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
26
|
+
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "classes" | "align" | "className" | "style" | "children" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & {
|
|
27
|
+
component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
28
|
+
} & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import Text from '../Text';
|
|
4
|
+
export const DonutWrapper = styled(Box)(() => ({
|
|
5
|
+
width: '100%',
|
|
6
|
+
maxWidth: 500,
|
|
7
|
+
aspectRatio: '1',
|
|
8
|
+
position: 'relative',
|
|
9
|
+
}));
|
|
10
|
+
export const CenterOverlay = styled(Box)(({ theme }) => ({
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
inset: 0,
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'column',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
pointerEvents: 'none',
|
|
18
|
+
gap: theme.spacing(1),
|
|
19
|
+
}));
|
|
20
|
+
export const CenterItem = styled(Box)(({ theme }) => ({
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: 'column',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
}));
|
|
26
|
+
export const ValueText = styled(Text)(({ theme }) => ({
|
|
27
|
+
fontSize: 12,
|
|
28
|
+
fontWeight: 700,
|
|
29
|
+
lineHeight: 1.2,
|
|
30
|
+
wordWrap: 'break-word',
|
|
31
|
+
}));
|
|
32
|
+
export const LegendWrapper = styled(Box)(({ theme }) => ({
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
gap: 4,
|
|
36
|
+
}));
|
|
37
|
+
export const LegendDot = styled(Box)(({ color }) => ({
|
|
38
|
+
width: 8,
|
|
39
|
+
height: 8,
|
|
40
|
+
borderRadius: '50%',
|
|
41
|
+
background: color,
|
|
42
|
+
}));
|
|
43
|
+
export const LegendText = styled(Text)(({ theme }) => ({
|
|
44
|
+
fontSize: 11,
|
|
45
|
+
fontWeight: 500,
|
|
46
|
+
}));
|
|
@@ -76,6 +76,7 @@ export declare const closeIcon: string;
|
|
|
76
76
|
export declare const dashedCheckIcon: string;
|
|
77
77
|
export declare const deactivatedIcon: string;
|
|
78
78
|
export declare const topUpIcon: string;
|
|
79
|
+
export declare const AIOverviewIcon: string;
|
|
79
80
|
export declare const deMaximizeIcon: string;
|
|
80
81
|
export declare const pendingFlag: string;
|
|
81
82
|
export declare const ibanIcon: string;
|
|
@@ -81,6 +81,7 @@ export const closeIcon = `${lightUrl}/close.svg`;
|
|
|
81
81
|
export const dashedCheckIcon = `${lightUrl}/dashedCheckIcon.svg`;
|
|
82
82
|
export const deactivatedIcon = `${lightUrl}/deactivatedIcon.svg`;
|
|
83
83
|
export const topUpIcon = `${lightUrl}/topup.svg`;
|
|
84
|
+
export const AIOverviewIcon = `${lightUrl}/AIOverviewIcon.svg`;
|
|
84
85
|
export const deMaximizeIcon = `${appBaseUrl}/demaximize.svg`;
|
|
85
86
|
export const pendingFlag = `${lightUrl}/pendingFlag.svg`;
|
|
86
87
|
export const ibanIcon = `${lightUrl}/ibanIcon.svg`;
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* Maps report **source codes** (app or service)
|
|
3
|
-
* to the corresponding **backend report filter types**.
|
|
4
|
-
*
|
|
5
|
-
* Used as a translation layer between UI report grouping
|
|
6
|
-
* and backend report filtering.
|
|
7
|
-
*
|
|
8
|
-
* - Key: App code or service code
|
|
9
|
-
* - Value: One or more backend filter types
|
|
10
|
-
*/
|
|
11
|
-
export declare const reportFilterTypesMap: {
|
|
1
|
+
export declare const filtersTypeMap: {
|
|
12
2
|
[x: string]: string[];
|
|
13
3
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Reports apps
|
|
16
|
-
*
|
|
17
|
-
* Defines apps shown in the reports app, with each service linked
|
|
18
|
-
* to its backend filter type (REPORT_FILTER_TYPES).
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
4
|
export declare const REPORTS_APPS: {
|
|
22
5
|
code: string;
|
|
23
6
|
name: string;
|
|
@@ -1,89 +1,39 @@
|
|
|
1
1
|
import { APP_CODES } from './apps';
|
|
2
2
|
import { acceptanceAppIcon, billingAppIcon, payoutsAppIcon, walletAppIcon } from './assets';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// Billing
|
|
20
|
-
INVOICE: 'INVOICE',
|
|
21
|
-
// Payouts
|
|
22
|
-
PAYOUT: 'PAYOUT',
|
|
23
|
-
MERCHANT_PAYOUT: 'MERCHANT_PAYOUT',
|
|
24
|
-
RETAILER_PAYOUT: 'RETAILER_PAYOUT',
|
|
3
|
+
export const filtersTypeMap = {
|
|
4
|
+
[APP_CODES.acceptance.services.charges.code]: ['CHARGE'],
|
|
5
|
+
[APP_CODES.acceptance.services.authorization.code]: ['AUTHORIZE'],
|
|
6
|
+
[APP_CODES.acceptance.services.refunds.code]: ['REFUND'],
|
|
7
|
+
[APP_CODES.acceptance.services.chargeback.code]: ['CHARGEBACKS'],
|
|
8
|
+
[APP_CODES.acceptance.services.destinations.code]: ['DESTINATIONS'],
|
|
9
|
+
[APP_CODES.acceptance.code]: ['CHARGE', 'AUTHORIZE', 'REFUND', 'CHARGEBACKS', 'DESTINATIONS'],
|
|
10
|
+
[APP_CODES.payouts.code]: ['PAYOUT', 'RETAILER_PAYOUT', 'MERCHANT_PAYOUT'],
|
|
11
|
+
[APP_CODES.wallet.code]: ['STATEMENT', 'STATEMENT_SUMMARY'],
|
|
12
|
+
[APP_CODES.billing.code]: ['INVOICE'],
|
|
13
|
+
[APP_CODES.payouts.services.payouts.code]: ['PAYOUT'],
|
|
14
|
+
[APP_CODES.wallet.services.merchants.functions.statement.code]: ['STATEMENT'],
|
|
15
|
+
[APP_CODES.wallet.services.merchants.functions.summary.code]: ['STATEMENT_SUMMARY'],
|
|
16
|
+
[APP_CODES.billing.services.invoices.code]: ['INVOICE'],
|
|
17
|
+
[APP_CODES.payouts.services.merchantPayout.code]: ['MERCHANT_PAYOUT'],
|
|
18
|
+
[APP_CODES.payouts.services.retailerPayout.code]: ['RETAILER_PAYOUT'],
|
|
25
19
|
};
|
|
26
|
-
/**
|
|
27
|
-
* Maps report **source codes** (app or service)
|
|
28
|
-
* to the corresponding **backend report filter types**.
|
|
29
|
-
*
|
|
30
|
-
* Used as a translation layer between UI report grouping
|
|
31
|
-
* and backend report filtering.
|
|
32
|
-
*
|
|
33
|
-
* - Key: App code or service code
|
|
34
|
-
* - Value: One or more backend filter types
|
|
35
|
-
*/
|
|
36
|
-
export const reportFilterTypesMap = {
|
|
37
|
-
// Acceptance
|
|
38
|
-
[APP_CODES.acceptance.services.charges.code]: [REPORT_FILTER_TYPES.CHARGE],
|
|
39
|
-
[APP_CODES.acceptance.services.authorization.code]: [REPORT_FILTER_TYPES.AUTHORIZE],
|
|
40
|
-
[APP_CODES.acceptance.services.refunds.code]: [REPORT_FILTER_TYPES.REFUND],
|
|
41
|
-
[APP_CODES.acceptance.services.chargeback.code]: [REPORT_FILTER_TYPES.CHARGEBACKS],
|
|
42
|
-
[APP_CODES.acceptance.services.destinations.code]: [REPORT_FILTER_TYPES.DESTINATIONS],
|
|
43
|
-
[APP_CODES.acceptance.code]: [
|
|
44
|
-
REPORT_FILTER_TYPES.CHARGE,
|
|
45
|
-
REPORT_FILTER_TYPES.AUTHORIZE,
|
|
46
|
-
REPORT_FILTER_TYPES.REFUND,
|
|
47
|
-
REPORT_FILTER_TYPES.CHARGEBACKS,
|
|
48
|
-
REPORT_FILTER_TYPES.DESTINATIONS,
|
|
49
|
-
],
|
|
50
|
-
// Wallet
|
|
51
|
-
[APP_CODES.wallet.services.merchants.functions.statement.code]: [REPORT_FILTER_TYPES.STATEMENT],
|
|
52
|
-
[APP_CODES.wallet.services.merchants.functions.summary.code]: [REPORT_FILTER_TYPES.STATEMENT_SUMMARY],
|
|
53
|
-
[APP_CODES.wallet.code]: [REPORT_FILTER_TYPES.STATEMENT, REPORT_FILTER_TYPES.STATEMENT_SUMMARY],
|
|
54
|
-
// Billing
|
|
55
|
-
[APP_CODES.billing.services.invoices.code]: [REPORT_FILTER_TYPES.INVOICE],
|
|
56
|
-
[APP_CODES.billing.code]: [REPORT_FILTER_TYPES.INVOICE],
|
|
57
|
-
// Payouts
|
|
58
|
-
[APP_CODES.payouts.services.payouts.code]: [REPORT_FILTER_TYPES.PAYOUT],
|
|
59
|
-
[APP_CODES.payouts.services.merchantPayout.code]: [REPORT_FILTER_TYPES.MERCHANT_PAYOUT],
|
|
60
|
-
[APP_CODES.payouts.services.retailerPayout.code]: [REPORT_FILTER_TYPES.RETAILER_PAYOUT],
|
|
61
|
-
[APP_CODES.payouts.code]: [REPORT_FILTER_TYPES.PAYOUT, REPORT_FILTER_TYPES.MERCHANT_PAYOUT, REPORT_FILTER_TYPES.RETAILER_PAYOUT],
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Reports apps
|
|
65
|
-
*
|
|
66
|
-
* Defines apps shown in the reports app, with each service linked
|
|
67
|
-
* to its backend filter type (REPORT_FILTER_TYPES).
|
|
68
|
-
*
|
|
69
|
-
*/
|
|
70
20
|
export const REPORTS_APPS = [
|
|
71
21
|
{
|
|
72
22
|
code: APP_CODES.billing.code,
|
|
73
23
|
name: 'Billing',
|
|
74
24
|
icon: billingAppIcon,
|
|
75
|
-
services: [{ name: 'Invoices', code:
|
|
25
|
+
services: [{ name: 'Invoices', code: 'INVOICE' }],
|
|
76
26
|
},
|
|
77
27
|
{
|
|
78
28
|
code: APP_CODES.acceptance.code,
|
|
79
29
|
name: 'Acceptance',
|
|
80
30
|
icon: acceptanceAppIcon,
|
|
81
31
|
services: [
|
|
82
|
-
{ name: 'Authorisations', code:
|
|
83
|
-
{ name: 'Charges', code:
|
|
84
|
-
{ name: 'Refunds', code:
|
|
85
|
-
{ name: 'Chargebacks', code:
|
|
86
|
-
{ name: 'Destinations', code:
|
|
32
|
+
{ name: 'Authorisations', code: 'AUTHORIZE' },
|
|
33
|
+
{ name: 'Charges', code: 'CHARGE' },
|
|
34
|
+
{ name: 'Refunds', code: 'REFUND' },
|
|
35
|
+
{ name: 'Chargebacks', code: 'CHARGEBACKS' },
|
|
36
|
+
{ name: 'Destinations', code: 'DESTINATIONS' },
|
|
87
37
|
],
|
|
88
38
|
},
|
|
89
39
|
{
|
|
@@ -91,8 +41,8 @@ export const REPORTS_APPS = [
|
|
|
91
41
|
name: 'Wallet',
|
|
92
42
|
icon: walletAppIcon,
|
|
93
43
|
services: [
|
|
94
|
-
{ name: 'Aggregated Statement', code:
|
|
95
|
-
{ name: 'Detailed Statement', code:
|
|
44
|
+
{ name: 'Aggregated Statement', code: 'STATEMENT_SUMMARY' },
|
|
45
|
+
{ name: 'Detailed Statement', code: 'STATEMENT' },
|
|
96
46
|
],
|
|
97
47
|
},
|
|
98
48
|
{
|
|
@@ -100,9 +50,9 @@ export const REPORTS_APPS = [
|
|
|
100
50
|
name: 'Payouts',
|
|
101
51
|
icon: payoutsAppIcon,
|
|
102
52
|
services: [
|
|
103
|
-
{ name: 'Payouts', code:
|
|
104
|
-
{ name: 'Merchant Payouts', code:
|
|
105
|
-
{ name: 'Retailer Payouts', code:
|
|
53
|
+
{ name: 'Payouts', code: 'PAYOUT' },
|
|
54
|
+
{ name: 'Merchant Payouts', code: 'MERCHANT_PAYOUT' },
|
|
55
|
+
{ name: 'Retailer Payouts', code: 'RETAILER_PAYOUT' },
|
|
106
56
|
],
|
|
107
57
|
},
|
|
108
58
|
];
|
package/build/types/apps.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ColumnsView } from './column';
|
|
2
2
|
import { Segment, SegmentCountry, SegmentUser, SelectedBrand, SelectedCountry, User } from './user';
|
|
3
|
+
import { BusinessMerchant } from './merchant';
|
|
3
4
|
import type { i18n } from 'i18next';
|
|
4
5
|
import { Theme } from '@mui/material';
|
|
5
6
|
import { CalenderMode } from './theme';
|
|
6
7
|
import { Timezone } from './appConfig';
|
|
7
8
|
import { Brand, Entity, TableMode } from './index.js';
|
|
8
9
|
import { TextAndLang } from './common';
|
|
9
|
-
export interface
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export interface AccountAppPayload {
|
|
11
|
+
disabledAccountDataFetching?: boolean;
|
|
12
|
+
isAccountDetailsOpen: boolean;
|
|
13
|
+
selectedMerchant?: BusinessMerchant;
|
|
12
14
|
}
|
|
13
|
-
export interface
|
|
15
|
+
export interface AppPayload extends Partial<AccountAppPayload> {
|
|
14
16
|
columnFilters?: Record<string, any>;
|
|
15
17
|
filteredIds?: string[];
|
|
16
18
|
dateRange?: [Date, Date];
|
|
@@ -19,7 +21,6 @@ export interface ServicePayload {
|
|
|
19
21
|
isTextShown?: boolean;
|
|
20
22
|
tableViews?: ColumnsView[];
|
|
21
23
|
calendarTimezone?: number;
|
|
22
|
-
reportTypes?: string[];
|
|
23
24
|
}
|
|
24
25
|
export interface AppDetails {
|
|
25
26
|
id: string;
|
|
@@ -42,7 +43,7 @@ export interface AppDetails {
|
|
|
42
43
|
minWidth: number | string;
|
|
43
44
|
minHeight: number | string;
|
|
44
45
|
};
|
|
45
|
-
payload?: Record<string, any> &
|
|
46
|
+
payload?: Record<string, any> & AppPayload;
|
|
46
47
|
toolbarIconUrl?: string;
|
|
47
48
|
hideMaximizedApp?: boolean;
|
|
48
49
|
hideMinimizeApp?: boolean;
|
|
@@ -98,7 +99,7 @@ export type MFWidgetBaseProps = {
|
|
|
98
99
|
hasHeader: boolean;
|
|
99
100
|
sandboxMode: boolean;
|
|
100
101
|
initialServiceCode?: string;
|
|
101
|
-
initialPayload?: Record<string, any> &
|
|
102
|
+
initialPayload?: Record<string, any> & AppPayload;
|
|
102
103
|
};
|
|
103
104
|
user: User;
|
|
104
105
|
segment: {
|
|
@@ -6,7 +6,7 @@ export declare const openNewAppAttrs: ({ appCode, serviceCode, sandboxMode, payl
|
|
|
6
6
|
numberOfOpenedApps: number;
|
|
7
7
|
segmentId: string;
|
|
8
8
|
}) => {
|
|
9
|
-
payload?: (Record<string, any> & import("../types/index.js").
|
|
9
|
+
payload?: (Record<string, any> & import("../types/index.js").AppPayload) | undefined;
|
|
10
10
|
segmentId: string;
|
|
11
11
|
appCode: string;
|
|
12
12
|
serviceCode: string;
|
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.365-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.365-test.11",
|
|
5
|
+
"testVersion": 11,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
|
|
64
64
|
"push:local": "yarn ts:build && yalc publish --push",
|
|
65
65
|
"push": "npm run ts:build && npm publish --access public",
|
|
66
|
-
"push:test": " npm publish --access public --tag test && node scripts/restore-version.cjs",
|
|
66
|
+
"push:test": "node scripts/increment-test-version.cjs && npm run ts:build && npm publish --access public --tag test && node scripts/restore-version.cjs",
|
|
67
67
|
"dev": "vite",
|
|
68
68
|
"build": "tsc -b && vite build ",
|
|
69
69
|
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
|
|
@@ -164,4 +164,4 @@
|
|
|
164
164
|
"publishConfig": {
|
|
165
165
|
"registry": "https://registry.npmjs.org/"
|
|
166
166
|
}
|
|
167
|
-
}
|
|
167
|
+
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import dayjs from 'dayjs';
|
|
4
|
-
import Box from '@mui/material/Box';
|
|
5
|
-
import { getLocalizedUnitLabel } from '../../../utils/index.js';
|
|
6
|
-
import { DATA_KEY } from '../../../constants/index.js';
|
|
7
|
-
import CountryFlag from '../../CountryFlag';
|
|
8
|
-
import { TooltipContainer, TimeTypography, ValueTypography, CurrencyBox, CurrencyText } from '../styles';
|
|
9
|
-
import { getTooltipFormattedValue, getFormattedDateWithTimezone } from '../utils';
|
|
10
|
-
const ChartTooltip = ({ active, payload, dateRange, selectedCurrency }) => {
|
|
11
|
-
var _a, _b, _c, _d;
|
|
12
|
-
const { t } = useTranslation();
|
|
13
|
-
const dateRangeFrom = dayjs(dateRange === null || dateRange === void 0 ? void 0 : dateRange[0]);
|
|
14
|
-
const dateRangeTo = dayjs(dateRange === null || dateRange === void 0 ? void 0 : dateRange[1]);
|
|
15
|
-
const isSingleDay = dateRangeFrom === null || dateRangeFrom === void 0 ? void 0 : dateRangeFrom.isSame(dateRangeTo, 'day');
|
|
16
|
-
if (active && (payload === null || payload === void 0 ? void 0 : payload.length)) {
|
|
17
|
-
const point = payload[0];
|
|
18
|
-
const localizedUnitLabel = getLocalizedUnitLabel(point === null || point === void 0 ? void 0 : point.dataKey, point === null || point === void 0 ? void 0 : point.value);
|
|
19
|
-
const formattedDate = ((_a = point === null || point === void 0 ? void 0 : point.payload) === null || _a === void 0 ? void 0 : _a.date) && getFormattedDateWithTimezone((_b = point === null || point === void 0 ? void 0 : point.payload) === null || _b === void 0 ? void 0 : _b.date, isSingleDay, (_c = point === null || point === void 0 ? void 0 : point.payload) === null || _c === void 0 ? void 0 : _c.hour);
|
|
20
|
-
return (_jsxs(TooltipContainer, Object.assign({ className: "chart-tooltip" }, { children: [_jsx(TimeTypography, { children: formattedDate !== null && formattedDate !== void 0 ? formattedDate : (_d = point === null || point === void 0 ? void 0 : point.payload) === null || _d === void 0 ? void 0 : _d.date }), _jsxs(ValueTypography, { children: [(point === null || point === void 0 ? void 0 : point.dataKey) === DATA_KEY.AMOUNT && (_jsxs(CurrencyBox, { children: [_jsx(CountryFlag, { currencyCode: selectedCurrency, width: 12 }), _jsx(CurrencyText, { children: selectedCurrency })] })), _jsx(Box, { children: `${getTooltipFormattedValue(point, t(localizedUnitLabel), selectedCurrency)}` })] })] })));
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
};
|
|
24
|
-
export default ChartTooltip;
|