@mintlify/msft-sdk 1.1.23 → 1.1.25

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 (356) hide show
  1. package/dist/api-playground/ApiPlayground/Request/BodySection.js +65 -0
  2. package/dist/api-playground/ApiPlayground/Request/BodySection.js.map +1 -0
  3. package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +33 -0
  4. package/dist/api-playground/ApiPlayground/Request/ParameterSection.js.map +1 -0
  5. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +202 -0
  6. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js.map +1 -0
  7. package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +147 -0
  8. package/dist/api-playground/ApiPlayground/Request/SecuritySection.js.map +1 -0
  9. package/dist/api-playground/ApiPlayground/Request/ServerSection.js +31 -0
  10. package/dist/api-playground/ApiPlayground/Request/ServerSection.js.map +1 -0
  11. package/dist/api-playground/ApiPlayground/Request/index.js +44 -0
  12. package/dist/api-playground/ApiPlayground/Request/index.js.map +1 -0
  13. package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +94 -0
  14. package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js.map +1 -0
  15. package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +91 -0
  16. package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js.map +1 -0
  17. package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +63 -0
  18. package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js.map +1 -0
  19. package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +34 -0
  20. package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js.map +1 -0
  21. package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +62 -0
  22. package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js.map +1 -0
  23. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +110 -0
  24. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js.map +1 -0
  25. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +88 -0
  26. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js.map +1 -0
  27. package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +62 -0
  28. package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js.map +1 -0
  29. package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +55 -0
  30. package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js.map +1 -0
  31. package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +68 -0
  32. package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js.map +1 -0
  33. package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +45 -0
  34. package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js.map +1 -0
  35. package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js +7 -0
  36. package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js.map +1 -0
  37. package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +45 -0
  38. package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js.map +1 -0
  39. package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +54 -0
  40. package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js.map +1 -0
  41. package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js +15 -0
  42. package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js.map +1 -0
  43. package/dist/api-playground/ApiPlayground/Response/ResponseError.js +14 -0
  44. package/dist/api-playground/ApiPlayground/Response/ResponseError.js.map +1 -0
  45. package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js +12 -0
  46. package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js.map +1 -0
  47. package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +20 -0
  48. package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js.map +1 -0
  49. package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +21 -0
  50. package/dist/api-playground/ApiPlayground/Response/ResponseTable.js.map +1 -0
  51. package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +93 -0
  52. package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js.map +1 -0
  53. package/dist/api-playground/ApiPlayground/Response/index.js +80 -0
  54. package/dist/api-playground/ApiPlayground/Response/index.js.map +1 -0
  55. package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js +24 -0
  56. package/dist/api-playground/ApiPlayground/components/AdditionalItemButton.js.map +1 -0
  57. package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +45 -0
  58. package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js.map +1 -0
  59. package/dist/api-playground/ApiPlayground/components/ArrayCount.js +18 -0
  60. package/dist/api-playground/ApiPlayground/components/ArrayCount.js.map +1 -0
  61. package/dist/api-playground/ApiPlayground/components/BasePathSelector.js +40 -0
  62. package/dist/api-playground/ApiPlayground/components/BasePathSelector.js.map +1 -0
  63. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +43 -0
  64. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js.map +1 -0
  65. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +44 -0
  66. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js.map +1 -0
  67. package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +39 -0
  68. package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js.map +1 -0
  69. package/dist/api-playground/ApiPlayground/components/InputContainer.js +129 -0
  70. package/dist/api-playground/ApiPlayground/components/InputContainer.js.map +1 -0
  71. package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +60 -0
  72. package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js.map +1 -0
  73. package/dist/api-playground/ApiPlayground/components/ModalHeader.js +16 -0
  74. package/dist/api-playground/ApiPlayground/components/ModalHeader.js.map +1 -0
  75. package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js +29 -0
  76. package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js.map +1 -0
  77. package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +20 -0
  78. package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js.map +1 -0
  79. package/dist/api-playground/ApiPlayground/components/PathHeader.js +163 -0
  80. package/dist/api-playground/ApiPlayground/components/PathHeader.js.map +1 -0
  81. package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +59 -0
  82. package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js.map +1 -0
  83. package/dist/api-playground/ApiPlayground/components/PrettyPath.js +50 -0
  84. package/dist/api-playground/ApiPlayground/components/PrettyPath.js.map +1 -0
  85. package/dist/api-playground/ApiPlayground/components/SendPill.js +40 -0
  86. package/dist/api-playground/ApiPlayground/components/SendPill.js.map +1 -0
  87. package/dist/api-playground/ApiPlayground/components/TrashButton.js +27 -0
  88. package/dist/api-playground/ApiPlayground/components/TrashButton.js.map +1 -0
  89. package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +53 -0
  90. package/dist/api-playground/ApiPlayground/components/TypeDropdown.js.map +1 -0
  91. package/dist/api-playground/ApiPlayground/index.js +68 -0
  92. package/dist/api-playground/ApiPlayground/index.js.map +1 -0
  93. package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +51 -0
  94. package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js.map +1 -0
  95. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +20 -0
  96. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js.map +1 -0
  97. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +19 -0
  98. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js.map +1 -0
  99. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +29 -0
  100. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js.map +1 -0
  101. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +6 -0
  102. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +1 -0
  103. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +13 -0
  104. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -0
  105. package/dist/api-playground/EndpointFields/components/Description.js +13 -0
  106. package/dist/api-playground/EndpointFields/components/Description.js.map +1 -0
  107. package/dist/api-playground/EndpointFields/components/OneOfDropdown.js +20 -0
  108. package/dist/api-playground/EndpointFields/components/OneOfDropdown.js.map +1 -0
  109. package/dist/api-playground/EndpointFields/components/OptionDropdown.js +36 -0
  110. package/dist/api-playground/EndpointFields/components/OptionDropdown.js.map +1 -0
  111. package/dist/api-playground/EndpointFields/components/SectionHeading.js +44 -0
  112. package/dist/api-playground/EndpointFields/components/SectionHeading.js.map +1 -0
  113. package/dist/api-playground/EndpointFields/index.js +7 -0
  114. package/dist/api-playground/EndpointFields/index.js.map +1 -0
  115. package/dist/api-playground-2/Api.js +13 -0
  116. package/dist/api-playground-2/Api.js.map +1 -0
  117. package/dist/api-playground-2/ApiExamples.js +19 -18
  118. package/dist/api-playground-2/ApiExamples.js.map +1 -1
  119. package/dist/api-playground-2/ApiFields.js +253 -0
  120. package/dist/api-playground-2/ApiFields.js.map +1 -0
  121. package/dist/api-playground-2/EndpointHeader.js +52 -0
  122. package/dist/api-playground-2/EndpointHeader.js.map +1 -0
  123. package/dist/api-playground-2/OperationPage.js +101 -0
  124. package/dist/api-playground-2/OperationPage.js.map +1 -0
  125. package/dist/api-playground-2/Playground.js +136 -0
  126. package/dist/api-playground-2/Playground.js.map +1 -0
  127. package/dist/api-playground-2/SchemaPage.js +14 -0
  128. package/dist/api-playground-2/SchemaPage.js.map +1 -0
  129. package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +88 -0
  130. package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js.map +1 -0
  131. package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +16 -0
  132. package/dist/api-playground-2/components/EndpointFields/fields/Enum.js.map +1 -0
  133. package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js +21 -0
  134. package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js.map +1 -0
  135. package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +57 -0
  136. package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js.map +1 -0
  137. package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +90 -0
  138. package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js.map +1 -0
  139. package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +122 -0
  140. package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js.map +1 -0
  141. package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +75 -0
  142. package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map +1 -0
  143. package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +253 -0
  144. package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js.map +1 -0
  145. package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js +28 -0
  146. package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js.map +1 -0
  147. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +101 -114
  148. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
  149. package/dist/api-playground-2/components/Request/BodySection.js +41 -0
  150. package/dist/api-playground-2/components/Request/BodySection.js.map +1 -0
  151. package/dist/api-playground-2/components/Request/InputSectionContainer.js +66 -0
  152. package/dist/api-playground-2/components/Request/InputSectionContainer.js.map +1 -0
  153. package/dist/api-playground-2/components/Request/ParameterSection.js +36 -0
  154. package/dist/api-playground-2/components/Request/ParameterSection.js.map +1 -0
  155. package/dist/api-playground-2/components/Request/SecuritySection.js +55 -0
  156. package/dist/api-playground-2/components/Request/SecuritySection.js.map +1 -0
  157. package/dist/api-playground-2/components/Request/ServerSection.js +33 -0
  158. package/dist/api-playground-2/components/Request/ServerSection.js.map +1 -0
  159. package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +55 -0
  160. package/dist/api-playground-2/components/Request/inputs/ArrayInput.js.map +1 -0
  161. package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +48 -0
  162. package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js.map +1 -0
  163. package/dist/api-playground-2/components/Request/inputs/FileInput.js +43 -0
  164. package/dist/api-playground-2/components/Request/inputs/FileInput.js.map +1 -0
  165. package/dist/api-playground-2/components/Request/inputs/InputContainer.js +127 -0
  166. package/dist/api-playground-2/components/Request/inputs/InputContainer.js.map +1 -0
  167. package/dist/api-playground-2/components/Request/inputs/NullInput.js +15 -0
  168. package/dist/api-playground-2/components/Request/inputs/NullInput.js.map +1 -0
  169. package/dist/api-playground-2/components/Request/inputs/NumberInput.js +46 -0
  170. package/dist/api-playground-2/components/Request/inputs/NumberInput.js.map +1 -0
  171. package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +104 -0
  172. package/dist/api-playground-2/components/Request/inputs/ObjectInput.js.map +1 -0
  173. package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +77 -0
  174. package/dist/api-playground-2/components/Request/inputs/OneOfInput.js.map +1 -0
  175. package/dist/api-playground-2/components/Request/inputs/SelectInput.js +54 -0
  176. package/dist/api-playground-2/components/Request/inputs/SelectInput.js.map +1 -0
  177. package/dist/api-playground-2/components/Request/inputs/StringInput.js +44 -0
  178. package/dist/api-playground-2/components/Request/inputs/StringInput.js.map +1 -0
  179. package/dist/api-playground-2/components/Request/inputs/TextInput.js +29 -0
  180. package/dist/api-playground-2/components/Request/inputs/TextInput.js.map +1 -0
  181. package/dist/api-playground-2/components/TypeDropdown.js +48 -0
  182. package/dist/api-playground-2/components/TypeDropdown.js.map +1 -0
  183. package/dist/api-playground-2/constants/index.js +15 -4
  184. package/dist/api-playground-2/constants/index.js.map +1 -1
  185. package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +11 -0
  186. package/dist/api-playground-2/contexts/ApiPlaygroundContext.js.map +1 -0
  187. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +6 -6
  188. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
  189. package/dist/api-playground-2/generators/generateSnippet.js +187 -36
  190. package/dist/api-playground-2/generators/generateSnippet.js.map +1 -1
  191. package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +14 -0
  192. package/dist/api-playground-2/hooks/useCopyPathWithInputs.js.map +1 -0
  193. package/dist/api-playground-2/hooks/useInitializeInputs.js +101 -0
  194. package/dist/api-playground-2/hooks/useInitializeInputs.js.map +1 -0
  195. package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +156 -0
  196. package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js.map +1 -0
  197. package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +57 -0
  198. package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js.map +1 -0
  199. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +41 -0
  200. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js.map +1 -0
  201. package/dist/api-playground-2/schemaGraph/errors.js +19 -0
  202. package/dist/api-playground-2/schemaGraph/errors.js.map +1 -0
  203. package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js +26 -0
  204. package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js.map +1 -0
  205. package/dist/api-playground-2/schemaGraph/getDocumentProperties.js +58 -0
  206. package/dist/api-playground-2/schemaGraph/getDocumentProperties.js.map +1 -0
  207. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +77 -0
  208. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js.map +1 -0
  209. package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js +16 -0
  210. package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js.map +1 -0
  211. package/dist/api-playground-2/schemaGraph/processExamples.js +118 -8
  212. package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
  213. package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +107 -0
  214. package/dist/api-playground-2/schemaGraph/processSecurityOptions.js.map +1 -0
  215. package/dist/api-playground-2/schemaGraph/reduceCompositions.js +283 -0
  216. package/dist/api-playground-2/schemaGraph/reduceCompositions.js.map +1 -0
  217. package/dist/api-playground-2/schemaGraph/resolveGraphNode.js +61 -0
  218. package/dist/api-playground-2/schemaGraph/resolveGraphNode.js.map +1 -0
  219. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +149 -0
  220. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js.map +1 -0
  221. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +33 -0
  222. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js.map +1 -0
  223. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +35 -0
  224. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js.map +1 -0
  225. package/dist/api-playground-2/schemaGraph/utils.js +243 -45
  226. package/dist/api-playground-2/schemaGraph/utils.js.map +1 -1
  227. package/dist/api-playground-2/types/index.js +118 -0
  228. package/dist/api-playground-2/types/index.js.map +1 -0
  229. package/dist/common/guards.js +32 -6
  230. package/dist/common/guards.js.map +1 -1
  231. package/dist/common/parseApiTargetFromMetadata.js +24 -0
  232. package/dist/common/parseApiTargetFromMetadata.js.map +1 -0
  233. package/dist/common/parseOpenApiString.js +42 -0
  234. package/dist/common/parseOpenApiString.js.map +1 -0
  235. package/dist/common/potentiallyParseOpenApiString.js +25 -0
  236. package/dist/common/potentiallyParseOpenApiString.js.map +1 -0
  237. package/dist/common/replaceSlashIndex.js +7 -0
  238. package/dist/common/replaceSlashIndex.js.map +1 -0
  239. package/dist/common/slugToTitle.js +11 -0
  240. package/dist/common/slugToTitle.js.map +1 -0
  241. package/dist/components/Api/ApiReferenceProvider.js +6 -15
  242. package/dist/components/Api/ApiReferenceProvider.js.map +1 -1
  243. package/dist/components/Api/Expandable.js +119 -0
  244. package/dist/components/Api/Expandable.js.map +1 -0
  245. package/dist/components/Api/Markdown.js +66 -0
  246. package/dist/components/Api/Markdown.js.map +1 -0
  247. package/dist/components/Api/Param.js +191 -0
  248. package/dist/components/Api/Param.js.map +1 -0
  249. package/dist/components/content-components/code-block.js +68 -61
  250. package/dist/components/content-components/code-block.js.map +1 -1
  251. package/dist/components/content-components/code-group.js +36 -25
  252. package/dist/components/content-components/code-group.js.map +1 -1
  253. package/dist/components/content-components/getNodeText.js +5 -0
  254. package/dist/components/content-components/getNodeText.js.map +1 -0
  255. package/dist/components/nav-tree/index.js +135 -109
  256. package/dist/components/nav-tree/index.js.map +1 -1
  257. package/dist/constants/index.js +5 -0
  258. package/dist/constants/index.js.map +1 -0
  259. package/dist/constants/zIndex.js +7 -0
  260. package/dist/constants/zIndex.js.map +1 -0
  261. package/dist/contexts/ApiPlaygroundInputsContext.js +18 -0
  262. package/dist/contexts/ApiPlaygroundInputsContext.js.map +1 -0
  263. package/dist/contexts/ConfigContext.js +60 -12
  264. package/dist/contexts/ConfigContext.js.map +1 -1
  265. package/dist/contexts/EndpointLocationContext.js +18 -0
  266. package/dist/contexts/EndpointLocationContext.js.map +1 -0
  267. package/dist/contexts/MDXContentContext.js +18 -0
  268. package/dist/contexts/MDXContentContext.js.map +1 -0
  269. package/dist/env.js +6 -1
  270. package/dist/env.js.map +1 -1
  271. package/dist/hooks/useApiPlaygroundInputs.js +7 -0
  272. package/dist/hooks/useApiPlaygroundInputs.js.map +1 -0
  273. package/dist/hooks/useApiPlaygroundPrefillExamples.js +40 -0
  274. package/dist/hooks/useApiPlaygroundPrefillExamples.js.map +1 -0
  275. package/dist/hooks/useBaseUrlOptions.js +19 -0
  276. package/dist/hooks/useBaseUrlOptions.js.map +1 -0
  277. package/dist/hooks/useCheckHash.js +18 -0
  278. package/dist/hooks/useCheckHash.js.map +1 -0
  279. package/dist/hooks/useComponentSchemas.js +10 -0
  280. package/dist/hooks/useComponentSchemas.js.map +1 -0
  281. package/dist/hooks/useEndpoint.js +3 -3
  282. package/dist/hooks/useExpandableMemory.js +46 -0
  283. package/dist/hooks/useExpandableMemory.js.map +1 -0
  284. package/dist/hooks/useGenerateNextAdditionalProperties.js +12 -0
  285. package/dist/hooks/useGenerateNextAdditionalProperties.js.map +1 -0
  286. package/dist/hooks/useGenerateNextItems.js +12 -0
  287. package/dist/hooks/useGenerateNextItems.js.map +1 -0
  288. package/dist/hooks/useGenerateNextProperties.js +12 -0
  289. package/dist/hooks/useGenerateNextProperties.js.map +1 -0
  290. package/dist/hooks/useKeyboardShortcut.js +26 -0
  291. package/dist/hooks/useKeyboardShortcut.js.map +1 -0
  292. package/dist/hooks/useMDXContent.js +7 -0
  293. package/dist/hooks/useMDXContent.js.map +1 -0
  294. package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +10 -0
  295. package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js.map +1 -0
  296. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +16 -0
  297. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js.map +1 -0
  298. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +16 -0
  299. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js.map +1 -0
  300. package/dist/hooks/usePlaygroundSchemaOptions.js +43 -0
  301. package/dist/hooks/usePlaygroundSchemaOptions.js.map +1 -0
  302. package/dist/hooks/usePrefilledInputs/index.js +66 -0
  303. package/dist/hooks/usePrefilledInputs/index.js.map +1 -0
  304. package/dist/hooks/usePrefilledInputs/storedServerVariables.js +30 -0
  305. package/dist/hooks/usePrefilledInputs/storedServerVariables.js.map +1 -0
  306. package/dist/hooks/useSecurityOption.js +11 -0
  307. package/dist/hooks/useSecurityOption.js.map +1 -0
  308. package/dist/hooks/useSendPlaygroundRequest.js +146 -15
  309. package/dist/hooks/useSendPlaygroundRequest.js.map +1 -1
  310. package/dist/hooks/useSetDefaultValue.js +64 -0
  311. package/dist/hooks/useSetDefaultValue.js.map +1 -0
  312. package/dist/index.d.ts +404 -7
  313. package/dist/index.js +159 -112
  314. package/dist/index.js.map +1 -1
  315. package/dist/openapi/filterEnums.js +21 -0
  316. package/dist/openapi/filterEnums.js.map +1 -0
  317. package/dist/openapi/generateNextAdditionalProperties.js +8 -0
  318. package/dist/openapi/generateNextAdditionalProperties.js.map +1 -0
  319. package/dist/openapi/generateNextItems.js +8 -0
  320. package/dist/openapi/generateNextItems.js.map +1 -0
  321. package/dist/openapi/generateNextProperties.js +24 -0
  322. package/dist/openapi/generateNextProperties.js.map +1 -0
  323. package/dist/openapi/generateOptionLabels.js +21 -0
  324. package/dist/openapi/generateOptionLabels.js.map +1 -0
  325. package/dist/openapi/generateSimpleLabels.js +5 -0
  326. package/dist/openapi/generateSimpleLabels.js.map +1 -0
  327. package/dist/openapi/generateTypeStringFromSchema.js +34 -0
  328. package/dist/openapi/generateTypeStringFromSchema.js.map +1 -0
  329. package/dist/openapi/getAuthFilteredSchemaArray.js +19 -0
  330. package/dist/openapi/getAuthFilteredSchemaArray.js.map +1 -0
  331. package/dist/paths/isEqualIgnoringLeadingSlash.js +22 -0
  332. package/dist/paths/isEqualIgnoringLeadingSlash.js.map +1 -0
  333. package/dist/paths/optionallyRemoveLeadingSlash.js +7 -0
  334. package/dist/paths/optionallyRemoveLeadingSlash.js.map +1 -0
  335. package/dist/paths/optionallyRemoveTrailingSlash.js +7 -0
  336. package/dist/paths/optionallyRemoveTrailingSlash.js.map +1 -0
  337. package/dist/styles.css +1 -1
  338. package/dist/utils/api-playground/defaults.js +16 -0
  339. package/dist/utils/api-playground/defaults.js.map +1 -0
  340. package/dist/utils/api-playground/paramFieldDefaults.js +11 -0
  341. package/dist/utils/api-playground/paramFieldDefaults.js.map +1 -0
  342. package/dist/utils/api-reference/getFilteredSecurityOptions.js +5 -0
  343. package/dist/utils/api-reference/getFilteredSecurityOptions.js.map +1 -0
  344. package/dist/utils/api-reference/getNextPropertiesByType.js +6 -0
  345. package/dist/utils/api-reference/getNextPropertiesByType.js.map +1 -0
  346. package/dist/utils/containsMarkdownTable.js +5 -0
  347. package/dist/utils/containsMarkdownTable.js.map +1 -0
  348. package/dist/utils/copyToClipboard.js +12 -0
  349. package/dist/utils/copyToClipboard.js.map +1 -0
  350. package/dist/utils/flattenObject.js +11 -0
  351. package/dist/utils/flattenObject.js.map +1 -0
  352. package/dist/utils/formatJSON.js +39 -0
  353. package/dist/utils/formatJSON.js.map +1 -0
  354. package/dist/utils/scrollElementIntoView.js +21 -0
  355. package/dist/utils/scrollElementIntoView.js.map +1 -0
  356. package/package.json +10 -10
@@ -0,0 +1,65 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useState as a, useMemo as u } from "react";
3
+ import { InputSectionContainer as x } from "../components/InputSectionContainer.js";
4
+ import { TypeDropdown as T } from "../components/TypeDropdown.js";
5
+ import { RecursiveInput as l } from "./inputs/RecursiveInput.js";
6
+ import { Tabs as S } from "../../../components/content-components/tabs/tabs.js";
7
+ import { Tab as I } from "../../../components/content-components/tabs/tab.js";
8
+ const k = ({ body: d, value: o, setValue: n }) => {
9
+ const [y, f] = a(0), [m, h] = a(0), r = u(() => Object.entries(d), [d]), s = r[m] ?? r[0];
10
+ if (s === void 0) return null;
11
+ const [b, { schemaArray: i }] = s;
12
+ return /* @__PURE__ */ t(
13
+ x,
14
+ {
15
+ name: "Body",
16
+ rightElement: r.length > 1 && /* @__PURE__ */ t("div", { onClick: (e) => e.stopPropagation(), className: "mint:text-xs mint:font-mono", children: /* @__PURE__ */ t(
17
+ T,
18
+ {
19
+ options: r.map(([e, c]) => ({
20
+ label: e,
21
+ schema: c
22
+ })),
23
+ selectedIndex: m,
24
+ onSelectOption: (e) => {
25
+ h(e);
26
+ }
27
+ }
28
+ ) }),
29
+ children: i.length > 1 ? /* @__PURE__ */ t(
30
+ S,
31
+ {
32
+ defaultTab: y,
33
+ onClickTab: (e) => f(e),
34
+ className: "mint:mb-0!",
35
+ children: i.map((e, c) => {
36
+ const p = e.title ?? `Option ${c + 1}`;
37
+ return /* @__PURE__ */ t(I, { title: p, children: /* @__PURE__ */ t(
38
+ l,
39
+ {
40
+ schemaArray: [e],
41
+ value: o,
42
+ setValue: n,
43
+ clearValue: o === void 0 ? void 0 : () => n(void 0),
44
+ isBody: !0
45
+ }
46
+ ) }, p);
47
+ })
48
+ }
49
+ ) : /* @__PURE__ */ t(
50
+ l,
51
+ {
52
+ schemaArray: i,
53
+ value: o,
54
+ setValue: n,
55
+ clearValue: o === void 0 ? void 0 : () => n(void 0),
56
+ isBody: !0
57
+ }
58
+ )
59
+ }
60
+ );
61
+ };
62
+ export {
63
+ k as BodySection
64
+ };
65
+ //# sourceMappingURL=BodySection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BodySection.js","sources":["../../../../src/api-playground/ApiPlayground/Request/BodySection.tsx"],"sourcesContent":["'use client';\n\nimport { BodySchema, DataSchemaArray, IncrementalDataSchemaArray } from '@mintlify/validation';\nimport { SetStateAction, useMemo, useState } from 'react';\n\nimport { Tab, Tabs } from '@/components/content-components/tabs';\nimport { NoAnyDataSchema } from '@/hooks/usePlaygroundSchemaOptions';\n\nimport { InputSectionContainer } from '../components/InputSectionContainer';\nimport { TypeDropdown } from '../components/TypeDropdown';\nimport { RecursiveInput } from './inputs/RecursiveInput';\n\ntype BodySectionParams = {\n body: BodySchema;\n value: unknown;\n setValue: (value: unknown) => void;\n};\n\nexport const BodySection = ({ body, value, setValue }: BodySectionParams) => {\n const [selectedSchemaArrayIndex, setSelectedSchemaArrayIndex] = useState(0);\n const [selectedContentTypeIndex, setSelectedContentTypeIndex] = useState(0);\n\n const bodyArray = useMemo(() => {\n return Object.entries(body);\n }, [body]);\n\n const contentTypeAndContent = bodyArray[selectedContentTypeIndex] ?? bodyArray[0];\n if (contentTypeAndContent === undefined) return null;\n\n const [_contentType, { schemaArray }] = contentTypeAndContent;\n\n return (\n <InputSectionContainer\n name=\"Body\"\n rightElement={\n bodyArray.length > 1 && (\n <div onClick={(e) => e.stopPropagation()} className=\"mint:text-xs mint:font-mono\">\n <TypeDropdown\n options={bodyArray.map(([label, schema]) => ({\n label,\n schema: schema as unknown as NoAnyDataSchema,\n }))}\n selectedIndex={selectedContentTypeIndex}\n onSelectOption={(index) => {\n setSelectedContentTypeIndex(index);\n }}\n />\n </div>\n )\n }\n >\n {schemaArray.length > 1 ? (\n <Tabs\n defaultTab={selectedSchemaArrayIndex}\n onClickTab={(index: SetStateAction<number>) => setSelectedSchemaArrayIndex(index)}\n className=\"mint:mb-0!\"\n >\n {schemaArray.map((schema, index) => {\n const title = schema.title ?? `Option ${index + 1}`;\n return (\n <Tab key={title} title={title}>\n <RecursiveInput\n schemaArray={[schema] as DataSchemaArray | IncrementalDataSchemaArray}\n value={value}\n setValue={setValue}\n clearValue={value === undefined ? undefined : () => setValue(undefined)}\n isBody\n />\n </Tab>\n );\n })}\n </Tabs>\n ) : (\n <RecursiveInput\n schemaArray={schemaArray}\n value={value}\n setValue={setValue}\n clearValue={value === undefined ? undefined : () => setValue(undefined)}\n isBody\n />\n )}\n </InputSectionContainer>\n );\n};\n"],"names":["BodySection","body","value","setValue","selectedSchemaArrayIndex","setSelectedSchemaArrayIndex","useState","selectedContentTypeIndex","setSelectedContentTypeIndex","bodyArray","useMemo","contentTypeAndContent","_contentType","schemaArray","jsx","InputSectionContainer","TypeDropdown","label","schema","index","Tabs","title","Tab","Recursive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,gBACpB,OAAAhB;AAAA,gBACA,UAAAC;AAAA,gBACA,YAAYD,MAAU,SAAY,SAAY,MAAMC,EAAS,MAAS;AAAA,gBACtE,QAAM;AAAA,cAAA;AAAA,YAAA,KANAkB,CAQV;AAAA,UAEJ,CAAC;AAAA,QAAA;AAAA,MAAA,IAGH,gBAAAP;AAAA,QAACS;AAAA,QAAA;AAAA,UACC,aAAAV;AAAA,UACA,OAAAX;AAAA,UACA,UAAAC;AAAA,UACA,YAAYD,MAAU,SAAY,SAAY,MAAMC,EAAS,MAAS;AAAA,UACtE,QAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IACR;AAAA,EAAA;AAIR;"}
@@ -0,0 +1,33 @@
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useMemo as p } from "react";
3
+ import { InputSectionContainer as h } from "../components/InputSectionContainer.js";
4
+ import { RecursiveInput as j } from "./inputs/RecursiveInput.js";
5
+ const P = ({ name: d, parameters: c, value: t, setValue: o }) => {
6
+ const s = p(() => Object.entries(c).map(([e, r]) => {
7
+ const i = t[e], m = (n) => {
8
+ const l = { ...t };
9
+ l[e] = n, o(l);
10
+ }, f = i === void 0 ? void 0 : () => {
11
+ const n = { ...t };
12
+ delete n[e], o(n);
13
+ };
14
+ return /* @__PURE__ */ u(
15
+ j,
16
+ {
17
+ name: e,
18
+ schemaArray: r.schema,
19
+ style: r.style,
20
+ explode: r.explode,
21
+ value: i,
22
+ setValue: m,
23
+ clearValue: f
24
+ },
25
+ e
26
+ );
27
+ }), [c, o, t]);
28
+ return s.length === 0 ? null : /* @__PURE__ */ u(h, { name: d, children: s });
29
+ };
30
+ export {
31
+ P as ParameterSection
32
+ };
33
+ //# sourceMappingURL=ParameterSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParameterSection.js","sources":["../../../../src/api-playground/ApiPlayground/Request/ParameterSection.tsx"],"sourcesContent":["'use client';\n\nimport { ParameterGroup } from '@mintlify/validation';\nimport { useMemo } from 'react';\n\nimport { InputSectionContainer } from '../components/InputSectionContainer';\nimport { RecursiveInput } from './inputs/RecursiveInput';\n\ntype ParameterSectionParams = {\n name: string;\n parameters: ParameterGroup;\n value: Record<string, unknown>;\n setValue: (value: Record<string, unknown>) => void;\n};\n\nexport const ParameterSection = ({ name, parameters, value, setValue }: ParameterSectionParams) => {\n const inputs = useMemo(() => {\n return Object.entries(parameters).map(([paramName, parameter]) => {\n const paramValue = value[paramName];\n const setParamValue = (newParamValue: unknown) => {\n const newObj = { ...value };\n newObj[paramName] = newParamValue;\n setValue(newObj);\n };\n\n const clearParamValue =\n paramValue === undefined\n ? undefined\n : () => {\n const newObj = { ...value };\n delete newObj[paramName];\n setValue(newObj);\n };\n\n return (\n <RecursiveInput\n key={paramName}\n name={paramName}\n schemaArray={parameter.schema}\n style={parameter.style}\n explode={parameter.explode}\n value={paramValue}\n setValue={setParamValue}\n clearValue={clearParamValue}\n />\n );\n });\n }, [parameters, setValue, value]);\n\n if (inputs.length === 0) {\n return null;\n }\n\n return <InputSectionContainer name={name}>{inputs}</InputSectionContainer>;\n};\n"],"names":["ParameterSection","name","parameters","value","setValue","inputs","useMemo","paramName","parameter","paramValue","setParamValue","newParamValue","newObj","clearParamValue","jsx","RecursiveInput","InputSectionContainer"],"mappings":";;;;AAeO,MAAMA,IAAmB,CAAC,EAAE,MAAAC,GAAM,YAAAC,GAAY,OAAAC,GAAO,UAAAC,QAAuC;AACjG,QAAMC,IAASC,EAAQ,MACd,OAAO,QAAQJ,CAAU,EAAE,IAAI,CAAC,CAACK,GAAWC,CAAS,MAAM;AAChE,UAAMC,IAAaN,EAAMI,CAAS,GAC5BG,IAAgB,CAACC,MAA2B;AAChD,YAAMC,IAAS,EAAE,GAAGT,EAAA;AACpB,MAAAS,EAAOL,CAAS,IAAII,GACpBP,EAASQ,CAAM;AAAA,IACjB,GAEMC,IACJJ,MAAe,SACX,SACA,MAAM;AACJ,YAAMG,IAAS,EAAE,GAAGT,EAAA;AACpB,aAAOS,EAAOL,CAAS,GACvBH,EAASQ,CAAM;AAAA,IACjB;AAEN,WACE,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QAEC,MAAMR;AAAA,QACN,aAAaC,EAAU;AAAA,QACvB,OAAOA,EAAU;AAAA,QACjB,SAASA,EAAU;AAAA,QACnB,OAAOC;AAAA,QACP,UAAUC;AAAA,QACV,YAAYG;AAAA,MAAA;AAAA,MAPPN;AAAA,IAAA;AAAA,EAUX,CAAC,GACA,CAACL,GAAYE,GAAUD,CAAK,CAAC;AAEhC,SAAIE,EAAO,WAAW,IACb,OAGF,gBAAAS,EAACE,GAAA,EAAsB,MAAAf,GAAa,UAAAI,EAAA,CAAO;AACpD;"}
@@ -0,0 +1,202 @@
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import { useState as C, useContext as B, useEffect as J } from "react";
3
+ import { DescriptionWithoutHeaders as H } from "../../EndpointFields/components/Description.js";
4
+ import { useApiPlaygroundPrefillExamples as I } from "../../../hooks/useApiPlaygroundPrefillExamples.js";
5
+ import { useMDXContent as R } from "../../../hooks/useMDXContent.js";
6
+ import { parseAuthInputsFromUserInfo as G } from "../../../hooks/usePrefilledInputs/index.js";
7
+ import { useSecurityOption as U } from "../../../hooks/useSecurityOption.js";
8
+ import { getDefaultsFromParameterGroup as W, getDefaultFromSchema as Q } from "../../../utils/api-playground/defaults.js";
9
+ import { paramFieldDefaults as w } from "../../../utils/api-playground/paramFieldDefaults.js";
10
+ import { getFilteredSecurityOptions as X } from "../../../utils/api-reference/getFilteredSecurityOptions.js";
11
+ import "@mintlify/validation";
12
+ import { cn as z } from "../../../utils/cn.js";
13
+ import { ApiPlaygroundContext as K } from "../ApiPlaygroundContext.js";
14
+ import { Response as P } from "../Response/index.js";
15
+ import { EndpointsMenu as L } from "../components/EndpointsMenu.js";
16
+ import { PathHeader as T, SendPill as Y } from "../components/PathHeader.js";
17
+ import { PlaygroundModalWrapper as Z } from "../components/PlaygroundModalWrapper.js";
18
+ import { BodySection as _ } from "./BodySection.js";
19
+ import { ParameterSection as y } from "./ParameterSection.js";
20
+ import { SecuritySection as $ } from "./SecuritySection.js";
21
+ import { ServerSection as ee } from "./ServerSection.js";
22
+ import { ApiExamples as te } from "../../../api-playground-2/ApiExamples.js";
23
+ function Oe({
24
+ endpoint: t,
25
+ inputs: a,
26
+ setInputs: m,
27
+ pathname: j
28
+ }) {
29
+ var k;
30
+ const [{ pageMetadata: b }] = R(), [v, A] = C(0), { prefillExamplesEnabled: f, generatedRequestExampleData: p } = I(), S = U(t.request.security), {
31
+ isSending: E,
32
+ selectedBaseUrlIndex: D,
33
+ isPlaygroundExpanded: g,
34
+ setIsPlaygroundExpanded: F,
35
+ sendRequest: M,
36
+ result: l,
37
+ selectedExampleIndex: d
38
+ } = B(K), h = (k = t.servers) == null ? void 0 : k[D], q = X(t), V = q[v], n = h == null ? void 0 : h.variables;
39
+ return J(() => {
40
+ var N;
41
+ if (!g) return;
42
+ const e = f ? p[d ?? 0] : JSON.parse(JSON.stringify(a));
43
+ if (n) {
44
+ const i = {};
45
+ Object.entries(n).forEach(([o, c]) => {
46
+ e.server[o] === void 0 && (i[o] = String(c.default));
47
+ }), e.server = { ...e.server, ...i };
48
+ }
49
+ [
50
+ ["header", t.request.parameters.header],
51
+ ["path", t.request.parameters.path],
52
+ ["query", t.request.parameters.query],
53
+ ["cookie", t.request.parameters.cookie]
54
+ ].forEach(([i, o]) => {
55
+ var O;
56
+ const c = f ? (O = p[d ?? 0]) == null ? void 0 : O[i] : W(o);
57
+ e[i] = {
58
+ ...c,
59
+ ...w[i],
60
+ ...e[i]
61
+ };
62
+ });
63
+ const x = G(
64
+ S
65
+ );
66
+ e.query = { ...e.query, ...x.query }, e.header = { ...e.header, ...x.header }, e.cookie = { ...e.cookie, ...x.cookie };
67
+ const u = Object.values(t.request.body)[0];
68
+ if (u != null && u.schemaArray.length) {
69
+ const i = f ? (N = p[d ?? 0]) == null ? void 0 : N.body : Q(u.schemaArray[0]), o = w.body;
70
+ if (typeof i == "object" && i !== null)
71
+ e.body = Object.assign(
72
+ {},
73
+ i,
74
+ o,
75
+ typeof e.body == "object" && e.body !== null && !Array.isArray(e.body) ? e.body : {}
76
+ );
77
+ else if (Object.keys(o).length) {
78
+ const c = typeof e.body == "object" && e.body !== null && !Array.isArray(e.body) ? e.body : {};
79
+ e.body = { ...o, ...c };
80
+ } else e.body === void 0 && i !== void 0 && (e.body = i);
81
+ }
82
+ JSON.stringify(e) !== JSON.stringify(a) && m(e);
83
+ }, [g, t, d, S]), /* @__PURE__ */ s(
84
+ Z,
85
+ {
86
+ isPlaygroundExpanded: g,
87
+ setIsPlaygroundExpanded: F,
88
+ children: [
89
+ /* @__PURE__ */ s("div", { className: "mint:flex mint:items-center mint:justify-between mint:gap-x-2", children: [
90
+ /* @__PURE__ */ r(L, { endpoint: t, pathname: j }),
91
+ /* @__PURE__ */ r(T, { endpoint: t, hasGrayBackground: !0, display: "interactive" }),
92
+ /* @__PURE__ */ r(
93
+ Y,
94
+ {
95
+ label: "Send",
96
+ method: t.method,
97
+ isSending: E,
98
+ onClick: M,
99
+ className: "mint:w-20"
100
+ }
101
+ )
102
+ ] }),
103
+ /* @__PURE__ */ s("div", { className: "mint:grid mint:grid-cols-1 mint:lg:grid-cols-5 mint:gap-x-8 mint:gap-y-6 mint:mt-5 mint:relative", children: [
104
+ /* @__PURE__ */ s("div", { className: "mint:col-span-1 mint:lg:col-span-3", children: [
105
+ /* @__PURE__ */ s("div", { className: "mint:space-y-1 mint:min-w-full mint:w-full mint:max-w-full mint:overflow-hidden", children: [
106
+ /* @__PURE__ */ r("div", { className: "mint:text-base mint:font-medium mint:text-gray-900 mint:dark:text-white mint:max-w-full", children: t.title }),
107
+ /* @__PURE__ */ r("div", { className: "mint:flex mint:items-start mint:gap-x-12 mint:justify-between mint:max-w-full! mint:overflow-x-auto", children: b.description && /* @__PURE__ */ r(
108
+ H,
109
+ {
110
+ markdown: b.description,
111
+ className: "mint:text-sm mint:text-gray-500 mint:dark:text-gray-400"
112
+ }
113
+ ) })
114
+ ] }),
115
+ l && /* @__PURE__ */ r(P, { result: l, className: "mint:mt-6 mint:block mint:lg:hidden" }),
116
+ /* @__PURE__ */ s("div", { className: "mint:space-y-2 mint:mt-6", children: [
117
+ n && Object.keys(n).length > 0 && /* @__PURE__ */ r(
118
+ ee,
119
+ {
120
+ variables: n,
121
+ value: a.server,
122
+ setValue: (e) => m({ ...a, server: e })
123
+ }
124
+ ),
125
+ V && /* @__PURE__ */ r(
126
+ $,
127
+ {
128
+ inputs: a,
129
+ setInputs: m,
130
+ securityOptions: q,
131
+ selectedSecurityOptionIndex: v,
132
+ setSelectedSecurityOptionIndex: A
133
+ }
134
+ ),
135
+ /* @__PURE__ */ r(
136
+ y,
137
+ {
138
+ name: "Header",
139
+ value: a.header,
140
+ setValue: (e) => m({ ...a, header: e }),
141
+ parameters: t.request.parameters.header
142
+ }
143
+ ),
144
+ /* @__PURE__ */ r(
145
+ y,
146
+ {
147
+ name: "Cookie",
148
+ value: a.cookie,
149
+ setValue: (e) => m({ ...a, cookie: e }),
150
+ parameters: t.request.parameters.cookie
151
+ }
152
+ ),
153
+ /* @__PURE__ */ r(
154
+ y,
155
+ {
156
+ name: "Path",
157
+ value: a.path,
158
+ setValue: (e) => m({ ...a, path: e }),
159
+ parameters: t.request.parameters.path
160
+ }
161
+ ),
162
+ /* @__PURE__ */ r(
163
+ y,
164
+ {
165
+ name: "Query",
166
+ value: a.query,
167
+ setValue: (e) => m({ ...a, query: e }),
168
+ parameters: t.request.parameters.query
169
+ }
170
+ ),
171
+ /* @__PURE__ */ r(
172
+ _,
173
+ {
174
+ value: a.body,
175
+ setValue: (e) => m({ ...a, body: e }),
176
+ body: t.request.body
177
+ }
178
+ )
179
+ ] })
180
+ ] }),
181
+ /* @__PURE__ */ s(
182
+ "div",
183
+ {
184
+ className: z(
185
+ "mint:p-px mint:col-span-1 mint:lg:col-span-2 mint:lg:space-y-6 mint:lg:flex mint:lg:sticky mint:lg:top-0 mint:lg:self-start mint:lg:h-[calc(100vh-5.5rem)]",
186
+ l && "mint:lg:flex-col mint:overflow-y-auto mint:lg:-top-12 mint:lg:h-screen"
187
+ ),
188
+ children: [
189
+ l && /* @__PURE__ */ r(P, { result: l, className: "mint:hidden mint:lg:block mint:min-h-fit" }),
190
+ /* @__PURE__ */ r(te, { isModal: !0, "data-testid": "api-playground-request-example", className: "mint:xl:w-full" })
191
+ ]
192
+ }
193
+ )
194
+ ] })
195
+ ]
196
+ }
197
+ );
198
+ }
199
+ export {
200
+ Oe as PlaygroundModal
201
+ };
202
+ //# sourceMappingURL=PlaygroundModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaygroundModal.js","sources":["../../../../src/api-playground/ApiPlayground/Request/PlaygroundModal.tsx"],"sourcesContent":["'use client';\n\nimport { ApiPlaygroundInputs, Endpoint } from '@mintlify/validation';\nimport { useContext, useState, useEffect } from 'react';\n\nimport { DescriptionWithoutHeaders } from '@/api-playground/EndpointFields/components/Description';\nimport { useApiPlaygroundPrefillExamples } from '@/hooks/useApiPlaygroundPrefillExamples';\nimport { useMDXContent } from '@/hooks/useMDXContent';\nimport { parseAuthInputsFromUserInfo } from '@/hooks/usePrefilledInputs';\nimport { useSecurityOption } from '@/hooks/useSecurityOption';\nimport {\n getDefaultsFromParameterGroup,\n getDefaultFromSchema,\n} from '@/utils/api-playground/defaults';\nimport { paramFieldDefaults } from '@/utils/api-playground/paramFieldDefaults';\nimport { getFilteredSecurityOptions } from '@/utils/api-reference/getFilteredSecurityOptions';\nimport { cn } from '@/api-playground-2/schemaGraph/utils';\n\nimport { ApiPlaygroundContext } from '../ApiPlaygroundContext';\nimport { Response } from '../Response';\nimport { EndpointsMenu } from '../components/EndpointsMenu';\nimport { PathHeader, SendPill } from '../components/PathHeader';\nimport { PlaygroundModalWrapper } from '../components/PlaygroundModalWrapper';\nimport { BodySection } from './BodySection';\nimport { ParameterSection } from './ParameterSection';\nimport { SecuritySection } from './SecuritySection';\nimport { ServerSection } from './ServerSection';\nimport ApiExamples from '@/api-playground-2/ApiExamples';\n\nexport function PlaygroundModal({\n endpoint,\n inputs,\n setInputs,\n pathname,\n}: {\n endpoint: Endpoint;\n inputs: ApiPlaygroundInputs;\n setInputs: (inputs: ApiPlaygroundInputs) => void;\n pathname: string;\n}) {\n const [{ pageMetadata }] = useMDXContent();\n const [selectedSecurityOptionIndex, setSelectedSecurityOptionIndex] = useState(0);\n const { prefillExamplesEnabled, generatedRequestExampleData } = useApiPlaygroundPrefillExamples();\n const securityOption = useSecurityOption(endpoint.request.security);\n\n const {\n isSending,\n selectedBaseUrlIndex,\n isPlaygroundExpanded,\n setIsPlaygroundExpanded,\n sendRequest,\n result,\n selectedExampleIndex,\n } = useContext(ApiPlaygroundContext);\n const server = endpoint.servers?.[selectedBaseUrlIndex];\n\n const filteredSecurityOptions = getFilteredSecurityOptions(endpoint);\n\n const selectedSecurityOption = filteredSecurityOptions[selectedSecurityOptionIndex];\n\n const variables = server?.variables;\n\n useEffect(() => {\n if (!isPlaygroundExpanded) return;\n\n const nextInputs: ApiPlaygroundInputs = prefillExamplesEnabled\n ? generatedRequestExampleData[selectedExampleIndex ?? 0]\n : JSON.parse(JSON.stringify(inputs));\n\n if (variables) {\n const serverDefaults: Record<string, string> = {};\n Object.entries(variables).forEach(([k, v]) => {\n if (nextInputs.server[k] === undefined) {\n serverDefaults[k] = String(v.default);\n }\n });\n nextInputs.server = { ...nextInputs.server, ...serverDefaults };\n }\n\n const paramSections: Array<\n ['header' | 'path' | 'query' | 'cookie', typeof endpoint.request.parameters.header]\n > = [\n ['header', endpoint.request.parameters.header],\n ['path', endpoint.request.parameters.path],\n ['query', endpoint.request.parameters.query],\n ['cookie', endpoint.request.parameters.cookie],\n ];\n\n paramSections.forEach(([section, group]) => {\n const spec = prefillExamplesEnabled\n ? generatedRequestExampleData[selectedExampleIndex ?? 0]?.[section]\n : getDefaultsFromParameterGroup(group);\n\n nextInputs[section] = {\n ...spec,\n ...paramFieldDefaults[section],\n ...nextInputs[section],\n };\n });\n\n const userInfoAuthInputs = parseAuthInputsFromUserInfo(\n securityOption,\n undefined\n );\n\n nextInputs.query = { ...nextInputs.query, ...userInfoAuthInputs.query };\n nextInputs.header = { ...nextInputs.header, ...userInfoAuthInputs.header };\n nextInputs.cookie = { ...nextInputs.cookie, ...userInfoAuthInputs.cookie };\n\n const bodyEntry = Object.values(endpoint.request.body)[0];\n if (bodyEntry?.schemaArray.length) {\n const bodyDefaultFromSpec = prefillExamplesEnabled\n ? generatedRequestExampleData[selectedExampleIndex ?? 0]?.body\n : getDefaultFromSchema(bodyEntry.schemaArray[0]);\n\n const bodyDefaultsFromParamField: Record<string, unknown> = paramFieldDefaults.body;\n\n if (typeof bodyDefaultFromSpec === 'object' && bodyDefaultFromSpec !== null) {\n nextInputs.body = Object.assign(\n {},\n bodyDefaultFromSpec,\n bodyDefaultsFromParamField,\n typeof nextInputs.body === 'object' &&\n nextInputs.body !== null &&\n !Array.isArray(nextInputs.body)\n ? nextInputs.body\n : {}\n );\n } else if (Object.keys(bodyDefaultsFromParamField).length) {\n const existingBody =\n typeof nextInputs.body === 'object' &&\n nextInputs.body !== null &&\n !Array.isArray(nextInputs.body)\n ? nextInputs.body\n : {};\n nextInputs.body = { ...bodyDefaultsFromParamField, ...existingBody };\n } else if (nextInputs.body === undefined && bodyDefaultFromSpec !== undefined) {\n nextInputs.body = bodyDefaultFromSpec;\n }\n }\n\n if (JSON.stringify(nextInputs) !== JSON.stringify(inputs)) {\n setInputs(nextInputs);\n }\n }, [isPlaygroundExpanded, endpoint, selectedExampleIndex, securityOption]);\n\n return (\n <PlaygroundModalWrapper\n isPlaygroundExpanded={isPlaygroundExpanded}\n setIsPlaygroundExpanded={setIsPlaygroundExpanded}\n >\n <div className=\"mint:flex mint:items-center mint:justify-between mint:gap-x-2\">\n <EndpointsMenu endpoint={endpoint} pathname={pathname} />\n <PathHeader endpoint={endpoint} hasGrayBackground display=\"interactive\" />\n <SendPill\n label=\"Send\"\n method={endpoint.method}\n isSending={isSending}\n onClick={sendRequest}\n className=\"mint:w-20\"\n />\n </div>\n <div className=\"mint:grid mint:grid-cols-1 mint:lg:grid-cols-5 mint:gap-x-8 mint:gap-y-6 mint:mt-5 mint:relative\">\n <div className=\"mint:col-span-1 mint:lg:col-span-3\">\n <div className=\"mint:space-y-1 mint:min-w-full mint:w-full mint:max-w-full mint:overflow-hidden\">\n <div className=\"mint:text-base mint:font-medium mint:text-gray-900 mint:dark:text-white mint:max-w-full\">\n {endpoint.title}\n </div>\n <div className=\"mint:flex mint:items-start mint:gap-x-12 mint:justify-between mint:max-w-full! mint:overflow-x-auto\">\n {pageMetadata.description && (\n <DescriptionWithoutHeaders\n markdown={pageMetadata.description}\n className=\"mint:text-sm mint:text-gray-500 mint:dark:text-gray-400\"\n />\n )}\n </div>\n </div>\n {result && <Response result={result} className=\"mint:mt-6 mint:block mint:lg:hidden\" />}\n <div className=\"mint:space-y-2 mint:mt-6\">\n {variables && Object.keys(variables).length > 0 && (\n <ServerSection\n variables={variables}\n value={inputs.server}\n setValue={(server) => setInputs({ ...inputs, server })}\n />\n )}\n {selectedSecurityOption && (\n <SecuritySection\n inputs={inputs}\n setInputs={setInputs}\n securityOptions={filteredSecurityOptions}\n selectedSecurityOptionIndex={selectedSecurityOptionIndex}\n setSelectedSecurityOptionIndex={setSelectedSecurityOptionIndex}\n />\n )}\n <ParameterSection\n name=\"Header\"\n value={inputs.header}\n setValue={(header) => setInputs({ ...inputs, header })}\n parameters={endpoint.request.parameters.header}\n />\n <ParameterSection\n name=\"Cookie\"\n value={inputs.cookie}\n setValue={(cookie) => setInputs({ ...inputs, cookie })}\n parameters={endpoint.request.parameters.cookie}\n />\n <ParameterSection\n name=\"Path\"\n value={inputs.path}\n setValue={(path) => setInputs({ ...inputs, path })}\n parameters={endpoint.request.parameters.path}\n />\n <ParameterSection\n name=\"Query\"\n value={inputs.query}\n setValue={(query) => setInputs({ ...inputs, query })}\n parameters={endpoint.request.parameters.query}\n />\n <BodySection\n value={inputs.body}\n setValue={(body) => setInputs({ ...inputs, body })}\n body={endpoint.request.body}\n />\n </div>\n </div>\n <div\n className={cn(\n 'mint:p-px mint:col-span-1 mint:lg:col-span-2 mint:lg:space-y-6 mint:lg:flex mint:lg:sticky mint:lg:top-0 mint:lg:self-start mint:lg:h-[calc(100vh-5.5rem)]',\n result && 'mint:lg:flex-col mint:overflow-y-auto mint:lg:-top-12 mint:lg:h-screen'\n )}\n >\n {result && <Response result={result} className=\"mint:hidden mint:lg:block mint:min-h-fit\" />}\n <ApiExamples isModal data-testid=\"api-playground-request-example\" className=\"mint:xl:w-full\" />\n </div>\n </div>\n </PlaygroundModalWrapper>\n );\n}\n"],"names":["PlaygroundModal","endpoint","inputs","setInputs","pathname","pageMetadata","useMDXContent","selectedSecurityOptionIndex","setSelectedSecurityOptionIndex","useState","prefillExamplesEnabled","generatedRequestExampleData","useApiPlaygroundPrefillExamples","securityOption","useSecurityOption","isSending","selectedBaseUrlIndex","isPlaygroundExpanded","setIsPlaygroundExpanded","sendRequest","result","selectedExampleIndex","useContext","ApiPlaygroundContext","server","_a","filteredSecurityOptions","getFilteredSecurityOptions","selectedSecurityOption","variables","useEffect","nextInputs","serverDefaults","k","v","section","group","spec","getDefaultsFromParameterGroup","paramFieldDefaults","userInfoAuthInputs","parseAuthInputsFromUserInfo","bodyEntry","bodyDefaultFromSpec","getDefaultFromSchema","bodyDefaultsFromParamField","existingBody","jsxs","PlaygroundModalWrapper","jsx","EndpointsMenu","PathHeader","SendPill","DescriptionWithoutHeaders","Response","ServerSection","SecuritySection","ParameterSection","header","cookie","path","query","BodySection","body","cn","ApiExamples"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BO,SAASA,GAAgB;AAAA,EAC9B,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AACF,GAKG;;AACD,QAAM,CAAC,EAAE,cAAAC,GAAc,IAAIC,EAAA,GACrB,CAACC,GAA6B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vD,EAAO;AAAA,kBACd,UAAU,CAAC2D,MAAU1D,EAAU,EAAE,GAAGD,GAAQ,OAAA2D,GAAO;AAAA,kBACnD,YAAY5D,EAAS,QAAQ,WAAW;AAAA,gBAAA;AAAA,cAAA;AAAA,cAE1C,gBAAAgD;AAAA,gBAACa;AAAA,gBAAA;AAAA,kBACC,OAAO5D,EAAO;AAAA,kBACd,UAAU,CAAC6D,MAAS5D,EAAU,EAAE,GAAGD,GAAQ,MAAA6D,GAAM;AAAA,kBACjD,MAAM9D,EAAS,QAAQ;AAAA,gBAAA;AAAA,cAAA;AAAA,YACzB,EAAA,CACF;AAAA,UAAA,GACF;AAAA,UACA,gBAAA8C;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWiB;AAAA,gBACT;AAAA,gBACA5C,KAAU;AAAA,cAAA;AAAA,cAGX,UAAA;AAAA,gBAAAA,KAAU,gBAAA6B,EAACK,GAAA,EAAS,QAAAlC,GAAgB,WAAU,4CAA2C;AAAA,kCACzF6C,IAAA,EAAY,SAAO,IAAC,eAAY,kCAAiC,WAAU,iBAAA,CAAiB;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAC/F,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,147 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { useMemo as y } from "react";
3
+ import "@mintlify/validation";
4
+ import { cn as b } from "../../../utils/cn.js";
5
+ import { InputSectionContainer as g } from "../components/InputSectionContainer.js";
6
+ import { TypeDropdown as w } from "../components/TypeDropdown.js";
7
+ import { RecursiveInput as P } from "./inputs/RecursiveInput.js";
8
+ const B = "Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.", S = "Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.", V = "The access token received from the authorization server in the OAuth 2.0 flow.", M = ({
9
+ inputs: e,
10
+ setInputs: t,
11
+ securityOptions: o,
12
+ selectedSecurityOptionIndex: s,
13
+ setSelectedSecurityOptionIndex: c
14
+ }) => {
15
+ const n = o[s], h = y(() => n ? ["header", "query", "cookie"].flatMap(
16
+ (r) => Object.entries(n.parameters[r]).map(([i, f]) => {
17
+ const {
18
+ schemaArray: p,
19
+ transform: l,
20
+ value: u
21
+ } = j(f, e[r][i]);
22
+ return /* @__PURE__ */ d(
23
+ P,
24
+ {
25
+ name: i,
26
+ schemaArray: p,
27
+ value: u,
28
+ setValue: (a) => {
29
+ const m = {
30
+ ...e,
31
+ [r]: { ...e[r] }
32
+ };
33
+ m[r][i] = l(a), t(m);
34
+ },
35
+ clearValue: u === void 0 ? void 0 : () => {
36
+ const a = {
37
+ ...e,
38
+ [r]: { ...e[r] }
39
+ };
40
+ delete a[r][i], t(a);
41
+ }
42
+ },
43
+ `${r}:${i}`
44
+ );
45
+ })
46
+ ) : null, [n, t, e]);
47
+ return /* @__PURE__ */ d(
48
+ g,
49
+ {
50
+ name: "Authorization",
51
+ rightElement: /* @__PURE__ */ d(
52
+ "div",
53
+ {
54
+ onClick: (r) => r.stopPropagation(),
55
+ className: b("mint:text-xs mint:font-mono", o.length <= 1 && "mint:hidden"),
56
+ children: /* @__PURE__ */ d(
57
+ w,
58
+ {
59
+ options: o.map((r) => ({
60
+ label: r.title,
61
+ schema: r
62
+ })),
63
+ selectedIndex: s,
64
+ onSelectOption: (r) => {
65
+ c(r);
66
+ }
67
+ }
68
+ )
69
+ }
70
+ ),
71
+ children: h
72
+ }
73
+ );
74
+ }, j = (e, t) => ({
75
+ schemaArray: x(e),
76
+ transform: A(e),
77
+ value: q(e, t)
78
+ }), x = (e) => {
79
+ const t = k(e);
80
+ switch (e.type) {
81
+ case "apiKey":
82
+ return [
83
+ {
84
+ type: "string",
85
+ required: !0,
86
+ description: t,
87
+ default: e["x-default"]
88
+ }
89
+ ];
90
+ case "http":
91
+ return e.scheme === "basic" ? [
92
+ {
93
+ type: "object",
94
+ required: !0,
95
+ description: t,
96
+ properties: {
97
+ username: [{ type: "string" }],
98
+ password: [{ type: "string" }]
99
+ },
100
+ additionalProperties: !1,
101
+ default: e["x-default"]
102
+ }
103
+ ] : [
104
+ {
105
+ type: "string",
106
+ required: !0,
107
+ format: "bearer",
108
+ description: t,
109
+ default: e["x-default"]
110
+ }
111
+ ];
112
+ case "oauth2":
113
+ return [
114
+ {
115
+ type: "string",
116
+ required: !0,
117
+ format: "bearer",
118
+ description: t
119
+ }
120
+ ];
121
+ }
122
+ }, k = (e) => {
123
+ switch (e.type) {
124
+ case "apiKey":
125
+ return e.description;
126
+ case "http":
127
+ return e.description ?? (e.scheme === "basic" ? B : S);
128
+ case "oauth2":
129
+ return e.description ?? V;
130
+ }
131
+ }, q = (e, t) => {
132
+ if (e.type !== "http" || e.scheme !== "basic" || typeof t != "string" || !t.startsWith("Basic "))
133
+ return t;
134
+ const o = t.slice(6), s = Buffer.from(o, "base64").toString("utf-8"), [c, n] = s.split(":");
135
+ return { username: c, password: n };
136
+ }, A = (e) => e.type !== "http" || e.scheme !== "basic" ? (t) => t : (t) => {
137
+ const o = t && typeof t == "object" && "username" in t ? t.username : void 0, s = t && typeof t == "object" && "password" in t ? t.password : void 0, c = `${o ?? ""}:${s ?? ""}`;
138
+ return `Basic ${Buffer.from(c).toString("base64")}`;
139
+ };
140
+ export {
141
+ M as SecuritySection,
142
+ B as basicDescription,
143
+ S as bearerDescription,
144
+ k as getDescriptionForSecurityParameter,
145
+ V as oauth2Description
146
+ };
147
+ //# sourceMappingURL=SecuritySection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecuritySection.js","sources":["../../../../src/api-playground/ApiPlayground/Request/SecuritySection.tsx"],"sourcesContent":["'use client';\n\nimport {\n ApiPlaygroundInputs,\n DataSchemaArray,\n SecurityOption,\n SecurityParameterSchema,\n} from '@mintlify/validation';\nimport { useMemo } from 'react';\n\nimport { NoAnyDataSchema } from '@/hooks/usePlaygroundSchemaOptions';\nimport { cn } from '@/api-playground-2/schemaGraph/utils';\n\nimport { InputSectionContainer } from '../components/InputSectionContainer';\nimport { TypeDropdown } from '../components/TypeDropdown';\nimport { RecursiveInput } from './inputs/RecursiveInput';\n\nexport const basicDescription =\n 'Basic authentication header of the form `Basic <encoded-value>`, where `<encoded-value>` is the base64-encoded string `username:password`.';\nexport const bearerDescription =\n 'Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.';\nexport const oauth2Description =\n 'The access token received from the authorization server in the OAuth 2.0 flow.';\n\ntype SecuritySectionParams = {\n inputs: ApiPlaygroundInputs;\n setInputs: (inputs: ApiPlaygroundInputs) => void;\n securityOptions: SecurityOption[];\n selectedSecurityOptionIndex: number;\n setSelectedSecurityOptionIndex: (index: number) => void;\n};\n\nexport const SecuritySection = ({\n inputs,\n setInputs,\n securityOptions,\n selectedSecurityOptionIndex,\n setSelectedSecurityOptionIndex,\n}: SecuritySectionParams) => {\n const selectedSecurityOption = securityOptions[selectedSecurityOptionIndex];\n\n const parameters = useMemo(() => {\n if (!selectedSecurityOption) return null;\n\n return (['header', 'query', 'cookie'] as const).flatMap((location) =>\n Object.entries(selectedSecurityOption.parameters[location]).map(([name, parameter]) => {\n const {\n schemaArray,\n transform,\n value: paramValue,\n } = getPropsForParameter(parameter, inputs[location][name]);\n\n const setParamValue = (paramValue: unknown) => {\n const newObj = {\n ...inputs,\n [location]: { ...inputs[location] },\n };\n newObj[location][name] = transform(paramValue);\n setInputs(newObj);\n };\n\n const clearParamValue =\n paramValue === undefined\n ? undefined\n : () => {\n const newObj = {\n ...inputs,\n [location]: { ...inputs[location] },\n };\n delete newObj[location][name];\n setInputs(newObj);\n };\n\n return (\n <RecursiveInput\n name={name}\n key={`${location}:${name}`}\n schemaArray={schemaArray}\n value={paramValue}\n setValue={setParamValue}\n clearValue={clearParamValue}\n />\n );\n })\n );\n }, [selectedSecurityOption, setInputs, inputs]);\n\n return (\n <InputSectionContainer\n name=\"Authorization\"\n rightElement={\n <div\n onClick={(e) => e.stopPropagation()}\n className={cn('mint:text-xs mint:font-mono', securityOptions.length <= 1 && 'mint:hidden')}\n >\n <TypeDropdown\n options={securityOptions.map((option) => ({\n label: option.title,\n \n schema: option as unknown as NoAnyDataSchema,\n }))}\n selectedIndex={selectedSecurityOptionIndex}\n onSelectOption={(index) => {\n setSelectedSecurityOptionIndex(index);\n }}\n />\n </div>\n }\n >\n {parameters}\n </InputSectionContainer>\n );\n};\n\nconst getPropsForParameter = (parameter: SecurityParameterSchema, value: unknown) => {\n return {\n schemaArray: getSchemaArrayForParameter(parameter),\n transform: getTransformForParameter(parameter),\n value: parseValueForParameter(parameter, value),\n };\n};\n\nconst getSchemaArrayForParameter = (parameter: SecurityParameterSchema): DataSchemaArray => {\n const description = getDescriptionForSecurityParameter(parameter);\n switch (parameter.type) {\n case 'apiKey':\n return [\n {\n type: 'string',\n required: true,\n description,\n \n default: parameter['x-default' as never],\n },\n ];\n case 'http':\n return parameter.scheme === 'basic'\n ? [\n {\n type: 'object',\n required: true,\n description,\n properties: {\n username: [{ type: 'string' }],\n password: [{ type: 'string' }],\n },\n additionalProperties: false,\n \n default: parameter['x-default' as never],\n },\n ]\n : [\n {\n type: 'string',\n required: true,\n format: 'bearer',\n description,\n \n default: parameter['x-default' as never],\n },\n ];\n case 'oauth2':\n return [\n {\n type: 'string',\n required: true,\n format: 'bearer',\n description,\n },\n ];\n }\n};\n\nexport const getDescriptionForSecurityParameter = (\n parameter: SecurityParameterSchema\n): string | undefined => {\n switch (parameter.type) {\n case 'apiKey':\n return parameter.description;\n case 'http':\n return (\n parameter.description ??\n (parameter.scheme === 'basic' ? basicDescription : bearerDescription)\n );\n case 'oauth2':\n return parameter.description ?? oauth2Description;\n }\n};\n\nconst parseValueForParameter = (parameter: SecurityParameterSchema, value: unknown) => {\n if (\n parameter.type !== 'http' ||\n parameter.scheme !== 'basic' ||\n typeof value !== 'string' ||\n !value.startsWith('Basic ')\n )\n return value;\n\n const encoded = value.slice('Basic '.length);\n const decoded = Buffer.from(encoded, 'base64').toString('utf-8');\n const [username, password] = decoded.split(':');\n return { username, password };\n};\n\nconst getTransformForParameter = (parameter: SecurityParameterSchema) => {\n if (parameter.type !== 'http' || parameter.scheme !== 'basic') {\n return (value: unknown) => value;\n }\n\n return (value: unknown) => {\n const username =\n value && typeof value === 'object' && 'username' in value ? value['username'] : undefined;\n const password =\n value && typeof value === 'object' && 'password' in value ? value['password'] : undefined;\n const unencoded = `${username ?? ''}:${password ?? ''}`;\n const encoded = Buffer.from(unencoded).toString('base64');\n return `Basic ${encoded}`;\n };\n};\n"],"names":["basicDescription","bearerDescription","oauth2Description","SecuritySection","inputs","setInputs","securityOptions","selectedSecurityOptionIndex","setSelectedSecurityOptionIndex","selectedSecurityOption","parameters","useMemo","location","name","parameter","schemaArray","transform","paramValue","getPropsForParameter","jsx","RecursiveInput","newObj","InputSectionContainer","e","cn","TypeDropdown","option","index","value","getSchemaArrayForParameter","getTransformForParameter","parseValueForParameter","description","getDescriptionForSecurityParameter","encoded","decoded","username","password","unencoded"],"mappings":";;;;;;;AAiBO,MAAMA,IACX,8IACWC,IACX,kGACWC,IACX,kFAUWC,IAAkB,CAAC;AAAA,EAC9B,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,6BAAAC;AAAA,EACA,gCAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAyBH,EAAgBC,CAA2B,GAEpEG,IAAaC,EAAQ,MACpBF,IAEG,CAAC,UAAU,SAAS,QAAQ,EAAY;AAAA,IAAQ,CAACG,MACvD,OAAO,QAAQH,EAAuB,WAAWG,CAAQ,CAAC,EAAE,IAAI,CAAC,CAACC,GAAMC,CAAS,MAAM;AACrF,YAAM;AAAA,QACJ,aAAAC;AAAA,QACA,WAAAC;AAAA,QACA,OAAOC;AAAA,MAAA,IACLC,EAAqBJ,GAAWV,EAAOQ,CAAQ,EAAEC,CAAI,CAAC;AAuB1D,aACE,gBAAAM;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAAP;AAAA,UAEA,aAAA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AACjB,GAAoCc,MAAmB;AACrF,MACEd,EAAU,SAAS,UACnBA,EAAU,WAAW,WACrB,OAAOc,KAAU,YACjB,CAACA,EAAM,WAAW,QAAQ;AAE1B,WAAOA;AAET,QAAMM,IAAUN,EAAM,MAAM,CAAe,GACrCO,IAAU,OAAO,KAAKD,GAAS,QAAQ,EAAE,SAAS,OAAO,GACzD,CAACE,GAAUC,CAAQ,IAAIF,EAAQ,MAAM,GAAG;AAC9C,SAAO,EAAE,UAAAC,GAAU,UAAAC,EAAA;AACrB,GAEMP,IAA2B,CAAChB,MAC5BA,EAAU,SAAS,UAAUA,EAAU,WAAW,UAC7C,CAACc,MAAmBA,IAGtB,CAACA,MAAmB;AACzB,QAAMQ,IACJR,KAAS,OAAOA,KAAU,YAAY,cAAcA,IAAQA,EAAM,WAAc,QAC5ES,IACJT,KAAS,OAAOA,KAAU,YAAY,cAAcA,IAAQA,EAAM,WAAc,QAC5EU,IAAY,GAAGF,KAAY,EAAE,IAAIC,KAAY,EAAE;AAErD,SAAO,SADS,OAAO,KAAKC,CAAS,EAAE,SAAS,QAAQ,CACjC;AACzB;"}
@@ -0,0 +1,31 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useMemo as u } from "react";
3
+ import { InputSectionContainer as p } from "../components/InputSectionContainer.js";
4
+ import { RecursiveInput as l } from "./inputs/RecursiveInput.js";
5
+ const O = ({ variables: o, value: e, setValue: n }) => {
6
+ const i = u(() => Object.entries(o).map(([r, s]) => {
7
+ const a = e[r];
8
+ return /* @__PURE__ */ c(
9
+ l,
10
+ {
11
+ name: r,
12
+ schemaArray: [s],
13
+ value: a,
14
+ setValue: (t) => {
15
+ const m = { ...e };
16
+ m[r] = String(t), n(m);
17
+ },
18
+ clearValue: a === void 0 ? void 0 : () => {
19
+ const t = { ...e };
20
+ delete t[r], n(t);
21
+ }
22
+ },
23
+ r
24
+ );
25
+ }), [o, n, e]);
26
+ return /* @__PURE__ */ c(p, { name: "Server", children: i });
27
+ };
28
+ export {
29
+ O as ServerSection
30
+ };
31
+ //# sourceMappingURL=ServerSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerSection.js","sources":["../../../../src/api-playground/ApiPlayground/Request/ServerSection.tsx"],"sourcesContent":["'use client';\n\nimport { Server } from '@mintlify/validation';\nimport { useMemo } from 'react';\n\nimport { InputSectionContainer } from '../components/InputSectionContainer';\nimport { RecursiveInput } from './inputs/RecursiveInput';\n\ntype ServerSectionProps = {\n variables: NonNullable<Server['variables']>;\n value: Record<string, string>;\n setValue: (value: Record<string, string>) => void;\n};\n\nexport const ServerSection = ({ variables, value, setValue }: ServerSectionProps) => {\n const inputs = useMemo(() => {\n return Object.entries(variables).map(([key, schema]) => {\n const paramValue = value[key];\n const setParamValue = (newParamValue: unknown) => {\n const newObj = { ...value };\n newObj[key] = String(newParamValue);\n setValue(newObj);\n };\n const clearParamValue =\n paramValue === undefined\n ? undefined\n : () => {\n const newObj = { ...value };\n delete newObj[key];\n setValue(newObj);\n };\n\n return (\n <RecursiveInput\n key={key}\n name={key}\n schemaArray={[schema]}\n value={paramValue}\n setValue={setParamValue}\n clearValue={clearParamValue}\n />\n );\n });\n }, [variables, setValue, value]);\n\n return <InputSectionContainer name=\"Server\">{inputs}</InputSectionContainer>;\n};\n"],"names":["ServerSection","variables","value","setValue","inputs","useMemo","key","schema","paramValue","jsx","RecursiveInput","newParamValue","newObj","InputSectionContainer"],"mappings":";;;;AAcO,MAAMA,IAAgB,CAAC,EAAE,WAAAC,GAAW,OAAAC,GAAO,UAAAC,QAAmC;AACnF,QAAMC,IAASC,EAAQ,MACd,OAAO,QAAQJ,CAAS,EAAE,IAAI,CAAC,CAACK,GAAKC,CAAM,MAAM;AACtD,UAAMC,IAAaN,EAAMI,CAAG;AAe5B,WACE,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QAEC,MAAMJ;AAAA,QACN,aAAa,CAACC,CAAM;AAAA,QACpB,OAAOC;AAAA,QACP,UApBkB,CAACG,MAA2B;AAChD,gBAAMC,IAAS,EAAE,GAAGV,EAAA;AACpB,UAAAU,EAAON,CAAG,IAAI,OAAOK,CAAa,GAClCR,EAASS,CAAM;AAAA,QACjB;AAAA,QAiBI,YAfFJ,MAAe,SACX,SACA,MAAM;AACJ,gBAAMI,IAAS,EAAE,GAAGV,EAAA;AACpB,iBAAOU,EAAON,CAAG,GACjBH,EAASS,CAAM;AAAA,QACjB;AAAA,MASU;AAAA,MALPN;AAAA,IAAA;AAAA,EAQX,CAAC,GACA,CAACL,GAAWE,GAAUD,CAAK,CAAC;AAE/B,SAAO,gBAAAO,EAACI,GAAA,EAAsB,MAAK,UAAU,UAAAT,GAAO;AACtD;"}
@@ -0,0 +1,44 @@
1
+ import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
+ import { useContext as f } from "react";
3
+ import { usePrefilledInputs as a } from "../../../hooks/usePrefilledInputs/index.js";
4
+ import { useSecurityOption as p } from "../../../hooks/useSecurityOption.js";
5
+ import x from "../../../components/Api/ErrorBoundary.js";
6
+ import "@mintlify/validation";
7
+ import { cn as b } from "../../../utils/cn.js";
8
+ import { ApiPlaygroundContext as g } from "../ApiPlaygroundContext.js";
9
+ import { EndpointHeader as k } from "../components/PathHeader.js";
10
+ import { PlaygroundModal as y } from "./PlaygroundModal.js";
11
+ const w = ({ endpoint: r, inputs: i, setInputs: m, display: n, pathname: s }) => {
12
+ var l;
13
+ const { selectedBaseUrlIndex: u, setIsPlaygroundExpanded: o } = f(g), t = (l = r.servers) == null ? void 0 : l[u], c = p(r.request.security);
14
+ return a({
15
+ inputs: i,
16
+ setInputs: m,
17
+ baseUrl: t == null ? void 0 : t.url,
18
+ securityOption: c,
19
+ userInfoInputs: void 0
20
+ }), /* @__PURE__ */ e(x, { children: /* @__PURE__ */ d(
21
+ "div",
22
+ {
23
+ className: b(
24
+ "mint:flex mint:w-full mint:flex-col mint:bg-background-light mint:dark:bg-background-dark mint:border-standard mint:rounded-2xl",
25
+ n === "simple" ? "mint:p-1" : "mint:p-1.5"
26
+ ),
27
+ children: [
28
+ /* @__PURE__ */ e(
29
+ k,
30
+ {
31
+ endpoint: r,
32
+ display: n,
33
+ onClickInteractive: () => o == null ? void 0 : o(!0)
34
+ }
35
+ ),
36
+ /* @__PURE__ */ e(y, { endpoint: r, inputs: i, setInputs: m, pathname: s })
37
+ ]
38
+ }
39
+ ) });
40
+ };
41
+ export {
42
+ w as Request
43
+ };
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/api-playground/ApiPlayground/Request/index.tsx"],"sourcesContent":["'use client';\n\nimport { ApiPlaygroundDisplayType } from '@mintlify/models';\nimport { ApiPlaygroundInputs, Endpoint } from '@mintlify/validation';\nimport { useContext } from 'react';\n\nimport { usePrefilledInputs } from '@/hooks/usePrefilledInputs';\nimport { useSecurityOption } from '@/hooks/useSecurityOption';\nimport ErrorBoundary from '@/components/Api/ErrorBoundary';\nimport { cn } from '@/api-playground-2/schemaGraph/utils';\n\nimport { ApiPlaygroundContext } from '../ApiPlaygroundContext';\nimport { EndpointHeader } from '../components/PathHeader';\nimport { PlaygroundModal } from './PlaygroundModal';\n\ntype RequestParams = {\n endpoint: Endpoint;\n inputs: ApiPlaygroundInputs;\n setInputs: (inputs: ApiPlaygroundInputs) => void;\n display: ApiPlaygroundDisplayType;\n pathname: string;\n};\n\nexport const Request = ({ endpoint, inputs, setInputs, display, pathname }: RequestParams) => {\n const { selectedBaseUrlIndex, setIsPlaygroundExpanded } = useContext(ApiPlaygroundContext);\n const server = endpoint.servers?.[selectedBaseUrlIndex];\n\n const securityOption = useSecurityOption(endpoint.request.security);\n usePrefilledInputs({\n inputs,\n setInputs,\n baseUrl: server?.url,\n securityOption,\n userInfoInputs: undefined,\n });\n\n return (\n <ErrorBoundary>\n <div\n className={cn(\n 'mint:flex mint:w-full mint:flex-col mint:bg-background-light mint:dark:bg-background-dark mint:border-standard mint:rounded-2xl',\n display === 'simple' ? 'mint:p-1' : 'mint:p-1.5'\n )}\n >\n <EndpointHeader\n endpoint={endpoint}\n display={display}\n onClickInteractive={() => setIsPlaygroundExpanded?.(true)}\n />\n <PlaygroundModal endpoint={endpoint} inputs={inputs} setInputs={setInputs} pathname={pathname} />\n </div>\n </ErrorBoundary>\n );\n};\n"],"names":["Request","endpoint","inputs","setInputs","display","pathname","selectedBaseUrlIndex","setIsPlaygroundExpanded","useContext","ApiPlaygroundContext","server","_a","securityOption","useSecurityOption","usePrefilledInputs","ErrorBoundary","jsxs","cn","jsx","EndpointHeader","PlaygroundModal"],"mappings":";;;;;;;;;;AAuBO,MAAMA,IAAU,CAAC,EAAE,UAAAC,GAAU,QAAAC,GAAQ,WAAAC,GAAW,SAAAC,GAAS,UAAAC,QAA8B;;AAC5F,QAAM,EAAE,sBAAAC,GAAsB,yBAAAC,MAA4BC,EAAWC,CAAoB,GACnFC,KAASC,IAAAV,EAAS,YAAT,gBAAAU,EAAmBL,IAE5BM,IAAiBC,EAAkBZ,EAAS,QAAQ,QAAQ;AAClE,SAAAa,EAAmB;AAAA,IACjB,QAAAZ;AAAA,IACA,WAAAC;AAAA,IACA,SAASO,KAAA,gBAAAA,EAAQ;AAAA,IACjB,gBAAAE;AAAA,IACA,gBAAgB;AAAA,EAAA,CACjB,qBAGEG,GAAA,EACC,UAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAb,MAAY,WAAW,aAAa;AAAA,MAAA;AAAA,MAGtC,UAAA;AAAA,QAAA,gBAAAc;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,UAAAlB;AAAA,YACA,SAAAG;AAAA,YACA,oBAAoB,MAAMG,KAAA,gBAAAA,EAA0B;AAAA,UAAI;AAAA,QAAA;AAAA,QAE1D,gBAAAW,EAACE,GAAA,EAAgB,UAAAnB,GAAoB,QAAAC,GAAgB,WAAAC,GAAsB,UAAAE,EAAA,CAAoB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEnG;AAEJ;"}