@tesouro/embedded-components-react 0.2.280 → 0.2.282
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 +17 -14
- package/dist/experimental/WidgetSuite.d.ts +9 -1
- package/dist/experimental/index.d.ts +9 -1
- package/dist/index.css +20 -6
- package/dist/index.d.ts +46 -23
- package/dist/index.js +54 -53
- package/dist/lib/AcceptDisclosuresWidget.d.ts +9 -1
- package/dist/lib/BalancesWidget.d.ts +8 -0
- package/dist/lib/BankAccountOnboardingWidget.d.ts +9 -1
- package/dist/lib/BankAccountsWidget.d.ts +9 -1
- package/dist/lib/BillPayWidget.d.ts +8 -0
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/lib/CardDetailsWidget.d.ts +9 -1
- package/dist/lib/CardsWidget.d.ts +9 -1
- package/dist/lib/ChartOfAccountsWidget.d.ts +9 -1
- package/dist/lib/CounterpartsWidget.d.ts +9 -1
- package/dist/lib/CreateCardWidget.d.ts +9 -1
- package/dist/lib/ExpenseApprovalPoliciesWidget.d.ts +9 -1
- package/dist/lib/ExpenseManagementWidget.d.ts +9 -1
- package/dist/lib/ExpenseRequirementsWidget.d.ts +9 -1
- package/dist/lib/HelpWidget.d.ts +9 -1
- package/dist/lib/InsightsWidget.d.ts +8 -0
- package/dist/lib/InvoicingWidget.d.ts +9 -1
- package/dist/lib/LinkedAccountsWidget.d.ts +9 -1
- package/dist/lib/ProductsWidget.d.ts +9 -1
- package/dist/lib/ProfileWidget.d.ts +9 -1
- package/dist/lib/ReceiptMatchWidget.d.ts +9 -1
- package/dist/lib/ReceivablesWidget.d.ts +9 -1
- package/dist/lib/SettingsWidget.d.ts +9 -1
- package/dist/lib/TagsWidget.d.ts +9 -1
- package/dist/lib/TeamWidget.d.ts +9 -1
- package/dist/lib/TransfersWidget.d.ts +8 -0
- package/dist/lib/WidgetProvider.d.ts +25 -2
- package/dist/lib/WidgetProvider.js +8 -7
- package/dist/lib/WidgetProviderPublic.d.ts +8 -0
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +54 -53
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +9 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +42 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +69 -54
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +21 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +46 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +81 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +46 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +5 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +43 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +1 -102
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +11 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +127 -76
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -111
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +85 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +16 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +2 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +114 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +25 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +50 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +25 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +86 -69
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +17 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +89 -124
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +31 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +80 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +228 -6
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +30 -29
- package/dist/libs/tesouro-embedded-components-react/expense-approval-policies-widget/feature/dist/lib/ExpenseApprovalPoliciesWidgetFeature.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index3.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/expense-receipt-match-widget/feature/dist/lib/ReceiptMatchWidget.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index8.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index3.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +53 -11
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +69 -67
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +158 -132
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/isDisclosuresAcceptanceRequired.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/labels.js +6 -1
- 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/ui/dist/index.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/ErrorState/ErrorState.js +19 -18
- package/dist/libs/tesouro-embedded-components-react/tags-widget/feature/dist/index11.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index17.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +3 -2
- package/dist/packages/shared-ui-shadcn/dist/index.js +3445 -3413
- package/package.json +1 -1
|
@@ -2,66 +2,69 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { calculateTotal as e, displayLineAmount as t } from "./index6.js";
|
|
6
|
-
import { emptyLineItem as
|
|
7
|
-
import { useCallback as
|
|
5
|
+
import { calculateTotal as e, displayLineAmount as t, parseMoneyToMinorUnits as n } from "./index6.js";
|
|
6
|
+
import { emptyLineItem as r, mapPayableToBillForm as i } from "./index9.js";
|
|
7
|
+
import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
|
|
8
8
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
function l(e, r, i) {
|
|
10
|
+
return n(r) === null ? i : t(e, r);
|
|
11
|
+
}
|
|
12
|
+
function u({ payable: t, lineItems: n } = {}) {
|
|
13
|
+
let u = s(() => i({
|
|
14
|
+
payable: t ?? {},
|
|
15
|
+
lineItems: n ?? []
|
|
16
|
+
}), [t, n]), [d, f] = c(u.values), [p, m] = c(u.lineItems), [h, g] = c(u.discount), [_, v] = c(u.tax), [y, b] = c(u.total || void 0), [x, S] = c(), [C, w] = c(), [T, E] = c(!1), [D, O] = c(!1), [k, A] = c(!1);
|
|
17
|
+
o(() => {
|
|
15
18
|
T || f(u.values);
|
|
16
|
-
}, [u]),
|
|
19
|
+
}, [u]), o(() => {
|
|
17
20
|
D || m(u.lineItems);
|
|
18
|
-
}, [u]),
|
|
19
|
-
k || (g(u.discount), v(u.tax));
|
|
21
|
+
}, [u]), o(() => {
|
|
22
|
+
k || (g(u.discount), v(u.tax), b(u.total || void 0));
|
|
20
23
|
}, [u]);
|
|
21
|
-
let j =
|
|
24
|
+
let j = a((e) => {
|
|
22
25
|
f((t) => ({
|
|
23
26
|
...t,
|
|
24
27
|
...e
|
|
25
28
|
})), E(!0);
|
|
26
|
-
}, []), M =
|
|
29
|
+
}, []), M = a((e) => {
|
|
27
30
|
w((t) => {
|
|
28
31
|
if (!t?.[e]) return t;
|
|
29
32
|
let n = { ...t };
|
|
30
33
|
return delete n[e], Object.keys(n).length ? n : void 0;
|
|
31
34
|
});
|
|
32
|
-
}, []), N =
|
|
33
|
-
M(e), m((
|
|
34
|
-
if (
|
|
35
|
-
let
|
|
36
|
-
...
|
|
37
|
-
...
|
|
35
|
+
}, []), N = a((e, t) => {
|
|
36
|
+
M(e), m((n) => n.map((n) => {
|
|
37
|
+
if (n.id !== e) return n;
|
|
38
|
+
let r = {
|
|
39
|
+
...n,
|
|
40
|
+
...t
|
|
38
41
|
};
|
|
39
|
-
return "amount" in
|
|
40
|
-
...
|
|
41
|
-
amount:
|
|
42
|
+
return "amount" in t ? r : {
|
|
43
|
+
...r,
|
|
44
|
+
amount: l(r.quantity, r.price, r.amount)
|
|
42
45
|
};
|
|
43
46
|
})), O(!0), b(void 0);
|
|
44
|
-
}, [M]), P =
|
|
45
|
-
M(e), m((
|
|
46
|
-
if (
|
|
47
|
-
let
|
|
47
|
+
}, [M]), P = a((e, t) => {
|
|
48
|
+
M(e), m((n) => n.map((n) => {
|
|
49
|
+
if (n.id !== e) return n;
|
|
50
|
+
let r = Number.parseFloat(n.quantity), i = String(Math.max(1, (Number.isFinite(r) ? r : 1) + t));
|
|
48
51
|
return {
|
|
49
|
-
...
|
|
50
|
-
quantity:
|
|
51
|
-
amount:
|
|
52
|
+
...n,
|
|
53
|
+
quantity: i,
|
|
54
|
+
amount: l(i, n.price, n.amount)
|
|
52
55
|
};
|
|
53
56
|
})), O(!0), b(void 0);
|
|
54
|
-
}, [M]), F =
|
|
57
|
+
}, [M]), F = a((e) => {
|
|
55
58
|
M(e), m((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), O(!0), b(void 0);
|
|
56
|
-
}, [M]), I =
|
|
57
|
-
m((e) => [...e,
|
|
58
|
-
}, []), L =
|
|
59
|
+
}, [M]), I = a(() => {
|
|
60
|
+
m((e) => [...e, r()]), O(!0), b(void 0);
|
|
61
|
+
}, []), L = a((e) => {
|
|
59
62
|
g(e), A(!0), b(void 0);
|
|
60
|
-
}, []), R =
|
|
63
|
+
}, []), R = a((e) => {
|
|
61
64
|
v(e), A(!0), b(void 0);
|
|
62
|
-
}, []), z =
|
|
65
|
+
}, []), z = a((e) => {
|
|
63
66
|
b(e), A(!0);
|
|
64
|
-
}, []), B =
|
|
67
|
+
}, []), B = s(() => p.map((e) => ({
|
|
65
68
|
...e,
|
|
66
69
|
onChange: (t) => N(e.id, t),
|
|
67
70
|
onQuantityStep: (t) => P(e.id, t),
|
|
@@ -71,7 +74,7 @@ function c({ payable: c, lineItems: l } = {}) {
|
|
|
71
74
|
N,
|
|
72
75
|
F,
|
|
73
76
|
P
|
|
74
|
-
]), V =
|
|
77
|
+
]), V = s(() => e(p, _, h), [
|
|
75
78
|
p,
|
|
76
79
|
_,
|
|
77
80
|
h
|
|
@@ -98,4 +101,4 @@ function c({ payable: c, lineItems: l } = {}) {
|
|
|
98
101
|
};
|
|
99
102
|
}
|
|
100
103
|
//#endregion
|
|
101
|
-
export {
|
|
104
|
+
export { u as useBillForm };
|
|
@@ -19,79 +19,94 @@ import { billCreateTestIds as u } from "./index11.js";
|
|
|
19
19
|
import { useCallback as d, useEffect as f, useMemo as p, useState as m } from "react";
|
|
20
20
|
import { jsx as h } from "react/jsx-runtime";
|
|
21
21
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js
|
|
22
|
-
function g({ open: g, onOpenChange: _, payableId: v,
|
|
23
|
-
let
|
|
22
|
+
function g({ open: g, onOpenChange: _, payableId: v, readOnly: y, copy: b }) {
|
|
23
|
+
let x = {
|
|
24
24
|
...t,
|
|
25
|
-
...
|
|
26
|
-
}, [
|
|
27
|
-
payable:
|
|
28
|
-
lineItems:
|
|
29
|
-
}),
|
|
25
|
+
...b
|
|
26
|
+
}, [S, C] = m(), [w, T] = m(!1), [E, D] = m(!1), [O, k] = m(), A = v ?? O, j = r(A, { pollWhileOcrProcessing: !0 }), M = n(A), N = e(), P = j.data, F = a({
|
|
27
|
+
payable: P,
|
|
28
|
+
lineItems: M.lineItems
|
|
29
|
+
}), I = P?.counterpart_id;
|
|
30
30
|
f(() => {
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
}, []),
|
|
31
|
+
w || I && (C(I), T(!0));
|
|
32
|
+
}, [w, I]);
|
|
33
|
+
let L = d((e) => {
|
|
34
|
+
T(!0), C(e);
|
|
35
|
+
}, []), R = i({
|
|
36
36
|
payableId: v,
|
|
37
|
-
form:
|
|
38
|
-
counterpartId:
|
|
39
|
-
onPayableCreated:
|
|
40
|
-
onSaved:
|
|
37
|
+
form: F,
|
|
38
|
+
counterpartId: S,
|
|
39
|
+
onPayableCreated: k,
|
|
40
|
+
onSaved: k,
|
|
41
41
|
onDraftSaved: () => _(!1),
|
|
42
42
|
onFinalized: () => _(!1)
|
|
43
|
-
}), R = p(() => (
|
|
43
|
+
}), z = !!(R.isSavingDraft || R.isFinalizing), B = p(() => (N.data?.data ?? []).map((e) => ({
|
|
44
44
|
value: e.id,
|
|
45
45
|
label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
|
|
46
|
-
})), [
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
})), [N.data]), V = P?.source_of_payable_data === "ocr", H = P?.counterpart_raw_data?.name, U = d(() => {
|
|
47
|
+
!y && F.isDirty && !window.confirm(x.discardConfirm) || _(!1);
|
|
48
|
+
}, [
|
|
49
|
+
x.discardConfirm,
|
|
50
|
+
F.isDirty,
|
|
51
|
+
_,
|
|
52
|
+
y
|
|
53
|
+
]), W = d((e) => {
|
|
54
|
+
if (!z) return e ? _(!0) : U();
|
|
55
|
+
}, [
|
|
56
|
+
U,
|
|
57
|
+
z,
|
|
58
|
+
_
|
|
59
|
+
]), G = l({
|
|
60
|
+
payableId: A,
|
|
61
|
+
counterpartId: S,
|
|
62
|
+
payableCounterpartId: I,
|
|
63
|
+
onCounterpartChange: L,
|
|
64
|
+
requiredError: F.errors?.vendor
|
|
53
65
|
});
|
|
54
66
|
return /* @__PURE__ */ h(o, {
|
|
55
67
|
open: g,
|
|
56
|
-
onOpenChange:
|
|
57
|
-
title:
|
|
58
|
-
notice:
|
|
68
|
+
onOpenChange: W,
|
|
69
|
+
title: y ? x.readOnlyTitle : V && H ? x.extractedTitle(H) : x.newTitle,
|
|
70
|
+
notice: V && !E ? /* @__PURE__ */ h(s, { onDismiss: () => D(!0) }) : void 0,
|
|
59
71
|
vendor: {
|
|
60
|
-
...
|
|
72
|
+
...G,
|
|
61
73
|
testId: u.vendorSection
|
|
62
74
|
},
|
|
63
|
-
values:
|
|
64
|
-
errors:
|
|
65
|
-
onChange:
|
|
75
|
+
values: F.values,
|
|
76
|
+
errors: F.errors,
|
|
77
|
+
onChange: F.onChange,
|
|
66
78
|
lineItems: {
|
|
67
|
-
items:
|
|
68
|
-
glCodeOptions:
|
|
69
|
-
discount:
|
|
70
|
-
onDiscountChange:
|
|
71
|
-
tax:
|
|
72
|
-
onTaxChange:
|
|
73
|
-
total:
|
|
74
|
-
onTotalChange:
|
|
75
|
-
onAddLineItem:
|
|
76
|
-
errors:
|
|
79
|
+
items: F.lineItemRows,
|
|
80
|
+
glCodeOptions: B,
|
|
81
|
+
discount: F.discount,
|
|
82
|
+
onDiscountChange: F.onDiscountChange,
|
|
83
|
+
tax: F.tax,
|
|
84
|
+
onTaxChange: F.onTaxChange,
|
|
85
|
+
total: F.total,
|
|
86
|
+
onTotalChange: F.onTotalChange,
|
|
87
|
+
onAddLineItem: F.onAddLineItem,
|
|
88
|
+
errors: F.lineItemErrors,
|
|
77
89
|
testId: u.lineItems
|
|
78
90
|
},
|
|
79
91
|
documentPanel: /* @__PURE__ */ h(c, {
|
|
80
|
-
payableId:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
payableId: A,
|
|
93
|
+
readOnly: y,
|
|
94
|
+
isDocumentPending: !!A && !P?.file && (j.isLoading || P?.ocr_status === "processing"),
|
|
95
|
+
file: P?.file ? {
|
|
96
|
+
id: P.file.id,
|
|
97
|
+
name: P.file.name,
|
|
98
|
+
url: P.file.url,
|
|
99
|
+
mimetype: P.file.mimetype
|
|
87
100
|
} : void 0
|
|
88
101
|
}),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
readOnly: y,
|
|
103
|
+
isLineItemsLoading: M.isResolving,
|
|
104
|
+
isSaving: z,
|
|
105
|
+
isSavingDraft: R.isSavingDraft,
|
|
106
|
+
isFinalizing: R.isFinalizing,
|
|
107
|
+
onCancel: U,
|
|
108
|
+
onSaveDraft: R.saveDraft,
|
|
109
|
+
onFinalize: R.finalize,
|
|
95
110
|
testId: u.dialog
|
|
96
111
|
});
|
|
97
112
|
}
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
+
import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index36.js";
|
|
2
|
+
import "../../ui/dist/index.js";
|
|
1
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js
|
|
2
|
-
var
|
|
4
|
+
var t = {
|
|
5
|
+
subtitle: "Accounts payable",
|
|
6
|
+
vendorRow: "Vendor",
|
|
7
|
+
bankAccountRow: "ACH bank account",
|
|
8
|
+
bankAccountValue: (e) => `Account ending in ${e}`,
|
|
9
|
+
invoiceNumberRow: "Number",
|
|
10
|
+
issueDateRow: "Issue date",
|
|
11
|
+
dueDateRow: "Due date",
|
|
12
|
+
poNumberRow: "PO number",
|
|
13
|
+
notProvided: "Not provided",
|
|
14
|
+
glCodeMissing: "GL code not specified",
|
|
15
|
+
quantityValue: (e, t) => `${e} x ${t}`,
|
|
16
|
+
subtotalRow: "Subtotal",
|
|
17
|
+
discountsRow: "Discounts",
|
|
18
|
+
taxRow: "Tax",
|
|
19
|
+
totalRow: "Total",
|
|
20
|
+
sheet: e
|
|
21
|
+
};
|
|
3
22
|
//#endregion
|
|
4
|
-
export {
|
|
23
|
+
export { t as BILL_DETAILS_LABELS_EN };
|
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
6
|
-
import "../../../shared/feature/dist/index.js";
|
|
7
|
-
import { BillPayWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "./index14.js";
|
|
8
|
-
import { Payables as r } from "../../../monite-sdk/dist/index431.js";
|
|
9
|
-
import "../../../monite-sdk/dist/index.js";
|
|
10
|
-
import { MoniteRegionProvider as i } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
|
|
11
|
-
import "../../../shared/monite-wrapper/feature/dist/index.js";
|
|
12
|
-
import { useEffect as a } from "react";
|
|
13
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
14
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
var e = /* @__PURE__ */ new Set([
|
|
3
|
+
"new",
|
|
4
|
+
"approve_in_progress",
|
|
5
|
+
"waiting_to_be_paid",
|
|
6
|
+
"partially_paid"
|
|
7
|
+
]);
|
|
8
|
+
function t(e, t) {
|
|
9
|
+
let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
|
|
10
|
+
return n.getTime() < r;
|
|
21
11
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
12
|
+
function n(n, r, i = /* @__PURE__ */ new Date()) {
|
|
13
|
+
if (e.has(n) && r && t(r, i)) return {
|
|
14
|
+
status: "overdue",
|
|
15
|
+
tone: "danger"
|
|
16
|
+
};
|
|
17
|
+
switch (n) {
|
|
18
|
+
case "draft": return {
|
|
19
|
+
status: "draft",
|
|
20
|
+
tone: "neutral"
|
|
21
|
+
};
|
|
22
|
+
case "new":
|
|
23
|
+
case "approve_in_progress": return {
|
|
24
|
+
status: "pending_approval",
|
|
25
|
+
tone: "warning"
|
|
26
|
+
};
|
|
27
|
+
case "waiting_to_be_paid": return {
|
|
28
|
+
status: "ready_to_pay",
|
|
29
|
+
tone: "info"
|
|
30
|
+
};
|
|
31
|
+
case "partially_paid": return {
|
|
32
|
+
status: "partially_paid",
|
|
33
|
+
tone: "success"
|
|
34
|
+
};
|
|
35
|
+
case "paid": return {
|
|
36
|
+
status: "paid",
|
|
37
|
+
tone: "success"
|
|
38
|
+
};
|
|
39
|
+
case "canceled": return {
|
|
40
|
+
status: "canceled",
|
|
41
|
+
tone: "neutral"
|
|
42
|
+
};
|
|
43
|
+
case "rejected": return {
|
|
44
|
+
status: "rejected",
|
|
45
|
+
tone: "danger"
|
|
46
|
+
};
|
|
47
|
+
}
|
|
42
48
|
}
|
|
43
49
|
//#endregion
|
|
44
|
-
export {
|
|
50
|
+
export { n as derivePayableStatus };
|
|
@@ -1 +1,81 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
2
|
+
import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
3
|
+
import "../../data-access/dist/index.js";
|
|
4
|
+
import { derivePayableStatus as n } from "./index15.js";
|
|
5
|
+
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js
|
|
6
|
+
function r(e, n) {
|
|
7
|
+
if (typeof e == "number") return t(e / 100, { currencyCode: n });
|
|
8
|
+
}
|
|
9
|
+
function i({ payable: t, lineItems: i, ledgerAccounts: a, labels: o }) {
|
|
10
|
+
let s = t.currency ?? "USD", c = n(t.status, t.due_date), l = t.counterpart ?? t.counterpart_raw_data, u = l?.name ?? "", d = e(t.issued_at) || o.notProvided, f = e(t.due_date) || o.notProvided, p = [{
|
|
11
|
+
label: o.vendorRow,
|
|
12
|
+
value: u || o.notProvided,
|
|
13
|
+
secondaryValue: l?.email ?? void 0
|
|
14
|
+
}], m = l?.bank_account?.account_number;
|
|
15
|
+
m && p.push({
|
|
16
|
+
label: o.bankAccountRow,
|
|
17
|
+
value: o.bankAccountValue(m.slice(-4))
|
|
18
|
+
});
|
|
19
|
+
let h = [
|
|
20
|
+
{
|
|
21
|
+
label: o.invoiceNumberRow,
|
|
22
|
+
value: t.document_id || o.notProvided
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: o.issueDateRow,
|
|
26
|
+
value: d
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: o.dueDateRow,
|
|
30
|
+
value: f
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: o.poNumberRow,
|
|
34
|
+
value: o.notProvided
|
|
35
|
+
}
|
|
36
|
+
], g = new Map(a.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), _ = i.map((e) => {
|
|
37
|
+
let t = r(e.unit_price, s);
|
|
38
|
+
return {
|
|
39
|
+
id: e.id,
|
|
40
|
+
description: e.name ?? e.description ?? "",
|
|
41
|
+
glCodeLabel: (e.ledger_account_id ? g.get(e.ledger_account_id) : void 0) || o.glCodeMissing,
|
|
42
|
+
quantityLabel: e.quantity != null && t ? o.quantityValue(String(e.quantity), t) : "",
|
|
43
|
+
amountLabel: r(e.subtotal, s) ?? ""
|
|
44
|
+
};
|
|
45
|
+
}), v = [
|
|
46
|
+
{
|
|
47
|
+
label: o.subtotalRow,
|
|
48
|
+
value: t.subtotal
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: o.discountsRow,
|
|
52
|
+
value: t.discount
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: o.taxRow,
|
|
56
|
+
value: t.tax_amount
|
|
57
|
+
}
|
|
58
|
+
].map(({ label: e, value: t }) => ({
|
|
59
|
+
label: e,
|
|
60
|
+
value: r(t, s)
|
|
61
|
+
})).filter((e) => !!e.value), y = r(t.total_amount, s);
|
|
62
|
+
return y && v.push({
|
|
63
|
+
label: o.totalRow,
|
|
64
|
+
value: y,
|
|
65
|
+
emphasis: !0
|
|
66
|
+
}), {
|
|
67
|
+
title: u,
|
|
68
|
+
subtitle: o.subtitle,
|
|
69
|
+
status: c.status,
|
|
70
|
+
statusTone: c.tone,
|
|
71
|
+
amountDueLabel: r(t.amount_due, s) ?? r(t.total_amount, s) ?? "",
|
|
72
|
+
invoiceDateLabel: d,
|
|
73
|
+
dueDateLabel: f,
|
|
74
|
+
payToItems: p,
|
|
75
|
+
invoiceItems: h,
|
|
76
|
+
lineItems: _,
|
|
77
|
+
totals: v
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { i as mapPayableToBillDetails };
|
|
@@ -1,50 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useAllLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
|
|
6
|
+
import "../../../shared/data-access/dist/index.js";
|
|
7
|
+
import { useAllPayableLineItemsQuery as t } from "../../data-access/dist/index6.js";
|
|
8
|
+
import { usePayableQuery as n } from "../../data-access/dist/index10.js";
|
|
9
|
+
import "../../data-access/dist/index.js";
|
|
10
|
+
import { BillDetailsSheet as r } from "../../ui/dist/index37.js";
|
|
11
|
+
import "../../ui/dist/index.js";
|
|
12
|
+
import { BILL_DETAILS_LABELS_EN as i } from "./index14.js";
|
|
13
|
+
import { mapPayableToBillDetails as a } from "./index16.js";
|
|
14
|
+
import { useMemo as o } from "react";
|
|
15
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
1
16
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
status: "partially_paid",
|
|
33
|
-
tone: "success"
|
|
34
|
-
};
|
|
35
|
-
case "paid": return {
|
|
36
|
-
status: "paid",
|
|
37
|
-
tone: "success"
|
|
38
|
-
};
|
|
39
|
-
case "canceled": return {
|
|
40
|
-
status: "canceled",
|
|
41
|
-
tone: "neutral"
|
|
42
|
-
};
|
|
43
|
-
case "rejected": return {
|
|
44
|
-
status: "rejected",
|
|
45
|
-
tone: "danger"
|
|
46
|
-
};
|
|
47
|
-
}
|
|
17
|
+
function c({ open: c, onOpenChange: l, payableId: u, onClose: d, onExpand: f, testId: p, labels: m }) {
|
|
18
|
+
let h = o(() => ({
|
|
19
|
+
...i,
|
|
20
|
+
...m,
|
|
21
|
+
sheet: {
|
|
22
|
+
...i.sheet,
|
|
23
|
+
...m?.sheet
|
|
24
|
+
}
|
|
25
|
+
}), [m]), g = n(u), _ = t(u), v = e(), y = g.data, b = o(() => y ? a({
|
|
26
|
+
payable: y,
|
|
27
|
+
lineItems: _.lineItems,
|
|
28
|
+
ledgerAccounts: v.data?.data ?? [],
|
|
29
|
+
labels: h
|
|
30
|
+
}) : void 0, [
|
|
31
|
+
y,
|
|
32
|
+
_.lineItems,
|
|
33
|
+
v.data,
|
|
34
|
+
h
|
|
35
|
+
]), x = g.isLoading || _.isResolving || v.isResolving, S = g.isError || _.isError || v.isError;
|
|
36
|
+
return /* @__PURE__ */ s(r, {
|
|
37
|
+
open: c,
|
|
38
|
+
onOpenChange: l,
|
|
39
|
+
details: b,
|
|
40
|
+
isLoading: x,
|
|
41
|
+
isError: S,
|
|
42
|
+
onClose: d,
|
|
43
|
+
onExpand: f,
|
|
44
|
+
testId: p,
|
|
45
|
+
labels: h.sheet
|
|
46
|
+
});
|
|
48
47
|
}
|
|
49
48
|
//#endregion
|
|
50
|
-
export {
|
|
49
|
+
export { c as BillDetailsContainer, c as default };
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
try {
|
|
5
|
-
return await navigator.clipboard.writeText(e), !0;
|
|
6
|
-
} catch {
|
|
7
|
-
return !1;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { e as copyTextToClipboard };
|
|
1
|
+
import "./index14.js";
|
|
2
|
+
import "./index16.js";
|
|
3
|
+
import "./index17.js";
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
|
|
2
|
-
var e = {
|
|
3
|
-
emptyHeading: "Add your first bill",
|
|
4
|
-
nonEmptyHeading: "Add a bill",
|
|
5
|
-
createButton: "Add bill",
|
|
6
|
-
emailCopiedToast: "Email address copied to clipboard",
|
|
7
|
-
emailCopyFailedToast: "Could not copy the email address"
|
|
8
|
-
};
|
|
2
|
+
var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
|
|
9
3
|
//#endregion
|
|
10
|
-
export { e as
|
|
4
|
+
export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
|
|
@@ -7,10 +7,10 @@ var e = {
|
|
|
7
7
|
finalizeFailed: "We could not submit this bill. Try again.",
|
|
8
8
|
draftSaved: "Bill saved as a draft.",
|
|
9
9
|
billFinalized: "Bill submitted for approval.",
|
|
10
|
-
unreadableMoney: "Enter a
|
|
10
|
+
unreadableMoney: "Enter a valid amount.",
|
|
11
11
|
unusableQuantity: "Enter a quantity greater than 0.",
|
|
12
12
|
lineItemsNeedAttention: "Check the highlighted line items before saving.",
|
|
13
|
-
totalsNeedAttention: "Enter discount, tax, and total
|
|
13
|
+
totalsNeedAttention: "Enter valid amounts for discount, tax, and total."
|
|
14
14
|
}, t = {
|
|
15
15
|
achMethod: "via ACH bank transfer",
|
|
16
16
|
noMethod: "No payment method on file",
|
|
@@ -21,10 +21,12 @@ var e = {
|
|
|
21
21
|
vendorDetailsFailed: "We could not load this vendor. Try again."
|
|
22
22
|
}, n = {
|
|
23
23
|
attachFailed: "We could not attach that file. Try again.",
|
|
24
|
-
saveBeforeAttaching: "Save this bill before attaching a document."
|
|
24
|
+
saveBeforeAttaching: "Save this bill before attaching a document.",
|
|
25
|
+
noDocument: "No document attached to this bill."
|
|
25
26
|
}, r = {
|
|
26
27
|
newTitle: "New bill",
|
|
27
28
|
extractedTitle: (e) => `Bill from ${e}`,
|
|
29
|
+
readOnlyTitle: "Bill details",
|
|
28
30
|
discardConfirm: "Discard your changes to this bill?"
|
|
29
31
|
}, i = {
|
|
30
32
|
createTitle: "New vendor",
|