@tesouro/embedded-components-react 0.11.275 → 0.11.277

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.
@@ -3,179 +3,179 @@
3
3
  "use client";
4
4
  "use client";
5
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 } from "../../../../data-access/dist/lib/EmbedApiContext.js";
6
+ import { createEmbeddedClient as t } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
7
+ import { EmbedApiProvider as n } from "../../../../data-access/dist/lib/EmbedApiContext.js";
9
8
  import "../../../../data-access/dist/index.js";
10
- import { resolveUIFramework as a } from "../../../../ui/dist/lib/UIContext/UIContext.js";
9
+ import { resolveUIFramework as r } from "../../../../ui/dist/lib/UIContext/UIContext.js";
11
10
  import { UIProvider as ee } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
12
11
  import { useDesignSystemEnsurer as te } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
13
12
  import "../../../../ui/dist/index.js";
14
- import { getGlobalSnapshot as o, subscribeToGlobal as ne } from "./globalStore.js";
13
+ import { getGlobalSnapshot as i, subscribeToGlobal as ne } from "./globalStore.js";
15
14
  import { configureEmbeddedClient as re } from "../analytics/client.js";
16
- import { generateCorrelationId as ie } from "../analytics/ids.js";
17
- import { WidgetContext as s } from "./WidgetContext.js";
18
- import { resolveOrgId as c, useAuthEpoch as l } from "./utils.js";
19
- import { useWidgetFetch as ae } from "./useWidgetFetch.js";
20
- import { deriveOrganizationStatus as oe } from "./deriveOrganizationStatus.js";
21
- import { deriveWidgetInitState as se, useWidgetInitPublisher as ce } from "./useWidgetInitPublisher.js";
22
- import { useTokenRefreshRef as le } from "./useTokenRefreshRef.js";
23
- import { useEffect as u, useMemo as d, useRef as f, useState as p, useSyncExternalStore as ue } from "react";
24
- import { jsx as m } from "react/jsx-runtime";
25
- import { QueryClient as de, QueryClientProvider as fe } from "@tanstack/react-query";
15
+ import { generateCorrelationId as a } from "../analytics/ids.js";
16
+ import { WidgetContext as o } from "./WidgetContext.js";
17
+ import { resolveOrgId as s, useAuthEpoch as c } from "./utils.js";
18
+ import { useWidgetFetch as l } from "./useWidgetFetch.js";
19
+ import { deriveOrganizationStatus as u } from "./deriveOrganizationStatus.js";
20
+ import { deriveWidgetInitState as ie, useWidgetInitPublisher as ae } from "./useWidgetInitPublisher.js";
21
+ import { useTokenRefreshRef as oe } from "./useTokenRefreshRef.js";
22
+ import { useOwnedQueryClient as se } from "./useOwnedQueryClient.js";
23
+ import { useEffect as d, useMemo as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
24
+ import { jsx as g } from "react/jsx-runtime";
25
+ import { QueryClient as ce, QueryClientProvider as le } from "@tanstack/react-query";
26
26
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js
27
- function h({ children: h, baseUrl: g, widgetToken: _, organizationId: v, configClient: y, gatewayRouting: b, linkComponent: x, uiFramework: S, analytics: C, unstable_initResponseOverride: w, disclosuresAcceptance: T, providerLabels: E }) {
28
- let D = ue(ne, o, o), O = g ?? D.baseUrl, k = _ === void 0 ? D.widgetToken : _, A = v === void 0 ? D.organizationId : v, j = y ?? D.configClient, M = b ?? D.gatewayRouting, N = x ?? D.linkComponent, P = S ?? D.uiFramework, F = C !== !1, [I] = p(ie), L = f({
29
- enabled: F,
30
- organizationId: A,
31
- rootCorrelationId: I
32
- }), [R] = p(() => new de({ defaultOptions: {
27
+ function _({ children: _, baseUrl: v, widgetToken: y, organizationId: b, configClient: x, gatewayRouting: S, linkComponent: C, uiFramework: w, analytics: ue, unstable_initResponseOverride: T, disclosuresAcceptance: E, providerLabels: D }) {
28
+ let O = h(ne, i, i), k = v ?? O.baseUrl, A = y === void 0 ? O.widgetToken : y, j = b === void 0 ? O.organizationId : b, M = x ?? O.configClient, N = S ?? O.gatewayRouting, P = C ?? O.linkComponent, F = w ?? O.uiFramework, I = ue !== !1, [L] = m(a), R = p({
29
+ enabled: I,
30
+ organizationId: j,
31
+ rootCorrelationId: L
32
+ }), [z] = m(() => new ce({ defaultOptions: {
33
33
  queries: {
34
34
  retry: !1,
35
35
  refetchOnWindowFocus: !1
36
36
  },
37
37
  mutations: { retry: !1 }
38
38
  } }));
39
- u(() => (t(R), () => n(R)), [R]);
40
- let z = f(k);
41
- z.current = k;
42
- let B = le(), V = f(null), pe = d(() => e(V), []), me = l(k), H = d(() => {
43
- let e = re(r(O), {
44
- tokenRef: z,
45
- analyticsContextRef: L,
46
- clientSecretRef: V,
47
- gatewayRouting: M,
48
- refreshTokenRef: B
39
+ se(z);
40
+ let B = p(A);
41
+ B.current = A;
42
+ let V = oe(), H = p(null), de = f(() => e(H), []), fe = c(A), U = f(() => {
43
+ let e = re(t(k), {
44
+ tokenRef: B,
45
+ analyticsContextRef: R,
46
+ clientSecretRef: H,
47
+ gatewayRouting: N,
48
+ refreshTokenRef: V
49
49
  });
50
- return j ? j(e) : e;
50
+ return M ? M(e) : e;
51
51
  }, [
52
- O,
53
- j,
52
+ k,
54
53
  M,
55
- B
54
+ N,
55
+ V
56
56
  ]);
57
- u(() => {
58
- if (!F || !("window" in globalThis)) return;
57
+ d(() => {
58
+ if (!I || !("window" in globalThis)) return;
59
59
  let e = !1;
60
60
  return import("../analytics/install.js").then(({ ensureAnalyticsAdapterInstalled: t }) => {
61
61
  e || t();
62
62
  }), () => {
63
63
  e = !0;
64
64
  };
65
- }, [F]);
66
- let U = te(a(P));
67
- u(() => {
68
- U && U().catch(() => {});
69
- }, [U]);
70
- let { result: he, loading: W, error: G, initStaleForToken: K, initReplacementPending: ge, refetch: q } = ae(w ? null : H, k, L), J = k ? w ?? he ?? void 0 : void 0, Y = !w && K, X = c(A, Y ? void 0 : J?.organizationId), _e = oe({
65
+ }, [I]);
66
+ let W = te(r(F));
67
+ d(() => {
68
+ W && W().catch(() => {});
69
+ }, [W]);
70
+ let { result: pe, loading: G, error: K, initStaleForToken: me, initReplacementPending: he, refetch: q } = l(T ? null : U, A, R), J = A ? T ?? pe ?? void 0 : void 0, Y = !T && me, X = s(j, Y ? void 0 : J?.organizationId), ge = u({
71
71
  organizationId: X,
72
- cascadeOrgId: A,
72
+ cascadeOrgId: j,
73
73
  ownsFetch: !0,
74
74
  parentStatus: "none",
75
- hasToken: !!k,
76
- loading: W,
77
- error: G,
75
+ hasToken: !!A,
76
+ loading: G,
77
+ error: K,
78
78
  hasResult: !!J,
79
- initReplacementPending: ge
80
- }), ve = d(() => se({
81
- hasToken: !!k,
82
- loading: W,
83
- error: G,
79
+ initReplacementPending: he
80
+ }), _e = f(() => ie({
81
+ hasToken: !!A,
82
+ loading: G,
83
+ error: K,
84
84
  initResponse: J,
85
85
  initStaleForToken: Y
86
86
  }), [
87
- k,
88
- W,
87
+ A,
89
88
  G,
89
+ K,
90
90
  J,
91
91
  Y
92
92
  ]);
93
- ce(ve, k);
94
- let Z = d(() => ({
95
- enabled: F,
93
+ ae(_e, A);
94
+ let Z = f(() => ({
95
+ enabled: I,
96
96
  organizationId: X,
97
- rootCorrelationId: I
97
+ rootCorrelationId: L
98
98
  }), [
99
- F,
99
+ I,
100
100
  X,
101
- I
101
+ L
102
102
  ]);
103
- L.current = Z;
104
- let Q = d(() => ({
105
- baseUrl: g,
106
- widgetToken: _,
107
- organizationId: v,
108
- configClient: y,
109
- gatewayRouting: b,
110
- linkComponent: x,
111
- uiFramework: S
103
+ R.current = Z;
104
+ let Q = f(() => ({
105
+ baseUrl: v,
106
+ widgetToken: y,
107
+ organizationId: b,
108
+ configClient: x,
109
+ gatewayRouting: S,
110
+ linkComponent: C,
111
+ uiFramework: w
112
112
  }), [
113
- g,
114
- _,
115
113
  v,
116
114
  y,
117
115
  b,
118
116
  x,
119
- S
120
- ]), $ = d(() => ({
121
- baseUrl: O,
122
- widgetToken: k,
117
+ S,
118
+ C,
119
+ w
120
+ ]), $ = f(() => ({
121
+ baseUrl: k,
122
+ widgetToken: A,
123
123
  organizationId: X,
124
- configClient: j,
125
- gatewayRouting: M,
126
- linkComponent: N,
127
- uiFramework: P,
124
+ configClient: M,
125
+ gatewayRouting: N,
126
+ linkComponent: P,
127
+ uiFramework: F,
128
128
  initResponse: J
129
129
  }), [
130
- O,
131
130
  k,
131
+ A,
132
132
  X,
133
- j,
134
133
  M,
135
134
  N,
136
135
  P,
136
+ F,
137
137
  J
138
- ]), ye = d(() => ({
138
+ ]), ve = f(() => ({
139
139
  resolved: $,
140
140
  own: Q,
141
141
  refetch: q,
142
- loading: W,
143
- error: G,
142
+ loading: G,
143
+ error: K,
144
144
  analytics: Z,
145
- cascadeOrgId: A,
145
+ cascadeOrgId: j,
146
146
  initResponseStaleForToken: Y,
147
- disclosuresAcceptance: T,
148
- providerLabels: E
147
+ disclosuresAcceptance: E,
148
+ providerLabels: D
149
149
  }), [
150
150
  $,
151
151
  Q,
152
152
  q,
153
- W,
154
153
  G,
154
+ K,
155
155
  Z,
156
- A,
156
+ j,
157
157
  Y,
158
- T,
159
- E
158
+ E,
159
+ D
160
160
  ]);
161
- return /* @__PURE__ */ m(fe, {
162
- client: R,
163
- children: /* @__PURE__ */ m(i, {
164
- client: H,
161
+ return /* @__PURE__ */ g(le, {
162
+ client: z,
163
+ children: /* @__PURE__ */ g(n, {
164
+ client: U,
165
165
  organizationId: X,
166
- widgetToken: k,
167
- installClientSecret: pe,
168
- authEpoch: me,
169
- organizationStatus: _e,
170
- children: /* @__PURE__ */ m(s.Provider, {
171
- value: ye,
172
- children: /* @__PURE__ */ m(ee, {
173
- linkComponent: N,
174
- uiFramework: P,
175
- children: h
166
+ widgetToken: A,
167
+ installClientSecret: de,
168
+ authEpoch: fe,
169
+ organizationStatus: ge,
170
+ children: /* @__PURE__ */ g(o.Provider, {
171
+ value: ve,
172
+ children: /* @__PURE__ */ g(ee, {
173
+ linkComponent: P,
174
+ uiFramework: F,
175
+ children: _
176
176
  })
177
177
  })
178
178
  })
179
179
  });
180
180
  }
181
- export { h as RootWidgetProvider };
181
+ export { _ as RootWidgetProvider };
@@ -5,46 +5,46 @@
5
5
  import { installStyleNonce as e } from "../../../../util/dist/lib/csp.js";
6
6
  import "../../../../util/dist/index.js";
7
7
  import { createClientSecretInstaller as t } from "../../../../data-access/dist/lib/scopedClientSecret.js";
8
- import { registerQueryClient as n, unregisterQueryClient as r } from "../../../../data-access/dist/lib/clientRegistry.js";
9
- import { createEmbeddedClient as i } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
10
- import { EmbedApiProvider as a, useEmbedApi as o } from "../../../../data-access/dist/lib/EmbedApiContext.js";
8
+ import { createEmbeddedClient as n } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
9
+ import { EmbedApiProvider as r, useEmbedApi as i } from "../../../../data-access/dist/lib/EmbedApiContext.js";
11
10
  import "../../../../data-access/dist/index.js";
12
- import { resolveUIFramework as ee } from "../../../../ui/dist/lib/UIContext/UIContext.js";
13
- import { UIProvider as te } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
14
- import { useDesignSystemEnsurer as ne, useFrameworkRenderer as re } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
15
- import { HostIsolationScope as ie } from "../../../../ui/dist/lib/HostIsolationScope/HostIsolationScope.js";
11
+ import { resolveUIFramework as a } from "../../../../ui/dist/lib/UIContext/UIContext.js";
12
+ import { UIProvider as o } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
13
+ import { useDesignSystemEnsurer as ee, useFrameworkRenderer as te } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
14
+ import { HostIsolationScope as ne } from "../../../../ui/dist/lib/HostIsolationScope/HostIsolationScope.js";
16
15
  import { ErrorState as s } from "../../../../ui/dist/lib/ErrorState/ErrorState.js";
17
16
  import "../../../../ui/dist/index.js";
18
- import { getGlobalSnapshot as c, subscribeToGlobal as ae } from "./globalStore.js";
19
- import { EmbeddedAnalyticsEvent as l } from "../analytics/events.js";
20
- import { configureEmbeddedClient as oe } from "../analytics/client.js";
21
- import { generateCorrelationId as se } from "../analytics/ids.js";
22
- import { WidgetContext as u } from "./WidgetContext.js";
17
+ import { getGlobalSnapshot as re, subscribeToGlobal as ie } from "./globalStore.js";
18
+ import { EmbeddedAnalyticsEvent as c } from "../analytics/events.js";
19
+ import { configureEmbeddedClient as ae } from "../analytics/client.js";
20
+ import { generateCorrelationId as oe } from "../analytics/ids.js";
21
+ import { WidgetContext as se } from "./WidgetContext.js";
23
22
  import { noop as ce, resolveOrgId as le, useAuthEpoch as ue } from "./utils.js";
24
23
  import { useWidgetFetch as de } from "./useWidgetFetch.js";
25
24
  import { deriveOrganizationStatus as fe } from "./deriveOrganizationStatus.js";
26
25
  import { deriveWidgetInitState as pe, useWidgetInitPublisher as me } from "./useWidgetInitPublisher.js";
27
26
  import { useTokenRefreshRef as he } from "./useTokenRefreshRef.js";
28
- import { useAnalyticsTrack as d } from "../analytics/hooks.js";
29
- import { resolveProviderLabels as ge } from "./labels.js";
30
- import { WidgetErrorBoundary as _e } from "./WidgetErrorBoundary.js";
31
- import { DISCLOSURES_REQUIRED_TEST_ID as f, hasRenderableAcceptanceSurface as p, resolveDisclosuresBlockedReason as m, shouldGateOnDisclosuresAcceptance as ve } from "./isDisclosuresAcceptanceRequired.js";
32
- import { useContext as ye, useEffect as h, useMemo as g, useRef as _, useState as v, useSyncExternalStore as be } from "react";
33
- import { jsx as y, jsxs as xe } from "react/jsx-runtime";
34
- import { QueryClient as Se, QueryClientProvider as Ce } from "@tanstack/react-query";
27
+ import { useOwnedQueryClient as ge } from "./useOwnedQueryClient.js";
28
+ import { useAnalyticsTrack as l } from "../analytics/hooks.js";
29
+ import { resolveProviderLabels as _e } from "./labels.js";
30
+ import { WidgetErrorBoundary as ve } from "./WidgetErrorBoundary.js";
31
+ import { DISCLOSURES_REQUIRED_TEST_ID as u, hasRenderableAcceptanceSurface as d, resolveDisclosuresBlockedReason as f, shouldGateOnDisclosuresAcceptance as ye } from "./isDisclosuresAcceptanceRequired.js";
32
+ import { useContext as be, useEffect as p, useMemo as m, useRef as h, useState as g, useSyncExternalStore as xe } from "react";
33
+ import { jsx as _, jsxs as Se } from "react/jsx-runtime";
34
+ import { QueryClient as Ce, QueryClientProvider as we } from "@tanstack/react-query";
35
35
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js
36
- function b({ children: re, baseUrl: s, widgetToken: l, organizationId: d, configClient: f, gatewayRouting: p, linkComponent: m, uiFramework: b, errorFallback: Te, onError: Ee, analytics: x, disclosuresAcceptance: De, providerLabels: Oe, widgetName: S, header: ke }) {
36
+ function v({ children: te, baseUrl: s, widgetToken: c, organizationId: l, configClient: u, gatewayRouting: d, linkComponent: f, uiFramework: v, errorFallback: Ee, onError: De, analytics: y, disclosuresAcceptance: Oe, providerLabels: ke, widgetName: b, header: Ae }) {
37
37
  e();
38
- let C = ye(u), Ae = be(ae, c, c), w = C?.resolved ?? Ae, je = C?.refetch ?? ce, Me = C?.loading ?? !1, Ne = C?.error ?? null, T = s ?? w.baseUrl, E = l === void 0 ? w.widgetToken : l, Pe = C ? C.cascadeOrgId : Ae.organizationId, D = d === void 0 ? Pe : d, O = f ?? w.configClient, k = p ?? w.gatewayRouting, A = m ?? w.linkComponent, j = b ?? w.uiFramework, M = De ?? C?.disclosuresAcceptance, N = Oe ?? C?.providerLabels, Fe = g(() => ge(N), [N]), P = C === null, F = P ? x !== !1 : C.analytics.enabled, [Ie] = v(se), I = P ? Ie : C.analytics.rootCorrelationId, [Le] = v(se), L = S === void 0 ? C?.analytics.widgetName : S, R = S === void 0 ? C?.analytics.widgetInstanceId : Le, z = _({
38
+ let x = be(se), S = xe(ie, re, re), C = x?.resolved ?? S, je = x?.refetch ?? ce, Me = x?.loading ?? !1, Ne = x?.error ?? null, w = s ?? C.baseUrl, T = c === void 0 ? C.widgetToken : c, Pe = x ? x.cascadeOrgId : S.organizationId, E = l === void 0 ? Pe : l, D = u ?? C.configClient, O = d ?? C.gatewayRouting, k = f ?? C.linkComponent, A = v ?? C.uiFramework, j = Oe ?? x?.disclosuresAcceptance, M = ke ?? x?.providerLabels, N = m(() => _e(M), [M]), P = x === null, F = P ? y !== !1 : x.analytics.enabled, [Fe] = g(oe), I = P ? Fe : x.analytics.rootCorrelationId, [Ie] = g(oe), L = b === void 0 ? x?.analytics.widgetName : b, R = b === void 0 ? x?.analytics.widgetInstanceId : Ie, z = h({
39
39
  enabled: F,
40
- organizationId: D,
40
+ organizationId: E,
41
41
  rootCorrelationId: I,
42
42
  widgetName: L,
43
43
  widgetInstanceId: R
44
- }), Re = _(!1);
45
- h(() => {
46
- P || x === void 0 || Re.current || (Re.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."));
47
- }, [x, P]), h(() => {
44
+ }), Le = h(!1);
45
+ p(() => {
46
+ P || y === void 0 || Le.current || (Le.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."));
47
+ }, [y, P]), p(() => {
48
48
  if (!P || !F || !("window" in globalThis)) return;
49
49
  let e = !1;
50
50
  return import("../analytics/install.js").then(({ ensureAnalyticsAdapterInstalled: t }) => {
@@ -53,186 +53,182 @@ function b({ children: re, baseUrl: s, widgetToken: l, organizationId: d, config
53
53
  e = !0;
54
54
  };
55
55
  }, [P, F]);
56
- let B = ne(ee(j));
57
- h(() => {
56
+ let B = ee(a(A));
57
+ p(() => {
58
58
  B && B().catch(() => {});
59
59
  }, [B]);
60
- let V = C === null || s !== void 0 || l !== void 0 || d !== void 0 || f != null || p !== void 0 || S !== void 0, H = _(E);
61
- H.current = E;
62
- let ze = he(), Be = _(null), Ve = g(() => t(Be), []), He = o(), Ue = ue(E), U = g(() => {
63
- if (!V) return null;
64
- let e = oe(i(T), {
65
- tokenRef: H,
60
+ let Re = x === null || s !== void 0 || c !== void 0 || l !== void 0 || u != null || d !== void 0 || b !== void 0, ze = h(T);
61
+ ze.current = T;
62
+ let Be = he(), Ve = h(null), He = m(() => t(Ve), []), Ue = i(), We = ue(T), V = m(() => {
63
+ if (!Re) return null;
64
+ let e = ae(n(w), {
65
+ tokenRef: ze,
66
66
  analyticsContextRef: z,
67
- clientSecretRef: Be,
68
- gatewayRouting: k,
69
- refreshTokenRef: ze
67
+ clientSecretRef: Ve,
68
+ gatewayRouting: O,
69
+ refreshTokenRef: Be
70
70
  });
71
- return O ? O(e) : e;
71
+ return D ? D(e) : e;
72
72
  }, [
73
- V,
74
- T,
73
+ Re,
74
+ w,
75
+ D,
75
76
  O,
76
- k,
77
- ze
78
- ]), W = C === null || s !== void 0 || l !== void 0, We = W ? Ue : He.authEpoch, { result: G, loading: K, error: q, clearedForAuthChange: Ge, initStaleForToken: J, initReplacementPending: Ke, refetch: qe } = de(W ? U : null, W ? E : void 0, z), Je = W ? qe : je, Ye = W ? K : Me, Xe = W ? q : Ne, Ze = C?.resolved.initResponse, Qe = !W || !Ge && !q && !G && !!E && !K, Y = Qe ? Ze : G ?? void 0, X = Qe ? W || (C?.initResponseStaleForToken ?? !1) : J, $e = C === null, et = g(() => $e ? pe({
79
- hasToken: !!E,
80
- loading: K,
81
- error: q,
82
- initResponse: G ?? void 0,
83
- initStaleForToken: J
77
+ Be
78
+ ]), H = x === null || s !== void 0 || c !== void 0, Ge = H ? We : Ue.authEpoch, { result: U, loading: W, error: G, clearedForAuthChange: Ke, initStaleForToken: K, initReplacementPending: qe, refetch: Je } = de(H ? V : null, H ? T : void 0, z), Ye = H ? Je : je, Xe = H ? W : Me, q = H ? G : Ne, Ze = x?.resolved.initResponse, Qe = !H || !Ke && !G && !U && !!T && !W, J = Qe ? Ze : U ?? void 0, Y = Qe ? H || (x?.initResponseStaleForToken ?? !1) : K, $e = x === null, et = m(() => $e ? pe({
79
+ hasToken: !!T,
80
+ loading: W,
81
+ error: G,
82
+ initResponse: U ?? void 0,
83
+ initStaleForToken: K
84
84
  }) : null, [
85
85
  $e,
86
- E,
87
- K,
88
- q,
86
+ T,
87
+ W,
89
88
  G,
90
- J
89
+ U,
90
+ K
91
91
  ]);
92
- me(et, E);
93
- let Z = le(D, X ? void 0 : Y?.organizationId), tt = fe({
94
- organizationId: Z,
95
- cascadeOrgId: D,
96
- ownsFetch: W,
97
- parentStatus: He.organizationStatus,
98
- hasToken: !!E,
99
- loading: K,
100
- error: q,
101
- hasResult: !!G,
102
- initReplacementPending: Ke
103
- }), Q = g(() => ({
92
+ me(et, T);
93
+ let X = le(E, Y ? void 0 : J?.organizationId), tt = fe({
94
+ organizationId: X,
95
+ cascadeOrgId: E,
96
+ ownsFetch: H,
97
+ parentStatus: Ue.organizationStatus,
98
+ hasToken: !!T,
99
+ loading: W,
100
+ error: G,
101
+ hasResult: !!U,
102
+ initReplacementPending: qe
103
+ }), Z = m(() => ({
104
104
  enabled: F,
105
- organizationId: Z,
105
+ organizationId: X,
106
106
  rootCorrelationId: I,
107
107
  widgetName: L,
108
108
  widgetInstanceId: R
109
109
  }), [
110
110
  F,
111
- Z,
111
+ X,
112
112
  I,
113
113
  L,
114
114
  R
115
115
  ]);
116
- z.current = Q;
117
- let [$] = v(() => C === null ? new Se({ defaultOptions: {
116
+ z.current = Z;
117
+ let [Q] = g(() => x === null ? new Ce({ defaultOptions: {
118
118
  queries: {
119
119
  retry: !1,
120
120
  refetchOnWindowFocus: !1
121
121
  },
122
122
  mutations: { retry: !1 }
123
123
  } }) : null);
124
- h(() => {
125
- if (!$) return;
126
- let e = $;
127
- return n(e), () => r(e);
128
- }, [$]);
129
- let nt = g(() => ({
124
+ ge(Q);
125
+ let nt = m(() => ({
130
126
  baseUrl: s,
131
- widgetToken: l,
132
- organizationId: d,
133
- configClient: f,
134
- gatewayRouting: p,
135
- linkComponent: m,
136
- uiFramework: b
127
+ widgetToken: c,
128
+ organizationId: l,
129
+ configClient: u,
130
+ gatewayRouting: d,
131
+ linkComponent: f,
132
+ uiFramework: v
137
133
  }), [
138
134
  s,
135
+ c,
139
136
  l,
137
+ u,
140
138
  d,
141
139
  f,
142
- p,
143
- m,
144
- b
145
- ]), rt = g(() => ({
146
- baseUrl: T,
147
- widgetToken: E,
148
- organizationId: Z,
149
- configClient: O,
150
- gatewayRouting: k,
151
- linkComponent: A,
152
- uiFramework: j,
153
- initResponse: Y
140
+ v
141
+ ]), rt = m(() => ({
142
+ baseUrl: w,
143
+ widgetToken: T,
144
+ organizationId: X,
145
+ configClient: D,
146
+ gatewayRouting: O,
147
+ linkComponent: k,
148
+ uiFramework: A,
149
+ initResponse: J
154
150
  }), [
151
+ w,
155
152
  T,
156
- E,
157
- Z,
153
+ X,
154
+ D,
158
155
  O,
159
156
  k,
160
157
  A,
161
- j,
162
- Y
163
- ]), it = g(() => ({
158
+ J
159
+ ]), it = m(() => ({
164
160
  resolved: rt,
165
161
  own: nt,
166
- refetch: Je,
167
- loading: Ye,
168
- error: Xe,
169
- analytics: Q,
170
- cascadeOrgId: D,
171
- initResponseStaleForToken: X,
172
- disclosuresAcceptance: M,
173
- providerLabels: N
162
+ refetch: Ye,
163
+ loading: Xe,
164
+ error: q,
165
+ analytics: Z,
166
+ cascadeOrgId: E,
167
+ initResponseStaleForToken: Y,
168
+ disclosuresAcceptance: j,
169
+ providerLabels: M
174
170
  }), [
175
171
  rt,
176
172
  nt,
177
- Je,
178
173
  Ye,
179
174
  Xe,
180
- Q,
181
- D,
182
- X,
183
- M,
184
- N
185
- ]), at = /* @__PURE__ */ y(u.Provider, {
175
+ q,
176
+ Z,
177
+ E,
178
+ Y,
179
+ j,
180
+ M
181
+ ]), at = /* @__PURE__ */ _(se.Provider, {
186
182
  value: it,
187
- children: /* @__PURE__ */ y(te, {
188
- linkComponent: A,
189
- uiFramework: j,
190
- children: /* @__PURE__ */ xe(ie, { children: [ke, /* @__PURE__ */ y(_e, {
191
- resetKeys: [E],
192
- errorFallback: Te,
193
- onError: Ee,
194
- labels: Fe,
195
- children: ve(Y, S) ? /* @__PURE__ */ y(we, {
196
- disclosuresAcceptance: M,
197
- initStaleForToken: X,
198
- labels: Fe
199
- }) : re
183
+ children: /* @__PURE__ */ _(o, {
184
+ linkComponent: k,
185
+ uiFramework: A,
186
+ children: /* @__PURE__ */ Se(ne, { children: [Ae, /* @__PURE__ */ _(ve, {
187
+ resetKeys: [T],
188
+ errorFallback: Ee,
189
+ onError: De,
190
+ labels: N,
191
+ children: ye(J, b) ? /* @__PURE__ */ _(Te, {
192
+ disclosuresAcceptance: j,
193
+ initStaleForToken: Y,
194
+ labels: N
195
+ }) : te
200
196
  })] })
201
197
  })
202
- }), ot = U ? /* @__PURE__ */ y(a, {
203
- client: U,
204
- organizationId: Z,
205
- widgetToken: E,
206
- installClientSecret: Ve,
207
- authEpoch: We,
198
+ }), $ = V ? /* @__PURE__ */ _(r, {
199
+ client: V,
200
+ organizationId: X,
201
+ widgetToken: T,
202
+ installClientSecret: He,
203
+ authEpoch: Ge,
208
204
  organizationStatus: tt,
209
205
  children: at
210
206
  }) : at;
211
- return $ ? /* @__PURE__ */ y(Ce, {
212
- client: $,
213
- children: ot
214
- }) : ot;
207
+ return Q ? /* @__PURE__ */ _(we, {
208
+ client: Q,
209
+ children: $
210
+ }) : $;
215
211
  }
216
- function we({ disclosuresAcceptance: e, initStaleForToken: t, labels: n }) {
217
- let r = re("error-state") ?? s, i = d(), a = p(e), o = m({
212
+ function Te({ disclosuresAcceptance: e, initStaleForToken: t, labels: n }) {
213
+ let r = te("error-state") ?? s, i = l(), a = d(e), o = f({
218
214
  initStaleForToken: t,
219
215
  hasAcceptanceSurface: a
220
216
  });
221
- return h(() => {
222
- i(l.WidgetDisclosuresBlocked, { reason: o }), console.info(`[disclosures] widget blocked: ${o}`);
223
- }, [o, i]), t ? /* @__PURE__ */ y(r, {
217
+ return p(() => {
218
+ i(c.WidgetDisclosuresBlocked, { reason: o }), console.info(`[disclosures] widget blocked: ${o}`);
219
+ }, [o, i]), t ? /* @__PURE__ */ _(r, {
224
220
  title: n.disclosuresRefreshingTitle,
225
221
  description: n.disclosuresRefreshingDescription,
226
- testId: f,
222
+ testId: u,
227
223
  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"
228
- }) : a ? /* @__PURE__ */ y("div", {
229
- "data-testid": f,
224
+ }) : a ? /* @__PURE__ */ _("div", {
225
+ "data-testid": u,
230
226
  className: "ttw:w-full",
231
227
  children: e
232
- }) : /* @__PURE__ */ y(r, {
228
+ }) : /* @__PURE__ */ _(r, {
233
229
  title: n.disclosuresRequiredTitle,
234
- testId: f,
230
+ testId: u,
235
231
  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"
236
232
  });
237
233
  }
238
- export { b as WidgetProvider, b as default };
234
+ export { v as WidgetProvider, v as default };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { registerQueryClient as e, unregisterQueryClient as t } from "../../../../data-access/dist/lib/clientRegistry.js";
6
+ import "../../../../data-access/dist/index.js";
7
+ import { useEffect as n, useRef as r } from "react";
8
+ // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/useOwnedQueryClient.js
9
+ function i(i) {
10
+ let a = r(void 0);
11
+ n(() => {
12
+ if (i) return a.current?.(), e(i), () => {
13
+ t(i);
14
+ let e = !1, n, r = setTimeout(() => {
15
+ i.cancelQueries().then(() => {
16
+ if (e) return;
17
+ for (let e of i.getMutationCache().getAll()) e.destroy();
18
+ i.clear();
19
+ let t = i.getQueryCache(), r = !1;
20
+ n = t.subscribe((e) => {
21
+ e.type === "added" && !r ? t.remove(e.query) : e.type === "observerAdded" && (r = !0, t.add(e.query));
22
+ });
23
+ });
24
+ }, 0);
25
+ a.current = () => {
26
+ e = !0, clearTimeout(r), n?.();
27
+ };
28
+ };
29
+ }, [i]);
30
+ }
31
+ export { i as useOwnedQueryClient };
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.11.275", n = "236170c6af2568317d8d38f784089ab4dca17c4c", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.11.277", n = "307f75b634b662f4dd4f64fb7df850ca92b13308", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -8710,6 +8710,7 @@ var q_ = z_("ttw:inline-flex ttw:cursor-pointer ttw:items-center ttw:justify-cen
8710
8710
  outline: "ttw:border ttw:border-border ttw:bg-background ttw:shadow-xs ttw:hover:bg-accent ttw:hover:text-accent-foreground ttw:dark:bg-input/30 ttw:dark:border-input ttw:dark:hover:bg-input/50",
8711
8711
  secondary: "ttw:bg-secondary ttw:text-secondary-foreground ttw:hover:bg-secondary/80",
8712
8712
  ghost: "ttw:hover:bg-accent ttw:hover:text-accent-foreground ttw:dark:hover:bg-accent/50",
8713
+ utility: "ttw:font-normal ttw:text-muted-foreground ttw:hover:bg-accent ttw:hover:text-foreground ttw:dark:hover:bg-accent/50",
8713
8714
  link: "ttw:text-primary ttw:underline-offset-4 ttw:hover:underline"
8714
8715
  },
8715
8716
  size: {
@@ -18016,7 +18017,7 @@ function mM({ activeCount: e, size: t = "sm", labels: n, className: r, ...i }) {
18016
18017
  return /* @__PURE__ */ b("button", {
18017
18018
  type: "button",
18018
18019
  className: J(q_({
18019
- variant: "ghost",
18020
+ variant: "utility",
18020
18021
  size: t
18021
18022
  }), r),
18022
18023
  ...i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.11.275",
3
+ "version": "0.11.277",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [