docusaurus-theme-openapi-docs 1.4.4 → 1.4.6

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 (84) hide show
  1. package/lib/theme/ApiDemoPanel/Accept/index.js +3 -3
  2. package/lib/theme/ApiDemoPanel/Authorization/index.js +9 -9
  3. package/lib/theme/ApiDemoPanel/Authorization/slice.js +1 -1
  4. package/lib/theme/ApiDemoPanel/Body/index.js +9 -13
  5. package/lib/theme/ApiDemoPanel/CodeTabs/index.js +1 -1
  6. package/lib/theme/ApiDemoPanel/ContentType/index.js +3 -3
  7. package/lib/theme/ApiDemoPanel/Curl/index.js +3 -3
  8. package/lib/theme/ApiDemoPanel/Execute/index.js +3 -3
  9. package/lib/theme/ApiDemoPanel/FormFileUpload/index.js +1 -1
  10. package/lib/theme/ApiDemoPanel/LiveEditor/index.js +1 -1
  11. package/lib/theme/ApiDemoPanel/ParamOptions/index.js +6 -6
  12. package/lib/theme/ApiDemoPanel/Request/index.js +7 -7
  13. package/lib/theme/ApiDemoPanel/Response/index.js +1 -1
  14. package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -1
  15. package/lib/theme/ApiDemoPanel/Server/index.js +5 -5
  16. package/lib/theme/ApiDemoPanel/index.js +5 -5
  17. package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +1 -1
  18. package/lib/theme/ApiItem/index.js +3 -3
  19. package/lib/theme/ApiItem/store.js +7 -7
  20. package/lib/theme/DiscriminatorTabs/styles.module.css +9 -5
  21. package/lib/theme/MimeTabs/index.js +4 -6
  22. package/lib/theme/ParamsItem/index.js +9 -3
  23. package/lib/theme/SchemaItem/index.js +4 -2
  24. package/lib/theme/styles.css +1 -0
  25. package/lib/theme-openapi.d.ts +186 -0
  26. package/lib-next/theme/ApiDemoPanel/Accept/index.js +3 -3
  27. package/lib-next/theme/ApiDemoPanel/Authorization/index.js +9 -9
  28. package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +1 -1
  29. package/lib-next/theme/ApiDemoPanel/Body/index.js +9 -11
  30. package/lib-next/theme/ApiDemoPanel/CodeTabs/index.js +1 -1
  31. package/lib-next/theme/ApiDemoPanel/ContentType/index.js +3 -3
  32. package/lib-next/theme/ApiDemoPanel/Curl/index.js +3 -3
  33. package/lib-next/theme/ApiDemoPanel/Execute/index.js +3 -3
  34. package/lib-next/theme/ApiDemoPanel/FormFileUpload/index.js +1 -1
  35. package/lib-next/theme/ApiDemoPanel/LiveEditor/index.js +1 -1
  36. package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +9 -6
  37. package/lib-next/theme/ApiDemoPanel/Request/index.js +7 -7
  38. package/lib-next/theme/ApiDemoPanel/Response/index.js +1 -1
  39. package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -1
  40. package/lib-next/theme/ApiDemoPanel/Server/index.js +5 -5
  41. package/lib-next/theme/ApiDemoPanel/index.js +5 -5
  42. package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +4 -1
  43. package/lib-next/theme/ApiItem/index.js +3 -3
  44. package/lib-next/theme/ApiItem/store.js +7 -7
  45. package/lib-next/theme/DiscriminatorTabs/styles.module.css +9 -5
  46. package/lib-next/theme/MimeTabs/index.js +4 -6
  47. package/lib-next/theme/ParamsItem/index.js +9 -3
  48. package/lib-next/theme/SchemaItem/index.js +4 -2
  49. package/lib-next/theme/styles.css +1 -0
  50. package/lib-next/theme-openapi.d.ts +186 -0
  51. package/package.json +3 -3
  52. package/src/theme/ApiDemoPanel/Accept/index.tsx +7 -6
  53. package/src/theme/ApiDemoPanel/Authorization/index.tsx +20 -19
  54. package/src/theme/ApiDemoPanel/Authorization/slice.ts +3 -2
  55. package/src/theme/ApiDemoPanel/Body/index.tsx +16 -18
  56. package/src/theme/ApiDemoPanel/CodeTabs/index.tsx +3 -2
  57. package/src/theme/ApiDemoPanel/ContentType/index.tsx +9 -6
  58. package/src/theme/ApiDemoPanel/Curl/index.tsx +14 -14
  59. package/src/theme/ApiDemoPanel/Execute/index.tsx +15 -15
  60. package/src/theme/ApiDemoPanel/Execute/makeRequest.ts +1 -2
  61. package/src/theme/ApiDemoPanel/FloatingButton/index.tsx +1 -1
  62. package/src/theme/ApiDemoPanel/FormFileUpload/index.tsx +2 -2
  63. package/src/theme/ApiDemoPanel/FormItem/index.tsx +1 -1
  64. package/src/theme/ApiDemoPanel/FormMultiSelect/index.tsx +1 -1
  65. package/src/theme/ApiDemoPanel/FormSelect/index.tsx +1 -1
  66. package/src/theme/ApiDemoPanel/FormTextInput/index.tsx +1 -1
  67. package/src/theme/ApiDemoPanel/LiveEditor/index.tsx +1 -1
  68. package/src/theme/ApiDemoPanel/MethodEndpoint/index.tsx +1 -1
  69. package/src/theme/ApiDemoPanel/ParamOptions/index.tsx +26 -16
  70. package/src/theme/ApiDemoPanel/Request/index.tsx +10 -10
  71. package/src/theme/ApiDemoPanel/Response/index.tsx +2 -2
  72. package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +4 -5
  73. package/src/theme/ApiDemoPanel/Server/index.tsx +14 -13
  74. package/src/theme/ApiDemoPanel/buildPostmanRequest.ts +2 -3
  75. package/src/theme/ApiDemoPanel/index.tsx +5 -6
  76. package/src/theme/ApiDemoPanel/persistanceMiddleware.ts +8 -4
  77. package/src/theme/ApiItem/index.tsx +8 -5
  78. package/src/theme/ApiItem/store.ts +7 -8
  79. package/src/theme/DiscriminatorTabs/styles.module.css +9 -5
  80. package/src/theme/MimeTabs/index.js +4 -6
  81. package/src/theme/ParamsItem/index.js +9 -3
  82. package/src/theme/SchemaItem/index.js +4 -2
  83. package/src/theme/styles.css +1 -0
  84. package/src/theme-openapi.d.ts +186 -0
@@ -46,3 +46,189 @@ declare module "@docusaurus/plugin-content-docs-types" {
46
46
  declare module "docusaurus-theme-openapi-docs" {
47
47
  export type ThemeConfig = Partial<import("./types").ThemeConfig>;
48
48
  }
49
+
50
+ declare module "@theme/ApiItem/hooks" {
51
+ export { useTypedDispatch, useTypedSelector };
52
+ }
53
+
54
+ declare module "@theme/ApiItem/Layout" {
55
+ export default function Layout(props: any): JSX.Element;
56
+ }
57
+
58
+ declare module "@theme/ApiItem/store" {
59
+ export { AppDispatch, RootState };
60
+ }
61
+
62
+ declare module "@theme/SchemaTabs" {
63
+ export default function SchemaTabs(props: any): JSX.Element;
64
+ }
65
+
66
+ declare module "@theme/ApiDemoPanel/Accept" {
67
+ export default function Accept(): JSX.Element;
68
+ }
69
+
70
+ declare module "@theme/ApiDemoPanel/Accept/slice" {
71
+ export default accept as Reducer<State, AnyAction>;
72
+ }
73
+
74
+ declare module "@theme/ApiDemoPanel/Authorization" {
75
+ export default function Authorization(): JSX.Element;
76
+ }
77
+
78
+ declare module "@theme/ApiDemoPanel/Authorization/slice" {
79
+ export { AuthState, Scheme, setAuthData, setSelectedAuth, createAuth };
80
+ export default auth as Reducer<State, AnyAction>;
81
+ }
82
+
83
+ declare module "@theme/ApiDemoPanel/Body" {
84
+ import { Props as BodyProps } from "@theme/ApiDemoPanel/Body";
85
+
86
+ export default function Body(props: BodyProps): JSX.Element;
87
+ }
88
+
89
+ declare module "@theme/ApiDemoPanel/Body/json2xml" {
90
+ export default function json2xml(any, any?): any;
91
+ }
92
+
93
+ declare module "@theme/ApiDemoPanel/Body/slice" {
94
+ import { Body, Content, State } from "@theme/ApiDemoPanel/Body/slice";
95
+
96
+ export { Body, Content, State };
97
+ export function setStringRawBody(any, any?): any;
98
+ export default body as Reducer<State, AnyAction>;
99
+ }
100
+
101
+ declare module "@theme/ApiDemoPanel/buildPostmanRequest" {
102
+ export default function buildPostmanRequest(any, any?): any;
103
+ }
104
+
105
+ declare module "@theme/ApiDemoPanel/CodeTabs" {
106
+ import { Props as CodeTabsProps } from "@theme/ApiDemoPanel/CodeTabs";
107
+
108
+ export default function CodeTabs(props: CodeTabsProps): JSX.Element;
109
+ }
110
+
111
+ declare module "@theme/ApiDemoPanel/ContentType" {
112
+ export default function ContentType(): JSX.Element;
113
+ }
114
+
115
+ declare module "@theme/ApiDemoPanel/ContentType/slice" {
116
+ export { setContentType };
117
+ export default contentType as Reducer<State, AnyAction>;
118
+ }
119
+
120
+ declare module "@theme/ApiDemoPanel/Curl" {
121
+ import { Props as CurlProps } from "@theme/ApiDemoPanel/Curl";
122
+
123
+ export { languageSet, Language } from "@theme/ApiDemoPanel/Curl";
124
+ export default function Curl(props: CurlProps): JSX.Element;
125
+ }
126
+
127
+ declare module "@theme/ApiDemoPanel/FloatingButton" {
128
+ import { Props as FloatingButtonProps } from "@theme/ApiDemoPanel/FloatingButton";
129
+
130
+ export default function FloatingButton(
131
+ props: FloatingButtonProps
132
+ ): JSX.Element;
133
+ }
134
+
135
+ declare module "@theme/ApiDemoPanel/FormItem" {
136
+ import { Props as FormItemProps } from "@theme/ApiDemoPanel/FormItem";
137
+
138
+ export default function FormItem(props: FormItemProps): JSX.Element;
139
+ }
140
+
141
+ declare module "@theme/ApiDemoPanel/FormSelect" {
142
+ import { Props as FormSelectProps } from "@theme/ApiDemoPanel/FormSelect";
143
+
144
+ export default function FormSelect(props: FormSelectProps): JSX.Element;
145
+ }
146
+
147
+ declare module "@theme/ApiDemoPanel/FormTextInput" {
148
+ import { Props as FormTextInputProps } from "@theme/ApiDemoPanel/FormTextInput";
149
+
150
+ export default function FormTextInput(props: FormTextInputProps): JSX.Element;
151
+ }
152
+
153
+ declare module "@theme/ApiDemoPanel/FormFileUpload" {
154
+ import { Props as FormFileUploadProps } from "@theme/ApiDemoPanel/FormFileUpload";
155
+
156
+ export default function FormFileUpload(
157
+ props: FormFileUploadProps
158
+ ): JSX.Element;
159
+ }
160
+
161
+ declare module "@theme/ApiDemoPanel/FormMultiSelect" {
162
+ import { Props as FormMultiSelectProps } from "@theme/ApiDemoPanel/FormMultiSelect";
163
+
164
+ export default function FormMultiSelect(
165
+ props: FormMultiSelectProps
166
+ ): JSX.Element;
167
+ }
168
+
169
+ declare module "@theme/ApiDemoPanel/Execute" {
170
+ import { Props as ExecuteProps } from "@theme/ApiDemoPanel/Execute";
171
+
172
+ export default function Execute(props: ExecuteProps): JSX.Element;
173
+ }
174
+
175
+ declare module "@theme/ApiDemoPanel/LiveEditor" {
176
+ export default function LiveEditor(props: any): JSX.Element;
177
+ }
178
+
179
+ declare module "@theme/ApiDemoPanel/MethodEndpoint" {
180
+ import { Props as MethodEndpointProps } from "@theme/ApiDemoPanel/MethodEndpoint";
181
+
182
+ export default function MethodEndpoint(
183
+ props: MethodEndpointProps
184
+ ): JSX.Element;
185
+ }
186
+
187
+ declare module "@theme/ApiDemoPanel/ParamOptions" {
188
+ import { ParamProps } from "@theme/ApiDemoPanel/ParamOptions";
189
+
190
+ export default function ParamOptions(props: ParamProps): JSX.Element;
191
+ }
192
+
193
+ declare module "@theme/ApiDemoPanel/ParamOptions/slice" {
194
+ export type { Param };
195
+ export default params as Reducer<State, AnyAction>;
196
+ }
197
+
198
+ declare module "@theme/ApiDemoPanel/persistanceMiddleware" {
199
+ export { createPersistanceMiddleware };
200
+ }
201
+
202
+ declare module "@theme/ApiDemoPanel/Request" {
203
+ import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
204
+
205
+ export interface RequestProps {
206
+ item: NonNullable<ApiItem>;
207
+ }
208
+ export default function Request(props: RequestProps): JSX.Element;
209
+ }
210
+
211
+ declare module "@theme/ApiDemoPanel/Response" {
212
+ export default function Response(): JSX.Element;
213
+ }
214
+
215
+ declare module "@theme/ApiDemoPanel/Response/slice" {
216
+ export { setResponse };
217
+ export default response as Reducer<State, AnyAction>;
218
+ }
219
+
220
+ declare module "@theme/ApiDemoPanel/SecuritySchemes" {
221
+ export default function SecuritySchemes(props: any): JSX.Element;
222
+ }
223
+
224
+ declare module "@theme/ApiDemoPanel/Server" {
225
+ export default function Server(): JSX.Element;
226
+ }
227
+
228
+ declare module "@theme/ApiDemoPanel/Server/slice" {
229
+ export default server as Reducer<State, AnyAction>;
230
+ }
231
+
232
+ declare module "@theme/ApiDemoPanel/storage-utils" {
233
+ export { createStorage, hashArray };
234
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "1.4.4",
4
+ "version": "1.4.6",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -51,7 +51,7 @@
51
51
  "buffer": "^6.0.3",
52
52
  "clsx": "^1.1.1",
53
53
  "crypto-js": "^4.1.1",
54
- "docusaurus-plugin-openapi-docs": "^1.4.4",
54
+ "docusaurus-plugin-openapi-docs": "^1.4.6",
55
55
  "file-saver": "^2.0.5",
56
56
  "immer": "^9.0.7",
57
57
  "lodash": "^4.17.20",
@@ -73,5 +73,5 @@
73
73
  "engines": {
74
74
  "node": ">=14"
75
75
  },
76
- "gitHead": "05860ecc586244bcb84b5daa095a4110b807a95c"
76
+ "gitHead": "cb1f7125cd919da03346cdcb9eef49f4de8537e7"
77
77
  }
@@ -7,14 +7,15 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
11
- import FormItem from "./../FormItem";
12
- import FormSelect from "./../FormSelect";
10
+ import FormItem from "@theme/ApiDemoPanel/FormItem";
11
+ import FormSelect from "@theme/ApiDemoPanel/FormSelect";
12
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
13
+
13
14
  import { setAccept } from "./slice";
14
15
 
15
16
  function Accept() {
16
- const value = useTypedSelector((state) => state.accept.value);
17
- const options = useTypedSelector((state) => state.accept.options);
17
+ const value = useTypedSelector((state: any) => state.accept.value);
18
+ const options = useTypedSelector((state: any) => state.accept.options);
18
19
  const dispatch = useTypedDispatch();
19
20
 
20
21
  if (options.length <= 1) {
@@ -26,7 +27,7 @@ function Accept() {
26
27
  <FormSelect
27
28
  value={value}
28
29
  options={options}
29
- onChange={(e) => dispatch(setAccept(e.target.value))}
30
+ onChange={(e: any) => dispatch(setAccept(e.target.value))}
30
31
  />
31
32
  </FormItem>
32
33
  );
@@ -7,16 +7,17 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
11
- import FormItem from "../FormItem";
12
- import FormSelect from "../FormSelect";
13
- import FormTextInput from "../FormTextInput";
10
+ import FormItem from "@theme/ApiDemoPanel/FormItem";
11
+ import FormSelect from "@theme/ApiDemoPanel/FormSelect";
12
+ import FormTextInput from "@theme/ApiDemoPanel/FormTextInput";
13
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
14
+
14
15
  import { setAuthData, setSelectedAuth } from "./slice";
15
16
 
16
17
  function Authorization() {
17
- const data = useTypedSelector((state) => state.auth.data);
18
- const options = useTypedSelector((state) => state.auth.options);
19
- const selected = useTypedSelector((state) => state.auth.selected);
18
+ const data = useTypedSelector((state: any) => state.auth.data);
19
+ const options = useTypedSelector((state: any) => state.auth.options);
20
+ const selected = useTypedSelector((state: any) => state.auth.selected);
20
21
 
21
22
  const dispatch = useTypedDispatch();
22
23
 
@@ -35,21 +36,21 @@ function Authorization() {
35
36
  <FormSelect
36
37
  options={optionKeys}
37
38
  value={selected}
38
- onChange={(e) => {
39
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
39
40
  dispatch(setSelectedAuth(e.target.value));
40
41
  }}
41
42
  />
42
43
  </FormItem>
43
44
  )}
44
- {selectedAuth.map((a) => {
45
+ {selectedAuth.map((a: any) => {
45
46
  if (a.type === "http" && a.scheme === "bearer") {
46
47
  return (
47
48
  <FormItem label="Bearer Token" key={a.key + "-bearer"}>
48
49
  <FormTextInput
49
50
  placeholder="Bearer Token"
50
51
  value={data[a.key].token ?? ""}
51
- onChange={(e) => {
52
- const value = e.target.value.trim();
52
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
53
+ const value = e.target.value;
53
54
  dispatch(
54
55
  setAuthData({
55
56
  scheme: a.key,
@@ -69,8 +70,8 @@ function Authorization() {
69
70
  <FormTextInput
70
71
  placeholder="Bearer Token"
71
72
  value={data[a.key].token ?? ""}
72
- onChange={(e) => {
73
- const value = e.target.value.trim();
73
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
74
+ const value = e.target.value;
74
75
  dispatch(
75
76
  setAuthData({
76
77
  scheme: a.key,
@@ -91,8 +92,8 @@ function Authorization() {
91
92
  <FormTextInput
92
93
  placeholder="Username"
93
94
  value={data[a.key].username ?? ""}
94
- onChange={(e) => {
95
- const value = e.target.value.trim();
95
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
96
+ const value = e.target.value;
96
97
  dispatch(
97
98
  setAuthData({
98
99
  scheme: a.key,
@@ -108,8 +109,8 @@ function Authorization() {
108
109
  placeholder="Password"
109
110
  password
110
111
  value={data[a.key].password ?? ""}
111
- onChange={(e) => {
112
- const value = e.target.value.trim();
112
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
113
+ const value = e.target.value;
113
114
  dispatch(
114
115
  setAuthData({
115
116
  scheme: a.key,
@@ -130,8 +131,8 @@ function Authorization() {
130
131
  <FormTextInput
131
132
  placeholder={`${a.key}`}
132
133
  value={data[a.key].apiKey ?? ""}
133
- onChange={(e) => {
134
- const value = e.target.value.trim();
134
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
135
+ const value = e.target.value;
135
136
  dispatch(
136
137
  setAuthData({
137
138
  scheme: a.key,
@@ -6,13 +6,14 @@
6
6
  * ========================================================================== */
7
7
 
8
8
  import { createSlice, PayloadAction } from "@reduxjs/toolkit";
9
+ import { createStorage, hashArray } from "@theme/ApiDemoPanel/storage-utils";
9
10
  import {
10
11
  SecurityRequirementObject,
11
12
  SecuritySchemeObject,
12
13
  } from "docusaurus-plugin-openapi-docs/src/openapi/types";
14
+ /* eslint-disable import/no-extraneous-dependencies*/
15
+ import { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
13
16
 
14
- import { ThemeConfig } from "../../../types";
15
- import { createStorage, hashArray } from "../storage-utils";
16
17
  import { getAuthDataKeys } from "./auth-types";
17
18
 
18
19
  // The global definitions
@@ -7,21 +7,19 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
+ import json2xml from "@theme/ApiDemoPanel/Body/json2xml";
11
+ import ContentType from "@theme/ApiDemoPanel/ContentType";
12
+ import FormFileUpload from "@theme/ApiDemoPanel/FormFileUpload";
13
+ import FormItem from "@theme/ApiDemoPanel/FormItem";
14
+ import FormSelect from "@theme/ApiDemoPanel/FormSelect";
15
+ import FormTextInput from "@theme/ApiDemoPanel/FormTextInput";
16
+ import LiveApp from "@theme/ApiDemoPanel/LiveEditor";
17
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
18
+ import SchemaTabs from "@theme/SchemaTabs";
10
19
  import TabItem from "@theme/TabItem";
11
20
  import { RequestBodyObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
12
21
  import format from "xml-formatter";
13
22
 
14
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
15
- // @ts-ignore
16
- import SchemaTabs from "../../SchemaTabs";
17
- import ContentType from "../ContentType";
18
- import FormSelect from "../FormSelect";
19
- import LiveApp from "../LiveEditor";
20
- import FormFileUpload from "./../FormFileUpload";
21
- import FormItem from "./../FormItem";
22
- import FormTextInput from "./../FormTextInput";
23
- // @ts-ignore
24
- import json2xml from "./json2xml";
25
23
  import {
26
24
  clearFormBodyKey,
27
25
  clearRawBody,
@@ -30,13 +28,13 @@ import {
30
28
  setStringFormBody,
31
29
  } from "./slice";
32
30
 
33
- interface Props {
31
+ export interface Props {
34
32
  jsonRequestBodyExample: string;
35
33
  requestBodyMetadata?: RequestBodyObject;
36
34
  }
37
35
 
38
36
  function BodyWrap({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
39
- const contentType = useTypedSelector((state) => state.contentType.value);
37
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
40
38
 
41
39
  // NOTE: We used to check if body was required, but opted to always show the request body
42
40
  // to reduce confusion, see: https://github.com/cloud-annotations/docusaurus-openapi/issues/145
@@ -58,7 +56,7 @@ function BodyWrap({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
58
56
  }
59
57
 
60
58
  function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
61
- const contentType = useTypedSelector((state) => state.contentType.value);
59
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
62
60
  const required = requestBodyMetadata?.required;
63
61
 
64
62
  const dispatch = useTypedDispatch();
@@ -93,7 +91,7 @@ function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
93
91
  <FormItem label="Body" required={required}>
94
92
  <FormFileUpload
95
93
  placeholder={schema.description || "Body"}
96
- onChange={(file) => {
94
+ onChange={(file: any) => {
97
95
  if (file === undefined) {
98
96
  dispatch(clearRawBody());
99
97
  return;
@@ -138,7 +136,7 @@ function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
138
136
  >
139
137
  <FormFileUpload
140
138
  placeholder={val.description || key}
141
- onChange={(file) => {
139
+ onChange={(file: any) => {
142
140
  if (file === undefined) {
143
141
  dispatch(clearFormBodyKey(key));
144
142
  return;
@@ -170,7 +168,7 @@ function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
170
168
  >
171
169
  <FormSelect
172
170
  options={["---", ...val.enum]}
173
- onChange={(e) => {
171
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
174
172
  const val = e.target.value;
175
173
  if (val === "---") {
176
174
  dispatch(clearFormBodyKey(key));
@@ -199,7 +197,7 @@ function Body({ requestBodyMetadata, jsonRequestBodyExample }: Props) {
199
197
  >
200
198
  <FormTextInput
201
199
  placeholder={val.description || key}
202
- onChange={(e) => {
200
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
203
201
  dispatch(
204
202
  setStringFormBody({ key: key, value: e.target.value })
205
203
  );
@@ -14,10 +14,11 @@ import React, {
14
14
 
15
15
  import { duplicates } from "@docusaurus/theme-common";
16
16
  import useIsBrowser from "@docusaurus/useIsBrowser";
17
+ import { languageSet } from "@theme/ApiDemoPanel/Curl";
18
+ import { Language } from "@theme/ApiDemoPanel/Curl";
17
19
  import type { Props as TabItemProps } from "@theme/TabItem";
18
20
  import clsx from "clsx";
19
21
 
20
- import { languageSet } from "../Curl";
21
22
  import styles from "./styles.module.css";
22
23
 
23
24
  const {
@@ -133,7 +134,7 @@ function TabsComponent(props: Props): JSX.Element {
133
134
  setSelectedValue(newTabValue);
134
135
  if (action) {
135
136
  const newLanguage = languageSet.filter(
136
- (lang) => lang.language === newTabValue
137
+ (lang: Language) => lang.language === newTabValue
137
138
  );
138
139
  action(newLanguage[0]);
139
140
  }
@@ -7,14 +7,15 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
11
- import FormItem from "./../FormItem";
12
- import FormSelect from "./../FormSelect";
10
+ import FormItem from "@theme/ApiDemoPanel/FormItem";
11
+ import FormSelect from "@theme/ApiDemoPanel/FormSelect";
12
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
13
+
13
14
  import { setContentType } from "./slice";
14
15
 
15
16
  function ContentType() {
16
- const value = useTypedSelector((state) => state.contentType.value);
17
- const options = useTypedSelector((state) => state.contentType.options);
17
+ const value = useTypedSelector((state: any) => state.contentType.value);
18
+ const options = useTypedSelector((state: any) => state.contentType.options);
18
19
  const dispatch = useTypedDispatch();
19
20
 
20
21
  if (options.length <= 1) {
@@ -26,7 +27,9 @@ function ContentType() {
26
27
  <FormSelect
27
28
  value={value}
28
29
  options={options}
29
- onChange={(e) => dispatch(setContentType(e.target.value))}
30
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
31
+ dispatch(setContentType(e.target.value))
32
+ }
30
33
  />
31
34
  </FormItem>
32
35
  );
@@ -10,15 +10,15 @@ import React, { useState, useEffect } from "react";
10
10
  import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
11
11
  import codegen from "@paloaltonetworks/postman-code-generators";
12
12
  import sdk from "@paloaltonetworks/postman-collection";
13
+ import buildPostmanRequest from "@theme/ApiDemoPanel/buildPostmanRequest";
14
+ import CodeTabs from "@theme/ApiDemoPanel/CodeTabs";
15
+ import { useTypedSelector } from "@theme/ApiItem/hooks";
13
16
  import CodeBlock from "@theme/CodeBlock";
14
17
  import clsx from "clsx";
15
18
 
16
- import { useTypedSelector } from "../../ApiItem/hooks";
17
- import CodeTabs from "../CodeTabs";
18
- import buildPostmanRequest from "./../buildPostmanRequest";
19
19
  import styles from "./styles.module.css";
20
20
 
21
- interface Language {
21
+ export interface Language {
22
22
  highlight?: string;
23
23
  language: string;
24
24
  logoClass?: string;
@@ -102,7 +102,7 @@ export const languageSet: Language[] = [
102
102
  },
103
103
  ];
104
104
 
105
- interface Props {
105
+ export interface Props {
106
106
  postman: sdk.Request;
107
107
  codeSamples: any; // TODO: Type this...
108
108
  }
@@ -124,17 +124,17 @@ function Curl({ postman, codeSamples }: Props) {
124
124
 
125
125
  const { siteConfig } = useDocusaurusContext();
126
126
 
127
- const contentType = useTypedSelector((state) => state.contentType.value);
128
- const accept = useTypedSelector((state) => state.accept.value);
129
- const server = useTypedSelector((state) => state.server.value);
130
- const body = useTypedSelector((state) => state.body);
127
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
128
+ const accept = useTypedSelector((state: any) => state.accept.value);
129
+ const server = useTypedSelector((state: any) => state.server.value);
130
+ const body = useTypedSelector((state: any) => state.body);
131
131
 
132
- const pathParams = useTypedSelector((state) => state.params.path);
133
- const queryParams = useTypedSelector((state) => state.params.query);
134
- const cookieParams = useTypedSelector((state) => state.params.cookie);
135
- const headerParams = useTypedSelector((state) => state.params.header);
132
+ const pathParams = useTypedSelector((state: any) => state.params.path);
133
+ const queryParams = useTypedSelector((state: any) => state.params.query);
134
+ const cookieParams = useTypedSelector((state: any) => state.params.cookie);
135
+ const headerParams = useTypedSelector((state: any) => state.params.header);
136
136
 
137
- const auth = useTypedSelector((state) => state.auth);
137
+ const auth = useTypedSelector((state: any) => state.auth);
138
138
 
139
139
  // TODO
140
140
  const langs = [
@@ -8,12 +8,12 @@
8
8
  import React from "react";
9
9
 
10
10
  import sdk from "@paloaltonetworks/postman-collection";
11
+ import buildPostmanRequest from "@theme/ApiDemoPanel/buildPostmanRequest";
12
+ import { Param } from "@theme/ApiDemoPanel/ParamOptions/slice";
13
+ import { setResponse } from "@theme/ApiDemoPanel/Response/slice";
14
+ import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
11
15
  import Modal from "react-modal";
12
16
 
13
- import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
14
- import { Param } from "../ParamOptions/slice";
15
- import { setResponse } from "../Response/slice";
16
- import buildPostmanRequest from "./../buildPostmanRequest";
17
17
  import makeRequest from "./makeRequest";
18
18
 
19
19
  function validateRequest(params: {
@@ -32,22 +32,22 @@ function validateRequest(params: {
32
32
  return true;
33
33
  }
34
34
 
35
- interface Props {
35
+ export interface Props {
36
36
  postman: sdk.Request;
37
37
  proxy?: string;
38
38
  }
39
39
 
40
40
  function Execute({ postman, proxy }: Props) {
41
- const pathParams = useTypedSelector((state) => state.params.path);
42
- const queryParams = useTypedSelector((state) => state.params.query);
43
- const cookieParams = useTypedSelector((state) => state.params.cookie);
44
- const headerParams = useTypedSelector((state) => state.params.header);
45
- const contentType = useTypedSelector((state) => state.contentType.value);
46
- const body = useTypedSelector((state) => state.body);
47
- const accept = useTypedSelector((state) => state.accept.value);
48
- const server = useTypedSelector((state) => state.server.value);
49
- const params = useTypedSelector((state) => state.params);
50
- const auth = useTypedSelector((state) => state.auth);
41
+ const pathParams = useTypedSelector((state: any) => state.params.path);
42
+ const queryParams = useTypedSelector((state: any) => state.params.query);
43
+ const cookieParams = useTypedSelector((state: any) => state.params.cookie);
44
+ const headerParams = useTypedSelector((state: any) => state.params.header);
45
+ const contentType = useTypedSelector((state: any) => state.contentType.value);
46
+ const body = useTypedSelector((state: any) => state.body);
47
+ const accept = useTypedSelector((state: any) => state.accept.value);
48
+ const server = useTypedSelector((state: any) => state.server.value);
49
+ const params = useTypedSelector((state: any) => state.params);
50
+ const auth = useTypedSelector((state: any) => state.auth);
51
51
 
52
52
  const isValidRequest = validateRequest(params);
53
53
 
@@ -6,8 +6,7 @@
6
6
  * ========================================================================== */
7
7
 
8
8
  import sdk from "@paloaltonetworks/postman-collection";
9
-
10
- import { Body } from "../Body/slice";
9
+ import { Body } from "@theme/ApiDemoPanel/Body/slice";
11
10
 
12
11
  function fetchWithtimeout(
13
12
  url: string,
@@ -9,7 +9,7 @@ import React from "react";
9
9
 
10
10
  import styles from "./styles.module.css";
11
11
 
12
- interface Props {
12
+ export interface Props {
13
13
  label?: string;
14
14
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
15
15
  children?: React.ReactNode;
@@ -7,9 +7,9 @@
7
7
 
8
8
  import React, { useState } from "react";
9
9
 
10
+ import FloatingButton from "@theme/ApiDemoPanel/FloatingButton";
10
11
  import MagicDropzone from "react-magic-dropzone";
11
12
 
12
- import FloatingButton from "../FloatingButton";
13
13
  import styles from "./styles.module.css";
14
14
 
15
15
  type PreviewFile = { preview: string } & File;
@@ -61,7 +61,7 @@ function RenderPreview({ file }: RenderPreviewProps) {
61
61
  }
62
62
  }
63
63
 
64
- interface Props {
64
+ export interface Props {
65
65
  placeholder: string;
66
66
  onChange?(file?: File): any;
67
67
  }
@@ -9,7 +9,7 @@ import React from "react";
9
9
 
10
10
  import styles from "./styles.module.css";
11
11
 
12
- interface Props {
12
+ export interface Props {
13
13
  label?: string;
14
14
  type?: string;
15
15
  required?: boolean | undefined;
@@ -9,7 +9,7 @@ import React from "react";
9
9
 
10
10
  import styles from "./styles.module.css";
11
11
 
12
- interface Props {
12
+ export interface Props {
13
13
  value?: string;
14
14
  options: string[];
15
15
  onChange?: React.ChangeEventHandler<HTMLSelectElement>;