@kuadrant/kuadrant-backstage-plugin-frontend 0.0.1-test.1-1593c3ec
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.
- package/README.md +491 -0
- package/dist/components/ApiAccessCard/ApiAccessCard.esm.js +42 -0
- package/dist/components/ApiAccessCard/ApiAccessCard.esm.js.map +1 -0
- package/dist/components/ApiAccessCard/index.esm.js +2 -0
- package/dist/components/ApiAccessCard/index.esm.js.map +1 -0
- package/dist/components/ApiKeyManagementTab/ApiKeyManagementTab.esm.js +441 -0
- package/dist/components/ApiKeyManagementTab/ApiKeyManagementTab.esm.js.map +1 -0
- package/dist/components/ApiKeyManagementTab/index.esm.js +2 -0
- package/dist/components/ApiKeyManagementTab/index.esm.js.map +1 -0
- package/dist/components/ApiProductInfoCard/ApiProductInfoCard.esm.js +47 -0
- package/dist/components/ApiProductInfoCard/ApiProductInfoCard.esm.js.map +1 -0
- package/dist/components/ApiProductInfoCard/index.esm.js +2 -0
- package/dist/components/ApiProductInfoCard/index.esm.js.map +1 -0
- package/dist/components/ApprovalQueueCard/ApprovalQueueCard.esm.js +349 -0
- package/dist/components/ApprovalQueueCard/ApprovalQueueCard.esm.js.map +1 -0
- package/dist/components/ApprovalQueueCard/index.esm.js +2 -0
- package/dist/components/ApprovalQueueCard/index.esm.js.map +1 -0
- package/dist/components/CreateAPIProductDialog/CreateAPIProductDialog.esm.js +289 -0
- package/dist/components/CreateAPIProductDialog/CreateAPIProductDialog.esm.js.map +1 -0
- package/dist/components/KuadrantPage/KuadrantPage.esm.js +198 -0
- package/dist/components/KuadrantPage/KuadrantPage.esm.js.map +1 -0
- package/dist/components/KuadrantPage/index.esm.js +2 -0
- package/dist/components/KuadrantPage/index.esm.js.map +1 -0
- package/dist/components/PermissionGate/PermissionGate.esm.js +33 -0
- package/dist/components/PermissionGate/PermissionGate.esm.js.map +1 -0
- package/dist/components/PlanPolicyDetailPage/PlanPolicyDetailPage.esm.js +89 -0
- package/dist/components/PlanPolicyDetailPage/PlanPolicyDetailPage.esm.js.map +1 -0
- package/dist/components/PlanPolicyDetailPage/index.esm.js +2 -0
- package/dist/components/PlanPolicyDetailPage/index.esm.js.map +1 -0
- package/dist/hooks/useUserRole.esm.js +49 -0
- package/dist/hooks/useUserRole.esm.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.esm.js +6 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/plugin.esm.js +68 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/routes.esm.js +13 -0
- package/dist/routes.esm.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useParams, useNavigate } from 'react-router-dom';
|
|
3
|
+
import { Typography, Button, Grid, Box, Card, CardHeader, Chip, CardContent, Accordion, AccordionSummary, AccordionDetails } from '@material-ui/core';
|
|
4
|
+
import { Page, Header, Content, Progress, ResponseErrorPanel, InfoCard, CodeSnippet } from '@backstage/core-components';
|
|
5
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
6
|
+
import { useApi, configApiRef, fetchApiRef } from '@backstage/core-plugin-api';
|
|
7
|
+
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
|
8
|
+
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
9
|
+
|
|
10
|
+
const PlanPolicyDetailPage = () => {
|
|
11
|
+
const { namespace, name } = useParams();
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const config = useApi(configApiRef);
|
|
14
|
+
const fetchApi = useApi(fetchApiRef);
|
|
15
|
+
const backendUrl = config.getString("backend.baseUrl");
|
|
16
|
+
const { value: planPolicy, loading, error } = useAsync(async () => {
|
|
17
|
+
const response = await fetchApi.fetch(`${backendUrl}/api/kuadrant/planpolicies/${namespace}/${name}`);
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
throw new Error(`Failed to fetch PlanPolicy: ${response.status}`);
|
|
20
|
+
}
|
|
21
|
+
return await response.json();
|
|
22
|
+
}, [backendUrl, namespace, name, fetchApi]);
|
|
23
|
+
const formatLimits = (limits) => {
|
|
24
|
+
if (!limits) return [];
|
|
25
|
+
return Object.entries(limits).map(([period, value]) => `${value} per ${period}`);
|
|
26
|
+
};
|
|
27
|
+
if (loading) {
|
|
28
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Loading..." }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Progress, null)));
|
|
29
|
+
}
|
|
30
|
+
if (error) {
|
|
31
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Error" }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ResponseErrorPanel, { error })));
|
|
32
|
+
}
|
|
33
|
+
if (!planPolicy) {
|
|
34
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Not Found" }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Typography, null, "PlanPolicy not found")));
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: planPolicy.metadata.name, subtitle: `PlanPolicy in ${planPolicy.metadata.namespace}` }, /* @__PURE__ */ React.createElement(
|
|
37
|
+
Button,
|
|
38
|
+
{
|
|
39
|
+
variant: "outlined",
|
|
40
|
+
startIcon: /* @__PURE__ */ React.createElement(ArrowBackIcon, null),
|
|
41
|
+
onClick: () => navigate("/kuadrant")
|
|
42
|
+
},
|
|
43
|
+
"Back to Kuadrant"
|
|
44
|
+
)), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Target Reference" }, /* @__PURE__ */ React.createElement(Box, { p: 2 }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "Kind"), /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, /* @__PURE__ */ React.createElement("strong", null, planPolicy.spec.targetRef.kind))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "Name"), /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, /* @__PURE__ */ React.createElement("strong", null, planPolicy.spec.targetRef.name))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "Namespace"), /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, /* @__PURE__ */ React.createElement("strong", null, planPolicy.spec.targetRef.namespace || planPolicy.metadata.namespace))))))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Plan Tiers" }, /* @__PURE__ */ React.createElement(Box, { p: 2 }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, planPolicy.spec.plans.map((plan, index) => /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, md: 6, lg: 4, key: index }, /* @__PURE__ */ React.createElement(Card, { variant: "outlined" }, /* @__PURE__ */ React.createElement(
|
|
45
|
+
CardHeader,
|
|
46
|
+
{
|
|
47
|
+
title: /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center", style: { gap: 8 } }, /* @__PURE__ */ React.createElement(Chip, { label: plan.tier, color: "primary" }))
|
|
48
|
+
}
|
|
49
|
+
), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary", gutterBottom: true }, "Rate Limits"), plan.limits && formatLimits(plan.limits).map((limit, idx) => /* @__PURE__ */ React.createElement(Typography, { key: idx, variant: "body1", gutterBottom: true }, limit)), plan.predicate && /* @__PURE__ */ React.createElement(Box, { mt: 2 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary", gutterBottom: true }, "Predicate (CEL)"), /* @__PURE__ */ React.createElement(
|
|
50
|
+
Box,
|
|
51
|
+
{
|
|
52
|
+
p: 1,
|
|
53
|
+
style: {
|
|
54
|
+
backgroundColor: "#f5f5f5",
|
|
55
|
+
borderRadius: 4,
|
|
56
|
+
fontFamily: "monospace",
|
|
57
|
+
fontSize: "0.875rem",
|
|
58
|
+
overflow: "auto"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
/* @__PURE__ */ React.createElement("pre", { style: { margin: 0, whiteSpace: "pre-wrap", wordBreak: "break-word", color: "#333" } }, plan.predicate)
|
|
62
|
+
)))))))))), planPolicy.status?.conditions && planPolicy.status.conditions.length > 0 && /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(InfoCard, { title: "Status Conditions" }, /* @__PURE__ */ React.createElement(Box, { p: 2 }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, planPolicy.status.conditions.map((condition, index) => /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, key: index }, /* @__PURE__ */ React.createElement(
|
|
63
|
+
Card,
|
|
64
|
+
{
|
|
65
|
+
variant: "outlined",
|
|
66
|
+
style: {
|
|
67
|
+
borderColor: condition.status === "True" ? "#4caf50" : condition.status === "False" ? "#f44336" : "#ff9800"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
/* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React.createElement(Typography, { variant: "h6" }, condition.type), /* @__PURE__ */ React.createElement(
|
|
71
|
+
Chip,
|
|
72
|
+
{
|
|
73
|
+
label: condition.status,
|
|
74
|
+
color: condition.status === "True" ? "primary" : "default",
|
|
75
|
+
size: "small"
|
|
76
|
+
}
|
|
77
|
+
)), condition.reason && /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary", style: { marginTop: 8 } }, /* @__PURE__ */ React.createElement("strong", null, "Reason:"), " ", condition.reason), condition.message && /* @__PURE__ */ React.createElement(Typography, { variant: "body2", style: { marginTop: 4 } }, condition.message), condition.lastTransitionTime && /* @__PURE__ */ React.createElement(Typography, { variant: "caption", color: "textSecondary", style: { marginTop: 8, display: "block" } }, "Last transition: ", new Date(condition.lastTransitionTime).toLocaleString()))
|
|
78
|
+
))))))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Accordion, null, /* @__PURE__ */ React.createElement(AccordionSummary, { expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null) }, /* @__PURE__ */ React.createElement(Typography, { variant: "h6" }, "View Full YAML")), /* @__PURE__ */ React.createElement(AccordionDetails, null, /* @__PURE__ */ React.createElement(Box, { width: "100%" }, /* @__PURE__ */ React.createElement(
|
|
79
|
+
CodeSnippet,
|
|
80
|
+
{
|
|
81
|
+
text: JSON.stringify(planPolicy, null, 2),
|
|
82
|
+
language: "yaml",
|
|
83
|
+
showCopyCodeButton: true
|
|
84
|
+
}
|
|
85
|
+
))))))));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { PlanPolicyDetailPage };
|
|
89
|
+
//# sourceMappingURL=PlanPolicyDetailPage.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanPolicyDetailPage.esm.js","sources":["../../../src/components/PlanPolicyDetailPage/PlanPolicyDetailPage.tsx"],"sourcesContent":["import React from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport { Typography, Box, Card, CardContent, CardHeader, Grid, Chip, Button, Accordion, AccordionSummary, AccordionDetails } from '@material-ui/core';\nimport {\n Header,\n Page,\n Content,\n Progress,\n ResponseErrorPanel,\n CodeSnippet,\n InfoCard,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/lib/useAsync';\nimport { useApi, configApiRef, fetchApiRef } from '@backstage/core-plugin-api';\nimport ArrowBackIcon from '@material-ui/icons/ArrowBack';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { PlanPolicy } from '../../types/api-management';\n\nexport const PlanPolicyDetailPage = () => {\n const { namespace, name } = useParams<{\n namespace: string;\n name: string;\n }>();\n const navigate = useNavigate();\n const config = useApi(configApiRef);\n const fetchApi = useApi(fetchApiRef);\n const backendUrl = config.getString('backend.baseUrl');\n\n const { value: planPolicy, loading, error } = useAsync(async (): Promise<PlanPolicy> => {\n const response = await fetchApi.fetch(`${backendUrl}/api/kuadrant/planpolicies/${namespace}/${name}`);\n if (!response.ok) {\n throw new Error(`Failed to fetch PlanPolicy: ${response.status}`);\n }\n return await response.json();\n }, [backendUrl, namespace, name, fetchApi]);\n\n const formatLimits = (limits: any): string[] => {\n if (!limits) return [];\n return Object.entries(limits).map(([period, value]) => `${value} per ${period}`);\n };\n\n if (loading) {\n return (\n <Page themeId=\"tool\">\n <Header title=\"Loading...\" />\n <Content>\n <Progress />\n </Content>\n </Page>\n );\n }\n\n if (error) {\n return (\n <Page themeId=\"tool\">\n <Header title=\"Error\" />\n <Content>\n <ResponseErrorPanel error={error} />\n </Content>\n </Page>\n );\n }\n\n if (!planPolicy) {\n return (\n <Page themeId=\"tool\">\n <Header title=\"Not Found\" />\n <Content>\n <Typography>PlanPolicy not found</Typography>\n </Content>\n </Page>\n );\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title={planPolicy.metadata.name} subtitle={`PlanPolicy in ${planPolicy.metadata.namespace}`}>\n <Button\n variant=\"outlined\"\n startIcon={<ArrowBackIcon />}\n onClick={() => navigate('/kuadrant')}\n >\n Back to Kuadrant\n </Button>\n </Header>\n <Content>\n <Grid container spacing={3}>\n {/* Target Reference Section */}\n <Grid item xs={12}>\n <InfoCard title=\"Target Reference\">\n <Box p={2}>\n <Grid container spacing={2}>\n <Grid item xs={12} md={4}>\n <Typography variant=\"body2\" color=\"textSecondary\">\n Kind\n </Typography>\n <Typography variant=\"body1\">\n <strong>{planPolicy.spec.targetRef.kind}</strong>\n </Typography>\n </Grid>\n <Grid item xs={12} md={4}>\n <Typography variant=\"body2\" color=\"textSecondary\">\n Name\n </Typography>\n <Typography variant=\"body1\">\n <strong>{planPolicy.spec.targetRef.name}</strong>\n </Typography>\n </Grid>\n <Grid item xs={12} md={4}>\n <Typography variant=\"body2\" color=\"textSecondary\">\n Namespace\n </Typography>\n <Typography variant=\"body1\">\n <strong>{planPolicy.spec.targetRef.namespace || planPolicy.metadata.namespace}</strong>\n </Typography>\n </Grid>\n </Grid>\n </Box>\n </InfoCard>\n </Grid>\n\n {/* Plan Tiers Section */}\n <Grid item xs={12}>\n <InfoCard title=\"Plan Tiers\">\n <Box p={2}>\n <Grid container spacing={2}>\n {planPolicy.spec.plans.map((plan, index) => (\n <Grid item xs={12} md={6} lg={4} key={index}>\n <Card variant=\"outlined\">\n <CardHeader\n title={\n <Box display=\"flex\" alignItems=\"center\" style={{ gap: 8 }}>\n <Chip label={plan.tier} color=\"primary\" />\n </Box>\n }\n />\n <CardContent>\n {/* Rate Limits */}\n <Typography variant=\"body2\" color=\"textSecondary\" gutterBottom>\n Rate Limits\n </Typography>\n {plan.limits && formatLimits(plan.limits).map((limit, idx) => (\n <Typography key={idx} variant=\"body1\" gutterBottom>\n {limit}\n </Typography>\n ))}\n\n {/* Predicate */}\n {plan.predicate && (\n <Box mt={2}>\n <Typography variant=\"body2\" color=\"textSecondary\" gutterBottom>\n Predicate (CEL)\n </Typography>\n <Box\n p={1}\n style={{\n backgroundColor: '#f5f5f5',\n borderRadius: 4,\n fontFamily: 'monospace',\n fontSize: '0.875rem',\n overflow: 'auto'\n }}\n >\n <pre style={{ margin: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-word', color: '#333' }}>\n {plan.predicate}\n </pre>\n </Box>\n </Box>\n )}\n </CardContent>\n </Card>\n </Grid>\n ))}\n </Grid>\n </Box>\n </InfoCard>\n </Grid>\n\n {/* Status Conditions Section */}\n {planPolicy.status?.conditions && planPolicy.status.conditions.length > 0 && (\n <Grid item xs={12}>\n <InfoCard title=\"Status Conditions\">\n <Box p={2}>\n <Grid container spacing={2}>\n {planPolicy.status.conditions.map((condition, index) => (\n <Grid item xs={12} key={index}>\n <Card\n variant=\"outlined\"\n style={{\n borderColor: condition.status === 'True' ? '#4caf50' :\n condition.status === 'False' ? '#f44336' : '#ff9800'\n }}\n >\n <CardContent>\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"space-between\">\n <Typography variant=\"h6\">{condition.type}</Typography>\n <Chip\n label={condition.status}\n color={condition.status === 'True' ? 'primary' : 'default'}\n size=\"small\"\n />\n </Box>\n {condition.reason && (\n <Typography variant=\"body2\" color=\"textSecondary\" style={{ marginTop: 8 }}>\n <strong>Reason:</strong> {condition.reason}\n </Typography>\n )}\n {condition.message && (\n <Typography variant=\"body2\" style={{ marginTop: 4 }}>\n {condition.message}\n </Typography>\n )}\n {condition.lastTransitionTime && (\n <Typography variant=\"caption\" color=\"textSecondary\" style={{ marginTop: 8, display: 'block' }}>\n Last transition: {new Date(condition.lastTransitionTime).toLocaleString()}\n </Typography>\n )}\n </CardContent>\n </Card>\n </Grid>\n ))}\n </Grid>\n </Box>\n </InfoCard>\n </Grid>\n )}\n\n {/* YAML View Section */}\n <Grid item xs={12}>\n <Accordion>\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <Typography variant=\"h6\">View Full YAML</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <Box width=\"100%\">\n <CodeSnippet\n text={JSON.stringify(planPolicy, null, 2)}\n language=\"yaml\"\n showCopyCodeButton\n />\n </Box>\n </AccordionDetails>\n </Accordion>\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"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B,EAAA;AAAA;AAAA,GAEtB,CACF,CACF,CACF,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useApi, identityApiRef } from '@backstage/core-plugin-api';
|
|
2
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
3
|
+
|
|
4
|
+
function useUserRole() {
|
|
5
|
+
const identityApi = useApi(identityApiRef);
|
|
6
|
+
const { value, loading } = useAsync(async () => {
|
|
7
|
+
try {
|
|
8
|
+
const identity = await identityApi.getBackstageIdentity();
|
|
9
|
+
const userId = identity.userEntityRef.split("/")[1] || "guest";
|
|
10
|
+
const ownershipRefs = identity.ownershipEntityRefs || [];
|
|
11
|
+
console.log("useUserRole debug:", { userId, ownershipRefs });
|
|
12
|
+
const isPlatformEngineer = ownershipRefs.includes("group:default/platform-engineers") || ownershipRefs.includes("group:default/platform-admins");
|
|
13
|
+
const isApiOwner = ownershipRefs.includes("group:default/api-owners") || ownershipRefs.includes("group:default/app-developers");
|
|
14
|
+
const isApiConsumer = ownershipRefs.includes("group:default/api-consumers");
|
|
15
|
+
let role = "unknown";
|
|
16
|
+
if (isPlatformEngineer) {
|
|
17
|
+
role = "platform-engineer";
|
|
18
|
+
} else if (isApiOwner) {
|
|
19
|
+
role = "api-owner";
|
|
20
|
+
} else if (isApiConsumer) {
|
|
21
|
+
role = "api-consumer";
|
|
22
|
+
}
|
|
23
|
+
console.log("useUserRole result:", { role, isPlatformEngineer, isApiOwner, isApiConsumer });
|
|
24
|
+
return {
|
|
25
|
+
userId,
|
|
26
|
+
role,
|
|
27
|
+
isPlatformEngineer,
|
|
28
|
+
isApiOwner,
|
|
29
|
+
isApiConsumer
|
|
30
|
+
};
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.log("useUserRole error, returning guest with full access:", error);
|
|
33
|
+
return {
|
|
34
|
+
userId: "guest",
|
|
35
|
+
role: "platform-engineer",
|
|
36
|
+
isPlatformEngineer: true,
|
|
37
|
+
isApiOwner: true,
|
|
38
|
+
isApiConsumer: true
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}, [identityApi]);
|
|
42
|
+
return {
|
|
43
|
+
userInfo: value || null,
|
|
44
|
+
loading
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { useUserRole };
|
|
49
|
+
//# sourceMappingURL=useUserRole.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserRole.esm.js","sources":["../../src/hooks/useUserRole.ts"],"sourcesContent":["import { useApi, identityApiRef } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\n\nexport type UserRole = 'platform-engineer' | 'api-owner' | 'api-consumer' | 'unknown';\n\nexport interface UserInfo {\n userId: string;\n role: UserRole;\n isPlatformEngineer: boolean;\n isApiOwner: boolean;\n isApiConsumer: boolean;\n}\n\nexport function useUserRole(): { userInfo: UserInfo | null; loading: boolean } {\n const identityApi = useApi(identityApiRef);\n\n const { value, loading } = useAsync(async () => {\n try {\n const identity = await identityApi.getBackstageIdentity();\n const userId = identity.userEntityRef.split('/')[1] || 'guest';\n const ownershipRefs = identity.ownershipEntityRefs || [];\n\n console.log('useUserRole debug:', { userId, ownershipRefs });\n\n // determine roles based on group membership (not hierarchical)\n const isPlatformEngineer = ownershipRefs.includes('group:default/platform-engineers') ||\n ownershipRefs.includes('group:default/platform-admins');\n\n const isApiOwner = ownershipRefs.includes('group:default/api-owners') ||\n ownershipRefs.includes('group:default/app-developers');\n\n const isApiConsumer = ownershipRefs.includes('group:default/api-consumers');\n\n // primary role (for display)\n let role: UserRole = 'unknown';\n if (isPlatformEngineer) {\n role = 'platform-engineer';\n } else if (isApiOwner) {\n role = 'api-owner';\n } else if (isApiConsumer) {\n role = 'api-consumer';\n }\n\n console.log('useUserRole result:', { role, isPlatformEngineer, isApiOwner, isApiConsumer });\n\n return {\n userId,\n role,\n isPlatformEngineer,\n isApiOwner,\n isApiConsumer,\n };\n } catch (error) {\n console.log('useUserRole error, returning guest with full access:', error);\n // in dev mode without auth backend, return default guest with full access\n return {\n userId: 'guest',\n role: 'platform-engineer' as UserRole,\n isPlatformEngineer: true,\n isApiOwner: true,\n isApiConsumer: true,\n };\n }\n }, [identityApi]);\n\n return {\n userInfo: value || null,\n loading,\n };\n}\n"],"names":[],"mappings":";;;AAaO,SAAS,WAA+D,GAAA;AAC7E,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AAEzC,EAAA,MAAM,EAAE,KAAA,EAAO,OAAQ,EAAA,GAAI,SAAS,YAAY;AAC9C,IAAI,IAAA;AACF,MAAM,MAAA,QAAA,GAAW,MAAM,WAAA,CAAY,oBAAqB,EAAA;AACxD,MAAA,MAAM,SAAS,QAAS,CAAA,aAAA,CAAc,MAAM,GAAG,CAAA,CAAE,CAAC,CAAK,IAAA,OAAA;AACvD,MAAM,MAAA,aAAA,GAAgB,QAAS,CAAA,mBAAA,IAAuB,EAAC;AAEvD,MAAA,OAAA,CAAQ,GAAI,CAAA,oBAAA,EAAsB,EAAE,MAAA,EAAQ,eAAe,CAAA;AAG3D,MAAA,MAAM,qBAAqB,aAAc,CAAA,QAAA,CAAS,kCAAkC,CACzD,IAAA,aAAA,CAAc,SAAS,+BAA+B,CAAA;AAEjF,MAAA,MAAM,aAAa,aAAc,CAAA,QAAA,CAAS,0BAA0B,CACjD,IAAA,aAAA,CAAc,SAAS,8BAA8B,CAAA;AAExE,MAAM,MAAA,aAAA,GAAgB,aAAc,CAAA,QAAA,CAAS,6BAA6B,CAAA;AAG1E,MAAA,IAAI,IAAiB,GAAA,SAAA;AACrB,MAAA,IAAI,kBAAoB,EAAA;AACtB,QAAO,IAAA,GAAA,mBAAA;AAAA,iBACE,UAAY,EAAA;AACrB,QAAO,IAAA,GAAA,WAAA;AAAA,iBACE,aAAe,EAAA;AACxB,QAAO,IAAA,GAAA,cAAA;AAAA;AAGT,MAAA,OAAA,CAAQ,IAAI,qBAAuB,EAAA,EAAE,MAAM,kBAAoB,EAAA,UAAA,EAAY,eAAe,CAAA;AAE1F,MAAO,OAAA;AAAA,QACL,MAAA;AAAA,QACA,IAAA;AAAA,QACA,kBAAA;AAAA,QACA,UAAA;AAAA,QACA;AAAA,OACF;AAAA,aACO,KAAO,EAAA;AACd,MAAQ,OAAA,CAAA,GAAA,CAAI,wDAAwD,KAAK,CAAA;AAEzE,MAAO,OAAA;AAAA,QACL,MAAQ,EAAA,OAAA;AAAA,QACR,IAAM,EAAA,mBAAA;AAAA,QACN,kBAAoB,EAAA,IAAA;AAAA,QACpB,UAAY,EAAA,IAAA;AAAA,QACZ,aAAe,EAAA;AAAA,OACjB;AAAA;AACF,GACF,EAAG,CAAC,WAAW,CAAC,CAAA;AAEhB,EAAO,OAAA;AAAA,IACL,UAAU,KAAS,IAAA,IAAA;AAAA,IACnB;AAAA,GACF;AACF;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default from 'react';
|
|
3
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
|
+
|
|
5
|
+
interface ApiKeyManagementTabProps {
|
|
6
|
+
namespace?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const ApiKeyManagementTab: ({ namespace: propNamespace }: ApiKeyManagementTabProps) => react__default.JSX.Element;
|
|
9
|
+
|
|
10
|
+
interface ApiAccessCardProps {
|
|
11
|
+
namespace?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const ApiAccessCard: ({ namespace: propNamespace }: ApiAccessCardProps) => react__default.JSX.Element;
|
|
14
|
+
|
|
15
|
+
declare const kuadrantPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
16
|
+
root: _backstage_core_plugin_api.RouteRef<undefined>;
|
|
17
|
+
resource: _backstage_core_plugin_api.SubRouteRef<_backstage_core_plugin_api.PathParams<"/:kind/:namespace/:name">>;
|
|
18
|
+
}, {}, {}>;
|
|
19
|
+
declare const KuadrantPage: () => react.JSX.Element;
|
|
20
|
+
declare const EntityKuadrantApiAccessCard: ({ namespace: propNamespace }: ApiAccessCardProps) => react.JSX.Element;
|
|
21
|
+
declare const EntityKuadrantApiKeyManagementTab: ({ namespace: propNamespace }: ApiKeyManagementTabProps) => react.JSX.Element;
|
|
22
|
+
declare const EntityKuadrantApiKeysContent: ({ namespace: propNamespace }: ApiKeyManagementTabProps) => react.JSX.Element;
|
|
23
|
+
declare const KuadrantApprovalQueueCard: () => react.JSX.Element;
|
|
24
|
+
declare const EntityKuadrantApiProductInfoContent: () => react.JSX.Element;
|
|
25
|
+
declare const PlanPolicyDetailPage: () => react.JSX.Element;
|
|
26
|
+
|
|
27
|
+
declare const ApiProductInfoCard: () => react__default.JSX.Element;
|
|
28
|
+
|
|
29
|
+
declare const ApprovalQueueCard: () => react__default.JSX.Element;
|
|
30
|
+
|
|
31
|
+
export { ApiAccessCard, ApiKeyManagementTab, ApiProductInfoCard, ApprovalQueueCard, EntityKuadrantApiAccessCard, EntityKuadrantApiKeyManagementTab, EntityKuadrantApiKeysContent, EntityKuadrantApiProductInfoContent, KuadrantApprovalQueueCard, KuadrantPage, PlanPolicyDetailPage, kuadrantPlugin };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { EntityKuadrantApiAccessCard, EntityKuadrantApiKeyManagementTab, EntityKuadrantApiKeysContent, EntityKuadrantApiProductInfoContent, KuadrantApprovalQueueCard, KuadrantPage, PlanPolicyDetailPage, kuadrantPlugin } from './plugin.esm.js';
|
|
2
|
+
export { ApiAccessCard } from './components/ApiAccessCard/ApiAccessCard.esm.js';
|
|
3
|
+
export { ApiKeyManagementTab } from './components/ApiKeyManagementTab/ApiKeyManagementTab.esm.js';
|
|
4
|
+
export { ApiProductInfoCard } from './components/ApiProductInfoCard/ApiProductInfoCard.esm.js';
|
|
5
|
+
export { ApprovalQueueCard } from './components/ApprovalQueueCard/ApprovalQueueCard.esm.js';
|
|
6
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createPlugin, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
2
|
+
import { rootRouteRef, resourceRouteRef } from './routes.esm.js';
|
|
3
|
+
|
|
4
|
+
const kuadrantPlugin = createPlugin({
|
|
5
|
+
id: "kuadrant",
|
|
6
|
+
routes: {
|
|
7
|
+
root: rootRouteRef,
|
|
8
|
+
resource: resourceRouteRef
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const KuadrantPage = kuadrantPlugin.provide(
|
|
12
|
+
createRoutableExtension({
|
|
13
|
+
name: "KuadrantPage",
|
|
14
|
+
component: () => import('./components/KuadrantPage/index.esm.js').then((m) => m.KuadrantPage),
|
|
15
|
+
mountPoint: rootRouteRef
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
const EntityKuadrantApiAccessCard = kuadrantPlugin.provide(
|
|
19
|
+
createComponentExtension({
|
|
20
|
+
name: "EntityKuadrantApiAccessCard",
|
|
21
|
+
component: {
|
|
22
|
+
lazy: () => import('./components/ApiAccessCard/index.esm.js').then((m) => m.ApiAccessCard)
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
const EntityKuadrantApiKeyManagementTab = kuadrantPlugin.provide(
|
|
27
|
+
createComponentExtension({
|
|
28
|
+
name: "EntityKuadrantApiKeyManagementTab",
|
|
29
|
+
component: {
|
|
30
|
+
lazy: () => import('./components/ApiKeyManagementTab/index.esm.js').then((m) => m.ApiKeyManagementTab)
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
const EntityKuadrantApiKeysContent = kuadrantPlugin.provide(
|
|
35
|
+
createComponentExtension({
|
|
36
|
+
name: "EntityKuadrantApiKeysContent",
|
|
37
|
+
component: {
|
|
38
|
+
lazy: () => import('./components/ApiKeyManagementTab/index.esm.js').then((m) => m.ApiKeyManagementTab)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
const KuadrantApprovalQueueCard = kuadrantPlugin.provide(
|
|
43
|
+
createComponentExtension({
|
|
44
|
+
name: "KuadrantApprovalQueueCard",
|
|
45
|
+
component: {
|
|
46
|
+
lazy: () => import('./components/ApprovalQueueCard/index.esm.js').then((m) => m.ApprovalQueueCard)
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
const EntityKuadrantApiProductInfoContent = kuadrantPlugin.provide(
|
|
51
|
+
createComponentExtension({
|
|
52
|
+
name: "EntityKuadrantApiProductInfoContent",
|
|
53
|
+
component: {
|
|
54
|
+
lazy: () => import('./components/ApiProductInfoCard/index.esm.js').then((m) => m.ApiProductInfoCard)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
const PlanPolicyDetailPage = kuadrantPlugin.provide(
|
|
59
|
+
createComponentExtension({
|
|
60
|
+
name: "PlanPolicyDetailPage",
|
|
61
|
+
component: {
|
|
62
|
+
lazy: () => import('./components/PlanPolicyDetailPage/index.esm.js').then((m) => m.PlanPolicyDetailPage)
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
export { EntityKuadrantApiAccessCard, EntityKuadrantApiKeyManagementTab, EntityKuadrantApiKeysContent, EntityKuadrantApiProductInfoContent, KuadrantApprovalQueueCard, KuadrantPage, PlanPolicyDetailPage, kuadrantPlugin };
|
|
68
|
+
//# sourceMappingURL=plugin.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["import {\n createPlugin,\n createRoutableExtension,\n createComponentExtension,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef, resourceRouteRef } from './routes';\n\nexport const kuadrantPlugin = createPlugin({\n id: 'kuadrant',\n routes: {\n root: rootRouteRef,\n resource: resourceRouteRef,\n },\n});\n\nexport const KuadrantPage = kuadrantPlugin.provide(\n createRoutableExtension({\n name: 'KuadrantPage',\n component: () =>\n import('./components/KuadrantPage').then(m => m.KuadrantPage),\n mountPoint: rootRouteRef,\n }),\n);\n\nexport const EntityKuadrantApiAccessCard = kuadrantPlugin.provide(\n createComponentExtension({\n name: 'EntityKuadrantApiAccessCard',\n component: {\n lazy: () =>\n import('./components/ApiAccessCard').then(m => m.ApiAccessCard),\n },\n }),\n);\n\nexport const EntityKuadrantApiKeyManagementTab = kuadrantPlugin.provide(\n createComponentExtension({\n name: 'EntityKuadrantApiKeyManagementTab',\n component: {\n lazy: () =>\n import('./components/ApiKeyManagementTab').then(m => m.ApiKeyManagementTab),\n },\n }),\n);\n\n// entity content extension for api keys tab\nexport const EntityKuadrantApiKeysContent = kuadrantPlugin.provide(\n createComponentExtension({\n name: 'EntityKuadrantApiKeysContent',\n component: {\n lazy: () =>\n import('./components/ApiKeyManagementTab').then(m => m.ApiKeyManagementTab),\n },\n }),\n);\n\nexport const KuadrantApprovalQueueCard = kuadrantPlugin.provide(\n createComponentExtension({\n name: 'KuadrantApprovalQueueCard',\n component: {\n lazy: () =>\n import('./components/ApprovalQueueCard').then(m => m.ApprovalQueueCard),\n },\n }),\n);\n\nexport const EntityKuadrantApiProductInfoContent = kuadrantPlugin.provide(\n createComponentExtension({\n name: 'EntityKuadrantApiProductInfoContent',\n component: {\n lazy: () =>\n import('./components/ApiProductInfoCard').then(m => m.ApiProductInfoCard),\n },\n }),\n);\n\nexport const PlanPolicyDetailPage = kuadrantPlugin.provide(\n createComponentExtension({\n name: 'PlanPolicyDetailPage',\n component: {\n lazy: () =>\n import('./components/PlanPolicyDetailPage').then(m => m.PlanPolicyDetailPage),\n },\n }),\n);\n"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A,MACT,IAAA,EAAM,MACJ,OAAO,6CAAgC,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,iBAAiB;AAAA;AAC1E,GACD;AACH;AAEO,MAAM,sCAAsC,cAAe,CAAA,OAAA;AAAA,EAChE,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,qCAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,8CAAiC,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,kBAAkB;AAAA;AAC5E,GACD;AACH;AAEO,MAAM,uBAAuB,cAAe,CAAA,OAAA;AAAA,EACjD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,sBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,gDAAmC,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,oBAAoB;AAAA;AAChF,GACD;AACH;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';
|
|
2
|
+
|
|
3
|
+
const rootRouteRef = createRouteRef({
|
|
4
|
+
id: "kuadrant"
|
|
5
|
+
});
|
|
6
|
+
const resourceRouteRef = createSubRouteRef({
|
|
7
|
+
id: "kuadrant/resource",
|
|
8
|
+
parent: rootRouteRef,
|
|
9
|
+
path: "/:kind/:namespace/:name"
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { resourceRouteRef, rootRouteRef };
|
|
13
|
+
//# sourceMappingURL=routes.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["import { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'kuadrant',\n});\n\nexport const resourceRouteRef = createSubRouteRef({\n id: 'kuadrant/resource',\n parent: rootRouteRef,\n path: '/:kind/:namespace/:name',\n});\n"],"names":[],"mappings":";;AAEO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;AAEM,MAAM,mBAAmB,iBAAkB,CAAA;AAAA,EAChD,EAAI,EAAA,mBAAA;AAAA,EACJ,MAAQ,EAAA,YAAA;AAAA,EACR,IAAM,EAAA;AACR,CAAC;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kuadrant/kuadrant-backstage-plugin-frontend",
|
|
3
|
+
"version": "0.0.1-test.1-1593c3ec",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Kuadrant/kuadrant-backstage-plugin.git",
|
|
8
|
+
"directory": "plugins/kuadrant"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.esm.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public",
|
|
14
|
+
"main": "dist/index.esm.js",
|
|
15
|
+
"types": "dist/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"backstage": {
|
|
18
|
+
"role": "frontend-plugin",
|
|
19
|
+
"pluginId": "kuadrant",
|
|
20
|
+
"pluginPackages": [
|
|
21
|
+
"@kuadrant/kuadrant-backstage-plugin-frontend"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"scalprum": {
|
|
25
|
+
"name": "internal.plugin-kuadrant",
|
|
26
|
+
"exposedModules": {
|
|
27
|
+
"PluginRoot": "./src/plugin.ts",
|
|
28
|
+
"KuadrantPage": "./src/plugin.ts",
|
|
29
|
+
"EntityKuadrantApiAccessCard": "./src/plugin.ts",
|
|
30
|
+
"EntityKuadrantApiKeyManagementTab": "./src/plugin.ts",
|
|
31
|
+
"EntityKuadrantApiKeysContent": "./src/plugin.ts",
|
|
32
|
+
"EntityKuadrantApiProductInfoContent": "./src/plugin.ts",
|
|
33
|
+
"KuadrantApprovalQueueCard": "./src/plugin.ts"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"scripts": {
|
|
38
|
+
"start": "backstage-cli package start",
|
|
39
|
+
"build": "backstage-cli package build",
|
|
40
|
+
"lint": "backstage-cli package lint",
|
|
41
|
+
"test": "backstage-cli package test",
|
|
42
|
+
"clean": "backstage-cli package clean",
|
|
43
|
+
"prepack": "backstage-cli package prepack",
|
|
44
|
+
"postpack": "backstage-cli package postpack",
|
|
45
|
+
"tsc": "tsc"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@backstage/core-components": "^0.18.0",
|
|
49
|
+
"@backstage/core-plugin-api": "^1.11.0",
|
|
50
|
+
"@backstage/plugin-catalog-react": "^1.14.0",
|
|
51
|
+
"@backstage/plugin-permission-common": "^0.9.2",
|
|
52
|
+
"@backstage/plugin-permission-react": "^0.4.37",
|
|
53
|
+
"@backstage/theme": "^0.6.8",
|
|
54
|
+
"@material-ui/core": "^4.9.13",
|
|
55
|
+
"@material-ui/icons": "^4.9.1",
|
|
56
|
+
"@material-ui/lab": "^4.0.0-alpha.61",
|
|
57
|
+
"react-use": "^17.2.4"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@backstage/cli": "^0.34.2",
|
|
64
|
+
"@backstage/core-app-api": "^1.19.0",
|
|
65
|
+
"@backstage/dev-utils": "^1.1.14",
|
|
66
|
+
"@backstage/test-utils": "^1.7.11",
|
|
67
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
68
|
+
"@testing-library/react": "^14.0.0",
|
|
69
|
+
"@testing-library/user-event": "^14.0.0",
|
|
70
|
+
"msw": "^1.0.0",
|
|
71
|
+
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
72
|
+
"typescript": "^5.9.3"
|
|
73
|
+
},
|
|
74
|
+
"files": [
|
|
75
|
+
"dist"
|
|
76
|
+
],
|
|
77
|
+
"typesVersions": {
|
|
78
|
+
"*": {
|
|
79
|
+
"package.json": [
|
|
80
|
+
"package.json"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"module": "./dist/index.esm.js"
|
|
85
|
+
}
|