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