@tesouro/embedded-components-react 0.11.220 → 0.11.221

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