@burdenoff/microfe-subscriberbot 2026.706.2 → 2026.706.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/subscriberbot/SubscriberBotRoutes.js +14 -6
- package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
- package/dist/subscriberbot/components/index.js +7 -0
- package/dist/subscriberbot/components/viz.js +196 -0
- package/dist/subscriberbot/components/viz.js.map +1 -0
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js +38 -30
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
- package/dist/subscriberbot/pages/AssetVaultPage.js +182 -0
- package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -0
- package/dist/subscriberbot/pages/DashboardPage.js +272 -199
- package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
- package/dist/subscriberbot/pages/InboxPage.js +517 -234
- package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.js +220 -0
- package/dist/subscriberbot/pages/InsightsPage.js.map +1 -0
- package/dist/subscriberbot/pages/InvoicesPage.js +325 -237
- package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.js +301 -112
- package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js +311 -165
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentsListPage.js +183 -93
- package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +426 -293
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js +217 -153
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js +215 -112
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +542 -428
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +242 -192
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +174 -133
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,15 +5,16 @@ import { MetricsCard as r } from "../components/MetricsCard.js";
|
|
|
5
5
|
import { formatCurrency as i, formatDate as a } from "../utils/formatters.js";
|
|
6
6
|
import { StatusBadge as o } from "../components/StatusBadge.js";
|
|
7
7
|
import { EmptyState as s } from "../components/EmptyState.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
8
|
+
import { Modal as c } from "../components/Modal.js";
|
|
9
|
+
import { ErrorView as l, LoadingView as u, Section as d } from "../components/StateViews.js";
|
|
10
|
+
import { CHART_COLORS as f, Donut as p, Legend as m } from "../components/viz.js";
|
|
11
|
+
import { useCreateInvoice as h, useCreatePaymentInstrument as g, useInvoices as _, useMarkInvoicePaid as v, usePaymentInstruments as y, useRelationships as b, useRemovePaymentInstrument as x } from "../hooks/useSubscriberBotApi.js";
|
|
12
|
+
import { useMemo as S, useState as C } from "react";
|
|
13
|
+
import { AlertTriangle as w, CheckCircle2 as T, CreditCard as E, FileText as D, Plus as O, Receipt as k, Star as A, Trash2 as j } from "lucide-react";
|
|
14
|
+
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
15
|
+
import { GlassCard as F, PagePurpose as I } from "@burdenoff/fe-libs/ui";
|
|
15
16
|
//#region src/subscriberbot/pages/InvoicesPage.tsx
|
|
16
|
-
var
|
|
17
|
+
var L = 25, R = "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)]", z = "mb-1 block text-xs font-medium text-text-secondary", B = [
|
|
17
18
|
{
|
|
18
19
|
value: "",
|
|
19
20
|
label: "All statuses"
|
|
@@ -46,7 +47,7 @@ var j = 25, M = "w-full rounded-lg border border-border-subtle bg-bg-surface px-
|
|
|
46
47
|
value: "REFUNDED",
|
|
47
48
|
label: "Refunded"
|
|
48
49
|
}
|
|
49
|
-
],
|
|
50
|
+
], V = [
|
|
50
51
|
"ISSUED",
|
|
51
52
|
"DRAFT",
|
|
52
53
|
"OVERDUE",
|
|
@@ -54,28 +55,36 @@ var j = 25, M = "w-full rounded-lg border border-border-subtle bg-bg-surface px-
|
|
|
54
55
|
"FAILED",
|
|
55
56
|
"CANCELLED",
|
|
56
57
|
"REFUNDED"
|
|
57
|
-
],
|
|
58
|
+
], H = [
|
|
58
59
|
"CARD",
|
|
59
60
|
"BANK_ACCOUNT",
|
|
60
61
|
"PAYPAL",
|
|
61
62
|
"UPI",
|
|
62
63
|
"WALLET",
|
|
63
64
|
"OTHER"
|
|
64
|
-
],
|
|
65
|
+
], U = new Set([
|
|
65
66
|
"ISSUED",
|
|
66
67
|
"OVERDUE",
|
|
67
68
|
"FAILED"
|
|
68
|
-
])
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
]), W = {
|
|
70
|
+
PAID: "var(--color-status-success-text)",
|
|
71
|
+
OVERDUE: "var(--color-status-error-text)",
|
|
72
|
+
FAILED: "var(--color-status-error-text)",
|
|
73
|
+
ISSUED: "var(--color-chart-1)",
|
|
74
|
+
DRAFT: "var(--color-text-secondary)",
|
|
75
|
+
CANCELLED: "var(--color-chart-4)",
|
|
76
|
+
REFUNDED: "var(--color-status-warning-text)"
|
|
77
|
+
};
|
|
78
|
+
function G({ onClose: e }) {
|
|
79
|
+
let t = h(), n = b({ pagination: {
|
|
71
80
|
limit: 100,
|
|
72
81
|
offset: 0
|
|
73
|
-
} }).data?.items ?? [], [r, i] =
|
|
74
|
-
return /* @__PURE__ */
|
|
82
|
+
} }).data?.items ?? [], [r, i] = C(""), [a, o] = C(""), [s, l] = C("ISSUED"), [u, d] = C("USD"), [f, p] = C(""), [m, g] = C(""), [_, v] = C(""), [y, x] = C(""), [S, w] = C(""), [T, E] = C(null);
|
|
83
|
+
return /* @__PURE__ */ N(c, {
|
|
75
84
|
title: "Create invoice",
|
|
76
85
|
onClose: e,
|
|
77
86
|
maxWidthClassName: "max-w-xl",
|
|
78
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ P("form", {
|
|
79
88
|
onSubmit: (n) => {
|
|
80
89
|
if (n.preventDefault(), E(null), !r) {
|
|
81
90
|
E("Select the relationship this invoice belongs to.");
|
|
@@ -84,13 +93,13 @@ function R({ onClose: e }) {
|
|
|
84
93
|
t.mutate({
|
|
85
94
|
relationshipId: r,
|
|
86
95
|
status: s,
|
|
87
|
-
currency:
|
|
96
|
+
currency: u.trim() || "USD",
|
|
88
97
|
...a.trim() ? { number: a.trim() } : {},
|
|
89
98
|
...f.trim() ? { subtotal: Number(f) } : {},
|
|
90
99
|
...m.trim() ? { taxAmount: Number(m) } : {},
|
|
91
100
|
..._.trim() ? { total: Number(_) } : {},
|
|
92
|
-
...
|
|
93
|
-
...
|
|
101
|
+
...y ? { issueDate: new Date(y).toISOString() } : {},
|
|
102
|
+
...S ? { dueDate: new Date(S).toISOString() } : {}
|
|
94
103
|
}, {
|
|
95
104
|
onSuccess: () => e(),
|
|
96
105
|
onError: (e) => E(e instanceof Error ? e.message : "Could not create invoice.")
|
|
@@ -98,150 +107,150 @@ function R({ onClose: e }) {
|
|
|
98
107
|
},
|
|
99
108
|
className: "space-y-4",
|
|
100
109
|
children: [
|
|
101
|
-
T && /* @__PURE__ */
|
|
110
|
+
T && /* @__PURE__ */ N("div", {
|
|
102
111
|
className: "rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
|
|
103
112
|
children: T
|
|
104
113
|
}),
|
|
105
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ P("label", {
|
|
106
115
|
htmlFor: "inv-relationship",
|
|
107
|
-
className:
|
|
108
|
-
children: ["Relationship ", /* @__PURE__ */
|
|
116
|
+
className: z,
|
|
117
|
+
children: ["Relationship ", /* @__PURE__ */ N("span", {
|
|
109
118
|
className: "text-status-error-text",
|
|
110
119
|
children: "*"
|
|
111
120
|
})]
|
|
112
|
-
}), /* @__PURE__ */
|
|
121
|
+
}), /* @__PURE__ */ P("select", {
|
|
113
122
|
id: "inv-relationship",
|
|
114
123
|
value: r,
|
|
115
124
|
onChange: (e) => i(e.target.value),
|
|
116
|
-
className:
|
|
125
|
+
className: R,
|
|
117
126
|
required: !0,
|
|
118
|
-
children: [/* @__PURE__ */
|
|
127
|
+
children: [/* @__PURE__ */ N("option", {
|
|
119
128
|
value: "",
|
|
120
129
|
children: "— Select a relationship —"
|
|
121
|
-
}), n.map((e) => /* @__PURE__ */
|
|
130
|
+
}), n.map((e) => /* @__PURE__ */ N("option", {
|
|
122
131
|
value: e.id,
|
|
123
132
|
children: e.label
|
|
124
133
|
}, e.id))]
|
|
125
134
|
})] }),
|
|
126
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ P("div", {
|
|
127
136
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
|
|
128
137
|
children: [
|
|
129
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
130
139
|
htmlFor: "inv-number",
|
|
131
|
-
className:
|
|
140
|
+
className: z,
|
|
132
141
|
children: "Number"
|
|
133
|
-
}), /* @__PURE__ */
|
|
142
|
+
}), /* @__PURE__ */ N("input", {
|
|
134
143
|
id: "inv-number",
|
|
135
144
|
type: "text",
|
|
136
145
|
value: a,
|
|
137
146
|
onChange: (e) => o(e.target.value),
|
|
138
147
|
placeholder: "INV-0001",
|
|
139
|
-
className:
|
|
148
|
+
className: R
|
|
140
149
|
})] }),
|
|
141
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
142
151
|
htmlFor: "inv-status",
|
|
143
|
-
className:
|
|
152
|
+
className: z,
|
|
144
153
|
children: "Status"
|
|
145
|
-
}), /* @__PURE__ */
|
|
154
|
+
}), /* @__PURE__ */ N("select", {
|
|
146
155
|
id: "inv-status",
|
|
147
156
|
value: s,
|
|
148
|
-
onChange: (e) =>
|
|
149
|
-
className:
|
|
150
|
-
children:
|
|
157
|
+
onChange: (e) => l(e.target.value),
|
|
158
|
+
className: R,
|
|
159
|
+
children: V.map((e) => /* @__PURE__ */ N("option", {
|
|
151
160
|
value: e,
|
|
152
161
|
children: e.replace(/_/g, " ")
|
|
153
162
|
}, e))
|
|
154
163
|
})] }),
|
|
155
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
156
165
|
htmlFor: "inv-currency",
|
|
157
|
-
className:
|
|
166
|
+
className: z,
|
|
158
167
|
children: "Currency"
|
|
159
|
-
}), /* @__PURE__ */
|
|
168
|
+
}), /* @__PURE__ */ N("input", {
|
|
160
169
|
id: "inv-currency",
|
|
161
170
|
type: "text",
|
|
162
|
-
value:
|
|
163
|
-
onChange: (e) =>
|
|
171
|
+
value: u,
|
|
172
|
+
onChange: (e) => d(e.target.value.toUpperCase()),
|
|
164
173
|
maxLength: 3,
|
|
165
|
-
className:
|
|
174
|
+
className: R
|
|
166
175
|
})] })
|
|
167
176
|
]
|
|
168
177
|
}),
|
|
169
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ P("div", {
|
|
170
179
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
|
|
171
180
|
children: [
|
|
172
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
173
182
|
htmlFor: "inv-subtotal",
|
|
174
|
-
className:
|
|
183
|
+
className: z,
|
|
175
184
|
children: "Subtotal"
|
|
176
|
-
}), /* @__PURE__ */
|
|
185
|
+
}), /* @__PURE__ */ N("input", {
|
|
177
186
|
id: "inv-subtotal",
|
|
178
187
|
type: "number",
|
|
179
188
|
min: "0",
|
|
180
189
|
step: "0.01",
|
|
181
190
|
value: f,
|
|
182
191
|
onChange: (e) => p(e.target.value),
|
|
183
|
-
className:
|
|
192
|
+
className: R
|
|
184
193
|
})] }),
|
|
185
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
186
195
|
htmlFor: "inv-tax",
|
|
187
|
-
className:
|
|
196
|
+
className: z,
|
|
188
197
|
children: "Tax"
|
|
189
|
-
}), /* @__PURE__ */
|
|
198
|
+
}), /* @__PURE__ */ N("input", {
|
|
190
199
|
id: "inv-tax",
|
|
191
200
|
type: "number",
|
|
192
201
|
min: "0",
|
|
193
202
|
step: "0.01",
|
|
194
203
|
value: m,
|
|
195
|
-
onChange: (e) =>
|
|
196
|
-
className:
|
|
204
|
+
onChange: (e) => g(e.target.value),
|
|
205
|
+
className: R
|
|
197
206
|
})] }),
|
|
198
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
199
208
|
htmlFor: "inv-total",
|
|
200
|
-
className:
|
|
209
|
+
className: z,
|
|
201
210
|
children: "Total"
|
|
202
|
-
}), /* @__PURE__ */
|
|
211
|
+
}), /* @__PURE__ */ N("input", {
|
|
203
212
|
id: "inv-total",
|
|
204
213
|
type: "number",
|
|
205
214
|
min: "0",
|
|
206
215
|
step: "0.01",
|
|
207
216
|
value: _,
|
|
208
|
-
onChange: (e) =>
|
|
209
|
-
className:
|
|
217
|
+
onChange: (e) => v(e.target.value),
|
|
218
|
+
className: R
|
|
210
219
|
})] })
|
|
211
220
|
]
|
|
212
221
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ P("div", {
|
|
214
223
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
215
|
-
children: [/* @__PURE__ */
|
|
224
|
+
children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
216
225
|
htmlFor: "inv-issue",
|
|
217
|
-
className:
|
|
226
|
+
className: z,
|
|
218
227
|
children: "Issue date"
|
|
219
|
-
}), /* @__PURE__ */
|
|
228
|
+
}), /* @__PURE__ */ N("input", {
|
|
220
229
|
id: "inv-issue",
|
|
221
230
|
type: "date",
|
|
222
|
-
value:
|
|
223
|
-
onChange: (e) =>
|
|
224
|
-
className:
|
|
225
|
-
})] }), /* @__PURE__ */
|
|
231
|
+
value: y,
|
|
232
|
+
onChange: (e) => x(e.target.value),
|
|
233
|
+
className: R
|
|
234
|
+
})] }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
226
235
|
htmlFor: "inv-due",
|
|
227
|
-
className:
|
|
236
|
+
className: z,
|
|
228
237
|
children: "Due date"
|
|
229
|
-
}), /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ N("input", {
|
|
230
239
|
id: "inv-due",
|
|
231
240
|
type: "date",
|
|
232
|
-
value:
|
|
241
|
+
value: S,
|
|
233
242
|
onChange: (e) => w(e.target.value),
|
|
234
|
-
className:
|
|
243
|
+
className: R
|
|
235
244
|
})] })]
|
|
236
245
|
}),
|
|
237
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ P("div", {
|
|
238
247
|
className: "flex justify-end gap-3",
|
|
239
|
-
children: [/* @__PURE__ */
|
|
248
|
+
children: [/* @__PURE__ */ N("button", {
|
|
240
249
|
type: "button",
|
|
241
250
|
onClick: e,
|
|
242
251
|
className: "rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
|
|
243
252
|
children: "Cancel"
|
|
244
|
-
}), /* @__PURE__ */
|
|
253
|
+
}), /* @__PURE__ */ N("button", {
|
|
245
254
|
type: "submit",
|
|
246
255
|
disabled: t.isPending,
|
|
247
256
|
className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50",
|
|
@@ -252,14 +261,14 @@ function R({ onClose: e }) {
|
|
|
252
261
|
})
|
|
253
262
|
});
|
|
254
263
|
}
|
|
255
|
-
function
|
|
256
|
-
let t =
|
|
257
|
-
return /* @__PURE__ */
|
|
264
|
+
function K({ onClose: e }) {
|
|
265
|
+
let t = g(), [n, r] = C(""), [i, a] = C("CARD"), [o, s] = C(""), [l, u] = C(""), [d, f] = C(""), [p, m] = C(""), [h, _] = C(!1), [v, y] = C(null);
|
|
266
|
+
return /* @__PURE__ */ N(c, {
|
|
258
267
|
title: "Add payment method",
|
|
259
268
|
description: "A passive annotation of which external card/account pays for a subscription — no full card numbers or CVV.",
|
|
260
269
|
onClose: e,
|
|
261
270
|
maxWidthClassName: "max-w-xl",
|
|
262
|
-
children: /* @__PURE__ */
|
|
271
|
+
children: /* @__PURE__ */ P("form", {
|
|
263
272
|
onSubmit: (r) => {
|
|
264
273
|
if (r.preventDefault(), y(null), !n.trim()) {
|
|
265
274
|
y("A label is required.");
|
|
@@ -270,8 +279,8 @@ function z({ onClose: e }) {
|
|
|
270
279
|
type: i,
|
|
271
280
|
isDefault: h,
|
|
272
281
|
...o.trim() ? { brand: o.trim() } : {},
|
|
273
|
-
...
|
|
274
|
-
...
|
|
282
|
+
...l.trim() ? { last4: l.trim() } : {},
|
|
283
|
+
...d.trim() ? { expiryMonth: Number(d) } : {},
|
|
275
284
|
...p.trim() ? { expiryYear: Number(p) } : {}
|
|
276
285
|
}, {
|
|
277
286
|
onSuccess: () => e(),
|
|
@@ -280,91 +289,91 @@ function z({ onClose: e }) {
|
|
|
280
289
|
},
|
|
281
290
|
className: "space-y-4",
|
|
282
291
|
children: [
|
|
283
|
-
|
|
292
|
+
v && /* @__PURE__ */ N("div", {
|
|
284
293
|
className: "rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
|
|
285
|
-
children:
|
|
294
|
+
children: v
|
|
286
295
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ P("div", {
|
|
288
297
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
289
|
-
children: [/* @__PURE__ */
|
|
298
|
+
children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ P("label", {
|
|
290
299
|
htmlFor: "pm-label",
|
|
291
|
-
className:
|
|
292
|
-
children: ["Label ", /* @__PURE__ */
|
|
300
|
+
className: z,
|
|
301
|
+
children: ["Label ", /* @__PURE__ */ N("span", {
|
|
293
302
|
className: "text-status-error-text",
|
|
294
303
|
children: "*"
|
|
295
304
|
})]
|
|
296
|
-
}), /* @__PURE__ */
|
|
305
|
+
}), /* @__PURE__ */ N("input", {
|
|
297
306
|
id: "pm-label",
|
|
298
307
|
type: "text",
|
|
299
308
|
value: n,
|
|
300
309
|
onChange: (e) => r(e.target.value),
|
|
301
310
|
placeholder: "e.g. Personal Visa",
|
|
302
|
-
className:
|
|
311
|
+
className: R,
|
|
303
312
|
required: !0
|
|
304
|
-
})] }), /* @__PURE__ */
|
|
313
|
+
})] }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
305
314
|
htmlFor: "pm-type",
|
|
306
|
-
className:
|
|
315
|
+
className: z,
|
|
307
316
|
children: "Type"
|
|
308
|
-
}), /* @__PURE__ */
|
|
317
|
+
}), /* @__PURE__ */ N("select", {
|
|
309
318
|
id: "pm-type",
|
|
310
319
|
value: i,
|
|
311
320
|
onChange: (e) => a(e.target.value),
|
|
312
|
-
className:
|
|
313
|
-
children:
|
|
321
|
+
className: R,
|
|
322
|
+
children: H.map((e) => /* @__PURE__ */ N("option", {
|
|
314
323
|
value: e,
|
|
315
324
|
children: e.replace(/_/g, " ")
|
|
316
325
|
}, e))
|
|
317
326
|
})] })]
|
|
318
327
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ P("div", {
|
|
320
329
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
|
|
321
330
|
children: [
|
|
322
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
323
332
|
htmlFor: "pm-brand",
|
|
324
|
-
className:
|
|
333
|
+
className: z,
|
|
325
334
|
children: "Brand"
|
|
326
|
-
}), /* @__PURE__ */
|
|
335
|
+
}), /* @__PURE__ */ N("input", {
|
|
327
336
|
id: "pm-brand",
|
|
328
337
|
type: "text",
|
|
329
338
|
value: o,
|
|
330
339
|
onChange: (e) => s(e.target.value),
|
|
331
340
|
placeholder: "Visa, Amex…",
|
|
332
|
-
className:
|
|
341
|
+
className: R
|
|
333
342
|
})] }),
|
|
334
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
335
344
|
htmlFor: "pm-last4",
|
|
336
|
-
className:
|
|
345
|
+
className: z,
|
|
337
346
|
children: "Last 4"
|
|
338
|
-
}), /* @__PURE__ */
|
|
347
|
+
}), /* @__PURE__ */ N("input", {
|
|
339
348
|
id: "pm-last4",
|
|
340
349
|
type: "text",
|
|
341
350
|
inputMode: "numeric",
|
|
342
351
|
maxLength: 4,
|
|
343
|
-
value:
|
|
344
|
-
onChange: (e) =>
|
|
352
|
+
value: l,
|
|
353
|
+
onChange: (e) => u(e.target.value.replace(/\D/g, "")),
|
|
345
354
|
placeholder: "4242",
|
|
346
|
-
className:
|
|
355
|
+
className: R
|
|
347
356
|
})] }),
|
|
348
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ P("div", {
|
|
349
358
|
className: "grid grid-cols-2 gap-2",
|
|
350
|
-
children: [/* @__PURE__ */
|
|
359
|
+
children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
351
360
|
htmlFor: "pm-exp-month",
|
|
352
|
-
className:
|
|
361
|
+
className: z,
|
|
353
362
|
children: "Exp. mo."
|
|
354
|
-
}), /* @__PURE__ */
|
|
363
|
+
}), /* @__PURE__ */ N("input", {
|
|
355
364
|
id: "pm-exp-month",
|
|
356
365
|
type: "number",
|
|
357
366
|
min: "1",
|
|
358
367
|
max: "12",
|
|
359
|
-
value:
|
|
360
|
-
onChange: (e) =>
|
|
368
|
+
value: d,
|
|
369
|
+
onChange: (e) => f(e.target.value),
|
|
361
370
|
placeholder: "12",
|
|
362
|
-
className:
|
|
363
|
-
})] }), /* @__PURE__ */
|
|
371
|
+
className: R
|
|
372
|
+
})] }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
364
373
|
htmlFor: "pm-exp-year",
|
|
365
|
-
className:
|
|
374
|
+
className: z,
|
|
366
375
|
children: "Exp. yr."
|
|
367
|
-
}), /* @__PURE__ */
|
|
376
|
+
}), /* @__PURE__ */ N("input", {
|
|
368
377
|
id: "pm-exp-year",
|
|
369
378
|
type: "number",
|
|
370
379
|
min: "2024",
|
|
@@ -372,28 +381,28 @@ function z({ onClose: e }) {
|
|
|
372
381
|
value: p,
|
|
373
382
|
onChange: (e) => m(e.target.value),
|
|
374
383
|
placeholder: "2028",
|
|
375
|
-
className:
|
|
384
|
+
className: R
|
|
376
385
|
})] })]
|
|
377
386
|
})
|
|
378
387
|
]
|
|
379
388
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ P("label", {
|
|
381
390
|
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
382
|
-
children: [/* @__PURE__ */
|
|
391
|
+
children: [/* @__PURE__ */ N("input", {
|
|
383
392
|
type: "checkbox",
|
|
384
393
|
checked: h,
|
|
385
|
-
onChange: (e) =>
|
|
394
|
+
onChange: (e) => _(e.target.checked),
|
|
386
395
|
className: "size-4 rounded border-border-subtle"
|
|
387
396
|
}), "Set as default"]
|
|
388
397
|
}),
|
|
389
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ P("div", {
|
|
390
399
|
className: "flex justify-end gap-3",
|
|
391
|
-
children: [/* @__PURE__ */
|
|
400
|
+
children: [/* @__PURE__ */ N("button", {
|
|
392
401
|
type: "button",
|
|
393
402
|
onClick: e,
|
|
394
403
|
className: "rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
|
|
395
404
|
children: "Cancel"
|
|
396
|
-
}), /* @__PURE__ */
|
|
405
|
+
}), /* @__PURE__ */ N("button", {
|
|
397
406
|
type: "submit",
|
|
398
407
|
disabled: t.isPending,
|
|
399
408
|
className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50",
|
|
@@ -404,192 +413,271 @@ function z({ onClose: e }) {
|
|
|
404
413
|
})
|
|
405
414
|
});
|
|
406
415
|
}
|
|
407
|
-
function
|
|
408
|
-
let { data: e, isLoading: t, isError: n, refetch: r } =
|
|
409
|
-
return /* @__PURE__ */
|
|
416
|
+
function q() {
|
|
417
|
+
let { data: e, isLoading: t, isError: n, refetch: r } = y(), i = x(), [a, c] = C(!1), f = e ?? [];
|
|
418
|
+
return /* @__PURE__ */ P(d, {
|
|
410
419
|
title: "Payment methods",
|
|
411
420
|
description: "Which external cards and accounts pay for your subscriptions",
|
|
412
|
-
action: /* @__PURE__ */
|
|
421
|
+
action: /* @__PURE__ */ P("button", {
|
|
413
422
|
type: "button",
|
|
414
|
-
onClick: () =>
|
|
423
|
+
onClick: () => c(!0),
|
|
415
424
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken",
|
|
416
|
-
children: [/* @__PURE__ */ O
|
|
425
|
+
children: [/* @__PURE__ */ N(O, { className: "h-3.5 w-3.5" }), " Add payment method"]
|
|
417
426
|
}),
|
|
418
|
-
children: [t ? /* @__PURE__ */
|
|
427
|
+
children: [t ? /* @__PURE__ */ N(u, { label: "Loading payment methods…" }) : n ? /* @__PURE__ */ N(l, {
|
|
419
428
|
message: "Could not load payment methods.",
|
|
420
429
|
onRetry: () => void r()
|
|
421
|
-
}) : f.length === 0 ? /* @__PURE__ */
|
|
430
|
+
}) : f.length === 0 ? /* @__PURE__ */ N(s, {
|
|
422
431
|
illustration: "empty-data",
|
|
423
|
-
icon: /* @__PURE__ */
|
|
432
|
+
icon: /* @__PURE__ */ N(E, { className: "h-12 w-12" }),
|
|
424
433
|
title: "No payment methods",
|
|
425
434
|
description: "Annotate which card or account pays for each subscription. No full card numbers are stored."
|
|
426
|
-
}) : /* @__PURE__ */
|
|
427
|
-
className: "
|
|
428
|
-
children: f.map((e) =>
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
435
|
+
}) : /* @__PURE__ */ N("div", {
|
|
436
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3",
|
|
437
|
+
children: f.map((e) => {
|
|
438
|
+
let t = [e.expiryMonth && e.expiryYear ? `Exp ${String(e.expiryMonth).padStart(2, "0")}/${String(e.expiryYear).slice(-2)}` : null].filter(Boolean);
|
|
439
|
+
return /* @__PURE__ */ P(F, {
|
|
440
|
+
treatment: "metric",
|
|
441
|
+
className: "flex flex-col gap-4 p-4",
|
|
442
|
+
children: [/* @__PURE__ */ P("div", {
|
|
443
|
+
className: "flex items-start justify-between gap-2",
|
|
444
|
+
children: [/* @__PURE__ */ P("div", {
|
|
445
|
+
className: "flex items-center gap-3",
|
|
446
|
+
children: [/* @__PURE__ */ N("span", {
|
|
447
|
+
className: "grid h-9 w-12 place-items-center rounded-md bg-[var(--color-accent-soft)] text-text-primary",
|
|
448
|
+
children: /* @__PURE__ */ N(E, {
|
|
449
|
+
className: "h-4 w-4",
|
|
450
|
+
"aria-hidden": !0
|
|
451
|
+
})
|
|
452
|
+
}), /* @__PURE__ */ P("div", {
|
|
453
|
+
className: "min-w-0",
|
|
454
|
+
children: [/* @__PURE__ */ P("p", {
|
|
455
|
+
className: "flex items-center gap-1.5 truncate text-sm font-semibold text-text-primary",
|
|
456
|
+
children: [e.brand || e.label, e.isDefault && /* @__PURE__ */ P("span", {
|
|
457
|
+
className: "inline-flex items-center gap-1 rounded-full bg-status-success-bg-subtle px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-status-success-text",
|
|
458
|
+
children: [/* @__PURE__ */ N(A, {
|
|
459
|
+
className: "h-2.5 w-2.5 fill-current",
|
|
460
|
+
"aria-hidden": !0
|
|
461
|
+
}), "Default"]
|
|
462
|
+
})]
|
|
463
|
+
}), /* @__PURE__ */ N("p", {
|
|
464
|
+
className: "font-mono text-sm tracking-[0.15em] text-text-secondary",
|
|
465
|
+
children: e.last4 ? `•••• ${e.last4}` : e.type.replace(/_/g, " ")
|
|
466
|
+
})]
|
|
467
|
+
})]
|
|
468
|
+
}), /* @__PURE__ */ N(o, { status: e.status })]
|
|
469
|
+
}), /* @__PURE__ */ P("div", {
|
|
470
|
+
className: "mt-auto flex items-center justify-between border-t border-border-subtle pt-3",
|
|
471
|
+
children: [/* @__PURE__ */ N("p", {
|
|
472
|
+
className: "truncate text-xs text-text-secondary",
|
|
473
|
+
children: [e.label, ...t].filter(Boolean).join(" · ")
|
|
474
|
+
}), /* @__PURE__ */ P("button", {
|
|
475
|
+
type: "button",
|
|
476
|
+
"aria-label": `Remove ${e.label}`,
|
|
477
|
+
disabled: i.isPending,
|
|
478
|
+
onClick: () => i.mutate(e.id),
|
|
479
|
+
className: "inline-flex shrink-0 items-center gap-1 rounded-lg border border-border-subtle px-2.5 py-1 text-xs font-medium text-text-secondary hover:border-status-error-text/40 hover:bg-status-error-bg-subtle hover:text-status-error-text disabled:opacity-50",
|
|
480
|
+
children: [/* @__PURE__ */ N(j, {
|
|
481
|
+
className: "h-3.5 w-3.5",
|
|
482
|
+
"aria-hidden": !0
|
|
483
|
+
}), "Remove"]
|
|
444
484
|
})]
|
|
445
485
|
})]
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
type: "button",
|
|
450
|
-
"aria-label": `Remove ${e.label}`,
|
|
451
|
-
disabled: i.isPending,
|
|
452
|
-
onClick: () => i.mutate(e.id),
|
|
453
|
-
className: "rounded-lg border border-border-subtle p-1.5 text-text-secondary hover:bg-status-error-bg-subtle hover:text-status-error-text disabled:opacity-50",
|
|
454
|
-
children: /* @__PURE__ */ O(E, { className: "h-4 w-4" })
|
|
455
|
-
})]
|
|
456
|
-
})]
|
|
457
|
-
}, e.id))
|
|
458
|
-
}), a && /* @__PURE__ */ O(z, { onClose: () => d(!1) })]
|
|
486
|
+
}, e.id);
|
|
487
|
+
})
|
|
488
|
+
}), a && /* @__PURE__ */ N(K, { onClose: () => c(!1) })]
|
|
459
489
|
});
|
|
460
490
|
}
|
|
461
|
-
function
|
|
462
|
-
let { navigateTo:
|
|
463
|
-
status:
|
|
491
|
+
function J() {
|
|
492
|
+
let { navigateTo: c } = e(), [d, h] = C(0), [g, y] = C(""), [b, x] = C(!1), { data: E, isLoading: A, isError: j, refetch: R, isFetching: z } = _({
|
|
493
|
+
status: g || void 0,
|
|
464
494
|
pagination: {
|
|
465
|
-
limit:
|
|
466
|
-
offset: d *
|
|
495
|
+
limit: L,
|
|
496
|
+
offset: d * L
|
|
467
497
|
}
|
|
468
|
-
}),
|
|
469
|
-
let e =
|
|
498
|
+
}), V = v(), H = S(() => E?.items ?? [], [E]), K = E?.pageInfo.hasMore ?? !1, J = S(() => {
|
|
499
|
+
let e = H.filter((e) => U.has(e.status)), t = H[0]?.currency ?? "USD", n = /* @__PURE__ */ new Map();
|
|
500
|
+
for (let e of H) n.set(e.status, (n.get(e.status) ?? 0) + 1);
|
|
501
|
+
let r = Array.from(n.entries()).sort((e, t) => t[1] - e[1]).map(([e, t], n) => ({
|
|
502
|
+
label: e.charAt(0) + e.slice(1).toLowerCase(),
|
|
503
|
+
value: t,
|
|
504
|
+
color: W[e] ?? f[n % f.length]
|
|
505
|
+
}));
|
|
470
506
|
return {
|
|
471
507
|
outstandingCount: e.length,
|
|
472
508
|
outstandingTotal: e.reduce((e, t) => e + t.total, 0),
|
|
509
|
+
paidCount: H.filter((e) => e.status === "PAID").length,
|
|
510
|
+
overdueCount: H.filter((e) => e.status === "OVERDUE").length,
|
|
511
|
+
distribution: r,
|
|
473
512
|
currency: t
|
|
474
513
|
};
|
|
475
|
-
}, [
|
|
476
|
-
return /* @__PURE__ */
|
|
514
|
+
}, [H]);
|
|
515
|
+
return /* @__PURE__ */ P(n, {
|
|
477
516
|
title: "Invoices",
|
|
478
517
|
description: "Your billing ledger across every relationship",
|
|
479
|
-
actions: /* @__PURE__ */
|
|
518
|
+
actions: /* @__PURE__ */ P("button", {
|
|
480
519
|
type: "button",
|
|
481
|
-
onClick: () =>
|
|
520
|
+
onClick: () => x(!0),
|
|
482
521
|
className: "inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
|
|
483
|
-
children: [/* @__PURE__ */ O
|
|
522
|
+
children: [/* @__PURE__ */ N(O, { className: "h-4 w-4" }), " Create invoice"]
|
|
484
523
|
}),
|
|
485
524
|
children: [
|
|
486
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ N(I, {
|
|
487
526
|
className: "mb-4",
|
|
488
527
|
children: "Every invoice from your recurring relationships in one ledger. Filter by status and settle issued or overdue invoices directly."
|
|
489
528
|
}),
|
|
490
|
-
!
|
|
491
|
-
className: "grid grid-cols-1 gap-4
|
|
492
|
-
children: [/* @__PURE__ */
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
529
|
+
!A && !j && H.length > 0 && /* @__PURE__ */ P("div", {
|
|
530
|
+
className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
|
|
531
|
+
children: [/* @__PURE__ */ P("div", {
|
|
532
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:col-span-2",
|
|
533
|
+
children: [
|
|
534
|
+
/* @__PURE__ */ N(r, {
|
|
535
|
+
featured: !0,
|
|
536
|
+
icon: /* @__PURE__ */ N(k, {}),
|
|
537
|
+
value: i(J.outstandingTotal, J.currency, { maximumFractionDigits: 0 }),
|
|
538
|
+
label: "Outstanding · this page"
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ N(r, {
|
|
541
|
+
icon: /* @__PURE__ */ N(D, {}),
|
|
542
|
+
value: J.outstandingCount,
|
|
543
|
+
label: "Open invoices"
|
|
544
|
+
}),
|
|
545
|
+
/* @__PURE__ */ N(r, {
|
|
546
|
+
icon: /* @__PURE__ */ N(w, {}),
|
|
547
|
+
value: J.overdueCount,
|
|
548
|
+
label: "Overdue",
|
|
549
|
+
...J.overdueCount > 0 ? { trend: "down" } : {}
|
|
550
|
+
}),
|
|
551
|
+
/* @__PURE__ */ N(r, {
|
|
552
|
+
icon: /* @__PURE__ */ N(T, {}),
|
|
553
|
+
value: J.paidCount,
|
|
554
|
+
label: "Paid",
|
|
555
|
+
...J.paidCount > 0 ? { trend: "up" } : {}
|
|
556
|
+
})
|
|
557
|
+
]
|
|
558
|
+
}), /* @__PURE__ */ P(F, {
|
|
559
|
+
treatment: "insight",
|
|
560
|
+
className: "p-6",
|
|
561
|
+
children: [
|
|
562
|
+
/* @__PURE__ */ N("p", {
|
|
563
|
+
className: "text-sm font-semibold text-text-primary",
|
|
564
|
+
children: "Status breakdown"
|
|
565
|
+
}),
|
|
566
|
+
/* @__PURE__ */ N("p", {
|
|
567
|
+
className: "text-xs text-text-secondary",
|
|
568
|
+
children: "Across the invoices on this page"
|
|
569
|
+
}),
|
|
570
|
+
/* @__PURE__ */ P("div", {
|
|
571
|
+
className: "mt-4 flex flex-col items-center gap-5 sm:flex-row sm:items-center lg:flex-col xl:flex-row",
|
|
572
|
+
children: [/* @__PURE__ */ N(p, {
|
|
573
|
+
data: J.distribution,
|
|
574
|
+
size: 132,
|
|
575
|
+
thickness: 16,
|
|
576
|
+
centerLabel: String(H.length),
|
|
577
|
+
centerSub: "invoices",
|
|
578
|
+
className: "shrink-0"
|
|
579
|
+
}), /* @__PURE__ */ N(m, {
|
|
580
|
+
data: J.distribution,
|
|
581
|
+
className: "w-full min-w-0 flex-1",
|
|
582
|
+
valueFormat: (e) => String(e)
|
|
583
|
+
})]
|
|
584
|
+
})
|
|
585
|
+
]
|
|
501
586
|
})]
|
|
502
587
|
}),
|
|
503
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ N("div", {
|
|
504
589
|
className: "mt-6 flex flex-wrap items-center gap-3",
|
|
505
|
-
children: /* @__PURE__ */
|
|
590
|
+
children: /* @__PURE__ */ N("select", {
|
|
506
591
|
"aria-label": "Filter by status",
|
|
507
|
-
value:
|
|
592
|
+
value: g,
|
|
508
593
|
onChange: (e) => {
|
|
509
|
-
|
|
594
|
+
y(e.target.value), h(0);
|
|
510
595
|
},
|
|
511
596
|
className: "rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-xs text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
512
|
-
children:
|
|
597
|
+
children: B.map((e) => /* @__PURE__ */ N("option", {
|
|
513
598
|
value: e.value,
|
|
514
599
|
children: e.label
|
|
515
600
|
}, e.value))
|
|
516
601
|
})
|
|
517
602
|
}),
|
|
518
|
-
|
|
603
|
+
A ? /* @__PURE__ */ N(u, { label: "Loading invoices…" }) : j ? /* @__PURE__ */ N(l, {
|
|
519
604
|
message: "Could not load invoices.",
|
|
520
|
-
onRetry: () => void
|
|
521
|
-
}) :
|
|
605
|
+
onRetry: () => void R()
|
|
606
|
+
}) : H.length === 0 ? /* @__PURE__ */ N("div", {
|
|
522
607
|
className: "mt-6",
|
|
523
|
-
children: /* @__PURE__ */
|
|
608
|
+
children: /* @__PURE__ */ N(s, {
|
|
524
609
|
illustration: "empty-data",
|
|
525
|
-
icon: /* @__PURE__ */
|
|
610
|
+
icon: /* @__PURE__ */ N(k, { className: "h-12 w-12" }),
|
|
526
611
|
title: "No invoices",
|
|
527
|
-
description:
|
|
528
|
-
action: /* @__PURE__ */
|
|
612
|
+
description: g ? "No invoices match this status filter." : "Invoices from your relationships will appear here — or create one manually.",
|
|
613
|
+
action: /* @__PURE__ */ N("button", {
|
|
529
614
|
type: "button",
|
|
530
|
-
onClick: () =>
|
|
615
|
+
onClick: () => x(!0),
|
|
531
616
|
className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
|
|
532
617
|
children: "Create invoice"
|
|
533
618
|
})
|
|
534
619
|
})
|
|
535
|
-
}) : /* @__PURE__ */
|
|
620
|
+
}) : /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P("div", {
|
|
536
621
|
className: "mt-6 overflow-hidden rounded-lg border border-border-subtle bg-bg-surface",
|
|
537
|
-
children: [/* @__PURE__ */
|
|
622
|
+
children: [/* @__PURE__ */ P("div", {
|
|
538
623
|
className: "hidden grid-cols-[1.5fr_1fr_1fr_1fr_auto] gap-4 border-b border-border-subtle bg-bg-sunken px-4 py-2.5 text-xs font-medium text-text-secondary sm:grid",
|
|
539
624
|
children: [
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ N("span", { children: "Invoice" }),
|
|
626
|
+
/* @__PURE__ */ N("span", { children: "Status" }),
|
|
627
|
+
/* @__PURE__ */ N("span", {
|
|
543
628
|
className: "text-right",
|
|
544
629
|
children: "Total"
|
|
545
630
|
}),
|
|
546
|
-
/* @__PURE__ */
|
|
631
|
+
/* @__PURE__ */ N("span", {
|
|
547
632
|
className: "text-right",
|
|
548
633
|
children: "Due"
|
|
549
634
|
}),
|
|
550
|
-
/* @__PURE__ */
|
|
635
|
+
/* @__PURE__ */ N("span", {
|
|
551
636
|
className: "text-right",
|
|
552
637
|
children: "Action"
|
|
553
638
|
})
|
|
554
639
|
]
|
|
555
|
-
}), /* @__PURE__ */
|
|
640
|
+
}), /* @__PURE__ */ N("div", {
|
|
556
641
|
className: "divide-y divide-border-subtle",
|
|
557
|
-
children:
|
|
558
|
-
className: "grid grid-cols-1 gap-2 px-4 py-3 sm:grid-cols-[1.5fr_1fr_1fr_1fr_auto] sm:items-center sm:gap-4",
|
|
642
|
+
children: H.map((e) => /* @__PURE__ */ P("div", {
|
|
643
|
+
className: "grid grid-cols-1 gap-2 px-4 py-3 transition-colors hover:bg-bg-sunken/50 sm:grid-cols-[1.5fr_1fr_1fr_1fr_auto] sm:items-center sm:gap-4",
|
|
559
644
|
children: [
|
|
560
|
-
/* @__PURE__ */
|
|
645
|
+
/* @__PURE__ */ P("button", {
|
|
561
646
|
type: "button",
|
|
562
|
-
onClick: () =>
|
|
647
|
+
onClick: () => c(`/relationships/${e.relationshipId}`),
|
|
563
648
|
className: "min-w-0 text-left",
|
|
564
|
-
children: [/* @__PURE__ */
|
|
649
|
+
children: [/* @__PURE__ */ N("p", {
|
|
565
650
|
className: "truncate text-sm font-medium text-text-primary",
|
|
566
651
|
children: e.number || `Invoice ${e.id.slice(0, 8)}`
|
|
567
|
-
}), /* @__PURE__ */
|
|
652
|
+
}), /* @__PURE__ */ N("p", {
|
|
568
653
|
className: "text-xs text-text-secondary",
|
|
569
654
|
children: e.issueDate ? `Issued ${a(e.issueDate)}` : "—"
|
|
570
655
|
})]
|
|
571
656
|
}),
|
|
572
|
-
/* @__PURE__ */
|
|
573
|
-
/* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ N("span", { children: /* @__PURE__ */ N(o, { status: e.status }) }),
|
|
658
|
+
/* @__PURE__ */ N("span", {
|
|
574
659
|
className: "text-sm font-semibold tabular-nums text-text-primary sm:text-right",
|
|
575
660
|
children: i(e.total, e.currency)
|
|
576
661
|
}),
|
|
577
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ N("span", {
|
|
578
663
|
className: "text-xs text-text-secondary sm:text-right",
|
|
579
664
|
children: e.dueDate ? a(e.dueDate) : "—"
|
|
580
665
|
}),
|
|
581
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ N("span", {
|
|
582
667
|
className: "sm:text-right",
|
|
583
|
-
children:
|
|
668
|
+
children: U.has(e.status) ? /* @__PURE__ */ P("button", {
|
|
584
669
|
type: "button",
|
|
585
|
-
disabled:
|
|
586
|
-
onClick: () =>
|
|
587
|
-
className: "rounded-lg border border-
|
|
588
|
-
children:
|
|
589
|
-
|
|
670
|
+
disabled: V.isPending,
|
|
671
|
+
onClick: () => V.mutate(e.id),
|
|
672
|
+
className: "inline-flex items-center gap-1.5 rounded-lg border border-status-success-text/30 bg-status-success-bg-subtle px-3 py-1.5 text-xs font-medium text-status-success-text hover:opacity-90 disabled:opacity-50",
|
|
673
|
+
children: [/* @__PURE__ */ N(T, {
|
|
674
|
+
className: "h-3.5 w-3.5",
|
|
675
|
+
"aria-hidden": !0
|
|
676
|
+
}), "Mark paid"]
|
|
677
|
+
}) : e.paidAt ? /* @__PURE__ */ P("span", {
|
|
590
678
|
className: "text-xs text-text-secondary",
|
|
591
679
|
children: ["Paid ", a(e.paidAt)]
|
|
592
|
-
}) : /* @__PURE__ */
|
|
680
|
+
}) : /* @__PURE__ */ N("span", {
|
|
593
681
|
className: "text-xs text-text-secondary",
|
|
594
682
|
children: "—"
|
|
595
683
|
})
|
|
@@ -597,38 +685,38 @@ function V() {
|
|
|
597
685
|
]
|
|
598
686
|
}, e.id))
|
|
599
687
|
})]
|
|
600
|
-
}), /* @__PURE__ */
|
|
688
|
+
}), /* @__PURE__ */ P("div", {
|
|
601
689
|
className: "mt-4 flex items-center justify-between",
|
|
602
|
-
children: [/* @__PURE__ */
|
|
690
|
+
children: [/* @__PURE__ */ P("p", {
|
|
603
691
|
className: "text-xs text-text-secondary",
|
|
604
692
|
children: [
|
|
605
693
|
"Page ",
|
|
606
694
|
d + 1,
|
|
607
|
-
|
|
695
|
+
z ? " · refreshing…" : ""
|
|
608
696
|
]
|
|
609
|
-
}), /* @__PURE__ */
|
|
697
|
+
}), /* @__PURE__ */ P("div", {
|
|
610
698
|
className: "flex gap-2",
|
|
611
|
-
children: [/* @__PURE__ */
|
|
699
|
+
children: [/* @__PURE__ */ N("button", {
|
|
612
700
|
type: "button",
|
|
613
701
|
disabled: d === 0,
|
|
614
|
-
onClick: () =>
|
|
702
|
+
onClick: () => h((e) => Math.max(0, e - 1)),
|
|
615
703
|
className: t("rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium", d === 0 ? "cursor-not-allowed text-text-secondary opacity-50" : "text-text-primary hover:bg-bg-sunken"),
|
|
616
704
|
children: "Previous"
|
|
617
|
-
}), /* @__PURE__ */
|
|
705
|
+
}), /* @__PURE__ */ N("button", {
|
|
618
706
|
type: "button",
|
|
619
|
-
disabled: !
|
|
620
|
-
onClick: () =>
|
|
621
|
-
className: t("rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium",
|
|
707
|
+
disabled: !K,
|
|
708
|
+
onClick: () => h((e) => e + 1),
|
|
709
|
+
className: t("rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium", K ? "text-text-primary hover:bg-bg-sunken" : "cursor-not-allowed text-text-secondary opacity-50"),
|
|
622
710
|
children: "Next"
|
|
623
711
|
})]
|
|
624
712
|
})]
|
|
625
713
|
})] }),
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
|
|
714
|
+
/* @__PURE__ */ N(q, {}),
|
|
715
|
+
b && /* @__PURE__ */ N(G, { onClose: () => x(!1) })
|
|
628
716
|
]
|
|
629
717
|
});
|
|
630
718
|
}
|
|
631
719
|
//#endregion
|
|
632
|
-
export {
|
|
720
|
+
export { J as InvoicesPage };
|
|
633
721
|
|
|
634
722
|
//# sourceMappingURL=InvoicesPage.js.map
|