PageSourceSearch

https://myka.ng/assets/ClaimsPage-CXXlw3eM.js

js myka.ng collected 2026-10-09 22:41:17 UTC 9,739 bytes, 1 lines download raw bytes

1import{j as e,r as p,d as I}from"./vendor-react-DfYGAhtm.js";import{m as s,g as w,af as O,ai as N,ae as P,ah as F,ag as D,ad as H,aO as U,c as B,ar as V,I as $,t as G,aP as Y}from"./index-DsBgCU7r.js";import{C as K,a as Q,f as J,b as q,u as X,m as Z,c as ee,d as y,M as E}from"./claimMappers-CQORzb1J.js";import{g as v}from"./errors-BYKXB8DF.js";import{I as R,g as te}from"./healthCategoryUi-C2_keODf.js";import"./normalizeBrand-Cr5Qmi7I.js";import"./PolicyContributionFilters-CIXgAXYH.js";import{av as se,z as ae,aw as re}from"./vendor-icons-1odZwi-b.js";import{o as oe}from"./other-icon-DC1bN4dP.js";import{f as L}from"./currency-tq8RhIEU.js";import{T as W}from"./Tag-CjDhIpKV.js";import{a as n,F as g,H as u,o as _,V as ie,T as l,i as ne,h as C}from"./vendor-ui-DA_r9yXk.js";import{b as le}from"./greeting-COgqVEJw.js";import"./vendor-state-BsBVN-fX.js";import"./vendor-forms-BP-7CbAP.js";import"./useApiQuery-mQnoCtpJ.js";import"./api-BEJchXjA.js";import"./mykaPromises-CARilZxi.js";import"./policyProductType-BD61ZnUx.js";import"./transit-insurance-DHaUSpuL.js";import"./fire-BtgY-J44.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"./DropdownPopover-KjBTPKBF.js";import"./SelectField-B8rkxDSz.js";import"./contributionPeriods-BVOAzSfZ.js";const ce="#F0F5FA",de=({claim:t,onViewDetails:a})=>{const o=K[t.status],r=Q[t.status],c=t.insuranceType.toLowerCase(),b=R.find(m=>m.id===c)??R.find(m=>m.id==="others"),d=b?.icon??oe,f=b?.title??`${t.insuranceType} claim`,x=t.claimType.trim().toUpperCase()===t.insuranceType.toUpperCase()?`${J(t.claimType)} · Claim`:t.claimType.trim()||`${t.insuranceType} claim`,S=t.claimNumber?.trim()||"—",h=L(t.amount);return e.jsxs(n,{borderRadius:"xl",border:"1px solid",borderColor:"#E2E8F0",bg:ce,px:{base:4,md:5},py:5,style:{boxShadow:"0px 1px 3px 0px rgba(15, 23, 42, 0.06), 0px 1px 2px -1px rgba(15, 23, 42, 0.04)"},children:[e.jsxs(g,{justify:"space-between",align:"flex-start",gap:3,wrap:"wrap",mb:3,children:[e.jsxs(u,{gap:3,align:"flex-start",minW:0,children:[e.jsx(n,{w:12,h:12,borderRadius:"lg",background:b?.gradient??s.gray[200],borderWidth:1,borderColor:b?.borderColor??s.gray[300],display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,children:e.jsx(_,{src:d,alt:"",boxSize:7,objectFit:"contain"})}),e.jsxs(ie,{align:"flex-start",gap:0,minW:0,children:[e.jsx(l,{fontSize:"lg",fontWeight:"semibold",color:s.text.label,lineHeight:"short",children:f}),e.jsx(l,{fontSize:"md",color:s.text.info,lineClamp:2,children:x})]})]}),e.jsx(u,{gap:2,flexShrink:0,children:e.jsx(W,{variant:"outline",borderRadius:"full",px:2.5,py:1.5,size:"lg",fontSize:"sm",fontWeight:"semibold",customColors:{bg:r.bg,color:r.color,borderColor:r.color},children:o})})]}),e.jsx(l,{fontSize:"sm",fontWeight:"bold",color:s.text.label,mb:2,children:S}),e.jsxs(g,{justify:"space-between",align:{base:"flex-start",md:"center"},gap:4,direction:{base:"column",md:"row"},children:[e.jsxs(u,{gap:6,flexWrap:"wrap",color:s.text.info,children:[e.jsxs(u,{gap:1.5,children:[e.jsx(se,{size:16,color:s.orange[500]}),e.jsx(l,{fontSize:"md",children:`Updated: ${t.date}`})]}),e.jsx(l,{fontSize:"md",fontWeight:"medium",children:h})]}),e.jsx(u,{gap:2,flexShrink:0,wrap:"wrap",children:e.jsx(w,{type:"button",buttonType:"primary",text:"View details",size:"sm",icon:e.jsx(ae,{size:14}),iconPosition:"right",onClick:()=>a(t.id)})})]})]})},me={Motor:H,Gadget:te,Health:D,Travel:F,Property:P,SME:N,Life:O},pe={Motor:s.orange[50],Gadget:s.success[50],Health:s.error[50],Travel:s.navy[50],Property:s.orange[50],SME:s.orange[50],Life:s.navy[50]},xe=t=>t==="approved"?"Approved":"Rejected",ue=({item:t})=>{const a=q[t.status],o=xe(t.status);return e.jsx(n,{border:`1px solid ${s.gray[200]}
1`,borderRadius:"xl",overflow:"hidden",w:"100%",style:{boxShadow:"0px 1px 3px 0px rgba(0,0,0,0.05), 0px 1px 2px -1px rgba(0,0,0,0.03)"},children:e.jsx(n,{px:{base:4,md:5},py:4,children:e.jsxs(g,{direction:{base:"column",md:"row"},justify:"space-between",align:{base:"stretch",md:"center"},gap:{base:3,md:4},children:[e.jsxs(u,{gap:3,align:"flex-start",flex:"1",minW:0,children:[e.jsx(n,{w:{base:9,md:10},h:{base:9,md:10},borderRadius:"lg",bg:pe[t.insuranceType],display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,p:1.5,children:e.jsx(_,{src:me[t.insuranceType],alt:`${t.insuranceType} insurance`,objectFit:"contain",boxSize:{base:"22px",md:"24px"},flexShrink:0,draggable:!1})}),e.jsxs(n,{minW:0,children:[e.jsxs(g,{align:"center",gap:1.5,flexWrap:"nowrap",minW:0,lineHeight:"1.35",children:[e.jsx(l,{as:"span",fontSize:{base:"sm",md:"md"},fontWeight:"bold",color:s.text.label,flexShrink:0,children:t.claimNumber}),e.jsx(n,{w:2,h:2,borderRadius:"full",bg:s.text.primary,flexShrink:0,alignSelf:"center"}),e.jsx(l,{as:"span",fontSize:{base:"sm",md:"md"},fontWeight:"normal",color:s.text.info,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minW:0,children:t.insuranceType})]}),e.jsx(l,{fontSize:"xs",color:s.text.info,mt:.5,children:t.date})]})]}),e.jsxs(g,{direction:{base:"row",md:"column"},justify:{base:"space-between",md:"flex-end"},align:{base:"center",md:"flex-end"},gap:{base:2,md:2},w:{base:"100%",md:"auto"},flexShrink:0,children:[e.jsx(W,{px:3,py:1.5,variant:"subtle",size:"lg",borderRadius:"md",customColors:{bg:a.bg,color:a.color},startElement:e.jsx(n,{w:2,h:2,borderRadius:"full",bg:a.color,flexShrink:0}),fontWeight:"medium",children:o}),e.jsxs(u,{gap:1,justify:{base:"flex-end",md:"flex-end"},align:"center",children:[e.jsx(re,{size:22,color:t.status==="approved"?s.success[500]:s.error[400]}),e.jsx(l,{fontSize:{base:"lg",md:"xl"},fontWeight:"semibold",color:a.color,lineHeight:"1.35",flexShrink:0,children:L(t.amount)})]})]})]})})})},ge=["all","active","pending","expired"],be={all:"All",active:"Active",pending:"Pending",expired:"Expired"},he=({activeTab:t,counts:a,onTabChange:o})=>{const r=p.useMemo(()=>ge.map(c=>({value:c,label:`${be[c]} (${a[c]})`})),[a]);return e.jsx(n,{w:"full",overflowX:"auto",overflowY:"hidden",mx:{base:-4,md:0},px:{base:4,md:0},css:{WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}},children:e.jsx(U,{items:r,value:t,onChange:o})})},fe=()=>{const t=I(),{user:a}=B(),{firstName:o}=V(a?.kyc),r=le({firstName:o??null});return e.jsxs(g,{justify:"space-between",align:{base:"stretch",md:"center"},direction:{base:"column",md:"row"},gap:{base:4,md:4},children:[e.jsxs(n,{flex:{md:1},minW:0,children:[e.jsx(l,{textStyle:"text-lg-regular",fontWeight:"semibold",color:s.text.tertiary,children:r}),e.jsx(ne,{fontSize:{base:"xl",md:"2xl",lg:"3xl"},fontWeight:"bold",color:s.text.label,lineHeight:"1.2",mt:1,children:"My Claims"})]}),e.jsxs(C,{direction:{base:"column",sm:"row"},gap:3,w:{base:"full",md:"auto"},align:{base:"stretch",sm:"center"},flexShrink:0,children:[e.jsx(w,{buttonType:"whatsapp",text:"Chat with Myka",size:"md",w:{base:"full",sm:"auto"},onClick:$}),e.jsx(w,{buttonType:"primary",text:"Policies",size:"md",w:{base:"full",sm:"auto"},onClick:()=>t("/policies")})]})]})},je={all:void 0,active:"UNDER_REVIEW",pending:"DRAFT",expired:"REJECTED"},A=(t,a)=>a.reduce((o,r)=>o+(Number(t[r])||0),0),ye=(t,a)=>{const o=a.trim().toLowerCase();return o?t.filter(r=>r.claimNumber.toLowerCase().includes(o)||r.insuranceType.toLowerCase().includes(o)||r.claimType.toLowerCase().includes(o)||r.status.toLowerCase().replace(/_/g," ").includes(o)):t},at=()=>{const t=I(),[a,o]=p.useState(""),[r,c]=p.useState("all"),b=p.useMemo(()=>{const i={page:1,limit:20,sortBy:"createdAt",sortOrder:"desc"},j=je[r];return j&&(i.status=j),i},[r]),{data:d,isLoading:f,error:x,refetch:S}=X(b);p.useEffect(()=>{x&&G.error(v(x)??"Could not load claims.")},[x]);const h=p.useMemo(()=>{const i=d?.data.counts??{},j=d?.data.pagination;return{all:Object.values(i).reduce((k,M)=>k+M,0)||j?.total||0,active:A(i,["UNDER_REVIEW","REPORTED","EVIDENCE_SUBMITTED"]),pending:i.DRAFT??0,expired:A(i,["REJECTED","PAID","APPROVED"])}},[d?.data.counts,d?.data.pagination]),m=p.useMemo(()=>(d?.data.items??[]).map(Z),[d?.data.items]),T=p.useMemo(()=>ye(m,a),[m,a]),z=i=>{t(`/claims/${i}`)};return e.jsxs(C,{gap:6,align:"stretch",px:{base:4,md:6,lg:8},py:6,children:[e.jsx(fe,{}),e.jsx(ee,{}),e.jsxs(n,{children:[e.jsxs(g,{justify:"space-between",align:{base:"flex-start",md:"center"},direction:{base:"column",md:"row"},gap:3,mb:4,children:[e.jsxs(n,{minW:0,w:{base:"full",md:"auto"},flex:{md:1},children:[e.jsx(l,{fontSize:"lg",fontWeight:"bold",color:s.text.label,mb:2,children:f?"Loading…":`${h.all} Total Claims`}),e.jsx(he,{activeTab:r,counts:h,onTabChange:c})]}),e.jsx(Y,{placeholder:"Search",value:a,onChange:i=>o(i.target.value),width:{base:"full",md:"280px"},flexShrink:0})]}),f?e.jsx(l,{fontSize:"sm",color:s.text.info,children:"Loading claims…"}):x&&m.length===0?e.jsx(y,{variant:"load-error",errorMessage:v(x)??"",onRetry:()=>{S()}}):m.length===0?h.all===0?e.jsx(y,{variant:"no-claims"}):e.jsx(y,{variant:"tab-empty",activeTab:r,onViewAllClaims:()=>{c("all")}}):T.length===0?e.jsx(y,{variant:"search-empty",onClearSearch:()=>{o("")}}):e.jsx(C,{gap:4,children:T.map(i=>e.jsx(de,{claim:i,onViewDetails:z},i.id))}),h.all>0&&E.length>0&&e.jsxs(n,{mt:8,children:[e.jsx(l,{fontSize:"md",fontWeight:"bold",color:s.text.primary,mb:3,children:"Claims History"}),e.jsx(C,{gap:3,w:"100%",children:E.map(i=>e.jsx(ue,{item:i},i.id))})]})]})]})};export{at 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.