1import{j as e,d as h,r as u}from"./vendor-react-DfYGAhtm.js";import{h as S,u as j,e as P}from"./vendor-state-BsBVN-fX.js";import{e as R,m as s,g as A,B as m,bo as E}from"./index-DsBgCU7r.js";import{u as v}from"./usePropertyStepBreadcrumbs-Cr5KdyVf.js";import{u as w}from"./useAnalytics-HP01GbIH.js";import{S as C}from"./StepPageLayout-DdZUweau.js";import{g as T}from"./errors-BYKXB8DF.js";import{bA as F}from"./vendor-icons-1odZwi-b.js";import{a as n,H as L,T as i,G as O,v as _,F as z,V as k}from"./vendor-ui-DA_r9yXk.js";import{P as y}from"./routes-D6u-5hjo.js";import"./vendor-forms-BP-7CbAP.js";import"./stepBreadcrumbs-FCtSk5Kj.js";const B=async t=>(await R.post("/api/v1/property-policy",t)).data,M=()=>{const t=S({mutationKey:["property","property-policy","create"],mutationFn:B});return{createPropertyPolicy:t.mutate,createPropertyPolicyAsync:t.mutateAsync,isLoading:t.isPending,isError:t.isError,error:t.error,isSuccess:t.isSuccess,data:t.data}},N=({label:t,value:o})=>e.jsxs(n,{children:[e.jsx(i,{fontSize:"sm",color:s.text.gray,mb:1,children:t}),e.jsx(n,{fontSize:"sm",fontWeight:"semibold",color:s.text.label,textTransform:"capitalize",children:o})]}),I=({icon:t,title:o,fields:a})=>e.jsxs(n,{border:"1px solid",borderColor:s.border.primary,borderRadius:"xl",p:4,bg:s.white.DEFAULT,children:[e.jsxs(L,{gap:2,mb:4,children:[e.jsx(n,{bg:s.orange[50],borderRadius:"lg",p:1.5,display:"flex",alignItems:"center",justifyContent:"center",children:t}),e.jsx(i,{fontWeight:"semibold",fontSize:"sm",color:s.text.primary,children:o})]}),e.jsx(O,{templateColumns:{base:"1fr",sm:"1fr 1fr"},gap:4,children:a.map(r=>e.jsx(N,{label:r.label,value:r.value},r.label))})]}),D=({location:t,onGetQuote:o,isSubmitting:a=!1,submitError:r=null})=>e.jsxs(e.Fragment,{children:[e.jsx(I,{icon:e.jsx(_,{as:F,boxSize:5,color:s.orange[500]}),title:"Property Details",fields:[{label:"Ownership Status",value:t.occupancyStatus==="owned"?"Owned":"Rented"},{label:"State",value:t.state},{label:"LGA",value:t.lga||"â"},{label:"Address",value:t.fullAddress}]}),e.jsxs(z,{direction:"column",align:{base:"stretch",sm:"flex-end"},gap:2,children:[r&&e.jsx(i,{fontSize:"sm",color:"red.500",children:r}),e.jsx(A,{buttonType:"primary",text:"Request Quote",size:"lg",type:"button",onClick:o,disabled:a,loading:a})]})]}),G=()=>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"]}),e.jsx(i,{fontSize:"md",color:s.text.gray,children:"Confirm all details are correct before submitting"})]}),ee=()=>{const{items:t}=v(),o=h(),a=j(),{location:r}=P(d=>d.propertyFlow),{createPropertyPolicyAsync:p,isLoading:x,isError:b,error:g}=M(),{track:c}=w();u.useEffect(()=>{r||o(`/${y.OccupancyLocation}`,{replace:!0})},[r,o]);const f=u.useCallback(async()=>{if(!r)return;const d={usageType:"PERSONAL",occupancy:r.occupancyStatus==="owned"?"OWNER":"TENANT",city:r.fullAddress,state:r.state,lga:r.lga,street:r.fullAddress};try{const l=await p(d);l?.data&&(c(m.FORM_PROPERTY_SUBMITTED,{product_type:"property"}),a(E({id:l.data.id,ourReference:l.data.ourReference,status:l.data.status,createdAt:l.data.createdAt})),o(`/${y.Submitted}`))}catch{c(m.FORM_PROPERTY_SUBMIT_FAILED,{product_type:"property",failure_reason:"server_error"})}},[r,p,a,o,c]);return r?e.jsx(C,{items:t,contentMaxW:"800px",mobileContentOnly:!0,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(k,{gap:6,align:"stretch",children:[e.jsx(G,{}),e.jsx(D,{location:r,onGetQuote:f,isSubmitting:x,submitError:b?T(g):null})]})})}):null};export{ee 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.