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