import{F as b,aP as D,l as B,o as c,aL as N,bT as G,j as r,aO as Q,P as Y,g as T,h as A,i as M,aQ as l,aR as z}from"./app-BgLa5dit.js";import{u as J,U as K,M as X,S as Z}from"./B5gexLDR.chunk.js";import{U as $}from"./ZKp_vc-v.chunk.js";import{a as tt}from"./m4aqaK_l.chunk.js";import{C as a,U as et}from"./q-IBKcuF.chunk.js";import{u as rt}from"./BTbeLL99.chunk.js";import{U as at}from"./D2M7oVCB.chunk.js";import{C as st}from"./C2cKa2R1.chunk.js";import{C as it,a as ot}from"./8iu0vnCW.chunk.js";import{g as mt}from"./B1ElCHu3.chunk.js";import{S as nt}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";import"./D6bTl1fN.chunk.js";import"./kOrk-qeI.chunk.js";import"./ChrB5FYK.chunk.js";import"./DR2FaZH9.chunk.js";import"./KUnagq9Z.chunk.js";import"./CCcwLDvu.chunk.js";import"./DDfKZ_ng.chunk.js";const i=b.encloseNamespace("userManager.staffManager"),m=G.Staff;function le(e){var S,h,U,E,C,I,y,x,R,P;rt({title:i("pageTitle")});const u=D(),o=B(),d=mt(e.customerId,m,e.queryParams),p=c(a.customer(e.customerId)),j=c(z.currentUser()),v=c(a.getCustomerProducts(e.customerId)),g=!!((h=(S=p.data)==null?void 0:S._integrations)!=null&&h.rostered),L={imageCdnUrl:ClickView.Config.Urls.ImageAPI},s=J(e.customerId,e.queryParams,m),n=s.data?"results"in s.data?s.data.results:s.data.data:null,q=(E=c(a.getAuthenticationMethodsByUserIds(e.customerId,((U=n==null?void 0:n.map(t=>t.id))==null?void 0:U.sort())??[])).data)==null?void 0:E.some(t=>N.hasSso(t)),f=c(a.userCount(e.customerId,m,e.queryParams));function w(t){l(u,a.resendActivationEmail(e.customerId,t.id,()=>{o.success(i("resendActivationEmailSuccess",{email:t.email,escapeText:!0}))},()=>{o.error(i("resendActivationEmailError",{email:t.email,escapeText:!0}))}))}function k(t){l(u,a.sendPasswordResetEmail(e.customerId,t.id,()=>{o.success(i("passwordResetEmailSuccess",{email:t.email,escapeText:!0}))},()=>{o.error(i("passwordResetEmailError",{email:t.email,escapeText:!0}))}))}function V(t){l(u,a.resendVerificationEmail(e.customerId,t.id,()=>{o.success(i("verificationEmailSuccess",{email:t.email,escapeText:!0}))},()=>{o.error(i("verificationEmailError",{email:t.email,escapeText:!0}))}))}function _(t){l(u,a.getSearchUserIds(e.customerId,m,e.queryParams,t))}function F(t){T.trigger({application:M.CRM_STUDIO,action:A.CrmStudio.USER_OVERVIEW,args:[t.id]})}function H(t){T.trigger({application:M.CRM_STUDIO,action:A.CrmStudio.USER_FEATURE_FLAGS,args:[t.id]})}const O=et.showEmptyState(s,e.queryParams);return r.jsx(it,{view:ot.Customers,children:r.jsx(st,{title:"Users",currentTabId:"users",id:e.customerId,loading:!1,children:r.jsxs($.Provider,{value:tt.Curator,children:[r.jsx(K,{userType:m,appLinks:d,users:n,userCount:f.data,headingComponent:p.data&&r.jsx(at,{active:"staff",id:e.customerId}),hasRostering:g}),O?r.jsx(nt,{appLinks:d}):r.jsx(r.Fragment,{children:r.jsxs("main",{className:"py-3 clearfix",children:[r.jsx(X,{customer:p.data,users:n,userType:m,config:L,countryCode:(I=(C=p.data)==null?void 0:C.country)==null?void 0:I.code,currentUser:j.data,searchEmptyState:Q.EmptyStates.TYPEAHEAD_RESULTS,appLinks:d,onClickResendActivationEmail:w,onClickSendResetEmail:k,onClickSendVerificationEmail:V,totalUsers:(y=f.data)==null?void 0:y.count,queryParams:e.queryParams,fetchUserIds:_,hasSso:q,selectWithSpreadsheetTemplate:Z,userRequest:(t,W)=>a.getUserIdByQuery(e.customerId,t,W),products:((x=v.data)==null?void 0:x.map(t=>t.id))??[],hasRostering:g,onEditUser:F,onEditUserOptions:H}),!!((P=(R=s.data)==null?void 0:R.pagination)!=null&&P.cursors)&&r.jsx(Y,{appLink:d.search,cursors:s.data.pagination.cursors,buttonVariant:"outline-dark",className:"py-2 float-end"})]})})]})})})}export{le as CustomerStaffView};
//# sourceMappingURL=D-cIOKPq.chunk.js.map
