@tesouro/embedded-components-react 0.3.16 → 0.3.17

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 (111) hide show
  1. package/dist/index.d.ts +22 -1
  2. package/dist/index.js +10 -10
  3. package/dist/lib/AcceptDisclosuresWidget.d.ts +11 -1
  4. package/dist/lib/AcceptDisclosuresWidget.js +1 -1
  5. package/dist/lib/BalancesWidget.js +1 -1
  6. package/dist/lib/BankAccountOnboardingWidget.d.ts +21 -21
  7. package/dist/lib/BankAccountOnboardingWidget.js +1 -1
  8. package/dist/lib/CardsWidget.js +1 -1
  9. package/dist/lib/ExpenseApprovalPoliciesWidget.js +1 -1
  10. package/dist/lib/ExpenseManagementWidget.js +1 -1
  11. package/dist/lib/InsightsWidget.js +1 -1
  12. package/dist/lib/ReceiptMatchWidget.js +1 -1
  13. package/dist/lib/TransfersWidget.js +1 -1
  14. package/dist/lib/UploadReceiptWidget.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +10 -140
  17. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index5.js +152 -0
  18. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js +19 -19
  19. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index4.js +10 -11
  21. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index5.js +15 -64
  22. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index6.js +75 -0
  23. package/dist/libs/tesouro-embedded-components-react/balances-widget/ui/dist/lib/BalancesWidget/BalancesWidget.js +16 -16
  24. package/dist/libs/tesouro-embedded-components-react/balances-widget/ui/dist/lib/BalancesWidget/SingleBalance/SingleBalance.js +7 -7
  25. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index10.js +109 -169
  27. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index11.js +170 -63
  28. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +73 -81
  29. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index13.js +77 -101
  30. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js +110 -83
  31. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js +91 -7
  32. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +7 -28
  33. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +26 -320
  34. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +341 -0
  35. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index9.js +29 -100
  36. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +0 -1
  37. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index11.js +3 -3
  38. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index15.js +32 -32
  39. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index16.js +2 -2
  40. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index18.js +14 -10
  41. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index19.js +42 -42
  42. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index2.js +80 -77
  43. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index20.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index22.js +14 -10
  45. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index23.js +16 -16
  46. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js +5 -5
  47. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index3.js +7 -6
  48. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index5.js +23 -18
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +0 -1
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +28 -28
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +0 -1
  52. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/index.js +0 -1
  53. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsHeader.js +5 -5
  54. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index.js +3 -3
  55. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index3.js +4 -23
  56. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index4.js +23 -24
  57. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +24 -30
  58. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index6.js +28 -55
  59. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +54 -209
  60. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +206 -81
  61. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +95 -0
  62. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardFaceSwatch.js +2 -2
  63. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +31 -30
  64. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +11 -10
  65. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js +5 -5
  66. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index10.js +1 -255
  67. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index11.js +253 -2
  68. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index12.js +2 -71
  69. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js +73 -0
  70. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index5.js +7 -218
  71. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js +219 -79
  72. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index7.js +89 -2
  73. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index8.js +2 -47
  74. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index9.js +49 -1
  75. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ApprovalRuleCard.js +2 -2
  76. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ApprovalRuleForm.js +32 -32
  77. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ExpenseApprovalsPage.js +11 -8
  78. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index.js +1 -1
  79. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index10.js +12 -14
  80. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index11.js +21 -62
  81. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index12.js +73 -0
  82. package/dist/libs/tesouro-embedded-components-react/insights-widget/ui/dist/lib/InsightsWidget/InsightsWidget.js +6 -6
  83. package/dist/libs/tesouro-embedded-components-react/insights-widget/ui/dist/lib/InsightsWidget/SingleInsight/SingleInsight.js +10 -10
  84. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index5.js +1 -1
  85. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +67 -46
  86. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/testIds.js +26 -0
  87. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +151 -135
  88. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +11 -11
  89. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index14.js +17 -17
  90. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +17 -15
  91. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +9 -9
  92. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +16 -13
  93. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +13 -13
  94. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index5.js +11 -11
  95. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +5 -5
  96. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index9.js +6 -6
  97. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  98. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +21 -20
  99. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellOverlayPortal.js +10 -10
  100. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellScrollRegion.js +17 -17
  101. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index.js +1 -1
  102. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index5.js +18 -99
  103. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index6.js +116 -19
  104. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index7.js +28 -0
  105. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/ReviewTransferStep.js +9 -9
  106. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferMoneyModal.js +13 -11
  107. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferResultStep.js +7 -7
  108. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +19 -19
  109. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +4 -4
  110. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  111. package/package.json +1 -1
@@ -1,176 +1,116 @@
1
- import { formatPhoneNumberInput as e } from "./index2.js";
2
- import { sanitizeZipCodeInput as t } from "./index3.js";
3
- import { PERSONAL_DETAILS_LABELS_EN as n } from "../../ui/dist/index7.js";
4
- import { ABOUT_YOU_PANEL_LABELS_EN as r } from "../../ui/dist/index21.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { bankAccountOnboardingTestIds as e } from "./index9.js";
6
+ import { isValidWebsiteUrl as t } from "./index6.js";
7
+ import { BusinessDetailsPanel as n } from "../../ui/dist/index18.js";
8
+ import { BusinessDisclosuresSection as r } from "../../ui/dist/index23.js";
5
9
  import "../../ui/dist/index.js";
6
- import { formatSsnInput as i, maskSsn as a, sanitizeSsnDigits as o } from "./index4.js";
10
+ import { buildBusinessDetailsEditFields as i, buildBusinessDetailsPanelLabels as a, buildBusinessDetailsSummaryRows as o, isBusinessWebsiteInvalid as s, mergeBusinessDetailsLabels as c } from "./index8.js";
11
+ import { useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
12
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
13
+ import { z as h } from "zod";
7
14
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index10.js
8
- function s(e) {
9
- return e ? e.toLocaleDateString("en-US", {
10
- month: "short",
11
- day: "numeric",
12
- year: "numeric"
13
- }) : "";
14
- }
15
- function c(e) {
16
- return {
17
- ...n,
18
- ...e
19
- };
20
- }
21
- function l(e) {
22
- let t = c(e);
23
- return {
24
- ...r,
25
- firstName: t.firstName,
26
- lastName: t.lastName,
27
- dateOfBirth: t.dateOfBirth,
28
- dateOfBirthPlaceholder: t.dateOfBirthPlaceholder,
29
- ssn: t.ssn,
30
- ssnShow: t.ssnShow,
31
- ssnHide: t.ssnHide,
32
- homeAddress: t.homeAddress,
33
- city: t.city,
34
- state: t.state,
35
- statePlaceholder: t.statePlaceholder,
36
- zipCode: t.zipCode,
37
- mobilePhoneNumber: t.mobilePhoneNumber,
38
- workEmail: t.workEmail,
39
- ownsOver25Question: t.ownsOver25Question,
40
- ownsOver25SummaryLabel: t.ownsOver25SummaryLabel,
41
- ownsOver25Yes: t.ownsOver25Yes,
42
- ownsOver25No: t.ownsOver25No,
43
- ownershipPercentage: t.ownershipPercentage,
44
- ownershipPercentagePlaceholder: t.ownershipPercentagePlaceholder
45
- };
46
- }
47
- function u(e, t) {
48
- let n = l(t.labels), r = t.stateOptions.find((t) => t.value === e.state)?.label ?? e.state;
49
- return [
50
- {
51
- label: n.firstName,
52
- value: e.firstName,
53
- testId: "about-you-summary-first-name"
54
- },
55
- {
56
- label: n.lastName,
57
- value: e.lastName,
58
- testId: "about-you-summary-last-name"
59
- },
60
- {
61
- label: n.dateOfBirth,
62
- value: s(e.dateOfBirth),
63
- testId: "about-you-summary-dob"
64
- },
65
- {
66
- label: n.ssn,
67
- value: a(e.ssn),
68
- testId: "about-you-summary-ssn",
69
- valueMonospace: !0
70
- },
71
- {
72
- label: n.homeAddress,
73
- value: e.homeAddress,
74
- testId: "about-you-summary-home-address"
75
- },
76
- {
77
- label: n.city,
78
- value: e.city,
79
- testId: "about-you-summary-city"
80
- },
81
- {
82
- label: n.state,
83
- value: r,
84
- testId: "about-you-summary-state"
85
- },
86
- {
87
- label: n.zipCode,
88
- value: e.zipCode,
89
- testId: "about-you-summary-zip-code"
90
- },
91
- {
92
- label: n.mobilePhoneNumber,
93
- value: e.mobilePhoneNumber,
94
- testId: "about-you-summary-mobile-phone"
95
- },
96
- {
97
- label: n.workEmail,
98
- value: e.workEmail,
99
- testId: "about-you-summary-email"
100
- },
101
- {
102
- label: n.ownershipPercentage,
103
- value: e.ownershipPercentage === null ? "" : `${e.ownershipPercentage}%`,
104
- testId: "about-you-summary-ownership-percentage"
105
- }
106
- ];
15
+ function g(e) {
16
+ return h.object({
17
+ companyLegalName: h.string().min(1),
18
+ companyDbaName: h.string(),
19
+ businessAddress: h.string().min(1),
20
+ city: h.string().min(1),
21
+ state: h.string().min(2),
22
+ zipCode: h.string().min(5),
23
+ companyPhoneNumber: h.string().refine((e) => e.replace(/\D/g, "").length === 10, { message: e.companyPhoneNumberInvalid }),
24
+ companyStructure: h.enum([
25
+ "CORPORATION_PUBLIC",
26
+ "CORPORATION_PRIVATE",
27
+ "CORPORATION_NOT_FOR_PROFIT",
28
+ "LLC",
29
+ "LLP",
30
+ "PARTNERSHIP",
31
+ "SOLE_PROPRIETORSHIP",
32
+ "GOVERNMENT",
33
+ "COOPERATIVE",
34
+ "ASSOCIATION",
35
+ "OTHER"
36
+ ]),
37
+ website: h.string().refine((e) => !e || t(e), { message: e.websiteInvalid }),
38
+ taxId: h.string().refine((e) => /^\d{9}$/.test(e), { message: e.taxIdInvalid }),
39
+ naicsCode: h.string().min(1)
40
+ });
107
41
  }
108
- function d(n, r, i) {
109
- let a = (e) => (t) => r({
110
- ...n,
111
- [e]: t
42
+ function _(e) {
43
+ return g(e).extend({
44
+ isAuthorized: h.literal(!0),
45
+ isCheckboxChecked: h.literal(!0)
112
46
  });
113
- return {
114
- firstName: {
115
- value: n.firstName,
116
- onValueChange: a("firstName")
117
- },
118
- lastName: {
119
- value: n.lastName,
120
- onValueChange: a("lastName")
121
- },
122
- dateOfBirth: {
123
- value: n.dateOfBirth,
124
- onValueChange: a("dateOfBirth")
125
- },
126
- ssn: {
127
- value: n.ssn,
128
- onValueChange: (e) => a("ssn")(o(e))
129
- },
130
- homeAddress: {
131
- value: n.homeAddress,
132
- onValueChange: a("homeAddress")
133
- },
134
- city: {
135
- value: n.city,
136
- onValueChange: a("city")
137
- },
138
- state: {
139
- value: n.state,
140
- onValueChange: a("state"),
141
- options: i.stateOptions
142
- },
143
- zipCode: {
144
- value: n.zipCode,
145
- onValueChange: (e) => a("zipCode")(t(e))
146
- },
147
- mobilePhoneNumber: {
148
- value: n.mobilePhoneNumber,
149
- onValueChange: (t) => a("mobilePhoneNumber")(e(t))
150
- },
151
- workEmail: {
152
- value: n.workEmail,
153
- onValueChange: a("workEmail")
154
- },
155
- ownsOver25Percent: {
156
- value: n.ownsOver25Percent === null ? "" : n.ownsOver25Percent ? "yes" : "no",
157
- onValueChange: (e) => r({
158
- ...n,
159
- ownsOver25Percent: e === "" ? null : e === "yes",
160
- ownershipPercentage: e === "yes" ? n.ownershipPercentage : null
161
- })
162
- },
163
- ownershipPercentage: {
164
- value: n.ownershipPercentage,
165
- onValueChange: a("ownershipPercentage")
166
- }
167
- };
168
47
  }
169
- function f(e) {
170
- return {
171
- masked: a(e),
172
- formatted: i(e)
173
- };
48
+ function v({ value: t, onValueChange: h, onSnapshotChange: v, naicsOptions: y, stateOptions: b, isSubmitting: x, labels: S, bankName: C, termsHref: w, privacyHref: T, electronicCommunicationHref: E, patriotActHref: D }) {
49
+ let O = u(() => c(S), [S]), k = u(() => ({
50
+ panelFields: g(O),
51
+ full: _(O)
52
+ }), [O]), A = k.full.safeParse(t), j = A.success ? A.data : null, M = k.panelFields.safeParse(t).success, N = JSON.stringify(j), P = d(v);
53
+ P.current = v, l(() => {
54
+ P.current(j);
55
+ }, [N]);
56
+ let [F, I] = f(() => !M);
57
+ l(() => {
58
+ M || I(!0);
59
+ }, [M]);
60
+ let L = u(() => ({
61
+ stateOptions: b,
62
+ naicsOptions: y,
63
+ labels: S
64
+ }), [
65
+ b,
66
+ y,
67
+ S
68
+ ]), R = u(() => a(S), [S]), z = u(() => o(t, L), [t, L]), B = u(() => i(t, h, L), [
69
+ t,
70
+ h,
71
+ L
72
+ ]), V = s(t.website);
73
+ return /* @__PURE__ */ m("div", {
74
+ className: "ttw:flex ttw:flex-col ttw:gap-6",
75
+ children: [/* @__PURE__ */ p(n, {
76
+ isEditing: F,
77
+ onEditClick: () => I(!0),
78
+ summaryRows: z,
79
+ editFields: B,
80
+ labels: R,
81
+ isDisabled: x,
82
+ websiteInvalid: V,
83
+ testIds: {
84
+ root: e.businessDetailsPanel,
85
+ editButton: e.businessDetailsEditButton,
86
+ summary: { root: e.businessDetailsSummary },
87
+ editForm: {
88
+ root: e.businessDetailsEditForm,
89
+ naicsCombobox: e.businessDetailsNaicsCombobox
90
+ }
91
+ }
92
+ }), /* @__PURE__ */ p(r, {
93
+ value: {
94
+ isAuthorized: t.isAuthorized,
95
+ isCheckboxChecked: t.isCheckboxChecked
96
+ },
97
+ onChange: (e) => h({
98
+ ...t,
99
+ ...e
100
+ }),
101
+ isSubmitting: x,
102
+ labels: S,
103
+ bankName: C,
104
+ termsHref: w,
105
+ privacyHref: T,
106
+ electronicCommunicationHref: E,
107
+ patriotActHref: D,
108
+ testIds: {
109
+ authorizationCheckbox: e.authorizationCheckbox,
110
+ disclosureCheckbox: e.disclosureCheckbox
111
+ }
112
+ })]
113
+ });
174
114
  }
175
115
  //#endregion
176
- export { d as buildAboutYouEditFields, l as buildAboutYouPanelLabels, u as buildAboutYouSummaryRows, f as buildSsnDisplayValues, c as mergePersonalDetailsLabels };
116
+ export { v as BusinessDetailsStep };
@@ -1,69 +1,176 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { AboutYouPanel as e } from "../../ui/dist/index22.js";
1
+ import { formatPhoneNumberInput as e } from "./index2.js";
2
+ import { sanitizeZipCodeInput as t } from "./index3.js";
3
+ import { PERSONAL_DETAILS_LABELS_EN as n } from "../../ui/dist/index7.js";
4
+ import { ABOUT_YOU_PANEL_LABELS_EN as r } from "../../ui/dist/index21.js";
6
5
  import "../../ui/dist/index.js";
7
- import { getMaxBirthDate as t, isAtLeastMinOwnerAge as n } from "./index7.js";
8
- import { buildAboutYouEditFields as r, buildAboutYouPanelLabels as i, buildAboutYouSummaryRows as a, buildSsnDisplayValues as o, mergePersonalDetailsLabels as s } from "./index10.js";
9
- import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
10
- import { jsx as f } from "react/jsx-runtime";
11
- import { z as p } from "zod";
6
+ import { formatSsnInput as i, maskSsn as a, sanitizeSsnDigits as o } from "./index4.js";
12
7
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index11.js
13
- function m(e) {
14
- return p.object({
15
- firstName: p.string().min(1),
16
- lastName: p.string().min(1),
17
- dateOfBirth: p.date().refine(n, { message: e.dateOfBirthMinAgeError }),
18
- ssn: p.string().refine((e) => /^\d{9}$/.test(e), { message: e.ssnInvalid }),
19
- homeAddress: p.string().min(1),
20
- city: p.string().min(1),
21
- state: p.string().min(2),
22
- zipCode: p.string().min(5),
23
- mobilePhoneNumber: p.string().refine((e) => e.replace(/\D/g, "").length === 10, { message: e.mobilePhoneNumberInvalid }),
24
- workEmail: p.email(),
25
- ownsOver25Percent: p.boolean(),
26
- ownershipPercentage: p.number().min(0).max(100).nullable()
27
- }).refine((e) => e.ownsOver25Percent === !1 || e.ownershipPercentage !== null && e.ownershipPercentage >= 25 && e.ownershipPercentage <= 100, {
28
- message: e.ownershipPercentageRangeError,
29
- path: ["ownershipPercentage"]
30
- });
8
+ function s(e) {
9
+ return e ? e.toLocaleDateString("en-US", {
10
+ month: "short",
11
+ day: "numeric",
12
+ year: "numeric"
13
+ }) : "";
14
+ }
15
+ function c(e) {
16
+ return {
17
+ ...n,
18
+ ...e
19
+ };
20
+ }
21
+ function l(e) {
22
+ let t = c(e);
23
+ return {
24
+ ...r,
25
+ firstName: t.firstName,
26
+ lastName: t.lastName,
27
+ dateOfBirth: t.dateOfBirth,
28
+ dateOfBirthPlaceholder: t.dateOfBirthPlaceholder,
29
+ ssn: t.ssn,
30
+ ssnShow: t.ssnShow,
31
+ ssnHide: t.ssnHide,
32
+ homeAddress: t.homeAddress,
33
+ city: t.city,
34
+ state: t.state,
35
+ statePlaceholder: t.statePlaceholder,
36
+ zipCode: t.zipCode,
37
+ mobilePhoneNumber: t.mobilePhoneNumber,
38
+ workEmail: t.workEmail,
39
+ ownsOver25Question: t.ownsOver25Question,
40
+ ownsOver25SummaryLabel: t.ownsOver25SummaryLabel,
41
+ ownsOver25Yes: t.ownsOver25Yes,
42
+ ownsOver25No: t.ownsOver25No,
43
+ ownershipPercentage: t.ownershipPercentage,
44
+ ownershipPercentagePlaceholder: t.ownershipPercentagePlaceholder
45
+ };
31
46
  }
32
- function h({ value: n, onValueChange: p, onSnapshotChange: h, stateOptions: g, isSubmitting: _, labels: v }) {
33
- let y = l(() => s(v), [v]), b = l(() => m(y), [y]).safeParse(n), x = b.success ? b.data : null, S = JSON.stringify({
34
- ...x,
35
- dateOfBirth: x?.dateOfBirth?.toISOString()
36
- }), C = u(h);
37
- C.current = h, c(() => {
38
- C.current(x);
39
- }, [S]);
40
- let [w, T] = d(() => x === null), [E, D] = d(!1);
41
- c(() => {
42
- x === null && T(!0);
43
- }, [S]);
44
- let O = l(() => ({
45
- stateOptions: g,
46
- labels: v
47
- }), [g, v]), k = l(() => i(v), [v]), A = l(() => a(n, O), [n, O]), j = l(() => r(n, p, O), [
48
- n,
49
- p,
50
- O
51
- ]), M = l(() => o(n.ssn), [n.ssn]), N = l(() => t(), []);
52
- return /* @__PURE__ */ f(e, {
53
- isEditing: w,
54
- onEditClick: () => T(!0),
55
- summaryRows: A,
56
- editFields: j,
57
- labels: k,
58
- isDisabled: _,
59
- ssnRevealed: E,
60
- ssnToggleAriaLabel: E ? k.ssnHide : k.ssnShow,
61
- onToggleSsnVisibility: () => D((e) => !e),
62
- showOwnershipPercentage: n.ownsOver25Percent === !0,
63
- maxBirthDate: N,
64
- ssnMaskedDisplay: M.masked,
65
- ssnFormattedDisplay: M.formatted
47
+ function u(e, t) {
48
+ let n = l(t.labels), r = t.stateOptions.find((t) => t.value === e.state)?.label ?? e.state;
49
+ return [
50
+ {
51
+ label: n.firstName,
52
+ value: e.firstName,
53
+ testId: "about-you-summary-first-name"
54
+ },
55
+ {
56
+ label: n.lastName,
57
+ value: e.lastName,
58
+ testId: "about-you-summary-last-name"
59
+ },
60
+ {
61
+ label: n.dateOfBirth,
62
+ value: s(e.dateOfBirth),
63
+ testId: "about-you-summary-dob"
64
+ },
65
+ {
66
+ label: n.ssn,
67
+ value: a(e.ssn),
68
+ testId: "about-you-summary-ssn",
69
+ valueMonospace: !0
70
+ },
71
+ {
72
+ label: n.homeAddress,
73
+ value: e.homeAddress,
74
+ testId: "about-you-summary-home-address"
75
+ },
76
+ {
77
+ label: n.city,
78
+ value: e.city,
79
+ testId: "about-you-summary-city"
80
+ },
81
+ {
82
+ label: n.state,
83
+ value: r,
84
+ testId: "about-you-summary-state"
85
+ },
86
+ {
87
+ label: n.zipCode,
88
+ value: e.zipCode,
89
+ testId: "about-you-summary-zip-code"
90
+ },
91
+ {
92
+ label: n.mobilePhoneNumber,
93
+ value: e.mobilePhoneNumber,
94
+ testId: "about-you-summary-mobile-phone"
95
+ },
96
+ {
97
+ label: n.workEmail,
98
+ value: e.workEmail,
99
+ testId: "about-you-summary-email"
100
+ },
101
+ {
102
+ label: n.ownershipPercentage,
103
+ value: e.ownershipPercentage === null ? "" : `${e.ownershipPercentage}%`,
104
+ testId: "about-you-summary-ownership-percentage"
105
+ }
106
+ ];
107
+ }
108
+ function d(n, r, i) {
109
+ let a = (e) => (t) => r({
110
+ ...n,
111
+ [e]: t
66
112
  });
113
+ return {
114
+ firstName: {
115
+ value: n.firstName,
116
+ onValueChange: a("firstName")
117
+ },
118
+ lastName: {
119
+ value: n.lastName,
120
+ onValueChange: a("lastName")
121
+ },
122
+ dateOfBirth: {
123
+ value: n.dateOfBirth,
124
+ onValueChange: a("dateOfBirth")
125
+ },
126
+ ssn: {
127
+ value: n.ssn,
128
+ onValueChange: (e) => a("ssn")(o(e))
129
+ },
130
+ homeAddress: {
131
+ value: n.homeAddress,
132
+ onValueChange: a("homeAddress")
133
+ },
134
+ city: {
135
+ value: n.city,
136
+ onValueChange: a("city")
137
+ },
138
+ state: {
139
+ value: n.state,
140
+ onValueChange: a("state"),
141
+ options: i.stateOptions
142
+ },
143
+ zipCode: {
144
+ value: n.zipCode,
145
+ onValueChange: (e) => a("zipCode")(t(e))
146
+ },
147
+ mobilePhoneNumber: {
148
+ value: n.mobilePhoneNumber,
149
+ onValueChange: (t) => a("mobilePhoneNumber")(e(t))
150
+ },
151
+ workEmail: {
152
+ value: n.workEmail,
153
+ onValueChange: a("workEmail")
154
+ },
155
+ ownsOver25Percent: {
156
+ value: n.ownsOver25Percent === null ? "" : n.ownsOver25Percent ? "yes" : "no",
157
+ onValueChange: (e) => r({
158
+ ...n,
159
+ ownsOver25Percent: e === "" ? null : e === "yes",
160
+ ownershipPercentage: e === "yes" ? n.ownershipPercentage : null
161
+ })
162
+ },
163
+ ownershipPercentage: {
164
+ value: n.ownershipPercentage,
165
+ onValueChange: a("ownershipPercentage")
166
+ }
167
+ };
168
+ }
169
+ function f(e) {
170
+ return {
171
+ masked: a(e),
172
+ formatted: i(e)
173
+ };
67
174
  }
68
175
  //#endregion
69
- export { h as PersonalDetailsStep };
176
+ export { d as buildAboutYouEditFields, l as buildAboutYouPanelLabels, u as buildAboutYouSummaryRows, f as buildSsnDisplayValues, c as mergePersonalDetailsLabels };