@tesouro/embedded-components-react 0.11.189 → 0.11.191

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