@mintlify/msft-sdk 1.1.24 → 1.1.26

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 (156) hide show
  1. package/dist/api-playground/ApiPlayground/ApiPlaygroundContext.js.map +1 -1
  2. package/dist/api-playground/ApiPlayground/Request/BodySection.js.map +1 -1
  3. package/dist/api-playground/ApiPlayground/Request/ParameterSection.js.map +1 -1
  4. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +46 -45
  5. package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js.map +1 -1
  6. package/dist/api-playground/ApiPlayground/Request/SecuritySection.js.map +1 -1
  7. package/dist/api-playground/ApiPlayground/Request/ServerSection.js.map +1 -1
  8. package/dist/api-playground/ApiPlayground/Request/index.js +18 -18
  9. package/dist/api-playground/ApiPlayground/Request/index.js.map +1 -1
  10. package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js.map +1 -1
  11. package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js.map +1 -1
  12. package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js.map +1 -1
  13. package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js.map +1 -1
  14. package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js.map +1 -1
  15. package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js.map +1 -1
  16. package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js.map +1 -1
  17. package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js.map +1 -1
  18. package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js.map +1 -1
  19. package/dist/api-playground/ApiPlayground/Response/CopyFileToClipboardButton.js.map +1 -1
  20. package/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js.map +1 -1
  21. package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js.map +1 -1
  22. package/dist/api-playground/ApiPlayground/Response/ResponseBody/index.js.map +1 -1
  23. package/dist/api-playground/ApiPlayground/Response/ResponseError.js.map +1 -1
  24. package/dist/api-playground/ApiPlayground/Response/ResponseHeaders.js.map +1 -1
  25. package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js.map +1 -1
  26. package/dist/api-playground/ApiPlayground/Response/ResponseTable.js.map +1 -1
  27. package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js.map +1 -1
  28. package/dist/api-playground/ApiPlayground/Response/index.js.map +1 -1
  29. package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js.map +1 -1
  30. package/dist/api-playground/ApiPlayground/components/ArrayCount.js.map +1 -1
  31. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +20 -21
  32. package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js.map +1 -1
  33. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +10 -11
  34. package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js.map +1 -1
  35. package/dist/api-playground/ApiPlayground/components/InputContainer.js.map +1 -1
  36. package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js.map +1 -1
  37. package/dist/api-playground/ApiPlayground/components/ObjectExpandButton.js.map +1 -1
  38. package/dist/api-playground/ApiPlayground/components/PathHeader.js.map +1 -1
  39. package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js.map +1 -1
  40. package/dist/api-playground/ApiPlayground/components/TrashButton.js.map +1 -1
  41. package/dist/api-playground/ApiPlayground/components/TypeDropdown.js.map +1 -1
  42. package/dist/api-playground/ApiPlayground/index.js +30 -30
  43. package/dist/api-playground/ApiPlayground/index.js.map +1 -1
  44. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js.map +1 -1
  45. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js.map +1 -1
  46. package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +1 -1
  47. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -1
  48. package/dist/api-playground/EndpointFields/components/Description.js.map +1 -1
  49. package/dist/api-playground/EndpointFields/components/OneOfDropdown.js.map +1 -1
  50. package/dist/api-playground/EndpointFields/components/OptionDropdown.js.map +1 -1
  51. package/dist/api-playground/EndpointFields/components/SectionHeading.js.map +1 -1
  52. package/dist/api-playground/EndpointFields/index.js.map +1 -1
  53. package/dist/api-playground-2/Api.js.map +1 -1
  54. package/dist/api-playground-2/ApiExamples.js.map +1 -1
  55. package/dist/api-playground-2/ApiFields.js.map +1 -1
  56. package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js.map +1 -1
  57. package/dist/api-playground-2/components/EndpointFields/fields/NumberMetadata.js.map +1 -1
  58. package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js.map +1 -1
  59. package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js.map +1 -1
  60. package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js.map +1 -1
  61. package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js.map +1 -1
  62. package/dist/api-playground-2/components/EndpointFields/fields/StringMetadata.js.map +1 -1
  63. package/dist/api-playground-2/components/Example/RequestExample.js +17 -15
  64. package/dist/api-playground-2/components/Example/RequestExample.js.map +1 -1
  65. package/dist/api-playground-2/components/Example/ResponseExample.js.map +1 -1
  66. package/dist/api-playground-2/components/Request/InputSectionContainer.js.map +1 -1
  67. package/dist/api-playground-2/components/TypeDropdown.js.map +1 -1
  68. package/dist/api-playground-2/constants/index.js +12 -3
  69. package/dist/api-playground-2/constants/index.js.map +1 -1
  70. package/dist/api-playground-2/contexts/ApiPlaygroundContext.js.map +1 -1
  71. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +10 -10
  72. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
  73. package/dist/api-playground-2/generators/generateSnippetMap.js +24 -24
  74. package/dist/api-playground-2/generators/generateSnippetMap.js.map +1 -1
  75. package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js.map +1 -1
  76. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +41 -0
  77. package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js.map +1 -0
  78. package/dist/api-playground-2/schemaGraph/errors.js +19 -0
  79. package/dist/api-playground-2/schemaGraph/errors.js.map +1 -0
  80. package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js +26 -0
  81. package/dist/api-playground-2/schemaGraph/getApiReferenceDataFromGraph.js.map +1 -0
  82. package/dist/api-playground-2/schemaGraph/getDocumentProperties.js +58 -0
  83. package/dist/api-playground-2/schemaGraph/getDocumentProperties.js.map +1 -0
  84. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +77 -0
  85. package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js.map +1 -0
  86. package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js +16 -0
  87. package/dist/api-playground-2/schemaGraph/getSchemaGraphSchemaData.js.map +1 -0
  88. package/dist/api-playground-2/schemaGraph/processExamples.js +111 -34
  89. package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
  90. package/dist/api-playground-2/schemaGraph/reduceCompositions.js +283 -0
  91. package/dist/api-playground-2/schemaGraph/reduceCompositions.js.map +1 -0
  92. package/dist/api-playground-2/schemaGraph/resolveGraphNode.js +61 -0
  93. package/dist/api-playground-2/schemaGraph/resolveGraphNode.js.map +1 -0
  94. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +149 -0
  95. package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js.map +1 -0
  96. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +33 -0
  97. package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js.map +1 -0
  98. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +35 -0
  99. package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js.map +1 -0
  100. package/dist/api-playground-2/schemaGraph/utils.js +144 -98
  101. package/dist/api-playground-2/schemaGraph/utils.js.map +1 -1
  102. package/dist/common/parseApiTargetFromMetadata.js +24 -0
  103. package/dist/common/parseApiTargetFromMetadata.js.map +1 -0
  104. package/dist/common/parseOpenApiString.js +42 -0
  105. package/dist/common/parseOpenApiString.js.map +1 -0
  106. package/dist/components/Api/ApiReferenceProvider.js +6 -15
  107. package/dist/components/Api/ApiReferenceProvider.js.map +1 -1
  108. package/dist/components/Api/ErrorBoundary.js.map +1 -1
  109. package/dist/components/Api/Expandable.js.map +1 -1
  110. package/dist/components/Api/Markdown.js.map +1 -1
  111. package/dist/components/Api/MethodPill.js.map +1 -1
  112. package/dist/components/Api/Param.js.map +1 -1
  113. package/dist/components/Api/colors.js.map +1 -1
  114. package/dist/components/content-components/CodeGroupSelect/CodeGroupCopyButton.js.map +1 -1
  115. package/dist/components/content-components/CodeGroupSelect/CodeSelectDropdown.js.map +1 -1
  116. package/dist/components/content-components/CodeGroupSelect/index.js.map +1 -1
  117. package/dist/components/content-components/code-block.js.map +1 -1
  118. package/dist/components/content-components/code-group.js.map +1 -1
  119. package/dist/components/content-components/code-snippet.js.map +1 -1
  120. package/dist/components/content-components/code-snippets.js.map +1 -1
  121. package/dist/components/content-components/getNodeText.js.map +1 -1
  122. package/dist/components/docsLayout.js +29 -27
  123. package/dist/components/docsLayout.js.map +1 -1
  124. package/dist/components/nav-tree/index.js +165 -156
  125. package/dist/components/nav-tree/index.js.map +1 -1
  126. package/dist/contexts/CodeExampleLabelContext.js.map +1 -1
  127. package/dist/contexts/ConfigContext.js +61 -12
  128. package/dist/contexts/ConfigContext.js.map +1 -1
  129. package/dist/contexts/EndpointLocationContext.js.map +1 -1
  130. package/dist/contexts/MDXContentContext.js +0 -1
  131. package/dist/contexts/MDXContentContext.js.map +1 -1
  132. package/dist/hooks/useApiPlaygroundDisplay.js.map +1 -1
  133. package/dist/hooks/useApiPlaygroundInputs.js.map +1 -1
  134. package/dist/hooks/useBaseUrlOptions.js.map +1 -1
  135. package/dist/hooks/useEndpoint.js.map +1 -1
  136. package/dist/hooks/useKeyboardShortcut.js.map +1 -1
  137. package/dist/hooks/useMDXContent.js.map +1 -1
  138. package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js.map +1 -1
  139. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js.map +1 -1
  140. package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js.map +1 -1
  141. package/dist/hooks/usePlaygroundSchemaOptions.js.map +1 -1
  142. package/dist/hooks/usePrefilledInputs/index.js.map +1 -1
  143. package/dist/hooks/usePrefilledInputs/storedServerVariables.js.map +1 -1
  144. package/dist/hooks/useSecurityOption.js.map +1 -1
  145. package/dist/hooks/useSendPlaygroundRequest.js.map +1 -1
  146. package/dist/index.d.ts +129 -11
  147. package/dist/index.js +156 -144
  148. package/dist/index.js.map +1 -1
  149. package/dist/styles.css +1 -1
  150. package/package.json +1 -1
  151. package/dist/hooks/useCurrentPath.js +0 -17
  152. package/dist/hooks/useCurrentPath.js.map +0 -1
  153. package/dist/utils/decodeSlug.js +0 -8
  154. package/dist/utils/decodeSlug.js.map +0 -1
  155. package/dist/utils/optionallyAddLeadingSlash.js +0 -7
  156. package/dist/utils/optionallyAddLeadingSlash.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigContext.js","sources":["../../src/contexts/ConfigContext.tsx"],"sourcesContent":["'use client';\n\nimport type { MdxExtracts } from '@mintlify/common';\nimport { SerializeSuccess } from '@mintlify/mdx/types';\nimport { InkeepType, MintConfig, PageMetaTags } from '@mintlify/models';\nimport { PageType } from '@mintlify/models';\nimport {\n DeploymentEntitlements,\n GitSource,\n DeploymentFeedbackType,\n DocsConfig,\n DecoratedNavigationConfig,\n TrieveType,\n DeploymentPreviewType,\n} from '@mintlify/validation';\nimport { createContext, ReactNode } from 'react';\n\nimport { addApiReferenceDataFromMdxAndDocsConfig } from '@/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig';\nimport { processSecurityOptions } from '@/api-playground-2/schemaGraph/processSecurityOptions';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { ApiReferenceData } from '../utils/api-reference/getApiReferenceData';\n\nexport type PageContextType = {\n pageMetadata: PageMetaTags;\n pageType?: PageType;\n mdxExtracts?: MdxExtracts;\n description?: SerializeSuccess | string | null;\n panelMdxSource?: SerializeSuccess;\n panelMdxSourceWithNoJs?: SerializeSuccess;\n};\n\nexport type DeploymentMetadataContextType = {\n subdomain?: string;\n actualSubdomain?: string;\n gitSource?: GitSource;\n inkeep?: InkeepType;\n trieve?: TrieveType;\n feedback?: DeploymentFeedbackType;\n entitlements?: DeploymentEntitlements;\n buildId?: string;\n clientVersion?: string;\n preview?: DeploymentPreviewType;\n};\n\nexport type DocsConfigContextType = {\n mintConfig?: MintConfig;\n docsConfig?: DocsConfig;\n docsNavWithMetadata?: DecoratedNavigationConfig;\n};\n\nexport type ApiReferenceContextType = {\n apiReferenceData: ApiReferenceData;\n};\n\nexport type ApiReferenceContext2Type = {\n apiReferenceData2: ApiReferenceDataV2;\n};\n\nexport const PageContext = createContext<PageContextType>({ pageMetadata: {} });\n\nexport const DeploymentMetadataContext = createContext<DeploymentMetadataContextType>({});\n\nexport const DocsConfigContext = createContext<DocsConfigContextType>({});\n\nexport const ApiReferenceContext = createContext<ApiReferenceContextType>({ apiReferenceData: {} });\n\nexport const ApiReferenceContext2 = createContext<ApiReferenceContext2Type>({\n apiReferenceData2: {},\n});\n\nPageContext.displayName = 'PageContext';\nDeploymentMetadataContext.displayName = 'DeploymentMetadataContext';\nDocsConfigContext.displayName = 'DocsConfigContext';\nApiReferenceContext.displayName = 'ApiReferenceContext';\n\nexport function PageProvider({ value, children }: { value: PageContextType; children: ReactNode }) {\n return <PageContext.Provider value={value}>{children}</PageContext.Provider>;\n}\n\nexport function DeploymentMetadataProvider({\n value,\n children,\n}: {\n value: DeploymentMetadataContextType;\n children: ReactNode;\n}) {\n return (\n <DeploymentMetadataContext.Provider value={value}>\n {children}\n </DeploymentMetadataContext.Provider>\n );\n}\n\nexport function DocsConfigProvider({\n value,\n children,\n}: {\n value: DocsConfigContextType;\n children: ReactNode;\n}) {\n return <DocsConfigContext.Provider value={value}>{children}</DocsConfigContext.Provider>;\n}\n\nexport function ApiReferenceProvider({\n value,\n children,\n}: {\n value: ApiReferenceContextType;\n children: ReactNode;\n}) {\n return <ApiReferenceContext.Provider value={value}>{children}</ApiReferenceContext.Provider>;\n}\n\nexport function ApiReferenceProvider2({\n pageMetadata,\n docsConfig,\n mdxExtracts,\n apiReferenceData2,\n children,\n}: {\n pageMetadata: PageMetaTags;\n docsConfig: DocsConfig | undefined;\n mdxExtracts: MdxExtracts | undefined;\n apiReferenceData2: ApiReferenceDataV2 | undefined;\n children: ReactNode;\n}) {\n // combine apiReferenceData2 from page props with mdxExtracts and docsConfig so we don't\n // have to go hunting per component for things that can come from other sources\n const apiReferenceDataFromPageProps = apiReferenceData2;\n\n const apiReferenceDataWithMdxAndDocsConfig = addApiReferenceDataFromMdxAndDocsConfig({\n apiReferenceData2: apiReferenceDataFromPageProps,\n mdxExtracts,\n docsConfig,\n pageMetadata,\n });\n\n // after we have the apiReferenceDataWithMdxAndDocsConfig, we can process the security options - some may have come from docs config\n const processedSecurityOptions = processSecurityOptions(apiReferenceDataWithMdxAndDocsConfig);\n if (processedSecurityOptions.length > 0) {\n if (!apiReferenceDataWithMdxAndDocsConfig.dependencies) {\n apiReferenceDataWithMdxAndDocsConfig.dependencies = {\n servers: {},\n security: {},\n processedSecurityOptions: [],\n };\n }\n apiReferenceDataWithMdxAndDocsConfig.dependencies.processedSecurityOptions =\n processedSecurityOptions;\n }\n\n const filteredApiReferenceData = apiReferenceDataWithMdxAndDocsConfig;\n return (\n <ApiReferenceContext2.Provider value={{ apiReferenceData2: filteredApiReferenceData ?? {} }}>\n {children}\n </ApiReferenceContext2.Provider>\n );\n}\n"],"names":["PageContext","createContext","DeploymentMetadataContext","DocsConfigContext","ApiReferenceContext","ApiReferenceContext2"],"mappings":";;AA0DO,MAAMA,IAAcC,EAA+B,EAAE,cAAc,IAAI,GAEjEC,IAA4BD,EAA6C,CAAA,CAAE,GAE3EE,IAAoBF,EAAqC,CAAA,CAAE,GAE3DG,IAAsBH,EAAuC,EAAE,kBAAkB,IAAI,GAErFI,IAAuBJ,EAAwC;AAAA,EAC1E,mBAAmB,CAAA;AACrB,CAAC;AAEDD,EAAY,cAAc;AAC1BE,EAA0B,cAAc;AACxCC,EAAkB,cAAc;AAChCC,EAAoB,cAAc;"}
1
+ {"version":3,"file":"ConfigContext.js","sources":["../../src/contexts/ConfigContext.tsx"],"sourcesContent":["\nimport type { MdxExtracts } from '@mintlify/common';\nimport { SerializeSuccess } from '@mintlify/mdx/types';\nimport { InkeepType, MintConfig, PageMetaTags } from '@mintlify/models';\nimport { PageType } from '@mintlify/models';\nimport {\n DeploymentEntitlements,\n GitSource,\n DeploymentFeedbackType,\n DocsConfig,\n DecoratedNavigationConfig,\n TrieveType,\n DeploymentPreviewType,\n} from '@mintlify/validation';\nimport { createContext, ReactNode } from 'react';\n\nimport { addApiReferenceDataFromMdxAndDocsConfig } from '@/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig';\nimport { processSecurityOptions } from '@/api-playground-2/schemaGraph/processSecurityOptions';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { ApiReferenceData } from '../utils/api-reference/getApiReferenceData';\n\nexport type PageContextType = {\n pageMetadata: PageMetaTags;\n pageType?: PageType;\n mdxExtracts?: MdxExtracts;\n description?: SerializeSuccess | string | null;\n panelMdxSource?: SerializeSuccess;\n panelMdxSourceWithNoJs?: SerializeSuccess;\n pathname?: string;\n};\n\nexport type DeploymentMetadataContextType = {\n subdomain?: string;\n actualSubdomain?: string;\n gitSource?: GitSource;\n inkeep?: InkeepType;\n trieve?: TrieveType;\n feedback?: DeploymentFeedbackType;\n entitlements?: DeploymentEntitlements;\n buildId?: string;\n clientVersion?: string;\n preview?: DeploymentPreviewType;\n};\n\nexport type DocsConfigContextType = {\n mintConfig?: MintConfig;\n docsConfig?: DocsConfig;\n docsNavWithMetadata?: DecoratedNavigationConfig;\n};\n\nexport type ApiReferenceContextType = {\n apiReferenceData: ApiReferenceData;\n};\n\nexport type ApiReferenceContext2Type = {\n apiReferenceData2: ApiReferenceDataV2;\n};\n\nexport type ApiReferenceProvider2Props = {\n pageMetadata: PageMetaTags;\n docsConfig: DocsConfig | undefined;\n mdxExtracts: MdxExtracts | undefined;\n apiReferenceData2: ApiReferenceDataV2 | undefined;\n children: ReactNode;\n};\n\nexport const PageContext = createContext<PageContextType>({ pageMetadata: {} });\n\nexport const DeploymentMetadataContext = createContext<DeploymentMetadataContextType>({});\n\nexport const DocsConfigContext = createContext<DocsConfigContextType>({});\n\nexport const ApiReferenceContext = createContext<ApiReferenceContextType>({ apiReferenceData: {} });\n\nexport const ApiReferenceContext2 = createContext<ApiReferenceContext2Type>({\n apiReferenceData2: {},\n});\n\nPageContext.displayName = 'PageContext';\nDeploymentMetadataContext.displayName = 'DeploymentMetadataContext';\nDocsConfigContext.displayName = 'DocsConfigContext';\nApiReferenceContext.displayName = 'ApiReferenceContext';\n\nexport function PageProvider({ value, children }: { value: PageContextType; children: ReactNode }) {\n return <PageContext.Provider value={value}>{children}</PageContext.Provider>;\n}\n\nexport function DeploymentMetadataProvider({\n value,\n children,\n}: {\n value: DeploymentMetadataContextType;\n children: ReactNode;\n}) {\n return (\n <DeploymentMetadataContext.Provider value={value}>\n {children}\n </DeploymentMetadataContext.Provider>\n );\n}\n\nexport function DocsConfigProvider({\n value,\n children,\n}: {\n value: DocsConfigContextType;\n children: ReactNode;\n}) {\n return <DocsConfigContext.Provider value={value}>{children}</DocsConfigContext.Provider>;\n}\n\nexport function ApiReferenceProvider({\n value,\n children,\n}: {\n value: ApiReferenceContextType;\n children: ReactNode;\n}) {\n return <ApiReferenceContext.Provider value={value}>{children}</ApiReferenceContext.Provider>;\n}\n\nexport function ApiReferenceProvider2({\n pageMetadata,\n docsConfig,\n mdxExtracts,\n apiReferenceData2,\n children,\n}: ApiReferenceProvider2Props) {\n // combine apiReferenceData2 from page props with mdxExtracts and docsConfig so we don't\n // have to go hunting per component for things that can come from other sources\n const apiReferenceDataFromPageProps = apiReferenceData2;\n\n const apiReferenceDataWithMdxAndDocsConfig = addApiReferenceDataFromMdxAndDocsConfig({\n apiReferenceData2: apiReferenceDataFromPageProps,\n mdxExtracts,\n docsConfig,\n pageMetadata,\n });\n\n // after we have the apiReferenceDataWithMdxAndDocsConfig, we can process the security options - some may have come from docs config\n const processedSecurityOptions = processSecurityOptions(apiReferenceDataWithMdxAndDocsConfig);\n if (processedSecurityOptions.length > 0) {\n if (!apiReferenceDataWithMdxAndDocsConfig.dependencies) {\n apiReferenceDataWithMdxAndDocsConfig.dependencies = {\n servers: {},\n security: {},\n processedSecurityOptions: [],\n };\n }\n apiReferenceDataWithMdxAndDocsConfig.dependencies.processedSecurityOptions =\n processedSecurityOptions;\n }\n\n const filteredApiReferenceData = apiReferenceDataWithMdxAndDocsConfig;\n return (\n <ApiReferenceContext2.Provider value={{ apiReferenceData2: filteredApiReferenceData ?? {} }}>\n {children}\n </ApiReferenceContext2.Provider>\n );\n}\n"],"names":["PageContext","createContext","DeploymentMetadataContext","DocsConfigContext","ApiReferenceContext","ApiReferenceContext2","PageProvider","value","children","jsx","DeploymentMetadataProvider","DocsConfigProvider","ApiReferenceProvider","ApiReferenceProvider2","pageMetadata","docsConfig","mdxExtracts","apiReferenceData2","apiReferenceDataWithMdxAndDocsConfig","addApiReferenceDataFromMdxAndDocsConfig","processedSecurityOptions","processSecurityOptions","filteredApiReferenceData"],"mappings":";;;;AAkEO,MAAMA,IAAcC,EAA+B,EAAE,cAAc,IAAI,GAEjEC,IAA4BD,EAA6C,CAAA,CAAE,GAE3EE,IAAoBF,EAAqC,CAAA,CAAE,GAE3DG,IAAsBH,EAAuC,EAAE,kB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2BJ;AACjC,SACE,gBAAAT,EAACJ,EAAqB,UAArB,EAA8B,OAAO,EAAE,mBAAmBiB,KAA4B,CAAA,KACpF,UAAAd,GACH;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EndpointLocationContext.js","sources":["../../src/contexts/EndpointLocationContext.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, ReactElement, MutableRefObject, useContext, useRef } from 'react';\n\nimport { useCheckHash } from '../hooks/useCheckHash';\nimport { LocationType } from '../api-playground-2/types/api';\n\nexport type EndpointLocationContextType = {\n location?: LocationType;\n anchor?: string;\n hasScrolledToAnchorRef?: MutableRefObject<boolean>;\n};\n\nexport const EndpointLocationContext = createContext<EndpointLocationContextType>({});\n\nexport const useEndpointLocation = () => useContext(EndpointLocationContext);\n\nexport function EndpointLocationProvider({\n location,\n children,\n}: {\n location?: LocationType;\n children?: ReactElement;\n}) {\n const hasScrolledToAnchorRef = useRef(false);\n const anchor = useCheckHash();\n return (\n <EndpointLocationContext.Provider value={{ location, anchor, hasScrolledToAnchorRef }}>\n {children}\n </EndpointLocationContext.Provider>\n );\n}\n\nEndpointLocationContext.displayName = 'EndpointLocationContext';\n"],"names":["EndpointLocationContext","createContext","useEndpointLocation","useContext","EndpointLocationProvider","location","children","hasScrolledToAnchorRef","useRef","anchor","useCheckHash","jsx"],"mappings":";;;AAaO,MAAMA,IAA0BC,EAA2C,CAAA,CAAE,GAEvEC,IAAsB,MAAMC,EAAWH,CAAuB;AAEpE,SAASI,EAAyB;AAAA,EACvC,UAAAC;AAAA,EACA,UAAAC;AACF,GAGG;AACD,QAAMC,IAAyBC,EAAO,EAAK,GACrCC,IAASC,EAAA;AACf,SACE,gBAAAC,EAACX,EAAwB,UAAxB,EAAiC,OAAO,EAAE,UAAAK,GAAU,QAAAI,GAAQ,wBAAAF,KAC1D,UAAAD,GACH;AAEJ;AAEAN,EAAwB,cAAc;"}
1
+ {"version":3,"file":"EndpointLocationContext.js","sources":["../../src/contexts/EndpointLocationContext.tsx"],"sourcesContent":["\nimport { createContext, ReactElement, MutableRefObject, useContext, useRef } from 'react';\n\nimport { useCheckHash } from '../hooks/useCheckHash';\nimport { LocationType } from '../api-playground-2/types/api';\n\nexport type EndpointLocationContextType = {\n location?: LocationType;\n anchor?: string;\n hasScrolledToAnchorRef?: MutableRefObject<boolean>;\n};\n\nexport const EndpointLocationContext = createContext<EndpointLocationContextType>({});\n\nexport const useEndpointLocation = () => useContext(EndpointLocationContext);\n\nexport function EndpointLocationProvider({\n location,\n children,\n}: {\n location?: LocationType;\n children?: ReactElement;\n}) {\n const hasScrolledToAnchorRef = useRef(false);\n const anchor = useCheckHash();\n return (\n <EndpointLocationContext.Provider value={{ location, anchor, hasScrolledToAnchorRef }}>\n {children}\n </EndpointLocationContext.Provider>\n );\n}\n\nEndpointLocationContext.displayName = 'EndpointLocationContext';\n"],"names":["EndpointLocationContext","createContext","useEndpointLocation","useContext","EndpointLocationProvider","location","children","hasScrolledToAnchorRef","useRef","anchor","useCheckHash","jsx"],"mappings":";;;AAYO,MAAMA,IAA0BC,EAA2C,CAAA,CAAE,GAEvEC,IAAsB,MAAMC,EAAWH,CAAuB;AAEpE,SAASI,EAAyB;AAAA,EACvC,UAAAC;AAAA,EACA,UAAAC;AACF,GAGG;AACD,QAAMC,IAAyBC,EAAO,EAAK,GACrCC,IAASC,EAAA;AACf,SACE,gBAAAC,EAACX,EAAwB,UAAxB,EAAiC,OAAO,EAAE,UAAAK,GAAU,QAAAI,GAAQ,wBAAAF,KAC1D,UAAAD,GACH;AAEJ;AAEAN,EAAwB,cAAc;"}
@@ -1,6 +1,5 @@
1
1
  import "react/jsx-runtime";
2
2
  import { createContext as e } from "react";
3
- import "./ConfigContext.js";
4
3
  const t = {
5
4
  headings: [],
6
5
  apiBaseIndex: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"MDXContentContext.js","sources":["../../src/contexts/MDXContentContext.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, ReactNode, Reducer, useContext, useMemo, useReducer } from 'react';\n\nimport { ChangelogFilterType, HeadingType, MDXContentState } from '../types/mdxContentController';\n\nimport { PageContext } from './ConfigContext';\n\nexport const initialState: MDXContentState = {\n headings: [],\n apiBaseIndex: 0,\n codeExamples: {},\n pageMetadata: {},\n selectedBodyContentType: undefined,\n selectedResponseContentType: undefined,\n tableOfContents: [],\n changelogFilters: [],\n};\n\n/**\n * Actions that can be dispatched in the MDXContentReducer.\n */\ntype MDXContentAction =\n | { type: 'set_state'; payload: Partial<MDXContentState> }\n | { type: 'set_api_base_index'; payload: number }\n | { type: 'set_selected_body_content_type'; payload: string }\n | { type: 'set_selected_response_content_type'; payload: string }\n | { type: 'register_heading'; payload: HeadingType }\n | { type: 'unregister_heading'; payload: string }\n | { type: 'toggle_changelog_filter'; payload: ChangelogFilterType };\n\nexport type MDXContentActionType = MDXContentAction['type'];\n\n/**\n * Consolidates state and update logic of MDXContentController.\n * @param state - current state.\n * @param action - state action to dispatch.\n * @returns MDXContentState - new state.\n */\nexport const MDXContentReducer: Reducer<MDXContentState, MDXContentAction> = (\n state: MDXContentState,\n action\n) => {\n const type = action.type;\n switch (type) {\n case 'set_state':\n return {\n ...state,\n ...action.payload,\n };\n case 'register_heading':\n const { id, top } = action.payload;\n return {\n ...state,\n headings: [...state.headings.filter((h) => id !== h.id), { id, top }],\n };\n case 'unregister_heading':\n return {\n ...state,\n headings: state.headings.filter((h) => action.payload !== h.id),\n };\n case 'set_selected_body_content_type':\n return {\n ...state,\n selectedBodyContentType: action.payload,\n };\n case 'set_selected_response_content_type':\n return {\n ...state,\n selectedResponseContentType: action.payload,\n };\n case 'set_api_base_index':\n return {\n ...state,\n apiBaseIndex: action.payload,\n };\n case 'toggle_changelog_filter':\n const existingFilterIndex = state.changelogFilters.findIndex(\n (filter) => filter.tag === action.payload.tag\n );\n if (existingFilterIndex !== -1) {\n const newFilters = [...state.changelogFilters];\n newFilters[existingFilterIndex] = action.payload;\n return {\n ...state,\n changelogFilters: newFilters,\n };\n }\n return {\n ...state,\n changelogFilters: [...state.changelogFilters, action.payload],\n };\n }\n};\n\nexport const useMDXContentReducer = (state?: Partial<MDXContentState>) => {\n const initializedState = {\n ...initialState,\n ...state,\n };\n return useReducer(MDXContentReducer, initializedState);\n};\n\nexport function useInitializeMDXContentReducer() {\n const { pageMetadata, mdxExtracts } = useContext(PageContext);\n const initialSelectedBodyContentType = Object.keys(mdxExtracts?.endpoint?.request.body ?? {})[0];\n\n const ctx = useMDXContentReducer({\n pageMetadata,\n selectedBodyContentType: initialSelectedBodyContentType,\n ...mdxExtracts,\n });\n\n return useMemo(() => {\n return ctx;\n }, [ctx]);\n}\n\nexport type MDXContentContextType = ReturnType<typeof useMDXContentReducer>;\n\nexport const MDXContentContext = createContext<MDXContentContextType>([initialState, () => null]);\n\nexport function MDXContentProvider({ children }: { children: ReactNode }) {\n const ctx = useInitializeMDXContentReducer();\n return <MDXContentContext.Provider value={ctx}>{children}</MDXContentContext.Provider>;\n}\n\nMDXContentContext.displayName = 'MDXContentContext';\n"],"names":["initialState","MDXContentContext","createContext"],"mappings":";;;AAQO,MAAMA,IAAgC;AAAA,EAC3C,UAAU,CAAA;AAAA,EACV,cAAc;AAAA,EACd,cAAc,CAAA;AAAA,EACd,cAAc,CAAA;AAAA,EACd,yBAAyB;AAAA,EACzB,6BAA6B;AAAA,EAC7B,iBAAiB,CAAA;AAAA,EACjB,kBAAkB,CAAA;AACpB,GAuGaC,IAAoBC,EAAqC,CAACF,GAAc,MAAM,IAAI,CAAC;AAOhGC,EAAkB,cAAc;"}
1
+ {"version":3,"file":"MDXContentContext.js","sources":["../../src/contexts/MDXContentContext.tsx"],"sourcesContent":["\nimport { createContext, ReactNode, Reducer, useContext, useMemo, useReducer } from 'react';\n\nimport { ChangelogFilterType, HeadingType, MDXContentState } from '../types/mdxContentController';\n\nimport { PageContext } from './ConfigContext';\n\nexport const initialState: MDXContentState = {\n headings: [],\n apiBaseIndex: 0,\n codeExamples: {},\n pageMetadata: {},\n selectedBodyContentType: undefined,\n selectedResponseContentType: undefined,\n tableOfContents: [],\n changelogFilters: [],\n};\n\n/**\n * Actions that can be dispatched in the MDXContentReducer.\n */\ntype MDXContentAction =\n | { type: 'set_state'; payload: Partial<MDXContentState> }\n | { type: 'set_api_base_index'; payload: number }\n | { type: 'set_selected_body_content_type'; payload: string }\n | { type: 'set_selected_response_content_type'; payload: string }\n | { type: 'register_heading'; payload: HeadingType }\n | { type: 'unregister_heading'; payload: string }\n | { type: 'toggle_changelog_filter'; payload: ChangelogFilterType };\n\nexport type MDXContentActionType = MDXContentAction['type'];\n\n/**\n * Consolidates state and update logic of MDXContentController.\n * @param state - current state.\n * @param action - state action to dispatch.\n * @returns MDXContentState - new state.\n */\nexport const MDXContentReducer: Reducer<MDXContentState, MDXContentAction> = (\n state: MDXContentState,\n action\n) => {\n const type = action.type;\n switch (type) {\n case 'set_state':\n return {\n ...state,\n ...action.payload,\n };\n case 'register_heading':\n const { id, top } = action.payload;\n return {\n ...state,\n headings: [...state.headings.filter((h) => id !== h.id), { id, top }],\n };\n case 'unregister_heading':\n return {\n ...state,\n headings: state.headings.filter((h) => action.payload !== h.id),\n };\n case 'set_selected_body_content_type':\n return {\n ...state,\n selectedBodyContentType: action.payload,\n };\n case 'set_selected_response_content_type':\n return {\n ...state,\n selectedResponseContentType: action.payload,\n };\n case 'set_api_base_index':\n return {\n ...state,\n apiBaseIndex: action.payload,\n };\n case 'toggle_changelog_filter':\n const existingFilterIndex = state.changelogFilters.findIndex(\n (filter) => filter.tag === action.payload.tag\n );\n if (existingFilterIndex !== -1) {\n const newFilters = [...state.changelogFilters];\n newFilters[existingFilterIndex] = action.payload;\n return {\n ...state,\n changelogFilters: newFilters,\n };\n }\n return {\n ...state,\n changelogFilters: [...state.changelogFilters, action.payload],\n };\n }\n};\n\nexport const useMDXContentReducer = (state?: Partial<MDXContentState>) => {\n const initializedState = {\n ...initialState,\n ...state,\n };\n return useReducer(MDXContentReducer, initializedState);\n};\n\nexport function useInitializeMDXContentReducer() {\n const { pageMetadata, mdxExtracts } = useContext(PageContext);\n const initialSelectedBodyContentType = Object.keys(mdxExtracts?.endpoint?.request.body ?? {})[0];\n\n const ctx = useMDXContentReducer({\n pageMetadata,\n selectedBodyContentType: initialSelectedBodyContentType,\n ...mdxExtracts,\n });\n\n return useMemo(() => {\n return ctx;\n }, [ctx]);\n}\n\nexport type MDXContentContextType = ReturnType<typeof useMDXContentReducer>;\n\nexport const MDXContentContext = createContext<MDXContentContextType>([initialState, () => null]);\n\nexport function MDXContentProvider({ children }: { children: ReactNode }) {\n const ctx = useInitializeMDXContentReducer();\n return <MDXContentContext.Provider value={ctx}>{children}</MDXContentContext.Provider>;\n}\n\nMDXContentContext.displayName = 'MDXContentContext';\n"],"names":["initialState","MDXContentContext","createContext"],"mappings":";;AAOO,MAAMA,IAAgC;AAAA,EAC3C,UAAU,CAAA;AAAA,EACV,cAAc;AAAA,EACd,cAAc,CAAA;AAAA,EACd,cAAc,CAAA;AAAA,EACd,yBAAyB;AAAA,EACzB,6BAA6B;AAAA,EAC7B,iBAAiB,CAAA;AAAA,EACjB,kBAAkB,CAAA;AACpB,GAuGaC,IAAoBC,EAAqC,CAACF,GAAc,MAAM,IAAI,CAAC;AAOhGC,EAAkB,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useApiPlaygroundDisplay.js","sources":["../../src/hooks/useApiPlaygroundDisplay.ts"],"sourcesContent":["'use client';\n\nimport { ApiPlaygroundDisplayType } from '@mintlify/models';\nimport { EndpointType } from '@mintlify/validation';\nimport { useContext, useMemo } from 'react';\n\nimport { ApiReferenceContext2, DocsConfigContext, PageContext } from '../contexts/ConfigContext';\nimport { useEndpoint } from '../hooks/useEndpoint';\n\nexport const useApiPlaygroundDisplay = (): ApiPlaygroundDisplayType => {\n const { docsConfig } = useContext(DocsConfigContext);\n const { pageMetadata } = useContext(PageContext);\n const endpoint = useEndpoint();\n const { apiReferenceData2 } = useContext(ApiReferenceContext2);\n\n let endpointType: EndpointType | undefined;\n if (apiReferenceData2.operation) {\n endpointType = apiReferenceData2.operation.type;\n } else {\n endpointType = endpoint?.type;\n }\n\n return useMemo(() => {\n const mode =\n endpointType === 'webhook'\n ? 'simple'\n : pageMetadata.playground || docsConfig?.api?.playground?.display;\n return mode ?? 'interactive';\n }, [docsConfig, pageMetadata, endpointType]);\n};\n"],"names":["useApiPlaygroundDisplay","docsConfig","useContext","DocsConfigContext","pageMetadata","PageContext","endpoint","useEndpoint","apiReferenceData2","ApiReferenceContext2","endpointType","useMemo","_b","_a"],"mappings":";;;AASO,MAAMA,IAA0B,MAAgC;AACrE,QAAM,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAiB,GAC7C,EAAE,cAAAC,EAAA,IAAiBF,EAAWG,CAAW,GACzCC,IAAWC,EAAA,GACX,EAAE,mBAAAC,EAAA,IAAsBN,EAAWO,CAAoB;AAE7D,MAAIC;AACJ,SAAIF,EAAkB,YACpBE,IAAeF,EAAkB,UAAU,OAE3CE,IAAeJ,KAAA,gBAAAA,EAAU,MAGpBK,EAAQ,MAAM;;AAKnB,YAHED,MAAiB,YACb,WACAN,EAAa,gBAAcQ,KAAAC,IAAAZ,KAAA,gBAAAA,EAAY,QAAZ,gBAAAY,EAAiB,eAAjB,gBAAAD,EAA6B,aAC/C;AAAA,EACjB,GAAG,CAACX,GAAYG,GAAcM,CAAY,CAAC;AAC7C;"}
1
+ {"version":3,"file":"useApiPlaygroundDisplay.js","sources":["../../src/hooks/useApiPlaygroundDisplay.ts"],"sourcesContent":["\nimport { ApiPlaygroundDisplayType } from '@mintlify/models';\nimport { EndpointType } from '@mintlify/validation';\nimport { useContext, useMemo } from 'react';\n\nimport { ApiReferenceContext2, DocsConfigContext, PageContext } from '../contexts/ConfigContext';\nimport { useEndpoint } from '../hooks/useEndpoint';\n\nexport const useApiPlaygroundDisplay = (): ApiPlaygroundDisplayType => {\n const { docsConfig } = useContext(DocsConfigContext);\n const { pageMetadata } = useContext(PageContext);\n const endpoint = useEndpoint();\n const { apiReferenceData2 } = useContext(ApiReferenceContext2);\n\n let endpointType: EndpointType | undefined;\n if (apiReferenceData2.operation) {\n endpointType = apiReferenceData2.operation.type;\n } else {\n endpointType = endpoint?.type;\n }\n\n return useMemo(() => {\n const mode =\n endpointType === 'webhook'\n ? 'simple'\n : pageMetadata.playground || docsConfig?.api?.playground?.display;\n return mode ?? 'interactive';\n }, [docsConfig, pageMetadata, endpointType]);\n};\n"],"names":["useApiPlaygroundDisplay","docsConfig","useContext","DocsConfigContext","pageMetadata","PageContext","endpoint","useEndpoint","apiReferenceData2","ApiReferenceContext2","endpointType","useMemo","_b","_a"],"mappings":";;;AAQO,MAAMA,IAA0B,MAAgC;AACrE,QAAM,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAiB,GAC7C,EAAE,cAAAC,EAAA,IAAiBF,EAAWG,CAAW,GACzCC,IAAWC,EAAA,GACX,EAAE,mBAAAC,EAAA,IAAsBN,EAAWO,CAAoB;AAE7D,MAAIC;AACJ,SAAIF,EAAkB,YACpBE,IAAeF,EAAkB,UAAU,OAE3CE,IAAeJ,KAAA,gBAAAA,EAAU,MAGpBK,EAAQ,MAAM;;AAKnB,YAHED,MAAiB,YACb,WACAN,EAAa,gBAAcQ,KAAAC,IAAAZ,KAAA,gBAAAA,EAAY,QAAZ,gBAAAY,EAAiB,eAAjB,gBAAAD,EAA6B,aAC/C;AAAA,EACjB,GAAG,CAACX,GAAYG,GAAcM,CAAY,CAAC;AAC7C;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useApiPlaygroundInputs.js","sources":["../../src/hooks/useApiPlaygroundInputs.ts"],"sourcesContent":["'use client';\n\nimport { useContext } from 'react';\n\nimport { ApiPlaygroundInputsContext } from '@/contexts/ApiPlaygroundInputsContext';\n\nexport const useApiPlaygroundInputs = () => useContext(ApiPlaygroundInputsContext);\n"],"names":["useApiPlaygroundInputs","useContext","ApiPlaygroundInputsContext"],"mappings":";;AAMO,MAAMA,IAAyB,MAAMC,EAAWC,CAA0B;"}
1
+ {"version":3,"file":"useApiPlaygroundInputs.js","sources":["../../src/hooks/useApiPlaygroundInputs.ts"],"sourcesContent":["\nimport { useContext } from 'react';\n\nimport { ApiPlaygroundInputsContext } from '@/contexts/ApiPlaygroundInputsContext';\n\nexport const useApiPlaygroundInputs = () => useContext(ApiPlaygroundInputsContext);\n"],"names":["useApiPlaygroundInputs","useContext","ApiPlaygroundInputsContext"],"mappings":";;AAKO,MAAMA,IAAyB,MAAMC,EAAWC,CAA0B;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseUrlOptions.js","sources":["../../src/hooks/useBaseUrlOptions.ts"],"sourcesContent":["'use client';\n\nimport { useContext, useMemo } from 'react';\n\nimport { DocsConfigContext } from '../contexts/ConfigContext';\n\nimport { useEndpoint } from '../hooks/useEndpoint';\n\nexport const useBaseUrlOptions = () => {\n const endpoint = useEndpoint();\n const { docsConfig } = useContext(DocsConfigContext);\n\n return useMemo(() => {\n const endpointUrls = endpoint?.servers?.map(({ url }) => url);\n if (endpointUrls && endpointUrls.length > 0) {\n return endpointUrls;\n }\n\n const configUrlOrUrls = docsConfig?.api?.mdx?.server;\n return typeof configUrlOrUrls === 'string' ? [configUrlOrUrls] : configUrlOrUrls;\n }, [endpoint?.servers, docsConfig?.api?.mdx?.server]);\n};\n"],"names":["useBaseUrlOptions","endpoint","useEndpoint","docsConfig","useContext","DocsConfigContext","useMemo","endpointUrls","_a","url","configUrlOrUrls","_c","_b"],"mappings":";;;AAQO,MAAMA,IAAoB,MAAM;;AACrC,QAAMC,IAAWC,EAAA,GACX,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAiB;AAEnD,SAAOC,EAAQ,MAAM;;AACnB,UAAMC,KAAeC,IAAAP,KAAA,gBAAAA,EAAU,YAAV,gBAAAO,EAAmB,IAAI,CAAC,EAAE,KAAAC,EAAA,MAAUA;AACzD,QAAIF,KAAgBA,EAAa,SAAS;AACxC,aAAOA;AAGT,UAAMG,KAAkBC,KAAAC,IAAAT,KAAA,gBAAAA,EAAY,QAAZ,gBAAAS,EAAiB,QAAjB,gBAAAD,EAAsB;AAC9C,WAAO,OAAOD,KAAoB,WAAW,CAACA,CAAe,IAAIA;AAAA,EACnE,GAAG,CAACT,KAAA,gBAAAA,EAAU,UAASW,KAAAJ,IAAAL,KAAA,gBAAAA,EAAY,QAAZ,gBAAAK,EAAiB,QAAjB,gBAAAI,EAAsB,MAAM,CAAC;AACtD;"}
1
+ {"version":3,"file":"useBaseUrlOptions.js","sources":["../../src/hooks/useBaseUrlOptions.ts"],"sourcesContent":["\nimport { useContext, useMemo } from 'react';\n\nimport { DocsConfigContext } from '../contexts/ConfigContext';\n\nimport { useEndpoint } from '../hooks/useEndpoint';\n\nexport const useBaseUrlOptions = () => {\n const endpoint = useEndpoint();\n const { docsConfig } = useContext(DocsConfigContext);\n\n return useMemo(() => {\n const endpointUrls = endpoint?.servers?.map(({ url }) => url);\n if (endpointUrls && endpointUrls.length > 0) {\n return endpointUrls;\n }\n\n const configUrlOrUrls = docsConfig?.api?.mdx?.server;\n return typeof configUrlOrUrls === 'string' ? [configUrlOrUrls] : configUrlOrUrls;\n }, [endpoint?.servers, docsConfig?.api?.mdx?.server]);\n};\n"],"names":["useBaseUrlOptions","endpoint","useEndpoint","docsConfig","useContext","DocsConfigContext","useMemo","endpointUrls","_a","url","configUrlOrUrls","_c","_b"],"mappings":";;;AAOO,MAAMA,IAAoB,MAAM;;AACrC,QAAMC,IAAWC,EAAA,GACX,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAiB;AAEnD,SAAOC,EAAQ,MAAM;;AACnB,UAAMC,KAAeC,IAAAP,KAAA,gBAAAA,EAAU,YAAV,gBAAAO,EAAmB,IAAI,CAAC,EAAE,KAAAC,EAAA,MAAUA;AACzD,QAAIF,KAAgBA,EAAa,SAAS;AACxC,aAAOA;AAGT,UAAMG,KAAkBC,KAAAC,IAAAT,KAAA,gBAAAA,EAAY,QAAZ,gBAAAS,EAAiB,QAAjB,gBAAAD,EAAsB;AAC9C,WAAO,OAAOD,KAAoB,WAAW,CAACA,CAAe,IAAIA;AAAA,EACnE,GAAG,CAACT,KAAA,gBAAAA,EAAU,UAASW,KAAAJ,IAAAL,KAAA,gBAAAA,EAAY,QAAZ,gBAAAK,EAAiB,QAAjB,gBAAAI,EAAsB,MAAM,CAAC;AACtD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEndpoint.js","sources":["../../src/hooks/useEndpoint.ts"],"sourcesContent":["'use client';\n\nimport { useContext, useMemo } from 'react';\n\nimport { ApiReferenceContext } from '../contexts/ConfigContext';\n\n// we sometimes only want the OpenAPI endpoint (e.g. Endpoint Fields)\nexport const useOpenApiEndpoint = () => {\n const {\n apiReferenceData: { endpoint },\n } = useContext(ApiReferenceContext);\n\n return endpoint;\n};\n\nexport const useHasOpenApiEndpoint = () => {\n const openApiEndpoint = useOpenApiEndpoint();\n\n return openApiEndpoint !== undefined;\n};\n\nexport const useEndpoint = () => {\n const openApiEndpoint = useOpenApiEndpoint();\n\n return useMemo(() => {\n // if both exist, prefer OpenAPI\n return openApiEndpoint;\n }, [openApiEndpoint]);\n};\n\nexport const useHasEndpoint = () => {\n const endpoint = useEndpoint();\n\n return endpoint !== undefined;\n};\n"],"names":["useOpenApiEndpoint","endpoint","useContext","ApiReferenceContext","useEndpoint","openApiEndpoint","useMemo"],"mappings":";;AAOO,MAAMA,IAAqB,MAAM;AACtC,QAAM;AAAA,IACJ,kBAAkB,EAAE,UAAAC,EAAA;AAAA,EAAS,IAC3BC,EAAWC,CAAmB;AAElC,SAAOF;AACT,GAQaG,IAAc,MAAM;AAC/B,QAAMC,IAAkBL,EAAA;AAExB,SAAOM,EAAQ,MAEND,GACN,CAACA,CAAe,CAAC;AACtB;"}
1
+ {"version":3,"file":"useEndpoint.js","sources":["../../src/hooks/useEndpoint.ts"],"sourcesContent":["\nimport { useContext, useMemo } from 'react';\n\nimport { ApiReferenceContext } from '../contexts/ConfigContext';\n\n// we sometimes only want the OpenAPI endpoint (e.g. Endpoint Fields)\nexport const useOpenApiEndpoint = () => {\n const {\n apiReferenceData: { endpoint },\n } = useContext(ApiReferenceContext);\n\n return endpoint;\n};\n\nexport const useHasOpenApiEndpoint = () => {\n const openApiEndpoint = useOpenApiEndpoint();\n\n return openApiEndpoint !== undefined;\n};\n\nexport const useEndpoint = () => {\n const openApiEndpoint = useOpenApiEndpoint();\n\n return useMemo(() => {\n // if both exist, prefer OpenAPI\n return openApiEndpoint;\n }, [openApiEndpoint]);\n};\n\nexport const useHasEndpoint = () => {\n const endpoint = useEndpoint();\n\n return endpoint !== undefined;\n};\n"],"names":["useOpenApiEndpoint","endpoint","useContext","ApiReferenceContext","useEndpoint","openApiEndpoint","useMemo"],"mappings":";;AAMO,MAAMA,IAAqB,MAAM;AACtC,QAAM;AAAA,IACJ,kBAAkB,EAAE,UAAAC,EAAA;AAAA,EAAS,IAC3BC,EAAWC,CAAmB;AAElC,SAAOF;AACT,GAQaG,IAAc,MAAM;AAC/B,QAAMC,IAAkBL,EAAA;AAExB,SAAOM,EAAQ,MAEND,GACN,CAACA,CAAe,CAAC;AACtB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useKeyboardShortcut.js","sources":["../../src/hooks/useKeyboardShortcut.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect } from 'react';\n\ntype UseKeyboardShortcutType = {\n key: string;\n callback: (() => void) | (() => Promise<void>) | undefined;\n isSingleKey?: boolean;\n excludedActiveElementId?: string[];\n excludedActiveElements?: (keyof HTMLElementTagNameMap)[];\n isDisabled?: boolean;\n};\n\nexport const useKeyboardShortcut = ({\n key,\n callback,\n isSingleKey,\n excludedActiveElementId,\n excludedActiveElements,\n isDisabled,\n}: UseKeyboardShortcutType) => {\n const onKeypress = useCallback(\n (event: KeyboardEvent) => {\n if (isDisabled) return;\n\n let shouldExclude = false;\n const activeElement = document.activeElement;\n\n if (excludedActiveElementId) {\n shouldExclude = !!activeElement?.id && excludedActiveElementId.includes(activeElement.id);\n }\n\n if (excludedActiveElements && !shouldExclude) {\n shouldExclude = excludedActiveElements.includes(\n \n activeElement?.tagName.toLowerCase() as keyof HTMLElementTagNameMap\n );\n }\n\n const isShortcut = event.key === key && (isSingleKey || event.metaKey || event.ctrlKey);\n if (isShortcut && !shouldExclude) {\n event.preventDefault();\n void callback?.();\n }\n },\n [callback, key, isSingleKey, excludedActiveElementId, excludedActiveElements, isDisabled]\n );\n\n useEffect(() => {\n addEventListener('keydown', onKeypress);\n return () => removeEventListener('keydown', onKeypress);\n }, [onKeypress]);\n};\n"],"names":["useKeyboardShortcut","key","callback","isSingleKey","excludedActiveElementId","excludedActiveElements","isDisabled","onKeypress","useCallback","event","shouldExclude","activeElement","useEffect"],"mappings":";AAaO,MAAMA,IAAsB,CAAC;AAAA,EAClC,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,YAAAC;AACF,MAA+B;AAC7B,QAAMC,IAAaC;AAAA,IACjB,CAACC,MAAyB;AACxB,UAAIH,EAAY;AAEhB,UAAII,IAAgB;AACpB,YAAMC,IAAgB,SAAS;AAE/B,MAAIP,MACFM,IAAgB,CAAC,EAACC,KAAA,QAAAA,EAAe,OAAMP,EAAwB,SAASO,EAAc,EAAE,IAGtFN,KAA0B,CAACK,MAC7BA,IAAgBL,EAAuB;AAAA,QAErCM,KAAA,gBAAAA,EAAe,QAAQ;AAAA,MAAY,IAIpBF,EAAM,QAAQR,MAAQE,KAAeM,EAAM,WAAWA,EAAM,YAC7D,CAACC,MACjBD,EAAM,eAAA,GACDP,KAAA,QAAAA;AAAA,IAET;AAAA,IACA,CAACA,GAAUD,GAAKE,GAAaC,GAAyBC,GAAwBC,CAAU;AAAA,EAAA;AAG1F,EAAAM,EAAU,OACR,iBAAiB,WAAWL,CAAU,GAC/B,MAAM,oBAAoB,WAAWA,CAAU,IACrD,CAACA,CAAU,CAAC;AACjB;"}
1
+ {"version":3,"file":"useKeyboardShortcut.js","sources":["../../src/hooks/useKeyboardShortcut.ts"],"sourcesContent":["\nimport { useCallback, useEffect } from 'react';\n\ntype UseKeyboardShortcutType = {\n key: string;\n callback: (() => void) | (() => Promise<void>) | undefined;\n isSingleKey?: boolean;\n excludedActiveElementId?: string[];\n excludedActiveElements?: (keyof HTMLElementTagNameMap)[];\n isDisabled?: boolean;\n};\n\nexport const useKeyboardShortcut = ({\n key,\n callback,\n isSingleKey,\n excludedActiveElementId,\n excludedActiveElements,\n isDisabled,\n}: UseKeyboardShortcutType) => {\n const onKeypress = useCallback(\n (event: KeyboardEvent) => {\n if (isDisabled) return;\n\n let shouldExclude = false;\n const activeElement = document.activeElement;\n\n if (excludedActiveElementId) {\n shouldExclude = !!activeElement?.id && excludedActiveElementId.includes(activeElement.id);\n }\n\n if (excludedActiveElements && !shouldExclude) {\n shouldExclude = excludedActiveElements.includes(\n \n activeElement?.tagName.toLowerCase() as keyof HTMLElementTagNameMap\n );\n }\n\n const isShortcut = event.key === key && (isSingleKey || event.metaKey || event.ctrlKey);\n if (isShortcut && !shouldExclude) {\n event.preventDefault();\n void callback?.();\n }\n },\n [callback, key, isSingleKey, excludedActiveElementId, excludedActiveElements, isDisabled]\n );\n\n useEffect(() => {\n addEventListener('keydown', onKeypress);\n return () => removeEventListener('keydown', onKeypress);\n }, [onKeypress]);\n};\n"],"names":["useKeyboardShortcut","key","callback","isSingleKey","excludedActiveElementId","excludedActiveElements","isDisabled","onKeypress","useCallback","event","shouldExclude","activeElement","useEffect"],"mappings":";AAYO,MAAMA,IAAsB,CAAC;AAAA,EAClC,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,YAAAC;AACF,MAA+B;AAC7B,QAAMC,IAAaC;AAAA,IACjB,CAACC,MAAyB;AACxB,UAAIH,EAAY;AAEhB,UAAII,IAAgB;AACpB,YAAMC,IAAgB,SAAS;AAE/B,MAAIP,MACFM,IAAgB,CAAC,EAACC,KAAA,QAAAA,EAAe,OAAMP,EAAwB,SAASO,EAAc,EAAE,IAGtFN,KAA0B,CAACK,MAC7BA,IAAgBL,EAAuB;AAAA,QAErCM,KAAA,gBAAAA,EAAe,QAAQ;AAAA,MAAY,IAIpBF,EAAM,QAAQR,MAAQE,KAAeM,EAAM,WAAWA,EAAM,YAC7D,CAACC,MACjBD,EAAM,eAAA,GACDP,KAAA,QAAAA;AAAA,IAET;AAAA,IACA,CAACA,GAAUD,GAAKE,GAAaC,GAAyBC,GAAwBC,CAAU;AAAA,EAAA;AAG1F,EAAAM,EAAU,OACR,iBAAiB,WAAWL,CAAU,GAC/B,MAAM,oBAAoB,WAAWA,CAAU,IACrD,CAACA,CAAU,CAAC;AACjB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useMDXContent.js","sources":["../../src/hooks/useMDXContent.ts"],"sourcesContent":["'use client';\n\nimport { useContext } from 'react';\n\nimport { MDXContentContext } from '../contexts/MDXContentContext';\n\nexport const useMDXContent = () => useContext(MDXContentContext);\n"],"names":["useMDXContent","useContext","MDXContentContext"],"mappings":";;AAMO,MAAMA,IAAgB,MAAMC,EAAWC,CAAiB;"}
1
+ {"version":3,"file":"useMDXContent.js","sources":["../../src/hooks/useMDXContent.ts"],"sourcesContent":["\nimport { useContext } from 'react';\n\nimport { MDXContentContext } from '../contexts/MDXContentContext';\n\nexport const useMDXContent = () => useContext(MDXContentContext);\n"],"names":["useMDXContent","useContext","MDXContentContext"],"mappings":";;AAKO,MAAMA,IAAgB,MAAMC,EAAWC,CAAiB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useApiPlaygroundInputs.js","sources":["../../../src/hooks/useMDXContentController/useApiPlaygroundInputs.ts"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { useApiPlaygroundInputs as useApiPlaygroundInputsCtx } from '@/hooks/useApiPlaygroundInputs';\n\nexport const useApiPlaygroundInputs = () => {\n const [context] = useApiPlaygroundInputsCtx();\n return useMemo(() => {\n return context;\n }, [context]);\n};\n"],"names":["useApiPlaygroundInputs","context","useApiPlaygroundInputsCtx","useMemo"],"mappings":";;AAMO,MAAMA,IAAyB,MAAM;AAC1C,QAAM,CAACC,CAAO,IAAIC,EAAA;AAClB,SAAOC,EAAQ,MACNF,GACN,CAACA,CAAO,CAAC;AACd;"}
1
+ {"version":3,"file":"useApiPlaygroundInputs.js","sources":["../../../src/hooks/useMDXContentController/useApiPlaygroundInputs.ts"],"sourcesContent":["\nimport { useMemo } from 'react';\n\nimport { useApiPlaygroundInputs as useApiPlaygroundInputsCtx } from '@/hooks/useApiPlaygroundInputs';\n\nexport const useApiPlaygroundInputs = () => {\n const [context] = useApiPlaygroundInputsCtx();\n return useMemo(() => {\n return context;\n }, [context]);\n};\n"],"names":["useApiPlaygroundInputs","context","useApiPlaygroundInputsCtx","useMemo"],"mappings":";;AAKO,MAAMA,IAAyB,MAAM;AAC1C,QAAM,CAACC,CAAO,IAAIC,EAAA;AAClB,SAAOC,EAAQ,MACNF,GACN,CAACA,CAAO,CAAC;AACd;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSetApiBaseIndexCallback.js","sources":["../../../../src/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.ts"],"sourcesContent":["'use client';\n\nimport { useCallback } from 'react';\n\nimport { useMDXContent } from '@/hooks/useMDXContent';\n\nexport const useSetApiBaseIndexCallback = () => {\n const [, dispatch] = useMDXContent();\n return useCallback(\n (x: number) =>\n dispatch({\n type: 'set_api_base_index',\n payload: x,\n }),\n [dispatch]\n );\n};\n"],"names":["useSetApiBaseIndexCallback","dispatch","useMDXContent","useCallback","x"],"mappings":";;AAMO,MAAMA,IAA6B,MAAM;AAC9C,QAAM,CAAA,EAAGC,CAAQ,IAAIC,EAAA;AACrB,SAAOC;AAAA,IACL,CAACC,MACCH,EAAS;AAAA,MACP,MAAM;AAAA,MACN,SAASG;AAAA,IAAA,CACV;AAAA,IACH,CAACH,CAAQ;AAAA,EAAA;AAEb;"}
1
+ {"version":3,"file":"useSetApiBaseIndexCallback.js","sources":["../../../../src/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.ts"],"sourcesContent":["\nimport { useCallback } from 'react';\n\nimport { useMDXContent } from '@/hooks/useMDXContent';\n\nexport const useSetApiBaseIndexCallback = () => {\n const [, dispatch] = useMDXContent();\n return useCallback(\n (x: number) =>\n dispatch({\n type: 'set_api_base_index',\n payload: x,\n }),\n [dispatch]\n );\n};\n"],"names":["useSetApiBaseIndexCallback","dispatch","useMDXContent","useCallback","x"],"mappings":";;AAKO,MAAMA,IAA6B,MAAM;AAC9C,QAAM,CAAA,EAAGC,CAAQ,IAAIC,EAAA;AACrB,SAAOC;AAAA,IACL,CAACC,MACCH,EAAS;AAAA,MACP,MAAM;AAAA,MACN,SAASG;AAAA,IAAA,CACV;AAAA,IACH,CAACH,CAAQ;AAAA,EAAA;AAEb;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSetApiPlaygroundInputsCallback.js","sources":["../../../../src/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.ts"],"sourcesContent":["'use client';\n\nimport { ApiPlaygroundInputs } from '@mintlify/validation';\nimport { useCallback } from 'react';\n\nimport { useApiPlaygroundInputs } from '@/hooks/useApiPlaygroundInputs';\n\nexport const useSetApiPlaygroundInputsCallback = () => {\n const [, dispatch] = useApiPlaygroundInputs();\n return useCallback(\n (inputs: ApiPlaygroundInputs) =>\n dispatch({\n type: 'set_api_playground_inputs',\n payload: inputs,\n }),\n [dispatch]\n );\n};\n"],"names":["useSetApiPlaygroundInputsCallback","dispatch","useApiPlaygroundInputs","useCallback","inputs"],"mappings":";;AAOO,MAAMA,IAAoC,MAAM;AACrD,QAAM,CAAA,EAAGC,CAAQ,IAAIC,EAAA;AACrB,SAAOC;AAAA,IACL,CAACC,MACCH,EAAS;AAAA,MACP,MAAM;AAAA,MACN,SAASG;AAAA,IAAA,CACV;AAAA,IACH,CAACH,CAAQ;AAAA,EAAA;AAEb;"}
1
+ {"version":3,"file":"useSetApiPlaygroundInputsCallback.js","sources":["../../../../src/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.ts"],"sourcesContent":["\nimport { ApiPlaygroundInputs } from '@mintlify/validation';\nimport { useCallback } from 'react';\n\nimport { useApiPlaygroundInputs } from '@/hooks/useApiPlaygroundInputs';\n\nexport const useSetApiPlaygroundInputsCallback = () => {\n const [, dispatch] = useApiPlaygroundInputs();\n return useCallback(\n (inputs: ApiPlaygroundInputs) =>\n dispatch({\n type: 'set_api_playground_inputs',\n payload: inputs,\n }),\n [dispatch]\n );\n};\n"],"names":["useSetApiPlaygroundInputsCallback","dispatch","useApiPlaygroundInputs","useCallback","inputs"],"mappings":";;AAMO,MAAMA,IAAoC,MAAM;AACrD,QAAM,CAAA,EAAGC,CAAQ,IAAIC,EAAA;AACrB,SAAOC;AAAA,IACL,CAACC,MACCH,EAAS;AAAA,MACP,MAAM;AAAA,MACN,SAASG;AAAA,IAAA,CACV;AAAA,IACH,CAACH,CAAQ;AAAA,EAAA;AAEb;"}
@@ -1 +1 @@
1
- {"version":3,"file":"usePlaygroundSchemaOptions.js","sources":["../../src/hooks/usePlaygroundSchemaOptions.ts"],"sourcesContent":["'use client';\n\nimport {\n AnySchema,\n DataSchema,\n DataSchemaArray,\n IncrementalDataSchema,\n IncrementalDataSchemaArray,\n} from '@mintlify/validation';\nimport { useMemo } from 'react';\n\nimport { generateOptionLabels } from '@/openapi/generateOptionLabels';\nimport { ComponentSchemas } from '@/utils/api-reference/getApiReferenceData';\n\nimport { useComponentSchemas } from './useComponentSchemas';\n\nexport type NoAnyDataSchema = Exclude<DataSchema | IncrementalDataSchema, AnySchema>;\nexport type SchemaWithLabelInfo = {\n schema: NoAnyDataSchema;\n label: string;\n};\n\nexport const usePlaygroundSchemaOptions = (\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray | null\n) => {\n const componentSchemas = useComponentSchemas();\n return useMemo(() => {\n if (!schemaArray) return [];\n return getCleanSchemaArray(schemaArray, componentSchemas, undefined);\n }, [schemaArray, componentSchemas]);\n};\n\nconst getCleanSchemaArray = (\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray,\n componentSchemas: ComponentSchemas | undefined,\n userGroups: string[] | undefined\n): SchemaWithLabelInfo[] => {\n const nullable = schemaArray.some((schema) => schema.type === 'null');\n const allObjects = schemaArray.every((schema) => schema.type === 'object');\n\n const typeStrings = generateOptionLabels(\n schemaArray,\n componentSchemas,\n allObjects,\n nullable,\n userGroups,\n true\n );\n\n let firstAnySchema: AnySchema | undefined = undefined;\n\n // filter out all schemas with type `any`, while saving the first instance for meta info\n const filteredSchemaArray: NoAnyDataSchema[] = [];\n const filteredTypeStringArray: (string | null)[] = [];\n for (const schema of schemaArray) {\n if (schema.type === 'any') {\n firstAnySchema = firstAnySchema ?? schema;\n } else {\n filteredSchemaArray.push(schema);\n }\n }\n\n for (const typeString of typeStrings) {\n if (typeString === 'any') {\n filteredTypeStringArray.push(null);\n } else {\n filteredTypeStringArray.push(typeString);\n }\n }\n\n // push a bunch of schemas to represent the `any`\n if (firstAnySchema !== undefined) {\n const baseSchema: Pick<DataSchema, 'description' | 'required'> = {\n description: firstAnySchema.description,\n required: firstAnySchema.required,\n };\n\n // all schemas that aren't added here are subsets of these schemas (eg, integer is just a more restrictive number input)\n filteredSchemaArray.push(\n { ...baseSchema, type: 'string' },\n { ...baseSchema, type: 'number' },\n { ...baseSchema, type: 'boolean' },\n { ...baseSchema, type: 'object', properties: {} },\n { ...baseSchema, type: 'array', items: [{ type: 'any' }] },\n { ...baseSchema, type: 'null' }\n );\n }\n\n const typeLabelMappedSchemaArray = filteredSchemaArray.map((schema, i) => ({\n schema,\n label: filteredTypeStringArray[i] ?? schema.type,\n }));\n\n // return each schema-label pair, just using the type for schemas generated from the `any`\n return typeLabelMappedSchemaArray;\n};\n"],"names":["usePlaygroundSchemaOptions","schemaArray","componentSchemas","useComponentSchemas","useMemo","getCleanSchemaArray","userGroups","nullable","schema","allObjects","typeStrings","generateOptionLabels","firstAnySchema","filteredSchemaArray","filteredTypeStringArray","typeString","baseSchema","i"],"mappings":";;;AAsBO,MAAMA,IAA6B,CACxCC,MACG;AACH,QAAMC,IAAmBC,EAAA;AACzB,SAAOC,EAAQ,MACRH,IACEI,EAAoBJ,GAAaC,GAAkB,MAAS,IAD1C,CAAA,GAExB,CAACD,GAAaC,CAAgB,CAAC;AACpC,GAEMG,IAAsB,CAC1BJ,GACAC,GACAI,MAC0B;AAC1B,QAAMC,IAAWN,EAAY,KAAK,CAACO,MAAWA,EAAO,SAAS,MAAM,GAC9DC,IAAaR,EAAY,MAAM,CAACO,MAAWA,EAAO,SAAS,QAAQ,GAEnEE,IAAcC;AAAA,IAClBV;AAAA,IACAC;AAAA,IACAO;AAAA,IACAF;AAAA,IACAD;AAAA,EAEF;AAEA,MAAIM;AAGJ,QAAMC,IAAyC,CAAA,GACzCC,IAA6C,CAAA;AACnD,aAAWN,KAAUP;AACnB,IAAIO,EAAO,SAAS,QAClBI,IAAiBA,KAAkBJ,IAEnCK,EAAoB,KAAKL,CAAM;AAInC,aAAWO,KAAcL;AACvB,IAAIK,MAAe,QACjBD,EAAwB,KAAK,IAAI,IAEjCA,EAAwB,KAAKC,CAAU;AAK3C,MAAIH,MAAmB,QAAW;AAChC,UAAMI,IAA2D;AAAA,MAC/D,aAAaJ,EAAe;AAAA,MAC5B,UAAUA,EAAe;AAAA,IAAA;AAI3B,IAAAC,EAAoB;AAAA,MAClB,EAAE,GAAGG,GAAY,MAAM,SAAA;AAAA,MACvB,EAAE,GAAGA,GAAY,MAAM,SAAA;AAAA,MACvB,EAAE,GAAGA,GAAY,MAAM,UAAA;AAAA,MACvB,EAAE,GAAGA,GAAY,MAAM,UAAU,YAAY,CAAA,EAAC;AAAA,MAC9C,EAAE,GAAGA,GAAY,MAAM,SAAS,OAAO,CAAC,EAAE,MAAM,MAAA,CAAO,EAAA;AAAA,MACvD,EAAE,GAAGA,GAAY,MAAM,OAAA;AAAA,IAAO;AAAA,EAElC;AAQA,SANmCH,EAAoB,IAAI,CAACL,GAAQS,OAAO;AAAA,IACzE,QAAAT;AAAA,IACA,OAAOM,EAAwBG,CAAC,KAAKT,EAAO;AAAA,EAAA,EAC5C;AAIJ;"}
1
+ {"version":3,"file":"usePlaygroundSchemaOptions.js","sources":["../../src/hooks/usePlaygroundSchemaOptions.ts"],"sourcesContent":["\nimport {\n AnySchema,\n DataSchema,\n DataSchemaArray,\n IncrementalDataSchema,\n IncrementalDataSchemaArray,\n} from '@mintlify/validation';\nimport { useMemo } from 'react';\n\nimport { generateOptionLabels } from '@/openapi/generateOptionLabels';\nimport { ComponentSchemas } from '@/utils/api-reference/getApiReferenceData';\n\nimport { useComponentSchemas } from './useComponentSchemas';\n\nexport type NoAnyDataSchema = Exclude<DataSchema | IncrementalDataSchema, AnySchema>;\nexport type SchemaWithLabelInfo = {\n schema: NoAnyDataSchema;\n label: string;\n};\n\nexport const usePlaygroundSchemaOptions = (\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray | null\n) => {\n const componentSchemas = useComponentSchemas();\n return useMemo(() => {\n if (!schemaArray) return [];\n return getCleanSchemaArray(schemaArray, componentSchemas, undefined);\n }, [schemaArray, componentSchemas]);\n};\n\nconst getCleanSchemaArray = (\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray,\n componentSchemas: ComponentSchemas | undefined,\n userGroups: string[] | undefined\n): SchemaWithLabelInfo[] => {\n const nullable = schemaArray.some((schema) => schema.type === 'null');\n const allObjects = schemaArray.every((schema) => schema.type === 'object');\n\n const typeStrings = generateOptionLabels(\n schemaArray,\n componentSchemas,\n allObjects,\n nullable,\n userGroups,\n true\n );\n\n let firstAnySchema: AnySchema | undefined = undefined;\n\n // filter out all schemas with type `any`, while saving the first instance for meta info\n const filteredSchemaArray: NoAnyDataSchema[] = [];\n const filteredTypeStringArray: (string | null)[] = [];\n for (const schema of schemaArray) {\n if (schema.type === 'any') {\n firstAnySchema = firstAnySchema ?? schema;\n } else {\n filteredSchemaArray.push(schema);\n }\n }\n\n for (const typeString of typeStrings) {\n if (typeString === 'any') {\n filteredTypeStringArray.push(null);\n } else {\n filteredTypeStringArray.push(typeString);\n }\n }\n\n // push a bunch of schemas to represent the `any`\n if (firstAnySchema !== undefined) {\n const baseSchema: Pick<DataSchema, 'description' | 'required'> = {\n description: firstAnySchema.description,\n required: firstAnySchema.required,\n };\n\n // all schemas that aren't added here are subsets of these schemas (eg, integer is just a more restrictive number input)\n filteredSchemaArray.push(\n { ...baseSchema, type: 'string' },\n { ...baseSchema, type: 'number' },\n { ...baseSchema, type: 'boolean' },\n { ...baseSchema, type: 'object', properties: {} },\n { ...baseSchema, type: 'array', items: [{ type: 'any' }] },\n { ...baseSchema, type: 'null' }\n );\n }\n\n const typeLabelMappedSchemaArray = filteredSchemaArray.map((schema, i) => ({\n schema,\n label: filteredTypeStringArray[i] ?? schema.type,\n }));\n\n // return each schema-label pair, just using the type for schemas generated from the `any`\n return typeLabelMappedSchemaArray;\n};\n"],"names":["usePlaygroundSchemaOptions","schemaArray","componentSchemas","useComponentSchemas","useMemo","getCleanSchemaArray","userGroups","nullable","schema","allObjects","typeStrings","generateOptionLabels","firstAnySchema","filteredSchemaArray","filteredTypeStringArray","typeString","baseSchema","i"],"mappings":";;;AAqBO,MAAMA,IAA6B,CACxCC,MACG;AACH,QAAMC,IAAmBC,EAAA;AACzB,SAAOC,EAAQ,MACRH,IACEI,EAAoBJ,GAAaC,GAAkB,MAAS,IAD1C,CAAA,GAExB,CAACD,GAAaC,CAAgB,CAAC;AACpC,GAEMG,IAAsB,CAC1BJ,GACAC,GACAI,MAC0B;AAC1B,QAAMC,IAAWN,EAAY,KAAK,CAACO,MAAWA,EAAO,SAAS,MAAM,GAC9DC,IAAaR,EAAY,MAAM,CAACO,MAAWA,EAAO,SAAS,QAAQ,GAEnEE,IAAcC;AAAA,IAClBV;AAAA,IACAC;AAAA,IACAO;AAAA,IACAF;AAAA,IACAD;AAAA,EAEF;AAEA,MAAIM;AAGJ,QAAMC,IAAyC,CAAA,GACzCC,IAA6C,CAAA;AACnD,aAAWN,KAAUP;AACnB,IAAIO,EAAO,SAAS,QAClBI,IAAiBA,KAAkBJ,IAEnCK,EAAoB,KAAKL,CAAM;AAInC,aAAWO,KAAcL;AACvB,IAAIK,MAAe,QACjBD,EAAwB,KAAK,IAAI,IAEjCA,EAAwB,KAAKC,CAAU;AAK3C,MAAIH,MAAmB,QAAW;AAChC,UAAMI,IAA2D;AAAA,MAC/D,aAAaJ,EAAe;AAAA,MAC5B,UAAUA,EAAe;AAAA,IAAA;AAI3B,IAAAC,EAAoB;AAAA,MAClB,EAAE,GAAGG,GAAY,MAAM,SAAA;AAAA,MACvB,EAAE,GAAGA,GAAY,MAAM,SAAA;AAAA,MACvB,EAAE,GAAGA,GAAY,MAAM,UAAA;AAAA,MACvB,EAAE,GAAGA,GAAY,MAAM,UAAU,YAAY,CAAA,EAAC;AAAA,MAC9C,EAAE,GAAGA,GAAY,MAAM,SAAS,OAAO,CAAC,EAAE,MAAM,MAAA,CAAO,EAAA;AAAA,MACvD,EAAE,GAAGA,GAAY,MAAM,OAAA;AAAA,IAAO;AAAA,EAElC;AAQA,SANmCH,EAAoB,IAAI,CAACL,GAAQS,OAAO;AAAA,IACzE,QAAAT;AAAA,IACA,OAAOM,EAAwBG,CAAC,KAAKT,EAAO;AAAA,EAAA,EAC5C;AAIJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/hooks/usePrefilledInputs/index.ts"],"sourcesContent":["'use client';\n\nimport {\n ApiPlaygroundInputs,\n UserInfoInputs,\n SecurityOption,\n SecurityParameterSchema,\n} from '@mintlify/validation';\nimport { useEffect, useState } from 'react';\n\nimport {\n ServerVariableStore,\n loadServerVariableStore,\n storeServerVariables,\n} from './storedServerVariables';\n\nexport type SecurityInputs = Pick<ApiPlaygroundInputs, 'query' | 'header' | 'cookie'>;\n\ntype UsePrefilledInputsParams = {\n inputs: ApiPlaygroundInputs;\n setInputs: (inputs: ApiPlaygroundInputs) => void;\n baseUrl?: string;\n securityOption?: SecurityOption;\n userInfoInputs?: UserInfoInputs;\n};\n\nexport function usePrefilledInputs({\n inputs,\n setInputs,\n baseUrl,\n securityOption,\n userInfoInputs,\n}: UsePrefilledInputsParams) {\n const [serverVariableStore, setServerVariableStore] = useState<ServerVariableStore>();\n\n useEffect(() => {\n setServerVariableStore(loadServerVariableStore());\n }, []);\n\n useEffect(() => {\n const authInputs = parseAuthInputs(securityOption, undefined, userInfoInputs);\n const serverInputs = parseServerInputs(baseUrl, serverVariableStore, userInfoInputs);\n\n setInputs({\n ...authInputs,\n server: serverInputs,\n path: inputs.path,\n body: inputs.body,\n });\n // these values should only ever change on page load\n }, [serverVariableStore, userInfoInputs]);\n\n // load security variables\n useEffect(() => {\n const authInputs = parseAuthInputs(securityOption, undefined, userInfoInputs);\n setInputs({ ...inputs, ...authInputs });\n // we only want to update the security variables when the security option changes\n }, [securityOption]);\n\n\n\n // load server variables\n useEffect(() => {\n const serverInputs = parseServerInputs(baseUrl, serverVariableStore, userInfoInputs);\n setInputs({ ...inputs, server: serverInputs });\n // we only want to update the server variables when the base url changes\n }, [baseUrl]);\n\n // store server variables\n useEffect(() => {\n if (!baseUrl) return;\n storeServerVariables(baseUrl, inputs.server, userInfoInputs);\n // we only want to store the server variables when their values change\n }, [inputs.server]);\n}\n\nexport const parseAuthInputs = (\n securityOption: SecurityOption | undefined,\n credentialStore: SecurityInputs | undefined,\n userInfoInputs: UserInfoInputs | undefined\n): SecurityInputs => {\n const inputs: SecurityInputs = {\n query: {},\n header: {},\n cookie: {},\n };\n\n if (!securityOption) {\n return inputs;\n }\n\n for (const section of ['query', 'header', 'cookie'] as const) {\n Object.entries(securityOption.parameters[section]).forEach(([name, schema]) => {\n inputs[section][name] =\n credentialStore?.[section][name] ??\n cleanUserInfoValue(userInfoInputs?.[section]?.[name], schema);\n });\n }\n return inputs;\n};\n\n// do a bit of preprocessing for common auth types\nconst cleanUserInfoValue = (value: unknown, schema: SecurityParameterSchema) => {\n if (!value) return value;\n\n if (schema.type === 'http' && schema.scheme === 'basic') {\n if (typeof value === 'object') {\n const username =\n 'username' in value && typeof value.username === 'string' ? value.username : '';\n const password =\n 'password' in value && typeof value.password === 'string' ? value.password : '';\n return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;\n }\n return undefined;\n }\n\n if (schema.type === 'http' && schema.scheme === 'bearer') {\n if (typeof value === 'string') {\n return value.startsWith('Bearer ') ? value : `Bearer ${value}`;\n }\n return undefined;\n }\n\n return value;\n};\n\nconst parseServerInputs = (\n baseUrl: string | undefined,\n serverVariableStore: ServerVariableStore | undefined,\n userInfoInputs: UserInfoInputs | undefined\n): Record<string, string> => {\n const userInfoServerVariables = userInfoInputs?.server;\n const storedServerVariables =\n serverVariableStore && baseUrl ? serverVariableStore[baseUrl] : undefined;\n\n return { ...userInfoServerVariables, ...storedServerVariables };\n};\n\nexport const parseAuthInputsFromUserInfo = (\n securityOption: SecurityOption | undefined,\n userInfoInputs: UserInfoInputs | undefined\n): Pick<ApiPlaygroundInputs, 'query' | 'header' | 'cookie'> => {\n const inputs: Pick<ApiPlaygroundInputs, 'query' | 'header' | 'cookie'> = {\n query: {},\n header: {},\n cookie: {},\n };\n\n if (!securityOption) {\n return inputs;\n }\n\n for (const section of ['query', 'header', 'cookie'] as const) {\n Object.entries(securityOption.parameters[section]).forEach(([name, schema]) => {\n const userInfoValue = userInfoInputs?.[section]?.[name];\n if (userInfoValue !== undefined) {\n inputs[section][name] = cleanUserInfoValue(userInfoValue, schema);\n }\n });\n }\n return inputs;\n};\n"],"names":["usePrefilledInputs","inputs","setInputs","baseUrl","securityOption","userInfoInputs","serverVariableStore","setServerVariableStore","useState","useEffect","loadServerVariableStore","authInputs","parseAuthInputs","serverInputs","parseServerInputs","storeServerVariables","credentialStore","section","name","schema","cleanUserInfoValue","_a","value","userInfoServerV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,UAAU,QAAQ;AAChD,WAAO,QAAQb,EAAe,WAAWa,CAAO,CAAC,EAAE,QAAQ,CAAC,CAACC,GAAMC,CAAM,MAAM;;AAC7E,MAAAlB,EAAOgB,CAAO,EAAEC,CAAI,IAElBE,GAAmBC,IAAAhB,KAAA,gBAAAA,EAAiBY,OAAjB,gBAAAI,EAA4BH,EAAa;AAAA,IAChE,CAAC;AAEH,SAAOjB;AACT,GAGMmB,IAAqB,CAACE,GAAgBH,MACvBG,GAuBfR,IAAoB,CACxBX,GACAG,GACAD,MAC2B;AAC3B,QAAMkB,IAA0BlB,KAAA,gBAAAA,EAAgB,QAC1CmB,IACJlB,KAAuBH,IAAUG,EAAoBH,CAAO,IAAI;AAElE,SAAO,EAAE,GAAGoB,GAAyB,GAAGC,EAAA;AAC1C,GAEaC,IAA8B,CACzCrB,GACAC,MAC6D;AAC7D,QAAMJ,IAAmE;AAAA,IACvE,OAAO,CAAA;AAAA,IACP,QAAQ,CAAA;AAAA,IACR,QAAQ,CAAA;AAAA,EAAC;AAGX,MAAI,CAACG;AACH,WAAOH;AAGT,aAAWgB,KAAW,CAAC,SAAS,UAAU,QAAQ;AAChD,WAAO,QAAQb,EAAe,WAAWa,CAAO,CAAC,EAAE,QAAQ,CAAC,CAACC,GAAMC,CAAM,MAAM;AAAA,IAK/E,CAAC;AAEH,SAAOlB;AACT;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/hooks/usePrefilledInputs/index.ts"],"sourcesContent":["\nimport {\n ApiPlaygroundInputs,\n UserInfoInputs,\n SecurityOption,\n SecurityParameterSchema,\n} from '@mintlify/validation';\nimport { useEffect, useState } from 'react';\n\nimport {\n ServerVariableStore,\n loadServerVariableStore,\n storeServerVariables,\n} from './storedServerVariables';\n\nexport type SecurityInputs = Pick<ApiPlaygroundInputs, 'query' | 'header' | 'cookie'>;\n\ntype UsePrefilledInputsParams = {\n inputs: ApiPlaygroundInputs;\n setInputs: (inputs: ApiPlaygroundInputs) => void;\n baseUrl?: string;\n securityOption?: SecurityOption;\n userInfoInputs?: UserInfoInputs;\n};\n\nexport function usePrefilledInputs({\n inputs,\n setInputs,\n baseUrl,\n securityOption,\n userInfoInputs,\n}: UsePrefilledInputsParams) {\n const [serverVariableStore, setServerVariableStore] = useState<ServerVariableStore>();\n\n useEffect(() => {\n setServerVariableStore(loadServerVariableStore());\n }, []);\n\n useEffect(() => {\n const authInputs = parseAuthInputs(securityOption, undefined, userInfoInputs);\n const serverInputs = parseServerInputs(baseUrl, serverVariableStore, userInfoInputs);\n\n setInputs({\n ...authInputs,\n server: serverInputs,\n path: inputs.path,\n body: inputs.body,\n });\n // these values should only ever change on page load\n }, [serverVariableStore, userInfoInputs]);\n\n // load security variables\n useEffect(() => {\n const authInputs = parseAuthInputs(securityOption, undefined, userInfoInputs);\n setInputs({ ...inputs, ...authInputs });\n // we only want to update the security variables when the security option changes\n }, [securityOption]);\n\n\n\n // load server variables\n useEffect(() => {\n const serverInputs = parseServerInputs(baseUrl, serverVariableStore, userInfoInputs);\n setInputs({ ...inputs, server: serverInputs });\n // we only want to update the server variables when the base url changes\n }, [baseUrl]);\n\n // store server variables\n useEffect(() => {\n if (!baseUrl) return;\n storeServerVariables(baseUrl, inputs.server, userInfoInputs);\n // we only want to store the server variables when their values change\n }, [inputs.server]);\n}\n\nexport const parseAuthInputs = (\n securityOption: SecurityOption | undefined,\n credentialStore: SecurityInputs | undefined,\n userInfoInputs: UserInfoInputs | undefined\n): SecurityInputs => {\n const inputs: SecurityInputs = {\n query: {},\n header: {},\n cookie: {},\n };\n\n if (!securityOption) {\n return inputs;\n }\n\n for (const section of ['query', 'header', 'cookie'] as const) {\n Object.entries(securityOption.parameters[section]).forEach(([name, schema]) => {\n inputs[section][name] =\n credentialStore?.[section][name] ??\n cleanUserInfoValue(userInfoInputs?.[section]?.[name], schema);\n });\n }\n return inputs;\n};\n\n// do a bit of preprocessing for common auth types\nconst cleanUserInfoValue = (value: unknown, schema: SecurityParameterSchema) => {\n if (!value) return value;\n\n if (schema.type === 'http' && schema.scheme === 'basic') {\n if (typeof value === 'object') {\n const username =\n 'username' in value && typeof value.username === 'string' ? value.username : '';\n const password =\n 'password' in value && typeof value.password === 'string' ? value.password : '';\n return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;\n }\n return undefined;\n }\n\n if (schema.type === 'http' && schema.scheme === 'bearer') {\n if (typeof value === 'string') {\n return value.startsWith('Bearer ') ? value : `Bearer ${value}`;\n }\n return undefined;\n }\n\n return value;\n};\n\nconst parseServerInputs = (\n baseUrl: string | undefined,\n serverVariableStore: ServerVariableStore | undefined,\n userInfoInputs: UserInfoInputs | undefined\n): Record<string, string> => {\n const userInfoServerVariables = userInfoInputs?.server;\n const storedServerVariables =\n serverVariableStore && baseUrl ? serverVariableStore[baseUrl] : undefined;\n\n return { ...userInfoServerVariables, ...storedServerVariables };\n};\n\nexport const parseAuthInputsFromUserInfo = (\n securityOption: SecurityOption | undefined,\n userInfoInputs: UserInfoInputs | undefined\n): Pick<ApiPlaygroundInputs, 'query' | 'header' | 'cookie'> => {\n const inputs: Pick<ApiPlaygroundInputs, 'query' | 'header' | 'cookie'> = {\n query: {},\n header: {},\n cookie: {},\n };\n\n if (!securityOption) {\n return inputs;\n }\n\n for (const section of ['query', 'header', 'cookie'] as const) {\n Object.entries(securityOption.parameters[section]).forEach(([name, schema]) => {\n const userInfoValue = userInfoInputs?.[section]?.[name];\n if (userInfoValue !== undefined) {\n inputs[section][name] = cleanUserInfoValue(userInfoValue, schema);\n }\n });\n }\n return inputs;\n};\n"],"names":["usePrefilledInputs","inputs","setInputs","baseUrl","securityOption","userInfoInputs","serverVariableStore","setServerVariableStore","useState","useEffect","loadServerVariableStore","authInputs","parseAuthInputs","serverInputs","parseServerInputs","storeServerVariables","credentialStore","section","name","schema","cleanUserInfoValue","_a","value","userInfoServerVariables","storedServerVariables","parseAuthInputsFromUserInfo"],"mappings":";;AAyBO,SAASA,EAAmB;AAAA,EACjC,QAAAC;AAAA,EACA,WAAA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MAAM;;AAC7E,MAAAlB,EAAOgB,CAAO,EAAEC,CAAI,IAElBE,GAAmBC,IAAAhB,KAAA,gBAAAA,EAAiBY,OAAjB,gBAAAI,EAA4BH,EAAa;AAAA,IAChE,CAAC;AAEH,SAAOjB;AACT,GAGMmB,IAAqB,CAACE,GAAgBH,MACvBG,GAuBfR,IAAoB,CACxBX,GACAG,GACAD,MAC2B;AAC3B,QAAMkB,IAA0BlB,KAAA,gBAAAA,EAAgB,QAC1CmB,IACJlB,KAAuBH,IAAUG,EAAoBH,CAAO,IAAI;AAElE,SAAO,EAAE,GAAGoB,GAAyB,GAAGC,EAAA;AAC1C,GAEaC,IAA8B,CACzCrB,GACAC,MAC6D;AAC7D,QAAMJ,IAAmE;AAAA,IACvE,OAAO,CAAA;AAAA,IACP,QAAQ,CAAA;AAAA,IACR,QAAQ,CAAA;AAAA,EAAC;AAGX,MAAI,CAACG;AACH,WAAOH;AAGT,aAAWgB,KAAW,CAAC,SAAS,UAAU,QAAQ;AAChD,WAAO,QAAQb,EAAe,WAAWa,CAAO,CAAC,EAAE,QAAQ,CAAC,CAACC,GAAMC,CAAM,MAAM;AAAA,IAK/E,CAAC;AAEH,SAAOlB;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"storedServerVariables.js","sources":["../../../src/hooks/usePrefilledInputs/storedServerVariables.ts"],"sourcesContent":["'use client';\n\nimport { UserInfoInputs } from '@mintlify/validation';\n\nconst SERVERVARS_LOCALSTORAGE_KEY = 'mintlify-server-variables';\n\nexport type ServerVariableStore = Record<string, Record<string, string>>;\n\nconst isValidServerVariableStore = (info: unknown): info is ServerVariableStore => {\n if (typeof info !== 'object' || info == null) {\n return false;\n }\n\n const infoObj = info as Record<string, unknown>;\n return Object.values(infoObj).every(\n (inputMap) =>\n typeof inputMap === 'object' &&\n inputMap !== null &&\n Object.values(inputMap).every((input) => typeof input === 'string')\n );\n};\n\nexport const loadServerVariableStore = (): ServerVariableStore => {\n const inputString = localStorage.getItem(SERVERVARS_LOCALSTORAGE_KEY);\n\n if (inputString) {\n try {\n const inputs = JSON.parse(inputString);\n if (isValidServerVariableStore(inputs)) {\n return inputs;\n }\n } catch (e) {\n console.log(`unable to parse stored server variables: ${e}`);\n }\n }\n\n return {};\n};\n\nexport const storeServerVariables = (\n baseUrl: string,\n serverVariables: Record<string, string>,\n userInfoInputs: UserInfoInputs | undefined\n) => {\n // only store the variables that differ from those in user info\n const meaningfulServerVariables = Object.fromEntries(\n Object.entries(serverVariables).filter(([name, value]) => {\n return value && userInfoInputs?.server?.[name] !== value;\n })\n );\n\n const existingServerVariableStore = loadServerVariableStore();\n const newServerVariableStore = {\n ...existingServerVariableStore,\n [baseUrl]: meaningfulServerVariables,\n };\n const serverVariableString = JSON.stringify(newServerVariableStore);\n localStorage.setItem(SERVERVARS_LOCALSTORAGE_KEY, serverVariableString);\n};\n"],"names":["SERVERVARS_LOCALSTORAGE_KEY","isValidServerVariableStore","info","inputMap","input","loadServerVariableStore","inputString","inputs","e","storeServerVariables","baseUrl","serverVariables","userInfoInputs","meaningfulServerVariables","name","value","_a","newServerVariableStore","serverVariableString"],"mappings":"AAIA,MAAMA,IAA8B,6BAI9BC,IAA6B,CAACC,MAC9B,OAAOA,KAAS,YAAYA,KAAQ,OAC/B,KAIF,OAAO,OADEA,CACY,EAAE;AAAA,EAC5B,CAACC,MACC,OAAOA,KAAa,YACpBA,MAAa,QACb,OAAO,OAAOA,CAAQ,EAAE,MAAM,CAACC,MAAU,OAAOA,KAAU,QAAQ;AAAA,GAI3DC,IAA0B,MAA2B;AAChE,QAAMC,IAAc,aAAa,QAAQN,CAA2B;AAEpE,MAAIM;AACF,QAAI;AACF,YAAMC,IAAS,KAAK,MAAMD,CAAW;AACrC,UAAIL,EAA2BM,CAAM;AACnC,eAAOA;AAAA,IAEX,SAASC,GAAG;AACV,cAAQ,IAAI,4CAA4CA,CAAC,EAAE;AAAA,IAC7D;AAGF,SAAO,CAAA;AACT,GAEaC,IAAuB,CAClCC,GACAC,GACAC,MACG;AAEH,QAAMC,IAA4B,OAAO;AAAA,IACvC,OAAO,QAAQF,CAAe,EAAE,OAAO,CAAC,CAACG,GAAMC,CAAK,MAAM;AA1C9D,UAAAC;AA2CM,aAAOD,OAASC,IAAAJ,KAAA,gBAAAA,EAAgB,WAAhB,gBAAAI,EAAyBF,QAAUC;AAAA,IACrD,CAAC;AAAA,EAAA,GAIGE,IAAyB;AAAA,IAC7B,GAFkCZ,EAAA;AAAA,IAGlC,CAACK,CAAO,GAAGG;AAAA,EAAA,GAEPK,IAAuB,KAAK,UAAUD,CAAsB;AAClE,eAAa,QAAQjB,GAA6BkB,CAAoB;AACxE;"}
1
+ {"version":3,"file":"storedServerVariables.js","sources":["../../../src/hooks/usePrefilledInputs/storedServerVariables.ts"],"sourcesContent":["\nimport { UserInfoInputs } from '@mintlify/validation';\n\nconst SERVERVARS_LOCALSTORAGE_KEY = 'mintlify-server-variables';\n\nexport type ServerVariableStore = Record<string, Record<string, string>>;\n\nconst isValidServerVariableStore = (info: unknown): info is ServerVariableStore => {\n if (typeof info !== 'object' || info == null) {\n return false;\n }\n\n const infoObj = info as Record<string, unknown>;\n return Object.values(infoObj).every(\n (inputMap) =>\n typeof inputMap === 'object' &&\n inputMap !== null &&\n Object.values(inputMap).every((input) => typeof input === 'string')\n );\n};\n\nexport const loadServerVariableStore = (): ServerVariableStore => {\n const inputString = localStorage.getItem(SERVERVARS_LOCALSTORAGE_KEY);\n\n if (inputString) {\n try {\n const inputs = JSON.parse(inputString);\n if (isValidServerVariableStore(inputs)) {\n return inputs;\n }\n } catch (e) {\n console.log(`unable to parse stored server variables: ${e}`);\n }\n }\n\n return {};\n};\n\nexport const storeServerVariables = (\n baseUrl: string,\n serverVariables: Record<string, string>,\n userInfoInputs: UserInfoInputs | undefined\n) => {\n // only store the variables that differ from those in user info\n const meaningfulServerVariables = Object.fromEntries(\n Object.entries(serverVariables).filter(([name, value]) => {\n return value && userInfoInputs?.server?.[name] !== value;\n })\n );\n\n const existingServerVariableStore = loadServerVariableStore();\n const newServerVariableStore = {\n ...existingServerVariableStore,\n [baseUrl]: meaningfulServerVariables,\n };\n const serverVariableString = JSON.stringify(newServerVariableStore);\n localStorage.setItem(SERVERVARS_LOCALSTORAGE_KEY, serverVariableString);\n};\n"],"names":["SERVERVARS_LOCALSTORAGE_KEY","isValidServerVariableStore","info","inputMap","input","loadServerVariableStore","inputString","inputs","e","storeServerVariables","baseUrl","serverVariables","userInfoInputs","meaningfulServerVariables","name","value","_a","newServerVariableStore","serverVariableString"],"mappings":"AAGA,MAAMA,IAA8B,6BAI9BC,IAA6B,CAACC,MAC9B,OAAOA,KAAS,YAAYA,KAAQ,OAC/B,KAIF,OAAO,OADEA,CACY,EAAE;AAAA,EAC5B,CAACC,MACC,OAAOA,KAAa,YACpBA,MAAa,QACb,OAAO,OAAOA,CAAQ,EAAE,MAAM,CAACC,MAAU,OAAOA,KAAU,QAAQ;AAAA,GAI3DC,IAA0B,MAA2B;AAChE,QAAMC,IAAc,aAAa,QAAQN,CAA2B;AAEpE,MAAIM;AACF,QAAI;AACF,YAAMC,IAAS,KAAK,MAAMD,CAAW;AACrC,UAAIL,EAA2BM,CAAM;AACnC,eAAOA;AAAA,IAEX,SAASC,GAAG;AACV,cAAQ,IAAI,4CAA4CA,CAAC,EAAE;AAAA,IAC7D;AAGF,SAAO,CAAA;AACT,GAEaC,IAAuB,CAClCC,GACAC,GACAC,MACG;AAEH,QAAMC,IAA4B,OAAO;AAAA,IACvC,OAAO,QAAQF,CAAe,EAAE,OAAO,CAAC,CAACG,GAAMC,CAAK,MAAM;AA1C9D,UAAAC;AA2CM,aAAOD,OAASC,IAAAJ,KAAA,gBAAAA,EAAgB,WAAhB,gBAAAI,EAAyBF,QAAUC;AAAA,IACrD,CAAC;AAAA,EAAA,GAIGE,IAAyB;AAAA,IAC7B,GAFkCZ,EAAA;AAAA,IAGlC,CAACK,CAAO,GAAGG;AAAA,EAAA,GAEPK,IAAuB,KAAK,UAAUD,CAAsB;AAClE,eAAa,QAAQjB,GAA6BkB,CAAoB;AACxE;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSecurityOption.js","sources":["../../src/hooks/useSecurityOption.ts"],"sourcesContent":["'use client';\n\nimport { SecurityOption } from '@mintlify/validation';\nimport { useState } from 'react';\n\n\nexport function useSecurityOption(baseOptions: SecurityOption[]) {\n const [selectedIndex, _setSelectedIndex] = useState(0);\n\n const nonemptyOptions = baseOptions.filter((option) =>\n Object.values(option.parameters).some((section) => Object.keys(section).length > 0)\n );\n\n const selectedSecurity = nonemptyOptions[selectedIndex];\n return selectedSecurity;\n}\n"],"names":["useSecurityOption","baseOptions","selectedIndex","_setSelectedIndex","useState","option","section"],"mappings":";AAMO,SAASA,EAAkBC,GAA+B;AAC/D,QAAM,CAACC,GAAeC,CAAiB,IAAIC,EAAS,CAAC;AAOrD,SALwBH,EAAY;AAAA,IAAO,CAACI,MACxC,OAAO,OAAOA,EAAO,UAAU,EAAE,KAAK,CAACC,MAAY,OAAO,KAAKA,CAAO,EAAE,SAAS,CAAC;AAAA,EAAA,EAG7CJ,CAAa;AAExD;"}
1
+ {"version":3,"file":"useSecurityOption.js","sources":["../../src/hooks/useSecurityOption.ts"],"sourcesContent":["\nimport { SecurityOption } from '@mintlify/validation';\nimport { useState } from 'react';\n\n\nexport function useSecurityOption(baseOptions: SecurityOption[]) {\n const [selectedIndex, _setSelectedIndex] = useState(0);\n\n const nonemptyOptions = baseOptions.filter((option) =>\n Object.values(option.parameters).some((section) => Object.keys(section).length > 0)\n );\n\n const selectedSecurity = nonemptyOptions[selectedIndex];\n return selectedSecurity;\n}\n"],"names":["useSecurityOption","baseOptions","selectedIndex","_setSelectedIndex","useState","option","section"],"mappings":";AAKO,SAASA,EAAkBC,GAA+B;AAC/D,QAAM,CAACC,GAAeC,CAAiB,IAAIC,EAAS,CAAC;AAOrD,SALwBH,EAAY;AAAA,IAAO,CAACI,MACxC,OAAO,OAAOA,EAAO,UAAU,EAAE,KAAK,CAACC,MAAY,OAAO,KAAKA,CAAO,EAAE,SAAS,CAAC;AAAA,EAAA,EAG7CJ,CAAa;AAExD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSendPlaygroundRequest.js","sources":["../../src/hooks/useSendPlaygroundRequest.ts"],"sourcesContent":["\"use client\";\n\nimport { ApiPlaygroundResultType } from \"@mintlify/models\";\nimport { Endpoint, HttpMethod } from \"@mintlify/validation\";\nimport { AxiosResponse } from \"axios\";\nimport { useCallback, useContext } from \"react\";\n\nimport { DocsConfigContext } from \"@/contexts/ConfigContext\";\nimport { NEXT_PUBLIC } from \"@/env\";\n\nimport { useApiPlaygroundInputs } from \"./useMDXContentController/useApiPlaygroundInputs\";\n\nexport type UseSendPlaygroundRequestProps = {\n endpoint: Endpoint;\n baseUrl: string;\n contentType: string;\n setResult: (result: ApiPlaygroundResultType) => void;\n setIsFetching: (isFetching: boolean) => void;\n};\n\nexport type RequestInfo = {\n method: HttpMethod;\n url: string;\n header: Record<string, unknown>;\n query: Record<string, unknown>;\n cookie: Record<string, unknown>;\n body: unknown;\n};\n\nexport const useSendPlaygroundRequest = ({\n endpoint,\n baseUrl,\n contentType,\n setResult,\n setIsFetching,\n}: UseSendPlaygroundRequestProps) => {\n const inputs = useApiPlaygroundInputs();\n const { docsConfig } = useContext(DocsConfigContext);\n\n // TODO: Move to JS pre-processing script\n const disableProxy = docsConfig?.api?.playground?.proxy === false;\n\n return useCallback(async () => {\n setIsFetching(true);\n const axios = await import(\"axios\").then((x) => x.default);\n\n const pathWithInputs = addPathParams(endpoint.path, inputs.path);\n\n const url = joinWithSingleSlash(\n addServerVariables(baseUrl, inputs.server),\n pathWithInputs\n );\n\n const headers = addContentType(inputs.header, contentType);\n\n const request: RequestInfo = {\n method: endpoint.method,\n url,\n header: headers,\n body: inputs.body,\n cookie: inputs.cookie,\n query: inputs.query,\n };\n\n try {\n if (disableProxy) {\n const response = await performDirectRequest(request);\n setResult({\n error: false,\n response: {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n data: response.data,\n },\n });\n } else {\n if (contentType.includes(\"multipart/form-data\")) {\n const data = await performFileRequest(request);\n\n setResult(data);\n } else {\n const { data } = await axios.post<\n unknown,\n AxiosResponse<ApiPlaygroundResultType>\n >(`${NEXT_PUBLIC.BASE_PATH}/_mintlify/api/request`, request);\n\n setResult(data);\n }\n }\n } catch (err) {\n setResult({\n error: true,\n errorMessage: \"unable to complete request\",\n });\n console.error(err);\n }\n setIsFetching(false);\n }, [\n setIsFetching,\n endpoint,\n inputs,\n baseUrl,\n contentType,\n disableProxy,\n setResult,\n ]);\n};\n\nexport const addPathParams = (\n path: string,\n pathInputs: Record<string, unknown>\n) => {\n return Object.entries(pathInputs).reduce((path, [inputName, inputValue]) => {\n if (inputValue == undefined) return path;\n return path.replace(\n `{${inputName}}`,\n encodeURIComponent(inputValue.toString())\n );\n }, path);\n};\n\nexport const addServerVariables = (\n baseUrl: string,\n variables: Record<string, string>\n): string => {\n let url = baseUrl;\n Object.entries(variables).forEach(([key, input]) => {\n if (input) url = url.replace(`{${key}}`, input);\n });\n return url;\n};\n\nexport const joinWithSingleSlash = (baseUrl: string, path: string): string => {\n // remove the last slash of the baseUrl and the first slash of the path, and join with slash\n return baseUrl.replace(/\\/$/, \"\") + \"/\" + path.replace(/^\\//, \"\");\n};\n\nconst addContentType = (\n headers: Record<string, unknown>,\n contentType: string\n) => {\n if (\n Object.keys(headers).some((name) => name.toLowerCase() === \"content-type\")\n ) {\n return headers;\n }\n\n return {\n ...headers,\n [\"content-type\"]: contentType,\n };\n};\n\nconst performDirectRequest = async (request: RequestInfo) => {\n const axios = await import(\"axios\").then((it) => it.default);\n\n const contentType = Object.keys(request.header).find(\n (key) => key.toLowerCase() === \"content-type\"\n );\n let data = request.body;\n \n let headers = request.header as Record<string, string>;\n if (contentType?.includes(\"multipart/form-data\")) {\n const { data: formData, headers: formHeaders } = handleFormData(request);\n data = formData;\n headers = formHeaders;\n }\n\n return axios({\n url: request.url,\n method: request.method,\n params: request.query,\n data,\n headers,\n // prevent axios from adding [] after array query params\n paramsSerializer: {\n indexes: null,\n },\n responseType: \"arraybuffer\",\n // prevent axios from erroring on bad status codes\n validateStatus: () => true,\n // prevent axios from parsing json, losing whitespace information, and using default utf-8 encoding\n // we can't use `responseEncoding` as it's ignored client-side\n transformResponse: (data) => {\n return Buffer.from(data).toString(\"base64\");\n },\n });\n};\n\nconst performFileRequest = async (request: RequestInfo) => {\n const axios = await import(\"axios\").then((it) => it.default);\n const formData = new FormData();\n formData.append(\n \"requestInfo\",\n JSON.stringify({\n method: request.method,\n url: request.url,\n header: request.header,\n query: request.query,\n cookie: request.cookie,\n })\n );\n if (typeof request.body === \"object\" && request.body !== null) {\n Object.entries(request.body).forEach(([key, value]) => {\n if (value instanceof File) {\n formData.append(key, value);\n } else if (Array.isArray(value)) {\n value.forEach((item) => {\n if (item instanceof File) {\n formData.append(key, item);\n } else if (item !== undefined && item !== null) {\n formData.append(\n key,\n typeof item === \"object\" ? JSON.stringify(item) : item.toString()\n );\n }\n });\n } else if (value !== undefined && value !== null) {\n formData.append(\n key,\n typeof value === \"object\" ? JSON.stringify(value) : value.toString()\n );\n }\n });\n }\n\n const { data } = await axios.post<\n unknown,\n AxiosResponse<ApiPlaygroundResultType>\n >(`${NEXT_PUBLIC.BASE_PATH}/_mintlify/api/file-request`, formData);\n return data;\n};\n\nconst handleFormData = (request: RequestInfo) => {\n let data = request.body;\n \n const headers = request.header as Record<string, string>;\n\n if (headers[\"content-type\"]?.includes(\"multipart/form-data\")) {\n const formData = new FormData();\n if (typeof data === \"object\" && data !== null) {\n Object.entries(data).forEach(([key, value]) => {\n if (value instanceof File) {\n formData.append(key, value);\n } else if (Array.isArray(value)) {\n value.forEach((item) => {\n if (item instanceof File) {\n formData.append(key, item);\n } else if (item !== undefined && item !== null) {\n formData.append(\n key,\n typeof item === \"object\"\n ? JSON.stringify(item)\n : item.toString()\n );\n }\n });\n } else if (value !== undefined && value !== null) {\n formData.append(\n key,\n typeof value === \"object\" ? JSON.stringify(value) : value.toString()\n );\n }\n });\n data = formData;\n delete headers[\"content-type\"];\n }\n }\n return { data, headers };\n};\n"],"names":["useSendPlaygroundRequest","endpoint","baseUrl","contentType","setResult","setIsFetching","inputs","useApiPlaygroundInputs","docsConfig","useContext","DocsConfigContext","disableProxy","_b","_a","useCallback","axios","x","pathWithInputs","addPathParams","url","joinWithSingleSlash","addServerVariables","headers","addContentType","request","response","performDirectRequest","data","performFileRequest","NEXT_PUBLIC","err","path","pathInputs","inputName","inputValue","variables","key","input","name","it","formData","formHeaders","handleFormData","value","item"],"mappings":";;;;AA6BO,MAAMA,IAA2B,CAAC;AAAA,EACvC,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AACF,MAAqC;;AACnC,QAAMC,IAASC,EAAA,GACT,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAiB,GAG7CC,MAAeC,KAAAC,IAAAL,KAAA,gBAAAA,EAAY,QAAZ,gBAAAK,EAAiB,eAAjB,gBAAAD,EAA6B,WAAU;AAE5D,SAAOE,EAAY,YAAY;AAC7B,IAAAT,EAAc,EAAI;AAClB,UAAMU,IAAQ,MAAM,OAAO,OAAO,EAAE,KAAK,CAACC,MAAMA,EAAE,OAAO,GAEnDC,IAAiBC,EAAcjB,EAAS,MAAMK,EAAO,IAAI,GAEzDa,IAAMC;AAAA,MACVC,EAAmBnB,GAASI,EAAO,MAAM;AAAA,MACzCW;AAAA,IAAA,GAGIK,IAAUC,EAAejB,EAAO,QAAQH,CAAW,GAEnDqB,IAAuB;AAAA,MAC3B,QAAQvB,EAAS;AAAA,MACjB,KAAAkB;AAAA,MACA,QAAQG;AAAA,MACR,MAAMhB,EAAO;AAAA,MACb,QAAQA,EAAO;AAAA,MACf,OAAOA,EAAO;AAAA,IAAA;AAGhB,QAAI;AACF,UAAIK,GAAc;AAChB,cAAMc,IAAW,MAAMC,EAAqBF,CAAO;AACnD,QA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,EAAS,OAAOJ,GAAKQ,CAAI,IACMA,KAAS,QACxCJ,EAAS;AAAA,UACPJ;AAAA,UACA,OAAOQ,KAAS,WACZ,KAAK,UAAUA,CAAI,IACnBA,EAAK,SAAA;AAAA,QAAS;AAAA,MAGxB,CAAC,IAC+BD,KAAU,QAC1CH,EAAS;AAAA,QACPJ;AAAA,QACA,OAAOO,KAAU,WAAW,KAAK,UAAUA,CAAK,IAAIA,EAAM,SAAA;AAAA,MAAS;AAAA,IAGzE,CAAC,GACDhB,IAAOa,GACP,OAAOlB,EAAQ,cAAc;AAAA,EAEjC;AACA,SAAO,EAAE,MAAAK,GAAM,SAAAL,EAAA;AACjB;"}
1
+ {"version":3,"file":"useSendPlaygroundRequest.js","sources":["../../src/hooks/useSendPlaygroundRequest.ts"],"sourcesContent":["\nimport { ApiPlaygroundResultType } from \"@mintlify/models\";\nimport { Endpoint, HttpMethod } from \"@mintlify/validation\";\nimport { AxiosResponse } from \"axios\";\nimport { useCallback, useContext } from \"react\";\n\nimport { DocsConfigContext } from \"@/contexts/ConfigContext\";\nimport { NEXT_PUBLIC } from \"@/env\";\n\nimport { useApiPlaygroundInputs } from \"./useMDXContentController/useApiPlaygroundInputs\";\n\nexport type UseSendPlaygroundRequestProps = {\n endpoint: Endpoint;\n baseUrl: string;\n contentType: string;\n setResult: (result: ApiPlaygroundResultType) => void;\n setIsFetching: (isFetching: boolean) => void;\n};\n\nexport type RequestInfo = {\n method: HttpMethod;\n url: string;\n header: Record<string, unknown>;\n query: Record<string, unknown>;\n cookie: Record<string, unknown>;\n body: unknown;\n};\n\nexport const useSendPlaygroundRequest = ({\n endpoint,\n baseUrl,\n contentType,\n setResult,\n setIsFetching,\n}: UseSendPlaygroundRequestProps) => {\n const inputs = useApiPlaygroundInputs();\n const { docsConfig } = useContext(DocsConfigContext);\n\n // TODO: Move to JS pre-processing script\n const disableProxy = docsConfig?.api?.playground?.proxy === false;\n\n return useCallback(async () => {\n setIsFetching(true);\n const axios = await import(\"axios\").then((x) => x.default);\n\n const pathWithInputs = addPathParams(endpoint.path, inputs.path);\n\n const url = joinWithSingleSlash(\n addServerVariables(baseUrl, inputs.server),\n pathWithInputs\n );\n\n const headers = addContentType(inputs.header, contentType);\n\n const request: RequestInfo = {\n method: endpoint.method,\n url,\n header: headers,\n body: inputs.body,\n cookie: inputs.cookie,\n query: inputs.query,\n };\n\n try {\n if (disableProxy) {\n const response = await performDirectRequest(request);\n setResult({\n error: false,\n response: {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n data: response.data,\n },\n });\n } else {\n if (contentType.includes(\"multipart/form-data\")) {\n const data = await performFileRequest(request);\n\n setResult(data);\n } else {\n const { data } = await axios.post<\n unknown,\n AxiosResponse<ApiPlaygroundResultType>\n >(`${NEXT_PUBLIC.BASE_PATH}/_mintlify/api/request`, request);\n\n setResult(data);\n }\n }\n } catch (err) {\n setResult({\n error: true,\n errorMessage: \"unable to complete request\",\n });\n console.error(err);\n }\n setIsFetching(false);\n }, [\n setIsFetching,\n endpoint,\n inputs,\n baseUrl,\n contentType,\n disableProxy,\n setResult,\n ]);\n};\n\nexport const addPathParams = (\n path: string,\n pathInputs: Record<string, unknown>\n) => {\n return Object.entries(pathInputs).reduce((path, [inputName, inputValue]) => {\n if (inputValue == undefined) return path;\n return path.replace(\n `{${inputName}}`,\n encodeURIComponent(inputValue.toString())\n );\n }, path);\n};\n\nexport const addServerVariables = (\n baseUrl: string,\n variables: Record<string, string>\n): string => {\n let url = baseUrl;\n Object.entries(variables).forEach(([key, input]) => {\n if (input) url = url.replace(`{${key}}`, input);\n });\n return url;\n};\n\nexport const joinWithSingleSlash = (baseUrl: string, path: string): string => {\n // remove the last slash of the baseUrl and the first slash of the path, and join with slash\n return baseUrl.replace(/\\/$/, \"\") + \"/\" + path.replace(/^\\//, \"\");\n};\n\nconst addContentType = (\n headers: Record<string, unknown>,\n contentType: string\n) => {\n if (\n Object.keys(headers).some((name) => name.toLowerCase() === \"content-type\")\n ) {\n return headers;\n }\n\n return {\n ...headers,\n [\"content-type\"]: contentType,\n };\n};\n\nconst performDirectRequest = async (request: RequestInfo) => {\n const axios = await import(\"axios\").then((it) => it.default);\n\n const contentType = Object.keys(request.header).find(\n (key) => key.toLowerCase() === \"content-type\"\n );\n let data = request.body;\n \n let headers = request.header as Record<string, string>;\n if (contentType?.includes(\"multipart/form-data\")) {\n const { data: formData, headers: formHeaders } = handleFormData(request);\n data = formData;\n headers = formHeaders;\n }\n\n return axios({\n url: request.url,\n method: request.method,\n params: request.query,\n data,\n headers,\n // prevent axios from adding [] after array query params\n paramsSerializer: {\n indexes: null,\n },\n responseType: \"arraybuffer\",\n // prevent axios from erroring on bad status codes\n validateStatus: () => true,\n // prevent axios from parsing json, losing whitespace information, and using default utf-8 encoding\n // we can't use `responseEncoding` as it's ignored client-side\n transformResponse: (data) => {\n return Buffer.from(data).toString(\"base64\");\n },\n });\n};\n\nconst performFileRequest = async (request: RequestInfo) => {\n const axios = await import(\"axios\").then((it) => it.default);\n const formData = new FormData();\n formData.append(\n \"requestInfo\",\n JSON.stringify({\n method: request.method,\n url: request.url,\n header: request.header,\n query: request.query,\n cookie: request.cookie,\n })\n );\n if (typeof request.body === \"object\" && request.body !== null) {\n Object.entries(request.body).forEach(([key, value]) => {\n if (value instanceof File) {\n formData.append(key, value);\n } else if (Array.isArray(value)) {\n value.forEach((item) => {\n if (item instanceof File) {\n formData.append(key, item);\n } else if (item !== undefined && item !== null) {\n formData.append(\n key,\n typeof item === \"object\" ? JSON.stringify(item) : item.toString()\n );\n }\n });\n } else if (value !== undefined && value !== null) {\n formData.append(\n key,\n typeof value === \"object\" ? JSON.stringify(value) : value.toString()\n );\n }\n });\n }\n\n const { data } = await axios.post<\n unknown,\n AxiosResponse<ApiPlaygroundResultType>\n >(`${NEXT_PUBLIC.BASE_PATH}/_mintlify/api/file-request`, formData);\n return data;\n};\n\nconst handleFormData = (request: RequestInfo) => {\n let data = request.body;\n \n const headers = request.header as Record<string, string>;\n\n if (headers[\"content-type\"]?.includes(\"multipart/form-data\")) {\n const formData = new FormData();\n if (typeof data === \"object\" && data !== null) {\n Object.entries(data).forEach(([key, value]) => {\n if (value instanceof File) {\n formData.append(key, value);\n } else if (Array.isArray(value)) {\n value.forEach((item) => {\n if (item instanceof File) {\n formData.append(key, item);\n } else if (item !== undefined && item !== null) {\n formData.append(\n key,\n typeof item === \"object\"\n ? JSON.stringify(item)\n : item.toString()\n );\n }\n });\n } else if (value !== undefined && value !== null) {\n formData.append(\n key,\n typeof value === \"object\" ? JSON.stringify(value) : value.toString()\n );\n }\n });\n data = formData;\n delete headers[\"content-type\"];\n }\n }\n return { data, headers };\n};\n"],"names":["useSendPlaygroundRequest","endpoint","baseUrl","contentType","setResult","setIsFetching","inputs","useApiPlaygroundInputs","docsConfig","useContext","DocsConfigContext","disableProxy","_b","_a","useCallback","axios","x","pathWithInputs","addPathParams","url","joinWithSingleSlash","addServerVariables","headers","addContentType","request","response","performDirectRequest","data","performFileRequest","NEXT_PUBLIC","err","path","pathInputs","inputName","inputValue","variables","key","input","name","it","formData","formHeaders","handleFormData","value","item"],"mappings":";;;;AA4BO,MAAMA,IAA2B,CAAC;AAAA,EACvC,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AACF,MAAqC;;AACnC,QAAMC,IAASC,EAAA,GACT,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAiB,GAG7CC,MAAeC,KAAAC,IAAAL,KAAA,gBAAAA,EAAY,QAAZ,gBAAAK,EAAiB,eAAjB,gBAAAD,EAA6B,WAAU;AAE5D,SAAOE,EAAY,YAAY;AAC7B,IAAAT,EAAc,EAAI;AAClB,UAAMU,IAAQ,MAAM,OAAO,OAAO,EAAE,KAAK,CAACC,MAAMA,EAAE,OAAO,GAEnDC,IAAiBC,EAAcjB,EAAS,MAAMK,EAAO,IAAI,GAEzDa,IAAMC;AAAA,MACVC,EAAmBnB,GAASI,EAAO,MAAM;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,QAAAT,EAAyB,SAAS,wBAAwB;AAC5D,UAAM2B,IAAW,IAAI,SAAA;AACrB,IAAI,OAAOb,KAAS,YAAYA,MAAS,SACvC,OAAO,QAAQA,CAAI,EAAE,QAAQ,CAAC,CAACS,GAAKO,CAAK,MAAM;AAC7C,MAAIA,aAAiB,OACnBH,EAAS,OAAOJ,GAAKO,CAAK,IACjB,MAAM,QAAQA,CAAK,IAC5BA,EAAM,QAAQ,CAACC,MAAS;AACtB,QAAIA,aAAgB,OAClBJ,EAAS,OAAOJ,GAAKQ,CAAI,IACMA,KAAS,QACxCJ,EAAS;AAAA,UACPJ;AAAA,UACA,OAAOQ,KAAS,WACZ,KAAK,UAAUA,CAAI,IACnBA,EAAK,SAAA;AAAA,QAAS;AAAA,MAGxB,CAAC,IAC+BD,KAAU,QAC1CH,EAAS;AAAA,QACPJ;AAAA,QACA,OAAOO,KAAU,WAAW,KAAK,UAAUA,CAAK,IAAIA,EAAM,SAAA;AAAA,MAAS;AAAA,IAGzE,CAAC,GACDhB,IAAOa,GACP,OAAOlB,EAAQ,cAAc;AAAA,EAEjC;AACA,SAAO,EAAE,MAAAK,GAAM,SAAAL,EAAA;AACjB;"}
package/dist/index.d.ts CHANGED
@@ -1,23 +1,35 @@
1
1
  import { ApiPlaygroundDisplayType } from '@mintlify/models';
2
2
  import { ApiPlaygroundInputs } from '@mintlify/validation';
3
3
  import { ApiPlaygroundResultType } from '@mintlify/models';
4
+ import { AsyncAPIDocumentInterface } from '@mintlify/common';
5
+ import { ChannelData } from '@mintlify/common';
4
6
  import { ClassValue } from 'clsx';
5
7
  import { CodeSample } from '@mintlify/validation';
6
8
  import { Context } from 'react';
9
+ import { DecoratedNavigationConfig } from '@mintlify/validation';
7
10
  import { default as default_2 } from 'react';
11
+ import { DeploymentEntitlements } from '@mintlify/validation';
12
+ import { DeploymentFeedbackType } from '@mintlify/validation';
13
+ import { DeploymentPreviewType } from '@mintlify/validation';
8
14
  import { DocsConfig } from '@mintlify/validation';
9
15
  import { Element as Element_2 } from 'hast';
10
16
  import { Endpoint } from '@mintlify/validation';
17
+ import { GitSource } from '@mintlify/validation';
11
18
  import { Handle } from 'hast-util-to-mdast';
19
+ import { IncrementalDataSchemaArray } from '@mintlify/validation';
20
+ import { InkeepType } from '@mintlify/models';
12
21
  import { JSX as JSX_2 } from 'react/jsx-runtime';
13
22
  import { MdxExtracts as MdxExtracts_2 } from '@mintlify/common';
14
23
  import { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
24
+ import { MintConfig } from '@mintlify/models';
15
25
  import { Node as Node_2 } from 'unist';
16
26
  import { Node as Node_3 } from 'hast';
27
+ import { OpenApiMetadata } from '@mintlify/models';
17
28
  import { OpenAPIV3 } from 'openapi-types';
18
29
  import { OpenAPIV3_1 } from 'openapi-types';
19
30
  import { Operation } from '@mintlify/validation';
20
31
  import { PageMetaTags } from '@mintlify/models';
32
+ import { PageType } from '@mintlify/models';
21
33
  import { ParameterObject } from '@mintlify/validation';
22
34
  import { Plugin as Plugin_2 } from 'unified';
23
35
  import * as React_2 from 'react';
@@ -26,12 +38,15 @@ import { RequestBodyObject } from '@mintlify/validation';
26
38
  import { ResponseObject } from '@mintlify/validation';
27
39
  import { Root } from 'mdast';
28
40
  import { Root as Root_2 } from 'hast';
41
+ import { SchemaGraphData } from '@mintlify/validation';
29
42
  import { SchemaObject } from '@mintlify/validation';
30
43
  import { SecurityOption } from '@mintlify/validation';
44
+ import { SerializeSuccess } from '@mintlify/mdx/types';
31
45
  import { ServerObject } from '@mintlify/validation';
32
46
  import { State } from 'hast-util-to-mdast';
33
47
  import { StoreApi } from 'zustand';
34
48
  import { Text as Text_2 } from 'hast';
49
+ import { TrieveType } from '@mintlify/validation';
35
50
  import { UseBoundStore } from 'zustand';
36
51
  import { UUID } from '@mintlify/validation';
37
52
 
@@ -56,6 +71,15 @@ export declare const allComponents: {
56
71
  Summary: typeof Summary;
57
72
  };
58
73
 
74
+ export declare interface AnchorConfig {
75
+ href: string;
76
+ title: string;
77
+ description?: string;
78
+ icon?: default_2.ComponentType<{
79
+ className?: string;
80
+ }>;
81
+ }
82
+
59
83
  export declare const Api: ({ children }: {
60
84
  children: ReactNode;
61
85
  }) => JSX_2.Element | null;
@@ -73,7 +97,7 @@ export declare function ApiFields({ pageMetadata }: {
73
97
  pageMetadata: PageMetaTags;
74
98
  }): JSX_2.Element;
75
99
 
76
- export declare const ApiPlayground: ({ endpoint, display }: ApiPlaygroundParams) => JSX_2.Element;
100
+ export declare const ApiPlayground: ({ endpoint, display, pathname }: ApiPlaygroundParams) => JSX_2.Element;
77
101
 
78
102
  export declare const ApiPlaygroundContext: Context<ApiPlaygroundContextType>;
79
103
 
@@ -108,6 +132,19 @@ export declare type ApiPlaygroundContextTypeLegacy = {
108
132
  declare type ApiPlaygroundParams = {
109
133
  endpoint: Endpoint;
110
134
  display: ApiPlaygroundDisplayType;
135
+ pathname: string;
136
+ };
137
+
138
+ export declare const ApiReferenceContext: Context<ApiReferenceContextType>;
139
+
140
+ export declare const ApiReferenceContext2: Context<ApiReferenceContext2Type>;
141
+
142
+ export declare type ApiReferenceContext2Type = {
143
+ apiReferenceData2: ApiReferenceDataV2;
144
+ };
145
+
146
+ export declare type ApiReferenceContextType = {
147
+ apiReferenceData: ApiReferenceData;
111
148
  };
112
149
 
113
150
  declare interface ApiReferenceContextValue {
@@ -116,6 +153,16 @@ declare interface ApiReferenceContextValue {
116
153
  mdxExtracts?: any;
117
154
  }
118
155
 
156
+ declare type ApiReferenceData = {
157
+ metadata?: OpenApiMetadata;
158
+ endpoint?: Endpoint;
159
+ schemaData?: SchemaData;
160
+ componentSchemas?: ComponentSchemas;
161
+ channel?: ChannelData;
162
+ channelId?: string;
163
+ document?: AsyncAPIDocumentInterface;
164
+ };
165
+
119
166
  export declare interface ApiReferenceDataV2 {
120
167
  filename?: string;
121
168
  originalFileLocation?: string;
@@ -132,14 +179,20 @@ export declare interface ApiReferenceDataV2 {
132
179
  };
133
180
  }
134
181
 
135
- export declare function ApiReferenceProvider2({ apiReferenceData2, docsConfig, mdxExtracts, children, }: ApiReferenceProvider2Props): JSX_2.Element;
182
+ export declare function ApiReferenceProvider({ value, children, }: {
183
+ value: ApiReferenceContextType;
184
+ children: ReactNode;
185
+ }): JSX_2.Element;
136
186
 
137
- declare interface ApiReferenceProvider2Props {
138
- apiReferenceData2?: any;
139
- docsConfig?: any;
140
- mdxExtracts?: any;
141
- children: default_2.ReactNode;
142
- }
187
+ export declare function ApiReferenceProvider2({ pageMetadata, docsConfig, mdxExtracts, apiReferenceData2, children, }: ApiReferenceProvider2Props): JSX_2.Element;
188
+
189
+ export declare type ApiReferenceProvider2Props = {
190
+ pageMetadata: PageMetaTags;
191
+ docsConfig: DocsConfig | undefined;
192
+ mdxExtracts: MdxExtracts_2 | undefined;
193
+ apiReferenceData2: ApiReferenceDataV2 | undefined;
194
+ children: ReactNode;
195
+ };
143
196
 
144
197
  export declare interface BottomLinkConfig {
145
198
  href: string;
@@ -186,6 +239,8 @@ export declare type CodeExample = {
186
239
  filename?: string;
187
240
  };
188
241
 
242
+ declare type ComponentSchemas = Record<string, OpenAPIV3_1.SchemaObject>;
243
+
189
244
  declare interface ComponentsContextValue {
190
245
  LinkComponent?: LinkComponent;
191
246
  }
@@ -232,6 +287,26 @@ export declare interface CreateDefaultComponentsOptions {
232
287
 
233
288
  export declare const defaultComponents: MDXComponents;
234
289
 
290
+ export declare const DeploymentMetadataContext: Context<DeploymentMetadataContextType>;
291
+
292
+ export declare type DeploymentMetadataContextType = {
293
+ subdomain?: string;
294
+ actualSubdomain?: string;
295
+ gitSource?: GitSource;
296
+ inkeep?: InkeepType;
297
+ trieve?: TrieveType;
298
+ feedback?: DeploymentFeedbackType;
299
+ entitlements?: DeploymentEntitlements;
300
+ buildId?: string;
301
+ clientVersion?: string;
302
+ preview?: DeploymentPreviewType;
303
+ };
304
+
305
+ export declare function DeploymentMetadataProvider({ value, children, }: {
306
+ value: DeploymentMetadataContextType;
307
+ children: ReactNode;
308
+ }): JSX_2.Element;
309
+
235
310
  export declare function Details({ children, open }: DetailsProps): JSX_2.Element;
236
311
 
237
312
  declare interface DetailsProps {
@@ -241,6 +316,19 @@ declare interface DetailsProps {
241
316
 
242
317
  export declare type DifferentiatedType = SchemaObject['type'] | 'oneOf' | 'any' | 'enum<string>' | 'enum<number>' | 'enum<integer>' | 'file';
243
318
 
319
+ export declare const DocsConfigContext: Context<DocsConfigContextType>;
320
+
321
+ export declare type DocsConfigContextType = {
322
+ mintConfig?: MintConfig;
323
+ docsConfig?: DocsConfig;
324
+ docsNavWithMetadata?: DecoratedNavigationConfig;
325
+ };
326
+
327
+ export declare function DocsConfigProvider({ value, children, }: {
328
+ value: DocsConfigContextType;
329
+ children: ReactNode;
330
+ }): JSX_2.Element;
331
+
244
332
  /**
245
333
  * DocsLayout component provides a complete documentation layout with sidebar navigation
246
334
  * and main content area. It's designed to be scalable, customizable, and tree-shakable.
@@ -260,7 +348,7 @@ export declare type DifferentiatedType = SchemaObject['type'] | 'oneOf' | 'any'
260
348
  * </DocsLayout>
261
349
  * ```
262
350
  */
263
- export declare const DocsLayout: ({ navTree, children, activeHref, activeId, theme, className, bottomLinks, LinkComponent, localization, telemetry, showSidebar, sidebarClassName, }: DocsLayoutProps) => JSX_2.Element;
351
+ export declare const DocsLayout: ({ navTree, anchors, children, activeHref, activeId, theme, className, bottomLinks, LinkComponent, localization, telemetry, showSidebar, sidebarClassName, }: DocsLayoutProps) => JSX_2.Element;
264
352
 
265
353
  /**
266
354
  * Localization strings for DocsLayout
@@ -276,6 +364,8 @@ export declare interface DocsLayoutLocalization {
276
364
  export declare interface DocsLayoutProps {
277
365
  /** Navigation tree data structure */
278
366
  navTree: NavTreeData;
367
+ /** Anchor configurations */
368
+ anchors?: AnchorConfig[];
279
369
  /** The main content to render in the layout */
280
370
  children: ReactNode;
281
371
  /** Currently active href for navigation highlighting */
@@ -434,6 +524,11 @@ export declare function generateLlmsFullTxt(pages: LlmsPageConfig[], baseUrl: st
434
524
 
435
525
  export declare function generateLlmsTxt(pages: LlmsPageConfig[], baseUrl: string): string;
436
526
 
527
+ export declare const getApiReferenceDataFromGraph: ({ metadata, schemaGraphData, }: {
528
+ metadata: PageMetaTags;
529
+ schemaGraphData: SchemaGraphData;
530
+ }) => ApiReferenceDataV2;
531
+
437
532
  export declare function getClassNames(element: Element_2): string[];
438
533
 
439
534
  export declare const getNodeText: (node: unknown) => string;
@@ -563,7 +658,7 @@ export declare interface NavItem {
563
658
  method?: string;
564
659
  }
565
660
 
566
- export declare function NavTree({ navTree, activeId, className, activeHref, theme, bottomLinks, }: NavTreeProps): JSX_2.Element | null;
661
+ export declare function NavTree({ navTree, activeId, className, activeHref, theme, bottomLinks, anchors, }: NavTreeProps): JSX_2.Element | null;
567
662
 
568
663
  export declare interface NavTreeData {
569
664
  items: NavItem[];
@@ -574,8 +669,9 @@ declare interface NavTreeProps {
574
669
  activeId?: string;
575
670
  className?: string;
576
671
  activeHref?: string;
577
- theme?: "light" | "dark" | "system";
672
+ theme?: 'light' | 'dark' | 'system';
578
673
  bottomLinks?: BottomLinkConfig[];
674
+ anchors?: AnchorConfig[];
579
675
  }
580
676
 
581
677
  export declare const OperationPage: ({ apiReferenceData, operation, children, }: {
@@ -603,6 +699,8 @@ export declare type OperationV2 = Operation & {
603
699
  disableProxy?: boolean;
604
700
  };
605
701
 
702
+ export declare const PageContext: Context<PageContextType>;
703
+
606
704
  export declare const PageContextMenu: ({ className, pathname, markdownContent, onCopyMarkdown, onViewMarkdown, allPages, baseUrl, }: PageContextMenuProps) => JSX_2.Element;
607
705
 
608
706
  /**
@@ -633,6 +731,21 @@ export declare interface PageContextMenuProps {
633
731
  baseUrl?: string;
634
732
  }
635
733
 
734
+ export declare type PageContextType = {
735
+ pageMetadata: PageMetaTags;
736
+ pageType?: PageType;
737
+ mdxExtracts?: MdxExtracts_2;
738
+ description?: SerializeSuccess | string | null;
739
+ panelMdxSource?: SerializeSuccess;
740
+ panelMdxSourceWithNoJs?: SerializeSuccess;
741
+ pathname?: string;
742
+ };
743
+
744
+ export declare function PageProvider({ value, children }: {
745
+ value: PageContextType;
746
+ children: ReactNode;
747
+ }): JSX_2.Element;
748
+
636
749
  export declare function ParamName({ children }: ParamNameProps): JSX_2.Element;
637
750
 
638
751
  declare interface ParamNameProps {
@@ -746,6 +859,11 @@ export declare type ResolvedSecurityObject = {
746
859
 
747
860
  export declare const sanitizePreTags: Plugin_2<[], Node_3>;
748
861
 
862
+ declare type SchemaData = {
863
+ schemaArray: IncrementalDataSchemaArray;
864
+ example: unknown;
865
+ };
866
+
749
867
  export declare type SchemaGeneratedExample = {
750
868
  title: string;
751
869
  description?: string;