@nocios/crudify-ui 1.0.49 → 1.0.50

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
@@ -59,27 +59,39 @@ var useTranslationsFromUrl = (url, providedTranslations) => {
59
59
  const [translations, setTranslations] = (0, import_react.useState)(providedTranslations || {});
60
60
  const [loading, setLoading] = (0, import_react.useState)(!!url);
61
61
  const [error, setError] = (0, import_react.useState)(null);
62
+ console.log("\u{1F310} useTranslationsFromUrl DEBUG:");
63
+ console.log(" - URL:", url);
64
+ console.log(" - Loading:", loading);
65
+ console.log(" - Has providedTranslations:", !!providedTranslations);
66
+ console.log(" - Current translations keys:", Object.keys(translations));
62
67
  (0, import_react.useEffect)(() => {
68
+ console.log("\u{1F504} useTranslationsFromUrl useEffect triggered");
63
69
  if (!url) {
70
+ console.log(" - No URL provided, using provided translations");
64
71
  setTranslations(providedTranslations || {});
65
72
  setLoading(false);
66
73
  setError(null);
67
74
  return;
68
75
  }
76
+ console.log(" - Starting fetch for:", url);
69
77
  let isCancelled = false;
70
78
  setLoading(true);
71
79
  setError(null);
72
80
  fetch(url).then((response) => {
81
+ console.log(" - Fetch response:", response.status, response.statusText);
73
82
  if (!response.ok) {
74
83
  throw new Error(`Failed to load translations: ${response.status}`);
75
84
  }
76
85
  return response.json();
77
86
  }).then((data) => {
87
+ console.log(" - Translations loaded successfully:", Object.keys(data).length, "keys");
88
+ console.log(" - First few keys:", Object.keys(data).slice(0, 5));
78
89
  if (!isCancelled) {
79
90
  setTranslations(data);
80
91
  setLoading(false);
81
92
  }
82
93
  }).catch((err) => {
94
+ console.log(" - Fetch error:", err.message);
83
95
  if (!isCancelled) {
84
96
  console.error("Error loading translations:", err);
85
97
  setError(err.message);
@@ -151,10 +163,18 @@ var I18nProvider = ({
151
163
  language = "en"
152
164
  }) => {
153
165
  const { translations: loadedTranslations, loading } = useTranslationsFromUrl(translationsUrl, translations);
166
+ console.log("\u{1F4DD} I18nProvider DEBUG:");
167
+ console.log(" - Language:", language);
168
+ console.log(" - TranslationsUrl:", translationsUrl);
169
+ console.log(" - Loading:", loading);
170
+ console.log(" - LoadedTranslations keys:", Object.keys(loadedTranslations || {}).length);
154
171
  const t = (0, import_react2.useMemo)(() => {
155
172
  return (key, variables) => {
156
173
  const mergedTranslations = { ...defaultTranslations, ...loadedTranslations };
157
174
  let value = getNestedValue(mergedTranslations, key) || key;
175
+ console.log(`\u{1F524} Translation for "${key}":`);
176
+ console.log(" - Found value:", value);
177
+ console.log(" - Merged translations keys:", Object.keys(mergedTranslations).length);
158
178
  if (variables && typeof value === "string") {
159
179
  Object.entries(variables).forEach(([varKey, varValue]) => {
160
180
  value = value.replace(new RegExp(`{{${varKey}}}`, "g"), varValue);
package/dist/index.mjs CHANGED
@@ -15,27 +15,39 @@ var useTranslationsFromUrl = (url, providedTranslations) => {
15
15
  const [translations, setTranslations] = useState(providedTranslations || {});
16
16
  const [loading, setLoading] = useState(!!url);
17
17
  const [error, setError] = useState(null);
18
+ console.log("\u{1F310} useTranslationsFromUrl DEBUG:");
19
+ console.log(" - URL:", url);
20
+ console.log(" - Loading:", loading);
21
+ console.log(" - Has providedTranslations:", !!providedTranslations);
22
+ console.log(" - Current translations keys:", Object.keys(translations));
18
23
  useEffect(() => {
24
+ console.log("\u{1F504} useTranslationsFromUrl useEffect triggered");
19
25
  if (!url) {
26
+ console.log(" - No URL provided, using provided translations");
20
27
  setTranslations(providedTranslations || {});
21
28
  setLoading(false);
22
29
  setError(null);
23
30
  return;
24
31
  }
32
+ console.log(" - Starting fetch for:", url);
25
33
  let isCancelled = false;
26
34
  setLoading(true);
27
35
  setError(null);
28
36
  fetch(url).then((response) => {
37
+ console.log(" - Fetch response:", response.status, response.statusText);
29
38
  if (!response.ok) {
30
39
  throw new Error(`Failed to load translations: ${response.status}`);
31
40
  }
32
41
  return response.json();
33
42
  }).then((data) => {
43
+ console.log(" - Translations loaded successfully:", Object.keys(data).length, "keys");
44
+ console.log(" - First few keys:", Object.keys(data).slice(0, 5));
34
45
  if (!isCancelled) {
35
46
  setTranslations(data);
36
47
  setLoading(false);
37
48
  }
38
49
  }).catch((err) => {
50
+ console.log(" - Fetch error:", err.message);
39
51
  if (!isCancelled) {
40
52
  console.error("Error loading translations:", err);
41
53
  setError(err.message);
@@ -107,10 +119,18 @@ var I18nProvider = ({
107
119
  language = "en"
108
120
  }) => {
109
121
  const { translations: loadedTranslations, loading } = useTranslationsFromUrl(translationsUrl, translations);
122
+ console.log("\u{1F4DD} I18nProvider DEBUG:");
123
+ console.log(" - Language:", language);
124
+ console.log(" - TranslationsUrl:", translationsUrl);
125
+ console.log(" - Loading:", loading);
126
+ console.log(" - LoadedTranslations keys:", Object.keys(loadedTranslations || {}).length);
110
127
  const t = useMemo(() => {
111
128
  return (key, variables) => {
112
129
  const mergedTranslations = { ...defaultTranslations, ...loadedTranslations };
113
130
  let value = getNestedValue(mergedTranslations, key) || key;
131
+ console.log(`\u{1F524} Translation for "${key}":`);
132
+ console.log(" - Found value:", value);
133
+ console.log(" - Merged translations keys:", Object.keys(mergedTranslations).length);
114
134
  if (variables && typeof value === "string") {
115
135
  Object.entries(variables).forEach(([varKey, varValue]) => {
116
136
  value = value.replace(new RegExp(`{{${varKey}}}`, "g"), varValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",