@tesouro/embedded-components-react 0.3.55 → 0.3.57
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/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +65 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +4 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +3 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +30 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +37 -158
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +165 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +48 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +1 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +47 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +4 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -57
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +54 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +24 -60
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +98 -98
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +51 -53
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +131 -140
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +6 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +2 -3
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js +18 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,68 @@
|
|
|
1
|
+
import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
2
|
+
import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
3
|
+
import "../../../shared/data-access/dist/index.js";
|
|
4
|
+
import { BanIcon as n, CalendarXIcon as r, RotateCcwIcon as i, ThumbsDownIcon as a, ThumbsUpIcon as o } from "lucide-react";
|
|
1
5
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js
|
|
2
|
-
function
|
|
3
|
-
return e
|
|
6
|
+
function s(n) {
|
|
7
|
+
return e(n, [t.CounterpartReadOrg]);
|
|
8
|
+
}
|
|
9
|
+
function c({ status: c, scopes: l, canDecideApprovalRequest: u, hasScheduledPayment: d, scheduledPaymentIntentId: f, isPolicyApprover: p, hasWaitingRequest: m, arePendingApproversUnknown: h, labels: g }) {
|
|
10
|
+
let _ = e(l, [t.PayablePayOrg]), v = e(l, [t.BankAccountReadOrg]), y = s(l), b = e(l, [t.PaymentRailAch]), x = e(l, [t.PayableWriteOrg]), S = _, C = e(l, [t.PayableApproveOrg]), w = [];
|
|
11
|
+
c === "approve_in_progress" && u && (w.push({
|
|
12
|
+
id: "approve",
|
|
13
|
+
label: g.approve,
|
|
14
|
+
variant: "default",
|
|
15
|
+
surface: "row"
|
|
16
|
+
}), w.push({
|
|
17
|
+
id: "reject",
|
|
18
|
+
label: g.reject,
|
|
19
|
+
variant: "ghost",
|
|
20
|
+
surface: "row"
|
|
21
|
+
})), c === "approve_in_progress" && m && C && !p && !h && (w.push({
|
|
22
|
+
id: "forceApprove",
|
|
23
|
+
label: g.forceApprove,
|
|
24
|
+
variant: "ghost",
|
|
25
|
+
surface: "menu",
|
|
26
|
+
icon: o,
|
|
27
|
+
sectionHeading: g.policyOverridesHeading
|
|
28
|
+
}), w.push({
|
|
29
|
+
id: "forceReject",
|
|
30
|
+
label: g.forceReject,
|
|
31
|
+
variant: "ghost",
|
|
32
|
+
surface: "menu",
|
|
33
|
+
icon: a,
|
|
34
|
+
sectionHeading: g.policyOverridesHeading
|
|
35
|
+
}));
|
|
36
|
+
let T = c === "waiting_to_be_paid" && _ && !d, E = c === "waiting_to_be_paid" && _ && v && y && b && !d;
|
|
37
|
+
return T && w.push({
|
|
38
|
+
id: "markAsPaid",
|
|
39
|
+
label: g.markAsPaid,
|
|
40
|
+
variant: "outline",
|
|
41
|
+
surface: "row"
|
|
42
|
+
}), E && w.push({
|
|
43
|
+
id: "payBill",
|
|
44
|
+
label: g.payBill,
|
|
45
|
+
variant: "default",
|
|
46
|
+
surface: "row"
|
|
47
|
+
}), c === "new" && x && w.push({
|
|
48
|
+
id: "cancel",
|
|
49
|
+
label: g.cancel,
|
|
50
|
+
variant: "ghost",
|
|
51
|
+
surface: "menu",
|
|
52
|
+
icon: n
|
|
53
|
+
}), (c === "rejected" || c === "waiting_to_be_paid" && !d) && x && w.push({
|
|
54
|
+
id: "reopen",
|
|
55
|
+
label: g.reopen,
|
|
56
|
+
variant: "ghost",
|
|
57
|
+
surface: "menu",
|
|
58
|
+
icon: i
|
|
59
|
+
}), c === "waiting_to_be_paid" && d && f && S && w.push({
|
|
60
|
+
id: "cancelScheduledPayment",
|
|
61
|
+
label: g.cancelScheduledPayment,
|
|
62
|
+
variant: "ghost",
|
|
63
|
+
surface: "menu",
|
|
64
|
+
icon: r
|
|
65
|
+
}), w;
|
|
4
66
|
}
|
|
5
67
|
//#endregion
|
|
6
|
-
export {
|
|
68
|
+
export { s as canReadCounterpartBankAccounts, c as getBillDetailActions };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e?.amount_due ?? e?.total_amount ?? void 0;
|
|
4
|
+
}
|
|
6
5
|
//#endregion
|
|
7
|
-
export { e as
|
|
6
|
+
export { e as resolveAmountDueMinorUnits };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var e = {
|
|
3
|
+
scheduleDialog: "pay-bill-schedule-dialog",
|
|
4
|
+
reviewDialog: "pay-bill-review-dialog"
|
|
5
|
+
};
|
|
5
6
|
//#endregion
|
|
6
|
-
export { e as
|
|
7
|
+
export { e as payBillFlowTestIds };
|
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
import { coerceAmountValueToMinorUnits as e } from "../../../shared/util/dist/lib/coerceAmountValueToMinorUnits.js";
|
|
2
|
-
import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
3
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
availableBalancePrefix: (e) => `Available balance: ${e}`,
|
|
7
|
-
futureInsufficientFunds: "Not enough funds right now. Add funds before the payment date.",
|
|
8
|
-
todayInsufficientFunds: "Not enough funds to pay today. Choose a different account or a later date."
|
|
9
|
-
};
|
|
10
|
-
function r(e) {
|
|
11
|
-
return e.slice(-4);
|
|
12
|
-
}
|
|
13
|
-
function i(i, a = n) {
|
|
14
|
-
return i.filter((e) => e.status === "ACTIVE").map((n) => {
|
|
15
|
-
let i = e(n.balance.value), o = n.balance.currencyCode;
|
|
16
|
-
return {
|
|
17
|
-
id: n.id,
|
|
18
|
-
primaryLabel: `${n.nickname || a.unnamedSourceAccount} - ${r(n.accountNumber)}`,
|
|
19
|
-
secondaryLabel: a.availableBalancePrefix(t(i / 100, { currencyCode: o })),
|
|
20
|
-
balanceMinorUnits: i
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function a({ selectedAccount: e, amountDueMinorUnits: t, isToday: r, labels: i = n }) {
|
|
25
|
-
let a = e?.balanceMinorUnits;
|
|
26
|
-
return a === void 0 ? { state: "warning" } : a >= t ? { state: "sufficient" } : r ? {
|
|
27
|
-
state: "error",
|
|
28
|
-
message: i.todayInsufficientFunds
|
|
29
|
-
} : {
|
|
30
|
-
state: "warning",
|
|
31
|
-
message: i.futureInsufficientFunds
|
|
32
|
-
};
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e ? `••••${e.slice(-4)}` : void 0;
|
|
33
4
|
}
|
|
34
5
|
//#endregion
|
|
35
|
-
export {
|
|
6
|
+
export { e as maskAccountNumber };
|
|
@@ -1,42 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "../../ui/dist/index.js";
|
|
4
|
-
import { SOURCE_ACCOUNT_LABELS_EN as n } from "./index19.js";
|
|
1
|
+
import { coerceAmountValueToMinorUnits as e } from "../../../shared/util/dist/lib/coerceAmountValueToMinorUnits.js";
|
|
2
|
+
import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
5
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
sourceAccount: "Pay from",
|
|
12
|
-
accountHolder: "Account holder name",
|
|
13
|
-
routingNumber: "Routing number",
|
|
14
|
-
accountNumber: "Account number",
|
|
15
|
-
achMethod: "Pay by ACH bank transfer",
|
|
16
|
-
scheduledToast: "Payment scheduled",
|
|
17
|
-
submitError: "Couldn't schedule this payment. Try again.",
|
|
18
|
-
selectAccountError: "Select a source account.",
|
|
19
|
-
selectDateError: "Select a payment date.",
|
|
20
|
-
staleDateError: "That date has passed. Choose a new payment date.",
|
|
21
|
-
missingPaymentInstructionsError: "This vendor does not have ACH payment instructions on file.",
|
|
22
|
-
missingVendorName: "Not provided",
|
|
23
|
-
...n,
|
|
24
|
-
scheduleDialog: t,
|
|
25
|
-
reviewDialog: e
|
|
4
|
+
var n = {
|
|
5
|
+
unnamedSourceAccount: "Bank account",
|
|
6
|
+
availableBalancePrefix: (e) => `Available balance: ${e}`,
|
|
7
|
+
futureInsufficientFunds: "Not enough funds right now. Add funds before the payment date.",
|
|
8
|
+
todayInsufficientFunds: "Not enough funds to pay today. Choose a different account or a later date."
|
|
26
9
|
};
|
|
27
|
-
function
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
10
|
+
function r(e) {
|
|
11
|
+
return e.slice(-4);
|
|
12
|
+
}
|
|
13
|
+
function i(i, a = n) {
|
|
14
|
+
return i.filter((e) => e.status === "ACTIVE").map((n) => {
|
|
15
|
+
let i = e(n.balance.value), o = n.balance.currencyCode;
|
|
16
|
+
return {
|
|
17
|
+
id: n.id,
|
|
18
|
+
primaryLabel: `${n.nickname || a.unnamedSourceAccount} - ${r(n.accountNumber)}`,
|
|
19
|
+
secondaryLabel: a.availableBalancePrefix(t(i / 100, { currencyCode: o })),
|
|
20
|
+
balanceMinorUnits: i
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function a({ selectedAccount: e, amountDueMinorUnits: t, isToday: r, labels: i = n }) {
|
|
25
|
+
let a = e?.balanceMinorUnits;
|
|
26
|
+
return a === void 0 ? { state: "warning" } : a >= t ? { state: "sufficient" } : r ? {
|
|
27
|
+
state: "error",
|
|
28
|
+
message: i.todayInsufficientFunds
|
|
29
|
+
} : {
|
|
30
|
+
state: "warning",
|
|
31
|
+
message: i.futureInsufficientFunds
|
|
39
32
|
};
|
|
40
33
|
}
|
|
41
34
|
//#endregion
|
|
42
|
-
export {
|
|
35
|
+
export { n as SOURCE_ACCOUNT_LABELS_EN, a as deriveSourceAccountFunds, i as mapSourceAccountOptions };
|
|
@@ -1,165 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import { useAllBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
|
|
7
|
-
import "../../../shared/data-access/dist/index.js";
|
|
8
|
-
import "../../../shared/ui/dist/index.js";
|
|
9
|
-
import { useAnalyticsCaptureException as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
10
|
-
import { formatCalendarDate as r } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
11
|
-
import { formatMoneyExact as i } from "../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
12
|
-
import { extractApiErrorMessage as a } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
13
|
-
import "../../../shared/feature/dist/index.js";
|
|
14
|
-
import { useSchedulePaymentMutation as o } from "../../data-access/dist/index11.js";
|
|
15
|
-
import "../../data-access/dist/index.js";
|
|
16
|
-
import { dateToCalendarKey as s, getDefaultPaymentDate as c, isPastEasternDate as l, isTodayInEastern as u } from "./index13.js";
|
|
17
|
-
import { maskAccountNumber as d } from "./index18.js";
|
|
18
|
-
import { deriveSourceAccountFunds as f, mapSourceAccountOptions as p } from "./index19.js";
|
|
19
|
-
import { mergePayBillFlowLabels as m } from "./index20.js";
|
|
20
|
-
import { useMemo as h, useState as g } from "react";
|
|
1
|
+
import { REVIEW_TRANSACTION_DIALOG_LABELS_EN as e } from "../../ui/dist/index83.js";
|
|
2
|
+
import { SCHEDULE_PAYMENT_DIALOG_LABELS_EN as t } from "../../ui/dist/index89.js";
|
|
3
|
+
import "../../ui/dist/index.js";
|
|
4
|
+
import { SOURCE_ACCOUNT_LABELS_EN as n } from "./index20.js";
|
|
21
5
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
error: i.message ?? r.todayInsufficientFunds
|
|
47
|
-
} : {
|
|
48
|
-
ok: !0,
|
|
49
|
-
date: e,
|
|
50
|
-
account: t
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function y({ payableId: l, amountDueMinorUnits: y, currencyCode: b = "USD", dueDate: x, vendorName: S, vendorEmail: C, vendorBankAccount: w, poweredByBankName: T, labels: E }) {
|
|
54
|
-
let D = h(() => m(E), [E]), O = S ?? D.missingVendorName, [k, A] = g(!1), [j, M] = g(!1), [N, P] = g(() => c()), [F, I] = g(), L = t({ enabled: k || j }), R = o(), z = n(), B = h(() => p(L.data?.data ?? [], D), [L.data?.data, D]), V = B.find((e) => e.id === F), H = N ? u(N) : !1, U = { before: c() }, W = f({
|
|
55
|
-
selectedAccount: V,
|
|
56
|
-
amountDueMinorUnits: y,
|
|
57
|
-
isToday: H,
|
|
58
|
-
labels: D
|
|
59
|
-
}), G = i(y / 100, { currencyCode: b }), K = N ? r(s(N)) : void 0, q = x ? D.dueDateSuffix(r(x)) : void 0, J = () => v({
|
|
60
|
-
selectedDate: N,
|
|
61
|
-
selectedAccount: V,
|
|
62
|
-
amountDueMinorUnits: y,
|
|
63
|
-
labels: D
|
|
64
|
-
}), Y = () => {
|
|
65
|
-
if (!_(w)) {
|
|
66
|
-
e.error(D.missingPaymentInstructionsError);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
A(!0);
|
|
70
|
-
}, X = () => {
|
|
71
|
-
M(!1), A(!1);
|
|
72
|
-
};
|
|
6
|
+
var r = {
|
|
7
|
+
amountDue: "Amount due",
|
|
8
|
+
paymentAmount: "Payment amount",
|
|
9
|
+
dueDateSuffix: (e) => `by ${e}`,
|
|
10
|
+
paymentDate: "Payment date",
|
|
11
|
+
sourceAccount: "Pay from",
|
|
12
|
+
accountHolder: "Account holder name",
|
|
13
|
+
routingNumber: "Routing number",
|
|
14
|
+
accountNumber: "Account number",
|
|
15
|
+
achMethod: "Pay by ACH bank transfer",
|
|
16
|
+
scheduledToast: "Payment scheduled",
|
|
17
|
+
submitError: "Couldn't schedule this payment. Try again.",
|
|
18
|
+
selectAccountError: "Select a source account.",
|
|
19
|
+
selectDateError: "Select a payment date.",
|
|
20
|
+
staleDateError: "That date has passed. Choose a new payment date.",
|
|
21
|
+
missingPaymentInstructionsError: "This vendor does not have ACH payment instructions on file.",
|
|
22
|
+
checkingPaymentInstructionsError: "Still checking this vendor's payment instructions. Try again in a moment.",
|
|
23
|
+
paymentInstructionsUnavailableError: "Couldn't check this vendor's payment instructions. Try again.",
|
|
24
|
+
missingVendorName: "Not provided",
|
|
25
|
+
...n,
|
|
26
|
+
scheduleDialog: t,
|
|
27
|
+
reviewDialog: e
|
|
28
|
+
};
|
|
29
|
+
function i(e) {
|
|
73
30
|
return {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
amountDue: G,
|
|
80
|
-
dueDateSuffix: q,
|
|
81
|
-
paymentAmountLabel: D.paymentAmount,
|
|
82
|
-
paymentAmount: G,
|
|
83
|
-
selectedDate: N,
|
|
84
|
-
selectedDateLabel: K,
|
|
85
|
-
calendarDisabled: U,
|
|
86
|
-
isToday: H,
|
|
87
|
-
selectedAccountId: F,
|
|
88
|
-
accounts: B,
|
|
89
|
-
poweredByBankName: T,
|
|
90
|
-
funds: W,
|
|
91
|
-
isAccountsLoading: L.isLoading,
|
|
92
|
-
isAccountsError: L.isError,
|
|
93
|
-
isSubmitting: R.isPending,
|
|
94
|
-
onDateChange: P,
|
|
95
|
-
onAccountChange: I,
|
|
96
|
-
onReview: () => {
|
|
97
|
-
let t = J();
|
|
98
|
-
if (!t.ok) {
|
|
99
|
-
e.error(t.error);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
A(!1), M(!0);
|
|
103
|
-
},
|
|
104
|
-
onCancel: X,
|
|
105
|
-
labels: D.scheduleDialog
|
|
31
|
+
...r,
|
|
32
|
+
...e,
|
|
33
|
+
scheduleDialog: {
|
|
34
|
+
...r.scheduleDialog,
|
|
35
|
+
...e?.scheduleDialog
|
|
106
36
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
amountLabel: D.paymentAmount,
|
|
111
|
-
amount: G,
|
|
112
|
-
rows: [{
|
|
113
|
-
label: D.sourceAccount,
|
|
114
|
-
value: V?.primaryLabel ?? ""
|
|
115
|
-
}, {
|
|
116
|
-
label: D.paymentDate,
|
|
117
|
-
value: K ?? ""
|
|
118
|
-
}],
|
|
119
|
-
payTo: {
|
|
120
|
-
name: O,
|
|
121
|
-
email: C,
|
|
122
|
-
methodLabel: D.achMethod,
|
|
123
|
-
fields: _(w) ? [
|
|
124
|
-
{
|
|
125
|
-
label: D.routingNumber,
|
|
126
|
-
value: w.routing_number
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
label: D.accountNumber,
|
|
130
|
-
value: w.account_number,
|
|
131
|
-
maskedValue: d(w.account_number)
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
label: D.accountHolder,
|
|
135
|
-
value: w.account_holder_name
|
|
136
|
-
}
|
|
137
|
-
] : []
|
|
138
|
-
},
|
|
139
|
-
isSubmitting: R.isPending,
|
|
140
|
-
onBack: () => {
|
|
141
|
-
M(!1), A(!0);
|
|
142
|
-
},
|
|
143
|
-
onCancel: X,
|
|
144
|
-
onSubmit: async () => {
|
|
145
|
-
let t = J();
|
|
146
|
-
if (!t.ok) {
|
|
147
|
-
M(!1), e.error(t.error), A(!0);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
await R.mutateAsync({
|
|
152
|
-
payableId: l,
|
|
153
|
-
paymentDate: s(t.date),
|
|
154
|
-
sourceBankAccountId: t.account.id
|
|
155
|
-
}), X(), e.success(D.scheduledToast);
|
|
156
|
-
} catch (t) {
|
|
157
|
-
z(t, { payable_id: l }), e.error(a(t) ?? D.submitError);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
labels: D.reviewDialog
|
|
37
|
+
reviewDialog: {
|
|
38
|
+
...r.reviewDialog,
|
|
39
|
+
...e?.reviewDialog
|
|
161
40
|
}
|
|
162
41
|
};
|
|
163
42
|
}
|
|
164
43
|
//#endregion
|
|
165
|
-
export {
|
|
44
|
+
export { r as PAY_BILL_FLOW_LABELS_EN, i as mergePayBillFlowLabels };
|
|
@@ -2,35 +2,172 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import "
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { useAllBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
|
|
7
|
+
import "../../../shared/data-access/dist/index.js";
|
|
8
|
+
import "../../../shared/ui/dist/index.js";
|
|
9
|
+
import { useAnalyticsCaptureException as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
10
|
+
import { formatCalendarDate as r } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
11
|
+
import { formatMoneyExact as i } from "../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
12
|
+
import { extractApiErrorMessage as a } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
13
|
+
import "../../../shared/feature/dist/index.js";
|
|
14
|
+
import { useSchedulePaymentMutation as o } from "../../data-access/dist/index11.js";
|
|
15
|
+
import "../../data-access/dist/index.js";
|
|
16
|
+
import { dateToCalendarKey as s, getDefaultPaymentDate as c, isPastEasternDate as l, isTodayInEastern as u } from "./index13.js";
|
|
17
|
+
import { maskAccountNumber as d } from "./index19.js";
|
|
18
|
+
import { deriveSourceAccountFunds as f, mapSourceAccountOptions as p } from "./index20.js";
|
|
19
|
+
import { mergePayBillFlowLabels as m } from "./index21.js";
|
|
20
|
+
import { useMemo as h, useState as g } from "react";
|
|
14
21
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
function _(e) {
|
|
23
|
+
return !!(e?.account_holder_name && e.routing_number && e.account_number);
|
|
24
|
+
}
|
|
25
|
+
function v({ selectedDate: e, selectedAccount: t, amountDueMinorUnits: n, labels: r }) {
|
|
26
|
+
if (!e) return {
|
|
27
|
+
ok: !1,
|
|
28
|
+
error: r.selectDateError
|
|
29
|
+
};
|
|
30
|
+
if (l(e)) return {
|
|
31
|
+
ok: !1,
|
|
32
|
+
error: r.staleDateError
|
|
33
|
+
};
|
|
34
|
+
if (!t) return {
|
|
35
|
+
ok: !1,
|
|
36
|
+
error: r.selectAccountError
|
|
37
|
+
};
|
|
38
|
+
let i = f({
|
|
39
|
+
selectedAccount: t,
|
|
40
|
+
amountDueMinorUnits: n,
|
|
41
|
+
isToday: u(e),
|
|
42
|
+
labels: r
|
|
26
43
|
});
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
return i.state === "error" ? {
|
|
45
|
+
ok: !1,
|
|
46
|
+
error: i.message ?? r.todayInsufficientFunds
|
|
47
|
+
} : {
|
|
48
|
+
ok: !0,
|
|
49
|
+
date: e,
|
|
50
|
+
account: t
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function y({ payableId: l, amountDueMinorUnits: y, currencyCode: b = "USD", dueDate: x, vendorName: S, vendorEmail: C, vendorBankAccount: w, isVendorBankAccountLoading: T, isVendorBankAccountError: E, onMissingAchInstructions: D, poweredByBankName: O, labels: k }) {
|
|
54
|
+
let A = h(() => m(k), [k]), j = S ?? A.missingVendorName, [M, N] = g(!1), [P, F] = g(!1), [I, L] = g(() => c()), [R, z] = g(), B = t({ enabled: M || P }), V = o(), H = n(), U = h(() => p(B.data?.data ?? [], A), [B.data?.data, A]), W = U.find((e) => e.id === R), G = I ? u(I) : !1, K = { before: c() }, q = f({
|
|
55
|
+
selectedAccount: W,
|
|
56
|
+
amountDueMinorUnits: y,
|
|
57
|
+
isToday: G,
|
|
58
|
+
labels: A
|
|
59
|
+
}), J = i(y / 100, { currencyCode: b }), Y = I ? r(s(I)) : void 0, X = x ? A.dueDateSuffix(r(x)) : void 0, Z = () => v({
|
|
60
|
+
selectedDate: I,
|
|
61
|
+
selectedAccount: W,
|
|
62
|
+
amountDueMinorUnits: y,
|
|
63
|
+
labels: A
|
|
64
|
+
}), Q = () => {
|
|
65
|
+
if (T) {
|
|
66
|
+
e.error(A.checkingPaymentInstructionsError);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (E) {
|
|
70
|
+
e.error(A.paymentInstructionsUnavailableError);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (!_(w)) {
|
|
74
|
+
D ? D() : e.error(A.missingPaymentInstructionsError);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
N(!0);
|
|
78
|
+
}, $ = () => {
|
|
79
|
+
F(!1), N(!1);
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
open: Q,
|
|
83
|
+
dialogProps: {
|
|
84
|
+
open: M,
|
|
85
|
+
onOpenChange: N,
|
|
86
|
+
amountDueLabel: A.amountDue,
|
|
87
|
+
amountDue: J,
|
|
88
|
+
dueDateSuffix: X,
|
|
89
|
+
paymentAmountLabel: A.paymentAmount,
|
|
90
|
+
paymentAmount: J,
|
|
91
|
+
selectedDate: I,
|
|
92
|
+
selectedDateLabel: Y,
|
|
93
|
+
calendarDisabled: K,
|
|
94
|
+
isToday: G,
|
|
95
|
+
selectedAccountId: R,
|
|
96
|
+
accounts: U,
|
|
97
|
+
poweredByBankName: O,
|
|
98
|
+
funds: q,
|
|
99
|
+
isAccountsLoading: B.isLoading,
|
|
100
|
+
isAccountsError: B.isError,
|
|
101
|
+
isSubmitting: V.isPending,
|
|
102
|
+
onDateChange: L,
|
|
103
|
+
onAccountChange: z,
|
|
104
|
+
onReview: () => {
|
|
105
|
+
let t = Z();
|
|
106
|
+
if (!t.ok) {
|
|
107
|
+
e.error(t.error);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
N(!1), F(!0);
|
|
111
|
+
},
|
|
112
|
+
onCancel: $,
|
|
113
|
+
labels: A.scheduleDialog
|
|
114
|
+
},
|
|
115
|
+
reviewProps: {
|
|
116
|
+
open: P,
|
|
117
|
+
onOpenChange: F,
|
|
118
|
+
amountLabel: A.paymentAmount,
|
|
119
|
+
amount: J,
|
|
120
|
+
rows: [{
|
|
121
|
+
label: A.sourceAccount,
|
|
122
|
+
value: W?.primaryLabel ?? ""
|
|
123
|
+
}, {
|
|
124
|
+
label: A.paymentDate,
|
|
125
|
+
value: Y ?? ""
|
|
126
|
+
}],
|
|
127
|
+
payTo: {
|
|
128
|
+
name: j,
|
|
129
|
+
email: C,
|
|
130
|
+
methodLabel: A.achMethod,
|
|
131
|
+
fields: _(w) ? [
|
|
132
|
+
{
|
|
133
|
+
label: A.routingNumber,
|
|
134
|
+
value: w.routing_number
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
label: A.accountNumber,
|
|
138
|
+
value: w.account_number,
|
|
139
|
+
maskedValue: d(w.account_number)
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
label: A.accountHolder,
|
|
143
|
+
value: w.account_holder_name
|
|
144
|
+
}
|
|
145
|
+
] : []
|
|
146
|
+
},
|
|
147
|
+
isSubmitting: V.isPending,
|
|
148
|
+
onBack: () => {
|
|
149
|
+
F(!1), N(!0);
|
|
150
|
+
},
|
|
151
|
+
onCancel: $,
|
|
152
|
+
onSubmit: async () => {
|
|
153
|
+
let t = Z();
|
|
154
|
+
if (!t.ok) {
|
|
155
|
+
F(!1), e.error(t.error), N(!0);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
await V.mutateAsync({
|
|
160
|
+
payableId: l,
|
|
161
|
+
paymentDate: s(t.date),
|
|
162
|
+
sourceBankAccountId: t.account.id
|
|
163
|
+
}), $(), e.success(A.scheduledToast);
|
|
164
|
+
} catch (t) {
|
|
165
|
+
H(t, { payable_id: l }), e.error(a(t) ?? A.submitError);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
labels: A.reviewDialog
|
|
169
|
+
}
|
|
170
|
+
};
|
|
34
171
|
}
|
|
35
172
|
//#endregion
|
|
36
|
-
export {
|
|
173
|
+
export { y as usePayBillFlow };
|