@tap-payments/os-micro-frontend-shared 0.1.299-test.1 → 0.1.299-test.11
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/index.d.ts +0 -1
- package/build/components/index.js +0 -1
- package/build/constants/payment.d.ts +2 -0
- package/build/constants/payment.js +4 -2
- package/build/types/segment.d.ts +9 -0
- package/build/types/segment.js +10 -1
- package/build/utils/merchantSource.d.ts +32 -0
- package/build/utils/merchantSource.js +80 -0
- package/package.json +2 -2
- package/build/components/ListColumnFilter/ListColumnFilter.d.ts +0 -16
- package/build/components/ListColumnFilter/ListColumnFilter.js +0 -36
- package/build/components/ListColumnFilter/index.d.ts +0 -1
- package/build/components/ListColumnFilter/index.js +0 -1
- package/build/components/ListColumnFilter/style.d.ts +0 -15
- package/build/components/ListColumnFilter/style.js +0 -35
|
@@ -3,6 +3,8 @@ export declare const PAYMENT_TYPES: {
|
|
|
3
3
|
label: string;
|
|
4
4
|
icon: string;
|
|
5
5
|
}[];
|
|
6
|
+
export declare const PAYMENT_INITIATED_CUSTOMER_KEY = "customer";
|
|
7
|
+
export declare const PAYMENT_INITIATED_MERCHANT_KEY = "merchant";
|
|
6
8
|
export declare const PAYMENT_INITIATED_OPTIONS: {
|
|
7
9
|
key: string;
|
|
8
10
|
value: string;
|
|
@@ -36,7 +36,9 @@ export const PAYMENT_TYPES = [
|
|
|
36
36
|
icon: `${lightUrl}/cash.svg`,
|
|
37
37
|
},
|
|
38
38
|
];
|
|
39
|
+
export const PAYMENT_INITIATED_CUSTOMER_KEY = 'customer';
|
|
40
|
+
export const PAYMENT_INITIATED_MERCHANT_KEY = 'merchant';
|
|
39
41
|
export const PAYMENT_INITIATED_OPTIONS = [
|
|
40
|
-
{ key:
|
|
41
|
-
{ key:
|
|
42
|
+
{ key: PAYMENT_INITIATED_CUSTOMER_KEY, value: 'true', label: 'Customer' },
|
|
43
|
+
{ key: PAYMENT_INITIATED_MERCHANT_KEY, value: 'false', label: 'Merchant' },
|
|
42
44
|
];
|
package/build/types/segment.d.ts
CHANGED
|
@@ -4,3 +4,12 @@ export interface SegmentData extends Segment {
|
|
|
4
4
|
defaultCountry?: SegmentCountry;
|
|
5
5
|
defaultEntity?: Entity;
|
|
6
6
|
}
|
|
7
|
+
export declare enum SEGMENTS_IDS {
|
|
8
|
+
BUSINESS = "BUSINESS",
|
|
9
|
+
PLATFORM = "PLATFORM",
|
|
10
|
+
DEVELOPMENT = "DEVELOPMENT",
|
|
11
|
+
PAYMENT_TECHNOLOGY = "PAYMENT_TECHNOLOGY",
|
|
12
|
+
PAYMENT_FACILITATOR = "PAYMENT_FACILITATOR",
|
|
13
|
+
PAYMENT_ACQUIRER = "PAYMENT_ACQUIRER",
|
|
14
|
+
PAYMENT_GATEWAY = "PAYMENT_GATEWAY"
|
|
15
|
+
}
|
package/build/types/segment.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var SEGMENTS_IDS;
|
|
2
|
+
(function (SEGMENTS_IDS) {
|
|
3
|
+
SEGMENTS_IDS["BUSINESS"] = "BUSINESS";
|
|
4
|
+
SEGMENTS_IDS["PLATFORM"] = "PLATFORM";
|
|
5
|
+
SEGMENTS_IDS["DEVELOPMENT"] = "DEVELOPMENT";
|
|
6
|
+
SEGMENTS_IDS["PAYMENT_TECHNOLOGY"] = "PAYMENT_TECHNOLOGY";
|
|
7
|
+
SEGMENTS_IDS["PAYMENT_FACILITATOR"] = "PAYMENT_FACILITATOR";
|
|
8
|
+
SEGMENTS_IDS["PAYMENT_ACQUIRER"] = "PAYMENT_ACQUIRER";
|
|
9
|
+
SEGMENTS_IDS["PAYMENT_GATEWAY"] = "PAYMENT_GATEWAY";
|
|
10
|
+
})(SEGMENTS_IDS || (SEGMENTS_IDS = {}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TextAndLang } from '../types/index.js';
|
|
2
|
+
interface Source {
|
|
3
|
+
code: string;
|
|
4
|
+
name: TextAndLang[];
|
|
5
|
+
}
|
|
6
|
+
interface PaymentMethod extends Source {
|
|
7
|
+
payment_methods: Source[];
|
|
8
|
+
}
|
|
9
|
+
export declare function transformPaymentMethodsData(data?: PaymentMethod[]): never[] | {
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
options: ({
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
options: {
|
|
17
|
+
name: string | undefined;
|
|
18
|
+
type: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
}[];
|
|
21
|
+
} | null)[];
|
|
22
|
+
};
|
|
23
|
+
export declare function transformPaymentSchemesData(data?: Source[]): never[] | {
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
options: {
|
|
27
|
+
name: string | undefined;
|
|
28
|
+
type: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { lightUrl } from '../constants/index.js';
|
|
2
|
+
import { getNameText } from './language';
|
|
3
|
+
const PAYMENT_TYPES = {
|
|
4
|
+
DEVICE: {
|
|
5
|
+
name: 'Device',
|
|
6
|
+
type: 'device',
|
|
7
|
+
icon: `${lightUrl}/device.svg`,
|
|
8
|
+
},
|
|
9
|
+
CARD: {
|
|
10
|
+
name: 'Cards',
|
|
11
|
+
type: 'cards',
|
|
12
|
+
icon: `${lightUrl}/payment-method/card.svg`,
|
|
13
|
+
},
|
|
14
|
+
PASS_THRU_WALLET: {
|
|
15
|
+
name: 'Pass-Thru Wallet',
|
|
16
|
+
type: 'pass_thru_wallet',
|
|
17
|
+
icon: `${lightUrl}/passThruWallet.svg`,
|
|
18
|
+
},
|
|
19
|
+
EXPRESS_CHECKOUT: {
|
|
20
|
+
name: 'Express Checkout',
|
|
21
|
+
type: 'express_checkout',
|
|
22
|
+
icon: `${lightUrl}/express_checkout.svg`,
|
|
23
|
+
},
|
|
24
|
+
STORED_VALUE_WALLET: {
|
|
25
|
+
name: 'Stored Value Wallet',
|
|
26
|
+
type: 'stored_value_wallet',
|
|
27
|
+
icon: `${lightUrl}/storedValueWallet.svg`,
|
|
28
|
+
},
|
|
29
|
+
CASH_WALLET: {
|
|
30
|
+
name: 'Cash Wallet',
|
|
31
|
+
type: 'cash_wallet',
|
|
32
|
+
icon: `${lightUrl}/cash.svg`,
|
|
33
|
+
},
|
|
34
|
+
BUY_NOW_PAY_LATER: {
|
|
35
|
+
name: 'Buy Now Pay Later',
|
|
36
|
+
type: 'buy_now_pay_later',
|
|
37
|
+
icon: `${lightUrl}/buyNowPayLater.svg`,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export function transformPaymentMethodsData(data) {
|
|
41
|
+
if (!data)
|
|
42
|
+
return [];
|
|
43
|
+
return {
|
|
44
|
+
name: 'Payment Methods',
|
|
45
|
+
type: 'payment_methods',
|
|
46
|
+
options: data === null || data === void 0 ? void 0 : data.map((category) => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const paymentType = (_a = PAYMENT_TYPES[category.code]) !== null && _a !== void 0 ? _a : {};
|
|
49
|
+
if (!paymentType)
|
|
50
|
+
return null;
|
|
51
|
+
return {
|
|
52
|
+
name: paymentType === null || paymentType === void 0 ? void 0 : paymentType.name,
|
|
53
|
+
type: paymentType === null || paymentType === void 0 ? void 0 : paymentType.type,
|
|
54
|
+
icon: paymentType === null || paymentType === void 0 ? void 0 : paymentType.icon,
|
|
55
|
+
options: (_b = category.payment_methods) === null || _b === void 0 ? void 0 : _b.map((method) => ({
|
|
56
|
+
name: getNameText(method.name),
|
|
57
|
+
type: method.code,
|
|
58
|
+
icon: `${lightUrl}/payment-method/${method.code}.svg`,
|
|
59
|
+
})),
|
|
60
|
+
};
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function transformPaymentSchemesData(data) {
|
|
65
|
+
if (!data)
|
|
66
|
+
return [];
|
|
67
|
+
return {
|
|
68
|
+
name: 'Payment Schemes',
|
|
69
|
+
type: 'payment_scheme',
|
|
70
|
+
options: data
|
|
71
|
+
.filter((scheme) => scheme.code)
|
|
72
|
+
.map((scheme) => {
|
|
73
|
+
return {
|
|
74
|
+
name: getNameText(scheme === null || scheme === void 0 ? void 0 : scheme.name),
|
|
75
|
+
type: scheme === null || scheme === void 0 ? void 0 : scheme.code,
|
|
76
|
+
icon: `${lightUrl}/payment-method/${scheme.code}.svg`,
|
|
77
|
+
};
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
}
|
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.299-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.299-test.11",
|
|
5
|
+
"testVersion": 11,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CustomColumnFilterProps } from '../VirtualTables';
|
|
2
|
-
export interface ListColumnFilterProps extends CustomColumnFilterProps {
|
|
3
|
-
apiKey: string;
|
|
4
|
-
placeholder: string;
|
|
5
|
-
onConfirm: () => void;
|
|
6
|
-
onClear: () => void;
|
|
7
|
-
inputValue: string;
|
|
8
|
-
onInputValueChange: (val: string) => void;
|
|
9
|
-
list: {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
}[];
|
|
13
|
-
onClickItem: (id: string) => void;
|
|
14
|
-
selectedListItems: string[];
|
|
15
|
-
}
|
|
16
|
-
export default function ListColumnFilter({ anchorEl, onCloseDropdown, list, apiKey, placeholder, onConfirm, onClear, onClickItem, inputValue, onInputValueChange, selectedListItems, }: ListColumnFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import { Box } from '@mui/material';
|
|
5
|
-
import { SearchListInput, FilterTitle, FilterOkayButton, FilterFooter, FilterCancelButton } from '../index.js';
|
|
6
|
-
import { FilterMenu, Container, ListColumnFilterID, ListColumnFilterMenuItem, ListColumnFilterName, ListColumnFilterWrapper } from './style';
|
|
7
|
-
export default function ListColumnFilter({ anchorEl, onCloseDropdown, list, apiKey, placeholder, onConfirm, onClear, onClickItem, inputValue, onInputValueChange, selectedListItems, }) {
|
|
8
|
-
const { t } = useTranslation();
|
|
9
|
-
const handleOkButtonClick = (e) => {
|
|
10
|
-
onConfirm();
|
|
11
|
-
onCloseDropdown(e);
|
|
12
|
-
};
|
|
13
|
-
const onCancel = (e) => {
|
|
14
|
-
onClear();
|
|
15
|
-
onCloseDropdown(e);
|
|
16
|
-
};
|
|
17
|
-
const isInputHasValue = !!inputValue.trim().length;
|
|
18
|
-
const onClickResetInput = () => {
|
|
19
|
-
if (isInputHasValue)
|
|
20
|
-
onInputValueChange('');
|
|
21
|
-
};
|
|
22
|
-
const onChangeInput = (value) => {
|
|
23
|
-
onInputValueChange(value);
|
|
24
|
-
};
|
|
25
|
-
// filter the list based on input value
|
|
26
|
-
const filteredList = useMemo(() => {
|
|
27
|
-
if (!isInputHasValue)
|
|
28
|
-
return list;
|
|
29
|
-
return list === null || list === void 0 ? void 0 : list.filter((item) => item.name.toLowerCase().includes(inputValue.trim().toLowerCase()));
|
|
30
|
-
}, [inputValue, isInputHasValue, list]);
|
|
31
|
-
const noListDataAvailable = (isInputHasValue && !filteredList.length) || !list.length;
|
|
32
|
-
const selectedSet = useMemo(() => new Set(selectedListItems), [selectedListItems]);
|
|
33
|
-
return (_jsxs(FilterMenu, Object.assign({ open: !!anchorEl, anchorEl: anchorEl }, { children: [_jsx(FilterTitle, Object.assign({ component: "span" }, { children: t('filterBy') })), _jsx(SearchListInput, { value: inputValue, name: apiKey, placeholder: placeholder, onSearchChange: onChangeInput, onSearchReset: onClickResetInput }), _jsx(Container, { children: !noListDataAvailable ? (filteredList === null || filteredList === void 0 ? void 0 : filteredList.map((item, index) => (_jsx(ListColumnFilterMenuItem, Object.assign({ isSelected: selectedSet.has(item === null || item === void 0 ? void 0 : item.id), onClick: () => {
|
|
34
|
-
onClickItem(item === null || item === void 0 ? void 0 : item.id);
|
|
35
|
-
} }, { children: _jsxs(ListColumnFilterWrapper, { children: [_jsx(ListColumnFilterName, { children: item.name }), _jsx(ListColumnFilterID, Object.assign({ component: "span" }, { children: item.id }))] }) }), `${item.id}-${index}`)))) : (_jsx(Box, Object.assign({ sx: { p: 1, textAlign: 'center', fontSize: '11px' } }, { children: "No data available" }))) }), _jsxs(FilterFooter, { children: [_jsx(FilterCancelButton, Object.assign({ onClick: onCancel }, { children: t('cancel') })), _jsx(FilterOkayButton, Object.assign({ onClick: handleOkButtonClick }, { children: t('okay') }))] })] })));
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ListColumnFilter, type ListColumnFilterProps } from './ListColumnFilter';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ListColumnFilter } from './ListColumnFilter';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
5
|
-
export declare const ListColumnFilterMenuItem: import("@emotion/styled").StyledComponent<import("../MenuItem/MenuItem").MenuItemProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
6
|
-
export declare const ListColumnFilterWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
8
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
9
|
-
export declare const ListColumnFilterID: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
11
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
12
|
-
export declare const ListColumnFilterName: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
13
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
14
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
15
|
-
export declare const FilterMenu: import("@emotion/styled").StyledComponent<Omit<import("../Menu/Menu").MenuProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { styled, alpha } from '@mui/material/styles';
|
|
2
|
-
import Box from '@mui/material/Box';
|
|
3
|
-
import { Menu, MenuItem } from '../index.js';
|
|
4
|
-
export const Container = styled(Box)(() => ({
|
|
5
|
-
maxHeight: '210px',
|
|
6
|
-
maxWidth: '177px',
|
|
7
|
-
overflowY: 'auto',
|
|
8
|
-
padding: 0,
|
|
9
|
-
}));
|
|
10
|
-
export const ListColumnFilterMenuItem = styled(MenuItem)(() => ({
|
|
11
|
-
padding: '12px 16px',
|
|
12
|
-
border: 'none !important',
|
|
13
|
-
'&:hover': { boxShadow: '0px 0px 16px 0px #00000021' },
|
|
14
|
-
maxHeight: 35,
|
|
15
|
-
minHeight: 35,
|
|
16
|
-
}));
|
|
17
|
-
export const ListColumnFilterWrapper = styled(Box)(() => ({
|
|
18
|
-
display: 'flex',
|
|
19
|
-
flexDirection: 'column',
|
|
20
|
-
gap: '2px',
|
|
21
|
-
}));
|
|
22
|
-
export const ListColumnFilterID = styled(Box)(({ theme }) => ({
|
|
23
|
-
color: alpha(theme.palette.text.primary, 0.5),
|
|
24
|
-
fontSize: '9px',
|
|
25
|
-
}));
|
|
26
|
-
export const ListColumnFilterName = styled(Box)(() => ({
|
|
27
|
-
fontSize: '11px',
|
|
28
|
-
overflow: 'hidden',
|
|
29
|
-
textOverflow: 'ellipsis',
|
|
30
|
-
whiteSpace: 'nowrap',
|
|
31
|
-
maxWidth: '120px',
|
|
32
|
-
}));
|
|
33
|
-
export const FilterMenu = styled(Menu)(() => ({
|
|
34
|
-
marginBottom: '8px',
|
|
35
|
-
}));
|