PageSourceSearch

https://www.dibaapp.com/assets/AfricanTierTwoKycPage-Dhbh5DL7.js

js dibaapp.com collected 2026-10-04 06:55:06 UTC 37,883 bytes, 11 lines download raw bytes

1import{r as i,j as e,y as ce,p as de,g as ue,c as w,k as ke,L as _e,M as We}from"./index-D6UrFXqh.js";import{X as me,A as Se}from"./AppShell-DKhCxBd5.js";import{C as Me,U as Fe}from"./upload-Dcfhr79F.js";import{c as Ue}from"./createLucideIcon-DBOTLUhc.js";import{E as Ve}from"./eye-B9Guj7JT.js";import{C as Ge}from"./check-circle-2-BBTiHial.js";import{B as Ke}from"./briefcase-BsIYQ1ce.js";import{W as ze}from"./appContent-Bmmk0ks2.js";import{S as Ce}from"./shield-check-Nz0OL0hG.js";import{A as Ee}from"./arrow-left-DJrC1F0y.js";import{C as Te}from"./check-CZJsqEMY.js";import{A as He}from"./Logo-VUZnl8oB.js";import"./sparkles-DMSCgezF.js";import"./help-circle-DfpDRC0m.js";import"./file-text-DXawlq-x.js";/**
2 * @license lucide-react v0.344.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Je=Ue("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/**
7 * @license lucide-react v0.344.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Pe=Ue("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);function Xe({title:s,onCapture:o,onClose:g}){const l=i.useRef(null),f=i.useRef(null),$=i.useRef(null),[B,I]=i.useState(!1),[U,O]=i.useState(!1),[D,x]=i.useState(""),[v,m]=i.useState(!1),j=i.useRef(!0),N=async c=>{m(!0),x("");try{if(c.size>10*1024*1024)throw new Error("Choose an image smaller than 10 MB.");const p=await createImageBitmap(c),{width:y,height:S}=p;if(p.close(),Math.min(y,S)<200||y*S>25e6)throw new Error("Choose an image at least 200 × 200 pixels and no larger than 25 megapixels.");j.current&&o(c)}catch(p){j.current&&x(p instanceof Error?p.message:"Choose a valid document image.")}finally{j.current&&m(!1)}};i.useEffect(()=>{var c;return j.current=!0,(c=l.current)==null||c.showModal(),()=>{j.current=!1}},[]),i.useEffect(()=>{if(!B)return;let c=!1,p;return O(!1),(async()=>{var S;try{if(!((S=navigator.mediaDevices)!=null&&S.getUserMedia))throw new Error("Camera unavailable");if(p=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"}},audio:!1}),c){p.getTracks().forEach(M=>M.stop());return}f.current&&(f.current.srcObject=p,await f.current.play())}catch{c||x("Unable to open the camera. Allow camera access and try again, or upload a document image.")}})(),()=>{c=!0,p==null||p.getTracks().forEach(S=>S.stop())}},[B]);const R=()=>{if(!f.current||!U||v)return;const c=document.createElement("canvas");c.width=f.current.videoWidth,c.height=f.current.videoHeight;const p=c.getContext("2d");!p||!c.width||!c.height||(p.drawImage(f.current,0,0),m(!0),c.toBlob(y=>{if(j.current){if(m(!1),!y){x("Unable to capture the image. Please try again.");return}N(new File([y],`${s.toLowerCase().replace(/ /g,"-")}.jpg`,{type:"image/jpeg"}))}},"image/jpeg",.92))};return e.jsxs("dialog",{ref:l,onCancel:g,"aria-labelledby":"document-capture-title",className:"w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] max-w-lg overflow-y-auto overscroll-contain rounded-2xl bg-white p-5 text-slate-950 shadow-xl backdrop:bg-slate-950/70",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsx("h2",{id:"document-capture-title",className:"text-lg font-bold",children:s}),e.jsx("button",{type:"button",onClick:g,"aria-label":"Close capture options",className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full",children:e.jsx(me,{className:"h-5 w-5"})})]}),B?e.jsxs(e.Fragment,{children:[e.jsx("video",{ref:f,autoPlay:!0,muted:!0,playsInl
11ine:!0,onLoadedData:()=>O(!0),className:"max-h-[55dvh] w-full rounded-xl bg-slate-950"}),e.jsx("p",{className:"mt-3 text-sm text-slate-500",children:"Keep the entire document in view and make sure the text is clear."}),e.jsx("button",{type:"button",disabled:!U||v,onClick:R,className:"mt-4 w-full rounded-xl bg-primary px-4 py-3 font-bold text-white disabled:opacity-50",children:v?"Capturing…":"Capture document"}),e.jsx("button",{type:"button",onClick:()=>{I(!1),x("")},className:"mt-2 w-full rounded-xl border px-4 py-3 font-semibold",children:"Back to options"})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",onClick:()=>{x(""),I(!0)},className:"flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-3 font-bold text-white",children:[e.jsx(Me,{className:"h-5 w-5"}),"Take photo"]}),e.jsxs("button",{type:"button",onClick:()=>{var c;return(c=$.current)==null?void 0:c.click()},className:"flex w-full items-center justify-center gap-2 rounded-xl border border-slate-200 px-4 py-3 font-semibold",children:[e.jsx(Fe,{className:"h-5 w-5"}),"Upload image"]})]}),e.jsx("input",{ref:$,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:c=>{var y;const p=(y=c.target.files)==null?void 0:y[0];if(p){if(!["image/jpeg","image/png","image/webp"].includes(p.type)){x("Choose a JPG, PNG or WebP image.");return}N(p)}}}),D&&e.jsx("p",{role:"alert",className:"mt-3 text-sm text-red-600",children:D})]})}function Ze(){let s="center",o=0;const g=()=>{s="center",o=0};return{reset:g,update(l){if(l.count!==1||!l.centered||!Number.isFinite(l.turn)||!Number.isFinite(l.blink))return g(),s;const f=l.blink<.25&&Math.abs(l.turn)<.16;return s==="center"?f?++o>=4&&(s="blink",o=0):o=0:s==="blink"&&l.blink>.55?s="open":s==="open"&&(f?++o>=4&&(s="passed"):o=0),s}}}function Qe({onCapture:s,onClose:o}){const g=i.useRef(null),l=i.useRef(null),f=i.useRef(s);f.current=s;const[$,B]=i.useState(0),[I,U]=i.useState("Opening camera and loading the movement check…"),[O,D]=i.useState(""),[x,v]=i.useState(null);return i.useEffect(()=>{var m;(m=g.current)==null||m.showModal()},[]),i.useEffect(()=>{let m=!1,j,N,R,c;const p=Ze(),y=document.createElement("canvas");y.width=480,y.height=360;const S=()=>{clearTimeout(R),clearTimeout(c),N==null||N.terminate(),j==null||j.getTracks().forEach(E=>E.stop())},M=E=>{m||(m=!0,S(),D(E))},Z={center:"Good position. Hold this distance and look straight at the camera with your eyes open.",blink:"Slowly close both eyes, then open them.",open:"Now open your eyes, look straight at the camera and hold still.",passed:"Blink check complete. Capturing…"},L=async()=>{var E;if(!m){if(document.hidden){M("The check was paused. Keep this tab open and try again.");return}if(!l.current||l.current.readyState<2){R=setTimeout(()=>void L(),150);return}try{(E=y.getContext("2d"))==null||E.drawImage(l.current,0,0,y.width,y.height);const T=await createImageBitmap(y);if(m){T.close();return}N==null||N.postMessage({type:"frame",bitmap:T,timestamp:performance.now()},[T])}catch{M("Unable to check the camera image. Please try again.")}}};return(async()=>{var E;D(""),v(null),U("Opening camera and loading the movement check…"),c=setTimeout(()=>M("The camera check took too long. Please try again in good lighting."),9e4);try{if(!((E=navigator.mediaDevices)!=null&&E.getUserMedia))throw new Error("Camera unavailable");if(j=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:640},height:{ideal:480}},audio:!1}),m){S();return}if(!l.current)throw new Error("Camera unavailable");if(l.current.srcObject=j,await l.current.play(),m){S();return}N=new Worker(new URL("/assets/selfie.worker-Bp58kNnL.js",import.meta.url),{type:"module"}),N.onerror=()=>M("Unable to load the movement check. Please try again."),N.onmessage=T=>{if(m)return;if(T.data.type==="error"){M("Unable to run the movement check on this device. Please try again.");return}if(T.data.type==="ready"){clearTimeout(c),c=setTimeout(()=>M("The movement check timed out. Please try again in good lighting."),6e4),v({stage:"center"}),U("Center your face in the camera with your eyes open."),L();return}if(T.data.type!=="sample")return;const Y=p.update(T.data.sample),W=T.data.sample.count===1?T.data.sample.framing:"off-center";v(F=>(F==null?void 0:F.stage)===Y&&F.framing===W?F:{stage:Y,framing:W}),U(T.data.sample.count!==1?"Keep only your face in view.":W==="too-far"?"Move a little closer, slowly. Stop when the prompt changes.":W==="too-close"?"Move back a little, slowly. Stop when the prompt changes.":T.data.sample.centered?Z[Y]:"Move your face into the center of the camera."),Y==="passed"?(clearTimeout(c),y.toBlob(F=>{if(!m){if(!F){M("Unable to save the selfie. Please try again.");return}m=!0,S(),f.current(new File([F],"selfie-camera.jpg",{type:"image/jpeg"}))}},"image/jpeg",.92)):R=setTimeout(()=>void L(),120)},N.postMessage({type:"init"})}catch{M("Unable to open your camera. Allow camera access in your browser and try again.")}})(),()=>{m=!0,S()}},[$]),e.jsxs("dialog",{ref:g,onCancel:o,"aria-labelledby":"selfie-title",className:"w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] max-w-lg overflow-y-auto overscroll-contain rounded-2xl bg-white p-5 text-slate-950 shadow-xl backdrop:bg-slate-950/70",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{id:"selfie-title",className:"text-lg font-bold",children:"Take a live selfie"}),e.jsx("button",{type:"button",onClick:o,"aria-label":"Close selfie camera",className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full",children:e.jsx(me,{className:"h-5 w-5"})})]}
11),e.jsx("video",{ref:l,autoPlay:!0,muted:!0,playsInline:!0,className:"max-h-[50dvh] w-full -scale-x-100 rounded-xl bg-slate-950"}),x&&!O&&e.jsx("div",{className:"mt-4 flex h-14 items-center justify-center gap-3 rounded-xl bg-primary/5 text-primary","aria-hidden":"true",children:x.framing==="too-far"||x.framing==="too-close"?e.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-full border-2 border-dashed border-primary/30",children:e.jsx(Pe,{className:`h-9 w-9 ${x.framing==="too-far"?"selfie-guide-closer":"selfie-guide-farther"}`,strokeWidth:1.75},x.framing)}):x.stage==="blink"||x.stage==="open"?e.jsx("span",{className:x.stage==="blink"?"selfie-guide-blink":"selfie-guide-open",children:e.jsx(Ve,{className:"h-10 w-10",strokeWidth:1.75})},x.stage):x.stage==="passed"?e.jsx(Ge,{className:"h-10 w-10 text-emerald-600"}):e.jsx(Pe,{className:"h-10 w-10 motion-safe:animate-pulse",strokeWidth:1.75})}),e.jsx("p",{role:"status",className:"mt-4 text-center font-semibold",children:O||I}),e.jsx("p",{className:"mt-2 text-center text-sm text-slate-500",children:"Follow the prompts in good lighting. Your selfie is captured automatically after the blink check."}),O&&e.jsx("button",{type:"button",onClick:()=>B(m=>m+1),className:"mt-4 w-full rounded-xl bg-primary px-4 py-3 font-bold text-white",children:"Try again"})]})}const Ae=()=>{const s=new Date;return`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`},H=s=>({"5000_9999":"$5,000 – $9,999","0_4999":"Below $5,000","10000_49999":"$10,000 – $49,999","50000_plus":"$50,000 and above"})[s]??s.replace(/_/g," ").replace(/^./,o=>o.toUpperCase()),z=s=>{const o=Array.isArray(s)?s:s==null?void 0:s.data;if(!Array.isArray(o)||!o.length)throw new Error("Verification options are unavailable. Please try again.");return o.map(g=>typeof g=="string"?{code:g,display_name:H(g)}:g)};async function _(s,o,g=!1){const l=await ce(s,o?{method:"POST",...o instanceof FormData?{body:o}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}}:void 0);if(g&&l.status===404)return{};const f=await de(l);if(!l.ok)throw new Error(ue(f,l.status,{fallback:"Unable to save verification details. Please try again."}));return f}async function et(){const[s,o,g,l,f,$,B,I,U,O]=await Promise.all([_(w.tierTwoOptions),_(w.occupations),_(w.accountPurposes),_(w.sourcesOfFunds),_(w.expectedMonthlyPayments),_(w.supportedCountries),_(w.tierTwoIdentity,void 0,!0),_(w.tierTwoEmployment,void 0,!0),_(w.tierTwoSelfie,void 0,!0),_(w.kycStatus+"?flow=tier2")]);return{documentTypes:z(s.document_types),employmentStatuses:z(s.employment_statuses),industries:z(s.industries),occupations:z(o),accountPurposes:z(g),sourceOfFundsOptions:z(l),inflowRanges:z(f),countries:$.data,identity:B,employment:I,selfie:U,status:O}}function Ie(s,o=!1){return o?{account_purpose_code:s.accountPurpose,account_purpose_other:s.accountPurpose==="other"?s.accountPurposeOther.trim():"",expected_monthly_amount_code:s.expectedMonthlyInflow,acting_as_intermediary:s.actingAsIntermediary==="yes"}:{employment_status_code:s.employmentStatus,occupation_code:s.occupation,employer_name:s.employerName.trim(),industry:s.industry,source_of_funds_code:s.sourceOfFunds}}const le="diba-bridge-tos-accepted",Oe="diba_bridge_tos_accepted_at",C="mt-2 min-w-0 w-full max-w-full rounded-xl border border-slate-200 bg-white px-4 py-3 text-base sm:text-sm text-slate-950 outline-none transition focus:border-primary focus:ring-4 focus:ring-primary/10 dark:border-slate-700 dark:bg-slate-950 dark:text-white",tt=()=>{var we,ve,je,Ne;const s=ke(),[o,g]=i.useState(null),[l,f]=i.useState(!0),[$,B]=i.useState(0),[I,U]=i.useState(!1),O=i.useRef(!1),[D,x]=i.useState(null),[v,m]=i.useState({}),[j,N]=i.useState(!1),{documentTypes:R=[],employmentStatuses:c=[],industries:p=[],sourceOfFundsOptions:y=[],accountPurposes:S=[],inflowRanges:M=[],occupations:Z=[],countries:L=[]}=o??{},[h,E]=i.useState(1),[T,Y]=i.useState(!1),[W,F]=i.useState(null),[pe,k]=i.useState(""),[J,K]=i.useState(!1),[b,De]=i.useState(null),[Q,he]=i.useState(!1),[fe,xe]=i.useState(!1),[te,Re]=i.useState(((we=s==null?void 0:s.user)==null?void 0:we.is_agreement_signed)===!0),[ae,se]=i.useState(""),[A,ne]=i.useState({documentFront:null,documentBack:null,selfie:null}),[ge,Be]=i.useState({});i.useEffect(()=>{const t={};for(const n of["documentFront","documentBack","selfie"]){const r=A[n];r&&(t[n]=URL.createObjectURL(r))}return Be(t),()=>{Object.values(t).forEach(n=>URL.revokeObjectURL(n))}},[A]);const[a,ee]=i.useState({documentType:"",issuingCountry:"",nationality:"",documentNumber:"",expirationDate:"",additionalNationalities:[],employmentStatus:"",occupation:"",employerName:"",industry:"",sourceOfFunds:"",accountPurpose:"",accountPurposeOther:"",expectedMonthlyInflow:"",actingAsIntermediary:""});i.useEffect(()=>{let t=!1;return f(!0),et().then(n=>{if(t)return;g(n),m(n.identity),N(!!n.selfie.has_selfie),n.identity.has_front&&["pending","approved"].includes(n.status.status)&&x(n.status.status==="approved"?"active":"under_review");const r=n.identity,d=n.employment;ee(G=>
11({...G,documentType:r.document_type??"",issuingCountry:r.issuing_country??"",nationality:r.nationality??"",expirationDate:r.expiration_date??"",additionalNationalities:(r.nationalities??[]).filter(oe=>oe!==r.nationality),employmentStatus:String(d.employment_status_code??""),occupation:String(d.occupation_code??""),employerName:String(d.employer_name??""),industry:String(d.industry??""),sourceOfFunds:String(d.source_of_funds_code??""),accountPurpose:String(d.account_purpose_code??""),accountPurposeOther:String(d.account_purpose_other??""),expectedMonthlyInflow:String(d.expected_monthly_amount_code??""),actingAsIntermediary:d.acting_as_intermediary===!0?"yes":d.acting_as_intermediary===!1?"no":""}));const u=n.documentTypes.find(G=>G.code===r.document_type);if(u&&r.has_front&&r.has_number&&r.nationality&&n.selfie.has_selfie&&(r.document_type==="passport"||r.has_back)&&r.issuing_country&&(!u.issuing_countries||u.issuing_countries.includes(r.issuing_country))&&(u.requires_expiration_date===!1||r.expiration_date&&r.expiration_date>Ae())){const G=["employment_status_code","occupation_code","industry","source_of_funds_code"].every(oe=>!!d[oe]);E(G?3:2)}}).catch(n=>{t||k(n.message)}).finally(()=>{t||f(!1)}),()=>{t=!0}},[$]);const re=a.documentType!=="passport",q=R.find(t=>t.code===a.documentType),X=(q==null?void 0:q.requires_expiration_date)!==!1,ye=L.filter(t=>!(q!=null&&q.issuing_countries)||q.issuing_countries.includes(t.alpha3)),Le=`${h/3*100}%`,qe=i.useMemo(()=>[{number:1,title:"Identity document",icon:Je},{number:2,title:"Employment and funding",icon:Ke},{number:3,title:"Expected activity",icon:ze}],[]);i.useEffect(()=>{const t=()=>{Re(!0),se(""),k("");const u=ke();u!=null&&u.user&&!u.user.is_agreement_signed&&We(V=>({...V,user:{...V.user,is_agreement_signed:!0}}))},n=u=>{var V;u.origin===window.location.origin&&((V=u.data)==null?void 0:V.type)===le&&t()},r=u=>{u.key===Oe&&u.newValue&&t()};window.addEventListener("message",n),window.addEventListener("storage",r);const d=new URLSearchParams(window.location.search).get("signed_agreement_id");return d&&(xe(!0),ce(w.saveBridgeAgreement,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({signed_agreement_id:d})}).then(async u=>{var G;const V=await de(u);if(!u.ok)throw new Error(ue(V,u.status,{fallback:"Unable to save your agreement. Please try again."}));t(),localStorage.setItem(Oe,Date.now().toString()),(G=window.opener)==null||G.postMessage({type:le},window.location.origin),window.parent!==window&&window.parent.postMessage({type:le},window.location.origin),window.history.replaceState({},"",window.location.pathname),window.opener&&window.close()}).catch(u=>k(u instanceof Error?u.message:"Unable to save your agreement. Please try again.")).finally(()=>xe(!1))),()=>{window.removeEventListener("message",n),window.removeEventListener("storage",r)}},[]);const P=(t,n)=>{if(t==="documentType"||t==="issuingCountry"){m({}),ne(d=>({...d,documentFront:null,documentBack:null}));const r=t==="documentType"?R.find(d=>d.code===n):q;ee(d=>({...d,documentNumber:"",[t]:n,...t==="documentType"?{expirationDate:"",issuingCountry:r!=null&&r.issuing_countries&&!r.issuing_countries.includes(d.issuingCountry)?"":d.issuingCountry}:{}}))}else ee(r=>({...r,[t]:n}));k(""),K(!1)},be=()=>{if(h===1&&(!q||!a.issuingCountry||!ye.some(t=>t.alpha3===a.issuingCountry)||!a.nationality||!a.documentNumber.trim()&&!v.has_number||X&&!a.expirationDate||!A.documentFront&&!v.has_front||!A.selfie&&!j||re&&!A.documentBack&&!v.has_back))return k("Complete all required identity-document fields and uploads."),!1;if(h===1&&X&&a.expirationDate<=Ae())return k("Use an unexpired identity document."),!1;if(h===2){if(!a.employmentStatus||!a.occupation||!a.industry||!a.sourceOfFunds)return k("Complete all required employment and funding fields."),!1;if(["employed","self_employed"].includes(a.employmentStatus)&&!a.employerName.trim())return k("Enter your employer or business name."),!1}return h===3&&(!a.accountPurpose||!a.expectedMonthlyInflow||!a.actingAsIntermediary||a.accountPurpose==="other"&&!a.accountPurposeOther.trim())?(k("Complete the expected account activity fields."),!1):!0},$e=async()=>
11{if(!(O.current||!be())){O.current=!0,U(!0),k("");try{if(h===1){const t=new FormData;t.set("document_type",a.documentType),t.set("issuing_country",a.issuingCountry),t.set("nationality",a.nationality),[...new Set([a.nationality,...a.additionalNationalities])].forEach(r=>t.append("nationalities",r)),X&&t.set("expiration_date",a.expirationDate),a.documentNumber&&t.set("document_number",a.documentNumber.trim()),A.documentFront&&t.set("photo_one_file",A.documentFront),re&&A.documentBack&&t.set("photo_two_file",A.documentBack);const n=await _(w.tierTwoIdentity,t);if(m(n),A.selfie){const r=new FormData;r.set("selfie_file",A.selfie),r.set("capture_method","camera_blink_turn"),await _(w.tierTwoSelfie,r),N(!0)}}else if(h===2)await _(w.tierTwoEmployment,Ie(a));else if(!J)await _(w.tierTwoEmployment,Ie(a,!0)),De(await _(w.tierTwoReview));else if(te){const t=await _(w.bridgeCustomerCreate,{flow:"tier2"});if(!t.id)throw new Error("The verification service returned an incomplete response. Please retry.");x(t.status??"under_review")}h<3?E(h+1):K(!0),window.scrollTo({top:0,behavior:"smooth"})}catch(t){k(t instanceof Error?t.message:"Unable to save. Please try again.")}finally{O.current=!1,U(!1)}}},Ye=async()=>{if(be()){he(!0),k("");try{const t=await ce(w.bridgeTosLink,{method:"POST"}),n=await de(t);if(!t.ok)throw new Error(ue(n,t.status,{fallback:"Unable to open the required terms. Please try again."}));const r=n&&typeof n=="object"?n.url:null;if(typeof r!="string")throw new Error("The terms link returned by the server was invalid.");const d=new URL(r),u=new URL("/dashboard/kyc/africa/tier-2",window.location.origin);d.searchParams.set("redirect_uri",u.toString()),se(d.toString())}catch(t){k(t instanceof Error?t.message:"Unable to open the required terms. Please try again.")}finally{he(!1)}}},ie=({field:t,title:n,description:r,capture:d})=>{var u;return e.jsx("button",{type:"button",onClick:()=>{t!=="selfie"?F(t):Y(!0)},className:"group block w-full text-left cursor-pointer rounded-2xl border border-dashed border-slate-300 bg-slate-50 p-4 transition hover:border-primary hover:bg-primary/5 dark:border-slate-700 dark:bg-slate-950/60",children:e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-white text-primary shadow-sm dark:bg-slate-900",children:A[t]||(t==="selfie"?j:t==="documentFront"?v.has_front:v.has_back)?e.jsx(Te,{className:"h-5 w-5 text-emerald-600"}):d?e.jsx(Me,{className:"h-5 w-5"}):e.jsx(Fe,{className:"h-5 w-5"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-bold text-slate-900 dark:text-white",children:n}),e.jsx("span",{className:"mt-0.5 block truncate text-xs text-slate-500 dark:text-slate-400",children:((u=A[t])==null?void 0:u.name)??((t==="selfie"?j:t==="documentFront"?v.has_front:v.has_back)?"Saved securely":r)})]}),ge[t]&&e.jsx("img",{src:ge[t],alt:`${n} preview`,className:"h-12 w-12 shrink-0 rounded-lg border border-slate-200 bg-white object-contain dark:border-slate-700 dark:bg-slate-900"})]})})};return D?e.jsx(Se,{children:e.jsxs("section",{className:"mx-auto max-w-xl rounded-2xl bg-white p-8 dark:bg-slate-900",children:[e.jsx(Ce,{className:"h-12 w-12 text-primary"}),e.jsx("h1",{className:"mt-4 text-2xl font-bold",children:D==="active"?"Verification approved":"Verification submitted"}),e.jsx("p",{className:"mt-3 text-slate-500",children:D==="active"?"Your international account verification is complete.":"Your information has been submitted. Check your verification status for updates or any additional requirements."}),e.jsxs("p",{className:"mt-3 text-sm",children:["Status: ",H(D)]}),e.jsx(_e,{to:"/dashboard/kyc/complete?flow=tier2",className:"mt-6 inline-flex rounded-xl bg-primary px-5 py-3 font-bold text-white",children:"View verification status"})]})}):e.jsxs(Se,{children:[e.jsxs("div",{className:"mx-auto max-w-4xl space-y-5 sm:space-y-6",children:[e.jsxs(_e,{to:"/dashboard/kyc",className:"inline-flex items-center gap-2 text-sm font-semibold text-slate-500 transition hover:text-primary",children:[e.jsx(Ee,{className:"h-4 w-4"})," Back to KYC options"]}),e.jsxs("section",{className:"overflow-hidden rounded-3xl border border-slate-200 bg-white shadow-sm dark:border-slate-800 dark:bg-slate-900",children:[e.jsx("div",{className:"bg-gradient-to-r from-slate-950 via-indigo-950 to-primary px-5 py-6 text-white sm:px-8 sm:py-8",children:e.jsxs("div",{className:"flex flex-col items-start gap-4 sm:flex-row",children:[e.jsx("span",{className:"inline-flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-white/10 ring-1 ring-white/15",children:e.jsx(Ce,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.14em] text-indigo-200",children:"African KYC 
11· Tier 2"}),e.jsx("h1",{className:"mt-2 text-2xl font-black sm:text-3xl",children:"International account verification"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-indigo-100",children:"Tell us about your identity, work and expected account activity. You can review everything before anything is submitted."})]})]})}),e.jsxs("div",{className:"p-5 sm:p-8",children:[e.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-slate-100 dark:bg-slate-800",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300",style:{width:Le}})}),e.jsx("div",{className:"mt-4 grid grid-cols-3 gap-2",children:qe.map(t=>e.jsxs("button",{type:"button",disabled:I,onClick:()=>{t.number<h&&(E(t.number),K(!1))},className:`flex min-w-0 flex-col items-center gap-2 rounded-xl px-2 py-2 text-center sm:flex-row sm:text-left ${h===t.number?"bg-primary/10 text-primary":t.number<h?"text-emerald-600":"text-slate-400"}`,children:[e.jsx("span",{className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-black ${h===t.number?"bg-primary text-white":t.number<h?"bg-emerald-100 text-emerald-700":"bg-slate-100 dark:bg-slate-800"}`,children:t.number<h?e.jsx(Te,{className:"h-4 w-4"}):t.number}),e.jsx("span",{className:"hidden text-xs font-bold sm:block",children:t.title})]},t.number))}),l&&e.jsx("p",{role:"status",className:"mt-5 text-sm",children:"Loading your saved verification details…"}),!l&&!o&&e.jsx("button",{type:"button",onClick:()=>{k(""),B(t=>t+1)},className:"mt-4 text-primary font-bold",children:"Retry loading"}),pe&&e.jsx("p",{className:"mt-5 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm font-semibold text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300",children:pe}),e.jsxs("fieldset",{disabled:I||l||!o,className:"mt-7 min-w-0",children:[h===1&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-black text-slate-950 dark:text-white",children:"Identity document"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500 dark:text-slate-400",children:"Use a valid, unexpired government-issued document."})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Document type",e.jsxs("select",{value:a.documentType,onChange:t=>P("documentType",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select document type"}),R.map(t=>e.jsx("option",{value:t.code,children:t.display_name},t.code))]})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Issuing country",e.jsxs("select",{value:a.issuingCountry,onChange:t=>P("issuingCountry",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select issuing country"}),ye.map(t=>e.jsx("option",{value:t.alpha3,children:t.name},t.alpha3))]})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Nationality",e.jsxs("select",{value:a.nationality,onChange:t=>P("nationality",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select nationality"}),L.map(t=>e.jsx("option",{value:t.alpha3,children:t.name},t.alpha3))]})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Additional nationalities (optional)",e.jsx("select",{multiple:!0,value:a.additionalNationalities,onChange:t=>{ee(n=>({...n,additionalNationalities:Array.from(t.target.selectedOptions,r=>r.value)})),K(!1)},className:C,"aria-describedby":"nationalities-help",children:L.filter(t=>t.alpha3!==a.nationality).map(t=>e.jsx("option",{value:t.alpha3,children:t.name},t.alpha3))}),e.jsx("span",{id:"nationalities-help",className:"mt-1 block text-xs font-normal text-slate-500",children:"Include every nationality you hold. Leave blank if you hold only the nationality selected above."})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Document number",e.jsx("input",{value:a.documentNumber,onChange:t=>P("documentNumber",t.target.value),maxLength:100,placeholder:v.has_number?"Saved securely · enter only to replace":"Enter document number",className:C})]}),X?e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Expiration date",e.jsx("input",{type:"date",value:a.expirationDate,onChange:t=>P("expirationDate",t.target.value),className:C})]}):e.jsx("p",{className:"self-center text-sm text-slate-500",children:"No expiration date is required for this document."})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(ie,{field:"documentFront",title:"Document front",description:"Take a photo or upload an image",capture:"environment"}),re&&e.jsx(ie,{field:"documentBack",title:"Document back",description:"Take a photo or upload an image",capture:"environment"}),e.jsx(ie,{field:"selfie",title:"Selfie",description:"Camera only · blink check",capture:"user"})]}),e.jsx("p",{className:"rounded-xl bg-amber-50 px-4 py-3 text-xs leading-5 text-amber-800 dark:bg-amber-950/30 dark:text-amber-200",children:"Your images are saved securely when you continue and submitted for verification after your final confirmation."})]}),h===2&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-black text-slate-950 dar
11k:text-white",children:"Employment and funding"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500 dark:text-slate-400",children:"Help us understand how you earn and fund your account."})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Employment status",e.jsxs("select",{value:a.employmentStatus,onChange:t=>P("employmentStatus",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select status"}),c.map(t=>e.jsx("option",{value:t.code,children:t.display_name},t.code))]})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Occupation",e.jsxs("select",{value:a.occupation,onChange:t=>P("occupation",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select occupation"}),Z.map(t=>e.jsx("option",{value:t.code,children:t.display_name},t.code))]})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Employer or business name",!["employed","self_employed"].includes(a.employmentStatus)&&e.jsx("span",{className:"font-normal text-slate-400",children:" (Optional)"}),e.jsx("input",{value:a.employerName,onChange:t=>P("employerName",t.target.value),placeholder:"Enter name",className:C})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Industry",e.jsxs("select",{value:a.industry,onChange:t=>P("industry",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select industry"}),p.map(t=>e.jsx("option",{value:t.code,children:t.display_name},t.code))]})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Source of funds",e.jsxs("select",{value:a.sourceOfFunds,onChange:t=>P("sourceOfFunds",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select source"}),y.map(t=>e.jsx("option",{value:t.code,children:t.display_name},t.code))]})]})]})]}),h===3&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-black text-slate-950 dark:text-white",children:"Expected account activity"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500 dark:text-slate-400",children:"Tell us how you expect to use your international account."})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Purpose of account",e.jsxs("select",{value:a.accountPurpose,onChange:t=>P("accountPurpose",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select purpose"}),S.map(t=>e.jsx("option",{value:t.code,children:t.display_name},t.code))]})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Expected monthly payments (sent or received)",e.jsxs("select",{value:a.expectedMonthlyInflow,onChange:t=>P("expectedMonthlyInflow",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select range"}),M.map(t=>e.jsx("option",{value:t.code,children:t.display_name},t.code))]})]}),a.accountPurpose==="other"&&e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Describe your account purpose",e.jsx("input",{value:a.accountPurposeOther,maxLength:500,onChange:t=>P("accountPurposeOther",t.target.value),className:C})]}),e.jsxs("label",{className:"min-w-0 text-sm font-semibold",children:["Will you act as an intermediary for someone else?",e.jsxs("select",{value:a.actingAsIntermediary,onChange:t=>P("actingAsIntermediary",t.target.value),className:C,children:[e.jsx("option",{value:"",children:"Select an option"}),e.jsx("option",{value:"no",children:"No, I am using my own account"}),e.jsx("option",{value:"yes",children:"Yes"})]})]})]}),J&&e.jsxs("div",{className:"rounded-2xl border border-indigo-200 bg-indigo-50 p-5 dark:border-indigo-900 dark:bg-indigo-950/30",children:[e.jsx("h3",{className:"font-bold",children:"Review your information"}),e.jsx("dl",{className:"mt-3 grid gap-3 text-sm sm:grid-cols-2",children:[["Legal name",b?[b.first_name,b.middle_name,b.last_name].filter(Boolean).join(" "):""],["Date of birth",b==null?void 0:b.birth_date],["Email",b==null?void 0:b.email],["Phone",b==null?void 0:b.phone],["Residential address",b?Object.values(b.residential_address).filter(
11Boolean).join(", "):""],["Document",(ve=R.find(t=>t.code===a.documentType))==null?void 0:ve.display_name],["Issuing country",(je=L.find(t=>t.alpha3===a.issuingCountry))==null?void 0:je.name],["Nationalities",((b==null?void 0:b.nationalities)??[a.nationality]).map(t=>{var n;return((n=L.find(r=>r.alpha3===t))==null?void 0:n.name)??t}).join(", ")],["Expiry date",X?a.expirationDate:"Not required"],["Employment",H(a.employmentStatus)],["Occupation",(Ne=Z.find(t=>t.code===a.occupation))==null?void 0:Ne.display_name],["Employer",a.employerName||"Not applicable"],["Industry",H(a.industry)],["Source of funds",H(a.sourceOfFunds)],["Account purpose",a.accountPurpose==="other"?a.accountPurposeOther:H(a.accountPurpose)],["Monthly payments",H(a.expectedMonthlyInflow)],["Acting as intermediary",a.actingAsIntermediary]].map(([t,n])=>e.jsxs("div",{className:"min-w-0 [overflow-wrap:anywhere]",children:[e.jsx("dt",{className:"text-slate-500",children:t}),e.jsx("dd",{className:"font-semibold",children:n})]},t))}),e.jsx("p",{className:"mt-4 text-xs",children:"These are your saved profile and residential details. Use Back to change the verification form. If your profile or verified address is incorrect, correct it through your profile or contact support before submitting."})]})]})]}),e.jsxs("div",{className:"mt-8 flex flex-col-reverse gap-3 border-t border-slate-100 pt-5 dark:border-slate-800 sm:flex-row sm:justify-between",children:[e.jsxs("button",{type:"button",disabled:I,onClick:()=>{K(!1),h>1?E(h-1):history.back()},className:"inline-flex min-h-12 items-center justify-center gap-2 rounded-xl border border-slate-200 px-5 text-sm font-bold text-slate-600 dark:border-slate-700 dark:text-slate-300",children:[e.jsx(Ee,{className:"h-4 w-4"})," Back"]}),e.jsxs("button",{type:"button",disabled:I||l||!o||Q||fe,onClick:h===3&&J&&!te?Ye:$e,className:"inline-flex min-h-12 items-center justify-center gap-2 rounded-xl bg-primary px-6 text-sm font-bold text-white shadow-lg shadow-primary/20 disabled:cursor-not-allowed disabled:opacity-60",children:[I?"Saving…":fe?"Saving agreement…":Q?"Opening terms…":h===3?J&&te?"Submit for verification":J?"Accept terms and continue":"Review information":"Save and continue"," ",e.jsx(He,{className:"h-4 w-4"})]})]})]})]})]}),T&&e.jsx(Qe,{onClose:()=>Y(!1),onCapture:t=>{ne(n=>({...n,selfie:t})),Y(!1),k(""),K(!1)}}),W&&e.jsx(Xe,{title:W==="documentFront"?"Document front":"Document back",onClose:()=>F(null),onCapture:t=>{ne(n=>({...n,[W]:t})),F(null),k(""),K(!1)}}),(Q||ae)&&e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-slate-950/80 p-0 backdrop-blur-sm sm:p-5",role:"dialog","aria-modal":"true","aria-label":"Required terms of service",children:e.jsxs("div",{className:"flex h-[100dvh] w-full flex-col overflow-hidden bg-white shadow-2xl dark:bg-slate-950 sm:h-[min(860px,94dvh)] sm:max-w-3xl sm:rounded-2xl sm:border sm:border-slate-200 sm:dark:border-slate-700",children:[e.jsxs("div",{className:"flex min-h-16 items-center justify-between gap-3 border-b border-slate-200 bg-white px-4 pb-3 pt-[max(0.75rem,env(safe-area-inset-top))] dark:border-slate-800 dark:bg-slate-950 sm:min-h-0 sm:px-5 sm:py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"truncate font-bold text-slate-950 dark:text-white",children:"Terms of service"}),e.jsx("p",{className:"mt-0.5 text-xs leading-5 text-slate-500 dark:text-slate-400",children:"Accept the required terms to continue Tier 2 verification."})]}),e.jsx("button",{type:"button",onClick:()=>se(""),disabled:Q,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 transition hover:bg-slate-100 disabled:opacity-50 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300 dark:hover:bg-slate-800","aria-label":"Close terms",children:e.jsx(me,{className:"h-5 w-5"})})]}),ae?e.jsx("iframe",{src:ae,title:"Terms of service",className:"min-h-0 w-full flex-1 border-0 bg-white pb-[env(safe-area-inset-bottom)]",allow:"clipboard-write"}):e.jsxs("div",{className:"flex flex-1 items-center justify-center gap-3 bg-white px-4 text-center text-sm font-semibold text-slate-600 dar
11k:bg-slate-950 dark:text-slate-300",children:[e.jsx("span",{className:"h-5 w-5 shrink-0 animate-spin rounded-full border-2 border-primary/25 border-t-primary"})," Opening terms…"]})]})})]})},gt=()=>e.jsx(tt,{});export{gt as default};

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.