@tesouro/embedded-components-react 0.5.232 → 0.5.235

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 (24) hide show
  1. package/README.md +16 -14
  2. package/dist/index.d.ts +66 -15
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +39 -1
  4. package/dist/lib/ReceivablesWidget.d.ts +1 -0
  5. package/dist/lib/WidgetSuite.d.ts +65 -15
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +3 -2
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +2 -1
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +6 -0
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index23.js +15 -11
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index26.js +441 -409
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index10.js +18 -14
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +6 -3
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +26 -30
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +4 -2
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +13 -13
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +4 -1
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +1 -0
  19. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +35 -35
  20. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/clientRegistry.js +6 -3
  21. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js +123 -92
  23. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +12 -5
  24. package/package.json +1 -1
@@ -12,133 +12,164 @@ import { useEmbedApi as s } from "../../../shared/data-access/dist/lib/EmbedApiC
12
12
  import { hasAnyScope as c } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
13
13
  import { OnboardingSuppressionReason as l } from "../../../shared/data-access/dist/lib/onboardingSuppressionReason.js";
14
14
  import { useOrganizationOnboardingSuppression as u } from "../../../shared/data-access/dist/lib/useOrganizationOnboardingSuppression.js";
15
+ import { useOrganizationApplicationStatus as d } from "../../../shared/data-access/dist/lib/useOrganizationApplicationStatus.js";
15
16
  import "../../../shared/data-access/dist/index.js";
16
- import { ErrorState as d } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
17
+ import { ErrorState as f } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
17
18
  import "../../../shared/ui/dist/index.js";
18
- import { useAnalyticsTrack as f } from "../../../shared/feature/dist/lib/analytics/hooks.js";
19
- import { WidgetProvider as p } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
20
- import { useRefetchWidget as m, useWidgetConfig as h, useWidgetError as g, useWidgetInitStaleForToken as _, useWidgetLoading as v } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
19
+ import { useAnalyticsTrack as p } from "../../../shared/feature/dist/lib/analytics/hooks.js";
20
+ import { WidgetProvider as m } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
21
+ import { useRefetchWidget as h, useWidgetConfig as ee, useWidgetError as g, useWidgetInitStaleForToken as _, useWidgetLoading as v } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
22
+ import { deniedNoticeExpiresAt as te, selectBankAccountApplication as ne } from "../../../shared/feature/dist/lib/application/bankAccountApplication.js";
21
23
  import "../../../shared/feature/dist/index.js";
22
- import { WIDGET_SUITE_SECTIONS as y } from "./index15.js";
23
- import { WIDGET_NAME as b, WidgetSuiteAnalyticsEvent as x } from "./index2.js";
24
- import { needsDisclosureAcceptance as S } from "./index3.js";
25
- import { AcceptDisclosuresWidget as C } from "../../../accept-disclosures-widget/feature/dist/index5.js";
24
+ import { WIDGET_SUITE_SECTIONS as re } from "./index15.js";
25
+ import { WIDGET_NAME as y, WidgetSuiteAnalyticsEvent as b } from "./index2.js";
26
+ import { needsDisclosureAcceptance as x } from "./index3.js";
27
+ import { AcceptDisclosuresWidget as ie } from "../../../accept-disclosures-widget/feature/dist/index5.js";
26
28
  import "../../../accept-disclosures-widget/feature/dist/index.js";
27
- import { BankAccountOnboardingWidget as w } from "../../../bank-account-onboarding-widget/feature/dist/index26.js";
29
+ import { OnboardingApplicationView as S, onboardingApplicationViewFor as C } from "../../../bank-account-onboarding-widget/feature/dist/index23.js";
30
+ import { BankAccountOnboardingWidget as ae } from "../../../bank-account-onboarding-widget/feature/dist/index26.js";
28
31
  import "../../../bank-account-onboarding-widget/feature/dist/index.js";
29
- import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as k } from "react";
30
- import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
32
+ import { useCallback as w, useEffect as T, useMemo as oe, useReducer as E, useRef as D, useState as O } from "react";
33
+ import { Fragment as se, jsx as k, jsxs as ce } from "react/jsx-runtime";
31
34
  //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js
32
- var N = {
35
+ var A = {
33
36
  initFailed: "widget-suite-init-failed",
34
37
  disclosuresRefreshFailed: "widget-suite-disclosures-refresh-failed",
35
- applicationInFlight: "widget-suite-application-in-flight"
36
- };
37
- function P({ showSectionTitle: n = !0, onboardingDisclosureLinks: r }) {
38
- let { availableSections: a, activeSection: s, labels: c, navigate: f } = o(), { initResponse: p } = h(), b = g(), x = _(), D = v(), P = m(), F = u(), [I, L] = k(!1), R = F.isResolved || I, z = T((e) => f(e), [f]), [B, V] = k(!1), ee = T(() => V(!0), []), [te, ne] = k(!1), H = S(p), U = c.disclosure, W = c.onboardingGate, G = p?.status === "INVITED", K = p?.status === "ACTIVE" || p?.status === "INACTIVE", q = !!(p && x), J = q && (G || K), Y = !p && !b || J && !b, X = !!p && !Y && !q && !G && !K && R && F.reason === l.OrganizationApplicationComplete && !te, Z = O(!1), [re, Q] = k(!1);
39
- E(() => {
40
- !H && B && V(!1);
41
- }, [B, H]), E(() => {
42
- F.isResolved && !I && L(!0);
43
- }, [F.isResolved, I]), E(() => {
44
- X ? Z.current || (Z.current = !0, Q(!0), P()) : (Z.current = !1, Q(!1));
45
- }, [X, P]);
46
- let $ = () => /* @__PURE__ */ j(e, {
38
+ applicationUnavailable: "widget-suite-application-unavailable"
39
+ }, j = 2 ** 31 - 1;
40
+ function M({ showSectionTitle: n = !0, onboardingDisclosureLinks: r, onApplicantLatchChange: a, onResultScreenHeldChange: s }) {
41
+ let { availableSections: c, activeSection: p, labels: m, navigate: y } = o(), { initResponse: b } = ee(), M = g(), N = _(), P = v(), F = h(), I = u(), L = d(), R = oe(() => ne(L.applications), [L.applications]), z = D(null);
42
+ L.isResolved && (z.current = { application: R });
43
+ let B = L.isResolved ? R : z.current?.application ?? null, [le, ue] = E((e) => e + 1, 0), V = te(B);
44
+ T(() => {
45
+ if (V === null) return;
46
+ let e = V - Date.now();
47
+ if (e < 0) return;
48
+ let t = setTimeout(ue, Math.min(e + 1, j));
49
+ return () => clearTimeout(t);
50
+ }, [V, le]);
51
+ let H = C(B), [U, de] = O(!1), [W, fe] = O(!1), pe = I.isResolved || W, me = w((e) => y(e), [y]), [G, he] = O(!1), ge = w(() => he(!0), []), [K, _e] = O(!1), ve = K || U;
52
+ T(() => {
53
+ a(ve);
54
+ }, [ve, a]);
55
+ let [ye, be] = O(!1), xe = U && !ye;
56
+ T(() => {
57
+ s(xe);
58
+ }, [xe, s]);
59
+ let q = x(b), J = m.disclosure, Y = m.onboardingGate, X = b?.status === "INVITED", Se = b?.status === "ACTIVE" || b?.status === "INACTIVE", Ce = !!(b && N), we = Ce && (X || Se), Te = !b && !M || we && !M, Z = !!b && !Te && !Ce && !X && !Se && pe && I.reason === l.OrganizationApplicationComplete && !K, Q = D(!1), [Ee, De] = O(!1);
60
+ T(() => {
61
+ !q && G && he(!1);
62
+ }, [G, q]), T(() => {
63
+ I.isResolved && !W && fe(!0);
64
+ }, [I.isResolved, W]), T(() => {
65
+ Z ? Q.current || (Q.current = !0, De(!0), F()) : (Q.current = !1, De(!1));
66
+ }, [Z, F]);
67
+ let $ = () => /* @__PURE__ */ k(e, {
47
68
  isLoading: !0,
48
69
  sections: [],
49
70
  selectedSectionId: "",
50
- onSectionChange: z,
51
- labels: c.shell
71
+ onSectionChange: me,
72
+ labels: m.shell
52
73
  });
53
- if (Y) return $();
54
- if ((!p || J) && b) return /* @__PURE__ */ j(d, {
55
- title: U.initFailedState.title,
56
- description: U.initFailedState.body,
57
- retryLabel: U.initFailedState.retryButton,
58
- onRetry: P,
59
- testId: N.initFailed
74
+ if (Te) return $();
75
+ if ((!b || we) && M) return /* @__PURE__ */ k(f, {
76
+ title: J.initFailedState.title,
77
+ description: J.initFailedState.body,
78
+ retryLabel: J.initFailedState.retryButton,
79
+ onRetry: F,
80
+ testId: A.initFailed
60
81
  });
61
- let ie = () => B && b ? /* @__PURE__ */ j(d, {
62
- title: U.refreshFailedState.title,
63
- description: U.refreshFailedState.body,
64
- retryLabel: U.refreshFailedState.retryButton,
65
- onRetry: P,
66
- testId: N.disclosuresRefreshFailed
67
- }) : /* @__PURE__ */ j(C, { onAccepted: ee });
68
- if (G || K) {
69
- if (H) return ie();
70
- } else return R ? F.reason === l.OrganizationApplicationStartedByOther ? /* @__PURE__ */ j(d, {
71
- title: W.applicationInFlightState.title,
72
- description: W.applicationInFlightState.body,
73
- retryLabel: W.applicationInFlightState.retryButton,
74
- onRetry: F.refetch,
75
- testId: N.applicationInFlight
76
- }) : X ? b || re && !D ? /* @__PURE__ */ j(d, {
77
- title: U.initFailedState.title,
78
- description: U.initFailedState.body,
79
- retryLabel: U.initFailedState.retryButton,
80
- onRetry: P,
81
- testId: N.initFailed
82
- }) : $() : /* @__PURE__ */ j(w, {
82
+ let Oe = () => G && M ? /* @__PURE__ */ k(f, {
83
+ title: J.refreshFailedState.title,
84
+ description: J.refreshFailedState.body,
85
+ retryLabel: J.refreshFailedState.retryButton,
86
+ onRetry: F,
87
+ testId: A.disclosuresRefreshFailed
88
+ }) : /* @__PURE__ */ k(ie, { onAccepted: ge });
89
+ if (X || Se) {
90
+ if (q) return Oe();
91
+ } else return pe ? Z ? M || Ee && !P ? /* @__PURE__ */ k(f, {
92
+ title: J.initFailedState.title,
93
+ description: J.initFailedState.body,
94
+ retryLabel: J.initFailedState.retryButton,
95
+ onRetry: F,
96
+ testId: A.initFailed
97
+ }) : $() : !L.isResolved && H !== S.Form && !U ? $() : (H === S.Hidden || H === S.Form && I.isSuppressed) && B?.status !== "COMPLETE" && !U && !K ? /* @__PURE__ */ k(f, {
98
+ title: Y.applicationUnavailableState.title,
99
+ description: Y.applicationUnavailableState.body,
100
+ retryLabel: Y.applicationUnavailableState.retryButton,
101
+ onRetry: I.refetch,
102
+ testId: A.applicationUnavailable
103
+ }) : /* @__PURE__ */ k(ae, {
83
104
  isFullScreenInline: !0,
84
- onEmbeddedOnboardingCompletedSuccessfully: () => ne(!0),
105
+ showApplicationStatusRefresh: !0,
106
+ onResultPhaseChange: de,
107
+ onEmbeddedOnboardingCompletedSuccessfully: () => _e(!0),
85
108
  onNavigateToDashboard: () => {
86
- a.includes(i.Dashboard) && f(i.Dashboard), P();
109
+ be(!0), c.includes(i.Dashboard) && y(i.Dashboard), F();
87
110
  },
88
111
  disclosureLinks: r,
89
- ...c.onboarding
112
+ ...m.onboarding
90
113
  }) : $();
91
- let ae = p?.bankName?.trim(), oe = ae ? c.sectionTitle.bankTagline.replaceAll("{bankName}", ae) : void 0, se = a.map((e) => {
92
- let { Content: r, placesOwnTitle: a } = y[e], o = c.menu[e], s = e === i.Accounts ? void 0 : oe, l = (e) => /* @__PURE__ */ j(t, {
114
+ let ke = b?.bankName?.trim(), Ae = ke ? m.sectionTitle.bankTagline.replaceAll("{bankName}", ke) : void 0, je = c.map((e) => {
115
+ let { Content: r, placesOwnTitle: a } = re[e], o = m.menu[e], s = e === i.Accounts ? void 0 : Ae, c = (e) => /* @__PURE__ */ k(t, {
93
116
  title: o,
94
117
  bankTagline: s,
95
118
  children: e
96
- }), u = /* @__PURE__ */ j(r, {});
97
- return n && (u = a ? /* @__PURE__ */ j(r, { renderTitle: l }) : /* @__PURE__ */ M(A, { children: [l(), /* @__PURE__ */ j(r, {})] })), {
119
+ }), l = /* @__PURE__ */ k(r, {});
120
+ return n && (l = a ? /* @__PURE__ */ k(r, { renderTitle: c }) : /* @__PURE__ */ ce(se, { children: [c(), /* @__PURE__ */ k(r, {})] })), {
98
121
  id: e,
99
122
  label: o,
100
- content: u
123
+ content: l
101
124
  };
102
125
  });
103
- return /* @__PURE__ */ j(e, {
104
- sections: se,
105
- selectedSectionId: s ?? "",
106
- onSectionChange: z,
107
- labels: c.shell
126
+ return /* @__PURE__ */ k(e, {
127
+ sections: je,
128
+ selectedSectionId: p ?? "",
129
+ onSectionChange: me,
130
+ labels: m.shell
108
131
  });
109
132
  }
110
- function F({ sections: e = r, section: t, defaultSection: i, onSectionChange: o, labels: l, cardArtSrc: u, ...d }) {
111
- let p = f();
112
- E(() => {
113
- p(x.Mounted);
114
- }, [p]);
115
- let { initResponse: m } = h(), g = m?.scopes, { client: _, widgetToken: v } = s(), b = m?.userId ?? null, [S, C] = k(b), [w, T] = k(0);
116
- b !== S && (C(b), S !== null && T((e) => e + 1));
117
- let [O, A] = k(_);
118
- _ !== O && (A(_), T((e) => e + 1));
119
- let M = !!v, [N, F] = k(M);
120
- M !== N && (F(M), T((e) => e + 1));
121
- let I = m?.organizationId ?? null, [L, R] = k(I);
122
- I !== L && (R(I), L !== null && T((e) => e + 1));
123
- let z = D(() => n(l), [l]), B = e.filter((e) => {
124
- let t = y[e];
125
- return !!t && (!t.anyOfScopes || c(g, t.anyOfScopes));
133
+ function N({ sections: e = r, section: t, defaultSection: i, onSectionChange: o, labels: l, cardArtSrc: u, ...d }) {
134
+ let f = p();
135
+ T(() => {
136
+ f(b.Mounted);
137
+ }, [f]);
138
+ let { initResponse: m } = ee(), h = m?.scopes, { client: g, widgetToken: _ } = s(), v = m?.userId ?? null, [te, ne] = O(v), [y, x] = O(0);
139
+ v !== te && (ne(v), te !== null && x((e) => e + 1));
140
+ let [ie, S] = O(g);
141
+ g !== ie && (S(g), x((e) => e + 1));
142
+ let C = !!_, [ae, w] = O(C);
143
+ C !== ae && (w(C), x((e) => e + 1));
144
+ let E = m?.organizationId ?? null, [D, se] = O(E);
145
+ E !== D && (se(E), D !== null && x((e) => e + 1));
146
+ let [ce, A] = O(!1), [j, N] = O(!1), [P, F] = O(null), I = () => {
147
+ A(!1), x((e) => e + 1);
148
+ }, [L, R] = O(_);
149
+ _ !== L && (R(_), ce && v === null && E === null && C === !!L && (j ? F(y) : I())), P !== null && !j && (F(null), P === y && v === null && E === null && I());
150
+ let z = oe(() => n(l), [l]), B = e.filter((e) => {
151
+ let t = re[e];
152
+ return !!t && (!t.anyOfScopes || c(h, t.anyOfScopes));
126
153
  });
127
- return /* @__PURE__ */ j(a, {
154
+ return /* @__PURE__ */ k(a, {
128
155
  sections: e,
129
156
  availableSections: B,
130
- grantedScopes: g,
157
+ grantedScopes: h,
131
158
  labels: z,
132
159
  section: t,
133
160
  defaultSection: i,
134
161
  onSectionChange: o,
135
162
  cardArtSrc: u,
136
- children: /* @__PURE__ */ j(P, { ...d }, w)
163
+ children: /* @__PURE__ */ k(M, {
164
+ onApplicantLatchChange: A,
165
+ onResultScreenHeldChange: N,
166
+ ...d
167
+ }, y)
137
168
  });
138
169
  }
139
- function I({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: u, disclosuresAcceptance: d, providerLabels: f, ...m }) {
140
- return /* @__PURE__ */ j(p, {
141
- widgetName: b,
170
+ function P({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: u, disclosuresAcceptance: d, providerLabels: f, ...p }) {
171
+ return /* @__PURE__ */ k(m, {
172
+ widgetName: y,
142
173
  baseUrl: e,
143
174
  widgetToken: t,
144
175
  organizationId: n,
@@ -152,8 +183,8 @@ function I({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gat
152
183
  analytics: u,
153
184
  disclosuresAcceptance: d,
154
185
  providerLabels: f,
155
- children: /* @__PURE__ */ j(F, { ...m })
186
+ children: /* @__PURE__ */ k(N, { ...p })
156
187
  });
157
188
  }
158
189
  //#endregion
159
- export { N as WIDGET_SUITE_TEST_IDS, I as WidgetSuite, I as default };
190
+ export { A as WIDGET_SUITE_TEST_IDS, P as WidgetSuite, P as default };
@@ -27,11 +27,18 @@ var n = {
27
27
  retryButton: "Try again"
28
28
  }
29
29
  },
30
- onboardingGate: { applicationInFlightState: {
31
- title: "Application in progress",
32
- body: "Your organization's account application is already being set up by a teammate. Contact your organization admin for details.",
33
- retryButton: "Check again"
34
- } },
30
+ onboardingGate: {
31
+ applicationUnavailableState: {
32
+ title: "We can't show your application",
33
+ body: "Your organization's bank account application isn't available here. Contact your organization admin or the bank for details.",
34
+ retryButton: "Check again"
35
+ },
36
+ applicationInFlightState: {
37
+ title: "Application in progress",
38
+ body: "Your organization's account application is already being set up by a teammate. Contact your organization admin for details.",
39
+ retryButton: "Check again"
40
+ }
41
+ },
35
42
  sections: {
36
43
  dashboard: {},
37
44
  cards: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.232",
3
+ "version": "0.5.235",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {