@redocly/framework-plugin-apigee 0.1.0-next.16 → 0.1.0-next.18

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.
@@ -34,6 +34,8 @@ export declare function LinkTableRow({ to, testId, children, }: {
34
34
  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;
35
35
  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;
36
36
  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;
37
+ /** A tag with a line of text under it, aligned to the top of its row. */
38
+ export declare const TagStack: 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;
37
39
  /** A filter select in a toolbar, sized to its options rather than the whole row. */
38
40
  export declare const FilterSlot: 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;
39
41
  export declare const Toolbar: 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;
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from"@tanstack/react-query";import{useEffect as u}from"react";import{useNavigate as y}from"react-router";import r,{keyframes as w}from"styled-components";import{Admonition as k}from"@redocly/theme/components/Admonition/Admonition";import{Breadcrumbs as z}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{Button as c}from"@redocly/theme/components/Button/Button";import{Link as T}from"@redocly/theme/components/Link/Link";import{SpinnerLoader as S}from"@redocly/theme/components/Loaders/SpinnerLoader";import{NavigationTab as L}from"@redocly/theme/components/NavigationTabs/NavigationTab";import{Portal as $}from"@redocly/theme/components/Portal/Portal";import{Tag as p}from"@redocly/theme/components/Tag/Tag";import{breakpoints as g}from"@redocly/theme/core/utils/media-css";import{CDNIcon as l}from"@redocly/theme/icons/CDNIcon/CDNIcon";const yr=r.div`
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from"@tanstack/react-query";import{useEffect as u}from"react";import{useNavigate as y}from"react-router";import r,{keyframes as w}from"styled-components";import{Admonition as k}from"@redocly/theme/components/Admonition/Admonition";import{Breadcrumbs as z}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{Button as c}from"@redocly/theme/components/Button/Button";import{Link as T}from"@redocly/theme/components/Link/Link";import{SpinnerLoader as S}from"@redocly/theme/components/Loaders/SpinnerLoader";import{NavigationTab as L}from"@redocly/theme/components/NavigationTabs/NavigationTab";import{Portal as $}from"@redocly/theme/components/Portal/Portal";import{Tag as p}from"@redocly/theme/components/Tag/Tag";import{breakpoints as g}from"@redocly/theme/core/utils/media-css";import{CDNIcon as d}from"@redocly/theme/icons/CDNIcon/CDNIcon";const yr=r.div`
2
2
  width: 100%;
3
3
  max-width: 1200px;
4
4
  margin: 0 auto;
@@ -13,7 +13,7 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
13
13
  flex-wrap: wrap;
14
14
  gap: var(--spacing-base);
15
15
  margin-bottom: var(--spacing-lg);
16
- `,j=r.h1`
16
+ `,P=r.h1`
17
17
  margin: 0;
18
18
  font-size: var(--font-size-xl);
19
19
  line-height: var(--line-height-xl);
@@ -21,16 +21,16 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
21
21
  display: flex;
22
22
  align-items: center;
23
23
  gap: var(--spacing-sm);
24
- `,D=r.p`
24
+ `,j=r.p`
25
25
  margin: var(--spacing-xxs) 0 0;
26
26
  color: var(--text-color-description);
27
27
  max-width: 720px;
28
- `,P=r.div`
28
+ `,D=r.div`
29
29
  display: flex;
30
30
  align-items: center;
31
31
  gap: var(--spacing-xs);
32
32
  flex-wrap: wrap;
33
- `;function R(){return b({queryKey:["apigee"],predicate:t=>t.state.data!==void 0})>0?e("span",{role:"status","aria-label":"Refreshing","data-testid":"apigee-refreshing",children:e(S,{color:"var(--text-color-description)",size:"14px"})}):null}function wr({title:a,description:t,actions:o}){return n(E,{children:[n("div",{children:[n(j,{children:[a,e(R,{})]}),t?e(D,{children:t}):null]}),o?e(P,{children:o}):null]})}const C=r.h2`
33
+ `;function R(){return b({queryKey:["apigee"],predicate:t=>t.state.data!==void 0})>0?e("span",{role:"status","aria-label":"Refreshing","data-testid":"apigee-refreshing",children:e(S,{color:"var(--text-color-description)",size:"14px"})}):null}function wr({title:a,description:t,actions:o}){return n(E,{children:[n("div",{children:[n(P,{children:[a,e(R,{})]}),t?e(j,{children:t}):null]}),o?e(D,{children:o}):null]})}const C=r.h2`
34
34
  margin: 0 0 var(--spacing-sm);
35
35
  font-size: var(--font-size-lg);
36
36
  line-height: var(--line-height-lg);
@@ -271,6 +271,12 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
271
271
  align-items: center;
272
272
  gap: var(--spacing-xs);
273
273
  flex-wrap: wrap;
274
+ `,Pr=r.div`
275
+ display: flex;
276
+ flex-direction: column;
277
+ align-items: flex-start;
278
+ align-self: flex-start;
279
+ gap: var(--spacing-xxs);
274
280
  `,F=r.div`
275
281
  min-width: 140px;
276
282
  `,jr=r.div`
@@ -302,7 +308,7 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
302
308
  > input {
303
309
  padding-left: calc(var(--spacing-sm) + 22px);
304
310
  }
305
- `;function Dr({value:a,onChange:t,placeholder:o,testId:i}){return n(M,{children:[e(l,{name:"magnifying-glass",size:"14px",color:"var(--text-color-description)"}),e(J,{type:"search",value:a,onChange:s=>t(s.target.value),placeholder:o,"aria-label":o,"data-testid":i})]})}const _=w`
311
+ `;function Dr({value:a,onChange:t,placeholder:o,testId:i}){return n(M,{children:[e(d,{name:"magnifying-glass",size:"14px",color:"var(--text-color-description)"}),e(J,{type:"search",value:a,onChange:s=>t(s.target.value),placeholder:o,"aria-label":o,"data-testid":i})]})}const _=w`
306
312
  from { opacity: 1; }
307
313
  50% { opacity: 0.45; }
308
314
  to { opacity: 1; }
@@ -323,7 +329,7 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
323
329
  background: var(--layer-color-hover);
324
330
  animation: ${_} 1.4s ease-in-out infinite;
325
331
  }
326
- `;function Pr({label:a,rows:t=4}){return e(B,{role:"status","aria-label":a,"data-testid":"apigee-skeleton",children:Array.from({length:t},(o,i)=>n(q,{children:[e("span",{style:{width:"28%"}}),e("span",{style:{width:"18%"}}),e("span",{style:{flex:1}}),e("span",{style:{width:"10%"}})]},i))})}const H=r.div`
332
+ `;function Rr({label:a,rows:t=4}){return e(B,{role:"status","aria-label":a,"data-testid":"apigee-skeleton",children:Array.from({length:t},(o,i)=>n(q,{children:[e("span",{style:{width:"28%"}}),e("span",{style:{width:"18%"}}),e("span",{style:{flex:1}}),e("span",{style:{width:"10%"}})]},i))})}const H=r.div`
327
333
  display: flex;
328
334
  flex-direction: column;
329
335
  align-items: center;
@@ -342,7 +348,7 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
342
348
  background: var(--layer-color);
343
349
  `,K=r.div`
344
350
  font-weight: var(--font-weight-semibold);
345
- `;function U({icon:a,title:t,text:o,action:i}){return n(H,{"data-testid":"apigee-empty",children:[e(O,{children:e(l,{name:a,size:"24px"})}),e(K,{children:t}),o?e(W,{style:{maxWidth:420},children:o}):null,i]})}function Rr({onClear:a}){return e(U,{icon:"magnifying-glass",title:"Nothing matches the filters",action:e(c,{variant:"outlined",onClick:a,children:"Clear filters"})})}const Cr=r.label`
351
+ `;function U({icon:a,title:t,text:o,action:i}){return n(H,{"data-testid":"apigee-empty",children:[e(O,{children:e(d,{name:a,size:"24px"})}),e(K,{children:t}),o?e(W,{style:{maxWidth:420},children:o}):null,i]})}function Cr({onClear:a}){return e(U,{icon:"magnifying-glass",title:"Nothing matches the filters",action:e(c,{variant:"outlined",onClick:a,children:"Clear filters"})})}const Nr=r.label`
346
352
  display: flex;
347
353
  flex-direction: column;
348
354
  gap: var(--spacing-xxs);
@@ -354,7 +360,7 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
354
360
  `,G=r.span`
355
361
  margin-left: var(--spacing-xxs);
356
362
  color: var(--schema-required-color);
357
- `;function Nr({children:a}){return n(Y,{children:[a,e(G,{"aria-hidden":"true",children:"*"})]})}const v=`
363
+ `;function Ar({children:a}){return n(Y,{children:[a,e(G,{"aria-hidden":"true",children:"*"})]})}const v=`
358
364
  width: 100%;
359
365
  box-sizing: border-box;
360
366
  padding: 5px var(--spacing-sm);
@@ -379,15 +385,15 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
379
385
  }
380
386
  `,J=r.input`
381
387
  ${v}
382
- `,Ar=r.textarea`
388
+ `,Br=r.textarea`
383
389
  ${v}
384
390
  min-height: 72px;
385
391
  resize: vertical;
386
- `,Br=r.div`
392
+ `,Ir=r.div`
387
393
  display: flex;
388
394
  flex-direction: column;
389
395
  gap: var(--spacing-xs);
390
- `,Ir=r.label`
396
+ `,Wr=r.label`
391
397
  display: flex;
392
398
  align-items: flex-start;
393
399
  gap: var(--spacing-sm);
@@ -406,7 +412,7 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
406
412
  border-color: var(--input-border-color-hover);
407
413
  background: var(--layer-color);
408
414
  }
409
- `,Wr=r.span`
415
+ `,Fr=r.span`
410
416
  display: flex;
411
417
  align-items: center;
412
418
  gap: var(--spacing-xs);
@@ -416,6 +422,8 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
416
422
  inset: 0;
417
423
  background: var(--bg-color-modal-overlay);
418
424
  z-index: var(--z-index-overlay);
425
+ /* Portalled menus of the dialog fields read it, so they open above the overlay. */
426
+ --dropdown-menu-z-index: calc(var(--z-index-overlay) + 1);
419
427
  display: flex;
420
428
  align-items: center;
421
429
  justify-content: center;
@@ -455,16 +463,16 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
455
463
  gap: var(--spacing-xs);
456
464
  padding: var(--spacing-base) var(--spacing-lg);
457
465
  border-top: 1px solid var(--border-color-secondary);
458
- `;function Fr({title:a,open:t,onClose:o,children:i,footer:s,wide:x,testId:h}){return u(()=>{if(!t)return;const d=f=>{f.key==="Escape"&&o()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[t,o]),t?e($,{children:e(Q,{onMouseDown:d=>d.target===d.currentTarget&&o(),children:n(V,{role:"dialog","aria-modal":"true",$wide:x,"data-testid":h,children:[n(X,{children:[e(Z,{children:a}),e(c,{variant:"text",size:"small",onClick:o,"aria-label":"Close",icon:e(l,{name:"xmark",size:"16px"})})]}),e(rr,{children:i}),s?e(er,{children:s}):null]})})}):null}const ar=r.div`
466
+ `;function Mr({title:a,open:t,onClose:o,children:i,footer:s,wide:m,testId:h}){return u(()=>{if(!t)return;const l=f=>{f.key==="Escape"&&o()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t,o]),t?e($,{children:e(Q,{onMouseDown:l=>l.target===l.currentTarget&&o(),children:n(V,{role:"dialog","aria-modal":"true",$wide:m,"data-testid":h,children:[n(X,{children:[e(Z,{children:a}),e(c,{variant:"text",size:"small",onClick:o,"aria-label":"Close",icon:e(d,{name:"xmark",size:"16px"})})]}),e(rr,{children:i}),s?e(er,{children:s}):null]})})}):null}const ar=r.div`
459
467
  --admonition-margin: 0;
460
- `;function Mr({tone:a="info",children:t}){return e(ar,{role:a==="danger"?"alert":"status","data-testid":`apigee-notice-${a}`,children:e(k,{type:a,children:t})})}const m={approved:"green",pending:"orange",revoked:"red"},tr={approved:"Approved",pending:"Pending approval",revoked:"Revoked"},or=r(T)`
468
+ `;function _r({tone:a="info",children:t}){return e(ar,{role:a==="danger"?"alert":"status","data-testid":`apigee-notice-${a}`,children:e(k,{type:a,children:t})})}const x={approved:"green",pending:"orange",revoked:"red"},tr={approved:"Approved",pending:"Pending approval",revoked:"Revoked"},or=r(T)`
461
469
  display: inline-flex;
462
470
  text-decoration: none;
463
471
 
464
472
  &:hover {
465
473
  text-decoration: none;
466
474
  }
467
- `;function _r({status:a}){return e(p,{color:m[a],children:tr[a]})}function qr({name:a,status:t,to:o}){const i=e(p,{color:m[t],variant:"outline",selectable:!!o,children:a});return o?e(or,{to:o,children:i}):i}const Hr=r.dl`
475
+ `;function qr({status:a}){return e(p,{color:x[a],children:tr[a]})}function Hr({name:a,status:t,to:o}){const i=e(p,{color:x[t],variant:"outline",selectable:!!o,children:a});return o?e(or,{to:o,children:i}):i}const Or=r.dl`
468
476
  display: grid;
469
477
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
470
478
  gap: var(--spacing-base);
@@ -497,12 +505,12 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
497
505
  flex-wrap: wrap;
498
506
  overflow-wrap: anywhere;
499
507
  }
500
- `,Or=r.div`
508
+ `,Kr=r.div`
501
509
  display: flex;
502
510
  gap: var(--spacing-base);
503
511
  flex-wrap: wrap;
504
512
  margin-bottom: var(--spacing-lg);
505
- `,Kr=r.div`
513
+ `,Ur=r.div`
506
514
  flex: 1 1 160px;
507
515
  padding: var(--spacing-base) var(--spacing-md);
508
516
  border: 1px solid var(--border-color-secondary);
@@ -515,6 +523,6 @@ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useIsFetching as b}from
515
523
  line-height: var(--line-height-xl);
516
524
  font-weight: var(--font-weight-semibold);
517
525
  }
518
- `,Ur=r(z)`
526
+ `,Yr=r(z)`
519
527
  margin-bottom: var(--spacing-sm);
520
- `;export{Ir as CheckItem,Wr as CheckItemTitle,Br as CheckList,Fr as Dialog,U as EmptyState,Cr as Field,Y as FieldLabel,F as FilterSlot,J as Input,Lr as LinkTableRow,Pr as ListSkeleton,Sr as ListTable,$r as Mono,W as Muted,Rr as NoMatches,Mr as Notice,Hr as Overview,yr as Page,Ur as PageBreadcrumbs,wr as PageHeader,qr as ProductTag,Nr as RequiredLabel,Er as Row,Dr as SearchField,kr as Section,zr as SectionHeader,C as SectionTitle,Kr as Stat,Or as Stats,_r as StatusTag,I as Table,B as TableWrap,Tr as Tabs,Ar as Textarea,jr as Toolbar};
528
+ `;export{Wr as CheckItem,Fr as CheckItemTitle,Ir as CheckList,Mr as Dialog,U as EmptyState,Nr as Field,Y as FieldLabel,F as FilterSlot,J as Input,Lr as LinkTableRow,Rr as ListSkeleton,Sr as ListTable,$r as Mono,W as Muted,Cr as NoMatches,_r as Notice,Or as Overview,yr as Page,Yr as PageBreadcrumbs,wr as PageHeader,Hr as ProductTag,Ar as RequiredLabel,Er as Row,Dr as SearchField,kr as Section,zr as SectionHeader,C as SectionTitle,Ur as Stat,Kr as Stats,qr as StatusTag,I as Table,B as TableWrap,Tr as Tabs,Pr as TagStack,Br as Textarea,jr as Toolbar};
@@ -1 +1 @@
1
- var T=function(t,l,r,a){function c(g){return g instanceof r?g:new r(function(d){d(g)})}return new(r||(r=Promise))(function(g,d){function h(v){try{p(a.next(v))}catch(f){d(f)}}function y(v){try{p(a.throw(v))}catch(f){d(f)}}function p(v){v.done?g(v.value):c(v.value).then(h,y)}p((a=a.apply(t,l||[])).next())})};import{Fragment as z,jsx as e,jsxs as o}from"react/jsx-runtime";import{useEffect as ce,useState as K}from"react";import{useNavigate as V}from"react-router";import{Button as b}from"@redocly/theme/components/Button/Button";import{Dropdown as ue}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as pe}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Link as me}from"@redocly/theme/components/Link/Link";import{Select as G}from"@redocly/theme/components/Select/Select";import{Tag as E}from"@redocly/theme/components/Tag/Tag";import{Tooltip as he}from"@redocly/theme/components/Tooltip/Tooltip";import{useToast as ve}from"@redocly/theme/core/hooks/use-toast";import{CDNIcon as w}from"@redocly/theme/icons/CDNIcon/CDNIcon";import{maskKey as fe}from"../../contract.js";import{apigeeApi as _}from"../api.js";import{useApigee as M}from"../context.js";import{copyText as ge,errorMessage as J,formatDate as B,matches as ye,useSearchParam as Q,useSearchText as ke}from"../hooks.js";import{EmptyState as X,FilterSlot as Y,ListSkeleton as Z,LinkTableRow as we,ListTable as be,Mono as ee,Muted as P,NoMatches as Ae,Notice as j,Overview as Pe,PageBreadcrumbs as Se,PageHeader as te,ProductTag as ne,Row as L,SearchField as Ie,Section as Ce,SectionHeader as xe,SectionTitle as Te,StatusTag as Ke,Table as _e,TableWrap as ie,Toolbar as Ne}from"../Primitives.js";import{dropApp as De,ownerKey as U,putApp as F,useApps as ze,useTeams as H}from"../queries.js";import{AppDialog as re,ConfirmDialog as oe,KeyDialog as Le}from"./Dialogs.js";const Re="Register apps and manage the API keys that call the APIs through Apigee.",Oe=[{value:"",element:"All statuses"},{value:"approved",element:"Approved"},{value:"partial",element:"Partly approved"},{value:"pending",element:"Pending approval"},{value:"rejected",element:"Rejected"},{value:"revoked",element:"Revoked"},{value:"none",element:"No API products"}],W=3;function q(t,l){var r,a;return t.kind==="developer"?"Personal":(a=(r=l.find(c=>c.id===t.teamId))===null||r===void 0?void 0:r.name)!==null&&a!==void 0?a:t.teamId}function R(t,l){var r,a;return(a=(r=t.find(c=>c.id===l))===null||r===void 0?void 0:r.name)!==null&&a!==void 0?a:l}function ae(t){if(t.status==="revoked")return{color:"red",label:"Revoked",filter:"revoked"};const l=t.credentials.flatMap(c=>c.apiProducts);if(l.length===0)return{color:"grey",label:"No API products",filter:"none"};if(l.some(c=>c.status==="pending"))return{color:"orange",label:"Pending approval",filter:"pending"};const r=new Set(l.map(c=>c.id)).size,a=new Set(l.filter(c=>c.status==="approved").map(c=>c.id)).size;return a===r?{color:"green",label:"Approved",filter:"approved"}:a===0?{color:"red",label:"Rejected",filter:"rejected"}:{color:"blue",label:`${a} of ${r} approved`,filter:"partial"}}function de(t){if(t.status!=="approved")return t.status;const{apiProducts:l}=t;return l.some(r=>r.status==="pending")?"pending":l.length>0&&l.every(r=>r.status==="revoked")?"revoked":"approved"}const le={approved:0,pending:1,revoked:2};function se(t){const l=new Map;for(const r of t.credentials.flatMap(a=>a.apiProducts)){const a=l.get(r.id);(!a||le[r.status]<le[a])&&l.set(r.id,r.status)}return[...l].map(([r,a])=>({id:r,status:a}))}function rt({selection:t}){var l,r,a;const{link:c,appLink:g,title:d,meta:h}=M(),y=V(),p=ze(),{data:v=[]}=H(),[f,k]=K(null),[S,A]=ke(),[I,$]=Q("owner"),[N,O]=Q("status");ce(()=>{var n,u;const x=new URLSearchParams(window.location.search);x.has("createApp")&&(k({product:(n=x.get("apiProduct"))!==null&&n!==void 0?n:void 0,teamId:(u=x.get("team"))!==null&&u!==void 0?u:void 0}),y(c(),{replace:!0}))},[c,y]);const C=e(re,{open:f!==null,onClose:()=>k(null),onSubmit:n=>T(this,void 0,void 0,function*(){const u=yield _.createApp(n);return F(u),y(g(u)),u}),products:h.apiProducts,teams:v,initialProduct:f?.product,initialTeamId:f?.teamId});if(t){const n=t.teamId?`team:${t.teamId}`:"developer",u=(l=p.data)===null||l===void 0?void 0:l.find(x=>x.id===t.appId&&U(x.owner)===n);return o(z,{children:[e(Se,{additionalBreadcrumbs:[{label:d,link:c()},{label:(r=u?.name)!==null&&r!==void 0?r:t.appId}]}),u?e($e,{app:u}):p.data?e(j,{tone:"danger",children:"App not found"}):p.isError?e(j,{tone:"danger",children:J(p.error)}):e(Z,{label:"Loading the app\u2026",rows:2}),C]})}const D=(a=p.data)!==null&&a!==void 0?a:[],i=e(b,{variant:"primary",onClick:()=>k({}),icon:e(w,{name:"plus",size:"16px"}),"data-testid":"apigee-new-app",children:"New app"}),m=D.filter(n=>(!I||U(n.owner)===I)&&(!N||ae(n).filter===N)&&ye(S,n.name,n.description,...se(n).map(u=>R(h.apiProducts,u.id)))),s=[{value:"",element:"All owners"},{value:"developer",element:"Personal"},...v.map(n=>({value:`team:${n.id}`,element:n.name}))];return o(z,{children:[e(te,{title:d,description:Re,actions:p.data&&D.length===0?void 0:i}),p.data?D.length===0?e(X,{icon:"key",title:"Create your first app",text:"An app holds the API keys your software sends. Pick the API products it needs; the keys for approved products work right away.",action:i}):o(z,{children:[o(Ne,{children:[e(Ie,{value:S,onChange:A,placeholder:"Search apps or API products",testId:"apigee-app-search"}),v.length>0?e(Y,{children:e(G,{value:I,options:s,onChange:n=>$(String(n)),dataTestId:"apigee-owner-filter"})}):null,e(Y,{children:e(G,{value:N,options:Oe,onChange:n=>O(String(n)),dataTestId:"apigee-status-filter"})})]}),m.length===0?e(Ae,{onClear:()=>{A(""),y(c(),{replace:!0})}}):e(je,{apps:m,showOwner:v.length>0})]}):p.isError?e(j,{tone:"danger",children:J(p.error)}):e(Z,{label:"Loading your apps\u2026"}),C]})}function je({apps:t,showOwner:l}){const{appLink:r,meta:a}=M(),{data:c=[]}=H(),g=[...t].sort((d,h)=>d.name.localeCompare(h.name));return e(ie,{children:o(be,{"data-testid":"apigee-app-list",children:[e("thead",{children:o("tr",{children:[e("th",{children:"App"}),l?e("th",{children:"Owner"}):null,e("th",{children:"API products"}),e("th",{children:"Keys"}),e("th",{children:"Status"}),e("th",{className:"chevron","aria-hidden":"true"})]})}),e("tbody",{children:g.map(d=>{const h=ae(d),y=se(d);return o(we,{to:r(d),testId:"apigee-app-row",children:[o("td",{children:[e(me,{to:r(d),children:d.name}),d.description?e(P,{as:"div",style:{maxWidth:360},children:d.description}):null]}),l?e("td",{className:"meta",children:o(L,{children:[e(w,{name:d.owner.kind==="team"?"user-group":"user",size:"14px"}),q(d.owner,c)]})}):null,e("td",{children:o(L,{children:[y.length===0?e(P,{children:"None"}):null,y.slice(0,W).map(p=>e(ne,{name:R(a.apiProducts,p.id),status:p.status},p.id)),y.length>W?o(E,{color:"grey",variant:"outline",children:["+",y.length-W]}):null]})}),e("td",{className:"optional",children:d.credentials.length}),e("td",{className:"trail",children:e(E,{color:h.color,textTransform:"none",children:h.label})}),e("td",{className:"chevron",children:e(w,{name:"chevron-right",size:"14px"})})]},`${U(d.owner)}:${d.id}`)})})]})})}function $e({app:t}){const{link:l,meta:r}=M(),a=V(),c=ve(),{data:g=[]}=H(),d=r.apiProducts,h=t.owner.kind==="team"?t.owner.teamId:void 0,[y,p]=K(!1),[v,f]=K(!1),[k,S]=K(null),[A,I]=K(null),[$,N]=K(new Set),O=(i,m)=>T(this,void 0,void 0,function*(){(yield ge(i))?c.success(`${m} copied`,{duration:2e3}):c.error(`Could not copy the ${m.toLowerCase()}`)}),C=i=>F(Object.assign(Object.assign({},t),{credentials:i})),D=i=>d.find(m=>m.id===i);return o("div",{"data-testid":"apigee-app-detail",children:[e(te,{title:o(z,{children:[t.name,t.status==="revoked"?e(E,{color:"red",children:"Revoked"}):null]}),description:t.description||void 0,actions:o(z,{children:[e(b,{variant:"outlined",onClick:()=>p(!0),icon:e(w,{name:"pen",size:"16px"}),"data-testid":"apigee-edit-app",children:"Edit"}),e(he,{tip:"Delete app",placement:"bottom",children:e(b,{variant:"outlined",tone:"danger","aria-label":"Delete app",icon:e(w,{name:"trash-can",size:"16px"}),onClick:()=>f(!0),"data-testid":"apigee-delete-app"})})]})}),o(Pe,{children:[o("div",{children:[e("dt",{children:"Owner"}),o("dd",{children:[e(w,{name:t.owner.kind==="team"?"user-group":"user",size:"16px"}),t.owner.kind==="team"?`Team \xB7 ${q(t.owner,g)}`:q(t.owner,g)]})]}),o("div",{children:[e("dt",{children:"Created"}),e("dd",{children:B(t.createdAt)})]}),o("div",{className:"wide",children:[e("dt",{children:"Callback URL"}),e("dd",{children:t.callbackUrl||e(P,{children:"Not set"})})]})]}),o(Ce,{children:[o(xe,{children:[e(Te,{children:"API keys"}),e(b,{variant:"outlined",size:"small",onClick:()=>S({}),icon:e(w,{name:"plus",size:"14px"}),"data-testid":"apigee-create-key",children:"Create key"})]}),t.credentials.length===0?e(X,{icon:"key",title:"No keys yet",text:"Create a key and pick the API products it may call."}):e(ie,{children:o(_e,{"data-testid":"apigee-keys-table",children:[e("thead",{children:o("tr",{children:[e("th",{children:"Key"}),e("th",{children:"API products"}),e("th",{children:"Status"}),e("th",{className:"actions"})]})}),e("tbody",{children:t.credentials.map(i=>{const m=$.has(i.consumerKey);return o("tr",{"data-testid":"apigee-key-row",children:[o("td",{className:"key",children:[o(L,{children:[e(ee,{"data-testid":"apigee-key-value",children:m?i.consumerKey:fe(i.consumerKey)}),e(b,{variant:"text",size:"small","aria-label":m?"Hide key":"Reveal key",icon:e(w,{name:m?"eye-slash":"eye",size:"14px"}),onClick:()=>N(s=>{const n=new Set(s);return n.has(i.consumerKey)?n.delete(i.consumerKey):n.add(i.consumerKey),n})}),e(b,{variant:"text",size:"small","aria-label":"Copy key",icon:e(w,{name:"copy",size:"14px"}),onClick:()=>O(i.consumerKey,"Key")})]}),i.consumerSecret?o(L,{children:[e(P,{children:"Secret"}),e(ee,{children:m?i.consumerSecret:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}),e(b,{variant:"text",size:"small","aria-label":"Copy secret",icon:e(w,{name:"copy",size:"14px"}),onClick:()=>{var s;return O((s=i.consumerSecret)!==null&&s!==void 0?s:"","Secret")}})]}):null,o(P,{children:["Issued ",B(i.issuedAt)," \xB7 Expires"," ",i.expiresAt?B(i.expiresAt):"never"]})]}),o("td",{"data-label":"API products",children:[o(L,{children:[i.apiProducts.length===0?e(P,{children:"None"}):null,i.apiProducts.map(s=>{var n,u;return e(ne,{name:s.status==="approved"?R(d,s.id):`${R(d,s.id)} \xB7 ${s.status}`,status:s.status,to:(u=(n=D(s.id))===null||n===void 0?void 0:n.api)===null||u===void 0?void 0:u.slug},s.id)})]}),i.apiProducts.filter(s=>{var n;return(n=s.decision)===null||n===void 0?void 0:n.note}).map(s=>{var n,u;return o(P,{as:"div","data-testid":"apigee-decision-note",children:[((n=s.decision)===null||n===void 0?void 0:n.action)==="approve"?"Approved":"Rejected"," \xB7"," ",R(d,s.id),": \u201C",(u=s.decision)===null||u===void 0?void 0:u.note,"\u201D"]},s.id)})]}),e("td",{"data-label":"Status",children:e(Ke,{status:de(i)})}),e("td",{className:"actions menu",children:e(ue,{trigger:e(b,{variant:"text",size:"small","aria-label":"Key actions",icon:e(w,{name:"ellipsis-vertical",size:"14px"}),"data-testid":"apigee-key-menu"}),alignment:"end",portalled:!0,children:e(pe,{items:[{content:"Edit API products",onAction:()=>S({consumerKey:i.consumerKey,products:i.apiProducts.map(s=>s.id)}),dataAttributes:{"data-testid":"apigee-edit-key"}},{content:"Delete key",dangerous:!0,separatorLine:!0,onAction:()=>I(i.consumerKey),dataAttributes:{"data-testid":"apigee-delete-key"}}]})})})]},i.consumerKey)})})]})}),t.credentials.some(i=>de(i)==="approved")?e("div",{style:{marginTop:"var(--spacing-base)"},children:o(j,{tone:"info",children:[e("strong",{children:"Keys are picked up by Try it."})," Open an operation of an approved API product in the API reference and the key is already filled in."]})}):null]}),e(re,{open:y,onClose:()=>p(!1),onSubmit:i=>T(this,void 0,void 0,function*(){const m=yield _.updateApp(t.id,i,h);return F(m),m}),products:d,teams:g,initial:t}),e(Le,{open:k!==null,onClose:()=>S(null),onSubmit:i=>T(this,void 0,void 0,function*(){const m=k?.consumerKey;if(m){const n=yield _.updateKey(t.id,m,i,h);return C(t.credentials.map(u=>u.consumerKey===m?n:u)),n}const s=yield _.createKey(t.id,i,h);return C([...t.credentials,s]),s}),products:d,initial:k?.products}),e(oe,{open:v,onClose:()=>f(!1),title:"Delete app?",confirmLabel:"Delete app",danger:!0,onConfirm:()=>T(this,void 0,void 0,function*(){return yield _.deleteApp(t.id,h),a(l()),De(t),c.success(`${t.name} deleted`),!0}),children:o("p",{children:[e("strong",{children:t.name})," and all of its keys stop working immediately. This cannot be undone."]})}),e(oe,{open:A!==null,onClose:()=>I(null),title:"Delete key?",confirmLabel:"Delete key",danger:!0,onConfirm:()=>T(this,void 0,void 0,function*(){return A&&(yield _.deleteKey(t.id,A,h),C(t.credentials.filter(i=>i.consumerKey!==A))),!0}),children:e("p",{children:"Requests that send this key are rejected from now on. This cannot be undone."})})]})}export{Re as APPS_DESCRIPTION,je as AppsTable,rt as AppsView};
1
+ var T=function(t,d,i,a){function s(g){return g instanceof i?g:new i(function(l){l(g)})}return new(i||(i=Promise))(function(g,l){function h(v){try{p(a.next(v))}catch(f){l(f)}}function y(v){try{p(a.throw(v))}catch(f){l(f)}}function p(v){v.done?g(v.value):s(v.value).then(h,y)}p((a=a.apply(t,d||[])).next())})};import{Fragment as z,jsx as e,jsxs as r}from"react/jsx-runtime";import{useEffect as ce,useState as K}from"react";import{useNavigate as V}from"react-router";import{Button as A}from"@redocly/theme/components/Button/Button";import{Dropdown as ue}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as pe}from"@redocly/theme/components/Dropdown/DropdownMenu";import{Link as me}from"@redocly/theme/components/Link/Link";import{Select as G}from"@redocly/theme/components/Select/Select";import{Tag as E}from"@redocly/theme/components/Tag/Tag";import{Tooltip as he}from"@redocly/theme/components/Tooltip/Tooltip";import{useToast as ve}from"@redocly/theme/core/hooks/use-toast";import{CDNIcon as w}from"@redocly/theme/icons/CDNIcon/CDNIcon";import{maskKey as fe}from"../../contract.js";import{apigeeApi as _}from"../api.js";import{useApigee as M}from"../context.js";import{copyText as ge,errorMessage as J,formatDate as U,matches as ye,useSearchParam as Q,useSearchText as ke}from"../hooks.js";import{EmptyState as X,FilterSlot as Y,ListSkeleton as Z,LinkTableRow as we,ListTable as be,Mono as ee,Muted as P,NoMatches as Ae,Notice as O,Overview as Se,PageBreadcrumbs as Pe,PageHeader as te,ProductTag as ne,Row as L,SearchField as Ie,Section as Ce,SectionHeader as xe,SectionTitle as Te,StatusTag as Ke,Table as _e,TableWrap as ie,TagStack as Ne,Toolbar as De}from"../Primitives.js";import{dropApp as ze,ownerKey as B,putApp as F,useApps as Le,useTeams as H}from"../queries.js";import{AppDialog as re,ConfirmDialog as oe,KeyDialog as Re}from"./Dialogs.js";const Oe="Register apps and manage the API keys that call the APIs through Apigee.",je=[{value:"",element:"All statuses"},{value:"approved",element:"Approved"},{value:"partial",element:"Partially approved"},{value:"pending",element:"Pending approval"},{value:"rejected",element:"Rejected"},{value:"revoked",element:"Revoked"},{value:"none",element:"No API products"}],W=3;function q(t,d){var i,a;return t.kind==="developer"?"Personal":(a=(i=d.find(s=>s.id===t.teamId))===null||i===void 0?void 0:i.name)!==null&&a!==void 0?a:t.teamId}function j(t,d){var i,a;return(a=(i=t.find(s=>s.id===d))===null||i===void 0?void 0:i.name)!==null&&a!==void 0?a:d}function ae(t){if(t.status==="revoked")return{color:"red",label:"Revoked",filter:"revoked"};const d=t.credentials.flatMap(s=>s.apiProducts);if(d.length===0)return{color:"grey",label:"No API products",filter:"none"};if(d.some(s=>s.status==="pending"))return{color:"orange",label:"Pending approval",filter:"pending"};const i=new Set(d.map(s=>s.id)).size,a=new Set(d.filter(s=>s.status==="approved").map(s=>s.id)).size;return a===i?{color:"green",label:"Approved",filter:"approved"}:a===0?{color:"red",label:"Rejected",filter:"rejected"}:{color:"blue",label:`${a} of ${i} approved`,filter:"partial"}}function de(t){if(t.status!=="approved")return t.status;const{apiProducts:d}=t;return d.some(i=>i.status==="pending")?"pending":d.length>0&&d.every(i=>i.status==="revoked")?"revoked":"approved"}const le={approved:0,pending:1,revoked:2};function se(t){const d=new Map;for(const i of t.credentials.flatMap(a=>a.apiProducts)){const a=d.get(i.id);(!a||le[i.status]<le[a])&&d.set(i.id,i.status)}return[...d].map(([i,a])=>({id:i,status:a}))}function ot({selection:t}){var d,i,a;const{link:s,appLink:g,title:l,meta:h}=M(),y=V(),p=Le(),{data:v=[]}=H(),[f,k]=K(null),[I,S]=ke(),[C,$]=Q("owner"),[N,R]=Q("status");ce(()=>{var o,u;const b=new URLSearchParams(window.location.search);b.has("createApp")&&(k({product:(o=b.get("apiProduct"))!==null&&o!==void 0?o:void 0,teamId:(u=b.get("team"))!==null&&u!==void 0?u:void 0}),y(s(),{replace:!0}))},[s,y]);const x=e(re,{open:f!==null,onClose:()=>k(null),onSubmit:o=>T(this,void 0,void 0,function*(){const u=yield _.createApp(o);return F(u),y(g(u)),u}),products:h.apiProducts,teams:v,initialProduct:f?.product,initialTeamId:f?.teamId});if(t){const o=t.teamId?`team:${t.teamId}`:"developer",u=(d=p.data)===null||d===void 0?void 0:d.find(b=>b.id===t.appId&&B(b.owner)===o);return r(z,{children:[e(Pe,{additionalBreadcrumbs:[{label:l,link:s()},{label:(i=u?.name)!==null&&i!==void 0?i:t.appId}]}),u?e(Ee,{app:u}):p.data?e(O,{tone:"danger",children:"App not found"}):p.isError?e(O,{tone:"danger",children:J(p.error)}):e(Z,{label:"Loading the app\u2026",rows:2}),x]})}const D=(a=p.data)!==null&&a!==void 0?a:[],n=e(A,{variant:"primary",onClick:()=>k({}),icon:e(w,{name:"plus",size:"16px"}),"data-testid":"apigee-new-app",children:"New app"}),m=D.filter(o=>(!C||B(o.owner)===C)&&(!N||ae(o).filter===N)&&ye(I,o.name,o.description,...se(o).map(u=>j(h.apiProducts,u.id)))),c=[{value:"",element:"All owners"},{value:"developer",element:"Personal"},...v.map(o=>({value:`team:${o.id}`,element:o.name}))];return r(z,{children:[e(te,{title:l,description:Oe,actions:p.data&&D.length===0?void 0:n}),p.data?D.length===0?e(X,{icon:"key",title:"Create your first app",text:"An app holds the API keys your software sends. Pick the API products it needs; the keys for approved products work right away.",action:n}):r(z,{children:[r(De,{children:[e(Ie,{value:I,onChange:S,placeholder:"Search apps or API products",testId:"apigee-app-search"}),v.length>0?e(Y,{children:e(G,{value:C,options:c,onChange:o=>$(String(o)),dataTestId:"apigee-owner-filter"})}):null,e(Y,{children:e(G,{value:N,options:je,onChange:o=>R(String(o)),dataTestId:"apigee-status-filter"})})]}),m.length===0?e(Ae,{onClear:()=>{S(""),y(s(),{replace:!0})}}):e($e,{apps:m,showOwner:v.length>0})]}):p.isError?e(O,{tone:"danger",children:J(p.error)}):e(Z,{label:"Loading your apps\u2026"}),x]})}function $e({apps:t,showOwner:d}){const{appLink:i,meta:a}=M(),{data:s=[]}=H(),g=[...t].sort((l,h)=>l.name.localeCompare(h.name));return e(ie,{children:r(be,{"data-testid":"apigee-app-list",children:[e("thead",{children:r("tr",{children:[e("th",{children:"App"}),d?e("th",{children:"Owner"}):null,e("th",{children:"API products"}),e("th",{children:"Keys"}),e("th",{children:"Status"}),e("th",{className:"chevron","aria-hidden":"true"})]})}),e("tbody",{children:g.map(l=>{const h=ae(l),y=se(l);return r(we,{to:i(l),testId:"apigee-app-row",children:[r("td",{children:[e(me,{to:i(l),children:l.name}),l.description?e(P,{as:"div",style:{maxWidth:360},children:l.description}):null]}),d?e("td",{className:"meta",children:r(L,{children:[e(w,{name:l.owner.kind==="team"?"user-group":"user",size:"14px"}),q(l.owner,s)]})}):null,e("td",{children:r(L,{children:[y.length===0?e(P,{children:"None"}):null,y.slice(0,W).map(p=>e(ne,{name:j(a.apiProducts,p.id),status:p.status},p.id)),y.length>W?r(E,{color:"grey",variant:"outline",children:["+",y.length-W]}):null]})}),e("td",{className:"optional",children:l.credentials.length}),e("td",{className:"trail",children:e(E,{color:h.color,textTransform:"none",children:h.label})}),e("td",{className:"chevron",children:e(w,{name:"chevron-right",size:"14px"})})]},`${B(l.owner)}:${l.id}`)})})]})})}function Ee({app:t}){const{link:d,meta:i}=M(),a=V(),s=ve(),{data:g=[]}=H(),l=i.apiProducts,h=t.owner.kind==="team"?t.owner.teamId:void 0,[y,p]=K(!1),[v,f]=K(!1),[k,I]=K(null),[S,C]=K(null),[$,N]=K(new Set),R=(n,m)=>T(this,void 0,void 0,function*(){(yield ge(n))?s.success(`${m} copied`,{duration:2e3}):s.error(`Could not copy the ${m.toLowerCase()}`)}),x=n=>F(Object.assign(Object.assign({},t),{credentials:n})),D=n=>l.find(m=>m.id===n);return r("div",{"data-testid":"apigee-app-detail",children:[e(te,{title:r(z,{children:[t.name,t.status==="revoked"?e(E,{color:"red",children:"Revoked"}):null]}),description:t.description||void 0,actions:r(z,{children:[e(A,{variant:"outlined",onClick:()=>p(!0),icon:e(w,{name:"pen",size:"16px"}),"data-testid":"apigee-edit-app",children:"Edit"}),e(he,{tip:"Delete app",placement:"bottom",children:e(A,{variant:"outlined",tone:"danger","aria-label":"Delete app",icon:e(w,{name:"trash-can",size:"16px"}),onClick:()=>f(!0),"data-testid":"apigee-delete-app"})})]})}),r(Se,{children:[r("div",{children:[e("dt",{children:"Owner"}),r("dd",{children:[e(w,{name:t.owner.kind==="team"?"user-group":"user",size:"16px"}),t.owner.kind==="team"?`Team \xB7 ${q(t.owner,g)}`:q(t.owner,g)]})]}),r("div",{children:[e("dt",{children:"Created"}),e("dd",{children:U(t.createdAt)})]}),r("div",{className:"wide",children:[e("dt",{children:"Callback URL"}),e("dd",{children:t.callbackUrl||e(P,{children:"Not set"})})]})]}),r(Ce,{children:[r(xe,{children:[e(Te,{children:"API keys"}),e(A,{variant:"outlined",size:"small",onClick:()=>I({}),icon:e(w,{name:"plus",size:"14px"}),"data-testid":"apigee-create-key",children:"Create key"})]}),t.credentials.length===0?e(X,{icon:"key",title:"No keys yet",text:"Create a key and pick the API products it may call."}):e(ie,{children:r(_e,{"data-testid":"apigee-keys-table",children:[e("thead",{children:r("tr",{children:[e("th",{children:"Key"}),e("th",{children:"API products"}),e("th",{children:"Status"}),e("th",{className:"actions"})]})}),e("tbody",{children:t.credentials.map(n=>{const m=$.has(n.consumerKey);return r("tr",{"data-testid":"apigee-key-row",children:[r("td",{className:"key",children:[r(L,{children:[e(ee,{"data-testid":"apigee-key-value",children:m?n.consumerKey:fe(n.consumerKey)}),e(A,{variant:"text",size:"small","aria-label":m?"Hide key":"Reveal key",icon:e(w,{name:m?"eye-slash":"eye",size:"14px"}),onClick:()=>N(c=>{const o=new Set(c);return o.has(n.consumerKey)?o.delete(n.consumerKey):o.add(n.consumerKey),o})}),e(A,{variant:"text",size:"small","aria-label":"Copy key",icon:e(w,{name:"copy",size:"14px"}),onClick:()=>R(n.consumerKey,"Key")})]}),n.consumerSecret?r(L,{children:[e(P,{children:"Secret"}),e(ee,{children:m?n.consumerSecret:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}),e(A,{variant:"text",size:"small","aria-label":"Copy secret",icon:e(w,{name:"copy",size:"14px"}),onClick:()=>{var c;return R((c=n.consumerSecret)!==null&&c!==void 0?c:"","Secret")}})]}):null,r(P,{children:["Issued ",U(n.issuedAt)," \xB7 Expires"," ",n.expiresAt?U(n.expiresAt):"never"]})]}),e("td",{"data-label":"API products",children:r(L,{children:[n.apiProducts.length===0?e(P,{children:"None"}):null,n.apiProducts.map(c=>{var o,u,b;return r(Ne,{children:[e(ne,{name:c.status==="approved"?j(l,c.id):`${j(l,c.id)} \xB7 ${c.status}`,status:c.status,to:(u=(o=D(c.id))===null||o===void 0?void 0:o.api)===null||u===void 0?void 0:u.slug}),!((b=c.decision)===null||b===void 0)&&b.note?r(P,{"data-testid":"apigee-decision-note",children:[c.decision.action==="approve"?"Approved":"Rejected",": \u201C",c.decision.note,"\u201D"]}):null]},c.id)})]})}),e("td",{"data-label":"Status",children:e(Ke,{status:de(n)})}),e("td",{className:"actions menu",children:e(ue,{trigger:e(A,{variant:"text",size:"small","aria-label":"Key actions",icon:e(w,{name:"ellipsis-vertical",size:"14px"}),"data-testid":"apigee-key-menu"}),alignment:"end",portalled:!0,children:e(pe,{items:[{content:"Edit API products",onAction:()=>I({consumerKey:n.consumerKey,products:n.apiProducts.map(c=>c.id)}),dataAttributes:{"data-testid":"apigee-edit-key"}},{content:"Delete key",dangerous:!0,separatorLine:!0,onAction:()=>C(n.consumerKey),dataAttributes:{"data-testid":"apigee-delete-key"}}]})})})]},n.consumerKey)})})]})}),t.credentials.some(n=>de(n)==="approved")?e("div",{style:{marginTop:"var(--spacing-base)"},children:r(O,{tone:"info",children:[e("strong",{children:"Keys are picked up by Try it."})," Open an operation of an approved API product in the API reference and the key is already filled in."]})}):null]}),e(re,{open:y,onClose:()=>p(!1),onSubmit:n=>T(this,void 0,void 0,function*(){const m=yield _.updateApp(t.id,n,h);return F(m),m}),products:l,teams:g,initial:t}),e(Re,{open:k!==null,onClose:()=>I(null),onSubmit:n=>T(this,void 0,void 0,function*(){const m=k?.consumerKey;if(m){const o=yield _.updateKey(t.id,m,n,h);return x(t.credentials.map(u=>u.consumerKey===m?o:u)),o}const c=yield _.createKey(t.id,n,h);return x([...t.credentials,c]),c}),products:l,initial:k?.products}),e(oe,{open:v,onClose:()=>f(!1),title:"Delete app?",confirmLabel:"Delete app",danger:!0,onConfirm:()=>T(this,void 0,void 0,function*(){return yield _.deleteApp(t.id,h),a(d()),ze(t),s.success(`${t.name} deleted`),!0}),children:r("p",{children:[e("strong",{children:t.name})," and all of its keys stop working immediately. This cannot be undone."]})}),e(oe,{open:S!==null,onClose:()=>C(null),title:"Delete key?",confirmLabel:"Delete key",danger:!0,onConfirm:()=>T(this,void 0,void 0,function*(){return S&&(yield _.deleteKey(t.id,S,h),x(t.credentials.filter(n=>n.consumerKey!==S))),!0}),children:e("p",{children:"Requests that send this key are rejected from now on. This cannot be undone."})})]})}export{Oe as APPS_DESCRIPTION,$e as AppsTable,ot as AppsView};
@@ -6,4 +6,4 @@ var O=function(t,o,n,r){function a(s){return s instanceof n?s:new n(function(d){
6
6
  `,Z=q(J)`
7
7
  max-height: 320px;
8
8
  overflow-y: auto;
9
- `;function R({products:t,selected:o,onChange:n}){const[r,a]=m(""),s=r.trim().toLowerCase(),d=t.filter(i=>`${i.name} ${i.description}`.toLowerCase().includes(s));return l(f,{as:"div",children:[l(Y,{children:[e(C,{children:"API products"}),t.length>0?l(y,{"data-testid":"apigee-product-count",children:[o.length," selected"]}):null]}),t.length===0?e(y,{children:"No API products are available to you yet."}):null,t.length>X?e(j,{type:"search",value:r,onChange:i=>a(i.target.value),placeholder:"Search API products","aria-label":"Search API products","data-testid":"apigee-product-search"}):null,t.length>0&&d.length===0?l(y,{children:["No API products match \u201C",r.trim(),"\u201D."]}):null,d.length>0?e(Z,{"data-testid":"apigee-product-picker",children:d.map(i=>{const u=o.includes(i.id);return l(Q,{$checked:u,children:[e("input",{type:"checkbox",checked:u,onChange:p=>n(p.target.checked?[...o,i.id]:o.filter(c=>c!==i.id))}),l("span",{children:[l(G,{children:[i.name,e(z,{color:i.approvalType==="manual"?"orange":"grey",children:i.approvalType==="manual"?"requires approval":"auto-approved"})]}),i.description?e(y,{children:i.description}):null]})]},i.id)})}):null]})}function U(t,o){return t.some(n=>o.includes(n.id)&&n.approvalType==="manual")}function he(t){var{open:o}=t,n=x(t,["open"]);return o?e(ee,Object.assign({},n)):null}function ee({onClose:t,onSubmit:o,products:n,teams:r,initial:a,initialProduct:s,initialTeamId:d}){var i,u,p;const c=!!a,[h,g]=m((i=a?.name)!==null&&i!==void 0?i:""),[k,M]=m((u=a?.description)!==null&&u!==void 0?u:""),[L,W]=m((p=a?.callbackUrl)!==null&&p!==void 0?p:""),[N,H]=m(a?.owner.kind==="team"?a.owner.teamId:d??""),[_,$]=m(s?[s]:[]),[A,B]=m(""),w=D(),K=()=>O(this,void 0,void 0,function*(){(yield w.run(()=>o(Object.assign(Object.assign({name:h.trim(),description:k.trim(),callbackUrl:L.trim(),apiProducts:_},A.trim()?{note:A.trim()}:{}),N?{teamId:N}:{}))))!==void 0&&t()});return l(T,{open:!0,onClose:t,wide:!0,title:c?"Edit app":"New app",testId:"apigee-app-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:w.pending,children:"Cancel"}),e(b,{variant:"primary",onClick:K,disabled:w.pending||!h.trim(),"data-testid":"apigee-app-submit",children:c?"Save":"Create app"})]}),children:[w.error?e(P,{tone:"danger",children:w.error}):null,l(f,{children:[e(F,{children:"Name"}),e(j,{value:h,onChange:v=>g(v.target.value),placeholder:"Ticketing kiosk",required:!0,autoFocus:!0,"data-testid":"apigee-app-name"}),c?null:e(y,{children:"Letters, digits, spaces, dots, dashes and underscores. The name cannot change later."})]}),!c&&r.length>0?l(f,{as:"div",children:[e(C,{children:"Owner"}),e(E,{value:N,options:[{value:"",element:"Personal"},...r.map(v=>({value:v.id,element:`Team \xB7 ${v.name}`}))],onChange:v=>H(v),dataTestId:"apigee-app-owner"}),e(y,{children:"Team apps are shared with every member of the team."})]}):null,c?null:e(R,{products:n,selected:_,onChange:$}),!c&&U(n,_)?l(f,{children:[e(C,{children:"Why do you need access?"}),e(S,{value:A,onChange:v=>B(v.target.value),placeholder:"Sent to the reviewers of the request","data-testid":"apigee-app-note"})]}):null,l(f,{children:[e(C,{children:"Description"}),e(S,{value:k,onChange:v=>M(v.target.value),placeholder:"What does this app do?"})]}),l(f,{children:[e(C,{children:"Callback URL"}),e(j,{value:L,onChange:v=>W(v.target.value),placeholder:"https://example.com/oauth/callback"}),e(y,{children:"Where OAuth 2.0 authorization codes are sent. Separate several URLs with commas."})]})]})}function me(t){var{open:o}=t,n=x(t,["open"]);return o?e(te,Object.assign({},n)):null}function te({onClose:t,onSubmit:o,products:n,initial:r}){const a=r!==void 0,[s,d]=m(r??[]),[i,u]=m(""),p=D(),c=s.filter(g=>!(r??[]).includes(g)),h=()=>O(this,void 0,void 0,function*(){(yield p.run(()=>o(Object.assign({apiProducts:s},i.trim()?{note:i.trim()}:{}))))!==void 0&&t()});return l(T,{open:!0,onClose:t,wide:!0,title:a?"Edit API products":"Create key",testId:"apigee-key-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:p.pending,children:"Cancel"}),e(b,{variant:"primary",onClick:h,disabled:p.pending,"data-testid":"apigee-key-submit",children:a?"Save":"Create key"})]}),children:[p.error?e(P,{tone:"danger",children:p.error}):null,e(R,{products:n,selected:s,onChange:d}),U(n,c)?l(f,{children:[e(C,{children:"Why do you need access?"}),e(S,{value:i,onChange:g=>u(g.target.value),placeholder:"Sent to the reviewers of the request"})]}):null]})}function ge(t){var{open:o}=t,n=x(t,["open"]);return o?e(ne,Object.assign({},n)):null}function ne({onClose:t,onSubmit:o,initial:n}){var r,a;const s=!!n,[d,i]=m((r=n?.name)!==null&&r!==void 0?r:""),[u,p]=m((a=n?.description)!==null&&a!==void 0?a:""),c=D(),h=()=>O(this,void 0,void 0,function*(){(yield c.run(()=>o({name:d.trim(),description:u.trim()})))!==void 0&&t()});return l(T,{open:!0,onClose:t,title:s?"Edit team":"New team",testId:"apigee-team-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:c.pending,children:"Cancel"}),e(b,{variant:"primary",onClick:h,disabled:c.pending||!d.trim(),"data-testid":"apigee-team-submit",children:s?"Save":"Create team"})]}),children:[c.error?e(P,{tone:"danger",children:c.error}):null,l(f,{children:[e(F,{children:"Name"}),e(j,{value:d,onChange:g=>i(g.target.value),placeholder:"Platform squad",required:!0,autoFocus:!0,"data-testid":"apigee-team-name"}),s?null:e(y,{children:"The identifier of the team in Apigee comes from the name and cannot change later."})]}),l(f,{children:[e(C,{children:"Description"}),e(S,{value:u,onChange:g=>p(g.target.value),placeholder:"What does this team build?"})]})]})}function ve(t){var{open:o}=t,n=x(t,["open"]);return o?e(re,Object.assign({},n)):null}function re({onClose:t,onSubmit:o}){const[n,r]=m(""),[a,s]=m("member"),d=D(),i=()=>O(this,void 0,void 0,function*(){(yield d.run(()=>o({email:n.trim(),role:a})))!==void 0&&t()});return l(T,{open:!0,onClose:t,title:"Add member",testId:"apigee-member-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:d.pending,children:"Cancel"}),e(b,{variant:"primary",onClick:i,disabled:d.pending||!n.trim(),"data-testid":"apigee-member-submit",children:"Add member"})]}),children:[d.error?e(P,{tone:"danger",children:d.error}):null,l(f,{children:[e(F,{children:"Email"}),e(j,{type:"email",value:n,onChange:u=>r(u.target.value),placeholder:"colleague@example.com",required:!0,autoFocus:!0,"data-testid":"apigee-member-email"}),e(y,{children:"The member signs in with the portal account that has this email."})]}),l(f,{as:"div",children:[e(C,{children:"Role"}),e(E,{value:a,options:V,onChange:u=>s(u),dataTestId:"apigee-member-role-select"}),e(y,{children:"Owners can add and remove members and delete the team."})]})]})}function fe(t){var{open:o}=t,n=x(t,["open"]);return o?e(ae,Object.assign({},n)):null}function ae({onClose:t,onConfirm:o,title:n,children:r,confirmLabel:a,danger:s,withNote:d,noteLabel:i="Note",notePlaceholder:u="Optional"}){const[p,c]=m(""),h=D(),g=()=>O(this,void 0,void 0,function*(){(yield h.run(()=>o(p.trim()||void 0)))!==void 0&&t()});return l(T,{open:!0,onClose:t,title:n,testId:"apigee-confirm-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:h.pending,children:"Cancel"}),e(b,{variant:"primary",tone:s?"danger":"default",onClick:g,disabled:h.pending,"data-testid":"apigee-confirm",children:a})]}),children:[h.error?e(P,{tone:"danger",children:h.error}):null,r,d?l(f,{children:[e(C,{children:i}),e(S,{value:p,onChange:k=>c(k.target.value),placeholder:u,"data-testid":"apigee-confirm-note"})]}):null]})}export{he as AppDialog,fe as ConfirmDialog,me as KeyDialog,ve as MemberDialog,V as ROLE_OPTIONS,ge as TeamDialog};
9
+ `;function R({products:t,selected:o,onChange:n}){const[r,a]=m(""),s=r.trim().toLowerCase(),d=t.filter(i=>`${i.name} ${i.description}`.toLowerCase().includes(s));return l(f,{as:"div",children:[l(Y,{children:[e(C,{children:"API products"}),t.length>0?l(y,{"data-testid":"apigee-product-count",children:[o.length," selected"]}):null]}),t.length===0?e(y,{children:"No API products are available to you yet."}):null,t.length>X?e(j,{type:"search",value:r,onChange:i=>a(i.target.value),placeholder:"Search API products","aria-label":"Search API products","data-testid":"apigee-product-search"}):null,t.length>0&&d.length===0?l(y,{children:["No API products match \u201C",r.trim(),"\u201D."]}):null,d.length>0?e(Z,{"data-testid":"apigee-product-picker",children:d.map(i=>{const u=o.includes(i.id);return l(Q,{$checked:u,children:[e("input",{type:"checkbox",checked:u,onChange:p=>n(p.target.checked?[...o,i.id]:o.filter(c=>c!==i.id))}),l("span",{children:[l(G,{children:[i.name,e(z,{color:i.approvalType==="manual"?"orange":"grey",children:i.approvalType==="manual"?"requires approval":"auto-approved"})]}),i.description?e(y,{children:i.description}):null]})]},i.id)})}):null]})}function U(t,o){return t.some(n=>o.includes(n.id)&&n.approvalType==="manual")}function he(t){var{open:o}=t,n=x(t,["open"]);return o?e(ee,Object.assign({},n)):null}function ee({onClose:t,onSubmit:o,products:n,teams:r,initial:a,initialProduct:s,initialTeamId:d}){var i,u,p;const c=!!a,[h,g]=m((i=a?.name)!==null&&i!==void 0?i:""),[k,M]=m((u=a?.description)!==null&&u!==void 0?u:""),[L,W]=m((p=a?.callbackUrl)!==null&&p!==void 0?p:""),[N,H]=m(a?.owner.kind==="team"?a.owner.teamId:d??""),[_,$]=m(s?[s]:[]),[A,B]=m(""),w=D(),K=()=>O(this,void 0,void 0,function*(){(yield w.run(()=>o(Object.assign(Object.assign({name:h.trim(),description:k.trim(),callbackUrl:L.trim(),apiProducts:_},A.trim()?{note:A.trim()}:{}),N?{teamId:N}:{}))))!==void 0&&t()});return l(T,{open:!0,onClose:t,wide:!0,title:c?"Edit app":"New app",testId:"apigee-app-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:w.pending,children:"Cancel"}),e(b,{variant:"primary",onClick:K,disabled:w.pending||!h.trim(),"data-testid":"apigee-app-submit",children:c?"Save":"Create app"})]}),children:[w.error?e(P,{tone:"danger",children:w.error}):null,l(f,{children:[e(F,{children:"Name"}),e(j,{value:h,onChange:v=>g(v.target.value),placeholder:"Ticketing kiosk",required:!0,autoFocus:!0,"data-testid":"apigee-app-name"}),c?null:e(y,{children:"Letters, digits, spaces, dots, dashes and underscores. The name cannot change later."})]}),!c&&r.length>0?l(f,{as:"div",children:[e(C,{children:"Owner"}),e(E,{value:N,options:[{value:"",element:"Personal"},...r.map(v=>({value:v.id,element:`Team \xB7 ${v.name}`}))],onChange:v=>H(v),portalled:!0,dataTestId:"apigee-app-owner"}),e(y,{children:"Team apps are shared with every member of the team."})]}):null,c?null:e(R,{products:n,selected:_,onChange:$}),!c&&U(n,_)?l(f,{children:[e(C,{children:"Why do you need access?"}),e(S,{value:A,onChange:v=>B(v.target.value),placeholder:"Sent to the reviewers of the request","data-testid":"apigee-app-note"})]}):null,l(f,{children:[e(C,{children:"Description"}),e(S,{value:k,onChange:v=>M(v.target.value),placeholder:"What does this app do?"})]}),l(f,{children:[e(C,{children:"Callback URL"}),e(j,{value:L,onChange:v=>W(v.target.value),placeholder:"https://example.com/oauth/callback"}),e(y,{children:"Where OAuth 2.0 authorization codes are sent. Separate several URLs with commas."})]})]})}function me(t){var{open:o}=t,n=x(t,["open"]);return o?e(te,Object.assign({},n)):null}function te({onClose:t,onSubmit:o,products:n,initial:r}){const a=r!==void 0,[s,d]=m(r??[]),[i,u]=m(""),p=D(),c=s.filter(g=>!(r??[]).includes(g)),h=()=>O(this,void 0,void 0,function*(){(yield p.run(()=>o(Object.assign({apiProducts:s},i.trim()?{note:i.trim()}:{}))))!==void 0&&t()});return l(T,{open:!0,onClose:t,wide:!0,title:a?"Edit API products":"Create key",testId:"apigee-key-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:p.pending,children:"Cancel"}),e(b,{variant:"primary",onClick:h,disabled:p.pending,"data-testid":"apigee-key-submit",children:a?"Save":"Create key"})]}),children:[p.error?e(P,{tone:"danger",children:p.error}):null,e(R,{products:n,selected:s,onChange:d}),U(n,c)?l(f,{children:[e(C,{children:"Why do you need access?"}),e(S,{value:i,onChange:g=>u(g.target.value),placeholder:"Sent to the reviewers of the request"})]}):null]})}function ge(t){var{open:o}=t,n=x(t,["open"]);return o?e(ne,Object.assign({},n)):null}function ne({onClose:t,onSubmit:o,initial:n}){var r,a;const s=!!n,[d,i]=m((r=n?.name)!==null&&r!==void 0?r:""),[u,p]=m((a=n?.description)!==null&&a!==void 0?a:""),c=D(),h=()=>O(this,void 0,void 0,function*(){(yield c.run(()=>o({name:d.trim(),description:u.trim()})))!==void 0&&t()});return l(T,{open:!0,onClose:t,title:s?"Edit team":"New team",testId:"apigee-team-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:c.pending,children:"Cancel"}),e(b,{variant:"primary",onClick:h,disabled:c.pending||!d.trim(),"data-testid":"apigee-team-submit",children:s?"Save":"Create team"})]}),children:[c.error?e(P,{tone:"danger",children:c.error}):null,l(f,{children:[e(F,{children:"Name"}),e(j,{value:d,onChange:g=>i(g.target.value),placeholder:"Platform squad",required:!0,autoFocus:!0,"data-testid":"apigee-team-name"}),s?null:e(y,{children:"The identifier of the team in Apigee comes from the name and cannot change later."})]}),l(f,{children:[e(C,{children:"Description"}),e(S,{value:u,onChange:g=>p(g.target.value),placeholder:"What does this team build?"})]})]})}function ve(t){var{open:o}=t,n=x(t,["open"]);return o?e(re,Object.assign({},n)):null}function re({onClose:t,onSubmit:o}){const[n,r]=m(""),[a,s]=m("member"),d=D(),i=()=>O(this,void 0,void 0,function*(){(yield d.run(()=>o({email:n.trim(),role:a})))!==void 0&&t()});return l(T,{open:!0,onClose:t,title:"Add member",testId:"apigee-member-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:d.pending,children:"Cancel"}),e(b,{variant:"primary",onClick:i,disabled:d.pending||!n.trim(),"data-testid":"apigee-member-submit",children:"Add member"})]}),children:[d.error?e(P,{tone:"danger",children:d.error}):null,l(f,{children:[e(F,{children:"Email"}),e(j,{type:"email",value:n,onChange:u=>r(u.target.value),placeholder:"colleague@example.com",required:!0,autoFocus:!0,"data-testid":"apigee-member-email"}),e(y,{children:"The member signs in with the portal account that has this email."})]}),l(f,{as:"div",children:[e(C,{children:"Role"}),e(E,{value:a,options:V,onChange:u=>s(u),portalled:!0,dataTestId:"apigee-member-role-select"}),e(y,{children:"Owners can add and remove members and delete the team."})]})]})}function fe(t){var{open:o}=t,n=x(t,["open"]);return o?e(ae,Object.assign({},n)):null}function ae({onClose:t,onConfirm:o,title:n,children:r,confirmLabel:a,danger:s,withNote:d,noteLabel:i="Note",notePlaceholder:u="Optional"}){const[p,c]=m(""),h=D(),g=()=>O(this,void 0,void 0,function*(){(yield h.run(()=>o(p.trim()||void 0)))!==void 0&&t()});return l(T,{open:!0,onClose:t,title:n,testId:"apigee-confirm-dialog",footer:l(I,{children:[e(b,{variant:"outlined",onClick:t,disabled:h.pending,children:"Cancel"}),e(b,{variant:"primary",tone:s?"danger":"default",onClick:g,disabled:h.pending,"data-testid":"apigee-confirm",children:a})]}),children:[h.error?e(P,{tone:"danger",children:h.error}):null,r,d?l(f,{children:[e(C,{children:i}),e(S,{value:p,onChange:k=>c(k.target.value),placeholder:u,"data-testid":"apigee-confirm-note"})]}):null]})}export{he as AppDialog,fe as ConfirmDialog,me as KeyDialog,ve as MemberDialog,V as ROLE_OPTIONS,ge as TeamDialog};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/framework-plugin-apigee",
3
- "version": "0.1.0-next.16",
3
+ "version": "0.1.0-next.18",
4
4
  "description": "Experimental Apigee developer onboarding plugin for Redocly",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -26,7 +26,7 @@
26
26
  "styled-components": "^6.4.2"
27
27
  },
28
28
  "devDependencies": {
29
- "@redocly/framework": "1.0.0-next.23",
29
+ "@redocly/framework": "1.0.0-next.25",
30
30
  "@types/node": "26.6.6",
31
31
  "@types/react": "^19.2.7",
32
32
  "@types/react-dom": "^19.2.3",
@@ -38,8 +38,8 @@
38
38
  "vitest": "4.1.11"
39
39
  },
40
40
  "peerDependencies": {
41
- "@redocly/framework": "^1.0.0-next.23",
42
- "@redocly/theme": "0.73.0-next.17",
41
+ "@redocly/framework": "^1.0.0-next.25",
42
+ "@redocly/theme": "0.73.0-next.19",
43
43
  "react": "^19.2.7",
44
44
  "react-dom": "^19.2.7",
45
45
  "react-router": "^8.3.0"