@mintlify/msft-sdk 1.1.62 → 1.1.63

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.
Files changed (166) hide show
  1. package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +6 -5
  2. package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +13 -12
  3. package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +8 -7
  4. package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +3 -2
  5. package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +9 -8
  6. package/dist/api-playground/ApiPlayground/Response/index.js +4 -3
  7. package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +42 -21
  8. package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +13 -9
  9. package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +6 -5
  10. package/dist/api-playground/ApiPlayground/components/SendPill.js +3 -2
  11. package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +6 -5
  12. package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +3 -2
  13. package/dist/api-playground/EndpointFields/components/Description.js +6 -5
  14. package/dist/api-playground/EndpointFields/components/OptionDropdown.js +9 -8
  15. package/dist/api-playground/EndpointFields/components/SectionHeading.js +8 -7
  16. package/dist/api-playground-2/ApiExamples.js +19 -20
  17. package/dist/api-playground-2/ApiFields.js +20 -247
  18. package/dist/api-playground-2/EndpointHeader.js +59 -47
  19. package/dist/api-playground-2/OperationPage.js +70 -66
  20. package/dist/api-playground-2/Playground.js +67 -83
  21. package/dist/api-playground-2/SchemaPage.js +22 -9
  22. package/dist/api-playground-2/components/EndpointFields/Body.js +40 -0
  23. package/dist/api-playground-2/components/EndpointFields/Parameters.js +90 -0
  24. package/dist/api-playground-2/components/EndpointFields/Response.js +146 -0
  25. package/dist/api-playground-2/components/EndpointFields/Security.js +88 -0
  26. package/dist/api-playground-2/components/EndpointFields/fields/ArrayParamField.js +93 -0
  27. package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +29 -11
  28. package/dist/api-playground-2/components/EndpointFields/fields/ObjectParamField.js +145 -0
  29. package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +60 -48
  30. package/dist/api-playground-2/components/EndpointFields/fields/SchemaField.js +230 -0
  31. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +93 -89
  32. package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +18 -17
  33. package/dist/api-playground-2/components/Example/RequestExample.js +92 -93
  34. package/dist/api-playground-2/components/Example/ResponseExample.js +19 -15
  35. package/dist/api-playground-2/components/Request/ParameterSection.js +20 -18
  36. package/dist/api-playground-2/components/Request/SecuritySection.js +53 -43
  37. package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +89 -40
  38. package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +12 -12
  39. package/dist/api-playground-2/components/Request/inputs/FileInput.js +16 -15
  40. package/dist/api-playground-2/components/Request/inputs/InputContainer.js +76 -57
  41. package/dist/api-playground-2/components/Request/inputs/NumberInput.js +10 -9
  42. package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +98 -80
  43. package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +55 -47
  44. package/dist/api-playground-2/components/Request/inputs/SelectInput.js +18 -17
  45. package/dist/api-playground-2/components/Request/inputs/StringInput.js +19 -18
  46. package/dist/api-playground-2/components/Request/inputs/TextInput.js +12 -11
  47. package/dist/api-playground-2/components/SendPillWrapper.js +35 -0
  48. package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +3 -5
  49. package/dist/api-playground-2/generators/createCookies.js +23 -0
  50. package/dist/api-playground-2/generators/createHeaders.js +53 -36
  51. package/dist/api-playground-2/generators/createQueryString.js +30 -0
  52. package/dist/api-playground-2/generators/generateAuthPlaceholder.js +14 -0
  53. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +27 -25
  54. package/dist/api-playground-2/generators/generateRequest.js +47 -51
  55. package/dist/api-playground-2/generators/generateResponseExampleMap.js +15 -11
  56. package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
  57. package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +11 -11
  58. package/dist/api-playground-2/hooks/useInitializeInputs.js +185 -88
  59. package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +70 -25
  60. package/dist/api-playground-2/hooks/useSelectedBaseUrl.js +13 -0
  61. package/dist/api-playground-2/hooks/useSelectedExample.js +10 -0
  62. package/dist/api-playground-2/hooks/useSelectedRequestBodyContentType.js +12 -0
  63. package/dist/api-playground-2/hooks/useSelectedResponseContentType.js +12 -0
  64. package/dist/api-playground-2/hooks/useSelectedSecurityOption.js +31 -0
  65. package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +114 -101
  66. package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +23 -32
  67. package/dist/api-playground-2/schemaGraph/addTypeLabelsToSchema.js +50 -0
  68. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +40 -24
  69. package/dist/api-playground-2/schemaGraph/getExampleBodyInputs.js +94 -0
  70. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +56 -50
  71. package/dist/api-playground-2/schemaGraph/processExamples.js +117 -52
  72. package/dist/api-playground-2/schemaGraph/processSchema.js +10 -0
  73. package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +58 -28
  74. package/dist/api-playground-2/schemaGraph/reduceCompositions.js +220 -181
  75. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +128 -89
  76. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +15 -16
  77. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +14 -12
  78. package/dist/api-playground-2/schemaGraph/utils.js +185 -147
  79. package/dist/common/guards.js +11 -19
  80. package/dist/components/Api/Expandable.js +10 -9
  81. package/dist/components/Api/Param.js +11 -13
  82. package/dist/components/Api/dropdown-menu.js +10 -9
  83. package/dist/components/content-components/code-group.js +4 -4
  84. package/dist/contexts/EndpointLocationContext.js +3 -3
  85. package/dist/hooks/useApiParamFieldOption.js +10 -0
  86. package/dist/hooks/useEndpoint.js +3 -3
  87. package/dist/hooks/useKeyboardShortcut.js +13 -13
  88. package/dist/hooks/useSendPlaygroundRequest.js +14 -146
  89. package/dist/index.d.ts +65 -58
  90. package/dist/index.js +109 -111
  91. package/dist/openapi/generateTypeStringFromSchema.js +2 -31
  92. package/dist/styles.css +1 -1
  93. package/package.json +1 -1
  94. package/dist/api-playground/ApiPlayground/Request/BodySection.js +0 -64
  95. package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +0 -32
  96. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +0 -201
  97. package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +0 -146
  98. package/dist/api-playground/ApiPlayground/Request/ServerSection.js +0 -30
  99. package/dist/api-playground/ApiPlayground/Request/index.js +0 -43
  100. package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +0 -93
  101. package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +0 -90
  102. package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +0 -62
  103. package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +0 -33
  104. package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +0 -61
  105. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +0 -109
  106. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +0 -87
  107. package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +0 -61
  108. package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +0 -54
  109. package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +0 -67
  110. package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +0 -44
  111. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +0 -42
  112. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +0 -43
  113. package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +0 -38
  114. package/dist/api-playground/ApiPlayground/components/InputContainer.js +0 -128
  115. package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +0 -59
  116. package/dist/api-playground/ApiPlayground/components/PathHeader.js +0 -162
  117. package/dist/api-playground/ApiPlayground/components/TrashButton.js +0 -26
  118. package/dist/api-playground/ApiPlayground/index.js +0 -67
  119. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +0 -19
  120. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +0 -18
  121. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +0 -28
  122. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +0 -5
  123. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +0 -13
  124. package/dist/api-playground/EndpointFields/index.js +0 -7
  125. package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +0 -87
  126. package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +0 -89
  127. package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +0 -121
  128. package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +0 -74
  129. package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +0 -252
  130. package/dist/common/potentiallyParseOpenApiString.js +0 -24
  131. package/dist/common/replaceSlashIndex.js +0 -6
  132. package/dist/common/slugToTitle.js +0 -10
  133. package/dist/constants/prism-languages.js +0 -19
  134. package/dist/contexts/ApiPlaygroundInputsContext.js +0 -17
  135. package/dist/contexts/MDXContentContext.js +0 -17
  136. package/dist/hooks/useApiPlaygroundInputs.js +0 -6
  137. package/dist/hooks/useApiPlaygroundPrefillExamples.js +0 -39
  138. package/dist/hooks/useBaseUrlOptions.js +0 -18
  139. package/dist/hooks/useComponentSchemas.js +0 -9
  140. package/dist/hooks/useGenerateNextAdditionalProperties.js +0 -11
  141. package/dist/hooks/useGenerateNextItems.js +0 -11
  142. package/dist/hooks/useGenerateNextProperties.js +0 -11
  143. package/dist/hooks/useMDXContent.js +0 -6
  144. package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +0 -9
  145. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +0 -15
  146. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +0 -15
  147. package/dist/hooks/usePlaygroundSchemaOptions.js +0 -42
  148. package/dist/hooks/usePrefilledInputs/index.js +0 -65
  149. package/dist/hooks/usePrefilledInputs/storedServerVariables.js +0 -29
  150. package/dist/hooks/useSecurityOption.js +0 -10
  151. package/dist/hooks/useSetDefaultValue.js +0 -63
  152. package/dist/openapi/filterEnums.js +0 -20
  153. package/dist/openapi/generateNextAdditionalProperties.js +0 -7
  154. package/dist/openapi/generateNextItems.js +0 -7
  155. package/dist/openapi/generateNextProperties.js +0 -23
  156. package/dist/openapi/generateOptionLabels.js +0 -20
  157. package/dist/openapi/generateSimpleLabels.js +0 -4
  158. package/dist/openapi/getAuthFilteredSchemaArray.js +0 -18
  159. package/dist/paths/isEqualIgnoringLeadingSlash.js +0 -21
  160. package/dist/paths/optionallyRemoveLeadingSlash.js +0 -6
  161. package/dist/paths/optionallyRemoveTrailingSlash.js +0 -6
  162. package/dist/utils/api-playground/defaults.js +0 -15
  163. package/dist/utils/api-playground/paramFieldDefaults.js +0 -10
  164. package/dist/utils/api-reference/getFilteredSecurityOptions.js +0 -4
  165. package/dist/utils/api-reference/getNextPropertiesByType.js +0 -5
  166. package/dist/utils/flattenObject.js +0 -10
@@ -1,141 +1,145 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- import { useState as B, useEffect as E } from "react";
3
- import { generateRequest as j } from "../../generators/generateRequest.js";
4
- import { generateSnippet as S } from "../../generators/generateSnippet.js";
5
- import { getFirstExampleValue as V } from "../../schemaGraph/processExamples.js";
6
- import { CodeGroupSelect as w } 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 J = ({
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
10
  baseUrl: s,
11
11
  apiReferenceData: t,
12
- inputs: e,
13
- requestExampleLanguages: u,
14
- requiredOnly: r,
15
- maxHeight: o,
16
- selectedSecurityOptionIndex: f
12
+ inputs: o,
13
+ requestExampleLanguages: c,
14
+ requiredOnly: n,
15
+ maxHeight: r,
16
+ selectedSecurityOptionIndex: f,
17
+ selectedRequestBodyContentTypeIndex: p
17
18
  }) => {
18
- var T, h, c, n, x;
19
- const p = (T = t.dependencies) == null ? void 0 : T.requestBody;
20
- if (!p)
21
- return /* @__PURE__ */ y(
22
- a,
19
+ var l, e, j;
20
+ const m = (l = t.dependencies) == null ? void 0 : l.requestBody;
21
+ if (!m)
22
+ return /* @__PURE__ */ a(
23
+ k,
23
24
  {
24
25
  apiReferenceData: t,
25
26
  baseUrl: s,
26
- inputs: e,
27
- requestExampleLanguages: u,
28
- requiredOnly: r,
29
- maxHeight: o,
27
+ inputs: o,
28
+ requestExampleLanguages: c,
29
+ requiredOnly: n,
30
+ maxHeight: r,
30
31
  selectedSecurityOptionIndex: f
31
32
  }
32
33
  );
33
- const i = V(p.content);
34
+ const i = C(
35
+ m.content,
36
+ p
37
+ );
34
38
  if (!i) return null;
35
- const m = Object.entries(p.content).map(
36
- ([C, d]) => ({
37
- contentType: C,
38
- examples: d.examples
39
+ const h = Object.entries(m.content).map(
40
+ ([S, T]) => ({
41
+ contentType: S,
42
+ examples: T.examples
39
43
  })
40
- ), l = 0;
41
- return ((h = m[l]) == null ? void 0 : h.examples.length) > 1 ? /* @__PURE__ */ y(
42
- k,
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,
43
47
  {
44
48
  apiReferenceData: t,
45
- selectedBodyContentType: (c = m[l]) == null ? void 0 : c.contentType,
49
+ selectedBodyContentType: u,
46
50
  baseUrl: s,
47
- inputs: e,
48
- examples: (n = m[l]) == null ? void 0 : n.examples,
49
- requiredOnly: r,
50
- maxHeight: o,
51
+ inputs: o,
52
+ examples: M,
53
+ requiredOnly: n,
54
+ maxHeight: r,
51
55
  selectedSecurityOptionIndex: f
52
56
  }
53
- ) : /* @__PURE__ */ y(
54
- a,
57
+ ) : /* @__PURE__ */ a(
58
+ k,
55
59
  {
56
60
  apiReferenceData: t,
57
- selectedBodyContentType: (x = m[l]) == null ? void 0 : x.contentType,
61
+ selectedBodyContentType: u,
58
62
  baseUrl: s,
59
- inputs: e,
63
+ inputs: o,
60
64
  exampleValue: i,
61
- requestExampleLanguages: u,
62
- requiredOnly: r,
63
- maxHeight: o,
65
+ requestExampleLanguages: c,
66
+ requiredOnly: n,
67
+ maxHeight: r,
64
68
  selectedSecurityOptionIndex: f
65
69
  }
66
70
  );
67
- }, a = ({
71
+ }, k = ({
68
72
  baseUrl: s,
69
73
  apiReferenceData: t,
70
- inputs: e,
71
- selectedBodyContentType: u,
72
- exampleValue: r,
73
- requestExampleLanguages: o,
74
+ inputs: o,
75
+ selectedBodyContentType: c,
76
+ exampleValue: n,
77
+ requestExampleLanguages: r,
74
78
  requiredOnly: f,
75
79
  maxHeight: p,
76
- selectedSecurityOptionIndex: i
80
+ selectedSecurityOptionIndex: m
77
81
  }) => {
78
- const m = j({
82
+ const i = w({
79
83
  baseUrl: s,
80
84
  apiReferenceData: t,
81
- inputs: e,
82
- selectedBodyContentType: u,
83
- exampleData: r,
85
+ inputs: o,
86
+ selectedBodyContentType: c,
87
+ exampleData: n,
84
88
  requiredOnly: f,
85
- selectedSecurityOptionIndex: i
86
- }), l = o == null ? void 0 : o.reduce((h, c) => {
87
- const n = P[c];
88
- return n && h.push(n), h;
89
- }, []), T = S({
89
+ selectedSecurityOptionIndex: m
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({
90
94
  apiReferenceData: t,
91
- pathInputs: e.path,
92
- request: m,
93
- snippetPresets: l
95
+ pathInputs: o.path,
96
+ request: i,
97
+ snippetPresets: h
94
98
  });
95
- return /* @__PURE__ */ y(G, { snippets: T, dropdown: !0, maxHeight: p, showCopyButton: !1 });
96
- }, k = ({
99
+ return /* @__PURE__ */ a(P, { snippets: M, dropdown: !0, maxHeight: p, showCopyButton: !1, noMargins: !0 });
100
+ }, v = ({
97
101
  baseUrl: s,
98
102
  apiReferenceData: t,
99
- inputs: e,
100
- selectedBodyContentType: u,
101
- examples: r,
102
- requiredOnly: o,
103
+ inputs: o,
104
+ selectedBodyContentType: c,
105
+ examples: n,
106
+ requiredOnly: r,
103
107
  maxHeight: f,
104
108
  selectedSecurityOptionIndex: p
105
109
  }) => {
106
- const [i, m] = B({}), [l, T] = B(null);
107
- return E(() => {
108
- const h = e.path, c = {};
110
+ const [m, i] = V({}), [h, M] = V(null);
111
+ return B(() => {
112
+ const u = o.path, l = {};
109
113
  try {
110
- for (const [n, { value: x }] of Object.entries(r)) {
111
- if (!x) continue;
112
- const C = j({
114
+ for (const [e, { value: j }] of Object.entries(n)) {
115
+ if (!j) continue;
116
+ const S = w({
113
117
  baseUrl: s,
114
118
  apiReferenceData: t,
115
- inputs: e,
116
- selectedBodyContentType: u,
117
- exampleData: x,
118
- requiredOnly: o,
119
+ inputs: o,
120
+ selectedBodyContentType: c,
121
+ exampleData: j,
122
+ requiredOnly: r,
119
123
  selectedSecurityOptionIndex: p
120
124
  });
121
- S({
125
+ x({
122
126
  apiReferenceData: t,
123
- pathInputs: h,
124
- request: C,
127
+ pathInputs: u,
128
+ request: S,
125
129
  isMultipleRequest: !0
126
- }).forEach((M) => {
127
- c[M.filename] = {
128
- ...c[M.filename],
129
- [n]: M
130
+ }).forEach((E) => {
131
+ l[E.filename] = {
132
+ ...l[E.filename],
133
+ [e]: E
130
134
  };
131
135
  });
132
136
  }
133
- m(c);
134
- } catch (n) {
135
- console.error(n), T(n);
137
+ i(l);
138
+ } catch (e) {
139
+ console.error(e), M(e);
136
140
  }
137
- }, [s, t, e, u, r, o, p]), l || Object.keys(i).length === 0 ? null : /* @__PURE__ */ y(w, { snippets: i, maxHeight: f });
141
+ }, [s, t, o, c, n, r, p]), h || Object.keys(m).length === 0 ? null : /* @__PURE__ */ a(G, { snippets: m, maxHeight: f });
138
142
  };
139
143
  export {
140
- J as GeneratedRequestExample
144
+ X as GeneratedRequestExample
141
145
  };
@@ -1,27 +1,28 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { generateResponseExampleMap as m } from "../../generators/generateResponseExampleMap.js";
3
- import { mapResponseExamples as i } from "../../schemaGraph/utils.js";
4
- import { CodeGroupSelect as u } from "../../../components/content-components/CodeGroupSelect/index.js";
5
- import { CodeSnippets as d } from "../../../components/content-components/code-snippets.js";
2
+ import { generateResponseExampleMap as i } from "../../generators/generateResponseExampleMap.js";
3
+ import { useSelectedResponseContentType as u } from "../../hooks/useSelectedResponseContentType.js";
4
+ import { mapResponseExamples as d } from "../../schemaGraph/utils.js";
5
+ import { CodeGroupSelect as j } from "../../../components/content-components/CodeGroupSelect/index.js";
6
+ import { CodeSnippets as b } from "../../../components/content-components/code-snippets.js";
6
7
  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,
8
+ apiReferenceData: t,
11
9
  maxHeight: n
12
10
  }) => {
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))
11
+ var p;
12
+ const { selectedResponseContentTypeIndex: c } = u(), o = Object.values(((p = t.dependencies) == null ? void 0 : p.responses) ?? {});
13
+ if (Object.keys(o).length === 0 || Object.values(o).every((e) => Object.keys(e).length === 0))
16
14
  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)
15
+ const l = d(t), s = i(
16
+ l,
17
+ c
18
+ );
19
+ if (Object.values(s).every((e) => Object.keys(e).length <= 1)) {
20
+ const a = Object.values(s).flatMap(
21
+ (m) => Object.values(m)
21
22
  );
22
- return /* @__PURE__ */ r(d, { snippets: l, maxHeight: n });
23
+ return /* @__PURE__ */ r(b, { snippets: a, maxHeight: n, noMargins: !0 });
23
24
  }
24
- return /* @__PURE__ */ r(u, { snippets: t, maxHeight: n });
25
+ return /* @__PURE__ */ r(j, { snippets: s, maxHeight: n });
25
26
  };
26
27
  export {
27
28
  C as GeneratedResponseExample
@@ -1,97 +1,96 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { useState as q, useEffect as E } from "react";
3
- import { initialApiPlaygroundInputs as y } from "../../constants/index.js";
4
- import { generateSnippetMap as M } from "../../generators/generateSnippetMap.js";
5
- import { CodeGroupSelect as O } from "../../../components/content-components/CodeGroupSelect/index.js";
6
- import { CodeSnippets as U } from "../../../components/content-components/code-snippets.js";
7
- import { CodeBlock as j } from "../../../components/content-components/code-block.js";
8
- import { CodeGroup as w } from "../../../components/content-components/code-group.js";
9
- import { prismLangToDisplayLang as x } from "../../../constants/prism-languages.js";
10
- import { useApiPlaygroundDisplay as C } from "../../../hooks/useApiPlaygroundDisplay.js";
11
- import { GeneratedRequestExample as L } from "./GeneratedRequestExample.js";
12
- const I = ({
13
- apiReferenceData: o,
14
- inputs: m = y,
15
- maxHeight: p,
16
- selectedSecurityOptionIndex: i
17
- }) => {
18
- var c, n, e, g, r;
19
- const u = (c = o.operation) == null ? void 0 : c.requestExamples, a = C(), d = (n = o.operation) == null ? void 0 : n.requestExampleLanguages, s = (e = o.operation) == null ? void 0 : e.requiredOnlyExamples;
20
- switch ((g = o.operation) == null || g.requestExampleType, (r = o.operation) == null ? void 0 : r.requestExampleType) {
21
- case "mdx":
22
- if (!u) return null;
23
- const f = u.some((t) => t.dropdown ?? !1);
24
- return /* @__PURE__ */ l(w, { isSmallText: !0, dropdown: f, noMargins: !0, className: p, children: u.map((t, b) => /* @__PURE__ */ l(
25
- j,
26
- {
27
- language: t.language,
28
- fileName: t.filename,
29
- children: /* @__PURE__ */ l("span", { children: t.code })
30
- },
31
- `${t.filename}-${t.language}-${b}`
32
- )) });
33
- case "codeSamples":
34
- return o.operation.codeSamples ? /* @__PURE__ */ l(
35
- v,
36
- {
37
- apiReferenceData: o,
38
- inputs: m,
39
- apiPlaygroundDisplay: a,
40
- requestExampleLanguages: d,
41
- requiredOnly: s,
42
- maxHeight: p,
43
- selectedSecurityOptionIndex: i
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { memo as O } from "react";
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
+ import { useApiPlaygroundDisplay as I } from "../../../hooks/useApiPlaygroundDisplay.js";
15
+ import { GeneratedRequestExample as E } from "./GeneratedRequestExample.js";
16
+ const N = O(
17
+ ({
18
+ apiReferenceData: e,
19
+ inputs: u = j,
20
+ maxHeight: i
21
+ }) => {
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
+ case "mdx":
26
+ if (!n) return null;
27
+ const C = n.some((o) => o.dropdown ?? !1);
28
+ return /* @__PURE__ */ r(b, { isSmallText: !0, dropdown: C, noMargins: !0, className: i, children: n.map((o, t) => /* @__PURE__ */ r(
29
+ h,
30
+ {
31
+ language: o.language,
32
+ fileName: o.filename,
33
+ children: /* @__PURE__ */ r("span", { children: o.code })
34
+ },
35
+ `${o.filename}-${o.language}-${t}`
36
+ )) });
37
+ case "webhook":
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
+ case "codeSamples":
40
+ if (!e.operation.codeSamples) return null;
41
+ const c = w({
42
+ apiReferenceData: e,
43
+ codeSamples: e.operation.codeSamples,
44
+ baseUrl: s,
45
+ apiPlaygroundMode: M,
46
+ requestExampleLanguages: m,
47
+ requiredOnly: d,
48
+ inputs: u,
49
+ selectedSecurityOptionIndex: a,
50
+ selectedRequestBodyContentTypeIndex: p
51
+ });
52
+ if (Object.values(c).every((o) => Object.keys(o).length <= 1)) {
53
+ let t = Object.values(c).flatMap((l) => Object.values(l));
54
+ return new Set(t.map((l) => l.filename)).size !== t.length && (t = t.map((l) => ({
55
+ ...l,
56
+ filename: G[l.language] ?? l.language
57
+ }))), /* @__PURE__ */ r(v, { snippets: t, noMargins: !0, dropdown: !0 });
44
58
  }
45
- ) : null;
46
- case "generated":
47
- const S = o.operation.baseUrl ?? o.operation.baseUrlOptions[0];
48
- return S ? /* @__PURE__ */ l(
49
- L,
50
- {
51
- apiReferenceData: o,
52
- baseUrl: S,
53
- inputs: m,
54
- requestExampleLanguages: d,
55
- selectedSecurityOptionIndex: i,
56
- requiredOnly: s,
57
- maxHeight: p
58
- }
59
- ) : null;
60
- }
61
- }, v = ({
62
- apiReferenceData: o,
63
- inputs: m,
64
- apiPlaygroundDisplay: p,
65
- requestExampleLanguages: i,
66
- requiredOnly: u,
67
- maxHeight: a,
68
- selectedSecurityOptionIndex: d
69
- }) => {
70
- const [s, c] = q(null);
71
- if (E(() => {
72
- var e;
73
- if (!((e = o.operation) != null && e.codeSamples)) return;
74
- const n = M({
75
- apiReferenceData: o,
76
- codeSamples: o.operation.codeSamples,
77
- baseUrl: o.operation.baseUrl ?? o.operation.baseUrlOptions[0],
78
- apiPlaygroundMode: p,
79
- requestExampleLanguages: i,
80
- requiredOnly: u,
81
- selectedSecurityOptionIndex: d,
82
- inputs: m
83
- });
84
- c(n);
85
- }, [o, m, p, i, u]), !s) return null;
86
- if (Object.values(s).every((n) => Object.keys(n).length <= 1)) {
87
- let e = Object.values(s).flatMap((r) => Object.values(r));
88
- return new Set(e.map((r) => r.filename)).size !== e.length && (e = e.map((r) => ({
89
- ...r,
90
- filename: x[r.language] ?? r.language
91
- }))), /* @__PURE__ */ l(U, { snippets: e, dropdown: !0, maxHeight: a });
59
+ return /* @__PURE__ */ r(k, { snippets: c });
60
+ case "generated":
61
+ return s ? /* @__PURE__ */ r(
62
+ E,
63
+ {
64
+ apiReferenceData: e,
65
+ baseUrl: s,
66
+ inputs: u,
67
+ selectedSecurityOptionIndex: a,
68
+ requestExampleLanguages: m,
69
+ requiredOnly: d,
70
+ selectedRequestBodyContentTypeIndex: p,
71
+ maxHeight: i
72
+ }
73
+ ) : null;
74
+ case "examples":
75
+ return !e.operation.prefillPlaygroundExamples || !s ? null : /* @__PURE__ */ r(
76
+ E,
77
+ {
78
+ apiReferenceData: e,
79
+ baseUrl: s,
80
+ inputs: u,
81
+ selectedSecurityOptionIndex: a,
82
+ requestExampleLanguages: m,
83
+ requiredOnly: d,
84
+ selectedRequestBodyContentTypeIndex: p,
85
+ maxHeight: i
86
+ }
87
+ );
88
+ default:
89
+ return null;
90
+ }
92
91
  }
93
- return /* @__PURE__ */ l(O, { snippets: s, maxHeight: a });
94
- };
92
+ );
93
+ N.displayName = "RequestExample";
95
94
  export {
96
- I as RequestExample
95
+ N as RequestExample
97
96
  };
@@ -1,17 +1,21 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { CodeBlock as a } from "../../../components/content-components/code-block.js";
3
- import { CodeGroup as i } from "../../../components/content-components/code-group.js";
4
- import { GeneratedResponseExample as d } from "./GeneratedResponseExample.js";
5
- const E = ({ 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((o) => o.dropdown ?? !1);
11
- return /* @__PURE__ */ e(i, { isSmallText: !0, dropdown: m, noMargins: !0, className: s, children: n.map((o, t) => /* @__PURE__ */ e(a, { language: o.language, fileName: o.filename, children: /* @__PURE__ */ e("span", { children: o.code }) }, `${o.filename}-${o.language}-${t}`)) });
12
- } else
13
- return /* @__PURE__ */ e(d, { apiReferenceData: r, maxHeight: s });
14
- };
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { memo as i } from "react";
3
+ import { CodeBlock as t } from "../../../components/content-components/code-block.js";
4
+ import { CodeGroup as d } from "../../../components/content-components/code-group.js";
5
+ import { GeneratedResponseExample as u } from "./GeneratedResponseExample.js";
6
+ const f = i(
7
+ ({ apiReferenceData: r, maxHeight: s }) => {
8
+ var m, p;
9
+ const n = (m = r.operation) == null ? void 0 : m.responseExamples;
10
+ if (((p = r.operation) == null ? void 0 : p.responseExampleType) === "mdx") {
11
+ if (!n) return null;
12
+ const l = n.some((e) => e.dropdown ?? !1);
13
+ return /* @__PURE__ */ o(d, { isSmallText: !0, dropdown: l, noMargins: !0, className: s, children: n.map((e, a) => /* @__PURE__ */ o(t, { language: e.language, fileName: e.filename, children: /* @__PURE__ */ o("span", { children: e.code }) }, `${e.filename}-${e.language}-${a}`)) });
14
+ } else
15
+ return /* @__PURE__ */ o(u, { apiReferenceData: r, maxHeight: s });
16
+ }
17
+ );
18
+ f.displayName = "ResponseExample";
15
19
  export {
16
- E as ResponseExample
20
+ f as ResponseExample
17
21
  };
@@ -1,33 +1,35 @@
1
- import { jsxs as P, Fragment as g, jsx as n } from "react/jsx-runtime";
2
- import { getParametersPerSection as y, isSchemaObject as I, mapParamInToPlaygroundInputKey as j, escapeDots as k } from "../../schemaGraph/utils.js";
3
- import { InputSectionContainer as r } from "./InputSectionContainer.js";
4
- import { DifferentiatedInput as x } from "./inputs/DifferentiatedInput.js";
1
+ import { jsxs as P, Fragment as y, jsx as n } from "react/jsx-runtime";
2
+ import { getParametersPerSection as g, isSchemaObject as x, mapParamInToPlaygroundInputKey as I, escapeDots as j } from "../../schemaGraph/utils.js";
3
+ import { InputSectionContainer as o } from "./InputSectionContainer.js";
4
+ import { DifferentiatedInput as k } from "./inputs/DifferentiatedInput.js";
5
5
  const K = ({
6
- apiReferenceData: o
6
+ apiReferenceData: r
7
7
  }) => {
8
- const { dependencies: l } = o, { parameters: a } = l ?? {};
9
- if (!a || Object.keys(a).length === 0) return null;
10
- const { header: h, path: u, query: p, cookie: d } = y(o), t = (e) => {
8
+ const { dependencies: a } = r, { parameters: i } = a ?? {};
9
+ if (!i || Object.keys(i).length === 0) return null;
10
+ const { header: h, path: u, query: d, cookie: p } = g(r), t = (e) => {
11
11
  if (e === void 0)
12
12
  return null;
13
- if (I(e.schema)) {
14
- const f = `${j(e.in)}.${k(e.name)}`;
13
+ if (x(e.schema)) {
14
+ const f = `${I(e.in)}.${j(e.name)}`;
15
15
  return /* @__PURE__ */ n(
16
- x,
16
+ k,
17
17
  {
18
18
  name: e.name,
19
- schema: e.schema,
19
+ schema: { ...e.schema, description: e.description },
20
+ style: e.style,
21
+ explode: e.explode,
20
22
  inputKeyPrefix: f
21
23
  },
22
24
  e.name
23
25
  );
24
26
  }
25
- }, i = h.map(t).filter((e) => e !== null), m = d.map(t).filter((e) => e !== null), s = u.map(t).filter((e) => e !== null), c = p.map(t).filter((e) => e !== null);
26
- return /* @__PURE__ */ P(g, { children: [
27
- i.length > 0 && /* @__PURE__ */ n(r, { name: "Header", children: i }),
28
- m.length > 0 && /* @__PURE__ */ n(r, { name: "Cookies", children: m }),
29
- s.length > 0 && /* @__PURE__ */ n(r, { name: "Path", children: s }),
30
- c.length > 0 && /* @__PURE__ */ n(r, { name: "Query", children: c })
27
+ }, s = h.map(t).filter((e) => e !== null), l = p.map(t).filter((e) => e !== null), c = u.map(t).filter((e) => e !== null), m = d.map(t).filter((e) => e !== null);
28
+ return /* @__PURE__ */ P(y, { children: [
29
+ s.length > 0 && /* @__PURE__ */ n(o, { name: "Header", children: s }),
30
+ l.length > 0 && /* @__PURE__ */ n(o, { name: "Cookies", children: l }),
31
+ c.length > 0 && /* @__PURE__ */ n(o, { name: "Path", children: c }),
32
+ m.length > 0 && /* @__PURE__ */ n(o, { name: "Query", children: m })
31
33
  ] });
32
34
  };
33
35
  export {