unleash-server 4.20.3 → 4.20.4
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/frontend/build/index.html +1 -1
- package/frontend/build/static/{CreateProject-f5c561c6.js → CreateProject-29a2b285.js} +1 -1
- package/frontend/build/static/{Error-cf50f470.js → Error-934cc570.js} +1 -1
- package/frontend/build/static/{ExpandMore-fa515e9b.js → ExpandMore-c3e13d73.js} +1 -1
- package/frontend/build/static/{FeatureArchiveDialog-9726aebb.js → FeatureArchiveDialog-b5fc8177.js} +1 -1
- package/frontend/build/static/{FeatureMetricsChart-2099cc8f.js → FeatureMetricsChart-13ce1b57.js} +1 -1
- package/frontend/build/static/{FeatureViewLazyExport-251c75f0.js → FeatureViewLazyExport-1bee3351.js} +2 -2
- package/frontend/build/static/{LazyAdminExport-110237f4.js → LazyAdminExport-2f5a25ac.js} +2 -2
- package/frontend/build/static/{LazyProjectExport-22be702f.js → LazyProjectExport-dc65603b.js} +1 -1
- package/frontend/build/static/{NetworkOverview-fa11486d.js → NetworkOverview-8018cd89.js} +45 -45
- package/frontend/build/static/{NetworkTraffic-e401fa21.js → NetworkTraffic-84935c51.js} +1 -1
- package/frontend/build/static/{Playground-d443ad89.js → Playground-6d2eacce.js} +1 -1
- package/frontend/build/static/{StrategyItemContainer-6834f121.js → StrategyItemContainer-93cba46f.js} +1 -1
- package/frontend/build/static/{chartjs-adapter-date-fns.esm-25ba860d.js → chartjs-adapter-date-fns.esm-38d041f7.js} +1 -1
- package/frontend/build/static/{index-ad851f89.js → index-3132dba8.js} +1 -1
- package/frontend/build/static/{index-3efe35ce.js → index-66dec49c.js} +1 -1
- package/frontend/build/static/{index-a09b079f.js → index-c290f941.js} +2 -2
- package/frontend/build/static/{unknownify-a62439db.js → unknownify-86fd295b.js} +1 -1
- package/frontend/build/static/{useProjectRole-6f60c011.js → useProjectRole-b5b140d2.js} +1 -1
- package/package.json +1 -1
|
@@ -376,12 +376,12 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
|
|
|
376
376
|
--data-raw '${c}'`},cxe=`
|
|
377
377
|
An activation strategy will only run when a feature toggle is enabled and provides a way to control who will get access to the feature.
|
|
378
378
|
If any of a feature toggle's activation strategies returns true, the user will get access.
|
|
379
|
-
`,uxe="https://docs.getunleash.io/reference/activation-strategies",dxe="Strategies documentation",pxe=E("ul")({marginBottom:0}),fxe=E(on)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),hxe=({segment:e,open:t,onClose:n,strategies:r})=>T(cr,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[T("p",{children:["The following feature toggles are using the"," ",s("strong",{children:e.name})," segment for their strategies:"]}),s(pxe,{children:r==null?void 0:r.map(o=>s("li",{children:T(fxe,{to:sxe(o.projectId,o.featureName,o.environment,o.id),target:"_blank",rel:"noopener noreferrer",children:[o.featureName," ",mxe(o)]})},o.id))})]}),mxe=e=>e.strategyName?`(${kp(e.strategyName)})`:"",gxe=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,loading:i}=lSe(e.id),a=(o==null?void 0:o.length)===0;return i?null:s(X,{condition:a,show:s(dSe,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:s(hxe,{segment:e,open:t,onClose:n,strategies:o})})},vxe=({segment:e})=>{const{refetchSegments:t}=Dl(),{deleteSegment:n}=a2(),{setToastData:r,setToastApiError:o}=It(),[i,a]=f.useState(!1),l=async()=>{try{await n(e.id),await t(),r({type:"success",title:"Successfully deleted segment"})}catch(c){o(ht(c))}finally{a(!1)}};return T(Re,{children:[s(mr,{onClick:()=>a(!0),permission:_oe,tooltipProps:{title:"Remove segment"},"data-testid":`${zte}_${e.name}`,children:s(ti,{"data-loading":!0})}),s(X,{condition:i,show:()=>s(gxe,{segment:e,open:i,onClose:()=>a(!1),onRemove:l})})]})},yxe=({segment:e})=>{const t=ft();return s(mr,{onClick:()=>t(`/segments/edit/${e.id}`),permission:lC,tooltipProps:{title:"Edit segment"},children:s(ea,{"data-loading":!0})})},bxe=({segment:e})=>T(na,{children:[s(yxe,{segment:e}),s(vxe,{segment:e})]}),wxe=()=>{const{segments:e,loading:t}=Dl(),n=Er(Wc.breakpoints.down("md")),[r]=f.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),o=f.useMemo(()=>e??Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user"}),[e]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p,setHiddenColumns:h}=tn.useTable({initialState:r,columns:e$,data:o,sortTypes:ca,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:mf}},tn.useGlobalFilter,tn.useSortBy);return Mv([{condition:n,columns:["createdAt","createdBy"]}],h,e$),s(gr,{header:s(xn,{title:`Segments (${c.length})`,actions:T(Re,{children:[s(go,{initialValue:d,onChange:p}),s(xn.Divider,{}),s(nSe,{})]})}),isLoading:t,children:s(X,{condition:!t&&o.length===0,show:s(Zn,{children:s(sSe,{})}),elseShow:()=>T(Re,{children:[s(As,{value:d,children:T(za,{...i(),rowHeight:"standard",children:[s(Fa,{headerGroups:l}),s(Ma,{...a(),children:c.map(m=>(u(m),s(sa,{hover:!0,...m.getRowProps(),children:m.cells.map(y=>s(ta,{...y.getCellProps(),children:y.render("Cell")}))})))})]})}),s(X,{condition:c.length===0&&(d==null?void 0:d.length)>0,show:T(Zn,{children:["No segments found matching “",d,"”"]})})]})})})},e$=[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>s(zv,{icon:s(s3,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({value:e,row:{original:t}})=>s(mf,{value:e,subtitle:t.description})},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:Ep,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:e}})=>s(bxe,{segment:e})},{accessor:"description"}],Sxe=e=>fetch(e).then(Cn("Feature toggle archive")).then(t=>t.json()),xxe=e=>{const{data:t,error:n,mutate:r,isLoading:o}=gn(Ft(e?`/api/admin/archive/features/${e}`:"api/admin/features"),Sxe,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},Cxe=({onRevive:e,onDelete:t,project:n})=>T(na,{children:[s(mr,{onClick:e,projectId:n,permission:W3,tooltipProps:{title:"Revive feature toggle"},children:s(gte,{})}),s(mr,{permission:yoe,projectId:n,tooltipProps:{title:"Delete feature toggle"},onClick:t,children:s(ti,{})})]}),yD=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Un({propagateErrors:!0});return{reviveFeature:async a=>{const l=`api/admin/archive/revive/${a}`,c=t(l,{method:"POST"});return e(c.caller,c.id)},deleteFeature:async a=>{const l=`api/admin/archive/${a}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},Exe=({value:e})=>{const{locationSettings:t}=la(),n=sn();return e?s(fo,{children:s(Tt,{title:`Archived on: ${Vc(e,t.locale)}`,arrow:!0,children:s(ke,{noWrap:!0,variant:"body2","data-loading":!0,children:s(gC,{date:new Date(e),title:"",live:!1})})})}):s(fo,{children:s(ke,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},kxe=E("p")(({theme:e})=>({marginTop:e.spacing(3)})),Txe=E(_r)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),_xe=({deletedFeature:e,open:t,setOpen:n,refetch:r})=>{const[o,i]=f.useState(""),{setToastData:a,setToastApiError:l}=It(),{deleteFeature:c}=yD(),u=async()=>{try{if(!e)return;await c(e.name),await r(),a({type:"success",title:"Feature toggle deleted",text:`You have successfully deleted the ${e.name} feature toggle.`})}catch(h){l(ht(h))}finally{d()}},d=()=>{n(!1),i("")},p="delete-feature-toggle-confirmation-form";return T(cr,{title:"Delete feature toggle?",open:t,primaryButtonText:"Delete feature toggle",secondaryButtonText:"Cancel",onClick:u,onClose:d,disabledPrimaryButton:(e==null?void 0:e.name)!==o,formId:p,children:[T(Xt,{severity:"warning",children:[s("b",{children:"Warning!"})," Before you delete a feature toggle, make sure all in-code references to that feature toggle have been removed. Otherwise, a new feature toggle with the same name could activate the old code paths."]}),T(kxe,{children:["In order to delete this feature toggle, please enter its name in the text field below: ",s("strong",{children:e==null?void 0:e.name})]}),s("form",{id:p,children:s(Txe,{autoFocus:!0,onChange:h=>{i(h.currentTarget.value)},value:o,placeholder:"<feature toggle name>",label:"Feature toggle name"})})]})},Rxe=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:a})=>{const l=Er(Wc.breakpoints.down("md")),c=Er(Wc.breakpoints.down("lg")),{setToastData:u,setToastApiError:d}=It(),[p,h]=f.useState(!1),[m,y]=f.useState(),[v,b]=jp(),{reviveFeature:w}=yD(),[g,S]=f.useState(v.get("search")||""),C=f.useCallback(async G=>{try{await w(G),await n(),u({type:"success",title:"And we're back!",text:"The feature toggle has been revived."})}catch(Z){d(ht(Z))}},[n,w,d,u]),R=f.useMemo(()=>[{Header:"Seen",width:85,canSort:!0,Cell:oO,accessor:"lastSeenAt",align:"center"},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:lO,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:G,row:{original:Z}})=>s(mf,{value:G,subtitle:Z.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:Ep,sortType:"date"},{Header:"Archived",accessor:"archivedAt",width:150,Cell:Exe,sortType:"date"},...a?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:G})=>s(Os,{title:G,to:`/projects/${G}`})}],{Header:"State",accessor:"stale",Cell:fO,sortType:"boolean",maxWidth:120,filterName:"state",filterParsing:G=>G?"stale":"active"},{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:G}})=>s(Cxe,{project:G.project,onRevive:()=>C(G.name),onDelete:()=>{y(G),h(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[a]),{data:k,getSearchText:P,getSearchContext:O}=RC(R,g,e),L=f.useMemo(()=>t?wO:k,[k,t]),[I]=f.useState(()=>({sortBy:[{id:v.get("sort")||r.id,desc:v.has("order")?v.get("order")==="desc":r.desc}],hiddenColumns:["description"]})),{headerGroups:A,rows:M,state:{sortBy:F},prepareRow:j,setHiddenColumns:q}=tn.useTable({columns:R,data:L,initialState:I,sortTypes:ca,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1},tn.useFlexLayout,tn.useSortBy);return Mv([{condition:l,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],q,R),f.useEffect(()=>{if(t)return;const G={};G.sort=F[0].id,F[0].desc&&(G.order="desc"),g&&(G.search=g),b(G,{replace:!0}),o({id:F[0].id,desc:F[0].desc||!1})},[t,F,g]),T(gr,{isLoading:t,header:s(xn,{titleElement:`${i} (${M.length<L.length?`${M.length} of ${L.length}`:L.length})`,actions:s(go,{initialValue:g,onChange:S,hasFilters:!0,getSearchContext:O})}),children:[s(As,{value:P(g),children:s(uC,{rows:M,headerGroups:A,prepareRow:j})}),s(X,{condition:M.length===0,show:()=>s(X,{condition:(g==null?void 0:g.length)>0,show:T(Zn,{children:["No feature toggles found matching “",g,"”"]}),elseShow:s(Zn,{children:"None of the feature toggles were archived yet."})})}),s(_xe,{deletedFeature:m,open:p,setOpen:h,refetch:n})]})},Pxe={id:"createdAt"},{value:$xe,setValue:Ixe}=Dv("FeaturesArchiveTable:v1",Pxe),Axe=()=>{cO("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=xxe();return s(Rxe,{title:"Archive",archivedFeatures:e,loading:t,storedParams:$xe,setStoredParams:Ixe,refetch:n})},Oxe=f.lazy(()=>import("./Playground-d443ad89.js")),Lxe=E(rt)(({theme:e,selected:t})=>({"&.MuiButton-root":{cursor:"pointer",height:e.spacing(6.5),border:0,backgroundColor:t?e.palette.background.paper:"transparent",borderLeft:`${e.spacing(1)} solid ${t?e.palette.primary.main:"transparent"}`,borderRadius:e.shape.borderRadiusMedium,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",padding:e.spacing(2,4),fontSize:e.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},justifyContent:"space-between"})),Dxe=({label:e,selected:t,onClick:n})=>s(Lxe,{selected:Boolean(t),onClick:n,disableRipple:!0,disableElevation:!0,disableFocusRipple:!0,disableTouchRipple:!0,fullWidth:!0,children:e}),Nxe=E("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),Mxe=E("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),Bxe=E("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),Fxe=({tabs:e,value:t,onChange:n,children:r})=>T(Nxe,{children:[s(Bxe,{children:e.filter(o=>!o.hidden).map(o=>s(Dxe,{label:o.label,selected:o.id===t,onClick:()=>n(o)},o.id))}),s(Mxe,{children:r})]}),zxe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Un({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});try{await e(a.caller,a.id)}catch(l){throw l}},errors:n,loading:r}},jxe=E("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),Uxe=()=>{const[e,t]=f.useState(!1),{setToastData:n,setToastApiError:r}=It(),[o,i]=f.useState(!1),[a,l]=f.useState(),[c,u]=f.useState(""),[d,p]=f.useState(""),{changePassword:h}=zxe(),m=async y=>{if(y.preventDefault(),c===d){if(!o)l(zO);else{t(!0),l(void 0);try{await h({password:c,confirmPassword:d}),n({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(v){const b=ht(v);l(b),r(b)}}t(!1)}};return s(gr,{isLoading:e,header:"Change password",children:T(jxe,{children:[s(jO,{password:c,callback:i,"data-loading":!0}),s(Yc,{"data-loading":!0,label:"Password",name:"password",value:c,error:Boolean(a),helperText:a,autoComplete:"new-password",onChange:y=>u(y.target.value)}),s(Yc,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:d,autoComplete:"new-password",onChange:y=>p(y.target.value)}),s(WO,{"data-loading":!0,started:Boolean(c&&d),matchingPasswords:c===d}),s(rt,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:m,children:"Save"})]})})},Wxe=10,M2=e=>{const{data:t,error:n,mutate:r}=gn(Ft(e?`api/admin/user-admin/${e}/pat`:"api/admin/user/tokens"),Hxe);return{tokens:t?t.pats:void 0,loading:!n&&!t,refetchTokens:()=>r(),error:n}},Hxe=e=>fetch(e).then(Cn("Personal API Tokens")).then(t=>t.json()),bD=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Un({propagateErrors:!0});return{createPersonalAPIToken:async c=>{const u=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(c)});try{return await(await e(u.caller,u.id)).json()}catch(d){throw d}},deletePersonalAPIToken:async c=>{const u=t(`api/admin/user/tokens/${c}`,{method:"DELETE"});try{await e(u.caller,u.id)}catch(d){throw d}},createUserPersonalAPIToken:async(c,u)=>{const d=t(`api/admin/user-admin/${c}/pat`,{method:"POST",body:JSON.stringify(u)});try{return await(await e(d.caller,d.id)).json()}catch(p){throw p}},deleteUserPersonalAPIToken:async(c,u)=>{const d=t(`api/admin/user-admin/${c}/pat/${u}`,{method:"DELETE"});try{await e(d.caller,d.id)}catch(p){throw p}},errors:n,loading:r}},Vxe=e=>{const t=new Date(e);return Cp(t,"yyyy-MM-dd")},Gxe=e=>{const t=new Date(e);return Cp(t,"yyyy-MM-dd")+"T"+Cp(t,"HH:mm")},qxe=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:l,...c})=>{const u=t==="datetime"?Gxe:Vxe;return s(pn,{type:t==="datetime"?"datetime-local":"date",size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const h=QO(p.target.value);l(h??a)},FormHelperTextProps:{["data-testid"]:S3},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},t$=E("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Yxe=E(_r)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),Kxe=E("div")(({theme:e,custom:t})=>({display:"flex",alignItems:t?"start":"center",gap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start"}})),Xxe=E(hD)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Jxe=E(qxe)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Qxe=E(Xt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var wD=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(wD||{});const SD=[{key:"7d",days:7,label:"7 days"},{key:"30d",days:30,label:"30 days"},{key:"60d",days:60,label:"60 days"},{key:"never",label:"Never"},{key:"custom",label:"Custom"}],vw=e=>{const t=new Date,n=SD.find(({key:r})=>r===e);return e==="never"?t.setFullYear(t.getFullYear()+1e3):e==="custom"?t.setMinutes(t.getMinutes()+30):n!=null&&n.days&&t.setDate(t.getDate()+n.days),t},Zxe=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=la(),d=v=>{c(b=>({...b,[v]:void 0}))},p=(v,b)=>{c(w=>({...w,[v]:b}))};f.useEffect(()=>{d("expiresAt"),a(vw(r))},[r]);const h=v=>{d("description"),n&&!n(v)&&p("description","A token with that description already exists."),t(v)},m=r==="custom",y=i.getFullYear()>new Date().getFullYear()+100;return T(Re,{children:[s(t$,{children:"Describe what this token will be used for"}),s(Yxe,{autoFocus:!0,label:"Description",error:Boolean(l.description),errorText:l.description,value:e,onChange:v=>h(v.target.value),required:!0}),s(t$,{children:"Token expiration date"}),T(Kxe,{custom:m,children:[s(Xxe,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:v=>o(v.target.value),options:SD}),s(X,{condition:m,show:()=>s(Jxe,{label:"Date",value:i,onChange:v=>{d("expiresAt"),v<new Date&&p("expiresAt","Invalid date, must be in the future"),a(v)},min:new Date,error:Boolean(l.expiresAt),errorText:l.expiresAt,required:!0}),elseShow:s(X,{condition:y,show:T(ke,{variant:"body2",children:["The token will ",s("strong",{children:"never"})," ","expire!"]}),elseShow:()=>T(ke,{variant:"body2",children:["Token will expire on"," ",s("strong",{children:Vc(i,u.locale)})]})})})]}),s(X,{condition:y,show:s(Qxe,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},eCe=E("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),tCe=E("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),nCe=E(rt)(({theme:e})=>({marginLeft:e.spacing(3)})),Ch=wD["30DAYS"],rCe=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=M2(),{createPersonalAPIToken:i,loading:a}=bD(),{setToastApiError:l}=It(),{uiConfig:c}=Lt(),[u,d]=f.useState(""),[p,h]=f.useState(Ch),[m,y]=f.useState(vw(Ch)),[v,b]=f.useState({});f.useEffect(()=>{d(""),h(Ch),y(vw(Ch)),b({})},[e]);const w=()=>({description:u,expiresAt:m}),g=async P=>{P.preventDefault();try{const O=await i(w());n(O),o(),t(!1)}catch(O){l(ht(O))}},S=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
|
|
379
|
+
`,uxe="https://docs.getunleash.io/reference/activation-strategies",dxe="Strategies documentation",pxe=E("ul")({marginBottom:0}),fxe=E(on)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),hxe=({segment:e,open:t,onClose:n,strategies:r})=>T(cr,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[T("p",{children:["The following feature toggles are using the"," ",s("strong",{children:e.name})," segment for their strategies:"]}),s(pxe,{children:r==null?void 0:r.map(o=>s("li",{children:T(fxe,{to:sxe(o.projectId,o.featureName,o.environment,o.id),target:"_blank",rel:"noopener noreferrer",children:[o.featureName," ",mxe(o)]})},o.id))})]}),mxe=e=>e.strategyName?`(${kp(e.strategyName)})`:"",gxe=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,loading:i}=lSe(e.id),a=(o==null?void 0:o.length)===0;return i?null:s(X,{condition:a,show:s(dSe,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:s(hxe,{segment:e,open:t,onClose:n,strategies:o})})},vxe=({segment:e})=>{const{refetchSegments:t}=Dl(),{deleteSegment:n}=a2(),{setToastData:r,setToastApiError:o}=It(),[i,a]=f.useState(!1),l=async()=>{try{await n(e.id),await t(),r({type:"success",title:"Successfully deleted segment"})}catch(c){o(ht(c))}finally{a(!1)}};return T(Re,{children:[s(mr,{onClick:()=>a(!0),permission:_oe,tooltipProps:{title:"Remove segment"},"data-testid":`${zte}_${e.name}`,children:s(ti,{"data-loading":!0})}),s(X,{condition:i,show:()=>s(gxe,{segment:e,open:i,onClose:()=>a(!1),onRemove:l})})]})},yxe=({segment:e})=>{const t=ft();return s(mr,{onClick:()=>t(`/segments/edit/${e.id}`),permission:lC,tooltipProps:{title:"Edit segment"},children:s(ea,{"data-loading":!0})})},bxe=({segment:e})=>T(na,{children:[s(yxe,{segment:e}),s(vxe,{segment:e})]}),wxe=()=>{const{segments:e,loading:t}=Dl(),n=Er(Wc.breakpoints.down("md")),[r]=f.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),o=f.useMemo(()=>e??Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user"}),[e]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p,setHiddenColumns:h}=tn.useTable({initialState:r,columns:e$,data:o,sortTypes:ca,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:mf}},tn.useGlobalFilter,tn.useSortBy);return Mv([{condition:n,columns:["createdAt","createdBy"]}],h,e$),s(gr,{header:s(xn,{title:`Segments (${c.length})`,actions:T(Re,{children:[s(go,{initialValue:d,onChange:p}),s(xn.Divider,{}),s(nSe,{})]})}),isLoading:t,children:s(X,{condition:!t&&o.length===0,show:s(Zn,{children:s(sSe,{})}),elseShow:()=>T(Re,{children:[s(As,{value:d,children:T(za,{...i(),rowHeight:"standard",children:[s(Fa,{headerGroups:l}),s(Ma,{...a(),children:c.map(m=>(u(m),s(sa,{hover:!0,...m.getRowProps(),children:m.cells.map(y=>s(ta,{...y.getCellProps(),children:y.render("Cell")}))})))})]})}),s(X,{condition:c.length===0&&(d==null?void 0:d.length)>0,show:T(Zn,{children:["No segments found matching “",d,"”"]})})]})})})},e$=[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>s(zv,{icon:s(s3,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({value:e,row:{original:t}})=>s(mf,{value:e,subtitle:t.description})},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:Ep,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:e}})=>s(bxe,{segment:e})},{accessor:"description"}],Sxe=e=>fetch(e).then(Cn("Feature toggle archive")).then(t=>t.json()),xxe=e=>{const{data:t,error:n,mutate:r,isLoading:o}=gn(Ft(e?`/api/admin/archive/features/${e}`:"api/admin/features"),Sxe,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},Cxe=({onRevive:e,onDelete:t,project:n})=>T(na,{children:[s(mr,{onClick:e,projectId:n,permission:W3,tooltipProps:{title:"Revive feature toggle"},children:s(gte,{})}),s(mr,{permission:yoe,projectId:n,tooltipProps:{title:"Delete feature toggle"},onClick:t,children:s(ti,{})})]}),yD=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Un({propagateErrors:!0});return{reviveFeature:async a=>{const l=`api/admin/archive/revive/${a}`,c=t(l,{method:"POST"});return e(c.caller,c.id)},deleteFeature:async a=>{const l=`api/admin/archive/${a}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},Exe=({value:e})=>{const{locationSettings:t}=la(),n=sn();return e?s(fo,{children:s(Tt,{title:`Archived on: ${Vc(e,t.locale)}`,arrow:!0,children:s(ke,{noWrap:!0,variant:"body2","data-loading":!0,children:s(gC,{date:new Date(e),title:"",live:!1})})})}):s(fo,{children:s(ke,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},kxe=E("p")(({theme:e})=>({marginTop:e.spacing(3)})),Txe=E(_r)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),_xe=({deletedFeature:e,open:t,setOpen:n,refetch:r})=>{const[o,i]=f.useState(""),{setToastData:a,setToastApiError:l}=It(),{deleteFeature:c}=yD(),u=async()=>{try{if(!e)return;await c(e.name),await r(),a({type:"success",title:"Feature toggle deleted",text:`You have successfully deleted the ${e.name} feature toggle.`})}catch(h){l(ht(h))}finally{d()}},d=()=>{n(!1),i("")},p="delete-feature-toggle-confirmation-form";return T(cr,{title:"Delete feature toggle?",open:t,primaryButtonText:"Delete feature toggle",secondaryButtonText:"Cancel",onClick:u,onClose:d,disabledPrimaryButton:(e==null?void 0:e.name)!==o,formId:p,children:[T(Xt,{severity:"warning",children:[s("b",{children:"Warning!"})," Before you delete a feature toggle, make sure all in-code references to that feature toggle have been removed. Otherwise, a new feature toggle with the same name could activate the old code paths."]}),T(kxe,{children:["In order to delete this feature toggle, please enter its name in the text field below: ",s("strong",{children:e==null?void 0:e.name})]}),s("form",{id:p,children:s(Txe,{autoFocus:!0,onChange:h=>{i(h.currentTarget.value)},value:o,placeholder:"<feature toggle name>",label:"Feature toggle name"})})]})},Rxe=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:a})=>{const l=Er(Wc.breakpoints.down("md")),c=Er(Wc.breakpoints.down("lg")),{setToastData:u,setToastApiError:d}=It(),[p,h]=f.useState(!1),[m,y]=f.useState(),[v,b]=jp(),{reviveFeature:w}=yD(),[g,S]=f.useState(v.get("search")||""),C=f.useCallback(async G=>{try{await w(G),await n(),u({type:"success",title:"And we're back!",text:"The feature toggle has been revived."})}catch(Z){d(ht(Z))}},[n,w,d,u]),R=f.useMemo(()=>[{Header:"Seen",width:85,canSort:!0,Cell:oO,accessor:"lastSeenAt",align:"center"},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:lO,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:G,row:{original:Z}})=>s(mf,{value:G,subtitle:Z.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:Ep,sortType:"date"},{Header:"Archived",accessor:"archivedAt",width:150,Cell:Exe,sortType:"date"},...a?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:G})=>s(Os,{title:G,to:`/projects/${G}`})}],{Header:"State",accessor:"stale",Cell:fO,sortType:"boolean",maxWidth:120,filterName:"state",filterParsing:G=>G?"stale":"active"},{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:G}})=>s(Cxe,{project:G.project,onRevive:()=>C(G.name),onDelete:()=>{y(G),h(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[a]),{data:k,getSearchText:P,getSearchContext:O}=RC(R,g,e),L=f.useMemo(()=>t?wO:k,[k,t]),[I]=f.useState(()=>({sortBy:[{id:v.get("sort")||r.id,desc:v.has("order")?v.get("order")==="desc":r.desc}],hiddenColumns:["description"]})),{headerGroups:A,rows:M,state:{sortBy:F},prepareRow:j,setHiddenColumns:q}=tn.useTable({columns:R,data:L,initialState:I,sortTypes:ca,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1},tn.useFlexLayout,tn.useSortBy);return Mv([{condition:l,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],q,R),f.useEffect(()=>{if(t)return;const G={};G.sort=F[0].id,F[0].desc&&(G.order="desc"),g&&(G.search=g),b(G,{replace:!0}),o({id:F[0].id,desc:F[0].desc||!1})},[t,F,g]),T(gr,{isLoading:t,header:s(xn,{titleElement:`${i} (${M.length<L.length?`${M.length} of ${L.length}`:L.length})`,actions:s(go,{initialValue:g,onChange:S,hasFilters:!0,getSearchContext:O})}),children:[s(As,{value:P(g),children:s(uC,{rows:M,headerGroups:A,prepareRow:j})}),s(X,{condition:M.length===0,show:()=>s(X,{condition:(g==null?void 0:g.length)>0,show:T(Zn,{children:["No feature toggles found matching “",g,"”"]}),elseShow:s(Zn,{children:"None of the feature toggles were archived yet."})})}),s(_xe,{deletedFeature:m,open:p,setOpen:h,refetch:n})]})},Pxe={id:"createdAt"},{value:$xe,setValue:Ixe}=Dv("FeaturesArchiveTable:v1",Pxe),Axe=()=>{cO("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=xxe();return s(Rxe,{title:"Archive",archivedFeatures:e,loading:t,storedParams:$xe,setStoredParams:Ixe,refetch:n})},Oxe=f.lazy(()=>import("./Playground-6d2eacce.js")),Lxe=E(rt)(({theme:e,selected:t})=>({"&.MuiButton-root":{cursor:"pointer",height:e.spacing(6.5),border:0,backgroundColor:t?e.palette.background.paper:"transparent",borderLeft:`${e.spacing(1)} solid ${t?e.palette.primary.main:"transparent"}`,borderRadius:e.shape.borderRadiusMedium,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",padding:e.spacing(2,4),fontSize:e.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},justifyContent:"space-between"})),Dxe=({label:e,selected:t,onClick:n})=>s(Lxe,{selected:Boolean(t),onClick:n,disableRipple:!0,disableElevation:!0,disableFocusRipple:!0,disableTouchRipple:!0,fullWidth:!0,children:e}),Nxe=E("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),Mxe=E("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),Bxe=E("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),Fxe=({tabs:e,value:t,onChange:n,children:r})=>T(Nxe,{children:[s(Bxe,{children:e.filter(o=>!o.hidden).map(o=>s(Dxe,{label:o.label,selected:o.id===t,onClick:()=>n(o)},o.id))}),s(Mxe,{children:r})]}),zxe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Un({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});try{await e(a.caller,a.id)}catch(l){throw l}},errors:n,loading:r}},jxe=E("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),Uxe=()=>{const[e,t]=f.useState(!1),{setToastData:n,setToastApiError:r}=It(),[o,i]=f.useState(!1),[a,l]=f.useState(),[c,u]=f.useState(""),[d,p]=f.useState(""),{changePassword:h}=zxe(),m=async y=>{if(y.preventDefault(),c===d){if(!o)l(zO);else{t(!0),l(void 0);try{await h({password:c,confirmPassword:d}),n({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(v){const b=ht(v);l(b),r(b)}}t(!1)}};return s(gr,{isLoading:e,header:"Change password",children:T(jxe,{children:[s(jO,{password:c,callback:i,"data-loading":!0}),s(Yc,{"data-loading":!0,label:"Password",name:"password",value:c,error:Boolean(a),helperText:a,autoComplete:"new-password",onChange:y=>u(y.target.value)}),s(Yc,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:d,autoComplete:"new-password",onChange:y=>p(y.target.value)}),s(WO,{"data-loading":!0,started:Boolean(c&&d),matchingPasswords:c===d}),s(rt,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:m,children:"Save"})]})})},Wxe=10,M2=e=>{const{data:t,error:n,mutate:r}=gn(Ft(e?`api/admin/user-admin/${e}/pat`:"api/admin/user/tokens"),Hxe);return{tokens:t?t.pats:void 0,loading:!n&&!t,refetchTokens:()=>r(),error:n}},Hxe=e=>fetch(e).then(Cn("Personal API Tokens")).then(t=>t.json()),bD=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Un({propagateErrors:!0});return{createPersonalAPIToken:async c=>{const u=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(c)});try{return await(await e(u.caller,u.id)).json()}catch(d){throw d}},deletePersonalAPIToken:async c=>{const u=t(`api/admin/user/tokens/${c}`,{method:"DELETE"});try{await e(u.caller,u.id)}catch(d){throw d}},createUserPersonalAPIToken:async(c,u)=>{const d=t(`api/admin/user-admin/${c}/pat`,{method:"POST",body:JSON.stringify(u)});try{return await(await e(d.caller,d.id)).json()}catch(p){throw p}},deleteUserPersonalAPIToken:async(c,u)=>{const d=t(`api/admin/user-admin/${c}/pat/${u}`,{method:"DELETE"});try{await e(d.caller,d.id)}catch(p){throw p}},errors:n,loading:r}},Vxe=e=>{const t=new Date(e);return Cp(t,"yyyy-MM-dd")},Gxe=e=>{const t=new Date(e);return Cp(t,"yyyy-MM-dd")+"T"+Cp(t,"HH:mm")},qxe=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:l,...c})=>{const u=t==="datetime"?Gxe:Vxe;return s(pn,{type:t==="datetime"?"datetime-local":"date",size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const h=QO(p.target.value);l(h??a)},FormHelperTextProps:{["data-testid"]:S3},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},t$=E("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Yxe=E(_r)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),Kxe=E("div")(({theme:e,custom:t})=>({display:"flex",alignItems:t?"start":"center",gap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start"}})),Xxe=E(hD)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Jxe=E(qxe)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Qxe=E(Xt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var wD=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(wD||{});const SD=[{key:"7d",days:7,label:"7 days"},{key:"30d",days:30,label:"30 days"},{key:"60d",days:60,label:"60 days"},{key:"never",label:"Never"},{key:"custom",label:"Custom"}],vw=e=>{const t=new Date,n=SD.find(({key:r})=>r===e);return e==="never"?t.setFullYear(t.getFullYear()+1e3):e==="custom"?t.setMinutes(t.getMinutes()+30):n!=null&&n.days&&t.setDate(t.getDate()+n.days),t},Zxe=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=la(),d=v=>{c(b=>({...b,[v]:void 0}))},p=(v,b)=>{c(w=>({...w,[v]:b}))};f.useEffect(()=>{d("expiresAt"),a(vw(r))},[r]);const h=v=>{d("description"),n&&!n(v)&&p("description","A token with that description already exists."),t(v)},m=r==="custom",y=i.getFullYear()>new Date().getFullYear()+100;return T(Re,{children:[s(t$,{children:"Describe what this token will be used for"}),s(Yxe,{autoFocus:!0,label:"Description",error:Boolean(l.description),errorText:l.description,value:e,onChange:v=>h(v.target.value),required:!0}),s(t$,{children:"Token expiration date"}),T(Kxe,{custom:m,children:[s(Xxe,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:v=>o(v.target.value),options:SD}),s(X,{condition:m,show:()=>s(Jxe,{label:"Date",value:i,onChange:v=>{d("expiresAt"),v<new Date&&p("expiresAt","Invalid date, must be in the future"),a(v)},min:new Date,error:Boolean(l.expiresAt),errorText:l.expiresAt,required:!0}),elseShow:s(X,{condition:y,show:T(ke,{variant:"body2",children:["The token will ",s("strong",{children:"never"})," ","expire!"]}),elseShow:()=>T(ke,{variant:"body2",children:["Token will expire on"," ",s("strong",{children:Vc(i,u.locale)})]})})})]}),s(X,{condition:y,show:s(Qxe,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},eCe=E("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),tCe=E("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),nCe=E(rt)(({theme:e})=>({marginLeft:e.spacing(3)})),Ch=wD["30DAYS"],rCe=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=M2(),{createPersonalAPIToken:i,loading:a}=bD(),{setToastApiError:l}=It(),{uiConfig:c}=Lt(),[u,d]=f.useState(""),[p,h]=f.useState(Ch),[m,y]=f.useState(vw(Ch)),[v,b]=f.useState({});f.useEffect(()=>{d(""),h(Ch),y(vw(Ch)),b({})},[e]);const w=()=>({description:u,expiresAt:m}),g=async P=>{P.preventDefault();try{const O=await i(w());n(O),o(),t(!1)}catch(O){l(ht(O))}},S=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
|
|
380
380
|
--header 'Authorization: INSERT_API_KEY' \\
|
|
381
381
|
--header 'Content-Type: application/json' \\
|
|
382
382
|
--data-raw '${JSON.stringify(w(),void 0,2)}'`,C=P=>P.length,R=P=>!(r!=null&&r.some(O=>O.description===P)),k=C(u)&&R(u)&&m>new Date;return s(c2,{open:e,onClose:()=>{t(!1)},label:"Create personal API token",children:s(Nr,{loading:a,modal:!0,title:"Create personal API token",description:`Use personal API tokens to authenticate to the Unleash API as
|
|
383
383
|
yourself. A personal API token has the same access privileges as
|
|
384
|
-
your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:S,children:T(eCe,{onSubmit:g,children:[s("div",{children:s(Zxe,{description:u,setDescription:d,isDescriptionUnique:R,expiration:p,setExpiration:h,expiresAt:m,setExpiresAt:y,errors:v,setErrors:b})}),T(tCe,{children:[s(rt,{type:"submit",variant:"contained",color:"primary",disabled:!k,children:"Create token"}),s(nCe,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},oCe=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=M2(),{deletePersonalAPIToken:o}=bD(),{setToastData:i,setToastApiError:a}=It();return s(cr,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){a(ht(c))}},onClose:()=>{t(!1)},title:"Delete token?",children:T(ke,{children:['Any applications or scripts using this token "',s("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},iCe=E(Xt)(({theme:e})=>({marginBottom:e.spacing(3)})),aCe=({open:e,setOpen:t,token:n})=>T(cr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[s(iCe,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),s(ke,{variant:"body1",children:"Your token:"}),s(uD,{token:(n==null?void 0:n.secret)||""})]}),sCe=({value:e,live:t=!1,emptyText:n,title:r})=>{const{locationSettings:o}=la();if(!e)return s(fo,{children:n});const i=Vc(e,o.locale);return s(fo,{children:s(Tt,{title:(r==null?void 0:r(i))??i,arrow:!0,children:s(ke,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:s(gC,{date:new Date(e),live:t,title:""})})})})},lCe=E(Xt)(({theme:e})=>({marginBottom:e.spacing(3)})),cCe=E("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),uCe=E(ke)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),dCe=E(ke)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),pCe=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),fCe={id:"createdAt"},{value:n$,setValue:hCe}=Dv("PersonalAPITokensTable:v1",fCe),mCe=()=>{const e=sn(),t=Er(e.breakpoints.down("md")),n=Er(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=M2(),[i,a]=jp(),[l]=f.useState(()=>({sortBy:[{id:i.get("sort")||n$.id,desc:i.has("order")?i.get("order")==="desc":n$.desc}],globalFilter:i.get("search")||""})),[c,u]=f.useState(l.globalFilter),[d,p]=f.useState(!1),[h,m]=f.useState(!1),[y,v]=f.useState(!1),[b,w]=f.useState(),[g,S]=f.useState(),C=f.useMemo(()=>[{Header:"Description",accessor:"description",Cell:mf,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:j})=>new Date(j).getFullYear()>new Date().getFullYear()+100?s(fo,{children:"Never"}):s(Ep,{value:j}),sortType:"date",maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:Ep,sortType:"date",maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:sCe,sortType:"date",maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:j}})=>s(na,{children:s(Tt,{title:"Delete token",arrow:!0,describeChild:!0,children:s("span",{children:s(Qt,{onClick:()=>{S(j),v(!0)},children:s(ti,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,v]),{data:R,getSearchText:k,getSearchContext:P}=RC(C,c,r),O=f.useMemo(()=>(R==null?void 0:R.length)===0&&o?pCe:R,[R,o]),{headerGroups:L,rows:I,prepareRow:A,state:{sortBy:M},setHiddenColumns:F}=tn.useTable({columns:C,data:O,initialState:l,sortTypes:ca,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},tn.useSortBy,tn.useFlexLayout);return Mv([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],F,C),f.useEffect(()=>{const j={};j.sort=M[0].id,M[0].desc&&(j.order="desc"),c&&(j.search=c),a(j,{replace:!0}),hCe({id:M[0].id,desc:M[0].desc||!1})},[M,c,a]),T(gr,{isLoading:o,header:s(xn,{title:`Personal API tokens (${I.length<O.length?`${I.length} of ${O.length}`:O.length})`,actions:T(Re,{children:[s(X,{condition:!t,show:T(Re,{children:[s(go,{initialValue:c,onChange:u,getSearchContext:P}),s(xn.Divider,{})]})}),s(rt,{variant:"contained",color:"primary",disabled:r.length>=Wxe,onClick:()=>p(!0),children:"New token"})]}),children:s(X,{condition:t,show:s(go,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:P})})}),children:[s(lCe,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),s(As,{value:k(c),children:s(uC,{rows:I,headerGroups:L,prepareRow:A})}),s(X,{condition:I.length===0,show:s(X,{condition:(c==null?void 0:c.length)>0,show:T(Zn,{children:["No tokens found matching “",c,"”"]}),elseShow:T(cCe,{children:[s(uCe,{children:"You have no personal API tokens yet."}),s(dCe,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),s(rt,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),s(rCe,{open:d,setOpen:p,newToken:j=>{w(j),m(!0)}}),s(aCe,{open:h,setOpen:m,token:b}),s(oCe,{open:y,setOpen:v,token:g})]})},gCe=()=>{const{data:e,error:t,mutate:n}=gn(Ft("api/admin/user/profile"),vCe);return{profile:e,loading:!t&&!e,refetchProfile:()=>n(),error:t}},vCe=e=>fetch(e).then(Cn("Profile")).then(t=>t.json());var B2={},yCe=fn;Object.defineProperty(B2,"__esModule",{value:!0});var xD=B2.default=void 0,bCe=yCe(En()),wCe=kn,SCe=(0,bCe.default)((0,wCe.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"InfoOutlined");xD=B2.default=SCe;var F2={},xCe=fn;Object.defineProperty(F2,"__esModule",{value:!0});var CD=F2.default=void 0,CCe=xCe(En()),ECe=kn,kCe=(0,CCe.default)((0,ECe.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16.77c.68 0 1.23-.56 1.23-1.23V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-2-6H6v-2h12v2zm-4 4H6v-2h8v2z"}),"TopicOutlined");CD=F2.default=kCe;const TCe=E("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:e.spacing(6),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.primary.main,color:e.palette.text.tertiaryContrast,marginBottom:e.spacing(3),boxShadow:e.boxShadows.primaryHeader})),_Ce=E("div")(()=>({flexGrow:1})),RCe=E(ke)(({theme:e})=>({fontSize:e.spacing(3.75)})),PCe=E(tC)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),r$=E(ke)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),$Ce=E("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),ICe=E(bi)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),ACe=E("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),OCe=E(Da)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),LCe=E(Zp)(({theme:e})=>({backgroundColor:e.palette.inputLabelBackground})),DCe=({user:e})=>{const{profile:t}=gCe(),n=ft(),{locationSettings:r,setLocationSettings:o}=la(),[i,a]=f.useState(),[l,c]=f.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);f.useEffect(()=>{const d=l.find(p=>p.toLowerCase().includes(r.locale.toLowerCase()));a(d),d||c(p=>[...p,r.locale])},[r]);const u=d=>{const p=d.target.value;a(p),o({locale:p})};return T(Re,{children:[T(TCe,{children:[s(PCe,{user:e}),T(_Ce,{children:[s(RCe,{children:e.name||e.username}),s(ke,{variant:"body1",children:e.email})]})]}),T(gr,{children:[s(r$,{children:"Access"}),T($Ce,{children:[T(Je,{sx:{width:"50%"},children:[s(ke,{variant:"body2",children:"Your root role"}),s(Tt,{title:(t==null?void 0:t.rootRole.description)||"",arrow:!0,placement:"bottom-end",describeChild:!0,children:s(bi,{color:"success",icon:s(xD,{}),iconRight:!0,children:t==null?void 0:t.rootRole.name})})]}),T(Je,{children:[s(ke,{variant:"body2",children:"Projects"}),s(X,{condition:Boolean(t==null?void 0:t.projects.length),show:t==null?void 0:t.projects.map(d=>s(Tt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:s(ICe,{onClick:p=>{p.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:s(CD,{}),children:d})},d)),elseShow:s(Tt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:s(bi,{children:"No projects"})})})]})]}),s(ACe,{}),s(r$,{children:"Settings"}),s(ke,{variant:"body2",children:"This is the format used across the system for time and date"}),T(OCe,{variant:"outlined",size:"small",children:[s(LCe,{htmlFor:"locale-select",children:"Date/Time formatting"}),s(ef,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:l.map(d=>s("option",{value:d,children:d},d))})]})]})]})},NCe=()=>{const{user:e}=si(),t=ri(),n=ft(),r=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password"},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens"}],o=c=>{n(c.path?`/profile/${c.path}`:"/profile",{replace:!0}),l(c.id)},i=()=>{const c=t.pathname;return(r.find(({path:d})=>d&&c.includes(d))||r[0]).id},[a,l]=f.useState(i());return f.useEffect(()=>{l(i())},[t]),T(Fxe,{tabs:r,value:a,onChange:o,children:[s(X,{condition:a==="profile",show:s(DCe,{user:e})}),s(X,{condition:a==="password",show:s(Uxe,{})}),s(X,{condition:a==="pat",show:s(mCe,{})})]})},MCe=f.lazy(()=>import("./CreateProject-f5c561c6.js")),BCe=f.lazy(()=>import("./FeatureViewLazyExport-251c75f0.js")),FCe=f.lazy(()=>import("./LazyAdminExport-110237f4.js")),zCe=f.lazy(()=>import("./LazyProjectExport-22be702f.js")),jCe=()=>s(Il,{to:"/admin/users",replace:!0}),$p=[{path:"/splash/:splashId",title:"Unleash",component:Age,type:"protected",menu:{},isStandalone:!0},{path:"/projects/create",parent:"/projects",title:"Create",component:MCe,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/edit",parent:"/projects",title:":projectId",component:she,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/archived",title:":projectId",parent:"/archive",component:Lpe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/:activeTab/copy",parent:"/projects/:projectId/features/:featureId/:activeTab",title:"Copy",component:Lme,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/edit",parent:"/projects",title:"Edit feature",component:Bhe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/*",parent:"/projects",title:"FeatureView",component:BCe,type:"protected",menu:{}},{path:"/projects/:projectId/create-toggle",parent:"/projects/:projectId/features",title:"Create feature toggle",component:whe,type:"protected",menu:{}},{path:"/projects/:projectId/features2/:featureId",parent:"/features",title:":featureId",component:UR,type:"protected",menu:{}},{path:"/projects/:projectId/*",parent:"/projects",title:":projectId",component:zCe,flag:bde,type:"protected",menu:{}},{path:"/projects",title:"Projects",component:Ope,type:"protected",menu:{mobile:!0}},{path:"/features/:activeTab/:featureId",parent:"/features",title:":featureId",component:UR,type:"protected",menu:{}},{path:"/features",title:"Feature toggles",component:jle,type:"protected",menu:{mobile:!0}},{path:"/playground",title:"Playground",component:Oxe,hidden:!1,type:"protected",menu:{mobile:!0}},{path:"/applications/:name",title:":name",parent:"/applications",component:Hhe,type:"protected",menu:{}},{path:"/applications",title:"Applications",component:Vhe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/context/create",parent:"/context",title:"Create",component:Dge,type:"protected",menu:{}},{path:"/context/edit/:name",parent:"/context",title:":name",component:Ufe,type:"protected",menu:{}},{path:"/context",title:"Context fields",component:Yhe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/strategies/create",title:"Create",parent:"/strategies",component:hge,type:"protected",menu:{}},{path:"/strategies/:name/edit",title:":name",parent:"/strategies",component:gge,type:"protected",menu:{}},{path:"/strategies/:name",title:":name",parent:"/strategies",component:_ce,type:"protected",menu:{}},{path:"/strategies",title:"Strategy types",component:sue,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/environments/create",title:"Environments",component:xfe,parent:"/environments",type:"protected",menu:{}},{path:"/environments/:id",title:"Edit",component:kfe,type:"protected",menu:{}},{path:"/environments",title:"Environments",component:eSe,type:"protected",flag:wde,menu:{mobile:!0,advanced:!0}},{path:"/tag-types/create",parent:"/tag-types",title:"Create",component:Qfe,type:"protected",menu:{}},{path:"/tag-types/edit/:name",parent:"/tag-types",title:":name",component:Jfe,type:"protected",menu:{}},{path:"/tag-types",title:"Tag types",component:uue,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/addons/create/:providerId",parent:"/addons",title:"Create",component:Pme,type:"protected",menu:{}},{path:"/addons/edit/:addonId",parent:"/addons",title:"Edit",component:$me,type:"protected",menu:{}},{path:"/addons",title:"Addons",component:Sue,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/segments/create",title:"Segments",component:nwe,hidden:!1,type:"protected",layout:"main",menu:{},flag:N1},{path:"/segments/edit/:segmentId",title:"Segments",component:iwe,hidden:!1,type:"protected",layout:"main",menu:{},flag:N1},{path:"/segments",title:"Segments",component:wxe,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0},flag:N1},{path:"/history",title:"Event log",component:Jme,type:"protected",menu:{adminSettings:!0}},{path:"/archive",title:"Archived toggles",component:Axe,type:"protected",menu:{}},{path:"/admin",title:"Admin",component:jCe,hidden:!1,type:"protected",menu:{}},{path:"/admin/*",title:"Admin",component:FCe,hidden:!1,type:"protected",menu:{}},{path:"/profile/*",title:"Profile",component:NCe,type:"protected",menu:{}},{path:"/login",title:"Log in",component:yde,type:"unprotected",hidden:!0,menu:{},isStandalone:!0},{path:"/new-user",title:"New user",hidden:!0,component:Kde,type:"unprotected",menu:{},isStandalone:!0},{path:"/reset-password",title:"Reset password",hidden:!0,component:Qde,type:"unprotected",menu:{},isStandalone:!0},{path:"/forgotten-password",title:"Forgotten password",hidden:!0,component:ipe,type:"unprotected",menu:{},isStandalone:!0}],UCe=[{path:"/history",title:"Event log",menu:{adminSettings:!0}},{path:"/admin/users",title:"Users",menu:{adminSettings:!0}},{path:"/admin/groups",title:"Groups",menu:{adminSettings:!0},flag:xde},{path:"/admin/roles",title:"Project roles",flag:Sde,menu:{adminSettings:!0}},{path:"/admin/auth",title:"Single sign-on",menu:{adminSettings:!0}},{path:"/admin/instance",title:"Instance stats",menu:{adminSettings:!0}},{path:"/admin/service-accounts",title:"Service accounts",menu:{adminSettings:!0},flag:"serviceAccounts"},{path:"/admin/network/*",title:"Network",menu:{adminSettings:!0},flag:"networkView"},{path:"/admin/maintenance",title:"Maintenance",menu:{adminSettings:!0},flag:"maintenance"},{path:"/admin/cors",title:"CORS origins",flag:"embedProxyFrontend",menu:{adminSettings:!0}},{path:"/admin/admin-invoices",title:"Billing & invoices",menu:{adminSettings:!0,isEnterprise:!0}}],WCe=$p.filter(e=>!e.hidden),HCe=()=>{const e=WCe.filter(o=>o.menu.advanced),t=$p.filter(o=>o.menu.adminSettings),n=$p.filter(o=>o.menu.mobile),r={mainNavRoutes:e,adminRoutes:t,mobileRoutes:n};return()=>r},o$=e=>e.map(t=>({path:t.path,flag:t.flag,title:t.title,menu:t.menu,configFlag:t.configFlag})),VCe=HCe(),i$=E(BH)(({theme:e})=>({backgroundColor:e.palette.headerBackground,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300})),a$=E(cq)(({theme:e})=>({display:"flex",alignItems:"center",maxWidth:1280,[e.breakpoints.down("md")]:{padding:"0"}})),s$=E("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),GCe=E("nav")({display:"flex",alignItems:"center",flexGrow:1}),qCe=E(Ure)({width:"150px"}),YCe=E(jre)({width:"150px"}),KCe=E("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}})),XCe=E("button")(({theme:e})=>({border:"none",background:"transparent",height:"100%",display:"flex",fontSize:e.fontSizes.bodySize,fontFamily:e.typography.fontFamily,alignItems:"center",color:"inherit",cursor:"pointer"})),l$=e=>({color:e.palette.neutral.main}),Eh=E(on)(({theme:e})=>Pv(e)),JCe=E(Qt)(({theme:e})=>({...Pv(e),borderRadius:100})),QCe=()=>{const{onSetThemeMode:e,themeMode:t}=y3(),n=sn(),r=Ss(),o=Ss(),[i,a]=f.useState(null),[l,c]=f.useState(null),[u,d]=f.useState(!1),{permissions:p}=WC(),{uiConfig:h,isOss:m}=Lt(),y=Er(n.breakpoints.down("md")),[v,b]=f.useState(!1),w=()=>b(P=>!P),g=()=>a(null),S=()=>c(null);f.useEffect(()=>{(p==null?void 0:p.find(O=>O.permission===xi))&&d(!0)},[p]);const C=VCe(),R=P=>!P.menu.isEnterprise||!m(),k={mainNavRoutes:o$(C.mainNavRoutes).concat([{path:"/admin/api",title:"API access",menu:{}}]).filter(z1(h)),mobileRoutes:o$(C.mobileRoutes).filter(z1(h)),adminRoutes:UCe.filter(z1(h)).filter(R).map(P=>({...P,path:P.path.replace("/*","")}))};return y?s(i$,{position:"static",children:T(a$,{children:[s(Tt,{title:"Menu",arrow:!0,children:s(Qt,{sx:{color:P=>P.palette.text.primary},onClick:w,"aria-controls":"header-drawer","aria-expanded":v,size:"large",children:s(O3,{})})}),s(voe,{title:h.name,flags:h.flags,links:h.links,open:v,toggleDrawer:w,admin:u,routes:k}),s(s$,{children:s(K_,{})})]})}):s(i$,{position:"static",children:T(a$,{children:[s(Eh,{to:"/",sx:$v,"aria-label":"Home",children:s(mw,{darkmode:s(qCe,{"aria-label":"Unleash logo"}),lightmode:s(YCe,{"aria-label":"Unleash logo"})})}),T(GCe,{children:[T(KCe,{children:[s(Eh,{to:"/projects",children:"Projects"}),s(Eh,{to:"/features",children:"Feature toggles"}),s(Eh,{to:"/playground",children:"Playground"}),T(XCe,{onClick:P=>c(P.currentTarget),"aria-controls":l?o:void 0,"aria-expanded":Boolean(l),children:["Configure",s(jb,{sx:l$})]}),s(eR,{id:o,options:k.mainNavRoutes,anchorEl:l,handleClose:S,style:{top:10}})]}),T(s$,{children:[s(X,{condition:Boolean(h.flags.ENABLE_DARK_MODE_SUPPORT),show:s(xr,{control:s(Na,{onChange:e,checked:t==="dark"}),label:"darkmode"})}),s(Tt,{title:"Documentation",arrow:!0,children:s(Qt,{href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",disableRipple:!0,sx:Pv,children:s(rC,{})})}),s(X,{condition:u,show:s(Tt,{title:"Settings",arrow:!0,children:T(JCe,{onClick:P=>a(P.currentTarget),"aria-controls":i?r:void 0,"aria-expanded":Boolean(i),size:"large",disableRipple:!0,children:[s(L3,{}),s(jb,{sx:l$})]})})}),s(eR,{id:r,options:k.adminRoutes,anchorEl:i,handleClose:g,style:{top:5,left:-100}})," ",s(K_,{})]})]})]})})},ZCe=e=>{var n;const t=(n=e.versionInfo)==null?void 0:n.current;return t!=null&&t.enterprise?`${e.name} ${t.enterprise}`:t!=null&&t.oss?`${e.name} ${t.oss}`:`${e.name} ${e.version}`},e2e=e=>{var r,o;const t=(r=e.versionInfo)==null?void 0:r.latest,n=(o=e.versionInfo)==null?void 0:o.isLatest;if(t!=null&&t.enterprise&&!n)return`Upgrade available - Latest Enterprise release: ${t.enterprise}`;if(t!=null&&t.oss&&!n)return`Upgrade available - Latest OSS release: ${t.oss}`},Zh=E("h2")(({theme:e})=>({all:"unset",display:"block",margin:e.spacing(2,0),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),t2e=e=>{var i;const t=(i=e.uiConfig.versionInfo)==null?void 0:i.instanceId,n=ZCe(e.uiConfig),r=e.uiConfig.environment,o=e2e(e.uiConfig);return T("section",{title:"API details",children:[T(Zh,{children:[n," ",s(X,{condition:Boolean(r),show:T("small",{children:["(",r,")"]})})]}),s(X,{condition:Boolean(o),show:T("small",{children:[o,s("br",{})]})}),s("br",{}),s("small",{children:e.uiConfig.slogan}),s("br",{}),s(X,{condition:Boolean(t),show:s("small",{children:`${t}`})})]})},n2e=E("footer")(({theme:e})=>({padding:e.spacing(4,8),width:"100%",flexGrow:1,zIndex:100,backgroundColor:e.palette.footerBackground})),c0=E(Yi)({padding:0,margin:0}),wr=E(zi)(({theme:e})=>({padding:0,margin:0,"& a":{textDecoration:"none",color:e.palette.text.primary}})),r2e=()=>{const{uiConfig:e}=Lt();return s(n2e,{children:T(_n,{container:!0,justifyContent:"center",spacing:10,style:{marginBottom:0},children:[s(_n,{item:!0,md:4,xs:12,children:s(t2e,{uiConfig:e})}),s(_n,{item:!0,xs:12,md:"auto",children:T(_n,{container:!0,spacing:7,direction:"row",children:[s(_n,{item:!0,children:T("section",{title:"Unleash SDK",children:[s(Zh,{children:"Server SDKs"}),T(c0,{dense:!0,children:[s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/node",target:"_blank",children:"Node.js"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/java",target:"_blank",children:"Java"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/go",target:"_blank",children:"Go"})})})," ",s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/ruby",target:"_blank",children:"Ruby"})})})," ",s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/python",target:"_blank",children:"Python"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/dotnet",target:"_blank",children:".NET"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/php",target:"_blank",children:"PHP"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",children:"All SDKs"})})})]})]})}),s(_n,{item:!0,children:T("section",{title:"Unleash SDK",children:[s(Zh,{children:"Frontend SDKs"}),T(c0,{dense:!0,children:[s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/unleash-proxy",target:"_blank",children:"Unleash Proxy"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/javascript-browser",target:"_blank",children:"JavaScript SDK"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/react",target:"_blank",children:"React SDK"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/ios-proxy",target:"_blank",children:"iOS SDK"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/android-proxy",target:"_blank",children:"Android SDK"})})})]})]})}),s(_n,{item:!0,children:T("section",{children:[s(Zh,{children:"About"}),T(c0,{dense:!0,children:[s(wr,{children:s(un,{primary:s("a",{href:"https://www.getunleash.io/",target:"_blank",children:"getunleash.io"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://twitter.com/getunleash",target:"_blank",children:"Twitter"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://www.linkedin.com/company/getunleash",target:"_blank",children:"LinkedIn"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://github.com/Unleash/unleash",target:"_blank",children:"GitHub"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://slack.unleash.run",target:"_blank",children:"Slack Community"})})})]})]})})]})})]})})},o2e=E(Xt)(({theme:e})=>({marginBottom:e.spacing(2)})),i2e=E(ke)(({theme:e})=>({maxWidth:"800px"})),a2e=E("a")(({theme:e})=>({display:"block",marginTop:e.spacing(1),width:"100px"})),s2e=e=>!(!e||localStorage&&localStorage.getItem(e)),l2e=({toast:e})=>{const[t,n]=f.useState(!1);f.useEffect(()=>{n(s2e((e==null?void 0:e.id)||""))},[e==null?void 0:e.id]);const r=()=>{localStorage&&localStorage.setItem((e==null?void 0:e.id)||"","seen"),n(!1)};return e?s(X,{condition:t,show:T(o2e,{severity:e.severity,onClose:r,children:[s(i2e,{variant:"body2",children:e.message}),s(a2e,{href:e.link,target:"_blank",rel:"noopener noreferrer",children:"View more"})]})}):null},c2e=E("div")(({theme:e})=>({height:e.spacing(2.5),margin:e.spacing(2,0)})),u2e=E(pG)({"& > ol":{flexWrap:"nowrap","& > li:last-child":{minWidth:0}}}),c$=E("p")(Kne),d2e=E(on)(({theme:e})=>({"& > *":{maxWidth:e.spacing(25)}})),p2e=()=>{const{isAdmin:e}=f.useContext(Qr),t=ri(),n=t.pathname.split("/").filter(r=>r).filter(r=>r!=="create"&&r!=="edit"&&r!=="view"&&r!=="variants"&&r!=="logs"&&r!=="metrics"&&r!=="copy"&&r!=="features"&&r!=="features2"&&r!=="create-toggle"&&r!=="settings"&&r!=="profile");return s(c2e,{children:s(X,{condition:t.pathname.includes("admin")&&e||!t.pathname.includes("admin"),show:s(X,{condition:n.length>1,show:s(u2e,{"aria-label":"Breadcrumbs",children:n.map((r,o)=>{if(o===n.length-1)return s(c$,{children:r},r);let a="/";return n.forEach((l,c)=>{c!==o&&c<o?a+=l+"/":c===o&&(a+=l)}),s(d2e,{to:a,children:s(c$,{children:r})},r)})})})})})},f2e="/static/texture-c29e66c0.png",ED="skip-nav-target-id",h2e=()=>s("div",{id:ED}),m2e=E("a")(({theme:e})=>({position:"fixed",overflow:"hidden",zIndex:1e3,top:e.spacing(2.25),left:e.spacing(2.25),padding:e.spacing(1,2),whiteSpace:"nowrap",textDecoration:"none",background:e.palette.primary.dark,color:e.palette.primary.contrastText,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallBody,[e.breakpoints.down(960)]:{top:"0.8rem",left:"0.8rem"},"&:not(:focus):not(:active)":{clip:"rect(0 0 0 0)",clipPath:"inset(50%)",zIndex:-1,width:1,height:1,margin:-1,padding:0}})),g2e=()=>T(m2e,{href:`#${ED}`,children:["Skip to content ",s("span",{"aria-hidden":!0,children:"↓"})]}),v2e=({featureName:e,projectId:t,conflict:n,onNavigate:r,children:o})=>T(S4,{elevation:0,sx:i=>({marginTop:i.spacing(2),overflow:"hidden"}),children:[T(Je,{sx:i=>({backgroundColor:(Boolean(n),i.palette.neutral.light),borderRadius:a=>`${a.shape.borderRadiusLarge}px ${a.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:a=>n?a.palette.warning.border:a.palette.tertiary.main,borderBottom:"none",overflow:"hidden"}),children:[s(X,{condition:Boolean(n),show:T(Xt,{severity:"warning",sx:{px:3,mb:2,"&.MuiAlert-standardWarning":{borderStyle:"none"}},children:[s("strong",{children:"Conflict!"})," ",n,"."]})}),T(Je,{sx:{display:"flex",pt:n?0:2,pb:2,px:3},children:[s(ke,{children:"Feature toggle name: "}),s(po,{component:on,to:`/projects/${t}/features/${e}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:r,children:s("strong",{children:e})})]})]}),s(Je,{children:o})]}),y2e=e=>typeof e=="object"&&e!==null&&"name"in e;var b2e=200,z2="__lodash_hash_undefined__",w2e=1/0,kD=9007199254740991,S2e="[object Arguments]",x2e="[object Function]",C2e="[object GeneratorFunction]",E2e="[object Symbol]",k2e=/[\\^$.*+?()[\]{}|]/g,T2e=/^\[object .+?Constructor\]$/,_2e=/^(?:0|[1-9]\d*)$/,R2e=typeof Rn=="object"&&Rn&&Rn.Object===Object&&Rn,P2e=typeof self=="object"&&self&&self.Object===Object&&self,j2=R2e||P2e||Function("return this")();function $2e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function I2e(e,t){var n=e?e.length:0;return!!n&&L2e(e,t,0)>-1}function A2e(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function TD(e,t){for(var n=-1,r=e?e.length:0,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function U2(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function O2e(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function L2e(e,t,n){if(t!==t)return O2e(e,D2e,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}function D2e(e){return e!==e}function N2e(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function M2e(e){return function(t){return e(t)}}function B2e(e,t){return e.has(t)}function F2e(e,t){return e==null?void 0:e[t]}function z2e(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function _D(e,t){return function(n){return e(t(n))}}var j2e=Array.prototype,U2e=Function.prototype,oy=Object.prototype,u0=j2["__core-js_shared__"],u$=function(){var e=/[^.]+$/.exec(u0&&u0.keys&&u0.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),RD=U2e.toString,Su=oy.hasOwnProperty,W2=oy.toString,W2e=RegExp("^"+RD.call(Su).replace(k2e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),d$=j2.Symbol,H2e=_D(Object.getPrototypeOf,Object),V2e=oy.propertyIsEnumerable,G2e=j2e.splice,p$=d$?d$.isConcatSpreadable:void 0,yw=Object.getOwnPropertySymbols,f$=Math.max,q2e=$D(j2,"Map"),Ip=$D(Object,"create");function kl(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Y2e(){this.__data__=Ip?Ip(null):{}}function K2e(e){return this.has(e)&&delete this.__data__[e]}function X2e(e){var t=this.__data__;if(Ip){var n=t[e];return n===z2?void 0:n}return Su.call(t,e)?t[e]:void 0}function J2e(e){var t=this.__data__;return Ip?t[e]!==void 0:Su.call(t,e)}function Q2e(e,t){var n=this.__data__;return n[e]=Ip&&t===void 0?z2:t,this}kl.prototype.clear=Y2e;kl.prototype.delete=K2e;kl.prototype.get=X2e;kl.prototype.has=J2e;kl.prototype.set=Q2e;function xu(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Z2e(){this.__data__=[]}function eEe(e){var t=this.__data__,n=iy(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():G2e.call(t,n,1),!0}function tEe(e){var t=this.__data__,n=iy(t,e);return n<0?void 0:t[n][1]}function nEe(e){return iy(this.__data__,e)>-1}function rEe(e,t){var n=this.__data__,r=iy(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}xu.prototype.clear=Z2e;xu.prototype.delete=eEe;xu.prototype.get=tEe;xu.prototype.has=nEe;xu.prototype.set=rEe;function Cu(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function oEe(){this.__data__={hash:new kl,map:new(q2e||xu),string:new kl}}function iEe(e){return ay(this,e).delete(e)}function aEe(e){return ay(this,e).get(e)}function sEe(e){return ay(this,e).has(e)}function lEe(e,t){return ay(this,e).set(e,t),this}Cu.prototype.clear=oEe;Cu.prototype.delete=iEe;Cu.prototype.get=aEe;Cu.prototype.has=sEe;Cu.prototype.set=lEe;function ig(e){var t=-1,n=e?e.length:0;for(this.__data__=new Cu;++t<n;)this.add(e[t])}function cEe(e){return this.__data__.set(e,z2),this}function uEe(e){return this.__data__.has(e)}ig.prototype.add=ig.prototype.push=cEe;ig.prototype.has=uEe;function dEe(e,t){var n=H2(e)||ID(e)?N2e(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||Su.call(e,i))&&!(o&&(i=="length"||CEe(i,r)))&&n.push(i);return n}function iy(e,t){for(var n=e.length;n--;)if($Ee(e[n][0],t))return n;return-1}function pEe(e,t,n,r){var o=-1,i=I2e,a=!0,l=e.length,c=[],u=t.length;if(!l)return c;n&&(t=TD(t,M2e(n))),r?(i=A2e,a=!1):t.length>=b2e&&(i=B2e,a=!1,t=new ig(t));e:for(;++o<l;){var d=e[o],p=n?n(d):d;if(d=r||d!==0?d:0,a&&p===p){for(var h=u;h--;)if(t[h]===p)continue e;c.push(d)}else i(t,p,r)||c.push(d)}return c}function PD(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=xEe),o||(o=[]);++i<a;){var l=e[i];t>0&&n(l)?t>1?PD(l,t-1,n,r,o):U2(o,l):r||(o[o.length]=l)}return o}function fEe(e,t,n){var r=t(e);return H2(e)?r:U2(r,n(e))}function hEe(e){if(!V2(e)||kEe(e))return!1;var t=OD(e)||z2e(e)?W2e:T2e;return t.test(PEe(e))}function mEe(e){if(!V2(e))return _Ee(e);var t=TEe(e),n=[];for(var r in e)r=="constructor"&&(t||!Su.call(e,r))||n.push(r);return n}function gEe(e,t){return e=Object(e),vEe(e,t,function(n,r){return r in e})}function vEe(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],l=e[a];n(l,a)&&(i[a]=l)}return i}function yEe(e,t){return t=f$(t===void 0?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=f$(n.length-t,0),i=Array(o);++r<o;)i[r]=n[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=n[r];return a[t]=i,$2e(e,this,a)}}function bEe(e){return fEe(e,LEe,SEe)}function ay(e,t){var n=e.__data__;return EEe(t)?n[typeof t=="string"?"string":"hash"]:n.map}function $D(e,t){var n=F2e(e,t);return hEe(n)?n:void 0}var wEe=yw?_D(yw,Object):DD,SEe=yw?function(e){for(var t=[];e;)U2(t,wEe(e)),e=H2e(e);return t}:DD;function xEe(e){return H2(e)||ID(e)||!!(p$&&e&&e[p$])}function CEe(e,t){return t=t??kD,!!t&&(typeof e=="number"||_2e.test(e))&&e>-1&&e%1==0&&e<t}function EEe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function kEe(e){return!!u$&&u$ in e}function TEe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||oy;return e===n}function _Ee(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function REe(e){if(typeof e=="string"||OEe(e))return e;var t=e+"";return t=="0"&&1/e==-w2e?"-0":t}function PEe(e){if(e!=null){try{return RD.call(e)}catch{}try{return e+""}catch{}}return""}function $Ee(e,t){return e===t||e!==e&&t!==t}function ID(e){return IEe(e)&&Su.call(e,"callee")&&(!V2e.call(e,"callee")||W2.call(e)==S2e)}var H2=Array.isArray;function AD(e){return e!=null&&AEe(e.length)&&!OD(e)}function IEe(e){return LD(e)&&AD(e)}function OD(e){var t=V2(e)?W2.call(e):"";return t==x2e||t==C2e}function AEe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=kD}function V2(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function LD(e){return!!e&&typeof e=="object"}function OEe(e){return typeof e=="symbol"||LD(e)&&W2.call(e)==E2e}function LEe(e){return AD(e)?dEe(e,!0):mEe(e)}var DEe=yEe(function(e,t){return e==null?{}:(t=TD(PD(t,1),REe),gEe(e,pEe(bEe(e),t)))});function DD(){return[]}var NEe=DEe;const MEe=(e,t,n,r)=>{var a,l;return(l=(a=xl(t,n).feature)==null?void 0:a.environments.find(c=>c.name===r))==null?void 0:l.strategies.find(c=>"id"in e.payload&&c.id===e.payload.id)},d0=({change:e,project:t,feature:n,environmentName:r})=>{const o=MEe(e,t,n,r),i=e.action==="deleteStrategy"?void 0:e.payload;return s(bL,{children:s(qv,{entry:{preData:NEe(o,"sortOrder"),data:i}})})},p0=({change:e,children:t})=>{const[n,r]=jt.useState(null),o=l=>{r(l.currentTarget)},i=()=>{r(null)},a=Boolean(n);return T(Re,{children:[s(Xce,{strategyName:e.payload.name}),s(ke,{onMouseEnter:o,onMouseLeave:i,children:kp(e.payload.name)}),s(Px,{id:String(e.id),sx:{pointerEvents:"none"},open:a,anchorEl:n,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:i,disableRestoreFocus:!0,children:t})]})},h$=({percentage:e,size:t="4rem"})=>{const n=sn(),r={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:t,width:t,background:n.palette.grey[200]},o=100/(2*Math.PI),i=2*o;return s("svg",{viewBox:`0 0 ${i} ${i}`,style:r,"aria-hidden":!0,children:s("circle",{r:o,cx:o,cy:o,fill:"none",stroke:n.palette.primary.light,strokeWidth:i,strokeDasharray:`${e} 100`})})},BEe=E("div")(({theme:e})=>({width:"100%",padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.divider}`})),FEe=E("p")(({theme:e})=>({display:"inline",margin:e.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),zEe=E(wo)(({theme:e})=>({margin:e.spacing(.5)})),f0=({value:e,text:t})=>s(BEe,{children:s(X,{condition:e.length===0,show:T("p",{children:["No ",t,"s added yet."]}),elseShow:T("div",{children:[T(FEe,{children:[e.length," ",e.length>1?`${t}s`:t," will get access."]}),e.map(n=>s(zEe,{label:s(Li,{maxWidth:"300",text:n,maxLength:50})},n))]})})}),jEe=({segments:e})=>!e||e.length===0?null:s(Re,{children:e.map((t,n)=>T(f.Fragment,{children:[s(X,{condition:n>0,show:s(I2,{text:"AND"})}),s(gD,{segment:t})]},t.id))}),m$=()=>s(Je,{sx:{px:3,color:"text.disabled"},children:"This strategy does not have constraints or parameters."}),Us=E(Je)(({theme:e})=>({padding:e.spacing(2,3),border:`1px solid ${e.palette.dividerAlternative}`,borderRadius:e.shape.borderRadiusMedium})),h0=E("span")(({theme:e})=>({color:e.palette.neutral.main})),g$=({strategy:e})=>{const{parameters:t,constraints:n=[]}=e,{strategies:r}=hu(),{uiConfig:o}=Lt(),{segments:i}=Dl(),a=i==null?void 0:i.filter(p=>{var h;return(h=e.segments)==null?void 0:h.includes(p.id)}),l=r.find(p=>p.name===e.name),c=f.useMemo(()=>!t||l!=null&&l.editable?null:Object.keys(t).map(p=>{switch(p){case"rollout":case"Rollout":const h=Ud(t[p]);return T(Us,{sx:{display:"flex",alignItems:"center"},children:[s(Je,{sx:{mr:2},children:s(h$,{percentage:h,size:"2rem"})}),T("div",{children:[s(wo,{color:"success",variant:"outlined",size:"small",label:`${h}%`})," ","of your base"," ",n.length>0?"who match constraints":""," ","is included."]})]});case"userIds":case"UserIds":const m=rs(t[p]);return s(f0,{value:m,text:"user"},p);case"hostNames":case"HostNames":const y=rs(t[p]);return s(f0,{value:y,text:"host"},p);case"IPs":const v=rs(t[p]);return s(f0,{value:v,text:"IP"},p);case"stickiness":case"groupId":return null;default:return null}}),[t,l,n]),u=f.useMemo(()=>{if(!t||!(l!=null&&l.editable))return null;const p=s(h0,{children:" is set to "});return l==null?void 0:l.parameters.map(h=>{const{type:m,name:y}={...h};if(!m||!y||t[y]===void 0)return null;const v=s(Li,{maxLength:15,maxWidth:"150",text:y});switch(h==null?void 0:h.type){case"list":const b=rs(t[y]);return b.length>0?T(Us,{children:[v," ",T(h0,{children:["has ",b.length," ",b.length>1?"items":"item",":"," ",b.map(C=>s(wo,{label:s(Li,{maxWidth:"300",text:C,maxLength:50}),sx:{mr:.5}},C))]})]}):null;case"percentage":const w=Ud(t[y]);return t[y]!==""?T(Us,{sx:{display:"flex",alignItems:"center"},children:[s(Je,{sx:{mr:2},children:s(h$,{percentage:w,size:"2rem"})}),T("div",{children:[v,p,s(wo,{color:"success",variant:"outlined",size:"small",label:`${w}%`})]})]}):null;case"boolean":return t[y]==="true"||t[y]==="false"?T(Us,{children:[s(Li,{maxLength:15,maxWidth:"150",text:y}),p,s(wo,{color:t[y]==="true"?"success":"error",variant:"outlined",size:"small",label:t[y]})]}):null;case"string":const g=fs(t[y]);return typeof t[y]<"u"?T(Us,{children:[v,s(X,{condition:g==="",show:s(h0,{children:" is an empty string"}),elseShow:T(Re,{children:[p,s(Li,{maxWidth:"300",text:g,maxLength:50})]})})]}):null;case"number":const S=Ud(t[y]);return t[y]!==""&&S!==void 0?T(Us,{children:[v,p,s(Li,{maxWidth:"300",text:String(S),maxLength:50})]}):null;case"default":return null}return null})},[t,l]);if(!t)return s(m$,{});const d=[Boolean(o.flags.SE)&&a&&a.length>0&&s(jEe,{segments:a}),n.length>0&&s(ny,{constraints:n,showLabel:!1}),e.name==="default"&&s(Re,{children:T(Us,{sx:{width:"100%"},children:["The standard strategy is"," ",s(wo,{variant:"outlined",size:"small",color:"success",label:"ON"})," ","for all users."]})}),...c??[],...u??[]].filter(Boolean);return s(X,{condition:d.length>0,show:s(Re,{children:d.map((p,h)=>T(f.Fragment,{children:[s(X,{condition:h>0,show:s(I2,{text:"AND"})}),p]},h))}),elseShow:s(m$,{})})},ND=E(Je)({display:"flex",justifyContent:"space-between",alignItems:"center"}),MD=E(Je)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2)})),G2=E(Je)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),UEe=({children:e,discard:t})=>T(MD,{children:[T(G2,{children:[s(ke,{sx:n=>({color:n.palette.success.dark}),children:"+ Adding strategy:"}),e]}),t]}),WEe=({children:e,discard:t})=>T(MD,{children:[T(G2,{children:[s(ke,{children:"Editing strategy:"}),e]}),t]}),HEe=({discard:e,children:t})=>T(ND,{children:[T(G2,{children:[s(ke,{sx:n=>({color:n.palette.error.main}),children:"- Deleting strategy"}),t]}),e]}),VEe=({enabled:e,discard:t})=>T(ND,{children:[T(Je,{sx:{display:"flex",alignItems:"center"},children:["New status:"," ",s(bi,{sx:n=>({marginLeft:n.spacing(1)}),color:e?"success":"error",children:e?" Enabled":"Disabled"})]}),t]}),GEe=E("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),qEe=({preData:e,data:t})=>s(GEe,{children:s(qv,{entry:{preData:e,data:t}})}),YEe=E(Je)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2)})),KEe=E(Je)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),XEe=({feature:e,project:t,environment:n,change:r,discard:o})=>{var l;const{feature:i}=xl(t,e),a=(l=i.environments.find(({name:c})=>n===c))==null?void 0:l.variants;return T(YEe,{children:[T(KEe,{children:[s(ke,{children:"Updating variants:"}),s(qEe,{preData:a,data:r.payload.variants})]}),o]})},JEe=E(Je,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$hasConflict:t,$isInConflictFeature:n,$isAfterWarning:r,$isLast:o})=>({borderLeft:"1px solid",borderRight:"1px solid",borderTop:"1px solid",borderBottom:o?"1px solid":"none",borderRadius:o?`0 0
|
|
384
|
+
your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:S,children:T(eCe,{onSubmit:g,children:[s("div",{children:s(Zxe,{description:u,setDescription:d,isDescriptionUnique:R,expiration:p,setExpiration:h,expiresAt:m,setExpiresAt:y,errors:v,setErrors:b})}),T(tCe,{children:[s(rt,{type:"submit",variant:"contained",color:"primary",disabled:!k,children:"Create token"}),s(nCe,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},oCe=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=M2(),{deletePersonalAPIToken:o}=bD(),{setToastData:i,setToastApiError:a}=It();return s(cr,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){a(ht(c))}},onClose:()=>{t(!1)},title:"Delete token?",children:T(ke,{children:['Any applications or scripts using this token "',s("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},iCe=E(Xt)(({theme:e})=>({marginBottom:e.spacing(3)})),aCe=({open:e,setOpen:t,token:n})=>T(cr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[s(iCe,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),s(ke,{variant:"body1",children:"Your token:"}),s(uD,{token:(n==null?void 0:n.secret)||""})]}),sCe=({value:e,live:t=!1,emptyText:n,title:r})=>{const{locationSettings:o}=la();if(!e)return s(fo,{children:n});const i=Vc(e,o.locale);return s(fo,{children:s(Tt,{title:(r==null?void 0:r(i))??i,arrow:!0,children:s(ke,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:s(gC,{date:new Date(e),live:t,title:""})})})})},lCe=E(Xt)(({theme:e})=>({marginBottom:e.spacing(3)})),cCe=E("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),uCe=E(ke)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),dCe=E(ke)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),pCe=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),fCe={id:"createdAt"},{value:n$,setValue:hCe}=Dv("PersonalAPITokensTable:v1",fCe),mCe=()=>{const e=sn(),t=Er(e.breakpoints.down("md")),n=Er(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=M2(),[i,a]=jp(),[l]=f.useState(()=>({sortBy:[{id:i.get("sort")||n$.id,desc:i.has("order")?i.get("order")==="desc":n$.desc}],globalFilter:i.get("search")||""})),[c,u]=f.useState(l.globalFilter),[d,p]=f.useState(!1),[h,m]=f.useState(!1),[y,v]=f.useState(!1),[b,w]=f.useState(),[g,S]=f.useState(),C=f.useMemo(()=>[{Header:"Description",accessor:"description",Cell:mf,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:j})=>new Date(j).getFullYear()>new Date().getFullYear()+100?s(fo,{children:"Never"}):s(Ep,{value:j}),sortType:"date",maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:Ep,sortType:"date",maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:sCe,sortType:"date",maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:j}})=>s(na,{children:s(Tt,{title:"Delete token",arrow:!0,describeChild:!0,children:s("span",{children:s(Qt,{onClick:()=>{S(j),v(!0)},children:s(ti,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,v]),{data:R,getSearchText:k,getSearchContext:P}=RC(C,c,r),O=f.useMemo(()=>(R==null?void 0:R.length)===0&&o?pCe:R,[R,o]),{headerGroups:L,rows:I,prepareRow:A,state:{sortBy:M},setHiddenColumns:F}=tn.useTable({columns:C,data:O,initialState:l,sortTypes:ca,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},tn.useSortBy,tn.useFlexLayout);return Mv([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],F,C),f.useEffect(()=>{const j={};j.sort=M[0].id,M[0].desc&&(j.order="desc"),c&&(j.search=c),a(j,{replace:!0}),hCe({id:M[0].id,desc:M[0].desc||!1})},[M,c,a]),T(gr,{isLoading:o,header:s(xn,{title:`Personal API tokens (${I.length<O.length?`${I.length} of ${O.length}`:O.length})`,actions:T(Re,{children:[s(X,{condition:!t,show:T(Re,{children:[s(go,{initialValue:c,onChange:u,getSearchContext:P}),s(xn.Divider,{})]})}),s(rt,{variant:"contained",color:"primary",disabled:r.length>=Wxe,onClick:()=>p(!0),children:"New token"})]}),children:s(X,{condition:t,show:s(go,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:P})})}),children:[s(lCe,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),s(As,{value:k(c),children:s(uC,{rows:I,headerGroups:L,prepareRow:A})}),s(X,{condition:I.length===0,show:s(X,{condition:(c==null?void 0:c.length)>0,show:T(Zn,{children:["No tokens found matching “",c,"”"]}),elseShow:T(cCe,{children:[s(uCe,{children:"You have no personal API tokens yet."}),s(dCe,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),s(rt,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),s(rCe,{open:d,setOpen:p,newToken:j=>{w(j),m(!0)}}),s(aCe,{open:h,setOpen:m,token:b}),s(oCe,{open:y,setOpen:v,token:g})]})},gCe=()=>{const{data:e,error:t,mutate:n}=gn(Ft("api/admin/user/profile"),vCe);return{profile:e,loading:!t&&!e,refetchProfile:()=>n(),error:t}},vCe=e=>fetch(e).then(Cn("Profile")).then(t=>t.json());var B2={},yCe=fn;Object.defineProperty(B2,"__esModule",{value:!0});var xD=B2.default=void 0,bCe=yCe(En()),wCe=kn,SCe=(0,bCe.default)((0,wCe.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"InfoOutlined");xD=B2.default=SCe;var F2={},xCe=fn;Object.defineProperty(F2,"__esModule",{value:!0});var CD=F2.default=void 0,CCe=xCe(En()),ECe=kn,kCe=(0,CCe.default)((0,ECe.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16.77c.68 0 1.23-.56 1.23-1.23V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-2-6H6v-2h12v2zm-4 4H6v-2h8v2z"}),"TopicOutlined");CD=F2.default=kCe;const TCe=E("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:e.spacing(6),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.primary.main,color:e.palette.text.tertiaryContrast,marginBottom:e.spacing(3),boxShadow:e.boxShadows.primaryHeader})),_Ce=E("div")(()=>({flexGrow:1})),RCe=E(ke)(({theme:e})=>({fontSize:e.spacing(3.75)})),PCe=E(tC)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),r$=E(ke)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),$Ce=E("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),ICe=E(bi)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),ACe=E("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),OCe=E(Da)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),LCe=E(Zp)(({theme:e})=>({backgroundColor:e.palette.inputLabelBackground})),DCe=({user:e})=>{const{profile:t}=gCe(),n=ft(),{locationSettings:r,setLocationSettings:o}=la(),[i,a]=f.useState(),[l,c]=f.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);f.useEffect(()=>{const d=l.find(p=>p.toLowerCase().includes(r.locale.toLowerCase()));a(d),d||c(p=>[...p,r.locale])},[r]);const u=d=>{const p=d.target.value;a(p),o({locale:p})};return T(Re,{children:[T(TCe,{children:[s(PCe,{user:e}),T(_Ce,{children:[s(RCe,{children:e.name||e.username}),s(ke,{variant:"body1",children:e.email})]})]}),T(gr,{children:[s(r$,{children:"Access"}),T($Ce,{children:[T(Je,{sx:{width:"50%"},children:[s(ke,{variant:"body2",children:"Your root role"}),s(Tt,{title:(t==null?void 0:t.rootRole.description)||"",arrow:!0,placement:"bottom-end",describeChild:!0,children:s(bi,{color:"success",icon:s(xD,{}),iconRight:!0,children:t==null?void 0:t.rootRole.name})})]}),T(Je,{children:[s(ke,{variant:"body2",children:"Projects"}),s(X,{condition:Boolean(t==null?void 0:t.projects.length),show:t==null?void 0:t.projects.map(d=>s(Tt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:s(ICe,{onClick:p=>{p.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:s(CD,{}),children:d})},d)),elseShow:s(Tt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:s(bi,{children:"No projects"})})})]})]}),s(ACe,{}),s(r$,{children:"Settings"}),s(ke,{variant:"body2",children:"This is the format used across the system for time and date"}),T(OCe,{variant:"outlined",size:"small",children:[s(LCe,{htmlFor:"locale-select",children:"Date/Time formatting"}),s(ef,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:l.map(d=>s("option",{value:d,children:d},d))})]})]})]})},NCe=()=>{const{user:e}=si(),t=ri(),n=ft(),r=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password"},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens"}],o=c=>{n(c.path?`/profile/${c.path}`:"/profile",{replace:!0}),l(c.id)},i=()=>{const c=t.pathname;return(r.find(({path:d})=>d&&c.includes(d))||r[0]).id},[a,l]=f.useState(i());return f.useEffect(()=>{l(i())},[t]),T(Fxe,{tabs:r,value:a,onChange:o,children:[s(X,{condition:a==="profile",show:s(DCe,{user:e})}),s(X,{condition:a==="password",show:s(Uxe,{})}),s(X,{condition:a==="pat",show:s(mCe,{})})]})},MCe=f.lazy(()=>import("./CreateProject-29a2b285.js")),BCe=f.lazy(()=>import("./FeatureViewLazyExport-1bee3351.js")),FCe=f.lazy(()=>import("./LazyAdminExport-2f5a25ac.js")),zCe=f.lazy(()=>import("./LazyProjectExport-dc65603b.js")),jCe=()=>s(Il,{to:"/admin/users",replace:!0}),$p=[{path:"/splash/:splashId",title:"Unleash",component:Age,type:"protected",menu:{},isStandalone:!0},{path:"/projects/create",parent:"/projects",title:"Create",component:MCe,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/edit",parent:"/projects",title:":projectId",component:she,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/archived",title:":projectId",parent:"/archive",component:Lpe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/:activeTab/copy",parent:"/projects/:projectId/features/:featureId/:activeTab",title:"Copy",component:Lme,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/edit",parent:"/projects",title:"Edit feature",component:Bhe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/*",parent:"/projects",title:"FeatureView",component:BCe,type:"protected",menu:{}},{path:"/projects/:projectId/create-toggle",parent:"/projects/:projectId/features",title:"Create feature toggle",component:whe,type:"protected",menu:{}},{path:"/projects/:projectId/features2/:featureId",parent:"/features",title:":featureId",component:UR,type:"protected",menu:{}},{path:"/projects/:projectId/*",parent:"/projects",title:":projectId",component:zCe,flag:bde,type:"protected",menu:{}},{path:"/projects",title:"Projects",component:Ope,type:"protected",menu:{mobile:!0}},{path:"/features/:activeTab/:featureId",parent:"/features",title:":featureId",component:UR,type:"protected",menu:{}},{path:"/features",title:"Feature toggles",component:jle,type:"protected",menu:{mobile:!0}},{path:"/playground",title:"Playground",component:Oxe,hidden:!1,type:"protected",menu:{mobile:!0}},{path:"/applications/:name",title:":name",parent:"/applications",component:Hhe,type:"protected",menu:{}},{path:"/applications",title:"Applications",component:Vhe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/context/create",parent:"/context",title:"Create",component:Dge,type:"protected",menu:{}},{path:"/context/edit/:name",parent:"/context",title:":name",component:Ufe,type:"protected",menu:{}},{path:"/context",title:"Context fields",component:Yhe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/strategies/create",title:"Create",parent:"/strategies",component:hge,type:"protected",menu:{}},{path:"/strategies/:name/edit",title:":name",parent:"/strategies",component:gge,type:"protected",menu:{}},{path:"/strategies/:name",title:":name",parent:"/strategies",component:_ce,type:"protected",menu:{}},{path:"/strategies",title:"Strategy types",component:sue,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/environments/create",title:"Environments",component:xfe,parent:"/environments",type:"protected",menu:{}},{path:"/environments/:id",title:"Edit",component:kfe,type:"protected",menu:{}},{path:"/environments",title:"Environments",component:eSe,type:"protected",flag:wde,menu:{mobile:!0,advanced:!0}},{path:"/tag-types/create",parent:"/tag-types",title:"Create",component:Qfe,type:"protected",menu:{}},{path:"/tag-types/edit/:name",parent:"/tag-types",title:":name",component:Jfe,type:"protected",menu:{}},{path:"/tag-types",title:"Tag types",component:uue,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/addons/create/:providerId",parent:"/addons",title:"Create",component:Pme,type:"protected",menu:{}},{path:"/addons/edit/:addonId",parent:"/addons",title:"Edit",component:$me,type:"protected",menu:{}},{path:"/addons",title:"Addons",component:Sue,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/segments/create",title:"Segments",component:nwe,hidden:!1,type:"protected",layout:"main",menu:{},flag:N1},{path:"/segments/edit/:segmentId",title:"Segments",component:iwe,hidden:!1,type:"protected",layout:"main",menu:{},flag:N1},{path:"/segments",title:"Segments",component:wxe,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0},flag:N1},{path:"/history",title:"Event log",component:Jme,type:"protected",menu:{adminSettings:!0}},{path:"/archive",title:"Archived toggles",component:Axe,type:"protected",menu:{}},{path:"/admin",title:"Admin",component:jCe,hidden:!1,type:"protected",menu:{}},{path:"/admin/*",title:"Admin",component:FCe,hidden:!1,type:"protected",menu:{}},{path:"/profile/*",title:"Profile",component:NCe,type:"protected",menu:{}},{path:"/login",title:"Log in",component:yde,type:"unprotected",hidden:!0,menu:{},isStandalone:!0},{path:"/new-user",title:"New user",hidden:!0,component:Kde,type:"unprotected",menu:{},isStandalone:!0},{path:"/reset-password",title:"Reset password",hidden:!0,component:Qde,type:"unprotected",menu:{},isStandalone:!0},{path:"/forgotten-password",title:"Forgotten password",hidden:!0,component:ipe,type:"unprotected",menu:{},isStandalone:!0}],UCe=[{path:"/history",title:"Event log",menu:{adminSettings:!0}},{path:"/admin/users",title:"Users",menu:{adminSettings:!0}},{path:"/admin/groups",title:"Groups",menu:{adminSettings:!0},flag:xde},{path:"/admin/roles",title:"Project roles",flag:Sde,menu:{adminSettings:!0}},{path:"/admin/auth",title:"Single sign-on",menu:{adminSettings:!0}},{path:"/admin/instance",title:"Instance stats",menu:{adminSettings:!0}},{path:"/admin/service-accounts",title:"Service accounts",menu:{adminSettings:!0},flag:"serviceAccounts"},{path:"/admin/network/*",title:"Network",menu:{adminSettings:!0},flag:"networkView"},{path:"/admin/maintenance",title:"Maintenance",menu:{adminSettings:!0},flag:"maintenance"},{path:"/admin/cors",title:"CORS origins",flag:"embedProxyFrontend",menu:{adminSettings:!0}},{path:"/admin/admin-invoices",title:"Billing & invoices",menu:{adminSettings:!0,isEnterprise:!0}}],WCe=$p.filter(e=>!e.hidden),HCe=()=>{const e=WCe.filter(o=>o.menu.advanced),t=$p.filter(o=>o.menu.adminSettings),n=$p.filter(o=>o.menu.mobile),r={mainNavRoutes:e,adminRoutes:t,mobileRoutes:n};return()=>r},o$=e=>e.map(t=>({path:t.path,flag:t.flag,title:t.title,menu:t.menu,configFlag:t.configFlag})),VCe=HCe(),i$=E(BH)(({theme:e})=>({backgroundColor:e.palette.headerBackground,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300})),a$=E(cq)(({theme:e})=>({display:"flex",alignItems:"center",maxWidth:1280,[e.breakpoints.down("md")]:{padding:"0"}})),s$=E("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),GCe=E("nav")({display:"flex",alignItems:"center",flexGrow:1}),qCe=E(Ure)({width:"150px"}),YCe=E(jre)({width:"150px"}),KCe=E("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}})),XCe=E("button")(({theme:e})=>({border:"none",background:"transparent",height:"100%",display:"flex",fontSize:e.fontSizes.bodySize,fontFamily:e.typography.fontFamily,alignItems:"center",color:"inherit",cursor:"pointer"})),l$=e=>({color:e.palette.neutral.main}),Eh=E(on)(({theme:e})=>Pv(e)),JCe=E(Qt)(({theme:e})=>({...Pv(e),borderRadius:100})),QCe=()=>{const{onSetThemeMode:e,themeMode:t}=y3(),n=sn(),r=Ss(),o=Ss(),[i,a]=f.useState(null),[l,c]=f.useState(null),[u,d]=f.useState(!1),{permissions:p}=WC(),{uiConfig:h,isOss:m}=Lt(),y=Er(n.breakpoints.down("md")),[v,b]=f.useState(!1),w=()=>b(P=>!P),g=()=>a(null),S=()=>c(null);f.useEffect(()=>{(p==null?void 0:p.find(O=>O.permission===xi))&&d(!0)},[p]);const C=VCe(),R=P=>!P.menu.isEnterprise||!m(),k={mainNavRoutes:o$(C.mainNavRoutes).concat([{path:"/admin/api",title:"API access",menu:{}}]).filter(z1(h)),mobileRoutes:o$(C.mobileRoutes).filter(z1(h)),adminRoutes:UCe.filter(z1(h)).filter(R).map(P=>({...P,path:P.path.replace("/*","")}))};return y?s(i$,{position:"static",children:T(a$,{children:[s(Tt,{title:"Menu",arrow:!0,children:s(Qt,{sx:{color:P=>P.palette.text.primary},onClick:w,"aria-controls":"header-drawer","aria-expanded":v,size:"large",children:s(O3,{})})}),s(voe,{title:h.name,flags:h.flags,links:h.links,open:v,toggleDrawer:w,admin:u,routes:k}),s(s$,{children:s(K_,{})})]})}):s(i$,{position:"static",children:T(a$,{children:[s(Eh,{to:"/",sx:$v,"aria-label":"Home",children:s(mw,{darkmode:s(qCe,{"aria-label":"Unleash logo"}),lightmode:s(YCe,{"aria-label":"Unleash logo"})})}),T(GCe,{children:[T(KCe,{children:[s(Eh,{to:"/projects",children:"Projects"}),s(Eh,{to:"/features",children:"Feature toggles"}),s(Eh,{to:"/playground",children:"Playground"}),T(XCe,{onClick:P=>c(P.currentTarget),"aria-controls":l?o:void 0,"aria-expanded":Boolean(l),children:["Configure",s(jb,{sx:l$})]}),s(eR,{id:o,options:k.mainNavRoutes,anchorEl:l,handleClose:S,style:{top:10}})]}),T(s$,{children:[s(X,{condition:Boolean(h.flags.ENABLE_DARK_MODE_SUPPORT),show:s(xr,{control:s(Na,{onChange:e,checked:t==="dark"}),label:"darkmode"})}),s(Tt,{title:"Documentation",arrow:!0,children:s(Qt,{href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",disableRipple:!0,sx:Pv,children:s(rC,{})})}),s(X,{condition:u,show:s(Tt,{title:"Settings",arrow:!0,children:T(JCe,{onClick:P=>a(P.currentTarget),"aria-controls":i?r:void 0,"aria-expanded":Boolean(i),size:"large",disableRipple:!0,children:[s(L3,{}),s(jb,{sx:l$})]})})}),s(eR,{id:r,options:k.adminRoutes,anchorEl:i,handleClose:g,style:{top:5,left:-100}})," ",s(K_,{})]})]})]})})},ZCe=e=>{var n;const t=(n=e.versionInfo)==null?void 0:n.current;return t!=null&&t.enterprise?`${e.name} ${t.enterprise}`:t!=null&&t.oss?`${e.name} ${t.oss}`:`${e.name} ${e.version}`},e2e=e=>{var r,o;const t=(r=e.versionInfo)==null?void 0:r.latest,n=(o=e.versionInfo)==null?void 0:o.isLatest;if(t!=null&&t.enterprise&&!n)return`Upgrade available - Latest Enterprise release: ${t.enterprise}`;if(t!=null&&t.oss&&!n)return`Upgrade available - Latest OSS release: ${t.oss}`},Zh=E("h2")(({theme:e})=>({all:"unset",display:"block",margin:e.spacing(2,0),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),t2e=e=>{var i;const t=(i=e.uiConfig.versionInfo)==null?void 0:i.instanceId,n=ZCe(e.uiConfig),r=e.uiConfig.environment,o=e2e(e.uiConfig);return T("section",{title:"API details",children:[T(Zh,{children:[n," ",s(X,{condition:Boolean(r),show:T("small",{children:["(",r,")"]})})]}),s(X,{condition:Boolean(o),show:T("small",{children:[o,s("br",{})]})}),s("br",{}),s("small",{children:e.uiConfig.slogan}),s("br",{}),s(X,{condition:Boolean(t),show:s("small",{children:`${t}`})})]})},n2e=E("footer")(({theme:e})=>({padding:e.spacing(4,8),width:"100%",flexGrow:1,zIndex:100,backgroundColor:e.palette.footerBackground})),c0=E(Yi)({padding:0,margin:0}),wr=E(zi)(({theme:e})=>({padding:0,margin:0,"& a":{textDecoration:"none",color:e.palette.text.primary}})),r2e=()=>{const{uiConfig:e}=Lt();return s(n2e,{children:T(_n,{container:!0,justifyContent:"center",spacing:10,style:{marginBottom:0},children:[s(_n,{item:!0,md:4,xs:12,children:s(t2e,{uiConfig:e})}),s(_n,{item:!0,xs:12,md:"auto",children:T(_n,{container:!0,spacing:7,direction:"row",children:[s(_n,{item:!0,children:T("section",{title:"Unleash SDK",children:[s(Zh,{children:"Server SDKs"}),T(c0,{dense:!0,children:[s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/node",target:"_blank",children:"Node.js"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/java",target:"_blank",children:"Java"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/go",target:"_blank",children:"Go"})})})," ",s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/ruby",target:"_blank",children:"Ruby"})})})," ",s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/python",target:"_blank",children:"Python"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/dotnet",target:"_blank",children:".NET"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/php",target:"_blank",children:"PHP"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",children:"All SDKs"})})})]})]})}),s(_n,{item:!0,children:T("section",{title:"Unleash SDK",children:[s(Zh,{children:"Frontend SDKs"}),T(c0,{dense:!0,children:[s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/unleash-proxy",target:"_blank",children:"Unleash Proxy"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/javascript-browser",target:"_blank",children:"JavaScript SDK"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/react",target:"_blank",children:"React SDK"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/ios-proxy",target:"_blank",children:"iOS SDK"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/android-proxy",target:"_blank",children:"Android SDK"})})})]})]})}),s(_n,{item:!0,children:T("section",{children:[s(Zh,{children:"About"}),T(c0,{dense:!0,children:[s(wr,{children:s(un,{primary:s("a",{href:"https://www.getunleash.io/",target:"_blank",children:"getunleash.io"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://twitter.com/getunleash",target:"_blank",children:"Twitter"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://www.linkedin.com/company/getunleash",target:"_blank",children:"LinkedIn"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://github.com/Unleash/unleash",target:"_blank",children:"GitHub"})})}),s(wr,{children:s(un,{primary:s("a",{href:"https://slack.unleash.run",target:"_blank",children:"Slack Community"})})})]})]})})]})})]})})},o2e=E(Xt)(({theme:e})=>({marginBottom:e.spacing(2)})),i2e=E(ke)(({theme:e})=>({maxWidth:"800px"})),a2e=E("a")(({theme:e})=>({display:"block",marginTop:e.spacing(1),width:"100px"})),s2e=e=>!(!e||localStorage&&localStorage.getItem(e)),l2e=({toast:e})=>{const[t,n]=f.useState(!1);f.useEffect(()=>{n(s2e((e==null?void 0:e.id)||""))},[e==null?void 0:e.id]);const r=()=>{localStorage&&localStorage.setItem((e==null?void 0:e.id)||"","seen"),n(!1)};return e?s(X,{condition:t,show:T(o2e,{severity:e.severity,onClose:r,children:[s(i2e,{variant:"body2",children:e.message}),s(a2e,{href:e.link,target:"_blank",rel:"noopener noreferrer",children:"View more"})]})}):null},c2e=E("div")(({theme:e})=>({height:e.spacing(2.5),margin:e.spacing(2,0)})),u2e=E(pG)({"& > ol":{flexWrap:"nowrap","& > li:last-child":{minWidth:0}}}),c$=E("p")(Kne),d2e=E(on)(({theme:e})=>({"& > *":{maxWidth:e.spacing(25)}})),p2e=()=>{const{isAdmin:e}=f.useContext(Qr),t=ri(),n=t.pathname.split("/").filter(r=>r).filter(r=>r!=="create"&&r!=="edit"&&r!=="view"&&r!=="variants"&&r!=="logs"&&r!=="metrics"&&r!=="copy"&&r!=="features"&&r!=="features2"&&r!=="create-toggle"&&r!=="settings"&&r!=="profile");return s(c2e,{children:s(X,{condition:t.pathname.includes("admin")&&e||!t.pathname.includes("admin"),show:s(X,{condition:n.length>1,show:s(u2e,{"aria-label":"Breadcrumbs",children:n.map((r,o)=>{if(o===n.length-1)return s(c$,{children:r},r);let a="/";return n.forEach((l,c)=>{c!==o&&c<o?a+=l+"/":c===o&&(a+=l)}),s(d2e,{to:a,children:s(c$,{children:r})},r)})})})})})},f2e="/static/texture-c29e66c0.png",ED="skip-nav-target-id",h2e=()=>s("div",{id:ED}),m2e=E("a")(({theme:e})=>({position:"fixed",overflow:"hidden",zIndex:1e3,top:e.spacing(2.25),left:e.spacing(2.25),padding:e.spacing(1,2),whiteSpace:"nowrap",textDecoration:"none",background:e.palette.primary.dark,color:e.palette.primary.contrastText,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallBody,[e.breakpoints.down(960)]:{top:"0.8rem",left:"0.8rem"},"&:not(:focus):not(:active)":{clip:"rect(0 0 0 0)",clipPath:"inset(50%)",zIndex:-1,width:1,height:1,margin:-1,padding:0}})),g2e=()=>T(m2e,{href:`#${ED}`,children:["Skip to content ",s("span",{"aria-hidden":!0,children:"↓"})]}),v2e=({featureName:e,projectId:t,conflict:n,onNavigate:r,children:o})=>T(S4,{elevation:0,sx:i=>({marginTop:i.spacing(2),overflow:"hidden"}),children:[T(Je,{sx:i=>({backgroundColor:(Boolean(n),i.palette.neutral.light),borderRadius:a=>`${a.shape.borderRadiusLarge}px ${a.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:a=>n?a.palette.warning.border:a.palette.tertiary.main,borderBottom:"none",overflow:"hidden"}),children:[s(X,{condition:Boolean(n),show:T(Xt,{severity:"warning",sx:{px:3,mb:2,"&.MuiAlert-standardWarning":{borderStyle:"none"}},children:[s("strong",{children:"Conflict!"})," ",n,"."]})}),T(Je,{sx:{display:"flex",pt:n?0:2,pb:2,px:3},children:[s(ke,{children:"Feature toggle name: "}),s(po,{component:on,to:`/projects/${t}/features/${e}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:r,children:s("strong",{children:e})})]})]}),s(Je,{children:o})]}),y2e=e=>typeof e=="object"&&e!==null&&"name"in e;var b2e=200,z2="__lodash_hash_undefined__",w2e=1/0,kD=9007199254740991,S2e="[object Arguments]",x2e="[object Function]",C2e="[object GeneratorFunction]",E2e="[object Symbol]",k2e=/[\\^$.*+?()[\]{}|]/g,T2e=/^\[object .+?Constructor\]$/,_2e=/^(?:0|[1-9]\d*)$/,R2e=typeof Rn=="object"&&Rn&&Rn.Object===Object&&Rn,P2e=typeof self=="object"&&self&&self.Object===Object&&self,j2=R2e||P2e||Function("return this")();function $2e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function I2e(e,t){var n=e?e.length:0;return!!n&&L2e(e,t,0)>-1}function A2e(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function TD(e,t){for(var n=-1,r=e?e.length:0,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function U2(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function O2e(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function L2e(e,t,n){if(t!==t)return O2e(e,D2e,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}function D2e(e){return e!==e}function N2e(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function M2e(e){return function(t){return e(t)}}function B2e(e,t){return e.has(t)}function F2e(e,t){return e==null?void 0:e[t]}function z2e(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function _D(e,t){return function(n){return e(t(n))}}var j2e=Array.prototype,U2e=Function.prototype,oy=Object.prototype,u0=j2["__core-js_shared__"],u$=function(){var e=/[^.]+$/.exec(u0&&u0.keys&&u0.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),RD=U2e.toString,Su=oy.hasOwnProperty,W2=oy.toString,W2e=RegExp("^"+RD.call(Su).replace(k2e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),d$=j2.Symbol,H2e=_D(Object.getPrototypeOf,Object),V2e=oy.propertyIsEnumerable,G2e=j2e.splice,p$=d$?d$.isConcatSpreadable:void 0,yw=Object.getOwnPropertySymbols,f$=Math.max,q2e=$D(j2,"Map"),Ip=$D(Object,"create");function kl(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Y2e(){this.__data__=Ip?Ip(null):{}}function K2e(e){return this.has(e)&&delete this.__data__[e]}function X2e(e){var t=this.__data__;if(Ip){var n=t[e];return n===z2?void 0:n}return Su.call(t,e)?t[e]:void 0}function J2e(e){var t=this.__data__;return Ip?t[e]!==void 0:Su.call(t,e)}function Q2e(e,t){var n=this.__data__;return n[e]=Ip&&t===void 0?z2:t,this}kl.prototype.clear=Y2e;kl.prototype.delete=K2e;kl.prototype.get=X2e;kl.prototype.has=J2e;kl.prototype.set=Q2e;function xu(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Z2e(){this.__data__=[]}function eEe(e){var t=this.__data__,n=iy(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():G2e.call(t,n,1),!0}function tEe(e){var t=this.__data__,n=iy(t,e);return n<0?void 0:t[n][1]}function nEe(e){return iy(this.__data__,e)>-1}function rEe(e,t){var n=this.__data__,r=iy(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}xu.prototype.clear=Z2e;xu.prototype.delete=eEe;xu.prototype.get=tEe;xu.prototype.has=nEe;xu.prototype.set=rEe;function Cu(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function oEe(){this.__data__={hash:new kl,map:new(q2e||xu),string:new kl}}function iEe(e){return ay(this,e).delete(e)}function aEe(e){return ay(this,e).get(e)}function sEe(e){return ay(this,e).has(e)}function lEe(e,t){return ay(this,e).set(e,t),this}Cu.prototype.clear=oEe;Cu.prototype.delete=iEe;Cu.prototype.get=aEe;Cu.prototype.has=sEe;Cu.prototype.set=lEe;function ig(e){var t=-1,n=e?e.length:0;for(this.__data__=new Cu;++t<n;)this.add(e[t])}function cEe(e){return this.__data__.set(e,z2),this}function uEe(e){return this.__data__.has(e)}ig.prototype.add=ig.prototype.push=cEe;ig.prototype.has=uEe;function dEe(e,t){var n=H2(e)||ID(e)?N2e(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||Su.call(e,i))&&!(o&&(i=="length"||CEe(i,r)))&&n.push(i);return n}function iy(e,t){for(var n=e.length;n--;)if($Ee(e[n][0],t))return n;return-1}function pEe(e,t,n,r){var o=-1,i=I2e,a=!0,l=e.length,c=[],u=t.length;if(!l)return c;n&&(t=TD(t,M2e(n))),r?(i=A2e,a=!1):t.length>=b2e&&(i=B2e,a=!1,t=new ig(t));e:for(;++o<l;){var d=e[o],p=n?n(d):d;if(d=r||d!==0?d:0,a&&p===p){for(var h=u;h--;)if(t[h]===p)continue e;c.push(d)}else i(t,p,r)||c.push(d)}return c}function PD(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=xEe),o||(o=[]);++i<a;){var l=e[i];t>0&&n(l)?t>1?PD(l,t-1,n,r,o):U2(o,l):r||(o[o.length]=l)}return o}function fEe(e,t,n){var r=t(e);return H2(e)?r:U2(r,n(e))}function hEe(e){if(!V2(e)||kEe(e))return!1;var t=OD(e)||z2e(e)?W2e:T2e;return t.test(PEe(e))}function mEe(e){if(!V2(e))return _Ee(e);var t=TEe(e),n=[];for(var r in e)r=="constructor"&&(t||!Su.call(e,r))||n.push(r);return n}function gEe(e,t){return e=Object(e),vEe(e,t,function(n,r){return r in e})}function vEe(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],l=e[a];n(l,a)&&(i[a]=l)}return i}function yEe(e,t){return t=f$(t===void 0?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=f$(n.length-t,0),i=Array(o);++r<o;)i[r]=n[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=n[r];return a[t]=i,$2e(e,this,a)}}function bEe(e){return fEe(e,LEe,SEe)}function ay(e,t){var n=e.__data__;return EEe(t)?n[typeof t=="string"?"string":"hash"]:n.map}function $D(e,t){var n=F2e(e,t);return hEe(n)?n:void 0}var wEe=yw?_D(yw,Object):DD,SEe=yw?function(e){for(var t=[];e;)U2(t,wEe(e)),e=H2e(e);return t}:DD;function xEe(e){return H2(e)||ID(e)||!!(p$&&e&&e[p$])}function CEe(e,t){return t=t??kD,!!t&&(typeof e=="number"||_2e.test(e))&&e>-1&&e%1==0&&e<t}function EEe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function kEe(e){return!!u$&&u$ in e}function TEe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||oy;return e===n}function _Ee(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function REe(e){if(typeof e=="string"||OEe(e))return e;var t=e+"";return t=="0"&&1/e==-w2e?"-0":t}function PEe(e){if(e!=null){try{return RD.call(e)}catch{}try{return e+""}catch{}}return""}function $Ee(e,t){return e===t||e!==e&&t!==t}function ID(e){return IEe(e)&&Su.call(e,"callee")&&(!V2e.call(e,"callee")||W2.call(e)==S2e)}var H2=Array.isArray;function AD(e){return e!=null&&AEe(e.length)&&!OD(e)}function IEe(e){return LD(e)&&AD(e)}function OD(e){var t=V2(e)?W2.call(e):"";return t==x2e||t==C2e}function AEe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=kD}function V2(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function LD(e){return!!e&&typeof e=="object"}function OEe(e){return typeof e=="symbol"||LD(e)&&W2.call(e)==E2e}function LEe(e){return AD(e)?dEe(e,!0):mEe(e)}var DEe=yEe(function(e,t){return e==null?{}:(t=TD(PD(t,1),REe),gEe(e,pEe(bEe(e),t)))});function DD(){return[]}var NEe=DEe;const MEe=(e,t,n,r)=>{var a,l;return(l=(a=xl(t,n).feature)==null?void 0:a.environments.find(c=>c.name===r))==null?void 0:l.strategies.find(c=>"id"in e.payload&&c.id===e.payload.id)},d0=({change:e,project:t,feature:n,environmentName:r})=>{const o=MEe(e,t,n,r),i=e.action==="deleteStrategy"?void 0:e.payload;return s(bL,{children:s(qv,{entry:{preData:NEe(o,"sortOrder"),data:i}})})},p0=({change:e,children:t})=>{const[n,r]=jt.useState(null),o=l=>{r(l.currentTarget)},i=()=>{r(null)},a=Boolean(n);return T(Re,{children:[s(Xce,{strategyName:e.payload.name}),s(ke,{onMouseEnter:o,onMouseLeave:i,children:kp(e.payload.name)}),s(Px,{id:String(e.id),sx:{pointerEvents:"none"},open:a,anchorEl:n,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:i,disableRestoreFocus:!0,children:t})]})},h$=({percentage:e,size:t="4rem"})=>{const n=sn(),r={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:t,width:t,background:n.palette.grey[200]},o=100/(2*Math.PI),i=2*o;return s("svg",{viewBox:`0 0 ${i} ${i}`,style:r,"aria-hidden":!0,children:s("circle",{r:o,cx:o,cy:o,fill:"none",stroke:n.palette.primary.light,strokeWidth:i,strokeDasharray:`${e} 100`})})},BEe=E("div")(({theme:e})=>({width:"100%",padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.divider}`})),FEe=E("p")(({theme:e})=>({display:"inline",margin:e.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),zEe=E(wo)(({theme:e})=>({margin:e.spacing(.5)})),f0=({value:e,text:t})=>s(BEe,{children:s(X,{condition:e.length===0,show:T("p",{children:["No ",t,"s added yet."]}),elseShow:T("div",{children:[T(FEe,{children:[e.length," ",e.length>1?`${t}s`:t," will get access."]}),e.map(n=>s(zEe,{label:s(Li,{maxWidth:"300",text:n,maxLength:50})},n))]})})}),jEe=({segments:e})=>!e||e.length===0?null:s(Re,{children:e.map((t,n)=>T(f.Fragment,{children:[s(X,{condition:n>0,show:s(I2,{text:"AND"})}),s(gD,{segment:t})]},t.id))}),m$=()=>s(Je,{sx:{px:3,color:"text.disabled"},children:"This strategy does not have constraints or parameters."}),Us=E(Je)(({theme:e})=>({padding:e.spacing(2,3),border:`1px solid ${e.palette.dividerAlternative}`,borderRadius:e.shape.borderRadiusMedium})),h0=E("span")(({theme:e})=>({color:e.palette.neutral.main})),g$=({strategy:e})=>{const{parameters:t,constraints:n=[]}=e,{strategies:r}=hu(),{uiConfig:o}=Lt(),{segments:i}=Dl(),a=i==null?void 0:i.filter(p=>{var h;return(h=e.segments)==null?void 0:h.includes(p.id)}),l=r.find(p=>p.name===e.name),c=f.useMemo(()=>!t||l!=null&&l.editable?null:Object.keys(t).map(p=>{switch(p){case"rollout":case"Rollout":const h=Ud(t[p]);return T(Us,{sx:{display:"flex",alignItems:"center"},children:[s(Je,{sx:{mr:2},children:s(h$,{percentage:h,size:"2rem"})}),T("div",{children:[s(wo,{color:"success",variant:"outlined",size:"small",label:`${h}%`})," ","of your base"," ",n.length>0?"who match constraints":""," ","is included."]})]});case"userIds":case"UserIds":const m=rs(t[p]);return s(f0,{value:m,text:"user"},p);case"hostNames":case"HostNames":const y=rs(t[p]);return s(f0,{value:y,text:"host"},p);case"IPs":const v=rs(t[p]);return s(f0,{value:v,text:"IP"},p);case"stickiness":case"groupId":return null;default:return null}}),[t,l,n]),u=f.useMemo(()=>{if(!t||!(l!=null&&l.editable))return null;const p=s(h0,{children:" is set to "});return l==null?void 0:l.parameters.map(h=>{const{type:m,name:y}={...h};if(!m||!y||t[y]===void 0)return null;const v=s(Li,{maxLength:15,maxWidth:"150",text:y});switch(h==null?void 0:h.type){case"list":const b=rs(t[y]);return b.length>0?T(Us,{children:[v," ",T(h0,{children:["has ",b.length," ",b.length>1?"items":"item",":"," ",b.map(C=>s(wo,{label:s(Li,{maxWidth:"300",text:C,maxLength:50}),sx:{mr:.5}},C))]})]}):null;case"percentage":const w=Ud(t[y]);return t[y]!==""?T(Us,{sx:{display:"flex",alignItems:"center"},children:[s(Je,{sx:{mr:2},children:s(h$,{percentage:w,size:"2rem"})}),T("div",{children:[v,p,s(wo,{color:"success",variant:"outlined",size:"small",label:`${w}%`})]})]}):null;case"boolean":return t[y]==="true"||t[y]==="false"?T(Us,{children:[s(Li,{maxLength:15,maxWidth:"150",text:y}),p,s(wo,{color:t[y]==="true"?"success":"error",variant:"outlined",size:"small",label:t[y]})]}):null;case"string":const g=fs(t[y]);return typeof t[y]<"u"?T(Us,{children:[v,s(X,{condition:g==="",show:s(h0,{children:" is an empty string"}),elseShow:T(Re,{children:[p,s(Li,{maxWidth:"300",text:g,maxLength:50})]})})]}):null;case"number":const S=Ud(t[y]);return t[y]!==""&&S!==void 0?T(Us,{children:[v,p,s(Li,{maxWidth:"300",text:String(S),maxLength:50})]}):null;case"default":return null}return null})},[t,l]);if(!t)return s(m$,{});const d=[Boolean(o.flags.SE)&&a&&a.length>0&&s(jEe,{segments:a}),n.length>0&&s(ny,{constraints:n,showLabel:!1}),e.name==="default"&&s(Re,{children:T(Us,{sx:{width:"100%"},children:["The standard strategy is"," ",s(wo,{variant:"outlined",size:"small",color:"success",label:"ON"})," ","for all users."]})}),...c??[],...u??[]].filter(Boolean);return s(X,{condition:d.length>0,show:s(Re,{children:d.map((p,h)=>T(f.Fragment,{children:[s(X,{condition:h>0,show:s(I2,{text:"AND"})}),p]},h))}),elseShow:s(m$,{})})},ND=E(Je)({display:"flex",justifyContent:"space-between",alignItems:"center"}),MD=E(Je)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2)})),G2=E(Je)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)})),UEe=({children:e,discard:t})=>T(MD,{children:[T(G2,{children:[s(ke,{sx:n=>({color:n.palette.success.dark}),children:"+ Adding strategy:"}),e]}),t]}),WEe=({children:e,discard:t})=>T(MD,{children:[T(G2,{children:[s(ke,{children:"Editing strategy:"}),e]}),t]}),HEe=({discard:e,children:t})=>T(ND,{children:[T(G2,{children:[s(ke,{sx:n=>({color:n.palette.error.main}),children:"- Deleting strategy"}),t]}),e]}),VEe=({enabled:e,discard:t})=>T(ND,{children:[T(Je,{sx:{display:"flex",alignItems:"center"},children:["New status:"," ",s(bi,{sx:n=>({marginLeft:n.spacing(1)}),color:e?"success":"error",children:e?" Enabled":"Disabled"})]}),t]}),GEe=E("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),qEe=({preData:e,data:t})=>s(GEe,{children:s(qv,{entry:{preData:e,data:t}})}),YEe=E(Je)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2)})),KEe=E(Je)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),XEe=({feature:e,project:t,environment:n,change:r,discard:o})=>{var l;const{feature:i}=xl(t,e),a=(l=i.environments.find(({name:c})=>n===c))==null?void 0:l.variants;return T(YEe,{children:[T(KEe,{children:[s(ke,{children:"Updating variants:"}),s(qEe,{preData:a,data:r.payload.variants})]}),o]})},JEe=E(Je,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$hasConflict:t,$isInConflictFeature:n,$isAfterWarning:r,$isLast:o})=>({borderLeft:"1px solid",borderRight:"1px solid",borderTop:"1px solid",borderBottom:o?"1px solid":"none",borderRadius:o?`0 0
|
|
385
385
|
${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`:0,borderColor:t||n?e.palette.warning.border:e.palette.dividerAlternative,borderTopColor:(t||r)&&!n?e.palette.warning.border:e.palette.dividerAlternative})),QEe=E(Xt)(({theme:e})=>({borderRadius:0,padding:e.spacing(0,2),"&.MuiAlert-standardWarning":{borderStyle:"none none solid none"}})),ZEe=({index:e,change:t,feature:n,changeRequest:r,discard:o})=>{var i;return T(JEe,{$hasConflict:Boolean(t.conflict),$isInConflictFeature:Boolean(n.conflict),$isAfterWarning:Boolean((i=n.changes[e-1])==null?void 0:i.conflict),$isLast:e+1===n.changes.length,children:[s(X,{condition:Boolean(t.conflict)&&!n.conflict,show:T(QEe,{severity:"warning",children:[s("strong",{children:"Conflict!"})," This change can’t be applied."," ",t.conflict,"."]})}),T(Je,{sx:a=>({padding:a.spacing(3)}),children:[t.action==="updateEnabled"&&s(VEe,{enabled:t.payload.enabled,discard:o}),t.action==="addStrategy"&&T(Re,{children:[s(UEe,{discard:o,children:s(p0,{change:t,children:s(d0,{change:t,feature:n.name,environmentName:r.environment,project:r.project})})}),s(g$,{strategy:t.payload})]}),t.action==="deleteStrategy"&&s(HEe,{discard:o,children:y2e(t.payload)&&s(p0,{change:t,children:s(d0,{change:t,feature:n.name,environmentName:r.environment,project:r.project})})}),t.action==="updateStrategy"&&T(Re,{children:[s(WEe,{discard:o,children:s(p0,{change:t,children:s(d0,{change:t,feature:n.name,environmentName:r.environment,project:r.project})})}),s(g$,{strategy:t.payload})]}),t.action==="patchVariant"&&s(XEe,{feature:n.name,project:r.project,environment:r.environment,change:t,discard:o})]})]},tD(t))},q2=e=>e.features.flatMap(t=>t.changes).length,eke=e=>{const{isChangeRequestConfigured:t}=ff(e.project),n=t(e.environment),r=!["Cancelled","Applied"].includes(e.state),{user:o}=si(),i=(o==null?void 0:o.id)===e.createdBy.id;return n&&r&&i&&q2(e)>1},tke=E(po)(()=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),nke=({onDiscard:e})=>s(Je,{children:s(tke,{onClick:e,children:"Discard"})}),rke=({changeRequest:e,changeId:t,onPostDiscard:n})=>{const r=eke(e),{discardChange:o}=D2(),{setToastData:i,setToastApiError:a}=It();return s(X,{condition:r,show:s(nke,{onDiscard:(c=>async()=>{try{await o(e.project,e.id,c),i({title:"Change discarded from change request draft.",type:"success"}),n==null||n()}catch(u){a(ht(u))}})(t)})})},oke=({changeRequest:e,onRefetch:t,onNavigate:n})=>{var r;return s(Je,{children:(r=e.features)==null?void 0:r.map(o=>s(v2e,{featureName:o.name,projectId:e.project,onNavigate:n,conflict:o.conflict,children:o.changes.map((i,a)=>s(ZEe,{discard:s(rke,{changeRequest:e,changeId:i.id,onPostDiscard:t}),index:a,changeRequest:e,change:i,feature:o},a))},o.name))})},v$=()=>s(bi,{color:"secondary",icon:s(Jee,{fontSize:"small"}),children:"Review required"}),ike=()=>s(bi,{color:"warning",children:"Draft"}),ake=({state:e})=>{switch(e){case"Draft":return s(ike,{});case"In review":return s(v$,{});case"Approved":return s(bi,{color:"success",icon:s(zm,{fontSize:"small"}),children:"Approved"});case"Applied":return s(bi,{color:"success",icon:s(zm,{fontSize:"small"}),children:"Applied"});case"Cancelled":return s(bi,{color:"error",icon:s(vv,{fontSize:"small"}),children:"Cancelled"});default:return s(v$,{})}},ske=({onClick:e,count:t})=>T(rt,{sx:{ml:"auto"},variant:"contained",onClick:e,children:["Submit change request (",t,")"]}),lke=({environmentChangeRequest:e,onClose:t,onReview:n,onDiscard:r,children:o})=>{const i=sn(),a=ft();return T(Je,{sx:{padding:3,border:"2px solid",mb:5,borderColor:l=>l.palette.secondaryContainer,borderRadius:l=>`${l.shape.borderRadiusLarge}px`},children:[T(Je,{sx:{display:"flex",alignItems:"end"},children:[T(Je,{sx:{display:"flex",alignItems:"center"},children:[s(a3,{sx:l=>({color:l.palette.primary.light,mr:.5})}),s(ke,{component:"span",variant:"h2",children:e.environment}),s(mke,{}),s(gke,{count:e.features.length})]}),s(Je,{sx:{ml:"auto"},children:s(ake,{state:e.state})})]}),s(uo,{sx:{my:3}}),s(ke,{variant:"body2",color:"text.secondary",children:"You request changes for these feature toggles:"}),o,T(Je,{sx:{display:"flex",mt:3},children:[s(X,{condition:(e==null?void 0:e.state)==="Draft",show:T(Re,{children:[s(ske,{onClick:()=>n(e.id),count:q2(e)}),s(rt,{sx:{ml:2},variant:"outlined",onClick:()=>r(e.id),children:"Discard changes"})]})}),s(X,{condition:e.state==="In review"||e.state==="Approved",show:s(Re,{children:T(hke,{children:[s(fke,{}),s(ke,{color:i.palette.success.dark,children:"Draft successfully sent to review"}),s(rt,{sx:{marginLeft:2},variant:"outlined",onClick:()=>{t(),a(`/projects/${e.project}/change-requests/${e.id}`)},children:"View change request page"})]})})})]})]},e.id)},cke=E(Bx)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginLeft:"0.3rem",color:e.palette.grey[700]})),uke=E("div")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody})),dke=()=>s(xn,{actions:"",titleElement:T(Re,{children:[T(Je,{sx:{display:"flex",alignItems:"center"},children:["Review your changes",s(Tt,{title:"Here you can see all the changes that you are suggesting and you can send them for review. You can still discard the changes after you sent them for review or even cancel the entire review if you need it",arrow:!0,children:s(cke,{})})]}),s(uke,{children:"Make sure you are sending the right changes to be reviewed"})]})}),y$=E(gr)(({theme:e})=>({height:"100vh",overflow:"auto",minWidth:"50vw",padding:e.spacing(6),[e.breakpoints.down("md")]:{padding:e.spacing(4,2)},"& .header":{padding:e.spacing(0,0,2,0)},"& .body":{padding:e.spacing(3,0,0,0)},borderRadius:`${e.spacing(1.5,0,0,1.5)} !important`})),pke=E(rt)(({theme:e})=>({marginTop:e.spacing(2),marginLeft:"auto"})),fke=E(Xee)(({theme:e})=>({color:e.palette.success.main,height:"32px",width:"32px",marginRight:e.spacing(1)})),hke=E(Je)(()=>({marginLeft:"auto",display:"flex",alignItems:"center"})),mke=()=>s(ke,{component:"span",sx:{marginLeft:1.5,marginRight:1.5,color:"dividerAlternative"},children:"|"}),gke=({count:e})=>T(Je,{children:[T(ke,{component:"span",variant:"body1",color:"text.secondary",children:["Updates:"," "]}),T(ke,{component:"span",sx:{fontWeight:"bold"},children:[e," ",e===1?"feature toggle":"feature toggles"]})]}),vke=({open:e,project:t,onClose:n})=>{const{data:r,loading:o,refetch:i}=ry(t),{changeState:a,discardDraft:l}=D2(),{setToastApiError:c}=It(),u=async p=>{try{await a(t,p,{state:"In review"}),i()}catch(h){c(ht(h))}},d=async p=>{try{await l(t,p),i()}catch(h){c(ht(h))}};return!o&&!r?s(iP,{open:e,onClose:n,label:"Review changes",children:T(y$,{disableBorder:!0,header:s(xn,{titleElement:"Review your changes"}),children:["There are no changes to review.",s(pke,{onClick:n,children:"Close"})]})}):s(iP,{open:e,onClose:n,label:"Review changes",children:s(y$,{disableBorder:!0,header:s(dke,{}),children:r==null?void 0:r.map(p=>s(lke,{environmentChangeRequest:p,onClose:n,onReview:u,onDiscard:d,children:s(oke,{changeRequest:p,onNavigate:n,onRefetch:i})},p.id))})})},yke=E(Je)(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing(1,0),[e.breakpoints.down("lg")]:{padding:e.spacing(1,2)},color:e.palette.warning.main})),bke=E(Je)(({theme:e})=>({width:"1250px",marginLeft:"auto",marginRight:"auto",[e.breakpoints.down("lg")]:{width:"1024px"},[e.breakpoints.down(1024)]:{width:"100%",marginLeft:0,marginRight:0},[e.breakpoints.down("sm")]:{minWidth:"100%"}})),wke=({changeRequest:e,onClick:t})=>s(bke,{children:T(yke,{children:[T(ke,{variant:"body2",sx:{mr:4},children:[s("strong",{children:"Change request mode"})," – You have changes"," ",s(X,{condition:Boolean(e.environment),show:T(Re,{children:["in ",T("strong",{children:[e.environment," "]})]})}),s(X,{condition:e.state==="Draft",show:"that need to be reviewed"}),s(X,{condition:e.state==="In review",show:"that are in review"}),s(X,{condition:e.state==="Approved",show:"that are approved. Adding more changes will clear the approvals and require a new review"})]}),T(rt,{variant:"contained",onClick:t,sx:{ml:"auto"},children:["View changes (",q2(e),")"]})]})}),Ske=E(Je)(({theme:e})=>({position:"sticky",top:-1,zIndex:250,borderTop:`1px solid ${e.palette.warning.border}`,borderBottom:`1px solid ${e.palette.warning.border}`,backgroundColor:e.palette.warning.light})),xke=({project:e})=>{const[t,n]=f.useState(!1),{data:r,loading:o}=ry(e);return!o&&!r||(r==null?void 0:r.length)===0?null:T(Ske,{children:[r!=null&&r.length?r.filter(i=>["Draft","In review","Approved"].includes(i.state)).map(i=>s(wke,{changeRequest:i,onClick:()=>{n(!0)}},i.id)):null,s(vke,{project:e,open:t,onClose:()=>{n(!1)}})]})},Cke=E(_n)(()=>({height:"100%",justifyContent:"space-between"})),Eke=E("main")(({theme:e})=>({margin:e.spacing(0,"auto"),overflow:"auto",flex:1,width:"100%",backgroundColor:e.palette.contentWrapper,position:"relative"})),kke=E(_n)(({theme:e})=>({width:"1250px",margin:"0 auto",[e.breakpoints.down("lg")]:{width:"1024px"},[e.breakpoints.down(1024)]:{width:"100%",marginLeft:0,marginRight:0},[e.breakpoints.down("sm")]:{minWidth:"100%"}})),Tke=E("img")(()=>({display:"block",position:"fixed",zIndex:0,bottom:0,right:0,width:400,pointerEvents:"none",userSelect:"none"})),_ke=E("div")(({theme:e})=>({height:"100%",padding:e.spacing(0,0,6.5,0),position:"relative",[e.breakpoints.down("md")]:{padding:e.spacing(0,1.5,6.5,1.5)},zIndex:200})),Rke=f.forwardRef(({children:e},t)=>{const{uiConfig:n}=Lt(),r=xO("projectId"),{isChangeRequestConfiguredInAnyEnv:o}=ff(r||"");return T(Re,{children:[s(g2e,{}),s(QCe,{}),s(h2e,{}),T(Cke,{children:[T(Eke,{children:[s(X,{condition:Boolean(r&&o()),show:s(xke,{project:r||""})}),s(kke,{item:!0,xs:12,sm:12,my:2,children:T(_ke,{ref:t,children:[s(p2e,{}),s(l2e,{toast:n.toast}),e]})}),s(Tke,{src:Js(f2e),alt:""})]}),s(r2e,{})]})]})}),Pke=({isStandalone:e,children:t})=>s(X,{condition:e===!0,show:t,elseShow:s(Rke,{children:t})}),$ke=E("div")(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:e.spacing(4),position:"fixed",inset:0,backgroundColor:e.palette.text.tertiaryContrast,width:"100%"})),Ike=E(U3)(({theme:e})=>({height:"80px"})),Ake=E("div")(({theme:e})=>({display:"flex",position:"relative"})),Oke=E("div")(({theme:e})=>({marginTop:e.spacing(4)})),Lke=E(rt)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),Dke=()=>{const e=ft();return s($ke,{children:T("div",{children:[s(Ike,{}),s(Ake,{children:s(ke,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),T(Oke,{children:[s(rt,{variant:"contained",color:"primary",onClick:()=>{e(Ao)},children:"Go back"}),s(Lke,{onClick:()=>{e("/")},children:"Go home"})]})]})})},Nke=()=>{const{pathname:e,search:t}=ri(),r=`/login?redirect=${encodeURIComponent(e+t)}`;return s(Il,{to:r,replace:!0})},Mke=({route:e})=>{const{user:t}=si();return!Boolean(t==null?void 0:t.id)&&e.type==="protected"?s(Nke,{}):s(e.component,{})},Bke=({children:e})=>{const{refetchUser:t}=si();return s(Uee,{value:{onError:r=>{r instanceof v3&&r.status===401&&t()}},children:e})};function Fke(e,t,n){const r=/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*:)*?:?0*1$/.test(location.hostname)||location.protocol==="file:";if(!t.trackLocalhost&&r)return console.warn("[Plausible] Ignoring event because website is running locally");try{if(window.localStorage.plausible_ignore==="true")return console.warn('[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage')}catch{}const o={n:e,u:t.url,d:t.domain,r:t.referrer,w:t.deviceWidth,h:t.hashMode?1:0,p:n&&n.props?JSON.stringify(n.props):void 0},i=new XMLHttpRequest;i.open("POST",`${t.apiHost}/api/event`,!0),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(o)),i.onreadystatechange=()=>{i.readyState===4&&n&&n.callback&&n.callback()}}function zke(e){const t=()=>({hashMode:!1,trackLocalhost:!1,url:location.href,domain:location.hostname,referrer:document.referrer||null,deviceWidth:window.innerWidth,apiHost:"https://plausible.io",...e}),n=(a,l,c)=>{Fke(a,{...t(),...c},l)},r=(a,l)=>{n("pageview",l,a)};return{trackEvent:n,trackPageview:r,enableAutoPageviews:()=>{const a=()=>r(),l=history.pushState;return l&&(history.pushState=function(c,u,d){l.apply(this,[c,u,d]),a()},addEventListener("popstate",a)),e&&e.hashMode&&addEventListener("hashchange",a),r(),function(){l&&(history.pushState=l,removeEventListener("popstate",a)),e&&e.hashMode&&removeEventListener("hashchange",a)}},enableAutoOutboundTracking:(a=document,l={subtree:!0,childList:!0,attributes:!0,attributeFilter:["href"]})=>{function c(m){n("Outbound Link: Click",{props:{url:this.href}}),typeof process<"u"&&process,setTimeout(()=>{location.href=this.href},150),m.preventDefault()}const u=new Set;function d(m){m instanceof HTMLAnchorElement?m.host!==location.host&&(m.addEventListener("click",c),u.add(m)):"querySelectorAll"in m&&m.querySelectorAll("a").forEach(d)}function p(m){m instanceof HTMLAnchorElement?(m.removeEventListener("click",c),u.delete(m)):"querySelectorAll"in m&&m.querySelectorAll("a").forEach(p)}const h=new MutationObserver(m=>{m.forEach(y=>{y.type==="attributes"?(p(y.target),d(y.target)):y.type==="childList"&&(y.addedNodes.forEach(d),y.removedNodes.forEach(p))})});return a.querySelectorAll("a").forEach(d),h.observe(a,l),function(){u.forEach(y=>{y.removeEventListener("click",c)}),u.clear(),h.disconnect()}}}}const jke="https://plausible.getunleash.io",Uke="app.unleash-hosted.com",m0=!1,Wke=({children:e})=>{var l;const[t,n]=f.useState(null),o=(()=>{var c;try{const u=((c=document.querySelector('meta[name="uiFlags"]'))==null?void 0:c.content)||"{}";return JSON.parse(u)}catch{return{}}})(),{uiConfig:i}=Lt(),a=Boolean(((l=i==null?void 0:i.flags)==null?void 0:l.T)||o.T||m0);return f.useEffect(()=>{if(a)try{const c=zke({domain:m0?void 0:Uke,apiHost:m0?"http://localhost:8000":jke,trackLocalhost:!0});return n(()=>c),c.enableAutoPageviews()}catch(c){console.warn(c)}},[a]),s(x3.Provider,{value:t,children:e})},Hke=ai()(e=>({container:{maxWidth:"450px",background:e.palette.background.paper,boxShadow:"2px 2px 4px rgba(0,0,0,0.4)",zIndex:500,margin:"0 0.8rem",borderRadius:"12.5px",padding:"2rem"},innerContainer:{position:"relative"},starting:{opacity:0},headerContainer:{display:"flex",alignItems:"center"},confettiContainer:{position:"relative",maxWidth:"600px",margin:"0 auto",display:"flex"},textContainer:{marginLeft:"1rem",wordBreak:"break-word"},headerStyles:{fontWeight:"normal",margin:0,marginBottom:"0.5rem"},createdContainer:{display:"flex",alignItems:"center",flexDirection:"column"},anim:{animation:"$drop 10s 3s"},checkMark:{width:"65px",height:"65px"},buttonStyle:{position:"absolute",top:"-33px",right:"-33px"},"@keyframes drop":{"0%":{opacity:"0%",top:"0%"},"10%":{opacity:"100%"},"100%":{top:"100%"}}})),Vke=E("div")(({theme:e})=>({backgroundColor:e.palette.checkmarkBadge,width:"75px",height:"75px",borderRadius:"50px",display:"flex",justifyContent:"center",alignItems:"center",[e.breakpoints.down("sm")]:{width:"50px",height:"50px"}})),Gke=E(vv)(({theme:e})=>({color:e.palette.tertiary.background,width:"35px",height:"35px"})),qke=E(zm)(({theme:e})=>({color:e.palette.tertiary.background,width:"35px",height:"35px"})),Yke=({type:e,className:t})=>s(Vke,{className:t,children:e==="error"?s(Gke,{titleAccess:"Error"}):s(qke,{})}),Kke=({title:e,text:t,type:n,confetti:r})=>{const{setToast:o}=f.useContext($s),{classes:i}=Hke(),a=["#d13447","#ffbf00","#263672"],l=200,c=p=>Math.floor(Math.random()*p)+1,u=()=>new Array(l).fill(1).map((m,y)=>{const v=c(8),b=c(100),w={position:"absolute",width:`${v}px`,height:`${v*.4}px`,backgroundColor:a[c(2)],left:`${b}%`,transform:`rotate(${c(101)}deg)`,animationDelay:`${c(5)}s`,animationDuration:`${c(3)}s`,animationEase:`${c(2)}s`};return s("div",{style:w,className:yi(i.starting,i.anim)},y)}),d=()=>{o(p=>({...p,show:!1}))};return s("div",{className:i.container,children:s("div",{className:i.innerContainer,children:T("div",{className:i.confettiContainer,children:[r&&u(),T("div",{className:i.createdContainer,children:[T("div",{className:i.headerContainer,children:[s("div",{children:s(Yke,{type:n,className:i.checkMark})}),T("div",{className:i.textContainer,children:[s("h3",{className:i.headerStyles,children:e}),s(X,{condition:Boolean(t),show:s("p",{"data-testid":nne,children:t})})]})]}),s(Tt,{title:"Close",arrow:!0,children:s(Qt,{onClick:d,className:i.buttonStyle,size:"large",children:s(wv,{})})})]})]})})})},Xke=()=>{const{toastData:e,setToast:t}=f.useContext($s),n=()=>{t(o=>({...o,show:!1}))};f.useEffect(()=>{if(!e.autoHideDuration)return;let o=setTimeout(()=>{n()},e.autoHideDuration);return()=>{clearTimeout(o)}},[e==null?void 0:e.show]);const r=f.useMemo(()=>({start:{...R3,right:0,left:0,margin:"0 auto",maxWidth:"450px"},enter:P3,leave:Qne}),[]);return s(mx,{children:s(qx,{mounted:Boolean(e==null?void 0:e.show),start:r.start,enter:r.enter,leave:r.leave,children:s(Kke,{...e})})})},Jke=()=>{const{pathname:e}=ri(),{user:t}=si(),{splash:n}=CL(),{uiConfig:r,loading:o}=Lt();if(!t||!n||!r||o||iA("/splash/:splashId",e)||t.isAPI)return null;const i=Ige.find(a=>!Qke(a,n));return i?s(Il,{to:`/splash/${i}`,replace:!0}):null},Qke=(e,t)=>Boolean(t[e]),Zke=E(tte)(({theme:e})=>({height:"20px",width:"20px",marginRight:e.spacing(1)})),eTe=E("div")(({theme:e})=>({display:"flex",fontSize:e.fontSizes.smallBody,justifyContent:"center",alignItems:"center",color:e.palette.error.main,backgroundColor:e.palette.error.light,height:"65px",borderBottom:`1px solid ${e.palette.error.border}`,whiteSpace:"pre-wrap"})),tTe=()=>T(eTe,{children:[s(Zke,{}),s("b",{children:"Maintenance Mode! "}),s("p",{children:"During maintenance mode, any changes made will not be saved and you may receive an error. We apologize for any inconvenience this may cause."})]}),nTe=()=>{const e=`${Ba}:unleash-lastViewedProject`,[t,n]=f.useState(()=>vp(e));return f.useEffect(()=>{t&&Uc(e,t)},[t,e]),{lastViewed:t,setLastViewed:n}},rTe=()=>{const{lastViewed:e}=nTe(),{projects:t,loading:n}=ja(),r=ft(),o=f.useCallback(()=>t&&e?`/projects/${e}`:t&&!e&&t.length===1?`/projects/${t[0].id}`:"/projects",[e,t]),i=()=>{r(o(),{replace:!0})};return f.useEffect(()=>{i()},[o]),n?s(Xm,{}):null},oTe=E("div")(()=>({"& ul":{margin:0}})),iTe=()=>{var a;const{authDetails:e}=mu(),{user:t}=si(),n=Boolean(e||t),{isOss:r,uiConfig:o}=Lt(),i=r()?$p.filter(l=>!l.enterprise):$p;return s(Rte,{FallbackComponent:lne,children:s(Bke,{children:s(f.Suspense,{fallback:s(Xm,{}),children:s(Wke,{children:s(X,{condition:!n,show:s(Xm,{}),elseShow:T(Re,{children:[s(X,{condition:Boolean((a=o==null?void 0:o.flags)==null?void 0:a.maintenance)&&Boolean(o==null?void 0:o.maintenanceMode),show:s(tTe,{})}),T(oTe,{children:[s(Xke,{}),T(JM,{children:[i.map(l=>s(Bh,{path:l.path,element:s(Pke,{isStandalone:l.isStandalone===!0,children:s(Mke,{route:l})})},l.path)),s(Bh,{path:"/",element:s(rTe,{})}),s(Bh,{path:"*",element:s(Dke,{})})]}),s(sre,{openUrl:"http://feedback.unleash.run"}),s(Jke,{})]})]})})})})})})},aTe=()=>{const{pathname:e}=ri();return f.useEffect(()=>{sTe.some(t=>e.includes(t))||window.scrollTo(0,0)},[e]),null},sTe=["/admin/api","/admin/users","/admin/auth","/admin/roles"],lTe=({children:e})=>{const{permissions:t}=WC(),n=f.useMemo(()=>({isAdmin:cTe(t),hasAccess:uTe.bind(null,t)}),[t]);return s(Qr.Provider,{value:n,children:e})},cTe=e=>e?e.some(t=>t.permission===xi):!1,uTe=(e,t,n,r)=>e?e.some(o=>dTe(o,t,n,r)):!1,dTe=(e,t,n,r)=>t?e.permission===xi||e.permission===t&&(e.project===n||e.project==="*")&&(e.environment===r||e.environment==="*")||e.permission===t&&(e.project===n||e.project==="*")&&e.environment===null?!0:e.permission===t&&e.project===void 0&&e.environment===null:(console.warn(`Missing permission for AccessProvider: ${t}`),!1),pTe=E("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",margin:"0 auto"})),b$=E("span")(({theme:e})=>({width:"6.25rem",whiteSpace:"nowrap",color:e.palette.text.secondary,"&:first-of-type":{textAlign:"right"},[e.breakpoints.down("sm")]:{display:"none"}})),fTe=E("label")(({theme:e})=>({"& input":{clip:"rect(0 0 0 0)",clipPath:"inset(50%)",overflow:"hidden",position:"absolute",whiteSpace:"nowrap",width:1,height:1},"& span":{display:"grid",justifyContent:"center",alignItems:"center",background:e.palette.grey[300],width:"3rem",height:"3rem",borderRadius:"10rem",fontSize:"1.25rem",paddingBottom:2,userSelect:"none",cursor:"pointer"},"& input:checked + span":{fontWeight:e.fontWeight.bold,background:e.palette.primary.main,color:e.palette.text.tertiaryContrast},"& input:focus-visible + span":{outline:"2px solid",outlineOffset:2,outlineColor:e.palette.primary.main}})),hTe=({form:e,setForm:t})=>{const n=r=>{t(Ho(o=>{o.score=Number(r.target.value)}))};return T(pTe,{children:[s(b$,{children:"Very difficult"}),[1,2,3,4,5,6,7].map(r=>T(fTe,{children:[s("input",{type:"radio",name:"score",value:r,checked:e.score===r,onChange:n}),s("span",{children:r})]},r)),s(b$,{children:"Very easy"})]})},mTe=async e=>{if(!e.score)return;const t={source:"app:segments",data:{score:e.score,comment:e.comment,currentPage:e.path,openedManually:!1,customerType:"paying"}};await fetch("https://europe-west3-metrics-304612.cloudfunctions.net/docs-app-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},gTe=E("div")(({theme:e})=>({fontWeight:e.fontWeight.thin})),vTe=E("h1")(({theme:e})=>({all:"unset",display:"block",textAlign:"center",color:e.palette.text.secondary})),yTe=E("form")(({theme:e})=>({display:"grid",gap:e.spacing(6),gridTemplateColumns:"minmax(auto, 40rem)",justifyContent:"center"})),bTe=E("p")(({theme:e})=>({all:"unset",display:"block",marginTop:e.spacing(5),fontSize:e.spacing(3),textAlign:"center"})),wTe=E("label")(({theme:e})=>({display:"block",marginBottom:e.spacing(1)})),STe=({state:e,onClose:t})=>{const[n,r]=f.useState(!1),{setToastData:o}=It(),[i,a]=f.useState({path:e.path}),l=u=>{a(Ho(d=>{d.comment=u.target.value}))};return T(gTe,{children:[s(vTe,{children:"Please help us improve"}),T(yTe,{onSubmit:async u=>{if(u.preventDefault(),!n)try{r(!0),await mTe(i),o({type:"success",title:"Feedback sent. Thank you!",confetti:!0}),t()}finally{r(!1)}},"aria-live":"polite",children:[s(bTe,{children:e.title}),s(hTe,{form:i,setForm:a}),T("div",{hidden:!i.score,children:[s(wTe,{htmlFor:"comment",children:e.text}),s(pn,{value:i.comment??"",onChange:l,multiline:!0,rows:3,variant:"outlined",fullWidth:!0})]}),s(Je,{hidden:!i.score,sx:{textAlign:"center"},children:s(rt,{type:"submit",color:"primary",variant:"contained",sx:{minWidth:"15rem"},disabled:!i.score||n,children:"Send feedback"})})]})]})},xTe=E("div")(({theme:e})=>({pointerEvents:"none",display:"grid",padding:e.spacing(2),overflowY:"auto",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw"})),CTe=E("div")(({theme:e})=>({pointerEvents:"auto",position:"relative",padding:e.spacing(8),background:e.palette.background.paper,boxShadow:"0 0 1rem rgba(0, 0, 0, 0.25)",borderRadius:e.spacing(2),[e.breakpoints.down("md")]:{padding:e.spacing(4)}})),ETe=E("div")({all:"unset",position:"absolute",top:0,right:0}),kTe=E(i3)(({theme:e})=>({fontSize:"1.5rem",color:e.palette.inactiveIcon})),TTe=({state:e})=>{const{hideFeedbackCES:t}=f.useContext(O2),n=e&&s(STe,{state:e,onClose:t});return s(Qp,{open:Boolean(e),onClose:t,"aria-label":e==null?void 0:e.title,children:s(xTe,{children:T(CTe,{children:[s(ETe,{children:s(Qt,{onClick:t,size:"large",children:s(kTe,{titleAccess:"Close"})})}),n]})})})},_Te=()=>{const{createFeedback:e}=A3(),{feedback:t}=Xx(),n=f.useCallback(o=>!!t&&t.some(i=>i.feedbackId===w$(o)),[t]),r=f.useCallback(o=>e({feedbackId:w$(o)}),[e]);return{isSeen:n,setSeen:r}},w$=e=>`ces${e.path}`,RTe=(e=window.location.hostname)=>e==="localhost",PTe=(e=window.location.hostname)=>e.endsWith(".getunleash.io")||e.endsWith(".unleash-hosted.com"),$Te=(e=window.location.hostname)=>e.endsWith(".vercel.app"),ITe=()=>PTe()||$Te()||RTe(),ATe=({children:e})=>{const[t,n]=f.useState(),{isSeen:r,setSeen:o}=_Te(),i=ITe();f.useEffect(()=>{t&&o(t)},[t,o]);const a=f.useCallback(u=>{n(d=>{const p=u instanceof Function?u(d):u;return!i||!p||r(p)?void 0:p})},[i,r]),l=f.useCallback(()=>{n(void 0)},[n]),c=f.useMemo(()=>({showFeedbackCES:a,hideFeedbackCES:l}),[a,l]);return T(O2.Provider,{value:c,children:[e,s(TTe,{state:t})]})},OTe=E("div")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",zIndex:-1,width:1,height:1,margin:-1,padding:0,overflow:"hidden"}),LTe=({announcement:e})=>s(OTe,{role:"status","aria-live":"polite","aria-atomic":!0,"data-testid":tne,children:e}),DTe=({children:e})=>{const[t,n]=f.useState(),r=f.useMemo(()=>({setAnnouncement:n}),[n]);return T(cC.Provider,{value:r,children:[e,s(LTe,{announcement:t})]})};var _a=(e=>(e.UNASSIGNED="UNASSIGNED",e.TRIAL="TRIAL",e.ACTIVE="ACTIVE",e.EXPIRED="EXPIRED",e.CHURNED="CHURNED",e))(_a||{}),dc=(e=>(e.PRO="Pro",e.COMPANY="Company",e.TEAM="Team",e.UNKNOWN="Unknown",e))(dc||{});const NTe=(e,t,n)=>{const{data:r,error:o,mutate:i}=gn(e,t,n),a=f.useCallback(()=>{i().catch(console.warn)},[i]);return{data:r,error:o,refetch:a,loading:!o&&!r}},MTe=()=>{const{uiConfig:e}=Lt(),{flags:{UNLEASH_CLOUD:t}}=e,{data:n,refetch:r,loading:o,error:i}=NTe(["useInstanceStatus",t],()=>BTe(t)),a=[dc.PRO,dc.COMPANY,dc.TEAM];return{instanceStatus:n,refetchInstanceStatus:r,refresh:async()=>{await fetch(Ft("api/instance/refresh"))},isBilling:a.includes((n==null?void 0:n.plan)??dc.UNKNOWN),loading:o,error:i}},BTe=async e=>{if(!e)return S$;const t=await fetch(Ft("api/instance/status"));return t.ok?t.json():S$},S$={plan:dc.UNKNOWN},FTe=10,zTe=e=>(e==null?void 0:e.state)===_a.TRIAL||(e==null?void 0:e.state)===_a.EXPIRED||(e==null?void 0:e.state)===_a.CHURNED,BD=e=>(e==null?void 0:e.state)===_a.EXPIRED||(e==null?void 0:e.state)===_a.CHURNED?!0:(e==null?void 0:e.state)===_a.TRIAL&&(e!=null&&e.trialExpiry)?Eae(pf(e.trialExpiry)):!1,jTe=e=>!e||e.state!==_a.TRIAL||!e.trialExpiry?!1:$3(pf(e.trialExpiry),new Date)<=FTe,x$=e=>Boolean(e&&e.state===_a.EXPIRED&&!e.trialExtended),UTe=E("aside")(({theme:e})=>({position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:e.spacing(1),gap:e.spacing(1),borderBottom:"1px solid",borderColor:e.palette.warning.border,background:e.palette.warning.light,color:e.palette.warning.dark})),FD=E("aside")(({theme:e})=>({position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:e.spacing(1),gap:e.spacing(1),borderBottom:"1px solid",borderColor:e.palette.info.border,background:e.palette.info.light,color:e.palette.info.dark})),WTe=E(rt)(({theme:e})=>({whiteSpace:"nowrap",minWidth:"8rem",marginLeft:e.spacing(2)})),HTe=E(p3)(({theme:e})=>({color:e.palette.warning.main})),zD=E(zd)(({theme:e})=>({color:e.palette.info.main})),VTe=({instanceStatus:e})=>BD(e)?s(GTe,{instanceStatus:e}):jTe(e)?s(qTe,{instanceStatus:e}):zTe(e)?s(YTe,{instanceStatus:e}):null,GTe=({instanceStatus:e})=>T(UTe,{"data-testid":Vx,children:[s(HTe,{}),T(ke,{sx:t=>({fontSize:t.fontSizes.smallBody}),children:[s("strong",{children:"Warning!"})," Your free ",e.plan," trial has expired. ",s("strong",{children:"Upgrade trial"})," otherwise your"," ",s("strong",{children:"account will be deleted."})]}),s(Y2,{})]}),qTe=({instanceStatus:e})=>{const t=Cae(pf(e.trialExpiry),{roundingMethod:"floor"});return T(FD,{"data-testid":Vx,children:[s(zD,{}),T(ke,{sx:n=>({fontSize:n.fontSizes.smallBody}),children:[s("strong",{children:"Heads up!"})," You have"," ",s("strong",{children:t})," left of your free"," ",e.plan," trial."]}),s(Y2,{})]})},YTe=({instanceStatus:e})=>T(FD,{"data-testid":Vx,children:[s(zD,{}),T(ke,{sx:t=>({fontSize:t.fontSizes.smallBody}),children:[s("strong",{children:"Heads up!"})," You're currently on a free"," ",e.plan," trial account."]}),s(Y2,{})]}),Y2=()=>{const{hasAccess:e}=f.useContext(Qr),t=ft();return e(xi)?s(WTe,{onClick:()=>t("/admin/billing"),variant:"outlined",children:"Upgrade trial"}):null},KTe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Un({propagateErrors:!0});return{extendTrial:async()=>{const a=t("api/instance/extend",{method:"POST"},"extendTrial");await e(a.caller,a.id)},loading:r,errors:n}},XTe=({instanceStatus:e,onExtendTrial:t})=>{const{hasAccess:n}=f.useContext(Qr),r=ft(),o=BD(e),[i,a]=f.useState(o),l=(c,u)=>{u||(a(!1),x$(e)&&t().catch(console.error))};return f.useEffect(()=>{a(o);const c=setInterval(()=>{a(o)},6e4);return()=>clearInterval(c)},[o]),n(xi)?s(cr,{open:i,primaryButtonText:"Upgrade trial",secondaryButtonText:x$(e)?"Extend trial (5 days)":"Remind me later",onClick:()=>{r("/admin/billing"),a(!1)},onClose:l,title:`Your free ${e.plan} trial has expired!`,children:T(ke,{children:[s("strong",{children:"Upgrade trial"})," otherwise your"," ",s("strong",{children:"account will be deleted."})]})}):s(cr,{open:i,secondaryButtonText:"Remind me later",onClose:()=>{a(!1)},title:`Your free ${e.plan} trial has expired!`,children:T(ke,{children:["Please inform your admin to ",s("strong",{children:"Upgrade trial"})," or your ",s("strong",{children:"account will be deleted."})]})})},JTe=({children:e})=>{const{instanceStatus:t,refetchInstanceStatus:n,isBilling:r}=MTe(),{extendTrial:o}=KTe(),{setToastApiError:i}=It(),a=sn(),l=async()=>{try{await o(),await n()}catch(c){i(ht(c))}};return T("div",{style:{height:"100%",backgroundColor:a.palette.background.paper},children:[s(X,{condition:r&&Boolean(t),show:()=>T(Re,{children:[s(QTe,{instanceStatus:t}),s(XTe,{instanceStatus:t,onExtendTrial:l})]})}),e]})},QTe=jt.memo(VTe),ZTe=e=>{const t=vp("unleash-theme");if(t)return t;let n;return e&&(n=window.matchMedia("(prefers-color-scheme: dark)").matches),n?"dark":"light"},e_e=({children:e,darkmode:t=!1})=>{const[n,r]=f.useState(q4()),[o,i]=f.useState(!1),[a,l]=f.useState(ZTe(t)),c=jt.useMemo(()=>({setToast:r,toastData:n,showFeedback:o,setShowFeedback:i,themeMode:a,setThemeMode:l}),[n,o,a]);return s($s.Provider,{value:c,children:e})},t_e=({children:e})=>{const{uiConfig:t}=Lt();return t.flags?s(e_e,{darkmode:t.flags.ENABLE_DARK_MODE_SUPPORT||!1,children:e}):null},C$=["http","https","mailto","tel"];function n_e(e){const t=(e||"").trim(),n=t.charAt(0);if(n==="#"||n==="/")return t;const r=t.indexOf(":");if(r===-1)return t;let o=-1;for(;++o<C$.length;){const i=C$[o];if(r===i.length&&t.slice(0,i.length).toLowerCase()===i)return t}return o=t.indexOf("?"),o!==-1&&r>o||(o=t.indexOf("#"),o!==-1&&r>o)?t:"javascript:void(0)"}/*!
|
|
386
386
|
* Determine if an object is a Buffer
|
|
387
387
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a_ as r,aJ as a,r as o,aK as c}from"./index-
|
|
1
|
+
import{a_ as r,aJ as a,r as o,aK as c}from"./index-c290f941.js";const u=(e={})=>{const{data:t,error:n,mutate:s}=r(a("api/admin/metrics/rps"),i,e);return o.useMemo(()=>({metrics:t,loading:!n&&!t,refetch:()=>s(),error:n}),[t,n,s])},i=e=>fetch(e).then(c("Instance Metrics")).then(t=>t.json()),f=e=>!e||e==="undefined"?"unknown":e;export{f as a,u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dU as d,a_ as f,aJ as n,r as a,aK as c,cj as l,aI as j}from"./index-
|
|
1
|
+
import{dU as d,a_ as f,aJ as n,r as a,aK as c,cj as l,aI as j}from"./index-c290f941.js";const B=d(),G=B,g=t=>t.map(e=>({...e.user,joinedAt:new Date(e.joinedAt),createdBy:e.createdBy})),$=t=>{const{data:e,error:o,mutate:r}=f(n(`api/admin/groups/${t}`),x);return a.useMemo(()=>({group:e&&{...e,users:g((e==null?void 0:e.users)??[])},loading:!o&&!e,refetchGroup:()=>r(),error:o}),[e,o,r])},x=t=>fetch(t).then(c("Group")).then(e=>e.json()),R=(t,e={})=>{const o=()=>{const i=n(`api/admin/roles/${t}`);return fetch(i,{method:"GET"}).then(c("project role")).then(m=>m.json())},{data:r,error:s}=l({},`api/admin/roles/${t}`,o,e),[u,p]=a.useState(!s&&!r),h=()=>{j(`api/admin/roles/${t}`)};return a.useEffect(()=>{p(!s&&!r)},[r,s]),{role:r||{},error:s,loading:u,refetch:h}};export{G as B,R as a,g as m,$ as u};
|
package/package.json
CHANGED