@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,91 +1,180 @@
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 { AboutYouPanel as n } from "../../ui/dist/index23.js";
1
+ import { maskIdentifierLast4 as e } from "./index6.js";
2
+ import { storedIdentifierFieldDisplay as t } from "./index7.js";
3
+ import { formatPhoneNumberInput as n } from "./index2.js";
4
+ import { sanitizeZipCodeInput as r } from "./index3.js";
5
+ import { PERSONAL_DETAILS_LABELS_EN as i } from "../../ui/dist/index8.js";
6
+ import { ABOUT_YOU_PANEL_LABELS_EN as a } from "../../ui/dist/index22.js";
8
7
  import "../../ui/dist/index.js";
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";
8
+ import { formatSsnInput as o, maskSsn as s, sanitizeSsnDigits as c } from "./index4.js";
14
9
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js
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"]
36
- });
10
+ function l(e) {
11
+ return e ? e.toLocaleDateString("en-US", {
12
+ month: "short",
13
+ day: "numeric",
14
+ year: "numeric"
15
+ }) : "";
16
+ }
17
+ function u(e) {
18
+ return {
19
+ ...i,
20
+ ...e
21
+ };
22
+ }
23
+ function d(e) {
24
+ let t = u(e);
25
+ return {
26
+ ...a,
27
+ firstName: t.firstName,
28
+ lastName: t.lastName,
29
+ dateOfBirth: t.dateOfBirth,
30
+ dateOfBirthPlaceholder: t.dateOfBirthPlaceholder,
31
+ ssn: t.ssn,
32
+ ssnShow: t.ssnShow,
33
+ ssnHide: t.ssnHide,
34
+ homeAddress: t.homeAddress,
35
+ city: t.city,
36
+ state: t.state,
37
+ statePlaceholder: t.statePlaceholder,
38
+ zipCode: t.zipCode,
39
+ mobilePhoneNumber: t.mobilePhoneNumber,
40
+ workEmail: t.workEmail,
41
+ ownsOver25Question: t.ownsOver25Question,
42
+ ownsOver25SummaryLabel: t.ownsOver25SummaryLabel,
43
+ ownsOver25Yes: t.ownsOver25Yes,
44
+ ownsOver25No: t.ownsOver25No,
45
+ ownershipPercentage: t.ownershipPercentage,
46
+ ownershipPercentagePlaceholder: t.ownershipPercentagePlaceholder
47
+ };
37
48
  }
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,
79
- testIds: {
80
- root: t.aboutYouPanel,
81
- editButton: t.aboutYouEditButton,
82
- summary: { root: t.aboutYouSummary },
83
- editForm: {
84
- root: t.aboutYouEditForm,
85
- ownsOver25Question: t.aboutYouOwnsOver25Question
86
- }
49
+ function f(t, n) {
50
+ let r = d(n.labels), i = n.stateOptions.find((e) => e.value === t.state)?.label ?? t.state;
51
+ return [
52
+ {
53
+ label: r.firstName,
54
+ value: t.firstName,
55
+ testId: "about-you-summary-first-name"
56
+ },
57
+ {
58
+ label: r.lastName,
59
+ value: t.lastName,
60
+ testId: "about-you-summary-last-name"
61
+ },
62
+ {
63
+ label: r.dateOfBirth,
64
+ value: l(t.dateOfBirth),
65
+ testId: "about-you-summary-dob"
66
+ },
67
+ {
68
+ label: r.ssn,
69
+ value: t.ssn ? s(t.ssn) : t.ssnOnFileLast4 ? e(t.ssnOnFileLast4) : "",
70
+ testId: "about-you-summary-ssn",
71
+ valueMonospace: !0
72
+ },
73
+ {
74
+ label: r.homeAddress,
75
+ value: t.homeAddress,
76
+ testId: "about-you-summary-home-address"
77
+ },
78
+ {
79
+ label: r.city,
80
+ value: t.city,
81
+ testId: "about-you-summary-city"
82
+ },
83
+ {
84
+ label: r.state,
85
+ value: i,
86
+ testId: "about-you-summary-state"
87
+ },
88
+ {
89
+ label: r.zipCode,
90
+ value: t.zipCode,
91
+ testId: "about-you-summary-zip-code"
92
+ },
93
+ {
94
+ label: r.mobilePhoneNumber,
95
+ value: t.mobilePhoneNumber,
96
+ testId: "about-you-summary-mobile-phone"
97
+ },
98
+ {
99
+ label: r.workEmail,
100
+ value: t.workEmail,
101
+ testId: "about-you-summary-email"
102
+ },
103
+ {
104
+ label: r.ownershipPercentage,
105
+ value: t.ownershipPercentage === null ? "" : `${t.ownershipPercentage}%`,
106
+ testId: "about-you-summary-ownership-percentage"
87
107
  }
108
+ ];
109
+ }
110
+ function p(e, t, i) {
111
+ let a = (n) => (r) => t({
112
+ ...e,
113
+ [n]: r
88
114
  });
115
+ return {
116
+ firstName: {
117
+ value: e.firstName,
118
+ onValueChange: a("firstName")
119
+ },
120
+ lastName: {
121
+ value: e.lastName,
122
+ onValueChange: a("lastName")
123
+ },
124
+ dateOfBirth: {
125
+ value: e.dateOfBirth,
126
+ onValueChange: a("dateOfBirth")
127
+ },
128
+ ssn: {
129
+ value: e.ssn,
130
+ onValueChange: (e) => a("ssn")(c(e))
131
+ },
132
+ homeAddress: {
133
+ value: e.homeAddress,
134
+ onValueChange: a("homeAddress")
135
+ },
136
+ city: {
137
+ value: e.city,
138
+ onValueChange: a("city")
139
+ },
140
+ state: {
141
+ value: e.state,
142
+ onValueChange: a("state"),
143
+ options: i.stateOptions
144
+ },
145
+ zipCode: {
146
+ value: e.zipCode,
147
+ onValueChange: (e) => a("zipCode")(r(e))
148
+ },
149
+ mobilePhoneNumber: {
150
+ value: e.mobilePhoneNumber,
151
+ onValueChange: (e) => a("mobilePhoneNumber")(n(e))
152
+ },
153
+ workEmail: {
154
+ value: e.workEmail,
155
+ onValueChange: a("workEmail")
156
+ },
157
+ ownsOver25Percent: {
158
+ value: e.ownsOver25Percent === null ? "" : e.ownsOver25Percent ? "yes" : "no",
159
+ onValueChange: (n) => t({
160
+ ...e,
161
+ ownsOver25Percent: n === "" ? null : n === "yes",
162
+ ownershipPercentage: n === "yes" ? e.ownershipPercentage : null
163
+ })
164
+ },
165
+ ownershipPercentage: {
166
+ value: e.ownershipPercentage,
167
+ onValueChange: a("ownershipPercentage")
168
+ }
169
+ };
170
+ }
171
+ function m(e, n, r) {
172
+ let i = u(r);
173
+ return {
174
+ masked: s(e),
175
+ formatted: o(e),
176
+ ...t(n, i.ssnOnFileTemplate)
177
+ };
89
178
  }
90
179
  //#endregion
91
- export { _ as PersonalDetailsStep };
180
+ export { p as buildAboutYouEditFields, d as buildAboutYouPanelLabels, f as buildAboutYouSummaryRows, m as buildSsnDisplayValues, u as mergePersonalDetailsLabels };
@@ -1,97 +1,67 @@
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";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { bankAccountOnboardingTestIds as e } from "./index12.js";
6
+ import { getMaxBirthDate as t } from "./index9.js";
7
+ import { buildPersonalDetailsSchema as n } from "./index10.js";
8
+ import { AboutYouPanel as r } from "../../ui/dist/index23.js";
5
9
  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";
10
+ import { buildAboutYouEditFields as i, buildAboutYouPanelLabels as a, buildAboutYouSummaryRows as o, buildSsnDisplayValues as s, mergePersonalDetailsLabels as c } from "./index14.js";
11
+ import { useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
12
+ import { jsx as p } from "react/jsx-runtime";
8
13
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js
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) {
23
- return {
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
29
- };
30
- }
31
- function d(t, n) {
32
- let c = {
33
- ...r,
34
- ...n
35
- }, l = e(t.ssnOnFileLast4, c.ssnOnFileTemplate);
36
- return {
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)
45
- };
46
- }
47
- function f(e, t, n) {
48
- let r = (n) => (r) => t(u({
49
- ...e,
50
- [n]: r
51
- }));
52
- return {
53
- firstName: {
54
- value: e.firstName,
55
- onValueChange: r("firstName")
56
- },
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")
14
+ function m({ value: m, onValueChange: h, onSnapshotChange: g, stateOptions: _, isSubmitting: v, labels: y }) {
15
+ let b = u(() => c(y), [y]), x = u(() => n(b), [b]).safeParse(m), S = x.success ? x.data : null, C = JSON.stringify({
16
+ ...S,
17
+ dateOfBirth: S?.dateOfBirth?.toISOString()
18
+ }), w = d(g);
19
+ w.current = g, l(() => {
20
+ w.current(S);
21
+ }, [C]);
22
+ let [T, E] = f(() => S === null), [D, O] = f(!1);
23
+ l(() => {
24
+ S === null && E(!0);
25
+ }, [C]);
26
+ let k = u(() => ({
27
+ stateOptions: _,
28
+ labels: y
29
+ }), [_, y]), A = u(() => a(y), [y]), j = u(() => o(m, k), [m, k]), M = u(() => i(m, h, k), [
30
+ m,
31
+ h,
32
+ k
33
+ ]), N = u(() => s(m.ssn, m.ssnOnFileLast4, y), [
34
+ m.ssn,
35
+ m.ssnOnFileLast4,
36
+ y
37
+ ]), P = u(() => t(), []);
38
+ return /* @__PURE__ */ p(r, {
39
+ isEditing: T,
40
+ onEditClick: () => E(!0),
41
+ summaryRows: j,
42
+ editFields: M,
43
+ labels: A,
44
+ isDisabled: v,
45
+ ssnRevealed: D,
46
+ ssnToggleAriaLabel: D ? A.ssnHide : A.ssnShow,
47
+ onToggleSsnVisibility: () => O((e) => !e),
48
+ showOwnershipPercentage: m.ownsOver25Percent === !0,
49
+ maxBirthDate: P,
50
+ ssnMaskedDisplay: N.masked,
51
+ ssnFormattedDisplay: N.formatted,
52
+ ssnRequired: N.required,
53
+ ssnPlaceholder: N.placeholder,
54
+ ssnHelpText: N.helpText,
55
+ testIds: {
56
+ root: e.aboutYouPanel,
57
+ editButton: e.aboutYouEditButton,
58
+ summary: { root: e.aboutYouSummary },
59
+ editForm: {
60
+ root: e.aboutYouEditForm,
61
+ ownsOver25Question: e.aboutYouOwnsOver25Question
62
+ }
93
63
  }
94
- };
64
+ });
95
65
  }
96
66
  //#endregion
97
- export { l as EMPTY_ADDITIONAL_OWNER, d as buildAdditionalOwnerEditDisplay, f as buildAdditionalOwnerEditFields, u as normalizeAdditionalOwnerDraft };
67
+ export { m as PersonalDetailsStep };
@@ -1,126 +1,97 @@
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";
1
+ import { storedIdentifierFieldDisplay as e } from "./index7.js";
2
+ import { getMaxBirthDate as t, isAtLeastMinOwnerAge as n } from "./index9.js";
3
+ import { formatPhoneNumberInput as r } from "./index2.js";
4
+ import { sanitizeZipCodeInput as i } from "./index3.js";
5
+ import { ADDITIONAL_OWNERS_LABELS_EN as a } from "../../ui/dist/index5.js";
9
6
  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";
7
+ import { formatSsnInput as o, maskSsn as s, sanitizeSsnDigits as c } from "./index4.js";
15
8
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js
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
- });
35
- }
36
- function g(e) {
37
- return e.ownershipPercentage !== null && e.ownershipPercentage >= 25 ? e.ownershipPercentage : 0;
38
- }
39
- function _(e) {
40
- return `${g(e)}%`;
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) {
23
+ return {
24
+ ...e,
25
+ ssn: c(e.ssn),
26
+ zipCode: i(e.zipCode),
27
+ mobilePhoneNumber: r(e.mobilePhoneNumber),
28
+ ownsOver25Percent: e.ownershipPercentage === null ? null : e.ownershipPercentage >= 25
29
+ };
41
30
  }
42
- function v(e) {
31
+ function d(r, i) {
32
+ let c = {
33
+ ...a,
34
+ ...i
35
+ }, l = e(r.ssnOnFileLast4, c.ssnOnFileTemplate);
43
36
  return {
44
- name: `${e.firstName} ${e.lastName}`.trim(),
45
- shareDisplay: _(e)
37
+ ssnRequired: l.required,
38
+ ssnPlaceholder: l.placeholder,
39
+ ssnHelpText: l.helpText,
40
+ dateOfBirthInvalid: r.dateOfBirth !== void 0 && !n(r.dateOfBirth),
41
+ ownershipPercentageInvalid: r.ownershipPercentage !== null && r.ownershipPercentage < 25,
42
+ maxBirthDate: t(),
43
+ ssnMaskedDisplay: s(r.ssn),
44
+ ssnFormattedDisplay: o(r.ssn)
46
45
  };
47
46
  }
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) => ({
47
+ function f(e, t, n) {
48
+ let r = (n) => (r) => t(u({
55
49
  ...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
- }
50
+ [n]: r
51
+ }));
52
+ return {
53
+ firstName: {
54
+ value: e.firstName,
55
+ onValueChange: r("firstName")
94
56
  },
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
- }
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")
122
93
  }
123
- });
94
+ };
124
95
  }
125
96
  //#endregion
126
- export { y as AdditionalOwnersStep, g as getAdditionalOwnerShare };
97
+ export { l as EMPTY_ADDITIONAL_OWNER, d as buildAdditionalOwnerEditDisplay, f as buildAdditionalOwnerEditFields, u as normalizeAdditionalOwnerDraft };