@nocios/crudify-ui 1.0.75 → 1.0.76

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
@@ -259,10 +259,19 @@ function loginStateReducer(state, action) {
259
259
  newParams: newState.searchParams,
260
260
  urlBefore: window.location.search
261
261
  });
262
- console.log("\u{1F310} LoginStateReducer - Browser URL management needed?", {
262
+ console.log("\u{1F310} LoginStateReducer - Updating browser URL:", {
263
263
  newScreen: newState.currentScreen,
264
- newParams: newState.searchParams
264
+ newParams: newState.searchParams,
265
+ shouldClearUrl: Object.keys(newState.searchParams).length === 0
265
266
  });
267
+ const newUrl = new URLSearchParams(newState.searchParams);
268
+ const newPath = newUrl.toString() ? `?${newUrl.toString()}` : window.location.pathname;
269
+ try {
270
+ window.history.replaceState({}, "", newPath);
271
+ console.log("\u{1F310} LoginStateReducer - Browser URL updated to:", window.location.search);
272
+ } catch (error) {
273
+ console.warn("\u{1F310} LoginStateReducer - Failed to update browser URL:", error);
274
+ }
266
275
  return newState;
267
276
  case "SET_SEARCH_PARAMS":
268
277
  return {
@@ -1722,9 +1731,11 @@ var CrudifyLoginInternal = ({
1722
1731
  });
1723
1732
  let finalParams = params;
1724
1733
  if (screen2 === "login") {
1725
- console.log("\u{1F9F9} CrudifyLoginInternal - Navigating to login, should clear email param from URL");
1726
- } else if (screen2 === "forgotPassword") {
1727
- console.log("\u{1F9F9} CrudifyLoginInternal - Navigating to forgotPassword, checking if email should be preserved");
1734
+ console.log("\u{1F9F9} CrudifyLoginInternal - Navigating to login, clearing all URL params");
1735
+ finalParams = {};
1736
+ } else if (screen2 === "forgotPassword" && !params) {
1737
+ console.log("\u{1F9F9} CrudifyLoginInternal - Navigating to forgotPassword, preserving existing email if any");
1738
+ finalParams = state.searchParams.email ? { email: state.searchParams.email } : {};
1728
1739
  }
1729
1740
  setScreen(screen2, finalParams);
1730
1741
  onScreenChange?.(screen2, finalParams);
package/dist/index.mjs CHANGED
@@ -208,10 +208,19 @@ function loginStateReducer(state, action) {
208
208
  newParams: newState.searchParams,
209
209
  urlBefore: window.location.search
210
210
  });
211
- console.log("\u{1F310} LoginStateReducer - Browser URL management needed?", {
211
+ console.log("\u{1F310} LoginStateReducer - Updating browser URL:", {
212
212
  newScreen: newState.currentScreen,
213
- newParams: newState.searchParams
213
+ newParams: newState.searchParams,
214
+ shouldClearUrl: Object.keys(newState.searchParams).length === 0
214
215
  });
216
+ const newUrl = new URLSearchParams(newState.searchParams);
217
+ const newPath = newUrl.toString() ? `?${newUrl.toString()}` : window.location.pathname;
218
+ try {
219
+ window.history.replaceState({}, "", newPath);
220
+ console.log("\u{1F310} LoginStateReducer - Browser URL updated to:", window.location.search);
221
+ } catch (error) {
222
+ console.warn("\u{1F310} LoginStateReducer - Failed to update browser URL:", error);
223
+ }
215
224
  return newState;
216
225
  case "SET_SEARCH_PARAMS":
217
226
  return {
@@ -1671,9 +1680,11 @@ var CrudifyLoginInternal = ({
1671
1680
  });
1672
1681
  let finalParams = params;
1673
1682
  if (screen2 === "login") {
1674
- console.log("\u{1F9F9} CrudifyLoginInternal - Navigating to login, should clear email param from URL");
1675
- } else if (screen2 === "forgotPassword") {
1676
- console.log("\u{1F9F9} CrudifyLoginInternal - Navigating to forgotPassword, checking if email should be preserved");
1683
+ console.log("\u{1F9F9} CrudifyLoginInternal - Navigating to login, clearing all URL params");
1684
+ finalParams = {};
1685
+ } else if (screen2 === "forgotPassword" && !params) {
1686
+ console.log("\u{1F9F9} CrudifyLoginInternal - Navigating to forgotPassword, preserving existing email if any");
1687
+ finalParams = state.searchParams.email ? { email: state.searchParams.email } : {};
1677
1688
  }
1678
1689
  setScreen(screen2, finalParams);
1679
1690
  onScreenChange?.(screen2, finalParams);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "1.0.75",
3
+ "version": "1.0.76",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",