@tesouro/embedded-components-react 0.5.232 → 0.5.235

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 (24) hide show
  1. package/README.md +16 -14
  2. package/dist/index.d.ts +66 -15
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +39 -1
  4. package/dist/lib/ReceivablesWidget.d.ts +1 -0
  5. package/dist/lib/WidgetSuite.d.ts +65 -15
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +3 -2
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +2 -1
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +6 -0
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index23.js +15 -11
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index26.js +441 -409
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index10.js +18 -14
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +6 -3
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +26 -30
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +4 -2
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +13 -13
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +4 -1
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +1 -0
  19. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +35 -35
  20. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/clientRegistry.js +6 -3
  21. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js +123 -92
  23. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +12 -5
  24. package/package.json +1 -1
@@ -2,78 +2,78 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Dialog as e, DialogContent as t, DialogTitle as n, cn as r, toast as i } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { getStateOptions as a } from "../../../shared/util/dist/lib/usStates.js";
7
- import { extractApiErrorMessage as o } from "../../../shared/util/dist/lib/apiErrors.js";
8
- import { useEmbedApi as s } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
- import { personDisclosure as c } from "../../../shared/data-access/dist/lib/disclosures/personDisclosure.js";
10
- import { useAcceptWidgetDisclosures as l } from "../../../shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js";
11
- import { useDisclosuresQuery as u } from "../../../shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js";
5
+ import { Button as e, Dialog as t, DialogContent as n, DialogTitle as r, cn as i, toast as a } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { getStateOptions as o } from "../../../shared/util/dist/lib/usStates.js";
7
+ import { extractApiErrorMessage as s } from "../../../shared/util/dist/lib/apiErrors.js";
8
+ import { useEmbedApi as c } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
+ import { personDisclosure as l } from "../../../shared/data-access/dist/lib/disclosures/personDisclosure.js";
10
+ import { useAcceptWidgetDisclosures as u } from "../../../shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js";
11
+ import { useDisclosuresQuery as ee } from "../../../shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js";
12
12
  import { OnboardingSuppressionReason as d } from "../../../shared/data-access/dist/lib/onboardingSuppressionReason.js";
13
- import { useOrganizationOnboardingSuppression as ee } from "../../../shared/data-access/dist/lib/useOrganizationOnboardingSuppression.js";
14
- import { useOrganizationApplicationStatus as f } from "../../../shared/data-access/dist/lib/useOrganizationApplicationStatus.js";
13
+ import { useOrganizationOnboardingSuppression as f } from "../../../shared/data-access/dist/lib/useOrganizationOnboardingSuppression.js";
14
+ import { useOrganizationApplicationStatus as te } from "../../../shared/data-access/dist/lib/useOrganizationApplicationStatus.js";
15
15
  import "../../../shared/data-access/dist/index.js";
16
- import { EmbeddedToaster as te } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
17
- import { OnboardingShell as ne } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
16
+ import { EmbeddedToaster as ne } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
17
+ import { OnboardingShell as re } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
18
18
  import "../../../shared/ui/dist/index.js";
19
- import { useAnalyticsTrack as re } from "../../../shared/feature/dist/lib/analytics/hooks.js";
20
- import { WidgetProvider as ie } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
21
- import { useRefetchWidget as ae, useWidgetConfig as oe, useWidgetInitStaleForToken as se } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
22
- import { getNaicsOptions as ce } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
23
- import { deniedNoticeExpiresAt as le, selectBankAccountApplication as ue } from "../../../shared/feature/dist/lib/application/bankAccountApplication.js";
19
+ import { useAnalyticsTrack as ie } from "../../../shared/feature/dist/lib/analytics/hooks.js";
20
+ import { WidgetProvider as ae } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
21
+ import { useRefetchWidget as oe, useWidgetConfig as se, useWidgetInitStaleForToken as ce, useWidgetLoading as le } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
22
+ import { getNaicsOptions as ue } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
23
+ import { deniedNoticeExpiresAt as de, selectBankAccountApplication as fe } from "../../../shared/feature/dist/lib/application/bankAccountApplication.js";
24
24
  import "../../../shared/feature/dist/index.js";
25
- import { ADDITIONAL_OWNERS_LABELS_EN as de } from "../../ui/dist/index5.js";
26
- import { interpolateBankName as fe } from "../../ui/dist/index7.js";
27
- import { ApplicationStatusCard as pe } from "../../ui/dist/index10.js";
28
- import { ResultStep as me } from "../../ui/dist/index14.js";
29
- import { UnsavedApplicationDialog as he } from "../../ui/dist/index28.js";
30
- import { DeleteApplicationDialog as ge } from "../../ui/dist/index30.js";
25
+ import { ADDITIONAL_OWNERS_LABELS_EN as pe } from "../../ui/dist/index5.js";
26
+ import { interpolateBankName as me } from "../../ui/dist/index7.js";
27
+ import { ApplicationStatusCard as he } from "../../ui/dist/index10.js";
28
+ import { ResultStep as ge } from "../../ui/dist/index14.js";
29
+ import { UnsavedApplicationDialog as _e } from "../../ui/dist/index28.js";
30
+ import { DeleteApplicationDialog as ve } from "../../ui/dist/index30.js";
31
31
  import "../../ui/dist/index.js";
32
- import { DEFAULT_LABELS as p } from "./index22.js";
33
- import { identifierLast4 as _e, isIdentifierEnteredOrStored as m } from "./index7.js";
34
- import { bankAccountOnboardingTestIds as h } from "./index12.js";
35
- import { BusinessDetailsStep as ve } from "./index13.js";
36
- import { PersonalDetailsStep as ye } from "./index15.js";
37
- import { valuesKey as g } from "./index17.js";
38
- import { AdditionalOwnersStep as be } from "./index18.js";
39
- import { buildCreateApplicationBody as xe, buildUpdateApplicationBody as Se } from "./index19.js";
40
- import { buildOnboardingPrefill as Ce } from "./index20.js";
41
- import { acceptDraftedValues as we, asCreateBody as Te, buildDraftApplicationBody as Ee, draftOwners as De, withApplicantWorkEmail as Oe } from "./index21.js";
42
- import { OnboardingApplicationView as ke, applicationStatusNoticeFor as Ae, hiddenViewReason as je, isNoticeView as Me, mergeApplicationStatusLabels as Ne, onboardingApplicationViewFor as Pe } from "./index23.js";
43
- import { OnboardingAnalyticsEvent as Fe, WIDGET_NAME as Ie } from "./index24.js";
44
- import { withoutResumeOnlyOwnerFields as Le, withoutStoredIdentifierMarkers as Re } from "./index25.js";
45
- import { ApplicationClientSecretProvider as ze, useApplicationClientSecret as Be } from "../../data-access/dist/index3.js";
46
- import { useCreateApplication as Ve } from "../../data-access/dist/index5.js";
47
- import { useUpdateApplication as He } from "../../data-access/dist/index6.js";
48
- import { useSubmitApplication as Ue } from "../../data-access/dist/index7.js";
49
- import { useDeleteApplication as We } from "../../data-access/dist/index8.js";
50
- import { usePollApplicationCompletion as Ge } from "../../data-access/dist/index9.js";
51
- import { useResumableBankAccountApplication as Ke } from "../../data-access/dist/index11.js";
52
- import { useStartedBankAccountApplication as qe } from "../../data-access/dist/index12.js";
32
+ import { DEFAULT_LABELS as ye } from "./index22.js";
33
+ import { OnboardingApplicationView as be, applicationStatusNoticeFor as xe, hiddenViewReason as Se, isNoticeView as Ce, mergeApplicationStatusLabels as we, onboardingApplicationViewFor as Te } from "./index23.js";
34
+ import { identifierLast4 as Ee, isIdentifierEnteredOrStored as p } from "./index7.js";
35
+ import { bankAccountOnboardingTestIds as m } from "./index12.js";
36
+ import { BusinessDetailsStep as De } from "./index13.js";
37
+ import { PersonalDetailsStep as Oe } from "./index15.js";
38
+ import { valuesKey as h } from "./index17.js";
39
+ import { AdditionalOwnersStep as ke } from "./index18.js";
40
+ import { buildCreateApplicationBody as Ae, buildUpdateApplicationBody as je } from "./index19.js";
41
+ import { buildOnboardingPrefill as Me } from "./index20.js";
42
+ import { acceptDraftedValues as Ne, asCreateBody as Pe, buildDraftApplicationBody as Fe, draftOwners as Ie, withApplicantWorkEmail as Le } from "./index21.js";
43
+ import { OnboardingAnalyticsEvent as Re, WIDGET_NAME as ze } from "./index24.js";
44
+ import { withoutResumeOnlyOwnerFields as Be, withoutStoredIdentifierMarkers as Ve } from "./index25.js";
45
+ import { ApplicationClientSecretProvider as He, useApplicationClientSecret as Ue } from "../../data-access/dist/index3.js";
46
+ import { useCreateApplication as We } from "../../data-access/dist/index5.js";
47
+ import { useUpdateApplication as Ge } from "../../data-access/dist/index6.js";
48
+ import { useSubmitApplication as Ke } from "../../data-access/dist/index7.js";
49
+ import { useDeleteApplication as qe } from "../../data-access/dist/index8.js";
50
+ import { usePollApplicationCompletion as Je } from "../../data-access/dist/index9.js";
51
+ import { useResumableBankAccountApplication as Ye } from "../../data-access/dist/index11.js";
52
+ import { useStartedBankAccountApplication as Xe } from "../../data-access/dist/index12.js";
53
53
  import "../../data-access/dist/index.js";
54
- import { useCallback as Je, useEffect as _, useMemo as v, useReducer as Ye, useRef as Xe, useState as y } from "react";
55
- import { Fragment as Ze, jsx as b, jsxs as Qe } from "react/jsx-runtime";
54
+ import { useCallback as Ze, useEffect as g, useMemo as _, useReducer as Qe, useRef as v, useState as y } from "react";
55
+ import { Fragment as $e, jsx as b, jsxs as et } from "react/jsx-runtime";
56
56
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index26.js
57
- var $e = 2 ** 31 - 1, et = "DRAFT", tt = [], x = (e) => m(e, void 0);
58
- function nt(e) {
57
+ var tt = 2 ** 31 - 1, nt = "DRAFT", rt = [], x = (e) => p(e, void 0);
58
+ function it(e) {
59
59
  return {
60
60
  ...e,
61
61
  taxId: "",
62
- taxIdOnFileLast4: _e(e.taxId),
62
+ taxIdOnFileLast4: Ee(e.taxId),
63
63
  taxIdOnFileStructure: e.companyStructure === "" ? void 0 : e.companyStructure
64
64
  };
65
65
  }
66
- function S(e) {
66
+ function at(e) {
67
67
  return {
68
68
  ...e,
69
69
  ssn: "",
70
- ssnOnFileLast4: _e(e.ssn)
70
+ ssnOnFileLast4: Ee(e.ssn)
71
71
  };
72
72
  }
73
- function rt(e, t) {
73
+ function ot(e, t) {
74
74
  return t ? t.index === null ? [...e, t.owner] : e.map((e, n) => n === t.index ? t.owner : e) : e;
75
75
  }
76
- var it = {
76
+ var st = {
77
77
  companyLegalName: "",
78
78
  companyDbaName: "",
79
79
  businessAddress: "",
@@ -87,7 +87,7 @@ var it = {
87
87
  naicsCode: "",
88
88
  isAuthorized: null,
89
89
  isCheckboxChecked: !1
90
- }, at = {
90
+ }, ct = {
91
91
  firstName: "",
92
92
  lastName: "",
93
93
  dateOfBirth: void 0,
@@ -101,7 +101,7 @@ var it = {
101
101
  ownsOver25Percent: null,
102
102
  ownershipPercentage: null
103
103
  };
104
- function ot(e, t) {
104
+ function lt(e, t) {
105
105
  if (e === 0) return {
106
106
  title: t.businessReviewTitle,
107
107
  subtitle: t.businessReviewSubtitle
@@ -111,7 +111,7 @@ function ot(e, t) {
111
111
  subtitle: t.personalReviewSubtitle
112
112
  };
113
113
  let n = {
114
- ...de,
114
+ ...pe,
115
115
  ...t.additionalOwners
116
116
  };
117
117
  return {
@@ -119,61 +119,61 @@ function ot(e, t) {
119
119
  subtitle: n.subheading
120
120
  };
121
121
  }
122
- function st({ onEmbeddedOnboardingCompletedSuccessfully: ie, onNavigateToDashboard: de, labels: m, initialBusinessDetails: Ce, initialPersonalDetails: Ie, initialAdditionalOwners: Re, initialApplicationId: ze = null, initialBoundAuthEpoch: Ke, onEditableDraftChange: qe, onApplicationDeleted: et, bankLogoSrc: st, disclosureLinks: ct, open: lt, defaultOpen: ut, onOpenChange: C, isFullScreenInline: w = !1 }) {
123
- let T = re(), { authEpoch: dt } = s();
124
- _(() => {
125
- T(Fe.Mounted);
126
- }, [T]);
127
- let E = {
122
+ function ut({ onEmbeddedOnboardingCompletedSuccessfully: ae, onNavigateToDashboard: pe, labels: p, initialBusinessDetails: Me, initialPersonalDetails: ze, initialAdditionalOwners: Ve, initialApplicationId: He = null, initialBoundAuthEpoch: Ye, onEditableDraftChange: Xe, onApplicationDeleted: nt, onNoticeReplacedByForm: ut, bankLogoSrc: dt, disclosureLinks: ft, open: pt, defaultOpen: mt, onOpenChange: ht, isFullScreenInline: S = !1, showApplicationStatusRefresh: gt = !1, onResultPhaseChange: _t }) {
123
+ let C = ie(), { authEpoch: vt } = c();
124
+ g(() => {
125
+ C(Re.Mounted);
126
+ }, [C]);
127
+ let w = {
128
+ ...ye,
128
129
  ...p,
129
- ...m,
130
130
  stepIndicator: {
131
- ...p.stepIndicator,
132
- ...m?.stepIndicator
131
+ ...ye.stepIndicator,
132
+ ...p?.stepIndicator
133
133
  },
134
- businessDetails: m?.businessDetails ?? {},
135
- personalDetails: m?.personalDetails ?? {},
136
- additionalOwners: m?.additionalOwners ?? {},
134
+ businessDetails: p?.businessDetails ?? {},
135
+ personalDetails: p?.personalDetails ?? {},
136
+ additionalOwners: p?.additionalOwners ?? {},
137
137
  result: {
138
- ...p.result,
139
- ...m?.result
138
+ ...ye.result,
139
+ ...p?.result
140
140
  },
141
- unsavedApplicationDialog: m?.unsavedApplicationDialog ?? {},
142
- deleteApplicationDialog: m?.deleteApplicationDialog ?? {},
143
- applicationStatus: Ne(m?.applicationStatus)
144
- }, D = oe().initResponse, { termsHref: ft, privacyHref: pt, electronicCommunicationHref: mt, patriotActHref: ht } = ct ?? {}, gt = lt === void 0, [_t, vt] = y(() => ut ?? !1), O = gt ? _t : lt, yt = ut ?? !1, k = Je((e) => {
145
- gt && vt(e), C?.(e);
146
- }, [C, gt]), bt = Je(() => {
147
- ie();
148
- }, [ie]), xt = ae(), [A, St] = y(0), [j, M] = y(() => ({
149
- ...it,
150
- ...Ce
151
- })), [N, P] = y(() => ({
152
- ...at,
153
- ...Ie
154
- })), [F, I] = y(() => Re ?? []), [L, Ct] = y(() => ({
155
- business: j,
156
- personal: N,
157
- owners: F
158
- })), [wt, Tt] = y(null);
159
- _(() => {
160
- if (!wt) return;
141
+ unsavedApplicationDialog: p?.unsavedApplicationDialog ?? {},
142
+ deleteApplicationDialog: p?.deleteApplicationDialog ?? {},
143
+ applicationStatus: we(p?.applicationStatus)
144
+ }, T = se().initResponse, { termsHref: yt, privacyHref: bt, electronicCommunicationHref: xt, patriotActHref: St } = ft ?? {}, Ct = pt === void 0, [wt, Tt] = y(() => mt ?? !1), E = Ct ? wt : pt, Et = mt ?? !1, D = Ze((e) => {
145
+ Ct && Tt(e), ht?.(e);
146
+ }, [ht, Ct]), Dt = Ze(() => {
147
+ ae();
148
+ }, [ae]), Ot = oe(), [O, kt] = y(0), [k, At] = y(() => ({
149
+ ...st,
150
+ ...Me
151
+ })), [A, jt] = y(() => ({
152
+ ...ct,
153
+ ...ze
154
+ })), [j, M] = y(() => Ve ?? []), [N, Mt] = y(() => ({
155
+ business: k,
156
+ personal: A,
157
+ owners: j
158
+ })), [Nt, Pt] = y(null);
159
+ g(() => {
160
+ if (!Nt) return;
161
161
  let e = {
162
- business: j,
163
- personal: N,
164
- owners: F
162
+ business: k,
163
+ personal: A,
164
+ owners: j
165
165
  };
166
- Ct((t) => wt.next(e, t)), Tt(null);
166
+ Mt((t) => Nt.next(e, t)), Pt(null);
167
167
  }, [
168
- wt,
169
- j,
170
- N,
171
- F
168
+ Nt,
169
+ k,
170
+ A,
171
+ j
172
172
  ]);
173
- let Et = (e, { owners: t = "none" } = {}) => Tt({ next: (n, r) => ({
173
+ let Ft = (e, { owners: t = "none" } = {}) => Pt({ next: (n, r) => ({
174
174
  business: e.includes("business") ? n.business : r.business,
175
175
  personal: e.includes("personal") ? n.personal : r.personal,
176
- owners: t === "cleared" ? tt : t === "restored" ? we({
176
+ owners: t === "cleared" ? rt : t === "restored" ? Ne({
177
177
  current: n,
178
178
  saved: r,
179
179
  dirty: {
@@ -183,409 +183,438 @@ function st({ onEmbeddedOnboardingCompletedSuccessfully: ie, onNavigateToDashboa
183
183
  },
184
184
  ownersWrite: "list"
185
185
  }).owners : e.includes("owners") ? n.owners : r.owners
186
- }) }), [Dt, Ot] = y(null), [kt, At] = y(0), [jt, R] = y(!1), [Mt, Nt] = y(!1), [z, Pt] = y(null), [B, Ft] = y(null), [It, Lt] = y(null), [V, Rt] = y(ze), [zt, Bt] = y(!1), [H, Vt] = y({}), Ht = (e) => Vt((t) => ({
186
+ }) }), [It, Lt] = y(null), [Rt, zt] = y(0), [Bt, Vt] = y(!1), [Ht, Ut] = y(!1), [P, Wt] = y(null), [F, Gt] = y(null), [Kt, qt] = y(null), [I, Jt] = y(He), [Yt, Xt] = y(!1), [L, Zt] = y({}), Qt = (e) => Zt((t) => ({
187
187
  ...t,
188
188
  ...e.taxId && x(e.taxId) && e.taxIdStructure ? {
189
189
  taxId: e.taxId,
190
190
  taxIdStructure: e.taxIdStructure
191
191
  } : {},
192
192
  ...e.ssn && x(e.ssn) ? { ssn: e.ssn } : {}
193
- })), Ut = (e) => {
194
- let { taxId: t, taxIdStructure: n } = H, r = t !== void 0 && n !== void 0 && e.companyStructure !== j.companyStructure && e.companyStructure !== "" && e.companyStructure === "SOLE_PROPRIETORSHIP" != (n === "SOLE_PROPRIETORSHIP");
195
- M(r ? {
193
+ })), $t = (e) => {
194
+ let { taxId: t, taxIdStructure: n } = L, r = t !== void 0 && n !== void 0 && e.companyStructure !== k.companyStructure && e.companyStructure !== "" && e.companyStructure === "SOLE_PROPRIETORSHIP" != (n === "SOLE_PROPRIETORSHIP");
195
+ At(r ? {
196
196
  ...e,
197
197
  taxId: e.taxId === t ? "" : e.taxId,
198
- taxIdOnFileLast4: _e(t),
198
+ taxIdOnFileLast4: Ee(t),
199
199
  taxIdOnFileStructure: n
200
200
  } : e);
201
- }, [Wt, Gt] = y(Ke ?? dt), [Kt, U] = y(null), [qt, Jt] = y(!1), [Yt, W] = y(!1);
202
- !w && !O && Yt && W(!1);
203
- let [Xt, Zt] = y(!1), [Qt, $t] = y(null), en = Ve(), G = He(), tn = Ue(), nn = We(), rn = Ge(), { setClientSecret: an } = Be(), { data: on, refetch: sn } = u(), { mutateAsync: cn } = l(), ln = ee(), K = f(), un = se(), [dn, fn] = Ye((e) => e + 1, 0), pn = v(() => ue(K.applications), [K.applications]), mn = Xe(null);
204
- K.isResolved && (mn.current = { application: pn });
205
- let q = K.isResolved ? pn : mn.current?.application ?? null, hn = le(q), J = Pe(q), gn = K.isResolved || mn.current !== null && J === ke.Form;
206
- _(() => {
207
- if (hn === null) return;
208
- let e = hn - Date.now();
201
+ }, [en, tn] = y(Ye ?? vt), [nn, R] = y(null), [rn, an] = y(!1), [on, sn] = y(!1);
202
+ !S && !E && on && sn(!1);
203
+ let [cn, ln] = y(!1), [un, dn] = y(null), fn = We(), z = Ge(), pn = Ke(), mn = qe(), hn = Je(), { setClientSecret: gn } = Ue(), { data: _n, refetch: vn } = ee(), { mutateAsync: yn } = u(), bn = f(), B = te(), xn = ce(), [Sn, Cn] = Qe((e) => e + 1, 0), wn = _(() => fe(B.applications), [B.applications]), Tn = v(null);
204
+ B.isResolved && (Tn.current = { application: wn });
205
+ let V = B.isResolved ? wn : Tn.current?.application ?? null, En = de(V), H = Te(V), Dn = B.isResolved || Tn.current !== null && H === be.Form;
206
+ g(() => {
207
+ if (En === null) return;
208
+ let e = En - Date.now();
209
209
  if (e < 0) return;
210
- let t = setTimeout(fn, Math.min(e + 1, $e));
210
+ let t = setTimeout(Cn, Math.min(e + 1, tt));
211
211
  return () => clearTimeout(t);
212
- }, [hn, dn]);
213
- let _n = Xe(null);
214
- _(() => () => _n.current?.abort(), []);
215
- let vn = v(() => ce(E.businessDetails.naicsTitles), [E.businessDetails.naicsTitles]), yn = v(() => a(E.businessDetails.stateTitles), [E.businessDetails.stateTitles]), bn = v(() => a(E.personalDetails.stateTitles), [E.personalDetails.stateTitles]), xn = v(() => a(E.additionalOwners.stateTitles), [E.additionalOwners.stateTitles]), Y = Xt || Qt !== null, Sn = D?.status === "ACTIVE" || D?.status === "INACTIVE", Cn = D?.status === "INVITED", wn = Sn || Cn, Tn = ln.isResolved && gn, En = D && !Y && !wn && Tn && Me(J) ? J : null, Dn = !!D && !Y && En === null && (wn || Tn && (ln.isSuppressed || J === ke.Hidden)), On = Dn ? Sn ? d.UserAlreadyOnboarded : Cn ? d.UserInvitedToOrganization : J === ke.Hidden ? je(q) : ln.reason ?? je(q) : null;
216
- _(() => {
217
- Dn && On && (T(Fe.Suppressed, { reason: On }), console.info(`[onboarding] not shown: ${On}`));
212
+ }, [En, Sn]);
213
+ let On = v(null);
214
+ g(() => () => On.current?.abort(), []);
215
+ let kn = _(() => ue(w.businessDetails.naicsTitles), [w.businessDetails.naicsTitles]), An = _(() => o(w.businessDetails.stateTitles), [w.businessDetails.stateTitles]), jn = _(() => o(w.personalDetails.stateTitles), [w.personalDetails.stateTitles]), Mn = _(() => o(w.additionalOwners.stateTitles), [w.additionalOwners.stateTitles]), U = cn || un !== null, Nn = v(_t);
216
+ Nn.current = _t, g(() => {
217
+ if (U) return Nn.current?.(!0), () => Nn.current?.(!1);
218
+ }, [U]);
219
+ let Pn = T?.status === "ACTIVE" || T?.status === "INACTIVE", Fn = T?.status === "INVITED", In = Pn || Fn, W = bn.isResolved && Dn, Ln = T && !U && !In && W && Ce(H) ? H : null, G = !!T && !U && Ln === null && (In || W && (bn.isSuppressed || H === be.Hidden)), K = G ? Pn ? d.UserAlreadyOnboarded : Fn ? d.UserInvitedToOrganization : H === be.Hidden ? Se(V) : bn.reason ?? Se(V) : null, Rn = !!T && W && !U, [zn, Bn] = y(!1), Vn = zn && G && !In && K !== d.OrganizationApplicationDenialExpired, q = Ln ?? (Vn ? "unavailable" : null);
220
+ Rn && zn !== (q !== null) && Bn(q !== null);
221
+ let J = Vn && K === d.OrganizationApplicationComplete, Hn = le(), [Y, Un] = y("idle"), [Wn, Gn] = y(!1);
222
+ Rn && J !== Wn && (Gn(J), J && Un("requested")), Y === "requested" && Hn && Un("inFlight"), Y === "inFlight" && !Hn && Un("idle");
223
+ let Kn = J && Y !== "idle";
224
+ g(() => {
225
+ G && K && (C(Re.Suppressed, { reason: K }), console.info(`[onboarding] not shown: ${K}`));
218
226
  }, [
219
- Dn,
220
- On,
221
- T
227
+ G,
228
+ K,
229
+ C
222
230
  ]);
223
- let kn = un || !(w || O) ? null : En;
224
- _(() => {
225
- kn && T(Fe.ApplicationStatusShown, { view: kn });
226
- }, [kn, T]), _(() => {
227
- qe?.(Y || V === null ? null : {
228
- applicationId: V,
229
- authEpoch: Wt
231
+ let qn = xn || !(S || E) ? null : Ln;
232
+ g(() => {
233
+ qn && C(Re.ApplicationStatusShown, { view: qn });
234
+ }, [qn, C]);
235
+ let Jn = v(q), Yn = v(ut);
236
+ Yn.current = ut;
237
+ let Xn = v(Ot);
238
+ Xn.current = Ot, g(() => {
239
+ if (!W || U) return;
240
+ let e = Jn.current !== null;
241
+ Jn.current = q, e && q === null && H === be.Form && Yn.current?.();
242
+ }, [
243
+ H,
244
+ U,
245
+ W,
246
+ q
247
+ ]), g(() => {
248
+ Y === "requested" && Xn.current();
249
+ }, [Y]), g(() => {
250
+ Xe?.(U || I === null ? null : {
251
+ applicationId: I,
252
+ authEpoch: en
230
253
  });
231
254
  }, [
232
- qe,
233
- Y,
234
- V,
235
- Wt
255
+ Xe,
256
+ U,
257
+ I,
258
+ en
236
259
  ]);
237
- let An = Xe(dt);
238
- if (An.current = dt, !D) return null;
239
- if (!Y) {
240
- if (Dn || !Tn) return null;
241
- if (En) {
242
- if (un) return null;
243
- let i = Ae(En, q, D.bankName?.trim() || E.fallbackBankName, E.applicationStatus), a = /* @__PURE__ */ b(pe, {
244
- ...i,
245
- className: r("ttw:max-w-2xl", !w && "ttw:pr-12"),
260
+ let Zn = v(vt);
261
+ if (Zn.current = vt, !T) return null;
262
+ if (!U) {
263
+ if (G && !q || Kn || !W) return null;
264
+ if (q) {
265
+ if (xn) return null;
266
+ let a = xe(q, V, T.bankName?.trim() || w.fallbackBankName, w.applicationStatus), o = /* @__PURE__ */ b(he, {
267
+ ...a,
268
+ className: i("ttw:max-w-2xl", !S && "ttw:pr-12"),
246
269
  testIds: {
247
- root: h.statusCard,
248
- chip: h.statusCardChip
249
- }
270
+ root: m.statusCard,
271
+ chip: m.statusCardChip
272
+ },
273
+ action: gt ? /* @__PURE__ */ b(e, {
274
+ variant: "outline",
275
+ onClick: J ? () => Un("requested") : bn.refetch,
276
+ "data-testid": m.statusCardCheckAgain,
277
+ children: w.applicationStatus.checkAgain
278
+ }) : void 0
250
279
  });
251
- return w ? /* @__PURE__ */ b("div", {
280
+ return S ? /* @__PURE__ */ b("div", {
252
281
  className: "ttw:grid ttw:h-full ttw:w-full ttw:place-items-center ttw:overflow-auto ttw:bg-background ttw:p-6",
253
- children: a
254
- }) : /* @__PURE__ */ b(e, {
255
- open: O,
256
- onOpenChange: k,
257
- children: /* @__PURE__ */ Qe(t, {
282
+ children: o
283
+ }) : /* @__PURE__ */ b(t, {
284
+ open: E,
285
+ onOpenChange: D,
286
+ children: /* @__PURE__ */ et(n, {
258
287
  showCloseButton: !0,
259
- closeButtonTestId: h.statusCardClose,
260
- labels: { close: E.applicationStatus.close },
288
+ closeButtonTestId: m.statusCardClose,
289
+ labels: { close: w.applicationStatus.close },
261
290
  className: "ttw:max-h-[90vh] ttw:w-[720px] ttw:max-w-[calc(100vw-2rem)] ttw:gap-0 ttw:overflow-y-auto ttw:rounded-2xl ttw:border-0 ttw:p-0",
262
- children: [/* @__PURE__ */ b(n, {
291
+ children: [/* @__PURE__ */ b(r, {
263
292
  className: "ttw:sr-only",
264
- children: E.modalTitle
265
- }), a]
293
+ children: w.modalTitle
294
+ }), o]
266
295
  })
267
296
  });
268
297
  }
269
298
  }
270
- let X = z?.companyStructure === "SOLE_PROPRIETORSHIP", jn = [
271
- E.stepIndicator.business,
272
- E.stepIndicator.personal,
273
- E.stepIndicator.ownership
274
- ], Mn = A === 0 ? z : A === 1 ? B : A === 2 ? It : null, Z = en.isPending || G.isPending || tn.isPending || nn.isPending || Xt, Nn = () => {
275
- U(null), St((e) => e === 0 ? 0 : e - 1);
299
+ let X = P?.companyStructure === "SOLE_PROPRIETORSHIP", Qn = [
300
+ w.stepIndicator.business,
301
+ w.stepIndicator.personal,
302
+ w.stepIndicator.ownership
303
+ ], $n = O === 0 ? P : O === 1 ? F : O === 2 ? Kt : null, Z = fn.isPending || z.isPending || pn.isPending || mn.isPending || cn, er = () => {
304
+ R(null), kt((e) => e === 0 ? 0 : e - 1);
276
305
  }, Q = {
277
- business: g(j) !== g(L.business),
278
- personal: g(N) !== g(L.personal),
279
- owners: g(j.companyStructure === "SOLE_PROPRIETORSHIP" ? tt : rt(F, Dt)) !== g(L.owners)
280
- }, Pn = Q.business || Q.personal || Q.owners, $ = {
281
- business: (e) => H.taxId && e.taxId === H.taxId ? nt(e) : e,
282
- personal: (e) => H.ssn && e.ssn === H.ssn ? S(e) : e,
283
- owners: (e) => e.map((e) => e.id && x(e.ssn) ? S(e) : e)
284
- }, Fn = () => Ct((e) => ({
306
+ business: h(k) !== h(N.business),
307
+ personal: h(A) !== h(N.personal),
308
+ owners: h(k.companyStructure === "SOLE_PROPRIETORSHIP" ? rt : ot(j, It)) !== h(N.owners)
309
+ }, tr = Q.business || Q.personal || Q.owners, $ = {
310
+ business: (e) => L.taxId && e.taxId === L.taxId ? it(e) : e,
311
+ personal: (e) => L.ssn && e.ssn === L.ssn ? at(e) : e,
312
+ owners: (e) => e.map((e) => e.id && x(e.ssn) ? at(e) : e)
313
+ }, nr = () => Mt((e) => ({
285
314
  business: $.business(e.business),
286
315
  personal: $.personal(e.personal),
287
316
  owners: $.owners(e.owners)
288
- })), In = () => {
289
- Z || (Pn ? R(!0) : (M($.business), P($.personal), I($.owners), Fn(), k(!1)));
290
- }, Ln = (e) => {
291
- e ? k(!0) : In();
292
- }, Rn = In, zn = async (e) => {
293
- Zt(!0), k(!0);
317
+ })), rr = () => {
318
+ Z || (tr ? Vt(!0) : (At($.business), jt($.personal), M($.owners), nr(), D(!1)));
319
+ }, ir = (e) => {
320
+ e ? D(!0) : rr();
321
+ }, ar = rr, or = async (e) => {
322
+ ln(!0), D(!0);
294
323
  let t = new AbortController();
295
- _n.current = t;
324
+ On.current = t;
296
325
  let n = !1;
297
326
  try {
298
- let r = await tn.mutateAsync({ path: { id: e } });
327
+ let r = await pn.mutateAsync({ path: { id: e } });
299
328
  if (t.signal.aborted) return;
300
- if (!r.id) throw Error(E.submitFailedError);
301
- if (n = !0, (await rn(e, { signal: t.signal })).status === "complete") {
302
- let e = on;
303
- if (e === void 0 && (e = (await sn()).data), t.signal.aborted) return;
329
+ if (!r.id) throw Error(w.submitFailedError);
330
+ if (n = !0, (await hn(e, { signal: t.signal })).status === "complete") {
331
+ let e = _n;
332
+ if (e === void 0 && (e = (await vn()).data), t.signal.aborted) return;
304
333
  if (e !== void 0) try {
305
- await cn({ displayedVersion: c(e)?.disclosureId ?? null });
334
+ await yn({ displayedVersion: l(e)?.disclosureId ?? null });
306
335
  } catch {}
307
336
  if (t.signal.aborted) return;
308
- $t("success"), xt(), bt();
309
- } else $t("pending");
337
+ dn("success"), Ot(), Dt();
338
+ } else dn("pending");
310
339
  } catch (e) {
311
340
  if (e instanceof DOMException && e.name === "AbortError") return;
312
341
  if (!n) throw e;
313
- $t("pending");
342
+ dn("pending");
314
343
  } finally {
315
- _n.current = null, Zt(!1);
344
+ On.current = null, ln(!1);
316
345
  }
317
- }, Bn = ({ evenWithoutMarker: e = !1 } = {}) => {
318
- M((t) => (t.taxIdOnFileLast4 || e) && x(t.taxId) ? nt(t) : t);
319
- }, Vn = ({ evenWithoutMarker: e = !1 } = {}) => {
320
- P((t) => (t.ssnOnFileLast4 || e) && x(t.ssn) ? S(t) : t);
321
- }, Hn = ({ evenWithoutMarker: e = !1 } = {}) => {
322
- I((t) => t.map((t) => (t.ssnOnFileLast4 || e && t.id) && x(t.ssn) ? S(t) : t));
323
- }, Un = () => {
324
- I((e) => e.map(Le));
325
- }, Wn = async (e) => {
326
- let t = An.current, n = await en.mutateAsync({ body: Oe(e, N) });
327
- return Rt(n.id), Gt(t), n.clientSecret && an(n.id, n.clientSecret), n.id;
328
- }, Gn = async () => {
329
- let e = L.business.companyStructure === "SOLE_PROPRIETORSHIP" && !X ? De(F) : [], t = e.length > 0 ? { businessOwners: e } : {};
330
- if (A === 0) {
331
- if (!z) return null;
332
- let e = V;
333
- return e ? await G.mutateAsync({
346
+ }, sr = ({ evenWithoutMarker: e = !1 } = {}) => {
347
+ At((t) => (t.taxIdOnFileLast4 || e) && x(t.taxId) ? it(t) : t);
348
+ }, cr = ({ evenWithoutMarker: e = !1 } = {}) => {
349
+ jt((t) => (t.ssnOnFileLast4 || e) && x(t.ssn) ? at(t) : t);
350
+ }, lr = ({ evenWithoutMarker: e = !1 } = {}) => {
351
+ M((t) => t.map((t) => (t.ssnOnFileLast4 || e && t.id) && x(t.ssn) ? at(t) : t));
352
+ }, ur = () => {
353
+ M((e) => e.map(Be));
354
+ }, dr = async (e) => {
355
+ let t = Zn.current, n = await fn.mutateAsync({ body: Le(e, A) });
356
+ return Jt(n.id), tn(t), n.clientSecret && gn(n.id, n.clientSecret), n.id;
357
+ }, fr = async () => {
358
+ let e = N.business.companyStructure === "SOLE_PROPRIETORSHIP" && !X ? Ie(j) : [], t = e.length > 0 ? { businessOwners: e } : {};
359
+ if (O === 0) {
360
+ if (!P) return null;
361
+ let e = I;
362
+ return e ? await z.mutateAsync({
334
363
  path: { id: e },
335
364
  body: {
336
- ...Se({
337
- businessDetails: z,
338
- carryConsent: !zt
365
+ ...je({
366
+ businessDetails: P,
367
+ carryConsent: !Yt
339
368
  }),
340
369
  ...t
341
370
  }
342
- }) : (e = await Wn(xe(z)), Bt(!0)), Ht({
343
- taxId: z.taxId,
344
- taxIdStructure: z.companyStructure
345
- }), Bn(), X && Un(), Et(["business"], { owners: X ? "cleared" : t.businessOwners ? "restored" : "none" }), e;
371
+ }) : (e = await dr(Ae(P)), Xt(!0)), Qt({
372
+ taxId: P.taxId,
373
+ taxIdStructure: P.companyStructure
374
+ }), sr(), X && ur(), Ft(["business"], { owners: X ? "cleared" : t.businessOwners ? "restored" : "none" }), e;
346
375
  }
347
- return A === 1 ? !B || !z || !V ? null : (await G.mutateAsync({
348
- path: { id: V },
376
+ return O === 1 ? !F || !P || !I ? null : (await z.mutateAsync({
377
+ path: { id: I },
349
378
  body: {
350
- ...Se({
351
- businessDetails: z,
352
- applicant: B,
353
- carryConsent: !zt
379
+ ...je({
380
+ businessDetails: P,
381
+ applicant: F,
382
+ carryConsent: !Yt
354
383
  }),
355
384
  ...t
356
385
  }
357
- }), Ht({
358
- taxId: z.taxId,
359
- taxIdStructure: z.companyStructure,
360
- ssn: B.ssn
361
- }), Bn(), Vn(), Et(["business", "personal"], { owners: X ? "cleared" : t.businessOwners ? "restored" : "none" }), V) : A === 2 ? !It || !V ? null : (await G.mutateAsync({
362
- path: { id: V },
363
- body: Se({ businessOwners: It })
364
- }), Hn(), Et(["owners"]), V) : null;
365
- }, Kn = (e) => o(e) ?? (e instanceof Error ? e.message : void 0) ?? E.genericRetryError, qn = async () => {
366
- U(null);
386
+ }), Qt({
387
+ taxId: P.taxId,
388
+ taxIdStructure: P.companyStructure,
389
+ ssn: F.ssn
390
+ }), sr(), cr(), Ft(["business", "personal"], { owners: X ? "cleared" : t.businessOwners ? "restored" : "none" }), I) : O === 2 ? !Kt || !I ? null : (await z.mutateAsync({
391
+ path: { id: I },
392
+ body: je({ businessOwners: Kt })
393
+ }), lr(), Ft(["owners"]), I) : null;
394
+ }, pr = (e) => s(e) ?? (e instanceof Error ? e.message : void 0) ?? w.genericRetryError, mr = async () => {
395
+ R(null);
367
396
  try {
368
- let e = await Gn();
397
+ let e = await fr();
369
398
  if (e === null) return;
370
- A === 2 ? await zn(e) : St(A + 1);
399
+ O === 2 ? await or(e) : kt(O + 1);
371
400
  } catch (e) {
372
- U(Kn(e));
401
+ R(pr(e));
373
402
  }
374
- }, Jn = async () => {
375
- U(null), Jt(!0);
403
+ }, hr = async () => {
404
+ R(null), an(!0);
376
405
  try {
377
- if (await Gn() === null) return;
378
- Bn({ evenWithoutMarker: !0 }), A >= 1 && Vn({ evenWithoutMarker: !0 }), A === 2 && Hn({ evenWithoutMarker: !0 }), i.success(E.applicationSavedToast), k(!1);
406
+ if (await fr() === null) return;
407
+ sr({ evenWithoutMarker: !0 }), O >= 1 && cr({ evenWithoutMarker: !0 }), O === 2 && lr({ evenWithoutMarker: !0 }), a.success(w.applicationSavedToast), D(!1);
379
408
  } catch (e) {
380
- i.error(Kn(e));
409
+ a.error(pr(e));
381
410
  } finally {
382
- Jt(!1);
411
+ an(!1);
383
412
  }
384
- }, Yn = async () => {
385
- let e = rt(F, Dt), t = Ee({
386
- businessDetails: j,
387
- applicant: N,
413
+ }, gr = async () => {
414
+ let e = ot(j, It), t = Fe({
415
+ businessDetails: k,
416
+ applicant: A,
388
417
  businessOwners: e,
389
- savedBusinessDetails: L.business,
390
- savedOwners: L.owners,
418
+ savedBusinessDetails: N.business,
419
+ savedOwners: N.owners,
391
420
  dirty: Q
392
421
  }), n = Q;
393
- Nt(!0);
422
+ Ut(!0);
394
423
  try {
395
424
  if (!t) {
396
- i.error(E.saveDraftNothingValidError);
425
+ a.error(w.saveDraftNothingValidError);
397
426
  return;
398
427
  }
399
- let r = !V;
400
- V ? await G.mutateAsync({
401
- path: { id: V },
428
+ let r = !I;
429
+ I ? await z.mutateAsync({
430
+ path: { id: I },
402
431
  body: t
403
- }) : await Wn(Te(t)), Dt && I(e), i.success(E.applicationSavedToast);
404
- let a = t;
405
- r && a.applicant?.isLegallyAuthorized && a.applicant?.hasAcceptedDisclosures && Bt(!0), Ht({
406
- taxId: a.businessDetails?.taxId?.value,
407
- taxIdStructure: j.companyStructure,
408
- ssn: a.applicant?.personalIdentificationNumber?.value
409
- }), a.businessDetails?.taxId !== void 0 && Bn({ evenWithoutMarker: !0 }), a.applicant?.personalIdentificationNumber !== void 0 && Vn({ evenWithoutMarker: !0 }), Array.isArray(a.businessOwners) && Hn({ evenWithoutMarker: !0 }), a.businessOwners === null && e.length > 0 && Un();
410
- let o = Array.isArray(a.businessOwners) ? "list" : a.businessOwners === null ? "cleared" : "none";
411
- Tt({ next: (e, t) => we({
432
+ }) : await dr(Pe(t)), It && M(e), a.success(w.applicationSavedToast);
433
+ let i = t;
434
+ r && i.applicant?.isLegallyAuthorized && i.applicant?.hasAcceptedDisclosures && Xt(!0), Qt({
435
+ taxId: i.businessDetails?.taxId?.value,
436
+ taxIdStructure: k.companyStructure,
437
+ ssn: i.applicant?.personalIdentificationNumber?.value
438
+ }), i.businessDetails?.taxId !== void 0 && sr({ evenWithoutMarker: !0 }), i.applicant?.personalIdentificationNumber !== void 0 && cr({ evenWithoutMarker: !0 }), Array.isArray(i.businessOwners) && lr({ evenWithoutMarker: !0 }), i.businessOwners === null && e.length > 0 && ur();
439
+ let o = Array.isArray(i.businessOwners) ? "list" : i.businessOwners === null ? "cleared" : "none";
440
+ Pt({ next: (e, t) => Ne({
412
441
  current: e,
413
442
  saved: t,
414
443
  dirty: n,
415
444
  ownersWrite: o
416
- }) }), Ot(null), At((e) => e + 1), R(!1), k(!1);
445
+ }) }), Lt(null), zt((e) => e + 1), Vt(!1), D(!1);
417
446
  } catch (e) {
418
- i.error(Kn(e));
447
+ a.error(pr(e));
419
448
  } finally {
420
- Nt(!1);
449
+ Ut(!1);
421
450
  }
422
- }, Xn = () => {
423
- M($.business(L.business)), P($.personal(L.personal)), I($.owners(L.owners)), Fn(), Ot(null), At((e) => e + 1), U(null), R(!1), k(!1);
424
- }, Zn = async () => {
425
- if (V !== null) {
451
+ }, _r = () => {
452
+ At($.business(N.business)), jt($.personal(N.personal)), M($.owners(N.owners)), nr(), Lt(null), zt((e) => e + 1), R(null), Vt(!1), D(!1);
453
+ }, vr = async () => {
454
+ if (I !== null) {
426
455
  try {
427
- await nn.mutateAsync({ path: { id: V } });
456
+ await mn.mutateAsync({ path: { id: I } });
428
457
  } catch (e) {
429
- i.error(Kn(e));
458
+ a.error(pr(e));
430
459
  return;
431
460
  }
432
- i.success(E.applicationDeletedToast);
461
+ a.success(w.applicationDeletedToast);
433
462
  }
434
- W(!1), k(!1), et?.();
435
- }, Qn = ot(Math.min(A, 2), E), $n = D.bankName?.trim() || E.fallbackBankName, er = fe(E.shellFdicDisclaimer, $n);
436
- if (Y) {
437
- let r = z?.companyLegalName ?? "", i = D.bankName?.trim() || E.fallbackBankName, a = Qt ?? "pending", o = a === "success", s = {
438
- ...p.result,
439
- ...E.result
440
- }, c = /* @__PURE__ */ b(me, {
463
+ sn(!1), D(!1), nt?.();
464
+ }, yr = lt(Math.min(O, 2), w), br = T.bankName?.trim() || w.fallbackBankName, xr = me(w.shellFdicDisclaimer, br);
465
+ if (U) {
466
+ let e = P?.companyLegalName ?? "", i = T.bankName?.trim() || w.fallbackBankName, a = un ?? "pending", o = a === "success", s = {
467
+ ...ye.result,
468
+ ...w.result
469
+ }, c = /* @__PURE__ */ b(ge, {
441
470
  testIds: {
442
- processing: h.resultProcessing,
443
- dashboardButton: h.resultDashboardButton
471
+ processing: m.resultProcessing,
472
+ dashboardButton: m.resultDashboardButton
444
473
  },
445
474
  status: a,
446
- isLoading: Xt,
475
+ isLoading: cn,
447
476
  loadingMessage: s.loadingMessage,
448
477
  headingLine1: o ? s.successHeadingLine1 : s.pendingHeadingLine1,
449
- headingLine2: `${r}!`,
478
+ headingLine2: `${e}!`,
450
479
  body: o ? s.successBody : s.pendingBody,
451
- followUpEmail: B?.workEmail ?? "",
480
+ followUpEmail: F?.workEmail ?? "",
452
481
  emailBoxLead: s.pendingEmailBoxLead,
453
482
  navigateToDashboardLabel: s.navigateToDashboard,
454
- bankLogoSrc: st,
455
- bankLogoAlt: fe(s.bankLogoAlt, i),
456
- fdicDisclaimer: fe(s.fdicDisclaimer, i),
457
- onNavigateToDashboard: de
483
+ bankLogoSrc: dt,
484
+ bankLogoAlt: me(s.bankLogoAlt, i),
485
+ fdicDisclaimer: me(s.fdicDisclaimer, i),
486
+ onNavigateToDashboard: pe
458
487
  });
459
- return w ? /* @__PURE__ */ b("div", {
488
+ return S ? /* @__PURE__ */ b("div", {
460
489
  className: "ttw:grid ttw:h-full ttw:w-full ttw:grid-rows-[1fr] ttw:place-items-center ttw:gap-0 ttw:overflow-auto ttw:bg-background",
461
490
  children: c
462
- }) : /* @__PURE__ */ b(e, {
463
- open: O,
464
- onOpenChange: k,
465
- children: /* @__PURE__ */ Qe(t, {
491
+ }) : /* @__PURE__ */ b(t, {
492
+ open: E,
493
+ onOpenChange: D,
494
+ children: /* @__PURE__ */ et(n, {
466
495
  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",
467
- children: [/* @__PURE__ */ b(n, {
496
+ children: [/* @__PURE__ */ b(r, {
468
497
  className: "ttw:sr-only",
469
- children: E.modalTitle
498
+ children: w.modalTitle
470
499
  }), c]
471
500
  })
472
501
  });
473
502
  }
474
- let tr = A === 2 ? E.submit : E.next, nr = Mn === null || Z;
475
- return /* @__PURE__ */ Qe(Ze, { children: [
476
- /* @__PURE__ */ Qe(ne, {
477
- open: O,
478
- defaultOpen: yt,
479
- onOpenChange: Ln,
480
- isFullScreenInline: w,
481
- title: Qn.title,
482
- subtitle: Qn.subtitle,
483
- stepLabels: jn,
484
- activeStep: A,
485
- disclaimerText: er,
486
- onBack: A === 0 ? Rn : Nn,
487
- onCancel: A > 0 ? Rn : void 0,
488
- onNext: qn,
489
- onSaveAndClose: Jn,
490
- onDelete: () => W(!0),
503
+ let Sr = O === 2 ? w.submit : w.next, Cr = $n === null || Z;
504
+ return /* @__PURE__ */ et($e, { children: [
505
+ /* @__PURE__ */ et(re, {
506
+ open: E,
507
+ defaultOpen: Et,
508
+ onOpenChange: ir,
509
+ isFullScreenInline: S,
510
+ title: yr.title,
511
+ subtitle: yr.subtitle,
512
+ stepLabels: Qn,
513
+ activeStep: O,
514
+ disclaimerText: xr,
515
+ onBack: O === 0 ? ar : er,
516
+ onCancel: O > 0 ? ar : void 0,
517
+ onNext: mr,
518
+ onSaveAndClose: hr,
519
+ onDelete: () => sn(!0),
491
520
  showDismissButton: !1,
492
- isNextDisabled: nr,
493
- isNextLoading: Z && !qt,
494
- isSaveAndCloseDisabled: nr,
495
- isSaveAndCloseLoading: qt,
496
- nextLabel: tr,
521
+ isNextDisabled: Cr,
522
+ isNextLoading: Z && !rn,
523
+ isSaveAndCloseDisabled: Cr,
524
+ isSaveAndCloseLoading: rn,
525
+ nextLabel: Sr,
497
526
  nextIcon: null,
498
- errorMessage: Kt,
527
+ errorMessage: nn,
499
528
  labels: {
500
- backButton: A === 0 ? E.cancel : E.back,
501
- cancelButton: E.cancel,
502
- saveAndCloseButton: E.saveAndClose,
503
- deleteButton: E.deleteApplication
529
+ backButton: O === 0 ? w.cancel : w.back,
530
+ cancelButton: w.cancel,
531
+ saveAndCloseButton: w.saveAndClose,
532
+ deleteButton: w.deleteApplication
504
533
  },
505
534
  testIds: {
506
- root: h.shell,
507
- dismiss: h.shellDismiss,
508
- back: h.shellBack,
509
- cancel: h.shellCancel,
510
- saveAndClose: h.shellSaveAndClose,
511
- delete: h.shellDelete,
512
- next: h.shellNext,
535
+ root: m.shell,
536
+ dismiss: m.shellDismiss,
537
+ back: m.shellBack,
538
+ cancel: m.shellCancel,
539
+ saveAndClose: m.shellSaveAndClose,
540
+ delete: m.shellDelete,
541
+ next: m.shellNext,
513
542
  scrollRegion: {
514
- root: h.shellScrollRegion,
515
- fade: h.shellScrollFade,
516
- hint: h.shellScrollHint
543
+ root: m.shellScrollRegion,
544
+ fade: m.shellScrollFade,
545
+ hint: m.shellScrollHint
517
546
  }
518
547
  },
519
548
  children: [
520
- A === 0 ? /* @__PURE__ */ b(ve, {
521
- value: j,
522
- onValueChange: Ut,
523
- onSnapshotChange: Pt,
524
- naicsOptions: vn,
525
- stateOptions: yn,
549
+ O === 0 ? /* @__PURE__ */ b(De, {
550
+ value: k,
551
+ onValueChange: $t,
552
+ onSnapshotChange: Wt,
553
+ naicsOptions: kn,
554
+ stateOptions: An,
526
555
  isSubmitting: Z,
527
- labels: E.businessDetails,
528
- bankName: $n,
529
- termsHref: ft,
530
- privacyHref: pt,
531
- electronicCommunicationHref: mt,
532
- patriotActHref: ht
556
+ labels: w.businessDetails,
557
+ bankName: br,
558
+ termsHref: yt,
559
+ privacyHref: bt,
560
+ electronicCommunicationHref: xt,
561
+ patriotActHref: St
533
562
  }, "business") : null,
534
- A === 1 ? /* @__PURE__ */ b(ye, {
535
- value: N,
536
- onValueChange: P,
537
- onSnapshotChange: Ft,
538
- stateOptions: bn,
563
+ O === 1 ? /* @__PURE__ */ b(Oe, {
564
+ value: A,
565
+ onValueChange: jt,
566
+ onSnapshotChange: Gt,
567
+ stateOptions: jn,
539
568
  isSubmitting: Z,
540
- labels: E.personalDetails
569
+ labels: w.personalDetails
541
570
  }, "personal") : null,
542
- A === 2 ? /* @__PURE__ */ b(be, {
543
- owners: X ? tt : F,
544
- onOwnersChange: I,
545
- primaryOwnerName: `${N.firstName} ${N.lastName}`.trim(),
546
- primaryOwnerPercentage: X ? 100 : B?.ownsOver25Percent === !0 ? B.ownershipPercentage ?? 0 : 0,
547
- stateOptions: xn,
548
- onSnapshotChange: Lt,
549
- onPendingOwnerChange: Ot,
571
+ O === 2 ? /* @__PURE__ */ b(ke, {
572
+ owners: X ? rt : j,
573
+ onOwnersChange: M,
574
+ primaryOwnerName: `${A.firstName} ${A.lastName}`.trim(),
575
+ primaryOwnerPercentage: X ? 100 : F?.ownsOver25Percent === !0 ? F.ownershipPercentage ?? 0 : 0,
576
+ stateOptions: Mn,
577
+ onSnapshotChange: qt,
578
+ onPendingOwnerChange: Lt,
550
579
  isSubmitting: Z,
551
- labels: E.additionalOwners
552
- }, kt) : null
580
+ labels: w.additionalOwners
581
+ }, Rt) : null
553
582
  ]
554
583
  }),
555
- /* @__PURE__ */ b(he, {
556
- open: jt,
557
- onSaveDraft: Yn,
558
- onDiscard: Xn,
559
- onCancel: () => R(!1),
560
- isSaving: Mt,
561
- labels: E.unsavedApplicationDialog,
584
+ /* @__PURE__ */ b(_e, {
585
+ open: Bt,
586
+ onSaveDraft: gr,
587
+ onDiscard: _r,
588
+ onCancel: () => Vt(!1),
589
+ isSaving: Ht,
590
+ labels: w.unsavedApplicationDialog,
562
591
  testIds: {
563
- root: h.unsavedDialog,
564
- saveDraft: h.unsavedDialogSaveDraft,
565
- discard: h.unsavedDialogDiscard,
566
- close: h.unsavedDialogClose
592
+ root: m.unsavedDialog,
593
+ saveDraft: m.unsavedDialogSaveDraft,
594
+ discard: m.unsavedDialogDiscard,
595
+ close: m.unsavedDialogClose
567
596
  }
568
597
  }),
569
- /* @__PURE__ */ b(ge, {
570
- open: Yt,
571
- onConfirm: Zn,
572
- onCancel: () => W(!1),
573
- isDeleting: nn.isPending,
598
+ /* @__PURE__ */ b(ve, {
599
+ open: on,
600
+ onConfirm: vr,
601
+ onCancel: () => sn(!1),
602
+ isDeleting: mn.isPending,
574
603
  labels: {
575
- descriptionEmphasis: E.saveAndClose,
576
- ...E.deleteApplicationDialog
604
+ descriptionEmphasis: w.saveAndClose,
605
+ ...w.deleteApplicationDialog
577
606
  },
578
607
  testIds: {
579
- root: h.deleteDialog,
580
- confirm: h.deleteDialogConfirm,
581
- cancel: h.deleteDialogCancel
608
+ root: m.deleteDialog,
609
+ confirm: m.deleteDialogConfirm,
610
+ cancel: m.deleteDialogCancel
582
611
  }
583
612
  }),
584
- /* @__PURE__ */ b(te, {})
613
+ /* @__PURE__ */ b(ne, {})
585
614
  ] });
586
615
  }
587
- function ct({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: u, disclosuresAcceptance: d, providerLabels: ee, ...f }) {
588
- return /* @__PURE__ */ b(ie, {
616
+ function dt({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: u, disclosuresAcceptance: ee, providerLabels: d, ...f }) {
617
+ return /* @__PURE__ */ b(ae, {
589
618
  baseUrl: e,
590
619
  widgetToken: t,
591
620
  organizationId: n,
@@ -597,47 +626,50 @@ function ct({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, ga
597
626
  errorFallback: c,
598
627
  onError: l,
599
628
  analytics: u,
600
- disclosuresAcceptance: d,
601
- providerLabels: ee,
602
- widgetName: Ie,
603
- children: /* @__PURE__ */ b(lt, { ...f })
629
+ disclosuresAcceptance: ee,
630
+ providerLabels: d,
631
+ widgetName: ze,
632
+ children: /* @__PURE__ */ b(ft, { ...f })
604
633
  });
605
634
  }
606
- function lt(e) {
607
- let { initResponse: t } = oe(), { client: n } = s(), r = t?.userId ?? null, [i, a] = y(r), [o, c] = y(0);
608
- r !== i && (a(r), i !== null && r !== null && c((e) => e + 1));
635
+ function ft(e) {
636
+ let { initResponse: t } = se(), { client: n } = c(), r = t?.userId ?? null, [i, a] = y(r), [o, s] = y(0);
637
+ r !== i && (a(r), i !== null && r !== null && s((e) => e + 1));
609
638
  let [l, u] = y(n);
610
- return n !== l && (u(n), c((e) => e + 1)), /* @__PURE__ */ b(ut, { ...e }, o);
639
+ return n !== l && (u(n), s((e) => e + 1)), /* @__PURE__ */ b(pt, { ...e }, o);
611
640
  }
612
- function ut(e) {
613
- let { authEpoch: t } = s(), { ownApplicationIds: n } = Ke(), [r, i] = y(null), [a, o] = y(0), [c, l] = y(!1), u = Je(() => {
641
+ function pt(e) {
642
+ let { authEpoch: t } = c(), { ownApplicationIds: n } = Ye(), [r, i] = y(null), [a, o] = y(0), [s, l] = y(!1), u = Ze(() => {
643
+ i(null), o((e) => e + 1);
644
+ }, []), ee = Ze(() => {
614
645
  i(null), l(!0), o((e) => e + 1);
615
646
  }, []);
616
- return r !== null && t !== r.authEpoch && n !== null && !n.includes(r.applicationId) && (i(null), o((e) => e + 1)), /* @__PURE__ */ b(ze, { children: /* @__PURE__ */ b(w, {
647
+ return r !== null && t !== r.authEpoch && n !== null && !n.includes(r.applicationId) && (i(null), o((e) => e + 1)), /* @__PURE__ */ b(He, { children: /* @__PURE__ */ b(ht, {
617
648
  ...e,
618
- defaultOpen: !c && e.defaultOpen,
649
+ defaultOpen: !s && e.defaultOpen,
619
650
  onEditableDraftChange: i,
620
- onApplicationDeleted: u
651
+ onApplicationDeleted: ee,
652
+ onNoticeReplacedByForm: u
621
653
  }, a) }, a);
622
654
  }
623
- var C = { canRender: !1 };
624
- function w(e) {
625
- let { authEpoch: t } = s(), { applicationId: n, clientSecret: r, isResolved: i } = Ke(), { application: a, isResolved: o, isUnavailable: c } = qe(n, r), [l, u] = y(null);
626
- if (_(() => {
655
+ var mt = { canRender: !1 };
656
+ function ht(e) {
657
+ let { authEpoch: t } = c(), { applicationId: n, clientSecret: r, isResolved: i } = Ye(), { application: a, isResolved: o, isUnavailable: s } = Xe(n, r), [l, u] = y(null);
658
+ if (g(() => {
627
659
  if (l?.canRender !== !0 && i && o) {
628
- if (c) {
629
- u(C);
660
+ if (s) {
661
+ u(mt);
630
662
  return;
631
663
  }
632
- if (a !== null && a.status !== void 0 && a.status !== et) {
633
- u(C);
664
+ if (a !== null && a.status !== void 0 && a.status !== nt) {
665
+ u(mt);
634
666
  return;
635
667
  }
636
668
  u({
637
669
  canRender: !0,
638
670
  applicationId: a === null ? null : n,
639
671
  authEpoch: t,
640
- prefill: Ce(a)
672
+ prefill: Me(a)
641
673
  });
642
674
  }
643
675
  }, [
@@ -645,25 +677,25 @@ function w(e) {
645
677
  l,
646
678
  i,
647
679
  o,
648
- c,
680
+ s,
649
681
  a,
650
682
  n
651
683
  ]), l === null || !l.canRender) return null;
652
- let { applicationId: d, authEpoch: ee, prefill: f } = l;
653
- return /* @__PURE__ */ b(st, {
684
+ let { applicationId: ee, authEpoch: d, prefill: f } = l;
685
+ return /* @__PURE__ */ b(ut, {
654
686
  ...e,
655
- initialApplicationId: d,
656
- initialBoundAuthEpoch: ee,
687
+ initialApplicationId: ee,
688
+ initialBoundAuthEpoch: d,
657
689
  initialBusinessDetails: {
658
- ...Re(e.initialBusinessDetails),
690
+ ...Ve(e.initialBusinessDetails),
659
691
  ...f?.businessDetails
660
692
  },
661
693
  initialPersonalDetails: {
662
- ...Re(e.initialPersonalDetails),
694
+ ...Ve(e.initialPersonalDetails),
663
695
  ...f?.personalDetails
664
696
  },
665
- initialAdditionalOwners: f?.additionalOwners ?? e.initialAdditionalOwners?.map(Le)
697
+ initialAdditionalOwners: f?.additionalOwners ?? e.initialAdditionalOwners?.map(Be)
666
698
  });
667
699
  }
668
700
  //#endregion
669
- export { ct as BankAccountOnboardingWidget, ct as default };
701
+ export { dt as BankAccountOnboardingWidget, dt as default };