@tap-payments/os-micro-frontend-shared 0.1.365-test.2 → 0.1.365-test.20

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.
Files changed (47) hide show
  1. package/build/components/ActivityAreaChart/ActivityAreaChart.js +39 -25
  2. package/build/components/ActivityAreaChart/components/ChartLegend/ChartLegend.d.ts +8 -0
  3. package/build/components/ActivityAreaChart/components/ChartLegend/ChartLegend.js +31 -0
  4. package/build/components/ActivityAreaChart/components/ChartLegend/LegendLabel.d.ts +6 -0
  5. package/build/components/ActivityAreaChart/components/ChartLegend/LegendLabel.js +4 -0
  6. package/build/components/ActivityAreaChart/components/ChartLegend/constant.d.ts +17 -0
  7. package/build/components/ActivityAreaChart/components/ChartLegend/constant.js +17 -0
  8. package/build/components/ActivityAreaChart/components/ChartLegend/index.d.ts +3 -0
  9. package/build/components/ActivityAreaChart/components/ChartLegend/index.js +3 -0
  10. package/build/components/ActivityAreaChart/components/ChartLegend/style.d.ts +8 -0
  11. package/build/components/ActivityAreaChart/components/ChartLegend/style.js +23 -0
  12. package/build/components/ActivityAreaChart/components/ChartLegend/type.d.ts +2 -0
  13. package/build/components/ActivityAreaChart/components/ChartLegend/type.js +1 -0
  14. package/build/components/ActivityAreaChart/components/ChartTooltip/ChartTooltip.d.ts +2 -0
  15. package/build/components/ActivityAreaChart/components/ChartTooltip/ChartTooltip.js +24 -0
  16. package/build/components/ActivityAreaChart/components/ChartTooltip/index.d.ts +1 -0
  17. package/build/components/ActivityAreaChart/components/ChartTooltip/index.js +1 -0
  18. package/build/components/ActivityAreaChart/components/LoadingChart/LoadingChart.d.ts +1 -0
  19. package/build/components/ActivityAreaChart/components/{LoadingChart.js → LoadingChart/LoadingChart.js} +1 -2
  20. package/build/components/ActivityAreaChart/components/LoadingChart/index.d.ts +1 -0
  21. package/build/components/ActivityAreaChart/components/LoadingChart/index.js +1 -0
  22. package/build/components/ActivityAreaChart/components/index.d.ts +3 -2
  23. package/build/components/ActivityAreaChart/components/index.js +3 -2
  24. package/build/components/ActivityAreaChart/styles.d.ts +3 -1
  25. package/build/components/ActivityAreaChart/styles.js +4 -4
  26. package/build/components/ActivityAreaChart/types.d.ts +13 -11
  27. package/build/components/FilterDropdown/FilterDropdown.d.ts +7 -4
  28. package/build/components/FilterDropdown/FilterDropdown.js +16 -4
  29. package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.d.ts +12 -0
  30. package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.js +19 -0
  31. package/build/components/MultiDatakeyDonut/index.d.ts +1 -0
  32. package/build/components/MultiDatakeyDonut/index.js +1 -0
  33. package/build/components/MultiDatakeyDonut/style.d.ts +10 -0
  34. package/build/components/MultiDatakeyDonut/style.js +23 -0
  35. package/build/components/RangeCalender/RangeCalender.js +4 -2
  36. package/build/components/index.d.ts +1 -0
  37. package/build/components/index.js +1 -0
  38. package/build/constants/assets.d.ts +1 -0
  39. package/build/constants/assets.js +1 -0
  40. package/build/constants/reports.d.ts +1 -18
  41. package/build/constants/reports.js +27 -77
  42. package/build/types/apps.d.ts +9 -9
  43. package/build/utils/navigation.d.ts +1 -1
  44. package/package.json +2 -2
  45. package/build/components/ActivityAreaChart/components/ChartTooltip.d.ts +0 -3
  46. package/build/components/ActivityAreaChart/components/ChartTooltip.js +0 -24
  47. 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 { useTheme } from '@mui/material/styles';
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
- top: 20,
24
- }, data: data, onMouseMove: handleMouseMove }, { children: [data.length > 0 && (_jsx(Tooltip, { content: MemoizedChartTooltip, cursor: {
25
- fill: '#A5A8A3',
26
- stroke: '#A5A8A3',
27
- strokeWidth: 1,
28
- strokeOpacity: 1,
29
- stopOpacity: 0.3,
30
- strokeDasharray: '5 5',
31
- strokeLinecap: 'round',
32
- strokeLinejoin: 'round',
33
- } })), _jsx(Area, { dataKey: dataKey, type: "monotone", fill: "#76BB4012", stroke: theme.palette.success.dark, activeDot: {
34
- r: 5,
35
- fill: theme.palette.success.dark,
36
- strokeWidth: 2,
37
- stroke: 'white',
38
- cursor: chartHovered ? 'pointer' : 'default',
39
- onMouseOver: () => setChartHovered(true),
40
- onMouseLeave: () => setChartHovered(false),
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,6 @@
1
+ interface LegendLabelProps {
2
+ label: string;
3
+ color: string;
4
+ }
5
+ export declare const LegendLabel: ({ label, color }: LegendLabelProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -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,3 @@
1
+ export * from './ChartLegend';
2
+ export * from './constant';
3
+ export * from './type';
@@ -0,0 +1,3 @@
1
+ export * from './ChartLegend';
2
+ export * from './constant';
3
+ export * from './type';
@@ -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,2 @@
1
+ import { LEGENDS } from './constant';
2
+ export type LegendKey = keyof typeof LEGENDS;
@@ -0,0 +1,2 @@
1
+ import { ChartTooltipProps } from '../../types';
2
+ export declare const ChartTooltip: ({ active, payload, dateRange, activeLegend, }: ChartTooltipProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -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 { default as ChartTooltip } from './ChartTooltip';
2
- export { default as LoadingChart } from './LoadingChart';
1
+ export * from './ChartTooltip';
2
+ export * from './LoadingChart';
3
+ export * from './ChartLegend';
@@ -1,2 +1,3 @@
1
- export { default as ChartTooltip } from './ChartTooltip';
2
- export { default as LoadingChart } from './LoadingChart';
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"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
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(Typography)({
41
- fontWeight: 500,
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];
@@ -1,10 +1,13 @@
1
- /// <reference types="react" />
2
- interface FilterDropdownProps {
3
- children?: React.ReactNode;
1
+ import { BoxProps } from '@mui/material/Box';
2
+ import { SxProps } from '@mui/material';
3
+ interface FilterDropdownProps extends BoxProps {
4
4
  onConfirm: () => void;
5
5
  onCancel: () => void;
6
6
  isOkayButDisabled?: boolean;
7
7
  isDisabled?: boolean;
8
+ icon?: string;
9
+ title?: string;
10
+ menuStyle?: SxProps;
8
11
  }
9
- export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled }: Readonly<FilterDropdownProps>): import("react/jsx-runtime").JSX.Element;
12
+ export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled, icon, title, menuStyle, ...props }: Readonly<FilterDropdownProps>): import("react/jsx-runtime").JSX.Element;
10
13
  export {};
@@ -1,12 +1,24 @@
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
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useState, useEffect } from 'react';
2
14
  import Box from '@mui/material/Box';
15
+ import ClickAwayListener from '@mui/material/ClickAwayListener';
3
16
  import { useTranslation } from 'react-i18next';
4
- import { useState, useEffect } from 'react';
5
- import { ClickAwayListener } from '@mui/material';
6
17
  import { darkFilterIcon } from '../../constants/index.js';
7
18
  import { Menu, CustomBackdrop } from '../index.js';
8
19
  import { CancelButton, FilterButton, Footer, OkayButton, TitleStyled } from './style';
9
- export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled }) {
20
+ export default function FilterDropdown(_a) {
21
+ var { onConfirm, onCancel, isOkayButDisabled, children, isDisabled, icon, title, menuStyle } = _a, props = __rest(_a, ["onConfirm", "onCancel", "isOkayButDisabled", "children", "isDisabled", "icon", "title", "menuStyle"]);
10
22
  const [anchorEl, setAnchorEl] = useState(null);
11
23
  const open = Boolean(anchorEl);
12
24
  const { t } = useTranslation();
@@ -50,5 +62,5 @@ export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled,
50
62
  onConfirm();
51
63
  onClose();
52
64
  };
53
- return (_jsx(ClickAwayListener, Object.assign({ onClickAway: handleCancel }, { children: _jsxs(Box, { children: [_jsx(FilterButton, Object.assign({ isActive: open, onClick: onOpen, sx: Object.assign({}, (isDisabled && { pointerEvents: 'none', opacity: 0.5 })) }, { children: _jsx(Box, { component: "img", src: darkFilterIcon, alt: "filter" }) })), _jsxs(Menu, Object.assign({ anchorEl: anchorEl, open: open, sx: { marginTop: '8px', marginBottom: '8px', width: 193 }, placement: "bottom-end" }, { children: [_jsx(TitleStyled, Object.assign({ component: "span" }, { children: t('filterBy') })), children, _jsxs(Footer, { children: [_jsx(CancelButton, Object.assign({ onClick: handleCancel }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ disabled: isOkayButDisabled, onClick: handleConfirm }, { children: t('okay') }))] })] })), open && _jsx(CustomBackdrop, { onClick: onClose })] }) })));
65
+ return (_jsx(ClickAwayListener, Object.assign({ onClickAway: handleCancel }, { children: _jsxs(Box, Object.assign({}, props, { children: [_jsx(FilterButton, Object.assign({ className: "filter-button", isActive: open, onClick: onOpen, sx: Object.assign({}, (isDisabled && Object.assign({ pointerEvents: 'none', opacity: 0.5 }, props.sx))) }, { children: _jsx(Box, { component: "img", src: icon !== null && icon !== void 0 ? icon : darkFilterIcon, alt: "filter" }) })), _jsxs(Menu, Object.assign({ anchorEl: anchorEl, open: open, sx: Object.assign({ marginTop: '8px', marginBottom: '8px', width: 193 }, menuStyle), placement: "bottom-end" }, { children: [_jsx(TitleStyled, Object.assign({ component: "span" }, { children: title !== null && title !== void 0 ? title : t('filterBy') })), children, _jsxs(Footer, { children: [_jsx(CancelButton, Object.assign({ onClick: handleCancel }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ disabled: isOkayButDisabled, onClick: handleConfirm }, { children: t('okay') }))] })] })), open && _jsx(CustomBackdrop, { onClick: onClose })] })) })));
54
66
  }
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ interface DonutProps {
3
+ size?: number;
4
+ chartData: Array<{
5
+ name: string;
6
+ value: number;
7
+ color: string;
8
+ }>;
9
+ chartInfo?: ReactNode;
10
+ }
11
+ export declare const MultiDatakeyDonut: ({ chartData, size, chartInfo }: DonutProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { ResponsiveContainer, PieChart, Pie, Cell } from 'recharts';
4
+ import { DonutWrapper, CenterOverlay, Empty } from './style';
5
+ export const MultiDatakeyDonut = ({ chartData, size = 170, chartInfo }) => {
6
+ const pieSegments = useMemo(() => {
7
+ const total = chartData.reduce((sum, d) => sum + d.value, 0) || 1;
8
+ let cumulative = 0;
9
+ return chartData.map((d) => {
10
+ const start = (cumulative / total) * 360;
11
+ const end = ((cumulative + d.value) / total) * 360;
12
+ cumulative += d.value;
13
+ return Object.assign(Object.assign({}, d), { startAngle: start, endAngle: end });
14
+ });
15
+ }, [chartData]);
16
+ const isEmpty = chartData.every((d) => d.value === 0);
17
+ 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 }), !isEmpty &&
18
+ pieSegments.map((segment) => (_jsx(Pie, Object.assign({ data: [segment], dataKey: "value", cx: "50%", cy: "50%", innerRadius: "70%", outerRadius: "100%", startAngle: 90 - segment.startAngle, endAngle: 90 - segment.endAngle, cornerRadius: 0, stroke: "none", isAnimationActive: true, animationDuration: 800, style: { outline: 'none' } }, { children: _jsx(Cell, { fill: segment.color, tabIndex: -1 }, segment.name) }), segment.name)))] }) }), _jsx(CenterOverlay, { children: !chartInfo ? _jsx(Empty, { children: "----" }) : chartInfo })] })));
19
+ };
@@ -0,0 +1 @@
1
+ export * from './MultiDatakeyDonut';
@@ -0,0 +1 @@
1
+ export * from './MultiDatakeyDonut';
@@ -0,0 +1,10 @@
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 Empty: 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>, {}, {}>;
@@ -0,0 +1,23 @@
1
+ import { Box } from '@mui/material';
2
+ import { styled } from '@mui/material/styles';
3
+ export const DonutWrapper = styled(Box)(() => ({
4
+ width: '100%',
5
+ maxWidth: 500,
6
+ aspectRatio: '1',
7
+ position: 'relative',
8
+ }));
9
+ export const CenterOverlay = styled(Box)(({ theme }) => ({
10
+ position: 'absolute',
11
+ inset: 0,
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ justifyContent: 'center',
15
+ alignItems: 'center',
16
+ pointerEvents: 'none',
17
+ gap: theme.spacing(1),
18
+ }));
19
+ export const Empty = styled(Box)(({ theme }) => ({
20
+ fontSize: 17,
21
+ fontWeight: 700,
22
+ color: '#CFD0D2',
23
+ }));
@@ -58,8 +58,10 @@ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalend
58
58
  onChangeTimezone === null || onChangeTimezone === void 0 ? void 0 : onChangeTimezone(selectedTimezone);
59
59
  };
60
60
  const getSelectedDate = () => {
61
- const startSelectedTime = dates[0].format('MMM D');
62
- const endSelectedTime = dates[1] ? dates[1].format('MMM D') : dates[0].format('MMM D');
61
+ const nowYear = dayjs().year();
62
+ const formatDate = (date) => (date.year === nowYear ? date.format('MMM D') : date.format('MMM D, YYYY'));
63
+ const startSelectedTime = formatDate(dates[0]);
64
+ const endSelectedTime = dates[1] ? formatDate(dates[1]) : formatDate(dates[0]);
63
65
  return startSelectedTime === endSelectedTime && !noTimezone ? startSelectedTime : `${startSelectedTime} - ${endSelectedTime}`;
64
66
  };
65
67
  const onChange = (newDate) => {
@@ -153,3 +153,4 @@ export * from './SalesChannelFilter';
153
153
  export * from './ReferenceTypeFilter';
154
154
  export * from './ListColumnFilter';
155
155
  export * from './VerificationIcon';
156
+ export * from './MultiDatakeyDonut';
@@ -153,3 +153,4 @@ export * from './SalesChannelFilter';
153
153
  export * from './ReferenceTypeFilter';
154
154
  export * from './ListColumnFilter';
155
155
  export * from './VerificationIcon';
156
+ export * from './MultiDatakeyDonut';
@@ -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
- * Backend report filter types (used by reports APIs)
5
- *
6
- * Maps frontend report identifiers to the backend API filter types.
7
- * Acts as the source of truth for all report types across apps/services
8
- */
9
- const REPORT_FILTER_TYPES = {
10
- // Acceptance
11
- CHARGE: 'CHARGE',
12
- AUTHORIZE: 'AUTHORIZE',
13
- REFUND: 'REFUND',
14
- CHARGEBACKS: 'CHARGEBACKS',
15
- DESTINATIONS: 'DESTINATIONS',
16
- // Wallet
17
- STATEMENT: 'STATEMENT',
18
- STATEMENT_SUMMARY: 'STATEMENT_SUMMARY',
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: REPORT_FILTER_TYPES.INVOICE }],
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: REPORT_FILTER_TYPES.AUTHORIZE },
83
- { name: 'Charges', code: REPORT_FILTER_TYPES.CHARGE },
84
- { name: 'Refunds', code: REPORT_FILTER_TYPES.REFUND },
85
- { name: 'Chargebacks', code: REPORT_FILTER_TYPES.CHARGEBACKS },
86
- { name: 'Destinations', code: REPORT_FILTER_TYPES.DESTINATIONS },
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: REPORT_FILTER_TYPES.STATEMENT_SUMMARY },
95
- { name: 'Detailed Statement', code: REPORT_FILTER_TYPES.STATEMENT },
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: REPORT_FILTER_TYPES.PAYOUT },
104
- { name: 'Merchant Payouts', code: REPORT_FILTER_TYPES.MERCHANT_PAYOUT },
105
- { name: 'Retailer Payouts', code: REPORT_FILTER_TYPES.RETAILER_PAYOUT },
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
  ];
@@ -1,17 +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 type AppPayload<TServiceCodes extends string = string> = {
10
- services: {
11
- [key in TServiceCodes]?: ServicePayload;
12
- };
13
- };
14
- export interface ServicePayload {
10
+ export interface AccountAppPayload {
11
+ disabledAccountDataFetching?: boolean;
12
+ isAccountDetailsOpen: boolean;
13
+ selectedMerchant?: BusinessMerchant;
14
+ }
15
+ export interface AppPayload extends Partial<AccountAppPayload> {
15
16
  columnFilters?: Record<string, any>;
16
17
  filteredIds?: string[];
17
18
  dateRange?: [Date, Date];
@@ -20,7 +21,6 @@ export interface ServicePayload {
20
21
  isTextShown?: boolean;
21
22
  tableViews?: ColumnsView[];
22
23
  calendarTimezone?: number;
23
- reportTypes?: string[];
24
24
  }
25
25
  export interface AppDetails {
26
26
  id: string;
@@ -43,7 +43,7 @@ export interface AppDetails {
43
43
  minWidth: number | string;
44
44
  minHeight: number | string;
45
45
  };
46
- payload?: Record<string, any> & ServicePayload;
46
+ payload?: Record<string, any> & AppPayload;
47
47
  toolbarIconUrl?: string;
48
48
  hideMaximizedApp?: boolean;
49
49
  hideMinimizeApp?: boolean;
@@ -99,7 +99,7 @@ export type MFWidgetBaseProps = {
99
99
  hasHeader: boolean;
100
100
  sandboxMode: boolean;
101
101
  initialServiceCode?: string;
102
- initialAppPayload?: AppPayload;
102
+ initialPayload?: Record<string, any> & AppPayload;
103
103
  };
104
104
  user: User;
105
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").ServicePayload) | undefined;
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.2",
5
- "testVersion": 2,
4
+ "version": "0.1.365-test.20",
5
+ "testVersion": 20,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -1,3 +0,0 @@
1
- import { ChartTooltipProps } from '../types';
2
- declare const ChartTooltip: ({ active, payload, dateRange, selectedCurrency }: ChartTooltipProps) => import("react/jsx-runtime").JSX.Element | null;
3
- export default ChartTooltip;
@@ -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;
@@ -1,2 +0,0 @@
1
- declare const LoadingChart: () => import("react/jsx-runtime").JSX.Element;
2
- export default LoadingChart;