@tesouro/embedded-components-react 0.5.27 → 0.5.29
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 +18 -6
- package/dist/index.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +2 -44
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +52 -67
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +15 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +57 -62
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +68 -207
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +278 -175
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +13 -126
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +47 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +53 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +204 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +32 -202
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +234 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +21 -240
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +532 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +4 -436
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +42 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +230 -35
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +3 -233
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +44 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +1 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +11 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +127 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -129
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +127 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +8 -124
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +46 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +18 -43
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +28 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +82 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +47 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +250 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +122 -241
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +206 -126
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +3 -213
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +8 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +113 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +1 -115
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +24 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +39 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +10 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +123 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +2 -170
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +18 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +7 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +158 -96
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +11 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +100 -44
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +52 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +20 -22
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +4 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +103 -146
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +93 -88
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +15 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +43 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +55 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +9 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +33 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +2 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +2 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +6 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +34 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +2 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +34 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +2 -201
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +39 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +3 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +187 -350
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +3 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +13 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +356 -85
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +9 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +87 -119
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +2 -94
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +125 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +25 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +90 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +26 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +4 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +30 -102
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +9 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +85 -104
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index128.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index186.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index197.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index495.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index503.js +291 -351
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index506.js +13 -21
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index507.js +30 -30
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index509.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index615.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +17 -17
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +92 -87
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +0 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +0 -28
|
@@ -8,215 +8,318 @@ import "../../../shared/data-access/dist/index.js";
|
|
|
8
8
|
import { useWidgetConfig as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
9
|
import "../../../shared/feature/dist/index.js";
|
|
10
10
|
import { useCounterpartsQuery as r } from "../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
11
|
-
import { useCreateCounterpartBankAccountMutation as
|
|
12
|
-
import { usePayableSuggestionsQuery as
|
|
11
|
+
import { useCreateCounterpartBankAccountMutation as i, useUpdateCounterpartBankAccountMutation as a } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
12
|
+
import { usePayableSuggestionsQuery as ee } from "../../data-access/dist/index18.js";
|
|
13
13
|
import "../../data-access/dist/index.js";
|
|
14
|
-
import {
|
|
15
|
-
import { counterpartFormBankAccountToCreatePayload as ne, counterpartFormBankAccountToUpdatePayload as re, getAchInstructions as
|
|
14
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as te } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
15
|
+
import { counterpartFormBankAccountToCreatePayload as ne, counterpartFormBankAccountToUpdatePayload as re, getAchInstructions as o, getCounterpartEmail as s, getCounterpartName as c, getPayableAchInstructions as ie, isAchCompatibleBankAccount as l, resolveCounterpartBankAccountWrite as ae, validateAchFormValues as oe } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
16
16
|
import { useCounterpartDetails as se } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
17
|
+
import { useCounterpartForm as ce } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
17
18
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
18
|
-
import { VENDOR_SECTION_PROPS_LABELS_EN as
|
|
19
|
-
import { buildVendorPrefill as
|
|
20
|
-
import { VendorInlineForm as
|
|
19
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as le } from "./index48.js";
|
|
20
|
+
import { buildVendorPrefill as ue } from "./index50.js";
|
|
21
|
+
import { VendorInlineForm as de } from "./index51.js";
|
|
21
22
|
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
22
|
-
import { jsx as
|
|
23
|
+
import { jsx as fe } from "react/jsx-runtime";
|
|
23
24
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js
|
|
24
|
-
var
|
|
25
|
+
var pe = 10, me = 300, h = {
|
|
25
26
|
accountHolderName: "",
|
|
26
27
|
routingNumber: "",
|
|
27
28
|
accountNumber: ""
|
|
28
29
|
};
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
function he(e) {
|
|
31
|
+
return {
|
|
32
|
+
accountHolderName: e.account_holder_name ?? "",
|
|
33
|
+
routingNumber: e.routing_number ?? "",
|
|
34
|
+
accountNumber: e.account_number ?? ""
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function g(e, t) {
|
|
38
|
+
return e.accountHolderName.trim() === t.accountHolderName.trim() && e.routingNumber.trim() === t.routingNumber.trim() && e.accountNumber.trim() === t.accountNumber.trim();
|
|
39
|
+
}
|
|
40
|
+
function ge(e, t) {
|
|
41
|
+
return e?.find((e) => e.id === t && l(e)) ?? o(e);
|
|
42
|
+
}
|
|
43
|
+
function _({ payableId: o, counterpartId: l, payableCounterpartId: _, payableCounterpartBankAccountId: _e, isVendorKnown: ve = !0, onCounterpartChange: ye, requiredError: be, extractedVendor: xe, readOnly: v = !1, canEditVendor: Se = !0, canEditPaymentInstructions: Ce = !0, canAddPaymentInstructions: we = !0, confirmDiscard: y = (e) => e(), labels: Te }) {
|
|
44
|
+
let b = {
|
|
45
|
+
...le,
|
|
46
|
+
...Te
|
|
47
|
+
}, { initResponse: Ee } = n(), De = e(Ee?.scopes, [t.CounterpartReadOrg]), [x, Oe] = m(""), [ke, Ae] = m(""), [S, C] = m(), [je, Me] = m("none"), [Ne, Pe] = m(), [Fe, w] = m(!1), [T, E] = m(!1), [D, O] = m(h), Ie = p(D);
|
|
48
|
+
Ie.current = D;
|
|
49
|
+
let k = p(h), [Le, A] = m(), [j, M] = m(), Re = p(l), [ze, Be] = m(!1), N = T && !g(D, k.current), P = u(() => {
|
|
50
|
+
E(!1), O(h), k.current = h, A(void 0);
|
|
51
|
+
}, []), F = u((e) => {
|
|
52
|
+
Be(!0), ye(e);
|
|
53
|
+
}, [ye]), I = ee(o, { enabled: !v && !!o && !l && !_ }).data?.suggested_counterpart?.id;
|
|
40
54
|
d(() => {
|
|
41
|
-
!
|
|
55
|
+
!v && !ze && !l && !_ && I && F(I);
|
|
42
56
|
}, [
|
|
57
|
+
l,
|
|
58
|
+
_,
|
|
43
59
|
v,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
U
|
|
60
|
+
ze,
|
|
61
|
+
I,
|
|
62
|
+
F
|
|
48
63
|
]), d(() => {
|
|
49
|
-
|
|
50
|
-
}, [
|
|
64
|
+
Re.current !== l && (Re.current = l, P(), M(void 0));
|
|
65
|
+
}, [l, P]), d(() => {
|
|
51
66
|
let e = setTimeout(() => {
|
|
52
|
-
|
|
53
|
-
},
|
|
67
|
+
Ae(x.trim());
|
|
68
|
+
}, me);
|
|
54
69
|
return () => clearTimeout(e);
|
|
55
|
-
}, [
|
|
56
|
-
let
|
|
70
|
+
}, [x]);
|
|
71
|
+
let L = r({
|
|
57
72
|
sort: "counterpart_name",
|
|
58
73
|
order: "asc",
|
|
59
|
-
limit:
|
|
60
|
-
counterpart_name__icontains:
|
|
74
|
+
limit: pe,
|
|
75
|
+
counterpart_name__icontains: ke || void 0,
|
|
61
76
|
is_vendor: !0,
|
|
62
|
-
enabled: !
|
|
63
|
-
}),
|
|
64
|
-
|
|
77
|
+
enabled: !v && (S === "edit" || !S && !l) && ve && De
|
|
78
|
+
}), R = se({
|
|
79
|
+
selectedId: l,
|
|
80
|
+
enabled: De
|
|
81
|
+
}), Ve = i(), He = a(), z = ce({
|
|
82
|
+
view: je,
|
|
83
|
+
setView: Me,
|
|
84
|
+
selectedId: Ne,
|
|
85
|
+
setSelectedId: Pe,
|
|
86
|
+
messages: te,
|
|
87
|
+
counterpartType: "vendor",
|
|
88
|
+
counterpart: R.counterpart,
|
|
89
|
+
primaryAddress: R.primaryAddress,
|
|
90
|
+
includeBankAccount: !1
|
|
91
|
+
}), { openCreate: Ue, openEdit: We, close: Ge, setValues: B, submit: Ke } = z, V = f(() => {
|
|
92
|
+
let e = R.counterpart;
|
|
65
93
|
if (!e) return;
|
|
66
|
-
if (
|
|
67
|
-
name:
|
|
68
|
-
email:
|
|
69
|
-
methodLabel:
|
|
70
|
-
|
|
94
|
+
if (R.isBankAccountsLoading) return {
|
|
95
|
+
name: c(e),
|
|
96
|
+
email: s(e),
|
|
97
|
+
methodLabel: b.paymentMethodLoading,
|
|
98
|
+
hasPaymentInstructions: !1
|
|
71
99
|
};
|
|
72
|
-
if (
|
|
73
|
-
name:
|
|
74
|
-
email:
|
|
75
|
-
methodLabel:
|
|
76
|
-
|
|
100
|
+
if (R.isBankAccountsError) return {
|
|
101
|
+
name: c(e),
|
|
102
|
+
email: s(e),
|
|
103
|
+
methodLabel: b.paymentMethodUnavailable,
|
|
104
|
+
hasPaymentInstructions: !1
|
|
77
105
|
};
|
|
78
|
-
let t =
|
|
106
|
+
let t = ie(R.bankAccounts);
|
|
79
107
|
return {
|
|
80
|
-
name:
|
|
81
|
-
email:
|
|
82
|
-
methodLabel: t ?
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
label: w.accountHolder,
|
|
86
|
-
value: t.account_holder_name ?? ""
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
label: w.routingNumber,
|
|
90
|
-
value: t.routing_number ?? ""
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
label: w.accountNumber,
|
|
94
|
-
value: t.account_number ?? "",
|
|
95
|
-
maskedValue: t.account_number ? a(t.account_number) : ""
|
|
96
|
-
}
|
|
97
|
-
] : []
|
|
108
|
+
name: c(e),
|
|
109
|
+
email: s(e),
|
|
110
|
+
methodLabel: t ? b.paymentInstructionsValue(t.account_number?.slice(-4) ?? "") : b.noMethod,
|
|
111
|
+
hasPaymentInstructions: !!t
|
|
98
112
|
};
|
|
99
113
|
}, [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
]),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (!
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
R.bankAccounts,
|
|
115
|
+
R.counterpart,
|
|
116
|
+
R.isBankAccountsError,
|
|
117
|
+
R.isBankAccountsLoading,
|
|
118
|
+
b
|
|
119
|
+
]), H = l === _ ? _e : void 0, U = f(() => ge(R.bankAccounts, H), [R.bankAccounts, H]), qe = f(() => ie(R.bankAccounts)?.id, [R.bankAccounts]), W = !R.counterpart || R.isLoading || R.isFetching || R.isError || R.isAddressesLoading || R.isAddressesFetching || R.isAddressesError || R.isBankAccountsLoading || R.isBankAccountsFetching || R.isBankAccountsError, G = u(() => {
|
|
120
|
+
Ge(), C(void 0), w(!1);
|
|
121
|
+
}, [Ge]), K = f(() => ue(xe), [xe]), q = u((e) => {
|
|
122
|
+
if (w(!1), e === "edit") Pe(l), We();
|
|
123
|
+
else {
|
|
124
|
+
Ue();
|
|
125
|
+
let e = x.trim();
|
|
126
|
+
B((t) => ({
|
|
127
|
+
...t,
|
|
128
|
+
entityType: "organization",
|
|
129
|
+
legalName: e || K?.legalName || t.legalName,
|
|
130
|
+
email: K?.email || t.email,
|
|
131
|
+
phone: K?.phone || t.phone,
|
|
132
|
+
address: K?.address ?? t.address
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
C(e);
|
|
136
|
+
}, [
|
|
137
|
+
l,
|
|
138
|
+
Ue,
|
|
139
|
+
We,
|
|
140
|
+
x,
|
|
141
|
+
B,
|
|
142
|
+
K
|
|
143
|
+
]), Je = u(() => {
|
|
144
|
+
let e = U ? he(U) : h;
|
|
145
|
+
k.current = e, O(e), A(void 0), E(!0);
|
|
146
|
+
}, [U]), Ye = u(() => {
|
|
147
|
+
N ? y(P) : P();
|
|
148
|
+
}, [
|
|
149
|
+
P,
|
|
150
|
+
y,
|
|
151
|
+
N
|
|
152
|
+
]), J = u(() => {
|
|
153
|
+
G(), P();
|
|
154
|
+
}, [P, G]), Y = Fe || N, X = u((e) => {
|
|
155
|
+
let t = () => {
|
|
156
|
+
J(), e();
|
|
114
157
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
158
|
+
Y ? y(t) : t();
|
|
159
|
+
}, [
|
|
160
|
+
y,
|
|
161
|
+
J,
|
|
162
|
+
Y
|
|
163
|
+
]), Xe = u(() => {
|
|
164
|
+
Y ? y(J) : J();
|
|
165
|
+
}, [
|
|
166
|
+
y,
|
|
167
|
+
J,
|
|
168
|
+
Y
|
|
169
|
+
]), Ze = u(async () => {
|
|
170
|
+
let e = l, t = !1, n = Ie.current;
|
|
171
|
+
if (!g(n, k.current)) {
|
|
172
|
+
let e = oe(n);
|
|
173
|
+
if (Object.keys(e).length > 0) return A(e), E(!0), { ok: !1 };
|
|
174
|
+
}
|
|
175
|
+
if (S === "edit" && W) return { ok: !1 };
|
|
176
|
+
if (S) {
|
|
177
|
+
let n = await Ke();
|
|
178
|
+
if (!n.ok) return { ok: !1 };
|
|
179
|
+
S === "create" ? (e = n.counterpartId, t = !0, G(), M(void 0), F(e)) : (G(), e = n.counterpartId ?? e);
|
|
180
|
+
}
|
|
181
|
+
if (!e) return { ok: !0 };
|
|
182
|
+
let r = R.isBankAccountsLoading || R.isBankAccountsFetching || R.isBankAccountsError;
|
|
183
|
+
if (g(n, k.current)) {
|
|
184
|
+
if (t) return {
|
|
185
|
+
ok: !0,
|
|
186
|
+
counterpartId: e
|
|
187
|
+
};
|
|
188
|
+
let n = j ?? H;
|
|
189
|
+
return n ? (E(!1), {
|
|
190
|
+
ok: !0,
|
|
191
|
+
counterpartId: e,
|
|
192
|
+
counterpartBankAccountId: n
|
|
193
|
+
}) : r ? { ok: !1 } : (E(!1), {
|
|
194
|
+
ok: !0,
|
|
195
|
+
counterpartId: e,
|
|
196
|
+
counterpartBankAccountId: qe
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (r) return { ok: !1 };
|
|
200
|
+
A(void 0);
|
|
201
|
+
let i = ae(R.bankAccounts, j ?? U?.id), a;
|
|
202
|
+
return i.kind === "update" ? (await He.mutateAsync({
|
|
121
203
|
path: {
|
|
122
|
-
counterpart_id:
|
|
123
|
-
bank_account_id:
|
|
204
|
+
counterpart_id: e,
|
|
205
|
+
bank_account_id: i.bankAccountId
|
|
124
206
|
},
|
|
125
|
-
body: re(
|
|
126
|
-
}),
|
|
207
|
+
body: re(n, { includeAchDefaults: i.includeAchDefaults })
|
|
208
|
+
}), a = i.bankAccountId) : a = (await Ve.mutateAsync({
|
|
209
|
+
path: { counterpart_id: e },
|
|
210
|
+
body: ne(n, { isDefaultForCurrency: i.isDefaultForCurrency })
|
|
211
|
+
}))?.id, k.current = n, M(a), E(!1), {
|
|
127
212
|
ok: !0,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let r = await q.mutateAsync({
|
|
131
|
-
path: { counterpart_id: v },
|
|
132
|
-
body: ne(e, { isDefaultForCurrency: n.isDefaultForCurrency })
|
|
133
|
-
});
|
|
134
|
-
return z(r?.id), {
|
|
135
|
-
ok: !0,
|
|
136
|
-
counterpartBankAccountId: r?.id
|
|
213
|
+
counterpartId: e,
|
|
214
|
+
counterpartBankAccountId: a
|
|
137
215
|
};
|
|
138
216
|
}, [
|
|
217
|
+
P,
|
|
218
|
+
G,
|
|
219
|
+
l,
|
|
220
|
+
Ve,
|
|
221
|
+
R.bankAccounts,
|
|
222
|
+
R.isBankAccountsError,
|
|
223
|
+
R.isBankAccountsFetching,
|
|
224
|
+
R.isBankAccountsLoading,
|
|
225
|
+
S,
|
|
226
|
+
W,
|
|
227
|
+
H,
|
|
228
|
+
qe,
|
|
229
|
+
F,
|
|
230
|
+
U,
|
|
231
|
+
Ke,
|
|
232
|
+
He,
|
|
233
|
+
j
|
|
234
|
+
]), Qe = f(() => (L.data?.data ?? []).map((e) => ({
|
|
235
|
+
name: c(e),
|
|
236
|
+
email: s(e),
|
|
237
|
+
onSelect: () => {
|
|
238
|
+
X(() => F(e.id));
|
|
239
|
+
}
|
|
240
|
+
})), [
|
|
241
|
+
L.data,
|
|
139
242
|
X,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
243
|
+
F
|
|
244
|
+
]), $e = u((e) => {
|
|
245
|
+
w(!0), B((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
|
|
246
|
+
...t,
|
|
247
|
+
...e,
|
|
248
|
+
firstName: t.firstName || t.legalName,
|
|
249
|
+
legalName: t.legalName
|
|
250
|
+
} : e.entityType === "organization" && t.entityType !== "organization" ? {
|
|
251
|
+
...t,
|
|
252
|
+
...e,
|
|
253
|
+
legalName: t.legalName || [t.firstName, t.lastName].filter(Boolean).join(" ")
|
|
254
|
+
} : {
|
|
255
|
+
...t,
|
|
256
|
+
...e
|
|
257
|
+
});
|
|
258
|
+
}, [B]), et = u((e) => {
|
|
259
|
+
w(!0), B((t) => ({
|
|
260
|
+
...t,
|
|
261
|
+
address: {
|
|
262
|
+
...t.address,
|
|
263
|
+
...e
|
|
264
|
+
}
|
|
265
|
+
}));
|
|
266
|
+
}, [B]), Z = {
|
|
267
|
+
query: x,
|
|
268
|
+
onQueryChange: Oe,
|
|
269
|
+
isLoading: !ve || !Ee || !!l && R.isLoading || L.isFetching,
|
|
270
|
+
onAddVendor: () => {
|
|
271
|
+
X(() => q("create"));
|
|
272
|
+
},
|
|
273
|
+
results: Qe
|
|
274
|
+
}, Q = we && (S === "create" || !W) ? {
|
|
275
|
+
isOpen: T,
|
|
276
|
+
values: D,
|
|
277
|
+
errors: Le,
|
|
278
|
+
onOpen: Je,
|
|
279
|
+
onCancel: Ye,
|
|
280
|
+
onChange: (e) => {
|
|
281
|
+
O((t) => ({
|
|
282
|
+
...t,
|
|
283
|
+
...e
|
|
284
|
+
})), A(void 0);
|
|
285
|
+
}
|
|
286
|
+
} : void 0, $ = {
|
|
287
|
+
prepareVendorForSave: Ze,
|
|
288
|
+
hasUnsavedVendorChanges: Y,
|
|
289
|
+
isEditingPayTo: !!S || T,
|
|
290
|
+
activePayToOperation: S ? "vendor" : T ? V?.hasPaymentInstructions ? "existingInstructions" : "missingInstructions" : void 0,
|
|
291
|
+
discardPayToEdits: J,
|
|
292
|
+
openPaymentInstructions: Je
|
|
293
|
+
};
|
|
294
|
+
return S ? {
|
|
161
295
|
mode: "creating",
|
|
162
|
-
newVendorForm: /* @__PURE__ */ de
|
|
163
|
-
mode:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
onDirtyChange: F
|
|
296
|
+
newVendorForm: /* @__PURE__ */ fe(de, {
|
|
297
|
+
mode: S,
|
|
298
|
+
values: z.values,
|
|
299
|
+
errors: z.errors,
|
|
300
|
+
onChange: $e,
|
|
301
|
+
onAddressChange: et,
|
|
302
|
+
sectionsToExpand: z.sectionsToExpand,
|
|
303
|
+
onAddressExpand: z.expandAddress,
|
|
304
|
+
onCancel: Xe,
|
|
305
|
+
paymentInstructions: Q,
|
|
306
|
+
search: S === "edit" && !v ? Z : void 0
|
|
174
307
|
}),
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
isOpen: ve,
|
|
187
|
-
values: j,
|
|
188
|
-
errors: ye,
|
|
189
|
-
onOpen: () => {
|
|
190
|
-
A(!0), X && (M({
|
|
191
|
-
accountHolderName: X.account_holder_name ?? "",
|
|
192
|
-
routingNumber: X.routing_number ?? "",
|
|
193
|
-
accountNumber: X.account_number ?? ""
|
|
194
|
-
}), z(X.id));
|
|
195
|
-
},
|
|
196
|
-
onChange: (e) => {
|
|
197
|
-
M((t) => ({
|
|
198
|
-
...t,
|
|
199
|
-
...e
|
|
200
|
-
})), L(void 0);
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
savePaymentInstructions: Q,
|
|
204
|
-
hasUnsavedVendorChanges: I
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
let we = !x || !T || !!v && K.isLoading;
|
|
208
|
-
return {
|
|
308
|
+
...$
|
|
309
|
+
} : V ? {
|
|
310
|
+
mode: "resolved",
|
|
311
|
+
summary: V,
|
|
312
|
+
onEdit: Se && !W ? () => q("edit") : void 0,
|
|
313
|
+
paymentInstructions: Q ? {
|
|
314
|
+
...Q,
|
|
315
|
+
canEditExisting: Ce
|
|
316
|
+
} : void 0,
|
|
317
|
+
...$
|
|
318
|
+
} : {
|
|
209
319
|
mode: "selecting",
|
|
210
|
-
error:
|
|
211
|
-
search:
|
|
212
|
-
|
|
213
|
-
onQueryChange: D,
|
|
214
|
-
isLoading: we || G.isFetching,
|
|
215
|
-
onAddVendor: () => k("create"),
|
|
216
|
-
results: xe
|
|
217
|
-
},
|
|
218
|
-
savePaymentInstructions: Q,
|
|
219
|
-
hasUnsavedVendorChanges: I
|
|
320
|
+
error: L.isError ? b.searchFailed : R.isError ? b.vendorDetailsFailed : be,
|
|
321
|
+
search: Z,
|
|
322
|
+
...$
|
|
220
323
|
};
|
|
221
324
|
}
|
|
222
325
|
//#endregion
|
|
@@ -1,129 +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 { extractApiErrorMessage as t } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
8
|
-
import { useUpdatePayableMutation as n } from "../../data-access/dist/index13.js";
|
|
9
|
-
import { useCounterpartBankAccountsQuery as r, useCreateCounterpartBankAccountMutation as i } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
10
|
-
import { useUpdatePayableCounterpartBankAccountMutation as a } from "../../data-access/dist/index14.js";
|
|
11
|
-
import "../../data-access/dist/index.js";
|
|
12
|
-
import { counterpartFormBankAccountToCreatePayload as o, counterpartFormBankAccountToUpdatePayload as s, getAchInstructions as c, isAchCompatibleBankAccount as l, resolveCounterpartBankAccountWrite as u, validateAchFormValues as d } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
13
|
-
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
14
|
-
import { useCallback as f, useEffect as p, useRef as m, useState as h } from "react";
|
|
15
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
function y({ payableId: t, counterpartId: l, currentBankAccountId: y, canReadCounterpartBankAccounts: b = !0, saveErrorMessage: x, linkErrorMessage: S }) {
|
|
29
|
-
let [C, w] = h(!1), [T, E] = h(_), [D, O] = h(), k = r(l, { enabled: b }), A = k.data?.data, j = i(), M = a(), N = n(), P = m(void 0), F = m(!1);
|
|
30
|
-
p(() => {
|
|
31
|
-
P.current = void 0;
|
|
32
|
-
}, [l, t]);
|
|
33
|
-
let I = f(() => {
|
|
34
|
-
if (C) return;
|
|
35
|
-
let e = k.isFetching ? void 0 : v(A, y);
|
|
36
|
-
E(e ? {
|
|
37
|
-
accountHolderName: e.account_holder_name ?? "",
|
|
38
|
-
routingNumber: e.routing_number ?? "",
|
|
39
|
-
accountNumber: e.account_number ?? ""
|
|
40
|
-
} : _), P.current = e?.id ?? P.current, F.current = !k.isFetching, O(void 0), w(!0);
|
|
41
|
-
}, [
|
|
42
|
-
A,
|
|
43
|
-
k.isFetching,
|
|
44
|
-
y,
|
|
45
|
-
C
|
|
46
|
-
]);
|
|
47
|
-
p(() => {
|
|
48
|
-
if (!C || F.current || k.isFetching) return;
|
|
49
|
-
F.current = !0;
|
|
50
|
-
let e = v(A, y);
|
|
51
|
-
e && (E((t) => t.accountHolderName === "" && t.routingNumber === "" && t.accountNumber === "" ? {
|
|
52
|
-
accountHolderName: e.account_holder_name ?? "",
|
|
53
|
-
routingNumber: e.routing_number ?? "",
|
|
54
|
-
accountNumber: e.account_number ?? ""
|
|
55
|
-
} : t), P.current = e.id);
|
|
56
|
-
}, [
|
|
57
|
-
C,
|
|
58
|
-
k.isFetching,
|
|
59
|
-
A,
|
|
60
|
-
y,
|
|
61
|
-
b
|
|
62
|
-
]);
|
|
63
|
-
let L = f(() => {
|
|
64
|
-
w(!1);
|
|
65
|
-
}, []), R = f((e) => {
|
|
66
|
-
E((t) => ({
|
|
67
|
-
...t,
|
|
68
|
-
...e
|
|
69
|
-
}));
|
|
70
|
-
}, []), z = f(async () => {
|
|
71
|
-
if (!t || !l) return !1;
|
|
72
|
-
let n = d(T);
|
|
73
|
-
if (Object.keys(n).length > 0) return O(n), !1;
|
|
74
|
-
if (O(void 0), !b || k.isFetching || k.isError) return e.error(x), !1;
|
|
75
|
-
let r = P.current;
|
|
76
|
-
try {
|
|
77
|
-
let e = u(A, r ?? c(A)?.id);
|
|
78
|
-
e.kind === "update" ? (await M.mutateAsync({
|
|
79
|
-
path: {
|
|
80
|
-
counterpart_id: l,
|
|
81
|
-
bank_account_id: e.bankAccountId
|
|
82
|
-
},
|
|
83
|
-
body: s(T, { includeAchDefaults: e.includeAchDefaults }),
|
|
84
|
-
payableId: t,
|
|
85
|
-
makeDefault: e.includeAchDefaults || !A?.find((t) => t.id === e.bankAccountId)?.is_default_for_currency
|
|
86
|
-
}), r = e.bankAccountId) : r = (await j.mutateAsync({
|
|
87
|
-
path: { counterpart_id: l },
|
|
88
|
-
body: o(T, { isDefaultForCurrency: e.isDefaultForCurrency })
|
|
89
|
-
}))?.id, P.current = r;
|
|
90
|
-
} catch (t) {
|
|
91
|
-
return e.error(g(x, t)), !1;
|
|
92
|
-
}
|
|
93
|
-
if (r !== y) try {
|
|
94
|
-
await N.mutateAsync({
|
|
95
|
-
path: { payable_id: t },
|
|
96
|
-
body: { counterpart_bank_account_id: r }
|
|
97
|
-
});
|
|
98
|
-
} catch (t) {
|
|
99
|
-
return e.error(g(S, t)), !1;
|
|
100
|
-
}
|
|
101
|
-
return w(!1), !0;
|
|
102
|
-
}, [
|
|
103
|
-
A,
|
|
104
|
-
k.isError,
|
|
105
|
-
k.isFetching,
|
|
106
|
-
b,
|
|
107
|
-
l,
|
|
108
|
-
j,
|
|
109
|
-
y,
|
|
110
|
-
S,
|
|
111
|
-
t,
|
|
112
|
-
x,
|
|
113
|
-
M,
|
|
114
|
-
N,
|
|
115
|
-
T
|
|
116
|
-
]);
|
|
117
|
-
return {
|
|
118
|
-
isOpen: C,
|
|
119
|
-
values: T,
|
|
120
|
-
errors: D,
|
|
121
|
-
isSaving: j.isPending || M.isPending || N.isPending,
|
|
122
|
-
open: I,
|
|
123
|
-
close: L,
|
|
124
|
-
onChange: R,
|
|
125
|
-
save: z
|
|
126
|
-
};
|
|
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;
|
|
10
|
+
}
|
|
11
|
+
t(e.slice(e.indexOf(",") + 1));
|
|
12
|
+
}, r.readAsDataURL(e);
|
|
13
|
+
});
|
|
127
14
|
}
|
|
128
15
|
//#endregion
|
|
129
|
-
export {
|
|
16
|
+
export { e as encodeFileToBase64 };
|