@tesouro/embedded-components-react 0.5.204 → 0.5.206
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 +15 -14
- package/dist/index.d.ts +49 -4
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +49 -4
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +26 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +79 -2
- 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 +88 -193
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +184 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +32 -145
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +150 -47
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +37 -293
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +58 -70
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +86 -99
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +48 -233
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +336 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +270 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +95 -394
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +422 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +15 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +94 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +24 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +3 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +3 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +16 -421
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +1 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +4 -93
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +11 -343
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +5 -159
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +264 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +72 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +401 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +106 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +182 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +27 -154
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +203 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +161 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +16 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +25 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +3 -17
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +38 -38
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +213 -202
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +136 -116
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +1763 -1749
- package/package.json +1 -1
|
@@ -1,75 +1,425 @@
|
|
|
1
|
+
import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
2
|
+
import { parseDateOrTimestamp as t } from "../../../shared/util/dist/lib/parseCalendarDate.js";
|
|
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";
|
|
1
6
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
lineItemsLoading: "Please wait for invoice details to finish loading.",
|
|
14
|
-
untitledDocument: "Untitled document",
|
|
15
|
-
unknownCustomer: "Unknown customer",
|
|
16
|
-
notAvailable: "Not available",
|
|
17
|
-
invoiceType: "Invoice",
|
|
18
|
-
quoteType: "Quote",
|
|
19
|
-
creditNoteType: "Credit note",
|
|
20
|
-
summaryDocumentType: "Document type",
|
|
21
|
-
summaryDocumentNumber: "Document number",
|
|
22
|
-
summaryCustomer: "Customer",
|
|
23
|
-
summaryIssued: "Issued",
|
|
24
|
-
summaryDue: "Due",
|
|
25
|
-
summaryCreated: "Created",
|
|
26
|
-
summaryUpdated: "Updated",
|
|
27
|
-
summaryTotal: "Total",
|
|
28
|
-
summaryAmountDue: "Amount due",
|
|
29
|
-
activityStatusChanged: "Status changed",
|
|
30
|
-
activityReceivableCreated: "Receivable created",
|
|
31
|
-
activityReceivableUpdated: "Receivable updated",
|
|
32
|
-
activityPaymentReceived: "Payment received",
|
|
33
|
-
activityMailSent: "Email sent",
|
|
34
|
-
activityUnknown: "Activity",
|
|
35
|
-
recipientsNone: "No recipients",
|
|
36
|
-
sendSubjectDefault: "Your receivable document",
|
|
37
|
-
sendBodyDefault: "Please find the receivable document attached.",
|
|
38
|
-
issueTitle: "Issue receivable?",
|
|
39
|
-
issueDescription: "Issuing locks the document and makes it ready to send to the customer.",
|
|
40
|
-
issueConfirm: "Issue",
|
|
41
|
-
acceptTitle: "Accept quote?",
|
|
42
|
-
acceptDescription: "This marks the quote as accepted.",
|
|
43
|
-
acceptConfirm: "Accept",
|
|
44
|
-
declineTitle: "Decline quote?",
|
|
45
|
-
declineDescription: "This marks the quote as declined.",
|
|
46
|
-
declineConfirm: "Decline",
|
|
47
|
-
cancelTitle: "Cancel receivable?",
|
|
48
|
-
cancelDescription: "This cancels the document. You cannot undo this action.",
|
|
49
|
-
cancelConfirm: "Cancel document",
|
|
50
|
-
cloneTitle: "Clone receivable?",
|
|
51
|
-
cloneDescription: "This creates a new draft based on the selected document.",
|
|
52
|
-
cloneConfirm: "Clone",
|
|
53
|
-
deleteTitle: "Delete draft?",
|
|
54
|
-
deleteDescription: "This permanently deletes the draft document. You cannot undo this action.",
|
|
55
|
-
deleteConfirm: "Delete",
|
|
56
|
-
markPaidTitle: "Mark invoice as paid?",
|
|
57
|
-
markPaidDescription: "This records the invoice as fully paid.",
|
|
58
|
-
markPaidConfirm: "Mark paid",
|
|
59
|
-
markUncollectibleTitle: "Mark invoice uncollectible?",
|
|
60
|
-
markUncollectibleDescription: "This records the invoice as uncollectible. You cannot undo this action.",
|
|
61
|
-
markUncollectibleConfirm: "Mark uncollectible",
|
|
62
|
-
attachmentsEmailCaption: "Selected files will be attached to the invoice email sent to the customer.",
|
|
63
|
-
attachmentsRecurringEmailCaption: "Selected files will be attached to every invoice email in the recurring series.",
|
|
64
|
-
attachmentIncludeInEmail: "Include in email:",
|
|
65
|
-
attachmentRemove: "Remove",
|
|
66
|
-
attachmentUploading: "Uploading…",
|
|
67
|
-
attachmentUploadFailed: "Upload failed. Please try again.",
|
|
68
|
-
attachmentTooLarge: "File too large (max 3 MB)",
|
|
69
|
-
attachmentUnsupportedType: "File type not supported. Use PDF, DOC, JPG or PNG",
|
|
70
|
-
attachmentsCountLimit: "You can attach up to 10 files.",
|
|
71
|
-
attachmentIncludedInEmail: "Included in email",
|
|
72
|
-
attachmentNotIncludedInEmail: "Not included in email"
|
|
7
|
+
var h = {
|
|
8
|
+
to: "",
|
|
9
|
+
cc: "",
|
|
10
|
+
bcc: "",
|
|
11
|
+
subject: "",
|
|
12
|
+
body: ""
|
|
13
|
+
}, g = {
|
|
14
|
+
mode: "full",
|
|
15
|
+
amountPaid: "",
|
|
16
|
+
paidAt: "",
|
|
17
|
+
comment: ""
|
|
73
18
|
};
|
|
19
|
+
function _() {
|
|
20
|
+
return {
|
|
21
|
+
type: "invoice",
|
|
22
|
+
customerId: "",
|
|
23
|
+
currency: "USD",
|
|
24
|
+
issueDate: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
25
|
+
dueDate: "",
|
|
26
|
+
openingNote: "",
|
|
27
|
+
closingNote: "",
|
|
28
|
+
paymentTermsId: "",
|
|
29
|
+
paymentTermsCustomDate: "",
|
|
30
|
+
taxRate: "",
|
|
31
|
+
lineItems: [n()],
|
|
32
|
+
bankAccountId: "",
|
|
33
|
+
bankAccountType: "",
|
|
34
|
+
attachments: []
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function v(e) {
|
|
38
|
+
return e === "quotes" ? "quote" : e === "credit_notes" ? "credit_note" : "invoice";
|
|
39
|
+
}
|
|
40
|
+
function y(e) {
|
|
41
|
+
return e === "quote" ? "quotes" : e === "credit_note" ? "credit_notes" : "invoices";
|
|
42
|
+
}
|
|
43
|
+
function b(e) {
|
|
44
|
+
return (e?.length ? e : [
|
|
45
|
+
"invoices",
|
|
46
|
+
"quotes",
|
|
47
|
+
"credit_notes"
|
|
48
|
+
]).filter((e, t, n) => [
|
|
49
|
+
"invoices",
|
|
50
|
+
"quotes",
|
|
51
|
+
"credit_notes"
|
|
52
|
+
].includes(e) && n.indexOf(e) === t);
|
|
53
|
+
}
|
|
54
|
+
function x({ defaultTab: e, enabledTabs: t }) {
|
|
55
|
+
return e && t.includes(e) ? e : t[0] ?? "invoices";
|
|
56
|
+
}
|
|
57
|
+
function S(e, n) {
|
|
58
|
+
let r = t(e);
|
|
59
|
+
return r ? new Intl.DateTimeFormat(void 0, {
|
|
60
|
+
day: "numeric",
|
|
61
|
+
month: "short",
|
|
62
|
+
year: "numeric"
|
|
63
|
+
}).format(r) : n;
|
|
64
|
+
}
|
|
65
|
+
function C({ amount: t, currency: n, fallback: r }) {
|
|
66
|
+
return t == null || !n ? r : new Intl.NumberFormat(void 0, {
|
|
67
|
+
currency: n,
|
|
68
|
+
style: "currency"
|
|
69
|
+
}).format(t / 10 ** e(n));
|
|
70
|
+
}
|
|
71
|
+
function w(t, n) {
|
|
72
|
+
let r = Number(t);
|
|
73
|
+
if (!Number.isFinite(r)) return;
|
|
74
|
+
let i = n ? e(n) : 2;
|
|
75
|
+
return Math.round(r * 10 ** i);
|
|
76
|
+
}
|
|
77
|
+
function T(e, t) {
|
|
78
|
+
return e.document_id || t.untitledDocument;
|
|
79
|
+
}
|
|
80
|
+
function E(e, t) {
|
|
81
|
+
return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
|
|
82
|
+
}
|
|
83
|
+
function D(e) {
|
|
84
|
+
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";
|
|
85
|
+
}
|
|
86
|
+
function O(e) {
|
|
87
|
+
let t = e.status === "draft", n = e.status === "issued", r = e.type === "invoice", i = e.type === "quote", a = e.type === "credit_note", o = r && [
|
|
88
|
+
"issued",
|
|
89
|
+
"overdue",
|
|
90
|
+
"partially_paid"
|
|
91
|
+
].includes(e.status);
|
|
92
|
+
return {
|
|
93
|
+
edit: t && !a,
|
|
94
|
+
accept: i && n,
|
|
95
|
+
cancel: ![
|
|
96
|
+
"paid",
|
|
97
|
+
"canceled",
|
|
98
|
+
"deleted",
|
|
99
|
+
"uncollectible"
|
|
100
|
+
].includes(e.status) && !t,
|
|
101
|
+
clone: !a && e.status !== "deleted",
|
|
102
|
+
decline: i && n,
|
|
103
|
+
delete: t,
|
|
104
|
+
issue: t,
|
|
105
|
+
markPaid: o,
|
|
106
|
+
markUncollectible: o,
|
|
107
|
+
recordPayment: o,
|
|
108
|
+
send: [
|
|
109
|
+
"issued",
|
|
110
|
+
"accepted",
|
|
111
|
+
"overdue",
|
|
112
|
+
"partially_paid"
|
|
113
|
+
].includes(e.status) && !a
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function k({ receivables: e, messages: t }) {
|
|
117
|
+
return e.map((e) => {
|
|
118
|
+
let n = e.type === "invoice" ? e.amount_due : void 0;
|
|
119
|
+
return {
|
|
120
|
+
id: e.id,
|
|
121
|
+
type: e.type,
|
|
122
|
+
documentLabel: T(e, t),
|
|
123
|
+
customerLabel: e.counterpart_name || t.unknownCustomer,
|
|
124
|
+
status: e.status,
|
|
125
|
+
statusTone: D(e.status),
|
|
126
|
+
issueDateLabel: S(e.issue_date, t.notAvailable),
|
|
127
|
+
dueDateLabel: S(e.type === "quote" ? e.expiry_date : e.due_date, t.notAvailable),
|
|
128
|
+
totalLabel: C({
|
|
129
|
+
amount: e.total_amount,
|
|
130
|
+
currency: e.currency,
|
|
131
|
+
fallback: t.notAvailable
|
|
132
|
+
}),
|
|
133
|
+
amountDueLabel: C({
|
|
134
|
+
amount: n,
|
|
135
|
+
currency: e.currency,
|
|
136
|
+
fallback: t.notAvailable
|
|
137
|
+
}),
|
|
138
|
+
actions: O(e)
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function A({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
|
|
143
|
+
if (!e) return;
|
|
144
|
+
let a = e.type === "invoice" ? e.amount_due : void 0, o = e.type === "quote" ? e.expiry_date : e.due_date;
|
|
145
|
+
return {
|
|
146
|
+
id: e.id,
|
|
147
|
+
type: e.type,
|
|
148
|
+
title: T(e, i),
|
|
149
|
+
customerLabel: e.counterpart_name || i.unknownCustomer,
|
|
150
|
+
status: e.status,
|
|
151
|
+
statusTone: D(e.status),
|
|
152
|
+
totalLabel: C({
|
|
153
|
+
amount: e.total_amount,
|
|
154
|
+
currency: e.currency,
|
|
155
|
+
fallback: i.notAvailable
|
|
156
|
+
}),
|
|
157
|
+
amountDueLabel: C({
|
|
158
|
+
amount: a,
|
|
159
|
+
currency: e.currency,
|
|
160
|
+
fallback: i.notAvailable
|
|
161
|
+
}),
|
|
162
|
+
pdfUrl: r || e.file_url || e.original_file_url || void 0,
|
|
163
|
+
summaryItems: [
|
|
164
|
+
{
|
|
165
|
+
label: i.summaryDocumentType,
|
|
166
|
+
value: E(e.type, i)
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: i.summaryDocumentNumber,
|
|
170
|
+
value: T(e, i)
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: i.summaryCustomer,
|
|
174
|
+
value: e.counterpart_name || i.unknownCustomer
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
label: i.summaryIssued,
|
|
178
|
+
value: S(e.issue_date, i.notAvailable)
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
label: i.summaryDue,
|
|
182
|
+
value: S(o, i.notAvailable)
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
label: i.summaryCreated,
|
|
186
|
+
value: S(e.created_at, i.notAvailable)
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
label: i.summaryUpdated,
|
|
190
|
+
value: S(e.updated_at, i.notAvailable)
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
label: i.summaryTotal,
|
|
194
|
+
value: C({
|
|
195
|
+
amount: e.total_amount,
|
|
196
|
+
currency: e.currency,
|
|
197
|
+
fallback: i.notAvailable
|
|
198
|
+
})
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
label: i.summaryAmountDue,
|
|
202
|
+
value: C({
|
|
203
|
+
amount: a,
|
|
204
|
+
currency: e.currency,
|
|
205
|
+
fallback: i.notAvailable
|
|
206
|
+
})
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
lineItems: e.line_items.map((t, n) => ({
|
|
210
|
+
id: t.product.id || String(n),
|
|
211
|
+
name: t.product.name,
|
|
212
|
+
quantityLabel: String(t.quantity),
|
|
213
|
+
unitPriceLabel: C({
|
|
214
|
+
amount: t.product.price?.value,
|
|
215
|
+
currency: t.product.price?.currency || e.currency,
|
|
216
|
+
fallback: i.notAvailable
|
|
217
|
+
}),
|
|
218
|
+
totalLabel: C({
|
|
219
|
+
amount: t.total_after_tax ?? t.total_before_tax,
|
|
220
|
+
currency: e.currency,
|
|
221
|
+
fallback: i.notAvailable
|
|
222
|
+
})
|
|
223
|
+
})),
|
|
224
|
+
activityItems: t.map((e) => ({
|
|
225
|
+
id: e.id,
|
|
226
|
+
title: j(e.event_type, i),
|
|
227
|
+
description: e.event_type,
|
|
228
|
+
timestampLabel: S(e.timestamp, i.notAvailable)
|
|
229
|
+
})),
|
|
230
|
+
mailItems: n.map((e) => ({
|
|
231
|
+
id: e.id,
|
|
232
|
+
statusLabel: e.status,
|
|
233
|
+
recipientsLabel: M(e, i),
|
|
234
|
+
sentAtLabel: S(e.created_at, i.notAvailable)
|
|
235
|
+
})),
|
|
236
|
+
actions: O(e)
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function j(e, t) {
|
|
240
|
+
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;
|
|
241
|
+
}
|
|
242
|
+
function M(e, t) {
|
|
243
|
+
let n = [
|
|
244
|
+
...e.recipients?.to ?? [],
|
|
245
|
+
...e.recipients?.cc ?? [],
|
|
246
|
+
...e.recipients?.bcc ?? []
|
|
247
|
+
].map((e) => e.email).filter(Boolean);
|
|
248
|
+
return n.length > 0 ? n.join(", ") : t.recipientsNone;
|
|
249
|
+
}
|
|
250
|
+
function N({ values: e, billingAddressId: t, messages: n }) {
|
|
251
|
+
let r = {};
|
|
252
|
+
e.customerId ? t || (r.customerId = n.customerAddressRequired) : r.customerId = n.customerRequired, e.currency || (r.currency = n.currencyRequired);
|
|
253
|
+
let i = l(e.lineItems, {
|
|
254
|
+
currency: e.currency,
|
|
255
|
+
messages: n
|
|
256
|
+
});
|
|
257
|
+
return i && (r.lineItems = i, r.lineItemsSummary = s(i)), r;
|
|
258
|
+
}
|
|
259
|
+
function P(e) {
|
|
260
|
+
return Object.keys(e).length > 0;
|
|
261
|
+
}
|
|
262
|
+
function F({ bankAccountId: e, bankAccountType: t }) {
|
|
263
|
+
return {
|
|
264
|
+
bank_account_id: e || void 0,
|
|
265
|
+
bank_account_type: e && t || void 0
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function I({ values: e, billingAddressId: t, unitNamesById: n }) {
|
|
269
|
+
let a = e.lineItems.filter((e) => !r(e)).map((t) => i({
|
|
270
|
+
lineItem: t,
|
|
271
|
+
currency: e.currency,
|
|
272
|
+
taxRate: e.taxRate,
|
|
273
|
+
unitNamesById: n
|
|
274
|
+
})), o = {
|
|
275
|
+
counterpart_billing_address_id: t,
|
|
276
|
+
counterpart_id: e.customerId,
|
|
277
|
+
currency: e.currency,
|
|
278
|
+
line_items: a,
|
|
279
|
+
memo: e.openingNote,
|
|
280
|
+
footer: e.closingNote,
|
|
281
|
+
...F(e)
|
|
282
|
+
};
|
|
283
|
+
return e.type === "quote" ? {
|
|
284
|
+
...o,
|
|
285
|
+
expiry_date: e.dueDate || void 0,
|
|
286
|
+
type: "quote"
|
|
287
|
+
} : {
|
|
288
|
+
...o,
|
|
289
|
+
...f(e),
|
|
290
|
+
attachments: u(e.attachments),
|
|
291
|
+
type: "invoice"
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function L(e, t) {
|
|
295
|
+
let r = e.type === "quote" ? "quote" : "invoice", i = e.line_items.map((n) => o({
|
|
296
|
+
lineItem: n,
|
|
297
|
+
currency: e.currency,
|
|
298
|
+
units: t
|
|
299
|
+
}));
|
|
300
|
+
return {
|
|
301
|
+
..._(),
|
|
302
|
+
type: r,
|
|
303
|
+
customerId: e.counterpart_id,
|
|
304
|
+
currency: e.currency,
|
|
305
|
+
issueDate: V(e.issue_date),
|
|
306
|
+
dueDate: e.type === "quote" ? V(e.expiry_date) : "",
|
|
307
|
+
openingNote: e.memo ?? "",
|
|
308
|
+
closingNote: e.footer ?? "",
|
|
309
|
+
...e.type === "invoice" ? m(e.payment_terms) : {},
|
|
310
|
+
taxRate: c(e.line_items),
|
|
311
|
+
lineItems: i.length > 0 ? i : [n(e.currency)],
|
|
312
|
+
bankAccountId: e.bank_account_id ?? "",
|
|
313
|
+
bankAccountType: R(e.bank_account_type),
|
|
314
|
+
attachments: d(e)
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function R(e) {
|
|
318
|
+
return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
|
|
319
|
+
}
|
|
320
|
+
function z({ values: e, billingAddressId: t, lineItemChanges: n }) {
|
|
321
|
+
let r = {
|
|
322
|
+
counterpart_billing_address_id: t,
|
|
323
|
+
counterpart_id: e.customerId,
|
|
324
|
+
currency: e.currency,
|
|
325
|
+
issue_date: e.issueDate || void 0,
|
|
326
|
+
memo: e.openingNote,
|
|
327
|
+
footer: e.closingNote,
|
|
328
|
+
...F(e)
|
|
329
|
+
};
|
|
330
|
+
return e.type === "quote" ? { quote: {
|
|
331
|
+
...r,
|
|
332
|
+
...n ? { line_items: n } : {},
|
|
333
|
+
expiry_date: e.dueDate || void 0,
|
|
334
|
+
...p(e)
|
|
335
|
+
} } : { invoice: {
|
|
336
|
+
...r,
|
|
337
|
+
...n ? { line_items: n } : {},
|
|
338
|
+
...p(e),
|
|
339
|
+
attachments: u(e.attachments) ?? null
|
|
340
|
+
} };
|
|
341
|
+
}
|
|
342
|
+
function B({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: i, units: s }) {
|
|
343
|
+
let l = (e, t, n) => a({
|
|
344
|
+
lineItem: e,
|
|
345
|
+
currency: t,
|
|
346
|
+
taxRate: n,
|
|
347
|
+
unitNamesById: i
|
|
348
|
+
}), u = c(t), d = new Map(t.map((e) => [e.id, JSON.stringify(l(o({
|
|
349
|
+
lineItem: e,
|
|
350
|
+
currency: n,
|
|
351
|
+
units: s
|
|
352
|
+
}), 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) => {
|
|
353
|
+
let n = d.get(t.id);
|
|
354
|
+
if (n === void 0) return [];
|
|
355
|
+
let r = l(t, e.currency, e.taxRate);
|
|
356
|
+
return n === JSON.stringify(r) ? [] : [{
|
|
357
|
+
id: t.id,
|
|
358
|
+
data: r
|
|
359
|
+
}];
|
|
360
|
+
}), g = t.filter((e) => !p.has(e.id)).map((e) => e.id);
|
|
361
|
+
if (m.length || h.length || g.length) return {
|
|
362
|
+
...m.length ? { add: m } : {},
|
|
363
|
+
...h.length ? { replace: h } : {},
|
|
364
|
+
...g.length ? { remove: g } : {}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function V(e) {
|
|
368
|
+
return e?.slice(0, 10) ?? "";
|
|
369
|
+
}
|
|
370
|
+
function H(e, t) {
|
|
371
|
+
let n = {};
|
|
372
|
+
return e.to.trim() || (n.to = t.sendToRequired), e.subject.trim() || (n.subject = t.sendSubjectRequired), e.body.trim() || (n.body = t.sendBodyRequired), n;
|
|
373
|
+
}
|
|
374
|
+
function U(e) {
|
|
375
|
+
return Object.keys(e).length > 0;
|
|
376
|
+
}
|
|
377
|
+
function W(e) {
|
|
378
|
+
return e.split(",").map((e) => e.trim()).filter(Boolean);
|
|
379
|
+
}
|
|
380
|
+
function G(e, t, n) {
|
|
381
|
+
let r = {};
|
|
382
|
+
if (e.mode === "partial") {
|
|
383
|
+
let i = w(e.amountPaid, n);
|
|
384
|
+
(!i || i <= 0) && (r.amountPaid = t.paymentAmountInvalid);
|
|
385
|
+
}
|
|
386
|
+
return r;
|
|
387
|
+
}
|
|
388
|
+
function K(e) {
|
|
389
|
+
return Object.keys(e).length > 0;
|
|
390
|
+
}
|
|
391
|
+
function q(e, t) {
|
|
392
|
+
return {
|
|
393
|
+
...h,
|
|
394
|
+
to: e?.counterpart_contact?.email ?? "",
|
|
395
|
+
subject: e?.document_id ? `${t.sendSubjectDefault} ${e.document_id}` : t.sendSubjectDefault,
|
|
396
|
+
body: t.sendBodyDefault
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function J() {
|
|
400
|
+
return {
|
|
401
|
+
...g,
|
|
402
|
+
paidAt: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function Y() {
|
|
406
|
+
return [
|
|
407
|
+
"draft",
|
|
408
|
+
"issued",
|
|
409
|
+
"failed",
|
|
410
|
+
"accepted",
|
|
411
|
+
"expired",
|
|
412
|
+
"declined",
|
|
413
|
+
"recurring",
|
|
414
|
+
"partially_paid",
|
|
415
|
+
"paid",
|
|
416
|
+
"overdue",
|
|
417
|
+
"uncollectible",
|
|
418
|
+
"canceled"
|
|
419
|
+
].map((e) => ({
|
|
420
|
+
value: e,
|
|
421
|
+
label: e.split("_").map((e) => `${e.slice(0, 1).toUpperCase()}${e.slice(1)}`).join(" ")
|
|
422
|
+
}));
|
|
423
|
+
}
|
|
74
424
|
//#endregion
|
|
75
|
-
export {
|
|
425
|
+
export { g as EMPTY_RECEIVABLE_PAYMENT_VALUES, h as EMPTY_RECEIVABLE_SEND_VALUES, O as buildReceivableActions, A as buildReceivableDetailsView, k as buildReceivableRows, b as coerceEnabledTabs, _ as createEmptyReceivableFormValues, n as createLineItem, J as defaultPaymentValues, q as defaultSendValues, S as formatDate, C as formatMoney, w as fromMajorUnits, T as getDocumentTitle, E as getDocumentTypeLabel, D as getStatusTone, K as hasPaymentErrors, P as hasReceivableFormErrors, U as hasSendErrors, I as receivableFormValuesToCreatePayload, B as receivableFormValuesToLineItemChanges, z as receivableFormValuesToUpdatePayload, L as receivableToFormValues, x as resolveInitialTab, W as splitEmailList, Y as statusFilterOptions, y as tabForType, v as typeForTab, G as validatePaymentValues, N as validateReceivableForm, H as validateSendValues };
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import "./index2.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import "./index5.js";
|
|
2
|
+
import "./index3.js";
|
|
3
|
+
import { ReceivableActionDialog as e } from "./index4.js";
|
|
4
|
+
import { ReceivableBankAccountSection as t } from "./index5.js";
|
|
5
|
+
import { ReceivableAttachmentsSection as n } from "./index6.js";
|
|
6
|
+
import { RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE as r, RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as i } from "./index9.js";
|
|
7
|
+
import { ReceivableBillingSection as a } from "./index10.js";
|
|
8
|
+
import "./index11.js";
|
|
5
9
|
import "./index12.js";
|
|
6
|
-
import "./
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
10
|
+
import "./index19.js";
|
|
11
|
+
import "./index20.js";
|
|
12
|
+
import { ReceivableDetailsSheet as o } from "./index21.js";
|
|
13
|
+
import { ReceivableFormSheet as s } from "./index23.js";
|
|
14
|
+
import { ReceivablePaymentDialog as c } from "./index24.js";
|
|
15
|
+
import { ReceivableSendDialog as l } from "./index25.js";
|
|
16
|
+
import { ReceivablesScreen as u } from "./index26.js";
|
|
17
|
+
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 ReceivableSendDialog, u as ReceivablesScreen };
|
|
@@ -1 +1,94 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import { Field as e, FieldContent as t, FieldError as n, FieldLabel as r, Popover as i, PopoverAnchor as a, PopoverContent as o, Select as s, SelectContent as c, SelectItem as l, SelectSeparator as u, SelectTrigger as d, SelectValue as f, Skeleton as p, Typography as m } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { RECEIVABLE_BILLING_SECTION_LABELS_EN as h } from "./index2.js";
|
|
3
|
+
import { RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE as g, RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as _ } from "./index9.js";
|
|
4
|
+
import { OptionRow as v } from "./index7.js";
|
|
5
|
+
import { SelectionValue as y } from "./index8.js";
|
|
6
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
7
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js
|
|
8
|
+
function S({ idPrefix: S, paymentTerms: C, paymentTermsError: w, disabled: T, onPaymentTermsChange: E, onCustomDatePickerOpenChange: D, customDateCalendar: O, labels: k }) {
|
|
9
|
+
let A = {
|
|
10
|
+
...h,
|
|
11
|
+
...k
|
|
12
|
+
}, j = `${S}-payment-terms`, M = () => {
|
|
13
|
+
window.setTimeout(() => D(!0), 0);
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ x("div", {
|
|
16
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
|
|
17
|
+
children: [/* @__PURE__ */ x("div", {
|
|
18
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
|
|
19
|
+
children: [/* @__PURE__ */ b(m, {
|
|
20
|
+
variant: "h4",
|
|
21
|
+
children: A.billingHeading
|
|
22
|
+
}), /* @__PURE__ */ b(m, {
|
|
23
|
+
variant: "body2",
|
|
24
|
+
color: "muted",
|
|
25
|
+
className: "ttw:font-medium",
|
|
26
|
+
children: A.billingDescription
|
|
27
|
+
})]
|
|
28
|
+
}), /* @__PURE__ */ b("div", {
|
|
29
|
+
className: "ttw:flex ttw:flex-col ttw:gap-6",
|
|
30
|
+
children: /* @__PURE__ */ b("div", {
|
|
31
|
+
className: "ttw:flex ttw:w-full ttw:items-start ttw:gap-2.5",
|
|
32
|
+
children: C.kind === "loading" ? /* @__PURE__ */ b(p, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ b(e, { children: /* @__PURE__ */ x(t, { children: [
|
|
33
|
+
/* @__PURE__ */ b(r, {
|
|
34
|
+
htmlFor: j,
|
|
35
|
+
children: A.paymentTermsLabel
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ x(i, {
|
|
38
|
+
open: C.customDatePicker.open,
|
|
39
|
+
onOpenChange: D,
|
|
40
|
+
children: [/* @__PURE__ */ x(s, {
|
|
41
|
+
disabled: T,
|
|
42
|
+
value: C.value,
|
|
43
|
+
onValueChange: (e) => {
|
|
44
|
+
E(e), e === "custom" && M();
|
|
45
|
+
},
|
|
46
|
+
children: [/* @__PURE__ */ b(a, {
|
|
47
|
+
className: "ttw:w-full",
|
|
48
|
+
children: /* @__PURE__ */ b(d, {
|
|
49
|
+
id: j,
|
|
50
|
+
className: "ttw:w-full",
|
|
51
|
+
"aria-invalid": !!w,
|
|
52
|
+
children: /* @__PURE__ */ b(f, {
|
|
53
|
+
placeholder: A.paymentTermsPlaceholder,
|
|
54
|
+
children: /* @__PURE__ */ b(y, {
|
|
55
|
+
selection: C.selection,
|
|
56
|
+
labels: A
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}), /* @__PURE__ */ x(c, { children: [
|
|
61
|
+
/* @__PURE__ */ b(l, {
|
|
62
|
+
value: _,
|
|
63
|
+
children: A.paymentTermsReceiptDue
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ b(l, {
|
|
66
|
+
value: g,
|
|
67
|
+
onPointerUp: M,
|
|
68
|
+
onClick: M,
|
|
69
|
+
onKeyDown: (e) => {
|
|
70
|
+
(e.key === "Enter" || e.key === " ") && M();
|
|
71
|
+
},
|
|
72
|
+
children: A.paymentTermsCustomDate
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ b(u, {}),
|
|
75
|
+
C.options.map((e) => /* @__PURE__ */ b(l, {
|
|
76
|
+
value: e.value,
|
|
77
|
+
children: /* @__PURE__ */ b(v, { option: e })
|
|
78
|
+
}, e.value))
|
|
79
|
+
] })]
|
|
80
|
+
}), /* @__PURE__ */ b(o, {
|
|
81
|
+
className: "ttw:w-auto ttw:overflow-hidden ttw:p-0",
|
|
82
|
+
align: "start",
|
|
83
|
+
onFocusOutside: (e) => e.preventDefault(),
|
|
84
|
+
children: O
|
|
85
|
+
})]
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ b(n, { errors: w ? [{ message: w }] : [] })
|
|
88
|
+
] }) })
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { S as ReceivableBillingSection, S as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "./
|
|
3
|
-
import "
|
|
4
|
-
import "lucide-react";
|
|
1
|
+
import "./index2.js";
|
|
2
|
+
import "./index9.js";
|
|
3
|
+
import "./index10.js";
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { Badge as e, cn as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { RECEIVABLE_STATUS_BADGE_LABELS_EN as n } from "./index3.js";
|
|
3
|
+
import { jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js
|
|
5
|
+
var i = {
|
|
6
|
+
danger: "ttw:border-red-200 ttw:bg-red-50 ttw:text-red-700 ttw:hover:bg-red-50",
|
|
7
|
+
info: "ttw:border-blue-200 ttw:bg-blue-50 ttw:text-blue-700 ttw:hover:bg-blue-50",
|
|
8
|
+
neutral: "ttw:border-border ttw:bg-muted ttw:text-foreground ttw:hover:bg-muted",
|
|
9
|
+
success: "ttw:border-emerald-200 ttw:bg-emerald-50 ttw:text-emerald-700 ttw:hover:bg-emerald-50",
|
|
10
|
+
warning: "ttw:border-amber-200 ttw:bg-amber-50 ttw:text-amber-800 ttw:hover:bg-amber-50"
|
|
11
|
+
};
|
|
12
|
+
function a({ status: a, tone: o, labels: s, icon: c }) {
|
|
13
|
+
let l = {
|
|
14
|
+
...n,
|
|
15
|
+
...s
|
|
16
|
+
}, u = l[a] ?? l.unknown;
|
|
17
|
+
return /* @__PURE__ */ r(e, {
|
|
18
|
+
variant: "outline",
|
|
19
|
+
className: t(c && "ttw:gap-1", i[o]),
|
|
20
|
+
children: [c, u]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as ReceivableStatusBadge, a as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "lucide-react";
|