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