@jpmorganchase/elemental-dev-portal 1.0.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/components/BranchSelector/BranchSelector.d.ts +7 -0
  2. package/components/BranchSelector/BranchSelector.spec.d.ts +15 -0
  3. package/components/BranchSelector/BranchSelector.stories.d.ts +29 -0
  4. package/components/DevPortalProvider/index.d.ts +7 -0
  5. package/components/Forbidden.d.ts +1 -0
  6. package/components/Loading.d.ts +1 -0
  7. package/components/NodeContent/NodeContent.d.ts +17 -0
  8. package/components/NodeContent/NodeContent.spec.d.ts +1 -0
  9. package/components/NodeContent/NodeContent.stories.d.ts +43 -0
  10. package/components/NotFound.d.ts +1 -0
  11. package/components/Search/Search.d.ts +13 -0
  12. package/components/Search/Search.stories.d.ts +33 -0
  13. package/components/TableOfContents/TableOfContents.d.ts +12 -0
  14. package/components/TableOfContents/TableOfContents.stories.d.ts +36 -0
  15. package/components/UpgradeToStarter.d.ts +1 -0
  16. package/consts.d.ts +28 -0
  17. package/containers/StoplightProject.d.ts +13 -0
  18. package/containers/StoplightProject.spec.d.ts +1 -0
  19. package/containers/StoplightProject.stories.d.ts +45 -0
  20. package/handlers/getBranches.d.ts +6 -0
  21. package/handlers/getNodeContent.d.ts +12 -0
  22. package/handlers/getNodes.d.ts +9 -0
  23. package/handlers/getTableOfContents.d.ts +7 -0
  24. package/handlers/getWorkspace.d.ts +6 -0
  25. package/hooks/useGetBranches.d.ts +3 -0
  26. package/hooks/useGetNodeContent.d.ts +5 -0
  27. package/hooks/useGetNodes.d.ts +7 -0
  28. package/hooks/useGetTableOfContents.d.ts +4 -0
  29. package/hooks/useGetWorkspace.d.ts +3 -0
  30. package/index.esm.js +682 -0
  31. package/index.js +726 -0
  32. package/index.mjs +682 -0
  33. package/package.json +17 -70
  34. package/styles.min.css +1 -0
  35. package/types.d.ts +65 -0
  36. package/version.d.ts +1 -0
  37. package/web-components/components.d.ts +1 -0
  38. package/web-components/index.d.ts +1 -0
  39. package/web-components.min.js +2 -0
  40. package/web-components.min.js.LICENSE.txt +187 -0
  41. package/.storybook/main.js +0 -1
  42. package/.storybook/manager.js +0 -1
  43. package/.storybook/preview.jsx +0 -46
  44. package/jest.config.js +0 -10
  45. package/src/__fixtures__/branches.json +0 -26
  46. package/src/__fixtures__/node-content.json +0 -257
  47. package/src/__fixtures__/table-of-contents.json +0 -144
  48. package/src/components/BranchSelector/BranchSelector.spec.tsx +0 -63
  49. package/src/components/BranchSelector/BranchSelector.stories.tsx +0 -41
  50. package/src/components/BranchSelector/BranchSelector.tsx +0 -50
  51. package/src/components/DevPortalProvider/index.tsx +0 -19
  52. package/src/components/Forbidden.tsx +0 -11
  53. package/src/components/Loading.tsx +0 -9
  54. package/src/components/NodeContent/NodeContent.spec.tsx +0 -54
  55. package/src/components/NodeContent/NodeContent.stories.tsx +0 -60
  56. package/src/components/NodeContent/NodeContent.tsx +0 -171
  57. package/src/components/NotFound.tsx +0 -11
  58. package/src/components/Search/Search.stories.tsx +0 -73
  59. package/src/components/Search/Search.tsx +0 -133
  60. package/src/components/TableOfContents/TableOfContents.stories.tsx +0 -54
  61. package/src/components/TableOfContents/TableOfContents.tsx +0 -51
  62. package/src/components/UpgradeToStarter.tsx +0 -22
  63. package/src/consts.ts +0 -32
  64. package/src/containers/StoplightProject.spec.tsx +0 -78
  65. package/src/containers/StoplightProject.stories.tsx +0 -28
  66. package/src/containers/StoplightProject.tsx +0 -213
  67. package/src/handlers/__tests__/getBranches.test.ts +0 -30
  68. package/src/handlers/__tests__/getNodeContent.test.ts +0 -35
  69. package/src/handlers/__tests__/getNodes.test.ts +0 -38
  70. package/src/handlers/__tests__/getTableOfContents.test.ts +0 -34
  71. package/src/handlers/__tests__/getWorkspace.test.ts +0 -30
  72. package/src/handlers/getBranches.ts +0 -27
  73. package/src/handlers/getNodeContent.ts +0 -53
  74. package/src/handlers/getNodes.ts +0 -69
  75. package/src/handlers/getTableOfContents.ts +0 -30
  76. package/src/handlers/getWorkspace.ts +0 -27
  77. package/src/hooks/__tests__/dataFetching.spec.tsx +0 -42
  78. package/src/hooks/useGetBranches.ts +0 -17
  79. package/src/hooks/useGetNodeContent.ts +0 -24
  80. package/src/hooks/useGetNodes.ts +0 -34
  81. package/src/hooks/useGetTableOfContents.ts +0 -15
  82. package/src/hooks/useGetWorkspace.tsx +0 -13
  83. package/src/styles.css +0 -1
  84. package/src/types.ts +0 -81
  85. package/src/version.ts +0 -2
  86. package/src/web-components/__stories__/StoplightProject.stories.tsx +0 -33
  87. package/src/web-components/components.ts +0 -17
  88. package/src/web-components/index.ts +0 -3
  89. package/tsconfig.build.json +0 -18
  90. package/tsconfig.json +0 -7
  91. package/web-components.config.js +0 -1
  92. /package/{src/components/BranchSelector/index.tsx → components/BranchSelector/index.d.ts} +0 -0
  93. /package/{src/components/NodeContent/index.tsx → components/NodeContent/index.d.ts} +0 -0
  94. /package/{src/components/Search/index.tsx → components/Search/index.d.ts} +0 -0
  95. /package/{src/components/TableOfContents/index.tsx → components/TableOfContents/index.d.ts} +0 -0
  96. /package/{src/index.ts → index.d.ts} +0 -0
@@ -0,0 +1,7 @@
1
+ import { Branch } from '../../types';
2
+ export declare type BranchSelectorProps = {
3
+ branchSlug: string;
4
+ branches: Branch[];
5
+ onChange: (branch: Branch) => void;
6
+ };
7
+ export declare const BranchSelector: ({ branchSlug, branches, onChange }: BranchSelectorProps) => JSX.Element;
@@ -0,0 +1,15 @@
1
+ export declare const branches: ({
2
+ id: number;
3
+ slug: string;
4
+ is_default: boolean;
5
+ is_published: boolean;
6
+ projectId: number;
7
+ name: string;
8
+ } | {
9
+ id: number;
10
+ slug: string;
11
+ is_default: boolean;
12
+ is_published: boolean;
13
+ projectId: number;
14
+ name?: undefined;
15
+ })[];
@@ -0,0 +1,29 @@
1
+ import { Story } from '@storybook/react';
2
+ declare const _default: {
3
+ title: string;
4
+ component: ({ projectId }: {
5
+ projectId: string;
6
+ }) => JSX.Element;
7
+ argTypes: {
8
+ projectId: {
9
+ table: {
10
+ category: string;
11
+ };
12
+ };
13
+ platformUrl: {
14
+ table: {
15
+ category: string;
16
+ };
17
+ };
18
+ };
19
+ args: {
20
+ projectId: string;
21
+ platformUrl: string;
22
+ };
23
+ };
24
+ export default _default;
25
+ export declare const Playground: Story<{
26
+ nodeSlug: string;
27
+ projectId: string;
28
+ branchSlug?: string;
29
+ }>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ export declare type DevPortalProviderProps = {
3
+ platformUrl?: string;
4
+ platformAuthToken?: string;
5
+ };
6
+ export declare const PlatformContext: React.Context<DevPortalProviderProps>;
7
+ export declare const DevPortalProvider: React.FC<DevPortalProviderProps>;
@@ -0,0 +1 @@
1
+ export declare const Forbidden: () => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const Loading: () => JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { CustomLinkComponent, DocsProps, ReferenceResolver } from '@jpmorganchase/elemental-core';
2
+ import { Node } from '../../types';
3
+ declare type DocsBaseProps = Pick<DocsProps, 'tryItCorsProxy' | 'tryItCredentialsPolicy' | 'nodeHasChanged'>;
4
+ declare type DocsLayoutProps = Pick<Required<DocsProps>['layoutOptions'], 'compact' | 'hideTryIt' | 'hideTryItPanel' | 'hideExport'>;
5
+ export declare type NodeContentProps = {
6
+ node: Node;
7
+ Link: CustomLinkComponent;
8
+ hideMocking?: boolean;
9
+ refResolver?: ReferenceResolver;
10
+ onExportRequest?: (type: 'original' | 'bundled') => void;
11
+ } & DocsBaseProps & DocsLayoutProps;
12
+ export declare const NodeContent: ({ node, Link, hideMocking, refResolver, tryItCorsProxy, tryItCredentialsPolicy, nodeHasChanged, compact, hideTryIt, hideTryItPanel, hideExport, onExportRequest, }: NodeContentProps) => JSX.Element;
13
+ export declare const getNodeUriParts: (uri: string) => {
14
+ fileUri: string;
15
+ pointer: string;
16
+ };
17
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ import { Story } from '@storybook/react';
2
+ declare const _default: {
3
+ title: string;
4
+ component: ({ nodeSlug, projectId, branchSlug, }: {
5
+ nodeSlug: string;
6
+ projectId: string;
7
+ branchSlug?: string | undefined;
8
+ }) => JSX.Element;
9
+ argTypes: {
10
+ nodeSlug: {
11
+ table: {
12
+ category: string;
13
+ };
14
+ };
15
+ projectId: {
16
+ table: {
17
+ category: string;
18
+ };
19
+ };
20
+ branchSlug: {
21
+ table: {
22
+ category: string;
23
+ };
24
+ };
25
+ platformUrl: {
26
+ table: {
27
+ category: string;
28
+ };
29
+ };
30
+ };
31
+ args: {
32
+ nodeSlug: string;
33
+ projectId: string;
34
+ branchSlug: string;
35
+ platformUrl: string;
36
+ };
37
+ };
38
+ export default _default;
39
+ export declare const Playground: Story<{
40
+ nodeSlug: string;
41
+ projectId: string;
42
+ branchSlug?: string;
43
+ }>;
@@ -0,0 +1 @@
1
+ export declare const NotFound: () => JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { ModalProps } from '@stoplight/mosaic';
2
+ import * as React from 'react';
3
+ import { NodeSearchResult } from '../../types';
4
+ export declare type SearchProps = {
5
+ isLoading?: boolean;
6
+ search?: string;
7
+ searchResults?: NodeSearchResult[];
8
+ onSearch: (search: string) => void;
9
+ onClick: (result: NodeSearchResult) => void;
10
+ isOpen?: boolean;
11
+ onClose: ModalProps['onClose'];
12
+ };
13
+ export declare const Search: React.FC<SearchProps>;
@@ -0,0 +1,33 @@
1
+ import { Story } from '@storybook/react';
2
+ declare type SearchWrapperProps = {
3
+ projectIds: string[];
4
+ workspaceId: string;
5
+ };
6
+ declare const _default: {
7
+ title: string;
8
+ component: ({ projectIds, workspaceId }: SearchWrapperProps) => JSX.Element;
9
+ argTypes: {
10
+ workspaceId: {
11
+ table: {
12
+ category: string;
13
+ };
14
+ };
15
+ projectIds: {
16
+ table: {
17
+ category: string;
18
+ };
19
+ };
20
+ platformUrl: {
21
+ table: {
22
+ category: string;
23
+ };
24
+ };
25
+ };
26
+ args: {
27
+ projectIds: string[];
28
+ workspaceId: string;
29
+ platformUrl: string;
30
+ };
31
+ };
32
+ export default _default;
33
+ export declare const Playground: Story<SearchWrapperProps>;
@@ -0,0 +1,12 @@
1
+ import { CustomLinkComponent } from '@jpmorganchase/elemental-core';
2
+ import { BoxProps } from '@stoplight/mosaic';
3
+ import { ProjectTableOfContents } from '../../types';
4
+ export declare type TableOfContentsProps = BoxProps<'div'> & {
5
+ activeId: string;
6
+ tableOfContents: ProjectTableOfContents;
7
+ Link: CustomLinkComponent;
8
+ collapseTableOfContents?: boolean;
9
+ externalScrollbar?: boolean;
10
+ onLinkClick?(): void;
11
+ };
12
+ export declare const TableOfContents: ({ tableOfContents, activeId, Link, collapseTableOfContents, externalScrollbar, onLinkClick, ...boxProps }: TableOfContentsProps) => JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { Story } from '@storybook/react';
2
+ declare const _default: {
3
+ title: string;
4
+ component: ({ projectId, branchSlug }: {
5
+ projectId: string;
6
+ branchSlug?: string | undefined;
7
+ }) => JSX.Element;
8
+ argTypes: {
9
+ projectId: {
10
+ table: {
11
+ category: string;
12
+ };
13
+ };
14
+ branchSlug: {
15
+ table: {
16
+ category: string;
17
+ };
18
+ };
19
+ platformUrl: {
20
+ table: {
21
+ category: string;
22
+ };
23
+ };
24
+ };
25
+ args: {
26
+ projectId: string;
27
+ branchSlug: string;
28
+ platformUrl: string;
29
+ };
30
+ };
31
+ export default _default;
32
+ export declare const Playground: Story<{
33
+ nodeSlug: string;
34
+ projectId: string;
35
+ branchSlug?: string;
36
+ }>;
@@ -0,0 +1 @@
1
+ export declare const UpgradeToStarter: () => JSX.Element;
package/consts.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ export declare const devPortalCacheKeys: {
2
+ all: readonly ["@stoplight/elements-dev-portal/client-query"];
3
+ projects: () => readonly ["@stoplight/elements-dev-portal/client-query", "projects"];
4
+ project: (projectId: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string];
5
+ projectsList: () => readonly ["@stoplight/elements-dev-portal/client-query", "projects", "list"];
6
+ projectDetails: (projectId: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "details"];
7
+ branches: (projectId: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches"];
8
+ branch: (projectId: string, branch: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches", string];
9
+ branchesList: (projectId: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches", "list"];
10
+ branchDetails: (projectId: string, branch: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches", string, "details"];
11
+ branchTOC: (projectId: string, branch: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches", string, "toc"];
12
+ branchNodes: (projectId: string, branch: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches", string, "nodes"];
13
+ branchNode: (projectId: string, branch: string, node: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches", string, "nodes", string];
14
+ branchNodesList: (projectId: string, branch: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches", string, "nodes", "list"];
15
+ branchNodeDetails: (projectId: string, branch: string, node: string) => readonly ["@stoplight/elements-dev-portal/client-query", "projects", string, "branches", string, "nodes", string, "details"];
16
+ search: () => string[];
17
+ searchNodes: (filters: {
18
+ projectIds?: string[];
19
+ branchSlug?: string;
20
+ workspaceId?: string;
21
+ search?: string;
22
+ }) => (string | {
23
+ projectIds?: string[] | undefined;
24
+ branchSlug?: string | undefined;
25
+ workspaceId?: string | undefined;
26
+ search?: string | undefined;
27
+ })[];
28
+ };
@@ -0,0 +1,13 @@
1
+ import { RoutingProps } from '@jpmorganchase/elemental-core';
2
+ import * as React from 'react';
3
+ export interface StoplightProjectProps extends RoutingProps {
4
+ projectId: string;
5
+ platformUrl?: string;
6
+ hideTryIt?: boolean;
7
+ hideMocking?: boolean;
8
+ hideExport?: boolean;
9
+ collapseTableOfContents?: boolean;
10
+ tryItCredentialsPolicy?: 'omit' | 'include' | 'same-origin';
11
+ tryItCorsProxy?: string;
12
+ }
13
+ export declare const StoplightProject: React.FC<StoplightProjectProps>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,45 @@
1
+ import { Story } from '@storybook/react';
2
+ import * as React from 'react';
3
+ import { StoplightProjectProps } from './StoplightProject';
4
+ declare const _default: {
5
+ title: string;
6
+ component: React.FC<StoplightProjectProps>;
7
+ argTypes: {
8
+ projectId: {
9
+ table: {
10
+ category: string;
11
+ };
12
+ };
13
+ hideTryIt: {
14
+ table: {
15
+ category: string;
16
+ };
17
+ };
18
+ hideMocking: {
19
+ table: {
20
+ category: string;
21
+ };
22
+ };
23
+ basePath: {
24
+ table: {
25
+ category: string;
26
+ };
27
+ };
28
+ router: {
29
+ table: {
30
+ category: string;
31
+ };
32
+ };
33
+ platformUrl: {
34
+ table: {
35
+ category: string;
36
+ };
37
+ };
38
+ };
39
+ args: {
40
+ router: string;
41
+ platformUrl: string;
42
+ };
43
+ };
44
+ export default _default;
45
+ export declare const Playground: Story<StoplightProjectProps>;
@@ -0,0 +1,6 @@
1
+ import { Branch } from '../types';
2
+ export declare const getBranches: ({ projectId, platformUrl, platformAuthToken, }: {
3
+ projectId: string;
4
+ platformUrl?: string | undefined;
5
+ platformAuthToken?: string | undefined;
6
+ }) => Promise<Branch[]>;
@@ -0,0 +1,12 @@
1
+ import { Node } from '../types';
2
+ export declare class ResponseError extends Error {
3
+ code: number;
4
+ constructor(message: string, responseCode: number);
5
+ }
6
+ export declare const getNodeContent: ({ nodeSlug, projectId, branchSlug, platformUrl, platformAuthToken, }: {
7
+ nodeSlug: string;
8
+ projectId: string;
9
+ branchSlug?: string | undefined;
10
+ platformUrl?: string | undefined;
11
+ platformAuthToken?: string | undefined;
12
+ }) => Promise<Node>;
@@ -0,0 +1,9 @@
1
+ import { NodeSearchResult } from '../types';
2
+ export declare const getNodes: ({ workspaceId, branchSlug, projectIds, search, platformUrl, platformAuthToken, }: {
3
+ workspaceId?: string | undefined;
4
+ branchSlug?: string | undefined;
5
+ projectIds?: string[] | undefined;
6
+ search?: string | undefined;
7
+ platformUrl?: string | undefined;
8
+ platformAuthToken?: string | undefined;
9
+ }) => Promise<NodeSearchResult[]>;
@@ -0,0 +1,7 @@
1
+ import { ProjectTableOfContents } from '../types';
2
+ export declare const getTableOfContents: ({ projectId, branchSlug, platformUrl, platformAuthToken, }: {
3
+ projectId: string;
4
+ branchSlug?: string | undefined;
5
+ platformUrl?: string | undefined;
6
+ platformAuthToken?: string | undefined;
7
+ }) => Promise<ProjectTableOfContents>;
@@ -0,0 +1,6 @@
1
+ import { Workspace } from '../types';
2
+ export declare const getWorkspace: ({ projectIds, platformUrl, platformAuthToken, }: {
3
+ projectIds: string[];
4
+ platformUrl?: string | undefined;
5
+ platformAuthToken?: string | undefined;
6
+ }) => Promise<Workspace>;
@@ -0,0 +1,3 @@
1
+ export declare function useGetBranches({ projectId }: {
2
+ projectId: string;
3
+ }): import("react-query").UseQueryResult<import("..").Branch[], unknown>;
@@ -0,0 +1,5 @@
1
+ export declare function useGetNodeContent({ nodeSlug, projectId, branchSlug, }: {
2
+ nodeSlug: string;
3
+ projectId: string;
4
+ branchSlug?: string;
5
+ }): import("react-query").UseQueryResult<import("..").Node, unknown>;
@@ -0,0 +1,7 @@
1
+ export declare function useGetNodes({ search, workspaceId, projectIds, branch, pause, }: {
2
+ search: string;
3
+ workspaceId?: string;
4
+ projectIds?: string[];
5
+ branch?: string;
6
+ pause?: boolean;
7
+ }): import("react-query").UseQueryResult<import("..").NodeSearchResult[], unknown>;
@@ -0,0 +1,4 @@
1
+ export declare function useGetTableOfContents({ projectId, branchSlug }: {
2
+ projectId: string;
3
+ branchSlug?: string;
4
+ }): import("react-query").UseQueryResult<import("..").ProjectTableOfContents, unknown>;
@@ -0,0 +1,3 @@
1
+ export declare function useGetWorkspace({ projectIds }: {
2
+ projectIds: string[];
3
+ }): import("react-query").UseQueryResult<import("../types").Workspace, unknown>;