@tap-payments/os-micro-frontend-shared 0.1.139-test.26 → 0.1.139-test.51

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 (40) hide show
  1. package/build/components/TableCells/CustomCells/AmountCell/AmountCell.d.ts +2 -2
  2. package/build/components/TableCells/CustomCells/AmountCell/AmountCell.js +19 -7
  3. package/build/components/TableCells/CustomCells/AmountCell/{components/AmountConversionTooltipLabel.js → AmountConversionTooltipLabel.js} +3 -3
  4. package/build/components/TableCells/CustomCells/AmountCell/index.d.ts +1 -3
  5. package/build/components/TableCells/CustomCells/AmountCell/index.js +1 -3
  6. package/build/components/TableCells/CustomCells/CustomerCell/CustomerCell.d.ts +2 -2
  7. package/build/components/TableCells/CustomCells/CustomerCell/CustomerCell.js +5 -2
  8. package/build/components/TableCells/CustomCells/CustomerCell/index.d.ts +0 -1
  9. package/build/components/TableCells/CustomCells/CustomerCell/index.js +0 -1
  10. package/build/components/TableCells/CustomCells/CustomerCell/type.d.ts +0 -15
  11. package/build/components/TableCells/CustomCells/StatusCell/StatusCell.d.ts +4 -1
  12. package/build/components/TableCells/CustomCells/StatusCell/StatusCell.js +10 -5
  13. package/build/components/TableCells/CustomCells/StatusCell/index.d.ts +0 -2
  14. package/build/components/TableCells/CustomCells/StatusCell/index.js +0 -2
  15. package/build/components/TableCells/CustomCells/StatusCell/type.d.ts +4 -2
  16. package/build/components/TableCells/CustomCells/StatusCell/utils.d.ts +1 -2
  17. package/build/components/TableCells/CustomCells/StatusCell/utils.js +1 -2
  18. package/build/components/TableCells/CustomCells/type.d.ts +32 -1
  19. package/package.json +2 -2
  20. package/build/components/TableCells/CustomCells/AmountCell/AmountCellSheet.d.ts +0 -3
  21. package/build/components/TableCells/CustomCells/AmountCell/AmountCellSheet.js +0 -10
  22. package/build/components/TableCells/CustomCells/AmountCell/AmountCellText.d.ts +0 -3
  23. package/build/components/TableCells/CustomCells/AmountCell/AmountCellText.js +0 -23
  24. package/build/components/TableCells/CustomCells/AmountCell/components/ConversionTypeLabel.d.ts +0 -7
  25. package/build/components/TableCells/CustomCells/AmountCell/components/ConversionTypeLabel.js +0 -7
  26. package/build/components/TableCells/CustomCells/AmountCell/components/CurrencyInfo.d.ts +0 -7
  27. package/build/components/TableCells/CustomCells/AmountCell/components/CurrencyInfo.js +0 -8
  28. package/build/components/TableCells/CustomCells/AmountCell/components/index.d.ts +0 -3
  29. package/build/components/TableCells/CustomCells/AmountCell/components/index.js +0 -3
  30. package/build/components/TableCells/CustomCells/AmountCell/type.d.ts +0 -22
  31. package/build/components/TableCells/CustomCells/AmountCell/type.js +0 -1
  32. package/build/components/TableCells/CustomCells/CustomerCell/CustomerCellSheet.d.ts +0 -3
  33. package/build/components/TableCells/CustomCells/CustomerCell/CustomerCellSheet.js +0 -8
  34. package/build/components/TableCells/CustomCells/StatusCell/StatusCellSheet.d.ts +0 -4
  35. package/build/components/TableCells/CustomCells/StatusCell/StatusCellSheet.js +0 -21
  36. package/build/components/TableCells/CustomCells/StatusCell/StatusCellText.d.ts +0 -6
  37. package/build/components/TableCells/CustomCells/StatusCell/StatusCellText.js +0 -42
  38. package/build/components/TableCells/CustomCells/StatusCell/useStatusCell.d.ts +0 -6
  39. package/build/components/TableCells/CustomCells/StatusCell/useStatusCell.js +0 -8
  40. /package/build/components/TableCells/CustomCells/AmountCell/{components/AmountConversionTooltipLabel.d.ts → AmountConversionTooltipLabel.d.ts} +0 -0
@@ -1,3 +1,3 @@
1
- import { AmountCellProps } from './type';
2
- declare function AmountCell({ conversionType, amount, currency, tooltipLabel, amountTooltipLabel, ...props }: AmountCellProps): import("react/jsx-runtime").JSX.Element;
1
+ import { AmountCellProps } from '../type';
2
+ declare function AmountCell({ conversionType, amount, currency, tooltipLabel, amountTooltipLabel, isTextShown, tableMode, selectionProps, chipIndex, ...props }: AmountCellProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default AmountCell;
@@ -9,18 +9,30 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useMemo } from 'react';
13
14
  import { TableCell } from '../../../TableCells';
14
15
  import Tooltip from '../../../Tooltip';
15
- import { CurrencyIcon } from '../../../index.js';
16
+ import { CurrencyIcon, StatusChipWithCopy } from '../../../index.js';
16
17
  import { getCurrenciesIcon } from '../../../../constants/index.js';
17
- import { AmountCellContainer, FlagContainer } from './style';
18
+ import { formatAmountWithCurrency } from '../../../../utils/index.js';
19
+ import { AmountCellContainer, ConversionBadge, CurrencySpan, DecimalSpan, FlagContainer } from './style';
18
20
  import { FlagIcon } from '../style';
19
- import { ConversionTypeLabel, CurrencyInfo } from './components';
20
- const tableMode = 'default';
21
21
  function AmountCell(_a) {
22
- var { conversionType, amount, currency, tooltipLabel, amountTooltipLabel } = _a, props = __rest(_a, ["conversionType", "amount", "currency", "tooltipLabel", "amountTooltipLabel"]);
22
+ var { conversionType, amount, currency, tooltipLabel, amountTooltipLabel, isTextShown, tableMode, selectionProps = {}, chipIndex = 0 } = _a, props = __rest(_a, ["conversionType", "amount", "currency", "tooltipLabel", "amountTooltipLabel", "isTextShown", "tableMode", "selectionProps", "chipIndex"]);
23
23
  const icon = currency && _jsx(FlagIcon, { src: getCurrenciesIcon(currency), alt: "customer icon" });
24
- return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(AmountCellContainer, { children: [_jsx(Tooltip, Object.assign({ title: tooltipLabel || '' }, { children: _jsx(ConversionTypeLabel, { tableMode: tableMode, conversionType: conversionType }) })), _jsx(Tooltip, Object.assign({ title: _jsx(CurrencyIcon, { currency: currency }) }, { children: _jsx(FlagContainer, { children: icon }) })), _jsx(Tooltip, Object.assign({ title: amountTooltipLabel }, { children: _jsx(CurrencyInfo, { tableMode: tableMode, amount: amount, currency: currency }) }))] }) })));
24
+ const { integerAmount, decimalAmount } = formatAmountWithCurrency(amount, currency);
25
+ const conversionTypeLabel = useMemo(() => {
26
+ if (!conversionType)
27
+ return _jsx(_Fragment, {});
28
+ return (_jsx(ConversionBadge, Object.assign({ tableMode: tableMode, className: "conversion-type" }, { children: conversionType })));
29
+ }, [conversionType, tableMode]);
30
+ const currencyInfo = useMemo(() => {
31
+ return (_jsx(CurrencySpan, Object.assign({ tableMode: tableMode }, { children: amount !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { children: _jsx(CurrencyIcon, { currency: currency, fontSize: 10 }) }), ' ', integerAmount, decimalAmount && (_jsxs(_Fragment, { children: [".", _jsx(DecimalSpan, { children: decimalAmount })] }))] })) : (_jsx("span", { children: "-" })) })));
32
+ }, [amount, tableMode, currency, integerAmount, decimalAmount]);
33
+ if (tableMode === 'sheet') {
34
+ return (_jsxs(StatusChipWithCopy, Object.assign({ chipIndex: chipIndex, copyText: amount ? `${integerAmount}.${decimalAmount}` : '-', selectionProps: selectionProps }, { children: [conversionTypeLabel, currencyInfo] })));
35
+ }
36
+ return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(AmountCellContainer, { children: [_jsx(Tooltip, Object.assign({ title: tooltipLabel || '' }, { children: conversionTypeLabel })), _jsx(Tooltip, Object.assign({ title: _jsx(CurrencyIcon, { currency: currency }) }, { children: isTextShown ? _jsx("span", {}) : _jsx(FlagContainer, { children: icon }) })), _jsx(Tooltip, Object.assign({ title: amountTooltipLabel }, { children: currencyInfo }))] }) })));
25
37
  }
26
38
  export default AmountCell;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { conversionTypesLabels, formatAmountWithCurrency } from '../../../../../utils/index.js';
3
- import { CurrencyIcon } from '../../../../index.js';
4
- import { ConversionTooltip, ConversionTooltipRow } from '../style';
2
+ import { conversionTypesLabels, formatAmountWithCurrency } from '../../../../utils/index.js';
3
+ import { CurrencyIcon } from '../../../index.js';
4
+ import { ConversionTooltip, ConversionTooltipRow } from './style';
5
5
  export const AmountConversionTooltipLabel = ({ type, selectAmount, selectCurrency, requestAmount, requestCurrency, merchantAmount, merchantCurrency, }) => {
6
6
  const customerSelectValue = formatAmountWithCurrency(selectAmount, selectCurrency);
7
7
  const chargeValue = formatAmountWithCurrency(requestAmount, requestCurrency);
@@ -1,5 +1,3 @@
1
1
  export { default as AmountCell } from './AmountCell';
2
- export { AmountConversionTooltipLabel } from './components';
3
- export { default as AmountCellText } from './AmountCellText';
4
- export { default as AmountCellSheet } from './AmountCellSheet';
2
+ export { AmountConversionTooltipLabel } from './AmountConversionTooltipLabel';
5
3
  export * from './style';
@@ -1,5 +1,3 @@
1
1
  export { default as AmountCell } from './AmountCell';
2
- export { AmountConversionTooltipLabel } from './components';
3
- export { default as AmountCellText } from './AmountCellText';
4
- export { default as AmountCellSheet } from './AmountCellSheet';
2
+ export { AmountConversionTooltipLabel } from './AmountConversionTooltipLabel';
5
3
  export * from './style';
@@ -1,3 +1,3 @@
1
- import type { CustomerCellProps } from './type';
2
- declare function CustomerCell({ customerInitiated, children, isTimezoneIconShown, hasCustomerIcon, customerIcon, customerName, hideCustomerInitiatedIcon, hideTimezoneIcon, phone, email, id, ...props }: Readonly<CustomerCellProps>): import("react/jsx-runtime").JSX.Element;
1
+ import type { CustomerCellProps } from '../type';
2
+ declare function CustomerCell({ customerInitiated, children, isTimezoneIconShown, hasCustomerIcon, customerIcon, customerName, hideCustomerInitiatedIcon, hideTimezoneIcon, phone, email, id, tableMode, ...props }: Readonly<CustomerCellProps>): import("react/jsx-runtime").JSX.Element;
3
3
  export default CustomerCell;
@@ -15,12 +15,12 @@ import { useTranslation } from 'react-i18next';
15
15
  import Tooltip from '../../../Tooltip';
16
16
  import { merchantInitiatedIcon, timezoneIcon } from '../../../../constants/index.js';
17
17
  import { getRandomGradientColor, isArabic } from '../../../../utils/index.js';
18
- import { TableCell } from '../../../TableCells';
19
18
  import { StyledCustomerCell, StyledCustomerIcon, StyledCustomerIconContainer, StyledCustomerName } from './style';
19
+ import { TableCell } from '../../../TableCells';
20
20
  import { AvatarStyled, StarBadgeWrapper } from '../style';
21
21
  function CustomerCell(_a) {
22
22
  var _b;
23
- var { customerInitiated, children, isTimezoneIconShown, hasCustomerIcon, customerIcon, customerName, hideCustomerInitiatedIcon, hideTimezoneIcon, phone, email, id } = _a, props = __rest(_a, ["customerInitiated", "children", "isTimezoneIconShown", "hasCustomerIcon", "customerIcon", "customerName", "hideCustomerInitiatedIcon", "hideTimezoneIcon", "phone", "email", "id"]);
23
+ var { customerInitiated, children, isTimezoneIconShown, hasCustomerIcon, customerIcon, customerName, hideCustomerInitiatedIcon, hideTimezoneIcon, phone, email, id, tableMode } = _a, props = __rest(_a, ["customerInitiated", "children", "isTimezoneIconShown", "hasCustomerIcon", "customerIcon", "customerName", "hideCustomerInitiatedIcon", "hideTimezoneIcon", "phone", "email", "id", "tableMode"]);
24
24
  const { t } = useTranslation();
25
25
  const customerInitiatedTooltip = customerInitiated === false ? t('merchantInitiated') : '';
26
26
  const isArabicCustomerName = isArabic(customerName);
@@ -38,6 +38,9 @@ function CustomerCell(_a) {
38
38
  return null;
39
39
  return (_jsx("div", Object.assign({ "data-testid": "CustomerCell_customerTooltip" }, { children: tooltipOptions.map(({ name, value }) => value && (_jsx("div", Object.assign({ "data-testid": `CustomerCell_customerTooltip_${name}` }, { children: name === 'Name' ? value : `${name}: ${value}` }), value))) })));
40
40
  }, [tooltipOptions]);
41
+ if (tableMode === 'sheet') {
42
+ return (_jsx(StyledCustomerName, Object.assign({ tableMode: tableMode, "data-testid": "CustomerCell_StyledCustomerName", "data-is-arabic": isArabicCustomerName }, { children: children })));
43
+ }
41
44
  return (_jsx(TableCell, Object.assign({}, props, { "data-testid": "CustomerCell_TableCell" }, { children: _jsxs(StyledCustomerCell, Object.assign({ "data-testid": "CustomerCell_StyledCustomerCell" }, { children: [customerShownIcon, _jsx(Tooltip, Object.assign({ title: customerTooltip }, { children: _jsx(StyledCustomerName, Object.assign({ "data-testid": "CustomerCell_StyledCustomerName", "data-is-arabic": isArabicCustomerName }, { children: children })) })), !hideTimezoneIcon && (_jsx(StyledCustomerIconContainer, Object.assign({ "data-testid": "CustomerCell_StyledCustomerIconContainer" }, { children: isTimezoneIconShown && _jsx(StyledCustomerIcon, { src: timezoneIcon, "data-testid": "CustomerCell_StyledCustomerIcon" }) }))), !hideCustomerInitiatedIcon && (_jsx(Tooltip, Object.assign({ title: customerInitiatedTooltip }, { children: _jsx(StarBadgeWrapper, Object.assign({ "data-testid": "CustomerCell_StarBadgeWrapper", className: "geography-box", isShown: !!customerInitiatedTooltip }, { children: customerInitiatedTooltip && (_jsx("img", { "data-testid": "CustomerCell_merchantInitiatedIcon", src: merchantInitiatedIcon, alt: "merchant", style: {
42
45
  width: '16px',
43
46
  height: '16px',
@@ -1,3 +1,2 @@
1
1
  export { default as CustomerCell } from './CustomerCell';
2
- export { default as CustomerCellSheet } from './CustomerCellSheet';
3
2
  export * from './type';
@@ -1,3 +1,2 @@
1
1
  export { default as CustomerCell } from './CustomerCell';
2
- export { default as CustomerCellSheet } from './CustomerCellSheet';
3
2
  export * from './type';
@@ -1,19 +1,4 @@
1
- import type { TableCellProps } from '@mui/material';
2
1
  export type TooltipOption = {
3
2
  name: string;
4
3
  value?: string;
5
4
  };
6
- export interface CustomerCellProps extends TableCellProps {
7
- customerInitiated?: boolean;
8
- flagIcon?: string;
9
- isTimezoneIconShown?: boolean;
10
- hasCustomerIcon?: boolean;
11
- customerIcon?: string;
12
- customerName: string;
13
- hideCustomerInitiatedIcon?: boolean;
14
- hideTimezoneIcon?: boolean;
15
- email?: string;
16
- phone?: string;
17
- id?: string;
18
- }
19
- export type CustomerCellSheetProps = Pick<CustomerCellProps, 'customerName' | 'children'>;
@@ -1,3 +1,6 @@
1
1
  import type { StatusCellProps } from './type';
2
- declare function StatusCell({ statuses, centerIconKey, ...props }: StatusCellProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function StatusCell({ statuses, isTextShown, centerIconKey, xGap, tableMode, ...props }: Readonly<StatusCellProps & {
3
+ isChargesService?: boolean;
4
+ isAuthorizationsService?: boolean;
5
+ }>): import("react/jsx-runtime").JSX.Element;
3
6
  export default StatusCell;
@@ -12,11 +12,16 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { TableCell } from '../../../TableCells';
14
14
  import { StatusIcon, StatusContainer, StatusWrapper } from './style';
15
- import { useStatusCell } from './useStatusCell';
15
+ import { getStatusesFilteredObject } from './utils';
16
16
  function StatusCell(_a) {
17
- var { statuses, centerIconKey } = _a, props = __rest(_a, ["statuses", "centerIconKey"]);
18
- const { centerIconIndex, statusesList } = useStatusCell({ statuses, centerIconKey });
19
- const xGapValue = 40;
17
+ var { statuses, isTextShown, centerIconKey, xGap, tableMode } = _a, props = __rest(_a, ["statuses", "isTextShown", "centerIconKey", "xGap", "tableMode"]);
18
+ const statusesFilteredObject = statuses ? getStatusesFilteredObject(statuses) : {};
19
+ const statusesList = Object.values(statusesFilteredObject).filter(Boolean);
20
+ if (tableMode === 'sheet') {
21
+ return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StatusContainer, Object.assign({ sx: { paddingRight: '30px' } }, { children: statusesList.map((status) => status) })) })));
22
+ }
23
+ const xGapValue = isTextShown ? xGap || 120 : 40;
24
+ const centerIconIndex = centerIconKey ? Object.entries(statusesFilteredObject).findIndex(([key]) => key === centerIconKey) : 0;
20
25
  return (_jsx(TableCell, Object.assign({}, props, { "data-testid": "StatusCell", sx: {
21
26
  position: 'relative',
22
27
  overflow: 'visible',
@@ -36,7 +41,7 @@ function StatusCell(_a) {
36
41
  x: xHoverPosition,
37
42
  zIndex: 100 - Math.abs(centerIconIndex - index),
38
43
  },
39
- }, transition: { duration: 0.3, type: 'tween', ease: 'easeOut' }, statusesCount: statusesList.length || 0 }, { children: _jsx(StatusIcon, { children: status }) }), index));
44
+ }, transition: { duration: 0.3, type: 'tween', ease: 'easeOut' }, statusesCount: statusesList.length || 0 }, { children: _jsx(StatusIcon, Object.assign({ isTextShown: isTextShown }, { children: status })) }), index));
40
45
  }) })) })));
41
46
  }
42
47
  export default StatusCell;
@@ -1,4 +1,2 @@
1
1
  export { default as StatusCell } from './StatusCell';
2
- export { default as StatusCellSheet } from './StatusCellSheet';
3
- export { default as StatusCellText } from './StatusCellText';
4
2
  export * from './type';
@@ -1,4 +1,2 @@
1
1
  export { default as StatusCell } from './StatusCell';
2
- export { default as StatusCellSheet } from './StatusCellSheet';
3
- export { default as StatusCellText } from './StatusCellText';
4
2
  export * from './type';
@@ -4,8 +4,10 @@ import { authorizedStatusIcons, payoutStatusIcons, refundStatusIcons } from './c
4
4
  export type RefundStatusType = keyof typeof refundStatusIcons;
5
5
  export type PayoutStatusType = keyof typeof payoutStatusIcons;
6
6
  export type AuthorizedStatusType = keyof typeof authorizedStatusIcons;
7
- export type Statuses = Record<string, React.ReactNode | undefined | null>;
8
7
  export interface StatusCellProps extends TableCellProps {
9
- statuses: Statuses;
8
+ statuses: Record<string, React.ReactNode>;
9
+ isTextShown?: boolean;
10
10
  centerIconKey?: string;
11
+ xGap?: number;
12
+ tableMode?: 'default' | 'text' | 'sheet';
11
13
  }
@@ -1,3 +1,2 @@
1
1
  /// <reference types="react" />
2
- import { Statuses } from './type';
3
- export declare const getStatusesFilteredObject: (statuses: Statuses) => Record<string, import("react").ReactNode>;
2
+ export declare const getStatusesFilteredObject: (statuses: Record<string, React.ReactNode | undefined | null>) => Record<string, import("react").ReactNode>;
@@ -1,9 +1,8 @@
1
1
  export const getStatusesFilteredObject = (statuses) => {
2
- const filteredList = Object.keys(statuses)
2
+ return Object.keys(statuses)
3
3
  .filter((key) => statuses[key])
4
4
  .reduce((acc, key) => {
5
5
  acc[key] = statuses[key];
6
6
  return acc;
7
7
  }, {});
8
- return statuses ? filteredList : {};
9
8
  };
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
2
  import type { TableCellProps } from '@mui/material';
3
3
  import type { Charge, SelectionProps, TableMode } from '../../../types/index.js';
4
- import { getGeographyBoxColor } from '../../../utils/index.js';
5
4
  import type { ActionType, FlagType } from './ActionCell';
5
+ import { getGeographyBoxColor } from '../../../utils/index.js';
6
6
  export type GeographyBoxVariant = keyof ReturnType<typeof getGeographyBoxColor>;
7
7
  export type PaymentMethod = 'VISA' | 'card' | 'MASTERCARD' | 'APPLE_PAY' | 'KNET' | 'MADA';
8
8
  export interface DateCellProps extends TableCellProps {
@@ -22,6 +22,20 @@ export interface OrderCellProps extends TableCellProps {
22
22
  }>;
23
23
  tableMode?: TableMode;
24
24
  }
25
+ export interface CustomerCellProps extends TableCellProps {
26
+ customerInitiated?: boolean;
27
+ flagIcon?: string;
28
+ isTimezoneIconShown?: boolean;
29
+ hasCustomerIcon?: boolean;
30
+ customerIcon?: string;
31
+ customerName: string;
32
+ hideCustomerInitiatedIcon?: boolean;
33
+ hideTimezoneIcon?: boolean;
34
+ email?: string;
35
+ phone?: string;
36
+ id?: string;
37
+ tableMode?: TableMode;
38
+ }
25
39
  export interface SourceCellProps extends TableCellProps {
26
40
  geographyVariant?: 'G' | 'L' | 'R';
27
41
  flagIcon?: string;
@@ -33,6 +47,23 @@ export interface SourceCellProps extends TableCellProps {
33
47
  showGeographyBox?: boolean;
34
48
  customerInitiated?: boolean;
35
49
  }
50
+ export interface AmountCellProps extends TableCellProps {
51
+ currency?: string;
52
+ conversionType?: 'fx' | 'dcc';
53
+ amount?: number;
54
+ selectAmount?: number;
55
+ selectCurrency?: string;
56
+ requestAmount?: number;
57
+ requestCurrency?: string;
58
+ merchantAmount?: number;
59
+ merchantCurrency?: string;
60
+ tooltipLabel?: React.ReactNode;
61
+ amountTooltipLabel?: React.ReactNode;
62
+ isTextShown?: boolean;
63
+ tableMode?: TableMode;
64
+ selectionProps?: SelectionProps;
65
+ chipIndex?: number;
66
+ }
36
67
  export interface DestinationCellProps extends TableCellProps {
37
68
  destinationsCount?: number;
38
69
  flagIcon?: string;
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.139-test.26",
5
- "testVersion": 26,
4
+ "version": "0.1.139-test.51",
5
+ "testVersion": 51,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -1,3 +0,0 @@
1
- import { AmountCellSheetProps } from './type';
2
- declare function AmountCellSheet({ conversionType, amount, currency, selectionProps, chipIndex }: AmountCellSheetProps): import("react/jsx-runtime").JSX.Element;
3
- export default AmountCellSheet;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { StatusChipWithCopy } from '../../../index.js';
3
- import { formatAmountWithCurrency } from '../../../../utils/index.js';
4
- import { ConversionTypeLabel, CurrencyInfo } from './components';
5
- const tableMode = 'sheet';
6
- function AmountCellSheet({ conversionType, amount, currency, selectionProps = {}, chipIndex = 0 }) {
7
- const { integerAmount, decimalAmount } = formatAmountWithCurrency(amount, currency);
8
- return (_jsxs(StatusChipWithCopy, Object.assign({ chipIndex: chipIndex, copyText: amount ? `${integerAmount}.${decimalAmount}` : '-', selectionProps: selectionProps }, { children: [_jsx(ConversionTypeLabel, { tableMode: tableMode, conversionType: conversionType }), _jsx(CurrencyInfo, { tableMode: tableMode, amount: amount, currency: currency })] })));
9
- }
10
- export default AmountCellSheet;
@@ -1,3 +0,0 @@
1
- import { AmountCellProps } from './type';
2
- declare function AmountCellText({ conversionType, amount, currency, tooltipLabel, amountTooltipLabel, ...props }: AmountCellProps): import("react/jsx-runtime").JSX.Element;
3
- export default AmountCellText;
@@ -1,23 +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, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { TableCell } from '../../../TableCells';
14
- import Tooltip from '../../../Tooltip';
15
- import { CurrencyIcon } from '../../../index.js';
16
- import { AmountCellContainer } from './style';
17
- import { ConversionTypeLabel, CurrencyInfo } from './components';
18
- const tableMode = 'text';
19
- function AmountCellText(_a) {
20
- var { conversionType, amount, currency, tooltipLabel, amountTooltipLabel } = _a, props = __rest(_a, ["conversionType", "amount", "currency", "tooltipLabel", "amountTooltipLabel"]);
21
- return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(AmountCellContainer, { children: [_jsx(Tooltip, Object.assign({ title: tooltipLabel || '' }, { children: _jsx(ConversionTypeLabel, { tableMode: tableMode, conversionType: conversionType }) })), _jsx(Tooltip, Object.assign({ title: _jsx(CurrencyIcon, { currency: currency }) }, { children: _jsx("span", {}) })), _jsx(Tooltip, Object.assign({ title: amountTooltipLabel }, { children: _jsx(CurrencyInfo, { tableMode: tableMode, amount: amount, currency: currency }) }))] }) })));
22
- }
23
- export default AmountCellText;
@@ -1,7 +0,0 @@
1
- import { TableMode } from '../../../../../types/index.js';
2
- import { AmountCellProps } from '../type';
3
- interface ConversionTypeLabelProps extends Pick<AmountCellProps, 'conversionType'> {
4
- tableMode: TableMode;
5
- }
6
- export declare const ConversionTypeLabel: ({ tableMode, conversionType }: ConversionTypeLabelProps) => import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,7 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { ConversionBadge } from '../style';
3
- export const ConversionTypeLabel = ({ tableMode, conversionType }) => {
4
- if (!conversionType)
5
- return _jsx(_Fragment, {});
6
- return (_jsx(ConversionBadge, Object.assign({ tableMode: tableMode, className: "conversion-type" }, { children: conversionType })));
7
- };
@@ -1,7 +0,0 @@
1
- import { TableMode } from '../../../../../types/index.js';
2
- import { AmountCellProps } from '../type';
3
- interface CurrencyInfoProps extends Pick<AmountCellProps, 'amount' | 'currency'> {
4
- tableMode: TableMode;
5
- }
6
- export declare const CurrencyInfo: ({ tableMode, amount, currency }: CurrencyInfoProps) => import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CurrencyIcon } from '../../../../index.js';
3
- import { CurrencySpan, DecimalSpan } from '../style';
4
- import { formatAmountWithCurrency } from '../../../../../utils/index.js';
5
- export const CurrencyInfo = ({ tableMode, amount, currency }) => {
6
- const { integerAmount, decimalAmount } = formatAmountWithCurrency(amount, currency);
7
- return (_jsx(CurrencySpan, Object.assign({ tableMode: tableMode }, { children: amount !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { children: _jsx(CurrencyIcon, { currency: currency, fontSize: 10 }) }), ' ', integerAmount, decimalAmount && (_jsxs(_Fragment, { children: [".", _jsx(DecimalSpan, { children: decimalAmount })] }))] })) : (_jsx("span", { children: "-" })) })));
8
- };
@@ -1,3 +0,0 @@
1
- export * from './AmountConversionTooltipLabel';
2
- export * from './ConversionTypeLabel';
3
- export * from './CurrencyInfo';
@@ -1,3 +0,0 @@
1
- export * from './AmountConversionTooltipLabel';
2
- export * from './ConversionTypeLabel';
3
- export * from './CurrencyInfo';
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- import type { TableCellProps } from '@mui/material';
3
- import { SelectionProps } from '../../../../types/index.js';
4
- export interface AmountCellCommonProps extends TableCellProps {
5
- currency?: string;
6
- conversionType?: 'fx' | 'dcc';
7
- amount?: number;
8
- }
9
- export interface AmountCellSheetProps extends AmountCellCommonProps {
10
- selectionProps?: SelectionProps;
11
- chipIndex?: number;
12
- }
13
- export interface AmountCellProps extends AmountCellCommonProps {
14
- selectAmount?: number;
15
- selectCurrency?: string;
16
- requestAmount?: number;
17
- requestCurrency?: string;
18
- merchantAmount?: number;
19
- merchantCurrency?: string;
20
- tooltipLabel?: React.ReactNode;
21
- amountTooltipLabel?: React.ReactNode;
22
- }
@@ -1,3 +0,0 @@
1
- import type { CustomerCellSheetProps } from './type';
2
- declare function CustomerCellSheet({ children, customerName }: CustomerCellSheetProps): import("react/jsx-runtime").JSX.Element;
3
- export default CustomerCellSheet;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { isArabic } from '../../../../utils/index.js';
3
- import { StyledCustomerName } from './style';
4
- function CustomerCellSheet({ children, customerName }) {
5
- const isArabicCustomerName = isArabic(customerName);
6
- return (_jsx(StyledCustomerName, Object.assign({ tableMode: "sheet", "data-testid": "CustomerCell_StyledCustomerName", "data-is-arabic": isArabicCustomerName }, { children: children })));
7
- }
8
- export default CustomerCellSheet;
@@ -1,4 +0,0 @@
1
- import type { TableCellProps } from '@mui/material/TableCell';
2
- import type { StatusCellProps } from './type';
3
- declare function StatusCellSheet({ statuses, ...props }: Pick<StatusCellProps, 'statuses'> & TableCellProps): import("react/jsx-runtime").JSX.Element;
4
- export default StatusCellSheet;
@@ -1,21 +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 { TableCell } from '../../../TableCells';
14
- import { StatusContainer } from './style';
15
- import { useStatusCell } from './useStatusCell';
16
- function StatusCellSheet(_a) {
17
- var { statuses } = _a, props = __rest(_a, ["statuses"]);
18
- const { statusesList } = useStatusCell({ statuses });
19
- return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StatusContainer, Object.assign({ sx: { paddingRight: '30px' } }, { children: statusesList.map((status) => status) })) })));
20
- }
21
- export default StatusCellSheet;
@@ -1,6 +0,0 @@
1
- import type { StatusCellProps } from './type';
2
- interface StatusCellTextProps extends StatusCellProps {
3
- xGap?: number;
4
- }
5
- declare function StatusCellText({ statuses, centerIconKey, xGap, ...props }: StatusCellTextProps): import("react/jsx-runtime").JSX.Element;
6
- export default StatusCellText;
@@ -1,42 +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 { TableCell } from '../../../TableCells';
14
- import { StatusIcon, StatusContainer, StatusWrapper } from './style';
15
- import { useStatusCell } from './useStatusCell';
16
- function StatusCellText(_a) {
17
- var { statuses, centerIconKey, xGap } = _a, props = __rest(_a, ["statuses", "centerIconKey", "xGap"]);
18
- const { statusesList, centerIconIndex } = useStatusCell({ statuses, centerIconKey });
19
- const xGapValue = xGap || 120;
20
- return (_jsx(TableCell, Object.assign({}, props, { "data-testid": "StatusCell", sx: {
21
- position: 'relative',
22
- overflow: 'visible',
23
- } }, { children: _jsx(StatusContainer, Object.assign({ initial: "initial", whileHover: "hover", animate: "start" }, { children: statusesList.map((status, index) => {
24
- if (!status)
25
- return;
26
- // To keep x position of each icon while hovering consistent
27
- const xHoverPosition = (index - centerIconIndex) * xGapValue;
28
- const isIconAfterCenterIcon = index > centerIconIndex;
29
- const isIconBeforeCenterIcon = index < centerIconIndex;
30
- return (_jsx(StatusWrapper, Object.assign({ variants: {
31
- initial: {
32
- x: isIconBeforeCenterIcon ? -5 : isIconAfterCenterIcon ? 5 : 0,
33
- zIndex: isIconBeforeCenterIcon ? 100 - index : isIconAfterCenterIcon ? index : 100,
34
- },
35
- hover: {
36
- x: xHoverPosition,
37
- zIndex: 100 - Math.abs(centerIconIndex - index),
38
- },
39
- }, transition: { duration: 0.3, type: 'tween', ease: 'easeOut' }, statusesCount: statusesList.length || 0 }, { children: _jsx(StatusIcon, Object.assign({ isTextShown: true }, { children: status })) }), index));
40
- }) })) })));
41
- }
42
- export default StatusCellText;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- import { StatusCellProps } from './type';
3
- export declare const useStatusCell: ({ statuses, centerIconKey }: Pick<StatusCellProps, 'statuses' | 'centerIconKey'>) => {
4
- statusesList: import("react").ReactNode[];
5
- centerIconIndex: number;
6
- };
@@ -1,8 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { getStatusesFilteredObject } from './utils';
3
- export const useStatusCell = ({ statuses, centerIconKey }) => {
4
- const statusesFilteredObject = useMemo(() => getStatusesFilteredObject(statuses), [statuses]);
5
- const statusesList = useMemo(() => Object.values(statusesFilteredObject).filter(Boolean), [statusesFilteredObject]);
6
- const centerIconIndex = useMemo(() => (centerIconKey ? Object.entries(statusesFilteredObject).findIndex(([key]) => key === centerIconKey) : 0), [statusesFilteredObject, centerIconKey]);
7
- return { statusesList, centerIconIndex };
8
- };