@tesouro/embedded-components-react 0.5.227 → 0.5.228
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 +21 -21
- package/dist/index.d.ts +54 -34
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +54 -34
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +29 -59
- 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/index12.js +36 -141
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +26 -16
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +58 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +228 -122
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +300 -147
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +34 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +126 -122
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +150 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +38 -91
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +113 -107
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +98 -231
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +111 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +25 -624
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +631 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +41 -40
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +35 -74
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +73 -115
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +115 -313
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index33.js +325 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +15 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +11 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +42 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +19 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +73 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +16 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +32 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +304 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +42 -258
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +62 -38
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +485 -61
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +90 -480
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +0 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +100 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +23 -95
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +231 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +3 -236
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +249 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +78 -234
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +53 -87
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +343 -49
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +29 -20
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +40 -40
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +189 -211
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +43 -59
- 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/index26.js +0 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +0 -353
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js
CHANGED
|
@@ -1,155 +1,308 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "../../data-access/dist/index.js";
|
|
8
|
-
import { useCallback as i, useEffect as a, useRef as o, useState as s } 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 "./index11.js";
|
|
4
|
+
import { buildReceivableNotesView as i, formatDate as a, formatMoney as o } from "./index12.js";
|
|
5
|
+
import { getPaymentAccountLineLabel as s } from "./index17.js";
|
|
6
|
+
import { formatCountryName as c, formatDeduction as l } from "./index18.js";
|
|
9
7
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
var u = {
|
|
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
|
+
}, d = {
|
|
46
|
+
draft: "neutral",
|
|
47
|
+
issuing: "info",
|
|
48
|
+
issued: "info",
|
|
49
|
+
partially_paid: "info",
|
|
50
|
+
accepted: "success",
|
|
51
|
+
paid: "success",
|
|
52
|
+
failed: "danger",
|
|
53
|
+
expired: "danger",
|
|
54
|
+
declined: "danger",
|
|
55
|
+
overdue: "danger",
|
|
56
|
+
canceled: "neutral",
|
|
57
|
+
uncollectible: "neutral",
|
|
58
|
+
recurring: "neutral",
|
|
59
|
+
deleted: "neutral"
|
|
60
|
+
};
|
|
61
|
+
function f(e, t = /* @__PURE__ */ new Date()) {
|
|
62
|
+
if (!e) return 0;
|
|
63
|
+
let n = new Date(e);
|
|
64
|
+
if (Number.isNaN(n.getTime())) return 0;
|
|
65
|
+
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);
|
|
66
|
+
return a > 0 ? a : 0;
|
|
67
|
+
}
|
|
68
|
+
function p(e, t) {
|
|
69
|
+
let n = e.map((e) => `${e} ${e === 1 ? t.reminderUnitDay : t.reminderUnitDays}`);
|
|
70
|
+
if (n.length <= 1) return n[0] ?? "";
|
|
71
|
+
let r = t.reminderNameAnd;
|
|
72
|
+
return n.length === 2 ? `${n[0]} ${r} ${n[1]}` : `${n.slice(0, -1).join(", ")}, ${r} ${n[n.length - 1]}`;
|
|
73
|
+
}
|
|
74
|
+
function m({ paymentReminder: e, overdueReminder: t, remindersConfigured: n, messages: r }) {
|
|
75
|
+
let i = [
|
|
76
|
+
e?.term_1_reminder?.days_before,
|
|
77
|
+
e?.term_2_reminder?.days_before,
|
|
78
|
+
e?.term_final_reminder?.days_before
|
|
79
|
+
].filter((e) => typeof e == "number"), a = (t?.terms ?? []).map((e) => e.days_after).filter((e) => typeof e == "number"), o = [];
|
|
80
|
+
return i.length > 0 && o.push(`${p(i, r)} ${r.detailsRemindersBefore}`), a.length > 0 && o.push(`${p(a, r)} ${r.detailsRemindersAfter}`), o.length > 0 ? o.join("\n") : n ? "-" : r.detailsRemindersNone;
|
|
81
|
+
}
|
|
82
|
+
function h(e) {
|
|
83
|
+
if (!e?.line1) return;
|
|
84
|
+
let t = [e.city, [e.state, e.postal_code].filter(Boolean).join(" ")].filter(Boolean).join(", ");
|
|
85
|
+
return [
|
|
86
|
+
e.line2 ? `${e.line1} ${e.line2}` : e.line1,
|
|
87
|
+
t,
|
|
88
|
+
e.country ? c(e.country) : void 0
|
|
89
|
+
].filter(Boolean).join(", ");
|
|
90
|
+
}
|
|
91
|
+
function g(e, t, n) {
|
|
92
|
+
let r = {
|
|
93
|
+
label: n.detailsAmountReceived,
|
|
94
|
+
value: t(e.amount_paid)
|
|
95
|
+
};
|
|
96
|
+
switch (e.status) {
|
|
97
|
+
case "issued":
|
|
98
|
+
case "overdue": return {
|
|
99
|
+
amountTone: e.status === "overdue" ? "danger" : "default",
|
|
100
|
+
amountRows: [{
|
|
101
|
+
label: n.detailsBalanceDue,
|
|
102
|
+
value: t(e.amount_due),
|
|
103
|
+
emphasis: !0
|
|
104
|
+
}, ...e.amount_paid > 0 ? [{
|
|
105
|
+
...r,
|
|
106
|
+
tone: "success"
|
|
107
|
+
}] : []]
|
|
19
108
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
e.clear();
|
|
109
|
+
case "partially_paid": return {
|
|
110
|
+
amountTone: "default",
|
|
111
|
+
amountRows: [{
|
|
112
|
+
label: n.detailsBalanceDue,
|
|
113
|
+
value: t(e.amount_due),
|
|
114
|
+
emphasis: !0
|
|
115
|
+
}, {
|
|
116
|
+
...r,
|
|
117
|
+
tone: "success"
|
|
118
|
+
}]
|
|
31
119
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
let r =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
120
|
+
case "paid": return {
|
|
121
|
+
amountTone: "success",
|
|
122
|
+
amountRows: [{
|
|
123
|
+
...r,
|
|
124
|
+
emphasis: !0
|
|
125
|
+
}]
|
|
126
|
+
};
|
|
127
|
+
case "canceled": return {
|
|
128
|
+
amountTone: "muted",
|
|
129
|
+
amountRows: [{
|
|
130
|
+
label: n.detailsCancelledAmount,
|
|
131
|
+
value: t(e.total_amount),
|
|
132
|
+
emphasis: !0
|
|
133
|
+
}]
|
|
134
|
+
};
|
|
135
|
+
case "uncollectible": return {
|
|
136
|
+
amountTone: "muted",
|
|
137
|
+
amountRows: [{
|
|
138
|
+
label: n.detailsAmountWrittenOff,
|
|
139
|
+
value: t(e.amount_due),
|
|
140
|
+
emphasis: !0
|
|
141
|
+
}]
|
|
142
|
+
};
|
|
143
|
+
default: return {
|
|
144
|
+
amountTone: "default",
|
|
145
|
+
amountRows: [{
|
|
146
|
+
label: n.detailsInvoiceAmount,
|
|
147
|
+
value: t(e.total_amount),
|
|
148
|
+
emphasis: !0
|
|
149
|
+
}]
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function _(t, i, a) {
|
|
154
|
+
let o = t.line_items.reduce((t, n) => {
|
|
155
|
+
let r = n.total_before_tax ?? 0;
|
|
156
|
+
return e(n.tax_status) ? {
|
|
157
|
+
...t,
|
|
158
|
+
taxableItemsSubtotal: t.taxableItemsSubtotal + r
|
|
159
|
+
} : {
|
|
160
|
+
...t,
|
|
161
|
+
nonTaxableItemsSubtotal: t.nonTaxableItemsSubtotal + r
|
|
162
|
+
};
|
|
163
|
+
}, {
|
|
164
|
+
taxableItemsSubtotal: 0,
|
|
165
|
+
nonTaxableItemsSubtotal: 0
|
|
166
|
+
}), s = r({
|
|
167
|
+
discount: t.discount,
|
|
168
|
+
subtotal: o.taxableItemsSubtotal + o.nonTaxableItemsSubtotal
|
|
169
|
+
}), { taxableSubtotal: c, nonTaxableSubtotal: u } = n({
|
|
170
|
+
...o,
|
|
171
|
+
discountAmount: s
|
|
172
|
+
}), d = s > 0, f = o.taxableItemsSubtotal > 0, p = o.nonTaxableItemsSubtotal > 0, m = [{
|
|
173
|
+
label: a.previewSubtotal,
|
|
174
|
+
value: i(t.subtotal)
|
|
175
|
+
}];
|
|
176
|
+
d && m.push({
|
|
177
|
+
label: a.previewDiscount,
|
|
178
|
+
value: l(s, t.currency)
|
|
179
|
+
}), p && (f || d) && m.push({
|
|
180
|
+
label: a.previewNonTaxableSubtotal,
|
|
181
|
+
value: i(u),
|
|
182
|
+
tone: "muted"
|
|
183
|
+
}), f && (p || d) && m.push({
|
|
184
|
+
label: a.previewTaxableSubtotal,
|
|
185
|
+
value: i(c),
|
|
186
|
+
tone: "muted"
|
|
187
|
+
});
|
|
188
|
+
for (let e of t.total_tax_amounts ?? []) m.push({
|
|
189
|
+
label: a.previewTaxWithRate.replace("{rate}", String((e.value ?? 0) / 100)),
|
|
190
|
+
value: i(e.amount)
|
|
191
|
+
});
|
|
192
|
+
return m.push({
|
|
193
|
+
label: a.previewTotal,
|
|
194
|
+
value: i(t.total_amount),
|
|
195
|
+
emphasis: !0
|
|
196
|
+
}), m;
|
|
197
|
+
}
|
|
198
|
+
function v({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: c, depositAccount: l, isAccountListIncomplete: p, statusLabels: v, messages: y, now: b }) {
|
|
199
|
+
if (!e || e.type !== "invoice") return;
|
|
200
|
+
let x = e, S = (e) => o({
|
|
201
|
+
amount: e ?? 0,
|
|
202
|
+
currency: x.currency,
|
|
203
|
+
fallback: ""
|
|
204
|
+
}), C = (e) => a(e, "-"), w = (e) => e ? C(e) : y.detailsPending, { status: T } = x, E = T === "canceled", D = T === "overdue" ? f(x.due_date, b) : 0, { amountTone: O, amountRows: k } = g(x, S, y), A = x.counterpart_contact, j = h(x.counterpart_billing_address), M = [
|
|
205
|
+
...x.counterpart_name ? [{
|
|
206
|
+
label: y.detailsCustomerName,
|
|
207
|
+
value: x.counterpart_name
|
|
208
|
+
}] : [],
|
|
209
|
+
...A?.email ? [{
|
|
210
|
+
label: y.detailsCustomerEmail,
|
|
211
|
+
value: A.email
|
|
212
|
+
}] : [],
|
|
213
|
+
...A?.phone ? [{
|
|
214
|
+
label: y.detailsCustomerPhone,
|
|
215
|
+
value: A.phone
|
|
216
|
+
}] : [],
|
|
217
|
+
...j ? [{
|
|
218
|
+
label: y.detailsCustomerAddress,
|
|
219
|
+
value: j
|
|
220
|
+
}] : []
|
|
221
|
+
], N = [
|
|
222
|
+
...x.document_id ? [{
|
|
223
|
+
label: y.detailsInvoiceNumber,
|
|
224
|
+
value: x.document_id
|
|
225
|
+
}] : [],
|
|
226
|
+
{
|
|
227
|
+
label: y.detailsInvoiceAmount,
|
|
228
|
+
value: S(x.total_amount)
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
label: y.detailsInvoiceDate,
|
|
232
|
+
value: w(x.issue_date)
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: y.detailsDueDate,
|
|
236
|
+
value: w(x.due_date)
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
label: y.detailsPaymentTerms,
|
|
240
|
+
value: x.payment_terms?.name ?? y.detailsPending
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
label: y.detailsPaymentReminders,
|
|
244
|
+
value: m({
|
|
245
|
+
paymentReminder: r,
|
|
246
|
+
overdueReminder: c,
|
|
247
|
+
remindersConfigured: !!(x.payment_reminder_id || x.overdue_reminder_id),
|
|
248
|
+
messages: y
|
|
249
|
+
})
|
|
250
|
+
},
|
|
251
|
+
...x.purchase_order ? [{
|
|
252
|
+
label: y.detailsPoNumber,
|
|
253
|
+
value: x.purchase_order
|
|
254
|
+
}] : [],
|
|
255
|
+
{
|
|
256
|
+
label: y.detailsDepositAccount,
|
|
257
|
+
value: l ? s(l, y) : p && x.bank_account_id ? "-" : y.detailsNotProvided
|
|
111
258
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}, [
|
|
117
|
-
f,
|
|
118
|
-
p,
|
|
119
|
-
u,
|
|
120
|
-
l
|
|
121
|
-
]), O = i(() => {
|
|
122
|
-
x.current += 1, v.current.clear(), y.current.clear(), b.current.clear(), m([]), g(!1);
|
|
123
|
-
}, []), k = i(() => {
|
|
124
|
-
let e = new Set(y.current);
|
|
125
|
-
for (let t of e) f({
|
|
126
|
-
path: { file_id: t },
|
|
127
|
-
receivableId: u
|
|
128
|
-
});
|
|
129
|
-
l((t) => t.filter(({ id: t }) => !e.has(t))), O();
|
|
130
|
-
}, [
|
|
131
|
-
f,
|
|
132
|
-
u,
|
|
133
|
-
O,
|
|
134
|
-
l
|
|
135
|
-
]), A = i(() => {
|
|
136
|
-
for (let e of b.current) f({
|
|
137
|
-
path: { file_id: e },
|
|
138
|
-
receivableId: u
|
|
139
|
-
});
|
|
140
|
-
b.current.clear();
|
|
141
|
-
}, [f, u]);
|
|
259
|
+
], P = i(x), F = u[T] ?? {
|
|
260
|
+
primary: [],
|
|
261
|
+
overflow: ["clone"]
|
|
262
|
+
};
|
|
142
263
|
return {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
264
|
+
id: x.id,
|
|
265
|
+
type: x.type,
|
|
266
|
+
title: x.counterpart_name ?? y.invoiceType,
|
|
267
|
+
status: T,
|
|
268
|
+
statusTone: d[T] ?? "neutral",
|
|
269
|
+
pdfUrl: n || x.file_url || x.original_file_url || void 0,
|
|
270
|
+
lineItems: x.line_items.map((e, t) => ({
|
|
271
|
+
id: `${e.product.id ?? "item"}-${t}`,
|
|
272
|
+
name: e.product.name,
|
|
273
|
+
quantityLabel: String(e.quantity),
|
|
274
|
+
unitPriceLabel: S(e.product.price?.value),
|
|
275
|
+
totalLabel: S(e.total_before_tax ?? (e.product.price?.value ?? 0) * e.quantity)
|
|
276
|
+
})),
|
|
277
|
+
panel: {
|
|
278
|
+
subtitle: x.document_id ? y.detailsInvoiceSubtitle.replace("{number}", x.document_id) : void 0,
|
|
279
|
+
statusLabel: T === "partially_paid" ? v.issued : v[T] ?? v.unknown,
|
|
280
|
+
recurring: !!x.recurrence_id || T === "recurring",
|
|
281
|
+
overdueLabel: D > 0 ? y.detailsDaysOverdue.replace("{days}", String(D)) : void 0,
|
|
282
|
+
amountTone: O,
|
|
283
|
+
amountRows: k,
|
|
284
|
+
issueDateLabel: w(x.issue_date),
|
|
285
|
+
dueDateLabel: E ? C(x.updated_at) : w(x.due_date),
|
|
286
|
+
dueDateCaption: E ? y.detailsCancelledOnCaption : y.detailsDueDate,
|
|
287
|
+
customerContact: M,
|
|
288
|
+
billingItems: N,
|
|
289
|
+
lineItemsCountLabel: String(x.line_items.length),
|
|
290
|
+
lineItemTotals: _(x, S, y),
|
|
291
|
+
notes: P && {
|
|
292
|
+
...P,
|
|
293
|
+
countLabel: String([P.opening, P.closing].filter(Boolean).length)
|
|
294
|
+
},
|
|
295
|
+
attachments: t(x, y),
|
|
296
|
+
primaryActions: F.primary,
|
|
297
|
+
overflowActions: F.overflow
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function y(e, t) {
|
|
302
|
+
if (e && e.type !== "invoice") return {
|
|
303
|
+
title: t.detailsUnsupportedTitle,
|
|
304
|
+
description: t.detailsUnsupportedDescription.replace("{type}", e.type)
|
|
152
305
|
};
|
|
153
306
|
}
|
|
154
307
|
//#endregion
|
|
155
|
-
export {
|
|
308
|
+
export { v as buildReceivableDetailsView, y as buildUnsupportedDetailsView, m as formatReminderSchedule, f as getDaysOverdue };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js
CHANGED
|
@@ -2,50 +2,47 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { useWidgetConfig as e } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
6
|
+
import "../../../shared/feature/dist/index.js";
|
|
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";
|
|
7
10
|
import "../../data-access/dist/index.js";
|
|
8
|
-
import {
|
|
11
|
+
import { getBankAccountPermissions as o } from "./index17.js";
|
|
12
|
+
import { buildReceivableDetailsView as s, buildUnsupportedDetailsView as c } from "./index19.js";
|
|
13
|
+
import { useMemo as l } from "react";
|
|
9
14
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js
|
|
10
|
-
function u({
|
|
11
|
-
let
|
|
15
|
+
function u({ selectedReceivableId: u, enabled: d = !0, messages: f, statusLabels: p }) {
|
|
16
|
+
let { initResponse: m } = e(), h = l(() => o(m?.scopes), [m?.scopes]), g = r(u, { enabled: d }), _ = g.data, v = _?.type === "invoice" ? _ : void 0, y = n(u, { enabled: d && !!_ }), b = a({ enabled: d && !!v?.payment_reminder_id }), x = i({ enabled: d && !!v?.overdue_reminder_id }), S = t({
|
|
17
|
+
enabled: d && !!v,
|
|
18
|
+
canReadEmbedded: h.canReadEmbedded,
|
|
19
|
+
canReadExternal: h.canReadExternal
|
|
20
|
+
}), C = b.data?.data.find((e) => e.id === v?.payment_reminder_id), w = x.data?.data.find((e) => e.id === v?.overdue_reminder_id), T = S.paymentAccounts.find((e) => e.id === v?.bank_account_id), E = y.data?.file_url || y.data?.original_file_url || void 0;
|
|
12
21
|
return {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
messages:
|
|
23
|
-
issueDate: i(f)
|
|
22
|
+
receivable: _,
|
|
23
|
+
detailsView: l(() => s({
|
|
24
|
+
receivable: _,
|
|
25
|
+
pdfUrl: E,
|
|
26
|
+
paymentReminder: C,
|
|
27
|
+
overdueReminder: w,
|
|
28
|
+
depositAccount: T,
|
|
29
|
+
isAccountListIncomplete: S.isIncomplete,
|
|
30
|
+
statusLabels: p,
|
|
31
|
+
messages: f
|
|
24
32
|
}), [
|
|
25
33
|
_,
|
|
34
|
+
E,
|
|
35
|
+
C,
|
|
36
|
+
w,
|
|
37
|
+
T,
|
|
38
|
+
S.isIncomplete,
|
|
26
39
|
p,
|
|
27
|
-
f
|
|
28
|
-
m,
|
|
29
|
-
d,
|
|
30
|
-
u,
|
|
31
|
-
g.data?.data,
|
|
32
|
-
g.isLoading
|
|
40
|
+
f
|
|
33
41
|
]),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, [h]),
|
|
38
|
-
changeCustomDatePickerOpen: s((e) => {
|
|
39
|
-
v(e), e || h(r);
|
|
40
|
-
}, [h]),
|
|
41
|
-
selectCustomDate: s((e) => {
|
|
42
|
-
h((t) => r({
|
|
43
|
-
...t,
|
|
44
|
-
paymentTermsCustomDate: o(e)
|
|
45
|
-
})), v(!1);
|
|
46
|
-
}, [h]),
|
|
47
|
-
reset: s(() => v(!1), [])
|
|
42
|
+
unsupportedView: l(() => c(_, f), [_, f]),
|
|
43
|
+
isLoading: g.isLoading || y.isLoading,
|
|
44
|
+
isError: g.isError
|
|
48
45
|
};
|
|
49
46
|
}
|
|
50
47
|
//#endregion
|
|
51
|
-
export { u as
|
|
48
|
+
export { u as useReceivableDetails };
|