import{F as V,aP as F,l as W,o as u,aL as B,bT as N,j as a,aO as b,P as D,aQ as p,aR as Q}from"./app-BgLa5dit.js";import{u as _,U as G,M as O,S as Y}from"./B5gexLDR.chunk.js";import{U as z}from"./ZKp_vc-v.chunk.js";import{a as J}from"./m4aqaK_l.chunk.js";import{C as r,U as K}from"./q-IBKcuF.chunk.js";import{u as X}from"./BTbeLL99.chunk.js";import{C as Z}from"./CsJ10TwK.chunk.js";import{g as $}from"./B1ElCHu3.chunk.js";import{S as ee}from"./ZEi5v1Bq.chunk.js";import"./1Of0XWgF.chunk.js";import"./qmOk7Utq.chunk.js";import"./BwrBcwEI.chunk.js";import"./BD9MrUJP.chunk.js";import"./EZim8aq-.chunk.js";import"./s6cGcwlA.chunk.js";import"./Zwjmkasg.chunk.js";import"./4qGb1BIY.chunk.js";import"./DnXDEnAR.chunk.js";import"./DpUpv6rY.chunk.js";import"./CG7zbly5.chunk.js";import"./MEkA24R1.chunk.js";import"./C53kfXmd.chunk.js";import"./BT3VnoQK.chunk.js";import"./kiNvuUO3.chunk.js";import"./Bkj-W53y.chunk.js";import"./KIVqng-q.chunk.js";import"./oUIMm7ik.chunk.js";import"./DD0tWTM_.chunk.js";import"./CPXlV0fg.chunk.js";import"./0GREfvNX.chunk.js";import"./Da6gN2lx.chunk.js";import"./DusGkY45.chunk.js";import"./byZ05CcP.chunk.js";import"./DULWIWQR.chunk.js";import"./nb6O6S6P.chunk.js";import"./COKAB0_A.chunk.js";import"./BYVfdcaw.chunk.js";import"./BfMtaC_g.chunk.js";import"./CBiQhiW4.chunk.js";import"./_VQbNI_n.chunk.js";import"./BcnghRSY.chunk.js";import"./DpWmZ9cE.chunk.js";import"./BxYybc33.chunk.js";import"./DkDkjje4.chunk.js";import"./3nM7jLnE.chunk.js";import"./DUpYPoLs.chunk.js";import"./9Z7K2s6J.chunk.js";import"./Cu2-dDll.chunk.js";const i=V.encloseNamespace("userManager.staffManager"),m=N.Staff;function Ke(t){var h,S,U,E,y,C,x,I,P,M;X({title:i("pageTitle")});const d=F(),o=W(),l=$(t.customerId,m,t.queryParams),n=u(r.customer(t.customerId)),R=u(Q.currentUser()),T=u(r.getCustomerProducts(t.customerId)),g=!!((S=(h=n.data)==null?void 0:h._integrations)!=null&&S.rostered),A={imageCdnUrl:ClickView.Config.Urls.ImageAPI},s=_(t.customerId,t.queryParams,m),c=s.data?"results"in s.data?s.data.results:s.data.data:null,j=(E=u(r.getAuthenticationMethodsByUserIds(t.customerId,((U=c==null?void 0:c.map(e=>e.id))==null?void 0:U.sort())??[])).data)==null?void 0:E.some(e=>B.hasSso(e)),f=u(r.userCount(t.customerId,m,t.queryParams));function q(e){p(d,r.resendActivationEmail(t.customerId,e.id,()=>{o.success(i("resendActivationEmailSuccess",{email:e.email,escapeText:!0}))},()=>{o.error(i("resendActivationEmailError",{email:e.email,escapeText:!0}))}))}function v(e){p(d,r.sendPasswordResetEmail(t.customerId,e.id,()=>{o.success(i("passwordResetEmailSuccess",{email:e.email,escapeText:!0}))},()=>{o.error(i("passwordResetEmailError",{email:e.email,escapeText:!0}))}))}function k(e){p(d,r.resendVerificationEmail(t.customerId,e.id,()=>{o.success(i("verificationEmailSuccess",{email:e.email,escapeText:!0}))},()=>{o.error(i("verificationEmailError",{email:e.email,escapeText:!0}))}))}function w(e){p(d,r.getSearchUserIds(t.customerId,m,t.queryParams,e))}const H=K.showEmptyState(s,t.queryParams);return a.jsx(z.Provider,{value:J.Curator,children:H?a.jsx(ee,{appLinks:l}):a.jsxs(a.Fragment,{children:[a.jsx(G,{userType:m,appLinks:l,users:c,userCount:f.data,headingComponent:n.data&&a.jsx(Z,{customer:n.data}),hasRostering:g}),a.jsxs("main",{className:"py-3 clearfix",children:[a.jsx(O,{customer:n.data,users:c,userType:m,config:A,countryCode:(C=(y=n.data)==null?void 0:y.country)==null?void 0:C.code,currentUser:R.data,searchEmptyState:b.EmptyStates.TYPEAHEAD_RESULTS,appLinks:l,onClickResendActivationEmail:q,onClickSendResetEmail:v,onClickSendVerificationEmail:k,totalUsers:(x=f.data)==null?void 0:x.count,queryParams:t.queryParams,fetchUserIds:w,hasSso:j,selectWithSpreadsheetTemplate:Y,userRequest:(e,L)=>r.getUserIdByQuery(t.customerId,e,L),products:((I=T.data)==null?void 0:I.map(e=>e.id))??[],hasRostering:g}),!!((M=(P=s.data)==null?void 0:P.pagination)!=null&&M.cursors)&&a.jsx(D,{appLink:l.search,cursors:s.data.pagination.cursors,buttonVariant:"outline-dark",className:"py-2 float-end"})]})]})})}export{Ke as StaffManagerView};
//# sourceMappingURL=BzUQ1DQ-.chunk.js.map
