PageSourceSearch

https://herostock.ai/assets/KycPage-D-OJnZIg.js

js herostock.ai collected 2026-10-05 14:32:36 UTC 27,992 bytes, 1 lines download raw bytes

1import{j as e}from"./query-BQ5zDiGB.js";import{r as c}from"./react-vendor-DHsc3q5k.js";import{u as De,s as u,c as N}from"./index-CUsCJzIz.js";import{C as j}from"./Card-DwpCWs77.js";import{B as U}from"./Button-BI-BmKKx.js";import{I as v}from"./Input-CFaMtlS_.js";import{B as Be}from"./Badge-McOzidRb.js";import{g as ze}from"./capitalconnect-DrS3xbAa.js";import{as as J,an as Ae,at as Fe,au as Pe,a9 as Ee,U as he,av as fe,q as Re,a7 as T,$ as V,z as W,aw as qe,W as H,ax as Q,Q as ue,ay as xe,i as Ue,az as Le,aA as Oe,aB as Me,aC as Xe,x as pe,aD as Ye}from"./ui-Blg_AY2b.js";import"./supabase-CpRTRdvQ.js";const z=[{id:"upload",label:"Upload & Import",icon:Ee},{id:"details",label:"Verify & Complete",icon:he},{id:"review",label:"Review & Submit",icon:fe}],L=[{id:"nid_front",label:"NID Front",icon:J,accept:"image/*,.pdf",hint:"Front side of National ID"},{id:"nid_back",label:"NID Back",icon:J,accept:"image/*,.pdf",hint:"Back side of National ID"},{id:"cheque",label:"Cheque Leaf",icon:Ae,accept:"image/*,.pdf",hint:"Any cheque page from bank"},{id:"photo",label:"Passport Photo",icon:Fe,accept:"image/*",hint:"Recent colour photograph"},{id:"signature",label:"Signature",icon:Pe,accept:"image/*,.pdf",hint:"Sign on white paper, scan"}];function O({label:l,value:f,onChange:d,options:h,required:C,highlight:w}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"block text-[11px] font-medium text-muted uppercase tracking-wider",children:[l," ",C&&e.jsx("span",{className:"text-danger",children:"*"})]}),e.jsxs("select",{value:f,onChange:m=>d(m.target.value),className:N("w-full rounded-lg border text-sm px-3 py-2.5 transition-all focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/40",w?"border-success/40 bg-success/5":"border-border bg-background text-foreground"),children:[e.jsx("option",{value:"",children:"Select..."}),h.map(m=>{const A=typeof m=="string"?m:m.value,X=typeof m=="string"?m:m.label;return e.jsx("option",{value:A,children:X},A)})]})]})}function ss(){const{user:l,updateProfile:f}=De(),[d,h]=c.useState("upload"),[C,w]=c.useState(!0),[m,A]=c.useState(!1),[X,Z]=c.useState(!1),[ge,be]=c.useState(null),[ee,_]=c.useState("idle"),Y=c.useRef(void 0),se=c.useRef(0),[F,je]=c.useState(""),[P,ae]=c.useState(!1),[S,te]=c.useState([]),[ne,le]=c.useState(""),[ve,ie]=c.useState(null),[Ne,re]=c.useState(null),[b,$]=c.useState({}),[_e,oe]=c.useState({}),[ce,E]=c.useState(null),[a,de]=c.useState({nationality:"Bangladeshi",nid_type:"nid",investor_category:"RB",account_type:"Cash",bo_type:"individual",is_pep:!1,declaration_signed:!1}),i=c.useCallback(s=>{de(n=>({...n,...s}))},[]);c.useEffect(()=>{l?.id&&(async()=>{const{data:s}=await u.from("profiles").select("*").eq("id",l.id).single();s&&de(t=>({...t,...s}));const{data:n}=await u.from("kyc_documents").select("*").eq("user_id",l.id);if(n){const t={};n.forEach(r=>{t[r.document_type]=r}),$(t)}w(!1),setTimeout(()=>A(!0),500)})()},[l?.id]),c.useEffect(()=>{if(!(!m||!l?.id)&&(se.current++,!(se.current<=1)))return clearTimeout(Y.current),_("saving"),Y.current=setTimeout(async()=>{const s=G(),{error:n}=await u.from("profiles").update(s).eq("id",l.id);if(n){console.warn("Auto-save update failed, trying upsert:",n.message);const{error:t}=await u.from("profiles").upsert({id:l.id,...s},{onConflict:"id"});t&&console.error("Auto-save upsert also failed:",t.message)}_("saved"),setTimeout(()=>_("idle"),2e3)},1500),()=>clearTimeout(Y.current)},[a,m,l?.id]);async function ye(){if(F.trim()){ae(!0),le(""),te([]);try{const s=await ze(F.trim(),"3"),n=[],t={};if(s.investorName&&s.investorName!=="."&&(t.full_name=s.investorName,n.push("Full Name")),s.fatherName&&s.fatherName!=="."&&(t.father_name=s.fatherName,n.push("Father's Name")),s.motherName&&s.motherName!=="."&&(t.mother_name=s.motherName,n.push("Mother's Name")),s.dob){const r=new Date(s.dob);isNaN(r.getTime())||(t.date_of_birth=r.toISOString().split("T")[0],n.push("Date of Birth"))}s.sex&&(t.gender=s.sex.toUpperCase()==="M"?"Male":s.sex.toUpperCase()==="F"?"Female":s.sex,n.push("Gender")),s.nationality&&s.nationality!=="."&&(t.nationality=s.nationality,n.push("Nationality")),s.cellNo&&s.cellNo!=="."&&(t.phone=s.cellNo,n.push("Phone")),s.email&&s.email!=="."&&(t.email=s.email,n.push("Email")),s.mailingAddress&&s.mailingAddress!=="."&&(t.present_address=s.mailingAddress,n.push("Present Address")),s.permanentAddress&&s.permanentAddress!=="."&&(t.permanent_address=s.permanentAddress,n.push("Permanent Address")),s.nationalID&&s.nationalID!=="."&&(t.nid_number=s.nationalID,n.push("NID Number")),s.boid&&s.boid!=="."&&(t.bo_account=s.boid,n.push("BO Account")),s.bankAccountNo&&s.bankAccountNo!=="."&&(t.bank_account=s.bankAccountNo,n.push("Bank Account")),i(t),te(n)}catch(s){le(s.message||"Failed to fetch investor data")}finally{ae(!1)}}}
1async function ke(s,n){if(l?.id){ie(s),E(null);try{n.type.startsWith("image/")&&oe(k=>({...k,[s]:URL.createObjectURL(n)}));let t=`${l.id}/${s}.${n.name.split(".").pop()}`,r=!1;await u.storage.from("kyc-docs").remove([t]);const{error:I}=await u.storage.from("kyc-docs").upload(t,n,{upsert:!0});I?(console.warn("Storage upload failed, saving reference only:",I.message),t=`local://${s}_${n.name}`):r=!0;const D={user_id:l.id,document_type:s,document_url:t,status:"pending"},q={file_size:n.size,file_type:n.type,version:(b[s]?.version||0)+1};async function B(k){let{error:K}=await u.from("kyc_documents").upsert(k,{onConflict:"user_id,document_type"});return K&&(await u.from("kyc_documents").delete().eq("user_id",l.id).eq("document_type",s),K=(await u.from("kyc_documents").insert(k)).error),K}let y=await B({...D,...q});(y?.message?.includes("schema cache")||y?.message?.includes("column"))&&(y=await B(D)),y&&(console.error("DB save failed:",y.message),E(`Document uploaded but record save failed: ${y.message}`)),$(k=>({...k,[s]:{...D,id:"",uploaded_at:new Date().toISOString()}})),["nid_front","nid_back","cheque"].includes(s)&&(re(s),await Ce(s,n),re(null))}catch(t){console.error("Upload failed:",t),E(`Upload failed for ${s}: ${t.message||"Unknown error"}`),n.type.startsWith("image/")&&(oe(r=>({...r,[s]:URL.createObjectURL(n)})),$(r=>({...r,[s]:{id:"",user_id:l.id,document_type:s,document_url:"",status:"pending",uploaded_at:new Date().toISOString()}})))}finally{ie(null)}}}async function Ce(s,n){await new Promise(t=>setTimeout(t,1200))}function G(){return{full_name:a.full_name||null,father_name:a.father_name||null,mother_name:a.mother_name||null,date_of_birth:a.date_of_birth||null,gender:a.gender||null,nationality:a.nationality||null,phone:a.phone||null,email:a.email||null,present_address:a.present_address||null,permanent_address:a.permanent_address||null,nid_type:a.nid_type||null,nid_number:a.nid_number||null,tin_number:a.tin_number||null,bank_name:a.bank_name||null,bank_account:a.bank_account||null,bank_branch:a.bank_branch||null,bank_routing_number:a.bank_routing_number||null,bo_account:a.bo_account||null,bo_type:a.bo_type||null,nominee_name:a.nominee_name||null,nominee_relation:a.nominee_relation||null,nominee_nid:a.nominee_nid||null,nominee_phone:a.nominee_phone||null,investor_category:a.investor_category||null,account_type:a.account_type||null,risk_tolerance:a.risk_tolerance||null,is_pep:a.is_pep??!1,declaration_signed:a.declaration_signed??!1,last_kyc_update:new Date().toISOString()}}async function we(){if(!l?.id)return;const s=G();_("saving");const{error:n}=await u.from("profiles").update(s).eq("id",l.id);if(n){console.error("Save failed:",n.message);const{error:t}=await u.from("profiles").upsert({id:l.id,...s},{onConflict:"id"});t&&console.error("Upsert fallback also failed:",t.message)}_("saved"),setTimeout(()=>_("idle"),2e3)}async function Se(){if(l?.id){Z(!0);try{const n={...G(),kyc_status:"submitted",declaration_signed:!0,declaration_signed_at:new Date().toISOString()},{error:t}=await u.from("profiles").update(n).eq("id",l.id);t&&console.error("Profile update failed:",t),await f({kyc_status:"submitted",declaration_signed:!0}),u.from("kyc_submissions").insert({user_id:l.id,status:"submitted",submitted_at:new Date().toISOString()}).then(({error:r})=>{r&&console.warn("kyc_submissions insert failed:",r.message)}),u.from("kyc_approvals").insert({user_id:l.id,action:"submitted",status_from:l.kyc_status,status_to:"submitted",notes:"Self-submitted via simplified KYC wizard"}).then(({error:r})=>{r&&console.warn("kyc_approvals insert failed:",r.message)}),be("submitted")}catch(s){console.error("Submit failed:",s)}finally{Z(!1)}}}const g=ge||a.kyc_status||l?.kyc_status||"pending";L.every(s=>!!b[s.id]),["nid_front","nid_back","photo","signature"].every(s=>!!b[s]);const me=a.declaration_signed&&a.phone&&a.date_of_birth&&a.full_name,x=new Set(S.map(s=>s.toLowerCase()));function Ie(s){return x.has(s.toLowerCase())}if(C)return e.jsx("div",{className:"min-h-screen bg-white animate-fade-in",children:e.jsxs("div",{style:{maxWidth:960,margin:"0 auto"},className:"px-4 py-8",children:[e.jsx("div",{className:"skeleton h-8 w-64 roun
1ded-lg mb-4"}),e.jsx("div",{className:"skeleton h-[400px] rounded-2xl"})]})});const R=z.findIndex(s=>s.id===d);return e.jsx("div",{className:"min-h-screen bg-white animate-fade-in",children:e.jsxs("div",{style:{maxWidth:960,margin:"0 auto"},className:"px-4 sm:px-6 py-4 sm:py-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(Re,{size:24,className:"text-primary"}),"KYC Verification"]}),e.jsx("p",{className:"text-muted text-xs mt-0.5",children:"Quick account verification — upload, verify, submit"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[ee==="saving"&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-muted animate-pulse",children:[e.jsx(T,{size:12,className:"animate-spin"})," Saving..."]}),ee==="saved"&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-success",children:[e.jsx(V,{size:12})," Saved"]}),e.jsx(Be,{status:g,label:g.replace(/_/g," "),pulse:!0})]})]}),g==="verified"&&e.jsxs("div",{className:"rounded-xl border border-success/20 bg-success/5 p-4 flex items-center gap-3 mb-6",children:[e.jsx(W,{className:"text-success shrink-0",size:20}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-success text-sm",children:"KYC Verified"}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:"Your identity has been verified. You can now trade."})]})]}),(g==="submitted"||g==="under_review")&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"rounded-xl border border-info/20 bg-info/5 p-5 flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-info/10 flex items-center justify-center shrink-0",children:e.jsx(qe,{className:"text-info",size:22})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-info text-sm",children:"KYC Pending for Verification"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:"Your application has been submitted and is being reviewed by our team. This usually takes 1-2 business days."}),e.jsx("p",{className:"text-[10px] text-muted mt-2",children:"You will be notified once your verification is complete."})]})]}),e.jsxs(j,{children:[e.jsxs("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2",children:[e.jsx(H,{size:16,className:"text-primary"})," Submitted Information"]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-4 gap-y-2 mb-4",children:[e.jsx(o,{label:"Full Name",value:a.full_name}),e.jsx(o,{label:"Phone",value:a.phone}),e.jsx(o,{label:"Email",value:a.email}),e.jsx(o,{label:"NID",value:a.nid_number}),e.jsx(o,{label:"Date of Birth",value:a.date_of_birth}),e.jsx(o,{label:"Gender",value:a.gender}),e.jsx(o,{label:"Bank",value:a.bank_name}),e.jsx(o,{label:"BO Account",value:a.bo_account})]}),e.jsxs("div",{className:"pt-3 border-t border-border",children:[e.jsx("p",{className:"text-[10px] text-muted uppercase tracking-wider mb-2",children:"Documents"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.map(s=>e.jsxs("span",{className:N("text-[10px] font-medium px-2 py-1 rounded-full",b[s.id]?"bg-success/10 text-success":"bg-muted/10 text-muted"),children:[b[s.id]?"✓":"—"," ",s.label]},s.id))})]})]})]}),g==="rejected"&&e.jsxs("div",{className:"rounded-xl border border-danger/20 bg-danger/5 p-4 flex items-center gap-3 mb-6",children:[e.jsx(Q,{className:"text-danger shrink-0",size:20}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-danger text-sm",children:"Rejected"}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:"Please review feedback and re-submit."})]})]}),(g==="pending"||g==="rejected"||g==="expired")&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center gap-1 mb-6",children:z.map((s,n)=>{s.icon;const t=s.id===d,r=n<R;return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("button",{onClick:()=>h(s.id),className:N("flex items-center gap-2 px-3 py-2 rounded-xl text-xs font-medium transition-all",t&&"bg-primary/10 text-primary border border-primary/20",r&&!t&&"bg-success/10 text-success",!t&&!r&&"text-muted/50"),children:[e.jsx("div",{className:N("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold",t&&"bg-primary text-white",r&&!t&&"bg-success text-white",!t&&!r&&"bg-gray-100 text-gray-400"),children:r&&!t?e.jsx(W,{size:14}):n+1}),e.jsx("span",{className:"hidden sm:inline",children:s.label})]}),n<z.length-1&&e.jsx(ue,{size:14,className:"text-muted/30 mx-1"})]},s.id)})}),d==="upload"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-r from-primary/5 to-transparent p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(xe,{size:16,className:"text-primary"}
1),e.jsx("h2",{className:"text-sm font-semibold",children:"Quick Fill from CapitalConnect"}),e.jsx("span",{className:"text-[9px] bg-primary/10 text-primary px-1.5 py-0.5 rounded-full font-medium",children:"Fastest"})]}),e.jsx("p",{className:"text-[11px] text-muted mb-3",children:"Enter investor code to auto-fill personal, bank & identity details from the broker system."}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("div",{className:"w-40",children:e.jsx(v,{label:"Investor Code",value:F,onChange:s=>je(s.target.value),placeholder:"e.g. 002"})}),e.jsx(U,{onClick:ye,loading:P,disabled:!F.trim()||P,icon:P?e.jsx(T,{size:14,className:"animate-spin"}):e.jsx(Ue,{size:14}),size:"sm",children:P?"Fetching...":"Fetch & Fill"})]}),S.length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-1",children:S.map(s=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[9px] bg-success/10 text-success px-1.5 py-0.5 rounded-full font-medium",children:[e.jsx(V,{size:8})," ",s]},s))}),ne&&e.jsxs("p",{className:"mt-2 text-xs text-danger flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",ne]})]}),e.jsxs(j,{children:[e.jsxs("h2",{className:"text-sm font-semibold mb-1 flex items-center gap-2",children:[e.jsx(Le,{size:16,className:"text-primary"}),"Required Documents"]}),e.jsx("p",{className:"text-[11px] text-muted mb-4",children:"Upload clear scans or photos. Documents help speed up verification."}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3",children:L.map(s=>{const n=!!b[s.id],t=ve===s.id,r=Ne===s.id,I=_e[s.id],D=s.icon;return e.jsxs("label",{className:N("relative flex flex-col items-center justify-center rounded-xl border-2 border-dashed p-4 cursor-pointer transition-all text-center min-h-[140px]",n?"border-success/30 bg-success/5":"border-border hover:border-primary/40 hover:bg-primary/5",t&&"opacity-60 pointer-events-none"),children:[e.jsx("input",{type:"file",accept:s.accept,className:"hidden",onChange:q=>{const B=q.target.files?.[0];B&&ke(s.id,B),q.target.value=""}}),I?e.jsx("img",{src:I,alt:s.label,className:"w-12 h-12 object-cover rounded-lg mb-2 ring-1 ring-border"}):n?e.jsx("div",{className:"w-12 h-12 rounded-lg bg-success/10 flex items-center justify-center mb-2",children:e.jsx(W,{size:20,className:"text-success"})}):e.jsx(D,{size:24,className:"text-muted mb-2"}),e.jsx("p",{className:"text-[11px] font-semibold leading-tight",children:s.label}),e.jsx("p",{className:"text-[9px] text-muted mt-0.5",children:s.hint}),t&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white/80 rounded-xl",children:e.jsx(T,{size:20,className:"animate-spin text-primary"})}),r&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-white/90 rounded-xl",children:[e.jsx(Oe,{size:18,className:"animate-pulse text-primary mb-1"}),e.jsx("span",{className:"text-[9px] text-primary font-medium",children:"Analyzing..."})]}),n&&!t&&!r&&e.jsx("span",{className:"absolute top-1.5 right-1.5 w-4 h-4 rounded-full bg-success text-white flex items-center justify-center",children:e.jsx(V,{size:10})})]},s.id)})}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-[10px] text-muted",children:[e.jsx(Me,{size:12}),"Accepted: JPG, PNG, PDF (max 10MB)"]}),ce&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 p-2 rounded-lg bg-danger/5 border border-danger/20 text-xs text-danger",children:[e.jsx(Q,{size:14,className:"shrink-0"}),e.jsx("span",{children:ce}),e.jsx("button",{onClick:()=>E(null),className:"ml-auto text-danger/60 hover:text-danger",children:"✕"})]})]})]}),d==="details"&&e.jsxs("div",{className:"space-y-5",children:[S.length>0&&e.jsxs("div",{className:"rounded-lg bg-success/5 border border-success/20 px-3 py-2 flex items-center gap-2 text-xs text-success",children:[e.jsx(xe,{size:14}),e.jsxs("span",{children:[S.length," fields auto-filled from CapitalConnect. Green-highlighted fields were imported — please verify."]})]}),e.jsxs(j,{children:[e.jsxs("h3",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[e.jsx(he,{size:16,className:"text-primary"})," Personal Information"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(p,{label:"Full Name",required:!0,value:a.full_name,field:"Full Name",filled:x,onChange:s=>i({full_name:s.target.value}),placeholder:"As per NID"}),e.jsx(p,{label:"Father's Name",value:a.father_name,field:"Father's Name",filled:x,onChange:s=>i({father_name:s.target.value}),placeholder:"Father's full name"}
1),e.jsx(p,{label:"Mother's Name",value:a.mother_name,field:"Mother's Name",filled:x,onChange:s=>i({mother_name:s.target.value}),placeholder:"Mother's full name"}),e.jsx(p,{label:"Date of Birth",required:!0,type:"date",value:a.date_of_birth,field:"Date of Birth",filled:x,onChange:s=>i({date_of_birth:s.target.value})}),e.jsx(O,{label:"Gender",value:a.gender||"",onChange:s=>i({gender:s}),options:["Male","Female"],highlight:Ie("gender")}),e.jsx(p,{label:"Phone",required:!0,value:a.phone,field:"Phone",filled:x,onChange:s=>i({phone:s.target.value}),placeholder:"01XXXXXXXXX"}),e.jsx(p,{label:"Email",value:a.email,field:"Email",filled:x,onChange:s=>i({email:s.target.value}),placeholder:"[email protected]"}),e.jsx(p,{label:"Nationality",value:a.nationality,field:"Nationality",filled:x,onChange:s=>i({nationality:s.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[e.jsx(p,{label:"Present Address",value:a.present_address,field:"Present Address",filled:x,onChange:s=>i({present_address:s.target.value}),placeholder:"Full present address"}),e.jsx(p,{label:"Permanent Address",value:a.permanent_address,field:"Permanent Address",filled:x,onChange:s=>i({permanent_address:s.target.value}),placeholder:"Same or different"})]})]}),e.jsxs(j,{children:[e.jsxs("h3",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[e.jsx(J,{size:16,className:"text-primary"})," Identity & Bank"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(p,{label:"NID Number",value:a.nid_number,field:"NID Number",filled:x,onChange:s=>i({nid_number:s.target.value}),placeholder:"10 or 17 digit NID"}),e.jsx(v,{label:"TIN Number",value:a.tin_number||"",onChange:s=>i({tin_number:s.target.value}),placeholder:"Tax ID (optional)"}),e.jsx(p,{label:"Bank Account No",value:a.bank_account,field:"Bank Account",filled:x,onChange:s=>i({bank_account:s.target.value}),placeholder:"From cheque leaf"}),e.jsx(v,{label:"Bank Name",value:a.bank_name||"",onChange:s=>i({bank_name:s.target.value}),placeholder:"e.g. Dutch-Bangla Bank"}),e.jsx(v,{label:"Bank Branch",value:a.bank_branch||"",onChange:s=>i({bank_branch:s.target.value}),placeholder:"Branch name"}),e.jsx(p,{label:"BO Account",value:a.bo_account,field:"BO Account",filled:x,onChange:s=>i({bo_account:s.target.value}),placeholder:"16-digit BO ID"})]})]}),e.jsxs(j,{children:[e.jsxs("h3",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Xe,{size:16,className:"text-primary"})," Nominee"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(v,{label:"Nominee Name",value:a.nominee_name||"",onChange:s=>i({nominee_name:s.target.value}),placeholder:"Full name"}),e.jsx(v,{label:"Relation",value:a.nominee_relation||"",onChange:s=>i({nominee_relation:s.target.value}),placeholder:"e.g. Spouse, Son"}),e.jsx(v,{label:"Nominee NID",value:a.nominee_nid||"",onChange:s=>i({nominee_nid:s.target.value}),placeholder:"Nominee's NID"}),e.jsx(v,{label:"Nominee Phone",value:a.nominee_phone||"",onChange:s=>i({nominee_phone:s.target.value}),placeholder:"Phone number"})]})]}),e.jsxs(j,{children:[e.jsxs("h3",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[e.jsx(H,{size:16,className:"text-primary"})," Account Preferences"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(O,{label:"Investor Category",value:a.investor_category||"RB",onChange:s=>i({investor_category:s}),options:[{value:"RB",label:"Retail"},{value:"MB",label:"Margin"},{value:"NRB",label:"Non-Resident"}]}),e.jsx(O,{label:"Account Type",value:a.account_type||"Cash",onChange:s=>i({account_type:s}),options:[{value:"Cash",label:"Cash Account"},{value:"Margin",label:"Margin Account"}]}),e.jsx(O,{label:"Risk Tolerance",value:a.risk_tolerance||"",onChange:s=>i({risk_tolerance:s}),options:[{value:"conservative",label:"Conservative"},{value:"moderate",label:"Moderate"},{value:"aggressive",label:"Aggressive"}]})]})]})]}),d==="review"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs(j,{children:[e.jsxs("h3",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[e.jsx(H,{size:16,className:"text-primary"})," Review Your Application"]}),e.jsxs(M,{title:"Personal",onEdit:()=>h("details"),children:[e.jsx(o,{label:"Full Name",value:a.full_name,required:!0}),e.jsx(o,{label:"Father",value:a.father_name}),e.jsx(o,{label:"Mother",value:a.mother_name}),e.jsx(o,{label:"DOB",value:a.date_of_birth,required:!0}),e.jsx(o,{label:"Gender",value:a.gender}
1),e.jsx(o,{label:"Phone",value:a.phone,required:!0}),e.jsx(o,{label:"Email",value:a.email}),e.jsx(o,{label:"Address",value:a.present_address})]}),e.jsxs(M,{title:"Identity & Bank",onEdit:()=>h("details"),children:[e.jsx(o,{label:"NID",value:a.nid_number}),e.jsx(o,{label:"TIN",value:a.tin_number}),e.jsx(o,{label:"Bank",value:a.bank_name}),e.jsx(o,{label:"Account",value:a.bank_account}),e.jsx(o,{label:"BO",value:a.bo_account})]}),e.jsxs(M,{title:"Nominee",onEdit:()=>h("details"),children:[e.jsx(o,{label:"Name",value:a.nominee_name}),e.jsx(o,{label:"Relation",value:a.nominee_relation}),e.jsx(o,{label:"NID",value:a.nominee_nid})]}),e.jsx(M,{title:"Documents",onEdit:()=>h("upload"),children:e.jsx("div",{className:"flex flex-wrap gap-1.5 col-span-full",children:L.map(s=>e.jsxs("span",{className:N("text-[10px] font-medium px-2 py-1 rounded-full",b[s.id]?"bg-success/10 text-success":"bg-muted/10 text-muted"),children:[b[s.id]?"✓":"—"," ",s.label]},s.id))})})]}),e.jsxs(j,{children:[e.jsxs("h3",{className:"text-sm font-semibold mb-4 flex items-center gap-2",children:[e.jsx(pe,{size:16,className:"text-warning"})," Declaration"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-start gap-3 p-3 bg-surface rounded-xl border border-border cursor-pointer hover:bg-gray-50 transition-colors",children:[e.jsx("input",{type:"checkbox",checked:a.is_pep||!1,onChange:s=>i({is_pep:s.target.checked}),className:"mt-0.5 w-4 h-4 accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium",children:"I am a Politically Exposed Person (PEP)"}),e.jsx("p",{className:"text-[10px] text-muted mt-0.5",children:"Check if you or close family hold a prominent public position"})]})]}),e.jsxs("label",{className:"flex items-start gap-3 p-3 bg-surface rounded-xl border border-border cursor-pointer hover:bg-gray-50 transition-colors",children:[e.jsx("input",{type:"checkbox",checked:a.declaration_signed||!1,onChange:s=>i({declaration_signed:s.target.checked}),className:"mt-0.5 w-4 h-4 accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium",children:"I declare that all information is true and accurate"}),e.jsx("p",{className:"text-[10px] text-muted mt-0.5",children:"I authorize identity verification and consent to AML/CFT screening per applicable regulations."})]})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-border",children:[e.jsx(U,{variant:"ghost",onClick:()=>h(z[R-1]?.id??"upload"),disabled:R===0,icon:e.jsx(Ye,{size:16}),children:"Back"}),d!=="review"?e.jsx(U,{onClick:async()=>{await we(),h(z[R+1].id)},icon:e.jsx(ue,{size:16}),children:"Continue"}):e.jsx(U,{onClick:Se,loading:X,disabled:!me,icon:e.jsx(fe,{size:16}),children:"Submit for Verification"})]}),d==="review"&&!me&&e.jsxs("div",{className:"mt-3 rounded-lg bg-warning/5 border border-warning/20 p-3 text-xs text-warning flex items-start gap-2",children:[e.jsx(pe,{size:14,className:"shrink-0 mt-0.5"}),e.jsxs("div",{children:["Missing required items:",!a.full_name&&e.jsx("span",{className:"ml-1 font-medium",children:"Full Name,"}),!a.phone&&e.jsx("span",{className:"ml-1 font-medium",children:"Phone,"}),!a.date_of_birth&&e.jsx("span",{className:"ml-1 font-medium",children:"Date of Birth,"}),!a.declaration_signed&&e.jsx("span",{className:"ml-1 font-medium",children:"Declaration"})]})]})]})]})})}function p({label:l,value:f,field:d,filled:h,required:C,...w}){const m=h.has(d.toLowerCase());return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"block text-[11px] font-medium text-muted uppercase tracking-wider",children:[l," ",C&&e.jsx("span",{className:"text-danger",children:"*"}),m&&e.jsx("span",{className:"text-success ml-1 normal-case",children:"(imported)"})]}),e.jsx("input",{value:f||"",className:N("w-full rounded-lg border text-sm px-3.5 py-2.5 transition-all","focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/40",m?"border-success/40 bg-success/5":"border-border bg-background text-foreground"),...w})]})}function M({title:l,onEdit:f,children:d}){return e.jsxs("div",{className:"p-4 bg-surface rounded-xl border border-border mb-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"text-xs font-semibold",children:l}),e.jsx("button",{onClick:f,className:"text-[10px] text-primary font-medium hover:underline",children:"Edit"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-4 gap-y-2",children:d})]})}function o({label:l,value:f,required:d}){return e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-muted uppercase tracking-wider",children:l}),e.jsx("p",{className:N("text-xs font-medium",f?"text-foreground":d?"text-danger/60":"text-muted"),children:f||(d?"Required":"—")})]})}export{ss as KycPage};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.