@digi-frontend/dgate-api-documentation 1.0.55 → 1.0.57
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/_virtual/index10.js +1 -1
- package/dist/_virtual/index20.js +2 -0
- package/dist/_virtual/index20.js.map +1 -0
- package/dist/_virtual/index3.js +1 -1
- package/dist/_virtual/index4.js +1 -1
- package/dist/_virtual/index5.js +1 -1
- package/dist/_virtual/index6.js +1 -1
- package/dist/_virtual/index7.js +1 -1
- package/dist/_virtual/index8.js +1 -1
- package/dist/_virtual/index9.js +1 -1
- package/dist/node_modules/dom-serializer/lib/index.js +1 -1
- package/dist/node_modules/dom-serializer/node_modules/entities/lib/index.js +1 -1
- package/dist/node_modules/domelementtype/lib/index.js +1 -1
- package/dist/node_modules/domhandler/lib/index.js +1 -1
- package/dist/node_modules/domutils/lib/index.js +1 -1
- package/dist/node_modules/fast-json-stable-stringify/index.js +2 -0
- package/dist/node_modules/fast-json-stable-stringify/index.js.map +1 -0
- package/dist/node_modules/formik/dist/formik.esm.js +1 -1
- package/dist/node_modules/html-dom-parser/lib/index.js +1 -1
- package/dist/node_modules/html-react-parser/esm/index.mjs.js +1 -1
- package/dist/node_modules/html-react-parser/esm/index.mjs.js.map +1 -1
- package/dist/node_modules/html-react-parser/lib/index.js +1 -1
- package/dist/node_modules/htmlparser2/dist/commonjs/index.js +1 -1
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/react-property/lib/index.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/toposort/index.js +1 -1
- package/dist/node_modules/yup/index.esm.js +1 -1
- package/dist/src/assets/icons/CloseIcon.svg.js +2 -0
- package/dist/src/assets/icons/CloseIcon.svg.js.map +1 -0
- package/dist/src/components/InfoForm/InfoForm.js +1 -1
- package/dist/src/components/InfoForm/InfoForm.js.map +1 -1
- package/dist/src/components/LivePreview/LivePreview.js +1 -1
- package/dist/src/components/LivePreview/LivePreview.js.map +1 -1
- package/dist/src/components/MethodAccordion/MethodAccordion.js +1 -1
- package/dist/src/components/MethodAccordion/MethodAccordion.js.map +1 -1
- package/dist/src/components/dialog/index.js +1 -1
- package/dist/src/components/dialog/index.js.map +1 -1
- package/dist/src/components/table/table.js +1 -1
- package/dist/src/components/table/table.js.map +1 -1
- package/dist/src/components/table/tags-table.js +1 -1
- package/dist/src/components/table/tags-table.js.map +1 -1
- package/dist/src/layout/docsComponents/DocsContent/DocsContent.js +1 -1
- package/dist/src/layout/docsComponents/DocsContent/DocsContent.js.map +1 -1
- package/dist/src/layout/docsComponents/DocsContent/OverviewPage/index.js +2 -0
- package/dist/src/layout/docsComponents/DocsContent/OverviewPage/index.js.map +1 -0
- package/dist/src/layout/docsComponents/DocsHeader/DocsHeader.js +1 -1
- package/dist/src/layout/docsComponents/DocsHeader/DocsHeader.js.map +1 -1
- package/dist/src/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.js +1 -1
- package/dist/src/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.js.map +1 -1
- package/dist/src/layout/docsLayout.js +1 -1
- package/dist/src/layout/docsLayout.js.map +1 -1
- package/dist/styles.css +761 -757
- package/dist/types/components/dialog/dialog.d.ts +2 -0
- package/dist/types/components/dialog/index.d.ts +1 -1
- package/dist/types/layout/docsComponents/DocsContent/DocsContent.d.ts +2 -1
- package/dist/types/layout/docsComponents/DocsContent/OverviewPage/index.d.ts +9 -0
- package/dist/types/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.d.ts +3 -1
- package/dist/types/layout/docsLayout.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/InfoForm/InfoForm.tsx +16 -16
- package/src/components/LivePreview/LivePreview.module.scss +15 -14
- package/src/components/LivePreview/LivePreview.tsx +1 -0
- package/src/components/MethodAccordion/MethodAccordion.tsx +129 -122
- package/src/components/dialog/dialog.ts +3 -0
- package/src/components/dialog/index.tsx +7 -8
- package/src/components/table/table.tsx +39 -32
- package/src/components/table/tags-table.tsx +2 -2
- package/src/layout/docsComponents/DocsContent/DocsContent.tsx +5 -2
- package/src/layout/docsComponents/DocsContent/{TagPage → OverviewPage}/index.tsx +17 -4
- package/src/layout/docsComponents/DocsContent/{TagPage → OverviewPage}/style.scss +1 -0
- package/src/layout/docsComponents/DocsHeader/DocsHeader.tsx +1 -4
- package/src/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.tsx +12 -1
- package/src/layout/docsLayout.tsx +7 -1
|
@@ -164,7 +164,12 @@ const ParamterTable = ({
|
|
|
164
164
|
label: capitalize(values.in),
|
|
165
165
|
value: values.in,
|
|
166
166
|
}}
|
|
167
|
-
onChange={(item) =>
|
|
167
|
+
onChange={(item) => {
|
|
168
|
+
setFieldValue('in', item?.value?.toLowerCase())
|
|
169
|
+
if (item?.value == 'in') {
|
|
170
|
+
setFieldValue('required', true)
|
|
171
|
+
}
|
|
172
|
+
}} // Updates state on selection
|
|
168
173
|
options={[
|
|
169
174
|
{
|
|
170
175
|
list: isRequest
|
|
@@ -186,10 +191,7 @@ const ParamterTable = ({
|
|
|
186
191
|
</td>
|
|
187
192
|
|
|
188
193
|
<td key={'parameter schema type'}>
|
|
189
|
-
<div
|
|
190
|
-
data-id="TEXT_DESCRIPTION"
|
|
191
|
-
className="tableData select-inputs"
|
|
192
|
-
>
|
|
194
|
+
<div data-id="TEXT_DESCRIPTION" className="tableData select-inputs">
|
|
193
195
|
<SelectGroupV2
|
|
194
196
|
disabled={readOnly}
|
|
195
197
|
clearable={false}
|
|
@@ -215,32 +217,32 @@ const ParamterTable = ({
|
|
|
215
217
|
withSearch={false}
|
|
216
218
|
/>{' '}
|
|
217
219
|
{!!values?.schema?.type && values?.schema?.type.toLowerCase() === 'array' ? (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
220
|
+
<SelectGroupV2
|
|
221
|
+
disabled={readOnly}
|
|
222
|
+
clearable={false}
|
|
223
|
+
value={{
|
|
224
|
+
label: capitalize(values?.schema?.items?.type),
|
|
225
|
+
value: values.schema?.items?.type,
|
|
226
|
+
}}
|
|
227
|
+
errorMsg={!!errors?.schema?.items?.type && errors?.schema?.items?.type}
|
|
228
|
+
onChange={(item) =>
|
|
229
|
+
setFieldValue('schema.items.type', item?.value?.toLowerCase())
|
|
230
|
+
} // Updates state on selection
|
|
231
|
+
options={[
|
|
232
|
+
{
|
|
233
|
+
list: [
|
|
234
|
+
{ label: 'String', value: 'string' },
|
|
235
|
+
{ label: 'Integer', value: 'integer' },
|
|
236
|
+
{ label: 'Boolean', value: 'boolean' },
|
|
237
|
+
{ label: 'Object', value: 'object' },
|
|
238
|
+
{ label: 'Array', value: 'array' },
|
|
239
|
+
{ label: 'Number', value: 'number' },
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
]}
|
|
243
|
+
isMultiple={false}
|
|
244
|
+
withSearch={false}
|
|
245
|
+
/>
|
|
244
246
|
) : (
|
|
245
247
|
''
|
|
246
248
|
)}
|
|
@@ -362,7 +364,12 @@ const ParamterTable = ({
|
|
|
362
364
|
<>{values.required ? 'True' : 'False'}</>
|
|
363
365
|
) : (
|
|
364
366
|
<Switch
|
|
365
|
-
checked={
|
|
367
|
+
checked={
|
|
368
|
+
values && values.in && values.in.toLowerCase() == 'path'
|
|
369
|
+
? true
|
|
370
|
+
: values.required
|
|
371
|
+
}
|
|
372
|
+
disabled={values && values.in && values.in.toLowerCase() == 'path'}
|
|
366
373
|
onClick={() => {
|
|
367
374
|
if (readOnly) {
|
|
368
375
|
return
|
|
@@ -16,7 +16,7 @@ const TagsTable = ({ id, headCells, data, isFormOpen, setIsFormOpen, saveNewRow,
|
|
|
16
16
|
const [externalUrl, setExternalUrl] = useState('')
|
|
17
17
|
const [tooltipRef, setTooltipRef] = useState(null)
|
|
18
18
|
const [externalTooltipRefs, setExternalTooltipRefs] = useState(null)
|
|
19
|
-
const { values, errors, setFieldValue, isValid, submitForm, resetForm } = useFormik({
|
|
19
|
+
const { values, errors, setFieldValue, isValid, submitForm, resetForm,dirty } = useFormik({
|
|
20
20
|
validateOnMount: true,
|
|
21
21
|
initialValues: {
|
|
22
22
|
name: '',
|
|
@@ -307,7 +307,7 @@ const TagsTable = ({ id, headCells, data, isFormOpen, setIsFormOpen, saveNewRow,
|
|
|
307
307
|
className={_styles.deleteParamBtn}
|
|
308
308
|
variant="link"
|
|
309
309
|
color="success"
|
|
310
|
-
disabled={!isValid}
|
|
310
|
+
disabled={!isValid || !dirty}
|
|
311
311
|
endIcon={<SVGLoader src={AddRow} width="0.125rem" height="0.125rem" />}
|
|
312
312
|
onClick={() => {
|
|
313
313
|
setText('')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import './style.scss'
|
|
3
|
-
import {
|
|
3
|
+
import { OverviewPage } from './OverviewPage'
|
|
4
4
|
import { EndpointPage } from './EndpointPage'
|
|
5
5
|
import { EndpointData, OverviewData } from 'src/layout/docsLayout'
|
|
6
6
|
|
|
@@ -10,6 +10,7 @@ const DocsContent = ({
|
|
|
10
10
|
setActiveItemData,
|
|
11
11
|
setActiveType,
|
|
12
12
|
setExpandedSections,
|
|
13
|
+
onProductNavigate,
|
|
13
14
|
}: {
|
|
14
15
|
data: OverviewData | EndpointData
|
|
15
16
|
activeType: 'OVERVIEW' | 'ENDPOINT'
|
|
@@ -17,15 +18,17 @@ const DocsContent = ({
|
|
|
17
18
|
setActiveType: React.Dispatch<React.SetStateAction<'OVERVIEW' | 'ENDPOINT'>>
|
|
18
19
|
setExpandedSections: React.Dispatch<React.SetStateAction<Record<string, boolean>>>
|
|
19
20
|
toggleSection: (apiId: string, sectionId: string, resetOthers?: boolean, key?: string[]) => void
|
|
21
|
+
onProductNavigate?: (productId: number) => void
|
|
20
22
|
}) => {
|
|
21
23
|
return (
|
|
22
24
|
<main>
|
|
23
25
|
{activeType === 'OVERVIEW' ? (
|
|
24
|
-
<
|
|
26
|
+
<OverviewPage
|
|
25
27
|
data={data as OverviewData}
|
|
26
28
|
setActiveItemData={setActiveItemData}
|
|
27
29
|
setActiveType={setActiveType}
|
|
28
30
|
setExpandedSections={setExpandedSections}
|
|
31
|
+
onProductNavigate={onProductNavigate}
|
|
29
32
|
/>
|
|
30
33
|
) : (
|
|
31
34
|
<EndpointPage data={data as EndpointData} />
|
|
@@ -3,16 +3,18 @@ import SVGLoader from '../../../../components/SVGLoader/SVGLoader'
|
|
|
3
3
|
import { arrowRightGray, CopySticker } from '../../../../assets/icons/index'
|
|
4
4
|
import { EndpointData, OverviewData } from 'src/layout/docsLayout'
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const OverviewPage = ({
|
|
7
7
|
data,
|
|
8
8
|
setActiveItemData,
|
|
9
9
|
setActiveType,
|
|
10
10
|
setExpandedSections,
|
|
11
|
+
onProductNavigate,
|
|
11
12
|
}: {
|
|
12
13
|
data: OverviewData
|
|
13
14
|
setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>
|
|
14
15
|
setActiveType: React.Dispatch<React.SetStateAction<'OVERVIEW' | 'ENDPOINT'>>
|
|
15
16
|
setExpandedSections: React.Dispatch<React.SetStateAction<Record<string, boolean>>>
|
|
17
|
+
onProductNavigate?: (productId: number) => void
|
|
16
18
|
}) => {
|
|
17
19
|
const handleVersionClick = (verObj) => {
|
|
18
20
|
if (verObj.apiSpecId === data.apiSpecId) {
|
|
@@ -72,6 +74,7 @@ export const TagPage = ({
|
|
|
72
74
|
[`api-${data.apiSpecId}-resource-${endpoint.id}`]: true,
|
|
73
75
|
}))
|
|
74
76
|
}
|
|
77
|
+
|
|
75
78
|
return (
|
|
76
79
|
<div className="api-details-page">
|
|
77
80
|
<h2 className="welcome">Welcome to</h2>
|
|
@@ -104,9 +107,19 @@ export const TagPage = ({
|
|
|
104
107
|
</div>
|
|
105
108
|
|
|
106
109
|
<p className="api-desc">API Description</p>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
{onProductNavigate && (
|
|
111
|
+
<div className="api-product-tag">
|
|
112
|
+
Product with this API{' '}
|
|
113
|
+
<span
|
|
114
|
+
className="product-tag"
|
|
115
|
+
role="button"
|
|
116
|
+
tabIndex={-1}
|
|
117
|
+
onClick={() => onProductNavigate(data.associatedProduct.productId)}
|
|
118
|
+
>
|
|
119
|
+
{data.associatedProduct.name}
|
|
120
|
+
</span>
|
|
121
|
+
</div>
|
|
122
|
+
)}
|
|
110
123
|
|
|
111
124
|
<h3 className="section-title">Endpoints</h3>
|
|
112
125
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useState, useRef } from 'react'
|
|
2
|
-
import { Button, Size, Input
|
|
2
|
+
import { Button, Size, Input } from 'digitinary-ui'
|
|
3
3
|
import SVGLoader from '../../../components/SVGLoader/SVGLoader'
|
|
4
4
|
import {
|
|
5
5
|
FilterIcon,
|
|
6
6
|
BookIcon,
|
|
7
7
|
ApiIcon,
|
|
8
8
|
SearchIcon,
|
|
9
|
-
arrowDownGray,
|
|
10
9
|
UpArrowIcon,
|
|
11
10
|
DownArrowIcon,
|
|
12
11
|
} from '../../../assets/icons'
|
|
@@ -25,9 +24,7 @@ const DocsHeader: React.FC = ({
|
|
|
25
24
|
const [showSearchFilter, setShowSearchFilter] = useState<boolean>(false)
|
|
26
25
|
const [apiName, setApiName] = useState<string>('')
|
|
27
26
|
const [selectedMethods, setSelectedMethods] = useState<any[]>([])
|
|
28
|
-
const [methodListOpened, setMethodListOpened] = useState(false)
|
|
29
27
|
const [isMethodDropdownOpen, setIsMethodDropdownOpen] = useState<boolean>(false)
|
|
30
|
-
const selectRef = useRef<any>(null)
|
|
31
28
|
|
|
32
29
|
const handleOpenSearchFilter = (): void => {
|
|
33
30
|
setShowSearchFilter(true)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './style.scss'
|
|
2
|
-
import React, { useEffect,
|
|
2
|
+
import React, { useEffect, useRef } from 'react'
|
|
3
3
|
import SVGLoader from '../../../components/SVGLoader/SVGLoader'
|
|
4
4
|
import { arrowDownGray, arrowRightGray, document, eye } from '../../../assets/icons'
|
|
5
5
|
import { EndpointData, OverviewData } from 'src/layout/docsLayout'
|
|
@@ -16,6 +16,8 @@ const DocsSideMenuTree = ({
|
|
|
16
16
|
setActiveType,
|
|
17
17
|
toggleSection,
|
|
18
18
|
canSelectFirstApi,
|
|
19
|
+
canFocusSection,
|
|
20
|
+
setCanFocusSection,
|
|
19
21
|
}: {
|
|
20
22
|
apis: OverviewData[]
|
|
21
23
|
setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>
|
|
@@ -28,6 +30,8 @@ const DocsSideMenuTree = ({
|
|
|
28
30
|
activeType: 'OVERVIEW' | 'ENDPOINT'
|
|
29
31
|
toggleSection: (apiId: string, sectionId: string, resetOthers?: boolean, key?: string[]) => void
|
|
30
32
|
canSelectFirstApi?: boolean
|
|
33
|
+
canFocusSection: boolean
|
|
34
|
+
setCanFocusSection: React.Dispatch<React.SetStateAction<boolean>>
|
|
31
35
|
}) => {
|
|
32
36
|
// Auto-expand first API only once
|
|
33
37
|
useEffect(() => {
|
|
@@ -124,12 +128,19 @@ const DocsSideMenuTree = ({
|
|
|
124
128
|
activeItemData.api.id === api.apiSpecId &&
|
|
125
129
|
'path' in activeItemData &&
|
|
126
130
|
'method' in activeItemData
|
|
131
|
+
const sectionRef = useRef<HTMLDivElement>(null)
|
|
132
|
+
// Scroll to the section if it's expanded
|
|
133
|
+
if (canFocusSection && sectionRef?.current) {
|
|
134
|
+
sectionRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
135
|
+
setCanFocusSection(false)
|
|
136
|
+
}
|
|
127
137
|
|
|
128
138
|
return (
|
|
129
139
|
<div
|
|
130
140
|
key={api.apiSpecId}
|
|
131
141
|
className="api-docs-api-tree__section"
|
|
132
142
|
data-active={isEndpointActive || isOverviewExpanded}
|
|
143
|
+
ref={sectionRef}
|
|
133
144
|
>
|
|
134
145
|
<div
|
|
135
146
|
className="api-docs-api-tree__section-header"
|
|
@@ -8,6 +8,7 @@ import stableStringify from 'fast-json-stable-stringify'
|
|
|
8
8
|
interface ILayoutProps {
|
|
9
9
|
apis?: ApiSpecModel[]
|
|
10
10
|
activeApiId?: string
|
|
11
|
+
onProductNavigate?: (productId: number) => void
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export interface TagData {
|
|
@@ -46,7 +47,7 @@ function areEqual(prev: ILayoutProps, next: ILayoutProps): boolean {
|
|
|
46
47
|
)
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
const DocsLayout = ({ apis, activeApiId }: ILayoutProps): JSX.Element => {
|
|
50
|
+
const DocsLayout = ({ apis, activeApiId, onProductNavigate }: ILayoutProps): JSX.Element => {
|
|
50
51
|
const [transformedOpenApis, setTransformedOpenApis] = useState<OverviewData[]>([])
|
|
51
52
|
const [isFirstApiExpanded, setIsFirstApiExpanded] = useState(true)
|
|
52
53
|
const [activeItemData, setActiveItemData] = useState<
|
|
@@ -57,6 +58,7 @@ const DocsLayout = ({ apis, activeApiId }: ILayoutProps): JSX.Element => {
|
|
|
57
58
|
const allData = useRef([])
|
|
58
59
|
const [pending, setPending] = useState(true)
|
|
59
60
|
const [canSelectFirstApi, setCanSelectFirstApi] = useState(false)
|
|
61
|
+
const [canFocusSection, setCanFocusSection] = useState(false)
|
|
60
62
|
|
|
61
63
|
const toggleSection = (
|
|
62
64
|
apiId: string,
|
|
@@ -127,6 +129,7 @@ const DocsLayout = ({ apis, activeApiId }: ILayoutProps): JSX.Element => {
|
|
|
127
129
|
setActiveType('OVERVIEW')
|
|
128
130
|
setIsFirstApiExpanded(false)
|
|
129
131
|
setCanSelectFirstApi(true)
|
|
132
|
+
setCanFocusSection(true)
|
|
130
133
|
}
|
|
131
134
|
}, [activeApiId, transformedOpenApis])
|
|
132
135
|
|
|
@@ -154,6 +157,8 @@ const DocsLayout = ({ apis, activeApiId }: ILayoutProps): JSX.Element => {
|
|
|
154
157
|
setActiveType={setActiveType}
|
|
155
158
|
toggleSection={toggleSection}
|
|
156
159
|
canSelectFirstApi={canSelectFirstApi}
|
|
160
|
+
canFocusSection={canFocusSection}
|
|
161
|
+
setCanFocusSection={setCanFocusSection}
|
|
157
162
|
/>
|
|
158
163
|
)}
|
|
159
164
|
|
|
@@ -165,6 +170,7 @@ const DocsLayout = ({ apis, activeApiId }: ILayoutProps): JSX.Element => {
|
|
|
165
170
|
setActiveType={setActiveType}
|
|
166
171
|
setExpandedSections={setExpandedSections}
|
|
167
172
|
toggleSection={toggleSection}
|
|
173
|
+
onProductNavigate={onProductNavigate}
|
|
168
174
|
/>
|
|
169
175
|
)}
|
|
170
176
|
{activeType === 'ENDPOINT' && <Layout.DocsAside data={activeItemData as EndpointData} />}
|