@tap-payments/os-micro-frontend-shared 0.1.73-test.1 → 0.1.74
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.
- package/build/components/AppWindowWrapper/context/Provider.d.ts +1 -1
- package/build/components/AppWindowWrapper/context/Provider.js +4 -3
- package/build/components/AppWindowWrapper/context/type.d.ts +4 -0
- package/build/components/TableCells/CustomCells/SalesChannelCell/SalesChannelCell.js +2 -7
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AppWindowProviderProps } from './type';
|
|
2
|
-
export declare function AppWindowContextProvider({ children, isOpen, onClose, defaultWindowHeight, defaultWindowWidth }: AppWindowProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function AppWindowContextProvider({ children, isOpen, onClose, defaultWindowHeight, defaultWindowWidth, initialPosition, }: AppWindowProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,13 +4,14 @@ import { useWindowDimensions } from '../../../hooks/index.js';
|
|
|
4
4
|
import { AppWindowContext } from './context';
|
|
5
5
|
const DEFAULT_VIEWER_WIDTH = 555;
|
|
6
6
|
const DEFAULT_VIEWER_HEIGHT = 545;
|
|
7
|
-
export function AppWindowContextProvider({ children, isOpen, onClose, defaultWindowHeight, defaultWindowWidth }) {
|
|
7
|
+
export function AppWindowContextProvider({ children, isOpen, onClose, defaultWindowHeight, defaultWindowWidth, initialPosition, }) {
|
|
8
|
+
var _a, _b;
|
|
8
9
|
const { height, width } = useWindowDimensions();
|
|
9
10
|
const viewerDefaultWidth = defaultWindowWidth || DEFAULT_VIEWER_WIDTH;
|
|
10
11
|
const viewerDefaultHeight = defaultWindowHeight || DEFAULT_VIEWER_HEIGHT;
|
|
11
12
|
const [position, setPosition] = useState({
|
|
12
|
-
x: width / 2 + viewerDefaultWidth / 2,
|
|
13
|
-
y: height / 2 - viewerDefaultHeight / 2,
|
|
13
|
+
x: (_a = initialPosition === null || initialPosition === void 0 ? void 0 : initialPosition.x) !== null && _a !== void 0 ? _a : width / 2 + viewerDefaultWidth / 2,
|
|
14
|
+
y: (_b = initialPosition === null || initialPosition === void 0 ? void 0 : initialPosition.y) !== null && _b !== void 0 ? _b : height / 2 - viewerDefaultHeight / 2,
|
|
14
15
|
});
|
|
15
16
|
const [isMaximized, setIsMaximized] = useState(false);
|
|
16
17
|
const [isResized, setIsResized] = useState(false);
|
|
@@ -6,6 +6,10 @@ export interface AppWindowProviderProps {
|
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
defaultWindowWidth?: number;
|
|
8
8
|
defaultWindowHeight?: number;
|
|
9
|
+
initialPosition?: {
|
|
10
|
+
x?: number | null;
|
|
11
|
+
y?: number | null;
|
|
12
|
+
};
|
|
9
13
|
}
|
|
10
14
|
export interface AppWindowContextProps {
|
|
11
15
|
position: {
|
|
@@ -17,20 +17,15 @@ import { ChannelTextLabel, ChannelTextWrapper, salesChannelAnimation, SalesChann
|
|
|
17
17
|
function SalesChannelCell(_a) {
|
|
18
18
|
var _b;
|
|
19
19
|
var { channels, isTextShown } = _a, props = __rest(_a, ["channels", "isTextShown"]);
|
|
20
|
-
const salesChannels = (_b = channels === null || channels === void 0 ? void 0 : channels.filter((
|
|
20
|
+
const salesChannels = (_b = channels === null || channels === void 0 ? void 0 : channels.filter((s) => !!s.address)) === null || _b === void 0 ? void 0 : _b.map((channel, index) => {
|
|
21
21
|
var _a;
|
|
22
22
|
const sourceTooltip = channel.address;
|
|
23
23
|
const channelCode = (_a = channel.code) === null || _a === void 0 ? void 0 : _a.replace(/_/g, '');
|
|
24
|
-
let channelAddressUrl = channel.address || '';
|
|
25
|
-
if (!/^https?:\/\//i.test(channelAddressUrl)) {
|
|
26
|
-
channelAddressUrl = 'https://' + channelAddressUrl;
|
|
27
|
-
}
|
|
28
24
|
return (_jsx(Tooltip, Object.assign({ title: sourceTooltip }, { children: _jsx(ImageWrapper, Object.assign({ order: index, variants: salesChannelAnimation(index, isTextShown ? 74 : 0), sx: {
|
|
29
25
|
width: isTextShown ? '70px' : '36px',
|
|
30
26
|
cursor: 'pointer',
|
|
31
|
-
boxShadow: '7px 0px 8px 0px #F2F2F2',
|
|
32
27
|
}, onClick: () => {
|
|
33
|
-
window.open(
|
|
28
|
+
window.open(channel.address, '_blank');
|
|
34
29
|
} }, { children: isTextShown ? (_jsx(ChannelTextWrapper, { children: _jsx(ChannelTextLabel, { children: channelCode }) })) : (_jsx(StyledSourceImage, { src: channel.logo, alt: channelCode })) })) }), `${channel}-${index}`));
|
|
35
30
|
});
|
|
36
31
|
const salesChannelsCount = (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.length) || 0;
|
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.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.74",
|
|
5
|
+
"testVersion": 0,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -134,4 +134,4 @@
|
|
|
134
134
|
"publishConfig": {
|
|
135
135
|
"registry": "https://registry.npmjs.org/"
|
|
136
136
|
}
|
|
137
|
-
}
|
|
137
|
+
}
|