@redocly/openapi-docs 3.19.0-next.8 → 3.19.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{Suspense as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Suspense as E,lazy as h,memo as S,useEffect as x,useState as R}from"react";import{useAtomValue as o}from"jotai";import{operationStore as T}from"../../jotai/operation.js";import{appStore as O,allowedEnvironmentsAtom as C,environmentsAtom as L}from"../../jotai/app.js";import{useTranslate as V}from"../../hooks/index.js";import{convertOperationToReplayValue as j}from"./utils.js";import{getDefaultCollectorUrl as A}from"../../utils/telemetry.js";import{styled as i}from"../../styled-components.js";import{HTTPSnippet as w}from"../../services/code-samples/httpsnippet/index.js";const P=h(async()=>import("@redocly/replay").then(t=>({default:t.EmbeddedReplay})));function U({activeOperationId:t,corsProxyUrl:d,fullOpenApi:l,pointer:r,hideOtherSecuritySchemes:m}){const a=V(),s=o(T(r)),c=o(O),f=o(L),n=o(C),[u,y]=R(!1);return x(()=>{y(!0)},[]),e(W,{children:u?e(E,{fallback:e(p,{children:a("openapi.loading","Loading...")}),children:e(P,{activeOperationId:t,activeOperationPointer:r,api:l,settings:{predefinedEnvValues:f,corsProxyUrl:d,disableCollectionsTab:!0,hideOtherSecuritySchemes:m,...n&&{allowedEnvironments:n},telemetry:{tracerName:"replay-openapi",collectorUrl:A()},HTTPSnippet:w,convertOperationToReplayValue:(v,g,b)=>j(v,g,b,void 0,s,c)}})}):e(p,{children:a("openapi.loading","Loading...")})})}const G=S(U),p=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
align-items: center;
|
|
5
5
|
min-height: 100px;
|
|
6
|
-
`,
|
|
6
|
+
`,W=i.div`
|
|
7
7
|
border: 1px solid var(--border-color-primary);
|
|
8
8
|
border-radius: var(--border-radius-lg);
|
|
9
9
|
padding: 0;
|
|
10
|
-
`;export{
|
|
10
|
+
`;export{G as EmbeddedReplay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,Fragment as
|
|
1
|
+
import{jsx as o,Fragment as M,jsxs as z}from"react/jsx-runtime";import{lazy as H,memo as J,Suspense as K,useCallback as m,useRef as W,useState as w}from"react";import{useAtom as u,useAtomValue as p}from"jotai";import Q from"deepmerge";const X=H(async()=>import("@redocly/replay").then(e=>({default:e.ReplayOverlay})));import{Button as Y}from"@redocly/theme/components/Button/Button";import{useFocusTrap as Z,useModalScrollLock as $}from"@redocly/theme/core/openapi";import{RocketIcon as ee}from"@redocly/theme/icons/RocketIcon/RocketIcon";import{CircleDashIcon as te}from"@redocly/theme/icons/CircleDashIcon/CircleDashIcon";import{Portal as oe}from"@redocly/theme/components/Portal/Portal";import{useConfigureReplay as re}from"@redocly/theme/ext/use-configure-replay";import{globalOptionsAtom as ne,globalStoreAtom as ae}from"../../jotai/store.js";import{allOperationsAtom as se,replayStateAtom as ie}from"../../jotai/replay.js";import{allOperations as le,getDefaultOperationStore as me}from"../../jotai/operation.js";import{LOADING_STATE as n}from"../../constants.js";import{environmentAtom as pe,userClaimsAtom as ce}from"../../jotai/app.js";import{convertOperationToReplayValueForRedoc as fe}from"./utils.js";import{useTranslate as ue,useTelemetry as de}from"../../hooks/index.js";import{JsonPointer as ye}from"../../utils/index.js";import{getDefaultCollectorUrl as he}from"../../utils/telemetry.js";import{createTryItOpenEvent as Oe,createTryItSentEvent as Ie}from"../../events/index.js";import{joinWithSeparator as Re}from"../../services/history/helpers.js";import{HTTPSnippet as ge}from"../../services/code-samples/httpsnippet/index.js";function ve({operation:e,corsProxyUrl:P,fullOpenApi:d}){const y=ue(),q=de(),h=W(null),O=p(ne),{oAuth2RedirectURI:E,routingBasePath:c}=O,I=p(se),{parser:R,options:{events:a}}=p(ae),g=p(ce),[s,N]=w(!1),[l,v]=u(ie),[A,S]=u(le),[[,V],T]=u(pe),{config:j,refresh:D}=re({userClaims:g,info:R?.definition.info,operation:{name:e.name,path:e.path,operationId:e.operationId||"",href:e.href,method:e.httpVerb},servers:e.servers},s);Z(h),$(s);const x=m(()=>D(),[D]),G=m(({operations:t,environment:i,environments:f})=>{const k=t.reduce((b,r)=>{r.requestValues.body=r.requestValues.body instanceof URLSearchParams?Object.fromEntries(r.requestValues.body.entries()):r.requestValues.body;const{path:F,method:B}=r.apiPath,L=ye.compile(["paths",F,B]);return b[L]=Q(me(L),r),b},{});S({...A,...k}),T({environment:i,environments:f})},[A,S,T]),C=()=>{if(l!==n.LOADING){if(!s&&(q.sendTryItOpenedMessage(),a?.tryItOpen&&e)){const t=Oe({operation:e});a.tryItOpen(t)}N(!s)}l===n.NOT_LOADED&&v(n.LOADING)},U=m(t=>{if(a?.tryItSent&&e){const i=Ie({operation:e,isSuccess:t});a.tryItSent(i)}},[a,e]),_=m(t=>{if(!t)return;const i=I.find(f=>f.operationId===t);return Re(c,i?.href)},[I,c]);return d?z(M,{children:[o(Y,{onClick:C,variant:"primary",iconPosition:"left",icon:l===n.LOADING?o(te,{}):o(ee,{}),children:l===n.LOADING?y("openapi.loading","Loading..."):y("openapi.tryIt","Try it")}),s&&o(K,{children:o(oe,{mountId:"api-content",children:o("div",{ref:h,children:o(X,{activeOperationId:e.operationId||e.pointer,api:d,onRequestChange:G,onClose:C,onLoad:()=>v(n.LOADED),settings:{corsProxyUrl:P,selectedEnvironment:V,apiId:R?.definition.info?.["x-metadata"]?.apiId,oAuth2RedirectURI:E,disableCollectionsTab:!0,storageKey:c,telemetry:{tracerName:"try-it",collectorUrl:he()},HTTPSnippet:ge,convertOperationToReplayValue:fe(g,j,O),getOperationUrl:_,onRequestReset:x},onRequestSent:U})})})})]}):null}const He=J(ve);export{He as Replay};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.19.0-next.
|
|
3
|
+
"version": "3.19.0-next.9",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@markdoc/markdoc": "0.5.2",
|
|
24
|
-
"@redocly/openapi-core": "2.20.
|
|
24
|
+
"@redocly/openapi-core": "2.20.5",
|
|
25
25
|
"deepmerge": "^4.2.2",
|
|
26
26
|
"dompurify": "3.2.7",
|
|
27
27
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"jotai": "^2.12.5",
|
|
30
30
|
"jotai-family": "1.0.1",
|
|
31
31
|
"json-pointer": "^0.6.2",
|
|
32
|
-
"openapi-sampler": "1.7.
|
|
32
|
+
"openapi-sampler": "^1.7.2",
|
|
33
33
|
"react-router-dom": "^6.30.3",
|
|
34
34
|
"slugify": "^1.4.7",
|
|
35
35
|
"stringify-object": "^3.3.0",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"url-template": "^2.0.8",
|
|
39
39
|
"util": "~0.12.5",
|
|
40
40
|
"web-vitals": "3.3.1",
|
|
41
|
-
"@redocly/config": "0.44.
|
|
42
|
-
"@redocly/replay": "0.22.0-next.
|
|
41
|
+
"@redocly/config": "0.44.1",
|
|
42
|
+
"@redocly/replay": "0.22.0-next.8"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@shikijs/transformers": "3.21.0",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"json-schema": "0.4.0",
|
|
61
61
|
"outdent": "0.8.0",
|
|
62
62
|
"path-browserify": "1.0.1",
|
|
63
|
-
"prettier-2": "npm:prettier@2.8.8",
|
|
64
63
|
"react": "^19.2.4",
|
|
65
64
|
"react-dom": "^19.2.4",
|
|
66
65
|
"rimraf": "5.0.7",
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
"url": "~0.11.0",
|
|
73
72
|
"vite": "7.2.6",
|
|
74
73
|
"vitest": "4.0.10",
|
|
75
|
-
"@redocly/theme": "0.63.0-next.
|
|
74
|
+
"@redocly/theme": "0.63.0-next.6"
|
|
76
75
|
},
|
|
77
76
|
"scripts": {
|
|
78
77
|
"start": "pnpm run copy-highlight-hook && vite",
|