@tap-payments/os-micro-frontend-shared 0.1.324-test.3 → 0.1.324-test.5
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 +4 -0
- package/build/components/PaymentSourceFilter/style.js +10 -0
- package/build/utils/merchantSource.js +2 -2
- 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,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const MenuItemStyled: import("@emotion/styled").StyledComponent<import("../MenuItem/MenuItem").MenuItemProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
3
|
+
export declare const PaymentChip: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
4
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
5
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { styled } from '@mui/material/styles';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
2
3
|
import { MenuItem } from '../index.js';
|
|
3
4
|
export const MenuItemStyled = styled(MenuItem)(({ theme }) => ({
|
|
4
5
|
height: 40,
|
|
@@ -10,3 +11,12 @@ export const MenuItemStyled = styled(MenuItem)(({ theme }) => ({
|
|
|
10
11
|
flexGrow: 1,
|
|
11
12
|
},
|
|
12
13
|
}));
|
|
14
|
+
export const PaymentChip = styled(Box)(({ theme }) => ({
|
|
15
|
+
width: 36,
|
|
16
|
+
height: 24,
|
|
17
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
borderRadius: '12px',
|
|
22
|
+
}));
|
|
@@ -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/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.5",
|
|
5
|
+
"testVersion": 5,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|