@tap-payments/os-micro-frontend-shared 0.1.111-test.2 → 0.1.112-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 (41) hide show
  1. package/build/components/StatusIcons/AuthorizationAutoIcons/style.js +1 -1
  2. package/build/components/TableCells/CustomCells/BalanceCell/style.js +1 -1
  3. package/build/components/TableCells/CustomCells/ProductsCell/style.js +1 -1
  4. package/build/components/TableCells/CustomCells/RefundChargeCell/style.js +1 -1
  5. package/build/components/TableCells/CustomCells/RefundStatusCell/style.js +1 -1
  6. package/build/components/TableCells/CustomCells/style.js +1 -1
  7. package/build/components/index.d.ts +0 -1
  8. package/build/components/index.js +0 -1
  9. package/package.json +1 -1
  10. package/build/components/ReceiptViewer/ReceiptViewer.d.ts +0 -2
  11. package/build/components/ReceiptViewer/ReceiptViewer.js +0 -122
  12. package/build/components/ReceiptViewer/ReceiptViewerList.d.ts +0 -9
  13. package/build/components/ReceiptViewer/ReceiptViewerList.js +0 -10
  14. package/build/components/ReceiptViewer/components/FooterButton/FooterButton.d.ts +0 -5
  15. package/build/components/ReceiptViewer/components/FooterButton/FooterButton.js +0 -44
  16. package/build/components/ReceiptViewer/components/FooterButton/index.d.ts +0 -2
  17. package/build/components/ReceiptViewer/components/FooterButton/index.js +0 -2
  18. package/build/components/ReceiptViewer/components/ReceiptTitleBar/ReceiptTitleBar.d.ts +0 -5
  19. package/build/components/ReceiptViewer/components/ReceiptTitleBar/ReceiptTitleBar.js +0 -9
  20. package/build/components/ReceiptViewer/components/ReceiptTitleBar/index.d.ts +0 -3
  21. package/build/components/ReceiptViewer/components/ReceiptTitleBar/index.js +0 -3
  22. package/build/components/ReceiptViewer/components/ReceiptTitleBar/type.d.ts +0 -11
  23. package/build/components/ReceiptViewer/components/ReceiptTitleBar/type.js +0 -1
  24. package/build/components/ReceiptViewer/components/index.d.ts +0 -2
  25. package/build/components/ReceiptViewer/components/index.js +0 -2
  26. package/build/components/ReceiptViewer/context/Provider.d.ts +0 -6
  27. package/build/components/ReceiptViewer/context/Provider.js +0 -42
  28. package/build/components/ReceiptViewer/context/context.d.ts +0 -3
  29. package/build/components/ReceiptViewer/context/context.js +0 -7
  30. package/build/components/ReceiptViewer/context/index.d.ts +0 -2
  31. package/build/components/ReceiptViewer/context/index.js +0 -2
  32. package/build/components/ReceiptViewer/hooks/index.d.ts +0 -1
  33. package/build/components/ReceiptViewer/hooks/index.js +0 -1
  34. package/build/components/ReceiptViewer/hooks/useReceiptViewerContext.d.ts +0 -8
  35. package/build/components/ReceiptViewer/hooks/useReceiptViewerContext.js +0 -18
  36. package/build/components/ReceiptViewer/index.d.ts +0 -7
  37. package/build/components/ReceiptViewer/index.js +0 -7
  38. package/build/components/ReceiptViewer/style.d.ts +0 -631
  39. package/build/components/ReceiptViewer/style.js +0 -176
  40. package/build/components/ReceiptViewer/type.d.ts +0 -22
  41. package/build/components/ReceiptViewer/type.js +0 -1
@@ -33,7 +33,7 @@ export const PercentageContainer = styled('div')(({ theme, percentage, isCapture
33
33
  gap: theme.spacing(0.5),
34
34
  }));
35
35
  export const PiePercentage = styled('div')(({ percentage, isCapture, theme }) => ({
36
- background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}.00%, transparent 0.00%)`,
36
+ background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}%, transparent 0.00%)`,
37
37
  borderRadius: '50%',
38
38
  width: '8.333px',
39
39
  height: '8.333px',
@@ -31,7 +31,7 @@ export const PercentageContainer = styled('div')(({ theme, percentage }) => ({
31
31
  gap: theme.spacing(0.5),
32
32
  }));
33
33
  export const PiePercentage = styled('div')(({ percentage, isCapture, theme }) => ({
34
- background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}.00%, transparent 0.00%)`,
34
+ background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}%, transparent 0.00%)`,
35
35
  borderRadius: '50%',
36
36
  width: '8.333px',
37
37
  height: '8.333px',
@@ -34,7 +34,7 @@ export const PercentageContainer = styled('div')(({ theme }) => ({
34
34
  lineHeight: 0,
35
35
  }));
36
36
  export const PiePercentage = styled('div')(({ percentage, isCapture, theme }) => ({
37
- background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}.00%, transparent 0.00%)`,
37
+ background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}%, transparent 0.00%)`,
38
38
  borderRadius: '50%',
39
39
  width: '8.333px',
40
40
  height: '8.333px',
@@ -31,7 +31,7 @@ export const PercentageContainer = styled(motion.div)(({ theme, percentage }) =>
31
31
  minWidth: '44px',
32
32
  }));
33
33
  export const PiePercentage = styled('div')(({ percentage, isCapture, theme }) => ({
34
- background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}.00%, transparent 0.00%)`,
34
+ background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}%, transparent 0.00%)`,
35
35
  borderRadius: '50%',
36
36
  width: '8.333px',
37
37
  height: '8.333px',
@@ -38,7 +38,7 @@ export const DateContainer = styled(DateCell)(({ theme }) => ({
38
38
  color: theme.palette.secondary.main,
39
39
  }));
40
40
  export const PiePercentage = styled('div')(({ percentage, isCapture, theme }) => ({
41
- background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}.00%, transparent 0.00%)`,
41
+ background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}%, transparent 0.00%)`,
42
42
  borderRadius: '50%',
43
43
  width: '8.333px',
44
44
  height: '8.333px',
@@ -136,7 +136,7 @@ export const StatusIcon = styled('img')(() => ({
136
136
  height: '16px',
137
137
  }));
138
138
  export const PiePercentage = styled('div')(({ percentage, isCapture, theme }) => ({
139
- background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}.00%, transparent 0.00%)`,
139
+ background: `conic-gradient(${isCapture ? theme.palette.info.dark : '#656565'} ${percentage}%, transparent 0.00%)`,
140
140
  borderRadius: '50%',
141
141
  width: '8.333px',
142
142
  height: '8.333px',
@@ -108,4 +108,3 @@ export { default as LazyImage } from './LazyImage';
108
108
  export { default as AmountStatusChip, type AmountStatusChipProps } from './AmountStatusChip';
109
109
  export { default as AuthenticationTypeChip, type AuthenticationTypeChipProps } from './AuthenticationTypeChip';
110
110
  export * from './LazyImage';
111
- export { default as ReceiptViewer, type ReceiptTitleBarProps, type ReceiptViewerProps, ReceiptTitleBar, ReceiptViewerDialogContext, ReceiptViewerList, useReceiptViewerContext, ReceiptViewerDialogContextProvider, } from './ReceiptViewer';
@@ -108,4 +108,3 @@ export { default as LazyImage } from './LazyImage';
108
108
  export { default as AmountStatusChip } from './AmountStatusChip';
109
109
  export { default as AuthenticationTypeChip } from './AuthenticationTypeChip';
110
110
  export * from './LazyImage';
111
- export { default as ReceiptViewer, ReceiptTitleBar, ReceiptViewerDialogContext, ReceiptViewerList, useReceiptViewerContext, ReceiptViewerDialogContextProvider, } from './ReceiptViewer';
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.1.111-test.2",
4
+ "version": "0.1.112-test.2",
5
5
  "testVersion": 2,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
@@ -1,2 +0,0 @@
1
- import { ReceiptViewerProps } from './type';
2
- export default function ReceiptViewer({ index, isWindowMinimized, windowOrder, onClose }: ReceiptViewerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,122 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from 'react';
3
- import { Box, Dialog } from '@mui/material';
4
- import { motion, } from 'framer-motion';
5
- import { Resizable } from 're-resizable';
6
- import Draggable from 'react-draggable';
7
- import { APP_WINDOW_Z_INDEX } from '../../constants/index.js';
8
- import { useMouseState, useWindowDimensions } from '../../hooks/index.js';
9
- import { isSafariBrowser } from '../../utils/index.js';
10
- import JSONTitleBar from './components/ReceiptTitleBar';
11
- import { JSONContainer, TITLE_BAR_HEIGHT, VIEWER_HEIGHT, FOOTER_HEIGHT, } from './style';
12
- const VIEWER_WIDTH = 400;
13
- const animationDuration = 0.5;
14
- export default function ReceiptViewer({ index, isWindowMinimized, windowOrder, onClose }) {
15
- var _a, _b, _c, _d;
16
- const [isMaximized, setIsMaximized] = useState(false);
17
- const [isResized, setIsResized] = useState(false);
18
- const [newDimensions, setNewDimensions] = useState({ width: 0, height: 0 });
19
- const [isToolbarAnimationDisabled, setIsToolbarAnimationDisabled] = useState(true);
20
- const [viewerWidth, setViewerWidth] = useState(VIEWER_WIDTH);
21
- const requestTimerRef = useRef();
22
- const { onMouseEnter, onMouseLeave, isHovered } = useMouseState();
23
- const { height, width } = useWindowDimensions();
24
- const [position, setPosition] = useState({
25
- x: width / 2 + VIEWER_WIDTH / 4 - index * 20,
26
- y: height / 2 - VIEWER_HEIGHT / 2 + index * 30,
27
- });
28
- const resizableRef = useRef();
29
- const isSafari = isSafariBrowser();
30
- const currentRequestWidth = Number((_b = (_a = resizableRef.current) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.width) || VIEWER_WIDTH;
31
- useEffect(() => {
32
- if (requestTimerRef.current) {
33
- clearTimeout(requestTimerRef.current);
34
- }
35
- setViewerWidth(currentRequestWidth);
36
- }, [currentRequestWidth]);
37
- return (_jsx(Draggable, Object.assign({ disabled: isMaximized, handle: "#draggable-dialog-title", cancel: '[class*="MuiDialogContent-root"]', defaultPosition: {
38
- x: width / 2 - VIEWER_WIDTH / 4,
39
- y: height / 2 - VIEWER_HEIGHT / 2,
40
- }, position: {
41
- x: width - position.x,
42
- y: position.y,
43
- }, onStop: (_, data) => {
44
- setPosition({
45
- x: width - data.x,
46
- y: data.y,
47
- });
48
- }, bounds: {
49
- top: 10,
50
- } }, { children: _jsx(Dialog, Object.assign({ disableEnforceFocus: true, sx: Object.assign(Object.assign(Object.assign(Object.assign({ backgroundColor: 'transparent', zIndex: (windowOrder || 0) + APP_WINDOW_Z_INDEX + (isMaximized ? 1 : 0) }, (isWindowMinimized && {
51
- display: 'none',
52
- })), { transform: 'translate(180px, 14px)' }), (!isMaximized && {
53
- width: isSafari ? (newDimensions === null || newDimensions === void 0 ? void 0 : newDimensions.width) || viewerWidth : 'fit-content',
54
- height: isSafari ? (newDimensions === null || newDimensions === void 0 ? void 0 : newDimensions.height) || VIEWER_HEIGHT : 'fit-content',
55
- })), (isMaximized && {
56
- transform: 'none !important',
57
- })), PaperProps: {
58
- style: Object.assign(Object.assign({ margin: 0, maxHeight: '100%', maxWidth: 'none', background: 'transparent', width: !isResized ? viewerWidth : 'fit-content', height: !isResized ? VIEWER_HEIGHT : 'fit-content' }, (isMaximized && {
59
- width: '100%',
60
- height: '100%',
61
- })), { position: 'relative' }),
62
- }, onClose: () => {
63
- setIsMaximized(false);
64
- setIsToolbarAnimationDisabled(true);
65
- setTimeout(() => {
66
- setIsToolbarAnimationDisabled(false);
67
- }, animationDuration * 1000);
68
- }, open: true, hideBackdrop: true, fullScreen: isMaximized, "aria-labelledby": "draggable-dialog-title" }, { children: _jsx(Resizable, Object.assign({ enable: {
69
- left: false,
70
- right: true,
71
- bottomRight: true,
72
- bottom: true,
73
- }, maxHeight: height - 40, maxWidth: width, minWidth: isMaximized ? '100vw' : viewerWidth, minHeight: isMaximized ? '100vh' : '300px', ref: (c) => {
74
- resizableRef.current = c;
75
- }, onResizeStart: () => {
76
- setIsToolbarAnimationDisabled(true);
77
- }, onResizeStop: () => {
78
- setIsToolbarAnimationDisabled(false);
79
- }, onResize: (_, __, element) => {
80
- setIsResized(true);
81
- setNewDimensions({
82
- width: element.offsetWidth,
83
- height: element.offsetHeight,
84
- });
85
- }, defaultSize: {
86
- width: viewerWidth,
87
- height: VIEWER_HEIGHT,
88
- }, style: Object.assign(Object.assign({ background: 'transparent' }, (isMaximized && {
89
- height: '100% !important',
90
- width: '100% !important',
91
- flex: 1,
92
- })), (isMaximized && {
93
- position: 'relative',
94
- })) }, { children: _jsxs(JSONContainer, { children: [_jsx(motion.div, Object.assign({ style: Object.assign({}, (isMaximized && {
95
- height: TITLE_BAR_HEIGHT,
96
- position: 'fixed',
97
- zIndex: 1000,
98
- })), animate: Object.assign(Object.assign({ width: currentRequestWidth }, (isMaximized && {
99
- width: '100vw',
100
- })), (!isMaximized && {
101
- transform: 'translateX(0)',
102
- })), transition: Object.assign({ duration: animationDuration }, (isToolbarAnimationDisabled && {
103
- duration: 0,
104
- })) }, { children: _jsx(JSONTitleBar, { title: "Receipt", onClose: () => onClose(), onMaximize: () => {
105
- setIsMaximized((prev) => !prev);
106
- setIsToolbarAnimationDisabled(true);
107
- setTimeout(() => {
108
- setIsToolbarAnimationDisabled(false);
109
- }, animationDuration * 1000);
110
- }, isHovered: isHovered, onMouseHover: onMouseEnter, onMouseLeave: onMouseLeave, maximized: isMaximized, id: "draggable-dialog-title" }) })), _jsx(Box, Object.assign({ sx: {
111
- display: 'flex',
112
- flexDirection: 'row',
113
- justifyContent: 'space-between',
114
- alignItems: 'flex-start',
115
- height: isMaximized
116
- ? `calc(100vh - ${FOOTER_HEIGHT}px)`
117
- : (Number((_d = (_c = resizableRef.current) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.height) || VIEWER_HEIGHT) - FOOTER_HEIGHT + 5,
118
- background: 'transparent',
119
- position: 'fixed',
120
- width: '100%',
121
- } }, { children: _jsx(Box, Object.assign({ sx: (theme) => ({ background: theme.palette.common.white, width: '100%', height: '100%' }) }, { children: "Here new Content" })) }))] }) })) })) })));
122
- }
@@ -1,9 +0,0 @@
1
- import { JsonViewer } from './type';
2
- type Props = {
3
- list: JsonViewer[];
4
- onClose: (index: number) => void;
5
- isWindowMinimized: boolean;
6
- windowOrder: number;
7
- };
8
- export declare const ReceiptViewerList: ({ list, onClose, isWindowMinimized, windowOrder }: Props) => import("react/jsx-runtime").JSX.Element | null;
9
- export {};
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import ReceiptViewer from './ReceiptViewer';
3
- export const ReceiptViewerList = ({ list, onClose, isWindowMinimized, windowOrder }) => {
4
- if (!(list === null || list === void 0 ? void 0 : list.length)) {
5
- return null;
6
- }
7
- return (_jsx(_Fragment, { children: list.map((item, index) => (_jsx(ReceiptViewer, { index: index, json: item.json, requestJson: item === null || item === void 0 ? void 0 : item.requestJson, onClose: () => {
8
- onClose(index);
9
- }, isWindowMinimized: isWindowMinimized, windowOrder: windowOrder }, item.json.id))) }));
10
- };
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { AnimatedButtonProps } from '../../type';
3
- declare function FooterButton({ onClick, icon, label, disableAnimation, ...props }: AnimatedButtonProps): import("react/jsx-runtime").JSX.Element;
4
- declare const _default: React.MemoExoticComponent<typeof FooterButton>;
5
- export default _default;
@@ -1,44 +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, Fragment as _Fragment } from "react/jsx-runtime";
13
- import React, { memo } from 'react';
14
- import Box from '@mui/material/Box';
15
- import { AnimatePresence, motion } from 'framer-motion';
16
- import { useTranslation } from 'react-i18next';
17
- import { greenCheckIcon } from '../../../../constants/index.js';
18
- import { StyledAnimatedButton } from '../../style';
19
- function FooterButton(_a) {
20
- var { onClick, icon, label, disableAnimation } = _a, props = __rest(_a, ["onClick", "icon", "label", "disableAnimation"]);
21
- const [isClicked, setIsClicked] = React.useState(false);
22
- const { t } = useTranslation();
23
- const handleClick = (e) => {
24
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
25
- if (disableAnimation)
26
- return;
27
- setIsClicked(true);
28
- setTimeout(() => {
29
- setIsClicked(false);
30
- }, 2000);
31
- };
32
- return (_jsxs(StyledAnimatedButton, Object.assign({}, props, { onClick: handleClick }, { children: [_jsxs(Box, Object.assign({ sx: {
33
- width: '16px',
34
- display: 'flex',
35
- overflow: 'hidden',
36
- justifyContent: 'center',
37
- alignItems: 'center',
38
- } }, { children: [_jsx(AnimatePresence, Object.assign({ mode: "wait" }, { children: isClicked && (_jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1, transition: { duration: 0.4 } }, exit: { opacity: 0, transition: { duration: 0.1 } }, transition: { duration: 0.4 }, src: greenCheckIcon, alt: "icon" }, "id-icon")) })), _jsx(AnimatePresence, Object.assign({ mode: "wait" }, { children: !isClicked && (_jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1, transition: { duration: 0.4 } }, exit: { opacity: 0, transition: { duration: 0.1 } }, transition: { duration: 0.4 }, src: icon, alt: "icon" }, "id-icon")) }))] })), label && (_jsxs(_Fragment, { children: [_jsx(AnimatePresence, { children: isClicked && (_jsx(motion.span, Object.assign({ initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0, position: 'absolute' }, transition: {
39
- duration: 0.4,
40
- } }, { children: t('copied') }))) }), _jsx(AnimatePresence, { children: !isClicked && (_jsx(motion.span, Object.assign({ initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0, position: 'absolute', width: '53px' }, transition: {
41
- duration: 0.4,
42
- } }, { children: label }))) })] }))] })));
43
- }
44
- export default memo(FooterButton);
@@ -1,2 +0,0 @@
1
- import FooterButton from './FooterButton';
2
- export default FooterButton;
@@ -1,2 +0,0 @@
1
- import FooterButton from './FooterButton';
2
- export default FooterButton;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { ReceiptTitleBarProps } from './type';
3
- declare function ReceiptTitleBar({ title, onClose, onMaximize, maximized, id, onMouseHover, onMouseLeave, isHovered }: ReceiptTitleBarProps): import("react/jsx-runtime").JSX.Element;
4
- declare const _default: import("react").MemoExoticComponent<typeof ReceiptTitleBar>;
5
- export default _default;
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo } from 'react';
3
- import Toolbar, { StyledHeaderWrapperStyled } from '../../../Toolbar';
4
- import { CloseIcon, MaximizeIcon } from '../../../ToolbarIcon';
5
- import { jsonIcon } from '../../../../constants/index.js';
6
- function ReceiptTitleBar({ title, onClose, onMaximize, maximized = false, id, onMouseHover, onMouseLeave, isHovered = false }) {
7
- return (_jsx(StyledHeaderWrapperStyled, Object.assign({ id: id, maximized: maximized || false, sandboxMode: false }, { children: _jsx(Toolbar, { isHovered: true, onMouseEnter: onMouseHover, onMouseLeave: onMouseLeave, isMaximized: maximized, title: title, icon: jsonIcon, leftActions: _jsxs(_Fragment, { children: [_jsx(CloseIcon, { onClick: onClose }), _jsx(MaximizeIcon, { isMaximized: maximized, onClick: onMaximize })] }) }) })));
8
- }
9
- export default memo(ReceiptTitleBar);
@@ -1,3 +0,0 @@
1
- import JSONTitleBar from './ReceiptTitleBar';
2
- export * from './type';
3
- export default JSONTitleBar;
@@ -1,3 +0,0 @@
1
- import JSONTitleBar from './ReceiptTitleBar';
2
- export * from './type';
3
- export default JSONTitleBar;
@@ -1,11 +0,0 @@
1
- import { SyntheticEvent } from 'react';
2
- export interface ReceiptTitleBarProps {
3
- title: string;
4
- onClose?: (e: SyntheticEvent) => void;
5
- onMaximize?: (e: SyntheticEvent) => void;
6
- maximized?: boolean;
7
- id?: string;
8
- onMouseHover: (e: SyntheticEvent) => void;
9
- onMouseLeave: (e: SyntheticEvent) => void;
10
- isHovered?: boolean;
11
- }
@@ -1,2 +0,0 @@
1
- export { default as FooterButton } from './FooterButton';
2
- export { default as ReceiptTitleBar, type ReceiptTitleBarProps } from './ReceiptTitleBar';
@@ -1,2 +0,0 @@
1
- export { default as FooterButton } from './FooterButton';
2
- export { default as ReceiptTitleBar } from './ReceiptTitleBar';
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- type ReceiptViewerDialogProviderProps = {
3
- children: ReactNode;
4
- };
5
- export declare const ReceiptViewerDialogContextProvider: ({ children }: ReceiptViewerDialogProviderProps) => import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,42 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useMemo, useState } from 'react';
3
- import { ReceiptViewerList } from '../ReceiptViewerList';
4
- import { ReceiptViewerDialogContext } from './context';
5
- export const ReceiptViewerDialogContextProvider = ({ children }) => {
6
- const [receiptViewerList, seReceiptViewerList] = useState([]);
7
- const [isWindowMinimized, setIsWindowMinimized] = useState(false);
8
- const [windowOrder, setWindowOrder] = useState(1);
9
- const handleReceiptViewerDialogOpen = useCallback((jsonViewer) => {
10
- if (receiptViewerList.length === 7) {
11
- alert('Maximum allowed active Json Viewer is 7 per table.');
12
- return;
13
- }
14
- if (receiptViewerList.some((item) => item.json.id === jsonViewer.json.id)) {
15
- return;
16
- }
17
- const jsonCopy = structuredClone(jsonViewer.json);
18
- const requestData = jsonCopy.request_body;
19
- const jsonViewerPreservedRequest = {
20
- json: jsonCopy,
21
- requestJson: jsonViewer.requestJson || requestData || undefined,
22
- };
23
- delete jsonViewerPreservedRequest.json.request_body;
24
- seReceiptViewerList((prev) => [...prev, jsonViewerPreservedRequest]);
25
- }, [receiptViewerList]);
26
- const handleJsonViewerDialogClose = (index) => {
27
- seReceiptViewerList((prev) => prev.filter((_, idx) => index !== idx));
28
- };
29
- const handleWindowMinimize = (value) => {
30
- setIsWindowMinimized(value);
31
- };
32
- const handleWindowOrder = (value) => {
33
- setWindowOrder(value);
34
- };
35
- const contextValue = useMemo(() => ({
36
- receiptViewerList,
37
- handleReceiptViewerDialogOpen,
38
- handleWindowMinimize,
39
- handleWindowOrder,
40
- }), [receiptViewerList, handleReceiptViewerDialogOpen]);
41
- return (_jsxs(ReceiptViewerDialogContext.Provider, Object.assign({ value: contextValue }, { children: [children, _jsx(ReceiptViewerList, { list: receiptViewerList, onClose: handleJsonViewerDialogClose, isWindowMinimized: isWindowMinimized, windowOrder: windowOrder })] })));
42
- };
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ReceiptViewerContext } from '../type';
3
- export declare const ReceiptViewerDialogContext: import("react").Context<ReceiptViewerContext>;
@@ -1,7 +0,0 @@
1
- import { createContext } from 'react';
2
- export const ReceiptViewerDialogContext = createContext({
3
- receiptViewerList: [],
4
- handleReceiptViewerDialogOpen: () => { },
5
- handleWindowMinimize: () => { },
6
- handleWindowOrder: () => { },
7
- });
@@ -1,2 +0,0 @@
1
- export * from './context';
2
- export { ReceiptViewerDialogContextProvider } from './Provider';
@@ -1,2 +0,0 @@
1
- export * from './context';
2
- export { ReceiptViewerDialogContextProvider } from './Provider';
@@ -1 +0,0 @@
1
- export { useReceiptViewerContext } from './useReceiptViewerContext';
@@ -1 +0,0 @@
1
- export { useReceiptViewerContext } from './useReceiptViewerContext';
@@ -1,8 +0,0 @@
1
- type Props = {
2
- isWindowMinimized: boolean;
3
- windowOrder: number;
4
- };
5
- export declare const useReceiptViewerContext: ({ isWindowMinimized, windowOrder }: Props) => {
6
- handleReceiptViewerDialogOpen: (jsonViewer: import("..").JsonViewer) => void;
7
- };
8
- export {};
@@ -1,18 +0,0 @@
1
- import { useContext, useEffect, useCallback } from 'react';
2
- import { ReceiptViewerDialogContext } from '../context';
3
- export const useReceiptViewerContext = ({ isWindowMinimized, windowOrder }) => {
4
- const { handleReceiptViewerDialogOpen, handleWindowMinimize, handleWindowOrder } = useContext(ReceiptViewerDialogContext);
5
- const onWindowMinimize = useCallback(() => {
6
- handleWindowMinimize(isWindowMinimized);
7
- }, [handleWindowMinimize, isWindowMinimized]);
8
- const onWindowOrder = useCallback(() => {
9
- handleWindowOrder(windowOrder);
10
- }, [handleWindowOrder, windowOrder]);
11
- useEffect(() => {
12
- onWindowOrder();
13
- }, [onWindowOrder]);
14
- useEffect(() => {
15
- onWindowMinimize();
16
- }, [onWindowMinimize]);
17
- return { handleReceiptViewerDialogOpen };
18
- };
@@ -1,7 +0,0 @@
1
- import JSONViewer from './ReceiptViewer';
2
- export * from './context';
3
- export * from './type';
4
- export * from './hooks';
5
- export * from './ReceiptViewerList';
6
- export * from './components';
7
- export default JSONViewer;
@@ -1,7 +0,0 @@
1
- import JSONViewer from './ReceiptViewer';
2
- export * from './context';
3
- export * from './type';
4
- export * from './hooks';
5
- export * from './ReceiptViewerList';
6
- export * from './components';
7
- export default JSONViewer;