PageSourceSearch

https://app.fintective.ai/assets/FinancialScore-CpYRXBz-.js

js fintective.ai collected 2026-10-05 12:03:01 UTC 10,778 bytes, 2 lines download raw bytes

1import{r as f,j as e,ad as V,a1 as W,p as z,B as Q,a7 as F,a8 as G,a9 as J}from"./react-vendor-DhHiR6oo.js";import{P as Z}from"./PaginationBar-Ctu7ufd5.js";import{L as ee}from"./router-C-6JOlnF.js";import{b as se,u as M,c as te}from"./query-Dwc0wqew.js";import{h as r,C as v,a as C,B,a2 as L,a3 as P,T as ae,d as re,e as ne,g as ie,aE as oe,c as le,W as ce}from"./index-DMh5MpXc.js";import{P as de,B as xe}from"./PageHeader-DzvcnSI-.js";import{T as he,a as me,b as E,c as x,d as ue,e as c}from"./table-5G_XrLNw.js";import{C as fe,a as je,b as ge}from"./collapsible-BRzMIGM0.js";import{R as pe,f as be,C as Ne,X as _e,Y as ve,T as Ce,d as $,g as Se}from"./recharts-DdfqAV_w.js";import{D as X}from"./app-vendor-CZGo0gMC.js";import"./ui-vendor-G2hslWMA.js";import"./backend-clients-DDAZ_8wi.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"72c723734fb5647bafabbb01efe0deb2a9be2629"};var l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="301e899c-5554-40f6-8cda-18869157cb1f",t._sentryDebugIdIdentifier="sentry-dbid-301e899c-5554-40f6-8cda-18869157cb1f")}catch{}})();function ye(t){return t>=75?"hsl(var(--success))":t>=50?"hsl(var(--warning))":"hsl(var(--destructive))"}function Te(t){return t===null?"Unavailable":t>=75?"On Track":t>=50?"Needs Attention":"Off Track"}function Ee(t,l){return t===null||l===void 0||l===null?e.jsx(F,{className:"h-3.5 w-3.5 text-muted-foreground"}):t>l?e.jsx(G,{className:"h-3.5 w-3.5 text-success"}):t<l?e.jsx(J,{className:"h-3.5 w-3.5 text-destructive"}):e.jsx(F,{className:"h-3.5 w-3.5 text-muted-foreground"})}function $e(){const t=se(),[l,w]=f.useState(!1),[j,O]=f.useState(0),h=5,g=j*h,{data:n,isFetching:S}=M({queryKey:["financial-score",h,g],queryFn:()=>le({limit:h,offset:g})}),m=te({mutationFn:s=>oe({limit:h,offset:g,auto:s==null?void 0:s.auto}),onSuccess:s=>{t.setQueryData(["financial-score",h,g],s)},onError:(s,i)=>{i!=null&&i.auto||Q.error(s instanceof Error?s.message:"Failed to calculate score")}});f.useEffect(()=>{var d,a;if(!n||m.isPending)return;const s=((d=n.current)==null?void 0:d.score_value)??null,i=((a=n.history[0])==null?void 0:a.score_value)??null;s!==null&&s!==i&&m.mutate({auto:!0})},[n]);const{data:p}=M({queryKey:["category-allocation"],queryFn:ce}),y=!!(p!=null&&p.allocation&&Object.keys(p.allocation.allocations??{}).length>0),o=(n==null?void 0:n.current)??null,b=(n==null?void 0:n.history)??[],A=(n==null?void 0:n.total)??0,I=Math.max(1,Math.ceil(A/h)),N=Math.min(j,Math.max(0,I-1)),u=(o==null?void 0:o.score_value)??null,Y=[...b].reverse().map(s=>({date:X(new Date(s.created_at),"MMM d"),score:s.score_value??0,detectorScore:s.detector_score,notificationScore:s.notification_score,ynabFreshnessScore:s.ynab_freshness_score,deviationScore:s.deviation_score,staleFindingsScore:s.stale_findings_score})),K=({active:s,payload:i,label:d})=>{var _;if(!s||!i||i.length===0)return null;const a=(_=i[0])==null?void 0:_.payload;return a?e.jsxs("div",{className:"rounded-md border bg-popover p-3 shadow-sm",style:{borderColor:"hsl(var(--border))"},children:[e.jsx("p",{className:"mb-1 text-xs text-muted-foreground",children:d}),e.jsxs("p",{className:"text-base font-bold",children:["Score: ",a.score??0,"%"]}),e.jsxs("div",{className:"mt-2 space-y-0.5 text-xs text-muted-foreground",children:[e.jsxs("p",{children:["Detectors: ",a.detectorScore??0,"/20"]}),e.jsxs("p",{children:["Notifications: ",a.notificationScore??0,"/15"]}),e.jsxs("p",{children:["YNAB freshness: ",a.ynabFreshnessScore??0,"/25"]}),e.jsxs("p",{children:["Deviation: ",a.deviationScore??0,"/15"]}),e.jsxs("p",{children:["Unresolved >1wk: ",a.staleFindingsScore??0,"/25"]})]})]}):null},D=f.useMemo(()=>{if(!o)return[];const s=(U,R,k,q,H)=>{const T=R>=k;return{label:U,score:R,max:k,atMax:T,fix:T?r.SCORE_MAXED:q,cta:T?null:H}},i=y?r.SCORE_DEVIATION_FIX:r.SCORE_DEVIATION_NO_ALLOCATION,d={label:y?r.SCORE_DEVIATION_CTA_REVIEW:r.SCORE_DEVIATION_CTA_SET,to:"/categories"},a=o.stale_findings_count??0,_=a>0?r.SCORE_STALE_FIX_COUNT.replace("{count}",String(a)).replace("{s}",a===1?"":"s"):r.SCORE_STALE_FIX;return[s("Detectors",o.detector_score,20,r.SCORE_DETECTORS_FIX,{label:r.SCORE_DETECTORS_CTA,to:"/settings?tab=detectors"}),s("Notifications",o.notification_score,15,r.SCORE_NOTIFICATIONS_FIX,{label:r.SCORE_NOTIFICATIONS_CTA,to:"/settings?tab=detectors"}),s("YNAB freshness",o.ynab_freshness_score,25,r.SCORE_YNAB_FIX,{label:r.SCORE_YNAB_CTA,to:"/settings?tab=connectors"}),s("Deviation",o.deviation_score,15,i,d),s("Unresolved >1wk",o.stale_findings_score,25,_,{label:r.SCORE_STALE_CTA,to:"/findings?filter=active"})]},[o,y]);return f.useEffect(()=>{N!==j&&O(N)},[j,N]),e.jsxs("div",{children:[e.jsx(de,{title:"Fintective Track Score",badge:"SCORE"}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx(v,{children:e.jsxs(C,{className:"p-6 flex flex-col md:flex-row items-center gap-6",children:[e.jsx("div",{className:"relative flex items-center justify-center rounded-full",style:{width:160,height:160,background:`conic-gradient(${ye(u??0)} ${(u??0)*3.6}deg, hsl(var(--muted)) 0deg)`}
1,children:e.jsxs("div",{className:"absolute inset-2 rounded-full bg-background flex flex-col items-center justify-center",children:[e.jsx("span",{className:"text-4xl font-bold",children:u!==null?`${u}%`:"-"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Te(u)})]})}),e.jsxs("div",{className:"flex-1 space-y-3 text-center md:text-left",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Current Score"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This page shows the persisted Fintective Score history generated from the current agency data."}),e.jsx("div",{className:"flex flex-wrap gap-2 justify-center md:justify-start",children:D.map(s=>e.jsx(xe,{variant:"secondary",className:"font-normal",children:`${s.label}: ${s.score}/${s.max}`},s.label))}),e.jsxs(B,{onClick:()=>m.mutate(),disabled:S||m.isPending,className:"mt-2",children:[e.jsx(V,{className:`h-4 w-4 mr-2 ${S||m.isPending?"animate-spin":""}`}),S||m.isPending?"Calculating...":"Calculate score"]})]})]})}),e.jsxs(v,{children:[e.jsx(L,{className:"pb-2",children:e.jsxs(P,{className:"text-base flex items-center gap-2",children:["Score Trend",e.jsx(ae,{delayDuration:200,children:e.jsxs(re,{children:[e.jsx(ne,{asChild:!0,children:e.jsx(W,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),e.jsx(ie,{className:"max-w-xs",children:e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsx("p",{className:"font-semibold",children:"Persisted history"}),e.jsx("p",{children:"Each refresh stores the current detector, notification, YNAB freshness, deviation, and unresolved-findings component scores for this agency and active plan."})]})})]})})]})}),e.jsx(C,{children:e.jsx("div",{className:"h-[280px]",children:e.jsx(pe,{width:"100%",height:"100%",children:e.jsxs(be,{data:Y,margin:{top:10,right:16,left:0,bottom:0},children:[e.jsx(Ne,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),e.jsx(_e,{dataKey:"date",tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"}}),e.jsx(ve,{domain:[0,100],tick:{fontSize:12,fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ce,{content:K}),e.jsx($,{y:75,stroke:"hsl(var(--success))",strokeDasharray:"4 4"}),e.jsx($,{y:50,stroke:"hsl(var(--warning))",strokeDasharray:"4 4"}),e.jsx(Se,{type:"monotone",dataKey:"score",stroke:"hsl(var(--primary))",strokeWidth:2.5,dot:{r:4,fill:"hsl(var(--primary))"},activeDot:{r:6}})]})})})})]}),o&&e.jsx(fe,{open:l,onOpenChange:w,children:e.jsxs(v,{children:[e.jsx(je,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex w-full items-start justify-between gap-2 p-6 pb-2 text-left",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-base font-semibold leading-none tracking-tight",children:r.SCORE_BREAKDOWN_TITLE}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r.SCORE_BREAKDOWN_SUBTITLE})]}),e.jsx(z,{className:`mt-1 h-4 w-4 shrink-0 text-muted-foreground transition-transform ${l?"rotate-180":""}`})]})}),e.jsx(ge,{children:e.jsx(C,{className:"space-y-4 pt-2",children:D.map(s=>e.jsxs("div",{className:"rounded-lg border border-border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:s.label}),e.jsxs("span",{className:`text-sm font-semibold ${s.atMax?"text-success":"text-muted-foreground"}`,children:[s.score,"/",s.max]})]}),e.jsx("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${s.score/s.max*100}%`,backgroundColor:s.atMax?"hsl(var(--success))":"hsl(var(--primary))"}})}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s.fix}),s.cta&&e.jsx(B,{asChild:!0,variant:"outline",size:"sm",className:"shrink-0",children:e.jsx(ee,{to:s.cta.to,children:s.cta.label})})]})]},s.label))})})]})}),e.jsxs(v,{children:[e.jsx(L,{className:"pb-2",children:e.jsx(P,{className:"text-base",children:"Score History"})}),e.jsxs(C,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(he,{children:[e.jsx(me,{children:e.jsxs(E,{children:[e.jsx(x,{children:"Date"}),e.jsx(x,{className:"text-right",children:"Detectors"}),e.jsx(x,{className:"text-right",children:"Notifications"}),e.jsx(x,{className:"text-right",children:"YNAB"}),e.jsx(x,{className:"text-right",children:"Deviation"}),e.jsx(x,{className:"text-right",children:">1wk"}),e.jsx(x,{className:"text-right",children:"Total"}),e.jsx(x,{className:"w-8"})]})}),e.jsxs(ue,{children:[b.map((s,i)=>{var a;const d=(a=b[i+1])==null?void 0:a.score_value;return e.jsxs(E,{children:[e.jsx(c,{className:"font-medium",children:X(new Date(s.created_at),"MMM d, yyyy p")}),e.jsx(c,{className:"text-right",children:s.detector_score}),e.jsx(c,{className:"text-right",children:s.notification_score}),e.jsx(c,{className:"text-right",children:s.ynab_freshness_score}),e.jsx(c,{className:"text-right",children:s.deviation_score}),e.jsx(c,{className:"text-right",children:s.stale_findings_score}),e.jsx(c,{className:"text-right font-semibold",children:s.score_value!==null&&s.score_value!==void 0?`${s.score_value}%`:"-"}),e.jsx(c,{children:Ee(s.score_value??null,d??null)})]},s.id)}),b.length===0&&e.jsx(E,{children:e.jsx(c,{colSpan:8,className:"text-center text-sm text-muted-foreground py-6",children:"No score snapshots yet."})})]})]})}),A>0&&e.jsx("div",{className:"mt-4",children:e.jsx(Z,{page:N,totalPages:I,onPage:O})})]})]})]})]})}export{$e as default};
2//# sourceMappingURL=FinancialScore-CpYRXBz-.js.map

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.