@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,87 +1,79 @@
1
- import { formatPhoneNumberInput as e } from "./index2.js";
2
- import { sanitizeZipCodeInput as t } from "./index3.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { bankAccountOnboardingTestIds as e } from "./index9.js";
6
+ import { AboutYouPanel as t } from "../../ui/dist/index22.js";
7
+ import "../../ui/dist/index.js";
3
8
  import { getMaxBirthDate as n, isAtLeastMinOwnerAge as r } from "./index7.js";
4
- import { formatSsnInput as i, maskSsn as a, sanitizeSsnDigits as o } from "./index4.js";
9
+ import { buildAboutYouEditFields as i, buildAboutYouPanelLabels as a, buildAboutYouSummaryRows as o, buildSsnDisplayValues as s, mergePersonalDetailsLabels as c } from "./index11.js";
10
+ import { useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
11
+ import { jsx as p } from "react/jsx-runtime";
12
+ import { z as m } from "zod";
5
13
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js
6
- var s = {
7
- firstName: "",
8
- lastName: "",
9
- dateOfBirth: void 0,
10
- ssn: "",
11
- homeAddress: "",
12
- city: "",
13
- state: "",
14
- zipCode: "",
15
- mobilePhoneNumber: "",
16
- ownsOver25Percent: null,
17
- ownershipPercentage: null
18
- };
19
- function c(n) {
20
- return {
21
- ...n,
22
- ssn: o(n.ssn),
23
- zipCode: t(n.zipCode),
24
- mobilePhoneNumber: e(n.mobilePhoneNumber),
25
- ownsOver25Percent: n.ownershipPercentage === null ? null : n.ownershipPercentage >= 25
26
- };
14
+ function h(e) {
15
+ return m.object({
16
+ firstName: m.string().min(1),
17
+ lastName: m.string().min(1),
18
+ dateOfBirth: m.date().refine(r, { message: e.dateOfBirthMinAgeError }),
19
+ ssn: m.string().refine((e) => /^\d{9}$/.test(e), { message: e.ssnInvalid }),
20
+ homeAddress: m.string().min(1),
21
+ city: m.string().min(1),
22
+ state: m.string().min(2),
23
+ zipCode: m.string().min(5),
24
+ mobilePhoneNumber: m.string().refine((e) => e.replace(/\D/g, "").length === 10, { message: e.mobilePhoneNumberInvalid }),
25
+ workEmail: m.email(),
26
+ ownsOver25Percent: m.boolean(),
27
+ ownershipPercentage: m.number().min(0).max(100).nullable()
28
+ }).refine((e) => e.ownsOver25Percent === !1 || e.ownershipPercentage !== null && e.ownershipPercentage >= 25 && e.ownershipPercentage <= 100, {
29
+ message: e.ownershipPercentageRangeError,
30
+ path: ["ownershipPercentage"]
31
+ });
27
32
  }
28
- function l(e) {
29
- return {
30
- dateOfBirthInvalid: e.dateOfBirth !== void 0 && !r(e.dateOfBirth),
31
- ownershipPercentageInvalid: e.ownershipPercentage !== null && e.ownershipPercentage < 25,
32
- maxBirthDate: n(),
33
- ssnMaskedDisplay: a(e.ssn),
34
- ssnFormattedDisplay: i(e.ssn)
35
- };
36
- }
37
- function u(e, t, n) {
38
- let r = (n) => (r) => t(c({
39
- ...e,
40
- [n]: r
41
- }));
42
- return {
43
- firstName: {
44
- value: e.firstName,
45
- onValueChange: r("firstName")
46
- },
47
- lastName: {
48
- value: e.lastName,
49
- onValueChange: r("lastName")
50
- },
51
- dateOfBirth: {
52
- value: e.dateOfBirth,
53
- onValueChange: r("dateOfBirth")
54
- },
55
- ssn: {
56
- value: e.ssn,
57
- onValueChange: (e) => r("ssn")(e)
58
- },
59
- homeAddress: {
60
- value: e.homeAddress,
61
- onValueChange: r("homeAddress")
62
- },
63
- city: {
64
- value: e.city,
65
- onValueChange: r("city")
66
- },
67
- state: {
68
- value: e.state,
69
- onValueChange: r("state"),
70
- options: n.stateOptions
71
- },
72
- zipCode: {
73
- value: e.zipCode,
74
- onValueChange: (e) => r("zipCode")(e)
75
- },
76
- mobilePhoneNumber: {
77
- value: e.mobilePhoneNumber,
78
- onValueChange: (e) => r("mobilePhoneNumber")(e)
79
- },
80
- ownershipPercentage: {
81
- value: e.ownershipPercentage,
82
- onValueChange: r("ownershipPercentage")
33
+ function g({ value: r, onValueChange: m, onSnapshotChange: g, stateOptions: _, isSubmitting: v, labels: y }) {
34
+ let b = u(() => c(y), [y]), x = u(() => h(b), [b]).safeParse(r), S = x.success ? x.data : null, C = JSON.stringify({
35
+ ...S,
36
+ dateOfBirth: S?.dateOfBirth?.toISOString()
37
+ }), w = d(g);
38
+ w.current = g, l(() => {
39
+ w.current(S);
40
+ }, [C]);
41
+ let [T, E] = f(() => S === null), [D, O] = f(!1);
42
+ l(() => {
43
+ S === null && E(!0);
44
+ }, [C]);
45
+ let k = u(() => ({
46
+ stateOptions: _,
47
+ labels: y
48
+ }), [_, y]), A = u(() => a(y), [y]), j = u(() => o(r, k), [r, k]), M = u(() => i(r, m, k), [
49
+ r,
50
+ m,
51
+ k
52
+ ]), N = u(() => s(r.ssn), [r.ssn]), P = u(() => n(), []);
53
+ return /* @__PURE__ */ p(t, {
54
+ isEditing: T,
55
+ onEditClick: () => E(!0),
56
+ summaryRows: j,
57
+ editFields: M,
58
+ labels: A,
59
+ isDisabled: v,
60
+ ssnRevealed: D,
61
+ ssnToggleAriaLabel: D ? A.ssnHide : A.ssnShow,
62
+ onToggleSsnVisibility: () => O((e) => !e),
63
+ showOwnershipPercentage: r.ownsOver25Percent === !0,
64
+ maxBirthDate: P,
65
+ ssnMaskedDisplay: N.masked,
66
+ ssnFormattedDisplay: N.formatted,
67
+ testIds: {
68
+ root: e.aboutYouPanel,
69
+ editButton: e.aboutYouEditButton,
70
+ summary: { root: e.aboutYouSummary },
71
+ editForm: {
72
+ root: e.aboutYouEditForm,
73
+ ownsOver25Question: e.aboutYouOwnsOver25Question
74
+ }
83
75
  }
84
- };
76
+ });
85
77
  }
86
78
  //#endregion
87
- export { s as EMPTY_ADDITIONAL_OWNER, l as buildAdditionalOwnerEditDisplay, u as buildAdditionalOwnerEditFields, c as normalizeAdditionalOwnerDraft };
79
+ export { g as PersonalDetailsStep };
@@ -1,111 +1,87 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { ADDITIONAL_OWNERS_LABELS_EN as e } from "../../ui/dist/index4.js";
6
- import { AdditionalOwnersForm as t } from "../../ui/dist/index5.js";
7
- import "../../ui/dist/index.js";
8
- import { isAtLeastMinOwnerAge as n } from "./index7.js";
9
- import { EMPTY_ADDITIONAL_OWNER as r, buildAdditionalOwnerEditDisplay as i, buildAdditionalOwnerEditFields as a, normalizeAdditionalOwnerDraft as o } from "./index12.js";
10
- import { useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
11
- import { jsx as d } from "react/jsx-runtime";
12
- import { z as f } from "zod";
1
+ import { formatPhoneNumberInput as e } from "./index2.js";
2
+ import { sanitizeZipCodeInput as t } from "./index3.js";
3
+ import { getMaxBirthDate as n, isAtLeastMinOwnerAge as r } from "./index7.js";
4
+ import { formatSsnInput as i, maskSsn as a, sanitizeSsnDigits as o } from "./index4.js";
13
5
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index13.js
14
- function p(e) {
15
- return f.object({
16
- firstName: f.string().min(1),
17
- lastName: f.string().min(1),
18
- dateOfBirth: f.date().refine(n, { message: e.dateOfBirthMinAgeError }),
19
- ssn: f.string().refine((e) => /^\d{9}$/.test(e), { message: e.ssnInvalid }),
20
- homeAddress: f.string().min(1),
21
- city: f.string().min(1),
22
- state: f.string().min(2),
23
- zipCode: f.string().min(5),
24
- mobilePhoneNumber: f.string().refine((e) => e.replace(/\D/g, "").length === 10, { message: e.mobilePhoneNumberInvalid }),
25
- ownsOver25Percent: f.literal(!0),
26
- ownershipPercentage: f.number().min(25).max(100)
27
- });
28
- }
29
- function m(e) {
30
- return e.ownershipPercentage !== null && e.ownershipPercentage >= 25 ? e.ownershipPercentage : 0;
31
- }
32
- function h(e) {
33
- return `${m(e)}%`;
6
+ var s = {
7
+ firstName: "",
8
+ lastName: "",
9
+ dateOfBirth: void 0,
10
+ ssn: "",
11
+ homeAddress: "",
12
+ city: "",
13
+ state: "",
14
+ zipCode: "",
15
+ mobilePhoneNumber: "",
16
+ ownsOver25Percent: null,
17
+ ownershipPercentage: null
18
+ };
19
+ function c(n) {
20
+ return {
21
+ ...n,
22
+ ssn: o(n.ssn),
23
+ zipCode: t(n.zipCode),
24
+ mobilePhoneNumber: e(n.mobilePhoneNumber),
25
+ ownsOver25Percent: n.ownershipPercentage === null ? null : n.ownershipPercentage >= 25
26
+ };
34
27
  }
35
- function g(e) {
28
+ function l(e) {
36
29
  return {
37
- name: `${e.firstName} ${e.lastName}`.trim(),
38
- shareDisplay: h(e)
30
+ dateOfBirthInvalid: e.dateOfBirth !== void 0 && !r(e.dateOfBirth),
31
+ ownershipPercentageInvalid: e.ownershipPercentage !== null && e.ownershipPercentage < 25,
32
+ maxBirthDate: n(),
33
+ ssnMaskedDisplay: a(e.ssn),
34
+ ssnFormattedDisplay: i(e.ssn)
39
35
  };
40
36
  }
41
- function _({ owners: n, onOwnersChange: f, primaryOwnerName: h, primaryOwnerPercentage: _, stateOptions: v, onSnapshotChange: y, isSubmitting: b, labels: x }) {
42
- let S = c(() => ({
37
+ function u(e, t, n) {
38
+ let r = (n) => (r) => t(c({
43
39
  ...e,
44
- ...x
45
- }), [x]), C = c(() => p(S), [S]), [w, T] = u(null), [E, D] = u(null), [O, k] = u(null), [A, j] = u(!1), M = (e) => {
46
- T(o(e));
47
- }, N = _ + n.reduce((e, t) => e + m(t), 0), P = N > 100 ? S.totalOwnershipExceedsTemplate(N) : null, F = N > 75, I = `${_}%`, L = _ >= 25, R = n.every((e) => C.safeParse(e).success), z = w !== null && C.safeParse(w).success, B = R && P === null && w === null && O === null ? n : null, V = JSON.stringify({ snapshot: B?.map((e) => ({
48
- ...e,
49
- dateOfBirth: e.dateOfBirth?.toISOString()
50
- })) }), H = l(y);
51
- H.current = y, s(() => {
52
- H.current(B);
53
- }, [V]);
54
- let U = () => {
55
- D(null), j(!1), T({ ...r });
56
- }, W = (e) => {
57
- D(e), j(!1), T(o({ ...n[e] }));
58
- }, G = (e) => {
59
- let t = n[e];
60
- k({
61
- index: e,
62
- displayName: `${t.firstName} ${t.lastName}`.trim()
63
- });
64
- }, K = () => {
65
- O && (f(n.filter((e, t) => t !== O.index)), k(null));
66
- }, q = () => {
67
- k(null);
68
- }, J = w ? {
69
- fields: a(w, M, { stateOptions: v }),
70
- display: i(w),
71
- isExisting: E !== null,
72
- isValid: z,
73
- ssnRevealed: A,
74
- ssnToggleAriaLabel: A ? S.ssnHide : S.ssnShow,
75
- onToggleSsnVisibility: () => j((e) => !e),
76
- onSubmit: () => {
77
- if (!w) return;
78
- let e = C.safeParse(w);
79
- if (e.success) {
80
- if (E === null) f([...n, e.data]);
81
- else {
82
- let t = [...n];
83
- t[E] = e.data, f(t);
84
- }
85
- T(null), D(null), j(!1);
86
- }
40
+ [n]: r
41
+ }));
42
+ return {
43
+ firstName: {
44
+ value: e.firstName,
45
+ onValueChange: r("firstName")
46
+ },
47
+ lastName: {
48
+ value: e.lastName,
49
+ onValueChange: r("lastName")
50
+ },
51
+ dateOfBirth: {
52
+ value: e.dateOfBirth,
53
+ onValueChange: r("dateOfBirth")
87
54
  },
88
- onCancel: () => {
89
- T(null), D(null), j(!1);
55
+ ssn: {
56
+ value: e.ssn,
57
+ onValueChange: (e) => r("ssn")(e)
58
+ },
59
+ homeAddress: {
60
+ value: e.homeAddress,
61
+ onValueChange: r("homeAddress")
62
+ },
63
+ city: {
64
+ value: e.city,
65
+ onValueChange: r("city")
66
+ },
67
+ state: {
68
+ value: e.state,
69
+ onValueChange: r("state"),
70
+ options: n.stateOptions
71
+ },
72
+ zipCode: {
73
+ value: e.zipCode,
74
+ onValueChange: (e) => r("zipCode")(e)
75
+ },
76
+ mobilePhoneNumber: {
77
+ value: e.mobilePhoneNumber,
78
+ onValueChange: (e) => r("mobilePhoneNumber")(e)
79
+ },
80
+ ownershipPercentage: {
81
+ value: e.ownershipPercentage,
82
+ onValueChange: r("ownershipPercentage")
90
83
  }
91
- } : null;
92
- return /* @__PURE__ */ d(t, {
93
- ownerRows: n.map(g),
94
- primaryOwnerName: h,
95
- primaryOwnerShareDisplay: I,
96
- showPrimaryOwner: L,
97
- totalOwnershipError: P,
98
- addOwnerDisabled: F,
99
- onAddOwner: U,
100
- onEditOwner: W,
101
- onDeleteOwnerRequest: G,
102
- deletingOwnerName: O?.displayName ?? null,
103
- onDeleteOwnerConfirm: K,
104
- onDeleteOwnerCancel: q,
105
- editingOverlay: J,
106
- isSubmitting: b,
107
- labels: x
108
- });
84
+ };
109
85
  }
110
86
  //#endregion
111
- export { _ as AdditionalOwnersStep, m as getAdditionalOwnerShare };
87
+ export { s as EMPTY_ADDITIONAL_OWNER, l as buildAdditionalOwnerEditDisplay, u as buildAdditionalOwnerEditFields, c as normalizeAdditionalOwnerDraft };
@@ -1,93 +1,120 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { bankAccountOnboardingTestIds as e } from "./index9.js";
6
+ import { ADDITIONAL_OWNERS_LABELS_EN as t } from "../../ui/dist/index4.js";
7
+ import { AdditionalOwnersForm as n } from "../../ui/dist/index5.js";
8
+ import "../../ui/dist/index.js";
9
+ import { isAtLeastMinOwnerAge as r } from "./index7.js";
10
+ import { EMPTY_ADDITIONAL_OWNER as i, buildAdditionalOwnerEditDisplay as a, buildAdditionalOwnerEditFields as o, normalizeAdditionalOwnerDraft as s } from "./index13.js";
11
+ import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
12
+ import { jsx as f } from "react/jsx-runtime";
13
+ import { z as p } from "zod";
1
14
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js
2
- var e = (e) => e.replace(/\D/g, "").slice(0, 10), t = (e) => `${e.getFullYear().toString().padStart(4, "0")}-${(e.getMonth() + 1).toString().padStart(2, "0")}-${e.getDate().toString().padStart(2, "0")}`;
3
- function n(e) {
4
- return {
5
- address1: e.address1,
6
- city: e.city,
7
- state: e.state,
8
- postalCode: e.postalCode,
9
- countryCode: "USA"
10
- };
15
+ function m(e) {
16
+ return p.object({
17
+ firstName: p.string().min(1),
18
+ lastName: p.string().min(1),
19
+ dateOfBirth: p.date().refine(r, { message: e.dateOfBirthMinAgeError }),
20
+ ssn: p.string().refine((e) => /^\d{9}$/.test(e), { message: e.ssnInvalid }),
21
+ homeAddress: p.string().min(1),
22
+ city: p.string().min(1),
23
+ state: p.string().min(2),
24
+ zipCode: p.string().min(5),
25
+ mobilePhoneNumber: p.string().refine((e) => e.replace(/\D/g, "").length === 10, { message: e.mobilePhoneNumberInvalid }),
26
+ ownsOver25Percent: p.literal(!0),
27
+ ownershipPercentage: p.number().min(25).max(100)
28
+ });
11
29
  }
12
- function r(t) {
13
- return {
14
- legalName: t.companyLegalName,
15
- dbaName: t.companyDbaName.trim() || null,
16
- address: n({
17
- address1: t.businessAddress,
18
- city: t.city,
19
- state: t.state,
20
- postalCode: t.zipCode
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
- };
30
+ function h(e) {
31
+ return e.ownershipPercentage !== null && e.ownershipPercentage >= 25 ? e.ownershipPercentage : 0;
31
32
  }
32
- function i(e) {
33
- return {
34
- isLegallyAuthorized: e.isAuthorized,
35
- hasAcceptedDisclosures: e.isCheckboxChecked
36
- };
33
+ function g(e) {
34
+ return `${h(e)}%`;
37
35
  }
38
- var a = 1;
39
- function o(r, { isSoleProprietor: i = !1 } = {}) {
36
+ function _(e) {
40
37
  return {
41
- firstName: r.firstName,
42
- lastName: r.lastName,
43
- birthDate: t(r.dateOfBirth),
44
- personalIdentificationNumber: {
45
- type: "SSN",
46
- value: r.ssn
47
- },
48
- homeAddress: n({
49
- address1: r.homeAddress,
50
- city: r.city,
51
- state: r.state,
52
- postalCode: r.zipCode
53
- }),
54
- mobilePhoneNumber: e(r.mobilePhoneNumber),
55
- workEmailAddress: r.workEmail,
56
- ownershipPercentage: i ? a : r.ownsOver25Percent && r.ownershipPercentage !== null ? r.ownershipPercentage / 100 : 0
38
+ name: `${e.firstName} ${e.lastName}`.trim(),
39
+ shareDisplay: g(e)
57
40
  };
58
41
  }
59
- function s(r) {
60
- return r.map((r) => ({
61
- firstName: r.firstName,
62
- lastName: r.lastName,
63
- birthDate: r.dateOfBirth ? t(r.dateOfBirth) : void 0,
64
- homeAddress: n({
65
- address1: r.homeAddress,
66
- city: r.city,
67
- state: r.state,
68
- postalCode: r.zipCode
69
- }),
70
- mobilePhoneNumber: e(r.mobilePhoneNumber),
71
- ownershipPercentage: r.ownershipPercentage !== null && r.ownershipPercentage >= 25 ? r.ownershipPercentage / 100 : 0,
72
- personalIdentificationNumber: {
73
- type: "SSN",
74
- value: r.ssn
42
+ function v({ owners: r, onOwnersChange: p, primaryOwnerName: g, primaryOwnerPercentage: v, stateOptions: y, onSnapshotChange: b, isSubmitting: x, labels: S }) {
43
+ let C = l(() => ({
44
+ ...t,
45
+ ...S
46
+ }), [S]), w = l(() => m(C), [C]), [T, E] = d(null), [D, O] = d(null), [k, A] = d(null), [j, M] = d(!1), N = (e) => {
47
+ E(s(e));
48
+ }, P = v + r.reduce((e, t) => e + h(t), 0), F = P > 100 ? C.totalOwnershipExceedsTemplate(P) : null, I = P > 75, L = `${v}%`, R = v >= 25, z = r.every((e) => w.safeParse(e).success), B = T !== null && w.safeParse(T).success, V = z && F === null && T === null && k === null ? r : null, H = JSON.stringify({ snapshot: V?.map((e) => ({
49
+ ...e,
50
+ dateOfBirth: e.dateOfBirth?.toISOString()
51
+ })) }), U = u(b);
52
+ U.current = b, c(() => {
53
+ U.current(V);
54
+ }, [H]);
55
+ let W = () => {
56
+ O(null), M(!1), E({ ...i });
57
+ }, G = (e) => {
58
+ O(e), M(!1), E(s({ ...r[e] }));
59
+ }, K = (e) => {
60
+ let t = r[e];
61
+ A({
62
+ index: e,
63
+ displayName: `${t.firstName} ${t.lastName}`.trim()
64
+ });
65
+ }, q = () => {
66
+ k && (p(r.filter((e, t) => t !== k.index)), A(null));
67
+ }, J = () => {
68
+ A(null);
69
+ }, Y = T ? {
70
+ fields: o(T, N, { stateOptions: y }),
71
+ display: a(T),
72
+ isExisting: D !== null,
73
+ isValid: B,
74
+ ssnRevealed: j,
75
+ ssnToggleAriaLabel: j ? C.ssnHide : C.ssnShow,
76
+ onToggleSsnVisibility: () => M((e) => !e),
77
+ onSubmit: () => {
78
+ if (!T) return;
79
+ let e = w.safeParse(T);
80
+ if (e.success) {
81
+ if (D === null) p([...r, e.data]);
82
+ else {
83
+ let t = [...r];
84
+ t[D] = e.data, p(t);
85
+ }
86
+ E(null), O(null), M(!1);
87
+ }
88
+ },
89
+ onCancel: () => {
90
+ E(null), O(null), M(!1);
75
91
  }
76
- }));
77
- }
78
- function c(e) {
79
- return {
80
- businessDetails: r(e),
81
- applicant: i(e)
82
- };
83
- }
84
- function l(e) {
85
- let t = e.businessDetails?.companyStructure === "SOLE_PROPRIETORSHIP";
86
- return {
87
- ...e.businessDetails && { businessDetails: r(e.businessDetails) },
88
- ...e.applicant && { applicant: o(e.applicant, { isSoleProprietor: t }) },
89
- ...(t || e.businessOwners !== void 0) && { businessOwners: !t && e.businessOwners?.length ? s(e.businessOwners) : null }
90
- };
92
+ } : null;
93
+ return /* @__PURE__ */ f(n, {
94
+ ownerRows: r.map(_),
95
+ primaryOwnerName: g,
96
+ primaryOwnerShareDisplay: L,
97
+ showPrimaryOwner: R,
98
+ totalOwnershipError: F,
99
+ addOwnerDisabled: I,
100
+ onAddOwner: W,
101
+ onEditOwner: G,
102
+ onDeleteOwnerRequest: K,
103
+ deletingOwnerName: k?.displayName ?? null,
104
+ onDeleteOwnerConfirm: q,
105
+ onDeleteOwnerCancel: J,
106
+ editingOverlay: Y,
107
+ isSubmitting: x,
108
+ labels: S,
109
+ testIds: {
110
+ addOwnerButton: e.addOwnerButton,
111
+ overlay: { root: e.shellOverlay },
112
+ deleteOverlay: {
113
+ root: e.ownerDeleteOverlay,
114
+ content: e.ownerDeleteContent
115
+ }
116
+ }
117
+ });
91
118
  }
92
119
  //#endregion
93
- export { i as buildApplicantForCreate, o as buildApplicantForUpdate, r as buildBusinessDetails, s as buildBusinessOwners, c as buildCreateApplicationBody, l as buildUpdateApplicationBody };
120
+ export { v as AdditionalOwnersStep, h as getAdditionalOwnerShare };
@@ -1,9 +1,93 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js
2
- var e = {
3
- Mounted: "onboarding.mounted",
4
- OpenMarketing: "onboarding_widget_open_marketing_widget",
5
- BeginOnboarding: "onboarding_widget_begin_onboarding",
6
- Suppressed: "onboarding.suppressed"
7
- }, t = "onboarding";
2
+ var e = (e) => e.replace(/\D/g, "").slice(0, 10), t = (e) => `${e.getFullYear().toString().padStart(4, "0")}-${(e.getMonth() + 1).toString().padStart(2, "0")}-${e.getDate().toString().padStart(2, "0")}`;
3
+ function n(e) {
4
+ return {
5
+ address1: e.address1,
6
+ city: e.city,
7
+ state: e.state,
8
+ postalCode: e.postalCode,
9
+ countryCode: "USA"
10
+ };
11
+ }
12
+ function r(t) {
13
+ return {
14
+ legalName: t.companyLegalName,
15
+ dbaName: t.companyDbaName.trim() || null,
16
+ address: n({
17
+ address1: t.businessAddress,
18
+ city: t.city,
19
+ state: t.state,
20
+ postalCode: t.zipCode
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
36
+ };
37
+ }
38
+ var a = 1;
39
+ function o(r, { isSoleProprietor: i = !1 } = {}) {
40
+ return {
41
+ firstName: r.firstName,
42
+ lastName: r.lastName,
43
+ birthDate: t(r.dateOfBirth),
44
+ personalIdentificationNumber: {
45
+ type: "SSN",
46
+ value: r.ssn
47
+ },
48
+ homeAddress: n({
49
+ address1: r.homeAddress,
50
+ city: r.city,
51
+ state: r.state,
52
+ postalCode: r.zipCode
53
+ }),
54
+ mobilePhoneNumber: e(r.mobilePhoneNumber),
55
+ workEmailAddress: r.workEmail,
56
+ ownershipPercentage: i ? a : r.ownsOver25Percent && r.ownershipPercentage !== null ? r.ownershipPercentage / 100 : 0
57
+ };
58
+ }
59
+ function s(r) {
60
+ return r.map((r) => ({
61
+ firstName: r.firstName,
62
+ lastName: r.lastName,
63
+ birthDate: r.dateOfBirth ? t(r.dateOfBirth) : void 0,
64
+ homeAddress: n({
65
+ address1: r.homeAddress,
66
+ city: r.city,
67
+ state: r.state,
68
+ postalCode: r.zipCode
69
+ }),
70
+ mobilePhoneNumber: e(r.mobilePhoneNumber),
71
+ ownershipPercentage: r.ownershipPercentage !== null && r.ownershipPercentage >= 25 ? r.ownershipPercentage / 100 : 0,
72
+ personalIdentificationNumber: {
73
+ type: "SSN",
74
+ value: r.ssn
75
+ }
76
+ }));
77
+ }
78
+ function c(e) {
79
+ return {
80
+ businessDetails: r(e),
81
+ applicant: i(e)
82
+ };
83
+ }
84
+ function l(e) {
85
+ let t = e.businessDetails?.companyStructure === "SOLE_PROPRIETORSHIP";
86
+ return {
87
+ ...e.businessDetails && { businessDetails: r(e.businessDetails) },
88
+ ...e.applicant && { applicant: o(e.applicant, { isSoleProprietor: t }) },
89
+ ...(t || e.businessOwners !== void 0) && { businessOwners: !t && e.businessOwners?.length ? s(e.businessOwners) : null }
90
+ };
91
+ }
8
92
  //#endregion
9
- export { e as OnboardingAnalyticsEvent, t as WIDGET_NAME };
93
+ export { i as buildApplicantForCreate, o as buildApplicantForUpdate, r as buildBusinessDetails, s as buildBusinessOwners, c as buildCreateApplicationBody, l as buildUpdateApplicationBody };