PageSourceSearch

https://dashboard.mux.com/assets/team.route-zk6RtVXk.js

js mux.com collected 2026-09-24 08:00:42 UTC 15,680 bytes, 2 lines download raw bytes

1import{r as I,j as e,a as $,F as k,cW as W,R as U,cX as q,aN as J,cY as X}from"./react-DwuEVfNv.js";import{bI as Q,bJ as fe,b5 as Z,b6 as ee,b7 as ye,a3 as R,b9 as te,P as ne,bK as Ee,b8 as Se,c as Y,r as we,bL as se,aa as E,a8 as D,bM as Ie,bN as Ce,bO as ie,bP as B,k as L,q as K,am as M,bQ as re,bR as y,bS as ae,bT as F,bU as v,bV as z,bW as Ae,bX as oe,ba as N,bc as O,bd as P,be as H,b4 as ce,bf as V,bg as G,bY as $e,bZ as le,b_ as De,b$ as _e,c0 as Te,c1 as Ue,c2 as ke,c3 as Re,c4 as ze,a7 as Le,c5 as Be,bp as Me,c6 as Fe,aw as Ne,bh as Oe,bi as Pe,bj as He,bk as Ve,bA as Ge,bl as Ye,bm as Ke}from"./index-DQzPtNsy.js";import{u as de}from"./useUniqueId-CAPtmc-w.js";import{R as ue}from"./RedactedPII-0xda9SDH.js";import{c as We,d as qe,e as Je,f as Xe}from"./user-Deu6eR3_.js";import"./d3-q0zOtUjj.js";import"./redacted-Bf0D5Xnx.js";const Qe=$(R)(["padding:2px 8px;background-color:",";border-radius:",";&[data-invalid='true']{background-color:",";}"],Y.blue10,we[3],Y.red10),Ze=$(E)(["width:16px;height:16px;padding:0;min-height:16px;"]),et=({emails:t,onChange:r,placeholder:s="Enter email addresses...",maxEmails:n=20,existingEmails:a=[],error:o})=>{const[l,c]=I.useState(""),b=I.useRef(null),x=i=>{const d=i.trim().toLowerCase();d&&(t.includes(d)||r([...t,d]))},p=i=>{r(t.filter(d=>d!==i))},m=i=>{i.key==="Enter"||i.key===","||i.key===" "?(i.preventDefault(),l.trim()&&(x(l),c(""))):i.key==="Backspace"&&!l&&t.length>0&&p(t[t.length-1])},h=()=>{l.trim()&&(x(l),c(""))},S=i=>{c(i.target.value)},j=i=>{const d=i.clipboardData.getData("text");if(d.includes(",")||d.includes(" ")){i.preventDefault();const C=d.split(/[,\s]+/).map(A=>A.trim()),g=[...t];C.forEach(A=>{A&&g.length<n&&!g.includes(A.toLowerCase())&&!a.includes(A.toLowerCase())&&g.push(A.toLowerCase())}),r(g),c("")}},w=i=>se(i)===void 0,f=t.length>=n,_=t.length===0?s.length:l.length,u=e.jsx("div",{role:"listbox","aria-multiselectable":"true","aria-orientation":"horizontal","aria-label":"Emails",style:{display:"contents"},children:t.map(i=>e.jsxs(Qe,{role:"option","aria-selected":"true","data-invalid":!w(i),yAlign:"center",gap:1,children:[e.jsx(Q,{$color:w(i)?void 0:"red50",children:i}),e.jsx(Ze,{variant:"muted",size:"small",onClick:()=>p(i),"aria-label":`Remove ${i}`,children:e.jsx(fe,{size:15})})]},i))});return e.jsxs(Z,{disabled:f,error:!!o,onClick:()=>b.current?.focus(),children:[e.jsx(ee,{children:"Email addresses"}),e.jsx(ye,{ref:b,type:"email",value:l,leading:u,isTextArea:!0,hideErrorIcon:!0,onChange:S,onKeyDown:m,onBlur:h,onPaste:j,placeholder:t.length===0?s:"",autoComplete:"email",style:{maxWidth:`${_+5}ch`}}),!o&&e.jsxs(R,{yAlign:"center",gap:1,children:[e.jsx(te,{children:"Type or paste emails, separated by comma, space, or Enter"}),e.jsx(ne,{}),e.jsxs(Ee,{style:{fontSize:"13px"},children:[e.jsxs("strong",{children:[t.length,"/",n]})," ","invites"]})]}),e.jsx(Se,{children:o})]})},me=()=>{const t=k(B);return(r,s)=>{if(s)return[];const n=t?.map(o=>o.id)??[],a=r.map(o=>o.id)??[];return n.length!==a.length||!n.every(o=>a.includes(o))?r:[]}},tt=()=>{const t=D(),{mutate:r}=ie({onSuccess:()=>{t({id:"invite_admin_status_success",type:"Success",title:"Invite Admin Change Success",description:"Invite admin status has been successfully updated"})},meta:{errorToastContent:{id:"invite_admin_error",title:"Invite Admin Change Error",description:"There was a problem updating the invite admin status"}}});return({email:s,admin:n})=>r({email:s,admin:n})},nt=()=>{const t=D(),{mutateAsync:r}=Ce({meta:{ignoreGlobalErrorHandling:!0}});return async s=>{try{await r(s),t({id:"invite_deletion_success",type:"Success",title:"Invite Delete Success",description:`Invite to ${s} has been deleted`})}catch{t({id:"invite_deletion_error",type:"Error",title:"Invite Delete Error",description:`There was a problem deleting ${s} `})}}},he=()=>{const t=D(),r=me(),{mutateAsync:s}=Ie({meta:{ignoreGlobalErrorHandling:!0}});return async({emails:n,admin:a,environments:o})=>
1{if(n.length===0){t({id:"invite_create_error",type:"Error",title:"Invite Error",description:"No email addresses provided"});return}try{const l={emails:n,...a&&{admin:a},...o&&{environments:r(o,a)}};await s(l);const c=n.length===1?`Invite sent to ${n[0]}`:`${n.length} invites sent successfully`;t({id:"invite_create_success",type:"Success",title:"Invite Success",description:c})}catch{const c=n.length===1?`There was a problem sending an invite to ${n[0]}`:"There was a problem sending some invites";t({id:"invite_create_error",type:"Error",title:"Invite Error",description:c})}}},st=()=>{const t=D(),{mutateAsync:r}=ie({meta:{ignoreGlobalErrorHandling:!0}}),s=me();return async({email:n,admin:a,environments:o})=>{try{await r({email:n,admin:a,environments:s(o,a)}),t({id:"update_invite_env_access_success",type:"Success",description:"Successfully updated environment access"})}catch{t({id:"update_invite_env_access_error",type:"Error",description:"Failed to update environment access - try again at a later time"})}}},T="environments",it=t=>{const{getValues:r}=W(),[s,n]=U.useState(t),[a,o]=U.useState("asc"),[l,c]=U.useState();return{environments:s,sortDirection:a,activeColumn:l,handleSort:(x,p)=>{const m=x,h=p==="asc"?"desc":"asc",{environments:S}=r();n(Ae(s.map(j=>({...j,access:S[j.id]})),j=>m==="access"?j.access:j[m].toLowerCase(),h)),o(h),c(m)}}},ve=({accessibleEnvironments:t=[]})=>{const{control:r,getValues:s,setValue:n,watch:a,setError:o,clearErrors:l,formState:{errors:c}}=W(),b=k(B),{environments:x,handleSort:p,activeColumn:m,sortDirection:h}=it(b??[]),S=x.map(u=>u.id);U.useEffect(()=>{const u=t&&t.length===0;S.forEach(i=>{u?n(`${T}.${i}`,!0):n(`${T}.${i}`,t?.some(d=>Object.values(d).includes(i))??!1)})},[]);const j=a(),w=Object.values(j?.environments??{}).filter(u=>u).length,f=w>0;U.useEffect(()=>{!f&&!c.environments?o(T,{type:"custom",message:"Select at least one environment"}):f&&c.environments&&l()},[l,c.environments,o,f]);const _=()=>{const u=Object.values(s().environments).some(i=>i);S.forEach(i=>{n(`${T}.${i}`,!u)})};return e.jsxs(L,{gap:4,children:[e.jsxs(R,{xAlign:"flex-end",children:[e.jsx(L,{gap:2,children:c.environments?e.jsx(K,{$color:"red60",children:c.environments.message}):e.jsxs(K,{children:[e.jsx(rt,{$bold:!0,children:w})," ","environments selected"]})}),e.jsx(ne,{}),e.jsx(M,{as:"button",type:"button",onClick:_,children:f?"Deselect all":"Select all"})]}),e.jsxs(at,{bordered:!0,children:[e.jsxs(re,{children:[e.jsx(y,{ratio:2,sortable:!0,columnName:"name",sortDirection:m==="name"?h:void 0,onSort:p,children:"Environment"}),e.jsx(y,{sortable:!0,columnName:"type",sortDirection:m==="type"?h:void 0,onSort:p,children:"Type"}),e.jsx(y,{width:100,sortable:!0,columnName:"access",sortDirection:m==="access"?h:void 0,onSort:p,children:"Access"})]}),e.jsx(ae,{children:x.map(u=>e.jsxs(F,{children:[e.jsx(v,{ratio:2,children:u.name}),e.jsx(ot,{children:u.type}),e.jsx(v,{width:100,children:e.jsx(q,{name:`${T}.${u.id}`,control:r,render:({field:i})=>e.jsx(z,{...i,onChange:d=>i.onChange(d.target.checked),checked:i.value})})})]},u.id))})]})]})};var rt=$(Q)(["vertical-align:top;"]),at=$(oe)(["max-height:330px;overflow-y:auto;scrollbar-width:thin;"]),ot=$(v)(["text-transform:capitalize;"]);function ct({emails:t=[],open:r,onOpenChange:s}){const n=he(),[a,o]=I.useState([]),[l,c]=I.useState(""),b=J({mode:"onBlur",defaultValues:{emails:[],admin:!1}}),x=de("invite-user-form"),{handleSubmit:p,formState:m,control:h,watch:S}=b,j=m.errors,w=S("admin"),f=i=>{if(i.length===0)return c("At least one email is required"),!1;if(i.length>20)return c("Maximum 20 emails allowed"),!1;const d=i.filter(g=>se(g)!==void 0);if(d.length>0)return c(`Invalid email${d.length>1?"s":""}: ${d.join(", ")}`),!1;const C=i.filter(g=>t.includes(g.toLowerCase()));return C.length>0?(c(`Email${C.length>1?"s":""} already invited: ${C.join(", ")}`),!1):(c(""),!0)},_=i=>{o(i),f(i)},u=async({admin:i,environments:d})=>{if(!f(a))return;const C=d?Object.entries(d).filter(([,g])=>g).map(([g])=>({id:g})):null;await n({emails:a,admin:i,environments:C}),o([]),c(""),s?.(!1)};return e.jsx(N,{open:r,onOpenChange:s,children:e.jsxs(O,{style:{overflowY:"auto",maxWidth:"600px"},children:[e.jsx(P,{children:e.jsx(H,{children:"Invite new members"})}),e.jsx(X,{...b,children:e.jsxs(ce,{id:x,gutterY:4,gap:5,onSubmit:p(u),children:[e.jsx(et,{emails:a,onChange:_,placeholder:"Enter email addresses...",maxEmails:20,existingEmails:t,error:l}),e.jsx(L,{children:e.jsxs(Z,{children:[e.jsx(ee,{children:"Admin"}),e.jsx(te,{isTooltip:!0,children:"Admins have the ability to access settings, including keys and tokens, as well as managing organization members."}),e.jsx(q,{name:"admin",control:h,render:({field:i})=>e.jsx(z,{...i,onChange:d=>i.onChange(d.target.checked),checked:i.value})})]})}),!w&&e.jsx(ve,{})]})}),e.jsxs(V,{children:[e.jsx(G,{asChild:!0,children:e.jsx(E,{variant:"muted",children:"Cancel"})}),e.jsx(E,{type:"submit",loading:m.isSubmitting,variant:"access",form:x,disabled:!!l||a.length===0||!!j.environments&&!w,children:a.length===1||a.length===0?"Send Invitation":`Send ${a.length} Invitations`})]})]})})}const lt=()=>{const t=D(),{mutateAsync:r,isLoading:s}=$e({meta:{ignoreGlobalErrorHandling:!0}});return{async mutate(n){try{await r(n.id),t({id:"user_deletion_success",type:"Success",title:"User Removal Success",description:`${n.firstName} ${n.lastName} was successfully removed`})}
1catch{t({id:"user_deletion_error",type:"Error",title:"User Removal Error",description:`There was a problem removing ${n.firstName} ${n.lastName}`})}},isLoading:s}},dt=()=>{const t=D(),{mutateAsync:r}=We({meta:{ignoreGlobalErrorHandling:!0}});return async s=>{try{await r({id:s.id,changes:{organizationAdmin:!s.organizationAdmin}}),t({id:"admin_status_success",type:"Success",title:"User Admin Change Success",description:"User admin status has been successfully updated"})}catch{t({id:"admin_status_error",type:"Error",title:"User Admin Change Error",description:"There was a problem updating the user admin status"})}}},ut=()=>{const t=D(),{mutateAsync:r}=qe({meta:{ignoreGlobalErrorHandling:!0}});return async(s,n)=>{try{await r({userId:s,environments:n}),t({id:"update_env_access_success",type:"Success",description:"Successfully updated environment access"})}catch{t({id:"update_env_access_error",type:"Error",description:"Failed to update environment access - try again at a later time"})}}};function mt({user:t,open:r,onOpenChange:s}){const n=lt();return e.jsx(N,{open:r,onOpenChange:s,children:e.jsxs(O,{onClick:a=>a.stopPropagation(),children:[e.jsxs(P,{children:[e.jsx(H,{children:"Delete user"}),e.jsxs(le,{children:["Are you sure you want to delete ",e.jsxs("strong",{children:['"',t.email,'"']}),"? This user will be permanently deleted, and this action cannot be undone."]})]}),e.jsxs(V,{children:[e.jsx(G,{asChild:!0,children:e.jsx(E,{variant:"muted",children:"Cancel"})}),e.jsx(E,{variant:"warn",onClick:()=>void n.mutate(t),loading:n.isLoading,children:"Delete"})]})]})})}function xe({email:t,open:r,onOpenChange:s,environments:n,isLoading:a,onSubmit:o}){const l=J(),c=de("provision-env-form"),b=({environments:x,...p})=>{const m=Object.entries(x).filter(([,h])=>h).map(([h])=>({id:h}));o({environments:m,...p})};return e.jsx(N,{open:r,onOpenChange:s,children:e.jsxs(O,{children:[e.jsxs(P,{children:[e.jsx(H,{children:"Manage environment access"}),e.jsx(le,{children:t})]}),a?e.jsx(De,{gutterY:8}):e.jsx(X,{...l,children:e.jsx(ce,{id:c,gutterY:5,onSubmit:l.handleSubmit(b),children:e.jsx(ve,{accessibleEnvironments:n})})}),e.jsxs(V,{children:[e.jsx(G,{asChild:!0,children:e.jsx(E,{variant:"muted",children:"Cancel"})}),e.jsx(E,{type:"submit",variant:"access",form:c,disabled:!!l.formState.errors.environments,children:"Save"})]})]})})}const ht=({user:t,open:r,onOpenChange:s})=>{const{isLoading:n,data:a}=Je(t.id,{cacheTime:0}),o=ut(),l=async({environments:c})=>{await o(t.id,c),s(!1)};return e.jsx(xe,{email:t.email,open:r,environments:a?.organization?.environments,isLoading:n,onSubmit:l,onOpenChange:s})};function vt({invite:{email:t},open:r,onOpenChange:s}){const{isLoading:n,data:a}=_e(t,{cacheTime:0}),o=st(),l=async({environments:c})=>{await o({email:t,environments:c}),s(!1)};return e.jsx(xe,{email:t,open:r,onOpenChange:s,onSubmit:l,isLoading:n,environments:a?.data?.environments})}const pe=$(E).attrs({variant:"muted",prefix:e.jsx(Me,{})})(["padding:0;"]);function xt({users:t=[],invites:r=[]}){return e.jsxs(oe,{bordered:!0,children:[e.jsxs(re,{children:[e.jsx(y,{ratio:1.25,children:"Name"}),e.jsx(y,{ratio:1.25,children:"Email"}),e.jsx(y,{children:"Status"}),e.jsx(y,{children:e.jsxs(R,{gap:2,yAlign:"center",children:["Access",e.jsxs(Te,{children:[e.jsx(Ue,{asChild:!0,children:e.jsx(ke,{})}),e.jsx(Re,{children:"This column indicates which environments a member can access. Admins have access to all environments."})]})]})}),e.jsx(y,{right:!0,width:75,children:"Admin"}),e.jsx(y,{right:!0,ratio:.5})]}),e.jsxs(ae,{children:[t.map(s=>e.jsx(pt,{user:s},s.id)),r.map(s=>e.jsx(gt,{invite:s},s.email))]})]})}const pt=({user:t})=>{const r=ze(),s=k(Le),n=dt(),[a,o]=I.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(F,{children:[e.jsx(v,{ratio:1.25,children:e.jsx(ue,{children:e.jsx(be,{children:`${t.firstName||""} ${t.lastName||""}`})})}),e.jsx(ge,{email:t.email}),e.jsxs(v,{children:["Joined"," ",t.organizationUserInsertedAt&&!isNaN(new Date(t.organizationUserInsertedAt).getTime())?r(new Date(t.organizationUserInsertedAt),Be.calendarDate):"N/A"]}),e.jsx(je,{type:"user",resource:t}),e.jsx(v,{right:!0,width:75,children:e.jsx(z,{variant:"access",disabled:t.id===s.id,checked:t.organizationAdmin,onChange:()=>n(t)})}),e.jsx(v,{right:!0,ratio:.5,children:s.id!==t.id&&e.jsx(pe,{onClick:()=>o(!0)})})]},t.id),a&&e.jsx(mt,{user:t,open:!0,onOpenChange:()=>o(!1)})]})},gt=({invite:t})=>{const r=he(),s=nt(),n=tt(),{email:a,admin:o}=t;return e.jsxs(F,{children:[e.jsx(v,{ratio:1.25}),e.jsx(ge,{email:a}),e.jsx(v,{children:e.jsxs("span",{children:["Invite sent ",e.jsx(M,{as:"button",onClick:()=>r({emails:[a]}),children:"Resend"})]})}),e.jsx(je,{type:"invite",resource:t}),e.jsx(v,{right:!0,width:75,children:e.jsx(z,{variant:"access",checked:o,onChange:()=>n({email:a,admin:!o})})}),e.jsx(v,{right:!0,ratio:.5,children:e.jsx(pe,{onClick:()=>s(a)})})]})};function ge({email:t}){return e.jsx(v,{ratio:1.25,children:e.jsx(ue,{children:e.jsx(be,{title:t,children:t})})})}function je({resource:t,type:r}){const[s,n]=I.useState(!1),{organizationEnvironmentsCount:a}=t,o="organizationAdmin"in t&&t.organizationAdmin||"admin"in t&&t.admin;return e.jsxs(e.Fragment,{children:[e.jsx(v,{children:o?e.jsx(e.Fragment,{children:"All environments"}):e.jsx(jt,{count:a,onClick:()=>n(!0)})}),s&&e.jsx(e.Fragment,{children:r==="user"?e.jsx(ht,{user:t,open:!0,onOpenChange:()=>n(!1)}):e.jsx(vt,{invite:t,open:!0,onOpenChange:()=>n(!1)})})]})}const be=$.span(["text-overflow:ellipsis;overflow:hidden;white-space:nowrap;"]);function jt({count:t,onClick:r}){const s=k(B),n=t&&t>0,a=s?.length===t;return e.jsx(M,{as:"button",onClick:r,children:!a&&n?`${t} environment${t>1?"s":""}`:"All environments"})}function Ct(){const{data:t}=Xe({}),{data:r}=Fe({}),s=I.useMemo(()=>r?.data?.map(l=>l.email),[r]),n=k(Ne),[a,o]=I.useState(!1);return Oe(`Team | ${n.name}`),e.jsxs(Pe,{children:[e.jsxs(He,{children:[e.jsx(Ve,{children:"Team"}),e.jsx(Ge,{children:"Manage your team members and their roles within the organization."}),e.jsx(Ye,{children:e.jsx(E,{variant:"access",onClick:()=>o(!0),children:"Invite Member"})})]}),e.jsxs(Ke,{gutterY:4,children:[e.jsx(xt,{users:t?.data,invites:r?.data}),a&&e.jsx(ct,{open:!0,onOpenChange:()=>o(!1),emails:s})]})]})}export{Ct as default};
2//# sourceMappingURL=team.route-zk6RtVXk.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.