@zauru-sdk/components 6.23.0 → 6.23.1

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.23.1](https://github.com/intuitiva/zauru-typescript-sdk/compare/@zauru-sdk/components@6.23.0...@zauru-sdk/components@6.23.1) (2026-12-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * leer el mensaje del boundary cuando Remix entrega un Response ([f9fe951](https://github.com/intuitiva/zauru-typescript-sdk/commit/f9fe9519a16f04b21ee9724ecbf40a40d04240d7))
12
+
13
+
14
+
15
+
16
+
6
17
  # [6.23.0](https://github.com/intuitiva/zauru-typescript-sdk/compare/@zauru-sdk/components@6.22.21...@zauru-sdk/components@6.23.0) (2026-12-04)
7
18
 
8
19
 
@@ -5,6 +5,8 @@ import { sendClientError } from "../../observability/sendClientError.js";
5
5
  const DEFAULT_MESSAGE = "No pudimos cargar esta pantalla. Recarga la página e inténtalo de nuevo.";
6
6
  const isTimeout = (message) => /TIMEOUT|timeout of \d+ms|no terminó a tiempo/i.test(message);
7
7
  const isNetworkFailure = (message) => /Failed to fetch|Network ?Error|ECONNRESET|ETIMEDOUT|ENOTFOUND|socket hang up/i.test(message);
8
+ /** Upstream 5xx (Hasura/Heroku) reaches us as an axios message with the URL. */
9
+ const isUpstreamUnavailable = (message) => /HTTP 50[0-9]|Service Unavailable|Bad Gateway|Gateway Timeout|ENOTFOUND|ECONNREFUSED/i.test(message);
8
10
  /**
9
11
  * Remix replaces a thrown `Error` with "An unknown error has occurred" before
10
12
  * it reaches the client, so a message that survived the wire is a real domain
@@ -14,6 +16,15 @@ const isSanitized = (message) => !message.trim() ||
14
16
  /unknown error has occurred|Unexpected Server Error/i.test(message);
15
17
  const describeRouteError = (error) => {
16
18
  if (isRouteErrorResponse(error)) {
19
+ // A `json({ message })` thrown from a loader reaches the boundary as data.
20
+ const data = error.data;
21
+ const fromData = typeof data === "string"
22
+ ? data
23
+ : data && typeof data === "object" && typeof data.message === "string"
24
+ ? data.message
25
+ : "";
26
+ if (fromData.trim() && !isSanitized(fromData))
27
+ return fromData;
17
28
  switch (error.status) {
18
29
  case 401:
19
30
  return "Tu sesión expiró. Vuelve a iniciar sesión para continuar.";
@@ -34,6 +45,9 @@ const describeRouteError = (error) => {
34
45
  if (isTimeout(message)) {
35
46
  return "El sistema tardó demasiado en responder. Vuelve a intentarlo en un momento.";
36
47
  }
48
+ if (isUpstreamUnavailable(message)) {
49
+ return "El sistema no está disponible en este momento. Vuelve a intentarlo en unos minutos.";
50
+ }
37
51
  if (isNetworkFailure(message)) {
38
52
  return "No pudimos conectar con el sistema. Revisa tu conexión e inténtalo de nuevo.";
39
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/components",
3
- "version": "6.23.0",
3
+ "version": "6.23.1",
4
4
  "description": "Componentes reutilizables en las WebApps de Zauru.",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -63,5 +63,5 @@
63
63
  "styled-components": "^5.3.5",
64
64
  "zod": "^3.23.8"
65
65
  },
66
- "gitHead": "3d0fccda00fa0bb82a9411599eae997cbabe2492"
66
+ "gitHead": "5231c20e50d19d648ce7539d3cf4531a901245da"
67
67
  }
@@ -20,6 +20,12 @@ const isNetworkFailure = (message: string) =>
20
20
  message,
21
21
  );
22
22
 
23
+ /** Upstream 5xx (Hasura/Heroku) reaches us as an axios message with the URL. */
24
+ const isUpstreamUnavailable = (message: string) =>
25
+ /HTTP 50[0-9]|Service Unavailable|Bad Gateway|Gateway Timeout|ENOTFOUND|ECONNREFUSED/i.test(
26
+ message,
27
+ );
28
+
23
29
  /**
24
30
  * Remix replaces a thrown `Error` with "An unknown error has occurred" before
25
31
  * it reaches the client, so a message that survived the wire is a real domain
@@ -31,6 +37,16 @@ const isSanitized = (message: string) =>
31
37
 
32
38
  const describeRouteError = (error: unknown): string => {
33
39
  if (isRouteErrorResponse(error)) {
40
+ // A `json({ message })` thrown from a loader reaches the boundary as data.
41
+ const data = error.data as { message?: unknown } | string | null;
42
+ const fromData =
43
+ typeof data === "string"
44
+ ? data
45
+ : data && typeof data === "object" && typeof data.message === "string"
46
+ ? data.message
47
+ : "";
48
+ if (fromData.trim() && !isSanitized(fromData)) return fromData;
49
+
34
50
  switch (error.status) {
35
51
  case 401:
36
52
  return "Tu sesión expiró. Vuelve a iniciar sesión para continuar.";
@@ -51,6 +67,9 @@ const describeRouteError = (error: unknown): string => {
51
67
  if (isTimeout(message)) {
52
68
  return "El sistema tardó demasiado en responder. Vuelve a intentarlo en un momento.";
53
69
  }
70
+ if (isUpstreamUnavailable(message)) {
71
+ return "El sistema no está disponible en este momento. Vuelve a intentarlo en unos minutos.";
72
+ }
54
73
  if (isNetworkFailure(message)) {
55
74
  return "No pudimos conectar con el sistema. Revisa tu conexión e inténtalo de nuevo.";
56
75
  }