@redocly/reference-docs 2.39.2 → 2.40.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.
- package/bin/cli/commands/redocly-docs-cli.min.js +76 -41
- package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +1 -1
- package/dist/console.redocly-reference-docs.min.js +1 -1
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-reference-docs.min.js +635 -582
- package/lib/components/Overlay/Overlay.d.ts +3 -0
- package/lib/components/Overlay/Overlay.js +2 -0
- package/lib/components/Overlay/constants.d.ts +9 -0
- package/lib/components/Overlay/constants.js +2 -0
- package/lib/components/Overlay/index.d.ts +1 -0
- package/lib/components/Overlay/index.js +2 -0
- package/lib/components/Overlay/styled.d.ts +6 -0
- package/lib/components/Overlay/styled.js +2 -0
- package/lib/components/Overlay/types.d.ts +16 -0
- package/lib/components/Overlay/types.js +2 -0
- package/lib/components/RedoclyReferenceDocs.js +1 -1
- package/lib/services/ProStore.js +1 -1
- package/lib/services/check.d.ts +6 -0
- package/lib/services/check.js +1 -1
- package/lib-esm/components/Overlay/Overlay.d.ts +3 -0
- package/lib-esm/components/Overlay/Overlay.js +2 -0
- package/lib-esm/components/Overlay/constants.d.ts +9 -0
- package/lib-esm/components/Overlay/constants.js +2 -0
- package/lib-esm/components/Overlay/index.d.ts +1 -0
- package/lib-esm/components/Overlay/index.js +2 -0
- package/lib-esm/components/Overlay/styled.d.ts +6 -0
- package/lib-esm/components/Overlay/styled.js +2 -0
- package/lib-esm/components/Overlay/types.d.ts +16 -0
- package/lib-esm/components/Overlay/types.js +2 -0
- package/lib-esm/components/RedoclyReferenceDocs.js +1 -1
- package/lib-esm/services/ProStore.js +1 -1
- package/lib-esm/services/check.d.ts +6 -0
- package/lib-esm/services/check.js +1 -1
- package/package.json +1 -1
- package/lib/components/Overlay.d.ts +0 -11
- package/lib/components/Overlay.js +0 -2
- package/lib-esm/components/Overlay.d.ts +0 -11
- package/lib-esm/components/Overlay.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Overlay=void 0;var tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),styled_1=require("../console/styled"),constants_1=require("./constants"),styled_2=require("./styled");function addUtmParametersToLink(e,t){return 0===Object.keys(t).length?e:e+"?"+new URLSearchParams((0,tslib_1.__assign)({},t)).toString()}var Overlay=function(e){var t=e.l,s=(0,react_1.useState)(null),r=s[0],n=s[1],i=(0,react_1.useState)(-1),a=i[0],l=i[1],_=(0,react_1.useState)(!1),o=_[0],u=_[1],c=(0,react_1.useRef)(constants_1.ATTRIBUTION_LINKS[Math.floor(Math.random()*constants_1.ATTRIBUTION_LINKS.length)]).current,d=(0,react_1.useMemo)((function(){return{utm_source:"preview-docs",utm_content:c.label,utm_medium:"attribution-link",utm_campaign:"preview-docs"}}),[c.label]),m=(0,react_1.useState)(addUtmParametersToLink(c.link,d)),v=m[0],x=m[1],j=(0,react_1.useState)(!1),b=j[0],h=j[1],y=(0,react_1.useState)(!0),p=y[0],g=y[1];return(0,react_1.useEffect)((function(){(0,tslib_1.__awaiter)(void 0,void 0,void 0,(function(){var e,s,r,i;return(0,tslib_1.__generator)(this,(function(a){switch(a.label){case 0:return[4,t];case 1:return e=a.sent(),(null===(s=e.plugin)||void 0===s?void 0:s.valid)&&(h(!0),x(addUtmParametersToLink(c.link,(0,tslib_1.__assign)((0,tslib_1.__assign)({},d),null===(r=e.plugin)||void 0===r?void 0:r.utms)))),e.local?(u(!0),[2]):(e.valid?e.allowed?e.expired&&n(e.t?constants_1.EXPIRED:constants_1.TRIAL_EXPIRED):n(constants_1.INVALID_HOST):n(!1===e.valid?constants_1.INVALID_KEY+(e.cryptoMissing?": works only with https":""):constants_1.INVALID_KEY_MISSING),e.t&&l(Math.ceil(((null!==(i=null==e?void 0:e.e)&&void 0!==i?i:0)-Date.now()/1e3)/60/60/24)),[2])}}))}))}),[c.link,t,d]),b||o?p?(0,jsx_runtime_1.jsxs)(styled_2.Wrapper,(0,tslib_1.__assign)({className:"top-banner"},{children:[(0,jsx_runtime_1.jsx)(styled_1.CloseButton,(0,tslib_1.__assign)({onClick:function(){return g(!1)}},{children:" ✕ "}),void 0),(0,jsx_runtime_1.jsxs)("a",(0,tslib_1.__assign)({target:"_blank",rel:"noopener",href:v},{children:[(0,jsx_runtime_1.jsx)(styled_2.RedoclyLogo,{},void 0),c.label]}),void 0)]}),void 0):null:!r&&a>-1?(0,jsx_runtime_1.jsxs)(styled_2.TrialWrap,{children:[" Trial version: ",a," days remaining "]},void 0):r?(0,jsx_runtime_1.jsx)(styled_2.Flash,{children:(0,jsx_runtime_1.jsxs)("span",{children:[r," ",(0,jsx_runtime_1.jsx)("br",{},void 0),(0,jsx_runtime_1.jsxs)("small",{children:["Please contact ",(0,jsx_runtime_1.jsx)("a",(0,tslib_1.__assign)({href:"mailto:team@redoc.ly"},{children:"team@redoc.ly"}),void 0)," to remedy the problem."," "]},void 0)]},void 0)},void 0):null};exports.Overlay=Overlay;
|
|
2
|
+
//# sourceMappingURL=Overlay.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const INVALID_KEY = "Invalid license key";
|
|
2
|
+
export declare const INVALID_KEY_MISSING: string;
|
|
3
|
+
export declare const EXPIRED = "Invalid license key: expired";
|
|
4
|
+
export declare const TRIAL_EXPIRED = "Invalid license key: expired";
|
|
5
|
+
export declare const INVALID_HOST = "Invalid license key: host not allowed";
|
|
6
|
+
export declare const ATTRIBUTION_LINKS: {
|
|
7
|
+
label: string;
|
|
8
|
+
link: string;
|
|
9
|
+
}[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ATTRIBUTION_LINKS=exports.INVALID_HOST=exports.TRIAL_EXPIRED=exports.EXPIRED=exports.INVALID_KEY_MISSING=exports.INVALID_KEY=void 0,exports.INVALID_KEY="Invalid license key",exports.INVALID_KEY_MISSING=exports.INVALID_KEY+": missing key",exports.EXPIRED="Invalid license key: expired",exports.TRIAL_EXPIRED=exports.EXPIRED,exports.INVALID_HOST="Invalid license key: host not allowed",exports.ATTRIBUTION_LINKS=[{label:"API docs powered by Redocly",link:"https://redocly.com/reference/"},{label:"It's not API docs; it's Redocly. Learn more",link:"https://redocly.com/reference/"},{label:"Learn the top 3 API onboarding funnels",link:"https://redocly.com/api-onboarding-funnels"},{label:"Download the 8-step system to building better APIs",link:"https://redocly.com/better-apis"},{label:"Get 5 mental models for building better APIs",link:"http://redocly.com/mental-models"},{label:"Download the ultimate API launch checklist",link:"http://redocly.com/api-launch-checklist"},{label:"Learn if an API catalog is right for you",link:"http://redocly.com/api-catalog-quiz"},{label:"How to implement an API design scorecard",link:"http://redocly.com/implement-design-scorecard"},{label:"5-steps to introduce API governance to your organization",link:"http://redocly.com/introduce-governance"},{label:"Subscribe to get Redocly Founder's API wisdom into your inbox",link:"http://redocly.com/api-wisdom"},{label:"When do you need an API catalog?",link:"http://redocly.com/api-catalog-quiz"},{label:"What is your API personality? Try the free quiz.",link:"http://redocly.com/api-personality-quiz"}];
|
|
2
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Overlay } from './Overlay';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const RedoclyLogoSVG: string;
|
|
3
|
+
export declare function RedoclyLogo(): JSX.Element | null;
|
|
4
|
+
export declare const Wrapper: import("styled-components").StyledComponent<"div", import("../../services/extendTheme").ProTheme, {}, never>;
|
|
5
|
+
export declare const TrialWrap: import("styled-components").StyledComponent<"div", import("../../services/extendTheme").ProTheme, {}, never>;
|
|
6
|
+
export declare const Flash: import("styled-components").StyledComponent<"div", import("../../services/extendTheme").ProTheme, {}, never>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Flash=exports.TrialWrap=exports.Wrapper=exports.RedoclyLogo=exports.RedoclyLogoSVG=void 0;var templateObject_1,templateObject_2,templateObject_3,tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),redoc_lib_1=require("../../redoc-lib");function RedoclyLogo(){return(0,jsx_runtime_1.jsx)("img",{alt:"redocly logo",onError:function(n){var e=n.currentTarget;e.onerror=null,e.src=exports.RedoclyLogoSVG},src:"https://cdn.redoc.ly/redoc/logo-mini.svg"},void 0)}exports.RedoclyLogoSVG="data:image/svg+xml;base64,"+btoa('\n <svg width="16" height="16" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M30.2267 27.7822C29.3436 27.186 28.3802 26.6296 27.4168 26.2321C29.1027 25.5167 30.6682 24.5231 31.9126 23.2512C34.4014 20.787 35.9669 17.3688 35.9669 13.6327C35.9669 9.85691 34.4416 6.47854 31.9126 4.01431C29.4239 1.51033 26.0118 0 22.1984 0H1.04368C0.762692 0 0.4817 0.119237 0.321133 0.317965C0.120425 0.476948 0 0.755167 0 1.03339C0 1.31161 0.120425 1.58983 0.321133 1.74881C0.4817 1.94754 0.762692 2.06677 1.04368 2.06677C4.25502 2.06677 7.18536 3.37838 9.31287 5.44515C11.4002 7.55167 12.7249 10.4531 12.7249 13.6327C12.7249 16.8124 11.4002 19.7138 9.31287 21.8203C7.18536 23.8871 4.25502 25.1987 1.04368 25.1987C0.923259 25.1987 0.883117 25.2385 0.762692 25.2385C0.321133 25.3577 0 25.7154 0 26.1924V26.3116C0 26.868 0.441558 27.2655 0.9634 27.2655H1.64581C3.97403 27.3847 6.14168 28.1399 7.90791 29.4118C9.83471 30.8029 11.32 32.7107 12.1228 34.9762C12.2432 35.3736 12.6848 35.6518 13.0862 35.6518H34.281C34.6021 35.6518 34.9233 35.4928 35.0838 35.2146C35.2845 34.9364 35.3247 34.6184 35.2043 34.3005C34.2409 31.6773 32.5148 29.4118 30.2267 27.7822ZM10.758 23.2512C13.2468 20.787 14.8123 17.3688 14.8123 13.6327C14.8123 9.85691 13.2869 6.47854 10.758 4.01431C9.99528 3.25914 9.1523 2.58347 8.22904 2.02703H22.1984C25.4097 2.02703 28.34 3.33863 30.4675 5.4054C32.5549 7.51192 33.8796 10.4134 33.8796 13.593C33.8796 16.7727 32.5549 19.6741 30.4675 21.7806C28.34 23.8474 25.4097 25.159 22.1984 25.159C22.1181 25.159 22.0779 25.159 21.9976 25.1987H8.1889C9.11216 24.7218 9.99528 24.0461 10.758 23.2512ZM9.07202 27.7822C8.83117 27.6232 8.55018 27.4642 8.30933 27.2655H22.8406C25.1688 27.3847 27.3365 28.1399 29.1027 29.4118C30.6281 30.4849 31.8725 31.9157 32.7155 33.6248H13.7285C12.7651 31.2798 11.1192 29.2925 9.07202 27.7822Z"\n fill="#0044d4"\n />\n <path\n d="M18.9873 13.6328C18.9873 14.1892 19.4289 14.6264 19.9908 14.6264H30.1868C30.7488 14.6264 31.1904 14.1892 31.1904 13.6328C31.1904 13.0764 30.7488 12.6392 30.1868 12.6392H20.031C19.4289 12.6392 18.9873 13.1161 18.9873 13.6328Z"\n fill="#0044d4"\n />\n <path\n d="M18.2647 18.6806H28.4607C29.0226 18.6806 29.4642 18.2434 29.4642 17.687C29.4642 17.1306 29.0226 16.6934 28.4607 16.6934H18.2647C17.7027 16.6934 17.2611 17.1306 17.2611 17.687C17.221 18.2434 17.7027 18.6806 18.2647 18.6806Z"\n fill="#0044d4"\n />\n <path\n d="M18.2647 10.6123H28.4607C29.0226 10.6123 29.4642 10.1751 29.4642 9.61864C29.4642 9.0622 29.0226 8.625 28.4607 8.625H18.2647C17.7027 8.625 17.2611 9.0622 17.2611 9.61864C17.221 10.1353 17.7027 10.6123 18.2647 10.6123Z"\n fill="#0044d4"\n />\n </svg>'),exports.RedoclyLogo=RedoclyLogo,exports.Wrapper=redoc_lib_1.styled.div(templateObject_1||(templateObject_1=(0,tslib_1.__makeTemplateObject)(["\n display: flex;\n padding: 6px 20px;\n font-size: 13px;\n margin-bottom: 10px;\n font-family: ",";\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: black;\n z-index: 10;\n text-align: center;\n border-bottom: 1px solid ",";\n\n svg,\n img {\n width: 15px;\n margin: 0 5px;\n }\n > a,\n a:visited,\n a:hover {\n white-space: pre-wrap;\n flex: 1;\n color: black;\n text-decoration: none;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n span {\n color: black;\n font-size: 13px;\n }\n"],["\n display: flex;\n padding: 6px 20px;\n font-size: 13px;\n margin-bottom: 10px;\n font-family: ",";\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: black;\n z-index: 10;\n text-align: center;\n border-bottom: 1px solid ",";\n\n svg,\n img {\n width: 15px;\n margin: 0 5px;\n }\n > a,\n a:visited,\n a:hover {\n white-space: pre-wrap;\n flex: 1;\n color: black;\n text-decoration: none;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n span {\n color: black;\n font-size: 13px;\n }\n"])),(function(n){return n.theme.typography.fontFamily}),(function(n){return n.theme.colors.border.light})),exports.TrialWrap=redoc_lib_1.styled.div(templateObject_2||(templateObject_2=(0,tslib_1.__makeTemplateObject)(["\n padding: 10px 40px;\n position: fixed;\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: orange;\n z-index: 10;\n opacity: 0.6;\n\n > a,\n a:visited {\n color: orange;\n }\n"],["\n padding: 10px 40px;\n position: fixed;\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: orange;\n z-index: 10;\n opacity: 0.6;\n\n > a,\n a:visited {\n color: orange;\n }\n"]))),exports.Flash=redoc_lib_1.styled.div(templateObject_3||(templateObject_3=(0,tslib_1.__makeTemplateObject)(["\n font-size: 1.5em;\n position: fixed;\n z-index: 100;\n background: rgba(38, 50, 56, 0.93);\n margin: 0;\n padding: 1em;\n width: 100%;\n color: white;\n height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n\n text-align: center;\n box-sizing: border-box;\n\n > span {\n display: inline-block;\n line-height: 1.5;\n }\n\n a,\n a:hover,\n a:visited {\n color: white;\n }\n"],["\n font-size: 1.5em;\n position: fixed;\n z-index: 100;\n background: rgba(38, 50, 56, 0.93);\n margin: 0;\n padding: 1em;\n width: 100%;\n color: white;\n height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n\n text-align: center;\n box-sizing: border-box;\n\n > span {\n display: inline-block;\n line-height: 1.5;\n }\n\n a,\n a:hover,\n a:visited {\n color: white;\n }\n"])));
|
|
2
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LicenseInfo } from '../../services/check';
|
|
2
|
+
export interface UtmParameters {
|
|
3
|
+
utm_campaign?: string;
|
|
4
|
+
utm_source?: string;
|
|
5
|
+
utm_medium?: string;
|
|
6
|
+
utm_content?: string;
|
|
7
|
+
utm_term?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface LicenseCheckProps {
|
|
10
|
+
l: Promise<LicenseInfo>;
|
|
11
|
+
}
|
|
12
|
+
export interface LicenseCheckState {
|
|
13
|
+
m: string | null;
|
|
14
|
+
exp: number;
|
|
15
|
+
local: boolean;
|
|
16
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RedoclyReferenceDocsStandalone=exports.RedoclyReferenceDocs=exports.CssFixes=void 0;var tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),mobx_react_1=require("mobx-react"),mobx_1=require("mobx"),redoc_lib_1=require("../redoc-lib"),store_types_1=require("../services/store-types"),VersionedSpecStore_1=require("../services/VersionedSpecStore"),DownloadButton_1=require("../redoc-lib/src/components/DownloadButton"),Search_1=require("./Search"),NextSectionButton_1=require("./NextSectionButton"),StoreProvider_1=require("./StoreProvider"),ConsoleLazy_1=require("./console/ConsoleLazy"),ProProviders_1=require("./ProProviders"),Overlay_1=require("./Overlay"),VersionSwitcher_1=require("./VersionSwitcher"),styled_elements_1=require("./styled.elements");(0,mobx_1.configure)({useProxies:"ifavailable"}),exports.CssFixes=(0,redoc_lib_1.createGlobalStyle)(templateObject_1||(templateObject_1=(0,tslib_1.__makeTemplateObject)(['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"],['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"])),redoc_lib_1.RightPanel,(function(e){var t,o=e.theme,n=e.showRightPanel,r=e.layout;return(0,redoc_lib_1.mediaCSS)({width:r===store_types_1.LayoutVariant.STACKED?"100%":"",paddingLeft:r===store_types_1.LayoutVariant.STACKED?o.spacing.sectionHorizontal:"",display:n?"":(t={},t[redoc_lib_1.ZERO_BREAKPOINT]="",t[o.rightPanel.showAtBreakpoint]="none",t)})}),styled_elements_1.BackgroundStub,styled_elements_1.BackgroundStubFix,(function(e){var t,o=e.theme,n=e.showRightPanel,r=e.layout;return(0,redoc_lib_1.mediaCSS)({display:n&&r!==store_types_1.LayoutVariant.STACKED?"":(t={},t[redoc_lib_1.ZERO_BREAKPOINT]="",t[o.rightPanel.showAtBreakpoint]="none",t)})}),redoc_lib_1.MiddlePanel,styled_elements_1.NextSectionButtonWrap,(function(e){var t,o,n,r=e.theme,i=e.showRightPanel,a=e.layout;return(0,redoc_lib_1.mediaCSS)({maxWidth:i&&a===store_types_1.LayoutVariant.THREE_PANEL?(0,redoc_lib_1.mediaMap)(r.breakpoints,[r.layout["three-panel"].middlePanelMaxWidth],(t={},t[redoc_lib_1.ZERO_BREAKPOINT]=function(){return"none"},t[r.rightPanel.showAtBreakpoint]=function(e){return e},t)):"none",margin:i&&a===store_types_1.LayoutVariant.THREE_PANEL?(0,redoc_lib_1.mediaMap)(r.breakpoints,[r.rightPanel.width,r.layout["three-panel"].middlePanelMaxWidth],(o={},o[redoc_lib_1.ZERO_BREAKPOINT]=function(){return"0"},o[r.rightPanel.showAtBreakpoint]=function(e,t){return t&&"none"!==t?"0 max(calc((100% - "+e+" - "+t+"}) / 2), 0px)":"0"},o)):"0",paddingRight:a===store_types_1.LayoutVariant.STACKED?r.spacing.sectionHorizontal:"",width:i&&a===store_types_1.LayoutVariant.THREE_PANEL?"":(n={},n[redoc_lib_1.ZERO_BREAKPOINT]="",n[r.rightPanel.showAtBreakpoint]="100%",n)})}),styled_elements_1.ApiContentWrap,(function(e){var t,o=e.theme,n=e.showRightPanel,r=e.layout;return(0,redoc_lib_1.mediaCSS)({width:(t={},t[redoc_lib_1.ZERO_BREAKPOINT]="none",t.small="calc(100% - "+o.sidebar.width+")",t),maxWidth:o.layout[r===store_types_1.LayoutVariant.THREE_PANEL&&n?store_types_1.LayoutVariant.THREE_PANEL:store_types_1.LayoutVariant.STACKED].maxWidth})}));var templateObject_1,RedoclyReferenceDocs=function(e){function t(t){var o=e.call(this,t)||this;return Object.defineProperty(o,"_observer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_updatedItems",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"rootElementRef",{enumerable:!0,configurable:!0,writable:!0,value:(0,react_1.createRef)()}),Object.defineProperty(o,"handleClose",{enumerable:!0,configurable:!0,writable:!0,value:function(){return o.props.store.tryItOut()}}),o.state={searchPopUpShown:!1,searchPopUpValue:""},o}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,o=this;this.props.store.onDidMount(),null===(t=(e=this.props).onLoaded)||void 0===t||t.call(e),this._observer=(0,mobx_1.reaction)((function(){return o.props.store.menu.renderItems}),(function(){o._updatedItems=!0}))}}),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._updatedItems&&(this._updatedItems=!1,this.props.store.menu.scrollToActive())}}),Object.defineProperty(t.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.props.store.dispose(),this._observer()}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props,o=t.store,n=t._forceRenderInfo,r=o.definition,i=o.menu,a=o.options,s=o.search,l=o.marker,_=a.hideDownloadButton,d=a.hideInfoSection,c=a.pagination,u=a.disableSidebar,p=i.renderItems,h="none"===c||i.activeRenderItemIdx<=0,m=!d&&h;m&&"none"!==c&&u&&p[0]&&"section"!==p[0].type&&(m=!1),n&&(m=!0);var b=!m&&null!==_&&!_&&h;return(0,jsx_runtime_1.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RedoclyReferenceDocsStandalone=exports.RedoclyReferenceDocs=exports.CssFixes=void 0;var tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),mobx_react_1=require("mobx-react"),mobx_1=require("mobx"),redoc_lib_1=require("../redoc-lib"),store_types_1=require("../services/store-types"),VersionedSpecStore_1=require("../services/VersionedSpecStore"),DownloadButton_1=require("../redoc-lib/src/components/DownloadButton"),Search_1=require("./Search"),NextSectionButton_1=require("./NextSectionButton"),StoreProvider_1=require("./StoreProvider"),ConsoleLazy_1=require("./console/ConsoleLazy"),ProProviders_1=require("./ProProviders"),Overlay_1=require("./Overlay"),VersionSwitcher_1=require("./VersionSwitcher"),styled_elements_1=require("./styled.elements");(0,mobx_1.configure)({useProxies:"ifavailable"}),exports.CssFixes=(0,redoc_lib_1.createGlobalStyle)(templateObject_1||(templateObject_1=(0,tslib_1.__makeTemplateObject)(['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"],['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"])),redoc_lib_1.RightPanel,(function(e){var t,o=e.theme,n=e.showRightPanel,r=e.layout;return(0,redoc_lib_1.mediaCSS)({width:r===store_types_1.LayoutVariant.STACKED?"100%":"",paddingLeft:r===store_types_1.LayoutVariant.STACKED?o.spacing.sectionHorizontal:"",display:n?"":(t={},t[redoc_lib_1.ZERO_BREAKPOINT]="",t[o.rightPanel.showAtBreakpoint]="none",t)})}),styled_elements_1.BackgroundStub,styled_elements_1.BackgroundStubFix,(function(e){var t,o=e.theme,n=e.showRightPanel,r=e.layout;return(0,redoc_lib_1.mediaCSS)({display:n&&r!==store_types_1.LayoutVariant.STACKED?"":(t={},t[redoc_lib_1.ZERO_BREAKPOINT]="",t[o.rightPanel.showAtBreakpoint]="none",t)})}),redoc_lib_1.MiddlePanel,styled_elements_1.NextSectionButtonWrap,(function(e){var t,o,n,r=e.theme,i=e.showRightPanel,a=e.layout;return(0,redoc_lib_1.mediaCSS)({maxWidth:i&&a===store_types_1.LayoutVariant.THREE_PANEL?(0,redoc_lib_1.mediaMap)(r.breakpoints,[r.layout["three-panel"].middlePanelMaxWidth],(t={},t[redoc_lib_1.ZERO_BREAKPOINT]=function(){return"none"},t[r.rightPanel.showAtBreakpoint]=function(e){return e},t)):"none",margin:i&&a===store_types_1.LayoutVariant.THREE_PANEL?(0,redoc_lib_1.mediaMap)(r.breakpoints,[r.rightPanel.width,r.layout["three-panel"].middlePanelMaxWidth],(o={},o[redoc_lib_1.ZERO_BREAKPOINT]=function(){return"0"},o[r.rightPanel.showAtBreakpoint]=function(e,t){return t&&"none"!==t?"0 max(calc((100% - "+e+" - "+t+"}) / 2), 0px)":"0"},o)):"0",paddingRight:a===store_types_1.LayoutVariant.STACKED?r.spacing.sectionHorizontal:"",width:i&&a===store_types_1.LayoutVariant.THREE_PANEL?"":(n={},n[redoc_lib_1.ZERO_BREAKPOINT]="",n[r.rightPanel.showAtBreakpoint]="100%",n)})}),styled_elements_1.ApiContentWrap,(function(e){var t,o=e.theme,n=e.showRightPanel,r=e.layout;return(0,redoc_lib_1.mediaCSS)({width:(t={},t[redoc_lib_1.ZERO_BREAKPOINT]="none",t.small="calc(100% - "+o.sidebar.width+")",t),maxWidth:o.layout[r===store_types_1.LayoutVariant.THREE_PANEL&&n?store_types_1.LayoutVariant.THREE_PANEL:store_types_1.LayoutVariant.STACKED].maxWidth})}));var templateObject_1,RedoclyReferenceDocs=function(e){function t(t){var o=e.call(this,t)||this;return Object.defineProperty(o,"_observer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_updatedItems",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"rootElementRef",{enumerable:!0,configurable:!0,writable:!0,value:(0,react_1.createRef)()}),Object.defineProperty(o,"handleClose",{enumerable:!0,configurable:!0,writable:!0,value:function(){return o.props.store.tryItOut()}}),o.state={searchPopUpShown:!1,searchPopUpValue:""},o}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,o=this;this.props.store.onDidMount(),null===(t=(e=this.props).onLoaded)||void 0===t||t.call(e),this._observer=(0,mobx_1.reaction)((function(){return o.props.store.menu.renderItems}),(function(){o._updatedItems=!0}))}}),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._updatedItems&&(this._updatedItems=!1,this.props.store.menu.scrollToActive())}}),Object.defineProperty(t.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.props.store.dispose(),this._observer()}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props,o=t.store,n=t._forceRenderInfo,r=o.definition,i=o.menu,a=o.options,s=o.search,l=o.marker,_=a.hideDownloadButton,d=a.hideInfoSection,c=a.pagination,u=a.disableSidebar,p=i.renderItems,h="none"===c||i.activeRenderItemIdx<=0,m=!d&&h;m&&"none"!==c&&u&&p[0]&&"section"!==p[0].type&&(m=!1),n&&(m=!0);var b=!m&&null!==_&&!_&&h;return(0,jsx_runtime_1.jsxs)(ProProviders_1.ProProviders,(0,tslib_1.__assign)({store:o},{children:[(0,jsx_runtime_1.jsx)(Overlay_1.Overlay,{l:o.l},void 0),(0,jsx_runtime_1.jsxs)(styled_elements_1.RedocWrap,(0,tslib_1.__assign)({className:"redoc-wrap",ref:this.rootElementRef},{children:[(0,jsx_runtime_1.jsx)(exports.CssFixes,{whiteLabel:a.whiteLabel,showRightPanel:o.showRightPanel,layout:o.layout},void 0),o.tryItOperation&&(0,jsx_runtime_1.jsx)(ConsoleLazy_1.Console,{rootElement:this.rootElementRef.current,store:o,operation:o.tryItOperation,onClose:this.handleClose},void 0),!a.disableSidebar&&(0,jsx_runtime_1.jsxs)(redoc_lib_1.StickyResponsiveSidebar,(0,tslib_1.__assign)({menu:i,className:"menu-content"},{children:[!a.hideLogo&&(0,jsx_runtime_1.jsx)(redoc_lib_1.ApiLogo,{info:r.info},void 0),r instanceof VersionedSpecStore_1.VersionedSpecStore&&(0,jsx_runtime_1.jsx)(VersionSwitcher_1.VersionSwitcher,{spec:r,onChange:function(e){void 0!==e.idx&&r.changeVersion(e.idx),i.updateItemsByVersionChange(!0),o.tryItOut(void 0)}},void 0),!a.disableSearch&&(0,jsx_runtime_1.jsx)(Search_1.SearchField,{showPopUp:function(){return e.setState({searchPopUpShown:!0})},searchValue:this.state.searchPopUpValue,marker:l,setSearchValue:function(t){return e.setState({searchPopUpValue:t})}},void 0),(0,jsx_runtime_1.jsx)(redoc_lib_1.SideMenu,{menu:i},void 0)]}),void 0),(0,jsx_runtime_1.jsxs)(styled_elements_1.ApiContentWrap,(0,tslib_1.__assign)({className:(o.isLoading?"loading ":"")+"api-content",layout:o.layout===store_types_1.LayoutVariant.THREE_PANEL&&o.showRightPanel?store_types_1.LayoutVariant.THREE_PANEL:store_types_1.LayoutVariant.STACKED},{children:[a.theme.layout.showDarkRightPanel&&o.showRightPanel&&o.layout!==store_types_1.LayoutVariant.STACKED&&(0,jsx_runtime_1.jsx)(styled_elements_1.BackgroundStub,{},void 0),m&&(0,jsx_runtime_1.jsx)(redoc_lib_1.ApiInfo,{store:o},void 0),b&&(0,jsx_runtime_1.jsx)(DownloadButton_1.DownloadButtonWithLabel,{store:o},void 0),(0,jsx_runtime_1.jsx)(redoc_lib_1.ContentItems,{items:p,store:o},void 0),a.showNextButton&&(0,jsx_runtime_1.jsx)(NextSectionButton_1.ContinueButton,{pagination:a.pagination,menu:i},void 0),this.props.children]}),void 0),(0,jsx_runtime_1.jsxs)(styled_elements_1.ControlsWrap,{children:[(0,jsx_runtime_1.jsx)(styled_elements_1.ToggleRightPanelButton,{store:o,isVisible:o.layout===store_types_1.LayoutVariant.THREE_PANEL},void 0),(0,jsx_runtime_1.jsx)(styled_elements_1.ChangeViewButton,{store:o,isVisible:o.showRightPanel},void 0)]},void 0),(0,jsx_runtime_1.jsx)(Search_1.ProSearchBox,{search:s,marker:l,menu:i,onActivate:i.activateAndScroll.bind(i),options:a,shown:this.state.searchPopUpShown,hidePopUp:function(){return e.setState({searchPopUpShown:!1})},showPopUp:function(){return e.setState({searchPopUpShown:!0})},setSearchValue:function(t){return e.setState({searchPopUpValue:t})},searchValue:this.state.searchPopUpValue},void 0),a.theme.layout.showDarkRightPanel&&o.showRightPanel&&o.layout!==store_types_1.LayoutVariant.STACKED&&(0,jsx_runtime_1.jsx)(styled_elements_1.BackgroundStubFix,{},void 0)]}),void 0)]}),void 0)}}),t=(0,tslib_1.__decorate)([mobx_react_1.observer],t)}(react_1.Component);function RedoclyReferenceDocsStandalone(e){var t=e.definition,o=e.definitionUrl,n=e.options,r=void 0===n?{}:n,i=e.activeItemId,a=e.activeSampleLanguage,s=e.activeDeepLink,l=(0,redoc_lib_1.argValueToBoolean)(r.hideLoading,!1),_=new redoc_lib_1.RedocNormalizedOptions(r),d=(0,jsx_runtime_1.jsx)(StoreProvider_1.ProStoreProvider,(0,tslib_1.__assign)({definition:t,definitionUrl:o,options:r,activeItemId:i,activeSampleLanguage:a,activeDeepLink:s},{children:function(e){var t=e.loading,o=e.store;return t?l?null:(0,jsx_runtime_1.jsx)(redoc_lib_1.Loading,{color:_.theme.colors.primary.main},void 0):(0,jsx_runtime_1.jsx)(RedoclyReferenceDocs,{store:o},void 0)}}),void 0);return r.disableErrorBoundary?d:(0,jsx_runtime_1.jsx)(redoc_lib_1.ErrorBoundary,{children:d},void 0)}exports.RedoclyReferenceDocs=RedoclyReferenceDocs,exports.RedoclyReferenceDocsStandalone=RedoclyReferenceDocsStandalone;
|
|
2
2
|
//# sourceMappingURL=RedoclyReferenceDocs.js.map
|
package/lib/services/ProStore.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProStore=exports.NestingGroup=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),openapi_core_1=require("@redocly/openapi-core"),decko_1=require("decko"),redoc_lib_1=require("../redoc-lib"),pluggable_1=require("../components/pluggable"),utils_1=require("../utils"),SecurityDefs_1=require("../redoc-lib/src/components/SecurityRequirement/SecurityDefs"),types_1=require("../types"),history_1=require("./history"),ProMenu_1=require("./ProMenu"),SearchStore_1=require("./SearchStore"),extendTheme_1=require("./extendTheme"),VersionedSpecStore_1=require("./VersionedSpecStore"),check_1=(0,tslib_1.__importDefault)(require("./check")),utils_2=require("./utils"),store_types_1=require("./store-types"),types_2=require("./types"),global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"expand",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"collapse",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),e}();function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}exports.NestingGroup=NestingGroup;var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new redoc_lib_1.MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:store_types_1.LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.initProOptions(i),redoc_lib_1.IS_BROWSER&&(this.l=(0,check_1.default)(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new history_1.FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new history_1.PushStateHistoryService(this.options,r):new history_1.ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore_1.VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new redoc_lib_1.SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new redoc_lib_1.ScrollService(this.options),this.options.disableSidebar||ProMenu_1.ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu_1.ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=(0,mobx_1.observe)(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),(0,utils_1.setGlobalStore)(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r,a;e=deepClone(e),this.rawOptions=(0,extendTheme_1.extendTheme)(e),this.options=new redoc_lib_1.RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),null!=this.rawOptions.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),this.options.showConsole=null!=this.rawOptions.hideTryItPanel?!this.rawOptions.hideTryItPanel:null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||store_types_1.LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||types_2.SideNavStyle.SummaryOnly,this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.unstable_hideServerUrlInTryIt=this.rawOptions.unstable_hideServerUrlInTryIt||!1,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.mockServer=(null===(r=this.rawOptions.mockServer)||void 0===r?void 0:r.url)?{url:this.rawOptions.mockServer.url,position:this.rawOptions.mockServer.position||"first",description:this.rawOptions.mockServer.description||"Mock server"}:null,this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.LINK_FOR_ID)||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.GENERATE_DEEP_LINK)||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.ON_DEEP_LINK_CLICK)||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.REQUEST_INTERCEPTOR)||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var s="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy=void 0!==this.rawOptions.routingStrategy?this.rawOptions.routingStrategy:"none"===this.options.pagination?"hash":"browser",!(null===(a=this.rawOptions)||void 0===a?void 0:a.pagination)&&(null==s?void 0:s.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==s?void 0:s.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&(0,utils_2.normalizePath)(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SearchStore_1.DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new SearchStore_1.RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new SearchStore_1.DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&(0,mobx_1.observe)(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new SearchStore_1.DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(redoc_lib_1.IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),redoc_lib_1.IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=(0,utils_1.fromLocalStorage)("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=(0,utils_1.fromLocalStorage)("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=(0,utils_1.fromSessionStorage)("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,(0,utils_1.toSessionStorage)("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=store_types_1.LayoutVariant.THREE_PANEL),this.layout=e,(0,utils_1.toLocalStorage)("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,(0,utils_1.toLocalStorage)("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var r,a,s,l,p,u,c,d;return(0,tslib_1.__generator)(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=(0,tslib_1.__assign)((0,tslib_1.__assign)({},getSpecVersionObj(a)),{components:a.components,paths:(c={},c[e.path]=(d={},d[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],d.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,d),c)}),l=new openapi_core_1.Config({}),p=(0,redoc_lib_1.createParsedDocument)(s),u={config:l,doc:p,dereference:!0},[4,(0,openapi_core_1.bundle)(u)];case 1:return h.sent(),[2,a]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];(0,mobx_1.observe)(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&(0,mobx_1.observe)(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);(0,utils_1.setGlobalStore)(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore_1.VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"search",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"tryItOperation",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showRightPanel",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"layout",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeSampleLanguage",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"isLoading",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"onDidMount",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleLayout",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"tryItOut",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveSampleLanguage",null),(0,tslib_1.__decorate)([decko_1.bind,(0,decko_1.debounce)(500)],e.prototype,"activateSampleLanguage",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"startLoader",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"stopLoader",null),e}();exports.ProStore=ProStore;var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:pluggable_1.RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:pluggable_1.PullRight,propsSelector:function(){return{}}}},_a[redoc_lib_1.SCHEMA_DEFINITION_JSX_NAME]={component:redoc_lib_1.SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
1
|
+
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProStore=exports.NestingGroup=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),openapi_core_1=require("@redocly/openapi-core"),decko_1=require("decko"),redoc_lib_1=require("../redoc-lib"),pluggable_1=require("../components/pluggable"),utils_1=require("../utils"),SecurityDefs_1=require("../redoc-lib/src/components/SecurityRequirement/SecurityDefs"),types_1=require("../types"),history_1=require("./history"),ProMenu_1=require("./ProMenu"),SearchStore_1=require("./SearchStore"),extendTheme_1=require("./extendTheme"),VersionedSpecStore_1=require("./VersionedSpecStore"),check_1=(0,tslib_1.__importDefault)(require("./check")),utils_2=require("./utils"),store_types_1=require("./store-types"),types_2=require("./types"),global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"expand",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"collapse",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),e}();function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}exports.NestingGroup=NestingGroup;var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new redoc_lib_1.MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:store_types_1.LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.initProOptions(i),redoc_lib_1.IS_BROWSER&&(this.l=(0,check_1.default)(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||e.plugin||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new history_1.FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new history_1.PushStateHistoryService(this.options,r):new history_1.ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore_1.VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new redoc_lib_1.SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new redoc_lib_1.ScrollService(this.options),this.options.disableSidebar||ProMenu_1.ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu_1.ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=(0,mobx_1.observe)(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),(0,utils_1.setGlobalStore)(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r,a;e=deepClone(e),this.rawOptions=(0,extendTheme_1.extendTheme)(e),this.options=new redoc_lib_1.RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),null!=this.rawOptions.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),this.options.showConsole=null!=this.rawOptions.hideTryItPanel?!this.rawOptions.hideTryItPanel:null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||store_types_1.LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||types_2.SideNavStyle.SummaryOnly,this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.unstable_hideServerUrlInTryIt=this.rawOptions.unstable_hideServerUrlInTryIt||!1,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.mockServer=(null===(r=this.rawOptions.mockServer)||void 0===r?void 0:r.url)?{url:this.rawOptions.mockServer.url,position:this.rawOptions.mockServer.position||"first",description:this.rawOptions.mockServer.description||"Mock server"}:null,this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.LINK_FOR_ID)||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.GENERATE_DEEP_LINK)||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.ON_DEEP_LINK_CLICK)||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||(0,utils_1.getWindowReferenceOptions)(types_1.WindowReferenceOptions.REQUEST_INTERCEPTOR)||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var s="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy=void 0!==this.rawOptions.routingStrategy?this.rawOptions.routingStrategy:"none"===this.options.pagination?"hash":"browser",!(null===(a=this.rawOptions)||void 0===a?void 0:a.pagination)&&(null==s?void 0:s.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==s?void 0:s.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&(0,utils_2.normalizePath)(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SearchStore_1.DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new SearchStore_1.RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new SearchStore_1.DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&(0,mobx_1.observe)(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new SearchStore_1.DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(redoc_lib_1.IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),redoc_lib_1.IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=(0,utils_1.fromLocalStorage)("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=(0,utils_1.fromLocalStorage)("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=(0,utils_1.fromSessionStorage)("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,(0,utils_1.toSessionStorage)("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=store_types_1.LayoutVariant.THREE_PANEL),this.layout=e,(0,utils_1.toLocalStorage)("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,(0,utils_1.toLocalStorage)("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var r,a,s,l,p,u,c,d;return(0,tslib_1.__generator)(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=(0,tslib_1.__assign)((0,tslib_1.__assign)({},getSpecVersionObj(a)),{components:a.components,paths:(c={},c[e.path]=(d={},d[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],d.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,d),c)}),l=new openapi_core_1.Config({}),p=(0,redoc_lib_1.createParsedDocument)(s),u={config:l,doc:p,dereference:!0},[4,(0,openapi_core_1.bundle)(u)];case 1:return h.sent(),[2,a]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];(0,mobx_1.observe)(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&(0,mobx_1.observe)(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);(0,utils_1.setGlobalStore)(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore_1.VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"search",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"tryItOperation",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showRightPanel",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"layout",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeSampleLanguage",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"isLoading",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"onDidMount",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleLayout",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"tryItOut",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveSampleLanguage",null),(0,tslib_1.__decorate)([decko_1.bind,(0,decko_1.debounce)(500)],e.prototype,"activateSampleLanguage",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"startLoader",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"stopLoader",null),e}();exports.ProStore=ProStore;var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:pluggable_1.RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:pluggable_1.PullRight,propsSelector:function(){return{}}}},_a[redoc_lib_1.SCHEMA_DEFINITION_JSX_NAME]={component:redoc_lib_1.SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
2
2
|
//# sourceMappingURL=ProStore.js.map
|
package/lib/services/check.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import type { UtmParameters } from '../components/Overlay/types';
|
|
1
2
|
export declare type LicenseInfo = {
|
|
2
3
|
t?: boolean;
|
|
3
4
|
i?: number;
|
|
4
5
|
e?: number;
|
|
5
6
|
h?: string[] | true;
|
|
7
|
+
s?: string;
|
|
6
8
|
valid?: boolean;
|
|
7
9
|
expired?: boolean;
|
|
8
10
|
allowed?: boolean;
|
|
9
11
|
local?: boolean;
|
|
10
12
|
cryptoMissing?: boolean;
|
|
13
|
+
plugin?: {
|
|
14
|
+
valid: boolean;
|
|
15
|
+
utms: UtmParameters;
|
|
16
|
+
};
|
|
11
17
|
};
|
|
12
18
|
export declare function isHostAllowed(hostname: string, hosts: string[] | boolean | undefined): boolean;
|
|
13
19
|
export default function parse(key?: string): Promise<LicenseInfo>;
|
package/lib/services/check.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isHostAllowed=void 0;var tslib_1=require("tslib"),utils_1=require("./utils");function promisifyIECryptoRes(e){return"then"in e?e:new Promise((function(t){e.oncomplete=function(e){t(e.target.result)}}))}function str2ab(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0,i=e.length;n<i;n++)r[n]=e.charCodeAt(n);return t}var getKey=function(){var e,t=str2ab(atob("undefined"!=typeof REDOCLY_PUBLIC_KEY?REDOCLY_PUBLIC_KEY:"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMHjNir5fXx/ZXoaEeXQ5XyxbNJ4YJYczoCRdSkL6NLzw1FHnng5Vfcgk5+bvox9QRYRbuk84mA4f2NhywDbXKECAwEAAQ=="));return promisifyIECryptoRes(null===(e=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isHostAllowed=void 0;var tslib_1=require("tslib"),utils_1=require("../redoc-lib/src/utils"),utils_2=require("./utils");function promisifyIECryptoRes(e){return"then"in e?e:new Promise((function(t){e.oncomplete=function(e){t(e.target.result)}}))}function str2ab(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0,i=e.length;n<i;n++)r[n]=e.charCodeAt(n);return t}var getKey=function(){var e,t=str2ab(atob("undefined"!=typeof REDOCLY_PUBLIC_KEY?REDOCLY_PUBLIC_KEY:"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMHjNir5fXx/ZXoaEeXQ5XyxbNJ4YJYczoCRdSkL6NLzw1FHnng5Vfcgk5+bvox9QRYRbuk84mA4f2NhywDbXKECAwEAAQ=="));return promisifyIECryptoRes(null===(e=utils_2.cryptoLib)||void 0===e?void 0:e.subtle.importKey("spki",t,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"]))};function textEncode(e){if(window.TextEncoder)return(new TextEncoder).encode(e);for(var t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function verify(e,t){var r;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,l;return(0,tslib_1.__generator)(this,(function(a){switch(a.label){case 0:return n=promisifyIECryptoRes,null!==(r=utils_2.cryptoLib)&&void 0!==r?[3,1]:(i=void 0,[3,3]);case 1:return s=(o=r.subtle).verify,l=[{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"}],[4,getKey()];case 2:i=s.apply(o,l.concat([a.sent(),str2ab(atob(t)),textEncode(e)])),a.label=3;case 3:return[2,n.apply(void 0,[i])]}}))}))}function isHostAllowed(e,t){return!0===t||!(!Array.isArray(t)||"undefined"==typeof window)&&(!("localhost"!==e&&"127.0.0.1"!==e&&!e.endsWith(".localhost")&&!t.find((function(t){return t===e||e.endsWith("."+t)})))||!!t.find((function(t){if(t.indexOf("*")===t.lastIndexOf("*")){var r=t.split("*"),n=r[0],i=r[1];return i&&e.startsWith(n)&&e.endsWith(i)&&i.split(".").length>2}})))}function parse(e){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,r,n,i,o;return(0,tslib_1.__generator)(this,(function(s){switch(s.label){case 0:if("development"===process.env.NODE_ENV)return[2,{valid:!0,allowed:!0}];if(t=utils_1.IS_BROWSER&&window.location.hostname||"",!e)return"localhost"===t||"127.0.0.1"===t||t.endsWith(".localhost")?[2,{local:!0}]:[2,{}];r=e.split("."),n=r[0],i=r[1],s.label=1;case 1:return s.trys.push([1,3,,4]),[4,verify(atob(n),i)];case 2:return s.sent()?(o=JSON.parse(atob(n)),[3,4]):[2,{valid:!1}];case 3:return s.sent(),[2,{valid:!1,cryptoMissing:!0}];case 4:return o.valid=!0,(!o.e||Date.now()/1e3>o.e)&&(o.expired=!0),o.allowed=isHostAllowed(t,o.h),"plugin"===(null==o?void 0:o.s)?[2,{plugin:{valid:!0,utms:{utm_campaign:Array.isArray(null==o?void 0:o.h)&&(null==o?void 0:o.h[0])||"preview-docs"}}}]:[2,o]}}))}))}exports.isHostAllowed=isHostAllowed,exports.default=parse;
|
|
2
2
|
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign,__awaiter,__generator}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useState,useEffect,useRef,useMemo}from"react";import{CloseButton}from"../console/styled";import{ATTRIBUTION_LINKS,EXPIRED,TRIAL_EXPIRED,INVALID_KEY,INVALID_KEY_MISSING,INVALID_HOST}from"./constants";import{Wrapper,RedoclyLogo,TrialWrap,Flash}from"./styled";function addUtmParametersToLink(e,t){return 0===Object.keys(t).length?e:e+"?"+new URLSearchParams(__assign({},t)).toString()}export var Overlay=function(e){var t=e.l,r=useState(null),s=r[0],a=r[1],i=useState(-1),n=i[0],o=i[1],l=useState(!1),_=l[0],d=l[1],u=useRef(ATTRIBUTION_LINKS[Math.floor(Math.random()*ATTRIBUTION_LINKS.length)]).current,c=useMemo((function(){return{utm_source:"preview-docs",utm_content:u.label,utm_medium:"attribution-link",utm_campaign:"preview-docs"}}),[u.label]),m=useState(addUtmParametersToLink(u.link,c)),I=m[0],v=m[1],p=useState(!1),h=p[0],f=p[1],g=useState(!0),T=g[0],S=g[1];return useEffect((function(){__awaiter(void 0,void 0,void 0,(function(){var e,r,s,i;return __generator(this,(function(n){switch(n.label){case 0:return[4,t];case 1:return e=n.sent(),(null===(r=e.plugin)||void 0===r?void 0:r.valid)&&(f(!0),v(addUtmParametersToLink(u.link,__assign(__assign({},c),null===(s=e.plugin)||void 0===s?void 0:s.utms)))),e.local?(d(!0),[2]):(e.valid?e.allowed?e.expired&&a(e.t?EXPIRED:TRIAL_EXPIRED):a(INVALID_HOST):a(!1===e.valid?INVALID_KEY+(e.cryptoMissing?": works only with https":""):INVALID_KEY_MISSING),e.t&&o(Math.ceil(((null!==(i=null==e?void 0:e.e)&&void 0!==i?i:0)-Date.now()/1e3)/60/60/24)),[2])}}))}))}),[u.link,t,c]),h||_?T?_jsxs(Wrapper,__assign({className:"top-banner"},{children:[_jsx(CloseButton,__assign({onClick:function(){return S(!1)}},{children:" ✕ "}),void 0),_jsxs("a",__assign({target:"_blank",rel:"noopener",href:I},{children:[_jsx(RedoclyLogo,{},void 0),u.label]}),void 0)]}),void 0):null:!s&&n>-1?_jsxs(TrialWrap,{children:[" Trial version: ",n," days remaining "]},void 0):s?_jsx(Flash,{children:_jsxs("span",{children:[s," ",_jsx("br",{},void 0),_jsxs("small",{children:["Please contact ",_jsx("a",__assign({href:"mailto:team@redoc.ly"},{children:"team@redoc.ly"}),void 0)," to remedy the problem."," "]},void 0)]},void 0)},void 0):null};
|
|
2
|
+
//# sourceMappingURL=Overlay.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const INVALID_KEY = "Invalid license key";
|
|
2
|
+
export declare const INVALID_KEY_MISSING: string;
|
|
3
|
+
export declare const EXPIRED = "Invalid license key: expired";
|
|
4
|
+
export declare const TRIAL_EXPIRED = "Invalid license key: expired";
|
|
5
|
+
export declare const INVALID_HOST = "Invalid license key: host not allowed";
|
|
6
|
+
export declare const ATTRIBUTION_LINKS: {
|
|
7
|
+
label: string;
|
|
8
|
+
link: string;
|
|
9
|
+
}[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export var INVALID_KEY="Invalid license key";export var INVALID_KEY_MISSING=INVALID_KEY+": missing key";export var EXPIRED="Invalid license key: expired";export var TRIAL_EXPIRED=EXPIRED;export var INVALID_HOST="Invalid license key: host not allowed";export var ATTRIBUTION_LINKS=[{label:"API docs powered by Redocly",link:"https://redocly.com/reference/"},{label:"It's not API docs; it's Redocly. Learn more",link:"https://redocly.com/reference/"},{label:"Learn the top 3 API onboarding funnels",link:"https://redocly.com/api-onboarding-funnels"},{label:"Download the 8-step system to building better APIs",link:"https://redocly.com/better-apis"},{label:"Get 5 mental models for building better APIs",link:"http://redocly.com/mental-models"},{label:"Download the ultimate API launch checklist",link:"http://redocly.com/api-launch-checklist"},{label:"Learn if an API catalog is right for you",link:"http://redocly.com/api-catalog-quiz"},{label:"How to implement an API design scorecard",link:"http://redocly.com/implement-design-scorecard"},{label:"5-steps to introduce API governance to your organization",link:"http://redocly.com/introduce-governance"},{label:"Subscribe to get Redocly Founder's API wisdom into your inbox",link:"http://redocly.com/api-wisdom"},{label:"When do you need an API catalog?",link:"http://redocly.com/api-catalog-quiz"},{label:"What is your API personality? Try the free quiz.",link:"http://redocly.com/api-personality-quiz"}];
|
|
2
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Overlay } from './Overlay';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const RedoclyLogoSVG: string;
|
|
3
|
+
export declare function RedoclyLogo(): JSX.Element | null;
|
|
4
|
+
export declare const Wrapper: import("styled-components").StyledComponent<"div", import("../../services/extendTheme").ProTheme, {}, never>;
|
|
5
|
+
export declare const TrialWrap: import("styled-components").StyledComponent<"div", import("../../services/extendTheme").ProTheme, {}, never>;
|
|
6
|
+
export declare const Flash: import("styled-components").StyledComponent<"div", import("../../services/extendTheme").ProTheme, {}, never>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__makeTemplateObject}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{styled}from"../../redoc-lib";export var RedoclyLogoSVG="data:image/svg+xml;base64,"+btoa('\n <svg width="16" height="16" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M30.2267 27.7822C29.3436 27.186 28.3802 26.6296 27.4168 26.2321C29.1027 25.5167 30.6682 24.5231 31.9126 23.2512C34.4014 20.787 35.9669 17.3688 35.9669 13.6327C35.9669 9.85691 34.4416 6.47854 31.9126 4.01431C29.4239 1.51033 26.0118 0 22.1984 0H1.04368C0.762692 0 0.4817 0.119237 0.321133 0.317965C0.120425 0.476948 0 0.755167 0 1.03339C0 1.31161 0.120425 1.58983 0.321133 1.74881C0.4817 1.94754 0.762692 2.06677 1.04368 2.06677C4.25502 2.06677 7.18536 3.37838 9.31287 5.44515C11.4002 7.55167 12.7249 10.4531 12.7249 13.6327C12.7249 16.8124 11.4002 19.7138 9.31287 21.8203C7.18536 23.8871 4.25502 25.1987 1.04368 25.1987C0.923259 25.1987 0.883117 25.2385 0.762692 25.2385C0.321133 25.3577 0 25.7154 0 26.1924V26.3116C0 26.868 0.441558 27.2655 0.9634 27.2655H1.64581C3.97403 27.3847 6.14168 28.1399 7.90791 29.4118C9.83471 30.8029 11.32 32.7107 12.1228 34.9762C12.2432 35.3736 12.6848 35.6518 13.0862 35.6518H34.281C34.6021 35.6518 34.9233 35.4928 35.0838 35.2146C35.2845 34.9364 35.3247 34.6184 35.2043 34.3005C34.2409 31.6773 32.5148 29.4118 30.2267 27.7822ZM10.758 23.2512C13.2468 20.787 14.8123 17.3688 14.8123 13.6327C14.8123 9.85691 13.2869 6.47854 10.758 4.01431C9.99528 3.25914 9.1523 2.58347 8.22904 2.02703H22.1984C25.4097 2.02703 28.34 3.33863 30.4675 5.4054C32.5549 7.51192 33.8796 10.4134 33.8796 13.593C33.8796 16.7727 32.5549 19.6741 30.4675 21.7806C28.34 23.8474 25.4097 25.159 22.1984 25.159C22.1181 25.159 22.0779 25.159 21.9976 25.1987H8.1889C9.11216 24.7218 9.99528 24.0461 10.758 23.2512ZM9.07202 27.7822C8.83117 27.6232 8.55018 27.4642 8.30933 27.2655H22.8406C25.1688 27.3847 27.3365 28.1399 29.1027 29.4118C30.6281 30.4849 31.8725 31.9157 32.7155 33.6248H13.7285C12.7651 31.2798 11.1192 29.2925 9.07202 27.7822Z"\n fill="#0044d4"\n />\n <path\n d="M18.9873 13.6328C18.9873 14.1892 19.4289 14.6264 19.9908 14.6264H30.1868C30.7488 14.6264 31.1904 14.1892 31.1904 13.6328C31.1904 13.0764 30.7488 12.6392 30.1868 12.6392H20.031C19.4289 12.6392 18.9873 13.1161 18.9873 13.6328Z"\n fill="#0044d4"\n />\n <path\n d="M18.2647 18.6806H28.4607C29.0226 18.6806 29.4642 18.2434 29.4642 17.687C29.4642 17.1306 29.0226 16.6934 28.4607 16.6934H18.2647C17.7027 16.6934 17.2611 17.1306 17.2611 17.687C17.221 18.2434 17.7027 18.6806 18.2647 18.6806Z"\n fill="#0044d4"\n />\n <path\n d="M18.2647 10.6123H28.4607C29.0226 10.6123 29.4642 10.1751 29.4642 9.61864C29.4642 9.0622 29.0226 8.625 28.4607 8.625H18.2647C17.7027 8.625 17.2611 9.0622 17.2611 9.61864C17.221 10.1353 17.7027 10.6123 18.2647 10.6123Z"\n fill="#0044d4"\n />\n </svg>');export function RedoclyLogo(){return _jsx("img",{alt:"redocly logo",onError:function(n){var e=n.currentTarget;e.onerror=null,e.src=RedoclyLogoSVG},src:"https://cdn.redoc.ly/redoc/logo-mini.svg"},void 0)}export var Wrapper=styled.div(templateObject_1||(templateObject_1=__makeTemplateObject(["\n display: flex;\n padding: 6px 20px;\n font-size: 13px;\n margin-bottom: 10px;\n font-family: ",";\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: black;\n z-index: 10;\n text-align: center;\n border-bottom: 1px solid ",";\n\n svg,\n img {\n width: 15px;\n margin: 0 5px;\n }\n > a,\n a:visited,\n a:hover {\n white-space: pre-wrap;\n flex: 1;\n color: black;\n text-decoration: none;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n span {\n color: black;\n font-size: 13px;\n }\n"],["\n display: flex;\n padding: 6px 20px;\n font-size: 13px;\n margin-bottom: 10px;\n font-family: ",";\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: black;\n z-index: 10;\n text-align: center;\n border-bottom: 1px solid ",";\n\n svg,\n img {\n width: 15px;\n margin: 0 5px;\n }\n > a,\n a:visited,\n a:hover {\n white-space: pre-wrap;\n flex: 1;\n color: black;\n text-decoration: none;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n span {\n color: black;\n font-size: 13px;\n }\n"])),(function(n){return n.theme.typography.fontFamily}),(function(n){return n.theme.colors.border.light}));export var TrialWrap=styled.div(templateObject_2||(templateObject_2=__makeTemplateObject(["\n padding: 10px 40px;\n position: fixed;\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: orange;\n z-index: 10;\n opacity: 0.6;\n\n > a,\n a:visited {\n color: orange;\n }\n"],["\n padding: 10px 40px;\n position: fixed;\n text-align: right;\n width: 100%;\n box-sizing: border-box;\n color: orange;\n z-index: 10;\n opacity: 0.6;\n\n > a,\n a:visited {\n color: orange;\n }\n"])));export var Flash=styled.div(templateObject_3||(templateObject_3=__makeTemplateObject(["\n font-size: 1.5em;\n position: fixed;\n z-index: 100;\n background: rgba(38, 50, 56, 0.93);\n margin: 0;\n padding: 1em;\n width: 100%;\n color: white;\n height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n\n text-align: center;\n box-sizing: border-box;\n\n > span {\n display: inline-block;\n line-height: 1.5;\n }\n\n a,\n a:hover,\n a:visited {\n color: white;\n }\n"],["\n font-size: 1.5em;\n position: fixed;\n z-index: 100;\n background: rgba(38, 50, 56, 0.93);\n margin: 0;\n padding: 1em;\n width: 100%;\n color: white;\n height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n\n text-align: center;\n box-sizing: border-box;\n\n > span {\n display: inline-block;\n line-height: 1.5;\n }\n\n a,\n a:hover,\n a:visited {\n color: white;\n }\n"])));var templateObject_1,templateObject_2,templateObject_3;
|
|
2
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LicenseInfo } from '../../services/check';
|
|
2
|
+
export interface UtmParameters {
|
|
3
|
+
utm_campaign?: string;
|
|
4
|
+
utm_source?: string;
|
|
5
|
+
utm_medium?: string;
|
|
6
|
+
utm_content?: string;
|
|
7
|
+
utm_term?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface LicenseCheckProps {
|
|
10
|
+
l: Promise<LicenseInfo>;
|
|
11
|
+
}
|
|
12
|
+
export interface LicenseCheckState {
|
|
13
|
+
m: string | null;
|
|
14
|
+
exp: number;
|
|
15
|
+
local: boolean;
|
|
16
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate,__extends,__makeTemplateObject}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{createRef,Component}from"react";import{observer}from"mobx-react";import{configure,reaction}from"mobx";import{ApiInfo,ApiLogo,argValueToBoolean,ContentItems,createGlobalStyle,ErrorBoundary,Loading,mediaCSS,mediaMap,MiddlePanel,RedocNormalizedOptions,RightPanel,SideMenu,StickyResponsiveSidebar,ZERO_BREAKPOINT}from"../redoc-lib";import{LayoutVariant}from"../services/store-types";import{VersionedSpecStore}from"../services/VersionedSpecStore";import{DownloadButtonWithLabel}from"../redoc-lib/src/components/DownloadButton";import{ProSearchBox,SearchField}from"./Search";import{ContinueButton}from"./NextSectionButton";import{ProStoreProvider}from"./StoreProvider";import{Console}from"./console/ConsoleLazy";import{ProProviders}from"./ProProviders";import{Overlay}from"./Overlay";import{VersionSwitcher}from"./VersionSwitcher";import{BackgroundStub,BackgroundStubFix,RedocWrap,ApiContentWrap,NextSectionButtonWrap,ToggleRightPanelButton,ChangeViewButton,ControlsWrap}from"./styled.elements";configure({useProxies:"ifavailable"});export var CssFixes=createGlobalStyle(templateObject_1||(templateObject_1=__makeTemplateObject(['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"],['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"])),RightPanel,(function(e){var t,o=e.theme,n=e.showRightPanel,i=e.layout;return mediaCSS({width:i===LayoutVariant.STACKED?"100%":"",paddingLeft:i===LayoutVariant.STACKED?o.spacing.sectionHorizontal:"",display:n?"":(t={},t[ZERO_BREAKPOINT]="",t[o.rightPanel.showAtBreakpoint]="none",t)})}),BackgroundStub,BackgroundStubFix,(function(e){var t,o=e.theme,n=e.showRightPanel,i=e.layout;return mediaCSS({display:n&&i!==LayoutVariant.STACKED?"":(t={},t[ZERO_BREAKPOINT]="",t[o.rightPanel.showAtBreakpoint]="none",t)})}),MiddlePanel,NextSectionButtonWrap,(function(e){var t,o,n,i=e.theme,r=e.showRightPanel,a=e.layout;return mediaCSS({maxWidth:r&&a===LayoutVariant.THREE_PANEL?mediaMap(i.breakpoints,[i.layout["three-panel"].middlePanelMaxWidth],(t={},t[ZERO_BREAKPOINT]=function(){return"none"},t[i.rightPanel.showAtBreakpoint]=function(e){return e},t)):"none",margin:r&&a===LayoutVariant.THREE_PANEL?mediaMap(i.breakpoints,[i.rightPanel.width,i.layout["three-panel"].middlePanelMaxWidth],(o={},o[ZERO_BREAKPOINT]=function(){return"0"},o[i.rightPanel.showAtBreakpoint]=function(e,t){return t&&"none"!==t?"0 max(calc((100% - "+e+" - "+t+"}) / 2), 0px)":"0"},o)):"0",paddingRight:a===LayoutVariant.STACKED?i.spacing.sectionHorizontal:"",width:r&&a===LayoutVariant.THREE_PANEL?"":(n={},n[ZERO_BREAKPOINT]="",n[i.rightPanel.showAtBreakpoint]="100%",n)})}),ApiContentWrap,(function(e){var t,o=e.theme,n=e.showRightPanel,i=e.layout;return mediaCSS({width:(t={},t[ZERO_BREAKPOINT]="none",t.small="calc(100% - "+o.sidebar.width+")",t),maxWidth:o.layout[i===LayoutVariant.THREE_PANEL&&n?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED].maxWidth})}));var templateObject_1,RedoclyReferenceDocs=function(e){function t(t){var o=e.call(this,t)||this;return Object.defineProperty(o,"_observer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_updatedItems",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"rootElementRef",{enumerable:!0,configurable:!0,writable:!0,value:createRef()}),Object.defineProperty(o,"handleClose",{enumerable:!0,configurable:!0,writable:!0,value:function(){return o.props.store.tryItOut()}}),o.state={searchPopUpShown:!1,searchPopUpValue:""},o}return __extends(t,e),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,o=this;this.props.store.onDidMount(),null===(t=(e=this.props).onLoaded)||void 0===t||t.call(e),this._observer=reaction((function(){return o.props.store.menu.renderItems}),(function(){o._updatedItems=!0}))}}),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._updatedItems&&(this._updatedItems=!1,this.props.store.menu.scrollToActive())}}),Object.defineProperty(t.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.props.store.dispose(),this._observer()}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props,o=t.store,n=t._forceRenderInfo,i=o.definition,r=o.menu,a=o.options,s=o.search,l=o.marker,d=a.hideDownloadButton,c=a.hideInfoSection,u=a.pagination,p=a.disableSidebar,h=r.renderItems,m="none"===u||r.activeRenderItemIdx<=0,f=!c&&m;f&&"none"!==u&&p&&h[0]&&"section"!==h[0].type&&(f=!1),n&&(f=!0);var v=!f&&null!==d&&!d&&m;return
|
|
1
|
+
import{__assign,__decorate,__extends,__makeTemplateObject}from"tslib";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{createRef,Component}from"react";import{observer}from"mobx-react";import{configure,reaction}from"mobx";import{ApiInfo,ApiLogo,argValueToBoolean,ContentItems,createGlobalStyle,ErrorBoundary,Loading,mediaCSS,mediaMap,MiddlePanel,RedocNormalizedOptions,RightPanel,SideMenu,StickyResponsiveSidebar,ZERO_BREAKPOINT}from"../redoc-lib";import{LayoutVariant}from"../services/store-types";import{VersionedSpecStore}from"../services/VersionedSpecStore";import{DownloadButtonWithLabel}from"../redoc-lib/src/components/DownloadButton";import{ProSearchBox,SearchField}from"./Search";import{ContinueButton}from"./NextSectionButton";import{ProStoreProvider}from"./StoreProvider";import{Console}from"./console/ConsoleLazy";import{ProProviders}from"./ProProviders";import{Overlay}from"./Overlay";import{VersionSwitcher}from"./VersionSwitcher";import{BackgroundStub,BackgroundStubFix,RedocWrap,ApiContentWrap,NextSectionButtonWrap,ToggleRightPanelButton,ChangeViewButton,ControlsWrap}from"./styled.elements";configure({useProxies:"ifavailable"});export var CssFixes=createGlobalStyle(templateObject_1||(templateObject_1=__makeTemplateObject(['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"],['\n div[data-section-id]::after {\n content: " ";\n display: block;\n height: 0;\n clear: both;\n visibility: hidden;\n }\n\n '," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n ",", "," {\n ","\n }\n\n "," {\n ",";\n }\n"])),RightPanel,(function(e){var t,o=e.theme,n=e.showRightPanel,i=e.layout;return mediaCSS({width:i===LayoutVariant.STACKED?"100%":"",paddingLeft:i===LayoutVariant.STACKED?o.spacing.sectionHorizontal:"",display:n?"":(t={},t[ZERO_BREAKPOINT]="",t[o.rightPanel.showAtBreakpoint]="none",t)})}),BackgroundStub,BackgroundStubFix,(function(e){var t,o=e.theme,n=e.showRightPanel,i=e.layout;return mediaCSS({display:n&&i!==LayoutVariant.STACKED?"":(t={},t[ZERO_BREAKPOINT]="",t[o.rightPanel.showAtBreakpoint]="none",t)})}),MiddlePanel,NextSectionButtonWrap,(function(e){var t,o,n,i=e.theme,r=e.showRightPanel,a=e.layout;return mediaCSS({maxWidth:r&&a===LayoutVariant.THREE_PANEL?mediaMap(i.breakpoints,[i.layout["three-panel"].middlePanelMaxWidth],(t={},t[ZERO_BREAKPOINT]=function(){return"none"},t[i.rightPanel.showAtBreakpoint]=function(e){return e},t)):"none",margin:r&&a===LayoutVariant.THREE_PANEL?mediaMap(i.breakpoints,[i.rightPanel.width,i.layout["three-panel"].middlePanelMaxWidth],(o={},o[ZERO_BREAKPOINT]=function(){return"0"},o[i.rightPanel.showAtBreakpoint]=function(e,t){return t&&"none"!==t?"0 max(calc((100% - "+e+" - "+t+"}) / 2), 0px)":"0"},o)):"0",paddingRight:a===LayoutVariant.STACKED?i.spacing.sectionHorizontal:"",width:r&&a===LayoutVariant.THREE_PANEL?"":(n={},n[ZERO_BREAKPOINT]="",n[i.rightPanel.showAtBreakpoint]="100%",n)})}),ApiContentWrap,(function(e){var t,o=e.theme,n=e.showRightPanel,i=e.layout;return mediaCSS({width:(t={},t[ZERO_BREAKPOINT]="none",t.small="calc(100% - "+o.sidebar.width+")",t),maxWidth:o.layout[i===LayoutVariant.THREE_PANEL&&n?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED].maxWidth})}));var templateObject_1,RedoclyReferenceDocs=function(e){function t(t){var o=e.call(this,t)||this;return Object.defineProperty(o,"_observer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_updatedItems",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"rootElementRef",{enumerable:!0,configurable:!0,writable:!0,value:createRef()}),Object.defineProperty(o,"handleClose",{enumerable:!0,configurable:!0,writable:!0,value:function(){return o.props.store.tryItOut()}}),o.state={searchPopUpShown:!1,searchPopUpValue:""},o}return __extends(t,e),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,o=this;this.props.store.onDidMount(),null===(t=(e=this.props).onLoaded)||void 0===t||t.call(e),this._observer=reaction((function(){return o.props.store.menu.renderItems}),(function(){o._updatedItems=!0}))}}),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._updatedItems&&(this._updatedItems=!1,this.props.store.menu.scrollToActive())}}),Object.defineProperty(t.prototype,"componentWillUnmount",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.props.store.dispose(),this._observer()}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this.props,o=t.store,n=t._forceRenderInfo,i=o.definition,r=o.menu,a=o.options,s=o.search,l=o.marker,d=a.hideDownloadButton,c=a.hideInfoSection,u=a.pagination,p=a.disableSidebar,h=r.renderItems,m="none"===u||r.activeRenderItemIdx<=0,f=!c&&m;f&&"none"!==u&&p&&h[0]&&"section"!==h[0].type&&(f=!1),n&&(f=!0);var v=!f&&null!==d&&!d&&m;return _jsxs(ProProviders,__assign({store:o},{children:[_jsx(Overlay,{l:o.l},void 0),_jsxs(RedocWrap,__assign({className:"redoc-wrap",ref:this.rootElementRef},{children:[_jsx(CssFixes,{whiteLabel:a.whiteLabel,showRightPanel:o.showRightPanel,layout:o.layout},void 0),o.tryItOperation&&_jsx(Console,{rootElement:this.rootElementRef.current,store:o,operation:o.tryItOperation,onClose:this.handleClose},void 0),!a.disableSidebar&&_jsxs(StickyResponsiveSidebar,__assign({menu:r,className:"menu-content"},{children:[!a.hideLogo&&_jsx(ApiLogo,{info:i.info},void 0),i instanceof VersionedSpecStore&&_jsx(VersionSwitcher,{spec:i,onChange:function(e){void 0!==e.idx&&i.changeVersion(e.idx),r.updateItemsByVersionChange(!0),o.tryItOut(void 0)}},void 0),!a.disableSearch&&_jsx(SearchField,{showPopUp:function(){return e.setState({searchPopUpShown:!0})},searchValue:this.state.searchPopUpValue,marker:l,setSearchValue:function(t){return e.setState({searchPopUpValue:t})}},void 0),_jsx(SideMenu,{menu:r},void 0)]}),void 0),_jsxs(ApiContentWrap,__assign({className:(o.isLoading?"loading ":"")+"api-content",layout:o.layout===LayoutVariant.THREE_PANEL&&o.showRightPanel?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED},{children:[a.theme.layout.showDarkRightPanel&&o.showRightPanel&&o.layout!==LayoutVariant.STACKED&&_jsx(BackgroundStub,{},void 0),f&&_jsx(ApiInfo,{store:o},void 0),v&&_jsx(DownloadButtonWithLabel,{store:o},void 0),_jsx(ContentItems,{items:h,store:o},void 0),a.showNextButton&&_jsx(ContinueButton,{pagination:a.pagination,menu:r},void 0),this.props.children]}),void 0),_jsxs(ControlsWrap,{children:[_jsx(ToggleRightPanelButton,{store:o,isVisible:o.layout===LayoutVariant.THREE_PANEL},void 0),_jsx(ChangeViewButton,{store:o,isVisible:o.showRightPanel},void 0)]},void 0),_jsx(ProSearchBox,{search:s,marker:l,menu:r,onActivate:r.activateAndScroll.bind(r),options:a,shown:this.state.searchPopUpShown,hidePopUp:function(){return e.setState({searchPopUpShown:!1})},showPopUp:function(){return e.setState({searchPopUpShown:!0})},setSearchValue:function(t){return e.setState({searchPopUpValue:t})},searchValue:this.state.searchPopUpValue},void 0),a.theme.layout.showDarkRightPanel&&o.showRightPanel&&o.layout!==LayoutVariant.STACKED&&_jsx(BackgroundStubFix,{},void 0)]}),void 0)]}),void 0)}}),t=__decorate([observer],t)}(Component);export{RedoclyReferenceDocs};export function RedoclyReferenceDocsStandalone(e){var t=e.definition,o=e.definitionUrl,n=e.options,i=void 0===n?{}:n,r=e.activeItemId,a=e.activeSampleLanguage,s=e.activeDeepLink,l=argValueToBoolean(i.hideLoading,!1),d=new RedocNormalizedOptions(i),c=_jsx(ProStoreProvider,__assign({definition:t,definitionUrl:o,options:i,activeItemId:r,activeSampleLanguage:a,activeDeepLink:s},{children:function(e){var t=e.loading,o=e.store;return t?l?null:_jsx(Loading,{color:d.theme.colors.primary.main},void 0):_jsx(RedoclyReferenceDocs,{store:o},void 0)}}),void 0);return i.disableErrorBoundary?c:_jsx(ErrorBoundary,{children:c},void 0)}
|
|
2
2
|
//# sourceMappingURL=RedoclyReferenceDocs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{bind,debounce}from"decko";import{createParsedDocument,IS_BROWSER,MarkerService,RedocNormalizedOptions,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,ScrollService,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SpecStore}from"../redoc-lib";import{PullRight,RedocResponse}from"../components/pluggable";import{fromLocalStorage,fromSessionStorage,getWindowReferenceOptions,setGlobalStore,toLocalStorage,toSessionStorage}from"../utils";import{SecurityDefs}from"../redoc-lib/src/components/SecurityRequirement/SecurityDefs";import{WindowReferenceOptions}from"../types";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,DEFAULT_SEARCH_MAX_DEPTH,RemoteSearch}from"./SearchStore";import{extendTheme}from"./extendTheme";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{LayoutVariant}from"./store-types";import{SideNavStyle}from"./types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r):new ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r,a;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),null!=this.rawOptions.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),this.options.showConsole=null!=this.rawOptions.hideTryItPanel?!this.rawOptions.hideTryItPanel:null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||SideNavStyle.SummaryOnly,this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.unstable_hideServerUrlInTryIt=this.rawOptions.unstable_hideServerUrlInTryIt||!1,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.mockServer=(null===(r=this.rawOptions.mockServer)||void 0===r?void 0:r.url)?{url:this.rawOptions.mockServer.url,position:this.rawOptions.mockServer.position||"first",description:this.rawOptions.mockServer.description||"Mock server"}:null,this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||getWindowReferenceOptions(WindowReferenceOptions.LINK_FOR_ID)||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||getWindowReferenceOptions(WindowReferenceOptions.GENERATE_DEEP_LINK)||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||getWindowReferenceOptions(WindowReferenceOptions.ON_DEEP_LINK_CLICK)||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||getWindowReferenceOptions(WindowReferenceOptions.REQUEST_INTERCEPTOR)||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var s="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy=void 0!==this.rawOptions.routingStrategy?this.rawOptions.routingStrategy:"none"===this.options.pagination?"hash":"browser",!(null===(a=this.rawOptions)||void 0===a?void 0:a.pagination)&&(null==s?void 0:s.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==s?void 0:s.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromSessionStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toSessionStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n;return __awaiter(this,void 0,void 0,(function(){var r,a,s,l,p,u,c;return __generator(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=__assign(__assign({},getSpecVersionObj(a)),{components:a.components,paths:(u={},u[e.path]=(c={},c[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],c.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,c),u)}),l=new Config({}),p=createParsedDocument(s),[4,bundle({config:l,doc:p,dereference:!0})];case 1:return h.sent(),[2,a]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([bind,debounce(500)],e.prototype,"activateSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
1
|
+
var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{bind,debounce}from"decko";import{createParsedDocument,IS_BROWSER,MarkerService,RedocNormalizedOptions,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,ScrollService,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SpecStore}from"../redoc-lib";import{PullRight,RedocResponse}from"../components/pluggable";import{fromLocalStorage,fromSessionStorage,getWindowReferenceOptions,setGlobalStore,toLocalStorage,toSessionStorage}from"../utils";import{SecurityDefs}from"../redoc-lib/src/components/SecurityRequirement/SecurityDefs";import{WindowReferenceOptions}from"../types";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,DEFAULT_SEARCH_MAX_DEPTH,RemoteSearch}from"./SearchStore";import{extendTheme}from"./extendTheme";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{LayoutVariant}from"./store-types";import{SideNavStyle}from"./types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||e.plugin||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r):new ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r,a;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),null!=this.rawOptions.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),this.options.showConsole=null!=this.rawOptions.hideTryItPanel?!this.rawOptions.hideTryItPanel:null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||SideNavStyle.SummaryOnly,this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.unstable_hideServerUrlInTryIt=this.rawOptions.unstable_hideServerUrlInTryIt||!1,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.mockServer=(null===(r=this.rawOptions.mockServer)||void 0===r?void 0:r.url)?{url:this.rawOptions.mockServer.url,position:this.rawOptions.mockServer.position||"first",description:this.rawOptions.mockServer.description||"Mock server"}:null,this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||getWindowReferenceOptions(WindowReferenceOptions.LINK_FOR_ID)||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||getWindowReferenceOptions(WindowReferenceOptions.GENERATE_DEEP_LINK)||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||getWindowReferenceOptions(WindowReferenceOptions.ON_DEEP_LINK_CLICK)||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||getWindowReferenceOptions(WindowReferenceOptions.REQUEST_INTERCEPTOR)||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var s="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy=void 0!==this.rawOptions.routingStrategy?this.rawOptions.routingStrategy:"none"===this.options.pagination?"hash":"browser",!(null===(a=this.rawOptions)||void 0===a?void 0:a.pagination)&&(null==s?void 0:s.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==s?void 0:s.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromSessionStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toSessionStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n;return __awaiter(this,void 0,void 0,(function(){var r,a,s,l,p,u,c;return __generator(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=__assign(__assign({},getSpecVersionObj(a)),{components:a.components,paths:(u={},u[e.path]=(c={},c[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],c.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,c),u)}),l=new Config({}),p=createParsedDocument(s),[4,bundle({config:l,doc:p,dereference:!0})];case 1:return h.sent(),[2,a]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([bind,debounce(500)],e.prototype,"activateSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
|
|
2
2
|
//# sourceMappingURL=ProStore.js.map
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import type { UtmParameters } from '../components/Overlay/types';
|
|
1
2
|
export declare type LicenseInfo = {
|
|
2
3
|
t?: boolean;
|
|
3
4
|
i?: number;
|
|
4
5
|
e?: number;
|
|
5
6
|
h?: string[] | true;
|
|
7
|
+
s?: string;
|
|
6
8
|
valid?: boolean;
|
|
7
9
|
expired?: boolean;
|
|
8
10
|
allowed?: boolean;
|
|
9
11
|
local?: boolean;
|
|
10
12
|
cryptoMissing?: boolean;
|
|
13
|
+
plugin?: {
|
|
14
|
+
valid: boolean;
|
|
15
|
+
utms: UtmParameters;
|
|
16
|
+
};
|
|
11
17
|
};
|
|
12
18
|
export declare function isHostAllowed(hostname: string, hosts: string[] | boolean | undefined): boolean;
|
|
13
19
|
export default function parse(key?: string): Promise<LicenseInfo>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter,__generator}from"tslib";import{cryptoLib}from"./utils";function promisifyIECryptoRes(e){return"then"in e?e:new Promise((function(t){e.oncomplete=function(e){t(e.target.result)}}))}function str2ab(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0,o=e.length;n<o;n++)r[n]=e.charCodeAt(n);return t}var getKey=function(){var e,t=str2ab(atob("undefined"!=typeof REDOCLY_PUBLIC_KEY?REDOCLY_PUBLIC_KEY:"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMHjNir5fXx/ZXoaEeXQ5XyxbNJ4YJYczoCRdSkL6NLzw1FHnng5Vfcgk5+bvox9QRYRbuk84mA4f2NhywDbXKECAwEAAQ=="));return promisifyIECryptoRes(null===(e=cryptoLib)||void 0===e?void 0:e.subtle.importKey("spki",t,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"]))};function textEncode(e){if(window.TextEncoder)return(new TextEncoder).encode(e);for(var t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function verify(e,t){var r;return __awaiter(this,void 0,void 0,(function(){var n,o,i,a,s;return __generator(this,(function(l){switch(l.label){case 0:return n=promisifyIECryptoRes,null!==(r=cryptoLib)&&void 0!==r?[3,1]:(o=void 0,[3,3]);case 1:return a=(i=r.subtle).verify,s=[{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"}],[4,getKey()];case 2:o=a.apply(i,s.concat([l.sent(),str2ab(atob(t)),textEncode(e)])),l.label=3;case 3:return[2,n.apply(void 0,[o])]}}))}))}export function isHostAllowed(e,t){return!0===t||!(!Array.isArray(t)||"undefined"==typeof window)&&(!("localhost"!==e&&"127.0.0.1"!==e&&!e.endsWith(".localhost")&&!t.find((function(t){return t===e||e.endsWith("."+t)})))||!!t.find((function(t){if(t.indexOf("*")===t.lastIndexOf("*")){var r=t.split("*"),n=r[0],o=r[1];return o&&e.startsWith(n)&&e.endsWith(o)&&o.split(".").length>2}})))}export default function parse(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n,o,i;return __generator(this,(function(a){switch(a.label){case 0:if("development"===process.env.NODE_ENV)return[2,{valid:!0,allowed:!0}];if(t=window.location.hostname,!e)return"localhost"===t||"127.0.0.1"===t||t.endsWith(".localhost")?[2,{local:!0}]:[2,{}];r=e.split("."),n=r[0],o=r[1],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,verify(atob(n),o)];case 2:return a.sent()?(i=JSON.parse(atob(n)),[3,4]):[2,{valid:!1}];case 3:return a.sent(),[2,{valid:!1,cryptoMissing:!0}];case 4:return i.valid=!0,(!i.e||Date.now()/1e3>i.e)&&(i.expired=!0),i.allowed=isHostAllowed(t,i.h),[2,i]}}))}))}
|
|
1
|
+
import{__awaiter,__generator}from"tslib";import{IS_BROWSER}from"../redoc-lib/src/utils";import{cryptoLib}from"./utils";function promisifyIECryptoRes(e){return"then"in e?e:new Promise((function(t){e.oncomplete=function(e){t(e.target.result)}}))}function str2ab(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0,o=e.length;n<o;n++)r[n]=e.charCodeAt(n);return t}var getKey=function(){var e,t=str2ab(atob("undefined"!=typeof REDOCLY_PUBLIC_KEY?REDOCLY_PUBLIC_KEY:"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMHjNir5fXx/ZXoaEeXQ5XyxbNJ4YJYczoCRdSkL6NLzw1FHnng5Vfcgk5+bvox9QRYRbuk84mA4f2NhywDbXKECAwEAAQ=="));return promisifyIECryptoRes(null===(e=cryptoLib)||void 0===e?void 0:e.subtle.importKey("spki",t,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"]))};function textEncode(e){if(window.TextEncoder)return(new TextEncoder).encode(e);for(var t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function verify(e,t){var r;return __awaiter(this,void 0,void 0,(function(){var n,o,i,a,s;return __generator(this,(function(l){switch(l.label){case 0:return n=promisifyIECryptoRes,null!==(r=cryptoLib)&&void 0!==r?[3,1]:(o=void 0,[3,3]);case 1:return a=(i=r.subtle).verify,s=[{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"}],[4,getKey()];case 2:o=a.apply(i,s.concat([l.sent(),str2ab(atob(t)),textEncode(e)])),l.label=3;case 3:return[2,n.apply(void 0,[o])]}}))}))}export function isHostAllowed(e,t){return!0===t||!(!Array.isArray(t)||"undefined"==typeof window)&&(!("localhost"!==e&&"127.0.0.1"!==e&&!e.endsWith(".localhost")&&!t.find((function(t){return t===e||e.endsWith("."+t)})))||!!t.find((function(t){if(t.indexOf("*")===t.lastIndexOf("*")){var r=t.split("*"),n=r[0],o=r[1];return o&&e.startsWith(n)&&e.endsWith(o)&&o.split(".").length>2}})))}export default function parse(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n,o,i;return __generator(this,(function(a){switch(a.label){case 0:if("development"===process.env.NODE_ENV)return[2,{valid:!0,allowed:!0}];if(t=IS_BROWSER&&window.location.hostname||"",!e)return"localhost"===t||"127.0.0.1"===t||t.endsWith(".localhost")?[2,{local:!0}]:[2,{}];r=e.split("."),n=r[0],o=r[1],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,verify(atob(n),o)];case 2:return a.sent()?(i=JSON.parse(atob(n)),[3,4]):[2,{valid:!1}];case 3:return a.sent(),[2,{valid:!1,cryptoMissing:!0}];case 4:return i.valid=!0,(!i.e||Date.now()/1e3>i.e)&&(i.expired=!0),i.allowed=isHostAllowed(t,i.h),"plugin"===(null==i?void 0:i.s)?[2,{plugin:{valid:!0,utms:{utm_campaign:Array.isArray(null==i?void 0:i.h)&&(null==i?void 0:i.h[0])||"preview-docs"}}}]:[2,i]}}))}))}
|
|
2
2
|
//# sourceMappingURL=check.js.map
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { LicenseInfo } from '../services/check';
|
|
3
|
-
export interface LicenseCheckProps {
|
|
4
|
-
l: Promise<LicenseInfo>;
|
|
5
|
-
}
|
|
6
|
-
export interface LicenseCheckState {
|
|
7
|
-
m: string | null;
|
|
8
|
-
exp: number;
|
|
9
|
-
local: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare const Overlay: ({ l }: LicenseCheckProps) => JSX.Element | null;
|