@stoplight/elements-dev-portal 2.0.2 → 2.0.4

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.
@@ -1,15 +1,2 @@
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
- })[];
1
+ import { Branch } from '../../types';
2
+ export declare const branches: Branch[];
@@ -1,6 +1,6 @@
1
- import { Branch } from '../types';
1
+ import { Branches } from '../types';
2
2
  export declare const getBranches: ({ projectId, platformUrl, platformAuthToken, }: {
3
3
  projectId: string;
4
4
  platformUrl?: string | undefined;
5
5
  platformAuthToken?: string | undefined;
6
- }) => Promise<Branch[]>;
6
+ }) => Promise<Branches>;
@@ -1,3 +1,3 @@
1
1
  export declare function useGetBranches({ projectId }: {
2
2
  projectId: string;
3
- }): import("react-query").UseQueryResult<import("..").Branch[], unknown>;
3
+ }): import("react-query").UseQueryResult<import("../types").Branches, unknown>;
package/index.esm.js CHANGED
@@ -5,7 +5,7 @@ import { withPersistenceBoundary, withQueryClientProvider, withMosaicProvider, M
5
5
  import { resolve, dirname } from '@stoplight/path';
6
6
  import { NodeType } from '@stoplight/types';
7
7
  import flow from 'lodash/flow.js';
8
- import { Link, Route, useParams, useHistory, Redirect } from 'react-router-dom';
8
+ import { Link, Switch, Route, useParams, useHistory, Redirect } from 'react-router-dom';
9
9
  import { useQuery } from 'react-query';
10
10
 
11
11
  const BranchSelector = ({ branchSlug, branches, onChange }) => {
@@ -281,7 +281,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
281
281
  React__default.createElement(Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
282
282
  React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
283
283
 
284
- const appVersion = '2.0.2';
284
+ const appVersion = '2.0.4';
285
285
 
286
286
  class ResponseError extends Error {
287
287
  constructor(message, responseCode) {
@@ -699,7 +699,7 @@ const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, c
699
699
  }
700
700
  };
701
701
  return (React.createElement(SidebarLayout, { ref: container, sidebar: React.createElement(React.Fragment, null,
702
- branches && branches.length > 1 ? (React.createElement(BranchSelector, { branchSlug: branchSlug, branches: branches, onChange: branch => {
702
+ branches && branches.items.length > 1 ? (React.createElement(BranchSelector, { branchSlug: branchSlug, branches: branches.items, onChange: branch => {
703
703
  const encodedBranchSlug = encodeURIComponent(branch.slug);
704
704
  history.push(branch.is_default ? `/${nodeSlug}` : `/branches/${encodedBranchSlug}/${nodeSlug}`);
705
705
  } })) : null,
@@ -711,12 +711,13 @@ const StoplightProjectRouter = (_a) => {
711
711
  return (React.createElement(DevPortalProvider, { platformUrl: platformUrl },
712
712
  React.createElement(RouterTypeContext.Provider, { value: router },
713
713
  React.createElement(Router, Object.assign({}, routerProps, { key: basePath }),
714
- React.createElement(Route, { path: "/branches/:branchSlug/:nodeSlug+", exact: true },
715
- React.createElement(StoplightProjectImpl, Object.assign({}, props))),
716
- React.createElement(Route, { path: "/:nodeSlug+", exact: true },
717
- React.createElement(StoplightProjectImpl, Object.assign({}, props))),
718
- React.createElement(Route, { path: "/", exact: true },
719
- React.createElement(StoplightProjectImpl, Object.assign({}, props)))))));
714
+ React.createElement(Switch, null,
715
+ React.createElement(Route, { path: "/branches/:branchSlug/:nodeSlug+", exact: true },
716
+ React.createElement(StoplightProjectImpl, Object.assign({}, props))),
717
+ React.createElement(Route, { path: "/:nodeSlug+", exact: true },
718
+ React.createElement(StoplightProjectImpl, Object.assign({}, props))),
719
+ React.createElement(Route, { path: "/", exact: true },
720
+ React.createElement(StoplightProjectImpl, Object.assign({}, props))))))));
720
721
  };
721
722
  const StoplightProject = withStyles(StoplightProjectRouter);
722
723
 
package/index.js CHANGED
@@ -308,7 +308,7 @@ const UpgradeToStarter = () => (React__default["default"].createElement(mosaic.F
308
308
  React__default["default"].createElement(mosaic.Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
309
309
  React__default["default"].createElement(mosaic.Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
310
310
 
311
- const appVersion = '2.0.2';
311
+ const appVersion = '2.0.4';
312
312
 
313
313
  class ResponseError extends Error {
314
314
  constructor(message, responseCode) {
@@ -726,7 +726,7 @@ const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, c
726
726
  }
727
727
  };
728
728
  return (React__namespace.createElement(elementsCore.SidebarLayout, { ref: container, sidebar: React__namespace.createElement(React__namespace.Fragment, null,
729
- branches && branches.length > 1 ? (React__namespace.createElement(BranchSelector, { branchSlug: branchSlug, branches: branches, onChange: branch => {
729
+ branches && branches.items.length > 1 ? (React__namespace.createElement(BranchSelector, { branchSlug: branchSlug, branches: branches.items, onChange: branch => {
730
730
  const encodedBranchSlug = encodeURIComponent(branch.slug);
731
731
  history.push(branch.is_default ? `/${nodeSlug}` : `/branches/${encodedBranchSlug}/${nodeSlug}`);
732
732
  } })) : null,
@@ -738,12 +738,13 @@ const StoplightProjectRouter = (_a) => {
738
738
  return (React__namespace.createElement(DevPortalProvider, { platformUrl: platformUrl },
739
739
  React__namespace.createElement(elementsCore.RouterTypeContext.Provider, { value: router },
740
740
  React__namespace.createElement(Router, Object.assign({}, routerProps, { key: basePath }),
741
- React__namespace.createElement(reactRouterDom.Route, { path: "/branches/:branchSlug/:nodeSlug+", exact: true },
742
- React__namespace.createElement(StoplightProjectImpl, Object.assign({}, props))),
743
- React__namespace.createElement(reactRouterDom.Route, { path: "/:nodeSlug+", exact: true },
744
- React__namespace.createElement(StoplightProjectImpl, Object.assign({}, props))),
745
- React__namespace.createElement(reactRouterDom.Route, { path: "/", exact: true },
746
- React__namespace.createElement(StoplightProjectImpl, Object.assign({}, props)))))));
741
+ React__namespace.createElement(reactRouterDom.Switch, null,
742
+ React__namespace.createElement(reactRouterDom.Route, { path: "/branches/:branchSlug/:nodeSlug+", exact: true },
743
+ React__namespace.createElement(StoplightProjectImpl, Object.assign({}, props))),
744
+ React__namespace.createElement(reactRouterDom.Route, { path: "/:nodeSlug+", exact: true },
745
+ React__namespace.createElement(StoplightProjectImpl, Object.assign({}, props))),
746
+ React__namespace.createElement(reactRouterDom.Route, { path: "/", exact: true },
747
+ React__namespace.createElement(StoplightProjectImpl, Object.assign({}, props))))))));
747
748
  };
748
749
  const StoplightProject = elementsCore.withStyles(StoplightProjectRouter);
749
750
 
package/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { withPersistenceBoundary, withQueryClientProvider, withMosaicProvider, M
5
5
  import { resolve, dirname } from '@stoplight/path';
6
6
  import { NodeType } from '@stoplight/types';
7
7
  import flow from 'lodash/flow.js';
8
- import { Link, Route, useParams, useHistory, Redirect } from 'react-router-dom';
8
+ import { Link, Switch, Route, useParams, useHistory, Redirect } from 'react-router-dom';
9
9
  import { useQuery } from 'react-query';
10
10
 
11
11
  const BranchSelector = ({ branchSlug, branches, onChange }) => {
@@ -281,7 +281,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
281
281
  React__default.createElement(Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
282
282
  React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
283
283
 
284
- const appVersion = '2.0.2';
284
+ const appVersion = '2.0.4';
285
285
 
286
286
  class ResponseError extends Error {
287
287
  constructor(message, responseCode) {
@@ -699,7 +699,7 @@ const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, c
699
699
  }
700
700
  };
701
701
  return (React.createElement(SidebarLayout, { ref: container, sidebar: React.createElement(React.Fragment, null,
702
- branches && branches.length > 1 ? (React.createElement(BranchSelector, { branchSlug: branchSlug, branches: branches, onChange: branch => {
702
+ branches && branches.items.length > 1 ? (React.createElement(BranchSelector, { branchSlug: branchSlug, branches: branches.items, onChange: branch => {
703
703
  const encodedBranchSlug = encodeURIComponent(branch.slug);
704
704
  history.push(branch.is_default ? `/${nodeSlug}` : `/branches/${encodedBranchSlug}/${nodeSlug}`);
705
705
  } })) : null,
@@ -711,12 +711,13 @@ const StoplightProjectRouter = (_a) => {
711
711
  return (React.createElement(DevPortalProvider, { platformUrl: platformUrl },
712
712
  React.createElement(RouterTypeContext.Provider, { value: router },
713
713
  React.createElement(Router, Object.assign({}, routerProps, { key: basePath }),
714
- React.createElement(Route, { path: "/branches/:branchSlug/:nodeSlug+", exact: true },
715
- React.createElement(StoplightProjectImpl, Object.assign({}, props))),
716
- React.createElement(Route, { path: "/:nodeSlug+", exact: true },
717
- React.createElement(StoplightProjectImpl, Object.assign({}, props))),
718
- React.createElement(Route, { path: "/", exact: true },
719
- React.createElement(StoplightProjectImpl, Object.assign({}, props)))))));
714
+ React.createElement(Switch, null,
715
+ React.createElement(Route, { path: "/branches/:branchSlug/:nodeSlug+", exact: true },
716
+ React.createElement(StoplightProjectImpl, Object.assign({}, props))),
717
+ React.createElement(Route, { path: "/:nodeSlug+", exact: true },
718
+ React.createElement(StoplightProjectImpl, Object.assign({}, props))),
719
+ React.createElement(Route, { path: "/", exact: true },
720
+ React.createElement(StoplightProjectImpl, Object.assign({}, props))))))));
720
721
  };
721
722
  const StoplightProject = withStyles(StoplightProjectRouter);
722
723
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-dev-portal",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "UI components for composing beautiful developer documentation.",
5
5
  "keywords": [],
6
6
  "main": "./index.js",
@@ -26,9 +26,9 @@
26
26
  "react-dom": ">=16.8"
27
27
  },
28
28
  "dependencies": {
29
- "@stoplight/elements-core": "~8.0.3",
29
+ "@stoplight/elements-core": "~8.0.5",
30
30
  "@stoplight/markdown-viewer": "^5.5.0",
31
- "@stoplight/mosaic": "^1.46.1",
31
+ "@stoplight/mosaic": "^1.51.3",
32
32
  "@stoplight/path": "^1.3.2",
33
33
  "@stoplight/types": "^14.0.0",
34
34
  "classnames": "^2.2.6",