@tesouro/embedded-components-react 0.3.16 → 0.3.18

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
@@ -0,0 +1,341 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { Dialog as e, DialogContent as t, DialogTitle as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { useAcceptWidgetDisclosures as r } from "../../../shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js";
7
+ import { useDisclosuresQuery as i } from "../../../shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js";
8
+ import "../../../shared/data-access/dist/index.js";
9
+ import { OnboardingShell as a } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
10
+ import "../../../shared/ui/dist/index.js";
11
+ import { useAnalyticsTrack as o } from "../../../shared/feature/dist/lib/analytics/hooks.js";
12
+ import { WidgetProvider as s } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
13
+ import { getStateOptions as c } from "../../../shared/util/dist/lib/usStates.js";
14
+ import { extractApiErrorMessage as l } from "../../../shared/util/dist/lib/apiErrors.js";
15
+ import { useRefetchWidget as ee, useWidgetConfig as u } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
16
+ import { getNaicsOptions as te } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
17
+ import "../../../shared/feature/dist/index.js";
18
+ import { bankAccountOnboardingTestIds as d } from "./index9.js";
19
+ import { ADDITIONAL_OWNERS_LABELS_EN as ne } from "../../ui/dist/index4.js";
20
+ import { interpolateBankName as f } from "../../ui/dist/index6.js";
21
+ import { ResultStep as re } from "../../ui/dist/index11.js";
22
+ import { MarketingWidget as ie } from "../../ui/dist/index28.js";
23
+ import "../../ui/dist/index.js";
24
+ import { BusinessDetailsStep as ae } from "./index10.js";
25
+ import { PersonalDetailsStep as oe } from "./index12.js";
26
+ import { AdditionalOwnersStep as se } from "./index14.js";
27
+ import { buildCreateApplicationBody as ce, buildUpdateApplicationBody as le } from "./index15.js";
28
+ import { OnboardingAnalyticsEvent as p, WIDGET_NAME as m } from "./index16.js";
29
+ import { DEFAULT_LABELS as h } from "./index17.js";
30
+ import { ApplicationClientSecretProvider as ue, useApplicationClientSecret as de } from "../../data-access/dist/index2.js";
31
+ import { useCreateApplication as fe } from "../../data-access/dist/index4.js";
32
+ import { useUpdateApplication as pe } from "../../data-access/dist/index6.js";
33
+ import { useSubmitApplication as me } from "../../data-access/dist/index7.js";
34
+ import { usePollApplicationCompletion as he } from "../../data-access/dist/index8.js";
35
+ import { OnboardingSuppressionReason as g } from "../../data-access/dist/index9.js";
36
+ import { useOrganizationOnboardingSuppression as ge } from "../../data-access/dist/index10.js";
37
+ import "../../data-access/dist/index.js";
38
+ import { useCallback as _, useEffect as v, useMemo as y, useRef as _e, useState as b } from "react";
39
+ import { Fragment as ve, jsx as x, jsxs as S } from "react/jsx-runtime";
40
+ //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js
41
+ var ye = {
42
+ companyLegalName: "",
43
+ companyDbaName: "",
44
+ businessAddress: "",
45
+ city: "",
46
+ state: "",
47
+ zipCode: "",
48
+ companyPhoneNumber: "",
49
+ companyStructure: "",
50
+ website: "",
51
+ taxId: "",
52
+ naicsCode: "",
53
+ isAuthorized: null,
54
+ isCheckboxChecked: !1
55
+ }, be = {
56
+ firstName: "",
57
+ lastName: "",
58
+ dateOfBirth: void 0,
59
+ ssn: "",
60
+ homeAddress: "",
61
+ city: "",
62
+ state: "",
63
+ zipCode: "",
64
+ mobilePhoneNumber: "",
65
+ workEmail: "",
66
+ ownsOver25Percent: null,
67
+ ownershipPercentage: null
68
+ };
69
+ function xe(e, t) {
70
+ if (e === 0) return {
71
+ title: t.businessReviewTitle,
72
+ subtitle: t.businessReviewSubtitle
73
+ };
74
+ if (e === 1) return {
75
+ title: t.personalReviewTitle,
76
+ subtitle: t.personalReviewSubtitle
77
+ };
78
+ let n = {
79
+ ...ne,
80
+ ...t.additionalOwners
81
+ };
82
+ return {
83
+ title: n.heading,
84
+ subtitle: n.subheading
85
+ };
86
+ }
87
+ function Se({ onEmbeddedOnboardingCompletedSuccessfully: s, onNavigateToDashboard: ne, labels: m, initialBusinessDetails: ue, initialPersonalDetails: Se, initialAdditionalOwners: C, bankLogoSrc: Ce, disclosureLinks: we, marketingContent: w = null, open: T, defaultOpen: E, onOpenChange: Te }) {
88
+ let D = o();
89
+ v(() => {
90
+ D(p.Mounted);
91
+ }, [D]);
92
+ let O = {
93
+ ...h,
94
+ ...m,
95
+ stepIndicator: {
96
+ ...h.stepIndicator,
97
+ ...m?.stepIndicator
98
+ },
99
+ businessDetails: m?.businessDetails ?? {},
100
+ personalDetails: m?.personalDetails ?? {},
101
+ additionalOwners: m?.additionalOwners ?? {},
102
+ result: {
103
+ ...h.result,
104
+ ...m?.result
105
+ }
106
+ }, k = u().initResponse, { termsHref: Ee, privacyHref: De, electronicCommunicationHref: Oe, patriotActHref: ke } = we ?? {}, Ae = w !== null, A = T === void 0, [je, j] = b(!1), [Me, Ne] = b(!0), [Pe, Fe] = b(() => E ?? !1), Ie = Ce ?? w?.bankLogoSrc ?? void 0, M = A ? Pe : T, Le = E ?? !1, N = _((e) => {
107
+ A && Fe(e), Te?.(e);
108
+ }, [Te, A]), Re = _(() => {
109
+ D(p.OpenMarketing), j(!0);
110
+ }, [D]), ze = _(() => {
111
+ j(!1);
112
+ }, []), Be = _(() => {
113
+ D(p.BeginOnboarding), j(!1), N(!0);
114
+ }, [N, D]), Ve = _(() => {
115
+ Ne(!1), s();
116
+ }, [s]), He = ee(), [P, F] = b(0), [Ue, We] = b(() => ({
117
+ ...ye,
118
+ ...ue
119
+ })), [I, Ge] = b(() => ({
120
+ ...be,
121
+ ...Se
122
+ })), [Ke, qe] = b(() => C ?? []), [L, Je] = b(null), [R, Ye] = b(null), [z, Xe] = b(null), [B, Ze] = b(null), [Qe, V] = b(null), [H, U] = b(!1), [W, G] = b(null), K = fe(), q = pe(), $e = me(), et = he(), { setClientSecret: tt } = de(), { data: nt, refetch: rt } = i(), { mutateAsync: it } = r(), J = ge(), Y = _e(null);
123
+ v(() => () => Y.current?.abort(), []);
124
+ let at = y(() => te(O.businessDetails.naicsTitles), [O.businessDetails.naicsTitles]), ot = y(() => c(O.businessDetails.stateTitles), [O.businessDetails.stateTitles]), st = y(() => c(O.personalDetails.stateTitles), [O.personalDetails.stateTitles]), ct = y(() => c(O.additionalOwners.stateTitles), [O.additionalOwners.stateTitles]), X = H || W !== null, lt = k?.status === "ACTIVE" || k?.status === "INACTIVE", ut = k?.status === "INVITED", Z = !!k && !X && (lt || ut || J.isSuppressed), Q = Z ? lt ? g.UserAlreadyOnboarded : ut ? g.UserInvitedToOrganization : J.reason : null;
125
+ if (v(() => {
126
+ !Z || !Q || (D(p.Suppressed, { reason: Q }), console.info(`[onboarding] not shown: ${Q}`));
127
+ }, [
128
+ Z,
129
+ Q,
130
+ D
131
+ ]), !k || !X && (Z || !J.isResolved)) return null;
132
+ let dt = L?.companyStructure === "SOLE_PROPRIETORSHIP", ft = [
133
+ O.stepIndicator.business,
134
+ O.stepIndicator.personal,
135
+ O.stepIndicator.ownership
136
+ ], pt = P === 0 ? L : P === 1 ? R : P === 2 ? z : null, $ = K.isPending || q.isPending || $e.isPending || H, mt = () => {
137
+ V(null), F((e) => e === 0 ? 0 : e - 1);
138
+ }, ht = () => {
139
+ N(!1);
140
+ }, gt = async (e) => {
141
+ U(!0), N(!0);
142
+ let t = new AbortController();
143
+ Y.current = t;
144
+ let n = !1;
145
+ try {
146
+ let r = await $e.mutateAsync({ path: { id: e } });
147
+ if (t.signal.aborted) return;
148
+ if (!r.id) throw Error(O.submitFailedError);
149
+ if (n = !0, (await et(e, { signal: t.signal })).status === "complete") {
150
+ let e = nt;
151
+ if (e === void 0 && (e = (await rt()).data), t.signal.aborted) return;
152
+ if (e !== void 0) try {
153
+ await it({ displayedVersion: e.version ?? null });
154
+ } catch {}
155
+ if (t.signal.aborted) return;
156
+ G("success"), He(), Ve();
157
+ } else G("pending");
158
+ } catch (e) {
159
+ if (e instanceof DOMException && e.name === "AbortError") return;
160
+ if (!n) throw e;
161
+ G("pending");
162
+ } finally {
163
+ Y.current = null, U(!1);
164
+ }
165
+ }, _t = async () => {
166
+ V(null);
167
+ try {
168
+ if (P === 0) {
169
+ if (!L) return;
170
+ let e = B;
171
+ if (!e) {
172
+ let t = await K.mutateAsync({ body: ce(L) });
173
+ e = t.id, Ze(e), t.clientSecret && tt(t.clientSecret);
174
+ }
175
+ F(1);
176
+ } else if (P === 1) {
177
+ if (!R || !L || !B) return;
178
+ await q.mutateAsync({
179
+ path: { id: B },
180
+ body: le({
181
+ businessDetails: L,
182
+ applicant: R
183
+ })
184
+ }), F(2);
185
+ } else if (P === 2) {
186
+ if (!z || !B) return;
187
+ await q.mutateAsync({
188
+ path: { id: B },
189
+ body: le({ businessOwners: z })
190
+ }), await gt(B);
191
+ }
192
+ } catch (e) {
193
+ let t = l(e) ?? (e instanceof Error ? e.message : void 0) ?? O.genericRetryError;
194
+ V(t);
195
+ }
196
+ }, vt = xe(Math.min(P, 2), O), yt = k.bankName?.trim() || O.fallbackBankName, bt = f(O.shellFdicDisclaimer, yt);
197
+ if (X) {
198
+ let r = L?.companyLegalName ?? "", i = k.bankName?.trim() || O.fallbackBankName, a = W ?? "pending", o = a === "success", s = {
199
+ ...h.result,
200
+ ...O.result
201
+ };
202
+ return /* @__PURE__ */ x(e, {
203
+ open: M,
204
+ onOpenChange: N,
205
+ children: /* @__PURE__ */ S(t, {
206
+ className: "ttw:grid ttw:max-h-[95vh] ttw:w-[720px] ttw:max-w-[calc(100vw-2rem)] ttw:grid-rows-[1fr] ttw:gap-0 ttw:overflow-hidden ttw:rounded-2xl ttw:p-0",
207
+ children: [/* @__PURE__ */ x(n, {
208
+ className: "ttw:sr-only",
209
+ children: O.modalTitle
210
+ }), /* @__PURE__ */ x(re, {
211
+ testIds: {
212
+ processing: d.resultProcessing,
213
+ dashboardButton: d.resultDashboardButton
214
+ },
215
+ status: a,
216
+ isLoading: H,
217
+ loadingMessage: s.loadingMessage,
218
+ headingLine1: o ? s.successHeadingLine1 : s.pendingHeadingLine1,
219
+ headingLine2: `${r}!`,
220
+ body: o ? s.successBody : s.pendingBody,
221
+ followUpEmail: R?.workEmail ?? "",
222
+ emailBoxLead: s.pendingEmailBoxLead,
223
+ navigateToDashboardLabel: s.navigateToDashboard,
224
+ bankLogoSrc: Ie,
225
+ bankLogoAlt: f(s.bankLogoAlt, i),
226
+ fdicDisclaimer: f(s.fdicDisclaimer, i),
227
+ onNavigateToDashboard: ne
228
+ })]
229
+ })
230
+ });
231
+ }
232
+ let xt = P === 2 ? O.submit : O.next, St = pt === null || $;
233
+ return /* @__PURE__ */ S(ve, { children: [Ae && Me && w ? /* @__PURE__ */ x(ie, {
234
+ open: je,
235
+ isVisible: !0,
236
+ vspLogo: w.vspLogo,
237
+ bankingText: w.bankingText,
238
+ primaryCaption: w.primaryCaption,
239
+ secondaryCaption: w.secondaryCaption,
240
+ providedByCaption: w.providedByCaption,
241
+ modalPrimaryImg: w.modalPrimaryImg,
242
+ primaryModalHeader: w.primaryModalHeader,
243
+ benefits: w.benefits,
244
+ appearance: w.appearance,
245
+ onOpenMarketingModal: Re,
246
+ onCloseMarketingModal: ze,
247
+ onPrimaryCtaClick: Be
248
+ }) : null, /* @__PURE__ */ S(a, {
249
+ open: M,
250
+ defaultOpen: Le,
251
+ onOpenChange: N,
252
+ title: vt.title,
253
+ subtitle: vt.subtitle,
254
+ stepLabels: ft,
255
+ activeStep: P,
256
+ disclaimerText: bt,
257
+ onBack: P === 0 ? ht : mt,
258
+ onCancel: P > 0 ? ht : void 0,
259
+ onNext: _t,
260
+ showDismissButton: !1,
261
+ isNextDisabled: St,
262
+ isNextLoading: $,
263
+ nextLabel: xt,
264
+ nextIcon: null,
265
+ errorMessage: Qe,
266
+ labels: {
267
+ backButton: P === 0 ? O.cancel : O.back,
268
+ cancelButton: O.cancel
269
+ },
270
+ testIds: {
271
+ root: d.shell,
272
+ dismiss: d.shellDismiss,
273
+ back: d.shellBack,
274
+ cancel: d.shellCancel,
275
+ next: d.shellNext,
276
+ scrollRegion: {
277
+ root: d.shellScrollRegion,
278
+ fade: d.shellScrollFade,
279
+ hint: d.shellScrollHint
280
+ }
281
+ },
282
+ children: [
283
+ P === 0 ? /* @__PURE__ */ x(ae, {
284
+ value: Ue,
285
+ onValueChange: We,
286
+ onSnapshotChange: Je,
287
+ naicsOptions: at,
288
+ stateOptions: ot,
289
+ isSubmitting: $,
290
+ labels: O.businessDetails,
291
+ bankName: yt,
292
+ termsHref: Ee,
293
+ privacyHref: De,
294
+ electronicCommunicationHref: Oe,
295
+ patriotActHref: ke
296
+ }, "business") : null,
297
+ P === 1 ? /* @__PURE__ */ x(oe, {
298
+ value: I,
299
+ onValueChange: Ge,
300
+ onSnapshotChange: Ye,
301
+ stateOptions: st,
302
+ isSubmitting: $,
303
+ labels: O.personalDetails
304
+ }, "personal") : null,
305
+ P === 2 ? /* @__PURE__ */ x(se, {
306
+ owners: Ke,
307
+ onOwnersChange: qe,
308
+ primaryOwnerName: `${I.firstName} ${I.lastName}`.trim(),
309
+ primaryOwnerPercentage: dt ? 100 : R?.ownsOver25Percent === !0 ? R.ownershipPercentage ?? 0 : 0,
310
+ stateOptions: ct,
311
+ onSnapshotChange: Xe,
312
+ isSubmitting: $,
313
+ labels: O.additionalOwners
314
+ }) : null
315
+ ]
316
+ })] });
317
+ }
318
+ function C({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: c, errorFallback: l, onError: ee, analytics: u, disclosuresAcceptance: te, ...d }) {
319
+ return /* @__PURE__ */ x(s, {
320
+ baseUrl: e,
321
+ widgetToken: t,
322
+ organizationId: n,
323
+ configClient: r,
324
+ gatewayRouting: i,
325
+ linkComponent: a,
326
+ implementation: o,
327
+ uiFramework: c,
328
+ errorFallback: l,
329
+ onError: ee,
330
+ analytics: u,
331
+ disclosuresAcceptance: te,
332
+ widgetName: m,
333
+ children: /* @__PURE__ */ x(Ce, { ...d })
334
+ });
335
+ }
336
+ function Ce(e) {
337
+ let { initResponse: t } = u(), n = t?.userId ?? null, [r, i] = b(n), [a, o] = b(0);
338
+ return n !== r && (i(n), r !== null && n !== null && o((e) => e + 1)), /* @__PURE__ */ x(ue, { children: /* @__PURE__ */ x(Se, { ...e }, a) }, a);
339
+ }
340
+ //#endregion
341
+ export { C as BankAccountOnboardingWidget, C as default };
@@ -1,102 +1,31 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { isValidWebsiteUrl as e } from "./index6.js";
6
- import { BusinessDetailsPanel as t } from "../../ui/dist/index18.js";
7
- import { BusinessDisclosuresSection as n } from "../../ui/dist/index23.js";
8
- import "../../ui/dist/index.js";
9
- import { buildBusinessDetailsEditFields as r, buildBusinessDetailsPanelLabels as i, buildBusinessDetailsSummaryRows as a, isBusinessWebsiteInvalid as o, mergeBusinessDetailsLabels as s } from "./index8.js";
10
- import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
11
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
12
- import { z as m } from "zod";
13
1
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index9.js
14
- function h(t) {
15
- return m.object({
16
- companyLegalName: m.string().min(1),
17
- companyDbaName: m.string(),
18
- businessAddress: m.string().min(1),
19
- city: m.string().min(1),
20
- state: m.string().min(2),
21
- zipCode: m.string().min(5),
22
- companyPhoneNumber: m.string().refine((e) => e.replace(/\D/g, "").length === 10, { message: t.companyPhoneNumberInvalid }),
23
- companyStructure: m.enum([
24
- "CORPORATION_PUBLIC",
25
- "CORPORATION_PRIVATE",
26
- "CORPORATION_NOT_FOR_PROFIT",
27
- "LLC",
28
- "LLP",
29
- "PARTNERSHIP",
30
- "SOLE_PROPRIETORSHIP",
31
- "GOVERNMENT",
32
- "COOPERATIVE",
33
- "ASSOCIATION",
34
- "OTHER"
35
- ]),
36
- website: m.string().refine((t) => !t || e(t), { message: t.websiteInvalid }),
37
- taxId: m.string().refine((e) => /^\d{9}$/.test(e), { message: t.taxIdInvalid }),
38
- naicsCode: m.string().min(1)
39
- });
40
- }
41
- function g(e) {
42
- return h(e).extend({
43
- isAuthorized: m.literal(!0),
44
- isCheckboxChecked: m.literal(!0)
45
- });
46
- }
47
- function _({ value: e, onValueChange: m, onSnapshotChange: _, naicsOptions: v, stateOptions: y, isSubmitting: b, labels: x, bankName: S, termsHref: C, privacyHref: w, electronicCommunicationHref: T, patriotActHref: E }) {
48
- let D = l(() => s(x), [x]), O = l(() => ({
49
- panelFields: h(D),
50
- full: g(D)
51
- }), [D]), k = O.full.safeParse(e), A = k.success ? k.data : null, j = O.panelFields.safeParse(e).success, M = JSON.stringify(A), N = u(_);
52
- N.current = _, c(() => {
53
- N.current(A);
54
- }, [M]);
55
- let [P, F] = d(() => !j);
56
- c(() => {
57
- j || F(!0);
58
- }, [j]);
59
- let I = l(() => ({
60
- stateOptions: y,
61
- naicsOptions: v,
62
- labels: x
63
- }), [
64
- y,
65
- v,
66
- x
67
- ]), L = l(() => i(x), [x]), R = l(() => a(e, I), [e, I]), z = l(() => r(e, m, I), [
68
- e,
69
- m,
70
- I
71
- ]), B = o(e.website);
72
- return /* @__PURE__ */ p("div", {
73
- className: "ttw:flex ttw:flex-col ttw:gap-6",
74
- children: [/* @__PURE__ */ f(t, {
75
- isEditing: P,
76
- onEditClick: () => F(!0),
77
- summaryRows: R,
78
- editFields: z,
79
- labels: L,
80
- isDisabled: b,
81
- websiteInvalid: B
82
- }), /* @__PURE__ */ f(n, {
83
- value: {
84
- isAuthorized: e.isAuthorized,
85
- isCheckboxChecked: e.isCheckboxChecked
86
- },
87
- onChange: (t) => m({
88
- ...e,
89
- ...t
90
- }),
91
- isSubmitting: b,
92
- labels: x,
93
- bankName: S,
94
- termsHref: C,
95
- privacyHref: w,
96
- electronicCommunicationHref: T,
97
- patriotActHref: E
98
- })]
99
- });
100
- }
2
+ var e = {
3
+ shell: "onboarding-shell",
4
+ shellDismiss: "onboarding-shell-dismiss",
5
+ shellBack: "onboarding-shell-back",
6
+ shellCancel: "onboarding-shell-cancel",
7
+ shellNext: "onboarding-shell-next",
8
+ shellScrollRegion: "onboarding-shell-scroll-region",
9
+ shellScrollFade: "onboarding-shell-scroll-fade",
10
+ shellScrollHint: "onboarding-shell-scroll-hint",
11
+ shellOverlay: "onboarding-shell-overlay",
12
+ businessDetailsPanel: "business-details-panel",
13
+ businessDetailsEditButton: "business-details-edit-button",
14
+ businessDetailsSummary: "business-details-summary",
15
+ businessDetailsEditForm: "business-details-edit-form",
16
+ businessDetailsNaicsCombobox: "business-details-naics-combobox",
17
+ authorizationCheckbox: "bank-account-onboarding-authorization-checkbox",
18
+ disclosureCheckbox: "bank-account-onboarding-disclosure-checkbox",
19
+ aboutYouPanel: "about-you-panel",
20
+ aboutYouEditButton: "about-you-edit-button",
21
+ aboutYouSummary: "about-you-summary",
22
+ aboutYouEditForm: "about-you-edit-form",
23
+ aboutYouOwnsOver25Question: "about-you-owns-over-25-question",
24
+ addOwnerButton: "bank-account-onboarding-add-owner-button",
25
+ ownerDeleteOverlay: "additional-owner-delete-overlay",
26
+ ownerDeleteContent: "additional-owner-delete-content",
27
+ resultProcessing: "bank-account-onboarding-result-processing",
28
+ resultDashboardButton: "bank-account-onboarding-result-dashboard-button"
29
+ };
101
30
  //#endregion
102
- export { _ as BusinessDetailsStep };
31
+ export { e as bankAccountOnboardingTestIds };
@@ -12,7 +12,6 @@ import { ABOUT_YOU_PANEL_LABELS_EN as l } from "./index21.js";
12
12
  import { AboutYouPanel as u } from "./index22.js";
13
13
  import { BusinessDisclosuresSection as d } from "./index23.js";
14
14
  import "./index24.js";
15
- import "./index26.js";
16
15
  import "./index27.js";
17
16
  import { MarketingWidget as f } from "./index28.js";
18
17
  export { l as ABOUT_YOU_PANEL_LABELS_EN, e as ADDITIONAL_OWNERS_LABELS_EN, u as AboutYouPanel, t as AdditionalOwnersForm, n as BUSINESS_DETAILS_LABELS_EN, s as BUSINESS_DETAILS_PANEL_LABELS_EN, c as BusinessDetailsPanel, d as BusinessDisclosuresSection, f as MarketingWidget, i as PERSONAL_DETAILS_LABELS_EN, o as RESULT_LABELS_EN, a as ResultStep, r as interpolateBankName };
@@ -27,10 +27,10 @@ function u({ line1: e, line2: t }) {
27
27
  ]
28
28
  });
29
29
  }
30
- function d({ status: d, isLoading: f, loadingMessage: p, headingLine1: m, headingLine2: h, body: g, followUpEmail: _, emailBoxLead: v, navigateToDashboardLabel: y, bankLogoSrc: b, bankLogoAlt: x, fdicDisclaimer: S, onNavigateToDashboard: C }) {
30
+ function d({ status: d, isLoading: f, loadingMessage: p, headingLine1: m, headingLine2: h, body: g, followUpEmail: _, emailBoxLead: v, navigateToDashboardLabel: y, bankLogoSrc: b, bankLogoAlt: x, fdicDisclaimer: S, onNavigateToDashboard: C, testIds: w }) {
31
31
  return f ? /* @__PURE__ */ s("div", {
32
32
  className: "ttw:flex ttw:min-h-[300px] ttw:w-full ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-6 ttw:text-center",
33
- "data-testid": "bank-account-onboarding-result-processing",
33
+ "data-testid": w?.processing,
34
34
  children: [/* @__PURE__ */ o(t, { className: "ttw:size-[65px] ttw:text-primary" }), /* @__PURE__ */ o("p", {
35
35
  className: "ttw:text-xl ttw:font-normal",
36
36
  children: p
@@ -65,7 +65,7 @@ function d({ status: d, isLoading: f, loadingMessage: p, headingLine1: m, headin
65
65
  type: "button",
66
66
  size: "lg",
67
67
  className: "ttw:mb-1 ttw:w-fit ttw:px-4 ttw:py-2",
68
- "data-testid": "bank-account-onboarding-result-dashboard-button",
68
+ "data-testid": w?.dashboardButton,
69
69
  onClick: C,
70
70
  children: [y, /* @__PURE__ */ o(c, { className: "ttw:size-4" })]
71
71
  })