@redocly/framework-plugin-apigee 0.0.0-stage → 0.1.0-next.0
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/CHANGELOG.md +18 -0
- package/README.md +102 -2
- package/lib/.tsbuildinfo +1 -0
- package/lib/client/ApigeeTemplate.d.ts +24 -0
- package/lib/client/ApigeeTemplate.js +1 -0
- package/lib/client/Primitives.d.ts +84 -0
- package/lib/client/Primitives.js +372 -0
- package/lib/client/api.d.ts +28 -0
- package/lib/client/api.js +1 -0
- package/lib/client/context.d.ts +12 -0
- package/lib/client/context.js +1 -0
- package/lib/client/hooks.d.ts +21 -0
- package/lib/client/hooks.js +1 -0
- package/lib/client/views/AdminView.d.ts +2 -0
- package/lib/client/views/AdminView.js +21 -0
- package/lib/client/views/AppsView.d.ts +11 -0
- package/lib/client/views/AppsView.js +1 -0
- package/lib/client/views/Dialogs.d.ts +49 -0
- package/lib/client/views/Dialogs.js +1 -0
- package/lib/client/views/TeamsView.d.ts +10 -0
- package/lib/client/views/TeamsView.js +1 -0
- package/lib/config.d.ts +31 -0
- package/lib/config.js +1 -0
- package/lib/constants.d.ts +37 -0
- package/lib/constants.js +1 -0
- package/lib/contract.d.ts +182 -0
- package/lib/contract.js +1 -0
- package/lib/plugin.d.ts +10 -0
- package/lib/plugin.js +1 -0
- package/lib/server/apigee-types.d.ts +72 -0
- package/lib/server/apigee-types.js +0 -0
- package/lib/server/client.d.ts +60 -0
- package/lib/server/client.js +1 -0
- package/lib/server/mappers.d.ts +10 -0
- package/lib/server/mappers.js +1 -0
- package/lib/server/routes.d.ts +25 -0
- package/lib/server/routes.js +1 -0
- package/lib/server/service.d.ts +93 -0
- package/lib/server/service.js +1 -0
- package/lib/server/store.d.ts +38 -0
- package/lib/server/store.js +1 -0
- package/lib/server/token.d.ts +13 -0
- package/lib/server/token.js +2 -0
- package/package.json +56 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { type AppSelection } from './views/AppsView.js';
|
|
3
|
+
type Route = {
|
|
4
|
+
view: 'apps';
|
|
5
|
+
selection: AppSelection;
|
|
6
|
+
} | {
|
|
7
|
+
view: 'teams';
|
|
8
|
+
} | {
|
|
9
|
+
view: 'team';
|
|
10
|
+
teamId: string;
|
|
11
|
+
} | {
|
|
12
|
+
view: 'admin';
|
|
13
|
+
};
|
|
14
|
+
/** The sub-route under the apps page: the path after `basePath`, without the site prefix. */
|
|
15
|
+
export declare function parseRoute(pathname: string, search: string, basePath: string): Route;
|
|
16
|
+
/** What Realm Plus passes a runtime template: the route that matched and its metadata. */
|
|
17
|
+
type TemplateProps = {
|
|
18
|
+
page: {
|
|
19
|
+
slug: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default function ApigeeTemplate({ page }: TemplateProps): ReactElement;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as j}from"react/jsx-runtime";import{useCallback as C,useMemo as S}from"react";import{useLocation as U}from"react-router";import{Button as V}from"@redocly/theme/components/Button/Button";import{useThemeHooks as R}from"@redocly/theme/core/hooks";import{APIGEE_DEFAULT_TITLE as $}from"../constants.js";import{apigeeApi as T}from"./api.js";import{ApigeeContext as D}from"./context.js";import{useAsync as y}from"./hooks.js";import{EmptyState as O,Loading as B,Notice as f,Page as v,Tabs as M}from"./Primitives.js";import{AdminView as W}from"./views/AdminView.js";import{AppsView as F}from"./views/AppsView.js";import{TeamDetailView as G,TeamsView as H}from"./views/TeamsView.js";function N(a,m,l){var i;const s=l==="/"?"":l,n=(a.startsWith(s)?a.slice(s.length):a).split("/").filter(Boolean).map(decodeURIComponent);if(n[0]==="teams")return n[1]?{view:"team",teamId:n[1]}:{view:"teams"};if(n[0]==="admin")return{view:"admin"};if(n[0]){const o=(i=new URLSearchParams(m).get("team"))!==null&&i!==void 0?i:void 0;return{view:"apps",selection:Object.assign({appId:n[0]},o?{teamId:o}:{})}}return{view:"apps",selection:null}}function Y({page:a}){var m,l,i;const s=U(),{userData:d,loginUrl:n}=R().useUserMenu(),o=a.slug.length>1&&a.slug.endsWith("/")?a.slug.slice(0,-1):a.slug,k=typeof((m=a.metadata)===null||m===void 0?void 0:m.title)=="string"?a.metadata.title:$,r=S(()=>N(s.pathname,s.search,o),[s.pathname,s.search,o]),p=d?.isAuthenticated===!0,t=y(()=>T.meta(),p?"meta":"meta:anonymous"),c=y(()=>p?T.listTeams():Promise.resolve([]),p?"teams":"teams:anonymous"),u=C((L="",h)=>{const _=o==="/"?"":o,w=new URLSearchParams;for(const[E,b]of Object.entries(h??{}))b!==void 0&&w.set(E,b);const A=w.toString();return`${_}${L}${A?`?${A}`:""}`||"/"},[o]);if(!p)return e(v,{children:e(O,{icon:"lock",title:"Sign in to manage your apps",text:"Your API keys and applications are tied to your portal account.",action:n?e(V,{variant:"primary",onClick:()=>window.location.assign(n),children:"Sign in"}):void 0})});if(t.loading&&!t.data)return e(v,{children:e(B,{children:"Loading\u2026"})});if(t.error||!t.data)return e(v,{children:e(f,{tone:"danger",children:(l=t.error)!==null&&l!==void 0?l:"Apigee is not available"})});const x={meta:t.data,basePath:o,title:k,link:u},g=(i=c.data)!==null&&i!==void 0?i:[],I=[{key:"apps",label:"Apps",to:u(),icon:"key"},...t.data.teamsEnabled?[{key:"teams",label:"Teams",to:u("/teams"),icon:"user-group",count:g.length}]:[],...t.data.approvals.canView?[{key:"admin",label:"Approvals",to:u("/admin"),icon:"shield-check"}]:[]],P=r.view==="team"?"teams":r.view;return e(D.Provider,{value:x,children:j(v,{"data-component-name":"Apigee/AppsPage","data-testid":"apigee-page",children:[e(M,{items:I,active:P}),c.error?e(f,{tone:"danger",children:c.error}):null,r.view==="apps"?e(F,{selection:r.selection,teams:g,products:t.data.apiProducts}):r.view==="teams"?t.data.teamsEnabled?e(H,{teams:g,onTeamsChanged:c.reload}):e(f,{tone:"warning",children:"Teams are disabled on this portal."}):r.view==="team"?e(G,{teamId:r.teamId,onTeamsChanged:c.reload}):t.data.approvals.canView?e(W,{}):e(f,{tone:"warning",children:"Only reviewers of an API product can open this page."})]})})}export{Y as default,N as parseRoute};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { Link } from '@redocly/theme/components/Link/Link';
|
|
3
|
+
import type { ApprovalStatus } from '../contract.js';
|
|
4
|
+
export declare const Page: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
5
|
+
export declare function PageHeader({ title, description, actions, }: {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
actions?: ReactNode;
|
|
9
|
+
}): ReactElement;
|
|
10
|
+
export declare const SectionTitle: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>>> & string;
|
|
11
|
+
export declare const Section: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>>> & string;
|
|
12
|
+
export declare const SectionHeader: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
13
|
+
export type TabItem = {
|
|
14
|
+
key: string;
|
|
15
|
+
label: ReactNode;
|
|
16
|
+
to: string;
|
|
17
|
+
icon?: string;
|
|
18
|
+
count?: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function Tabs({ items, active }: {
|
|
21
|
+
items: TabItem[];
|
|
22
|
+
active: string;
|
|
23
|
+
}): ReactElement;
|
|
24
|
+
export declare const TableWrap: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
25
|
+
export declare const Table: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>>> & string;
|
|
26
|
+
export declare const Muted: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
27
|
+
export declare const Mono: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>>> & string;
|
|
28
|
+
export declare const Row: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
29
|
+
export declare function EmptyState({ icon, title, text, action, }: {
|
|
30
|
+
icon: string;
|
|
31
|
+
title: ReactNode;
|
|
32
|
+
text?: ReactNode;
|
|
33
|
+
action?: ReactNode;
|
|
34
|
+
}): ReactElement;
|
|
35
|
+
export declare const Field: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>>> & string;
|
|
36
|
+
export declare const FieldLabel: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
37
|
+
export declare const Input: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>>> & string;
|
|
38
|
+
export declare const Textarea: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, never>>> & string;
|
|
39
|
+
export declare const NativeSelect: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, never>>> & string;
|
|
40
|
+
export declare const CheckList: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
41
|
+
export declare const CheckItem: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "$checked"> & {
|
|
42
|
+
$checked?: boolean;
|
|
43
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "$checked"> & {
|
|
44
|
+
$checked?: boolean;
|
|
45
|
+
}, never>>> & string;
|
|
46
|
+
export declare const CheckItemTitle: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
47
|
+
export declare function Dialog({ title, open, onClose, children, footer, wide, testId, }: {
|
|
48
|
+
title: ReactNode;
|
|
49
|
+
open: boolean;
|
|
50
|
+
onClose: () => void;
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
footer?: ReactNode;
|
|
53
|
+
wide?: boolean;
|
|
54
|
+
testId?: string;
|
|
55
|
+
}): ReactElement | null;
|
|
56
|
+
export declare function Notice({ tone, children, }: {
|
|
57
|
+
tone?: 'info' | 'success' | 'warning' | 'danger';
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
}): ReactElement;
|
|
60
|
+
export declare function StatusTag({ status, label, }: {
|
|
61
|
+
status: ApprovalStatus;
|
|
62
|
+
label?: string;
|
|
63
|
+
}): ReactElement;
|
|
64
|
+
export declare const Overview: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDListElement>, HTMLDListElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDListElement>, HTMLDListElement>, never>>> & string;
|
|
65
|
+
export declare const Stats: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
66
|
+
export declare const Stat: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
67
|
+
export declare const Loading: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
68
|
+
export declare const SplitLayout: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
69
|
+
export declare const ListTitle: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
70
|
+
export declare const ListItem: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("@redocly/theme").LinkProps & {
|
|
71
|
+
children?: ReactNode | undefined;
|
|
72
|
+
}, "$active"> & {
|
|
73
|
+
$active: boolean;
|
|
74
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("@redocly/theme").LinkProps & {
|
|
75
|
+
children?: ReactNode | undefined;
|
|
76
|
+
}, "$active"> & {
|
|
77
|
+
$active: boolean;
|
|
78
|
+
}, never>>> & string & Omit<typeof Link, keyof import("react").Component<any, {}, any>>;
|
|
79
|
+
export declare const Dot: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$color"> & {
|
|
80
|
+
$color: 'green' | 'orange' | 'red' | 'grey';
|
|
81
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$color"> & {
|
|
82
|
+
$color: 'green' | 'orange' | 'red' | 'grey';
|
|
83
|
+
}, never>>> & string;
|
|
84
|
+
export declare const Breadcrumb: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>>> & string;
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import{jsx as o,jsxs as t}from"react/jsx-runtime";import{useEffect as b}from"react";import e from"styled-components";import{Button as f}from"@redocly/theme/components/Button/Button";import{Link as p}from"@redocly/theme/components/Link/Link";import{Portal as h}from"@redocly/theme/components/Portal/Portal";import{Tag as g}from"@redocly/theme/components/Tag/Tag";import{CDNIcon as s}from"@redocly/theme/icons/CDNIcon/CDNIcon";const G=e.div`
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 1200px;
|
|
4
|
+
margin: 0 auto;
|
|
5
|
+
padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-xxl);
|
|
6
|
+
font-size: var(--font-size-base);
|
|
7
|
+
line-height: var(--line-height-base);
|
|
8
|
+
color: var(--text-color-primary);
|
|
9
|
+
`,u=e.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
gap: var(--spacing-base);
|
|
15
|
+
margin-bottom: var(--spacing-lg);
|
|
16
|
+
`,y=e.h1`
|
|
17
|
+
margin: 0;
|
|
18
|
+
font-size: var(--font-size-xl);
|
|
19
|
+
line-height: var(--line-height-xl);
|
|
20
|
+
font-weight: var(--font-weight-semibold);
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: var(--spacing-sm);
|
|
24
|
+
`,w=e.p`
|
|
25
|
+
margin: var(--spacing-xxs) 0 0;
|
|
26
|
+
color: var(--text-color-description);
|
|
27
|
+
max-width: 720px;
|
|
28
|
+
`,z=e.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: var(--spacing-xs);
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
`;function J({title:r,description:i,actions:a}){return t(u,{children:[t("div",{children:[o(y,{children:r}),i?o(w,{children:i}):null]}),a?o(z,{children:a}):null]})}const k=e.h2`
|
|
34
|
+
margin: 0 0 var(--spacing-sm);
|
|
35
|
+
font-size: var(--font-size-lg);
|
|
36
|
+
line-height: var(--line-height-lg);
|
|
37
|
+
font-weight: var(--font-weight-semibold);
|
|
38
|
+
`,Q=e.section`
|
|
39
|
+
margin-top: var(--spacing-xl);
|
|
40
|
+
`,V=e.div`
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
gap: var(--spacing-sm);
|
|
45
|
+
margin-bottom: var(--spacing-sm);
|
|
46
|
+
|
|
47
|
+
${k} {
|
|
48
|
+
margin: 0;
|
|
49
|
+
}
|
|
50
|
+
`,T=e.nav`
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: var(--spacing-xxs);
|
|
53
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
54
|
+
margin-bottom: var(--spacing-lg);
|
|
55
|
+
`,S=e(p)`
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: var(--spacing-xs);
|
|
59
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
60
|
+
margin-bottom: -1px;
|
|
61
|
+
border-bottom: 2px solid ${({$active:r})=>r?"var(--text-color-primary)":"transparent"};
|
|
62
|
+
color: ${({$active:r})=>r?"var(--text-color-primary)":"var(--text-color-secondary)"};
|
|
63
|
+
font-weight: ${({$active:r})=>r?"var(--font-weight-medium)":"var(--font-weight-regular)"};
|
|
64
|
+
text-decoration: none;
|
|
65
|
+
border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
|
|
66
|
+
|
|
67
|
+
&:hover {
|
|
68
|
+
color: var(--text-color-primary);
|
|
69
|
+
background: var(--layer-color-hover);
|
|
70
|
+
text-decoration: none;
|
|
71
|
+
}
|
|
72
|
+
`;function X({items:r,active:i}){return o(T,{"aria-label":"Sections",children:r.map(a=>t(S,{to:a.to,$active:a.key===i,"data-testid":`apigee-tab-${a.key}`,children:[a.icon?o(s,{name:a.icon,size:"16px"}):null,a.label,a.count!==void 0&&a.count>0?o(g,{color:"grey",children:a.count}):null]},a.key))})}const Y=e.div`
|
|
73
|
+
border: 1px solid var(--border-color-secondary);
|
|
74
|
+
border-radius: var(--border-radius-xl);
|
|
75
|
+
overflow-x: auto;
|
|
76
|
+
`,Z=e.table`
|
|
77
|
+
width: 100%;
|
|
78
|
+
border-collapse: collapse;
|
|
79
|
+
font-size: var(--font-size-base);
|
|
80
|
+
|
|
81
|
+
th,
|
|
82
|
+
td {
|
|
83
|
+
text-align: left;
|
|
84
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
85
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
86
|
+
vertical-align: top;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
th {
|
|
90
|
+
font-weight: var(--font-weight-medium);
|
|
91
|
+
color: var(--text-color-secondary);
|
|
92
|
+
white-space: nowrap;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
tbody tr:last-child td {
|
|
96
|
+
border-bottom: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
tbody tr:hover td {
|
|
100
|
+
background: var(--layer-color-hover);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
td.actions,
|
|
104
|
+
th.actions {
|
|
105
|
+
text-align: right;
|
|
106
|
+
white-space: nowrap;
|
|
107
|
+
width: 1%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
td.key {
|
|
111
|
+
min-width: 260px;
|
|
112
|
+
}
|
|
113
|
+
`,$=e.span`
|
|
114
|
+
color: var(--text-color-description);
|
|
115
|
+
font-size: var(--font-size-sm);
|
|
116
|
+
line-height: var(--line-height-sm);
|
|
117
|
+
`,rr=e.code`
|
|
118
|
+
font-family: var(--font-family-monospaced);
|
|
119
|
+
font-size: var(--font-size-sm);
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
`,er=e.div`
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
gap: var(--spacing-xs);
|
|
125
|
+
flex-wrap: wrap;
|
|
126
|
+
`,L=e.div`
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
align-items: center;
|
|
130
|
+
gap: var(--spacing-sm);
|
|
131
|
+
padding: var(--spacing-xxl) var(--spacing-lg);
|
|
132
|
+
border: 1px dashed var(--border-color-primary);
|
|
133
|
+
border-radius: var(--border-radius-xl);
|
|
134
|
+
text-align: center;
|
|
135
|
+
`,j=e.div`
|
|
136
|
+
width: 48px;
|
|
137
|
+
height: 48px;
|
|
138
|
+
display: grid;
|
|
139
|
+
place-items: center;
|
|
140
|
+
border: 1px solid var(--border-color-secondary);
|
|
141
|
+
border-radius: var(--border-radius-lg);
|
|
142
|
+
background: var(--layer-color);
|
|
143
|
+
`,D=e.div`
|
|
144
|
+
font-weight: var(--font-weight-semibold);
|
|
145
|
+
`;function ar({icon:r,title:i,text:a,action:d}){return t(L,{"data-testid":"apigee-empty",children:[o(j,{children:o(s,{name:r,size:"24px"})}),o(D,{children:i}),a?o($,{style:{maxWidth:420},children:a}):null,d]})}const or=e.label`
|
|
146
|
+
display: flex;
|
|
147
|
+
flex-direction: column;
|
|
148
|
+
gap: var(--spacing-xxs);
|
|
149
|
+
font-size: var(--font-size-base);
|
|
150
|
+
`,ir=e.span`
|
|
151
|
+
font-weight: var(--font-weight-medium);
|
|
152
|
+
color: var(--text-color-secondary);
|
|
153
|
+
font-size: var(--font-size-sm);
|
|
154
|
+
`,c=`
|
|
155
|
+
width: 100%;
|
|
156
|
+
box-sizing: border-box;
|
|
157
|
+
padding: 5px var(--spacing-sm);
|
|
158
|
+
border: var(--input-border);
|
|
159
|
+
border-radius: var(--input-border-radius);
|
|
160
|
+
background: var(--bg-color);
|
|
161
|
+
color: var(--text-color-primary);
|
|
162
|
+
font: inherit;
|
|
163
|
+
font-size: var(--font-size-base);
|
|
164
|
+
line-height: var(--line-height-base);
|
|
165
|
+
|
|
166
|
+
&:hover {
|
|
167
|
+
border: var(--input-border-hover);
|
|
168
|
+
}
|
|
169
|
+
&:focus {
|
|
170
|
+
outline: none;
|
|
171
|
+
border: var(--input-border-focus);
|
|
172
|
+
box-shadow: 0 0 0 2px var(--border-color-secondary);
|
|
173
|
+
}
|
|
174
|
+
&::placeholder {
|
|
175
|
+
color: var(--text-color-disabled);
|
|
176
|
+
}
|
|
177
|
+
`,tr=e.input`
|
|
178
|
+
${c}
|
|
179
|
+
`,nr=e.textarea`
|
|
180
|
+
${c}
|
|
181
|
+
min-height: 72px;
|
|
182
|
+
resize: vertical;
|
|
183
|
+
`,sr=e.select`
|
|
184
|
+
${c}
|
|
185
|
+
`,dr=e.div`
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: column;
|
|
188
|
+
gap: var(--spacing-xs);
|
|
189
|
+
`,cr=e.label`
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: flex-start;
|
|
192
|
+
gap: var(--spacing-sm);
|
|
193
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
194
|
+
border: 1px solid ${({$checked:r})=>r?"var(--input-border-color-hover)":"var(--border-color-secondary)"};
|
|
195
|
+
border-radius: var(--border-radius-lg);
|
|
196
|
+
background: ${({$checked:r})=>r?"var(--layer-color)":"transparent"};
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
|
|
199
|
+
input {
|
|
200
|
+
margin-top: 4px;
|
|
201
|
+
accent-color: var(--text-color-primary);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&:hover {
|
|
205
|
+
border-color: var(--input-border-color-hover);
|
|
206
|
+
background: var(--layer-color);
|
|
207
|
+
}
|
|
208
|
+
`,lr=e.span`
|
|
209
|
+
display: flex;
|
|
210
|
+
align-items: center;
|
|
211
|
+
gap: var(--spacing-xs);
|
|
212
|
+
font-weight: var(--font-weight-medium);
|
|
213
|
+
`,E=e.div`
|
|
214
|
+
position: fixed;
|
|
215
|
+
inset: 0;
|
|
216
|
+
background: var(--bg-color-modal-overlay);
|
|
217
|
+
z-index: var(--z-index-overlay);
|
|
218
|
+
display: flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
padding: var(--spacing-base);
|
|
222
|
+
`,P=e.div`
|
|
223
|
+
width: 100%;
|
|
224
|
+
max-width: ${({$wide:r})=>r?"640px":"480px"};
|
|
225
|
+
max-height: calc(100vh - 64px);
|
|
226
|
+
display: flex;
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
background: var(--bg-color-raised);
|
|
229
|
+
border: 1px solid var(--border-color-secondary);
|
|
230
|
+
border-radius: var(--border-radius-xl);
|
|
231
|
+
box-shadow: var(--modal-box-shadow);
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
font-family: var(--font-family-base);
|
|
234
|
+
`,I=e.div`
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: space-between;
|
|
238
|
+
gap: var(--spacing-sm);
|
|
239
|
+
padding: var(--spacing-md) var(--spacing-lg) var(--spacing-sm);
|
|
240
|
+
`,W=e.h2`
|
|
241
|
+
margin: 0;
|
|
242
|
+
font-size: var(--font-size-lg);
|
|
243
|
+
line-height: var(--line-height-lg);
|
|
244
|
+
font-weight: var(--font-weight-semibold);
|
|
245
|
+
`,A=e.div`
|
|
246
|
+
display: flex;
|
|
247
|
+
flex-direction: column;
|
|
248
|
+
gap: var(--spacing-base);
|
|
249
|
+
padding: 0 var(--spacing-lg) var(--spacing-md);
|
|
250
|
+
overflow-y: auto;
|
|
251
|
+
`,B=e.div`
|
|
252
|
+
display: flex;
|
|
253
|
+
justify-content: flex-end;
|
|
254
|
+
gap: var(--spacing-xs);
|
|
255
|
+
padding: var(--spacing-base) var(--spacing-lg);
|
|
256
|
+
border-top: 1px solid var(--border-color-secondary);
|
|
257
|
+
`;function pr({title:r,open:i,onClose:a,children:d,footer:l,wide:v,testId:x}){return b(()=>{if(!i)return;const n=m=>{m.key==="Escape"&&a()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[i,a]),i?o(h,{children:o(E,{onMouseDown:n=>n.target===n.currentTarget&&a(),children:t(P,{role:"dialog","aria-modal":"true",$wide:v,"data-testid":x,children:[t(I,{children:[o(W,{children:r}),o(f,{variant:"text",size:"small",onClick:a,"aria-label":"Close",icon:o(s,{name:"xmark",size:"16px"})})]}),o(A,{children:d}),l?o(B,{children:l}):null]})})}):null}const C=e.div`
|
|
258
|
+
display: flex;
|
|
259
|
+
gap: var(--spacing-sm);
|
|
260
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
261
|
+
border-radius: var(--border-radius-lg);
|
|
262
|
+
border: 1px solid
|
|
263
|
+
${({$tone:r})=>r==="danger"?"var(--color-error-border)":r==="warning"?"var(--color-warning-border)":r==="success"?"var(--color-success-border)":"var(--color-info-border)"};
|
|
264
|
+
background: ${({$tone:r})=>r==="danger"?"var(--color-error-bg)":r==="warning"?"var(--color-warning-bg)":r==="success"?"var(--color-success-bg)":"var(--color-info-bg)"};
|
|
265
|
+
color: var(--text-color-primary);
|
|
266
|
+
font-size: var(--font-size-base);
|
|
267
|
+
`;function gr({tone:r="info",children:i}){const a=r==="danger"?"circle-xmark":r==="warning"?"triangle-exclamation":r==="success"?"circle-check":"circle-info";return t(C,{$tone:r,role:r==="danger"?"alert":"status","data-testid":`apigee-notice-${r}`,children:[o(s,{name:a,size:"18px",style:{flexShrink:0,marginTop:2}}),o("div",{children:i})]})}const H={approved:"green",pending:"orange",revoked:"red"},N={approved:"Approved",pending:"Pending approval",revoked:"Revoked"};function vr({status:r,label:i}){return o(g,{color:H[r],children:i??N[r]})}const xr=e.dl`
|
|
268
|
+
display: grid;
|
|
269
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
270
|
+
gap: var(--spacing-base);
|
|
271
|
+
margin: 0;
|
|
272
|
+
padding: var(--spacing-base) var(--spacing-md);
|
|
273
|
+
border: 1px solid var(--border-color-secondary);
|
|
274
|
+
border-radius: var(--border-radius-xl);
|
|
275
|
+
background: var(--layer-color);
|
|
276
|
+
|
|
277
|
+
dt {
|
|
278
|
+
font-size: var(--font-size-sm);
|
|
279
|
+
line-height: var(--line-height-sm);
|
|
280
|
+
color: var(--text-color-description);
|
|
281
|
+
margin-bottom: var(--spacing-xxs);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
> div {
|
|
285
|
+
min-width: 0;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
> .wide {
|
|
289
|
+
grid-column: 1 / -1;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
dd {
|
|
293
|
+
margin: 0;
|
|
294
|
+
display: flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
gap: var(--spacing-xs);
|
|
297
|
+
flex-wrap: wrap;
|
|
298
|
+
overflow-wrap: anywhere;
|
|
299
|
+
}
|
|
300
|
+
`,mr=e.div`
|
|
301
|
+
display: flex;
|
|
302
|
+
gap: var(--spacing-base);
|
|
303
|
+
flex-wrap: wrap;
|
|
304
|
+
margin-bottom: var(--spacing-lg);
|
|
305
|
+
`,br=e.div`
|
|
306
|
+
flex: 1 1 160px;
|
|
307
|
+
padding: var(--spacing-base) var(--spacing-md);
|
|
308
|
+
border: 1px solid var(--border-color-secondary);
|
|
309
|
+
border-radius: var(--border-radius-xl);
|
|
310
|
+
display: grid;
|
|
311
|
+
gap: var(--spacing-xxs);
|
|
312
|
+
|
|
313
|
+
strong {
|
|
314
|
+
font-size: var(--font-size-xl);
|
|
315
|
+
line-height: var(--line-height-xl);
|
|
316
|
+
font-weight: var(--font-weight-semibold);
|
|
317
|
+
}
|
|
318
|
+
`,fr=e.div`
|
|
319
|
+
padding: var(--spacing-xl);
|
|
320
|
+
text-align: center;
|
|
321
|
+
color: var(--text-color-description);
|
|
322
|
+
`,hr=e.div`
|
|
323
|
+
display: grid;
|
|
324
|
+
grid-template-columns: 280px minmax(0, 1fr);
|
|
325
|
+
gap: var(--spacing-xl);
|
|
326
|
+
align-items: start;
|
|
327
|
+
|
|
328
|
+
@media (max-width: 960px) {
|
|
329
|
+
grid-template-columns: 1fr;
|
|
330
|
+
}
|
|
331
|
+
`,ur=e.div`
|
|
332
|
+
display: flex;
|
|
333
|
+
align-items: center;
|
|
334
|
+
justify-content: space-between;
|
|
335
|
+
padding: 0 var(--spacing-sm) var(--spacing-xs);
|
|
336
|
+
font-size: var(--font-size-sm);
|
|
337
|
+
font-weight: var(--font-weight-medium);
|
|
338
|
+
color: var(--text-color-secondary);
|
|
339
|
+
`,yr=e(p)`
|
|
340
|
+
display: flex;
|
|
341
|
+
align-items: center;
|
|
342
|
+
justify-content: space-between;
|
|
343
|
+
gap: var(--spacing-xs);
|
|
344
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
345
|
+
border-radius: var(--border-radius-lg);
|
|
346
|
+
color: var(--text-color-primary);
|
|
347
|
+
text-decoration: none;
|
|
348
|
+
background: ${({$active:r})=>r?"var(--layer-color-active)":"transparent"};
|
|
349
|
+
font-weight: ${({$active:r})=>r?"var(--font-weight-medium)":"var(--font-weight-regular)"};
|
|
350
|
+
|
|
351
|
+
&:hover {
|
|
352
|
+
background: var(--layer-color-hover);
|
|
353
|
+
text-decoration: none;
|
|
354
|
+
}
|
|
355
|
+
`,wr=e.span`
|
|
356
|
+
width: 8px;
|
|
357
|
+
height: 8px;
|
|
358
|
+
border-radius: 50%;
|
|
359
|
+
flex-shrink: 0;
|
|
360
|
+
background: ${({$color:r})=>r==="green"?"var(--color-success-base)":r==="orange"?"var(--color-warning-base)":r==="red"?"var(--color-error-base)":"var(--text-color-disabled)"};
|
|
361
|
+
`,zr=e.nav`
|
|
362
|
+
display: flex;
|
|
363
|
+
align-items: center;
|
|
364
|
+
gap: var(--spacing-xs);
|
|
365
|
+
margin-bottom: var(--spacing-sm);
|
|
366
|
+
font-size: var(--font-size-sm);
|
|
367
|
+
color: var(--text-color-description);
|
|
368
|
+
|
|
369
|
+
a {
|
|
370
|
+
color: inherit;
|
|
371
|
+
}
|
|
372
|
+
`;export{zr as Breadcrumb,cr as CheckItem,lr as CheckItemTitle,dr as CheckList,pr as Dialog,wr as Dot,ar as EmptyState,or as Field,ir as FieldLabel,tr as Input,yr as ListItem,ur as ListTitle,fr as Loading,rr as Mono,$ as Muted,sr as NativeSelect,gr as Notice,xr as Overview,G as Page,J as PageHeader,er as Row,Q as Section,V as SectionHeader,k as SectionTitle,hr as SplitLayout,br as Stat,mr as Stats,vr as StatusTag,Z as Table,Y as TableWrap,X as Tabs,nr as Textarea};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AccessRequest, AdminApp, ApigeeMeta, App, AppInput, AppUpdateInput, AuditEntry, Credential, KeyInput, Team, TeamInput, TeamMemberInput, TeamRole } from '../contract.js';
|
|
2
|
+
export declare class ApiRequestError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
name: string;
|
|
5
|
+
constructor(status: number, message: string);
|
|
6
|
+
}
|
|
7
|
+
export declare const apigeeApi: {
|
|
8
|
+
meta: () => Promise<ApigeeMeta>;
|
|
9
|
+
listApps: () => Promise<App[]>;
|
|
10
|
+
createApp: (input: AppInput) => Promise<App>;
|
|
11
|
+
updateApp: (appId: string, input: AppUpdateInput, teamId?: string) => Promise<App>;
|
|
12
|
+
deleteApp: (appId: string, teamId?: string) => Promise<void>;
|
|
13
|
+
createKey: (appId: string, input: KeyInput, teamId?: string) => Promise<Credential>;
|
|
14
|
+
updateKey: (appId: string, consumerKey: string, input: KeyInput, teamId?: string) => Promise<Credential>;
|
|
15
|
+
deleteKey: (appId: string, consumerKey: string, teamId?: string) => Promise<void>;
|
|
16
|
+
listTeams: () => Promise<Team[]>;
|
|
17
|
+
createTeam: (input: TeamInput) => Promise<Team>;
|
|
18
|
+
getTeam: (teamId: string) => Promise<Team>;
|
|
19
|
+
updateTeam: (teamId: string, input: TeamInput) => Promise<Team>;
|
|
20
|
+
deleteTeam: (teamId: string) => Promise<void>;
|
|
21
|
+
addMember: (teamId: string, input: TeamMemberInput) => Promise<Team>;
|
|
22
|
+
setMemberRole: (teamId: string, email: string, role: TeamRole) => Promise<Team>;
|
|
23
|
+
removeMember: (teamId: string, email: string) => Promise<Team>;
|
|
24
|
+
adminRequests: () => Promise<AccessRequest[]>;
|
|
25
|
+
adminDecide: (requestId: string, action: 'approve' | 'revoke', note?: string) => Promise<AuditEntry>;
|
|
26
|
+
adminApps: () => Promise<AdminApp[]>;
|
|
27
|
+
adminAudit: () => Promise<AuditEntry[]>;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=function(e,n,t,i){function m(d){return d instanceof t?d:new t(function(r){r(d)})}return new(t||(t=Promise))(function(d,r){function p(u){try{l(i.next(u))}catch(f){r(f)}}function h(u){try{l(i.throw(u))}catch(f){r(f)}}function l(u){u.done?d(u.value):m(u.value).then(p,h)}l((i=i.apply(e,n||[])).next())})};import{withPathPrefix as j}from"@redocly/theme/core/utils";import{APIGEE_ROUTES as o}from"../constants.js";class T extends Error{constructor(n,t){super(t),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ApiRequestError"})}}function a(e,n,t){let i=e;for(const[r,p]of Object.entries(n))i=i.replace(`:${r}`,encodeURIComponent(p));const m=new URLSearchParams;for(const[r,p]of Object.entries(t??{}))p!==void 0&&p!==""&&m.set(r,p);const d=m.toString();return j(d?`${i}?${d}`:i)}function s(e){return b(this,arguments,void 0,function*(n,t={}){var i;const m=yield fetch(n,Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({Accept:"application/json"},t.json!==void 0?{"Content-Type":"application/json"}:{}),(i=t.headers)!==null&&i!==void 0?i:{}),body:t.json!==void 0?JSON.stringify(t.json):t.body}));if(m.status===204)return;const d=yield m.text();let r=null;try{r=d?JSON.parse(d):null}catch{r=null}if(!m.ok){const p=r&&typeof r=="object"&&typeof r.error=="string"?r.error:`Request failed with ${m.status}`;throw new T(m.status,p)}return r})}const c=e=>({team:e}),O={meta:()=>s(a(o.meta,{})),listApps:()=>s(a(o.apps,{})),createApp:e=>s(a(o.apps,{}),{method:"POST",json:e}),updateApp:(e,n,t)=>s(a(o.app,{appId:e},c(t)),{method:"PUT",json:n}),deleteApp:(e,n)=>s(a(o.app,{appId:e},c(n)),{method:"DELETE"}),createKey:(e,n,t)=>s(a(o.appKeys,{appId:e},c(t)),{method:"POST",json:n}),updateKey:(e,n,t,i)=>s(a(o.appKey,{appId:e,consumerKey:n},c(i)),{method:"PUT",json:t}),deleteKey:(e,n,t)=>s(a(o.appKey,{appId:e,consumerKey:n},c(t)),{method:"DELETE"}),listTeams:()=>s(a(o.teams,{})),createTeam:e=>s(a(o.teams,{}),{method:"POST",json:e}),getTeam:e=>s(a(o.team,{teamId:e})),updateTeam:(e,n)=>s(a(o.team,{teamId:e}),{method:"PUT",json:n}),deleteTeam:e=>s(a(o.team,{teamId:e}),{method:"DELETE"}),addMember:(e,n)=>s(a(o.teamMembers,{teamId:e}),{method:"POST",json:n}),setMemberRole:(e,n,t)=>s(a(o.teamMember,{teamId:e,email:n}),{method:"PUT",json:{role:t}}),removeMember:(e,n)=>s(a(o.teamMember,{teamId:e,email:n}),{method:"DELETE"}),adminRequests:()=>s(a(o.adminRequests,{})),adminDecide:(e,n,t)=>s(a(n==="approve"?o.adminRequestApprove:o.adminRequestRevoke,{requestId:e}),{method:"POST",json:t?{note:t}:{}}),adminApps:()=>s(a(o.adminApps,{})),adminAudit:()=>s(a(o.adminAudit,{}))};export{T as ApiRequestError,O as apigeeApi};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ApigeeMeta } from '../contract.js';
|
|
2
|
+
export type ApigeeContextValue = {
|
|
3
|
+
meta: ApigeeMeta;
|
|
4
|
+
/** The apps page slug, without the site path prefix: router links add it. */
|
|
5
|
+
basePath: string;
|
|
6
|
+
/** The page title from the route, `apigee.title` in the config. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** A site-relative link under the apps page. */
|
|
9
|
+
link: (path?: string, query?: Record<string, string | undefined>) => string;
|
|
10
|
+
};
|
|
11
|
+
export declare const ApigeeContext: import("react").Context<ApigeeContextValue | null>;
|
|
12
|
+
export declare function useApigee(): ApigeeContextValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as t,useContext as o}from"react";const n=t(null);function i(){const e=o(n);if(!e)throw new Error("useApigee needs an ApigeeContext provider");return e}export{n as ApigeeContext,i as useApigee};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type AsyncState<T> = {
|
|
2
|
+
data: T | null;
|
|
3
|
+
error: string | null;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
reload: () => void;
|
|
6
|
+
/** Replaces the loaded value without a round trip, after a mutation returned the new state. */
|
|
7
|
+
setData: (value: T | null) => void;
|
|
8
|
+
};
|
|
9
|
+
/** Loads `load()` on mount and whenever `key` changes; the last request wins. */
|
|
10
|
+
export declare function useAsync<T>(load: () => Promise<T>, key: string): AsyncState<T>;
|
|
11
|
+
export type MutationState = {
|
|
12
|
+
pending: boolean;
|
|
13
|
+
error: string | null;
|
|
14
|
+
clearError: () => void;
|
|
15
|
+
run: <T>(action: () => Promise<T>) => Promise<T | undefined>;
|
|
16
|
+
};
|
|
17
|
+
/** Runs one mutation at a time and keeps its error for the form that started it. */
|
|
18
|
+
export declare function useMutation(): MutationState;
|
|
19
|
+
export declare function formatDate(value: number | null | undefined): string;
|
|
20
|
+
export declare function formatDateTime(value: number | null | undefined): string;
|
|
21
|
+
export declare function copyText(text: string): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=function(t,u,a,n){function c(i){return i instanceof a?i:new a(function(o){o(i)})}return new(a||(a=Promise))(function(i,o){function s(e){try{r(n.next(e))}catch(m){o(m)}}function d(e){try{r(n.throw(e))}catch(m){o(m)}}function r(e){e.done?i(e.value):c(e.value).then(s,d)}r((n=n.apply(t,u||[])).next())})};import{useCallback as f,useEffect as p,useRef as y,useState as l}from"react";import{ApiRequestError as x}from"./api.js";function D(t,u){const[a,n]=l({data:null,error:null,loading:!0}),[c,i]=l(0),o=y(t);o.current=t,p(()=>{let r=!1;return n(e=>Object.assign(Object.assign({},e),{loading:!0,error:null})),o.current().then(e=>{r||n({data:e,error:null,loading:!1})}).catch(e=>{r||n({data:null,error:h(e),loading:!1})}),()=>{r=!0}},[u,c]);const s=f(()=>i(r=>r+1),[]),d=f(r=>n({data:r,error:null,loading:!1}),[]);return Object.assign(Object.assign({},a),{reload:s,setData:d})}function E(){const[t,u]=l(!1),[a,n]=l(null),c=f(o=>g(this,void 0,void 0,function*(){u(!0),n(null);try{return yield o()}catch(s){n(h(s));return}finally{u(!1)}}),[]),i=f(()=>n(null),[]);return{pending:t,error:a,clearError:i,run:c}}function h(t){return t instanceof x||t instanceof Error?t.message:String(t)}function S(t){return t?new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):"\u2014"}function _(t){return t?new Date(t).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}function j(t){return g(this,void 0,void 0,function*(){try{return yield navigator.clipboard.writeText(t),!0}catch{return!1}})}export{j as copyText,S as formatDate,_ as formatDateTime,D as useAsync,E as useMutation};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var W=function(n,v,h,p){function k(a){return a instanceof h?a:new h(function(u){u(a)})}return new(h||(h=Promise))(function(a,u){function l(i){try{o(p.next(i))}catch(g){u(g)}}function d(i){try{o(p.throw(i))}catch(g){u(g)}}function o(i){i.done?a(i.value):k(i.value).then(l,d)}o((p=p.apply(n,v||[])).next())})};import{Fragment as E,jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as $}from"react";import z from"styled-components";import{Button as L}from"@redocly/theme/components/Button/Button";import{Dropdown as F}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as H}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Tag as w}from"@redocly/theme/components/Tag/Tag";import{CDNIcon as I}from"@redocly/theme/icons/CDNIcon/CDNIcon";import{apigeeApi as A}from"../api.js";import{useApigee as O}from"../context.js";import{formatDateTime as N,useAsync as D}from"../hooks.js";import{EmptyState as R,Loading as j,Mono as V,Muted as s,Notice as C,PageHeader as G,Row as J,Stat as y,Stats as Q,StatusTag as U,Table as _,TableWrap as q}from"../Primitives.js";import{ConfirmDialog as X}from"./Dialogs.js";const Y=z.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: var(--spacing-xxs);
|
|
4
|
+
margin-bottom: var(--spacing-base);
|
|
5
|
+
`,P=z.button`
|
|
6
|
+
border: none;
|
|
7
|
+
background: ${({$active:n})=>n?"var(--layer-color-active)":"transparent"};
|
|
8
|
+
color: ${({$active:n})=>n?"var(--text-color-primary)":"var(--text-color-secondary)"};
|
|
9
|
+
font: inherit;
|
|
10
|
+
padding: var(--spacing-xxs) var(--spacing-sm);
|
|
11
|
+
border-radius: var(--border-radius-md);
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: var(--spacing-xs);
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
background: var(--layer-color-hover);
|
|
19
|
+
color: var(--text-color-primary);
|
|
20
|
+
}
|
|
21
|
+
`;function x(n){return n.kind==="developer"?{title:n.email,subtitle:"Personal"}:{title:n.teamId,subtitle:"Team"}}function pe(){var n,v,h,p;const{meta:k}=O(),[a,u]=$("pending"),l=D(()=>A.adminRequests(),"admin-requests"),d=D(()=>A.adminApps(),"admin-apps"),o=D(()=>A.adminAudit(),"admin-audit"),[i,g]=$(null),S=()=>{l.reload(),d.reload(),o.reload()},b=(n=l.data)!==null&&n!==void 0?n:[],f=(v=d.data)!==null&&v!==void 0?v:[],B=f.reduce((t,c)=>t+c.credentials.filter(T=>T.status==="approved").length,0),M=new Set(f.filter(t=>t.owner.kind==="developer").map(t=>t.owner.kind==="developer"&&t.owner.email)).size,K=new Set(f.filter(t=>t.owner.kind==="team").map(t=>t.owner.kind==="team"&&t.owner.teamId)).size;return r("div",{"data-testid":"apigee-admin",children:[e(G,{title:"Approvals",description:r(E,{children:["Access requests for API products that require manual approval in Apigee organization"," ",e("strong",{children:k.organizationName}),"."]}),actions:e(L,{variant:"outlined",onClick:S,icon:e(I,{name:"arrows-rotate",size:"16px"}),children:"Refresh"})}),r(Q,{children:[r(y,{children:[e("strong",{"data-testid":"apigee-stat-pending",children:l.data?b.length:"\u2026"}),e(s,{children:"Pending requests"})]}),r(y,{children:[e("strong",{children:d.data?B:"\u2026"}),e(s,{children:"Approved keys"})]}),r(y,{children:[e("strong",{children:d.data?M:"\u2026"}),e(s,{children:"Developers with apps"})]}),r(y,{children:[e("strong",{children:d.data?K:"\u2026"}),e(s,{children:"Teams with apps"})]})]}),r(Y,{role:"tablist",children:[r(P,{$active:a==="pending",onClick:()=>u("pending"),role:"tab","data-testid":"apigee-admin-tab-pending",children:["Pending ",b.length>0?e(w,{color:"orange",children:b.length}):null]}),e(P,{$active:a==="apps",onClick:()=>u("apps"),role:"tab","data-testid":"apigee-admin-tab-apps",children:"All apps"}),e(P,{$active:a==="audit",onClick:()=>u("audit"),role:"tab","data-testid":"apigee-admin-tab-audit",children:"Audit log"})]}),a==="pending"?l.loading&&!l.data?e(j,{children:"Loading requests\u2026"}):l.error?e(C,{tone:"danger",children:l.error}):b.length===0?e(R,{icon:"circle-check",title:"Nothing to review",text:"Every request for a manually approved product has been handled."}):e(q,{children:r(_,{"data-testid":"apigee-requests-table",children:[e("thead",{children:r("tr",{children:[e("th",{children:"Requested by"}),e("th",{children:"App"}),e("th",{children:"API product"}),e("th",{children:"Reason"}),e("th",{children:"Requested"}),e("th",{className:"actions"})]})}),e("tbody",{children:b.map(t=>{const c=x(t.owner);return r("tr",{"data-testid":"apigee-request-row",children:[r("td",{children:[c.title,e("br",{}),r(s,{children:[c.subtitle,t.requestedBy&&t.requestedBy!==c.title?` \xB7 requested by ${t.requestedBy}`:""]})]}),r("td",{children:[t.appName,e("br",{}),e(V,{children:e(s,{children:t.consumerKey})})]}),e("td",{children:e(w,{color:"orange",children:t.apiProduct})}),e("td",{children:t.note?t.note:e(s,{children:"No reason given"})}),e("td",{children:N(t.requestedAt)}),e("td",{className:"actions",children:e(F,{trigger:e(L,{variant:"text",size:"small","aria-label":"Decide",icon:e(I,{name:"ellipsis-vertical",size:"14px"}),"data-testid":"apigee-request-menu"}),alignment:"end",portalled:!0,children:e(H,{items:[{content:"Approve",disabled:!t.canDecide,onAction:()=>g({request:t,action:"approve"}),dataAttributes:{"data-testid":"apigee-approve"}},{content:"Reject",dangerous:!0,separatorLine:!0,disabled:!t.canDecide,onAction:()=>g({request:t,action:"revoke"}),dataAttributes:{"data-testid":"apigee-reject"}}]})})})]},t.id)})})]})}):null,a==="apps"?d.loading&&!d.data?e(j,{children:"Loading apps\u2026"}):d.error?e(C,{tone:"danger",children:d.error}):f.length===0?e(R,{icon:"key",title:"No apps yet",text:"Apps developers register appear here."}):e(q,{children:r(_,{"data-testid":"apigee-admin-apps-table",children:[e("thead",{children:r("tr",{children:[e("th",{children:"App"}),e("th",{children:"Owner"}),e("th",{children:"Keys"}),e("th",{children:"API products"}),e("th",{children:"Created"})]})}),e("tbody",{children:f.map(t=>{const c=x(t.owner),T=[...new Map(t.credentials.flatMap(m=>m.apiProducts).map(m=>[m.id,m])).values()];return r("tr",{children:[r("td",{children:[t.name,t.status==="revoked"?e(w,{color:"red",children:"Revoked"}):null]}),r("td",{children:[c.title,e("br",{}),e(s,{children:c.subtitle})]}),e("td",{children:t.credentials.length}),e("td",{children:e(J,{children:T.map(m=>e(U,{status:m.status,label:m.id},m.id))})}),e("td",{children:N(t.createdAt)})]},`${c.title}:${t.id}`)})})]})}):null,a==="audit"?o.loading&&!o.data?e(j,{children:"Loading the audit log\u2026"}):o.error?e(C,{tone:"danger",children:o.error}):((h=o.data)!==null&&h!==void 0?h:[]).length===0?e(R,{icon:"file-lines",title:"No decisions yet",text:"Approvals and rejections made here are recorded with who made them."}):e(q,{children:r(_,{"data-testid":"apigee-audit-table",children:[e("thead",{children:r("tr",{children:[e("th",{children:"When"}),e("th",{children:"Reviewer"}),e("th",{children:"Action"}),e("th",{children:"Target"})]})}),e("tbody",{children:((p=o.data)!==null&&p!==void 0?p:[]).map(t=>r("tr",{children:[e("td",{children:N(t.at)}),e("td",{children:t.actor}),e("td",{children:e(w,{color:t.action==="approve"?"green":"red",children:t.action==="approve"?"Approved":"Rejected"})}),r("td",{children:[t.apiProduct," \xB7 ",t.appName," (",x(t.owner).title,")",t.note?r(s,{children:[" \u2014 \u201C",t.note,"\u201D"]}):null]})]},t.id))})]})}):null,e(X,{open:i!==null,onClose:()=>g(null),title:i?.action==="approve"?"Approve access?":"Reject request?",confirmLabel:i?.action==="approve"?"Approve":"Reject",danger:i?.action==="revoke",withNote:!0,noteLabel:"Comment for the developer",notePlaceholder:i?.action==="approve"?"Anything the developer should know before they start":"Why the request is rejected and what would change the decision",onConfirm:t=>W(this,void 0,void 0,function*(){return i&&(yield A.adminDecide(i.request.id,i.action,t),S()),!0}),children:i?r("p",{children:[e("strong",{children:i.request.apiProduct})," for"," ",e("strong",{children:i.request.appName})," (",x(i.request.owner).title,").",i.action==="approve"?" The key starts working for this product right away.":" The product stays revoked on this key until it is approved later."]}):null})]})}export{pe as AdminView};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { ApiProduct, Team } from '../../contract.js';
|
|
3
|
+
export type AppSelection = {
|
|
4
|
+
appId: string;
|
|
5
|
+
teamId?: string;
|
|
6
|
+
} | null;
|
|
7
|
+
export declare function AppsView({ selection, teams, products, }: {
|
|
8
|
+
selection: AppSelection;
|
|
9
|
+
teams: Team[];
|
|
10
|
+
products: ApiProduct[];
|
|
11
|
+
}): ReactElement;
|