PageSourceSearch

https://sohamrecruit.com/_next/static/chunks/app/admin/users/page-b0aae7a4bc4a9885.js

js sohamrecruit.com collected 2026-10-02 00:57:14 UTC 12,189 bytes, 1 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="ecf418ff-ebcd-4196-aa2a-6d51be18baa7",e._sentryDebugIdIdentifier="sentry-dbid-ecf418ff-ebcd-4196-aa2a-6d51be18baa7")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8733],{13189:(e,s,t)=>{Promise.resolve().then(t.bind(t,83126))},19215:(e,s,t)=>{"use strict";t.d(s,{d:()=>m,y:()=>d});var a=t(95155),l=t(12115),i=t(40980),r=t(52484),n=t(62791),c=t(33210);function d({message:e,type:s,onDismiss:t}){return(0,l.useEffect)(()=>{let e=setTimeout(t,4e3);return()=>clearTimeout(e)},[t]),(0,a.jsxs)("div",{className:(0,i.cn)("flex items-start gap-3 rounded-xl border px-4 py-3 text-sm shadow-sm","success"===s?"border-green-100 bg-green-50 text-green-800":"border-red-100 bg-red-50 text-red-800"),children:["success"===s?(0,a.jsx)(r.A,{size:16,className:"mt-0.5 shrink-0 text-green-600"}):(0,a.jsx)(n.A,{size:16,className:"mt-0.5 shrink-0 text-red-500"}),(0,a.jsx)("span",{className:"flex-1",children:e}),(0,a.jsx)("button",{onClick:t,"aria-label":"Dismiss",title:"Dismiss",className:"shrink-0 opacity-50 hover:opacity-100",children:(0,a.jsx)(c.A,{size:14})})]})}function m(){let[e,s]=(0,l.useState)(null);return{toast:e,show:(0,l.useCallback)((e,t="success")=>s({message:e,type:t}),[]),dismiss:(0,l.useCallback)(()=>s(null),[])}}},51914:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(78340).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},52484:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(78340).A)("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},62791:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(78340).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},68459:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(78340).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},83126:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>g});var a=t(95155),l=t(12115),i=t(73321),r=t(97086),n=t(27529),c=t(51159),d=t(19215),m=t(40980),o=t(51914),x=t(33210),h=t(94514);let u=(0,t(78340).A)("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);var p=t(91958),y=t(68459);function g(){let{user:e}=(0,c.A)(),s=(0,i.useRouter)(),{toast:t,show:g,dismiss:b}=(0,d.d)(),[j,f]=(0,l.useState)([]),[v,N]=(0,l.useState)(!0),[k,w]=(0,l.useState)(!1),[C,A]=(0,l.useState)({name:"",email:"",role:"recruiter",clientId:""}),[S,_]=(0,l.useState)(!1),[D,z]=(0,l.useState)(""),[M,I]=(0,l.useState)(!1),[E,T]=(0,l.useState)(null),[U,V]=(0,l.useState)(null);(0,l.useEffect)(()=>{e&&!["company_admin","super_admin"].includes(e.role)&&s.replace("/dashboard")},[e,s]);let L=(0,l.useCallback)(async()=>{N(!0);try{if(e?.role==="super_admin"){let e=await n.Dw.searchUsers("");f(e.users)}else{let e=await n.wr.listUsers();f(e.users)}}finally{N(!1)}},[e]);(0,l.useEffect)(()=>{e&&L()},[L,e]);let q=async e=>{await n.wr.setStatus(e,"approved"),g("User approved — they can now log in"),await L()},P=async e=>{await n.wr.setStatus(e,"rejected"),g("User rejected"),await L()},R=async(e,s)=>{await n.wr.resetPassword(e),g(`Temporary password sent to ${s}`)},$=async(e,s)=>{if(confirm(`Delete ${s}? This cannot be undone.`)){T(e);try{await n.wr.deleteUser(e),g(`${s} deleted`),f(s=>s.filter(s=>s.id!==e))}catch{g("Failed to delete user","error")}finally{T(null)}}},F=async e=>{await n.Dw.verifyEmail(e),g("Email verified"),await L()},B=async e=>{if(e.preventDefault(),z(""),I(!1),!C.name||!C.email)return void z("Name and email are required");if("client"===C.role&&!C.clientId)return void z("Select which client company this user belongs to");_(!0);try{"client"===C.role?(await n.b2.inviteUser(C.clientId,{name:C.name,email:C.email}),g(`Invite sent to ${C.name} — they'll set a password via email`)):(await n.wr.addUser({name:C.name,email:C.email,role:C.role}),g(`${C.name} added — they click Verify in email to sign in`)),w(!1),A({name:"",email:"",role:"recruiter",clientId:""}),await L()}catch(e){e instanceof n.hD&&e.data?.error==="seat_cap_reached"?(I(!0),z(String(e.data.message||"You’ve used all your seats. Upgrade to add more team members."))):z(e instanceof n.hD?String(e.data?.message||e.message):"Failed to add user")}finally{_(!1)}},H=j.filter(e=>"pending"===e.status),O=j.filter(e=>"pending"!==e.status);return(0,a.jsx)(r.A,{children:(0,a.jsxs)("div",{className:"p-6 space-y-4 max-w-2xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-lg font-semibold",children:"Users"}),(0,a.jsx)("p",{className:"text-sm text-gray-400",children:e?.tenantName})]}),(0,a.jsxs)("button",{onClick:()=>w(!0),className:"btn-primary",children:[(0,a.jsx)(o.A,{size:15})," Add user"]})]}),t&&(0,a.jsx)(d.y,{message:t.message,type:t.type,onDismiss:b}),k&&(0,a.jsxs)("div",{className:"rounded-xl border border-gray-100 bg-white p-5 shadow-sm space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"font-medium",children:"Add user"}),(0,a.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:"client"===C.role?"The contact gets an email with a link to set their password and access the client portal.":"They get an email to verify and sign in (plus a temporary password for later)."})]}),(0,a.jsx)("button",{onClick:()=>w(!1),className:"text-gray-400 hover:text-gray-600",children:(0,a.jsx)(x.A,{size:16})})]}),(0,a.jsxs)("form",{onSubmit:B,className:"space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Full name"}),(0,a.jsx)("input",{className:"input",value:C.name,onChange:e=>A(s=>({...s,name:e.target.value})),placeholder:"Anita Sharma",autoFocus:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Email"}),(0,a.jsx)("input",{className:"input",type:"email",value:C.email,onChange:e=>A(s=>({...s,email:e.target.value})),placeholder:"[email protected]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Role"}),(0,a.jsxs)("select",{className:"input",value:C.role,onChange:e=>{let s=e.target.value;"client"===s&&null===U&&n.b2.list().then(e=>V(e.clients)).catch(()=>V([])),A(e=>({...e,role:s}))},children:[(0,a.jsx)("option",{value:"recruiter",children:"Recruiter (delivery)"}),(0,a.jsx)("option",{value:"bd",children:"BD (clients, fees, revenue)"}),(0,a.jsx)("option",{value:"company_admin",children:"Company admin"}),(0,a.jsx)("option",{value:"client",children:"Client (portal access)"})]}),"client"===C.role&&(0,a.jsx)("p",{className:"mt-1 text-[11px] text-gray-400",children:"Client users see only their own shortlists in the portal and don't use a billable seat."})]}),"client"===C.role&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Client company"}),null===U?(0,a.jsx)("p",{className:"text-xs text-gray-400",children:"Loading clients…"}):0===U.length?(0,a.jsx)("p",{className:"rounded-lg bg-amber-50 border border-amber-100 px-3 py-2 text-xs text-amber-700",children:"No clients yet — add the client company on the Clients page first."}):(0,a.jsxs)("select",{className:"input",value:C.clientId,onChange:e=>A(s=>({...s,clientId:e.target.value})),children:[(0,a.jsx)("option",{value:"",children:"Select a client…"}),U.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),D&&(0,a.jsxs)("div",{className:(0,m.cn)("rounded-lg px-3 py-2 text-sm",M?"bg-amber-50 text-amber-800 space-y-2":"bg-red-50 text-red-700"),children:[(0,a.jsx)("p",{children:D}),M&&(0,a.jsx)("button",{type:"button",onClick:()=>s.push("/settings/billing"),className:"btn-primary text-xs",children:"Buy a seat →"})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end pt-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>w(!1),className:"btn text-xs",children:"Cancel"}),(0,a.jsx)("button",{type:"submit",disabled:S,className:"btn-primary text-xs",children:S?"Adding…":"Add user + send email"})]})]})]}),H.length>0&&(0,a.jsxs)("div",{className:"card",children:[(0,a.jsxs)("h2",{className:"mb-3 text-sm font-medium text-gray-500",children:["Pending approvals",(0,a.jsx)("span",{className:"ml-2 badge bg-amber-50 text-amber-700",children:H.length})]}),(0,a.jsx)("div",{className:"divide-y divide-gray-50",children:H.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-3 py-2.5",children:[(0,a.jsx)("div",{className:(0,m.cn)("flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-medium",(0,m.V7)(e.name)),children:(0,m.yC)(e.name)}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:e.name}),(0,a.jsxs)("p",{className:"text-xs text-gray-400 truncate",children:[e.email," \xb7 Self-registered \xb7 ",(0,m.Yq)(e.createdAt??"")]})]}),(0,a.jsx)("span",{className:(0,m.cn)("badge shrink-0",m.gu.pending),children:"Pending"}),(0,a.jsxs)("div",{className:"flex shrink-0 gap-1.5",children:[(0,a.jsxs)("button",{onClick:()=>q(e.id),className:"btn text-xs bg-green-50 text-green-700 border-green-100 hover:bg-green-100",children:[(0,a.jsx)(h.A,{size:12})," Approve"]}),(0,a.jsxs)("button",{onClick:()=>P(e.id),className:"btn-danger text-xs",children:[(0,a.jsx)(x.A,{size:12})," Reject"]})]})]},e.id))})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsxs)("h2",{className:"mb-3 text-sm font-medium text-gray-500",children:["All users \xb7 ",O.length]}),v?(0,a.jsx)("p",{className:"py-4 text-center text-sm text-gray-400",children:"Loading…"}):(0,a.jsx)("div",{className:"divide-y divide-gray-50",children:O.map(s=>(0,a.jsxs)("div",{className:"flex items-center gap-3 py-2.5",children:[(0,a.jsx)("div",{className:(0,m.cn)("flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-medium",(0,m.V7)(s.name)),children:(0,m.yC)(s.name)}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:s.name}),(0,a.jsx)("p",{className:"text-xs text-gray-400 truncate",children:s.email})]}),(0,a.jsx)("span",{className:(0,m.cn)("badge shrink-0 text-[11px]",m._t[s.role]),children:m.fn[s.role]}
1),(0,a.jsx)("span",{className:(0,m.cn)("badge shrink-0 text-[11px]",m.gu[s.status??"approved"]),children:s.status}),s.id!==e?.id&&(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[e?.role==="super_admin"&&!1===s.emailVerified&&(0,a.jsx)("button",{onClick:()=>F(s.id),title:"Verify user's email address",className:"p-1 text-gray-300 hover:text-gray-600 transition-colors",children:(0,a.jsx)(u,{size:13})}),(0,a.jsx)("button",{onClick:()=>R(s.id,s.name),title:"Send new temporary password",className:"p-1 text-gray-300 hover:text-gray-600 transition-colors",children:(0,a.jsx)(p.A,{size:13})}),(0,a.jsx)("button",{onClick:()=>$(s.id,s.name),disabled:E===s.id,title:"Delete user",className:"p-1 text-gray-300 hover:text-red-500 hover:bg-red-50 rounded transition-colors",children:(0,a.jsx)(y.A,{size:13})})]})]},s.id))})]})]})})}},91958:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(78340).A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},94514:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(78340).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])}},e=>{e.O(0,[8500,8437,9060,2917,7529,7086,9793,8441,2209,7358],()=>e(e.s=13189)),_N_E=e.O()}]);

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.