@tap-payments/os-micro-frontend-shared 0.1.433 → 0.1.434

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.
@@ -15,7 +15,7 @@ const ActivityAreaChart = ({ data, dataKey, isLoading, dateRange, selectedCurren
15
15
  };
16
16
  const MemoizedChartTooltip = useMemo(() => {
17
17
  return _jsx(ChartTooltip, { position: cursorPosition, dateRange: dateRange, selectedCurrency: selectedCurrency });
18
- }, [cursorPosition]);
18
+ }, [cursorPosition, dateRange, selectedCurrency]);
19
19
  if (isLoading || isEmpty) {
20
20
  return _jsx(LoadingChart, {});
21
21
  }
@@ -1,8 +1,8 @@
1
1
  import { CustomColumnFilterProps } from '../VirtualTables';
2
- import { PaymentSourceFilters } from './type';
2
+ import { Filter } from './type';
3
3
  interface PaymentInitiatedFilterProps extends Partial<CustomColumnFilterProps> {
4
- filters?: PaymentSourceFilters;
5
- setFilters?: (filters: PaymentSourceFilters) => void;
4
+ filters?: Filter;
5
+ setFilters?: (filters: Filter) => void;
6
6
  }
7
7
  export default function PaymentInitiatedFilter({ filters, setFilters }: Readonly<PaymentInitiatedFilterProps>): import("react/jsx-runtime").JSX.Element;
8
8
  export {};
@@ -26,7 +26,7 @@ export default function PaymentSchemes({ paymentSchemesSource, filters, setFilte
26
26
  const onClose = () => {
27
27
  setAnchorEl(null);
28
28
  };
29
- const isSelected = useMemo(() => { var _a; return paymentScheme.length === ((_a = paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.options) === null || _a === void 0 ? void 0 : _a.length) && paymentScheme.length > 0; }, [paymentScheme.length, (_c = paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.options) === null || _c === void 0 ? void 0 : _c.length]);
29
+ const isSelected = useMemo(() => { var _a; return (paymentScheme === null || paymentScheme === void 0 ? void 0 : paymentScheme.length) === ((_a = paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.options) === null || _a === void 0 ? void 0 : _a.length) && paymentScheme.length > 0; }, [paymentScheme === null || paymentScheme === void 0 ? void 0 : paymentScheme.length, (_c = paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.options) === null || _c === void 0 ? void 0 : _c.length]);
30
30
  const isIndeterminate = useMemo(() => !isSelected && paymentScheme.length > 0, [paymentScheme.length, isSelected]);
31
31
  const isSelectedPaymentScheme = useCallback((selectedPaymentScheme) => { var _a; return (_a = paymentScheme.includes(selectedPaymentScheme)) !== null && _a !== void 0 ? _a : false; }, [paymentScheme]);
32
32
  const onClick = () => {
@@ -1,9 +1,9 @@
1
1
  import { SourceFilter } from '../../types/index.js';
2
2
  import { CustomColumnFilterProps } from '../VirtualTables';
3
- import { PaymentSourceFilters } from './type';
3
+ import { Filter } from './type';
4
4
  interface SourceFilterProps extends CustomColumnFilterProps {
5
- filters: PaymentSourceFilters;
6
- setFilters: (filters: PaymentSourceFilters) => void;
5
+ filters: Filter;
6
+ setFilters: (filters: Filter) => void;
7
7
  showPaymentSchemes?: boolean;
8
8
  showPaymentMethods?: boolean;
9
9
  showPaymentInitiated?: boolean;
@@ -4,6 +4,7 @@ import { Menu, FilterTitle, FilterOkayButton, FilterFooter, FilterCancelButton }
4
4
  import PaymentMethods from './PaymentMethods';
5
5
  import PaymentSchemes from './PaymentSchemes';
6
6
  import PaymentInitiated from './PaymentInitiated';
7
+ // TODO: Refactor this component to be generic for all source filters
7
8
  export default function PaymentSourceFilter({ filters, setFilters, anchorEl, showPaymentSchemes = true, showPaymentMethods = true, showPaymentInitiated = true, paymentMethodsSource, paymentSchemesSource, onCloseDropdown, onConfirm, }) {
8
9
  const { t } = useTranslation();
9
10
  const open = Boolean(anchorEl);
@@ -1,2 +1,5 @@
1
1
  export { default as PaymentSourceFilter } from './PaymentSourceFilter';
2
- export { type PaymentSourceFilters } from './type';
2
+ export { default as PaymentMethods } from './PaymentMethods';
3
+ export { default as PaymentSchemes } from './PaymentSchemes';
4
+ export { default as PaymentInitiated } from './PaymentInitiated';
5
+ export * from './type';
@@ -1 +1,5 @@
1
1
  export { default as PaymentSourceFilter } from './PaymentSourceFilter';
2
+ export { default as PaymentMethods } from './PaymentMethods';
3
+ export { default as PaymentSchemes } from './PaymentSchemes';
4
+ export { default as PaymentInitiated } from './PaymentInitiated';
5
+ export * from './type';
@@ -4,7 +4,8 @@ export interface PaymentSourceFilters {
4
4
  payment_initiated?: string[];
5
5
  issuer_countries?: string[];
6
6
  }
7
+ export type Filter = Record<string, boolean | string | number | string[]>;
7
8
  export interface Filters {
8
- filters: PaymentSourceFilters;
9
- setFilters: (filters: PaymentSourceFilters) => void;
9
+ filters: Filter;
10
+ setFilters: (filters: Filter) => void;
10
11
  }
@@ -6,6 +6,11 @@ import MenuItem from '../../../MenuItem';
6
6
  import Text from '../../../Text';
7
7
  import { columnIcon, sortAzIcon, sortZaIcon } from '../../../../constants/index.js';
8
8
  import { ActionIcon, ColumnIcon } from './style';
9
+ var SORTING_ORDER;
10
+ (function (SORTING_ORDER) {
11
+ SORTING_ORDER["ASC"] = "asc";
12
+ SORTING_ORDER["DESC"] = "desc";
13
+ })(SORTING_ORDER || (SORTING_ORDER = {}));
9
14
  function ColumnSort({ onColumnSort, columnsSorting, columnId, onClick }) {
10
15
  const [anchorEl, setAnchorEl] = useState(null);
11
16
  const open = Boolean(anchorEl);
@@ -27,10 +32,10 @@ function ColumnSort({ onColumnSort, columnsSorting, columnId, onClick }) {
27
32
  handleClose(event);
28
33
  }
29
34
  };
30
- return (_jsxs(_Fragment, { children: [_jsx(ColumnIcon, { onClick: handleClick, src: columnIcon, alt: "column-icon", "data-id": columnId, sx: { userSelect: 'none', marginTop: '2px' } }), open && _jsx(CustomBackdrop, { onClick: handleClose }), _jsxs(Menu, Object.assign({ anchorEl: anchorEl, open: open }, { children: [_jsxs(MenuItem, Object.assign({ onClick: (e) => {
31
- handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'asc', e);
32
- }, sx: (theme) => (Object.assign({}, ((columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'asc' && { boxShadow: theme.shadows[10] }))) }, { children: [_jsx(ActionIcon, { src: sortAzIcon, alt: "sort-icon" }), _jsx(Text, Object.assign({ sx: { fontSize: '0.6875rem' } }, { children: "Sort Z-A" }))] })), _jsxs(MenuItem, Object.assign({ onClick: (e) => {
33
- handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'desc', e);
34
- }, sx: (theme) => (Object.assign({}, ((columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'desc' && { boxShadow: theme.shadows[10] }))) }, { children: [_jsx(ActionIcon, { src: sortZaIcon, alt: "sort-icon" }), _jsx(Text, Object.assign({ sx: { fontSize: '0.6875rem' } }, { children: "Sort Z-A" }))] }))] }))] }));
35
+ return (_jsxs(_Fragment, { children: [_jsx(ColumnIcon, { onClick: handleClick, src: columnIcon, alt: "column-icon", "data-id": columnId, sx: { userSelect: 'none', marginTop: '2px' } }), open && _jsx(CustomBackdrop, { onClick: handleClose }), _jsxs(Menu, Object.assign({ anchorEl: anchorEl, open: open }, { children: [_jsxs(MenuItem, Object.assign({ isSelected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === SORTING_ORDER.ASC, onClick: (e) => {
36
+ handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, SORTING_ORDER.ASC, e);
37
+ }, sx: (theme) => (Object.assign({}, ((columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === SORTING_ORDER.ASC && { boxShadow: theme.shadows[10] }))) }, { children: [_jsx(ActionIcon, { src: sortAzIcon, alt: "sort-icon" }), _jsx(Text, Object.assign({ sx: { fontSize: '0.6875rem' } }, { children: "Sort A-Z" }))] })), _jsxs(MenuItem, Object.assign({ isSelected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === SORTING_ORDER.DESC, onClick: (e) => {
38
+ handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, SORTING_ORDER.DESC, e);
39
+ }, sx: (theme) => (Object.assign({}, ((columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === SORTING_ORDER.DESC && { boxShadow: theme.shadows[10] }))) }, { children: [_jsx(ActionIcon, { src: sortZaIcon, alt: "sort-icon" }), _jsx(Text, Object.assign({ sx: { fontSize: '0.6875rem' } }, { children: "Sort Z-A" }))] }))] }))] }));
35
40
  }
36
41
  export default memo(ColumnSort);
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.433",
4
+ "version": "0.1.434",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",