PageSourceSearch

https://app.thena.ai/assets/Members-BK9Vx7PZ.js

js thena.ai collected 2026-09-28 06:45:21 UTC 9,294 bytes, 19 lines download raw bytes

1import{r as f,d as N,T as M,mU as q,A as w,hN as O,j as e,_ as v,mV as z,ap as Q,aq as V,bo as H,as as $,C as B,p as G,s as J,t as W,q as X,hJ as Y,v as Z,D as ee,n as se,m5 as te,ag as ne,bm as T,cM as ae,O as U,mW as re,k_ as L,Q as le,gU as k,eU as oe,H as ie,hM as ce,mX as de,Z as me}from"./index-B79jx0QH.js";import{I as ue}from"./InviteModal-M9TLHuQ9.js";import{u as ge,g as xe,b as he,a as pe,f as D}from"./index-Cv_Vf7U1.js";import{u as be}from"./index-BvkyY9Ua.js";import{S as y}from"./skeleton-Cbu7hH40.js";import{T as fe,d as je,b as A,e as ve,a as ye,c as P}from"./table-qlTNHZJv.js";import{T as C}from"./TableHeader-DvZcEEur.js";import{D as Me,a as we,b as Ce,c as Ne}from"./dropdown-menu-DOfBs0uf.js";import"./index-DNi9bZVg.js";import"./index-DnQZnmdU.js";import"./index-Zo-lXBHX.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="744a2591-8c1c-456b-9d7f-e67ecbbc0dee",n._sentryDebugIdIdentifier="sentry-dbid-744a2591-8c1c-456b-9d7f-e67ecbbc0dee")}catch{}})();const K={title:"Invite user(s)",subtitle:"Invite teammates to access the portal."},Ie=()=>{const[n,o]=f.useState(!1),i=N(),m=M({mutationKey:["customer-portal-invite-members"],mutationFn:({emails:a,is_admin:c})=>q(a,c),onSuccess:()=>{w("Invite sent successfully"),i.refetchQueries({queryKey:["customer-portal-member-list"]}),o(!1)},onError:a=>{var p,d;const c=((d=(p=a==null?void 0:a.response)==null?void 0:p.data)==null?void 0:d.error)||"Failed to send invite";console.error("Member invite failed",{error:a}),w.error(c),O({message:"Customer portal member invite failed",error:a,tag:{key:"customer-portal-member-invite",value:"error"}})}}
1),s=(a,c)=>{m.mutate({emails:a,is_admin:c})};return e.jsxs(e.Fragment,{children:[n&&e.jsx(ue,{open:n,setOpen:o,title:K.title,subtitle:K.subtitle,onSubmit:s,isPending:m.isPending}),e.jsx(v,{className:"text-sm",size:"sm",onClick:()=>o(!0),children:"Invite"})]})};function Se({isAdmin:n,rowId:o,disabled:i}){const[m,s]=f.useState(!1),a=N(),c=M({mutationKey:["update-role"],mutationFn:({id:d,is_admin:j})=>z(d,{is_admin:j}),onSuccess:()=>a.refetchQueries({queryKey:["customer-portal-member-list"]})}),p=f.useCallback((d,j)=>{i||c.mutate({id:d,is_admin:j})},[]);return e.jsxs(Q,{open:m,onOpenChange:s,children:[e.jsx(V,{disabled:c.isPending||i,children:e.jsx("div",{className:"flex items-center gap-1",children:n?e.jsxs(e.Fragment,{children:['"Admin" ',e.jsx(H,{size:14})]}):"Member"})}),e.jsx($,{className:"p-0 w-200",children:e.jsxs(B,{children:[e.jsx(G,{placeholder:"Change role"}),e.jsx(J,{children:"No value found."}),e.jsx(W,{children:e.jsx(X,{children:Y.map(d=>e.jsx(Z,{onSelect:()=>{p(o,d.value==="admin"),s(!1)},children:d.label},d.value))})})]})})]})}function Re({removeUser:n,disabled:o,id:i,name:m}){const[s,a]=f.useState(!1),c=()=>a(!1);return e.jsxs(e.Fragment,{children:[s&&e.jsx(ee,{open:!0,onOpenChange:c,children:e.jsxs(se,{children:[e.jsx("p",{className:"text-base font-medium",children:"Remove member"}),e.jsxs("p",{children:["Are you sure you want to remove ",e.jsx("em",{children:m})," 's access to the portal?"]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{onClick:c,variant:"outline",children:"Cancel"}),e.jsx(v,{onClick:()=>n(i),children:"Proceed"})]})]})}),e.jsxs(Me,{children:[e.jsx(we,{asChild:!0,children:e.jsx(v,{variant:"outline",className:"p-0 w-7 h-7",disabled:o,children:e.jsx(te,{size:14})})}),e.jsx(Ce,{align:"end",children:e.jsx(Ne,{onClick:()=>{o||a(!0)},children:"Remove user"})})]})]})}const Ee=ne.div`
2  border-radius: 6px;
3  display: flex;
4  align-items: center;
5  justify-content: center;
6  font-size: 12px;
7  padding: 2px 8px;
8  font-weight: 500;
9  line-height: 16px;
10  box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
11
12  ${({$status:n})=>{switch(n){case"Pending":return T`
13          color: var(--color-text-error);
14          background-color: var(--color-bg-error-muted);
15        `;case"Accepted":return T`
16          color: var(--color-text-success);
17          background-color: var(--color-bg-success-muted);
18        `}}}
19`,_e=()=>{var R;const{data:n,isLoading:o,isRefetching:i}=ae({queryKey:["customer-portal-member-list"],queryFn:de}),m=N(),s=U(),a=M({mutationKey:["update-role"],mutationFn:({id:r})=>re(r),onSuccess:()=>{w("User removed successfully"),m.refetchQueries({queryKey:["customer-portal-member-list"]})}}),c=M({mutationKey:["customer-portal-invite-members"],mutationFn:({emails:r,is_admin:l})=>q(r,l),onSuccess:()=>{m.refetchQueries({queryKey:["customer-portal-member-list"]})},onError:r=>{console.error("Member invite failed",{error:r}),w.error("Failed to invite member")}}),p=f.useCallback(r=>{a.mutate({id:r})},[]),d=f.useMemo(()=>{var l,x;const r=(x=(l=s==null?void 0:s.roles)==null?void 0:l.includes)==null?void 0:x.call(l,L);return[{header:({column:t})=>e.jsx(C,{column:t,title:"Name"}),accessorKey:"name",sortingFn:"alphanumeric",cell:t=>{const u=t.cell.getValue(),h=t.row.original.email;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{alt:u,src:le,className:"w-4 h-4 rounded-full"}),u||k(h)]})}},{header:"Email",accessorKey:"email",sortingFn:"alphanumeric"},{header:({column:t})=>e.jsx(C,{column:t,title:"Role"}),accessorKey:"role",sortingFn:"alphanumeric",cell:t=>{var b;const u=(b=t.row.original)==null?void 0:b.is_admin,h=(s==null?void 0:s.email)===t.row.original.email;return e.jsx(Se,{isAdmin:u,rowId:t.row.original.id,disabled:i||h||!r})}},{header:({column:t})=>e.jsx(C,{column:t,title:"Invite status"}),accessorKey:"has_logged_in",sortingFn:"alphanumeric",cell:({row:t})=>{var b;const u=(b=t.original)==null?void 0:b.has_logged_in,h=u?"Accepted":"Pending";return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{$status:h,children:h}),!u&&r&&e.jsxs(v,{size:"sm",variant:"link",disabled:c.isPending||i,onClick:()=>c.mutate({emails:[t.original.email],is_admin:t.original.is_admin}),className:"gap-1 text-[var(--color-text-info)] h-4 text-[12px] font-medium leading-4 !no-underline px-0",children:["Resend",e.jsx(oe,{size:12})]})]})}},{header:"Actions",cell:({row:t})=>{var E,_,F;const u=(s==null?void 0:s.email)===t.original.email,h=[a.isPending,i,u,!r].some(Boolean),b=((E=t.original)==null?void 0:E.name)||k((_=t.original)==null?void 0:_.email)||((F=t.original)==null?void 0:F.email);return e.jsx("div",{className:"w-full flex justify-end pr-8",children:e.jsx(Re,{removeUser:p,disabled:h,id:t.original.id,name:b})})}}]},[s==null?void 0:s.roles,s==null?void 0:s.email,i,c,a.isPending,p]),j=ge({data:n??ie,columns:d,enableSortingRemoval:!0,getCoreRowModel:xe(),getFilteredRowModel:he(),getSortedRowModel:pe()}),{rows:I}=j.getRowModel(),S=f.useRef(null),g=be({overscan:5,count:I.length,estimateSize:()=>15,getScrollElement:()=>S.current,measureElement:ce});return o?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-full h-8 mt-4"}),e.jsx(y,{className:"w-full h-8 mt-2"}),e.jsx(y,{className:"w-full h-8 mt-2"}),e.jsx(y,{className:"w-full h-8 mt-2"})]}):e.jsx("div",{ref:S,className:"mt-4 overflow-auto h-[calc(100vh-14rem)]",children:e.jsxs(fe,{style:{width:"100%",display:"grid",position:"relative"}
19,children:[e.jsx(je,{style:{top:0,zIndex:1,display:"grid",position:"sticky"},className:"bg-[var(--color-bg-subtle)] rounded-t-lg rounded-r-lg",children:j.getHeaderGroups().map(r=>e.jsx(A,{className:"border border-l-0 border-r-0 border-b-0 first:!border-l last:!border-r rounded-t-lg",style:{width:"100%",display:"flex",background:"var(--color-bg-subtle)"},children:r.headers.map(l=>e.jsx(ve,{colSpan:l.colSpan,className:"rounded-t-lg font-normal",style:{width:"100%",display:"flex",alignItems:"center",background:"var(--color-bg-subtle)"},children:l.isPlaceholder||l.id==="Actions"?null:D(l.column.columnDef.header,l.getContext())},l.id))},r.id))}),e.jsx(ye,{style:{display:"grid",position:"relative",height:`${g.getTotalSize()}px`},children:(R=g==null?void 0:g.getVirtualItems())!=null&&R.length?g.getVirtualItems().map(r=>{const l=I[r.index];return e.jsx(A,{"data-index":r.index,ref:x=>g==null?void 0:g.measureElement(x),className:"border border-solid border-[var(--modal-border)] border-t-0 last:!border last:!border-t-0 last:!rounded-b-lg",style:{width:"100%",display:"flex",position:"absolute",alignItems:"center",transform:`translateY(${r.start}px)`},children:l.getVisibleCells().map(x=>e.jsx(P,{style:{width:"100%",display:"flex"},children:D(x.column.columnDef.cell,x.getContext())},x.id))},l.id)}):e.jsx("div",{className:"flex items-center w-full justify-center hover:bg-transparent h-full",children:e.jsx(P,{colSpan:d.length,className:"h-full text-center hover:bg-transparent",children:"No data"})})})]})})},ze=()=>{var i;const n=U(),o=(i=n==null?void 0:n.roles)==null?void 0:i.find(m=>m===L);return e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-[24px] leading-8 font-semibold",children:"Manage users"}),e.jsx("p",{className:" text-[var(--color-text-disabled)] text-base mt-2 ",children:"Manage your team and permissions."}),e.jsx(me,{className:"my-4"}),e.jsxs("div",{className:" flex items-center justify-between",children:[e.jsx("h4",{className:"text-[18px] font-medium leading-7",children:"User list"}),!!o&&e.jsx(Ie,{})]}),e.jsx(_e,{})]})};export{ze as default};

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.