@tesouro/embedded-components-react 0.11.205 → 0.11.209
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/experimental/BalanceHistoryWidget.d.ts +1 -1
- package/dist/experimental/index.d.ts +1 -1
- package/dist/index.css +13 -126
- package/dist/index.d.ts +7 -6
- package/dist/lib/ReceivablesWidget.d.ts +6 -5
- package/dist/lib/WidgetSuite.d.ts +7 -6
- package/dist/libs/tesouro-embedded-components-react/balance-history-widget/feature/dist/lib/BalanceHistoryWidget/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +16 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +186 -239
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +59 -52
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentRecord.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurringSeries.js +19 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusColors.js +34 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +2 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +5 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +28 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +18 -120
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +89 -84
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +91 -36
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +41 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +2 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +9 -25
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +26 -208
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +209 -52
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +50 -208
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +186 -138
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +157 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +10 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +23 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +2 -116
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +117 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +3 -198
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +198 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +2 -54
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +14 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +22 -8
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +40 -77
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +17 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +8 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +61 -38
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +26 -15
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +14 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +19 -35
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +31 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +67 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +391 -84
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +2 -494
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +47 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +62 -38
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +433 -61
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +176 -428
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +20 -224
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +6 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +264 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +2 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +131 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +22 -126
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +235 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +3 -239
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +247 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +26 -244
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +183 -26
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +21 -194
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +143 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index62.js +2 -143
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index63.js +47 -2
- package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index7.js +2 -31
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +1554 -1544
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +0 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index64.js +0 -47
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { isLineItemTaxable as e } from "./lineItems.js";
|
|
2
2
|
import { buildReceivableAttachmentDetailsView as t } from "./attachments.js";
|
|
3
3
|
import { allocateDiscount as n, resolveDiscountAmount as r } from "./totals.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { ITERATION_STATUS_COLOR as i, SERIES_STATUS_COLOR as a, receivableStatusColor as o } from "./statusColors.js";
|
|
5
|
+
import { buildReceivableNotesView as s, formatDate as c, formatMoney as l, receivableBadgeLabel as u, resolveReceivableDueDate as d } from "./helpers.js";
|
|
6
|
+
import { getPaymentAccountLineLabel as f } from "./bankAccounts.js";
|
|
7
|
+
import { formatCountryName as p, formatDeduction as m } from "./preview.js";
|
|
7
8
|
// ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js
|
|
8
|
-
var
|
|
9
|
+
var h = {
|
|
9
10
|
draft: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"issue",
|
|
13
|
-
"issueAndSend"
|
|
14
|
-
],
|
|
11
|
+
header: ["edit"],
|
|
12
|
+
summary: ["issue", "issueAndSend"],
|
|
15
13
|
overflow: ["clone", "delete"]
|
|
16
14
|
},
|
|
17
15
|
issued: {
|
|
18
|
-
|
|
16
|
+
header: [],
|
|
17
|
+
summary: ["send", "recordPayment"],
|
|
19
18
|
overflow: ["clone", "cancel"]
|
|
20
19
|
},
|
|
21
20
|
overdue: {
|
|
22
|
-
|
|
21
|
+
header: [],
|
|
22
|
+
summary: ["send", "recordPayment"],
|
|
23
23
|
overflow: [
|
|
24
24
|
"clone",
|
|
25
25
|
"cancel",
|
|
@@ -27,66 +27,64 @@ var d = {
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
partially_paid: {
|
|
30
|
-
|
|
30
|
+
header: [],
|
|
31
|
+
summary: ["send", "recordPayment"],
|
|
31
32
|
overflow: ["clone"]
|
|
32
33
|
},
|
|
33
34
|
paid: {
|
|
34
|
-
|
|
35
|
+
header: [],
|
|
36
|
+
summary: [],
|
|
35
37
|
overflow: ["clone"]
|
|
36
38
|
},
|
|
37
39
|
canceled: {
|
|
38
|
-
|
|
40
|
+
header: [],
|
|
41
|
+
summary: [],
|
|
39
42
|
overflow: ["clone"]
|
|
40
43
|
},
|
|
41
44
|
uncollectible: {
|
|
42
|
-
|
|
45
|
+
header: [],
|
|
46
|
+
summary: [],
|
|
43
47
|
overflow: ["clone"]
|
|
44
48
|
},
|
|
45
49
|
recurring: {
|
|
46
|
-
|
|
50
|
+
header: [],
|
|
51
|
+
summary: [],
|
|
47
52
|
overflow: []
|
|
48
53
|
}
|
|
49
|
-
}
|
|
54
|
+
};
|
|
55
|
+
function ee(e) {
|
|
56
|
+
return Object.hasOwn(h, e) ? h[e] : {
|
|
57
|
+
header: [],
|
|
58
|
+
summary: [],
|
|
59
|
+
overflow: ["clone"]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
var te = /* @__PURE__ */ new Set([
|
|
50
63
|
"issued",
|
|
51
64
|
"overdue",
|
|
52
65
|
"partially_paid",
|
|
53
66
|
"paid",
|
|
54
67
|
"uncollectible"
|
|
55
|
-
])
|
|
56
|
-
|
|
57
|
-
issuing: "info",
|
|
58
|
-
issued: "info",
|
|
59
|
-
partially_paid: "info",
|
|
60
|
-
accepted: "success",
|
|
61
|
-
paid: "success",
|
|
62
|
-
failed: "danger",
|
|
63
|
-
expired: "danger",
|
|
64
|
-
declined: "danger",
|
|
65
|
-
overdue: "danger",
|
|
66
|
-
canceled: "neutral",
|
|
67
|
-
uncollectible: "neutral",
|
|
68
|
-
recurring: "neutral",
|
|
69
|
-
deleted: "neutral"
|
|
70
|
-
};
|
|
71
|
-
function m(e, t) {
|
|
68
|
+
]);
|
|
69
|
+
function g(e, t) {
|
|
72
70
|
let n = e.map((e) => `${e} ${e === 1 ? t.reminderUnitDay : t.reminderUnitDays}`);
|
|
73
71
|
if (n.length <= 1) return n[0] ?? "";
|
|
74
72
|
let r = t.reminderNameAnd;
|
|
75
73
|
return n.length === 2 ? `${n[0]} ${r} ${n[1]}` : `${n.slice(0, -1).join(", ")}, ${r} ${n[n.length - 1]}`;
|
|
76
74
|
}
|
|
77
|
-
function
|
|
75
|
+
function _({ paymentReminder: e, overdueReminder: t, remindersConfigured: n, messages: r }) {
|
|
78
76
|
let i = [
|
|
79
77
|
e?.term_1_reminder?.days_before,
|
|
80
78
|
e?.term_2_reminder?.days_before,
|
|
81
79
|
e?.term_final_reminder?.days_before
|
|
82
80
|
].filter((e) => typeof e == "number"), a = (t?.terms ?? []).map((e) => e.days_after).filter((e) => typeof e == "number"), o = [];
|
|
83
|
-
return i.length > 0 && o.push(`${
|
|
81
|
+
return i.length > 0 && o.push(`${g(i, r)} ${r.detailsRemindersBefore}`), a.length > 0 && o.push(`${g(a, r)} ${r.detailsRemindersAfter}`), o.length > 0 ? o.join("\n") : n ? "-" : r.detailsRemindersNone;
|
|
84
82
|
}
|
|
85
|
-
function
|
|
83
|
+
function v(e, t, n) {
|
|
86
84
|
return ((e.interval > 1 ? n : t)[e.frequency] ?? "").replace("{interval}", String(e.interval));
|
|
87
85
|
}
|
|
88
|
-
function
|
|
89
|
-
return
|
|
86
|
+
function y(e, t) {
|
|
87
|
+
return v(e, {
|
|
90
88
|
day: t.detailsFrequencyDay,
|
|
91
89
|
week: t.detailsFrequencyWeek,
|
|
92
90
|
month: t.detailsFrequencyMonth,
|
|
@@ -100,8 +98,8 @@ function _(e, t) {
|
|
|
100
98
|
year: t.listSeriesEveryYears
|
|
101
99
|
});
|
|
102
100
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
101
|
+
function b(e, t) {
|
|
102
|
+
return v(e, {
|
|
105
103
|
day: t.detailsPeriodDay,
|
|
106
104
|
week: t.detailsPeriodWeek,
|
|
107
105
|
month: t.detailsPeriodMonth,
|
|
@@ -115,10 +113,10 @@ function v(e, t) {
|
|
|
115
113
|
year: t.detailsPeriodEveryYears
|
|
116
114
|
});
|
|
117
115
|
}
|
|
118
|
-
function
|
|
119
|
-
return e.interval > 1 ? t.detailsScheduleTitleEvery.replace("{period}",
|
|
116
|
+
function x(e, t) {
|
|
117
|
+
return e.interval > 1 ? t.detailsScheduleTitleEvery.replace("{period}", b(e, t)) : t.detailsScheduleTitle.replace("{frequency}", y(e, t));
|
|
120
118
|
}
|
|
121
|
-
function
|
|
119
|
+
function S(e, t) {
|
|
122
120
|
return {
|
|
123
121
|
active: t.detailsSeriesStatusActive,
|
|
124
122
|
paused: t.detailsSeriesStatusPaused,
|
|
@@ -126,24 +124,6 @@ function y(e, t) {
|
|
|
126
124
|
completed: t.detailsSeriesStatusCompleted
|
|
127
125
|
}[e] ?? "";
|
|
128
126
|
}
|
|
129
|
-
var b = {
|
|
130
|
-
active: "info",
|
|
131
|
-
paused: "warning",
|
|
132
|
-
canceled: "danger",
|
|
133
|
-
completed: "success"
|
|
134
|
-
}, x = {
|
|
135
|
-
active: "forward",
|
|
136
|
-
paused: "pause",
|
|
137
|
-
canceled: "ban",
|
|
138
|
-
completed: "check"
|
|
139
|
-
}, S = {
|
|
140
|
-
pending: "neutral",
|
|
141
|
-
skipped: "warning",
|
|
142
|
-
canceled: "danger",
|
|
143
|
-
issue_failed: "danger",
|
|
144
|
-
send_failed: "danger",
|
|
145
|
-
completed: "success"
|
|
146
|
-
};
|
|
147
127
|
function C(e, t) {
|
|
148
128
|
return {
|
|
149
129
|
pending: t.detailsIterationStatusPending,
|
|
@@ -154,110 +134,77 @@ function C(e, t) {
|
|
|
154
134
|
completed: t.detailsIterationStatusCompleted
|
|
155
135
|
}[e] ?? "";
|
|
156
136
|
}
|
|
157
|
-
function
|
|
158
|
-
return n.detailsSeriesTitle.replace("{name}", e.counterpart_name ?? n.invoiceType).replace("{frequency}",
|
|
159
|
-
}
|
|
160
|
-
function T(e, t) {
|
|
161
|
-
return t[e] ?? t.unknown;
|
|
137
|
+
function ne(e, t, n) {
|
|
138
|
+
return n.detailsSeriesTitle.replace("{name}", e.counterpart_name ?? n.invoiceType).replace("{frequency}", y(t, n));
|
|
162
139
|
}
|
|
163
|
-
function
|
|
164
|
-
return (t.iterations ?? []).map((t,
|
|
165
|
-
let
|
|
140
|
+
function re({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLabels: a, messages: s, onOpenReceivable: c }) {
|
|
141
|
+
return (t.iterations ?? []).map((t, d) => {
|
|
142
|
+
let f = t.issued_invoice_id, p = f ? n.get(f) : void 0, m = p ?? e;
|
|
166
143
|
return {
|
|
167
|
-
id: `iteration-${t.iteration ?? ""}-${
|
|
168
|
-
issueDateLabel: t.issue_at ? r(t.issue_at) :
|
|
169
|
-
amountLabel:
|
|
170
|
-
amount:
|
|
171
|
-
currency:
|
|
144
|
+
id: `iteration-${t.iteration ?? ""}-${d}`,
|
|
145
|
+
issueDateLabel: t.issue_at ? r(t.issue_at) : s.detailsPending,
|
|
146
|
+
amountLabel: l({
|
|
147
|
+
amount: m.total_amount ?? 0,
|
|
148
|
+
currency: m.currency,
|
|
172
149
|
fallback: ""
|
|
173
150
|
}),
|
|
174
|
-
chip:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
status: u.status
|
|
151
|
+
chip: p ? {
|
|
152
|
+
label: u(p.status, a),
|
|
153
|
+
color: o(p.status)
|
|
178
154
|
} : {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
tone: S[t.status] ?? "neutral"
|
|
155
|
+
label: C(t.status, s),
|
|
156
|
+
color: i[t.status] ?? "neutral"
|
|
182
157
|
},
|
|
183
|
-
numberLabel:
|
|
184
|
-
onOpen:
|
|
185
|
-
openLabel:
|
|
158
|
+
numberLabel: f ? p?.document_id ?? "" : s.detailsPending,
|
|
159
|
+
onOpen: p ? () => c(p.id) : void 0,
|
|
160
|
+
openLabel: p ? s.detailsScheduleOpenInvoice.replace("{number}", p.document_id ?? "") : void 0
|
|
186
161
|
};
|
|
187
162
|
});
|
|
188
163
|
}
|
|
189
|
-
function
|
|
164
|
+
function ie(e) {
|
|
190
165
|
if (!e?.line1) return;
|
|
191
166
|
let t = [e.city, [e.state, e.postal_code].filter(Boolean).join(" ")].filter(Boolean).join(", ");
|
|
192
167
|
return [
|
|
193
168
|
e.line2 ? `${e.line1} ${e.line2}` : e.line1,
|
|
194
169
|
t,
|
|
195
|
-
e.country ?
|
|
170
|
+
e.country ? p(e.country) : void 0
|
|
196
171
|
].filter(Boolean).join(", ");
|
|
197
172
|
}
|
|
198
|
-
function
|
|
173
|
+
function w(e, t, n) {
|
|
199
174
|
let r = {
|
|
200
175
|
label: n.detailsAmountReceived,
|
|
201
176
|
value: t(e.amount_paid)
|
|
177
|
+
}, i = {
|
|
178
|
+
label: n.detailsBalanceDue,
|
|
179
|
+
value: t(e.amount_due),
|
|
180
|
+
emphasis: !0
|
|
202
181
|
};
|
|
203
182
|
switch (e.status) {
|
|
204
183
|
case "issued":
|
|
205
|
-
case "overdue": return
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
};
|
|
216
|
-
case "
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
};
|
|
227
|
-
case "paid": return {
|
|
228
|
-
amountTone: "success",
|
|
229
|
-
amountRows: [{
|
|
230
|
-
...r,
|
|
231
|
-
emphasis: !0
|
|
232
|
-
}]
|
|
233
|
-
};
|
|
234
|
-
case "canceled": return {
|
|
235
|
-
amountTone: "muted",
|
|
236
|
-
amountRows: [{
|
|
237
|
-
label: n.detailsCancelledAmount,
|
|
238
|
-
value: t(e.total_amount),
|
|
239
|
-
emphasis: !0
|
|
240
|
-
}]
|
|
241
|
-
};
|
|
242
|
-
case "uncollectible": return {
|
|
243
|
-
amountTone: "muted",
|
|
244
|
-
amountRows: [{
|
|
245
|
-
label: n.detailsAmountWrittenOff,
|
|
246
|
-
value: t(e.amount_due),
|
|
247
|
-
emphasis: !0
|
|
248
|
-
}]
|
|
249
|
-
};
|
|
250
|
-
default: return {
|
|
251
|
-
amountTone: "default",
|
|
252
|
-
amountRows: [{
|
|
253
|
-
label: n.detailsInvoiceAmount,
|
|
254
|
-
value: t(e.total_amount),
|
|
255
|
-
emphasis: !0
|
|
256
|
-
}]
|
|
257
|
-
};
|
|
184
|
+
case "overdue": return e.amount_paid > 0 ? [i, r] : [i];
|
|
185
|
+
case "partially_paid": return [i, r];
|
|
186
|
+
case "paid": return [{
|
|
187
|
+
...r,
|
|
188
|
+
emphasis: !0
|
|
189
|
+
}];
|
|
190
|
+
case "canceled": return [{
|
|
191
|
+
label: n.detailsCancelledAmount,
|
|
192
|
+
value: t(e.total_amount),
|
|
193
|
+
emphasis: !0
|
|
194
|
+
}];
|
|
195
|
+
case "uncollectible": return [{
|
|
196
|
+
label: n.detailsAmountWrittenOff,
|
|
197
|
+
value: t(e.amount_due),
|
|
198
|
+
emphasis: !0
|
|
199
|
+
}];
|
|
200
|
+
default: return [{
|
|
201
|
+
label: n.detailsInvoiceAmount,
|
|
202
|
+
value: t(e.total_amount),
|
|
203
|
+
emphasis: !0
|
|
204
|
+
}];
|
|
258
205
|
}
|
|
259
206
|
}
|
|
260
|
-
function
|
|
207
|
+
function ae(t, i, a) {
|
|
261
208
|
let o = t.line_items.reduce((t, n) => {
|
|
262
209
|
let r = n.total_before_tax ?? 0;
|
|
263
210
|
return e(n.tax_status) ? {
|
|
@@ -276,160 +223,159 @@ function re(t, i, a) {
|
|
|
276
223
|
}), { taxableSubtotal: c, nonTaxableSubtotal: l } = n({
|
|
277
224
|
...o,
|
|
278
225
|
discountAmount: s
|
|
279
|
-
}),
|
|
226
|
+
}), u = s > 0, d = o.taxableItemsSubtotal > 0, f = o.nonTaxableItemsSubtotal > 0, p = [{
|
|
280
227
|
label: a.previewSubtotal,
|
|
281
228
|
value: i(t.subtotal)
|
|
282
229
|
}];
|
|
283
|
-
|
|
230
|
+
u && p.push({
|
|
284
231
|
label: a.previewDiscount,
|
|
285
|
-
value:
|
|
286
|
-
}),
|
|
232
|
+
value: m(s, t.currency)
|
|
233
|
+
}), f && (d || u) && p.push({
|
|
287
234
|
label: a.previewNonTaxableSubtotal,
|
|
288
|
-
value: i(l)
|
|
289
|
-
|
|
290
|
-
}), f && (p || d) && m.push({
|
|
235
|
+
value: i(l)
|
|
236
|
+
}), d && (f || u) && p.push({
|
|
291
237
|
label: a.previewTaxableSubtotal,
|
|
292
|
-
value: i(c)
|
|
293
|
-
tone: "muted"
|
|
238
|
+
value: i(c)
|
|
294
239
|
});
|
|
295
|
-
for (let e of t.total_tax_amounts ?? [])
|
|
240
|
+
for (let e of t.total_tax_amounts ?? []) p.push({
|
|
296
241
|
label: a.previewTaxWithRate.replace("{rate}", String((e.value ?? 0) / 100)),
|
|
297
242
|
value: i(e.amount)
|
|
298
243
|
});
|
|
299
|
-
return
|
|
244
|
+
return p.push({
|
|
300
245
|
label: a.previewTotal,
|
|
301
246
|
value: i(t.total_amount),
|
|
302
247
|
emphasis: !0
|
|
303
|
-
}),
|
|
248
|
+
}), p;
|
|
304
249
|
}
|
|
305
|
-
var
|
|
306
|
-
|
|
250
|
+
var oe = {
|
|
251
|
+
header: [],
|
|
252
|
+
summary: [],
|
|
307
253
|
overflow: []
|
|
308
254
|
};
|
|
309
|
-
function
|
|
255
|
+
function T({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: i, depositAccount: p, isAccountListIncomplete: m, recurrence: h, paymentRecords: g = [], isLoadingPaymentRecords: v = !1, iterationInvoices: C = /* @__PURE__ */ new Map(), auditHistory: T, statusLabels: E, messages: D, canRecordPayment: O, hasBeenSent: se = !1, canWrite: k = !0, onOpenReceivable: A, onOpenCustomer: j, now: M }) {
|
|
310
256
|
if (!e || e.type !== "invoice") return;
|
|
311
|
-
let N = e, P = (e) =>
|
|
257
|
+
let N = e, P = (e) => l({
|
|
312
258
|
amount: e ?? 0,
|
|
313
259
|
currency: N.currency,
|
|
314
260
|
fallback: ""
|
|
315
|
-
}), F = (e) =>
|
|
316
|
-
|
|
261
|
+
}), F = (e) => c(e, "-"), I = (e) => e ? F(e) : D.detailsPending, { status: L } = N, R = L === "canceled", z = L === "recurring" ? h : void 0, B = N.recurrence_id && L !== "recurring" ? h : void 0, V = d({
|
|
262
|
+
dueDate: N.due_date,
|
|
263
|
+
status: L,
|
|
264
|
+
dateLabel: I(N.due_date),
|
|
265
|
+
messages: D,
|
|
266
|
+
now: M ?? /* @__PURE__ */ new Date()
|
|
267
|
+
}), H = w(N, P, D), U = N.counterpart_contact, W = ie(N.counterpart_billing_address), G = N.counterpart_id, ce = N.counterpart_name ? {
|
|
268
|
+
label: D.detailsCustomerName,
|
|
317
269
|
name: N.counterpart_name,
|
|
318
|
-
onOpen:
|
|
270
|
+
onOpen: j && G ? () => j(G) : void 0
|
|
319
271
|
} : void 0, le = [
|
|
320
|
-
...
|
|
321
|
-
label:
|
|
322
|
-
value:
|
|
272
|
+
...U?.email ? [{
|
|
273
|
+
label: D.detailsCustomerEmail,
|
|
274
|
+
value: U.email
|
|
323
275
|
}] : [],
|
|
324
|
-
...
|
|
325
|
-
label:
|
|
326
|
-
value:
|
|
276
|
+
...U?.phone ? [{
|
|
277
|
+
label: D.detailsCustomerPhone,
|
|
278
|
+
value: U.phone
|
|
327
279
|
}] : [],
|
|
328
|
-
...
|
|
329
|
-
label:
|
|
330
|
-
value:
|
|
280
|
+
...W ? [{
|
|
281
|
+
label: D.detailsCustomerAddress,
|
|
282
|
+
value: W
|
|
331
283
|
}] : []
|
|
332
|
-
],
|
|
333
|
-
label:
|
|
334
|
-
value:
|
|
284
|
+
], K = {
|
|
285
|
+
label: D.detailsPaymentReminders,
|
|
286
|
+
value: _({
|
|
335
287
|
paymentReminder: r,
|
|
336
|
-
overdueReminder:
|
|
288
|
+
overdueReminder: i,
|
|
337
289
|
remindersConfigured: !!(N.payment_reminder_id || N.overdue_reminder_id),
|
|
338
|
-
messages:
|
|
290
|
+
messages: D
|
|
339
291
|
})
|
|
292
|
+
}, q = {
|
|
293
|
+
label: D.detailsDepositAccount,
|
|
294
|
+
value: p ? f(p, D) : m && N.bank_account_id ? "-" : D.detailsNotProvided
|
|
340
295
|
}, J = {
|
|
341
|
-
label:
|
|
342
|
-
value:
|
|
343
|
-
}, Y = {
|
|
344
|
-
label: k.detailsPaymentTerms,
|
|
345
|
-
value: N.payment_terms?.name ?? k.detailsPending
|
|
296
|
+
label: D.detailsPaymentTerms,
|
|
297
|
+
value: N.payment_terms?.name ?? D.detailsPending
|
|
346
298
|
}, ue = z ? [
|
|
347
299
|
{
|
|
348
|
-
label:
|
|
349
|
-
value:
|
|
300
|
+
label: D.detailsFrequency,
|
|
301
|
+
value: y(z, D)
|
|
350
302
|
},
|
|
351
303
|
{
|
|
352
|
-
label:
|
|
304
|
+
label: D.detailsInvoiceAmount,
|
|
353
305
|
value: P(N.total_amount)
|
|
354
306
|
},
|
|
355
|
-
|
|
356
|
-
|
|
307
|
+
J,
|
|
308
|
+
K,
|
|
357
309
|
{
|
|
358
|
-
label:
|
|
359
|
-
value: N.purchase_order ||
|
|
310
|
+
label: D.detailsPoNumber,
|
|
311
|
+
value: N.purchase_order || D.detailsNotProvided
|
|
360
312
|
},
|
|
361
|
-
|
|
313
|
+
q
|
|
362
314
|
] : [
|
|
363
315
|
...N.document_id ? [{
|
|
364
|
-
label:
|
|
316
|
+
label: D.detailsInvoiceNumber,
|
|
365
317
|
value: N.document_id
|
|
366
318
|
}] : [],
|
|
367
319
|
{
|
|
368
|
-
label:
|
|
320
|
+
label: D.detailsInvoiceAmount,
|
|
369
321
|
value: P(N.total_amount)
|
|
370
322
|
},
|
|
371
323
|
{
|
|
372
|
-
label:
|
|
324
|
+
label: D.detailsInvoiceDate,
|
|
373
325
|
value: I(N.issue_date)
|
|
374
326
|
},
|
|
375
327
|
{
|
|
376
|
-
label:
|
|
328
|
+
label: D.detailsDueDate,
|
|
377
329
|
value: I(N.due_date)
|
|
378
330
|
},
|
|
379
|
-
|
|
380
|
-
|
|
331
|
+
J,
|
|
332
|
+
K,
|
|
381
333
|
...N.purchase_order ? [{
|
|
382
|
-
label:
|
|
334
|
+
label: D.detailsPoNumber,
|
|
383
335
|
value: N.purchase_order
|
|
384
336
|
}] : [],
|
|
385
|
-
|
|
386
|
-
],
|
|
387
|
-
|
|
388
|
-
overflow: ["clone"]
|
|
389
|
-
} : ie;
|
|
390
|
-
if (z && A) {
|
|
337
|
+
q
|
|
338
|
+
], Y = z ? void 0 : s(N), { header: X, summary: Z, overflow: Q } = k ? ee(L) : oe;
|
|
339
|
+
if (z && k) {
|
|
391
340
|
let e = z.status === "active" || z.status === "paused";
|
|
392
|
-
Q = z.status === "active" ? ["pauseRecurrence", "cancelRecurrence"] : z.status === "paused" ? ["resumeRecurrence", "cancelRecurrence"] : [],
|
|
341
|
+
Q = z.status === "active" ? ["pauseRecurrence", "cancelRecurrence"] : z.status === "paused" ? ["resumeRecurrence", "cancelRecurrence"] : [], X = e ? ["edit"] : [], Z = [];
|
|
393
342
|
}
|
|
394
|
-
|
|
395
|
-
let de =
|
|
396
|
-
rows:
|
|
343
|
+
O || (Z = Z.filter((e) => e !== "recordPayment"));
|
|
344
|
+
let de = te.has(L) ? {
|
|
345
|
+
rows: g.map((e) => ({
|
|
397
346
|
id: e.id,
|
|
398
347
|
dateLabel: F(e.paid_at),
|
|
399
348
|
amountLabel: P(e.amount)
|
|
400
349
|
})),
|
|
401
350
|
totalLabel: P(N.amount_paid),
|
|
402
|
-
|
|
403
|
-
isLoading: C
|
|
351
|
+
isLoading: v
|
|
404
352
|
} : void 0, fe = z ? {
|
|
405
|
-
statusLabel:
|
|
406
|
-
|
|
407
|
-
statusIcon: x[z.status],
|
|
353
|
+
statusLabel: S(z.status, D),
|
|
354
|
+
statusColor: a[z.status] ?? "neutral",
|
|
408
355
|
amountLabel: P(N.total_amount),
|
|
409
|
-
amountPeriodLabel:
|
|
356
|
+
amountPeriodLabel: b(z, D),
|
|
410
357
|
startsOnLabel: I(z.start_date),
|
|
411
358
|
endsOnLabel: F(z.end_date ?? (z.max_occurrences ? z.iterations?.at(-1)?.issue_at : void 0)),
|
|
412
|
-
scheduleTitle:
|
|
413
|
-
schedule:
|
|
359
|
+
scheduleTitle: x(z, D),
|
|
360
|
+
schedule: re({
|
|
414
361
|
invoice: N,
|
|
415
362
|
recurrence: z,
|
|
416
|
-
iterationInvoices:
|
|
363
|
+
iterationInvoices: C,
|
|
417
364
|
date: F,
|
|
418
|
-
statusLabels:
|
|
419
|
-
messages:
|
|
420
|
-
onOpenReceivable:
|
|
365
|
+
statusLabels: E,
|
|
366
|
+
messages: D,
|
|
367
|
+
onOpenReceivable: A
|
|
421
368
|
})
|
|
422
|
-
} : void 0, $ = B ?
|
|
369
|
+
} : void 0, $ = B ? ne(N, B, D) : void 0, pe = B && $ ? {
|
|
423
370
|
title: $,
|
|
424
|
-
backLabel:
|
|
425
|
-
onOpen: () =>
|
|
371
|
+
backLabel: D.detailsSeriesBack.replace("{title}", $),
|
|
372
|
+
onOpen: () => A(B.invoice_id)
|
|
426
373
|
} : void 0;
|
|
427
374
|
return {
|
|
428
375
|
id: N.id,
|
|
429
376
|
type: N.type,
|
|
430
|
-
title: N.counterpart_name ??
|
|
377
|
+
title: N.counterpart_name ?? D.invoiceType,
|
|
431
378
|
status: L,
|
|
432
|
-
statusTone: p[L] ?? "neutral",
|
|
433
379
|
pdfUrl: n,
|
|
434
380
|
lineItems: N.line_items.map((e, t) => ({
|
|
435
381
|
id: `${e.product.id ?? "item"}-${t}`,
|
|
@@ -439,15 +385,15 @@ function D({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: l, d
|
|
|
439
385
|
totalLabel: P(e.total_before_tax ?? (e.product.price?.value ?? 0) * e.quantity)
|
|
440
386
|
})),
|
|
441
387
|
panel: {
|
|
442
|
-
subtitle: z ?
|
|
443
|
-
|
|
388
|
+
subtitle: z ? D.detailsSeriesSubtitle.replace("{frequency}", y(z, D)) : N.document_id ? D.detailsInvoiceSubtitle.replace("{number}", N.document_id) : void 0,
|
|
389
|
+
hiddenDescription: !z && !N.document_id && L === "draft" ? D.detailsDraftDescription : void 0,
|
|
390
|
+
statusLabel: u(L, E),
|
|
391
|
+
statusColor: o(L),
|
|
444
392
|
recurring: !!N.recurrence_id || L === "recurring",
|
|
445
|
-
|
|
446
|
-
amountTone: H,
|
|
447
|
-
amountRows: U,
|
|
393
|
+
amountRows: H,
|
|
448
394
|
issueDateLabel: I(N.issue_date),
|
|
449
|
-
dueDateLabel: R ? F(N.updated_at) : I(N.due_date),
|
|
450
|
-
dueDateCaption: R ?
|
|
395
|
+
dueDateLabel: R ? F(N.updated_at) : V.overdueLabel ? D.detailsOverdueDueDate.replace("{date}", V.label).replace("{overdue}", V.overdueLabel) : I(N.due_date),
|
|
396
|
+
dueDateCaption: R ? D.detailsCancelledOnCaption : D.detailsDueDate,
|
|
451
397
|
paymentHistory: de,
|
|
452
398
|
customerName: ce,
|
|
453
399
|
customerContact: le,
|
|
@@ -456,21 +402,22 @@ function D({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: l, d
|
|
|
456
402
|
billingItems: ue,
|
|
457
403
|
lineItemsSection: z ? void 0 : {
|
|
458
404
|
countLabel: String(N.line_items.length),
|
|
459
|
-
totals:
|
|
405
|
+
totals: ae(N, P, D)
|
|
460
406
|
},
|
|
461
|
-
notes:
|
|
462
|
-
...
|
|
463
|
-
countLabel: String([
|
|
407
|
+
notes: Y && {
|
|
408
|
+
...Y,
|
|
409
|
+
countLabel: String([Y.opening, Y.closing].filter(Boolean).length)
|
|
464
410
|
},
|
|
465
|
-
attachments: t(N,
|
|
466
|
-
auditHistory:
|
|
467
|
-
|
|
411
|
+
attachments: t(N, D),
|
|
412
|
+
auditHistory: T,
|
|
413
|
+
headerActions: X,
|
|
414
|
+
summaryActions: Z,
|
|
468
415
|
overflowActions: Q,
|
|
469
|
-
actionLabels: { send:
|
|
416
|
+
actionLabels: { send: se ? D.detailsResendButton : D.detailsSendButton }
|
|
470
417
|
}
|
|
471
418
|
};
|
|
472
419
|
}
|
|
473
|
-
function
|
|
420
|
+
function E(e, t, n) {
|
|
474
421
|
if (!e) return {
|
|
475
422
|
title: n.detailsNotFoundTitle,
|
|
476
423
|
description: n.detailsNotFoundDescription.replace("{invoiceId}", t)
|
|
@@ -480,4 +427,4 @@ function O(e, t, n) {
|
|
|
480
427
|
description: n.detailsUnsupportedDescription.replace("{type}", e.type)
|
|
481
428
|
};
|
|
482
429
|
}
|
|
483
|
-
export {
|
|
430
|
+
export { E as buildDetailsMessageView, T as buildReceivableDetailsView, _ as formatReminderSchedule, y as frequencyLabel, S as seriesStatusLabel };
|