@burdenoff/microfe-billing 2026.1108.2 → 2026.1112.1
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/billing/BillingUserRoutes.js +202 -188
- package/dist/billing/BillingUserRoutes.js.map +1 -1
- package/dist/billing/hooks/useBillingVariant.d.ts +6 -0
- package/dist/billing/hooks/useBillingVariant.js +8 -0
- package/dist/billing/hooks/useBillingVariant.js.map +1 -0
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +169 -140
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +191 -156
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +160 -157
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +4 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/providers/BillingProvider.js +16 -15
- package/dist/billing/providers/BillingProvider.js.map +1 -1
- package/dist/billing/shared/components/MoneyActionDialog.d.ts +27 -0
- package/dist/billing/shared/components/MoneyActionDialog.js +53 -0
- package/dist/billing/shared/components/MoneyActionDialog.js.map +1 -0
- package/dist/billing/shared/components/index.d.ts +1 -0
- package/dist/billing/shared/components/index.js +2 -1
- package/dist/billing/shared/utils/accessRules.d.ts +16 -0
- package/dist/billing/shared/utils/accessRules.js +10 -0
- package/dist/billing/shared/utils/accessRules.js.map +1 -0
- package/dist/billing/shared/utils/directActivityGraphql.d.ts +2 -0
- package/dist/billing/shared/utils/directActivityGraphql.js +1 -1
- package/dist/billing/shared/utils/directBillingGraphql.d.ts +2 -0
- package/dist/billing/shared/utils/directBillingGraphql.js +2 -1
- package/dist/billing/shared/utils/directBillingGraphql.js.map +1 -1
- package/dist/billing/shared/utils/gatewayGraphql.d.ts +2 -0
- package/dist/billing/shared/utils/gatewayGraphql.js +2 -1
- package/dist/billing/shared/utils/gatewayGraphql.js.map +1 -1
- package/dist/billing/shared/utils/pinnedRequest.d.ts +48 -0
- package/dist/billing/shared/utils/pinnedRequest.js +63 -0
- package/dist/billing/shared/utils/pinnedRequest.js.map +1 -0
- package/dist/billing/types/index.d.ts +6 -0
- package/package.json +2 -2
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
import { useBillingNavigate as e } from "../../../hooks/useBillingNavigate.js";
|
|
2
2
|
import { StatusPill as t } from "../../../shared/ui/StatusPill.js";
|
|
3
3
|
import { useInvoiceMutations as n, usePaginatedInvoices as r } from "../hooks/useInvoices.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { MoneyActionDialog as i } from "../../../shared/components/MoneyActionDialog.js";
|
|
5
|
+
import { useBillingPermissions as a } from "../../../hooks/useBillingPermissions.js";
|
|
6
|
+
import { useGetBillingAccountsByOrgQuery as o } from "../../../../generated/global-operations.js";
|
|
7
|
+
import { formatCurrency as s, formatDate as c, formatInvoiceNumber as l, formatInvoiceStatus as u } from "../../../shared/utils/format.js";
|
|
8
|
+
import { withBillingAccountId as d } from "../../../shared/utils/navigation.js";
|
|
9
|
+
import { getInvoiceStatusColor as f } from "../../../shared/utils/status.js";
|
|
9
10
|
import "../../../shared/ui/index.js";
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
11
|
+
import "../../../shared/components/index.js";
|
|
12
|
+
import { useIsFluidgridsVariant as p } from "../../../hooks/useBillingVariant.js";
|
|
13
|
+
import { useTr as m } from "../../../shared/hooks/useTr.js";
|
|
14
|
+
import { nativeConfirm as h, nativeImpact as g, nativeNotify as _ } from "../../../../utils/nativeBridge.js";
|
|
15
|
+
import { useCallback as v, useEffect as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
16
|
+
import { RotateCcw as C } from "lucide-react";
|
|
17
|
+
import { useSearchParams as w } from "react-router";
|
|
18
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
19
|
+
import { IllustratedEmptyState as O, PagePurpose as k } from "@burdenoff/fe-libs/ui";
|
|
17
20
|
// src/billing/modules/billing/pages/InvoicesListPage.tsx
|
|
18
|
-
var
|
|
19
|
-
let t =
|
|
20
|
-
|
|
21
|
-
I(
|
|
22
|
-
}, [
|
|
23
|
-
let L =
|
|
24
|
-
|
|
21
|
+
var A = () => {
|
|
22
|
+
let t = m(), i = e(), s = a(), [c] = w(), l = c.get("billingAccountId") ?? void 0, { data: f } = o({ fetchPolicy: "cache-first" }), p = b(() => f?.getBillingAccountsByOrg ?? [], [f]), { payInvoice: h, voidInvoice: g } = n(), [A, M] = S(null), [N, P] = S(null), [F, I] = S(l);
|
|
23
|
+
y(() => {
|
|
24
|
+
I(l);
|
|
25
|
+
}, [l]);
|
|
26
|
+
let L = b(() => (p.find((e) => e.isDefault) ?? p[0])?.id ?? void 0, [p]), R = F === void 0 ? L ?? null : F, [z, B] = S("all"), [V, H] = S(""), [U, W] = S(""), [G, K] = S(1), q = x(null);
|
|
27
|
+
y(() => (q.current && clearTimeout(q.current), q.current = setTimeout(() => {
|
|
25
28
|
W(V), K(1);
|
|
26
29
|
}, 400), () => {
|
|
27
30
|
q.current && clearTimeout(q.current);
|
|
@@ -32,8 +35,8 @@ var O = () => {
|
|
|
32
35
|
search: U || void 0,
|
|
33
36
|
page: G,
|
|
34
37
|
pageSize: 20
|
|
35
|
-
}), $ =
|
|
36
|
-
let t = e.billingAccountId, n = t ?
|
|
38
|
+
}), $ = v(async (e) => {
|
|
39
|
+
let t = e.billingAccountId, n = t ? p.find((e) => e.id === t)?.defaultPaymentMethod : void 0;
|
|
37
40
|
if (!t) M("No billing account context");
|
|
38
41
|
else if (!n) M("Add and set a default payment method before paying this invoice.");
|
|
39
42
|
else {
|
|
@@ -42,18 +45,18 @@ var O = () => {
|
|
|
42
45
|
action: "pay"
|
|
43
46
|
});
|
|
44
47
|
try {
|
|
45
|
-
await
|
|
48
|
+
await h(e.id, n, t), await Q(), _("success");
|
|
46
49
|
} catch (e) {
|
|
47
|
-
M(e instanceof Error ? e.message : "Failed to pay invoice"),
|
|
50
|
+
M(e instanceof Error ? e.message : "Failed to pay invoice"), _("error");
|
|
48
51
|
} finally {
|
|
49
52
|
P(null);
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
}, [
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
p,
|
|
57
|
+
h,
|
|
55
58
|
Q
|
|
56
|
-
]), ee =
|
|
59
|
+
]), ee = v(async (e) => {
|
|
57
60
|
let t = e.billingAccountId;
|
|
58
61
|
if (!t) M("No billing account context");
|
|
59
62
|
else {
|
|
@@ -62,17 +65,17 @@ var O = () => {
|
|
|
62
65
|
action: "void"
|
|
63
66
|
});
|
|
64
67
|
try {
|
|
65
|
-
await
|
|
68
|
+
await g(e.id, t), await Q(), _("success");
|
|
66
69
|
} catch (e) {
|
|
67
|
-
M(e instanceof Error ? e.message : "Failed to void invoice"),
|
|
70
|
+
M(e instanceof Error ? e.message : "Failed to void invoice"), _("error");
|
|
68
71
|
} finally {
|
|
69
72
|
P(null);
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
|
-
}, [Q,
|
|
73
|
-
return s.canViewInvoices ? X && J.length === 0 ? /* @__PURE__ */
|
|
75
|
+
}, [Q, g]);
|
|
76
|
+
return s.canViewInvoices ? X && J.length === 0 ? /* @__PURE__ */ D("div", {
|
|
74
77
|
className: "space-y-6 p-6",
|
|
75
|
-
children: [/* @__PURE__ */
|
|
78
|
+
children: [/* @__PURE__ */ E("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ E("div", {
|
|
76
79
|
className: "space-y-3",
|
|
77
80
|
children: [
|
|
78
81
|
1,
|
|
@@ -80,30 +83,30 @@ var O = () => {
|
|
|
80
83
|
3,
|
|
81
84
|
4,
|
|
82
85
|
5
|
|
83
|
-
].map((e) => /* @__PURE__ */
|
|
86
|
+
].map((e) => /* @__PURE__ */ E("div", {
|
|
84
87
|
className: "border border-border-subtle rounded-lg p-4",
|
|
85
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ D("div", {
|
|
86
89
|
className: "flex items-center gap-4",
|
|
87
|
-
children: [/* @__PURE__ */
|
|
90
|
+
children: [/* @__PURE__ */ E("div", { className: "size-10 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ D("div", {
|
|
88
91
|
className: "flex-1 space-y-2",
|
|
89
|
-
children: [/* @__PURE__ */
|
|
92
|
+
children: [/* @__PURE__ */ E("div", { className: "h-4 w-32 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ E("div", { className: "h-3 w-48 bg-bg-sunken animate-pulse rounded" })]
|
|
90
93
|
})]
|
|
91
94
|
})
|
|
92
95
|
}, e))
|
|
93
96
|
})]
|
|
94
|
-
}) : Z ? /* @__PURE__ */
|
|
97
|
+
}) : Z ? /* @__PURE__ */ E("div", {
|
|
95
98
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
96
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ D("div", {
|
|
97
100
|
className: "text-center space-y-4",
|
|
98
101
|
children: [
|
|
99
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ E("div", {
|
|
100
103
|
className: "size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center",
|
|
101
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ E("svg", {
|
|
102
105
|
className: "size-6 text-status-error-text",
|
|
103
106
|
fill: "none",
|
|
104
107
|
viewBox: "0 0 24 24",
|
|
105
108
|
stroke: "currentColor",
|
|
106
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ E("path", {
|
|
107
110
|
strokeLinecap: "round",
|
|
108
111
|
strokeLinejoin: "round",
|
|
109
112
|
strokeWidth: 2,
|
|
@@ -111,15 +114,15 @@ var O = () => {
|
|
|
111
114
|
})
|
|
112
115
|
})
|
|
113
116
|
}),
|
|
114
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ E("h2", {
|
|
115
118
|
className: "text-lg font-semibold text-text-primary",
|
|
116
119
|
children: t("billing.invoices.failedToLoad", "Failed to load invoices")
|
|
117
120
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ E("p", {
|
|
119
122
|
className: "text-sm text-text-secondary",
|
|
120
123
|
children: Z.message
|
|
121
124
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ E("button", {
|
|
123
126
|
type: "button",
|
|
124
127
|
onClick: () => Q(),
|
|
125
128
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
@@ -127,44 +130,44 @@ var O = () => {
|
|
|
127
130
|
})
|
|
128
131
|
]
|
|
129
132
|
})
|
|
130
|
-
}) : /* @__PURE__ */
|
|
133
|
+
}) : /* @__PURE__ */ D("div", {
|
|
131
134
|
className: "space-y-6 px-6 lg:px-8 py-6",
|
|
132
135
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ D("div", {
|
|
134
137
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
135
|
-
children: [/* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */
|
|
138
|
+
children: [/* @__PURE__ */ D("div", { children: [
|
|
139
|
+
/* @__PURE__ */ E("h1", {
|
|
137
140
|
className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
|
|
138
141
|
children: t("billing.invoices.title", "Invoices")
|
|
139
142
|
}),
|
|
140
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ E("p", {
|
|
141
144
|
className: "text-sm text-text-secondary mt-1",
|
|
142
145
|
children: t("billing.invoices.subtitle", "View and manage your billing invoices")
|
|
143
146
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ E(k, {
|
|
145
148
|
className: "mt-3",
|
|
146
149
|
children: t("billing.invoices.purpose", "A record of everything you have been billed for — subscriptions, add-ons and one-off charges. Open an invoice to see line items, download the PDF, pay an outstanding amount, or request a refund.")
|
|
147
150
|
})
|
|
148
|
-
] }), /* @__PURE__ */
|
|
151
|
+
] }), /* @__PURE__ */ D("div", {
|
|
149
152
|
className: "flex items-center gap-3",
|
|
150
|
-
children: [/* @__PURE__ */
|
|
153
|
+
children: [/* @__PURE__ */ D("button", {
|
|
151
154
|
type: "button",
|
|
152
|
-
onClick: () =>
|
|
155
|
+
onClick: () => i("/refunds"),
|
|
153
156
|
className: "inline-flex items-center gap-2 px-3 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken hover:border-border-strong transition-all duration-200",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
155
|
-
}),
|
|
157
|
+
children: [/* @__PURE__ */ E(C, { className: "size-4" }), t("billing.invoices.myRefunds", "My Refunds")]
|
|
158
|
+
}), p.length > 1 && /* @__PURE__ */ D("div", {
|
|
156
159
|
className: "flex items-center gap-2",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ E("label", {
|
|
158
161
|
className: "text-sm text-text-secondary whitespace-nowrap",
|
|
159
162
|
children: t("billing.invoices.billingAccountLabel", "Billing Account")
|
|
160
|
-
}), /* @__PURE__ */
|
|
163
|
+
}), /* @__PURE__ */ D("select", {
|
|
161
164
|
value: R ?? "",
|
|
162
165
|
onChange: (e) => I(e.target.value || null),
|
|
163
166
|
className: "text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary px-3 py-2 focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
164
|
-
children: [/* @__PURE__ */
|
|
167
|
+
children: [/* @__PURE__ */ E("option", {
|
|
165
168
|
value: "",
|
|
166
169
|
children: t("billing.invoices.allAccounts", "All Accounts")
|
|
167
|
-
}),
|
|
170
|
+
}), p.map((e) => /* @__PURE__ */ D("option", {
|
|
168
171
|
value: e.id ?? "",
|
|
169
172
|
children: [e.name ?? e.email ?? e.id, e.isDefault ? t("billing.invoices.defaultSuffix", " (Default)") : ""]
|
|
170
173
|
}, e.id ?? ""))]
|
|
@@ -172,9 +175,9 @@ var O = () => {
|
|
|
172
175
|
})]
|
|
173
176
|
})]
|
|
174
177
|
}),
|
|
175
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ D("div", {
|
|
176
179
|
className: "flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle",
|
|
177
|
-
children: [/* @__PURE__ */
|
|
180
|
+
children: [/* @__PURE__ */ E("div", {
|
|
178
181
|
className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken flex-wrap",
|
|
179
182
|
children: [
|
|
180
183
|
"all",
|
|
@@ -182,28 +185,28 @@ var O = () => {
|
|
|
182
185
|
"PAID",
|
|
183
186
|
"DRAFT",
|
|
184
187
|
"VOID"
|
|
185
|
-
].map((e) => /* @__PURE__ */
|
|
188
|
+
].map((e) => /* @__PURE__ */ E("button", {
|
|
186
189
|
type: "button",
|
|
187
190
|
onClick: () => {
|
|
188
191
|
B(e), K(1);
|
|
189
192
|
},
|
|
190
193
|
className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${z === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
191
|
-
children: e === "all" ? "All" :
|
|
194
|
+
children: e === "all" ? "All" : u(e)
|
|
192
195
|
}, e))
|
|
193
|
-
}), /* @__PURE__ */
|
|
196
|
+
}), /* @__PURE__ */ D("div", {
|
|
194
197
|
className: "relative flex-1 min-w-0 w-full sm:max-w-md",
|
|
195
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ E("svg", {
|
|
196
199
|
className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-text-secondary",
|
|
197
200
|
fill: "none",
|
|
198
201
|
viewBox: "0 0 24 24",
|
|
199
202
|
stroke: "currentColor",
|
|
200
|
-
children: /* @__PURE__ */
|
|
203
|
+
children: /* @__PURE__ */ E("path", {
|
|
201
204
|
strokeLinecap: "round",
|
|
202
205
|
strokeLinejoin: "round",
|
|
203
206
|
strokeWidth: 2,
|
|
204
207
|
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
205
208
|
})
|
|
206
|
-
}), /* @__PURE__ */
|
|
209
|
+
}), /* @__PURE__ */ E("input", {
|
|
207
210
|
type: "text",
|
|
208
211
|
placeholder: t("billing.invoices.searchPlaceholder", "Search by invoice number..."),
|
|
209
212
|
value: V,
|
|
@@ -212,86 +215,86 @@ var O = () => {
|
|
|
212
215
|
})]
|
|
213
216
|
})]
|
|
214
217
|
}),
|
|
215
|
-
|
|
218
|
+
A && /* @__PURE__ */ E("div", {
|
|
216
219
|
className: "rounded-button border border-status-error-border bg-status-error-bg-subtle p-3",
|
|
217
|
-
children: /* @__PURE__ */
|
|
220
|
+
children: /* @__PURE__ */ E("p", {
|
|
218
221
|
className: "text-sm text-status-error-text",
|
|
219
|
-
children:
|
|
222
|
+
children: A
|
|
220
223
|
})
|
|
221
224
|
}),
|
|
222
|
-
!X && J.length === 0 ? /* @__PURE__ */
|
|
225
|
+
!X && J.length === 0 ? /* @__PURE__ */ E(O, {
|
|
223
226
|
illustration: z !== "all" || U ? "empty-search" : "empty-files",
|
|
224
227
|
title: t("billing.invoices.noInvoicesFound", "No invoices found"),
|
|
225
228
|
description: z !== "all" || U ? t("billing.invoices.noInvoicesFiltered", "No invoices match your filters.") : t("billing.invoices.noInvoicesYet", "You don't have any invoices yet.")
|
|
226
|
-
}) : /* @__PURE__ */ T
|
|
229
|
+
}) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("div", {
|
|
227
230
|
className: "border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden",
|
|
228
|
-
children: /* @__PURE__ */
|
|
231
|
+
children: /* @__PURE__ */ D("table", {
|
|
229
232
|
className: "w-full",
|
|
230
|
-
children: [/* @__PURE__ */
|
|
233
|
+
children: [/* @__PURE__ */ E("thead", {
|
|
231
234
|
className: "bg-bg-sunken",
|
|
232
|
-
children: /* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */
|
|
235
|
+
children: /* @__PURE__ */ D("tr", { children: [
|
|
236
|
+
/* @__PURE__ */ E("th", {
|
|
234
237
|
className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
235
238
|
children: t("billing.invoices.invoice", "Invoice")
|
|
236
239
|
}),
|
|
237
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ E("th", {
|
|
238
241
|
className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
239
242
|
children: t("billing.common.status", "Status")
|
|
240
243
|
}),
|
|
241
|
-
!R &&
|
|
244
|
+
!R && p.length > 1 && /* @__PURE__ */ E("th", {
|
|
242
245
|
className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden lg:table-cell",
|
|
243
246
|
children: t("billing.common.account", "Account")
|
|
244
247
|
}),
|
|
245
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ E("th", {
|
|
246
249
|
className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden sm:table-cell",
|
|
247
250
|
children: t("billing.common.date", "Date")
|
|
248
251
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ E("th", {
|
|
250
253
|
className: "text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden md:table-cell",
|
|
251
254
|
children: t("billing.common.dueDate", "Due Date")
|
|
252
255
|
}),
|
|
253
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ E("th", {
|
|
254
257
|
className: "text-right px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
255
258
|
children: t("billing.common.amount", "Amount")
|
|
256
259
|
}),
|
|
257
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ E("th", {
|
|
258
261
|
className: "text-right px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
259
262
|
children: t("billing.common.actions", "Actions")
|
|
260
263
|
})
|
|
261
264
|
] })
|
|
262
|
-
}), /* @__PURE__ */
|
|
265
|
+
}), /* @__PURE__ */ E("tbody", {
|
|
263
266
|
className: "divide-y divide-border-subtle",
|
|
264
|
-
children: J.map((e) => /* @__PURE__ */
|
|
267
|
+
children: J.map((e) => /* @__PURE__ */ E(j, {
|
|
265
268
|
invoice: e,
|
|
266
|
-
onView: () =>
|
|
269
|
+
onView: () => i(d(`/invoices/${e.id}`, e.billingAccountId)),
|
|
267
270
|
canPay: s.canPayInvoice,
|
|
268
271
|
canVoid: s.canVoidInvoice,
|
|
269
272
|
onPay: $,
|
|
270
273
|
onVoid: ee,
|
|
271
274
|
isProcessing: N?.invoiceId === e.id,
|
|
272
275
|
processingAction: N?.invoiceId === e.id ? N.action : void 0,
|
|
273
|
-
showAccount: !R &&
|
|
274
|
-
accountName:
|
|
276
|
+
showAccount: !R && p.length > 1,
|
|
277
|
+
accountName: p.find((t) => t.id === e.billingAccountId)?.name ?? null
|
|
275
278
|
}, e.id))
|
|
276
279
|
})]
|
|
277
280
|
})
|
|
278
|
-
}), Y > 1 && /* @__PURE__ */
|
|
281
|
+
}), Y > 1 && /* @__PURE__ */ D("div", {
|
|
279
282
|
className: "flex items-center justify-between pt-2",
|
|
280
|
-
children: [/* @__PURE__ */
|
|
283
|
+
children: [/* @__PURE__ */ E("p", {
|
|
281
284
|
className: "text-sm text-text-secondary",
|
|
282
285
|
children: t("billing.common.pageOf", "Page {{page}} of {{totalPages}}", {
|
|
283
286
|
page: G,
|
|
284
287
|
totalPages: Y
|
|
285
288
|
})
|
|
286
|
-
}), /* @__PURE__ */
|
|
289
|
+
}), /* @__PURE__ */ D("div", {
|
|
287
290
|
className: "flex items-center gap-2",
|
|
288
|
-
children: [/* @__PURE__ */
|
|
291
|
+
children: [/* @__PURE__ */ E("button", {
|
|
289
292
|
type: "button",
|
|
290
293
|
onClick: () => K((e) => Math.max(1, e - 1)),
|
|
291
294
|
disabled: G <= 1,
|
|
292
295
|
className: "px-3 py-1.5 text-sm font-medium border border-border-subtle rounded-button bg-bg-surface text-text-primary hover:bg-bg-sunken disabled:opacity-40 disabled:cursor-not-allowed transition-colors",
|
|
293
296
|
children: t("billing.common.previous", "Previous")
|
|
294
|
-
}), /* @__PURE__ */
|
|
297
|
+
}), /* @__PURE__ */ E("button", {
|
|
295
298
|
type: "button",
|
|
296
299
|
onClick: () => K((e) => Math.min(Y, e + 1)),
|
|
297
300
|
disabled: G >= Y,
|
|
@@ -301,19 +304,19 @@ var O = () => {
|
|
|
301
304
|
})]
|
|
302
305
|
})] })
|
|
303
306
|
]
|
|
304
|
-
}) : /* @__PURE__ */
|
|
307
|
+
}) : /* @__PURE__ */ E("div", {
|
|
305
308
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
306
|
-
children: /* @__PURE__ */
|
|
309
|
+
children: /* @__PURE__ */ D("div", {
|
|
307
310
|
className: "text-center space-y-2",
|
|
308
311
|
children: [
|
|
309
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ E("div", {
|
|
310
313
|
className: "size-12 mx-auto rounded-full bg-bg-sunken flex items-center justify-center",
|
|
311
|
-
children: /* @__PURE__ */
|
|
314
|
+
children: /* @__PURE__ */ E("svg", {
|
|
312
315
|
className: "size-6 text-text-secondary",
|
|
313
316
|
fill: "none",
|
|
314
317
|
viewBox: "0 0 24 24",
|
|
315
318
|
stroke: "currentColor",
|
|
316
|
-
children: /* @__PURE__ */
|
|
319
|
+
children: /* @__PURE__ */ E("path", {
|
|
317
320
|
strokeLinecap: "round",
|
|
318
321
|
strokeLinejoin: "round",
|
|
319
322
|
strokeWidth: 2,
|
|
@@ -321,144 +324,176 @@ var O = () => {
|
|
|
321
324
|
})
|
|
322
325
|
})
|
|
323
326
|
}),
|
|
324
|
-
/* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ E("h2", {
|
|
325
328
|
className: "text-lg font-semibold text-text-primary",
|
|
326
329
|
children: t("billing.accessDenied.title", "Access Denied")
|
|
327
330
|
}),
|
|
328
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ E("p", {
|
|
329
332
|
className: "text-sm text-text-secondary max-w-sm",
|
|
330
333
|
children: t("billing.invoices.noViewPermission", "You don't have permission to view invoices.")
|
|
331
334
|
})
|
|
332
335
|
]
|
|
333
336
|
})
|
|
334
337
|
});
|
|
335
|
-
},
|
|
336
|
-
let
|
|
337
|
-
|
|
338
|
-
let t = await
|
|
338
|
+
}, j = ({ invoice: e, onView: n, onPay: r, onVoid: a, canPay: o, canVoid: d, isProcessing: _, processingAction: v, showAccount: y = !1, accountName: b }) => {
|
|
339
|
+
let x = m(), C = p(), [w, T] = S(!1), [O, k] = S(!1), A = f(e.status), j = e.status === "OPEN", M = e.status === "DRAFT", N = async () => {
|
|
340
|
+
g("medium");
|
|
341
|
+
let t = await h({
|
|
339
342
|
title: "Void invoice",
|
|
340
343
|
message: "Are you sure you want to void this invoice?",
|
|
341
344
|
okButtonTitle: "Void",
|
|
342
345
|
cancelButtonTitle: "Cancel"
|
|
343
346
|
});
|
|
344
|
-
t === !0 ? await
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
},
|
|
348
|
-
|
|
347
|
+
t === !0 ? await a(e) : t === null && T(!0);
|
|
348
|
+
}, P = () => {
|
|
349
|
+
C ? k(!0) : r(e);
|
|
350
|
+
}, F = async () => {
|
|
351
|
+
await r(e), k(!1);
|
|
352
|
+
}, I = async () => {
|
|
353
|
+
await a(e), T(!1);
|
|
354
|
+
}, L = e.metadata?.invoicePdfBackupUrl;
|
|
355
|
+
return /* @__PURE__ */ D("tr", {
|
|
349
356
|
className: "hover:bg-bg-sunken transition-colors",
|
|
350
357
|
children: [
|
|
351
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ D("td", {
|
|
352
359
|
className: "p-4",
|
|
353
|
-
children: [e.invoiceUrl ? /* @__PURE__ */
|
|
360
|
+
children: [e.invoiceUrl ? /* @__PURE__ */ E("a", {
|
|
354
361
|
href: e.invoiceUrl,
|
|
355
362
|
target: "_blank",
|
|
356
363
|
rel: "noopener noreferrer",
|
|
357
364
|
className: "font-medium text-text-primary hover:text-text-link transition-colors",
|
|
358
|
-
children:
|
|
359
|
-
}) : /* @__PURE__ */
|
|
365
|
+
children: l(e.invoiceNumber)
|
|
366
|
+
}) : /* @__PURE__ */ E("button", {
|
|
360
367
|
type: "button",
|
|
361
368
|
onClick: n,
|
|
362
369
|
className: "font-medium text-text-primary hover:text-text-link transition-colors",
|
|
363
|
-
children:
|
|
364
|
-
}), (e.itemDescription ?? e.subscription?.plan?.name) && /* @__PURE__ */
|
|
370
|
+
children: l(e.invoiceNumber)
|
|
371
|
+
}), (e.itemDescription ?? e.subscription?.plan?.name) && /* @__PURE__ */ E("p", {
|
|
365
372
|
className: "text-sm text-text-secondary mt-0.5",
|
|
366
373
|
children: e.itemDescription ?? e.subscription?.plan?.name
|
|
367
374
|
})]
|
|
368
375
|
}),
|
|
369
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ E("td", {
|
|
370
377
|
className: "p-4",
|
|
371
|
-
children: /* @__PURE__ */
|
|
372
|
-
status:
|
|
378
|
+
children: /* @__PURE__ */ E(t, {
|
|
379
|
+
status: A,
|
|
373
380
|
dot: !0,
|
|
374
|
-
children:
|
|
381
|
+
children: u(e.status)
|
|
375
382
|
})
|
|
376
383
|
}),
|
|
377
|
-
|
|
384
|
+
y && /* @__PURE__ */ E("td", {
|
|
378
385
|
className: "p-4 hidden lg:table-cell",
|
|
379
|
-
children:
|
|
386
|
+
children: b ? /* @__PURE__ */ E("span", {
|
|
380
387
|
className: "inline-flex items-center px-2 py-0.5 text-xs font-medium rounded-full bg-bg-sunken text-text-secondary border border-border-subtle",
|
|
381
|
-
children:
|
|
382
|
-
}) : /* @__PURE__ */
|
|
388
|
+
children: b
|
|
389
|
+
}) : /* @__PURE__ */ E("span", {
|
|
383
390
|
className: "text-sm text-text-secondary",
|
|
384
391
|
children: ", "
|
|
385
392
|
})
|
|
386
393
|
}),
|
|
387
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ E("td", {
|
|
388
395
|
className: "p-4 text-sm text-text-secondary hidden sm:table-cell",
|
|
389
|
-
children:
|
|
396
|
+
children: c(e.createdAt, "short")
|
|
390
397
|
}),
|
|
391
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ E("td", {
|
|
392
399
|
className: "p-4 text-sm text-text-secondary hidden md:table-cell",
|
|
393
|
-
children: e.dueDate ?
|
|
400
|
+
children: e.dueDate ? c(e.dueDate, "short") : "—"
|
|
394
401
|
}),
|
|
395
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ E("td", {
|
|
396
403
|
className: "p-4 text-right font-medium text-text-primary",
|
|
397
|
-
children:
|
|
404
|
+
children: s(e.total, e.currency)
|
|
398
405
|
}),
|
|
399
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ E("td", {
|
|
400
407
|
className: "p-4 text-right",
|
|
401
|
-
children: /* @__PURE__ */
|
|
408
|
+
children: /* @__PURE__ */ D("div", {
|
|
402
409
|
className: "relative flex items-center justify-end gap-2",
|
|
403
410
|
children: [
|
|
404
|
-
e.invoiceUrl ? /* @__PURE__ */
|
|
411
|
+
e.invoiceUrl ? /* @__PURE__ */ E("a", {
|
|
405
412
|
href: e.invoiceUrl,
|
|
406
413
|
target: "_blank",
|
|
407
414
|
rel: "noopener noreferrer",
|
|
408
415
|
className: "px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-sunken rounded-button transition-colors duration-200",
|
|
409
|
-
children:
|
|
410
|
-
}) : /* @__PURE__ */
|
|
416
|
+
children: x("billing.common.view", "View")
|
|
417
|
+
}) : /* @__PURE__ */ E("button", {
|
|
411
418
|
type: "button",
|
|
412
419
|
onClick: n,
|
|
413
420
|
className: "px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-sunken rounded-button transition-colors duration-200",
|
|
414
|
-
children:
|
|
421
|
+
children: x("billing.common.view", "View")
|
|
415
422
|
}),
|
|
416
|
-
e.pdfUrl && /* @__PURE__ */
|
|
423
|
+
e.pdfUrl && /* @__PURE__ */ E("a", {
|
|
417
424
|
href: e.pdfUrl,
|
|
418
425
|
target: "_blank",
|
|
419
426
|
rel: "noopener noreferrer",
|
|
420
427
|
className: "px-3 py-1.5 text-sm font-medium text-text-link hover:bg-[var(--color-accent-softHover)] rounded-button transition-colors duration-200",
|
|
421
|
-
children:
|
|
428
|
+
children: x("billing.common.pdf", "PDF")
|
|
422
429
|
}),
|
|
423
|
-
|
|
424
|
-
href:
|
|
430
|
+
L && /* @__PURE__ */ E("a", {
|
|
431
|
+
href: L,
|
|
425
432
|
target: "_blank",
|
|
426
433
|
rel: "noopener noreferrer",
|
|
427
434
|
className: "px-3 py-1.5 text-sm font-medium text-text-link hover:bg-[var(--color-accent-softHover)] rounded-button transition-colors duration-200",
|
|
428
|
-
children:
|
|
435
|
+
children: x("billing.common.pdfBackup", "PDF (backup)")
|
|
429
436
|
}),
|
|
430
|
-
|
|
437
|
+
j && o && /* @__PURE__ */ E("button", {
|
|
431
438
|
type: "button",
|
|
432
|
-
onClick:
|
|
433
|
-
disabled:
|
|
439
|
+
onClick: P,
|
|
440
|
+
disabled: _,
|
|
434
441
|
className: "px-3 py-1.5 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50",
|
|
435
|
-
children:
|
|
442
|
+
children: _ && v === "pay" ? x("billing.common.paying", "Paying…") : x("billing.common.pay", "Pay")
|
|
436
443
|
}),
|
|
437
|
-
|
|
444
|
+
C && /* @__PURE__ */ E(i, {
|
|
445
|
+
open: O,
|
|
446
|
+
title: x("billing.invoices.payReview.title", "Review and pay"),
|
|
447
|
+
description: x("billing.invoices.payReview.description", "Your default card is charged as soon as you confirm."),
|
|
448
|
+
details: [
|
|
449
|
+
{
|
|
450
|
+
label: x("billing.invoices.payReview.invoice", "Invoice"),
|
|
451
|
+
value: l(e.invoiceNumber)
|
|
452
|
+
},
|
|
453
|
+
...b ? [{
|
|
454
|
+
label: x("billing.invoices.payReview.account", "Billing account"),
|
|
455
|
+
value: b
|
|
456
|
+
}] : [],
|
|
457
|
+
{
|
|
458
|
+
label: x("billing.invoices.payReview.card", "Paid with"),
|
|
459
|
+
value: x("billing.invoices.payReview.defaultCard", "Your default card")
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
label: x("billing.invoices.payReview.amount", "Amount"),
|
|
463
|
+
value: s(e.total, e.currency)
|
|
464
|
+
}
|
|
465
|
+
],
|
|
466
|
+
confirmLabel: x("billing.invoices.payReview.confirm", "Pay {{amount}}", { amount: s(e.total, e.currency) }),
|
|
467
|
+
busyLabel: x("billing.common.paying", "Paying…"),
|
|
468
|
+
isBusy: _ && v === "pay",
|
|
469
|
+
onConfirm: () => void F(),
|
|
470
|
+
onCancel: () => k(!1)
|
|
471
|
+
}),
|
|
472
|
+
(j || M) && d && /* @__PURE__ */ E("button", {
|
|
438
473
|
type: "button",
|
|
439
|
-
onClick: () => void
|
|
440
|
-
disabled:
|
|
474
|
+
onClick: () => void N(),
|
|
475
|
+
disabled: _,
|
|
441
476
|
className: "px-3 py-1.5 text-sm font-medium text-status-error-text hover:bg-status-error-bg-subtle rounded-button transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-50",
|
|
442
|
-
children:
|
|
477
|
+
children: _ && v === "void" ? x("billing.common.voiding", "Voiding…") : x("billing.common.void", "Void")
|
|
443
478
|
}),
|
|
444
|
-
|
|
479
|
+
w && /* @__PURE__ */ D("div", {
|
|
445
480
|
className: "absolute right-4 mt-12 z-10 w-64 rounded-card border border-status-error-border bg-bg-elevated p-3 text-left shadow-elevation-2",
|
|
446
|
-
children: [/* @__PURE__ */
|
|
481
|
+
children: [/* @__PURE__ */ E("p", {
|
|
447
482
|
className: "text-sm font-medium text-text-primary",
|
|
448
483
|
children: "Void this invoice?"
|
|
449
|
-
}), /* @__PURE__ */
|
|
484
|
+
}), /* @__PURE__ */ D("div", {
|
|
450
485
|
className: "mt-3 flex justify-end gap-2",
|
|
451
|
-
children: [/* @__PURE__ */
|
|
486
|
+
children: [/* @__PURE__ */ E("button", {
|
|
452
487
|
type: "button",
|
|
453
|
-
onClick: () =>
|
|
488
|
+
onClick: () => T(!1),
|
|
454
489
|
className: "rounded-button border border-border-subtle bg-bg-surface px-2.5 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken",
|
|
455
490
|
children: "Cancel"
|
|
456
|
-
}), /* @__PURE__ */
|
|
491
|
+
}), /* @__PURE__ */ E("button", {
|
|
457
492
|
type: "button",
|
|
458
|
-
onClick: () => void
|
|
459
|
-
disabled:
|
|
493
|
+
onClick: () => void I(),
|
|
494
|
+
disabled: _,
|
|
460
495
|
className: "rounded-button bg-action-danger-bg px-2.5 py-1.5 text-xs font-medium text-action-primary-text hover:bg-action-danger-bgHover disabled:cursor-not-allowed disabled:opacity-50",
|
|
461
|
-
children:
|
|
496
|
+
children: _ ? "Voiding…" : "Confirm"
|
|
462
497
|
})]
|
|
463
498
|
})]
|
|
464
499
|
})
|
|
@@ -468,6 +503,6 @@ var O = () => {
|
|
|
468
503
|
]
|
|
469
504
|
});
|
|
470
505
|
};
|
|
471
|
-
export {
|
|
506
|
+
export { A as InvoicesListPage };
|
|
472
507
|
|
|
473
508
|
//# sourceMappingURL=InvoicesListPage.js.map
|