@tesouro/embedded-components-react 0.5.128 → 0.5.129

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.
@@ -16,7 +16,7 @@ function a({ enabled: a, ...o } = {}) {
16
16
  headers: r(c)
17
17
  });
18
18
  return i({
19
- ...t(d, u),
19
+ ...t(d, u, { carryWithinOrg: !0 }),
20
20
  enabled: !!(c && l) && (a === !0 || a === void 0)
21
21
  });
22
22
  }
@@ -16,7 +16,7 @@ function a({ enabled: a, ...o } = {}) {
16
16
  headers: r(c)
17
17
  });
18
18
  return i({
19
- ...t(d, u),
19
+ ...t(d, u, { carryWithinOrg: !0 }),
20
20
  enabled: !!(c && l) && (a === !0 || a === void 0)
21
21
  });
22
22
  }
@@ -15,7 +15,7 @@ function i({ enabled: i, ...a } = {}) {
15
15
  headers: { "x-organization-id": s ?? "" }
16
16
  });
17
17
  return r({
18
- ...t(d, l),
18
+ ...t(d, l, { carryWithinOrg: !0 }),
19
19
  enabled: u
20
20
  });
21
21
  }
@@ -16,7 +16,7 @@ function l({ enabled: e, ...t } = {}) {
16
16
  query: t
17
17
  });
18
18
  return c({
19
- ...a(f, u),
19
+ ...a(f, u, { carryWithinOrg: !0 }),
20
20
  enabled: d
21
21
  });
22
22
  }
@@ -16,7 +16,7 @@ function a({ enabled: a, ...o } = {}) {
16
16
  headers: r(c)
17
17
  });
18
18
  return i({
19
- ...t(d, u),
19
+ ...t(d, u, { carryWithinOrg: !0 }),
20
20
  enabled: !!(c && l) && (a === !0 || a === void 0)
21
21
  });
22
22
  }
@@ -19,7 +19,7 @@ function p({ enabled: e, ...t } = {}) {
19
19
  headers: c(r)
20
20
  });
21
21
  return f({
22
- ...a(d, l),
22
+ ...a(d, l, { carryWithinOrg: !0 }),
23
23
  enabled: u
24
24
  });
25
25
  }
@@ -7,12 +7,15 @@ function i({ client: t }) {
7
7
  return e({ client: t }).queryKey;
8
8
  }
9
9
  function a({ client: i, widgetToken: a, authEpoch: o }) {
10
- let { queryFn: s, queryKey: c } = e({ client: i });
10
+ let { queryFn: s, queryKey: c } = e({ client: i }), { placeholderData: l } = t({ queryKey: c }, o);
11
11
  return {
12
- ...t({
13
- queryKey: [c[0], { widgetTokenId: n(a) }],
14
- queryFn: s
15
- }, o),
12
+ queryKey: [
13
+ c[0],
14
+ { authEpoch: o },
15
+ { widgetTokenId: n(a) }
16
+ ],
17
+ queryFn: s,
18
+ placeholderData: l,
16
19
  retry: 2,
17
20
  retryDelay: 300,
18
21
  staleTime: r
@@ -4,7 +4,7 @@
4
4
  "use client";
5
5
  import { getBankAccounts as e } from "../rest/sdk.gen.js";
6
6
  import { getBankAccountsOptions as t } from "../rest/@tanstack/react-query.gen.js";
7
- import { useAuthEpochPlaceholder as n } from "../withAuthEpoch.js";
7
+ import { authEpochPlaceholder as n } from "../withAuthEpoch.js";
8
8
  import { useEmbedApi as r } from "../EmbedApiContext.js";
9
9
  import { organizationHeaders as i } from "../organizationHeaders.js";
10
10
  import { getAllPagesNextPageParam as a, useAutoFetchNextPage as o } from "../allPages.js";
@@ -17,9 +17,9 @@ function u({ enabled: u } = {}) {
17
17
  client: d,
18
18
  headers: h,
19
19
  query: { limit: l }
20
- }).queryKey, "all"], v = n(f ? _ : void 0), y = c({
20
+ }).queryKey, "all"], v = c({
21
21
  queryKey: [..._, { authEpoch: m }],
22
- placeholderData: v,
22
+ placeholderData: n(_),
23
23
  enabled: g,
24
24
  initialPageParam: void 0,
25
25
  queryFn: async ({ signal: t, pageParam: n }) => {
@@ -37,17 +37,17 @@ function u({ enabled: u } = {}) {
37
37
  },
38
38
  getNextPageParam: a
39
39
  });
40
- o(y, g);
41
- let b = s(() => {
42
- if (y.data) return {
43
- data: y.data.pages.flatMap((e) => e.data ?? []),
40
+ o(v, g);
41
+ let y = s(() => {
42
+ if (v.data) return {
43
+ data: v.data.pages.flatMap((e) => e.data ?? []),
44
44
  nextPaginationToken: null,
45
45
  prevPaginationToken: null
46
46
  };
47
- }, [y.data]);
47
+ }, [v.data]);
48
48
  return {
49
- ...y,
50
- data: b
49
+ ...v,
50
+ data: y
51
51
  };
52
52
  }
53
53
  //#endregion
@@ -12,44 +12,34 @@ function i(e) {
12
12
  for (let n = 0; n < e.length; n += 1) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
13
13
  return (t >>> 0).toString(16);
14
14
  }
15
- function a(e, t) {
16
- return JSON.stringify(e.slice(0, -1)) === JSON.stringify(t);
17
- }
18
- var o = [];
19
- function s(e, t) {
20
- if (e !== void 0 && t !== void 0 && a(t.queryKey, o)) return e;
21
- }
22
- function c({ invitationToken: a, userId: c, enabled: l } = {}) {
23
- let { client: u, widgetToken: d, authEpoch: f } = n(), p = a && c ? {
15
+ function a({ invitationToken: a, userId: o, enabled: s } = {}) {
16
+ let { client: c, widgetToken: l, authEpoch: u } = n(), d = a && o ? {
24
17
  invitationToken: a,
25
- userId: c
26
- } : void 0, m = async ({ signal: t }) => {
18
+ userId: o
19
+ } : void 0, f = async ({ signal: t }) => {
27
20
  let { data: n } = await e({
28
- client: u,
29
- headers: { "X-Widget-Token": d ?? "" },
30
- ...p ? { query: p } : {},
21
+ client: c,
22
+ headers: { "X-Widget-Token": l ?? "" },
23
+ ...d ? { query: d } : {},
31
24
  signal: t,
32
25
  throwOnError: !0
33
26
  });
34
27
  if (!n) throw Error("Unexpected disclosures response from widget gateway");
35
28
  return n;
36
- }, h = ["getDisclosures", {
37
- baseUrl: u.getConfig().baseUrl,
38
- ...c ? { userId: c } : {},
39
- ...p ? { invitationTokenFingerprint: i(p.invitationToken) } : {}
40
- }];
41
- o = h;
42
- let { queryKey: g } = t({
43
- queryKey: h,
44
- queryFn: m,
45
- placeholderData: void 0
46
- }, f);
29
+ }, p = ["getDisclosures", {
30
+ baseUrl: c.getConfig().baseUrl,
31
+ ...o ? { userId: o } : {},
32
+ ...d ? { invitationTokenFingerprint: i(d.invitationToken) } : {}
33
+ }], { queryKey: m, placeholderData: h } = t({
34
+ queryKey: p,
35
+ queryFn: f
36
+ }, u);
47
37
  return r({
48
- queryKey: g,
49
- queryFn: m,
50
- placeholderData: s,
51
- enabled: !!d && (l === !0 || l === void 0)
38
+ queryKey: m,
39
+ queryFn: f,
40
+ placeholderData: h,
41
+ enabled: !!l && (s === !0 || s === void 0)
52
42
  });
53
43
  }
54
44
  //#endregion
55
- export { c as useDisclosuresQuery };
45
+ export { a as useDisclosuresQuery };
@@ -1,16 +1,34 @@
1
- import { useMemo as e } from "react";
2
1
  //#region ../../libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js
3
- var t = (e) => e;
4
- function n(t) {
5
- let n = t && JSON.stringify(t);
6
- return e(() => (e, t) => n === void 0 || t && JSON.stringify(t.queryKey.slice(0, -1)) === n ? e : void 0, [n]);
2
+ var e = "x-organization-id", t = (e) => typeof e == "object" && !!e && !Array.isArray(e), n = (n) => t(n.headers) ? n.headers[e] : void 0, r = ([n, ...r]) => {
3
+ if (!t(n) || !t(n.headers)) return [n, ...r];
4
+ let i = { ...n.headers };
5
+ return delete i[e], [{
6
+ ...n,
7
+ headers: i
8
+ }, ...r];
9
+ }, i = (e) => JSON.stringify(e, (e, n) => t(n) ? Object.fromEntries(Object.keys(n).sort().map((e) => [e, n[e]])) : n);
10
+ function a(e, a, o) {
11
+ let s = o ? r(e) : e, [c] = s;
12
+ return i(a && t(c) ? [c.baseUrl, n(c)] : s);
7
13
  }
8
- function r(e, n) {
14
+ function o(n) {
15
+ let [r] = n;
16
+ return t(r) && t(r.headers) && e in r.headers && !r.headers[e];
17
+ }
18
+ var s = /* @__PURE__ */ new Map(), c = 500;
19
+ function l(e, t) {
20
+ let n = o(e), r = a(e, t, n), i = `${t}:${n}:${e.length}:${r}`, l = s.get(i);
21
+ if (l) return s.delete(i), s.set(i, l), l;
22
+ let u = (i, o) => o && a(o.queryKey.slice(0, e.length), t, n) === r ? i : void 0;
23
+ return s.size >= c && s.delete(s.keys().next().value), s.set(i, u), u;
24
+ }
25
+ var u = (e) => l(e, !1);
26
+ function d(e, t, { carryWithinOrg: n = !1 } = {}) {
9
27
  return {
10
- placeholderData: t,
28
+ placeholderData: l(e.queryKey, n),
11
29
  ...e,
12
- queryKey: [...e.queryKey, { authEpoch: n }]
30
+ queryKey: [...e.queryKey, { authEpoch: t }]
13
31
  };
14
32
  }
15
33
  //#endregion
16
- export { n as useAuthEpochPlaceholder, r as withAuthEpoch };
34
+ export { u as authEpochPlaceholder, d as withAuthEpoch };
@@ -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.128", n = "6c38915889a61343c6db7abd8a772c5eb25831fe", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.129", n = "be19c976cefc2e40777e2dfb87a8b3cd2a50caa8", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -16,7 +16,7 @@ function a({ enabled: a, ...o } = {}) {
16
16
  headers: r(c)
17
17
  });
18
18
  return i({
19
- ...t(f, u),
19
+ ...t(f, u, { carryWithinOrg: !0 }),
20
20
  enabled: d
21
21
  });
22
22
  }
@@ -16,7 +16,7 @@ function a({ enabled: a, ...o } = {}) {
16
16
  headers: r(c)
17
17
  });
18
18
  return i({
19
- ...t(f, u),
19
+ ...t(f, u, { carryWithinOrg: !0 }),
20
20
  enabled: d
21
21
  });
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.128",
3
+ "version": "0.5.129",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {