@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,15 +1,16 @@
1
- import { jsx as m, jsxs as r } from "react/jsx-runtime";
1
+ import { jsx as m, jsxs as s } from "react/jsx-runtime";
2
2
  import "@mintlify/validation";
3
+ import "@sindresorhus/slugify";
3
4
  import { cn as d } from "../../utils/cn.js";
4
5
  import * as t from "@radix-ui/react-dropdown-menu";
5
6
  import { ChevronRightFilled as l, CheckmarkCircleRegular as c, CircleRegular as p } from "@fluentui/react-icons";
6
7
  import * as o from "react";
7
8
  const f = o.forwardRef((n, e) => /* @__PURE__ */ m(t.Root, { modal: !1, ...n }));
8
9
  f.displayName = t.Root.displayName;
9
- const I = t.Trigger, u = o.forwardRef(({ className: n, inset: e, children: i, ...a }, s) => /* @__PURE__ */ r(
10
+ const k = t.Trigger, u = o.forwardRef(({ className: n, inset: e, children: i, ...a }, r) => /* @__PURE__ */ s(
10
11
  t.SubTrigger,
11
12
  {
12
- ref: s,
13
+ ref: r,
13
14
  className: d(
14
15
  "mint:flex mint:cursor-default mint:select-none mint:items-center mint:rounded-md mint:px-2 mint:py-1.5 mint:text-sm mint:outline-none mint:focus:bg-accent mint:data-[state=open]:bg-accent",
15
16
  e && "mint:pl-8",
@@ -48,10 +49,10 @@ const g = o.forwardRef(({ className: n, sideOffset: e = 8, ...i }, a) => /* @__P
48
49
  }
49
50
  ) }));
50
51
  g.displayName = t.Content.displayName;
51
- const w = o.forwardRef(({ className: n, inset: e, isSelected: i, ...a }, s) => /* @__PURE__ */ m(
52
+ const w = o.forwardRef(({ className: n, inset: e, isSelected: i, ...a }, r) => /* @__PURE__ */ m(
52
53
  t.Item,
53
54
  {
54
- ref: s,
55
+ ref: r,
55
56
  className: d(
56
57
  "mint:relative mint:flex mint:cursor-pointer mint:select-none mint:items-center mint:rounded-lg mint:px-2 mint:py-1.5 mint:text-sm mint:outline-none mint:focus:bg-accent mint:focus:text-accent-foreground mint:data-[disabled]:pointer-events-none mint:data-[disabled]:opacity-50 mint:hover:bg-zinc-950/5 mint:dark:hover:bg-white/5",
57
58
  e && "mint:pl-8",
@@ -62,10 +63,10 @@ const w = o.forwardRef(({ className: n, inset: e, isSelected: i, ...a }, s) => /
62
63
  }
63
64
  ));
64
65
  w.displayName = t.Item.displayName;
65
- const h = o.forwardRef(({ className: n, children: e, checked: i, ...a }, s) => /* @__PURE__ */ r(
66
+ const h = o.forwardRef(({ className: n, children: e, checked: i, ...a }, r) => /* @__PURE__ */ s(
66
67
  t.CheckboxItem,
67
68
  {
68
- ref: s,
69
+ ref: r,
69
70
  className: d(
70
71
  "mint:relative mint:flex mint:cursor-default mint:select-none mint:items-center mint:rounded-sm mint:py-1.5 mint:pl-8 mint:pr-2 mint:text-sm mint:outline-none mint:transition-colors mint:focus:bg-accent mint:focus:text-accent-foreground mint:data-[disabled]:pointer-events-none mint:data-[disabled]:opacity-50",
71
72
  n
@@ -79,7 +80,7 @@ const h = o.forwardRef(({ className: n, children: e, checked: i, ...a }, s) => /
79
80
  }
80
81
  ));
81
82
  h.displayName = t.CheckboxItem.displayName;
82
- const N = o.forwardRef(({ className: n, children: e, ...i }, a) => /* @__PURE__ */ r(
83
+ const N = o.forwardRef(({ className: n, children: e, ...i }, a) => /* @__PURE__ */ s(
83
84
  t.RadioItem,
84
85
  {
85
86
  ref: a,
@@ -123,5 +124,5 @@ export {
123
124
  x as DropdownMenuSeparator,
124
125
  b as DropdownMenuSubContent,
125
126
  u as DropdownMenuSubTrigger,
126
- I as DropdownMenuTrigger
127
+ k as DropdownMenuTrigger
127
128
  };
@@ -6,7 +6,7 @@ import { cn as g } from "../../utils/cn.js";
6
6
  import { CopyToClipboardButton as B } from "./code-block.js";
7
7
  import { getNodeText as G } from "../../utils/get-node-text.js";
8
8
  import { capitalize as D } from "../../utils/string.js";
9
- const K = y(function({ children: r, onChange: a, className: o, dropdown: l, noMargins: h, ...T }, C) {
9
+ const Q = y(function({ children: r, onChange: a, className: o, dropdown: l, noMargins: h, isSmallText: q, ...T }, C) {
10
10
  var k, N;
11
11
  const { defaultValue: u, ...S } = T, x = z(/* @__PURE__ */ new Map()), i = Array.isArray(r) ? r : j.Children.toArray(r), [v, A] = F(0), w = L(
12
12
  (n) => {
@@ -133,7 +133,7 @@ const K = y(function({ children: r, onChange: a, className: o, dropdown: l, noMa
133
133
  }
134
134
  );
135
135
  });
136
- function Q({ text: b }) {
136
+ function U({ text: b }) {
137
137
  return /* @__PURE__ */ e(
138
138
  "div",
139
139
  {
@@ -144,6 +144,6 @@ function Q({ text: b }) {
144
144
  );
145
145
  }
146
146
  export {
147
- Q as CodeBlockTooltip,
148
- K as CodeGroup
147
+ U as CodeBlockTooltip,
148
+ Q as CodeGroup
149
149
  };
@@ -1,12 +1,12 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { useRef as c, createContext as s, useContext as a } from "react";
2
+ import { useContext as c, useRef as s, createContext as a } from "react";
3
3
  import { useCheckHash as p } from "../hooks/useCheckHash.js";
4
- const o = s({}), u = () => a(o);
4
+ const o = a({}), u = () => c(o);
5
5
  function x({
6
6
  location: t,
7
7
  children: n
8
8
  }) {
9
- const e = c(!1), r = p();
9
+ const e = s(!1), r = p();
10
10
  return /* @__PURE__ */ i(o.Provider, { value: { location: t, anchor: r, hasScrolledToAnchorRef: e }, children: n });
11
11
  }
12
12
  o.displayName = "EndpointLocationContext";
@@ -0,0 +1,10 @@
1
+ import { useContext as r } from "react";
2
+ import { DocsConfigContext as d } from "../contexts/ConfigContext.js";
3
+ const F = () => {
4
+ var o, p, t, n;
5
+ const { mintConfig: i, docsConfig: a } = r(d), e = (p = (o = i == null ? void 0 : i.api) == null ? void 0 : o.paramFields) == null ? void 0 : p.expanded;
6
+ return ((n = (t = a == null ? void 0 : a.api) == null ? void 0 : t.params) == null ? void 0 : n.expanded) ?? e;
7
+ };
8
+ export {
9
+ F as useApiParamFieldOption
10
+ };
@@ -1,13 +1,13 @@
1
- import { useContext as n, useMemo as t } from "react";
1
+ import { useMemo as n, useContext as t } from "react";
2
2
  import { ApiReferenceContext as o } from "../contexts/ConfigContext.js";
3
3
  const p = () => {
4
4
  const {
5
5
  apiReferenceData: { endpoint: e }
6
- } = n(o);
6
+ } = t(o);
7
7
  return e;
8
8
  }, s = () => {
9
9
  const e = p();
10
- return t(() => e, [e]);
10
+ return n(() => e, [e]);
11
11
  };
12
12
  export {
13
13
  s as useEndpoint,
@@ -1,25 +1,25 @@
1
- import { useCallback as p, useEffect as w } from "react";
2
- const d = ({
3
- key: y,
1
+ import { useCallback as w, useEffect as y } from "react";
2
+ const C = ({
3
+ key: n,
4
4
  callback: r,
5
5
  isSingleKey: h,
6
- excludedActiveElementId: u,
7
- excludedActiveElements: f,
6
+ excludedActiveElementId: t,
7
+ excludedActiveElements: u,
8
8
  isDisabled: i
9
9
  }) => {
10
- const n = p(
11
- (s) => {
10
+ const f = w(
11
+ (p) => {
12
12
  if (i) return;
13
- let t = !1;
13
+ let s = !1;
14
14
  const o = document.activeElement;
15
- u && (t = !!(o != null && o.id) && u.includes(o.id)), f && !t && (t = f.includes(
15
+ t && (s = !!(o != null && o.id) && t.includes(o.id)), u && !s && (s = u.includes(
16
16
  o == null ? void 0 : o.tagName.toLowerCase()
17
- )), s.key === y && (h || s.metaKey || s.ctrlKey) && !t && (s.preventDefault(), r == null || r());
17
+ )), p.key === n && h && !s && (p.preventDefault(), r == null || r());
18
18
  },
19
- [r, y, h, u, f, i]
19
+ [r, n, h, t, u, i]
20
20
  );
21
- w(() => (addEventListener("keydown", n), () => removeEventListener("keydown", n)), [n]);
21
+ y(() => (addEventListener("keydown", f), () => removeEventListener("keydown", f)), [f]);
22
22
  };
23
23
  export {
24
- d as useKeyboardShortcut
24
+ C as useKeyboardShortcut
25
25
  };
@@ -1,148 +1,16 @@
1
- import { useContext as b, useCallback as S } from "react";
2
- import { DocsConfigContext as g } from "../contexts/ConfigContext.js";
3
- import { NEXT_PUBLIC as l } from "../env.js";
4
- import { useApiPlaygroundInputs as j } from "./useMDXContentController/useApiPlaygroundInputs.js";
5
- const _ = ({
6
- endpoint: t,
7
- baseUrl: n,
8
- contentType: r,
9
- setResult: s,
10
- setIsFetching: o
11
- }) => {
12
- var f, p;
13
- const e = j(), { docsConfig: a } = b(g), d = ((p = (f = a == null ? void 0 : a.api) == null ? void 0 : f.playground) == null ? void 0 : p.proxy) === !1;
14
- return S(async () => {
15
- o(!0);
16
- const y = await import("axios").then((i) => i.default), u = w(t.path, e.path), h = O(
17
- x(n, e.server),
18
- u
19
- ), m = A(e.header, r), c = {
20
- method: t.method,
21
- url: h,
22
- header: m,
23
- body: e.body,
24
- cookie: e.cookie,
25
- query: e.query
26
- };
27
- try {
28
- if (d) {
29
- const i = await C(c);
30
- s({
31
- error: !1,
32
- response: {
33
- status: i.status,
34
- statusText: i.statusText,
35
- headers: i.headers,
36
- data: i.data
37
- }
38
- });
39
- } else if (r.includes("multipart/form-data")) {
40
- const i = await D(c);
41
- s(i);
42
- } else {
43
- const { data: i } = await y.post(`${l.BASE_PATH}/_mintlify/api/request`, c);
44
- s(i);
45
- }
46
- } catch (i) {
47
- s({
48
- error: !0,
49
- errorMessage: "unable to complete request"
50
- }), console.error(i);
51
- }
52
- o(!1);
53
- }, [
54
- o,
55
- t,
56
- e,
57
- n,
58
- r,
59
- d,
60
- s
61
- ]);
62
- }, w = (t, n) => Object.entries(n).reduce((r, [s, o]) => o == null ? r : r.replace(
63
- `{${s}}`,
64
- encodeURIComponent(o.toString())
65
- ), t), x = (t, n) => {
66
- let r = t;
67
- return Object.entries(n).forEach(([s, o]) => {
68
- o && (r = r.replace(`{${s}}`, o));
69
- }), r;
70
- }, O = (t, n) => t.replace(/\/$/, "") + "/" + n.replace(/^\//, ""), A = (t, n) => Object.keys(t).some((r) => r.toLowerCase() === "content-type") ? t : {
71
- ...t,
72
- "content-type": n
73
- }, C = async (t) => {
74
- const n = await import("axios").then((e) => e.default), r = Object.keys(t.header).find(
75
- (e) => e.toLowerCase() === "content-type"
76
- );
77
- let s = t.body, o = t.header;
78
- if (r != null && r.includes("multipart/form-data")) {
79
- const { data: e, headers: a } = E(t);
80
- s = e, o = a;
81
- }
82
- return n({
83
- url: t.url,
84
- method: t.method,
85
- params: t.query,
86
- data: s,
87
- headers: o,
88
- // prevent axios from adding [] after array query params
89
- paramsSerializer: {
90
- indexes: null
91
- },
92
- responseType: "arraybuffer",
93
- // prevent axios from erroring on bad status codes
94
- validateStatus: () => !0,
95
- // prevent axios from parsing json, losing whitespace information, and using default utf-8 encoding
96
- // we can't use `responseEncoding` as it's ignored client-side
97
- transformResponse: (e) => Buffer.from(e).toString("base64")
98
- });
99
- }, D = async (t) => {
100
- const n = await import("axios").then((o) => o.default), r = new FormData();
101
- r.append(
102
- "requestInfo",
103
- JSON.stringify({
104
- method: t.method,
105
- url: t.url,
106
- header: t.header,
107
- query: t.query,
108
- cookie: t.cookie
109
- })
110
- ), typeof t.body == "object" && t.body !== null && Object.entries(t.body).forEach(([o, e]) => {
111
- e instanceof File ? r.append(o, e) : Array.isArray(e) ? e.forEach((a) => {
112
- a instanceof File ? r.append(o, a) : a != null && r.append(
113
- o,
114
- typeof a == "object" ? JSON.stringify(a) : a.toString()
115
- );
116
- }) : e != null && r.append(
117
- o,
118
- typeof e == "object" ? JSON.stringify(e) : e.toString()
119
- );
120
- });
121
- const { data: s } = await n.post(`${l.BASE_PATH}/_mintlify/api/file-request`, r);
122
- return s;
123
- }, E = (t) => {
124
- var s;
125
- let n = t.body;
126
- const r = t.header;
127
- if ((s = r["content-type"]) != null && s.includes("multipart/form-data")) {
128
- const o = new FormData();
129
- typeof n == "object" && n !== null && (Object.entries(n).forEach(([e, a]) => {
130
- a instanceof File ? o.append(e, a) : Array.isArray(a) ? a.forEach((d) => {
131
- d instanceof File ? o.append(e, d) : d != null && o.append(
132
- e,
133
- typeof d == "object" ? JSON.stringify(d) : d.toString()
134
- );
135
- }) : a != null && o.append(
136
- e,
137
- typeof a == "object" ? JSON.stringify(a) : a.toString()
138
- );
139
- }), n = o, delete r["content-type"]);
140
- }
141
- return { data: n, headers: r };
142
- };
1
+ import "react";
2
+ import "../env.js";
3
+ const i = (r, t) => Object.entries(t).reduce((e, [o, n]) => n == null ? e : e.replace(
4
+ `{${o}}`,
5
+ encodeURIComponent(n.toString())
6
+ ), r), l = (r, t) => {
7
+ let e = r;
8
+ return Object.entries(t).forEach(([o, n]) => {
9
+ n && (e = e.replace(`{${o}}`, n));
10
+ }), e;
11
+ }, s = (r, t) => r.replace(/\/$/, "") + "/" + t.replace(/^\//, "");
143
12
  export {
144
- w as addPathParams,
145
- x as addServerVariables,
146
- O as joinWithSingleSlash,
147
- _ as useSendPlaygroundRequest
13
+ i as addPathParams,
14
+ l as addServerVariables,
15
+ s as joinWithSingleSlash
148
16
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ApiPlaygroundDisplayType } from '@mintlify/models';
2
1
  import { ApiPlaygroundInputs } from '@mintlify/validation';
3
2
  import { ApiPlaygroundResultType } from '@mintlify/models';
4
3
  import { AsyncAPIDocumentInterface } from '@mintlify/common';
@@ -22,9 +21,11 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
22
21
  import { MdxExtracts as MdxExtracts_2 } from '@mintlify/common';
23
22
  import { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
24
23
  import { MintConfig } from '@mintlify/models';
24
+ import { NamedExoticComponent } from 'react';
25
25
  import { Node as Node_2 } from 'unist';
26
26
  import { Node as Node_3 } from 'hast';
27
27
  import { OpenApiMetadata } from '@mintlify/models';
28
+ import { openApiToSchemaGraph } from '@mintlify/validation';
28
29
  import { OpenAPIV3 } from 'openapi-types';
29
30
  import { OpenAPIV3_1 } from 'openapi-types';
30
31
  import { Operation } from '@mintlify/validation';
@@ -48,6 +49,7 @@ import { StoreApi } from 'zustand';
48
49
  import { Text as Text_2 } from 'hast';
49
50
  import { TrieveType } from '@mintlify/validation';
50
51
  import { UseBoundStore } from 'zustand';
52
+ import { UserInfoInputs } from '@mintlify/validation';
51
53
  import { UUID } from '@mintlify/validation';
52
54
 
53
55
  export declare const addApiReferenceDataFromMdxAndDocsConfig: ({ pageMetadata, apiReferenceData2, mdxExtracts, docsConfig, }: {
@@ -94,47 +96,23 @@ declare type ApiExamplesProps = {
94
96
  noInputs?: boolean;
95
97
  };
96
98
 
97
- export declare function ApiFields({ pageMetadata }: {
98
- pageMetadata: PageMetaTags;
99
- }): JSX_2.Element;
100
-
101
- export declare const ApiPlayground: ({ endpoint, display, pathname }: ApiPlaygroundParams) => JSX_2.Element;
102
-
103
- export declare const ApiPlaygroundContext: Context<ApiPlaygroundContextType>;
104
-
105
- export declare const ApiPlaygroundContextLegacy: Context<ApiPlaygroundContextTypeLegacy>;
99
+ export declare const ApiFields: NamedExoticComponent< {
100
+ pageMetadata: PageMetaTags;
101
+ }>;
106
102
 
107
- export declare type ApiPlaygroundContextType = {
108
- isSending?: boolean;
109
- sendRequest?: () => void;
110
- isPlaygroundExpanded: boolean;
111
- result?: ApiPlaygroundResultType;
112
- selectedBaseUrlIndex: number;
113
- setSelectedBaseUrlIndex?: (index: number) => void;
114
- setIsPlaygroundExpanded?: (expanded: boolean) => void;
115
- baseUrlOptions?: string[];
116
- selectedExampleIndex?: number;
117
- setSelectedExampleIndex?: (index: number) => void;
118
- };
103
+ declare const ApiPlaygroundContext: Context<ApiPlaygroundContextType>;
104
+ export { ApiPlaygroundContext }
105
+ export { ApiPlaygroundContext as ApiPlaygroundContextLegacy }
119
106
 
120
- export declare type ApiPlaygroundContextTypeLegacy = {
107
+ declare type ApiPlaygroundContextType = {
121
108
  isSending?: boolean;
122
109
  sendRequest?: () => void;
123
110
  isPlaygroundExpanded: boolean;
124
111
  result?: ApiPlaygroundResultType;
125
- selectedBaseUrlIndex: number;
126
- setSelectedBaseUrlIndex?: (index: number) => void;
127
112
  setIsPlaygroundExpanded?: (expanded: boolean) => void;
128
- baseUrlOptions?: string[];
129
- selectedExampleIndex?: number;
130
- setSelectedExampleIndex?: (index: number) => void;
131
- };
132
-
133
- declare type ApiPlaygroundParams = {
134
- endpoint: Endpoint;
135
- display: ApiPlaygroundDisplayType;
136
- pathname: string;
137
113
  };
114
+ export { ApiPlaygroundContextType }
115
+ export { ApiPlaygroundContextType as ApiPlaygroundContextTypeLegacy }
138
116
 
139
117
  export declare const ApiReferenceContext: Context<ApiReferenceContextType>;
140
118
 
@@ -171,8 +149,8 @@ export declare interface ApiReferenceDataV2 {
171
149
  schemaData?: SchemaV2;
172
150
  dependencies?: {
173
151
  parameters?: Record<UUID, ParameterObject>;
174
- requestBody?: RequestBodyObject;
175
- responses?: Record<UUID, ResponseObject>;
152
+ requestBody?: ResolvedRequestBody;
153
+ responses?: ResolvedResponses;
176
154
  servers: Record<UUID, ServerObject>;
177
155
  security: Record<UUID, ResolvedSecurityObject>;
178
156
  processedSecurityOptions?: ProcessedSecurityOption[];
@@ -521,16 +499,13 @@ export declare type ElementType = {
521
499
  tagName?: string;
522
500
  };
523
501
 
524
- export declare const EndpointFields: () => JSX_2.Element | null;
525
-
526
- export declare const EndpointHeader: ({ onCopy, baseUrlOptions, selectedBaseUrlIndex, setSelectedBaseUrlIndex, isCopiedActive, display, path, method, onBaseUrlChange, isInPlaygroundModal, }: EndpointHeaderProps) => JSX_2.Element;
502
+ export declare const EndpointHeader: ({ baseUrl, baseUrlOptions, selectedBaseUrlIndex, setSelectedBaseUrlIndex, display, path, method, onBaseUrlChange, isInPlaygroundModal, }: EndpointHeaderProps) => JSX_2.Element;
527
503
 
528
504
  declare type EndpointHeaderProps = {
529
- onCopy: () => void;
505
+ baseUrl: string;
530
506
  baseUrlOptions: string[];
531
507
  selectedBaseUrlIndex: number;
532
508
  setSelectedBaseUrlIndex: (index: number) => void;
533
- isCopiedActive: boolean;
534
509
  isInPlaygroundModal: boolean;
535
510
  display: 'simple' | 'none' | 'interactive';
536
511
  path: string;
@@ -703,6 +678,8 @@ declare interface NavTreeProps {
703
678
  anchors?: AnchorConfig[];
704
679
  }
705
680
 
681
+ export { openApiToSchemaGraph }
682
+
706
683
  export declare const OperationPage: ({ apiReferenceData, operation, children, }: {
707
684
  apiReferenceData: ApiReferenceDataV2;
708
685
  operation: OperationV2;
@@ -719,13 +696,14 @@ export declare type OperationV2 = Operation & {
719
696
  requestExamples?: CodeExample[];
720
697
  responseExamples?: CodeExample[];
721
698
  codeSamples?: CodeSample[];
722
- requestExampleType?: 'mdx' | 'webhook' | 'codeSamples' | 'generated';
699
+ requestExampleType?: 'mdx' | 'webhook' | 'codeSamples' | 'generated' | 'examples';
723
700
  requestExampleLanguages?: string[];
724
701
  requiredOnlyExamples?: boolean;
725
702
  responseExampleType?: 'mdx' | 'generated';
726
703
  prefillPlaygroundWithExample?: boolean;
727
- prefillPlaygroundExamples?: ApiPlaygroundInputs[];
704
+ prefillPlaygroundExamples?: Record<string, PlaygroundInputValue>[];
728
705
  disableProxy?: boolean;
706
+ userInfoPlaygroundInputs?: UserInfoInputs;
729
707
  };
730
708
 
731
709
  export declare const PageContext: Context<PageContextType>;
@@ -806,17 +784,28 @@ export declare interface PlainTextPageProps {
806
784
  export declare const Playground: ({ isPlaygroundExpanded, setIsPlaygroundExpanded, baseUrl, baseUrlOptions, apiReferenceData, }: PlaygroundProps) => JSX_2.Element | null;
807
785
 
808
786
  declare interface PlaygroundInputsState {
787
+ apiReferenceData: ApiReferenceDataV2 | undefined;
809
788
  inputs: Record<string, PlaygroundInputValue>;
810
- initialize: (initialValues: Record<string, PlaygroundInputValue>) => void;
789
+ initializeInputs: (initialValues: Record<string, PlaygroundInputValue>) => void;
790
+ initializeApiReferenceData: (apiReferenceData: ApiReferenceDataV2) => void;
811
791
  setInput: (name: string, value: PlaygroundInputValue) => void;
812
792
  setInputs: (inputs: Record<string, PlaygroundInputValue>) => void;
813
793
  replaceInputs: (inputs: Record<string, PlaygroundInputValue>) => void;
794
+ deleteInput: (name: string) => void;
814
795
  getInput: (name: string) => PlaygroundInputValue;
815
796
  getApiPlaygroundInputs: () => ApiPlaygroundInputs;
816
797
  clear: () => void;
817
798
  reset: () => void;
799
+ selectedBaseUrlIndex: number;
800
+ setSelectedBaseUrlIndex: (index: number) => void;
818
801
  selectedSecurityOptionIndex: number;
819
802
  setSelectedSecurityOptionIndex: (index: number) => void;
803
+ selectedExampleIndex: number;
804
+ setSelectedExampleIndex: (index: number) => void;
805
+ selectedRequestBodyContentTypeIndex: number;
806
+ setSelectedRequestBodyContentTypeIndex: (index: number) => void;
807
+ selectedResponseContentTypeIndex: number;
808
+ setSelectedResponseContentTypeIndex: (index: number) => void;
820
809
  }
821
810
 
822
811
  declare type PlaygroundInputValue = unknown;
@@ -830,8 +819,15 @@ declare type PlaygroundProps = {
830
819
  };
831
820
 
832
821
  export declare type ProcessedSecurityOption = {
822
+ schemes: Array<ProcessedSecurityScheme>;
823
+ title: string;
824
+ };
825
+
826
+ declare type ProcessedSecurityScheme = {
833
827
  scheme: SecuritySchemeAndScope;
834
828
  schema: SchemaObject;
829
+ schemeName: string;
830
+ name: string;
835
831
  };
836
832
 
837
833
  export declare const processSecurityOptions: (apiReferenceData: ApiReferenceDataV2) => ProcessedSecurityOption[];
@@ -860,6 +856,14 @@ export declare function remarkHeadingIds(): (tree: Root) => void;
860
856
 
861
857
  export declare function removeHtmlComments(root: Root_2): void;
862
858
 
859
+ declare type ResolvedRequestBody = RequestBodyObject & {
860
+ exampleType?: 'generated' | 'examples';
861
+ };
862
+
863
+ declare type ResolvedResponses = Record<UUID, ResponseObject & {
864
+ exampleType?: 'generated' | 'examples';
865
+ }>;
866
+
863
867
  /**
864
868
  * SchemaObject after being processed by the various transformations in `resolveOperationWithDependencies`.
865
869
  * This is the type of object that all the API UI components should be consuming. Any properties that
@@ -882,6 +886,7 @@ export declare type ResolvedSchemaObject = SchemaObject & {
882
886
  isCircular?: boolean;
883
887
  type?: DifferentiatedType;
884
888
  [CIRCULAR_REF_KEY]?: UUID;
889
+ typeLabel?: string;
885
890
  };
886
891
 
887
892
  export declare type ResolvedSecurityObject = {
@@ -991,30 +996,32 @@ export declare const useCopyPathWithInputs: ({ path, baseUrl }: {
991
996
  }) => string;
992
997
 
993
998
  /**
994
- * CLANKED
995
- * Syncs playground state with URL pathname changes.
999
+ * RE-CLANKED BUT BETTER THIS TIME
1000
+ * Simplified playground initialization hook.
996
1001
  *
997
- * This hook implements the following behavior:
998
- * - When the pathname changes, it resets the playground inputs
999
- * - After reset, it initializes with the new default values for the current endpoint
1000
- * - When playground closes without pathname change, state is preserved
1001
- * - Query parameter changes (like ?playground=open) do NOT reset the state
1002
+ * Assumes the Playground component remounts for each new page/endpoint,
1003
+ * so we don't need complex pathname tracking.
1002
1004
  *
1003
- * Uses refs to track previous pathname to avoid unnecessary resets.
1005
+ * Handles:
1006
+ * - Initial mount: Reset and initialize with defaults
1007
+ * - Credentials loading: Update inputs when credentials load from localStorage
1008
+ * - Example switching: Handled via selectedExampleIndex prop changes
1004
1009
  */
1005
- export declare function useInitializeInputs({ apiReferenceData, selectedBaseUrlIndex, selectedExampleIndex, selectedRequestBodyContentTypeIndex, }: UsePlaygroundStateSyncProps): void;
1006
-
1007
- export declare function useMarkdownCopy(pathname: string): void;
1008
-
1009
- export declare const usePlaygroundInputsStore: UseBoundStore<StoreApi<PlaygroundInputsState>>;
1010
+ export declare function useInitializeInputs({ apiReferenceData, selectedBaseUrlIndex, selectedExampleIndex, selectedRequestBodyContentTypeIndex, locallyStoredCredentials, serverInputs, }: UseInitializeInputsProps): void;
1010
1011
 
1011
- declare interface UsePlaygroundStateSyncProps {
1012
+ declare interface UseInitializeInputsProps {
1012
1013
  apiReferenceData: ApiReferenceDataV2;
1013
1014
  selectedBaseUrlIndex: number;
1014
1015
  selectedExampleIndex: number;
1015
1016
  selectedRequestBodyContentTypeIndex: number;
1017
+ locallyStoredCredentials: Record<string, any> | undefined;
1018
+ serverInputs: Record<string, string> | undefined;
1016
1019
  }
1017
1020
 
1021
+ export declare function useMarkdownCopy(pathname: string): void;
1022
+
1023
+ export declare const usePlaygroundInputsStore: UseBoundStore<StoreApi<PlaygroundInputsState>>;
1024
+
1018
1025
  export declare const useSelectedSecurityOption: () => {
1019
1026
  selectedSecurityOptionIndex: number;
1020
1027
  setSelectedSecurityOptionIndex: (index: number) => void;