@tesouro/embedded-components-react 0.5.171 → 0.5.173

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 (31) hide show
  1. package/dist/index.d.ts +18 -0
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +18 -0
  4. package/dist/lib/BankAccountOnboardingWidget.js +1 -1
  5. package/dist/lib/WidgetSuite.d.ts +18 -0
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index10.js +82 -184
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index11.js +189 -29
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +34 -127
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index13.js +83 -175
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js +173 -84
  12. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js +62 -92
  13. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +86 -115
  14. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +5 -97
  15. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +105 -87
  16. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index19.js +99 -5
  17. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index20.js +94 -28
  18. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index21.js +182 -16
  19. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +5 -423
  20. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index23.js +34 -0
  21. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index24.js +19 -0
  22. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index25.js +580 -0
  23. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +3 -1
  24. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index25.js +10 -0
  25. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index26.js +59 -0
  26. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +62 -49
  28. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/labels.js +1 -0
  29. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index12.js +3 -2
  30. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js +9 -8
  31. package/package.json +1 -1
@@ -1,19 +1,185 @@
1
+ import { isIdentifierEnteredOrStored as e, usableStoredTaxIdLast4 as t } from "./index7.js";
2
+ import { buildAdditionalOwnerSchema as n, buildBusinessDetailsPanelFieldsSchema as r, buildPersonalDetailsSchema as i } from "./index10.js";
3
+ import { ADDITIONAL_OWNERS_LABELS_EN as a } from "../../ui/dist/index5.js";
4
+ import { BUSINESS_DETAILS_LABELS_EN as o } from "../../ui/dist/index7.js";
5
+ import { PERSONAL_DETAILS_LABELS_EN as s } from "../../ui/dist/index8.js";
6
+ import "../../ui/dist/index.js";
7
+ import { EMPTY_ADDITIONAL_OWNER as c } from "./index16.js";
8
+ import { formatBirthDate as l, stripPhone as u } from "./index19.js";
1
9
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index21.js
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);
10
+ var d = r(o).shape, f = i(s).shape, p = n(a).shape, m = (e, t) => e.safeParse(t).success;
11
+ function h(e) {
12
+ return Object.keys(e).length === 0 ? {} : {
13
+ ...e,
14
+ countryCode: "USA"
15
+ };
16
+ }
17
+ var g = (t) => e(t, void 0);
18
+ function _(e) {
19
+ return !(e.taxIdOnFileLast4 && !t(e)) || g(e.taxId);
20
+ }
21
+ function v(e) {
22
+ return _(e) ? e.companyStructure : e.taxIdOnFileStructure;
23
+ }
24
+ var y = (e) => e.trim();
25
+ function b(e, t) {
26
+ return {
27
+ companyLegalName: m(d.companyLegalName, e.companyLegalName),
28
+ companyDbaName: y(e.companyDbaName) !== y(t.companyDbaName),
29
+ website: m(d.website, e.website) && y(e.website) !== y(t.website),
30
+ businessAddress: m(d.businessAddress, e.businessAddress),
31
+ city: m(d.city, e.city),
32
+ state: m(d.state, e.state),
33
+ zipCode: m(d.zipCode, e.zipCode),
34
+ companyPhoneNumber: m(d.companyPhoneNumber, e.companyPhoneNumber),
35
+ companyStructure: _(e) && m(d.companyStructure, e.companyStructure),
36
+ taxId: g(e.taxId) && e.companyStructure !== "",
37
+ naicsCode: m(d.naicsCode, e.naicsCode),
38
+ isAuthorized: e.isAuthorized !== null,
39
+ isCheckboxChecked: e.isCheckboxChecked
40
+ };
41
+ }
42
+ function x(e, t) {
43
+ let n = h({
44
+ ...t.businessAddress && { address1: e.businessAddress },
45
+ ...t.city && { city: e.city },
46
+ ...t.state && { state: e.state },
47
+ ...t.zipCode && { postalCode: e.zipCode }
48
+ });
49
+ return {
50
+ ...t.companyLegalName && { legalName: e.companyLegalName },
51
+ ...t.companyDbaName && { dbaName: y(e.companyDbaName) || null },
52
+ ...Object.keys(n).length ? { address: n } : {},
53
+ ...t.companyPhoneNumber && { phoneNumber: u(e.companyPhoneNumber) },
54
+ ...t.companyStructure && { businessStructureType: e.companyStructure },
55
+ ...t.website && { website: y(e.website) || null },
56
+ ...t.taxId && { taxId: {
57
+ type: e.companyStructure === "SOLE_PROPRIETORSHIP" ? "SSN" : "EIN",
58
+ value: e.taxId
59
+ } },
60
+ ...t.naicsCode && { northAmericanIndustryClassificationSystemCode: e.naicsCode }
61
+ };
62
+ }
63
+ function S(e, t) {
64
+ return {
65
+ ...t.isAuthorized && { isLegallyAuthorized: e.isAuthorized },
66
+ ...t.isCheckboxChecked && { hasAcceptedDisclosures: !0 }
67
+ };
68
+ }
69
+ function C(e, t) {
70
+ if (t === "SOLE_PROPRIETORSHIP") return 1;
71
+ if (e.ownsOver25Percent === !1) return 0;
72
+ if (e.ownsOver25Percent === !0 && e.ownershipPercentage !== null && e.ownershipPercentage >= 25 && e.ownershipPercentage <= 100) return e.ownershipPercentage / 100;
73
+ }
74
+ function w(e, t) {
75
+ let n = C(e, t) !== void 0;
76
+ return {
77
+ firstName: m(f.firstName, e.firstName),
78
+ lastName: m(f.lastName, e.lastName),
79
+ dateOfBirth: m(f.dateOfBirth, e.dateOfBirth),
80
+ ssn: g(e.ssn),
81
+ homeAddress: m(f.homeAddress, e.homeAddress),
82
+ city: m(f.city, e.city),
83
+ state: m(f.state, e.state),
84
+ zipCode: m(f.zipCode, e.zipCode),
85
+ mobilePhoneNumber: m(f.mobilePhoneNumber, e.mobilePhoneNumber),
86
+ workEmail: m(f.workEmail, e.workEmail),
87
+ ownsOver25Percent: n,
88
+ ownershipPercentage: n
89
+ };
90
+ }
91
+ function T(e, t, n) {
92
+ let r = h({
93
+ ...t.homeAddress && { address1: e.homeAddress },
94
+ ...t.city && { city: e.city },
95
+ ...t.state && { state: e.state },
96
+ ...t.zipCode && { postalCode: e.zipCode }
97
+ });
98
+ return {
99
+ ...t.firstName && { firstName: e.firstName },
100
+ ...t.lastName && { lastName: e.lastName },
101
+ ...t.dateOfBirth && e.dateOfBirth && { birthDate: l(e.dateOfBirth) },
102
+ ...t.ssn && { personalIdentificationNumber: {
103
+ type: "SSN",
104
+ value: e.ssn
105
+ } },
106
+ ...Object.keys(r).length ? { homeAddress: r } : {},
107
+ ...t.mobilePhoneNumber && { mobilePhoneNumber: u(e.mobilePhoneNumber) },
108
+ ...t.workEmail && { workEmailAddress: e.workEmail },
109
+ ...t.ownershipPercentage && { ownershipPercentage: C(e, n) }
110
+ };
111
+ }
112
+ function E(e) {
113
+ return {
114
+ firstName: m(p.firstName, e.firstName),
115
+ lastName: m(p.lastName, e.lastName),
116
+ dateOfBirth: m(p.dateOfBirth, e.dateOfBirth),
117
+ ssn: g(e.ssn),
118
+ homeAddress: m(p.homeAddress, e.homeAddress),
119
+ city: m(p.city, e.city),
120
+ state: m(p.state, e.state),
121
+ zipCode: m(p.zipCode, e.zipCode),
122
+ mobilePhoneNumber: m(p.mobilePhoneNumber, e.mobilePhoneNumber),
123
+ ownershipPercentage: m(p.ownershipPercentage, e.ownershipPercentage)
124
+ };
125
+ }
126
+ var D = (e) => e.map(k).filter((e) => "id" in e || Object.keys(e).length > 0), O = (e) => !!e.id || Object.values(E(e)).some(Boolean);
127
+ function k(e) {
128
+ let t = E(e), n = h({
129
+ ...t.homeAddress && { address1: e.homeAddress },
130
+ ...t.city && { city: e.city },
131
+ ...t.state && { state: e.state },
132
+ ...t.zipCode && { postalCode: e.zipCode }
133
+ });
134
+ return {
135
+ ...e.id ? { id: e.id } : {},
136
+ ...t.firstName && { firstName: e.firstName },
137
+ ...t.lastName && { lastName: e.lastName },
138
+ ...t.dateOfBirth && e.dateOfBirth && { birthDate: l(e.dateOfBirth) },
139
+ ...t.ssn && { personalIdentificationNumber: {
140
+ type: "SSN",
141
+ value: e.ssn
142
+ } },
143
+ ...Object.keys(n).length ? { homeAddress: n } : {},
144
+ ...t.mobilePhoneNumber && { mobilePhoneNumber: u(e.mobilePhoneNumber) },
145
+ ...t.ownershipPercentage && e.ownershipPercentage !== null && { ownershipPercentage: e.ownershipPercentage / 100 }
146
+ };
147
+ }
148
+ function A({ businessDetails: e, savedBusinessDetails: t, savedOwners: n, dirty: r, applicant: i, businessOwners: a }) {
149
+ let o = v(e) ?? "", s = o === "SOLE_PROPRIETORSHIP", c = b(e, t), l = r.business ? x(e, c) : {}, u = {
150
+ ...r.personal ? T(i, w(i, o), o) : {},
151
+ ...r.business ? S(e, c) : {}
152
+ }, d = s ? [] : D(a), f = d.length > 0 ? d : n.length > 0 ? null : void 0, p = {
153
+ ...Object.keys(l).length > 0 && { businessDetails: l },
154
+ ...Object.keys(u).length > 0 && { applicant: u },
155
+ ...(r.owners || r.business && s) && f !== void 0 && { businessOwners: f }
156
+ };
157
+ return Object.keys(p).length > 0 ? p : null;
158
+ }
159
+ var j = (e) => e, M = (e, t) => e === "" && !!t;
160
+ function N(e, t, n) {
161
+ let r = { ...e };
162
+ for (let e of Object.keys(n)) n[e] || (r[e] = t[e]);
163
+ return r;
164
+ }
165
+ function P({ current: e, saved: t, dirty: n, ownersWrite: r }) {
166
+ let i = v(e.business) ?? "", a = b(e.business, t.business);
167
+ return {
168
+ business: n.business ? N(e.business, t.business, {
169
+ ...a,
170
+ companyDbaName: !0,
171
+ website: m(d.website, e.business.website),
172
+ taxId: a.taxId || M(e.business.taxId, e.business.taxIdOnFileLast4)
173
+ }) : e.business,
174
+ personal: n.personal ? N(e.personal, t.personal, {
175
+ ...w(e.personal, i),
176
+ ssn: g(e.personal.ssn) || M(e.personal.ssn, e.personal.ssnOnFileLast4)
177
+ }) : e.personal,
178
+ owners: r === "cleared" ? [] : r === "list" ? e.owners.filter(O).map((e) => N(e, e.id && t.owners.find((t) => t.id === e.id) || c, {
179
+ ...E(e),
180
+ ssn: g(e.ssn) || M(e.ssn, e.ssnOnFileLast4)
181
+ })) : t.owners
182
+ };
17
183
  }
18
184
  //#endregion
19
- export { i as withoutResumeOnlyOwnerFields, r as withoutStoredIdentifierMarkers };
185
+ export { P as acceptDraftedValues, j as asCreateBody, A as buildDraftApplicationBody, D as draftOwners };
@@ -1,425 +1,7 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { Dialog as e, DialogContent as t, DialogTitle as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { useEmbedApi as r } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
- import { useAcceptWidgetDisclosures as i } from "../../../shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js";
8
- import { useDisclosuresQuery as a } from "../../../shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js";
9
- import { OnboardingSuppressionReason as o } from "../../../shared/data-access/dist/lib/onboardingSuppressionReason.js";
10
- import { useOrganizationOnboardingSuppression as s } from "../../../shared/data-access/dist/lib/useOrganizationOnboardingSuppression.js";
11
- import "../../../shared/data-access/dist/index.js";
12
- import { OnboardingShell as c } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
13
- import "../../../shared/ui/dist/index.js";
14
- import { useAnalyticsTrack as l } from "../../../shared/feature/dist/lib/analytics/hooks.js";
15
- import { WidgetProvider as u } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
16
- import { getStateOptions as d } from "../../../shared/util/dist/lib/usStates.js";
17
- import { extractApiErrorMessage as f } from "../../../shared/util/dist/lib/apiErrors.js";
18
- import { useRefetchWidget as p, useWidgetConfig as m } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
19
- import { getNaicsOptions as ee } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
20
- import "../../../shared/feature/dist/index.js";
21
- import { identifierLast4 as h } from "./index7.js";
22
- import { bankAccountOnboardingTestIds as g } from "./index11.js";
23
- import { ADDITIONAL_OWNERS_LABELS_EN as te } from "../../ui/dist/index5.js";
24
- import { interpolateBankName as _ } from "../../ui/dist/index7.js";
25
- import { ResultStep as ne } from "../../ui/dist/index12.js";
26
- import "../../ui/dist/index.js";
27
- import { BusinessDetailsStep as re } from "./index12.js";
28
- import { PersonalDetailsStep as ie } from "./index14.js";
29
- import { AdditionalOwnersStep as ae } from "./index16.js";
30
- import { buildCreateApplicationBody as oe, buildUpdateApplicationBody as v } from "./index17.js";
31
- import { buildOnboardingPrefill as y } from "./index18.js";
32
- import { OnboardingAnalyticsEvent as se, WIDGET_NAME as ce } from "./index19.js";
33
- import { DEFAULT_LABELS as b } from "./index20.js";
34
- import { withoutResumeOnlyOwnerFields as le, withoutStoredIdentifierMarkers as ue } from "./index21.js";
35
- import { ApplicationClientSecretProvider as de, useApplicationClientSecret as fe } from "../../data-access/dist/index3.js";
36
- import { useCreateApplication as pe } from "../../data-access/dist/index5.js";
37
- import { useUpdateApplication as me } from "../../data-access/dist/index6.js";
38
- import { useSubmitApplication as he } from "../../data-access/dist/index7.js";
39
- import { usePollApplicationCompletion as ge } from "../../data-access/dist/index8.js";
40
- import { useResumableBankAccountApplication as x } from "../../data-access/dist/index10.js";
41
- import { useStartedBankAccountApplication as _e } from "../../data-access/dist/index11.js";
42
- import "../../data-access/dist/index.js";
43
- import { useCallback as ve, useEffect as S, useMemo as C, useRef as ye, useState as w } from "react";
44
- import { Fragment as be, jsx as T, jsxs as xe } from "react/jsx-runtime";
45
1
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js
46
- var E = "DRAFT", Se = [], Ce = {
47
- companyLegalName: "",
48
- companyDbaName: "",
49
- businessAddress: "",
50
- city: "",
51
- state: "",
52
- zipCode: "",
53
- companyPhoneNumber: "",
54
- companyStructure: "",
55
- website: "",
56
- taxId: "",
57
- naicsCode: "",
58
- isAuthorized: null,
59
- isCheckboxChecked: !1
60
- }, we = {
61
- firstName: "",
62
- lastName: "",
63
- dateOfBirth: void 0,
64
- ssn: "",
65
- homeAddress: "",
66
- city: "",
67
- state: "",
68
- zipCode: "",
69
- mobilePhoneNumber: "",
70
- workEmail: "",
71
- ownsOver25Percent: null,
72
- ownershipPercentage: null
73
- };
74
- function Te(e, t) {
75
- if (e === 0) return {
76
- title: t.businessReviewTitle,
77
- subtitle: t.businessReviewSubtitle
78
- };
79
- if (e === 1) return {
80
- title: t.personalReviewTitle,
81
- subtitle: t.personalReviewSubtitle
82
- };
83
- let n = {
84
- ...te,
85
- ...t.additionalOwners
86
- };
87
- return {
88
- title: n.heading,
89
- subtitle: n.subheading
90
- };
91
- }
92
- function Ee({ onEmbeddedOnboardingCompletedSuccessfully: u, onNavigateToDashboard: te, labels: y, initialBusinessDetails: ce, initialPersonalDetails: ue, initialAdditionalOwners: de, initialApplicationId: x = null, initialBoundAuthEpoch: _e, onEditableDraftChange: E, bankLogoSrc: Ee, disclosureLinks: D, open: O, defaultOpen: k, onOpenChange: A, isFullScreenInline: j = !1 }) {
93
- let M = l(), { authEpoch: N } = r();
94
- S(() => {
95
- M(se.Mounted);
96
- }, [M]);
97
- let P = {
98
- ...b,
99
- ...y,
100
- stepIndicator: {
101
- ...b.stepIndicator,
102
- ...y?.stepIndicator
103
- },
104
- businessDetails: y?.businessDetails ?? {},
105
- personalDetails: y?.personalDetails ?? {},
106
- additionalOwners: y?.additionalOwners ?? {},
107
- result: {
108
- ...b.result,
109
- ...y?.result
110
- }
111
- }, F = m().initResponse, { termsHref: De, privacyHref: Oe, electronicCommunicationHref: ke, patriotActHref: Ae } = D ?? {}, I = O === void 0, [je, Me] = w(() => k ?? !1), Ne = I ? je : O, Pe = k ?? !1, L = ve((e) => {
112
- I && Me(e), A?.(e);
113
- }, [A, I]), Fe = ve(() => {
114
- u();
115
- }, [u]), Ie = p(), [R, z] = w(0), [Le, Re] = w(() => ({
116
- ...Ce,
117
- ...ce
118
- })), [B, ze] = w(() => ({
119
- ...we,
120
- ...ue
121
- })), [Be, V] = w(() => de ?? []), [H, Ve] = w(null), [U, He] = w(null), [W, Ue] = w(null), [G, We] = w(x), [Ge, Ke] = w(_e ?? N), [qe, K] = w(null), [q, Je] = w(!1), [Ye, J] = w(null), Xe = pe(), Y = me(), Ze = he(), Qe = ge(), { setClientSecret: $e } = fe(), { data: et, refetch: tt } = a(), { mutateAsync: nt } = i(), rt = s(), it = ye(null);
122
- S(() => () => it.current?.abort(), []);
123
- let at = C(() => ee(P.businessDetails.naicsTitles), [P.businessDetails.naicsTitles]), ot = C(() => d(P.businessDetails.stateTitles), [P.businessDetails.stateTitles]), st = C(() => d(P.personalDetails.stateTitles), [P.personalDetails.stateTitles]), ct = C(() => d(P.additionalOwners.stateTitles), [P.additionalOwners.stateTitles]), X = q || Ye !== null, lt = F?.status === "ACTIVE" || F?.status === "INACTIVE", ut = F?.status === "INVITED", Z = !!F && !X && (lt || ut || rt.isSuppressed), Q = Z ? lt ? o.UserAlreadyOnboarded : ut ? o.UserInvitedToOrganization : rt.reason : null;
124
- S(() => {
125
- Z && Q && (M(se.Suppressed, { reason: Q }), console.info(`[onboarding] not shown: ${Q}`));
126
- }, [
127
- Z,
128
- Q,
129
- M
130
- ]), S(() => {
131
- E?.(X || G === null ? null : {
132
- applicationId: G,
133
- authEpoch: Ge
134
- });
135
- }, [
136
- E,
137
- X,
138
- G,
139
- Ge
140
- ]);
141
- let dt = ye(N);
142
- if (dt.current = N, !F || !X && (Z || !rt.isResolved)) return null;
143
- let ft = H?.companyStructure === "SOLE_PROPRIETORSHIP", pt = [
144
- P.stepIndicator.business,
145
- P.stepIndicator.personal,
146
- P.stepIndicator.ownership
147
- ], mt = R === 0 ? H : R === 1 ? U : R === 2 ? W : null, $ = Xe.isPending || Y.isPending || Ze.isPending || q, ht = () => {
148
- K(null), z((e) => e === 0 ? 0 : e - 1);
149
- }, gt = () => {
150
- L(!1);
151
- }, _t = async (e) => {
152
- Je(!0), L(!0);
153
- let t = new AbortController();
154
- it.current = t;
155
- let n = !1;
156
- try {
157
- let r = await Ze.mutateAsync({ path: { id: e } });
158
- if (t.signal.aborted) return;
159
- if (!r.id) throw Error(P.submitFailedError);
160
- if (n = !0, (await Qe(e, { signal: t.signal })).status === "complete") {
161
- let e = et;
162
- if (e === void 0 && (e = (await tt()).data), t.signal.aborted) return;
163
- if (e !== void 0) try {
164
- await nt({ displayedVersion: e.version ?? null });
165
- } catch {}
166
- if (t.signal.aborted) return;
167
- J("success"), Ie(), Fe();
168
- } else J("pending");
169
- } catch (e) {
170
- if (e instanceof DOMException && e.name === "AbortError") return;
171
- if (!n) throw e;
172
- J("pending");
173
- } finally {
174
- it.current = null, Je(!1);
175
- }
176
- }, vt = () => {
177
- Re((e) => e.taxIdOnFileLast4 && e.taxId ? {
178
- ...e,
179
- taxId: "",
180
- taxIdOnFileLast4: h(e.taxId),
181
- taxIdOnFileStructure: e.companyStructure === "" ? void 0 : e.companyStructure
182
- } : e);
183
- }, yt = () => {
184
- ze((e) => e.ssnOnFileLast4 && e.ssn ? {
185
- ...e,
186
- ssn: "",
187
- ssnOnFileLast4: h(e.ssn)
188
- } : e);
189
- }, bt = () => {
190
- V((e) => e.map((e) => e.ssnOnFileLast4 && e.ssn ? {
191
- ...e,
192
- ssn: "",
193
- ssnOnFileLast4: h(e.ssn)
194
- } : e));
195
- }, xt = () => {
196
- V((e) => e.map(le));
197
- }, St = async () => {
198
- K(null);
199
- try {
200
- if (R === 0) {
201
- if (!H) return;
202
- let e = G;
203
- if (e) await Y.mutateAsync({
204
- path: { id: e },
205
- body: v({
206
- businessDetails: H,
207
- carryConsent: x !== null
208
- })
209
- });
210
- else {
211
- let t = dt.current, n = await Xe.mutateAsync({ body: oe(H) });
212
- e = n.id, We(e), Ke(t), n.clientSecret && $e(e, n.clientSecret);
213
- }
214
- vt(), ft && xt(), z(1);
215
- } else if (R === 1) {
216
- if (!U || !H || !G) return;
217
- await Y.mutateAsync({
218
- path: { id: G },
219
- body: v({
220
- businessDetails: H,
221
- applicant: U,
222
- carryConsent: x !== null
223
- })
224
- }), vt(), yt(), z(2);
225
- } else if (R === 2) {
226
- if (!W || !G) return;
227
- await Y.mutateAsync({
228
- path: { id: G },
229
- body: v({ businessOwners: W })
230
- }), bt(), await _t(G);
231
- }
232
- } catch (e) {
233
- let t = f(e) ?? (e instanceof Error ? e.message : void 0) ?? P.genericRetryError;
234
- K(t);
235
- }
236
- }, Ct = Te(Math.min(R, 2), P), wt = F.bankName?.trim() || P.fallbackBankName, Tt = _(P.shellFdicDisclaimer, wt);
237
- if (X) {
238
- let r = H?.companyLegalName ?? "", i = F.bankName?.trim() || P.fallbackBankName, a = Ye ?? "pending", o = a === "success", s = {
239
- ...b.result,
240
- ...P.result
241
- }, c = /* @__PURE__ */ T(ne, {
242
- testIds: {
243
- processing: g.resultProcessing,
244
- dashboardButton: g.resultDashboardButton
245
- },
246
- status: a,
247
- isLoading: q,
248
- loadingMessage: s.loadingMessage,
249
- headingLine1: o ? s.successHeadingLine1 : s.pendingHeadingLine1,
250
- headingLine2: `${r}!`,
251
- body: o ? s.successBody : s.pendingBody,
252
- followUpEmail: U?.workEmail ?? "",
253
- emailBoxLead: s.pendingEmailBoxLead,
254
- navigateToDashboardLabel: s.navigateToDashboard,
255
- bankLogoSrc: Ee,
256
- bankLogoAlt: _(s.bankLogoAlt, i),
257
- fdicDisclaimer: _(s.fdicDisclaimer, i),
258
- onNavigateToDashboard: te
259
- });
260
- return j ? /* @__PURE__ */ T("div", {
261
- 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",
262
- children: c
263
- }) : /* @__PURE__ */ T(e, {
264
- open: Ne,
265
- onOpenChange: L,
266
- children: /* @__PURE__ */ xe(t, {
267
- 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",
268
- children: [/* @__PURE__ */ T(n, {
269
- className: "ttw:sr-only",
270
- children: P.modalTitle
271
- }), c]
272
- })
273
- });
274
- }
275
- let Et = R === 2 ? P.submit : P.next, Dt = mt === null || $;
276
- return /* @__PURE__ */ T(be, { children: /* @__PURE__ */ xe(c, {
277
- open: Ne,
278
- defaultOpen: Pe,
279
- onOpenChange: L,
280
- isFullScreenInline: j,
281
- title: Ct.title,
282
- subtitle: Ct.subtitle,
283
- stepLabels: pt,
284
- activeStep: R,
285
- disclaimerText: Tt,
286
- onBack: R === 0 ? gt : ht,
287
- onCancel: R > 0 ? gt : void 0,
288
- onNext: St,
289
- showDismissButton: !1,
290
- isNextDisabled: Dt,
291
- isNextLoading: $,
292
- nextLabel: Et,
293
- nextIcon: null,
294
- errorMessage: qe,
295
- labels: {
296
- backButton: R === 0 ? P.cancel : P.back,
297
- cancelButton: P.cancel
298
- },
299
- testIds: {
300
- root: g.shell,
301
- dismiss: g.shellDismiss,
302
- back: g.shellBack,
303
- cancel: g.shellCancel,
304
- next: g.shellNext,
305
- scrollRegion: {
306
- root: g.shellScrollRegion,
307
- fade: g.shellScrollFade,
308
- hint: g.shellScrollHint
309
- }
310
- },
311
- children: [
312
- R === 0 ? /* @__PURE__ */ T(re, {
313
- value: Le,
314
- onValueChange: Re,
315
- onSnapshotChange: Ve,
316
- naicsOptions: at,
317
- stateOptions: ot,
318
- isSubmitting: $,
319
- labels: P.businessDetails,
320
- bankName: wt,
321
- termsHref: De,
322
- privacyHref: Oe,
323
- electronicCommunicationHref: ke,
324
- patriotActHref: Ae
325
- }, "business") : null,
326
- R === 1 ? /* @__PURE__ */ T(ie, {
327
- value: B,
328
- onValueChange: ze,
329
- onSnapshotChange: He,
330
- stateOptions: st,
331
- isSubmitting: $,
332
- labels: P.personalDetails
333
- }, "personal") : null,
334
- R === 2 ? /* @__PURE__ */ T(ae, {
335
- owners: ft ? Se : Be,
336
- onOwnersChange: V,
337
- primaryOwnerName: `${B.firstName} ${B.lastName}`.trim(),
338
- primaryOwnerPercentage: ft ? 100 : U?.ownsOver25Percent === !0 ? U.ownershipPercentage ?? 0 : 0,
339
- stateOptions: ct,
340
- onSnapshotChange: Ue,
341
- isSubmitting: $,
342
- labels: P.additionalOwners
343
- }) : null
344
- ]
345
- }) });
346
- }
347
- function D({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: d, disclosuresAcceptance: f, providerLabels: p, ...m }) {
348
- return /* @__PURE__ */ T(u, {
349
- baseUrl: e,
350
- widgetToken: t,
351
- organizationId: n,
352
- configClient: r,
353
- gatewayRouting: i,
354
- linkComponent: a,
355
- implementation: o,
356
- uiFramework: s,
357
- errorFallback: c,
358
- onError: l,
359
- analytics: d,
360
- disclosuresAcceptance: f,
361
- providerLabels: p,
362
- widgetName: ce,
363
- children: /* @__PURE__ */ T(O, { ...m })
364
- });
365
- }
366
- function O(e) {
367
- let { initResponse: t } = m(), { client: n } = r(), i = t?.userId ?? null, [a, o] = w(i), [s, c] = w(0);
368
- i !== a && (o(i), a !== null && i !== null && c((e) => e + 1));
369
- let [l, u] = w(n);
370
- return n !== l && (u(n), c((e) => e + 1)), /* @__PURE__ */ T(k, { ...e }, s);
371
- }
372
- function k(e) {
373
- let { authEpoch: t } = r(), { ownApplicationIds: n } = x(), [i, a] = w(null), [o, s] = w(0);
374
- return i !== null && t !== i.authEpoch && n !== null && !n.includes(i.applicationId) && (a(null), s((e) => e + 1)), /* @__PURE__ */ T(de, { children: /* @__PURE__ */ T(j, {
375
- ...e,
376
- onEditableDraftChange: a
377
- }, o) }, o);
378
- }
379
- var A = { canRender: !1 };
380
- function j(e) {
381
- let { authEpoch: t } = r(), { applicationId: n, clientSecret: i, isResolved: a } = x(), { application: o, isResolved: s, isUnavailable: c } = _e(n, i), [l, u] = w(null);
382
- if (S(() => {
383
- if (l?.canRender !== !0 && a && s) {
384
- if (c) {
385
- u(A);
386
- return;
387
- }
388
- if (o !== null && o.status !== void 0 && o.status !== E) {
389
- u(A);
390
- return;
391
- }
392
- u({
393
- canRender: !0,
394
- applicationId: o === null ? null : n,
395
- authEpoch: t,
396
- prefill: y(o)
397
- });
398
- }
399
- }, [
400
- t,
401
- l,
402
- a,
403
- s,
404
- c,
405
- o,
406
- n
407
- ]), l === null || !l.canRender) return null;
408
- let { applicationId: d, authEpoch: f, prefill: p } = l;
409
- return /* @__PURE__ */ T(Ee, {
410
- ...e,
411
- initialApplicationId: d,
412
- initialBoundAuthEpoch: f,
413
- initialBusinessDetails: {
414
- ...ue(e.initialBusinessDetails),
415
- ...p?.businessDetails
416
- },
417
- initialPersonalDetails: {
418
- ...ue(e.initialPersonalDetails),
419
- ...p?.personalDetails
420
- },
421
- initialAdditionalOwners: p?.additionalOwners ?? e.initialAdditionalOwners?.map(le)
422
- });
423
- }
2
+ var e = {
3
+ Mounted: "onboarding.mounted",
4
+ Suppressed: "onboarding.suppressed"
5
+ }, t = "onboarding";
424
6
  //#endregion
425
- export { D as BankAccountOnboardingWidget, D as default };
7
+ export { e as OnboardingAnalyticsEvent, t as WIDGET_NAME };
@@ -0,0 +1,34 @@
1
+ import { RESULT_LABELS_EN as e } from "../../ui/dist/index13.js";
2
+ import "../../ui/dist/index.js";
3
+ //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index23.js
4
+ var t = {
5
+ stepIndicator: {
6
+ business: "Business",
7
+ personal: "Personal",
8
+ ownership: "Ownership",
9
+ done: "Done"
10
+ },
11
+ businessDetails: {},
12
+ personalDetails: {},
13
+ additionalOwners: {},
14
+ result: e,
15
+ unsavedApplicationDialog: {},
16
+ back: "Back",
17
+ cancel: "Cancel",
18
+ next: "Next",
19
+ submit: "Submit application",
20
+ saveAndClose: "Save and close",
21
+ applicationSavedToast: "Application saved. You can continue later.",
22
+ businessReviewTitle: "Review your business details",
23
+ businessReviewSubtitle: "Take a moment to make sure your business information is correct.",
24
+ personalReviewTitle: "Review your personal details",
25
+ personalReviewSubtitle: "Take a moment to make sure your personal information is correct.",
26
+ modalTitle: "Bank account onboarding",
27
+ submitFailedError: "Unable to submit application. Please try again.",
28
+ genericRetryError: "Please try again.",
29
+ saveDraftNothingValidError: "Fix the highlighted fields before saving, or discard your changes.",
30
+ fallbackBankName: "Member Bank",
31
+ shellFdicDisclaimer: "Products and services are offered by {bankName}, N.A., Member FDIC."
32
+ };
33
+ //#endregion
34
+ export { t as DEFAULT_LABELS };
@@ -0,0 +1,19 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index24.js
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);
17
+ }
18
+ //#endregion
19
+ export { i as withoutResumeOnlyOwnerFields, r as withoutStoredIdentifierMarkers };