@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.
- package/README.md +16 -14
- package/dist/index.d.ts +66 -15
- package/dist/lib/BankAccountOnboardingWidget.d.ts +39 -1
- package/dist/lib/ReceivablesWidget.d.ts +1 -0
- package/dist/lib/WidgetSuite.d.ts +65 -15
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index23.js +15 -11
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index26.js +441 -409
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index10.js +18 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +26 -30
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +35 -35
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/clientRegistry.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js +123 -92
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +12 -5
- 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
|
|
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
|
|
19
|
-
import { WidgetProvider as
|
|
20
|
-
import { useRefetchWidget as
|
|
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
|
|
23
|
-
import { WIDGET_NAME as
|
|
24
|
-
import { needsDisclosureAcceptance as
|
|
25
|
-
import { AcceptDisclosuresWidget as
|
|
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 {
|
|
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
|
|
30
|
-
import { Fragment as
|
|
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
|
|
35
|
+
var A = {
|
|
33
36
|
initFailed: "widget-suite-init-failed",
|
|
34
37
|
disclosuresRefreshFailed: "widget-suite-disclosures-refresh-failed",
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
function
|
|
38
|
-
let { availableSections:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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:
|
|
51
|
-
labels:
|
|
71
|
+
onSectionChange: me,
|
|
72
|
+
labels: m.shell
|
|
52
73
|
});
|
|
53
|
-
if (
|
|
54
|
-
if ((!
|
|
55
|
-
title:
|
|
56
|
-
description:
|
|
57
|
-
retryLabel:
|
|
58
|
-
onRetry:
|
|
59
|
-
testId:
|
|
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
|
|
62
|
-
title:
|
|
63
|
-
description:
|
|
64
|
-
retryLabel:
|
|
65
|
-
onRetry:
|
|
66
|
-
testId:
|
|
67
|
-
}) : /* @__PURE__ */
|
|
68
|
-
if (
|
|
69
|
-
if (
|
|
70
|
-
} else return
|
|
71
|
-
title:
|
|
72
|
-
description:
|
|
73
|
-
retryLabel:
|
|
74
|
-
onRetry: F
|
|
75
|
-
testId:
|
|
76
|
-
}) :
|
|
77
|
-
title:
|
|
78
|
-
description:
|
|
79
|
-
retryLabel:
|
|
80
|
-
onRetry:
|
|
81
|
-
testId:
|
|
82
|
-
}) :
|
|
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
|
-
|
|
105
|
+
showApplicationStatusRefresh: !0,
|
|
106
|
+
onResultPhaseChange: de,
|
|
107
|
+
onEmbeddedOnboardingCompletedSuccessfully: () => _e(!0),
|
|
85
108
|
onNavigateToDashboard: () => {
|
|
86
|
-
|
|
109
|
+
be(!0), c.includes(i.Dashboard) && y(i.Dashboard), F();
|
|
87
110
|
},
|
|
88
111
|
disclosureLinks: r,
|
|
89
|
-
...
|
|
112
|
+
...m.onboarding
|
|
90
113
|
}) : $();
|
|
91
|
-
let
|
|
92
|
-
let { Content: r, placesOwnTitle: a } =
|
|
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
|
-
}),
|
|
97
|
-
return n && (
|
|
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:
|
|
123
|
+
content: l
|
|
101
124
|
};
|
|
102
125
|
});
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
sections:
|
|
105
|
-
selectedSectionId:
|
|
106
|
-
onSectionChange:
|
|
107
|
-
labels:
|
|
126
|
+
return /* @__PURE__ */ k(e, {
|
|
127
|
+
sections: je,
|
|
128
|
+
selectedSectionId: p ?? "",
|
|
129
|
+
onSectionChange: me,
|
|
130
|
+
labels: m.shell
|
|
108
131
|
});
|
|
109
132
|
}
|
|
110
|
-
function
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}, [
|
|
115
|
-
let { initResponse: m } =
|
|
116
|
-
|
|
117
|
-
let [
|
|
118
|
-
|
|
119
|
-
let
|
|
120
|
-
|
|
121
|
-
let
|
|
122
|
-
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
|
|
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__ */
|
|
154
|
+
return /* @__PURE__ */ k(a, {
|
|
128
155
|
sections: e,
|
|
129
156
|
availableSections: B,
|
|
130
|
-
grantedScopes:
|
|
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__ */
|
|
163
|
+
children: /* @__PURE__ */ k(M, {
|
|
164
|
+
onApplicantLatchChange: A,
|
|
165
|
+
onResultScreenHeldChange: N,
|
|
166
|
+
...d
|
|
167
|
+
}, y)
|
|
137
168
|
});
|
|
138
169
|
}
|
|
139
|
-
function
|
|
140
|
-
return /* @__PURE__ */
|
|
141
|
-
widgetName:
|
|
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__ */
|
|
186
|
+
children: /* @__PURE__ */ k(N, { ...p })
|
|
156
187
|
});
|
|
157
188
|
}
|
|
158
189
|
//#endregion
|
|
159
|
-
export {
|
|
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: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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: {
|