unleash-server 7.4.2 → 7.4.3
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/dist/lib/features/index.d.ts +1 -0
- package/dist/lib/features/index.d.ts.map +1 -1
- package/dist/lib/features/index.js +1 -0
- package/dist/lib/features/index.js.map +1 -1
- package/dist/lib/routes/admin-api/user/user.d.ts +1 -0
- package/dist/lib/routes/admin-api/user/user.d.ts.map +1 -1
- package/dist/lib/routes/admin-api/user/user.js +12 -1
- package/dist/lib/routes/admin-api/user/user.js.map +1 -1
- package/dist/lib/server-impl.d.ts +2 -2
- package/dist/lib/server-impl.d.ts.map +1 -1
- package/dist/lib/server-impl.js +2 -2
- package/dist/lib/server-impl.js.map +1 -1
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/{AdvancedPlayground-DRpxJMnK.js → AdvancedPlayground-BVQjoHnr.js} +1 -1
- package/frontend/build/static/{BackendConnections-_n7OFNmD.js → BackendConnections-bRvUo06H.js} +1 -1
- package/frontend/build/static/{CreateProject-068uYB82.js → CreateProject-z7K5-k8g.js} +1 -1
- package/frontend/build/static/{EnterpriseEdge-D8BFcFOL.js → EnterpriseEdge-CAkbmuGs.js} +1 -1
- package/frontend/build/static/{FeatureMetricsChart-CmPDv0Qg.js → FeatureMetricsChart-TPw8l2qi.js} +1 -1
- package/frontend/build/static/{FeatureStaleDialog-p_WEko7Q.js → FeatureStaleDialog-DwV5Mzh6.js} +1 -1
- package/frontend/build/static/{FeatureViewLazyExport-CsvADBC_.js → FeatureViewLazyExport-CBpSqVMU.js} +2 -2
- package/frontend/build/static/{FlagMetricsChart-D0cnIXiN.js → FlagMetricsChart-DLcy8CzE.js} +1 -1
- package/frontend/build/static/{FrontendNetworkTrafficUsage-DF0QQUFI.js → FrontendNetworkTrafficUsage-CYJZFmkc.js} +1 -1
- package/frontend/build/static/{GridLayoutWrapper-CvaFKuMM.js → GridLayoutWrapper-CixVvIgD.js} +1 -1
- package/frontend/build/static/{ImpactMetricsPage-BQnbfPhs.js → ImpactMetricsPage-AS6DHn5C.js} +1 -1
- package/frontend/build/static/{LazyAdminExport-CaPIJWoT.js → LazyAdminExport-dyqU9IvB.js} +3 -3
- package/frontend/build/static/{LazyProjectExport-DxVvRHV2.js → LazyProjectExport-B1vRaljX.js} +2 -2
- package/frontend/build/static/{LifecycleChartComponent-7r5tp81g.js → LifecycleChartComponent-BGuUP9oF.js} +1 -1
- package/frontend/build/static/{LineChartComponent-p_JFdSdE.js → LineChartComponent-DA6kG8Ei.js} +1 -1
- package/frontend/build/static/{MarkCompletedDialogue-BHRKKIec.js → MarkCompletedDialogue-D2TM3HgS.js} +1 -1
- package/frontend/build/static/{NetworkOverview-Dr4-ROCD.js → NetworkOverview-aNdwr7xF.js} +1 -1
- package/frontend/build/static/{NetworkPrometheusAPIWarning-COfHXZmz.js → NetworkPrometheusAPIWarning-f1m-ZHgX.js} +1 -1
- package/frontend/build/static/{NetworkTraffic-Dm-2mi3M.js → NetworkTraffic-CzH9_YqS.js} +1 -1
- package/frontend/build/static/{NetworkTrafficUsage-fGr4QA8t.js → NetworkTrafficUsage-BqpcQ4JO.js} +1 -1
- package/frontend/build/static/{PercentageDonut-DystLTgb.js → PercentageDonut-cKg6eF-p.js} +1 -1
- package/frontend/build/static/{ReactJSONEditor-CdN66QkS.js → ReactJSONEditor-BH7GX57b.js} +1 -1
- package/frontend/build/static/{RoleCell-BjcvUPQZ.js → RoleCell-D01N1lHV.js} +1 -1
- package/frontend/build/static/{aggregateFeatureMetrics-60FrVlfS.js → aggregateFeatureMetrics-DJ_IwcyH.js} +1 -1
- package/frontend/build/static/{formatTickValue-CODpmZvr.js → formatTickValue-ClJtK_xN.js} +1 -1
- package/frontend/build/static/{index-B_EIW-7Y.js → index-Cz4lAJ3Y.js} +117 -117
- package/frontend/build/static/{networkTrafficUsageHighlightPlugin-COgb9_ZU.js → networkTrafficUsageHighlightPlugin-Ce-A3Xr6.js} +1 -1
- package/frontend/build/static/{useApiTokens-CdZATTgS.js → useApiTokens-Dx2wjhgw.js} +1 -1
- package/frontend/package.json +1 -1
- package/package.json +2 -2
package/frontend/build/static/{LazyProjectExport-DxVvRHV2.js → LazyProjectExport-B1vRaljX.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var sd=Object.defineProperty;var od=(e,t,n)=>t in e?sd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var q=(e,t,n)=>od(e,typeof t!="symbol"?t+"":t,n);import{fM as ld,fN as dd,fO as ze,r as h,s as u,fP as ud,dl as v2,F as X1,H as ee,j as a,B as O,f as O1,y as Y1,D as $1,aX as Pr,J as C0,aY as D0,aZ as ce,fQ as p3,a_ as pe,d as V3,fR as cc,b0 as se,T as I,fS as ve,dr as P2,L as x1,cT as E2,bg as Z2,dj as sc,dw as Ze,fT as hd,n as $0,aC as Ie,fU as md,fV as fd,aq as C1,k as c1,fW as pd,fX as vd,fY as Je,fZ as gd,C as V,i as y1,bc as xd,aV as he,d8 as le,G as N3,R as T1,bd as Er,aR as T0,aU as P0,aS as I2,f_ as oc,fu as jd,cc as M3,ao as M2,dE as Zr,dF as Ir,b7 as B1,f$ as bd,g0 as lc,bi as dc,g1 as yd,b as _1,aj as Q1,aw as re,g2 as uc,g3 as hc,dA as Pe,g4 as j8,g5 as _d,dB as I3,g6 as wd,dC as Sd,g7 as Be,g8 as mc,dg as fc,g9 as pc,ga as vc,cm as W3,b9 as me,u as A2,M as z3,gb as pr,d0 as gc,gc as l3,gd as Od,ge as Cd,gf as Dd,gg as $d,gh as Td,gi as Pd,gj as Ed,gk as Zd,gl as Id,gm as Md,gn as Ad,go as Fd,gp as Rd,gq as Ld,gr as Vd,gs as g3,fy as y0,gt as xc,gu as Nd,aJ as Qe,c3 as te,ba as v1,gv as g2,aD as Wd,cb as Mr,ds as zd,gw as Bd,gx as Yd,U as Hd,ap as Ar,br as ne,cN as _0,gy as Ud,gz as kd,gA as jc,x as Fr,gB as qd,bI as Xe,gC as Kd,gD as vr,bP as bc,gE as Gd,gF as yc,gG as Qd,eH as F2,ar as R2,aO as n1,bf as e3,gH as Jd,gI as Rr,K as L2,c5 as J1,gJ as _c,gK as Xd,gL as eu,b1 as x3,aE as j3,aF as B3,aK as Y3,_ as H3,a as W1,aL as U3,aN as k3,aM as V2,gM as tu,gN as p1,c0 as nu,m as de,dk as Lr,gO as au,gP as ru,gQ as iu,b3,gR as cu,da as wc,c as x2,gS as su,gT as Sc,c_ as ge,c1 as ou,gU as lu,E as q3,cG as A3,ce as du,gV as uu,as as y3,aB as S1,gW as hu,av as Se,dm as mu,gX as fu,gY as pu,gZ as vu,el as Oc,g_ as gu,g$ as xu,h0 as ju,h1 as bu,h2 as Cc,h3 as Dc,aA as A1,ax as K3,h4 as $c,h5 as Tc,fB as yu,h6 as je,h as F3,cV as fe,h7 as _u,aQ as wu,h8 as Su,eF as N2,h9 as Ou,b6 as w0,ha as Cu,hb as Pc,hc as Du,hd as $u,bq as G3,dt as Tu,X as Vr,W as Ec,he as Pu,a$ as Q3,hf as Zc,hg as E0,hh as Eu,hi as Zu,hj as Iu,hk as Mu,bh as Me,ck as Ic,hl as Au,w as Fu,hm as Ru,hn as Nr,ho as Lu,cj as Mc,hp as Vu,hq as Nu,eC as Ac,o as Wr,q as zr,eE as v3,hr as Wu,hs as zu,ht as Bu,ex as Br,ai as Z1,ey as j2,hu as Yr,ac as W2,du as S0,hv as Yu,hw as Hu,eO as b2,al as z2,hx as Uu,au as Hr,hy as ku,aa as k1,ab as Z0,am as B2,ad as Y2,ae as H2,af as U2,ag as k2,hz as Fc,e6 as I0,bb as qu,an as Ur,A as q2,dX as Ku,hA as Gu,ep as u2,dW as oe,hB as Qu,hC as Ju,v as Rc,hD as Xu,hE as eh,at as M0,dR as kr,hF as th,hG as I4,hH as nh,hI as ah,cY as _3,cZ as f1,hJ as rh,hK as ih,I as w3,hL as ch,hM as sh,hN as Lc,fL as Vc,hO as gr,hP as b8,hQ as oh,dU as lh,dV as dh,hR as y8,hS as uh,hT as hh,hU as mh,hV as fh,hW as ph,hX as vh,hY as gh,cf as qr,cg as xh,bn as Nc,cJ as Kr,cK as Gr,hZ as jh,c6 as bh,c7 as yh,c8 as A0,h_ as _h,h$ as wh,bv as Sh,bw as Oh,z as _8,fs as Ch,d1 as Dh,d4 as $h,i0 as Th,i1 as Wc,i2 as Ph,i3 as Eh,i4 as Zh,b8 as Qr,i5 as Ih,i6 as Mh,b2 as F0,i7 as xr,i8 as Ah,i9 as K2,ia as Jr,ib as Xr,dx as zc,ic as e5,fD as Fh,id as Bc,e_ as Rh,ie as Lh,ig as Vh,ih as jr,ii as Nh,ij as Wh,e1 as zh,e3 as Bh,e4 as Yh,ik as Yc,il as Hc,im as Uc,io as Hh,ip as kc,iq as Uh,ir as kh,is as qh,fC as Kh,it as Gh,fG as Qh,dM as w8,dJ as Jh,iu as Xh,iv as em,iw as tm,dn as qc,ix as br,iy as nm,e8 as Kc,iz as am,dD as S8,iA as rm,iB as im,iC as cm,iD as a0,ci as Gc,iE as sm,iF as om,iG as lm,iH as dm,iI as um,fx as hm,iJ as mm,bA as fm,iK as pm,iL as vm,iM as gm}from"./index-B_EIW-7Y.js";import{F as Qc,M as xm}from"./MarkCompletedDialogue-BHRKKIec.js";import{a as jm,u as Jc,T as bm,b as ym,F as _m,h as wm,f as Sm,g as Om,e as Cm,d as Dm,E as $m}from"./FeatureStaleDialog-p_WEko7Q.js";import{m as Tm,i as O8,b as Pm,c as Em,d as Zm,e as Im,E as Mm,f as Am,u as Fm,a as Rm,R as Lm,C as Vm,A as Nm,g as Xc,j as Wm}from"./RoleCell-BjcvUPQZ.js";import"./useApiTokens-CdZATTgS.js";function zm(e,t){var n,i;ld(1,arguments);var c=dd(e);if(isNaN(c.getTime()))throw new RangeError("Invalid time value");var s=String((n=t==null?void 0:t.format)!==null&&n!==void 0?n:"extended"),o=String((i=t==null?void 0:t.representation)!==null&&i!==void 0?i:"complete");if(s!=="extended"&&s!=="basic")throw new RangeError("format must be 'extended' or 'basic'");if(o!=="date"&&o!=="time"&&o!=="complete")throw new RangeError("representation must be 'date', 'time', or 'complete'");var l="",d="",m=s==="extended"?"-":"",f=s==="extended"?":":"";if(o!=="time"){var v=ze(c.getDate(),2),p=ze(c.getMonth()+1,2),g=ze(c.getFullYear(),4);l="".concat(g).concat(m).concat(p).concat(m).concat(v)}if(o!=="date"){var j=c.getTimezoneOffset();if(j!==0){var b=Math.abs(j),_=ze(Math.floor(b/60),2),x=ze(b%60,2),w=j<0?"+":"-";d="".concat(w).concat(_,":").concat(x)}else d="Z";var P=ze(c.getHours(),2),C=ze(c.getMinutes(),2),D=ze(c.getSeconds(),2),W=l===""?"":"T",S=[P,C,D].join(f);l="".concat(l).concat(W).concat(S).concat(d)}return l}const es=e=>h.createElement("svg",{width:20,height:18,viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M14.125 0C15.7917 0 17.1875 0.616667 18.3125 1.85C19.4375 3.08333 20 4.55 20 6.25C20 6.55 19.9833 6.84583 19.95 7.1375C19.9167 7.42917 19.8583 7.71667 19.775 8H13.525L11.825 5.45C11.7417 5.31667 11.625 5.20833 11.475 5.125C11.325 5.04167 11.1667 5 11 5C10.7833 5 10.5875 5.06667 10.4125 5.2C10.2375 5.33333 10.1167 5.5 10.05 5.7L8.7 9.75L7.825 8.45C7.74167 8.31667 7.625 8.20833 7.475 8.125C7.325 8.04167 7.16667 8 7 8H0.225C0.141667 7.71667 0.0833333 7.42917 0.05 7.1375C0.0166667 6.84583 0 6.55833 0 6.275C0 4.55833 0.558333 3.08333 1.675 1.85C2.79167 0.616667 4.18333 0 5.85 0C6.65 0 7.40417 0.158333 8.1125 0.475C8.82083 0.791667 9.45 1.23333 10 1.8C10.5333 1.23333 11.1542 0.791667 11.8625 0.475C12.5708 0.158333 13.325 0 14.125 0ZM10 18C9.7 18 9.4125 17.9458 9.1375 17.8375C8.8625 17.7292 8.61667 17.5667 8.4 17.35L1.7 10.625C1.6 10.525 1.50833 10.425 1.425 10.325C1.34167 10.225 1.25833 10.1167 1.175 10H6.45L8.15 12.55C8.23333 12.6833 8.35 12.7917 8.5 12.875C8.65 12.9583 8.80833 13 8.975 13C9.19167 13 9.39167 12.9333 9.575 12.8C9.75833 12.6667 9.88333 12.5 9.95 12.3L11.3 8.25L12.15 9.55C12.25 9.68333 12.375 9.79167 12.525 9.875C12.675 9.95833 12.8333 10 13 10H18.8L18.55 10.3L18.3 10.6L11.575 17.35C11.3583 17.5667 11.1167 17.7292 10.85 17.8375C10.5833 17.9458 10.3 18 10 18Z"})),C8=u("div")(()=>({display:"flex"})),Bm=u("div")(()=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",width:"100%"}));u("div")(()=>({display:"flex",flexDirection:"column"}));const Ym=u("span")(({theme:e})=>({textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"})),Hm=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));u(Hm)(({theme:e})=>({color:e.palette.neutral.dark}));const Um=u(ud)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),km=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),qm=u("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),Km=u("h1")(({theme:e})=>({margin:0,width:"100%",fontSize:e.typography.h1.fontSize,fontWeight:"bold",display:"flex",alignItems:"center",gap:e.spacing(2),overflow:"hidden",lineHeight:1.5})),Gm=u("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Qm=u("div")(({theme:e})=>({padding:e.spacing(0,4)})),Jm=u(v2)(({theme:e})=>({textTransform:"none",flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1),minWidth:170},[e.breakpoints.up("md")]:{minWidth:170}}));var t5={},Xm=ee;Object.defineProperty(t5,"__esModule",{value:!0});var ts=t5.default=void 0,ef=Xm(X1()),tf=a,nf=(0,ef.default)((0,tf.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"LibraryAdd");ts=t5.default=nf;var n5={},af=ee;Object.defineProperty(n5,"__esModule",{value:!0});var ns=n5.default=void 0,rf=af(X1()),cf=a,sf=(0,rf.default)((0,cf.jsx)("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive");ns=n5.default=sf;var a5={},of=ee;Object.defineProperty(a5,"__esModule",{value:!0});var y2=a5.default=void 0,lf=of(X1()),df=a,uf=(0,lf.default)((0,df.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater");y2=a5.default=uf;const hf=u(O)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),mf=({projectId:e,row:t,onOpenArchiveDialog:n,onOpenStaleDialog:i})=>{const[c,s]=h.useState(null),[o,l]=h.useState(!1),{setToastData:d}=O1(),{original:{name:m,stale:f}}=t,v=!!c,p=x=>{s(x.currentTarget)},g=()=>{s(null)},j=`feature-${m}-actions`,b=`${j}-menu`,_=()=>{try{sc(m),l(!0),setTimeout(()=>{g(),l(!1)},1e3)}catch{d({type:"error",text:"Could not copy feature name"})}};return a.jsxs(hf,{children:[a.jsx(Y1,{title:"Feature flag actions",arrow:!0,describeChild:!0,children:a.jsx($1,{id:j,"data-loading":!0,"aria-controls":v?b:void 0,"aria-haspopup":"true","aria-expanded":v?"true":void 0,onClick:p,type:"button",children:a.jsx(Pr,{})})}),a.jsx(C0,{id:b,anchorEl:c,open:v,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:x=>({borderRadius:`${x.shape.borderRadius}px`,padding:x.spacing(1,1.5)})},children:a.jsxs(D0,{"aria-labelledby":j,children:[a.jsxs(ce,{sx:p3,onClick:_,children:[a.jsx(pe,{children:o?a.jsx(V3,{}):a.jsx(cc,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:o?"Copied!":"Copy Name"})})]}),a.jsx(ve,{projectId:e,permission:P2,children:({hasAccess:x})=>a.jsxs(ce,{sx:p3,onClick:g,disabled:!x,component:x1,to:`/projects/${e}/features/${m}/copy`,children:[a.jsx(pe,{children:a.jsx(ts,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Clone"})})]})}),a.jsx(ve,{projectId:e,permission:E2,children:({hasAccess:x})=>a.jsxs(ce,{sx:p3,onClick:()=>{n(m),g()},disabled:!x,children:[a.jsx(pe,{children:a.jsx(ns,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Archive"})})]})}),a.jsx(ve,{projectId:e,permission:Z2,children:({hasAccess:x})=>a.jsxs(ce,{sx:p3,onClick:()=>{g(),i({featureId:m,stale:f===!0})},disabled:!x,children:[a.jsx(pe,{children:a.jsx(y2,{})}),a.jsx(se,{children:a.jsxs(I,{variant:"body2",children:[f?"Un-mark":"Mark"," as stale"]})})]})})]})})]})},ff=u(O)(({theme:e})=>({display:"flex",justifyContent:"center",marginRight:e.spacing(-2)})),pf=({onChange:e,checked:t,title:n})=>a.jsx(ff,{"data-testid":hd,children:a.jsx($0,{onChange:e,title:n,checked:t,"data-loading":!0})}),D8=Ze.memo(pf),vf=u("div")(({theme:e})=>({position:"sticky",bottom:50,zIndex:e.zIndex.fab,pointerEvents:"none"})),gf=u(O)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),xf=u(Ie)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(2),marginLeft:"auto",marginRight:"auto",padding:e.spacing(2,3),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.background.alternative}`,borderRadius:e.shape.borderRadiusLarge,gap:e.spacing(1),flexWrap:"wrap",pointerEvents:"auto"})),jf=u("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),bf=u(I)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),yf=({count:e,children:t})=>e===0?null:a.jsx(vf,{"data-testid":md,children:a.jsx(gf,{children:a.jsxs(xf,{elevation:4,children:[a.jsxs(bf,{children:[a.jsx(jf,{"data-testid":fd,children:e})," selected"]}),t]})})}),_f=7,wf=e=>{const t=pd(new Date,-_f);return!!(e!=null&&e.lastSeenAt&&vd(new Date(e.lastSeenAt),t))},Sf=({projectId:e,featureIds:t,features:n,onConfirm:i})=>{const[c,s]=h.useState(!1),{trackEvent:o}=C1(),l=h.useMemo(()=>t.filter(m=>{const f=n.find(v=>v.name===m);return wf(f)}),[JSON.stringify(n),t]),d=async()=>{s(!1),i==null||i(),o("batch_operations",{props:{eventType:"features archived"}})};return a.jsxs(a.Fragment,{children:[a.jsx(ve,{projectId:e,permission:E2,children:({hasAccess:m})=>a.jsx("span",{children:a.jsx(c1,{disabled:!m||c,variant:"outlined",size:"small",onClick:()=>s(!0),children:"Archive"})})}),a.jsx(Qc,{projectId:e,featureIds:t,featuresWithUsage:l,onConfirm:d,isOpen:c,onClose:()=>s(!1)})]})},Q0="selection-actions-menu",Of=({projectId:e,data:t,onChange:n})=>{const[i,c]=h.useState(null),{staleFeatures:s}=Je(),{setToastData:o,setToastApiError:l}=O1(),{trackEvent:d}=C1(),m=!!i,f=t.map(({name:x})=>x),v=x=>{c(x.currentTarget)},p=()=>{c(null)},g=t.some(({stale:x})=>x===!0),j=t.some(({stale:x})=>x===!1),b=async()=>{try{p(),await s(e,f),n==null||n(),o({text:"Feature flags marked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features staled"}})}catch(x){l(y1(x))}},_=async()=>{try{p(),await s(e,f,!1),n==null||n(),o({text:"Feature flags unmarked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features unstaled"}})}catch(x){l(y1(x))}};return a.jsxs(a.Fragment,{children:[a.jsx(Y1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:a.jsx($1,{id:Q0,"aria-controls":m?Q0:void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:v,type:"button","data-testid":gd,children:a.jsx(Pr,{})})}),a.jsx(C0,{id:`${Q0}-menu`,anchorEl:i,open:m,onClose:p,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:x=>({borderRadius:`${x.shape.borderRadius}px`,padding:x.spacing(1,1.5)})},children:a.jsx(D0,{"aria-labelledby":`${Q0}-menu`,children:a.jsx(ve,{projectId:e,permission:Z2,children:({hasAccess:x})=>a.jsxs(a.Fragment,{children:[a.jsx(V,{condition:j,show:()=>a.jsxs(ce,{onClick:b,disabled:!x,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[a.jsx(pe,{children:a.jsx(y2,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Mark as stale"})})]})}),a.jsx(V,{condition:g,show:()=>a.jsxs(ce,{onClick:_,disabled:!x,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[a.jsx(pe,{children:a.jsx(y2,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},Cf=u("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),$8="manage-tags-form",T8=(e,t)=>[...e,...e.some(n=>n.value===t.value&&n.type===t.type)?[]:[t]],P8=(e,t)=>e.filter(n=>!(n.value===t.value&&n.type===t.type)),Df=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:T8(e.addedTags,t.payload),removedTags:P8(e.removedTags,t.payload)};case"remove":return{...e,addedTags:P8(e.addedTags,t.payload),removedTags:T8(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};case"reset":return{addedTags:[],removedTags:[]};default:return e}},E8={name:"",description:"",icon:""},$f=({open:e,initialValues:t,initialIndeterminateValues:n,onCancel:i,onSubmit:c})=>{const{tagTypes:s,loading:o}=xd(),[l,d]=h.useState(E8),[m,f]=h.useState([]),[v,p]=h.useState([]),{tags:g,refetch:j}=jm(l.name),{createTag:b}=Jc(),_=g.map(({value:z})=>({title:z})),[x,w]=h.useReducer(Df,{addedTags:[],removedTags:[]}),P=()=>{c(x),w({type:"reset"})},C=(z=s.length>0?s[0]:E8)=>{d(z);const A=n.filter(({type:M})=>M===z.name);f(t.filter(({type:M})=>M===z.name).filter(({type:M,value:k})=>!A.some(K=>K.value===k&&K.type===M)).map(({value:M})=>({title:M}))),p(A.map(({value:M})=>({title:M}))),w({type:"clear",payload:[]})};h.useEffect(()=>{s.length>0&&C()},[o]);const D=(z,A)=>{A!=null&&typeof A!="string"&&(z.preventDefault(),C(A))},W=(z,A)=>b({value:z,type:A}).then(async()=>{j(),f(M=>[...M,{title:z}]),w({type:"add",payload:{value:z,type:A}})}),S=(z,A,M,k)=>{M==="selectOption"?A.forEach(K=>{typeof K!="string"&&typeof K.inputValue=="string"&&K.inputValue&&K.title.startsWith("Create new value")&&W(K.inputValue,l.name),f(A),p(Z=>Z.filter(({title:H})=>H!==K.title)),k!=null&&k.option&&w({type:"add",payload:{value:k.option.title,type:l.name}})}):M==="clear"?(f([]),w({type:"clear",payload:t})):M==="removeOption"&&(f(A),k!=null&&k.option&&w({type:"remove",payload:{value:k.option.title,type:l.name}}))},R=()=>{C(),i()};return a.jsxs(he,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature flag tags",onClick:P,disabledPrimaryButton:x.addedTags.length===0&&x.removedTags.length===0,onClose:R,formId:$8,children:[a.jsx(I,{paragraph:!0,sx:{marginBottom:z=>z.spacing(2.5)},children:"Tags allow you to group features together"}),a.jsx("form",{id:$8,onSubmit:P,children:a.jsxs(Cf,{children:[a.jsx(bm,{options:s,disabled:o||s.length===0,value:l,onChange:D},o?"loading":s.length),a.jsx(V,{condition:!o&&s.length===0,show:a.jsxs(I,{variant:"body1",children:["No"," ",a.jsx(le,{component:x1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:a.jsx(ym,{disabled:o,options:_,existingTags:t,indeterminateOptions:v,tagType:l,selectedOptions:m,onChange:S})})]})})]})},Tf=({projectId:e,data:t,onChange:n})=>{const{bulkUpdateTags:i}=Jc(),{setToastData:c,setToastApiError:s}=O1(),{trackEvent:o}=C1(),[l,d]=h.useState(!1),[m,f]=h.useMemo(()=>{const p=t.flatMap(({tags:j})=>j||[]).reduce((j,b)=>[...j,...j.some(_=>_.type===b.type&&_.value===b.value)?[]:[b]],[]),g=p.filter(j=>!t.every(({tags:b})=>b==null?void 0:b.some(_=>_.type===j.type&&_.value===j.value)));return[p,g]},[t]),v=async({addedTags:p,removedTags:g})=>{const b={features:t.map(({name:_})=>_),tags:{addedTags:p,removedTags:g}};try{const _=[p.length>0&&`added ${p.length} tag${p.length>1?"s":""}`,g.length>0&&`removed ${g.length} tag${g.length>1?"s":""}`].filter(Boolean).join(" and ");await i(b,e),c({text:_,type:"success",autoHideDuration:12e3}),o("batch_operations",{props:{eventType:"tags updated"}})}catch(_){s(y1(_))}n==null||n(),d(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(ve,{projectId:e,permission:Z2,children:({hasAccess:p})=>a.jsx("span",{children:a.jsx(c1,{disabled:!p||l,variant:"outlined",size:"small",onClick:()=>d(!0),children:"Tags"})})}),a.jsx($f,{open:l,onCancel:()=>d(!1),onSubmit:v,initialValues:m,initialIndeterminateValues:f},t.length)]})},Pf=u(N3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),Z8=u(T1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Ef=({showExportDialog:e,data:t,onClose:n,onConfirm:i,environments:c,projectId:s})=>{const[o,l]=h.useState(c[0]),{bulkToggleFeaturesEnvironmentOff:d}=Er(),{addChange:m}=T0(),{setToastApiError:f,setToastData:v}=O1(),{isChangeRequestConfigured:p}=P0(s),{refetch:g}=I2(s),j=t.filter(w=>{var P,C;return((C=(P=w.environments)==null?void 0:P.find(D=>o===D.name))==null?void 0:C.enabled)===!1}).length,b=()=>c.map(w=>({key:w,label:w})),_=async()=>{try{p(o)?(await m(s,o,t.map(w=>({action:"updateEnabled",feature:w.name,payload:{enabled:!1}}))),g(),v({type:"success",text:"Changes added to draft"})):(await d(s,t.map(w=>w.name),o),v({type:"success",text:"Feature flags disabled"})),n(),i==null||i()}catch(w){f(y1(w))}},x=p(o)?"Add to change request":"Disable flags";return a.jsx(he,{open:e,title:"Disable feature flags",onClose:n,onClick:_,primaryButtonText:x,secondaryButtonText:"Cancel",children:a.jsxs(O,{children:["You have selected ",a.jsx("b",{children:t.length})," feature flags to disable.",a.jsx("br",{}),a.jsx("br",{}),a.jsx(I,{children:"Select which environment to disable the features for:"}),a.jsx(Pf,{options:b(),value:o,onChange:w=>l(w)}),a.jsx(V,{condition:p(o),show:a.jsx(Z8,{severity:"warning",children:"Change requests are enabled for this environment."})}),a.jsx(V,{condition:j>0,show:a.jsxs(Z8,{severity:"info",children:[j," feature"," ",j>1?"flags are ":"flag is ","already disabled."]})})]})})},Zf=u(N3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),I8=u(T1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),If=({showExportDialog:e,data:t,onClose:n,onConfirm:i,environments:c,projectId:s})=>{const[o,l]=h.useState(c[0]),{bulkToggleFeaturesEnvironmentOn:d}=Er(),{addChange:m}=T0(),{setToastApiError:f,setToastData:v}=O1(),{isChangeRequestConfigured:p}=P0(s),{refetch:g}=I2(s),j=t.filter(w=>{var P,C;return((C=(P=w.environments)==null?void 0:P.find(D=>o===D.name))==null?void 0:C.enabled)===!0}).length,b=()=>c.map(w=>({key:w,label:w})),_=async()=>{try{p(o)?(await m(s,o,t.map(w=>({action:"updateEnabled",feature:w.name,payload:{enabled:!0}}))),g(),v({type:"success",text:"Changes added to draft"})):(await d(s,t.map(w=>w.name),o),v({type:"success",text:"Feature flags enabled"})),n(),i==null||i()}catch(w){f(y1(w))}},x=p(o)?"Add to change request":"Enable flags";return a.jsx(he,{open:e,title:"Enable feature flags",onClose:n,onClick:_,primaryButtonText:x,secondaryButtonText:"Cancel",children:a.jsxs(O,{children:["You have selected ",a.jsx("b",{children:t.length})," feature flags to enable.",a.jsx("br",{}),a.jsx("br",{}),a.jsx(I,{children:"Select which environment to enable the features for:"}),a.jsx(Zf,{options:b(),value:o,onChange:w=>l(w)}),a.jsx(V,{condition:p(o),show:a.jsx(I8,{severity:"warning",children:"Change requests are enabled for this environment."})}),a.jsx(V,{condition:j>0,show:a.jsxs(I8,{severity:"info",children:[j," feature"," ",j>1?"flags are ":"flag is ","already enabled."]})})]})})},Mf=({selectedIds:e,data:t,projectId:n,onResetSelection:i,onChange:c})=>{const[s,o]=h.useState(!1),[l,d]=h.useState(!1),[m,f]=h.useState(!1),{trackEvent:v}=C1(),p=h.useMemo(()=>t.filter(w=>e.includes(w.name)),[t,e]),g=h.useMemo(()=>{const w=p.flatMap(P=>P.environments).map(P=>P==null?void 0:P.name).filter(P=>P!==void 0);return Array.from(new Set(w))},[p]),j=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features exported"}})},b=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features enabled"}})},_=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features disabled"}})},x=()=>{c==null||c(),i()};return a.jsxs(a.Fragment,{children:[a.jsx(c1,{variant:"outlined",size:"small",onClick:()=>d(!0),children:"Enable"}),a.jsx(c1,{variant:"outlined",size:"small",onClick:()=>f(!0),children:"Disable"}),a.jsx(Sf,{projectId:n,featureIds:e,features:t,onConfirm:x}),a.jsx(c1,{variant:"outlined",size:"small",onClick:()=>o(!0),children:"Export"}),a.jsx(Tf,{projectId:n,data:p,onChange:c}),a.jsx(Of,{projectId:n,data:p,onChange:c}),a.jsx(oc,{showExportDialog:s,data:p,onClose:()=>o(!1),environments:g,onConfirm:j}),a.jsx(If,{showExportDialog:l,data:p,onClose:()=>d(!1),environments:g,projectId:n,onConfirm:b}),a.jsx(Ef,{showExportDialog:m,data:p,onClose:()=>f(!1),environments:g,projectId:n,onConfirm:_})]})},Af=u(jd)(({theme:e})=>({color:e.palette.warning.main,fontSize:e.fontSizes.bodySize})),Ff=()=>a.jsx(M3,{arrow:!0,title:a.jsxs(a.Fragment,{children:["This environment has no variants enabled. If you check this feature's variants in this environment, you will get the"," ",a.jsx("a",{href:"https://docs.getunleash.io/concepts/feature-flag-variants#the-disabled-variant",target:"_blank",rel:"noreferrer",children:"disabled variant"}),"."]}),children:a.jsx(Af,{})}),as=u("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...M2,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),Rf=u("div")(({theme:e})=>({flexGrow:0,...M2,justifyContent:"center"})),Lf=({value:e,featureId:t,projectId:n,environment:i,isChangeRequestEnabled:c,someEnabledEnvironmentHasVariants:s,refetch:o,onFeatureToggleSwitch:l})=>{const d=h.useMemo(()=>s&&(i==null?void 0:i.variantCount)===0&&(i==null?void 0:i.enabled),[s,i]),m=(f,v)=>{var p;l(f,{projectId:n,featureId:t,environmentName:(i==null?void 0:i.name)||"",environmentType:i==null?void 0:i.type,hasStrategies:i==null?void 0:i.hasStrategies,hasReleasePlans:!!((p=i==null?void 0:i.releasePlans)!=null&&p.length),hasEnabledStrategies:i==null?void 0:i.hasEnabledStrategies,isChangeRequestEnabled:c,onRollback:v,onSuccess:o})};return a.jsxs(as,{hasWarning:d,children:[a.jsx(_m,{projectId:n,value:e,featureId:t,environmentName:(i==null?void 0:i.name)||"",onToggle:m}),a.jsx(V,{condition:d||!1,show:a.jsx(Ff,{})})]})},Vf=Ze.memo(Lf),Nf=()=>a.jsx(as,{children:a.jsx("div",{"data-loading":!0,children:"toggle"})}),Wf=()=>a.jsx(Rf,{"aria-hidden":"true",children:"-"}),zf=e=>{const t=`api/admin/projects/${e}/flag-creators`,{data:n,refetch:i,error:c}=Zr(B1(t),()=>Ir(B1(t),"Flag creators"));return{flagCreators:n||[],refetch:i,error:c}},Bf=u(bd)({padding:0}),M8=({state:e,onChange:t,project:n})=>{const{tags:i}=lc(),{flagCreators:c}=zf(n),[s,o]=h.useState([]);return h.useEffect(()=>{const l=(i||[]).map(v=>{const p=dc(v);return{label:p,value:p}}),d=c.map(v=>({label:v.name,value:String(v.id)}));o([{label:"State",icon:"hexagon",options:[{label:"Active",value:"active"},{label:"Stale",value:"stale"},{label:"Potentially stale",value:"potentially-stale"}],filterKey:"state",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},{label:"Tags",icon:"label",options:l,filterKey:"tag",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ALL_OF","INCLUDE_ANY_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Created date",icon:"today",options:[],filterKey:"createdAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]},{label:"Last seen",icon:"monitor_heart",options:[],filterKey:"lastSeenAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]},{label:"Flag type",icon:"flag",options:[{label:"Release",value:"release"},{label:"Experiment",value:"experiment"},{label:"Operational",value:"operational"},{label:"Kill switch",value:"kill-switch"},{label:"Permission",value:"permission"}],filterKey:"type",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},{label:"Created by",icon:"person",options:d,filterKey:"createdBy",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}])},[JSON.stringify(i),JSON.stringify(c)]),a.jsx(Bf,{availableFilters:s,state:e,onChange:t})},Yf=e=>`api/admin/projects/${e}/status`,Hf={activityCountByDate:[],resources:{members:0,apiTokens:0,segments:0},health:{current:0},technicalDebt:{current:0},lifecycleSummary:{initial:{currentFlags:0,averageDays:null},preLive:{currentFlags:0,averageDays:null},live:{currentFlags:0,averageDays:null},completed:{currentFlags:0,averageDays:null},archived:{currentFlags:0,last30Days:0}},staleFlags:{total:0}},R0=e=>{const t=B1(Yf(e)),{data:n,refetch:i,loading:c,error:s}=Zr(t,()=>Ir(t,"Project Status"));return{data:n||Hf,refetch:i,loading:c,error:s}},Uf=({projectId:e,state:t,onChange:n,children:i})=>{var l,d;const{data:c}=R0(e),s=Object.entries((c==null?void 0:c.lifecycleSummary)||{}).reduce((m,[f,v])=>(m[f==="preLive"?"pre-live":f]=v.currentFlags||0,m),{}),o=(d=(l=t.archived)==null?void 0:l.values)==null?void 0:d.includes("true");return h.useEffect(()=>{o&&t.lifecycle&&n({...t,lifecycle:null})},[o,t,n]),o?null:a.jsx(O,{sx:{marginRight:"auto"},children:a.jsx(yd,{state:t,onChange:n,countData:s,children:i})})},J0=["select","actions","name","favorite"],X0=(e,t)=>e.reduce((n,i)=>({...n,[i]:t.includes(i)}),{}),kf=e=>{const t=_1(),n=Q1(t.breakpoints.down("sm")),i=Q1(t.breakpoints.down("md")),c=Q1(t.breakpoints.down("lg")),s=h.useCallback((o=0)=>e.filter(l=>l.startsWith("environment:")),[e]);return n?X0(e,[...J0,"createdAt"]):i?X0(e,[...J0,"createdAt",...s(1)]):c?X0(e,[...J0,"createdAt","type",...s(1)]):X0(e,[...J0,"lastSeenAt","lifecycle","createdAt","createdBy","type","tags",...s(3)])},qf=({query:e})=>{var t;return((t=e||"")==null?void 0:t.length)>0?a.jsx(O,{sx:n=>({padding:n.spacing(3)}),children:a.jsxs(re,{children:["No feature flags found matching “",e,"”"]})}):a.jsx(O,{sx:n=>({padding:n.spacing(3)}),children:a.jsx(re,{children:"No feature flags available."})})},Kf=(e,t,n)=>{const[i,c]=h.useState(),[s,o]=h.useState({}),[l,d]=h.useState({featureId:"default",open:!1}),[m,f]=h.useState({featureId:"default",open:!1}),[v,p]=h.useState({featureId:"default",open:!1});return{rowActionsDialogs:a.jsxs(a.Fragment,{children:[a.jsx(wm,{isStale:!!s.stale,isOpen:!!s.featureId,onClose:()=>{o({}),e()},featureId:s.featureId||"",projectId:t}),a.jsx(Qc,{isOpen:!!i,onConfirm:()=>{e(),n==null||n()},onClose:()=>{c(void 0)},featureIds:[i||""],projectId:t}),a.jsx(xm,{isOpen:l.open,setIsOpen:j=>{d({...l,open:j})},projectId:t,featureId:l.featureId,onComplete:e}),a.jsx(uc,{deletedFeatures:[v.featureId],projectId:t,open:v.open,setOpen:j=>{p(b=>({...b,open:j}))},refetch:e}),a.jsx(hc,{revivedFeatures:[m.featureId],projectId:t,open:m.open,setOpen:j=>{f(b=>({...b,open:j}))},refetch:()=>{f(j=>({...j,open:!1})),e()}})]}),setFeatureArchiveState:c,setFeatureStaleDialogState:o,setShowMarkCompletedDialogue:d,setShowFeatureReviveDialogue:f,setShowFeatureDeleteDialogue:p}},Gf=(e,t)=>{const[n,i]=h.useState([]);return h.useEffect(()=>{i(c=>{const s=[...e];return c.forEach(o=>{s.find(l=>l.name===o.name)||s.push(o)}),s.filter(o=>t[o.name])})},[e,t]),n},rs=(e,t="project-overview-v2",n=15*1e3)=>{const i={offset:Pe(j8,0),limit:Pe(j8,_d),query:I3,favoritesFirst:Pe(wd,!0),sortBy:Pe(I3,"createdAt"),sortOrder:Pe(I3,"desc"),columns:Sd,tag:Be,state:Be,createdAt:Be,lastSeenAt:Be,type:Be,createdBy:Be,archived:Be,lifecycle:Be},[c,s]=mc(`${t}-${e}`,i),{columns:o,...l}=c,{features:d,total:m,refetch:f,loading:v,initialLoad:p}=fc(pc({...vc(i,l),project:`IS:${e}`},g=>g?`${g}`:void 0),{refreshInterval:n});return{features:d,total:m,refetch:f,loading:v,initialLoad:p,tableState:c,setTableState:s}},Qf=(e,t)=>{const n=(o,l)=>{const d=e[o.key];d&&d.values.length>0&&!d.values.includes(l)?t({[o.key]:{operator:d.operator,values:[...d.values,l]}}):d||t({[o.key]:{operator:o.operator,values:[l]}})};return{onFlagTypeClick:o=>n({key:"type",operator:"IS"},o),onTagClick:o=>n({key:"tag",operator:"INCLUDE"},o),onAvatarClick:o=>n({key:"createdBy",operator:"IS"},o.toString())}},r5=(e,t={})=>{const n=B1(`api/admin/projects/${e}/api-tokens`),{data:i,error:c,mutate:s}=W3(n,Jf,t),o=h.useMemo(()=>i??[],[i]),l=h.useCallback(()=>{s().catch(console.warn)},[s]);return{tokens:o,error:c,loading:!c&&!i,refetch:l}},Jf=async e=>(await(await fetch(e).then(me("Project Api tokens"))).json()).tokens,i5=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:i}=A2({propagateErrors:!0});return{deleteToken:async(o,l)=>{const d=`api/admin/projects/${l}/api-tokens/${o}`,m=t(d,{method:"DELETE"});return e(m.caller,m.id)},createToken:async(o,l)=>{const d=`api/admin/projects/${l}/api-tokens`,m=t(d,{method:"POST",body:JSON.stringify(o)});return e(m.caller,m.id)},errors:n,loading:i}},Xf=e=>{if(!e)return null;const[t,n]=e.split(":",2);if(!n)return null;const[i,c,...s]=n.split(".");return t&&i&&c&&s.length===0?{project:t,environment:i,secret:c}:null},R3=u("div")(({theme:e})=>({fontWeight:e.typography.fontWeightBold,marginBottom:e.spacing(1),fontSize:e.typography.body1.fontSize})),G2=u("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:e.spacing(2)})),ep=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),tp=u("div")(({theme:e})=>({background:e.palette.background.application,borderRadius:e.shape.borderRadius,width:e.spacing(7),height:e.spacing(1)})),np=u("div")(({theme:e})=>({background:e.palette.background.sidebar,borderRadius:e.shape.borderRadius,width:e.spacing(7),height:e.spacing(1)})),Q2=({active:e,steps:t})=>a.jsx(ep,{children:Array.from({length:t},(n,i)=>i===e?a.jsx(np,{},i):a.jsx(tp,{},i))}),ap=({environments:e,onSelect:t,currentEnvironment:n})=>{const i=Math.max(...e.map(c=>c.length));return a.jsx(pr,{tooltip:{header:""},description:"Select the environment where the API key will be created",options:e.map(c=>({label:c,value:c})),onChange:c=>{t(c)},button:{label:n,icon:a.jsx(gc,{}),labelWidth:`${i+5}ch`},search:{label:"Filter project mode options",placeholder:"Select project mode"}})},rp=u("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,padding:e.spacing(3),display:"flex",flexDirection:"column",alignItems:"center"})),M4=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,padding:e.spacing(2),flex:1,color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),ip=u(O)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"flex-start",marginTop:e.spacing(8),flexWrap:"wrap"})),A4=u("p")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(2)})),cp=u("div")(({theme:e})=>({padding:e.spacing(5,8,3,8),display:"flex",flexDirection:"column",gap:e.spacing(3)})),sp=({project:e,environment:t,secret:n})=>{const i=_1(),c=Q1(i.breakpoints.up("lg"));return a.jsx(l3.ArcherContainer,{strokeColor:i.palette.secondary.border,endMarker:!1,lineStyle:"curve",children:a.jsxs(rp,{children:[a.jsxs(O,{sx:{wordBreak:"break-all"},children:[a.jsx(l3.ArcherElement,{id:"project",children:a.jsx("span",{children:e})}),":",a.jsx(l3.ArcherElement,{id:"environment",children:a.jsx("span",{children:t})}),".",a.jsx(l3.ArcherElement,{id:"secret",children:a.jsx("span",{children:n})})]}),c?a.jsxs(ip,{children:[a.jsx(l3.ArcherElement,{id:"project-description",relations:[{targetId:"project",targetAnchor:"bottom",sourceAnchor:"top"}],children:a.jsx(M4,{children:"The project this API key can retrieve feature flags from"})}),a.jsx(l3.ArcherElement,{id:"environment-description",relations:[{targetId:"environment",targetAnchor:"bottom",sourceAnchor:"top"}],children:a.jsx(M4,{children:"The environment this API key can retrieve feature flag configuration from"})}),a.jsx(l3.ArcherElement,{id:"secret-description",relations:[{targetId:"secret",targetAnchor:"right",sourceAnchor:"top"}],children:a.jsx(M4,{children:"The API key secret"})})]}):null]})})},op=({environments:e,environment:t,project:n,sdkType:i,onEnvSelect:c,onApiKey:s})=>{const{trackEvent:o}=C1(),{tokens:l,refetch:d}=r5(n),{createToken:m,loading:f}=i5(),v=l.find(_=>_.environment===t&&_.type===i);h.useEffect(()=>{s((v==null?void 0:v.secret)||null)},[v]);const p=Xf(v==null?void 0:v.secret),{setToastApiError:g}=O1(),j=async()=>{try{await m({environment:t,type:i,projects:[n],tokenName:`api-key-${n}-${t}`},n),d(),b()}catch(_){g(y1(_))}},b=()=>{o("onboarding",{props:{eventType:"api-key-generated"}})};return a.jsxs(cp,{children:[a.jsx(I,{variant:"h2",children:"Connect an SDK to Unleash"}),a.jsxs(G2,{children:[a.jsx(Q2,{active:1,steps:3}),a.jsx(z3,{color:"secondary",children:"2/3 - Generate API Key"})]}),a.jsxs(O,{sx:{mt:2},children:[a.jsx(R3,{children:"Environment"}),a.jsx(A4,{children:"The environment the SDK connects to to retrieve configuration."}),e.length>0?a.jsx(ap,{environments:e,currentEnvironment:t,onSelect:c}):null]}),a.jsxs(O,{sx:{mt:3},children:[a.jsx(R3,{children:"API Key"}),p?a.jsxs(A4,{children:["Here is your generated API key. We will use it to connect to the ",a.jsx("b",{children:p.project})," project in the ",a.jsx("b",{children:p.environment})," environment."]}):a.jsx(A4,{children:"You currently have no active API keys for this project/environment combination. Generate an API key to proceed with connecting your SDK."}),p?a.jsx(sp,{project:p.project,environment:p.environment,secret:p.secret}):a.jsx(c1,{variant:"contained",disabled:f,onClick:j,children:"Generate API Key"})]})]})},is=[{name:"Node.js",icon:Od},{name:"Go",icon:Cd},{name:"Ruby",icon:Dd},{name:"PHP",icon:$d},{name:"Rust",icon:Td},{name:".NET",icon:Pd},{name:"Java",icon:Ed},{name:"Python",icon:Zd}],cs=[{name:"JavaScript",icon:Id},{name:"React",icon:Md},{name:"Vue",icon:Ad},{name:"Svelte",icon:Fd},{name:"Swift",icon:Rd},{name:"Android",icon:Ld},{name:"Flutter",icon:Vd}],ss=[...is,...cs],lp=u("div")(({theme:e})=>({padding:e.spacing(5,8,8,8),display:"flex",flexDirection:"column",gap:e.spacing(3)})),A8=u("div")(({theme:e})=>({marginTop:e.spacing(4),marginBottom:e.spacing(2),fontSize:e.typography.body1.fontSize})),F8=u("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,padding:e.spacing(6),display:"flex",columnGap:e.spacing(2),rowGap:e.spacing(5),alignItems:"center",justifyContent:"flex-start",flexWrap:"wrap"})),R8=u("div")(({theme:e})=>({fontSize:e.typography.body2.fontSize,backgroundColor:e.palette.background.default,borderRadius:e.shape.borderRadius,padding:e.spacing(2,3),width:"170px",position:"relative"})),L8=u("div")(()=>({display:"flex",justifyContent:"space-between"})),V8=u(g3)(({theme:e})=>({position:"absolute",width:e.spacing(4),height:e.spacing(4),top:e.spacing(-2.75),left:e.spacing(2),boxShadow:e.shadows[2]})),dp=({onSelect:e})=>a.jsxs(lp,{children:[a.jsx(I,{variant:"h2",children:"Connect an SDK to Unleash"}),a.jsxs(G2,{children:[a.jsx(Q2,{active:0,steps:3}),a.jsx(z3,{color:"secondary",children:"1/3 - Choose SDK"})]}),a.jsxs(O,{sx:{mt:2},children:[a.jsx(R3,{children:"Select SDK"}),a.jsx(A8,{children:"Server side SDKs"}),a.jsx(F8,{children:is.map(t=>a.jsxs(R8,{children:[a.jsx(V8,{src:y0(t.icon)}),a.jsxs(L8,{children:[a.jsx("b",{children:t.name})," ",a.jsx(le,{onClick:()=>e({name:t.name,type:"client"}),component:"button",children:"Select"})]})]},t.name))}),a.jsx(A8,{children:"Client side SDKs"}),a.jsx(F8,{children:cs.map(t=>a.jsxs(R8,{children:[a.jsx(V8,{src:y0(t.icon)}),a.jsxs(L8,{children:[a.jsx("b",{children:t.name})," ",a.jsx(le,{onClick:()=>e({name:t.name,type:"frontend"}),component:"button",children:"Select"})]})]},t.name))})]})]}),os=u("div")(({theme:e})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(12,6,6,6),flex:0,minWidth:"400px"})),h2=u("p")(({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.caption.fontSize,marginBottom:e.spacing(2)})),c5=({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.body2.fontSize,marginTop:e.spacing(.5)}),up=u(xc)(c5),hp=u(gc)(c5),ls=u(Nd)(c5),m2=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1.5),alignItems:"flex-start",marginTop:e.spacing(3)})),f2=u("div")(({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.fontWeightBold,marginBottom:e.spacing(2)})),mp=()=>a.jsxs(os,{children:[a.jsxs(m2,{children:[a.jsx(up,{}),a.jsxs(O,{children:[a.jsx(f2,{children:"Flags live in projects"}),a.jsx(h2,{children:"Projects are containers for feature flags. Each flag belongs to the project where you create it."})]})]}),a.jsxs(m2,{children:[a.jsx(hp,{}),a.jsxs(O,{children:[a.jsx(f2,{children:"Flags have configuration in environments"}),a.jsx(h2,{children:"You can have multiple environments, and each feature flag has a different configuration per environment."})]})]}),a.jsxs(m2,{children:[a.jsx(ls,{}),a.jsxs(O,{children:[a.jsx(f2,{children:"SDKs connect to Unleash to retrieve configuration"}),a.jsx(h2,{children:"When you connect an SDK to Unleash, it uses the API key to identify which feature flags and configuration to retrieve from each environment."})]})]})]}),fp=()=>a.jsx(os,{children:a.jsxs(m2,{children:[a.jsx(ls,{}),a.jsxs(O,{children:[a.jsx(f2,{children:"SDKs and Unleash"}),a.jsx(h2,{children:"SDKs serve to bind your application to Unleash. The SDK can connect to Unleash via HTTP and retrieve feature flag configuration that is then cached in your application. Making sure none of your application data ever leaves your servers."})]})]})}),ds=u(g3,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({transition:"background-color 0.5s ease",color:e.palette.common.white,backgroundColor:t?e.palette.primary.main:e.palette.divider,"@keyframes pulse":{"0%":{boxShadow:`0 0 0 0px ${Qe(e.palette.primary.main,.7)}`},"100%":{boxShadow:`0 0 0 20px ${Qe(e.palette.primary.main,0)}`}},animation:t?"pulse 2s infinite":""})),pp=u(g3,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({transition:"background-color 0.5s ease",color:e.palette.primary.main,backgroundColor:t?e.palette.background.default:e.palette.divider,"@keyframes pulse":{"0%":{boxShadow:`0 0 0 0px ${Qe(e.palette.background.default,.7)}`},"100%":{boxShadow:`0 0 0 20px ${Qe(e.palette.background.default,0)}`}},animation:t?"pulse 2s infinite":""}));var s5={},vp=ee;Object.defineProperty(s5,"__esModule",{value:!0});var J2=s5.default=void 0,gp=vp(X1()),xp=a,jp=(0,gp.default)((0,xp.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending");J2=s5.default=jp;const bp=u("div")(({theme:e})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(6,9,6,9),minWidth:"400px",display:"flex",flexDirection:"column",color:e.palette.primary.contrastText})),yp=u(I)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",fontWeight:e.typography.fontWeightBold})),_p=u("div")(({theme:e})=>({display:"flex",flexDirection:"row",padding:e.spacing(4,0,12,0),justifyContent:"space-between",fontSize:e.spacing(1)})),N8=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexDirection:"column"})),W8=u("div")(({theme:e})=>({alignItems:"center",justifyContent:"center",display:"flex",gap:e.spacing(2),flexDirection:"column",fontSize:e.fontSizes.smallBody})),wp=u(V3)(({theme:e})=>({color:e.palette.primary.main,backgroundColor:e.palette.background.paper,borderRadius:"50%",padding:e.spacing(1),width:"80px",height:"80px"})),Sp=({projectId:e,sdk:t,environment:n})=>{const i=_1(),{project:c}=te(e,{refreshInterval:1e3}),s=c.onboardingStatus.status==="onboarded";return a.jsxs(bp,{children:[a.jsx(yp,{children:"Connection information"}),a.jsxs(_p,{children:[a.jsxs(N8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Environment"}),a.jsx(I,{variant:"body2",children:n})]}),a.jsxs(N8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"SDK"}),a.jsx(I,{variant:"body2",children:t})]})]}),s?a.jsxs(W8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Connection status"}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"Connected"}),a.jsx(wp,{}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"We received metrics from your application!"})]}):a.jsxs(W8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Connection status"}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"Waiting for SDK data..."}),a.jsx(pp,{sx:{width:80,height:80},active:!0,children:a.jsx(J2,{fontSize:"large"})})]})]})},Op=`1\\. Install the SDK
|
|
1
|
+
var sd=Object.defineProperty;var od=(e,t,n)=>t in e?sd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var q=(e,t,n)=>od(e,typeof t!="symbol"?t+"":t,n);import{fM as ld,fN as dd,fO as ze,r as h,s as u,fP as ud,dl as v2,F as X1,H as ee,j as a,B as O,f as O1,y as Y1,D as $1,aX as Pr,J as C0,aY as D0,aZ as ce,fQ as p3,a_ as pe,d as V3,fR as cc,b0 as se,T as I,fS as ve,dr as P2,L as x1,cT as E2,bg as Z2,dj as sc,dw as Ze,fT as hd,n as $0,aC as Ie,fU as md,fV as fd,aq as C1,k as c1,fW as pd,fX as vd,fY as Je,fZ as gd,C as V,i as y1,bc as xd,aV as he,d8 as le,G as N3,R as T1,bd as Er,aR as T0,aU as P0,aS as I2,f_ as oc,fu as jd,cc as M3,ao as M2,dE as Zr,dF as Ir,b7 as B1,f$ as bd,g0 as lc,bi as dc,g1 as yd,b as _1,aj as Q1,aw as re,g2 as uc,g3 as hc,dA as Pe,g4 as j8,g5 as _d,dB as I3,g6 as wd,dC as Sd,g7 as Be,g8 as mc,dg as fc,g9 as pc,ga as vc,cm as W3,b9 as me,u as A2,M as z3,gb as pr,d0 as gc,gc as l3,gd as Od,ge as Cd,gf as Dd,gg as $d,gh as Td,gi as Pd,gj as Ed,gk as Zd,gl as Id,gm as Md,gn as Ad,go as Fd,gp as Rd,gq as Ld,gr as Vd,gs as g3,fy as y0,gt as xc,gu as Nd,aJ as Qe,c3 as te,ba as v1,gv as g2,aD as Wd,cb as Mr,ds as zd,gw as Bd,gx as Yd,U as Hd,ap as Ar,br as ne,cN as _0,gy as Ud,gz as kd,gA as jc,x as Fr,gB as qd,bI as Xe,gC as Kd,gD as vr,bP as bc,gE as Gd,gF as yc,gG as Qd,eH as F2,ar as R2,aO as n1,bf as e3,gH as Jd,gI as Rr,K as L2,c5 as J1,gJ as _c,gK as Xd,gL as eu,b1 as x3,aE as j3,aF as B3,aK as Y3,_ as H3,a as W1,aL as U3,aN as k3,aM as V2,gM as tu,gN as p1,c0 as nu,m as de,dk as Lr,gO as au,gP as ru,gQ as iu,b3,gR as cu,da as wc,c as x2,gS as su,gT as Sc,c_ as ge,c1 as ou,gU as lu,E as q3,cG as A3,ce as du,gV as uu,as as y3,aB as S1,gW as hu,av as Se,dm as mu,gX as fu,gY as pu,gZ as vu,el as Oc,g_ as gu,g$ as xu,h0 as ju,h1 as bu,h2 as Cc,h3 as Dc,aA as A1,ax as K3,h4 as $c,h5 as Tc,fB as yu,h6 as je,h as F3,cV as fe,h7 as _u,aQ as wu,h8 as Su,eF as N2,h9 as Ou,b6 as w0,ha as Cu,hb as Pc,hc as Du,hd as $u,bq as G3,dt as Tu,X as Vr,W as Ec,he as Pu,a$ as Q3,hf as Zc,hg as E0,hh as Eu,hi as Zu,hj as Iu,hk as Mu,bh as Me,ck as Ic,hl as Au,w as Fu,hm as Ru,hn as Nr,ho as Lu,cj as Mc,hp as Vu,hq as Nu,eC as Ac,o as Wr,q as zr,eE as v3,hr as Wu,hs as zu,ht as Bu,ex as Br,ai as Z1,ey as j2,hu as Yr,ac as W2,du as S0,hv as Yu,hw as Hu,eO as b2,al as z2,hx as Uu,au as Hr,hy as ku,aa as k1,ab as Z0,am as B2,ad as Y2,ae as H2,af as U2,ag as k2,hz as Fc,e6 as I0,bb as qu,an as Ur,A as q2,dX as Ku,hA as Gu,ep as u2,dW as oe,hB as Qu,hC as Ju,v as Rc,hD as Xu,hE as eh,at as M0,dR as kr,hF as th,hG as I4,hH as nh,hI as ah,cY as _3,cZ as f1,hJ as rh,hK as ih,I as w3,hL as ch,hM as sh,hN as Lc,fL as Vc,hO as gr,hP as b8,hQ as oh,dU as lh,dV as dh,hR as y8,hS as uh,hT as hh,hU as mh,hV as fh,hW as ph,hX as vh,hY as gh,cf as qr,cg as xh,bn as Nc,cJ as Kr,cK as Gr,hZ as jh,c6 as bh,c7 as yh,c8 as A0,h_ as _h,h$ as wh,bv as Sh,bw as Oh,z as _8,fs as Ch,d1 as Dh,d4 as $h,i0 as Th,i1 as Wc,i2 as Ph,i3 as Eh,i4 as Zh,b8 as Qr,i5 as Ih,i6 as Mh,b2 as F0,i7 as xr,i8 as Ah,i9 as K2,ia as Jr,ib as Xr,dx as zc,ic as e5,fD as Fh,id as Bc,e_ as Rh,ie as Lh,ig as Vh,ih as jr,ii as Nh,ij as Wh,e1 as zh,e3 as Bh,e4 as Yh,ik as Yc,il as Hc,im as Uc,io as Hh,ip as kc,iq as Uh,ir as kh,is as qh,fC as Kh,it as Gh,fG as Qh,dM as w8,dJ as Jh,iu as Xh,iv as em,iw as tm,dn as qc,ix as br,iy as nm,e8 as Kc,iz as am,dD as S8,iA as rm,iB as im,iC as cm,iD as a0,ci as Gc,iE as sm,iF as om,iG as lm,iH as dm,iI as um,fx as hm,iJ as mm,bA as fm,iK as pm,iL as vm,iM as gm}from"./index-Cz4lAJ3Y.js";import{F as Qc,M as xm}from"./MarkCompletedDialogue-D2TM3HgS.js";import{a as jm,u as Jc,T as bm,b as ym,F as _m,h as wm,f as Sm,g as Om,e as Cm,d as Dm,E as $m}from"./FeatureStaleDialog-DwV5Mzh6.js";import{m as Tm,i as O8,b as Pm,c as Em,d as Zm,e as Im,E as Mm,f as Am,u as Fm,a as Rm,R as Lm,C as Vm,A as Nm,g as Xc,j as Wm}from"./RoleCell-D01N1lHV.js";import"./useApiTokens-Dx2wjhgw.js";function zm(e,t){var n,i;ld(1,arguments);var c=dd(e);if(isNaN(c.getTime()))throw new RangeError("Invalid time value");var s=String((n=t==null?void 0:t.format)!==null&&n!==void 0?n:"extended"),o=String((i=t==null?void 0:t.representation)!==null&&i!==void 0?i:"complete");if(s!=="extended"&&s!=="basic")throw new RangeError("format must be 'extended' or 'basic'");if(o!=="date"&&o!=="time"&&o!=="complete")throw new RangeError("representation must be 'date', 'time', or 'complete'");var l="",d="",m=s==="extended"?"-":"",f=s==="extended"?":":"";if(o!=="time"){var v=ze(c.getDate(),2),p=ze(c.getMonth()+1,2),g=ze(c.getFullYear(),4);l="".concat(g).concat(m).concat(p).concat(m).concat(v)}if(o!=="date"){var j=c.getTimezoneOffset();if(j!==0){var b=Math.abs(j),_=ze(Math.floor(b/60),2),x=ze(b%60,2),w=j<0?"+":"-";d="".concat(w).concat(_,":").concat(x)}else d="Z";var P=ze(c.getHours(),2),C=ze(c.getMinutes(),2),D=ze(c.getSeconds(),2),W=l===""?"":"T",S=[P,C,D].join(f);l="".concat(l).concat(W).concat(S).concat(d)}return l}const es=e=>h.createElement("svg",{width:20,height:18,viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M14.125 0C15.7917 0 17.1875 0.616667 18.3125 1.85C19.4375 3.08333 20 4.55 20 6.25C20 6.55 19.9833 6.84583 19.95 7.1375C19.9167 7.42917 19.8583 7.71667 19.775 8H13.525L11.825 5.45C11.7417 5.31667 11.625 5.20833 11.475 5.125C11.325 5.04167 11.1667 5 11 5C10.7833 5 10.5875 5.06667 10.4125 5.2C10.2375 5.33333 10.1167 5.5 10.05 5.7L8.7 9.75L7.825 8.45C7.74167 8.31667 7.625 8.20833 7.475 8.125C7.325 8.04167 7.16667 8 7 8H0.225C0.141667 7.71667 0.0833333 7.42917 0.05 7.1375C0.0166667 6.84583 0 6.55833 0 6.275C0 4.55833 0.558333 3.08333 1.675 1.85C2.79167 0.616667 4.18333 0 5.85 0C6.65 0 7.40417 0.158333 8.1125 0.475C8.82083 0.791667 9.45 1.23333 10 1.8C10.5333 1.23333 11.1542 0.791667 11.8625 0.475C12.5708 0.158333 13.325 0 14.125 0ZM10 18C9.7 18 9.4125 17.9458 9.1375 17.8375C8.8625 17.7292 8.61667 17.5667 8.4 17.35L1.7 10.625C1.6 10.525 1.50833 10.425 1.425 10.325C1.34167 10.225 1.25833 10.1167 1.175 10H6.45L8.15 12.55C8.23333 12.6833 8.35 12.7917 8.5 12.875C8.65 12.9583 8.80833 13 8.975 13C9.19167 13 9.39167 12.9333 9.575 12.8C9.75833 12.6667 9.88333 12.5 9.95 12.3L11.3 8.25L12.15 9.55C12.25 9.68333 12.375 9.79167 12.525 9.875C12.675 9.95833 12.8333 10 13 10H18.8L18.55 10.3L18.3 10.6L11.575 17.35C11.3583 17.5667 11.1167 17.7292 10.85 17.8375C10.5833 17.9458 10.3 18 10 18Z"})),C8=u("div")(()=>({display:"flex"})),Bm=u("div")(()=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",width:"100%"}));u("div")(()=>({display:"flex",flexDirection:"column"}));const Ym=u("span")(({theme:e})=>({textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"})),Hm=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));u(Hm)(({theme:e})=>({color:e.palette.neutral.dark}));const Um=u(ud)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),km=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),qm=u("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),Km=u("h1")(({theme:e})=>({margin:0,width:"100%",fontSize:e.typography.h1.fontSize,fontWeight:"bold",display:"flex",alignItems:"center",gap:e.spacing(2),overflow:"hidden",lineHeight:1.5})),Gm=u("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Qm=u("div")(({theme:e})=>({padding:e.spacing(0,4)})),Jm=u(v2)(({theme:e})=>({textTransform:"none",flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1),minWidth:170},[e.breakpoints.up("md")]:{minWidth:170}}));var t5={},Xm=ee;Object.defineProperty(t5,"__esModule",{value:!0});var ts=t5.default=void 0,ef=Xm(X1()),tf=a,nf=(0,ef.default)((0,tf.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"LibraryAdd");ts=t5.default=nf;var n5={},af=ee;Object.defineProperty(n5,"__esModule",{value:!0});var ns=n5.default=void 0,rf=af(X1()),cf=a,sf=(0,rf.default)((0,cf.jsx)("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive");ns=n5.default=sf;var a5={},of=ee;Object.defineProperty(a5,"__esModule",{value:!0});var y2=a5.default=void 0,lf=of(X1()),df=a,uf=(0,lf.default)((0,df.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater");y2=a5.default=uf;const hf=u(O)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),mf=({projectId:e,row:t,onOpenArchiveDialog:n,onOpenStaleDialog:i})=>{const[c,s]=h.useState(null),[o,l]=h.useState(!1),{setToastData:d}=O1(),{original:{name:m,stale:f}}=t,v=!!c,p=x=>{s(x.currentTarget)},g=()=>{s(null)},j=`feature-${m}-actions`,b=`${j}-menu`,_=()=>{try{sc(m),l(!0),setTimeout(()=>{g(),l(!1)},1e3)}catch{d({type:"error",text:"Could not copy feature name"})}};return a.jsxs(hf,{children:[a.jsx(Y1,{title:"Feature flag actions",arrow:!0,describeChild:!0,children:a.jsx($1,{id:j,"data-loading":!0,"aria-controls":v?b:void 0,"aria-haspopup":"true","aria-expanded":v?"true":void 0,onClick:p,type:"button",children:a.jsx(Pr,{})})}),a.jsx(C0,{id:b,anchorEl:c,open:v,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:x=>({borderRadius:`${x.shape.borderRadius}px`,padding:x.spacing(1,1.5)})},children:a.jsxs(D0,{"aria-labelledby":j,children:[a.jsxs(ce,{sx:p3,onClick:_,children:[a.jsx(pe,{children:o?a.jsx(V3,{}):a.jsx(cc,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:o?"Copied!":"Copy Name"})})]}),a.jsx(ve,{projectId:e,permission:P2,children:({hasAccess:x})=>a.jsxs(ce,{sx:p3,onClick:g,disabled:!x,component:x1,to:`/projects/${e}/features/${m}/copy`,children:[a.jsx(pe,{children:a.jsx(ts,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Clone"})})]})}),a.jsx(ve,{projectId:e,permission:E2,children:({hasAccess:x})=>a.jsxs(ce,{sx:p3,onClick:()=>{n(m),g()},disabled:!x,children:[a.jsx(pe,{children:a.jsx(ns,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Archive"})})]})}),a.jsx(ve,{projectId:e,permission:Z2,children:({hasAccess:x})=>a.jsxs(ce,{sx:p3,onClick:()=>{g(),i({featureId:m,stale:f===!0})},disabled:!x,children:[a.jsx(pe,{children:a.jsx(y2,{})}),a.jsx(se,{children:a.jsxs(I,{variant:"body2",children:[f?"Un-mark":"Mark"," as stale"]})})]})})]})})]})},ff=u(O)(({theme:e})=>({display:"flex",justifyContent:"center",marginRight:e.spacing(-2)})),pf=({onChange:e,checked:t,title:n})=>a.jsx(ff,{"data-testid":hd,children:a.jsx($0,{onChange:e,title:n,checked:t,"data-loading":!0})}),D8=Ze.memo(pf),vf=u("div")(({theme:e})=>({position:"sticky",bottom:50,zIndex:e.zIndex.fab,pointerEvents:"none"})),gf=u(O)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),xf=u(Ie)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(2),marginLeft:"auto",marginRight:"auto",padding:e.spacing(2,3),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.background.alternative}`,borderRadius:e.shape.borderRadiusLarge,gap:e.spacing(1),flexWrap:"wrap",pointerEvents:"auto"})),jf=u("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),bf=u(I)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),yf=({count:e,children:t})=>e===0?null:a.jsx(vf,{"data-testid":md,children:a.jsx(gf,{children:a.jsxs(xf,{elevation:4,children:[a.jsxs(bf,{children:[a.jsx(jf,{"data-testid":fd,children:e})," selected"]}),t]})})}),_f=7,wf=e=>{const t=pd(new Date,-_f);return!!(e!=null&&e.lastSeenAt&&vd(new Date(e.lastSeenAt),t))},Sf=({projectId:e,featureIds:t,features:n,onConfirm:i})=>{const[c,s]=h.useState(!1),{trackEvent:o}=C1(),l=h.useMemo(()=>t.filter(m=>{const f=n.find(v=>v.name===m);return wf(f)}),[JSON.stringify(n),t]),d=async()=>{s(!1),i==null||i(),o("batch_operations",{props:{eventType:"features archived"}})};return a.jsxs(a.Fragment,{children:[a.jsx(ve,{projectId:e,permission:E2,children:({hasAccess:m})=>a.jsx("span",{children:a.jsx(c1,{disabled:!m||c,variant:"outlined",size:"small",onClick:()=>s(!0),children:"Archive"})})}),a.jsx(Qc,{projectId:e,featureIds:t,featuresWithUsage:l,onConfirm:d,isOpen:c,onClose:()=>s(!1)})]})},Q0="selection-actions-menu",Of=({projectId:e,data:t,onChange:n})=>{const[i,c]=h.useState(null),{staleFeatures:s}=Je(),{setToastData:o,setToastApiError:l}=O1(),{trackEvent:d}=C1(),m=!!i,f=t.map(({name:x})=>x),v=x=>{c(x.currentTarget)},p=()=>{c(null)},g=t.some(({stale:x})=>x===!0),j=t.some(({stale:x})=>x===!1),b=async()=>{try{p(),await s(e,f),n==null||n(),o({text:"Feature flags marked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features staled"}})}catch(x){l(y1(x))}},_=async()=>{try{p(),await s(e,f,!1),n==null||n(),o({text:"Feature flags unmarked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features unstaled"}})}catch(x){l(y1(x))}};return a.jsxs(a.Fragment,{children:[a.jsx(Y1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:a.jsx($1,{id:Q0,"aria-controls":m?Q0:void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:v,type:"button","data-testid":gd,children:a.jsx(Pr,{})})}),a.jsx(C0,{id:`${Q0}-menu`,anchorEl:i,open:m,onClose:p,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:x=>({borderRadius:`${x.shape.borderRadius}px`,padding:x.spacing(1,1.5)})},children:a.jsx(D0,{"aria-labelledby":`${Q0}-menu`,children:a.jsx(ve,{projectId:e,permission:Z2,children:({hasAccess:x})=>a.jsxs(a.Fragment,{children:[a.jsx(V,{condition:j,show:()=>a.jsxs(ce,{onClick:b,disabled:!x,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[a.jsx(pe,{children:a.jsx(y2,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Mark as stale"})})]})}),a.jsx(V,{condition:g,show:()=>a.jsxs(ce,{onClick:_,disabled:!x,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[a.jsx(pe,{children:a.jsx(y2,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},Cf=u("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),$8="manage-tags-form",T8=(e,t)=>[...e,...e.some(n=>n.value===t.value&&n.type===t.type)?[]:[t]],P8=(e,t)=>e.filter(n=>!(n.value===t.value&&n.type===t.type)),Df=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:T8(e.addedTags,t.payload),removedTags:P8(e.removedTags,t.payload)};case"remove":return{...e,addedTags:P8(e.addedTags,t.payload),removedTags:T8(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};case"reset":return{addedTags:[],removedTags:[]};default:return e}},E8={name:"",description:"",icon:""},$f=({open:e,initialValues:t,initialIndeterminateValues:n,onCancel:i,onSubmit:c})=>{const{tagTypes:s,loading:o}=xd(),[l,d]=h.useState(E8),[m,f]=h.useState([]),[v,p]=h.useState([]),{tags:g,refetch:j}=jm(l.name),{createTag:b}=Jc(),_=g.map(({value:z})=>({title:z})),[x,w]=h.useReducer(Df,{addedTags:[],removedTags:[]}),P=()=>{c(x),w({type:"reset"})},C=(z=s.length>0?s[0]:E8)=>{d(z);const A=n.filter(({type:M})=>M===z.name);f(t.filter(({type:M})=>M===z.name).filter(({type:M,value:k})=>!A.some(K=>K.value===k&&K.type===M)).map(({value:M})=>({title:M}))),p(A.map(({value:M})=>({title:M}))),w({type:"clear",payload:[]})};h.useEffect(()=>{s.length>0&&C()},[o]);const D=(z,A)=>{A!=null&&typeof A!="string"&&(z.preventDefault(),C(A))},W=(z,A)=>b({value:z,type:A}).then(async()=>{j(),f(M=>[...M,{title:z}]),w({type:"add",payload:{value:z,type:A}})}),S=(z,A,M,k)=>{M==="selectOption"?A.forEach(K=>{typeof K!="string"&&typeof K.inputValue=="string"&&K.inputValue&&K.title.startsWith("Create new value")&&W(K.inputValue,l.name),f(A),p(Z=>Z.filter(({title:H})=>H!==K.title)),k!=null&&k.option&&w({type:"add",payload:{value:k.option.title,type:l.name}})}):M==="clear"?(f([]),w({type:"clear",payload:t})):M==="removeOption"&&(f(A),k!=null&&k.option&&w({type:"remove",payload:{value:k.option.title,type:l.name}}))},R=()=>{C(),i()};return a.jsxs(he,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature flag tags",onClick:P,disabledPrimaryButton:x.addedTags.length===0&&x.removedTags.length===0,onClose:R,formId:$8,children:[a.jsx(I,{paragraph:!0,sx:{marginBottom:z=>z.spacing(2.5)},children:"Tags allow you to group features together"}),a.jsx("form",{id:$8,onSubmit:P,children:a.jsxs(Cf,{children:[a.jsx(bm,{options:s,disabled:o||s.length===0,value:l,onChange:D},o?"loading":s.length),a.jsx(V,{condition:!o&&s.length===0,show:a.jsxs(I,{variant:"body1",children:["No"," ",a.jsx(le,{component:x1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:a.jsx(ym,{disabled:o,options:_,existingTags:t,indeterminateOptions:v,tagType:l,selectedOptions:m,onChange:S})})]})})]})},Tf=({projectId:e,data:t,onChange:n})=>{const{bulkUpdateTags:i}=Jc(),{setToastData:c,setToastApiError:s}=O1(),{trackEvent:o}=C1(),[l,d]=h.useState(!1),[m,f]=h.useMemo(()=>{const p=t.flatMap(({tags:j})=>j||[]).reduce((j,b)=>[...j,...j.some(_=>_.type===b.type&&_.value===b.value)?[]:[b]],[]),g=p.filter(j=>!t.every(({tags:b})=>b==null?void 0:b.some(_=>_.type===j.type&&_.value===j.value)));return[p,g]},[t]),v=async({addedTags:p,removedTags:g})=>{const b={features:t.map(({name:_})=>_),tags:{addedTags:p,removedTags:g}};try{const _=[p.length>0&&`added ${p.length} tag${p.length>1?"s":""}`,g.length>0&&`removed ${g.length} tag${g.length>1?"s":""}`].filter(Boolean).join(" and ");await i(b,e),c({text:_,type:"success",autoHideDuration:12e3}),o("batch_operations",{props:{eventType:"tags updated"}})}catch(_){s(y1(_))}n==null||n(),d(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(ve,{projectId:e,permission:Z2,children:({hasAccess:p})=>a.jsx("span",{children:a.jsx(c1,{disabled:!p||l,variant:"outlined",size:"small",onClick:()=>d(!0),children:"Tags"})})}),a.jsx($f,{open:l,onCancel:()=>d(!1),onSubmit:v,initialValues:m,initialIndeterminateValues:f},t.length)]})},Pf=u(N3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),Z8=u(T1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Ef=({showExportDialog:e,data:t,onClose:n,onConfirm:i,environments:c,projectId:s})=>{const[o,l]=h.useState(c[0]),{bulkToggleFeaturesEnvironmentOff:d}=Er(),{addChange:m}=T0(),{setToastApiError:f,setToastData:v}=O1(),{isChangeRequestConfigured:p}=P0(s),{refetch:g}=I2(s),j=t.filter(w=>{var P,C;return((C=(P=w.environments)==null?void 0:P.find(D=>o===D.name))==null?void 0:C.enabled)===!1}).length,b=()=>c.map(w=>({key:w,label:w})),_=async()=>{try{p(o)?(await m(s,o,t.map(w=>({action:"updateEnabled",feature:w.name,payload:{enabled:!1}}))),g(),v({type:"success",text:"Changes added to draft"})):(await d(s,t.map(w=>w.name),o),v({type:"success",text:"Feature flags disabled"})),n(),i==null||i()}catch(w){f(y1(w))}},x=p(o)?"Add to change request":"Disable flags";return a.jsx(he,{open:e,title:"Disable feature flags",onClose:n,onClick:_,primaryButtonText:x,secondaryButtonText:"Cancel",children:a.jsxs(O,{children:["You have selected ",a.jsx("b",{children:t.length})," feature flags to disable.",a.jsx("br",{}),a.jsx("br",{}),a.jsx(I,{children:"Select which environment to disable the features for:"}),a.jsx(Pf,{options:b(),value:o,onChange:w=>l(w)}),a.jsx(V,{condition:p(o),show:a.jsx(Z8,{severity:"warning",children:"Change requests are enabled for this environment."})}),a.jsx(V,{condition:j>0,show:a.jsxs(Z8,{severity:"info",children:[j," feature"," ",j>1?"flags are ":"flag is ","already disabled."]})})]})})},Zf=u(N3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),I8=u(T1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),If=({showExportDialog:e,data:t,onClose:n,onConfirm:i,environments:c,projectId:s})=>{const[o,l]=h.useState(c[0]),{bulkToggleFeaturesEnvironmentOn:d}=Er(),{addChange:m}=T0(),{setToastApiError:f,setToastData:v}=O1(),{isChangeRequestConfigured:p}=P0(s),{refetch:g}=I2(s),j=t.filter(w=>{var P,C;return((C=(P=w.environments)==null?void 0:P.find(D=>o===D.name))==null?void 0:C.enabled)===!0}).length,b=()=>c.map(w=>({key:w,label:w})),_=async()=>{try{p(o)?(await m(s,o,t.map(w=>({action:"updateEnabled",feature:w.name,payload:{enabled:!0}}))),g(),v({type:"success",text:"Changes added to draft"})):(await d(s,t.map(w=>w.name),o),v({type:"success",text:"Feature flags enabled"})),n(),i==null||i()}catch(w){f(y1(w))}},x=p(o)?"Add to change request":"Enable flags";return a.jsx(he,{open:e,title:"Enable feature flags",onClose:n,onClick:_,primaryButtonText:x,secondaryButtonText:"Cancel",children:a.jsxs(O,{children:["You have selected ",a.jsx("b",{children:t.length})," feature flags to enable.",a.jsx("br",{}),a.jsx("br",{}),a.jsx(I,{children:"Select which environment to enable the features for:"}),a.jsx(Zf,{options:b(),value:o,onChange:w=>l(w)}),a.jsx(V,{condition:p(o),show:a.jsx(I8,{severity:"warning",children:"Change requests are enabled for this environment."})}),a.jsx(V,{condition:j>0,show:a.jsxs(I8,{severity:"info",children:[j," feature"," ",j>1?"flags are ":"flag is ","already enabled."]})})]})})},Mf=({selectedIds:e,data:t,projectId:n,onResetSelection:i,onChange:c})=>{const[s,o]=h.useState(!1),[l,d]=h.useState(!1),[m,f]=h.useState(!1),{trackEvent:v}=C1(),p=h.useMemo(()=>t.filter(w=>e.includes(w.name)),[t,e]),g=h.useMemo(()=>{const w=p.flatMap(P=>P.environments).map(P=>P==null?void 0:P.name).filter(P=>P!==void 0);return Array.from(new Set(w))},[p]),j=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features exported"}})},b=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features enabled"}})},_=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features disabled"}})},x=()=>{c==null||c(),i()};return a.jsxs(a.Fragment,{children:[a.jsx(c1,{variant:"outlined",size:"small",onClick:()=>d(!0),children:"Enable"}),a.jsx(c1,{variant:"outlined",size:"small",onClick:()=>f(!0),children:"Disable"}),a.jsx(Sf,{projectId:n,featureIds:e,features:t,onConfirm:x}),a.jsx(c1,{variant:"outlined",size:"small",onClick:()=>o(!0),children:"Export"}),a.jsx(Tf,{projectId:n,data:p,onChange:c}),a.jsx(Of,{projectId:n,data:p,onChange:c}),a.jsx(oc,{showExportDialog:s,data:p,onClose:()=>o(!1),environments:g,onConfirm:j}),a.jsx(If,{showExportDialog:l,data:p,onClose:()=>d(!1),environments:g,projectId:n,onConfirm:b}),a.jsx(Ef,{showExportDialog:m,data:p,onClose:()=>f(!1),environments:g,projectId:n,onConfirm:_})]})},Af=u(jd)(({theme:e})=>({color:e.palette.warning.main,fontSize:e.fontSizes.bodySize})),Ff=()=>a.jsx(M3,{arrow:!0,title:a.jsxs(a.Fragment,{children:["This environment has no variants enabled. If you check this feature's variants in this environment, you will get the"," ",a.jsx("a",{href:"https://docs.getunleash.io/concepts/feature-flag-variants#the-disabled-variant",target:"_blank",rel:"noreferrer",children:"disabled variant"}),"."]}),children:a.jsx(Af,{})}),as=u("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...M2,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),Rf=u("div")(({theme:e})=>({flexGrow:0,...M2,justifyContent:"center"})),Lf=({value:e,featureId:t,projectId:n,environment:i,isChangeRequestEnabled:c,someEnabledEnvironmentHasVariants:s,refetch:o,onFeatureToggleSwitch:l})=>{const d=h.useMemo(()=>s&&(i==null?void 0:i.variantCount)===0&&(i==null?void 0:i.enabled),[s,i]),m=(f,v)=>{var p;l(f,{projectId:n,featureId:t,environmentName:(i==null?void 0:i.name)||"",environmentType:i==null?void 0:i.type,hasStrategies:i==null?void 0:i.hasStrategies,hasReleasePlans:!!((p=i==null?void 0:i.releasePlans)!=null&&p.length),hasEnabledStrategies:i==null?void 0:i.hasEnabledStrategies,isChangeRequestEnabled:c,onRollback:v,onSuccess:o})};return a.jsxs(as,{hasWarning:d,children:[a.jsx(_m,{projectId:n,value:e,featureId:t,environmentName:(i==null?void 0:i.name)||"",onToggle:m}),a.jsx(V,{condition:d||!1,show:a.jsx(Ff,{})})]})},Vf=Ze.memo(Lf),Nf=()=>a.jsx(as,{children:a.jsx("div",{"data-loading":!0,children:"toggle"})}),Wf=()=>a.jsx(Rf,{"aria-hidden":"true",children:"-"}),zf=e=>{const t=`api/admin/projects/${e}/flag-creators`,{data:n,refetch:i,error:c}=Zr(B1(t),()=>Ir(B1(t),"Flag creators"));return{flagCreators:n||[],refetch:i,error:c}},Bf=u(bd)({padding:0}),M8=({state:e,onChange:t,project:n})=>{const{tags:i}=lc(),{flagCreators:c}=zf(n),[s,o]=h.useState([]);return h.useEffect(()=>{const l=(i||[]).map(v=>{const p=dc(v);return{label:p,value:p}}),d=c.map(v=>({label:v.name,value:String(v.id)}));o([{label:"State",icon:"hexagon",options:[{label:"Active",value:"active"},{label:"Stale",value:"stale"},{label:"Potentially stale",value:"potentially-stale"}],filterKey:"state",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},{label:"Tags",icon:"label",options:l,filterKey:"tag",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ALL_OF","INCLUDE_ANY_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Created date",icon:"today",options:[],filterKey:"createdAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]},{label:"Last seen",icon:"monitor_heart",options:[],filterKey:"lastSeenAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]},{label:"Flag type",icon:"flag",options:[{label:"Release",value:"release"},{label:"Experiment",value:"experiment"},{label:"Operational",value:"operational"},{label:"Kill switch",value:"kill-switch"},{label:"Permission",value:"permission"}],filterKey:"type",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},{label:"Created by",icon:"person",options:d,filterKey:"createdBy",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}])},[JSON.stringify(i),JSON.stringify(c)]),a.jsx(Bf,{availableFilters:s,state:e,onChange:t})},Yf=e=>`api/admin/projects/${e}/status`,Hf={activityCountByDate:[],resources:{members:0,apiTokens:0,segments:0},health:{current:0},technicalDebt:{current:0},lifecycleSummary:{initial:{currentFlags:0,averageDays:null},preLive:{currentFlags:0,averageDays:null},live:{currentFlags:0,averageDays:null},completed:{currentFlags:0,averageDays:null},archived:{currentFlags:0,last30Days:0}},staleFlags:{total:0}},R0=e=>{const t=B1(Yf(e)),{data:n,refetch:i,loading:c,error:s}=Zr(t,()=>Ir(t,"Project Status"));return{data:n||Hf,refetch:i,loading:c,error:s}},Uf=({projectId:e,state:t,onChange:n,children:i})=>{var l,d;const{data:c}=R0(e),s=Object.entries((c==null?void 0:c.lifecycleSummary)||{}).reduce((m,[f,v])=>(m[f==="preLive"?"pre-live":f]=v.currentFlags||0,m),{}),o=(d=(l=t.archived)==null?void 0:l.values)==null?void 0:d.includes("true");return h.useEffect(()=>{o&&t.lifecycle&&n({...t,lifecycle:null})},[o,t,n]),o?null:a.jsx(O,{sx:{marginRight:"auto"},children:a.jsx(yd,{state:t,onChange:n,countData:s,children:i})})},J0=["select","actions","name","favorite"],X0=(e,t)=>e.reduce((n,i)=>({...n,[i]:t.includes(i)}),{}),kf=e=>{const t=_1(),n=Q1(t.breakpoints.down("sm")),i=Q1(t.breakpoints.down("md")),c=Q1(t.breakpoints.down("lg")),s=h.useCallback((o=0)=>e.filter(l=>l.startsWith("environment:")),[e]);return n?X0(e,[...J0,"createdAt"]):i?X0(e,[...J0,"createdAt",...s(1)]):c?X0(e,[...J0,"createdAt","type",...s(1)]):X0(e,[...J0,"lastSeenAt","lifecycle","createdAt","createdBy","type","tags",...s(3)])},qf=({query:e})=>{var t;return((t=e||"")==null?void 0:t.length)>0?a.jsx(O,{sx:n=>({padding:n.spacing(3)}),children:a.jsxs(re,{children:["No feature flags found matching “",e,"”"]})}):a.jsx(O,{sx:n=>({padding:n.spacing(3)}),children:a.jsx(re,{children:"No feature flags available."})})},Kf=(e,t,n)=>{const[i,c]=h.useState(),[s,o]=h.useState({}),[l,d]=h.useState({featureId:"default",open:!1}),[m,f]=h.useState({featureId:"default",open:!1}),[v,p]=h.useState({featureId:"default",open:!1});return{rowActionsDialogs:a.jsxs(a.Fragment,{children:[a.jsx(wm,{isStale:!!s.stale,isOpen:!!s.featureId,onClose:()=>{o({}),e()},featureId:s.featureId||"",projectId:t}),a.jsx(Qc,{isOpen:!!i,onConfirm:()=>{e(),n==null||n()},onClose:()=>{c(void 0)},featureIds:[i||""],projectId:t}),a.jsx(xm,{isOpen:l.open,setIsOpen:j=>{d({...l,open:j})},projectId:t,featureId:l.featureId,onComplete:e}),a.jsx(uc,{deletedFeatures:[v.featureId],projectId:t,open:v.open,setOpen:j=>{p(b=>({...b,open:j}))},refetch:e}),a.jsx(hc,{revivedFeatures:[m.featureId],projectId:t,open:m.open,setOpen:j=>{f(b=>({...b,open:j}))},refetch:()=>{f(j=>({...j,open:!1})),e()}})]}),setFeatureArchiveState:c,setFeatureStaleDialogState:o,setShowMarkCompletedDialogue:d,setShowFeatureReviveDialogue:f,setShowFeatureDeleteDialogue:p}},Gf=(e,t)=>{const[n,i]=h.useState([]);return h.useEffect(()=>{i(c=>{const s=[...e];return c.forEach(o=>{s.find(l=>l.name===o.name)||s.push(o)}),s.filter(o=>t[o.name])})},[e,t]),n},rs=(e,t="project-overview-v2",n=15*1e3)=>{const i={offset:Pe(j8,0),limit:Pe(j8,_d),query:I3,favoritesFirst:Pe(wd,!0),sortBy:Pe(I3,"createdAt"),sortOrder:Pe(I3,"desc"),columns:Sd,tag:Be,state:Be,createdAt:Be,lastSeenAt:Be,type:Be,createdBy:Be,archived:Be,lifecycle:Be},[c,s]=mc(`${t}-${e}`,i),{columns:o,...l}=c,{features:d,total:m,refetch:f,loading:v,initialLoad:p}=fc(pc({...vc(i,l),project:`IS:${e}`},g=>g?`${g}`:void 0),{refreshInterval:n});return{features:d,total:m,refetch:f,loading:v,initialLoad:p,tableState:c,setTableState:s}},Qf=(e,t)=>{const n=(o,l)=>{const d=e[o.key];d&&d.values.length>0&&!d.values.includes(l)?t({[o.key]:{operator:d.operator,values:[...d.values,l]}}):d||t({[o.key]:{operator:o.operator,values:[l]}})};return{onFlagTypeClick:o=>n({key:"type",operator:"IS"},o),onTagClick:o=>n({key:"tag",operator:"INCLUDE"},o),onAvatarClick:o=>n({key:"createdBy",operator:"IS"},o.toString())}},r5=(e,t={})=>{const n=B1(`api/admin/projects/${e}/api-tokens`),{data:i,error:c,mutate:s}=W3(n,Jf,t),o=h.useMemo(()=>i??[],[i]),l=h.useCallback(()=>{s().catch(console.warn)},[s]);return{tokens:o,error:c,loading:!c&&!i,refetch:l}},Jf=async e=>(await(await fetch(e).then(me("Project Api tokens"))).json()).tokens,i5=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:i}=A2({propagateErrors:!0});return{deleteToken:async(o,l)=>{const d=`api/admin/projects/${l}/api-tokens/${o}`,m=t(d,{method:"DELETE"});return e(m.caller,m.id)},createToken:async(o,l)=>{const d=`api/admin/projects/${l}/api-tokens`,m=t(d,{method:"POST",body:JSON.stringify(o)});return e(m.caller,m.id)},errors:n,loading:i}},Xf=e=>{if(!e)return null;const[t,n]=e.split(":",2);if(!n)return null;const[i,c,...s]=n.split(".");return t&&i&&c&&s.length===0?{project:t,environment:i,secret:c}:null},R3=u("div")(({theme:e})=>({fontWeight:e.typography.fontWeightBold,marginBottom:e.spacing(1),fontSize:e.typography.body1.fontSize})),G2=u("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:e.spacing(2)})),ep=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),tp=u("div")(({theme:e})=>({background:e.palette.background.application,borderRadius:e.shape.borderRadius,width:e.spacing(7),height:e.spacing(1)})),np=u("div")(({theme:e})=>({background:e.palette.background.sidebar,borderRadius:e.shape.borderRadius,width:e.spacing(7),height:e.spacing(1)})),Q2=({active:e,steps:t})=>a.jsx(ep,{children:Array.from({length:t},(n,i)=>i===e?a.jsx(np,{},i):a.jsx(tp,{},i))}),ap=({environments:e,onSelect:t,currentEnvironment:n})=>{const i=Math.max(...e.map(c=>c.length));return a.jsx(pr,{tooltip:{header:""},description:"Select the environment where the API key will be created",options:e.map(c=>({label:c,value:c})),onChange:c=>{t(c)},button:{label:n,icon:a.jsx(gc,{}),labelWidth:`${i+5}ch`},search:{label:"Filter project mode options",placeholder:"Select project mode"}})},rp=u("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,padding:e.spacing(3),display:"flex",flexDirection:"column",alignItems:"center"})),M4=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,padding:e.spacing(2),flex:1,color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),ip=u(O)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"flex-start",marginTop:e.spacing(8),flexWrap:"wrap"})),A4=u("p")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(2)})),cp=u("div")(({theme:e})=>({padding:e.spacing(5,8,3,8),display:"flex",flexDirection:"column",gap:e.spacing(3)})),sp=({project:e,environment:t,secret:n})=>{const i=_1(),c=Q1(i.breakpoints.up("lg"));return a.jsx(l3.ArcherContainer,{strokeColor:i.palette.secondary.border,endMarker:!1,lineStyle:"curve",children:a.jsxs(rp,{children:[a.jsxs(O,{sx:{wordBreak:"break-all"},children:[a.jsx(l3.ArcherElement,{id:"project",children:a.jsx("span",{children:e})}),":",a.jsx(l3.ArcherElement,{id:"environment",children:a.jsx("span",{children:t})}),".",a.jsx(l3.ArcherElement,{id:"secret",children:a.jsx("span",{children:n})})]}),c?a.jsxs(ip,{children:[a.jsx(l3.ArcherElement,{id:"project-description",relations:[{targetId:"project",targetAnchor:"bottom",sourceAnchor:"top"}],children:a.jsx(M4,{children:"The project this API key can retrieve feature flags from"})}),a.jsx(l3.ArcherElement,{id:"environment-description",relations:[{targetId:"environment",targetAnchor:"bottom",sourceAnchor:"top"}],children:a.jsx(M4,{children:"The environment this API key can retrieve feature flag configuration from"})}),a.jsx(l3.ArcherElement,{id:"secret-description",relations:[{targetId:"secret",targetAnchor:"right",sourceAnchor:"top"}],children:a.jsx(M4,{children:"The API key secret"})})]}):null]})})},op=({environments:e,environment:t,project:n,sdkType:i,onEnvSelect:c,onApiKey:s})=>{const{trackEvent:o}=C1(),{tokens:l,refetch:d}=r5(n),{createToken:m,loading:f}=i5(),v=l.find(_=>_.environment===t&&_.type===i);h.useEffect(()=>{s((v==null?void 0:v.secret)||null)},[v]);const p=Xf(v==null?void 0:v.secret),{setToastApiError:g}=O1(),j=async()=>{try{await m({environment:t,type:i,projects:[n],tokenName:`api-key-${n}-${t}`},n),d(),b()}catch(_){g(y1(_))}},b=()=>{o("onboarding",{props:{eventType:"api-key-generated"}})};return a.jsxs(cp,{children:[a.jsx(I,{variant:"h2",children:"Connect an SDK to Unleash"}),a.jsxs(G2,{children:[a.jsx(Q2,{active:1,steps:3}),a.jsx(z3,{color:"secondary",children:"2/3 - Generate API Key"})]}),a.jsxs(O,{sx:{mt:2},children:[a.jsx(R3,{children:"Environment"}),a.jsx(A4,{children:"The environment the SDK connects to to retrieve configuration."}),e.length>0?a.jsx(ap,{environments:e,currentEnvironment:t,onSelect:c}):null]}),a.jsxs(O,{sx:{mt:3},children:[a.jsx(R3,{children:"API Key"}),p?a.jsxs(A4,{children:["Here is your generated API key. We will use it to connect to the ",a.jsx("b",{children:p.project})," project in the ",a.jsx("b",{children:p.environment})," environment."]}):a.jsx(A4,{children:"You currently have no active API keys for this project/environment combination. Generate an API key to proceed with connecting your SDK."}),p?a.jsx(sp,{project:p.project,environment:p.environment,secret:p.secret}):a.jsx(c1,{variant:"contained",disabled:f,onClick:j,children:"Generate API Key"})]})]})},is=[{name:"Node.js",icon:Od},{name:"Go",icon:Cd},{name:"Ruby",icon:Dd},{name:"PHP",icon:$d},{name:"Rust",icon:Td},{name:".NET",icon:Pd},{name:"Java",icon:Ed},{name:"Python",icon:Zd}],cs=[{name:"JavaScript",icon:Id},{name:"React",icon:Md},{name:"Vue",icon:Ad},{name:"Svelte",icon:Fd},{name:"Swift",icon:Rd},{name:"Android",icon:Ld},{name:"Flutter",icon:Vd}],ss=[...is,...cs],lp=u("div")(({theme:e})=>({padding:e.spacing(5,8,8,8),display:"flex",flexDirection:"column",gap:e.spacing(3)})),A8=u("div")(({theme:e})=>({marginTop:e.spacing(4),marginBottom:e.spacing(2),fontSize:e.typography.body1.fontSize})),F8=u("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,padding:e.spacing(6),display:"flex",columnGap:e.spacing(2),rowGap:e.spacing(5),alignItems:"center",justifyContent:"flex-start",flexWrap:"wrap"})),R8=u("div")(({theme:e})=>({fontSize:e.typography.body2.fontSize,backgroundColor:e.palette.background.default,borderRadius:e.shape.borderRadius,padding:e.spacing(2,3),width:"170px",position:"relative"})),L8=u("div")(()=>({display:"flex",justifyContent:"space-between"})),V8=u(g3)(({theme:e})=>({position:"absolute",width:e.spacing(4),height:e.spacing(4),top:e.spacing(-2.75),left:e.spacing(2),boxShadow:e.shadows[2]})),dp=({onSelect:e})=>a.jsxs(lp,{children:[a.jsx(I,{variant:"h2",children:"Connect an SDK to Unleash"}),a.jsxs(G2,{children:[a.jsx(Q2,{active:0,steps:3}),a.jsx(z3,{color:"secondary",children:"1/3 - Choose SDK"})]}),a.jsxs(O,{sx:{mt:2},children:[a.jsx(R3,{children:"Select SDK"}),a.jsx(A8,{children:"Server side SDKs"}),a.jsx(F8,{children:is.map(t=>a.jsxs(R8,{children:[a.jsx(V8,{src:y0(t.icon)}),a.jsxs(L8,{children:[a.jsx("b",{children:t.name})," ",a.jsx(le,{onClick:()=>e({name:t.name,type:"client"}),component:"button",children:"Select"})]})]},t.name))}),a.jsx(A8,{children:"Client side SDKs"}),a.jsx(F8,{children:cs.map(t=>a.jsxs(R8,{children:[a.jsx(V8,{src:y0(t.icon)}),a.jsxs(L8,{children:[a.jsx("b",{children:t.name})," ",a.jsx(le,{onClick:()=>e({name:t.name,type:"frontend"}),component:"button",children:"Select"})]})]},t.name))})]})]}),os=u("div")(({theme:e})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(12,6,6,6),flex:0,minWidth:"400px"})),h2=u("p")(({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.caption.fontSize,marginBottom:e.spacing(2)})),c5=({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.body2.fontSize,marginTop:e.spacing(.5)}),up=u(xc)(c5),hp=u(gc)(c5),ls=u(Nd)(c5),m2=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1.5),alignItems:"flex-start",marginTop:e.spacing(3)})),f2=u("div")(({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.fontWeightBold,marginBottom:e.spacing(2)})),mp=()=>a.jsxs(os,{children:[a.jsxs(m2,{children:[a.jsx(up,{}),a.jsxs(O,{children:[a.jsx(f2,{children:"Flags live in projects"}),a.jsx(h2,{children:"Projects are containers for feature flags. Each flag belongs to the project where you create it."})]})]}),a.jsxs(m2,{children:[a.jsx(hp,{}),a.jsxs(O,{children:[a.jsx(f2,{children:"Flags have configuration in environments"}),a.jsx(h2,{children:"You can have multiple environments, and each feature flag has a different configuration per environment."})]})]}),a.jsxs(m2,{children:[a.jsx(ls,{}),a.jsxs(O,{children:[a.jsx(f2,{children:"SDKs connect to Unleash to retrieve configuration"}),a.jsx(h2,{children:"When you connect an SDK to Unleash, it uses the API key to identify which feature flags and configuration to retrieve from each environment."})]})]})]}),fp=()=>a.jsx(os,{children:a.jsxs(m2,{children:[a.jsx(ls,{}),a.jsxs(O,{children:[a.jsx(f2,{children:"SDKs and Unleash"}),a.jsx(h2,{children:"SDKs serve to bind your application to Unleash. The SDK can connect to Unleash via HTTP and retrieve feature flag configuration that is then cached in your application. Making sure none of your application data ever leaves your servers."})]})]})}),ds=u(g3,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({transition:"background-color 0.5s ease",color:e.palette.common.white,backgroundColor:t?e.palette.primary.main:e.palette.divider,"@keyframes pulse":{"0%":{boxShadow:`0 0 0 0px ${Qe(e.palette.primary.main,.7)}`},"100%":{boxShadow:`0 0 0 20px ${Qe(e.palette.primary.main,0)}`}},animation:t?"pulse 2s infinite":""})),pp=u(g3,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({transition:"background-color 0.5s ease",color:e.palette.primary.main,backgroundColor:t?e.palette.background.default:e.palette.divider,"@keyframes pulse":{"0%":{boxShadow:`0 0 0 0px ${Qe(e.palette.background.default,.7)}`},"100%":{boxShadow:`0 0 0 20px ${Qe(e.palette.background.default,0)}`}},animation:t?"pulse 2s infinite":""}));var s5={},vp=ee;Object.defineProperty(s5,"__esModule",{value:!0});var J2=s5.default=void 0,gp=vp(X1()),xp=a,jp=(0,gp.default)((0,xp.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending");J2=s5.default=jp;const bp=u("div")(({theme:e})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(6,9,6,9),minWidth:"400px",display:"flex",flexDirection:"column",color:e.palette.primary.contrastText})),yp=u(I)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",fontWeight:e.typography.fontWeightBold})),_p=u("div")(({theme:e})=>({display:"flex",flexDirection:"row",padding:e.spacing(4,0,12,0),justifyContent:"space-between",fontSize:e.spacing(1)})),N8=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexDirection:"column"})),W8=u("div")(({theme:e})=>({alignItems:"center",justifyContent:"center",display:"flex",gap:e.spacing(2),flexDirection:"column",fontSize:e.fontSizes.smallBody})),wp=u(V3)(({theme:e})=>({color:e.palette.primary.main,backgroundColor:e.palette.background.paper,borderRadius:"50%",padding:e.spacing(1),width:"80px",height:"80px"})),Sp=({projectId:e,sdk:t,environment:n})=>{const i=_1(),{project:c}=te(e,{refreshInterval:1e3}),s=c.onboardingStatus.status==="onboarded";return a.jsxs(bp,{children:[a.jsx(yp,{children:"Connection information"}),a.jsxs(_p,{children:[a.jsxs(N8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Environment"}),a.jsx(I,{variant:"body2",children:n})]}),a.jsxs(N8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"SDK"}),a.jsx(I,{variant:"body2",children:t})]})]}),s?a.jsxs(W8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Connection status"}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"Connected"}),a.jsx(wp,{}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"We received metrics from your application!"})]}):a.jsxs(W8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Connection status"}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"Waiting for SDK data..."}),a.jsx(pp,{sx:{width:80,height:80},active:!0,children:a.jsx(J2,{fontSize:"large"})})]})]})},Op=`1\\. Install the SDK
|
|
2
2
|
|
|
3
3
|
\`\`\`gradle
|
|
4
4
|
implementation("io.getunleash:unleash-android:1")
|
|
@@ -706,7 +706,7 @@ The flag name should contain the project name, the feature name, and the ticket
|
|
|
706
706
|
--header 'Authorization: INSERT_API_KEY' \\
|
|
707
707
|
--header 'Content-Type: application/json' \\
|
|
708
708
|
--data-raw '${JSON.stringify(x(),void 0,2)}'`,k=async K=>{K.preventDefault();const Z=x();if(C())try{await W(t,Z),A(),i({text:"Project information updated",type:"success"}),f!==Ph&&o("project_stickiness_set")}catch(B){c(y1(B))}};return a.jsx(Pw,{children:a.jsx(Xe,{loading:S,title:"General settings",description:"Projects allow you to group feature flags together in the management UI.",documentationLink:"https://docs.getunleash.io/concepts/projects#update-a-project",documentationLinkLabel:"Projects documentation",formatApiCode:M,compactPadding:!0,compact:!0,children:a.jsx(Ew,{children:a.jsx(Tw,{errors:D,handleSubmit:k,projectId:l,setProjectId:g,projectName:d,setProjectName:j,projectStickiness:f,setProjectStickiness:_,setFeatureLimit:p,featureLimit:v,projectDesc:m,setProjectDesc:b,mode:"Edit",clearErrors:w,validateProjectId:P,children:a.jsx(b3,{type:"submit",permission:[J1,Wc],projectId:l,"data-testid":Zw,children:"Save changes"})})})})})},Mw=({open:e,onClose:t,project:n,onSuccess:i})=>{const{archiveProject:c}=Je(),{refetch:s}=Fr(),{setToastData:o,setToastApiError:l}=O1(),d=async m=>{m.preventDefault();try{await c(n),s(),o({text:"Project archived",type:"success"}),i==null||i()}catch(f){l(y1(f))}t(m)};return a.jsx(he,{open:e,onClick:d,onClose:t,title:"Are you sure?",children:a.jsx(I,{children:"The project will be moved to the projects archive, where it can either be revived or permanently deleted."})})},Aw=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",borderTop:`1px solid ${e.palette.divider}`,paddingTop:e.spacing(4),gap:e.spacing(2)})),Fw=u("div")(({theme:e})=>({display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(3)})),Rw=({projectId:e,featureCount:t})=>{const[n,i]=h.useState(!1),c=ne(),s=t>0;return a.jsxs(Aw,{children:[a.jsx("p",{children:"Before you can archive a project, you must first archive all of the feature flags associated with it."}),a.jsx(V,{condition:t>0,show:a.jsxs("p",{children:["Currently there ",t<=1?"is":"are"," ",a.jsx(le,{component:x1,to:"../..",children:a.jsxs("strong",{children:[t," active feature"," ",t===1?"flag":"flags","."]})})]})}),a.jsx(Fw,{children:a.jsx(b3,{permission:Eh,disabled:s,projectId:e,onClick:()=>{i(!0)},tooltipProps:{title:"Archive project"},"data-loading":!0,children:"Archive project"})}),a.jsx(Mw,{project:e,open:n,onClose:()=>{i(!1)},onSuccess:()=>{c("/projects")}})]})},Lw=u("div")(({theme:e})=>({borderRadius:e.spacing(2),overflow:"hidden"})),Vw=({featureCount:e})=>{const t=n1("projectId"),{uiConfig:n}=v1(),{loading:i}=Je(),c=()=>`curl --location --request POST '${n.unleashUrl}/api/admin/projects/archive/${t}' \\
|
|
709
|
-
--header 'Authorization: INSERT_API_KEY'`;return a.jsx(Lw,{children:a.jsx(Xe,{loading:i,title:"Archive project",description:"",documentationLink:"https://docs.getunleash.io/concepts/projects",documentationLinkLabel:"Projects documentation",formatApiCode:c,compact:!0,compactPadding:!0,showDescription:!1,showLink:!1,children:a.jsx(Rw,{projectId:t,featureCount:e})})})},Nw=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),Ww=()=>{const{isEnterprise:e}=v1(),{hasAccess:t}=h.useContext(Me),n=n1("projectId"),{project:i}=te(n);if(!i.name)return null;const c=!t([J1,Wc],n)&&a.jsx(T1,{severity:"error",sx:{mb:4},children:"You do not have the required permissions to edit this project."});return a.jsxs(a.Fragment,{children:[c,a.jsxs(Nw,{children:[a.jsx(Iw,{project:i}),a.jsx(V,{condition:e(),show:a.jsx(gw,{project:i})}),a.jsx(Vw,{featureCount:jc(i)??0})]})]})},zw=()=>{const e=n1("projectId"),t=je(e),{hasAccess:n}=h.useContext(Me),{isOss:i}=v1();return fe(`Project configuration – ${t}`),i()?a.jsx(A1,{header:a.jsx(S1,{title:"General settings"}),sx:{justifyContent:"center"},children:a.jsx(I0,{feature:"project-settings"})}):n([J1,Zh],e)?a.jsx(Ww,{}):a.jsx(A1,{header:a.jsx(S1,{title:"General settings"}),children:a.jsx(T1,{severity:"error",children:'You need project owner permissions or a custom role with "project setting access permission" to access this section.'})})},Bw={actions:[]},I5=e=>{const{isEnterprise:t}=v1(),n=F3("automatedActions"),{data:i,error:c,mutate:s}=Qr(t()&&n,Bw,B1(`api/admin/projects/${e}/actions`),Yw);return h.useMemo(()=>({actions:(i==null?void 0:i.actions)??[],loading:!c&&!i,refetch:()=>s(),error:c}),[i,c,s])},Yw=e=>fetch(e).then(me("Actions")).then(t=>t.json()),Bs=e=>{const{loading:t,makeRequest:n,createRequest:i,errors:c}=A2({propagateErrors:!0}),s=`api/admin/projects/${e}/actions`,o=async p=>{const j=i(s,{method:"POST",body:JSON.stringify(p)},"addActionSet");return(await n(j.caller,j.id)).json()},l=async(p,g)=>{const b=i(`${s}/${p}`,{method:"PUT",body:JSON.stringify(g)},"updateActionSet");await n(b.caller,b.id)},d=async p=>{const j=i(`${s}/${p}/on`,{method:"POST"},"enableActionSet");await n(j.caller,j.id)},m=async p=>{const j=i(`${s}/${p}/off`,{method:"POST"},"disableActionSet");await n(j.caller,j.id)};return{addActionSet:o,updateActionSet:l,removeActionSet:async p=>{const j=i(`${s}/${p}`,{method:"DELETE"},"removeActionSet");await n(j.caller,j.id)},toggleActionSet:async(p,g)=>{g?await d(p):await m(p)},errors:c,loading:t}},Hw=u(O)({display:"flex",alignItems:"center"}),Uw=u(g3)(({theme:e})=>({background:"transparent",borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(3),height:e.spacing(3),fontSize:e.fontSizes.mainHeader})),kw=u(le)(({theme:e})=>({...Ih(e),"&:hover, &:focus":{textDecoration:"underline"}})),qw=({action:e,signalEndpoints:t})=>{const{sourceId:n,source:i}=e.match;if(i==="signal-endpoint"){const c=t.find(({id:s})=>s===n);if(c)return a.jsx(Z1,{children:a.jsxs(Hw,{children:[a.jsx(M3,{title:"Signal endpoint",arrow:!0,children:a.jsx(Uw,{src:y0(Mh),alt:"Signal endpoint",variant:"rounded"})}),a.jsx(kw,{component:x1,to:"/integrations/signals",underline:"hover",children:c.name})]})})}return a.jsx(Z1,{children:"No source"})},Kw=u(I)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),Gw=({action:e})=>{const{payload:t}=e.match,n=Object.entries(t);return n.length===0?a.jsx(Z1,{children:"0 filters"}):a.jsx(Z1,{children:a.jsx(F0,{tooltipProps:{maxWidth:500},tooltip:a.jsx(a.Fragment,{children:n.map(([i,{inverted:c,operator:s,caseInsensitive:o,value:l,values:d}])=>{const m=xr(s),f=c?a.jsxs(a.Fragment,{children:["is ",a.jsx("u",{children:"not"})," ",m.substring(2)]}):m;return a.jsxs(Kw,{children:[a.jsx("strong",{children:i})," ",f,o?" (case insensitive)":"",": ",a.jsx("strong",{children:d?d.join(", "):l})]},i)})}),children:n.length===1?"1 filter":`${n.length} filters`})})},Qw=({action:e,serviceAccounts:t})=>{const{actorId:n}=e,i=t.find(({id:c})=>c===n);return i?a.jsx(M0,{to:"/admin/service-accounts",title:i.name,subtitle:i.username}):a.jsx(Z1,{children:"No service account"})},Jw=async e=>{const t=await fetch(e);return await me("Action events")(t),t.json()},Ys=(e,t,n=50,i={})=>{var w;const{isEnterprise:c}=v1(),s=F3("automatedActions"),o=(P,C)=>!e||!t||!c||!s||C&&!C.actionSetEvents.length?null:B1(`api/admin/projects/${t}/actions/${e}/events?limit=${n}&offset=${P*n}`),{data:l,error:d,size:m,setSize:f,mutate:v}=Ah(o,Jw,{...i,revalidateAll:!0}),p=l?l.flatMap(({actionSetEvents:P})=>P):[],g=!l&&!d,j=m>0&&!(l!=null&&l[m-1]),b=g||j,_=((w=l==null?void 0:l[m-1])==null?void 0:w.actionSetEvents.length)===n;return{actionEvents:p,hasMore:_,loadMore:()=>{b||!_||f(m+1)},loading:b,refetch:()=>v(),error:d}},Xw=u("div",{shouldForwardProp:e=>e!=="state"})(({theme:e,state:t})=>({padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,...t==="not started"&&{backgroundColor:e.palette.background.elevation1}})),eS=u("div")({display:"flex",flexDirection:"column"}),tS=u("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),nS=u("div")(({theme:e})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,gap:e.spacing(2)})),aS=u(K2)(({theme:e})=>({color:e.palette.success.main}));u(Jr)(({theme:e})=>({color:e.palette.error.main}));const rS=u(T1)(({theme:e})=>({marginTop:e.spacing(2),fontSize:"inherit"})),iS=u(q3)(({theme:e})=>({margin:e.spacing(2,0)})),cS=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),sS=u("p")(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(.5)})),oS=u("span")(({theme:e})=>({color:e.palette.text.secondary})),lS=({action:{state:e,details:t,action:n,executionParams:i},children:c})=>{const s=e==="success"?a.jsx(aS,{}):e==="started"?a.jsx(Xr,{size:20}):e==="not started"?a.jsx("span",{children:"Not started"}):null;return a.jsxs(Xw,{state:e,children:[a.jsxs(eS,{children:[a.jsxs(tS,{children:[a.jsx("div",{children:c}),a.jsx(nS,{children:s})]}),a.jsx(V,{condition:!!t,show:a.jsx(rS,{severity:"error",children:t})})]}),a.jsx(iS,{}),a.jsxs(cS,{children:[a.jsx(sS,{children:n}),Object.entries(i).map(([o,l])=>a.jsxs("div",{children:[a.jsxs(oS,{children:[o,":"]})," ",l]},o))]})]})},dS=h.lazy(()=>zc(()=>import("./ReactJSONEditor-CdN66QkS.js"),[])),uS=u(Kr)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),hS=u(qr)({lineHeight:"1.5rem"}),mS=u(x1)(({theme:e})=>({marginLeft:e.spacing(1)})),fS=({signal:e})=>{const{signalEndpoints:t}=e5(),n=h.useMemo(()=>{const i=t.find(({id:c})=>c===e.sourceId);return i==null?void 0:i.name},[t,e.sourceId]);return a.jsxs(uS,{children:[a.jsxs(hS,{expandIcon:a.jsx($1,{children:a.jsx(Nc,{titleAccess:"Toggle"})}),children:["Signal endpoint:",a.jsx(mS,{to:"/integrations/signals",children:n})]}),a.jsx(Gr,{children:a.jsx(h.Suspense,{fallback:null,children:a.jsx(dS,{content:{json:e.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]})},pS=({signal:e})=>{const{source:t}=e;return t==="signal-endpoint"?a.jsx(fS,{signal:e}):null},vS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),gS=u(T1)({fontSize:"inherit"}),Hs=({state:e,actionSet:{actions:t},signal:n})=>{const i=e==="failed"?`${t.filter(({state:c})=>c!=="success").length} out of ${t.length} actions were not successfully executed`:"All actions were successfully executed";return a.jsxs(vS,{children:[a.jsx(gS,{severity:e==="failed"?"error":"success",icon:e==="success"?a.jsx(K2,{}):void 0,children:i}),a.jsx(pS,{signal:n}),t.map((c,s)=>a.jsxs(lS,{action:c,children:["Action ",s+1]},c.id))]})},xS=u(F0)(({theme:e})=>({display:"flex",alignItems:"center"})),jS=u("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),bS=u("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),yS=u(K2)(({theme:e})=>({color:e.palette.success.main})),_S=u(Jr)(({theme:e})=>({color:e.palette.error.main})),wS=({action:e})=>{const{id:t,project:n}=e,{actionEvents:i}=Ys(t,n,1,{refreshInterval:5e3}),{locationSettings:c}=G3();if(i.length===0)return null;const s=i[0],o=s.state==="success"?a.jsx(yS,{}):s.state==="failed"?a.jsx(_S,{}):a.jsx(Xr,{size:20});return a.jsx(xS,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:a.jsxs(a.Fragment,{children:[a.jsxs(jS,{children:[a.jsx(bS,{children:"Last event"}),a.jsx("span",{children:E0(s.createdAt,c==null?void 0:c.locale)})]}),a.jsx(Hs,{...s})]}),children:o})},SS=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:e.spacing(2)})),OS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),fontSize:e.fontSizes.smallerBody})),CS=u("ul")(({theme:e})=>({listStyle:"none",paddingLeft:e.spacing(1),margin:0})),DS=({action:e,onCreateAction:t})=>{const{actions:n}=e;return n.length===0?t?a.jsx(M0,{title:"Create action",onClick:t}):a.jsx(Z1,{children:"0 actions"}):a.jsxs(SS,{children:[a.jsx(wS,{action:e}),a.jsx(F0,{tooltip:a.jsx(OS,{children:n.map(({id:i,action:c,executionParams:s})=>a.jsxs("div",{children:[a.jsx("strong",{children:c}),a.jsx(CS,{children:Object.entries(s).map(([o,l])=>a.jsxs("li",{children:[a.jsx("strong",{children:o}),":"," ",l]},o))})]},i))}),children:n.length===1?"1 action":`${n.length} actions`})]})},$S=u(O)({display:"flex",justifyContent:"center"}),TS=({actionId:e,onOpenEvents:t,onEdit:n,onDelete:i})=>{const[c,s]=h.useState(null),o=!!c,l=v=>{s(v.currentTarget)},d=()=>{s(null)},m=`action-${e}-actions`,f=`${m}-menu`;return a.jsxs($S,{children:[a.jsx(Y1,{title:"Action actions",arrow:!0,describeChild:!0,children:a.jsx($1,{id:m,"data-loading":!0,"aria-controls":o?f:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:l,type:"button",children:a.jsx(Pr,{})})}),a.jsx(C0,{id:f,anchorEl:c,open:o,onClose:d,onClick:d,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:`${v.shape.borderRadius}px`,padding:v.spacing(1,1.5)})},children:a.jsxs(D0,{"aria-labelledby":m,children:[a.jsx(ve,{permission:u2,children:({hasAccess:v})=>a.jsxs(ce,{sx:p3,onClick:t,disabled:!v,children:[a.jsx(pe,{children:a.jsx(Fh,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"View events"})})]})}),a.jsx(ve,{permission:u2,children:({hasAccess:v})=>a.jsxs(ce,{sx:p3,onClick:n,disabled:!v,children:[a.jsx(pe,{children:a.jsx(Q3,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Edit"})})]})}),a.jsx(ve,{permission:u2,children:({hasAccess:v})=>a.jsxs(ce,{sx:p3,onClick:i,disabled:!v,children:[a.jsx(pe,{children:a.jsx(x3,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Remove"})})]})})]})})]})},PS=u("div")(({theme:e})=>({marginTop:e.spacing(1),position:"relative"})),ES=u("div")(({theme:e})=>({padding:e.spacing(.75,1),fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:e.spacing(-2),left:e.spacing(2),lineHeight:1})),ZS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.default,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),paddingTop:e.spacing(1),borderRadius:e.shape.borderRadiusMedium})),Us=u("div")({display:"flex",alignItems:"center"}),IS=u(Us)(({theme:e})=>({justifyContent:"space-between",marginBottom:e.spacing(1)})),ks=({index:e,header:t,separator:n="AND",children:i})=>a.jsxs(PS,{children:[a.jsx(V,{condition:e>0,show:a.jsx(ES,{children:n})}),a.jsxs(ZS,{children:[a.jsx(IS,{children:t}),a.jsx(Us,{children:i})]})]}),MS=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M5 18C5 18.55 5.45 19 6 19H18C18.55 19 19 18.55 19 18C19 17.45 18.55 17 18 17H6C5.45 17 5 17.45 5 18ZM9.5 12.8H14.5L15.16 14.4C15.31 14.76 15.66 15 16.05 15C16.74 15 17.2 14.29 16.93 13.66L13.05 4.69C12.87 4.27 12.46 4 12 4C11.54 4 11.13 4.27 10.95 4.69L7.07 13.66C6.8 14.29 7.27 15 7.96 15C8.35 15 8.7 14.76 8.85 14.4L9.5 12.8ZM12 5.98L13.87 11H10.13L12 5.98Z"})),AS=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.10831 2.60839C3.71687 2.23054 3.09322 2.23475 2.70696 2.62102C2.31643 3.01154 2.31643 3.64471 2.70696 4.03523L8.65871 9.98698L7.07 13.6598C6.8 14.2898 7.27 14.9998 7.96 14.9998C8.35 14.9998 8.7 14.7598 8.85 14.3998L9.5 12.7998H11.4716L15.6716 16.9998H6C5.45 16.9998 5 17.4498 5 17.9998C5 18.5498 5.45 18.9998 6 18.9998H17.6716L19.6775 21.0058C20.068 21.3963 20.7012 21.3963 21.0917 21.0058C21.478 20.6195 21.4822 19.9959 21.1044 19.6044C21.1001 19.6003 21.0958 19.5961 21.0916 19.5919L4.12102 2.62132C4.11674 2.61704 4.1125 2.61273 4.10831 2.60839ZM16.1235 11.7954L13.05 4.68985C12.87 4.26985 12.46 3.99985 12 3.99985C11.54 3.99985 11.13 4.26985 10.95 4.68985L10.3666 6.03851L11.5408 7.21265L12 5.97985L13.0045 8.67635L16.1235 11.7954Z"})),qs=Bc($1)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",height:"auto",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,padding:"0 1px 0",marginRight:"1rem","&:hover":{background:e.palette.background.application},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),Ks=Bc($1)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main,borderRadius:e.shape.borderRadius,marginRight:"1rem",padding:"0 1px 0","&:hover":{color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),FS=({localConstraint:e,setCaseInsensitive:t})=>a.jsx(Y1,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:a.jsx(O,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(V,{condition:!!e.caseInsensitive,show:a.jsx(qs,{onClick:t,disableRipple:!0,children:a.jsx(AS,{})}),elseShow:a.jsx(Ks,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(MS,{})})})})}),RS=e=>h.createElement("svg",{width:24,height:10,viewBox:"0 0 24 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M20.9238 0.46875V9H19.1719V0.46875H20.9238ZM23.5488 0.46875V1.8457H16.5879V0.46875H23.5488Z"}),h.createElement("path",{d:"M16.2422 4.53516V4.93945C16.2422 5.58789 16.1543 6.16992 15.9785 6.68555C15.8027 7.20117 15.5547 7.64062 15.2344 8.00391C14.9141 8.36328 14.5312 8.63867 14.0859 8.83008C13.6445 9.02148 13.1543 9.11719 12.6152 9.11719C12.0801 9.11719 11.5898 9.02148 11.1445 8.83008C10.7031 8.63867 10.3203 8.36328 9.99609 8.00391C9.67188 7.64062 9.41992 7.20117 9.24023 6.68555C9.06445 6.16992 8.97656 5.58789 8.97656 4.93945V4.53516C8.97656 3.88281 9.06445 3.30078 9.24023 2.78906C9.41602 2.27344 9.66406 1.83398 9.98438 1.4707C10.3086 1.10742 10.6914 0.830078 11.1328 0.638672C11.5781 0.447266 12.0684 0.351562 12.6035 0.351562C13.1426 0.351562 13.6328 0.447266 14.0742 0.638672C14.5195 0.830078 14.9023 1.10742 15.2227 1.4707C15.5469 1.83398 15.7969 2.27344 15.9727 2.78906C16.1523 3.30078 16.2422 3.88281 16.2422 4.53516ZM14.4668 4.93945V4.52344C14.4668 4.07031 14.4258 3.67188 14.3438 3.32812C14.2617 2.98438 14.1406 2.69531 13.9805 2.46094C13.8203 2.22656 13.625 2.05078 13.3945 1.93359C13.1641 1.8125 12.9004 1.75195 12.6035 1.75195C12.3066 1.75195 12.043 1.8125 11.8125 1.93359C11.5859 2.05078 11.3926 2.22656 11.2324 2.46094C11.0762 2.69531 10.957 2.98438 10.875 3.32812C10.793 3.67188 10.752 4.07031 10.752 4.52344V4.93945C10.752 5.38867 10.793 5.78711 10.875 6.13477C10.957 6.47852 11.0781 6.76953 11.2383 7.00781C11.3984 7.24219 11.5938 7.41992 11.8242 7.54102C12.0547 7.66211 12.3184 7.72266 12.6152 7.72266C12.9121 7.72266 13.1758 7.66211 13.4062 7.54102C13.6367 7.41992 13.8301 7.24219 13.9863 7.00781C14.1426 6.76953 14.2617 6.47852 14.3438 6.13477C14.4258 5.78711 14.4668 5.38867 14.4668 4.93945Z"}),h.createElement("path",{d:"M7.70508 0.46875V9H5.94727L2.51953 3.28125V9H0.761719V0.46875H2.51953L5.95312 6.19336V0.46875H7.70508Z"})),LS=e=>h.createElement("svg",{width:24,height:36,viewBox:"25 12 24 30",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M44.2145 31H45.9238V23.8457H48.5488V22.4688H45.9238H44.1719H41.5879V23.8457H44.1719V30.9574L44.2145 31ZM39.1419 28.7274L40.3188 29.9043C40.3146 29.9095 40.3104 29.9147 40.3061 29.9198L46.2004 35.8141L44.8004 37.2141L38.5868 31.0005C38.2828 31.0783 37.9589 31.1172 37.6152 31.1172C37.0801 31.1172 36.5898 31.0215 36.1445 30.8301C35.7031 30.6387 35.3203 30.3633 34.9961 30.0039C34.6719 29.6406 34.4199 29.2012 34.2402 28.6855C34.0645 28.1699 33.9766 27.5879 33.9766 26.9395V26.5352C33.9766 26.4869 33.977 26.4391 33.978 26.3917L32.7051 25.1188V31H30.9473L27.5195 25.2812V31H25.7617V22.4688H27.5195L30.9531 28.1934V23.3668L26.4004 18.8141L27.8004 17.4141L34.5229 24.1366C34.5262 24.1305 34.5295 24.1244 34.5328 24.1183L35.8509 25.4364C35.8493 25.4442 35.8477 25.452 35.8461 25.4598L37.0004 26.6141L39.1328 28.7465C39.1359 28.7402 39.1389 28.7338 39.1419 28.7274ZM39.4614 26.247L41.1626 27.9481C41.2157 27.632 41.2422 27.2957 41.2422 26.9395V26.5352C41.2422 25.8828 41.1523 25.3008 40.9727 24.7891C40.7969 24.2734 40.5469 23.834 40.2227 23.4707C39.9023 23.1074 39.5195 22.8301 39.0742 22.6387C38.6328 22.4473 38.1426 22.3516 37.6035 22.3516C37.0684 22.3516 36.5781 22.4473 36.1328 22.6387C36.0682 22.6667 36.0048 22.6966 35.9427 22.7283L37.0488 23.8344C37.2187 23.7794 37.4036 23.752 37.6035 23.752C37.9004 23.752 38.1641 23.8125 38.3945 23.9336C38.625 24.0508 38.8203 24.2266 38.9805 24.4609C39.1406 24.6953 39.2617 24.9844 39.3438 25.3281C39.4087 25.6002 39.4479 25.9065 39.4614 26.247ZM37.281 29.6947L35.9324 28.346C36.0101 28.5994 36.112 28.82 36.2383 29.0078C36.3984 29.2422 36.5938 29.4199 36.8242 29.541C36.9642 29.6146 37.1165 29.6658 37.281 29.6947Z"})),VS=({localConstraint:e,setInvertedOperator:t})=>a.jsx(Y1,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:a.jsx(O,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(V,{condition:!!e.inverted,show:a.jsx(Ks,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(RS,{})}),elseShow:a.jsx(qs,{onClick:t,disableRipple:!0,children:a.jsx(LS,{})})})})}),NS=u("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular})),Gs=({children:e,...t})=>a.jsx(NS,{...t,children:e}),Qs=Yr()(e=>({valueChip:{margin:"0 0.5rem 0.5rem 0"},chipValue:{whiteSpace:"pre"},inputContainer:{display:"flex",alignItems:"center",[e.breakpoints.down(700)]:{flexDirection:"column",alignItems:"flex-start"}},inputInnerContainer:{minWidth:"300px",[e.breakpoints.down(700)]:{minWidth:"100%"}},input:{width:"100%",margin:"1rem 0"},button:{marginLeft:"1rem",[e.breakpoints.down(700)]:{marginLeft:0,marginBottom:"0.5rem"}},valuesContainer:{marginTop:"1rem"}})),WS=u(O)(({theme:e})=>({"&:has(*)":{marginTop:e.spacing(2)}})),zS="Enter",S7=({values:e,removeValue:t,setValues:n,error:i,setError:c})=>{const[s,o]=h.useState(""),{classes:l}=Qs(),{uiConfig:d,loading:m}=v1(),f=d.resourceLimits.constraintValues,v=g=>{g.key===zS&&(g.preventDefault(),p())},p=()=>{const g=YS([...e,...Lh(s)]);g.length>f?c(`constraints cannot have more than ${f} values`):g.length===0?c("values cannot be empty"):g.some(b=>b.length>100)?c("values cannot be longer than 100 characters"):(c(""),o(""),n(g))};return a.jsxs(a.Fragment,{children:[a.jsx(Gs,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),a.jsxs("div",{className:l.inputContainer,children:[a.jsx("div",{className:l.inputInnerContainer,children:a.jsx(w3,{onKeyPress:v,label:"Values",name:"values",value:s,onFocus:()=>{c("")},onChange:g=>o(g.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!i,errorText:i,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),a.jsx(c1,{className:l.button,variant:"outlined",color:"primary",onClick:p,"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",disabled:m,children:"Add values"})]}),a.jsx("div",{className:l.valuesContainer,children:a.jsx(BS,{values:e,removeValue:t})}),a.jsx(WS,{children:a.jsx(bc,{name:"single constraint values",shortName:"values",currentValue:e.length,limit:f})})]})},BS=({values:e,removeValue:t})=>{const{classes:n}=Qs();return a.jsx(a.Fragment,{children:e.map((i,c)=>a.jsx(Rc,{label:a.jsx(Rh,{text:i,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(c),className:n.valueChip,"data-testid":"CONSTRAINT_VALUES_CHIP"},`${i}-${c}`))})},YS=e=>Array.from(new Set(e)),HS=Yr()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),O7=({setValue:e,value:t,type:n,error:i,setError:c})=>{const{classes:s}=HS();return a.jsxs(a.Fragment,{children:[a.jsxs(Gs,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx("div",{className:s.singleValueContainer,children:a.jsx(w3,{label:n,name:"value",value:t||"",onChange:o=>{c(""),e(o.target.value.trim())},onFocus:()=>c(""),placeholder:`Enter a single ${n} value`,className:s.singleValueInput,error:!!i,errorText:i})})]})},US=({operator:e,localConstraint:t,setValue:n,setValues:i,setError:c,removeValue:s,error:o})=>{if(Vh(e))return a.jsx(S7,{values:t.values||[],removeValue:s,setValues:i,error:o,setError:c});if(jr(e))return a.jsx(S7,{values:t.values||[],removeValue:s,setValues:i,error:o,setError:c});if(Nh(e))return a.jsx(O7,{setValue:n,value:t.value,type:"number",error:o,setError:c});if(Wh(e))return a.jsx(O7,{setValue:n,value:t.value,type:"semver",error:o,setError:c})},kS=u("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),C7=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),D7=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),qS=u(zh)(({theme:e})=>({[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(.5)}})),KS=u(ce,{shouldForwardProp:e=>e!=="separator"})(({theme:e,separator:t})=>t?{position:"relative",overflow:"visible",marginTop:e.spacing(2),"&:before":{content:'""',display:"block",position:"absolute",top:e.spacing(-1),left:0,right:0,borderTop:"1px solid",borderTopColor:e.palette.divider}}:{}),GS=u("div")(({theme:e})=>({lineHeight:1.2})),QS=({options:e,value:t,onChange:n})=>{const[i,c]=h.useState(!1),s=l=>{n(l.target.value)},o=()=>a.jsxs(kS,{children:[a.jsx(C7,{children:t}),a.jsx(D7,{children:xr(t)})]});return a.jsxs(qS,{variant:"outlined",size:"small",fullWidth:!0,children:[a.jsx(Bh,{htmlFor:"operator-select",children:"Operator"}),a.jsx(Yh,{id:"operator-select",name:"operator",label:"Operator",value:t,open:i,onOpen:()=>c(!0),onClose:()=>c(!1),onChange:s,renderValue:o,children:e.map(l=>a.jsx(KS,{value:l,separator:JS(e,l),children:a.jsxs(GS,{children:[a.jsx(C7,{children:l}),a.jsx(D7,{children:xr(l)})]})},l))})]})},JS=(e,t)=>t===e[0]?!1:XS.some(n=>n[0]===t),XS=[Yc,Hc,Uc,Hh,kc],eO=u($1)({marginRight:"-6px"}),tO=u("div")({display:"flex",flexDirection:"column",width:"100%"}),nO=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"start",gap:e.spacing(2)}})),aO=u("div")(({theme:e})=>({width:"100%",display:"inline-flex",flex:1,gap:e.spacing(1)})),rO=u("div")(({theme:e})=>({width:"100%","&&& > div":{width:"100%"}})),$7=u("div")(({theme:e})=>({display:"inline-flex",flex:1,"&&& button":{marginRight:0,"&:not(.operator-is-active)":{backgroundColor:e.palette.background.elevation2}}})),iO=u("div")({width:"100%",flex:1});u(w3)({width:"100%"});const cO=u("div")(({theme:e})=>({"& > h3":{margin:e.spacing(1,0,0,0),fontSize:e.fontSizes.smallBody},"& > div":{margin:0,maxWidth:"unset","& > div":{flex:1},"& .MuiFormControl-root":{margin:e.spacing(.5,0,0,0)},"&:not(:first-of-type)":{marginTop:e.spacing(1)}}})),sO=({filter:e,index:t,stateChanged:n,suggestions:i,onDelete:c})=>{const{parameter:s,inverted:o,operator:l,caseInsensitive:d,value:m,values:f}=e,v=a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Filter ",t+1]}),a.jsx("div",{children:a.jsx(Y1,{title:"Delete filter",arrow:!0,children:a.jsx(eO,{onClick:c,children:a.jsx(x3,{})})})})]}),[p,g]=h.useState(!1),j=[...Yc,...Hc,...Uc,...kc],[b,_]=h.useState(""),x=Uh(l),w=()=>{if(n({...e,error:void 0}),m===void 0&&f===void 0)return;const S=f||[m||""],[R,z]=x(...S);R||(_(z),n({...e,error:z}))};h.useEffect(()=>{w()},[m,b]),h.useEffect(()=>{jr(l)?g(!0):g(!1)},[l]);const P=S=>{jr(S)?g(!0):g(!1),n({...e,operator:S})},C=S=>{n({...e,values:void 0,value:S})},D=S=>{n({...e,value:void 0,values:S})},W=S=>{const R=(f==null?void 0:f.filter((z,A)=>A!==S))||[];D(R)};return a.jsx(ks,{index:t,header:v,children:a.jsxs(tO,{children:[a.jsxs(nO,{children:[a.jsx(iO,{children:a.jsx(q2,{freeSolo:!0,options:i,value:s,onInputChange:(S,R)=>n({...e,parameter:R}),renderInput:S=>a.jsx(de,{...S,size:"small",label:"Parameter"})})}),a.jsxs(aO,{children:[a.jsx($7,{children:a.jsx(VS,{localConstraint:{inverted:o},setInvertedOperator:()=>n({...e,inverted:!o||void 0})})}),a.jsx(rO,{children:a.jsx(QS,{options:j,value:l,onChange:P})}),a.jsx(V,{condition:p,show:a.jsx($7,{children:a.jsx(FS,{localConstraint:{caseInsensitive:d},setCaseInsensitive:()=>n({...e,caseInsensitive:!d||void 0})})})})]})]}),a.jsx(cO,{children:a.jsx(US,{setValues:D,setValue:C,setError:_,localConstraint:{value:m,values:f},operator:l,error:b,removeValue:W})})]})})},oO=u("div")(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:e.spacing(2)})),lO=u("div")(({theme:e})=>({position:"absolute",right:0,fontSize:e.fontSizes.smallBody,[e.breakpoints.down("sm")]:{display:"none"}})),dO=u(O,{shouldForwardProp:e=>e!=="verticalConnector"})(({theme:e,verticalConnector:t})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,marginTop:t?0:e.spacing(3),padding:e.spacing(3),borderRadius:e.shape.borderRadiusMedium})),uO=u(q3)(({theme:e})=>({margin:"auto",width:1,height:e.spacing(3)})),Js=({name:e,verticalConnector:t,resourceLink:n,children:i})=>a.jsxs(a.Fragment,{children:[a.jsx(V,{condition:!!t,show:a.jsx(uO,{orientation:"vertical"})}),a.jsxs(dO,{verticalConnector:t,children:[a.jsxs(oO,{children:[a.jsx(z3,{color:"secondary",children:e}),a.jsx(lO,{children:n})]}),i]})]});var M5={},hO=ee;Object.defineProperty(M5,"__esModule",{value:!0});var Xs=M5.default=void 0,mO=hO(X1()),fO=a,pO=(0,mO.default)((0,fO.jsx)("path",{d:"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"}),"ArrowForwardIosSharp");Xs=M5.default=pO;const vO=h.lazy(()=>zc(()=>import("./ReactJSONEditor-CdN66QkS.js"),[])),gO=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(1.5),marginBottom:e.spacing(-.75),height:e.spacing(3)})),xO=u(Kr)({backgroundColor:"transparent",boxShadow:"none","&:before":{display:"none"}}),jO=u(qr)(({theme:e})=>({lineHeight:"1.5rem",padding:0,marginBottom:e.spacing(-2.25),fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,flexDirection:"row-reverse","& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(90deg)"}})),bO=u(Xs)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.fontSizes.smallBody})),yO=u(Gr)(({theme:e})=>({marginTop:e.spacing(2),padding:0})),_O=({payload:e})=>e?a.jsxs(xO,{children:[a.jsx(jO,{expandIcon:a.jsx($1,{children:a.jsx(bO,{titleAccess:"Toggle"})}),children:"Preview payload"}),a.jsx(yO,{children:a.jsx(h.Suspense,{fallback:null,children:a.jsx(vO,{content:{json:e},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]}):a.jsx(gO,{children:"No signals were received from this source yet."}),$r=(e={},t="")=>Object.entries(e).reduce((n,[i,c])=>{const s=t?`${t}.${i}`:i;return typeof c=="object"&&c!==null&&!Array.isArray(c)?Object.assign(n,$r(c,s)):Array.isArray(c)?c.forEach((o,l)=>{typeof o=="object"&&o!==null?Object.assign(n,$r(o,`${s}[${l}]`)):n[`${s}[${l}]`]=o}):n[s]=c,n},{}),wO=u(q3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),SO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),OO=u("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),CO=({sourceId:e,setSourceId:t,filters:n,setFilters:i,validateSourceId:c})=>{const{signalEndpoints:s,loading:o}=e5(),{signalEndpointSignals:l}=kh(e,1),d=()=>{const g=crypto.randomUUID();i(j=>[...j,{id:g,parameter:"",operator:qh}])},m=g=>{i(j=>j.map(b=>b.id===g.id?g:b))},f=h.useMemo(()=>o?[]:s.map(({id:g,name:j})=>({label:j,key:`${g}`})),[o,s]),{lastSourcePayload:v,filterSuggestions:p}=h.useMemo(()=>{var j;const g=(j=l[0])==null?void 0:j.payload;return{lastSourcePayload:g,filterSuggestions:Object.keys($r(g)||{}).sort()}},[l]);return a.jsxs(Js,{name:"When this",resourceLink:a.jsx(x1,{to:"/integrations/signals",children:"Create signal endpoint"}),children:[a.jsx(N3,{label:"Source",options:f,value:`${e}`,onChange:g=>{c(Number(g)),t(Number.parseInt(g,10))}}),a.jsx(V,{condition:!!e,show:a.jsx(_O,{payload:v})}),a.jsx(wO,{}),n.map((g,j)=>a.jsx(sO,{index:j,filter:g,stateChanged:m,suggestions:p,onDelete:()=>i(b=>b.filter(({id:_})=>_!==g.id))},g.id)),a.jsxs(OO,{children:[a.jsx(c1,{startIcon:a.jsx(e3,{}),onClick:d,variant:"outlined",color:"primary",children:"Add filter"}),a.jsx(A0,{htmlTooltip:!0,tooltip:a.jsxs(SO,{children:[a.jsx("p",{children:"Filters allow you to add conditions to the execution of the actions based on the source payload."}),a.jsx("p",{children:"If no filters are defined then the action will always be triggered from the selected source, no matter the payload."})]})})]})]})},DO=(e,t,n)=>{const i=`${t?`?project=${t}`:""}${n?`${t?"&":"?"}environment=${n}`:""}`,c=`api/admin/service-account/${e}/permissions${i}`,{data:s,error:o,mutate:l}=Qr(!!e,void 0,B1(c),$O);return h.useMemo(()=>({overview:s==null?void 0:s.overview,projectRoles:s==null?void 0:s.projectRoles,rootRole:s==null?void 0:s.rootRole,serviceAccount:s==null?void 0:s.serviceAccount,permissions:(s==null?void 0:s.permissions)||[],loading:!o&&!s,refetch:()=>l(),error:o}),[s,o,l])},$O=e=>fetch(e).then(me("Service account access overview")).then(t=>t.json()),TO=({label:e,value:t,onChange:n,options:i})=>a.jsx(q2,{options:i,autoHighlight:!0,autoSelect:!0,value:t,onInputChange:(c,s)=>n(s),renderInput:c=>a.jsx(de,{...c,size:"small",label:e})}),PO=({parameter:e,value:t,onChange:n})=>{const{label:i,type:c}=e;if(c==="select"){const{options:s}=e;return a.jsx(TO,{label:i,value:t,onChange:n,options:s})}return null},EO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),ZO=({value:e,onChange:t,actionConfigurations:n})=>{const i=(s,o)=>a.jsx("li",{...s,children:a.jsxs(EO,{children:[a.jsx("span",{children:o.label}),a.jsx("span",{children:o.description})]})}),c=[...n].map(([s,o])=>({key:s,...o}));return a.jsx(q2,{options:c,autoHighlight:!0,autoSelect:!0,value:c.find(({key:s})=>s===e)||null,onChange:(s,o)=>t(o?o.key:""),renderOption:i,getOptionLabel:({label:s})=>s,renderInput:s=>a.jsx(de,{...s,size:"small",label:"Action"})})},IO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",gap:e.spacing(2)})),T7=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"100%",flexWrap:"wrap"})),P7=u("div")(({theme:e})=>({flex:1,minWidth:e.spacing(25)})),MO=({action:e,index:t,stateChanged:n,actorId:i,onDelete:c,actionConfigurations:s,validated:o})=>{const{action:l,executionParams:d,error:m}=e,f=n1("projectId"),{permissions:v}=DO(i,f,d.environment),p=s.get(l),g=h.useMemo(()=>{const _=p==null?void 0:p.permissions,{environment:x}=d;return v.length===0||!_||!x?!0:_.some(w=>v.some(({permission:P,project:C,environment:D})=>P===w&&C===f&&D===x))},[p,v]);h.useEffect(()=>{n({...e,error:void 0}),((p==null?void 0:p.parameters.filter(({optional:x})=>!x).map(({name:x})=>x))||[]).some(x=>!d[x])&&n({...e,error:"Please fill all required fields."})},[p,d]);const j=a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Action ",t+1]}),a.jsx("div",{children:a.jsx(Y1,{title:"Delete action",arrow:!0,children:a.jsx($1,{onClick:c,children:a.jsx(x3,{})})})})]}),b=(p==null?void 0:p.parameters.filter(({type:_})=>_!=="hidden"))||[];return a.jsx(ks,{index:t,header:j,separator:"THEN",children:a.jsxs(IO,{children:[a.jsx(T7,{children:a.jsx(P7,{children:a.jsx(ZO,{value:l,onChange:_=>n({...e,action:_}),actionConfigurations:s})})}),a.jsx(V,{condition:b.length>0,show:a.jsx(T7,{children:b.map(_=>a.jsx(P7,{children:a.jsx(PO,{parameter:_,value:d[_.name],onChange:x=>n({...e,executionParams:{...d,[_.name]:x}})})},_.name))})}),a.jsx(V,{condition:o&&!!m,show:a.jsx(T1,{severity:"error",children:m})}),a.jsx(V,{condition:!g,show:a.jsx(T1,{severity:"error",children:"The selected service account does not have permissions to execute this action currently."})})]})})},AO={},FO=e=>{const{isEnterprise:t}=v1(),n=F3("automatedActions"),{data:i,error:c,mutate:s}=Qr(t()&&n,AO,B1(`api/admin/projects/${e}/actions/config`),RO);return h.useMemo(()=>({actionConfigurations:new Map(Object.entries(i||{})),loading:!c&&!i,refetch:()=>s(),error:c}),[i,c,s])},RO=e=>fetch(e).then(me("Actions configuration")).then(t=>t.json()),LO=u(q3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),VO=u("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),NO=({serviceAccounts:e,serviceAccountsLoading:t,actions:n,setActions:i,actorId:c,setActorId:s,validateActorId:o,validated:l})=>{const d=n1("projectId"),{actionConfigurations:m}=FO(d),f=g=>{const b={id:crypto.randomUUID(),action:"",sortOrder:n.map(_=>_.sortOrder).reduce((_,x)=>Math.max(_,x),0)+1,executionParams:{project:g}};i([...n,b])},v=g=>{i(j=>j.map(b=>b.id===g.id?g:b))},p=h.useMemo(()=>t?[]:e.map(g=>({label:g.name,key:`${g.id}`})),[t,e]);return a.jsxs(Js,{name:"Do these actions",verticalConnector:!0,resourceLink:a.jsx(x1,{to:"/admin/service-accounts",children:"Create service account"}),children:[a.jsx(N3,{label:"Service account",name:"service-account",options:p,value:`${c}`,onChange:g=>{o(Number(g)),s(Number.parseInt(g,10))}}),a.jsx(LO,{}),n.map((g,j)=>a.jsx(MO,{index:j,action:g,stateChanged:v,actorId:c,onDelete:()=>i(b=>b.filter(_=>_.id!==g.id)),actionConfigurations:m,validated:l},g.id)),a.jsx(VO,{children:a.jsx(c1,{startIcon:a.jsx(e3,{}),onClick:()=>f(d),variant:"outlined",color:"primary",children:"Add action"})})]})},WO=u(T1)(({theme:e})=>({marginBottom:e.spacing(4)})),zO=u("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),E7=u("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),Z7=u(w3)(()=>({width:"100%"})),BO=u(T1)(({theme:e})=>({marginTop:e.spacing(3)})),YO=({enabled:e,setEnabled:t,name:n,setName:i,description:c,setDescription:s,sourceId:o,setSourceId:l,filters:d,setFilters:m,actorId:f,setActorId:v,actions:p,setActions:g,errors:j,validateName:b,validateSourceId:_,validateActorId:x,validated:w})=>{const{serviceAccounts:P,loading:C}=Xc(),D=S=>{setTimeout(()=>S(),300)},W=w&&Object.values(j).some(Boolean);return a.jsxs("div",{children:[a.jsx(V,{condition:P.length===0,show:a.jsxs(WO,{color:"warning",children:[a.jsx("strong",{children:"Heads up!"})," In order to create an action you need to create a service account first. Please"," ",a.jsx(le,{to:"/admin/service-accounts",component:x1,children:"go ahead and create one"}),"."]})}),a.jsx(zO,{children:a.jsx(Kh,{checked:e,setChecked:t,children:"Action status"})}),a.jsx(E7,{children:"What is your new action name?"}),a.jsx(Z7,{autoFocus:!0,label:"Action name",error:!!j.name,errorText:j.name,value:n,onChange:S=>{b(S.target.value),i(S.target.value)},onBlur:S=>D(()=>b(S.target.value)),autoComplete:"off"}),a.jsx(E7,{children:"What is your new action description?"}),a.jsx(Z7,{label:"Action description",value:c,onChange:S=>s(S.target.value),autoComplete:"off"}),a.jsx(CO,{sourceId:o,setSourceId:l,filters:d,setFilters:m,validateSourceId:_}),a.jsx(NO,{serviceAccounts:P,serviceAccountsLoading:C,actions:p,setActions:g,actorId:f,setActorId:v,validateActorId:x,validated:w}),a.jsx(V,{condition:W,show:()=>a.jsx(BO,{severity:"error",icon:!1,children:a.jsx("ul",{children:Object.values(j).filter(Boolean).map(S=>a.jsx("li",{children:S},S))})})})]})},I7={name:void 0,source:void 0,filters:void 0,actor:void 0,actions:void 0},HO=e=>{const t=n1("projectId"),{actions:n}=I5(t),[i,c]=h.useState(!1),[s,o]=h.useState(""),[l,d]=h.useState(""),[m,f]=h.useState(0),[v,p]=h.useState([]),[g,j]=h.useState(0),[b,_]=h.useState([]),x=()=>{var E,L,y;c((e==null?void 0:e.enabled)??!0),o((e==null?void 0:e.name)||""),d((e==null?void 0:e.description)||""),f(((E=e==null?void 0:e.match)==null?void 0:E.sourceId)??0),p(Object.entries(((L=e==null?void 0:e.match)==null?void 0:L.payload)??{}).map(([T,{inverted:Y,operator:Q,caseInsensitive:a1,value:e1,values:X}])=>({id:crypto.randomUUID(),parameter:T,inverted:Y,operator:Q,caseInsensitive:a1,value:e1,values:X}))),j((e==null?void 0:e.actorId)??0),_(((y=e==null?void 0:e.actions)==null?void 0:y.map(T=>({id:crypto.randomUUID(),action:T.action,sortOrder:T.sortOrder,executionParams:T.executionParams})))??[]),D(!1),P(I7)};h.useEffect(()=>{x()},[e]);const[w,P]=h.useState(I7),[C,D]=h.useState(!1),W=E=>{P(L=>({...L,[E]:void 0}))},S=(E,L)=>{P(y=>({...y,[E]:L}))};h.useEffect(()=>{K(v)},[v]),h.useEffect(()=>{H(b)},[b]);const R=E=>!E.length,z=E=>n==null?void 0:n.some(({id:L,name:y})=>L!==(e==null?void 0:e.id)&&y===E),A=E=>E===0,M=E=>R(E)?(S("name","Name is required."),!1):z(E)?(S("name","Name must be unique."),!1):(W("name"),!0),k=E=>A(E)?(S("source","Source is required."),!1):(W("source"),!0),K=E=>E.some(({error:L})=>L)?(S("filters","One or more filters have errors."),!1):(W("filters"),!0),Z=E=>A(E)?(S("actor","Service account is required."),!1):(W("actor"),!0),H=E=>E.filter(({action:L})=>!!L).length===0?(S("actions","At least one action is required."),!1):(W("actions"),E.some(({error:L})=>L)?(S("actions","One or more actions have errors."),!1):(W("actions"),!0));return{enabled:i,setEnabled:c,name:s,setName:o,description:l,setDescription:d,sourceId:m,setSourceId:f,filters:v,setFilters:p,actorId:g,setActorId:j,actions:b,setActions:_,errors:w,setErrors:P,validated:C,validateName:M,validateSourceId:k,validateActorId:Z,validate:()=>{const E=M(s),L=k(m),y=K(v),T=Z(g),Y=H(b);return D(!0),E&&L&&y&&T&&Y},reloadForm:x}},UO=u("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),kO=u("h1")({fontWeight:"normal"}),qO=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),KO=u("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),GO=u(c1)(({theme:e})=>({marginLeft:e.spacing(3)})),QO=({action:e,open:t,setOpen:n,onOpenEvents:i})=>{const c=n1("projectId"),{refetch:s}=I5(c),{addActionSet:o,updateActionSet:l,loading:d}=Bs(c),{setToastData:m,setToastApiError:f}=O1(),{uiConfig:v}=v1(),{enabled:p,setEnabled:g,name:j,setName:b,description:_,setDescription:x,sourceId:w,setSourceId:P,filters:C,setFilters:D,actorId:W,setActorId:S,actions:R,setActions:z,errors:A,validateName:M,validateSourceId:k,validateActorId:K,validate:Z,validated:H,reloadForm:B}=HO(e);h.useEffect(()=>{B()},[t]);const E=e!==void 0,L=`${E?"Edit":"New"} action`,y={enabled:p,name:j,description:_,match:{source:"signal-endpoint",sourceId:w,payload:C.filter(Q=>Q.parameter.length>0).reduce((Q,{parameter:a1,inverted:e1,operator:X,caseInsensitive:t1,value:i1,values:r1})=>({...Q,[a1]:{inverted:e1,operator:X,caseInsensitive:t1,value:i1,values:r1}}),{})},actorId:W,actions:R.filter(({action:Q})=>!!Q).map(({action:Q,sortOrder:a1,executionParams:e1})=>({action:Q,sortOrder:a1,executionParams:e1}))},T=()=>`curl --location --request ${E?"PUT":"POST"} '${v.unleashUrl}/api/admin/projects/${c}/actions${E?`/${e.id}`:""}' \\
|
|
709
|
+
--header 'Authorization: INSERT_API_KEY'`;return a.jsx(Lw,{children:a.jsx(Xe,{loading:i,title:"Archive project",description:"",documentationLink:"https://docs.getunleash.io/concepts/projects",documentationLinkLabel:"Projects documentation",formatApiCode:c,compact:!0,compactPadding:!0,showDescription:!1,showLink:!1,children:a.jsx(Rw,{projectId:t,featureCount:e})})})},Nw=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),Ww=()=>{const{isEnterprise:e}=v1(),{hasAccess:t}=h.useContext(Me),n=n1("projectId"),{project:i}=te(n);if(!i.name)return null;const c=!t([J1,Wc],n)&&a.jsx(T1,{severity:"error",sx:{mb:4},children:"You do not have the required permissions to edit this project."});return a.jsxs(a.Fragment,{children:[c,a.jsxs(Nw,{children:[a.jsx(Iw,{project:i}),a.jsx(V,{condition:e(),show:a.jsx(gw,{project:i})}),a.jsx(Vw,{featureCount:jc(i)??0})]})]})},zw=()=>{const e=n1("projectId"),t=je(e),{hasAccess:n}=h.useContext(Me),{isOss:i}=v1();return fe(`Project configuration – ${t}`),i()?a.jsx(A1,{header:a.jsx(S1,{title:"General settings"}),sx:{justifyContent:"center"},children:a.jsx(I0,{feature:"project-settings"})}):n([J1,Zh],e)?a.jsx(Ww,{}):a.jsx(A1,{header:a.jsx(S1,{title:"General settings"}),children:a.jsx(T1,{severity:"error",children:'You need project owner permissions or a custom role with "project setting access permission" to access this section.'})})},Bw={actions:[]},I5=e=>{const{isEnterprise:t}=v1(),n=F3("automatedActions"),{data:i,error:c,mutate:s}=Qr(t()&&n,Bw,B1(`api/admin/projects/${e}/actions`),Yw);return h.useMemo(()=>({actions:(i==null?void 0:i.actions)??[],loading:!c&&!i,refetch:()=>s(),error:c}),[i,c,s])},Yw=e=>fetch(e).then(me("Actions")).then(t=>t.json()),Bs=e=>{const{loading:t,makeRequest:n,createRequest:i,errors:c}=A2({propagateErrors:!0}),s=`api/admin/projects/${e}/actions`,o=async p=>{const j=i(s,{method:"POST",body:JSON.stringify(p)},"addActionSet");return(await n(j.caller,j.id)).json()},l=async(p,g)=>{const b=i(`${s}/${p}`,{method:"PUT",body:JSON.stringify(g)},"updateActionSet");await n(b.caller,b.id)},d=async p=>{const j=i(`${s}/${p}/on`,{method:"POST"},"enableActionSet");await n(j.caller,j.id)},m=async p=>{const j=i(`${s}/${p}/off`,{method:"POST"},"disableActionSet");await n(j.caller,j.id)};return{addActionSet:o,updateActionSet:l,removeActionSet:async p=>{const j=i(`${s}/${p}`,{method:"DELETE"},"removeActionSet");await n(j.caller,j.id)},toggleActionSet:async(p,g)=>{g?await d(p):await m(p)},errors:c,loading:t}},Hw=u(O)({display:"flex",alignItems:"center"}),Uw=u(g3)(({theme:e})=>({background:"transparent",borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(3),height:e.spacing(3),fontSize:e.fontSizes.mainHeader})),kw=u(le)(({theme:e})=>({...Ih(e),"&:hover, &:focus":{textDecoration:"underline"}})),qw=({action:e,signalEndpoints:t})=>{const{sourceId:n,source:i}=e.match;if(i==="signal-endpoint"){const c=t.find(({id:s})=>s===n);if(c)return a.jsx(Z1,{children:a.jsxs(Hw,{children:[a.jsx(M3,{title:"Signal endpoint",arrow:!0,children:a.jsx(Uw,{src:y0(Mh),alt:"Signal endpoint",variant:"rounded"})}),a.jsx(kw,{component:x1,to:"/integrations/signals",underline:"hover",children:c.name})]})})}return a.jsx(Z1,{children:"No source"})},Kw=u(I)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),Gw=({action:e})=>{const{payload:t}=e.match,n=Object.entries(t);return n.length===0?a.jsx(Z1,{children:"0 filters"}):a.jsx(Z1,{children:a.jsx(F0,{tooltipProps:{maxWidth:500},tooltip:a.jsx(a.Fragment,{children:n.map(([i,{inverted:c,operator:s,caseInsensitive:o,value:l,values:d}])=>{const m=xr(s),f=c?a.jsxs(a.Fragment,{children:["is ",a.jsx("u",{children:"not"})," ",m.substring(2)]}):m;return a.jsxs(Kw,{children:[a.jsx("strong",{children:i})," ",f,o?" (case insensitive)":"",": ",a.jsx("strong",{children:d?d.join(", "):l})]},i)})}),children:n.length===1?"1 filter":`${n.length} filters`})})},Qw=({action:e,serviceAccounts:t})=>{const{actorId:n}=e,i=t.find(({id:c})=>c===n);return i?a.jsx(M0,{to:"/admin/service-accounts",title:i.name,subtitle:i.username}):a.jsx(Z1,{children:"No service account"})},Jw=async e=>{const t=await fetch(e);return await me("Action events")(t),t.json()},Ys=(e,t,n=50,i={})=>{var w;const{isEnterprise:c}=v1(),s=F3("automatedActions"),o=(P,C)=>!e||!t||!c||!s||C&&!C.actionSetEvents.length?null:B1(`api/admin/projects/${t}/actions/${e}/events?limit=${n}&offset=${P*n}`),{data:l,error:d,size:m,setSize:f,mutate:v}=Ah(o,Jw,{...i,revalidateAll:!0}),p=l?l.flatMap(({actionSetEvents:P})=>P):[],g=!l&&!d,j=m>0&&!(l!=null&&l[m-1]),b=g||j,_=((w=l==null?void 0:l[m-1])==null?void 0:w.actionSetEvents.length)===n;return{actionEvents:p,hasMore:_,loadMore:()=>{b||!_||f(m+1)},loading:b,refetch:()=>v(),error:d}},Xw=u("div",{shouldForwardProp:e=>e!=="state"})(({theme:e,state:t})=>({padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,...t==="not started"&&{backgroundColor:e.palette.background.elevation1}})),eS=u("div")({display:"flex",flexDirection:"column"}),tS=u("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),nS=u("div")(({theme:e})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,gap:e.spacing(2)})),aS=u(K2)(({theme:e})=>({color:e.palette.success.main}));u(Jr)(({theme:e})=>({color:e.palette.error.main}));const rS=u(T1)(({theme:e})=>({marginTop:e.spacing(2),fontSize:"inherit"})),iS=u(q3)(({theme:e})=>({margin:e.spacing(2,0)})),cS=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),sS=u("p")(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(.5)})),oS=u("span")(({theme:e})=>({color:e.palette.text.secondary})),lS=({action:{state:e,details:t,action:n,executionParams:i},children:c})=>{const s=e==="success"?a.jsx(aS,{}):e==="started"?a.jsx(Xr,{size:20}):e==="not started"?a.jsx("span",{children:"Not started"}):null;return a.jsxs(Xw,{state:e,children:[a.jsxs(eS,{children:[a.jsxs(tS,{children:[a.jsx("div",{children:c}),a.jsx(nS,{children:s})]}),a.jsx(V,{condition:!!t,show:a.jsx(rS,{severity:"error",children:t})})]}),a.jsx(iS,{}),a.jsxs(cS,{children:[a.jsx(sS,{children:n}),Object.entries(i).map(([o,l])=>a.jsxs("div",{children:[a.jsxs(oS,{children:[o,":"]})," ",l]},o))]})]})},dS=h.lazy(()=>zc(()=>import("./ReactJSONEditor-BH7GX57b.js"),[])),uS=u(Kr)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),hS=u(qr)({lineHeight:"1.5rem"}),mS=u(x1)(({theme:e})=>({marginLeft:e.spacing(1)})),fS=({signal:e})=>{const{signalEndpoints:t}=e5(),n=h.useMemo(()=>{const i=t.find(({id:c})=>c===e.sourceId);return i==null?void 0:i.name},[t,e.sourceId]);return a.jsxs(uS,{children:[a.jsxs(hS,{expandIcon:a.jsx($1,{children:a.jsx(Nc,{titleAccess:"Toggle"})}),children:["Signal endpoint:",a.jsx(mS,{to:"/integrations/signals",children:n})]}),a.jsx(Gr,{children:a.jsx(h.Suspense,{fallback:null,children:a.jsx(dS,{content:{json:e.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]})},pS=({signal:e})=>{const{source:t}=e;return t==="signal-endpoint"?a.jsx(fS,{signal:e}):null},vS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),gS=u(T1)({fontSize:"inherit"}),Hs=({state:e,actionSet:{actions:t},signal:n})=>{const i=e==="failed"?`${t.filter(({state:c})=>c!=="success").length} out of ${t.length} actions were not successfully executed`:"All actions were successfully executed";return a.jsxs(vS,{children:[a.jsx(gS,{severity:e==="failed"?"error":"success",icon:e==="success"?a.jsx(K2,{}):void 0,children:i}),a.jsx(pS,{signal:n}),t.map((c,s)=>a.jsxs(lS,{action:c,children:["Action ",s+1]},c.id))]})},xS=u(F0)(({theme:e})=>({display:"flex",alignItems:"center"})),jS=u("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),bS=u("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),yS=u(K2)(({theme:e})=>({color:e.palette.success.main})),_S=u(Jr)(({theme:e})=>({color:e.palette.error.main})),wS=({action:e})=>{const{id:t,project:n}=e,{actionEvents:i}=Ys(t,n,1,{refreshInterval:5e3}),{locationSettings:c}=G3();if(i.length===0)return null;const s=i[0],o=s.state==="success"?a.jsx(yS,{}):s.state==="failed"?a.jsx(_S,{}):a.jsx(Xr,{size:20});return a.jsx(xS,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:a.jsxs(a.Fragment,{children:[a.jsxs(jS,{children:[a.jsx(bS,{children:"Last event"}),a.jsx("span",{children:E0(s.createdAt,c==null?void 0:c.locale)})]}),a.jsx(Hs,{...s})]}),children:o})},SS=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:e.spacing(2)})),OS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),fontSize:e.fontSizes.smallerBody})),CS=u("ul")(({theme:e})=>({listStyle:"none",paddingLeft:e.spacing(1),margin:0})),DS=({action:e,onCreateAction:t})=>{const{actions:n}=e;return n.length===0?t?a.jsx(M0,{title:"Create action",onClick:t}):a.jsx(Z1,{children:"0 actions"}):a.jsxs(SS,{children:[a.jsx(wS,{action:e}),a.jsx(F0,{tooltip:a.jsx(OS,{children:n.map(({id:i,action:c,executionParams:s})=>a.jsxs("div",{children:[a.jsx("strong",{children:c}),a.jsx(CS,{children:Object.entries(s).map(([o,l])=>a.jsxs("li",{children:[a.jsx("strong",{children:o}),":"," ",l]},o))})]},i))}),children:n.length===1?"1 action":`${n.length} actions`})]})},$S=u(O)({display:"flex",justifyContent:"center"}),TS=({actionId:e,onOpenEvents:t,onEdit:n,onDelete:i})=>{const[c,s]=h.useState(null),o=!!c,l=v=>{s(v.currentTarget)},d=()=>{s(null)},m=`action-${e}-actions`,f=`${m}-menu`;return a.jsxs($S,{children:[a.jsx(Y1,{title:"Action actions",arrow:!0,describeChild:!0,children:a.jsx($1,{id:m,"data-loading":!0,"aria-controls":o?f:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:l,type:"button",children:a.jsx(Pr,{})})}),a.jsx(C0,{id:f,anchorEl:c,open:o,onClose:d,onClick:d,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:`${v.shape.borderRadius}px`,padding:v.spacing(1,1.5)})},children:a.jsxs(D0,{"aria-labelledby":m,children:[a.jsx(ve,{permission:u2,children:({hasAccess:v})=>a.jsxs(ce,{sx:p3,onClick:t,disabled:!v,children:[a.jsx(pe,{children:a.jsx(Fh,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"View events"})})]})}),a.jsx(ve,{permission:u2,children:({hasAccess:v})=>a.jsxs(ce,{sx:p3,onClick:n,disabled:!v,children:[a.jsx(pe,{children:a.jsx(Q3,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Edit"})})]})}),a.jsx(ve,{permission:u2,children:({hasAccess:v})=>a.jsxs(ce,{sx:p3,onClick:i,disabled:!v,children:[a.jsx(pe,{children:a.jsx(x3,{})}),a.jsx(se,{children:a.jsx(I,{variant:"body2",children:"Remove"})})]})})]})})]})},PS=u("div")(({theme:e})=>({marginTop:e.spacing(1),position:"relative"})),ES=u("div")(({theme:e})=>({padding:e.spacing(.75,1),fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:e.spacing(-2),left:e.spacing(2),lineHeight:1})),ZS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.default,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),paddingTop:e.spacing(1),borderRadius:e.shape.borderRadiusMedium})),Us=u("div")({display:"flex",alignItems:"center"}),IS=u(Us)(({theme:e})=>({justifyContent:"space-between",marginBottom:e.spacing(1)})),ks=({index:e,header:t,separator:n="AND",children:i})=>a.jsxs(PS,{children:[a.jsx(V,{condition:e>0,show:a.jsx(ES,{children:n})}),a.jsxs(ZS,{children:[a.jsx(IS,{children:t}),a.jsx(Us,{children:i})]})]}),MS=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M5 18C5 18.55 5.45 19 6 19H18C18.55 19 19 18.55 19 18C19 17.45 18.55 17 18 17H6C5.45 17 5 17.45 5 18ZM9.5 12.8H14.5L15.16 14.4C15.31 14.76 15.66 15 16.05 15C16.74 15 17.2 14.29 16.93 13.66L13.05 4.69C12.87 4.27 12.46 4 12 4C11.54 4 11.13 4.27 10.95 4.69L7.07 13.66C6.8 14.29 7.27 15 7.96 15C8.35 15 8.7 14.76 8.85 14.4L9.5 12.8ZM12 5.98L13.87 11H10.13L12 5.98Z"})),AS=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.10831 2.60839C3.71687 2.23054 3.09322 2.23475 2.70696 2.62102C2.31643 3.01154 2.31643 3.64471 2.70696 4.03523L8.65871 9.98698L7.07 13.6598C6.8 14.2898 7.27 14.9998 7.96 14.9998C8.35 14.9998 8.7 14.7598 8.85 14.3998L9.5 12.7998H11.4716L15.6716 16.9998H6C5.45 16.9998 5 17.4498 5 17.9998C5 18.5498 5.45 18.9998 6 18.9998H17.6716L19.6775 21.0058C20.068 21.3963 20.7012 21.3963 21.0917 21.0058C21.478 20.6195 21.4822 19.9959 21.1044 19.6044C21.1001 19.6003 21.0958 19.5961 21.0916 19.5919L4.12102 2.62132C4.11674 2.61704 4.1125 2.61273 4.10831 2.60839ZM16.1235 11.7954L13.05 4.68985C12.87 4.26985 12.46 3.99985 12 3.99985C11.54 3.99985 11.13 4.26985 10.95 4.68985L10.3666 6.03851L11.5408 7.21265L12 5.97985L13.0045 8.67635L16.1235 11.7954Z"})),qs=Bc($1)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",height:"auto",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,padding:"0 1px 0",marginRight:"1rem","&:hover":{background:e.palette.background.application},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),Ks=Bc($1)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main,borderRadius:e.shape.borderRadius,marginRight:"1rem",padding:"0 1px 0","&:hover":{color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),FS=({localConstraint:e,setCaseInsensitive:t})=>a.jsx(Y1,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:a.jsx(O,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(V,{condition:!!e.caseInsensitive,show:a.jsx(qs,{onClick:t,disableRipple:!0,children:a.jsx(AS,{})}),elseShow:a.jsx(Ks,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(MS,{})})})})}),RS=e=>h.createElement("svg",{width:24,height:10,viewBox:"0 0 24 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M20.9238 0.46875V9H19.1719V0.46875H20.9238ZM23.5488 0.46875V1.8457H16.5879V0.46875H23.5488Z"}),h.createElement("path",{d:"M16.2422 4.53516V4.93945C16.2422 5.58789 16.1543 6.16992 15.9785 6.68555C15.8027 7.20117 15.5547 7.64062 15.2344 8.00391C14.9141 8.36328 14.5312 8.63867 14.0859 8.83008C13.6445 9.02148 13.1543 9.11719 12.6152 9.11719C12.0801 9.11719 11.5898 9.02148 11.1445 8.83008C10.7031 8.63867 10.3203 8.36328 9.99609 8.00391C9.67188 7.64062 9.41992 7.20117 9.24023 6.68555C9.06445 6.16992 8.97656 5.58789 8.97656 4.93945V4.53516C8.97656 3.88281 9.06445 3.30078 9.24023 2.78906C9.41602 2.27344 9.66406 1.83398 9.98438 1.4707C10.3086 1.10742 10.6914 0.830078 11.1328 0.638672C11.5781 0.447266 12.0684 0.351562 12.6035 0.351562C13.1426 0.351562 13.6328 0.447266 14.0742 0.638672C14.5195 0.830078 14.9023 1.10742 15.2227 1.4707C15.5469 1.83398 15.7969 2.27344 15.9727 2.78906C16.1523 3.30078 16.2422 3.88281 16.2422 4.53516ZM14.4668 4.93945V4.52344C14.4668 4.07031 14.4258 3.67188 14.3438 3.32812C14.2617 2.98438 14.1406 2.69531 13.9805 2.46094C13.8203 2.22656 13.625 2.05078 13.3945 1.93359C13.1641 1.8125 12.9004 1.75195 12.6035 1.75195C12.3066 1.75195 12.043 1.8125 11.8125 1.93359C11.5859 2.05078 11.3926 2.22656 11.2324 2.46094C11.0762 2.69531 10.957 2.98438 10.875 3.32812C10.793 3.67188 10.752 4.07031 10.752 4.52344V4.93945C10.752 5.38867 10.793 5.78711 10.875 6.13477C10.957 6.47852 11.0781 6.76953 11.2383 7.00781C11.3984 7.24219 11.5938 7.41992 11.8242 7.54102C12.0547 7.66211 12.3184 7.72266 12.6152 7.72266C12.9121 7.72266 13.1758 7.66211 13.4062 7.54102C13.6367 7.41992 13.8301 7.24219 13.9863 7.00781C14.1426 6.76953 14.2617 6.47852 14.3438 6.13477C14.4258 5.78711 14.4668 5.38867 14.4668 4.93945Z"}),h.createElement("path",{d:"M7.70508 0.46875V9H5.94727L2.51953 3.28125V9H0.761719V0.46875H2.51953L5.95312 6.19336V0.46875H7.70508Z"})),LS=e=>h.createElement("svg",{width:24,height:36,viewBox:"25 12 24 30",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M44.2145 31H45.9238V23.8457H48.5488V22.4688H45.9238H44.1719H41.5879V23.8457H44.1719V30.9574L44.2145 31ZM39.1419 28.7274L40.3188 29.9043C40.3146 29.9095 40.3104 29.9147 40.3061 29.9198L46.2004 35.8141L44.8004 37.2141L38.5868 31.0005C38.2828 31.0783 37.9589 31.1172 37.6152 31.1172C37.0801 31.1172 36.5898 31.0215 36.1445 30.8301C35.7031 30.6387 35.3203 30.3633 34.9961 30.0039C34.6719 29.6406 34.4199 29.2012 34.2402 28.6855C34.0645 28.1699 33.9766 27.5879 33.9766 26.9395V26.5352C33.9766 26.4869 33.977 26.4391 33.978 26.3917L32.7051 25.1188V31H30.9473L27.5195 25.2812V31H25.7617V22.4688H27.5195L30.9531 28.1934V23.3668L26.4004 18.8141L27.8004 17.4141L34.5229 24.1366C34.5262 24.1305 34.5295 24.1244 34.5328 24.1183L35.8509 25.4364C35.8493 25.4442 35.8477 25.452 35.8461 25.4598L37.0004 26.6141L39.1328 28.7465C39.1359 28.7402 39.1389 28.7338 39.1419 28.7274ZM39.4614 26.247L41.1626 27.9481C41.2157 27.632 41.2422 27.2957 41.2422 26.9395V26.5352C41.2422 25.8828 41.1523 25.3008 40.9727 24.7891C40.7969 24.2734 40.5469 23.834 40.2227 23.4707C39.9023 23.1074 39.5195 22.8301 39.0742 22.6387C38.6328 22.4473 38.1426 22.3516 37.6035 22.3516C37.0684 22.3516 36.5781 22.4473 36.1328 22.6387C36.0682 22.6667 36.0048 22.6966 35.9427 22.7283L37.0488 23.8344C37.2187 23.7794 37.4036 23.752 37.6035 23.752C37.9004 23.752 38.1641 23.8125 38.3945 23.9336C38.625 24.0508 38.8203 24.2266 38.9805 24.4609C39.1406 24.6953 39.2617 24.9844 39.3438 25.3281C39.4087 25.6002 39.4479 25.9065 39.4614 26.247ZM37.281 29.6947L35.9324 28.346C36.0101 28.5994 36.112 28.82 36.2383 29.0078C36.3984 29.2422 36.5938 29.4199 36.8242 29.541C36.9642 29.6146 37.1165 29.6658 37.281 29.6947Z"})),VS=({localConstraint:e,setInvertedOperator:t})=>a.jsx(Y1,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:a.jsx(O,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(V,{condition:!!e.inverted,show:a.jsx(Ks,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(RS,{})}),elseShow:a.jsx(qs,{onClick:t,disableRipple:!0,children:a.jsx(LS,{})})})})}),NS=u("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular})),Gs=({children:e,...t})=>a.jsx(NS,{...t,children:e}),Qs=Yr()(e=>({valueChip:{margin:"0 0.5rem 0.5rem 0"},chipValue:{whiteSpace:"pre"},inputContainer:{display:"flex",alignItems:"center",[e.breakpoints.down(700)]:{flexDirection:"column",alignItems:"flex-start"}},inputInnerContainer:{minWidth:"300px",[e.breakpoints.down(700)]:{minWidth:"100%"}},input:{width:"100%",margin:"1rem 0"},button:{marginLeft:"1rem",[e.breakpoints.down(700)]:{marginLeft:0,marginBottom:"0.5rem"}},valuesContainer:{marginTop:"1rem"}})),WS=u(O)(({theme:e})=>({"&:has(*)":{marginTop:e.spacing(2)}})),zS="Enter",S7=({values:e,removeValue:t,setValues:n,error:i,setError:c})=>{const[s,o]=h.useState(""),{classes:l}=Qs(),{uiConfig:d,loading:m}=v1(),f=d.resourceLimits.constraintValues,v=g=>{g.key===zS&&(g.preventDefault(),p())},p=()=>{const g=YS([...e,...Lh(s)]);g.length>f?c(`constraints cannot have more than ${f} values`):g.length===0?c("values cannot be empty"):g.some(b=>b.length>100)?c("values cannot be longer than 100 characters"):(c(""),o(""),n(g))};return a.jsxs(a.Fragment,{children:[a.jsx(Gs,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),a.jsxs("div",{className:l.inputContainer,children:[a.jsx("div",{className:l.inputInnerContainer,children:a.jsx(w3,{onKeyPress:v,label:"Values",name:"values",value:s,onFocus:()=>{c("")},onChange:g=>o(g.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!i,errorText:i,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),a.jsx(c1,{className:l.button,variant:"outlined",color:"primary",onClick:p,"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",disabled:m,children:"Add values"})]}),a.jsx("div",{className:l.valuesContainer,children:a.jsx(BS,{values:e,removeValue:t})}),a.jsx(WS,{children:a.jsx(bc,{name:"single constraint values",shortName:"values",currentValue:e.length,limit:f})})]})},BS=({values:e,removeValue:t})=>{const{classes:n}=Qs();return a.jsx(a.Fragment,{children:e.map((i,c)=>a.jsx(Rc,{label:a.jsx(Rh,{text:i,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(c),className:n.valueChip,"data-testid":"CONSTRAINT_VALUES_CHIP"},`${i}-${c}`))})},YS=e=>Array.from(new Set(e)),HS=Yr()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),O7=({setValue:e,value:t,type:n,error:i,setError:c})=>{const{classes:s}=HS();return a.jsxs(a.Fragment,{children:[a.jsxs(Gs,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx("div",{className:s.singleValueContainer,children:a.jsx(w3,{label:n,name:"value",value:t||"",onChange:o=>{c(""),e(o.target.value.trim())},onFocus:()=>c(""),placeholder:`Enter a single ${n} value`,className:s.singleValueInput,error:!!i,errorText:i})})]})},US=({operator:e,localConstraint:t,setValue:n,setValues:i,setError:c,removeValue:s,error:o})=>{if(Vh(e))return a.jsx(S7,{values:t.values||[],removeValue:s,setValues:i,error:o,setError:c});if(jr(e))return a.jsx(S7,{values:t.values||[],removeValue:s,setValues:i,error:o,setError:c});if(Nh(e))return a.jsx(O7,{setValue:n,value:t.value,type:"number",error:o,setError:c});if(Wh(e))return a.jsx(O7,{setValue:n,value:t.value,type:"semver",error:o,setError:c})},kS=u("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),C7=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),D7=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),qS=u(zh)(({theme:e})=>({[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(.5)}})),KS=u(ce,{shouldForwardProp:e=>e!=="separator"})(({theme:e,separator:t})=>t?{position:"relative",overflow:"visible",marginTop:e.spacing(2),"&:before":{content:'""',display:"block",position:"absolute",top:e.spacing(-1),left:0,right:0,borderTop:"1px solid",borderTopColor:e.palette.divider}}:{}),GS=u("div")(({theme:e})=>({lineHeight:1.2})),QS=({options:e,value:t,onChange:n})=>{const[i,c]=h.useState(!1),s=l=>{n(l.target.value)},o=()=>a.jsxs(kS,{children:[a.jsx(C7,{children:t}),a.jsx(D7,{children:xr(t)})]});return a.jsxs(qS,{variant:"outlined",size:"small",fullWidth:!0,children:[a.jsx(Bh,{htmlFor:"operator-select",children:"Operator"}),a.jsx(Yh,{id:"operator-select",name:"operator",label:"Operator",value:t,open:i,onOpen:()=>c(!0),onClose:()=>c(!1),onChange:s,renderValue:o,children:e.map(l=>a.jsx(KS,{value:l,separator:JS(e,l),children:a.jsxs(GS,{children:[a.jsx(C7,{children:l}),a.jsx(D7,{children:xr(l)})]})},l))})]})},JS=(e,t)=>t===e[0]?!1:XS.some(n=>n[0]===t),XS=[Yc,Hc,Uc,Hh,kc],eO=u($1)({marginRight:"-6px"}),tO=u("div")({display:"flex",flexDirection:"column",width:"100%"}),nO=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"start",gap:e.spacing(2)}})),aO=u("div")(({theme:e})=>({width:"100%",display:"inline-flex",flex:1,gap:e.spacing(1)})),rO=u("div")(({theme:e})=>({width:"100%","&&& > div":{width:"100%"}})),$7=u("div")(({theme:e})=>({display:"inline-flex",flex:1,"&&& button":{marginRight:0,"&:not(.operator-is-active)":{backgroundColor:e.palette.background.elevation2}}})),iO=u("div")({width:"100%",flex:1});u(w3)({width:"100%"});const cO=u("div")(({theme:e})=>({"& > h3":{margin:e.spacing(1,0,0,0),fontSize:e.fontSizes.smallBody},"& > div":{margin:0,maxWidth:"unset","& > div":{flex:1},"& .MuiFormControl-root":{margin:e.spacing(.5,0,0,0)},"&:not(:first-of-type)":{marginTop:e.spacing(1)}}})),sO=({filter:e,index:t,stateChanged:n,suggestions:i,onDelete:c})=>{const{parameter:s,inverted:o,operator:l,caseInsensitive:d,value:m,values:f}=e,v=a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Filter ",t+1]}),a.jsx("div",{children:a.jsx(Y1,{title:"Delete filter",arrow:!0,children:a.jsx(eO,{onClick:c,children:a.jsx(x3,{})})})})]}),[p,g]=h.useState(!1),j=[...Yc,...Hc,...Uc,...kc],[b,_]=h.useState(""),x=Uh(l),w=()=>{if(n({...e,error:void 0}),m===void 0&&f===void 0)return;const S=f||[m||""],[R,z]=x(...S);R||(_(z),n({...e,error:z}))};h.useEffect(()=>{w()},[m,b]),h.useEffect(()=>{jr(l)?g(!0):g(!1)},[l]);const P=S=>{jr(S)?g(!0):g(!1),n({...e,operator:S})},C=S=>{n({...e,values:void 0,value:S})},D=S=>{n({...e,value:void 0,values:S})},W=S=>{const R=(f==null?void 0:f.filter((z,A)=>A!==S))||[];D(R)};return a.jsx(ks,{index:t,header:v,children:a.jsxs(tO,{children:[a.jsxs(nO,{children:[a.jsx(iO,{children:a.jsx(q2,{freeSolo:!0,options:i,value:s,onInputChange:(S,R)=>n({...e,parameter:R}),renderInput:S=>a.jsx(de,{...S,size:"small",label:"Parameter"})})}),a.jsxs(aO,{children:[a.jsx($7,{children:a.jsx(VS,{localConstraint:{inverted:o},setInvertedOperator:()=>n({...e,inverted:!o||void 0})})}),a.jsx(rO,{children:a.jsx(QS,{options:j,value:l,onChange:P})}),a.jsx(V,{condition:p,show:a.jsx($7,{children:a.jsx(FS,{localConstraint:{caseInsensitive:d},setCaseInsensitive:()=>n({...e,caseInsensitive:!d||void 0})})})})]})]}),a.jsx(cO,{children:a.jsx(US,{setValues:D,setValue:C,setError:_,localConstraint:{value:m,values:f},operator:l,error:b,removeValue:W})})]})})},oO=u("div")(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:e.spacing(2)})),lO=u("div")(({theme:e})=>({position:"absolute",right:0,fontSize:e.fontSizes.smallBody,[e.breakpoints.down("sm")]:{display:"none"}})),dO=u(O,{shouldForwardProp:e=>e!=="verticalConnector"})(({theme:e,verticalConnector:t})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,marginTop:t?0:e.spacing(3),padding:e.spacing(3),borderRadius:e.shape.borderRadiusMedium})),uO=u(q3)(({theme:e})=>({margin:"auto",width:1,height:e.spacing(3)})),Js=({name:e,verticalConnector:t,resourceLink:n,children:i})=>a.jsxs(a.Fragment,{children:[a.jsx(V,{condition:!!t,show:a.jsx(uO,{orientation:"vertical"})}),a.jsxs(dO,{verticalConnector:t,children:[a.jsxs(oO,{children:[a.jsx(z3,{color:"secondary",children:e}),a.jsx(lO,{children:n})]}),i]})]});var M5={},hO=ee;Object.defineProperty(M5,"__esModule",{value:!0});var Xs=M5.default=void 0,mO=hO(X1()),fO=a,pO=(0,mO.default)((0,fO.jsx)("path",{d:"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"}),"ArrowForwardIosSharp");Xs=M5.default=pO;const vO=h.lazy(()=>zc(()=>import("./ReactJSONEditor-BH7GX57b.js"),[])),gO=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(1.5),marginBottom:e.spacing(-.75),height:e.spacing(3)})),xO=u(Kr)({backgroundColor:"transparent",boxShadow:"none","&:before":{display:"none"}}),jO=u(qr)(({theme:e})=>({lineHeight:"1.5rem",padding:0,marginBottom:e.spacing(-2.25),fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,flexDirection:"row-reverse","& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(90deg)"}})),bO=u(Xs)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.fontSizes.smallBody})),yO=u(Gr)(({theme:e})=>({marginTop:e.spacing(2),padding:0})),_O=({payload:e})=>e?a.jsxs(xO,{children:[a.jsx(jO,{expandIcon:a.jsx($1,{children:a.jsx(bO,{titleAccess:"Toggle"})}),children:"Preview payload"}),a.jsx(yO,{children:a.jsx(h.Suspense,{fallback:null,children:a.jsx(vO,{content:{json:e},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]}):a.jsx(gO,{children:"No signals were received from this source yet."}),$r=(e={},t="")=>Object.entries(e).reduce((n,[i,c])=>{const s=t?`${t}.${i}`:i;return typeof c=="object"&&c!==null&&!Array.isArray(c)?Object.assign(n,$r(c,s)):Array.isArray(c)?c.forEach((o,l)=>{typeof o=="object"&&o!==null?Object.assign(n,$r(o,`${s}[${l}]`)):n[`${s}[${l}]`]=o}):n[s]=c,n},{}),wO=u(q3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),SO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),OO=u("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),CO=({sourceId:e,setSourceId:t,filters:n,setFilters:i,validateSourceId:c})=>{const{signalEndpoints:s,loading:o}=e5(),{signalEndpointSignals:l}=kh(e,1),d=()=>{const g=crypto.randomUUID();i(j=>[...j,{id:g,parameter:"",operator:qh}])},m=g=>{i(j=>j.map(b=>b.id===g.id?g:b))},f=h.useMemo(()=>o?[]:s.map(({id:g,name:j})=>({label:j,key:`${g}`})),[o,s]),{lastSourcePayload:v,filterSuggestions:p}=h.useMemo(()=>{var j;const g=(j=l[0])==null?void 0:j.payload;return{lastSourcePayload:g,filterSuggestions:Object.keys($r(g)||{}).sort()}},[l]);return a.jsxs(Js,{name:"When this",resourceLink:a.jsx(x1,{to:"/integrations/signals",children:"Create signal endpoint"}),children:[a.jsx(N3,{label:"Source",options:f,value:`${e}`,onChange:g=>{c(Number(g)),t(Number.parseInt(g,10))}}),a.jsx(V,{condition:!!e,show:a.jsx(_O,{payload:v})}),a.jsx(wO,{}),n.map((g,j)=>a.jsx(sO,{index:j,filter:g,stateChanged:m,suggestions:p,onDelete:()=>i(b=>b.filter(({id:_})=>_!==g.id))},g.id)),a.jsxs(OO,{children:[a.jsx(c1,{startIcon:a.jsx(e3,{}),onClick:d,variant:"outlined",color:"primary",children:"Add filter"}),a.jsx(A0,{htmlTooltip:!0,tooltip:a.jsxs(SO,{children:[a.jsx("p",{children:"Filters allow you to add conditions to the execution of the actions based on the source payload."}),a.jsx("p",{children:"If no filters are defined then the action will always be triggered from the selected source, no matter the payload."})]})})]})]})},DO=(e,t,n)=>{const i=`${t?`?project=${t}`:""}${n?`${t?"&":"?"}environment=${n}`:""}`,c=`api/admin/service-account/${e}/permissions${i}`,{data:s,error:o,mutate:l}=Qr(!!e,void 0,B1(c),$O);return h.useMemo(()=>({overview:s==null?void 0:s.overview,projectRoles:s==null?void 0:s.projectRoles,rootRole:s==null?void 0:s.rootRole,serviceAccount:s==null?void 0:s.serviceAccount,permissions:(s==null?void 0:s.permissions)||[],loading:!o&&!s,refetch:()=>l(),error:o}),[s,o,l])},$O=e=>fetch(e).then(me("Service account access overview")).then(t=>t.json()),TO=({label:e,value:t,onChange:n,options:i})=>a.jsx(q2,{options:i,autoHighlight:!0,autoSelect:!0,value:t,onInputChange:(c,s)=>n(s),renderInput:c=>a.jsx(de,{...c,size:"small",label:e})}),PO=({parameter:e,value:t,onChange:n})=>{const{label:i,type:c}=e;if(c==="select"){const{options:s}=e;return a.jsx(TO,{label:i,value:t,onChange:n,options:s})}return null},EO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),ZO=({value:e,onChange:t,actionConfigurations:n})=>{const i=(s,o)=>a.jsx("li",{...s,children:a.jsxs(EO,{children:[a.jsx("span",{children:o.label}),a.jsx("span",{children:o.description})]})}),c=[...n].map(([s,o])=>({key:s,...o}));return a.jsx(q2,{options:c,autoHighlight:!0,autoSelect:!0,value:c.find(({key:s})=>s===e)||null,onChange:(s,o)=>t(o?o.key:""),renderOption:i,getOptionLabel:({label:s})=>s,renderInput:s=>a.jsx(de,{...s,size:"small",label:"Action"})})},IO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",gap:e.spacing(2)})),T7=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"100%",flexWrap:"wrap"})),P7=u("div")(({theme:e})=>({flex:1,minWidth:e.spacing(25)})),MO=({action:e,index:t,stateChanged:n,actorId:i,onDelete:c,actionConfigurations:s,validated:o})=>{const{action:l,executionParams:d,error:m}=e,f=n1("projectId"),{permissions:v}=DO(i,f,d.environment),p=s.get(l),g=h.useMemo(()=>{const _=p==null?void 0:p.permissions,{environment:x}=d;return v.length===0||!_||!x?!0:_.some(w=>v.some(({permission:P,project:C,environment:D})=>P===w&&C===f&&D===x))},[p,v]);h.useEffect(()=>{n({...e,error:void 0}),((p==null?void 0:p.parameters.filter(({optional:x})=>!x).map(({name:x})=>x))||[]).some(x=>!d[x])&&n({...e,error:"Please fill all required fields."})},[p,d]);const j=a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Action ",t+1]}),a.jsx("div",{children:a.jsx(Y1,{title:"Delete action",arrow:!0,children:a.jsx($1,{onClick:c,children:a.jsx(x3,{})})})})]}),b=(p==null?void 0:p.parameters.filter(({type:_})=>_!=="hidden"))||[];return a.jsx(ks,{index:t,header:j,separator:"THEN",children:a.jsxs(IO,{children:[a.jsx(T7,{children:a.jsx(P7,{children:a.jsx(ZO,{value:l,onChange:_=>n({...e,action:_}),actionConfigurations:s})})}),a.jsx(V,{condition:b.length>0,show:a.jsx(T7,{children:b.map(_=>a.jsx(P7,{children:a.jsx(PO,{parameter:_,value:d[_.name],onChange:x=>n({...e,executionParams:{...d,[_.name]:x}})})},_.name))})}),a.jsx(V,{condition:o&&!!m,show:a.jsx(T1,{severity:"error",children:m})}),a.jsx(V,{condition:!g,show:a.jsx(T1,{severity:"error",children:"The selected service account does not have permissions to execute this action currently."})})]})})},AO={},FO=e=>{const{isEnterprise:t}=v1(),n=F3("automatedActions"),{data:i,error:c,mutate:s}=Qr(t()&&n,AO,B1(`api/admin/projects/${e}/actions/config`),RO);return h.useMemo(()=>({actionConfigurations:new Map(Object.entries(i||{})),loading:!c&&!i,refetch:()=>s(),error:c}),[i,c,s])},RO=e=>fetch(e).then(me("Actions configuration")).then(t=>t.json()),LO=u(q3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),VO=u("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),NO=({serviceAccounts:e,serviceAccountsLoading:t,actions:n,setActions:i,actorId:c,setActorId:s,validateActorId:o,validated:l})=>{const d=n1("projectId"),{actionConfigurations:m}=FO(d),f=g=>{const b={id:crypto.randomUUID(),action:"",sortOrder:n.map(_=>_.sortOrder).reduce((_,x)=>Math.max(_,x),0)+1,executionParams:{project:g}};i([...n,b])},v=g=>{i(j=>j.map(b=>b.id===g.id?g:b))},p=h.useMemo(()=>t?[]:e.map(g=>({label:g.name,key:`${g.id}`})),[t,e]);return a.jsxs(Js,{name:"Do these actions",verticalConnector:!0,resourceLink:a.jsx(x1,{to:"/admin/service-accounts",children:"Create service account"}),children:[a.jsx(N3,{label:"Service account",name:"service-account",options:p,value:`${c}`,onChange:g=>{o(Number(g)),s(Number.parseInt(g,10))}}),a.jsx(LO,{}),n.map((g,j)=>a.jsx(MO,{index:j,action:g,stateChanged:v,actorId:c,onDelete:()=>i(b=>b.filter(_=>_.id!==g.id)),actionConfigurations:m,validated:l},g.id)),a.jsx(VO,{children:a.jsx(c1,{startIcon:a.jsx(e3,{}),onClick:()=>f(d),variant:"outlined",color:"primary",children:"Add action"})})]})},WO=u(T1)(({theme:e})=>({marginBottom:e.spacing(4)})),zO=u("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),E7=u("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),Z7=u(w3)(()=>({width:"100%"})),BO=u(T1)(({theme:e})=>({marginTop:e.spacing(3)})),YO=({enabled:e,setEnabled:t,name:n,setName:i,description:c,setDescription:s,sourceId:o,setSourceId:l,filters:d,setFilters:m,actorId:f,setActorId:v,actions:p,setActions:g,errors:j,validateName:b,validateSourceId:_,validateActorId:x,validated:w})=>{const{serviceAccounts:P,loading:C}=Xc(),D=S=>{setTimeout(()=>S(),300)},W=w&&Object.values(j).some(Boolean);return a.jsxs("div",{children:[a.jsx(V,{condition:P.length===0,show:a.jsxs(WO,{color:"warning",children:[a.jsx("strong",{children:"Heads up!"})," In order to create an action you need to create a service account first. Please"," ",a.jsx(le,{to:"/admin/service-accounts",component:x1,children:"go ahead and create one"}),"."]})}),a.jsx(zO,{children:a.jsx(Kh,{checked:e,setChecked:t,children:"Action status"})}),a.jsx(E7,{children:"What is your new action name?"}),a.jsx(Z7,{autoFocus:!0,label:"Action name",error:!!j.name,errorText:j.name,value:n,onChange:S=>{b(S.target.value),i(S.target.value)},onBlur:S=>D(()=>b(S.target.value)),autoComplete:"off"}),a.jsx(E7,{children:"What is your new action description?"}),a.jsx(Z7,{label:"Action description",value:c,onChange:S=>s(S.target.value),autoComplete:"off"}),a.jsx(CO,{sourceId:o,setSourceId:l,filters:d,setFilters:m,validateSourceId:_}),a.jsx(NO,{serviceAccounts:P,serviceAccountsLoading:C,actions:p,setActions:g,actorId:f,setActorId:v,validateActorId:x,validated:w}),a.jsx(V,{condition:W,show:()=>a.jsx(BO,{severity:"error",icon:!1,children:a.jsx("ul",{children:Object.values(j).filter(Boolean).map(S=>a.jsx("li",{children:S},S))})})})]})},I7={name:void 0,source:void 0,filters:void 0,actor:void 0,actions:void 0},HO=e=>{const t=n1("projectId"),{actions:n}=I5(t),[i,c]=h.useState(!1),[s,o]=h.useState(""),[l,d]=h.useState(""),[m,f]=h.useState(0),[v,p]=h.useState([]),[g,j]=h.useState(0),[b,_]=h.useState([]),x=()=>{var E,L,y;c((e==null?void 0:e.enabled)??!0),o((e==null?void 0:e.name)||""),d((e==null?void 0:e.description)||""),f(((E=e==null?void 0:e.match)==null?void 0:E.sourceId)??0),p(Object.entries(((L=e==null?void 0:e.match)==null?void 0:L.payload)??{}).map(([T,{inverted:Y,operator:Q,caseInsensitive:a1,value:e1,values:X}])=>({id:crypto.randomUUID(),parameter:T,inverted:Y,operator:Q,caseInsensitive:a1,value:e1,values:X}))),j((e==null?void 0:e.actorId)??0),_(((y=e==null?void 0:e.actions)==null?void 0:y.map(T=>({id:crypto.randomUUID(),action:T.action,sortOrder:T.sortOrder,executionParams:T.executionParams})))??[]),D(!1),P(I7)};h.useEffect(()=>{x()},[e]);const[w,P]=h.useState(I7),[C,D]=h.useState(!1),W=E=>{P(L=>({...L,[E]:void 0}))},S=(E,L)=>{P(y=>({...y,[E]:L}))};h.useEffect(()=>{K(v)},[v]),h.useEffect(()=>{H(b)},[b]);const R=E=>!E.length,z=E=>n==null?void 0:n.some(({id:L,name:y})=>L!==(e==null?void 0:e.id)&&y===E),A=E=>E===0,M=E=>R(E)?(S("name","Name is required."),!1):z(E)?(S("name","Name must be unique."),!1):(W("name"),!0),k=E=>A(E)?(S("source","Source is required."),!1):(W("source"),!0),K=E=>E.some(({error:L})=>L)?(S("filters","One or more filters have errors."),!1):(W("filters"),!0),Z=E=>A(E)?(S("actor","Service account is required."),!1):(W("actor"),!0),H=E=>E.filter(({action:L})=>!!L).length===0?(S("actions","At least one action is required."),!1):(W("actions"),E.some(({error:L})=>L)?(S("actions","One or more actions have errors."),!1):(W("actions"),!0));return{enabled:i,setEnabled:c,name:s,setName:o,description:l,setDescription:d,sourceId:m,setSourceId:f,filters:v,setFilters:p,actorId:g,setActorId:j,actions:b,setActions:_,errors:w,setErrors:P,validated:C,validateName:M,validateSourceId:k,validateActorId:Z,validate:()=>{const E=M(s),L=k(m),y=K(v),T=Z(g),Y=H(b);return D(!0),E&&L&&y&&T&&Y},reloadForm:x}},UO=u("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),kO=u("h1")({fontWeight:"normal"}),qO=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),KO=u("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),GO=u(c1)(({theme:e})=>({marginLeft:e.spacing(3)})),QO=({action:e,open:t,setOpen:n,onOpenEvents:i})=>{const c=n1("projectId"),{refetch:s}=I5(c),{addActionSet:o,updateActionSet:l,loading:d}=Bs(c),{setToastData:m,setToastApiError:f}=O1(),{uiConfig:v}=v1(),{enabled:p,setEnabled:g,name:j,setName:b,description:_,setDescription:x,sourceId:w,setSourceId:P,filters:C,setFilters:D,actorId:W,setActorId:S,actions:R,setActions:z,errors:A,validateName:M,validateSourceId:k,validateActorId:K,validate:Z,validated:H,reloadForm:B}=HO(e);h.useEffect(()=>{B()},[t]);const E=e!==void 0,L=`${E?"Edit":"New"} action`,y={enabled:p,name:j,description:_,match:{source:"signal-endpoint",sourceId:w,payload:C.filter(Q=>Q.parameter.length>0).reduce((Q,{parameter:a1,inverted:e1,operator:X,caseInsensitive:t1,value:i1,values:r1})=>({...Q,[a1]:{inverted:e1,operator:X,caseInsensitive:t1,value:i1,values:r1}}),{})},actorId:W,actions:R.filter(({action:Q})=>!!Q).map(({action:Q,sortOrder:a1,executionParams:e1})=>({action:Q,sortOrder:a1,executionParams:e1}))},T=()=>`curl --location --request ${E?"PUT":"POST"} '${v.unleashUrl}/api/admin/projects/${c}/actions${E?`/${e.id}`:""}' \\
|
|
710
710
|
--header 'Authorization: INSERT_API_KEY' \\
|
|
711
711
|
--header 'Content-Type: application/json' \\
|
|
712
712
|
--data-raw '${JSON.stringify(y,void 0,2)}'`,Y=async Q=>{if(Q.preventDefault(),!!Z())try{E?await l(e.id,y):await o(y),m({text:`action ${E?"updated":"added"} successfully`,type:"success"}),s(),n(!1)}catch(a1){f(y1(a1))}};return a.jsx(ge,{open:t,onClose:()=>{n(!1)},label:L,children:a.jsxs(Xe,{loading:d,modal:!0,description:"Actions allow you to configure automations based on specific signals, like the ones originated from signal endpoints.",documentationLink:"https://docs.getunleash.io/concepts/actions",documentationLinkLabel:"Actions documentation",formatApiCode:T,children:[a.jsxs(UO,{children:[a.jsx(kO,{children:L}),a.jsx(V,{condition:E,show:a.jsx(le,{onClick:i,children:"View events"})})]}),a.jsxs(qO,{onSubmit:Y,children:[a.jsx(YO,{enabled:p,setEnabled:g,name:j,setName:b,description:_,setDescription:x,sourceId:w,setSourceId:P,filters:C,setFilters:D,actorId:W,setActorId:S,actions:R,setActions:z,errors:A,validateName:M,validateSourceId:k,validateActorId:K,validated:H}),a.jsxs(KO,{children:[a.jsxs(c1,{type:"submit",variant:"contained",color:"primary",children:[E?"Save":"Add"," action"]}),a.jsx(GO,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},JO=({action:e,open:t,setOpen:n,onConfirm:i})=>a.jsx(he,{title:"Delete action?",open:t,primaryButtonText:"Delete action",secondaryButtonText:"Cancel",onClick:()=>i(e),onClose:()=>{n(!1)},children:a.jsxs("p",{children:["You are about to delete action: ",a.jsx("strong",{children:e==null?void 0:e.name})]})}),XO=u(K2)(({theme:e})=>({color:e.palette.success.main})),eC=u(Jr)(({theme:e})=>({color:e.palette.error.main})),tC=({state:e})=>e==="success"?a.jsx(XO,{}):e==="failed"?a.jsx(eC,{}):a.jsx(Xr,{size:20}),nC=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),aC=u("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),rC=u("h1")({fontWeight:"normal"}),iC=u("form")({display:"flex",flexDirection:"column",height:"100%"}),cC=u("div")(({theme:e})=>({backgroundColor:e.palette.error.light})),sC=u("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),oC=({action:e,open:t,setOpen:n,onOpenConfiguration:i})=>{const c=n1("projectId"),{locationSettings:s}=G3(),{actionEvents:o,hasMore:l,loadMore:d,loading:m}=Ys(e==null?void 0:e.id,c,20,{refreshInterval:5e3});if(!e)return null;const f=`Events: ${e.name}`;return a.jsx(ge,{open:t,onClose:()=>{n(!1)},label:f,children:a.jsxs(Xe,{loading:m&&o.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[a.jsx(nC,{children:a.jsxs(aC,{children:[a.jsx(rC,{children:f}),a.jsx(le,{onClick:i,children:"View configuration"})]})}),a.jsxs(iC,{children:[a.jsx(Gh,{height:960,items:o,columns:[{header:"Status",align:"center",maxWidth:100,cell:tC},{header:"Date",maxWidth:240,cell:({createdAt:v})=>E0(v,s==null?void 0:s.locale)}],sidePanelHeader:"Details",renderContent:Hs,renderItem:({id:v,state:p},g)=>p==="failed"?a.jsx(cC,{children:g},v):g,listEnd:a.jsx(V,{condition:l,show:a.jsx(c1,{onClick:d,children:"Load more"})})}),a.jsx(V,{condition:o.length===0,show:a.jsx("p",{children:"No events have been registered for this action set."})}),a.jsx(sC,{children:a.jsx(c1,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},lC=({modalOpen:e,setModalOpen:t,selectedAction:n,setSelectedAction:i})=>{const{setToastData:c,setToastApiError:s}=O1(),o=n1("projectId"),{actions:l,refetch:d}=I5(o),{toggleActionSet:m,removeActionSet:f}=Bs(o),{signalEndpoints:v}=e5(),{serviceAccounts:p}=Xc(),[g,j]=h.useState(!1),[b,_]=h.useState(!1),x=async(M,k)=>{try{await m(M.id,k),c({text:`"${M.name}" has been ${k?"enabled":"disabled"}`,type:"success"}),d()}catch(K){s(y1(K))}},w=async M=>{try{await f(M.id),c({text:`"${M.name}" has been deleted`,type:"success"}),d(),_(!1)}catch(k){s(y1(k))}},P=Q1(S0.breakpoints.down("sm")),C=Q1(S0.breakpoints.down("lg")),D=h.useMemo(()=>[{Header:"Name",accessor:"name",minWidth:60,Cell:({row:{original:M}})=>a.jsx(M0,{title:M.name,subtitle:M.description,onClick:()=>{i(M),t(!0)}})},{id:"source",Header:"Source",Cell:({row:{original:M}})=>a.jsx(qw,{action:M,signalEndpoints:v})},{id:"filters",Header:"Filters",Cell:({row:{original:M}})=>a.jsx(Gw,{action:M}),maxWidth:90},{id:"actor",Header:"Service account",Cell:({row:{original:M}})=>a.jsx(Qw,{action:M,serviceAccounts:p}),minWidth:160},{id:"actions",Header:"Actions",Cell:({row:{original:M}})=>a.jsx(DS,{action:M,onCreateAction:()=>{i(M),t(!0)}}),maxWidth:130},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:M}})=>a.jsx(Qh,{checked:M.enabled,setChecked:k=>x(M,k)}),sortType:"boolean",width:90,maxWidth:90},{id:"table-actions",Header:"",align:"center",Cell:({row:{original:M}})=>a.jsx(TS,{actionId:M.id,onOpenEvents:()=>{i(M),j(!0)},onEdit:()=>{i(M),t(!0)},onDelete:()=>{i(M),_(!0)}}),width:50,disableSortBy:!0}],[v,p]),[W]=h.useState({sortBy:[{id:"name",desc:!0}]}),{headerGroups:S,rows:R,prepareRow:z,setHiddenColumns:A}=k1.useTable({columns:D,data:l,initialState:W,sortTypes:Z0,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:Z1}},k1.useSortBy,k1.useFlexLayout);return B2([{condition:C,columns:["actor","enabled"]},{condition:P,columns:["filters","actions"]}],A,D),a.jsxs(a.Fragment,{children:[a.jsx(Ur,{rows:R,headerGroups:S,prepareRow:z}),a.jsx(V,{condition:R.length===0,show:a.jsx(re,{children:"No actions available. Get started by adding one."})}),a.jsx(QO,{action:n,open:e,setOpen:t,onOpenEvents:()=>{t(!1),j(!0)}}),a.jsx(oC,{action:n,open:g,setOpen:j,onOpenConfiguration:()=>{j(!1),t(!0)}}),a.jsx(JO,{action:n,open:b,setOpen:_,onConfirm:w})]})},dC=()=>{const e=n1("projectId"),t=je(e),{isEnterprise:n}=v1(),i=_1();fe(`Project actions – ${t}`);const[c,s]=h.useState(),[o,l]=h.useState(!1),d=()=>{s(void 0),l(!0)};return n()?a.jsx(A1,{header:a.jsx(S1,{title:"Actions",actions:a.jsx(F2,{onClick:d,maxWidth:`${i.breakpoints.values.sm}px`,Icon:e3,permission:w8,children:"New action"})}),children:a.jsx(Jh,{permissions:w8,children:a.jsx(lC,{modalOpen:o,setModalOpen:l,selectedAction:c,setSelectedAction:s})})}):a.jsx(A1,{header:a.jsx(S1,{title:"Actions"}),children:a.jsx(I0,{feature:"actions"})})},uC=()=>{const e=n1("projectId"),t=je(e),n=ne();return fe(`Project context fields – ${t}`),a.jsxs(_3,{children:[a.jsx(f1,{path:"create",element:a.jsx(ge,{open:!0,onClose:()=>n(oe),label:"Create segment",children:a.jsx(Xh,{modal:!0,onSubmit:()=>n(oe),onCancel:()=>n(oe)})})}),a.jsx(f1,{path:"edit/:name",element:a.jsx(ge,{open:!0,onClose:()=>n(oe),label:"Edit context field",children:a.jsx(em,{modal:!0})})}),a.jsx(f1,{path:"*",element:a.jsx(tm,{})})]})},M7=u(O)({marginLeft:"auto",display:"flex",alignItems:"center"}),hC=()=>{var m;const e=qc(),{isPro:t,isEnterprise:n}=v1(),i=ne(),c=F3("automatedActions"),s=F3("projectContextFields"),o=(...f)=>t()||n()?f:[],l=[...o({id:"",label:"Project settings"},{id:"access",label:"User access"}),{id:"api-access",label:"API access"},...s?[{id:"context",label:"Context fields"}]:[],{id:"segments",label:"Segments"},{id:"environments",label:"Environments"},{id:"default-strategy",label:"Default strategy"},...o({id:"change-requests",label:"Change request configuration",endIcon:t()?a.jsx(M7,{children:a.jsx(br,{})}):void 0})];c&&l.push({id:"actions",label:"Actions",endIcon:t()?a.jsx(M7,{children:a.jsx(br,{})}):void 0});const d=f=>{i(f.id)};return a.jsx(nm,{tabs:l,value:((m=l.find(({id:f})=>{var v;return f&&((v=e.pathname)==null?void 0:v.includes(`/settings/${f}`))}))==null?void 0:m.id)||l[0].id,onChange:d,children:a.jsxs(_3,{children:[a.jsx(f1,{path:"/*",element:a.jsx(zw,{})}),a.jsx(f1,{path:"environments/*",element:a.jsx(b_,{})}),a.jsx(f1,{path:"access/*",element:a.jsx(t_,{})}),s&&a.jsx(f1,{path:"context/*",element:a.jsx(uC,{})}),a.jsx(f1,{path:"segments/*",element:a.jsx(D_,{})}),a.jsx(f1,{path:"change-requests/*",element:a.jsx(w_,{})}),a.jsx(f1,{path:"api-access/*",element:a.jsx(C_,{})}),a.jsx(f1,{path:"default-strategy/*",element:a.jsx(H_,{})}),a.jsx(f1,{path:"actions/*",element:a.jsx(dC,{})}),a.jsx(f1,{path:"*",element:a.jsx(Kc,{replace:!0,to:l[0].id})})]})})},mC=u(am)(({theme:e})=>({color:e.palette.action.disabled})),fC=()=>a.jsx(M3,{title:`This projects collaboration mode is set to private. The project and associated feature
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jv as w,jw as K,jx as v,jy as V,jz as Y,jA as Z,jB as D,jC as p,jD as Q,jE as W,jo as O,jF as ee,jG as re,b as te,bq as ae,r as ie,j as ne,js as oe,jl as se,jm as le,jn as ue,jH as de,jq as fe,jr as ve,jI as he,jJ as ye}from"./index-
|
|
1
|
+
import{jv as w,jw as K,jx as v,jy as V,jz as Y,jA as Z,jB as D,jC as p,jD as Q,jE as W,jo as O,jF as ee,jG as re,b as te,bq as ae,r as ie,j as ne,js as oe,jl as se,jm as le,jn as ue,jH as de,jq as fe,jr as ve,jI as he,jJ as ye}from"./index-Cz4lAJ3Y.js";/*!
|
|
2
2
|
* chartjs-plugin-datalabels v2.2.0
|
|
3
3
|
* https://chartjs-plugin-datalabels.netlify.app
|
|
4
4
|
* (c) 2017-2022 chartjs-plugin-datalabels contributors
|
package/frontend/build/static/{LineChartComponent-p_JFdSdE.js → LineChartComponent-DA6kG8Ei.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jK as g,jL as u,s as x,b as j,bq as y,r as p,j as i,jM as b,jN as m,C,jO as S,jP as h,jQ as f,jl as L,jm as R,jn as w,jE as A,jR as E,jH as T,jq as k,jr as v,jI as M,jJ as _}from"./index-
|
|
1
|
+
import{jK as g,jL as u,s as x,b as j,bq as y,r as p,j as i,jM as b,jN as m,C,jO as S,jP as h,jQ as f,jl as L,jm as R,jn as w,jE as A,jR as E,jH as T,jq as k,jr as v,jI as M,jJ as _}from"./index-Cz4lAJ3Y.js";const q={position:"bottom",labels:{boxWidth:12,padding:30,generateLabels:t=>{var l;const s=t.data.datasets,{labels:{usePointStyle:e,pointStyle:o,textAlign:r,color:d}}=((l=t==null?void 0:t.legend)==null?void 0:l.options)||{labels:{}};return t._getSortedDatasetMetas().map(n=>{const a=n.controller.getStyle(e?0:void 0);return{text:s[n.index].label,fillStyle:a.borderColor,fontColor:d,hidden:!n.visible,lineWidth:0,borderRadius:6,strokeStyle:a.borderColor,pointStyle:o||a.pointStyle,textAlign:r||a.textAlign,datasetIndex:n.index}})}}},D=(t,s,e,o)=>({responsive:!0,...o?{animation:{duration:0}}:{},plugins:{legend:{...q,display:!o},tooltip:{enabled:!1,position:"nearest",external:g(e)}},locale:s.locale,interaction:{intersect:!1,axis:"xy",mode:"nearest"},elements:{point:{radius:0,hitRadius:15}},color:t.palette.text.secondary,scales:{y:{beginAtZero:!0,type:"linear",grid:{color:t.palette.divider,borderColor:t.palette.divider},ticks:{color:t.palette.text.secondary,display:!o,precision:0}},x:{adapters:{date:{locale:u(s.locale)}},type:"time",time:{unit:"week",tooltipFormat:"P"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:t.palette.text.secondary,display:!o,source:"data",maxRotation:90,minRotation:23.5}}}}),F=x("div")(({theme:t})=>({position:"relative"}));function H(t){return _.all(t.filter(s=>s))}const O=({data:t,aspectRatio:s=2.5,cover:e,overrideOptions:o,TooltipComponent:r})=>{const d=j(),{locationSettings:l}=y(),[n,a]=p.useState(null),c=p.useMemo(()=>H([D(d,l,a,!!e),o??{}]),[d,l,a,o,e]);return i.jsxs(F,{children:[i.jsx(b,{options:c,data:t,plugins:[m({width:26})],height:100,width:100*s},e?"cover":"chart"),i.jsx(C,{condition:!e,show:r?i.jsx(S,{tooltip:n,children:i.jsx(r,{tooltip:n})}):i.jsx(h,{tooltip:n}),elseShow:i.jsx(f,{children:e!==!0?e:" "})})]})};L.register(R,w,A,E,T,k,v,M);export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cj as H,b7 as k,b9 as L,j as e,aV as $,C as p,R as m,T as C,L as y,aT as P,aU as D,f as M,bd as _,fY as E,aR as W,aS as z,i as G,r as f,dE as F,dF as B,s as N,A as J,n as K,m as Y,o as Q,q as X,jt as Z,aq as U,B as T,fg as I,ju as A,fh as b}from"./index-
|
|
1
|
+
import{cj as H,b7 as k,b9 as L,j as e,aV as $,C as p,R as m,T as C,L as y,aT as P,aU as D,f as M,bd as _,fY as E,aR as W,aS as z,i as G,r as f,dE as F,dF as B,s as N,A as J,n as K,m as Y,o as Q,q as X,jt as Z,aq as U,B as T,fg as I,ju as A,fh as b}from"./index-Cz4lAJ3Y.js";const ee=t=>fetch(t).then(L("ChangeRequest")).then(s=>s.json()),te=(t,s)=>{const r=s.map(i=>`feature=${i}`).join("&"),{data:n,error:a,mutate:o}=H([],k(`api/admin/projects/${t}/change-requests/scheduled?${r}`),ee);return{changeRequests:n,loading:!a&&!n,refetch:o,error:a}},S=()=>e.jsx(m,{severity:"warning",sx:{m:t=>t.spacing(2,0)},children:"Archiving flags with dependencies will also remove those dependencies."}),ne=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t?e.jsxs(m,{severity:"warning",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(C,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have usage from applications. If you archive these feature flags they will not be available to Client SDKs:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):null},q=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t&&t.length>1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(C,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have child features that depend on them and are not part of the archive operation. These parent features can not be archived:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):t&&t.length===1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(y,{to:r(t[0]),children:t[0]})," has child features that depend on it and are not part of the archive operation."]}):null},R=({changeRequests:t,projectId:s})=>t&&t.length>0?e.jsxs(m,{severity:"warning",sx:{m:r=>r.spacing(2,0)},children:[e.jsxs("p",{children:["This archive operation would conflict with"," ",t.length," scheduled change request(s). The change request(s) that would be affected by this are:"]}),e.jsx("ul",{children:t.map(({id:r,title:n})=>{const a=n?`#${r} (${n})`:`Change request #${r}`;return e.jsx("li",{children:e.jsx(y,{to:`/projects/${s}/change-requests/${r}`,target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:a})},r)})})]}):t===void 0?e.jsx(m,{severity:"warning",children:e.jsx("p",{children:"This archive operation might conflict with one or more scheduled change requests. If you complete it, those change requests can no longer be applied."})}):null,se=(t,s)=>{const n=P(t)(),{isChangeRequestConfiguredForReview:a}=D(t);return n&&a(n)&&s?"Add to change request":n&&a(n)?"Add change to draft":s?"Archive flags":"Archive flag"},ae=({projectId:t,featureIds:s,onSuccess:r,onError:n})=>{const{setToastData:a,setToastApiError:o}=M(),{archiveFeatureToggle:i}=_(),{archiveFeatures:c}=E(),{isChangeRequestConfiguredForReview:h}=D(t),{addChange:x}=W(),{refetch:u}=z(t),d=P(t),g=(s==null?void 0:s.length)>1,l=d(),v=async()=>{if(!l){console.error("No change request environment");return}await x(t,l,s.map(w=>({action:"archiveFeature",feature:w,payload:void 0}))),u(),a({type:"success",text:g?"Changes added to a draft":"Change added to a draft"})},j=async()=>{await i(t,s[0]),a({type:"success",text:"Feature flag archived"})},V=async()=>{await c(t,s),a({type:"success",text:"Feature flags archived"})};return async()=>{try{l&&h(l)?await v():g?await V():await j(),r()}catch(w){o(G(w)),n()}}},re=(t,s,r)=>{const[n,a]=f.useState(!0),[o,i]=f.useState([]),[c,h]=f.useState(!1),{verifyArchiveFeatures:x}=E();return f.useEffect(()=>{r&&x(s,t).then(u=>u.json()).then(({hasDeletedDependencies:u,parentsWithChildFeatures:d})=>{d.length===0?(a(!1),i(d)):(a(!0),i(d)),h(u)})},[JSON.stringify(t),r,s,i,a,h]),{disableArchive:n,offendingParents:o,hasDeletedDependencies:c}},ue=({isOpen:t,onClose:s,onConfirm:r,projectId:n,featureIds:a,featuresWithUsage:o})=>{const i=(a==null?void 0:a.length)>1,c=se(n,i),h=i?"Archive feature flags":"Archive feature flag",x=ae({projectId:n,featureIds:a,onSuccess(){r(),s()},onError(){s()}}),{changeRequests:u}=te(n,a),{disableArchive:d,offendingParents:g,hasDeletedDependencies:l}=re(a,n,t),v=g.length===0&&l;return e.jsx($,{onClick:x,open:t,onClose:s,primaryButtonText:c,secondaryButtonText:"Cancel",title:h,disabledPrimaryButton:d,children:e.jsx(p,{condition:i,show:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",e.jsx("strong",{children:a==null?void 0:a.length})," feature flags?"]}),e.jsx(p,{condition:!!(o&&(o==null?void 0:o.length)>0),show:e.jsx(ne,{ids:o,projectId:n})}),e.jsx(p,{condition:g.length>0,show:e.jsx(q,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(S,{})}),e.jsx(R,{changeRequests:u,projectId:n}),e.jsx(p,{condition:(a==null?void 0:a.length)<=5,show:e.jsx("ul",{children:a==null?void 0:a.map(j=>e.jsx("li",{children:j},j))})})]}),elseShow:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",i?"these feature flags":"this feature flag","?"]}),e.jsx(p,{condition:g.length>0,show:e.jsx(q,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(S,{})}),e.jsx(R,{changeRequests:u,projectId:n})]})})})},ie=(t,s)=>`/api/admin/projects/${t}/features/${s}/parents`,ge=(t,s)=>{const r=k(ie(t,s)),{data:n,loading:a,error:o}=F(r,()=>B(r,"Parent Options"));return{parentOptions:n,loading:a,error:o}},oe=(t,s)=>`/api/admin/projects/${t}/features/${s}/parent-variants`,O=(t,s)=>{const r=k(oe(t,s)),{data:n,loading:a,error:o}=F(r,()=>B(r,"Parent Variant Options"));return{parentVariantOptions:n||[],loading:a,error:o}},ce=N(J)(({theme:t})=>({marginTop:t.spacing(2),marginBottom:t.spacing(1.5)})),le=({project:t,parent:s,onSelect:r})=>{const{parentVariantOptions:n}=O(t,s),a=e.jsx(Q,{fontSize:"small"}),o=e.jsx(X,{fontSize:"small"});return e.jsx(ce,{id:"single-variant-options",options:n,renderOption:(i,c,{selected:h})=>e.jsxs("li",{...i,children:[e.jsx(K,{icon:a,checkedIcon:o,style:{marginRight:8},checked:h}),c]}),renderInput:i=>e.jsx(Y,{...i,placeholder:"Select variant"}),fullWidth:!0,onChange:(i,c)=>{r(String(c))}})},de=({projectId:t,featureId:s,isOpen:r,setIsOpen:n,onComplete:a})=>{const{markFeatureCompleted:o}=Z(),{parentVariantOptions:i}=O(t,s),[c,h]=f.useState("kept"),[x,u]=f.useState(void 0),{trackEvent:d}=U(),g=async()=>{const l=c==="kept-with-variant"?"kept":c;await o(s,t,{status:l,statusValue:x}),n(!1),a(),d("feature-lifecycle",{props:{eventType:"complete",status:l}})};return e.jsx($,{open:r,title:"Mark completed",onClose:()=>{n(!1)},disabledPrimaryButton:c==="kept-with-variant"&&x===null,onClick:g,primaryButtonText:"Mark completed",secondaryButtonText:"Cancel",children:e.jsxs(T,{children:[e.jsxs(T,{sx:{mt:2,mb:4},children:["Marking the feature ",e.jsx("b",{children:s})," as complete does not affect any configuration, but it moves the feature flag into it’s next life cycle stage and is an indication that you have learned what you needed in order to progress with the feature. It serves as a reminder to start cleaning up the feature flag and removing it from the code."]}),e.jsx(C,{sx:{mb:2},children:e.jsx("b",{children:"What was the outcome of this feature?"})}),e.jsxs(I,{"aria-label":"selected-value",name:"selected",sx:{gap:l=>l.spacing(.5)},onChange:(l,v)=>{h(v)},children:[e.jsx(A,{value:"kept",legal:{value:"We decided to keep the feature"},control:e.jsx(b,{})},"kept"),e.jsx(A,{value:"discarded",legal:{value:"We decided to discard the feature"},control:e.jsx(b,{})},"discarded"),e.jsx(p,{condition:i.length>0,show:e.jsx(A,{value:"kept-with-variant",legal:{value:"We decided to keep the feature variant",description:"Choose to specify which feature variant will be kept"},control:e.jsx(b,{})},"kept-with-variant")}),e.jsx(p,{condition:i.length>0&&c==="kept-with-variant",show:e.jsx(le,{parent:s,project:t,onSelect:l=>{u(l)}})})]})]})})};export{ue as F,de as M,ge as a,O as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as i,T as d,cV as h,b as x,r as u,j as t,R as m,gc as c,jS as y,jT as j,jU as f}from"./index-
|
|
1
|
+
import{s as i,T as d,cV as h,b as x,r as u,j as t,R as m,gc as c,jS as y,jT as j,jU as f}from"./index-Cz4lAJ3Y.js";import{u as b,N as v}from"./NetworkPrometheusAPIWarning-f1m-ZHgX.js";import{u as g}from"./unknownify-B7hmSXnj.js";const w=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),S=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),k=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),q=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),C=e=>e[0]*1e3>Date.now()-6e5,E=e=>{var a,s;const r=(e.values||[]).filter(l=>C(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:g((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},T=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},B=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:g((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(E).reduce(T,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},D=()=>{h("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>B(n),[n]);return r.length===0?t.jsxs(m,{severity:"warning",children:["No data available.",t.jsx(v,{})]}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(w,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(y,{darkmode:t.jsx(j,{}),lightmode:t.jsx(f,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(S,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(k,{children:o}),t.jsxs(A,{children:[a," req/s"]}),t.jsxs(q,{children:[s," app"]})]})}))})]})};export{D as NetworkOverview,D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ba as a,b8 as i,b7 as c,r as u,b9 as h,j as n}from"./index-
|
|
1
|
+
import{ba as a,b8 as i,b7 as c,r as u,b9 as h,j as n}from"./index-Cz4lAJ3Y.js";const f=(e={})=>{const{uiConfig:{prometheusAPIAvailable:r}}=a(),{data:t,error:s,mutate:o}=i(r,{},c("api/admin/metrics/rps"),l,e);return u.useMemo(()=>({metrics:t,loading:!s&&!t,refetch:()=>o(),error:s}),[t,s,o])},l=e=>fetch(e).then(h("Instance Metrics")).then(r=>r.json()),p=()=>{const{uiConfig:{prometheusAPIAvailable:e}}=a();return e?null:n.jsxs("p",{children:["This view requires the ",n.jsx("strong",{children:"PROMETHEUS_API"})," environment variable to be set. Refer to our"," ",n.jsx("a",{href:"https://docs.getunleash.io/concepts/network-view#data-source",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more information."]})};export{p as N,f as u};
|