@mintlify/msft-sdk 1.1.14 → 1.1.16
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/dist/api-playground-2/ApiExamples.js +27 -0
- package/dist/api-playground-2/ApiExamples.js.map +1 -0
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +142 -0
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -0
- package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +29 -0
- package/dist/api-playground-2/components/Example/GeneratedResponseExample.js.map +1 -0
- package/dist/api-playground-2/components/Example/RequestExample.js +91 -0
- package/dist/api-playground-2/components/Example/RequestExample.js.map +1 -0
- package/dist/api-playground-2/components/Example/ResponseExample.js +18 -0
- package/dist/api-playground-2/components/Example/ResponseExample.js.map +1 -0
- package/dist/components/Api/ErrorBoundary.js +19 -0
- package/dist/components/Api/ErrorBoundary.js.map +1 -0
- package/dist/components/Api/MethodPill.js +12 -12
- package/dist/components/Api/MethodPill.js.map +1 -1
- package/dist/components/Api/colors.js +39 -47
- package/dist/components/Api/colors.js.map +1 -1
- package/dist/components/Api/dropdown-menu.js +127 -0
- package/dist/components/Api/dropdown-menu.js.map +1 -0
- package/dist/components/content-components/CodeGroupSelect/CodeGroupCopyButton.js +7 -0
- package/dist/components/content-components/CodeGroupSelect/CodeGroupCopyButton.js.map +1 -0
- package/dist/components/content-components/CodeGroupSelect/CodeSelectDropdown.js +52 -0
- package/dist/components/content-components/CodeGroupSelect/CodeSelectDropdown.js.map +1 -0
- package/dist/components/content-components/CodeGroupSelect/index.js +77 -0
- package/dist/components/content-components/CodeGroupSelect/index.js.map +1 -0
- package/dist/components/content-components/code-block.js +90 -95
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/code-group.js +139 -0
- package/dist/components/content-components/code-group.js.map +1 -0
- package/dist/components/content-components/code-snippet.js +27 -0
- package/dist/components/content-components/code-snippet.js.map +1 -0
- package/dist/components/content-components/code-snippets.js +22 -0
- package/dist/components/content-components/code-snippets.js.map +1 -0
- package/dist/components/content-components/heading.js +51 -9
- package/dist/components/content-components/heading.js.map +1 -1
- package/dist/components/docsPage.js +55 -53
- package/dist/components/docsPage.js.map +1 -1
- package/dist/components/nav-tree/index.js +20 -20
- package/dist/components/nav-tree/index.js.map +1 -1
- package/dist/components/nav-tree/mobile-nav.js +1 -1
- package/dist/components/nav-tree/mobile-nav.js.map +1 -1
- package/dist/components/page-context-menu.js +36 -36
- package/dist/components/page-context-menu.js.map +1 -1
- package/dist/components/toc/index.js +3 -3
- package/dist/components/toc/index.js.map +1 -1
- package/dist/constants/prism-languages.js +20 -0
- package/dist/constants/prism-languages.js.map +1 -0
- package/dist/constants/snippetPresets.js +58 -0
- package/dist/constants/snippetPresets.js.map +1 -0
- package/dist/contexts/ConfigContext.js +19 -0
- package/dist/contexts/ConfigContext.js.map +1 -0
- package/dist/hooks/useApiPlaygroundDisplay.js +15 -0
- package/dist/hooks/useApiPlaygroundDisplay.js.map +1 -0
- package/dist/hooks/useEndpoint.js +16 -0
- package/dist/hooks/useEndpoint.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/styles.css +1 -1
- package/dist/utils/cn.js +7 -4
- package/dist/utils/cn.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as x, useState as f, useMemo as u } from "react";
|
|
3
|
+
import { usePlaygroundInputsStore as d } from "@/api-playground-2/hooks/usePlaygroundInputsStore";
|
|
4
|
+
import { CodeExampleLabelContext as h } from "@/contexts/CodeExampleLabelContext";
|
|
5
|
+
import { ApiReferenceContext2 as g } from "@/contexts/ConfigContext";
|
|
6
|
+
import R from "../components/Api/ErrorBoundary.js";
|
|
7
|
+
import { clsx as v } from "clsx";
|
|
8
|
+
import { RequestExample as C } from "./components/Example/RequestExample.js";
|
|
9
|
+
import { ResponseExample as D } from "./components/Example/ResponseExample.js";
|
|
10
|
+
const H = ({ className: t, isModal: m = !1, apiReferenceData: n }) => {
|
|
11
|
+
const { apiReferenceData2: i } = x(g), r = n || i, { getApiPlaygroundInputs: o } = d(), a = o(), [s, p] = f(), l = u(
|
|
12
|
+
() => v(
|
|
13
|
+
"mint:w-full mint:xl:w-[28rem] mint:gap-6 mint:grid mint:grid-rows-[repeat(auto-fit,minmax(0,min-content))] mint:grid-rows mint:relative mint:max-h-[calc(100%-32px)] mint:min-h-[18rem]",
|
|
14
|
+
t
|
|
15
|
+
),
|
|
16
|
+
[t, m]
|
|
17
|
+
);
|
|
18
|
+
return /* @__PURE__ */ e(h.Provider, { value: { selectedLabel: s, setSelectedLabel: p }, children: /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ c(R, { children: [
|
|
19
|
+
/* @__PURE__ */ e(C, { apiReferenceData: r, inputs: a, maxHeight: "mint:max-h-[40vh]" }),
|
|
20
|
+
/* @__PURE__ */ e(D, { apiReferenceData: r, maxHeight: "mint:max-h-[40vh]" })
|
|
21
|
+
] }) }) });
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
H as ApiExamples,
|
|
25
|
+
H as default
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=ApiExamples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiExamples.js","sources":["../../src/api-playground-2/ApiExamples.tsx"],"sourcesContent":["'use client';\n\nimport React, { useContext, useMemo, useState } from 'react';\n\nimport { usePlaygroundInputsStore } from '@/api-playground-2/hooks/usePlaygroundInputsStore';\nimport { CodeExampleLabelContext } from '@/contexts/CodeExampleLabelContext';\nimport { ApiReferenceContext2 } from '@/contexts/ConfigContext';\nimport ErrorBoundary from '../components/Api/ErrorBoundary';\nimport { clsx } from 'clsx';\n\nimport { RequestExample } from './components/Example/RequestExample';\nimport { ResponseExample } from './components/Example/ResponseExample';\nimport { ApiReferenceDataV2 } from './types';\n\n\ntype ApiExamplesProps = {\n className?: string;\n isModal?: boolean;\n apiReferenceData?: ApiReferenceDataV2;\n};\n\nexport const ApiExamples = ({ className, isModal = false, apiReferenceData }: ApiExamplesProps) => {\n const { apiReferenceData2: apiReferenceData2FromContext } = useContext(ApiReferenceContext2);\n const apiReferenceData2 = apiReferenceData || apiReferenceData2FromContext;\n const { getApiPlaygroundInputs } = usePlaygroundInputsStore();\n const inputs = getApiPlaygroundInputs();\n const [selectedLabel, setSelectedLabel] = useState<string | undefined>();\n\n const containerClassName = useMemo(\n () =>\n clsx(\n 'mint:w-full mint:xl:w-[28rem] mint:gap-6 mint:grid mint:grid-rows-[repeat(auto-fit,minmax(0,min-content))] mint:grid-rows mint:relative mint:max-h-[calc(100%-32px)] mint:min-h-[18rem]',\n className,\n ),\n [className, isModal]\n );\n\n return (\n <CodeExampleLabelContext.Provider value={{ selectedLabel, setSelectedLabel }}>\n <div className={containerClassName}>\n <ErrorBoundary>\n <RequestExample apiReferenceData={apiReferenceData2} inputs={inputs} maxHeight=\"mint:max-h-[40vh]\" />\n <ResponseExample apiReferenceData={apiReferenceData2} maxHeight=\"mint:max-h-[40vh]\" />\n {/* TODO - Api Playground Refactor: OpenApiSchemaExample */}\n </ErrorBoundary>\n </div>\n </CodeExampleLabelContext.Provider>\n );\n};\n\nexport default ApiExamples;\n"],"names":["ApiExamples","className","isModal","apiReferenceData","apiReferenceData2FromContext","useContext","ApiReferenceContext2","apiReferenceData2","getApiPlaygroundInputs","usePlaygroundInputsStore","inputs","selectedLabel","setSelectedLabel","useState","containerClassName","useMemo","clsx","jsx","CodeExampleLabelContext","ErrorBoundary","RequestExample","ResponseExample"],"mappings":";;;;;;;;;AAqBO,MAAMA,IAAc,CAAC,EAAE,WAAAC,GAAW,SAAAC,IAAU,IAAO,kBAAAC,QAAyC;AACjG,QAAM,EAAE,mBAAmBC,MAAiCC,EAAWC,CAAoB,GACrFC,IAAoBJ,KAAoBC,GACxC,EAAE,wBAAAI,EAAA,IAA2BC,EAAA,GAC7BC,IAASF,EAAA,GACT,CAACG,GAAeC,CAAgB,IAAIC,EAAA,GAEpCC,IAAqBC;AAAA,IACzB,MACEC;AAAA,MACE;AAAA,MACAf;AAAA,IAAA;AAAA,IAEJ,CAACA,GAAWC,CAAO;AAAA,EAAA;AAGrB,SACE,gBAAAe,EAACC,EAAwB,UAAxB,EAAiC,OAAO,EAAE,eAAAP,GAAe,kBAAAC,KACxD,UAAA,gBAAAK,EAAC,OAAA,EAAI,WAAWH,GACd,4BAACK,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAF,EAACG,GAAA,EAAe,kBAAkBb,GAAmB,QAAAG,GAAgB,WAAU,qBAAoB;AAAA,IACnG,gBAAAO,EAACI,GAAA,EAAgB,kBAAkBd,GAAmB,WAAU,oBAAA,CAAoB;AAAA,EAAA,EAAA,CAEtF,GACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useEffect as B } from "react";
|
|
3
|
+
import { generateRequest as E } from "@/api-playground-2/generators/generateRequest";
|
|
4
|
+
import { generateSnippet as I } from "@/api-playground-2/generators/generateSnippet";
|
|
5
|
+
import { getFirstExampleValue as w } from "@/api-playground-2/schemaGraph/processExamples";
|
|
6
|
+
import { CodeGroupSelect as A } from "../../../components/content-components/CodeGroupSelect/index.js";
|
|
7
|
+
import { CodeSnippets as G } from "../../../components/content-components/code-snippets.js";
|
|
8
|
+
import { langToPresetMap as P } from "../../../constants/snippetPresets.js";
|
|
9
|
+
const Q = ({
|
|
10
|
+
baseUrl: r,
|
|
11
|
+
apiReferenceData: t,
|
|
12
|
+
inputs: e,
|
|
13
|
+
requestExampleLanguages: l,
|
|
14
|
+
requiredOnly: s,
|
|
15
|
+
maxHeight: n
|
|
16
|
+
}) => {
|
|
17
|
+
var f, S, u, x, o;
|
|
18
|
+
const c = (f = t.dependencies) == null ? void 0 : f.requestBody;
|
|
19
|
+
if (!c)
|
|
20
|
+
return /* @__PURE__ */ T(
|
|
21
|
+
C,
|
|
22
|
+
{
|
|
23
|
+
apiReferenceData: t,
|
|
24
|
+
baseUrl: r,
|
|
25
|
+
inputs: e,
|
|
26
|
+
requestExampleLanguages: l,
|
|
27
|
+
requiredOnly: s,
|
|
28
|
+
maxHeight: n
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
const i = w(c.content);
|
|
32
|
+
if (!i) return null;
|
|
33
|
+
const p = Object.entries(c.content).map(
|
|
34
|
+
([h, d]) => ({
|
|
35
|
+
contentType: h,
|
|
36
|
+
examples: d.examples
|
|
37
|
+
})
|
|
38
|
+
), m = 0;
|
|
39
|
+
return ((S = p[m]) == null ? void 0 : S.examples.length) > 1 ? /* @__PURE__ */ T(
|
|
40
|
+
V,
|
|
41
|
+
{
|
|
42
|
+
apiReferenceData: t,
|
|
43
|
+
selectedBodyContentType: (u = p[m]) == null ? void 0 : u.contentType,
|
|
44
|
+
baseUrl: r,
|
|
45
|
+
inputs: e,
|
|
46
|
+
examples: (x = p[m]) == null ? void 0 : x.examples,
|
|
47
|
+
requiredOnly: s,
|
|
48
|
+
maxHeight: n
|
|
49
|
+
}
|
|
50
|
+
) : /* @__PURE__ */ T(
|
|
51
|
+
C,
|
|
52
|
+
{
|
|
53
|
+
apiReferenceData: t,
|
|
54
|
+
selectedBodyContentType: (o = p[m]) == null ? void 0 : o.contentType,
|
|
55
|
+
baseUrl: r,
|
|
56
|
+
inputs: e,
|
|
57
|
+
exampleValue: i,
|
|
58
|
+
requestExampleLanguages: l,
|
|
59
|
+
requiredOnly: s,
|
|
60
|
+
maxHeight: n
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}, C = ({
|
|
64
|
+
baseUrl: r,
|
|
65
|
+
apiReferenceData: t,
|
|
66
|
+
inputs: e,
|
|
67
|
+
selectedBodyContentType: l,
|
|
68
|
+
exampleValue: s,
|
|
69
|
+
requestExampleLanguages: n,
|
|
70
|
+
requiredOnly: c,
|
|
71
|
+
maxHeight: i
|
|
72
|
+
}) => {
|
|
73
|
+
const [p, m] = y(null), [f, S] = y(null);
|
|
74
|
+
return B(() => {
|
|
75
|
+
const u = E({
|
|
76
|
+
baseUrl: r,
|
|
77
|
+
apiReferenceData: t,
|
|
78
|
+
inputs: e,
|
|
79
|
+
selectedBodyContentType: l,
|
|
80
|
+
exampleData: s,
|
|
81
|
+
requiredOnly: c
|
|
82
|
+
}), x = n == null ? void 0 : n.reduce((o, h) => {
|
|
83
|
+
const d = P[h];
|
|
84
|
+
return d && o.push(d), o;
|
|
85
|
+
}, []);
|
|
86
|
+
I({
|
|
87
|
+
apiReferenceData: t,
|
|
88
|
+
pathInputs: e.path,
|
|
89
|
+
request: u,
|
|
90
|
+
snippetPresets: x
|
|
91
|
+
}).then(m).catch((o) => {
|
|
92
|
+
console.error(o), S(o);
|
|
93
|
+
});
|
|
94
|
+
}, [r, t, e, l, s, n, c]), f || !p ? null : /* @__PURE__ */ T(G, { snippets: p, dropdown: !0, maxHeight: i });
|
|
95
|
+
}, V = ({
|
|
96
|
+
baseUrl: r,
|
|
97
|
+
apiReferenceData: t,
|
|
98
|
+
inputs: e,
|
|
99
|
+
selectedBodyContentType: l,
|
|
100
|
+
examples: s,
|
|
101
|
+
requiredOnly: n,
|
|
102
|
+
maxHeight: c
|
|
103
|
+
}) => {
|
|
104
|
+
const [i, p] = y({}), [m, f] = y(null);
|
|
105
|
+
return B(() => {
|
|
106
|
+
const S = e.path, u = {};
|
|
107
|
+
(async () => {
|
|
108
|
+
for (const [o, { value: h }] of Object.entries(s)) {
|
|
109
|
+
if (!h) continue;
|
|
110
|
+
const d = E({
|
|
111
|
+
baseUrl: r,
|
|
112
|
+
apiReferenceData: t,
|
|
113
|
+
inputs: e,
|
|
114
|
+
selectedBodyContentType: l,
|
|
115
|
+
exampleData: h,
|
|
116
|
+
requiredOnly: n
|
|
117
|
+
});
|
|
118
|
+
try {
|
|
119
|
+
(await I({
|
|
120
|
+
apiReferenceData: t,
|
|
121
|
+
pathInputs: S,
|
|
122
|
+
request: d,
|
|
123
|
+
isMultipleRequest: !0
|
|
124
|
+
})).forEach((j) => {
|
|
125
|
+
u[j.filename] = {
|
|
126
|
+
...u[j.filename],
|
|
127
|
+
[o]: j
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
} catch (M) {
|
|
131
|
+
console.error(M), f(M);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
p(u);
|
|
136
|
+
})();
|
|
137
|
+
}, [r, t, e, l, s, n]), m || Object.keys(i).length === 0 ? null : /* @__PURE__ */ T(A, { snippets: i, maxHeight: c });
|
|
138
|
+
};
|
|
139
|
+
export {
|
|
140
|
+
Q as GeneratedRequestExample
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=GeneratedRequestExample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratedRequestExample.js","sources":["../../../../src/api-playground-2/components/Example/GeneratedRequestExample.tsx"],"sourcesContent":["import { ApiPlaygroundInputs, ExampleSchema } from '@mintlify/validation';\nimport { JSX, useState, useEffect } from 'react';\n\nimport { generateRequest } from '@/api-playground-2/generators/generateRequest';\nimport { generateSnippet } from '@/api-playground-2/generators/generateSnippet';\nimport { getFirstExampleValue } from '@/api-playground-2/schemaGraph/processExamples';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { CodeGroupSelect } from '../../../components/content-components/CodeGroupSelect';\nimport { CodeSnippets } from '../../../components/content-components/code-snippets';\nimport { langToPresetMap, SnippetPreset } from '../../../constants/snippetPresets';\nimport type { ExampleCodeSnippet } from '../../../types/exampleCodeSnippet';\n\nexport type GeneratedRequestExampleParams = {\n baseUrl: string;\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n maxHeight?: string;\n};\n\nexport const GeneratedRequestExample = ({\n baseUrl,\n apiReferenceData,\n inputs,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n}: GeneratedRequestExampleParams): JSX.Element | null => {\n const requestBody = apiReferenceData.dependencies?.requestBody;\n\n if (!requestBody) {\n return (\n <SingleRequest\n apiReferenceData={apiReferenceData}\n baseUrl={baseUrl}\n inputs={inputs}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n }\n\n const firstExampleValue = getFirstExampleValue(requestBody.content);\n\n if (!firstExampleValue) return null;\n\n const examplesByContentType = Object.entries(requestBody.content).map(\n ([contentType, content]) => {\n return {\n contentType,\n examples: content.examples,\n };\n }\n );\n const selectedContentTypeIndex = 0;\n\n return examplesByContentType[selectedContentTypeIndex]?.examples.length > 1 ? (\n <MultipleRequest\n apiReferenceData={apiReferenceData}\n selectedBodyContentType={examplesByContentType[selectedContentTypeIndex]?.contentType}\n baseUrl={baseUrl}\n inputs={inputs}\n examples={examplesByContentType[selectedContentTypeIndex]?.examples}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n ) : (\n <SingleRequest\n apiReferenceData={apiReferenceData}\n selectedBodyContentType={examplesByContentType[selectedContentTypeIndex]?.contentType}\n baseUrl={baseUrl}\n inputs={inputs}\n exampleValue={firstExampleValue}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n};\n\ntype SingleRequestParams = GeneratedRequestExampleParams & {\n selectedBodyContentType?: string;\n exampleValue?: unknown;\n};\n\nconst SingleRequest = ({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n exampleValue,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n}: SingleRequestParams) => {\n const [snippets, setSnippets] = useState<ExampleCodeSnippet[] | null>(null);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const request = generateRequest({\n baseUrl,\n apiReferenceData,\n inputs: inputs,\n selectedBodyContentType,\n exampleData: exampleValue,\n requiredOnly,\n });\n\n const snippetPresets = requestExampleLanguages?.reduce<SnippetPreset[]>((acc, lang) => {\n const preset = langToPresetMap[lang];\n if (preset) acc.push(preset);\n return acc;\n }, []);\n\n generateSnippet({\n apiReferenceData,\n pathInputs: inputs.path,\n request,\n snippetPresets,\n })\n .then(setSnippets)\n .catch((err) => {\n console.error(err);\n setError(err);\n });\n }, [baseUrl, apiReferenceData, inputs, selectedBodyContentType, exampleValue, requestExampleLanguages, requiredOnly]);\n\n if (error) return null;\n if (!snippets) return null; // or a loading spinner\n\n return <CodeSnippets snippets={snippets} dropdown maxHeight={maxHeight} />;\n};\n\ntype MultipleRequestParams = GeneratedRequestExampleParams & {\n selectedBodyContentType?: string;\n examples: Record<string, ExampleSchema>;\n};\n\nconst MultipleRequest = ({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n examples,\n requiredOnly,\n maxHeight,\n}: MultipleRequestParams): JSX.Element | null => {\n const [nameToSnippetExamplesMap, setNameToSnippetExamplesMap] = useState<\n Record<string, Record<string, ExampleCodeSnippet>>\n >({});\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const pathInputs = inputs.path;\n const snippetMap: Record<string, Record<string, ExampleCodeSnippet>> = {};\n\n const generateAllSnippets = async () => {\n for (const [name, { value: exampleData }] of Object.entries(examples)) {\n if (!exampleData) continue;\n\n const request = generateRequest({\n baseUrl,\n apiReferenceData,\n inputs,\n selectedBodyContentType,\n exampleData,\n requiredOnly,\n });\n\n try {\n const snippets = await generateSnippet({\n apiReferenceData,\n pathInputs,\n request,\n isMultipleRequest: true,\n });\n\n snippets.forEach((snippet) => {\n snippetMap[snippet.filename] = {\n ...snippetMap[snippet.filename],\n [name]: snippet,\n };\n });\n } catch (err) {\n console.error(err);\n setError(err as Error);\n return;\n }\n }\n setNameToSnippetExamplesMap(snippetMap);\n };\n\n generateAllSnippets();\n }, [baseUrl, apiReferenceData, inputs, selectedBodyContentType, examples, requiredOnly]);\n\n if (error) return null;\n if (Object.keys(nameToSnippetExamplesMap).length === 0) return null;\n\n return <CodeGroupSelect snippets={nameToSnippetExamplesMap} maxHeight={maxHeight} />;\n};\n"],"names":["GeneratedRequestExample","baseUrl","apiReferenceData","inputs","requestExampleLanguages","requiredOnly","maxHeight","requestBody","_a","jsx","SingleRequest","firstExampleValue","getFirstExampleValue","examplesByContentType","contentType","content","selectedContentTypeIndex","_b","MultipleRequest","_c","_d","_e","selectedBodyContentType","exampleValue","snippets","setSnippets","useState","error","setError","useEffect","request","generateRequest","snippetPresets","acc","lang","preset","langToPresetMap","generateSnippet","err","CodeSnippets","examples","nameToSnippetExamplesMap","setNameToSnippetExamplesMap","pathInputs","snippetMap","name","exampleData","snippet","CodeGroupSelect"],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { generateResponseExampleMap as m } from "@/api-playground-2/generators/generateResponseExampleMap";
|
|
3
|
+
import { mapResponseExamples as i } from "@/api-playground-2/schemaGraph/utils";
|
|
4
|
+
import { CodeGroupSelect as u } from "../../../components/content-components/CodeGroupSelect/index.js";
|
|
5
|
+
import { CodeSnippets as d } from "../../../components/content-components/code-snippets.js";
|
|
6
|
+
const C = ({
|
|
7
|
+
apiReferenceData: s,
|
|
8
|
+
// TODO - Api Playground Refactor: selectedContentType here implies the example will change when a different example is selected, but that doesn't work even in v1 - should be easy to pass a real selectedContentTypeIndex here
|
|
9
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
10
|
+
selectedResponseContentType: j,
|
|
11
|
+
maxHeight: n
|
|
12
|
+
}) => {
|
|
13
|
+
var o;
|
|
14
|
+
const p = Object.values(((o = s.dependencies) == null ? void 0 : o.responses) ?? {});
|
|
15
|
+
if (Object.keys(p).length === 0 || Object.values(p).every((e) => Object.keys(e).length === 0))
|
|
16
|
+
return null;
|
|
17
|
+
const c = i(s), t = m(c, 0);
|
|
18
|
+
if (Object.values(t).every((e) => Object.keys(e).length <= 1)) {
|
|
19
|
+
const l = Object.values(t).flatMap(
|
|
20
|
+
(a) => Object.values(a)
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ r(d, { snippets: l, maxHeight: n });
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ r(u, { snippets: t, maxHeight: n });
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
C as GeneratedResponseExample
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=GeneratedResponseExample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratedResponseExample.js","sources":["../../../../src/api-playground-2/components/Example/GeneratedResponseExample.tsx"],"sourcesContent":["import { generateResponseExampleMap } from '@/api-playground-2/generators/generateResponseExampleMap';\nimport { mapResponseExamples } from '@/api-playground-2/schemaGraph/utils';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { CodeGroupSelect } from '../../../components/content-components/CodeGroupSelect';\nimport { CodeSnippets } from '../../../components/content-components/code-snippets';\nimport type { ExampleCodeSnippet } from '../../../types/exampleCodeSnippet';\n\nexport const GeneratedResponseExample = ({\n apiReferenceData,\n // TODO - Api Playground Refactor: selectedContentType here implies the example will change when a different example is selected, but that doesn't work even in v1 - should be easy to pass a real selectedContentTypeIndex here\n // eslint-disable-next-line unused-imports/no-unused-vars\n selectedResponseContentType: selectedContentType,\n maxHeight,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n selectedResponseContentType?: string;\n maxHeight?: string;\n}) => {\n const responseContent = Object.values(apiReferenceData.dependencies?.responses ?? {});\n\n // if there are no status codes, don't render\n if (Object.keys(responseContent).length === 0) {\n return null;\n }\n\n // if none of the status codes have a content type, don't render\n if (Object.values(responseContent).every((body) => Object.keys(body).length === 0)) {\n return null;\n }\n\n const responseCodeMediaObjects = mapResponseExamples(apiReferenceData);\n\n const responseExampleMap = generateResponseExampleMap(responseCodeMediaObjects, 0);\n\n if (Object.values(responseExampleMap).every((value) => Object.keys(value).length <= 1)) {\n const codeSnippetMap: Record<string, ExampleCodeSnippet>[] = Object.values(responseExampleMap);\n const snippets: ExampleCodeSnippet[] = codeSnippetMap.flatMap((record) =>\n Object.values(record)\n );\n return <CodeSnippets snippets={snippets} maxHeight={maxHeight} />;\n }\n return <CodeGroupSelect snippets={responseExampleMap} maxHeight={maxHeight} />;\n};\n"],"names":["GeneratedResponseExample","apiReferenceData","selectedContentType","maxHeight","responseContent","_a","body","responseCodeMediaObjects","mapResponseExamples","responseExampleMap","generateResponseExampleMap","value","snippets","record","jsx","CodeSnippets","CodeGroupSelect"],"mappings":";;;;;AAOO,MAAMA,IAA2B,CAAC;AAAA,EACvC,kBAAAC;AAAA;AAAA;AAAA,EAGA,6BAA6BC;AAAA,EAC7B,WAAAC;AACF,MAIM;;AACJ,QAAMC,IAAkB,OAAO,SAAOC,IAAAJ,EAAiB,iBAAjB,gBAAAI,EAA+B,cAAa,EAAE;AAQpF,MALI,OAAO,KAAKD,CAAe,EAAE,WAAW,KAKxC,OAAO,OAAOA,CAAe,EAAE,MAAM,CAACE,MAAS,OAAO,KAAKA,CAAI,EAAE,WAAW,CAAC;AAC/E,WAAO;AAGT,QAAMC,IAA2BC,EAAoBP,CAAgB,GAE/DQ,IAAqBC,EAA2BH,GAA0B,CAAC;AAEjF,MAAI,OAAO,OAAOE,CAAkB,EAAE,MAAM,CAACE,MAAU,OAAO,KAAKA,CAAK,EAAE,UAAU,CAAC,GAAG;AAEtF,UAAMC,IADuD,OAAO,OAAOH,CAAkB,EACvC;AAAA,MAAQ,CAACI,MAC7D,OAAO,OAAOA,CAAM;AAAA,IAAA;AAEtB,WAAO,gBAAAC,EAACC,GAAA,EAAa,UAAAH,GAAoB,WAAAT,EAAA,CAAsB;AAAA,EACjE;AACA,SAAO,gBAAAW,EAACE,GAAA,EAAgB,UAAUP,GAAoB,WAAAN,EAAA,CAAsB;AAC9E;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useEffect as q } from "react";
|
|
3
|
+
import { initialApiPlaygroundInputs as y } from "@/api-playground-2/constants";
|
|
4
|
+
import { generateSnippetMap as E } from "@/api-playground-2/generators/generateSnippetMap";
|
|
5
|
+
import { CodeGroupSelect as x } from "../../../components/content-components/CodeGroupSelect/index.js";
|
|
6
|
+
import { CodeSnippets as M } from "../../../components/content-components/code-snippets.js";
|
|
7
|
+
import { CodeBlock as O } from "../../../components/content-components/code-block.js";
|
|
8
|
+
import { CodeGroup as T } from "../../../components/content-components/code-group.js";
|
|
9
|
+
import { prismLangToDisplayLang as U } from "../../../constants/prism-languages.js";
|
|
10
|
+
import { useApiPlaygroundDisplay as j } from "../../../hooks/useApiPlaygroundDisplay.js";
|
|
11
|
+
import { GeneratedRequestExample as w } from "./GeneratedRequestExample.js";
|
|
12
|
+
const F = ({
|
|
13
|
+
apiReferenceData: o,
|
|
14
|
+
inputs: m = y,
|
|
15
|
+
maxHeight: l
|
|
16
|
+
}) => {
|
|
17
|
+
var r, s, c, e, g;
|
|
18
|
+
const p = (r = o.operation) == null ? void 0 : r.requestExamples, a = j(), i = (s = o.operation) == null ? void 0 : s.requestExampleLanguages, t = (c = o.operation) == null ? void 0 : c.requiredOnlyExamples, d = (e = o.operation) == null ? void 0 : e.requestExampleType;
|
|
19
|
+
switch (console.log("requestExampleType", d), (g = o.operation) == null ? void 0 : g.requestExampleType) {
|
|
20
|
+
case "mdx":
|
|
21
|
+
if (!p) return null;
|
|
22
|
+
const f = p.some((u) => u.dropdown ?? !1);
|
|
23
|
+
return /* @__PURE__ */ n(T, { isSmallText: !0, dropdown: f, noMargins: !0, className: l, children: p.map((u) => /* @__PURE__ */ n(
|
|
24
|
+
O,
|
|
25
|
+
{
|
|
26
|
+
language: u.language,
|
|
27
|
+
fileName: u.filename,
|
|
28
|
+
children: /* @__PURE__ */ n("span", { children: u.code })
|
|
29
|
+
},
|
|
30
|
+
u.filename
|
|
31
|
+
)) });
|
|
32
|
+
case "codeSamples":
|
|
33
|
+
return o.operation.codeSamples ? /* @__PURE__ */ n(
|
|
34
|
+
C,
|
|
35
|
+
{
|
|
36
|
+
apiReferenceData: o,
|
|
37
|
+
inputs: m,
|
|
38
|
+
apiPlaygroundDisplay: a,
|
|
39
|
+
requestExampleLanguages: i,
|
|
40
|
+
requiredOnly: t,
|
|
41
|
+
maxHeight: l
|
|
42
|
+
}
|
|
43
|
+
) : null;
|
|
44
|
+
case "generated":
|
|
45
|
+
const S = o.operation.baseUrl ?? o.operation.baseUrlOptions[0];
|
|
46
|
+
return S ? /* @__PURE__ */ n(
|
|
47
|
+
w,
|
|
48
|
+
{
|
|
49
|
+
apiReferenceData: o,
|
|
50
|
+
baseUrl: S,
|
|
51
|
+
inputs: m,
|
|
52
|
+
requestExampleLanguages: i,
|
|
53
|
+
requiredOnly: t,
|
|
54
|
+
maxHeight: l
|
|
55
|
+
}
|
|
56
|
+
) : null;
|
|
57
|
+
}
|
|
58
|
+
}, C = ({
|
|
59
|
+
apiReferenceData: o,
|
|
60
|
+
inputs: m,
|
|
61
|
+
apiPlaygroundDisplay: l,
|
|
62
|
+
requestExampleLanguages: p,
|
|
63
|
+
requiredOnly: a,
|
|
64
|
+
maxHeight: i
|
|
65
|
+
}) => {
|
|
66
|
+
const [t, d] = b(null);
|
|
67
|
+
if (q(() => {
|
|
68
|
+
var r;
|
|
69
|
+
(r = o.operation) != null && r.codeSamples && E({
|
|
70
|
+
apiReferenceData: o,
|
|
71
|
+
codeSamples: o.operation.codeSamples,
|
|
72
|
+
baseUrl: o.operation.baseUrl ?? o.operation.baseUrlOptions[0],
|
|
73
|
+
apiPlaygroundMode: l,
|
|
74
|
+
requestExampleLanguages: p,
|
|
75
|
+
requiredOnly: a,
|
|
76
|
+
inputs: m
|
|
77
|
+
}).then(d);
|
|
78
|
+
}, [o, m, l, p, a]), !t) return null;
|
|
79
|
+
if (Object.values(t).every((r) => Object.keys(r).length <= 1)) {
|
|
80
|
+
let s = Object.values(t).flatMap((e) => Object.values(e));
|
|
81
|
+
return new Set(s.map((e) => e.filename)).size !== s.length && (s = s.map((e) => ({
|
|
82
|
+
...e,
|
|
83
|
+
filename: U[e.language] ?? e.language
|
|
84
|
+
}))), /* @__PURE__ */ n(M, { snippets: s, dropdown: !0, maxHeight: i });
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ n(x, { snippets: t, maxHeight: i });
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
F as RequestExample
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=RequestExample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestExample.js","sources":["../../../../src/api-playground-2/components/Example/RequestExample.tsx"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\nimport { useState, useEffect } from 'react';\n\nimport { initialApiPlaygroundInputs } from '@/api-playground-2/constants';\nimport { generateSnippetMap } from '@/api-playground-2/generators/generateSnippetMap';\nimport type { ApiReferenceDataV2, CodeExample } from '@/api-playground-2/types';\nimport { CodeGroupSelect } from '../../../components/content-components/CodeGroupSelect';\nimport { CodeSnippet } from '../../../components/content-components/code-snippet';\nimport { CodeSnippets } from '../../../components/content-components/code-snippets';\nimport { CodeBlock } from '../../../components/content-components/code-block';\nimport { CodeGroup } from '../../../components/content-components/code-group';\nimport { prismLangToDisplayLang } from '../../../constants/prism-languages';\nimport { useApiPlaygroundDisplay } from '../../../hooks/useApiPlaygroundDisplay';\nimport type { ExampleCodeSnippet } from '../../../types/exampleCodeSnippet';\n\nimport { GeneratedRequestExample } from './GeneratedRequestExample';\n\nexport const RequestExample = ({\n apiReferenceData,\n inputs = initialApiPlaygroundInputs,\n maxHeight,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n maxHeight?: string;\n}) => {\n const requestExamples = apiReferenceData.operation?.requestExamples;\n const apiPlaygroundDisplay = useApiPlaygroundDisplay();\n const requestExampleLanguages = apiReferenceData.operation?.requestExampleLanguages;\n const requiredOnly = apiReferenceData.operation?.requiredOnlyExamples;\n\n const requestExampleType = apiReferenceData.operation?.requestExampleType;\n\n console.log('requestExampleType', requestExampleType);\n\n switch (apiReferenceData.operation?.requestExampleType) {\n case 'mdx':\n if (!requestExamples) return null;\n const dropdown = requestExamples.some((example: CodeExample) => example.dropdown ?? false);\n return (\n <CodeGroup isSmallText dropdown={dropdown} noMargins className={maxHeight}>\n {requestExamples.map((example: CodeExample) => (\n <CodeBlock\n language={example.language}\n fileName={example.filename}\n key={example.filename}\n >\n <span>{example.code}</span>\n </CodeBlock>\n ))}\n </CodeGroup>\n );\n case 'codeSamples':\n if (!apiReferenceData.operation.codeSamples) return null;\n return (\n <CodeSamplesExample\n apiReferenceData={apiReferenceData}\n inputs={inputs}\n apiPlaygroundDisplay={apiPlaygroundDisplay}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n case 'generated':\n const baseUrl =\n apiReferenceData.operation.baseUrl ?? apiReferenceData.operation.baseUrlOptions[0];\n if (!baseUrl) return null;\n return (\n <GeneratedRequestExample\n apiReferenceData={apiReferenceData}\n baseUrl={baseUrl}\n inputs={inputs}\n requestExampleLanguages={requestExampleLanguages}\n requiredOnly={requiredOnly}\n maxHeight={maxHeight}\n />\n );\n }\n};\n\nconst CodeSamplesExample = ({\n apiReferenceData,\n inputs,\n apiPlaygroundDisplay,\n requestExampleLanguages,\n requiredOnly,\n maxHeight,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n inputs: ApiPlaygroundInputs;\n apiPlaygroundDisplay: 'none' | 'simple' | 'interactive';\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n maxHeight?: string;\n}) => {\n const [snippetMap, setSnippetMap] = useState<Record<string, Record<string, ExampleCodeSnippet>> | null>(null);\n\n useEffect(() => {\n if (!apiReferenceData.operation?.codeSamples) return;\n\n generateSnippetMap({\n apiReferenceData,\n codeSamples: apiReferenceData.operation.codeSamples,\n baseUrl: apiReferenceData.operation.baseUrl ?? apiReferenceData.operation.baseUrlOptions[0],\n apiPlaygroundMode: apiPlaygroundDisplay,\n requestExampleLanguages,\n requiredOnly,\n inputs,\n }).then(setSnippetMap);\n }, [apiReferenceData, inputs, apiPlaygroundDisplay, requestExampleLanguages, requiredOnly]);\n\n if (!snippetMap) return null;\n\n if (Object.values(snippetMap).every((value) => Object.keys(value).length <= 1)) {\n const codeSnippetMap = Object.values(snippetMap);\n let snippets = codeSnippetMap.flatMap((record) => Object.values(record));\n const uniqueLabels = new Set(snippets.map((snippet) => snippet.filename));\n if (uniqueLabels.size !== snippets.length) {\n snippets = snippets.map((snippet) => ({\n ...snippet,\n filename: prismLangToDisplayLang[snippet.language] ?? snippet.language,\n }));\n }\n return <CodeSnippets snippets={snippets} dropdown maxHeight={maxHeight} />;\n }\n\n return <CodeGroupSelect snippets={snippetMap} maxHeight={maxHeight} />;\n};\n"],"names":["RequestExample","apiReferenceData","inputs","initialApiPlaygroundInputs","maxHeight","requestExamples","_a","apiPlaygroundDisplay","useApiPlaygroundDisplay","requestExampleLanguages","_b","requiredOnly","_c","requestExampleType","_d","_e","dropdown","example","jsx","CodeGroup","CodeBlock","CodeSamplesExample","baseUrl","GeneratedRequestExample","snippetMap","setSnippetMap","useState","useEffect","generateSnippetMap","value","snippets","record","snippet","prismLangToDisplayLang","CodeSnippets","CodeGroupSelect"],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { CodeBlock as t } from "../../../components/content-components/code-block.js";
|
|
3
|
+
import { CodeGroup as i } from "../../../components/content-components/code-group.js";
|
|
4
|
+
import { GeneratedResponseExample as a } from "./GeneratedResponseExample.js";
|
|
5
|
+
const x = ({ apiReferenceData: r, maxHeight: s }) => {
|
|
6
|
+
var l, p;
|
|
7
|
+
const n = (l = r.operation) == null ? void 0 : l.responseExamples;
|
|
8
|
+
if (((p = r.operation) == null ? void 0 : p.responseExampleType) === "mdx") {
|
|
9
|
+
if (!n) return null;
|
|
10
|
+
const m = n.some((e) => e.dropdown ?? !1);
|
|
11
|
+
return /* @__PURE__ */ o(i, { isSmallText: !0, dropdown: m, noMargins: !0, className: s, children: n.map((e) => /* @__PURE__ */ o(t, { language: e.language, fileName: e.filename, children: /* @__PURE__ */ o("span", { children: e.code }) }, e.filename)) });
|
|
12
|
+
} else
|
|
13
|
+
return /* @__PURE__ */ o(a, { apiReferenceData: r, maxHeight: s });
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
x as ResponseExample
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=ResponseExample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponseExample.js","sources":["../../../../src/api-playground-2/components/Example/ResponseExample.tsx"],"sourcesContent":["'use client';\n\nimport type { ApiReferenceDataV2, CodeExample } from '@/api-playground-2/types';\nimport { CodeBlock } from '../../../components/content-components/code-block';\nimport { CodeGroup } from '../../../components/content-components/code-group';\n\nimport { GeneratedResponseExample } from './GeneratedResponseExample';\n\nexport const ResponseExample = ({ apiReferenceData, maxHeight }: { apiReferenceData: ApiReferenceDataV2; maxHeight?: string }) => {\n const responseExamples = apiReferenceData.operation?.responseExamples;\n\n if (apiReferenceData.operation?.responseExampleType === 'mdx') {\n if (!responseExamples) return null;\n const dropdown = responseExamples.some((example: CodeExample) => example.dropdown ?? false);\n return (\n <CodeGroup isSmallText dropdown={dropdown} noMargins className={maxHeight}>\n {responseExamples.map((example: CodeExample) => (\n <CodeBlock language={example.language} fileName={example.filename} key={example.filename}>\n <span>{example.code}</span>\n </CodeBlock>\n ))}\n </CodeGroup>\n );\n } else {\n return <GeneratedResponseExample apiReferenceData={apiReferenceData} maxHeight={maxHeight} />;\n }\n};\n"],"names":["ResponseExample","apiReferenceData","maxHeight","responseExamples","_a","_b","dropdown","example","jsx","CodeGroup","CodeBlock","GeneratedResponseExample"],"mappings":";;;;AAQO,MAAMA,IAAkB,CAAC,EAAE,kBAAAC,GAAkB,WAAAC,QAA8E;;AAChI,QAAMC,KAAmBC,IAAAH,EAAiB,cAAjB,gBAAAG,EAA4B;AAErD,QAAIC,IAAAJ,EAAiB,cAAjB,gBAAAI,EAA4B,yBAAwB,OAAO;AAC7D,QAAI,CAACF,EAAkB,QAAO;AAC9B,UAAMG,IAAWH,EAAiB,KAAK,CAACI,MAAyBA,EAAQ,YAAY,EAAK;AAC1F,WACE,gBAAAC,EAACC,GAAA,EAAU,aAAW,IAAC,UAAAH,GAAoB,WAAS,IAAC,WAAWJ,GAC7D,UAAAC,EAAiB,IAAI,CAACI,MACrB,gBAAAC,EAACE,GAAA,EAAU,UAAUH,EAAQ,UAAU,UAAUA,EAAQ,UACvD,UAAA,gBAAAC,EAAC,QAAA,EAAM,UAAAD,EAAQ,MAAK,EAAA,GADkDA,EAAQ,QAEhF,CACD,GACH;AAAA,EAEJ;AACE,WAAO,gBAAAC,EAACG,GAAA,EAAyB,kBAAAV,GAAoC,WAAAC,EAAA,CAAsB;AAE/F;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
class a extends e.Component {
|
|
3
|
+
constructor(r) {
|
|
4
|
+
super(r), this.state = { hasError: !1 };
|
|
5
|
+
}
|
|
6
|
+
static getDerivedStateFromError() {
|
|
7
|
+
return { hasError: !0 };
|
|
8
|
+
}
|
|
9
|
+
componentDidCatch(r, t) {
|
|
10
|
+
console.log({ error: r, errorInfo: t });
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
return this.state.hasError ? null : this.props.children;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
a as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sources":["../../../src/components/Api/ErrorBoundary.tsx"],"sourcesContent":["'use client';\n\nimport React, { ReactNode } from 'react';\n\nclass ErrorBoundary extends React.Component<{ children: ReactNode }, { hasError: boolean }> {\n constructor(props: { children: ReactNode }) {\n super(props);\n this.state = { hasError: false };\n }\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n console.log({ error, errorInfo });\n }\n render() {\n if (this.state.hasError) {\n return null;\n }\n return this.props.children;\n }\n}\n\nexport default ErrorBoundary;\n"],"names":["ErrorBoundary","React","props","error","errorInfo"],"mappings":";AAIA,MAAMA,UAAsBC,EAAM,UAA0D;AAAA,EAC1F,YAAYC,GAAgC;AAC1C,UAAMA,CAAK,GACX,KAAK,QAAQ,EAAE,UAAU,GAAA;AAAA,EAC3B;AAAA,EACA,OAAO,2BAA2B;AAChC,WAAO,EAAE,UAAU,GAAA;AAAA,EACrB;AAAA,EACA,kBAAkBC,GAAcC,GAAkC;AAChE,YAAQ,IAAI,EAAE,OAAAD,GAAO,WAAAC,EAAA,CAAW;AAAA,EAClC;AAAA,EACA,SAAS;AACP,WAAI,KAAK,MAAM,WACN,OAEF,KAAK,MAAM;AAAA,EACpB;AACF;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { getShortenedMethodName as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { getShortenedMethodName as s, getMethodColor as c } from "./colors.js";
|
|
3
|
+
import { cn as g } from "../../utils/cn.js";
|
|
4
|
+
const h = ({ isActive: n = !1, method: t, shortMethod: e = !1, className: o }) => {
|
|
5
|
+
const i = t.toUpperCase(), m = s(i), { activeNavPillBg: l, activeNavPillText: a, inactiveNavPillText: r, inactiveNavPillBg: d } = c(t);
|
|
6
|
+
return /* @__PURE__ */ p(
|
|
7
7
|
"span",
|
|
8
8
|
{
|
|
9
|
-
className:
|
|
10
|
-
"mint:px-1 mint:py-0.5 mint:rounded-md mint:text-[0.55rem] mint:leading-tight mint:font-bold",
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
className: g(
|
|
10
|
+
e ? "mint:px-1 mint:py-0.5 mint:rounded-md mint:text-[0.55rem] mint:leading-tight mint:font-bold" : "mint:px-2 mint:py-0.5 mint:rounded-md mint:text-sm mint:leading-tight mint:font-bold",
|
|
11
|
+
n ? `${l} ${a}` : `${d} ${r}`,
|
|
12
|
+
o
|
|
13
13
|
),
|
|
14
|
-
children:
|
|
14
|
+
children: e ? m : i
|
|
15
15
|
}
|
|
16
16
|
);
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
h as MethodPill
|
|
20
20
|
};
|
|
21
21
|
//# sourceMappingURL=MethodPill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodPill.js","sources":["../../../src/components/Api/MethodPill.tsx"],"sourcesContent":["'use client';\n\nimport { getMethodColor, getShortenedMethodName } from './colors';\nimport { cn } from '../../utils/cn';\n\ntype MethodPillProps = {\n isActive: boolean;\n method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' | string;\n shortMethod?: boolean;\n className?: string;\n};\n\nexport const MethodPill = ({ isActive = false, method, shortMethod = false, className }: MethodPillProps) => {\n const upperMethod = method.toUpperCase();\n const shortenedMethod = getShortenedMethodName(upperMethod);\n const { activeNavPillBg, activeNavPillText, inactiveNavPillText, inactiveNavPillBg } =\n getMethodColor(method);\n return (\n <span\n className={cn(\n 'mint:px-1 mint:py-0.5 mint:rounded-md mint:text-[0.55rem] mint:leading-tight mint:font-bold',\n isActive\n ? `${activeNavPillBg} ${activeNavPillText}`\n : `${inactiveNavPillBg} ${inactiveNavPillText}`,\n className\n )}\n >\n {shortMethod ? shortenedMethod : upperMethod}\n </span>\n );\n};\n"],"names":["MethodPill","isActive","method","shortMethod","className","upperMethod","shortenedMethod","getShortenedMethodName","activeNavPillBg","activeNavPillText","inactiveNavPillText","inactiveNavPillBg","getMethodColor","jsx","cn"],"mappings":";;;AAYO,MAAMA,IAAa,CAAC,EAAE,UAAAC,IAAW,IAAO,QAAAC,GAAQ,aAAAC,IAAc,IAAO,WAAAC,QAAiC;AAC3G,QAAMC,IAAcH,EAAO,YAAA,GACrBI,IAAkBC,EAAuBF,CAAW,GACpD,EAAE,iBAAAG,GAAiB,mBAAAC,GAAmB,qBAAAC,GAAqB,mBAAAC,EAAA,IAC/DC,EAAeV,CAAM;AACvB,SACE,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,
|
|
1
|
+
{"version":3,"file":"MethodPill.js","sources":["../../../src/components/Api/MethodPill.tsx"],"sourcesContent":["'use client';\n\nimport { getMethodColor, getShortenedMethodName } from './colors';\nimport { cn } from '../../utils/cn';\n\ntype MethodPillProps = {\n isActive: boolean;\n method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' | string;\n shortMethod?: boolean;\n className?: string;\n};\n\nexport const MethodPill = ({ isActive = false, method, shortMethod = false, className }: MethodPillProps) => {\n const upperMethod = method.toUpperCase();\n const shortenedMethod = getShortenedMethodName(upperMethod);\n const { activeNavPillBg, activeNavPillText, inactiveNavPillText, inactiveNavPillBg } =\n getMethodColor(method);\n return (\n <span\n className={cn(\n shortMethod\n ? 'mint:px-1 mint:py-0.5 mint:rounded-md mint:text-[0.55rem] mint:leading-tight mint:font-bold'\n : 'mint:px-2 mint:py-0.5 mint:rounded-md mint:text-sm mint:leading-tight mint:font-bold',\n isActive\n ? `${activeNavPillBg} ${activeNavPillText}`\n : `${inactiveNavPillBg} ${inactiveNavPillText}`,\n className\n )}\n >\n {shortMethod ? shortenedMethod : upperMethod}\n </span>\n );\n};\n"],"names":["MethodPill","isActive","method","shortMethod","className","upperMethod","shortenedMethod","getShortenedMethodName","activeNavPillBg","activeNavPillText","inactiveNavPillText","inactiveNavPillBg","getMethodColor","jsx","cn"],"mappings":";;;AAYO,MAAMA,IAAa,CAAC,EAAE,UAAAC,IAAW,IAAO,QAAAC,GAAQ,aAAAC,IAAc,IAAO,WAAAC,QAAiC;AAC3G,QAAMC,IAAcH,EAAO,YAAA,GACrBI,IAAkBC,EAAuBF,CAAW,GACpD,EAAE,iBAAAG,GAAiB,mBAAAC,GAAmB,qBAAAC,GAAqB,mBAAAC,EAAA,IAC/DC,EAAeV,CAAM;AACvB,SACE,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACTX,IACI,gGACA;AAAA,QACJF,IACI,GAAGO,CAAe,IAAIC,CAAiB,KACvC,GAAGE,CAAiB,IAAID,CAAmB;AAAA,QAC/CN;AAAA,MAAA;AAAA,MAGD,cAAcE,IAAkBD;AAAA,IAAA;AAAA,EAAA;AAGvC;"}
|
|
@@ -1,105 +1,97 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e = (t) => {
|
|
2
2
|
switch (t == null ? void 0 : t.toUpperCase()) {
|
|
3
3
|
case "GET":
|
|
4
4
|
return {
|
|
5
5
|
activeNavPillBg: "mint:bg-[#2AB673]",
|
|
6
|
-
activeNavPillText: "mint:text-
|
|
6
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
7
7
|
inactiveNavPillText: "mint:text-green-700 mint:dark:text-green-400",
|
|
8
|
-
inactiveNavPillBg: "mint:bg-
|
|
9
|
-
paramStyle: "mint:
|
|
8
|
+
inactiveNavPillBg: "mint:bg-green-400/20 mint:dark:bg-green-400/20",
|
|
9
|
+
paramStyle: "mint:text-[#2AB673] mint:bg-[#2AB673]/10 mint:border-[#2AB673]/30"
|
|
10
10
|
};
|
|
11
11
|
case "POST":
|
|
12
|
-
return {
|
|
13
|
-
activeNavPillBg: "mint:bg-[#3064E3]",
|
|
14
|
-
activeNavPillText: "mint:text-white",
|
|
15
|
-
inactiveNavPillText: "mint:text-blue-700 mint:dark:text-blue-400",
|
|
16
|
-
inactiveNavPillBg: "mint:bg-[#3064E3]/20",
|
|
17
|
-
paramStyle: "mint:border-blue-700 mint:dark:border-blue-400 mint:text-blue-700 mint:dark:text-blue-400"
|
|
18
|
-
};
|
|
19
12
|
case "WEBHOOK":
|
|
20
13
|
return {
|
|
21
14
|
activeNavPillBg: "mint:bg-[#3064E3]",
|
|
22
|
-
activeNavPillText: "mint:text-
|
|
15
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
23
16
|
inactiveNavPillText: "mint:text-blue-700 mint:dark:text-blue-400",
|
|
24
|
-
inactiveNavPillBg: "mint:bg-
|
|
25
|
-
paramStyle: "mint:
|
|
17
|
+
inactiveNavPillBg: "mint:bg-blue-400/20 mint:dark:bg-blue-400/20",
|
|
18
|
+
paramStyle: "mint:text-[#3064E3] mint:bg-[#3064E3]/10 mint:border-[#3064E3]/30"
|
|
26
19
|
};
|
|
27
20
|
case "PUT":
|
|
28
21
|
return {
|
|
29
22
|
activeNavPillBg: "mint:bg-[#C28C30]",
|
|
30
|
-
activeNavPillText: "mint:text-
|
|
31
|
-
inactiveNavPillText: "mint:text-yellow-700 mint:dark:text-yellow-
|
|
32
|
-
inactiveNavPillBg: "mint:bg-
|
|
33
|
-
paramStyle: "mint:
|
|
23
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
24
|
+
inactiveNavPillText: "mint:text-yellow-700 mint:dark:text-yellow-400",
|
|
25
|
+
inactiveNavPillBg: "mint:bg-yellow-400/20 mint:dark:bg-yellow-400/20",
|
|
26
|
+
paramStyle: "mint:text-[#C28C30] mint:bg-[#C28C30]/10 mint:border-[#C28C30]/30"
|
|
34
27
|
};
|
|
35
28
|
case "DELETE":
|
|
36
29
|
return {
|
|
37
30
|
activeNavPillBg: "mint:bg-[#CB3A32]",
|
|
38
|
-
activeNavPillText: "mint:text-
|
|
31
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
39
32
|
inactiveNavPillText: "mint:text-red-700 mint:dark:text-red-400",
|
|
40
|
-
inactiveNavPillBg: "mint:bg-
|
|
41
|
-
paramStyle: "mint:
|
|
33
|
+
inactiveNavPillBg: "mint:bg-red-400/20 mint:dark:bg-red-400/20",
|
|
34
|
+
paramStyle: "mint:text-[#CB3A32] mint:bg-[#CB3A32]/10 mint:border-[#CB3A32]/30"
|
|
42
35
|
};
|
|
43
36
|
case "OPTIONS":
|
|
44
37
|
return {
|
|
45
38
|
activeNavPillBg: "mint:bg-[#9341FB]",
|
|
46
|
-
activeNavPillText: "mint:text-
|
|
39
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
47
40
|
inactiveNavPillText: "mint:text-purple-700 mint:dark:text-purple-400",
|
|
48
|
-
inactiveNavPillBg: "mint:bg-
|
|
49
|
-
paramStyle: "mint:
|
|
41
|
+
inactiveNavPillBg: "mint:bg-purple-400/20 mint:dark:bg-purple-400/20",
|
|
42
|
+
paramStyle: "mint:text-[#9341FB] mint:bg-[#9341FB]/10 mint:border-[#9341FB]/30"
|
|
50
43
|
};
|
|
51
44
|
case "HEAD":
|
|
52
45
|
return {
|
|
53
|
-
activeNavPillBg: "mint:bg-
|
|
54
|
-
activeNavPillText: "mint:text-
|
|
46
|
+
activeNavPillBg: "mint:bg-[#0e7490]",
|
|
47
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
55
48
|
inactiveNavPillText: "mint:text-cyan-700 mint:dark:text-cyan-400",
|
|
56
|
-
inactiveNavPillBg: "mint:bg-cyan-
|
|
57
|
-
paramStyle: "mint:
|
|
49
|
+
inactiveNavPillBg: "mint:bg-cyan-400/20 mint:dark:bg-cyan-400/20",
|
|
50
|
+
paramStyle: "mint:text-[#0e7490] mint:text-[#00d3f2] mint:bg-[#00d3f2]/10 mint:border-[#00d3f2]/30"
|
|
58
51
|
};
|
|
59
52
|
case "PATCH":
|
|
60
53
|
return {
|
|
61
54
|
activeNavPillBg: "mint:bg-[#DA622B]",
|
|
62
|
-
activeNavPillText: "mint:text-
|
|
55
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
63
56
|
inactiveNavPillText: "mint:text-orange-700 mint:dark:text-orange-400",
|
|
64
|
-
inactiveNavPillBg: "mint:bg-
|
|
65
|
-
paramStyle: "mint:
|
|
57
|
+
inactiveNavPillBg: "mint:bg-orange-400/20 mint:dark:bg-orange-400/20",
|
|
58
|
+
paramStyle: "mint:text-[#DA622B] mint:bg-[#DA622B]/10 mint:border-[#DA622B]/30"
|
|
66
59
|
};
|
|
67
60
|
case "TRACE":
|
|
68
61
|
return {
|
|
69
62
|
activeNavPillBg: "mint:bg-[#BD30D3]",
|
|
70
|
-
activeNavPillText: "mint:text-
|
|
63
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
71
64
|
inactiveNavPillText: "mint:text-fuchsia-700 mint:dark:text-fuchsia-400",
|
|
72
|
-
inactiveNavPillBg: "mint:bg-
|
|
73
|
-
paramStyle: "mint:
|
|
65
|
+
inactiveNavPillBg: "mint:bg-fuchsia-400/20 mint:dark:bg-fuchsia-400/20",
|
|
66
|
+
paramStyle: "mint:text-[#BD30D3] mint:bg-[#BD30D3]/10 mint:border-[#BD30D3]/30"
|
|
74
67
|
};
|
|
75
68
|
case "WEBSOCKET":
|
|
76
69
|
return {
|
|
77
70
|
activeNavPillBg: "mint:bg-[#F54A00] mint:dark:bg-[#FF6900]",
|
|
78
|
-
activeNavPillText: "mint:text-
|
|
71
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
79
72
|
inactiveNavPillText: "mint:text-[#F54A00] mint:dark:text-[#FF6900]",
|
|
80
73
|
inactiveNavPillBg: "mint:bg-[#FFEDD4] mint:dark:bg-[#FF6900]/20",
|
|
81
|
-
paramStyle: "mint:
|
|
74
|
+
paramStyle: "mint:text-[#F54A00] mint:bg-[#FFEDD4]/10 mint:border-[#FFEDD4]/30 mint:dark:text-[#FF6900] mint:dark:bg-[#FF6900]/10 mint:dark:border-[#FF6900]/30"
|
|
82
75
|
};
|
|
83
76
|
case "DEPRECATED":
|
|
84
77
|
return {
|
|
85
78
|
activeNavPillBg: "mint:bg-[#F7F7F8] mint:dark:bg-[#14151A]",
|
|
86
|
-
activeNavPillText: "mint:text-[#14151A] mint:dark:text-
|
|
87
|
-
inactiveNavPillText: "mint:text-[#14151A] mint:dark:text-
|
|
88
|
-
inactiveNavPillBg: "mint:bg-[#F7F7F8] mint:dark:bg-[#14151A]"
|
|
89
|
-
paramStyle: "mint:border-[#14151A] mint:dark:border-white mint:text-[#14151A] mint:dark:text-white"
|
|
79
|
+
activeNavPillText: "mint:text-[#14151A] mint:dark:text-[#FFFFFF]",
|
|
80
|
+
inactiveNavPillText: "mint:text-[#14151A] mint:dark:text-[#FFFFFF]",
|
|
81
|
+
inactiveNavPillBg: "mint:bg-[#F7F7F8] mint:dark:bg-[#14151A]"
|
|
90
82
|
};
|
|
91
83
|
default:
|
|
92
84
|
return {
|
|
93
85
|
activeNavPillBg: "mint:bg-gray-600",
|
|
94
|
-
activeNavPillText: "mint:text-
|
|
86
|
+
activeNavPillText: "mint:text-[#FFFFFF]",
|
|
95
87
|
inactiveNavPillText: "mint:text-gray-700 mint:dark:text-gray-400",
|
|
96
|
-
inactiveNavPillBg: "mint:bg-gray-
|
|
97
|
-
paramStyle: "mint:
|
|
88
|
+
inactiveNavPillBg: "mint:bg-gray-400/20 mint:dark:bg-gray-400/20",
|
|
89
|
+
paramStyle: "mint:text-gray-600 mint:bg-gray-600/10 mint:border-gray-600/30"
|
|
98
90
|
};
|
|
99
91
|
}
|
|
100
92
|
}, a = (t) => {
|
|
101
|
-
const
|
|
102
|
-
switch (
|
|
93
|
+
const i = t == null ? void 0 : t.toUpperCase();
|
|
94
|
+
switch (i) {
|
|
103
95
|
case "DELETE":
|
|
104
96
|
return "DEL";
|
|
105
97
|
case "WEBHOOK":
|
|
@@ -107,11 +99,11 @@ const i = (t) => {
|
|
|
107
99
|
case "WEBSOCKET":
|
|
108
100
|
return "WSS";
|
|
109
101
|
default:
|
|
110
|
-
return
|
|
102
|
+
return i;
|
|
111
103
|
}
|
|
112
104
|
};
|
|
113
105
|
export {
|
|
114
|
-
|
|
106
|
+
e as getMethodColor,
|
|
115
107
|
a as getShortenedMethodName
|
|
116
108
|
};
|
|
117
109
|
//# sourceMappingURL=colors.js.map
|