import { CORE_LAYOUT_IDS } from "@medusajs/admin-shared" import { useLoaderData, useParams } from "react-router-dom" import { SingleColumnPageSkeleton } from "../../../components/common/skeleton" import { LayoutComposer, detailPageDefaultEntries, } from "../../../components/layout-composer" import { useApiKey } from "../../../hooks/api/api-keys" import { useFeatureFlag } from "../../../providers/feature-flag-provider" import { ApiKeyType } from "../common/constants" import { ApiKeyGeneralSection } from "./components/api-key-general-section" import { ApiKeySalesChannelSection } from "./components/api-key-sales-channel-section" import { ConfigurableApiKeySalesChannelSection } from "./components/api-key-sales-channel-section/configurable-api-key-sales-channel-section" import { apiKeyLoader } from "./loader" export const ApiKeyManagementDetail = () => { const initialData = useLoaderData() as Awaited< ReturnType > const { id } = useParams() const isViewConfigEnabled = useFeatureFlag("view_configurations") const { api_key, isLoading, isError, error } = useApiKey(id!, { initialData: initialData, }) if (isLoading || !api_key) { return } const isPublishable = api_key?.type === ApiKeyType.PUBLISHABLE if (isError) { throw error } return ( {isPublishable && ( {isViewConfigEnabled ? ( ) : ( )} )} {detailPageDefaultEntries(api_key, { metadata: false, permissions: false, })} ), }} /> ) }