@tesouro/embedded-components-react 0.5.211 → 0.5.213
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.d.ts +16 -0
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +16 -0
- package/dist/lib/ReceivablesWidget.js +1 -1
- 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/index10.js +113 -109
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +416 -132
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +113 -211
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +154 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +193 -135
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +32 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +150 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +35 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +58 -116
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +96 -47
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +103 -347
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +364 -64
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +66 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +105 -275
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +288 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +76 -61
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +48 -422
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +38 -62
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +61 -391
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +457 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +91 -234
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +234 -78
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +80 -331
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -1,433 +1,59 @@
|
|
|
1
1
|
import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
2
|
-
import {
|
|
3
|
-
import { createLineItem as n, isBlankLineItem as r, lineItemToCreatePayload as i, lineItemToUpdatePayload as a, responseLineItemToFormValues as o, summarizeLineItemErrors as s, taxRateFromLineItems as c, validateLineItems as l } from "./index6.js";
|
|
4
|
-
import { attachmentFormValuesToPayload as u, receivableToAttachmentFormValues as d } from "./index7.js";
|
|
5
|
-
import { buildPaymentTermsPayload as f, buildPaymentTermsUpdatePayload as p, paymentTermsToFormFields as m } from "./index8.js";
|
|
2
|
+
import { escapeRegex as t, getNumberSeparators as n, parseLocaleDecimal as r } from "./index6.js";
|
|
6
3
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
overdueReminderId: "",
|
|
36
|
-
attachments: []
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function v(e) {
|
|
40
|
-
return e === "quotes" ? "quote" : e === "credit_notes" ? "credit_note" : "invoice";
|
|
41
|
-
}
|
|
42
|
-
function y(e) {
|
|
43
|
-
return e === "quote" ? "quotes" : e === "credit_note" ? "credit_notes" : "invoices";
|
|
44
|
-
}
|
|
45
|
-
function b(e) {
|
|
46
|
-
return (e?.length ? e : [
|
|
47
|
-
"invoices",
|
|
48
|
-
"quotes",
|
|
49
|
-
"credit_notes"
|
|
50
|
-
]).filter((e, t, n) => [
|
|
51
|
-
"invoices",
|
|
52
|
-
"quotes",
|
|
53
|
-
"credit_notes"
|
|
54
|
-
].includes(e) && n.indexOf(e) === t);
|
|
55
|
-
}
|
|
56
|
-
function x({ defaultTab: e, enabledTabs: t }) {
|
|
57
|
-
return e && t.includes(e) ? e : t[0] ?? "invoices";
|
|
58
|
-
}
|
|
59
|
-
function S(e, n) {
|
|
60
|
-
let r = t(e);
|
|
61
|
-
return r ? new Intl.DateTimeFormat(void 0, {
|
|
62
|
-
day: "numeric",
|
|
63
|
-
month: "short",
|
|
64
|
-
year: "numeric"
|
|
65
|
-
}).format(r) : n;
|
|
66
|
-
}
|
|
67
|
-
function C({ amount: t, currency: n, fallback: r }) {
|
|
68
|
-
return t == null || !n ? r : new Intl.NumberFormat(void 0, {
|
|
4
|
+
function i(t, n) {
|
|
5
|
+
return t === "percentage" ? 2 : e(n);
|
|
6
|
+
}
|
|
7
|
+
function a(e, r, a, o = n()) {
|
|
8
|
+
let s = `0-9${t(o.digits.join(""))}${t(o.decimal)}${o.group ? t(o.group) : ""}`, c = e.replace(RegExp(`[^${s}]`, "gu"), ""), l = c.indexOf(o.decimal);
|
|
9
|
+
return l === -1 ? c : c.slice(0, l + o.decimal.length) + Array.from(c.slice(l + o.decimal.length).split(o.decimal).join("")).slice(0, i(r, a)).join("");
|
|
10
|
+
}
|
|
11
|
+
function o(e, t, a, o = n()) {
|
|
12
|
+
return Math.round(r(e, o) * 10 ** i(t, a));
|
|
13
|
+
}
|
|
14
|
+
function s(e, t, n) {
|
|
15
|
+
let r = i(t, n);
|
|
16
|
+
return new Intl.NumberFormat(void 0, {
|
|
17
|
+
minimumFractionDigits: r,
|
|
18
|
+
maximumFractionDigits: r
|
|
19
|
+
}).format(e / 10 ** r);
|
|
20
|
+
}
|
|
21
|
+
function c(e, t, n) {
|
|
22
|
+
let r = i(t, n), a = {
|
|
23
|
+
minimumFractionDigits: r,
|
|
24
|
+
maximumFractionDigits: r
|
|
25
|
+
};
|
|
26
|
+
return t === "percentage" ? new Intl.NumberFormat(void 0, {
|
|
27
|
+
...a,
|
|
28
|
+
style: "percent"
|
|
29
|
+
}).format(e / 10 ** (r + 2)) : new Intl.NumberFormat(void 0, {
|
|
30
|
+
...a,
|
|
31
|
+
style: "currency",
|
|
69
32
|
currency: n,
|
|
70
|
-
|
|
71
|
-
}).format(
|
|
72
|
-
}
|
|
73
|
-
function w(t, n) {
|
|
74
|
-
let r = Number(t);
|
|
75
|
-
if (!Number.isFinite(r)) return;
|
|
76
|
-
let i = n ? e(n) : 2;
|
|
77
|
-
return Math.round(r * 10 ** i);
|
|
33
|
+
currencyDisplay: "narrowSymbol"
|
|
34
|
+
}).format(e / 10 ** r);
|
|
78
35
|
}
|
|
79
|
-
function
|
|
80
|
-
return e
|
|
36
|
+
function l({ value: e, type: t, currency: n }) {
|
|
37
|
+
return s(o(e, t, n), t, n);
|
|
81
38
|
}
|
|
82
|
-
function
|
|
83
|
-
return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
|
|
84
|
-
}
|
|
85
|
-
function D(e) {
|
|
86
|
-
return e === "paid" || e === "accepted" || e === "issued" || e === "recurring" ? "success" : e === "draft" || e === "issuing" ? "neutral" : e === "overdue" || e === "partially_paid" ? "warning" : e === "failed" || e === "declined" || e === "expired" || e === "uncollectible" || e === "canceled" || e === "deleted" ? "danger" : "info";
|
|
87
|
-
}
|
|
88
|
-
function O(e) {
|
|
89
|
-
let t = e.status === "draft", n = e.status === "issued", r = e.type === "invoice", i = e.type === "quote", a = e.type === "credit_note", o = r && [
|
|
90
|
-
"issued",
|
|
91
|
-
"overdue",
|
|
92
|
-
"partially_paid"
|
|
93
|
-
].includes(e.status);
|
|
39
|
+
function u(e) {
|
|
94
40
|
return {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
cancel: ![
|
|
98
|
-
"paid",
|
|
99
|
-
"canceled",
|
|
100
|
-
"deleted",
|
|
101
|
-
"uncollectible"
|
|
102
|
-
].includes(e.status) && !t,
|
|
103
|
-
clone: !a && e.status !== "deleted",
|
|
104
|
-
decline: i && n,
|
|
105
|
-
delete: t,
|
|
106
|
-
issue: t,
|
|
107
|
-
markPaid: o,
|
|
108
|
-
markUncollectible: o,
|
|
109
|
-
recordPayment: o,
|
|
110
|
-
send: [
|
|
111
|
-
"issued",
|
|
112
|
-
"accepted",
|
|
113
|
-
"overdue",
|
|
114
|
-
"partially_paid"
|
|
115
|
-
].includes(e.status) && !a
|
|
41
|
+
discountType: "amount",
|
|
42
|
+
discount: s(0, "amount", e)
|
|
116
43
|
};
|
|
117
44
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
documentLabel: T(e, t),
|
|
125
|
-
customerLabel: e.counterpart_name || t.unknownCustomer,
|
|
126
|
-
status: e.status,
|
|
127
|
-
statusTone: D(e.status),
|
|
128
|
-
issueDateLabel: S(e.issue_date, t.notAvailable),
|
|
129
|
-
dueDateLabel: S(e.type === "quote" ? e.expiry_date : e.due_date, t.notAvailable),
|
|
130
|
-
totalLabel: C({
|
|
131
|
-
amount: e.total_amount,
|
|
132
|
-
currency: e.currency,
|
|
133
|
-
fallback: t.notAvailable
|
|
134
|
-
}),
|
|
135
|
-
amountDueLabel: C({
|
|
136
|
-
amount: n,
|
|
137
|
-
currency: e.currency,
|
|
138
|
-
fallback: t.notAvailable
|
|
139
|
-
}),
|
|
140
|
-
actions: O(e)
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function A({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
|
|
145
|
-
if (!e) return;
|
|
146
|
-
let a = e.type === "invoice" ? e.amount_due : void 0, o = e.type === "quote" ? e.expiry_date : e.due_date;
|
|
147
|
-
return {
|
|
148
|
-
id: e.id,
|
|
149
|
-
type: e.type,
|
|
150
|
-
title: T(e, i),
|
|
151
|
-
customerLabel: e.counterpart_name || i.unknownCustomer,
|
|
152
|
-
status: e.status,
|
|
153
|
-
statusTone: D(e.status),
|
|
154
|
-
totalLabel: C({
|
|
155
|
-
amount: e.total_amount,
|
|
156
|
-
currency: e.currency,
|
|
157
|
-
fallback: i.notAvailable
|
|
158
|
-
}),
|
|
159
|
-
amountDueLabel: C({
|
|
160
|
-
amount: a,
|
|
161
|
-
currency: e.currency,
|
|
162
|
-
fallback: i.notAvailable
|
|
163
|
-
}),
|
|
164
|
-
pdfUrl: r || e.file_url || e.original_file_url || void 0,
|
|
165
|
-
summaryItems: [
|
|
166
|
-
{
|
|
167
|
-
label: i.summaryDocumentType,
|
|
168
|
-
value: E(e.type, i)
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
label: i.summaryDocumentNumber,
|
|
172
|
-
value: T(e, i)
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
label: i.summaryCustomer,
|
|
176
|
-
value: e.counterpart_name || i.unknownCustomer
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
label: i.summaryIssued,
|
|
180
|
-
value: S(e.issue_date, i.notAvailable)
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
label: i.summaryDue,
|
|
184
|
-
value: S(o, i.notAvailable)
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
label: i.summaryCreated,
|
|
188
|
-
value: S(e.created_at, i.notAvailable)
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
label: i.summaryUpdated,
|
|
192
|
-
value: S(e.updated_at, i.notAvailable)
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
label: i.summaryTotal,
|
|
196
|
-
value: C({
|
|
197
|
-
amount: e.total_amount,
|
|
198
|
-
currency: e.currency,
|
|
199
|
-
fallback: i.notAvailable
|
|
200
|
-
})
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
label: i.summaryAmountDue,
|
|
204
|
-
value: C({
|
|
205
|
-
amount: a,
|
|
206
|
-
currency: e.currency,
|
|
207
|
-
fallback: i.notAvailable
|
|
208
|
-
})
|
|
209
|
-
}
|
|
210
|
-
],
|
|
211
|
-
lineItems: e.line_items.map((t, n) => ({
|
|
212
|
-
id: t.product.id || String(n),
|
|
213
|
-
name: t.product.name,
|
|
214
|
-
quantityLabel: String(t.quantity),
|
|
215
|
-
unitPriceLabel: C({
|
|
216
|
-
amount: t.product.price?.value,
|
|
217
|
-
currency: t.product.price?.currency || e.currency,
|
|
218
|
-
fallback: i.notAvailable
|
|
219
|
-
}),
|
|
220
|
-
totalLabel: C({
|
|
221
|
-
amount: t.total_after_tax ?? t.total_before_tax,
|
|
222
|
-
currency: e.currency,
|
|
223
|
-
fallback: i.notAvailable
|
|
224
|
-
})
|
|
225
|
-
})),
|
|
226
|
-
activityItems: t.map((e) => ({
|
|
227
|
-
id: e.id,
|
|
228
|
-
title: j(e.event_type, i),
|
|
229
|
-
description: e.event_type,
|
|
230
|
-
timestampLabel: S(e.timestamp, i.notAvailable)
|
|
231
|
-
})),
|
|
232
|
-
mailItems: n.map((e) => ({
|
|
233
|
-
id: e.id,
|
|
234
|
-
statusLabel: e.status,
|
|
235
|
-
recipientsLabel: M(e, i),
|
|
236
|
-
sentAtLabel: S(e.created_at, i.notAvailable)
|
|
237
|
-
})),
|
|
238
|
-
actions: O(e)
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function j(e, t) {
|
|
242
|
-
return e === "status_changed" ? t.activityStatusChanged : e === "receivable_created" ? t.activityReceivableCreated : e === "receivable_updated" ? t.activityReceivableUpdated : e === "payment_received" ? t.activityPaymentReceived : e === "mail_sent" ? t.activityMailSent : t.activityUnknown;
|
|
243
|
-
}
|
|
244
|
-
function M(e, t) {
|
|
245
|
-
let n = [
|
|
246
|
-
...e.recipients?.to ?? [],
|
|
247
|
-
...e.recipients?.cc ?? [],
|
|
248
|
-
...e.recipients?.bcc ?? []
|
|
249
|
-
].map((e) => e.email).filter(Boolean);
|
|
250
|
-
return n.length > 0 ? n.join(", ") : t.recipientsNone;
|
|
251
|
-
}
|
|
252
|
-
function N({ values: e, billingAddressId: t, messages: n }) {
|
|
253
|
-
let r = {};
|
|
254
|
-
e.customerId ? t || (r.customerId = n.customerAddressRequired) : r.customerId = n.customerRequired, e.currency || (r.currency = n.currencyRequired);
|
|
255
|
-
let i = l(e.lineItems, {
|
|
256
|
-
currency: e.currency,
|
|
257
|
-
messages: n
|
|
258
|
-
});
|
|
259
|
-
return i && (r.lineItems = i, r.lineItemsSummary = s(i)), r;
|
|
260
|
-
}
|
|
261
|
-
function P(e) {
|
|
262
|
-
return Object.keys(e).length > 0;
|
|
263
|
-
}
|
|
264
|
-
function F({ bankAccountId: e, bankAccountType: t }) {
|
|
265
|
-
return {
|
|
266
|
-
bank_account_id: e || void 0,
|
|
267
|
-
bank_account_type: e && t || void 0
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
function I({ values: e, billingAddressId: t, unitNamesById: n }) {
|
|
271
|
-
let a = e.lineItems.filter((e) => !r(e)).map((t) => i({
|
|
272
|
-
lineItem: t,
|
|
273
|
-
currency: e.currency,
|
|
274
|
-
taxRate: e.taxRate,
|
|
275
|
-
unitNamesById: n
|
|
276
|
-
})), o = {
|
|
277
|
-
counterpart_billing_address_id: t,
|
|
278
|
-
counterpart_id: e.customerId,
|
|
279
|
-
currency: e.currency,
|
|
280
|
-
line_items: a,
|
|
281
|
-
memo: e.openingNote,
|
|
282
|
-
footer: e.closingNote,
|
|
283
|
-
...F(e)
|
|
284
|
-
};
|
|
285
|
-
return e.type === "quote" ? {
|
|
286
|
-
...o,
|
|
287
|
-
expiry_date: e.dueDate || void 0,
|
|
288
|
-
type: "quote"
|
|
289
|
-
} : {
|
|
290
|
-
...o,
|
|
291
|
-
...f(e),
|
|
292
|
-
payment_reminder_id: e.paymentReminderId || void 0,
|
|
293
|
-
overdue_reminder_id: e.overdueReminderId || void 0,
|
|
294
|
-
attachments: u(e.attachments),
|
|
295
|
-
type: "invoice"
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
function L(e, t) {
|
|
299
|
-
let r = e.type === "quote" ? "quote" : "invoice", i = e.type === "invoice" ? e : void 0, a = e.line_items.map((n) => o({
|
|
300
|
-
lineItem: n,
|
|
301
|
-
currency: e.currency,
|
|
302
|
-
units: t
|
|
303
|
-
}));
|
|
304
|
-
return {
|
|
305
|
-
..._(),
|
|
306
|
-
type: r,
|
|
307
|
-
customerId: e.counterpart_id,
|
|
308
|
-
currency: e.currency,
|
|
309
|
-
issueDate: V(e.issue_date),
|
|
310
|
-
dueDate: e.type === "quote" ? V(e.expiry_date) : "",
|
|
311
|
-
openingNote: e.memo ?? "",
|
|
312
|
-
closingNote: e.footer ?? "",
|
|
313
|
-
...e.type === "invoice" ? m(e.payment_terms) : {},
|
|
314
|
-
taxRate: c(e.line_items),
|
|
315
|
-
lineItems: a.length > 0 ? a : [n(e.currency)],
|
|
316
|
-
bankAccountId: e.bank_account_id ?? "",
|
|
317
|
-
bankAccountType: R(e.bank_account_type),
|
|
318
|
-
paymentReminderId: i?.payment_reminder_id ?? "",
|
|
319
|
-
overdueReminderId: i?.overdue_reminder_id ?? "",
|
|
320
|
-
attachments: d(e)
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
function R(e) {
|
|
324
|
-
return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
|
|
325
|
-
}
|
|
326
|
-
function z({ values: e, billingAddressId: t, lineItemChanges: n }) {
|
|
327
|
-
let r = {
|
|
328
|
-
counterpart_billing_address_id: t,
|
|
329
|
-
counterpart_id: e.customerId,
|
|
330
|
-
currency: e.currency,
|
|
331
|
-
issue_date: e.issueDate || void 0,
|
|
332
|
-
memo: e.openingNote,
|
|
333
|
-
footer: e.closingNote,
|
|
334
|
-
...F(e)
|
|
335
|
-
};
|
|
336
|
-
return e.type === "quote" ? { quote: {
|
|
337
|
-
...r,
|
|
338
|
-
...n ? { line_items: n } : {},
|
|
339
|
-
expiry_date: e.dueDate || void 0,
|
|
340
|
-
...p(e)
|
|
341
|
-
} } : { invoice: {
|
|
342
|
-
...r,
|
|
343
|
-
...n ? { line_items: n } : {},
|
|
344
|
-
...p(e),
|
|
345
|
-
payment_reminder_id: e.paymentReminderId || null,
|
|
346
|
-
overdue_reminder_id: e.overdueReminderId || null,
|
|
347
|
-
attachments: u(e.attachments) ?? null
|
|
348
|
-
} };
|
|
349
|
-
}
|
|
350
|
-
function B({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: i, units: s }) {
|
|
351
|
-
let l = (e, t, n) => a({
|
|
352
|
-
lineItem: e,
|
|
353
|
-
currency: t,
|
|
354
|
-
taxRate: n,
|
|
355
|
-
unitNamesById: i
|
|
356
|
-
}), u = c(t), d = new Map(t.map((e) => [e.id, JSON.stringify(l(o({
|
|
357
|
-
lineItem: e,
|
|
358
|
-
currency: n,
|
|
359
|
-
units: s
|
|
360
|
-
}), n, u))])), f = e.lineItems.filter((e) => !r(e)), p = new Set(f.map((e) => e.id)), m = f.filter((e) => !d.has(e.id)).map((t) => l(t, e.currency, e.taxRate)), h = f.flatMap((t) => {
|
|
361
|
-
let n = d.get(t.id);
|
|
362
|
-
if (n === void 0) return [];
|
|
363
|
-
let r = l(t, e.currency, e.taxRate);
|
|
364
|
-
return n === JSON.stringify(r) ? [] : [{
|
|
365
|
-
id: t.id,
|
|
366
|
-
data: r
|
|
367
|
-
}];
|
|
368
|
-
}), g = t.filter((e) => !p.has(e.id)).map((e) => e.id);
|
|
369
|
-
if (m.length || h.length || g.length) return {
|
|
370
|
-
...m.length ? { add: m } : {},
|
|
371
|
-
...h.length ? { replace: h } : {},
|
|
372
|
-
...g.length ? { remove: g } : {}
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
function V(e) {
|
|
376
|
-
return e?.slice(0, 10) ?? "";
|
|
377
|
-
}
|
|
378
|
-
function H(e, t) {
|
|
379
|
-
let n = {};
|
|
380
|
-
return e.to.trim() || (n.to = t.sendToRequired), e.subject.trim() || (n.subject = t.sendSubjectRequired), e.body.trim() || (n.body = t.sendBodyRequired), n;
|
|
381
|
-
}
|
|
382
|
-
function U(e) {
|
|
383
|
-
return Object.keys(e).length > 0;
|
|
384
|
-
}
|
|
385
|
-
function W(e) {
|
|
386
|
-
return e.split(",").map((e) => e.trim()).filter(Boolean);
|
|
387
|
-
}
|
|
388
|
-
function G(e, t, n) {
|
|
389
|
-
let r = {};
|
|
390
|
-
if (e.mode === "partial") {
|
|
391
|
-
let i = w(e.amountPaid, n);
|
|
392
|
-
(!i || i <= 0) && (r.amountPaid = t.paymentAmountInvalid);
|
|
393
|
-
}
|
|
394
|
-
return r;
|
|
395
|
-
}
|
|
396
|
-
function K(e) {
|
|
397
|
-
return Object.keys(e).length > 0;
|
|
398
|
-
}
|
|
399
|
-
function q(e, t) {
|
|
400
|
-
return {
|
|
401
|
-
...h,
|
|
402
|
-
to: e?.counterpart_contact?.email ?? "",
|
|
403
|
-
subject: e?.document_id ? `${t.sendSubjectDefault} ${e.document_id}` : t.sendSubjectDefault,
|
|
404
|
-
body: t.sendBodyDefault
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
function J() {
|
|
408
|
-
return {
|
|
409
|
-
...g,
|
|
410
|
-
paidAt: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
|
|
411
|
-
};
|
|
45
|
+
function d(e) {
|
|
46
|
+
let t = o(e.discount, e.discountType, e.currency);
|
|
47
|
+
return t > 0 ? {
|
|
48
|
+
type: e.discountType,
|
|
49
|
+
amount: t
|
|
50
|
+
} : null;
|
|
412
51
|
}
|
|
413
|
-
function
|
|
414
|
-
return
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
"accepted",
|
|
419
|
-
"expired",
|
|
420
|
-
"declined",
|
|
421
|
-
"recurring",
|
|
422
|
-
"partially_paid",
|
|
423
|
-
"paid",
|
|
424
|
-
"overdue",
|
|
425
|
-
"uncollectible",
|
|
426
|
-
"canceled"
|
|
427
|
-
].map((e) => ({
|
|
428
|
-
value: e,
|
|
429
|
-
label: e.split("_").map((e) => `${e.slice(0, 1).toUpperCase()}${e.slice(1)}`).join(" ")
|
|
430
|
-
}));
|
|
52
|
+
function f(e, t) {
|
|
53
|
+
return e ? {
|
|
54
|
+
discountType: e.type,
|
|
55
|
+
discount: s(e.amount, e.type, t)
|
|
56
|
+
} : u(t);
|
|
431
57
|
}
|
|
432
58
|
//#endregion
|
|
433
|
-
export {
|
|
59
|
+
export { l as convertDiscountInput, u as createEmptyDiscount, c as decorateDiscountInput, d as discountFromDraft, o as discountInputToMinorUnits, f as discountToDraft, s as formatDiscountInput, a as sanitizeDiscountInput };
|
|
@@ -10,9 +10,9 @@ import "./index12.js";
|
|
|
10
10
|
import "./index19.js";
|
|
11
11
|
import "./index20.js";
|
|
12
12
|
import { ReceivableDetailsSheet as o } from "./index21.js";
|
|
13
|
-
import { ReceivableFormSheet as s } from "./
|
|
14
|
-
import { ReceivablePaymentDialog as c } from "./
|
|
15
|
-
import { ReceivableRemindersSection as l } from "./
|
|
16
|
-
import { ReceivableSendDialog as u } from "./
|
|
17
|
-
import { ReceivablesScreen as d } from "./
|
|
13
|
+
import { ReceivableFormSheet as s } from "./index24.js";
|
|
14
|
+
import { ReceivablePaymentDialog as c } from "./index25.js";
|
|
15
|
+
import { ReceivableRemindersSection as l } from "./index26.js";
|
|
16
|
+
import { ReceivableSendDialog as u } from "./index27.js";
|
|
17
|
+
import { ReceivablesScreen as d } from "./index28.js";
|
|
18
18
|
export { r as RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE, i as RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE, e as ReceivableActionDialog, n as ReceivableAttachmentsSection, t as ReceivableBankAccountSection, a as ReceivableBillingSection, o as ReceivableDetailsSheet, s as ReceivableFormSheet, c as ReceivablePaymentDialog, l as ReceivableRemindersSection, u as ReceivableSendDialog, d as ReceivablesScreen };
|
|
@@ -1,72 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx as
|
|
1
|
+
import { cn as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js
|
|
4
|
-
function
|
|
5
|
-
return /* @__PURE__ */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
children: [p, /* @__PURE__ */ s(o, {
|
|
10
|
-
variant: "body2",
|
|
11
|
-
component: "span",
|
|
12
|
-
color: "muted",
|
|
13
|
-
className: "ttw:leading-snug",
|
|
14
|
-
children: m
|
|
15
|
-
})]
|
|
16
|
-
}),
|
|
17
|
-
/* @__PURE__ */ s(a, {
|
|
18
|
-
id: l,
|
|
19
|
-
value: u,
|
|
20
|
-
disabled: f,
|
|
21
|
-
placeholder: h,
|
|
22
|
-
className: "ttw:h-26 ttw:resize-none",
|
|
23
|
-
"aria-invalid": !!d,
|
|
24
|
-
onChange: (e) => _(e.target.value)
|
|
25
|
-
}),
|
|
26
|
-
/* @__PURE__ */ s(n, { children: g }),
|
|
27
|
-
/* @__PURE__ */ s(r, { errors: d ? [{ message: d }] : [] })
|
|
28
|
-
] }) });
|
|
4
|
+
function r({ label: r, value: i, className: a }) {
|
|
5
|
+
return /* @__PURE__ */ n("li", {
|
|
6
|
+
className: e("ttw:flex ttw:items-center ttw:justify-between", a),
|
|
7
|
+
children: [/* @__PURE__ */ t("span", { children: r }), /* @__PURE__ */ t("span", { children: i })]
|
|
8
|
+
});
|
|
29
9
|
}
|
|
30
|
-
function
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
className: "ttw:flex ttw:
|
|
10
|
+
function i({ totals: e, labels: i }) {
|
|
11
|
+
return /* @__PURE__ */ n("ul", {
|
|
12
|
+
className: "ttw:flex ttw:w-full ttw:list-none ttw:flex-col ttw:gap-1.5",
|
|
33
13
|
children: [
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
14
|
+
/* @__PURE__ */ t(r, {
|
|
15
|
+
label: i.subtotalLabel,
|
|
16
|
+
value: e.subtotal,
|
|
17
|
+
className: "ttw:text-sm ttw:font-normal"
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ t(r, {
|
|
20
|
+
label: i.discountTotalLabel,
|
|
21
|
+
value: e.discount,
|
|
22
|
+
className: "ttw:text-sm ttw:font-normal"
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ t(r, {
|
|
25
|
+
label: i.nonTaxableSubtotalLabel,
|
|
26
|
+
value: e.nonTaxableSubtotal,
|
|
27
|
+
className: "ttw:text-sm ttw:font-normal ttw:text-muted-foreground"
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ t(r, {
|
|
30
|
+
label: i.taxableSubtotalLabel,
|
|
31
|
+
value: e.taxableSubtotal,
|
|
32
|
+
className: "ttw:text-sm ttw:font-normal ttw:text-muted-foreground"
|
|
45
33
|
}),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
value:
|
|
49
|
-
|
|
50
|
-
disabled: a,
|
|
51
|
-
label: f.openingNoteLabel,
|
|
52
|
-
optionalSuffix: f.optionalSuffix,
|
|
53
|
-
placeholder: f.openingNotePlaceholder,
|
|
54
|
-
description: f.openingNoteDescription,
|
|
55
|
-
onChange: u
|
|
34
|
+
/* @__PURE__ */ t(r, {
|
|
35
|
+
label: i.taxTotalLabel,
|
|
36
|
+
value: e.tax,
|
|
37
|
+
className: "ttw:text-sm ttw:font-normal"
|
|
56
38
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
value:
|
|
60
|
-
|
|
61
|
-
disabled: a,
|
|
62
|
-
label: f.closingNoteLabel,
|
|
63
|
-
optionalSuffix: f.optionalSuffix,
|
|
64
|
-
placeholder: f.closingNotePlaceholder,
|
|
65
|
-
description: f.closingNoteDescription,
|
|
66
|
-
onChange: d
|
|
39
|
+
/* @__PURE__ */ t(r, {
|
|
40
|
+
label: i.totalLabel,
|
|
41
|
+
value: e.total,
|
|
42
|
+
className: "ttw:text-lg ttw:font-medium"
|
|
67
43
|
})
|
|
68
44
|
]
|
|
69
45
|
});
|
|
70
46
|
}
|
|
71
47
|
//#endregion
|
|
72
|
-
export {
|
|
48
|
+
export { i as ReceivableFormTotals };
|