@burdenoff/microfe-subscriberbot 2026.1102.2 → 2026.1102.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts +12 -0
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +1 -0
- package/dist/stories/pages/InsightsPage.stories.d.ts +1 -0
- package/dist/stories/pages/InsightsPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/RenewalsPage.stories.d.ts +18 -0
- package/dist/stories/pages/RenewalsPage.stories.d.ts.map +1 -0
- package/dist/stories/support/bankingFixtures.d.ts +8 -0
- package/dist/stories/support/bankingFixtures.d.ts.map +1 -0
- package/dist/stories/support/fixtures.d.ts +2 -1
- package/dist/stories/support/fixtures.d.ts.map +1 -1
- package/dist/stories/support/handlers.d.ts.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoot.d.ts.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoot.js +64 -48
- package/dist/subscriberbot/SubscriberBotRoot.js.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoutes.d.ts.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoutes.js +21 -13
- package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.js +3 -0
- package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
- package/dist/subscriberbot/hooks/index.d.ts +1 -1
- package/dist/subscriberbot/hooks/index.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/useBankingApi.d.ts +31 -0
- package/dist/subscriberbot/hooks/useBankingApi.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useBankingApi.js +105 -0
- package/dist/subscriberbot/hooks/useBankingApi.js.map +1 -0
- package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts +8 -1
- package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js +87 -36
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.js +12 -3
- package/dist/subscriberbot/pages/InsightsPage.js.map +1 -1
- package/dist/subscriberbot/pages/RenewalsPage.d.ts +4 -0
- package/dist/subscriberbot/pages/RenewalsPage.d.ts.map +1 -0
- package/dist/subscriberbot/pages/RenewalsPage.js +582 -0
- package/dist/subscriberbot/pages/RenewalsPage.js.map +1 -0
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts +11 -0
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -0
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +564 -0
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -0
- package/dist/subscriberbot/types/banking.d.ts +86 -0
- package/dist/subscriberbot/types/banking.d.ts.map +1 -0
- package/dist/subscriberbot/types/index.d.ts +79 -0
- package/dist/subscriberbot/types/index.d.ts.map +1 -1
- package/dist/subscriberbot/utils/plaidLink.d.ts +47 -0
- package/dist/subscriberbot/utils/plaidLink.d.ts.map +1 -0
- package/dist/subscriberbot/utils/plaidLink.js +35 -0
- package/dist/subscriberbot/utils/plaidLink.js.map +1 -0
- package/dist/subscriberbot/utils/renewals.d.ts +19 -0
- package/dist/subscriberbot/utils/renewals.d.ts.map +1 -0
- package/dist/subscriberbot/utils/renewals.js +26 -0
- package/dist/subscriberbot/utils/renewals.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import { useSubscriberBot as e } from "../../context/SubscriberBotContext.js";
|
|
2
|
+
import { cn as t } from "../../utils/cn.js";
|
|
3
|
+
import { PageLayout as n } from "../../components/PageLayout.js";
|
|
4
|
+
import { MetricsCard as r } from "../../components/MetricsCard.js";
|
|
5
|
+
import { formatCurrency as i, formatDate as a, formatIntervalSuffix as o } from "../../utils/formatters.js";
|
|
6
|
+
import { StatusBadge as s } from "../../components/StatusBadge.js";
|
|
7
|
+
import { EmptyState as c } from "../../components/EmptyState.js";
|
|
8
|
+
import { Modal as l } from "../../components/Modal.js";
|
|
9
|
+
import { useTr as ee } from "../../hooks/useTr.js";
|
|
10
|
+
import { ErrorView as u, LoadingView as d, Section as f } from "../../components/StateViews.js";
|
|
11
|
+
import "../../components/index.js";
|
|
12
|
+
import { useBankAggregators as p, useBankConnections as m, useCompleteBankLink as h, useCreateBankLinkSession as te, useDismissRecurringCharge as g, useImportBankStatement as ne, useRecurringCharges as _, useRemoveBankConnection as v, useRestoreRecurringCharge as y, useSyncBankConnection as b, useTrackRecurringCharge as x } from "../../hooks/useBankingApi.js";
|
|
13
|
+
import { openPlaidLink as S } from "../../utils/plaidLink.js";
|
|
14
|
+
import { useMemo as C, useState as w } from "react";
|
|
15
|
+
import { CalendarClock as T, FileUp as E, Landmark as re, Link2 as ie, RefreshCw as ae, Repeat as oe, ShieldCheck as se, Trash2 as ce } from "lucide-react";
|
|
16
|
+
import { Fragment as le, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
17
|
+
import { PagePurpose as ue } from "@burdenoff/fe-libs/ui";
|
|
18
|
+
//#region src/subscriberbot/pages/banking/BankConnectionsPage.tsx
|
|
19
|
+
var k = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", A = "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50", j = "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50", M = "inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-2.5 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50", de = [
|
|
20
|
+
"DETECTED",
|
|
21
|
+
"TRACKED",
|
|
22
|
+
"DISMISSED"
|
|
23
|
+
], N = {
|
|
24
|
+
DETECTED: {
|
|
25
|
+
key: "banking.charges.detected",
|
|
26
|
+
fallback: "To review"
|
|
27
|
+
},
|
|
28
|
+
TRACKED: {
|
|
29
|
+
key: "banking.charges.tracked",
|
|
30
|
+
fallback: "Tracked"
|
|
31
|
+
},
|
|
32
|
+
DISMISSED: {
|
|
33
|
+
key: "banking.charges.dismissed",
|
|
34
|
+
fallback: "Dismissed"
|
|
35
|
+
}
|
|
36
|
+
}, P = 2e6, F = (e) => e instanceof Error ? e.message : "Something went wrong";
|
|
37
|
+
function I() {
|
|
38
|
+
let l = ee(), { navigateTo: ne } = e(), [k, P] = w("DETECTED"), [I, L] = w(!1), [R, z] = w(null), [B, V] = w(!1), pe = p(), H = m(), U = _(k), W = _("DETECTED"), G = _("TRACKED"), me = te(), he = h(), K = b(), q = v(), J = x(), Y = g(), ge = y(), X = pe.data?.find((e) => e.aggregator === "PLAID"), Z = H.data?.items ?? [], _e = U.data?.items ?? [], ve = C(() => {
|
|
39
|
+
let e = /* @__PURE__ */ new Map();
|
|
40
|
+
for (let t of W.data?.items ?? []) e.set(t.currency, (e.get(t.currency) ?? 0) + t.annualCost);
|
|
41
|
+
return [...e.entries()].map(([e, t]) => i(t, e)).join(" + ");
|
|
42
|
+
}, [W.data]), Q = (e) => l("banking.notice.synced", "{{added}} new transaction(s) from {{institution}}; {{recurring}} recurring charge(s) found.", {
|
|
43
|
+
added: e.added,
|
|
44
|
+
institution: e.connection.institutionName,
|
|
45
|
+
recurring: e.recurringDetected
|
|
46
|
+
}), ye = async () => {
|
|
47
|
+
z(null), V(!0);
|
|
48
|
+
try {
|
|
49
|
+
let e = await S((await me.mutateAsync({ aggregator: "PLAID" })).linkToken);
|
|
50
|
+
if (!e) return;
|
|
51
|
+
z({
|
|
52
|
+
tone: "success",
|
|
53
|
+
text: Q(await he.mutateAsync({ input: {
|
|
54
|
+
aggregator: "PLAID",
|
|
55
|
+
publicToken: e.publicToken,
|
|
56
|
+
institutionId: e.institutionId,
|
|
57
|
+
institutionName: e.institutionName
|
|
58
|
+
} }))
|
|
59
|
+
});
|
|
60
|
+
} catch (e) {
|
|
61
|
+
z({
|
|
62
|
+
tone: "error",
|
|
63
|
+
text: F(e)
|
|
64
|
+
});
|
|
65
|
+
} finally {
|
|
66
|
+
V(!1);
|
|
67
|
+
}
|
|
68
|
+
}, be = async (e) => {
|
|
69
|
+
z(null);
|
|
70
|
+
try {
|
|
71
|
+
z({
|
|
72
|
+
tone: "success",
|
|
73
|
+
text: Q(await K.mutateAsync({ id: e.id }))
|
|
74
|
+
});
|
|
75
|
+
} catch (e) {
|
|
76
|
+
z({
|
|
77
|
+
tone: "error",
|
|
78
|
+
text: F(e)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, xe = async (e) => {
|
|
82
|
+
if (window.confirm(l("banking.disconnect.confirm", "Disconnect {{institution}}? Its accounts and transactions are deleted from Subscriber Bot. Subscriptions you already track stay.", { institution: e.institutionName }))) {
|
|
83
|
+
z(null);
|
|
84
|
+
try {
|
|
85
|
+
await q.mutateAsync({ id: e.id }), z({
|
|
86
|
+
tone: "success",
|
|
87
|
+
text: l("banking.notice.disconnected", "{{institution}} was disconnected.", { institution: e.institutionName })
|
|
88
|
+
});
|
|
89
|
+
} catch (e) {
|
|
90
|
+
z({
|
|
91
|
+
tone: "error",
|
|
92
|
+
text: F(e)
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, $ = async (e, t) => {
|
|
97
|
+
z(null);
|
|
98
|
+
try {
|
|
99
|
+
let n = await {
|
|
100
|
+
track: J,
|
|
101
|
+
dismiss: Y,
|
|
102
|
+
restore: ge
|
|
103
|
+
}[e].mutateAsync({ id: t.id });
|
|
104
|
+
e === "track" && z({
|
|
105
|
+
tone: "success",
|
|
106
|
+
text: l("banking.notice.tracked", "{{name}} is now tracked as a subscription.", { name: n.displayName })
|
|
107
|
+
});
|
|
108
|
+
} catch (e) {
|
|
109
|
+
z({
|
|
110
|
+
tone: "error",
|
|
111
|
+
text: F(e)
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, Se = /* @__PURE__ */ O("div", {
|
|
115
|
+
className: "flex flex-wrap gap-2",
|
|
116
|
+
children: [/* @__PURE__ */ O("button", {
|
|
117
|
+
type: "button",
|
|
118
|
+
className: j,
|
|
119
|
+
onClick: () => L(!0),
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ D(E, {
|
|
122
|
+
className: "h-4 w-4",
|
|
123
|
+
"aria-hidden": !0
|
|
124
|
+
}),
|
|
125
|
+
" ",
|
|
126
|
+
l("banking.import.open", "Import a statement")
|
|
127
|
+
]
|
|
128
|
+
}), /* @__PURE__ */ O("button", {
|
|
129
|
+
type: "button",
|
|
130
|
+
className: A,
|
|
131
|
+
onClick: () => void ye(),
|
|
132
|
+
disabled: !X?.available || B,
|
|
133
|
+
title: X?.available ? void 0 : l("banking.plaid.unavailable", "Bank linking is not switched on yet. Import a statement instead."),
|
|
134
|
+
children: [/* @__PURE__ */ D(ie, {
|
|
135
|
+
className: "h-4 w-4",
|
|
136
|
+
"aria-hidden": !0
|
|
137
|
+
}), B ? l("banking.plaid.linking", "Connecting…") : l("banking.plaid.connect", "Connect a bank")]
|
|
138
|
+
})]
|
|
139
|
+
});
|
|
140
|
+
return /* @__PURE__ */ O(n, {
|
|
141
|
+
title: l("banking.title", "Bank & card connections"),
|
|
142
|
+
description: l("banking.description", "Find every subscription in your bank and card transactions."),
|
|
143
|
+
actions: Se,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ D(ue, {
|
|
146
|
+
className: "mb-6",
|
|
147
|
+
children: l("banking.purpose", "Connect a US bank or card through Plaid, or import the CSV export any bank lets you download. Subscriber Bot spots the charges that repeat every week, month, quarter or year so you can track them or wave them off. Your bank password is never shared with Subscriber Bot, and only you can see these accounts.")
|
|
148
|
+
}),
|
|
149
|
+
X && !X.available && /* @__PURE__ */ O("p", {
|
|
150
|
+
className: "mb-4 flex items-start gap-2 rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-secondary",
|
|
151
|
+
"data-testid": "plaid-unavailable",
|
|
152
|
+
children: [/* @__PURE__ */ D(se, {
|
|
153
|
+
className: "mt-0.5 h-4 w-4 shrink-0",
|
|
154
|
+
"aria-hidden": !0
|
|
155
|
+
}), l("banking.plaid.unavailableLong", "Direct bank linking is being switched on. Until then, import a statement export: it finds the same recurring charges.")]
|
|
156
|
+
}),
|
|
157
|
+
R && /* @__PURE__ */ D("p", {
|
|
158
|
+
role: R.tone === "error" ? "alert" : "status",
|
|
159
|
+
className: t("mb-4 rounded-lg px-3 py-2 text-sm", R.tone === "error" ? "bg-status-error-bg-subtle text-status-error-text" : "bg-status-success-bg-subtle text-status-success-text"),
|
|
160
|
+
"data-testid": "banking-notice",
|
|
161
|
+
children: R.text
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ O("div", {
|
|
164
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ D(r, {
|
|
167
|
+
icon: /* @__PURE__ */ D(re, { className: "h-5 w-5" }),
|
|
168
|
+
value: H.isLoading ? "—" : Z.length,
|
|
169
|
+
label: l("banking.metrics.connections", "Connected accounts")
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ D(r, {
|
|
172
|
+
icon: /* @__PURE__ */ D(oe, { className: "h-5 w-5" }),
|
|
173
|
+
value: W.isLoading ? "—" : W.data?.items.length ?? 0,
|
|
174
|
+
label: l("banking.metrics.detected", "Charges to review")
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ D(r, {
|
|
177
|
+
icon: /* @__PURE__ */ D(T, { className: "h-5 w-5" }),
|
|
178
|
+
value: W.isLoading ? "—" : ve || i(0, "USD"),
|
|
179
|
+
label: l("banking.metrics.yearly", "Yearly cost to review")
|
|
180
|
+
}),
|
|
181
|
+
/* @__PURE__ */ D(r, {
|
|
182
|
+
icon: /* @__PURE__ */ D(se, { className: "h-5 w-5" }),
|
|
183
|
+
value: G.isLoading ? "—" : G.data?.items.length ?? 0,
|
|
184
|
+
label: l("banking.metrics.tracked", "Tracked from your bank")
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
}),
|
|
188
|
+
/* @__PURE__ */ O(f, {
|
|
189
|
+
title: l("banking.charges.title", "Recurring charges found"),
|
|
190
|
+
description: l("banking.charges.description", "Charges from the same merchant at a steady amount and rhythm."),
|
|
191
|
+
children: [/* @__PURE__ */ D("div", {
|
|
192
|
+
role: "tablist",
|
|
193
|
+
"aria-label": l("banking.charges.filter", "Charge status"),
|
|
194
|
+
className: "mb-3 flex gap-1.5",
|
|
195
|
+
children: de.map((e) => /* @__PURE__ */ D("button", {
|
|
196
|
+
type: "button",
|
|
197
|
+
role: "tab",
|
|
198
|
+
"aria-selected": k === e,
|
|
199
|
+
onClick: () => P(e),
|
|
200
|
+
className: t("rounded-lg px-3 py-1.5 text-xs font-medium", k === e ? "bg-action-primary-bg text-action-primary-text" : "border border-border-subtle text-text-primary hover:bg-bg-sunken"),
|
|
201
|
+
children: l(N[e].key, N[e].fallback)
|
|
202
|
+
}, e))
|
|
203
|
+
}), U.isLoading ? /* @__PURE__ */ D(d, { label: l("banking.charges.loading", "Loading recurring charges…") }) : U.isError ? /* @__PURE__ */ D(u, {
|
|
204
|
+
message: F(U.error),
|
|
205
|
+
onRetry: () => void U.refetch()
|
|
206
|
+
}) : _e.length === 0 ? /* @__PURE__ */ D(c, {
|
|
207
|
+
illustration: "empty-data",
|
|
208
|
+
title: l("banking.charges.empty.title", "Nothing here yet"),
|
|
209
|
+
description: l("banking.charges.empty.description", "Import a statement with at least two months of transactions, or connect a bank, and repeating charges show up here.")
|
|
210
|
+
}) : /* @__PURE__ */ D("ul", {
|
|
211
|
+
className: "grid grid-cols-1 gap-3 lg:grid-cols-2",
|
|
212
|
+
"data-testid": "recurring-charge-list",
|
|
213
|
+
children: _e.map((e) => /* @__PURE__ */ O("li", {
|
|
214
|
+
className: "rounded-xl border border-border-subtle bg-bg-surface p-4",
|
|
215
|
+
"data-testid": "recurring-charge",
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ O("div", {
|
|
218
|
+
className: "flex items-start justify-between gap-3",
|
|
219
|
+
children: [/* @__PURE__ */ O("div", {
|
|
220
|
+
className: "min-w-0",
|
|
221
|
+
children: [/* @__PURE__ */ D("p", {
|
|
222
|
+
className: "truncate text-sm font-semibold text-text-primary",
|
|
223
|
+
children: e.displayName
|
|
224
|
+
}), /* @__PURE__ */ D("p", {
|
|
225
|
+
className: "mt-0.5 text-xs text-text-secondary",
|
|
226
|
+
children: l("banking.charges.meta", "{{count}} charges since {{first}} · {{confidence}}% sure", {
|
|
227
|
+
count: e.occurrences,
|
|
228
|
+
first: a(e.firstChargedOn),
|
|
229
|
+
confidence: e.confidence
|
|
230
|
+
})
|
|
231
|
+
})]
|
|
232
|
+
}), /* @__PURE__ */ O("span", {
|
|
233
|
+
className: "shrink-0 text-sm font-semibold text-text-primary",
|
|
234
|
+
children: [i(e.lastAmount, e.currency), o(e.interval)]
|
|
235
|
+
})]
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ O("p", {
|
|
238
|
+
className: "mt-2 text-xs text-text-secondary",
|
|
239
|
+
children: [
|
|
240
|
+
l("banking.charges.dates", "Last charged {{last}}", { last: a(e.lastChargedOn) }),
|
|
241
|
+
e.nextExpectedOn && ` · ${l("banking.charges.next", "next expected {{next}}", { next: a(e.nextExpectedOn) })}`,
|
|
242
|
+
` · ${l("banking.charges.yearly", "{{amount}} a year", { amount: i(e.annualCost, e.currency) })}`
|
|
243
|
+
]
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ O("div", {
|
|
246
|
+
className: "mt-3 flex flex-wrap gap-2",
|
|
247
|
+
children: [
|
|
248
|
+
e.status === "DETECTED" && /* @__PURE__ */ O(le, { children: [/* @__PURE__ */ D("button", {
|
|
249
|
+
type: "button",
|
|
250
|
+
className: A,
|
|
251
|
+
onClick: () => void $("track", e),
|
|
252
|
+
disabled: J.isPending,
|
|
253
|
+
children: l("banking.charges.track", "Track as subscription")
|
|
254
|
+
}), /* @__PURE__ */ D("button", {
|
|
255
|
+
type: "button",
|
|
256
|
+
className: j,
|
|
257
|
+
onClick: () => void $("dismiss", e),
|
|
258
|
+
disabled: Y.isPending,
|
|
259
|
+
children: l("banking.charges.dismiss", "Not a subscription")
|
|
260
|
+
})] }),
|
|
261
|
+
e.status === "TRACKED" && e.relationshipId && /* @__PURE__ */ D("button", {
|
|
262
|
+
type: "button",
|
|
263
|
+
className: j,
|
|
264
|
+
onClick: () => ne(`/relationships/${e.relationshipId}`),
|
|
265
|
+
children: l("banking.charges.view", "View subscription")
|
|
266
|
+
}),
|
|
267
|
+
e.status === "DISMISSED" && /* @__PURE__ */ D("button", {
|
|
268
|
+
type: "button",
|
|
269
|
+
className: j,
|
|
270
|
+
onClick: () => void $("restore", e),
|
|
271
|
+
disabled: ge.isPending,
|
|
272
|
+
children: l("banking.charges.restore", "Review again")
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
}, e.id))
|
|
278
|
+
})]
|
|
279
|
+
}),
|
|
280
|
+
/* @__PURE__ */ D(f, {
|
|
281
|
+
title: l("banking.connections.title", "Your connections"),
|
|
282
|
+
description: l("banking.connections.description", "Disconnecting deletes the accounts and transactions from Subscriber Bot."),
|
|
283
|
+
children: H.isLoading ? /* @__PURE__ */ D(d, { label: l("banking.connections.loading", "Loading connections…") }) : H.isError ? /* @__PURE__ */ D(u, {
|
|
284
|
+
message: F(H.error),
|
|
285
|
+
onRetry: () => void H.refetch()
|
|
286
|
+
}) : Z.length === 0 ? /* @__PURE__ */ D(c, {
|
|
287
|
+
illustration: "empty-data",
|
|
288
|
+
title: l("banking.connections.empty.title", "No bank or card connected"),
|
|
289
|
+
description: l("banking.connections.empty.description", "Download a CSV of your transactions from your bank or card website and import it, or connect a bank."),
|
|
290
|
+
action: /* @__PURE__ */ O("button", {
|
|
291
|
+
type: "button",
|
|
292
|
+
className: A,
|
|
293
|
+
onClick: () => L(!0),
|
|
294
|
+
children: [
|
|
295
|
+
/* @__PURE__ */ D(E, {
|
|
296
|
+
className: "h-4 w-4",
|
|
297
|
+
"aria-hidden": !0
|
|
298
|
+
}),
|
|
299
|
+
" ",
|
|
300
|
+
l("banking.import.open", "Import a statement")
|
|
301
|
+
]
|
|
302
|
+
})
|
|
303
|
+
}) : /* @__PURE__ */ D("ul", {
|
|
304
|
+
className: "space-y-3",
|
|
305
|
+
"data-testid": "bank-connection-list",
|
|
306
|
+
children: Z.map((e) => /* @__PURE__ */ O("li", {
|
|
307
|
+
className: "flex flex-col gap-3 rounded-xl border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between",
|
|
308
|
+
"data-testid": "bank-connection",
|
|
309
|
+
children: [/* @__PURE__ */ O("div", {
|
|
310
|
+
className: "min-w-0",
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ O("div", {
|
|
313
|
+
className: "flex items-center gap-2",
|
|
314
|
+
children: [/* @__PURE__ */ D("p", {
|
|
315
|
+
className: "truncate text-sm font-semibold text-text-primary",
|
|
316
|
+
children: e.institutionName
|
|
317
|
+
}), /* @__PURE__ */ D(s, { status: e.status })]
|
|
318
|
+
}),
|
|
319
|
+
/* @__PURE__ */ O("p", {
|
|
320
|
+
className: "mt-0.5 text-xs text-text-secondary",
|
|
321
|
+
children: [
|
|
322
|
+
e.aggregator === "PLAID" ? l("banking.connections.viaPlaid", "Linked with Plaid") : l("banking.connections.viaImport", "Statement import"),
|
|
323
|
+
" · ",
|
|
324
|
+
e.accounts.map((e) => e.mask ? `${e.name} ••${e.mask}` : e.name).join(", ") || l("banking.connections.noAccounts", "no accounts yet"),
|
|
325
|
+
" · ",
|
|
326
|
+
l("banking.connections.count", "{{count}} transactions", { count: e.transactionCount }),
|
|
327
|
+
e.lastSyncedAt && ` · ${l("banking.connections.synced", "updated {{date}}", { date: a(e.lastSyncedAt) })}`
|
|
328
|
+
]
|
|
329
|
+
}),
|
|
330
|
+
e.lastSyncError && /* @__PURE__ */ D("p", {
|
|
331
|
+
className: "mt-1 text-xs text-status-error-text",
|
|
332
|
+
children: e.lastSyncError
|
|
333
|
+
})
|
|
334
|
+
]
|
|
335
|
+
}), /* @__PURE__ */ O("div", {
|
|
336
|
+
className: "flex shrink-0 gap-2",
|
|
337
|
+
children: [e.aggregator === "PLAID" && /* @__PURE__ */ O("button", {
|
|
338
|
+
type: "button",
|
|
339
|
+
className: M,
|
|
340
|
+
onClick: () => void be(e),
|
|
341
|
+
disabled: K.isPending || !X?.available,
|
|
342
|
+
children: [
|
|
343
|
+
/* @__PURE__ */ D(ae, {
|
|
344
|
+
className: "h-3.5 w-3.5",
|
|
345
|
+
"aria-hidden": !0
|
|
346
|
+
}),
|
|
347
|
+
" ",
|
|
348
|
+
l("banking.connections.sync", "Sync")
|
|
349
|
+
]
|
|
350
|
+
}), /* @__PURE__ */ O("button", {
|
|
351
|
+
type: "button",
|
|
352
|
+
className: M,
|
|
353
|
+
onClick: () => void xe(e),
|
|
354
|
+
disabled: q.isPending,
|
|
355
|
+
children: [
|
|
356
|
+
/* @__PURE__ */ D(ce, {
|
|
357
|
+
className: "h-3.5 w-3.5",
|
|
358
|
+
"aria-hidden": !0
|
|
359
|
+
}),
|
|
360
|
+
" ",
|
|
361
|
+
l("banking.connections.disconnect", "Disconnect")
|
|
362
|
+
]
|
|
363
|
+
})]
|
|
364
|
+
})]
|
|
365
|
+
}, e.id))
|
|
366
|
+
})
|
|
367
|
+
}),
|
|
368
|
+
I && /* @__PURE__ */ D(fe, {
|
|
369
|
+
connections: Z.filter((e) => e.aggregator === "STATEMENT_IMPORT"),
|
|
370
|
+
onClose: () => L(!1),
|
|
371
|
+
onImported: (e) => {
|
|
372
|
+
L(!1), P("DETECTED"), z({
|
|
373
|
+
tone: "success",
|
|
374
|
+
text: Q(e)
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
})
|
|
378
|
+
]
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
function fe({ connections: e, onClose: n, onImported: r }) {
|
|
382
|
+
let i = ee(), a = ne(), [o, s] = w(""), [c, u] = w(""), [d, f] = w(""), [p, m] = w(""), [h, te] = w("USD"), [g, _] = w("OUTFLOW_NEGATIVE"), [v, y] = w("MDY"), [b, x] = w(""), [S, C] = w(null), T = async (e) => {
|
|
383
|
+
if (C(null), x(""), e) {
|
|
384
|
+
if (e.size > P) {
|
|
385
|
+
C(i("banking.import.tooLarge", "That file is larger than 2 MB. Export a shorter date range."));
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
x(await e.text());
|
|
389
|
+
}
|
|
390
|
+
}, E = async (e) => {
|
|
391
|
+
if (e.preventDefault(), C(null), !b.trim()) {
|
|
392
|
+
C(i("banking.import.required", "Choose a CSV file or paste the statement."));
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
r(await a.mutateAsync({ input: {
|
|
397
|
+
connectionId: o || null,
|
|
398
|
+
institutionName: o ? null : c || null,
|
|
399
|
+
accountName: d || null,
|
|
400
|
+
accountMask: p || null,
|
|
401
|
+
currency: h || "USD",
|
|
402
|
+
csv: b,
|
|
403
|
+
amountConvention: g,
|
|
404
|
+
dateFormat: v
|
|
405
|
+
} }));
|
|
406
|
+
} catch (e) {
|
|
407
|
+
C(F(e));
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
return /* @__PURE__ */ D(l, {
|
|
411
|
+
title: i("banking.import.title", "Import a bank or card statement"),
|
|
412
|
+
description: i("banking.import.description", "Download your transactions as CSV from your bank or card website (two months or more works best)."),
|
|
413
|
+
onClose: n,
|
|
414
|
+
maxWidthClassName: "max-w-xl",
|
|
415
|
+
children: /* @__PURE__ */ O("form", {
|
|
416
|
+
onSubmit: (e) => void E(e),
|
|
417
|
+
className: "space-y-3",
|
|
418
|
+
"data-testid": "import-statement-form",
|
|
419
|
+
children: [
|
|
420
|
+
e.length > 0 && /* @__PURE__ */ O("label", {
|
|
421
|
+
className: "block text-sm text-text-primary",
|
|
422
|
+
children: [i("banking.import.target", "Add to"), /* @__PURE__ */ O("select", {
|
|
423
|
+
className: t(k, "mt-1"),
|
|
424
|
+
value: o,
|
|
425
|
+
onChange: (e) => s(e.target.value),
|
|
426
|
+
children: [/* @__PURE__ */ D("option", {
|
|
427
|
+
value: "",
|
|
428
|
+
children: i("banking.import.newConnection", "A new connection")
|
|
429
|
+
}), e.map((e) => /* @__PURE__ */ D("option", {
|
|
430
|
+
value: e.id,
|
|
431
|
+
children: e.institutionName
|
|
432
|
+
}, e.id))]
|
|
433
|
+
})]
|
|
434
|
+
}),
|
|
435
|
+
!o && /* @__PURE__ */ O("label", {
|
|
436
|
+
className: "block text-sm text-text-primary",
|
|
437
|
+
children: [i("banking.import.institution", "Bank or card issuer"), /* @__PURE__ */ D("input", {
|
|
438
|
+
className: t(k, "mt-1"),
|
|
439
|
+
value: c,
|
|
440
|
+
onChange: (e) => u(e.target.value),
|
|
441
|
+
placeholder: i("banking.import.institutionPlaceholder", "e.g. Chase"),
|
|
442
|
+
maxLength: 255
|
|
443
|
+
})]
|
|
444
|
+
}),
|
|
445
|
+
/* @__PURE__ */ O("div", {
|
|
446
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
|
|
447
|
+
children: [/* @__PURE__ */ O("label", {
|
|
448
|
+
className: "block text-sm text-text-primary sm:col-span-2",
|
|
449
|
+
children: [i("banking.import.account", "Account name"), /* @__PURE__ */ D("input", {
|
|
450
|
+
className: t(k, "mt-1"),
|
|
451
|
+
value: d,
|
|
452
|
+
onChange: (e) => f(e.target.value),
|
|
453
|
+
placeholder: i("banking.import.accountPlaceholder", "e.g. Sapphire card"),
|
|
454
|
+
maxLength: 255
|
|
455
|
+
})]
|
|
456
|
+
}), /* @__PURE__ */ O("label", {
|
|
457
|
+
className: "block text-sm text-text-primary",
|
|
458
|
+
children: [i("banking.import.mask", "Last 4 digits"), /* @__PURE__ */ D("input", {
|
|
459
|
+
className: t(k, "mt-1"),
|
|
460
|
+
value: p,
|
|
461
|
+
onChange: (e) => m(e.target.value.replace(/\D/g, "").slice(-4)),
|
|
462
|
+
inputMode: "numeric",
|
|
463
|
+
maxLength: 4
|
|
464
|
+
})]
|
|
465
|
+
})]
|
|
466
|
+
}),
|
|
467
|
+
/* @__PURE__ */ O("div", {
|
|
468
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
|
|
469
|
+
children: [
|
|
470
|
+
/* @__PURE__ */ O("label", {
|
|
471
|
+
className: "block text-sm text-text-primary",
|
|
472
|
+
children: [i("banking.import.currency", "Currency"), /* @__PURE__ */ D("input", {
|
|
473
|
+
className: t(k, "mt-1 uppercase"),
|
|
474
|
+
value: h,
|
|
475
|
+
onChange: (e) => te(e.target.value.toUpperCase().slice(0, 3)),
|
|
476
|
+
maxLength: 3
|
|
477
|
+
})]
|
|
478
|
+
}),
|
|
479
|
+
/* @__PURE__ */ O("label", {
|
|
480
|
+
className: "block text-sm text-text-primary",
|
|
481
|
+
children: [i("banking.import.convention", "Money out is"), /* @__PURE__ */ O("select", {
|
|
482
|
+
className: t(k, "mt-1"),
|
|
483
|
+
value: g,
|
|
484
|
+
onChange: (e) => _(e.target.value),
|
|
485
|
+
children: [/* @__PURE__ */ D("option", {
|
|
486
|
+
value: "OUTFLOW_NEGATIVE",
|
|
487
|
+
children: i("banking.import.negative", "Negative (bank)")
|
|
488
|
+
}), /* @__PURE__ */ D("option", {
|
|
489
|
+
value: "OUTFLOW_POSITIVE",
|
|
490
|
+
children: i("banking.import.positive", "Positive (card)")
|
|
491
|
+
})]
|
|
492
|
+
})]
|
|
493
|
+
}),
|
|
494
|
+
/* @__PURE__ */ O("label", {
|
|
495
|
+
className: "block text-sm text-text-primary",
|
|
496
|
+
children: [i("banking.import.dateFormat", "Date format"), /* @__PURE__ */ O("select", {
|
|
497
|
+
className: t(k, "mt-1"),
|
|
498
|
+
value: v,
|
|
499
|
+
onChange: (e) => y(e.target.value),
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ D("option", {
|
|
502
|
+
value: "MDY",
|
|
503
|
+
children: "MM/DD/YYYY"
|
|
504
|
+
}),
|
|
505
|
+
/* @__PURE__ */ D("option", {
|
|
506
|
+
value: "DMY",
|
|
507
|
+
children: "DD/MM/YYYY"
|
|
508
|
+
}),
|
|
509
|
+
/* @__PURE__ */ D("option", {
|
|
510
|
+
value: "YMD",
|
|
511
|
+
children: "YYYY-MM-DD"
|
|
512
|
+
})
|
|
513
|
+
]
|
|
514
|
+
})]
|
|
515
|
+
})
|
|
516
|
+
]
|
|
517
|
+
}),
|
|
518
|
+
/* @__PURE__ */ O("label", {
|
|
519
|
+
className: "block text-sm text-text-primary",
|
|
520
|
+
children: [i("banking.import.file", "CSV file"), /* @__PURE__ */ D("input", {
|
|
521
|
+
type: "file",
|
|
522
|
+
accept: ".csv,text/csv,text/plain",
|
|
523
|
+
className: t(k, "mt-1"),
|
|
524
|
+
onChange: (e) => void T(e.target.files?.[0]),
|
|
525
|
+
"data-testid": "import-statement-file"
|
|
526
|
+
})]
|
|
527
|
+
}),
|
|
528
|
+
/* @__PURE__ */ O("label", {
|
|
529
|
+
className: "block text-sm text-text-primary",
|
|
530
|
+
children: [i("banking.import.paste", "Or paste the statement"), /* @__PURE__ */ D("textarea", {
|
|
531
|
+
className: t(k, "mt-1 h-32 font-mono text-xs"),
|
|
532
|
+
value: b,
|
|
533
|
+
onChange: (e) => x(e.target.value),
|
|
534
|
+
placeholder: "Date,Description,Amount\n10/05/2026,NETFLIX.COM,-15.49",
|
|
535
|
+
"data-testid": "import-statement-csv"
|
|
536
|
+
})]
|
|
537
|
+
}),
|
|
538
|
+
S && /* @__PURE__ */ D("p", {
|
|
539
|
+
role: "alert",
|
|
540
|
+
className: "text-sm text-status-error-text",
|
|
541
|
+
children: S
|
|
542
|
+
}),
|
|
543
|
+
/* @__PURE__ */ O("div", {
|
|
544
|
+
className: "flex justify-end gap-2 pt-1",
|
|
545
|
+
children: [/* @__PURE__ */ D("button", {
|
|
546
|
+
type: "button",
|
|
547
|
+
className: j,
|
|
548
|
+
onClick: n,
|
|
549
|
+
children: i("common.cancel", "Cancel")
|
|
550
|
+
}), /* @__PURE__ */ D("button", {
|
|
551
|
+
type: "submit",
|
|
552
|
+
className: A,
|
|
553
|
+
disabled: a.isPending,
|
|
554
|
+
children: a.isPending ? i("banking.import.submitting", "Importing…") : i("banking.import.submit", "Import and find subscriptions")
|
|
555
|
+
})]
|
|
556
|
+
})
|
|
557
|
+
]
|
|
558
|
+
})
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
//#endregion
|
|
562
|
+
export { I as BankConnectionsPage };
|
|
563
|
+
|
|
564
|
+
//# sourceMappingURL=BankConnectionsPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BankConnectionsPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/banking/BankConnectionsPage.tsx"],"sourcesContent":["/**\n * Bank & card connections\n * @module subscriberbot/pages/banking\n *\n * `/subscriberbot/banking` — link a bank or card through Plaid, or import a\n * statement export (CSV) from any bank, and review the recurring charges\n * Subscriber Bot found in the transactions: track each as a subscription or\n * dismiss it (BOFF-4161). Everything here belongs to the signed-in user only.\n */\n\nimport { useMemo, useState, type FormEvent } from 'react';\nimport {\n CalendarClock,\n FileUp,\n Landmark,\n Link2,\n RefreshCw,\n Repeat,\n ShieldCheck,\n Trash2,\n} from 'lucide-react';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport {\n EmptyState,\n ErrorView,\n LoadingView,\n MetricsCard,\n Modal,\n PageLayout,\n Section,\n StatusBadge,\n} from '../../components';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport {\n useBankAggregators,\n useBankConnections,\n useCompleteBankLink,\n useCreateBankLinkSession,\n useDismissRecurringCharge,\n useImportBankStatement,\n useRecurringCharges,\n useRemoveBankConnection,\n useRestoreRecurringCharge,\n useSyncBankConnection,\n useTrackRecurringCharge,\n} from '../../hooks/useBankingApi';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatDate, formatIntervalSuffix } from '../../utils/formatters';\nimport { openPlaidLink } from '../../utils/plaidLink';\nimport type {\n SubBankConnection,\n SubBankSyncResult,\n SubRecurringCharge,\n SubRecurringChargeStatus,\n SubStatementAmountConvention,\n SubStatementDateFormat,\n} from '../../types/banking';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst primaryBtn =\n 'inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50';\nconst secondaryBtn =\n 'inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\nconst smallBtn =\n 'inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-2.5 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\n\nconst CHARGE_FILTERS: SubRecurringChargeStatus[] = ['DETECTED', 'TRACKED', 'DISMISSED'];\nconst CHARGE_FILTER_LABEL: Record<SubRecurringChargeStatus, { key: string; fallback: string }> = {\n DETECTED: { key: 'banking.charges.detected', fallback: 'To review' },\n TRACKED: { key: 'banking.charges.tracked', fallback: 'Tracked' },\n DISMISSED: { key: 'banking.charges.dismissed', fallback: 'Dismissed' },\n};\nconst MAX_FILE_BYTES = 2_000_000;\n\nconst errorText = (error: unknown): string =>\n error instanceof Error ? error.message : 'Something went wrong';\n\ninterface Notice {\n tone: 'success' | 'error';\n text: string;\n}\n\nexport function BankConnectionsPage() {\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const [filter, setFilter] = useState<SubRecurringChargeStatus>('DETECTED');\n const [importOpen, setImportOpen] = useState(false);\n const [notice, setNotice] = useState<Notice | null>(null);\n const [linking, setLinking] = useState(false);\n\n const aggregators = useBankAggregators();\n const connections = useBankConnections();\n const charges = useRecurringCharges(filter);\n const detected = useRecurringCharges('DETECTED');\n const tracked = useRecurringCharges('TRACKED');\n\n const createLink = useCreateBankLinkSession();\n const completeLink = useCompleteBankLink();\n const sync = useSyncBankConnection();\n const remove = useRemoveBankConnection();\n const track = useTrackRecurringCharge();\n const dismiss = useDismissRecurringCharge();\n const restore = useRestoreRecurringCharge();\n\n const plaid = aggregators.data?.find((a) => a.aggregator === 'PLAID');\n const connectionItems = connections.data?.items ?? [];\n const chargeItems = charges.data?.items ?? [];\n\n const detectedYearly = useMemo(() => {\n const totals = new Map<string, number>();\n for (const c of detected.data?.items ?? []) {\n totals.set(c.currency, (totals.get(c.currency) ?? 0) + c.annualCost);\n }\n return [...totals.entries()]\n .map(([currency, amount]) => formatCurrency(amount, currency))\n .join(' + ');\n }, [detected.data]);\n\n const summarise = (result: SubBankSyncResult): string =>\n tr(\n 'banking.notice.synced',\n '{{added}} new transaction(s) from {{institution}}; {{recurring}} recurring charge(s) found.',\n {\n added: result.added,\n institution: result.connection.institutionName,\n recurring: result.recurringDetected,\n }\n );\n\n const connectBank = async () => {\n setNotice(null);\n setLinking(true);\n try {\n const session = await createLink.mutateAsync({ aggregator: 'PLAID' });\n const linked = await openPlaidLink(session.linkToken);\n if (!linked) return;\n const result = await completeLink.mutateAsync({\n input: {\n aggregator: 'PLAID',\n publicToken: linked.publicToken,\n institutionId: linked.institutionId,\n institutionName: linked.institutionName,\n },\n });\n setNotice({ tone: 'success', text: summarise(result) });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error) });\n } finally {\n setLinking(false);\n }\n };\n\n const runSync = async (connection: SubBankConnection) => {\n setNotice(null);\n try {\n setNotice({\n tone: 'success',\n text: summarise(await sync.mutateAsync({ id: connection.id })),\n });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error) });\n }\n };\n\n const disconnect = async (connection: SubBankConnection) => {\n const confirmed = window.confirm(\n tr(\n 'banking.disconnect.confirm',\n 'Disconnect {{institution}}? Its accounts and transactions are deleted from Subscriber Bot. Subscriptions you already track stay.',\n { institution: connection.institutionName }\n )\n );\n if (!confirmed) return;\n setNotice(null);\n try {\n await remove.mutateAsync({ id: connection.id });\n setNotice({\n tone: 'success',\n text: tr('banking.notice.disconnected', '{{institution}} was disconnected.', {\n institution: connection.institutionName,\n }),\n });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error) });\n }\n };\n\n const decide = async (action: 'track' | 'dismiss' | 'restore', charge: SubRecurringCharge) => {\n setNotice(null);\n try {\n const mutation = { track, dismiss, restore }[action];\n const updated = await mutation.mutateAsync({ id: charge.id });\n if (action === 'track') {\n setNotice({\n tone: 'success',\n text: tr('banking.notice.tracked', '{{name}} is now tracked as a subscription.', {\n name: updated.displayName,\n }),\n });\n }\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error) });\n }\n };\n\n const actions = (\n <div className=\"flex flex-wrap gap-2\">\n <button type=\"button\" className={secondaryBtn} onClick={() => setImportOpen(true)}>\n <FileUp className=\"h-4 w-4\" aria-hidden /> {tr('banking.import.open', 'Import a statement')}\n </button>\n <button\n type=\"button\"\n className={primaryBtn}\n onClick={() => void connectBank()}\n disabled={!plaid?.available || linking}\n title={\n plaid?.available\n ? undefined\n : tr(\n 'banking.plaid.unavailable',\n 'Bank linking is not switched on yet. Import a statement instead.'\n )\n }\n >\n <Link2 className=\"h-4 w-4\" aria-hidden />\n {linking\n ? tr('banking.plaid.linking', 'Connecting…')\n : tr('banking.plaid.connect', 'Connect a bank')}\n </button>\n </div>\n );\n\n return (\n <PageLayout\n title={tr('banking.title', 'Bank & card connections')}\n description={tr(\n 'banking.description',\n 'Find every subscription in your bank and card transactions.'\n )}\n actions={actions}\n >\n <PagePurpose className=\"mb-6\">\n {tr(\n 'banking.purpose',\n 'Connect a US bank or card through Plaid, or import the CSV export any bank lets you download. Subscriber Bot spots the charges that repeat every week, month, quarter or year so you can track them or wave them off. Your bank password is never shared with Subscriber Bot, and only you can see these accounts.'\n )}\n </PagePurpose>\n\n {plaid && !plaid.available && (\n <p\n className=\"mb-4 flex items-start gap-2 rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-secondary\"\n data-testid=\"plaid-unavailable\"\n >\n <ShieldCheck className=\"mt-0.5 h-4 w-4 shrink-0\" aria-hidden />\n {tr(\n 'banking.plaid.unavailableLong',\n 'Direct bank linking is being switched on. Until then, import a statement export: it finds the same recurring charges.'\n )}\n </p>\n )}\n\n {notice && (\n <p\n role={notice.tone === 'error' ? 'alert' : 'status'}\n className={cn(\n 'mb-4 rounded-lg px-3 py-2 text-sm',\n notice.tone === 'error'\n ? 'bg-status-error-bg-subtle text-status-error-text'\n : 'bg-status-success-bg-subtle text-status-success-text'\n )}\n data-testid=\"banking-notice\"\n >\n {notice.text}\n </p>\n )}\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <MetricsCard\n icon={<Landmark className=\"h-5 w-5\" />}\n value={connections.isLoading ? '—' : connectionItems.length}\n label={tr('banking.metrics.connections', 'Connected accounts')}\n />\n <MetricsCard\n icon={<Repeat className=\"h-5 w-5\" />}\n value={detected.isLoading ? '—' : (detected.data?.items.length ?? 0)}\n label={tr('banking.metrics.detected', 'Charges to review')}\n />\n <MetricsCard\n icon={<CalendarClock className=\"h-5 w-5\" />}\n value={detected.isLoading ? '—' : detectedYearly || formatCurrency(0, 'USD')}\n label={tr('banking.metrics.yearly', 'Yearly cost to review')}\n />\n <MetricsCard\n icon={<ShieldCheck className=\"h-5 w-5\" />}\n value={tracked.isLoading ? '—' : (tracked.data?.items.length ?? 0)}\n label={tr('banking.metrics.tracked', 'Tracked from your bank')}\n />\n </div>\n\n <Section\n title={tr('banking.charges.title', 'Recurring charges found')}\n description={tr(\n 'banking.charges.description',\n 'Charges from the same merchant at a steady amount and rhythm.'\n )}\n >\n <div\n role=\"tablist\"\n aria-label={tr('banking.charges.filter', 'Charge status')}\n className=\"mb-3 flex gap-1.5\"\n >\n {CHARGE_FILTERS.map((f) => (\n <button\n key={f}\n type=\"button\"\n role=\"tab\"\n aria-selected={filter === f}\n onClick={() => setFilter(f)}\n className={cn(\n 'rounded-lg px-3 py-1.5 text-xs font-medium',\n filter === f\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'border border-border-subtle text-text-primary hover:bg-bg-sunken'\n )}\n >\n {tr(CHARGE_FILTER_LABEL[f].key, CHARGE_FILTER_LABEL[f].fallback)}\n </button>\n ))}\n </div>\n\n {charges.isLoading ? (\n <LoadingView label={tr('banking.charges.loading', 'Loading recurring charges…')} />\n ) : charges.isError ? (\n <ErrorView message={errorText(charges.error)} onRetry={() => void charges.refetch()} />\n ) : chargeItems.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('banking.charges.empty.title', 'Nothing here yet')}\n description={tr(\n 'banking.charges.empty.description',\n 'Import a statement with at least two months of transactions, or connect a bank, and repeating charges show up here.'\n )}\n />\n ) : (\n <ul className=\"grid grid-cols-1 gap-3 lg:grid-cols-2\" data-testid=\"recurring-charge-list\">\n {chargeItems.map((charge) => (\n <li\n key={charge.id}\n className=\"rounded-xl border border-border-subtle bg-bg-surface p-4\"\n data-testid=\"recurring-charge\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold text-text-primary\">\n {charge.displayName}\n </p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {tr(\n 'banking.charges.meta',\n '{{count}} charges since {{first}} · {{confidence}}% sure',\n {\n count: charge.occurrences,\n first: formatDate(charge.firstChargedOn),\n confidence: charge.confidence,\n }\n )}\n </p>\n </div>\n <span className=\"shrink-0 text-sm font-semibold text-text-primary\">\n {formatCurrency(charge.lastAmount, charge.currency)}\n {formatIntervalSuffix(charge.interval)}\n </span>\n </div>\n <p className=\"mt-2 text-xs text-text-secondary\">\n {tr('banking.charges.dates', 'Last charged {{last}}', {\n last: formatDate(charge.lastChargedOn),\n })}\n {charge.nextExpectedOn &&\n ` · ${tr('banking.charges.next', 'next expected {{next}}', {\n next: formatDate(charge.nextExpectedOn),\n })}`}\n {` · ${tr('banking.charges.yearly', '{{amount}} a year', {\n amount: formatCurrency(charge.annualCost, charge.currency),\n })}`}\n </p>\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {charge.status === 'DETECTED' && (\n <>\n <button\n type=\"button\"\n className={primaryBtn}\n onClick={() => void decide('track', charge)}\n disabled={track.isPending}\n >\n {tr('banking.charges.track', 'Track as subscription')}\n </button>\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => void decide('dismiss', charge)}\n disabled={dismiss.isPending}\n >\n {tr('banking.charges.dismiss', 'Not a subscription')}\n </button>\n </>\n )}\n {charge.status === 'TRACKED' && charge.relationshipId && (\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => navigateTo(`/relationships/${charge.relationshipId}`)}\n >\n {tr('banking.charges.view', 'View subscription')}\n </button>\n )}\n {charge.status === 'DISMISSED' && (\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => void decide('restore', charge)}\n disabled={restore.isPending}\n >\n {tr('banking.charges.restore', 'Review again')}\n </button>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n </Section>\n\n <Section\n title={tr('banking.connections.title', 'Your connections')}\n description={tr(\n 'banking.connections.description',\n 'Disconnecting deletes the accounts and transactions from Subscriber Bot.'\n )}\n >\n {connections.isLoading ? (\n <LoadingView label={tr('banking.connections.loading', 'Loading connections…')} />\n ) : connections.isError ? (\n <ErrorView\n message={errorText(connections.error)}\n onRetry={() => void connections.refetch()}\n />\n ) : connectionItems.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('banking.connections.empty.title', 'No bank or card connected')}\n description={tr(\n 'banking.connections.empty.description',\n 'Download a CSV of your transactions from your bank or card website and import it, or connect a bank.'\n )}\n action={\n <button type=\"button\" className={primaryBtn} onClick={() => setImportOpen(true)}>\n <FileUp className=\"h-4 w-4\" aria-hidden />{' '}\n {tr('banking.import.open', 'Import a statement')}\n </button>\n }\n />\n ) : (\n <ul className=\"space-y-3\" data-testid=\"bank-connection-list\">\n {connectionItems.map((connection) => (\n <li\n key={connection.id}\n className=\"flex flex-col gap-3 rounded-xl border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between\"\n data-testid=\"bank-connection\"\n >\n <div className=\"min-w-0\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-sm font-semibold text-text-primary\">\n {connection.institutionName}\n </p>\n <StatusBadge status={connection.status} />\n </div>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {connection.aggregator === 'PLAID'\n ? tr('banking.connections.viaPlaid', 'Linked with Plaid')\n : tr('banking.connections.viaImport', 'Statement import')}\n {' · '}\n {connection.accounts\n .map((a) => (a.mask ? `${a.name} ••${a.mask}` : a.name))\n .join(', ') || tr('banking.connections.noAccounts', 'no accounts yet')}\n {' · '}\n {tr('banking.connections.count', '{{count}} transactions', {\n count: connection.transactionCount,\n })}\n {connection.lastSyncedAt &&\n ` · ${tr('banking.connections.synced', 'updated {{date}}', {\n date: formatDate(connection.lastSyncedAt),\n })}`}\n </p>\n {connection.lastSyncError && (\n <p className=\"mt-1 text-xs text-status-error-text\">\n {connection.lastSyncError}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 gap-2\">\n {connection.aggregator === 'PLAID' && (\n <button\n type=\"button\"\n className={smallBtn}\n onClick={() => void runSync(connection)}\n disabled={sync.isPending || !plaid?.available}\n >\n <RefreshCw className=\"h-3.5 w-3.5\" aria-hidden />{' '}\n {tr('banking.connections.sync', 'Sync')}\n </button>\n )}\n <button\n type=\"button\"\n className={smallBtn}\n onClick={() => void disconnect(connection)}\n disabled={remove.isPending}\n >\n <Trash2 className=\"h-3.5 w-3.5\" aria-hidden />{' '}\n {tr('banking.connections.disconnect', 'Disconnect')}\n </button>\n </div>\n </li>\n ))}\n </ul>\n )}\n </Section>\n\n {importOpen && (\n <ImportStatementModal\n connections={connectionItems.filter((c) => c.aggregator === 'STATEMENT_IMPORT')}\n onClose={() => setImportOpen(false)}\n onImported={(result) => {\n setImportOpen(false);\n setFilter('DETECTED');\n setNotice({ tone: 'success', text: summarise(result) });\n }}\n />\n )}\n </PageLayout>\n );\n}\n\ninterface ImportStatementModalProps {\n connections: SubBankConnection[];\n onClose: () => void;\n onImported: (result: SubBankSyncResult) => void;\n}\n\nfunction ImportStatementModal({ connections, onClose, onImported }: ImportStatementModalProps) {\n const tr = useTr();\n const importStatement = useImportBankStatement();\n const [connectionId, setConnectionId] = useState('');\n const [institutionName, setInstitutionName] = useState('');\n const [accountName, setAccountName] = useState('');\n const [accountMask, setAccountMask] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [convention, setConvention] = useState<SubStatementAmountConvention>('OUTFLOW_NEGATIVE');\n const [dateFormat, setDateFormat] = useState<SubStatementDateFormat>('MDY');\n const [csv, setCsv] = useState('');\n const [error, setError] = useState<string | null>(null);\n\n const onFile = async (file: File | undefined) => {\n setError(null);\n // A new selection always replaces the previous statement, so a rejected\n // replacement can never leave the earlier file's rows ready to import.\n setCsv('');\n if (!file) return;\n if (file.size > MAX_FILE_BYTES) {\n setError(\n tr('banking.import.tooLarge', 'That file is larger than 2 MB. Export a shorter date range.')\n );\n return;\n }\n setCsv(await file.text());\n };\n\n const submit = async (event: FormEvent) => {\n event.preventDefault();\n setError(null);\n if (!csv.trim()) {\n setError(tr('banking.import.required', 'Choose a CSV file or paste the statement.'));\n return;\n }\n try {\n const result = await importStatement.mutateAsync({\n input: {\n connectionId: connectionId || null,\n institutionName: connectionId ? null : institutionName || null,\n accountName: accountName || null,\n accountMask: accountMask || null,\n currency: currency || 'USD',\n csv,\n amountConvention: convention,\n dateFormat,\n },\n });\n onImported(result);\n } catch (err) {\n setError(errorText(err));\n }\n };\n\n return (\n <Modal\n title={tr('banking.import.title', 'Import a bank or card statement')}\n description={tr(\n 'banking.import.description',\n 'Download your transactions as CSV from your bank or card website (two months or more works best).'\n )}\n onClose={onClose}\n maxWidthClassName=\"max-w-xl\"\n >\n <form\n onSubmit={(e) => void submit(e)}\n className=\"space-y-3\"\n data-testid=\"import-statement-form\"\n >\n {connections.length > 0 && (\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.target', 'Add to')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={connectionId}\n onChange={(e) => setConnectionId(e.target.value)}\n >\n <option value=\"\">{tr('banking.import.newConnection', 'A new connection')}</option>\n {connections.map((c) => (\n <option key={c.id} value={c.id}>\n {c.institutionName}\n </option>\n ))}\n </select>\n </label>\n )}\n {!connectionId && (\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.institution', 'Bank or card issuer')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={institutionName}\n onChange={(e) => setInstitutionName(e.target.value)}\n placeholder={tr('banking.import.institutionPlaceholder', 'e.g. Chase')}\n maxLength={255}\n />\n </label>\n )}\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <label className=\"block text-sm text-text-primary sm:col-span-2\">\n {tr('banking.import.account', 'Account name')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={accountName}\n onChange={(e) => setAccountName(e.target.value)}\n placeholder={tr('banking.import.accountPlaceholder', 'e.g. Sapphire card')}\n maxLength={255}\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.mask', 'Last 4 digits')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={accountMask}\n onChange={(e) => setAccountMask(e.target.value.replace(/\\D/g, '').slice(-4))}\n inputMode=\"numeric\"\n maxLength={4}\n />\n </label>\n </div>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.currency', 'Currency')}\n <input\n className={cn(inputCls, 'mt-1 uppercase')}\n value={currency}\n onChange={(e) => setCurrency(e.target.value.toUpperCase().slice(0, 3))}\n maxLength={3}\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.convention', 'Money out is')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={convention}\n onChange={(e) => setConvention(e.target.value as SubStatementAmountConvention)}\n >\n <option value=\"OUTFLOW_NEGATIVE\">\n {tr('banking.import.negative', 'Negative (bank)')}\n </option>\n <option value=\"OUTFLOW_POSITIVE\">\n {tr('banking.import.positive', 'Positive (card)')}\n </option>\n </select>\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.dateFormat', 'Date format')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={dateFormat}\n onChange={(e) => setDateFormat(e.target.value as SubStatementDateFormat)}\n >\n <option value=\"MDY\">MM/DD/YYYY</option>\n <option value=\"DMY\">DD/MM/YYYY</option>\n <option value=\"YMD\">YYYY-MM-DD</option>\n </select>\n </label>\n </div>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.file', 'CSV file')}\n <input\n type=\"file\"\n accept=\".csv,text/csv,text/plain\"\n className={cn(inputCls, 'mt-1')}\n onChange={(e) => void onFile(e.target.files?.[0])}\n data-testid=\"import-statement-file\"\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.paste', 'Or paste the statement')}\n <textarea\n className={cn(inputCls, 'mt-1 h-32 font-mono text-xs')}\n value={csv}\n onChange={(e) => setCsv(e.target.value)}\n placeholder={'Date,Description,Amount\\n10/05/2026,NETFLIX.COM,-15.49'}\n data-testid=\"import-statement-csv\"\n />\n </label>\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <div className=\"flex justify-end gap-2 pt-1\">\n <button type=\"button\" className={secondaryBtn} onClick={onClose}>\n {tr('common.cancel', 'Cancel')}\n </button>\n <button type=\"submit\" className={primaryBtn} disabled={importStatement.isPending}>\n {importStatement.isPending\n ? tr('banking.import.submitting', 'Importing…')\n : tr('banking.import.submit', 'Import and find subscriptions')}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2DA,IAAM,IACJ,wMACI,IACJ,8JACI,IACJ,gKACI,IACJ,sKAEI,KAA6C;CAAC;CAAY;CAAW;AAAW,GAChF,IAA2F;CAC/F,UAAU;EAAE,KAAK;EAA4B,UAAU;CAAY;CACnE,SAAS;EAAE,KAAK;EAA2B,UAAU;CAAU;CAC/D,WAAW;EAAE,KAAK;EAA6B,UAAU;CAAY;AACvE,GACM,IAAiB,KAEjB,KAAa,MACjB,aAAiB,QAAQ,EAAM,UAAU;AAO3C,SAAgB,IAAsB;CACpC,IAAM,IAAK,GAAM,GACX,EAAE,mBAAe,EAAiB,GAClC,CAAC,GAAQ,KAAa,EAAmC,UAAU,GACnE,CAAC,GAAY,KAAiB,EAAS,EAAK,GAC5C,CAAC,GAAQ,KAAa,EAAwB,IAAI,GAClD,CAAC,GAAS,KAAc,EAAS,EAAK,GAEtC,KAAc,EAAmB,GACjC,IAAc,EAAmB,GACjC,IAAU,EAAoB,CAAM,GACpC,IAAW,EAAoB,UAAU,GACzC,IAAU,EAAoB,SAAS,GAEvC,KAAa,GAAyB,GACtC,KAAe,EAAoB,GACnC,IAAO,EAAsB,GAC7B,IAAS,EAAwB,GACjC,IAAQ,EAAwB,GAChC,IAAU,EAA0B,GACpC,KAAU,EAA0B,GAEpC,IAAQ,GAAY,MAAM,MAAM,MAAM,EAAE,eAAe,OAAO,GAC9D,IAAkB,EAAY,MAAM,SAAS,CAAC,GAC9C,KAAc,EAAQ,MAAM,SAAS,CAAC,GAEtC,KAAiB,QAAc;EACnC,IAAM,oBAAS,IAAI,IAAoB;EACvC,KAAK,IAAM,KAAK,EAAS,MAAM,SAAS,CA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