PageSourceSearch

https://myka.ng/assets/LifeEnquiryPage-Lt4217FK.js

js myka.ng collected 2026-10-09 22:42:52 UTC 5,047 bytes, 1 lines download raw bytes

1import{j as e,d as F,r as f}from"./vendor-react-DfYGAhtm.js";import{b as P,c as T,C as m}from"./vendor-forms-BP-7CbAP.js";import{h as C,u as M}from"./vendor-state-BsBVN-fX.js";import{e as I,m as r,g as L,I as R,c as v,B as E,bk as w,t as N,G as g,o as W,A as z}from"./index-DsBgCU7r.js";import{u as B}from"./useAnalytics-HP01GbIH.js";import{S as D}from"./StepPageLayout-DdZUweau.js";import{g as U}from"./errors-BYKXB8DF.js";import{H as q,T as i,F as A,v as H,i as G,t as O,a as l,V,x as $}from"./vendor-ui-DA_r9yXk.js";import{q as K}from"./vendor-icons-1odZwi-b.js";import{l as Y}from"./enquiryFormSchema-4_Diaam2.js";import{L as J}from"./routes-BTwm__Y5.js";const Q=async t=>(await I.post("/api/v1/life-policy",t)).data,X=()=>{const t=C({mutationKey:["life","life-policy","create"],mutationFn:Q});return{createLifePolicy:t.mutate,createLifePolicyAsync:t.mutateAsync,isLoading:t.isPending,isError:t.isError,error:t.error,isSuccess:t.isSuccess,data:t.data}},u=({children:t,isRequired:o=!0})=>e.jsxs(q,{gap:.5,mb:2,children:[e.jsx(i,{fontSize:"sm",fontWeight:"medium",color:r.text.info,children:t}),o&&e.jsx(i,{fontSize:"md",color:r.error[500],children:"*"})]}),Z=O("button"),ee=({onGoBack:t})=>e.jsxs(e.Fragment,{children:[e.jsxs(A,{justify:"space-between",align:"center",gap:3,mb:{base:6,md:8},children:[e.jsxs(Z,{type:"button",onClick:t,display:"flex",alignItems:"center",gap:2,cursor:"pointer",color:r.text.primary,_hover:{color:r.text.orange},flexShrink:0,children:[e.jsx(A,{align:"center",justify:"center",boxSize:"32px",borderRadius:"full",border:"1px solid",borderColor:r.border.primary,children:e.jsx(H,{as:K,boxSize:4})}),e.jsx(i,{fontSize:"sm",fontWeight:"medium",children:"Back"})]}),e.jsx(L,{buttonType:"whatsapp",text:"Chat with Myka",iconPosition:"left",size:"sm",flexShrink:0,onClick:R})]}),e.jsxs(G,{fontSize:{base:"3xl",md:"4xl"},fontWeight:"semibold",lineHeight:"1.15",color:r.text.info,mb:2,children:["Make an"," ",e.jsx(i,{as:"span",color:r.text.label,fontWeight:"semibold",children:"Enquiry"})]}),e.jsx(i,{fontSize:"md",color:r.text.gray,maxW:"380px",children:"Share your details and we'll help you find the right cover."})]}),re=t=>{const o=t.replace(/\D/g,"");return o.startsWith("234")?o:o.startsWith("0")?"234"+o.slice(1):"234"+o},y={border:`1px solid ${r.border.primary}`,bg:r.white.DEFAULT,_hover:{bg:r.white.DEFAULT}},pe=()=>{const t=F(),o=M(),{track:d}=B(),{isAuthenticated:p}=v(),{createLifePolicyAsync:b,isLoading:j}=X(),x=f.useRef(null),{control:c,handleSubmit:_,formState:{errors:a}}=P({resolver:T(Y),defaultValues:{fullName:"",email:"",phone:"",message:""}}),h=f.useCallback(async s=>{try{const n=await b({usageType:"BUSINESS",repFullName:s.fullName.trim(),repEmail:s.email.trim(),repPhone:re(s.phone)}),S=n?.data??n;d(E.FORM_GROUP_LIFE_SUBMITTED,{product_type:"group_life"}),o(w(S)),t(`/${J.Submitted}`,{replace:!0,state:{submissionResult:S}})}catch(n){d(E.FORM_GROUP_LIFE_SUBMIT_FAILED,{product_type:"group_life",failure_reason:"server_error"}),N.error(U(n)??"We could not submit your enquiry. Please try again.")}},[b,o,t,d]);f.useEffect(()=>{const s=x.current;!p||!s||(x.current=null,h(s))},[p,h]);const k=s=>{if(!p){x.current=s,o(W({step:z.LOGIN}));return}h(s)};return e.jsxs(D,{items:[],hideGoBack:!0,contentMaxW:"560px",children:[e.jsx(ee,{onGoBack:()=>t(-1)}),e.jsxs(l,{as:"form",onSubmit:s=>{_(k)(s)},mt:6,children:[e.jsx(l,{border:"1px solid",borderColor:r.border.primary,borderRadius:"20px",bg:r.white.DEFAULT,p:{base:5,md:6},children:e.jsxs(V,{gap:4,align:"stretch",children:[e.jsxs(l,{children:[e.jsx(u,{children:"Full Name"}),e.jsx(m,{name:"fullName",control:c,render:({field:s})=>e.jsx(g,{...s,placeholder:"Enter your full name",...y,error:a.fullName?.message})})]}),e.jsxs(l,{children:[e.jsx(u,{children:"Email Address"}),e.jsx(m,{name:"email",control:c,render:({field:s})=>e.jsx(g,{...s,type:"email",placeholder:"Enter your email address",...y,error:a.email?.message})})]}),e.jsxs(l,{children:[e.jsx(u,{children:"Phone Number"}),e.jsx(m,{name:"phone",control:c,render:({field:s})=>e.jsx(g,{...s,type:"tel",inputMode:"numeric",placeholder:"7084578655",...y,error:a.phone?.message,pl:"16",leftIcon:e.jsx(i,{fontSize:"sm",fontWeight:"600",color:r.gray[700],children:"+234"}),onChange:n=>{s.onChange(n.currentTarget.value.replace(/\D/g,"").slice(0,10))}})})]}),e.jsxs(l,{children:[e.jsx(u,{children:"Message"}),e.jsx(m,{name:"message",control:c,render:({field:s})=>e.jsx($,{...s,placeholder:"Enter your message",minH:"150px",resize:"vertical",p:4,borderRadius:"20px",bg:r.white.DEFAULT,border:"1px solid",borderColor:a.message?r.error[500]:r.border.primary,_placeholder:{color:r.gray[400]},_focus:{outline:"none",borderColor:a.message?r.error[500]:r.orange[500],boxSh
1adow:`0 0 0 1px ${a.message?r.error[500]:r.orange[500]}`}})}),a.message?.message&&e.jsx(i,{textStyle:"text-sm-regular",color:r.error[500],mt:1.5,children:a.message.message})]})]})}),e.jsx(L,{buttonType:"primary",text:"Submit",size:"lg",type:"submit",fullWidth:!0,mt:{base:8,md:10},loading:j,disabled:j})]})]})};export{pe 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.