@tesouro/embedded-components-react 0.5.280 → 0.5.281

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 (52) hide show
  1. package/dist/index.css +8 -0
  2. package/dist/index.d.ts +2 -2
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +2 -2
  4. package/dist/lib/WidgetSuite.d.ts +2 -2
  5. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/labels.js +2 -2
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index30.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +1 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +6 -6
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +8 -8
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +7 -28
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +8 -160
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +20 -13
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +148 -27
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +21 -96
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +37 -79
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +98 -3
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +83 -54
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +3 -113
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +54 -184
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +108 -75
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +181 -29
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +74 -83
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +27 -412
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +88 -12
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +413 -77
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +13 -80
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +77 -226
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +78 -41
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +216 -234
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +44 -23
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +233 -611
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +25 -4
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +647 -39
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +4 -243
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +42 -3
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +250 -3
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +2 -66
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +5 -1
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +67 -0
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +1 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index12.js +11 -11
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +47 -47
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/reconcileCancelledPaymentQueries.js +19 -19
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +1 -1
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/data-access/dist/index4.js +15 -15
  47. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +2 -0
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +1 -0
  49. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  50. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +1 -1
  51. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/labels.js +2 -2
  52. package/package.json +1 -1
@@ -1,420 +1,35 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
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";
8
- import "../../../../shared/data-access/dist/index.js";
9
- import "../../../../shared/ui/dist/index.js";
10
- import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../../shared/feature/dist/index.js";
12
- import { VENDOR_SECTION_PROPS_LABELS_EN as i } from "./index23.js";
13
- import { usePayableSuggestionsQuery as a } from "../../data-access/dist/index19.js";
14
- import "../../data-access/dist/index.js";
15
- import { buildVendorPrefill as o } from "./index25.js";
16
- import { COUNTERPART_MESSAGE_LABELS_EN as s } from "../../../../shared/counterpart-management/feature/dist/lib/labels.js";
17
- import { counterpartFormBankAccountToCreatePayload as ee, counterpartFormBankAccountToUpdatePayload as te, getAchInstructions as ne, getCounterpartEmail as c, getCounterpartName as l, getPayableAchInstructions as re, isAchCompatibleBankAccount as u, resolveCounterpartBankAccountWrite as ie, validateAchFormValues as ae } from "../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
18
- import { useCounterpartsQuery as oe } from "../../../../shared/counterpart-management/data-access/dist/index3.js";
19
- import { useCreateCounterpartBankAccountMutation as se, useUpdateCounterpartBankAccountMutation as ce } from "../../../../shared/counterpart-management/data-access/dist/index5.js";
20
- import { useCounterpartDetails as le } from "../../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
21
- import { useCounterpartForm as ue } from "../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
22
- import "../../../../shared/counterpart-management/feature/dist/index.js";
23
- import { VendorInlineForm as de } from "./index26.js";
24
- import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
25
- import { jsx as fe } from "react/jsx-runtime";
26
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js
27
- var pe = 10, me = 300, g = {
28
- accountHolderName: "",
29
- routingNumber: "",
30
- accountNumber: ""
31
- };
32
- function he(e) {
33
- return {
34
- accountHolderName: e.account_holder_name ?? "",
35
- routingNumber: e.routing_number ?? "",
36
- accountNumber: e.account_number ?? ""
37
- };
2
+ function e(e) {
3
+ return e?.trim() ?? "";
38
4
  }
39
- function _(e, t) {
40
- return e.accountHolderName.trim() === t.accountHolderName.trim() && e.routingNumber.trim() === t.routingNumber.trim() && e.accountNumber.trim() === t.accountNumber.trim();
5
+ function t(t) {
6
+ let n = e(t);
7
+ return n.length === 2 ? n.toUpperCase() : "";
41
8
  }
42
- function ge(e, t) {
43
- return e?.find((e) => e.id === t && u(e)) ?? ne(e);
9
+ function n(t) {
10
+ let n = e(t.bank_account?.routing_number), r = e(t.bank_account?.account_number);
11
+ if (n || r) return {
12
+ accountHolderName: e(t.bank_account?.account_holder_name) || e(t.name),
13
+ routingNumber: n,
14
+ accountNumber: r
15
+ };
44
16
  }
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
- ...i,
48
- ...Se
49
- }, Ce = Se?.messages, we = p(() => ({
50
- ...s,
51
- ...Ce
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);
56
- }, []), R = d((e) => {
57
- Ue(!0), ye(e);
58
- }, [ye]), qe = a(ne, { enabled: !b && !!ne && !u && !v }).data?.suggested_counterpart?.id, Je = y?.name;
59
- f(() => {
60
- !b && !He && !u && !v && qe && R(qe);
61
- }, [
62
- u,
63
- v,
64
- b,
65
- He,
66
- qe,
67
- R
68
- ]), f(() => {
69
- Ve.current !== u && (Ve.current = u, L(), ze((e) => e?.counterpartId === u ? e : void 0));
70
- }, [u, L]), f(() => {
71
- let e = setTimeout(() => {
72
- Oe(T.trim());
73
- }, me);
74
- return () => clearTimeout(e);
75
- }, [T]);
76
- let z = oe({
77
- sort: "counterpart_name",
78
- order: "asc",
79
- limit: pe,
80
- counterpart_name__icontains: E || void 0,
81
- is_vendor: !0,
82
- enabled: !b && (D === "edit" || !D && !u) && ve && Ee
83
- });
84
- f(() => {
85
- z.isPlaceholderData || (ke.current = E);
86
- }, [E, z.isPlaceholderData]);
87
- let Ye = z.isPlaceholderData && ke.current !== E, B = le({
88
- selectedId: u,
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,
96
- counterpartType: "vendor",
97
- counterpart: B.counterpart,
98
- primaryAddress: B.primaryAddress,
99
- includeBankAccount: !1
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;
102
- if (!e) return;
103
- if (B.isBankAccountsLoading) return {
104
- name: l(e),
105
- email: c(e),
106
- methodLabel: w.paymentMethodLoading,
107
- hasPaymentInstructions: !1
108
- };
109
- if (B.isBankAccountsError) return {
110
- name: l(e),
111
- email: c(e),
112
- methodLabel: w.paymentMethodUnavailable,
113
- hasPaymentInstructions: !1
114
- };
115
- let t = re(B.bankAccounts);
116
- return {
117
- name: l(e),
118
- email: c(e),
119
- methodLabel: t ? w.paymentInstructionsValue(t.account_number?.slice(-4) ?? "") : w.noMethod,
120
- hasPaymentInstructions: !!t
121
- };
122
- }, [
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;
132
- return {
133
- name: e,
134
- email: y?.email ?? "",
135
- description: w.pendingVendorDescription,
136
- methodLabel: t ? w.paymentInstructionsValue(t.slice(-4)) : "",
137
- hasPaymentInstructions: !!t
138
- };
139
- }, [
140
- u,
141
- W?.accountNumber,
142
- y?.email,
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();
151
- else {
152
- Qe();
153
- let e = T.trim();
154
- H((t) => ({
155
- ...t,
156
- entityType: "organization",
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;
162
- }
163
- Ae(e);
164
- }, [
165
- u,
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) => ({
177
- ...t,
178
- ...e
179
- })), P(void 0);
180
- }, []), ut = d(() => {
181
- Ke ? C(L) : L();
182
- }, [
183
- L,
184
- C,
185
- Ke
186
- ]), Y = d(() => {
187
- J(), L();
188
- }, [L, J]), X = Fe || Ke, Z = d((e) => {
189
- let t = () => {
190
- Y(), e();
191
- };
192
- X ? C(t) : t();
193
- }, [
194
- C,
195
- Y,
196
- X
197
- ]), dt = d(() => {
198
- X ? C(Y) : Y();
199
- }, [
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 };
208
- }
209
- if (D === "edit" && at) return { ok: !1 };
210
- if (D) {
211
- if (D === "create" && F.current) n = F.current;
212
- else {
213
- let e = await tt();
214
- if (!e.ok) return { ok: !1 };
215
- D === "create" ? (n = e.counterpartId, F.current = n) : n = e.counterpartId ?? n;
216
- }
217
- D === "create" && (r = !0);
218
- }
219
- if (!n) return { ok: !0 };
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), {
224
- ok: !0,
225
- counterpartId: n,
226
- counterpartBankAccountId: e
227
- }) : r ? (t && J(), R(n), {
228
- ok: !0,
229
- counterpartId: n
230
- }) : a ? { ok: !1 } : (t && (A(!1), D && J()), {
231
- ok: !0,
232
- counterpartId: n,
233
- counterpartBankAccountId: rt
234
- });
235
- }
236
- if (a) return { ok: !1 };
237
- P(void 0);
238
- let o = ie(B.bankAccounts, Be ?? q?.id), s;
239
- try {
240
- o.kind === "update" ? (await Ze.mutateAsync({
241
- path: {
242
- counterpart_id: n,
243
- bank_account_id: o.bankAccountId
244
- },
245
- body: te(i, { includeAchDefaults: o.includeAchDefaults })
246
- }), s = o.bankAccountId) : s = (await Xe.mutateAsync({
247
- path: { counterpart_id: n },
248
- body: ee(i, { isDefaultForCurrency: o.isDefaultForCurrency })
249
- }))?.id;
250
- } catch {
251
- return e.error(w.bankAccountSaveFailed), {
252
- ok: !1,
253
- counterpartId: n
254
- };
255
- }
256
- return N.current = i, ze(s ? {
257
- counterpartId: n,
258
- bankAccountId: s
259
- } : void 0), t && (A(!1), D && J()), r && R(n), {
260
- ok: !0,
261
- counterpartId: n,
262
- counterpartBankAccountId: s
263
- };
264
- }, [
265
- J,
266
- u,
267
- Xe,
268
- B.bankAccounts,
269
- B.isBankAccountsError,
270
- B.isBankAccountsFetching,
271
- B.isBankAccountsLoading,
272
- D,
273
- at,
274
- K,
275
- we,
276
- rt,
277
- R,
278
- q,
279
- tt,
280
- Ze,
281
- Be
282
- ]), pt = d((e) => {
283
- if (I.current) return I.current;
284
- let t = e?.closeOnSuccess ?? !0, n = (async () => {
285
- Ge(!0);
286
- try {
287
- return await ft(t);
288
- } finally {
289
- I.current = void 0, Ge(!1);
290
- }
291
- })();
292
- return I.current = n, n;
293
- }, [ft]), mt = d(() => {
294
- A(!1), D && J();
295
- }, [D, J]), ht = p(() => (z.data?.data ?? []).map((e) => ({
296
- name: l(e),
297
- email: c(e),
298
- onSelect: () => {
299
- Z(() => R(e.id));
300
- }
301
- })), [
302
- z.data,
303
- Z,
304
- R
305
- ]), gt = d((e) => {
306
- O(!0), H((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
307
- ...t,
308
- ...e,
309
- firstName: t.firstName || t.legalName,
310
- legalName: t.legalName
311
- } : e.entityType === "organization" && t.entityType !== "organization" ? {
312
- ...t,
313
- ...e,
314
- legalName: t.legalName || [t.firstName, t.lastName].filter(Boolean).join(" ")
315
- } : {
316
- ...t,
317
- ...e
318
- });
319
- }, [H]), _t = d((e) => {
320
- O(!0), H((t) => ({
321
- ...t,
322
- address: {
323
- ...t.address,
324
- ...e
325
- }
326
- }));
327
- }, [H]), vt = {
328
- query: T,
329
- onQueryChange: De,
330
- isLoading: !ve || !Te || !!u && B.isLoading || z.isLoading || z.isFetching && Ye,
331
- onAddVendor: () => {
332
- Z(() => st("create"));
17
+ function r(r) {
18
+ if (!r) return;
19
+ let i = {
20
+ legalName: e(r.name),
21
+ email: e(r.email),
22
+ phone: e(r.phone),
23
+ address: {
24
+ line1: e(r.address?.line1),
25
+ line2: e(r.address?.line2),
26
+ city: e(r.address?.city),
27
+ state: t(r.address?.state),
28
+ postalCode: e(r.address?.postal_code)
333
29
  },
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,
345
- canEditExisting: xe
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))
363
- } : void 0;
364
- if (D) return {
365
- mode: "creating",
366
- summary: G,
367
- newVendorForm: /* @__PURE__ */ fe(de, {
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
381
- }),
382
- ...$
383
- };
384
- if (G) return {
385
- mode: "resolved",
386
- summary: G,
387
- onEdit: x && !at ? () => Z(() => st("edit")) : void 0,
388
- ...$
389
- };
390
- if (nt) {
391
- let e = () => Z(() => {
392
- Ue(!0), st("create");
393
- });
394
- return {
395
- mode: "resolved",
396
- summary: nt,
397
- onEdit: x ? e : void 0,
398
- error: be,
399
- ...$,
400
- showPaymentInstructions: !0,
401
- paymentInstructions: x && S ? {
402
- isOpen: !1,
403
- values: j,
404
- errors: Le,
405
- onOpen: e,
406
- onChange: lt,
407
- onCancel: ut,
408
- canEditExisting: !0
409
- } : void 0
410
- };
411
- }
412
- return {
413
- mode: "selecting",
414
- error: z.isError ? w.searchFailed : B.isError ? w.vendorDetailsFailed : be,
415
- search: vt,
416
- ...$
30
+ bankAccount: n(r)
417
31
  };
32
+ return i.legalName || i.email || i.phone || Object.values(i.address).some(Boolean) || i.bankAccount ? i : void 0;
418
33
  }
419
34
  //#endregion
420
- export { v as useVendorSectionProps };
35
+ export { r as buildVendorPrefill };
@@ -1,16 +1,92 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { Button as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { getStateOptions as t } from "../../../../shared/util/dist/lib/usStates.js";
7
+ import { AchFieldGroup as n } from "../../../../shared/counterpart-management/ui/dist/index5.js";
8
+ import { CounterpartFormFields as r, useFocusFirstInvalidField as i } from "../../../../shared/counterpart-management/ui/dist/index9.js";
9
+ import "../../../../shared/counterpart-management/ui/dist/index.js";
10
+ import { VendorSearchCombobox as a } from "../../ui/dist/index24.js";
11
+ import "../../ui/dist/index.js";
12
+ import { mergeVendorInlineFormLabels as o } from "./index25.js";
13
+ import "../../../../shared/counterpart-management/feature/dist/index.js";
14
+ import { useMemo as s } from "react";
15
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
1
16
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js
2
- function e(e) {
3
- return new Promise((t, n) => {
4
- let r = new FileReader();
5
- r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read file")), r.onload = () => {
6
- let e = r.result;
7
- if (typeof e != "string") {
8
- n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
9
- return;
10
- }
11
- t(e.slice(e.indexOf(",") + 1));
12
- }, r.readAsDataURL(e);
17
+ function u({ mode: u, values: d, errors: f, onChange: p, onAddressChange: m, sectionsToExpand: h, onAddressExpand: g, onCancel: _, onSave: v, isSaving: y = !1, search: b, paymentInstructions: x, labels: S }) {
18
+ let C = s(() => o(S), [S]), w = s(() => t(), []), T = i(f ?? {});
19
+ return /* @__PURE__ */ l("div", {
20
+ ref: T,
21
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4",
22
+ children: [
23
+ /* @__PURE__ */ c("p", {
24
+ className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
25
+ children: u === "edit" ? C.editTitle : C.createTitle
26
+ }),
27
+ u === "edit" && b ? /* @__PURE__ */ c(a, {
28
+ ...b,
29
+ labels: { fieldLabel: C.switchVendorFieldLabel }
30
+ }) : null,
31
+ /* @__PURE__ */ c(r, {
32
+ mode: u,
33
+ counterpartMode: "vendor",
34
+ values: d,
35
+ errors: f,
36
+ stateOptions: w,
37
+ onChange: p,
38
+ onAddressChange: m,
39
+ sections: {
40
+ entityType: !0,
41
+ profileHeading: !1,
42
+ title: !1,
43
+ taxId: !1,
44
+ address: "collapsible",
45
+ bankAccount: !1
46
+ },
47
+ sectionsToExpand: h,
48
+ onAddressExpand: g,
49
+ labels: { businessNameLabel: C.nameLabel }
50
+ }),
51
+ x ? /* @__PURE__ */ l("div", {
52
+ className: "ttw:flex ttw:flex-col ttw:gap-3",
53
+ children: [/* @__PURE__ */ l("div", {
54
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
55
+ children: [/* @__PURE__ */ c("p", {
56
+ className: "ttw:text-sm ttw:font-semibold ttw:text-foreground",
57
+ children: C.paymentInstructionsHeading
58
+ }), /* @__PURE__ */ c("p", {
59
+ className: "ttw:text-sm ttw:text-muted-foreground",
60
+ children: x.isExtracted ? C.paymentInstructionsExtracted : C.paymentInstructionsDescription
61
+ })]
62
+ }), /* @__PURE__ */ c(n, {
63
+ idPrefix: "vendor-inline-ach",
64
+ values: x.values,
65
+ errors: x.errors,
66
+ onChange: x.onChange,
67
+ labels: C.ach
68
+ })]
69
+ }) : null,
70
+ /* @__PURE__ */ l("div", {
71
+ className: "ttw:flex ttw:justify-end ttw:gap-2",
72
+ children: [/* @__PURE__ */ c(e, {
73
+ type: "button",
74
+ variant: "outline",
75
+ onClick: _,
76
+ "aria-label": C.cancelAriaLabel,
77
+ disabled: y,
78
+ children: C.cancel
79
+ }), v ? /* @__PURE__ */ c(e, {
80
+ type: "button",
81
+ onClick: v,
82
+ "aria-label": C.saveAriaLabel,
83
+ loading: y,
84
+ disabled: y,
85
+ children: C.save
86
+ }) : null]
87
+ })
88
+ ]
13
89
  });
14
90
  }
15
91
  //#endregion
16
- export { e as encodeFileToBase64 };
92
+ export { u as VendorInlineForm, u as default };