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AACU,SAAUA,KAG1B+D,EAAAA,cAACG,EAAAA,GAAM,KACLH,EAAAA,cAACI,EAAAA,GAAK,CAACC,KAAI,GAAAC,OAAKnE,EAAMkE,KAAI,uBAAuBE,OAAK,GACpDP,EAAAA,cAACQ,EAAAA,SAAQ,CAACC,SAAUT,EAAAA,cAACnF,EAAc,CAAC6F,SAAO,KACzCV,EAAAA,cAACxE,EAAI,QAGTwE,EAAAA,cAACI,EAAAA,GAAK,CAACC,KAAI,GAAAC,OAAKnE,EAAMkE,KAAI,oBAAoBE,OAAK,GACjDP,EAAAA,cAACQ,EAAAA,SAAQ,CAACC,SAAUT,EAAAA,cAACnF,EAAc,CAAC6F,SAAO,KACzCV,EAAAA,cAACxF,EAAI,KACHwF,EAAAA,cAAC1E,EAAgB,CACfqF,KAAMtC,EACNc,SAA0B,OAAhBpB,QAAgB,IAAhBA,OAAgB,EAAhBA,EAAkBoB,eAS9C,EAUA1D,EAAcmF,aAAe,CAC3BhF,cAAe,GACfC,UAAW,GACXC,SAAS,EACTC,YAAY,EACZC,YAAY,GAGd,S","sources":["webpack://dev-portal/./app/frontend/react/api_explorer/Components/EndpointGroup/endpointGroupHooks.js","webpack://dev-portal/./app/frontend/react/api_explorer/Components/EndpointGroup/styles.js","webpack://dev-portal/./app/frontend/react/api_explorer/Components/EndpointGroup/EndpointGroup.jsx","webpack://dev-portal/./app/frontend/react/api_explorer/Components/Sidebar/sidebarHooks.js"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { getResourceData } from '../../utils';\n\nconst HOME_REGEX = /\\/reference\\/rest(\\/v\\d)?\\/docs/;\n\nexport const useGroupData = ({\n currentBranch,\n devApiUrl,\n link,\n selectedResource,\n sidebar,\n location,\n}) => {\n const [endpointInfo, setEndpointInfo] = useState({});\n const [isError, setIsError] = useState(false);\n\n useEffect(() => {\n setEndpointInfo({});\n setIsError(false);\n if (\n sidebar?.length > 0 &&\n typeof selectedResource === 'undefined' &&\n !HOME_REGEX.test(location?.pathname)\n ) {\n setIsError(true);\n }\n if (link) {\n getResourceData({\n devApiUrl,\n branchName: currentBranch,\n link,\n }).then((resp) => {\n if (resp === null) {\n setIsError(true);\n setEndpointInfo([]);\n return;\n }\n setIsError(false);\n setEndpointInfo(resp?.data);\n });\n }\n }, [devApiUrl, currentBranch, link, selectedResource, sidebar, location]);\n return [endpointInfo, isError];\n};\n","import styled from 'styled-components';\nimport { Flex, Spinner } from '@procore/core-react';\n\nexport const Main = styled.main`\n display: flex;\n flex-direction: column;\n height: calc(100vh - 106px);\n overflow-y: scroll;\n position: relative;\n width: 100vw;\n`;\n\nexport const LoadingSpinner = styled(Spinner)`\n margin: auto;\n`;\n\nexport const AppContainer = styled(Flex)`\n height: calc(100vh - 106px);\n`;\n","import React, { useEffect, lazy, Suspense } from 'react';\nimport { bool, number, string } from 'prop-types';\nimport {\n Route,\n Switch,\n useHistory,\n useLocation,\n useRouteMatch,\n} from 'react-router-dom';\nimport { useBranchSelector } from '@/react/hooks';\nimport lazyWithRetry from '@/utils/lazyWithRetry';\nimport { useDocsSidebar } from '../Sidebar/sidebarHooks';\nimport { useGroupData } from './endpointGroupHooks';\nimport { trackEvent } from '../../../shared/analytics';\nimport { AppContainer, LoadingSpinner, Main } from './styles';\n\nconst Sidebar = lazy(() => lazyWithRetry(() => import('../Sidebar/Sidebar')));\nconst OpenApiEndpoints = lazy(() =>\n lazyWithRetry(() => import('../OpenApi/OpenApiEndpoints'))\n);\nconst FourZeroFour = lazy(() =>\n lazyWithRetry(() => import('@/react/shared/FourZeroFour'))\n);\n\nconst Docs = lazy(() => lazyWithRetry(() => import('./Docs')));\n\nconst EndpointGroup = ({\n currentBranch,\n devApiUrl,\n isAdmin,\n isEmployee,\n isSignedIn,\n}) => {\n const location = useLocation();\n const match = useRouteMatch();\n const history = useHistory();\n const locationAry = location.pathname.split('/');\n const currentGroup = locationAry[locationAry.length - 1];\n const params = new URLSearchParams(location.search);\n const fullVersion = params.get('version');\n\n const [branch] = useBranchSelector({\n currentBranch,\n isAdmin,\n isEmployee,\n });\n\n const [sidebar] = useDocsSidebar(\n {\n devApiUrl,\n },\n branch\n );\n\n const selectedResource = sidebar?.find(\n ({ resource_name_id }) => resource_name_id === currentGroup\n );\n\n const link = selectedResource?.links?.find((l) => l.search(fullVersion) > -1);\n\n const [endpointInfo, isError] = useGroupData({\n devApiUrl,\n currentBranch,\n link,\n selectedResource,\n sidebar,\n location,\n });\n\n useEffect(() => {\n if (selectedResource) {\n const latestVersion = Object.keys(selectedResource.versions).sort((a, b) =>\n b.replace(/\\d+/g, n => +n+1000 ).localeCompare(a.replace(/\\d+/g, n => +n+1000 ))\n )[0];\n const linkedVersion = params.get('version');\n if (\n !Object.keys(selectedResource?.versions).includes(linkedVersion) &&\n latestVersion\n ) {\n params.set('version', latestVersion);\n history.replace({ search: params.toString() });\n }\n }\n }, [fullVersion, params, sidebar, selectedResource]);\n\n useEffect(() => {\n if (isSignedIn) {\n trackEvent('developers.apps.reference.page_viewed', {\n page: currentGroup,\n });\n }\n }, [currentGroup, isSignedIn]);\n\n return (\n \n \n {isError ? (\n \n \n \n ) : (\n \n \n }>\n \n \n \n \n }>\n
\n \n
\n
\n
\n
\n )}\n
\n );\n};\n\nEndpointGroup.propTypes = {\n currentBranch: string,\n devApiUrl: string,\n isAdmin: bool,\n isEmployee: bool,\n isSignedIn: bool,\n};\n\nEndpointGroup.defaultProps = {\n currentBranch: '',\n devApiUrl: '',\n isAdmin: false,\n isEmployee: false,\n isSignedIn: false,\n};\n\nexport default EndpointGroup;\n","import { useEffect, useState } from 'react';\nimport { getIndexData } from '../../utils';\n\nexport const useDocsSidebar = ({ devApiUrl }, branchName) => {\n const [sidebar, setSidebar] = useState([]);\n useEffect(() => {\n getIndexData({\n devApiUrl,\n branchName,\n }).then((resp) => {\n if (resp) {\n setSidebar(resp.data);\n }\n });\n }, [devApiUrl, branchName]);\n return [sidebar, setSidebar];\n};\n"],"names":["HOME_REGEX","Main","styled","main","_templateObject","_taggedTemplateLiteral","LoadingSpinner","Spinner","_templateObject2","AppContainer","Flex","_templateObject3","Sidebar","lazy","lazyWithRetry","OpenApiEndpoints","FourZeroFour","Docs","EndpointGroup","_ref","_selectedResource$lin","currentBranch","devApiUrl","isAdmin","isEmployee","isSignedIn","location","useLocation","match","useRouteMatch","history","useHistory","locationAry","pathname","split","currentGroup","length","params","URLSearchParams","search","fullVersion","get","_useDocsSidebar","branchName","_useState2","_slicedToArray","useState","sidebar","setSidebar","useEffect","getIndexData","then","resp","data","useDocsSidebar","useBranchSelector","selectedResource","find","_ref2","resource_name_id","_useGroupData","link","endpointInfo","setEndpointInfo","_useState4","isError","setIsError","test","getResourceData","useGroupData","links","l","_useGroupData2","latestVersion","Object","keys","versions","sort","a","b","replace","n","localeCompare","linkedVersion","includes","set","toString","trackEvent","page","React","style","width","Switch","Route","path","concat","exact","Suspense","fallback","loading","spec","defaultProps"],"sourceRoot":""}