@techlabi/kycrazy-ui-kit 0.52.0-beta.0 → 0.52.0-beta.1

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.
package/dist/index.es.js CHANGED
@@ -30899,12 +30899,12 @@ const ul = 5, nO = 10, WA = {
30899
30899
  ] })
30900
30900
  ] });
30901
30901
  }, cO = ii({
30902
- registration_number: r0().min(1, "Registration number is required"),
30903
- country: r0().min(1, "Country is required"),
30904
- company_name: r0().min(2, "Company name must be at least 2 characters"),
30905
- doing_business_as: r0().min(1, "Doing Business As (DBA) is required"),
30906
- tax_identity_number: r0().min(1, "Tax identity number is required"),
30907
- corporate_type: r0().min(1, "Corporate type is required"),
30902
+ registration_number: r0().trim().min(1, "Registration number is required"),
30903
+ country: r0().trim().min(1, "Country is required"),
30904
+ company_name: r0().trim().min(2, "Company name must be at least 2 characters"),
30905
+ doing_business_as: r0().trim().min(1, "Doing Business As (DBA) is required"),
30906
+ tax_identity_number: r0().trim().min(1, "Tax identity number is required"),
30907
+ corporate_type: r0().trim().min(1, "Corporate type is required"),
30908
30908
  date_of_establishment: I_.date({
30909
30909
  required_error: "Date of establishment is required"
30910
30910
  })
package/dist/index.umd.js CHANGED
@@ -273,7 +273,7 @@ onmessage = (message) => {
273
273
  }
274
274
  };
275
275
 
276
- `,t=new Blob([a],{type:"application/javascript"});window.__heic2any__worker=new Worker(URL.createObjectURL(t));var n=["image/png","image/jpeg","image/gif"],i={blobToDataURL:function(s){return new Promise(function(f,l){var c=new FileReader;c.onerror=function(){l("ERR_DOM Error on converting blob to data URL")},c.onload=function(h){f(c.result)},c.readAsDataURL(s)})},dataURItoBlob:function(s){try{for(var f=atob(s.split(",")[1]),l=s.split(",")[0].split(":")[1].split(";")[0],c=new ArrayBuffer(f.length),h=new Uint8Array(c),d=0;d<f.length;d++)h[d]=f.charCodeAt(d);var v=new Blob([c],{type:l});return v}catch(b){return"ERR_DOM Error on converting data URI to blob "+b&&b.toString?b.toString():b}},imageDataToBlob:function(s){var f=s.imageData,l=s.toType;l===void 0&&(l="image/png");var c=s.quality;return c===void 0&&(c=.92),(c>1||c<0)&&(c=.92),n.indexOf(l)===-1&&(l="image/png"),new Promise(function(h,d){var v=null;try{v=document.createElement("canvas")}catch{}if(!v)return d("ERR_CANVAS Error on converting imagedata to blob: Could not create canvas element");v.width=f.width,v.height=f.height;var b=v.getContext("2d");if(!b)return d("ERR_CANVAS Error on converting imagedata to blob: Could not get canvas context");b.putImageData(f,0,0),v.toBlob(function(m){return m?h(m):d("ERR_CANVAS Error on converting imagedata to blob: Could not get blob from canvas")},l,c)})},imagesToGif:function(s){var f=s.images,l=s.interval,c=s.gifHeight,h=s.gifWidth;return new Promise(function(d,v){gifshot.createGIF({images:f,interval:l,gifHeight:c,gifWidth:h},function(b){return b.error&&v("ERR_GIF "+b.errorCode+" "+b.errorMessage),d(b.image)})})},otherImageType:function(s){for(var f=new Uint8Array(s).subarray(0,4),l="",c=0;c<f.length;c++)l=l+f[c].toString(16);switch(l){case"89504e47":return"image/png";case"47494638":return"image/gif";case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":return"image/jpeg";default:return!1}},error:function(s){var f=0;s?typeof s!="string"&&(s.toString?s=s.toString():s=JSON.stringify(s)):s="ERR_UNKNOWN";for(var l=["ERR_USER","ERR_LIBHEIF","ERR_GIF","ERR_DOM","ERR_CANVAS"],c=0;c<l.length;c++){var h=l[c];s.indexOf(h)===0&&(f=c+1)}return{code:f,message:s}}};function o(s){return new Promise(function(f,l){var c=(Math.random()*new Date().getTime()).toString(),h={id:c,buffer:s};window.__heic2any__worker.postMessage(h),window.__heic2any__worker.addEventListener("message",function(d){if(d.data.id===c)return d.data.error?l(d.data.error):f(d.data.imageDataArr)})})}function A(s){var f=s.blob,l=s.toType;l===void 0&&(l="image/png");var c=s.quality;c===void 0&&(c=.92);var h=s.gifInterval;h===void 0&&(h=.4);var d=s.multiple;return d===void 0&&(d=void 0),new Promise(function(v,b){f instanceof Blob||i.error("ERR_USER library only accepts BLOBs as input"),typeof d!="boolean"&&i.error('ERR_USER "multiple" parameter should be of type "boolean"'),typeof c!="number"&&i.error('ERR_USER "quality" parameter should be of type "number"'),typeof h!="number"&&i.error('ERR_USER "gifInterval" parameter should be of type "number"');var m=new FileReader;m.onload=function(_){var E=0,B=0,Z=_.target.result,k=i.otherImageType(Z);if(k)return b(i.error("ERR_USER Image is already browser readable: "+k));o(Z).then(function(O){return E=O[0].width,B=O[0].height,Promise.all(O.map(function(D){return i.imageDataToBlob({imageData:D,toType:l,quality:c})}))}).then(function(O){return l==="image/gif"?Promise.all(O.map(function(D){return i.blobToDataURL(D)})):d?(v(O),[""]):(v(O[0]),[""])}).then(function(O){return l==="image/gif"&&O?i.imagesToGif({images:O,interval:h,gifWidth:E,gifHeight:B}):""}).then(function(O){if(l==="image/gif"&&O){var D=i.dataURItoBlob(O);typeof D=="string"?b(i.error(D)):v(D)}}).catch(function(O){b(i.error(O))})},m.readAsArrayBuffer(f)})}return A})})(kg);var gO=kg.exports;const yO=q1(gO),wO=async r=>{try{const e=r.name.toLowerCase();if(!e.endsWith(".heic")&&!e.endsWith(".heif"))return r;let a=await yO({blob:r,toType:"image/jpeg",quality:.7});Array.isArray(a)&&(a=a[0]);const t=await a.arrayBuffer(),n=new Uint8Array(t);return new window.File([n],r.name.replace(/\.(heic|heif)$/i,".jpg"),{type:"image/jpeg",lastModified:r.lastModified})}catch(e){return console.error("HEIC/HEIF conversion failed:",e),r}},kO="Something went wrong.";function EO(r,e){return r instanceof Array&&(r=r[0]),r instanceof Error?r.message:typeof r=="string"?r:kO}const Oo=I.forwardRef(({label:r,error:e,hint:a,required:t=!1,accept:n,multiple:i=!1,maxSize:o,maxFiles:A,disabled:s=!1,containerClassName:f,className:l,id:c,onFileSelect:h,onHeicConversionStart:d,isSubmitting:v,isFormatHintVisible:b=!0,placeholder:m=i?"Select files":"Select file",..._},E)=>{const[B,Z]=I.useState([]),[k,O]=I.useState(!1),{toast:D}=Ii(),j=I.useRef(0),J=I.useRef(null),M=c||`file-field-${r.toLowerCase().replace(/\s+/g,"-")}`,z=async y=>{try{const x=await wO(y),S=x;S.preview=URL.createObjectURL(x),Z(N=>{if(!N.includes(y))return URL.revokeObjectURL(S.preview),N;const G=[...N.filter(Q=>Q!==y),S],T=new DataTransfer;return G.forEach(Q=>T.items.add(Q)),h==null||h(T.files),G})}catch(x){console.error("HEIC convert failed:",x),Z([...B])}},R=async y=>{const x=[],S=[];for(const N of y){const W=N.name.toLowerCase().endsWith(".heic")||N.name.toLowerCase().endsWith(".heif"),G=N.type.startsWith("image/"),T=N;if(G?T.preview=URL.createObjectURL(N):T.preview=void 0,x.push(T),W){const Q=z(T);S.push(Q)}}return S.forEach(N=>d==null?void 0:d(N)),x},q=I.useCallback(async(y,x=!1)=>{if(!y||y.length===0){x||(Z([]),h==null||h(null));return}const S=Array.from(y),{valid:N,errors:W}=pO(S,{maxSize:o,accept:n,maxFiles:A?A-(x?B.length:0):void 0});if(W.length>0){D({title:"Validation Error",description:EO(W[0]),variant:"destructive"});return}const G=await R(N),T=x?[...B,...G]:G;Z(T);try{const Q=new DataTransfer;T.forEach(er=>Q.items.add(er)),h==null||h(Q.files)}catch{h==null||h(T)}J.current&&(J.current.value="")},[B,o,n,A,h,i]),L=I.useCallback(y=>{y.preventDefault(),j.current+=1,j.current===1&&O(!0)},[]),or=I.useCallback(y=>{y.preventDefault(),j.current-=1,j.current<=0&&(O(!1),j.current=0)},[]),H=I.useCallback(y=>{y.preventDefault()},[]),V=I.useCallback(y=>{if(y.preventDefault(),O(!1),j.current=0,s)return;const x=y.dataTransfer.files,S=i&&B.length>0;q(x,S)},[s,q,i,B.length]),p=I.useCallback(()=>{var y;s||(y=J.current)==null||y.click()},[s]),w=I.useCallback(()=>{var y;s||(y=J.current)==null||y.click()},[s]),g=I.useCallback(y=>{const x=B.filter((S,N)=>N!==y);if(Z(x),x.length===0)h==null||h(null),J.current&&(J.current.value="");else{const S=new DataTransfer;x.forEach(N=>S.items.add(N)),h==null||h(S.files)}},[B,h]);return I.useEffect(()=>()=>{B.forEach(y=>{y.preview&&URL.revokeObjectURL(y.preview)})},[B]),u.jsxs("div",{className:wg("space-y-2",f),children:[u.jsxs(K1,{htmlFor:M,className:"font-medium text-gray-700",children:[r,t&&u.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),u.jsx("input",{ref:J,id:M,type:"file",accept:n,multiple:i,disabled:s,className:"sr-only",onChange:y=>{const x=i&&B.length>0;q(y.target.files,x)},"aria-describedby":e?`${M}-error`:a?`${M}-hint`:void 0,..._}),u.jsx("div",{className:wg("relative cursor-pointer rounded-lg border-2 border-dashed p-3 transition-all duration-200","hover:border-primary hover:bg-gray-50","focus-within:border-primary focus-within:ring-2 focus-within:ring-purple-400 focus-within:ring-opacity-20",k&&"border-primary bg-blue-50",e&&"border-red-300 hover:border-red-400",s&&"cursor-not-allowed opacity-50 hover:border-gray-300",l),onDragEnter:L,onDragLeave:or,onDragOver:H,onDrop:V,onClick:B.length===0?p:void 0,children:B.length===0?u.jsxs("div",{className:"text-center",children:[u.jsx(n4,{className:"mx-auto mb-2 h-8 w-8 text-gray-400"}),u.jsxs("div",{className:"text-sm text-gray-600",children:[u.jsx("span",{className:"hover:text-primary/80 font-medium text-primary",children:m})," or drag here"]}),(n||o)&&u.jsxs("div",{className:"mt-1 text-xs text-gray-500",children:[n&&b&&u.jsxs("div",{children:["Supported formats: ",n]}),a&&a,o&&u.jsxs("div",{children:["Maximum size: ",od(o)]})]})]}):u.jsxs("div",{className:"space-y-2",children:[B.map((y,x)=>u.jsxs("div",{className:"flex items-center justify-between rounded p-2",children:[u.jsxs("div",{className:"flex min-w-0 flex-1 items-center space-x-2",children:[y.preview?u.jsx("img",{src:y.preview,alt:y.name,className:"h-8 w-8 rounded object-cover"}):u.jsx(Jy,{className:"h-8 w-8 flex-shrink-0 text-gray-400"}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"truncate text-sm font-medium text-gray-900",children:y.name}),u.jsx("div",{className:"text-xs text-gray-500",children:od(y.size)})]})]}),u.jsx(E0,{disabled:v,type:"button",variant:"ghost",size:"sm",onClick:S=>{S.stopPropagation(),g(x)},className:"h-8 w-8",children:u.jsx(Ky,{className:"text-primary"})})]},`${y.preview}-${y.name}`)),i&&(!A||B.length<A)&&u.jsx("div",{className:"border-t border-dashed border-gray-300 pt-2 text-center",children:u.jsxs(E0,{type:"button",variant:"outline",size:"sm",onClick:y=>{y.stopPropagation(),w()},className:"text-xs",children:[u.jsx(n4,{className:"mr-1 text-primary"}),"Add More Files"]})})]})})]})});Oo.displayName="FileUploadField";const Ad=5,CO=10,vf={company_structure:{label:"Company Structure",description:"Upload document showing directors & legal representatives",required:!0},certificate_of_registration:{label:"Certificate of Registration",description:"Upload your company's certificate of registration",required:!0},bank_statement:{label:"Bank Statement",description:"Upload your latest bank statement",required:!0},void_cheque:{label:"Void Cheque",description:"Upload your Void Cheque",required:!1},business_license:{label:"Business License",description:"Upload your official business/operating license",required:!1}},Eg=["company_structure","certificate_of_registration","bank_statement","void_cheque","business_license"],_O=r=>{const e={};return r.forEach(a=>{const t=vf[a].required;e[a]=i_(DA(File)).max(Ad,`Maximum ${Ad} files allowed`).refine(n=>!t||n.length>0,"At least one file is required")}),Nn(e)},BO=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n,companyDocumentsTypes:i=["bank_statement","company_structure","certificate_of_registration","void_cheque","business_license"]})=>{const o=I.useMemo(()=>[...i].sort((h,d)=>{const v=vf[h].required,b=vf[d].required;return v&&!b?-1:!v&&b?1:Eg.indexOf(h)-Eg.indexOf(d)}),[i]),A=_O(o),s=En({resolver:Cn(A),defaultValues:Object.fromEntries(o.map(h=>[h,r[h]||[]]))}),{isSubmitting:f}=s.formState,l=h=>d=>{const v=d?Array.isArray(d)?d:Array.from(d):[];s.setValue(h,v,{shouldValidate:!0}),e({[h]:v})},c=async h=>{await a(h)};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Company Documents",subTitle:"Please upload the required company documents",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...s,children:u.jsxs("form",{onSubmit:s.handleSubmit(c),className:"space-y-8",children:[o.map(h=>{const d=vf[h];return u.jsx(Xr,{control:s.control,name:h,render:()=>u.jsxs(Vr,{children:[u.jsx(Dr,{children:u.jsx(Oo,{label:d.label,required:d.required,multiple:!0,maxFiles:Ad,maxSize:CO*1024*1024,accept:"image/*,application/pdf,.pdf",placeholder:"Drop files here or click to upload",hint:d.description,onFileSelect:l(h),isSubmitting:f,disabled:f})}),u.jsx(Mr,{})]})},h)}),u.jsx(E0,{type:"submit",size:"lg",className:"w-full",disabled:f,children:f?"Processing...":"Continue to Review"})]})}),u.jsx("div",{className:"mt-8",children:n()})]})]})},IO=Nn({industry:zr().min(1,"Industry is required"),business_model:zr().min(1,"Business model is required"),annual_sales_volume:zr().min(1,"Annual sales volume is required"),website_url:zr().min(1,"Website URL is required").url("Please enter a valid URL")}),NO=[{value:"technology",label:"Technology"},{value:"finance",label:"Finance"},{value:"healthcare",label:"Healthcare"},{value:"retail",label:"Retail"},{value:"manufacturing",label:"Manufacturing"},{value:"education",label:"Education"},{value:"hospitality",label:"Hospitality"},{value:"real-estate",label:"Real Estate"},{value:"consulting",label:"Consulting"}],xO=[{value:"b2b",label:"B2B (Business to Business)"},{value:"b2c",label:"B2C (Business to Consumer)"},{value:"b2b2c",label:"B2B2C (Business to Business to Consumer)"},{value:"marketplace",label:"Marketplace"},{value:"saas",label:"SaaS (Software as a Service)"},{value:"subscription",label:"Subscription"},{value:"freemium",label:"Freemium"}],ZO=[{value:"0-50k",label:"$0 - $50,000"},{value:"50k-100k",label:"$50,000 - $100,000"},{value:"100k-500k",label:"$100,000 - $500,000"},{value:"500k-1m",label:"$500,000 - $1,000,000"},{value:"1m-5m",label:"$1,000,000 - $5,000,000"},{value:"5m-10m",label:"$5,000,000 - $10,000,000"},{value:"10m+",label:"$10,000,000+"}],SO=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n})=>{const i=En({resolver:Cn(IO),defaultValues:{industry:r.industry,business_model:r.business_model,annual_sales_volume:r.annual_sales_volume,website_url:r.website_url}}),o=A=>{e(A),a(A)};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Company Activity",subTitle:"Tell us about your business operations",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...i,children:u.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-6",children:[u.jsx(Xr,{control:i.control,name:"industry",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Industry"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:NO,placeholder:"Enter industry",name:"industry"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"business_model",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Business Model"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:xO,placeholder:"Enter business model",name:"business_model"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"annual_sales_volume",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Annual Sales Volume (USD)"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:ZO,placeholder:"Enter annual sales volume",name:"annual_sales_volume"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"website_url",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Website URL (Optional)"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"https://www.yourcompany.com",...A})}),u.jsx(Mr,{})]})}),u.jsx(E0,{type:"submit",className:"w-full",children:"Continue"})]})}),u.jsx("div",{className:"mt-6",children:n()})]})]})},FO=Nn({registration_number:zr().min(1,"Registration number is required"),country:zr().min(1,"Country is required"),company_name:zr().min(2,"Company name must be at least 2 characters"),doing_business_as:zr().min(1,"Doing Business As (DBA) is required"),tax_identity_number:zr().min(1,"Tax identity number is required"),corporate_type:zr().min(1,"Corporate type is required"),date_of_establishment:o_.date({required_error:"Date of establishment is required"})}),WO=[{value:"us",label:"United States"},{value:"uk",label:"United Kingdom"},{value:"ca",label:"Canada"},{value:"au",label:"Australia"},{value:"de",label:"Germany"},{value:"fr",label:"France"}],TO=[{value:"llc",label:"LLC"},{value:"corporation",label:"Corporation"},{value:"partnership",label:"Partnership"},{value:"sole-proprietorship",label:"Sole Proprietorship"}],$O=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n})=>{const i=En({resolver:Cn(FO),defaultValues:{registration_number:r.registration_number,country:r.country,company_name:r.company_name,doing_business_as:r.doing_business_as||"",tax_identity_number:r.tax_identity_number,corporate_type:r.corporate_type,date_of_establishment:r.date_of_establishment?new Date(r.date_of_establishment):void 0}}),o=A=>{e(A),a(A)};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Business Information",subTitle:"Please provide your business details",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...i,children:u.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-6",children:[u.jsx(Xr,{control:i.control,name:"registration_number",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Registration Number"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter registration number",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"country",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Country"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:WO,placeholder:"Enter country",name:"country"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"company_name",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Company Name"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter company name",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"doing_business_as",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Doing Business As (DBA)"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter Doing Business As (DBA)",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"tax_identity_number",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Tax Identity Number"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter tax identity number",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"corporate_type",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Corporate Type"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:TO,placeholder:"Enter corporate type",name:"corporate_type"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"date_of_establishment",render:({field:A})=>u.jsxs(Vr,{className:"flex flex-col",children:[u.jsx(Lr,{children:"Date of Establishment"}),u.jsxs(Hu,{modal:!0,children:[u.jsx(Qu,{asChild:!0,children:u.jsx(Dr,{children:u.jsxs(E0,{variant:"outline",className:Or("w-full pl-3 text-left font-normal",!A.value&&"text-muted-foreground"),children:[A.value?Ga(A.value,"PPP"):u.jsx("span",{children:"Pick a date"}),u.jsx(Wf,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),u.jsx(ds,{className:"w-auto p-0",align:"start",onOpenAutoFocus:s=>s.preventDefault(),children:u.jsx(ks,{mode:"single",selected:A.value,onSelect:A.onChange,captionLayout:"dropdown-buttons",fromYear:1900,toYear:2026,disabled:s=>s>new Date,initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),u.jsx(Mr,{})]})}),u.jsx(E0,{type:"submit",className:"w-full",children:"Continue"})]})}),u.jsx("div",{className:"mt-6",children:n()})]})]})},PO=y3(new Date),OO=Nn({full_name:zr().min(2,"Full name must be at least 2 characters"),title:zr().min(1,"Title is required"),email:zr().email("Invalid email").optional(),birth:i3({required_error:"Birth date is required"}).refine(r=>GA(r,PO),{message:"You must be at least 16 years old"}),phone_number:zr().min(1,"Phone number is required").refine(r=>q5(r),{message:"Invalid phone number"})}).superRefine((r,e)=>{r.email||e.addIssue({path:["email"],message:"Email is required",code:sr.custom})}),VO=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n})=>{const i=En({resolver:Cn(OO),defaultValues:{full_name:r.full_name,title:r.title,email:r.email||"",birth:r.birth||void 0,phone_number:r.phone_number}}),o=A=>{e(A),a(A)};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Personal Details",subTitle:"Please provide your personal information",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...i,children:u.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-6",children:[u.jsx(Xr,{control:i.control,name:"full_name",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Full Name"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter your full name",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"title",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Title"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"e.g., CEO, Director, Manager",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"email",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Email"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"example@gmail.com",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"birth",render:({field:A})=>u.jsxs(Vr,{className:"flex flex-col",children:[u.jsx(Lr,{children:"Date of Birth"}),u.jsxs(Hu,{modal:!0,children:[u.jsx(Qu,{asChild:!0,children:u.jsx(Dr,{children:u.jsxs(E0,{variant:"outline",className:Or("w-full pl-3 text-left font-normal",!A.value&&"text-muted-foreground"),children:[A.value?Ga(A.value,"PPP"):u.jsx("span",{children:"Pick a date"}),u.jsx(Wf,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),u.jsx(ds,{className:"w-auto p-0",align:"start",onOpenAutoFocus:s=>s.preventDefault(),children:u.jsx(ks,{mode:"single",selected:A.value,onSelect:A.onChange,captionLayout:"dropdown-buttons",fromYear:1900,toYear:2026,disabled:s=>s>new Date||s<new Date("1900-01-01"),initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"phone_number",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Phone Number"}),u.jsx(Dr,{children:u.jsx(k8,{control:i.control,name:"phone_number",placeholder:"Enter your phone number",defaultCountry:"US"})}),u.jsx(Mr,{})]})}),u.jsx(E0,{type:"submit",className:"w-full",children:"Continue"})]})}),u.jsx("div",{className:"mt-6",children:n()})]})]})},DO=Nn({inventory_maintained:zr().min(1,"Please select an inventory option"),offsite_address:zr().optional(),fulfillment_agreement:DA(File).nullable().optional(),other_companies_involved:zr().min(1,"Please select an option"),other_fulfillment_agreement:DA(File).nullable().optional(),recurring_services:zr().min(1,"Please select an option"),recurring_services_description:zr().optional(),fulfillment_time:zr().min(1,"Please select a fulfillment time"),delivery_time:zr().min(1,"Please select a delivery time"),charge_time:zr().min(1,"Please select a charge time"),return_policy:zr().min(1,"Return policy is required"),bankruptcy_filed:zr().min(1,"Please select an option"),was_terminated_from_card_acceptance:zr().min(1,"Please select an option"),has_coa:zr().min(1,"Please select an option"),coa_document:DA(File).nullable().optional()}).superRefine((r,e)=>{var a,t;r.inventory_maintained==="off-site"&&!((a=r.offsite_address)!=null&&a.trim())&&e.addIssue({code:sr.custom,message:"Warehouse address is required when inventory is maintained off-site",path:["offsite_address"]}),r.inventory_maintained==="third-party"&&!r.fulfillment_agreement&&e.addIssue({code:sr.custom,message:"Fulfillment agreement file is required when using a third-party fulfillment center",path:["fulfillment_agreement"]}),r.other_companies_involved==="yes"&&!r.other_fulfillment_agreement&&e.addIssue({code:sr.custom,message:"Fulfillment agreement file is required when other companies are involved",path:["other_fulfillment_agreement"]}),r.recurring_services==="yes"&&!((t=r.recurring_services_description)!=null&&t.trim())&&e.addIssue({code:sr.custom,message:"Recurring services description is required when offering recurring services",path:["recurring_services_description"]}),r.has_coa==="yes"&&!r.coa_document&&e.addIssue({code:sr.custom,message:"Certificate of Analysis document is required when COA is available",path:["coa_document"]})}),MO=[{value:"on-site",label:"On-Site"},{value:"off-site",label:"Off-Site (e.g., Warehouse)"},{value:"third-party",label:"3rd Party Fulfillment Center"},{value:"service-only",label:"Service Only (No Products Sold)"}],pf=[{value:"no",label:"No"},{value:"yes",label:"Yes"}],GO=[{value:"24-hours",label:"Within 24 Hours"},{value:"2-days",label:"2 Days"},{value:"3-10-days",label:"3-10 Days"},{value:"11-30-days",label:"11-30 Days"},{value:"31-90-days",label:"31-90 Days"},{value:"90-plus-days",label:"90+ Days"}],XO=[{value:"24-hours",label:"Within 24 Hours"},{value:"2-5-days",label:"2-5 Days"},{value:"6-10-days",label:"6-10 Days"},{value:"11-plus-days",label:"11+ Days"}],RO=[{value:"time-of-order",label:"Time of Order"},{value:"upon-shipment",label:"Upon Shipment"}],jO=[{value:"business-bankruptcy",label:"Business Bankruptcy"},{value:"personal-bankruptcy",label:"Personal Bankruptcy"},{value:"never",label:"Never"}],LO=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n})=>{const i=En({resolver:Cn(DO),defaultValues:{inventory_maintained:r.inventory_maintained||"",offsite_address:r.offsite_address||"",fulfillment_agreement:r.fulfillment_agreement||null,other_companies_involved:r.other_companies_involved||"",other_fulfillment_agreement:r.other_fulfillment_agreement||null,recurring_services:r.recurring_services||"",recurring_services_description:r.recurring_services_description||"",fulfillment_time:r.fulfillment_time||"",delivery_time:r.delivery_time||"",charge_time:r.charge_time||"",return_policy:r.return_policy||"",bankruptcy_filed:r.bankruptcy_filed||"",was_terminated_from_card_acceptance:r.was_terminated_from_card_acceptance||"",has_coa:r.has_coa||"",coa_document:r.coa_document||null}}),{isSubmitting:o}=i.formState,A=async d=>{const v={...d};d.inventory_maintained!=="off-site"&&delete v.offsite_address,d.inventory_maintained!=="third-party"&&delete v.fulfillment_agreement,d.other_companies_involved!=="yes"&&delete v.other_fulfillment_agreement,d.recurring_services!=="yes"&&delete v.recurring_services_description,d.has_coa!=="yes"&&delete v.coa_document,e(v),await a(v)},s=i.watch("inventory_maintained"),f=i.watch("other_companies_involved"),l=i.watch("recurring_services"),c=i.watch("has_coa"),h=(d,v)=>{const b=v&&v.length>0?v[0]:null;i.setValue(d,b,{shouldValidate:!0}),e({[d]:b})};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Business Questionnaire",subTitle:"Provide details about your business operations",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...i,children:u.jsxs("form",{onSubmit:i.handleSubmit(A),className:"space-y-6",children:[u.jsx(Xr,{control:i.control,name:"inventory_maintained",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Inventory Maintained"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select inventory option"})})}),u.jsx(Ea,{children:MO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),s==="off-site"&&u.jsx(Xr,{control:i.control,name:"offsite_address",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Warehouse Address"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter warehouse address",...d,disabled:o})}),u.jsx(Mr,{})]})}),s==="third-party"&&u.jsx(Xr,{control:i.control,name:"fulfillment_agreement",render:()=>{var d;return u.jsxs(Vr,{children:[u.jsx(Dr,{children:u.jsx(Oo,{label:"Fulfillment Agreement",placeholder:"Upload fulfillment agreement",hint:"Upload fully executed fulfillment agreement with 3rd party",accept:"image/*,application/pdf,.pdf",onFileSelect:v=>h("fulfillment_agreement",v),error:(d=i.formState.errors.fulfillment_agreement)==null?void 0:d.message,isSubmitting:o,disabled:o})}),u.jsx(Mr,{})]})}}),u.jsx(Xr,{control:i.control,name:"other_companies_involved",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Are there any other companies involved in shipping or fulfilling product/service?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:pf.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),f==="yes"&&u.jsx(Xr,{control:i.control,name:"other_fulfillment_agreement",render:()=>{var d;return u.jsxs(Vr,{children:[u.jsx(Dr,{children:u.jsx(Oo,{label:"Fulfillment Agreement for Other Companies",placeholder:"Upload fulfillment agreement",hint:"Upload fully executed fulfillment agreement",accept:"image/*,application/pdf,.pdf",onFileSelect:v=>h("other_fulfillment_agreement",v),error:(d=i.formState.errors.other_fulfillment_agreement)==null?void 0:d.message,isSubmitting:o,disabled:o})}),u.jsx(Mr,{})]})}}),u.jsx(Xr,{control:i.control,name:"recurring_services",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Do you offer recurring or time-extended services?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:pf.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),l==="yes"&&u.jsx(Xr,{control:i.control,name:"recurring_services_description",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Recurring Services Description and Duration"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"e.g., Monthly subscription, 12-month plan",...d,disabled:o})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"has_coa",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Do you have a Certificate of Analysis (COA) for your product(s)?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:pf.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),c==="yes"&&u.jsx(Xr,{control:i.control,name:"coa_document",render:()=>{var d;return u.jsxs(Vr,{children:[u.jsx(Dr,{children:u.jsx(Oo,{label:"Certificate of Analysis",placeholder:"Upload COA document",hint:"Upload the Certificate of Analysis document",accept:"image/*,application/pdf,.pdf",onFileSelect:v=>h("coa_document",v),error:(d=i.formState.errors.coa_document)==null?void 0:d.message,isSubmitting:o,disabled:o})}),u.jsx(Mr,{})]})}}),u.jsx(Xr,{control:i.control,name:"fulfillment_time",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"How long after charging the customer is the product fulfilled or service begun?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select fulfillment time"})})}),u.jsx(Ea,{children:GO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"delivery_time",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"How long after order does the cardholder receive the product/service?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select delivery time"})})}),u.jsx(Ea,{children:XO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"charge_time",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"When is the cardholder charged?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select charge time"})})}),u.jsx(Ea,{children:RO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"bankruptcy_filed",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Have you (your business or any principal) filed bankruptcy?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:jO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"was_terminated_from_card_acceptance",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Have you (your business or any principal) ever been terminated from accepting bank cards?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:pf.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"return_policy",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Return Policy"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Describe your return policy",...d,disabled:o})}),u.jsx(Mr,{})]})}),u.jsx(E0,{type:"submit",className:"w-full",disabled:o,children:o?"Submitting...":"Continue"})]})}),u.jsx("div",{className:"mt-6",children:n()})]})]})};var sd="Progress",fd=100,[UO]=bn(sd),[YO,HO]=UO(sd),Cg=C.forwardRef((r,e)=>{const{__scopeProgress:a,value:t=null,max:n,getValueLabel:i=QO,...o}=r;(n||n===0)&&!Ng(n)&&console.error(JO(`${n}`,"Progress"));const A=Ng(n)?n:fd;t!==null&&!xg(t,A)&&console.error(zO(`${t}`,"Progress"));const s=xg(t,A)?t:null,f=gf(s)?i(s,A):void 0;return u.jsx(YO,{scope:a,value:s,max:A,children:u.jsx(e0.div,{"aria-valuemax":A,"aria-valuemin":0,"aria-valuenow":gf(s)?s:void 0,"aria-valuetext":f,role:"progressbar","data-state":Ig(s,A),"data-value":s??void 0,"data-max":A,...o,ref:e})})});Cg.displayName=sd;var _g="ProgressIndicator",Bg=C.forwardRef((r,e)=>{const{__scopeProgress:a,...t}=r,n=HO(_g,a);return u.jsx(e0.div,{"data-state":Ig(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...t,ref:e})});Bg.displayName=_g;function QO(r,e){return`${Math.round(r/e*100)}%`}function Ig(r,e){return r==null?"indeterminate":r===e?"complete":"loading"}function gf(r){return typeof r=="number"}function Ng(r){return gf(r)&&!isNaN(r)&&r>0}function xg(r,e){return gf(r)&&!isNaN(r)&&r<=e&&r>=0}function JO(r,e){return`Invalid prop \`max\` of value \`${r}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${fd}\`.`}function zO(r,e){return`Invalid prop \`value\` of value \`${r}\` supplied to \`${e}\`. The \`value\` prop must be:
276
+ `,t=new Blob([a],{type:"application/javascript"});window.__heic2any__worker=new Worker(URL.createObjectURL(t));var n=["image/png","image/jpeg","image/gif"],i={blobToDataURL:function(s){return new Promise(function(f,l){var c=new FileReader;c.onerror=function(){l("ERR_DOM Error on converting blob to data URL")},c.onload=function(h){f(c.result)},c.readAsDataURL(s)})},dataURItoBlob:function(s){try{for(var f=atob(s.split(",")[1]),l=s.split(",")[0].split(":")[1].split(";")[0],c=new ArrayBuffer(f.length),h=new Uint8Array(c),d=0;d<f.length;d++)h[d]=f.charCodeAt(d);var v=new Blob([c],{type:l});return v}catch(b){return"ERR_DOM Error on converting data URI to blob "+b&&b.toString?b.toString():b}},imageDataToBlob:function(s){var f=s.imageData,l=s.toType;l===void 0&&(l="image/png");var c=s.quality;return c===void 0&&(c=.92),(c>1||c<0)&&(c=.92),n.indexOf(l)===-1&&(l="image/png"),new Promise(function(h,d){var v=null;try{v=document.createElement("canvas")}catch{}if(!v)return d("ERR_CANVAS Error on converting imagedata to blob: Could not create canvas element");v.width=f.width,v.height=f.height;var b=v.getContext("2d");if(!b)return d("ERR_CANVAS Error on converting imagedata to blob: Could not get canvas context");b.putImageData(f,0,0),v.toBlob(function(m){return m?h(m):d("ERR_CANVAS Error on converting imagedata to blob: Could not get blob from canvas")},l,c)})},imagesToGif:function(s){var f=s.images,l=s.interval,c=s.gifHeight,h=s.gifWidth;return new Promise(function(d,v){gifshot.createGIF({images:f,interval:l,gifHeight:c,gifWidth:h},function(b){return b.error&&v("ERR_GIF "+b.errorCode+" "+b.errorMessage),d(b.image)})})},otherImageType:function(s){for(var f=new Uint8Array(s).subarray(0,4),l="",c=0;c<f.length;c++)l=l+f[c].toString(16);switch(l){case"89504e47":return"image/png";case"47494638":return"image/gif";case"ffd8ffe0":case"ffd8ffe1":case"ffd8ffe2":case"ffd8ffe3":case"ffd8ffe8":return"image/jpeg";default:return!1}},error:function(s){var f=0;s?typeof s!="string"&&(s.toString?s=s.toString():s=JSON.stringify(s)):s="ERR_UNKNOWN";for(var l=["ERR_USER","ERR_LIBHEIF","ERR_GIF","ERR_DOM","ERR_CANVAS"],c=0;c<l.length;c++){var h=l[c];s.indexOf(h)===0&&(f=c+1)}return{code:f,message:s}}};function o(s){return new Promise(function(f,l){var c=(Math.random()*new Date().getTime()).toString(),h={id:c,buffer:s};window.__heic2any__worker.postMessage(h),window.__heic2any__worker.addEventListener("message",function(d){if(d.data.id===c)return d.data.error?l(d.data.error):f(d.data.imageDataArr)})})}function A(s){var f=s.blob,l=s.toType;l===void 0&&(l="image/png");var c=s.quality;c===void 0&&(c=.92);var h=s.gifInterval;h===void 0&&(h=.4);var d=s.multiple;return d===void 0&&(d=void 0),new Promise(function(v,b){f instanceof Blob||i.error("ERR_USER library only accepts BLOBs as input"),typeof d!="boolean"&&i.error('ERR_USER "multiple" parameter should be of type "boolean"'),typeof c!="number"&&i.error('ERR_USER "quality" parameter should be of type "number"'),typeof h!="number"&&i.error('ERR_USER "gifInterval" parameter should be of type "number"');var m=new FileReader;m.onload=function(_){var E=0,B=0,Z=_.target.result,k=i.otherImageType(Z);if(k)return b(i.error("ERR_USER Image is already browser readable: "+k));o(Z).then(function(O){return E=O[0].width,B=O[0].height,Promise.all(O.map(function(D){return i.imageDataToBlob({imageData:D,toType:l,quality:c})}))}).then(function(O){return l==="image/gif"?Promise.all(O.map(function(D){return i.blobToDataURL(D)})):d?(v(O),[""]):(v(O[0]),[""])}).then(function(O){return l==="image/gif"&&O?i.imagesToGif({images:O,interval:h,gifWidth:E,gifHeight:B}):""}).then(function(O){if(l==="image/gif"&&O){var D=i.dataURItoBlob(O);typeof D=="string"?b(i.error(D)):v(D)}}).catch(function(O){b(i.error(O))})},m.readAsArrayBuffer(f)})}return A})})(kg);var gO=kg.exports;const yO=q1(gO),wO=async r=>{try{const e=r.name.toLowerCase();if(!e.endsWith(".heic")&&!e.endsWith(".heif"))return r;let a=await yO({blob:r,toType:"image/jpeg",quality:.7});Array.isArray(a)&&(a=a[0]);const t=await a.arrayBuffer(),n=new Uint8Array(t);return new window.File([n],r.name.replace(/\.(heic|heif)$/i,".jpg"),{type:"image/jpeg",lastModified:r.lastModified})}catch(e){return console.error("HEIC/HEIF conversion failed:",e),r}},kO="Something went wrong.";function EO(r,e){return r instanceof Array&&(r=r[0]),r instanceof Error?r.message:typeof r=="string"?r:kO}const Oo=I.forwardRef(({label:r,error:e,hint:a,required:t=!1,accept:n,multiple:i=!1,maxSize:o,maxFiles:A,disabled:s=!1,containerClassName:f,className:l,id:c,onFileSelect:h,onHeicConversionStart:d,isSubmitting:v,isFormatHintVisible:b=!0,placeholder:m=i?"Select files":"Select file",..._},E)=>{const[B,Z]=I.useState([]),[k,O]=I.useState(!1),{toast:D}=Ii(),j=I.useRef(0),J=I.useRef(null),M=c||`file-field-${r.toLowerCase().replace(/\s+/g,"-")}`,z=async y=>{try{const x=await wO(y),S=x;S.preview=URL.createObjectURL(x),Z(N=>{if(!N.includes(y))return URL.revokeObjectURL(S.preview),N;const G=[...N.filter(Q=>Q!==y),S],T=new DataTransfer;return G.forEach(Q=>T.items.add(Q)),h==null||h(T.files),G})}catch(x){console.error("HEIC convert failed:",x),Z([...B])}},R=async y=>{const x=[],S=[];for(const N of y){const W=N.name.toLowerCase().endsWith(".heic")||N.name.toLowerCase().endsWith(".heif"),G=N.type.startsWith("image/"),T=N;if(G?T.preview=URL.createObjectURL(N):T.preview=void 0,x.push(T),W){const Q=z(T);S.push(Q)}}return S.forEach(N=>d==null?void 0:d(N)),x},q=I.useCallback(async(y,x=!1)=>{if(!y||y.length===0){x||(Z([]),h==null||h(null));return}const S=Array.from(y),{valid:N,errors:W}=pO(S,{maxSize:o,accept:n,maxFiles:A?A-(x?B.length:0):void 0});if(W.length>0){D({title:"Validation Error",description:EO(W[0]),variant:"destructive"});return}const G=await R(N),T=x?[...B,...G]:G;Z(T);try{const Q=new DataTransfer;T.forEach(er=>Q.items.add(er)),h==null||h(Q.files)}catch{h==null||h(T)}J.current&&(J.current.value="")},[B,o,n,A,h,i]),L=I.useCallback(y=>{y.preventDefault(),j.current+=1,j.current===1&&O(!0)},[]),or=I.useCallback(y=>{y.preventDefault(),j.current-=1,j.current<=0&&(O(!1),j.current=0)},[]),H=I.useCallback(y=>{y.preventDefault()},[]),V=I.useCallback(y=>{if(y.preventDefault(),O(!1),j.current=0,s)return;const x=y.dataTransfer.files,S=i&&B.length>0;q(x,S)},[s,q,i,B.length]),p=I.useCallback(()=>{var y;s||(y=J.current)==null||y.click()},[s]),w=I.useCallback(()=>{var y;s||(y=J.current)==null||y.click()},[s]),g=I.useCallback(y=>{const x=B.filter((S,N)=>N!==y);if(Z(x),x.length===0)h==null||h(null),J.current&&(J.current.value="");else{const S=new DataTransfer;x.forEach(N=>S.items.add(N)),h==null||h(S.files)}},[B,h]);return I.useEffect(()=>()=>{B.forEach(y=>{y.preview&&URL.revokeObjectURL(y.preview)})},[B]),u.jsxs("div",{className:wg("space-y-2",f),children:[u.jsxs(K1,{htmlFor:M,className:"font-medium text-gray-700",children:[r,t&&u.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),u.jsx("input",{ref:J,id:M,type:"file",accept:n,multiple:i,disabled:s,className:"sr-only",onChange:y=>{const x=i&&B.length>0;q(y.target.files,x)},"aria-describedby":e?`${M}-error`:a?`${M}-hint`:void 0,..._}),u.jsx("div",{className:wg("relative cursor-pointer rounded-lg border-2 border-dashed p-3 transition-all duration-200","hover:border-primary hover:bg-gray-50","focus-within:border-primary focus-within:ring-2 focus-within:ring-purple-400 focus-within:ring-opacity-20",k&&"border-primary bg-blue-50",e&&"border-red-300 hover:border-red-400",s&&"cursor-not-allowed opacity-50 hover:border-gray-300",l),onDragEnter:L,onDragLeave:or,onDragOver:H,onDrop:V,onClick:B.length===0?p:void 0,children:B.length===0?u.jsxs("div",{className:"text-center",children:[u.jsx(n4,{className:"mx-auto mb-2 h-8 w-8 text-gray-400"}),u.jsxs("div",{className:"text-sm text-gray-600",children:[u.jsx("span",{className:"hover:text-primary/80 font-medium text-primary",children:m})," or drag here"]}),(n||o)&&u.jsxs("div",{className:"mt-1 text-xs text-gray-500",children:[n&&b&&u.jsxs("div",{children:["Supported formats: ",n]}),a&&a,o&&u.jsxs("div",{children:["Maximum size: ",od(o)]})]})]}):u.jsxs("div",{className:"space-y-2",children:[B.map((y,x)=>u.jsxs("div",{className:"flex items-center justify-between rounded p-2",children:[u.jsxs("div",{className:"flex min-w-0 flex-1 items-center space-x-2",children:[y.preview?u.jsx("img",{src:y.preview,alt:y.name,className:"h-8 w-8 rounded object-cover"}):u.jsx(Jy,{className:"h-8 w-8 flex-shrink-0 text-gray-400"}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"truncate text-sm font-medium text-gray-900",children:y.name}),u.jsx("div",{className:"text-xs text-gray-500",children:od(y.size)})]})]}),u.jsx(E0,{disabled:v,type:"button",variant:"ghost",size:"sm",onClick:S=>{S.stopPropagation(),g(x)},className:"h-8 w-8",children:u.jsx(Ky,{className:"text-primary"})})]},`${y.preview}-${y.name}`)),i&&(!A||B.length<A)&&u.jsx("div",{className:"border-t border-dashed border-gray-300 pt-2 text-center",children:u.jsxs(E0,{type:"button",variant:"outline",size:"sm",onClick:y=>{y.stopPropagation(),w()},className:"text-xs",children:[u.jsx(n4,{className:"mr-1 text-primary"}),"Add More Files"]})})]})})]})});Oo.displayName="FileUploadField";const Ad=5,CO=10,vf={company_structure:{label:"Company Structure",description:"Upload document showing directors & legal representatives",required:!0},certificate_of_registration:{label:"Certificate of Registration",description:"Upload your company's certificate of registration",required:!0},bank_statement:{label:"Bank Statement",description:"Upload your latest bank statement",required:!0},void_cheque:{label:"Void Cheque",description:"Upload your Void Cheque",required:!1},business_license:{label:"Business License",description:"Upload your official business/operating license",required:!1}},Eg=["company_structure","certificate_of_registration","bank_statement","void_cheque","business_license"],_O=r=>{const e={};return r.forEach(a=>{const t=vf[a].required;e[a]=i_(DA(File)).max(Ad,`Maximum ${Ad} files allowed`).refine(n=>!t||n.length>0,"At least one file is required")}),Nn(e)},BO=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n,companyDocumentsTypes:i=["bank_statement","company_structure","certificate_of_registration","void_cheque","business_license"]})=>{const o=I.useMemo(()=>[...i].sort((h,d)=>{const v=vf[h].required,b=vf[d].required;return v&&!b?-1:!v&&b?1:Eg.indexOf(h)-Eg.indexOf(d)}),[i]),A=_O(o),s=En({resolver:Cn(A),defaultValues:Object.fromEntries(o.map(h=>[h,r[h]||[]]))}),{isSubmitting:f}=s.formState,l=h=>d=>{const v=d?Array.isArray(d)?d:Array.from(d):[];s.setValue(h,v,{shouldValidate:!0}),e({[h]:v})},c=async h=>{await a(h)};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Company Documents",subTitle:"Please upload the required company documents",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...s,children:u.jsxs("form",{onSubmit:s.handleSubmit(c),className:"space-y-8",children:[o.map(h=>{const d=vf[h];return u.jsx(Xr,{control:s.control,name:h,render:()=>u.jsxs(Vr,{children:[u.jsx(Dr,{children:u.jsx(Oo,{label:d.label,required:d.required,multiple:!0,maxFiles:Ad,maxSize:CO*1024*1024,accept:"image/*,application/pdf,.pdf",placeholder:"Drop files here or click to upload",hint:d.description,onFileSelect:l(h),isSubmitting:f,disabled:f})}),u.jsx(Mr,{})]})},h)}),u.jsx(E0,{type:"submit",size:"lg",className:"w-full",disabled:f,children:f?"Processing...":"Continue to Review"})]})}),u.jsx("div",{className:"mt-8",children:n()})]})]})},IO=Nn({industry:zr().min(1,"Industry is required"),business_model:zr().min(1,"Business model is required"),annual_sales_volume:zr().min(1,"Annual sales volume is required"),website_url:zr().min(1,"Website URL is required").url("Please enter a valid URL")}),NO=[{value:"technology",label:"Technology"},{value:"finance",label:"Finance"},{value:"healthcare",label:"Healthcare"},{value:"retail",label:"Retail"},{value:"manufacturing",label:"Manufacturing"},{value:"education",label:"Education"},{value:"hospitality",label:"Hospitality"},{value:"real-estate",label:"Real Estate"},{value:"consulting",label:"Consulting"}],xO=[{value:"b2b",label:"B2B (Business to Business)"},{value:"b2c",label:"B2C (Business to Consumer)"},{value:"b2b2c",label:"B2B2C (Business to Business to Consumer)"},{value:"marketplace",label:"Marketplace"},{value:"saas",label:"SaaS (Software as a Service)"},{value:"subscription",label:"Subscription"},{value:"freemium",label:"Freemium"}],ZO=[{value:"0-50k",label:"$0 - $50,000"},{value:"50k-100k",label:"$50,000 - $100,000"},{value:"100k-500k",label:"$100,000 - $500,000"},{value:"500k-1m",label:"$500,000 - $1,000,000"},{value:"1m-5m",label:"$1,000,000 - $5,000,000"},{value:"5m-10m",label:"$5,000,000 - $10,000,000"},{value:"10m+",label:"$10,000,000+"}],SO=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n})=>{const i=En({resolver:Cn(IO),defaultValues:{industry:r.industry,business_model:r.business_model,annual_sales_volume:r.annual_sales_volume,website_url:r.website_url}}),o=A=>{e(A),a(A)};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Company Activity",subTitle:"Tell us about your business operations",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...i,children:u.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-6",children:[u.jsx(Xr,{control:i.control,name:"industry",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Industry"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:NO,placeholder:"Enter industry",name:"industry"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"business_model",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Business Model"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:xO,placeholder:"Enter business model",name:"business_model"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"annual_sales_volume",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Annual Sales Volume (USD)"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:ZO,placeholder:"Enter annual sales volume",name:"annual_sales_volume"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"website_url",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Website URL (Optional)"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"https://www.yourcompany.com",...A})}),u.jsx(Mr,{})]})}),u.jsx(E0,{type:"submit",className:"w-full",children:"Continue"})]})}),u.jsx("div",{className:"mt-6",children:n()})]})]})},FO=Nn({registration_number:zr().trim().min(1,"Registration number is required"),country:zr().trim().min(1,"Country is required"),company_name:zr().trim().min(2,"Company name must be at least 2 characters"),doing_business_as:zr().trim().min(1,"Doing Business As (DBA) is required"),tax_identity_number:zr().trim().min(1,"Tax identity number is required"),corporate_type:zr().trim().min(1,"Corporate type is required"),date_of_establishment:o_.date({required_error:"Date of establishment is required"})}),WO=[{value:"us",label:"United States"},{value:"uk",label:"United Kingdom"},{value:"ca",label:"Canada"},{value:"au",label:"Australia"},{value:"de",label:"Germany"},{value:"fr",label:"France"}],TO=[{value:"llc",label:"LLC"},{value:"corporation",label:"Corporation"},{value:"partnership",label:"Partnership"},{value:"sole-proprietorship",label:"Sole Proprietorship"}],$O=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n})=>{const i=En({resolver:Cn(FO),defaultValues:{registration_number:r.registration_number,country:r.country,company_name:r.company_name,doing_business_as:r.doing_business_as||"",tax_identity_number:r.tax_identity_number,corporate_type:r.corporate_type,date_of_establishment:r.date_of_establishment?new Date(r.date_of_establishment):void 0}}),o=A=>{e(A),a(A)};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Business Information",subTitle:"Please provide your business details",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...i,children:u.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-6",children:[u.jsx(Xr,{control:i.control,name:"registration_number",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Registration Number"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter registration number",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"country",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Country"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:WO,placeholder:"Enter country",name:"country"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"company_name",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Company Name"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter company name",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"doing_business_as",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Doing Business As (DBA)"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter Doing Business As (DBA)",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"tax_identity_number",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Tax Identity Number"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter tax identity number",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"corporate_type",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Corporate Type"}),u.jsx(Dr,{children:u.jsx(ci,{value:A.value,onValueChange:A.onChange,options:TO,placeholder:"Enter corporate type",name:"corporate_type"})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"date_of_establishment",render:({field:A})=>u.jsxs(Vr,{className:"flex flex-col",children:[u.jsx(Lr,{children:"Date of Establishment"}),u.jsxs(Hu,{modal:!0,children:[u.jsx(Qu,{asChild:!0,children:u.jsx(Dr,{children:u.jsxs(E0,{variant:"outline",className:Or("w-full pl-3 text-left font-normal",!A.value&&"text-muted-foreground"),children:[A.value?Ga(A.value,"PPP"):u.jsx("span",{children:"Pick a date"}),u.jsx(Wf,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),u.jsx(ds,{className:"w-auto p-0",align:"start",onOpenAutoFocus:s=>s.preventDefault(),children:u.jsx(ks,{mode:"single",selected:A.value,onSelect:A.onChange,captionLayout:"dropdown-buttons",fromYear:1900,toYear:2026,disabled:s=>s>new Date,initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),u.jsx(Mr,{})]})}),u.jsx(E0,{type:"submit",className:"w-full",children:"Continue"})]})}),u.jsx("div",{className:"mt-6",children:n()})]})]})},PO=y3(new Date),OO=Nn({full_name:zr().min(2,"Full name must be at least 2 characters"),title:zr().min(1,"Title is required"),email:zr().email("Invalid email").optional(),birth:i3({required_error:"Birth date is required"}).refine(r=>GA(r,PO),{message:"You must be at least 16 years old"}),phone_number:zr().min(1,"Phone number is required").refine(r=>q5(r),{message:"Invalid phone number"})}).superRefine((r,e)=>{r.email||e.addIssue({path:["email"],message:"Email is required",code:sr.custom})}),VO=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n})=>{const i=En({resolver:Cn(OO),defaultValues:{full_name:r.full_name,title:r.title,email:r.email||"",birth:r.birth||void 0,phone_number:r.phone_number}}),o=A=>{e(A),a(A)};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Personal Details",subTitle:"Please provide your personal information",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...i,children:u.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-6",children:[u.jsx(Xr,{control:i.control,name:"full_name",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Full Name"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter your full name",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"title",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Title"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"e.g., CEO, Director, Manager",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"email",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Email"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"example@gmail.com",...A})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"birth",render:({field:A})=>u.jsxs(Vr,{className:"flex flex-col",children:[u.jsx(Lr,{children:"Date of Birth"}),u.jsxs(Hu,{modal:!0,children:[u.jsx(Qu,{asChild:!0,children:u.jsx(Dr,{children:u.jsxs(E0,{variant:"outline",className:Or("w-full pl-3 text-left font-normal",!A.value&&"text-muted-foreground"),children:[A.value?Ga(A.value,"PPP"):u.jsx("span",{children:"Pick a date"}),u.jsx(Wf,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),u.jsx(ds,{className:"w-auto p-0",align:"start",onOpenAutoFocus:s=>s.preventDefault(),children:u.jsx(ks,{mode:"single",selected:A.value,onSelect:A.onChange,captionLayout:"dropdown-buttons",fromYear:1900,toYear:2026,disabled:s=>s>new Date||s<new Date("1900-01-01"),initialFocus:!0,className:"p-3 pointer-events-auto"})})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"phone_number",render:({field:A})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Phone Number"}),u.jsx(Dr,{children:u.jsx(k8,{control:i.control,name:"phone_number",placeholder:"Enter your phone number",defaultCountry:"US"})}),u.jsx(Mr,{})]})}),u.jsx(E0,{type:"submit",className:"w-full",children:"Continue"})]})}),u.jsx("div",{className:"mt-6",children:n()})]})]})},DO=Nn({inventory_maintained:zr().min(1,"Please select an inventory option"),offsite_address:zr().optional(),fulfillment_agreement:DA(File).nullable().optional(),other_companies_involved:zr().min(1,"Please select an option"),other_fulfillment_agreement:DA(File).nullable().optional(),recurring_services:zr().min(1,"Please select an option"),recurring_services_description:zr().optional(),fulfillment_time:zr().min(1,"Please select a fulfillment time"),delivery_time:zr().min(1,"Please select a delivery time"),charge_time:zr().min(1,"Please select a charge time"),return_policy:zr().min(1,"Return policy is required"),bankruptcy_filed:zr().min(1,"Please select an option"),was_terminated_from_card_acceptance:zr().min(1,"Please select an option"),has_coa:zr().min(1,"Please select an option"),coa_document:DA(File).nullable().optional()}).superRefine((r,e)=>{var a,t;r.inventory_maintained==="off-site"&&!((a=r.offsite_address)!=null&&a.trim())&&e.addIssue({code:sr.custom,message:"Warehouse address is required when inventory is maintained off-site",path:["offsite_address"]}),r.inventory_maintained==="third-party"&&!r.fulfillment_agreement&&e.addIssue({code:sr.custom,message:"Fulfillment agreement file is required when using a third-party fulfillment center",path:["fulfillment_agreement"]}),r.other_companies_involved==="yes"&&!r.other_fulfillment_agreement&&e.addIssue({code:sr.custom,message:"Fulfillment agreement file is required when other companies are involved",path:["other_fulfillment_agreement"]}),r.recurring_services==="yes"&&!((t=r.recurring_services_description)!=null&&t.trim())&&e.addIssue({code:sr.custom,message:"Recurring services description is required when offering recurring services",path:["recurring_services_description"]}),r.has_coa==="yes"&&!r.coa_document&&e.addIssue({code:sr.custom,message:"Certificate of Analysis document is required when COA is available",path:["coa_document"]})}),MO=[{value:"on-site",label:"On-Site"},{value:"off-site",label:"Off-Site (e.g., Warehouse)"},{value:"third-party",label:"3rd Party Fulfillment Center"},{value:"service-only",label:"Service Only (No Products Sold)"}],pf=[{value:"no",label:"No"},{value:"yes",label:"Yes"}],GO=[{value:"24-hours",label:"Within 24 Hours"},{value:"2-days",label:"2 Days"},{value:"3-10-days",label:"3-10 Days"},{value:"11-30-days",label:"11-30 Days"},{value:"31-90-days",label:"31-90 Days"},{value:"90-plus-days",label:"90+ Days"}],XO=[{value:"24-hours",label:"Within 24 Hours"},{value:"2-5-days",label:"2-5 Days"},{value:"6-10-days",label:"6-10 Days"},{value:"11-plus-days",label:"11+ Days"}],RO=[{value:"time-of-order",label:"Time of Order"},{value:"upon-shipment",label:"Upon Shipment"}],jO=[{value:"business-bankruptcy",label:"Business Bankruptcy"},{value:"personal-bankruptcy",label:"Personal Bankruptcy"},{value:"never",label:"Never"}],LO=({data:r,onDataChange:e,onContinue:a,onBack:t,renderProgress:n})=>{const i=En({resolver:Cn(DO),defaultValues:{inventory_maintained:r.inventory_maintained||"",offsite_address:r.offsite_address||"",fulfillment_agreement:r.fulfillment_agreement||null,other_companies_involved:r.other_companies_involved||"",other_fulfillment_agreement:r.other_fulfillment_agreement||null,recurring_services:r.recurring_services||"",recurring_services_description:r.recurring_services_description||"",fulfillment_time:r.fulfillment_time||"",delivery_time:r.delivery_time||"",charge_time:r.charge_time||"",return_policy:r.return_policy||"",bankruptcy_filed:r.bankruptcy_filed||"",was_terminated_from_card_acceptance:r.was_terminated_from_card_acceptance||"",has_coa:r.has_coa||"",coa_document:r.coa_document||null}}),{isSubmitting:o}=i.formState,A=async d=>{const v={...d};d.inventory_maintained!=="off-site"&&delete v.offsite_address,d.inventory_maintained!=="third-party"&&delete v.fulfillment_agreement,d.other_companies_involved!=="yes"&&delete v.other_fulfillment_agreement,d.recurring_services!=="yes"&&delete v.recurring_services_description,d.has_coa!=="yes"&&delete v.coa_document,e(v),await a(v)},s=i.watch("inventory_maintained"),f=i.watch("other_companies_involved"),l=i.watch("recurring_services"),c=i.watch("has_coa"),h=(d,v)=>{const b=v&&v.length>0?v[0]:null;i.setValue(d,b,{shouldValidate:!0}),e({[d]:b})};return u.jsxs(te,{className:"w-full max-w-2xl mx-auto",children:[u.jsx(At,{children:u.jsx(mt,{title:"Business Questionnaire",subTitle:"Provide details about your business operations",onBack:t})}),u.jsxs(ne,{children:[u.jsx(Sn,{...i,children:u.jsxs("form",{onSubmit:i.handleSubmit(A),className:"space-y-6",children:[u.jsx(Xr,{control:i.control,name:"inventory_maintained",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Inventory Maintained"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select inventory option"})})}),u.jsx(Ea,{children:MO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),s==="off-site"&&u.jsx(Xr,{control:i.control,name:"offsite_address",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Warehouse Address"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Enter warehouse address",...d,disabled:o})}),u.jsx(Mr,{})]})}),s==="third-party"&&u.jsx(Xr,{control:i.control,name:"fulfillment_agreement",render:()=>{var d;return u.jsxs(Vr,{children:[u.jsx(Dr,{children:u.jsx(Oo,{label:"Fulfillment Agreement",placeholder:"Upload fulfillment agreement",hint:"Upload fully executed fulfillment agreement with 3rd party",accept:"image/*,application/pdf,.pdf",onFileSelect:v=>h("fulfillment_agreement",v),error:(d=i.formState.errors.fulfillment_agreement)==null?void 0:d.message,isSubmitting:o,disabled:o})}),u.jsx(Mr,{})]})}}),u.jsx(Xr,{control:i.control,name:"other_companies_involved",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Are there any other companies involved in shipping or fulfilling product/service?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:pf.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),f==="yes"&&u.jsx(Xr,{control:i.control,name:"other_fulfillment_agreement",render:()=>{var d;return u.jsxs(Vr,{children:[u.jsx(Dr,{children:u.jsx(Oo,{label:"Fulfillment Agreement for Other Companies",placeholder:"Upload fulfillment agreement",hint:"Upload fully executed fulfillment agreement",accept:"image/*,application/pdf,.pdf",onFileSelect:v=>h("other_fulfillment_agreement",v),error:(d=i.formState.errors.other_fulfillment_agreement)==null?void 0:d.message,isSubmitting:o,disabled:o})}),u.jsx(Mr,{})]})}}),u.jsx(Xr,{control:i.control,name:"recurring_services",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Do you offer recurring or time-extended services?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:pf.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),l==="yes"&&u.jsx(Xr,{control:i.control,name:"recurring_services_description",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Recurring Services Description and Duration"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"e.g., Monthly subscription, 12-month plan",...d,disabled:o})}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"has_coa",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Do you have a Certificate of Analysis (COA) for your product(s)?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:pf.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),c==="yes"&&u.jsx(Xr,{control:i.control,name:"coa_document",render:()=>{var d;return u.jsxs(Vr,{children:[u.jsx(Dr,{children:u.jsx(Oo,{label:"Certificate of Analysis",placeholder:"Upload COA document",hint:"Upload the Certificate of Analysis document",accept:"image/*,application/pdf,.pdf",onFileSelect:v=>h("coa_document",v),error:(d=i.formState.errors.coa_document)==null?void 0:d.message,isSubmitting:o,disabled:o})}),u.jsx(Mr,{})]})}}),u.jsx(Xr,{control:i.control,name:"fulfillment_time",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"How long after charging the customer is the product fulfilled or service begun?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select fulfillment time"})})}),u.jsx(Ea,{children:GO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"delivery_time",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"How long after order does the cardholder receive the product/service?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select delivery time"})})}),u.jsx(Ea,{children:XO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"charge_time",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"When is the cardholder charged?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select charge time"})})}),u.jsx(Ea,{children:RO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"bankruptcy_filed",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Have you (your business or any principal) filed bankruptcy?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:jO.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"was_terminated_from_card_acceptance",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Have you (your business or any principal) ever been terminated from accepting bank cards?"}),u.jsxs(Ra,{onValueChange:d.onChange,value:d.value,disabled:o,children:[u.jsx(Dr,{children:u.jsx(ka,{children:u.jsx(ja,{placeholder:"Select an option"})})}),u.jsx(Ea,{children:pf.map(v=>u.jsx(Ca,{value:v.value,children:v.label},v.value))})]}),u.jsx(Mr,{})]})}),u.jsx(Xr,{control:i.control,name:"return_policy",render:({field:d})=>u.jsxs(Vr,{children:[u.jsx(Lr,{children:"Return Policy"}),u.jsx(Dr,{children:u.jsx(D0,{placeholder:"Describe your return policy",...d,disabled:o})}),u.jsx(Mr,{})]})}),u.jsx(E0,{type:"submit",className:"w-full",disabled:o,children:o?"Submitting...":"Continue"})]})}),u.jsx("div",{className:"mt-6",children:n()})]})]})};var sd="Progress",fd=100,[UO]=bn(sd),[YO,HO]=UO(sd),Cg=C.forwardRef((r,e)=>{const{__scopeProgress:a,value:t=null,max:n,getValueLabel:i=QO,...o}=r;(n||n===0)&&!Ng(n)&&console.error(JO(`${n}`,"Progress"));const A=Ng(n)?n:fd;t!==null&&!xg(t,A)&&console.error(zO(`${t}`,"Progress"));const s=xg(t,A)?t:null,f=gf(s)?i(s,A):void 0;return u.jsx(YO,{scope:a,value:s,max:A,children:u.jsx(e0.div,{"aria-valuemax":A,"aria-valuemin":0,"aria-valuenow":gf(s)?s:void 0,"aria-valuetext":f,role:"progressbar","data-state":Ig(s,A),"data-value":s??void 0,"data-max":A,...o,ref:e})})});Cg.displayName=sd;var _g="ProgressIndicator",Bg=C.forwardRef((r,e)=>{const{__scopeProgress:a,...t}=r,n=HO(_g,a);return u.jsx(e0.div,{"data-state":Ig(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...t,ref:e})});Bg.displayName=_g;function QO(r,e){return`${Math.round(r/e*100)}%`}function Ig(r,e){return r==null?"indeterminate":r===e?"complete":"loading"}function gf(r){return typeof r=="number"}function Ng(r){return gf(r)&&!isNaN(r)&&r>0}function xg(r,e){return gf(r)&&!isNaN(r)&&r<=e&&r>=0}function JO(r,e){return`Invalid prop \`max\` of value \`${r}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${fd}\`.`}function zO(r,e){return`Invalid prop \`value\` of value \`${r}\` supplied to \`${e}\`. The \`value\` prop must be:
277
277
  - a positive number
278
278
  - less than the value passed to \`max\` (or ${fd} if no \`max\` prop is set)
279
279
  - \`null\` or \`undefined\` if the progress is indeterminate.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "description": "A modern React component library for KYC",
5
5
  "author": "TechLabi",
6
- "version": "0.52.0-beta.0",
6
+ "version": "0.52.0-beta.1",
7
7
  "type": "module",
8
8
  "types": "dist/types/index.d.ts",
9
9
  "style": "dist/style.css",