@nocios/crudify-ui 3.0.42 → 3.0.44

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/dist/index.js CHANGED
@@ -1852,6 +1852,9 @@ function translateErrorCode(errorCode, config) {
1852
1852
  }
1853
1853
  for (const key of translationKeys) {
1854
1854
  const translated = translateFn(key);
1855
+ if (enableDebug) {
1856
+ console.log(`\u{1F50D} [ErrorTranslation] Checking key: "${key}" -> result: "${translated}" (same as key: ${translated === key})`);
1857
+ }
1855
1858
  if (translated && translated !== key) {
1856
1859
  if (enableDebug) {
1857
1860
  console.log(`\u2705 [ErrorTranslation] Found translation at key: ${key} = "${translated}"`);
@@ -1880,13 +1883,25 @@ function translateError(error, config) {
1880
1883
  if (enableDebug) {
1881
1884
  console.log(`\u{1F50D} [ErrorTranslation] Translating error:`, error);
1882
1885
  }
1883
- if (error.message && !error.message.includes("Error:") && error.message.length > 0) {
1886
+ const translatedCode = translateErrorCode(error.code, config);
1887
+ if (translatedCode !== error.code.toUpperCase() && translatedCode !== error.code) {
1888
+ if (enableDebug) {
1889
+ console.log(`\u2705 [ErrorTranslation] Using hierarchical translation: "${translatedCode}"`);
1890
+ }
1891
+ if (error.field) {
1892
+ return `${error.field}: ${translatedCode}`;
1893
+ }
1894
+ return translatedCode;
1895
+ }
1896
+ if (error.message && !error.message.includes("Error:") && error.message.length > 0 && error.message !== error.code) {
1884
1897
  if (enableDebug) {
1885
- console.log(`\u2705 [ErrorTranslation] Using API message: "${error.message}"`);
1898
+ console.log(`\u{1F504} [ErrorTranslation] No hierarchical translation found, using API message: "${error.message}"`);
1886
1899
  }
1887
1900
  return error.message;
1888
1901
  }
1889
- const translatedCode = translateErrorCode(error.code, config);
1902
+ if (enableDebug) {
1903
+ console.log(`\u26A0\uFE0F [ErrorTranslation] Using final fallback: "${translatedCode}"`);
1904
+ }
1890
1905
  if (error.field) {
1891
1906
  return `${error.field}: ${translatedCode}`;
1892
1907
  }
@@ -1949,11 +1964,14 @@ var LoginForm = ({ onScreenChange, onExternalNavigate, onLoginSuccess, onError,
1949
1964
  return () => clearTimeout(timer);
1950
1965
  }, []);
1951
1966
  const translateError2 = (parsedError) => {
1952
- return errorTranslator.translateError({
1967
+ console.log("\u{1F50D} [LoginForm] Translating parsed error:", parsedError);
1968
+ const result = errorTranslator.translateError({
1953
1969
  code: parsedError.code,
1954
1970
  message: parsedError.message,
1955
1971
  field: parsedError.field
1956
1972
  });
1973
+ console.log("\u{1F50D} [LoginForm] Translation result:", result);
1974
+ return result;
1957
1975
  };
1958
1976
  const handleLogin = async () => {
1959
1977
  if (state.loading) return;
package/dist/index.mjs CHANGED
@@ -1779,6 +1779,9 @@ function translateErrorCode(errorCode, config) {
1779
1779
  }
1780
1780
  for (const key of translationKeys) {
1781
1781
  const translated = translateFn(key);
1782
+ if (enableDebug) {
1783
+ console.log(`\u{1F50D} [ErrorTranslation] Checking key: "${key}" -> result: "${translated}" (same as key: ${translated === key})`);
1784
+ }
1782
1785
  if (translated && translated !== key) {
1783
1786
  if (enableDebug) {
1784
1787
  console.log(`\u2705 [ErrorTranslation] Found translation at key: ${key} = "${translated}"`);
@@ -1807,13 +1810,25 @@ function translateError(error, config) {
1807
1810
  if (enableDebug) {
1808
1811
  console.log(`\u{1F50D} [ErrorTranslation] Translating error:`, error);
1809
1812
  }
1810
- if (error.message && !error.message.includes("Error:") && error.message.length > 0) {
1813
+ const translatedCode = translateErrorCode(error.code, config);
1814
+ if (translatedCode !== error.code.toUpperCase() && translatedCode !== error.code) {
1815
+ if (enableDebug) {
1816
+ console.log(`\u2705 [ErrorTranslation] Using hierarchical translation: "${translatedCode}"`);
1817
+ }
1818
+ if (error.field) {
1819
+ return `${error.field}: ${translatedCode}`;
1820
+ }
1821
+ return translatedCode;
1822
+ }
1823
+ if (error.message && !error.message.includes("Error:") && error.message.length > 0 && error.message !== error.code) {
1811
1824
  if (enableDebug) {
1812
- console.log(`\u2705 [ErrorTranslation] Using API message: "${error.message}"`);
1825
+ console.log(`\u{1F504} [ErrorTranslation] No hierarchical translation found, using API message: "${error.message}"`);
1813
1826
  }
1814
1827
  return error.message;
1815
1828
  }
1816
- const translatedCode = translateErrorCode(error.code, config);
1829
+ if (enableDebug) {
1830
+ console.log(`\u26A0\uFE0F [ErrorTranslation] Using final fallback: "${translatedCode}"`);
1831
+ }
1817
1832
  if (error.field) {
1818
1833
  return `${error.field}: ${translatedCode}`;
1819
1834
  }
@@ -1876,11 +1891,14 @@ var LoginForm = ({ onScreenChange, onExternalNavigate, onLoginSuccess, onError,
1876
1891
  return () => clearTimeout(timer);
1877
1892
  }, []);
1878
1893
  const translateError2 = (parsedError) => {
1879
- return errorTranslator.translateError({
1894
+ console.log("\u{1F50D} [LoginForm] Translating parsed error:", parsedError);
1895
+ const result = errorTranslator.translateError({
1880
1896
  code: parsedError.code,
1881
1897
  message: parsedError.message,
1882
1898
  field: parsedError.field
1883
1899
  });
1900
+ console.log("\u{1F50D} [LoginForm] Translation result:", result);
1901
+ return result;
1884
1902
  };
1885
1903
  const handleLogin = async () => {
1886
1904
  if (state.loading) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "3.0.42",
3
+ "version": "3.0.44",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",