@tesouro/embedded-components-react 0.5.148 → 0.5.150

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 (64) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index11.js +11 -8
  2. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index2.js +5 -2
  3. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +5 -2
  4. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +5 -2
  5. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/data-access/dist/index5.js +21 -18
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +14 -11
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +17 -14
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +6 -3
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +43 -28
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index18.js +9 -6
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +6 -3
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +6 -3
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +52 -49
  14. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index6.js +7 -4
  15. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index7.js +10 -7
  16. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index8.js +7 -4
  17. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/data-access/dist/index7.js +5 -2
  18. package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index2.js +5 -2
  19. package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index3.js +5 -2
  20. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index2.js +12 -6
  21. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index3.js +12 -6
  22. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index2.js +6 -3
  23. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index3.js +6 -3
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +30 -15
  25. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/data-access/dist/index4.js +5 -2
  26. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js +6 -3
  27. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js +6 -3
  28. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index4.js +6 -3
  29. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/data-access/dist/index2.js +7 -4
  30. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index10.js +6 -3
  31. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index2.js +6 -3
  32. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index7.js +6 -3
  33. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/data-access/dist/index8.js +6 -3
  34. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index12.js +7 -4
  35. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index13.js +5 -2
  36. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js +16 -13
  37. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index3.js +12 -6
  38. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +6 -3
  39. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index7.js +12 -6
  40. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/EmbedApiContext.js +9 -6
  41. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/applicationStatusQueryOptions.js +4 -1
  42. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js +14 -14
  43. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js +15 -12
  44. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/merchant-category-group/useAllMerchantCategoryGroupsQuery.js +17 -14
  45. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +23 -17
  46. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js +6 -3
  47. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +3 -0
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js +17 -14
  49. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useRolePermissionsQueries.js +19 -16
  50. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useCurrentUserQuery.js +6 -3
  51. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useGetUserDataQuery.js +12 -9
  52. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +19 -16
  53. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js +11 -11
  54. package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index3.js +6 -3
  55. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +99 -98
  56. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +139 -138
  57. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/useWidgetFetch.js +11 -10
  58. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  59. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index2.js +6 -3
  60. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index3.js +6 -3
  61. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index8.js +6 -3
  62. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +6 -3
  63. package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index6.js +16 -13
  64. package/package.json +7 -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 ie, subscribeToGlobal as ae } from "./globalStore.js";
17
- import { EmbeddedAnalyticsEvent as c } from "../analytics/events.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";
24
- import { useAnalyticsTrack as l } from "../analytics/hooks.js";
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";
29
- import { jsx as _ } from "react/jsx-runtime";
30
- import { QueryClient as be, QueryClientProvider as xe } from "@tanstack/react-query";
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 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({
34
- enabled: F,
35
- organizationId: E,
36
- rootCorrelationId: I,
37
- widgetName: L,
38
- widgetInstanceId: R
39
- }), Fe = h(!1);
40
- p(() => {
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."));
42
- }, [b, P]), p(() => {
43
- if (!P || !F || !("window" in globalThis)) return;
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
- }, [P, F]);
51
- let B = te(o(A));
52
- p(() => {
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,
61
- analyticsContextRef: z,
62
- clientSecretRef: Re,
63
- gatewayRouting: O
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 D ? D(e) : e;
65
+ return O ? O(e) : e;
66
66
  }, [
67
- Ie,
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
- W,
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
- U,
83
- K
81
+ K,
82
+ W,
83
+ q
84
84
  ]);
85
- me(Xe, T);
86
- let X = ue(E, J ? void 0 : q?.organizationId), Z = m(() => ({
87
- enabled: F,
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: I,
90
- widgetName: L,
91
- widgetInstanceId: R
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
- z.current = Z;
100
- let [Q] = g(() => S === null ? new be({ defaultOptions: {
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
- p(() => {
107
+ m(() => {
108
108
  if (!Q) return;
109
109
  let e = Q;
110
110
  return t(e), () => n(e);
111
111
  }, [Q]);
112
- let Ze = m(() => ({
112
+ let $e = h(() => ({
113
113
  baseUrl: s,
114
- widgetToken: c,
115
- organizationId: l,
116
- configClient: u,
117
- gatewayRouting: d,
118
- linkComponent: f,
119
- uiFramework: v,
120
- implementation: y
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
- v,
129
- y
130
- ]), Qe = m(() => ({
131
- baseUrl: w,
132
- widgetToken: T,
127
+ p,
128
+ y,
129
+ b
130
+ ]), et = h(() => ({
131
+ baseUrl: T,
132
+ widgetToken: E,
133
133
  organizationId: X,
134
- configClient: D,
135
- gatewayRouting: O,
136
- linkComponent: k,
137
- uiFramework: A,
138
- implementation: j,
139
- initResponse: q
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
- q
150
- ]), $e = m(() => ({
151
- resolved: Qe,
152
- own: Ze,
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: E,
158
- initResponseStaleForToken: J,
159
- disclosuresAcceptance: M,
160
- providerLabels: N
157
+ cascadeOrgId: D,
158
+ initResponseStaleForToken: Y,
159
+ disclosuresAcceptance: N,
160
+ providerLabels: P
161
161
  }), [
162
- Qe,
163
- Ze,
162
+ et,
163
+ $e,
164
164
  Ge,
165
165
  Ke,
166
166
  qe,
167
167
  Z,
168
- E,
169
- J,
170
- M,
171
- N
172
- ]), et = /* @__PURE__ */ _(ce.Provider, {
173
- value: $e,
174
- children: /* @__PURE__ */ _(ee, {
175
- linkComponent: k,
176
- uiFramework: A,
177
- children: /* @__PURE__ */ _(re, { children: /* @__PURE__ */ _(ge, {
178
- resetKeys: [T],
179
- errorFallback: Ce,
180
- onError: we,
181
- labels: Me,
182
- children: _e(q, x) ? /* @__PURE__ */ _(Se, {
183
- disclosuresAcceptance: M,
184
- initStaleForToken: J,
185
- labels: Me
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
- }), $ = V ? /* @__PURE__ */ _(i, {
190
- client: V,
189
+ }), $ = H ? /* @__PURE__ */ v(i, {
190
+ client: H,
191
191
  organizationId: X,
192
- widgetToken: T,
193
- installClientSecret: ze,
194
- authEpoch: He,
195
- children: et
196
- }) : et;
197
- return Q ? /* @__PURE__ */ _(xe, {
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 Se({ disclosuresAcceptance: e, initStaleForToken: t, labels: n }) {
203
- let r = ne("error-state") ?? s, i = l(), a = d(e), o = f({
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 p(() => {
208
- i(c.WidgetDisclosuresBlocked, { reason: o }), console.info(`[disclosures] widget blocked: ${o}`);
209
- }, [o, i]), t ? /* @__PURE__ */ _(r, {
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: u,
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__ */ _("div", {
215
- "data-testid": u,
215
+ }) : a ? /* @__PURE__ */ v("div", {
216
+ "data-testid": d,
216
217
  className: "ttw:w-full",
217
218
  children: e
218
- }) : /* @__PURE__ */ _(r, {
219
+ }) : /* @__PURE__ */ v(r, {
219
220
  title: n.disclosuresRequiredTitle,
220
- testId: u,
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 { v as WidgetProvider, v as default };
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), C = o(l), w = o(void 0), T = o(void 0);
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 = S.current !== c, a = C.current !== l;
12
- if (S.current = c, C.current = l, !c || !l) {
13
- p(null), h(!1), _(null), y(!1), w.current = void 0, T.current = void 0;
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), w.current = void 0, T.current = void 0) : a && y(!1);
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 (w.current = i ? l : void 0, T.current = i ? c : void 0, p(i), _(null), y(!1), h(!1), u) {
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), w.current = void 0, T.current = void 0), y(!1), _(e instanceof Error ? e : Error("Widget init fetch failed", { cause: e })), h(!1), u)) {
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 E = i(() => x((e) => e + 1), []);
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: d !== null && (w.current !== l || T.current !== c),
57
- refetch: E
56
+ initStaleForToken: k,
57
+ initReplacementPending: k && !S,
58
+ refetch: O
58
59
  };
59
60
  }
60
61
  function l(e) {
@@ -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.148", n = "53e265c20b4ff06229dbe274cabebca1939f24be", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.150", n = "de1720601f4aa895be5279b264351172850f2150", 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(), d = !!(c && l) && (a === !0 || a === void 0), f = e({
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(f, u, { carryWithinOrg: !0 }),
20
- enabled: d
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(), u = !!(s && c && a), d = e({
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(d, l),
20
- enabled: u
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(), l = !!(o && s), u = e({
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(u, c),
19
- enabled: l
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(), u = !!(s && c && a), d = e({
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(d, l),
20
- enabled: u
19
+ ...t(f, {
20
+ authEpoch: l,
21
+ organizationPending: u
22
+ }),
23
+ enabled: d
21
24
  });
22
25
  }
23
26
  //#endregion
@@ -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(), h = r(f), g = !!(f && p) && (l === !0 || l === void 0), _ = a({ enabled: g }), v = o(() => [..._.data?.data?.map((e) => e.id).filter(Boolean) ?? []].sort(), [_.data?.data]), y = s({ queries: v.map((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: h,
20
+ headers: g,
21
21
  path: { id: n },
22
22
  query: { limit: u }
23
- }), m),
24
- enabled: g
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 y) for (let n of t.data?.data ?? []) e.set(n.id, n);
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
- }, [y]),
32
- accountIds: v,
33
- isLoading: i(_) || y.some((e) => e.isLoading && e.fetchStatus !== "idle"),
34
- isError: _.isError || y.some((e) => e.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
- _.refetch();
37
- for (let e of y) e.refetch();
39
+ v.refetch();
40
+ for (let e of b) e.refetch();
38
41
  },
39
- accountsQuery: _,
40
- transferQueries: y
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.148",
3
+ "version": "0.5.150",
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,