@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.
Files changed (30) 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/index16.js +1 -1
  30. package/package.json +1 -1
@@ -1,101 +1,9 @@
1
- import { keepsStoredIdentifier as e, usableStoredTaxIdLast4 as t } from "./index7.js";
2
1
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js
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
- };
2
+ function e(e) {
3
+ return JSON.stringify(t(e));
12
4
  }
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
- };
5
+ function t(e) {
6
+ return e instanceof Date ? Number.isNaN(e.getTime()) ? "Invalid Date" : e.toISOString() : Array.isArray(e) ? e.map(t) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => [e, t(n)])) : e;
99
7
  }
100
8
  //#endregion
101
- export { o as buildApplicantForCreate, c as buildApplicantForUpdate, a as buildBusinessDetails, l as buildBusinessOwners, u as buildCreateApplicationBody, d as buildUpdateApplicationBody };
9
+ export { e as valuesKey };
@@ -1,96 +1,114 @@
1
- import { parseCalendarDate as e } from "../../../shared/util/dist/lib/parseCalendarDate.js";
2
- import { formatPhoneNumberInput as t } from "./index2.js";
3
- import { sanitizeZipCodeInput as n } from "./index3.js";
4
- import { normalizeAdditionalOwnerDraft as r } from "./index15.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { bankAccountOnboardingTestIds as e } from "./index12.js";
6
+ import { buildAdditionalOwnerSchema as t } from "./index10.js";
7
+ import { ADDITIONAL_OWNERS_LABELS_EN as n } from "../../ui/dist/index5.js";
8
+ import { AdditionalOwnersForm as r } from "../../ui/dist/index6.js";
9
+ import "../../ui/dist/index.js";
10
+ import { valuesKey as i } from "./index17.js";
11
+ import { EMPTY_ADDITIONAL_OWNER as a, buildAdditionalOwnerEditDisplay as o, buildAdditionalOwnerEditFields as s, normalizeAdditionalOwnerDraft as c } from "./index16.js";
12
+ import { useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
13
+ import { jsx as p } from "react/jsx-runtime";
5
14
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js
6
- var i = .25, a = (e) => e ? t(e) : void 0, o = (e) => e ? n(e) : void 0;
7
- function s(e) {
8
- return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
9
- }
10
- function c(e) {
11
- if (e == null || e === "") return null;
12
- let t = typeof e == "string" ? Number(e) : e;
13
- return Number.isFinite(t) ? Math.round(t * 1e6) / 1e4 : null;
15
+ function m(e) {
16
+ return e.ownershipPercentage !== null && e.ownershipPercentage >= 25 ? e.ownershipPercentage : 0;
14
17
  }
15
- function l(e) {
16
- if (e == null || e === "") return null;
17
- let t = typeof e == "string" ? Number(e) : e;
18
- return Number.isFinite(t) ? t >= i : null;
18
+ function h(e) {
19
+ return `${m(e)}%`;
19
20
  }
20
- function u(e) {
21
+ function g(e) {
21
22
  return {
22
- line1: e?.address1 ?? void 0,
23
- city: e?.city ?? void 0,
24
- state: e?.state ?? void 0,
25
- zipCode: e?.postalCode ?? void 0
23
+ name: `${e.firstName} ${e.lastName}`.trim(),
24
+ shareDisplay: h(e)
26
25
  };
27
26
  }
28
- function d(e, t) {
29
- let n = u(e.address);
30
- return s({
31
- companyLegalName: e.legalName ?? void 0,
32
- companyDbaName: e.dbaName ?? "",
33
- businessAddress: n.line1,
34
- city: n.city,
35
- state: n.state,
36
- zipCode: o(n.zipCode),
37
- companyPhoneNumber: a(e.phoneNumber),
38
- companyStructure: e.businessStructureType ?? void 0,
39
- website: e.website ?? "",
40
- naicsCode: e.northAmericanIndustryClassificationSystemCode ?? void 0,
41
- isAuthorized: t?.isLegallyAuthorized ?? void 0,
42
- taxId: "",
43
- taxIdOnFileLast4: e.taxIdLast4 ?? void 0,
44
- taxIdOnFileStructure: e.businessStructureType ?? void 0,
45
- isCheckboxChecked: !1
46
- });
47
- }
48
- function f(t) {
49
- let n = u(t.homeAddress);
50
- return s({
51
- firstName: t.firstName ?? void 0,
52
- lastName: t.lastName ?? void 0,
53
- dateOfBirth: e(t.birthDate),
54
- homeAddress: n.line1,
55
- city: n.city,
56
- state: n.state,
57
- zipCode: o(n.zipCode),
58
- mobilePhoneNumber: a(t.mobilePhoneNumber),
59
- workEmail: t.workEmailAddress ?? void 0,
60
- ownsOver25Percent: l(t.ownershipPercentage) ?? void 0,
61
- ownershipPercentage: c(t.ownershipPercentage) ?? void 0,
62
- ssn: "",
63
- ssnOnFileLast4: t.personalIdentificationNumberLast4 ?? void 0
64
- });
65
- }
66
- function p(t) {
67
- let n = u(t.homeAddress);
68
- return r({
69
- ...t.id ? { id: t.id } : {},
70
- firstName: t.firstName ?? "",
71
- lastName: t.lastName ?? "",
72
- dateOfBirth: e(t.birthDate),
73
- ssn: "",
74
- ...t.id && t.personalIdentificationNumberLast4 ? { ssnOnFileLast4: t.personalIdentificationNumberLast4 } : {},
75
- homeAddress: n.line1 ?? "",
76
- city: n.city ?? "",
77
- state: n.state ?? "",
78
- zipCode: n.zipCode ?? "",
79
- mobilePhoneNumber: t.mobilePhoneNumber ?? "",
80
- ownsOver25Percent: null,
81
- ownershipPercentage: c(t.ownershipPercentage)
82
- });
83
- }
84
- function m(e) {
85
- if (!e) return;
86
- let { applicant: t, businessDetails: n, businessOwners: r } = e, i = {
87
- businessDetails: {
88
- taxId: "",
89
- isCheckboxChecked: !1
27
+ function _({ owners: h, onOwnersChange: _, primaryOwnerName: v, primaryOwnerPercentage: y, stateOptions: b, onSnapshotChange: x, onPendingOwnerChange: S, isSubmitting: C, labels: w }) {
28
+ let T = u(() => ({
29
+ ...n,
30
+ ...w
31
+ }), [w]), E = u(() => t(T), [T]), [D, O] = f(null), [k, A] = f(null), [j, M] = f(null), [N, P] = f(null), [F, I] = f(!1), L = (e) => {
32
+ O(c(e));
33
+ }, R = y + h.reduce((e, t) => e + m(t), 0), z = R > 100 ? T.totalOwnershipExceedsTemplate(R) : null, B = R > 75, V = `${y}%`, H = y >= 25, U = h.every((e) => E.safeParse(e).success), W = D !== null && E.safeParse(D).success, G = U && z === null && D === null && N === null ? h : null, K = JSON.stringify({ snapshot: G?.map((e) => ({
34
+ ...e,
35
+ dateOfBirth: e.dateOfBirth?.toISOString()
36
+ })) }), q = d(x);
37
+ q.current = x, l(() => {
38
+ q.current(G);
39
+ }, [K]);
40
+ let J = D !== null && i(D) !== i(j) ? {
41
+ owner: D,
42
+ index: k
43
+ } : null, Y = i(J), X = d(S);
44
+ X.current = S, l(() => {
45
+ X.current?.(J);
46
+ }, [Y]), l(() => () => X.current?.(null), []);
47
+ let Z = () => {
48
+ A(null), I(!1), O({ ...a }), M({ ...a });
49
+ }, Q = (e) => {
50
+ A(e), I(!1);
51
+ let t = c({ ...h[e] });
52
+ O(t), M(t);
53
+ }, $ = (e) => {
54
+ let t = h[e];
55
+ P({
56
+ index: e,
57
+ displayName: `${t.firstName} ${t.lastName}`.trim()
58
+ });
59
+ }, ee = () => {
60
+ N && (_(h.filter((e, t) => t !== N.index)), P(null));
61
+ }, te = () => {
62
+ P(null);
63
+ }, ne = D ? {
64
+ fields: s(D, L, { stateOptions: b }),
65
+ display: o(D, T),
66
+ isExisting: k !== null,
67
+ isValid: W,
68
+ ssnRevealed: F,
69
+ ssnToggleAriaLabel: F ? T.ssnHide : T.ssnShow,
70
+ onToggleSsnVisibility: () => I((e) => !e),
71
+ onSubmit: () => {
72
+ if (!D) return;
73
+ let e = E.safeParse(D);
74
+ if (e.success) {
75
+ if (k === null) _([...h, e.data]);
76
+ else {
77
+ let t = [...h];
78
+ t[k] = e.data, _(t);
79
+ }
80
+ O(null), A(null), I(!1);
81
+ }
90
82
  },
91
- personalDetails: { ssn: "" }
92
- };
93
- return n && (i.businessDetails = d(n, t)), t && (i.personalDetails = f(t)), r !== void 0 && (i.additionalOwners = r?.map(p) ?? []), i;
83
+ onCancel: () => {
84
+ O(null), A(null), I(!1);
85
+ }
86
+ } : null;
87
+ return /* @__PURE__ */ p(r, {
88
+ ownerRows: h.map(g),
89
+ primaryOwnerName: v,
90
+ primaryOwnerShareDisplay: V,
91
+ showPrimaryOwner: H,
92
+ totalOwnershipError: z,
93
+ addOwnerDisabled: B,
94
+ onAddOwner: Z,
95
+ onEditOwner: Q,
96
+ onDeleteOwnerRequest: $,
97
+ deletingOwnerName: N?.displayName ?? null,
98
+ onDeleteOwnerConfirm: ee,
99
+ onDeleteOwnerCancel: te,
100
+ editingOverlay: ne,
101
+ isSubmitting: C,
102
+ labels: w,
103
+ testIds: {
104
+ addOwnerButton: e.addOwnerButton,
105
+ overlay: { root: e.shellOverlay },
106
+ deleteOverlay: {
107
+ root: e.ownerDeleteOverlay,
108
+ content: e.ownerDeleteContent
109
+ }
110
+ }
111
+ });
94
112
  }
95
113
  //#endregion
96
- export { m as buildOnboardingPrefill };
114
+ export { _ as AdditionalOwnersStep, m as getAdditionalOwnerShare };
@@ -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/index19.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, r as formatBirthDate, n as stripPhone };
@@ -1,30 +1,96 @@
1
- import { RESULT_LABELS_EN as e } from "../../ui/dist/index13.js";
2
- import "../../ui/dist/index.js";
1
+ import { parseCalendarDate as e } from "../../../shared/util/dist/lib/parseCalendarDate.js";
2
+ import { formatPhoneNumberInput as t } from "./index2.js";
3
+ import { sanitizeZipCodeInput as n } from "./index3.js";
4
+ import { normalizeAdditionalOwnerDraft as r } from "./index16.js";
3
5
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index20.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
- };
6
+ var i = .25, a = (e) => e ? t(e) : void 0, o = (e) => e ? n(e) : void 0;
7
+ function s(e) {
8
+ return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
9
+ }
10
+ function c(e) {
11
+ if (e == null || e === "") return null;
12
+ let t = typeof e == "string" ? Number(e) : e;
13
+ return Number.isFinite(t) ? Math.round(t * 1e6) / 1e4 : null;
14
+ }
15
+ function l(e) {
16
+ if (e == null || e === "") return null;
17
+ let t = typeof e == "string" ? Number(e) : e;
18
+ return Number.isFinite(t) ? t >= i : null;
19
+ }
20
+ function u(e) {
21
+ return {
22
+ line1: e?.address1 ?? void 0,
23
+ city: e?.city ?? void 0,
24
+ state: e?.state ?? void 0,
25
+ zipCode: e?.postalCode ?? void 0
26
+ };
27
+ }
28
+ function d(e, t) {
29
+ let n = u(e.address);
30
+ return s({
31
+ companyLegalName: e.legalName ?? void 0,
32
+ companyDbaName: e.dbaName ?? "",
33
+ businessAddress: n.line1,
34
+ city: n.city,
35
+ state: n.state,
36
+ zipCode: o(n.zipCode),
37
+ companyPhoneNumber: a(e.phoneNumber),
38
+ companyStructure: e.businessStructureType ?? void 0,
39
+ website: e.website ?? "",
40
+ naicsCode: e.northAmericanIndustryClassificationSystemCode ?? void 0,
41
+ isAuthorized: t?.isLegallyAuthorized ?? void 0,
42
+ taxId: "",
43
+ taxIdOnFileLast4: e.taxIdLast4 ?? void 0,
44
+ taxIdOnFileStructure: e.businessStructureType ?? void 0,
45
+ isCheckboxChecked: !1
46
+ });
47
+ }
48
+ function f(t) {
49
+ let n = u(t.homeAddress);
50
+ return s({
51
+ firstName: t.firstName ?? void 0,
52
+ lastName: t.lastName ?? void 0,
53
+ dateOfBirth: e(t.birthDate),
54
+ homeAddress: n.line1,
55
+ city: n.city,
56
+ state: n.state,
57
+ zipCode: o(n.zipCode),
58
+ mobilePhoneNumber: a(t.mobilePhoneNumber),
59
+ workEmail: t.workEmailAddress ?? void 0,
60
+ ownsOver25Percent: l(t.ownershipPercentage) ?? void 0,
61
+ ownershipPercentage: c(t.ownershipPercentage) ?? void 0,
62
+ ssn: "",
63
+ ssnOnFileLast4: t.personalIdentificationNumberLast4 ?? void 0
64
+ });
65
+ }
66
+ function p(t) {
67
+ let n = u(t.homeAddress);
68
+ return r({
69
+ ...t.id ? { id: t.id } : {},
70
+ firstName: t.firstName ?? "",
71
+ lastName: t.lastName ?? "",
72
+ dateOfBirth: e(t.birthDate),
73
+ ssn: "",
74
+ ...t.id && t.personalIdentificationNumberLast4 ? { ssnOnFileLast4: t.personalIdentificationNumberLast4 } : {},
75
+ homeAddress: n.line1 ?? "",
76
+ city: n.city ?? "",
77
+ state: n.state ?? "",
78
+ zipCode: n.zipCode ?? "",
79
+ mobilePhoneNumber: t.mobilePhoneNumber ?? "",
80
+ ownsOver25Percent: null,
81
+ ownershipPercentage: c(t.ownershipPercentage)
82
+ });
83
+ }
84
+ function m(e) {
85
+ if (!e) return;
86
+ let { applicant: t, businessDetails: n, businessOwners: r } = e, i = {
87
+ businessDetails: {
88
+ taxId: "",
89
+ isCheckboxChecked: !1
90
+ },
91
+ personalDetails: { ssn: "" }
92
+ };
93
+ return n && (i.businessDetails = d(n, t)), t && (i.personalDetails = f(t)), r !== void 0 && (i.additionalOwners = r?.map(p) ?? []), i;
94
+ }
29
95
  //#endregion
30
- export { t as DEFAULT_LABELS };
96
+ export { m as buildOnboardingPrefill };