@tap-payments/os-micro-frontend-shared 0.1.324-test.2 → 0.1.324-test.4
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.
- package/build/components/PaymentSourceFilter/PaymentIcon.d.ts +5 -0
- package/build/components/PaymentSourceFilter/PaymentIcon.js +9 -0
- package/build/components/PaymentSourceFilter/PaymentMethod.js +2 -1
- package/build/components/PaymentSourceFilter/PaymentSchemes.js +2 -1
- package/build/components/PaymentSourceFilter/style.d.ts +1 -0
- package/build/components/PaymentSourceFilter/style.js +9 -0
- package/build/utils/merchantSource.js +2 -2
- package/build/utils/segment.d.ts +2 -2
- package/build/utils/segment.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import { getPaymentMethodsIcon } from '../../constants/index.js';
|
|
4
|
+
import { PaymentChip } from './style';
|
|
5
|
+
export function PaymentIcon({ url }) {
|
|
6
|
+
return (_jsx(PaymentChip, { children: _jsx(Box, { component: "img", src: url, sx: { width: 18 }, onError: (e) => {
|
|
7
|
+
e.currentTarget.src = getPaymentMethodsIcon('card');
|
|
8
|
+
} }) }));
|
|
9
|
+
}
|
|
@@ -14,6 +14,7 @@ import { useState, useCallback, useMemo } from 'react';
|
|
|
14
14
|
import { Menu } from '../index.js';
|
|
15
15
|
import { rightArrow } from '../../constants/index.js';
|
|
16
16
|
import { MenuItemStyled } from './style';
|
|
17
|
+
import { PaymentIcon } from './PaymentIcon';
|
|
17
18
|
export default function PaymentMethod({ icon, name, options = [], filters, setFilters }) {
|
|
18
19
|
var _a;
|
|
19
20
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -50,5 +51,5 @@ export default function PaymentMethod({ icon, name, options = [], filters, setFi
|
|
|
50
51
|
setFilters(Object.assign(Object.assign({}, filters), { payment_methods: [...(paymentMethods !== null && paymentMethods !== void 0 ? paymentMethods : []), selectedPaymentMethod] }));
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
return (_jsxs(MenuItemStyled, Object.assign({ isSelected: isSelected, isIndeterminate: isIndeterminate, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick }, { children: [_jsx("img", { src: icon, alt: name }), _jsx("span", Object.assign({ className: "label" }, { children: name })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(Menu, Object.assign({ open: Boolean(anchorEl), anchorEl: anchorEl, placement: "right-end" }, { children: options === null || options === void 0 ? void 0 : options.map((option) => (_jsx(MenuItemStyled, Object.assign({ isSelected: isSelectedPaymentMethod(option.type), onClick: (e) => onClickPaymentMethod(e, option.type) }, { children: _jsx(
|
|
54
|
+
return (_jsxs(MenuItemStyled, Object.assign({ isSelected: isSelected, isIndeterminate: isIndeterminate, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick }, { children: [_jsx("img", { src: icon, alt: name }), _jsx("span", Object.assign({ className: "label" }, { children: name })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(Menu, Object.assign({ open: Boolean(anchorEl), anchorEl: anchorEl, placement: "right-end" }, { children: options === null || options === void 0 ? void 0 : options.map((option) => (_jsx(MenuItemStyled, Object.assign({ isSelected: isSelectedPaymentMethod(option.type), onClick: (e) => onClickPaymentMethod(e, option.type) }, { children: _jsx(PaymentIcon, { url: option.icon }) }), option.type))) }))] })));
|
|
54
55
|
}
|
|
@@ -14,6 +14,7 @@ import { useCallback, useMemo, useState } from 'react';
|
|
|
14
14
|
import { Menu } from '../index.js';
|
|
15
15
|
import { rightArrow } from '../../constants/index.js';
|
|
16
16
|
import { MenuItemStyled } from './style';
|
|
17
|
+
import { PaymentIcon } from './PaymentIcon';
|
|
17
18
|
export default function PaymentSchemes({ paymentSchemesSource, filters, setFilters }) {
|
|
18
19
|
var _a, _b, _c, _d;
|
|
19
20
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -49,5 +50,5 @@ export default function PaymentSchemes({ paymentSchemesSource, filters, setFilte
|
|
|
49
50
|
setFilters(Object.assign(Object.assign({}, filters), { payment_scheme: [...((_b = filters === null || filters === void 0 ? void 0 : filters.payment_scheme) !== null && _b !== void 0 ? _b : []), selectedPaymentScheme] }));
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
|
-
return (_jsxs(MenuItemStyled, Object.assign({ isSelected: isSelected, isIndeterminate: isIndeterminate, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick, sx: Object.assign({}, (isDisabled && { opacity: 0.5, pointerEvents: 'none' })) }, { children: [_jsx("span", Object.assign({ className: "label" }, { children: paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.name })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(Menu, Object.assign({ open: Boolean(anchorEl), anchorEl: anchorEl, placement: "right-start" }, { children: (_d = paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.options) === null || _d === void 0 ? void 0 : _d.map((scheme) => (_jsx(MenuItemStyled, Object.assign({ isSelected: isSelectedPaymentScheme(scheme.type), onClick: (e) => onClickPaymentScheme(e, scheme.type) }, { children: _jsx(
|
|
53
|
+
return (_jsxs(MenuItemStyled, Object.assign({ isSelected: isSelected, isIndeterminate: isIndeterminate, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick, sx: Object.assign({}, (isDisabled && { opacity: 0.5, pointerEvents: 'none' })) }, { children: [_jsx("span", Object.assign({ className: "label" }, { children: paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.name })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(Menu, Object.assign({ open: Boolean(anchorEl), anchorEl: anchorEl, placement: "right-start" }, { children: (_d = paymentSchemesSource === null || paymentSchemesSource === void 0 ? void 0 : paymentSchemesSource.options) === null || _d === void 0 ? void 0 : _d.map((scheme) => (_jsx(MenuItemStyled, Object.assign({ isSelected: isSelectedPaymentScheme(scheme.type), onClick: (e) => onClickPaymentScheme(e, scheme.type) }, { children: _jsx(PaymentIcon, { url: scheme.icon }) }), scheme.type))) }))] })));
|
|
53
54
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const MenuItemStyled: import("@emotion/styled").StyledComponent<import("../MenuItem/MenuItem").MenuItemProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
2
|
+
export declare const PaymentChip: import("@emotion/styled").StyledComponent<import("../MenuItem/MenuItem").MenuItemProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -10,3 +10,12 @@ export const MenuItemStyled = styled(MenuItem)(({ theme }) => ({
|
|
|
10
10
|
flexGrow: 1,
|
|
11
11
|
},
|
|
12
12
|
}));
|
|
13
|
+
export const PaymentChip = styled(MenuItem)(({ theme }) => ({
|
|
14
|
+
width: 36,
|
|
15
|
+
height: 24,
|
|
16
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
borderRadius: '12px',
|
|
21
|
+
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import capitalize from 'lodash/capitalize';
|
|
2
|
-
import { getPaymentMethodsIcon,
|
|
2
|
+
import { getPaymentMethodsIcon, PAYMENT_TYPES_ICONS } from '../constants/index.js';
|
|
3
3
|
import { getNameText } from './language';
|
|
4
4
|
export function transformPaymentMethodsData(data) {
|
|
5
5
|
return {
|
|
@@ -30,7 +30,7 @@ export function transformPaymentSchemesData(data = []) {
|
|
|
30
30
|
return {
|
|
31
31
|
name: getNameText(scheme === null || scheme === void 0 ? void 0 : scheme.name),
|
|
32
32
|
type: scheme === null || scheme === void 0 ? void 0 : scheme.code,
|
|
33
|
-
icon:
|
|
33
|
+
icon: getPaymentMethodsIcon(scheme.code),
|
|
34
34
|
};
|
|
35
35
|
}),
|
|
36
36
|
};
|
package/build/utils/segment.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Segment,
|
|
1
|
+
import { Segment, SegmentData } from '../types/index.js';
|
|
2
2
|
export declare const getSegmentData: (segments: Segment[], activeSegmentId: string, activeSegments: Segment[]) => SegmentData;
|
|
3
3
|
export declare const getBusinessSegmentConfig: (merchantsIds: string[]) => {
|
|
4
4
|
business?: undefined;
|
|
@@ -7,7 +7,7 @@ export declare const getBusinessSegmentConfig: (merchantsIds: string[]) => {
|
|
|
7
7
|
merchant: string[];
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export declare const getNonBusinessSegmentConfig: (segmentCode:
|
|
10
|
+
export declare const getNonBusinessSegmentConfig: (segmentCode: string, segmentId: string) => {
|
|
11
11
|
payment_provider: {
|
|
12
12
|
technology: {
|
|
13
13
|
orchestrator: string[];
|
package/build/utils/segment.js
CHANGED
|
@@ -13,7 +13,7 @@ export const getSegmentData = (segments, activeSegmentId, activeSegments) => {
|
|
|
13
13
|
defaultEntity });
|
|
14
14
|
};
|
|
15
15
|
export const getBusinessSegmentConfig = (merchantsIds) => {
|
|
16
|
-
if (!merchantsIds)
|
|
16
|
+
if (!merchantsIds || !(merchantsIds === null || merchantsIds === void 0 ? void 0 : merchantsIds.length))
|
|
17
17
|
return {};
|
|
18
18
|
return { business: { merchant: merchantsIds } };
|
|
19
19
|
};
|
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.324-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.324-test.4",
|
|
5
|
+
"testVersion": 4,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|