@digi-frontend/dgate-api-documentation 1.0.55 → 1.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/_virtual/index10.js +1 -1
  2. package/dist/_virtual/index20.js +2 -0
  3. package/dist/_virtual/index20.js.map +1 -0
  4. package/dist/_virtual/index3.js +1 -1
  5. package/dist/_virtual/index4.js +1 -1
  6. package/dist/_virtual/index6.js +1 -1
  7. package/dist/_virtual/index7.js +1 -1
  8. package/dist/_virtual/index8.js +1 -1
  9. package/dist/_virtual/index9.js +1 -1
  10. package/dist/node_modules/dom-serializer/lib/index.js +1 -1
  11. package/dist/node_modules/dom-serializer/node_modules/entities/lib/index.js +1 -1
  12. package/dist/node_modules/domelementtype/lib/index.js +1 -1
  13. package/dist/node_modules/domhandler/lib/index.js +1 -1
  14. package/dist/node_modules/domutils/lib/index.js +1 -1
  15. package/dist/node_modules/fast-json-stable-stringify/index.js +2 -0
  16. package/dist/node_modules/fast-json-stable-stringify/index.js.map +1 -0
  17. package/dist/node_modules/formik/dist/formik.esm.js +1 -1
  18. package/dist/node_modules/html-dom-parser/lib/index.js +1 -1
  19. package/dist/node_modules/html-react-parser/esm/index.mjs.js +1 -1
  20. package/dist/node_modules/html-react-parser/esm/index.mjs.js.map +1 -1
  21. package/dist/node_modules/html-react-parser/lib/index.js +1 -1
  22. package/dist/node_modules/htmlparser2/dist/commonjs/index.js +1 -1
  23. package/dist/node_modules/react-is/index.js +1 -1
  24. package/dist/node_modules/react-property/lib/index.js +1 -1
  25. package/dist/node_modules/style-to-object/cjs/index.js +1 -1
  26. package/dist/node_modules/toposort/index.js +1 -1
  27. package/dist/node_modules/yup/index.esm.js +1 -1
  28. package/dist/src/assets/icons/CloseIcon.svg.js +2 -0
  29. package/dist/src/assets/icons/CloseIcon.svg.js.map +1 -0
  30. package/dist/src/components/InfoForm/InfoForm.js +1 -1
  31. package/dist/src/components/InfoForm/InfoForm.js.map +1 -1
  32. package/dist/src/components/MethodAccordion/MethodAccordion.js +1 -1
  33. package/dist/src/components/MethodAccordion/MethodAccordion.js.map +1 -1
  34. package/dist/src/components/dialog/index.js +1 -1
  35. package/dist/src/components/dialog/index.js.map +1 -1
  36. package/dist/src/layout/docsComponents/DocsContent/DocsContent.js +1 -1
  37. package/dist/src/layout/docsComponents/DocsContent/DocsContent.js.map +1 -1
  38. package/dist/src/layout/docsComponents/DocsContent/OverviewPage/index.js +2 -0
  39. package/dist/src/layout/docsComponents/DocsContent/OverviewPage/index.js.map +1 -0
  40. package/dist/src/layout/docsComponents/DocsHeader/DocsHeader.js +1 -1
  41. package/dist/src/layout/docsComponents/DocsHeader/DocsHeader.js.map +1 -1
  42. package/dist/src/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.js +1 -1
  43. package/dist/src/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.js.map +1 -1
  44. package/dist/src/layout/docsLayout.js +1 -1
  45. package/dist/src/layout/docsLayout.js.map +1 -1
  46. package/dist/styles.css +608 -607
  47. package/dist/types/components/dialog/dialog.d.ts +2 -0
  48. package/dist/types/components/dialog/index.d.ts +1 -1
  49. package/dist/types/layout/docsComponents/DocsContent/DocsContent.d.ts +2 -1
  50. package/dist/types/layout/docsComponents/DocsContent/OverviewPage/index.d.ts +9 -0
  51. package/dist/types/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.d.ts +3 -1
  52. package/dist/types/layout/docsLayout.d.ts +2 -1
  53. package/package.json +1 -1
  54. package/src/components/InfoForm/InfoForm.tsx +16 -16
  55. package/src/components/MethodAccordion/MethodAccordion.tsx +28 -12
  56. package/src/components/dialog/dialog.ts +3 -0
  57. package/src/components/dialog/index.tsx +7 -8
  58. package/src/layout/docsComponents/DocsContent/DocsContent.tsx +5 -2
  59. package/src/layout/docsComponents/DocsContent/{TagPage → OverviewPage}/index.tsx +17 -4
  60. package/src/layout/docsComponents/DocsContent/{TagPage → OverviewPage}/style.scss +1 -0
  61. package/src/layout/docsComponents/DocsHeader/DocsHeader.tsx +1 -4
  62. package/src/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.tsx +12 -1
  63. package/src/layout/docsLayout.tsx +7 -1
@@ -1,3 +1,4 @@
1
+ import { JSX } from 'react';
1
2
  export type DialogStatus = 'error' | 'info' | 'warning';
2
3
  export type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
4
  export type ButtonType = 'text' | 'submit' | 'reset';
@@ -42,4 +43,5 @@ export interface CommonDialogProps {
42
43
  submitBtnComponent?: JSX.Element | null;
43
44
  withClose?: boolean;
44
45
  noActions?: boolean;
46
+ closeIcon?: JSX.Element;
45
47
  }
@@ -1,4 +1,4 @@
1
1
  import './style.scss';
2
2
  import { CommonDialogProps } from './dialog';
3
- declare const CommonDialog: ({ status, content, onSubmit, onCancel, onClose, open, size, icon, noActions, }: CommonDialogProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const CommonDialog: ({ status, content, onSubmit, onCancel, onClose, open, size, icon, noActions, closeIcon, }: CommonDialogProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export default CommonDialog;
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import './style.scss';
3
3
  import { EndpointData, OverviewData } from 'src/layout/docsLayout';
4
- declare const DocsContent: ({ data, activeType, setActiveItemData, setActiveType, setExpandedSections, }: {
4
+ declare const DocsContent: ({ data, activeType, setActiveItemData, setActiveType, setExpandedSections, onProductNavigate, }: {
5
5
  data: OverviewData | EndpointData;
6
6
  activeType: "OVERVIEW" | "ENDPOINT";
7
7
  setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>;
8
8
  setActiveType: React.Dispatch<React.SetStateAction<"OVERVIEW" | "ENDPOINT">>;
9
9
  setExpandedSections: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
10
10
  toggleSection: (apiId: string, sectionId: string, resetOthers?: boolean, key?: string[]) => void;
11
+ onProductNavigate?: (productId: number) => void;
11
12
  }) => import("react/jsx-runtime").JSX.Element;
12
13
  export default DocsContent;
@@ -0,0 +1,9 @@
1
+ import './style.scss';
2
+ import { EndpointData, OverviewData } from 'src/layout/docsLayout';
3
+ export declare const OverviewPage: ({ data, setActiveItemData, setActiveType, setExpandedSections, onProductNavigate, }: {
4
+ data: OverviewData;
5
+ setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>;
6
+ setActiveType: React.Dispatch<React.SetStateAction<"OVERVIEW" | "ENDPOINT">>;
7
+ setExpandedSections: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
8
+ onProductNavigate?: (productId: number) => void;
9
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import './style.scss';
2
2
  import React from 'react';
3
3
  import { EndpointData, OverviewData } from 'src/layout/docsLayout';
4
- declare const DocsSideMenuTree: ({ apis, setActiveItemData, activeItemData, activeType, expandedSections, setExpandedSections, isFirstApiExpanded, setIsFirstApiExpanded, setActiveType, toggleSection, canSelectFirstApi, }: {
4
+ declare const DocsSideMenuTree: ({ apis, setActiveItemData, activeItemData, activeType, expandedSections, setExpandedSections, isFirstApiExpanded, setIsFirstApiExpanded, setActiveType, toggleSection, canSelectFirstApi, canFocusSection, setCanFocusSection, }: {
5
5
  apis: OverviewData[];
6
6
  setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>;
7
7
  activeItemData: OverviewData | EndpointData;
@@ -13,5 +13,7 @@ declare const DocsSideMenuTree: ({ apis, setActiveItemData, activeItemData, acti
13
13
  activeType: "OVERVIEW" | "ENDPOINT";
14
14
  toggleSection: (apiId: string, sectionId: string, resetOthers?: boolean, key?: string[]) => void;
15
15
  canSelectFirstApi?: boolean;
16
+ canFocusSection: boolean;
17
+ setCanFocusSection: React.Dispatch<React.SetStateAction<boolean>>;
16
18
  }) => import("react/jsx-runtime").JSX.Element;
17
19
  export default DocsSideMenuTree;
@@ -4,6 +4,7 @@ import { ApiSpecModel } from '@entities/index';
4
4
  interface ILayoutProps {
5
5
  apis?: ApiSpecModel[];
6
6
  activeApiId?: string;
7
+ onProductNavigate?: (productId: number) => void;
7
8
  }
8
9
  export interface TagData {
9
10
  id: string;
@@ -31,5 +32,5 @@ export interface OverviewData extends Omit<ApiSpecModel, 'metaData'> {
31
32
  tags: Record<string, TagData[]>;
32
33
  servers: OpenAPIFile['servers'];
33
34
  }
34
- declare const _default: React.MemoExoticComponent<({ apis, activeApiId }: ILayoutProps) => JSX.Element>;
35
+ declare const _default: React.MemoExoticComponent<({ apis, activeApiId, onProductNavigate }: ILayoutProps) => JSX.Element>;
35
36
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digi-frontend/dgate-api-documentation",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "main": "dist/src/index.js",
5
5
  "module": "dist/src/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -334,23 +334,23 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
334
334
 
335
335
  return (
336
336
  <form className={styles.apiInfoForm} onSubmit={(e) => e.preventDefault()}>
337
- <Input
338
- size="large"
339
- placeholder="e.g. Payments"
340
- label="API Name"
341
- required
342
- value={values?.info?.title}
343
- maxLength={35}
344
- onChange={(value) => {
345
- setFieldValue('info.title', value)
346
- }}
347
- onClear={() => {
348
- setFieldValue('info.title', '')
349
- }}
350
- errorMsg={errors?.info?.title}
351
- restrictedCharactersRegex={regex.basic}
352
- />
353
337
  <div className={styles.apiDocRow}>
338
+ <Input
339
+ size="large"
340
+ placeholder="e.g. Payments"
341
+ label="API Name"
342
+ required
343
+ value={values?.info?.title}
344
+ maxLength={35}
345
+ onChange={(value) => {
346
+ setFieldValue('info.title', value)
347
+ }}
348
+ onClear={() => {
349
+ setFieldValue('info.title', '')
350
+ }}
351
+ errorMsg={errors?.info?.title}
352
+ restrictedCharactersRegex={regex.basic}
353
+ />
354
354
  <Input size="large" label="Version" required value={values?.info?.version} disabled />
355
355
  </div>
356
356
  <TextArea
@@ -1,15 +1,13 @@
1
1
  import { useEffect, useRef, useState } from 'react'
2
- import {
3
- Accordion,
4
- Button,
5
- Input,
6
- SelectGroup,
7
- SelectGroupV2,
8
- Switch,
9
- TextArea,
10
- } from 'digitinary-ui'
2
+ import { Accordion, Button, Input, SelectGroup, Switch, TextArea } from 'digitinary-ui'
11
3
  import SVGLoader from '../../components/SVGLoader/SVGLoader'
12
- import { DeleteIcon, DownArrowIcon, EditIcon, DeleteOutlinedIcon } from '../../assets/icons'
4
+ import {
5
+ DeleteIcon,
6
+ DownArrowIcon,
7
+ EditIcon,
8
+ DeleteOutlinedIcon,
9
+ CloseIcon,
10
+ } from '../../assets/icons'
13
11
  import PlusIcon from '../../assets/icons/Plus.svg'
14
12
  import PlusSquare from '../../assets/icons/PlusSquare.svg'
15
13
  import { httpStatusCodes, methodColorMapping, paramsTableHeaders } from '../../constants/index'
@@ -1006,12 +1004,21 @@ const MethodsAccordion = ({
1006
1004
  }}
1007
1005
  onCancel={{
1008
1006
  text: 'Cancel',
1009
- color: 'normal',
1007
+ color: 'action',
1010
1008
  fullWidth: true,
1009
+ variant: 'outlined',
1011
1010
  }}
1012
1011
  onClose={() => setOpenDeleteDialog(false)}
1013
1012
  open={openDeleteDialog}
1014
1013
  icon={<SVGLoader src={DeleteOutlinedIcon} width="4.0625rem" height="4.0625rem" />}
1014
+ closeIcon={
1015
+ <SVGLoader
1016
+ src={CloseIcon}
1017
+ width="1.5rem"
1018
+ height="1.5rem"
1019
+ onClick={() => setOpenDeleteDialog(false)}
1020
+ />
1021
+ }
1015
1022
  />
1016
1023
  <CommonDialog
1017
1024
  status="error"
@@ -1041,12 +1048,21 @@ const MethodsAccordion = ({
1041
1048
  }}
1042
1049
  onCancel={{
1043
1050
  text: 'Cancel',
1044
- color: 'normal',
1051
+ color: 'action',
1045
1052
  fullWidth: true,
1053
+ variant: 'outlined',
1046
1054
  }}
1047
1055
  onClose={() => setOpenHeaderDeleteDialog(false)}
1048
1056
  open={openHeaderDeleteDialog}
1049
1057
  icon={<SVGLoader src={DeleteOutlinedIcon} width="4.0625rem" height="4.0625rem" />}
1058
+ closeIcon={
1059
+ <SVGLoader
1060
+ src={CloseIcon}
1061
+ width="1.5rem"
1062
+ height="1.5rem"
1063
+ onClick={() => setOpenDeleteDialog(false)}
1064
+ />
1065
+ }
1050
1066
  />
1051
1067
  </div>
1052
1068
  )
@@ -1,3 +1,5 @@
1
+ import { JSX } from 'react'
2
+
1
3
  export type DialogStatus = 'error' | 'info' | 'warning'
2
4
  export type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
3
5
  export type ButtonType = 'text' | 'submit' | 'reset'
@@ -55,4 +57,5 @@ export interface CommonDialogProps {
55
57
  submitBtnComponent?: JSX.Element | null
56
58
  withClose?: boolean
57
59
  noActions?: boolean
60
+ closeIcon?: JSX.Element
58
61
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  // @ts-ignore
3
- import { Dialog, Button, CloseIcon, infoIcon } from 'digitinary-ui'
3
+ import { Dialog, Button } from 'digitinary-ui'
4
4
  import SVGLoader from '../SVGLoader/SVGLoader'
5
5
  import './style.scss'
6
6
  import { CommonDialogProps } from './dialog'
@@ -20,6 +20,7 @@ const CommonDialog = ({
20
20
  </>
21
21
  ),
22
22
  noActions = false,
23
+ closeIcon,
23
24
  }: CommonDialogProps) => {
24
25
  const handleClose = () => {
25
26
  onClose() // Always close the dialog first
@@ -36,13 +37,11 @@ const CommonDialog = ({
36
37
  <div className={`icon ${status}`}>{icon}</div>
37
38
  </div>
38
39
  )}
39
- <SVGLoader
40
- src={Closecircle}
41
- width={'1.5rem'}
42
- height={'1.5rem'}
43
- onClick={handleClose}
44
- className="close-icon"
45
- />
40
+ <div className="close-icon">
41
+ {closeIcon ?? (
42
+ <SVGLoader src={Closecircle} width={'1.5rem'} height={'1.5rem'} onClick={handleClose} />
43
+ )}
44
+ </div>
46
45
 
47
46
  {content}
48
47
  {!!noActions ? null : (
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import './style.scss'
3
- import { TagPage } from './TagPage'
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
- <TagPage
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 TagPage = ({
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
- <div className="api-product-tag">
108
- Product with this API <span className="product-tag">{data.associatedProduct.name}</span>
109
- </div>
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
 
@@ -101,6 +101,7 @@
101
101
  font-size: 0.75rem;
102
102
  letter-spacing: 0px;
103
103
  margin-left: 0.5rem;
104
+ cursor: pointer;
104
105
  }
105
106
  }
106
107
 
@@ -1,12 +1,11 @@
1
1
  import React, { useState, useRef } from 'react'
2
- import { Button, Size, Input, SelectGroup } from 'digitinary-ui'
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, useState } from 'react'
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} />}