@tesouro/embedded-components-react 0.5.303 → 0.5.305
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/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +8 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +8 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +24 -157
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +20 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +13 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +153 -89
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +17 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +23 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +42 -55
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +93 -107
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +77 -185
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +3 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +55 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +111 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +184 -463
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index3.js +14 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +78 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +61 -74
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +115 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +449 -216
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +116 -42
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +11 -249
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +85 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +80 -648
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +240 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +44 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +38 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +242 -240
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +25 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +538 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +3 -66
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +42 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +239 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +5 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +67 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index5.js +227 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index6.js +82 -224
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index7.js +45 -82
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index8.js +4 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index29.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index31.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -1,46 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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";
|
|
3
10
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
11
|
+
function l({ vendor: l, payableId: u, linkedCounterpartId: d, linkedBankAccountId: f, canSavePayToEdits: p, readOnly: m, refreshPayable: h, labels: g }) {
|
|
12
|
+
let _ = t(), [v, y] = c(!1), b = s(void 0), x = i(async () => {
|
|
13
|
+
if (b.current) return b.current;
|
|
14
|
+
let t = (async () => {
|
|
15
|
+
if (p) {
|
|
16
|
+
y(!0);
|
|
17
|
+
try {
|
|
18
|
+
let t;
|
|
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
|
+
}
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
b.current = t;
|
|
59
|
+
try {
|
|
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
|
|
43
117
|
};
|
|
44
118
|
}
|
|
45
119
|
//#endregion
|
|
46
|
-
export {
|
|
120
|
+
export { l as usePayToSave };
|
|
@@ -1,254 +1,16 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index25.js";
|
|
6
|
-
import { calculateTotal as t, displayLineAmount as n, normalizeMoneyOnBlur as r, parseMoneyToMinorUnits as i, parseQuantity as a } from "./index31.js";
|
|
7
|
-
import { validateBillTotals as o } from "./index32.js";
|
|
8
|
-
import { emptyLineItem as s, mapPayableToBillForm as c } from "./index34.js";
|
|
9
|
-
import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
10
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"price",
|
|
19
|
-
"amount"
|
|
20
|
-
];
|
|
21
|
-
function _(e) {
|
|
22
|
-
let t = e.trim(), n = /[.,]$/.test(t) ? t.slice(0, -1) : t;
|
|
23
|
-
return t && !n ? null : n;
|
|
24
|
-
}
|
|
25
|
-
function v(e, t, n) {
|
|
26
|
-
if (t === void 0) return;
|
|
27
|
-
let r = _(t);
|
|
28
|
-
if (r !== null) return o(e === "discount" ? r : "", e === "tax" ? r : "", e === "total" ? r : void 0, n)?.[e];
|
|
29
|
-
}
|
|
30
|
-
function y(e, t) {
|
|
31
|
-
let n = {}, r = {
|
|
32
|
-
price: null,
|
|
33
|
-
amount: null
|
|
34
|
-
};
|
|
35
|
-
for (let a of ["price", "amount"]) {
|
|
36
|
-
let o = _(e[a]);
|
|
37
|
-
o !== null && (r[a] = i(o), o && r[a] === null && (n[a] = t.unreadableMoney));
|
|
38
|
-
}
|
|
39
|
-
let o = _(e.quantity);
|
|
40
|
-
if (o !== null) {
|
|
41
|
-
let e = r.price !== null || r.amount !== null;
|
|
42
|
-
a(o) === null && (o || e) && (n.quantity = t.unusableQuantity);
|
|
43
|
-
}
|
|
44
|
-
return n;
|
|
45
|
-
}
|
|
46
|
-
function b(e, t, r) {
|
|
47
|
-
return i(t) === null ? r : n(e, t);
|
|
48
|
-
}
|
|
49
|
-
function x({ payable: n, lineItems: i, labels: a = e } = {}) {
|
|
50
|
-
let o = d(() => c({
|
|
51
|
-
payable: n ?? {},
|
|
52
|
-
lineItems: i ?? []
|
|
53
|
-
}), [n, i]), [m, _] = p(o.values), [x, S] = p(o.lineItems), [C, w] = p(o.discount), [T, E] = p(o.tax), [D, O] = p(o.total || void 0), [ee, k] = p(), A = f(void 0), te = l((e) => {
|
|
54
|
-
k((t) => {
|
|
55
|
-
let n = typeof e == "function" ? e(t) : e;
|
|
56
|
-
return n?.form !== A.current && (A.current = void 0), n;
|
|
57
|
-
});
|
|
58
|
-
}, []), ne = l((e) => {
|
|
59
|
-
A.current = e, k((t) => ({
|
|
60
|
-
...t,
|
|
61
|
-
form: e
|
|
62
|
-
}));
|
|
63
|
-
}, []), j = l(() => {
|
|
64
|
-
k((e) => {
|
|
65
|
-
if (!e?.form || e.form !== A.current) return e;
|
|
66
|
-
A.current = void 0;
|
|
67
|
-
let t = { ...e };
|
|
68
|
-
return delete t.form, Object.keys(t).length ? t : void 0;
|
|
69
|
-
});
|
|
70
|
-
}, []), [re, M] = p(), [N, P] = p(), [F, I] = p(!1), [L, R] = p(!1), [z, B] = p(!1);
|
|
71
|
-
u(() => {
|
|
72
|
-
F || _(o.values);
|
|
73
|
-
}, [o]), u(() => {
|
|
74
|
-
L || S(o.lineItems);
|
|
75
|
-
}, [o]), u(() => {
|
|
76
|
-
z || (w(o.discount), E(o.tax), O(o.total || void 0));
|
|
77
|
-
}, [o]);
|
|
78
|
-
let ie = l((e) => {
|
|
79
|
-
_((t) => ({
|
|
80
|
-
...t,
|
|
81
|
-
...e
|
|
82
|
-
})), I(!0), k((t) => {
|
|
83
|
-
if (!t) return t;
|
|
84
|
-
let n = { ...t };
|
|
85
|
-
for (let t of Object.keys(e)) delete n[t];
|
|
86
|
-
return Object.keys(n).length ? n : void 0;
|
|
87
|
-
}), j();
|
|
88
|
-
}, [j]), V = l((e, t) => {
|
|
89
|
-
M((n) => {
|
|
90
|
-
if (!n?.[e] && !t) return n;
|
|
91
|
-
let r = {
|
|
92
|
-
...n,
|
|
93
|
-
[e]: t
|
|
94
|
-
};
|
|
95
|
-
return t || delete r[e], Object.keys(r).length ? r : void 0;
|
|
96
|
-
});
|
|
97
|
-
}, []), H = l((e, t) => {
|
|
98
|
-
V(e, v(e, t, a));
|
|
99
|
-
}, [a, V]), U = l(() => {
|
|
100
|
-
O(void 0), H("total", void 0), j();
|
|
101
|
-
}, [H, j]), W = l((e, t = []) => {
|
|
102
|
-
let n = y(e, a);
|
|
103
|
-
P((r) => {
|
|
104
|
-
let i = r?.[e.id], a = { ...i };
|
|
105
|
-
for (let e of [
|
|
106
|
-
"price",
|
|
107
|
-
"amount",
|
|
108
|
-
"quantity"
|
|
109
|
-
]) n[e] ? a[e] = n[e] : delete a[e];
|
|
110
|
-
t.includes("description") && delete a.description;
|
|
111
|
-
let o = Object.keys(a).length > 0;
|
|
112
|
-
if (!i && !o) return r;
|
|
113
|
-
let s = { ...r };
|
|
114
|
-
return o ? s[e.id] = a : delete s[e.id], Object.keys(s).length ? s : void 0;
|
|
115
|
-
});
|
|
116
|
-
}, [a]), G = l((e, t, n) => {
|
|
117
|
-
P((r) => ({
|
|
118
|
-
...r,
|
|
119
|
-
[e]: {
|
|
120
|
-
...r?.[e],
|
|
121
|
-
[t]: n
|
|
122
|
-
}
|
|
123
|
-
}));
|
|
124
|
-
}, []), K = l((e, t, n = []) => {
|
|
125
|
-
let r = x.find((t) => t.id === e);
|
|
126
|
-
if (!r) return;
|
|
127
|
-
let i = t(r);
|
|
128
|
-
S(x.map((t) => t.id === e ? i : t)), W(i, n), R(!0), U();
|
|
129
|
-
}, [
|
|
130
|
-
U,
|
|
131
|
-
x,
|
|
132
|
-
W
|
|
133
|
-
]), q = l((e, t) => {
|
|
134
|
-
let n = { ...t };
|
|
135
|
-
for (let r of g) {
|
|
136
|
-
let i = t[r];
|
|
137
|
-
if (i === void 0) continue;
|
|
138
|
-
let o = h(i);
|
|
139
|
-
if (o === null) {
|
|
140
|
-
G(e, r, a.numbersOnly);
|
|
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"));
|
|
141
9
|
return;
|
|
142
10
|
}
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
let t = {
|
|
147
|
-
...e,
|
|
148
|
-
...n
|
|
149
|
-
};
|
|
150
|
-
return "amount" in n ? t : {
|
|
151
|
-
...t,
|
|
152
|
-
amount: b(t.quantity, t.price, t.amount)
|
|
153
|
-
};
|
|
154
|
-
}, Object.keys(n));
|
|
155
|
-
}, [
|
|
156
|
-
K,
|
|
157
|
-
a,
|
|
158
|
-
G
|
|
159
|
-
]), J = l((e, t) => {
|
|
160
|
-
S((n) => n.map((n) => n.id === e ? {
|
|
161
|
-
...n,
|
|
162
|
-
[t]: r(n[t])
|
|
163
|
-
} : n));
|
|
164
|
-
}, []), Y = l((e, t) => {
|
|
165
|
-
K(e, (e) => {
|
|
166
|
-
let n = Number.parseFloat(e.quantity), r = String(Math.max(1, (Number.isFinite(n) ? n : 0) + t));
|
|
167
|
-
return {
|
|
168
|
-
...e,
|
|
169
|
-
quantity: r,
|
|
170
|
-
amount: b(r, e.price, e.amount)
|
|
171
|
-
};
|
|
172
|
-
});
|
|
173
|
-
}, [K]), X = l((e) => {
|
|
174
|
-
P((t) => {
|
|
175
|
-
if (!t?.[e]) return t;
|
|
176
|
-
let n = { ...t };
|
|
177
|
-
return delete n[e], Object.keys(n).length ? n : void 0;
|
|
178
|
-
});
|
|
179
|
-
}, []), Z = l((e) => {
|
|
180
|
-
X(e), S((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), R(!0), U();
|
|
181
|
-
}, [X, U]), ae = l(() => {
|
|
182
|
-
S((e) => [...e, s()]), R(!0), U();
|
|
183
|
-
}, [U]), Q = l((e, t, n) => {
|
|
184
|
-
let r = h(t);
|
|
185
|
-
if (r === null) {
|
|
186
|
-
V(e, a.numbersOnly);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
n(r), B(!0), U(), H(e, r);
|
|
190
|
-
}, [
|
|
191
|
-
U,
|
|
192
|
-
a,
|
|
193
|
-
H,
|
|
194
|
-
V
|
|
195
|
-
]), oe = l((e) => Q("discount", e, w), [Q]), se = l((e) => Q("tax", e, E), [Q]), $ = l(() => w((e) => r(e)), []), ce = l(() => E((e) => r(e)), []), le = l((e) => {
|
|
196
|
-
let t = h(e);
|
|
197
|
-
if (t === null) {
|
|
198
|
-
V("total", a.numbersOnly);
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
O(t), B(!0), H("total", t), j();
|
|
202
|
-
}, [
|
|
203
|
-
j,
|
|
204
|
-
a,
|
|
205
|
-
H,
|
|
206
|
-
V
|
|
207
|
-
]), ue = l(() => {
|
|
208
|
-
O((e) => e === void 0 ? e : r(e));
|
|
209
|
-
}, []), de = d(() => x.map((e) => ({
|
|
210
|
-
...e,
|
|
211
|
-
onChange: (t) => q(e.id, t),
|
|
212
|
-
onBlur: (t) => J(e.id, t),
|
|
213
|
-
onQuantityStep: (t) => Y(e.id, t),
|
|
214
|
-
onRemove: () => Z(e.id)
|
|
215
|
-
})), [
|
|
216
|
-
J,
|
|
217
|
-
x,
|
|
218
|
-
q,
|
|
219
|
-
Z,
|
|
220
|
-
Y
|
|
221
|
-
]), fe = d(() => t(x, T, C), [
|
|
222
|
-
x,
|
|
223
|
-
T,
|
|
224
|
-
C
|
|
225
|
-
]);
|
|
226
|
-
return {
|
|
227
|
-
values: m,
|
|
228
|
-
errors: ee,
|
|
229
|
-
setErrors: te,
|
|
230
|
-
setSaveFailureMessage: ne,
|
|
231
|
-
lineItemErrors: N,
|
|
232
|
-
setLineItemErrors: P,
|
|
233
|
-
totalsErrors: re,
|
|
234
|
-
setTotalsErrors: M,
|
|
235
|
-
onChange: ie,
|
|
236
|
-
lineItems: x,
|
|
237
|
-
lineItemRows: de,
|
|
238
|
-
discount: C,
|
|
239
|
-
onDiscountChange: oe,
|
|
240
|
-
onDiscountBlur: $,
|
|
241
|
-
tax: T,
|
|
242
|
-
onTaxChange: se,
|
|
243
|
-
onTaxBlur: ce,
|
|
244
|
-
total: D ?? fe,
|
|
245
|
-
totalOverride: D,
|
|
246
|
-
onTotalChange: le,
|
|
247
|
-
onTotalBlur: ue,
|
|
248
|
-
onAddLineItem: ae,
|
|
249
|
-
isTotalsDirty: z,
|
|
250
|
-
isDirty: F || L || z
|
|
251
|
-
};
|
|
11
|
+
t(e.slice(e.indexOf(",") + 1));
|
|
12
|
+
}, r.readAsDataURL(e);
|
|
13
|
+
});
|
|
252
14
|
}
|
|
253
15
|
//#endregion
|
|
254
|
-
export {
|
|
16
|
+
export { e as encodeFileToBase64 };
|
|
@@ -1,25 +1,87 @@
|
|
|
1
|
+
import { parseDecimalAmountToMinorUnits as e } from "../../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
|
|
1
2
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
var t = "USD";
|
|
4
|
+
function n(n) {
|
|
5
|
+
return e(n, t);
|
|
6
|
+
}
|
|
7
|
+
function r(e) {
|
|
8
|
+
let t = e.trim();
|
|
9
|
+
if (!t) return null;
|
|
10
|
+
let n = Number(t);
|
|
11
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
12
|
+
}
|
|
13
|
+
function i(e) {
|
|
14
|
+
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
15
|
+
}
|
|
16
|
+
function a(e) {
|
|
17
|
+
return n(e) ?? 0;
|
|
18
|
+
}
|
|
19
|
+
function o(e) {
|
|
20
|
+
let t = Number.parseFloat(e);
|
|
21
|
+
return Number.isFinite(t) ? t : 0;
|
|
22
|
+
}
|
|
23
|
+
function s(e) {
|
|
24
|
+
let t = n(e);
|
|
25
|
+
return t === null ? e : c(t);
|
|
26
|
+
}
|
|
27
|
+
function c(e) {
|
|
28
|
+
return (e / 100).toFixed(2);
|
|
29
|
+
}
|
|
30
|
+
function l({ values: e, initialLineItems: r, counterpartId: i, clearCounterpart: a, counterpartBankAccountId: o, editedTotals: s, currentTotals: c, lineItems: l, document: f, includeBlankPoNumber: p = !0 }) {
|
|
31
|
+
let m = { currency: t };
|
|
32
|
+
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);
|
|
33
|
+
let h = e.poNumber.trim();
|
|
34
|
+
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) {
|
|
35
|
+
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;
|
|
36
|
+
e !== void 0 && (m.subtotal = e), m.discount = r, m.tax_amount = t, m.total_amount = i;
|
|
37
|
+
} else if (r && !("total_amount" in m)) {
|
|
38
|
+
let e = u(r, {
|
|
39
|
+
tax: s?.tax,
|
|
40
|
+
discount: s?.discount
|
|
41
|
+
});
|
|
42
|
+
e !== void 0 && (m.total_amount = e);
|
|
43
|
+
}
|
|
44
|
+
return m;
|
|
45
|
+
}
|
|
46
|
+
function u(e, { tax: t, discount: r }) {
|
|
47
|
+
let i = d(e);
|
|
48
|
+
if (i !== void 0) return i + (t ? n(t) ?? 0 : 0) - (r ? n(r) ?? 0 : 0);
|
|
49
|
+
}
|
|
50
|
+
function d(e) {
|
|
51
|
+
let t = !1, r = e.reduce((e, r) => {
|
|
52
|
+
if (!i(r)) return e;
|
|
53
|
+
let a = n(r.amount);
|
|
54
|
+
return a === null ? e : (t = !0, e + a);
|
|
55
|
+
}, 0);
|
|
56
|
+
if (t) return r;
|
|
57
|
+
}
|
|
58
|
+
function f({ lineItems: e, editedTotals: t }) {
|
|
59
|
+
let r = d(e), i = n(t.tax) ?? 0, a = n(t.discount) ?? 0, o = {
|
|
60
|
+
discount: a,
|
|
61
|
+
tax_amount: i
|
|
62
|
+
};
|
|
63
|
+
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;
|
|
64
|
+
}
|
|
65
|
+
function p(e) {
|
|
66
|
+
return e.filter(i).map((e) => {
|
|
67
|
+
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;
|
|
68
|
+
return {
|
|
69
|
+
name: e.description,
|
|
70
|
+
quantity: i,
|
|
71
|
+
unit_price: a,
|
|
72
|
+
tax: 0,
|
|
73
|
+
subtotal: s,
|
|
74
|
+
tax_amount: 0,
|
|
75
|
+
total: s,
|
|
76
|
+
...e.glCode ? { ledger_account_id: e.glCode } : {}
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function m(e, t) {
|
|
81
|
+
return c(Math.round(o(e) * a(t)));
|
|
82
|
+
}
|
|
83
|
+
function h(e, t, n) {
|
|
84
|
+
return c(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
|
|
85
|
+
}
|
|
24
86
|
//#endregion
|
|
25
|
-
export {
|
|
87
|
+
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 };
|