@tesouro/embedded-components-react 0.5.36 → 0.5.38

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