@tesouro/embedded-components-react 0.3.26 → 0.3.27

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 (63) hide show
  1. package/README.md +3 -0
  2. package/dist/experimental/WidgetSuite.d.ts +32 -3
  3. package/dist/experimental/index.d.ts +32 -3
  4. package/dist/index.d.ts +60 -25
  5. package/dist/lib/AcceptDisclosuresWidget.d.ts +32 -3
  6. package/dist/lib/BalancesWidget.d.ts +31 -2
  7. package/dist/lib/BankAccountOnboardingWidget.d.ts +32 -3
  8. package/dist/lib/BankAccountsWidget.d.ts +32 -3
  9. package/dist/lib/BillPayWidget.d.ts +31 -2
  10. package/dist/lib/CardDetailsWidget.d.ts +32 -3
  11. package/dist/lib/CardsWidget.d.ts +32 -3
  12. package/dist/lib/ChartOfAccountsWidget.d.ts +32 -3
  13. package/dist/lib/CounterpartsWidget.d.ts +32 -3
  14. package/dist/lib/CreateCardWidget.d.ts +32 -3
  15. package/dist/lib/ExpenseApprovalPoliciesWidget.d.ts +32 -3
  16. package/dist/lib/ExpenseManagementWidget.d.ts +32 -3
  17. package/dist/lib/ExpenseRequirementsWidget.d.ts +32 -3
  18. package/dist/lib/HelpWidget.d.ts +32 -3
  19. package/dist/lib/InsightsWidget.d.ts +31 -2
  20. package/dist/lib/InvoicingWidget.d.ts +32 -3
  21. package/dist/lib/LinkedAccountsWidget.d.ts +32 -3
  22. package/dist/lib/ProductsWidget.d.ts +32 -3
  23. package/dist/lib/ProfileWidget.d.ts +32 -3
  24. package/dist/lib/ReceiptMatchWidget.d.ts +32 -3
  25. package/dist/lib/ReceivablesWidget.d.ts +32 -3
  26. package/dist/lib/SettingsWidget.d.ts +32 -3
  27. package/dist/lib/TagsWidget.d.ts +32 -3
  28. package/dist/lib/TeamWidget.d.ts +32 -3
  29. package/dist/lib/TransfersWidget.d.ts +31 -2
  30. package/dist/lib/WidgetProvider.d.ts +39 -4
  31. package/dist/lib/WidgetProviderPublic.d.ts +31 -2
  32. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index5.js +3 -2
  33. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +131 -130
  34. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +3 -2
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +4 -3
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +3 -2
  37. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +3 -2
  38. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +3 -2
  39. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +3 -2
  40. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +88 -87
  41. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js +7 -6
  42. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js +2 -1
  43. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index9.js +3 -2
  44. package/dist/libs/tesouro-embedded-components-react/expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js +2 -1
  45. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index8.js +5 -4
  46. package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index3.js +3 -2
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +3 -2
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js +5 -4
  49. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +3 -2
  50. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +3 -2
  51. package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +3 -2
  52. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +3 -2
  53. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +50 -48
  54. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetErrorBoundary.js +13 -13
  55. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +174 -163
  56. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/isDisclosuresAcceptanceRequired.js +12 -1
  57. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/labels.js +7 -1
  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/feature/dist/lib/analytics/events.js +1 -0
  60. package/dist/libs/tesouro-embedded-components-react/tags-widget/feature/dist/index11.js +3 -2
  61. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index17.js +3 -2
  62. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +3 -2
  63. package/package.json +1 -1
@@ -4,40 +4,40 @@
4
4
  "use client";
5
5
  import { registerQueryClient as e, unregisterQueryClient as t } from "../../../../data-access/dist/lib/clientRegistry.js";
6
6
  import { createEmbeddedClient as ee } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
7
- import { EmbedApiProvider as n } from "../../../../data-access/dist/lib/EmbedApiContext.js";
7
+ import { EmbedApiProvider as te } from "../../../../data-access/dist/lib/EmbedApiContext.js";
8
8
  import "../../../../data-access/dist/index.js";
9
- import { getGlobalSnapshot as r, subscribeToGlobal as i } from "./globalStore.js";
10
- import { configureEmbeddedClient as te } from "../analytics/client.js";
11
- import { generateCorrelationId as a } from "../analytics/ids.js";
12
- import { WidgetContext as ne } from "./WidgetContext.js";
13
- import { resolveOrgId as re, useAuthEpoch as ie } from "./utils.js";
14
- import { useWidgetFetch as ae } from "./useWidgetFetch.js";
15
- import { deriveWidgetInitState as oe, useWidgetInitPublisher as se } from "./useWidgetInitPublisher.js";
16
- import { resolveUIFramework as o } from "../../../../ui/dist/lib/UIContext/UIContext.js";
17
- import { UIProvider as s } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
18
- import { useDesignSystemEnsurer as c } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
9
+ import { getGlobalSnapshot as n, subscribeToGlobal as ne } from "./globalStore.js";
10
+ import { configureEmbeddedClient as re } from "../analytics/client.js";
11
+ import { generateCorrelationId as ie } from "../analytics/ids.js";
12
+ import { WidgetContext as r } from "./WidgetContext.js";
13
+ import { resolveOrgId as i, useAuthEpoch as ae } from "./utils.js";
14
+ import { useWidgetFetch as oe } from "./useWidgetFetch.js";
15
+ import { deriveWidgetInitState as se, useWidgetInitPublisher as ce } from "./useWidgetInitPublisher.js";
16
+ import { resolveUIFramework as a } from "../../../../ui/dist/lib/UIContext/UIContext.js";
17
+ import { UIProvider as o } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
18
+ import { useDesignSystemEnsurer as le } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
19
19
  import "../../../../ui/dist/index.js";
20
- import { useEffect as l, useMemo as u, useRef as d, useState as f, useSyncExternalStore as p } from "react";
21
- import { jsx as m } from "react/jsx-runtime";
22
- import { QueryClient as h, QueryClientProvider as ce } from "@tanstack/react-query";
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";
23
23
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js
24
- function g({ children: g, baseUrl: _, widgetToken: v, organizationId: y, configClient: b, gatewayRouting: x, linkComponent: S, uiFramework: C, implementation: w, analytics: T, unstable_initResponseOverride: E, disclosuresAcceptance: D }) {
25
- let O = p(i, r, r), k = _ ?? O.baseUrl, A = v === void 0 ? O.widgetToken : v, j = y === void 0 ? O.organizationId : y, M = b ?? O.configClient, N = x ?? O.gatewayRouting, P = S ?? O.linkComponent, F = C ?? O.uiFramework, I = w ?? O.implementation, L = T !== !1, [R] = f(a), z = d({
24
+ 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(ne, 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(ie), z = l({
26
26
  enabled: L,
27
27
  organizationId: j,
28
28
  rootCorrelationId: R
29
- }), [B] = f(() => new h({ defaultOptions: {
29
+ }), [B] = u(() => new p({ defaultOptions: {
30
30
  queries: {
31
31
  retry: !1,
32
32
  refetchOnWindowFocus: !1
33
33
  },
34
34
  mutations: { retry: !1 }
35
35
  } }));
36
- l(() => (e(B), () => t(B)), [B]);
37
- let V = d(A);
36
+ s(() => (e(B), () => t(B)), [B]);
37
+ let V = l(A);
38
38
  V.current = A;
39
- let H = ie(A), U = u(() => {
40
- let e = te(ee(k), {
39
+ let H = ae(A), U = c(() => {
40
+ let e = re(ee(k), {
41
41
  tokenRef: V,
42
42
  analyticsContextRef: z,
43
43
  gatewayRouting: N
@@ -48,7 +48,7 @@ function g({ children: g, baseUrl: _, widgetToken: v, organizationId: y, configC
48
48
  M,
49
49
  N
50
50
  ]);
51
- l(() => {
51
+ s(() => {
52
52
  if (!L || !("window" in globalThis)) return;
53
53
  let e = !1;
54
54
  return import("../analytics/install.js").then(({ ensureAnalyticsAdapterInstalled: t }) => {
@@ -57,11 +57,11 @@ function g({ children: g, baseUrl: _, widgetToken: v, organizationId: y, configC
57
57
  e = !0;
58
58
  };
59
59
  }, [L]);
60
- let W = c(o(F));
61
- l(() => {
60
+ let W = le(a(F));
61
+ s(() => {
62
62
  W && W().catch(() => {});
63
63
  }, [W]);
64
- let { result: le, loading: G, error: K, initStaleForToken: ue, refetch: q } = ae(E ? null : U, A, z), J = A ? E ?? le ?? void 0 : void 0, Y = !E && ue, X = re(j, Y ? void 0 : J?.organizationId), de = u(() => oe({
64
+ let { result: ue, loading: G, error: K, initStaleForToken: de, refetch: q } = oe(T ? null : U, A, z), J = A ? T ?? ue ?? void 0 : void 0, Y = !T && de, X = i(j, Y ? void 0 : J?.organizationId), fe = c(() => se({
65
65
  hasToken: !!A,
66
66
  loading: G,
67
67
  error: K,
@@ -74,8 +74,8 @@ function g({ children: g, baseUrl: _, widgetToken: v, organizationId: y, configC
74
74
  J,
75
75
  Y
76
76
  ]);
77
- se(de, A);
78
- let Z = u(() => ({
77
+ ce(fe, A);
78
+ let Z = c(() => ({
79
79
  enabled: L,
80
80
  organizationId: X,
81
81
  rootCorrelationId: R
@@ -85,25 +85,25 @@ function g({ children: g, baseUrl: _, widgetToken: v, organizationId: y, configC
85
85
  R
86
86
  ]);
87
87
  z.current = Z;
88
- let Q = u(() => ({
89
- baseUrl: _,
90
- widgetToken: v,
91
- organizationId: y,
92
- configClient: b,
93
- gatewayRouting: x,
94
- linkComponent: S,
95
- uiFramework: C,
96
- implementation: w
88
+ let Q = c(() => ({
89
+ baseUrl: g,
90
+ widgetToken: _,
91
+ organizationId: v,
92
+ configClient: y,
93
+ gatewayRouting: b,
94
+ linkComponent: x,
95
+ uiFramework: S,
96
+ implementation: C
97
97
  }), [
98
+ g,
98
99
  _,
99
100
  v,
100
101
  y,
101
102
  b,
102
103
  x,
103
104
  S,
104
- C,
105
- w
106
- ]), $ = u(() => ({
105
+ C
106
+ ]), $ = c(() => ({
107
107
  baseUrl: k,
108
108
  widgetToken: A,
109
109
  organizationId: X,
@@ -123,7 +123,7 @@ function g({ children: g, baseUrl: _, widgetToken: v, organizationId: y, configC
123
123
  F,
124
124
  I,
125
125
  J
126
- ]), fe = u(() => ({
126
+ ]), pe = c(() => ({
127
127
  resolved: $,
128
128
  own: Q,
129
129
  refetch: q,
@@ -132,7 +132,8 @@ function g({ children: g, baseUrl: _, widgetToken: v, organizationId: y, configC
132
132
  analytics: Z,
133
133
  cascadeOrgId: j,
134
134
  initResponseStaleForToken: Y,
135
- disclosuresAcceptance: D
135
+ disclosuresAcceptance: E,
136
+ providerLabels: D
136
137
  }), [
137
138
  $,
138
139
  Q,
@@ -142,25 +143,26 @@ function g({ children: g, baseUrl: _, widgetToken: v, organizationId: y, configC
142
143
  Z,
143
144
  j,
144
145
  Y,
146
+ E,
145
147
  D
146
148
  ]);
147
- return /* @__PURE__ */ m(ce, {
149
+ return /* @__PURE__ */ f(m, {
148
150
  client: B,
149
- children: /* @__PURE__ */ m(n, {
151
+ children: /* @__PURE__ */ f(te, {
150
152
  client: U,
151
153
  organizationId: X,
152
154
  widgetToken: A,
153
155
  authEpoch: H,
154
- children: /* @__PURE__ */ m(ne.Provider, {
155
- value: fe,
156
- children: /* @__PURE__ */ m(s, {
156
+ children: /* @__PURE__ */ f(r.Provider, {
157
+ value: pe,
158
+ children: /* @__PURE__ */ f(o, {
157
159
  linkComponent: P,
158
160
  uiFramework: F,
159
- children: g
161
+ children: h
160
162
  })
161
163
  })
162
164
  })
163
165
  });
164
166
  }
165
167
  //#endregion
166
- export { g as RootWidgetProvider };
168
+ export { h as RootWidgetProvider };
@@ -11,34 +11,34 @@ import { QueryErrorResetBoundary as o } from "@tanstack/react-query";
11
11
  import { ErrorBoundary as s } from "react-error-boundary";
12
12
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetErrorBoundary.js
13
13
  var c = 256, l = 1024;
14
- function u() {
14
+ function u({ message: e }) {
15
15
  return /* @__PURE__ */ a("div", {
16
16
  role: "alert",
17
- children: r.errorBoundaryFallback
17
+ children: e
18
18
  });
19
19
  }
20
20
  function d(e, t) {
21
21
  return e.length > t ? `${e.slice(0, t)}...` : e;
22
22
  }
23
- function f({ resetKeys: r, errorFallback: f, onError: p, children: m }) {
24
- let h = n(), g = t(), _ = i((t, n) => {
23
+ function f({ resetKeys: f, errorFallback: p, onError: m, labels: h = r, children: g }) {
24
+ let _ = n(), v = t(), y = i((t, n) => {
25
25
  let r = t instanceof Error ? t : /* @__PURE__ */ Error("Unknown widget error"), i = d(n.componentStack ?? "", l);
26
- h(e.WidgetError, {
26
+ _(e.WidgetError, {
27
27
  error_name: r.name,
28
28
  error_message: d(r.message, c),
29
29
  component_stack: i
30
- }), g(r, { component_stack: i }), p?.(t, n);
30
+ }), v(r, { component_stack: i }), m?.(t, n);
31
31
  }, [
32
- h,
33
- g,
34
- p
32
+ _,
33
+ v,
34
+ m
35
35
  ]);
36
36
  return /* @__PURE__ */ a(o, { children: ({ reset: e }) => /* @__PURE__ */ a(s, {
37
- resetKeys: [...r],
37
+ resetKeys: [...f],
38
38
  onReset: e,
39
- onError: _,
40
- ...typeof f == "function" ? { fallbackRender: f } : f === void 0 ? { FallbackComponent: u } : { fallback: f },
41
- children: m
39
+ onError: y,
40
+ ...typeof p == "function" ? { fallbackRender: p } : p === void 0 ? { fallback: /* @__PURE__ */ a(u, { message: h.errorBoundaryFallback }) } : { fallback: p },
41
+ children: g
42
42
  }) });
43
43
  }
44
44
  //#endregion
@@ -4,208 +4,219 @@
4
4
  "use client";
5
5
  import { registerQueryClient as e, unregisterQueryClient as t } from "../../../../data-access/dist/lib/clientRegistry.js";
6
6
  import { createEmbeddedClient as n } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
7
- import { EmbedApiProvider as ee, useEmbedApi as te } from "../../../../data-access/dist/lib/EmbedApiContext.js";
7
+ import { EmbedApiProvider as r, useEmbedApi as i } from "../../../../data-access/dist/lib/EmbedApiContext.js";
8
8
  import "../../../../data-access/dist/index.js";
9
- import { getGlobalSnapshot as ne, subscribeToGlobal as re } from "./globalStore.js";
10
- import { configureEmbeddedClient as ie } from "../analytics/client.js";
11
- import { generateCorrelationId as r } from "../analytics/ids.js";
12
- import { WidgetContext as i } from "./WidgetContext.js";
13
- import { noop as ae, resolveOrgId as oe, useAuthEpoch as se } from "./utils.js";
14
- import { useWidgetFetch as ce } from "./useWidgetFetch.js";
15
- import { deriveWidgetInitState as le, useWidgetInitPublisher as ue } from "./useWidgetInitPublisher.js";
16
- import { resolveUIFramework as de } from "../../../../ui/dist/lib/UIContext/UIContext.js";
17
- import { UIProvider as fe } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
18
- import { useDesignSystemEnsurer as pe, useFrameworkRenderer as me } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
19
- import { HostIsolationScope as he } from "../../../../ui/dist/lib/HostIsolationScope/HostIsolationScope.js";
20
- import { ErrorState as a } from "../../../../ui/dist/lib/ErrorState/ErrorState.js";
9
+ import { getGlobalSnapshot as a, subscribeToGlobal as o } from "./globalStore.js";
10
+ import { EmbeddedAnalyticsEvent as s } from "../analytics/events.js";
11
+ import { configureEmbeddedClient as ee } from "../analytics/client.js";
12
+ import { generateCorrelationId as te } from "../analytics/ids.js";
13
+ import { WidgetContext as ne } from "./WidgetContext.js";
14
+ import { noop as re, resolveOrgId as ie, useAuthEpoch as ae } from "./utils.js";
15
+ import { useWidgetFetch as oe } from "./useWidgetFetch.js";
16
+ import { deriveWidgetInitState as se, useWidgetInitPublisher as ce } from "./useWidgetInitPublisher.js";
17
+ import { resolveUIFramework as le } from "../../../../ui/dist/lib/UIContext/UIContext.js";
18
+ import { UIProvider as ue } from "../../../../ui/dist/lib/UIContext/UIProvider.js";
19
+ import { useDesignSystemEnsurer as de, useFrameworkRenderer as c } from "../../../../ui/dist/lib/UIContext/uiRendererRegistry.js";
20
+ import { HostIsolationScope as fe } from "../../../../ui/dist/lib/HostIsolationScope/HostIsolationScope.js";
21
+ import { ErrorState as l } from "../../../../ui/dist/lib/ErrorState/ErrorState.js";
21
22
  import "../../../../ui/dist/index.js";
22
- import { DEFAULT_LABELS as o } from "./labels.js";
23
- import { WidgetErrorBoundary as ge } from "./WidgetErrorBoundary.js";
24
- import { DISCLOSURES_REQUIRED_TEST_ID as s, shouldGateOnDisclosuresAcceptance as _e } from "./isDisclosuresAcceptanceRequired.js";
25
- import { useContext as ve, useEffect as c, useMemo as l, useRef as u, useState as d, useSyncExternalStore as ye } from "react";
26
- import { jsx as f } from "react/jsx-runtime";
27
- import { QueryClient as be, QueryClientProvider as xe } from "@tanstack/react-query";
23
+ import { useAnalyticsTrack as u } from "../analytics/hooks.js";
24
+ import { resolveProviderLabels as pe } from "./labels.js";
25
+ import { WidgetErrorBoundary as me } from "./WidgetErrorBoundary.js";
26
+ import { DISCLOSURES_REQUIRED_TEST_ID as d, hasRenderableAcceptanceSurface as f, resolveDisclosuresBlockedReason as p, shouldGateOnDisclosuresAcceptance as he } from "./isDisclosuresAcceptanceRequired.js";
27
+ import { useContext as ge, useEffect as m, useMemo as h, useRef as g, useState as _, useSyncExternalStore as _e } from "react";
28
+ import { jsx as v } from "react/jsx-runtime";
29
+ import { QueryClient as ve, QueryClientProvider as ye } from "@tanstack/react-query";
28
30
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js
29
- function p({ children: me, baseUrl: a, widgetToken: o, organizationId: s, configClient: p, gatewayRouting: m, linkComponent: h, uiFramework: g, implementation: _, errorFallback: Ce, onError: we, analytics: v, disclosuresAcceptance: Te, widgetName: y }) {
30
- let b = ve(i), Ee = ye(re, ne, ne), x = b?.resolved ?? Ee, De = b?.refetch ?? ae, Oe = b?.loading ?? !1, ke = b?.error ?? null, S = a ?? x.baseUrl, C = o === void 0 ? x.widgetToken : o, Ae = b ? b.cascadeOrgId : Ee.organizationId, w = s === void 0 ? Ae : s, T = p ?? x.configClient, E = m ?? x.gatewayRouting, D = h ?? x.linkComponent, O = g ?? x.uiFramework, k = _ ?? x.implementation, A = Te ?? b?.disclosuresAcceptance, j = b === null, M = j ? v !== !1 : b.analytics.enabled, [je] = d(r), N = j ? je : b.analytics.rootCorrelationId, [Me] = d(r), P = y === void 0 ? b?.analytics.widgetName : y, F = y === void 0 ? b?.analytics.widgetInstanceId : Me, I = u({
31
- enabled: M,
32
- organizationId: w,
33
- rootCorrelationId: N,
34
- widgetName: P,
35
- widgetInstanceId: F
36
- }), Ne = u(!1);
37
- c(() => {
38
- j || v === void 0 || Ne.current || (Ne.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."));
39
- }, [v, j]), c(() => {
40
- if (!j || !M || !("window" in globalThis)) return;
31
+ function y({ children: s, baseUrl: c, widgetToken: l, organizationId: u, configClient: d, gatewayRouting: f, linkComponent: p, uiFramework: y, implementation: b, errorFallback: xe, onError: Se, analytics: x, disclosuresAcceptance: Ce, providerLabels: we, widgetName: S }) {
32
+ let C = ge(ne), Te = _e(o, a, a), w = C?.resolved ?? Te, Ee = C?.refetch ?? re, De = C?.loading ?? !1, Oe = C?.error ?? null, T = c ?? w.baseUrl, E = l === void 0 ? w.widgetToken : l, ke = C ? C.cascadeOrgId : Te.organizationId, D = u === void 0 ? ke : u, O = d ?? w.configClient, k = f ?? w.gatewayRouting, A = p ?? w.linkComponent, j = y ?? w.uiFramework, Ae = b ?? w.implementation, M = Ce ?? C?.disclosuresAcceptance, N = we ?? C?.providerLabels, je = h(() => pe(N), [N]), P = C === null, F = P ? x !== !1 : C.analytics.enabled, [Me] = _(te), I = P ? Me : C.analytics.rootCorrelationId, [Ne] = _(te), L = S === void 0 ? C?.analytics.widgetName : S, R = S === void 0 ? C?.analytics.widgetInstanceId : Ne, z = g({
33
+ enabled: F,
34
+ organizationId: D,
35
+ rootCorrelationId: I,
36
+ widgetName: L,
37
+ widgetInstanceId: R
38
+ }), Pe = g(!1);
39
+ m(() => {
40
+ P || 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."));
41
+ }, [x, P]), m(() => {
42
+ if (!P || !F || !("window" in globalThis)) return;
41
43
  let e = !1;
42
44
  return import("../analytics/install.js").then(({ ensureAnalyticsAdapterInstalled: t }) => {
43
45
  e || t();
44
46
  }), () => {
45
47
  e = !0;
46
48
  };
47
- }, [j, M]);
48
- let L = pe(de(O));
49
- c(() => {
50
- L && L().catch(() => {});
51
- }, [L]);
52
- let Pe = b === null || a !== void 0 || o !== void 0 || s !== void 0 || p != null || m !== void 0 || y !== void 0, R = u(C);
53
- R.current = C;
54
- let Fe = te(), Ie = se(C), z = l(() => {
55
- if (!Pe) return null;
56
- let e = ie(n(S), {
57
- tokenRef: R,
58
- analyticsContextRef: I,
59
- gatewayRouting: E
49
+ }, [P, F]);
50
+ let B = de(le(j));
51
+ m(() => {
52
+ B && B().catch(() => {});
53
+ }, [B]);
54
+ let Fe = C === null || c !== void 0 || l !== void 0 || u !== void 0 || d != null || f !== void 0 || S !== void 0, Ie = g(E);
55
+ Ie.current = E;
56
+ let Le = i(), Re = ae(E), V = h(() => {
57
+ if (!Fe) return null;
58
+ let e = ee(n(T), {
59
+ tokenRef: Ie,
60
+ analyticsContextRef: z,
61
+ gatewayRouting: k
60
62
  });
61
- return T ? T(e) : e;
63
+ return O ? O(e) : e;
62
64
  }, [
63
- Pe,
64
- S,
65
+ Fe,
65
66
  T,
66
- E
67
- ]), B = b === null || a !== void 0 || o !== void 0, Le = B ? Ie : Fe.authEpoch, { result: V, loading: H, error: U, clearedForAuthChange: Re, initStaleForToken: W, refetch: ze } = ce(B ? z : null, B ? C : void 0, I), G = B ? ze : De, K = B ? H : Oe, q = B ? U : ke, Be = b?.resolved.initResponse, J = !B || !Re && !U && !V && !!C && !H, Y = J ? Be : V ?? void 0, X = J ? B || (b?.initResponseStaleForToken ?? !1) : W, Ve = b === null, He = l(() => Ve ? le({
68
- hasToken: !!C,
69
- loading: H,
70
- error: U,
71
- initResponse: V ?? void 0,
72
- initStaleForToken: W
67
+ O,
68
+ k
69
+ ]), H = C === null || c !== void 0 || l !== void 0, ze = H ? Re : Le.authEpoch, { result: U, loading: W, error: G, clearedForAuthChange: Be, initStaleForToken: K, refetch: Ve } = oe(H ? V : null, H ? E : void 0, z), He = H ? Ve : Ee, Ue = H ? W : De, We = H ? G : Oe, Ge = C?.resolved.initResponse, Ke = !H || !Be && !G && !U && !!E && !W, q = Ke ? Ge : U ?? void 0, J = Ke ? H || (C?.initResponseStaleForToken ?? !1) : K, Y = C === null, qe = h(() => Y ? se({
70
+ hasToken: !!E,
71
+ loading: W,
72
+ error: G,
73
+ initResponse: U ?? void 0,
74
+ initStaleForToken: K
73
75
  }) : null, [
74
- Ve,
75
- C,
76
- H,
76
+ Y,
77
+ E,
78
+ W,
79
+ G,
77
80
  U,
78
- V,
79
- W
81
+ K
80
82
  ]);
81
- ue(He, C);
82
- let Z = oe(w, X ? void 0 : Y?.organizationId), Q = l(() => ({
83
- enabled: M,
84
- organizationId: Z,
85
- rootCorrelationId: N,
86
- widgetName: P,
87
- widgetInstanceId: F
83
+ ce(qe, E);
84
+ let X = ie(D, J ? void 0 : q?.organizationId), Z = h(() => ({
85
+ enabled: F,
86
+ organizationId: X,
87
+ rootCorrelationId: I,
88
+ widgetName: L,
89
+ widgetInstanceId: R
88
90
  }), [
89
- M,
90
- Z,
91
- N,
92
- P,
93
- F
91
+ F,
92
+ X,
93
+ I,
94
+ L,
95
+ R
94
96
  ]);
95
- I.current = Q;
96
- let [$] = d(() => b === null ? new be({ defaultOptions: {
97
+ z.current = Z;
98
+ let [Q] = _(() => C === null ? new ve({ defaultOptions: {
97
99
  queries: {
98
100
  retry: !1,
99
101
  refetchOnWindowFocus: !1
100
102
  },
101
103
  mutations: { retry: !1 }
102
104
  } }) : null);
103
- c(() => {
104
- if (!$) return;
105
- let n = $;
105
+ m(() => {
106
+ if (!Q) return;
107
+ let n = Q;
106
108
  return e(n), () => t(n);
107
- }, [$]);
108
- let Ue = l(() => ({
109
- baseUrl: a,
110
- widgetToken: o,
111
- organizationId: s,
112
- configClient: p,
113
- gatewayRouting: m,
114
- linkComponent: h,
115
- uiFramework: g,
116
- implementation: _
109
+ }, [Q]);
110
+ let Je = h(() => ({
111
+ baseUrl: c,
112
+ widgetToken: l,
113
+ organizationId: u,
114
+ configClient: d,
115
+ gatewayRouting: f,
116
+ linkComponent: p,
117
+ uiFramework: y,
118
+ implementation: b
117
119
  }), [
118
- a,
119
- o,
120
- s,
120
+ c,
121
+ l,
122
+ u,
123
+ d,
124
+ f,
121
125
  p,
122
- m,
123
- h,
124
- g,
125
- _
126
- ]), We = l(() => ({
127
- baseUrl: S,
128
- widgetToken: C,
129
- organizationId: Z,
130
- configClient: T,
131
- gatewayRouting: E,
132
- linkComponent: D,
133
- uiFramework: O,
134
- implementation: k,
135
- initResponse: Y
126
+ y,
127
+ b
128
+ ]), Ye = h(() => ({
129
+ baseUrl: T,
130
+ widgetToken: E,
131
+ organizationId: X,
132
+ configClient: O,
133
+ gatewayRouting: k,
134
+ linkComponent: A,
135
+ uiFramework: j,
136
+ implementation: Ae,
137
+ initResponse: q
136
138
  }), [
137
- S,
138
- C,
139
- Z,
140
139
  T,
141
140
  E,
142
- D,
141
+ X,
143
142
  O,
144
143
  k,
145
- Y
146
- ]), Ge = l(() => ({
147
- resolved: We,
148
- own: Ue,
149
- refetch: G,
150
- loading: K,
151
- error: q,
152
- analytics: Q,
153
- cascadeOrgId: w,
154
- initResponseStaleForToken: X,
155
- disclosuresAcceptance: A
144
+ A,
145
+ j,
146
+ Ae,
147
+ q
148
+ ]), Xe = h(() => ({
149
+ resolved: Ye,
150
+ own: Je,
151
+ refetch: He,
152
+ loading: Ue,
153
+ error: We,
154
+ analytics: Z,
155
+ cascadeOrgId: D,
156
+ initResponseStaleForToken: J,
157
+ disclosuresAcceptance: M,
158
+ providerLabels: N
156
159
  }), [
157
- We,
160
+ Ye,
161
+ Je,
162
+ He,
158
163
  Ue,
159
- G,
160
- K,
161
- q,
162
- Q,
163
- w,
164
- X,
165
- A
166
- ]), Ke = /* @__PURE__ */ f(i.Provider, {
167
- value: Ge,
168
- children: /* @__PURE__ */ f(fe, {
169
- linkComponent: D,
170
- uiFramework: O,
171
- children: /* @__PURE__ */ f(he, { children: /* @__PURE__ */ f(ge, {
172
- resetKeys: [C],
173
- errorFallback: Ce,
174
- onError: we,
175
- children: _e(Y, y) ? /* @__PURE__ */ f(Se, {
176
- disclosuresAcceptance: A,
177
- initStaleForToken: X
178
- }) : me
164
+ We,
165
+ Z,
166
+ D,
167
+ J,
168
+ M,
169
+ N
170
+ ]), Ze = /* @__PURE__ */ v(ne.Provider, {
171
+ value: Xe,
172
+ children: /* @__PURE__ */ v(ue, {
173
+ linkComponent: A,
174
+ uiFramework: j,
175
+ children: /* @__PURE__ */ v(fe, { children: /* @__PURE__ */ v(me, {
176
+ resetKeys: [E],
177
+ errorFallback: xe,
178
+ onError: Se,
179
+ labels: je,
180
+ children: he(q, S) ? /* @__PURE__ */ v(be, {
181
+ disclosuresAcceptance: M,
182
+ initStaleForToken: J,
183
+ labels: je
184
+ }) : s
179
185
  }) })
180
186
  })
181
- }), qe = z ? /* @__PURE__ */ f(ee, {
182
- client: z,
183
- organizationId: Z,
184
- widgetToken: C,
185
- authEpoch: Le,
186
- children: Ke
187
- }) : Ke;
188
- return $ ? /* @__PURE__ */ f(xe, {
189
- client: $,
190
- children: qe
191
- }) : qe;
187
+ }), $ = V ? /* @__PURE__ */ v(r, {
188
+ client: V,
189
+ organizationId: X,
190
+ widgetToken: E,
191
+ authEpoch: ze,
192
+ children: Ze
193
+ }) : Ze;
194
+ return Q ? /* @__PURE__ */ v(ye, {
195
+ client: Q,
196
+ children: $
197
+ }) : $;
192
198
  }
193
- function Se({ disclosuresAcceptance: e, initStaleForToken: t }) {
194
- let n = me("error-state") ?? a;
195
- return t ? /* @__PURE__ */ f(n, {
196
- title: o.disclosuresRefreshingTitle,
197
- description: o.disclosuresRefreshingDescription,
198
- testId: s,
199
- 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"
200
- }) : e == null ? /* @__PURE__ */ f(n, {
201
- title: o.disclosuresRequiredTitle,
202
- testId: s,
199
+ function be({ disclosuresAcceptance: e, initStaleForToken: t, labels: n }) {
200
+ let r = c("error-state") ?? l, i = u(), a = f(e), o = p({
201
+ initStaleForToken: t,
202
+ hasAcceptanceSurface: a
203
+ });
204
+ return m(() => {
205
+ i(s.WidgetDisclosuresBlocked, { reason: o }), console.info(`[disclosures] widget blocked: ${o}`);
206
+ }, [o, i]), t ? /* @__PURE__ */ v(r, {
207
+ title: n.disclosuresRefreshingTitle,
208
+ description: n.disclosuresRefreshingDescription,
209
+ testId: d,
203
210
  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"
204
- }) : /* @__PURE__ */ f("div", {
205
- "data-testid": s,
211
+ }) : a ? /* @__PURE__ */ v("div", {
212
+ "data-testid": d,
206
213
  className: "ttw:w-full",
207
214
  children: e
215
+ }) : /* @__PURE__ */ v(r, {
216
+ title: n.disclosuresRequiredTitle,
217
+ testId: d,
218
+ 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"
208
219
  });
209
220
  }
210
221
  //#endregion
211
- export { p as WidgetProvider, p as default };
222
+ export { y as WidgetProvider, y as default };
@@ -13,5 +13,16 @@ function r(e) {
13
13
  function i(e, t) {
14
14
  return t !== void 0 && n(e) && !r(t);
15
15
  }
16
+ function a(e) {
17
+ return e != null && typeof e != "boolean" && e !== "";
18
+ }
19
+ var o = {
20
+ AcceptanceSurfaceShown: "acceptance_surface_shown",
21
+ NoAcceptanceSurface: "no_acceptance_surface",
22
+ InitStaleForToken: "init_stale_for_token"
23
+ };
24
+ function s({ initStaleForToken: e, hasAcceptanceSurface: t }) {
25
+ return e ? o.InitStaleForToken : t ? o.AcceptanceSurfaceShown : o.NoAcceptanceSurface;
26
+ }
16
27
  //#endregion
17
- export { e as DISCLOSURES_REQUIRED_TEST_ID, n as isDisclosuresAcceptanceRequired, r as isDisclosuresGateExempt, i as shouldGateOnDisclosuresAcceptance };
28
+ export { e as DISCLOSURES_REQUIRED_TEST_ID, o as DisclosuresBlockedReason, a as hasRenderableAcceptanceSurface, n as isDisclosuresAcceptanceRequired, r as isDisclosuresGateExempt, s as resolveDisclosuresBlockedReason, i as shouldGateOnDisclosuresAcceptance };