@flarehr/apollo-import-workspace-app 0.27.0 → 0.28.0

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
  `,B='"',pe=B+B,Y=!1,W=null,P=!1,G=((()=>{if(typeof _=="object"){if(typeof _.delimiter!="string"||u.BAD_DELIMITERS.filter(function(z){return _.delimiter.indexOf(z)!==-1}).length||(I=_.delimiter),typeof _.quotes!="boolean"&&typeof _.quotes!="function"&&!Array.isArray(_.quotes)||(k=_.quotes),typeof _.skipEmptyLines!="boolean"&&typeof _.skipEmptyLines!="string"||(Y=_.skipEmptyLines),typeof _.newline=="string"&&(O=_.newline),typeof _.quoteChar=="string"&&(B=_.quoteChar),typeof _.header=="boolean"&&(N=_.header),Array.isArray(_.columns)){if(_.columns.length===0)throw new Error("Option columns is empty");W=_.columns}_.escapeChar!==void 0&&(pe=_.escapeChar+B),_.escapeFormulae instanceof RegExp?P=_.escapeFormulae:typeof _.escapeFormulae=="boolean"&&_.escapeFormulae&&(P=/^[=+\-@\t\r].*$/)}})(),new RegExp(b(B),"g"));if(typeof E=="string"&&(E=JSON.parse(E)),Array.isArray(E)){if(!E.length||Array.isArray(E[0]))return j(null,E,Y);if(typeof E[0]=="object")return j(W||Object.keys(E[0]),E,Y)}else if(typeof E=="object")return typeof E.data=="string"&&(E.data=JSON.parse(E.data)),Array.isArray(E.data)&&(E.fields||(E.fields=E.meta&&E.meta.fields||W),E.fields||(E.fields=Array.isArray(E.data[0])?E.fields:typeof E.data[0]=="object"?Object.keys(E.data[0]):[]),Array.isArray(E.data[0])||typeof E.data[0]=="object"||(E.data=[E.data])),j(E.fields||[],E.data||[],Y);throw new Error("Unable to serialize unrecognized input");function j(z,R,ge){var me="",we=(typeof z=="string"&&(z=JSON.parse(z)),typeof R=="string"&&(R=JSON.parse(R)),Array.isArray(z)&&0<z.length),Ee=!Array.isArray(R[0]);if(we&&N){for(var ne=0;ne<z.length;ne++)0<ne&&(me+=I),me+=de(z[ne],ne);0<R.length&&(me+=O)}for(var xe=0;xe<R.length;xe++){var Ce=(we?z:R[xe]).length,De=!1,ee=we?Object.keys(R[xe]).length===0:R[xe].length===0;if(ge&&!we&&(De=ge==="greedy"?R[xe].join("").trim()==="":R[xe].length===1&&R[xe][0].length===0),ge==="greedy"&&we){for(var oe=[],q=0;q<Ce;q++){var Se=Ee?z[q]:q;oe.push(R[xe][Se])}De=oe.join("").trim()===""}if(!De){for(var te=0;te<Ce;te++){0<te&&!ee&&(me+=I);var ce=we&&Ee?z[te]:te;me+=de(R[xe][ce],te)}xe<R.length-1&&(!ge||0<Ce&&!ee)&&(me+=O)}}return me}function de(z,R){var ge,me;return z==null?"":z.constructor===Date?JSON.stringify(z).slice(1,25):(me=!1,P&&typeof z=="string"&&P.test(z)&&(z="'"+z,me=!0),ge=z.toString().replace(G,pe),(me=me||k===!0||typeof k=="function"&&k(z,R)||Array.isArray(k)&&k[R]||((we,Ee)=>{for(var ne=0;ne<Ee.length;ne++)if(-1<we.indexOf(Ee[ne]))return!0;return!1})(ge,u.BAD_DELIMITERS)||-1<ge.indexOf(I)||ge.charAt(0)===" "||ge.charAt(ge.length-1)===" ")?B+ge+B:ge)}},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=x,u.ParserHandle=v,u.NetworkStreamer=d,u.FileStreamer=p,u.StringStreamer=h,u.ReadableStreamStreamer=m,r.jQuery&&((i=r.jQuery).fn.parse=function(E){var _=E.config||{},k=[];return this.each(function(O){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 B=0;B<this.files.length;B++)k.push({file:this.files[B],inputElem:this,instanceConfig:i.extend({},_)})}),N(),this;function N(){if(k.length===0)L(E.complete)&&E.complete();else{var O,B,pe,Y,W=k[0];if(L(E.before)){var P=E.before(W.file,W.inputElem);if(typeof P=="object"){if(P.action==="abort")return O="AbortError",B=W.file,pe=W.inputElem,Y=P.reason,void(L(E.error)&&E.error({name:O},B,pe,Y));if(P.action==="skip")return void I();typeof P.config=="object"&&(W.instanceConfig=i.extend(W.instanceConfig,P.config))}else if(P==="skip")return void I()}var G=W.instanceConfig.complete;W.instanceConfig.complete=function(j){L(G)&&G(j,W.file,W.inputElem),I()},u.parse(W.file,W.instanceConfig)}}function I(){k.splice(0,1),N()}}),s&&(r.onmessage=function(E){E=E.data,u.WORKER_ID===void 0&&E&&(u.WORKER_ID=E.workerId),typeof E.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(E.input,E.config),finished:!0}):(r.File&&E.input instanceof File||E.input instanceof Object)&&(E=u.parse(E.input,E.config))&&r.postMessage({workerId:u.WORKER_ID,results:E,finished:!0})}),(d.prototype=Object.create(f.prototype)).constructor=d,(p.prototype=Object.create(f.prototype)).constructor=p,(h.prototype=Object.create(h.prototype)).constructor=h,(m.prototype=Object.create(f.prototype)).constructor=m,u})}(as)),as.exports}var Y6=q6();const Z6=e=>e.filter(n=>!vi(n)).length===0;function K6(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,f,d,p,h,m,v,b,x,C;e((a=o.errors,!kr(Q,a,Ae())&&a.length===0?(l=(u=o.data,u.filter(S=>!Z6(S))),f=l.length>1?new M(0,[void 0]):new M(1,[new Sn(2,[])]),f.tag===1?new M(1,[f.fields[0]]):(d=l.length<=5001?new M(0,[void 0]):new M(1,[new Sn(3,[])]),d.tag===1?new M(1,[d.fields[0]]):(p=vc(l),h=p.length|0,m=p.some(vi)?new M(1,[new Sn(4,[])]):new M(0,[void 0]),m.tag===1?new M(1,[m.fields[0]]):(v=(b=Cm(Ze(S=>S.trim().toLocaleLowerCase(),p),{Equals:(S,$)=>S===$,GetHashCode:sr}),b.length===h?new M(0,[void 0]):new M(1,[new Sn(5,[])])),v.tag===1?new M(1,[v.fields[0]]):(x=(C=l.filter(S=>S.length!==h),C.length===0?new M(0,[void 0]):new M(1,[new Sn(6,[])])),x.tag===1?new M(1,[x.fields[0]]):new M(0,[new U_(new km(t.name),i0((S,$)=>[new M_(S),new H_($.trim())],vc(l)),new Am(Ze(S=>new j_(Ze($=>$.trim(),S)),Q1(l))),t.size)])))))):new M(1,[new Sn(7,[he(0,o.errors).message])])))},i.error=(o,s)=>{e(new M(1,[new Sn(7,[o])]))},i.worker=!0,Y6.parse(t,i)}else e(new M(1,[new Sn(1,[])]));else e(new M(1,[new Sn(0,[])]))}let vr=class extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["NoFileSelected","ParsingFile","FileSelected"]}};function X6(e){return e==null?[new vr(0,[void 0]),X()]:[new vr(2,[e]),X()]}function J6(e,t,n){let r,i,o,s,a;switch(t.tag){case 1:{n.tag===1?r=4:r=5;break}case 2:{n.tag===2?r=6:r=7;break}default:if(t.fields[0].tag===1)t.fields[0].fields[0].tag===1?n.tag===1?(r=2,a=t.fields[0].fields[0].fields[0]):r=3:n.tag===1?(r=1,s=t.fields[0].fields[0].fields[0]):r=3;else switch(n.tag){case 0:{r=0,i=t.fields[0].fields[0][0],o=t.fields[0].fields[0][1];break}case 2:{r=0,i=t.fields[0].fields[0][0],o=t.fields[0].fields[0][1];break}default:r=3}}switch(r){case 0:return[new vr(1,[i]),ts(o)];case 1:return[new vr(2,[s]),ts(l=>{e(!0)})];case 2:return[new vr(0,[a]),X()];case 3:return[n,X()];case 4:return[new vr(0,[void 0]),X()];case 5:return[n,X()];case 6:return[new vr(0,[void 0]),ts(l=>{e(!1)})];default:return[n,X()]}}function Q6(e,t){let n,r,i,o,s,a,l;return Ii(g([new bt(3,[e]),new bt(4,[t]),new bt(5,[[Ri(le(new Oi(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=[Di(le(new or(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=[Fi(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 e4(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 t4(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 n4(e,t){Ks(J.Delay(()=>J.Bind(k0(1e3),()=>(K6(n=>{t(new ss(0,[new Xs(1,[n])]))},e),J.Zero()))))}const Za=(()=>{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 r4(e){let t,n,r,i,o,s,a,l;const u=e.markDirty,f=e.cancel,d=e.next,p=e.existingCsvFile;let h;const m=X6(p);h=Lr(()=>Pr(()=>m,(k,N)=>J6(u,k,N),(k,N)=>{}),void 0,void 0);const v=h[0],b=h[1],x=k=>{b(new ss(0,[new Xs(0,[[new km(k.name),N=>{n4(k,N)}]])]))},C=y.useState(!1),S=C[1],$=y.useState(!1),D=$[1],F=y.useState(!1),L=F[1],E=y.useRef(void 0),_=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=[dp(Za,C[0],()=>{S(!1)}),Q6(F[0],()=>{L(!1)}),_a("Upload CSV"),xa("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",Za],["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=[ho("What kind of data do I need?",()=>{S(!0)}),ho("Frequently asked questions",()=>{L(!0)})],["children",y.Children.toArray(Array.from(i))])]))),c("div",w(Z(T(()=>H($[0]?A(["className","h-75 border-gray-300 border-dashed border-2 rounded-md my-6 bg-blue-50 border-blue-300"]):A(["className","h-75 border-gray-300 border-dashed border-2 rounded-md my-6 hover:bg-gray-100"]),T(()=>{let k;return A((k=Z(T(()=>{let N,I,O,B,pe,Y,W,P,G,j,de,z,R,ge;switch(v.tag){case 2:{let me;const we=v.fields[0].SizeInBytes/1024/1024;return me=we<.01?.01:we,A(c("div",w(g([["className","p-6 justify-between items-center inline-flex w-full"],(N=[c("div",w(g([["className","justify-start items-start gap-2 flex"],(I=[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"],(O=[Pu(20,20)],["children",y.Children.toArray(Array.from(O))])])))],["children",y.Children.toArray(Array.from(I))])]))),c("div",w(g([["className","justify-start items-start gap-3 flex"],(B=[c("div",{className:"text-center text-gray-500 text-sm font-medium",children:(pe=Kl("{0:F2}",me),Er(Rn("%sMB"))(pe))}),c("button",w(g([["className","justify-start items-center gap-1 flex text-red-600"],["onClick",Ee=>{b(new ss(2,[]))}],(Y=[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"],(W=[hl(10,10)],["children",y.Children.toArray(Array.from(W))])])))],["children",y.Children.toArray(Array.from(Y))])])))],["children",y.Children.toArray(Array.from(B))])])))],["children",y.Children.toArray(Array.from(N))])]))))}case 1:return A(c("div",w(g([["className","p-6 justify-between items-center inline-flex w-full"],(P=[c("div",w(g([["className","justify-start items-start gap-2 flex"],(G=[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"],(j=[e4(20,20)],["children",y.Children.toArray(Array.from(j))])])))],["children",y.Children.toArray(Array.from(G))])]))),c("div",w(g([["className","justify-start items-start gap-2 flex"],(de=[c("button",w(g([["className","justify-start items-center gap-1 flex text-red-600"],["onClick",me=>{b(new ss(1,[]))}],(z=[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"],(R=[hl(10,10)],["children",y.Children.toArray(Array.from(R))])])))],["children",y.Children.toArray(Array.from(z))])])))],["children",y.Children.toArray(Array.from(de))])])))],["children",y.Children.toArray(Array.from(P))])]))));default:{const me=we=>{we.preventDefault(),we.stopPropagation()};return A(c("div",w(g([["className","flex flex-col items-center p-4"],["onDragEnter",we=>{me(we),D(!0)}],["onDragLeave",we=>{me(we),D(!1)}],["onDragOver",we=>{me(we),D(!0)}],["onDrop",we=>{let Ee;me(we),D(!1),x((Ee=we,Ee.dataTransfer).files.item(0))}],(ge=Z(T(()=>{let we,Ee,ne,xe,Ce,De;return H((we=v.fields[0],we==null?A(Ae()):(Ee=we,A(c("div",w(g([["className","h-9 p-2 bg-red-50 rounded-md justify-start items-start gap-2 inline-flex w-full"],(ne=[c("div",w(g([["className","w-5 h-5 px-0.5 pt-0.5 pb-[3px] justify-center items-center flex"],(xe=[qh(16,15)],["children",y.Children.toArray(Array.from(xe))])]))),c("div",w(g([["className","grow shrink basis-0 flex-col justify-start items-start gap-2 inline-flex"],(Ce=[c("div",w(g([["className","self-stretch text-red-800 text-sm font-normal"],(De=Z(T(()=>{let ee;const oe=te=>c("span",{className:"font-medium",children:te}),q=te=>c("span",{children:[te]}),Se=c("a",{className:"underline",children:"sample CSV",href:Za,download:"import_users"});return A((ee=Ee.tag===1?g([oe("File is too large (over 10MB). "),q("Upload a "),oe("smaller file"),q(".")]):Ee.tag===2?g([oe("File is empty. "),q("Ensure your file contains data before uploading.")]):Ee.tag===3?g([oe("Too many rows (5000+). "),q("Upload a "),oe("file with fewer rows"),q(".")]):Ee.tag===4?g([oe("Invalid CSV: Missing header field(s). "),q("Try using our "),Se,q(".")]):Ee.tag===5?g([oe("Invalid CSV: Duplicate header fields. "),q("Try using our "),Se,q(".")]):Ee.tag===6?g([oe("Invalid CSV: Rows have different lengths. "),q("Check for missing or extra columns.")]):Ee.tag===7?g([oe("Invalid CSV format. "),q("Try using our "),Se,q(".")]):g([oe("Unsupported file type. "),q("Upload a "),oe(".csv file"),q(".")]),c("p",{children:y.Children.toArray(Array.from(ee))})))})),["children",y.Children.toArray(Array.from(De))])])))],["children",y.Children.toArray(Array.from(Ce))])])))],["children",y.Children.toArray(Array.from(ne))])])))))),T(()=>{let ee;return H(A(c("div",w(g([["className","pt-2"],(ee=[t4(20,21)],["children",y.Children.toArray(Array.from(ee))])])))),T(()=>H(A(c("input",{type:"file",onChange:oe=>{const q=oe.target.files;q!=null&&q.length>0&&x(q.item(0))},className:"hidden",ref:E})),T(()=>H(A(c("span",{className:"text-gray-600 text-sm font-medium mt-3",children:"Drag and drop CSV file here"})),T(()=>H(A(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:oe=>{Vn(q=>{q.click()},bi(E.current))},type:"button",children:y.Children.toArray(["Choose file"])})),T(()=>A(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(ge))])]))))}}})),["children",y.Children.toArray(Array.from(k))]))})))))),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",k=>{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",k=>{v.tag===2&&d(v.fields[0])}],["type","button"],["disabled",!_],(l=["Map fields",Lu(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 Bt extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["UploadingCsv","MappingColumns","MappingEmploymentBasis","Reviewing"]}}class Lt extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Configuring","Importing"]}}function i4(){return[new Lt(0,[new Bt(0,[void 0])]),X()]}function o4(e,t){let n,r,i,o,s,a,l,u,f,d,p,h,m,v,b,x,C,S,$,D,F,L,E,_,k,N,I,O,B,pe,Y,W,P,G,j,de,z;if(e.tag===1)switch(e.fields[0].tag){case 1:{t.tag===0&&t.fields[0].tag===2?(n=13,N=t.fields[0].fields[0][1],I=t.fields[0].fields[0][0],O=t.fields[0].fields[0][2],B=e.fields[0].fields[0]):n=14;break}case 2:{e.fields[0].fields[0].tag===0?t.tag===0&&t.fields[0].tag===1?(n=17,de=t.fields[0].fields[0][0],z=e.fields[0].fields[0].fields[0]):n=18:e.fields[0].fields[0].fields[1]!=null?t.tag===0&&t.fields[0].tag===1?(n=16,W=e.fields[0].fields[0].fields[0],P=t.fields[0].fields[0][0],G=e.fields[0].fields[0].fields[1],j=t.fields[0].fields[0][1]):n=18:t.tag===0&&t.fields[0].tag===1?(n=15,pe=e.fields[0].fields[0].fields[0],Y=t.fields[0].fields[0][0]):n=18;break}default:t.tag===0&&t.fields[0].tag===3?t.fields[0].fields[0][2]!=null?(n=11,L=t.fields[0].fields[0][1],E=t.fields[0].fields[0][0],_=t.fields[0].fields[0][2][0],k=t.fields[0].fields[0][2][1]):(n=10,D=t.fields[0].fields[0][1],F=t.fields[0].fields[0][0]):n=12}else switch(e.fields[0].tag){case 1:{e.fields[0].fields[1]!=null?t.tag===0&&t.fields[0].tag===1?(n=4,u=e.fields[0].fields[0],f=t.fields[0].fields[0][0],d=e.fields[0].fields[1],p=t.fields[0].fields[0][1]):n=5:t.tag===0&&t.fields[0].tag===1?(n=3,a=e.fields[0].fields[0],l=t.fields[0].fields[0][0]):n=5;break}case 2:{t.tag===0&&t.fields[0].tag===2?(n=6,h=t.fields[0].fields[0][1],m=t.fields[0].fields[0][0],v=t.fields[0].fields[0][2],b=e.fields[0].fields[0]):n=7;break}case 3:{t.tag===0&&t.fields[0].tag===3?(n=8,t.fields[0].fields[0][0],x=t.fields[0].fields[0][1],C=t.fields[0].fields[0][2],S=e.fields[0].fields[1],$=e.fields[0].fields[0]):n=9;break}default:t.tag===0&&t.fields[0].tag===0?t.fields[0].fields[0]!=null?(n=1,i=e.fields[0].fields[0],o=t.fields[0].fields[0][0],s=t.fields[0].fields[0][1]):(n=0,r=e.fields[0].fields[0]):n=2}switch(n){case 0:return[new Lt(0,[new Bt(1,[[r,new Cn(0,[void 0])]])]),X()];case 1:return Q(i,o)?[new Lt(0,[new Bt(1,[[o,s]])]),X()]:[new Lt(0,[new Bt(1,[[i,new Cn(0,[void 0])]])]),X()];case 2:return[t,X()];case 3:return[new Lt(0,[new Bt(3,[[l,a,void 0]])]),X()];case 4:return[new Lt(0,[new Bt(2,[[f,u,d,p.tag===1&&p.fields[0].tag===1&&Q(d,p.fields[0].fields[1])?p.fields[0].fields[2]:void 0]])]),X()];case 5:return[t,X()];case 6:return[new Lt(0,[new Bt(3,[[m,h,[v,b]]])]),X()];case 7:return[t,X()];case 8:return[new Lt(1,[[$,x,C,S]]),X()];case 9:return[t,X()];case 10:return[new Lt(0,[new Bt(1,[[F,new Cn(1,[new Ur(0,[D])])]])]),X()];case 11:return[new Lt(0,[new Bt(2,[[E,L,_,k]])]),X()];case 12:return[t,X()];case 13:return[new Lt(0,[new Bt(1,[[I,new Cn(1,[new Ur(1,[N,O,B])])]])]),X()];case 14:return[t,X()];case 15:return[new Lt(0,[new Bt(0,[[Y,new Cn(1,[new Ur(0,[pe])])]])]),X()];case 16:return[new Lt(0,[new Bt(0,[[P,j.tag===1?j.fields[0].tag===1?Q(W,j.fields[0].fields[0])&&Q(G,j.fields[0].fields[1])?j:new Cn(1,[new Ur(1,[W,G,void 0])]):new Cn(1,[new Ur(1,[W,G,void 0])]):new Cn(1,[new Ur(1,[W,G,void 0])])]])]),X()];case 17:return[new Lt(0,[new Bt(0,[[de,new Cn(0,[z])]])]),X()];default:return[t,X()]}}function s4(e,t,n){let r,i,o,s,a,l,u,f,d,p,h;return Ii(g([new bt(3,[e]),new bt(4,[t]),new bt(5,[[Ri(le(new Oi(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=[Di(g([new or(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 or(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",m=>{t()}],["className","text-gray-600"],(s=[Fi(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=[R6([])],["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=[Gh(g([new Is(2,["text-gray-900 text-lg font-bold"]),new Is(3,[["Cancel import"]])])),c("div",w(g([["className","mt-2 text-sm text-gray-500 leading-tight"],(f=[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(f))])])))],["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"],(d=[c("button",w(g([["type","button"],["onClick",m=>{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",m=>{t()}],(h="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",h]),["children","Continue import"]])))],["children",y.Children.toArray(Array.from(d))])])))]])]))],["children",y.Children.toArray(Array.from(i))])])))],["children",y.Children.toArray(Array.from(r))])])))]])]))}class Ka extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["HasNotStartedYet","InProgress","Resolved","Failed"]}}function a4(e,t){let n;const r=Ew();return n=y.useRef(r),bm(()=>_u(()=>{Aw(n.current)})),_m(i=>{kw(n.current)||Ks(J.Delay(()=>J.TryWith(J.Delay(()=>(t(new Ka(1,[])),J.Bind(e(i),o=>(t(new Ka(2,[o])),J.Zero())))),o=>(t(new Ka(3,[o])),J.Zero()))),n.current)})}function l4(e,t,n,r,i,o,s){let a,l,u,f,d,p,h;return vm((a=[()=>C6(e,t,n,r,i),m=>{let v,b,x,C;switch(m.tag){case 1:case 0:{v=3;break}case 3:{v=2,C=m.fields[0];break}default:m.fields[0].tag===1?(v=1,x=m.fields[0].fields[0]):(v=0,b=m.fields[0].fields[0])}switch(v){case 0:{o(b);break}case 1:{s(x);break}case 2:{s(Je(C));break}}}],a4(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"],(f=[c("div",w(g([["className","relative"],(d=[P6([])],["children",y.Children.toArray(Array.from(d))])]))),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"],(h=[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(h))])])))],["children",y.Children.toArray(Array.from(p))])])))],["children",y.Children.toArray(Array.from(f))])])))],["children",y.Children.toArray(Array.from(u))])])))],["children",y.Children.toArray(Array.from(l))])])))}class Ki extends _e{constructor(t,n,r){super(),this.Type=t,this.Title=n,this.Message=r}}class Xi extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Success","Failure"]}}const u4=3e4;function c4(e,t,n,r,i){const o=()=>J.Delay(()=>J.Bind(k0(u4),()=>J.Bind(t(n),s=>{let a,l;const u=s;return u.tag!==1&&(u.fields[0].tag!==1||(u.fields[0].fields[0].tag===1?(e(new Ki(new Xi(1,[]),"We found a duplicate user",`"${he(i.fields[0],he(u.fields[0].fields[0].fields[0]-2,r.fields[0]).fields[0])}" already exists in our system. This user was skipped during the import.`)),!1):u.fields[0].fields[0].tag===2?(a=u.fields[0].fields[0].fields[0].DuplicateEmailCount>0,l=u.fields[0].fields[0].fields[0].OtherFailuresCount>0,e(a?l?new Ki(new Xi(1,[]),"We found multiple import errors","One or more of the rows experienced errors during import. These rows were skipped during the import."):new Ki(new Xi(1,[]),`We found ${u.fields[0].fields[0].fields[0].DuplicateEmailCount} duplicate users`,"One or more of the users you’re trying to add already exist in our system. These users were skipped during the import."):new Ki(new Xi(1,[]),"We found multiple import errors","One or more of the rows experienced errors during import. These rows were skipped during the import.")),!1):(e(new Ki(new Xi(0,[]),`Successfully added ${u.fields[0].fields[0].fields[0]} users`,"If you don’t see any new users, try refreshing this page.")),!1)))?J.Bind(o(),()=>J.Return(void 0)):J.Zero()})));Ks(o())}class kt extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Completed","Active","Disabled"]}}class Xo extends _e{constructor(t,n,r,i){super(),this.UploadingCsv=t,this.MappingColumns=n,this.MappingEmploymentBasis=r,this.Reviewing=i}}function Qd(){xm(g(["admin","app","users"]))}function fp(e){xm(g(["admin","app","oops"]))}function d4(e){switch(e.tag){case 1:return new Xo(new kt(0,[]),new kt(1,[]),new kt(2,[]),new kt(2,[]));case 2:return new Xo(new kt(0,[]),new kt(0,[]),new kt(1,[]),new kt(2,[]));case 3:return new Xo(new kt(0,[]),new kt(0,[]),new kt(0,[]),new kt(1,[]));default:return new Xo(new kt(1,[]),new kt(2,[]),new kt(2,[]),new kt(2,[]))}}function f4(e,t,n,r,i){switch(i.tag){case 1:{const o=i.fields[0],s=o[1].tag===1?o[1].fields[0].tag===1?[Cd(o[1].fields[0].fields[0],o[1].fields[0].fields[1]),o[0].HeaderRow,o[0].DataRows]:[Cd(o[1].fields[0].fields[0],void 0),o[0].HeaderRow,o[0].DataRows]:[o[1].fields[0],o[0].HeaderRow,o[0].DataRows];return c(u6,{existingMappings:Ji(s[0]),headerRow:s[1],dataRows:s[2],next:a=>{let l;n(new mr(0,[(l=a,new qo(1,[l[0],l[1]]))]))},back:a=>{n(new mr(1,[new Ya(2,[a])]))}})}case 2:{const o=B_(i.fields[0][0].DataRows,i.fields[0][2]);return c(y6,{existingMappings:Ji(i.fields[0][3]),employmentBasisColumn:o,next:s=>{n(new mr(0,[new qo(2,[s])]))},back:s=>{n(new mr(1,[new Ya(1,[s])]))}})}case 3:return c(G6,{apiCallAsync:e,dataRows:i.fields[0][0].DataRows,baseColumnMappings:i.fields[0][1],employmentBasis:Ji(i.fields[0][2]),next:o=>{let s;n(new mr(0,[(s=o,new qo(3,[s[0],s[1]]))]))},back:()=>{n(new mr(1,[new Ya(0,[])]))},onError:o=>{fp()}});default:{const o=Ct(s=>s[0],i.fields[0]);return c(r4,{existingCsvFile:Ji(o),next:s=>{n(new mr(0,[new qo(0,[s])]))},cancel:t,markDirty:r})}}}function Jo(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=[Pu(20,20),c("span",{children:e})],["children",y.Children.toArray(Array.from(i))])])))}}function m4(e,t){const n={detail:t,bubbles:!0};return new CustomEvent(e,n)}function h4(e){let t;t=m4("show-toast",{message:lt(e.Message),title:e.Title,toastType:e.Type.tag===1?"failure":"success"}),document.dispatchEvent(t)}function p4(e){let t,n,r,i,o;const s=i4();o=Lr(()=>Pr(()=>s,o4,(x,C)=>{}),void 0,void 0);const a=o[0],l=y.useState(!1),u=l[0],f=l[1],d=y.useState(!1),p=d[0],h=y.useCallback(x=>{x.preventDefault(),x.returnValue=!0},[]),m=()=>{window.removeEventListener("beforeunload",h)};ym(()=>(p?window.addEventListener("beforeunload",h):m(),{Dispose(){m()}}),[p]);let v;if(a.tag===0){const x=a.fields[0],C=()=>{u||f(!0)},S=d4(x),$=f4(D=>J2(e.backendUrl,D),C,o[1],d[1],x);v=c("div",w(g([["className","flex flex-col h-full"],(t=[s4(u,()=>{u&&f(!1)},()=>{u&&(m(),Qd())}),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",D=>{C()}],["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=[Jo("1. Upload CSV",S.UploadingCsv),c("hr",{className:"w-16 pt-1.5"}),Jo("2. Map fields",S.MappingColumns),c("hr",{className:"w-16 pt-1.5"}),Jo("3. Map values",S.MappingEmploymentBasis),c("hr",{className:"w-16 pt-1.5"}),Jo("4. Review",S.Reviewing)],["children",y.Children.toArray(Array.from(i))])]))),$],["children",y.Children.toArray(Array.from(t))])])))}else{const x=a.fields[0][0],C=a.fields[0][1];v=l4(S=>Q2(e.backendUrl,S),x,C,a.fields[0][2],a.fields[0][3],S=>{m();const $=[S,x,C.Email];c4(D=>{h4(D)},D=>ev(e.backendUrl,D),$[0],$[1],$[2]),Qd()},S=>{m(),fp()})}const b=[c("style",{children:[ql]}),v];return c(ze,{},...b)}function g4(){Rl(e=>c(p4,e),"apollo-import-workspace-wizard")}Rl(e=>c(hg,e),"apollo-import-workspace-app");w_();g4();
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 e4(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 t4(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 n4(e,t){Ks(J.Delay(()=>J.Bind(k0(1e3),()=>(K6(n=>{t(new ss(0,[new Xs(1,[n])]))},e),J.Zero()))))}const Za=(()=>{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 r4(e){let t,n,r,i,o,s,a,l;const u=e.markDirty,f=e.cancel,d=e.next,p=e.existingCsvFile;let h;const m=X6(p);h=Lr(()=>Pr(()=>m,(k,N)=>J6(u,k,N),(k,N)=>{}),void 0,void 0);const v=h[0],b=h[1],x=k=>{b(new ss(0,[new Xs(0,[[new km(k.name),N=>{n4(k,N)}]])]))},C=y.useState(!1),S=C[1],$=y.useState(!1),D=$[1],F=y.useState(!1),L=F[1],E=y.useRef(void 0),_=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=[dp(Za,C[0],()=>{S(!1)}),Q6(F[0],()=>{L(!1)}),_a("Upload CSV"),xa("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",Za],["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=[ho("What kind of data do I need?",()=>{S(!0)}),ho("Frequently asked questions",()=>{L(!0)})],["children",y.Children.toArray(Array.from(i))])]))),c("div",w(Z(T(()=>H($[0]?A(["className","h-75 border-gray-300 border-dashed border-2 rounded-md my-6 bg-blue-50 border-blue-300"]):A(["className","h-75 border-gray-300 border-dashed border-2 rounded-md my-6 hover:bg-gray-100"]),T(()=>{let k;return A((k=Z(T(()=>{let N,I,O,B,pe,Y,W,P,G,j,de,z,R,ge;switch(v.tag){case 2:{let me;const we=v.fields[0].SizeInBytes/1024/1024;return me=we<.01?.01:we,A(c("div",w(g([["className","p-6 justify-between items-center inline-flex w-full"],(N=[c("div",w(g([["className","justify-start items-start gap-2 flex"],(I=[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"],(O=[Pu(20,20)],["children",y.Children.toArray(Array.from(O))])])))],["children",y.Children.toArray(Array.from(I))])]))),c("div",w(g([["className","justify-start items-start gap-3 flex"],(B=[c("div",{className:"text-center text-gray-500 text-sm font-medium",children:(pe=Kl("{0:F2}",me),Er(Rn("%sMB"))(pe))}),c("button",w(g([["className","justify-start items-center gap-1 flex text-red-600"],["onClick",Ee=>{b(new ss(2,[]))}],(Y=[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"],(W=[hl(10,10)],["children",y.Children.toArray(Array.from(W))])])))],["children",y.Children.toArray(Array.from(Y))])])))],["children",y.Children.toArray(Array.from(B))])])))],["children",y.Children.toArray(Array.from(N))])]))))}case 1:return A(c("div",w(g([["className","p-6 justify-between items-center inline-flex w-full"],(P=[c("div",w(g([["className","justify-start items-start gap-2 flex"],(G=[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"],(j=[e4(20,20)],["children",y.Children.toArray(Array.from(j))])])))],["children",y.Children.toArray(Array.from(G))])]))),c("div",w(g([["className","justify-start items-start gap-2 flex"],(de=[c("button",w(g([["className","justify-start items-center gap-1 flex text-red-600"],["onClick",me=>{b(new ss(1,[]))}],(z=[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"],(R=[hl(10,10)],["children",y.Children.toArray(Array.from(R))])])))],["children",y.Children.toArray(Array.from(z))])])))],["children",y.Children.toArray(Array.from(de))])])))],["children",y.Children.toArray(Array.from(P))])]))));default:{const me=we=>{we.preventDefault(),we.stopPropagation()};return A(c("div",w(g([["className","flex flex-col items-center p-4"],["onDragEnter",we=>{me(we),D(!0)}],["onDragLeave",we=>{me(we),D(!1)}],["onDragOver",we=>{me(we),D(!0)}],["onDrop",we=>{let Ee;me(we),D(!1),x((Ee=we,Ee.dataTransfer).files.item(0))}],(ge=Z(T(()=>{let we,Ee,ne,xe,Ce,De;return H((we=v.fields[0],we==null?A(Ae()):(Ee=we,A(c("div",w(g([["className","h-9 p-2 bg-red-50 rounded-md justify-start items-start gap-2 inline-flex w-full"],(ne=[c("div",w(g([["className","w-5 h-5 px-0.5 pt-0.5 pb-[3px] justify-center items-center flex"],(xe=[qh(16,15)],["children",y.Children.toArray(Array.from(xe))])]))),c("div",w(g([["className","grow shrink basis-0 flex-col justify-start items-start gap-2 inline-flex"],(Ce=[c("div",w(g([["className","self-stretch text-red-800 text-sm font-normal"],(De=Z(T(()=>{let ee;const oe=te=>c("span",{className:"font-medium",children:te}),q=te=>c("span",{children:[te]}),Se=c("a",{className:"underline",children:"sample CSV",href:Za,download:"import_users"});return A((ee=Ee.tag===1?g([oe("File is too large (over 10MB). "),q("Upload a "),oe("smaller file"),q(".")]):Ee.tag===2?g([oe("File is empty. "),q("Ensure your file contains data before uploading.")]):Ee.tag===3?g([oe("Too many rows (5000+). "),q("Upload a "),oe("file with fewer rows"),q(".")]):Ee.tag===4?g([oe("Invalid CSV: Missing header field(s). "),q("Try using our "),Se,q(".")]):Ee.tag===5?g([oe("Invalid CSV: Duplicate header fields. "),q("Try using our "),Se,q(".")]):Ee.tag===6?g([oe("Invalid CSV: Rows have different lengths. "),q("Check for missing or extra columns.")]):Ee.tag===7?g([oe("Invalid CSV format. "),q("Try using our "),Se,q(".")]):g([oe("Unsupported file type. "),q("Upload a "),oe(".csv file"),q(".")]),c("p",{children:y.Children.toArray(Array.from(ee))})))})),["children",y.Children.toArray(Array.from(De))])])))],["children",y.Children.toArray(Array.from(Ce))])])))],["children",y.Children.toArray(Array.from(ne))])])))))),T(()=>{let ee;return H(A(c("div",w(g([["className","pt-2"],(ee=[t4(20,21)],["children",y.Children.toArray(Array.from(ee))])])))),T(()=>H(A(c("input",{type:"file",onChange:oe=>{const q=oe.target.files;q!=null&&q.length>0&&x(q.item(0))},className:"hidden",ref:E})),T(()=>H(A(c("span",{className:"text-gray-600 text-sm font-medium mt-3",children:"Drag and drop CSV file here"})),T(()=>H(A(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:oe=>{Vn(q=>{q.click()},bi(E.current))},type:"button",children:y.Children.toArray(["Choose file"])})),T(()=>A(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(ge))])]))))}}})),["children",y.Children.toArray(Array.from(k))]))})))))),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",k=>{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",k=>{v.tag===2&&d(v.fields[0])}],["type","button"],["disabled",!_],(l=["Map fields",Lu(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 Bt extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["UploadingCsv","MappingColumns","MappingEmploymentBasis","Reviewing"]}}class Lt extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Configuring","Importing"]}}function i4(){return[new Lt(0,[new Bt(0,[void 0])]),X()]}function o4(e,t){let n,r,i,o,s,a,l,u,f,d,p,h,m,v,b,x,C,S,$,D,F,L,E,_,k,N,I,O,B,pe,Y,W,P,G,j,de,z;if(e.tag===1)switch(e.fields[0].tag){case 1:{t.tag===0&&t.fields[0].tag===2?(n=13,N=t.fields[0].fields[0][1],I=t.fields[0].fields[0][0],O=t.fields[0].fields[0][2],B=e.fields[0].fields[0]):n=14;break}case 2:{e.fields[0].fields[0].tag===0?t.tag===0&&t.fields[0].tag===1?(n=17,de=t.fields[0].fields[0][0],z=e.fields[0].fields[0].fields[0]):n=18:e.fields[0].fields[0].fields[1]!=null?t.tag===0&&t.fields[0].tag===1?(n=16,W=e.fields[0].fields[0].fields[0],P=t.fields[0].fields[0][0],G=e.fields[0].fields[0].fields[1],j=t.fields[0].fields[0][1]):n=18:t.tag===0&&t.fields[0].tag===1?(n=15,pe=e.fields[0].fields[0].fields[0],Y=t.fields[0].fields[0][0]):n=18;break}default:t.tag===0&&t.fields[0].tag===3?t.fields[0].fields[0][2]!=null?(n=11,L=t.fields[0].fields[0][1],E=t.fields[0].fields[0][0],_=t.fields[0].fields[0][2][0],k=t.fields[0].fields[0][2][1]):(n=10,D=t.fields[0].fields[0][1],F=t.fields[0].fields[0][0]):n=12}else switch(e.fields[0].tag){case 1:{e.fields[0].fields[1]!=null?t.tag===0&&t.fields[0].tag===1?(n=4,u=e.fields[0].fields[0],f=t.fields[0].fields[0][0],d=e.fields[0].fields[1],p=t.fields[0].fields[0][1]):n=5:t.tag===0&&t.fields[0].tag===1?(n=3,a=e.fields[0].fields[0],l=t.fields[0].fields[0][0]):n=5;break}case 2:{t.tag===0&&t.fields[0].tag===2?(n=6,h=t.fields[0].fields[0][1],m=t.fields[0].fields[0][0],v=t.fields[0].fields[0][2],b=e.fields[0].fields[0]):n=7;break}case 3:{t.tag===0&&t.fields[0].tag===3?(n=8,t.fields[0].fields[0][0],x=t.fields[0].fields[0][1],C=t.fields[0].fields[0][2],S=e.fields[0].fields[1],$=e.fields[0].fields[0]):n=9;break}default:t.tag===0&&t.fields[0].tag===0?t.fields[0].fields[0]!=null?(n=1,i=e.fields[0].fields[0],o=t.fields[0].fields[0][0],s=t.fields[0].fields[0][1]):(n=0,r=e.fields[0].fields[0]):n=2}switch(n){case 0:return[new Lt(0,[new Bt(1,[[r,new Cn(0,[void 0])]])]),X()];case 1:return Q(i,o)?[new Lt(0,[new Bt(1,[[o,s]])]),X()]:[new Lt(0,[new Bt(1,[[i,new Cn(0,[void 0])]])]),X()];case 2:return[t,X()];case 3:return[new Lt(0,[new Bt(3,[[l,a,void 0]])]),X()];case 4:return[new Lt(0,[new Bt(2,[[f,u,d,p.tag===1&&p.fields[0].tag===1&&Q(d,p.fields[0].fields[1])?p.fields[0].fields[2]:void 0]])]),X()];case 5:return[t,X()];case 6:return[new Lt(0,[new Bt(3,[[m,h,[v,b]]])]),X()];case 7:return[t,X()];case 8:return[new Lt(1,[[$,x,C,S]]),X()];case 9:return[t,X()];case 10:return[new Lt(0,[new Bt(1,[[F,new Cn(1,[new Ur(0,[D])])]])]),X()];case 11:return[new Lt(0,[new Bt(2,[[E,L,_,k]])]),X()];case 12:return[t,X()];case 13:return[new Lt(0,[new Bt(1,[[I,new Cn(1,[new Ur(1,[N,O,B])])]])]),X()];case 14:return[t,X()];case 15:return[new Lt(0,[new Bt(0,[[Y,new Cn(1,[new Ur(0,[pe])])]])]),X()];case 16:return[new Lt(0,[new Bt(0,[[P,j.tag===1?j.fields[0].tag===1?Q(W,j.fields[0].fields[0])&&Q(G,j.fields[0].fields[1])?j:new Cn(1,[new Ur(1,[W,G,void 0])]):new Cn(1,[new Ur(1,[W,G,void 0])]):new Cn(1,[new Ur(1,[W,G,void 0])])]])]),X()];case 17:return[new Lt(0,[new Bt(0,[[de,new Cn(0,[z])]])]),X()];default:return[t,X()]}}function s4(e,t,n){let r,i,o,s,a,l,u,f,d,p,h;return Ii(g([new bt(3,[e]),new bt(4,[t]),new bt(5,[[Ri(le(new Oi(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=[Di(g([new or(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 or(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",m=>{t()}],["className","text-gray-600"],(s=[Fi(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=[R6([])],["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=[Gh(g([new Is(2,["text-gray-900 text-lg font-bold"]),new Is(3,[["Cancel import"]])])),c("div",w(g([["className","mt-2 text-sm text-gray-500 leading-tight"],(f=[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(f))])])))],["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"],(d=[c("button",w(g([["type","button"],["onClick",m=>{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",m=>{t()}],(h="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",h]),["children","Continue import"]])))],["children",y.Children.toArray(Array.from(d))])])))]])]))],["children",y.Children.toArray(Array.from(i))])])))],["children",y.Children.toArray(Array.from(r))])])))]])]))}class Ka extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["HasNotStartedYet","InProgress","Resolved","Failed"]}}function a4(e,t){let n;const r=Ew();return n=y.useRef(r),bm(()=>_u(()=>{Aw(n.current)})),_m(i=>{kw(n.current)||Ks(J.Delay(()=>J.TryWith(J.Delay(()=>(t(new Ka(1,[])),J.Bind(e(i),o=>(t(new Ka(2,[o])),J.Zero())))),o=>(t(new Ka(3,[o])),J.Zero()))),n.current)})}function l4(e,t,n,r,i,o,s){let a,l,u,f,d,p,h;return vm((a=[()=>C6(e,t,n,r,i),m=>{let v,b,x,C;switch(m.tag){case 1:case 0:{v=3;break}case 3:{v=2,C=m.fields[0];break}default:m.fields[0].tag===1?(v=1,x=m.fields[0].fields[0]):(v=0,b=m.fields[0].fields[0])}switch(v){case 0:{o(b);break}case 1:{s(x);break}case 2:{s(Je(C));break}}}],a4(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"],(f=[c("div",w(g([["className","relative"],(d=[P6([])],["children",y.Children.toArray(Array.from(d))])]))),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"],(h=[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(h))])])))],["children",y.Children.toArray(Array.from(p))])])))],["children",y.Children.toArray(Array.from(f))])])))],["children",y.Children.toArray(Array.from(u))])])))],["children",y.Children.toArray(Array.from(l))])])))}class Ki extends _e{constructor(t,n,r){super(),this.Type=t,this.Title=n,this.Message=r}}class Xi extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Success","Failure"]}}const u4=3e4;function c4(e,t,n,r,i){const o=()=>J.Delay(()=>J.Bind(k0(u4),()=>J.Bind(t(n),s=>{let a,l;const u=s;return u.tag!==1&&(u.fields[0].tag!==1||(u.fields[0].fields[0].tag===1?(e(new Ki(new Xi(1,[]),"We found a duplicate user",`"${he(i.fields[0],he(u.fields[0].fields[0].fields[0]-2,r.fields[0]).fields[0])}" already exists in our system. This user was skipped during the import.`)),!1):u.fields[0].fields[0].tag===2?(a=u.fields[0].fields[0].fields[0].DuplicateEmailCount>0,l=u.fields[0].fields[0].fields[0].OtherFailuresCount>0,e(a?l?new Ki(new Xi(1,[]),"We found multiple import errors","One or more of the rows experienced errors during import. These rows were skipped during the import."):new Ki(new Xi(1,[]),`We found ${u.fields[0].fields[0].fields[0].DuplicateEmailCount} duplicate users`,"One or more of the users you’re trying to add already exist in our system. These users were skipped during the import."):new Ki(new Xi(1,[]),"We found multiple import errors","One or more of the rows experienced errors during import. These rows were skipped during the import.")),!1):(e(new Ki(new Xi(0,[]),`Successfully added ${u.fields[0].fields[0].fields[0]} users`,"If you don’t see any new users, try refreshing this page.")),!1)))?J.Bind(o(),()=>J.Return(void 0)):J.Zero()})));Ks(o())}class kt extends U{constructor(t,n){super(),this.tag=t,this.fields=n}cases(){return["Completed","Active","Disabled"]}}class Xo extends _e{constructor(t,n,r,i){super(),this.UploadingCsv=t,this.MappingColumns=n,this.MappingEmploymentBasis=r,this.Reviewing=i}}function Qd(){xm(g(["admin","app","users"]))}function fp(e){xm(g(["admin","app","oops"]))}function d4(e){switch(e.tag){case 1:return new Xo(new kt(0,[]),new kt(1,[]),new kt(2,[]),new kt(2,[]));case 2:return new Xo(new kt(0,[]),new kt(0,[]),new kt(1,[]),new kt(2,[]));case 3:return new Xo(new kt(0,[]),new kt(0,[]),new kt(0,[]),new kt(1,[]));default:return new Xo(new kt(1,[]),new kt(2,[]),new kt(2,[]),new kt(2,[]))}}function f4(e,t,n,r,i){switch(i.tag){case 1:{const o=i.fields[0],s=o[1].tag===1?o[1].fields[0].tag===1?[Cd(o[1].fields[0].fields[0],o[1].fields[0].fields[1]),o[0].HeaderRow,o[0].DataRows]:[Cd(o[1].fields[0].fields[0],void 0),o[0].HeaderRow,o[0].DataRows]:[o[1].fields[0],o[0].HeaderRow,o[0].DataRows];return c(u6,{existingMappings:Ji(s[0]),headerRow:s[1],dataRows:s[2],next:a=>{let l;n(new mr(0,[(l=a,new qo(1,[l[0],l[1]]))]))},back:a=>{n(new mr(1,[new Ya(2,[a])]))}})}case 2:{const o=B_(i.fields[0][0].DataRows,i.fields[0][2]);return c(y6,{existingMappings:Ji(i.fields[0][3]),employmentBasisColumn:o,next:s=>{n(new mr(0,[new qo(2,[s])]))},back:s=>{n(new mr(1,[new Ya(1,[s])]))}})}case 3:return c(G6,{apiCallAsync:e,dataRows:i.fields[0][0].DataRows,baseColumnMappings:i.fields[0][1],employmentBasis:Ji(i.fields[0][2]),next:o=>{let s;n(new mr(0,[(s=o,new qo(3,[s[0],s[1]]))]))},back:()=>{n(new mr(1,[new Ya(0,[])]))},onError:o=>{fp()}});default:{const o=Ct(s=>s[0],i.fields[0]);return c(r4,{existingCsvFile:Ji(o),next:s=>{n(new mr(0,[new qo(0,[s])]))},cancel:t,markDirty:r})}}}function Jo(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=[Pu(20,20),c("span",{children:e})],["children",y.Children.toArray(Array.from(i))])])))}}function m4(e,t){const n={detail:t,bubbles:!0};return new CustomEvent(e,n)}function h4(e){let t;t=m4("show-toast",{message:lt(e.Message),sticky:!0,title:e.Title,toastType:e.Type.tag===1?"failure":"success"}),document.dispatchEvent(t)}function p4(e){let t,n,r,i,o;const s=i4();o=Lr(()=>Pr(()=>s,o4,(x,C)=>{}),void 0,void 0);const a=o[0],l=y.useState(!1),u=l[0],f=l[1],d=y.useState(!1),p=d[0],h=y.useCallback(x=>{x.preventDefault(),x.returnValue=!0},[]),m=()=>{window.removeEventListener("beforeunload",h)};ym(()=>(p?window.addEventListener("beforeunload",h):m(),{Dispose(){m()}}),[p]);let v;if(a.tag===0){const x=a.fields[0],C=()=>{u||f(!0)},S=d4(x),$=f4(D=>J2(e.backendUrl,D),C,o[1],d[1],x);v=c("div",w(g([["className","flex flex-col h-full"],(t=[s4(u,()=>{u&&f(!1)},()=>{u&&(m(),Qd())}),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",D=>{C()}],["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=[Jo("1. Upload CSV",S.UploadingCsv),c("hr",{className:"w-16 pt-1.5"}),Jo("2. Map fields",S.MappingColumns),c("hr",{className:"w-16 pt-1.5"}),Jo("3. Map values",S.MappingEmploymentBasis),c("hr",{className:"w-16 pt-1.5"}),Jo("4. Review",S.Reviewing)],["children",y.Children.toArray(Array.from(i))])]))),$],["children",y.Children.toArray(Array.from(t))])])))}else{const x=a.fields[0][0],C=a.fields[0][1];v=l4(S=>Q2(e.backendUrl,S),x,C,a.fields[0][2],a.fields[0][3],S=>{m();const $=[S,x,C.Email];c4(D=>{h4(D)},D=>ev(e.backendUrl,D),$[0],$[1],$[2]),Qd()},S=>{m(),fp()})}const b=[c("style",{children:[ql]}),v];return c(ze,{},...b)}function g4(){Rl(e=>c(p4,e),"apollo-import-workspace-wizard")}Rl(e=>c(hg,e),"apollo-import-workspace-app");w_();g4();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flarehr/apollo-import-workspace-app",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Apollo Import Workspace App",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",