@astral/features 4.0.0-alpha.21 → 4.0.0-alpha.22

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.
@@ -10,9 +10,14 @@ export type AstralProductSwitcherType = {
10
10
  filterBy?: ProductFilterType;
11
11
  /** Код для фильтрации */
12
12
  code?: string;
13
+ /**
14
+ * Идентификатор экосистемы
15
+ * @deprecated
16
+ * */
17
+ tenantId?: string;
13
18
  /**
14
19
  * Альтернативная функция для фильтрации продуктов
15
20
  */
16
21
  filter?: ProductSwitcherProps['filter'];
17
22
  };
18
- export declare const AstralProductSwitcher: ({ identityUrl, filterBy, code, filter, }: AstralProductSwitcherType) => JSX.Element;
23
+ export declare const AstralProductSwitcher: ({ identityUrl, filterBy, code, filter, tenantId, }: AstralProductSwitcherType) => JSX.Element;
@@ -13,15 +13,22 @@ 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");
16
17
  const enums_1 = require("./enums");
17
- const utils_1 = require("./utils");
18
- const AstralProductSwitcher = ({ identityUrl, filterBy = enums_1.ProductFilterType.Tenant, code = 'astral', filter, }) => {
18
+ const utils_2 = require("./utils");
19
+ const AstralProductSwitcher = ({ identityUrl, filterBy = enums_1.ProductFilterType.Tenant, code = 'astral', filter, tenantId, }) => {
19
20
  const [products, setProducts] = (0, react_1.useState)([]);
20
21
  const handleGetProducts = () => __awaiter(void 0, void 0, void 0, function* () {
21
22
  if (products.length) {
22
23
  return products;
23
24
  }
24
- const filteredProductsList = yield (0, utils_1.getFilteredProducts)(identityUrl, filterBy, code);
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);
25
32
  setProducts(filteredProductsList);
26
33
  return filteredProductsList;
27
34
  });
@@ -17,17 +17,14 @@ 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
- &.MuiMenuItem-gutters {
21
- min-height: 56px;
22
- padding-left: ${({ theme }) => theme.spacing(4)};
23
- }
20
+ padding-left: ${({ theme }) => theme.spacing(6)};
24
21
  `;
25
22
  exports.Logo = (0, ui_1.styled)('img', {
26
23
  shouldForwardProp: (prop) => prop !== 'color',
27
24
  }) `
28
- width: 32px;
29
- height: 32px;
30
- margin-right: ${({ theme }) => theme.spacing(2)};
25
+ width: 40px;
26
+ height: 40px;
27
+ margin-right: ${({ theme }) => theme.spacing(4)};
31
28
 
32
29
  background-color: ${({ color }) => color};
33
30
  border-radius: ${({ theme }) => theme.shape.small};
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.0-alpha.21",
4
+ "version": "4.0.0-alpha.22",
5
5
  "dependencies": {
6
- "@astral/ui": "4.0.0-alpha.21",
6
+ "@astral/ui": "4.0.0-alpha.22",
7
7
  "mobx": "^6.8.0",
8
8
  "mobx-react-lite": "^3.4.0",
9
9
  "@astral/cryptopro-cades": "^1.5.1"
@@ -10,9 +10,14 @@ export type AstralProductSwitcherType = {
10
10
  filterBy?: ProductFilterType;
11
11
  /** Код для фильтрации */
12
12
  code?: string;
13
+ /**
14
+ * Идентификатор экосистемы
15
+ * @deprecated
16
+ * */
17
+ tenantId?: string;
13
18
  /**
14
19
  * Альтернативная функция для фильтрации продуктов
15
20
  */
16
21
  filter?: ProductSwitcherProps['filter'];
17
22
  };
18
- export declare const AstralProductSwitcher: ({ identityUrl, filterBy, code, filter, }: AstralProductSwitcherType) => JSX.Element;
23
+ export declare const AstralProductSwitcher: ({ identityUrl, filterBy, code, filter, tenantId, }: AstralProductSwitcherType) => JSX.Element;
@@ -10,14 +10,21 @@ 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';
13
14
  import { ProductFilterType } from './enums';
14
15
  import { getFilteredProducts } from './utils';
15
- export const AstralProductSwitcher = ({ identityUrl, filterBy = ProductFilterType.Tenant, code = 'astral', filter, }) => {
16
+ export const AstralProductSwitcher = ({ identityUrl, filterBy = ProductFilterType.Tenant, code = 'astral', filter, tenantId, }) => {
16
17
  const [products, setProducts] = useState([]);
17
18
  const handleGetProducts = () => __awaiter(void 0, void 0, void 0, function* () {
18
19
  if (products.length) {
19
20
  return products;
20
21
  }
22
+ // Это заглушка для обратной совместимости, убрать после релиза мажорной версии
23
+ if (tenantId) {
24
+ const productsList = yield getIdentityProducts(identityUrl, tenantId);
25
+ setProducts(productsList);
26
+ return productsList;
27
+ }
21
28
  const filteredProductsList = yield getFilteredProducts(identityUrl, filterBy, code);
22
29
  setProducts(filteredProductsList);
23
30
  return filteredProductsList;
@@ -14,17 +14,14 @@ 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
- &.MuiMenuItem-gutters {
18
- min-height: 56px;
19
- padding-left: ${({ theme }) => theme.spacing(4)};
20
- }
17
+ padding-left: ${({ theme }) => theme.spacing(6)};
21
18
  `;
22
19
  export const Logo = styled('img', {
23
20
  shouldForwardProp: (prop) => prop !== 'color',
24
21
  }) `
25
- width: 32px;
26
- height: 32px;
27
- margin-right: ${({ theme }) => theme.spacing(2)};
22
+ width: 40px;
23
+ height: 40px;
24
+ margin-right: ${({ theme }) => theme.spacing(4)};
28
25
 
29
26
  background-color: ${({ color }) => color};
30
27
  border-radius: ${({ theme }) => theme.shape.small};