@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.
- package/README.md +14 -14
- package/dist/index.d.ts +41 -3
- package/dist/index.js +5 -5
- package/dist/lib/BankAccountOnboardingWidget.d.ts +41 -3
- package/dist/lib/BankAccountOnboardingWidget.js +5 -5
- 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 +184 -109
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index11.js +29 -174
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +117 -67
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index13.js +137 -44
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js +77 -107
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js +84 -87
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +116 -88
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +99 -5
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +100 -28
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index19.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index20.js +26 -383
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index21.js +19 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +407 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index6.js +2 -10
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index7.js +22 -6
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index8.js +11 -182
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index9.js +8 -29
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +12 -12
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index10.js +27 -26
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index11.js +34 -91
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index12.js +96 -12
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index13.js +14 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index14.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index15.js +4 -175
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index16.js +180 -28
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index17.js +31 -21
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index18.js +21 -65
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index19.js +60 -215
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index20.js +230 -29
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index21.js +32 -26
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index22.js +26 -71
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index23.js +71 -82
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index24.js +87 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index3.js +38 -28
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index4.js +2 -46
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index5.js +48 -139
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index6.js +138 -48
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index7.js +47 -26
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index8.js +32 -33
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index9.js +31 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +20 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -2,120 +2,90 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { isIdentifierEnteredOrStored as e } from "./index7.js";
|
|
6
|
+
import { bankAccountOnboardingTestIds as t } from "./index11.js";
|
|
7
|
+
import { AboutYouPanel as n } from "../../ui/dist/index23.js";
|
|
8
8
|
import "../../ui/dist/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { useEffect as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { z as
|
|
9
|
+
import { getMaxBirthDate as r, isAtLeastMinOwnerAge as i } from "./index9.js";
|
|
10
|
+
import { buildAboutYouEditFields as a, buildAboutYouPanelLabels as o, buildAboutYouSummaryRows as s, buildSsnDisplayValues as c, mergePersonalDetailsLabels as l } from "./index13.js";
|
|
11
|
+
import { useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
12
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
13
|
+
import { z as h } from "zod";
|
|
14
14
|
//#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js
|
|
15
|
-
function
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
homeAddress:
|
|
23
|
-
city:
|
|
24
|
-
state:
|
|
25
|
-
zipCode:
|
|
26
|
-
mobilePhoneNumber:
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
function g(t) {
|
|
16
|
+
return h.object({
|
|
17
|
+
firstName: h.string().min(1),
|
|
18
|
+
lastName: h.string().min(1),
|
|
19
|
+
dateOfBirth: h.date().refine(i, { message: t.dateOfBirthMinAgeError }),
|
|
20
|
+
ssn: h.string(),
|
|
21
|
+
ssnOnFileLast4: h.string().optional(),
|
|
22
|
+
homeAddress: h.string().min(1),
|
|
23
|
+
city: h.string().min(1),
|
|
24
|
+
state: h.string().min(2),
|
|
25
|
+
zipCode: h.string().min(5),
|
|
26
|
+
mobilePhoneNumber: h.string().refine((e) => e.replace(/\D/g, "").length === 10, { message: t.mobilePhoneNumberInvalid }),
|
|
27
|
+
workEmail: h.email(),
|
|
28
|
+
ownsOver25Percent: h.boolean(),
|
|
29
|
+
ownershipPercentage: h.number().min(0).max(100).nullable()
|
|
30
|
+
}).refine((t) => e(t.ssn, t.ssnOnFileLast4), {
|
|
31
|
+
message: t.ssnInvalid,
|
|
32
|
+
path: ["ssn"]
|
|
33
|
+
}).refine((e) => e.ownsOver25Percent === !1 || e.ownershipPercentage !== null && e.ownershipPercentage >= 25 && e.ownershipPercentage <= 100, {
|
|
34
|
+
message: t.ownershipPercentageRangeError,
|
|
35
|
+
path: ["ownershipPercentage"]
|
|
29
36
|
});
|
|
30
37
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
display: a(T),
|
|
73
|
-
isExisting: D !== null,
|
|
74
|
-
isValid: B,
|
|
75
|
-
ssnRevealed: j,
|
|
76
|
-
ssnToggleAriaLabel: j ? C.ssnHide : C.ssnShow,
|
|
77
|
-
onToggleSsnVisibility: () => M((e) => !e),
|
|
78
|
-
onSubmit: () => {
|
|
79
|
-
if (!T) return;
|
|
80
|
-
let e = w.safeParse(T);
|
|
81
|
-
if (e.success) {
|
|
82
|
-
if (D === null) p([...r, e.data]);
|
|
83
|
-
else {
|
|
84
|
-
let t = [...r];
|
|
85
|
-
t[D] = e.data, p(t);
|
|
86
|
-
}
|
|
87
|
-
E(null), O(null), M(!1);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
onCancel: () => {
|
|
91
|
-
E(null), O(null), M(!1);
|
|
92
|
-
}
|
|
93
|
-
} : null;
|
|
94
|
-
return /* @__PURE__ */ f(n, {
|
|
95
|
-
ownerRows: r.map(_),
|
|
96
|
-
primaryOwnerName: g,
|
|
97
|
-
primaryOwnerShareDisplay: L,
|
|
98
|
-
showPrimaryOwner: R,
|
|
99
|
-
totalOwnershipError: F,
|
|
100
|
-
addOwnerDisabled: I,
|
|
101
|
-
onAddOwner: W,
|
|
102
|
-
onEditOwner: G,
|
|
103
|
-
onDeleteOwnerRequest: K,
|
|
104
|
-
deletingOwnerName: k?.displayName ?? null,
|
|
105
|
-
onDeleteOwnerConfirm: q,
|
|
106
|
-
onDeleteOwnerCancel: J,
|
|
107
|
-
editingOverlay: Y,
|
|
108
|
-
isSubmitting: x,
|
|
109
|
-
labels: S,
|
|
38
|
+
function _({ value: e, onValueChange: i, onSnapshotChange: h, stateOptions: _, isSubmitting: v, labels: y }) {
|
|
39
|
+
let b = d(() => l(y), [y]), x = d(() => g(b), [b]).safeParse(e), S = x.success ? x.data : null, C = JSON.stringify({
|
|
40
|
+
...S,
|
|
41
|
+
dateOfBirth: S?.dateOfBirth?.toISOString()
|
|
42
|
+
}), w = f(h);
|
|
43
|
+
w.current = h, u(() => {
|
|
44
|
+
w.current(S);
|
|
45
|
+
}, [C]);
|
|
46
|
+
let [T, E] = p(() => S === null), [D, O] = p(!1);
|
|
47
|
+
u(() => {
|
|
48
|
+
S === null && E(!0);
|
|
49
|
+
}, [C]);
|
|
50
|
+
let k = d(() => ({
|
|
51
|
+
stateOptions: _,
|
|
52
|
+
labels: y
|
|
53
|
+
}), [_, y]), A = d(() => o(y), [y]), j = d(() => s(e, k), [e, k]), M = d(() => a(e, i, k), [
|
|
54
|
+
e,
|
|
55
|
+
i,
|
|
56
|
+
k
|
|
57
|
+
]), N = d(() => c(e.ssn, e.ssnOnFileLast4, y), [
|
|
58
|
+
e.ssn,
|
|
59
|
+
e.ssnOnFileLast4,
|
|
60
|
+
y
|
|
61
|
+
]), P = d(() => r(), []);
|
|
62
|
+
return /* @__PURE__ */ m(n, {
|
|
63
|
+
isEditing: T,
|
|
64
|
+
onEditClick: () => E(!0),
|
|
65
|
+
summaryRows: j,
|
|
66
|
+
editFields: M,
|
|
67
|
+
labels: A,
|
|
68
|
+
isDisabled: v,
|
|
69
|
+
ssnRevealed: D,
|
|
70
|
+
ssnToggleAriaLabel: D ? A.ssnHide : A.ssnShow,
|
|
71
|
+
onToggleSsnVisibility: () => O((e) => !e),
|
|
72
|
+
showOwnershipPercentage: e.ownsOver25Percent === !0,
|
|
73
|
+
maxBirthDate: P,
|
|
74
|
+
ssnMaskedDisplay: N.masked,
|
|
75
|
+
ssnFormattedDisplay: N.formatted,
|
|
76
|
+
ssnRequired: N.required,
|
|
77
|
+
ssnPlaceholder: N.placeholder,
|
|
78
|
+
ssnHelpText: N.helpText,
|
|
110
79
|
testIds: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
80
|
+
root: t.aboutYouPanel,
|
|
81
|
+
editButton: t.aboutYouEditButton,
|
|
82
|
+
summary: { root: t.aboutYouSummary },
|
|
83
|
+
editForm: {
|
|
84
|
+
root: t.aboutYouEditForm,
|
|
85
|
+
ownsOver25Question: t.aboutYouOwnsOver25Question
|
|
116
86
|
}
|
|
117
87
|
}
|
|
118
88
|
});
|
|
119
89
|
}
|
|
120
90
|
//#endregion
|
|
121
|
-
export {
|
|
91
|
+
export { _ as PersonalDetailsStep };
|
|
@@ -1,100 +1,97 @@
|
|
|
1
|
+
import { storedIdentifierFieldDisplay as e } from "./index7.js";
|
|
2
|
+
import { formatPhoneNumberInput as t } from "./index2.js";
|
|
3
|
+
import { sanitizeZipCodeInput as n } from "./index3.js";
|
|
4
|
+
import { ADDITIONAL_OWNERS_LABELS_EN as r } from "../../ui/dist/index5.js";
|
|
5
|
+
import "../../ui/dist/index.js";
|
|
6
|
+
import { getMaxBirthDate as i, isAtLeastMinOwnerAge as a } from "./index9.js";
|
|
7
|
+
import { formatSsnInput as o, maskSsn as s, sanitizeSsnDigits as c } from "./index4.js";
|
|
1
8
|
//#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js
|
|
2
|
-
var
|
|
3
|
-
|
|
9
|
+
var l = {
|
|
10
|
+
firstName: "",
|
|
11
|
+
lastName: "",
|
|
12
|
+
dateOfBirth: void 0,
|
|
13
|
+
ssn: "",
|
|
14
|
+
homeAddress: "",
|
|
15
|
+
city: "",
|
|
16
|
+
state: "",
|
|
17
|
+
zipCode: "",
|
|
18
|
+
mobilePhoneNumber: "",
|
|
19
|
+
ownsOver25Percent: null,
|
|
20
|
+
ownershipPercentage: null
|
|
21
|
+
};
|
|
22
|
+
function u(e) {
|
|
4
23
|
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
24
|
+
...e,
|
|
25
|
+
ssn: c(e.ssn),
|
|
26
|
+
zipCode: n(e.zipCode),
|
|
27
|
+
mobilePhoneNumber: t(e.mobilePhoneNumber),
|
|
28
|
+
ownsOver25Percent: e.ownershipPercentage === null ? null : e.ownershipPercentage >= 25
|
|
10
29
|
};
|
|
11
30
|
}
|
|
12
|
-
function
|
|
31
|
+
function d(t, n) {
|
|
32
|
+
let c = {
|
|
33
|
+
...r,
|
|
34
|
+
...n
|
|
35
|
+
}, l = e(t.ssnOnFileLast4, c.ssnOnFileTemplate);
|
|
13
36
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
phoneNumber: e(t.companyPhoneNumber),
|
|
23
|
-
businessStructureType: t.companyStructure,
|
|
24
|
-
website: t.website.trim() || null,
|
|
25
|
-
taxId: {
|
|
26
|
-
type: t.companyStructure === "SOLE_PROPRIETORSHIP" ? "SSN" : "EIN",
|
|
27
|
-
value: t.taxId
|
|
28
|
-
},
|
|
29
|
-
northAmericanIndustryClassificationSystemCode: t.naicsCode
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function i(e) {
|
|
33
|
-
return {
|
|
34
|
-
isLegallyAuthorized: e.isAuthorized,
|
|
35
|
-
hasAcceptedDisclosures: e.isCheckboxChecked
|
|
37
|
+
ssnRequired: l.required,
|
|
38
|
+
ssnPlaceholder: l.placeholder,
|
|
39
|
+
ssnHelpText: l.helpText,
|
|
40
|
+
dateOfBirthInvalid: t.dateOfBirth !== void 0 && !a(t.dateOfBirth),
|
|
41
|
+
ownershipPercentageInvalid: t.ownershipPercentage !== null && t.ownershipPercentage < 25,
|
|
42
|
+
maxBirthDate: i(),
|
|
43
|
+
ssnMaskedDisplay: s(t.ssn),
|
|
44
|
+
ssnFormattedDisplay: o(t.ssn)
|
|
36
45
|
};
|
|
37
46
|
}
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
function f(e, t, n) {
|
|
48
|
+
let r = (n) => (r) => t(u({
|
|
49
|
+
...e,
|
|
50
|
+
[n]: r
|
|
51
|
+
}));
|
|
40
52
|
return {
|
|
41
|
-
firstName:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
personalIdentificationNumber: {
|
|
45
|
-
type: "SSN",
|
|
46
|
-
value: r.ssn
|
|
53
|
+
firstName: {
|
|
54
|
+
value: e.firstName,
|
|
55
|
+
onValueChange: r("firstName")
|
|
47
56
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
57
|
+
lastName: {
|
|
58
|
+
value: e.lastName,
|
|
59
|
+
onValueChange: r("lastName")
|
|
60
|
+
},
|
|
61
|
+
dateOfBirth: {
|
|
62
|
+
value: e.dateOfBirth,
|
|
63
|
+
onValueChange: r("dateOfBirth")
|
|
64
|
+
},
|
|
65
|
+
ssn: {
|
|
66
|
+
value: e.ssn,
|
|
67
|
+
onValueChange: (e) => r("ssn")(e)
|
|
68
|
+
},
|
|
69
|
+
homeAddress: {
|
|
70
|
+
value: e.homeAddress,
|
|
71
|
+
onValueChange: r("homeAddress")
|
|
72
|
+
},
|
|
73
|
+
city: {
|
|
74
|
+
value: e.city,
|
|
75
|
+
onValueChange: r("city")
|
|
76
|
+
},
|
|
77
|
+
state: {
|
|
78
|
+
value: e.state,
|
|
79
|
+
onValueChange: r("state"),
|
|
80
|
+
options: n.stateOptions
|
|
81
|
+
},
|
|
82
|
+
zipCode: {
|
|
83
|
+
value: e.zipCode,
|
|
84
|
+
onValueChange: (e) => r("zipCode")(e)
|
|
85
|
+
},
|
|
86
|
+
mobilePhoneNumber: {
|
|
87
|
+
value: e.mobilePhoneNumber,
|
|
88
|
+
onValueChange: (e) => r("mobilePhoneNumber")(e)
|
|
89
|
+
},
|
|
90
|
+
ownershipPercentage: {
|
|
91
|
+
value: e.ownershipPercentage,
|
|
92
|
+
onValueChange: r("ownershipPercentage")
|
|
76
93
|
}
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
function c(e) {
|
|
80
|
-
return {
|
|
81
|
-
businessDetails: r(e),
|
|
82
|
-
applicant: i(e)
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function l(e) {
|
|
86
|
-
let t = e.businessDetails?.companyStructure === "SOLE_PROPRIETORSHIP", n = e.carryConsent && e.businessDetails && {
|
|
87
|
-
isLegallyAuthorized: e.businessDetails.isAuthorized,
|
|
88
|
-
hasAcceptedDisclosures: e.businessDetails.isCheckboxChecked
|
|
89
|
-
};
|
|
90
|
-
return {
|
|
91
|
-
...e.businessDetails && { businessDetails: r(e.businessDetails) },
|
|
92
|
-
...(e.applicant || n) && { applicant: {
|
|
93
|
-
...e.applicant ? o(e.applicant, { isSoleProprietor: t }) : {},
|
|
94
|
-
...n
|
|
95
|
-
} },
|
|
96
|
-
...(t || e.businessOwners !== void 0) && { businessOwners: !t && e.businessOwners?.length ? s(e.businessOwners) : null }
|
|
97
94
|
};
|
|
98
95
|
}
|
|
99
96
|
//#endregion
|
|
100
|
-
export {
|
|
97
|
+
export { l as EMPTY_ADDITIONAL_OWNER, d as buildAdditionalOwnerEditDisplay, f as buildAdditionalOwnerEditFields, u as normalizeAdditionalOwnerDraft };
|
|
@@ -1,98 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { isIdentifierEnteredOrStored as e } from "./index7.js";
|
|
6
|
+
import { bankAccountOnboardingTestIds as t } from "./index11.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 { isAtLeastMinOwnerAge as i } from "./index9.js";
|
|
11
|
+
import { EMPTY_ADDITIONAL_OWNER as a, buildAdditionalOwnerEditDisplay as o, buildAdditionalOwnerEditFields as s, normalizeAdditionalOwnerDraft as c } from "./index15.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";
|
|
14
|
+
import { z as m } from "zod";
|
|
4
15
|
//#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
function h(t) {
|
|
17
|
+
return m.object({
|
|
18
|
+
id: m.string().optional(),
|
|
19
|
+
firstName: m.string().min(1),
|
|
20
|
+
lastName: m.string().min(1),
|
|
21
|
+
dateOfBirth: m.date().refine(i, { message: t.dateOfBirthMinAgeError }),
|
|
22
|
+
ssn: m.string(),
|
|
23
|
+
ssnOnFileLast4: m.string().optional(),
|
|
24
|
+
homeAddress: m.string().min(1),
|
|
25
|
+
city: m.string().min(1),
|
|
26
|
+
state: m.string().min(2),
|
|
27
|
+
zipCode: m.string().min(5),
|
|
28
|
+
mobilePhoneNumber: m.string().refine((e) => e.replace(/\D/g, "").length === 10, { message: t.mobilePhoneNumberInvalid }),
|
|
29
|
+
ownsOver25Percent: m.literal(!0),
|
|
30
|
+
ownershipPercentage: m.number().min(25).max(100)
|
|
31
|
+
}).refine((t) => e(t.ssn, t.ssnOnFileLast4), {
|
|
32
|
+
message: t.ssnInvalid,
|
|
33
|
+
path: ["ssn"]
|
|
34
|
+
});
|
|
15
35
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
let t = typeof e == "string" ? Number(e) : e;
|
|
19
|
-
return Number.isFinite(t) ? Math.round(t * 1e6) / 1e4 : null;
|
|
36
|
+
function g(e) {
|
|
37
|
+
return e.ownershipPercentage !== null && e.ownershipPercentage >= 25 ? e.ownershipPercentage : 0;
|
|
20
38
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
let t = typeof e == "string" ? Number(e) : e;
|
|
24
|
-
return Number.isFinite(t) ? t >= r : null;
|
|
39
|
+
function _(e) {
|
|
40
|
+
return `${g(e)}%`;
|
|
25
41
|
}
|
|
26
|
-
function
|
|
42
|
+
function v(e) {
|
|
27
43
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
state: e?.state ?? void 0,
|
|
31
|
-
zipCode: e?.postalCode ?? void 0
|
|
44
|
+
name: `${e.firstName} ${e.lastName}`.trim(),
|
|
45
|
+
shareDisplay: _(e)
|
|
32
46
|
};
|
|
33
47
|
}
|
|
34
|
-
function
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
zipCode: t.zipCode ?? "",
|
|
81
|
-
mobilePhoneNumber: e.mobilePhoneNumber ?? "",
|
|
82
|
-
ownsOver25Percent: null,
|
|
83
|
-
ownershipPercentage: c(e.ownershipPercentage)
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function m(e) {
|
|
87
|
-
if (!e) return;
|
|
88
|
-
let { applicant: t, businessDetails: n, businessOwners: r } = e, i = {
|
|
89
|
-
businessDetails: {
|
|
90
|
-
taxId: "",
|
|
91
|
-
isCheckboxChecked: !1
|
|
48
|
+
function y({ owners: e, onOwnersChange: i, primaryOwnerName: m, primaryOwnerPercentage: _, stateOptions: y, onSnapshotChange: b, isSubmitting: x, labels: S }) {
|
|
49
|
+
let C = u(() => ({
|
|
50
|
+
...n,
|
|
51
|
+
...S
|
|
52
|
+
}), [S]), w = u(() => h(C), [C]), [T, E] = f(null), [D, O] = f(null), [k, A] = f(null), [j, M] = f(!1), N = (e) => {
|
|
53
|
+
E(c(e));
|
|
54
|
+
}, P = _ + e.reduce((e, t) => e + g(t), 0), F = P > 100 ? C.totalOwnershipExceedsTemplate(P) : null, I = P > 75, L = `${_}%`, R = _ >= 25, z = e.every((e) => w.safeParse(e).success), B = T !== null && w.safeParse(T).success, V = z && F === null && T === null && k === null ? e : null, H = JSON.stringify({ snapshot: V?.map((e) => ({
|
|
55
|
+
...e,
|
|
56
|
+
dateOfBirth: e.dateOfBirth?.toISOString()
|
|
57
|
+
})) }), U = d(b);
|
|
58
|
+
U.current = b, l(() => {
|
|
59
|
+
U.current(V);
|
|
60
|
+
}, [H]);
|
|
61
|
+
let W = () => {
|
|
62
|
+
O(null), M(!1), E({ ...a });
|
|
63
|
+
}, G = (t) => {
|
|
64
|
+
O(t), M(!1), E(c({ ...e[t] }));
|
|
65
|
+
}, K = (t) => {
|
|
66
|
+
let n = e[t];
|
|
67
|
+
A({
|
|
68
|
+
index: t,
|
|
69
|
+
displayName: `${n.firstName} ${n.lastName}`.trim()
|
|
70
|
+
});
|
|
71
|
+
}, q = () => {
|
|
72
|
+
k && (i(e.filter((e, t) => t !== k.index)), A(null));
|
|
73
|
+
}, J = () => {
|
|
74
|
+
A(null);
|
|
75
|
+
}, Y = T ? {
|
|
76
|
+
fields: s(T, N, { stateOptions: y }),
|
|
77
|
+
display: o(T, C),
|
|
78
|
+
isExisting: D !== null,
|
|
79
|
+
isValid: B,
|
|
80
|
+
ssnRevealed: j,
|
|
81
|
+
ssnToggleAriaLabel: j ? C.ssnHide : C.ssnShow,
|
|
82
|
+
onToggleSsnVisibility: () => M((e) => !e),
|
|
83
|
+
onSubmit: () => {
|
|
84
|
+
if (!T) return;
|
|
85
|
+
let t = w.safeParse(T);
|
|
86
|
+
if (t.success) {
|
|
87
|
+
if (D === null) i([...e, t.data]);
|
|
88
|
+
else {
|
|
89
|
+
let n = [...e];
|
|
90
|
+
n[D] = t.data, i(n);
|
|
91
|
+
}
|
|
92
|
+
E(null), O(null), M(!1);
|
|
93
|
+
}
|
|
92
94
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
onCancel: () => {
|
|
96
|
+
E(null), O(null), M(!1);
|
|
97
|
+
}
|
|
98
|
+
} : null;
|
|
99
|
+
return /* @__PURE__ */ p(r, {
|
|
100
|
+
ownerRows: e.map(v),
|
|
101
|
+
primaryOwnerName: m,
|
|
102
|
+
primaryOwnerShareDisplay: L,
|
|
103
|
+
showPrimaryOwner: R,
|
|
104
|
+
totalOwnershipError: F,
|
|
105
|
+
addOwnerDisabled: I,
|
|
106
|
+
onAddOwner: W,
|
|
107
|
+
onEditOwner: G,
|
|
108
|
+
onDeleteOwnerRequest: K,
|
|
109
|
+
deletingOwnerName: k?.displayName ?? null,
|
|
110
|
+
onDeleteOwnerConfirm: q,
|
|
111
|
+
onDeleteOwnerCancel: J,
|
|
112
|
+
editingOverlay: Y,
|
|
113
|
+
isSubmitting: x,
|
|
114
|
+
labels: S,
|
|
115
|
+
testIds: {
|
|
116
|
+
addOwnerButton: t.addOwnerButton,
|
|
117
|
+
overlay: { root: t.shellOverlay },
|
|
118
|
+
deleteOverlay: {
|
|
119
|
+
root: t.ownerDeleteOverlay,
|
|
120
|
+
content: t.ownerDeleteContent
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
96
124
|
}
|
|
97
125
|
//#endregion
|
|
98
|
-
export {
|
|
126
|
+
export { y as AdditionalOwnersStep, g as getAdditionalOwnerShare };
|