@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.
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts +2 -0
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +1 -1
- package/dist/stories/support/bankingFixtures.d.ts.map +1 -1
- package/dist/subscriberbot/components/PageLayout.d.ts.map +1 -1
- package/dist/subscriberbot/components/PageLayout.js +1 -1
- package/dist/subscriberbot/components/PageLayout.js.map +1 -1
- package/dist/subscriberbot/hooks/useBankingApi.d.ts +1 -0
- package/dist/subscriberbot/hooks/useBankingApi.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/useBankingApi.js +3 -3
- package/dist/subscriberbot/hooks/useBankingApi.js.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +402 -299
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/ConnectBankModal.d.ts +17 -0
- package/dist/subscriberbot/pages/banking/ConnectBankModal.d.ts.map +1 -0
- package/dist/subscriberbot/pages/banking/ConnectBankModal.js +156 -0
- package/dist/subscriberbot/pages/banking/ConnectBankModal.js.map +1 -0
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +5 -5
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
- package/dist/subscriberbot/types/banking.d.ts +12 -1
- package/dist/subscriberbot/types/banking.d.ts.map +1 -1
- package/dist/subscriberbot/utils/bankRedirectLink.d.ts +27 -0
- package/dist/subscriberbot/utils/bankRedirectLink.d.ts.map +1 -0
- package/dist/subscriberbot/utils/bankRedirectLink.js +68 -0
- package/dist/subscriberbot/utils/bankRedirectLink.js.map +1 -0
- package/dist/subscriberbot/utils/portfolio.d.ts +7 -4
- package/dist/subscriberbot/utils/portfolio.d.ts.map +1 -1
- package/dist/subscriberbot/utils/portfolio.js +47 -38
- package/dist/subscriberbot/utils/portfolio.js.map +1 -1
- 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
|
|
6
|
-
import { MetricsCard as
|
|
7
|
-
import { StatusBadge as
|
|
8
|
-
import { EmptyState as
|
|
9
|
-
import { Modal as
|
|
10
|
-
import { ErrorView as
|
|
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
|
|
13
|
-
import { useBankAggregators as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
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
|
|
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
|
-
],
|
|
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
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
42
|
-
return [...e.entries()].map(([e, t]) =>
|
|
43
|
-
}, [
|
|
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
|
-
}),
|
|
48
|
-
|
|
77
|
+
}), Pe = async () => {
|
|
78
|
+
L(null), z(!0);
|
|
49
79
|
try {
|
|
50
|
-
let e = await
|
|
80
|
+
let e = await b((await K.mutateAsync({ aggregator: "PLAID" })).linkToken, O);
|
|
51
81
|
if (!e) return;
|
|
52
|
-
|
|
82
|
+
L({
|
|
53
83
|
tone: "success",
|
|
54
|
-
text:
|
|
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
|
-
|
|
92
|
+
L({
|
|
63
93
|
tone: "error",
|
|
64
|
-
text:
|
|
94
|
+
text: N(e, O)
|
|
65
95
|
});
|
|
66
96
|
} finally {
|
|
67
|
-
|
|
97
|
+
z(!1);
|
|
68
98
|
}
|
|
69
|
-
},
|
|
70
|
-
|
|
99
|
+
}, Fe = async (e, t, n) => {
|
|
100
|
+
L(null), z(!0);
|
|
71
101
|
try {
|
|
72
|
-
|
|
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,
|
|
76
|
-
|
|
165
|
+
})).linkToken, O)) return;
|
|
166
|
+
L({
|
|
77
167
|
tone: "success",
|
|
78
|
-
text:
|
|
168
|
+
text: Z(await q.mutateAsync({ id: e.id }))
|
|
79
169
|
});
|
|
80
170
|
} catch (e) {
|
|
81
|
-
|
|
171
|
+
L({
|
|
82
172
|
tone: "error",
|
|
83
|
-
text:
|
|
173
|
+
text: N(e, O)
|
|
84
174
|
});
|
|
85
175
|
} finally {
|
|
86
|
-
|
|
176
|
+
z(!1);
|
|
87
177
|
}
|
|
88
|
-
},
|
|
89
|
-
|
|
178
|
+
}, Le = async (e) => {
|
|
179
|
+
L(null);
|
|
90
180
|
try {
|
|
91
|
-
|
|
181
|
+
L({
|
|
92
182
|
tone: "success",
|
|
93
|
-
text:
|
|
183
|
+
text: Z(await q.mutateAsync({ id: e.id }))
|
|
94
184
|
});
|
|
95
185
|
} catch (e) {
|
|
96
|
-
|
|
186
|
+
L({
|
|
97
187
|
tone: "error",
|
|
98
|
-
text:
|
|
188
|
+
text: N(e, O)
|
|
99
189
|
});
|
|
100
190
|
}
|
|
101
|
-
},
|
|
102
|
-
if (window.confirm(
|
|
103
|
-
|
|
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
|
|
195
|
+
await De.mutateAsync({ id: e.id }), L({
|
|
106
196
|
tone: "success",
|
|
107
|
-
text:
|
|
197
|
+
text: O("banking.notice.disconnected", "{{institution}} was disconnected.", { institution: e.institutionName })
|
|
108
198
|
});
|
|
109
199
|
} catch (e) {
|
|
110
|
-
|
|
200
|
+
L({
|
|
111
201
|
tone: "error",
|
|
112
|
-
text:
|
|
202
|
+
text: N(e, O)
|
|
113
203
|
});
|
|
114
204
|
}
|
|
115
205
|
}
|
|
116
206
|
}, $ = async (e, t) => {
|
|
117
|
-
|
|
207
|
+
L(null);
|
|
118
208
|
try {
|
|
119
209
|
let n = await {
|
|
120
|
-
track:
|
|
121
|
-
dismiss:
|
|
122
|
-
restore:
|
|
210
|
+
track: Oe,
|
|
211
|
+
dismiss: ke,
|
|
212
|
+
restore: Ae
|
|
123
213
|
}[e].mutateAsync({ id: t.id });
|
|
124
|
-
e === "track" &&
|
|
214
|
+
e === "track" && L({
|
|
125
215
|
tone: "success",
|
|
126
|
-
text:
|
|
216
|
+
text: O("banking.notice.tracked", "{{name}} is now tracked as a subscription.", { name: n.displayName })
|
|
127
217
|
});
|
|
128
218
|
} catch (e) {
|
|
129
|
-
|
|
219
|
+
L({
|
|
130
220
|
tone: "error",
|
|
131
|
-
text:
|
|
221
|
+
text: N(e, O)
|
|
132
222
|
});
|
|
133
223
|
}
|
|
134
|
-
},
|
|
224
|
+
}, ze = /* @__PURE__ */ D("div", {
|
|
135
225
|
className: "flex flex-wrap gap-2",
|
|
136
226
|
"data-tour": "subscriberbot-banking-connect",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
227
|
+
children: [/* @__PURE__ */ D("button", {
|
|
138
228
|
type: "button",
|
|
139
|
-
className:
|
|
140
|
-
onClick: () =>
|
|
229
|
+
className: A,
|
|
230
|
+
onClick: () => F(!0),
|
|
141
231
|
children: [
|
|
142
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ E(ce, {
|
|
143
233
|
className: "h-4 w-4",
|
|
144
234
|
"aria-hidden": !0
|
|
145
235
|
}),
|
|
146
236
|
" ",
|
|
147
|
-
|
|
237
|
+
O("banking.import.open", "Import a statement")
|
|
148
238
|
]
|
|
149
|
-
}), /* @__PURE__ */
|
|
239
|
+
}), /* @__PURE__ */ D("button", {
|
|
150
240
|
type: "button",
|
|
151
|
-
className:
|
|
152
|
-
onClick: () =>
|
|
153
|
-
disabled: !
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
}),
|
|
249
|
+
}), R ? O("banking.plaid.linking", "Connecting…") : O("banking.plaid.connect", "Connect a bank")]
|
|
159
250
|
})]
|
|
160
251
|
});
|
|
161
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ D(ee, {
|
|
162
253
|
dataTour: "subscriberbot-banking",
|
|
163
|
-
title:
|
|
164
|
-
description:
|
|
165
|
-
actions:
|
|
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__ */
|
|
258
|
+
/* @__PURE__ */ E(he, {
|
|
168
259
|
className: "mb-6",
|
|
169
|
-
children:
|
|
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
|
-
|
|
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__ */
|
|
265
|
+
children: [/* @__PURE__ */ E(fe, {
|
|
175
266
|
className: "mt-0.5 h-4 w-4 shrink-0",
|
|
176
267
|
"aria-hidden": !0
|
|
177
|
-
}),
|
|
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
|
-
|
|
180
|
-
role:
|
|
181
|
-
className: r("mb-4 rounded-lg px-3 py-2 text-sm",
|
|
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:
|
|
274
|
+
children: I.text
|
|
184
275
|
}),
|
|
185
|
-
/* @__PURE__ */
|
|
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__ */
|
|
190
|
-
icon: /* @__PURE__ */
|
|
191
|
-
value:
|
|
192
|
-
label:
|
|
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__ */
|
|
195
|
-
icon: /* @__PURE__ */
|
|
196
|
-
value:
|
|
197
|
-
label:
|
|
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__ */
|
|
200
|
-
icon: /* @__PURE__ */
|
|
201
|
-
value:
|
|
202
|
-
label:
|
|
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__ */
|
|
205
|
-
icon: /* @__PURE__ */
|
|
206
|
-
value:
|
|
207
|
-
label:
|
|
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__ */
|
|
302
|
+
/* @__PURE__ */ D(u, {
|
|
212
303
|
dataTour: "subscriberbot-banking-charges",
|
|
213
|
-
title:
|
|
214
|
-
description:
|
|
215
|
-
children: [/* @__PURE__ */
|
|
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":
|
|
308
|
+
"aria-label": O("banking.charges.filter", "Charge status"),
|
|
218
309
|
className: "mb-3 flex gap-1.5",
|
|
219
|
-
children:
|
|
310
|
+
children: ge.map((e) => /* @__PURE__ */ E("button", {
|
|
220
311
|
type: "button",
|
|
221
312
|
role: "tab",
|
|
222
|
-
"aria-selected":
|
|
223
|
-
onClick: () =>
|
|
224
|
-
className: r("rounded-lg px-3 py-1.5 text-xs font-medium",
|
|
225
|
-
children:
|
|
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
|
-
}),
|
|
228
|
-
message:
|
|
229
|
-
onRetry: () => void
|
|
230
|
-
}) :
|
|
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:
|
|
233
|
-
description:
|
|
234
|
-
}) : /* @__PURE__ */
|
|
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:
|
|
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__ */
|
|
332
|
+
/* @__PURE__ */ D("div", {
|
|
242
333
|
className: "flex items-start justify-between gap-3",
|
|
243
|
-
children: [/* @__PURE__ */
|
|
334
|
+
children: [/* @__PURE__ */ D("div", {
|
|
244
335
|
className: "min-w-0",
|
|
245
|
-
children: [/* @__PURE__ */
|
|
336
|
+
children: [/* @__PURE__ */ E("p", {
|
|
246
337
|
className: "truncate text-sm font-semibold text-text-primary",
|
|
247
338
|
children: e.displayName
|
|
248
|
-
}), /* @__PURE__ */
|
|
339
|
+
}), /* @__PURE__ */ E("p", {
|
|
249
340
|
className: "mt-0.5 text-xs text-text-secondary",
|
|
250
|
-
children:
|
|
341
|
+
children: O("banking.charges.meta", "{{count}} charges since {{first}} · {{confidence}}% sure", {
|
|
251
342
|
count: e.occurrences,
|
|
252
|
-
first:
|
|
343
|
+
first: d(e.firstChargedOn),
|
|
253
344
|
confidence: e.confidence
|
|
254
345
|
})
|
|
255
346
|
})]
|
|
256
|
-
}), /* @__PURE__ */
|
|
347
|
+
}), /* @__PURE__ */ D("span", {
|
|
257
348
|
className: "shrink-0 text-sm font-semibold text-text-primary",
|
|
258
|
-
children: [
|
|
349
|
+
children: [s(e.lastAmount, e.currency), re(e.interval)]
|
|
259
350
|
})]
|
|
260
351
|
}),
|
|
261
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ D("p", {
|
|
262
353
|
className: "mt-2 text-xs text-text-secondary",
|
|
263
354
|
children: [
|
|
264
|
-
|
|
265
|
-
e.nextExpectedOn && ` · ${
|
|
266
|
-
` · ${
|
|
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__ */
|
|
360
|
+
/* @__PURE__ */ D("div", {
|
|
270
361
|
className: "mt-3 flex flex-wrap gap-2",
|
|
271
362
|
children: [
|
|
272
|
-
e.status === "DETECTED" && /* @__PURE__ */
|
|
363
|
+
e.status === "DETECTED" && /* @__PURE__ */ D(me, { children: [/* @__PURE__ */ E("button", {
|
|
273
364
|
type: "button",
|
|
274
|
-
className:
|
|
365
|
+
className: k,
|
|
275
366
|
onClick: () => void $("track", e),
|
|
276
|
-
disabled:
|
|
277
|
-
children:
|
|
278
|
-
}), /* @__PURE__ */
|
|
367
|
+
disabled: Oe.isPending,
|
|
368
|
+
children: O("banking.charges.track", "Track as subscription")
|
|
369
|
+
}), /* @__PURE__ */ E("button", {
|
|
279
370
|
type: "button",
|
|
280
|
-
className:
|
|
371
|
+
className: A,
|
|
281
372
|
onClick: () => void $("dismiss", e),
|
|
282
|
-
disabled:
|
|
283
|
-
children:
|
|
373
|
+
disabled: ke.isPending,
|
|
374
|
+
children: O("banking.charges.dismiss", "Not a subscription")
|
|
284
375
|
})] }),
|
|
285
|
-
e.status === "TRACKED" && e.relationshipId && /* @__PURE__ */
|
|
376
|
+
e.status === "TRACKED" && e.relationshipId && /* @__PURE__ */ E("button", {
|
|
286
377
|
type: "button",
|
|
287
|
-
className:
|
|
288
|
-
onClick: () =>
|
|
289
|
-
children:
|
|
378
|
+
className: A,
|
|
379
|
+
onClick: () => ve(`/relationships/${e.relationshipId}`),
|
|
380
|
+
children: O("banking.charges.view", "View subscription")
|
|
290
381
|
}),
|
|
291
|
-
e.status === "DISMISSED" && /* @__PURE__ */
|
|
382
|
+
e.status === "DISMISSED" && /* @__PURE__ */ E("button", {
|
|
292
383
|
type: "button",
|
|
293
|
-
className:
|
|
384
|
+
className: A,
|
|
294
385
|
onClick: () => void $("restore", e),
|
|
295
|
-
disabled:
|
|
296
|
-
children:
|
|
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__ */
|
|
395
|
+
/* @__PURE__ */ E(u, {
|
|
305
396
|
dataTour: "subscriberbot-banking-connections",
|
|
306
|
-
title:
|
|
307
|
-
description:
|
|
308
|
-
children:
|
|
309
|
-
message:
|
|
310
|
-
onRetry: () => void
|
|
311
|
-
}) :
|
|
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:
|
|
314
|
-
description:
|
|
315
|
-
action: /* @__PURE__ */
|
|
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:
|
|
318
|
-
onClick: () =>
|
|
408
|
+
className: k,
|
|
409
|
+
onClick: () => F(!0),
|
|
319
410
|
children: [
|
|
320
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ E(ce, {
|
|
321
412
|
className: "h-4 w-4",
|
|
322
413
|
"aria-hidden": !0
|
|
323
414
|
}),
|
|
324
415
|
" ",
|
|
325
|
-
|
|
416
|
+
O("banking.import.open", "Import a statement")
|
|
326
417
|
]
|
|
327
418
|
})
|
|
328
|
-
}) : /* @__PURE__ */
|
|
419
|
+
}) : /* @__PURE__ */ E("ul", {
|
|
329
420
|
className: "space-y-3",
|
|
330
421
|
"data-testid": "bank-connection-list",
|
|
331
|
-
children:
|
|
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__ */
|
|
425
|
+
children: [/* @__PURE__ */ D("div", {
|
|
335
426
|
className: "min-w-0",
|
|
336
427
|
children: [
|
|
337
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ D("div", {
|
|
338
429
|
className: "flex items-center gap-2",
|
|
339
|
-
children: [/* @__PURE__ */
|
|
430
|
+
children: [/* @__PURE__ */ E("p", {
|
|
340
431
|
className: "truncate text-sm font-semibold text-text-primary",
|
|
341
432
|
children: e.institutionName
|
|
342
|
-
}), /* @__PURE__ */
|
|
433
|
+
}), /* @__PURE__ */ E(a, { status: e.status })]
|
|
343
434
|
}),
|
|
344
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ D("p", {
|
|
345
436
|
className: "mt-0.5 text-xs text-text-secondary",
|
|
346
437
|
children: [
|
|
347
|
-
e.aggregator
|
|
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(", ") ||
|
|
440
|
+
e.accounts.map((e) => e.mask ? `${e.name} ••${e.mask}` : e.name).join(", ") || O("banking.connections.noAccounts", "no accounts yet"),
|
|
350
441
|
" · ",
|
|
351
|
-
|
|
352
|
-
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.
|
|
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__ */
|
|
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:
|
|
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__ */
|
|
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:
|
|
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__ */
|
|
466
|
+
}), /* @__PURE__ */ D("div", {
|
|
371
467
|
className: "flex shrink-0 gap-2",
|
|
372
468
|
children: [
|
|
373
|
-
e.aggregator
|
|
469
|
+
M.has(e.aggregator) && e.status === "NEEDS_REAUTH" && /* @__PURE__ */ D("button", {
|
|
374
470
|
type: "button",
|
|
375
|
-
className:
|
|
376
|
-
onClick: () => void
|
|
377
|
-
disabled:
|
|
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__ */
|
|
475
|
+
/* @__PURE__ */ E(T, {
|
|
380
476
|
className: "h-3.5 w-3.5",
|
|
381
477
|
"aria-hidden": !0
|
|
382
478
|
}),
|
|
383
479
|
" ",
|
|
384
|
-
|
|
480
|
+
O("banking.connections.reconnect", "Reconnect")
|
|
385
481
|
]
|
|
386
482
|
}),
|
|
387
|
-
e.aggregator
|
|
483
|
+
M.has(e.aggregator) && e.status !== "REVOKED" && e.status !== "NEEDS_REAUTH" && /* @__PURE__ */ D("button", {
|
|
388
484
|
type: "button",
|
|
389
|
-
className:
|
|
390
|
-
onClick: () => void
|
|
391
|
-
disabled:
|
|
485
|
+
className: j,
|
|
486
|
+
onClick: () => void Le(e),
|
|
487
|
+
disabled: q.isPending || !je(e.aggregator),
|
|
392
488
|
children: [
|
|
393
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ E(ue, {
|
|
394
490
|
className: "h-3.5 w-3.5",
|
|
395
491
|
"aria-hidden": !0
|
|
396
492
|
}),
|
|
397
493
|
" ",
|
|
398
|
-
|
|
494
|
+
O("banking.connections.sync", "Sync")
|
|
399
495
|
]
|
|
400
496
|
}),
|
|
401
|
-
/* @__PURE__ */
|
|
497
|
+
/* @__PURE__ */ D("button", {
|
|
402
498
|
type: "button",
|
|
403
|
-
className:
|
|
404
|
-
onClick: () => void
|
|
405
|
-
disabled:
|
|
499
|
+
className: j,
|
|
500
|
+
onClick: () => void Re(e),
|
|
501
|
+
disabled: De.isPending,
|
|
406
502
|
children: [
|
|
407
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ E(pe, {
|
|
408
504
|
className: "h-3.5 w-3.5",
|
|
409
505
|
"aria-hidden": !0
|
|
410
506
|
}),
|
|
411
507
|
" ",
|
|
412
|
-
|
|
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
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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
|
-
|
|
527
|
+
F(!1), Se("DETECTED"), L({
|
|
425
528
|
tone: "success",
|
|
426
|
-
text:
|
|
529
|
+
text: Z(e)
|
|
427
530
|
});
|
|
428
531
|
}
|
|
429
532
|
})
|
|
430
533
|
]
|
|
431
534
|
});
|
|
432
535
|
}
|
|
433
|
-
function
|
|
434
|
-
let
|
|
435
|
-
if (
|
|
436
|
-
if (e.size >
|
|
437
|
-
|
|
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
|
-
|
|
543
|
+
y(await e.text());
|
|
441
544
|
}
|
|
442
|
-
},
|
|
443
|
-
if (e.preventDefault(),
|
|
444
|
-
|
|
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
|
-
|
|
449
|
-
connectionId:
|
|
450
|
-
institutionName:
|
|
451
|
-
accountName:
|
|
452
|
-
accountMask:
|
|
453
|
-
currency:
|
|
454
|
-
csv:
|
|
455
|
-
amountConvention:
|
|
456
|
-
dateFormat:
|
|
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
|
-
|
|
562
|
+
x(N(e, i));
|
|
460
563
|
}
|
|
461
564
|
};
|
|
462
|
-
return /* @__PURE__ */
|
|
463
|
-
title:
|
|
464
|
-
description:
|
|
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__ */
|
|
468
|
-
onSubmit: (e) => void
|
|
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__ */
|
|
575
|
+
e.length > 0 && /* @__PURE__ */ D("label", {
|
|
473
576
|
className: "block text-sm text-text-primary",
|
|
474
|
-
children: [
|
|
475
|
-
className: r(
|
|
476
|
-
value:
|
|
477
|
-
onChange: (e) =>
|
|
478
|
-
children: [/* @__PURE__ */
|
|
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:
|
|
481
|
-
}), e.map((e) => /* @__PURE__ */
|
|
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
|
-
!
|
|
590
|
+
!o && /* @__PURE__ */ D("label", {
|
|
488
591
|
className: "block text-sm text-text-primary",
|
|
489
|
-
children: [
|
|
490
|
-
className: r(
|
|
491
|
-
value:
|
|
492
|
-
onChange: (e) =>
|
|
493
|
-
placeholder:
|
|
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__ */
|
|
600
|
+
/* @__PURE__ */ D("div", {
|
|
498
601
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
|
|
499
|
-
children: [/* @__PURE__ */
|
|
602
|
+
children: [/* @__PURE__ */ D("label", {
|
|
500
603
|
className: "block text-sm text-text-primary sm:col-span-2",
|
|
501
|
-
children: [
|
|
502
|
-
className: r(
|
|
503
|
-
value:
|
|
504
|
-
onChange: (e) =>
|
|
505
|
-
placeholder:
|
|
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__ */
|
|
611
|
+
}), /* @__PURE__ */ D("label", {
|
|
509
612
|
className: "block text-sm text-text-primary",
|
|
510
|
-
children: [
|
|
511
|
-
className: r(
|
|
512
|
-
value:
|
|
513
|
-
onChange: (e) =>
|
|
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__ */
|
|
622
|
+
/* @__PURE__ */ D("div", {
|
|
520
623
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
|
|
521
624
|
children: [
|
|
522
|
-
/* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ D("label", {
|
|
523
626
|
className: "block text-sm text-text-primary",
|
|
524
|
-
children: [
|
|
525
|
-
className: r(
|
|
526
|
-
value:
|
|
527
|
-
onChange: (e) =>
|
|
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__ */
|
|
634
|
+
/* @__PURE__ */ D("label", {
|
|
532
635
|
className: "block text-sm text-text-primary",
|
|
533
|
-
children: [
|
|
534
|
-
className: r(
|
|
535
|
-
value:
|
|
536
|
-
onChange: (e) =>
|
|
537
|
-
children: [/* @__PURE__ */
|
|
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:
|
|
540
|
-
}), /* @__PURE__ */
|
|
642
|
+
children: i("banking.import.negative", "Negative (bank)")
|
|
643
|
+
}), /* @__PURE__ */ E("option", {
|
|
541
644
|
value: "OUTFLOW_POSITIVE",
|
|
542
|
-
children:
|
|
645
|
+
children: i("banking.import.positive", "Positive (card)")
|
|
543
646
|
})]
|
|
544
647
|
})]
|
|
545
648
|
}),
|
|
546
|
-
/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ D("label", {
|
|
547
650
|
className: "block text-sm text-text-primary",
|
|
548
|
-
children: [
|
|
549
|
-
className: r(
|
|
550
|
-
value:
|
|
551
|
-
onChange: (e) =>
|
|
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__ */
|
|
656
|
+
/* @__PURE__ */ E("option", {
|
|
554
657
|
value: "MDY",
|
|
555
658
|
children: "MM/DD/YYYY"
|
|
556
659
|
}),
|
|
557
|
-
/* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ E("option", {
|
|
558
661
|
value: "DMY",
|
|
559
662
|
children: "DD/MM/YYYY"
|
|
560
663
|
}),
|
|
561
|
-
/* @__PURE__ */
|
|
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__ */
|
|
673
|
+
/* @__PURE__ */ D("label", {
|
|
571
674
|
className: "block text-sm text-text-primary",
|
|
572
|
-
children: [
|
|
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(
|
|
576
|
-
onChange: (e) => void
|
|
678
|
+
className: r(O, "mt-1"),
|
|
679
|
+
onChange: (e) => void oe(e.target.files?.[0]),
|
|
577
680
|
id: "statement-file",
|
|
578
|
-
...
|
|
681
|
+
...S("statement-file"),
|
|
579
682
|
"data-testid": "import-statement-file"
|
|
580
683
|
})]
|
|
581
684
|
}),
|
|
582
|
-
/* @__PURE__ */
|
|
685
|
+
/* @__PURE__ */ D("label", {
|
|
583
686
|
className: "block text-sm text-text-primary",
|
|
584
|
-
children: [
|
|
585
|
-
className: r(
|
|
586
|
-
value:
|
|
587
|
-
onChange: (e) =>
|
|
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
|
-
...
|
|
693
|
+
...S("statement-csv"),
|
|
591
694
|
"data-testid": "import-statement-csv"
|
|
592
695
|
})]
|
|
593
696
|
}),
|
|
594
|
-
|
|
595
|
-
id:
|
|
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:
|
|
702
|
+
children: b
|
|
600
703
|
}),
|
|
601
|
-
/* @__PURE__ */
|
|
704
|
+
/* @__PURE__ */ D("div", {
|
|
602
705
|
className: "flex justify-end gap-2 pt-1",
|
|
603
|
-
children: [/* @__PURE__ */
|
|
706
|
+
children: [/* @__PURE__ */ E("button", {
|
|
604
707
|
type: "button",
|
|
605
|
-
className:
|
|
708
|
+
className: A,
|
|
606
709
|
onClick: n,
|
|
607
|
-
children:
|
|
608
|
-
}), /* @__PURE__ */
|
|
710
|
+
children: i("common.cancel", "Cancel")
|
|
711
|
+
}), /* @__PURE__ */ E("button", {
|
|
609
712
|
type: "submit",
|
|
610
|
-
className:
|
|
611
|
-
disabled:
|
|
612
|
-
children:
|
|
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 {
|
|
723
|
+
export { P as BankConnectionsPage };
|
|
621
724
|
|
|
622
725
|
//# sourceMappingURL=BankConnectionsPage.js.map
|