@burdenoff/microfe-subscriberbot 2026.1107.2 → 2026.1107.3

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.
@@ -2,26 +2,26 @@ import { useSubscriberBot as e } from "../../context/SubscriberBotContext.js";
2
2
  import { useTr as t } from "../../hooks/useTr.js";
3
3
  import { useFormatters as n } from "../../hooks/useFormatters.js";
4
4
  import { cn as r } from "../../utils/cn.js";
5
- import { PageLayout as ee } from "../../components/PageLayout.js";
6
- import { MetricsCard as i } from "../../components/MetricsCard.js";
7
- import { StatusBadge as a } from "../../components/StatusBadge.js";
8
- import { EmptyState as o } from "../../components/EmptyState.js";
9
- import { Modal as s } from "../../components/Modal.js";
10
- import { ErrorView as c, LoadingView as l, Section as u } from "../../components/StateViews.js";
5
+ import { PageLayout as i } from "../../components/PageLayout.js";
6
+ import { MetricsCard as a } from "../../components/MetricsCard.js";
7
+ import { StatusBadge as o } from "../../components/StatusBadge.js";
8
+ import { EmptyState as s } from "../../components/EmptyState.js";
9
+ import { Modal as c } from "../../components/Modal.js";
10
+ import { ErrorView as l, LoadingView as u, Section as d } from "../../components/StateViews.js";
11
11
  import "../../components/index.js";
12
- import { useFormError as d } from "../../hooks/useFormError.js";
13
- import { useBankAggregators as f, useBankConnections as p, useCompleteBankLink as m, useCreateBankLinkSession as h, useDismissRecurringCharge as g, useImportBankStatement as _, useRecurringCharges as v, useRemoveBankConnection as y, useRestoreRecurringCharge as te, useSyncBankConnection as b, useTrackRecurringCharge as x } from "../../hooks/useBankingApi.js";
14
- import { openPlaidLink as S } from "../../utils/plaidLink.js";
15
- import { useMemo as C, useState as w } from "react";
16
- import { CalendarClock as T, FileUp as E, Landmark as D, Link2 as ne, RefreshCw as re, Repeat as O, ShieldCheck as k, Trash2 as ie } from "lucide-react";
17
- import { Fragment as ae, jsx as A, jsxs as j } from "react/jsx-runtime";
18
- import { PagePurpose as oe } from "@burdenoff/fe-libs/ui";
12
+ import { useFormError as f } from "../../hooks/useFormError.js";
13
+ import { useBankAggregators as p, useBankConnections as ee, useCompleteBankLink as m, useCreateBankLinkSession as h, useDismissRecurringCharge as g, useImportBankStatement as _, useRecurringCharges as v, useRemoveBankConnection as y, useRestoreRecurringCharge as b, useSyncBankConnection as x, useTrackRecurringCharge as S } from "../../hooks/useBankingApi.js";
14
+ import { openPlaidLink as C } from "../../utils/plaidLink.js";
15
+ import { useMemo as w, useState as T } from "react";
16
+ import { CalendarClock as E, FileUp as D, Landmark as O, Link2 as k, RefreshCw as A, Repeat as j, ShieldCheck as te, Trash2 as ne } from "lucide-react";
17
+ import { Fragment as re, jsx as M, jsxs as N } from "react/jsx-runtime";
18
+ import { PagePurpose as ie } from "@burdenoff/fe-libs/ui";
19
19
  //#region src/subscriberbot/pages/banking/BankConnectionsPage.tsx
20
- var M = "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)]", 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", P = "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", F = "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", se = [
20
+ var P = "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)]", F = "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", I = "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", L = "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", ae = [
21
21
  "DETECTED",
22
22
  "TRACKED",
23
23
  "DISMISSED"
24
- ], I = {
24
+ ], oe = {
25
25
  DETECTED: {
26
26
  key: "banking.charges.detected",
27
27
  fallback: "To review"
@@ -34,20 +34,20 @@ var M = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 t
34
34
  key: "banking.charges.dismissed",
35
35
  fallback: "Dismissed"
36
36
  }
37
- }, L = 2e6, R = (e, t) => e instanceof Error ? e.message : t("common.somethingWentWrong", "Something went wrong");
37
+ }, se = 2e6, R = (e, t) => e instanceof Error ? e.message : t("common.somethingWentWrong", "Something went wrong");
38
38
  function z() {
39
- let { formatCurrency: s, formatDate: d, formatIntervalSuffix: _ } = n(), M = t(), { navigateTo: L } = e(), [z, B] = w("DETECTED"), [le, V] = w(!1), [H, U] = w(null), [W, G] = w(!1), ue = f(), K = p(), q = v(z), J = v("DETECTED"), de = v("TRACKED"), fe = h(), pe = m(), me = b(), he = y(), ge = x(), Y = g(), _e = te(), X = ue.data?.find((e) => e.aggregator === "PLAID"), Z = K.data?.items ?? [], ve = q.data?.items ?? [], ye = C(() => {
39
+ let { formatCurrency: c, formatDate: f, formatIntervalSuffix: _ } = n(), P = t(), { navigateTo: se } = e(), [z, B] = T("DETECTED"), [le, V] = T(!1), [H, U] = T(null), [W, G] = T(!1), ue = p(), K = ee(), q = v(z), J = v("DETECTED"), de = v("TRACKED"), fe = h(), pe = m(), Y = x(), me = y(), he = S(), ge = g(), _e = b(), X = ue.data?.find((e) => e.aggregator === "PLAID"), Z = K.data?.items ?? [], ve = q.data?.items ?? [], ye = w(() => {
40
40
  let e = /* @__PURE__ */ new Map();
41
41
  for (let t of J.data?.items ?? []) e.set(t.currency, (e.get(t.currency) ?? 0) + t.annualCost);
42
- return [...e.entries()].map(([e, t]) => s(t, e)).join(" + ");
43
- }, [J.data, s]), Q = (e) => M("banking.notice.synced", "{{added}} new transaction(s) from {{institution}}; {{recurring}} recurring charge(s) found.", {
42
+ return [...e.entries()].map(([e, t]) => c(t, e)).join(" + ");
43
+ }, [J.data, c]), Q = (e) => P("banking.notice.synced", "{{added}} new transaction(s) from {{institution}}; {{recurring}} recurring charge(s) found.", {
44
44
  added: e.added,
45
45
  institution: e.connection.institutionName,
46
46
  recurring: e.recurringDetected
47
47
  }), be = async () => {
48
48
  U(null), G(!0);
49
49
  try {
50
- let e = await S((await fe.mutateAsync({ aggregator: "PLAID" })).linkToken, M);
50
+ let e = await C((await fe.mutateAsync({ aggregator: "PLAID" })).linkToken, P);
51
51
  if (!e) return;
52
52
  U({
53
53
  tone: "success",
@@ -61,36 +61,55 @@ function z() {
61
61
  } catch (e) {
62
62
  U({
63
63
  tone: "error",
64
- text: R(e, M)
64
+ text: R(e, P)
65
65
  });
66
66
  } finally {
67
67
  G(!1);
68
68
  }
69
69
  }, xe = async (e) => {
70
- U(null);
70
+ U(null), G(!0);
71
71
  try {
72
+ if (!await C((await fe.mutateAsync({
73
+ aggregator: "PLAID",
74
+ connectionId: e.id
75
+ })).linkToken, P)) return;
72
76
  U({
73
77
  tone: "success",
74
- text: Q(await me.mutateAsync({ id: e.id }))
78
+ text: Q(await Y.mutateAsync({ id: e.id }))
75
79
  });
76
80
  } catch (e) {
77
81
  U({
78
82
  tone: "error",
79
- text: R(e, M)
83
+ text: R(e, P)
80
84
  });
85
+ } finally {
86
+ G(!1);
81
87
  }
82
88
  }, Se = async (e) => {
83
- if (window.confirm(M("banking.disconnect.confirm", "Disconnect {{institution}}? Its accounts and transactions are deleted from Subscriber Bot. Subscriptions you already track stay.", { institution: e.institutionName }))) {
89
+ U(null);
90
+ try {
91
+ U({
92
+ tone: "success",
93
+ text: Q(await Y.mutateAsync({ id: e.id }))
94
+ });
95
+ } catch (e) {
96
+ U({
97
+ tone: "error",
98
+ text: R(e, P)
99
+ });
100
+ }
101
+ }, Ce = async (e) => {
102
+ if (window.confirm(P("banking.disconnect.confirm", "Disconnect {{institution}}? Its accounts and transactions are deleted from Subscriber Bot. Subscriptions you already track stay.", { institution: e.institutionName }))) {
84
103
  U(null);
85
104
  try {
86
- await he.mutateAsync({ id: e.id }), U({
105
+ await me.mutateAsync({ id: e.id }), U({
87
106
  tone: "success",
88
- text: M("banking.notice.disconnected", "{{institution}} was disconnected.", { institution: e.institutionName })
107
+ text: P("banking.notice.disconnected", "{{institution}} was disconnected.", { institution: e.institutionName })
89
108
  });
90
109
  } catch (e) {
91
110
  U({
92
111
  tone: "error",
93
- text: R(e, M)
112
+ text: R(e, P)
94
113
  });
95
114
  }
96
115
  }
@@ -98,183 +117,183 @@ function z() {
98
117
  U(null);
99
118
  try {
100
119
  let n = await {
101
- track: ge,
102
- dismiss: Y,
120
+ track: he,
121
+ dismiss: ge,
103
122
  restore: _e
104
123
  }[e].mutateAsync({ id: t.id });
105
124
  e === "track" && U({
106
125
  tone: "success",
107
- text: M("banking.notice.tracked", "{{name}} is now tracked as a subscription.", { name: n.displayName })
126
+ text: P("banking.notice.tracked", "{{name}} is now tracked as a subscription.", { name: n.displayName })
108
127
  });
109
128
  } catch (e) {
110
129
  U({
111
130
  tone: "error",
112
- text: R(e, M)
131
+ text: R(e, P)
113
132
  });
114
133
  }
115
- }, Ce = /* @__PURE__ */ j("div", {
134
+ }, we = /* @__PURE__ */ N("div", {
116
135
  className: "flex flex-wrap gap-2",
117
136
  "data-tour": "subscriberbot-banking-connect",
118
- children: [/* @__PURE__ */ j("button", {
137
+ children: [/* @__PURE__ */ N("button", {
119
138
  type: "button",
120
- className: P,
139
+ className: I,
121
140
  onClick: () => V(!0),
122
141
  children: [
123
- /* @__PURE__ */ A(E, {
142
+ /* @__PURE__ */ M(D, {
124
143
  className: "h-4 w-4",
125
144
  "aria-hidden": !0
126
145
  }),
127
146
  " ",
128
- M("banking.import.open", "Import a statement")
147
+ P("banking.import.open", "Import a statement")
129
148
  ]
130
- }), /* @__PURE__ */ j("button", {
149
+ }), /* @__PURE__ */ N("button", {
131
150
  type: "button",
132
- className: N,
151
+ className: F,
133
152
  onClick: () => void be(),
134
153
  disabled: !X?.available || W,
135
- title: X?.available ? void 0 : M("banking.plaid.unavailable", "Bank linking is not switched on yet. Import a statement instead."),
136
- children: [/* @__PURE__ */ A(ne, {
154
+ title: X?.available ? void 0 : P("banking.plaid.unavailable", "Bank linking is not switched on yet. Import a statement instead."),
155
+ children: [/* @__PURE__ */ M(k, {
137
156
  className: "h-4 w-4",
138
157
  "aria-hidden": !0
139
- }), W ? M("banking.plaid.linking", "Connecting…") : M("banking.plaid.connect", "Connect a bank")]
158
+ }), W ? P("banking.plaid.linking", "Connecting…") : P("banking.plaid.connect", "Connect a bank")]
140
159
  })]
141
160
  });
142
- return /* @__PURE__ */ j(ee, {
161
+ return /* @__PURE__ */ N(i, {
143
162
  dataTour: "subscriberbot-banking",
144
- title: M("banking.title", "Bank & card connections"),
145
- description: M("banking.description", "Find every subscription in your bank and card transactions."),
146
- actions: Ce,
163
+ title: P("banking.title", "Bank & card connections"),
164
+ description: P("banking.description", "Find every subscription in your bank and card transactions."),
165
+ actions: we,
147
166
  children: [
148
- /* @__PURE__ */ A(oe, {
167
+ /* @__PURE__ */ M(ie, {
149
168
  className: "mb-6",
150
- children: M("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.")
169
+ children: P("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.")
151
170
  }),
152
- X && !X.available && /* @__PURE__ */ j("p", {
171
+ X && !X.available && /* @__PURE__ */ N("p", {
153
172
  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",
154
173
  "data-testid": "plaid-unavailable",
155
- children: [/* @__PURE__ */ A(k, {
174
+ children: [/* @__PURE__ */ M(te, {
156
175
  className: "mt-0.5 h-4 w-4 shrink-0",
157
176
  "aria-hidden": !0
158
- }), M("banking.plaid.unavailableLong", "Direct bank linking is being switched on. Until then, import a statement export: it finds the same recurring charges.")]
177
+ }), P("banking.plaid.unavailableLong", "Direct bank linking is being switched on. Until then, import a statement export: it finds the same recurring charges.")]
159
178
  }),
160
- H && /* @__PURE__ */ A("p", {
179
+ H && /* @__PURE__ */ M("p", {
161
180
  role: H.tone === "error" ? "alert" : "status",
162
181
  className: r("mb-4 rounded-lg px-3 py-2 text-sm", H.tone === "error" ? "bg-status-error-bg-subtle text-status-error-text" : "bg-status-success-bg-subtle text-status-success-text"),
163
182
  "data-testid": "banking-notice",
164
183
  children: H.text
165
184
  }),
166
- /* @__PURE__ */ j("div", {
185
+ /* @__PURE__ */ N("div", {
167
186
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
168
187
  "data-tour": "subscriberbot-banking-metrics",
169
188
  children: [
170
- /* @__PURE__ */ A(i, {
171
- icon: /* @__PURE__ */ A(D, { className: "h-5 w-5" }),
189
+ /* @__PURE__ */ M(a, {
190
+ icon: /* @__PURE__ */ M(O, { className: "h-5 w-5" }),
172
191
  value: K.isLoading ? "—" : Z.length,
173
- label: M("banking.metrics.connections", "Connected accounts")
192
+ label: P("banking.metrics.connections", "Connected accounts")
174
193
  }),
175
- /* @__PURE__ */ A(i, {
176
- icon: /* @__PURE__ */ A(O, { className: "h-5 w-5" }),
194
+ /* @__PURE__ */ M(a, {
195
+ icon: /* @__PURE__ */ M(j, { className: "h-5 w-5" }),
177
196
  value: J.isLoading ? "—" : J.data?.items.length ?? 0,
178
- label: M("banking.metrics.detected", "Charges to review")
197
+ label: P("banking.metrics.detected", "Charges to review")
179
198
  }),
180
- /* @__PURE__ */ A(i, {
181
- icon: /* @__PURE__ */ A(T, { className: "h-5 w-5" }),
182
- value: J.isLoading ? "—" : ye || s(0, "USD"),
183
- label: M("banking.metrics.yearly", "Yearly cost to review")
199
+ /* @__PURE__ */ M(a, {
200
+ icon: /* @__PURE__ */ M(E, { className: "h-5 w-5" }),
201
+ value: J.isLoading ? "—" : ye || c(0, "USD"),
202
+ label: P("banking.metrics.yearly", "Yearly cost to review")
184
203
  }),
185
- /* @__PURE__ */ A(i, {
186
- icon: /* @__PURE__ */ A(k, { className: "h-5 w-5" }),
204
+ /* @__PURE__ */ M(a, {
205
+ icon: /* @__PURE__ */ M(te, { className: "h-5 w-5" }),
187
206
  value: de.isLoading ? "—" : de.data?.items.length ?? 0,
188
- label: M("banking.metrics.tracked", "Tracked from your bank")
207
+ label: P("banking.metrics.tracked", "Tracked from your bank")
189
208
  })
190
209
  ]
191
210
  }),
192
- /* @__PURE__ */ j(u, {
211
+ /* @__PURE__ */ N(d, {
193
212
  dataTour: "subscriberbot-banking-charges",
194
- title: M("banking.charges.title", "Recurring charges found"),
195
- description: M("banking.charges.description", "Charges from the same merchant at a steady amount and rhythm."),
196
- children: [/* @__PURE__ */ A("div", {
213
+ title: P("banking.charges.title", "Recurring charges found"),
214
+ description: P("banking.charges.description", "Charges from the same merchant at a steady amount and rhythm."),
215
+ children: [/* @__PURE__ */ M("div", {
197
216
  role: "tablist",
198
- "aria-label": M("banking.charges.filter", "Charge status"),
217
+ "aria-label": P("banking.charges.filter", "Charge status"),
199
218
  className: "mb-3 flex gap-1.5",
200
- children: se.map((e) => /* @__PURE__ */ A("button", {
219
+ children: ae.map((e) => /* @__PURE__ */ M("button", {
201
220
  type: "button",
202
221
  role: "tab",
203
222
  "aria-selected": z === e,
204
223
  onClick: () => B(e),
205
224
  className: r("rounded-lg px-3 py-1.5 text-xs font-medium", z === e ? "bg-action-primary-bg text-action-primary-text" : "border border-border-subtle text-text-primary hover:bg-bg-sunken"),
206
- children: M(I[e].key, I[e].fallback)
225
+ children: P(oe[e].key, oe[e].fallback)
207
226
  }, e))
208
- }), q.isLoading ? /* @__PURE__ */ A(l, { label: M("banking.charges.loading", "Loading recurring charges…") }) : q.isError ? /* @__PURE__ */ A(c, {
209
- message: R(q.error, M),
227
+ }), q.isLoading ? /* @__PURE__ */ M(u, { label: P("banking.charges.loading", "Loading recurring charges…") }) : q.isError ? /* @__PURE__ */ M(l, {
228
+ message: R(q.error, P),
210
229
  onRetry: () => void q.refetch()
211
- }) : ve.length === 0 ? /* @__PURE__ */ A(o, {
230
+ }) : ve.length === 0 ? /* @__PURE__ */ M(s, {
212
231
  illustration: "empty-data",
213
- title: M("banking.charges.empty.title", "Nothing here yet"),
214
- description: M("banking.charges.empty.description", "Import a statement with at least two months of transactions, or connect a bank, and repeating charges show up here.")
215
- }) : /* @__PURE__ */ A("ul", {
232
+ title: P("banking.charges.empty.title", "Nothing here yet"),
233
+ description: P("banking.charges.empty.description", "Import a statement with at least two months of transactions, or connect a bank, and repeating charges show up here.")
234
+ }) : /* @__PURE__ */ M("ul", {
216
235
  className: "grid grid-cols-1 gap-3 lg:grid-cols-2",
217
236
  "data-testid": "recurring-charge-list",
218
- children: ve.map((e) => /* @__PURE__ */ j("li", {
237
+ children: ve.map((e) => /* @__PURE__ */ N("li", {
219
238
  className: "rounded-xl border border-border-subtle bg-bg-surface p-4",
220
239
  "data-testid": "recurring-charge",
221
240
  children: [
222
- /* @__PURE__ */ j("div", {
241
+ /* @__PURE__ */ N("div", {
223
242
  className: "flex items-start justify-between gap-3",
224
- children: [/* @__PURE__ */ j("div", {
243
+ children: [/* @__PURE__ */ N("div", {
225
244
  className: "min-w-0",
226
- children: [/* @__PURE__ */ A("p", {
245
+ children: [/* @__PURE__ */ M("p", {
227
246
  className: "truncate text-sm font-semibold text-text-primary",
228
247
  children: e.displayName
229
- }), /* @__PURE__ */ A("p", {
248
+ }), /* @__PURE__ */ M("p", {
230
249
  className: "mt-0.5 text-xs text-text-secondary",
231
- children: M("banking.charges.meta", "{{count}} charges since {{first}} · {{confidence}}% sure", {
250
+ children: P("banking.charges.meta", "{{count}} charges since {{first}} · {{confidence}}% sure", {
232
251
  count: e.occurrences,
233
- first: d(e.firstChargedOn),
252
+ first: f(e.firstChargedOn),
234
253
  confidence: e.confidence
235
254
  })
236
255
  })]
237
- }), /* @__PURE__ */ j("span", {
256
+ }), /* @__PURE__ */ N("span", {
238
257
  className: "shrink-0 text-sm font-semibold text-text-primary",
239
- children: [s(e.lastAmount, e.currency), _(e.interval)]
258
+ children: [c(e.lastAmount, e.currency), _(e.interval)]
240
259
  })]
241
260
  }),
242
- /* @__PURE__ */ j("p", {
261
+ /* @__PURE__ */ N("p", {
243
262
  className: "mt-2 text-xs text-text-secondary",
244
263
  children: [
245
- M("banking.charges.dates", "Last charged {{last}}", { last: d(e.lastChargedOn) }),
246
- e.nextExpectedOn && ` · ${M("banking.charges.next", "next expected {{next}}", { next: d(e.nextExpectedOn) })}`,
247
- ` · ${M("banking.charges.yearly", "{{amount}} a year", { amount: s(e.annualCost, e.currency) })}`
264
+ P("banking.charges.dates", "Last charged {{last}}", { last: f(e.lastChargedOn) }),
265
+ e.nextExpectedOn && ` · ${P("banking.charges.next", "next expected {{next}}", { next: f(e.nextExpectedOn) })}`,
266
+ ` · ${P("banking.charges.yearly", "{{amount}} a year", { amount: c(e.annualCost, e.currency) })}`
248
267
  ]
249
268
  }),
250
- /* @__PURE__ */ j("div", {
269
+ /* @__PURE__ */ N("div", {
251
270
  className: "mt-3 flex flex-wrap gap-2",
252
271
  children: [
253
- e.status === "DETECTED" && /* @__PURE__ */ j(ae, { children: [/* @__PURE__ */ A("button", {
272
+ e.status === "DETECTED" && /* @__PURE__ */ N(re, { children: [/* @__PURE__ */ M("button", {
254
273
  type: "button",
255
- className: N,
274
+ className: F,
256
275
  onClick: () => void $("track", e),
257
- disabled: ge.isPending,
258
- children: M("banking.charges.track", "Track as subscription")
259
- }), /* @__PURE__ */ A("button", {
276
+ disabled: he.isPending,
277
+ children: P("banking.charges.track", "Track as subscription")
278
+ }), /* @__PURE__ */ M("button", {
260
279
  type: "button",
261
- className: P,
280
+ className: I,
262
281
  onClick: () => void $("dismiss", e),
263
- disabled: Y.isPending,
264
- children: M("banking.charges.dismiss", "Not a subscription")
282
+ disabled: ge.isPending,
283
+ children: P("banking.charges.dismiss", "Not a subscription")
265
284
  })] }),
266
- e.status === "TRACKED" && e.relationshipId && /* @__PURE__ */ A("button", {
285
+ e.status === "TRACKED" && e.relationshipId && /* @__PURE__ */ M("button", {
267
286
  type: "button",
268
- className: P,
269
- onClick: () => L(`/relationships/${e.relationshipId}`),
270
- children: M("banking.charges.view", "View subscription")
287
+ className: I,
288
+ onClick: () => se(`/relationships/${e.relationshipId}`),
289
+ children: P("banking.charges.view", "View subscription")
271
290
  }),
272
- e.status === "DISMISSED" && /* @__PURE__ */ A("button", {
291
+ e.status === "DISMISSED" && /* @__PURE__ */ M("button", {
273
292
  type: "button",
274
- className: P,
293
+ className: I,
275
294
  onClick: () => void $("restore", e),
276
295
  disabled: _e.isPending,
277
- children: M("banking.charges.restore", "Review again")
296
+ children: P("banking.charges.restore", "Review again")
278
297
  })
279
298
  ]
280
299
  })
@@ -282,96 +301,123 @@ function z() {
282
301
  }, e.id))
283
302
  })]
284
303
  }),
285
- /* @__PURE__ */ A(u, {
304
+ /* @__PURE__ */ M(d, {
286
305
  dataTour: "subscriberbot-banking-connections",
287
- title: M("banking.connections.title", "Your connections"),
288
- description: M("banking.connections.description", "Disconnecting deletes the accounts and transactions from Subscriber Bot."),
289
- children: K.isLoading ? /* @__PURE__ */ A(l, { label: M("banking.connections.loading", "Loading connections…") }) : K.isError ? /* @__PURE__ */ A(c, {
290
- message: R(K.error, M),
306
+ title: P("banking.connections.title", "Your connections"),
307
+ description: P("banking.connections.description", "Disconnecting deletes the accounts and transactions from Subscriber Bot."),
308
+ children: K.isLoading ? /* @__PURE__ */ M(u, { label: P("banking.connections.loading", "Loading connections…") }) : K.isError ? /* @__PURE__ */ M(l, {
309
+ message: R(K.error, P),
291
310
  onRetry: () => void K.refetch()
292
- }) : Z.length === 0 ? /* @__PURE__ */ A(o, {
311
+ }) : Z.length === 0 ? /* @__PURE__ */ M(s, {
293
312
  illustration: "empty-data",
294
- title: M("banking.connections.empty.title", "No bank or card connected"),
295
- description: M("banking.connections.empty.description", "Download a CSV of your transactions from your bank or card website and import it, or connect a bank."),
296
- action: /* @__PURE__ */ j("button", {
313
+ title: P("banking.connections.empty.title", "No bank or card connected"),
314
+ description: P("banking.connections.empty.description", "Download a CSV of your transactions from your bank or card website and import it, or connect a bank."),
315
+ action: /* @__PURE__ */ N("button", {
297
316
  type: "button",
298
- className: N,
317
+ className: F,
299
318
  onClick: () => V(!0),
300
319
  children: [
301
- /* @__PURE__ */ A(E, {
320
+ /* @__PURE__ */ M(D, {
302
321
  className: "h-4 w-4",
303
322
  "aria-hidden": !0
304
323
  }),
305
324
  " ",
306
- M("banking.import.open", "Import a statement")
325
+ P("banking.import.open", "Import a statement")
307
326
  ]
308
327
  })
309
- }) : /* @__PURE__ */ A("ul", {
328
+ }) : /* @__PURE__ */ M("ul", {
310
329
  className: "space-y-3",
311
330
  "data-testid": "bank-connection-list",
312
- children: Z.map((e) => /* @__PURE__ */ j("li", {
331
+ children: Z.map((e) => /* @__PURE__ */ N("li", {
313
332
  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",
314
333
  "data-testid": "bank-connection",
315
- children: [/* @__PURE__ */ j("div", {
334
+ children: [/* @__PURE__ */ N("div", {
316
335
  className: "min-w-0",
317
336
  children: [
318
- /* @__PURE__ */ j("div", {
337
+ /* @__PURE__ */ N("div", {
319
338
  className: "flex items-center gap-2",
320
- children: [/* @__PURE__ */ A("p", {
339
+ children: [/* @__PURE__ */ M("p", {
321
340
  className: "truncate text-sm font-semibold text-text-primary",
322
341
  children: e.institutionName
323
- }), /* @__PURE__ */ A(a, { status: e.status })]
342
+ }), /* @__PURE__ */ M(o, { status: e.status })]
324
343
  }),
325
- /* @__PURE__ */ j("p", {
344
+ /* @__PURE__ */ N("p", {
326
345
  className: "mt-0.5 text-xs text-text-secondary",
327
346
  children: [
328
- e.aggregator === "PLAID" ? M("banking.connections.viaPlaid", "Linked with Plaid") : M("banking.connections.viaImport", "Statement import"),
347
+ e.aggregator === "PLAID" ? P("banking.connections.viaPlaid", "Linked with Plaid") : P("banking.connections.viaImport", "Statement import"),
329
348
  " · ",
330
- e.accounts.map((e) => e.mask ? `${e.name} ••${e.mask}` : e.name).join(", ") || M("banking.connections.noAccounts", "no accounts yet"),
349
+ e.accounts.map((e) => e.mask ? `${e.name} ••${e.mask}` : e.name).join(", ") || P("banking.connections.noAccounts", "no accounts yet"),
331
350
  " · ",
332
- M("banking.connections.count", "{{count}} transactions", { count: e.transactionCount }),
333
- e.lastSyncedAt && ` · ${M("banking.connections.synced", "updated {{date}}", { date: d(e.lastSyncedAt) })}`
351
+ P("banking.connections.count", "{{count}} transactions", { count: e.transactionCount }),
352
+ e.lastSyncedAt && ` · ${P("banking.connections.synced", "updated {{date}}", { date: f(e.lastSyncedAt) })}`
334
353
  ]
335
354
  }),
336
- e.lastSyncError && /* @__PURE__ */ A("p", {
355
+ e.lastSyncError && /* @__PURE__ */ M("p", {
337
356
  className: "mt-1 text-xs text-status-error-text",
338
357
  children: e.lastSyncError
358
+ }),
359
+ e.status === "NEEDS_REAUTH" && /* @__PURE__ */ M("p", {
360
+ className: "mt-1 text-xs text-status-warning-text",
361
+ "data-testid": "bank-connection-hint",
362
+ children: P("banking.connections.needsReauth", "The bank needs you to sign in again. Reconnect to keep syncing; your history is kept.")
363
+ }),
364
+ e.status === "REVOKED" && /* @__PURE__ */ M("p", {
365
+ className: "mt-1 text-xs text-text-secondary",
366
+ "data-testid": "bank-connection-hint",
367
+ children: P("banking.connections.revoked", "Access was revoked at the bank. Disconnect this connection and link the bank again to keep tracking it.")
339
368
  })
340
369
  ]
341
- }), /* @__PURE__ */ j("div", {
370
+ }), /* @__PURE__ */ N("div", {
342
371
  className: "flex shrink-0 gap-2",
343
- children: [e.aggregator === "PLAID" && /* @__PURE__ */ j("button", {
344
- type: "button",
345
- className: F,
346
- onClick: () => void xe(e),
347
- disabled: me.isPending || !X?.available,
348
- children: [
349
- /* @__PURE__ */ A(re, {
350
- className: "h-3.5 w-3.5",
351
- "aria-hidden": !0
352
- }),
353
- " ",
354
- M("banking.connections.sync", "Sync")
355
- ]
356
- }), /* @__PURE__ */ j("button", {
357
- type: "button",
358
- className: F,
359
- onClick: () => void Se(e),
360
- disabled: he.isPending,
361
- children: [
362
- /* @__PURE__ */ A(ie, {
363
- className: "h-3.5 w-3.5",
364
- "aria-hidden": !0
365
- }),
366
- " ",
367
- M("banking.connections.disconnect", "Disconnect")
368
- ]
369
- })]
372
+ children: [
373
+ e.aggregator === "PLAID" && e.status === "NEEDS_REAUTH" && /* @__PURE__ */ N("button", {
374
+ type: "button",
375
+ className: L,
376
+ onClick: () => void xe(e),
377
+ disabled: W || !X?.available,
378
+ children: [
379
+ /* @__PURE__ */ M(k, {
380
+ className: "h-3.5 w-3.5",
381
+ "aria-hidden": !0
382
+ }),
383
+ " ",
384
+ P("banking.connections.reconnect", "Reconnect")
385
+ ]
386
+ }),
387
+ e.aggregator === "PLAID" && e.status !== "REVOKED" && e.status !== "NEEDS_REAUTH" && /* @__PURE__ */ N("button", {
388
+ type: "button",
389
+ className: L,
390
+ onClick: () => void Se(e),
391
+ disabled: Y.isPending || !X?.available,
392
+ children: [
393
+ /* @__PURE__ */ M(A, {
394
+ className: "h-3.5 w-3.5",
395
+ "aria-hidden": !0
396
+ }),
397
+ " ",
398
+ P("banking.connections.sync", "Sync")
399
+ ]
400
+ }),
401
+ /* @__PURE__ */ N("button", {
402
+ type: "button",
403
+ className: L,
404
+ onClick: () => void Ce(e),
405
+ disabled: me.isPending,
406
+ children: [
407
+ /* @__PURE__ */ M(ne, {
408
+ className: "h-3.5 w-3.5",
409
+ "aria-hidden": !0
410
+ }),
411
+ " ",
412
+ P("banking.connections.disconnect", "Disconnect")
413
+ ]
414
+ })
415
+ ]
370
416
  })]
371
417
  }, e.id))
372
418
  })
373
419
  }),
374
- le && /* @__PURE__ */ A(ce, {
420
+ le && /* @__PURE__ */ M(ce, {
375
421
  connections: Z.filter((e) => e.aggregator === "STATEMENT_IMPORT"),
376
422
  onClose: () => V(!1),
377
423
  onImported: (e) => {
@@ -384,85 +430,85 @@ function z() {
384
430
  ]
385
431
  });
386
432
  }
387
- function ce({ connections: e, onClose: n, onImported: ee }) {
388
- let i = t(), a = _(), [o, c] = w(""), [l, u] = w(""), [f, p] = w(""), [m, h] = w(""), [g, v] = w("USD"), [y, te] = w("OUTFLOW_NEGATIVE"), [b, x] = w("MDY"), [S, C] = w(""), [T, E, D, ne] = d(), re = async (e) => {
389
- if (E(null), C(""), e) {
390
- if (e.size > L) {
391
- E(i("banking.import.tooLarge", "That file is larger than 2 MB. Export a shorter date range."), "statement-file");
433
+ function ce({ connections: e, onClose: n, onImported: i }) {
434
+ let a = t(), o = _(), [s, l] = T(""), [u, d] = T(""), [p, ee] = T(""), [m, h] = T(""), [g, v] = T("USD"), [y, b] = T("OUTFLOW_NEGATIVE"), [x, S] = T("MDY"), [C, w] = T(""), [E, D, O, k] = f(), A = async (e) => {
435
+ if (D(null), w(""), e) {
436
+ if (e.size > se) {
437
+ D(a("banking.import.tooLarge", "That file is larger than 2 MB. Export a shorter date range."), "statement-file");
392
438
  return;
393
439
  }
394
- C(await e.text());
440
+ w(await e.text());
395
441
  }
396
- }, O = async (e) => {
397
- if (e.preventDefault(), E(null), !S.trim()) {
398
- E(i("banking.import.required", "Choose a CSV file or paste the statement."), ["statement-csv", "statement-file"]);
442
+ }, j = async (e) => {
443
+ if (e.preventDefault(), D(null), !C.trim()) {
444
+ D(a("banking.import.required", "Choose a CSV file or paste the statement."), ["statement-csv", "statement-file"]);
399
445
  return;
400
446
  }
401
447
  try {
402
- ee(await a.mutateAsync({ input: {
403
- connectionId: o || null,
404
- institutionName: o ? null : l || null,
405
- accountName: f || null,
448
+ i(await o.mutateAsync({ input: {
449
+ connectionId: s || null,
450
+ institutionName: s ? null : u || null,
451
+ accountName: p || null,
406
452
  accountMask: m || null,
407
453
  currency: g || "USD",
408
- csv: S,
454
+ csv: C,
409
455
  amountConvention: y,
410
- dateFormat: b
456
+ dateFormat: x
411
457
  } }));
412
458
  } catch (e) {
413
- E(R(e, i));
459
+ D(R(e, a));
414
460
  }
415
461
  };
416
- return /* @__PURE__ */ A(s, {
417
- title: i("banking.import.title", "Import a bank or card statement"),
418
- description: i("banking.import.description", "Download your transactions as CSV from your bank or card website (two months or more works best)."),
462
+ return /* @__PURE__ */ M(c, {
463
+ title: a("banking.import.title", "Import a bank or card statement"),
464
+ description: a("banking.import.description", "Download your transactions as CSV from your bank or card website (two months or more works best)."),
419
465
  onClose: n,
420
466
  maxWidthClassName: "max-w-xl",
421
- children: /* @__PURE__ */ j("form", {
422
- onSubmit: (e) => void O(e),
467
+ children: /* @__PURE__ */ N("form", {
468
+ onSubmit: (e) => void j(e),
423
469
  className: "space-y-3",
424
470
  "data-testid": "import-statement-form",
425
471
  children: [
426
- e.length > 0 && /* @__PURE__ */ j("label", {
472
+ e.length > 0 && /* @__PURE__ */ N("label", {
427
473
  className: "block text-sm text-text-primary",
428
- children: [i("banking.import.target", "Add to"), /* @__PURE__ */ j("select", {
429
- className: r(M, "mt-1"),
430
- value: o,
431
- onChange: (e) => c(e.target.value),
432
- children: [/* @__PURE__ */ A("option", {
474
+ children: [a("banking.import.target", "Add to"), /* @__PURE__ */ N("select", {
475
+ className: r(P, "mt-1"),
476
+ value: s,
477
+ onChange: (e) => l(e.target.value),
478
+ children: [/* @__PURE__ */ M("option", {
433
479
  value: "",
434
- children: i("banking.import.newConnection", "A new connection")
435
- }), e.map((e) => /* @__PURE__ */ A("option", {
480
+ children: a("banking.import.newConnection", "A new connection")
481
+ }), e.map((e) => /* @__PURE__ */ M("option", {
436
482
  value: e.id,
437
483
  children: e.institutionName
438
484
  }, e.id))]
439
485
  })]
440
486
  }),
441
- !o && /* @__PURE__ */ j("label", {
487
+ !s && /* @__PURE__ */ N("label", {
442
488
  className: "block text-sm text-text-primary",
443
- children: [i("banking.import.institution", "Bank or card issuer"), /* @__PURE__ */ A("input", {
444
- className: r(M, "mt-1"),
445
- value: l,
446
- onChange: (e) => u(e.target.value),
447
- placeholder: i("banking.import.institutionPlaceholder", "e.g. Chase"),
489
+ children: [a("banking.import.institution", "Bank or card issuer"), /* @__PURE__ */ M("input", {
490
+ className: r(P, "mt-1"),
491
+ value: u,
492
+ onChange: (e) => d(e.target.value),
493
+ placeholder: a("banking.import.institutionPlaceholder", "e.g. Chase"),
448
494
  maxLength: 255
449
495
  })]
450
496
  }),
451
- /* @__PURE__ */ j("div", {
497
+ /* @__PURE__ */ N("div", {
452
498
  className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
453
- children: [/* @__PURE__ */ j("label", {
499
+ children: [/* @__PURE__ */ N("label", {
454
500
  className: "block text-sm text-text-primary sm:col-span-2",
455
- children: [i("banking.import.account", "Account name"), /* @__PURE__ */ A("input", {
456
- className: r(M, "mt-1"),
457
- value: f,
458
- onChange: (e) => p(e.target.value),
459
- placeholder: i("banking.import.accountPlaceholder", "e.g. Sapphire card"),
501
+ children: [a("banking.import.account", "Account name"), /* @__PURE__ */ M("input", {
502
+ className: r(P, "mt-1"),
503
+ value: p,
504
+ onChange: (e) => ee(e.target.value),
505
+ placeholder: a("banking.import.accountPlaceholder", "e.g. Sapphire card"),
460
506
  maxLength: 255
461
507
  })]
462
- }), /* @__PURE__ */ j("label", {
508
+ }), /* @__PURE__ */ N("label", {
463
509
  className: "block text-sm text-text-primary",
464
- children: [i("banking.import.mask", "Last 4 digits"), /* @__PURE__ */ A("input", {
465
- className: r(M, "mt-1"),
510
+ children: [a("banking.import.mask", "Last 4 digits"), /* @__PURE__ */ M("input", {
511
+ className: r(P, "mt-1"),
466
512
  value: m,
467
513
  onChange: (e) => h(e.target.value.replace(/\D/g, "").slice(-4)),
468
514
  inputMode: "numeric",
@@ -470,49 +516,49 @@ function ce({ connections: e, onClose: n, onImported: ee }) {
470
516
  })]
471
517
  })]
472
518
  }),
473
- /* @__PURE__ */ j("div", {
519
+ /* @__PURE__ */ N("div", {
474
520
  className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
475
521
  children: [
476
- /* @__PURE__ */ j("label", {
522
+ /* @__PURE__ */ N("label", {
477
523
  className: "block text-sm text-text-primary",
478
- children: [i("banking.import.currency", "Currency"), /* @__PURE__ */ A("input", {
479
- className: r(M, "mt-1 uppercase"),
524
+ children: [a("banking.import.currency", "Currency"), /* @__PURE__ */ M("input", {
525
+ className: r(P, "mt-1 uppercase"),
480
526
  value: g,
481
527
  onChange: (e) => v(e.target.value.toUpperCase().slice(0, 3)),
482
528
  maxLength: 3
483
529
  })]
484
530
  }),
485
- /* @__PURE__ */ j("label", {
531
+ /* @__PURE__ */ N("label", {
486
532
  className: "block text-sm text-text-primary",
487
- children: [i("banking.import.convention", "Money out is"), /* @__PURE__ */ j("select", {
488
- className: r(M, "mt-1"),
533
+ children: [a("banking.import.convention", "Money out is"), /* @__PURE__ */ N("select", {
534
+ className: r(P, "mt-1"),
489
535
  value: y,
490
- onChange: (e) => te(e.target.value),
491
- children: [/* @__PURE__ */ A("option", {
536
+ onChange: (e) => b(e.target.value),
537
+ children: [/* @__PURE__ */ M("option", {
492
538
  value: "OUTFLOW_NEGATIVE",
493
- children: i("banking.import.negative", "Negative (bank)")
494
- }), /* @__PURE__ */ A("option", {
539
+ children: a("banking.import.negative", "Negative (bank)")
540
+ }), /* @__PURE__ */ M("option", {
495
541
  value: "OUTFLOW_POSITIVE",
496
- children: i("banking.import.positive", "Positive (card)")
542
+ children: a("banking.import.positive", "Positive (card)")
497
543
  })]
498
544
  })]
499
545
  }),
500
- /* @__PURE__ */ j("label", {
546
+ /* @__PURE__ */ N("label", {
501
547
  className: "block text-sm text-text-primary",
502
- children: [i("banking.import.dateFormat", "Date format"), /* @__PURE__ */ j("select", {
503
- className: r(M, "mt-1"),
504
- value: b,
505
- onChange: (e) => x(e.target.value),
548
+ children: [a("banking.import.dateFormat", "Date format"), /* @__PURE__ */ N("select", {
549
+ className: r(P, "mt-1"),
550
+ value: x,
551
+ onChange: (e) => S(e.target.value),
506
552
  children: [
507
- /* @__PURE__ */ A("option", {
553
+ /* @__PURE__ */ M("option", {
508
554
  value: "MDY",
509
555
  children: "MM/DD/YYYY"
510
556
  }),
511
- /* @__PURE__ */ A("option", {
557
+ /* @__PURE__ */ M("option", {
512
558
  value: "DMY",
513
559
  children: "DD/MM/YYYY"
514
560
  }),
515
- /* @__PURE__ */ A("option", {
561
+ /* @__PURE__ */ M("option", {
516
562
  value: "YMD",
517
563
  children: "YYYY-MM-DD"
518
564
  })
@@ -521,49 +567,49 @@ function ce({ connections: e, onClose: n, onImported: ee }) {
521
567
  })
522
568
  ]
523
569
  }),
524
- /* @__PURE__ */ j("label", {
570
+ /* @__PURE__ */ N("label", {
525
571
  className: "block text-sm text-text-primary",
526
- children: [i("banking.import.file", "CSV file"), /* @__PURE__ */ A("input", {
572
+ children: [a("banking.import.file", "CSV file"), /* @__PURE__ */ M("input", {
527
573
  type: "file",
528
574
  accept: ".csv,text/csv,text/plain",
529
- className: r(M, "mt-1"),
530
- onChange: (e) => void re(e.target.files?.[0]),
575
+ className: r(P, "mt-1"),
576
+ onChange: (e) => void A(e.target.files?.[0]),
531
577
  id: "statement-file",
532
- ...D("statement-file"),
578
+ ...O("statement-file"),
533
579
  "data-testid": "import-statement-file"
534
580
  })]
535
581
  }),
536
- /* @__PURE__ */ j("label", {
582
+ /* @__PURE__ */ N("label", {
537
583
  className: "block text-sm text-text-primary",
538
- children: [i("banking.import.paste", "Or paste the statement"), /* @__PURE__ */ A("textarea", {
539
- className: r(M, "mt-1 h-32 font-mono text-xs"),
540
- value: S,
541
- onChange: (e) => C(e.target.value),
584
+ children: [a("banking.import.paste", "Or paste the statement"), /* @__PURE__ */ M("textarea", {
585
+ className: r(P, "mt-1 h-32 font-mono text-xs"),
586
+ value: C,
587
+ onChange: (e) => w(e.target.value),
542
588
  placeholder: "Date,Description,Amount\n10/05/2026,NETFLIX.COM,-15.49",
543
589
  id: "statement-csv",
544
- ...D("statement-csv"),
590
+ ...O("statement-csv"),
545
591
  "data-testid": "import-statement-csv"
546
592
  })]
547
593
  }),
548
- T && /* @__PURE__ */ A("p", {
549
- id: ne,
594
+ E && /* @__PURE__ */ M("p", {
595
+ id: k,
550
596
  tabIndex: -1,
551
597
  role: "alert",
552
598
  className: "text-sm text-status-error-text",
553
- children: T
599
+ children: E
554
600
  }),
555
- /* @__PURE__ */ j("div", {
601
+ /* @__PURE__ */ N("div", {
556
602
  className: "flex justify-end gap-2 pt-1",
557
- children: [/* @__PURE__ */ A("button", {
603
+ children: [/* @__PURE__ */ M("button", {
558
604
  type: "button",
559
- className: P,
605
+ className: I,
560
606
  onClick: n,
561
- children: i("common.cancel", "Cancel")
562
- }), /* @__PURE__ */ A("button", {
607
+ children: a("common.cancel", "Cancel")
608
+ }), /* @__PURE__ */ M("button", {
563
609
  type: "submit",
564
- className: N,
565
- disabled: a.isPending,
566
- children: a.isPending ? i("banking.import.submitting", "Importing…") : i("banking.import.submit", "Import and find subscriptions")
610
+ className: F,
611
+ disabled: o.isPending,
612
+ children: o.isPending ? a("banking.import.submitting", "Importing…") : a("banking.import.submit", "Import and find subscriptions")
567
613
  })]
568
614
  })
569
615
  ]