@mintlify/msft-sdk 1.1.66 → 1.1.68

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,36 +1,34 @@
1
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";
2
+ import { useContext as f, useState as x, useMemo as u } from "react";
3
3
  import { useDebouncedApiPlaygroundInputs as d } from "./hooks/usePlaygroundInputsStore.js";
4
- import { CodeExampleLabelContext as E } from "../contexts/CodeExampleLabelContext.js";
4
+ import { CodeExampleLabelContext as h } from "../contexts/CodeExampleLabelContext.js";
5
5
  import { ApiReferenceContext2 as g } from "../contexts/ConfigContext.js";
6
- import D from "../components/Api/ErrorBoundary.js";
7
- import { clsx as h } from "clsx";
8
- import { RequestExample as R } from "./components/Example/RequestExample.js";
9
- import { ResponseExample as A } from "./components/Example/ResponseExample.js";
10
- import { initialApiPlaygroundInputs as C } from "./constants/index.js";
11
- const j = ({ className: o, isModal: i = !1, apiReferenceData: a, noInputs: n = !1 }) => {
12
- const { apiReferenceData2: m } = x(g), t = a || m, r = d(100), [p, l] = f();
13
- console.log("[DEBUG] ApiExamples - Props apiReferenceData:", a), console.log("[DEBUG] ApiExamples - Context apiReferenceData2FromContext:", m), console.log("[DEBUG] ApiExamples - Final apiReferenceData2:", t), console.log("[DEBUG] ApiExamples - noInputs:", n), console.log("[DEBUG] ApiExamples - isModal:", i);
14
- const s = u(
15
- () => h(
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
+ import { initialApiPlaygroundInputs as E } from "./constants/index.js";
11
+ const q = ({ className: t, isModal: r = !1, apiReferenceData: m, noInputs: n = !1 }) => {
12
+ const { apiReferenceData2: a } = f(g), i = m || a, o = d(100), [p, s] = x(), l = u(
13
+ () => v(
16
14
  "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]",
17
- o
15
+ t
18
16
  ),
19
- [o, i]
17
+ [t, r]
20
18
  );
21
- return /* @__PURE__ */ e(E.Provider, { value: { selectedLabel: p, setSelectedLabel: l }, children: /* @__PURE__ */ e("div", { className: s, children: /* @__PURE__ */ c(D, { children: [
19
+ return /* @__PURE__ */ e(h.Provider, { value: { selectedLabel: p, setSelectedLabel: s }, children: /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ c(R, { children: [
22
20
  /* @__PURE__ */ e(
23
- R,
21
+ C,
24
22
  {
25
- apiReferenceData: t,
26
- inputs: n ? C : r,
23
+ apiReferenceData: i,
24
+ inputs: n ? E : o,
27
25
  maxHeight: "mint:max-h-[40vh]"
28
26
  }
29
27
  ),
30
- /* @__PURE__ */ e(A, { apiReferenceData: t, maxHeight: "mint:max-h-[40vh]" })
28
+ /* @__PURE__ */ e(D, { apiReferenceData: i, maxHeight: "mint:max-h-[40vh]" })
31
29
  ] }) }) });
32
30
  };
33
31
  export {
34
- j as ApiExamples,
35
- j as default
32
+ q as ApiExamples,
33
+ q as default
36
34
  };
@@ -1,146 +1,145 @@
1
- import { jsx as h } from "react/jsx-runtime";
2
- import { useState as j, useEffect as V } from "react";
3
- import { generateRequest as S } from "../../generators/generateRequest.js";
4
- import { generateSnippet as T } from "../../generators/generateSnippet.js";
5
- import { getFirstExampleValue as g } from "../../schemaGraph/processExamples.js";
6
- import { CodeGroupSelect as k } from "../../../components/content-components/CodeGroupSelect/index.js";
7
- import { CodeSnippets as w } from "../../../components/content-components/code-snippets.js";
8
- import { langToPresetMap as C } from "../../../constants/snippetPresets.js";
9
- const z = ({
10
- baseUrl: r,
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useState as V, useEffect as B } from "react";
3
+ import { generateRequest as w } from "../../generators/generateRequest.js";
4
+ import { generateSnippet as x } from "../../generators/generateSnippet.js";
5
+ import { getFirstExampleValue as C } from "../../schemaGraph/processExamples.js";
6
+ import { CodeGroupSelect as G } from "../../../components/content-components/CodeGroupSelect/index.js";
7
+ import { CodeSnippets as P } from "../../../components/content-components/code-snippets.js";
8
+ import { langToPresetMap as b } from "../../../constants/snippetPresets.js";
9
+ const X = ({
10
+ baseUrl: s,
11
11
  apiReferenceData: t,
12
- inputs: e,
13
- requestExampleLanguages: n,
14
- requiredOnly: p,
15
- maxHeight: o,
16
- selectedSecurityOptionIndex: c,
17
- selectedRequestBodyContentTypeIndex: l
12
+ inputs: o,
13
+ requestExampleLanguages: c,
14
+ requiredOnly: n,
15
+ maxHeight: r,
16
+ selectedSecurityOptionIndex: f,
17
+ selectedRequestBodyContentTypeIndex: p
18
18
  }) => {
19
- var u, s, G;
20
- console.log("[DEBUG] GeneratedRequestExample - baseUrl:", r), console.log("[DEBUG] GeneratedRequestExample - apiReferenceData:", t), console.log("[DEBUG] GeneratedRequestExample - requestExampleLanguages:", n);
21
- const m = (u = t.dependencies) == null ? void 0 : u.requestBody;
19
+ var l, e, j;
20
+ const m = (l = t.dependencies) == null ? void 0 : l.requestBody;
22
21
  if (!m)
23
- return console.log("[DEBUG] GeneratedRequestExample - No requestBody, using SingleRequest"), /* @__PURE__ */ h(
24
- q,
22
+ return /* @__PURE__ */ a(
23
+ k,
25
24
  {
26
25
  apiReferenceData: t,
27
- baseUrl: r,
28
- inputs: e,
29
- requestExampleLanguages: n,
30
- requiredOnly: p,
31
- maxHeight: o,
32
- selectedSecurityOptionIndex: c
26
+ baseUrl: s,
27
+ inputs: o,
28
+ requestExampleLanguages: c,
29
+ requiredOnly: n,
30
+ maxHeight: r,
31
+ selectedSecurityOptionIndex: f
33
32
  }
34
33
  );
35
- const i = g(
34
+ const i = C(
36
35
  m.content,
37
- l
36
+ p
38
37
  );
39
38
  if (!i) return null;
40
- const a = Object.entries(m.content).map(
41
- ([B, x]) => ({
42
- contentType: B,
43
- examples: x.examples
39
+ const h = Object.entries(m.content).map(
40
+ ([S, T]) => ({
41
+ contentType: S,
42
+ examples: T.examples
44
43
  })
45
- ), E = (s = a[l]) == null ? void 0 : s.examples, f = (G = a[l]) == null ? void 0 : G.contentType;
46
- return Object.keys(E).length > 1 ? /* @__PURE__ */ h(
47
- N,
44
+ ), M = (e = h[p]) == null ? void 0 : e.examples, u = (j = h[p]) == null ? void 0 : j.contentType;
45
+ return Object.keys(M).length > 1 ? /* @__PURE__ */ a(
46
+ v,
48
47
  {
49
48
  apiReferenceData: t,
50
- selectedBodyContentType: f,
51
- baseUrl: r,
52
- inputs: e,
53
- examples: E,
54
- requiredOnly: p,
55
- maxHeight: o,
56
- selectedSecurityOptionIndex: c
49
+ selectedBodyContentType: u,
50
+ baseUrl: s,
51
+ inputs: o,
52
+ examples: M,
53
+ requiredOnly: n,
54
+ maxHeight: r,
55
+ selectedSecurityOptionIndex: f
57
56
  }
58
- ) : /* @__PURE__ */ h(
59
- q,
57
+ ) : /* @__PURE__ */ a(
58
+ k,
60
59
  {
61
60
  apiReferenceData: t,
62
- selectedBodyContentType: f,
63
- baseUrl: r,
64
- inputs: e,
61
+ selectedBodyContentType: u,
62
+ baseUrl: s,
63
+ inputs: o,
65
64
  exampleValue: i,
66
- requestExampleLanguages: n,
67
- requiredOnly: p,
68
- maxHeight: o,
69
- selectedSecurityOptionIndex: c
65
+ requestExampleLanguages: c,
66
+ requiredOnly: n,
67
+ maxHeight: r,
68
+ selectedSecurityOptionIndex: f
70
69
  }
71
70
  );
72
- }, q = ({
73
- baseUrl: r,
71
+ }, k = ({
72
+ baseUrl: s,
74
73
  apiReferenceData: t,
75
- inputs: e,
76
- selectedBodyContentType: n,
77
- exampleValue: p,
78
- requestExampleLanguages: o,
79
- requiredOnly: c,
80
- maxHeight: l,
74
+ inputs: o,
75
+ selectedBodyContentType: c,
76
+ exampleValue: n,
77
+ requestExampleLanguages: r,
78
+ requiredOnly: f,
79
+ maxHeight: p,
81
80
  selectedSecurityOptionIndex: m
82
81
  }) => {
83
- const i = S({
84
- baseUrl: r,
82
+ const i = w({
83
+ baseUrl: s,
85
84
  apiReferenceData: t,
86
- inputs: e,
87
- selectedBodyContentType: n,
88
- exampleData: p,
89
- requiredOnly: c,
85
+ inputs: o,
86
+ selectedBodyContentType: c,
87
+ exampleData: n,
88
+ requiredOnly: f,
90
89
  selectedSecurityOptionIndex: m
91
- }), a = o == null ? void 0 : o.reduce((f, u) => {
92
- const s = C[u];
93
- return s && f.push(s), f;
94
- }, []), E = T({
90
+ }), h = r == null ? void 0 : r.reduce((u, l) => {
91
+ const e = b[l];
92
+ return e && u.push(e), u;
93
+ }, []), M = x({
95
94
  apiReferenceData: t,
96
- pathInputs: e.path,
95
+ pathInputs: o.path,
97
96
  request: i,
98
- snippetPresets: a
97
+ snippetPresets: h
99
98
  });
100
- return /* @__PURE__ */ h(w, { snippets: E, dropdown: !0, maxHeight: l, showCopyButton: !1, noMargins: !0 });
101
- }, N = ({
102
- baseUrl: r,
99
+ return /* @__PURE__ */ a(P, { snippets: M, dropdown: !0, maxHeight: p, showCopyButton: !1, noMargins: !0 });
100
+ }, v = ({
101
+ baseUrl: s,
103
102
  apiReferenceData: t,
104
- inputs: e,
105
- selectedBodyContentType: n,
106
- examples: p,
107
- requiredOnly: o,
108
- maxHeight: c,
109
- selectedSecurityOptionIndex: l
103
+ inputs: o,
104
+ selectedBodyContentType: c,
105
+ examples: n,
106
+ requiredOnly: r,
107
+ maxHeight: f,
108
+ selectedSecurityOptionIndex: p
110
109
  }) => {
111
- const [m, i] = j({}), [a, E] = j(null);
112
- return V(() => {
113
- const f = e.path, u = {};
110
+ const [m, i] = V({}), [h, M] = V(null);
111
+ return B(() => {
112
+ const u = o.path, l = {};
114
113
  try {
115
- for (const [s, { value: G }] of Object.entries(p)) {
116
- if (!G) continue;
117
- const B = S({
118
- baseUrl: r,
114
+ for (const [e, { value: j }] of Object.entries(n)) {
115
+ if (!j) continue;
116
+ const S = w({
117
+ baseUrl: s,
119
118
  apiReferenceData: t,
120
- inputs: e,
121
- selectedBodyContentType: n,
122
- exampleData: G,
123
- requiredOnly: o,
124
- selectedSecurityOptionIndex: l
119
+ inputs: o,
120
+ selectedBodyContentType: c,
121
+ exampleData: j,
122
+ requiredOnly: r,
123
+ selectedSecurityOptionIndex: p
125
124
  });
126
- T({
125
+ x({
127
126
  apiReferenceData: t,
128
- pathInputs: f,
129
- request: B,
127
+ pathInputs: u,
128
+ request: S,
130
129
  isMultipleRequest: !0
131
- }).forEach((M) => {
132
- u[M.filename] = {
133
- ...u[M.filename],
134
- [s]: M
130
+ }).forEach((E) => {
131
+ l[E.filename] = {
132
+ ...l[E.filename],
133
+ [e]: E
135
134
  };
136
135
  });
137
136
  }
138
- i(u);
139
- } catch (s) {
140
- console.error(s), E(s);
137
+ i(l);
138
+ } catch (e) {
139
+ console.error(e), M(e);
141
140
  }
142
- }, [r, t, e, n, p, o, l]), a || Object.keys(m).length === 0 ? null : /* @__PURE__ */ h(k, { snippets: m, maxHeight: c });
141
+ }, [s, t, o, c, n, r, p]), h || Object.keys(m).length === 0 ? null : /* @__PURE__ */ a(G, { snippets: m, maxHeight: f });
143
142
  };
144
143
  export {
145
- z as GeneratedRequestExample
144
+ X as GeneratedRequestExample
146
145
  };
@@ -1,32 +1,32 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { memo as O } from "react";
3
- import { initialApiPlaygroundInputs as T } from "../../constants/index.js";
4
- import { generateSnippetMap as j } from "../../generators/generateSnippetMap.js";
5
- import { useSelectedBaseUrl as w } from "../../hooks/useSelectedBaseUrl.js";
6
- import { useSelectedRequestBodyContentType as G } from "../../hooks/useSelectedRequestBodyContentType.js";
7
- import { useSelectedSecurityOption as L } from "../../hooks/useSelectedSecurityOption.js";
8
- import { CodeGroupSelect as U } from "../../../components/content-components/CodeGroupSelect/index.js";
9
- import { CodeSnippet as k } from "../../../components/content-components/code-snippet.js";
10
- import { CodeSnippets as P } from "../../../components/content-components/code-snippets.js";
11
- import { CodeBlock as b } from "../../../components/content-components/code-block.js";
12
- import { CodeGroup as h } from "../../../components/content-components/code-group.js";
13
- import { shikiLangToDisplayLang as v } from "../../../constants/snippetPresets.js";
3
+ import { initialApiPlaygroundInputs as j } from "../../constants/index.js";
4
+ import { generateSnippetMap as w } from "../../generators/generateSnippetMap.js";
5
+ import { useSelectedBaseUrl as B } from "../../hooks/useSelectedBaseUrl.js";
6
+ import { useSelectedRequestBodyContentType as L } from "../../hooks/useSelectedRequestBodyContentType.js";
7
+ import { useSelectedSecurityOption as T } from "../../hooks/useSelectedSecurityOption.js";
8
+ import { CodeGroupSelect as k } from "../../../components/content-components/CodeGroupSelect/index.js";
9
+ import { CodeSnippet as P } from "../../../components/content-components/code-snippet.js";
10
+ import { CodeSnippets as v } from "../../../components/content-components/code-snippets.js";
11
+ import { CodeBlock as h } from "../../../components/content-components/code-block.js";
12
+ import { CodeGroup as b } from "../../../components/content-components/code-group.js";
13
+ import { shikiLangToDisplayLang as G } from "../../../constants/snippetPresets.js";
14
14
  import { useApiPlaygroundDisplay as I } from "../../../hooks/useApiPlaygroundDisplay.js";
15
- import { GeneratedRequestExample as B } from "./GeneratedRequestExample.js";
15
+ import { GeneratedRequestExample as E } from "./GeneratedRequestExample.js";
16
16
  const N = O(
17
17
  ({
18
18
  apiReferenceData: e,
19
- inputs: p = T,
20
- maxHeight: u
19
+ inputs: u = j,
20
+ maxHeight: i
21
21
  }) => {
22
- var g, y, f, S, q, E, x;
23
- const n = (g = e.operation) == null ? void 0 : g.requestExamples, { selectedRequestBodyContentTypeIndex: a } = G(), { selectedSecurityOptionIndex: i } = L(), M = I(), m = (y = e.operation) == null ? void 0 : y.requestExampleLanguages, d = (f = e.operation) == null ? void 0 : f.requiredOnlyExamples, { baseUrl: s } = w();
24
- switch (console.log("[DEBUG] RequestExample - requestExampleType:", (S = e.operation) == null ? void 0 : S.requestExampleType), console.log("[DEBUG] RequestExample - baseUrl:", s), console.log("[DEBUG] RequestExample - apiReferenceData.operation:", e.operation), (q = e.operation) == null ? void 0 : q.requestExampleType) {
22
+ var g, f, y, S, q, x;
23
+ const n = (g = e.operation) == null ? void 0 : g.requestExamples, { selectedRequestBodyContentTypeIndex: p } = L(), { selectedSecurityOptionIndex: a } = T(), M = I(), m = (f = e.operation) == null ? void 0 : f.requestExampleLanguages, d = (y = e.operation) == null ? void 0 : y.requiredOnlyExamples, { baseUrl: s } = B();
24
+ switch ((S = e.operation) == null ? void 0 : S.requestExampleType) {
25
25
  case "mdx":
26
26
  if (!n) return null;
27
27
  const C = n.some((o) => o.dropdown ?? !1);
28
- return /* @__PURE__ */ r(h, { isSmallText: !0, dropdown: C, noMargins: !0, className: u, children: n.map((o, t) => /* @__PURE__ */ r(
29
- b,
28
+ return /* @__PURE__ */ r(b, { isSmallText: !0, dropdown: C, noMargins: !0, className: i, children: n.map((o, t) => /* @__PURE__ */ r(
29
+ h,
30
30
  {
31
31
  language: o.language,
32
32
  fileName: o.filename,
@@ -35,54 +35,54 @@ const N = O(
35
35
  `${o.filename}-${o.language}-${t}`
36
36
  )) });
37
37
  case "webhook":
38
- return (E = n == null ? void 0 : n[0]) != null && E.code ? /* @__PURE__ */ r(h, { isSmallText: !0, noMargins: !0, hideCodeSnippetFeedbackButton: !0, children: /* @__PURE__ */ r(b, { language: "json", filename: "Example Request Body", children: /* @__PURE__ */ r(k, { language: "json", children: (x = n[0]) == null ? void 0 : x.code }) }) }) : null;
38
+ return (q = n == null ? void 0 : n[0]) != null && q.code ? /* @__PURE__ */ r(b, { isSmallText: !0, noMargins: !0, hideCodeSnippetFeedbackButton: !0, children: /* @__PURE__ */ r(h, { language: "json", filename: "Example Request Body", children: /* @__PURE__ */ r(P, { language: "json", children: (x = n[0]) == null ? void 0 : x.code }) }) }) : null;
39
39
  case "codeSamples":
40
40
  if (!e.operation.codeSamples) return null;
41
- const c = j({
41
+ const c = w({
42
42
  apiReferenceData: e,
43
43
  codeSamples: e.operation.codeSamples,
44
44
  baseUrl: s,
45
45
  apiPlaygroundMode: M,
46
46
  requestExampleLanguages: m,
47
47
  requiredOnly: d,
48
- inputs: p,
49
- selectedSecurityOptionIndex: i,
50
- selectedRequestBodyContentTypeIndex: a
48
+ inputs: u,
49
+ selectedSecurityOptionIndex: a,
50
+ selectedRequestBodyContentTypeIndex: p
51
51
  });
52
52
  if (Object.values(c).every((o) => Object.keys(o).length <= 1)) {
53
53
  let t = Object.values(c).flatMap((l) => Object.values(l));
54
54
  return new Set(t.map((l) => l.filename)).size !== t.length && (t = t.map((l) => ({
55
55
  ...l,
56
- filename: v[l.language] ?? l.language
57
- }))), /* @__PURE__ */ r(P, { snippets: t, noMargins: !0, dropdown: !0 });
56
+ filename: G[l.language] ?? l.language
57
+ }))), /* @__PURE__ */ r(v, { snippets: t, noMargins: !0, dropdown: !0 });
58
58
  }
59
- return /* @__PURE__ */ r(U, { snippets: c });
59
+ return /* @__PURE__ */ r(k, { snippets: c });
60
60
  case "generated":
61
61
  return s ? /* @__PURE__ */ r(
62
- B,
62
+ E,
63
63
  {
64
64
  apiReferenceData: e,
65
65
  baseUrl: s,
66
- inputs: p,
67
- selectedSecurityOptionIndex: i,
66
+ inputs: u,
67
+ selectedSecurityOptionIndex: a,
68
68
  requestExampleLanguages: m,
69
69
  requiredOnly: d,
70
- selectedRequestBodyContentTypeIndex: a,
71
- maxHeight: u
70
+ selectedRequestBodyContentTypeIndex: p,
71
+ maxHeight: i
72
72
  }
73
73
  ) : null;
74
74
  case "examples":
75
75
  return !e.operation.prefillPlaygroundExamples || !s ? null : /* @__PURE__ */ r(
76
- B,
76
+ E,
77
77
  {
78
78
  apiReferenceData: e,
79
79
  baseUrl: s,
80
- inputs: p,
81
- selectedSecurityOptionIndex: i,
80
+ inputs: u,
81
+ selectedSecurityOptionIndex: a,
82
82
  requestExampleLanguages: m,
83
83
  requiredOnly: d,
84
- selectedRequestBodyContentTypeIndex: a,
85
- maxHeight: u
84
+ selectedRequestBodyContentTypeIndex: p,
85
+ maxHeight: i
86
86
  }
87
87
  );
88
88
  default: