@tap-payments/os-micro-frontend-shared 0.1.109-test.4 → 0.1.109-test.5

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.
@@ -1,16 +1,18 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
- import { Dialog } from '@mui/material';
3
+ import { Box, Dialog } from '@mui/material';
4
+ import { motion } from 'framer-motion';
4
5
  import { Resizable } from 're-resizable';
5
6
  import Draggable from 'react-draggable';
6
7
  import { APP_WINDOW_Z_INDEX } from '../../constants/index.js';
7
8
  import { useMouseState, useWindowDimensions } from '../../hooks/index.js';
8
9
  import { isSafariBrowser } from '../../utils/index.js';
9
- import { VIEWER_HEIGHT, } from './style';
10
+ import JSONTitleBar from './components/ReceiptTitleBar';
11
+ import { FooterWrapper, JSONContainer, TITLE_BAR_HEIGHT, VIEWER_HEIGHT, FOOTER_HEIGHT, } from './style';
10
12
  const VIEWER_WIDTH = 400;
11
13
  const animationDuration = 0.5;
12
14
  export default function ReceiptViewer({ index, json, requestJson = {}, isWindowMinimized, windowOrder, onClose }) {
13
- var _a, _b;
15
+ var _a, _b, _c, _d;
14
16
  const [isMaximized, setIsMaximized] = useState(false);
15
17
  const [isResized, setIsResized] = useState(false);
16
18
  const [isResponseCollapsed, setIsResponseCollapsed] = useState(true);
@@ -113,5 +115,45 @@ export default function ReceiptViewer({ index, json, requestJson = {}, isWindowM
113
115
  flex: 1,
114
116
  })), (isMaximized && {
115
117
  position: 'relative',
116
- })) }, { children: "Hello" })) })) })));
118
+ })) }, { children: _jsxs(JSONContainer, { children: [_jsx(motion.div, Object.assign({ style: Object.assign({}, (isMaximized && {
119
+ height: TITLE_BAR_HEIGHT,
120
+ position: 'fixed',
121
+ zIndex: 1000,
122
+ })), animate: Object.assign(Object.assign({ width: isRequestShown ? currentRequestWidth * 2 : currentRequestWidth }, (isMaximized && {
123
+ width: '100vw',
124
+ })), (!isMaximized && {
125
+ transform: `translateX(${isRequestShown ? -currentRequestWidth : 0}px)`,
126
+ })), transition: Object.assign({ duration: animationDuration }, (isToolbarAnimationDisabled && {
127
+ duration: 0,
128
+ })) }, { children: _jsx(JSONTitleBar, { title: isRequestShown ? 'JSON Request & Response' : 'JSON Response', onClose: () => onClose(), onMaximize: () => {
129
+ setIsMaximized((prev) => !prev);
130
+ setIsToolbarAnimationDisabled(true);
131
+ setTimeout(() => {
132
+ setIsToolbarAnimationDisabled(false);
133
+ }, animationDuration * 1000);
134
+ }, isHovered: isHovered, onMouseHover: onMouseEnter, onMouseLeave: onMouseLeave, maximized: isMaximized, id: "draggable-dialog-title", onRequestClick: () => {
135
+ var _a;
136
+ setIsRequestShown((prev) => !prev);
137
+ setIsToolbarAnimationDisabled(false);
138
+ if (!isRequestShown) {
139
+ (_a = resizableRef.current) === null || _a === void 0 ? void 0 : _a.updateSize({
140
+ width: VIEWER_WIDTH,
141
+ height: VIEWER_HEIGHT,
142
+ });
143
+ }
144
+ }, isRequestExpanded: isRequestShown, showRequestIcon: Boolean(requestObjectPropertiesCount) }) })), _jsxs(Box, Object.assign({ sx: {
145
+ display: 'flex',
146
+ flexDirection: 'row',
147
+ justifyContent: 'space-between',
148
+ alignItems: 'flex-start',
149
+ height: isMaximized
150
+ ? `calc(100vh - ${FOOTER_HEIGHT}px)`
151
+ : (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,
152
+ background: 'transparent',
153
+ position: 'fixed',
154
+ width: '100%',
155
+ } }, { children: ["Here new Content", _jsx(FooterWrapper, { sx: {
156
+ flex: 1,
157
+ height: FOOTER_HEIGHT,
158
+ } })] }))] }) })) })) })));
117
159
  }
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.109-test.4",
5
- "testVersion": 4,
4
+ "version": "0.1.109-test.5",
5
+ "testVersion": 5,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",