@tesouro/embedded-components-react 0.5.251 → 0.5.254

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