@tap-payments/os-micro-frontend-shared 0.0.263 → 0.0.264

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.
@@ -22,17 +22,21 @@ function SegmentsCell(_a) {
22
22
  var { isTextShown } = _a, props = __rest(_a, ["isTextShown"]);
23
23
  const [isTooltipOpen, setIsTooltipOpen] = useState(false);
24
24
  const theme = useTheme();
25
- const segments = useMemo(() => Object.keys(segmentsIcons).filter((key) => !!props[key]), [props]);
25
+ const segments = useMemo(() => Object.keys(segmentsIcons).filter((key) => { var _a; return !!((_a = props[key]) === null || _a === void 0 ? void 0 : _a.name); }), [props]);
26
26
  const ReferenceSources = useMemo(() => segments.map((segment, index) => {
27
27
  const prefixKey = ['technology', 'institution'].includes(segment) ? 'Payment' : '';
28
- const sourceTooltip = `${prefixKey} ${startCase(segment)} - ${props[segment]}`;
28
+ const segmentData = props[segment];
29
+ const sourceTooltip = `${prefixKey} ${startCase(segment)} - ${segmentData === null || segmentData === void 0 ? void 0 : segmentData.name}`;
29
30
  return (_jsx(Tooltip, Object.assign({ onOpen: () => {
30
31
  setIsTooltipOpen(true);
31
32
  }, onClose: () => {
32
33
  setIsTooltipOpen(false);
33
34
  }, title: sourceTooltip }, { children: _jsx(ImageWrapper, Object.assign({ order: index, variants: referenceSourceAnimation(index, theme.shadows[4], isTextShown ? 83 : 0), sx: {
34
35
  width: isTextShown ? '79px' : '24px',
35
- } }, { children: isTextShown ? (_jsx(ReferenceTextWrapper, { children: _jsx(ReferenceTextLabel, { children: startCase(segment) }) })) : (_jsx(StyledSourceImage, { src: segmentsIcons[segment], alt: segment, sx: Object.assign({}, (segment === 'order' && { width: '11.82px' })) })) })) }), `${segment}-${index}`));
36
+ } }, { children: isTextShown ? (_jsx(ReferenceTextWrapper, { children: _jsx(ReferenceTextLabel, { children: startCase(segment) }) })) : (_jsx(StyledSourceImage, { src: (segmentData === null || segmentData === void 0 ? void 0 : segmentData.icon) || segmentsIcons[segment], alt: segment, sx: Object.assign(Object.assign({}, (segment === 'order' && { width: '11.82px' })), ((segmentData === null || segmentData === void 0 ? void 0 : segmentData.icon) && { borderRadius: '40px' })), onError: (e) => {
37
+ e.currentTarget.src = segmentsIcons[segment];
38
+ e.currentTarget.style.borderRadius = '0px';
39
+ } })) })) }), `${segment}-${index}`));
36
40
  }), [props, segments, isTextShown, theme]);
37
41
  const referenceSourcesCount = (ReferenceSources === null || ReferenceSources === void 0 ? void 0 : ReferenceSources.length) || 0;
38
42
  return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, { children: referenceSourcesCount > 0 ? (_jsx(ReferenceSourcesContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate", animate: isTooltipOpen ? 'animate' : 'start', sourcesCount: referenceSourcesCount, variants: { animate: { width: referenceSourcesCount * (6 + 32) } }, style: {
@@ -1,11 +1,15 @@
1
1
  import { TableCellProps } from '@mui/material/TableCell';
2
2
  import { segmentsIcons } from './constant';
3
3
  export type SegmentsType = keyof typeof segmentsIcons;
4
+ export interface SegmentInfo {
5
+ name?: string;
6
+ icon?: string;
7
+ }
4
8
  export interface SegmentsCellProps extends TableCellProps {
5
- technology?: string;
6
- institution?: string;
7
- payment?: string;
8
- developmentHouse?: string;
9
- platform?: string;
9
+ technology?: SegmentInfo;
10
+ institution?: SegmentInfo;
11
+ payment?: SegmentInfo;
12
+ developmentHouse?: SegmentInfo;
13
+ platform?: SegmentInfo;
10
14
  isTextShown?: boolean;
11
15
  }
@@ -68,6 +68,7 @@ export interface BusinessMerchant {
68
68
  platforms: Array<{
69
69
  id: string;
70
70
  brand: {
71
+ logo?: string;
71
72
  name: Array<{
72
73
  lang: string;
73
74
  text: string;
@@ -76,7 +76,7 @@ export const getLoggedInUserSegment = () => {
76
76
  const userData = getLoggedInUserData();
77
77
  if (!userData)
78
78
  return null;
79
- return getSegmentData(userData === null || userData === void 0 ? void 0 : userData.segments, userData === null || userData === void 0 ? void 0 : userData.active_segment_id, userData === null || userData === void 0 ? void 0 : userData.active_segments);
79
+ return getSegmentData(userData === null || userData === void 0 ? void 0 : userData.segments, userData === null || userData === void 0 ? void 0 : userData.active_segment_id);
80
80
  };
81
81
  export const getLoggedInUserActiveSegment = () => {
82
82
  const userData = getLoggedInUserData();
@@ -1,2 +1,2 @@
1
1
  import { Segment, SegmentData } from '../types/index.js';
2
- export declare const getSegmentData: (segments: Segment[], activeSegmentId: string, activeSegments: Segment[]) => SegmentData;
2
+ export declare const getSegmentData: (segments: Segment[], activeSegmentId: string) => SegmentData;
@@ -1,12 +1,9 @@
1
1
  import { getDefaultEntityCountry } from './entity';
2
- export const getSegmentData = (segments, activeSegmentId, activeSegments) => {
3
- var _a, _b, _c;
2
+ export const getSegmentData = (segments, activeSegmentId) => {
3
+ var _a, _b;
4
4
  const newSegment = (_a = segments.find((segment) => segment.id === activeSegmentId)) !== null && _a !== void 0 ? _a : {};
5
- const activeSegment = (_b = activeSegments.find((segment) => segment.id === activeSegmentId)) !== null && _b !== void 0 ? _b : {};
6
- const defaultCountry = activeSegment.countries.length === 1
7
- ? newSegment.countries.find((country) => { var _a; return country.id === ((_a = activeSegment.countries) === null || _a === void 0 ? void 0 : _a[0].id); })
8
- : getDefaultEntityCountry(newSegment === null || newSegment === void 0 ? void 0 : newSegment.countries);
9
- const defaultEntity = (_c = defaultCountry === null || defaultCountry === void 0 ? void 0 : defaultCountry.entities) === null || _c === void 0 ? void 0 : _c.find((entity) => entity.default);
5
+ const defaultCountry = getDefaultEntityCountry(newSegment === null || newSegment === void 0 ? void 0 : newSegment.countries);
6
+ const defaultEntity = (_b = defaultCountry === null || defaultCountry === void 0 ? void 0 : defaultCountry.entities) === null || _b === void 0 ? void 0 : _b.find((entity) => entity.default);
10
7
  return Object.assign(Object.assign({}, newSegment), { defaultCountry,
11
8
  defaultEntity });
12
9
  };
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.0.263",
5
- "testVersion": 2,
4
+ "version": "0.0.264",
5
+ "testVersion": 1,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",