UNPKG

@redocly/graphql-docs

Version:

Redocly GraphQL docs

2 lines (1 loc) 1.54 kB
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{ThreePanelLayout as p,useMount as f}from"@redocly/theme";import"./polyfills.js";import{IS_BROWSER as h}from"./common/utils/is-browser.js";import{Box as d}from"./common/index.js";import{AppProviders as n}from"./app/index.js";import{DocsContent as u}from"./definition/index.js";import{AppRouter as y}from"./navigation/index.js";import{useGraphqlSchema as L}from"./schema/index.js";import{Sidebar as g}from"./sidebar/index.js";import{GraphQLDocsWrapper as j}from"./styled.js";import{useLicenseKey as D}from"../shared/license/use-license-key.js";import{useSettings as x}from"./settings/index.js";import{useTelemetry as G,usePerformanceMetrics as S}from"./hooks/index.js";function m(){const{layout:o}=x(),t=G();return S({sendTelemetry:s=>{const r=Object.fromEntries(Object.entries(s).map(([i,c])=>[i.toLowerCase(),c]));t.sendGraphqlDocsPerformanceMetricsMessage({cls:r.cls,lcp:r.lcp,fcp:r.fcp,ttfb:r.ttfb})}}),f(()=>{t.sendGraphqlDocsViewedMessage({layout:o})}),e(p,{layout:o,children:l(j,{children:[e(g,{}),e(u,{})]})})}function A({settings:o,withCommonStyles:t,...s}){const{schema:r,loading:i}=L(s.schema),{isValid:c,loading:a}=D(o?.licenseKey);return i||a?e("div",{children:"Loading..."}):c?h?e(n,{schema:r,settings:o,withCommonStyles:t,children:e(y,{children:e(m,{})})}):e(n,{schema:r,settings:o,withCommonStyles:t,children:e(m,{})}):e(d,{style:{height:"100vh"},align:"center",justify:"center",children:e("div",{children:"Invalid License Key"})})}export{A as RedoclyGraphQLDocs};