@flarehr/apollo-import-workspace-app 0.1.595 → 0.1.599

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,4 +64,4 @@ License: MIT
64
64
  `,j='"',se=j+j,X=!1,J=null,L=!1,G=((()=>{if(typeof C=="object"){if(typeof C.delimiter!="string"||u.BAD_DELIMITERS.filter(function(q){return C.delimiter.indexOf(q)!==-1}).length||(D=C.delimiter),typeof C.quotes!="boolean"&&typeof C.quotes!="function"&&!Array.isArray(C.quotes)||(A=C.quotes),typeof C.skipEmptyLines!="boolean"&&typeof C.skipEmptyLines!="string"||(X=C.skipEmptyLines),typeof C.newline=="string"&&(P=C.newline),typeof C.quoteChar=="string"&&(j=C.quoteChar),typeof C.header=="boolean"&&(N=C.header),Array.isArray(C.columns)){if(C.columns.length===0)throw new Error("Option columns is empty");J=C.columns}C.escapeChar!==void 0&&(se=C.escapeChar+j),C.escapeFormulae instanceof RegExp?L=C.escapeFormulae:typeof C.escapeFormulae=="boolean"&&C.escapeFormulae&&(L=/^[=+\-@\t\r].*$/)}})(),new RegExp(v(j),"g"));if(typeof S=="string"&&(S=JSON.parse(S)),Array.isArray(S)){if(!S.length||Array.isArray(S[0]))return B(null,S,X);if(typeof S[0]=="object")return B(J||Object.keys(S[0]),S,X)}else if(typeof S=="object")return typeof S.data=="string"&&(S.data=JSON.parse(S.data)),Array.isArray(S.data)&&(S.fields||(S.fields=S.meta&&S.meta.fields||J),S.fields||(S.fields=Array.isArray(S.data[0])?S.fields:typeof S.data[0]=="object"?Object.keys(S.data[0]):[]),Array.isArray(S.data[0])||typeof S.data[0]=="object"||(S.data=[S.data])),B(S.fields||[],S.data||[],X);throw new Error("Unable to serialize unrecognized input");function B(q,R,fe){var U="",Ae=(typeof q=="string"&&(q=JSON.parse(q)),typeof R=="string"&&(R=JSON.parse(R)),Array.isArray(q)&&0<q.length),ge=!Array.isArray(R[0]);if(Ae&&N){for(var Y=0;Y<q.length;Y++)0<Y&&(U+=D),U+=ce(q[Y],Y);0<R.length&&(U+=P)}for(var Ce=0;Ce<R.length;Ce++){var ye=(Ae?q:R[Ce]).length,Ie=!1,ae=Ae?Object.keys(R[Ce]).length===0:R[Ce].length===0;if(fe&&!Ae&&(Ie=fe==="greedy"?R[Ce].join("").trim()==="":R[Ce].length===1&&R[Ce][0].length===0),fe==="greedy"&&Ae){for(var pe=[],ee=0;ee<ye;ee++){var oe=ge?q[ee]:ee;pe.push(R[Ce][oe])}Ie=pe.join("").trim()===""}if(!Ie){for(var Re=0;Re<ye;Re++){0<Re&&!ae&&(U+=D);var z=Ae&&ge?q[Re]:Re;U+=ce(R[Ce][z],Re)}Ce<R.length-1&&(!fe||0<ye&&!ae)&&(U+=P)}}return U}function ce(q,R){var fe,U;return q==null?"":q.constructor===Date?JSON.stringify(q).slice(1,25):(U=!1,L&&typeof q=="string"&&L.test(q)&&(q="'"+q,U=!0),fe=q.toString().replace(G,se),(U=U||A===!0||typeof A=="function"&&A(q,R)||Array.isArray(A)&&A[R]||((Ae,ge)=>{for(var Y=0;Y<ge.length;Y++)if(-1<Ae.indexOf(ge[Y]))return!0;return!1})(fe,u.BAD_DELIMITERS)||-1<fe.indexOf(D)||fe.charAt(0)===" "||fe.charAt(fe.length-1)===" ")?j+fe+j:fe)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
65
65
  `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!o&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=_,u.ParserHandle=b,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=m,u.ReadableStreamStreamer=h,r.jQuery&&((i=r.jQuery).fn.parse=function(S){var C=S.config||{},A=[];return this.each(function(P){if(!(i(this).prop("tagName").toUpperCase()==="INPUT"&&i(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var j=0;j<this.files.length;j++)A.push({file:this.files[j],inputElem:this,instanceConfig:i.extend({},C)})}),N(),this;function N(){if(A.length===0)F(S.complete)&&S.complete();else{var P,j,se,X,J=A[0];if(F(S.before)){var L=S.before(J.file,J.inputElem);if(typeof L=="object"){if(L.action==="abort")return P="AbortError",j=J.file,se=J.inputElem,X=L.reason,void(F(S.error)&&S.error({name:P},j,se,X));if(L.action==="skip")return void D();typeof L.config=="object"&&(J.instanceConfig=i.extend(J.instanceConfig,L.config))}else if(L==="skip")return void D()}var G=J.instanceConfig.complete;J.instanceConfig.complete=function(B){F(G)&&G(B,J.file,J.inputElem),D()},u.parse(J.file,J.instanceConfig)}}function D(){A.splice(0,1),N()}}),s&&(r.onmessage=function(S){S=S.data,u.WORKER_ID===void 0&&S&&(u.WORKER_ID=S.workerId),typeof S.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(S.input,S.config),finished:!0}):(r.File&&S.input instanceof File||S.input instanceof Object)&&(S=u.parse(S.input,S.config))&&r.postMessage({workerId:u.WORKER_ID,results:S,finished:!0})}),(f.prototype=Object.create(d.prototype)).constructor=f,(p.prototype=Object.create(d.prototype)).constructor=p,(m.prototype=Object.create(m.prototype)).constructor=m,(h.prototype=Object.create(d.prototype)).constructor=h,u})}(ys)),ys.exports}var g4=p4();const w4=e=>e.filter(n=>!Ni(n)).length===0;function y4(e,t){const n=t.type==="text/csv",r=t.size<=10485760;if(n)if(r){const i={};i.complete=(o,s)=>{let a,l,u,d,f,p,m,h,b,v,_,x;e((a=o.errors,!Rr(te,a,Se())&&a.length===0?(l=(u=o.data,u.filter(E=>!w4(E))),d=l.length>1?new M(0,[void 0]):new M(1,[new Tn(2,[])]),d.tag===1?new M(1,[d.fields[0]]):(f=l.length<=5001?new M(0,[void 0]):new M(1,[new Tn(3,[])]),f.tag===1?new M(1,[f.fields[0]]):(p=Nc(l),m=p.length|0,h=p.some(Ni)?new M(1,[new Tn(4,[])]):new M(0,[void 0]),h.tag===1?new M(1,[h.fields[0]]):(b=(v=Om(et(E=>E.trim().toLocaleLowerCase(),p),{Equals:(E,T)=>E===T,GetHashCode:fr}),v.length===m?new M(0,[void 0]):new M(1,[new Tn(5,[])])),b.tag===1?new M(1,[b.fields[0]]):(_=(x=l.filter(E=>E.length!==m),x.length===0?new M(0,[void 0]):new M(1,[new Tn(6,[])])),_.tag===1?new M(1,[_.fields[0]]):new M(0,[new ox(new Vm(t.name),m0((E,T)=>[new z_(E),new tx(T.trim())],Nc(l)),new Lm(et(E=>new nx(et(T=>T.trim(),E)),mg(l))),t.size)])))))):new M(1,[new Tn(7,[he(0,o.errors).message])])))},i.error=(o,s)=>{e(new M(1,[new Tn(7,[o])]))},i.worker=!0,g4.parse(t,i)}else e(new M(1,[new Tn(1,[])]));else e(new M(1,[new Tn(0,[])]))}let Er=class extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["NoFileSelected","ParsingFile","FileSelected"]}};function v4(e){return e==null?[new Er(0,[void 0]),we()]:[new Er(2,[e]),we()]}function b4(e,t,n,r){const i=d=>Pn(t,new gn(1,[{Success:d}]));let o,s,a,l,u;switch(n.tag){case 1:{r.tag===1?o=4:o=5;break}case 2:{r.tag===2?o=6:o=7;break}default:if(n.fields[0].tag===1)n.fields[0].fields[0].tag===1?r.tag===1?(o=2,u=n.fields[0].fields[0].fields[0]):o=3:r.tag===1?(o=1,l=n.fields[0].fields[0].fields[0]):o=3;else switch(r.tag){case 0:{o=0,s=n.fields[0].fields[0][0],a=n.fields[0].fields[0][1];break}case 2:{o=0,s=n.fields[0].fields[0][0],a=n.fields[0].fields[0][1];break}default:o=3}}switch(o){case 0:return[new Er(1,[s]),pm(a)];case 1:return[new Er(2,[l]),hm(g([Pn(e,!0),i(!0)]))];case 2:return[new Er(0,[u]),i(!1)];case 3:return[r,we()];case 4:return[new Er(0,[void 0]),we()];case 5:return[r,we()];case 6:return[new Er(0,[void 0]),Pn(e,!1)];default:return[r,we()]}}function _4(e,t){let n,r,i,o,s,a,l;return Ui(g([new xt(3,[e]),new xt(4,[t]),new xt(5,[[zi(ue(new Gi(2,["fixed inset-0 bg-gray-500/50"]))),c("div",w(g([["className","fixed top-0 bottom-0 right-0 w-[480px] bg-white overflow-y-auto"],(n=[Wi(ue(new dr(2,[[c("div",w(g([["className","flex flex-col mt-6 mb-6 px-6"],(r=[c("div",w(g([["className","flex flex-row justify-between"],(i=[c("span",{className:"text-gray-900 font-semibold text-lg",children:"Frequently asked questions"}),c("button",w(g([["onClick",u=>{t()}],["type","button"],["className","text-gray-700"],(o=[zr(24,24)],["children",y.Children.toArray(Array.from(o))])])))],["children",y.Children.toArray(Array.from(i))])]))),c("div",{className:"font-semibold text-sm pt-6",children:"What file format is accepted for bulk import?"}),c("div",{className:"text-sm text-gray-500 pt-2",children:"The only accepted file format for bulk import is CSV."}),c("div",{className:"font-semibold text-sm pt-6",children:"What is the maximum upload file size?"}),c("div",{className:"text-sm text-gray-500 pt-2",children:"The maximum upload file size is 10 MB."}),c("div",{className:"font-semibold text-sm pt-6",children:"What is the maximum number of rows supported for bulk import?"}),c("div",{className:"text-sm text-gray-500 pt-2",children:"The maximum number of rows you can upload is 5,000."}),c("div",{className:"font-semibold text-sm pt-6",children:"What information do I need to include in the CSV file?"}),c("div",w(g([["className","text-sm text-gray-500 pt-2"],(s="You must include the required fields: “First name,” “Last name,” and “Email” to create a profile. “Mobile number” and “Employment basis” are optional but recommended, as they can help with searching and filtering.",["children",s])]))),c("div",{className:"font-semibold text-sm pt-6",children:"How do I format the CSV file?"}),c("div",w(g([["className","text-sm text-gray-500 pt-2"],(a=`We recommend downloading and editing our sample CSV template, which includes all the necessary column headers and example values.
66
66
  If you’re using your own CSV, ensure that your data is organised correctly and that there are no extra spaces or special characters.`,["children",a])]))),c("div",{className:"font-semibold text-sm pt-6",children:"What should I do if my CSV file contains errors?"}),c("div",w(g([["className","text-sm text-gray-500 pt-2"],(l=`We recommend checking for common issues, such as missing data or incorrect formatting before upload.
67
- If errors are detected during import, you can download a CSV file that lists all the rows with issues.`,["children",l])])))],["children",y.Children.toArray(Array.from(r))])])))]])))],["children",y.Children.toArray(Array.from(n))])])))]])]))}function x4(e,t){let n,r,i;return c("svg",w(g([["fill","none"],["height",t],["width",e],["viewBox","0 0 "+e+" "+t],["xmlns","http://www.w3.org/2000/svg"],(n=g([c("path",w(g([(r="M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10ZM3.99743 10C3.99743 13.3151 6.68487 16.0026 10 16.0026C13.3151 16.0026 16.0026 13.3151 16.0026 10C16.0026 6.68487 13.3151 3.99743 10 3.99743C6.68487 3.99743 3.99743 6.68487 3.99743 10Z",["d",r]),["fill","#D6E2FC"]]))),c("path",w(g([(i="M10 3C10 2.44772 10.4494 1.99356 10.9974 2.06242C11.7053 2.15137 12.3996 2.3348 13.0615 2.60896C14.0321 3.011 14.914 3.60028 15.6569 4.34315C16.3997 5.08602 16.989 5.96793 17.391 6.93853C17.6652 7.60043 17.8486 8.29473 17.9376 9.0026C18.0064 9.55057 17.5523 10 17 10C16.4477 10 16.0085 9.54925 15.9169 9.00462C15.842 8.55939 15.7169 8.12298 15.5433 7.7039C15.2417 6.97595 14.7998 6.31451 14.2426 5.75736C13.6855 5.20021 13.0241 4.75825 12.2961 4.45672C11.877 4.28313 11.4406 4.15804 10.9954 4.08314C10.4508 3.99152 10 3.55228 10 3Z",["d",i]),["fill","#2E66F7"]])))]),["children",y.Children.toArray(Array.from(n))])])))}function C4(e,t){let n,r;return c("svg",w(g([["fill","none"],["height",t],["width",e],["viewBox","0 0 "+e+" "+t],["xmlns","http://www.w3.org/2000/svg"],(n=g([c("path",w(g([(r="M17 21H3C1.346 21 0 19.654 0 18V14H2V18C2 18.551 2.448 19 3 19H17C17.552 19 18 18.551 18 18V14H20V18C20 19.654 18.654 21 17 21Z",["d",r]),["fill","#9CA3AF"]]))),c("path",{d:"M16.414 7L10 0.585999L3.586 7L5 8.414L9 4.414V15H11V4.414L15 8.414L16.414 7Z",fill:"#9CA3AF"})]),["children",y.Children.toArray(Array.from(n))])])))}function S4(e,t){Ii(Z.Delay(()=>Z.Bind(N0(1e3),()=>(y4(n=>{t(new ws(0,[new da(1,[n])]))},e),Z.Zero()))))}const nl=(()=>{const e=new Blob(["First name,Last name,Email,Mobile phone,Employment basis"],{type:"text/csv;charset=utf-8;"});return window.URL.createObjectURL(e)})();function E4(e){let t,n,r,i,o,s,a,l;const u=e.sendAnalytics,d=e.markDirty,f=e.cancel,p=e.next,m=e.existingCsvFile;let h;const b=v4(m);h=Gr(()=>Wr(()=>b,(N,D)=>b4(d,u,N,D),(N,D)=>{}),void 0,void 0);const v=h[0],_=h[1],x=N=>{_(new ws(0,[new da(0,[[new Vm(N.name),D=>{S4(N,D)}]])]))},E=y.useState(!1),T=E[1],I=y.useState(!1),O=I[1],F=y.useState(!1),S=F[1],C=y.useRef(void 0),A=v.tag===2;return c("div",w(g([["className","bg-gray-50 h-full"],(t=[c("div",w(g([["className","max-w-[640px] flex flex-col mx-12 mt-8 mb-12"],(n=[Sp(nl,E[0],()=>{T(!1)}),_4(F[0],()=>{S(!1)}),Na("Upload CSV"),Ta("Download and use our template, or upload your own CSV to get started."),c("a",w(g([["className","flex flex-row items-end gap-1"],["href",nl],["download","import_users"],(r=[c("span",{className:"text-sm font-medium text-primary-600 pt-2",children:"Download sample CSV template"}),Cp(16,16)],["children",y.Children.toArray(Array.from(r))])]))),c("div",w(g([["className","flex flex-row pt-3 gap-2"],(i=[Co("What kind of data do I need?",()=>{T(!0)}),Co("Frequently asked questions",()=>{S(!0)})],["children",y.Children.toArray(Array.from(i))])]))),c("div",w(K($(()=>H(I[0]?k(["className","h-75 border-gray-300 border-dashed border-2 rounded-md my-6 bg-blue-50 border-blue-300"]):k(["className","h-75 border-gray-300 border-dashed border-2 rounded-md my-6 hover:bg-gray-100"]),$(()=>{let N;return k((N=K($(()=>{let D,P,j,se,X,J,L,G,B,ce,q,R,fe,U;switch(v.tag){case 2:{let Ae;const ge=v.fields[0].SizeInBytes/1024/1024;return Ae=ge<.01?.01:ge,k(c("div",w(g([["className","p-6 justify-between items-center inline-flex w-full"],(D=[c("div",w(g([["className","justify-start items-start gap-2 flex"],(P=[c("div",{className:"text-center text-gray-600 text-sm font-medium",children:v.fields[0].Name.fields[0]}),c("span",w(g([["className","text-emerald-700"],(j=[Gu(20,20)],["children",y.Children.toArray(Array.from(j))])])))],["children",y.Children.toArray(Array.from(P))])]))),c("div",w(g([["className","justify-start items-start gap-3 flex"],(se=[c("div",{className:"text-center text-gray-500 text-sm font-medium",children:(X=nu("{0:F2}",Ae),Ir(Hn("%sMB"))(X))}),c("button",w(g([["className","justify-start items-center gap-1 flex text-red-600"],["onClick",Y=>{_(new ws(2,[]))}],(J=[c("div",{className:"text-center text-sm font-medium",children:"Remove"}),c("div",w(g([["className","w-4 h-4 justify-center items-center flex"],(L=[Ds(10,10)],["children",y.Children.toArray(Array.from(L))])])))],["children",y.Children.toArray(Array.from(J))])])))],["children",y.Children.toArray(Array.from(se))])])))],["children",y.Children.toArray(Array.from(D))])]))))}case 1:return k(c("div",w(g([["className","p-6 justify-between items-center inline-flex w-full"],(G=[c("div",w(g([["className","justify-start items-start gap-2 flex"],(B=[c("div",{className:"text-center text-gray-600 text-sm font-medium",children:v.fields[0].fields[0]}),c("span",w(g([["className","animate-spin"],(ce=[x4(20,20)],["children",y.Children.toArray(Array.from(ce))])])))],["children",y.Children.toArray(Array.from(B))])]))),c("div",w(g([["className","justify-start items-start gap-2 flex"],(q=[c("button",w(g([["className","justify-start items-center gap-1 flex text-red-600"],["onClick",Ae=>{_(new ws(1,[]))}],(R=[c("div",{className:"text-center text-sm font-medium",children:"Cancel"}),c("div",w(g([["className","w-4 h-4 justify-center items-center flex"],(fe=[Ds(10,10)],["children",y.Children.toArray(Array.from(fe))])])))],["children",y.Children.toArray(Array.from(R))])])))],["children",y.Children.toArray(Array.from(q))])])))],["children",y.Children.toArray(Array.from(G))])]))));default:{const Ae=ge=>{ge.preventDefault(),ge.stopPropagation()};return k(c("div",w(g([["className","flex flex-col items-center p-4"],["onDragEnter",ge=>{Ae(ge),O(!0)}],["onDragLeave",ge=>{Ae(ge),O(!1)}],["onDragOver",ge=>{Ae(ge),O(!0)}],["onDrop",ge=>{let Y;Ae(ge),O(!1),x((Y=ge,Y.dataTransfer).files.item(0))}],(U=K($(()=>{let ge,Y,Ce,ye,Ie,ae;return H((ge=v.fields[0],ge==null?k(Se()):(Y=ge,k(c("div",w(g([["className","h-9 p-2 bg-red-50 rounded-md justify-start items-start gap-2 inline-flex w-full"],(Ce=[c("div",w(g([["className","w-5 h-5 px-0.5 pt-0.5 pb-[3px] justify-center items-center flex"],(ye=[sp(16,15)],["children",y.Children.toArray(Array.from(ye))])]))),c("div",w(g([["className","grow shrink basis-0 flex-col justify-start items-start gap-2 inline-flex"],(Ie=[c("div",w(g([["className","self-stretch text-red-800 text-sm font-normal"],(ae=K($(()=>{let pe;const ee=z=>c("span",{className:"font-medium",children:z}),oe=z=>c("span",{children:[z]}),Re=c("a",{className:"underline",children:"sample CSV",href:nl,download:"import_users"});return k((pe=Y.tag===1?g([ee("File is too large (over 10MB). "),oe("Upload a "),ee("smaller file"),oe(".")]):Y.tag===2?g([ee("File is empty. "),oe("Ensure your file contains data before uploading.")]):Y.tag===3?g([ee("Too many rows (5000+). "),oe("Upload a "),ee("file with fewer rows"),oe(".")]):Y.tag===4?g([ee("Invalid CSV: Missing header field(s). "),oe("Try using our "),Re,oe(".")]):Y.tag===5?g([ee("Invalid CSV: Duplicate header fields. "),oe("Try using our "),Re,oe(".")]):Y.tag===6?g([ee("Invalid CSV: Rows have different lengths. "),oe("Check for missing or extra columns.")]):Y.tag===7?g([ee("Invalid CSV format. "),oe("Try using our "),Re,oe(".")]):g([ee("Unsupported file type. "),oe("Upload a "),ee(".csv file"),oe(".")]),c("p",{children:y.Children.toArray(Array.from(pe))})))})),["children",y.Children.toArray(Array.from(ae))])])))],["children",y.Children.toArray(Array.from(Ie))])])))],["children",y.Children.toArray(Array.from(Ce))])])))))),$(()=>{let pe;return H(k(c("div",w(g([["className","pt-2"],(pe=[C4(20,21)],["children",y.Children.toArray(Array.from(pe))])])))),$(()=>H(k(c("input",{type:"file",onChange:ee=>{const oe=ee.target.files;oe!=null&&oe.length>0&&x(oe.item(0))},className:"hidden",ref:C})),$(()=>H(k(c("span",{className:"text-gray-600 text-sm font-medium mt-3",children:"Drag and drop CSV file here"})),$(()=>H(k(c("button",{className:"rounded text-sm w-[120px] border px-3 py-2 mt-4 font-medium text-gray-700 bg-white hover:bg-gray-50",onClick:ee=>{Wn(oe=>{oe.click()},Ti(C.current))},type:"button",children:y.Children.toArray(["Choose file"])})),$(()=>k(c("span",{className:"text-gray-500 text-xs font-normal mt-2 font-normal pb-2",children:"Maximum size: 10 MB"}))))))))))}))})),["children",y.Children.toArray(Array.from(U))])]))))}}})),["children",y.Children.toArray(Array.from(N))]))})))))),c("div",w(g([["className","flex flex-row justify-end gap-3"],(o=[c("button",w(g([(s="bg-white hover:bg-gray-50 rounded-md text-red-700 shadow-sm text-sm border border-gray-300 font-medium px-3 py-2 w-[120px]",["className",s]),["onClick",N=>{f()}],["type","button"],["children",y.Children.toArray(["Cancel import"])]]))),c("button",w(g([(a="inline-flex justify-center items-center gap-x-1 rounded-md text-white bg-primary-600 hover:enabled:bg-primary-700 text-sm w-[120px] border font-medium px-3 py-2 disabled:opacity-50",["className",a]),["onClick",N=>{v.tag===2&&p(v.fields[0])}],["type","button"],["disabled",!A],(l=["Map fields",zu(13,8)],["children",y.Children.toArray(Array.from(l))])])))],["children",y.Children.toArray(Array.from(o))])])))],["children",y.Children.toArray(Array.from(n))])])))],["children",y.Children.toArray(Array.from(t))])])))}class zt extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["UploadingCsv","MappingColumns","MappingEmploymentBasis","Reviewing"]}}function Ep(e){switch(e.tag){case 1:return"field mapping";case 2:return"value mapping";case 3:return"review";default:return"file upload"}}class Ht extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Configuring","Importing"]}}function uf(e){return e.tag===1?"requested":Ep(e.fields[0])}function A4(){return[new Ht(0,[new zt(0,[void 0])]),we()]}function k4(e,t,n){const r=(U,Ae)=>Pn(e,new gn(3,[{From:uf(U),To:uf(Ae)}]));let i,o,s,a,l,u,d,f,p,m,h,b,v,_,x,E,T,I,O,F,S,C,A,N,D,P,j,se,X,J,L,G,B,ce,q,R,fe;if(t.tag===1)switch(t.fields[0].tag){case 1:{n.tag===0&&n.fields[0].tag===2?(i=13,P=n.fields[0].fields[0][1],j=n.fields[0].fields[0][0],se=n.fields[0].fields[0][2],X=t.fields[0].fields[0]):i=14;break}case 2:{t.fields[0].fields[0].tag===0?n.tag===0&&n.fields[0].tag===1?(i=17,R=n.fields[0].fields[0][0],fe=t.fields[0].fields[0].fields[0]):i=18:t.fields[0].fields[0].fields[1]!=null?n.tag===0&&n.fields[0].tag===1?(i=16,G=t.fields[0].fields[0].fields[0],B=n.fields[0].fields[0][0],ce=t.fields[0].fields[0].fields[1],q=n.fields[0].fields[0][1]):i=18:n.tag===0&&n.fields[0].tag===1?(i=15,J=t.fields[0].fields[0].fields[0],L=n.fields[0].fields[0][0]):i=18;break}default:n.tag===0&&n.fields[0].tag===3?n.fields[0].fields[0][2]!=null?(i=11,C=n.fields[0].fields[0][1],A=n.fields[0].fields[0][0],N=n.fields[0].fields[0][2][0],D=n.fields[0].fields[0][2][1]):(i=10,F=n.fields[0].fields[0][1],S=n.fields[0].fields[0][0]):i=12}else switch(t.fields[0].tag){case 1:{t.fields[0].fields[1]!=null?n.tag===0&&n.fields[0].tag===1?(i=4,f=t.fields[0].fields[0],p=n.fields[0].fields[0][0],m=t.fields[0].fields[1],h=n.fields[0].fields[0][1]):i=5:n.tag===0&&n.fields[0].tag===1?(i=3,u=t.fields[0].fields[0],d=n.fields[0].fields[0][0]):i=5;break}case 2:{n.tag===0&&n.fields[0].tag===2?(i=6,b=n.fields[0].fields[0][1],v=n.fields[0].fields[0][0],_=n.fields[0].fields[0][2],x=t.fields[0].fields[0]):i=7;break}case 3:{n.tag===0&&n.fields[0].tag===3?(i=8,n.fields[0].fields[0][0],E=n.fields[0].fields[0][1],T=n.fields[0].fields[0][2],I=t.fields[0].fields[1],O=t.fields[0].fields[0]):i=9;break}default:n.tag===0&&n.fields[0].tag===0?n.fields[0].fields[0]!=null?(i=1,s=t.fields[0].fields[0],a=n.fields[0].fields[0][0],l=n.fields[0].fields[0][1]):(i=0,o=t.fields[0].fields[0]):i=2}switch(i){case 0:{const U=new Ht(0,[new zt(1,[[o,new Nn(0,[void 0])]])]);return[U,r(n,U)]}case 1:{const U=te(s,a)?new Ht(0,[new zt(1,[[a,l]])]):new Ht(0,[new zt(1,[[s,new Nn(0,[void 0])]])]);return[U,r(n,U)]}case 2:return[n,we()];case 3:{const U=new Ht(0,[new zt(3,[[d,u,void 0]])]);return[U,r(n,U)]}case 4:{const U=new Ht(0,[new zt(2,[[p,f,m,h.tag===1&&h.fields[0].tag===1&&te(m,h.fields[0].fields[1])?h.fields[0].fields[2]:void 0]])]);return[U,r(n,U)]}case 5:return[n,we()];case 6:{const U=new Ht(0,[new zt(3,[[v,b,[_,x]]])]);return[U,r(n,U)]}case 7:return[n,we()];case 8:{const U=new Ht(1,[[O,E,T,I]]);return[U,r(n,U)]}case 9:return[n,we()];case 10:{const U=new Ht(0,[new zt(1,[[S,new Nn(1,[new Xr(0,[F])])]])]);return[U,r(n,U)]}case 11:{const U=new Ht(0,[new zt(2,[[A,C,N,D]])]);return[U,r(n,U)]}case 12:return[n,we()];case 13:{const U=new Ht(0,[new zt(1,[[j,new Nn(1,[new Xr(1,[P,se,X])])]])]);return[U,r(n,U)]}case 14:return[n,we()];case 15:{const U=new Ht(0,[new zt(0,[[L,new Nn(1,[new Xr(0,[J])])]])]);return[U,r(n,U)]}case 16:{const U=new Ht(0,[new zt(0,[[B,q.tag===1?q.fields[0].tag===1?te(G,q.fields[0].fields[0])&&te(ce,q.fields[0].fields[1])?q:new Nn(1,[new Xr(1,[G,ce,void 0])]):new Nn(1,[new Xr(1,[G,ce,void 0])]):new Nn(1,[new Xr(1,[G,ce,void 0])])]])]);return[U,r(n,U)]}case 17:{const U=new Ht(0,[new zt(0,[[R,new Nn(0,[fe])]])]);return[U,r(n,U)]}default:return[n,we()]}}function N4(e,t,n){let r,i,o,s,a,l,u,d,f,p,m;return Ui(g([new xt(3,[e]),new xt(4,[t]),new xt(5,[[zi(ue(new Gi(2,["fixed inset-0 bg-gray-500/50"]))),c("div",w(g([["className","fixed inset-0 z-10 w-screen overflow-y-auto"],(r=[c("div",w(g([["className","flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"],(i=[Wi(g([new dr(1,["relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl sm:my-8 sm:w-full sm:max-w-lg sm:p-6"]),new dr(2,[[c("div",w(g([["className","absolute top-0 right-0 hidden pt-4 pr-4 sm:block"],(o=[c("button",w(g([["type","button"],["onClick",h=>{t()}],["className","text-gray-600"],(s=[zr(24,24)],["children",y.Children.toArray(Array.from(s))])])))],["children",y.Children.toArray(Array.from(o))])]))),c("div",w(g([["className","sm:flex sm:items-start"],(a=[c("div",w(g([["className","mx-auto flex size-12 shrink-0 items-center justify-center sm:mx-0 sm:size-10"],(l=[e4([])],["children",y.Children.toArray(Array.from(l))])]))),c("div",w(g([["className","mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"],(u=[ip(g([new Us(2,["text-gray-900 text-lg font-bold"]),new Us(3,[["Cancel import"]])])),c("div",w(g([["className","mt-2 text-sm text-gray-500 leading-tight"],(d=[c("p",{children:["You’re about to cancel your import. All changes will be discarded."]}),c("br",{}),c("p",{children:["Are you sure you want to cancel and exit?"]})],["children",y.Children.toArray(Array.from(d))])])))],["children",y.Children.toArray(Array.from(u))])])))],["children",y.Children.toArray(Array.from(a))])]))),c("div",w(g([["className","mt-5 sm:mt-4 sm:flex sm:flex-row-reverse"],(f=[c("button",w(g([["type","button"],["onClick",h=>{n()}],(p="inline-flex w-full justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-medium text-white shadow-xs hover:bg-red-500 sm:ml-3 sm:w-auto",["className",p]),["children","Cancel import and exit"]]))),c("button",w(g([["type","button"],["onClick",h=>{t()}],(m="mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-gray-700 text-sm font-medium ring-1 shadow-xs ring-gray-300 ring-inset hover:bg-gray-50 sm:mt-0 sm:w-auto",["className",m]),["children","Continue import"]])))],["children",y.Children.toArray(Array.from(f))])])))]])]))],["children",y.Children.toArray(Array.from(i))])])))],["children",y.Children.toArray(Array.from(r))])])))]])]))}class rl extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["HasNotStartedYet","InProgress","Resolved","Failed"]}}function T4(e,t){let n;const r=sw();return n=y.useRef(r),T0(()=>mu(()=>{aw(n.current)})),$0(i=>{lw(n.current)||Ii(Z.Delay(()=>Z.TryWith(Z.Delay(()=>(t(new rl(1,[])),Z.Bind(e(i),o=>(t(new rl(2,[o])),Z.Zero())))),o=>(t(new rl(3,[o])),Z.Zero()))),n.current)})}function $4(e,t,n,r,i,o,s){let a,l,u,d,f,p,m;return oa((a=[()=>V6(e,t,n,r,i),h=>{let b,v,_,x;switch(h.tag){case 1:case 0:{b=3;break}case 3:{b=2,x=h.fields[0];break}default:h.fields[0].tag===1?(b=1,_=h.fields[0].fields[0]):(b=0,v=h.fields[0].fields[0])}switch(b){case 0:{o(v);break}case 1:{s(_);break}case 2:{s(nt(x));break}}}],T4(a[0],a[1]))),c("div",w(g([["className","fixed inset-0 z-100 w-screen overflow-y-auto bg-white"],(l=[c("div",w(g([["className","flex-col w-full h-full justify-center items-center gap-2.5 inline-flex overflow-hidden"],(u=[c("div",w(g([["className","self-stretch h-[118px] flex-col justify-center items-center gap-8 flex"],(d=[c("div",w(g([["className","relative"],(f=[n4([])],["children",y.Children.toArray(Array.from(f))])]))),c("div",w(g([["className","flex-col justify-start items-center gap-6 flex"],(p=[c("div",w(g([["className","w-[140px] h-1.5 relative bg-blue-100 rounded-[5px] overflow-hidden"],(m=[c("div",{style:{animation:"progressBar 2s linear infinite"},className:"h-1.5 top-0 absolute bg-gradient-to-r from-[#a650ff] to-[#0095f2] rounded-[5px]"})],["children",y.Children.toArray(Array.from(m))])])))],["children",y.Children.toArray(Array.from(p))])])))],["children",y.Children.toArray(Array.from(d))])])))],["children",y.Children.toArray(Array.from(u))])])))],["children",y.Children.toArray(Array.from(l))])])))}class yn extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Key","As","Appear","Show","ClassName","Enter","EnterFrom","EnterTo","Leave","LeaveFrom","LeaveTo","Children"]}}function M4(e){return c(Qh,Gn(e,1))}class Qr extends _e{constructor(t,n,r){super(),this.Type=t,this.Title=n,this.Message=r}}class ei extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Success","Failure","InProgress"]}}function I4(e,t){let n,r,i,o,s,a,l,u;return M4(g([new yn(1,["div"]),new yn(4,["pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5"]),new yn(3,[!0]),new yn(5,["transform ease-out duration-300 transition"]),new yn(6,["translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"]),new yn(7,["translate-y-0 opacity-100 sm:translate-x-0"]),new yn(8,["transition ease-in duration-100"]),new yn(9,["opacity-100"]),new yn(10,["opacity-0"]),new yn(11,[[c("div",w(g([["key","1"],(n=[c("div",w(g([["className","p-4"],(r=[c("div",w(g([["className","flex items-start"],(i=[c("div",w(g([["className","flex-shrink-0"],(o=K($(()=>{const d=t.Type;return d.tag===1?k(i4([])):d.tag===2?k(o4([])):k(r4([]))})),["children",y.Children.toArray(Array.from(o))])]))),c("div",w(g([["className","ml-3 w-0 flex-1 pt-0.5"],(s=[c("p",{className:"text-sm font-medium text-gray-900",children:t.Title}),c("p",{className:"mt-1 text-sm text-gray-500",children:t.Message})],["children",y.Children.toArray(Array.from(s))])]))),c("div",w(g([["className","ml-4 flex flex-shrink-0"],(a=[c("button",w(g([["type","button"],(l="inline-flex rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2",["className",l]),["onClick",d=>{e()}],(u=[Ds(10,10)],["children",y.Children.toArray(Array.from(u))])])))],["children",y.Children.toArray(Array.from(a))])])))],["children",y.Children.toArray(Array.from(i))])])))],["children",y.Children.toArray(Array.from(r))])])))],["children",y.Children.toArray(Array.from(n))])])))]])]))}function D4(e){const t=document.getElementById("workspace-toasts-container"),n=G0(),r=I4(()=>{document.getElementById(n).remove()},e),i=document.createElement("div");Zl(r,i);const o=i.children[0];o.id=n,t.appendChild(o)}const R4=3e4;function O4(e,t,n,r,i){const o=r.fields[0],s=()=>Z.Delay(()=>Z.Bind(N0(R4),()=>Z.Bind(t(n),a=>{let l,u,d,f;const p=a;return p.tag!==1&&(p.fields[0].tag!==1||(p.fields[0].fields[0].tag===1?(e(new Qr(new ei(1,[]),"We found a duplicate user",`"${he(i.fields[0],he(p.fields[0].fields[0].fields[0]-2,o).fields[0])}" already exists in our system. This user was skipped during the import.`)),!1):p.fields[0].fields[0].tag===2?(l=p.fields[0].fields[0].fields[0].DuplicateEmailCount>0,u=p.fields[0].fields[0].fields[0].OtherFailuresCount>0,e(l?u?new Qr(new ei(1,[]),"We found multiple import errors",(d="One or more of the rows experienced errors during import. These rows were skipped during the import.",d)):new Qr(new ei(1,[]),`We found ${p.fields[0].fields[0].fields[0].DuplicateEmailCount} duplicate users`,(f="One or more of the users you’re trying to add already exist in our system. These users were skipped during the import.",f)):new Qr(new ei(1,[]),"We found multiple import errors",(d="One or more of the rows experienced errors during import. These rows were skipped during the import.",d))),!1):(e(new Qr(new ei(0,[]),`Successfully added ${p.fields[0].fields[0].fields[0]} users`,"If you don’t see any new users, try refreshing this page.")),!1)))?Z.Bind(s(),()=>Z.Return(void 0)):Z.Zero()})));e(new Qr(new ei(2,[]),`Importing ${o.length} users`,"This might take a while. We’ll let you know via email when it’s finished.")),Ii(s())}class kt extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Completed","Active","Disabled"]}}class us extends _e{constructor(t,n,r,i){super(),this.UploadingCsv=t,this.MappingColumns=n,this.MappingEmploymentBasis=r,this.Reviewing=i}}function cf(){Rm(g(["admin","app","users"]))}function Ap(e){Rm(g(["admin","app","oops"]))}function F4(e){switch(e.tag){case 1:return new us(new kt(0,[]),new kt(1,[]),new kt(2,[]),new kt(2,[]));case 2:return new us(new kt(0,[]),new kt(0,[]),new kt(1,[]),new kt(2,[]));case 3:return new us(new kt(0,[]),new kt(0,[]),new kt(0,[]),new kt(1,[]));default:return new us(new kt(1,[]),new kt(2,[]),new kt(2,[]),new kt(2,[]))}}function P4(e,t,n,r,i,o){switch(o.tag){case 1:{const s=o.fields[0],a=s[1].tag===1?s[1].fields[0].tag===1?[Id(s[1].fields[0].fields[0],s[1].fields[0].fields[1]),s[0].HeaderRow,s[0].DataRows]:[Id(s[1].fields[0].fields[0],void 0),s[0].HeaderRow,s[0].DataRows]:[s[1].fields[0],s[0].HeaderRow,s[0].DataRows];return c(E6,{existingMappings:so(a[0]),headerRow:a[1],dataRows:a[2],next:l=>{let u;n(new yr(0,[(u=l,new os(1,[u[0],u[1]]))]))},back:l=>{n(new yr(1,[new tl(2,[l])]))},sendAnalytics:i})}case 2:{const s=rx(o.fields[0][0].DataRows,o.fields[0][2]);return c(R6,{existingMappings:so(o.fields[0][3]),employmentBasisColumn:s,next:a=>{n(new yr(0,[new os(2,[a])]))},back:a=>{n(new yr(1,[new tl(1,[a])]))}})}case 3:return c(m4,{apiCallAsync:e,dataRows:o.fields[0][0].DataRows,baseColumnMappings:o.fields[0][1],employmentBasis:so(o.fields[0][2]),next:s=>{let a;n(new yr(0,[(a=s,new os(3,[a[0],a[1]]))]))},back:()=>{n(new yr(1,[new tl(0,[])]))},onError:s=>{Ap()},sendAnalytics:i});default:{const s=_t(a=>a[0],o.fields[0]);return c(E4,{existingCsvFile:so(s),next:a=>{n(new yr(0,[new os(0,[a])]))},cancel:t,markDirty:r,sendAnalytics:i})}}}function cs(e,t){let n,r,i;switch(t.tag){case 1:return c("div",w(g([["className","text-sm font-medium border-b-2 border-primary-600 pt-1 pb-3 text-primary-600"],(n=[c("span",{children:e})],["children",y.Children.toArray(Array.from(n))])])));case 2:return c("div",w(g([["className","text-sm font-medium pt-1 pb-3 text-gray-500"],(r=[c("span",{children:e})],["children",y.Children.toArray(Array.from(r))])])));default:return c("div",w(g([["className","text-sm font-medium pt-1 pb-3 text-emerald-700 gap-2 inline-flex"],(i=[Gu(20,20),c("span",{children:e})],["children",y.Children.toArray(Array.from(i))])])))}}function L4(e){let t,n,r,i,o,s;s=G0(),o=y.useState(s);const l=T=>{Ii(fm(e.backendUrl,o[0],T))};oa(()=>{l(new gn(0,[{Section:"user import"}]))});const u=Gr(()=>Wr(A4,(T,I)=>k4(l,T,I),(T,I)=>{}),void 0,void 0),d=u[0],f=y.useState(!1),p=f[0],m=f[1],h=y.useState(!1),b=h[0],v=y.useCallback(T=>{T.preventDefault(),T.returnValue=!0},[]),_=()=>{window.removeEventListener("beforeunload",v)};E0(()=>(b?window.addEventListener("beforeunload",v):_(),{Dispose(){_()}}),[b]);let x;if(d.tag===0){const T=d.fields[0],I=()=>{p||m(!0)},O=F4(T),F=P4(S=>M2(e.backendUrl,S),I,u[1],h[1],l,T);x=c("div",w(g([["className","flex flex-col h-full"],(t=[N4(p,()=>{p&&m(!1)},()=>{p&&(l(new gn(2,[{From:Ep(T)}])),_(),cf())}),c("div",w(g([["className","flex flex-row justify-between px-12 pt-8 pb-4"],(n=[c("span",{className:"font-sonoma text-gray-900 font-bold text-lg",children:"Import Users from CSV"}),c("button",w(g([(r="bg-white hover:bg-gray-50 rounded-md text-red-700 shadow-sm text-sm border border-gray-300 font-medium px-3 py-2 w-[120px]",["className",r]),["onClick",S=>{I()}],["type","button"],["children",y.Children.toArray(["Cancel import"])]])))],["children",y.Children.toArray(Array.from(n))])]))),c("div",w(g([["className","flex flex-row items-center px-12 gap-2 border-b border-gray-200"],(i=[cs("1. Upload CSV",O.UploadingCsv),c("hr",{className:"w-16 pt-1.5"}),cs("2. Map fields",O.MappingColumns),c("hr",{className:"w-16 pt-1.5"}),cs("3. Map values",O.MappingEmploymentBasis),c("hr",{className:"w-16 pt-1.5"}),cs("4. Review",O.Reviewing)],["children",y.Children.toArray(Array.from(i))])]))),F],["children",y.Children.toArray(Array.from(t))])])))}else{const T=d.fields[0][3],I=d.fields[0][0],O=d.fields[0][1];x=$4(F=>I2(e.backendUrl,F),I,O,d.fields[0][2],T,F=>{l(new gn(8,[{ImportId:F,UsersInvited:T.tag!==1}])),_();const S=[F,I,O.Email];O4(C=>{D4(C)},C=>D2(e.backendUrl,C),S[0],S[1],S[2]),cf()},F=>{_(),Ap()})}const E=[c("style",{children:[Ql]}),x];return c(Ye,{},...E)}function V4(){Hl(e=>c(L4,e),"apollo-import-workspace-wizard")}Hl(e=>c(Ng,e),"apollo-import-workspace-app");F_();V4();
67
+ If errors are detected during import, you can download a CSV file that lists all the rows with issues.`,["children",l])])))],["children",y.Children.toArray(Array.from(r))])])))]])))],["children",y.Children.toArray(Array.from(n))])])))]])]))}function x4(e,t){let n,r,i;return c("svg",w(g([["fill","none"],["height",t],["width",e],["viewBox","0 0 "+e+" "+t],["xmlns","http://www.w3.org/2000/svg"],(n=g([c("path",w(g([(r="M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10ZM3.99743 10C3.99743 13.3151 6.68487 16.0026 10 16.0026C13.3151 16.0026 16.0026 13.3151 16.0026 10C16.0026 6.68487 13.3151 3.99743 10 3.99743C6.68487 3.99743 3.99743 6.68487 3.99743 10Z",["d",r]),["fill","#D6E2FC"]]))),c("path",w(g([(i="M10 3C10 2.44772 10.4494 1.99356 10.9974 2.06242C11.7053 2.15137 12.3996 2.3348 13.0615 2.60896C14.0321 3.011 14.914 3.60028 15.6569 4.34315C16.3997 5.08602 16.989 5.96793 17.391 6.93853C17.6652 7.60043 17.8486 8.29473 17.9376 9.0026C18.0064 9.55057 17.5523 10 17 10C16.4477 10 16.0085 9.54925 15.9169 9.00462C15.842 8.55939 15.7169 8.12298 15.5433 7.7039C15.2417 6.97595 14.7998 6.31451 14.2426 5.75736C13.6855 5.20021 13.0241 4.75825 12.2961 4.45672C11.877 4.28313 11.4406 4.15804 10.9954 4.08314C10.4508 3.99152 10 3.55228 10 3Z",["d",i]),["fill","#2E66F7"]])))]),["children",y.Children.toArray(Array.from(n))])])))}function C4(e,t){let n,r;return c("svg",w(g([["fill","none"],["height",t],["width",e],["viewBox","0 0 "+e+" "+t],["xmlns","http://www.w3.org/2000/svg"],(n=g([c("path",w(g([(r="M17 21H3C1.346 21 0 19.654 0 18V14H2V18C2 18.551 2.448 19 3 19H17C17.552 19 18 18.551 18 18V14H20V18C20 19.654 18.654 21 17 21Z",["d",r]),["fill","#9CA3AF"]]))),c("path",{d:"M16.414 7L10 0.585999L3.586 7L5 8.414L9 4.414V15H11V4.414L15 8.414L16.414 7Z",fill:"#9CA3AF"})]),["children",y.Children.toArray(Array.from(n))])])))}function S4(e,t){Ii(Z.Delay(()=>Z.Bind(N0(1e3),()=>(y4(n=>{t(new ws(0,[new da(1,[n])]))},e),Z.Zero()))))}const nl=(()=>{const e=new Blob(["First name,Last name,Email,Mobile phone,Employment basis"],{type:"text/csv;charset=utf-8;"});return window.URL.createObjectURL(e)})();function E4(e){let t,n,r,i,o,s,a,l;const u=e.sendAnalytics,d=e.markDirty,f=e.cancel,p=e.next,m=e.existingCsvFile;let h;const b=v4(m);h=Gr(()=>Wr(()=>b,(N,D)=>b4(d,u,N,D),(N,D)=>{}),void 0,void 0);const v=h[0],_=h[1],x=N=>{_(new ws(0,[new da(0,[[new Vm(N.name),D=>{S4(N,D)}]])]))},E=y.useState(!1),T=E[1],I=y.useState(!1),O=I[1],F=y.useState(!1),S=F[1],C=y.useRef(void 0),A=v.tag===2;return c("div",w(g([["className","bg-gray-50 h-full"],(t=[c("div",w(g([["className","max-w-[640px] flex flex-col mx-12 mt-8 mb-12"],(n=[Sp(nl,E[0],()=>{T(!1)}),_4(F[0],()=>{S(!1)}),Na("Upload CSV"),Ta("Download and use our template, or upload your own CSV to get started."),c("a",w(g([["className","flex flex-row items-end gap-1"],["href",nl],["download","import_users"],(r=[c("span",{className:"text-sm font-medium text-primary-600 pt-2",children:"Download sample CSV template"}),Cp(16,16)],["children",y.Children.toArray(Array.from(r))])]))),c("div",w(g([["className","flex flex-row pt-3 gap-2"],(i=[Co("What kind of data do I need?",()=>{T(!0)}),Co("Frequently asked questions",()=>{S(!0)})],["children",y.Children.toArray(Array.from(i))])]))),c("div",w(K($(()=>H(I[0]?k(["className","h-75 border-gray-300 border-dashed border-2 rounded-md my-6 bg-blue-50 border-blue-300"]):k(["className","h-75 border-gray-300 border-dashed border-2 rounded-md my-6 hover:bg-gray-100"]),$(()=>{let N;return k((N=K($(()=>{let D,P,j,se,X,J,L,G,B,ce,q,R,fe,U;switch(v.tag){case 2:{let Ae;const ge=v.fields[0].SizeInBytes/1024/1024;return Ae=ge<.01?.01:ge,k(c("div",w(g([["className","p-6 justify-between items-center inline-flex w-full"],(D=[c("div",w(g([["className","justify-start items-start gap-2 flex"],(P=[c("div",{className:"text-center text-gray-600 text-sm font-medium",children:v.fields[0].Name.fields[0]}),c("span",w(g([["className","text-emerald-700"],(j=[Gu(20,20)],["children",y.Children.toArray(Array.from(j))])])))],["children",y.Children.toArray(Array.from(P))])]))),c("div",w(g([["className","justify-start items-start gap-3 flex"],(se=[c("div",{className:"text-center text-gray-500 text-sm font-medium",children:(X=nu("{0:F2}",Ae),Ir(Hn("%sMB"))(X))}),c("button",w(g([["className","justify-start items-center gap-1 flex text-red-600"],["onClick",Y=>{_(new ws(2,[]))}],(J=[c("div",{className:"text-center text-sm font-medium",children:"Remove"}),c("div",w(g([["className","w-4 h-4 justify-center items-center flex"],(L=[Ds(10,10)],["children",y.Children.toArray(Array.from(L))])])))],["children",y.Children.toArray(Array.from(J))])])))],["children",y.Children.toArray(Array.from(se))])])))],["children",y.Children.toArray(Array.from(D))])]))))}case 1:return k(c("div",w(g([["className","p-6 justify-between items-center inline-flex w-full"],(G=[c("div",w(g([["className","justify-start items-start gap-2 flex"],(B=[c("div",{className:"text-center text-gray-600 text-sm font-medium",children:v.fields[0].fields[0]}),c("span",w(g([["className","animate-spin"],(ce=[x4(20,20)],["children",y.Children.toArray(Array.from(ce))])])))],["children",y.Children.toArray(Array.from(B))])]))),c("div",w(g([["className","justify-start items-start gap-2 flex"],(q=[c("button",w(g([["className","justify-start items-center gap-1 flex text-red-600"],["onClick",Ae=>{_(new ws(1,[]))}],(R=[c("div",{className:"text-center text-sm font-medium",children:"Cancel"}),c("div",w(g([["className","w-4 h-4 justify-center items-center flex"],(fe=[Ds(10,10)],["children",y.Children.toArray(Array.from(fe))])])))],["children",y.Children.toArray(Array.from(R))])])))],["children",y.Children.toArray(Array.from(q))])])))],["children",y.Children.toArray(Array.from(G))])]))));default:{const Ae=ge=>{ge.preventDefault(),ge.stopPropagation()};return k(c("div",w(g([["className","flex flex-col items-center p-4"],["onDragEnter",ge=>{Ae(ge),O(!0)}],["onDragLeave",ge=>{Ae(ge),O(!1)}],["onDragOver",ge=>{Ae(ge),O(!0)}],["onDrop",ge=>{let Y;Ae(ge),O(!1),x((Y=ge,Y.dataTransfer).files.item(0))}],(U=K($(()=>{let ge,Y,Ce,ye,Ie,ae;return H((ge=v.fields[0],ge==null?k(Se()):(Y=ge,k(c("div",w(g([["className","h-9 p-2 bg-red-50 rounded-md justify-start items-start gap-2 inline-flex w-full"],(Ce=[c("div",w(g([["className","w-5 h-5 px-0.5 pt-0.5 pb-[3px] justify-center items-center flex"],(ye=[sp(16,15)],["children",y.Children.toArray(Array.from(ye))])]))),c("div",w(g([["className","grow shrink basis-0 flex-col justify-start items-start gap-2 inline-flex"],(Ie=[c("div",w(g([["className","self-stretch text-red-800 text-sm font-normal"],(ae=K($(()=>{let pe;const ee=z=>c("span",{className:"font-medium",children:z}),oe=z=>c("span",{children:[z]}),Re=c("a",{className:"underline",children:"sample CSV",href:nl,download:"import_users"});return k((pe=Y.tag===1?g([ee("File is too large (over 10MB). "),oe("Upload a "),ee("smaller file"),oe(".")]):Y.tag===2?g([ee("File is empty. "),oe("Ensure your file contains data before uploading.")]):Y.tag===3?g([ee("Too many rows (5000+). "),oe("Upload a "),ee("file with fewer rows"),oe(".")]):Y.tag===4?g([ee("Invalid CSV: Missing header field(s). "),oe("Try using our "),Re,oe(".")]):Y.tag===5?g([ee("Invalid CSV: Duplicate header fields. "),oe("Try using our "),Re,oe(".")]):Y.tag===6?g([ee("Invalid CSV: Rows have different lengths. "),oe("Check for missing or extra columns.")]):Y.tag===7?g([ee("Invalid CSV format. "),oe("Try using our "),Re,oe(".")]):g([ee("Unsupported file type. "),oe("Upload a "),ee(".csv file"),oe(".")]),c("p",{children:y.Children.toArray(Array.from(pe))})))})),["children",y.Children.toArray(Array.from(ae))])])))],["children",y.Children.toArray(Array.from(Ie))])])))],["children",y.Children.toArray(Array.from(Ce))])])))))),$(()=>{let pe;return H(k(c("div",w(g([["className","pt-2"],(pe=[C4(20,21)],["children",y.Children.toArray(Array.from(pe))])])))),$(()=>H(k(c("input",{type:"file",onChange:ee=>{const oe=ee.target.files;oe!=null&&oe.length>0&&x(oe.item(0))},className:"hidden",ref:C})),$(()=>H(k(c("span",{className:"text-gray-600 text-sm font-medium mt-3",children:"Drag and drop CSV file here"})),$(()=>H(k(c("button",{className:"rounded text-sm w-[120px] border px-3 py-2 mt-4 font-medium text-gray-700 bg-white hover:bg-gray-50",onClick:ee=>{Wn(oe=>{oe.click()},Ti(C.current))},type:"button",children:y.Children.toArray(["Choose file"])})),$(()=>k(c("span",{className:"text-gray-500 text-xs font-normal mt-2 font-normal pb-2",children:"Maximum size: 10 MB"}))))))))))}))})),["children",y.Children.toArray(Array.from(U))])]))))}}})),["children",y.Children.toArray(Array.from(N))]))})))))),c("div",w(g([["className","flex flex-row justify-end gap-3"],(o=[c("button",w(g([(s="bg-white hover:bg-gray-50 rounded-md text-red-700 shadow-sm text-sm border border-gray-300 font-medium px-3 py-2 w-[120px]",["className",s]),["onClick",N=>{f()}],["type","button"],["children",y.Children.toArray(["Cancel import"])]]))),c("button",w(g([(a="inline-flex justify-center items-center gap-x-1 rounded-md text-white bg-primary-600 hover:enabled:bg-primary-700 text-sm w-[120px] border font-medium px-3 py-2 disabled:opacity-50",["className",a]),["onClick",N=>{v.tag===2&&p(v.fields[0])}],["type","button"],["disabled",!A],(l=["Map fields",zu(13,8)],["children",y.Children.toArray(Array.from(l))])])))],["children",y.Children.toArray(Array.from(o))])])))],["children",y.Children.toArray(Array.from(n))])])))],["children",y.Children.toArray(Array.from(t))])])))}class zt extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["UploadingCsv","MappingColumns","MappingEmploymentBasis","Reviewing"]}}function Ep(e){switch(e.tag){case 1:return"field mapping";case 2:return"value mapping";case 3:return"review";default:return"file upload"}}class Ht extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Configuring","Importing"]}}function uf(e){return e.tag===1?"requested":Ep(e.fields[0])}function A4(){return[new Ht(0,[new zt(0,[void 0])]),we()]}function k4(e,t,n){const r=(U,Ae)=>Pn(e,new gn(3,[{From:uf(U),To:uf(Ae)}]));let i,o,s,a,l,u,d,f,p,m,h,b,v,_,x,E,T,I,O,F,S,C,A,N,D,P,j,se,X,J,L,G,B,ce,q,R,fe;if(t.tag===1)switch(t.fields[0].tag){case 1:{n.tag===0&&n.fields[0].tag===2?(i=13,P=n.fields[0].fields[0][1],j=n.fields[0].fields[0][0],se=n.fields[0].fields[0][2],X=t.fields[0].fields[0]):i=14;break}case 2:{t.fields[0].fields[0].tag===0?n.tag===0&&n.fields[0].tag===1?(i=17,R=n.fields[0].fields[0][0],fe=t.fields[0].fields[0].fields[0]):i=18:t.fields[0].fields[0].fields[1]!=null?n.tag===0&&n.fields[0].tag===1?(i=16,G=t.fields[0].fields[0].fields[0],B=n.fields[0].fields[0][0],ce=t.fields[0].fields[0].fields[1],q=n.fields[0].fields[0][1]):i=18:n.tag===0&&n.fields[0].tag===1?(i=15,J=t.fields[0].fields[0].fields[0],L=n.fields[0].fields[0][0]):i=18;break}default:n.tag===0&&n.fields[0].tag===3?n.fields[0].fields[0][2]!=null?(i=11,C=n.fields[0].fields[0][1],A=n.fields[0].fields[0][0],N=n.fields[0].fields[0][2][0],D=n.fields[0].fields[0][2][1]):(i=10,F=n.fields[0].fields[0][1],S=n.fields[0].fields[0][0]):i=12}else switch(t.fields[0].tag){case 1:{t.fields[0].fields[1]!=null?n.tag===0&&n.fields[0].tag===1?(i=4,f=t.fields[0].fields[0],p=n.fields[0].fields[0][0],m=t.fields[0].fields[1],h=n.fields[0].fields[0][1]):i=5:n.tag===0&&n.fields[0].tag===1?(i=3,u=t.fields[0].fields[0],d=n.fields[0].fields[0][0]):i=5;break}case 2:{n.tag===0&&n.fields[0].tag===2?(i=6,b=n.fields[0].fields[0][1],v=n.fields[0].fields[0][0],_=n.fields[0].fields[0][2],x=t.fields[0].fields[0]):i=7;break}case 3:{n.tag===0&&n.fields[0].tag===3?(i=8,n.fields[0].fields[0][0],E=n.fields[0].fields[0][1],T=n.fields[0].fields[0][2],I=t.fields[0].fields[1],O=t.fields[0].fields[0]):i=9;break}default:n.tag===0&&n.fields[0].tag===0?n.fields[0].fields[0]!=null?(i=1,s=t.fields[0].fields[0],a=n.fields[0].fields[0][0],l=n.fields[0].fields[0][1]):(i=0,o=t.fields[0].fields[0]):i=2}switch(i){case 0:{const U=new Ht(0,[new zt(1,[[o,new Nn(0,[void 0])]])]);return[U,r(n,U)]}case 1:{const U=te(s,a)?new Ht(0,[new zt(1,[[a,l]])]):new Ht(0,[new zt(1,[[s,new Nn(0,[void 0])]])]);return[U,r(n,U)]}case 2:return[n,we()];case 3:{const U=new Ht(0,[new zt(3,[[d,u,void 0]])]);return[U,r(n,U)]}case 4:{const U=new Ht(0,[new zt(2,[[p,f,m,h.tag===1&&h.fields[0].tag===1&&te(m,h.fields[0].fields[1])?h.fields[0].fields[2]:void 0]])]);return[U,r(n,U)]}case 5:return[n,we()];case 6:{const U=new Ht(0,[new zt(3,[[v,b,[_,x]]])]);return[U,r(n,U)]}case 7:return[n,we()];case 8:{const U=new Ht(1,[[O,E,T,I]]);return[U,r(n,U)]}case 9:return[n,we()];case 10:{const U=new Ht(0,[new zt(1,[[S,new Nn(1,[new Xr(0,[F])])]])]);return[U,r(n,U)]}case 11:{const U=new Ht(0,[new zt(2,[[A,C,N,D]])]);return[U,r(n,U)]}case 12:return[n,we()];case 13:{const U=new Ht(0,[new zt(1,[[j,new Nn(1,[new Xr(1,[P,se,X])])]])]);return[U,r(n,U)]}case 14:return[n,we()];case 15:{const U=new Ht(0,[new zt(0,[[L,new Nn(1,[new Xr(0,[J])])]])]);return[U,r(n,U)]}case 16:{const U=new Ht(0,[new zt(0,[[B,q.tag===1?q.fields[0].tag===1?te(G,q.fields[0].fields[0])&&te(ce,q.fields[0].fields[1])?q:new Nn(1,[new Xr(1,[G,ce,void 0])]):new Nn(1,[new Xr(1,[G,ce,void 0])]):new Nn(1,[new Xr(1,[G,ce,void 0])])]])]);return[U,r(n,U)]}case 17:{const U=new Ht(0,[new zt(0,[[R,new Nn(0,[fe])]])]);return[U,r(n,U)]}default:return[n,we()]}}function N4(e,t,n){let r,i,o,s,a,l,u,d,f,p,m;return Ui(g([new xt(3,[e]),new xt(4,[t]),new xt(5,[[zi(ue(new Gi(2,["fixed inset-0 bg-gray-500/50"]))),c("div",w(g([["className","fixed inset-0 z-10 w-screen overflow-y-auto"],(r=[c("div",w(g([["className","flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"],(i=[Wi(g([new dr(1,["relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl sm:my-8 sm:w-full sm:max-w-lg sm:p-6"]),new dr(2,[[c("div",w(g([["className","absolute top-0 right-0 hidden pt-4 pr-4 sm:block"],(o=[c("button",w(g([["type","button"],["onClick",h=>{t()}],["className","text-gray-600"],(s=[zr(24,24)],["children",y.Children.toArray(Array.from(s))])])))],["children",y.Children.toArray(Array.from(o))])]))),c("div",w(g([["className","sm:flex sm:items-start"],(a=[c("div",w(g([["className","mx-auto flex size-12 shrink-0 items-center justify-center sm:mx-0 sm:size-10"],(l=[e4([])],["children",y.Children.toArray(Array.from(l))])]))),c("div",w(g([["className","mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"],(u=[ip(g([new Us(2,["text-gray-900 text-lg font-bold"]),new Us(3,[["Cancel import"]])])),c("div",w(g([["className","mt-2 text-sm text-gray-500 leading-tight"],(d=[c("p",{children:["You’re about to cancel your import. All changes will be discarded."]}),c("br",{}),c("p",{children:["Are you sure you want to cancel and exit?"]})],["children",y.Children.toArray(Array.from(d))])])))],["children",y.Children.toArray(Array.from(u))])])))],["children",y.Children.toArray(Array.from(a))])]))),c("div",w(g([["className","mt-5 sm:mt-4 sm:flex sm:flex-row-reverse"],(f=[c("button",w(g([["type","button"],["onClick",h=>{n()}],(p="inline-flex w-full justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-medium text-white shadow-xs hover:bg-red-500 sm:ml-3 sm:w-auto",["className",p]),["children","Cancel import and exit"]]))),c("button",w(g([["type","button"],["onClick",h=>{t()}],(m="mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-gray-700 text-sm font-medium ring-1 shadow-xs ring-gray-300 ring-inset hover:bg-gray-50 sm:mt-0 sm:w-auto",["className",m]),["children","Continue import"]])))],["children",y.Children.toArray(Array.from(f))])])))]])]))],["children",y.Children.toArray(Array.from(i))])])))],["children",y.Children.toArray(Array.from(r))])])))]])]))}class rl extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["HasNotStartedYet","InProgress","Resolved","Failed"]}}function T4(e,t){let n;const r=sw();return n=y.useRef(r),T0(()=>mu(()=>{aw(n.current)})),$0(i=>{lw(n.current)||Ii(Z.Delay(()=>Z.TryWith(Z.Delay(()=>(t(new rl(1,[])),Z.Bind(e(i),o=>(t(new rl(2,[o])),Z.Zero())))),o=>(t(new rl(3,[o])),Z.Zero()))),n.current)})}function $4(e,t,n,r,i,o,s){let a,l,u,d,f,p,m;return oa((a=[()=>V6(e,t,n,r,i),h=>{let b,v,_,x;switch(h.tag){case 1:case 0:{b=3;break}case 3:{b=2,x=h.fields[0];break}default:h.fields[0].tag===1?(b=1,_=h.fields[0].fields[0]):(b=0,v=h.fields[0].fields[0])}switch(b){case 0:{o(v);break}case 1:{s(_);break}case 2:{s(nt(x));break}}}],T4(a[0],a[1]))),c("div",w(g([["className","fixed inset-0 z-100 w-screen overflow-y-auto bg-white"],(l=[c("div",w(g([["className","flex-col w-full h-full justify-center items-center gap-2.5 inline-flex overflow-hidden"],(u=[c("div",w(g([["className","self-stretch h-[118px] flex-col justify-center items-center gap-8 flex"],(d=[c("div",w(g([["className","relative"],(f=[n4([])],["children",y.Children.toArray(Array.from(f))])]))),c("div",w(g([["className","flex-col justify-start items-center gap-6 flex"],(p=[c("div",w(g([["className","w-[140px] h-1.5 relative bg-blue-100 rounded-[5px] overflow-hidden"],(m=[c("div",{style:{animation:"progressBar 2s linear infinite"},className:"h-1.5 top-0 absolute bg-gradient-to-r from-[#a650ff] to-[#0095f2] rounded-[5px]"})],["children",y.Children.toArray(Array.from(m))])])))],["children",y.Children.toArray(Array.from(p))])])))],["children",y.Children.toArray(Array.from(d))])])))],["children",y.Children.toArray(Array.from(u))])])))],["children",y.Children.toArray(Array.from(l))])])))}class yn extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Key","As","Appear","Show","ClassName","Enter","EnterFrom","EnterTo","Leave","LeaveFrom","LeaveTo","Children"]}}function M4(e){return c(Qh,Gn(e,1))}class Qr extends _e{constructor(t,n,r){super(),this.Type=t,this.Title=n,this.Message=r}}class ei extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Success","Failure","InProgress"]}}function I4(e,t){let n,r,i,o,s,a,l,u;return M4(g([new yn(1,["div"]),new yn(4,["pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5"]),new yn(3,[!0]),new yn(5,["transform ease-out duration-300 transition"]),new yn(6,["translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"]),new yn(7,["translate-y-0 opacity-100 sm:translate-x-0"]),new yn(8,["transition ease-in duration-100"]),new yn(9,["opacity-100"]),new yn(10,["opacity-0"]),new yn(11,[[c("div",w(g([["key","1"],(n=[c("div",w(g([["className","p-4"],(r=[c("div",w(g([["className","flex items-start"],(i=[c("div",w(g([["className","flex-shrink-0"],(o=K($(()=>{const d=t.Type;return d.tag===1?k(i4([])):d.tag===2?k(o4([])):k(r4([]))})),["children",y.Children.toArray(Array.from(o))])]))),c("div",w(g([["className","ml-3 w-0 flex-1 pt-0.5"],(s=[c("p",{className:"text-sm font-medium text-gray-900",children:t.Title}),c("p",{className:"mt-1 text-sm text-gray-500",children:t.Message})],["children",y.Children.toArray(Array.from(s))])]))),c("div",w(g([["className","ml-4 flex flex-shrink-0"],(a=[c("button",w(g([["type","button"],(l="inline-flex rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2",["className",l]),["onClick",d=>{e()}],(u=[Ds(10,10)],["children",y.Children.toArray(Array.from(u))])])))],["children",y.Children.toArray(Array.from(a))])])))],["children",y.Children.toArray(Array.from(i))])])))],["children",y.Children.toArray(Array.from(r))])])))],["children",y.Children.toArray(Array.from(n))])])))]])]))}function D4(e){const t=document.getElementById("workspace-toasts-container"),n=G0(),r=I4(()=>{document.getElementById(n).remove()},e),i=document.createElement("div");Zl(r,i);const o=i.children[0];o.id=n,t.appendChild(o)}const R4=3e4;function O4(e,t,n,r,i){const o=r.fields[0],s=()=>Z.Delay(()=>Z.Bind(N0(R4),()=>Z.Bind(t(n),a=>{let l,u,d,f;const p=a;return p.tag!==1&&(p.fields[0].tag!==1||(p.fields[0].fields[0].tag===1?(e(new Qr(new ei(1,[]),"We found a duplicate user",`"${he(i.fields[0],he(p.fields[0].fields[0].fields[0]-2,o).fields[0])}" already exists in our system. This user was skipped during the import.`)),!1):p.fields[0].fields[0].tag===2?(l=p.fields[0].fields[0].fields[0].DuplicateEmailCount>0,u=p.fields[0].fields[0].fields[0].OtherFailuresCount>0,e(l?u?new Qr(new ei(1,[]),"We found multiple import errors",(d="One or more of the rows experienced errors during import. These rows were skipped during the import.",d)):new Qr(new ei(1,[]),`We found ${p.fields[0].fields[0].fields[0].DuplicateEmailCount} duplicate users`,(f="One or more of the users you’re trying to add already exist in our system. These users were skipped during the import.",f)):new Qr(new ei(1,[]),"We found multiple import errors",(d="One or more of the rows experienced errors during import. These rows were skipped during the import.",d))),!1):(e(new Qr(new ei(0,[]),`Successfully added ${p.fields[0].fields[0].fields[0]} users`,"If you don’t see any new users, try refreshing this page.")),!1)))?Z.Bind(s(),()=>Z.Return(void 0)):Z.Zero()})));e(new Qr(new ei(2,[]),`Importing ${o.length} users`,"This might take a while. We’ll let you know via email when it’s finished.")),Ii(s())}class kt extends W{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Completed","Active","Disabled"]}}class us extends _e{constructor(t,n,r,i){super(),this.UploadingCsv=t,this.MappingColumns=n,this.MappingEmploymentBasis=r,this.Reviewing=i}}function cf(){Rm(g(["admin","app","users"]))}function Ap(e){Rm(g(["admin","app","oops"]))}function F4(e){switch(e.tag){case 1:return new us(new kt(0,[]),new kt(1,[]),new kt(2,[]),new kt(2,[]));case 2:return new us(new kt(0,[]),new kt(0,[]),new kt(1,[]),new kt(2,[]));case 3:return new us(new kt(0,[]),new kt(0,[]),new kt(0,[]),new kt(1,[]));default:return new us(new kt(1,[]),new kt(2,[]),new kt(2,[]),new kt(2,[]))}}function P4(e,t,n,r,i,o){switch(o.tag){case 1:{const s=o.fields[0],a=s[1].tag===1?s[1].fields[0].tag===1?[Id(s[1].fields[0].fields[0],s[1].fields[0].fields[1]),s[0].HeaderRow,s[0].DataRows]:[Id(s[1].fields[0].fields[0],void 0),s[0].HeaderRow,s[0].DataRows]:[s[1].fields[0],s[0].HeaderRow,s[0].DataRows];return c(E6,{existingMappings:so(a[0]),headerRow:a[1],dataRows:a[2],next:l=>{let u;n(new yr(0,[(u=l,new os(1,[u[0],u[1]]))]))},back:l=>{n(new yr(1,[new tl(2,[l])]))},sendAnalytics:i})}case 2:{const s=rx(o.fields[0][0].DataRows,o.fields[0][2]);return c(R6,{existingMappings:so(o.fields[0][3]),employmentBasisColumn:s,next:a=>{n(new yr(0,[new os(2,[a])]))},back:a=>{n(new yr(1,[new tl(1,[a])]))}})}case 3:return c(m4,{apiCallAsync:e,dataRows:o.fields[0][0].DataRows,baseColumnMappings:o.fields[0][1],employmentBasis:so(o.fields[0][2]),next:s=>{let a;n(new yr(0,[(a=s,new os(3,[a[0],a[1]]))]))},back:()=>{n(new yr(1,[new tl(0,[])]))},onError:s=>{Ap()},sendAnalytics:i});default:{const s=_t(a=>a[0],o.fields[0]);return c(E4,{existingCsvFile:so(s),next:a=>{n(new yr(0,[new os(0,[a])]))},cancel:t,markDirty:r,sendAnalytics:i})}}}function cs(e,t){let n,r,i;switch(t.tag){case 1:return c("div",w(g([["className","text-sm font-medium border-b-2 border-primary-600 pt-1 pb-3 text-primary-600"],(n=[c("span",{children:e})],["children",y.Children.toArray(Array.from(n))])])));case 2:return c("div",w(g([["className","text-sm font-medium pt-1 pb-3 text-gray-500"],(r=[c("span",{children:e})],["children",y.Children.toArray(Array.from(r))])])));default:return c("div",w(g([["className","text-sm font-medium pt-1 pb-3 text-emerald-700 gap-2 inline-flex"],(i=[Gu(20,20),c("span",{children:e})],["children",y.Children.toArray(Array.from(i))])])))}}function L4(e){let t,n,r,i,o,s,a,l;const u=(t=G0(),t);l=I=>fm(e.backendUrl,u,I),a=I=>{Ii(l(I))},s=y.useCallback(a,[]),oa(()=>{s(new gn(0,[{Section:"user import"}]))});const d=Gr(()=>Wr(A4,(I,O)=>k4(s,I,O),(I,O)=>{}),void 0,void 0),f=d[0],p=y.useState(!1),m=p[0],h=p[1],b=y.useState(!1),v=b[0],_=y.useCallback(I=>{I.preventDefault(),I.returnValue=!0},[]),x=()=>{window.removeEventListener("beforeunload",_)};E0(()=>(v?window.addEventListener("beforeunload",_):x(),{Dispose(){x()}}),[v]);let E;if(f.tag===0){const I=f.fields[0],O=()=>{m||h(!0)},F=F4(I),S=P4(C=>M2(e.backendUrl,C),O,d[1],b[1],s,I);E=c("div",w(g([["className","flex flex-col h-full"],(n=[N4(m,()=>{m&&h(!1)},()=>{m&&(s(new gn(2,[{From:Ep(I)}])),x(),cf())}),c("div",w(g([["className","flex flex-row justify-between px-12 pt-8 pb-4"],(r=[c("span",{className:"font-sonoma text-gray-900 font-bold text-lg",children:"Import Users from CSV"}),c("button",w(g([(i="bg-white hover:bg-gray-50 rounded-md text-red-700 shadow-sm text-sm border border-gray-300 font-medium px-3 py-2 w-[120px]",["className",i]),["onClick",C=>{O()}],["type","button"],["children",y.Children.toArray(["Cancel import"])]])))],["children",y.Children.toArray(Array.from(r))])]))),c("div",w(g([["className","flex flex-row items-center px-12 gap-2 border-b border-gray-200"],(o=[cs("1. Upload CSV",F.UploadingCsv),c("hr",{className:"w-16 pt-1.5"}),cs("2. Map fields",F.MappingColumns),c("hr",{className:"w-16 pt-1.5"}),cs("3. Map values",F.MappingEmploymentBasis),c("hr",{className:"w-16 pt-1.5"}),cs("4. Review",F.Reviewing)],["children",y.Children.toArray(Array.from(o))])]))),S],["children",y.Children.toArray(Array.from(n))])])))}else{const I=f.fields[0][3],O=f.fields[0][0],F=f.fields[0][1];E=$4(S=>I2(e.backendUrl,S),O,F,f.fields[0][2],I,S=>{s(new gn(8,[{ImportId:S,UsersInvited:I.tag!==1}])),x();const C=[S,O,F.Email];O4(A=>{D4(A)},A=>D2(e.backendUrl,A),C[0],C[1],C[2]),cf()},S=>{x(),Ap()})}const T=[c("style",{children:[Ql]}),E];return c(Ye,{},...T)}function V4(){Hl(e=>c(L4,e),"apollo-import-workspace-wizard")}Hl(e=>c(Ng,e),"apollo-import-workspace-app");F_();V4();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flarehr/apollo-import-workspace-app",
3
- "version": "0.1.595",
3
+ "version": "0.1.599",
4
4
  "description": "Apollo Import Workspace App",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",