@tap-payments/os-micro-frontend-shared 0.1.14-test.8 → 0.1.14-test.9

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.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { TextAndLang } from '../../../../types/index.js';
2
3
  type TerminalsBrandCellProps = {
3
- name: Record<string, string>;
4
+ name: TextAndLang[];
4
5
  icon?: React.ReactNode;
5
6
  displayRules: {
6
7
  showIcon: boolean;
@@ -1,33 +1,20 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
2
  import { useTranslation } from 'react-i18next';
14
3
  import Stack from '@mui/material/Stack';
15
4
  import Typography from '@mui/material/Typography';
16
- import { Chip, TableCell, Tooltip } from '../../../index.js';
5
+ import { Chip, Tooltip } from '../../../index.js';
17
6
  import { getNameText } from '../../../../utils/index.js';
18
- const formatPropertyName = (name) => {
19
- const _a = name || {}, { textId: _ } = _a, nameMapper = __rest(_a, ["textId"]);
20
- return Object.entries(nameMapper).map(([lang, text]) => ({ lang, text }));
21
- };
22
7
  const TerminalsBrandCell = (props) => {
23
8
  const { name, icon, displayRules } = props;
24
9
  const { i18n } = useTranslation();
25
- if (!name && icon)
10
+ if (!name && !icon)
26
11
  return null;
27
12
  const { showIcon, showLabel } = displayRules;
28
- const brandName = name ? getNameText(formatPropertyName(name), i18n.language) : '';
13
+ const brandName = name ? getNameText(name, i18n.language) : '';
29
14
  const displayLabel = showLabel && !!brandName;
30
15
  const displayIcon = showIcon && !!icon;
31
- return (_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", spacing: 1 }, { children: [displayIcon && (_jsx(Chip, Object.assign({ variant: "circular", sx: { '&.CustomVariant_circular': { minWidth: 32, height: 32 } } }, { children: icon }))), displayLabel && (_jsx(Tooltip, Object.assign({ title: brandName }, { children: _jsx(Typography, Object.assign({ noWrap: true, fontSize: 12, fontWeight: 500 }, { children: brandName })) })))] })) }));
16
+ if (!displayIcon && !displayLabel)
17
+ return null;
18
+ return (_jsxs(Stack, Object.assign({ "data-testid": "TerminalsBrandCell", direction: "row", alignItems: "center", spacing: 1, color: "text.primary" }, { children: [displayIcon && (_jsx(Chip, Object.assign({ variant: "circular", sx: { '&.CustomVariant_circular': { minWidth: 32, height: 32 } } }, { children: icon }))), displayLabel && (_jsx(Tooltip, Object.assign({ title: brandName }, { children: _jsx(Typography, Object.assign({ noWrap: true, fontSize: 12, fontWeight: 500 }, { children: brandName })) })))] })));
32
19
  };
33
20
  export default TerminalsBrandCell;
@@ -8,5 +8,5 @@ type TerminalsPlatformCellProps = {
8
8
  showLabel?: boolean;
9
9
  };
10
10
  };
11
- declare const _default: import("react").MemoExoticComponent<({ name, icon, displayRules }: TerminalsPlatformCellProps) => import("react/jsx-runtime").JSX.Element>;
11
+ declare const _default: import("react").MemoExoticComponent<({ name, icon, displayRules }: TerminalsPlatformCellProps) => import("react/jsx-runtime").JSX.Element | null>;
12
12
  export default _default;
@@ -4,13 +4,16 @@ import { useTranslation } from 'react-i18next';
4
4
  import Stack from '@mui/material/Stack';
5
5
  import Typography from '@mui/material/Typography';
6
6
  import Box from '@mui/material/Box';
7
- import { Chip, TableCell, Tooltip } from '../../../index.js';
7
+ import { Chip, Tooltip } from '../../../index.js';
8
8
  import { getNameText } from '../../../../utils/index.js';
9
9
  const TerminalsPlatformCell = ({ name, icon, displayRules }) => {
10
10
  const { i18n } = useTranslation();
11
11
  const { showIcon = true, showLabel = true } = displayRules || {};
12
12
  const platformName = getNameText(name, i18n.language);
13
13
  const displayIcon = showIcon && !!icon;
14
- return (_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ "data-testid": "sdf", direction: "row", alignItems: "center", spacing: 1 }, { children: [displayIcon && (_jsx(Chip, Object.assign({ variant: "circular", sx: { '&.CustomVariant_circular': { minWidth: 32, height: 32 } } }, { children: icon }))), showLabel && (_jsx(Tooltip, Object.assign({ title: platformName }, { children: _jsx(Typography, Object.assign({ noWrap: true, fontSize: 12, fontWeight: 500 }, { children: platformName || (_jsx(Box, Object.assign({ component: "span", sx: { opacity: 0.2 } }, { children: "Unavailable" }))) })) })))] })) }));
14
+ const displayLabel = showLabel || !!platformName;
15
+ if (!displayIcon && !displayLabel)
16
+ return null;
17
+ return (_jsxs(Stack, Object.assign({ "data-testid": "TerminalsPlatformCell", direction: "row", alignItems: "center", spacing: 1, color: "text.primary" }, { children: [displayIcon && (_jsx(Chip, Object.assign({ variant: "circular", sx: { '&.CustomVariant_circular': { minWidth: 32, height: 32 } } }, { children: icon }))), displayLabel && (_jsx(Tooltip, Object.assign({ title: platformName }, { children: _jsx(Typography, Object.assign({ noWrap: true, fontSize: 12, fontWeight: 500 }, { children: platformName || (_jsx(Box, Object.assign({ component: "span", sx: { opacity: 0.2 } }, { children: "Unavailable" }))) })) })))] })));
15
18
  };
16
19
  export default memo(TerminalsPlatformCell);
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.14-test.8",
5
- "testVersion": 8,
4
+ "version": "0.1.14-test.9",
5
+ "testVersion": 9,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",