1import{j as e,d as C,r as y}from"./vendor-react-DfYGAhtm.js";import{bA as R,bB as P,b_ as N,bw as z}from"./vendor-icons-1odZwi-b.js";import{h as A,u as T,e as _}from"./vendor-state-BsBVN-fX.js";import{e as B,m as s,g as w,B as j,bt as I}from"./index-DsBgCU7r.js";import{u as L}from"./useSmeStepBreadcrumbs-eAyE9Kbh.js";import{u as M}from"./useAnalytics-HP01GbIH.js";import{S as F}from"./StepPageLayout-DdZUweau.js";import{g as k}from"./errors-BYKXB8DF.js";import{a as W}from"./text-D803XGGZ.js";import{a as n,H as g,T as i,G as D,V as E,v as b,a8 as O,F as U}from"./vendor-ui-DA_r9yXk.js";import{g as V,S as $}from"./flowGuard-BNgCH5A1.js";import{P as q,s as G}from"./protections-CyJ9pxcP.js";import{S as H}from"./routes-alBnq1HL.js";import"./vendor-forms-BP-7CbAP.js";import"./stepBreadcrumbs-FCtSk5Kj.js";const K=r=>{const t=r.replace(/\D/g,"");return t.startsWith("234")?t:t.startsWith("0")?"234"+t.slice(1):"234"+t},Q=async r=>(await B.post("/api/v1/sme-policy",r)).data,Y=()=>{const r=A({mutationKey:["sme","sme-policy","create"],mutationFn:Q});return{createSmePolicy:r.mutate,createSmePolicyAsync:r.mutateAsync,isLoading:r.isPending,isError:r.isError,error:r.error,isSuccess:r.isSuccess,data:r.data}},J=({label:r,value:t})=>e.jsxs(n,{children:[e.jsx(i,{fontSize:"sm",color:s.text.gray,mb:1,children:r}),e.jsx(n,{fontSize:"sm",fontWeight:"semibold",color:s.text.label,children:t})]}),x=({icon:r,title:t,fields:d,children:u})=>e.jsxs(n,{border:"1px solid",borderColor:s.border.primary,borderRadius:"xl",p:4,bg:s.white.DEFAULT,children:[e.jsxs(g,{gap:2,mb:4,children:[e.jsx(n,{bg:s.orange[50],borderRadius:"lg",p:1.5,display:"flex",alignItems:"center",justifyContent:"center",children:r}),e.jsx(i,{fontWeight:"semibold",fontSize:"sm",color:s.text.primary,children:t})]}),d.length>0&&e.jsx(D,{templateColumns:"1fr 1fr",gap:4,children:d.map(c=>e.jsx(J,{label:c.label,value:c.value},c.label))}),u]}),X=()=>e.jsxs(g,{gap:1,children:[e.jsx(b,{as:z,boxSize:4,color:s.success[600]}),e.jsx(i,{fontSize:"sm",fontWeight:"semibold",color:s.success[700],children:"Verified"})]}),be=()=>{const{items:r}=L(),t=C(),d=T(),[u,c]=y.useState(null),{company:l,representative:o,selectedProtections:m}=_(a=>a.sme),{createSmePolicy:v,isLoading:S}=Y(),{track:h}=M(),p=V($.ReviewSubmit,l,o,m,null);return y.useEffect(()=>{p&&t(p,{replace:!0})},[p,t]),p||!o||m.length===0?null:e.jsx(F,{items:r,contentMaxW:"800px",children:e.jsx(n,{bg:"white",borderRadius:"2xl",p:{base:6,md:10},background:`linear-gradient(145deg, white 55%, ${s.orange[50]} 100%)`,border:"1px solid",borderColor:s.border.secondary,children:e.jsxs(E,{gap:6,align:"stretch",children:[e.jsxs(n,{children:[e.jsxs(i,{fontSize:{base:"3xl",md:"4xl"},fontWeight:"bold",color:s.text.label,mb:2,children:[e.jsxs(i,{as:"span",color:s.orange[500],children:["Review &"," "]}),"Submit Request"]}),e.jsx(i,{fontSize:"md",color:s.text.gray,children:"Confirm your business details and selected protections before sending your request to our team."})]}),l&&e.jsx(x,{icon:e.jsx(b,{as:R,boxSize:5,color:s.orange[500]}),title:"Business Identity",fields:[{label:"Company Name",value:l.name},{label:"CAC Number",value:l.rcNumber},{label:"Industry",value:W(l.details?.classification)},{label:"Status",value:e.jsx(X,{})}]}),e.jsx(x,{icon:e.jsx(b,{as:P,boxSize:5,color:s.orange[500]}),title:"Authorized Representative",fields:[{label:"First Name",value:o.firstName},{label:"Last Name",value:o.lastName},{label:"Phone",value:o.phone},{label:"Email",value:o.email}]}),e.jsx(x,{icon:e.jsx(b,{as:N,boxSize:5,color:s.orange[500]}),title:"Coverage Options",fields:[],children:e.jsx(E,{gap:3,align:"stretch",children:m.length>0&&e.jsxs(n,{children:[e.jsxs(i,{fontSize:"sm",color:s.text.gray,mb:2,children:["Selected Protections (",m.length,")"]}),e.jsx(g,{gap:2,flexWrap:"wrap",children:m.map(a=>e.jsx(O,{color:s.orange[600],bg:s.orange[50],borderRadius:"full",px:2,borderColor:s.orange[800],border:`1px solid ${s.border.secondary}`,py:.5,fontSize:"2xs",fontWeight:"semibold",children:q[a]??a},a))})]})})}),u&&e.jsx(i,{fontSize:"sm",color:s.error[600],children:u}),e.jsx(U,{justify:"flex-end",children:e.jsx(w,{buttonType:"primary",text:"Request Quote",size:"lg",type:"button",loading:S,disabled:S,onClick:()=>{o&&(c(null),v({usageType:"BUSINESS",repFullName:`${o.firstName} ${o.lastName}`,repEmail:o.email,repPhone:K(o.phone),...l?{businessId:l.id}:{},protectionCover:G(m)},{onSuccess:a=>{const f=a?.data??a;h(j.FORM_SME_SUBMITTED,{product_type:"sme"}),d(I(f)),t(`/${H.Submitted}`,{replace:!0,state:{submissionResult:f}})},onError:a=>{h(j.FORM_SME_SUBMIT_FAILED,{product_type:"sme",failure_reason:"server_error"}),c(k(a)??"Submission failed. Please check your details and try again.")}}))}})})]})})})};export{be 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.