@tap-payments/os-micro-frontend-shared 0.1.385 → 0.1.386-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 (52) hide show
  1. package/build/components/AnimatedSpinnerIcon/style.d.ts +0 -1
  2. package/build/components/Chip/style.d.ts +0 -1
  3. package/build/components/CountBadge/style.d.ts +0 -1
  4. package/build/components/Dialog/style.d.ts +0 -1
  5. package/build/components/FlippingCard/style.d.ts +0 -1
  6. package/build/components/ImageWrapper/ImageWrapper.d.ts +0 -1
  7. package/build/components/JSONViewer/style.d.ts +0 -1
  8. package/build/components/LeftPeekRightExpandingChip/style.d.ts +0 -1
  9. package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.js +1 -1
  10. package/build/components/RightLeftExpandingCenterChip/style.d.ts +0 -1
  11. package/build/components/SearchButton/styles.d.ts +0 -1
  12. package/build/components/StatusIcons/AuthIcons/style.d.ts +0 -1
  13. package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +0 -1
  14. package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +0 -1
  15. package/build/components/StatusIcons/SourceIcons/style.d.ts +0 -1
  16. package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +0 -1
  17. package/build/components/TableCells/CustomCells/AgreementCell/style.d.ts +0 -1
  18. package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +0 -1
  19. package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +0 -1
  20. package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +0 -1
  21. package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +0 -1
  22. package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +0 -1
  23. package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +0 -1
  24. package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +0 -1
  25. package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +0 -1
  26. package/build/components/TableCells/CustomCells/DueDateCell/DueDateCell.d.ts +1 -1
  27. package/build/components/TableCells/CustomCells/DueDateCell/DueDateCell.js +9 -170
  28. package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +0 -1
  29. package/build/components/TableCells/CustomCells/DueDateCell/type.d.ts +16 -2
  30. package/build/components/TableCells/CustomCells/DueDateCell/useDueDate.d.ts +2 -0
  31. package/build/components/TableCells/CustomCells/DueDateCell/useDueDate.js +19 -0
  32. package/build/components/TableCells/CustomCells/DueDateCell/utils.d.ts +13 -0
  33. package/build/components/TableCells/CustomCells/DueDateCell/utils.js +58 -0
  34. package/build/components/TableCells/CustomCells/IDButton/style.d.ts +0 -1
  35. package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +0 -1
  36. package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +0 -1
  37. package/build/components/TableCells/CustomCells/PayoutReportCell/style.d.ts +0 -1
  38. package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +0 -1
  39. package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +0 -1
  40. package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +0 -1
  41. package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +0 -1
  42. package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +0 -1
  43. package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +0 -1
  44. package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +0 -1
  45. package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +0 -1
  46. package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +0 -1
  47. package/build/components/TableCells/CustomCells/style.d.ts +0 -1
  48. package/build/components/TableReports/components/DownloadButton/style.d.ts +0 -1
  49. package/build/components/TableReports/style.d.ts +0 -1
  50. package/build/components/VirtualTables/components/style.d.ts +0 -1
  51. package/build/constants/apps.js +1 -0
  52. package/package.json +3 -3
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  type AnimatedSpinnerIconProps = {
4
3
  width?: string;
5
4
  height?: string;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  import { GetSourceAnimationFunction } from './type';
4
3
  export declare const ChipStyled: import("@emotion/styled").StyledComponent<import("react").RefAttributes<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
5
4
  variant?: import("./type").ChipVariant | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const AgreementImageWrapper: 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 DialogWrapper: 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 Wrapper: 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
  declare const ImageWrapper: 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 FOOTER_HEIGHT = 37;
4
3
  export declare const TITLE_BAR_HEIGHT = "32px";
5
4
  export declare const VIEWER_HEIGHT = 545;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  import type { SxProps, Theme } from '@mui/material/styles';
4
3
  export declare const CHIP_GAP = 3;
5
4
  export declare const DEFAULT_CHIP_MIN_WIDTH = 24;
@@ -49,7 +49,7 @@ import { useRightLeftExpandingCenterChip, DEFAULT_CHIP_MIN_WIDTH } from './useRi
49
49
  function RightLeftExpandingCenterChip(_a) {
50
50
  var { leftIcons = [], rightIcons = [], centerIcon, expandableCenterRight, expandableCenterLeft, expandedZIndex = 1000 } = _a, props = __rest(_a, ["leftIcons", "rightIcons", "centerIcon", "expandableCenterRight", "expandableCenterLeft", "expandedZIndex"]);
51
51
  const { isHovering, handleMouseEnter, handleMouseLeave, centerWrapRef, centerContentRef, centerChipRef, anchors, leftChipRefs, rightChipRefs, leftOffsets, rightOffsets, expandableRightInnerRef, expandableLeftInnerRef, expandedRightMV, expandedLeftMV, shiftX, rightShift, leftShift, leftHoverWidth, rightHoverWidth, } = useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenterRight, expandableCenterLeft });
52
- return (_jsx(Box, Object.assign({}, props, { "data-testid": "RightLeftExpandingCenterChipBox", sx: tableCellSx }, { children: _jsx(CenterShiftWrapper, Object.assign({ "data-testid": "CenterShiftWrapper", initial: false, style: { x: shiftX } }, { children: _jsxs(CenterIconWrapper, Object.assign({ "data-testid": "CenterIconWrapper", ref: centerWrapRef, onMouseLeave: handleMouseLeave }, { children: [_jsxs(PeekContainer, Object.assign({ "data-testid": "PeekContainer" }, { children: [_jsx(AnimatePresence, Object.assign({ initial: false }, { children: leftIcons.length > 0 && (_jsx(LeftPeekChip, { "data-testid": "LeftPeekChip", initial: { opacity: 0, scale: 0.95, x: -4 }, animate: isHovering ? { opacity: 0, scale: 0.9, x: -6 } : { opacity: 1, scale: 1, x: -5 }, exit: { opacity: 0, scale: 0.95, x: -4 }, transition: { duration: 0.18, ease: 'easeOut' } }, "left-peek")) })), _jsx(CenterChip, Object.assign({ "data-testid": "CenterChip", ref: centerChipRef, onMouseEnter: handleMouseEnter, style: {
52
+ return (_jsx(Box, Object.assign({}, props, { "data-testid": "RightLeftExpandingCenterChipBox", sx: Object.assign(Object.assign({}, tableCellSx), props.sx) }, { children: _jsx(CenterShiftWrapper, Object.assign({ "data-testid": "CenterShiftWrapper", initial: false, style: { x: shiftX } }, { children: _jsxs(CenterIconWrapper, Object.assign({ "data-testid": "CenterIconWrapper", ref: centerWrapRef, onMouseLeave: handleMouseLeave }, { children: [_jsxs(PeekContainer, Object.assign({ "data-testid": "PeekContainer" }, { children: [_jsx(AnimatePresence, Object.assign({ initial: false }, { children: leftIcons.length > 0 && (_jsx(LeftPeekChip, { "data-testid": "LeftPeekChip", initial: { opacity: 0, scale: 0.95, x: -4 }, animate: isHovering ? { opacity: 0, scale: 0.9, x: -6 } : { opacity: 1, scale: 1, x: -5 }, exit: { opacity: 0, scale: 0.95, x: -4 }, transition: { duration: 0.18, ease: 'easeOut' } }, "left-peek")) })), _jsx(CenterChip, Object.assign({ "data-testid": "CenterChip", ref: centerChipRef, onMouseEnter: handleMouseEnter, style: {
53
53
  borderRadius: (() => {
54
54
  const hasLeftExpanded = expandableCenterLeft && isHovering;
55
55
  const hasRightExpanded = expandableCenterRight && isHovering;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  import type { SxProps, Theme } from '@mui/material/styles';
4
3
  export declare const CHIP_GAP = 3;
5
4
  export declare const CenterIconWrapper: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledInput: 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 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 BalanceCellContainer: 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 ErrorCodeLabel: 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 PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  import { TableMode } from '../../../../types/index.js';
4
3
  export declare const ActionCellContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
5
4
  tableMode?: TableMode | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const AgreementCellContainer: 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 StyledAgreementCardIcon: 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 CardContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledAppsCell: 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 AppsStatusContainer: import("@emotion/styled").StyledComponent<{
5
4
  hidden?: boolean | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const AuthIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
4
3
  export declare const AuthCellContainer: import("@emotion/styled").StyledComponent<{
5
4
  hidden?: boolean | 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 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 BalanceCellContainer: 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 PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -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,3 +1,3 @@
1
1
  import { DueCellProps } from './type';
2
- declare function DueDateCell({ dueDate, expiryDate, remindedCount, isTextShown, ...props }: DueCellProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function DueDateCell({ dueDate, expiryDate, ...props }: DueCellProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default DueDateCell;
@@ -9,178 +9,17 @@ 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";
13
- import { useEffect, useRef, useState } from 'react';
14
- import { useTheme } from '@mui/material/styles';
15
- import dayjs from 'dayjs';
16
- import { motion } from 'framer-motion';
17
- import { useTranslation } from 'react-i18next';
18
- import StyledBadge, { BadgeVariants } from '../../../CountBadge';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
19
13
  import { TableCell } from '../../../TableCells';
20
14
  import Tooltip from '../../../Tooltip';
21
- import { dueDateBlueIcon, dueDateRedIcon, timerBlueIcon, expiredIcon, dueDateGrayIcon, remindedRedIcon } from '../../../../constants/index.js';
22
- import { DueDateCellContainer, DateIcon, ReminderTextLabel, ExpiredTextLabel } from './style';
23
- import { formatDate } from './utils';
15
+ import { RightLeftExpandingCenterChip } from '../../../RightLeftExpandingCenterChip';
16
+ import { DateIcon } from './style';
17
+ import { useDueDate } from './useDueDate';
24
18
  function DueDateCell(_a) {
25
- var { dueDate, expiryDate, remindedCount, isTextShown } = _a, props = __rest(_a, ["dueDate", "expiryDate", "remindedCount", "isTextShown"]);
26
- const theme = useTheme();
27
- const dueDateRef = useRef(null);
28
- const expiryRef = useRef(null);
29
- const [dueDateRefClientWidth, setDueDateRefClientWidth] = useState(0);
30
- const [expiryRefClientWidth, setReminderRefClientWidth] = useState(0);
31
- useEffect(() => {
32
- var _a, _b;
33
- setDueDateRefClientWidth((_a = dueDateRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth);
34
- setReminderRefClientWidth((_b = expiryRef === null || expiryRef === void 0 ? void 0 : expiryRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth);
35
- }, [isTextShown]);
36
- const { t } = useTranslation();
37
- const isDueDatePassed = dayjs(dueDate).isBefore(dayjs(), 'day');
38
- const isDueDateAfterTomorrow = dayjs(dueDate).isAfter(dayjs().add(2, 'day'), 'day');
39
- let icon = dueDateBlueIcon;
40
- let color = theme.palette.info.dark;
41
- const date = formatDate(dayjs(dueDate).valueOf());
42
- let backgroundColor = theme.palette.custom['200'];
43
- if (isDueDatePassed) {
44
- icon = dueDateRedIcon;
45
- color = theme.palette.error.main;
46
- backgroundColor = theme.palette.custom['300'];
47
- }
48
- else if (isDueDateAfterTomorrow) {
49
- icon = dueDateGrayIcon;
50
- color = theme.palette.grey.A700;
51
- backgroundColor = theme.palette.custom['400'];
52
- }
53
- let expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'day');
54
- let expiryDateTimeLeftText = 'days';
55
- const isExpired = dayjs(expiryDate).isBefore(dayjs(), 'second');
56
- if (expiryDateTimeLeft < 1) {
57
- expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'hour');
58
- expiryDateTimeLeftText = 'hours';
59
- }
60
- if (expiryDateTimeLeft < 1) {
61
- expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'minute');
62
- expiryDateTimeLeftText = 'minutes';
63
- }
64
- if (expiryDateTimeLeft < 1) {
65
- expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'second');
66
- expiryDateTimeLeftText = 'seconds';
67
- }
68
- const isExpiryLeftTimeMoreThanOneDay = dayjs(expiryDate).diff(dayjs(), 'day') > 1;
69
- const expiryDateTimestamp = dayjs(expiryDate).valueOf();
70
- const timeLeftLabel = isExpiryLeftTimeMoreThanOneDay ? formatDate(expiryDateTimestamp) : `${expiryDateTimeLeft} ${expiryDateTimeLeftText} left`;
71
- const expiredDate = formatDate(expiryDateTimestamp);
72
- const expiredDateLabel = `Expired on ${expiredDate}`;
73
- const shownLabel = isExpired ? expiredDateLabel : timeLeftLabel;
74
- const isRemindedExpansionShown = remindedCount > 1;
75
- const reminderLeftOffset = (dueDateRefClientWidth || 0) + (expiryRefClientWidth || 0);
76
- return (_jsx(TableCell, Object.assign({}, props, { sx: {
77
- position: 'relative',
78
- overflow: 'visible',
79
- } }, { children: _jsxs("div", Object.assign({ style: {
80
- display: 'flex',
81
- alignItems: 'center',
82
- justifyContent: 'flex-start',
83
- gap: '8px',
84
- overflow: 'visible',
85
- } }, { children: [!!dueDate && (_jsx(Tooltip, Object.assign({ title: isTextShown ? '' : date }, { children: _jsxs(DueDateCellContainer, Object.assign({ whileHover: ['animate', 'fadeIn'], animate: "start", ref: dueDateRef, sx: Object.assign({ zIndex: 28, position: 'absolute', overflow: 'visible' }, (isTextShown && { paddingInline: theme.spacing(1) })), background: backgroundColor, variants: {
86
- animate: Object.assign({}, (!isTextShown && { boxShadow: theme.shadows[4], paddingInlineEnd: theme.spacing(1) })),
87
- } }, { children: [isTextShown ? (_jsx("span", Object.assign({ style: {
88
- color,
89
- } }, { children: isDueDatePassed ? 'Past Due' : `Due ${date}` }))) : (_jsx(DateIcon, { src: icon, alt: "icon" })), !isTextShown && (_jsx(motion.div, Object.assign({ style: {
90
- display: 'none',
91
- alignItems: 'center',
92
- justifyContent: 'center',
93
- gap: '4px',
94
- width: 0,
95
- }, initial: { width: 0, opacity: 0 }, transition: {
96
- animate: {
97
- duration: 0.5,
98
- },
99
- fadeIn: {
100
- duration: 0.2,
101
- },
102
- }, variants: {
103
- animate: {
104
- width: 'auto',
105
- display: 'flex',
106
- },
107
- fadeIn: {
108
- transition: {
109
- delay: 0.5,
110
- },
111
- opacity: 1,
112
- },
113
- } }, { children: date && _jsxs("span", Object.assign({ style: { color } }, { children: [date, " "] })) })))] })) }))), expiryDate && (_jsx(Tooltip, Object.assign({ title: isTextShown ? '' : shownLabel }, { children: _jsxs(DueDateCellContainer, Object.assign({ whileHover: ['animate', 'fadeIn'], animate: "start", ref: expiryRef, sx: Object.assign({ zIndex: 27, position: 'absolute', left: isTextShown ? (dueDateRefClientWidth || 0) + 8 : '32px' }, (isTextShown && { paddingInline: theme.spacing(1) })), background: isExpired ? theme.palette.custom['100'] : theme.palette.custom['50'], variants: {
114
- animate: Object.assign({}, (!isTextShown && { boxShadow: theme.shadows[4], paddingInlineEnd: theme.spacing(1) })),
115
- } }, { children: [isTextShown ? (_jsx(ExpiredTextLabel, Object.assign({ sx: {
116
- color: isExpired ? theme.palette.custom[500] : theme.palette.info.dark,
117
- background: isExpired ? `${theme.palette.custom[500]}0d` : `${theme.palette.info.dark}0d`,
118
- } }, { children: isExpired ? 'Expired' : `Expiry ${shownLabel}` }))) : (_jsx(DateIcon, { src: isExpired ? expiredIcon : timerBlueIcon, alt: "icon" })), !isTextShown && (_jsx(motion.div, Object.assign({ style: {
119
- display: 'none',
120
- alignItems: 'center',
121
- justifyContent: 'center',
122
- gap: '4px',
123
- width: 0,
124
- }, initial: { width: 0, opacity: 0 }, transition: {
125
- animate: {
126
- duration: 0.5,
127
- },
128
- fadeIn: {
129
- duration: 0.2,
130
- },
131
- }, variants: {
132
- animate: {
133
- width: 'auto',
134
- display: 'flex',
135
- },
136
- fadeIn: {
137
- transition: {
138
- delay: 0.5,
139
- },
140
- opacity: 1,
141
- },
142
- } }, { children: shownLabel && _jsx("span", Object.assign({ style: { color: isExpired ? theme.palette.custom[500] : theme.palette.info.dark } }, { children: shownLabel })) })))] })) }))), remindedCount > 0 && (_jsx(Tooltip, Object.assign({ title: t('reminded') }, { children: _jsxs(DueDateCellContainer, Object.assign({ whileHover: isRemindedExpansionShown ? ['animate', 'fadeIn'] : [], animate: "start", sx: {
143
- zIndex: 26,
144
- left: isTextShown ? reminderLeftOffset + (reminderLeftOffset ? 16 : 0) : '64px',
145
- position: 'absolute',
146
- overflow: 'visible',
147
- border: `1px solid ${theme.palette.error.main}1A`,
148
- paddingInline: isTextShown ? theme.spacing(1) : theme.spacing(0.5),
149
- }, background: isTextShown ? theme.palette.common.white : theme.palette.custom['600'], variants: {
150
- animate: {
151
- boxShadow: theme.shadows[4],
152
- },
153
- } }, { children: [isTextShown ? (_jsx(ReminderTextLabel, { children: "Reminder" })) : (_jsx(DateIcon, { sx: {
154
- width: '14px',
155
- height: '14px',
156
- }, src: remindedRedIcon, alt: "icon" })), _jsx(motion.div, Object.assign({ style: {
157
- display: 'none',
158
- alignItems: 'center',
159
- justifyContent: 'center',
160
- gap: '4px',
161
- width: 0,
162
- }, initial: { width: 0, opacity: 0 }, transition: {
163
- animate: {
164
- duration: 0.5,
165
- },
166
- fadeIn: {
167
- duration: 0.2,
168
- },
169
- }, variants: {
170
- animate: {
171
- width: 'auto',
172
- display: 'flex',
173
- },
174
- fadeIn: {
175
- transition: {
176
- delay: 0.5,
177
- },
178
- opacity: 1,
179
- },
180
- } }, { children: isRemindedExpansionShown && (_jsx(StyledBadge, Object.assign({ variant: BadgeVariants.DEFAULT, style: {
181
- background: theme.palette.error.main,
182
- fontWeight: 'bold',
183
- color: theme.palette.common.white,
184
- } }, { children: remindedCount }))) }))] })) })))] })) })));
19
+ var { dueDate, expiryDate } = _a, props = __rest(_a, ["dueDate", "expiryDate"]);
20
+ const { dueMeta, expiryMeta } = useDueDate(dueDate, expiryDate);
21
+ return (_jsx(TableCell, Object.assign({}, props, { sx: { position: 'relative', overflow: 'visible' } }, { children: _jsx(RightLeftExpandingCenterChip, { sx: { justifyContent: 'flex-start' }, centerIcon: dueMeta && (_jsx(Tooltip, Object.assign({ title: dueMeta.label }, { children: _jsx(DateIcon, { src: dueMeta.icon, alt: "icon" }) }))), rightIcons: [
22
+ expiryMeta && (_jsx(Tooltip, Object.assign({ title: expiryMeta.label }, { children: _jsx(DateIcon, { src: expiryMeta.icon, alt: "icon" }) }))),
23
+ ] }) })));
185
24
  }
186
25
  export default DueDateCell;
@@ -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;
@@ -2,6 +2,20 @@ import { TableCellProps } from '@mui/material';
2
2
  export interface DueCellProps extends TableCellProps {
3
3
  dueDate?: string | Date;
4
4
  expiryDate?: string | Date;
5
- remindedCount: number;
6
- isTextShown?: boolean;
7
5
  }
6
+ export type DateInput = string | number | Date;
7
+ interface DueMeta {
8
+ icon: string;
9
+ color: string;
10
+ label: string;
11
+ }
12
+ interface ExpiryMeta {
13
+ icon: string;
14
+ isExpired: boolean;
15
+ label: string;
16
+ }
17
+ export interface UseDueDateResult {
18
+ dueMeta: DueMeta | null;
19
+ expiryMeta: ExpiryMeta | null;
20
+ }
21
+ export {};
@@ -0,0 +1,2 @@
1
+ import { DateInput, UseDueDateResult } from './type';
2
+ export declare function useDueDate(dueDate?: DateInput, expiryDate?: DateInput): UseDueDateResult;
@@ -0,0 +1,19 @@
1
+ import { useMemo } from 'react';
2
+ import dayjs from 'dayjs';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import { isValidDate, buildDueMeta, buildExpiryMeta } from './utils';
5
+ export function useDueDate(dueDate, expiryDate) {
6
+ const theme = useTheme();
7
+ const now = dayjs();
8
+ const dueMeta = useMemo(() => {
9
+ if (!isValidDate(dueDate))
10
+ return null;
11
+ return buildDueMeta(dayjs(dueDate), now, theme);
12
+ }, [dueDate, now, theme]);
13
+ const expiryMeta = useMemo(() => {
14
+ if (!isValidDate(expiryDate))
15
+ return null;
16
+ return buildExpiryMeta(dayjs(expiryDate), now);
17
+ }, [expiryDate, now]);
18
+ return { dueMeta, expiryMeta };
19
+ }
@@ -1 +1,14 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { DateInput } from './type';
1
3
  export declare function formatDate(date?: number): string;
4
+ export declare function buildDueMeta(due: Dayjs, now: Dayjs, theme: any): {
5
+ icon: string;
6
+ color: any;
7
+ label: string;
8
+ };
9
+ export declare function buildExpiryMeta(expiry: Dayjs, now: Dayjs): {
10
+ icon: string;
11
+ isExpired: boolean;
12
+ label: string;
13
+ };
14
+ export declare function isValidDate(input?: DateInput): boolean;
@@ -1,4 +1,6 @@
1
+ import dayjs from 'dayjs';
1
2
  import { formatCellDate } from '../../../../utils/index.js';
3
+ import { dueDateBlueIcon, dueDateRedIcon, dueDateGrayIcon, expiredIcon, timerBlueIcon } from '../../../../constants/index.js';
2
4
  export function formatDate(date) {
3
5
  return formatCellDate(date, {
4
6
  sameDay: '[Today at] h:mm A',
@@ -9,3 +11,59 @@ export function formatDate(date) {
9
11
  nextWeek: 'MMM DD, YYYY',
10
12
  });
11
13
  }
14
+ export function buildDueMeta(due, now, theme) {
15
+ if (due.isBefore(now, 'day')) {
16
+ return {
17
+ icon: dueDateRedIcon,
18
+ color: theme.palette.error.main,
19
+ label: formatDate(due.valueOf()),
20
+ };
21
+ }
22
+ if (due.isAfter(now.add(2, 'day'), 'day')) {
23
+ return {
24
+ icon: dueDateGrayIcon,
25
+ color: theme.palette.grey.A700,
26
+ label: formatDate(due.valueOf()),
27
+ };
28
+ }
29
+ return {
30
+ icon: dueDateBlueIcon,
31
+ color: theme.palette.info.dark,
32
+ label: formatDate(due.valueOf()),
33
+ };
34
+ }
35
+ export function buildExpiryMeta(expiry, now) {
36
+ if (expiry.isBefore(now)) {
37
+ return {
38
+ icon: expiredIcon,
39
+ isExpired: true,
40
+ label: `Expired on ${formatDate(expiry.valueOf())}`,
41
+ };
42
+ }
43
+ const units = ['day', 'hour', 'minute', 'second'];
44
+ for (const unit of units) {
45
+ const diff = expiry.diff(now, unit);
46
+ if (diff >= 1) {
47
+ if (unit === 'day' && diff > 1) {
48
+ return {
49
+ icon: timerBlueIcon,
50
+ isExpired: false,
51
+ label: formatDate(expiry.valueOf()),
52
+ };
53
+ }
54
+ return {
55
+ icon: timerBlueIcon,
56
+ isExpired: false,
57
+ label: `${diff} ${unit}${diff > 1 ? 's' : ''} left`,
58
+ };
59
+ }
60
+ }
61
+ return {
62
+ icon: timerBlueIcon,
63
+ isExpired: false,
64
+ label: 'Less than a second left',
65
+ };
66
+ }
67
+ export function isValidDate(input) {
68
+ return Boolean(input && dayjs(input).isValid());
69
+ }
@@ -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 StyledDownloadFileImageWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
4
3
  isTextShown?: boolean | undefined;
5
4
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -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;
@@ -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;
@@ -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>, {}>;
@@ -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
  type ExportButtonProps = {
4
3
  notificationState?: {
5
4
  success: boolean;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  interface TableWrapperProps {
4
3
  showNoDataView?: boolean;
5
4
  }
@@ -502,4 +502,5 @@ export const MF_APPS_MAPPER = new Set([
502
502
  APP_CODES.acceptance.code,
503
503
  APP_CODES.authentication.code,
504
504
  APP_CODES.protect.code,
505
+ APP_CODES.tokens.code,
505
506
  ]);
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.385",
5
- "testVersion": 0,
4
+ "version": "0.1.386-test.2",
5
+ "testVersion": 2,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -164,4 +164,4 @@
164
164
  "publishConfig": {
165
165
  "registry": "https://registry.npmjs.org/"
166
166
  }
167
- }
167
+ }