import{R as P,o as u,aP as R,k as w,F as x,c2 as y,j as a,aO as A,bT as t,aQ as B,g as M}from"./app-BgLa5dit.js";import{E as j}from"./B7cxm1f4.chunk.js";import{B as J}from"./C0Fqgg75.chunk.js";import{U as L}from"./ZKp_vc-v.chunk.js";import{a as V}from"./m4aqaK_l.chunk.js";import{u as q}from"./DL8ott7R.chunk.js";import{B as F}from"./DpUpv6rY.chunk.js";import{B as m}from"./DpWmZ9cE.chunk.js";import{C as s,U as G}from"./q-IBKcuF.chunk.js";import{u as O}from"./BTbeLL99.chunk.js";import{J as H}from"./DfIMhO3y.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"./BTbZzD17.chunk.js";import"./B3eOBVf8.chunk.js";import"./3nM7jLnE.chunk.js";import"./CPXlV0fg.chunk.js";import"./DJ0pq8J_.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";const W={[t.Learner]:"userManager.bulkStudentUploadReviewAccounts",[t.Staff]:"userManager.bulkStaffUploadReviewAccounts",[t.Unknown]:"",[t.System]:""};function Be(e){var l,U;const{users:f}=q(),[g,n]=P.useState(0),T=u(s.yearGroups(e.customerId)),k=u(s.passwordPolicy(e.customerId)),c=u(s.getCustomerProducts(e.customerId)),p=R(),S=w();O({title:x.getPhrase(W[e.userType],"pageTitle")});const o=D(e.customerId,e.userType),d=!((l=c.data)!=null&&l.some(r=>r.id===y.Online));function I(r,i,E){m.validateSpreadsheetRequest({users:r,userType:e.userType,customerId:e.customerId,dispatch:p,canInviteExistingUsers:d,requestFn:s.bulkValidate,setTotalCompletedUsers:n,onSuccess:i,onError:E})}function h(r){const i=G.formatCreateOrValidateUserRequest([r],e.userType,e.customerId);return S(s.bulkValidate(i,d,null))}const C=F.useCreateJobErrorAlert();function b(){const r=m.getJobData({users:f,customerId:e.customerId,userType:e.userType});B(p,H.createUserJob(r,v,C))}function v(r){M.trigger({...o.userUploadStatus.polling,params:{userType:e.userType,jobId:r.id}})}return a.jsx(L.Provider,{value:V.Curator,children:a.jsx(J,{appLinks:o,userType:e.userType,currentStep:"review-accounts",canAddExistingUsers:!((U=c.data)!=null&&U.some(r=>r.id===y.Online)),children:a.jsx("div",{className:"px-3",children:a.jsx(j,{onClickConfirm:b,currentUser:{},userType:e.userType,appLinks:o,yearGroups:T.data,closePopup:e.closePopup,validateSpreadsheet:I,validateUser:h,totalValidatedUsers:g,setTotalValidatedUsers:n,emptyStateImageUrl:A.EmptyStates.UserManager.REVIEWS,showPasswordField:e.userType===t.Learner,emailRequired:e.userType===t.Staff,passwordPolicy:k.data,localErrorMessage:m.getErrorMessageOverride(e.userType)})})})})}export{Be as BulkUserUploadReviewAccountsView};
//# sourceMappingURL=C8wb1bzf.chunk.js.map
