@tesouro/embedded-components-react 0.5.215 → 0.5.217

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