@stoplight/elements-dev-portal 2.1.2 → 2.1.3
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/components/DevPortalProvider/index.d.ts +1 -0
- package/index.esm.js +11 -11
- package/index.js +11 -11
- package/index.mjs +11 -11
- package/package.json +3 -3
- package/styles.min.css +1 -1
- package/version.d.ts +1 -1
- package/web-components.min.js +1 -1
- package/web-components.min.js.LICENSE.txt +0 -10
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
export declare type DevPortalProviderProps = {
|
|
3
3
|
platformUrl?: string;
|
|
4
4
|
platformAuthToken?: string;
|
|
5
|
+
isLoggedIn?: boolean;
|
|
5
6
|
};
|
|
6
7
|
export declare const PlatformContext: React.Context<DevPortalProviderProps>;
|
|
7
8
|
export declare const DevPortalProvider: React.FC<DevPortalProviderProps>;
|
package/index.esm.js
CHANGED
|
@@ -32,8 +32,8 @@ const BranchSelector = ({ branchSlug, branches, onChange }) => {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const PlatformContext = React.createContext({ platformUrl: 'https://stoplight.io' });
|
|
35
|
-
const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, children, }) => {
|
|
36
|
-
return React.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } }, children);
|
|
35
|
+
const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, isLoggedIn, children, }) => {
|
|
36
|
+
return (React.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken, isLoggedIn } }, children));
|
|
37
37
|
};
|
|
38
38
|
const DevPortalProvider = withPersistenceBoundary(withQueryClientProvider(withMosaicProvider(PlatformProvider)));
|
|
39
39
|
|
|
@@ -263,7 +263,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
|
|
|
263
263
|
React__default.createElement(Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
|
|
264
264
|
React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
265
265
|
|
|
266
|
-
const appVersion = '2.1.
|
|
266
|
+
const appVersion = '2.1.3';
|
|
267
267
|
|
|
268
268
|
class ResponseError extends Error {
|
|
269
269
|
constructor(message, responseCode) {
|
|
@@ -308,15 +308,15 @@ const getBranches = ({ projectId, platformUrl = 'https://stoplight.io', platform
|
|
|
308
308
|
});
|
|
309
309
|
|
|
310
310
|
function useGetBranches({ projectId }) {
|
|
311
|
-
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
312
|
-
return useQuery([...devPortalCacheKeys.branchesList(projectId), platformUrl,
|
|
311
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
312
|
+
return useQuery([...devPortalCacheKeys.branchesList(projectId), platformUrl, isLoggedIn], () => getBranches({ projectId, platformUrl, platformAuthToken }), {
|
|
313
313
|
enabled: projectId ? true : false,
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
function useGetNodeContent({ nodeSlug, projectId, branchSlug, }) {
|
|
318
|
-
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
319
|
-
return useQuery([...devPortalCacheKeys.branchNodeDetails(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : '', nodeSlug), platformUrl,
|
|
318
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
319
|
+
return useQuery([...devPortalCacheKeys.branchNodeDetails(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : '', nodeSlug), platformUrl, isLoggedIn], () => getNodeContent({ nodeSlug, projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: nodeSlug && projectId ? true : false });
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stoplight.io', platformAuthToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -334,8 +334,8 @@ const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stop
|
|
|
334
334
|
});
|
|
335
335
|
|
|
336
336
|
function useGetTableOfContents({ projectId, branchSlug }) {
|
|
337
|
-
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
338
|
-
return useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl,
|
|
337
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
338
|
+
return useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId ? true : false });
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, collapseTableOfContents = false, tryItCredentialsPolicy, tryItCorsProxy, }) => {
|
|
@@ -690,12 +690,12 @@ function useDebounce(value, delay, options) {
|
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
function useGetNodes({ search, workspaceId, projectIds, branch, pause, }) {
|
|
693
|
-
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
693
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
694
694
|
const [debounceSearch] = useDebounce(search, 500);
|
|
695
695
|
return useQuery([
|
|
696
696
|
...devPortalCacheKeys.searchNodes({ projectIds, branchSlug: branch, workspaceId, search: debounceSearch }),
|
|
697
697
|
platformUrl,
|
|
698
|
-
|
|
698
|
+
isLoggedIn,
|
|
699
699
|
], () => getNodes({ workspaceId, projectIds, branchSlug: branch, search: debounceSearch, platformUrl, platformAuthToken }), { enabled: !pause, keepPreviousData: true });
|
|
700
700
|
}
|
|
701
701
|
|
package/index.js
CHANGED
|
@@ -59,8 +59,8 @@ const BranchSelector = ({ branchSlug, branches, onChange }) => {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
const PlatformContext = React__namespace.createContext({ platformUrl: 'https://stoplight.io' });
|
|
62
|
-
const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, children, }) => {
|
|
63
|
-
return React__namespace.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } }, children);
|
|
62
|
+
const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, isLoggedIn, children, }) => {
|
|
63
|
+
return (React__namespace.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken, isLoggedIn } }, children));
|
|
64
64
|
};
|
|
65
65
|
const DevPortalProvider = elementsCore.withPersistenceBoundary(elementsCore.withQueryClientProvider(elementsCore.withMosaicProvider(PlatformProvider)));
|
|
66
66
|
|
|
@@ -290,7 +290,7 @@ const UpgradeToStarter = () => (React__default["default"].createElement(mosaic.F
|
|
|
290
290
|
React__default["default"].createElement(mosaic.Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
|
|
291
291
|
React__default["default"].createElement(mosaic.Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
292
292
|
|
|
293
|
-
const appVersion = '2.1.
|
|
293
|
+
const appVersion = '2.1.3';
|
|
294
294
|
|
|
295
295
|
class ResponseError extends Error {
|
|
296
296
|
constructor(message, responseCode) {
|
|
@@ -335,15 +335,15 @@ const getBranches = ({ projectId, platformUrl = 'https://stoplight.io', platform
|
|
|
335
335
|
});
|
|
336
336
|
|
|
337
337
|
function useGetBranches({ projectId }) {
|
|
338
|
-
const { platformUrl, platformAuthToken } = React__namespace.useContext(PlatformContext);
|
|
339
|
-
return reactQuery.useQuery([...devPortalCacheKeys.branchesList(projectId), platformUrl,
|
|
338
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React__namespace.useContext(PlatformContext);
|
|
339
|
+
return reactQuery.useQuery([...devPortalCacheKeys.branchesList(projectId), platformUrl, isLoggedIn], () => getBranches({ projectId, platformUrl, platformAuthToken }), {
|
|
340
340
|
enabled: projectId ? true : false,
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
function useGetNodeContent({ nodeSlug, projectId, branchSlug, }) {
|
|
345
|
-
const { platformUrl, platformAuthToken } = React__namespace.useContext(PlatformContext);
|
|
346
|
-
return reactQuery.useQuery([...devPortalCacheKeys.branchNodeDetails(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : '', nodeSlug), platformUrl,
|
|
345
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React__namespace.useContext(PlatformContext);
|
|
346
|
+
return reactQuery.useQuery([...devPortalCacheKeys.branchNodeDetails(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : '', nodeSlug), platformUrl, isLoggedIn], () => getNodeContent({ nodeSlug, projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: nodeSlug && projectId ? true : false });
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stoplight.io', platformAuthToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -361,8 +361,8 @@ const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stop
|
|
|
361
361
|
});
|
|
362
362
|
|
|
363
363
|
function useGetTableOfContents({ projectId, branchSlug }) {
|
|
364
|
-
const { platformUrl, platformAuthToken } = React__namespace.useContext(PlatformContext);
|
|
365
|
-
return reactQuery.useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl,
|
|
364
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React__namespace.useContext(PlatformContext);
|
|
365
|
+
return reactQuery.useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId ? true : false });
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, collapseTableOfContents = false, tryItCredentialsPolicy, tryItCorsProxy, }) => {
|
|
@@ -717,12 +717,12 @@ function useDebounce(value, delay, options) {
|
|
|
717
717
|
}
|
|
718
718
|
|
|
719
719
|
function useGetNodes({ search, workspaceId, projectIds, branch, pause, }) {
|
|
720
|
-
const { platformUrl, platformAuthToken } = React__namespace.useContext(PlatformContext);
|
|
720
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React__namespace.useContext(PlatformContext);
|
|
721
721
|
const [debounceSearch] = useDebounce(search, 500);
|
|
722
722
|
return reactQuery.useQuery([
|
|
723
723
|
...devPortalCacheKeys.searchNodes({ projectIds, branchSlug: branch, workspaceId, search: debounceSearch }),
|
|
724
724
|
platformUrl,
|
|
725
|
-
|
|
725
|
+
isLoggedIn,
|
|
726
726
|
], () => getNodes({ workspaceId, projectIds, branchSlug: branch, search: debounceSearch, platformUrl, platformAuthToken }), { enabled: !pause, keepPreviousData: true });
|
|
727
727
|
}
|
|
728
728
|
|
package/index.mjs
CHANGED
|
@@ -32,8 +32,8 @@ const BranchSelector = ({ branchSlug, branches, onChange }) => {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const PlatformContext = React.createContext({ platformUrl: 'https://stoplight.io' });
|
|
35
|
-
const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, children, }) => {
|
|
36
|
-
return React.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } }, children);
|
|
35
|
+
const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, isLoggedIn, children, }) => {
|
|
36
|
+
return (React.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken, isLoggedIn } }, children));
|
|
37
37
|
};
|
|
38
38
|
const DevPortalProvider = withPersistenceBoundary(withQueryClientProvider(withMosaicProvider(PlatformProvider)));
|
|
39
39
|
|
|
@@ -263,7 +263,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
|
|
|
263
263
|
React__default.createElement(Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
|
|
264
264
|
React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
265
265
|
|
|
266
|
-
const appVersion = '2.1.
|
|
266
|
+
const appVersion = '2.1.3';
|
|
267
267
|
|
|
268
268
|
class ResponseError extends Error {
|
|
269
269
|
constructor(message, responseCode) {
|
|
@@ -308,15 +308,15 @@ const getBranches = ({ projectId, platformUrl = 'https://stoplight.io', platform
|
|
|
308
308
|
});
|
|
309
309
|
|
|
310
310
|
function useGetBranches({ projectId }) {
|
|
311
|
-
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
312
|
-
return useQuery([...devPortalCacheKeys.branchesList(projectId), platformUrl,
|
|
311
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
312
|
+
return useQuery([...devPortalCacheKeys.branchesList(projectId), platformUrl, isLoggedIn], () => getBranches({ projectId, platformUrl, platformAuthToken }), {
|
|
313
313
|
enabled: projectId ? true : false,
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
function useGetNodeContent({ nodeSlug, projectId, branchSlug, }) {
|
|
318
|
-
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
319
|
-
return useQuery([...devPortalCacheKeys.branchNodeDetails(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : '', nodeSlug), platformUrl,
|
|
318
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
319
|
+
return useQuery([...devPortalCacheKeys.branchNodeDetails(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : '', nodeSlug), platformUrl, isLoggedIn], () => getNodeContent({ nodeSlug, projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: nodeSlug && projectId ? true : false });
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stoplight.io', platformAuthToken, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -334,8 +334,8 @@ const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stop
|
|
|
334
334
|
});
|
|
335
335
|
|
|
336
336
|
function useGetTableOfContents({ projectId, branchSlug }) {
|
|
337
|
-
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
338
|
-
return useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl,
|
|
337
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
338
|
+
return useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId ? true : false });
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, collapseTableOfContents = false, tryItCredentialsPolicy, tryItCorsProxy, }) => {
|
|
@@ -690,12 +690,12 @@ function useDebounce(value, delay, options) {
|
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
function useGetNodes({ search, workspaceId, projectIds, branch, pause, }) {
|
|
693
|
-
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
693
|
+
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
694
694
|
const [debounceSearch] = useDebounce(search, 500);
|
|
695
695
|
return useQuery([
|
|
696
696
|
...devPortalCacheKeys.searchNodes({ projectIds, branchSlug: branch, workspaceId, search: debounceSearch }),
|
|
697
697
|
platformUrl,
|
|
698
|
-
|
|
698
|
+
isLoggedIn,
|
|
699
699
|
], () => getNodes({ workspaceId, projectIds, branchSlug: branch, search: debounceSearch, platformUrl, platformAuthToken }), { enabled: !pause, keepPreviousData: true });
|
|
700
700
|
}
|
|
701
701
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements-dev-portal",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
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.1.
|
|
29
|
+
"@stoplight/elements-core": "~8.1.1",
|
|
30
30
|
"@stoplight/markdown-viewer": "^5.7.0",
|
|
31
|
-
"@stoplight/mosaic": "^1.
|
|
31
|
+
"@stoplight/mosaic": "^1.52.0",
|
|
32
32
|
"@stoplight/path": "^1.3.2",
|
|
33
33
|
"@stoplight/types": "^14.0.0",
|
|
34
34
|
"classnames": "^2.2.6",
|