@tap-payments/os-micro-frontend-shared 0.0.148 → 0.0.150-dropdown-flag-v1

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.
@@ -12,9 +12,9 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo } from 'react';
14
14
  import Box from '@mui/material/Box';
15
- import { defaultCountryIcon } from '../../constants/index.js';
15
+ import { defaultCountryIcon, getCountriesIcon } from '../../constants/index.js';
16
16
  function CountryFlag(_a) {
17
- var { code } = _a, props = __rest(_a, ["code"]);
18
- return (_jsx(Box, Object.assign({}, props, { component: "img", src: code || defaultCountryIcon, alt: code, sx: Object.assign(Object.assign({ width: 16 }, (code && { height: 12, borderRadius: '3px' })), props.sx), loading: "lazy" })));
17
+ var { code = '' } = _a, props = __rest(_a, ["code"]);
18
+ return (_jsx(Box, Object.assign({}, props, { component: "img", src: getCountriesIcon(code) || defaultCountryIcon, alt: code, sx: Object.assign(Object.assign({ width: 16 }, (code && { height: 12, borderRadius: '3px' })), props.sx), loading: "lazy" })));
19
19
  }
20
20
  export default memo(CountryFlag);
@@ -5,7 +5,7 @@ import { Typography, Checkbox } from '@mui/material';
5
5
  import { ChevronIcon } from '../TableHeader_V2/components/StatusButtons/ChevronIcon';
6
6
  import StyledBadge, { BadgeVariants } from '../CountBadge';
7
7
  import CountryFlag from '../CountryFlag';
8
- import { formatNumber, getCurrencyCodeFlag } from '../../utils/index.js';
8
+ import { formatNumber } from '../../utils/index.js';
9
9
  import { closeXIcon } from '../../constants/index.js';
10
10
  import { ChevronContainer, Label, LabelWrapper, StyledDropdown, MenuItemContainer, CheckboxStyles, StyledStatusButton, ClearIcon, ChevronIconWrapper, } from './style';
11
11
  function MultiSelectStatusButton({ options = [], selectedValues, onSelectionChange, label, variant = 'inActive' }) {
@@ -85,7 +85,7 @@ function MultiSelectStatusButton({ options = [], selectedValues, onSelectionChan
85
85
  var _a;
86
86
  e.stopPropagation();
87
87
  handleOptionToggle((_a = option.status) !== null && _a !== void 0 ? _a : '', e);
88
- } }), _jsx(CountryFlag, { code: getCurrencyCodeFlag(option.code), sx: { border: '1px solid white', borderRadius: '3px' } }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: option.name }))] })),
88
+ } }), _jsx(CountryFlag, { code: option.code, sx: { border: '1px solid white', borderRadius: '3px' } }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: option.name }))] })),
89
89
  onClick: (e) => {
90
90
  var _a;
91
91
  e.preventDefault();
@@ -33,7 +33,7 @@ function StatusButton(_a) {
33
33
  const statusIcon = icon ? _jsx(StatusIcon, { icon: icon, variant: variant, src: statusButtonIcons[icon], alt: `${icon}-icon` }) : null;
34
34
  const statusBadge = badgeCount && !Number.isNaN(convertToNumber(badgeCount)) ? (_jsx(StyledBadge, Object.assign({ variant: variant === 'active' ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE }, { children: formatNumber(Number(badgeCount)) }))) : null;
35
35
  const dropdownIcon = hasDropdown ? _jsx(ChevronIcon, { isActive: variant === 'active' }) : null;
36
- return (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ "data-testid": "StatusButton" }, props, { onClick: (e) => {
36
+ return (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ "data-testid": "StatusButton" }, props, { ref: buttonRef, onClick: (e) => {
37
37
  var _a, _b;
38
38
  (_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
39
39
  onButtonBodyClick === null || onButtonBodyClick === void 0 ? void 0 : onButtonBodyClick(lastActiveStatus || ((_b = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _b === void 0 ? void 0 : _b.status) || 'all');
@@ -22,6 +22,6 @@ function AmountCell(_a) {
22
22
  const icon = currency && _jsx(FlagIcon, { src: getCurrenciesIcon(currency), alt: "customer icon" });
23
23
  const { fullAmount } = formatAmountWithCurrency(amount, currency);
24
24
  const [integerAmount, decimalAmount] = fullAmount.toString().split('.');
25
- return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(AmountCellContainer, { children: [_jsx(Tooltip, Object.assign({ title: tooltipLabel || '' }, { children: conversionType && (_jsx(ConversionBadge, Object.assign({ tableMode: tableMode, className: "conversion-type" }, { children: conversionType }))) })), _jsx(Tooltip, Object.assign({ title: _jsx(CurrencyIcon, { currency: currency }) }, { children: isTextShown ? _jsx("span", {}) : _jsx(FlagContainer, { children: icon }) })), _jsx(Tooltip, Object.assign({ title: amountTooltipLabel }, { children: _jsx(CurrencySpan, Object.assign({ tableMode: tableMode }, { children: integerAmount && decimalAmount && amount !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { children: _jsx(CurrencyIcon, { currency: currency, fontSize: 10 }) }), ' ', integerAmount, ".", _jsx(DecimalSpan, { children: decimalAmount })] })) : (_jsx("span", { children: "-" })) })) }))] }) })));
25
+ return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(AmountCellContainer, { children: [_jsx(Tooltip, Object.assign({ title: tooltipLabel || '' }, { children: conversionType && (_jsx(ConversionBadge, Object.assign({ tableMode: tableMode, className: "conversion-type" }, { children: conversionType }))) })), _jsx(Tooltip, Object.assign({ title: _jsx(CurrencyIcon, { currency: currency }) }, { children: isTextShown ? _jsx("span", {}) : _jsx(FlagContainer, { children: icon }) })), _jsx(Tooltip, Object.assign({ title: amountTooltipLabel }, { children: _jsx(CurrencySpan, Object.assign({ tableMode: tableMode }, { children: amount !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { children: _jsx(CurrencyIcon, { currency: currency, fontSize: 10 }) }), ' ', integerAmount, decimalAmount && (_jsxs(_Fragment, { children: [".", _jsx(DecimalSpan, { children: decimalAmount })] }))] })) : (_jsx("span", { children: "-" })) })) }))] }) })));
26
26
  }
27
27
  export default AmountCell;
@@ -1,2 +1,2 @@
1
1
  import { MarketPlaceCellProps } from './type';
2
- export default function MarketPlaceCell({ isMarketPlace, ...props }: MarketPlaceCellProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function MarketPlaceCell({ marketPlaceIcon, marketPlaceName, isTextShown, ...props }: MarketPlaceCellProps): import("react/jsx-runtime").JSX.Element;
@@ -13,16 +13,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import Tooltip from '../../../Tooltip';
14
14
  import TableCell from '../../TableCell';
15
15
  import { Box } from '@mui/material';
16
- import { marketPlaceBlueIcon, marketPlaceDimmedIcon } from '../../../../constants/index.js';
16
+ import { marketPlaceBlueIcon } from '../../../../constants/index.js';
17
+ import { TextLabel } from '../style';
17
18
  export default function MarketPlaceCell(_a) {
18
- var { isMarketPlace } = _a, props = __rest(_a, ["isMarketPlace"]);
19
- return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(Tooltip, Object.assign({ title: isMarketPlace ? 'Market Place' : 'No Market Place' }, { children: _jsx(Box, Object.assign({ sx: {
20
- width: 36.25,
21
- height: 24.17,
22
- display: 'flex',
23
- alignItems: 'center',
24
- justifyContent: 'center',
25
- border: '1.03px solid #F2F2F2',
26
- borderRadius: '23.26px',
27
- } }, { children: _jsx(Box, { component: "img", src: isMarketPlace ? marketPlaceBlueIcon : marketPlaceDimmedIcon }) })) })) })));
19
+ var { marketPlaceIcon, marketPlaceName, isTextShown } = _a, props = __rest(_a, ["marketPlaceIcon", "marketPlaceName", "isTextShown"]);
20
+ return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(Tooltip, Object.assign({ title: marketPlaceName }, { children: _jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: 1 } }, { children: isTextShown ? (_jsx(TextLabel, { children: marketPlaceName })) : (_jsx(Box, Object.assign({ sx: {
21
+ width: '24px',
22
+ height: '24px',
23
+ border: '1px solid #F2F2F2',
24
+ borderRadius: '50%',
25
+ display: 'flex',
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ } }, { children: _jsx("img", { src: marketPlaceIcon || marketPlaceBlueIcon, alt: "marketplace", style: { maxWidth: '18px', maxHeight: '18px', objectFit: 'cover' } }) }))) })) })) })));
28
29
  }
@@ -1,4 +1,6 @@
1
1
  import { TableCellProps } from '@mui/material';
2
2
  export type MarketPlaceCellProps = TableCellProps & {
3
- isMarketPlace: boolean;
3
+ marketPlaceIcon?: string;
4
+ marketPlaceName?: string;
5
+ isTextShown?: boolean;
4
6
  };
@@ -62,7 +62,7 @@ function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columns
62
62
  const { header, id, align, headerStyle, sortable, filter } = column;
63
63
  const isFirst = id === columns[0].id;
64
64
  const isLast = id === columns[columns.length - 1].id;
65
- return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "VirtualTable_TableHeader_StyledCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, isFirst: isFirst, isLast: isLast, sx: Object.assign({ paddingInline: '0.6875rem', paddingLeft: isFirst ? '0' : '0.6875rem', paddingRight: isLast ? '0' : '0.6875rem', display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset' }, headerStyle), isSheetView: isSheetView }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "TableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && (_jsx("span", Object.assign({ style: { textOverflow: 'ellipsis', width: '80%', overflow: 'hidden' }, "data-testid": "VirtualTable_TableHeader_StyledCell_header_text" }, { children: header }))) }))), filter && _jsx(ColumnFilter, Object.assign({}, filter)), sortable && _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id })] }), `${id}-${colIndex}`));
65
+ return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "VirtualTable_TableHeader_StyledCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, isFirst: isFirst, isLast: isLast, sx: Object.assign({ paddingInline: '0.6875rem', paddingLeft: isFirst ? '0' : '0.6875rem', paddingRight: isLast ? '0' : '0.6875rem', display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset', fontWeight: 600 }, headerStyle), isSheetView: isSheetView }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "TableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && (_jsx("span", Object.assign({ style: { textOverflow: 'ellipsis', width: '80%', overflow: 'hidden' }, "data-testid": "VirtualTable_TableHeader_StyledCell_header_text" }, { children: header }))) }))), filter && _jsx(ColumnFilter, Object.assign({}, filter)), sortable && _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id })] }), `${id}-${colIndex}`));
66
66
  }) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
67
67
  {
68
68
  label: 'Sort A-Z',
@@ -21,6 +21,18 @@ export interface BusinessMerchant {
21
21
  comments_count: number;
22
22
  reference_id: string;
23
23
  control_by: string;
24
+ marketplace: {
25
+ id: string;
26
+ brand: {
27
+ id: string;
28
+ status: VerificationStatus;
29
+ name: {
30
+ textId: string;
31
+ en: string;
32
+ };
33
+ logo: string;
34
+ };
35
+ };
24
36
  business: {
25
37
  id: string;
26
38
  status: MerchantStatus;
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.0.148",
4
+ "version": "0.0.150-dropdown-flag-v1",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",