PageSourceSearch

https://app.trybrass.com/assets/TeamMatesPage-_VAD9rb_.js

js trybrass.com collected 2026-09-25 21:01:59 UTC 11,629 bytes, 2 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="d534dc1c-49d7-4b97-91ae-c4a6ca6e117b",e._sentryDebugIdIdentifier="sentry-dbid-d534dc1c-49d7-4b97-91ae-c4a6ca6e117b")}catch(s){}}();import{j as e,r as a,R as s,F as t,c as l,T as i,S as n,N as o,Y as r,E as d,m,q as c,B as u,V as v,n as h,J as p,K as _,Q as b}from"./@brasshq/ui-kit-C5jh8u1K.js";import{bi as g,O as f,dx as y,de as j,b6 as T,D as x,c as w,eK as D,e as M,eL as S}from"./App-HYYDePiw.js";import{u as F}from"./useFilter-CEYXy2hB.js";import"./yup-CN_DNaz9.js";import{C}from"./Common-BM3-sm7I.js";import{w as I}from"./withErrorBoundary-CWU-ZZW1.js";import{S as N}from"./SpanBadge-CTcDmg8V.js";import{F as P}from"./empty-table-state-BlNs9Vgr.js";import{R}from"./RestrictionGuard-DWgUias_.js";import{A as k}from"./ActionButton-B2hcoNYk.js";import{D as B}from"./Dialog-lTG4C4c9.js";import{E as V}from"./EmptyScreen-CX3vtjra.js";import{a as E,R as O,b as q}from"./actions-BxPSroJY.js";import{N as A}from"./NameWithAvatar-Ci_03ku8.js";import{F as L,a as G}from"./formik-CBscJFpt.js";import{D as K}from"./DatePicker-DH18o6l7.js";import{R as U}from"./RolePrivileges-DO114LTK.js";import{a as W,s as Y,r as $,b as H,e as J}from"./functions-BdLAxqob.js";import{s as Q}from"./validators-CN9muVI3.js";import{f as z}from"./date-fns-CpEzoGKw.js";import"./libphonenumber-js/min-ORpmiCJc.js";import"./index-Dtj21Ljh.js";import"./@sentry/react-2ugike8y.js";import"./@reduxjs/toolkit-QiR5TFUJ.js";import"./react-error-boundary-D4mCVdMt.js";import"./Modal-F9mYhuKU.js";import"./api-D4bgH0sR.js";import"./If-CV2hdnnO.js";import"./react-feather-B1p3-ou_.js";import"./cancel-outline-circle-La_-7RO4.js";import"./check-outline-circle-xR5qeq04.js";const X={TeamMatesTable:"_TeamMatesTable_q44hl_1",TeamMatesTable_account_name_header:"_TeamMatesTable_account_name_header_q44hl_8",TeamMatesTable_emptyTable:"_TeamMatesTable_emptyTable_q44hl_25",TeamMatesTable_emptyState:"_TeamMatesTable_emptyState_q44hl_32"};function Z(e,a){const s=a(["team.invite","team.manage"],!0);return[{label:"Resend invite",onClick:a=>e({showDialog:!0,activeRowData:a,dialogType:g.ResendInvite}),handleVisibility:()=>!s},{label:"Delete invite",onClick:a=>e({showDialog:!0,activeRowData:a,dialogType:g.DeleteInvite}),handleVisibility:()=>!s}]}function ee(e,a){const s=a("team.manage");return[{label:"Edit teammate",onClick:a=>e({showDetailsFlyout:!0,activeRowData:a}),handleVisibility:()=>!s},{label:"View permissions",onClick:a=>e({showPrivilegeFlyout:!0,activeRowData:a})},{label:"Disable and remove",onClick:a=>e({showDialog:!0,activeRowData:a,dialogType:g.RemoveMember}),handleVisibility:e=>{var a,t;return!(!["business.owner"].includes((null==(t=null==(a=null==e?void 0:e.role)?void 0:a.data)?void 0:t.name)||"")&&s)}}]}const ae="_TeamMatesDetailsFlyout_t7l7v_4",se="_TeamMatesDetailsFlyout_wrapper_t7l7v_8",te="_TeamMatesDetailsFlyout_form_t7l7v_27",le="_TeamMatesDetailsFlyout_form_row_t7l7v_31",ie="_TeamMatesDetailsFlyout_form_row_group_t7l7v_49",ne="_TeamMatesDetailsFlyout_form_row_select_t7l7v_58",oe="_TeamMatesDetailsFlyout_form_owner_t7l7v_66",re="_TeamMatesDetailsFlyout_form_actions_t7l7v_70",de="_TeamMatesDetailsFlyout_form_actions_button_t7l7v_78",me="_TeamMatesDetailsFlyout_privileges_t7l7v_81",ce=p=>{var _,b;const{data:g,handleClose:f,roles:x,refresh:w,isOpen:D=!0}=p,[M,S]=a.useState(!1),F=Boolean(g&&(null==g?void 0:g.id)),C={firstname:(null==g?void 0:g.firstname)||"",lastname:(null==g?void 0:g.lastname)||"",email:(null==g?void 0:g.email)||"",role:(null==(b=null==(_=null==g?void 0:g.role)?void 0:_.data)?void 0:b.id)||"",gender:(null==g?void 0:g.gender)||"",phone:(null==g?void 0:g.phone)||"",dob:(null==g?void 0:g.date_of_birth)?z(new Date(g.date_of_birth),"yyyy-MM-dd"):null},I=s.useMemo(()=>{let e=Q;return F||(e=e.omit(["dob","gender","phone"])),e},[F]);a.useEffect(()=>{S(!!(null==C?void 0:C.role))},[C.role]);const N=()=>{w(),h(F?"Team member updated successfully":"Invitation sent successfully!"),p.handleClose&&p.handleClose()};return e.jsx(t,{isOpen:D,isMaskClear:!1,isMaskOn:!0,className:se,closeFlyout:f,style:M?{}:{right:"-487px"},children:e.jsx(L,{validationSchema:I,initialValues:C,validateOnBlur:!1,validateOnChange:!0,onSubmit:async e=>{F&&(null==g?void 0:g.id)?await W(g.id,T(C,e),N):await Y(e,N)},children:({values:a,isValid:s,dirty:t,handleChange:h,isSubmitting:_,setFieldValue:b,handleBlur:f,errors:T,touched:w})=>{var D;const C=(null==x?void 0:x.find(({id:e})=>e===(null==a?void 0:a.role)))||(null==(D=null==g?void 0:g.role)?void 0:D.data),I="business.owner"===(null==C?void 0:C.name);return e.jsxs("section",{className:ae,children:[e.jsxs("section",{children:[e.jsxs("header",{children:[e.jsx("h5",{children:F?"Edit team mate":"Invite a team mate"}),e.jsx("p",{children:F?"Make changes to this team mate ":"Send an invitation to join your company’s Brass account"})]}),e.jsx("main",{children:e.jsxs(G,{className:te,children:[e.jsxs("div",{className:l(le,ie),children:[e.jsx(i,{label:"First name",name:"firstname",value:a.firstname,onChange:h,readOnly:F,disabled:F,onBlur:f,errorMessage:w.firstname?T.firstname:""}),e.jsx(i,{label:"Last name",name:"lastname",value:a.lastname,onChange:h,readOnly:F,disabled:F,onBlur:f,errorMessage:w.lastname?T.lastname:""})]}),e.jsx(i,{label:"Email address",name:"email",value:a.email,onChange:h,readOnly:F,disabled:F,className:l(le),onBlur:f,errorMessage:w.email?T.email:""}),e.jsx(n,{className:l(le,ne),label:"Assign role",options:x||[],valueField:"id",labelField:"display_name",onChange:e=>{b("role",e.id),M||S(!0)},value:a.role||"",disabled:!t&&I,showSearch:!0}),F&&e.jsxs(e.Fragment,{children:[e.jsx(o,{label:"Phone number",name:"phone",id:"phone",value:a.p
1hone||"",onChange:h,className:l(le),onBlur:f,errorMessage:w.phone?T.phone:void 0}),e.jsxs("div",{className:l(le,ie),children:[e.jsx(n,{label:"Gender",name:"gender",options:y,placeholder:"Select gender",onChange:e=>b("gender",e.value),value:a.gender||""}),e.jsx(K,{label:"Date of birth",id:"dob",alignment:"right",variant:"light",type:d.Date,placeholder:"Choose date",value:a.dob||"",onChange:e=>b("dob",e),startYear:j-70,endYear:j-16,yearsOrder:r.DSC})]})]}),I&&e.jsx(m,{className:oe,title:"About “owner”",description:"To re-assign or disable an owner’s role, you will have\n                          to contact support",variant:c.Warning}),e.jsxs("div",{className:re,children:[e.jsx(u,{variant:v.Secondary,className:de,onClick:e=>{e.preventDefault(),p.handleClose&&p.handleClose()},children:"Cancel"}),e.jsx(u,{variant:v.Primary,className:de,type:"submit",disabled:!(s&&t)||_,loading:_,children:F?"Make changes":"Send Invitation"})]})]})})]}),M&&e.jsx(U,{role:C,className:me})]})}})})},ue=({activeTabIndex:a,data:t,loading:i,roles:n,refresh:o,paginate:r,pagination:d,handlePermissions:m})=>{const[c,u]=s.useState({activeRowData:null,showDetailsFlyout:!1,showPrivilegeFlyout:!1,showDialog:!1,dialogType:null}),v=null==n?void 0:n.find(({id:e})=>{var a,s;return e===(null==(s=null==(a=c.activeRowData)?void 0:a.role)?void 0:s.data.id)}),h=e=>u(a=>({...a,...e})),{actions:b,dataSchema:g,emptyStateProps:y}=function(a,s){const t={actions:[],dataSchema:[],emptyStateProps:null};switch(a){case 0:return{...t,actions:ee(s.handleStateUpdate,s.handlePermissions),dataSchema:[{name:e.jsx("span",{className:X.TeamMatesTable_account_name_header,children:"Name"}),render:a=>e.jsx(A,{firstname:null==a?void 0:a.firstname,lastname:null==a?void 0:a.lastname,isVerified:!1})},{name:"Email",accessor:"email"},{name:"Role",render:e=>{var a,s;return(null==(s=null==(a=null==e?void 0:e.role)?void 0:a.data)?void 0:s.display_name)||""}}]};case 1:return{...t,dataSchema:[{name:e.jsx("span",{className:X.TeamMatesTable_account_name_header,children:"Account name"}),render:a=>e.jsx(A,{firstname:null==a?void 0:a.firstname,lastname:null==a?void 0:a.lastname,isVerified:!1})},{name:"Email",accessor:"email"},{name:"Role",render:e=>{var a,s;return(null==(s=null==(a=null==e?void 0:e.role)?void 0:a.data)?void 0:s.display_name)||""}},{name:"Invited by",render:({invited_by:e})=>{var a,s;return f(`${(null==(a=null==e?void 0:e.data)?void 0:a.firstname)||""} ${(null==(s=null==e?void 0:e.data)?void 0:s.lastname)||""}`,28)}}],actions:Z(s.handleStateUpdate,s.handlePermissions),emptyStateProps:{title:"No sent invite",subText:"To invite your team mates to your company’s Brass account, click on the plus icon below."}};default:return t}}(a,{handleStateUpdate:h,handlePermissions:m}),j=c.dialogType?E({removeMember:$,resendInvite:H,deleteInvite:J})[c.dialogType]:x;return e.jsxs("div",{className:X.TeamMatesTable_wrapper,children:[e.jsx(p,{className:l(X.TeamMatesTable,{[X.TeamMatesTable_no_border_top]:a<2||2===a&&!(null==t?void 0:t.length),[X.TeamMatesTable_emptyTable]:!(null==t?void 0:t.length)}),config:{dataSchema:g,actionsSchema:b},data:t,isLoading:i,onRowClick:e=>{0===a&&h({showPrivilegeFlyout:!0,activeRowData:e})},renderEmptyState:()=>y?e.jsx(V,{className:X.TeamMatesTable_emptyState,icon:e.jsx(P,{}),...y}):void 0}),!!(null==t?void 0:t.length)&&e.jsx(_,{className:X.PaymentsTable_pagination,limit:null==d?void 0:d.per_page,paginate:(e,a)=>{r({page:e,limit:a})},totalPage:null==d?void 0:d.total_pages,currentPage:null==d?void 0:d.current_page}),e.jsx(R,{requiredPermissions:["team.manage","team.invite"],strict:!0,children:e.jsx(k,{onClick:()=>{h({showDetailsFlyout:!0,activeRowData:null})}})}
1),e.jsx(ce,{isOpen:c.showDetailsFlyout,data:c.activeRowData,handleClose:()=>h({showDetailsFlyout:!1,activeRowData:null}),refresh:o,roles:n}),e.jsx(O,{role:v,isOpen:c.showPrivilegeFlyout,handleClose:()=>{h({showPrivilegeFlyout:!1,activeRowData:null})}}),e.jsx(B,{show:c.showDialog&&!!c.dialogType,handleClose:()=>{h({showDialog:!1,dialogType:null})},data:c.activeRowData,refresh:o,...j})]})},ve="_TeamMatesPage_5sn3d_1",he="_TeamMatesPage_ttl_5sn3d_4",pe="_TeamMatesPage_tab_5sn3d_7",_e="_TeamMatesPage_tab_label_5sn3d_13",be=w(e=>{const{teamMembers:a,sentInvites:s}=e["module/administration"],{roles:t}=e["module/common"];return{sentInvites:s,teamMembers:a,roles:t}},{...q,fetchRoles:S})(I(a=>{var t,l;const{teamMembers:i,sentInvites:n,fetchTeamMembers:o,fetchSentInvites:r,fetchRoles:d,roles:{data:m}}=a,{profile:c,hasSessionTimedOut:u}=s.useContext(C),[v,h]=s.useState({activeIndex:0}),p=(null==c?void 0:c.permissions)||[],{updateFilters:_,filterData:g}=F({limit:10,page:1},e=>!u&&(e=>{switch(v.activeIndex){case 0:return o(e);case 1:return r({...D,...e});default:return}})(e),[v.activeIndex,u]),f=(e,a=!1)=>M(p,e,a),y=f("team.manage"),j=(a,s)=>e.jsxs("p",{className:_e,children:[a,e.jsx(N,{children:s})]}),T=[{label:j("People",(null==(t=null==i?void 0:i.pagination)?void 0:t.total)||0),component:e.jsx(ue,{activeTabIndex:v.activeIndex,data:i.data,pagination:i.pagination,loading:!!i.loading,roles:m,refresh:g,paginate:_,handlePermissions:f}),isVisible:!0},{label:j("Sent Invites",(null==(l=null==n?void 0:n.pagination)?void 0:l.total)||0),component:e.jsx(ue,{activeTabIndex:v.activeIndex,data:n.data,pagination:n.pagination,loading:!!n.loading,roles:m,refresh:g,paginate:_,handlePermissions:f}),isVisible:y}];return s.useEffect(()=>{d(),y&&r(D)},[]),e.jsxs("section",{className:ve,children:[e.jsx("h3",{className:he,children:"Team mates"}),e.jsx(b,{className:pe,activeIndex:v.activeIndex,config:T,onNavigate:e=>h(a=>({...a,activeIndex:e})),hideHeaderForSingleVisibleTab:!0})]})},{useBackButton:!0,forRoute:!0}));export{be as default};
2//# sourceMappingURL=TeamMatesPage-_VAD9rb_.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.