@nocios/crudify-ui 1.0.74 → 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
@@ -256,8 +256,22 @@ function loginStateReducer(state, action) {
256
256
  oldScreen: state.currentScreen,
257
257
  newScreen: newState.currentScreen,
258
258
  oldParams: state.searchParams,
259
- newParams: newState.searchParams
259
+ newParams: newState.searchParams,
260
+ urlBefore: window.location.search
260
261
  });
262
+ console.log("\u{1F310} LoginStateReducer - Updating browser URL:", {
263
+ newScreen: newState.currentScreen,
264
+ newParams: newState.searchParams,
265
+ shouldClearUrl: Object.keys(newState.searchParams).length === 0
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
+ }
261
275
  return newState;
262
276
  case "SET_SEARCH_PARAMS":
263
277
  return {
@@ -1115,6 +1129,8 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1115
1129
  }
1116
1130
  };
1117
1131
  const handleBack = () => {
1132
+ console.log("\u{1F4E7} ForgotPasswordForm - handleBack called");
1133
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating back to login");
1118
1134
  onScreenChange?.("login");
1119
1135
  };
1120
1136
  const handleGoToCheckCode = () => {
@@ -1563,7 +1579,8 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1563
1579
  }
1564
1580
  };
1565
1581
  const handleBack = () => {
1566
- console.log("\u{1F522} CheckCodeForm - handleBack called");
1582
+ console.log("\u{1F522} CheckCodeForm - handleBack called, current searchParams:", searchParams);
1583
+ console.log("\u{1F522} CheckCodeForm - Navigating back to forgotPassword");
1567
1584
  onScreenChange?.("forgotPassword");
1568
1585
  };
1569
1586
  const handleCodeChange = (event) => {
@@ -1709,11 +1726,20 @@ var CrudifyLoginInternal = ({
1709
1726
  currentScreen: state.currentScreen,
1710
1727
  newScreen: screen2,
1711
1728
  params,
1712
- stateSearchParams: state.searchParams
1729
+ stateSearchParams: state.searchParams,
1730
+ urlBeforeChange: window.location.search
1713
1731
  });
1714
- setScreen(screen2, params);
1715
- onScreenChange?.(screen2, params);
1716
- console.log("\u2705 CrudifyLoginInternal - screen change completed");
1732
+ let finalParams = params;
1733
+ if (screen2 === "login") {
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 } : {};
1739
+ }
1740
+ setScreen(screen2, finalParams);
1741
+ onScreenChange?.(screen2, finalParams);
1742
+ console.log("\u2705 CrudifyLoginInternal - screen change completed, URL after:", window.location.search);
1717
1743
  };
1718
1744
  const renderCurrentForm = () => {
1719
1745
  console.log("\u{1F3A8} CrudifyLoginInternal - renderCurrentForm called:", {
package/dist/index.mjs CHANGED
@@ -205,8 +205,22 @@ function loginStateReducer(state, action) {
205
205
  oldScreen: state.currentScreen,
206
206
  newScreen: newState.currentScreen,
207
207
  oldParams: state.searchParams,
208
- newParams: newState.searchParams
208
+ newParams: newState.searchParams,
209
+ urlBefore: window.location.search
209
210
  });
211
+ console.log("\u{1F310} LoginStateReducer - Updating browser URL:", {
212
+ newScreen: newState.currentScreen,
213
+ newParams: newState.searchParams,
214
+ shouldClearUrl: Object.keys(newState.searchParams).length === 0
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
+ }
210
224
  return newState;
211
225
  case "SET_SEARCH_PARAMS":
212
226
  return {
@@ -1064,6 +1078,8 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1064
1078
  }
1065
1079
  };
1066
1080
  const handleBack = () => {
1081
+ console.log("\u{1F4E7} ForgotPasswordForm - handleBack called");
1082
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating back to login");
1067
1083
  onScreenChange?.("login");
1068
1084
  };
1069
1085
  const handleGoToCheckCode = () => {
@@ -1512,7 +1528,8 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1512
1528
  }
1513
1529
  };
1514
1530
  const handleBack = () => {
1515
- console.log("\u{1F522} CheckCodeForm - handleBack called");
1531
+ console.log("\u{1F522} CheckCodeForm - handleBack called, current searchParams:", searchParams);
1532
+ console.log("\u{1F522} CheckCodeForm - Navigating back to forgotPassword");
1516
1533
  onScreenChange?.("forgotPassword");
1517
1534
  };
1518
1535
  const handleCodeChange = (event) => {
@@ -1658,11 +1675,20 @@ var CrudifyLoginInternal = ({
1658
1675
  currentScreen: state.currentScreen,
1659
1676
  newScreen: screen2,
1660
1677
  params,
1661
- stateSearchParams: state.searchParams
1678
+ stateSearchParams: state.searchParams,
1679
+ urlBeforeChange: window.location.search
1662
1680
  });
1663
- setScreen(screen2, params);
1664
- onScreenChange?.(screen2, params);
1665
- console.log("\u2705 CrudifyLoginInternal - screen change completed");
1681
+ let finalParams = params;
1682
+ if (screen2 === "login") {
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 } : {};
1688
+ }
1689
+ setScreen(screen2, finalParams);
1690
+ onScreenChange?.(screen2, finalParams);
1691
+ console.log("\u2705 CrudifyLoginInternal - screen change completed, URL after:", window.location.search);
1666
1692
  };
1667
1693
  const renderCurrentForm = () => {
1668
1694
  console.log("\u{1F3A8} CrudifyLoginInternal - renderCurrentForm called:", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "1.0.74",
3
+ "version": "1.0.76",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",