@tap-payments/os-micro-frontend-shared 0.0.54 → 0.0.56

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 (44) hide show
  1. package/build/components/Chip/style.d.ts +1 -0
  2. package/build/components/CountBadge/style.d.ts +1 -0
  3. package/build/components/Dialog/style.d.ts +1 -0
  4. package/build/components/FlippingCard/style.d.ts +1 -0
  5. package/build/components/ImageWrapper/ImageWrapper.d.ts +1 -0
  6. package/build/components/JSONViewer/style.d.ts +1 -0
  7. package/build/components/SearchButton/styles.d.ts +1 -0
  8. package/build/components/StatusIcons/AuthIcons/style.d.ts +1 -0
  9. package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +1 -0
  10. package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +1 -0
  11. package/build/components/StatusIcons/SourceIcons/style.d.ts +1 -0
  12. package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +1 -0
  13. package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +1 -0
  14. package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +1 -0
  15. package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +1 -0
  16. package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +1 -0
  17. package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +1 -0
  18. package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +1 -0
  19. package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +1 -0
  20. package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +1 -0
  21. package/build/components/TableCells/CustomCells/IDButton/style.d.ts +1 -0
  22. package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +1 -0
  23. package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +1 -0
  24. package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +1 -0
  25. package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +1 -0
  26. package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +1 -0
  27. package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +1 -0
  28. package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +1 -0
  29. package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +1 -0
  30. package/build/components/TableCells/CustomCells/SourceCell/style.d.ts +1 -0
  31. package/build/components/TableCells/CustomCells/SourceMergedCell/style.d.ts +1 -0
  32. package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +1 -0
  33. package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +1 -0
  34. package/build/components/TableCells/CustomCells/style.d.ts +1 -0
  35. package/build/components/VirtualTable/style.d.ts +1 -0
  36. package/build/hooks/index.d.ts +1 -0
  37. package/build/hooks/index.js +1 -0
  38. package/build/hooks/useCountdown.d.ts +7 -0
  39. package/build/hooks/useCountdown.js +46 -0
  40. package/build/utils/date.d.ts +1 -0
  41. package/build/utils/date.js +10 -0
  42. package/build/utils/number.d.ts +1 -0
  43. package/build/utils/number.js +3 -0
  44. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  import { GetSourceAnimationFunction } from './type';
3
4
  export declare const ChipStyled: import("@emotion/styled").StyledComponent<import("react").RefAttributes<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
4
5
  variant?: import("./type").ChipVariant | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const AgreementImageWrapper: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const DialogWrapper: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const Wrapper: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  declare const ImageWrapper: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const FOOTER_HEIGHT = 37;
3
4
  export declare const TITLE_BAR_HEIGHT = "32px";
4
5
  export declare const VIEWER_HEIGHT = 545;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const StyledInput: import("@emotion/styled").StyledComponent<{
3
4
  width?: string | number | undefined;
4
5
  height?: string | number | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
4
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
4
5
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const BalanceCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const ErrorCodeLabel: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
4
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
4
5
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const ActionCellContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
3
4
  export declare const ActionsIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
4
5
  selected: boolean;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const AuthIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
3
4
  export declare const AuthCellContainer: import("@emotion/styled").StyledComponent<{
4
5
  hidden?: boolean | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const BalanceCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
4
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
4
5
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const Button: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const ProductCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
4
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
4
5
  export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const RefundChargeCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const RefundCellContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
4
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
4
5
  export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
4
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
4
5
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const collapsedViewIconVariants: {
3
4
  default: {
4
5
  duration: number;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<{
3
4
  width?: string | number | undefined;
4
5
  height?: string | number | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
3
4
  hidden?: boolean | undefined;
4
5
  id?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare const GeographyBox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
3
4
  variant?: "Local" | "Global" | "Regional" | undefined;
4
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  interface TableWrapperProps {
3
4
  showNoDataView?: boolean;
4
5
  }
@@ -9,3 +9,4 @@ export * from './useDelayedUpdate';
9
9
  export * from './useIsParameterSelected';
10
10
  export * from './useStickyHeaderShadow';
11
11
  export * from './useThemeMode';
12
+ export * from './useCountdown';
@@ -9,3 +9,4 @@ export * from './useDelayedUpdate';
9
9
  export * from './useIsParameterSelected';
10
10
  export * from './useStickyHeaderShadow';
11
11
  export * from './useThemeMode';
12
+ export * from './useCountdown';
@@ -0,0 +1,7 @@
1
+ export declare function useCountdown(): {
2
+ timer: number;
3
+ formattedTime: string;
4
+ startTimer: (expiryTime: number) => void;
5
+ stopTimer: () => void;
6
+ resetTimer: () => void;
7
+ };
@@ -0,0 +1,46 @@
1
+ import { secondsToTimeString } from '../utils/index.js';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ export function useCountdown() {
4
+ const [timer, setTimer] = useState(0);
5
+ const timerInterval = useRef(null);
6
+ const formattedTime = secondsToTimeString(timer);
7
+ const stopTimer = () => {
8
+ if (timerInterval.current) {
9
+ clearInterval(timerInterval.current);
10
+ timerInterval.current = null;
11
+ }
12
+ };
13
+ const resetTimer = () => {
14
+ stopTimer();
15
+ setTimer(0);
16
+ };
17
+ const startTimer = (expiryTime) => {
18
+ if (expiryTime <= 0)
19
+ return;
20
+ if (timerInterval.current) {
21
+ stopTimer();
22
+ }
23
+ setTimer(expiryTime);
24
+ timerInterval.current = setInterval(() => {
25
+ setTimer((prev) => {
26
+ const newTime = prev - 1;
27
+ if (newTime <= 0) {
28
+ stopTimer();
29
+ }
30
+ return newTime;
31
+ });
32
+ }, 1000);
33
+ };
34
+ useEffect(() => {
35
+ return () => {
36
+ stopTimer();
37
+ };
38
+ }, []);
39
+ return {
40
+ timer,
41
+ formattedTime,
42
+ startTimer,
43
+ stopTimer,
44
+ resetTimer,
45
+ };
46
+ }
@@ -32,3 +32,4 @@ export declare const generatePastYearList: (length?: number) => {
32
32
  id: number;
33
33
  label: number;
34
34
  }[];
35
+ export declare function secondsToTimeString(seconds: number): string;
@@ -4,6 +4,7 @@ import timezone from 'dayjs/plugin/timezone';
4
4
  import utc from 'dayjs/plugin/utc';
5
5
  import calendar from 'dayjs/plugin/calendar';
6
6
  import { TIMEZONES } from '../constants/index.js';
7
+ import { pad } from './number';
7
8
  dayjs.extend(utc);
8
9
  dayjs.extend(timezone);
9
10
  dayjs.extend(relativeTime);
@@ -178,3 +179,12 @@ export const generatePastYearList = (length = 10) => Array.from({ length }, (_,
178
179
  id: year,
179
180
  label: year,
180
181
  }));
182
+ export function secondsToTimeString(seconds) {
183
+ const hours = Math.floor(seconds / 3600);
184
+ const minutes = Math.floor((seconds % 3600) / 60);
185
+ const secondsValue = Math.floor(seconds % 60);
186
+ if (hours > 0) {
187
+ return `${pad(hours)}:${pad(minutes)}:${pad(secondsValue)}`;
188
+ }
189
+ return `${pad(minutes)}:${pad(secondsValue)}`;
190
+ }
@@ -2,3 +2,4 @@ export declare function formatOrdinal(num?: number): string;
2
2
  export declare function formatNumber(num: number): string;
3
3
  export declare const stringToNumber: (value: string) => number;
4
4
  export declare const numberToString: (value: number, fixed?: number) => string;
5
+ export declare function pad(num: number, length?: number): string;
@@ -22,3 +22,6 @@ export const numberToString = (value, fixed) => {
22
22
  return value.toString();
23
23
  return value.toFixed(fixed);
24
24
  };
25
+ export function pad(num, length = 2) {
26
+ return num.toString().padStart(length, '0');
27
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.0.54",
4
+ "version": "0.0.56",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",