@tesouro/embedded-components-react 0.11.32 → 0.11.34

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.
package/dist/index.d.ts CHANGED
@@ -2338,6 +2338,12 @@ interface BankAccountOnboardingWidgetInnerProps {
2338
2338
  * under. Set by the resume layer, not by hosts.
2339
2339
  */
2340
2340
  initialBoundAuthEpoch?: number;
2341
+ /**
2342
+ * Which sections the resumed application already holds everything on screen
2343
+ * for. Set by the resume layer, not by hosts; without it nothing counts as
2344
+ * held, so a save sends what it can.
2345
+ */
2346
+ initialWrittenSections?: WrittenSections;
2341
2347
  /**
2342
2348
  * The application this session may still write to, with the auth epoch it
2343
2349
  * was bound under, or null once there is none. Reported up to the session
@@ -2399,11 +2405,16 @@ interface BankAccountOnboardingWidgetInnerProps {
2399
2405
  */
2400
2406
  onResultPhaseChange?: (isInResultPhase: boolean) => void;
2401
2407
  }
2402
- type BankAccountOnboardingWidgetProps = WidgetProviderProps & Omit<BankAccountOnboardingWidgetInnerProps, 'initialApplicationId' | 'initialBoundAuthEpoch' | 'initialBusinessDetails' | 'initialPersonalDetails' | 'initialAdditionalOwners' | 'onEditableDraftChange' | 'onApplicationDeleted' | 'onNoticeReplacedByForm' | 'focusFormOnMount' | 'onFocusFormOnMountDone'> & {
2408
+ type BankAccountOnboardingWidgetProps = WidgetProviderProps & Omit<BankAccountOnboardingWidgetInnerProps, 'initialApplicationId' | 'initialBoundAuthEpoch' | 'initialWrittenSections' | 'initialBusinessDetails' | 'initialPersonalDetails' | 'initialAdditionalOwners' | 'onEditableDraftChange' | 'onApplicationDeleted' | 'onNoticeReplacedByForm' | 'focusFormOnMount' | 'onFocusFormOnMountDone'> & {
2403
2409
  initialBusinessDetails?: Partial<HostSupplied<BusinessDetailsValues>>;
2404
2410
  initialPersonalDetails?: Partial<HostSupplied<PersonalDetailsValues>>;
2405
2411
  initialAdditionalOwners?: HostSuppliedOwner[];
2406
2412
  };
2413
+ /** Which sections the server holds as the form shows them. */
2414
+ interface WrittenSections {
2415
+ business: boolean;
2416
+ owners: boolean;
2417
+ }
2407
2418
  declare function BankAccountOnboardingWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: BankAccountOnboardingWidgetProps): React.JSX.Element;
2408
2419
 
2409
2420
  interface BalancesWidgetLabels {
@@ -1290,6 +1290,12 @@ interface BankAccountOnboardingWidgetInnerProps {
1290
1290
  * under. Set by the resume layer, not by hosts.
1291
1291
  */
1292
1292
  initialBoundAuthEpoch?: number;
1293
+ /**
1294
+ * Which sections the resumed application already holds everything on screen
1295
+ * for. Set by the resume layer, not by hosts; without it nothing counts as
1296
+ * held, so a save sends what it can.
1297
+ */
1298
+ initialWrittenSections?: WrittenSections;
1293
1299
  /**
1294
1300
  * The application this session may still write to, with the auth epoch it
1295
1301
  * was bound under, or null once there is none. Reported up to the session
@@ -1351,11 +1357,16 @@ interface BankAccountOnboardingWidgetInnerProps {
1351
1357
  */
1352
1358
  onResultPhaseChange?: (isInResultPhase: boolean) => void;
1353
1359
  }
1354
- type BankAccountOnboardingWidgetProps = WidgetProviderProps & Omit<BankAccountOnboardingWidgetInnerProps, 'initialApplicationId' | 'initialBoundAuthEpoch' | 'initialBusinessDetails' | 'initialPersonalDetails' | 'initialAdditionalOwners' | 'onEditableDraftChange' | 'onApplicationDeleted' | 'onNoticeReplacedByForm' | 'focusFormOnMount' | 'onFocusFormOnMountDone'> & {
1360
+ type BankAccountOnboardingWidgetProps = WidgetProviderProps & Omit<BankAccountOnboardingWidgetInnerProps, 'initialApplicationId' | 'initialBoundAuthEpoch' | 'initialWrittenSections' | 'initialBusinessDetails' | 'initialPersonalDetails' | 'initialAdditionalOwners' | 'onEditableDraftChange' | 'onApplicationDeleted' | 'onNoticeReplacedByForm' | 'focusFormOnMount' | 'onFocusFormOnMountDone'> & {
1355
1361
  initialBusinessDetails?: Partial<HostSupplied<BusinessDetailsValues>>;
1356
1362
  initialPersonalDetails?: Partial<HostSupplied<PersonalDetailsValues>>;
1357
1363
  initialAdditionalOwners?: HostSuppliedOwner[];
1358
1364
  };
1365
+ /** Which sections the server holds as the form shows them. */
1366
+ interface WrittenSections {
1367
+ business: boolean;
1368
+ owners: boolean;
1369
+ }
1359
1370
  declare function BankAccountOnboardingWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: BankAccountOnboardingWidgetProps): React.JSX.Element;
1360
1371
 
1361
1372
  export { ADDITIONAL_OWNERS_LABELS_EN, APPLICATION_STATUS_LABELS_EN, BUSINESS_DETAILS_LABELS_EN, BankAccountOnboardingWidget, OnboardingSuppressionReason, PERSONAL_DETAILS_LABELS_EN, RESULT_LABELS_EN };
@@ -1339,6 +1339,12 @@ interface BankAccountOnboardingWidgetInnerProps {
1339
1339
  * under. Set by the resume layer, not by hosts.
1340
1340
  */
1341
1341
  initialBoundAuthEpoch?: number;
1342
+ /**
1343
+ * Which sections the resumed application already holds everything on screen
1344
+ * for. Set by the resume layer, not by hosts; without it nothing counts as
1345
+ * held, so a save sends what it can.
1346
+ */
1347
+ initialWrittenSections?: WrittenSections;
1342
1348
  /**
1343
1349
  * The application this session may still write to, with the auth epoch it
1344
1350
  * was bound under, or null once there is none. Reported up to the session
@@ -1400,11 +1406,16 @@ interface BankAccountOnboardingWidgetInnerProps {
1400
1406
  */
1401
1407
  onResultPhaseChange?: (isInResultPhase: boolean) => void;
1402
1408
  }
1403
- type BankAccountOnboardingWidgetProps = WidgetProviderProps & Omit<BankAccountOnboardingWidgetInnerProps, 'initialApplicationId' | 'initialBoundAuthEpoch' | 'initialBusinessDetails' | 'initialPersonalDetails' | 'initialAdditionalOwners' | 'onEditableDraftChange' | 'onApplicationDeleted' | 'onNoticeReplacedByForm' | 'focusFormOnMount' | 'onFocusFormOnMountDone'> & {
1409
+ type BankAccountOnboardingWidgetProps = WidgetProviderProps & Omit<BankAccountOnboardingWidgetInnerProps, 'initialApplicationId' | 'initialBoundAuthEpoch' | 'initialWrittenSections' | 'initialBusinessDetails' | 'initialPersonalDetails' | 'initialAdditionalOwners' | 'onEditableDraftChange' | 'onApplicationDeleted' | 'onNoticeReplacedByForm' | 'focusFormOnMount' | 'onFocusFormOnMountDone'> & {
1404
1410
  initialBusinessDetails?: Partial<HostSupplied<BusinessDetailsValues>>;
1405
1411
  initialPersonalDetails?: Partial<HostSupplied<PersonalDetailsValues>>;
1406
1412
  initialAdditionalOwners?: HostSuppliedOwner[];
1407
1413
  };
1414
+ /** Which sections the server holds as the form shows them. */
1415
+ interface WrittenSections {
1416
+ business: boolean;
1417
+ owners: boolean;
1418
+ }
1408
1419
 
1409
1420
  interface BalancesWidgetLabels {
1410
1421
  /** Card header title, beside the bank icon */
@@ -17,51 +17,51 @@ import { EmbeddedToaster as d } from "../../../../../shared/ui/dist/lib/Embedded
17
17
  import { OnboardingShell as ee } from "../../../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
18
18
  import "../../../../../shared/ui/dist/index.js";
19
19
  import { useAnalyticsTrack as f } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
20
- import { WidgetProvider as te } from "../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
21
- import { useRefetchWidget as ne, useWidgetConfig as re, useWidgetInitStaleForToken as ie, useWidgetLoading as ae } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
22
- import { getNaicsOptions as oe } from "../../../../../shared/feature/dist/lib/naicsCodeMap.js";
23
- import { deniedNoticeExpiresAt as se, selectBankAccountApplication as ce } from "../../../../../shared/feature/dist/lib/application/bankAccountApplication.js";
20
+ import { WidgetProvider as p } from "../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
21
+ import { useRefetchWidget as te, useWidgetConfig as ne, useWidgetInitStaleForToken as re, useWidgetLoading as ie } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
22
+ import { getNaicsOptions as ae } from "../../../../../shared/feature/dist/lib/naicsCodeMap.js";
23
+ import { deniedNoticeExpiresAt as oe, selectBankAccountApplication as se } from "../../../../../shared/feature/dist/lib/application/bankAccountApplication.js";
24
24
  import "../../../../../shared/feature/dist/index.js";
25
- import { interpolateBankName as le } from "../../../../ui/dist/index12.js";
26
- import { ApplicationStatusCard as ue } from "../../../../ui/dist/index15.js";
27
- import { ResultStep as de } from "../../../../ui/dist/index19.js";
28
- import { DeleteApplicationDialog as fe } from "../../../../ui/dist/index33.js";
29
- import { ApplicationDeletedScreen as pe } from "../../../../ui/dist/index35.js";
25
+ import { interpolateBankName as ce } from "../../../../ui/dist/index12.js";
26
+ import { ApplicationStatusCard as le } from "../../../../ui/dist/index15.js";
27
+ import { ResultStep as ue } from "../../../../ui/dist/index19.js";
28
+ import { DeleteApplicationDialog as de } from "../../../../ui/dist/index33.js";
29
+ import { ApplicationDeletedScreen as fe } from "../../../../ui/dist/index35.js";
30
30
  import "../../../../ui/dist/index.js";
31
- import { DEFAULT_LABELS as p } from "./labels.js";
32
- import { OnboardingApplicationView as me, applicationStatusNoticeFor as he, hiddenViewReason as ge, isNoticeView as _e, mergeApplicationStatusLabels as ve, onboardingApplicationViewFor as ye } from "./applicationStatusView.js";
33
- import { identifierLast4 as be, isIdentifierEnteredOrStored as xe } from "./fieldInput/storedIdentifier.js";
34
- import { isConsentGiven as Se } from "./stepSchemas.js";
35
- import { bankAccountOnboardingTestIds as m } from "./testIds.js";
36
- import { BusinessDetailsStep as Ce } from "./BusinessDetailsStep.js";
37
- import { PersonalDetailsStep as we } from "./PersonalDetailsStep.js";
38
- import { ReviewStep as Te } from "./ReviewStep.js";
39
- import { TermsStep as Ee } from "./TermsStep.js";
40
- import { valuesKey as h } from "./valuesKey.js";
41
- import { AdditionalOwnersStep as De } from "./AdditionalOwnersStep.js";
42
- import { buildCreateApplicationBody as Oe, buildUpdateApplicationBody as ke } from "./apiMapping.js";
43
- import { buildOnboardingPrefill as g } from "./buildOnboardingPrefill.js";
44
- import { acceptDraftedValues as Ae, asCreateBody as je, buildDraftApplicationBody as Me, withApplicantWorkEmail as Ne } from "./draftApplicationMapping.js";
45
- import { OnboardingAnalyticsEvent as Pe, WIDGET_NAME as Fe } from "../analytics/events.js";
46
- import { withoutResumeOnlyOwnerFields as Ie, withoutStoredIdentifierMarkers as Le } from "./hostInitialValues.js";
47
- import { ApplicationClientSecretProvider as Re, useApplicationClientSecret as ze } from "../../../../data-access/dist/index3.js";
48
- import { useCreateApplication as Be } from "../../../../data-access/dist/index5.js";
49
- import { useUpdateApplication as Ve } from "../../../../data-access/dist/index6.js";
50
- import { useSubmitApplication as He } from "../../../../data-access/dist/index7.js";
51
- import { useDeleteApplication as Ue } from "../../../../data-access/dist/index8.js";
52
- import { usePollApplicationCompletion as We } from "../../../../data-access/dist/index9.js";
53
- import { useResumableBankAccountApplication as Ge } from "../../../../data-access/dist/index11.js";
54
- import { useStartedBankAccountApplication as Ke } from "../../../../data-access/dist/index12.js";
31
+ import { DEFAULT_LABELS as m } from "./labels.js";
32
+ import { OnboardingApplicationView as pe, applicationStatusNoticeFor as me, hiddenViewReason as he, isNoticeView as ge, mergeApplicationStatusLabels as _e, onboardingApplicationViewFor as ve } from "./applicationStatusView.js";
33
+ import { identifierLast4 as ye, isIdentifierEnteredOrStored as be } from "./fieldInput/storedIdentifier.js";
34
+ import { isConsentGiven as xe } from "./stepSchemas.js";
35
+ import { bankAccountOnboardingTestIds as h } from "./testIds.js";
36
+ import { BusinessDetailsStep as Se } from "./BusinessDetailsStep.js";
37
+ import { PersonalDetailsStep as Ce } from "./PersonalDetailsStep.js";
38
+ import { ReviewStep as we } from "./ReviewStep.js";
39
+ import { TermsStep as Te } from "./TermsStep.js";
40
+ import { valuesKey as g } from "./valuesKey.js";
41
+ import { AdditionalOwnersStep as Ee } from "./AdditionalOwnersStep.js";
42
+ import { buildCreateApplicationBody as De, buildUpdateApplicationBody as Oe } from "./apiMapping.js";
43
+ import { buildOnboardingPrefill as _ } from "./buildOnboardingPrefill.js";
44
+ import { acceptDraftedValues as ke, asCreateBody as Ae, buildDraftApplicationBody as je, withApplicantWorkEmail as Me } from "./draftApplicationMapping.js";
45
+ import { OnboardingAnalyticsEvent as Ne, WIDGET_NAME as Pe } from "../analytics/events.js";
46
+ import { withoutResumeOnlyOwnerFields as Fe, withoutStoredIdentifierMarkers as Ie } from "./hostInitialValues.js";
47
+ import { ApplicationClientSecretProvider as Le, useApplicationClientSecret as Re } from "../../../../data-access/dist/index3.js";
48
+ import { useCreateApplication as ze } from "../../../../data-access/dist/index5.js";
49
+ import { useUpdateApplication as Be } from "../../../../data-access/dist/index6.js";
50
+ import { useSubmitApplication as Ve } from "../../../../data-access/dist/index7.js";
51
+ import { useDeleteApplication as He } from "../../../../data-access/dist/index8.js";
52
+ import { usePollApplicationCompletion as Ue } from "../../../../data-access/dist/index9.js";
53
+ import { useResumableBankAccountApplication as We } from "../../../../data-access/dist/index11.js";
54
+ import { useStartedBankAccountApplication as Ge } from "../../../../data-access/dist/index12.js";
55
55
  import "../../../../data-access/dist/index.js";
56
- import { useCallback as _, useEffect as v, useMemo as y, useReducer as qe, useRef as b, useState as x } from "react";
57
- import { Fragment as Je, jsx as S, jsxs as C } from "react/jsx-runtime";
56
+ import { useCallback as v, useEffect as y, useMemo as b, useReducer as Ke, useRef as x, useState as S } from "react";
57
+ import { Fragment as qe, jsx as C, jsxs as Je } from "react/jsx-runtime";
58
58
  // ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/BankAccountOnboardingWidget.js
59
- var Ye = 2 ** 31 - 1, Xe = "DRAFT", Ze = [], Qe = "ttw:grid ttw:w-full ttw:place-items-center ttw:overflow-auto ttw:bg-background ttw:p-6", w = (e) => xe(e, void 0);
59
+ var Ye = 2 ** 31 - 1, Xe = "DRAFT", Ze = [], Qe = "ttw:grid ttw:w-full ttw:place-items-center ttw:overflow-auto ttw:bg-background ttw:p-6", w = (e) => be(e, void 0);
60
60
  function $e(e) {
61
61
  return {
62
62
  ...e,
63
63
  taxId: "",
64
- taxIdOnFileLast4: be(e.taxId),
64
+ taxIdOnFileLast4: ye(e.taxId),
65
65
  taxIdOnFileStructure: e.companyStructure === "" ? void 0 : e.companyStructure
66
66
  };
67
67
  }
@@ -69,7 +69,7 @@ function et(e) {
69
69
  return {
70
70
  ...e,
71
71
  ssn: "",
72
- ssnOnFileLast4: be(e.ssn)
72
+ ssnOnFileLast4: ye(e.ssn)
73
73
  };
74
74
  }
75
75
  function tt(e, t) {
@@ -130,369 +130,386 @@ function at(e, t) {
130
130
  };
131
131
  }
132
132
  function ot({ callback: e }) {
133
- return v(() => {
133
+ return y(() => {
134
134
  e?.();
135
135
  }, [e]), null;
136
136
  }
137
- function st({ onEmbeddedOnboardingCompletedSuccessfully: te, onNavigateToDashboard: pe, onSuppressed: xe, labels: g, initialBusinessDetails: Fe, initialPersonalDetails: Le, initialAdditionalOwners: Re, initialApplicationId: Ge = null, initialBoundAuthEpoch: Ke, onEditableDraftChange: Xe, onApplicationDeleted: st, onNoticeReplacedByForm: ct, focusFormOnMount: E = !1, onFocusFormOnMountDone: lt, bankLogoSrc: ut, disclosureLinks: dt, showApplicationStatusRefresh: ft = !1, onResultPhaseChange: pt }) {
138
- let D = f(), { authEpoch: mt } = i();
139
- v(() => {
140
- D(Pe.Mounted);
137
+ function st({ onEmbeddedOnboardingCompletedSuccessfully: p, onNavigateToDashboard: fe, onSuppressed: be, labels: _, initialBusinessDetails: Pe, initialPersonalDetails: Ie, initialAdditionalOwners: Le, initialApplicationId: We = null, initialWrittenSections: Ge, initialBoundAuthEpoch: Xe, onEditableDraftChange: st, onApplicationDeleted: ct, onNoticeReplacedByForm: lt, focusFormOnMount: E = !1, onFocusFormOnMountDone: ut, bankLogoSrc: dt, disclosureLinks: ft, showApplicationStatusRefresh: pt = !1, onResultPhaseChange: mt }) {
138
+ let D = f(), { authEpoch: ht } = i();
139
+ y(() => {
140
+ D(Ne.Mounted);
141
141
  }, [D]);
142
142
  let O = {
143
- ...p,
144
- ...g,
145
- deleteFailedError: g?.deleteFailedError ?? p.deleteFailedError,
143
+ ...m,
144
+ ..._,
145
+ deleteFailedError: _?.deleteFailedError ?? m.deleteFailedError,
146
146
  stepIndicator: {
147
- ...p.stepIndicator,
148
- ...g?.stepIndicator
147
+ ...m.stepIndicator,
148
+ ..._?.stepIndicator
149
149
  },
150
150
  nextToStep: {
151
- ...p.nextToStep,
152
- ...g?.nextToStep
151
+ ...m.nextToStep,
152
+ ..._?.nextToStep
153
153
  },
154
154
  backToStepAriaLabel: {
155
- ...p.backToStepAriaLabel,
156
- ...g?.backToStepAriaLabel
155
+ ...m.backToStepAriaLabel,
156
+ ..._?.backToStepAriaLabel
157
157
  },
158
- businessDetails: g?.businessDetails ?? {},
159
- personalDetails: g?.personalDetails ?? {},
160
- additionalOwners: g?.additionalOwners ?? {},
161
- applicationReview: g?.applicationReview ?? {},
158
+ businessDetails: _?.businessDetails ?? {},
159
+ personalDetails: _?.personalDetails ?? {},
160
+ additionalOwners: _?.additionalOwners ?? {},
161
+ applicationReview: _?.applicationReview ?? {},
162
162
  result: {
163
- ...p.result,
164
- ...g?.result
163
+ ...m.result,
164
+ ..._?.result
165
165
  },
166
- deleteApplicationDialog: g?.deleteApplicationDialog ?? {},
167
- applicationStatus: ve(g?.applicationStatus)
168
- }, k = re().initResponse, { termsHref: ht, privacyHref: gt, electronicCommunicationHref: _t, patriotActHref: vt } = dt ?? {}, yt = _(() => {
169
- te();
170
- }, [te]), bt = ne(), [A, xt] = x(T.personal), [j, St] = x(() => ({
166
+ deleteApplicationDialog: _?.deleteApplicationDialog ?? {},
167
+ applicationStatus: _e(_?.applicationStatus)
168
+ }, k = ne().initResponse, { termsHref: gt, privacyHref: _t, electronicCommunicationHref: vt, patriotActHref: yt } = ft ?? {}, bt = v(() => {
169
+ p();
170
+ }, [p]), xt = te(), [A, St] = S(T.personal), [j, Ct] = S(() => ({
171
171
  ...rt,
172
- ...Fe
173
- })), [M, Ct] = x(() => ({
172
+ ...Pe
173
+ })), [M, wt] = S(() => ({
174
174
  ...it,
175
- ...Le
176
- })), [N, P] = x(() => Re ?? []), [F, wt] = x(() => ({
175
+ ...Ie
176
+ })), [N, P] = S(() => Le ?? []), [F, Tt] = S(() => ({
177
177
  business: j,
178
178
  personal: M,
179
179
  owners: N
180
- })), [Tt, Et] = x(null);
181
- v(() => {
182
- if (!Tt) return;
180
+ })), [Et, Dt] = S(null);
181
+ y(() => {
182
+ if (!Et) return;
183
183
  let e = {
184
184
  business: j,
185
185
  personal: M,
186
186
  owners: N
187
187
  };
188
- wt((t) => Tt.next(e, t)), Et(null);
188
+ Tt((t) => Et.next(e, t)), Dt(null);
189
189
  }, [
190
- Tt,
190
+ Et,
191
191
  j,
192
192
  M,
193
193
  N
194
194
  ]);
195
- let Dt = (e, { ownersCleared: t = !1 } = {}) => Et({ next: (n, r) => ({
195
+ let Ot = (e, { ownersCleared: t = !1 } = {}) => Dt({ next: (n, r) => ({
196
196
  business: e.includes("business") ? n.business : r.business,
197
197
  personal: e.includes("personal") ? n.personal : r.personal,
198
198
  owners: t ? Ze : e.includes("owners") ? n.owners : r.owners
199
- }) }), [I, Ot] = x(null), [kt, At] = x(0), [jt, Mt] = x(null), [Nt, Pt] = x(!1), [L, Ft] = x(null), [R, It] = x(null), [Lt, Rt] = x(null), [z, zt] = x(Ge), [Bt, Vt] = x({}), Ht = (e) => Vt((t) => ({
199
+ }) }), [I, kt] = S(null), [At, jt] = S(0), [Mt, Nt] = S(null), [Pt, Ft] = S(!1), [L, It] = S(null), [R, Lt] = S(null), [Rt, zt] = S(null), [z, Bt] = S(We), [Vt, Ht] = S(() => Ge ?? {
200
+ business: !1,
201
+ owners: !1
202
+ }), [Ut, Wt] = S({}), Gt = (e) => Wt((t) => ({
200
203
  ...t,
201
204
  ...e.taxId && w(e.taxId) && e.taxIdStructure ? {
202
205
  taxId: e.taxId,
203
206
  taxIdStructure: e.taxIdStructure
204
207
  } : {},
205
208
  ...e.ssn && w(e.ssn) ? { ssn: e.ssn } : {}
206
- })), Ut = (e) => {
207
- let { taxId: t, taxIdStructure: n } = Bt, r = t !== void 0 && n !== void 0 && e.companyStructure !== j.companyStructure && e.companyStructure !== "" && e.companyStructure === "SOLE_PROPRIETORSHIP" != (n === "SOLE_PROPRIETORSHIP");
208
- St(r ? {
209
+ })), Kt = (e) => {
210
+ let { taxId: t, taxIdStructure: n } = Ut, r = t !== void 0 && n !== void 0 && e.companyStructure !== j.companyStructure && e.companyStructure !== "" && e.companyStructure === "SOLE_PROPRIETORSHIP" != (n === "SOLE_PROPRIETORSHIP");
211
+ Ct(r ? {
209
212
  ...e,
210
213
  taxId: e.taxId === t ? "" : e.taxId,
211
- taxIdOnFileLast4: be(t),
214
+ taxIdOnFileLast4: ye(t),
212
215
  taxIdOnFileStructure: n
213
216
  } : e);
214
- }, [Wt, Gt] = x(Ke ?? mt), [Kt, B] = x(null), [qt, Jt] = x(null), [Yt, Xt] = x(0), Zt = b(null);
215
- v(() => {
216
- if (Yt === 0) return;
217
- let e = Zt.current;
217
+ }, [qt, Jt] = S(Xe ?? ht), [Yt, B] = S(null), [Xt, Zt] = S(null), [Qt, $t] = S(0), en = x(null);
218
+ y(() => {
219
+ if (Qt === 0) return;
220
+ let e = en.current;
218
221
  (e?.querySelector("[aria-invalid=\"true\"]") ?? e?.querySelector("[data-needs-attention]"))?.focus();
219
- }, [Yt]);
220
- let [Qt, $t] = x(!1), [en, tn] = x(!1), [nn, rn] = x(!1), [an, on] = x(null), sn = Be(), V = Ve(), cn = He(), ln = Ue(), un = We(), { setClientSecret: dn } = ze(), { data: fn, refetch: pn } = s(), { mutateAsync: mn } = o(), hn = l(), H = u(), gn = ie(), [_n, vn] = qe((e) => e + 1, 0), yn = y(() => ce(H.applications), [H.applications]), bn = b(null);
221
- H.isResolved && (bn.current = { application: yn });
222
- let U = H.isResolved ? yn : bn.current?.application ?? null, xn = se(U), W = ye(U), Sn = H.isResolved || bn.current !== null && W === me.Form;
223
- v(() => {
224
- if (xn === null) return;
225
- let e = xn - Date.now();
222
+ }, [Qt]);
223
+ let [tn, nn] = S(!1), [rn, an] = S(!1), [on, sn] = S(!1), [cn, ln] = S(null), un = ze(), V = Be(), dn = Ve(), fn = He(), pn = Ue(), { setClientSecret: mn } = Re(), { data: hn, refetch: gn } = s(), { mutateAsync: _n } = o(), vn = l(), H = u(), yn = re(), [bn, xn] = Ke((e) => e + 1, 0), Sn = b(() => se(H.applications), [H.applications]), Cn = x(null);
224
+ H.isResolved && (Cn.current = { application: Sn });
225
+ let U = H.isResolved ? Sn : Cn.current?.application ?? null, wn = oe(U), W = ve(U), Tn = H.isResolved || Cn.current !== null && W === pe.Form;
226
+ y(() => {
227
+ if (wn === null) return;
228
+ let e = wn - Date.now();
226
229
  if (e < 0) return;
227
- let t = setTimeout(vn, Math.min(e + 1, Ye));
230
+ let t = setTimeout(xn, Math.min(e + 1, Ye));
228
231
  return () => clearTimeout(t);
229
- }, [xn, _n]);
230
- let Cn = b(null);
231
- v(() => () => Cn.current?.abort(), []);
232
- let wn = y(() => oe(O.businessDetails.naicsTitles), [O.businessDetails.naicsTitles]), Tn = y(() => r(O.businessDetails.stateTitles), [O.businessDetails.stateTitles]), En = y(() => r(O.personalDetails.stateTitles), [O.personalDetails.stateTitles]), Dn = y(() => r(O.additionalOwners.stateTitles), [O.additionalOwners.stateTitles]), G = nn || an !== null, On = b(pt);
233
- On.current = pt, v(() => {
234
- if (G) return On.current?.(!0), () => On.current?.(!1);
232
+ }, [wn, bn]);
233
+ let En = x(null);
234
+ y(() => () => En.current?.abort(), []);
235
+ let Dn = b(() => ae(O.businessDetails.naicsTitles), [O.businessDetails.naicsTitles]), On = b(() => r(O.businessDetails.stateTitles), [O.businessDetails.stateTitles]), kn = b(() => r(O.personalDetails.stateTitles), [O.personalDetails.stateTitles]), An = b(() => r(O.additionalOwners.stateTitles), [O.additionalOwners.stateTitles]), G = on || cn !== null, jn = x(mt);
236
+ jn.current = mt, y(() => {
237
+ if (G) return jn.current?.(!0), () => jn.current?.(!1);
235
238
  }, [G]);
236
- let kn = k?.status === "ACTIVE" || k?.status === "INACTIVE", An = k?.status === "INVITED", jn = kn || An, K = hn.isResolved && Sn, Mn = k && !G && !jn && K && _e(W) ? W : null, Nn = !!k && !G && Mn === null && (jn || K && (hn.isSuppressed || W === me.Hidden)), q = Nn ? kn ? c.UserAlreadyOnboarded : An ? c.UserInvitedToOrganization : W === me.Hidden ? ge(U) : hn.reason ?? ge(U) : null, Pn = !!k && K && !G, [Fn, In] = x(!1), Ln = Fn && Nn && !jn && q !== c.OrganizationApplicationDenialExpired, J = Mn ?? (Ln ? "unavailable" : null);
237
- Pn && Fn !== (J !== null) && In(J !== null);
238
- let Y = Ln && q === c.OrganizationApplicationComplete, Rn = ae(), [X, zn] = x("idle"), [Bn, Vn] = x(!1);
239
- Pn && Y !== Bn && (Vn(Y), Y && zn("requested")), X === "requested" && Rn && zn("inFlight"), X === "inFlight" && !Rn && zn("idle");
240
- let Hn = Y && X !== "idle", Un = b(xe);
241
- Un.current = xe;
242
- let Wn = Nn && J === null;
243
- v(() => {
244
- Wn && q && (D(Pe.Suppressed, { reason: q }), console.info(`[onboarding] not shown: ${q}`), Un.current?.(q));
239
+ let Mn = k?.status === "ACTIVE" || k?.status === "INACTIVE", Nn = k?.status === "INVITED", Pn = Mn || Nn, K = vn.isResolved && Tn, Fn = k && !G && !Pn && K && ge(W) ? W : null, In = !!k && !G && Fn === null && (Pn || K && (vn.isSuppressed || W === pe.Hidden)), q = In ? Mn ? c.UserAlreadyOnboarded : Nn ? c.UserInvitedToOrganization : W === pe.Hidden ? he(U) : vn.reason ?? he(U) : null, Ln = !!k && K && !G, [Rn, zn] = S(!1), Bn = Rn && In && !Pn && q !== c.OrganizationApplicationDenialExpired, J = Fn ?? (Bn ? "unavailable" : null);
240
+ Ln && Rn !== (J !== null) && zn(J !== null);
241
+ let Y = Bn && q === c.OrganizationApplicationComplete, Vn = ie(), [Hn, Un] = S("idle"), [Wn, Gn] = S(!1);
242
+ Ln && Y !== Wn && (Gn(Y), Y && Un("requested")), Hn === "requested" && Vn && Un("inFlight"), Hn === "inFlight" && !Vn && Un("idle");
243
+ let Kn = Y && Hn !== "idle", qn = x(be);
244
+ qn.current = be;
245
+ let Jn = In && J === null;
246
+ y(() => {
247
+ Jn && q && (D(Ne.Suppressed, { reason: q }), console.info(`[onboarding] not shown: ${q}`), qn.current?.(q));
245
248
  }, [
246
- Wn,
249
+ Jn,
247
250
  q,
248
251
  D
249
252
  ]);
250
- let Gn = gn ? null : Mn;
251
- v(() => {
252
- Gn && D(Pe.ApplicationStatusShown, { view: Gn });
253
- }, [Gn, D]);
254
- let Kn = b(J), qn = b(ct);
255
- qn.current = ct;
256
- let Jn = b(bt);
257
- Jn.current = bt, v(() => {
253
+ let Yn = yn ? null : Fn;
254
+ y(() => {
255
+ Yn && D(Ne.ApplicationStatusShown, { view: Yn });
256
+ }, [Yn, D]);
257
+ let Xn = x(J), Zn = x(lt);
258
+ Zn.current = lt;
259
+ let Qn = x(xt);
260
+ Qn.current = xt, y(() => {
258
261
  if (!K || G) return;
259
- let e = Kn.current !== null;
260
- Kn.current = J, e && J === null && W === me.Form && qn.current?.();
262
+ let e = Xn.current !== null;
263
+ Xn.current = J, e && J === null && W === pe.Form && Zn.current?.();
261
264
  }, [
262
265
  W,
263
266
  G,
264
267
  K,
265
268
  J
266
- ]), v(() => {
267
- X === "requested" && Jn.current();
268
- }, [X]), v(() => {
269
- Xe?.(G || z === null ? null : {
269
+ ]), y(() => {
270
+ Hn === "requested" && Qn.current();
271
+ }, [Hn]), y(() => {
272
+ st?.(G || z === null ? null : {
270
273
  applicationId: z,
271
- authEpoch: Wt
274
+ authEpoch: qt
272
275
  });
273
276
  }, [
274
- Xe,
277
+ st,
275
278
  G,
276
279
  z,
277
- Wt
280
+ qt
278
281
  ]);
279
- let Yn = b(mt);
280
- if (Yn.current = mt, !k) return null;
282
+ let $n = x(ht);
283
+ if ($n.current = ht, !k) return null;
281
284
  if (!G) {
282
- if (Nn && !J || Hn || !K) return null;
285
+ if (In && !J || Kn || !K) return null;
283
286
  if (J) {
284
- if (gn) return null;
285
- let t = he(J, U, k.bankName?.trim() || O.fallbackBankName, O.applicationStatus), n = /* @__PURE__ */ S(ue, {
287
+ if (yn) return null;
288
+ let t = me(J, U, k.bankName?.trim() || O.fallbackBankName, O.applicationStatus), n = /* @__PURE__ */ C(le, {
286
289
  ...t,
287
290
  className: "ttw:max-w-2xl",
288
291
  focusTitleOnMount: E,
289
292
  testIds: {
290
- root: m.statusCard,
291
- chip: m.statusCardChip
293
+ root: h.statusCard,
294
+ chip: h.statusCardChip
292
295
  },
293
- action: ft ? /* @__PURE__ */ S(e, {
296
+ action: pt ? /* @__PURE__ */ C(e, {
294
297
  variant: "outline",
295
- onClick: Y ? () => zn("requested") : hn.refetch,
296
- "data-testid": m.statusCardCheckAgain,
298
+ onClick: Y ? () => Un("requested") : vn.refetch,
299
+ "data-testid": h.statusCardCheckAgain,
297
300
  children: O.applicationStatus.checkAgain
298
301
  }) : void 0
299
302
  });
300
- return /* @__PURE__ */ C("div", {
303
+ return /* @__PURE__ */ Je("div", {
301
304
  className: Qe,
302
- children: [n, E ? /* @__PURE__ */ S(ot, { callback: lt }) : null]
305
+ children: [n, E ? /* @__PURE__ */ C(ot, { callback: ut }) : null]
303
306
  });
304
307
  }
305
308
  }
306
- let Z = j.companyStructure === "SOLE_PROPRIETORSHIP", Xn = j.companyStructure !== "" && !Z, Zn = Xn ? Lt : Ze, Q = R && {
309
+ let X = j.companyStructure === "SOLE_PROPRIETORSHIP", er = j.companyStructure !== "" && !X, tr = er ? Rt : Ze, Z = R && {
307
310
  ...R,
308
311
  ownsOver25Percent: M.ownsOver25Percent,
309
312
  ownershipPercentage: M.ownershipPercentage
310
- }, Qn = [
313
+ }, nr = [
311
314
  O.stepIndicator.personal,
312
315
  O.stepIndicator.business,
313
316
  O.stepIndicator.review,
314
317
  O.stepIndicator.terms
315
- ], $n = R !== null && L !== null && Zn !== null, er = A === T.personal ? R !== null : A === T.business ? L !== null && Zn !== null : A === T.review ? $n : $n && Se(j), $ = sn.isPending || V.isPending || cn.isPending || ln.isPending || nn, tr = () => {
316
- St((e) => e.isAuthorized === null && !e.isCheckboxChecked ? e : {
318
+ ], rr = R !== null && L !== null && tr !== null, ir = A === T.personal ? R !== null : A === T.business ? L !== null && tr !== null : A === T.review ? rr : rr && xe(j), Q = un.isPending || V.isPending || dn.isPending || fn.isPending || on, ar = () => {
319
+ Ct((e) => e.isAuthorized === null && !e.isCheckboxChecked ? e : {
317
320
  ...e,
318
321
  isAuthorized: null,
319
322
  isCheckboxChecked: !1
320
323
  });
321
- }, nr = () => {
322
- B(null), tr(), xt(T.personal);
323
- }, rr = () => {
324
- B(null), tr(), xt(T.business);
325
- }, ir = () => {
326
- B(null), A === T.review && tr(), I && P(tt(N, I)), xt((e) => e === T.personal ? e : e - 1);
327
- }, ar = {
328
- business: h(j) !== h(F.business),
329
- personal: h(M) !== h(F.personal),
330
- owners: h(nt(j.companyStructure === "SOLE_PROPRIETORSHIP" ? Ze : tt(N, I))) !== h(nt(F.owners))
331
- }, or = async (e) => {
332
- rn(!0);
324
+ }, or = () => {
325
+ B(null), ar(), St(T.personal);
326
+ }, sr = () => {
327
+ B(null), ar(), St(T.business);
328
+ }, cr = () => {
329
+ B(null), A === T.review && ar(), I && P(tt(N, I)), St((e) => e === T.personal ? e : e - 1);
330
+ }, $ = {
331
+ business: g(j) !== g(F.business),
332
+ personal: g(M) !== g(F.personal),
333
+ owners: g(nt(j.companyStructure === "SOLE_PROPRIETORSHIP" ? Ze : tt(N, I))) !== g(nt(F.owners))
334
+ }, lr = $.business || $.personal || $.owners, ur = async (e) => {
335
+ sn(!0);
333
336
  let t = new AbortController();
334
- Cn.current = t;
337
+ En.current = t;
335
338
  let n = !1;
336
339
  try {
337
- let r = await cn.mutateAsync({ path: { id: e } });
340
+ let r = await dn.mutateAsync({ path: { id: e } });
338
341
  if (t.signal.aborted) return;
339
342
  if (!r.id) throw Error(O.submitFailedError);
340
- if (n = !0, (await un(e, { signal: t.signal })).status === "complete") {
341
- let e = fn;
342
- if (e === void 0 && (e = (await pn()).data), t.signal.aborted) return;
343
+ if (n = !0, (await pn(e, { signal: t.signal })).status === "complete") {
344
+ let e = hn;
345
+ if (e === void 0 && (e = (await gn()).data), t.signal.aborted) return;
343
346
  if (e !== void 0) try {
344
- await mn({ displayedVersion: a(e)?.disclosureId ?? null });
347
+ await _n({ displayedVersion: a(e)?.disclosureId ?? null });
345
348
  } catch {}
346
349
  if (t.signal.aborted) return;
347
- on("success"), bt(), yt();
348
- } else on("pending");
350
+ ln("success"), xt(), bt();
351
+ } else ln("pending");
349
352
  } catch (e) {
350
353
  if (e instanceof DOMException && e.name === "AbortError") return;
351
354
  if (!n) throw e;
352
- on("pending");
355
+ ln("pending");
353
356
  } finally {
354
- Cn.current = null, rn(!1);
357
+ En.current = null, sn(!1);
355
358
  }
356
- }, sr = ({ evenWithoutMarker: e = !1 } = {}) => {
357
- St((t) => (t.taxIdOnFileLast4 || e) && w(t.taxId) ? $e(t) : t);
358
- }, cr = ({ evenWithoutMarker: e = !1 } = {}) => {
359
- Ct((t) => (t.ssnOnFileLast4 || e) && w(t.ssn) ? et(t) : t);
360
- }, lr = ({ evenWithoutMarker: e = !1 } = {}) => {
359
+ }, dr = ({ evenWithoutMarker: e = !1 } = {}) => {
360
+ Ct((t) => (t.taxIdOnFileLast4 || e) && w(t.taxId) ? $e(t) : t);
361
+ }, fr = ({ evenWithoutMarker: e = !1 } = {}) => {
362
+ wt((t) => (t.ssnOnFileLast4 || e) && w(t.ssn) ? et(t) : t);
363
+ }, pr = ({ evenWithoutMarker: e = !1 } = {}) => {
361
364
  P((t) => t.map((t) => (t.ssnOnFileLast4 || e && t.id) && w(t.ssn) ? et(t) : t));
362
- }, ur = () => {
363
- P((e) => e.map(Ie));
364
- }, dr = async (e) => {
365
- let t = Yn.current, n = await sn.mutateAsync({ body: Ne(e, M) });
366
- return zt(n.id), Gt(t), n.clientSecret && dn(n.id, n.clientSecret), n.id;
367
- }, fr = async () => {
365
+ }, mr = () => {
366
+ P((e) => e.map(Fe));
367
+ }, hr = async (e) => {
368
+ let t = $n.current, n = await un.mutateAsync({ body: Me(e, M) });
369
+ return Bt(n.id), Jt(t), n.clientSecret && mn(n.id, n.clientSecret), n.id;
370
+ }, gr = async () => {
368
371
  if (A === T.personal) {
369
- if (!Q) return null;
372
+ if (!Z) return null;
370
373
  let e = F.business.companyStructure === "SOLE_PROPRIETORSHIP", t = z;
371
374
  return t ? await V.mutateAsync({
372
375
  path: { id: t },
373
- body: ke({
374
- applicant: Q,
376
+ body: Oe({
377
+ applicant: Z,
375
378
  isSoleProprietor: e
376
379
  })
377
- }) : t = await dr(Oe({
378
- applicant: Q,
380
+ }) : t = await hr(De({
381
+ applicant: Z,
379
382
  isSoleProprietor: e
380
- })), Ht({ ssn: Q.ssn }), cr(), Dt(["personal"]), t;
383
+ })), Gt({ ssn: Z.ssn }), fr(), Ot(["personal"]), t;
381
384
  }
382
385
  if (A === T.business) {
383
- if (!Q || !L || !Zn) return null;
386
+ if (!Z || !L || !tr) return null;
384
387
  let e = {
385
388
  businessDetails: L,
386
- applicant: Q,
387
- businessOwners: Zn
389
+ applicant: Z,
390
+ businessOwners: tr
388
391
  }, t = z;
389
392
  return t ? await V.mutateAsync({
390
393
  path: { id: t },
391
- body: ke(e)
392
- }) : t = await dr(ke(e)), Ht({
394
+ body: Oe(e)
395
+ }) : t = await hr(Oe(e)), Gt({
393
396
  taxId: L.taxId,
394
397
  taxIdStructure: L.companyStructure,
395
- ssn: Q.ssn
396
- }), sr(), cr(), Z ? ur() : lr(), Dt([
398
+ ssn: Z.ssn
399
+ }), dr(), fr(), X ? mr() : pr(), Ot([
397
400
  "business",
398
401
  "personal",
399
402
  "owners"
400
- ], { ownersCleared: Z }), t;
403
+ ], { ownersCleared: X }), Ht({
404
+ business: !0,
405
+ owners: !0
406
+ }), t;
401
407
  }
402
- return A === T.review ? $n ? z : null : !z || !Se(j) ? null : (await V.mutateAsync({
408
+ return A === T.review ? rr ? z : null : !z || !xe(j) ? null : (await V.mutateAsync({
403
409
  path: { id: z },
404
- body: ke({ consent: {
410
+ body: Oe({ consent: {
405
411
  isLegallyAuthorized: !0,
406
412
  hasAcceptedDisclosures: !0
407
413
  } })
408
- }), Dt(["business"]), z);
409
- }, pr = async () => {
410
- if (B(null), !er) {
411
- Jt(A), Xt((e) => e + 1);
414
+ }), Ot(["business"]), z);
415
+ }, _r = async () => {
416
+ if (B(null), !ir) {
417
+ Zt(A), $t((e) => e + 1);
412
418
  return;
413
419
  }
414
420
  let e;
415
421
  try {
416
- e = await fr();
422
+ e = await gr();
417
423
  } catch {
418
424
  B(O.genericRetryError);
419
425
  return;
420
426
  }
421
427
  if (e !== null) {
422
- if (Jt(null), A === T.terms) try {
423
- await or(e);
428
+ if (Zt(null), A === T.terms) try {
429
+ await ur(e);
424
430
  } catch {
425
431
  B(O.submitFailedError);
426
432
  }
427
- else xt(A + 1);
433
+ else St(A + 1);
428
434
  }
429
- }, mr = async () => {
430
- B(null), $t(!0);
435
+ }, vr = async () => {
436
+ B(null), nn(!0);
431
437
  try {
432
- if (await fr() === null) return;
433
- cr({ evenWithoutMarker: !0 }), A >= T.business && (sr({ evenWithoutMarker: !0 }), lr({ evenWithoutMarker: !0 })), n.success(O.applicationSavedToast);
438
+ if (await gr() === null) return;
439
+ fr({ evenWithoutMarker: !0 }), A >= T.business && (dr({ evenWithoutMarker: !0 }), pr({ evenWithoutMarker: !0 })), n.success(O.applicationSavedToast);
434
440
  } catch {
435
441
  n.error(O.genericRetryError);
436
442
  } finally {
437
- $t(!1);
443
+ nn(!1);
438
444
  }
439
- }, hr = async () => {
440
- let e = tt(N, I), t = Me({
445
+ }, yr = async () => {
446
+ let e = tt(N, I), t = {
447
+ ...$,
448
+ business: $.business || z !== null && !Vt.business,
449
+ owners: $.owners || z !== null && !Vt.owners
450
+ }, r = je({
441
451
  businessDetails: j,
442
452
  applicant: M,
443
453
  businessOwners: e,
444
454
  savedBusinessDetails: F.business,
445
455
  savedOwners: F.owners,
446
- dirty: ar
447
- }), r = ar;
448
- Pt(!0);
456
+ dirty: t
457
+ });
458
+ Ft(!0);
449
459
  try {
450
- if (!t) {
460
+ if (!r) {
461
+ if (!lr) {
462
+ n.success(O.applicationSavedToast);
463
+ return;
464
+ }
451
465
  n.error(O.saveDraftNothingValidError);
452
466
  return;
453
467
  }
454
468
  z ? await V.mutateAsync({
455
469
  path: { id: z },
456
- body: t
457
- }) : await dr(je(t)), I && P(e), n.success(O.applicationSavedToast);
458
- let i = t;
459
- Ht({
470
+ body: r
471
+ }) : await hr(Ae(r)), I && P(e), n.success(O.applicationSavedToast);
472
+ let i = r;
473
+ Gt({
460
474
  taxId: i.businessDetails?.taxId?.value,
461
475
  taxIdStructure: j.companyStructure,
462
476
  ssn: i.applicant?.personalIdentificationNumber?.value
463
- }), 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();
477
+ }), i.businessDetails?.taxId !== void 0 && dr({ evenWithoutMarker: !0 }), i.applicant?.personalIdentificationNumber !== void 0 && fr({ evenWithoutMarker: !0 }), Array.isArray(i.businessOwners) && pr({ evenWithoutMarker: !0 }), i.businessOwners === null && e.length > 0 && mr(), Ht((e) => ({
478
+ business: e.business || i.businessDetails !== void 0,
479
+ owners: e.owners || i.businessOwners !== void 0
480
+ }));
464
481
  let a = Array.isArray(i.businessOwners) ? "list" : i.businessOwners === null ? "cleared" : "none";
465
- Et({ next: (e, t) => Ae({
482
+ Dt({ next: (e, n) => ke({
466
483
  current: e,
467
- saved: t,
468
- dirty: r,
484
+ saved: n,
485
+ dirty: t,
469
486
  ownersWrite: a
470
- }) }), Ot(null), At((e) => e + 1);
487
+ }) }), kt(null), jt((e) => e + 1);
471
488
  } catch {
472
489
  n.error(O.genericRetryError);
473
490
  } finally {
474
- Pt(!1);
491
+ Ft(!1);
475
492
  }
476
- }, gr = async () => {
493
+ }, br = async () => {
477
494
  if (z !== null) try {
478
- await ln.mutateAsync({ path: { id: z } });
495
+ await fn.mutateAsync({ path: { id: z } });
479
496
  } catch {
480
497
  n.error(O.deleteFailedError);
481
498
  return;
482
499
  }
483
- tn(!1), st?.();
484
- }, _r = at(A, O), vr = k.bankName?.trim() || O.fallbackBankName, yr = le(O.shellFdicDisclaimer, vr);
500
+ an(!1), ct?.();
501
+ }, xr = at(A, O), Sr = k.bankName?.trim() || O.fallbackBankName, Cr = ce(O.shellFdicDisclaimer, Sr);
485
502
  if (G) {
486
- let e = L?.companyLegalName ?? "", t = k.bankName?.trim() || O.fallbackBankName, n = an ?? "pending", r = n === "success", i = {
487
- ...p.result,
503
+ let e = L?.companyLegalName ?? "", t = k.bankName?.trim() || O.fallbackBankName, n = cn ?? "pending", r = n === "success", i = {
504
+ ...m.result,
488
505
  ...O.result
489
- }, a = /* @__PURE__ */ S(de, {
506
+ }, a = /* @__PURE__ */ C(ue, {
490
507
  testIds: {
491
- processing: m.resultProcessing,
492
- dashboardButton: m.resultDashboardButton
508
+ processing: h.resultProcessing,
509
+ dashboardButton: h.resultDashboardButton
493
510
  },
494
511
  status: n,
495
- isLoading: nn,
512
+ isLoading: on,
496
513
  loadingMessage: i.loadingMessage,
497
514
  headingLine1: r ? i.successHeadingLine1 : i.pendingHeadingLine1,
498
515
  headingLine2: `${e}!`,
@@ -500,165 +517,165 @@ function st({ onEmbeddedOnboardingCompletedSuccessfully: te, onNavigateToDashboa
500
517
  followUpEmail: R?.workEmail ?? "",
501
518
  emailBoxLead: i.pendingEmailBoxLead,
502
519
  navigateToDashboardLabel: i.navigateToDashboard,
503
- bankLogoSrc: ut,
504
- bankLogoAlt: le(i.bankLogoAlt, t),
505
- fdicDisclaimer: le(i.fdicDisclaimer, t),
506
- onNavigateToDashboard: pe
520
+ bankLogoSrc: dt,
521
+ bankLogoAlt: ce(i.bankLogoAlt, t),
522
+ fdicDisclaimer: ce(i.fdicDisclaimer, t),
523
+ onNavigateToDashboard: fe
507
524
  });
508
- return /* @__PURE__ */ S("div", {
525
+ return /* @__PURE__ */ C("div", {
509
526
  className: "ttw:grid ttw:w-full ttw:place-items-center ttw:gap-0 ttw:overflow-auto ttw:bg-background",
510
527
  children: a
511
528
  });
512
529
  }
513
- let br = A === T.personal ? O.nextToStep.business : A === T.business ? O.nextToStep.review : A === T.review ? O.nextToStep.terms : O.submit, xr = A === T.business ? O.backToStepAriaLabel.personal : A === T.review ? O.backToStepAriaLabel.business : A === T.terms ? O.backToStepAriaLabel.review : void 0, Sr = $, Cr = qt === A, wr = ar.business || ar.personal || ar.owners, Tr = er ? mr : hr, Er = $ || Nt || !er && !wr, Dr = `${M.firstName} ${M.lastName}`.trim(), Or = Z ? 100 : M.ownsOver25Percent === !0 ? M.ownershipPercentage ?? 0 : 0, kr = j.companyDbaName.trim() || j.companyLegalName.trim(), Ar = Z ? Ze : N, jr = qt === T.business && A === T.business && Ar.some((e) => !e.reviewed) ? O.ownersNeedReviewError : null;
514
- return /* @__PURE__ */ C(Je, { children: [
515
- /* @__PURE__ */ S(ee, {
516
- title: _r.title,
517
- subtitle: _r.subtitle,
530
+ let wr = A === T.personal ? O.nextToStep.business : A === T.business ? O.nextToStep.review : A === T.review ? O.nextToStep.terms : O.submit, Tr = A === T.business ? O.backToStepAriaLabel.personal : A === T.review ? O.backToStepAriaLabel.business : A === T.terms ? O.backToStepAriaLabel.review : void 0, Er = Q, Dr = Xt === A, Or = ir ? vr : yr, kr = Q || Pt || !ir && !lr && z === null, Ar = `${M.firstName} ${M.lastName}`.trim(), jr = X ? 100 : M.ownsOver25Percent === !0 ? M.ownershipPercentage ?? 0 : 0, Mr = j.companyDbaName.trim() || j.companyLegalName.trim(), Nr = X ? Ze : N, Pr = Xt === T.business && A === T.business && Nr.some((e) => !e.reviewed) ? O.ownersNeedReviewError : null;
531
+ return /* @__PURE__ */ Je(qe, { children: [
532
+ /* @__PURE__ */ C(ee, {
533
+ title: xr.title,
534
+ subtitle: xr.subtitle,
518
535
  focusTitleOnMount: E,
519
- stepLabels: Qn,
536
+ stepLabels: nr,
520
537
  activeStep: A,
521
- disclaimerText: yr,
522
- onBack: ir,
538
+ disclaimerText: Cr,
539
+ onBack: cr,
523
540
  showBackButton: A !== T.personal,
524
- backAriaLabel: xr,
525
- onNext: pr,
526
- onSaveAndClose: Tr,
527
- onDelete: () => tn(!0),
528
- isNextDisabled: Sr,
529
- isNextLoading: $ && !Qt,
530
- isSaveAndCloseDisabled: Er,
531
- isSaveAndCloseLoading: Qt || Nt,
532
- nextLabel: br,
541
+ backAriaLabel: Tr,
542
+ onNext: _r,
543
+ onSaveAndClose: Or,
544
+ onDelete: () => an(!0),
545
+ isNextDisabled: Er,
546
+ isNextLoading: Q && !tn,
547
+ isSaveAndCloseDisabled: kr,
548
+ isSaveAndCloseLoading: tn || Pt,
549
+ nextLabel: wr,
533
550
  nextIcon: null,
534
551
  nextTone: A === T.terms ? "success" : "primary",
535
552
  isTitleVisuallyHidden: A === T.terms,
536
- errorMessage: Kt,
553
+ errorMessage: Yt,
537
554
  labels: {
538
555
  backButton: O.back,
539
556
  saveAndCloseButton: O.saveAndClose,
540
557
  deleteButton: O.deleteApplication
541
558
  },
542
559
  testIds: {
543
- root: m.shell,
544
- back: m.shellBack,
545
- saveAndClose: m.shellSaveAndClose,
546
- delete: m.shellDelete,
547
- next: m.shellNext,
560
+ root: h.shell,
561
+ back: h.shellBack,
562
+ saveAndClose: h.shellSaveAndClose,
563
+ delete: h.shellDelete,
564
+ next: h.shellNext,
548
565
  scrollRegion: {
549
- root: m.shellScrollRegion,
550
- fade: m.shellScrollFade
566
+ root: h.shellScrollRegion,
567
+ fade: h.shellScrollFade
551
568
  }
552
569
  },
553
- children: /* @__PURE__ */ C("div", {
554
- ref: Zt,
570
+ children: /* @__PURE__ */ Je("div", {
571
+ ref: en,
555
572
  className: "ttw:contents",
556
573
  children: [
557
- A === T.personal ? /* @__PURE__ */ S("div", {
574
+ A === T.personal ? /* @__PURE__ */ C("div", {
558
575
  className: "ttw:max-w-2xl",
559
- children: /* @__PURE__ */ S(we, {
576
+ children: /* @__PURE__ */ C(Ce, {
560
577
  value: M,
561
- onValueChange: Ct,
562
- onSnapshotChange: It,
563
- stateOptions: En,
564
- isSubmitting: $,
565
- showAllErrors: Cr,
578
+ onValueChange: wt,
579
+ onSnapshotChange: Lt,
580
+ stateOptions: kn,
581
+ isSubmitting: Q,
582
+ showAllErrors: Dr,
566
583
  labels: O.personalDetails
567
584
  }, "personal")
568
585
  }) : null,
569
- A === T.business ? /* @__PURE__ */ C("div", {
586
+ A === T.business ? /* @__PURE__ */ Je("div", {
570
587
  className: "ttw:flex ttw:max-w-2xl ttw:flex-col ttw:gap-10",
571
- children: [/* @__PURE__ */ S(Ce, {
588
+ children: [/* @__PURE__ */ C(Se, {
572
589
  value: j,
573
- onValueChange: Ut,
574
- onSnapshotChange: Ft,
575
- naicsOptions: wn,
576
- stateOptions: Tn,
577
- isSubmitting: $,
578
- showAllErrors: Cr,
590
+ onValueChange: Kt,
591
+ onSnapshotChange: It,
592
+ naicsOptions: Dn,
593
+ stateOptions: On,
594
+ isSubmitting: Q,
595
+ showAllErrors: Dr,
579
596
  labels: O.businessDetails
580
- }, "business"), Xn ? /* @__PURE__ */ C(Je, { children: [/* @__PURE__ */ S(t, {}), /* @__PURE__ */ S(De, {
581
- owners: Ar,
597
+ }, "business"), er ? /* @__PURE__ */ Je(qe, { children: [/* @__PURE__ */ C(t, {}), /* @__PURE__ */ C(Ee, {
598
+ owners: Nr,
582
599
  onOwnersChange: P,
583
- primaryOwnerName: Dr,
600
+ primaryOwnerName: Ar,
584
601
  applicantOwnership: {
585
602
  ownsOver25Percent: M.ownsOver25Percent,
586
603
  ownershipPercentage: M.ownershipPercentage
587
604
  },
588
- onApplicantOwnershipChange: (e) => Ct((t) => ({
605
+ onApplicantOwnershipChange: (e) => wt((t) => ({
589
606
  ...t,
590
607
  ...e
591
608
  })),
592
- applicantOwnershipBaseline: jt,
593
- onApplicantOwnershipBaselineChange: Mt,
594
- businessName: kr,
609
+ applicantOwnershipBaseline: Mt,
610
+ onApplicantOwnershipBaselineChange: Nt,
611
+ businessName: Mr,
595
612
  applicantPersonalDetails: M,
596
- onEditPersonalDetails: nr,
597
- stateOptions: Dn,
598
- onSnapshotChange: Rt,
599
- onPendingOwnerChange: Ot,
600
- isSubmitting: $,
601
- showAllErrors: Cr,
602
- revealErrorsAttempt: Yt,
603
- reviewError: jr,
613
+ onEditPersonalDetails: or,
614
+ stateOptions: An,
615
+ onSnapshotChange: zt,
616
+ onPendingOwnerChange: kt,
617
+ isSubmitting: Q,
618
+ showAllErrors: Dr,
619
+ revealErrorsAttempt: Qt,
620
+ reviewError: Pr,
604
621
  labels: O.additionalOwners
605
- }, kt)] }) : null]
622
+ }, At)] }) : null]
606
623
  }) : null,
607
- A === T.review ? /* @__PURE__ */ S("div", {
624
+ A === T.review ? /* @__PURE__ */ C("div", {
608
625
  className: "ttw:max-w-2xl",
609
- children: /* @__PURE__ */ S(Te, {
626
+ children: /* @__PURE__ */ C(we, {
610
627
  personalDetails: M,
611
628
  businessDetails: j,
612
- additionalOwners: Ar,
613
- primaryOwnerName: Dr,
614
- primaryOwnerPercentage: Or,
615
- isSoleProprietor: Z,
616
- personalStateOptions: En,
617
- businessStateOptions: Tn,
618
- naicsOptions: wn,
619
- onEditPersonal: nr,
620
- onEditBusiness: rr,
629
+ additionalOwners: Nr,
630
+ primaryOwnerName: Ar,
631
+ primaryOwnerPercentage: jr,
632
+ isSoleProprietor: X,
633
+ personalStateOptions: kn,
634
+ businessStateOptions: On,
635
+ naicsOptions: Dn,
636
+ onEditPersonal: or,
637
+ onEditBusiness: sr,
621
638
  ownersEditAriaLabel: O.reviewOwnersEditAriaLabel,
622
- isSubmitting: $,
639
+ isSubmitting: Q,
623
640
  labels: O
624
641
  })
625
642
  }) : null,
626
- A === T.terms ? /* @__PURE__ */ S(Ee, {
643
+ A === T.terms ? /* @__PURE__ */ C(Te, {
627
644
  value: j,
628
- onValueChange: St,
629
- isSubmitting: $,
630
- showAllErrors: Cr,
645
+ onValueChange: Ct,
646
+ isSubmitting: Q,
647
+ showAllErrors: Dr,
631
648
  labels: O.businessDetails,
632
- bankName: vr,
633
- termsHref: ht,
634
- privacyHref: gt,
635
- electronicCommunicationHref: _t,
636
- patriotActHref: vt
649
+ bankName: Sr,
650
+ termsHref: gt,
651
+ privacyHref: _t,
652
+ electronicCommunicationHref: vt,
653
+ patriotActHref: yt
637
654
  }) : null
638
655
  ]
639
656
  })
640
657
  }),
641
- E ? /* @__PURE__ */ S(ot, { callback: lt }) : null,
642
- /* @__PURE__ */ S(fe, {
643
- open: en,
644
- onConfirm: gr,
645
- onCancel: () => tn(!1),
646
- isDeleting: ln.isPending,
658
+ E ? /* @__PURE__ */ C(ot, { callback: ut }) : null,
659
+ /* @__PURE__ */ C(de, {
660
+ open: rn,
661
+ onConfirm: br,
662
+ onCancel: () => an(!1),
663
+ isDeleting: fn.isPending,
647
664
  labels: {
648
665
  descriptionEmphasis: O.saveAndClose,
649
666
  ...O.deleteApplicationDialog
650
667
  },
651
668
  testIds: {
652
- root: m.deleteDialog,
653
- confirm: m.deleteDialogConfirm,
654
- cancel: m.deleteDialogCancel
669
+ root: h.deleteDialog,
670
+ confirm: h.deleteDialogConfirm,
671
+ cancel: h.deleteDialogCancel
655
672
  }
656
673
  }),
657
- /* @__PURE__ */ S(d, {})
674
+ /* @__PURE__ */ C(d, {})
658
675
  ] });
659
676
  }
660
677
  function ct({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, uiFramework: o, errorFallback: s, onError: c, analytics: l, disclosuresAcceptance: u, providerLabels: d, ...ee }) {
661
- return /* @__PURE__ */ S(te, {
678
+ return /* @__PURE__ */ C(p, {
662
679
  baseUrl: e,
663
680
  widgetToken: t,
664
681
  organizationId: n,
@@ -671,55 +688,55 @@ function ct({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, ga
671
688
  analytics: l,
672
689
  disclosuresAcceptance: u,
673
690
  providerLabels: d,
674
- widgetName: Fe,
675
- children: /* @__PURE__ */ S(E, { ...ee })
691
+ widgetName: Pe,
692
+ children: /* @__PURE__ */ C(lt, { ...ee })
676
693
  });
677
694
  }
678
- function E(e) {
679
- let { initResponse: t } = re(), { client: n } = i(), r = t?.userId ?? null, [a, o] = x(r), [s, c] = x(0);
695
+ function lt(e) {
696
+ let { initResponse: t } = ne(), { client: n } = i(), r = t?.userId ?? null, [a, o] = S(r), [s, c] = S(0);
680
697
  r !== a && (o(r), a !== null && r !== null && c((e) => e + 1));
681
- let [l, u] = x(n);
682
- return n !== l && (u(n), c((e) => e + 1)), /* @__PURE__ */ S(lt, { ...e }, s);
698
+ let [l, u] = S(n);
699
+ return n !== l && (u(n), c((e) => e + 1)), /* @__PURE__ */ C(E, { ...e }, s);
683
700
  }
684
- function lt(e) {
685
- let { authEpoch: t } = i(), { ownApplicationIds: n } = Ge(), [r, a] = x(null), [o, s] = x(0), [c, l] = x(null), [u, d] = x(null), [ee, f] = x(null), te = _(() => {
701
+ function E(e) {
702
+ let { authEpoch: t } = i(), { ownApplicationIds: n } = We(), [r, a] = S(null), [o, s] = S(0), [c, l] = S(null), [u, d] = S(null), [ee, f] = S(null), p = v(() => {
686
703
  f(null);
687
- }, []), ne = _(() => {
704
+ }, []), te = v(() => {
688
705
  a(null), s((e) => e + 1);
689
- }, []), re = _(() => {
706
+ }, []), ne = v(() => {
690
707
  d(r?.applicationId ?? null), a(null), l(t);
691
- }, [t, r]), ie = _(() => {
708
+ }, [t, r]), re = v(() => {
692
709
  l(null), d(null), f(o + 1), s(o + 1);
693
710
  }, [o]);
694
- return r !== null && t !== r.authEpoch && n !== null && !n.includes(r.applicationId) && (a(null), s((e) => e + 1)), c !== null && t !== c && n !== null && n.some((e) => e !== u) && (l(null), d(null), f(o + 1), s(o + 1)), c === null ? /* @__PURE__ */ S(Re, { children: /* @__PURE__ */ S(dt, {
711
+ return r !== null && t !== r.authEpoch && n !== null && !n.includes(r.applicationId) && (a(null), s((e) => e + 1)), c !== null && t !== c && n !== null && n.some((e) => e !== u) && (l(null), d(null), f(o + 1), s(o + 1)), c === null ? /* @__PURE__ */ C(Le, { children: /* @__PURE__ */ C(dt, {
695
712
  ...e,
696
713
  onEditableDraftChange: a,
697
- onApplicationDeleted: re,
698
- onNoticeReplacedByForm: ne,
714
+ onApplicationDeleted: ne,
715
+ onNoticeReplacedByForm: te,
699
716
  focusFormOnMount: ee === o,
700
- onFocusFormOnMountDone: te
701
- }, o) }, o) : /* @__PURE__ */ S("div", {
717
+ onFocusFormOnMountDone: p
718
+ }, o) }, o) : /* @__PURE__ */ C("div", {
702
719
  className: Qe,
703
- children: /* @__PURE__ */ S(pe, {
720
+ children: /* @__PURE__ */ C(fe, {
704
721
  className: "ttw:max-w-2xl",
705
- onStartNewApplication: ie,
722
+ onStartNewApplication: re,
706
723
  labels: e.labels?.applicationDeleted,
707
724
  testIds: {
708
- root: m.applicationDeletedScreen,
709
- startNewApplication: m.applicationDeletedStartNew
725
+ root: h.applicationDeletedScreen,
726
+ startNewApplication: h.applicationDeletedStartNew
710
727
  }
711
728
  })
712
729
  });
713
730
  }
714
731
  var ut = { canRender: !1 };
715
732
  function dt(e) {
716
- let { authEpoch: t } = i(), { applicationId: n, clientSecret: r, isResolved: a } = Ge(), { application: o, isResolved: s, isUnavailable: c } = Ke(n, r), [l, u] = x(null);
717
- if (v(() => {
733
+ let { authEpoch: t } = i(), { applicationId: n, clientSecret: r, isResolved: a } = We(), { application: o, isResolved: s, isUnavailable: c } = Ge(n, r), [l, u] = S(null);
734
+ if (y(() => {
718
735
  l?.canRender !== !0 && a && s && (c || o !== null && o.status !== void 0 && o.status !== Xe ? u(ut) : u({
719
736
  canRender: !0,
720
737
  applicationId: o === null ? null : n,
721
738
  authEpoch: t,
722
- prefill: g(o)
739
+ prefill: _(o)
723
740
  }));
724
741
  }, [
725
742
  t,
@@ -730,20 +747,24 @@ function dt(e) {
730
747
  o,
731
748
  n
732
749
  ]), l === null || !l.canRender) return null;
733
- let { applicationId: d, authEpoch: ee, prefill: f } = l;
734
- return /* @__PURE__ */ S(st, {
750
+ let { applicationId: d, authEpoch: ee, prefill: f } = l, p = Ie(e.initialBusinessDetails);
751
+ return /* @__PURE__ */ C(st, {
735
752
  ...e,
736
753
  initialApplicationId: d,
737
754
  initialBoundAuthEpoch: ee,
755
+ initialWrittenSections: d === null ? void 0 : {
756
+ business: Object.entries(p ?? {}).every(([e, t]) => t === void 0 || f?.businessDetails !== void 0 && e in f.businessDetails),
757
+ owners: f?.additionalOwners !== void 0 || !e.initialAdditionalOwners?.length
758
+ },
738
759
  initialBusinessDetails: {
739
- ...Le(e.initialBusinessDetails),
760
+ ...p,
740
761
  ...f?.businessDetails
741
762
  },
742
763
  initialPersonalDetails: {
743
- ...Le(e.initialPersonalDetails),
764
+ ...Ie(e.initialPersonalDetails),
744
765
  ...f?.personalDetails
745
766
  },
746
- initialAdditionalOwners: f?.additionalOwners ?? e.initialAdditionalOwners?.map(Ie)
767
+ initialAdditionalOwners: f?.additionalOwners ?? e.initialAdditionalOwners?.map(Fe)
747
768
  });
748
769
  }
749
770
  export { ct as BankAccountOnboardingWidget, ct as default, c as OnboardingSuppressionReason };
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.11.32", n = "a9d57b99d1e871ddd534b30f87ab4b6a1ebd3a9d", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.11.34", n = "11b9ed7f3ac2e8246ccea18a7e52c1f9b5af70ec", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.11.32",
3
+ "version": "0.11.34",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [