@tap-payments/os-micro-frontend-shared 0.1.96-test.6 → 0.1.96-test.8
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.
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { memo, useEffect, useRef, useState, useMemo } from 'react';
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { useLocation } from 'react-router';
|
|
6
5
|
import { StyledIconForDropDown, StyledMenuTitle, StyledOption, StyledSelect, StyledSelectComponent } from '../index.js';
|
|
7
6
|
import { APP_CODES, blackHeadingDownArrow, blueHeadingDropdownArrow } from '../../constants/index.js';
|
|
8
7
|
import { getNameText } from '../../utils/index.js';
|
|
@@ -17,7 +16,6 @@ function AppServices({ isMaximized, serviceCode, dimensions, appCode, services,
|
|
|
17
16
|
const [selectedOption, setSelectedOption] = useState('');
|
|
18
17
|
const servicesRef = useRef(null);
|
|
19
18
|
const [openDropdown, setOpenDropdown] = React.useState(false);
|
|
20
|
-
const pathname = useLocation();
|
|
21
19
|
const { i18n } = useTranslation();
|
|
22
20
|
const servicesList = useMemo(() => {
|
|
23
21
|
var _a;
|
|
@@ -35,7 +33,7 @@ function AppServices({ isMaximized, serviceCode, dimensions, appCode, services,
|
|
|
35
33
|
const activeTabTitle = useMemo(() => {
|
|
36
34
|
var _a, _b;
|
|
37
35
|
return getNameText((_b = (_a = servicesList.filter((service) => service.code.toLowerCase() === decodeURIComponent(serviceCode).toLowerCase())) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name, i18n.language);
|
|
38
|
-
}, [
|
|
36
|
+
}, [servicesList, i18n.language, serviceCode]);
|
|
39
37
|
useEffect(() => {
|
|
40
38
|
setSelectedOption(activeTabTitle);
|
|
41
39
|
}, [activeTabTitle]);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DragControls } from 'framer-motion';
|
|
3
3
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
-
import {
|
|
4
|
+
import { AppService } from '../../types/index.js';
|
|
5
5
|
export interface AppServicesBarProps {
|
|
6
|
-
|
|
6
|
+
appCode: string;
|
|
7
|
+
services: AppService[];
|
|
7
8
|
isMaximized: boolean;
|
|
8
9
|
dimensions: {
|
|
9
10
|
width: number | string;
|
|
@@ -19,6 +20,6 @@ export interface AppServicesBarProps {
|
|
|
19
20
|
onClickServiceItem: (code: string) => void;
|
|
20
21
|
sx?: SxProps<Theme>;
|
|
21
22
|
}
|
|
22
|
-
declare function AppServicesBar({
|
|
23
|
+
declare function AppServicesBar({ appCode, services, isMaximized, dimensions, features: { initialServiceCode }, ui: { onStartDrag }, onChangeServiceCode, onClickServiceItem, sx, }: Readonly<AppServicesBarProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
23
24
|
declare const _default: import("react").MemoExoticComponent<typeof AppServicesBar>;
|
|
24
25
|
export default _default;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { memo, useCallback, useState } from 'react';
|
|
3
3
|
import { AppServices } from '../index.js';
|
|
4
4
|
import { StyledAppHeaderWrapper } from '../Toolbar/style';
|
|
5
|
-
function AppServicesBar({
|
|
5
|
+
function AppServicesBar({ appCode, services, isMaximized, dimensions, features: { initialServiceCode }, ui: { onStartDrag }, onChangeServiceCode, onClickServiceItem, sx, }) {
|
|
6
6
|
const [isDragging, setIsDragging] = useState(false);
|
|
7
7
|
const onPointerDown = useCallback((e) => {
|
|
8
8
|
onStartDrag === null || onStartDrag === void 0 ? void 0 : onStartDrag(e);
|
|
@@ -11,11 +11,8 @@ function AppServicesBar({ app, isMaximized, dimensions, features: { initialServi
|
|
|
11
11
|
const onPointerUp = () => {
|
|
12
12
|
setIsDragging(false);
|
|
13
13
|
};
|
|
14
|
-
if (!
|
|
14
|
+
if (!appCode || !services.length)
|
|
15
15
|
return null;
|
|
16
|
-
|
|
17
|
-
if (!services.length)
|
|
18
|
-
return null;
|
|
19
|
-
return (_jsx(StyledAppHeaderWrapper, Object.assign({ id: "app-header-wrapper", onPointerDown: onPointerDown, onPointerUp: onPointerUp, isDragging: isDragging, sx: sx }, { children: _jsx(AppServices, { onClickServiceItem: onClickServiceItem, dimensions: { width: dimensions.width }, serviceCode: initialServiceCode !== null && initialServiceCode !== void 0 ? initialServiceCode : '', services: services, isMaximized: isMaximized, appCode: app.code, onChangeServiceCode: onChangeServiceCode }) })));
|
|
16
|
+
return (_jsx(StyledAppHeaderWrapper, Object.assign({ id: "app-header-wrapper", onPointerDown: onPointerDown, onPointerUp: onPointerUp, isDragging: isDragging, sx: sx }, { children: _jsx(AppServices, { onClickServiceItem: onClickServiceItem, dimensions: { width: dimensions.width }, serviceCode: initialServiceCode !== null && initialServiceCode !== void 0 ? initialServiceCode : '', services: services, isMaximized: isMaximized, appCode: appCode, onChangeServiceCode: onChangeServiceCode }) })));
|
|
20
17
|
}
|
|
21
18
|
export default memo(AppServicesBar);
|
package/build/types/apps.d.ts
CHANGED
|
@@ -106,7 +106,6 @@ export type MFWidgetBaseProps = {
|
|
|
106
106
|
openApp: (app: Pick<AppDetails, 'appCode' | 'serviceCode' | 'payload'> & {
|
|
107
107
|
sandboxMode?: boolean;
|
|
108
108
|
}) => void;
|
|
109
|
-
modifyAppServiceCode: ({ id, serviceCode, appCode }: Pick<AppDetails, 'id' | 'serviceCode' | 'appCode'>) => void;
|
|
110
109
|
};
|
|
111
110
|
timezone: {
|
|
112
111
|
current?: Timezone | null;
|
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.96-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.96-test.8",
|
|
5
|
+
"testVersion": 8,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|