@astral/features 4.0.0-alpha.8 → 4.0.0

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.
Files changed (63) hide show
  1. package/node/productSwitcher/components/AstralProductSwitcher/AstralProductSwitcher.d.ts +1 -6
  2. package/node/productSwitcher/components/AstralProductSwitcher/AstralProductSwitcher.js +3 -10
  3. package/node/productSwitcher/components/AstralProductSwitcher/stories/Example.story.d.ts +5 -0
  4. package/node/productSwitcher/components/AstralProductSwitcher/stories/Example.story.js +10 -0
  5. package/node/productSwitcher/components/AstralProductSwitcher/stories/Group.story.d.ts +8 -0
  6. package/node/productSwitcher/components/AstralProductSwitcher/stories/Group.story.js +14 -0
  7. package/node/productSwitcher/components/AstralProductSwitcher/stories/Interaction.story.d.ts +6 -0
  8. package/node/productSwitcher/components/AstralProductSwitcher/stories/Interaction.story.js +19 -0
  9. package/node/productSwitcher/components/AstralProductSwitcher/stories/Tenant.story.d.ts +8 -0
  10. package/node/productSwitcher/components/AstralProductSwitcher/stories/Tenant.story.js +14 -0
  11. package/node/productSwitcher/components/AstralProductSwitcher/stories/common/index.d.ts +2 -0
  12. package/node/productSwitcher/components/AstralProductSwitcher/stories/common/index.js +18 -0
  13. package/node/productSwitcher/components/AstralProductSwitcher/stories/common/mockData.d.ts +27 -0
  14. package/node/productSwitcher/components/AstralProductSwitcher/stories/common/mockData.js +119 -0
  15. package/node/productSwitcher/components/AstralProductSwitcher/stories/common/mockResponses.d.ts +59 -0
  16. package/node/productSwitcher/components/AstralProductSwitcher/stories/common/mockResponses.js +54 -0
  17. package/node/productSwitcher/components/AstralProductSwitcher/utils/getFilteredProducts/getFilteredProducts.d.ts +1 -1
  18. package/node/productSwitcher/components/IdentityProductSwitcher/stories/Example.story.d.ts +5 -0
  19. package/node/productSwitcher/components/IdentityProductSwitcher/stories/Example.story.js +9 -0
  20. package/node/productSwitcher/components/IdentityProductSwitcher/stories/Interaction.story.d.ts +6 -0
  21. package/node/productSwitcher/components/IdentityProductSwitcher/stories/Interaction.story.js +16 -0
  22. package/node/productSwitcher/components/IdentityProductSwitcher/stories/common/index.d.ts +2 -0
  23. package/node/productSwitcher/components/IdentityProductSwitcher/stories/common/index.js +18 -0
  24. package/node/productSwitcher/components/IdentityProductSwitcher/stories/common/mockData.d.ts +27 -0
  25. package/node/productSwitcher/components/IdentityProductSwitcher/stories/common/mockData.js +119 -0
  26. package/node/productSwitcher/components/IdentityProductSwitcher/stories/common/mockResponses.d.ts +47 -0
  27. package/node/productSwitcher/components/IdentityProductSwitcher/stories/common/mockResponses.js +58 -0
  28. package/node/productSwitcher/components/IdentityProductSwitcher/styles.d.ts +3 -3
  29. package/node/productSwitcher/components/IdentityProductSwitcher/styles.js +7 -4
  30. package/node/productSwitcher/utils/getGroupsProducts/getGroupsProducts.d.ts +1 -1
  31. package/node/productSwitcher/utils/getIdentityProducts/getIdentityProducts.d.ts +1 -1
  32. package/package.json +2 -2
  33. package/productSwitcher/components/AstralProductSwitcher/AstralProductSwitcher.d.ts +1 -6
  34. package/productSwitcher/components/AstralProductSwitcher/AstralProductSwitcher.js +1 -8
  35. package/productSwitcher/components/AstralProductSwitcher/stories/Example.story.d.ts +5 -0
  36. package/productSwitcher/components/AstralProductSwitcher/stories/Example.story.js +6 -0
  37. package/productSwitcher/components/AstralProductSwitcher/stories/Group.story.d.ts +8 -0
  38. package/productSwitcher/components/AstralProductSwitcher/stories/Group.story.js +10 -0
  39. package/productSwitcher/components/AstralProductSwitcher/stories/Interaction.story.d.ts +6 -0
  40. package/productSwitcher/components/AstralProductSwitcher/stories/Interaction.story.js +16 -0
  41. package/productSwitcher/components/AstralProductSwitcher/stories/Tenant.story.d.ts +8 -0
  42. package/productSwitcher/components/AstralProductSwitcher/stories/Tenant.story.js +10 -0
  43. package/productSwitcher/components/AstralProductSwitcher/stories/common/index.d.ts +2 -0
  44. package/productSwitcher/components/AstralProductSwitcher/stories/common/index.js +2 -0
  45. package/productSwitcher/components/AstralProductSwitcher/stories/common/mockData.d.ts +27 -0
  46. package/productSwitcher/components/AstralProductSwitcher/stories/common/mockData.js +116 -0
  47. package/productSwitcher/components/AstralProductSwitcher/stories/common/mockResponses.d.ts +59 -0
  48. package/productSwitcher/components/AstralProductSwitcher/stories/common/mockResponses.js +50 -0
  49. package/productSwitcher/components/AstralProductSwitcher/utils/getFilteredProducts/getFilteredProducts.d.ts +1 -1
  50. package/productSwitcher/components/IdentityProductSwitcher/stories/Example.story.d.ts +5 -0
  51. package/productSwitcher/components/IdentityProductSwitcher/stories/Example.story.js +5 -0
  52. package/productSwitcher/components/IdentityProductSwitcher/stories/Interaction.story.d.ts +6 -0
  53. package/productSwitcher/components/IdentityProductSwitcher/stories/Interaction.story.js +13 -0
  54. package/productSwitcher/components/IdentityProductSwitcher/stories/common/index.d.ts +2 -0
  55. package/productSwitcher/components/IdentityProductSwitcher/stories/common/index.js +2 -0
  56. package/productSwitcher/components/IdentityProductSwitcher/stories/common/mockData.d.ts +27 -0
  57. package/productSwitcher/components/IdentityProductSwitcher/stories/common/mockData.js +116 -0
  58. package/productSwitcher/components/IdentityProductSwitcher/stories/common/mockResponses.d.ts +47 -0
  59. package/productSwitcher/components/IdentityProductSwitcher/stories/common/mockResponses.js +54 -0
  60. package/productSwitcher/components/IdentityProductSwitcher/styles.d.ts +3 -3
  61. package/productSwitcher/components/IdentityProductSwitcher/styles.js +7 -4
  62. package/productSwitcher/utils/getGroupsProducts/getGroupsProducts.d.ts +1 -1
  63. package/productSwitcher/utils/getIdentityProducts/getIdentityProducts.d.ts +1 -1
@@ -0,0 +1,47 @@
1
+ import type { MockRequest } from './mockData';
2
+ export declare const createProductsMockResponse: ({ searchParams }: MockRequest) => {
3
+ data: {
4
+ id: string;
5
+ name: string;
6
+ productUrl: string;
7
+ description: string;
8
+ shortDescription: string;
9
+ iconFileId: string;
10
+ logoUrl: string;
11
+ backgroundHexColor: string;
12
+ tenantId: string;
13
+ }[];
14
+ meta: {
15
+ totalCount: number;
16
+ };
17
+ };
18
+ export declare const MOCK_FETCH_IDENTITY_PRODUCTS: {
19
+ url: string;
20
+ method: string;
21
+ status: number;
22
+ response: ({ searchParams }: MockRequest) => {
23
+ data: {
24
+ id: string;
25
+ name: string;
26
+ productUrl: string;
27
+ description: string;
28
+ shortDescription: string;
29
+ iconFileId: string;
30
+ logoUrl: string;
31
+ backgroundHexColor: string;
32
+ tenantId: string;
33
+ }[];
34
+ meta: {
35
+ totalCount: number;
36
+ };
37
+ };
38
+ }[];
39
+ export declare const MOCK_FETCH_IDENTITY_TENANTS: {
40
+ url: string;
41
+ method: string;
42
+ status: number;
43
+ response: {
44
+ id: string;
45
+ name: string;
46
+ }[];
47
+ }[];
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MOCK_FETCH_IDENTITY_TENANTS = exports.MOCK_FETCH_IDENTITY_PRODUCTS = exports.createProductsMockResponse = void 0;
4
+ const mockData_1 = require("./mockData");
5
+ const createProductsMockResponse = ({ searchParams }) => {
6
+ switch (searchParams.tenantId) {
7
+ case 'astral': {
8
+ return {
9
+ data: mockData_1.ASTRAL_PRODUCTS,
10
+ meta: {
11
+ totalCount: mockData_1.ASTRAL_PRODUCTS.length,
12
+ },
13
+ };
14
+ }
15
+ case 'eco': {
16
+ return {
17
+ data: mockData_1.ECO_PRODUCTS,
18
+ meta: {
19
+ totalCount: mockData_1.ECO_PRODUCTS.length,
20
+ },
21
+ };
22
+ }
23
+ default: {
24
+ return {
25
+ data: [],
26
+ meta: {
27
+ totalCount: 0,
28
+ },
29
+ };
30
+ }
31
+ }
32
+ };
33
+ exports.createProductsMockResponse = createProductsMockResponse;
34
+ exports.MOCK_FETCH_IDENTITY_PRODUCTS = [
35
+ {
36
+ url: `${mockData_1.IDENTITY_URL}/api/products/widget?tenantId=*`,
37
+ method: 'GET',
38
+ status: 200,
39
+ response: exports.createProductsMockResponse,
40
+ },
41
+ ];
42
+ exports.MOCK_FETCH_IDENTITY_TENANTS = [
43
+ {
44
+ url: `${mockData_1.IDENTITY_URL}/api/tenants/widget`,
45
+ method: 'GET',
46
+ status: 200,
47
+ response: [
48
+ {
49
+ id: 'astral',
50
+ name: 'Астрал',
51
+ },
52
+ {
53
+ id: 'eco',
54
+ name: 'Экосистема',
55
+ },
56
+ ],
57
+ },
58
+ ];
@@ -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/components/src/Grid/GridComponent").GridComponentProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
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/components/src/Grid/styles").StyledGridProps, {}, {}>;
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
- padding-left: ${({ theme }) => theme.spacing(6)};
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: 40px;
26
- height: 40px;
27
- margin-right: ${({ theme }) => theme.spacing(4)};
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/components").WidgetProduct[]>;
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/components").WidgetProduct[]>;
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.0-alpha.8",
4
+ "version": "4.0.0",
5
5
  "dependencies": {
6
- "@astral/ui": "4.0.0-alpha.8",
6
+ "@astral/ui": "4.0.0",
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, tenantId, }: AstralProductSwitcherType) => JSX.Element;
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, tenantId, }) => {
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;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { type Meta } from '@storybook/react-vite';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ export declare const Example: () => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AstralProductSwitcher } from '../AstralProductSwitcher';
3
+ import { IDENTITY_URL } from './common';
4
+ const meta = {};
5
+ export default meta;
6
+ export const Example = () => (_jsx(AstralProductSwitcher, { identityUrl: IDENTITY_URL }));
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { type Meta } from '@storybook/react-vite';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ /**
6
+ * Чтобы получить список продуктов, отфильтрованных по группам, необходимо указать параметр ```filterBy``` в значение ```group``` и указать параметр ```code```, равный ```коду вашей группы```
7
+ */
8
+ export declare const Group: () => JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AstralProductSwitcher } from '../AstralProductSwitcher';
3
+ import { ProductFilterType } from '../enums';
4
+ import { IDENTITY_URL } from './common';
5
+ const meta = {};
6
+ export default meta;
7
+ /**
8
+ * Чтобы получить список продуктов, отфильтрованных по группам, необходимо указать параметр ```filterBy``` в значение ```group``` и указать параметр ```code```, равный ```коду вашей группы```
9
+ */
10
+ export const Group = () => (_jsx(AstralProductSwitcher, { identityUrl: IDENTITY_URL, filterBy: ProductFilterType.Group, code: "identityGroupID" }));
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import type { AstralProductSwitcher } from '../AstralProductSwitcher';
3
+ declare const meta: Meta<typeof AstralProductSwitcher>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof AstralProductSwitcher>;
6
+ export declare const Interaction: Story;
@@ -0,0 +1,16 @@
1
+ import { ProductFilterType } from '../enums';
2
+ import { IDENTITY_URL } from './common';
3
+ const meta = {};
4
+ export default meta;
5
+ export const Interaction = {
6
+ args: {
7
+ identityUrl: IDENTITY_URL,
8
+ filterBy: ProductFilterType.Tenant,
9
+ code: 'astral',
10
+ },
11
+ parameters: {
12
+ docs: {
13
+ disable: true,
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { type Meta } from '@storybook/react-vite';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ /**
6
+ * Чтобы получить список продуктов, отфильтрованных по экосистемам, необходимо указать параметр ```filterBy``` в значение ```tenant``` и указать параметр ```code```, равный ```коду вашей экосистемы```
7
+ */
8
+ export declare const Tenant: () => JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AstralProductSwitcher } from '../AstralProductSwitcher';
3
+ import { ProductFilterType } from '../enums';
4
+ import { IDENTITY_URL } from './common';
5
+ const meta = {};
6
+ export default meta;
7
+ /**
8
+ * Чтобы получить список продуктов, отфильтрованных по экосистемам, необходимо указать параметр ```filterBy``` в значение ```tenant``` и указать параметр ```code```, равный ```коду вашей экосистемы```
9
+ */
10
+ export const Tenant = () => (_jsx(AstralProductSwitcher, { identityUrl: IDENTITY_URL, filterBy: ProductFilterType.Tenant, code: "eco" }));
@@ -0,0 +1,2 @@
1
+ export * from './mockData';
2
+ export * from './mockResponses';
@@ -0,0 +1,2 @@
1
+ export * from './mockData';
2
+ export * from './mockResponses';
@@ -0,0 +1,27 @@
1
+ export declare const IDENTITY_URL = "https://identity";
2
+ export declare const MOCK_IMAGE = "data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik04LjI1NzE5IDE3LjI2ODlDOC4yNTcxOSAxNy4yNjg5IDQuNTY5MzMgMjAuMjAyMyA0LjExODcyIDIyLjA3OTZDMi43NjA3OCAyNy43MzY5IDEzLjQwNTkgMjAuOTM3NyAxNy45Njg3IDE3LjUxMDZDMTkuMjMwNCAxNi41NjI5I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+CjxwYXRoIGQ9Ik04LjUgOC41QzguNSA5LjMyODQzIDcuODI4NDMgMTAgNyAxMEM2LjE3MTU3IDEwIDUuNSA5LjMyODQzIDUuNSA4LjVDNS41IDcuNjcxNTcgNi4xNzE1NyA3IDcgN0M3LjgyODQzIDcgOC41IDcuNjcxNTcgOC41IDguNVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=";
3
+ export type MockRequest = {
4
+ searchParams: Record<string, string>;
5
+ };
6
+ export declare const ASTRAL_PRODUCTS: {
7
+ id: string;
8
+ name: string;
9
+ productUrl: string;
10
+ description: string;
11
+ shortDescription: string;
12
+ iconFileId: string;
13
+ logoUrl: string;
14
+ backgroundHexColor: string;
15
+ tenantId: string;
16
+ }[];
17
+ export declare const ECO_PRODUCTS: {
18
+ id: string;
19
+ name: string;
20
+ productUrl: string;
21
+ description: string;
22
+ shortDescription: string;
23
+ iconFileId: string;
24
+ logoUrl: string;
25
+ backgroundHexColor: string;
26
+ tenantId: string;
27
+ }[];
@@ -0,0 +1,116 @@
1
+ export const IDENTITY_URL = 'https://identity';
2
+ export const MOCK_IMAGE = 'data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik04LjI1NzE5IDE3LjI2ODlDOC4yNTcxOSAxNy4yNjg5IDQuNTY5MzMgMjAuMjAyMyA0LjExODcyIDIyLjA3OTZDMi43NjA3OCAyNy43MzY5IDEzLjQwNTkgMjAuOTM3NyAxNy45Njg3IDE3LjUxMDZDMTkuMjMwNCAxNi41NjI5IDIxLjAyNTggMTUuMTIwOSAyMi43MDE4IDEzLjYwNTlMMjIuOTExOSAxMy40NzQxQzIyLjkwNjQgMTM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IDUuNSA5LjMyODQzIDUuNSA4LjVDNS41IDcuNjcxNTcgNi4xNzE1NyA3IDcgN0M3LjgyODQzIDcgOC41IDcuNjcxNTcgOC41IDguNVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=';
3
+ export const ASTRAL_PRODUCTS = [
4
+ {
5
+ id: '1',
6
+ name: 'Астрал Отчет 5.0',
7
+ productUrl: 'https://product1',
8
+ description: 'Астрал.Продукт 1',
9
+ shortDescription: 'Астрал.Продукт 1',
10
+ iconFileId: '1',
11
+ logoUrl: MOCK_IMAGE,
12
+ backgroundHexColor: '#2e77ff',
13
+ tenantId: 'astral',
14
+ },
15
+ {
16
+ id: '2',
17
+ name: 'Астрал.ЭДО',
18
+ productUrl: 'https://product2',
19
+ description: 'Астрал.Продукт2',
20
+ shortDescription: 'Астрал.Продукт2',
21
+ iconFileId: '2',
22
+ logoUrl: MOCK_IMAGE,
23
+ backgroundHexColor: '#33adf2',
24
+ tenantId: 'astral',
25
+ },
26
+ {
27
+ id: '3',
28
+ name: 'Астрал iKЭДО',
29
+ productUrl: 'https://product3',
30
+ description: 'Астрал.Продукт3',
31
+ shortDescription: 'Астрал.Продукт3',
32
+ iconFileId: '3',
33
+ logoUrl: MOCK_IMAGE,
34
+ backgroundHexColor: '#755afd',
35
+ tenantId: 'astral',
36
+ },
37
+ {
38
+ id: '4',
39
+ name: 'Астрал.ОФД',
40
+ productUrl: 'https://product4',
41
+ description: 'Астрал.Продукт4',
42
+ shortDescription: 'Астрал.Продукт4',
43
+ iconFileId: '4',
44
+ logoUrl: MOCK_IMAGE,
45
+ backgroundHexColor: '#00b2ff',
46
+ tenantId: 'astral',
47
+ },
48
+ {
49
+ id: '5',
50
+ name: 'Астрал Доверенность',
51
+ productUrl: 'https://product5',
52
+ description: 'Астрал.Продукт5',
53
+ shortDescription: 'Астрал.Продукт5',
54
+ iconFileId: '5',
55
+ logoUrl: MOCK_IMAGE,
56
+ backgroundHexColor: '#7856ff',
57
+ tenantId: 'astral',
58
+ },
59
+ {
60
+ id: '6',
61
+ name: 'Личный Кабинет',
62
+ productUrl: 'https://product4',
63
+ description: 'Астрал.Продукт6',
64
+ shortDescription: 'Астрал.Продукт6',
65
+ iconFileId: '6',
66
+ logoUrl: MOCK_IMAGE,
67
+ backgroundHexColor: '#00b2ff',
68
+ tenantId: 'astral',
69
+ },
70
+ {
71
+ id: '7',
72
+ name: 'Личный Кабинет Партнёра',
73
+ productUrl: 'https://product5',
74
+ description: 'Астрал.Продукт7',
75
+ shortDescription: 'Астрал.Продукт7',
76
+ iconFileId: '7',
77
+ logoUrl: MOCK_IMAGE,
78
+ backgroundHexColor: '#7856ff',
79
+ tenantId: 'astral',
80
+ },
81
+ ];
82
+ export const ECO_PRODUCTS = [
83
+ {
84
+ id: '6',
85
+ name: 'Экосистема-Продукт 1',
86
+ productUrl: 'https://eco1',
87
+ description: 'Экосистема-Продукт1',
88
+ shortDescription: 'Экосистема-Продукт1',
89
+ iconFileId: 'test',
90
+ logoUrl: MOCK_IMAGE,
91
+ backgroundHexColor: '#2e77ff',
92
+ tenantId: 'eco',
93
+ },
94
+ {
95
+ id: '7',
96
+ name: 'Экосистема-Продукт 2',
97
+ productUrl: 'https://eco2',
98
+ description: 'Экосистема-Продукт2',
99
+ shortDescription: 'Экосистема-Продукт2',
100
+ iconFileId: 'test',
101
+ logoUrl: MOCK_IMAGE,
102
+ backgroundHexColor: '#7756FF',
103
+ tenantId: 'eco',
104
+ },
105
+ {
106
+ id: '8',
107
+ name: 'Экосистема-Продукт 3',
108
+ productUrl: 'https://eco3',
109
+ description: 'Экосистема-Продукт3',
110
+ shortDescription: 'Экосистема-Продукт3',
111
+ iconFileId: 'test',
112
+ logoUrl: MOCK_IMAGE,
113
+ backgroundHexColor: '#0397b3',
114
+ tenantId: 'eco',
115
+ },
116
+ ];
@@ -0,0 +1,59 @@
1
+ import type { MockRequest } from './mockData';
2
+ export declare const createProductsMockResponse: ({ searchParams }: MockRequest) => {
3
+ data: {
4
+ id: string;
5
+ name: string;
6
+ productUrl: string;
7
+ description: string;
8
+ shortDescription: string;
9
+ iconFileId: string;
10
+ logoUrl: string;
11
+ backgroundHexColor: string;
12
+ tenantId: string;
13
+ }[];
14
+ meta: {
15
+ totalCount: number;
16
+ };
17
+ };
18
+ export declare const MOCK_FETCH_IDENTITY_PRODUCTS: {
19
+ url: string;
20
+ method: string;
21
+ status: number;
22
+ response: ({ searchParams }: MockRequest) => {
23
+ data: {
24
+ id: string;
25
+ name: string;
26
+ productUrl: string;
27
+ description: string;
28
+ shortDescription: string;
29
+ iconFileId: string;
30
+ logoUrl: string;
31
+ backgroundHexColor: string;
32
+ tenantId: string;
33
+ }[];
34
+ meta: {
35
+ totalCount: number;
36
+ };
37
+ };
38
+ }[];
39
+ export declare const MOCK_FETCH_IDENTITY_GROUPS: {
40
+ url: string;
41
+ method: string;
42
+ status: number;
43
+ response: {
44
+ data: {
45
+ id: string;
46
+ name: string;
47
+ productUrl: string;
48
+ description: string;
49
+ shortDescription: string;
50
+ iconFileId: string;
51
+ logoUrl: string;
52
+ backgroundHexColor: string;
53
+ tenantId: string;
54
+ }[];
55
+ meta: {
56
+ totalCount: number;
57
+ };
58
+ };
59
+ }[];
@@ -0,0 +1,50 @@
1
+ import { ASTRAL_PRODUCTS, ECO_PRODUCTS, IDENTITY_URL } from './mockData';
2
+ export const createProductsMockResponse = ({ searchParams }) => {
3
+ switch (searchParams.tenantId) {
4
+ case 'astral': {
5
+ return {
6
+ data: ASTRAL_PRODUCTS,
7
+ meta: {
8
+ totalCount: ASTRAL_PRODUCTS.length,
9
+ },
10
+ };
11
+ }
12
+ case 'eco': {
13
+ return {
14
+ data: ECO_PRODUCTS,
15
+ meta: {
16
+ totalCount: ECO_PRODUCTS.length,
17
+ },
18
+ };
19
+ }
20
+ default: {
21
+ return {
22
+ data: [],
23
+ meta: {
24
+ totalCount: 0,
25
+ },
26
+ };
27
+ }
28
+ }
29
+ };
30
+ export const MOCK_FETCH_IDENTITY_PRODUCTS = [
31
+ {
32
+ url: `${IDENTITY_URL}/api/products/widget?tenantId=*`,
33
+ method: 'GET',
34
+ status: 200,
35
+ response: createProductsMockResponse,
36
+ },
37
+ ];
38
+ export const MOCK_FETCH_IDENTITY_GROUPS = [
39
+ {
40
+ url: `${IDENTITY_URL}/api/products/group?groupId=*`,
41
+ method: 'GET',
42
+ status: 200,
43
+ response: {
44
+ data: ECO_PRODUCTS,
45
+ meta: {
46
+ totalCount: ECO_PRODUCTS.length,
47
+ },
48
+ },
49
+ },
50
+ ];
@@ -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/components").WidgetProduct[]>;
7
+ export declare const getFilteredProducts: (identityUrl: string, filterBy: string, code: string) => Promise<import("@astral/ui").WidgetProduct[]>;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { type Meta } from '@storybook/react-vite';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ export declare const Example: () => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { IdentityProductSwitcher } from '../IdentityProductSwitcher';
3
+ const meta = {};
4
+ export default meta;
5
+ export const Example = () => _jsx(IdentityProductSwitcher, { identityUrl: "" });
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import type { IdentityProductSwitcher } from '../IdentityProductSwitcher';
3
+ declare const meta: Meta<typeof IdentityProductSwitcher>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof IdentityProductSwitcher>;
6
+ export declare const Interaction: Story;
@@ -0,0 +1,13 @@
1
+ import { IDENTITY_URL } from './common';
2
+ const meta = {};
3
+ export default meta;
4
+ export const Interaction = {
5
+ args: {
6
+ identityUrl: IDENTITY_URL,
7
+ },
8
+ parameters: {
9
+ docs: {
10
+ disable: true,
11
+ },
12
+ },
13
+ };
@@ -0,0 +1,2 @@
1
+ export * from './mockData';
2
+ export * from './mockResponses';
@@ -0,0 +1,2 @@
1
+ export * from './mockData';
2
+ export * from './mockResponses';
@@ -0,0 +1,27 @@
1
+ export declare const IDENTITY_URL = "https://identity";
2
+ export declare const MOCK_IMAGE = "data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik04LjI1NzE5IDE3LjI2ODlDOC4yNTcxOSAxNy4yNjg5IDQuNTY5MzMgMjAuMjAyMyA0LjExODcyIDIyLjA3OTZDMi43NjA3OCAyNy43MzY5IDEzLjQwNTkgMjAuOTM3NyAxNy45Njg3IDE3LjUxMDZDMTkuMjMwNCAxNi41NjI5IDIxLjAyNTggMTUuMTIwOSAyMi43MDE4IDEzLjYwNTlMMjIuOTExOSAxMy40NzQxQzIyLjkwNjQgMTMuNDU5NCAyMi45MDA5IDEzLjQ0NDcgMjIuODk1NCAxMy40MzAxQzI2LjI4NDQgMTAuMzM3OCAyOS4wNzUgNy4wMTExOSAyNS43NjgyIDcuMDAwMDFDMjMuOTcwOCA2Ljk5Mzk0IDE5Ljg3NjEgOC45MzMyNiAxOS44NzYxIDguOTMzMjZDMTkuODc2MSA4LjkzMzI2IDIyLjc4MjggNy43MzU2NCAyMy40NjUxIDguMDgyOUMyNC40NDM2IDguNTgwODggMjMuMzk5NSA5LjgzMDI2IDIxLjY2OSAxMS4zMDE5QzIwLjMxODEgOS42NDU2MSAxOC4yOTU2IDguNTkzMzkgMTYuMDM1MyA4LjU5MzM5QzExLjk2ODEgOC41OTMzOSA4LjY3MDk2IDEyLjAwMDIgOC42NzA5NiAxNi4yMDI4QzguNjcwOTYgMTcuNjE2MSA5LjA0Mzc5IDE4LjkzOTMgOS42OTMzNiAyMC4wNzMzQzcuNTgzODkgMjEuMzE2NyA1Ljk1ODY3IDIxLjg0OCA2LjAwODkyIDIwLjQzMDVDNi4wNDY0IDE5LjM3MzMgOC4yNTcxOSAxNy4yNjg5IDguMjU3MTkgMTcuMjY4OVpNMjMuMzk5NiAxNi4yMDI4QzIzLjM5OTYgMjAuNDA1NCAyMC4xMDI1IDIzLjgxMjMgMTYuMDM1MyAyMy44MTIzQzE1LjYwMzkgMjMuODEyMyAxNS4xODEyIDIzLjc3NCAxNC43NzAyIDIzLjcwMDVDMTQuMzM4NyAyMy42MjMzIDE0LjExNDEgMjMuMTYwNCAxNC4zMTYxIDIyLjc3MTRDMTYuMTk1MiAxOS4xNTI1IDIxLjAxNzMgMTYuMzkxNiAyMy4zMzkzIDE1LjIyNTNDMjMuMzc5IDE1LjU0NTMgMjMuMzk5NiAxNS44NzE2IDIzLjM5OTYgMTYuMjAyOFoiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik04LjUgOC41QzguNSA5LjMyODQzIDcuODI4NDMgMTAgNyAxMEM2LjE3MTU3IDEwIDUuNSA5LjMyODQzIDUuNSA4LjVDNS41IDcuNjcxNTcgNi4xNzE1NyA3IDcgN0M3LjgyODQzIDcgOC41IDcuNjcxNTcgOC41IDguNVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=";
3
+ export type MockRequest = {
4
+ searchParams: Record<string, string>;
5
+ };
6
+ export declare const ASTRAL_PRODUCTS: {
7
+ id: string;
8
+ name: string;
9
+ productUrl: string;
10
+ description: string;
11
+ shortDescription: string;
12
+ iconFileId: string;
13
+ logoUrl: string;
14
+ backgroundHexColor: string;
15
+ tenantId: string;
16
+ }[];
17
+ export declare const ECO_PRODUCTS: {
18
+ id: string;
19
+ name: string;
20
+ productUrl: string;
21
+ description: string;
22
+ shortDescription: string;
23
+ iconFileId: string;
24
+ logoUrl: string;
25
+ backgroundHexColor: string;
26
+ tenantId: string;
27
+ }[];