@tesouro/embedded-components-react 0.2.267 → 0.2.270

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 (66) hide show
  1. package/README.md +15 -12
  2. package/dist/experimental/WidgetSuite.d.ts +25 -1
  3. package/dist/experimental/index.d.ts +25 -1
  4. package/dist/index.css +3 -0
  5. package/dist/index.d.ts +46 -22
  6. package/dist/lib/AcceptDisclosuresWidget.d.ts +25 -1
  7. package/dist/lib/BalancesWidget.d.ts +24 -0
  8. package/dist/lib/BankAccountOnboardingWidget.d.ts +25 -1
  9. package/dist/lib/BankAccountsWidget.d.ts +25 -1
  10. package/dist/lib/BillPayWidget.d.ts +24 -0
  11. package/dist/lib/CardDetailsWidget.d.ts +25 -1
  12. package/dist/lib/CardsWidget.d.ts +25 -1
  13. package/dist/lib/ChartOfAccountsWidget.d.ts +25 -1
  14. package/dist/lib/CounterpartsWidget.d.ts +25 -1
  15. package/dist/lib/CreateCardWidget.d.ts +25 -1
  16. package/dist/lib/ExpenseApprovalPoliciesWidget.d.ts +25 -1
  17. package/dist/lib/ExpenseManagementWidget.d.ts +25 -1
  18. package/dist/lib/ExpenseRequirementsWidget.d.ts +25 -1
  19. package/dist/lib/HelpWidget.d.ts +25 -1
  20. package/dist/lib/InsightsWidget.d.ts +24 -0
  21. package/dist/lib/InvoicingWidget.d.ts +25 -1
  22. package/dist/lib/LinkedAccountsWidget.d.ts +25 -1
  23. package/dist/lib/ProductsWidget.d.ts +25 -1
  24. package/dist/lib/ProfileWidget.d.ts +25 -1
  25. package/dist/lib/ReceiptMatchWidget.d.ts +25 -1
  26. package/dist/lib/ReceivablesWidget.d.ts +25 -1
  27. package/dist/lib/SettingsWidget.d.ts +25 -1
  28. package/dist/lib/TagsWidget.d.ts +25 -1
  29. package/dist/lib/TeamWidget.d.ts +25 -1
  30. package/dist/lib/TransfersWidget.d.ts +24 -0
  31. package/dist/lib/WidgetProvider.d.ts +25 -1
  32. package/dist/lib/WidgetProviderPublic.d.ts +24 -0
  33. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +9 -8
  34. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +122 -121
  35. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +9 -8
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +11 -10
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +9 -8
  38. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +9 -8
  39. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +1 -1
  40. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +9 -8
  41. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +1 -1
  42. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListDetailsSheet.js +1 -1
  43. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +9 -8
  44. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +94 -93
  45. package/dist/libs/tesouro-embedded-components-react/expense-approval-policies-widget/feature/dist/lib/ExpenseApprovalPoliciesWidgetFeature.js +7 -6
  46. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index3.js +9 -8
  47. package/dist/libs/tesouro-embedded-components-react/expense-receipt-match-widget/feature/dist/lib/ReceiptMatchWidget.js +12 -11
  48. package/dist/libs/tesouro-embedded-components-react/expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js +7 -6
  49. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index8.js +9 -8
  50. package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index3.js +9 -8
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +9 -8
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js +10 -9
  53. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +9 -8
  54. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +9 -8
  55. package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +9 -8
  56. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +10 -9
  57. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +22 -21
  58. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/widgetGatewayHosts.js +14 -0
  59. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +76 -67
  60. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +107 -101
  61. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  62. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/client.js +12 -4
  63. package/dist/libs/tesouro-embedded-components-react/tags-widget/feature/dist/index11.js +9 -8
  64. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index17.js +106 -105
  65. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +9 -8
  66. package/package.json +1 -1
@@ -2,14 +2,14 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { registerQueryClient as e, unregisterQueryClient as t } from "../../../../data-access/dist/lib/clientRegistry.js";
6
- import { createEmbeddedClient as n } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
7
- import { EmbedApiProvider as ee, useEmbedApi as te } from "../../../../data-access/dist/lib/EmbedApiContext.js";
5
+ import { registerQueryClient as e, unregisterQueryClient as ee } from "../../../../data-access/dist/lib/clientRegistry.js";
6
+ import { createEmbeddedClient as t } from "../../../../data-access/dist/lib/createEmbeddedClient.js";
7
+ import { EmbedApiProvider as te, useEmbedApi as ne } from "../../../../data-access/dist/lib/EmbedApiContext.js";
8
8
  import "../../../../data-access/dist/index.js";
9
- import { getGlobalSnapshot as r, subscribeToGlobal as ne } from "./globalStore.js";
10
- import { configureEmbeddedClient as re } from "../analytics/client.js";
11
- import { generateCorrelationId as i } from "../analytics/ids.js";
12
- import { WidgetContext as ie } from "./WidgetContext.js";
9
+ import { getGlobalSnapshot as n, 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
13
  import { noop as ae, resolveOrgId as oe, useAuthEpoch as se } from "./utils.js";
14
14
  import { useWidgetFetch as ce } from "./useWidgetFetch.js";
15
15
  import { deriveWidgetInitState as le, useWidgetInitPublisher as ue } from "./useWidgetInitPublisher.js";
@@ -23,72 +23,74 @@ import { useContext as ge, useEffect as a, useMemo as o, useRef as s, useState a
23
23
  import { jsx as l } from "react/jsx-runtime";
24
24
  import { QueryClient as ve, QueryClientProvider as ye } from "@tanstack/react-query";
25
25
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js
26
- function u({ children: u, baseUrl: d, widgetToken: f, organizationId: p, configClient: m, linkComponent: h, uiFramework: g, implementation: _, errorFallback: be, onError: xe, analytics: v, widgetName: y }) {
27
- let b = ge(ie), Se = _e(ne, r, r), x = b?.resolved ?? Se, Ce = b?.refetch ?? ae, we = b?.loading ?? !1, Te = b?.error ?? null, S = d ?? x.baseUrl, C = f === void 0 ? x.widgetToken : f, Ee = b ? b.cascadeOrgId : Se.organizationId, w = p === void 0 ? Ee : p, T = m ?? x.configClient, E = h ?? x.linkComponent, D = g ?? x.uiFramework, O = _ ?? x.implementation, k = b === null, A = k ? v !== !1 : b.analytics.enabled, [De] = c(i), j = k ? De : b.analytics.rootCorrelationId, [Oe] = c(i), M = y === void 0 ? b?.analytics.widgetName : y, N = y === void 0 ? b?.analytics.widgetInstanceId : Oe, P = s({
28
- enabled: A,
29
- organizationId: w,
30
- rootCorrelationId: j,
31
- widgetName: M,
32
- widgetInstanceId: N
33
- }), F = s(!1);
26
+ function u({ children: u, baseUrl: d, widgetToken: f, organizationId: p, configClient: m, gatewayRouting: h, linkComponent: g, uiFramework: _, implementation: v, errorFallback: be, onError: xe, analytics: y, widgetName: b }) {
27
+ let x = ge(i), Se = _e(re, n, n), S = x?.resolved ?? Se, Ce = x?.refetch ?? ae, we = x?.loading ?? !1, Te = x?.error ?? null, C = d ?? S.baseUrl, w = f === void 0 ? S.widgetToken : f, Ee = x ? x.cascadeOrgId : Se.organizationId, T = p === void 0 ? Ee : p, E = m ?? S.configClient, D = h ?? S.gatewayRouting, O = g ?? S.linkComponent, k = _ ?? S.uiFramework, A = v ?? S.implementation, j = x === null, M = j ? y !== !1 : x.analytics.enabled, [De] = c(r), N = j ? De : x.analytics.rootCorrelationId, [Oe] = c(r), P = b === void 0 ? x?.analytics.widgetName : b, F = b === void 0 ? x?.analytics.widgetInstanceId : Oe, I = s({
28
+ enabled: M,
29
+ organizationId: T,
30
+ rootCorrelationId: N,
31
+ widgetName: P,
32
+ widgetInstanceId: F
33
+ }), L = s(!1);
34
34
  a(() => {
35
- k || v === void 0 || F.current || (F.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."));
36
- }, [v, k]), a(() => {
37
- if (!k || !A || !("window" in globalThis)) return;
35
+ j || y === void 0 || L.current || (L.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."));
36
+ }, [y, j]), a(() => {
37
+ if (!j || !M || !("window" in globalThis)) return;
38
38
  let e = !1;
39
- return import("../analytics/install.js").then(({ ensureAnalyticsAdapterInstalled: t }) => {
40
- e || t();
39
+ return import("../analytics/install.js").then(({ ensureAnalyticsAdapterInstalled: ee }) => {
40
+ e || ee();
41
41
  }), () => {
42
42
  e = !0;
43
43
  };
44
- }, [k, A]);
45
- let I = pe(de(D));
44
+ }, [j, M]);
45
+ let R = pe(de(k));
46
46
  a(() => {
47
- I && I().catch(() => {});
48
- }, [I]);
49
- let L = b === null || d !== void 0 || f !== void 0 || p !== void 0 || m != null || y !== void 0, R = s(C);
50
- R.current = C;
51
- let ke = te(), Ae = se(C), z = o(() => {
52
- if (!L) return null;
53
- let e = re(n(S), {
54
- tokenRef: R,
55
- analyticsContextRef: P
47
+ R && R().catch(() => {});
48
+ }, [R]);
49
+ let z = x === null || d !== void 0 || f !== void 0 || p !== void 0 || m != null || h !== void 0 || b !== void 0, B = s(w);
50
+ B.current = w;
51
+ let ke = ne(), Ae = se(w), V = o(() => {
52
+ if (!z) return null;
53
+ let e = ie(t(C), {
54
+ tokenRef: B,
55
+ analyticsContextRef: I,
56
+ gatewayRouting: D
56
57
  });
57
- return T ? T(e) : e;
58
+ return E ? E(e) : e;
58
59
  }, [
59
- L,
60
- S,
61
- T
62
- ]), B = b === null || d !== void 0 || f !== void 0, je = B ? Ae : ke.authEpoch, { result: V, loading: H, error: U, clearedForAuthChange: Me, initStaleForToken: W, refetch: Ne } = ce(B ? z : null, B ? C : void 0, P), G = B ? Ne : Ce, K = B ? H : we, q = B ? U : Te, Pe = b?.resolved.initResponse, Fe = !B || !Me && !U && !V && !!C && !H, J = Fe ? Pe : V ?? void 0, Y = Fe ? B || (b?.initResponseStaleForToken ?? !1) : W, Ie = b === null, Le = o(() => Ie ? le({
63
- hasToken: !!C,
64
- loading: H,
65
- error: U,
66
- initResponse: V ?? void 0,
67
- initStaleForToken: W
68
- }) : null, [
69
- Ie,
60
+ z,
70
61
  C,
71
- H,
62
+ E,
63
+ D
64
+ ]), H = x === null || d !== void 0 || f !== void 0, je = H ? Ae : ke.authEpoch, { result: U, loading: W, error: G, clearedForAuthChange: Me, initStaleForToken: K, refetch: Ne } = ce(H ? V : null, H ? w : void 0, I), Pe = H ? Ne : Ce, Fe = H ? W : we, Ie = H ? G : Te, Le = x?.resolved.initResponse, Re = !H || !Me && !G && !U && !!w && !W, q = Re ? Le : U ?? void 0, J = Re ? H || (x?.initResponseStaleForToken ?? !1) : K, Y = x === null, ze = o(() => Y ? le({
65
+ hasToken: !!w,
66
+ loading: W,
67
+ error: G,
68
+ initResponse: U ?? void 0,
69
+ initStaleForToken: K
70
+ }) : null, [
71
+ Y,
72
+ w,
73
+ W,
74
+ G,
72
75
  U,
73
- V,
74
- W
76
+ K
75
77
  ]);
76
- ue(Le, C);
77
- let X = oe(w, Y ? void 0 : J?.organizationId), Z = o(() => ({
78
- enabled: A,
78
+ ue(ze, w);
79
+ let X = oe(T, J ? void 0 : q?.organizationId), Z = o(() => ({
80
+ enabled: M,
79
81
  organizationId: X,
80
- rootCorrelationId: j,
81
- widgetName: M,
82
- widgetInstanceId: N
82
+ rootCorrelationId: N,
83
+ widgetName: P,
84
+ widgetInstanceId: F
83
85
  }), [
84
- A,
85
- X,
86
- j,
87
86
  M,
88
- N
87
+ X,
88
+ N,
89
+ P,
90
+ F
89
91
  ]);
90
- P.current = Z;
91
- let [Q] = c(() => b === null ? new ve({ defaultOptions: {
92
+ I.current = Z;
93
+ let [Q] = c(() => x === null ? new ve({ defaultOptions: {
92
94
  queries: {
93
95
  retry: !1,
94
96
  refetchOnWindowFocus: !1
@@ -97,17 +99,18 @@ function u({ children: u, baseUrl: d, widgetToken: f, organizationId: p, configC
97
99
  } }) : null);
98
100
  a(() => {
99
101
  if (!Q) return;
100
- let n = Q;
101
- return e(n), () => t(n);
102
+ let t = Q;
103
+ return e(t), () => ee(t);
102
104
  }, [Q]);
103
- let Re = o(() => ({
105
+ let Be = o(() => ({
104
106
  baseUrl: d,
105
107
  widgetToken: f,
106
108
  organizationId: p,
107
109
  configClient: m,
108
- linkComponent: h,
109
- uiFramework: g,
110
- implementation: _
110
+ gatewayRouting: h,
111
+ linkComponent: g,
112
+ uiFramework: _,
113
+ implementation: v
111
114
  }), [
112
115
  d,
113
116
  f,
@@ -115,62 +118,65 @@ function u({ children: u, baseUrl: d, widgetToken: f, organizationId: p, configC
115
118
  m,
116
119
  h,
117
120
  g,
118
- _
119
- ]), ze = o(() => ({
120
- baseUrl: S,
121
- widgetToken: C,
121
+ _,
122
+ v
123
+ ]), Ve = o(() => ({
124
+ baseUrl: C,
125
+ widgetToken: w,
122
126
  organizationId: X,
123
- configClient: T,
124
- linkComponent: E,
125
- uiFramework: D,
126
- implementation: O,
127
- initResponse: J
127
+ configClient: E,
128
+ gatewayRouting: D,
129
+ linkComponent: O,
130
+ uiFramework: k,
131
+ implementation: A,
132
+ initResponse: q
128
133
  }), [
129
- S,
130
134
  C,
135
+ w,
131
136
  X,
132
- T,
133
137
  E,
134
138
  D,
135
139
  O,
136
- J
137
- ]), Be = o(() => ({
138
- resolved: ze,
139
- own: Re,
140
- refetch: G,
141
- loading: K,
142
- error: q,
140
+ k,
141
+ A,
142
+ q
143
+ ]), He = o(() => ({
144
+ resolved: Ve,
145
+ own: Be,
146
+ refetch: Pe,
147
+ loading: Fe,
148
+ error: Ie,
143
149
  analytics: Z,
144
- cascadeOrgId: w,
145
- initResponseStaleForToken: Y
150
+ cascadeOrgId: T,
151
+ initResponseStaleForToken: J
146
152
  }), [
147
- ze,
148
- Re,
149
- G,
150
- K,
151
- q,
153
+ Ve,
154
+ Be,
155
+ Pe,
156
+ Fe,
157
+ Ie,
152
158
  Z,
153
- w,
154
- Y
155
- ]), Ve = /* @__PURE__ */ l(ie.Provider, {
156
- value: Be,
159
+ T,
160
+ J
161
+ ]), Ue = /* @__PURE__ */ l(i.Provider, {
162
+ value: He,
157
163
  children: /* @__PURE__ */ l(fe, {
158
- linkComponent: E,
159
- uiFramework: D,
164
+ linkComponent: O,
165
+ uiFramework: k,
160
166
  children: /* @__PURE__ */ l(me, { children: /* @__PURE__ */ l(he, {
161
- resetKeys: [C],
167
+ resetKeys: [w],
162
168
  errorFallback: be,
163
169
  onError: xe,
164
170
  children: u
165
171
  }) })
166
172
  })
167
- }), $ = z ? /* @__PURE__ */ l(ee, {
168
- client: z,
173
+ }), $ = V ? /* @__PURE__ */ l(te, {
174
+ client: V,
169
175
  organizationId: X,
170
- widgetToken: C,
176
+ widgetToken: w,
171
177
  authEpoch: je,
172
- children: Ve
173
- }) : Ve;
178
+ children: Ue
179
+ }) : Ue;
174
180
  return Q ? /* @__PURE__ */ l(ye, {
175
181
  client: Q,
176
182
  children: $
@@ -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.2.267", n = "ffc9d042b2bcd9bb009f185e224c044803586799", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.2.270", n = "6bf6a363553cdcc2d4ec7362b4f41707e7a20462", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -1,7 +1,15 @@
1
- import { attachAnalyticsInterceptors as e } from "./interceptor.js";
1
+ import { isWidgetGatewayHost as e } from "../../../../data-access/dist/lib/widgetGatewayHosts.js";
2
+ import "../../../../data-access/dist/index.js";
3
+ import { attachAnalyticsInterceptors as t } from "./interceptor.js";
2
4
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/client.js
3
- function t(t, { tokenRef: n, analyticsContextRef: r }) {
4
- return t.interceptors.request.use((e) => (e.headers.has("X-Client-Secret") ? (e.headers.delete("Authorization"), n.current && e.headers.set("X-Widget-Token", n.current)) : n.current && e.headers.set("Authorization", `Bearer ${n.current}`), e)), e(t, r), t;
5
+ function n(n, { tokenRef: r, analyticsContextRef: i, gatewayRouting: a }) {
6
+ return n.interceptors.request.use((e) => (e.headers.has("X-Client-Secret") ? (e.headers.delete("Authorization"), r.current && e.headers.set("X-Widget-Token", r.current)) : r.current && e.headers.set("Authorization", `Bearer ${r.current}`), e)), a !== !1 && n.interceptors.request.use((t) => {
7
+ let n = new URL(t.url);
8
+ if (n.pathname.startsWith("/api/widget-gateway") || !(a ?? e(n.origin))) return t;
9
+ n.pathname = "/api/widget-gateway/proxy" + n.pathname;
10
+ let i = new Request(n.toString(), t);
11
+ return r.current && i.headers.set("X-Widget-Token", r.current), i;
12
+ }), t(n, i), n;
5
13
  }
6
14
  //#endregion
7
- export { t as configureEmbeddedClient };
15
+ export { n as configureEmbeddedClient };
@@ -72,20 +72,21 @@ function p({ pageSizeOptions: t = i, screenLabels: r, formLabels: p, deleteLabel
72
72
  })
73
73
  ] });
74
74
  }
75
- function m({ baseUrl: e, widgetToken: n, organizationId: i, configClient: a, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: f, ...m }) {
75
+ function m({ baseUrl: e, widgetToken: n, organizationId: i, configClient: a, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: f, analytics: m, ...h }) {
76
76
  return /* @__PURE__ */ d(t, {
77
77
  widgetName: r,
78
78
  baseUrl: e,
79
79
  widgetToken: n,
80
80
  organizationId: i,
81
81
  configClient: a,
82
- linkComponent: o,
83
- implementation: s,
84
- uiFramework: c,
85
- errorFallback: l,
86
- onError: u,
87
- analytics: f,
88
- children: /* @__PURE__ */ d(p, { ...m })
82
+ gatewayRouting: o,
83
+ linkComponent: s,
84
+ implementation: c,
85
+ uiFramework: l,
86
+ errorFallback: u,
87
+ onError: f,
88
+ analytics: m,
89
+ children: /* @__PURE__ */ d(p, { ...h })
89
90
  });
90
91
  }
91
92
  //#endregion