@tesouro/embedded-components-react 0.7.14 → 0.7.16

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