@tap-payments/os-micro-frontend-shared 0.1.245 → 0.1.246-test.2

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.
Files changed (104) hide show
  1. package/build/components/ActionMenu/ActionMenuDropDown.js +2 -2
  2. package/build/components/ActionMenu/ActionMenuItem.js +3 -3
  3. package/build/components/ActivityAreaChart/components/ChartTooltip.js +2 -2
  4. package/build/components/Chip/style.d.ts +0 -1
  5. package/build/components/CountBadge/style.d.ts +0 -1
  6. package/build/components/CountryFlag/CountryFlag.d.ts +3 -2
  7. package/build/components/CountryFlag/CountryFlag.js +4 -3
  8. package/build/components/{CurrencyIcon/CurrencyIcon.d.ts → CurrencySymbol/CurrencySymbol.d.ts} +2 -2
  9. package/build/components/CurrencySymbol/CurrencySymbol.js +14 -0
  10. package/build/components/CurrencySymbol/index.d.ts +2 -0
  11. package/build/components/CurrencySymbol/index.js +2 -0
  12. package/build/components/{CurrencyIcon → CurrencySymbol}/style.d.ts +1 -1
  13. package/build/components/{CurrencyIcon → CurrencySymbol}/style.js +1 -1
  14. package/build/components/Dialog/style.d.ts +0 -1
  15. package/build/components/FlippingCard/style.d.ts +0 -1
  16. package/build/components/ImageWrapper/ImageWrapper.d.ts +0 -1
  17. package/build/components/JSONViewer/style.d.ts +0 -1
  18. package/build/components/LeftPeekRightExpandingChip/style.d.ts +0 -1
  19. package/build/components/RangeCalender/components/Timezone/Timezone.js +1 -1
  20. package/build/components/RangeCalender/components/Timezone/components/EntitiesTimezone.js +2 -2
  21. package/build/components/RangeCalender/components/Timezone/components/UserTimezone.js +1 -1
  22. package/build/components/RightLeftExpandingCenterChip/style.d.ts +0 -1
  23. package/build/components/SearchButton/styles.d.ts +0 -1
  24. package/build/components/StatusIcons/AuthIcons/style.d.ts +0 -1
  25. package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +0 -1
  26. package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +0 -1
  27. package/build/components/StatusIcons/GeographyIcon/GeographyIcon.js +1 -1
  28. package/build/components/StatusIcons/SourceIcons/style.d.ts +0 -1
  29. package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +0 -1
  30. package/build/components/TableCells/CustomCells/AmountCell/AmountCell.js +2 -2
  31. package/build/components/TableCells/CustomCells/AmountCell/AmountCellText.js +2 -2
  32. package/build/components/TableCells/CustomCells/AmountCell/components/AmountConversionTooltipLabel.js +2 -2
  33. package/build/components/TableCells/CustomCells/AmountCell/components/CurrencyInfo.js +2 -2
  34. package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +0 -1
  35. package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +0 -1
  36. package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +0 -1
  37. package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +0 -1
  38. package/build/components/TableCells/CustomCells/BalanceCell/BalanceCell.js +3 -3
  39. package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellSheet.js +3 -3
  40. package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +0 -1
  41. package/build/components/TableCells/CustomCells/BankCell/BankCell.js +1 -1
  42. package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +0 -1
  43. package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +0 -1
  44. package/build/components/TableCells/CustomCells/CurrencyCell/CurrencyCell.js +2 -2
  45. package/build/components/TableCells/CustomCells/DateCell/DateCell.js +1 -1
  46. package/build/components/TableCells/CustomCells/DestinationCell/DestinationCellSheet.js +2 -2
  47. package/build/components/TableCells/CustomCells/DestinationCell/DestinationCellText.js +2 -2
  48. package/build/components/TableCells/CustomCells/DestinationCell/utils.js +3 -3
  49. package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +0 -1
  50. package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +0 -1
  51. package/build/components/TableCells/CustomCells/EntityCell/EntityCell.js +1 -1
  52. package/build/components/TableCells/CustomCells/IDButton/style.d.ts +0 -1
  53. package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +0 -1
  54. package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +0 -1
  55. package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +0 -1
  56. package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +0 -1
  57. package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +0 -1
  58. package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +0 -1
  59. package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +0 -1
  60. package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +0 -1
  61. package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +0 -1
  62. package/build/components/TableCells/CustomCells/SourceCell/SourceCell.js +1 -1
  63. package/build/components/TableCells/CustomCells/SourceCell/style.d.ts +0 -1
  64. package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +0 -1
  65. package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +0 -1
  66. package/build/components/TableCells/CustomCells/WalletCell/WalletCell.js +1 -1
  67. package/build/components/TableCells/CustomCells/style.d.ts +0 -1
  68. package/build/components/VAT/TotalVAT/TotalVAT.d.ts +12 -0
  69. package/build/components/VAT/TotalVAT/TotalVAT.js +31 -0
  70. package/build/components/VAT/TotalVAT/index.d.ts +1 -0
  71. package/build/components/VAT/TotalVAT/index.js +1 -0
  72. package/build/components/VAT/TotalVAT/style.d.ts +12 -0
  73. package/build/components/VAT/TotalVAT/style.js +5 -0
  74. package/build/components/VAT/VATDropdown/VATDropdown.d.ts +11 -0
  75. package/build/components/VAT/VATDropdown/VATDropdown.js +34 -0
  76. package/build/components/VAT/VATDropdown/index.d.ts +1 -0
  77. package/build/components/VAT/VATDropdown/index.js +1 -0
  78. package/build/components/VAT/VATDropdown/style.d.ts +7 -0
  79. package/build/components/VAT/VATDropdown/style.js +32 -0
  80. package/build/components/VAT/VATRateDropdown/VATRateDropdown.d.ts +10 -0
  81. package/build/components/VAT/VATRateDropdown/VATRateDropdown.js +38 -0
  82. package/build/components/VAT/VATRateDropdown/index.d.ts +1 -0
  83. package/build/components/VAT/VATRateDropdown/index.js +1 -0
  84. package/build/components/VAT/VATRateDropdown/style.d.ts +7 -0
  85. package/build/components/VAT/VATRateDropdown/style.js +30 -0
  86. package/build/components/VAT/index.d.ts +4 -0
  87. package/build/components/VAT/index.js +4 -0
  88. package/build/components/VAT/utils.d.ts +7 -0
  89. package/build/components/VAT/utils.js +8 -0
  90. package/build/components/VirtualTables/components/style.d.ts +0 -1
  91. package/build/components/index.d.ts +2 -2
  92. package/build/components/index.js +2 -2
  93. package/build/constants/index.d.ts +1 -0
  94. package/build/constants/index.js +1 -0
  95. package/build/constants/rate.d.ts +6 -0
  96. package/build/constants/rate.js +6 -0
  97. package/package.json +3 -3
  98. package/build/components/CurrencyCountryFlag/CurrencyCountryFlag.d.ts +0 -8
  99. package/build/components/CurrencyCountryFlag/CurrencyCountryFlag.js +0 -22
  100. package/build/components/CurrencyCountryFlag/index.d.ts +0 -2
  101. package/build/components/CurrencyCountryFlag/index.js +0 -2
  102. package/build/components/CurrencyIcon/CurrencyIcon.js +0 -15
  103. package/build/components/CurrencyIcon/index.d.ts +0 -2
  104. package/build/components/CurrencyIcon/index.js +0 -2
@@ -20,5 +20,5 @@ import { Box } from '@mui/material';
20
20
  export default function EntityCell(_a) {
21
21
  var { entity, country, verificationStatus, licenseNumber, hideStatus } = _a, props = __rest(_a, ["entity", "country", "verificationStatus", "licenseNumber", "hideStatus"]);
22
22
  const icon = verificationIcon[verificationStatus !== null && verificationStatus !== void 0 ? verificationStatus : 'incomplete'];
23
- return (_jsx(TableCell, Object.assign({}, props, { sx: { cursor: (props === null || props === void 0 ? void 0 : props.onClick) ? 'pointer' : 'default' } }, { children: _jsx(Tooltip, Object.assign({ title: entity }, { children: _jsx(EntityWrapper, Object.assign({ sx: { cursor: props.onClick ? 'pointer' : 'default' } }, { children: _jsxs(Box, Object.assign({ display: "flex", alignItems: "center", gap: '5px', sx: { overflow: 'hidden', width: '100%' } }, { children: [_jsx(Tooltip, Object.assign({ title: getCountryNameByISO(country) }, { children: _jsx(CountryFlag, { code: country }) })), _jsx(EntityName, { children: licenseNumber }), !hideStatus && (_jsx(VerificationContainer, { children: _jsx(VerificationIcon, { src: icon }) }))] })) })) })) })));
23
+ return (_jsx(TableCell, Object.assign({}, props, { sx: { cursor: (props === null || props === void 0 ? void 0 : props.onClick) ? 'pointer' : 'default' } }, { children: _jsx(Tooltip, Object.assign({ title: entity }, { children: _jsx(EntityWrapper, Object.assign({ sx: { cursor: props.onClick ? 'pointer' : 'default' } }, { children: _jsxs(Box, Object.assign({ display: "flex", alignItems: "center", gap: '5px', sx: { overflow: 'hidden', width: '100%' } }, { children: [_jsx(Tooltip, Object.assign({ title: getCountryNameByISO(country) }, { children: _jsx(CountryFlag, { countryCode: country }) })), _jsx(EntityName, { children: licenseNumber }), !hideStatus && (_jsx(VerificationContainer, { children: _jsx(VerificationIcon, { src: icon }) }))] })) })) })) })));
24
24
  }
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const Button: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const ProductCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const RefundChargeCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const RefundCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const SalesChannelsContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
5
4
  hidden?: boolean | undefined;
@@ -41,7 +41,7 @@ function SourceCell(_a) {
41
41
  const customerInitiatedTooltip = customerInitiated === false ? t('merchantInitiated') : '';
42
42
  const geographyTooltip = geographyVariant ? geographyMap[geographyVariant] : undefined;
43
43
  const tooltip = geographyTooltip || flagIcon ? `${geographyTooltip || ''} ${geographyTooltip && flagIcon ? `-` : ''} ${flagIcon ? `${flagIcon}` : ''}` : undefined;
44
- const icon = flagIcon && _jsx(CountryFlag, { code: flagIcon });
44
+ const icon = flagIcon && _jsx(CountryFlag, { countryCode: flagIcon });
45
45
  const sources = [];
46
46
  const walletTypeIcon = (payment === null || payment === void 0 ? void 0 : payment.wallet) === 'SV Wallet' ? 'walletStoredValue' : 'walletPassThru';
47
47
  const type = (payment === null || payment === void 0 ? void 0 : payment.type) === 'Wallet' ? walletTypeIcon : payment === null || payment === void 0 ? void 0 : payment.type;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<{
4
3
  width?: string | number | undefined;
5
4
  height?: string | number | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -21,6 +21,6 @@ function WalletCell(_a) {
21
21
  return (_jsx(TableCell, Object.assign({ style: {
22
22
  textAlign: 'center',
23
23
  overflow: 'visible',
24
- } }, props, { children: _jsxs(WalletCellContainer, { children: [showCountry && country && (_jsx(Tooltip, Object.assign({ title: getCountryNameByISO(country) }, { children: _jsx(CountryFlag, { code: country }) }))), _jsxs(WalletWrapper, { children: [_jsx(WalletIcon, { src: walletIcon, alt: "wallet-icon" }), walletId && _jsxs(WalletIdContainer, { children: ["\u00B7\u00B7\u00B7\u00B7 ", walletId === null || walletId === void 0 ? void 0 : walletId.substring(((walletId === null || walletId === void 0 ? void 0 : walletId.length) || 0) - 4)] })] })] }) })));
24
+ } }, props, { children: _jsxs(WalletCellContainer, { children: [showCountry && country && (_jsx(Tooltip, Object.assign({ title: getCountryNameByISO(country) }, { children: _jsx(CountryFlag, { countryCode: country }) }))), _jsxs(WalletWrapper, { children: [_jsx(WalletIcon, { src: walletIcon, alt: "wallet-icon" }), walletId && _jsxs(WalletIdContainer, { children: ["\u00B7\u00B7\u00B7\u00B7 ", walletId === null || walletId === void 0 ? void 0 : walletId.substring(((walletId === null || walletId === void 0 ? void 0 : walletId.length) || 0) - 4)] })] })] }) })));
25
25
  }
26
26
  export default WalletCell;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const GeographyBox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
4
3
  variant?: "Global" | "Regional" | "Local" | undefined;
5
4
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { Currency, Vat } from '../../../types/index.js';
3
+ interface TotalVATProps {
4
+ totalGrossAmount: number;
5
+ totalVat: Vat;
6
+ selectedCurrency: Currency;
7
+ isDisabled: boolean;
8
+ onChangeTotalVat: (vat: Vat) => void;
9
+ }
10
+ declare function TotalVAT({ totalGrossAmount, totalVat, selectedCurrency, onChangeTotalVat, isDisabled }: Readonly<TotalVATProps>): import("react/jsx-runtime").JSX.Element;
11
+ declare const _default: import("react").MemoExoticComponent<typeof TotalVAT>;
12
+ export default _default;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo, useRef, useState } from 'react';
3
+ import Popper from '@mui/material/Popper';
4
+ import Box from '@mui/material/Box';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { CustomBackdrop, DisplayAmount } from '../../index.js';
7
+ import { actionsIcon, activeActionIcon, taxIcon } from '../../../constants/index.js';
8
+ import { Label, LabelWrapper } from './style';
9
+ import { getVatValue } from '../utils';
10
+ import VATDropdown from '../VATDropdown';
11
+ function TotalVAT({ totalGrossAmount, totalVat, selectedCurrency, onChangeTotalVat, isDisabled }) {
12
+ const [isOpen, setIsOpen] = useState(false);
13
+ const vatButtonRef = useRef();
14
+ const { t } = useTranslation();
15
+ const toggleDropdown = () => {
16
+ if (!isDisabled)
17
+ setIsOpen(!isOpen);
18
+ };
19
+ const modifyTotalVAT = (newVat) => {
20
+ onChangeTotalVat(Object.assign(Object.assign({}, newVat), { value: getVatValue(totalGrossAmount, newVat) }));
21
+ };
22
+ const getLabel = () => {
23
+ if (totalVat.percentage === 0)
24
+ return t('noVat');
25
+ if (!totalVat.isInclusive)
26
+ return _jsx(DisplayAmount, { selectedCurrency: selectedCurrency, amount: totalVat.value });
27
+ return (_jsxs(Box, Object.assign({ sx: { display: 'flex', gap: '4px' } }, { children: [_jsxs("span", { children: [t('inclusive'), " "] }), _jsx(DisplayAmount, { amount: totalVat.value, selectedCurrency: selectedCurrency })] })));
28
+ };
29
+ return (_jsxs(LabelWrapper, Object.assign({ isDisabled: isDisabled, isOpen: isOpen, onClick: toggleDropdown, ref: vatButtonRef, sx: Object.assign({}, (isDisabled && { pointerEvents: 'none', opacity: 0.7 })) }, { children: [_jsx("img", { src: taxIcon, alt: "p" }), _jsx(Label, Object.assign({ isDisabled: isDisabled }, { children: getLabel() })), _jsx(Box, { component: "img", src: isOpen ? activeActionIcon : actionsIcon, alt: "a" }), isOpen && _jsx(CustomBackdrop, { onClick: toggleDropdown }), _jsx(Popper, Object.assign({ open: Boolean(isOpen), anchorEl: vatButtonRef.current, placement: "bottom-start" }, { children: _jsx(VATDropdown, { setIsOpen: setIsOpen, vat: totalVat, setVat: modifyTotalVAT, sx: { position: 'absolute', top: 8, left: 0, display: isOpen ? 'block' : 'none' } }) }))] })));
30
+ }
31
+ export default memo(TotalVAT);
@@ -0,0 +1 @@
1
+ export { default } from './TotalVAT';
@@ -0,0 +1 @@
1
+ export { default } from './TotalVAT';
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ export declare const LabelWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").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").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
5
+ isDisabled?: boolean | undefined;
6
+ isOpen?: boolean | undefined;
7
+ }, {}, {}>;
8
+ export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
9
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
10
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
11
+ isDisabled: boolean;
12
+ }, {}, {}>;
@@ -0,0 +1,5 @@
1
+ import { Box, styled } from '@mui/material';
2
+ export const LabelWrapper = styled(Box, {
3
+ shouldForwardProp: (props) => props !== 'isDisabled' && props !== 'isOpen',
4
+ })(({ theme, isOpen, isDisabled }) => (Object.assign(Object.assign({ display: 'flex', gap: theme.spacing(1), alignItems: 'center', justifyContent: 'space-between', fontSize: '11px', border: `1px solid ${theme.palette.divider}`, height: 32, padding: theme.spacing(1), borderRadius: '4px' }, (isOpen && { borderColor: theme.palette.info.dark, position: 'relative' })), (isDisabled ? { color: theme.palette.grey[700], cursor: 'not-allowed' } : { cursor: 'pointer' }))));
5
+ export const Label = styled(Box, { shouldForwardProp: (props) => props !== 'isDisabled' })(({ theme, isDisabled }) => (Object.assign({ fontSize: '11px', fontWeight: 600, color: theme.palette.text.primary }, (isDisabled && { color: theme.palette.grey[700] }))));
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { BoxProps } from '@mui/material/Box';
3
+ import { Vat } from '../../../types/index.js';
4
+ interface VATDropdownProps extends BoxProps {
5
+ vat: Vat;
6
+ setVat: (vat: Vat) => void;
7
+ setIsOpen: (value: boolean) => void;
8
+ }
9
+ declare function VATDropdown({ setVat, vat, setIsOpen: setIsDropdownOpen, ...props }: Readonly<VATDropdownProps>): import("react/jsx-runtime").JSX.Element;
10
+ declare const _default: import("react").MemoExoticComponent<typeof VATDropdown>;
11
+ export default _default;
@@ -0,0 +1,34 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { memo, useState } from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { rightArrow } from '../../../constants/index.js';
16
+ import { Menu } from '../../index.js';
17
+ import { Wrapper, Option } from './style';
18
+ import VATRateDropdown from '../VATRateDropdown';
19
+ function VATDropdown(_a) {
20
+ var { setVat, vat, setIsOpen: setIsDropdownOpen } = _a, props = __rest(_a, ["setVat", "vat", "setIsOpen"]);
21
+ const [anchorEl, setAnchorEl] = useState(null);
22
+ const open = Boolean(anchorEl);
23
+ const { t } = useTranslation();
24
+ const toggleDropdown = (e) => {
25
+ e.stopPropagation();
26
+ if (open) {
27
+ setAnchorEl(null);
28
+ return;
29
+ }
30
+ setAnchorEl(e.currentTarget);
31
+ };
32
+ return (_jsx(Wrapper, Object.assign({ sx: props.sx }, { children: _jsxs(Option, Object.assign({ sx: (theme) => (Object.assign({}, (open && { boxShadow: theme.shadows[3] }))), className: "option", onClick: toggleDropdown }, { children: [_jsx("span", { children: t('rate') }), _jsx("img", { src: rightArrow, alt: "a" }), _jsx(Menu, Object.assign({ anchorEl: anchorEl, open: open, placement: "right-start" }, { children: _jsx(VATRateDropdown, { onChange: setVat, vat: vat, setIsDropdownOpen: setIsDropdownOpen }) }))] })) })));
33
+ }
34
+ export default memo(VATDropdown);
@@ -0,0 +1 @@
1
+ export { default } from './VATDropdown';
@@ -0,0 +1 @@
1
+ export { default } from './VATDropdown';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const Wrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").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").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
5
+ export declare const Option: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
6
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
7
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,32 @@
1
+ import { Box, styled } from '@mui/material';
2
+ export const Wrapper = styled(Box)(({ theme }) => ({
3
+ width: 112,
4
+ boxShadow: theme.shadows[16],
5
+ borderRadius: 4,
6
+ backgroundColor: theme.palette.common.white,
7
+ '.option + .option': {
8
+ borderTop: `1px solid ${theme.palette.divider}`,
9
+ },
10
+ zIndex: 3,
11
+ }));
12
+ export const Option = styled(Box)(({ theme }) => ({
13
+ fontSize: '11px',
14
+ paddingInlineStart: theme.spacing(2),
15
+ paddingInlineEnd: theme.spacing(1),
16
+ paddingTop: theme.spacing(1.5),
17
+ paddingBottom: theme.spacing(1.5),
18
+ display: 'flex',
19
+ justifyContent: 'space-between',
20
+ alignItems: 'center',
21
+ gap: theme.spacing(1),
22
+ cursor: 'pointer',
23
+ height: 40,
24
+ input: {
25
+ height: 24,
26
+ width: 47,
27
+ textAlign: 'right',
28
+ },
29
+ '&:hover': {
30
+ boxShadow: theme.shadows[3],
31
+ },
32
+ }));
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { Vat } from '../../../types/index.js';
3
+ interface VATRateDropdownProps {
4
+ vat: Vat;
5
+ onChange: (value: Vat) => void;
6
+ setIsDropdownOpen: (value: boolean) => void;
7
+ }
8
+ declare function VATRateDropdown({ vat, onChange, setIsDropdownOpen }: Readonly<VATRateDropdownProps>): import("react/jsx-runtime").JSX.Element;
9
+ declare const _default: import("react").MemoExoticComponent<typeof VATRateDropdown>;
10
+ export default _default;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Input } from '../../index.js';
5
+ import { checkIcon, RATES } from '../../../constants/index.js';
6
+ import { removeAllCharsFromNumber } from '../../../utils/index.js';
7
+ import { Wrapper, Option } from './style';
8
+ function VATRateDropdown({ vat, onChange, setIsDropdownOpen }) {
9
+ const { t } = useTranslation();
10
+ const { percentage, isInclusive, value } = vat;
11
+ const isNoVAT = percentage === RATES.ZERO;
12
+ const isFivePercent = percentage === RATES.FIVE;
13
+ const isTenPercent = percentage === RATES.TEN;
14
+ const isFifteenPercent = percentage === RATES.FIFTEEN;
15
+ const isCustomPercent = percentage !== RATES.FIVE && percentage !== RATES.TEN && percentage !== RATES.FIFTEEN && percentage !== RATES.ZERO;
16
+ const vatRates = [
17
+ { label: t('noVat'), value: RATES.ZERO, selected: isNoVAT },
18
+ { label: '5%', value: RATES.FIVE, selected: isFivePercent },
19
+ { label: '10%', value: RATES.TEN, selected: isTenPercent },
20
+ { label: '15%', value: RATES.FIFTEEN, selected: isFifteenPercent },
21
+ ];
22
+ const selectRate = (percentageValue) => {
23
+ onChange({ value, percentage: percentageValue, isInclusive });
24
+ };
25
+ const handleCustomRate = (e) => {
26
+ if (Number(e.target.value) > 100)
27
+ return;
28
+ selectRate(Number(removeAllCharsFromNumber(e.target.value)));
29
+ };
30
+ const renderSelectedIcon = (selected) => {
31
+ return selected ? _jsx("img", { src: checkIcon, alt: "check" }) : _jsx("span", {});
32
+ };
33
+ return (_jsxs(Wrapper, { children: [vatRates.map((rate, index) => (_jsxs(Option, Object.assign({ className: "option", onClick: () => {
34
+ selectRate(rate.value);
35
+ setIsDropdownOpen(false);
36
+ } }, { children: [renderSelectedIcon(rate.selected), _jsx("span", { children: rate.label })] }), `${rate.value}-${index}`))), _jsxs(Option, Object.assign({ className: "option" }, { children: [renderSelectedIcon(isCustomPercent), _jsx(Input, { placeholder: "%", value: isCustomPercent ? String(percentage) : '', onChange: handleCustomRate, sx: { justifyContent: 'flex-end' } })] }))] }));
37
+ }
38
+ export default memo(VATRateDropdown);
@@ -0,0 +1 @@
1
+ export { default } from './VATRateDropdown';
@@ -0,0 +1 @@
1
+ export { default } from './VATRateDropdown';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const Wrapper: 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 Option: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
6
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
7
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -0,0 +1,30 @@
1
+ import Box from '@mui/material/Box';
2
+ import { styled } from '@mui/material/styles';
3
+ export const Wrapper = styled(Box)(({ theme }) => ({
4
+ width: 112,
5
+ '.option + .option': {
6
+ borderTop: `1px solid ${theme.palette.divider}`,
7
+ },
8
+ zIndex: 3,
9
+ }));
10
+ export const Option = styled(Box)(({ theme }) => ({
11
+ fontSize: '11px',
12
+ paddingInlineStart: theme.spacing(2),
13
+ paddingInlineEnd: theme.spacing(1),
14
+ paddingTop: theme.spacing(1.5),
15
+ paddingBottom: theme.spacing(1.5),
16
+ display: 'flex',
17
+ justifyContent: 'space-between',
18
+ alignItems: 'center',
19
+ gap: theme.spacing(1),
20
+ cursor: 'pointer',
21
+ height: 40,
22
+ input: {
23
+ height: 24,
24
+ width: 47,
25
+ textAlign: 'right',
26
+ },
27
+ '&:hover': {
28
+ boxShadow: theme.shadows[3],
29
+ },
30
+ }));
@@ -0,0 +1,4 @@
1
+ export * from './utils';
2
+ export { default as TotalVAT } from './TotalVAT';
3
+ export { default as VATDropdown } from './VATDropdown';
4
+ export { default as VATRateDropdown } from './VATRateDropdown';
@@ -0,0 +1,4 @@
1
+ export * from './utils';
2
+ export { default as TotalVAT } from './TotalVAT';
3
+ export { default as VATDropdown } from './VATDropdown';
4
+ export { default as VATRateDropdown } from './VATRateDropdown';
@@ -0,0 +1,7 @@
1
+ import { Vat } from '../../types/index.js';
2
+ export declare const getVatValue: (amount: number, vat: Vat) => number;
3
+ export declare const getItemVat: (vat: Vat, itemPrice: number, quantity: number) => {
4
+ value: number;
5
+ percentage: number;
6
+ isInclusive: boolean;
7
+ };
@@ -0,0 +1,8 @@
1
+ export const getVatValue = (amount, vat) => {
2
+ let newVatValue = 0;
3
+ if (vat.percentage > 0) {
4
+ newVatValue = amount * (vat.percentage / 100);
5
+ }
6
+ return newVatValue;
7
+ };
8
+ export const getItemVat = (vat, itemPrice, quantity) => (Object.assign(Object.assign({}, vat), { value: getVatValue(Number(itemPrice), vat) * quantity }));
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  interface TableWrapperProps {
4
3
  showNoDataView?: boolean;
5
4
  }
@@ -74,7 +74,7 @@ export * from './ErrorBoundary';
74
74
  export { default as DropdownButton, type DropdownButtonProps, DropdownChevronIcon, type DropdownChevronIconProps } from './DropdownButton';
75
75
  export { default as Dropdown2 } from './Dropdown2';
76
76
  export { default as CountryFlag } from './CountryFlag';
77
- export { default as CurrencyIcon } from './CurrencyIcon';
77
+ export { default as CurrencySymbol } from './CurrencySymbol';
78
78
  export { default as CustomBackdrop } from './CustomBackdrop';
79
79
  export { default as DeviceIcon, isDeviceIconShown } from './DeviceIcon';
80
80
  export { default as CountBadge, BadgeVariants, CountAnimatedBadge, type StyledBadgeProps, paymentSourceAnimation } from './CountBadge';
@@ -122,4 +122,4 @@ export * from './ListLayout';
122
122
  export { default as MFWidgetLoader } from './MFWidgetLoader';
123
123
  export { default as BetaBanner } from './BetaBanner';
124
124
  export * from './Autocomplete';
125
- export { default as CurrencyCountryFlag } from './CurrencyCountryFlag';
125
+ export * from './VAT';
@@ -74,7 +74,7 @@ export * from './ErrorBoundary';
74
74
  export { default as DropdownButton, DropdownChevronIcon } from './DropdownButton';
75
75
  export { default as Dropdown2 } from './Dropdown2';
76
76
  export { default as CountryFlag } from './CountryFlag';
77
- export { default as CurrencyIcon } from './CurrencyIcon';
77
+ export { default as CurrencySymbol } from './CurrencySymbol';
78
78
  export { default as CustomBackdrop } from './CustomBackdrop';
79
79
  export { default as DeviceIcon, isDeviceIconShown } from './DeviceIcon';
80
80
  export { default as CountBadge, BadgeVariants, CountAnimatedBadge, paymentSourceAnimation } from './CountBadge';
@@ -122,4 +122,4 @@ export * from './ListLayout';
122
122
  export { default as MFWidgetLoader } from './MFWidgetLoader';
123
123
  export { default as BetaBanner } from './BetaBanner';
124
124
  export * from './Autocomplete';
125
- export { default as CurrencyCountryFlag } from './CurrencyCountryFlag';
125
+ export * from './VAT';
@@ -13,3 +13,4 @@ export * from './toggleOptions';
13
13
  export * from './payment';
14
14
  export * from './segment';
15
15
  export * from './chips';
16
+ export * from './rate';
@@ -13,3 +13,4 @@ export * from './toggleOptions';
13
13
  export * from './payment';
14
14
  export * from './segment';
15
15
  export * from './chips';
16
+ export * from './rate';
@@ -0,0 +1,6 @@
1
+ export declare const RATES: {
2
+ ZERO: number;
3
+ FIVE: number;
4
+ TEN: number;
5
+ FIFTEEN: number;
6
+ };
@@ -0,0 +1,6 @@
1
+ export const RATES = {
2
+ ZERO: 0,
3
+ FIVE: 5,
4
+ TEN: 10,
5
+ FIFTEEN: 15,
6
+ };
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.245",
5
- "testVersion": 0,
4
+ "version": "0.1.246-test.2",
5
+ "testVersion": 2,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -163,4 +163,4 @@
163
163
  "publishConfig": {
164
164
  "registry": "https://registry.npmjs.org/"
165
165
  }
166
- }
166
+ }
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { BoxProps } from '@mui/material/Box';
3
- interface CurrencyCountryFlagProps extends BoxProps {
4
- code?: string;
5
- }
6
- declare function CurrencyCountryFlag({ code, ...props }: CurrencyCountryFlagProps): import("react/jsx-runtime").JSX.Element;
7
- declare const _default: import("react").MemoExoticComponent<typeof CurrencyCountryFlag>;
8
- export default _default;
@@ -1,22 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { memo } from 'react';
14
- import Box from '@mui/material/Box';
15
- import { defaultCountryIcon, getCurrenciesIcon } from '../../constants/index.js';
16
- function CurrencyCountryFlag(_a) {
17
- var { code = '' } = _a, props = __rest(_a, ["code"]);
18
- return (_jsx(Box, Object.assign({}, props, { component: "img", src: getCurrenciesIcon(code) || defaultCountryIcon, alt: code, loading: "lazy", onError: (e) => {
19
- e.currentTarget.src = defaultCountryIcon;
20
- } })));
21
- }
22
- export default memo(CurrencyCountryFlag);
@@ -1,2 +0,0 @@
1
- import CurrencyCountryFlag from './CurrencyCountryFlag';
2
- export default CurrencyCountryFlag;
@@ -1,2 +0,0 @@
1
- import CurrencyCountryFlag from './CurrencyCountryFlag';
2
- export default CurrencyCountryFlag;
@@ -1,15 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { DirhamIconImage, SARIconImage } from '../../constants/index.js';
3
- import { StyleCurrencyIcon } from './style';
4
- const currencyMap = {
5
- SAR: SARIconImage,
6
- AED: DirhamIconImage,
7
- };
8
- function CurrencyIcon({ currency, fontSize }) {
9
- const currencyIcon = currencyMap[currency];
10
- if (!currencyIcon) {
11
- return _jsx(_Fragment, { children: currency });
12
- }
13
- return _jsx(StyleCurrencyIcon, { component: "img", src: currencyIcon, alt: currency, sx: { height: fontSize } });
14
- }
15
- export default CurrencyIcon;
@@ -1,2 +0,0 @@
1
- import CurrencyIcon from './CurrencyIcon';
2
- export default CurrencyIcon;
@@ -1,2 +0,0 @@
1
- import CurrencyIcon from './CurrencyIcon';
2
- export default CurrencyIcon;