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