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