@nocios/crudify-ui 1.0.72 → 1.0.73

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
@@ -238,15 +238,27 @@ var initialState = {
238
238
  config: {}
239
239
  };
240
240
  function loginStateReducer(state, action) {
241
+ console.log("\u{1F504} LoginStateReducer - Action dispatched:", {
242
+ type: action.type,
243
+ currentScreen: state.currentScreen,
244
+ payload: action.payload
245
+ });
241
246
  switch (action.type) {
242
247
  case "SET_SCREEN":
243
- return {
248
+ const newState = {
244
249
  ...state,
245
250
  currentScreen: action.payload.screen,
246
251
  searchParams: action.payload.params || state.searchParams,
247
252
  // Clear form errors when changing screens
248
253
  errors: { global: [] }
249
254
  };
255
+ console.log("\u{1F504} LoginStateReducer - SET_SCREEN result:", {
256
+ oldScreen: state.currentScreen,
257
+ newScreen: newState.currentScreen,
258
+ oldParams: state.searchParams,
259
+ newParams: newState.searchParams
260
+ });
261
+ return newState;
250
262
  case "SET_SEARCH_PARAMS":
251
263
  return {
252
264
  ...state,
@@ -333,6 +345,11 @@ var LoginStateProvider = ({
333
345
  config: providedConfig,
334
346
  autoReadFromCookies = true
335
347
  }) => {
348
+ console.log("\u{1F3D7}\uFE0F LoginStateProvider - Component initialized with:", {
349
+ initialScreen,
350
+ providedConfig,
351
+ autoReadFromCookies
352
+ });
336
353
  const [state, dispatch] = (0, import_react4.useReducer)(loginStateReducer, {
337
354
  ...initialState,
338
355
  currentScreen: initialScreen
@@ -393,6 +410,11 @@ var LoginStateProvider = ({
393
410
  }
394
411
  }, [initialScreen]);
395
412
  const setScreen = (screen2, params) => {
413
+ console.log("\u{1F504} LoginStateProvider - setScreen called:", {
414
+ currentScreen: state.currentScreen,
415
+ targetScreen: screen2,
416
+ params
417
+ });
396
418
  dispatch({ type: "SET_SCREEN", payload: { screen: screen2, params } });
397
419
  };
398
420
  const updateFormData = (data) => {
@@ -1093,7 +1115,14 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1093
1115
  onScreenChange?.("login");
1094
1116
  };
1095
1117
  const handleGoToCheckCode = () => {
1118
+ console.log("\u{1F4E7} ForgotPasswordForm - handleGoToCheckCode called:", {
1119
+ emailSent,
1120
+ codeAlreadyExists,
1121
+ email,
1122
+ onScreenChange: !!onScreenChange
1123
+ });
1096
1124
  if (emailSent || codeAlreadyExists) {
1125
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating to checkCode with email:", email);
1097
1126
  onScreenChange?.("checkCode", { email });
1098
1127
  return;
1099
1128
  }
@@ -1105,6 +1134,7 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1105
1134
  setHelperTextEmail(t("forgotPassword.invalidEmail"));
1106
1135
  return;
1107
1136
  }
1137
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating to checkCode with validated email:", email);
1108
1138
  onScreenChange?.("checkCode", { email });
1109
1139
  };
1110
1140
  if (emailSent || codeAlreadyExists) {
@@ -1200,14 +1230,21 @@ var ResetPasswordForm = ({ onScreenChange, onError, searchParams, onResetSuccess
1200
1230
  }
1201
1231
  return parsedError.message || t("error.unknown");
1202
1232
  };
1233
+ const getParam = (key) => {
1234
+ if (!searchParams) return null;
1235
+ if (searchParams instanceof URLSearchParams) {
1236
+ return searchParams.get(key);
1237
+ }
1238
+ return searchParams[key] || null;
1239
+ };
1203
1240
  (0, import_react7.useEffect)(() => {
1204
1241
  if (!searchParams) {
1205
1242
  return;
1206
1243
  }
1207
1244
  if (searchParams) {
1208
- const fromCodeVerificationParam = searchParams.get("fromCodeVerification");
1209
- const emailParam = searchParams.get("email");
1210
- const codeParam = searchParams.get("code");
1245
+ const fromCodeVerificationParam = getParam("fromCodeVerification");
1246
+ const emailParam = getParam("email");
1247
+ const codeParam = getParam("code");
1211
1248
  if (fromCodeVerificationParam === "true" && emailParam && codeParam) {
1212
1249
  setEmail(emailParam);
1213
1250
  setCode(codeParam);
@@ -1216,7 +1253,7 @@ var ResetPasswordForm = ({ onScreenChange, onError, searchParams, onResetSuccess
1216
1253
  setValidatingCode(false);
1217
1254
  return;
1218
1255
  }
1219
- const linkParam = searchParams.get("link");
1256
+ const linkParam = getParam("link");
1220
1257
  if (linkParam) {
1221
1258
  try {
1222
1259
  const decodedLink = decodeURIComponent(linkParam);
@@ -1433,6 +1470,11 @@ var import_react8 = require("react");
1433
1470
  var import_material4 = require("@mui/material");
1434
1471
  var import_jsx_runtime7 = require("react/jsx-runtime");
1435
1472
  var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1473
+ console.log("\u{1F522} CheckCodeForm - Component initialized with props:", {
1474
+ onScreenChange: !!onScreenChange,
1475
+ onError: !!onError,
1476
+ searchParams
1477
+ });
1436
1478
  const { crudify: crudify3 } = useCrudify();
1437
1479
  const [code, setCode] = (0, import_react8.useState)("");
1438
1480
  const [loading, setLoading] = (0, import_react8.useState)(false);
@@ -1440,6 +1482,13 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1440
1482
  const [helperTextCode, setHelperTextCode] = (0, import_react8.useState)(null);
1441
1483
  const [email, setEmail] = (0, import_react8.useState)("");
1442
1484
  const { t } = useTranslation();
1485
+ const getParam = (key) => {
1486
+ if (!searchParams) return null;
1487
+ if (searchParams instanceof URLSearchParams) {
1488
+ return searchParams.get(key);
1489
+ }
1490
+ return searchParams[key] || null;
1491
+ };
1443
1492
  const translateError = (parsedError) => {
1444
1493
  const possibleKeys = [
1445
1494
  `errors.auth.${parsedError.code}`,
@@ -1457,10 +1506,17 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1457
1506
  return parsedError.message || t("error.unknown");
1458
1507
  };
1459
1508
  (0, import_react8.useEffect)(() => {
1460
- const emailParam = searchParams?.get("email");
1509
+ console.log("\u{1F522} CheckCodeForm - useEffect triggered:", {
1510
+ searchParams,
1511
+ onScreenChange: !!onScreenChange
1512
+ });
1513
+ const emailParam = getParam("email");
1514
+ console.log("\u{1F522} CheckCodeForm - emailParam extracted:", emailParam);
1461
1515
  if (emailParam) {
1516
+ console.log("\u{1F522} CheckCodeForm - Setting email:", emailParam);
1462
1517
  setEmail(emailParam);
1463
1518
  } else {
1519
+ console.log("\u{1F522} CheckCodeForm - No email found, redirecting to forgotPassword");
1464
1520
  onScreenChange?.("forgotPassword");
1465
1521
  }
1466
1522
  }, [searchParams, onScreenChange]);
@@ -1504,6 +1560,7 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1504
1560
  }
1505
1561
  };
1506
1562
  const handleBack = () => {
1563
+ console.log("\u{1F522} CheckCodeForm - handleBack called");
1507
1564
  onScreenChange?.("forgotPassword");
1508
1565
  };
1509
1566
  const handleCodeChange = (event) => {
@@ -1645,10 +1702,22 @@ var CrudifyLoginInternal = ({
1645
1702
  const { t } = useTranslation();
1646
1703
  const { state, setScreen } = useLoginState();
1647
1704
  const handleScreenChange = (screen2, params) => {
1705
+ console.log("\u{1F504} CrudifyLoginInternal - handleScreenChange called:", {
1706
+ currentScreen: state.currentScreen,
1707
+ newScreen: screen2,
1708
+ params,
1709
+ stateSearchParams: state.searchParams
1710
+ });
1648
1711
  setScreen(screen2, params);
1649
1712
  onScreenChange?.(screen2, params);
1713
+ console.log("\u2705 CrudifyLoginInternal - screen change completed");
1650
1714
  };
1651
1715
  const renderCurrentForm = () => {
1716
+ console.log("\u{1F3A8} CrudifyLoginInternal - renderCurrentForm called:", {
1717
+ currentScreen: state.currentScreen,
1718
+ searchParams: state.searchParams,
1719
+ config: state.config
1720
+ });
1652
1721
  const commonProps = {
1653
1722
  onScreenChange: handleScreenChange,
1654
1723
  onExternalNavigate,
@@ -1657,20 +1726,26 @@ var CrudifyLoginInternal = ({
1657
1726
  };
1658
1727
  switch (state.currentScreen) {
1659
1728
  case "forgotPassword":
1729
+ console.log("\u{1F4E7} Rendering ForgotPasswordForm");
1660
1730
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ForgotPasswordForm_default, { ...commonProps });
1661
1731
  case "checkCode":
1662
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckCodeForm_default, { ...commonProps });
1732
+ console.log("\u{1F522} Rendering CheckCodeForm with params:", state.searchParams);
1733
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckCodeForm_default, { ...commonProps, searchParams: state.searchParams });
1663
1734
  case "resetPassword":
1735
+ console.log("\u{1F510} Rendering ResetPasswordForm with params:", state.searchParams);
1664
1736
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1665
1737
  ResetPasswordForm_default,
1666
1738
  {
1667
1739
  ...commonProps,
1740
+ searchParams: state.searchParams,
1668
1741
  onResetSuccess: () => {
1742
+ console.log("\u2705 ResetPasswordForm - onResetSuccess called");
1669
1743
  handleScreenChange("login");
1670
1744
  }
1671
1745
  }
1672
1746
  );
1673
1747
  default:
1748
+ console.log("\u{1F3E0} Rendering LoginForm (default)");
1674
1749
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LoginForm_default, { ...commonProps, onLoginSuccess });
1675
1750
  }
1676
1751
  };
package/dist/index.mjs CHANGED
@@ -187,15 +187,27 @@ var initialState = {
187
187
  config: {}
188
188
  };
189
189
  function loginStateReducer(state, action) {
190
+ console.log("\u{1F504} LoginStateReducer - Action dispatched:", {
191
+ type: action.type,
192
+ currentScreen: state.currentScreen,
193
+ payload: action.payload
194
+ });
190
195
  switch (action.type) {
191
196
  case "SET_SCREEN":
192
- return {
197
+ const newState = {
193
198
  ...state,
194
199
  currentScreen: action.payload.screen,
195
200
  searchParams: action.payload.params || state.searchParams,
196
201
  // Clear form errors when changing screens
197
202
  errors: { global: [] }
198
203
  };
204
+ console.log("\u{1F504} LoginStateReducer - SET_SCREEN result:", {
205
+ oldScreen: state.currentScreen,
206
+ newScreen: newState.currentScreen,
207
+ oldParams: state.searchParams,
208
+ newParams: newState.searchParams
209
+ });
210
+ return newState;
199
211
  case "SET_SEARCH_PARAMS":
200
212
  return {
201
213
  ...state,
@@ -282,6 +294,11 @@ var LoginStateProvider = ({
282
294
  config: providedConfig,
283
295
  autoReadFromCookies = true
284
296
  }) => {
297
+ console.log("\u{1F3D7}\uFE0F LoginStateProvider - Component initialized with:", {
298
+ initialScreen,
299
+ providedConfig,
300
+ autoReadFromCookies
301
+ });
285
302
  const [state, dispatch] = useReducer(loginStateReducer, {
286
303
  ...initialState,
287
304
  currentScreen: initialScreen
@@ -342,6 +359,11 @@ var LoginStateProvider = ({
342
359
  }
343
360
  }, [initialScreen]);
344
361
  const setScreen = (screen2, params) => {
362
+ console.log("\u{1F504} LoginStateProvider - setScreen called:", {
363
+ currentScreen: state.currentScreen,
364
+ targetScreen: screen2,
365
+ params
366
+ });
345
367
  dispatch({ type: "SET_SCREEN", payload: { screen: screen2, params } });
346
368
  };
347
369
  const updateFormData = (data) => {
@@ -1042,7 +1064,14 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1042
1064
  onScreenChange?.("login");
1043
1065
  };
1044
1066
  const handleGoToCheckCode = () => {
1067
+ console.log("\u{1F4E7} ForgotPasswordForm - handleGoToCheckCode called:", {
1068
+ emailSent,
1069
+ codeAlreadyExists,
1070
+ email,
1071
+ onScreenChange: !!onScreenChange
1072
+ });
1045
1073
  if (emailSent || codeAlreadyExists) {
1074
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating to checkCode with email:", email);
1046
1075
  onScreenChange?.("checkCode", { email });
1047
1076
  return;
1048
1077
  }
@@ -1054,6 +1083,7 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1054
1083
  setHelperTextEmail(t("forgotPassword.invalidEmail"));
1055
1084
  return;
1056
1085
  }
1086
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating to checkCode with validated email:", email);
1057
1087
  onScreenChange?.("checkCode", { email });
1058
1088
  };
1059
1089
  if (emailSent || codeAlreadyExists) {
@@ -1149,14 +1179,21 @@ var ResetPasswordForm = ({ onScreenChange, onError, searchParams, onResetSuccess
1149
1179
  }
1150
1180
  return parsedError.message || t("error.unknown");
1151
1181
  };
1182
+ const getParam = (key) => {
1183
+ if (!searchParams) return null;
1184
+ if (searchParams instanceof URLSearchParams) {
1185
+ return searchParams.get(key);
1186
+ }
1187
+ return searchParams[key] || null;
1188
+ };
1152
1189
  useEffect5(() => {
1153
1190
  if (!searchParams) {
1154
1191
  return;
1155
1192
  }
1156
1193
  if (searchParams) {
1157
- const fromCodeVerificationParam = searchParams.get("fromCodeVerification");
1158
- const emailParam = searchParams.get("email");
1159
- const codeParam = searchParams.get("code");
1194
+ const fromCodeVerificationParam = getParam("fromCodeVerification");
1195
+ const emailParam = getParam("email");
1196
+ const codeParam = getParam("code");
1160
1197
  if (fromCodeVerificationParam === "true" && emailParam && codeParam) {
1161
1198
  setEmail(emailParam);
1162
1199
  setCode(codeParam);
@@ -1165,7 +1202,7 @@ var ResetPasswordForm = ({ onScreenChange, onError, searchParams, onResetSuccess
1165
1202
  setValidatingCode(false);
1166
1203
  return;
1167
1204
  }
1168
- const linkParam = searchParams.get("link");
1205
+ const linkParam = getParam("link");
1169
1206
  if (linkParam) {
1170
1207
  try {
1171
1208
  const decodedLink = decodeURIComponent(linkParam);
@@ -1382,6 +1419,11 @@ import { useState as useState5, useEffect as useEffect6 } from "react";
1382
1419
  import { Typography as Typography4, TextField as TextField4, Button as Button4, Box as Box4, CircularProgress as CircularProgress4, Alert as Alert4, Link as Link4 } from "@mui/material";
1383
1420
  import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1384
1421
  var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1422
+ console.log("\u{1F522} CheckCodeForm - Component initialized with props:", {
1423
+ onScreenChange: !!onScreenChange,
1424
+ onError: !!onError,
1425
+ searchParams
1426
+ });
1385
1427
  const { crudify: crudify3 } = useCrudify();
1386
1428
  const [code, setCode] = useState5("");
1387
1429
  const [loading, setLoading] = useState5(false);
@@ -1389,6 +1431,13 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1389
1431
  const [helperTextCode, setHelperTextCode] = useState5(null);
1390
1432
  const [email, setEmail] = useState5("");
1391
1433
  const { t } = useTranslation();
1434
+ const getParam = (key) => {
1435
+ if (!searchParams) return null;
1436
+ if (searchParams instanceof URLSearchParams) {
1437
+ return searchParams.get(key);
1438
+ }
1439
+ return searchParams[key] || null;
1440
+ };
1392
1441
  const translateError = (parsedError) => {
1393
1442
  const possibleKeys = [
1394
1443
  `errors.auth.${parsedError.code}`,
@@ -1406,10 +1455,17 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1406
1455
  return parsedError.message || t("error.unknown");
1407
1456
  };
1408
1457
  useEffect6(() => {
1409
- const emailParam = searchParams?.get("email");
1458
+ console.log("\u{1F522} CheckCodeForm - useEffect triggered:", {
1459
+ searchParams,
1460
+ onScreenChange: !!onScreenChange
1461
+ });
1462
+ const emailParam = getParam("email");
1463
+ console.log("\u{1F522} CheckCodeForm - emailParam extracted:", emailParam);
1410
1464
  if (emailParam) {
1465
+ console.log("\u{1F522} CheckCodeForm - Setting email:", emailParam);
1411
1466
  setEmail(emailParam);
1412
1467
  } else {
1468
+ console.log("\u{1F522} CheckCodeForm - No email found, redirecting to forgotPassword");
1413
1469
  onScreenChange?.("forgotPassword");
1414
1470
  }
1415
1471
  }, [searchParams, onScreenChange]);
@@ -1453,6 +1509,7 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1453
1509
  }
1454
1510
  };
1455
1511
  const handleBack = () => {
1512
+ console.log("\u{1F522} CheckCodeForm - handleBack called");
1456
1513
  onScreenChange?.("forgotPassword");
1457
1514
  };
1458
1515
  const handleCodeChange = (event) => {
@@ -1594,10 +1651,22 @@ var CrudifyLoginInternal = ({
1594
1651
  const { t } = useTranslation();
1595
1652
  const { state, setScreen } = useLoginState();
1596
1653
  const handleScreenChange = (screen2, params) => {
1654
+ console.log("\u{1F504} CrudifyLoginInternal - handleScreenChange called:", {
1655
+ currentScreen: state.currentScreen,
1656
+ newScreen: screen2,
1657
+ params,
1658
+ stateSearchParams: state.searchParams
1659
+ });
1597
1660
  setScreen(screen2, params);
1598
1661
  onScreenChange?.(screen2, params);
1662
+ console.log("\u2705 CrudifyLoginInternal - screen change completed");
1599
1663
  };
1600
1664
  const renderCurrentForm = () => {
1665
+ console.log("\u{1F3A8} CrudifyLoginInternal - renderCurrentForm called:", {
1666
+ currentScreen: state.currentScreen,
1667
+ searchParams: state.searchParams,
1668
+ config: state.config
1669
+ });
1601
1670
  const commonProps = {
1602
1671
  onScreenChange: handleScreenChange,
1603
1672
  onExternalNavigate,
@@ -1606,20 +1675,26 @@ var CrudifyLoginInternal = ({
1606
1675
  };
1607
1676
  switch (state.currentScreen) {
1608
1677
  case "forgotPassword":
1678
+ console.log("\u{1F4E7} Rendering ForgotPasswordForm");
1609
1679
  return /* @__PURE__ */ jsx9(ForgotPasswordForm_default, { ...commonProps });
1610
1680
  case "checkCode":
1611
- return /* @__PURE__ */ jsx9(CheckCodeForm_default, { ...commonProps });
1681
+ console.log("\u{1F522} Rendering CheckCodeForm with params:", state.searchParams);
1682
+ return /* @__PURE__ */ jsx9(CheckCodeForm_default, { ...commonProps, searchParams: state.searchParams });
1612
1683
  case "resetPassword":
1684
+ console.log("\u{1F510} Rendering ResetPasswordForm with params:", state.searchParams);
1613
1685
  return /* @__PURE__ */ jsx9(
1614
1686
  ResetPasswordForm_default,
1615
1687
  {
1616
1688
  ...commonProps,
1689
+ searchParams: state.searchParams,
1617
1690
  onResetSuccess: () => {
1691
+ console.log("\u2705 ResetPasswordForm - onResetSuccess called");
1618
1692
  handleScreenChange("login");
1619
1693
  }
1620
1694
  }
1621
1695
  );
1622
1696
  default:
1697
+ console.log("\u{1F3E0} Rendering LoginForm (default)");
1623
1698
  return /* @__PURE__ */ jsx9(LoginForm_default, { ...commonProps, onLoginSuccess });
1624
1699
  }
1625
1700
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "1.0.72",
3
+ "version": "1.0.73",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",