@tesouro/embedded-components-react 0.2.296 → 0.2.299

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 (45) hide show
  1. package/dist/index.css +6 -0
  2. package/dist/index.d.ts +107 -87
  3. package/dist/lib/CounterpartsWidget.d.ts +24 -4
  4. package/dist/lib/ReceivablesWidget.d.ts +20 -3
  5. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index.js +3 -2
  6. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +2 -2
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +210 -199
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +31 -27
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +2 -0
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +122 -149
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +163 -72
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +3 -3
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +52 -46
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +8 -2
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +98 -67
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +6 -1
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +7 -3
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index7.js +4 -1
  19. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +12 -7
  20. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +1 -1
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +17 -16
  23. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +103 -50
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -1
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js +2 -0
  27. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +126 -76
  28. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +12 -11
  29. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +6 -173
  30. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +173 -5
  31. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +5 -57
  32. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +51 -22
  33. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index14.js +24 -72
  34. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +76 -0
  35. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +13 -7
  36. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +53 -110
  37. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index6.js +115 -51
  38. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +53 -47
  39. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +44 -504
  40. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +480 -6
  41. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +21 -19
  42. package/dist/libs/tesouro-embedded-components-react/{accept-disclosures-widget/data-access/dist/index2.js → shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js} +3 -4
  43. package/dist/libs/tesouro-embedded-components-react/{accept-disclosures-widget/data-access/dist/index3.js → shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js} +4 -5
  44. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  45. package/package.json +1 -1
@@ -3,38 +3,41 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { Dialog as e, DialogContent as t, DialogTitle as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { OnboardingShell as r } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
6
+ import { useAcceptWidgetDisclosures as r } from "../../../shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js";
7
+ import { useDisclosuresQuery as i } from "../../../shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js";
8
+ import "../../../shared/data-access/dist/index.js";
9
+ import { OnboardingShell as a } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
7
10
  import "../../../shared/ui/dist/index.js";
8
- import { useAnalyticsTrack as i } from "../../../shared/feature/dist/lib/analytics/hooks.js";
9
- import { WidgetProvider as a } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
10
- import { getStateOptions as o } from "../../../shared/util/dist/lib/usStates.js";
11
- import { extractApiErrorMessage as s } from "../../../shared/util/dist/lib/apiErrors.js";
12
- import { useRefetchWidget as ee, useWidgetConfig as c } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
13
- import { getNaicsOptions as l } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
11
+ import { useAnalyticsTrack as o } from "../../../shared/feature/dist/lib/analytics/hooks.js";
12
+ import { WidgetProvider as s } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
13
+ import { getStateOptions as c } from "../../../shared/util/dist/lib/usStates.js";
14
+ import { extractApiErrorMessage as l } from "../../../shared/util/dist/lib/apiErrors.js";
15
+ import { useRefetchWidget as u, useWidgetConfig as d } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
16
+ import { getNaicsOptions as f } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
14
17
  import "../../../shared/feature/dist/index.js";
15
- import { ADDITIONAL_OWNERS_LABELS_EN as u } from "../../ui/dist/index4.js";
16
- import { interpolateBankName as d } from "../../ui/dist/index6.js";
17
- import { ResultStep as te } from "../../ui/dist/index11.js";
18
- import { MarketingWidget as ne } from "../../ui/dist/index28.js";
18
+ import { ADDITIONAL_OWNERS_LABELS_EN as p } from "../../ui/dist/index4.js";
19
+ import { interpolateBankName as m } from "../../ui/dist/index6.js";
20
+ import { ResultStep as ee } from "../../ui/dist/index11.js";
21
+ import { MarketingWidget as te } from "../../ui/dist/index28.js";
19
22
  import "../../ui/dist/index.js";
20
- import { BusinessDetailsStep as re } from "./index9.js";
21
- import { PersonalDetailsStep as ie } from "./index11.js";
22
- import { AdditionalOwnersStep as ae } from "./index13.js";
23
- import { buildCreateApplicationBody as oe, buildUpdateApplicationBody as se } from "./index14.js";
24
- import { OnboardingAnalyticsEvent as f, WIDGET_NAME as p } from "./index15.js";
25
- import { DEFAULT_LABELS as m } from "./index16.js";
26
- import { ApplicationClientSecretProvider as h, useApplicationClientSecret as ce } from "../../data-access/dist/index2.js";
27
- import { useCreateApplication as le } from "../../data-access/dist/index4.js";
28
- import { useUpdateApplication as ue } from "../../data-access/dist/index6.js";
29
- import { useSubmitApplication as de } from "../../data-access/dist/index7.js";
30
- import { usePollApplicationCompletion as fe } from "../../data-access/dist/index8.js";
31
- import { OnboardingSuppressionReason as pe } from "../../data-access/dist/index9.js";
32
- import { useOrganizationOnboardingSuppression as me } from "../../data-access/dist/index10.js";
23
+ import { BusinessDetailsStep as ne } from "./index9.js";
24
+ import { PersonalDetailsStep as re } from "./index11.js";
25
+ import { AdditionalOwnersStep as ie } from "./index13.js";
26
+ import { buildCreateApplicationBody as ae, buildUpdateApplicationBody as h } from "./index14.js";
27
+ import { OnboardingAnalyticsEvent as g, WIDGET_NAME as _ } from "./index15.js";
28
+ import { DEFAULT_LABELS as v } from "./index16.js";
29
+ import { ApplicationClientSecretProvider as oe, useApplicationClientSecret as se } from "../../data-access/dist/index2.js";
30
+ import { useCreateApplication as ce } from "../../data-access/dist/index4.js";
31
+ import { useUpdateApplication as le } from "../../data-access/dist/index6.js";
32
+ import { useSubmitApplication as ue } from "../../data-access/dist/index7.js";
33
+ import { usePollApplicationCompletion as de } from "../../data-access/dist/index8.js";
34
+ import { OnboardingSuppressionReason as y } from "../../data-access/dist/index9.js";
35
+ import { useOrganizationOnboardingSuppression as fe } from "../../data-access/dist/index10.js";
33
36
  import "../../data-access/dist/index.js";
34
- import { useCallback as g, useEffect as _, useMemo as v, useRef as he, useState as y } from "react";
35
- import { Fragment as ge, jsx as b, jsxs as x } from "react/jsx-runtime";
37
+ import { useCallback as b, useEffect as x, useMemo as S, useRef as pe, useState as C } from "react";
38
+ import { Fragment as me, jsx as w, jsxs as T } from "react/jsx-runtime";
36
39
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js
37
- var _e = {
40
+ var he = {
38
41
  companyLegalName: "",
39
42
  companyDbaName: "",
40
43
  businessAddress: "",
@@ -48,7 +51,7 @@ var _e = {
48
51
  naicsCode: "",
49
52
  isAuthorized: null,
50
53
  isCheckboxChecked: !1
51
- }, ve = {
54
+ }, ge = {
52
55
  firstName: "",
53
56
  lastName: "",
54
57
  dateOfBirth: void 0,
@@ -62,7 +65,7 @@ var _e = {
62
65
  ownsOver25Percent: null,
63
66
  ownershipPercentage: null
64
67
  };
65
- function ye(e, t) {
68
+ function _e(e, t) {
66
69
  if (e === 0) return {
67
70
  title: t.businessReviewTitle,
68
71
  subtitle: t.businessReviewSubtitle
@@ -72,7 +75,7 @@ function ye(e, t) {
72
75
  subtitle: t.personalReviewSubtitle
73
76
  };
74
77
  let n = {
75
- ...u,
78
+ ...p,
76
79
  ...t.additionalOwners
77
80
  };
78
81
  return {
@@ -80,234 +83,242 @@ function ye(e, t) {
80
83
  subtitle: n.subheading
81
84
  };
82
85
  }
83
- function be({ onEmbeddedOnboardingCompletedSuccessfully: a, onNavigateToDashboard: u, labels: p, initialBusinessDetails: h, initialPersonalDetails: be, initialAdditionalOwners: S, bankLogoSrc: xe, disclosureLinks: Se, marketingContent: C = null, open: Ce, defaultOpen: w, onOpenChange: T }) {
84
- let E = i();
85
- _(() => {
86
- E(f.Mounted);
87
- }, [E]);
88
- let D = {
89
- ...m,
90
- ...p,
86
+ function E({ onEmbeddedOnboardingCompletedSuccessfully: s, onNavigateToDashboard: p, labels: _, initialBusinessDetails: oe, initialPersonalDetails: E, initialAdditionalOwners: D, bankLogoSrc: ve, disclosureLinks: ye, marketingContent: O = null, open: be, defaultOpen: k, onOpenChange: A }) {
87
+ let j = o();
88
+ x(() => {
89
+ j(g.Mounted);
90
+ }, [j]);
91
+ let M = {
92
+ ...v,
93
+ ..._,
91
94
  stepIndicator: {
92
- ...m.stepIndicator,
93
- ...p?.stepIndicator
95
+ ...v.stepIndicator,
96
+ ..._?.stepIndicator
94
97
  },
95
- businessDetails: p?.businessDetails ?? {},
96
- personalDetails: p?.personalDetails ?? {},
97
- additionalOwners: p?.additionalOwners ?? {},
98
+ businessDetails: _?.businessDetails ?? {},
99
+ personalDetails: _?.personalDetails ?? {},
100
+ additionalOwners: _?.additionalOwners ?? {},
98
101
  result: {
99
- ...m.result,
100
- ...p?.result
102
+ ...v.result,
103
+ ..._?.result
101
104
  }
102
- }, O = c().initResponse, { termsHref: we, privacyHref: Te, electronicCommunicationHref: Ee, patriotActHref: De } = Se ?? {}, Oe = C !== null, k = Ce === void 0, [ke, A] = y(!1), [Ae, je] = y(!0), [Me, Ne] = y(() => w ?? !1), Pe = xe ?? C?.bankLogoSrc ?? void 0, Fe = k ? Me : Ce, Ie = w ?? !1, j = g((e) => {
103
- k && Ne(e), T?.(e);
104
- }, [T, k]), Le = g(() => {
105
- E(f.OpenMarketing), A(!0);
106
- }, [E]), Re = g(() => {
107
- A(!1);
108
- }, []), ze = g(() => {
109
- E(f.BeginOnboarding), A(!1), j(!0);
110
- }, [j, E]), Be = g(() => {
111
- je(!1), a();
112
- }, [a]), Ve = ee(), [M, N] = y(0), [He, Ue] = y(() => ({
113
- ..._e,
114
- ...h
115
- })), [P, We] = y(() => ({
116
- ...ve,
117
- ...be
118
- })), [Ge, Ke] = y(() => S ?? []), [F, qe] = y(null), [I, Je] = y(null), [L, Ye] = y(null), [R, Xe] = y(null), [Ze, z] = y(null), [B, V] = y(!1), [H, U] = y(null), W = le(), G = ue(), K = de(), Qe = fe(), { setClientSecret: $e } = ce(), q = me(), J = he(null);
119
- _(() => () => J.current?.abort(), []);
120
- let et = v(() => l(D.businessDetails.naicsTitles), [D.businessDetails.naicsTitles]), tt = v(() => o(D.businessDetails.stateTitles), [D.businessDetails.stateTitles]), nt = v(() => o(D.personalDetails.stateTitles), [D.personalDetails.stateTitles]), rt = v(() => o(D.additionalOwners.stateTitles), [D.additionalOwners.stateTitles]), Y = B || H !== null, X = O?.status === "ACTIVE" || O?.status === "INACTIVE", it = O?.status === "INVITED", Z = !!O && !Y && (X || it || q.isSuppressed), Q = Z ? X ? pe.UserAlreadyOnboarded : it ? pe.UserInvitedToOrganization : q.reason : null;
121
- if (_(() => {
122
- !Z || !Q || (E(f.Suppressed, { reason: Q }), console.info(`[onboarding] not shown: ${Q}`));
105
+ }, N = d().initResponse, { termsHref: xe, privacyHref: Se, electronicCommunicationHref: Ce, patriotActHref: we } = ye ?? {}, Te = O !== null, P = be === void 0, [Ee, F] = C(!1), [De, Oe] = C(!0), [ke, Ae] = C(() => k ?? !1), je = ve ?? O?.bankLogoSrc ?? void 0, Me = P ? ke : be, Ne = k ?? !1, I = b((e) => {
106
+ P && Ae(e), A?.(e);
107
+ }, [A, P]), Pe = b(() => {
108
+ j(g.OpenMarketing), F(!0);
109
+ }, [j]), Fe = b(() => {
110
+ F(!1);
111
+ }, []), Ie = b(() => {
112
+ j(g.BeginOnboarding), F(!1), I(!0);
113
+ }, [I, j]), Le = b(() => {
114
+ Oe(!1), s();
115
+ }, [s]), Re = u(), [L, R] = C(0), [ze, Be] = C(() => ({
116
+ ...he,
117
+ ...oe
118
+ })), [z, Ve] = C(() => ({
119
+ ...ge,
120
+ ...E
121
+ })), [He, Ue] = C(() => D ?? []), [B, We] = C(null), [V, Ge] = C(null), [H, Ke] = C(null), [U, qe] = C(null), [Je, W] = C(null), [G, Ye] = C(!1), [Xe, K] = C(null), Ze = ce(), q = le(), Qe = ue(), $e = de(), { setClientSecret: et } = se(), { data: tt, refetch: nt } = i(), { mutateAsync: rt } = r(), J = fe(), Y = pe(null);
122
+ x(() => () => Y.current?.abort(), []);
123
+ let it = S(() => f(M.businessDetails.naicsTitles), [M.businessDetails.naicsTitles]), at = S(() => c(M.businessDetails.stateTitles), [M.businessDetails.stateTitles]), ot = S(() => c(M.personalDetails.stateTitles), [M.personalDetails.stateTitles]), st = S(() => c(M.additionalOwners.stateTitles), [M.additionalOwners.stateTitles]), X = G || Xe !== null, ct = N?.status === "ACTIVE" || N?.status === "INACTIVE", lt = N?.status === "INVITED", Z = !!N && !X && (ct || lt || J.isSuppressed), Q = Z ? ct ? y.UserAlreadyOnboarded : lt ? y.UserInvitedToOrganization : J.reason : null;
124
+ if (x(() => {
125
+ !Z || !Q || (j(g.Suppressed, { reason: Q }), console.info(`[onboarding] not shown: ${Q}`));
123
126
  }, [
124
127
  Z,
125
128
  Q,
126
- E
127
- ]), !O || !Y && (Z || !q.isResolved)) return null;
128
- let at = F?.companyStructure === "SOLE_PROPRIETORSHIP", ot = [
129
- D.stepIndicator.business,
130
- D.stepIndicator.personal,
131
- D.stepIndicator.ownership
132
- ], st = M === 0 ? F : M === 1 ? I : M === 2 ? L : null, $ = W.isPending || G.isPending || K.isPending || B, ct = () => {
133
- z(null), N((e) => e === 0 ? 0 : e - 1);
134
- }, lt = () => {
135
- j(!1);
136
- }, ut = async (e) => {
137
- V(!0), j(!0);
129
+ j
130
+ ]), !N || !X && (Z || !J.isResolved)) return null;
131
+ let ut = B?.companyStructure === "SOLE_PROPRIETORSHIP", dt = [
132
+ M.stepIndicator.business,
133
+ M.stepIndicator.personal,
134
+ M.stepIndicator.ownership
135
+ ], ft = L === 0 ? B : L === 1 ? V : L === 2 ? H : null, $ = Ze.isPending || q.isPending || Qe.isPending || G, pt = () => {
136
+ W(null), R((e) => e === 0 ? 0 : e - 1);
137
+ }, mt = () => {
138
+ I(!1);
139
+ }, ht = async (e) => {
140
+ Ye(!0), I(!0);
138
141
  let t = new AbortController();
139
- J.current = t;
142
+ Y.current = t;
140
143
  let n = !1;
141
144
  try {
142
- let r = await K.mutateAsync({ path: { id: e } });
145
+ let r = await Qe.mutateAsync({ path: { id: e } });
143
146
  if (t.signal.aborted) return;
144
- if (!r.id) throw Error(D.submitFailedError);
145
- n = !0, (await Qe(e, { signal: t.signal })).status === "complete" ? (U("success"), Ve(), Be()) : U("pending");
147
+ if (!r.id) throw Error(M.submitFailedError);
148
+ if (n = !0, (await $e(e, { signal: t.signal })).status === "complete") {
149
+ let e = tt;
150
+ if (e === void 0 && (e = (await nt()).data), t.signal.aborted) return;
151
+ if (e !== void 0) try {
152
+ await rt({ displayedVersion: e.version ?? null });
153
+ } catch {}
154
+ if (t.signal.aborted) return;
155
+ K("success"), Re(), Le();
156
+ } else K("pending");
146
157
  } catch (e) {
147
158
  if (e instanceof DOMException && e.name === "AbortError") return;
148
159
  if (!n) throw e;
149
- U("pending");
160
+ K("pending");
150
161
  } finally {
151
- J.current = null, V(!1);
162
+ Y.current = null, Ye(!1);
152
163
  }
153
- }, dt = async () => {
154
- z(null);
164
+ }, gt = async () => {
165
+ W(null);
155
166
  try {
156
- if (M === 0) {
157
- if (!F) return;
158
- let e = R;
167
+ if (L === 0) {
168
+ if (!B) return;
169
+ let e = U;
159
170
  if (!e) {
160
- let t = await W.mutateAsync({ body: oe(F) });
161
- e = t.id, Xe(e), t.clientSecret && $e(t.clientSecret);
171
+ let t = await Ze.mutateAsync({ body: ae(B) });
172
+ e = t.id, qe(e), t.clientSecret && et(t.clientSecret);
162
173
  }
163
- N(1);
164
- } else if (M === 1) {
165
- if (!I || !F || !R) return;
166
- await G.mutateAsync({
167
- path: { id: R },
168
- body: se({
169
- businessDetails: F,
170
- applicant: I
174
+ R(1);
175
+ } else if (L === 1) {
176
+ if (!V || !B || !U) return;
177
+ await q.mutateAsync({
178
+ path: { id: U },
179
+ body: h({
180
+ businessDetails: B,
181
+ applicant: V
171
182
  })
172
- }), N(2);
173
- } else if (M === 2) {
174
- if (!L || !R) return;
175
- await G.mutateAsync({
176
- path: { id: R },
177
- body: se({ businessOwners: L })
178
- }), await ut(R);
183
+ }), R(2);
184
+ } else if (L === 2) {
185
+ if (!H || !U) return;
186
+ await q.mutateAsync({
187
+ path: { id: U },
188
+ body: h({ businessOwners: H })
189
+ }), await ht(U);
179
190
  }
180
191
  } catch (e) {
181
- let t = s(e) ?? (e instanceof Error ? e.message : void 0) ?? D.genericRetryError;
182
- z(t);
192
+ let t = l(e) ?? (e instanceof Error ? e.message : void 0) ?? M.genericRetryError;
193
+ W(t);
183
194
  }
184
- }, ft = ye(Math.min(M, 2), D), pt = O.bankName?.trim() || D.fallbackBankName, mt = d(D.shellFdicDisclaimer, pt);
185
- if (Y) {
186
- let r = F?.companyLegalName ?? "", i = O.bankName?.trim() || D.fallbackBankName, a = H ?? "pending", o = a === "success", s = {
187
- ...m.result,
188
- ...D.result
195
+ }, _t = _e(Math.min(L, 2), M), vt = N.bankName?.trim() || M.fallbackBankName, yt = m(M.shellFdicDisclaimer, vt);
196
+ if (X) {
197
+ let r = B?.companyLegalName ?? "", i = N.bankName?.trim() || M.fallbackBankName, a = Xe ?? "pending", o = a === "success", s = {
198
+ ...v.result,
199
+ ...M.result
189
200
  };
190
- return /* @__PURE__ */ b(e, {
191
- open: Fe,
192
- onOpenChange: j,
193
- children: /* @__PURE__ */ x(t, {
201
+ return /* @__PURE__ */ w(e, {
202
+ open: Me,
203
+ onOpenChange: I,
204
+ children: /* @__PURE__ */ T(t, {
194
205
  className: "ttw:grid ttw:max-h-[95vh] ttw:w-[720px] ttw:max-w-[calc(100vw-2rem)] ttw:grid-rows-[1fr] ttw:gap-0 ttw:overflow-hidden ttw:rounded-2xl ttw:p-0",
195
- children: [/* @__PURE__ */ b(n, {
206
+ children: [/* @__PURE__ */ w(n, {
196
207
  className: "ttw:sr-only",
197
- children: D.modalTitle
198
- }), /* @__PURE__ */ b(te, {
208
+ children: M.modalTitle
209
+ }), /* @__PURE__ */ w(ee, {
199
210
  status: a,
200
- isLoading: B,
211
+ isLoading: G,
201
212
  loadingMessage: s.loadingMessage,
202
213
  headingLine1: o ? s.successHeadingLine1 : s.pendingHeadingLine1,
203
214
  headingLine2: `${r}!`,
204
215
  body: o ? s.successBody : s.pendingBody,
205
- followUpEmail: I?.workEmail ?? "",
216
+ followUpEmail: V?.workEmail ?? "",
206
217
  emailBoxLead: s.pendingEmailBoxLead,
207
218
  navigateToDashboardLabel: s.navigateToDashboard,
208
- bankLogoSrc: Pe,
209
- bankLogoAlt: d(s.bankLogoAlt, i),
210
- fdicDisclaimer: d(s.fdicDisclaimer, i),
211
- onNavigateToDashboard: u
219
+ bankLogoSrc: je,
220
+ bankLogoAlt: m(s.bankLogoAlt, i),
221
+ fdicDisclaimer: m(s.fdicDisclaimer, i),
222
+ onNavigateToDashboard: p
212
223
  })]
213
224
  })
214
225
  });
215
226
  }
216
- let ht = M === 2 ? D.submit : D.next, gt = st === null || $;
217
- return /* @__PURE__ */ x(ge, { children: [Oe && Ae && C ? /* @__PURE__ */ b(ne, {
218
- open: ke,
227
+ let bt = L === 2 ? M.submit : M.next, xt = ft === null || $;
228
+ return /* @__PURE__ */ T(me, { children: [Te && De && O ? /* @__PURE__ */ w(te, {
229
+ open: Ee,
219
230
  isVisible: !0,
220
- vspLogo: C.vspLogo,
221
- bankingText: C.bankingText,
222
- primaryCaption: C.primaryCaption,
223
- secondaryCaption: C.secondaryCaption,
224
- providedByCaption: C.providedByCaption,
225
- modalPrimaryImg: C.modalPrimaryImg,
226
- primaryModalHeader: C.primaryModalHeader,
227
- benefits: C.benefits,
228
- appearance: C.appearance,
229
- onOpenMarketingModal: Le,
230
- onCloseMarketingModal: Re,
231
- onPrimaryCtaClick: ze
232
- }) : null, /* @__PURE__ */ x(r, {
233
- open: Fe,
234
- defaultOpen: Ie,
235
- onOpenChange: j,
236
- title: ft.title,
237
- subtitle: ft.subtitle,
238
- stepLabels: ot,
239
- activeStep: M,
240
- disclaimerText: mt,
241
- onBack: M === 0 ? lt : ct,
242
- onCancel: M > 0 ? lt : void 0,
243
- onNext: dt,
231
+ vspLogo: O.vspLogo,
232
+ bankingText: O.bankingText,
233
+ primaryCaption: O.primaryCaption,
234
+ secondaryCaption: O.secondaryCaption,
235
+ providedByCaption: O.providedByCaption,
236
+ modalPrimaryImg: O.modalPrimaryImg,
237
+ primaryModalHeader: O.primaryModalHeader,
238
+ benefits: O.benefits,
239
+ appearance: O.appearance,
240
+ onOpenMarketingModal: Pe,
241
+ onCloseMarketingModal: Fe,
242
+ onPrimaryCtaClick: Ie
243
+ }) : null, /* @__PURE__ */ T(a, {
244
+ open: Me,
245
+ defaultOpen: Ne,
246
+ onOpenChange: I,
247
+ title: _t.title,
248
+ subtitle: _t.subtitle,
249
+ stepLabels: dt,
250
+ activeStep: L,
251
+ disclaimerText: yt,
252
+ onBack: L === 0 ? mt : pt,
253
+ onCancel: L > 0 ? mt : void 0,
254
+ onNext: gt,
244
255
  showDismissButton: !1,
245
- isNextDisabled: gt,
256
+ isNextDisabled: xt,
246
257
  isNextLoading: $,
247
- nextLabel: ht,
258
+ nextLabel: bt,
248
259
  nextIcon: null,
249
- errorMessage: Ze,
260
+ errorMessage: Je,
250
261
  labels: {
251
- backButton: M === 0 ? D.cancel : D.back,
252
- cancelButton: D.cancel
262
+ backButton: L === 0 ? M.cancel : M.back,
263
+ cancelButton: M.cancel
253
264
  },
254
265
  children: [
255
- M === 0 ? /* @__PURE__ */ b(re, {
256
- value: He,
257
- onValueChange: Ue,
258
- onSnapshotChange: qe,
259
- naicsOptions: et,
260
- stateOptions: tt,
266
+ L === 0 ? /* @__PURE__ */ w(ne, {
267
+ value: ze,
268
+ onValueChange: Be,
269
+ onSnapshotChange: We,
270
+ naicsOptions: it,
271
+ stateOptions: at,
261
272
  isSubmitting: $,
262
- labels: D.businessDetails,
263
- bankName: pt,
264
- termsHref: we,
265
- privacyHref: Te,
266
- electronicCommunicationHref: Ee,
267
- patriotActHref: De
273
+ labels: M.businessDetails,
274
+ bankName: vt,
275
+ termsHref: xe,
276
+ privacyHref: Se,
277
+ electronicCommunicationHref: Ce,
278
+ patriotActHref: we
268
279
  }, "business") : null,
269
- M === 1 ? /* @__PURE__ */ b(ie, {
270
- value: P,
271
- onValueChange: We,
272
- onSnapshotChange: Je,
273
- stateOptions: nt,
280
+ L === 1 ? /* @__PURE__ */ w(re, {
281
+ value: z,
282
+ onValueChange: Ve,
283
+ onSnapshotChange: Ge,
284
+ stateOptions: ot,
274
285
  isSubmitting: $,
275
- labels: D.personalDetails
286
+ labels: M.personalDetails
276
287
  }, "personal") : null,
277
- M === 2 ? /* @__PURE__ */ b(ae, {
278
- owners: Ge,
279
- onOwnersChange: Ke,
280
- primaryOwnerName: `${P.firstName} ${P.lastName}`.trim(),
281
- primaryOwnerPercentage: at ? 100 : I?.ownsOver25Percent === !0 ? I.ownershipPercentage ?? 0 : 0,
282
- stateOptions: rt,
283
- onSnapshotChange: Ye,
288
+ L === 2 ? /* @__PURE__ */ w(ie, {
289
+ owners: He,
290
+ onOwnersChange: Ue,
291
+ primaryOwnerName: `${z.firstName} ${z.lastName}`.trim(),
292
+ primaryOwnerPercentage: ut ? 100 : V?.ownsOver25Percent === !0 ? V.ownershipPercentage ?? 0 : 0,
293
+ stateOptions: st,
294
+ onSnapshotChange: Ke,
284
295
  isSubmitting: $,
285
- labels: D.additionalOwners
296
+ labels: M.additionalOwners
286
297
  }) : null
287
298
  ]
288
299
  })] });
289
300
  }
290
- function S({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: o, implementation: s, uiFramework: ee, errorFallback: c, onError: l, analytics: u, disclosuresAcceptance: d, ...te }) {
291
- return /* @__PURE__ */ b(a, {
301
+ function D({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, ...p }) {
302
+ return /* @__PURE__ */ w(s, {
292
303
  baseUrl: e,
293
304
  widgetToken: t,
294
305
  organizationId: n,
295
306
  configClient: r,
296
307
  gatewayRouting: i,
297
- linkComponent: o,
298
- implementation: s,
299
- uiFramework: ee,
300
- errorFallback: c,
301
- onError: l,
302
- analytics: u,
303
- disclosuresAcceptance: d,
304
- widgetName: p,
305
- children: /* @__PURE__ */ b(xe, { ...te })
308
+ linkComponent: a,
309
+ implementation: o,
310
+ uiFramework: c,
311
+ errorFallback: l,
312
+ onError: u,
313
+ analytics: d,
314
+ disclosuresAcceptance: f,
315
+ widgetName: _,
316
+ children: /* @__PURE__ */ w(ve, { ...p })
306
317
  });
307
318
  }
308
- function xe(e) {
309
- let { initResponse: t } = c(), n = t?.userId ?? null, [r, i] = y(n), [a, o] = y(0);
310
- return n !== r && (i(n), r !== null && n !== null && o((e) => e + 1)), /* @__PURE__ */ b(h, { children: /* @__PURE__ */ b(be, { ...e }, a) }, a);
319
+ function ve(e) {
320
+ let { initResponse: t } = d(), n = t?.userId ?? null, [r, i] = C(n), [a, o] = C(0);
321
+ return n !== r && (i(n), r !== null && n !== null && o((e) => e + 1)), /* @__PURE__ */ w(oe, { children: /* @__PURE__ */ w(E, { ...e }, a) }, a);
311
322
  }
312
323
  //#endregion
313
- export { S as BankAccountOnboardingWidget, S as default };
324
+ export { D as BankAccountOnboardingWidget, D as default };
@@ -32,44 +32,48 @@ function g({ open: g, onOpenChange: _, payableId: v, readOnly: y, copy: b }) {
32
32
  }, [w, I]);
33
33
  let L = d((e) => {
34
34
  T(!0), C(e);
35
- }, []), R = i({
35
+ }, []), R = l({
36
+ payableId: A,
37
+ counterpartId: S,
38
+ payableCounterpartId: I,
39
+ onCounterpartChange: L,
40
+ requiredError: F.errors?.vendor
41
+ }), z = i({
36
42
  payableId: v,
37
43
  form: F,
38
44
  counterpartId: S,
45
+ clearCounterpart: !!(A && w) && !S,
46
+ prepareVendorForSave: R.savePaymentInstructions,
39
47
  onPayableCreated: k,
40
48
  onSaved: k,
41
49
  onDraftSaved: () => _(!1),
42
50
  onFinalized: () => _(!1)
43
- }), z = !!(R.isSavingDraft || R.isFinalizing), B = p(() => (N.data?.data ?? []).map((e) => ({
51
+ }), B = !!(z.isSavingDraft || z.isFinalizing), V = p(() => (N.data?.data ?? []).map((e) => ({
44
52
  value: e.id,
45
53
  label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
46
- })), [N.data]), V = P?.source_of_payable_data === "ocr", H = P?.counterpart_raw_data?.name, U = d(() => {
47
- !y && F.isDirty && !window.confirm(x.discardConfirm) || _(!1);
54
+ })), [N.data]), H = P?.source_of_payable_data === "ocr", U = P?.counterpart_raw_data?.name, W = d(() => {
55
+ let e = F.isDirty || R.hasUnsavedVendorChanges;
56
+ !y && e && !window.confirm(x.discardConfirm) || _(!1);
48
57
  }, [
49
58
  x.discardConfirm,
50
59
  F.isDirty,
51
60
  _,
52
- y
53
- ]), W = d((e) => {
54
- if (!z) return e ? _(!0) : U();
61
+ y,
62
+ R.hasUnsavedVendorChanges
63
+ ]), G = d((e) => {
64
+ if (!B) return e ? _(!0) : W();
55
65
  }, [
56
- U,
57
- z,
66
+ W,
67
+ B,
58
68
  _
59
- ]), G = l({
60
- payableId: A,
61
- counterpartId: S,
62
- payableCounterpartId: I,
63
- onCounterpartChange: L,
64
- requiredError: F.errors?.vendor
65
- });
69
+ ]);
66
70
  return /* @__PURE__ */ h(o, {
67
71
  open: g,
68
- onOpenChange: W,
69
- title: y ? x.readOnlyTitle : V && H ? x.extractedTitle(H) : x.newTitle,
70
- notice: V && !E ? /* @__PURE__ */ h(s, { onDismiss: () => D(!0) }) : void 0,
72
+ onOpenChange: G,
73
+ title: y ? x.readOnlyTitle : H && U ? x.extractedTitle(U) : x.newTitle,
74
+ notice: H && !E ? /* @__PURE__ */ h(s, { onDismiss: () => D(!0) }) : void 0,
71
75
  vendor: {
72
- ...G,
76
+ ...R,
73
77
  testId: u.vendorSection
74
78
  },
75
79
  values: F.values,
@@ -77,7 +81,7 @@ function g({ open: g, onOpenChange: _, payableId: v, readOnly: y, copy: b }) {
77
81
  onChange: F.onChange,
78
82
  lineItems: {
79
83
  items: F.lineItemRows,
80
- glCodeOptions: B,
84
+ glCodeOptions: V,
81
85
  discount: F.discount,
82
86
  onDiscountChange: F.onDiscountChange,
83
87
  tax: F.tax,
@@ -101,12 +105,12 @@ function g({ open: g, onOpenChange: _, payableId: v, readOnly: y, copy: b }) {
101
105
  }),
102
106
  readOnly: y,
103
107
  isLineItemsLoading: M.isResolving,
104
- isSaving: z,
105
- isSavingDraft: R.isSavingDraft,
106
- isFinalizing: R.isFinalizing,
107
- onCancel: U,
108
- onSaveDraft: R.saveDraft,
109
- onFinalize: R.finalize,
108
+ isSaving: B,
109
+ isSavingDraft: z.isSavingDraft,
110
+ isFinalizing: z.isFinalizing,
111
+ onCancel: W,
112
+ onSaveDraft: z.saveDraft,
113
+ onFinalize: z.finalize,
110
114
  testId: u.dialog
111
115
  });
112
116
  }
@@ -17,6 +17,8 @@ var e = {
17
17
  accountHolder: "Account holder",
18
18
  routingNumber: "Routing number",
19
19
  accountNumber: "Account number",
20
+ paymentMethodLoading: "Loading payment method...",
21
+ paymentMethodUnavailable: "We could not load payment methods. Try again.",
20
22
  searchFailed: "We could not load vendors. Try again.",
21
23
  vendorDetailsFailed: "We could not load this vendor. Try again."
22
24
  }, n = {