@digi-frontend/dgate-api-documentation 1.0.96 → 1.0.97
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.
- package/dist/src/helpers/layout.helper.js +1 -1
- package/dist/src/helpers/layout.helper.js.map +1 -1
- package/dist/src/layout/docsComponents/DocsAside/DocsAside.js +1 -1
- package/dist/src/layout/docsComponents/DocsAside/DocsAside.js.map +1 -1
- package/dist/src/layout/docsComponents/DocsContent/EndpointPage/index.js +1 -1
- package/dist/src/layout/docsComponents/DocsContent/EndpointPage/index.js.map +1 -1
- package/dist/styles.css +233 -233
- package/package.json +1 -1
- package/src/helpers/layout.helper.ts +17 -1
- package/src/layout/docsComponents/DocsAside/DocsAside.tsx +34 -15
- package/src/layout/docsComponents/DocsContent/EndpointPage/index.tsx +71 -54
- package/variables.txt +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e}from"../../node_modules/tslib/tslib.es6.js";const s=(e,s)=>e.replace(/^#\//,"").split("/").reduce((e,s)=>null==e?void 0:e[s],s),t=e=>{var s,t,
|
|
1
|
+
import{__rest as e}from"../../node_modules/tslib/tslib.es6.js";const s=(e,s)=>e.replace(/^#\//,"").split("/").reduce((e,s)=>null==e?void 0:e[s],s),t=e=>{var s,t,n,i;if(e.components&&e.components.securitySchemes){const o=null===(s=Object.keys(e.components.securitySchemes))||void 0===s?void 0:s.at(0);o&&(e.components.securitySchemes[o].type=null===(i=null===(n=null===(t=null==e?void 0:e.components)||void 0===t?void 0:t.securitySchemes)||void 0===n?void 0:n[o])||void 0===i?void 0:i.type)}else e.components=Object.assign({securitySchemes:{Public:{type:"http",scheme:"public"}}},e.components||{});return e.tags||(e.tags=[]),Object.assign(Object.assign({},e),{paths:o(e)})},n=e=>{var s,t,n,o;const i=Object.assign(Object.assign({},e),{paths:c(e.paths)});if(i.components&&i.components.securitySchemes){const e=null===(s=Object.keys(i.components.securitySchemes))||void 0===s?void 0:s.at(0);e&&(i.components.securitySchemes[e].type.toLowerCase()=="APIKEY".toLowerCase()&&(i.components.securitySchemes[e].in=i.components.securitySchemes[e].in),i.components.securitySchemes[e].type=null===(o=null===(n=null===(t=null==i?void 0:i.components)||void 0===t?void 0:t.securitySchemes)||void 0===n?void 0:n[e])||void 0===o?void 0:o.type)}return i},o=e=>{const t=e.paths;return Object.entries(t).map(([t,n])=>({path:t,methods:Object.entries(n).map(([t,n])=>{var o,i,c,r,l,d;const a=Object.assign(Object.assign({},n),{type:t,tags:n.tags||[],summary:n.summary||"",responses:Object.entries(n.responses).map(([t,n])=>{var o,i,c,r,l;const d=Object.keys(n.content||{})[0];let a=null!==(o=null==n?void 0:n.headers)&&void 0!==o?o:{};Object.keys(a).map(e=>{var s,t,n,o;let i=a[e];(null==i?void 0:i.schema)&&(null===(s=null==i?void 0:i.schema)||void 0===s?void 0:s.type)&&"array"!=(null===(t=null==i?void 0:i.schema)||void 0===t?void 0:t.type)&&(null===(o=null===(n=a[e])||void 0===n?void 0:n.schema)||void 0===o||delete o.items)});let u=null===(c=null===(i=n.content)||void 0===i?void 0:i[d])||void 0===c?void 0:c.schema;if(null==u?void 0:u.$ref)u=s(null==u?void 0:u.$ref,e);else if("array"==(null==u?void 0:u.type)&&(null===(r=null==u?void 0:u.items)||void 0===r?void 0:r.$ref)){const t=s(u.items.$ref,e);u=Object.assign(Object.assign({},u),{items:t})}return{code:t,headers:a,content:{contentType:d,schema:Object.assign(Object.assign({},u),{properties:JSON.stringify((null==u?void 0:u.properties)||(null===(l=null==u?void 0:u.items)||void 0===l?void 0:l.properties))})}}})});if(a.responses.find(e=>"200"==e.code)||a.responses.push({code:"200",content:{contentType:"application/json",schema:{}},headers:{}}),(null==n?void 0:n.parameters)||(a.parameters=[]),"get"!=t.toLowerCase()){const t=Object.keys((null===(o=null==n?void 0:n.requestBody)||void 0===o?void 0:o.content)||{})[0];let u=null===(r=null===(c=null===(i=null==n?void 0:n.requestBody)||void 0===i?void 0:i.content)||void 0===c?void 0:c[t])||void 0===r?void 0:r.schema;(null==u?void 0:u.$ref)?u=s(u.$ref,e):"array"===(null==u?void 0:u.type)&&(null===(l=u.items)||void 0===l?void 0:l.$ref)&&(u=Object.assign(Object.assign({},u),{items:s(u.items.$ref,e)}));const p=u?{content:{contentType:t,schema:Object.assign(Object.assign({},u),{properties:JSON.stringify((null==u?void 0:u.properties)||(null===(d=null==u?void 0:u.items)||void 0===d?void 0:d.properties))})}}:{content:{contentType:"application/json",schema:{properties:"{}",type:"object"}}};a.requestBody=p}return a})}))},i=(e,s)=>{var t,n;if(!(null==e?void 0:e.schema)||!(null===(t=null==e?void 0:e.schema)||void 0===t?void 0:t.properties))return{};return JSON.parse(null===(n=null==e?void 0:e.schema)||void 0===n?void 0:n.properties)},c=s=>s.reduce((s,{path:t,methods:n})=>(s[t]=n.reduce((s,t)=>{var{type:n,tags:o,responses:c,summary:r,requestBody:l}=t,d=e(t,["type","tags","responses","summary","requestBody"]);let a=structuredClone(d||{});a&&a.parameters&&a.parameters.map(e=>{var s,t,n;return e&&(null===(s=null==e?void 0:e.schema)||void 0===s?void 0:s.items)&&"array"==(null===(n=null===(t=null==e?void 0:e.schema)||void 0===t?void 0:t.items)||void 0===n?void 0:n.type)&&(e.schema.items.items={}),e});const u=d.responses||{};s[n]=Object.assign(Object.assign({},a),{tags:o,summary:r,responses:c.reduce((e,{code:s,content:t,headers:n})=>{var o;const c=!u[s],r=Object.keys(n||{}).length>0,l=Object.keys(i(t||{})||{}).length>0;if(c&&!r&&!l)return e;const d={};if(n)for(const[e,s]of Object.entries(n))d[e]={description:s.description||"",required:s.required||!1,schema:s.schema||{}};return e[s]={description:"Success",content:t.contentType?{[t.contentType]:{schema:Object.assign(Object.assign({},t.schema),{properties:i(t)})}}:(null===(o=u[s])||void 0===o?void 0:o.content)||{},headers:d},e},{})});const p="get"!==n?JSON.parse(l.content.schema.properties):{};return"get"!==n&&(s[n].requestBody={content:{[l.content.contentType]:{schema:Object.assign(Object.assign({},l.content.schema),{properties:p})}}}),s},{}),s),{});export{t as transformOpenApiObject,n as transformOpenApiObjectToOrigin,c as transformPathsArrayToOrigin,o as transformPathsToArray};
|
|
2
2
|
//# sourceMappingURL=layout.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.helper.js","sources":["../../../src/helpers/layout.helper.ts"],"sourcesContent":["import { TransformedPathsArray } from '@entities/layout.type'\nimport { OpenAPIFile, SecurityScheme } from '@entities/openApi'\nimport { TransformedOpenApi } from '@entities/transformedOpenApi'\n\nconst resolveRef = (ref: string, openApiJson: OpenAPIFile): Object => {\n const parts = ref.replace(/^#\\//, '').split('/')\n return parts.reduce((obj, key) => obj?.[key], openApiJson)\n}\n\nexport const transformOpenApiObject = (openApiJson: OpenAPIFile): TransformedOpenApi => {\n if (openApiJson.components && openApiJson.components.securitySchemes) {\n const authKey = Object.keys(openApiJson.components.securitySchemes)?.at(0)\n if (authKey) {\n openApiJson.components.securitySchemes[authKey].type = openApiJson?.components\n ?.securitySchemes?.[authKey]?.type as SecurityScheme['type']\n }\n } else {\n openApiJson.components = {\n securitySchemes: {\n Public: {\n type: 'http',\n scheme: 'public',\n },\n },\n ...(openApiJson.components || {}),\n }\n }\n\n if (!openApiJson.tags) {\n openApiJson.tags = []\n }\n\n return {\n ...openApiJson,\n paths: transformPathsToArray(openApiJson),\n } as TransformedOpenApi\n}\n\nexport const transformOpenApiObjectToOrigin = (values: TransformedOpenApi): OpenAPIFile => {\n const object = {\n ...values,\n paths: transformPathsArrayToOrigin(values.paths),\n }\n if (object.components && object.components.securitySchemes) {\n const authKey = Object.keys(object.components.securitySchemes)?.at(0)\n if (authKey) {\n if (object.components.securitySchemes[authKey].type.toLowerCase() == 'APIKEY'.toLowerCase()) {\n object.components.securitySchemes[authKey].in = object.components.securitySchemes[authKey]\n .in as SecurityScheme['in']\n }\n object.components.securitySchemes[authKey].type = object?.components?.securitySchemes?.[\n authKey\n ]?.type as SecurityScheme['type']\n }\n }\n return object\n}\n\nexport const transformPathsToArray = (openApiJson: OpenAPIFile): TransformedPathsArray | any => {\n const paths: OpenAPIFile['paths'] = openApiJson.paths\n const transformedPaths = Object.entries(paths).map(([path, methods]) => ({\n path,\n methods: Object.entries(methods).map(([method, methodProps]) => {\n const obj: any = {\n ...methodProps,\n type: method,\n tags: methodProps.tags || [],\n summary: methodProps.summary || '',\n responses: Object.entries(methodProps.responses).map(([code, codeProps]) => {\n const contentType = Object.keys(codeProps.content || {})[0]\n let headers = codeProps?.headers ?? {}\n\n // ? Fix headers with items property\n Object.keys(headers).map((header: string) => {\n let headerObj = headers[header]\n if (\n headerObj?.schema &&\n headerObj?.schema?.type &&\n headerObj?.schema?.type != 'array'\n ) {\n delete headers[header]?.schema?.items\n }\n })\n\n let schema = codeProps.content?.[contentType]?.schema\n if (schema?.$ref) {\n schema = resolveRef(schema?.$ref, openApiJson)\n } else if (schema?.type == 'array' && schema?.items?.$ref) {\n const resolvedItemSchema = resolveRef(schema.items.$ref, openApiJson)\n schema = {\n ...schema,\n items: resolvedItemSchema,\n }\n }\n\n return {\n code,\n headers,\n content: {\n contentType,\n schema: {\n ...schema,\n properties: JSON.stringify(schema?.properties || schema?.items?.properties),\n },\n },\n }\n }),\n }\n\n if (!obj.responses.find((item) => item.code == '200')) {\n obj.responses.push({\n code: '200',\n content: {\n contentType: 'application/json',\n schema: {},\n },\n headers: {},\n })\n }\n // Add parameters if it does not exist in the original JSON\n if (!methodProps?.parameters) {\n obj.parameters = []\n }\n\n // load response headers parameters\n\n if (method.toLowerCase() != 'get') {\n const contentType = Object.keys(methodProps?.requestBody?.content || {})[0]\n let reqSchema = methodProps?.requestBody?.content?.[contentType]?.schema\n\n if (reqSchema?.$ref) {\n reqSchema = resolveRef(reqSchema.$ref, openApiJson)\n } else if (reqSchema?.type === 'array' && reqSchema.items?.$ref) {\n reqSchema = {\n ...reqSchema,\n items: resolveRef(reqSchema.items.$ref, openApiJson),\n }\n }\n\n const requestBodyData = reqSchema\n ? {\n content: {\n contentType,\n schema: {\n ...reqSchema,\n properties: JSON.stringify(reqSchema?.properties || reqSchema?.items?.properties),\n },\n },\n }\n : {\n content: {\n contentType: 'application/json',\n schema: {\n properties: '{}',\n type: 'object',\n },\n },\n }\n\n obj['requestBody'] = requestBodyData\n }\n return obj\n }),\n }))\n\n return transformedPaths\n}\n\nconst validateBodyForResponse = (content, method) => {\n if (!(content?.schema as any) || !(content?.schema as any)?.properties) {\n return {}\n }\n let _content = JSON.parse((content?.schema as any)?.properties as string)\n\n return _content\n}\n\nexport const transformPathsArrayToOrigin = (paths: TransformedPathsArray): OpenAPIFile['paths'] => {\n return paths.reduce((acc, { path, methods }) => {\n acc[path] = methods.reduce(\n (methodAcc, { type, tags, responses, summary, requestBody, ...rest }) => {\n // Initialize the method object\n // ? Validate (rest) [parameters]\n let copiedRest = structuredClone(rest || {})\n if (copiedRest && copiedRest.parameters) {\n copiedRest.parameters.map((param) => {\n if (param && param?.schema?.items && param?.schema?.items?.type == 'array') {\n param.schema.items.items = {}\n }\n return param\n })\n }\n methodAcc[type] = {\n ...copiedRest,\n tags,\n summary,\n responses: responses.reduce((respAcc, { code, content, headers }) => {\n const formattedHeaders: Record<string, any> = {}\n if (headers) {\n for (const [key, value] of Object.entries(headers)) {\n formattedHeaders[key] = {\n description: value.description || '',\n required: value.required || false,\n schema: value.schema || {},\n }\n }\n }\n respAcc[code] = {\n description: 'Success', // Assuming this is static from the original data\n content: content.contentType\n ? {\n [content.contentType]: {\n schema: {\n ...(content.schema as object),\n properties: validateBodyForResponse(content, type),\n },\n },\n }\n : {},\n headers: formattedHeaders,\n }\n return respAcc\n }, {} as Record<string, any>),\n }\n\n const parsedRequestBodyProps =\n type !== 'get' ? JSON.parse(requestBody.content.schema.properties) : {}\n // Add requestBody for non-GET methods\n if (type !== 'get') {\n methodAcc[type].requestBody = {\n content: {\n [requestBody.content.contentType]: {\n schema: {\n ...requestBody.content.schema,\n properties: parsedRequestBodyProps,\n },\n },\n },\n }\n }\n\n return methodAcc\n },\n {} as Record<string, any>\n )\n\n return acc\n }, {} as OpenAPIFile['paths'])\n}\n"],"names":["resolveRef","ref","openApiJson","replace","split","reduce","obj","key","transformOpenApiObject","components","securitySchemes","authKey","_a","Object","keys","at","type","_d","_c","_b","assign","Public","scheme","tags","paths","transformPathsToArray","transformOpenApiObjectToOrigin","values","object","transformPathsArrayToOrigin","toLowerCase","in","entries","map","path","methods","method","methodProps","summary","responses","code","codeProps","contentType","content","headers","header","headerObj","schema","items","$ref","resolvedItemSchema","properties","JSON","stringify","_e","find","item","push","parameters","requestBody","reqSchema","requestBodyData","_f","validateBodyForResponse","parse","acc","methodAcc","rest","__rest","copiedRest","structuredClone","param","respAcc","formattedHeaders","value","description","required","parsedRequestBodyProps"],"mappings":"+DAIA,MAAMA,EAAa,CAACC,EAAaC,IACjBD,EAAIE,QAAQ,OAAQ,IAAIC,MAAM,KAC/BC,OAAO,CAACC,EAAKC,IAAQD,eAAAA,EAAMC,GAAML,GAGnCM,EAA0BN,gBACrC,GAAIA,EAAYO,YAAcP,EAAYO,WAAWC,gBAAiB,CACpE,MAAMC,EAA6D,QAAnDC,EAAAC,OAAOC,KAAKZ,EAAYO,WAAWC,wBAAgB,IAAAE,OAAA,EAAAA,EAAEG,GAAG,GACpEJ,IACFT,EAAYO,WAAWC,gBAAgBC,GAASK,KAChB,QADuBC,EACpC,QADoCC,EAAuB,QAAvBC,EAAAjB,aAAW,EAAXA,EAAaO,kBAAU,IAAAU,OAAA,EAAAA,EAC1ET,uBAAe,IAAAQ,OAAA,EAAAA,EAAGP,UAAU,IAAAM,OAAA,EAAAA,EAAAD,KAEnC,MACCd,EAAYO,WACVI,OAAAO,OAAA,CAAAV,gBAAiB,CACfW,OAAQ,CACNL,KAAM,OACNM,OAAQ,YAGRpB,EAAYO,YAAc,CAAA,GAQlC,OAJKP,EAAYqB,OACfrB,EAAYqB,KAAO,IAGdV,OAAAO,OAAAP,OAAAO,OAAA,CAAA,EACFlB,GAAW,CACdsB,M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,CACjCK,OAAMlC,OAAAO,OAAAP,OAAAO,OAAA,CAAA,EACDuC,EAAYhB,QAAQI,QACvB,CAAAI,WAAY0B,QAOfX,GAET,CAAyB,GAGpBD,GACN,CAA0B"}
|
|
1
|
+
{"version":3,"file":"layout.helper.js","sources":["../../../src/helpers/layout.helper.ts"],"sourcesContent":["import { TransformedPathsArray } from '@entities/layout.type'\nimport { OpenAPIFile, SecurityScheme } from '@entities/openApi'\nimport { TransformedOpenApi } from '@entities/transformedOpenApi'\n\nconst resolveRef = (ref: string, openApiJson: OpenAPIFile): Object => {\n const parts = ref.replace(/^#\\//, '').split('/')\n return parts.reduce((obj, key) => obj?.[key], openApiJson)\n}\n\nexport const transformOpenApiObject = (openApiJson: OpenAPIFile): TransformedOpenApi => {\n if (openApiJson.components && openApiJson.components.securitySchemes) {\n const authKey = Object.keys(openApiJson.components.securitySchemes)?.at(0)\n if (authKey) {\n openApiJson.components.securitySchemes[authKey].type = openApiJson?.components\n ?.securitySchemes?.[authKey]?.type as SecurityScheme['type']\n }\n } else {\n openApiJson.components = {\n securitySchemes: {\n Public: {\n type: 'http',\n scheme: 'public',\n },\n },\n ...(openApiJson.components || {}),\n }\n }\n\n if (!openApiJson.tags) {\n openApiJson.tags = []\n }\n\n return {\n ...openApiJson,\n paths: transformPathsToArray(openApiJson),\n } as TransformedOpenApi\n}\n\nexport const transformOpenApiObjectToOrigin = (values: TransformedOpenApi): OpenAPIFile => {\n const object = {\n ...values,\n paths: transformPathsArrayToOrigin(values.paths),\n }\n if (object.components && object.components.securitySchemes) {\n const authKey = Object.keys(object.components.securitySchemes)?.at(0)\n if (authKey) {\n if (object.components.securitySchemes[authKey].type.toLowerCase() == 'APIKEY'.toLowerCase()) {\n object.components.securitySchemes[authKey].in = object.components.securitySchemes[authKey]\n .in as SecurityScheme['in']\n }\n object.components.securitySchemes[authKey].type = object?.components?.securitySchemes?.[\n authKey\n ]?.type as SecurityScheme['type']\n }\n }\n return object\n}\n\nexport const transformPathsToArray = (openApiJson: OpenAPIFile): TransformedPathsArray | any => {\n const paths: OpenAPIFile['paths'] = openApiJson.paths\n const transformedPaths = Object.entries(paths).map(([path, methods]) => ({\n path,\n methods: Object.entries(methods).map(([method, methodProps]) => {\n const obj: any = {\n ...methodProps,\n type: method,\n tags: methodProps.tags || [],\n summary: methodProps.summary || '',\n responses: Object.entries(methodProps.responses).map(([code, codeProps]) => {\n const contentType = Object.keys(codeProps.content || {})[0]\n let headers = codeProps?.headers ?? {}\n\n // ? Fix headers with items property\n Object.keys(headers).map((header: string) => {\n let headerObj = headers[header]\n if (\n headerObj?.schema &&\n headerObj?.schema?.type &&\n headerObj?.schema?.type != 'array'\n ) {\n delete headers[header]?.schema?.items\n }\n })\n\n let schema = codeProps.content?.[contentType]?.schema\n if (schema?.$ref) {\n schema = resolveRef(schema?.$ref, openApiJson)\n } else if (schema?.type == 'array' && schema?.items?.$ref) {\n const resolvedItemSchema = resolveRef(schema.items.$ref, openApiJson)\n schema = {\n ...schema,\n items: resolvedItemSchema,\n }\n }\n\n return {\n code,\n headers,\n content: {\n contentType,\n schema: {\n ...schema,\n properties: JSON.stringify(schema?.properties || schema?.items?.properties),\n },\n },\n }\n }),\n }\n\n if (!obj.responses.find((item) => item.code == '200')) {\n obj.responses.push({\n code: '200',\n content: {\n contentType: 'application/json',\n schema: {},\n },\n headers: {},\n })\n }\n // Add parameters if it does not exist in the original JSON\n if (!methodProps?.parameters) {\n obj.parameters = []\n }\n\n // load response headers parameters\n\n if (method.toLowerCase() != 'get') {\n const contentType = Object.keys(methodProps?.requestBody?.content || {})[0]\n let reqSchema = methodProps?.requestBody?.content?.[contentType]?.schema\n\n if (reqSchema?.$ref) {\n reqSchema = resolveRef(reqSchema.$ref, openApiJson)\n } else if (reqSchema?.type === 'array' && reqSchema.items?.$ref) {\n reqSchema = {\n ...reqSchema,\n items: resolveRef(reqSchema.items.$ref, openApiJson),\n }\n }\n\n const requestBodyData = reqSchema\n ? {\n content: {\n contentType,\n schema: {\n ...reqSchema,\n properties: JSON.stringify(reqSchema?.properties || reqSchema?.items?.properties),\n },\n },\n }\n : {\n content: {\n contentType: 'application/json',\n schema: {\n properties: '{}',\n type: 'object',\n },\n },\n }\n\n obj['requestBody'] = requestBodyData\n }\n return obj\n }),\n }))\n\n return transformedPaths\n}\n\nconst validateBodyForResponse = (content, method) => {\n if (!(content?.schema as any) || !(content?.schema as any)?.properties) {\n return {}\n }\n let _content = JSON.parse((content?.schema as any)?.properties as string)\n\n return _content\n}\n\nexport const transformPathsArrayToOrigin = (paths: TransformedPathsArray): OpenAPIFile['paths'] => {\n return paths.reduce((acc, { path, methods }) => {\n acc[path] = methods.reduce(\n (methodAcc, { type, tags, responses, summary, requestBody, ...rest }) => {\n // Initialize the method object\n // ? Validate (rest) [parameters]\n let copiedRest = structuredClone(rest || {})\n if (copiedRest && copiedRest.parameters) {\n copiedRest.parameters.map((param) => {\n if (param && param?.schema?.items && param?.schema?.items?.type == 'array') {\n param.schema.items.items = {}\n }\n return param\n })\n }\n\n // Get the original responses from the rest object\n const originalResponses = rest.responses || {}\n\n methodAcc[type] = {\n ...copiedRest,\n tags,\n summary,\n responses: responses.reduce((respAcc, { code, content, headers }) => {\n // Skip if:\n // 1. This is a new code (not in original) AND\n // 2. Both headers and content are empty\n const isNewCode = !originalResponses[code]\n const hasHeaders = Object.keys(headers || {}).length > 0\n const hasContent =\n Object.keys(validateBodyForResponse(content || {}, type) || {}).length > 0\n\n if (isNewCode && !hasHeaders && !hasContent) {\n return respAcc\n }\n\n const formattedHeaders: Record<string, any> = {}\n if (headers) {\n for (const [key, value] of Object.entries(headers)) {\n formattedHeaders[key] = {\n description: value.description || '',\n required: value.required || false,\n schema: value.schema || {},\n }\n }\n }\n respAcc[code] = {\n description: 'Success', // Assuming this is static from the original data\n content: content.contentType\n ? {\n [content.contentType]: {\n schema: {\n ...(content.schema as object),\n properties: validateBodyForResponse(content, type),\n },\n },\n }\n : originalResponses[code]?.content || {},\n headers: formattedHeaders,\n }\n return respAcc\n }, {} as Record<string, any>),\n }\n\n const parsedRequestBodyProps =\n type !== 'get' ? JSON.parse(requestBody.content.schema.properties) : {}\n // Add requestBody for non-GET methods\n if (type !== 'get') {\n methodAcc[type].requestBody = {\n content: {\n [requestBody.content.contentType]: {\n schema: {\n ...requestBody.content.schema,\n properties: parsedRequestBodyProps,\n },\n },\n },\n }\n }\n\n return methodAcc\n },\n {} as Record<string, any>\n )\n\n return acc\n }, {} as OpenAPIFile['paths'])\n}\n"],"names":["resolveRef","ref","openApiJson","replace","split","reduce","obj","key","transformOpenApiObject","components","securitySchemes","authKey","_a","Object","keys","at","type","_d","_c","_b","assign","Public","scheme","tags","paths","transformPathsToArray","transformOpenApiObjectToOrigin","values","object","transformPathsArrayToOrigin","toLowerCase","in","entries","map","path","methods","method","methodProps","summary","responses","code","codeProps","contentType","content","headers","header","headerObj","schema","items","$ref","resolvedItemSchema","properties","JSON","stringify","_e","find","item","push","parameters","requestBody","reqSchema","requestBodyData","_f","validateBodyForResponse","parse","acc","methodAcc","rest","__rest","copiedRest","structuredClone","param","originalResponses","respAcc","isNewCode","hasHeaders","length","hasContent","formattedHeaders","value","description","required","parsedRequestBodyProps"],"mappings":"+DAIA,MAAMA,EAAa,CAACC,EAAaC,IACjBD,EAAIE,QAAQ,OAAQ,IAAIC,MAAM,KAC/BC,OAAO,CAACC,EAAKC,IAAQD,eAAAA,EAAMC,GAAML,GAGnCM,EAA0BN,gBACrC,GAAIA,EAAYO,YAAcP,EAAYO,WAAWC,gBAAiB,CACpE,MAAMC,EAA6D,QAAnDC,EAAAC,OAAOC,KAAKZ,EAAYO,WAAWC,wBAAgB,IAAAE,OAAA,EAAAA,EAAEG,GAAG,GACpEJ,IACFT,EAAYO,WAAWC,gBAAgBC,GAASK,KAChB,QADuBC,EACpC,QADoCC,EAAuB,QAAvBC,EAAAjB,aAAW,EAAXA,EAAaO,kBAAU,IAAAU,OAAA,EAAAA,EAC1ET,uBAAe,IAAAQ,OAAA,EAAAA,E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,GAAO,CACtByE,YAAaD,EAAMC,aAAe,GAClCC,SAAUF,EAAME,WAAY,EAC5BlC,OAAQgC,EAAMhC,QAAU,CAAE,GAkBhC,OAdA0B,EAAQjC,GAAQ,CACdwC,YAAa,UACbrC,QAASA,EAAQD,YACb,CACE,CAACC,EAAQD,aAAc,CACrBK,OACMlC,OAAAO,OAAAP,OAAAO,OAAA,CAAA,EAAAuB,EAAQI,QACZ,CAAAI,WAAYY,EAAwBpB,QAInB,QAAvB/B,EAAA4D,EAAkBhC,UAAK,IAAA5B,OAAA,EAAAA,EAAE+B,UAAW,CAAE,EAC1CC,QAASkC,GAEJL,GACN,CAAA,KAGL,MAAMS,EACK,QAATlE,EAAiBoC,KAAKY,MAAML,EAAYhB,QAAQI,OAAOI,YAAc,CAAA,EAevE,MAba,QAATnC,IACFkD,EAAUlD,GAAM2C,YAAc,CAC5BhB,QAAS,CACP,CAACgB,EAAYhB,QAAQD,aAAc,CACjCK,OAAMlC,OAAAO,OAAAP,OAAAO,OAAA,CAAA,EACDuC,EAAYhB,QAAQI,QACvB,CAAAI,WAAY+B,QAOfhB,GAET,CAAyB,GAGpBD,GACN,CAA0B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"../../../../_virtual/jsx-runtime.js";import{useState as
|
|
1
|
+
import{j as e}from"../../../../_virtual/jsx-runtime.js";import{useEffect as s,useState as o}from"react";import l from"../Codebox/Codebox.js";import{d as i}from"../../../../_virtual/index3.js";import{handleStatusColor as d}from"../../../helpers/methodAccordion.helper.js";import t from"./style.module.scss.js";const n=({data:n})=>{var a,r;const c=Object.keys((null==n?void 0:n.responses)||{}).filter(e=>{var s,o,l;const i=n.responses[e],d=Object.keys((null==i?void 0:i.content)||{})[0];return null===(l=null===(o=null===(s=null==i?void 0:i.content)||void 0===s?void 0:s[d])||void 0===o?void 0:o.schema)||void 0===l?void 0:l.properties}),u=c.map(s=>({label:e.jsxs("div",{className:t.statusCodeOptionContainer,children:[e.jsx("div",{className:t.statusCodeOptionCircle,style:{backgroundColor:d(s)}}),e.jsx("span",{children:s})]}),value:String(s)}));s(()=>{m(c.includes("200")?u.find(e=>"200"===e.value):u[0]||null)},[n]);const[v,m]=o(u[4]),p=Object.entries(n.responses).map(([e,s])=>({code:e,data:s})).find(e=>e.code===(null==v?void 0:v.value));return e.jsxs("aside",{className:t.apiDocsAside,children:[e.jsx("h2",{className:t.apiDocsAside_title,children:n.summary}),e.jsxs("h4",{className:t.apiDocsAside_subtitle,children:[e.jsx("span",{className:t.apiDocsAside_subtitle_method,"data-method":n.method,children:n.method})," ",e.jsx("span",{children:n.path})]}),!["delete","get"].includes(n.method)&&(null===(a=null==n?void 0:n.requestBody)||void 0===a?void 0:a.content)&&e.jsxs("div",{className:t.codeboxSection,children:[e.jsx("div",{className:t.codeboxHeader,children:e.jsx("h6",{className:t.codeboxTitle,children:"Request"})}),e.jsx(l,{code:(()=>{var e,s,o,l,i;if(null===(e=null==n?void 0:n.requestBody)||void 0===e?void 0:e.content){const e=Object.keys(null===(s=null==n?void 0:n.requestBody)||void 0===s?void 0:s.content)[0];return JSON.stringify(null===(i=null===(l=null===(o=null==n?void 0:n.requestBody)||void 0===o?void 0:o.content[e])||void 0===l?void 0:l.schema)||void 0===i?void 0:i.properties,null,2)}return"{}"})()})]}),(null===(r=Object.keys((null==n?void 0:n.responses)||{}))||void 0===r?void 0:r.length)>0&&e.jsxs("div",{className:t.codeboxSection,children:[e.jsxs("div",{className:`${t.codeboxHeader}`,children:[e.jsx("h6",{className:t.codeboxTitle,children:"Response"}),e.jsx(i.SelectGroup,{size:"small",withSearch:!1,isMultiple:!1,clearable:!1,placeholder:"200",options:[{list:u}],value:v,onChange:e=>{m(e)}})]}),e.jsx(l,{code:(()=>{var e,s,o,l;if(null==p?void 0:p.data){const i=Object.keys(null===(e=p.data)||void 0===e?void 0:e.content)[0];return JSON.stringify(null===(l=null===(o=null===(s=p.data)||void 0===s?void 0:s.content[i])||void 0===o?void 0:o.schema)||void 0===l?void 0:l.properties,null,2)}return"{}"})()})]})]})};export{n as default};
|
|
2
2
|
//# sourceMappingURL=DocsAside.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocsAside.js","sources":["../../../../../src/layout/docsComponents/DocsAside/DocsAside.tsx"],"sourcesContent":["import React, { useState } from 'react'\nimport { EndpointData } from 'src/layout/docsLayout'\nimport Codebox from '../Codebox/Codebox'\nimport { Option, SelectGroup } from 'digitinary-ui'\nimport { httpStatusCodes } from '../../../constants/index'\nimport { handleStatusColor } from '../../../helpers/methodAccordion.helper'\nimport styles from './style.module.scss'\n\nconst
|
|
1
|
+
{"version":3,"file":"DocsAside.js","sources":["../../../../../src/layout/docsComponents/DocsAside/DocsAside.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { EndpointData } from 'src/layout/docsLayout'\nimport Codebox from '../Codebox/Codebox'\nimport { Option, SelectGroup } from 'digitinary-ui'\nimport { httpStatusCodes } from '../../../constants/index'\nimport { handleStatusColor } from '../../../helpers/methodAccordion.helper'\nimport styles from './style.module.scss'\n\nconst DocsAside = ({ data }: { data: EndpointData }) => {\n // Filter status codes to only include those with non-empty properties\n const filteredStatusCodes = Object.keys(data?.responses || {}).filter((code) => {\n const response = data.responses[code]\n const contentType = Object.keys(response?.content || {})[0]\n return response?.content?.[contentType]?.schema?.properties\n })\n\n // Create options for the select dropdown\n const httpStatusCodeOptions = filteredStatusCodes.map((code) => ({\n label: (\n <div className={styles.statusCodeOptionContainer}>\n <div\n className={styles.statusCodeOptionCircle}\n style={{ backgroundColor: handleStatusColor(code) }}\n ></div>\n <span>{code}</span>\n </div>\n ),\n value: String(code),\n }))\n\n // Function to get default option\n const getDefaultOption = () => {\n const has200 = filteredStatusCodes.includes('200')\n return has200\n ? httpStatusCodeOptions.find((opt) => opt.value === '200')\n : httpStatusCodeOptions[0] || null\n }\n\n useEffect(() => {\n setSelectedResStatusCode(getDefaultOption())\n }, [data])\n const [selectedResStatusCode, setSelectedResStatusCode] = useState(httpStatusCodeOptions[4])\n const currentResponse = Object.entries(data.responses)\n .map(([code, data]) => ({ code, data }))\n .find((res) => res.code === selectedResStatusCode?.value)\n\n const stringifyRequestBody = () => {\n if (data?.requestBody?.content) {\n const contentKey = Object.keys(data?.requestBody?.content)[0]\n return JSON.stringify(data?.requestBody?.content[contentKey]?.schema?.properties, null, 2)\n } else {\n return '{}'\n }\n }\n\n const stringifyResponseBody = () => {\n if (currentResponse?.data) {\n const contentKey = Object.keys(currentResponse.data?.content)[0]\n return JSON.stringify(currentResponse.data?.content[contentKey]?.schema?.properties, null, 2)\n } else {\n return '{}'\n }\n }\n\n return (\n <aside className={styles.apiDocsAside}>\n <h2 className={styles.apiDocsAside_title}>{data.summary}</h2>\n <h4 className={styles.apiDocsAside_subtitle}>\n <span className={styles.apiDocsAside_subtitle_method} data-method={data.method}>\n {data.method}\n </span>{' '}\n <span>{data.path}</span>\n </h4>\n {!['delete', 'get'].includes(data.method) && data?.requestBody?.content && (\n <div className={styles.codeboxSection}>\n <div className={styles.codeboxHeader}>\n <h6 className={styles.codeboxTitle}>Request</h6>\n </div>\n\n <Codebox code={stringifyRequestBody()} />\n </div>\n )}\n {Object.keys(data?.responses || {})?.length > 0 && (\n <div className={styles.codeboxSection}>\n <div className={`${styles.codeboxHeader}`}>\n <h6 className={styles.codeboxTitle}>Response</h6>\n <SelectGroup\n size=\"small\"\n withSearch={false}\n isMultiple={false}\n clearable={false}\n placeholder=\"200\"\n options={[\n {\n list: httpStatusCodeOptions,\n },\n ]}\n value={selectedResStatusCode}\n onChange={(value) => {\n setSelectedResStatusCode(value)\n }}\n />\n </div>\n\n <Codebox code={stringifyResponseBody()} />\n </div>\n )}\n </aside>\n )\n}\n\nexport default DocsAside\n"],"names":["DocsAside","data","filteredStatusCodes","Object","keys","responses","filter","code","response","contentType","content","_b","_a","schema","_c","properties","httpStatusCodeOptions","map","label","_jsxs","className","styles","statusCodeOptionContainer","children","_jsx","statusCodeOptionCircle","style","backgroundColor","handleStatusColor","value","String","useEffect","setSelectedResStatusCode","includes","find","opt","selectedResStatusCode","useState","currentResponse","entries","res","jsxs","apiDocsAside","apiDocsAside_title","summary","apiDocsAside_subtitle","apiDocsAside_subtitle_method","method","path","requestBody","codeboxSection","codeboxHeader","codeboxTitle","jsx","Codebox","contentKey","JSON","stringify","_e","_d","stringifyRequestBody","length","SelectGroup","size","withSearch","isMultiple","clearable","placeholder","options","list","onChange","stringifyResponseBody"],"mappings":"qTAQA,MAAMA,EAAY,EAAGC,mBAEnB,MAAMC,EAAsBC,OAAOC,MAAKH,aAAI,EAAJA,EAAMI,YAAa,CAAE,GAAEC,OAAQC,cACrE,MAAMC,EAAWP,EAAKI,UAAUE,GAC1BE,EAAcN,OAAOC,MAAKI,eAAAA,EAAUE,UAAW,CAAE,GAAE,GACzD,OAA+C,kBAAxCC,UAAAC,EAAAJ,aAAA,EAAAA,EAAUE,8BAAUD,yBAAcI,cAAM,IAAAC,OAAA,EAAAA,EAAEC,aAI7CC,EAAwBd,EAAoBe,IAAKV,IAAU,CAC/DW,MACEC,EAAAA,KAAK,MAAA,CAAAC,UAAWC,EAAOC,0BAAyBC,SAAA,CAC9CC,EAAAA,IACE,MAAA,CAAAJ,UAAWC,EAAOI,uBAClBC,MAAO,CAAEC,gBAAiBC,EAAkBrB,MAE9CiB,MAAA,OAAA,CAAAD,SAAOhB,OAGXsB,MAAOC,OAAOvB,MAWhBwB,EAAU,KACRC,EAPe9B,EAAoB+B,SAAS,OAExCjB,EAAsBkB,KAAMC,GAAsB,QAAdA,EAAIN,OACxCb,EAAsB,IAAM,OAK/B,CAACf,IACJ,MAAOmC,EAAuBJ,GAA4BK,EAASrB,EAAsB,IACnFsB,EAAkBnC,OAAOoC,QAAQtC,EAAKI,WACzCY,IAAI,EAAEV,EAAMN,MAAK,CAAQM,OAAMN,UAC/BiC,KAAMM,GAAQA,EAAIjC,QAAS6B,aAAA,EAAAA,EAAuBP,QAoBrD,OACEV,EAAOsB,KAA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EAAAsB,KAAA,MAAA,CAAKrB,UAAW,GAAGC,EAAO8B,gBACxB5B,SAAA,CAAAC,EAAAA,IAAA,KAAA,CAAIJ,UAAWC,EAAO+B,aAAY7B,SAAA,aAClCC,EAAC6B,IAAAS,EAAWA,aACVC,KAAK,QACLC,YAAY,EACZC,YAAY,EACZC,WAAW,EACXC,YAAY,MACZC,QAAS,CACP,CACEC,KAAMrD,IAGVa,MAAOO,EACPkC,SAAWzC,IACTG,EAAyBH,SAK/BL,EAAA6B,IAACC,EAAQ,CAAA/C,KAjDa,kBAC5B,GAAI+B,aAAe,EAAfA,EAAiBrC,KAAM,CACzB,MAAMsD,EAAapD,OAAOC,aAAKQ,EAAA0B,EAAgBrC,2BAAMS,SAAS,GAC9D,OAAO8C,KAAKC,UAA6D,QAAnDE,EAA2C,UAArB,QAAtBhD,EAAA2B,EAAgBrC,YAAM,IAAAU,OAAA,EAAAA,EAAAD,QAAQ6C,UAAa,IAAAzC,OAAA,EAAAA,EAAAD,cAAQ,IAAA8C,OAAA,EAAAA,EAAA5C,WAAY,KAAM,EAC5F,CACC,MAAO,MA4CYwD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"../../../../../_virtual/jsx-runtime.js";import s from"../../../../components/SVGLoader/SVGLoader.js";import l from"../../../../assets/icons/DownArrow.svg.js";import i from"../../../../assets/icons/RequestOption.svg.js";import a from"../../../../assets/icons/ArrowBack.svg.js";import o from"../../../../assets/icons/arrow-down.svg.js";import d from"../../../../assets/icons/newCopyIcon.svg.js";import r from"../../../../assets/icons/arrow-up.svg.js";import{d as
|
|
1
|
+
import{j as e}from"../../../../../_virtual/jsx-runtime.js";import s from"../../../../components/SVGLoader/SVGLoader.js";import l from"../../../../assets/icons/DownArrow.svg.js";import i from"../../../../assets/icons/RequestOption.svg.js";import a from"../../../../assets/icons/ArrowBack.svg.js";import o from"../../../../assets/icons/arrow-down.svg.js";import d from"../../../../assets/icons/newCopyIcon.svg.js";import r from"../../../../assets/icons/arrow-up.svg.js";import{d as n}from"../../../../../_virtual/index3.js";import{useState as t,useEffect as c,useMemo as v}from"react";import{handleStatusColor as h}from"../../../../helpers/methodAccordion.helper.js";import m from"../../../../components/Tooltip/Tooltip.js";import{useSectionToggle as u,SectionEnum as p}from"../../../../context/SectionToggleContext.js";import{copyToClipboard as j,capitalizeFirstLetter as x}from"../../../../utils/index.js";const b=({data:b,setActiveType:N,setActiveItemData:y})=>{var f,g,C,w,k,O,S,q;const[T,R]=t("header"),{toggleSection:$}=u(),[A,E]=t((null===(C=null===(g=null===(f=null==b?void 0:b.api)||void 0===f?void 0:f.servers)||void 0===g?void 0:g[0])||void 0===C?void 0:C.url)||""),[L,I]=t(!1);c(()=>{var e,s,l;E((null===(l=null===(s=null===(e=null==b?void 0:b.api)||void 0===e?void 0:e.servers)||void 0===s?void 0:s[0])||void 0===l?void 0:l.url)||"")},[b]),v(()=>{var e,s,l;const i=null===(l=null===(s=null===(e=b.api)||void 0===e?void 0:e.servers)||void 0===s?void 0:s.filter(e=>"/"!==e.url)[0])||void 0===l?void 0:l.url,a=null==b?void 0:b.path.split("/").slice(2);return`${i}${(null==a?void 0:a.length)?"/"+a.join("/"):""}`},[b]);const V=Object.keys((null==b?void 0:b.responses)||{}).filter(e=>{var s,l,i;const a=b.responses[e];return null===(i=null===(l=null===(s=null==a?void 0:a.content)||void 0===s?void 0:s["application/json"])||void 0===l?void 0:l.schema)||void 0===i?void 0:i.properties}),z=V.map(s=>({label:e.jsxs("div",{className:"statusCodeOptionContainer",children:[e.jsx("div",{className:"statusCodeOptionCircle",style:{backgroundColor:h(s)}}),e.jsx("span",{children:s})]}),value:s})),D=()=>V.includes("200")?z.find(e=>"200"===e.value):z[0]||null,[_,B]=t(null),[G,H]=t(D()),[P,U]=t({});return((null==b?void 0:b.parameters)||[]).filter(e=>{var s;return(null===(s=e.in)||void 0===s?void 0:s.toLowerCase())===T.toLowerCase()}),c(()=>{H(D())},[b]),c(()=>{if(G&&G.value){const e=null==b?void 0:b.responses[G.value];U(null==e?void 0:e.headers)}},[G,null==b?void 0:b.responses]),e.jsxs("div",{className:"api-details-expanded",children:[e.jsxs("div",{className:"test-button",children:[e.jsx("button",{className:"back-button",onClick:()=>{$(b.api.apiSpecId,[{type:p.OVERVIEW,setTo:!0}],{resetOthers:!0,filterKeys:[p.RESOURCE]}),N("OVERVIEW"),y(b.api)},children:e.jsx(s,{src:a})}),e.jsx(m,{content:"Comming soon",children:e.jsx("button",{className:"disabled",children:"Test"})})]}),e.jsx("h3",{children:b.api.title}),e.jsx("h1",{className:"api-title",children:null==b?void 0:b.summary}),e.jsxs("div",{className:"url-box",children:[L&&0!==A.length&&e.jsx("div",{className:"url-list",children:null===(k=null===(w=b.api)||void 0===w?void 0:w.servers)||void 0===k?void 0:k.map((s,l)=>e.jsxs("div",{className:"url-item",onClick:()=>{E(s.url),I(!1)},children:[e.jsx("input",{type:"radio",name:"api-method",checked:A===s.url,readOnly:!0}),e.jsx("span",{children:`${s.url}${b.path}`})]},l))}),e.jsxs("div",{className:"url-box_text-container",children:[e.jsx("span",{className:`method-label ${null===(O=null==b?void 0:b.method)||void 0===O?void 0:O.toLowerCase()}`,children:b.method}),e.jsx("div",{className:"url-container",children:e.jsxs("div",{className:"type-ddl",onClick:()=>I(e=>!e),children:[e.jsx("span",{className:"url-text",children:`${A}${b.path}`}),e.jsxs("div",{className:"icon-container",children:[e.jsx(s,{className:"icon",role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),j(`${A}${b.path}`)},src:d}),0!==A.length&&e.jsx(s,{src:L?r:o})]})]})})]})]}),e.jsx("p",{className:"api-desc",children:(null==b?void 0:b.description)||"No Description"}),e.jsx("h3",{children:"Request"}),e.jsxs("div",{className:"request-section",children:[e.jsx("div",{className:"request-tabs",children:["header","path","query"].map(l=>e.jsxs("button",{className:"tab "+(T===l?"active":""),onClick:()=>R(l),children:[e.jsx(s,{src:i,className:"icon-left"}),e.jsx("span",{className:"tab-label",children:"requestBody"===l?"Request Body":l.charAt(0).toUpperCase()+l.slice(1)})]},l))}),e.jsx("div",{className:"table-wrapper",children:e.jsxs("table",{className:"param-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"head-table-label",children:"Parameter Name"}),e.jsx("th",{className:"head-table-label",children:"Required"}),e.jsx("th",{className:"head-table-label",children:"Type"}),e.jsx("th",{className:"head-table-label",children:"Enum"}),e.jsx("th",{className:"head-table-label",children:"Description"})]})}),e.jsx("tbody",{children:null===(S=b.parameters)||void 0===S?void 0:S.filter(e=>{var s;return(null===(s=e.in)||void 0===s?void 0:s.toLowerCase())===T.toLowerCase()}).map((i,a)=>{var o,d,r,n,t,c,v;return e.jsxs("tr",{children:[e.jsx("td",{children:i.name}),e.jsx("td",{children:i.required?"True":"False"}),e.jsxs("td",{style:{textTransform:"capitalize"},children:[e.jsx("span",{children:(null===(o=null==i?void 0:i.schema)||void 0===o?void 0:o.type)||"-"}),"array"===(null===(d=null==i?void 0:i.schema)||void 0===d?void 0:d.type)&&(null===(n=null===(r=null==i?void 0:i.schema)||void 0===r?void 0:r.items)||void 0===n?void 0:n.type)&&e.jsxs("span",{style:{color:"#616874",fontSize:"0.75rem"},children:["_",x(null===(c=null===(t=i.schema)||void 0===t?void 0:t.items)||void 0===c?void 0:c.type)]})]}),e.jsx("td",{children:Array.isArray(null===(v=i.schema)||void 0===v?void 0:v.enum)?i.schema.enum.join(" / "):"-"}),e.jsxs("td",{className:"desc-cell",children:[e.jsx("div",{className:"desc-text "+(_===a?"expanded":""),children:i.description||"No description"}),e.jsx("button",{className:"desc-toggle",onClick:()=>B(_===a?null:a),children:e.jsx(s,{src:l,className:_===a?"rotated":""})})]})]},a)})})]})})]}),e.jsxs("div",{className:"response-section",children:[e.jsx("h3",{children:"Response"}),e.jsxs("div",{children:[e.jsx("div",{style:{height:"0.5rem",width:"7.5rem",marginLeft:"auto"},children:(null===(q=Object.keys((null==b?void 0:b.responses)||{}))||void 0===q?void 0:q.length)>0&&e.jsx("div",{className:"codeboxSection",children:e.jsx("div",{className:"codeboxHeader",children:e.jsx(n.SelectGroup,{size:"small",withSearch:!1,isMultiple:!1,clearable:!1,placeholder:"200",options:[{list:z}],value:G,onChange:e=>{H(e)}})})})}),e.jsxs("button",{className:"tab active ",children:[e.jsx(s,{src:i,className:"icon-left"}),"Header"]})]}),e.jsx("div",{className:"table-wrapper",children:e.jsxs("table",{className:"param-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"head-table-label",children:"Header Name"}),e.jsx("th",{className:"head-table-label",children:"Required"}),e.jsx("th",{className:"head-table-label",children:"Type"}),e.jsx("th",{className:"head-table-label",children:"Enum"}),e.jsx("th",{className:"head-table-label",children:"Description"})]})}),e.jsx("tbody",{children:!!P&&Object.keys(P)&&Object.keys(P).map(s=>{var l,i,a,o,d,r,n,t,c,v,h,m,u,p,j;return e.jsxs("tr",{children:[e.jsx("td",{children:s}),e.jsx("td",{children:null===(l=P[s])||void 0===l?void 0:l.required.toString()}),e.jsxs("td",{style:{textTransform:"capitalize"},children:[e.jsx("span",{children:(null===(a=null===(i=P[s])||void 0===i?void 0:i.schema)||void 0===a?void 0:a.type)||"-"}),"array"===(null===(d=null===(o=P[s])||void 0===o?void 0:o.schema)||void 0===d?void 0:d.type)&&(null===(t=null===(n=null===(r=P[s])||void 0===r?void 0:r.schema)||void 0===n?void 0:n.items)||void 0===t?void 0:t.type)&&e.jsxs("span",{style:{color:"#616874",fontSize:"0.75rem"},children:["_",x(null===(h=null===(v=null===(c=P[s])||void 0===c?void 0:c.schema)||void 0===v?void 0:v.items)||void 0===h?void 0:h.type)]})]}),e.jsx("td",{children:null===(p=null===(u=null===(m=P[s])||void 0===m?void 0:m.schema)||void 0===u?void 0:u.enum)||void 0===p?void 0:p.join("/")}),e.jsx("td",{children:null===(j=P[s])||void 0===j?void 0:j.description})]})})})]})})]})]})};export{b as EndpointPage};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/layout/docsComponents/DocsContent/EndpointPage/index.tsx"],"sourcesContent":["import SVGLoader from '../../../../components/SVGLoader/SVGLoader'\nimport {\n ArrowBack,\n arrowDown,\n arrowUp,\n DownArrowIcon,\n newCopyIcon,\n RequestOption,\n} from '../../../../assets/icons/index'\nimport { SelectGroup } from 'digitinary-ui'\nimport { useEffect, useMemo, useState } from 'react'\nimport { EndpointData, OverviewData } from 'src/layout/docsLayout'\nimport { handleStatusColor } from '../../../../helpers/methodAccordion.helper'\nimport { httpStatusCodes } from '../../../../constants/index'\nimport styles from '../../Codebox/style.module.scss'\nimport Tooltip from '../../../../components/Tooltip/Tooltip'\nimport './style.scss'\nimport { SectionEnum, useSectionToggle } from '../../../../../src/context/SectionToggleContext'\nimport { capitalizeFirstLetter, copyToClipboard } from '../../../../../src/utils'\n\nexport const EndpointPage = ({\n data,\n setActiveType,\n setActiveItemData,\n}: {\n data: EndpointData\n setActiveType: React.Dispatch<React.SetStateAction<'OVERVIEW' | 'ENDPOINT'>>\n setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>\n}) => {\n const [activeTab, setActiveTab] = useState('header')\n const { toggleSection } = useSectionToggle()\n const [selectedUrl, setSelectedUrl] = useState(data?.api?.servers?.[0]?.url || '')\n const [isUrlDropdownOpen, setIsUrlDropdownOpen] = useState<boolean>(false)\n\n useEffect(() => {\n setSelectedUrl(data?.api?.servers?.[0]?.url || '')\n }, [data])\n\n const fullUrl = useMemo(() => {\n // env gateway url + api version(if appended) + context path\n const url = data.api?.servers?.filter((s) => s.url !== '/')[0]?.url\n const pathParts = data?.path.split('/').slice(2) // slice from index 2 to skip the first empty \"\" and \"comments\"\n const fullPath = !!pathParts?.length ? '/' + pathParts.join('/') : '' // this will contain the full path without the context path\n return `${url}${fullPath}`\n }, [data])\n\n const httpStatusCodeOptions = httpStatusCodes.map((code) => ({\n label: (\n <div className={'statusCodeOptionContainer'}>\n <div\n className={'statusCodeOptionCircle'}\n style={{ backgroundColor: handleStatusColor(code) }}\n ></div>\n <span>{code}</span>\n </div>\n ),\n value: code,\n }))\n\n const [expanded, setExpanded] = useState(null)\n const [selectedResStatusCode, setSelectedResStatusCode] = useState(httpStatusCodeOptions[4])\n const [headersList, setHeadersList] = useState({})\n const requestTableData = (data?.parameters || []).filter(\n (param) => param.in?.toLowerCase() === activeTab.toLowerCase()\n )\n\n useEffect(() => {\n if (selectedResStatusCode && selectedResStatusCode.value) {\n const headerObj = data?.responses[selectedResStatusCode.value]\n setHeadersList(headerObj?.headers)\n }\n }, [selectedResStatusCode, data?.responses])\n\n // ? TODO: 'body' should be returned after discussing with PO\n\n return (\n <div className=\"api-details-expanded\">\n <div className=\"test-button\">\n <button\n className=\"back-button\"\n onClick={() => {\n toggleSection(data.api.apiSpecId, [{ type: SectionEnum.OVERVIEW, setTo: true }], {\n resetOthers: true,\n filterKeys: [SectionEnum.RESOURCE],\n })\n setActiveType('OVERVIEW')\n setActiveItemData(data.api)\n }}\n >\n <SVGLoader src={ArrowBack} />\n </button>\n\n <Tooltip content=\"Comming soon\">\n <button className=\"disabled\">Test</button>\n </Tooltip>\n </div>\n <h3>{data.api.title}</h3>\n <h1 className=\"api-title\">{data?.summary}</h1>\n <div className=\"url-box\">\n {isUrlDropdownOpen && selectedUrl.length !== 0 && (\n <div className=\"url-list\">\n {data.api?.servers?.map((server, index) => (\n <div\n key={index}\n className=\"url-item\"\n onClick={() => {\n setSelectedUrl(server.url)\n setIsUrlDropdownOpen(false)\n }}\n >\n <input\n type=\"radio\"\n name=\"api-method\"\n checked={selectedUrl === server.url}\n readOnly\n />\n <span>{`${server.url}${data.path}`}</span>\n </div>\n ))}\n </div>\n )}\n <div className=\"url-box_text-container\">\n <span className={`method-label ${data?.method?.toLowerCase()}`}>{data.method}</span>\n <div className=\"url-container\">\n <div className=\"type-ddl\" onClick={() => setIsUrlDropdownOpen((prev) => !prev)}>\n <span className=\"url-text\">{`${selectedUrl}${data.path}`}</span>\n <div className=\"icon-container\">\n <SVGLoader\n className=\"icon\"\n role=\"button\"\n tabIndex={0}\n onClick={(e) => {\n e.stopPropagation()\n copyToClipboard(`${selectedUrl}${data.path}`)\n }}\n src={newCopyIcon}\n />\n {selectedUrl.length !== 0 && (\n <SVGLoader src={!isUrlDropdownOpen ? arrowDown : arrowUp} />\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <p className=\"api-desc\">{data?.description || 'No Description'}</p>\n\n <h3>Request</h3>\n\n <div className=\"request-section\">\n <div className=\"request-tabs\">\n {['header', 'path', 'query'].map((tab) => (\n <button\n key={tab}\n className={`tab ${activeTab === tab ? 'active' : ''}`}\n onClick={() => setActiveTab(tab)}\n >\n <SVGLoader src={RequestOption} className=\"icon-left\" />\n <span className=\"tab-label\">\n {tab === 'requestBody'\n ? 'Request Body'\n : tab.charAt(0).toUpperCase() + tab.slice(1)}\n </span>\n </button>\n ))}\n </div>\n\n {\n <div className=\"table-wrapper\">\n <table className=\"param-table\">\n <thead>\n <tr>\n <th className=\"head-table-label\">Parameter Name</th>\n <th className=\"head-table-label\">Required</th>\n <th className=\"head-table-label\">Type</th>\n <th className=\"head-table-label\">Enum</th>\n <th className=\"head-table-label\">Description</th>\n </tr>\n </thead>\n <tbody>\n {data.parameters\n ?.filter((p) => p.in?.toLowerCase() === activeTab.toLowerCase())\n .map((row, index) => (\n <tr key={index}>\n <td>{row.name}</td>\n <td>{row.required ? 'True' : 'False'}</td>\n <td style={{ textTransform: 'capitalize' }}>\n <span>{row?.schema?.type || '-'}</span>\n {row?.schema?.type === 'array' && row?.schema?.items?.type && (\n <span style={{ color: '#616874', fontSize: '0.75rem' }}>\n _{capitalizeFirstLetter(row.schema?.items?.type)}\n </span>\n )}\n </td>\n <td>{Array.isArray(row.schema?.enum) ? row.schema.enum.join(' / ') : '-'}</td>\n <td className=\"desc-cell\">\n <div className={`desc-text ${expanded === index ? 'expanded' : ''}`}>\n {row.description || 'No description'}\n </div>\n <button\n className=\"desc-toggle\"\n onClick={() => setExpanded(expanded === index ? null : index)}\n >\n <SVGLoader\n src={DownArrowIcon}\n className={expanded === index ? 'rotated' : ''}\n />\n </button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n }\n </div>\n\n <div className=\"response-section\">\n <h3>Response</h3>\n\n <div>\n <div style={{ height: '0.5rem', width: '7.5rem', marginLeft: 'auto' }}>\n {Object.keys(data?.responses || {})?.length > 0 && (\n <div className={'codeboxSection'}>\n <div className={`${'codeboxHeader'}`}>\n <SelectGroup\n size=\"small\"\n withSearch={false}\n isMultiple={false}\n clearable={false}\n placeholder=\"200\"\n options={[\n {\n list: httpStatusCodeOptions,\n },\n ]}\n value={selectedResStatusCode}\n onChange={(value) => {\n setSelectedResStatusCode(value)\n }}\n />\n </div>\n </div>\n )}\n </div>\n <button className=\"tab active \">\n <SVGLoader src={RequestOption} className=\"icon-left\" />\n Header\n </button>\n </div>\n\n <div className=\"table-wrapper\">\n <table className=\"param-table\">\n <thead>\n <tr>\n <th className=\"head-table-label\">Header Name</th>\n <th className=\"head-table-label\">Required</th>\n <th className=\"head-table-label\">Type</th>\n <th className=\"head-table-label\">Enum</th>\n <th className=\"head-table-label\">Description</th>\n </tr>\n </thead>\n <tbody>\n {!!headersList &&\n Object.keys(headersList) &&\n Object.keys(headersList).map((key) => (\n <tr>\n <td>{key}</td>\n <td>{headersList[key]?.required.toString()}</td>\n <td style={{ textTransform: 'capitalize' }}>\n <span>{headersList[key]?.schema?.type || '-'}</span>\n {headersList[key]?.schema?.type === 'array' &&\n headersList[key]?.schema?.items?.type && (\n <span style={{ color: '#616874', fontSize: '0.75rem' }}>\n _{capitalizeFirstLetter(headersList[key]?.schema?.items?.type)}\n </span>\n )}\n </td>\n <td>{headersList[key]?.schema?.enum?.join('/')}</td>\n <td>{headersList[key]?.description}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n </div>\n )\n}\n"],"names":["EndpointPage","data","setActiveType","setActiveItemData","activeTab","setActiveTab","useState","toggleSection","useSectionToggle","selectedUrl","setSelectedUrl","_c","_b","_a","api","servers","url","isUrlDropdownOpen","setIsUrlDropdownOpen","useEffect","useMemo","filter","s","pathParts","path","split","slice","length","join","httpStatusCodeOptions","httpStatusCodes","map","code","label","_jsxs","jsxs","className","children","_jsx","style","backgroundColor","handleStatusColor","value","expanded","setExpanded","selectedResStatusCode","setSelectedResStatusCode","headersList","setHeadersList","parameters","param","in","toLowerCase","headerObj","responses","headers","onClick","apiSpecId","type","SectionEnum","OVERVIEW","setTo","resetOthers","filterKeys","RESOURCE","SVGLoader","src","ArrowBack","Tooltip","content","title","summary","_e","_d","server","index","name","checked","readOnly","jsx","_f","method","prev","role","tabIndex","e","stopPropagation","copyToClipboard","newCopyIcon","arrowUp","arrowDown","description","tab","RequestOption","charAt","toUpperCase","_g","p","row","required","textTransform","schema","items","color","fontSize","capitalizeFirstLetter","Array","isArray","enum","DownArrowIcon","height","width","marginLeft","_h","Object","keys","SelectGroup","size","withSearch","isMultiple","clearable","placeholder","options","list","onChange","key","toString","_k","_j","_p","_o","_q"],"mappings":"28BAoBO,MAAMA,EAAe,EAC1BC,OACAC,gBACAC,4CAMA,MAAOC,EAAWC,GAAgBC,EAAS,WACrCC,cAAEA,GAAkBC,KACnBC,EAAaC,GAAkBJ,GAAkC,QAAzBK,EAAkB,QAAlBC,EAAS,QAATC,EAAAZ,aAAI,EAAJA,EAAMa,WAAG,IAAAD,OAAA,EAAAA,EAAEE,eAAO,IAAAH,OAAA,EAAAA,EAAG,UAAI,IAAAD,OAAA,EAAAA,EAAAK,MAAO,KACxEC,EAAmBC,GAAwBZ,GAAkB,GAEpEa,EAAU,eACRT,WAAeC,UAAAC,EAAW,UAAXX,aAAI,EAAJA,EAAMa,WAAK,IAAAD,OAAA,EAAAA,EAAAE,8BAAU,yBAAIC,MAAO,KAC9C,CAACf,IAEYmB,EAAQ,eAEtB,MAAMJ,EAA0D,QAApDL,EAAmB,QAAnBC,EAA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,EAAApF,EAAY8E,UAAI,IAAAM,OAAA,EAAAA,EAAExC"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/layout/docsComponents/DocsContent/EndpointPage/index.tsx"],"sourcesContent":["import SVGLoader from '../../../../components/SVGLoader/SVGLoader'\nimport {\n ArrowBack,\n arrowDown,\n arrowUp,\n DownArrowIcon,\n newCopyIcon,\n RequestOption,\n} from '../../../../assets/icons/index'\nimport { SelectGroup } from 'digitinary-ui'\nimport { useEffect, useMemo, useState } from 'react'\nimport { EndpointData, OverviewData } from 'src/layout/docsLayout'\nimport { handleStatusColor } from '../../../../helpers/methodAccordion.helper'\nimport { httpStatusCodes } from '../../../../constants/index'\nimport styles from '../../Codebox/style.module.scss'\nimport Tooltip from '../../../../components/Tooltip/Tooltip'\nimport './style.scss'\nimport { SectionEnum, useSectionToggle } from '../../../../../src/context/SectionToggleContext'\nimport { capitalizeFirstLetter, copyToClipboard } from '../../../../../src/utils'\n\nexport const EndpointPage = ({\n data,\n setActiveType,\n setActiveItemData,\n}: {\n data: EndpointData\n setActiveType: React.Dispatch<React.SetStateAction<'OVERVIEW' | 'ENDPOINT'>>\n setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>\n}) => {\n const [activeTab, setActiveTab] = useState('header')\n const { toggleSection } = useSectionToggle()\n const [selectedUrl, setSelectedUrl] = useState(data?.api?.servers?.[0]?.url || '')\n const [isUrlDropdownOpen, setIsUrlDropdownOpen] = useState<boolean>(false)\n\n useEffect(() => {\n setSelectedUrl(data?.api?.servers?.[0]?.url || '')\n }, [data])\n\n const fullUrl = useMemo(() => {\n // env gateway url + api version(if appended) + context path\n const url = data.api?.servers?.filter((s) => s.url !== '/')[0]?.url\n const pathParts = data?.path.split('/').slice(2) // slice from index 2 to skip the first empty \"\" and \"comments\"\n const fullPath = !!pathParts?.length ? '/' + pathParts.join('/') : '' // this will contain the full path without the context path\n return `${url}${fullPath}`\n }, [data])\n\n // Filter status codes to only include those\n const filteredStatusCodes = Object.keys(data?.responses || {}).filter((code) => {\n const response = data.responses[code]\n return (\n response?.content?.['application/json']?.schema?.properties\n )\n })\n\n // Create options for the select dropdown\n const httpStatusCodeOptions = filteredStatusCodes.map((code) => ({\n label: (\n <div className=\"statusCodeOptionContainer\">\n <div\n className=\"statusCodeOptionCircle\"\n style={{ backgroundColor: handleStatusColor(code) }}\n ></div>\n <span>{code}</span>\n </div>\n ),\n value: code,\n }))\n\n // Function to get default option\n const getDefaultOption = () => {\n const has200 = filteredStatusCodes.includes('200')\n return has200\n ? httpStatusCodeOptions.find((opt) => opt.value === '200')\n : httpStatusCodeOptions[0] || null\n }\n\n const [expanded, setExpanded] = useState(null)\n const [selectedResStatusCode, setSelectedResStatusCode] = useState(getDefaultOption())\n const [headersList, setHeadersList] = useState({})\n const requestTableData = (data?.parameters || []).filter(\n (param) => param.in?.toLowerCase() === activeTab.toLowerCase()\n )\n\n useEffect(() => {\n setSelectedResStatusCode(getDefaultOption())\n }, [data])\n\n useEffect(() => {\n if (selectedResStatusCode && selectedResStatusCode.value) {\n const headerObj = data?.responses[selectedResStatusCode.value]\n setHeadersList(headerObj?.headers)\n }\n }, [selectedResStatusCode, data?.responses])\n\n return (\n <div className=\"api-details-expanded\">\n <div className=\"test-button\">\n <button\n className=\"back-button\"\n onClick={() => {\n toggleSection(data.api.apiSpecId, [{ type: SectionEnum.OVERVIEW, setTo: true }], {\n resetOthers: true,\n filterKeys: [SectionEnum.RESOURCE],\n })\n setActiveType('OVERVIEW')\n setActiveItemData(data.api)\n }}\n >\n <SVGLoader src={ArrowBack} />\n </button>\n\n <Tooltip content=\"Comming soon\">\n <button className=\"disabled\">Test</button>\n </Tooltip>\n </div>\n <h3>{data.api.title}</h3>\n <h1 className=\"api-title\">{data?.summary}</h1>\n <div className=\"url-box\">\n {isUrlDropdownOpen && selectedUrl.length !== 0 && (\n <div className=\"url-list\">\n {data.api?.servers?.map((server, index) => (\n <div\n key={index}\n className=\"url-item\"\n onClick={() => {\n setSelectedUrl(server.url)\n setIsUrlDropdownOpen(false)\n }}\n >\n <input\n type=\"radio\"\n name=\"api-method\"\n checked={selectedUrl === server.url}\n readOnly\n />\n <span>{`${server.url}${data.path}`}</span>\n </div>\n ))}\n </div>\n )}\n <div className=\"url-box_text-container\">\n <span className={`method-label ${data?.method?.toLowerCase()}`}>{data.method}</span>\n <div className=\"url-container\">\n <div className=\"type-ddl\" onClick={() => setIsUrlDropdownOpen((prev) => !prev)}>\n <span className=\"url-text\">{`${selectedUrl}${data.path}`}</span>\n <div className=\"icon-container\">\n <SVGLoader\n className=\"icon\"\n role=\"button\"\n tabIndex={0}\n onClick={(e) => {\n e.stopPropagation()\n copyToClipboard(`${selectedUrl}${data.path}`)\n }}\n src={newCopyIcon}\n />\n {selectedUrl.length !== 0 && (\n <SVGLoader src={!isUrlDropdownOpen ? arrowDown : arrowUp} />\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <p className=\"api-desc\">{data?.description || 'No Description'}</p>\n\n <h3>Request</h3>\n\n <div className=\"request-section\">\n <div className=\"request-tabs\">\n {['header', 'path', 'query'].map((tab) => (\n <button\n key={tab}\n className={`tab ${activeTab === tab ? 'active' : ''}`}\n onClick={() => setActiveTab(tab)}\n >\n <SVGLoader src={RequestOption} className=\"icon-left\" />\n <span className=\"tab-label\">\n {tab === 'requestBody'\n ? 'Request Body'\n : tab.charAt(0).toUpperCase() + tab.slice(1)}\n </span>\n </button>\n ))}\n </div>\n\n <div className=\"table-wrapper\">\n <table className=\"param-table\">\n <thead>\n <tr>\n <th className=\"head-table-label\">Parameter Name</th>\n <th className=\"head-table-label\">Required</th>\n <th className=\"head-table-label\">Type</th>\n <th className=\"head-table-label\">Enum</th>\n <th className=\"head-table-label\">Description</th>\n </tr>\n </thead>\n <tbody>\n {data.parameters\n ?.filter((p) => p.in?.toLowerCase() === activeTab.toLowerCase())\n .map((row, index) => (\n <tr key={index}>\n <td>{row.name}</td>\n <td>{row.required ? 'True' : 'False'}</td>\n <td style={{ textTransform: 'capitalize' }}>\n <span>{row?.schema?.type || '-'}</span>\n {row?.schema?.type === 'array' && row?.schema?.items?.type && (\n <span style={{ color: '#616874', fontSize: '0.75rem' }}>\n _{capitalizeFirstLetter(row.schema?.items?.type)}\n </span>\n )}\n </td>\n <td>{Array.isArray(row.schema?.enum) ? row.schema.enum.join(' / ') : '-'}</td>\n <td className=\"desc-cell\">\n <div className={`desc-text ${expanded === index ? 'expanded' : ''}`}>\n {row.description || 'No description'}\n </div>\n <button\n className=\"desc-toggle\"\n onClick={() => setExpanded(expanded === index ? null : index)}\n >\n <SVGLoader\n src={DownArrowIcon}\n className={expanded === index ? 'rotated' : ''}\n />\n </button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n\n <div className=\"response-section\">\n <h3>Response</h3>\n\n <div>\n <div style={{ height: '0.5rem', width: '7.5rem', marginLeft: 'auto' }}>\n {Object.keys(data?.responses || {})?.length > 0 && (\n <div className={'codeboxSection'}>\n <div className={`${'codeboxHeader'}`}>\n <SelectGroup\n size=\"small\"\n withSearch={false}\n isMultiple={false}\n clearable={false}\n placeholder=\"200\"\n options={[\n {\n list: httpStatusCodeOptions,\n },\n ]}\n value={selectedResStatusCode}\n onChange={(value) => {\n setSelectedResStatusCode(value)\n }}\n />\n </div>\n </div>\n )}\n </div>\n <button className=\"tab active \">\n <SVGLoader src={RequestOption} className=\"icon-left\" />\n Header\n </button>\n </div>\n\n <div className=\"table-wrapper\">\n <table className=\"param-table\">\n <thead>\n <tr>\n <th className=\"head-table-label\">Header Name</th>\n <th className=\"head-table-label\">Required</th>\n <th className=\"head-table-label\">Type</th>\n <th className=\"head-table-label\">Enum</th>\n <th className=\"head-table-label\">Description</th>\n </tr>\n </thead>\n <tbody>\n {!!headersList &&\n Object.keys(headersList) &&\n Object.keys(headersList).map((key) => (\n <tr>\n <td>{key}</td>\n <td>{headersList[key]?.required.toString()}</td>\n <td style={{ textTransform: 'capitalize' }}>\n <span>{headersList[key]?.schema?.type || '-'}</span>\n {headersList[key]?.schema?.type === 'array' &&\n headersList[key]?.schema?.items?.type && (\n <span style={{ color: '#616874', fontSize: '0.75rem' }}>\n _{capitalizeFirstLetter(headersList[key]?.schema?.items?.type)}\n </span>\n )}\n </td>\n <td>{headersList[key]?.schema?.enum?.join('/')}</td>\n <td>{headersList[key]?.description}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n </div>\n )\n}\n"],"names":["EndpointPage","data","setActiveType","setActiveItemData","activeTab","setActiveTab","useState","toggleSection","useSectionToggle","selectedUrl","setSelectedUrl","_c","_b","_a","api","servers","url","isUrlDropdownOpen","setIsUrlDropdownOpen","useEffect","useMemo","filter","s","pathParts","path","split","slice","length","join","filteredStatusCodes","Object","keys","responses","code","response","content","schema","properties","httpStatusCodeOptions","map","label","_jsxs","jsxs","className","children","_jsx","style","backgroundColor","handleStatusColor","value","getDefaultOption","includes","find","opt","expanded","setExpanded","selectedResStatusCode","setSelectedResStatusCode","headersList","setHeadersList","parameters","param","in","toLowerCase","headerObj","headers","onClick","apiSpecId","type","SectionEnum","OVERVIEW","setTo","resetOthers","filterKeys","RESOURCE","SVGLoader","src","ArrowBack","Tooltip","title","summary","_e","_d","server","index","name","checked","readOnly","jsx","_f","method","prev","role","tabIndex","e","stopPropagation","copyToClipboard","newCopyIcon","arrowUp","arrowDown","description","tab","RequestOption","charAt","toUpperCase","_g","p","row","required","textTransform","items","color","fontSize","capitalizeFirstLetter","Array","isArray","enum","DownArrowIcon","height","width","marginLeft","_h","SelectGroup","size","withSearch","isMultiple","clearable","placeholder","options","list","onChange","key","toString","_k","_j","_p","_o","_q"],"mappings":"04BAoBO,MAAMA,EAAe,EAC1BC,OACAC,gBACAC,4CAMA,MAAOC,EAAWC,GAAgBC,EAAS,WACrCC,cAAEA,GAAkBC,KACnBC,EAAaC,GAAkBJ,GAAkC,QAAzBK,EAAkB,QAAlBC,EAAS,QAATC,EAAAZ,aAAI,EAAJA,EAAMa,WAAG,I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AAgB,QAAhBC,EAAA8C,EAAYyE,UAAI,IAAAvH,OAAA,EAAAA,EAAEwB,cAAM,IAAAzB,OAAA,EAAAA,EAAEyD,OAAQ,MACL,WAAX,QAAxBa,EAAgB,QAAhBC,EAAAxB,EAAYyE,UAAI,IAAAjD,OAAA,EAAAA,EAAE9C,cAAM,IAAA6C,OAAA,EAAAA,EAAEb,gBACzBqD,EAA0B,UAAR,QAAlBhC,EAAA/B,EAAYyE,UAAM,IAAA1C,OAAA,EAAAA,EAAArD,cAAQ,IAAAqE,OAAA,EAAAA,EAAAK,4BAAO1C,OAC/B3B,EAAAA,aAAMK,MAAO,CAAEiE,MAAO,UAAWC,SAAU,WAAWpE,SAAA,CAAA,IAClDqE,YAAgD,QAA1BoB,EAAkB,QAAlBC,EAAA5E,EAAYyE,UAAM,IAAAG,OAAA,EAAAA,EAAAlG,cAAQ,IAAAiG,OAAA,EAAAA,EAAAvB,4BAAO1C,YAIjEvB,EAAAA,IAAA,KAAA,CAAAD,SAAmC,QAA9B2F,EAAwB,QAAxBC,YAAA9E,EAAYyE,yBAAM/F,cAAM,IAAAoG,OAAA,EAAAA,EAAEpB,YAAI,IAAAmB,OAAA,EAAAA,EAAE3G,KAAK,OAC1CiB,EAAAA,IAAK,KAAA,CAAAD,SAAgB,QAAhB6F,EAAA/E,EAAYyE,UAAI,IAAAM,OAAA,EAAAA,EAAErC"}
|
package/dist/styles.css
CHANGED
|
@@ -511,6 +511,147 @@
|
|
|
511
511
|
}
|
|
512
512
|
.methodAccordion.readOnly .methodSummaryContainer .methodExpandArrowContainer {
|
|
513
513
|
background-color: #ebecf2;
|
|
514
|
+
}#common-dialog.dialog-content-wrapper {
|
|
515
|
+
overflow: visible !important;
|
|
516
|
+
max-height: 100%;
|
|
517
|
+
width: 22.1875rem;
|
|
518
|
+
}
|
|
519
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root {
|
|
520
|
+
overflow: visible !important;
|
|
521
|
+
border-radius: 0.625rem;
|
|
522
|
+
max-height: 100%;
|
|
523
|
+
}
|
|
524
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content {
|
|
525
|
+
padding: 0 1.875rem !important;
|
|
526
|
+
overflow: visible !important;
|
|
527
|
+
max-height: 100%;
|
|
528
|
+
}
|
|
529
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog {
|
|
530
|
+
position: relative;
|
|
531
|
+
}
|
|
532
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .close-icon {
|
|
533
|
+
position: absolute;
|
|
534
|
+
z-index: 1;
|
|
535
|
+
top: 1.5rem;
|
|
536
|
+
right: 0;
|
|
537
|
+
transform: translate(0.625rem, -0.625rem);
|
|
538
|
+
cursor: pointer;
|
|
539
|
+
}
|
|
540
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header {
|
|
541
|
+
display: flex;
|
|
542
|
+
padding-top: 0.5rem;
|
|
543
|
+
position: relative;
|
|
544
|
+
}
|
|
545
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon {
|
|
546
|
+
margin-top: 1rem;
|
|
547
|
+
margin-bottom: 1.5rem;
|
|
548
|
+
margin-inline: auto;
|
|
549
|
+
}
|
|
550
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.info path {
|
|
551
|
+
stroke: #12131a;
|
|
552
|
+
}
|
|
553
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.info line {
|
|
554
|
+
stroke: #12131a;
|
|
555
|
+
}
|
|
556
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.info line + path {
|
|
557
|
+
fill: #12131a;
|
|
558
|
+
}
|
|
559
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.warning path {
|
|
560
|
+
stroke: #faad14;
|
|
561
|
+
}
|
|
562
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.warning line {
|
|
563
|
+
stroke: #faad14;
|
|
564
|
+
}
|
|
565
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.error path {
|
|
566
|
+
stroke: #da3f3f;
|
|
567
|
+
}
|
|
568
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.error line {
|
|
569
|
+
stroke: #da3f3f;
|
|
570
|
+
}
|
|
571
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.error line + path {
|
|
572
|
+
fill: #da3f3f;
|
|
573
|
+
}
|
|
574
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-title {
|
|
575
|
+
font-size: 1.5rem;
|
|
576
|
+
font-weight: 500;
|
|
577
|
+
line-height: 1.875rem;
|
|
578
|
+
text-align: center;
|
|
579
|
+
margin-bottom: 0.625rem;
|
|
580
|
+
}
|
|
581
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-title.error-title {
|
|
582
|
+
color: #da3f3f;
|
|
583
|
+
}
|
|
584
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-title.warning-title {
|
|
585
|
+
color: #faad14;
|
|
586
|
+
}
|
|
587
|
+
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-footer {
|
|
588
|
+
display: flex;
|
|
589
|
+
gap: 1.25rem;
|
|
590
|
+
margin-top: 1.875rem;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.common-dialog {
|
|
594
|
+
position: relative;
|
|
595
|
+
}
|
|
596
|
+
.common-dialog .close-icon {
|
|
597
|
+
position: absolute !important;
|
|
598
|
+
z-index: 1 !important;
|
|
599
|
+
top: 0.75rem !important;
|
|
600
|
+
right: 0.4rem !important;
|
|
601
|
+
transform: translate(0.625rem, -0.625rem) !important;
|
|
602
|
+
cursor: pointer !important;
|
|
603
|
+
}
|
|
604
|
+
.common-dialog .confirmation-dialog-header {
|
|
605
|
+
display: flex;
|
|
606
|
+
padding-top: 0.5rem;
|
|
607
|
+
position: relative;
|
|
608
|
+
}
|
|
609
|
+
.common-dialog .confirmation-dialog-header .icon {
|
|
610
|
+
margin-top: 1rem;
|
|
611
|
+
margin-bottom: 1.5rem;
|
|
612
|
+
margin-inline: auto;
|
|
613
|
+
}
|
|
614
|
+
.common-dialog .confirmation-dialog-header .icon.info path {
|
|
615
|
+
stroke: #12131a;
|
|
616
|
+
}
|
|
617
|
+
.common-dialog .confirmation-dialog-header .icon.info line {
|
|
618
|
+
stroke: #12131a;
|
|
619
|
+
}
|
|
620
|
+
.common-dialog .confirmation-dialog-header .icon.info line + path {
|
|
621
|
+
fill: #12131a;
|
|
622
|
+
}
|
|
623
|
+
.common-dialog .confirmation-dialog-header .icon.warning path {
|
|
624
|
+
stroke: #faad14;
|
|
625
|
+
}
|
|
626
|
+
.common-dialog .confirmation-dialog-header .icon.warning line {
|
|
627
|
+
stroke: #faad14;
|
|
628
|
+
}
|
|
629
|
+
.common-dialog .confirmation-dialog-header .icon.error path {
|
|
630
|
+
stroke: #da3f3f;
|
|
631
|
+
}
|
|
632
|
+
.common-dialog .confirmation-dialog-header .icon.error line {
|
|
633
|
+
stroke: #da3f3f;
|
|
634
|
+
}
|
|
635
|
+
.common-dialog .confirmation-dialog-header .icon.error line + path {
|
|
636
|
+
fill: #da3f3f;
|
|
637
|
+
}
|
|
638
|
+
.common-dialog .confirmation-title {
|
|
639
|
+
font-size: 1.5rem;
|
|
640
|
+
font-weight: 500;
|
|
641
|
+
line-height: 1.875rem;
|
|
642
|
+
text-align: center;
|
|
643
|
+
margin-bottom: 0.625rem;
|
|
644
|
+
}
|
|
645
|
+
.common-dialog .confirmation-title.error-title {
|
|
646
|
+
color: #da3f3f;
|
|
647
|
+
}
|
|
648
|
+
.common-dialog .confirmation-title.warning-title {
|
|
649
|
+
color: #faad14;
|
|
650
|
+
}
|
|
651
|
+
.common-dialog .confirmation-dialog-footer {
|
|
652
|
+
display: flex;
|
|
653
|
+
gap: 1.25rem;
|
|
654
|
+
margin-top: 1.875rem;
|
|
514
655
|
}.livePreviewContainer .titleContainer {
|
|
515
656
|
margin-top: 1.875rem;
|
|
516
657
|
display: flex;
|
|
@@ -776,147 +917,117 @@
|
|
|
776
917
|
z-index: 2;
|
|
777
918
|
top: -0.45rem;
|
|
778
919
|
transform-origin: center !important;
|
|
779
|
-
}
|
|
780
|
-
overflow:
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root {
|
|
785
|
-
overflow: visible !important;
|
|
786
|
-
border-radius: 0.625rem;
|
|
787
|
-
max-height: 100%;
|
|
788
|
-
}
|
|
789
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content {
|
|
790
|
-
padding: 0 1.875rem !important;
|
|
791
|
-
overflow: visible !important;
|
|
792
|
-
max-height: 100%;
|
|
793
|
-
}
|
|
794
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog {
|
|
795
|
-
position: relative;
|
|
920
|
+
}.json-editor-container {
|
|
921
|
+
overflow: hidden;
|
|
922
|
+
border-bottom-right-radius: 0.3125rem;
|
|
923
|
+
border-bottom-left-radius: 0.3125rem;
|
|
796
924
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
transform: translate(0.625rem, -0.625rem);
|
|
803
|
-
cursor: pointer;
|
|
925
|
+
.json-editor-container .json-editor-label {
|
|
926
|
+
font-size: 0.875rem;
|
|
927
|
+
font-weight: 600;
|
|
928
|
+
line-height: 1.25rem;
|
|
929
|
+
margin-bottom: 0.3125rem;
|
|
804
930
|
}
|
|
805
|
-
|
|
931
|
+
.json-editor-container .json-editor {
|
|
806
932
|
display: flex;
|
|
807
|
-
|
|
933
|
+
flex-direction: column;
|
|
934
|
+
background-color: #142452;
|
|
935
|
+
width: 100%;
|
|
936
|
+
outline: 1px solid transparent;
|
|
808
937
|
position: relative;
|
|
938
|
+
overflow: hidden;
|
|
809
939
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
#
|
|
816
|
-
stroke: #12131a;
|
|
817
|
-
}
|
|
818
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.info line {
|
|
819
|
-
stroke: #12131a;
|
|
820
|
-
}
|
|
821
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.info line + path {
|
|
822
|
-
fill: #12131a;
|
|
823
|
-
}
|
|
824
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.warning path {
|
|
825
|
-
stroke: #faad14;
|
|
826
|
-
}
|
|
827
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.warning line {
|
|
828
|
-
stroke: #faad14;
|
|
829
|
-
}
|
|
830
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.error path {
|
|
831
|
-
stroke: #da3f3f;
|
|
832
|
-
}
|
|
833
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.error line {
|
|
834
|
-
stroke: #da3f3f;
|
|
835
|
-
}
|
|
836
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-header .icon.error line + path {
|
|
837
|
-
fill: #da3f3f;
|
|
838
|
-
}
|
|
839
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-title {
|
|
840
|
-
font-size: 1.5rem;
|
|
841
|
-
font-weight: 500;
|
|
842
|
-
line-height: 1.875rem;
|
|
843
|
-
text-align: center;
|
|
844
|
-
margin-bottom: 0.625rem;
|
|
845
|
-
}
|
|
846
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-title.error-title {
|
|
847
|
-
color: #da3f3f;
|
|
848
|
-
}
|
|
849
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-title.warning-title {
|
|
850
|
-
color: #faad14;
|
|
851
|
-
}
|
|
852
|
-
#common-dialog.dialog-content-wrapper .dialog-content-root .dialog-content .common-dialog .confirmation-dialog-footer {
|
|
940
|
+
.json-editor-container .json-editor .actions-container {
|
|
941
|
+
width: 100%;
|
|
942
|
+
height: 5rem;
|
|
943
|
+
padding: 1.25rem;
|
|
944
|
+
border-radius: 0 0 0.3125rem 0.3125rem;
|
|
945
|
+
background: #101e47;
|
|
853
946
|
display: flex;
|
|
947
|
+
flex-direction: row;
|
|
854
948
|
gap: 1.25rem;
|
|
855
|
-
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
.common-dialog {
|
|
859
|
-
position: relative;
|
|
860
|
-
}
|
|
861
|
-
.common-dialog .close-icon {
|
|
862
|
-
position: absolute !important;
|
|
863
|
-
z-index: 1 !important;
|
|
864
|
-
top: 0.75rem !important;
|
|
865
|
-
right: 0.4rem !important;
|
|
866
|
-
transform: translate(0.625rem, -0.625rem) !important;
|
|
867
|
-
cursor: pointer !important;
|
|
868
|
-
}
|
|
869
|
-
.common-dialog .confirmation-dialog-header {
|
|
870
|
-
display: flex;
|
|
871
|
-
padding-top: 0.5rem;
|
|
872
|
-
position: relative;
|
|
873
|
-
}
|
|
874
|
-
.common-dialog .confirmation-dialog-header .icon {
|
|
875
|
-
margin-top: 1rem;
|
|
876
|
-
margin-bottom: 1.5rem;
|
|
877
|
-
margin-inline: auto;
|
|
949
|
+
align-items: center;
|
|
878
950
|
}
|
|
879
|
-
.
|
|
880
|
-
|
|
951
|
+
.json-editor-container .json-editor .actions-container .validate {
|
|
952
|
+
color: #fff;
|
|
953
|
+
text-align: center;
|
|
954
|
+
font-size: 1rem;
|
|
955
|
+
font-style: normal;
|
|
956
|
+
font-weight: 600;
|
|
957
|
+
line-height: 1.25rem;
|
|
958
|
+
width: 8.75rem;
|
|
959
|
+
padding: 0.625rem 2.25rem;
|
|
960
|
+
background-color: rgba(240, 248, 255, 0);
|
|
961
|
+
border-radius: 0.3125rem;
|
|
962
|
+
border: 0.0625rem solid #4d75d8;
|
|
963
|
+
cursor: pointer;
|
|
881
964
|
}
|
|
882
|
-
.
|
|
883
|
-
|
|
965
|
+
.json-editor-container .json-editor .actions-container .validate:disabled {
|
|
966
|
+
color: #babdcc;
|
|
967
|
+
border-color: #a2a5b6;
|
|
884
968
|
}
|
|
885
|
-
.
|
|
886
|
-
|
|
969
|
+
.json-editor-container .json-editor .actions-container .beautify {
|
|
970
|
+
color: #fff;
|
|
971
|
+
text-align: center;
|
|
972
|
+
font-size: 1rem;
|
|
973
|
+
font-style: normal;
|
|
974
|
+
font-weight: 600;
|
|
975
|
+
line-height: 1.25rem;
|
|
976
|
+
width: 8.75rem;
|
|
977
|
+
padding: 0.625rem 2.25rem;
|
|
978
|
+
background-color: rgba(240, 248, 255, 0);
|
|
979
|
+
border-radius: 0.3125rem;
|
|
980
|
+
border: 1px solid #babdcc;
|
|
981
|
+
cursor: pointer;
|
|
887
982
|
}
|
|
888
|
-
.
|
|
889
|
-
|
|
983
|
+
.json-editor-container .json-editor .actions-container .beautify:disabled {
|
|
984
|
+
color: #a2a5b6;
|
|
985
|
+
border-color: #a2a5b6;
|
|
890
986
|
}
|
|
891
|
-
.
|
|
892
|
-
|
|
987
|
+
.json-editor-container .json-editor textarea {
|
|
988
|
+
width: 100%;
|
|
989
|
+
padding: 1.25rem;
|
|
990
|
+
font-size: 0.875rem;
|
|
991
|
+
font-style: normal;
|
|
992
|
+
font-weight: 400;
|
|
993
|
+
line-height: 1.25rem;
|
|
994
|
+
color: white;
|
|
995
|
+
height: 25rem;
|
|
996
|
+
background-color: #142452;
|
|
997
|
+
border: none;
|
|
998
|
+
resize: none;
|
|
893
999
|
}
|
|
894
|
-
.
|
|
895
|
-
|
|
1000
|
+
.json-editor-container .json-editor textarea:focus, .json-editor-container .json-editor textarea:focus-within, .json-editor-container .json-editor textarea:focus-visible .json-editor-container .json-editor textarea:active {
|
|
1001
|
+
outline: none;
|
|
1002
|
+
border: none;
|
|
896
1003
|
}
|
|
897
|
-
.
|
|
898
|
-
|
|
1004
|
+
.json-editor-container .json-editor textarea::-webkit-scrollbar {
|
|
1005
|
+
width: 0.5rem;
|
|
899
1006
|
}
|
|
900
|
-
.
|
|
901
|
-
|
|
1007
|
+
.json-editor-container .json-editor textarea::-webkit-scrollbar-track {
|
|
1008
|
+
background-color: #828699;
|
|
1009
|
+
border: none;
|
|
1010
|
+
border-color: transparent;
|
|
1011
|
+
border-top-left-radius: 0;
|
|
902
1012
|
}
|
|
903
|
-
.
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
margin-bottom: 0.625rem;
|
|
1013
|
+
.json-editor-container .json-editor textarea::-webkit-scrollbar-thumb {
|
|
1014
|
+
background-color: #d8dae5;
|
|
1015
|
+
border: none;
|
|
1016
|
+
border-color: transparent;
|
|
1017
|
+
border-radius: 0;
|
|
909
1018
|
}
|
|
910
|
-
.
|
|
911
|
-
|
|
1019
|
+
.json-editor-container .json-editor.invalid {
|
|
1020
|
+
outline: 1px solid #ce2828 !important;
|
|
912
1021
|
}
|
|
913
|
-
.
|
|
914
|
-
color: #
|
|
1022
|
+
.json-editor-container .error-message {
|
|
1023
|
+
color: #ce2828;
|
|
1024
|
+
font-size: 0.75rem;
|
|
1025
|
+
line-height: 1.25rem;
|
|
1026
|
+
margin-top: 0.625rem;
|
|
915
1027
|
}
|
|
916
|
-
.
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
margin-top: 1.875rem;
|
|
1028
|
+
.json-editor-container.disabled .json-editor textarea {
|
|
1029
|
+
background-color: white;
|
|
1030
|
+
color: #12131a;
|
|
920
1031
|
}:root {
|
|
921
1032
|
--white: #fff;
|
|
922
1033
|
--Gray-5: #f1f2f6;
|
|
@@ -1186,117 +1297,6 @@ div.endBtnIcon {
|
|
|
1186
1297
|
.tableSectionContainer .descArrow path,
|
|
1187
1298
|
.tableSectionContainer .defaultSortArrow path {
|
|
1188
1299
|
fill: var(--Gray-50);
|
|
1189
|
-
}.json-editor-container {
|
|
1190
|
-
overflow: hidden;
|
|
1191
|
-
border-bottom-right-radius: 0.3125rem;
|
|
1192
|
-
border-bottom-left-radius: 0.3125rem;
|
|
1193
|
-
}
|
|
1194
|
-
.json-editor-container .json-editor-label {
|
|
1195
|
-
font-size: 0.875rem;
|
|
1196
|
-
font-weight: 600;
|
|
1197
|
-
line-height: 1.25rem;
|
|
1198
|
-
margin-bottom: 0.3125rem;
|
|
1199
|
-
}
|
|
1200
|
-
.json-editor-container .json-editor {
|
|
1201
|
-
display: flex;
|
|
1202
|
-
flex-direction: column;
|
|
1203
|
-
background-color: #142452;
|
|
1204
|
-
width: 100%;
|
|
1205
|
-
outline: 1px solid transparent;
|
|
1206
|
-
position: relative;
|
|
1207
|
-
overflow: hidden;
|
|
1208
|
-
}
|
|
1209
|
-
.json-editor-container .json-editor .actions-container {
|
|
1210
|
-
width: 100%;
|
|
1211
|
-
height: 5rem;
|
|
1212
|
-
padding: 1.25rem;
|
|
1213
|
-
border-radius: 0 0 0.3125rem 0.3125rem;
|
|
1214
|
-
background: #101e47;
|
|
1215
|
-
display: flex;
|
|
1216
|
-
flex-direction: row;
|
|
1217
|
-
gap: 1.25rem;
|
|
1218
|
-
align-items: center;
|
|
1219
|
-
}
|
|
1220
|
-
.json-editor-container .json-editor .actions-container .validate {
|
|
1221
|
-
color: #fff;
|
|
1222
|
-
text-align: center;
|
|
1223
|
-
font-size: 1rem;
|
|
1224
|
-
font-style: normal;
|
|
1225
|
-
font-weight: 600;
|
|
1226
|
-
line-height: 1.25rem;
|
|
1227
|
-
width: 8.75rem;
|
|
1228
|
-
padding: 0.625rem 2.25rem;
|
|
1229
|
-
background-color: rgba(240, 248, 255, 0);
|
|
1230
|
-
border-radius: 0.3125rem;
|
|
1231
|
-
border: 0.0625rem solid #4d75d8;
|
|
1232
|
-
cursor: pointer;
|
|
1233
|
-
}
|
|
1234
|
-
.json-editor-container .json-editor .actions-container .validate:disabled {
|
|
1235
|
-
color: #babdcc;
|
|
1236
|
-
border-color: #a2a5b6;
|
|
1237
|
-
}
|
|
1238
|
-
.json-editor-container .json-editor .actions-container .beautify {
|
|
1239
|
-
color: #fff;
|
|
1240
|
-
text-align: center;
|
|
1241
|
-
font-size: 1rem;
|
|
1242
|
-
font-style: normal;
|
|
1243
|
-
font-weight: 600;
|
|
1244
|
-
line-height: 1.25rem;
|
|
1245
|
-
width: 8.75rem;
|
|
1246
|
-
padding: 0.625rem 2.25rem;
|
|
1247
|
-
background-color: rgba(240, 248, 255, 0);
|
|
1248
|
-
border-radius: 0.3125rem;
|
|
1249
|
-
border: 1px solid #babdcc;
|
|
1250
|
-
cursor: pointer;
|
|
1251
|
-
}
|
|
1252
|
-
.json-editor-container .json-editor .actions-container .beautify:disabled {
|
|
1253
|
-
color: #a2a5b6;
|
|
1254
|
-
border-color: #a2a5b6;
|
|
1255
|
-
}
|
|
1256
|
-
.json-editor-container .json-editor textarea {
|
|
1257
|
-
width: 100%;
|
|
1258
|
-
padding: 1.25rem;
|
|
1259
|
-
font-size: 0.875rem;
|
|
1260
|
-
font-style: normal;
|
|
1261
|
-
font-weight: 400;
|
|
1262
|
-
line-height: 1.25rem;
|
|
1263
|
-
color: white;
|
|
1264
|
-
height: 25rem;
|
|
1265
|
-
background-color: #142452;
|
|
1266
|
-
border: none;
|
|
1267
|
-
resize: none;
|
|
1268
|
-
}
|
|
1269
|
-
.json-editor-container .json-editor textarea:focus, .json-editor-container .json-editor textarea:focus-within, .json-editor-container .json-editor textarea:focus-visible .json-editor-container .json-editor textarea:active {
|
|
1270
|
-
outline: none;
|
|
1271
|
-
border: none;
|
|
1272
|
-
}
|
|
1273
|
-
.json-editor-container .json-editor textarea::-webkit-scrollbar {
|
|
1274
|
-
width: 0.5rem;
|
|
1275
|
-
}
|
|
1276
|
-
.json-editor-container .json-editor textarea::-webkit-scrollbar-track {
|
|
1277
|
-
background-color: #828699;
|
|
1278
|
-
border: none;
|
|
1279
|
-
border-color: transparent;
|
|
1280
|
-
border-top-left-radius: 0;
|
|
1281
|
-
}
|
|
1282
|
-
.json-editor-container .json-editor textarea::-webkit-scrollbar-thumb {
|
|
1283
|
-
background-color: #d8dae5;
|
|
1284
|
-
border: none;
|
|
1285
|
-
border-color: transparent;
|
|
1286
|
-
border-radius: 0;
|
|
1287
|
-
}
|
|
1288
|
-
.json-editor-container .json-editor.invalid {
|
|
1289
|
-
outline: 1px solid #ce2828 !important;
|
|
1290
|
-
}
|
|
1291
|
-
.json-editor-container .error-message {
|
|
1292
|
-
color: #ce2828;
|
|
1293
|
-
font-size: 0.75rem;
|
|
1294
|
-
line-height: 1.25rem;
|
|
1295
|
-
margin-top: 0.625rem;
|
|
1296
|
-
}
|
|
1297
|
-
.json-editor-container.disabled .json-editor textarea {
|
|
1298
|
-
background-color: white;
|
|
1299
|
-
color: #12131a;
|
|
1300
1300
|
}:root {
|
|
1301
1301
|
--white: #fff;
|
|
1302
1302
|
--Gray-5: #f1f2f6;
|
package/package.json
CHANGED
|
@@ -190,11 +190,27 @@ export const transformPathsArrayToOrigin = (paths: TransformedPathsArray): OpenA
|
|
|
190
190
|
return param
|
|
191
191
|
})
|
|
192
192
|
}
|
|
193
|
+
|
|
194
|
+
// Get the original responses from the rest object
|
|
195
|
+
const originalResponses = rest.responses || {}
|
|
196
|
+
|
|
193
197
|
methodAcc[type] = {
|
|
194
198
|
...copiedRest,
|
|
195
199
|
tags,
|
|
196
200
|
summary,
|
|
197
201
|
responses: responses.reduce((respAcc, { code, content, headers }) => {
|
|
202
|
+
// Skip if:
|
|
203
|
+
// 1. This is a new code (not in original) AND
|
|
204
|
+
// 2. Both headers and content are empty
|
|
205
|
+
const isNewCode = !originalResponses[code]
|
|
206
|
+
const hasHeaders = Object.keys(headers || {}).length > 0
|
|
207
|
+
const hasContent =
|
|
208
|
+
Object.keys(validateBodyForResponse(content || {}, type) || {}).length > 0
|
|
209
|
+
|
|
210
|
+
if (isNewCode && !hasHeaders && !hasContent) {
|
|
211
|
+
return respAcc
|
|
212
|
+
}
|
|
213
|
+
|
|
198
214
|
const formattedHeaders: Record<string, any> = {}
|
|
199
215
|
if (headers) {
|
|
200
216
|
for (const [key, value] of Object.entries(headers)) {
|
|
@@ -216,7 +232,7 @@ export const transformPathsArrayToOrigin = (paths: TransformedPathsArray): OpenA
|
|
|
216
232
|
},
|
|
217
233
|
},
|
|
218
234
|
}
|
|
219
|
-
: {},
|
|
235
|
+
: originalResponses[code]?.content || {},
|
|
220
236
|
headers: formattedHeaders,
|
|
221
237
|
}
|
|
222
238
|
return respAcc
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { EndpointData } from 'src/layout/docsLayout'
|
|
3
3
|
import Codebox from '../Codebox/Codebox'
|
|
4
4
|
import { Option, SelectGroup } from 'digitinary-ui'
|
|
@@ -6,24 +6,43 @@ import { httpStatusCodes } from '../../../constants/index'
|
|
|
6
6
|
import { handleStatusColor } from '../../../helpers/methodAccordion.helper'
|
|
7
7
|
import styles from './style.module.scss'
|
|
8
8
|
|
|
9
|
-
const httpStatusCodeOptions: Option[] = httpStatusCodes.map((code) => ({
|
|
10
|
-
label: (
|
|
11
|
-
<div className={styles.statusCodeOptionContainer}>
|
|
12
|
-
<div
|
|
13
|
-
className={styles.statusCodeOptionCircle}
|
|
14
|
-
style={{ backgroundColor: handleStatusColor(code) }}
|
|
15
|
-
></div>
|
|
16
|
-
<span>{code}</span>
|
|
17
|
-
</div>
|
|
18
|
-
),
|
|
19
|
-
value: String(code),
|
|
20
|
-
}))
|
|
21
|
-
|
|
22
9
|
const DocsAside = ({ data }: { data: EndpointData }) => {
|
|
10
|
+
// Filter status codes to only include those with non-empty properties
|
|
11
|
+
const filteredStatusCodes = Object.keys(data?.responses || {}).filter((code) => {
|
|
12
|
+
const response = data.responses[code]
|
|
13
|
+
const contentType = Object.keys(response?.content || {})[0]
|
|
14
|
+
return response?.content?.[contentType]?.schema?.properties
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
// Create options for the select dropdown
|
|
18
|
+
const httpStatusCodeOptions = filteredStatusCodes.map((code) => ({
|
|
19
|
+
label: (
|
|
20
|
+
<div className={styles.statusCodeOptionContainer}>
|
|
21
|
+
<div
|
|
22
|
+
className={styles.statusCodeOptionCircle}
|
|
23
|
+
style={{ backgroundColor: handleStatusColor(code) }}
|
|
24
|
+
></div>
|
|
25
|
+
<span>{code}</span>
|
|
26
|
+
</div>
|
|
27
|
+
),
|
|
28
|
+
value: String(code),
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
// Function to get default option
|
|
32
|
+
const getDefaultOption = () => {
|
|
33
|
+
const has200 = filteredStatusCodes.includes('200')
|
|
34
|
+
return has200
|
|
35
|
+
? httpStatusCodeOptions.find((opt) => opt.value === '200')
|
|
36
|
+
: httpStatusCodeOptions[0] || null
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setSelectedResStatusCode(getDefaultOption())
|
|
41
|
+
}, [data])
|
|
23
42
|
const [selectedResStatusCode, setSelectedResStatusCode] = useState(httpStatusCodeOptions[4])
|
|
24
43
|
const currentResponse = Object.entries(data.responses)
|
|
25
44
|
.map(([code, data]) => ({ code, data }))
|
|
26
|
-
.find((res) => res.code === selectedResStatusCode
|
|
45
|
+
.find((res) => res.code === selectedResStatusCode?.value)
|
|
27
46
|
|
|
28
47
|
const stringifyRequestBody = () => {
|
|
29
48
|
if (data?.requestBody?.content) {
|
|
@@ -44,11 +44,20 @@ export const EndpointPage = ({
|
|
|
44
44
|
return `${url}${fullPath}`
|
|
45
45
|
}, [data])
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
// Filter status codes to only include those
|
|
48
|
+
const filteredStatusCodes = Object.keys(data?.responses || {}).filter((code) => {
|
|
49
|
+
const response = data.responses[code]
|
|
50
|
+
return (
|
|
51
|
+
response?.content?.['application/json']?.schema?.properties
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
// Create options for the select dropdown
|
|
56
|
+
const httpStatusCodeOptions = filteredStatusCodes.map((code) => ({
|
|
48
57
|
label: (
|
|
49
|
-
<div className=
|
|
58
|
+
<div className="statusCodeOptionContainer">
|
|
50
59
|
<div
|
|
51
|
-
className=
|
|
60
|
+
className="statusCodeOptionCircle"
|
|
52
61
|
style={{ backgroundColor: handleStatusColor(code) }}
|
|
53
62
|
></div>
|
|
54
63
|
<span>{code}</span>
|
|
@@ -57,13 +66,25 @@ export const EndpointPage = ({
|
|
|
57
66
|
value: code,
|
|
58
67
|
}))
|
|
59
68
|
|
|
69
|
+
// Function to get default option
|
|
70
|
+
const getDefaultOption = () => {
|
|
71
|
+
const has200 = filteredStatusCodes.includes('200')
|
|
72
|
+
return has200
|
|
73
|
+
? httpStatusCodeOptions.find((opt) => opt.value === '200')
|
|
74
|
+
: httpStatusCodeOptions[0] || null
|
|
75
|
+
}
|
|
76
|
+
|
|
60
77
|
const [expanded, setExpanded] = useState(null)
|
|
61
|
-
const [selectedResStatusCode, setSelectedResStatusCode] = useState(
|
|
78
|
+
const [selectedResStatusCode, setSelectedResStatusCode] = useState(getDefaultOption())
|
|
62
79
|
const [headersList, setHeadersList] = useState({})
|
|
63
80
|
const requestTableData = (data?.parameters || []).filter(
|
|
64
81
|
(param) => param.in?.toLowerCase() === activeTab.toLowerCase()
|
|
65
82
|
)
|
|
66
83
|
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
setSelectedResStatusCode(getDefaultOption())
|
|
86
|
+
}, [data])
|
|
87
|
+
|
|
67
88
|
useEffect(() => {
|
|
68
89
|
if (selectedResStatusCode && selectedResStatusCode.value) {
|
|
69
90
|
const headerObj = data?.responses[selectedResStatusCode.value]
|
|
@@ -71,8 +92,6 @@ export const EndpointPage = ({
|
|
|
71
92
|
}
|
|
72
93
|
}, [selectedResStatusCode, data?.responses])
|
|
73
94
|
|
|
74
|
-
// ? TODO: 'body' should be returned after discussing with PO
|
|
75
|
-
|
|
76
95
|
return (
|
|
77
96
|
<div className="api-details-expanded">
|
|
78
97
|
<div className="test-button">
|
|
@@ -166,54 +185,52 @@ export const EndpointPage = ({
|
|
|
166
185
|
))}
|
|
167
186
|
</div>
|
|
168
187
|
|
|
169
|
-
|
|
170
|
-
<
|
|
171
|
-
<
|
|
172
|
-
<
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
{
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
</div>
|
|
216
|
-
}
|
|
188
|
+
<div className="table-wrapper">
|
|
189
|
+
<table className="param-table">
|
|
190
|
+
<thead>
|
|
191
|
+
<tr>
|
|
192
|
+
<th className="head-table-label">Parameter Name</th>
|
|
193
|
+
<th className="head-table-label">Required</th>
|
|
194
|
+
<th className="head-table-label">Type</th>
|
|
195
|
+
<th className="head-table-label">Enum</th>
|
|
196
|
+
<th className="head-table-label">Description</th>
|
|
197
|
+
</tr>
|
|
198
|
+
</thead>
|
|
199
|
+
<tbody>
|
|
200
|
+
{data.parameters
|
|
201
|
+
?.filter((p) => p.in?.toLowerCase() === activeTab.toLowerCase())
|
|
202
|
+
.map((row, index) => (
|
|
203
|
+
<tr key={index}>
|
|
204
|
+
<td>{row.name}</td>
|
|
205
|
+
<td>{row.required ? 'True' : 'False'}</td>
|
|
206
|
+
<td style={{ textTransform: 'capitalize' }}>
|
|
207
|
+
<span>{row?.schema?.type || '-'}</span>
|
|
208
|
+
{row?.schema?.type === 'array' && row?.schema?.items?.type && (
|
|
209
|
+
<span style={{ color: '#616874', fontSize: '0.75rem' }}>
|
|
210
|
+
_{capitalizeFirstLetter(row.schema?.items?.type)}
|
|
211
|
+
</span>
|
|
212
|
+
)}
|
|
213
|
+
</td>
|
|
214
|
+
<td>{Array.isArray(row.schema?.enum) ? row.schema.enum.join(' / ') : '-'}</td>
|
|
215
|
+
<td className="desc-cell">
|
|
216
|
+
<div className={`desc-text ${expanded === index ? 'expanded' : ''}`}>
|
|
217
|
+
{row.description || 'No description'}
|
|
218
|
+
</div>
|
|
219
|
+
<button
|
|
220
|
+
className="desc-toggle"
|
|
221
|
+
onClick={() => setExpanded(expanded === index ? null : index)}
|
|
222
|
+
>
|
|
223
|
+
<SVGLoader
|
|
224
|
+
src={DownArrowIcon}
|
|
225
|
+
className={expanded === index ? 'rotated' : ''}
|
|
226
|
+
/>
|
|
227
|
+
</button>
|
|
228
|
+
</td>
|
|
229
|
+
</tr>
|
|
230
|
+
))}
|
|
231
|
+
</tbody>
|
|
232
|
+
</table>
|
|
233
|
+
</div>
|
|
217
234
|
</div>
|
|
218
235
|
|
|
219
236
|
<div className="response-section">
|
package/variables.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export APP_VERSION=1.0.
|
|
1
|
+
export APP_VERSION=1.0.96
|