PageSourceSearch

https://bankingapp-kpgywg5z.manus.space/assets/FinancialAdvisor-DLfEm6Ph.js

js bankingapp-kpgywg5z.manus.space collected 2026-10-03 05:00:21 UTC 16,822 bytes, 22 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AIChatBox-C1i5MRYW.js","assets/index-CMjSxCKv.js","assets/index-Uw8LEJYc.css","assets/textarea-DH9mnoNq.js","assets/dialog-DBoB1lEi.js","assets/useComposition-C2jfMLJQ.js","assets/usePersistFn-njW8008O.js","assets/DashboardLayout-DRtOb4Ng.js","assets/shield-check-DD5U_9mZ.js","assets/select-8X2pu2C0.js","assets/send-nvXETkoF.js","assets/AIChatBox-CyAuISp2.css"])))=>i.map(i=>d[i]);
2import{g as F,u as B,r as A,t as p,j as a,B as b,C as t,a as c,c as n,b as l,d as r,e as g,_ as P}from"./index-CMjSxCKv.js";import{D as E,S as M,a as h}from"./DashboardLayout-DRtOb4Ng.js";import{A as m,a as v,b as u,R as $}from"./alert-IlXuAYfF.js";import{B as I}from"./badge-E7WmV-qe.js";import{S as V,a as G,b as W,c as H,d as f}from"./select-8X2pu2C0.js";import{S as Q}from"./shield-check-DD5U_9mZ.js";import{L as q}from"./lightbulb-B_IiXImn.js";import"./dialog-DBoB1lEi.js";/**
3 * @license lucide-react v0.453.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const O=F("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
8 * @license lucide-react v0.453.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const L=F("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
13 * @license lucide-react v0.453.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const U=F("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/**
18 * @license lucide-react v0.453.0 - ISC
19 *
20 * This source code is licensed under the ISC license.
21 * See the LICENSE file in the root directory of this source tree.
22 */const Y=F("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),J=A.lazy(async()=>({default:(await P(()=>import("./AIChatBox-C1i5MRYW.js").then(d=>d.A),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))).AIChatBox})),K="I’m an AI, not a licensed financial advisor. These insights are educational analysis of your account activity, not guaranteed financial advice.";function na(){const{user:N}=B(),[d,T]=A.useState("90"),[w,k]=A.useState([]),i=p.advisor.getSpendingAnalysis.useQuery({days:Number(d)},{enabled:!!N}),o=p.advisor.generateInsights.useQuery({days:Number(d)},{enabled:!1}),x=p.advisor.generateSavingsGoals.useQuery({days:Number(d)},{enabled:!1}),S=p.advisor.chat.useMutation(),C=Object.entries(i.data?.spending??{}).sort(([,s],[,e])=>Number(e.total)-Number(s.total)),j=Number(i.data?.totalSpent??0),z=Number(i.data?.totalReceived??0),D=async s=>{const e=[...w,{role:"user",content:s}];k(e);try{const y=await S.mutateAsync({messages:e});k([...e,{role:"assistant",content:y.message}])}catch{g.error("The advisor could not respond. Please try again.")}},R=async()=>{try{await o.refetch(),g.success("Your spending insights are ready.")}catch{g.error("We couldn’t generate insights right now.")}},_=async()=>{try{await x.refetch(),g.success("Personalized savings goals are ready.")}catch{g.error("We couldn’t generate savings goals right now.")}};return a.jsx(E,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:78",children:a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:79",className:"space-y-8",children:[a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:80",className:"flex flex-col justify-between gap-4 lg:flex-row lg:items-end",children:[a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:81",children:[a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:82",className:"mb-3 flex items-center gap-2",children:[a.jsxs(I,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:82",className:"bg-blue-600",children:[a.jsx(M,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:82",className:"mr-1 h-3.5 w-3.5"}),"AI powered"]}),a.jsx("span",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:82",className:"text-sm text-muted-foreground",children:"Private to your account"})]}),a.jsx("h1",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:83",className:"text-3xl font-bold tracking-tight",children:"Financial Advisor"}),a.jsx("p",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:84",className:"mt-2 max-w-2xl text-muted-foreground",children:"Understand your spending habits, identify opportunities, and turn your priorities into practical savings goals."})]}),a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86",className:"flex items-center gap-2",children:[a.jsx(O,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86",className:"h-4 w-4 text-muted-foreground"}),a.jsxs(V,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86",value:d,onValueChange:T,children:[a.jsx(G,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86",className:"w-[150px]",children:a.jsx(W,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86"})}),a.jsxs(H,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86",children:[a.jsx(f,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86",value:"30",children:"Last 30 days"}),a.jsx(f,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86",value:"90",children:"Last 90 days"}),a.jsx(f,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:86",value:"180",children:"Last 6 months"})]})]})]})]}),a.jsxs(m,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:89",className:"border-amber-200 bg-amber-50 text-amber-950",children:[a.jsx(Q,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:89",className:"h-4 w-4"}),a.jsx(v,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:89",children:"Use insights as a planning aid"}),a.jsx(u,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:89",children:K})]}),i.isError?a.jsxs(m,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:92",variant:"destructive",children:[a.jsx(v,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:92",children:"Spending analysis unavailable"}),a.jsxs(u,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:92",className:"flex flex-wrap items-center gap-3",children:["We couldn’t read your account activity. ",a.jsxs(b,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:92",variant:"outline",size:"sm",onClick:()=>i.refetch(),children:[a.jsx($,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:92",className:"mr-2 h-4 w-4"}),"Retry"]})]})]}):a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:94",className:"grid gap-4 md:grid-cols-3",children:[a.jsxs(t,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:95",children:[a.jsxs(c,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:95",className:"pb-2",children:[a.jsx(n,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:95",children:"Recorded outflow"}),a.jsxs(l,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:95",className:"flex items-center gap-2 text-2xl",children:[a.jsx(U,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:95",className:"h-5 w-5 text-blue-600"}),"$",j.toFixed(2)]})]}),a.jsx(r,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:95",children:a.jsx("p",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:95",className:"text-xs text-muted-foreground",children:"Across the selected period"})})]}),a.jsxs(t,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:96",children:[a.jsxs(c,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:96",className:"pb-2",children:[a.jsx(n,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:96",children:"Recorded inflow"}),a.jsxs(l,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:96",className:"flex items-center gap-2 text-2xl",children:[a.jsx(L,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:96",className:"h-5 w-5 text-emerald-600"}),"$",z.toFixed(2)]})]}),a.jsx(r,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:96",children:a.jsx("p",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:96",className:"text-xs text-muted-foreground",children:"Money received into your accounts"})})]}),a.jsxs(t,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:97",children:[a.jsxs(c,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:97",className:"pb-2",children:[a.jsx(n,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:97",children:"Transactions reviewed"}),a.jsx(l,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:97",className:"text-2xl",children:i.data?.transactionCount??0})]}),a.jsx(r,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:97",children:a.jsx("p",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:97",className:"text-xs text-muted-foreground",children:"The assistant uses this activity to find patterns"})})]})]}),a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:101",className:"grid gap-6 xl:grid-cols-[1.05fr_0.95fr]",children:[a.jsxs(t,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:102",children:[a.jsxs(c,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:103",children:[a.jsxs(l,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:103",className:"flex items-center gap-2",children:[a.jsx(L,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:103",className:"h-5 w-5 text-blue-600"}),"Spending patterns"]}),a.jsx(n,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:103",children:"Categories are based on transaction types and descriptions currently recorded by GlobalBank."})]}),a.jsx(r,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:104",children:i.isLoading?a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"space-y-3",children:[a.jsx(h,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"h-8"}),a.jsx(h,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"h-8"}),a.jsx(h,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"h-8"})]}):C.length===0?a.jsx("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground",children:"No transactions are available for this period yet."}):a.jsx("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"space-y-4",children:C.map(([s,e])=>{const y=j>0?Math.min(100,Number(e.total)/j*100):0;return a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",children:[a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"mb-1 flex items-center justify-between text-sm",children:[a.jsx("span",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"font-medium capitalize",children:s.replaceAll("_"," ")}),a.jsxs("span",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"text-muted-foreground",children:["$",Number(e.total).toFixed(2)," · ",e.count," txns"]})]}),a.jsx("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"h-2 overflow-hidden rounded-full bg-slate-100",children:a.jsx("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:105",className:"h-full rounded-full bg-blue-600 transition-all",style:{width:`${y}%`}})})]},s)})})})]}),a.jsxs(t,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:109",className:"border-indigo-200 bg-indigo-50/50",children:[a.jsxs(c,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:110",children:[a.jsxs(l,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:110",className:"flex items-center gap-2",children:[a.jsx(q,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:110",className:"h-5 w-5 text-indigo-600"}),"Personalized insights"]}),a.jsx(n,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:110",children:"Ask the assistant to explain patterns in plain language."})]}),a.jsxs(r,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:111",className:"space-y-4",children:[a.jsx(b,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:111",onClick:R,disabled:o.isFetching||i.isLoading,className:"w-full bg-indigo-600 hover:bg-indigo-700",children:o.isFetching?"Analyzing your activity…":"Analyze my spending"}),o.isError&&a.jsxs(m,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:111",variant:"destructive",children:[a.jsx(v,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:111",children:"Analysis failed"}),a.jsx(u,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:111",children:"Try again in a moment."})]}),o.data&&a.jsx("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:111",className:"rounded-xl border bg-white p-4 text-sm leading-6 whitespace-pre-wrap",children:o.data.insights})]})]})]}),a.jsxs(t,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:115",children:[a.jsxs(c,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:116",children:[a.jsxs(l,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:116",className:"flex items-center gap-2",children:[a.jsx(Y,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:116",className:"h-5 w-5 text-emerald-600"}),"Savings goals built around you"]}),a.jsx(n,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:116",children:"Recommendations are generated from your selected period and should be adju
22sted to fit your real priorities and obligations."})]}),a.jsxs(r,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"space-y-4",children:[a.jsx(b,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",variant:"outline",onClick:_,disabled:x.isFetching||i.isLoading,children:x.isFetching?"Building recommendations…":"Suggest savings goals"}),x.isError&&a.jsxs(m,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",variant:"destructive",children:[a.jsx(v,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",children:"Goal generation failed"}),a.jsx(u,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",children:"Try again in a moment."})]}),x.data?.goals?.length?a.jsx("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"grid gap-4 md:grid-cols-3",children:x.data.goals.map((s,e)=>a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"rounded-xl border bg-white p-4",children:[a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"mb-2 flex items-start justify-between gap-2",children:[a.jsx("h3",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"font-semibold",children:s.title||"Savings goal"}),a.jsx(I,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",variant:"outline",className:"capitalize",children:s.priority||"medium"})]}),a.jsx("p",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"mb-4 text-sm text-muted-foreground",children:s.description||"A practical goal based on your recent activity."}),a.jsxs("div",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"flex items-center justify-between text-sm",children:[a.jsxs("span",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"font-semibold text-emerald-700",children:["$",s.targetAmount||"—"]}),a.jsx("span",{"data-loc":"client/src/pages/FinancialAdvisor.tsx:117",className:"text-muted-foreground",children:s.timeframe||"Flexible"})]})]},`${s.title??"goal"}-${e}`))}):null]})]}),a.jsxs(t,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",children:[a.jsxs(c,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",children:[a.jsxs(l,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",className:"flex items-center gap-2",children:[a.jsx(M,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",className:"h-5 w-5 text-blue-600"}),"Ask your financial assistant"]}),a.jsx(n,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",children:"Ask about spending patterns, budgeting approaches, or how to make a goal more achievable."})]}),a.jsx(r,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",children:a.jsx(A.Suspense,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",fallback:a.jsx(h,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",className:"h-[420px] w-full"}),children:a.jsx(J,{"data-loc":"client/src/pages/FinancialAdvisor.tsx:120",messages:w,onSendMessage:D,isLoading:S.isPending,height:420,suggestedPrompts:["What is my biggest spending pattern?","Suggest a realistic emergency fund goal","How can I reduce unnecessary spending?"],emptyStateMessage:"Start a conversation about your money. I’ll use your recent activity to make the discussion more relevant."})})})]})]})})}export{na 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.