PageSourceSearch

https://myka.ng/assets/GadgetPolicyActivationPage-BxC9f6Uj.js

js myka.ng collected 2026-10-09 22:42:34 UTC 14,426 bytes, 1 lines download raw bytes

1import{j as e,r as b,p as te,u as ie,N as oe}from"./vendor-react-DfYGAhtm.js";import{d as re,bn as $,P as se}from"./vendor-icons-1odZwi-b.js";import{m as t,C as ne,e as ae,$ as C,a0 as le,x as ce,b as de,g as M,t as w}from"./index-DsBgCU7r.js";import"./missedContributionRetry-D0dCo6_S.js";import{g as pe}from"./healthCategoryUi-C2_keODf.js";import{u as me}from"./policiesApi-DYBxVdNQ.js";import{c as ue}from"./webToWebInspection-BgWNZmY_.js";import{u as xe}from"./gadgetPolicyApi-C0LGK2Xi.js";import{F as j,a as d,o as L,H as F,T as c,V as g,v as T,s as f}from"./vendor-ui-DA_r9yXk.js";import{m as ge}from"./Myka_QRCode-mHFr64Nb.js";import{M as H}from"./Modal-DS-VW05m.js";import{g as B,h as he}from"./vendor-state-BsBVN-fX.js";import{g as z}from"./errors-BYKXB8DF.js";import{N as fe}from"./NinVerificationPanel-Cl3L-HVS.js";import{a as be}from"./PolicySummaryCard-CiBcvnsY.js";import{v as ye}from"./valid-11xrBmDj.js";import{v as je}from"./verification_mark-CJRfnqWz.js";import{i as Se}from"./gadgetInspectionFromPolicy-BWnWyYwv.js";import{G as ve}from"./gadgetPostPaymentFlowConfig-ChCU4qBA.js";import{G as we}from"./routes-CNOe4p0Z.js";import{E as Ae}from"./EmailVerificationModal-BxNiYJiq.js";import{h as Ce}from"./userEmail-9DwyWHBc.js";import{i as Ne}from"./device-DbCxnG1h.js";import"./vendor-forms-BP-7CbAP.js";import"./other-icon-DC1bN4dP.js";import"./savings-BJUwUGln.js";import"./routes-BR5I3bEX.js";import"./annuity-retirement-C1dZ1QHM.js";import"./health-ped-DAki1cTK.js";import"./professional-indemnity-Cx_HID73.js";import"./property-building-content-BPs_xKUv.js";import"./property-business-assets-DHEXMjWx.js";import"./property-home-content-BS-RQEdB.js";import"./savings-specialized-hA4moY7S.js";import"./savings-targeted-goals-BG697KhM.js";import"./useApiQuery-mQnoCtpJ.js";import"./api-BEJchXjA.js";import"./deviceBrandIcons-BuVSPKZ7.js";import"./deviceBrandLogos-CnwfDF74.js";import"./currency-tq8RhIEU.js";const A=[{id:"nin",label:"NIN Verification",description:"Confirm your identity with your National Identification Number (NIN) to proceed.",icon:ye},{id:"email_verification",label:"Email Verification",description:"Verify your email address so we can send your policy documents and updates.",icon:je},{id:"gadget_inspection",label:"Gadget Inspection",description:"Complete a short inspection of your device by scanning a QR code with a second phone.",icon:pe}],Ie={nin:o=>o.kycApproved?"passed":"pending",email_verification:o=>o.hasVerifiedEmail?"passed":"pending",gadget_inspection:o=>o.policyStatus==="ACTIVE"||o.inspectionDoneOnMobile?"passed":"pending"},ke=(o,{currentStatus:p,context:n})=>p==="passed"?"passed":Ie[o](n),Pe=({label:o,description:p,icon:n,status:a,onClick:u})=>{const r=a==="passed";return e.jsxs(j,{align:"center",gap:4,border:"1px solid",borderColor:r?t.success[200]:t.border.primary,borderRadius:"2xl",p:{base:4,md:5},bg:r?t.success[50]:"white",cursor:r?"default":"pointer",onClick:r?void 0:u,transition:"all 0.2s ease",_hover:r?{}:{borderColor:t.orange[300],bg:t.orange[50]},children:[e.jsx(d,{flexShrink:0,w:{base:"52px",md:"60px"},h:{base:"52px",md:"60px"},borderRadius:"xl",bg:r?t.success[100]:t.gray[50],border:"1px solid",borderColor:r?t.success[200]:t.border.primary,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",p:2,children:e.jsx(L,{src:n,alt:o,w:"100%",h:"100%",objectFit:"contain"})}),e.jsxs(d,{flex:1,minW:0,children:[e.jsxs(F,{gap:2,mb:1,flexWrap:"wrap",children:[e.jsx(c,{fontSize:{base:"sm",md:"md"},fontWeight:"semibold",color:r?t.success[700]:t.text.primary,children:o}),e.jsx(d,{px:2,py:.5,borderRadius:"full",bg:r?t.success[100]:t.orange[100],border:"1px solid",borderColor:r?t.success[300]:t.orange[300],children:e.jsx(c,{fontSize:"2xs",fontWeight:"bold",color:r?t.success[700]:t.text.orange,textTransform:"uppercase",letterSpacing:"wider",children:r?"Passed":"Pending"})})]}),e.jsx(c,{fontSize:{base:"xs",md:"sm"},color:t.text.gray,lineHeight:"1.5",overflow:"hidden",style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:p})]}),!r&&e.jsx(d,{flexShrink:0,w:"36px",h:"36px",borderRadius:"full",bg:t.orange[500],display:"flex",alignItems:"center",justifyContent:"center",children:e.jsx(re,{size:20,color:"white"})})]})},Ee=({open:o,onClose:p,deviceSummary:n})=>{const a=b.useRef(null);return e.jsx(H,{open:o,onClose:p,showCloseButton:!1,size:"xl",contentProps:{borderRadius:"28px",maxW:"min(92vw, 720px)",px:{base:6,md:10},py:{base:8,md:10},w:"full"},initialFocusEl:()=>a.current,children:e.jsx(g,{gap:{base:7,md:8},align:"stretch",children:e.jsxs(g,{align:"center",gap:{base:5,md:6},children:[e.jsxs(g,{gap:3,children:[e.jsx(d,{borderWidth:"2px",borderColor:"orange.500",borderRadius:"20px",bg:"white",p:{base:"10px",md:"12px"},lineHeight:0,boxShadow:"sm",children:e.jsx(L,{src:ge,alt:"Scan to open Myka",boxSize:{base:"200px",md:"220px"},display:"block"})}),e.jsx(c,{fontSize:{base:"sm",md:"md"},fontWeight:"semibold",color:"gray.600",textAlign:"center",children:"Scan to open Myka"})]}),e.jsxs(g,{align:"center",gap:2,children:[e.jsx(c,{fontSize:{base:"2xl",md:"3xl"},fontWeight:"bold",textAlign:"center",color:t.text.primary,lineHeight:"short",children:"Continue on the device you’re insuring"}),e.jsx(c,{fontSize:{base:"sm",md:"md"},textAlign:"center",color:t.text.gray,maxW:"480px",children:"Scan this code with the phone you want to insure and log in there to start the inspection — the inspection has to run on the actual device."}),n?e.jsx(Re,{deviceSummary:n}):null]})]})})})},Re=({deviceSummary:o})=>e.jsxs(F,{gap:2,px:3,py:1.5,borderRadius:"full",bg:t.gray[50],border:"1px solid",borderColor:t.border.primary,maxW:"100%",children:[e.jsx(T,{as:$,boxSize:4,color:t.navy[400]}),e.jsx(c,{fontSize:"xs",fontWeight:"medium",color:t.text.label,lineClamp:1,children:o})]}),We=async o=>(await ae.post("/api/v1/compliance/kyc/",o)).data,Me=()=>{const o=B(),{mutateAsync:p,isPending:n,isError:a,error:u}=he({mutationKey:["gadget","compliance","kyc"],mutationFn:We,onSuccess:()=>{o.invalidateQueries({queryKey:ne})}});return{verifyKycAsync:p,isLoading:n,isError:a,error:u}},Te=({open:o,onClose:p,onPassed:n})=>{const a=B(),u=C(l=>l?.email??""),r=C(l=>l?.kyc),S=C(l=>l?.kycApproved??!1),{verifyKycAsync:P}=Me(),[N,x]=b.useState(!1),m=b.useMemo(()=>!r||!S?null:{fullName:[r.firstName,r.middleName,r.lastName].filter(
1Boolean).join(" ").trim()||"N/A",nin:r.documentNo??"N/A",email:u||"N/A",phoneNumber:r.phoneNumber??"N/A"},[r,S,u]),E=async l=>{const y=await P({documentType:"NIN",documentNumber:l});if(y.success===!1)throw new Error(y.message?.trim()||"Verification could not be completed. Please try again.");const h=y.data,W=[h?.firstName,h?.middleName,h?.lastName].filter(Boolean).join(" "),v=h?.phoneNumber||h?.phone||"";return{fullName:W||"N/A",nin:l,email:u||"N/A",phoneNumber:v||"N/A"}},R=async()=>{x(!0);try{await le(a)}finally{x(!1)}n(),p()},I=async l=>{try{return await E(l)}catch(y){throw new Error(z(y)||"Verification failed. Please check your NIN and try again.")}};return e.jsx(H,{open:o,onClose:p,closeOnInteractOutside:!1,closeOnEscape:!1,size:"xl",maxW:"580px",contentProps:{borderRadius:"28px",px:{base:5,md:8},py:{base:6,md:8}},bodyProps:{p:0},children:e.jsx(fe,{onVerifyNin:I,onContinue:R,isContinuing:N,continueButtonText:"Mark as Done",noteDescription:"To activate your gadget policy and comply with NAICOM rules, we need to verify your identity. Your information is encrypted and secure.",...m&&{initialInfo:m}})})},ze=o=>o?.trim().toUpperCase()==="ACTIVE",Ge=()=>Object.fromEntries(A.map(o=>[o.id,"pending"])),wt=()=>{const[o]=te(),p=ie(),{navigate:n}=ce(),a=o.get("policyId"),u=C(i=>i?.kycApproved??!1),r=C(i=>i?.email),S=Ce(r),{data:P,isLoading:N}=me(a??""),x=P?.data,m=x?.gadget,[E,R]=b.useState(()=>{const i=Ge(),s=!!p.state?.gadgetInspectionCompleted;return u&&(i.nin="passed"),S&&(i.email_verification="passed"),s&&(i.gadget_inspection="passed"),i}),[I,l]=b.useState(null),[y,h]=b.useState(!1),{submitGadgetPolicyAsync:W,isLoading:v}=xe();b.useEffect(()=>{ue()},[]);const U=ve.routes,K={kycApproved:u,hasVerifiedEmail:S,policyStatus:x?.status??null,inspectionDoneOnMobile:x!=null?Se(x):!1},G=i=>{R(s=>({...s,[i]:"passed"}))},V=i=>ke(i,{currentStatus:E[i]??"pending",context:K}),Q=N&&A.some(i=>i.id==="gadget_inspection"),_=A.every(i=>V(i.id)==="passed"),k=b.useMemo(()=>{if(!m)return"";const i=[m.brand,m.model].filter(Boolean).join(" ").trim(),s=m.imei?.trim();return i&&s?`${i} · IMEI: ${s}`:i||(s?`IMEI: ${s}`:"Gadget policy")},[m]);if(!a)return e.jsx(oe,{to:"/home",replace:!0});const Y=i=>{if(i==="gadget_inspection"){if(Ne()){n(`/${we.DeviceInspection}?policyId=${a}`);return}h(!0);return}l(i)},q=()=>{G("email_verification"),l(null)},J=async()=>{const i=x?.quoteReference??o.get("quoteId")??"";if(!i){w.error("Missing quote reference. Please retry from confirm & pay.");return}try{const s=await W({policyId:a,quoteId:i});if(!s.success){w.error(z(s)||s.message||"Activation could not be completed. Please try again.");return}const O=U.activationSuccess,Z=k.replace(/\s*·\s*IMEI:.*/,"").trim()||"Your Gadget",D=ze(s.data.status);if(D&&O){const ee=new URLSearchParams({policyId:a,status:s.data.status??"",policyNumber:s.data.policyNumber??"",startDate:s.data.startDate??"",endDate:s.data.endDate??"",certificateUrl:s.data.certificateUrl??"",mykaCertificate:s.data.mykaCertificate??"",vehicleTitle:Z});n(`/${O}?${ee.toString()}`,{replace:!0});return}if(D){w.success("Policy activated successfully!"),n(`/policies/${a}`,{replace:!0});return}w.success("Policy Pending"),n(`/policies/${a}`,{replace:!0})}catch(s){w.error(z(s)||"Could not activate your policy. Please try again.")}},X=de();return e.jsxs(d,{minH:"100vh",display:"flex",flexDirection:"column",background:`linear-gradient(165deg, ${t.white.DEFAULT} 35%, ${t.orange[50]} 140%)`,children:[e.jsxs(d,{flex:1,px:{base:4,md:6},py:{base:5,md:8},w:"100%",maxW:"640px",mx:"auto",children:[e.jsxs(d,{mb:6,children:[e.jsx(d,{as:"span",display:"inline-flex",alignItems:"center",px:3,py:1,mb:3,borderRadius:"full",bg:t.orange[50],border:"1px solid",borderColor:t.orange[200],children:e.jsx(c,{fontSize:"xs",fontWeight:"semibold",color:t.text.orange,letterSpacing:"wide",children:"Gadget insurance"})}),e.jsx(c,{as:"h1",fontSize:{base:"2xl",md:"3xl"},fontWeight:"bold",color:t.text.label,mb:2,lineHeight:"shorter",children:"Activate your policy"}),e.jsx(c,{fontSize:"sm",color:t.text.gray,lineHeight:"1.65",children:"Finish email verification, identity checks, and device inspection to turn your cover on — it only takes a few minutes."})]}),e.jsx(d,{bg:"white",border:"1px solid",borderColor:t.border.primary,borderRadius:"2xl",px:{base:4,md:5},py:{base:4,md:5},mb:6,boxShadow:"0 12px 40px rgba(31, 54, 95, 0.07)",children:N?e.jsxs(j,{align:"flex-start",ga
1p:4,children:[e.jsx(f,{borderRadius:"xl",h:"56px",w:"56px",flexShrink:0}),e.jsxs(g,{align:"stretch",gap:2,flex:1,children:[e.jsx(f,{height:"14px",width:"40%",borderRadius:"md"}),e.jsx(f,{height:"22px",width:"85%",borderRadius:"md"}),e.jsx(f,{height:"14px",width:"55%",borderRadius:"md"})]})]}):m!=null||k?e.jsxs(j,{align:"flex-start",justify:"flex-start",gap:4,minW:0,children:[e.jsx(d,{flexShrink:0,w:{base:"56px",md:"64px"},h:{base:"56px",md:"64px"},borderRadius:"xl",bg:t.gray[50],border:"1px solid",borderColor:t.border.primary,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",p:2,children:m?.brand?.trim()?e.jsx(be,{brand:m.brand},m.brand):e.jsx(T,{as:$,boxSize:{base:"28px",md:"32px"},color:t.navy[400],"aria-hidden":!0})}),e.jsxs(g,{align:"stretch",gap:2,flex:1,minW:0,children:[e.jsx(c,{fontSize:"xs",fontWeight:"bold",color:t.text.info,textTransform:"uppercase",letterSpacing:"wider",children:"Insured device"}),e.jsx(c,{fontSize:{base:"md",md:"lg"},fontWeight:"semibold",color:t.text.label,lineHeight:"snug",children:k||"Gadget policy"}),x?.premium!=null&&e.jsx(j,{align:"center",flexWrap:"wrap",gap:2,pt:1,children:e.jsx(d,{px:2.5,py:1,borderRadius:"lg",bg:t.navy[50],border:"1px solid",borderColor:`${t.navy[200]}99`,children:e.jsxs(c,{fontSize:"xs",fontWeight:"semibold",color:t.text.label,children:["Gadget Premium · ₦",Number(x.premium).toLocaleString()]})})})]})]}):e.jsxs(j,{align:"flex-start",gap:4,children:[e.jsx(f,{borderRadius:"xl",h:"56px",w:"56px",flexShrink:0}),e.jsxs(g,{align:"stretch",gap:2,flex:1,children:[e.jsx(f,{height:"14px",width:"40%",borderRadius:"md"}),e.jsx(f,{height:"22px",width:"85%",borderRadius:"md"})]})]})}),e.jsx(c,{fontSize:"sm",fontWeight:"bold",color:t.text.label,mb:3,children:"Activation steps"}),e.jsx(g,{align:"stretch",gap:4,mb:6,children:Q?e.jsx(e.Fragment,{children:A.map(i=>e.jsx(f,{height:"108px",borderRadius:"2xl",borderWidth:"1px",borderColor:t.border.primary},i.id))}):A.map(i=>e.jsx(Pe,{label:i.label,description:i.description,icon:i.icon,status:V(i.id),onClick:()=>Y(i.id)},i.id))}),!_&&e.jsxs(j,{align:"flex-start",gap:3,bg:t.orange[50],border:"1px solid",borderColor:t.orange[200],borderRadius:"xl",px:4,py:3.5,mb:6,children:[e.jsx(T,{as:se,boxSize:5,color:t.orange[600],flexShrink:0,mt:.5,"aria-hidden":!0}),e.jsx(c,{fontSize:"sm",color:t.text.primary,lineHeight:"1.6",children:"Complete every step in the checklist to unlock activation. You can continue anytime — your payment is already secured."})]})]}),e.jsx(d,{position:"sticky",bottom:0,bg:"white",borderTop:"1px solid",borderColor:t.border.primary,boxShadow:"0 -8px 32px rgba(31, 54, 95, 0.06)",px:{base:4,md:6},py:4,maxW:"100%",children:e.jsxs(g,{maxW:"600px",mx:"auto",gap:2.5,align:"stretch",children:[e.jsx(M,{buttonType:"primary",text:"Activate Policy",fullWidth:!0,size:"lg",loading:v,disabled:!_||v,onClick:()=>void J()}),e.jsx(M,{buttonType:"outline",text:"View Policy",fullWidth:!0,border:`1px solid ${t.border.primary}`,size:"lg",disabled:v,onClick:()=>n(`/policies/${a}`)})]})}),e.jsx(Te,{open:I==="nin",onClose:()=>l(null),onPassed:()=>G("nin")}),e.jsx(Ae,{open:I==="email_verification",onClose:()=>l(null),onVerified:q,initialEmail:r?.trim()??"",pendingEmail:r?.trim()??"",description:"We need a verified email so we can send your policy documents and important updates."}),e.jsx(Ee,{open:y,onClose:()=>h(!1),deviceSummary:k}),e.jsx("a",{href:X,target:"_blank",rel:"noopener noreferrer",children:e.jsx(d,{position:"fixed",right:{base:4,md:6},bottom:{base:"88px",md:"96px"},zIndex:11,children:e.jsx(M,{buttonType:"whatsapp",text:"Chat with Myka",size:"sm"})})})]})};export{wt 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.