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