PageSourceSearch

https://app.alloy.ai/assets/UserFeaturesSettingsPage-CJOLa6ly.js

js alloy.ai collected 2026-10-03 19:05:45 UTC 5,394 bytes, 2 lines download raw bytes

1import{k8 as J,dd as $,j as r,a6 as K,b as Q,ki as Y,f as G,c as X,d as b,fz as N,P as B,u as Z,bK as ee,kj as se,af as f,l as ae,eu as re,B as A,p as te,ai as oe,kk as S,kl as D,co as R,C as T,O as I,w,km as ne,bL as y,kn as le,k as ie,bV as ue,ip as ce,i as de,aA as me,k9 as pe,ka as ge}from"./index-o5hMGMsX.js";import{a as l,R as Fe}from"./vendor-react-DFM4tGg0.js";import{B as he}from"./BaseSettingsPage-gqf4ZzVg.js";import{a as fe}from"./utils-BxJw8CCi.js";import{A as ve}from"./ActionBar-BSUmFWiu.js";import{A as Ce}from"./ActionBarSpacer-D2eOHL9q.js";import{C as xe}from"./Checkbox-RfKV1Hfk.js";import"./vendor-redux-byXXH3Fl.js";import"./vendor-firebase-BtY9UEN7.js";import"./vendor-react-grid-nj3QJOH1.js";import"./vendor-ag-grid-BjjCojRR.js";import"./colors-D3t2KOS4.js";import"./InfoHover-BZS1Veka.js";import"./PeriodInterval-C0-cxJaU.js";import"./markdown-DCCdrTqW.js";import"./vendor-chartjs-DRPi5OMT.js";import"./FileDownloadLink-Cm6rAnBt.js";import"./MultiLabel-BH9UQah-.js";import"./TreeExpandCollapseArrow-Qaohde3g.js";function je(e){return J(e,a=>a.featureFlagName,$)}const E=({displayName:e,minimumRole:a})=>{const s=a?r.jsxs("div",{children:[r.jsx("p",{className:"tooltip-title",children:e}),r.jsxs("p",{className:"min-role-description",children:["This feature has been released to ",a," and above."]})]}):e;return r.jsxs("div",{className:"FeatureHeaderCell",children:[r.jsx("div",{className:"title",children:r.jsx(K,{tooltip:s,tooltipClassName:"user-feature-header-tooltip",children:e})}),r.jsx("div",{className:"subtitle",children:a})]})};E.displayName="FeatureHeaderCell";const O=Fe.createContext({proposedFeatureFlags:I(),onFeatureToggled:ue,vendorFeaturesByName:{},allFeatures:[]}),Ne=({data:e})=>r.jsxs("div",{className:"UserCell",children:[r.jsx("div",{className:"title",children:R(e.user,e.userInfo)}),r.jsx("div",{className:"role",children:ce.get(e.user.role)})]}),Re=({data:e,feature:a})=>{var C,x;const{proposedFeatureFlags:s,onFeatureToggled:o,vendorFeaturesByName:n}=l.useContext(O),i=s.get(e.user.id)??f.of(),u=a.name,m=(C=n[u])==null?void 0:C.minimumRole,v=!!m&&de(e.user.role,m),c=i==null?void 0:i.contains(u),g=!c&&((x=e.userInfo)==null?void 0:x.isBetaUser)&&a.isBeta,p=v||c||g;return r.jsxs("div",{className:"FeatureCell",children:[r.jsx(xe,{checked:p,disabled:v,onChange:()=>o(u,me(e.user.id))}),g&&r.jsx(pe,{displayVariant:ge.SUPERSCRIPT,featureName:u})]})};function Ue(e,a){return[{cellClass:s=>s.data.isCurrentUser?"current-user":"",cellRendererFramework:Ne,comparator:(s,o,n,i)=>{const u=R(n.data.user,n.data.userInfo),m=R(i.data.user,i.data.userInfo);return u.localeCompare(m)},getQuickFilterText:s=>`${s.data.user.email} ${R(s.data.user,s.data.userInfo)}`,headerName:"User",minWidth:200,pinned:"left",sort:"asc"},...e.slice().map(s=>{var o;return{cellRendererFramework:Re,cellClass:n=>n.data.isCurrentUser?"current-user":"",cellRendererParams:{feature:s},headerName:s.name,headerClass:"feature-header",headerComponentFramework:E,headerComponentParams:{minimumRole:(o=a[s.name])==null?void 0:o.minimumRole},maxWidth:150,minWidth:100,sortable:!1}})]}function ke(e,a,s){return e.map((o,n)=>({isCurrentUser:s===o.id,user:o,userInfo:a.get(n)})).sortBy(o=>o.user.email).valueSeq().toArray()}function be(e=f(),a=f()){return Object.fromEntries([...S(e,D()),...S(a,D())].filter(s=>a.contains(s)!==e.contains(s)).map(s=>[s,a.contains(s)&&!e.contains(s)]))}const Je=()=>{const e=Q(),a=Y(e.vendor.id),{allUserInfos:s,allUsers:o}=G(),[n,i]=X(b(N.getVendorFeatures.getResource(e.vendor.id,{vendorId:B})),b(N.getAllFeatures.getResource())),u=l.useMemo(()=>je(n),[n]),[m,v]=l.useState(""),[c,g]=l.useState(a),p=Z(),C=l.useCallback(t=>p(ee.saveFeatureFlags(t)),[p]);l.useEffect(()=>{a.isEmpty()||g(a)},[a]);const x=t=>v(t),U=se(),k=l.useCallback(t=>t?U(be(a.get(e.user.id),t)):!1,[a,e.user.id,U]),P=()=>{const t=a;N.saveFeatures(c.toJSON()).then(F=>{const d=I(F).mapEntries(([q,W])=>[parseInt(q,10),f(W.map(z=>z))]);C(d),w(N.getFeaturesForUsers.getResource(e.vendor.id,{vendorId:B}),()=>F);const h=e.user.id;d.has(h)&&!d.get(h).equals(t.get(h))?k(d.get(h))?(ne("Feature flags saved."),window.location.reload()):(y("Feature flags saved."),p(T.setUserFeatureFlags(d.get(h))),w(le.getAvailableSettings.getResource())):y("Feature flags saved.")}).catch(ie)},M=l.useMemo(()=>Ue(i,u),[i,u]),j=l.useMemo(()=>ke(o,s,e.user.id),[o,s,e.user.id]),V=l.useMemo(()=>j.filter(t=>!t.isCurrentUser),[j]),H=l.useMemo(()=>j.filter(t=>t.isCurrentUser),[j]),L=(t,F)=>{const d=c.get(F)??f();g(c.set(F,d.has(t)?d.delete(t):d.add(t)))},_=()=>{p(T.setPermissionsOverrideDialogOpen(!0))};return r.jsx(he,{className:"UserFeaturesSettingsPage",title:"User-level Feature Flags",children:r.jsxs(ae,{className:"features-table",gapped:!0,padded:!0,children:[r.jsxs(ve,{children:[r.jsx(re,{className:"user-features-search-bar",placeholder:"Search users...",sizeVariant:"medium",onChange:x}),r.jsx(Ce,{}),r.jsx(A,{displayVariant:te.SECONDARY,onClick:_,children:"Temporary overrides"}),r.jsx(A,{className:"save",disabled:oe(c,a),onClick:P,children:k(c.get(e.user.id))?"Save & Reload":"Save"})]}),r.jsx(O.Provider,{value:{proposedFeatureFlags:c,onFeatureToggled:L,vendorFeaturesByName:u,allFeatures:i},children:r.jsx(fe,{columnDefs:M,filterText:m,headerHeight:45,pinnedTopRowData:H,rowData:V,rowHeight:50})})]})})};export{Je as default};
2//# sourceMappingURL=UserFeaturesSettingsPage-CJOLa6ly.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.