@tesouro/embedded-components-react 0.5.83 → 0.5.84

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 (21) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index.js +6 -7
  2. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index10.js +28 -21
  3. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index2.js +7 -23
  4. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index3.js +34 -6
  5. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index5.js +8 -8
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index6.js +11 -17
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index7.js +37 -16
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index8.js +3 -43
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index9.js +31 -3
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +29 -33
  11. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +31 -30
  12. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/EmbedApiContext.js +7 -5
  13. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +186 -175
  14. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/scopedClientSecret.js +8 -0
  15. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/transportInterceptors.js +9 -6
  16. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +39 -36
  17. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +86 -83
  18. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/client.js +3 -2
  20. package/package.json +1 -1
  21. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index11.js +0 -48
@@ -0,0 +1,8 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/shared/data-access/dist/lib/scopedClientSecret.js
2
+ function e(e) {
3
+ return (t) => (e.current = t, () => {
4
+ e.current === t && (e.current = null);
5
+ });
6
+ }
7
+ //#endregion
8
+ export { e as createClientSecretInstaller };
@@ -1,11 +1,14 @@
1
1
  import { isWidgetGatewayHost as e } from "./widgetGatewayHosts.js";
2
2
  //#region ../../libs/tesouro-embedded-components-react/shared/data-access/dist/lib/transportInterceptors.js
3
- function t(t, { tokenRef: n, gatewayRouting: r }) {
4
- return t.interceptors.request.use((e) => (e.headers.has("X-Client-Secret") ? (e.headers.delete("Authorization"), n.current && e.headers.set("X-Widget-Token", n.current)) : n.current && e.headers.set("Authorization", `Bearer ${n.current}`), e)), r !== !1 && t.interceptors.request.use(async (t) => {
5
- let i = new URL(t.url);
6
- if (i.pathname.startsWith("/api/widget-gateway") || !(r ?? e(i.origin))) return t;
7
- i.pathname = "/api/widget-gateway/proxy" + i.pathname;
8
- let a = t.body ? await t.clone().arrayBuffer() : void 0, o = new Request(i.toString(), {
3
+ function t(t, { tokenRef: n, clientSecretRef: r, gatewayRouting: i }) {
4
+ return t.interceptors.request.use((e, t) => {
5
+ let i = r?.current;
6
+ return i?.appliesTo(t) && e.headers.set("X-Client-Secret", i.clientSecret), e.headers.has("X-Client-Secret") ? (e.headers.delete("Authorization"), n.current && e.headers.set("X-Widget-Token", n.current)) : n.current && e.headers.set("Authorization", `Bearer ${n.current}`), e;
7
+ }), i !== !1 && t.interceptors.request.use(async (t) => {
8
+ let r = new URL(t.url);
9
+ if (r.pathname.startsWith("/api/widget-gateway") || !(i ?? e(r.origin))) return t;
10
+ r.pathname = "/api/widget-gateway/proxy" + r.pathname;
11
+ let a = t.body ? await t.clone().arrayBuffer() : void 0, o = new Request(r.toString(), {
9
12
  method: t.method,
10
13
  headers: t.headers,
11
14
  body: a,
@@ -2,44 +2,46 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { registerQueryClient as e, unregisterQueryClient as t } from "../../../../data-access/dist/lib/clientRegistry.js";
6
- import { createEmbeddedClient as ee } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
5
+ import { createClientSecretInstaller as e } from "../../../../data-access/dist/lib/scopedClientSecret.js";
6
+ import { registerQueryClient as t, unregisterQueryClient as ee } from "../../../../data-access/dist/lib/clientRegistry.js";
7
+ import { createEmbeddedClient as n } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
7
8
  import { EmbedApiProvider as te } from "../../../../data-access/dist/lib/EmbedApiContext.js";
8
9
  import "../../../../data-access/dist/index.js";
9
- import { resolveUIFramework as ne } from "../../../../ui/dist/lib/UIContext/UIContext.js";
10
- import { UIProvider as re } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
11
- import { useDesignSystemEnsurer as ie } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
10
+ import { resolveUIFramework as r } from "../../../../ui/dist/lib/UIContext/UIContext.js";
11
+ import { UIProvider as i } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
12
+ import { useDesignSystemEnsurer as a } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
12
13
  import "../../../../ui/dist/index.js";
13
- import { getGlobalSnapshot as n, subscribeToGlobal as r } from "./globalStore.js";
14
- import { configureEmbeddedClient as i } from "../analytics/client.js";
15
- import { generateCorrelationId as ae } from "../analytics/ids.js";
16
- import { WidgetContext as oe } from "./WidgetContext.js";
17
- import { resolveOrgId as se, useAuthEpoch as ce } from "./utils.js";
18
- import { useWidgetFetch as a } from "./useWidgetFetch.js";
19
- import { deriveWidgetInitState as o, useWidgetInitPublisher as le } from "./useWidgetInitPublisher.js";
20
- import { useEffect as s, useMemo as c, useRef as l, useState as u, useSyncExternalStore as d } from "react";
21
- import { jsx as f } from "react/jsx-runtime";
22
- import { QueryClient as p, QueryClientProvider as m } from "@tanstack/react-query";
14
+ import { getGlobalSnapshot as o, subscribeToGlobal as s } from "./globalStore.js";
15
+ import { configureEmbeddedClient as ne } from "../analytics/client.js";
16
+ import { generateCorrelationId as re } from "../analytics/ids.js";
17
+ import { WidgetContext as ie } from "./WidgetContext.js";
18
+ import { resolveOrgId as ae, useAuthEpoch as c } from "./utils.js";
19
+ import { useWidgetFetch as l } from "./useWidgetFetch.js";
20
+ import { deriveWidgetInitState as oe, useWidgetInitPublisher as se } from "./useWidgetInitPublisher.js";
21
+ import { useEffect as u, useMemo as d, useRef as f, useState as p, useSyncExternalStore as ce } from "react";
22
+ import { jsx as m } from "react/jsx-runtime";
23
+ import { QueryClient as le, QueryClientProvider as ue } from "@tanstack/react-query";
23
24
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js
24
25
  function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configClient: y, gatewayRouting: b, linkComponent: x, uiFramework: S, implementation: C, analytics: w, unstable_initResponseOverride: T, disclosuresAcceptance: E, providerLabels: D }) {
25
- let O = d(r, n, n), k = g ?? O.baseUrl, A = _ === void 0 ? O.widgetToken : _, j = v === void 0 ? O.organizationId : v, M = y ?? O.configClient, N = b ?? O.gatewayRouting, P = x ?? O.linkComponent, F = S ?? O.uiFramework, I = C ?? O.implementation, L = w !== !1, [R] = u(ae), z = l({
26
+ let O = ce(s, o, o), k = g ?? O.baseUrl, A = _ === void 0 ? O.widgetToken : _, j = v === void 0 ? O.organizationId : v, M = y ?? O.configClient, N = b ?? O.gatewayRouting, P = x ?? O.linkComponent, F = S ?? O.uiFramework, I = C ?? O.implementation, L = w !== !1, [R] = p(re), z = f({
26
27
  enabled: L,
27
28
  organizationId: j,
28
29
  rootCorrelationId: R
29
- }), [B] = u(() => new p({ defaultOptions: {
30
+ }), [B] = p(() => new le({ defaultOptions: {
30
31
  queries: {
31
32
  retry: !1,
32
33
  refetchOnWindowFocus: !1
33
34
  },
34
35
  mutations: { retry: !1 }
35
36
  } }));
36
- s(() => (e(B), () => t(B)), [B]);
37
- let V = l(A);
37
+ u(() => (t(B), () => ee(B)), [B]);
38
+ let V = f(A);
38
39
  V.current = A;
39
- let H = ce(A), U = c(() => {
40
- let e = i(ee(k), {
40
+ let H = f(null), de = d(() => e(H), []), fe = c(A), U = d(() => {
41
+ let e = ne(n(k), {
41
42
  tokenRef: V,
42
43
  analyticsContextRef: z,
44
+ clientSecretRef: H,
43
45
  gatewayRouting: N
44
46
  });
45
47
  return M ? M(e) : e;
@@ -48,7 +50,7 @@ function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configC
48
50
  M,
49
51
  N
50
52
  ]);
51
- s(() => {
53
+ u(() => {
52
54
  if (!L || !("window" in globalThis)) return;
53
55
  let e = !1;
54
56
  return import("../analytics/install.js").then(({ ensureAnalyticsAdapterInstalled: t }) => {
@@ -57,11 +59,11 @@ function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configC
57
59
  e = !0;
58
60
  };
59
61
  }, [L]);
60
- let W = ie(ne(F));
61
- s(() => {
62
+ let W = a(r(F));
63
+ u(() => {
62
64
  W && W().catch(() => {});
63
65
  }, [W]);
64
- let { result: ue, loading: G, error: K, initStaleForToken: de, refetch: q } = a(T ? null : U, A, z), J = A ? T ?? ue ?? void 0 : void 0, Y = !T && de, X = se(j, Y ? void 0 : J?.organizationId), fe = c(() => o({
66
+ let { result: pe, loading: G, error: K, initStaleForToken: me, refetch: q } = l(T ? null : U, A, z), J = A ? T ?? pe ?? void 0 : void 0, Y = !T && me, X = ae(j, Y ? void 0 : J?.organizationId), he = d(() => oe({
65
67
  hasToken: !!A,
66
68
  loading: G,
67
69
  error: K,
@@ -74,8 +76,8 @@ function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configC
74
76
  J,
75
77
  Y
76
78
  ]);
77
- le(fe, A);
78
- let Z = c(() => ({
79
+ se(he, A);
80
+ let Z = d(() => ({
79
81
  enabled: L,
80
82
  organizationId: X,
81
83
  rootCorrelationId: R
@@ -85,7 +87,7 @@ function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configC
85
87
  R
86
88
  ]);
87
89
  z.current = Z;
88
- let Q = c(() => ({
90
+ let Q = d(() => ({
89
91
  baseUrl: g,
90
92
  widgetToken: _,
91
93
  organizationId: v,
@@ -103,7 +105,7 @@ function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configC
103
105
  x,
104
106
  S,
105
107
  C
106
- ]), $ = c(() => ({
108
+ ]), $ = d(() => ({
107
109
  baseUrl: k,
108
110
  widgetToken: A,
109
111
  organizationId: X,
@@ -123,7 +125,7 @@ function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configC
123
125
  F,
124
126
  I,
125
127
  J
126
- ]), pe = c(() => ({
128
+ ]), ge = d(() => ({
127
129
  resolved: $,
128
130
  own: Q,
129
131
  refetch: q,
@@ -146,16 +148,17 @@ function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configC
146
148
  E,
147
149
  D
148
150
  ]);
149
- return /* @__PURE__ */ f(m, {
151
+ return /* @__PURE__ */ m(ue, {
150
152
  client: B,
151
- children: /* @__PURE__ */ f(te, {
153
+ children: /* @__PURE__ */ m(te, {
152
154
  client: U,
153
155
  organizationId: X,
154
156
  widgetToken: A,
155
- authEpoch: H,
156
- children: /* @__PURE__ */ f(oe.Provider, {
157
- value: pe,
158
- children: /* @__PURE__ */ f(re, {
157
+ installClientSecret: de,
158
+ authEpoch: fe,
159
+ children: /* @__PURE__ */ m(ie.Provider, {
160
+ value: ge,
161
+ children: /* @__PURE__ */ m(i, {
159
162
  linkComponent: P,
160
163
  uiFramework: F,
161
164
  children: h
@@ -2,42 +2,43 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { registerQueryClient as e, unregisterQueryClient as t } from "../../../../data-access/dist/lib/clientRegistry.js";
6
- import { createEmbeddedClient as n } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
7
- import { EmbedApiProvider as r, useEmbedApi as i } from "../../../../data-access/dist/lib/EmbedApiContext.js";
5
+ import { createClientSecretInstaller as e } from "../../../../data-access/dist/lib/scopedClientSecret.js";
6
+ import { registerQueryClient as t, unregisterQueryClient as n } from "../../../../data-access/dist/lib/clientRegistry.js";
7
+ import { createEmbeddedClient as r } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
8
+ import { EmbedApiProvider as i, useEmbedApi as a } from "../../../../data-access/dist/lib/EmbedApiContext.js";
8
9
  import "../../../../data-access/dist/index.js";
9
- import { resolveUIFramework as a } from "../../../../ui/dist/lib/UIContext/UIContext.js";
10
- import { UIProvider as o } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
11
- import { useDesignSystemEnsurer as ee, useFrameworkRenderer as te } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
12
- import { HostIsolationScope as ne } from "../../../../ui/dist/lib/HostIsolationScope/HostIsolationScope.js";
10
+ import { resolveUIFramework as o } from "../../../../ui/dist/lib/UIContext/UIContext.js";
11
+ import { UIProvider as ee } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
12
+ import { useDesignSystemEnsurer as te, useFrameworkRenderer as ne } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
13
+ import { HostIsolationScope as re } from "../../../../ui/dist/lib/HostIsolationScope/HostIsolationScope.js";
13
14
  import { ErrorState as s } from "../../../../ui/dist/lib/ErrorState/ErrorState.js";
14
15
  import "../../../../ui/dist/index.js";
15
- import { getGlobalSnapshot as re, subscribeToGlobal as ie } from "./globalStore.js";
16
+ import { getGlobalSnapshot as ie, subscribeToGlobal as ae } from "./globalStore.js";
16
17
  import { EmbeddedAnalyticsEvent as c } from "../analytics/events.js";
17
- import { configureEmbeddedClient as ae } from "../analytics/client.js";
18
- import { generateCorrelationId as oe } from "../analytics/ids.js";
19
- import { WidgetContext as se } from "./WidgetContext.js";
20
- import { noop as ce, resolveOrgId as le, useAuthEpoch as ue } from "./utils.js";
21
- import { useWidgetFetch as de } from "./useWidgetFetch.js";
22
- import { deriveWidgetInitState as fe, useWidgetInitPublisher as pe } from "./useWidgetInitPublisher.js";
18
+ import { configureEmbeddedClient as oe } from "../analytics/client.js";
19
+ import { generateCorrelationId as se } from "../analytics/ids.js";
20
+ import { WidgetContext as ce } from "./WidgetContext.js";
21
+ import { noop as le, resolveOrgId as ue, useAuthEpoch as de } from "./utils.js";
22
+ import { useWidgetFetch as fe } from "./useWidgetFetch.js";
23
+ import { deriveWidgetInitState as pe, useWidgetInitPublisher as me } from "./useWidgetInitPublisher.js";
23
24
  import { useAnalyticsTrack as l } from "../analytics/hooks.js";
24
- import { resolveProviderLabels as me } from "./labels.js";
25
- import { WidgetErrorBoundary as he } from "./WidgetErrorBoundary.js";
26
- import { DISCLOSURES_REQUIRED_TEST_ID as u, hasRenderableAcceptanceSurface as d, resolveDisclosuresBlockedReason as f, shouldGateOnDisclosuresAcceptance as ge } from "./isDisclosuresAcceptanceRequired.js";
27
- import { useContext as _e, useEffect as p, useMemo as m, useRef as h, useState as g, useSyncExternalStore as ve } from "react";
25
+ import { resolveProviderLabels as he } from "./labels.js";
26
+ import { WidgetErrorBoundary as ge } from "./WidgetErrorBoundary.js";
27
+ import { DISCLOSURES_REQUIRED_TEST_ID as u, hasRenderableAcceptanceSurface as d, resolveDisclosuresBlockedReason as f, shouldGateOnDisclosuresAcceptance as _e } from "./isDisclosuresAcceptanceRequired.js";
28
+ import { useContext as ve, useEffect as p, useMemo as m, useRef as h, useState as g, useSyncExternalStore as ye } from "react";
28
29
  import { jsx as _ } from "react/jsx-runtime";
29
- import { QueryClient as ye, QueryClientProvider as be } from "@tanstack/react-query";
30
+ import { QueryClient as be, QueryClientProvider as xe } from "@tanstack/react-query";
30
31
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js
31
- function v({ children: te, baseUrl: s, widgetToken: c, organizationId: l, configClient: u, gatewayRouting: d, linkComponent: f, uiFramework: v, implementation: y, errorFallback: Se, onError: Ce, analytics: b, disclosuresAcceptance: we, providerLabels: Te, widgetName: x }) {
32
- let S = _e(se), Ee = ve(ie, re, re), C = S?.resolved ?? Ee, De = S?.refetch ?? ce, Oe = S?.loading ?? !1, ke = S?.error ?? null, w = s ?? C.baseUrl, T = c === void 0 ? C.widgetToken : c, Ae = S ? S.cascadeOrgId : Ee.organizationId, E = l === void 0 ? Ae : l, D = u ?? C.configClient, O = d ?? C.gatewayRouting, k = f ?? C.linkComponent, A = v ?? C.uiFramework, j = y ?? C.implementation, M = we ?? S?.disclosuresAcceptance, N = Te ?? S?.providerLabels, je = m(() => me(N), [N]), P = S === null, F = P ? b !== !1 : S.analytics.enabled, [Me] = g(oe), I = P ? Me : S.analytics.rootCorrelationId, [Ne] = g(oe), L = x === void 0 ? S?.analytics.widgetName : x, R = x === void 0 ? S?.analytics.widgetInstanceId : Ne, z = h({
32
+ function v({ children: ne, baseUrl: s, widgetToken: c, organizationId: l, configClient: u, gatewayRouting: d, linkComponent: f, uiFramework: v, implementation: y, errorFallback: Ce, onError: we, analytics: b, disclosuresAcceptance: Te, providerLabels: Ee, widgetName: x }) {
33
+ let S = ve(ce), De = ye(ae, ie, ie), C = S?.resolved ?? De, Oe = S?.refetch ?? le, ke = S?.loading ?? !1, Ae = S?.error ?? null, w = s ?? C.baseUrl, T = c === void 0 ? C.widgetToken : c, je = S ? S.cascadeOrgId : De.organizationId, E = l === void 0 ? je : l, D = u ?? C.configClient, O = d ?? C.gatewayRouting, k = f ?? C.linkComponent, A = v ?? C.uiFramework, j = y ?? C.implementation, M = Te ?? S?.disclosuresAcceptance, N = Ee ?? S?.providerLabels, Me = m(() => he(N), [N]), P = S === null, F = P ? b !== !1 : S.analytics.enabled, [Ne] = g(se), I = P ? Ne : S.analytics.rootCorrelationId, [Pe] = g(se), L = x === void 0 ? S?.analytics.widgetName : x, R = x === void 0 ? S?.analytics.widgetInstanceId : Pe, z = h({
33
34
  enabled: F,
34
35
  organizationId: E,
35
36
  rootCorrelationId: I,
36
37
  widgetName: L,
37
38
  widgetInstanceId: R
38
- }), B = h(!1);
39
+ }), Fe = h(!1);
39
40
  p(() => {
40
- P || b === void 0 || B.current || (B.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."));
41
+ P || b === void 0 || Fe.current || (Fe.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."));
41
42
  }, [b, P]), p(() => {
42
43
  if (!P || !F || !("window" in globalThis)) return;
43
44
  let e = !1;
@@ -47,41 +48,42 @@ function v({ children: te, baseUrl: s, widgetToken: c, organizationId: l, config
47
48
  e = !0;
48
49
  };
49
50
  }, [P, F]);
50
- let V = ee(a(A));
51
+ let B = te(o(A));
51
52
  p(() => {
52
- V && V().catch(() => {});
53
- }, [V]);
54
- let Pe = S === null || s !== void 0 || c !== void 0 || l !== void 0 || u != null || d !== void 0 || x !== void 0, Fe = h(T);
55
- Fe.current = T;
56
- let Ie = i(), Le = ue(T), H = m(() => {
57
- if (!Pe) return null;
58
- let e = ae(n(w), {
59
- tokenRef: Fe,
53
+ B && B().catch(() => {});
54
+ }, [B]);
55
+ let Ie = S === null || s !== void 0 || c !== void 0 || l !== void 0 || u != null || d !== void 0 || x !== void 0, Le = h(T);
56
+ Le.current = T;
57
+ let Re = h(null), ze = m(() => e(Re), []), Be = a(), Ve = de(T), V = m(() => {
58
+ if (!Ie) return null;
59
+ let e = oe(r(w), {
60
+ tokenRef: Le,
60
61
  analyticsContextRef: z,
62
+ clientSecretRef: Re,
61
63
  gatewayRouting: O
62
64
  });
63
65
  return D ? D(e) : e;
64
66
  }, [
65
- Pe,
67
+ Ie,
66
68
  w,
67
69
  D,
68
70
  O
69
- ]), U = S === null || s !== void 0 || c !== void 0, Re = U ? Le : Ie.authEpoch, { result: W, loading: G, error: K, clearedForAuthChange: ze, initStaleForToken: q, refetch: Be } = de(U ? H : null, U ? T : void 0, z), Ve = U ? Be : De, He = U ? G : Oe, Ue = U ? K : ke, We = S?.resolved.initResponse, Ge = !U || !ze && !K && !W && !!T && !G, J = Ge ? We : W ?? void 0, Y = Ge ? U || (S?.initResponseStaleForToken ?? !1) : q, Ke = S === null, qe = m(() => Ke ? fe({
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({
70
72
  hasToken: !!T,
71
- loading: G,
72
- error: K,
73
- initResponse: W ?? void 0,
74
- initStaleForToken: q
73
+ loading: W,
74
+ error: G,
75
+ initResponse: U ?? void 0,
76
+ initStaleForToken: K
75
77
  }) : null, [
76
- Ke,
78
+ Y,
77
79
  T,
78
- G,
79
- K,
80
80
  W,
81
- q
81
+ G,
82
+ U,
83
+ K
82
84
  ]);
83
- pe(qe, T);
84
- let X = le(E, Y ? void 0 : J?.organizationId), Z = m(() => ({
85
+ me(Xe, T);
86
+ let X = ue(E, J ? void 0 : q?.organizationId), Z = m(() => ({
85
87
  enabled: F,
86
88
  organizationId: X,
87
89
  rootCorrelationId: I,
@@ -95,7 +97,7 @@ function v({ children: te, baseUrl: s, widgetToken: c, organizationId: l, config
95
97
  R
96
98
  ]);
97
99
  z.current = Z;
98
- let [Q] = g(() => S === null ? new ye({ defaultOptions: {
100
+ let [Q] = g(() => S === null ? new be({ defaultOptions: {
99
101
  queries: {
100
102
  retry: !1,
101
103
  refetchOnWindowFocus: !1
@@ -104,10 +106,10 @@ function v({ children: te, baseUrl: s, widgetToken: c, organizationId: l, config
104
106
  } }) : null);
105
107
  p(() => {
106
108
  if (!Q) return;
107
- let n = Q;
108
- return e(n), () => t(n);
109
+ let e = Q;
110
+ return t(e), () => n(e);
109
111
  }, [Q]);
110
- let Je = m(() => ({
112
+ let Ze = m(() => ({
111
113
  baseUrl: s,
112
114
  widgetToken: c,
113
115
  organizationId: l,
@@ -125,7 +127,7 @@ function v({ children: te, baseUrl: s, widgetToken: c, organizationId: l, config
125
127
  f,
126
128
  v,
127
129
  y
128
- ]), Ye = m(() => ({
130
+ ]), Qe = m(() => ({
129
131
  baseUrl: w,
130
132
  widgetToken: T,
131
133
  organizationId: X,
@@ -134,7 +136,7 @@ function v({ children: te, baseUrl: s, widgetToken: c, organizationId: l, config
134
136
  linkComponent: k,
135
137
  uiFramework: A,
136
138
  implementation: j,
137
- initResponse: J
139
+ initResponse: q
138
140
  }), [
139
141
  w,
140
142
  T,
@@ -144,60 +146,61 @@ function v({ children: te, baseUrl: s, widgetToken: c, organizationId: l, config
144
146
  k,
145
147
  A,
146
148
  j,
147
- J
148
- ]), Xe = m(() => ({
149
- resolved: Ye,
150
- own: Je,
151
- refetch: Ve,
152
- loading: He,
153
- error: Ue,
149
+ q
150
+ ]), $e = m(() => ({
151
+ resolved: Qe,
152
+ own: Ze,
153
+ refetch: Ge,
154
+ loading: Ke,
155
+ error: qe,
154
156
  analytics: Z,
155
157
  cascadeOrgId: E,
156
- initResponseStaleForToken: Y,
158
+ initResponseStaleForToken: J,
157
159
  disclosuresAcceptance: M,
158
160
  providerLabels: N
159
161
  }), [
160
- Ye,
161
- Je,
162
- Ve,
163
- He,
164
- Ue,
162
+ Qe,
163
+ Ze,
164
+ Ge,
165
+ Ke,
166
+ qe,
165
167
  Z,
166
168
  E,
167
- Y,
169
+ J,
168
170
  M,
169
171
  N
170
- ]), Ze = /* @__PURE__ */ _(se.Provider, {
171
- value: Xe,
172
- children: /* @__PURE__ */ _(o, {
172
+ ]), et = /* @__PURE__ */ _(ce.Provider, {
173
+ value: $e,
174
+ children: /* @__PURE__ */ _(ee, {
173
175
  linkComponent: k,
174
176
  uiFramework: A,
175
- children: /* @__PURE__ */ _(ne, { children: /* @__PURE__ */ _(he, {
177
+ children: /* @__PURE__ */ _(re, { children: /* @__PURE__ */ _(ge, {
176
178
  resetKeys: [T],
177
- errorFallback: Se,
178
- onError: Ce,
179
- labels: je,
180
- children: ge(J, x) ? /* @__PURE__ */ _(xe, {
179
+ errorFallback: Ce,
180
+ onError: we,
181
+ labels: Me,
182
+ children: _e(q, x) ? /* @__PURE__ */ _(Se, {
181
183
  disclosuresAcceptance: M,
182
- initStaleForToken: Y,
183
- labels: je
184
- }) : te
184
+ initStaleForToken: J,
185
+ labels: Me
186
+ }) : ne
185
187
  }) })
186
188
  })
187
- }), $ = H ? /* @__PURE__ */ _(r, {
188
- client: H,
189
+ }), $ = V ? /* @__PURE__ */ _(i, {
190
+ client: V,
189
191
  organizationId: X,
190
192
  widgetToken: T,
191
- authEpoch: Re,
192
- children: Ze
193
- }) : Ze;
194
- return Q ? /* @__PURE__ */ _(be, {
193
+ installClientSecret: ze,
194
+ authEpoch: He,
195
+ children: et
196
+ }) : et;
197
+ return Q ? /* @__PURE__ */ _(xe, {
195
198
  client: Q,
196
199
  children: $
197
200
  }) : $;
198
201
  }
199
- function xe({ disclosuresAcceptance: e, initStaleForToken: t, labels: n }) {
200
- let r = te("error-state") ?? s, i = l(), a = d(e), o = f({
202
+ function Se({ disclosuresAcceptance: e, initStaleForToken: t, labels: n }) {
203
+ let r = ne("error-state") ?? s, i = l(), a = d(e), o = f({
201
204
  initStaleForToken: t,
202
205
  hasAcceptanceSurface: a
203
206
  });
@@ -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.83", n = "da010dc11c99a0de6966d1a0b5d1bb3b51fe357d", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.84", n = "7cfd4f4027097f08bd71300e75898565395239f2", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -2,10 +2,11 @@ import { attachTransportInterceptors as e } from "../../../../data-access/dist/l
2
2
  import "../../../../data-access/dist/index.js";
3
3
  import { attachAnalyticsInterceptors as t } from "./interceptor.js";
4
4
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/client.js
5
- function n(n, { tokenRef: r, analyticsContextRef: i, gatewayRouting: a }) {
5
+ function n(n, { tokenRef: r, analyticsContextRef: i, clientSecretRef: a, gatewayRouting: o }) {
6
6
  return e(n, {
7
7
  tokenRef: r,
8
- gatewayRouting: a
8
+ clientSecretRef: a,
9
+ gatewayRouting: o
9
10
  }), t(n, i), n;
10
11
  }
11
12
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.83",
3
+ "version": "0.5.84",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {
@@ -1,48 +0,0 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
- import { getBankAccountApplication as t } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
7
- import { withAuthEpoch as n } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
- import "../../../shared/data-access/dist/index.js";
9
- import { applicationResourceHeaders as r } from "./index3.js";
10
- import { hasFreshAnswer as i } from "./index9.js";
11
- import { useMemo as a } from "react";
12
- import { useQuery as o } from "@tanstack/react-query";
13
- //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index11.js
14
- var s = "getBankAccountApplication", c = (e, t) => (n, r) => {
15
- if (n === void 0 || r === void 0) return;
16
- let [i, a] = r.queryKey;
17
- if (i === s && a?.baseUrl === e && a?.id === t) return n;
18
- };
19
- function l(l, u) {
20
- let { client: d, organizationId: f, widgetToken: p, authEpoch: m } = e(), h = !!(p && l && u), g = async ({ signal: e }) => {
21
- let { data: n } = await t({
22
- client: d,
23
- path: { id: l ?? "" },
24
- headers: r(f, u),
25
- signal: e,
26
- throwOnError: !0
27
- });
28
- if (!n) throw Error("Unexpected application response from widget gateway");
29
- return n;
30
- }, _ = d.getConfig().baseUrl, { queryKey: v } = n({ queryKey: [s, {
31
- baseUrl: _,
32
- id: l
33
- }] }, m), y = a(() => c(_, l), [_, l]), b = o({
34
- queryKey: v,
35
- queryFn: g,
36
- placeholderData: y,
37
- enabled: h,
38
- retry: 2,
39
- retryDelay: 300
40
- });
41
- return {
42
- application: b.data ?? null,
43
- isResolved: !h || i(b),
44
- isUnavailable: h && b.isError
45
- };
46
- }
47
- //#endregion
48
- export { l as useStartedBankAccountApplication };