@tesouro/embedded-components-react 0.5.158 → 0.5.160
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 +3 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index8.js +106 -105
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index3.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index8.js +19 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +252 -251
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +334 -333
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +68 -56
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -10,296 +10,296 @@ import "../../../shared/ui/dist/index.js";
|
|
|
10
10
|
import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
11
11
|
import "../../../shared/feature/dist/index.js";
|
|
12
12
|
import { useCounterpartsQuery as i } from "../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
13
|
-
import { useCreateCounterpartBankAccountMutation as
|
|
14
|
-
import { usePayableSuggestionsQuery as
|
|
13
|
+
import { useCreateCounterpartBankAccountMutation as ee, useUpdateCounterpartBankAccountMutation as a } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
14
|
+
import { usePayableSuggestionsQuery as o } from "../../data-access/dist/index18.js";
|
|
15
15
|
import "../../data-access/dist/index.js";
|
|
16
|
-
import { COUNTERPART_MESSAGE_LABELS_EN as
|
|
17
|
-
import { counterpartFormBankAccountToCreatePayload as
|
|
18
|
-
import { useCounterpartDetails as
|
|
19
|
-
import { useCounterpartForm as
|
|
16
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as te } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
17
|
+
import { counterpartFormBankAccountToCreatePayload as ne, counterpartFormBankAccountToUpdatePayload as re, getAchInstructions as ie, getCounterpartEmail as s, getCounterpartName as c, getPayableAchInstructions as ae, isAchCompatibleBankAccount as l, resolveCounterpartBankAccountWrite as oe, validateAchFormValues as se } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
18
|
+
import { useCounterpartDetails as ce } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
19
|
+
import { useCounterpartForm as le } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
20
20
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
21
|
-
import { VENDOR_SECTION_PROPS_LABELS_EN as
|
|
22
|
-
import { buildVendorPrefill as
|
|
23
|
-
import { VendorInlineForm as
|
|
24
|
-
import { useCallback as
|
|
25
|
-
import { jsx as
|
|
21
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as ue } from "./index50.js";
|
|
22
|
+
import { buildVendorPrefill as de } from "./index52.js";
|
|
23
|
+
import { VendorInlineForm as fe } from "./index53.js";
|
|
24
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
25
|
+
import { jsx as pe } from "react/jsx-runtime";
|
|
26
26
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js
|
|
27
|
-
var
|
|
27
|
+
var me = 10, he = 300, h = {
|
|
28
28
|
accountHolderName: "",
|
|
29
29
|
routingNumber: "",
|
|
30
30
|
accountNumber: ""
|
|
31
31
|
};
|
|
32
|
-
function
|
|
32
|
+
function ge(e) {
|
|
33
33
|
return {
|
|
34
34
|
accountHolderName: e.account_holder_name ?? "",
|
|
35
35
|
routingNumber: e.routing_number ?? "",
|
|
36
36
|
accountNumber: e.account_number ?? ""
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function g(e, t) {
|
|
40
40
|
return e.accountHolderName.trim() === t.accountHolderName.trim() && e.routingNumber.trim() === t.routingNumber.trim() && e.accountNumber.trim() === t.accountNumber.trim();
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return e?.find((e) => e.id === t &&
|
|
42
|
+
function _e(e, t) {
|
|
43
|
+
return e?.find((e) => e.id === t && l(e)) ?? ie(e);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
let
|
|
47
|
-
...
|
|
48
|
-
...
|
|
49
|
-
}, { initResponse:
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
}, []),
|
|
54
|
-
|
|
55
|
-
}, [
|
|
56
|
-
|
|
57
|
-
!
|
|
45
|
+
function _({ payableId: ie, counterpartId: l, payableCounterpartId: _, payableCounterpartBankAccountId: ve, isVendorKnown: ye = !0, onCounterpartChange: be, requiredError: xe, extractedVendor: v, readOnly: y = !1, canEditVendor: b = !0, canEditPaymentInstructions: Se = !0, canAddPaymentInstructions: Ce = !0, confirmDiscard: x = (e) => e(), labels: we }) {
|
|
46
|
+
let S = {
|
|
47
|
+
...ue,
|
|
48
|
+
...we
|
|
49
|
+
}, { initResponse: Te } = r(), Ee = t(Te?.scopes, [n.CounterpartReadOrg]), [C, De] = m(""), [w, Oe] = m(""), ke = p(w), [T, Ae] = m(), [je, Me] = m("none"), [Ne, Pe] = m(), [Fe, E] = m(!1), [D, O] = m(!1), [k, A] = m(h), Ie = p(k);
|
|
50
|
+
Ie.current = k;
|
|
51
|
+
let j = p(h), [Le, M] = m(), [Re, ze] = m(), Be = Re?.bankAccountId, N = p(void 0), Ve = p(l), [He, Ue] = m(!1), [We, Ge] = m(!1), P = p(void 0), Ke = (D || T === "create") && !g(k, j.current), F = u(() => {
|
|
52
|
+
O(!1), A(h), j.current = h, M(void 0);
|
|
53
|
+
}, []), I = u((e) => {
|
|
54
|
+
Ue(!0), be(e);
|
|
55
|
+
}, [be]), L = o(ie, { enabled: !y && !!ie && !l && !_ }).data?.suggested_counterpart?.id, qe = v?.name;
|
|
56
|
+
d(() => {
|
|
57
|
+
!y && !He && !l && !_ && L && I(L);
|
|
58
58
|
}, [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
]),
|
|
66
|
-
|
|
67
|
-
}, [
|
|
59
|
+
l,
|
|
60
|
+
_,
|
|
61
|
+
y,
|
|
62
|
+
He,
|
|
63
|
+
L,
|
|
64
|
+
I
|
|
65
|
+
]), d(() => {
|
|
66
|
+
Ve.current !== l && (Ve.current = l, F(), ze((e) => e?.counterpartId === l ? e : void 0));
|
|
67
|
+
}, [l, F]), d(() => {
|
|
68
68
|
let e = setTimeout(() => {
|
|
69
|
-
|
|
70
|
-
},
|
|
69
|
+
Oe(C.trim());
|
|
70
|
+
}, he);
|
|
71
71
|
return () => clearTimeout(e);
|
|
72
|
-
}, [
|
|
73
|
-
let
|
|
72
|
+
}, [C]);
|
|
73
|
+
let R = i({
|
|
74
74
|
sort: "counterpart_name",
|
|
75
75
|
order: "asc",
|
|
76
|
-
limit:
|
|
77
|
-
counterpart_name__icontains:
|
|
76
|
+
limit: me,
|
|
77
|
+
counterpart_name__icontains: w || void 0,
|
|
78
78
|
is_vendor: !0,
|
|
79
|
-
enabled: !
|
|
79
|
+
enabled: !y && (T === "edit" || !T && !l) && ye && Ee
|
|
80
80
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, [
|
|
84
|
-
let
|
|
85
|
-
selectedId:
|
|
86
|
-
enabled:
|
|
87
|
-
}),
|
|
88
|
-
view:
|
|
89
|
-
setView:
|
|
90
|
-
selectedId:
|
|
91
|
-
setSelectedId:
|
|
92
|
-
messages:
|
|
81
|
+
d(() => {
|
|
82
|
+
R.isPlaceholderData || (ke.current = w);
|
|
83
|
+
}, [w, R.isPlaceholderData]);
|
|
84
|
+
let Je = R.isPlaceholderData && ke.current !== w, z = ce({
|
|
85
|
+
selectedId: l,
|
|
86
|
+
enabled: Ee
|
|
87
|
+
}), Ye = ee(), Xe = a(), B = le({
|
|
88
|
+
view: je,
|
|
89
|
+
setView: Me,
|
|
90
|
+
selectedId: Ne,
|
|
91
|
+
setSelectedId: Pe,
|
|
92
|
+
messages: te,
|
|
93
93
|
counterpartType: "vendor",
|
|
94
|
-
counterpart:
|
|
95
|
-
primaryAddress:
|
|
94
|
+
counterpart: z.counterpart,
|
|
95
|
+
primaryAddress: z.primaryAddress,
|
|
96
96
|
includeBankAccount: !1
|
|
97
|
-
}), { openCreate:
|
|
98
|
-
let e =
|
|
97
|
+
}), { openCreate: Ze, openEdit: Qe, close: $e, setValues: V, submit: et } = B, H = f(() => de(v), [v]), U = H?.bankAccount, W = f(() => {
|
|
98
|
+
let e = z.counterpart;
|
|
99
99
|
if (!e) return;
|
|
100
|
-
if (
|
|
101
|
-
name:
|
|
102
|
-
email:
|
|
103
|
-
methodLabel:
|
|
100
|
+
if (z.isBankAccountsLoading) return {
|
|
101
|
+
name: c(e),
|
|
102
|
+
email: s(e),
|
|
103
|
+
methodLabel: S.paymentMethodLoading,
|
|
104
104
|
hasPaymentInstructions: !1
|
|
105
105
|
};
|
|
106
|
-
if (
|
|
107
|
-
name:
|
|
108
|
-
email:
|
|
109
|
-
methodLabel:
|
|
106
|
+
if (z.isBankAccountsError) return {
|
|
107
|
+
name: c(e),
|
|
108
|
+
email: s(e),
|
|
109
|
+
methodLabel: S.paymentMethodUnavailable,
|
|
110
110
|
hasPaymentInstructions: !1
|
|
111
111
|
};
|
|
112
|
-
let t =
|
|
112
|
+
let t = ae(z.bankAccounts);
|
|
113
113
|
return {
|
|
114
|
-
name:
|
|
115
|
-
email:
|
|
116
|
-
methodLabel: t ?
|
|
114
|
+
name: c(e),
|
|
115
|
+
email: s(e),
|
|
116
|
+
methodLabel: t ? S.paymentInstructionsValue(t.account_number?.slice(-4) ?? "") : S.noMethod,
|
|
117
117
|
hasPaymentInstructions: !!t
|
|
118
118
|
};
|
|
119
119
|
}, [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
]),
|
|
126
|
-
let e =
|
|
127
|
-
if (!e ||
|
|
128
|
-
let t =
|
|
120
|
+
z.bankAccounts,
|
|
121
|
+
z.counterpart,
|
|
122
|
+
z.isBankAccountsError,
|
|
123
|
+
z.isBankAccountsLoading,
|
|
124
|
+
S
|
|
125
|
+
]), G = f(() => {
|
|
126
|
+
let e = qe?.trim();
|
|
127
|
+
if (!e || l || T) return;
|
|
128
|
+
let t = U?.accountNumber;
|
|
129
129
|
return {
|
|
130
130
|
name: e,
|
|
131
|
-
email:
|
|
132
|
-
description:
|
|
133
|
-
methodLabel: t ?
|
|
131
|
+
email: v?.email ?? "",
|
|
132
|
+
description: S.pendingVendorDescription,
|
|
133
|
+
methodLabel: t ? S.paymentInstructionsValue(t.slice(-4)) : "",
|
|
134
134
|
hasPaymentInstructions: !!t
|
|
135
135
|
};
|
|
136
136
|
}, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
]), K =
|
|
145
|
-
|
|
146
|
-
}, [
|
|
147
|
-
if (
|
|
137
|
+
l,
|
|
138
|
+
U?.accountNumber,
|
|
139
|
+
v?.email,
|
|
140
|
+
qe,
|
|
141
|
+
T,
|
|
142
|
+
S.paymentInstructionsValue,
|
|
143
|
+
S.pendingVendorDescription
|
|
144
|
+
]), K = l === _ ? ve : void 0, q = f(() => _e(z.bankAccounts, K), [z.bankAccounts, K]), tt = f(() => ae(z.bankAccounts)?.id, [z.bankAccounts]), nt = !z.counterpart || z.isLoading || z.isFetching || z.isError || z.isBankAccountsLoading || z.isBankAccountsFetching || z.isBankAccountsError, rt = nt || z.isAddressesLoading || z.isAddressesFetching || z.isAddressesError, it = b && !nt && z.isAddressesError ? { onRetry: z.refetchAddresses } : void 0, J = u(() => {
|
|
145
|
+
$e(), Ae(void 0), E(!1), N.current = void 0;
|
|
146
|
+
}, [$e]), at = u((e) => {
|
|
147
|
+
if (E(!1), N.current = void 0, e === "edit") Pe(l), Qe();
|
|
148
148
|
else {
|
|
149
|
-
|
|
150
|
-
let e =
|
|
151
|
-
|
|
149
|
+
Ze();
|
|
150
|
+
let e = C.trim();
|
|
151
|
+
V((t) => ({
|
|
152
152
|
...t,
|
|
153
153
|
entityType: "organization",
|
|
154
|
-
legalName: e ||
|
|
155
|
-
email:
|
|
156
|
-
phone:
|
|
157
|
-
address:
|
|
158
|
-
})),
|
|
154
|
+
legalName: e || H?.legalName || t.legalName,
|
|
155
|
+
email: H?.email || t.email,
|
|
156
|
+
phone: H?.phone || t.phone,
|
|
157
|
+
address: H?.address ?? t.address
|
|
158
|
+
})), A(U ?? h), M(void 0), j.current = h;
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
Ae(e);
|
|
161
161
|
}, [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
Xe,
|
|
162
|
+
l,
|
|
163
|
+
U,
|
|
165
164
|
Ze,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
Qe,
|
|
166
|
+
C,
|
|
167
|
+
V,
|
|
168
|
+
H
|
|
169
|
+
]), Y = u(() => {
|
|
170
|
+
let e = q ? ge(q) : h;
|
|
171
|
+
j.current = e, A(e), M(void 0), O(!0);
|
|
172
|
+
}, [q]), ot = u((e) => {
|
|
173
|
+
A((t) => ({
|
|
174
174
|
...t,
|
|
175
175
|
...e
|
|
176
|
-
})),
|
|
177
|
-
}, []),
|
|
178
|
-
|
|
176
|
+
})), M(void 0);
|
|
177
|
+
}, []), st = u(() => {
|
|
178
|
+
Ke ? x(F) : F();
|
|
179
179
|
}, [
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
]), X =
|
|
184
|
-
|
|
185
|
-
}, [
|
|
180
|
+
F,
|
|
181
|
+
x,
|
|
182
|
+
Ke
|
|
183
|
+
]), X = u(() => {
|
|
184
|
+
J(), F();
|
|
185
|
+
}, [F, J]), Z = Fe || Ke, Q = u((e) => {
|
|
186
186
|
let t = () => {
|
|
187
187
|
X(), e();
|
|
188
188
|
};
|
|
189
|
-
Z ?
|
|
189
|
+
Z ? x(t) : t();
|
|
190
190
|
}, [
|
|
191
|
-
|
|
191
|
+
x,
|
|
192
192
|
X,
|
|
193
193
|
Z
|
|
194
|
-
]),
|
|
195
|
-
Z ?
|
|
194
|
+
]), ct = u(() => {
|
|
195
|
+
Z ? x(X) : X();
|
|
196
196
|
}, [
|
|
197
|
-
|
|
197
|
+
x,
|
|
198
198
|
X,
|
|
199
199
|
Z
|
|
200
|
-
]),
|
|
201
|
-
let n =
|
|
202
|
-
if (!
|
|
203
|
-
let e =
|
|
204
|
-
if (Object.keys(e).length > 0) return
|
|
200
|
+
]), lt = u(async (t) => {
|
|
201
|
+
let n = l, r = !1, i = Ie.current;
|
|
202
|
+
if (!g(i, j.current)) {
|
|
203
|
+
let e = se(i);
|
|
204
|
+
if (Object.keys(e).length > 0) return M(e), T !== "create" && O(!0), { ok: !1 };
|
|
205
205
|
}
|
|
206
|
-
if (
|
|
207
|
-
if (
|
|
208
|
-
if (
|
|
206
|
+
if (T === "edit" && rt) return { ok: !1 };
|
|
207
|
+
if (T) {
|
|
208
|
+
if (T === "create" && N.current) n = N.current;
|
|
209
209
|
else {
|
|
210
|
-
let e = await
|
|
210
|
+
let e = await et();
|
|
211
211
|
if (!e.ok) return { ok: !1 };
|
|
212
|
-
|
|
212
|
+
T === "create" ? (n = e.counterpartId, N.current = n) : n = e.counterpartId ?? n;
|
|
213
213
|
}
|
|
214
|
-
|
|
214
|
+
T === "create" && (r = !0);
|
|
215
215
|
}
|
|
216
216
|
if (!n) return { ok: !0 };
|
|
217
|
-
let
|
|
218
|
-
if (
|
|
219
|
-
let e =
|
|
220
|
-
return e ? (t && (
|
|
217
|
+
let ee = z.isBankAccountsLoading || z.isBankAccountsFetching || z.isBankAccountsError;
|
|
218
|
+
if (g(i, j.current)) {
|
|
219
|
+
let e = Be ?? K;
|
|
220
|
+
return e ? (t && (O(!1), T && J()), r && I(n), {
|
|
221
221
|
ok: !0,
|
|
222
222
|
counterpartId: n,
|
|
223
223
|
counterpartBankAccountId: e
|
|
224
|
-
}) : r ? (t &&
|
|
224
|
+
}) : r ? (t && J(), I(n), {
|
|
225
225
|
ok: !0,
|
|
226
226
|
counterpartId: n
|
|
227
|
-
}) :
|
|
227
|
+
}) : ee ? { ok: !1 } : (t && (O(!1), T && J()), {
|
|
228
228
|
ok: !0,
|
|
229
229
|
counterpartId: n,
|
|
230
230
|
counterpartBankAccountId: tt
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
-
if (
|
|
234
|
-
|
|
235
|
-
let
|
|
233
|
+
if (ee) return { ok: !1 };
|
|
234
|
+
M(void 0);
|
|
235
|
+
let a = oe(z.bankAccounts, Be ?? q?.id), o;
|
|
236
236
|
try {
|
|
237
|
-
|
|
237
|
+
a.kind === "update" ? (await Xe.mutateAsync({
|
|
238
238
|
path: {
|
|
239
239
|
counterpart_id: n,
|
|
240
|
-
bank_account_id:
|
|
240
|
+
bank_account_id: a.bankAccountId
|
|
241
241
|
},
|
|
242
|
-
body:
|
|
243
|
-
}),
|
|
242
|
+
body: re(i, { includeAchDefaults: a.includeAchDefaults })
|
|
243
|
+
}), o = a.bankAccountId) : o = (await Ye.mutateAsync({
|
|
244
244
|
path: { counterpart_id: n },
|
|
245
|
-
body:
|
|
245
|
+
body: ne(i, { isDefaultForCurrency: a.isDefaultForCurrency })
|
|
246
246
|
}))?.id;
|
|
247
247
|
} catch {
|
|
248
|
-
return e.error(
|
|
248
|
+
return e.error(S.bankAccountSaveFailed), {
|
|
249
249
|
ok: !1,
|
|
250
250
|
counterpartId: n
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
|
-
return
|
|
253
|
+
return j.current = i, ze(o ? {
|
|
254
254
|
counterpartId: n,
|
|
255
|
-
bankAccountId:
|
|
256
|
-
} : void 0), t && (
|
|
255
|
+
bankAccountId: o
|
|
256
|
+
} : void 0), t && (O(!1), T && J()), r && I(n), {
|
|
257
257
|
ok: !0,
|
|
258
258
|
counterpartId: n,
|
|
259
|
-
counterpartBankAccountId:
|
|
259
|
+
counterpartBankAccountId: o
|
|
260
260
|
};
|
|
261
261
|
}, [
|
|
262
|
-
Y,
|
|
263
|
-
u,
|
|
264
|
-
Je,
|
|
265
|
-
B.bankAccounts,
|
|
266
|
-
B.isBankAccountsError,
|
|
267
|
-
B.isBankAccountsFetching,
|
|
268
|
-
B.isBankAccountsLoading,
|
|
269
|
-
E,
|
|
270
262
|
J,
|
|
263
|
+
l,
|
|
264
|
+
Ye,
|
|
265
|
+
z.bankAccounts,
|
|
266
|
+
z.isBankAccountsError,
|
|
267
|
+
z.isBankAccountsFetching,
|
|
268
|
+
z.isBankAccountsLoading,
|
|
269
|
+
T,
|
|
270
|
+
rt,
|
|
271
271
|
K,
|
|
272
272
|
tt,
|
|
273
|
-
|
|
273
|
+
I,
|
|
274
274
|
q,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
]),
|
|
279
|
-
if (
|
|
275
|
+
et,
|
|
276
|
+
Xe,
|
|
277
|
+
Be
|
|
278
|
+
]), ut = u((e) => {
|
|
279
|
+
if (P.current) return P.current;
|
|
280
280
|
let t = e?.closeOnSuccess ?? !0, n = (async () => {
|
|
281
|
-
|
|
281
|
+
Ge(!0);
|
|
282
282
|
try {
|
|
283
|
-
return await
|
|
283
|
+
return await lt(t);
|
|
284
284
|
} finally {
|
|
285
|
-
|
|
285
|
+
P.current = void 0, Ge(!1);
|
|
286
286
|
}
|
|
287
287
|
})();
|
|
288
|
-
return
|
|
289
|
-
}, [
|
|
290
|
-
|
|
291
|
-
}, [
|
|
292
|
-
name:
|
|
293
|
-
email:
|
|
288
|
+
return P.current = n, n;
|
|
289
|
+
}, [lt]), dt = u(() => {
|
|
290
|
+
O(!1), T && J();
|
|
291
|
+
}, [T, J]), ft = f(() => (R.data?.data ?? []).map((e) => ({
|
|
292
|
+
name: c(e),
|
|
293
|
+
email: s(e),
|
|
294
294
|
onSelect: () => {
|
|
295
|
-
Q(() =>
|
|
295
|
+
Q(() => I(e.id));
|
|
296
296
|
}
|
|
297
297
|
})), [
|
|
298
|
-
|
|
298
|
+
R.data,
|
|
299
299
|
Q,
|
|
300
|
-
|
|
301
|
-
]),
|
|
302
|
-
|
|
300
|
+
I
|
|
301
|
+
]), pt = u((e) => {
|
|
302
|
+
E(!0), V((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
|
|
303
303
|
...t,
|
|
304
304
|
...e,
|
|
305
305
|
firstName: t.firstName || t.legalName,
|
|
@@ -312,103 +312,104 @@ function v({ payableId: re, counterpartId: u, payableCounterpartId: v, payableCo
|
|
|
312
312
|
...t,
|
|
313
313
|
...e
|
|
314
314
|
});
|
|
315
|
-
}, [
|
|
316
|
-
|
|
315
|
+
}, [V]), mt = u((e) => {
|
|
316
|
+
E(!0), V((t) => ({
|
|
317
317
|
...t,
|
|
318
318
|
address: {
|
|
319
319
|
...t.address,
|
|
320
320
|
...e
|
|
321
321
|
}
|
|
322
322
|
}));
|
|
323
|
-
}, [
|
|
324
|
-
query:
|
|
325
|
-
onQueryChange:
|
|
326
|
-
isLoading: !
|
|
323
|
+
}, [V]), ht = {
|
|
324
|
+
query: C,
|
|
325
|
+
onQueryChange: De,
|
|
326
|
+
isLoading: !ye || !Te || !!l && z.isLoading || R.isLoading || R.isFetching && Je,
|
|
327
327
|
onAddVendor: () => {
|
|
328
|
-
Q(() =>
|
|
328
|
+
Q(() => at("create"));
|
|
329
329
|
},
|
|
330
|
-
results:
|
|
331
|
-
},
|
|
332
|
-
isOpen:
|
|
333
|
-
values:
|
|
334
|
-
errors:
|
|
335
|
-
onOpen:
|
|
336
|
-
onCancel:
|
|
337
|
-
onChange:
|
|
338
|
-
} : void 0,
|
|
339
|
-
...
|
|
340
|
-
onOpen:
|
|
330
|
+
results: ft
|
|
331
|
+
}, gt = Ce && (T === "create" || !nt) ? {
|
|
332
|
+
isOpen: D,
|
|
333
|
+
values: k,
|
|
334
|
+
errors: Le,
|
|
335
|
+
onOpen: Y,
|
|
336
|
+
onCancel: st,
|
|
337
|
+
onChange: ot
|
|
338
|
+
} : void 0, _t = T !== "create" && gt ? {
|
|
339
|
+
...gt,
|
|
340
|
+
onOpen: T === "edit" ? () => Q(Y) : gt.onOpen,
|
|
341
341
|
canEditExisting: Se
|
|
342
|
-
} : void 0,
|
|
343
|
-
prepareVendorForSave:
|
|
344
|
-
isVendorSavePending:
|
|
342
|
+
} : void 0, vt = B.isSubmitting || Ye.isPending || Xe.isPending, $ = {
|
|
343
|
+
prepareVendorForSave: ut,
|
|
344
|
+
isVendorSavePending: We || vt,
|
|
345
345
|
hasUnsavedVendorChanges: Z,
|
|
346
|
-
isPendingVendor: !!
|
|
347
|
-
isEditingPayTo: !!
|
|
348
|
-
activePayToOperation:
|
|
346
|
+
isPendingVendor: !!G,
|
|
347
|
+
isEditingPayTo: !!T || D,
|
|
348
|
+
activePayToOperation: T ? "vendor" : D ? W?.hasPaymentInstructions ? "existingInstructions" : "missingInstructions" : void 0,
|
|
349
349
|
discardPayToEdits: X,
|
|
350
|
-
finalizePayToSave:
|
|
351
|
-
openPaymentInstructions:
|
|
352
|
-
paymentInstructions:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
350
|
+
finalizePayToSave: dt,
|
|
351
|
+
openPaymentInstructions: Y,
|
|
352
|
+
paymentInstructions: _t,
|
|
353
|
+
detailsWarning: it
|
|
354
|
+
}, yt = T === "create" && Ce ? {
|
|
355
|
+
values: k,
|
|
356
|
+
errors: Le,
|
|
357
|
+
onChange: ot,
|
|
358
|
+
isExtracted: !!(U && g(k, U))
|
|
358
359
|
} : void 0;
|
|
359
|
-
if (
|
|
360
|
+
if (T) return {
|
|
360
361
|
mode: "creating",
|
|
361
|
-
summary:
|
|
362
|
-
newVendorForm: /* @__PURE__ */ fe
|
|
363
|
-
mode:
|
|
364
|
-
values:
|
|
365
|
-
errors:
|
|
366
|
-
onChange:
|
|
367
|
-
onAddressChange:
|
|
368
|
-
sectionsToExpand:
|
|
369
|
-
onAddressExpand:
|
|
370
|
-
onCancel:
|
|
371
|
-
onSave:
|
|
372
|
-
isSaving:
|
|
373
|
-
search:
|
|
374
|
-
paymentInstructions:
|
|
362
|
+
summary: W,
|
|
363
|
+
newVendorForm: /* @__PURE__ */ pe(fe, {
|
|
364
|
+
mode: T,
|
|
365
|
+
values: B.values,
|
|
366
|
+
errors: B.errors,
|
|
367
|
+
onChange: pt,
|
|
368
|
+
onAddressChange: mt,
|
|
369
|
+
sectionsToExpand: B.sectionsToExpand,
|
|
370
|
+
onAddressExpand: B.expandAddress,
|
|
371
|
+
onCancel: ct,
|
|
372
|
+
onSave: ut,
|
|
373
|
+
isSaving: vt,
|
|
374
|
+
search: T === "edit" && !y ? ht : void 0,
|
|
375
|
+
paymentInstructions: yt
|
|
375
376
|
}),
|
|
376
377
|
...$
|
|
377
378
|
};
|
|
378
|
-
if (
|
|
379
|
+
if (W) return {
|
|
379
380
|
mode: "resolved",
|
|
380
|
-
summary:
|
|
381
|
-
onEdit:
|
|
381
|
+
summary: W,
|
|
382
|
+
onEdit: b && !rt ? () => Q(() => at("edit")) : void 0,
|
|
382
383
|
...$
|
|
383
384
|
};
|
|
384
|
-
if (
|
|
385
|
+
if (G) {
|
|
385
386
|
let e = () => Q(() => {
|
|
386
|
-
|
|
387
|
+
Ue(!0), at("create");
|
|
387
388
|
});
|
|
388
389
|
return {
|
|
389
390
|
mode: "resolved",
|
|
390
|
-
summary:
|
|
391
|
-
onEdit:
|
|
392
|
-
error:
|
|
391
|
+
summary: G,
|
|
392
|
+
onEdit: b ? e : void 0,
|
|
393
|
+
error: xe,
|
|
393
394
|
...$,
|
|
394
395
|
showPaymentInstructions: !0,
|
|
395
|
-
paymentInstructions:
|
|
396
|
+
paymentInstructions: b && Ce ? {
|
|
396
397
|
isOpen: !1,
|
|
397
|
-
values:
|
|
398
|
-
errors:
|
|
398
|
+
values: k,
|
|
399
|
+
errors: Le,
|
|
399
400
|
onOpen: e,
|
|
400
|
-
onChange:
|
|
401
|
-
onCancel:
|
|
401
|
+
onChange: ot,
|
|
402
|
+
onCancel: st,
|
|
402
403
|
canEditExisting: !0
|
|
403
404
|
} : void 0
|
|
404
405
|
};
|
|
405
406
|
}
|
|
406
407
|
return {
|
|
407
408
|
mode: "selecting",
|
|
408
|
-
error:
|
|
409
|
-
search:
|
|
409
|
+
error: R.isError ? S.searchFailed : z.isError ? S.vendorDetailsFailed : xe,
|
|
410
|
+
search: ht,
|
|
410
411
|
...$
|
|
411
412
|
};
|
|
412
413
|
}
|
|
413
414
|
//#endregion
|
|
414
|
-
export {
|
|
415
|
+
export { _ as useVendorSectionProps };
|