@tesouro/embedded-components-react 0.11.189 → 0.11.190
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 +12 -8
- package/dist/index.d.ts +16 -1
- package/dist/index.js +40 -39
- package/dist/lib/BillPayWidget.d.ts +16 -1
- package/dist/lib/BillPayWidget.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +180 -180
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +62 -62
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +32 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index14.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +20 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index33.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index37.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js +101 -58
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js +19 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index14.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index15.js +169 -138
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +227 -204
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index18.js +208 -204
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index19.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index21.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index23.js +212 -212
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index9.js +9 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js +43 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +66 -64
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/index.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +21 -21
- package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index7.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -4,91 +4,91 @@
|
|
|
4
4
|
"use client";
|
|
5
5
|
import { toast as e } from "../../../../../../node_modules/sonner/dist/index.js";
|
|
6
6
|
import { hasAnyScope as t } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
7
|
-
import { Scope as
|
|
7
|
+
import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
|
|
8
8
|
import "../../../../shared/data-access/dist/index.js";
|
|
9
9
|
import "../../../../shared/ui/dist/index.js";
|
|
10
|
-
import { useWidgetConfig as
|
|
10
|
+
import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
11
11
|
import "../../../../shared/feature/dist/index.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import "
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { useCounterpartsQuery as ue } from "../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
19
|
-
import { useCreateCounterpartBankAccountMutation as de, useUpdateCounterpartBankAccountMutation as fe } from "../../../../shared/counterpart-management/data-access/dist/index4.js";
|
|
20
|
-
import { useCounterpartDetails as pe } from "../../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
21
|
-
import { useCounterpartForm as me } from "../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
12
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as i } from "../../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
13
|
+
import { counterpartFormBankAccountToCreatePayload as ee, counterpartFormBankAccountToUpdatePayload as te, getAchInstructions as a, getCounterpartEmail as o, getCounterpartName as s, getPayableAchInstructions as c, hasCounterpartFormErrors as ne, isAchCompatibleBankAccount as l, resolveCounterpartBankAccountWrite as re, validateAchFormValues as ie, validateCounterpartForm as ae } from "../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
14
|
+
import { useCounterpartsQuery as oe } from "../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
15
|
+
import { useCreateCounterpartBankAccountMutation as se, useUpdateCounterpartBankAccountMutation as ce } from "../../../../shared/counterpart-management/data-access/dist/index4.js";
|
|
16
|
+
import { useCounterpartDetails as le } from "../../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
17
|
+
import { useCounterpartForm as ue } from "../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
22
18
|
import "../../../../shared/counterpart-management/feature/dist/index.js";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
19
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as de } from "./index32.js";
|
|
20
|
+
import { usePayableSuggestionsQuery as fe } from "../../data-access/dist/index21.js";
|
|
21
|
+
import "../../data-access/dist/index.js";
|
|
22
|
+
import { resolvePaymentInstructionsGestures as pe } from "./index18.js";
|
|
23
|
+
import { buildVendorPrefill as me, canAutoCreateVendor as he, toCounterpartRawData as ge } from "./index34.js";
|
|
24
|
+
import { VendorInlineForm as _e } from "./index35.js";
|
|
25
|
+
import { useCallback as u, useEffect as d, useLayoutEffect as ve, useMemo as f, useRef as p, useState as m } from "react";
|
|
26
|
+
import { jsx as ye } from "react/jsx-runtime";
|
|
27
27
|
// ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js
|
|
28
|
-
var
|
|
28
|
+
var be = 10, xe = 300, h = {
|
|
29
29
|
accountHolderName: "",
|
|
30
30
|
routingNumber: "",
|
|
31
31
|
accountNumber: ""
|
|
32
32
|
};
|
|
33
|
-
function
|
|
33
|
+
function Se(e) {
|
|
34
34
|
return {
|
|
35
35
|
accountHolderName: e.account_holder_name ?? "",
|
|
36
36
|
routingNumber: e.routing_number ?? "",
|
|
37
37
|
accountNumber: e.account_number ?? ""
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function g(e, t) {
|
|
41
41
|
return e.accountHolderName.trim() === t.accountHolderName.trim() && e.routingNumber.trim() === t.routingNumber.trim() && e.accountNumber.trim() === t.accountNumber.trim();
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return e?.find((e) => e.id === t &&
|
|
43
|
+
function Ce(e, t) {
|
|
44
|
+
return e?.find((e) => e.id === t && l(e)) ?? a(e);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
let S =
|
|
48
|
-
...
|
|
49
|
-
...
|
|
50
|
-
}), [
|
|
51
|
-
...
|
|
46
|
+
function _({ payableId: a, counterpartId: l, payableCounterpartId: _, payableCounterpartBankAccountId: we, isVendorKnown: Te = !0, onCounterpartChange: Ee, requiredError: De, extractedVendor: v, readOnly: y = !1, canEditVendor: b = !0, canEditPaymentInstructions: Oe = !0, canAddPaymentInstructions: ke = !0, confirmDiscard: x = (e) => e(), labels: Ae }) {
|
|
47
|
+
let S = f(() => ({
|
|
48
|
+
...de,
|
|
49
|
+
...Ae
|
|
50
|
+
}), [Ae]), je = Ae?.messages, C = f(() => ({
|
|
51
|
+
...i,
|
|
52
52
|
...je
|
|
53
|
-
}), [je]), { initResponse: Me } =
|
|
54
|
-
|
|
55
|
-
let
|
|
56
|
-
k(!1),
|
|
57
|
-
}, []),
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
}), [je]), { initResponse: Me } = r(), Ne = t(Me?.scopes, [n.CounterpartReadOrg]), [w, Pe] = m(""), [T, Fe] = m(""), Ie = p(T), [E, Le] = m(), [Re, ze] = m("none"), [Be, Ve] = m(), [He, D] = m(!1), [O, k] = m(!1), [A, j] = m(h), M = p(A);
|
|
54
|
+
M.current = A;
|
|
55
|
+
let N = p(h), [Ue, P] = m(), [We, Ge] = m(), Ke = We?.bankAccountId, F = p(void 0), qe = p(l), [Je, Ye] = m(!1), [Xe, Ze] = m(!1), I = p(void 0), L = u(() => {
|
|
56
|
+
k(!1), j(h), N.current = h, P(void 0);
|
|
57
|
+
}, []), R = u((e) => {
|
|
58
|
+
Ye(!0), Ee(e);
|
|
59
|
+
}, [Ee]), Qe = fe(a, { enabled: !y && !!a && !l && !_ }), $e = Qe.data?.suggested_counterpart?.id, et = v?.name;
|
|
60
|
+
d(() => {
|
|
61
|
+
y || Je || l || _ || !$e || R($e);
|
|
62
62
|
}, [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
]),
|
|
70
|
-
|
|
71
|
-
}, [
|
|
63
|
+
l,
|
|
64
|
+
_,
|
|
65
|
+
y,
|
|
66
|
+
Je,
|
|
67
|
+
$e,
|
|
68
|
+
R
|
|
69
|
+
]), d(() => {
|
|
70
|
+
qe.current !== l && (qe.current = l, L(), Ge((e) => e?.counterpartId === l ? e : void 0));
|
|
71
|
+
}, [l, L]), d(() => {
|
|
72
72
|
let e = setTimeout(() => {
|
|
73
73
|
Fe(w.trim());
|
|
74
|
-
},
|
|
74
|
+
}, xe);
|
|
75
75
|
return () => clearTimeout(e);
|
|
76
76
|
}, [w]);
|
|
77
|
-
let z =
|
|
77
|
+
let z = f(() => me(v), [v]), B = z?.bankAccount, tt = f(() => he(v), [v]), nt = E === "create" ? !g(A, B ?? h) : O && !g(A, N.current), rt = !y && (E === "edit" || E === "create" && !!z), V = oe({
|
|
78
78
|
sort: "counterpart_name",
|
|
79
79
|
order: "asc",
|
|
80
|
-
limit:
|
|
80
|
+
limit: be,
|
|
81
81
|
counterpart_name__icontains: T || void 0,
|
|
82
82
|
is_vendor: !0,
|
|
83
|
-
enabled: (rt || !
|
|
83
|
+
enabled: (rt || !y && !E && !l) && Te && Ne
|
|
84
84
|
});
|
|
85
|
-
|
|
85
|
+
d(() => {
|
|
86
86
|
V.isPlaceholderData || (Ie.current = T);
|
|
87
87
|
}, [T, V.isPlaceholderData]);
|
|
88
|
-
let it = V.isPlaceholderData && Ie.current !== T, H =
|
|
89
|
-
selectedId:
|
|
88
|
+
let it = V.isPlaceholderData && Ie.current !== T, H = le({
|
|
89
|
+
selectedId: l,
|
|
90
90
|
enabled: Ne
|
|
91
|
-
}), at =
|
|
91
|
+
}), at = se(), ot = ce(), U = ue({
|
|
92
92
|
view: Re,
|
|
93
93
|
setView: ze,
|
|
94
94
|
selectedId: Be,
|
|
@@ -98,25 +98,25 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
98
98
|
counterpart: H.counterpart,
|
|
99
99
|
primaryAddress: H.primaryAddress,
|
|
100
100
|
includeBankAccount: !1
|
|
101
|
-
}), { openCreate: st, openEdit: ct, close: lt, setValues: W, submit: ut, values: dt } = U, G =
|
|
101
|
+
}), { openCreate: st, openEdit: ct, close: lt, setValues: W, submit: ut, values: dt } = U, G = f(() => {
|
|
102
102
|
let e = H.counterpart;
|
|
103
103
|
if (!e) return;
|
|
104
104
|
if (H.isBankAccountsLoading) return {
|
|
105
|
-
name:
|
|
106
|
-
email:
|
|
105
|
+
name: s(e),
|
|
106
|
+
email: o(e),
|
|
107
107
|
methodLabel: S.paymentMethodLoading,
|
|
108
108
|
hasPaymentInstructions: !1
|
|
109
109
|
};
|
|
110
110
|
if (H.isBankAccountsError) return {
|
|
111
|
-
name:
|
|
112
|
-
email:
|
|
111
|
+
name: s(e),
|
|
112
|
+
email: o(e),
|
|
113
113
|
methodLabel: S.paymentMethodUnavailable,
|
|
114
114
|
hasPaymentInstructions: !1
|
|
115
115
|
};
|
|
116
|
-
let t =
|
|
116
|
+
let t = c(H.bankAccounts);
|
|
117
117
|
return {
|
|
118
|
-
name:
|
|
119
|
-
email:
|
|
118
|
+
name: s(e),
|
|
119
|
+
email: o(e),
|
|
120
120
|
methodLabel: t ? S.paymentInstructionsValue(t.account_number?.slice(-4) ?? "") : S.noMethod,
|
|
121
121
|
hasPaymentInstructions: !!t
|
|
122
122
|
};
|
|
@@ -126,29 +126,29 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
126
126
|
H.isBankAccountsError,
|
|
127
127
|
H.isBankAccountsLoading,
|
|
128
128
|
S
|
|
129
|
-
]), K =
|
|
129
|
+
]), K = f(() => {
|
|
130
130
|
let e = et?.trim();
|
|
131
|
-
if (!e ||
|
|
131
|
+
if (!e || l || E) return;
|
|
132
132
|
let t = B?.accountNumber;
|
|
133
133
|
return {
|
|
134
134
|
name: e,
|
|
135
|
-
email:
|
|
135
|
+
email: v?.email ?? "",
|
|
136
136
|
description: tt ? S.pendingVendorDescription : S.pendingVendorIncompleteDescription,
|
|
137
137
|
methodLabel: t ? S.paymentInstructionsValue(t.slice(-4)) : "",
|
|
138
138
|
hasPaymentInstructions: !!t
|
|
139
139
|
};
|
|
140
140
|
}, [
|
|
141
|
-
|
|
141
|
+
l,
|
|
142
142
|
B?.accountNumber,
|
|
143
|
-
|
|
143
|
+
v?.email,
|
|
144
144
|
et,
|
|
145
145
|
E,
|
|
146
146
|
tt,
|
|
147
147
|
S
|
|
148
|
-
]), ft = !!K && !tt, q =
|
|
149
|
-
lt(), Le(void 0), D(!1),
|
|
150
|
-
}, [lt]), X =
|
|
151
|
-
if (D(!1),
|
|
148
|
+
]), ft = !!K && !tt, q = l === _ ? we : void 0, J = f(() => Ce(H.bankAccounts, q), [H.bankAccounts, q]), pt = f(() => c(H.bankAccounts)?.id, [H.bankAccounts]), mt = !H.counterpart || H.isLoading || H.isFetching || H.isError || H.isBankAccountsLoading || H.isBankAccountsFetching || H.isBankAccountsError, ht = mt || H.isAddressesLoading || H.isAddressesFetching || H.isAddressesError, gt = b && !mt && H.isAddressesError ? { onRetry: H.refetchAddresses } : void 0, Y = u(() => {
|
|
149
|
+
lt(), Le(void 0), D(!1), F.current = void 0;
|
|
150
|
+
}, [lt]), X = u((e) => {
|
|
151
|
+
if (D(!1), F.current = void 0, e === "edit") Ve(l), ct();
|
|
152
152
|
else {
|
|
153
153
|
st();
|
|
154
154
|
let e = w.trim();
|
|
@@ -159,150 +159,150 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
159
159
|
email: z?.email || t.email,
|
|
160
160
|
phone: z?.phone || t.phone,
|
|
161
161
|
address: z?.address ?? t.address
|
|
162
|
-
})),
|
|
162
|
+
})), j(B ?? h), P(void 0), N.current = h;
|
|
163
163
|
}
|
|
164
164
|
Le(e);
|
|
165
165
|
}, [
|
|
166
|
-
|
|
166
|
+
l,
|
|
167
167
|
B,
|
|
168
168
|
st,
|
|
169
169
|
ct,
|
|
170
170
|
w,
|
|
171
171
|
W,
|
|
172
172
|
z
|
|
173
|
-
]), _t = U.revealErrors, vt =
|
|
174
|
-
|
|
175
|
-
let e = B ?
|
|
176
|
-
Object.keys(e).length &&
|
|
173
|
+
]), _t = U.revealErrors, vt = u(() => {
|
|
174
|
+
Ye(!0), X("create"), _t();
|
|
175
|
+
let e = B ? ie(B, C) : {};
|
|
176
|
+
Object.keys(e).length && P(e);
|
|
177
177
|
}, [
|
|
178
178
|
B,
|
|
179
179
|
C,
|
|
180
180
|
X,
|
|
181
181
|
_t
|
|
182
|
-
]), yt =
|
|
183
|
-
|
|
182
|
+
]), yt = p(!1), bt = !yt.current && !y && b && Te && !_ && !$e && !Je && ft, xt = bt && !Qe.isLoading;
|
|
183
|
+
ve(() => {
|
|
184
184
|
xt && (yt.current = !0, vt());
|
|
185
185
|
}, [vt, xt]);
|
|
186
|
-
let St =
|
|
187
|
-
let e = J ?
|
|
188
|
-
|
|
189
|
-
}, [J]), Ct =
|
|
186
|
+
let St = u(() => {
|
|
187
|
+
let e = J ? Se(J) : h;
|
|
188
|
+
N.current = e, j(e), P(void 0), k(!0);
|
|
189
|
+
}, [J]), Ct = u((e) => {
|
|
190
190
|
let t = {
|
|
191
|
-
...
|
|
191
|
+
...M.current,
|
|
192
192
|
...e
|
|
193
193
|
};
|
|
194
|
-
|
|
195
|
-
let
|
|
196
|
-
|
|
194
|
+
M.current = t, j(t);
|
|
195
|
+
let n = ie(t, C);
|
|
196
|
+
P((e) => {
|
|
197
197
|
if (!e) return e;
|
|
198
198
|
let t = { ...e };
|
|
199
|
-
for (let e of Object.keys(t))
|
|
199
|
+
for (let e of Object.keys(t)) n[e] || delete t[e];
|
|
200
200
|
return Object.keys(t).length ? t : void 0;
|
|
201
201
|
});
|
|
202
|
-
}, [C]), wt =
|
|
203
|
-
nt ?
|
|
202
|
+
}, [C]), wt = u(() => {
|
|
203
|
+
nt ? x(L) : L();
|
|
204
204
|
}, [
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
L,
|
|
206
|
+
x,
|
|
207
207
|
nt
|
|
208
|
-
]), Z =
|
|
209
|
-
Y(),
|
|
210
|
-
}, [
|
|
208
|
+
]), Z = u(() => {
|
|
209
|
+
Y(), L();
|
|
210
|
+
}, [L, Y]), Q = He || nt, $ = u((e) => {
|
|
211
211
|
let t = () => {
|
|
212
212
|
Z(), e();
|
|
213
213
|
};
|
|
214
|
-
Q ?
|
|
214
|
+
Q ? x(t) : t();
|
|
215
215
|
}, [
|
|
216
|
-
|
|
216
|
+
x,
|
|
217
217
|
Z,
|
|
218
218
|
Q
|
|
219
|
-
]), Tt =
|
|
220
|
-
Q ?
|
|
219
|
+
]), Tt = u(() => {
|
|
220
|
+
Q ? x(Z) : Z();
|
|
221
221
|
}, [
|
|
222
|
-
|
|
222
|
+
x,
|
|
223
223
|
Z,
|
|
224
224
|
Q
|
|
225
|
-
]), Et =
|
|
226
|
-
if (
|
|
227
|
-
let e =
|
|
225
|
+
]), Et = u(async ({ closeOnSuccess: t = !0, allowIncompleteVendor: n = !1 } = {}) => {
|
|
226
|
+
if (n && E === "create" && !F.current) {
|
|
227
|
+
let e = M.current, t = ae({
|
|
228
228
|
...dt,
|
|
229
229
|
bankAccount: e
|
|
230
230
|
}, C, "vendor");
|
|
231
|
-
if (
|
|
231
|
+
if (ne(t)) return He || !g(e, B ?? h) ? {
|
|
232
232
|
ok: !0,
|
|
233
|
-
counterpartRawData:
|
|
233
|
+
counterpartRawData: ge(dt, e, v)
|
|
234
234
|
} : { ok: !0 };
|
|
235
235
|
}
|
|
236
|
-
let
|
|
237
|
-
if (!
|
|
238
|
-
let e =
|
|
239
|
-
if (Object.keys(e).length > 0) return
|
|
236
|
+
let r = l, i = !1, a = M.current;
|
|
237
|
+
if (!g(a, N.current)) {
|
|
238
|
+
let e = ie(a, C);
|
|
239
|
+
if (Object.keys(e).length > 0) return P(e), E !== "create" && k(!0), { ok: !1 };
|
|
240
240
|
}
|
|
241
241
|
if (E === "edit" && ht) return { ok: !1 };
|
|
242
242
|
if (E) {
|
|
243
|
-
if (E === "create" &&
|
|
243
|
+
if (E === "create" && F.current) r = F.current;
|
|
244
244
|
else {
|
|
245
245
|
let e = await ut();
|
|
246
246
|
if (!e.ok) return { ok: !1 };
|
|
247
|
-
E === "create" ? (
|
|
247
|
+
E === "create" ? (r = e.counterpartId, F.current = r) : r = e.counterpartId ?? r;
|
|
248
248
|
}
|
|
249
|
-
E === "create" && (
|
|
249
|
+
E === "create" && (i = !0);
|
|
250
250
|
}
|
|
251
|
-
if (!
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
254
|
-
let e =
|
|
255
|
-
return e ? (t && (k(!1), E && Y()),
|
|
251
|
+
if (!r) return { ok: !0 };
|
|
252
|
+
let o = H.isBankAccountsLoading || H.isBankAccountsFetching || H.isBankAccountsError;
|
|
253
|
+
if (g(a, N.current)) {
|
|
254
|
+
let e = Ke ?? q;
|
|
255
|
+
return e ? (t && (k(!1), E && Y()), i && R(r), {
|
|
256
256
|
ok: !0,
|
|
257
|
-
counterpartId:
|
|
257
|
+
counterpartId: r,
|
|
258
258
|
counterpartBankAccountId: e
|
|
259
|
-
}) :
|
|
259
|
+
}) : i ? (t && Y(), R(r), {
|
|
260
260
|
ok: !0,
|
|
261
|
-
counterpartId:
|
|
262
|
-
}) :
|
|
261
|
+
counterpartId: r
|
|
262
|
+
}) : o ? { ok: !1 } : (t && (k(!1), E && Y()), {
|
|
263
263
|
ok: !0,
|
|
264
|
-
counterpartId:
|
|
264
|
+
counterpartId: r,
|
|
265
265
|
counterpartBankAccountId: pt
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
-
let
|
|
268
|
+
if (o) return { ok: !1 };
|
|
269
|
+
P(void 0);
|
|
270
|
+
let s = re(H.bankAccounts, Ke ?? J?.id), c;
|
|
271
271
|
try {
|
|
272
|
-
|
|
272
|
+
s.kind === "update" ? (await ot.mutateAsync({
|
|
273
273
|
path: {
|
|
274
|
-
counterpart_id:
|
|
275
|
-
bank_account_id:
|
|
274
|
+
counterpart_id: r,
|
|
275
|
+
bank_account_id: s.bankAccountId
|
|
276
276
|
},
|
|
277
|
-
body:
|
|
278
|
-
}),
|
|
279
|
-
path: { counterpart_id:
|
|
280
|
-
body:
|
|
277
|
+
body: te(a, { includeAchDefaults: s.includeAchDefaults })
|
|
278
|
+
}), c = s.bankAccountId) : c = (await at.mutateAsync({
|
|
279
|
+
path: { counterpart_id: r },
|
|
280
|
+
body: ee(a, { isDefaultForCurrency: s.isDefaultForCurrency })
|
|
281
281
|
}))?.id;
|
|
282
282
|
} catch {
|
|
283
283
|
return e.error(S.bankAccountSaveFailed), {
|
|
284
284
|
ok: !1,
|
|
285
|
-
counterpartId:
|
|
285
|
+
counterpartId: r
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
return
|
|
289
|
-
counterpartId:
|
|
290
|
-
bankAccountId:
|
|
291
|
-
} : void 0), t && (k(!1), E && Y()),
|
|
288
|
+
return N.current = a, Ge(c ? {
|
|
289
|
+
counterpartId: r,
|
|
290
|
+
bankAccountId: c
|
|
291
|
+
} : void 0), t && (k(!1), E && Y()), i && R(r), {
|
|
292
292
|
ok: !0,
|
|
293
|
-
counterpartId:
|
|
294
|
-
counterpartBankAccountId:
|
|
293
|
+
counterpartId: r,
|
|
294
|
+
counterpartBankAccountId: c
|
|
295
295
|
};
|
|
296
296
|
}, [
|
|
297
297
|
Y,
|
|
298
|
-
|
|
298
|
+
l,
|
|
299
299
|
at,
|
|
300
300
|
H.bankAccounts,
|
|
301
301
|
H.isBankAccountsError,
|
|
302
302
|
H.isBankAccountsFetching,
|
|
303
303
|
H.isBankAccountsLoading,
|
|
304
304
|
B,
|
|
305
|
-
|
|
305
|
+
v,
|
|
306
306
|
E,
|
|
307
307
|
dt,
|
|
308
308
|
He,
|
|
@@ -311,35 +311,35 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
311
311
|
q,
|
|
312
312
|
C,
|
|
313
313
|
pt,
|
|
314
|
-
|
|
314
|
+
R,
|
|
315
315
|
J,
|
|
316
316
|
ut,
|
|
317
317
|
ot,
|
|
318
|
-
|
|
319
|
-
]), Dt =
|
|
320
|
-
if (
|
|
318
|
+
Ke
|
|
319
|
+
]), Dt = u((e) => {
|
|
320
|
+
if (I.current) return I.current;
|
|
321
321
|
let t = (async () => {
|
|
322
|
-
|
|
322
|
+
Ze(!0);
|
|
323
323
|
try {
|
|
324
324
|
return await Et(e);
|
|
325
325
|
} finally {
|
|
326
|
-
|
|
326
|
+
I.current = void 0, Ze(!1);
|
|
327
327
|
}
|
|
328
328
|
})();
|
|
329
|
-
return
|
|
330
|
-
}, [Et]), Ot =
|
|
329
|
+
return I.current = t, t;
|
|
330
|
+
}, [Et]), Ot = u(() => {
|
|
331
331
|
k(!1), E && Y();
|
|
332
|
-
}, [E, Y]), kt =
|
|
333
|
-
name:
|
|
334
|
-
email:
|
|
332
|
+
}, [E, Y]), kt = f(() => (V.data?.data ?? []).map((e) => ({
|
|
333
|
+
name: s(e),
|
|
334
|
+
email: o(e),
|
|
335
335
|
onSelect: () => {
|
|
336
|
-
$(() =>
|
|
336
|
+
$(() => R(e.id));
|
|
337
337
|
}
|
|
338
338
|
})), [
|
|
339
339
|
V.data,
|
|
340
340
|
$,
|
|
341
|
-
|
|
342
|
-
]), At =
|
|
341
|
+
R
|
|
342
|
+
]), At = u((e) => {
|
|
343
343
|
D(!0), W((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
|
|
344
344
|
...t,
|
|
345
345
|
...e,
|
|
@@ -353,7 +353,7 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
353
353
|
...t,
|
|
354
354
|
...e
|
|
355
355
|
});
|
|
356
|
-
}, [W]), jt =
|
|
356
|
+
}, [W]), jt = u((e) => {
|
|
357
357
|
D(!0), W((t) => ({
|
|
358
358
|
...t,
|
|
359
359
|
address: {
|
|
@@ -364,35 +364,35 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
364
364
|
}, [W]), Mt = {
|
|
365
365
|
query: w,
|
|
366
366
|
onQueryChange: Pe,
|
|
367
|
-
isLoading: bt || !
|
|
367
|
+
isLoading: bt || !Te || !Me || !!l && H.isLoading || V.isLoading || V.isFetching && it,
|
|
368
368
|
onAddVendor: () => {
|
|
369
369
|
if (E === "create") {
|
|
370
|
-
let e = w.trim(), [t, ...
|
|
371
|
-
W((
|
|
372
|
-
...
|
|
370
|
+
let e = w.trim(), [t, ...n] = e.split(/\s+/);
|
|
371
|
+
W((r) => r.entityType === "individual" ? {
|
|
372
|
+
...r,
|
|
373
373
|
firstName: t,
|
|
374
|
-
lastName:
|
|
374
|
+
lastName: n.join(" ")
|
|
375
375
|
} : {
|
|
376
|
-
...
|
|
376
|
+
...r,
|
|
377
377
|
legalName: e
|
|
378
378
|
}), D(!0);
|
|
379
379
|
} else $(() => X("create"));
|
|
380
380
|
},
|
|
381
381
|
results: kt
|
|
382
|
-
}, Nt =
|
|
382
|
+
}, Nt = ke && (E === "create" || !mt) ? {
|
|
383
383
|
isOpen: O,
|
|
384
384
|
values: A,
|
|
385
|
-
errors:
|
|
385
|
+
errors: Ue,
|
|
386
386
|
onOpen: St,
|
|
387
387
|
onCancel: wt,
|
|
388
388
|
onChange: Ct
|
|
389
389
|
} : void 0, Pt = E !== "create" && Nt ? {
|
|
390
390
|
...Nt,
|
|
391
391
|
onOpen: E === "edit" ? () => $(St) : Nt.onOpen,
|
|
392
|
-
canEditExisting:
|
|
392
|
+
canEditExisting: Oe
|
|
393
393
|
} : void 0, Ft = U.isSubmitting || at.isPending || ot.isPending, It = {
|
|
394
394
|
prepareVendorForSave: Dt,
|
|
395
|
-
isVendorSavePending:
|
|
395
|
+
isVendorSavePending: Xe || Ft,
|
|
396
396
|
hasUnsavedVendorChanges: Q,
|
|
397
397
|
isPendingVendor: !!K && !ft,
|
|
398
398
|
revealIncompleteVendor: ft ? vt : void 0,
|
|
@@ -401,19 +401,19 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
401
401
|
discardPayToEdits: Z,
|
|
402
402
|
finalizePayToSave: Ot,
|
|
403
403
|
openPaymentInstructions: St,
|
|
404
|
-
paymentInstructions:
|
|
404
|
+
paymentInstructions: pe(Pt, !!G?.hasPaymentInstructions),
|
|
405
405
|
paymentInstructionsEditor: Pt,
|
|
406
406
|
detailsWarning: gt
|
|
407
|
-
}, Lt = E === "create" &&
|
|
407
|
+
}, Lt = E === "create" && ke ? {
|
|
408
408
|
values: A,
|
|
409
|
-
errors:
|
|
409
|
+
errors: Ue,
|
|
410
410
|
onChange: Ct,
|
|
411
|
-
isExtracted: !!(B &&
|
|
411
|
+
isExtracted: !!(B && g(A, B))
|
|
412
412
|
} : void 0;
|
|
413
413
|
if (E) return {
|
|
414
414
|
mode: "creating",
|
|
415
415
|
summary: G,
|
|
416
|
-
newVendorForm: /* @__PURE__ */
|
|
416
|
+
newVendorForm: /* @__PURE__ */ ye(_e, {
|
|
417
417
|
mode: E,
|
|
418
418
|
values: U.values,
|
|
419
419
|
errors: U.errors,
|
|
@@ -424,23 +424,23 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
424
424
|
isSaving: Ft,
|
|
425
425
|
search: rt ? Mt : void 0,
|
|
426
426
|
paymentInstructions: Lt,
|
|
427
|
-
labels:
|
|
427
|
+
labels: Ae?.inlineForm
|
|
428
428
|
}),
|
|
429
429
|
...It
|
|
430
430
|
};
|
|
431
431
|
if (G) return {
|
|
432
432
|
mode: "resolved",
|
|
433
433
|
summary: G,
|
|
434
|
-
onEdit:
|
|
434
|
+
onEdit: b && !ht ? () => $(() => X("edit")) : void 0,
|
|
435
435
|
...It
|
|
436
436
|
};
|
|
437
437
|
if (K && !bt) {
|
|
438
438
|
let e = () => $(() => {
|
|
439
|
-
|
|
440
|
-
}), t =
|
|
439
|
+
Ye(!0), X("create");
|
|
440
|
+
}), t = b && ke ? {
|
|
441
441
|
isOpen: !1,
|
|
442
442
|
values: A,
|
|
443
|
-
errors:
|
|
443
|
+
errors: Ue,
|
|
444
444
|
onOpen: e,
|
|
445
445
|
onChange: Ct,
|
|
446
446
|
onCancel: wt,
|
|
@@ -449,19 +449,19 @@ function g({ payableId: s, counterpartId: c, payableCounterpartId: g, payableCou
|
|
|
449
449
|
return {
|
|
450
450
|
mode: "resolved",
|
|
451
451
|
summary: K,
|
|
452
|
-
onEdit:
|
|
453
|
-
error:
|
|
452
|
+
onEdit: b ? e : void 0,
|
|
453
|
+
error: De,
|
|
454
454
|
...It,
|
|
455
455
|
showPaymentInstructions: !0,
|
|
456
|
-
paymentInstructions:
|
|
456
|
+
paymentInstructions: pe(t, K.hasPaymentInstructions),
|
|
457
457
|
paymentInstructionsEditor: t
|
|
458
458
|
};
|
|
459
459
|
}
|
|
460
460
|
return {
|
|
461
461
|
mode: "selecting",
|
|
462
|
-
error: V.isError ? S.searchFailed : H.isError ? S.vendorDetailsFailed :
|
|
462
|
+
error: V.isError ? S.searchFailed : H.isError ? S.vendorDetailsFailed : De,
|
|
463
463
|
search: Mt,
|
|
464
464
|
...It
|
|
465
465
|
};
|
|
466
466
|
}
|
|
467
|
-
export {
|
|
467
|
+
export { _ as useVendorSectionProps };
|