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