PageSourceSearch

https://app.izooto.com/assets/Invite_users-DHW_A5wy.js

js izooto.com collected 2026-09-24 08:40:18 UTC 20,595 bytes, 1 lines download raw bytes

1import{$ as ee,j as e,B as g,aj as se,ag as Se,J,bz as we,M as a,T as b,bA as ke,cn as Ae,bu as Me,r as h,a3 as Ee,u as q,S as A,g as B,ax as K,k as he,b3 as De,al as Fe,l as W,h as Y,ba as G,be as ue,bk as ae,bl as Q,bf as Te,R as re,aA as _,E as te,a as Pe,ab as xe,ac as me,F as ze,f as Le,ak as ie,co as Oe,m as X,t as R,cp as Re,cq as Ne,cr as Ve,aC as Be,aD as We,ad as He,bi as Ue,a4 as ne,a9 as $e,cs as Ye,am as le,af as Ge,e as Je,ao as qe,H as _e,ct as Ze,cu as Ke,cv as Qe}from"./index-BRYgt7Qm.js";import{I as Xe}from"./IzListingTable-x_8hXXcs.js";import{a as pe,w as ge}from"./android-BO0DusMU.js";import{i as je}from"./ios-apple-CDg77oFe.js";import{u as es}from"./userprofile.service-BCYmEN2d.js";import{I as ss}from"./index-4p_RJOuY.js";import"./TableFooter-CH5m0aG9.js";const ts=ee([e.jsx("path",{d:"M5 18.08V19h.92l9.06-9.06-.92-.92z",opacity:".3"},"0"),e.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM5.92 19H5v-.92l9.06-9.06.92.92zM20.71 5.63l-2.34-2.34c-.2-.2-.45-.29-.71-.29s-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41"},"1")],"CreateTwoTone"),ns=ee([e.jsx("path",{d:"M8 9h8v10H8z",opacity:".3"},"0"),e.jsx("path",{d:"m15.5 4-1-1h-5l-1 1H5v2h14V4zM6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8z"},"1")],"DeleteTwoTone"),as=ee([e.jsx("path",{d:"M12 6c-3.79 0-7.17 2.13-8.82 5.5C4.83 14.87 8.21 17 12 17s7.17-2.13 8.82-5.5C19.17 8.13 15.79 6 12 6m0 10c-2.48 0-4.5-2.02-4.5-4.5S9.52 7 12 7s4.5 2.02 4.5 4.5S14.48 16 12 16",opacity:".3"},"0"),e.jsx("path",{d:"M12 4C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4m0 13c-3.79 0-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6s7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17m0-10c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7m0 7c-1.38 0-2.5-1.12-2.5-2.5S10.62 9 12 9s2.5 1.12 2.5 2.5S13.38 14 12 14"},"1")],"VisibilityTwoTone"),fe={ADMIN:"Admin",USER:"User"},oe=(s,n)=>n.isPrimaryUser||n.email==s.email,rs=s=>{const n=new Date(s).getFullYear(),j=new Date().getFullYear();return n===j},ce=s=>{switch(s.status){case"PENDING":return{statusi18nTextId:"Inactive",statusColor:"#ffb300"};case"ACCEPTED":return{statusi18nTextId:"Active",statusColor:"#00c533"};default:return{statusi18nTextId:"Inactive",statusColor:"#ffb300"}}},be=s=>[{id:"Dot",label:" ",exportable:!1,cell:n=>e.jsx(se,{item:!0,sx:{display:"flex"},children:e.jsx(Se,{title:e.jsx(a,{id:ce(n).statusi18nTextId}),placement:"top",children:e.jsx(J,{children:e.jsx(we,{sx:{bgcolor:ce(n).statusColor},size:10})})})})},{id:"Name",label:e.jsx(a,{id:"Name"}),cell:n=>e.jsx(b,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"224px"},children:n.name})},{id:"Email",label:e.jsx(a,{id:"Email Id"}),cell:n=>n.email},{id:"Role",label:e.jsx(a,{id:"Role"}),cell:n=>e.jsx(a,{id:fe[n.role]})},{id:"LastLogin",label:e.jsx(a,{id:"Last Login"}),cell:n=>e.jsxs(g,{children:[e.jsx(b,{whiteSpace:"nowrap",children:rs(n.lastLogin)?ke(n.lastLogin):Ae(n.lastLogin)||"-"}),e.jsx(b,{color:"textSecondary",whiteSpace:"nowrap",children:Me(n.lastLogin)})]})},{id:"Action",label:e.jsx(a,{id:"Action"}),exportable:!1,cell:n=>s(n)}];function is({invites:s,pagination:n,onFilterChange:j,actions:f,loading:i}){return e.jsx(g,{children:e.jsx(g,{children:e.jsx(g,{sx:{marginTop:"20px"},children:e.jsx(Xe,{data:s,columns:be(f),pagination:n,onFilter:d=>j(d),loading:i})})})})}const Ce="data:image/svg+xml,%3csvg%20width='45'%20height='45'%20viewBox='0%200%2045%2045'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0)'%3e%3cpath%20d='M22.5017%200.00437552C10.3428%20-0.235367%200.281526%209.4067%200.00390625%2021.5647C0.0356317%2027.7537%202.77606%2033.6184%207.50315%2037.6132V44.0626C7.50315%2044.5803%207.92287%2045%208.44058%2045C8.61626%2045%208.78842%2044.9506%208.93738%2044.8575L14.1625%2041.5935C16.8246%2042.6117%2019.6515%2043.1309%2022.5017%2043.1252C34.6606%2043.3649%2044.7219%2033.7229%2044.9995%2021.5648C44.7219%209.4067%2034.6606%20-0.235367%2022.5017%200.00437552Z'%20fill='%232196F3'/%3e%3cpath%20d='M37.3108%2015.3779C37.0318%2015.004%2036.5204%2014.8921%2036.1109%2015.1154L26.3619%2020.4305L20.2969%2015.2297C19.925%2014.9109%2019.3703%2014.932%2019.0239%2015.2785L7.77501%2026.5274C7.41004%2026.8945%207.4118%2027.4881%207.77905%2027.8531C8.07267%2028.1449%208.52289%2028.2096%208.88681%2028.0122L18.6358%2022.6971L24.7065%2027.8997C25.0784%2028.2186%2025.6331%2028.1974%2025.9794%2027.851L37.2283%2016.6021C37.5561%2016.2712%2037.5913%2015.7498%2037.3108%2015.3779Z'%20fill='%23FAFAFA'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0'%3e%3crect%20width='45'%20height='45'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",de=De(W)({"&.Mui-disabled":{opacity:1}}),ls={"&:focus":{backgroundColor:"transparent"},"&:hover":{backgroundColor:"transparent"},"&.Mui-focusVisible":{backgroundColor:"transparent"}},os={1:ge,2:pe,3:je,4:Ce},cs=90,ds=8,hs={PaperProps:{style:{maxHeight:cs*4.5+ds,width:250}}},us={redAsterisk:{color:"red"}},xs=({label:s,asterisk:n})=>e.jsxs(g,{component:"label",mb:1,children:[s,n&&e.jsx(g,{component:"span",sx:us.redAsterisk,children:"*"})]}),ms=({value:s,onChange:n,ProjectObj:j,selectChannelError:f,setSelectChannelError:i})=>{const[d,E]=h.useState(""),[u,v]=h.useState(s),{values:y}=Ee(),D=q(),F=p=>{E(p.target.value)};h.useEffect(()=>{const p=d.trim().toLowerCase();v(s.map(l=>({...l,channels:l.channels.filter(x=>!!(x.name?.toLowerCase().includes(p)||x.url?.toLowerCase().includes(p)))})).filter(l=>l.channels.length>0))},[d,s]),h.useEffect(()=>{i("")},[y.role]);const N=h.useCallback(()=>{let p=0,l="";
1return s.forEach(x=>{x.channels.forEach(o=>{o.checked&&(p++,l||(l=o.name))})}),p===0?e.jsx(a,{id:"Select-Channel"}):p===s.reduce((x,o)=>x+o.channels.length,0)?e.jsx(a,{id:"All-Channels"}):p===1?l:`${l} (+${p-1} others)`},[s]),M=h.useMemo(()=>s.every(p=>p.channels.every(l=>l.checked)),[s]),T={marginRight:"5px"},S=(p,l,x,o)=>{let k;o&&x?k={value:p,key:"single",projInd:x.id,channelInd:o.id}:k={value:p,key:"all"},n(k),l.setFieldError("projects",null),i("")};return e.jsxs(A,{children:[e.jsx(b,{variant:"subtitle2",children:e.jsx(xs,{label:e.jsx(a,{id:"Channel-Access"}),asterisk:!0})}),e.jsx(B,{name:"role",children:({form:p})=>e.jsx(K,{fullWidth:!0,sx:{cursor:p.values.role==="ADMIN"?"not-allowed":"default"},children:e.jsx(B,{name:"projects",children:({form:l,meta:x})=>e.jsx(e.Fragment,{children:e.jsxs(K,{error:!!(x.touched&&x.error),children:[e.jsxs(he,{displayEmpty:!0,multiple:!0,onBlur:()=>{const o=j.every(k=>k.channels.every(I=>!I.checked));i(o?e.jsx(a,{id:"Select a Channel"}):"")},value:l.values.projects,error:f,sx:{height:"2.5rem","& .MuiInputBase-input":{cursor:l.values.role==="ADMIN"?"not-allowed":"pointer"},"& .MuiMenuItem-root":{padding:0}},renderValue:N,input:e.jsx(Te,{}),MenuProps:hs,disabled:l.values.role==="ADMIN",children:[e.jsxs(g,{children:[e.jsx(de,{disabled:!0,dense:!0,children:e.jsx(Fe,{children:e.jsx(b,{variant:"subtitle1",children:e.jsx(a,{id:"Select-Channel"})})})}),e.jsx(W,{dense:!0,disableRipple:!0,sx:ls,children:e.jsx(Y,{placeholder:D.formatMessage({id:"Search By URL or Title"}),fullWidth:!0,value:d,onChange:F,onKeyDown:o=>{o.stopPropagation()},onClick:o=>o.stopPropagation(),InputProps:{startAdornment:e.jsx(G,{position:"start",children:e.jsx(ue,{})})}})}),e.jsxs(W,{disableRipple:!0,onClick:()=>S(!M,l),children:[e.jsx(ae,{sx:T,checked:M,onChange:o=>S(o.target.checked,l)}),e.jsx(Q,{children:e.jsx(b,{sx:{color:"black",fontWeight:500},children:e.jsx(a,{id:"All-Channels"})})})]})]}),u.map((o,k)=>e.jsxs(g,{children:[e.jsx(de,{disabled:!0,dense:!0,children:e.jsx(b,{sx:{fontWeight:500},children:o.name})}),o.channels.map((I,H)=>e.jsxs(W,{value:I,disableRipple:!0,onClick:()=>S(!I.checked,l,o,I),children:[e.jsx(ae,{id:I.id,sx:T,checked:I.checked,onChange:O=>S(O.target.checked,l,o,I)}),e.jsx(Q,{primary:e.jsxs(g,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(b,{sx:{color:"black",fontWeight:500},children:I.name}),e.jsx("img",{src:os[I.type],style:{width:"0.875rem"}})]}),secondary:e.jsx(b,{color:"textSecondary",sx:{fontWeight:500},children:I.url})})]},I.id))]},o.id))]}),l.values.role==="ADMIN"&&e.jsx(b,{variant:"body2",color:"textSecondary",children:e.jsx(a,{id:"Admin-will-have-access-to-all-channels"})}),x.touched&&x.error?e.jsx(re,{variant:"body2",color:"error",sx:{position:"absolute",top:"95%",ml:"0px",fontWeight:500},children:x.error}):f&&e.jsx(re,{sx:{position:"absolute",top:"95%",ml:"0px",fontWeight:500},error:!0,children:f})]})})})})})]})},ps={redAsterisk:{color:"red"}},Z=({label:s,asterisk:n})=>e.jsxs(g,{component:"label",mb:1,children:[s,n&&e.jsx(g,{component:"span",sx:ps.redAsterisk,children:"*"})]});function ye({open:s,onClose:n=()=>{},onCancel:j=()=>{},onSubmit:f=()=>{},isEditMode:i,userData:d,inviteRoles:E}){const u=q(),[v,y]=h.useState(""),D=_.object().shape({name:_.string().test("only-spaces",e.jsx(a,{id:"Only space(s) are not allowed"}),t=>t?.trim().length>0).isI18nUserName().onlySpaceNotAllowed().required(e.jsx(a,{id:"Enter name"})),email:_.string().izEmail(e.jsx(a,{id:"Invalid email address"})).required(e.jsx(a,{id:"Enter email address."})).noLeadingOrTrailingSpace()}),{projects:F,currentOrganization:N}=te(),M=Pe(),[T,S]=h.useState(!1),p=F.map(t=>({...t,channels:t.channels.map(r=>({...r,checked:!1}))})),[l,x]=h.useState(p),o=h.useRef(!1),k=()=>{const t=l.map(r=>({...r,channels:r.channels.map(c=>({...c,checked:!0}))}));x(t)},I=()=>{const t=F.map(r=>({...r,channels:r.channels.map(c=>({...c,checked:!1}))}));x(t)},H=({value:t,key:r,projInd:c=null,channelInd:C=null})=>{x(z=>{const L=[...z];if(r==="all"){const U=t;L.forEach($=>{$.channels.forEach(ve=>{ve.checked=U})})}else L.map(U=>
1{U.id==c&&U.channels.forEach($=>{$.id==C&&($.checked=t)})});return L})},O={name:d?.name,email:d?.email,projects:d?.projects,role:d?.role,organizationID:d?.organizationID},m=t=>l.filter(c=>c.channels.some(C=>C.checked)).map(c=>({id:c.id,channels:c.channels.filter(C=>C.checked).map(C=>({id:C.id}))})),w={"& .Mui-disabled":{cursor:i?"not-allowed":"default"}},V=t=>JSON.stringify(t)===JSON.stringify(O),P=async(t,{setFieldError:r})=>{if(o.current)return;if(V(t)){M(R({open:!0,message:u.formatMessage({id:"nthgChngdInFormSnckBrMsg"},{user:t.name}),variant:"alert",alert:{color:"error"},close:!0,autoHideDuration:2e3,anchorOrigin:{vertical:"bottom",horizontal:"center"}}));return}S(!0);const c=m();if(t.projects=c,t.role==="USER"&&t.projects.length===0){S(!1),r("projects",e.jsx(a,{id:"Select a Channel"}));return}else t.role==="ADMIN"&&r("projects",null);try{if(i){const{email:C,...z}=t;let L;d?.isPrimaryUser?L=await es({name:z?.name}):L=await Re(d?.id,z),L?.data?.id&&M(R({open:!0,message:u.formatMessage({id:"edtInvtUsrSuccssMsg"},{user:t.name}),variant:"alert",alert:{color:"success"},close:!0,autoHideDuration:2e3,anchorOrigin:{vertical:"bottom",horizontal:"center"}}))}else(await Ne(t))?.data?.inviteID&&M(R({open:!0,message:u.formatMessage({id:"sndInvtUsrSuccssMsg"},{user:t.name}),variant:"alert",alert:{color:"success"},close:!0,autoHideDuration:2e3,anchorOrigin:{vertical:"bottom",horizontal:"center"}}));n(),f()}catch(C){if(console.error("Error:",C),C.status===409){r("email",e.jsx(a,{id:"emailExistsAsyncErrMsg"}));return}let z="cantSntInvtUserApiErrMsg";i&&(z="cantEdtUsrApiErrMsg"),M(R({open:!0,message:u.formatMessage({id:z},{user:t.name}),variant:"alert",alert:{color:"error"},close:!0,autoHideDuration:2e3,anchorOrigin:{vertical:"bottom",horizontal:"center"}}))}finally{S(!1)}},Ie=async(t,r)=>{if(!i)return(await Ve(t,r))?.data.exists===!0?e.jsx(a,{id:"email-already-exists",values:{signin:""}}):""};return h.useEffect(()=>{if(d){const t=new Set;d.projects?.forEach(r=>{r?.channels?.forEach(c=>{t.add(c.id)})}),x(r=>r.map(c=>({...c,channels:c.channels.map(C=>({...C,checked:t.has(C.id)}))})))}},[d]),h.useEffect(()=>{!i&&s&&k()},[s]),e.jsx(g,{children:e.jsx(xe,{sx:{"& .MuiDialog-paper":{width:{lg:"533px",md:"25rem",xs:"22rem"},maxHeight:800,backgroundColor:"#F5F5F5"}},open:s,scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:e.jsx(me,{children:e.jsx(ze,{initialValues:i?O:{name:"",email:"",role:"ADMIN",organizationID:N.id,projects:[]},validationSchema:D,onSubmit:P,children:e.jsx(Le,{children:e.jsx(se,{container:!0,sx:{width:"100%"},children:e.jsxs(A,{width:{lg:"500px",md:"100%",xs:"100%"},spacing:2,children:[e.jsx(b,{variant:"h4",sx:{marginBottom:"0.5rem"},children:i?e.jsx(a,{id:"Edit-user"}):e.jsx(a,{id:"Add a new user"})}),e.jsx(ie,{sx:{margin:"0.5rem -1.5rem 1rem -1.5rem"}}),e.jsxs(A,{width:"100%",children:[e.jsx(b,{variant:"subtitle2",children:e.jsx(Z,{label:e.jsx(a,{id:"Name"}),asterisk:!0})}),e.jsx(B,{name:"name",children:({field:t,meta:r})=>e.jsx(Y,{...t,fullWidth:!0,variant:"outlined",id:"name",placeholder:u.formatMessage({id:"e.g John Smith"}),error:!!(r.touched&&r.error),helperText:r.touched&&r.error,InputProps:{style:{fontSize:"0.85rem"},endAdornment:e.jsx(G,{position:"end"})}})})]}),e.jsxs(A,{children:[e.jsx(b,{variant:"subtitle2",children:e.jsx(Z,{label:e.jsx(a,{id:"Email"}),asterisk:!0})}),e.jsx(Oe,{name:"email",validateAsync:Ie,isValidRef:o,children:({field:t,meta:r,loading:c})=>e.jsx(Y,{...t,fullWidth:!0,variant:"outlined",disabled:!!i,id:"email",placeholder:u.formatMessage({id:"e.g [email protected]"}),sx:w,error:!!(r.touched&&r.error),helperText:r.touched&&(r.error||(c?u.formatMessage({id:"Checking availability..."}):"")),InputProps:{style:{fontSize:"0.85rem"},endAdornment:e.jsx(G,{position:"end"})}})})]}),e.jsxs(A,{mb:2,children:[e.jsx(b,{variant:"subtitle2",children:e.jsx(Z,{label:e.jsx(a,{id:"Role"}),asterisk:!0})}),e.jsx(B,{name:"role",children:({form:t,meta:r})=>e.jsx(K,{fullWidth:!0,children:e.jsx(he,{size:"small",fullWidth:!0,disabled:!!i,id:"grouped-native-select",error:!!(r.touched&&r.error),sx:{fontSize:"0.85rem","& .MuiSelect-select.Mui-disabled":{cursor:i?"not-allowed":"pointer"}},value:t.values.role,onChange:c=>{t.setFieldValue("role",c.target.value),c.target.value==="USER"?I():c.target.value==="ADMIN"&&k()},MenuProps:{PaperProps:{style:{height:"5rem"}}},children:E.map((c,C)=>e.jsx(W,{value:c,children:fe[c]},C))})})})]}),e.jsx(ms,{value:l,isEditMode:i,onChange:H,ProjectObj:l,selectChannelError:v,setSelectChannelError:y}),e.jsx(ie,{sx:{margin:"1rem -1.5rem 1rem -1.5rem"}}),e.jsx(A,{direction:"row",justifyContent:"right",alignItems:"center",children:e.jsxs(A,{direction:"row",children:[e.jsx(X,{type:"button",variant:"outlined",onClick:t=>{n(),j(t)},sx:{color:"grey",borderColor:"lightgrey",marginRight:"1rem"},disabled:!!T,children:e.jsx(a,{id:"Cancel"})}),e.jsx(B,{children:({form:t})=>e.jsx(X,{variant:"contained",color:"primary",onClick:()=>{const r=m(t.values);t.values.projects=r,t.values.role=="USER"&&t.values.projects.length==0&&y(e.jsx(a,{id:"Select a Channel"}
1)),t.submitForm()},disabled:!!T,children:i?e.jsx(a,{id:"Save"}):e.jsx(a,{id:"Send invite"})})})]})})]})})})})})})})}const gs={1:ge,2:pe,3:je,4:Ce};function js({open:s,handleClose:n,userData:j}){const f=j?.projects,{projects:i}=te(),d=f?.map(u=>{const v=i.find(y=>y.id===u.id);if(v){const y=v.channels.filter(D=>u.channels.some(F=>F.id===D.id));return{...v,channels:y}}return null}).filter(u=>u!==null),E=u=>u?.channels?.map((v,y)=>e.jsx(Ue,{disablePadding:!0,children:e.jsx(Q,{primary:e.jsxs(g,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(b,{sx:{color:"black",fontWeight:500},children:v?.name}),e.jsx("img",{src:gs[v?.type],style:{width:"0.875rem"}})]}),secondary:e.jsx(b,{color:"textSecondary",sx:{fontWeight:500},children:v?.url})})},y));return e.jsxs(xe,{sx:{"& .MuiDialog-paper":{width:"30rem",maxHeight:500,backgroundColor:"#F5F5F5"}},open:s,onClose:n,scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:[e.jsxs(Be,{id:"scroll-dialog-title",sx:{display:"flex",justifyContent:"space-between",fontWeight:"bold",fontSize:"1.2rem"},children:[e.jsx(a,{id:"Accessible-channels"}),e.jsx(We,{onClick:n})]}),e.jsx(me,{children:d?.map(u=>e.jsxs(g,{children:[e.jsx(b,{variant:"h5",fontWeight:"bold",children:u?.name}),E(u)]},u.id))}),e.jsx(He,{})]})}const fs=({inviteUserData:s})=>{const[n,j]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(ne,{title:s.role==="ADMIN"?e.jsx(a,{id:"Admin Tooltip Message"}):e.jsx(a,{id:"View Access"}),placement:"top",children:e.jsx(g,{component:"span",children:e.jsx(J,{variant:"outlined",onClick:()=>{j(!0)},disabled:s.role==="ADMIN",sx:{marginRight:"8px",opacity:s.role==="ADMIN"?.5:1,cursor:s.role==="ADMIN"?"not-allowed":"default",height:"32px",width:"32px",backgroundColor:"#EFEFEF"},children:e.jsx(as,{fontSize:"medium"})})})}),e.jsx(js,{open:n,handleClose:()=>j(!1),userData:s})]})},bs=({inviteUserData:s,inviteRoles:n,onEditSuccess:j})=>{const[f,i]=h.useState(!1),d=()=>{j()};return e.jsxs(e.Fragment,{children:[e.jsx(ne,{title:e.jsx(a,{id:"Edit"}),placement:"top",children:e.jsx(g,{children:e.jsx(J,{variant:"outlined",onClick:()=>i(!0),sx:{marginRight:"8px",height:"32px",width:"32px",backgroundColor:"#EFEFEF"},disabled:!!s?.role==="ADMIN",children:e.jsx(ts,{color:s?.role==="ADMIN"&&s.isPrimaryUser?"lightGrey":"primary",fontSize:"large"})})})}),f&&e.jsx(ye,{open:f,onClose:()=>i(!1),onSubmit:()=>d(),inviteRoles:n,isEditMode:!0,userData:s})]})},Cs=({inviteUserData:s,onDelete:n})=>{const[j,f]=h.useState(!1),{user:i}=te(),d=q(),[E,u]=h.useState(!1),v=async()=>{u(!0);try{(await Ye(s.id))?.data?.id&&(le(R({open:!0,message:d.formatMessage({id:"invtUsrDelApiSucssMsg"},{user:s.name}),variant:"alert",alert:{color:"success"},close:!1,autoHideDuration:2e3,anchorOrigin:{vertical:"bottom",horizontal:"center"}})),n())}catch(y){console.error(`Error : ${y}`),le(R({open:!0,message:d.formatMessage({id:"invtUsrDelApiErrMsg"},{user:s.name}),variant:"alert",alert:{color:"error"},close:!1,autoHideDuration:2e3,anchorOrigin:{vertical:"bottom",horizontal:"center"}}))}finally{u(!1),f(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(ne,{title:e.jsx(a,{id:oe(i,s)?"Admin-can't-be-deleted":"Delete"}),placement:"top",children:e.jsx(g,{children:e.jsx(J,{variant:"outlined",sx:{height:"32px",width:"32px",backgroundColor:"#EFEFEF"},disabled:oe(i,s),onClick:()=>f(!0),children:e.jsx(ns,{fontSize:"medium"})})})}),e.jsx($e,{open:j,onClose:()=>f(!1),onConfirm:v,confirmationText:e.jsx(a,{id:"no-longer-have-access",values:{value1:s?.name,value2:s?.role.toLowerCase()}}),loading:E})]})},ys={pageIndex:1,pageSize:10,search:""},Is={index:1,pageSize:10,totalPageCount:1,hasNextPage:!1};function Ds(){const[s,n]=h.useState(!1),[j,f]=h.useState([]),[i,d]=h.useState(ys),[E,u]=h.useState(Is),[v,y]=h.useState(!1),[D,F]=h.useState([]),[N,M]=h.useState(!1),T=q(),S=async(m,w={})=>{const{updateState:V=!0}=w;V&&y(!0);try{const P=await Ke(m);return V&&(f(P.data.invites),u(P.data.paginationInfo)),P.data.invites}catch(P){return console.log("Invite user List fetch error",P),[]}finally{V&&y(!1)}};h.useEffect(()=>{(async()=>{const w=await Ze();F(w.data)})()},[]),h.useEffect(()=>{S(i)},[i]);const p=()=>{S(i)},l=async()=>{try{await S(i)}catch(m){console.log(m)}},x=()=>{S(i)},o=m=>e.jsxs(A,{direction:"row",children:[e.jsx(fs,{inviteUserData:m}),e.jsx(bs,{inviteRoles:D,inviteUserData:m,onEditSuccess:l}),e.jsx(Cs,{inviteUserData:m,onDelete:p})]}),k=h.useCallback(Ge.debounce(m=>d(w=>({...w,search:m,pageIndex:1})),250),[]),I=(m,w)=>{w&&w==="backdropClick"||n(!1)},H=m=>{d(w=>({...w,...m}))},O=async()=>{M(!0);try{const m=await S({...i,pageIndex:1,pageSize:5e3},{updateState:!1});if(!m?.length)return;Qe({data:m,columns:be(o),fileName:"invite-users.csv"})}catch{}finally{M(!1)}};return e.jsxs(g,{children:[e.jsxs(se,{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem",mt:2,children:[e.jsx(A,{children:e.jsx(b,{variant:"h4",children:e.jsx(a,{id:"Invite Users"})})}),Je.addUsers?e.jsx(A,{children:e.jsxs(X,{variant:"contained",onClick:()=>n(!0),children:[e.jsx(qe,{})," ",e.jsx(a,{id:"User"})]})}):e.jsx(e.Fragment,{})]}),e.jsxs(_e,{children:[e.jsxs(A,{children:[e.jsxs(g,{sx:{display:"flex",justifyContent:"space-between"},children:[e.jsx(Y,{fullWidth:!0,size:"small",placeholder:T.formatMessage({id:"Search By Name or Email Id"}),type:"search",onChange:m=>k(m.target.value),InputProps:{startAdornment:e.jsx(e.Fragment,{children:e.jsx(G,{position:"start",children:e.jsx(ue,{fontSize:"small"})})})},sx:{width:{lg:"16rem",xs:"100%",md:"100%"}}}),e.jsx(ss,{onClick:O,loading:N})]}),e.jsx(g,{children:e.jsx(is,{invites:j,pagination:E,onFilterChange:H,actions:o,loading:v})})]}),s&&e.jsx(ye,{inviteRoles:D,open:s,onClose:I,onSubmit:x,isEditMode:!1})]})]})}export{Ds 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.