1 import { CORE_LAYOUT_IDS } from "@medusajs/admin-shared"
2 import { useLocation } from "react-router-dom"
3 import { getApiKeyTypeFromPathname } from "../common/utils"
4 import { ApiKeyManagementListTable } from "./components/api-key-management-list-table"
5 import { ConfigurableApiKeyManagementListTable } from "./components/api-key-management-list-table/configurable-api-key-management-list-table"
6
7 import { LayoutComposer } from "../../../components/layout-composer"
8 import { useFeatureFlag } from "../../../providers/feature-flag-provider"
9
10 export const ApiKeyManagementList = () => {
11 const { pathname } = useLocation()
12 const isViewConfigEnabled = useFeatureFlag("view_configurations")
13
14 const keyType = getApiKeyTypeFromPathname(pathname)
15
16 return (
17 <LayoutComposer
18 widgetsZonePrefix="api_key.list"
19 preferredLayoutId={CORE_LAYOUT_IDS.SINGLE_COLUMN}
20 sections={{
21 main: (
22 <LayoutComposer.Entry id="ApiKeyManagementListTable">
23 {isViewConfigEnabled ? (
24 <ConfigurableApiKeyManagementListTable keyType={keyType} />
25 ) : (
26 <ApiKeyManagementListTable keyType={keyType} />
27 )}
28 </LayoutComposer.Entry>
29 ),
30 }}
31 />
32 )
33 }