@tesouro/embedded-components-react 0.5.32 → 0.5.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +17 -1
  3. package/dist/index.js +2 -2
  4. package/dist/lib/BankAccountOnboardingWidget.d.ts +17 -1
  5. package/dist/lib/BankAccountOnboardingWidget.js +1 -1
  6. package/dist/lib/SettingsWidget.js +1 -2
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index.js +3 -1
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index10.js +30 -0
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index11.js +48 -0
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index9.js +6 -0
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +1 -1
  12. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js +1 -0
  13. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js +9 -2
  14. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +96 -5
  15. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +5 -28
  16. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +26 -320
  17. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index19.js +7 -0
  18. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index20.js +387 -0
  19. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index.js +3 -2
  20. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +2 -2
  21. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index7.js +3 -0
  22. package/dist/libs/tesouro-embedded-components-react/settings-widget/help/feature/dist/index2.js +5 -0
  23. package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/feature/dist/index3.js +7 -7
  24. package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/ui/contract/dist/index2.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/ui/contract/dist/index3.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/contract/dist/index4.js +4 -0
  27. package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/ui/contract/dist/index5.js +1 -1
  28. package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/ui/shadcn/dist/index2.js +1 -1
  29. package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/ui/shadcn/dist/index3.js +4 -4
  30. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +27 -27
  31. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +162 -154
  32. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useOrganizationOnboardingSuppression.js +11 -11
  33. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  34. package/package.json +1 -1
  35. package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index2.js +0 -4
  36. package/dist/libs/tesouro-embedded-components-react/help-widget/ui/contract/dist/index4.js +0 -4
  37. /package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/feature/dist/index.js +0 -0
  38. /package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/ui/contract/dist/index.js +0 -0
  39. /package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/ui/shadcn/dist/index.js +0 -0
  40. /package/dist/libs/tesouro-embedded-components-react/{help-widget → settings-widget/help}/ui/shadcn/dist/index4.js +0 -0
@@ -1,324 +1,30 @@
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 { useAcceptWidgetDisclosures as r } from "../../../shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js";
7
- import { useDisclosuresQuery as i } from "../../../shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js";
8
- import { OnboardingSuppressionReason as a } from "../../../shared/data-access/dist/lib/onboardingSuppressionReason.js";
9
- import { useOrganizationOnboardingSuppression as o } from "../../../shared/data-access/dist/lib/useOrganizationOnboardingSuppression.js";
10
- import "../../../shared/data-access/dist/index.js";
11
- import { OnboardingShell as s } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
12
- import "../../../shared/ui/dist/index.js";
13
- import { useAnalyticsTrack as c } from "../../../shared/feature/dist/lib/analytics/hooks.js";
14
- import { WidgetProvider as l } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
15
- import { getStateOptions as u } from "../../../shared/util/dist/lib/usStates.js";
16
- import { extractApiErrorMessage as ee } from "../../../shared/util/dist/lib/apiErrors.js";
17
- import { useRefetchWidget as d, useWidgetConfig as f } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
18
- import { getNaicsOptions as p } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
19
- import "../../../shared/feature/dist/index.js";
20
- import { bankAccountOnboardingTestIds as m } from "./index9.js";
21
- import { ADDITIONAL_OWNERS_LABELS_EN as te } from "../../ui/dist/index4.js";
22
- import { interpolateBankName as h } from "../../ui/dist/index6.js";
23
- import { ResultStep as ne } from "../../ui/dist/index11.js";
1
+ import { RESULT_LABELS_EN as e } from "../../ui/dist/index12.js";
24
2
  import "../../ui/dist/index.js";
25
- import { BusinessDetailsStep as re } from "./index10.js";
26
- import { PersonalDetailsStep as ie } from "./index12.js";
27
- import { AdditionalOwnersStep as ae } from "./index14.js";
28
- import { buildCreateApplicationBody as oe, buildUpdateApplicationBody as se } from "./index15.js";
29
- import { OnboardingAnalyticsEvent as g, WIDGET_NAME as _ } from "./index16.js";
30
- import { DEFAULT_LABELS as v } from "./index17.js";
31
- import { ApplicationClientSecretProvider as y, useApplicationClientSecret as ce } from "../../data-access/dist/index2.js";
32
- import { useCreateApplication as le } from "../../data-access/dist/index4.js";
33
- import { useUpdateApplication as ue } from "../../data-access/dist/index6.js";
34
- import { useSubmitApplication as de } from "../../data-access/dist/index7.js";
35
- import { usePollApplicationCompletion as fe } from "../../data-access/dist/index8.js";
36
- import "../../data-access/dist/index.js";
37
- import { useCallback as b, useEffect as x, useMemo as S, useRef as pe, useState as C } from "react";
38
- import { Fragment as me, jsx as w, jsxs as he } from "react/jsx-runtime";
39
3
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js
40
- var ge = {
41
- companyLegalName: "",
42
- companyDbaName: "",
43
- businessAddress: "",
44
- city: "",
45
- state: "",
46
- zipCode: "",
47
- companyPhoneNumber: "",
48
- companyStructure: "",
49
- website: "",
50
- taxId: "",
51
- naicsCode: "",
52
- isAuthorized: null,
53
- isCheckboxChecked: !1
54
- }, _e = {
55
- firstName: "",
56
- lastName: "",
57
- dateOfBirth: void 0,
58
- ssn: "",
59
- homeAddress: "",
60
- city: "",
61
- state: "",
62
- zipCode: "",
63
- mobilePhoneNumber: "",
64
- workEmail: "",
65
- ownsOver25Percent: null,
66
- ownershipPercentage: null
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
+ back: "Back",
16
+ cancel: "Cancel",
17
+ next: "Next",
18
+ submit: "Submit application",
19
+ businessReviewTitle: "Review your business details",
20
+ businessReviewSubtitle: "Take a moment to make sure your business information is correct.",
21
+ personalReviewTitle: "Review your personal details",
22
+ personalReviewSubtitle: "Take a moment to make sure your personal information is correct.",
23
+ modalTitle: "Bank account onboarding",
24
+ submitFailedError: "Unable to submit application. Please try again.",
25
+ genericRetryError: "Please try again.",
26
+ fallbackBankName: "Member Bank",
27
+ shellFdicDisclaimer: "Products and services are offered by {bankName}, N.A., Member FDIC."
67
28
  };
68
- function ve(e, t) {
69
- if (e === 0) return {
70
- title: t.businessReviewTitle,
71
- subtitle: t.businessReviewSubtitle
72
- };
73
- if (e === 1) return {
74
- title: t.personalReviewTitle,
75
- subtitle: t.personalReviewSubtitle
76
- };
77
- let n = {
78
- ...te,
79
- ...t.additionalOwners
80
- };
81
- return {
82
- title: n.heading,
83
- subtitle: n.subheading
84
- };
85
- }
86
- function ye({ onEmbeddedOnboardingCompletedSuccessfully: l, onNavigateToDashboard: te, labels: _, initialBusinessDetails: y, initialPersonalDetails: ye, initialAdditionalOwners: T, bankLogoSrc: E, disclosureLinks: be, open: D, defaultOpen: O, onOpenChange: k, isFullScreenInline: A = !1 }) {
87
- let j = c();
88
- x(() => {
89
- j(g.Mounted);
90
- }, [j]);
91
- let M = {
92
- ...v,
93
- ..._,
94
- stepIndicator: {
95
- ...v.stepIndicator,
96
- ..._?.stepIndicator
97
- },
98
- businessDetails: _?.businessDetails ?? {},
99
- personalDetails: _?.personalDetails ?? {},
100
- additionalOwners: _?.additionalOwners ?? {},
101
- result: {
102
- ...v.result,
103
- ..._?.result
104
- }
105
- }, N = f().initResponse, { termsHref: xe, privacyHref: Se, electronicCommunicationHref: Ce, patriotActHref: we } = be ?? {}, P = D === void 0, [Te, Ee] = C(() => O ?? !1), F = P ? Te : D, De = O ?? !1, I = b((e) => {
106
- P && Ee(e), k?.(e);
107
- }, [k, P]), Oe = b(() => {
108
- l();
109
- }, [l]), ke = d(), [L, R] = C(0), [Ae, je] = C(() => ({
110
- ...ge,
111
- ...y
112
- })), [z, Me] = C(() => ({
113
- ..._e,
114
- ...ye
115
- })), [Ne, Pe] = C(() => T ?? []), [B, Fe] = C(null), [V, Ie] = C(null), [H, Le] = C(null), [U, Re] = C(null), [ze, W] = C(null), [G, Be] = C(!1), [Ve, K] = C(null), He = le(), q = ue(), Ue = de(), We = fe(), { setClientSecret: Ge } = ce(), { data: Ke, refetch: qe } = i(), { mutateAsync: Je } = r(), J = o(), Y = pe(null);
116
- x(() => () => Y.current?.abort(), []);
117
- let Ye = S(() => p(M.businessDetails.naicsTitles), [M.businessDetails.naicsTitles]), Xe = S(() => u(M.businessDetails.stateTitles), [M.businessDetails.stateTitles]), Ze = S(() => u(M.personalDetails.stateTitles), [M.personalDetails.stateTitles]), Qe = S(() => u(M.additionalOwners.stateTitles), [M.additionalOwners.stateTitles]), X = G || Ve !== null, $e = N?.status === "ACTIVE" || N?.status === "INACTIVE", et = N?.status === "INVITED", Z = !!N && !X && ($e || et || J.isSuppressed), Q = Z ? $e ? a.UserAlreadyOnboarded : et ? a.UserInvitedToOrganization : J.reason : null;
118
- if (x(() => {
119
- !Z || !Q || (j(g.Suppressed, { reason: Q }), console.info(`[onboarding] not shown: ${Q}`));
120
- }, [
121
- Z,
122
- Q,
123
- j
124
- ]), !N || !X && (Z || !J.isResolved)) return null;
125
- let tt = B?.companyStructure === "SOLE_PROPRIETORSHIP", nt = [
126
- M.stepIndicator.business,
127
- M.stepIndicator.personal,
128
- M.stepIndicator.ownership
129
- ], rt = L === 0 ? B : L === 1 ? V : L === 2 ? H : null, $ = He.isPending || q.isPending || Ue.isPending || G, it = () => {
130
- W(null), R((e) => e === 0 ? 0 : e - 1);
131
- }, at = () => {
132
- I(!1);
133
- }, ot = async (e) => {
134
- Be(!0), I(!0);
135
- let t = new AbortController();
136
- Y.current = t;
137
- let n = !1;
138
- try {
139
- let r = await Ue.mutateAsync({ path: { id: e } });
140
- if (t.signal.aborted) return;
141
- if (!r.id) throw Error(M.submitFailedError);
142
- if (n = !0, (await We(e, { signal: t.signal })).status === "complete") {
143
- let e = Ke;
144
- if (e === void 0 && (e = (await qe()).data), t.signal.aborted) return;
145
- if (e !== void 0) try {
146
- await Je({ displayedVersion: e.version ?? null });
147
- } catch {}
148
- if (t.signal.aborted) return;
149
- K("success"), ke(), Oe();
150
- } else K("pending");
151
- } catch (e) {
152
- if (e instanceof DOMException && e.name === "AbortError") return;
153
- if (!n) throw e;
154
- K("pending");
155
- } finally {
156
- Y.current = null, Be(!1);
157
- }
158
- }, st = async () => {
159
- W(null);
160
- try {
161
- if (L === 0) {
162
- if (!B) return;
163
- let e = U;
164
- if (!e) {
165
- let t = await He.mutateAsync({ body: oe(B) });
166
- e = t.id, Re(e), t.clientSecret && Ge(t.clientSecret);
167
- }
168
- R(1);
169
- } else if (L === 1) {
170
- if (!V || !B || !U) return;
171
- await q.mutateAsync({
172
- path: { id: U },
173
- body: se({
174
- businessDetails: B,
175
- applicant: V
176
- })
177
- }), R(2);
178
- } else if (L === 2) {
179
- if (!H || !U) return;
180
- await q.mutateAsync({
181
- path: { id: U },
182
- body: se({ businessOwners: H })
183
- }), await ot(U);
184
- }
185
- } catch (e) {
186
- let t = ee(e) ?? (e instanceof Error ? e.message : void 0) ?? M.genericRetryError;
187
- W(t);
188
- }
189
- }, ct = ve(Math.min(L, 2), M), lt = N.bankName?.trim() || M.fallbackBankName, ut = h(M.shellFdicDisclaimer, lt);
190
- if (X) {
191
- let r = B?.companyLegalName ?? "", i = N.bankName?.trim() || M.fallbackBankName, a = Ve ?? "pending", o = a === "success", s = {
192
- ...v.result,
193
- ...M.result
194
- }, c = /* @__PURE__ */ w(ne, {
195
- testIds: {
196
- processing: m.resultProcessing,
197
- dashboardButton: m.resultDashboardButton
198
- },
199
- status: a,
200
- isLoading: G,
201
- loadingMessage: s.loadingMessage,
202
- headingLine1: o ? s.successHeadingLine1 : s.pendingHeadingLine1,
203
- headingLine2: `${r}!`,
204
- body: o ? s.successBody : s.pendingBody,
205
- followUpEmail: V?.workEmail ?? "",
206
- emailBoxLead: s.pendingEmailBoxLead,
207
- navigateToDashboardLabel: s.navigateToDashboard,
208
- bankLogoSrc: E,
209
- bankLogoAlt: h(s.bankLogoAlt, i),
210
- fdicDisclaimer: h(s.fdicDisclaimer, i),
211
- onNavigateToDashboard: te
212
- });
213
- return A ? /* @__PURE__ */ w("div", {
214
- 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",
215
- children: c
216
- }) : /* @__PURE__ */ w(e, {
217
- open: F,
218
- onOpenChange: I,
219
- children: /* @__PURE__ */ he(t, {
220
- 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",
221
- children: [/* @__PURE__ */ w(n, {
222
- className: "ttw:sr-only",
223
- children: M.modalTitle
224
- }), c]
225
- })
226
- });
227
- }
228
- let dt = L === 2 ? M.submit : M.next, ft = rt === null || $;
229
- return /* @__PURE__ */ w(me, { children: /* @__PURE__ */ he(s, {
230
- open: F,
231
- defaultOpen: De,
232
- onOpenChange: I,
233
- isFullScreenInline: A,
234
- title: ct.title,
235
- subtitle: ct.subtitle,
236
- stepLabels: nt,
237
- activeStep: L,
238
- disclaimerText: ut,
239
- onBack: L === 0 ? at : it,
240
- onCancel: L > 0 ? at : void 0,
241
- onNext: st,
242
- showDismissButton: !1,
243
- isNextDisabled: ft,
244
- isNextLoading: $,
245
- nextLabel: dt,
246
- nextIcon: null,
247
- errorMessage: ze,
248
- labels: {
249
- backButton: L === 0 ? M.cancel : M.back,
250
- cancelButton: M.cancel
251
- },
252
- testIds: {
253
- root: m.shell,
254
- dismiss: m.shellDismiss,
255
- back: m.shellBack,
256
- cancel: m.shellCancel,
257
- next: m.shellNext,
258
- scrollRegion: {
259
- root: m.shellScrollRegion,
260
- fade: m.shellScrollFade,
261
- hint: m.shellScrollHint
262
- }
263
- },
264
- children: [
265
- L === 0 ? /* @__PURE__ */ w(re, {
266
- value: Ae,
267
- onValueChange: je,
268
- onSnapshotChange: Fe,
269
- naicsOptions: Ye,
270
- stateOptions: Xe,
271
- isSubmitting: $,
272
- labels: M.businessDetails,
273
- bankName: lt,
274
- termsHref: xe,
275
- privacyHref: Se,
276
- electronicCommunicationHref: Ce,
277
- patriotActHref: we
278
- }, "business") : null,
279
- L === 1 ? /* @__PURE__ */ w(ie, {
280
- value: z,
281
- onValueChange: Me,
282
- onSnapshotChange: Ie,
283
- stateOptions: Ze,
284
- isSubmitting: $,
285
- labels: M.personalDetails
286
- }, "personal") : null,
287
- L === 2 ? /* @__PURE__ */ w(ae, {
288
- owners: Ne,
289
- onOwnersChange: Pe,
290
- primaryOwnerName: `${z.firstName} ${z.lastName}`.trim(),
291
- primaryOwnerPercentage: tt ? 100 : V?.ownsOver25Percent === !0 ? V.ownershipPercentage ?? 0 : 0,
292
- stateOptions: Qe,
293
- onSnapshotChange: Le,
294
- isSubmitting: $,
295
- labels: M.additionalOwners
296
- }) : null
297
- ]
298
- }) });
299
- }
300
- function T({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: u, analytics: ee, disclosuresAcceptance: d, providerLabels: f, ...p }) {
301
- return /* @__PURE__ */ w(l, {
302
- baseUrl: e,
303
- widgetToken: t,
304
- organizationId: n,
305
- configClient: r,
306
- gatewayRouting: i,
307
- linkComponent: a,
308
- implementation: o,
309
- uiFramework: s,
310
- errorFallback: c,
311
- onError: u,
312
- analytics: ee,
313
- disclosuresAcceptance: d,
314
- providerLabels: f,
315
- widgetName: _,
316
- children: /* @__PURE__ */ w(E, { ...p })
317
- });
318
- }
319
- function E(e) {
320
- let { initResponse: t } = f(), n = t?.userId ?? null, [r, i] = C(n), [a, o] = C(0);
321
- return n !== r && (i(n), r !== null && n !== null && o((e) => e + 1)), /* @__PURE__ */ w(y, { children: /* @__PURE__ */ w(ye, { ...e }, a) }, a);
322
- }
323
29
  //#endregion
324
- export { T as BankAccountOnboardingWidget, T as default };
30
+ export { t as DEFAULT_LABELS };
@@ -0,0 +1,7 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index19.js
2
+ function e(e) {
3
+ let { id: t, ...n } = e;
4
+ return n;
5
+ }
6
+ //#endregion
7
+ export { e as withoutResumeOnlyOwnerFields };