@tap-payments/os-micro-frontend-shared 0.1.241-test.3 → 0.1.241-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/ActionMenu/ActionMenuDropDown.js +4 -3
- package/build/components/ActionMenu/ActionMenuItem.js +3 -3
- package/build/components/ActionMenu/style.d.ts +0 -1
- package/build/components/ActionMenu/style.js +0 -4
- package/build/components/ActivityAreaChart/components/ChartTooltip.js +4 -3
- package/build/components/ActivityAreaChart/styles.d.ts +0 -1
- package/build/components/ActivityAreaChart/styles.js +0 -6
- package/build/components/InputBase/PhoneInputBase/CountriesList/CountriesList.js +2 -1
- package/build/utils/currency.d.ts +0 -1
- package/build/utils/currency.js +1 -6
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import {
|
|
4
|
-
import { EnglishAmount, StyledCurrency, StyledIconRowContainer, StyledDropDownContainer, StyledDropdown,
|
|
3
|
+
import { intlCurrency } from '../../utils/index.js';
|
|
4
|
+
import { EnglishAmount, StyledCurrency, StyledIconRowContainer, StyledDropDownContainer, StyledDropdown, StyledMenuItem, StyledTextAmount, DropDownChargeGapColumn, } from './style';
|
|
5
|
+
import CurrencyCountryFlag from '../CurrencyCountryFlag';
|
|
5
6
|
const Menu = ({ selectedCurrency, option, closeDropdown, handleSelectOption }) => {
|
|
6
7
|
var _a, _b, _c;
|
|
7
8
|
const { t } = useTranslation();
|
|
@@ -10,7 +11,7 @@ const Menu = ({ selectedCurrency, option, closeDropdown, handleSelectOption }) =
|
|
|
10
11
|
handleSelectOption(option.value, option === null || option === void 0 ? void 0 : option.currency);
|
|
11
12
|
}
|
|
12
13
|
closeDropdown();
|
|
13
|
-
} }, { children: [_jsx(EnglishAmount, Object.assign({ showBottomPadding: true, showWarning: false }, { children: t(option.name) })), _jsxs(DropDownChargeGapColumn, { children: [_jsxs(StyledIconRowContainer, Object.assign({ marginRightAuto: true }, { children: [_jsx(
|
|
14
|
+
} }, { children: [_jsx(EnglishAmount, Object.assign({ showBottomPadding: true, showWarning: false }, { children: t(option.name) })), _jsxs(DropDownChargeGapColumn, { children: [_jsxs(StyledIconRowContainer, Object.assign({ marginRightAuto: true }, { children: [_jsx(CurrencyCountryFlag, { code: (_a = option === null || option === void 0 ? void 0 : option.currency) !== null && _a !== void 0 ? _a : selectedCurrency }), _jsx(StyledCurrency, { children: (_b = option === null || option === void 0 ? void 0 : option.currency) !== null && _b !== void 0 ? _b : selectedCurrency })] })), _jsx(StyledTextAmount, Object.assign({ showWarning: false }, { children: intlCurrency(option.value || 0, (_c = option === null || option === void 0 ? void 0 : option.currency) !== null && _c !== void 0 ? _c : selectedCurrency) }))] })] })));
|
|
14
15
|
};
|
|
15
16
|
function ActionMenuDropDown({ menuAnchor, showDropDown, selectedCurrency, options, closeDropdown, handleSelectOption }) {
|
|
16
17
|
if (options.length <= 1)
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { blueDropdownArrowIcon, greyDropdownIcon } from '../../constants/index.js';
|
|
5
|
-
import {
|
|
6
|
-
import { EnglishAmount, Charge, StyledIconRowContainer, StyledFlag, StyledCurrency, StyledDropDownIcon, StyledAmount, StyledMissingDiv, } from './style';
|
|
5
|
+
import { EnglishAmount, Charge, StyledIconRowContainer, StyledCurrency, StyledDropDownIcon, StyledAmount, StyledMissingDiv } from './style';
|
|
7
6
|
import Skeleton from '../Skeleton';
|
|
8
7
|
import CurrencyIcon from '../CurrencyIcon';
|
|
8
|
+
import CurrencyCountryFlag from '../CurrencyCountryFlag';
|
|
9
9
|
function ActionMenuItem({ showWarning, selectedCurrency, onAmountChange, amount, currencyConfig, toggleDropDown, showDropDown, showDropdownIcon, disabled, isLoading, }) {
|
|
10
10
|
var _a, _b;
|
|
11
11
|
const { t } = useTranslation();
|
|
@@ -15,6 +15,6 @@ function ActionMenuItem({ showWarning, selectedCurrency, onAmountChange, amount,
|
|
|
15
15
|
iconRef.current.click();
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Charge, { children: [_jsx(EnglishAmount, Object.assign({ showBottomPadding: true, showWarning: showWarning }, { children: t('amount') })), _jsxs(StyledIconRowContainer, Object.assign({ limited: true, paddingTop: true, onClick: onClickMissingDiv }, { children: [_jsx(
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Charge, { children: [_jsx(EnglishAmount, Object.assign({ showBottomPadding: true, showWarning: showWarning }, { children: t('amount') })), _jsxs(StyledIconRowContainer, Object.assign({ limited: true, paddingTop: true, onClick: onClickMissingDiv }, { children: [_jsx(CurrencyCountryFlag, { code: selectedCurrency }), _jsx(StyledCurrency, { children: _jsx(CurrencyIcon, { currency: selectedCurrency }) }), !showWarning && showDropdownIcon && (_jsx(StyledDropDownIcon, { src: !showDropDown ? blueDropdownArrowIcon : greyDropdownIcon, alt: "drop-down icon", currencyPadding: true }))] }))] }), _jsx(StyledMissingDiv, { ref: iconRef, onClick: toggleDropDown }), isLoading ? (_jsx(Skeleton, { variant: "text", width: "100%", height: "100%" })) : (_jsx(StyledAmount, { disabled: disabled, placeholder: currencyConfig[selectedCurrency] ? '0.000' : '0.00', onValueChange: onAmountChange, value: amount, decimalsLimit: (_a = currencyConfig[selectedCurrency]) !== null && _a !== void 0 ? _a : 2, showWarning: showWarning || false, decimalScale: (_b = currencyConfig[selectedCurrency]) !== null && _b !== void 0 ? _b : 2, autoFocus: true }))] }));
|
|
19
19
|
}
|
|
20
20
|
export default ActionMenuItem;
|
|
@@ -58,7 +58,6 @@ export declare const StyledIconRowContainer: import("@emotion/styled").StyledCom
|
|
|
58
58
|
}, {}, {}>;
|
|
59
59
|
export declare const StyledCurrency: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
60
60
|
export declare const StyledMissingDiv: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
61
|
-
export declare const StyledFlag: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
62
61
|
export declare const StyledPopover: import("@emotion/styled").StyledComponent<import("@mui/material").PopoverProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
63
62
|
export declare const IconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
64
63
|
disabled?: boolean | undefined;
|
|
@@ -129,10 +129,6 @@ export const StyledMissingDiv = styled('div')({
|
|
|
129
129
|
width: 0,
|
|
130
130
|
height: 0,
|
|
131
131
|
});
|
|
132
|
-
export const StyledFlag = styled('img')({
|
|
133
|
-
width: '0.76rem',
|
|
134
|
-
height: '0.56rem',
|
|
135
|
-
});
|
|
136
132
|
export const StyledPopover = styled(Popover)(({ theme }) => ({
|
|
137
133
|
backgroundColor: theme.palette.background.default,
|
|
138
134
|
boxShadow: theme.shadows[21],
|
|
@@ -2,10 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
5
|
-
import {
|
|
5
|
+
import { getLocalizedUnitLabel } from '../../../utils/index.js';
|
|
6
6
|
import { DATA_KEY } from '../../../constants/index.js';
|
|
7
|
-
import { TooltipContainer, TimeTypography, ValueTypography, CurrencyBox, CurrencyText
|
|
7
|
+
import { TooltipContainer, TimeTypography, ValueTypography, CurrencyBox, CurrencyText } from '../styles';
|
|
8
8
|
import { getTooltipFormattedValue, getFormattedDateWithTimezone } from '../utils';
|
|
9
|
+
import CurrencyCountryFlag from '../../CurrencyCountryFlag';
|
|
9
10
|
const ChartTooltip = ({ active, payload, dateRange, selectedCurrency }) => {
|
|
10
11
|
var _a, _b, _c, _d;
|
|
11
12
|
const { t } = useTranslation();
|
|
@@ -16,7 +17,7 @@ const ChartTooltip = ({ active, payload, dateRange, selectedCurrency }) => {
|
|
|
16
17
|
const point = payload[0];
|
|
17
18
|
const localizedUnitLabel = getLocalizedUnitLabel(point === null || point === void 0 ? void 0 : point.dataKey, point === null || point === void 0 ? void 0 : point.value);
|
|
18
19
|
const formattedDate = ((_a = point === null || point === void 0 ? void 0 : point.payload) === null || _a === void 0 ? void 0 : _a.date) && getFormattedDateWithTimezone((_b = point === null || point === void 0 ? void 0 : point.payload) === null || _b === void 0 ? void 0 : _b.date, isSingleDay, (_c = point === null || point === void 0 ? void 0 : point.payload) === null || _c === void 0 ? void 0 : _c.hour);
|
|
19
|
-
return (_jsxs(TooltipContainer, Object.assign({ className: "chart-tooltip" }, { children: [_jsx(TimeTypography, { children: formattedDate !== null && formattedDate !== void 0 ? formattedDate : (_d = point === null || point === void 0 ? void 0 : point.payload) === null || _d === void 0 ? void 0 : _d.date }), _jsxs(ValueTypography, { children: [(point === null || point === void 0 ? void 0 : point.dataKey) === DATA_KEY.AMOUNT && (_jsxs(CurrencyBox, { children: [_jsx(
|
|
20
|
+
return (_jsxs(TooltipContainer, Object.assign({ className: "chart-tooltip" }, { children: [_jsx(TimeTypography, { children: formattedDate !== null && formattedDate !== void 0 ? formattedDate : (_d = point === null || point === void 0 ? void 0 : point.payload) === null || _d === void 0 ? void 0 : _d.date }), _jsxs(ValueTypography, { children: [(point === null || point === void 0 ? void 0 : point.dataKey) === DATA_KEY.AMOUNT && (_jsxs(CurrencyBox, { children: [_jsx(CurrencyCountryFlag, { code: selectedCurrency }), _jsx(CurrencyText, { children: selectedCurrency })] })), _jsx(Box, { children: `${getTooltipFormattedValue(point, t(localizedUnitLabel), selectedCurrency)}` })] })] })));
|
|
20
21
|
}
|
|
21
22
|
return null;
|
|
22
23
|
};
|
|
@@ -14,4 +14,3 @@ export declare const CurrencyBox: import("@emotion/styled").StyledComponent<impo
|
|
|
14
14
|
export declare const CurrencyText: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
15
15
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
16
16
|
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "classes" | "align" | "className" | "style" | "children" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
17
|
-
export declare const CurrencyIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
@@ -6,6 +6,7 @@ import CustomBackdrop from '../../../CustomBackdrop';
|
|
|
6
6
|
import { downArrowIcon, searchIcon } from '../../../../constants/index.js';
|
|
7
7
|
import { CountryStyled, CountriesWrapper, CountriesListStyled, InputStyled, CountryButton, Required } from './style';
|
|
8
8
|
import { ClickAwayListener } from '@mui/material';
|
|
9
|
+
import CountryFlag from '../../../CountryFlag';
|
|
9
10
|
function CountriesList({ isLoading, countries, value: countryValue, onCountryChange, required, disabled }) {
|
|
10
11
|
const [selectedCountry, setSelectedCountry] = useState();
|
|
11
12
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -58,7 +59,7 @@ function CountriesList({ isLoading, countries, value: countryValue, onCountryCha
|
|
|
58
59
|
}, sx: {
|
|
59
60
|
backgroundColor: isSelected ? '#F9F9F9' : 'transparent',
|
|
60
61
|
color: isSelected ? '#000' : '#8D8D94',
|
|
61
|
-
} }, { children: [_jsx(
|
|
62
|
+
} }, { children: [_jsx(CountryFlag, { code: country.iso2 }), _jsx("span", { children: `+${country.idd_prefix}` })] }), `country-code-${country.countryId}`));
|
|
62
63
|
}) }))] })) })))] })));
|
|
63
64
|
}
|
|
64
65
|
CountriesList.displayName = 'CountriesList';
|
|
@@ -5,7 +5,6 @@ export declare const conversionTypesLabels: {
|
|
|
5
5
|
};
|
|
6
6
|
export declare const currencyConfig: Record<string, number>;
|
|
7
7
|
export declare const intlCurrency: (charge: number, currencyType: CurrencyCodes) => string;
|
|
8
|
-
export declare const getCurrencyCodeFlag: (currency: string) => string;
|
|
9
8
|
export declare const isIntegerAmount: (charge: number) => boolean;
|
|
10
9
|
export declare const isDecimalWithOneDigit: (charge: number) => boolean;
|
|
11
10
|
export declare const hasOnlyOneDigitAfterDecimal: (charge: number) => boolean;
|
package/build/utils/currency.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CurrencyCodes } from '../types/index.js';
|
|
1
|
+
import { SUPPORTED_CURRENCY_DETAILS } from '../constants/index.js';
|
|
3
2
|
export const conversionTypesLabels = {
|
|
4
3
|
fx: 'Foreign Exchange',
|
|
5
4
|
dcc: 'Dynamic Currency Conversion',
|
|
@@ -28,10 +27,6 @@ export const intlCurrency = (charge, currencyType) => {
|
|
|
28
27
|
return '0';
|
|
29
28
|
}
|
|
30
29
|
};
|
|
31
|
-
export const getCurrencyCodeFlag = (currency) => {
|
|
32
|
-
const currencyMap = new Map(SUPPORTED_CURRENCY_CODES.map((selectedCurrency) => [selectedCurrency, getCurrenciesIcon(selectedCurrency)]));
|
|
33
|
-
return currencyMap.get(currency) || CurrencyCodes.SAR;
|
|
34
|
-
};
|
|
35
30
|
export const isIntegerAmount = (charge) => {
|
|
36
31
|
return charge % 1 === 0;
|
|
37
32
|
};
|
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.241-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.241-test.5",
|
|
5
|
+
"testVersion": 5,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|