@tesouro/embedded-components-react 0.5.44 → 0.5.46

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 (38) hide show
  1. package/README.md +7 -5
  2. package/dist/index.d.ts +54 -24
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +15 -1
  4. package/dist/lib/BillPayWidget.d.ts +16 -1
  5. package/dist/lib/SettingsWidget.d.ts +1 -0
  6. package/dist/lib/WidgetSuite.d.ts +1 -0
  7. package/dist/lib/monite-sdk.d.ts +2 -0
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index10.js +12 -8
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +233 -211
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -7
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +3 -3
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +7 -1
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +387 -387
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +1 -0
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +119 -113
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +1 -2
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +55 -70
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +9 -7
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +2 -2
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +1 -0
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +163 -151
  23. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js +77 -77
  24. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ExpenseApprovalsPage.js +17 -10
  25. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/labels.js +2 -1
  26. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index382.js +10 -4
  28. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index394.js +1 -1
  29. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index616.js +23 -23
  30. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index3.js +1 -0
  31. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +13 -4
  32. package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +27 -29
  33. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +29 -28
  34. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +13 -13
  35. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +1933 -1906
  36. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/scopes.js +1 -0
  37. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  38. package/package.json +1 -1
@@ -14,25 +14,25 @@ import "../../../shared/ui/dist/index.js";
14
14
  import { useAnalyticsTrack as l } from "../../../shared/feature/dist/lib/analytics/hooks.js";
15
15
  import { WidgetProvider as u } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
16
16
  import { getStateOptions as d } from "../../../shared/util/dist/lib/usStates.js";
17
- import { extractApiErrorMessage as ee } from "../../../shared/util/dist/lib/apiErrors.js";
18
- import { useRefetchWidget as te, useWidgetConfig as f } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
19
- import { getNaicsOptions as ne } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
17
+ import { extractApiErrorMessage as f } from "../../../shared/util/dist/lib/apiErrors.js";
18
+ import { useRefetchWidget as p, useWidgetConfig as m } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
19
+ import { getNaicsOptions as ee } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
20
20
  import "../../../shared/feature/dist/index.js";
21
- import { identifierLast4 as p } from "./index7.js";
22
- import { bankAccountOnboardingTestIds as m } from "./index11.js";
23
- import { ADDITIONAL_OWNERS_LABELS_EN as h } from "../../ui/dist/index5.js";
24
- import { interpolateBankName as g } from "../../ui/dist/index7.js";
25
- import { ResultStep as re } from "../../ui/dist/index12.js";
21
+ import { identifierLast4 as h } from "./index7.js";
22
+ import { bankAccountOnboardingTestIds as g } from "./index11.js";
23
+ import { ADDITIONAL_OWNERS_LABELS_EN as te } from "../../ui/dist/index5.js";
24
+ import { interpolateBankName as _ } from "../../ui/dist/index7.js";
25
+ import { ResultStep as ne } from "../../ui/dist/index12.js";
26
26
  import "../../ui/dist/index.js";
27
- import { BusinessDetailsStep as ie } from "./index12.js";
28
- import { PersonalDetailsStep as ae } from "./index14.js";
29
- import { AdditionalOwnersStep as oe } from "./index16.js";
30
- import { buildCreateApplicationBody as se, buildUpdateApplicationBody as _ } from "./index17.js";
31
- import { buildOnboardingPrefill as ce } from "./index18.js";
32
- import { OnboardingAnalyticsEvent as le, WIDGET_NAME as ue } from "./index19.js";
33
- import { DEFAULT_LABELS as v } from "./index20.js";
34
- import { withoutResumeOnlyOwnerFields as de, withoutStoredIdentifierMarkers as y } from "./index21.js";
35
- import { ApplicationClientSecretProvider as b, useApplicationClientSecret as fe } from "../../data-access/dist/index2.js";
27
+ import { BusinessDetailsStep as re } from "./index12.js";
28
+ import { PersonalDetailsStep as ie } from "./index14.js";
29
+ import { AdditionalOwnersStep as ae } from "./index16.js";
30
+ import { buildCreateApplicationBody as oe, buildUpdateApplicationBody as v } from "./index17.js";
31
+ import { buildOnboardingPrefill as y } from "./index18.js";
32
+ import { OnboardingAnalyticsEvent as se, WIDGET_NAME as ce } from "./index19.js";
33
+ import { DEFAULT_LABELS as b } from "./index20.js";
34
+ import { withoutResumeOnlyOwnerFields as le, withoutStoredIdentifierMarkers as ue } from "./index21.js";
35
+ import { ApplicationClientSecretProvider as de, useApplicationClientSecret as fe } from "../../data-access/dist/index2.js";
36
36
  import { useCreateApplication as pe } from "../../data-access/dist/index4.js";
37
37
  import { useUpdateApplication as me } from "../../data-access/dist/index6.js";
38
38
  import { useSubmitApplication as he } from "../../data-access/dist/index7.js";
@@ -81,7 +81,7 @@ function Te(e, t) {
81
81
  subtitle: t.personalReviewSubtitle
82
82
  };
83
83
  let n = {
84
- ...h,
84
+ ...te,
85
85
  ...t.additionalOwners
86
86
  };
87
87
  return {
@@ -89,250 +89,262 @@ function Te(e, t) {
89
89
  subtitle: n.subheading
90
90
  };
91
91
  }
92
- function D({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard: u, labels: h, initialBusinessDetails: ce, initialPersonalDetails: ue, initialAdditionalOwners: y, initialApplicationId: b = null, bankLogoSrc: x, disclosureLinks: _e, open: E, defaultOpen: D, onOpenChange: O, isFullScreenInline: k = !1 }) {
93
- let A = l();
92
+ function Ee({ onEmbeddedOnboardingCompletedSuccessfully: u, onNavigateToDashboard: te, labels: y, initialBusinessDetails: ce, initialPersonalDetails: ue, initialAdditionalOwners: de, initialApplicationId: x = null, initialBoundAuthEpoch: _e, onEditableDraftChange: E, bankLogoSrc: Ee, disclosureLinks: D, open: O, defaultOpen: k, onOpenChange: A, isFullScreenInline: j = !1 }) {
93
+ let M = l(), { authEpoch: N } = r();
94
94
  S(() => {
95
- A(le.Mounted);
96
- }, [A]);
97
- let j = {
98
- ...v,
99
- ...h,
95
+ M(se.Mounted);
96
+ }, [M]);
97
+ let P = {
98
+ ...b,
99
+ ...y,
100
100
  stepIndicator: {
101
- ...v.stepIndicator,
102
- ...h?.stepIndicator
101
+ ...b.stepIndicator,
102
+ ...y?.stepIndicator
103
103
  },
104
- businessDetails: h?.businessDetails ?? {},
105
- personalDetails: h?.personalDetails ?? {},
106
- additionalOwners: h?.additionalOwners ?? {},
104
+ businessDetails: y?.businessDetails ?? {},
105
+ personalDetails: y?.personalDetails ?? {},
106
+ additionalOwners: y?.additionalOwners ?? {},
107
107
  result: {
108
- ...v.result,
109
- ...h?.result
108
+ ...b.result,
109
+ ...y?.result
110
110
  }
111
- }, M = f().initResponse, { termsHref: Ee, privacyHref: De, electronicCommunicationHref: Oe, patriotActHref: ke } = _e ?? {}, N = E === void 0, [Ae, je] = w(() => D ?? !1), Me = N ? Ae : E, Ne = D ?? !1, P = ve((e) => {
112
- N && je(e), O?.(e);
113
- }, [O, N]), Pe = ve(() => {
114
- r();
115
- }, [r]), Fe = te(), [F, I] = w(0), [Ie, Le] = w(() => ({
111
+ }, F = m().initResponse, { termsHref: De, privacyHref: Oe, electronicCommunicationHref: ke, patriotActHref: Ae } = D ?? {}, I = O === void 0, [je, Me] = w(() => k ?? !1), Ne = I ? je : O, Pe = k ?? !1, L = ve((e) => {
112
+ I && Me(e), A?.(e);
113
+ }, [A, I]), Fe = ve(() => {
114
+ u();
115
+ }, [u]), Ie = p(), [R, z] = w(0), [Le, Re] = w(() => ({
116
116
  ...Ce,
117
117
  ...ce
118
- })), [L, Re] = w(() => ({
118
+ })), [B, ze] = w(() => ({
119
119
  ...we,
120
120
  ...ue
121
- })), [ze, R] = w(() => y ?? []), [z, Be] = w(null), [B, Ve] = w(null), [V, He] = w(null), [H, Ue] = w(b), [We, U] = w(null), [W, Ge] = w(!1), [Ke, G] = w(null), qe = pe(), K = me(), Je = he(), Ye = ge(), { setClientSecret: Xe } = fe(), { data: Ze, refetch: Qe } = a(), { mutateAsync: $e } = i(), q = s(), J = ye(null);
122
- S(() => () => J.current?.abort(), []);
123
- let et = C(() => ne(j.businessDetails.naicsTitles), [j.businessDetails.naicsTitles]), tt = C(() => d(j.businessDetails.stateTitles), [j.businessDetails.stateTitles]), nt = C(() => d(j.personalDetails.stateTitles), [j.personalDetails.stateTitles]), rt = C(() => d(j.additionalOwners.stateTitles), [j.additionalOwners.stateTitles]), Y = W || Ke !== null, it = M?.status === "ACTIVE" || M?.status === "INACTIVE", at = M?.status === "INVITED", X = !!M && !Y && (it || at || q.isSuppressed), Z = X ? it ? o.UserAlreadyOnboarded : at ? o.UserInvitedToOrganization : q.reason : null;
124
- if (S(() => {
125
- !X || !Z || (A(le.Suppressed, { reason: Z }), console.info(`[onboarding] not shown: ${Z}`));
121
+ })), [Be, V] = w(() => de ?? []), [H, Ve] = w(null), [U, He] = w(null), [W, Ue] = w(null), [G, We] = w(x), [Ge, Ke] = w(_e ?? N), [qe, K] = w(null), [q, Je] = w(!1), [Ye, J] = w(null), Xe = pe(), Y = me(), Ze = he(), Qe = ge(), { setClientSecret: $e } = fe(), { data: et, refetch: tt } = a(), { mutateAsync: nt } = i(), rt = s(), it = ye(null);
122
+ S(() => () => it.current?.abort(), []);
123
+ let at = C(() => ee(P.businessDetails.naicsTitles), [P.businessDetails.naicsTitles]), ot = C(() => d(P.businessDetails.stateTitles), [P.businessDetails.stateTitles]), st = C(() => d(P.personalDetails.stateTitles), [P.personalDetails.stateTitles]), ct = C(() => d(P.additionalOwners.stateTitles), [P.additionalOwners.stateTitles]), X = q || Ye !== null, lt = F?.status === "ACTIVE" || F?.status === "INACTIVE", ut = F?.status === "INVITED", Z = !!F && !X && (lt || ut || rt.isSuppressed), Q = Z ? lt ? o.UserAlreadyOnboarded : ut ? o.UserInvitedToOrganization : rt.reason : null;
124
+ S(() => {
125
+ !Z || !Q || (M(se.Suppressed, { reason: Q }), console.info(`[onboarding] not shown: ${Q}`));
126
126
  }, [
127
- X,
128
127
  Z,
129
- A
130
- ]), !M || !Y && (X || !q.isResolved)) return null;
131
- let Q = z?.companyStructure === "SOLE_PROPRIETORSHIP", ot = [
132
- j.stepIndicator.business,
133
- j.stepIndicator.personal,
134
- j.stepIndicator.ownership
135
- ], st = F === 0 ? z : F === 1 ? B : F === 2 ? V : null, $ = qe.isPending || K.isPending || Je.isPending || W, ct = () => {
136
- U(null), I((e) => e === 0 ? 0 : e - 1);
137
- }, lt = () => {
138
- P(!1);
139
- }, ut = async (e) => {
140
- Ge(!0), P(!0);
128
+ Q,
129
+ M
130
+ ]), S(() => {
131
+ E?.(X || G === null ? null : {
132
+ applicationId: G,
133
+ authEpoch: Ge
134
+ });
135
+ }, [
136
+ E,
137
+ X,
138
+ G,
139
+ Ge
140
+ ]);
141
+ let dt = ye(N);
142
+ if (dt.current = N, !F || !X && (Z || !rt.isResolved)) return null;
143
+ let ft = H?.companyStructure === "SOLE_PROPRIETORSHIP", pt = [
144
+ P.stepIndicator.business,
145
+ P.stepIndicator.personal,
146
+ P.stepIndicator.ownership
147
+ ], mt = R === 0 ? H : R === 1 ? U : R === 2 ? W : null, $ = Xe.isPending || Y.isPending || Ze.isPending || q, ht = () => {
148
+ K(null), z((e) => e === 0 ? 0 : e - 1);
149
+ }, gt = () => {
150
+ L(!1);
151
+ }, _t = async (e) => {
152
+ Je(!0), L(!0);
141
153
  let t = new AbortController();
142
- J.current = t;
154
+ it.current = t;
143
155
  let n = !1;
144
156
  try {
145
- let r = await Je.mutateAsync({ path: { id: e } });
157
+ let r = await Ze.mutateAsync({ path: { id: e } });
146
158
  if (t.signal.aborted) return;
147
- if (!r.id) throw Error(j.submitFailedError);
148
- if (n = !0, (await Ye(e, { signal: t.signal })).status === "complete") {
149
- let e = Ze;
150
- if (e === void 0 && (e = (await Qe()).data), t.signal.aborted) return;
159
+ if (!r.id) throw Error(P.submitFailedError);
160
+ if (n = !0, (await Qe(e, { signal: t.signal })).status === "complete") {
161
+ let e = et;
162
+ if (e === void 0 && (e = (await tt()).data), t.signal.aborted) return;
151
163
  if (e !== void 0) try {
152
- await $e({ displayedVersion: e.version ?? null });
164
+ await nt({ displayedVersion: e.version ?? null });
153
165
  } catch {}
154
166
  if (t.signal.aborted) return;
155
- G("success"), Fe(), Pe();
156
- } else G("pending");
167
+ J("success"), Ie(), Fe();
168
+ } else J("pending");
157
169
  } catch (e) {
158
170
  if (e instanceof DOMException && e.name === "AbortError") return;
159
171
  if (!n) throw e;
160
- G("pending");
172
+ J("pending");
161
173
  } finally {
162
- J.current = null, Ge(!1);
174
+ it.current = null, Je(!1);
163
175
  }
164
- }, dt = () => {
165
- Le((e) => e.taxIdOnFileLast4 && e.taxId ? {
176
+ }, vt = () => {
177
+ Re((e) => e.taxIdOnFileLast4 && e.taxId ? {
166
178
  ...e,
167
179
  taxId: "",
168
- taxIdOnFileLast4: p(e.taxId),
180
+ taxIdOnFileLast4: h(e.taxId),
169
181
  taxIdOnFileStructure: e.companyStructure === "" ? void 0 : e.companyStructure
170
182
  } : e);
171
- }, ft = () => {
172
- Re((e) => e.ssnOnFileLast4 && e.ssn ? {
183
+ }, yt = () => {
184
+ ze((e) => e.ssnOnFileLast4 && e.ssn ? {
173
185
  ...e,
174
186
  ssn: "",
175
- ssnOnFileLast4: p(e.ssn)
187
+ ssnOnFileLast4: h(e.ssn)
176
188
  } : e);
177
- }, pt = () => {
178
- R((e) => e.map((e) => e.ssnOnFileLast4 && e.ssn ? {
189
+ }, bt = () => {
190
+ V((e) => e.map((e) => e.ssnOnFileLast4 && e.ssn ? {
179
191
  ...e,
180
192
  ssn: "",
181
- ssnOnFileLast4: p(e.ssn)
193
+ ssnOnFileLast4: h(e.ssn)
182
194
  } : e));
183
- }, mt = () => {
184
- R((e) => e.map(de));
185
- }, ht = async () => {
186
- U(null);
195
+ }, xt = () => {
196
+ V((e) => e.map(le));
197
+ }, St = async () => {
198
+ K(null);
187
199
  try {
188
- if (F === 0) {
189
- if (!z) return;
190
- let e = H;
191
- if (e) await K.mutateAsync({
200
+ if (R === 0) {
201
+ if (!H) return;
202
+ let e = G;
203
+ if (e) await Y.mutateAsync({
192
204
  path: { id: e },
193
- body: _({
194
- businessDetails: z,
195
- carryConsent: b !== null
205
+ body: v({
206
+ businessDetails: H,
207
+ carryConsent: x !== null
196
208
  })
197
209
  });
198
210
  else {
199
- let t = await qe.mutateAsync({ body: se(z) });
200
- e = t.id, Ue(e), t.clientSecret && Xe(t.clientSecret);
211
+ let t = dt.current, n = await Xe.mutateAsync({ body: oe(H) });
212
+ e = n.id, We(e), Ke(t), n.clientSecret && $e(n.clientSecret);
201
213
  }
202
- dt(), Q && mt(), I(1);
203
- } else if (F === 1) {
204
- if (!B || !z || !H) return;
205
- await K.mutateAsync({
206
- path: { id: H },
207
- body: _({
208
- businessDetails: z,
209
- applicant: B,
210
- carryConsent: b !== null
214
+ vt(), ft && xt(), z(1);
215
+ } else if (R === 1) {
216
+ if (!U || !H || !G) return;
217
+ await Y.mutateAsync({
218
+ path: { id: G },
219
+ body: v({
220
+ businessDetails: H,
221
+ applicant: U,
222
+ carryConsent: x !== null
211
223
  })
212
- }), dt(), ft(), I(2);
213
- } else if (F === 2) {
214
- if (!V || !H) return;
215
- await K.mutateAsync({
216
- path: { id: H },
217
- body: _({ businessOwners: V })
218
- }), pt(), await ut(H);
224
+ }), vt(), yt(), z(2);
225
+ } else if (R === 2) {
226
+ if (!W || !G) return;
227
+ await Y.mutateAsync({
228
+ path: { id: G },
229
+ body: v({ businessOwners: W })
230
+ }), bt(), await _t(G);
219
231
  }
220
232
  } catch (e) {
221
- let t = ee(e) ?? (e instanceof Error ? e.message : void 0) ?? j.genericRetryError;
222
- U(t);
233
+ let t = f(e) ?? (e instanceof Error ? e.message : void 0) ?? P.genericRetryError;
234
+ K(t);
223
235
  }
224
- }, gt = Te(Math.min(F, 2), j), _t = M.bankName?.trim() || j.fallbackBankName, vt = g(j.shellFdicDisclaimer, _t);
225
- if (Y) {
226
- let r = z?.companyLegalName ?? "", i = M.bankName?.trim() || j.fallbackBankName, a = Ke ?? "pending", o = a === "success", s = {
227
- ...v.result,
228
- ...j.result
229
- }, c = /* @__PURE__ */ T(re, {
236
+ }, Ct = Te(Math.min(R, 2), P), wt = F.bankName?.trim() || P.fallbackBankName, Tt = _(P.shellFdicDisclaimer, wt);
237
+ if (X) {
238
+ let r = H?.companyLegalName ?? "", i = F.bankName?.trim() || P.fallbackBankName, a = Ye ?? "pending", o = a === "success", s = {
239
+ ...b.result,
240
+ ...P.result
241
+ }, c = /* @__PURE__ */ T(ne, {
230
242
  testIds: {
231
- processing: m.resultProcessing,
232
- dashboardButton: m.resultDashboardButton
243
+ processing: g.resultProcessing,
244
+ dashboardButton: g.resultDashboardButton
233
245
  },
234
246
  status: a,
235
- isLoading: W,
247
+ isLoading: q,
236
248
  loadingMessage: s.loadingMessage,
237
249
  headingLine1: o ? s.successHeadingLine1 : s.pendingHeadingLine1,
238
250
  headingLine2: `${r}!`,
239
251
  body: o ? s.successBody : s.pendingBody,
240
- followUpEmail: B?.workEmail ?? "",
252
+ followUpEmail: U?.workEmail ?? "",
241
253
  emailBoxLead: s.pendingEmailBoxLead,
242
254
  navigateToDashboardLabel: s.navigateToDashboard,
243
- bankLogoSrc: x,
244
- bankLogoAlt: g(s.bankLogoAlt, i),
245
- fdicDisclaimer: g(s.fdicDisclaimer, i),
246
- onNavigateToDashboard: u
255
+ bankLogoSrc: Ee,
256
+ bankLogoAlt: _(s.bankLogoAlt, i),
257
+ fdicDisclaimer: _(s.fdicDisclaimer, i),
258
+ onNavigateToDashboard: te
247
259
  });
248
- return k ? /* @__PURE__ */ T("div", {
260
+ return j ? /* @__PURE__ */ T("div", {
249
261
  className: "ttw:grid ttw:h-full ttw:w-full ttw:grid-rows-[1fr] ttw:place-items-center ttw:gap-0 ttw:overflow-auto ttw:bg-background",
250
262
  children: c
251
263
  }) : /* @__PURE__ */ T(e, {
252
- open: Me,
253
- onOpenChange: P,
264
+ open: Ne,
265
+ onOpenChange: L,
254
266
  children: /* @__PURE__ */ xe(t, {
255
267
  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",
256
268
  children: [/* @__PURE__ */ T(n, {
257
269
  className: "ttw:sr-only",
258
- children: j.modalTitle
270
+ children: P.modalTitle
259
271
  }), c]
260
272
  })
261
273
  });
262
274
  }
263
- let yt = F === 2 ? j.submit : j.next, bt = st === null || $;
275
+ let Et = R === 2 ? P.submit : P.next, Dt = mt === null || $;
264
276
  return /* @__PURE__ */ T(be, { children: /* @__PURE__ */ xe(c, {
265
- open: Me,
266
- defaultOpen: Ne,
267
- onOpenChange: P,
268
- isFullScreenInline: k,
269
- title: gt.title,
270
- subtitle: gt.subtitle,
271
- stepLabels: ot,
272
- activeStep: F,
273
- disclaimerText: vt,
274
- onBack: F === 0 ? lt : ct,
275
- onCancel: F > 0 ? lt : void 0,
276
- onNext: ht,
277
+ open: Ne,
278
+ defaultOpen: Pe,
279
+ onOpenChange: L,
280
+ isFullScreenInline: j,
281
+ title: Ct.title,
282
+ subtitle: Ct.subtitle,
283
+ stepLabels: pt,
284
+ activeStep: R,
285
+ disclaimerText: Tt,
286
+ onBack: R === 0 ? gt : ht,
287
+ onCancel: R > 0 ? gt : void 0,
288
+ onNext: St,
277
289
  showDismissButton: !1,
278
- isNextDisabled: bt,
290
+ isNextDisabled: Dt,
279
291
  isNextLoading: $,
280
- nextLabel: yt,
292
+ nextLabel: Et,
281
293
  nextIcon: null,
282
- errorMessage: We,
294
+ errorMessage: qe,
283
295
  labels: {
284
- backButton: F === 0 ? j.cancel : j.back,
285
- cancelButton: j.cancel
296
+ backButton: R === 0 ? P.cancel : P.back,
297
+ cancelButton: P.cancel
286
298
  },
287
299
  testIds: {
288
- root: m.shell,
289
- dismiss: m.shellDismiss,
290
- back: m.shellBack,
291
- cancel: m.shellCancel,
292
- next: m.shellNext,
300
+ root: g.shell,
301
+ dismiss: g.shellDismiss,
302
+ back: g.shellBack,
303
+ cancel: g.shellCancel,
304
+ next: g.shellNext,
293
305
  scrollRegion: {
294
- root: m.shellScrollRegion,
295
- fade: m.shellScrollFade,
296
- hint: m.shellScrollHint
306
+ root: g.shellScrollRegion,
307
+ fade: g.shellScrollFade,
308
+ hint: g.shellScrollHint
297
309
  }
298
310
  },
299
311
  children: [
300
- F === 0 ? /* @__PURE__ */ T(ie, {
301
- value: Ie,
302
- onValueChange: Le,
303
- onSnapshotChange: Be,
304
- naicsOptions: et,
305
- stateOptions: tt,
306
- isSubmitting: $,
307
- labels: j.businessDetails,
308
- bankName: _t,
309
- termsHref: Ee,
310
- privacyHref: De,
311
- electronicCommunicationHref: Oe,
312
- patriotActHref: ke
313
- }, "business") : null,
314
- F === 1 ? /* @__PURE__ */ T(ae, {
315
- value: L,
312
+ R === 0 ? /* @__PURE__ */ T(re, {
313
+ value: Le,
316
314
  onValueChange: Re,
317
315
  onSnapshotChange: Ve,
318
- stateOptions: nt,
316
+ naicsOptions: at,
317
+ stateOptions: ot,
319
318
  isSubmitting: $,
320
- labels: j.personalDetails
321
- }, "personal") : null,
322
- F === 2 ? /* @__PURE__ */ T(oe, {
323
- owners: Q ? Se : ze,
324
- onOwnersChange: R,
325
- primaryOwnerName: `${L.firstName} ${L.lastName}`.trim(),
326
- primaryOwnerPercentage: Q ? 100 : B?.ownsOver25Percent === !0 ? B.ownershipPercentage ?? 0 : 0,
327
- stateOptions: rt,
319
+ labels: P.businessDetails,
320
+ bankName: wt,
321
+ termsHref: De,
322
+ privacyHref: Oe,
323
+ electronicCommunicationHref: ke,
324
+ patriotActHref: Ae
325
+ }, "business") : null,
326
+ R === 1 ? /* @__PURE__ */ T(ie, {
327
+ value: B,
328
+ onValueChange: ze,
328
329
  onSnapshotChange: He,
330
+ stateOptions: st,
331
+ isSubmitting: $,
332
+ labels: P.personalDetails
333
+ }, "personal") : null,
334
+ R === 2 ? /* @__PURE__ */ T(ae, {
335
+ owners: ft ? Se : Be,
336
+ onOwnersChange: V,
337
+ primaryOwnerName: `${B.firstName} ${B.lastName}`.trim(),
338
+ primaryOwnerPercentage: ft ? 100 : U?.ownsOver25Percent === !0 ? U.ownershipPercentage ?? 0 : 0,
339
+ stateOptions: ct,
340
+ onSnapshotChange: Ue,
329
341
  isSubmitting: $,
330
- labels: j.additionalOwners
342
+ labels: P.additionalOwners
331
343
  }) : null
332
344
  ]
333
345
  }) });
334
346
  }
335
- function O({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: d, disclosuresAcceptance: ee, providerLabels: te, ...f }) {
347
+ function D({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: d, disclosuresAcceptance: f, providerLabels: p, ...m }) {
336
348
  return /* @__PURE__ */ T(u, {
337
349
  baseUrl: e,
338
350
  widgetToken: t,
@@ -345,63 +357,73 @@ function O({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gat
345
357
  errorFallback: c,
346
358
  onError: l,
347
359
  analytics: d,
348
- disclosuresAcceptance: ee,
349
- providerLabels: te,
350
- widgetName: ue,
351
- children: /* @__PURE__ */ T(k, { ...f })
360
+ disclosuresAcceptance: f,
361
+ providerLabels: p,
362
+ widgetName: ce,
363
+ children: /* @__PURE__ */ T(O, { ...m })
352
364
  });
353
365
  }
354
- function k(e) {
355
- let { initResponse: t } = f(), { client: n } = r(), i = t?.userId ?? null, [a, o] = w(i), [s, c] = w(0);
366
+ function O(e) {
367
+ let { initResponse: t } = m(), { client: n } = r(), i = t?.userId ?? null, [a, o] = w(i), [s, c] = w(0);
356
368
  i !== a && (o(i), a !== null && i !== null && c((e) => e + 1));
357
369
  let [l, u] = w(n);
358
- return n !== l && (u(n), c((e) => e + 1)), /* @__PURE__ */ T(b, { children: /* @__PURE__ */ T(j, { ...e }, s) }, s);
370
+ return n !== l && (u(n), c((e) => e + 1)), /* @__PURE__ */ T(k, { ...e }, s);
371
+ }
372
+ function k(e) {
373
+ let { authEpoch: t } = r(), { ownApplicationIds: n } = x(), [i, a] = w(null), [o, s] = w(0);
374
+ return i !== null && t !== i.authEpoch && n !== null && !n.includes(i.applicationId) && (a(null), s((e) => e + 1)), /* @__PURE__ */ T(de, { children: /* @__PURE__ */ T(j, {
375
+ ...e,
376
+ onEditableDraftChange: a
377
+ }, o) }, o);
359
378
  }
360
379
  var A = { canRender: !1 };
361
380
  function j(e) {
362
- let { setClientSecret: t } = fe(), { applicationId: n, clientSecret: r, isResolved: i } = x(), { application: a, isResolved: o, isUnavailable: s } = _e(n, r);
381
+ let { setClientSecret: t } = fe(), { authEpoch: n } = r(), { applicationId: i, clientSecret: a, isResolved: o } = x(), { application: s, isResolved: c, isUnavailable: l } = _e(i, a);
363
382
  S(() => {
364
- r && t(r);
365
- }, [r, t]);
366
- let [c, l] = w(null);
383
+ a && t(a);
384
+ }, [a, t]);
385
+ let [u, d] = w(null);
367
386
  if (S(() => {
368
- if (!(c?.canRender === !0 || !i || !o)) {
369
- if (s) {
370
- l(A);
387
+ if (!(u?.canRender === !0 || !o || !c)) {
388
+ if (l) {
389
+ d(A);
371
390
  return;
372
391
  }
373
- if (a !== null && a.status !== void 0 && a.status !== E) {
374
- l(A);
392
+ if (s !== null && s.status !== void 0 && s.status !== E) {
393
+ d(A);
375
394
  return;
376
395
  }
377
- l({
396
+ d({
378
397
  canRender: !0,
379
- applicationId: a === null ? null : n,
380
- prefill: ce(a)
398
+ applicationId: s === null ? null : i,
399
+ authEpoch: n,
400
+ prefill: y(s)
381
401
  });
382
402
  }
383
403
  }, [
384
- c,
385
- i,
404
+ n,
405
+ u,
386
406
  o,
407
+ c,
408
+ l,
387
409
  s,
388
- a,
389
- n
390
- ]), c === null || !c.canRender) return null;
391
- let { applicationId: u, prefill: d } = c;
392
- return /* @__PURE__ */ T(D, {
410
+ i
411
+ ]), u === null || !u.canRender) return null;
412
+ let { applicationId: f, authEpoch: p, prefill: m } = u;
413
+ return /* @__PURE__ */ T(Ee, {
393
414
  ...e,
394
- initialApplicationId: u,
415
+ initialApplicationId: f,
416
+ initialBoundAuthEpoch: p,
395
417
  initialBusinessDetails: {
396
- ...y(e.initialBusinessDetails),
397
- ...d?.businessDetails
418
+ ...ue(e.initialBusinessDetails),
419
+ ...m?.businessDetails
398
420
  },
399
421
  initialPersonalDetails: {
400
- ...y(e.initialPersonalDetails),
401
- ...d?.personalDetails
422
+ ...ue(e.initialPersonalDetails),
423
+ ...m?.personalDetails
402
424
  },
403
- initialAdditionalOwners: d?.additionalOwners ?? e.initialAdditionalOwners?.map(de)
425
+ initialAdditionalOwners: m?.additionalOwners ?? e.initialAdditionalOwners?.map(le)
404
426
  });
405
427
  }
406
428
  //#endregion
407
- export { O as BankAccountOnboardingWidget, O as default };
429
+ export { D as BankAccountOnboardingWidget, D as default };
@@ -24,13 +24,16 @@ function o(e) {
24
24
  function s(e) {
25
25
  return (e / 100).toFixed(2);
26
26
  }
27
- function c({ values: e, initialLineItems: r, counterpartId: i, clearCounterpart: a, counterpartBankAccountId: o, editedTotals: s, document: c }) {
28
- let u = { currency: t };
29
- if (i ? u.counterpart_id = i : a && (u.counterpart_id = null), i ? u.counterpart_bank_account_id = o ?? null : a && (u.counterpart_bank_account_id = null), e.invoiceNumber && (u.document_id = e.invoiceNumber), e.invoiceDate && (u.issued_at = e.invoiceDate), e.dueDate && (u.due_date = e.dueDate), c && (u.base64_encoded_file = c.base64EncodedFile, u.file_name = c.fileName), s && (u.discount = n(s.discount) ?? 0, u.tax_amount = n(s.tax) ?? 0, s.total !== void 0 && (u.total_amount = n(s.total) ?? 0)), r && !("total_amount" in u)) {
27
+ function c({ values: e, initialLineItems: r, counterpartId: i, clearCounterpart: a, counterpartBankAccountId: o, editedTotals: s, currentTotals: c, lineItems: d, document: f }) {
28
+ let p = { currency: t };
29
+ if (i ? p.counterpart_id = i : a && (p.counterpart_id = null), i ? p.counterpart_bank_account_id = o ?? null : a && (p.counterpart_bank_account_id = null), e.invoiceNumber && (p.document_id = e.invoiceNumber), e.invoiceDate && (p.issued_at = e.invoiceDate), e.dueDate && (p.due_date = e.dueDate), f && (p.base64_encoded_file = f.base64EncodedFile, p.file_name = f.fileName), s && (p.discount = n(s.discount) ?? 0, p.tax_amount = n(s.tax) ?? 0, s.total !== void 0 && (p.total_amount = (n(s.total) ?? 0) + (n(s.discount) ?? 0))), c && d) {
30
+ let e = u(d).reduce((e, t) => e + t.subtotal, 0), t = n(c.tax) ?? 0, r = n(c.discount) ?? 0, i = c.total === void 0 ? e + t : (n(c.total) ?? 0) + r;
31
+ p.subtotal = e, p.tax_amount = t, p.total_amount = i;
32
+ } else if (r && !("total_amount" in p)) {
30
33
  let e = l(r, s?.tax);
31
- e !== void 0 && (u.total_amount = e);
34
+ e !== void 0 && (p.total_amount = e);
32
35
  }
33
- return u;
36
+ return p;
34
37
  }
35
38
  function l(e, t) {
36
39
  let r = !1, a = e.reduce((e, t) => {
@@ -42,13 +45,15 @@ function l(e, t) {
42
45
  }
43
46
  function u(e) {
44
47
  return e.filter(i).map((e) => {
45
- let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a);
48
+ let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a), s = t ?? o;
46
49
  return {
47
50
  name: e.description,
48
51
  quantity: i,
49
52
  unit_price: a,
50
53
  tax: 0,
51
- ...t !== null && t !== o ? { subtotal: t } : {},
54
+ subtotal: s,
55
+ tax_amount: 0,
56
+ total: s,
52
57
  ...e.glCode ? { ledger_account_id: e.glCode } : {}
53
58
  };
54
59
  });
@@ -44,10 +44,10 @@ function f(t, n = e) {
44
44
  let r = d(t, n);
45
45
  return r ? { total: r } : void 0;
46
46
  }
47
- function p(t, r, i = e) {
47
+ function p(t, r = e) {
48
48
  if (t === void 0) return;
49
- let a = n(t);
50
- if (a !== null) return a - (n(r) ?? 0) > 0 ? void 0 : { total: i.totalNotGreaterThanZero };
49
+ let i = n(t);
50
+ if (i !== null) return i > 0 ? void 0 : { total: r.totalNotGreaterThanZero };
51
51
  }
52
52
  function m(t, n, r, i = e) {
53
53
  let a = {};