@astral/features 4.0.0-alpha.9 → 4.0.1
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/README.md +1 -1
- package/node/productSwitcher/components/AstralProductSwitcher/AstralProductSwitcher.d.ts +1 -6
- package/node/productSwitcher/components/AstralProductSwitcher/AstralProductSwitcher.js +3 -10
- package/node/productSwitcher/components/AstralProductSwitcher/stories/{Example.story.d.ts → BasicUsage.story.d.ts} +1 -1
- package/node/productSwitcher/components/AstralProductSwitcher/stories/{Example.story.js → BasicUsage.story.js} +3 -3
- package/node/productSwitcher/components/AstralProductSwitcher/utils/getFilteredProducts/getFilteredProducts.d.ts +1 -1
- package/{productSwitcher/components/AstralProductSwitcher/stories/Example.story.d.ts → node/productSwitcher/components/IdentityProductSwitcher/stories/BasicUsage.story.d.ts} +1 -1
- package/node/productSwitcher/components/IdentityProductSwitcher/stories/{Example.story.js → BasicUsage.story.js} +3 -3
- package/node/productSwitcher/components/IdentityProductSwitcher/styles.d.ts +3 -3
- package/node/productSwitcher/components/IdentityProductSwitcher/styles.js +7 -4
- package/node/productSwitcher/utils/getGroupsProducts/getGroupsProducts.d.ts +1 -1
- package/node/productSwitcher/utils/getIdentityProducts/getIdentityProducts.d.ts +1 -1
- package/package.json +2 -2
- package/productSwitcher/components/AstralProductSwitcher/AstralProductSwitcher.d.ts +1 -6
- package/productSwitcher/components/AstralProductSwitcher/AstralProductSwitcher.js +1 -8
- package/{node/productSwitcher/components/IdentityProductSwitcher/stories/Example.story.d.ts → productSwitcher/components/AstralProductSwitcher/stories/BasicUsage.story.d.ts} +1 -1
- package/productSwitcher/components/AstralProductSwitcher/stories/{Example.story.js → BasicUsage.story.js} +1 -1
- package/productSwitcher/components/AstralProductSwitcher/utils/getFilteredProducts/getFilteredProducts.d.ts +1 -1
- package/productSwitcher/components/IdentityProductSwitcher/stories/{Example.story.d.ts → BasicUsage.story.d.ts} +1 -1
- package/productSwitcher/components/IdentityProductSwitcher/stories/{Example.story.js → BasicUsage.story.js} +1 -1
- package/productSwitcher/components/IdentityProductSwitcher/styles.d.ts +3 -3
- package/productSwitcher/components/IdentityProductSwitcher/styles.js +7 -4
- package/productSwitcher/utils/getGroupsProducts/getGroupsProducts.d.ts +1 -1
- package/productSwitcher/utils/getIdentityProducts/getIdentityProducts.d.ts +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ screen
|
|
|
64
64
|
|
|
65
65
|
import { autoSaveIndicatorInstance } from "@example/shared"
|
|
66
66
|
|
|
67
|
-
export const
|
|
67
|
+
export const BasicUsageScreen = observer(() => {
|
|
68
68
|
const [autoSaveIndicatorStore] = useState(autoSaveIndicatorStoreInstance);
|
|
69
69
|
|
|
70
70
|
useInitAutoSaveIndicatorStore(autoSaveIndicatorStore);
|
|
@@ -10,14 +10,9 @@ export type AstralProductSwitcherType = {
|
|
|
10
10
|
filterBy?: ProductFilterType;
|
|
11
11
|
/** Код для фильтрации */
|
|
12
12
|
code?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Идентификатор экосистемы
|
|
15
|
-
* @deprecated
|
|
16
|
-
* */
|
|
17
|
-
tenantId?: string;
|
|
18
13
|
/**
|
|
19
14
|
* Альтернативная функция для фильтрации продуктов
|
|
20
15
|
*/
|
|
21
16
|
filter?: ProductSwitcherProps['filter'];
|
|
22
17
|
};
|
|
23
|
-
export declare const AstralProductSwitcher: ({ identityUrl, filterBy, code, filter,
|
|
18
|
+
export declare const AstralProductSwitcher: ({ identityUrl, filterBy, code, filter, }: AstralProductSwitcherType) => JSX.Element;
|
|
@@ -13,22 +13,15 @@ exports.AstralProductSwitcher = void 0;
|
|
|
13
13
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
14
|
const ui_1 = require("@astral/ui");
|
|
15
15
|
const react_1 = require("react");
|
|
16
|
-
const utils_1 = require("../../utils");
|
|
17
16
|
const enums_1 = require("./enums");
|
|
18
|
-
const
|
|
19
|
-
const AstralProductSwitcher = ({ identityUrl, filterBy = enums_1.ProductFilterType.Tenant, code = 'astral', filter,
|
|
17
|
+
const utils_1 = require("./utils");
|
|
18
|
+
const AstralProductSwitcher = ({ identityUrl, filterBy = enums_1.ProductFilterType.Tenant, code = 'astral', filter, }) => {
|
|
20
19
|
const [products, setProducts] = (0, react_1.useState)([]);
|
|
21
20
|
const handleGetProducts = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
21
|
if (products.length) {
|
|
23
22
|
return products;
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
if (tenantId) {
|
|
27
|
-
const productsList = yield (0, utils_1.getIdentityProducts)(identityUrl, tenantId);
|
|
28
|
-
setProducts(productsList);
|
|
29
|
-
return productsList;
|
|
30
|
-
}
|
|
31
|
-
const filteredProductsList = yield (0, utils_2.getFilteredProducts)(identityUrl, filterBy, code);
|
|
24
|
+
const filteredProductsList = yield (0, utils_1.getFilteredProducts)(identityUrl, filterBy, code);
|
|
32
25
|
setProducts(filteredProductsList);
|
|
33
26
|
return filteredProductsList;
|
|
34
27
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BasicUsage = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const AstralProductSwitcher_1 = require("../AstralProductSwitcher");
|
|
6
6
|
const common_1 = require("./common");
|
|
7
7
|
const meta = {};
|
|
8
8
|
exports.default = meta;
|
|
9
|
-
const
|
|
10
|
-
exports.
|
|
9
|
+
const BasicUsage = () => ((0, jsx_runtime_1.jsx)(AstralProductSwitcher_1.AstralProductSwitcher, { identityUrl: common_1.IDENTITY_URL }));
|
|
10
|
+
exports.BasicUsage = BasicUsage;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param filterBy - тип фильтрации продуктов
|
|
5
5
|
* @param code - код-значение для фильтрации
|
|
6
6
|
*/
|
|
7
|
-
export declare const getFilteredProducts: (identityUrl: string, filterBy: string, code: string) => Promise<import("@astral/
|
|
7
|
+
export declare const getFilteredProducts: (identityUrl: string, filterBy: string, code: string) => Promise<import("@astral/ui").WidgetProduct[]>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BasicUsage = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const IdentityProductSwitcher_1 = require("../IdentityProductSwitcher");
|
|
6
6
|
const meta = {};
|
|
7
7
|
exports.default = meta;
|
|
8
|
-
const
|
|
9
|
-
exports.
|
|
8
|
+
const BasicUsage = () => (0, jsx_runtime_1.jsx)(IdentityProductSwitcher_1.IdentityProductSwitcher, { identityUrl: "" });
|
|
9
|
+
exports.BasicUsage = BasicUsage;
|
|
@@ -15,12 +15,12 @@ export declare const Logo: import("@emotion/styled").StyledComponent<{
|
|
|
15
15
|
theme?: import("@emotion/react").Theme | undefined;
|
|
16
16
|
as?: import("react").ElementType<any> | undefined;
|
|
17
17
|
}, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
18
|
-
export declare const ErrorContainer: import("@emotion/styled").StyledComponent<Omit<import("@astral/
|
|
18
|
+
export declare const ErrorContainer: import("@emotion/styled").StyledComponent<Omit<import("@astral/ui/src/components/Grid/GridComponent").GridComponentProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
|
|
19
19
|
theme?: import("@emotion/react").Theme | undefined;
|
|
20
|
-
} & import("@astral/
|
|
20
|
+
} & import("@astral/ui/src/components/Grid/styles").StyledGridProps, {}, {}>;
|
|
21
21
|
export declare const TenantsToggleButtonGroup: import("@emotion/styled").StyledComponent<Omit<import("@astral/ui").ToggleButtonGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
|
|
22
22
|
theme?: import("@emotion/react").Theme | undefined;
|
|
23
23
|
}, {}, {}>;
|
|
24
|
-
export declare const TenantToggleButton: import("@emotion/styled").StyledComponent<Omit<import("@astral/ui").ToggleButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
24
|
+
export declare const TenantToggleButton: import("@emotion/styled").StyledComponent<Omit<import("@astral/ui/src/components/ToggleButton/types").ToggleButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
25
25
|
theme?: import("@emotion/react").Theme | undefined;
|
|
26
26
|
}, {}, {}>;
|
|
@@ -17,14 +17,17 @@ exports.StyledMenu = (0, ui_1.styled)(ui_1.Menu) `
|
|
|
17
17
|
// as typeof MenuItem необходим для возможности прокинуть component
|
|
18
18
|
// https://github.com/mui/material-ui/issues/15695
|
|
19
19
|
exports.StyledMenuItem = (0, ui_1.styled)(ui_1.MenuItem) `
|
|
20
|
-
|
|
20
|
+
&.MuiMenuItem-gutters {
|
|
21
|
+
min-height: 56px;
|
|
22
|
+
padding-left: ${({ theme }) => theme.spacing(4)};
|
|
23
|
+
}
|
|
21
24
|
`;
|
|
22
25
|
exports.Logo = (0, ui_1.styled)('img', {
|
|
23
26
|
shouldForwardProp: (prop) => prop !== 'color',
|
|
24
27
|
}) `
|
|
25
|
-
width:
|
|
26
|
-
height:
|
|
27
|
-
margin-right: ${({ theme }) => theme.spacing(
|
|
28
|
+
width: 32px;
|
|
29
|
+
height: 32px;
|
|
30
|
+
margin-right: ${({ theme }) => theme.spacing(2)};
|
|
28
31
|
|
|
29
32
|
background-color: ${({ color }) => color};
|
|
30
33
|
border-radius: ${({ theme }) => theme.shape.small};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param identityUrl - адрес identity
|
|
4
4
|
* @param group - код группы
|
|
5
5
|
*/
|
|
6
|
-
export declare const getGroupsProducts: (identityUrl: string, group: string) => Promise<import("@astral/
|
|
6
|
+
export declare const getGroupsProducts: (identityUrl: string, group: string) => Promise<import("@astral/ui").WidgetProduct[]>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param identityUrl - адрес identity
|
|
4
4
|
* @param tenant - код экосистемы
|
|
5
5
|
*/
|
|
6
|
-
export declare const getIdentityProducts: (identityUrl: string, tenant?: string) => Promise<import("@astral/
|
|
6
|
+
export declare const getIdentityProducts: (identityUrl: string, tenant?: string) => Promise<import("@astral/ui").WidgetProduct[]>;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astral/features",
|
|
3
3
|
"main": "./node/index.js",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.1",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@astral/ui": "4.0.
|
|
6
|
+
"@astral/ui": "4.0.1",
|
|
7
7
|
"mobx": "^6.8.0",
|
|
8
8
|
"mobx-react-lite": "^3.4.0",
|
|
9
9
|
"@astral/cryptopro-cades": "^1.5.1"
|
|
@@ -10,14 +10,9 @@ export type AstralProductSwitcherType = {
|
|
|
10
10
|
filterBy?: ProductFilterType;
|
|
11
11
|
/** Код для фильтрации */
|
|
12
12
|
code?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Идентификатор экосистемы
|
|
15
|
-
* @deprecated
|
|
16
|
-
* */
|
|
17
|
-
tenantId?: string;
|
|
18
13
|
/**
|
|
19
14
|
* Альтернативная функция для фильтрации продуктов
|
|
20
15
|
*/
|
|
21
16
|
filter?: ProductSwitcherProps['filter'];
|
|
22
17
|
};
|
|
23
|
-
export declare const AstralProductSwitcher: ({ identityUrl, filterBy, code, filter,
|
|
18
|
+
export declare const AstralProductSwitcher: ({ identityUrl, filterBy, code, filter, }: AstralProductSwitcherType) => JSX.Element;
|
|
@@ -10,21 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { ProductSwitcher, } from '@astral/ui';
|
|
12
12
|
import { useState } from 'react';
|
|
13
|
-
import { getIdentityProducts } from '../../utils';
|
|
14
13
|
import { ProductFilterType } from './enums';
|
|
15
14
|
import { getFilteredProducts } from './utils';
|
|
16
|
-
export const AstralProductSwitcher = ({ identityUrl, filterBy = ProductFilterType.Tenant, code = 'astral', filter,
|
|
15
|
+
export const AstralProductSwitcher = ({ identityUrl, filterBy = ProductFilterType.Tenant, code = 'astral', filter, }) => {
|
|
17
16
|
const [products, setProducts] = useState([]);
|
|
18
17
|
const handleGetProducts = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
18
|
if (products.length) {
|
|
20
19
|
return products;
|
|
21
20
|
}
|
|
22
|
-
// Это заглушка для обратной совместимости, убрать после релиза мажорной версии
|
|
23
|
-
if (tenantId) {
|
|
24
|
-
const productsList = yield getIdentityProducts(identityUrl, tenantId);
|
|
25
|
-
setProducts(productsList);
|
|
26
|
-
return productsList;
|
|
27
|
-
}
|
|
28
21
|
const filteredProductsList = yield getFilteredProducts(identityUrl, filterBy, code);
|
|
29
22
|
setProducts(filteredProductsList);
|
|
30
23
|
return filteredProductsList;
|
|
@@ -3,4 +3,4 @@ import { AstralProductSwitcher } from '../AstralProductSwitcher';
|
|
|
3
3
|
import { IDENTITY_URL } from './common';
|
|
4
4
|
const meta = {};
|
|
5
5
|
export default meta;
|
|
6
|
-
export const
|
|
6
|
+
export const BasicUsage = () => (_jsx(AstralProductSwitcher, { identityUrl: IDENTITY_URL }));
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param filterBy - тип фильтрации продуктов
|
|
5
5
|
* @param code - код-значение для фильтрации
|
|
6
6
|
*/
|
|
7
|
-
export declare const getFilteredProducts: (identityUrl: string, filterBy: string, code: string) => Promise<import("@astral/
|
|
7
|
+
export declare const getFilteredProducts: (identityUrl: string, filterBy: string, code: string) => Promise<import("@astral/ui").WidgetProduct[]>;
|
|
@@ -2,4 +2,4 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { IdentityProductSwitcher } from '../IdentityProductSwitcher';
|
|
3
3
|
const meta = {};
|
|
4
4
|
export default meta;
|
|
5
|
-
export const
|
|
5
|
+
export const BasicUsage = () => _jsx(IdentityProductSwitcher, { identityUrl: "" });
|
|
@@ -15,12 +15,12 @@ export declare const Logo: import("@emotion/styled").StyledComponent<{
|
|
|
15
15
|
theme?: import("@emotion/react").Theme | undefined;
|
|
16
16
|
as?: import("react").ElementType<any> | undefined;
|
|
17
17
|
}, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
18
|
-
export declare const ErrorContainer: import("@emotion/styled").StyledComponent<Omit<import("@astral/
|
|
18
|
+
export declare const ErrorContainer: import("@emotion/styled").StyledComponent<Omit<import("@astral/ui/src/components/Grid/GridComponent").GridComponentProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
|
|
19
19
|
theme?: import("@emotion/react").Theme | undefined;
|
|
20
|
-
} & import("@astral/
|
|
20
|
+
} & import("@astral/ui/src/components/Grid/styles").StyledGridProps, {}, {}>;
|
|
21
21
|
export declare const TenantsToggleButtonGroup: import("@emotion/styled").StyledComponent<Omit<import("@astral/ui").ToggleButtonGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
|
|
22
22
|
theme?: import("@emotion/react").Theme | undefined;
|
|
23
23
|
}, {}, {}>;
|
|
24
|
-
export declare const TenantToggleButton: import("@emotion/styled").StyledComponent<Omit<import("@astral/ui").ToggleButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
24
|
+
export declare const TenantToggleButton: import("@emotion/styled").StyledComponent<Omit<import("@astral/ui/src/components/ToggleButton/types").ToggleButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
25
25
|
theme?: import("@emotion/react").Theme | undefined;
|
|
26
26
|
}, {}, {}>;
|
|
@@ -14,14 +14,17 @@ export const StyledMenu = styled(Menu) `
|
|
|
14
14
|
// as typeof MenuItem необходим для возможности прокинуть component
|
|
15
15
|
// https://github.com/mui/material-ui/issues/15695
|
|
16
16
|
export const StyledMenuItem = styled(MenuItem) `
|
|
17
|
-
|
|
17
|
+
&.MuiMenuItem-gutters {
|
|
18
|
+
min-height: 56px;
|
|
19
|
+
padding-left: ${({ theme }) => theme.spacing(4)};
|
|
20
|
+
}
|
|
18
21
|
`;
|
|
19
22
|
export const Logo = styled('img', {
|
|
20
23
|
shouldForwardProp: (prop) => prop !== 'color',
|
|
21
24
|
}) `
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
24
|
-
margin-right: ${({ theme }) => theme.spacing(
|
|
25
|
+
width: 32px;
|
|
26
|
+
height: 32px;
|
|
27
|
+
margin-right: ${({ theme }) => theme.spacing(2)};
|
|
25
28
|
|
|
26
29
|
background-color: ${({ color }) => color};
|
|
27
30
|
border-radius: ${({ theme }) => theme.shape.small};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param identityUrl - адрес identity
|
|
4
4
|
* @param group - код группы
|
|
5
5
|
*/
|
|
6
|
-
export declare const getGroupsProducts: (identityUrl: string, group: string) => Promise<import("@astral/
|
|
6
|
+
export declare const getGroupsProducts: (identityUrl: string, group: string) => Promise<import("@astral/ui").WidgetProduct[]>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param identityUrl - адрес identity
|
|
4
4
|
* @param tenant - код экосистемы
|
|
5
5
|
*/
|
|
6
|
-
export declare const getIdentityProducts: (identityUrl: string, tenant?: string) => Promise<import("@astral/
|
|
6
|
+
export declare const getIdentityProducts: (identityUrl: string, tenant?: string) => Promise<import("@astral/ui").WidgetProduct[]>;
|