@burdenoff/microfe-subscriberbot 2026.1107.4 → 2026.1107.6

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