@tesouro/embedded-components-react 0.11.240 → 0.11.243

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.
@@ -32,9 +32,16 @@ function c({ emailAddress: c, onCopyEmail: l, onFilesSelected: u, accept: d, max
32
32
  /* @__PURE__ */ o("button", {
33
33
  type: "button",
34
34
  onClick: l,
35
- "aria-label": v.copyEmail,
36
35
  className: "ttw:inline-flex ttw:items-center ttw:gap-1.5 ttw:rounded-md ttw:border ttw:border-input ttw:px-2 ttw:py-1 ttw:align-middle ttw:text-foreground ttw:hover:bg-accent",
37
- children: [c, /* @__PURE__ */ a(s, { className: "ttw:size-3.5 ttw:text-muted-foreground" })]
36
+ children: [
37
+ c,
38
+ " ",
39
+ /* @__PURE__ */ a("span", {
40
+ className: "ttw:sr-only",
41
+ children: v.copyEmail
42
+ }),
43
+ /* @__PURE__ */ a(s, { className: "ttw:size-3.5 ttw:text-muted-foreground" })
44
+ ]
38
45
  }),
39
46
  " ",
40
47
  v.subcopySuffix
@@ -107,7 +107,7 @@ function C({ open: C, onOpenChange: w, step: T, values: E, errors: D, currencySy
107
107
  id: `${x.amount}-error`,
108
108
  message: D?.amount
109
109
  }),
110
- /* @__PURE__ */ y("p", {
110
+ k ? /* @__PURE__ */ y("p", {
111
111
  className: "ttw:text-sm ttw:text-muted-foreground",
112
112
  children: [
113
113
  z.fullAmountDuePrefix,
@@ -120,7 +120,7 @@ function C({ open: C, onOpenChange: w, step: T, values: E, errors: D, currencySy
120
120
  children: k
121
121
  })
122
122
  ]
123
- })
123
+ }) : null
124
124
  ]
125
125
  }),
126
126
  /* @__PURE__ */ y("div", {
@@ -0,0 +1,32 @@
1
+ // ../../libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rateLimitRetry.js
2
+ var e = 1e3, t = /* @__PURE__ */ new Set(["GET", "HEAD"]);
3
+ function n(e) {
4
+ if (e === null) return;
5
+ let t = Number(e);
6
+ return Number.isFinite(t) && t >= 0 ? t : void 0;
7
+ }
8
+ function r(t, r, i = Math.random) {
9
+ let a = n(t.headers.get("retry-after")) ?? n(t.headers.get("x-ratelimit-reset")), o = a === void 0 ? e * r : Math.max(a * 1e3, e);
10
+ return Math.min(o, 5e3) + Math.floor(i() * 250);
11
+ }
12
+ function i(e, t) {
13
+ return new Promise((n, r) => {
14
+ if (t.aborted) {
15
+ r(t.reason);
16
+ return;
17
+ }
18
+ let i = () => {
19
+ clearTimeout(a), r(t.reason);
20
+ }, a = setTimeout(() => {
21
+ t.removeEventListener("abort", i), n();
22
+ }, e);
23
+ t.addEventListener("abort", i, { once: !0 });
24
+ });
25
+ }
26
+ async function a(e, n, { fetch: a, sleep: o = i, random: s }) {
27
+ if (e.status !== 429 || !t.has(n.method.toUpperCase())) return e;
28
+ let c = e;
29
+ for (let e = 1; e <= 2 && c.status === 429; e += 1) await o(r(c, e, s), n.signal), c = await a(n.clone());
30
+ return c;
31
+ }
32
+ export { e as RATE_LIMIT_WINDOW_MS, r as rateLimitRetryDelayMs, a as retryRateLimitedRead };
@@ -1,17 +1,18 @@
1
1
  import { isWidgetGatewayHost as e } from "./widgetGatewayHosts.js";
2
+ import { retryRateLimitedRead as t } from "./rateLimitRetry.js";
2
3
  // ../../libs/tesouro-embedded-components-react/shared/data-access/dist/lib/transportInterceptors.js
3
- function t(t, { tokenRef: n, clientSecretRef: r, gatewayRouting: i }) {
4
- return t.interceptors.request.use((e, t) => {
5
- let i = r?.current;
6
- return i?.appliesTo(t) && e.headers.set("X-Client-Secret", i.clientSecret), 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;
7
- }), i !== !1 && t.interceptors.request.use(async (t) => {
8
- let r = new URL(t.url);
9
- if (r.pathname.startsWith("/api/widget-gateway") || !(i ?? e(r.origin))) return t;
10
- r.pathname = "/api/widget-gateway/proxy" + r.pathname;
11
- let a = t.body ? await t.clone().arrayBuffer() : void 0, o = new Request(r.toString(), {
4
+ function n(n, { tokenRef: r, clientSecretRef: i, gatewayRouting: a }) {
5
+ return n.interceptors.request.use((e, t) => {
6
+ let n = i?.current;
7
+ return n?.appliesTo(t) && e.headers.set("X-Client-Secret", n.clientSecret), 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;
8
+ }), a !== !1 && n.interceptors.request.use(async (t) => {
9
+ let n = new URL(t.url);
10
+ if (n.pathname.startsWith("/api/widget-gateway") || !(a ?? e(n.origin))) return t;
11
+ n.pathname = "/api/widget-gateway/proxy" + n.pathname;
12
+ let i = t.body ? await t.clone().arrayBuffer() : void 0, o = new Request(n.toString(), {
12
13
  method: t.method,
13
14
  headers: t.headers,
14
- body: a,
15
+ body: i,
15
16
  credentials: t.credentials,
16
17
  cache: t.cache,
17
18
  redirect: t.redirect,
@@ -22,7 +23,7 @@ function t(t, { tokenRef: n, clientSecretRef: r, gatewayRouting: i }) {
22
23
  signal: t.signal,
23
24
  mode: t.mode
24
25
  });
25
- return n.current && o.headers.set("X-Widget-Token", n.current), o;
26
- }), t;
26
+ return r.current && o.headers.set("X-Widget-Token", r.current), o;
27
+ }), n.interceptors.response.use((e, n, r) => t(e, n, { fetch: (e) => (r.fetch ?? globalThis.fetch)(e) })), n;
27
28
  }
28
- export { t as attachTransportInterceptors };
29
+ export { n as attachTransportInterceptors };
@@ -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.240", n = "37d076ead717102510bfd257e86c71d36b3a0e3f", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.11.243", n = "0a4c3ac1f5aedefe01af4e648ac4e3b219488a98", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -3,78 +3,79 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { Button as e, Tooltip as t, TooltipContent as n, TooltipProvider as r, TooltipTrigger as i, usePortalContainer as a } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { useState as o } from "react";
7
- import { createPortal as s } from "react-dom";
8
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
- import { ChevronDown as u, ChevronUp as d, X as f } from "lucide-react";
6
+ import { useId as o, useState as s } from "react";
7
+ import { createPortal as c } from "react-dom";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import { ChevronDown as d, ChevronUp as f, X as p } from "lucide-react";
10
10
  // ../../libs/tesouro-embedded-components-react/shared/ui/dist/lib/UploadTray/UploadTray.js
11
- function p({ title: p, listLabel: m, items: h, summary: g, closeLabel: _, collapseLabel: v, expandLabel: y, retryLabel: b, onClose: x }) {
12
- let [S, C] = o(!1), w = a();
13
- return typeof document > "u" ? null : s(/* @__PURE__ */ l("section", {
14
- "aria-label": p,
11
+ function m({ title: m, listLabel: h, items: g, summary: _, closeLabel: v, collapseLabel: y, expandLabel: b, retryLabel: x, onClose: S }) {
12
+ let [C, w] = s(!1), T = o(), E = a();
13
+ return typeof document > "u" ? null : c(/* @__PURE__ */ u("section", {
14
+ "aria-label": m,
15
15
  className: "ttw:fixed ttw:bottom-4 ttw:right-4 ttw:z-50 ttw:flex ttw:max-h-[calc(100dvh-2rem)] ttw:w-80 ttw:max-w-[calc(100vw-2rem)] ttw:flex-col ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:shadow-md",
16
16
  children: [
17
- /* @__PURE__ */ l("div", {
17
+ /* @__PURE__ */ u("div", {
18
18
  className: "ttw:flex ttw:items-center ttw:gap-2",
19
- children: [/* @__PURE__ */ c("span", {
19
+ children: [/* @__PURE__ */ l("span", {
20
+ id: T,
20
21
  className: "ttw:flex-1 ttw:text-sm ttw:font-semibold",
21
- children: p
22
- }), /* @__PURE__ */ l(r, { children: [/* @__PURE__ */ l(t, { children: [/* @__PURE__ */ c(i, {
22
+ children: m
23
+ }), /* @__PURE__ */ u(r, { children: [/* @__PURE__ */ u(t, { children: [/* @__PURE__ */ l(i, {
23
24
  asChild: !0,
24
- children: /* @__PURE__ */ c(e, {
25
+ children: /* @__PURE__ */ l(e, {
25
26
  type: "button",
26
27
  variant: "ghost",
27
28
  size: "icon-sm",
28
- "aria-expanded": !S,
29
- "aria-label": S ? y : v,
30
- onClick: () => C((e) => !e),
31
- children: c(S ? d : u, { className: "ttw:size-4" })
29
+ "aria-expanded": !C,
30
+ "aria-label": C ? b : y,
31
+ onClick: () => w((e) => !e),
32
+ children: l(C ? f : d, { className: "ttw:size-4" })
32
33
  })
33
- }), /* @__PURE__ */ c(n, { children: S ? y : v })] }), /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ c(i, {
34
+ }), /* @__PURE__ */ l(n, { children: C ? b : y })] }), /* @__PURE__ */ u(t, { children: [/* @__PURE__ */ l(i, {
34
35
  asChild: !0,
35
- children: /* @__PURE__ */ c(e, {
36
+ children: /* @__PURE__ */ l(e, {
36
37
  type: "button",
37
38
  variant: "ghost",
38
39
  size: "icon-sm",
39
- "aria-label": _,
40
- onClick: x,
41
- children: /* @__PURE__ */ c(f, { className: "ttw:size-4" })
40
+ "aria-label": v,
41
+ onClick: S,
42
+ children: /* @__PURE__ */ l(p, { className: "ttw:size-4" })
42
43
  })
43
- }), /* @__PURE__ */ c(n, { children: _ })] })] })]
44
+ }), /* @__PURE__ */ l(n, { children: v })] })] })]
44
45
  }),
45
- g && /* @__PURE__ */ c("p", {
46
+ _ && /* @__PURE__ */ l("p", {
46
47
  role: "status",
47
48
  className: "ttw:mt-2 ttw:text-sm ttw:text-muted-foreground",
48
- children: g
49
+ children: _
49
50
  }),
50
- !S && /* @__PURE__ */ c("div", {
51
+ !C && /* @__PURE__ */ l("div", {
51
52
  tabIndex: 0,
52
53
  role: "region",
53
- "aria-label": m,
54
+ "aria-label": h,
54
55
  className: "ttw:mt-3 ttw:min-h-0 ttw:overflow-y-auto",
55
- children: /* @__PURE__ */ c("ul", {
56
+ children: /* @__PURE__ */ l("ul", {
56
57
  className: "ttw:flex ttw:flex-col ttw:gap-3",
57
- children: h.map((t) => /* @__PURE__ */ l("li", {
58
+ children: g.map((t) => /* @__PURE__ */ u("li", {
58
59
  className: "ttw:flex ttw:flex-col ttw:gap-1",
59
60
  children: [
60
- /* @__PURE__ */ l("div", {
61
+ /* @__PURE__ */ u("div", {
61
62
  className: "ttw:flex ttw:items-center ttw:gap-2",
62
- children: [/* @__PURE__ */ c("span", {
63
+ children: [/* @__PURE__ */ l("span", {
63
64
  className: "ttw:min-w-0 ttw:flex-1 ttw:truncate ttw:text-sm",
64
65
  title: t.name,
65
66
  children: t.name
66
- }), t.onRetry && /* @__PURE__ */ c(e, {
67
+ }), t.onRetry && /* @__PURE__ */ l(e, {
67
68
  variant: "ghost",
68
69
  size: "sm",
69
70
  onClick: t.onRetry,
70
- children: b
71
+ children: x
71
72
  })]
72
73
  }),
73
- /* @__PURE__ */ c("span", {
74
+ /* @__PURE__ */ l("span", {
74
75
  className: "ttw:text-xs ttw:text-muted-foreground",
75
76
  children: t.status
76
77
  }),
77
- t.progress !== void 0 && /* @__PURE__ */ c("progress", {
78
+ t.progress !== void 0 && /* @__PURE__ */ l("progress", {
78
79
  "aria-label": t.name,
79
80
  value: t.progress,
80
81
  max: 100,
@@ -85,6 +86,6 @@ function p({ title: p, listLabel: m, items: h, summary: g, closeLabel: _, collap
85
86
  })
86
87
  })
87
88
  ]
88
- }), w ?? document.body);
89
+ }), E ?? document.body);
89
90
  }
90
- export { p as UploadTray };
91
+ export { m as UploadTray };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.11.240",
3
+ "version": "0.11.243",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -168,6 +168,7 @@
168
168
  "externalDependencies": [
169
169
  "@nx/vite",
170
170
  "@playwright/test",
171
+ "@storybook/addon-a11y",
171
172
  "@storybook/addon-vitest",
172
173
  "@storybook/react-vite",
173
174
  "@tailwindcss/vite",