@tesouro/embedded-components-react 0.9.22 → 0.9.25
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 +82 -55
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index10.js +14 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index11.js +59 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +10 -65
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +9 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +9 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +29 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +24 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +14 -22
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +155 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +13 -157
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +18 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +32 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +99 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +69 -85
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +3 -85
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +57 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +114 -57
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +190 -111
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +75 -187
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index3.js +35 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +67 -75
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +111 -69
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +461 -108
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +102 -452
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +12 -116
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +85 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +67 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +231 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +38 -232
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +245 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +169 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +21 -252
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +534 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +4 -542
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +43 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +236 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +3 -240
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +63 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +1 -65
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index5.js +82 -225
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index6.js +45 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index7.js +4 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index8.js +13 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +8 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index14.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index31.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index33.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index36.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index37.js +138 -155
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index48.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index49.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/ui/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +48 -43
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +219 -207
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index4.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index6.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index7.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index18.js +1 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index20.js +278 -322
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index3.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/mocks/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +18 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index10.js +2 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index11.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +39 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +2 -78
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +11 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +78 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +2 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +25 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +28 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +2 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +7 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +34 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index6.js +31 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +1 -54
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index8.js +18 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index9.js +52 -2
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/theme/themeTokens.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +4696 -4681
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +0 -29
|
@@ -1,120 +1,16 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import "../../../../shared/ui/dist/index.js";
|
|
7
|
-
import { useUpdatePayableMutation as t } from "../../data-access/dist/index15.js";
|
|
8
|
-
import "../../data-access/dist/index.js";
|
|
9
|
-
import { cloneElement as n, isValidElement as r, useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
10
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
t = await l.prepareVendorForSave({ closeOnSuccess: !1 });
|
|
21
|
-
} catch {
|
|
22
|
-
e.error(g.paymentInstructionsSaveError);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (!t.ok) return;
|
|
26
|
-
if (!u) {
|
|
27
|
-
l.finalizePayToSave();
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
let n = t.counterpartId && t.counterpartId !== d ? t.counterpartId : void 0, r = t.counterpartBankAccountId && t.counterpartBankAccountId !== f ? t.counterpartBankAccountId : void 0;
|
|
31
|
-
if (n || r) {
|
|
32
|
-
let t = {
|
|
33
|
-
path: { payable_id: u },
|
|
34
|
-
body: {
|
|
35
|
-
...n ? { counterpart_id: n } : {},
|
|
36
|
-
...r ? { counterpart_bank_account_id: r } : {}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
try {
|
|
40
|
-
await _.mutateAsync(t);
|
|
41
|
-
} catch {
|
|
42
|
-
try {
|
|
43
|
-
await _.mutateAsync(t);
|
|
44
|
-
} catch {
|
|
45
|
-
e.error(g.paymentInstructionsLinkError);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
l.finalizePayToSave();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
l.finalizePayToSave(), await h();
|
|
53
|
-
} finally {
|
|
54
|
-
y(!1);
|
|
55
|
-
}
|
|
2
|
+
function e(e) {
|
|
3
|
+
return new Promise((t, n) => {
|
|
4
|
+
let r = new FileReader();
|
|
5
|
+
r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read file")), r.onload = () => {
|
|
6
|
+
let e = r.result;
|
|
7
|
+
if (typeof e != "string") {
|
|
8
|
+
n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
|
|
9
|
+
return;
|
|
56
10
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
await t;
|
|
61
|
-
} finally {
|
|
62
|
-
b.current = void 0;
|
|
63
|
-
}
|
|
64
|
-
}, [
|
|
65
|
-
p,
|
|
66
|
-
g.paymentInstructionsLinkError,
|
|
67
|
-
g.paymentInstructionsSaveError,
|
|
68
|
-
_,
|
|
69
|
-
f,
|
|
70
|
-
d,
|
|
71
|
-
u,
|
|
72
|
-
h,
|
|
73
|
-
l
|
|
74
|
-
]), S = o(() => {
|
|
75
|
-
if (!p) return l;
|
|
76
|
-
if (l.mode === "creating" && r(l.newVendorForm)) return {
|
|
77
|
-
...l,
|
|
78
|
-
newVendorForm: n(l.newVendorForm, {
|
|
79
|
-
onSave: x,
|
|
80
|
-
isSaving: v
|
|
81
|
-
})
|
|
82
|
-
};
|
|
83
|
-
if (l.mode === "resolved" && l.paymentInstructions) {
|
|
84
|
-
let e = {
|
|
85
|
-
onSave: x,
|
|
86
|
-
isSaving: v
|
|
87
|
-
};
|
|
88
|
-
return {
|
|
89
|
-
...l,
|
|
90
|
-
paymentInstructions: {
|
|
91
|
-
...l.paymentInstructions,
|
|
92
|
-
...e
|
|
93
|
-
},
|
|
94
|
-
paymentInstructionsEditor: l.paymentInstructionsEditor && {
|
|
95
|
-
...l.paymentInstructionsEditor,
|
|
96
|
-
...e
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
return l;
|
|
101
|
-
}, [
|
|
102
|
-
p,
|
|
103
|
-
v,
|
|
104
|
-
x,
|
|
105
|
-
l
|
|
106
|
-
]);
|
|
107
|
-
return a(() => {
|
|
108
|
-
m && l.isEditingPayTo && !p && l.discardPayToEdits();
|
|
109
|
-
}, [
|
|
110
|
-
p,
|
|
111
|
-
m,
|
|
112
|
-
l.discardPayToEdits,
|
|
113
|
-
l.isEditingPayTo
|
|
114
|
-
]), {
|
|
115
|
-
vendorWithInlineSave: S,
|
|
116
|
-
isSavingPayToEdits: v
|
|
117
|
-
};
|
|
11
|
+
t(e.slice(e.indexOf(",") + 1));
|
|
12
|
+
}, r.readAsDataURL(e);
|
|
13
|
+
});
|
|
118
14
|
}
|
|
119
15
|
//#endregion
|
|
120
|
-
export {
|
|
16
|
+
export { e as encodeFileToBase64 };
|
|
@@ -1,16 +1,89 @@
|
|
|
1
|
+
import { parseDecimalAmountToMinorUnits as e } from "../../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
|
|
2
|
+
import "../../../../shared/util/dist/index.js";
|
|
3
|
+
import "../../../util/dist/index.js";
|
|
1
4
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
var t = "USD";
|
|
6
|
+
function n(n) {
|
|
7
|
+
return e(n, t);
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
let t = e.trim();
|
|
11
|
+
if (!t) return null;
|
|
12
|
+
let n = Number(t);
|
|
13
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
14
|
+
}
|
|
15
|
+
function i(e) {
|
|
16
|
+
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
17
|
+
}
|
|
18
|
+
function a(e) {
|
|
19
|
+
return n(e) ?? 0;
|
|
20
|
+
}
|
|
21
|
+
function o(e) {
|
|
22
|
+
let t = Number.parseFloat(e);
|
|
23
|
+
return Number.isFinite(t) ? t : 0;
|
|
24
|
+
}
|
|
25
|
+
function s(e) {
|
|
26
|
+
let t = n(e);
|
|
27
|
+
return t === null ? e : c(t);
|
|
28
|
+
}
|
|
29
|
+
function c(e) {
|
|
30
|
+
return (e / 100).toFixed(2);
|
|
31
|
+
}
|
|
32
|
+
function l({ values: e, initialLineItems: r, counterpartId: i, clearCounterpart: a, counterpartBankAccountId: o, editedTotals: s, currentTotals: c, lineItems: l, document: f, includeBlankPoNumber: p = !0 }) {
|
|
33
|
+
let m = { currency: t };
|
|
34
|
+
i ? m.counterpart_id = i : a && (m.counterpart_id = null), i ? m.counterpart_bank_account_id = o ?? null : a && (m.counterpart_bank_account_id = null), e.invoiceNumber && (m.document_id = e.invoiceNumber), e.invoiceDate && (m.issued_at = e.invoiceDate), e.dueDate && (m.due_date = e.dueDate);
|
|
35
|
+
let h = e.poNumber.trim();
|
|
36
|
+
if ((h || p) && (m.purchase_order_number = h || null), f && (m.base64_encoded_file = f.base64EncodedFile, m.file_name = f.fileName), s && (m.discount = n(s.discount) ?? 0, m.tax_amount = n(s.tax) ?? 0, s.total !== void 0 && (m.total_amount = n(s.total) ?? 0)), c && l) {
|
|
37
|
+
let e = d(l), t = n(c.tax) ?? 0, r = n(c.discount) ?? 0, i = c.total === void 0 ? (e ?? 0) - r + t : n(c.total) ?? 0;
|
|
38
|
+
e !== void 0 && (m.subtotal = e), m.discount = r, m.tax_amount = t, m.total_amount = i;
|
|
39
|
+
} else if (r && !("total_amount" in m)) {
|
|
40
|
+
let e = u(r, {
|
|
41
|
+
tax: s?.tax,
|
|
42
|
+
discount: s?.discount
|
|
43
|
+
});
|
|
44
|
+
e !== void 0 && (m.total_amount = e);
|
|
45
|
+
}
|
|
46
|
+
return m;
|
|
47
|
+
}
|
|
48
|
+
function u(e, { tax: t, discount: r }) {
|
|
49
|
+
let i = d(e);
|
|
50
|
+
if (i !== void 0) return i + (t ? n(t) ?? 0 : 0) - (r ? n(r) ?? 0 : 0);
|
|
51
|
+
}
|
|
52
|
+
function d(e) {
|
|
53
|
+
let t = !1, r = e.reduce((e, r) => {
|
|
54
|
+
if (!i(r)) return e;
|
|
55
|
+
let a = n(r.amount);
|
|
56
|
+
return a === null ? e : (t = !0, e + a);
|
|
57
|
+
}, 0);
|
|
58
|
+
if (t) return r;
|
|
59
|
+
}
|
|
60
|
+
function f({ lineItems: e, editedTotals: t }) {
|
|
61
|
+
let r = d(e), i = n(t.tax) ?? 0, a = n(t.discount) ?? 0, o = {
|
|
62
|
+
discount: a,
|
|
63
|
+
tax_amount: i
|
|
64
|
+
};
|
|
65
|
+
return r !== void 0 && (o.subtotal = r), t.total === void 0 ? r !== void 0 && (o.total_amount = r - a + i) : o.total_amount = n(t.total) ?? 0, o;
|
|
66
|
+
}
|
|
67
|
+
function p(e) {
|
|
68
|
+
return e.filter(i).map((e) => {
|
|
69
|
+
let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a), s = t ?? o;
|
|
70
|
+
return {
|
|
71
|
+
name: e.description,
|
|
72
|
+
quantity: i,
|
|
73
|
+
unit_price: a,
|
|
74
|
+
tax: 0,
|
|
75
|
+
subtotal: s,
|
|
76
|
+
tax_amount: 0,
|
|
77
|
+
total: s,
|
|
78
|
+
...e.glCode ? { ledger_account_id: e.glCode } : {}
|
|
79
|
+
};
|
|
13
80
|
});
|
|
14
81
|
}
|
|
82
|
+
function m(e, t) {
|
|
83
|
+
return c(Math.round(o(e) * a(t)));
|
|
84
|
+
}
|
|
85
|
+
function h(e, t, n) {
|
|
86
|
+
return c(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
|
|
87
|
+
}
|
|
15
88
|
//#endregion
|
|
16
|
-
export {
|
|
89
|
+
export { h as calculateTotal, m as displayLineAmount, i as isPersistableLineItem, l as mapBillFormToPayload, p as mapLineItemsToPayload, f as mapPayableAmountFieldsToPayload, s as normalizeMoneyOnBlur, n as parseMoneyToMinorUnits, r as parseQuantity };
|
|
@@ -1,89 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import "../../../util/dist/index.js";
|
|
1
|
+
import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index28.js";
|
|
2
|
+
import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index35.js";
|
|
4
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
|
|
4
|
+
var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/, a = 255, o = 10, s = 5, c = 30, l = 864e5;
|
|
5
|
+
function u() {
|
|
6
|
+
let e = /* @__PURE__ */ new Date();
|
|
7
|
+
return Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let n = Number(t);
|
|
13
|
-
return Number.isFinite(n) && n > 0 ? n : null;
|
|
14
|
-
}
|
|
15
|
-
function i(e) {
|
|
16
|
-
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
9
|
+
function d() {
|
|
10
|
+
let e = new Date(u());
|
|
11
|
+
return e.setUTCFullYear(e.getUTCFullYear() - o), e;
|
|
17
12
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
13
|
+
function f(e) {
|
|
14
|
+
let t = new Date(e);
|
|
15
|
+
if (Number.isNaN(t.getTime())) return !1;
|
|
16
|
+
let n = new Date(u() + c * l);
|
|
17
|
+
return t < d() || t > n;
|
|
20
18
|
}
|
|
21
|
-
function
|
|
22
|
-
let t =
|
|
23
|
-
|
|
19
|
+
function p(e) {
|
|
20
|
+
let t = new Date(e);
|
|
21
|
+
if (Number.isNaN(t.getTime())) return !1;
|
|
22
|
+
let n = new Date(u());
|
|
23
|
+
return n.setUTCFullYear(n.getUTCFullYear() + s), t < d() || t > n;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let
|
|
27
|
-
return t
|
|
25
|
+
function m(t, n = e) {
|
|
26
|
+
let r = {};
|
|
27
|
+
return t.poNumber.length > a && (r.poNumber = n.poNumberTooLong), Object.keys(r).length ? r : void 0;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
29
|
+
function h(e) {
|
|
30
|
+
let t = e.trim();
|
|
31
|
+
return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
let e = d(l), t = n(c.tax) ?? 0, r = n(c.discount) ?? 0, i = c.total === void 0 ? (e ?? 0) - r + t : n(c.total) ?? 0;
|
|
38
|
-
e !== void 0 && (m.subtotal = e), m.discount = r, m.tax_amount = t, m.total_amount = i;
|
|
39
|
-
} else if (r && !("total_amount" in m)) {
|
|
40
|
-
let e = u(r, {
|
|
41
|
-
tax: s?.tax,
|
|
42
|
-
discount: s?.discount
|
|
43
|
-
});
|
|
44
|
-
e !== void 0 && (m.total_amount = e);
|
|
33
|
+
function g(t, i = e) {
|
|
34
|
+
let a = {};
|
|
35
|
+
for (let e of t) {
|
|
36
|
+
let t = n(e.price), o = n(e.amount), s = {};
|
|
37
|
+
e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), r(e.quantity) === null && (e.quantity.trim() || t !== null || o !== null) && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
|
|
45
38
|
}
|
|
46
|
-
return
|
|
39
|
+
return Object.keys(a).length ? a : void 0;
|
|
47
40
|
}
|
|
48
|
-
function
|
|
49
|
-
let
|
|
50
|
-
|
|
41
|
+
function _(i, a, o, s = e) {
|
|
42
|
+
let c = {};
|
|
43
|
+
a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField);
|
|
44
|
+
let l = i.invoiceDate.trim(), u = i.dueDate.trim();
|
|
45
|
+
l ? f(l) && (c.invoiceDate = s.implausibleInvoiceDate) : c.invoiceDate = s.requiredField, u ? p(u) ? c.dueDate = s.implausibleDueDate : l && u < l && (c.dueDate = s.dueBeforeInvoiceDate) : c.dueDate = s.requiredField;
|
|
46
|
+
let d = {};
|
|
47
|
+
return o.forEach((e, i) => {
|
|
48
|
+
if (i > 0 && !t(e)) return;
|
|
49
|
+
let a = {};
|
|
50
|
+
e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (d[e.id] = a);
|
|
51
|
+
}), {
|
|
52
|
+
formErrors: Object.keys(c).length ? c : void 0,
|
|
53
|
+
lineItemErrors: Object.keys(d).length ? d : void 0
|
|
54
|
+
};
|
|
51
55
|
}
|
|
52
|
-
function
|
|
53
|
-
let t =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, 0);
|
|
58
|
-
if (t) return r;
|
|
56
|
+
function v(e) {
|
|
57
|
+
let t = e.trim();
|
|
58
|
+
if (!t) return !0;
|
|
59
|
+
let n = t.startsWith("-") ? t.slice(1) : t;
|
|
60
|
+
return i.test(n) ? Number(t.replaceAll(",", "")) <= 0 : !1;
|
|
59
61
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
discount: a,
|
|
63
|
-
tax_amount: i
|
|
64
|
-
};
|
|
65
|
-
return r !== void 0 && (o.subtotal = r), t.total === void 0 ? r !== void 0 && (o.total_amount = r - a + i) : o.total_amount = n(t.total) ?? 0, o;
|
|
62
|
+
function y(e, t) {
|
|
63
|
+
if (n(e) === null) return v(e) ? t.totalNotGreaterThanZero : t.unreadableTotal;
|
|
66
64
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
name: e.description,
|
|
72
|
-
quantity: i,
|
|
73
|
-
unit_price: a,
|
|
74
|
-
tax: 0,
|
|
75
|
-
subtotal: s,
|
|
76
|
-
tax_amount: 0,
|
|
77
|
-
total: s,
|
|
78
|
-
...e.glCode ? { ledger_account_id: e.glCode } : {}
|
|
79
|
-
};
|
|
80
|
-
});
|
|
65
|
+
function b(t, n = e) {
|
|
66
|
+
let r = y(t, n);
|
|
67
|
+
return r ? { total: r } : void 0;
|
|
81
68
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
69
|
+
function x(t, r = e) {
|
|
70
|
+
if (t === void 0) return;
|
|
71
|
+
let i = n(t);
|
|
72
|
+
if (i !== null) return i > 0 ? void 0 : { total: r.totalNotGreaterThanZero };
|
|
84
73
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
74
|
+
function S(t, n, r, i = e) {
|
|
75
|
+
let a = {};
|
|
76
|
+
if (h(t) || (a.discount = i.unreadableDiscount), h(n) || (a.tax = i.unreadableTax), r !== void 0) {
|
|
77
|
+
let e = y(r, i);
|
|
78
|
+
e && (a.total = e);
|
|
79
|
+
}
|
|
80
|
+
return Object.keys(a).length ? a : void 0;
|
|
87
81
|
}
|
|
88
82
|
//#endregion
|
|
89
|
-
export { h as
|
|
83
|
+
export { h as isReadableMoneyOrZero, _ as validateBillCompleteness, b as validateBillTotalIsPayable, S as validateBillTotals, m as validateBillValues, g as validateLineItems, x as validateStoredAmountDue };
|