@tesouro/embedded-components-react 0.5.147 → 0.5.149
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/dist/fixtures/index.d.ts +54 -1
- package/dist/fixtures/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index11.js +11 -8
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index2.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/data-access/dist/index5.js +21 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +14 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +17 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +43 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index18.js +9 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +52 -49
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index6.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index7.js +10 -7
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index8.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/data-access/dist/index7.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index2.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index3.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index2.js +12 -6
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index3.js +12 -6
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index2.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index3.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +30 -15
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/data-access/dist/index4.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index4.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/data-access/dist/index2.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index10.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index2.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index7.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index8.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index12.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index13.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js +16 -13
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index3.js +12 -6
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index7.js +12 -6
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/EmbedApiContext.js +9 -6
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/applicationStatusQueryOptions.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js +14 -14
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js +15 -12
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/merchant-category-group/useAllMerchantCategoryGroupsQuery.js +17 -14
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +23 -17
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js +17 -14
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useRolePermissionsQueries.js +19 -16
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useCurrentUserQuery.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useGetUserDataQuery.js +12 -9
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +19 -16
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index3.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +99 -98
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +139 -138
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/useWidgetFetch.js +11 -10
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index2.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index3.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index8.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index6.js +16 -13
- package/package.json +8 -1
|
@@ -13,213 +13,214 @@ import { useDesignSystemEnsurer as te, useFrameworkRenderer as ne } from "../../
|
|
|
13
13
|
import { HostIsolationScope as re } from "../../../../ui/dist/lib/HostIsolationScope/HostIsolationScope.js";
|
|
14
14
|
import { ErrorState as s } from "../../../../ui/dist/lib/ErrorState/ErrorState.js";
|
|
15
15
|
import "../../../../ui/dist/index.js";
|
|
16
|
-
import { getGlobalSnapshot as
|
|
17
|
-
import { EmbeddedAnalyticsEvent as
|
|
18
|
-
import { configureEmbeddedClient as
|
|
19
|
-
import { generateCorrelationId as
|
|
20
|
-
import { WidgetContext as
|
|
21
|
-
import { noop as
|
|
22
|
-
import { useWidgetFetch as
|
|
23
|
-
import { deriveWidgetInitState as
|
|
24
|
-
import { useAnalyticsTrack as
|
|
25
|
-
import { resolveProviderLabels as
|
|
26
|
-
import { WidgetErrorBoundary as
|
|
27
|
-
import { DISCLOSURES_REQUIRED_TEST_ID as
|
|
28
|
-
import { useContext as
|
|
29
|
-
import { jsx as
|
|
30
|
-
import { QueryClient as
|
|
16
|
+
import { getGlobalSnapshot as c, subscribeToGlobal as ie } from "./globalStore.js";
|
|
17
|
+
import { EmbeddedAnalyticsEvent as l } from "../analytics/events.js";
|
|
18
|
+
import { configureEmbeddedClient as ae } from "../analytics/client.js";
|
|
19
|
+
import { generateCorrelationId as oe } from "../analytics/ids.js";
|
|
20
|
+
import { WidgetContext as se } from "./WidgetContext.js";
|
|
21
|
+
import { noop as ce, resolveOrgId as le, useAuthEpoch as ue } from "./utils.js";
|
|
22
|
+
import { useWidgetFetch as de } from "./useWidgetFetch.js";
|
|
23
|
+
import { deriveWidgetInitState as fe, useWidgetInitPublisher as pe } from "./useWidgetInitPublisher.js";
|
|
24
|
+
import { useAnalyticsTrack as u } from "../analytics/hooks.js";
|
|
25
|
+
import { resolveProviderLabels as me } from "./labels.js";
|
|
26
|
+
import { WidgetErrorBoundary as he } from "./WidgetErrorBoundary.js";
|
|
27
|
+
import { DISCLOSURES_REQUIRED_TEST_ID as d, hasRenderableAcceptanceSurface as f, resolveDisclosuresBlockedReason as p, shouldGateOnDisclosuresAcceptance as ge } from "./isDisclosuresAcceptanceRequired.js";
|
|
28
|
+
import { useContext as _e, useEffect as m, useMemo as h, useRef as g, useState as _, useSyncExternalStore as ve } from "react";
|
|
29
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
30
|
+
import { QueryClient as ye, QueryClientProvider as be } from "@tanstack/react-query";
|
|
31
31
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
enabled:
|
|
35
|
-
organizationId:
|
|
36
|
-
rootCorrelationId:
|
|
37
|
-
widgetName:
|
|
38
|
-
widgetInstanceId:
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
if (!
|
|
32
|
+
function y({ children: ne, baseUrl: s, widgetToken: l, organizationId: u, configClient: d, gatewayRouting: f, linkComponent: p, uiFramework: y, implementation: b, errorFallback: Se, onError: Ce, analytics: x, disclosuresAcceptance: we, providerLabels: Te, widgetName: S }) {
|
|
33
|
+
let C = _e(se), Ee = ve(ie, c, c), w = C?.resolved ?? Ee, De = C?.refetch ?? ce, Oe = C?.loading ?? !1, ke = C?.error ?? null, T = s ?? w.baseUrl, E = l === void 0 ? w.widgetToken : l, Ae = C ? C.cascadeOrgId : Ee.organizationId, D = u === void 0 ? Ae : u, O = d ?? w.configClient, k = f ?? w.gatewayRouting, A = p ?? w.linkComponent, j = y ?? w.uiFramework, M = b ?? w.implementation, N = we ?? C?.disclosuresAcceptance, P = Te ?? C?.providerLabels, je = h(() => me(P), [P]), F = C === null, I = F ? x !== !1 : C.analytics.enabled, [Me] = _(oe), L = F ? Me : C.analytics.rootCorrelationId, [Ne] = _(oe), R = S === void 0 ? C?.analytics.widgetName : S, z = S === void 0 ? C?.analytics.widgetInstanceId : Ne, B = g({
|
|
34
|
+
enabled: I,
|
|
35
|
+
organizationId: D,
|
|
36
|
+
rootCorrelationId: L,
|
|
37
|
+
widgetName: R,
|
|
38
|
+
widgetInstanceId: z
|
|
39
|
+
}), Pe = g(!1);
|
|
40
|
+
m(() => {
|
|
41
|
+
F || x === void 0 || Pe.current || (Pe.current = !0, console.warn("[tesouro-embedded] `analytics` on a nested WidgetProvider is ignored in v1. Set it on the outermost RootWidgetProvider or standalone WidgetProvider instead."));
|
|
42
|
+
}, [x, F]), m(() => {
|
|
43
|
+
if (!F || !I || !("window" in globalThis)) return;
|
|
44
44
|
let e = !1;
|
|
45
45
|
return import("../analytics/install.js").then(({ ensureAnalyticsAdapterInstalled: t }) => {
|
|
46
46
|
e || t();
|
|
47
47
|
}), () => {
|
|
48
48
|
e = !0;
|
|
49
49
|
};
|
|
50
|
-
}, [
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, [
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
let
|
|
58
|
-
if (!
|
|
59
|
-
let e =
|
|
60
|
-
tokenRef:
|
|
61
|
-
analyticsContextRef:
|
|
62
|
-
clientSecretRef:
|
|
63
|
-
gatewayRouting:
|
|
50
|
+
}, [F, I]);
|
|
51
|
+
let V = te(o(j));
|
|
52
|
+
m(() => {
|
|
53
|
+
V && V().catch(() => {});
|
|
54
|
+
}, [V]);
|
|
55
|
+
let Fe = C === null || s !== void 0 || l !== void 0 || u !== void 0 || d != null || f !== void 0 || S !== void 0, Ie = g(E);
|
|
56
|
+
Ie.current = E;
|
|
57
|
+
let Le = g(null), Re = h(() => e(Le), []), ze = a(), Be = ue(E), H = h(() => {
|
|
58
|
+
if (!Fe) return null;
|
|
59
|
+
let e = ae(r(T), {
|
|
60
|
+
tokenRef: Ie,
|
|
61
|
+
analyticsContextRef: B,
|
|
62
|
+
clientSecretRef: Le,
|
|
63
|
+
gatewayRouting: k
|
|
64
64
|
});
|
|
65
|
-
return
|
|
65
|
+
return O ? O(e) : e;
|
|
66
66
|
}, [
|
|
67
|
-
|
|
68
|
-
w,
|
|
69
|
-
D,
|
|
70
|
-
O
|
|
71
|
-
]), H = S === null || s !== void 0 || c !== void 0, He = H ? Ve : Be.authEpoch, { result: U, loading: W, error: G, clearedForAuthChange: Ue, initStaleForToken: K, refetch: We } = fe(H ? V : null, H ? T : void 0, z), Ge = H ? We : Oe, Ke = H ? W : ke, qe = H ? G : Ae, Je = S?.resolved.initResponse, Ye = !H || !Ue && !G && !U && !!T && !W, q = Ye ? Je : U ?? void 0, J = Ye ? H || (S?.initResponseStaleForToken ?? !1) : K, Y = S === null, Xe = m(() => Y ? pe({
|
|
72
|
-
hasToken: !!T,
|
|
73
|
-
loading: W,
|
|
74
|
-
error: G,
|
|
75
|
-
initResponse: U ?? void 0,
|
|
76
|
-
initStaleForToken: K
|
|
77
|
-
}) : null, [
|
|
78
|
-
Y,
|
|
67
|
+
Fe,
|
|
79
68
|
T,
|
|
80
|
-
|
|
69
|
+
O,
|
|
70
|
+
k
|
|
71
|
+
]), U = C === null || s !== void 0 || l !== void 0, Ve = U ? Be : ze.authEpoch, { result: W, loading: G, error: K, clearedForAuthChange: He, initStaleForToken: q, initReplacementPending: Ue, refetch: We } = de(U ? H : null, U ? E : void 0, B), Ge = U ? We : De, Ke = U ? G : Oe, qe = U ? K : ke, Je = C?.resolved.initResponse, Ye = !U || !He && !K && !W && !!E && !G, J = Ye ? Je : W ?? void 0, Y = Ye ? U || (C?.initResponseStaleForToken ?? !1) : q, Xe = C === null, Ze = h(() => Xe ? fe({
|
|
72
|
+
hasToken: !!E,
|
|
73
|
+
loading: G,
|
|
74
|
+
error: K,
|
|
75
|
+
initResponse: W ?? void 0,
|
|
76
|
+
initStaleForToken: q
|
|
77
|
+
}) : null, [
|
|
78
|
+
Xe,
|
|
79
|
+
E,
|
|
81
80
|
G,
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
K,
|
|
82
|
+
W,
|
|
83
|
+
q
|
|
84
84
|
]);
|
|
85
|
-
|
|
86
|
-
let X =
|
|
87
|
-
enabled:
|
|
85
|
+
pe(Ze, E);
|
|
86
|
+
let X = le(D, Y ? void 0 : J?.organizationId), Qe = D === void 0 && (U ? Ue : ze.organizationPending), Z = h(() => ({
|
|
87
|
+
enabled: I,
|
|
88
88
|
organizationId: X,
|
|
89
|
-
rootCorrelationId:
|
|
90
|
-
widgetName:
|
|
91
|
-
widgetInstanceId:
|
|
89
|
+
rootCorrelationId: L,
|
|
90
|
+
widgetName: R,
|
|
91
|
+
widgetInstanceId: z
|
|
92
92
|
}), [
|
|
93
|
-
F,
|
|
94
|
-
X,
|
|
95
93
|
I,
|
|
94
|
+
X,
|
|
96
95
|
L,
|
|
97
|
-
R
|
|
96
|
+
R,
|
|
97
|
+
z
|
|
98
98
|
]);
|
|
99
|
-
|
|
100
|
-
let [Q] =
|
|
99
|
+
B.current = Z;
|
|
100
|
+
let [Q] = _(() => C === null ? new ye({ defaultOptions: {
|
|
101
101
|
queries: {
|
|
102
102
|
retry: !1,
|
|
103
103
|
refetchOnWindowFocus: !1
|
|
104
104
|
},
|
|
105
105
|
mutations: { retry: !1 }
|
|
106
106
|
} }) : null);
|
|
107
|
-
|
|
107
|
+
m(() => {
|
|
108
108
|
if (!Q) return;
|
|
109
109
|
let e = Q;
|
|
110
110
|
return t(e), () => n(e);
|
|
111
111
|
}, [Q]);
|
|
112
|
-
let
|
|
112
|
+
let $e = h(() => ({
|
|
113
113
|
baseUrl: s,
|
|
114
|
-
widgetToken:
|
|
115
|
-
organizationId:
|
|
116
|
-
configClient:
|
|
117
|
-
gatewayRouting:
|
|
118
|
-
linkComponent:
|
|
119
|
-
uiFramework:
|
|
120
|
-
implementation:
|
|
114
|
+
widgetToken: l,
|
|
115
|
+
organizationId: u,
|
|
116
|
+
configClient: d,
|
|
117
|
+
gatewayRouting: f,
|
|
118
|
+
linkComponent: p,
|
|
119
|
+
uiFramework: y,
|
|
120
|
+
implementation: b
|
|
121
121
|
}), [
|
|
122
122
|
s,
|
|
123
|
-
c,
|
|
124
123
|
l,
|
|
125
124
|
u,
|
|
126
125
|
d,
|
|
127
126
|
f,
|
|
128
|
-
|
|
129
|
-
y
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
p,
|
|
128
|
+
y,
|
|
129
|
+
b
|
|
130
|
+
]), et = h(() => ({
|
|
131
|
+
baseUrl: T,
|
|
132
|
+
widgetToken: E,
|
|
133
133
|
organizationId: X,
|
|
134
|
-
configClient:
|
|
135
|
-
gatewayRouting:
|
|
136
|
-
linkComponent:
|
|
137
|
-
uiFramework:
|
|
138
|
-
implementation:
|
|
139
|
-
initResponse:
|
|
134
|
+
configClient: O,
|
|
135
|
+
gatewayRouting: k,
|
|
136
|
+
linkComponent: A,
|
|
137
|
+
uiFramework: j,
|
|
138
|
+
implementation: M,
|
|
139
|
+
initResponse: J
|
|
140
140
|
}), [
|
|
141
|
-
w,
|
|
142
141
|
T,
|
|
142
|
+
E,
|
|
143
143
|
X,
|
|
144
|
-
D,
|
|
145
144
|
O,
|
|
146
145
|
k,
|
|
147
146
|
A,
|
|
148
147
|
j,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
M,
|
|
149
|
+
J
|
|
150
|
+
]), tt = h(() => ({
|
|
151
|
+
resolved: et,
|
|
152
|
+
own: $e,
|
|
153
153
|
refetch: Ge,
|
|
154
154
|
loading: Ke,
|
|
155
155
|
error: qe,
|
|
156
156
|
analytics: Z,
|
|
157
|
-
cascadeOrgId:
|
|
158
|
-
initResponseStaleForToken:
|
|
159
|
-
disclosuresAcceptance:
|
|
160
|
-
providerLabels:
|
|
157
|
+
cascadeOrgId: D,
|
|
158
|
+
initResponseStaleForToken: Y,
|
|
159
|
+
disclosuresAcceptance: N,
|
|
160
|
+
providerLabels: P
|
|
161
161
|
}), [
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
et,
|
|
163
|
+
$e,
|
|
164
164
|
Ge,
|
|
165
165
|
Ke,
|
|
166
166
|
qe,
|
|
167
167
|
Z,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
]),
|
|
173
|
-
value:
|
|
174
|
-
children: /* @__PURE__ */
|
|
175
|
-
linkComponent:
|
|
176
|
-
uiFramework:
|
|
177
|
-
children: /* @__PURE__ */
|
|
178
|
-
resetKeys: [
|
|
179
|
-
errorFallback:
|
|
180
|
-
onError:
|
|
181
|
-
labels:
|
|
182
|
-
children:
|
|
183
|
-
disclosuresAcceptance:
|
|
184
|
-
initStaleForToken:
|
|
185
|
-
labels:
|
|
168
|
+
D,
|
|
169
|
+
Y,
|
|
170
|
+
N,
|
|
171
|
+
P
|
|
172
|
+
]), nt = /* @__PURE__ */ v(se.Provider, {
|
|
173
|
+
value: tt,
|
|
174
|
+
children: /* @__PURE__ */ v(ee, {
|
|
175
|
+
linkComponent: A,
|
|
176
|
+
uiFramework: j,
|
|
177
|
+
children: /* @__PURE__ */ v(re, { children: /* @__PURE__ */ v(he, {
|
|
178
|
+
resetKeys: [E],
|
|
179
|
+
errorFallback: Se,
|
|
180
|
+
onError: Ce,
|
|
181
|
+
labels: je,
|
|
182
|
+
children: ge(J, S) ? /* @__PURE__ */ v(xe, {
|
|
183
|
+
disclosuresAcceptance: N,
|
|
184
|
+
initStaleForToken: Y,
|
|
185
|
+
labels: je
|
|
186
186
|
}) : ne
|
|
187
187
|
}) })
|
|
188
188
|
})
|
|
189
|
-
}), $ =
|
|
190
|
-
client:
|
|
189
|
+
}), $ = H ? /* @__PURE__ */ v(i, {
|
|
190
|
+
client: H,
|
|
191
191
|
organizationId: X,
|
|
192
|
-
widgetToken:
|
|
193
|
-
installClientSecret:
|
|
194
|
-
authEpoch:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
widgetToken: E,
|
|
193
|
+
installClientSecret: Re,
|
|
194
|
+
authEpoch: Ve,
|
|
195
|
+
organizationPending: Qe,
|
|
196
|
+
children: nt
|
|
197
|
+
}) : nt;
|
|
198
|
+
return Q ? /* @__PURE__ */ v(be, {
|
|
198
199
|
client: Q,
|
|
199
200
|
children: $
|
|
200
201
|
}) : $;
|
|
201
202
|
}
|
|
202
|
-
function
|
|
203
|
-
let r = ne("error-state") ?? s, i =
|
|
203
|
+
function xe({ disclosuresAcceptance: e, initStaleForToken: t, labels: n }) {
|
|
204
|
+
let r = ne("error-state") ?? s, i = u(), a = f(e), o = p({
|
|
204
205
|
initStaleForToken: t,
|
|
205
206
|
hasAcceptanceSurface: a
|
|
206
207
|
});
|
|
207
|
-
return
|
|
208
|
-
i(
|
|
209
|
-
}, [o, i]), t ? /* @__PURE__ */
|
|
208
|
+
return m(() => {
|
|
209
|
+
i(l.WidgetDisclosuresBlocked, { reason: o }), console.info(`[disclosures] widget blocked: ${o}`);
|
|
210
|
+
}, [o, i]), t ? /* @__PURE__ */ v(r, {
|
|
210
211
|
title: n.disclosuresRefreshingTitle,
|
|
211
212
|
description: n.disclosuresRefreshingDescription,
|
|
212
|
-
testId:
|
|
213
|
+
testId: d,
|
|
213
214
|
className: "ttw:w-full ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:py-7 ttw:text-card-foreground ttw:shadow-sm"
|
|
214
|
-
}) : a ? /* @__PURE__ */
|
|
215
|
-
"data-testid":
|
|
215
|
+
}) : a ? /* @__PURE__ */ v("div", {
|
|
216
|
+
"data-testid": d,
|
|
216
217
|
className: "ttw:w-full",
|
|
217
218
|
children: e
|
|
218
|
-
}) : /* @__PURE__ */
|
|
219
|
+
}) : /* @__PURE__ */ v(r, {
|
|
219
220
|
title: n.disclosuresRequiredTitle,
|
|
220
|
-
testId:
|
|
221
|
+
testId: d,
|
|
221
222
|
className: "ttw:w-full ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:py-7 ttw:text-card-foreground ttw:shadow-sm"
|
|
222
223
|
});
|
|
223
224
|
}
|
|
224
225
|
//#endregion
|
|
225
|
-
export {
|
|
226
|
+
export { y as WidgetProvider, y as default };
|
|
@@ -6,15 +6,15 @@ import { resolveOrgId as r } from "./utils.js";
|
|
|
6
6
|
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
7
7
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/useWidgetFetch.js
|
|
8
8
|
function c(c, l, u) {
|
|
9
|
-
let [d, p] = s(null), [m, h] = s(!1), [g, _] = s(null), [v, y] = s(!1), [b, x] = s(0), S = o(c),
|
|
9
|
+
let [d, p] = s(null), [m, h] = s(!1), [g, _] = s(null), [v, y] = s(!1), [b, x] = s(0), [S, C] = s(!1), w = o(c), T = o(l), E = o(void 0), D = o(void 0);
|
|
10
10
|
a(() => {
|
|
11
|
-
let i =
|
|
12
|
-
if (
|
|
13
|
-
p(null), h(!1), _(null), y(!1),
|
|
11
|
+
let i = w.current !== c, a = T.current !== l;
|
|
12
|
+
if (w.current = c, T.current = l, !c || !l) {
|
|
13
|
+
p(null), h(!1), _(null), y(!1), E.current = void 0, D.current = void 0;
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
let o = !1, s = new AbortController();
|
|
17
|
-
h(!0), _(null), i ? (p(null), y(!0),
|
|
17
|
+
h(!0), _(null), i ? (p(null), y(!0), E.current = void 0, D.current = void 0) : a && y(!1);
|
|
18
18
|
let d = typeof performance < "u" ? performance.now() : Date.now();
|
|
19
19
|
return e({
|
|
20
20
|
client: c,
|
|
@@ -23,7 +23,7 @@ function c(c, l, u) {
|
|
|
23
23
|
}).then((e) => {
|
|
24
24
|
if (o) return;
|
|
25
25
|
let i = e.data ?? null;
|
|
26
|
-
if (
|
|
26
|
+
if (E.current = i ? l : void 0, D.current = i ? c : void 0, p(i), C(!1), _(null), y(!1), h(!1), u) {
|
|
27
27
|
let i = typeof performance < "u" ? performance.now() : Date.now(), a = u.current;
|
|
28
28
|
n(t.WidgetInitFetched, { duration_ms: Math.round(i - d) }, {
|
|
29
29
|
...a,
|
|
@@ -31,7 +31,7 @@ function c(c, l, u) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}, (e) => {
|
|
34
|
-
if (!(o || e instanceof Error && e.name === "AbortError") && (i && (p(null),
|
|
34
|
+
if (!(o || e instanceof Error && e.name === "AbortError") && (i && (p(null), E.current = void 0, D.current = void 0), y(!1), C(!0), _(e instanceof Error ? e : Error("Widget init fetch failed", { cause: e })), h(!1), u)) {
|
|
35
35
|
let r = typeof performance < "u" ? performance.now() : Date.now();
|
|
36
36
|
n(t.WidgetInitFailed, {
|
|
37
37
|
duration_ms: Math.round(r - d),
|
|
@@ -47,14 +47,15 @@ function c(c, l, u) {
|
|
|
47
47
|
b,
|
|
48
48
|
u
|
|
49
49
|
]);
|
|
50
|
-
let
|
|
50
|
+
let O = i(() => x((e) => e + 1), []), k = d !== null && (E.current !== l || D.current !== c);
|
|
51
51
|
return {
|
|
52
52
|
result: d,
|
|
53
53
|
loading: m,
|
|
54
54
|
error: g,
|
|
55
55
|
clearedForAuthChange: v,
|
|
56
|
-
initStaleForToken:
|
|
57
|
-
|
|
56
|
+
initStaleForToken: k,
|
|
57
|
+
initReplacementPending: k && !S,
|
|
58
|
+
refetch: O
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
function l(e) {
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.5.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.5.149", n = "b55b5c0119256ab01eeabd18be4881238052ca1d", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|
|
@@ -10,14 +10,17 @@ import "../../../data-access/dist/index.js";
|
|
|
10
10
|
import { useQuery as i } from "@tanstack/react-query";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index2.js
|
|
12
12
|
function a({ enabled: a, ...o } = {}) {
|
|
13
|
-
let { client: s, organizationId: c, widgetToken: l, authEpoch: u } = n(),
|
|
13
|
+
let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationPending: d } = n(), f = !!(c && l) && (a === !0 || a === void 0), p = e({
|
|
14
14
|
query: o,
|
|
15
15
|
client: s,
|
|
16
16
|
headers: r(c)
|
|
17
17
|
});
|
|
18
18
|
return i({
|
|
19
|
-
...t(
|
|
20
|
-
|
|
19
|
+
...t(p, {
|
|
20
|
+
authEpoch: u,
|
|
21
|
+
organizationPending: d
|
|
22
|
+
}, { carryWithinOrg: !0 }),
|
|
23
|
+
enabled: f
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
//#endregion
|
|
@@ -10,14 +10,17 @@ import "../../../data-access/dist/index.js";
|
|
|
10
10
|
import { useQuery as i } from "@tanstack/react-query";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index3.js
|
|
12
12
|
function a(a) {
|
|
13
|
-
let { client: o, organizationId: s, widgetToken: c, authEpoch: l } = n(),
|
|
13
|
+
let { client: o, organizationId: s, widgetToken: c, authEpoch: l, organizationPending: u } = n(), d = !!(s && c && a), f = e({
|
|
14
14
|
client: o,
|
|
15
15
|
headers: r(s),
|
|
16
16
|
path: { product_id: a ?? "" }
|
|
17
17
|
});
|
|
18
18
|
return i({
|
|
19
|
-
...t(
|
|
20
|
-
|
|
19
|
+
...t(f, {
|
|
20
|
+
authEpoch: l,
|
|
21
|
+
organizationPending: u
|
|
22
|
+
}),
|
|
23
|
+
enabled: d
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
//#endregion
|
|
@@ -10,13 +10,16 @@ import "../../../data-access/dist/index.js";
|
|
|
10
10
|
import { useQuery as i } from "@tanstack/react-query";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index8.js
|
|
12
12
|
function a() {
|
|
13
|
-
let { client: a, organizationId: o, widgetToken: s, authEpoch: c } = n(),
|
|
13
|
+
let { client: a, organizationId: o, widgetToken: s, authEpoch: c, organizationPending: l } = n(), u = !!(o && s), d = e({
|
|
14
14
|
client: a,
|
|
15
15
|
headers: r(o)
|
|
16
16
|
});
|
|
17
17
|
return i({
|
|
18
|
-
...t(
|
|
19
|
-
|
|
18
|
+
...t(d, {
|
|
19
|
+
authEpoch: c,
|
|
20
|
+
organizationPending: l
|
|
21
|
+
}),
|
|
22
|
+
enabled: u
|
|
20
23
|
});
|
|
21
24
|
}
|
|
22
25
|
//#endregion
|
|
@@ -10,14 +10,17 @@ import "../../../data-access/dist/index.js";
|
|
|
10
10
|
import { useQuery as i } from "@tanstack/react-query";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js
|
|
12
12
|
function a(a) {
|
|
13
|
-
let { client: o, organizationId: s, widgetToken: c, authEpoch: l } = n(),
|
|
13
|
+
let { client: o, organizationId: s, widgetToken: c, authEpoch: l, organizationPending: u } = n(), d = !!(s && c && a), f = e({
|
|
14
14
|
query: { measure_unit_id: a ?? "" },
|
|
15
15
|
client: o,
|
|
16
16
|
headers: r(s)
|
|
17
17
|
});
|
|
18
18
|
return i({
|
|
19
|
-
...t(
|
|
20
|
-
|
|
19
|
+
...t(f, {
|
|
20
|
+
authEpoch: l,
|
|
21
|
+
organizationPending: u
|
|
22
|
+
}),
|
|
23
|
+
enabled: d
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
//#endregion
|
package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index6.js
CHANGED
|
@@ -14,30 +14,33 @@ import { useQueries as s } from "@tanstack/react-query";
|
|
|
14
14
|
//#region ../../libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index6.js
|
|
15
15
|
var c = 25;
|
|
16
16
|
function l({ enabled: l, transfersPerAccount: u = c } = {}) {
|
|
17
|
-
let { client: d, organizationId: f, widgetToken: p, authEpoch: m } = n(),
|
|
17
|
+
let { client: d, organizationId: f, widgetToken: p, authEpoch: m, organizationPending: h } = n(), g = r(f), _ = !!(f && p) && (l === !0 || l === void 0), v = a({ enabled: _ }), y = o(() => [...v.data?.data?.map((e) => e.id).filter(Boolean) ?? []].sort(), [v.data?.data]), b = s({ queries: y.map((n) => ({
|
|
18
18
|
...t(e({
|
|
19
19
|
client: d,
|
|
20
|
-
headers:
|
|
20
|
+
headers: g,
|
|
21
21
|
path: { id: n },
|
|
22
22
|
query: { limit: u }
|
|
23
|
-
}),
|
|
24
|
-
|
|
23
|
+
}), {
|
|
24
|
+
authEpoch: m,
|
|
25
|
+
organizationPending: h
|
|
26
|
+
}),
|
|
27
|
+
enabled: _
|
|
25
28
|
})) });
|
|
26
29
|
return {
|
|
27
30
|
mergedTransfers: o(() => {
|
|
28
31
|
let e = /* @__PURE__ */ new Map();
|
|
29
|
-
for (let t of
|
|
32
|
+
for (let t of b) for (let n of t.data?.data ?? []) e.set(n.id, n);
|
|
30
33
|
return [...e.values()].sort((e, t) => t.date.localeCompare(e.date));
|
|
31
|
-
}, [
|
|
32
|
-
accountIds:
|
|
33
|
-
isLoading: i(
|
|
34
|
-
isError:
|
|
34
|
+
}, [b]),
|
|
35
|
+
accountIds: y,
|
|
36
|
+
isLoading: i(v) || b.some((e) => e.isLoading && e.fetchStatus !== "idle"),
|
|
37
|
+
isError: v.isError || b.some((e) => e.isError),
|
|
35
38
|
refetch: () => {
|
|
36
|
-
|
|
37
|
-
for (let e of
|
|
39
|
+
v.refetch();
|
|
40
|
+
for (let e of b) e.refetch();
|
|
38
41
|
},
|
|
39
|
-
accountsQuery:
|
|
40
|
-
transferQueries:
|
|
42
|
+
accountsQuery: v,
|
|
43
|
+
transferQueries: b
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
46
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tesouro/embedded-components-react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.149",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageDepSync": {
|
|
@@ -76,6 +76,12 @@
|
|
|
76
76
|
"package"
|
|
77
77
|
],
|
|
78
78
|
"targets": {
|
|
79
|
+
"test": {
|
|
80
|
+
"dependsOn": [
|
|
81
|
+
"^build",
|
|
82
|
+
"build"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
79
85
|
"build": {
|
|
80
86
|
"executor": "nx:run-commands",
|
|
81
87
|
"cache": true,
|
|
@@ -180,6 +186,7 @@
|
|
|
180
186
|
"{projectRoot}/scripts/assemble-readme.mjs",
|
|
181
187
|
"{projectRoot}/scripts/pack-package.mjs",
|
|
182
188
|
"{workspaceRoot}/apps/embedded-components-docs/content/authored/**",
|
|
189
|
+
"{workspaceRoot}/apps/embedded-components-docs/src/mocks/manifest.json",
|
|
183
190
|
{
|
|
184
191
|
"env": "TESOURO_EMBEDDED_LIBRARY_VERSION"
|
|
185
192
|
}
|