import{R as P,o as u,aP as R,k as w,F as x,c2 as f,j as a,aO as A,bT as r,aQ as B,g as M}from"./app-BgLa5dit.js";import{E as j}from"./B7cxm1f4.chunk.js";import{U as J}from"./ZKp_vc-v.chunk.js";import{a as L}from"./m4aqaK_l.chunk.js";import{u as V}from"./DL8ott7R.chunk.js";import{B as q}from"./DpUpv6rY.chunk.js";import{B as m}from"./DpWmZ9cE.chunk.js";import{C as s,U as O}from"./q-IBKcuF.chunk.js";import{u as F}from"./BTbeLL99.chunk.js";import{J as G}from"./DfIMhO3y.chunk.js";import{B as H}from"./CTVUBibh.chunk.js";import{g as D}from"./B1ElCHu3.chunk.js";import"./Bl0-tJo1.chunk.js";import"./DULJTEyC.chunk.js";import"./De9um1Ze.chunk.js";import"./COKAB0_A.chunk.js";import"./BYVfdcaw.chunk.js";import"./BfMtaC_g.chunk.js";import"./R6rHoxuD.chunk.js";import"./B82YbMjA.chunk.js";import"./D8ca7W7r.chunk.js";import"./0GREfvNX.chunk.js";import"./MEkA24R1.chunk.js";import"./B5-QmNlz.chunk.js";import"./CG7zbly5.chunk.js";import"./C53kfXmd.chunk.js";import"./DusGkY45.chunk.js";import"./DUpYPoLs.chunk.js";import"./EZim8aq-.chunk.js";import"./BD9MrUJP.chunk.js";import"./s6cGcwlA.chunk.js";import"./Zwjmkasg.chunk.js";import"./4qGb1BIY.chunk.js";import"./DnXDEnAR.chunk.js";import"./9Z7K2s6J.chunk.js";import"./Cu2-dDll.chunk.js";import"./BTbZzD17.chunk.js";import"./Dr5_kWYc.chunk.js";import"./DJ0pq8J_.chunk.js";import"./BUT90D7O.chunk.js";import"./CCcwLDvu.chunk.js";import"./DDfKZ_ng.chunk.js";const W={[r.Learner]:"userManager.bulkStudentUploadReviewAccounts",[r.Staff]:"userManager.bulkStaffUploadReviewAccounts",[r.Unknown]:"",[r.System]:""};function Me(e){var l,U;const{users:g}=V(),[y,n]=P.useState(0),T=u(s.yearGroups(e.customerId)),I=u(s.passwordPolicy(e.customerId)),c=u(s.getCustomerProducts(e.customerId)),p=R(),k=w();F({title:x.getPhrase(W[e.userType],"pageTitle")});const o=D(e.customerId,e.userType),d=!((l=c.data)!=null&&l.some(t=>t.id===f.Online));function S(t,i,E){m.validateSpreadsheetRequest({users:t,userType:e.userType,customerId:e.customerId,dispatch:p,canInviteExistingUsers:d,requestFn:s.bulkValidate,setTotalCompletedUsers:n,onSuccess:i,onError:E})}function h(t){const i=O.formatCreateOrValidateUserRequest([t],e.userType,e.customerId);return k(s.bulkValidate(i,d,null))}const b=q.useCreateJobErrorAlert();function C(){const t=m.getJobData({users:g,customerId:e.customerId,userType:e.userType});B(p,G.createUserJob(t,v,b))}function v(t){M.trigger({...o.userUploadStatus.polling,params:{userType:e.userType,jobId:t.id}})}return a.jsx(J.Provider,{value:L.Curator,children:a.jsx(H,{appLinks:o,userType:e.userType,currentStep:"review-accounts",canAddExistingUsers:!((U=c.data)!=null&&U.some(t=>t.id===f.Online)),customerId:e.customerId,children:a.jsx("div",{className:"px-3",children:a.jsx(j,{tableHeightOffset:220,onClickConfirm:C,currentUser:{},userType:e.userType,appLinks:o,yearGroups:T.data,closePopup:e.closePopup,validateSpreadsheet:S,validateUser:h,totalValidatedUsers:y,setTotalValidatedUsers:n,emptyStateImageUrl:A.EmptyStates.UserManager.REVIEWS,showPasswordField:e.userType===r.Learner,emailRequired:e.userType===r.Staff,passwordPolicy:I.data,localErrorMessage:m.getErrorMessageOverride(e.userType)})})})})}export{Me as BulkUserUploadReviewAccountsView};
//# sourceMappingURL=DlK3B5h9.chunk.js.map
