@tesouro/embedded-components-react 0.5.38 → 0.5.40
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.css +20 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +62 -59
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +21 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +104 -100
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +17 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +22 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -377,9 +377,6 @@
|
|
|
377
377
|
.ttw\:col-span-1 {
|
|
378
378
|
grid-column: span 1 / span 1;
|
|
379
379
|
}
|
|
380
|
-
.ttw\:col-span-3 {
|
|
381
|
-
grid-column: span 3 / span 3;
|
|
382
|
-
}
|
|
383
380
|
.ttw\:col-start-2 {
|
|
384
381
|
grid-column-start: 2;
|
|
385
382
|
}
|
|
@@ -5848,6 +5845,14 @@
|
|
|
5848
5845
|
max-width: var(--ttw-container-4xl);
|
|
5849
5846
|
}
|
|
5850
5847
|
}
|
|
5848
|
+
@container line-item (width >= 24rem) {
|
|
5849
|
+
.ttw\:\@sm\/line-item\:col-span-3 {
|
|
5850
|
+
grid-column: span 3 / span 3;
|
|
5851
|
+
}
|
|
5852
|
+
.ttw\:\@sm\/line-item\:grid-cols-3 {
|
|
5853
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
5854
|
+
}
|
|
5855
|
+
}
|
|
5851
5856
|
@container field-group (width >= 28rem) {
|
|
5852
5857
|
.ttw\:\@md\/field-group\:flex-row {
|
|
5853
5858
|
flex-direction: row;
|
|
@@ -5859,9 +5864,18 @@
|
|
|
5859
5864
|
align-items: flex-start;
|
|
5860
5865
|
}
|
|
5861
5866
|
}
|
|
5862
|
-
@container line-item (width >=
|
|
5863
|
-
.ttw\:\@
|
|
5864
|
-
grid-
|
|
5867
|
+
@container line-item (width >= 56rem) {
|
|
5868
|
+
.ttw\:\@4xl\/line-item\:col-span-2 {
|
|
5869
|
+
grid-column: span 2 / span 2;
|
|
5870
|
+
}
|
|
5871
|
+
.ttw\:\@4xl\/line-item\:col-span-3 {
|
|
5872
|
+
grid-column: span 3 / span 3;
|
|
5873
|
+
}
|
|
5874
|
+
.ttw\:\@4xl\/line-item\:col-span-5 {
|
|
5875
|
+
grid-column: span 5 / span 5;
|
|
5876
|
+
}
|
|
5877
|
+
.ttw\:\@4xl\/line-item\:grid-cols-12 {
|
|
5878
|
+
grid-template-columns: repeat(12, minmax(0, 1fr));
|
|
5865
5879
|
}
|
|
5866
5880
|
}
|
|
5867
5881
|
.ttw\:dark\:border-input:is(.dark *) {
|
|
@@ -5,91 +5,94 @@ import { formatBillMoney as i } from "./index2.js";
|
|
|
5
5
|
import { resolveLineItemAmountMinorUnits as a } from "./index40.js";
|
|
6
6
|
import { resolveLineItemQuantity as o } from "./index41.js";
|
|
7
7
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
|
|
8
|
-
function s(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
function s(e) {
|
|
9
|
+
return typeof e == "string" ? e : "";
|
|
10
|
+
}
|
|
11
|
+
function c({ payable: c, lineItems: u, ledgerAccounts: d, labels: f, hasScheduledPayment: p, now: m, rejection: h, achInstructions: g, achInstructionsReadable: _ = !1 }) {
|
|
12
|
+
let v = c.currency, y = (e) => i(e, v), b = t({
|
|
13
|
+
apiStatus: c.status,
|
|
14
|
+
dueDate: c.due_date,
|
|
15
|
+
scheduledPaymentDate: c.scheduled_payment_date,
|
|
16
|
+
hasScheduledPayment: p,
|
|
17
|
+
now: m
|
|
18
|
+
}), x = n(c), S = r(c), C = e(c.issued_at) || f.notProvided, w = e(c.due_date) || f.notProvided, T = [{
|
|
19
|
+
label: f.vendorRow,
|
|
20
|
+
value: S || f.notProvided,
|
|
21
|
+
secondaryValue: x?.email ?? void 0
|
|
22
|
+
}], E = _ ? g?.account_number : void 0;
|
|
23
|
+
E && T.push({
|
|
24
|
+
label: f.bankAccountRow,
|
|
25
|
+
value: f.bankAccountValue(E.slice(-4))
|
|
23
26
|
});
|
|
24
|
-
let
|
|
27
|
+
let D = [
|
|
25
28
|
{
|
|
26
|
-
label:
|
|
27
|
-
value:
|
|
29
|
+
label: f.invoiceNumberRow,
|
|
30
|
+
value: c.document_id || f.notProvided
|
|
28
31
|
},
|
|
29
32
|
{
|
|
30
|
-
label:
|
|
31
|
-
value:
|
|
33
|
+
label: f.issueDateRow,
|
|
34
|
+
value: C
|
|
32
35
|
},
|
|
33
36
|
{
|
|
34
|
-
label:
|
|
35
|
-
value:
|
|
37
|
+
label: f.dueDateRow,
|
|
38
|
+
value: w
|
|
36
39
|
},
|
|
37
40
|
{
|
|
38
|
-
label:
|
|
39
|
-
value:
|
|
41
|
+
label: f.poNumberRow,
|
|
42
|
+
value: s(c.purchase_order_number) || f.notProvided
|
|
40
43
|
}
|
|
41
|
-
],
|
|
42
|
-
let t =
|
|
44
|
+
], O = new Map(d.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), k = u.map((e) => {
|
|
45
|
+
let t = y(e.unit_price), n = String(o(e));
|
|
43
46
|
return {
|
|
44
47
|
id: e.id,
|
|
45
48
|
description: e.name ?? e.description ?? "",
|
|
46
|
-
glCodeLabel: (e.ledger_account_id ?
|
|
47
|
-
quantityLabel: t ?
|
|
48
|
-
amountLabel:
|
|
49
|
+
glCodeLabel: (e.ledger_account_id ? O.get(e.ledger_account_id) : void 0) || f.glCodeMissing,
|
|
50
|
+
quantityLabel: t ? f.quantityValue(n, t) : f.quantityOnlyValue(n),
|
|
51
|
+
amountLabel: y(a(e)) ?? ""
|
|
49
52
|
};
|
|
50
|
-
}),
|
|
53
|
+
}), A = [
|
|
51
54
|
{
|
|
52
|
-
label:
|
|
53
|
-
value:
|
|
55
|
+
label: f.subtotalRow,
|
|
56
|
+
value: c.subtotal
|
|
54
57
|
},
|
|
55
58
|
{
|
|
56
|
-
label:
|
|
57
|
-
value:
|
|
59
|
+
label: f.discountsRow,
|
|
60
|
+
value: c.discount
|
|
58
61
|
},
|
|
59
62
|
{
|
|
60
|
-
label:
|
|
61
|
-
value:
|
|
63
|
+
label: f.taxRow,
|
|
64
|
+
value: c.tax_amount
|
|
62
65
|
}
|
|
63
66
|
].map(({ label: e, value: t }) => ({
|
|
64
67
|
label: e,
|
|
65
|
-
value:
|
|
66
|
-
})).filter((e) => !!e.value),
|
|
67
|
-
|
|
68
|
-
label:
|
|
69
|
-
value:
|
|
68
|
+
value: y(t)
|
|
69
|
+
})).filter((e) => !!e.value), j = y(c.total_amount);
|
|
70
|
+
j && A.push({
|
|
71
|
+
label: f.totalRow,
|
|
72
|
+
value: j,
|
|
70
73
|
emphasis: !0
|
|
71
74
|
});
|
|
72
|
-
let
|
|
75
|
+
let M = l(c);
|
|
73
76
|
return {
|
|
74
|
-
title:
|
|
75
|
-
subtitle:
|
|
76
|
-
status:
|
|
77
|
-
statusTone:
|
|
78
|
-
amountDueLabel:
|
|
79
|
-
amountPaidLabel:
|
|
80
|
-
paidOnLabel:
|
|
81
|
-
invoiceDateLabel:
|
|
82
|
-
dueDateLabel:
|
|
83
|
-
dueDateTone:
|
|
84
|
-
payToItems:
|
|
85
|
-
invoiceItems:
|
|
86
|
-
lineItems:
|
|
87
|
-
totals:
|
|
88
|
-
rejection:
|
|
77
|
+
title: S,
|
|
78
|
+
subtitle: f.subtitle,
|
|
79
|
+
status: b.status,
|
|
80
|
+
statusTone: b.tone,
|
|
81
|
+
amountDueLabel: y(c.amount_due) ?? y(c.total_amount) ?? "",
|
|
82
|
+
amountPaidLabel: M ? y(c.amount_paid) : void 0,
|
|
83
|
+
paidOnLabel: M ? f.paidOnLabel(M) : void 0,
|
|
84
|
+
invoiceDateLabel: C,
|
|
85
|
+
dueDateLabel: w,
|
|
86
|
+
dueDateTone: b.isOverdue ? "danger" : "default",
|
|
87
|
+
payToItems: T,
|
|
88
|
+
invoiceItems: D,
|
|
89
|
+
lineItems: k,
|
|
90
|
+
totals: A,
|
|
91
|
+
rejection: h
|
|
89
92
|
};
|
|
90
93
|
}
|
|
91
|
-
function
|
|
94
|
+
function l(t) {
|
|
92
95
|
return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
|
|
93
96
|
}
|
|
94
97
|
//#endregion
|
|
95
|
-
export {
|
|
98
|
+
export { l as getPaidAtLabel, c as mapPayableToBillDetails };
|
|
@@ -29,7 +29,8 @@ var v = {
|
|
|
29
29
|
unreadableDiscount: "Enter a valid discount amount.",
|
|
30
30
|
unreadableTax: "Enter a valid tax amount.",
|
|
31
31
|
unreadableTotal: "Enter a valid total amount.",
|
|
32
|
-
totalNotGreaterThanZero: "Total amount must be greater than $0."
|
|
32
|
+
totalNotGreaterThanZero: "Total amount must be greater than $0.",
|
|
33
|
+
poNumberTooLong: "PO number must be 255 characters or fewer."
|
|
33
34
|
}, y = {
|
|
34
35
|
paymentInstructionsValue: (e) => `Account ending in ${e}`,
|
|
35
36
|
noMethod: "No payment method on file",
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index48.js";
|
|
2
2
|
import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index54.js";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js
|
|
4
|
-
var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)
|
|
5
|
-
function
|
|
4
|
+
var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/, a = 255;
|
|
5
|
+
function o(t, n = e) {
|
|
6
|
+
let r = {};
|
|
7
|
+
return t.poNumber.length > a && (r.poNumber = n.poNumberTooLong), Object.keys(r).length ? r : void 0;
|
|
8
|
+
}
|
|
9
|
+
function s(e) {
|
|
6
10
|
let t = e.trim();
|
|
7
11
|
return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
|
|
8
12
|
}
|
|
9
|
-
function
|
|
13
|
+
function c(t, i = e) {
|
|
10
14
|
let a = {};
|
|
11
15
|
for (let e of t) {
|
|
12
16
|
let t = n(e.price), o = n(e.amount), s = {};
|
|
@@ -14,7 +18,7 @@ function o(t, i = e) {
|
|
|
14
18
|
}
|
|
15
19
|
return Object.keys(a).length ? a : void 0;
|
|
16
20
|
}
|
|
17
|
-
function
|
|
21
|
+
function l(i, a, o, s = e) {
|
|
18
22
|
let c = {};
|
|
19
23
|
a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField), i.invoiceDate.trim() || (c.invoiceDate = s.requiredField), i.dueDate.trim() || (c.dueDate = s.requiredField);
|
|
20
24
|
let l = {};
|
|
@@ -27,31 +31,31 @@ function s(i, a, o, s = e) {
|
|
|
27
31
|
lineItemErrors: Object.keys(l).length ? l : void 0
|
|
28
32
|
};
|
|
29
33
|
}
|
|
30
|
-
function
|
|
34
|
+
function u(e) {
|
|
31
35
|
let t = e.trim();
|
|
32
36
|
if (!t) return !0;
|
|
33
37
|
let n = t.startsWith("-") ? t.slice(1) : t;
|
|
34
38
|
return i.test(n) ? Number(t.replaceAll(",", "")) <= 0 : !1;
|
|
35
39
|
}
|
|
36
|
-
function
|
|
37
|
-
if (n(e) === null) return
|
|
40
|
+
function d(e, t) {
|
|
41
|
+
if (n(e) === null) return u(e) ? t.totalNotGreaterThanZero : t.unreadableTotal;
|
|
38
42
|
}
|
|
39
|
-
function
|
|
40
|
-
let r =
|
|
43
|
+
function f(t, n = e) {
|
|
44
|
+
let r = d(t, n);
|
|
41
45
|
return r ? { total: r } : void 0;
|
|
42
46
|
}
|
|
43
|
-
function
|
|
47
|
+
function p(t, r, i = e) {
|
|
44
48
|
if (t === void 0) return;
|
|
45
49
|
let a = n(t);
|
|
46
50
|
if (a !== null) return a - (n(r) ?? 0) > 0 ? void 0 : { total: i.totalNotGreaterThanZero };
|
|
47
51
|
}
|
|
48
|
-
function
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
51
|
-
let e =
|
|
52
|
-
e && (
|
|
52
|
+
function m(t, n, r, i = e) {
|
|
53
|
+
let a = {};
|
|
54
|
+
if (s(t) || (a.discount = i.unreadableDiscount), s(n) || (a.tax = i.unreadableTax), r !== void 0) {
|
|
55
|
+
let e = d(r, i);
|
|
56
|
+
e && (a.total = e);
|
|
53
57
|
}
|
|
54
|
-
return Object.keys(
|
|
58
|
+
return Object.keys(a).length ? a : void 0;
|
|
55
59
|
}
|
|
56
60
|
//#endregion
|
|
57
|
-
export {
|
|
61
|
+
export { s as isReadableMoneyOrZero, l as validateBillCompleteness, f as validateBillTotalIsPayable, m as validateBillTotals, o as validateBillValues, c as validateLineItems, p as validateStoredAmountDue };
|
|
@@ -10,27 +10,28 @@ import { useCreatePayableMutation as r, useDeletePayableFileMutation as i, useSu
|
|
|
10
10
|
import "../../data-access/dist/index.js";
|
|
11
11
|
import { BILL_CREATE_MESSAGE_LABELS_EN as c } from "./index48.js";
|
|
12
12
|
import { encodeFileToBase64 as l } from "./index53.js";
|
|
13
|
-
import { mapBillFormToPayload as
|
|
14
|
-
import { validateBillCompleteness as
|
|
15
|
-
import { useCallback as
|
|
13
|
+
import { mapBillFormToPayload as u, mapLineItemsToPayload as ee } from "./index54.js";
|
|
14
|
+
import { validateBillCompleteness as te, validateBillTotalIsPayable as ne, validateBillTotals as d, validateBillValues as f, validateLineItems as p, validateStoredAmountDue as m } from "./index55.js";
|
|
15
|
+
import { useCallback as h, useRef as g, useState as _ } from "react";
|
|
16
16
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js
|
|
17
|
-
var
|
|
17
|
+
var v = {
|
|
18
18
|
document_id: "invoiceNumber",
|
|
19
19
|
issued_at: "invoiceDate",
|
|
20
20
|
due_date: "dueDate",
|
|
21
|
-
counterpart_id: "vendor"
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
counterpart_id: "vendor",
|
|
22
|
+
purchase_order_number: "poNumber"
|
|
23
|
+
}, y = { tax_amount: "tax" };
|
|
24
|
+
function b(e) {
|
|
24
25
|
return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
|
|
25
26
|
}
|
|
26
|
-
var
|
|
27
|
+
var re = "pending-vendor";
|
|
27
28
|
function x(e) {
|
|
28
29
|
return !!t(e)?.includes("line_items_enabled");
|
|
29
30
|
}
|
|
30
31
|
function S(e, t = c) {
|
|
31
32
|
let n = {}, r = {}, i = [];
|
|
32
33
|
for (let a of e) {
|
|
33
|
-
let e = a.loc[0] ?? t.unknownValidationField, o =
|
|
34
|
+
let e = a.loc[0] ?? t.unknownValidationField, o = v[e], s = y[e], c = b(a) ? t.requiredField : a.msg;
|
|
34
35
|
o ? n[o] = c : s ? r[s] = c : i.push(t.unmappedValidationError(e, c));
|
|
35
36
|
}
|
|
36
37
|
return i.length && (n.form = i.join(" ")), {
|
|
@@ -38,7 +39,7 @@ function S(e, t = c) {
|
|
|
38
39
|
totalsErrors: Object.keys(r).length ? r : void 0
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function C(e, t) {
|
|
42
43
|
if (!e && !t) return;
|
|
43
44
|
let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
|
|
44
45
|
for (let i of r) n[i] = {
|
|
@@ -47,167 +48,170 @@ function re(e, t) {
|
|
|
47
48
|
};
|
|
48
49
|
return n;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
let
|
|
51
|
+
function w({ payableId: t, form: v, counterpartId: y, isVendorPending: b, clearCounterpart: w, prepareVendorForSave: T, onSaved: E, onPayableCreated: D, readSavedStatus: O, onDraftSaved: k, onFinalized: A, labels: j }) {
|
|
52
|
+
let M = {
|
|
52
53
|
...c,
|
|
53
|
-
...
|
|
54
|
-
}, [
|
|
55
|
-
let t = f(
|
|
56
|
-
return
|
|
54
|
+
...j
|
|
55
|
+
}, [N, P] = _(), F = t ?? N, [I, L] = _(), R = h(() => L(void 0), []), [z, B] = _(!1), ie = h(() => B(!0), []), [V, H] = _(), U = g(!1), [ae, oe] = _(0), W = h(() => oe((e) => e + 1), []), G = r(), K = i(), q = o(), J = n(), Y = s(), X = a(), Z = h(() => v.isTotalsDirty ? d(v.discount, v.tax, v.totalOverride, M) : void 0, [v, M]), Q = h(() => {
|
|
56
|
+
let t = f(v.values, M), n = p(v.lineItems, M), r = Z();
|
|
57
|
+
return v.setErrors(t), v.setLineItemErrors(n), v.setTotalsErrors(r), !t && !n && !r || (n && e.error(M.lineItemsNeedAttention), W(), !1);
|
|
57
58
|
}, [
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
v,
|
|
60
|
+
M,
|
|
60
61
|
W,
|
|
61
62
|
Z
|
|
62
|
-
]), $ =
|
|
63
|
-
let n = !
|
|
64
|
-
base64EncodedFile: await l(
|
|
65
|
-
fileName:
|
|
66
|
-
} : void 0, r =
|
|
67
|
-
values:
|
|
68
|
-
initialLineItems:
|
|
69
|
-
counterpartId: t ??
|
|
70
|
-
clearCounterpart:
|
|
63
|
+
]), $ = h(async (e, t) => {
|
|
64
|
+
let n = !F && I ? {
|
|
65
|
+
base64EncodedFile: await l(I),
|
|
66
|
+
fileName: I.name
|
|
67
|
+
} : void 0, r = u({
|
|
68
|
+
values: v.values,
|
|
69
|
+
initialLineItems: F ? void 0 : v.lineItems,
|
|
70
|
+
counterpartId: t ?? y,
|
|
71
|
+
clearCounterpart: w,
|
|
71
72
|
counterpartBankAccountId: e,
|
|
72
|
-
editedTotals:
|
|
73
|
-
discount:
|
|
74
|
-
tax:
|
|
75
|
-
total:
|
|
73
|
+
editedTotals: v.isTotalsDirty ? {
|
|
74
|
+
discount: v.discount,
|
|
75
|
+
tax: v.tax,
|
|
76
|
+
total: v.totalOverride
|
|
76
77
|
} : void 0,
|
|
77
78
|
document: n
|
|
78
|
-
}), i =
|
|
79
|
+
}), i = F;
|
|
79
80
|
if (i ? await q.mutateAsync({
|
|
80
81
|
path: { payable_id: i },
|
|
81
82
|
body: r
|
|
82
|
-
}) : (i = (await G.mutateAsync({ body: r }))?.id, i && (
|
|
83
|
-
if (
|
|
83
|
+
}) : (i = (await G.mutateAsync({ body: r }))?.id, i && (P(i), D?.(i), n && L(void 0))), !i) throw Error("Payable was created without an id");
|
|
84
|
+
if (z) {
|
|
84
85
|
try {
|
|
85
86
|
await K.mutateAsync({ path: { payable_id: i } });
|
|
86
87
|
} catch {}
|
|
87
|
-
|
|
88
|
+
B(!1);
|
|
88
89
|
}
|
|
89
90
|
return await J.mutateAsync({
|
|
90
91
|
path: { payable_id: i },
|
|
91
|
-
body: { data:
|
|
92
|
+
body: { data: ee(v.lineItems) }
|
|
92
93
|
}), i;
|
|
93
94
|
}, [
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
y,
|
|
96
|
+
w,
|
|
96
97
|
G,
|
|
97
98
|
K,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
P,
|
|
107
|
-
J,
|
|
99
|
+
z,
|
|
100
|
+
v.discount,
|
|
101
|
+
v.isTotalsDirty,
|
|
102
|
+
v.lineItems,
|
|
103
|
+
v.tax,
|
|
104
|
+
v.totalOverride,
|
|
105
|
+
v.values,
|
|
106
|
+
D,
|
|
108
107
|
F,
|
|
108
|
+
J,
|
|
109
|
+
I,
|
|
109
110
|
q
|
|
110
|
-
]),
|
|
111
|
-
|
|
112
|
-
}, [K,
|
|
111
|
+
]), se = h(async () => {
|
|
112
|
+
F && (await K.mutateAsync({ path: { payable_id: F } }), B(!1));
|
|
113
|
+
}, [K, F]);
|
|
113
114
|
return {
|
|
114
|
-
saveDraft:
|
|
115
|
-
if (!
|
|
116
|
-
|
|
115
|
+
saveDraft: h(async () => {
|
|
116
|
+
if (!U.current && Q()) {
|
|
117
|
+
U.current = !0, H("draft");
|
|
117
118
|
try {
|
|
118
|
-
let t = await
|
|
119
|
+
let t = await T?.();
|
|
119
120
|
if (t && !t.ok) return;
|
|
120
121
|
let n = await $(t?.counterpartBankAccountId, t?.counterpartId);
|
|
121
|
-
|
|
122
|
-
let r = await
|
|
123
|
-
return e.success(r === "draft" ?
|
|
122
|
+
v.setErrors(void 0), E?.(n), k?.(n);
|
|
123
|
+
let r = await O?.();
|
|
124
|
+
return e.success(r === "draft" ? M.submittedDemoted : M.draftSaved), n;
|
|
124
125
|
} catch (e) {
|
|
125
|
-
|
|
126
|
+
v.setSaveFailureMessage(x(e) ? M.discountTaxBlockedByLineItems : M.saveFailed), W();
|
|
126
127
|
return;
|
|
127
128
|
} finally {
|
|
128
|
-
|
|
129
|
+
H(void 0), U.current = !1;
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
}, [
|
|
132
|
-
|
|
133
|
+
v,
|
|
133
134
|
Q,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
M.discountTaxBlockedByLineItems,
|
|
136
|
+
M.draftSaved,
|
|
137
|
+
M.saveFailed,
|
|
138
|
+
M.submittedDemoted,
|
|
139
|
+
k,
|
|
140
|
+
E,
|
|
138
141
|
O,
|
|
139
142
|
T,
|
|
140
|
-
D,
|
|
141
|
-
w,
|
|
142
143
|
$,
|
|
143
144
|
W
|
|
144
145
|
]),
|
|
145
|
-
finalize:
|
|
146
|
-
if (
|
|
147
|
-
let t =
|
|
146
|
+
finalize: h(async () => {
|
|
147
|
+
if (U.current) return;
|
|
148
|
+
let t = p(v.lineItems, M), n = f(v.values, M), r = Z(), i = ne(v.total, M), a = v.isTotalsDirty ? m(v.totalOverride, v.discount, M) : void 0, o = r || i || a ? {
|
|
149
|
+
...a,
|
|
148
150
|
...i,
|
|
149
|
-
...r
|
|
151
|
+
...r
|
|
152
|
+
} : void 0, { formErrors: s, lineItemErrors: c } = te(v.values, y ?? (b ? re : void 0), v.lineItems, M), l = C(c, t);
|
|
153
|
+
v.setLineItemErrors(l), v.setTotalsErrors(o);
|
|
154
|
+
let u = {
|
|
155
|
+
...s,
|
|
150
156
|
...n
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
let l = o ?? {};
|
|
154
|
-
if (_.setErrors(Object.keys(l).length ? l : void 0), t && e.error(j.lineItemsNeedAttention), c || a || Object.keys(l).length) {
|
|
157
|
+
};
|
|
158
|
+
if (v.setErrors(Object.keys(u).length ? u : void 0), t && e.error(M.lineItemsNeedAttention), l || o || Object.keys(u).length) {
|
|
155
159
|
W();
|
|
156
160
|
return;
|
|
157
161
|
}
|
|
158
|
-
|
|
162
|
+
U.current = !0, H("finalize");
|
|
159
163
|
try {
|
|
160
164
|
let t;
|
|
161
165
|
try {
|
|
162
|
-
let e = await
|
|
166
|
+
let e = await T?.();
|
|
163
167
|
if (e && !e.ok) return;
|
|
164
168
|
t = await $(e?.counterpartBankAccountId, e?.counterpartId);
|
|
165
169
|
} catch (e) {
|
|
166
|
-
|
|
170
|
+
v.setSaveFailureMessage(x(e) ? M.discountTaxBlockedByLineItems : M.saveFailed), W();
|
|
167
171
|
return;
|
|
168
172
|
}
|
|
169
|
-
|
|
173
|
+
E?.(t);
|
|
170
174
|
try {
|
|
171
175
|
let n = await Y.mutateAsync({ path: { payable_id: t } });
|
|
172
176
|
if (n.validation_errors.length) {
|
|
173
|
-
let e = S(n.validation_errors,
|
|
174
|
-
|
|
177
|
+
let e = S(n.validation_errors, M);
|
|
178
|
+
v.setErrors(e.formErrors), v.setTotalsErrors(e.totalsErrors), W();
|
|
175
179
|
return;
|
|
176
180
|
}
|
|
177
|
-
await X.mutateAsync({ path: { payable_id: t } }),
|
|
181
|
+
await X.mutateAsync({ path: { payable_id: t } }), v.setErrors(void 0), A?.(t), e.success(M.billFinalized);
|
|
178
182
|
} catch {
|
|
179
|
-
|
|
183
|
+
v.setSaveFailureMessage(M.finalizeFailed), W();
|
|
180
184
|
}
|
|
181
185
|
} finally {
|
|
182
|
-
|
|
186
|
+
H(void 0), U.current = !1;
|
|
183
187
|
}
|
|
184
188
|
}, [
|
|
185
|
-
v,
|
|
186
189
|
y,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
b,
|
|
191
|
+
v,
|
|
192
|
+
M,
|
|
193
|
+
A,
|
|
194
|
+
E,
|
|
190
195
|
T,
|
|
191
|
-
w,
|
|
192
196
|
$,
|
|
193
197
|
W,
|
|
194
198
|
X,
|
|
195
199
|
Z,
|
|
196
200
|
Y
|
|
197
201
|
]),
|
|
198
|
-
payableId:
|
|
199
|
-
isSavingDraft:
|
|
200
|
-
isFinalizing:
|
|
201
|
-
stagedFile:
|
|
202
|
-
stageFile:
|
|
203
|
-
clearStagedFile:
|
|
204
|
-
scrollToErrorToken:
|
|
205
|
-
isFileDeletionPending:
|
|
206
|
-
requestFileDeletion:
|
|
207
|
-
detachFileNow:
|
|
202
|
+
payableId: F,
|
|
203
|
+
isSavingDraft: V === "draft",
|
|
204
|
+
isFinalizing: V === "finalize",
|
|
205
|
+
stagedFile: I,
|
|
206
|
+
stageFile: L,
|
|
207
|
+
clearStagedFile: R,
|
|
208
|
+
scrollToErrorToken: ae,
|
|
209
|
+
isFileDeletionPending: z,
|
|
210
|
+
requestFileDeletion: ie,
|
|
211
|
+
detachFileNow: se,
|
|
208
212
|
isDeletingFile: K.isPending,
|
|
209
213
|
hasFileDeletionFailed: K.isError
|
|
210
214
|
};
|
|
211
215
|
}
|
|
212
216
|
//#endregion
|
|
213
|
-
export { S as mapValidationErrorsToForm,
|
|
217
|
+
export { S as mapValidationErrorsToForm, w as useBillCreateController };
|
|
@@ -14,27 +14,30 @@ function n() {
|
|
|
14
14
|
function r(e) {
|
|
15
15
|
return typeof e == "number" ? (e / 100).toFixed(2) : "";
|
|
16
16
|
}
|
|
17
|
-
function i(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
function i(e) {
|
|
18
|
+
return typeof e == "string" ? e : "";
|
|
19
|
+
}
|
|
20
|
+
function a({ payable: a, lineItems: o }) {
|
|
21
|
+
let s = {
|
|
22
|
+
invoiceNumber: a.document_id ?? "",
|
|
23
|
+
invoiceDate: a.issued_at ?? "",
|
|
24
|
+
dueDate: a.due_date ?? "",
|
|
25
|
+
poNumber: i(a.purchase_order_number)
|
|
26
|
+
}, c = o.map((n) => ({
|
|
24
27
|
id: n.id,
|
|
25
28
|
description: n.name ?? "",
|
|
26
29
|
glCode: n.ledger_account_id ?? "",
|
|
27
30
|
quantity: String(t(n)),
|
|
28
31
|
price: r(n.unit_price),
|
|
29
32
|
amount: r(e(n))
|
|
30
|
-
})),
|
|
33
|
+
})), l = a.amount_due ?? (a.total_amount == null ? void 0 : a.total_amount - (a.discount ?? 0));
|
|
31
34
|
return {
|
|
32
|
-
values:
|
|
33
|
-
lineItems:
|
|
34
|
-
discount: r(
|
|
35
|
-
tax: r(
|
|
36
|
-
total:
|
|
35
|
+
values: s,
|
|
36
|
+
lineItems: c.length ? c : [n()],
|
|
37
|
+
discount: r(a.discount),
|
|
38
|
+
tax: r(a.tax_amount),
|
|
39
|
+
total: l ? r(l) : ""
|
|
37
40
|
};
|
|
38
41
|
}
|
|
39
42
|
//#endregion
|
|
40
|
-
export { n as emptyLineItem,
|
|
43
|
+
export { n as emptyLineItem, a as mapPayableToBillForm };
|
|
@@ -64,8 +64,8 @@ function y({ payable: n, lineItems: r, labels: i = e } = {}) {
|
|
|
64
64
|
D((e) => {
|
|
65
65
|
if (!e?.form || e.form !== O.current) return e;
|
|
66
66
|
O.current = void 0;
|
|
67
|
-
let
|
|
68
|
-
return Object.keys(
|
|
67
|
+
let t = { ...e };
|
|
68
|
+
return delete t.form, Object.keys(t).length ? t : void 0;
|
|
69
69
|
});
|
|
70
70
|
}, []), [M, N] = d(), [P, F] = d(), [I, L] = d(!1), [R, z] = d(!1), [B, V] = d(!1);
|
|
71
71
|
l(() => {
|
|
@@ -3,47 +3,49 @@ import { BILL_FORM_FIELDS_LABELS_EN as n } from "./index33.js";
|
|
|
3
3
|
import { useId as r } from "react";
|
|
4
4
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
5
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
var o = 255;
|
|
7
|
+
function s({ values: s, errors: c, onChange: l, disabled: u, testId: d, labels: f }) {
|
|
8
|
+
let p = {
|
|
8
9
|
...n,
|
|
9
|
-
...
|
|
10
|
-
},
|
|
11
|
-
let
|
|
10
|
+
...f
|
|
11
|
+
}, m = r(), h = (n, r, d) => {
|
|
12
|
+
let f = `${m}-${n}`, p = `${f}-error`, h = c?.[n];
|
|
12
13
|
return /* @__PURE__ */ a("div", {
|
|
13
14
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
14
15
|
children: [
|
|
15
16
|
/* @__PURE__ */ i(t, {
|
|
16
|
-
htmlFor:
|
|
17
|
+
htmlFor: f,
|
|
17
18
|
children: r
|
|
18
19
|
}),
|
|
19
20
|
/* @__PURE__ */ i(e, {
|
|
20
|
-
id: d,
|
|
21
|
-
type: u,
|
|
22
|
-
value: o[n],
|
|
23
|
-
disabled: l,
|
|
24
|
-
"aria-invalid": m ? !0 : void 0,
|
|
25
|
-
"aria-describedby": m ? f : void 0,
|
|
26
|
-
onChange: (e) => c({ [n]: e.target.value })
|
|
27
|
-
}),
|
|
28
|
-
m ? /* @__PURE__ */ i("p", {
|
|
29
21
|
id: f,
|
|
22
|
+
type: d,
|
|
23
|
+
value: s[n],
|
|
24
|
+
disabled: u,
|
|
25
|
+
maxLength: n === "poNumber" ? o : void 0,
|
|
26
|
+
"aria-invalid": h ? !0 : void 0,
|
|
27
|
+
"aria-describedby": h ? p : void 0,
|
|
28
|
+
onChange: (e) => l({ [n]: e.target.value })
|
|
29
|
+
}),
|
|
30
|
+
h ? /* @__PURE__ */ i("p", {
|
|
31
|
+
id: p,
|
|
30
32
|
className: "ttw:text-sm ttw:text-destructive",
|
|
31
|
-
children:
|
|
33
|
+
children: h
|
|
32
34
|
}) : null
|
|
33
35
|
]
|
|
34
36
|
});
|
|
35
37
|
};
|
|
36
38
|
return /* @__PURE__ */ a("div", {
|
|
37
39
|
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
38
|
-
"data-testid":
|
|
40
|
+
"data-testid": d,
|
|
39
41
|
children: [/* @__PURE__ */ a("div", {
|
|
40
42
|
className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
|
|
41
|
-
children: [
|
|
43
|
+
children: [h("invoiceDate", p.invoiceDate, "date"), h("dueDate", p.dueDate, "date")]
|
|
42
44
|
}), /* @__PURE__ */ a("div", {
|
|
43
45
|
className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
|
|
44
|
-
children: [
|
|
46
|
+
children: [h("invoiceNumber", p.invoiceNumber), h("poNumber", p.poNumber)]
|
|
45
47
|
})]
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
//#endregion
|
|
49
|
-
export {
|
|
51
|
+
export { s as BillFormFields, s as default };
|
|
@@ -83,10 +83,10 @@ function E({ items: E, glCodeOptions: D, glCodeDisabled: O, glCodeUnavailableMes
|
|
|
83
83
|
}), M("description")]
|
|
84
84
|
}),
|
|
85
85
|
/* @__PURE__ */ b("div", {
|
|
86
|
-
className: "ttw:grid ttw:grid-cols-3 ttw:@
|
|
86
|
+
className: "ttw:grid ttw:grid-cols-1 ttw:@sm/line-item:grid-cols-3 ttw:@4xl/line-item:grid-cols-12 ttw:gap-3",
|
|
87
87
|
children: [
|
|
88
88
|
/* @__PURE__ */ b("div", {
|
|
89
|
-
className: "ttw:col-span-3 ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
89
|
+
className: "ttw:col-span-1 ttw:@sm/line-item:col-span-3 ttw:@4xl/line-item:col-span-5 ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
90
90
|
children: [
|
|
91
91
|
/* @__PURE__ */ b("div", {
|
|
92
92
|
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
@@ -138,7 +138,7 @@ function E({ items: E, glCodeOptions: D, glCodeDisabled: O, glCodeUnavailableMes
|
|
|
138
138
|
]
|
|
139
139
|
}),
|
|
140
140
|
/* @__PURE__ */ b("div", {
|
|
141
|
-
className: "ttw:col-span-1 ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
141
|
+
className: "ttw:col-span-1 ttw:@4xl/line-item:col-span-3 ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
142
142
|
children: [
|
|
143
143
|
/* @__PURE__ */ y(a, {
|
|
144
144
|
htmlFor: `${v}-quantity`,
|
|
@@ -183,7 +183,7 @@ function E({ items: E, glCodeOptions: D, glCodeDisabled: O, glCodeUnavailableMes
|
|
|
183
183
|
]
|
|
184
184
|
}),
|
|
185
185
|
/* @__PURE__ */ b("div", {
|
|
186
|
-
className: "ttw:col-span-1 ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
186
|
+
className: "ttw:col-span-1 ttw:@4xl/line-item:col-span-2 ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
187
187
|
children: [
|
|
188
188
|
/* @__PURE__ */ y(a, {
|
|
189
189
|
htmlFor: `${v}-price`,
|
|
@@ -208,7 +208,7 @@ function E({ items: E, glCodeOptions: D, glCodeDisabled: O, glCodeUnavailableMes
|
|
|
208
208
|
]
|
|
209
209
|
}),
|
|
210
210
|
/* @__PURE__ */ b("div", {
|
|
211
|
-
className: "ttw:col-span-1 ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
211
|
+
className: "ttw:col-span-1 ttw:@4xl/line-item:col-span-2 ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
212
212
|
children: [
|
|
213
213
|
/* @__PURE__ */ y(a, {
|
|
214
214
|
htmlFor: `${v}-amount`,
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.5.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.5.40", n = "cf726abcf80a70bb2ca03fd1610339cc6bcd4e11", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|