@nocios/crudify-ui 1.0.72 → 1.0.74

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,
@@ -262,10 +274,13 @@ function loginStateReducer(state, action) {
262
274
  // Clear related errors when updating form data
263
275
  errors: {
264
276
  ...state.errors,
265
- ...Object.keys(action.payload).reduce((acc, key) => ({
266
- ...acc,
267
- [key]: void 0
268
- }), {})
277
+ ...Object.keys(action.payload).reduce(
278
+ (acc, key) => ({
279
+ ...acc,
280
+ [key]: void 0
281
+ }),
282
+ {}
283
+ )
269
284
  }
270
285
  };
271
286
  case "SET_LOADING":
@@ -333,6 +348,11 @@ var LoginStateProvider = ({
333
348
  config: providedConfig,
334
349
  autoReadFromCookies = true
335
350
  }) => {
351
+ console.log("\u{1F3D7}\uFE0F LoginStateProvider - Component initialized with:", {
352
+ initialScreen,
353
+ providedConfig,
354
+ autoReadFromCookies
355
+ });
336
356
  const [state, dispatch] = (0, import_react4.useReducer)(loginStateReducer, {
337
357
  ...initialState,
338
358
  currentScreen: initialScreen
@@ -393,6 +413,11 @@ var LoginStateProvider = ({
393
413
  }
394
414
  }, [initialScreen]);
395
415
  const setScreen = (screen2, params) => {
416
+ console.log("\u{1F504} LoginStateProvider - setScreen called:", {
417
+ currentScreen: state.currentScreen,
418
+ targetScreen: screen2,
419
+ params
420
+ });
396
421
  dispatch({ type: "SET_SCREEN", payload: { screen: screen2, params } });
397
422
  };
398
423
  const updateFormData = (data) => {
@@ -1093,7 +1118,14 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1093
1118
  onScreenChange?.("login");
1094
1119
  };
1095
1120
  const handleGoToCheckCode = () => {
1121
+ console.log("\u{1F4E7} ForgotPasswordForm - handleGoToCheckCode called:", {
1122
+ emailSent,
1123
+ codeAlreadyExists,
1124
+ email,
1125
+ onScreenChange: !!onScreenChange
1126
+ });
1096
1127
  if (emailSent || codeAlreadyExists) {
1128
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating to checkCode with email:", email);
1097
1129
  onScreenChange?.("checkCode", { email });
1098
1130
  return;
1099
1131
  }
@@ -1105,6 +1137,7 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1105
1137
  setHelperTextEmail(t("forgotPassword.invalidEmail"));
1106
1138
  return;
1107
1139
  }
1140
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating to checkCode with validated email:", email);
1108
1141
  onScreenChange?.("checkCode", { email });
1109
1142
  };
1110
1143
  if (emailSent || codeAlreadyExists) {
@@ -1200,14 +1233,21 @@ var ResetPasswordForm = ({ onScreenChange, onError, searchParams, onResetSuccess
1200
1233
  }
1201
1234
  return parsedError.message || t("error.unknown");
1202
1235
  };
1236
+ const getParam = (key) => {
1237
+ if (!searchParams) return null;
1238
+ if (searchParams instanceof URLSearchParams) {
1239
+ return searchParams.get(key);
1240
+ }
1241
+ return searchParams[key] || null;
1242
+ };
1203
1243
  (0, import_react7.useEffect)(() => {
1204
1244
  if (!searchParams) {
1205
1245
  return;
1206
1246
  }
1207
1247
  if (searchParams) {
1208
- const fromCodeVerificationParam = searchParams.get("fromCodeVerification");
1209
- const emailParam = searchParams.get("email");
1210
- const codeParam = searchParams.get("code");
1248
+ const fromCodeVerificationParam = getParam("fromCodeVerification");
1249
+ const emailParam = getParam("email");
1250
+ const codeParam = getParam("code");
1211
1251
  if (fromCodeVerificationParam === "true" && emailParam && codeParam) {
1212
1252
  setEmail(emailParam);
1213
1253
  setCode(codeParam);
@@ -1216,7 +1256,7 @@ var ResetPasswordForm = ({ onScreenChange, onError, searchParams, onResetSuccess
1216
1256
  setValidatingCode(false);
1217
1257
  return;
1218
1258
  }
1219
- const linkParam = searchParams.get("link");
1259
+ const linkParam = getParam("link");
1220
1260
  if (linkParam) {
1221
1261
  try {
1222
1262
  const decodedLink = decodeURIComponent(linkParam);
@@ -1433,6 +1473,11 @@ var import_react8 = require("react");
1433
1473
  var import_material4 = require("@mui/material");
1434
1474
  var import_jsx_runtime7 = require("react/jsx-runtime");
1435
1475
  var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1476
+ console.log("\u{1F522} CheckCodeForm - Component initialized with props:", {
1477
+ onScreenChange: !!onScreenChange,
1478
+ onError: !!onError,
1479
+ searchParams
1480
+ });
1436
1481
  const { crudify: crudify3 } = useCrudify();
1437
1482
  const [code, setCode] = (0, import_react8.useState)("");
1438
1483
  const [loading, setLoading] = (0, import_react8.useState)(false);
@@ -1440,6 +1485,13 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1440
1485
  const [helperTextCode, setHelperTextCode] = (0, import_react8.useState)(null);
1441
1486
  const [email, setEmail] = (0, import_react8.useState)("");
1442
1487
  const { t } = useTranslation();
1488
+ const getParam = (key) => {
1489
+ if (!searchParams) return null;
1490
+ if (searchParams instanceof URLSearchParams) {
1491
+ return searchParams.get(key);
1492
+ }
1493
+ return searchParams[key] || null;
1494
+ };
1443
1495
  const translateError = (parsedError) => {
1444
1496
  const possibleKeys = [
1445
1497
  `errors.auth.${parsedError.code}`,
@@ -1457,10 +1509,17 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1457
1509
  return parsedError.message || t("error.unknown");
1458
1510
  };
1459
1511
  (0, import_react8.useEffect)(() => {
1460
- const emailParam = searchParams?.get("email");
1512
+ console.log("\u{1F522} CheckCodeForm - useEffect triggered:", {
1513
+ searchParams,
1514
+ onScreenChange: !!onScreenChange
1515
+ });
1516
+ const emailParam = getParam("email");
1517
+ console.log("\u{1F522} CheckCodeForm - emailParam extracted:", emailParam);
1461
1518
  if (emailParam) {
1519
+ console.log("\u{1F522} CheckCodeForm - Setting email:", emailParam);
1462
1520
  setEmail(emailParam);
1463
1521
  } else {
1522
+ console.log("\u{1F522} CheckCodeForm - No email found, redirecting to forgotPassword");
1464
1523
  onScreenChange?.("forgotPassword");
1465
1524
  }
1466
1525
  }, [searchParams, onScreenChange]);
@@ -1504,6 +1563,7 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1504
1563
  }
1505
1564
  };
1506
1565
  const handleBack = () => {
1566
+ console.log("\u{1F522} CheckCodeForm - handleBack called");
1507
1567
  onScreenChange?.("forgotPassword");
1508
1568
  };
1509
1569
  const handleCodeChange = (event) => {
@@ -1645,10 +1705,22 @@ var CrudifyLoginInternal = ({
1645
1705
  const { t } = useTranslation();
1646
1706
  const { state, setScreen } = useLoginState();
1647
1707
  const handleScreenChange = (screen2, params) => {
1708
+ console.log("\u{1F504} CrudifyLoginInternal - handleScreenChange called:", {
1709
+ currentScreen: state.currentScreen,
1710
+ newScreen: screen2,
1711
+ params,
1712
+ stateSearchParams: state.searchParams
1713
+ });
1648
1714
  setScreen(screen2, params);
1649
1715
  onScreenChange?.(screen2, params);
1716
+ console.log("\u2705 CrudifyLoginInternal - screen change completed");
1650
1717
  };
1651
1718
  const renderCurrentForm = () => {
1719
+ console.log("\u{1F3A8} CrudifyLoginInternal - renderCurrentForm called:", {
1720
+ currentScreen: state.currentScreen,
1721
+ searchParams: state.searchParams,
1722
+ config: state.config
1723
+ });
1652
1724
  const commonProps = {
1653
1725
  onScreenChange: handleScreenChange,
1654
1726
  onExternalNavigate,
@@ -1657,20 +1729,26 @@ var CrudifyLoginInternal = ({
1657
1729
  };
1658
1730
  switch (state.currentScreen) {
1659
1731
  case "forgotPassword":
1732
+ console.log("\u{1F4E7} Rendering ForgotPasswordForm");
1660
1733
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ForgotPasswordForm_default, { ...commonProps });
1661
1734
  case "checkCode":
1662
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckCodeForm_default, { ...commonProps });
1735
+ console.log("\u{1F522} Rendering CheckCodeForm with params:", state.searchParams);
1736
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckCodeForm_default, { ...commonProps, searchParams: state.searchParams });
1663
1737
  case "resetPassword":
1738
+ console.log("\u{1F510} Rendering ResetPasswordForm with params:", state.searchParams);
1664
1739
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1665
1740
  ResetPasswordForm_default,
1666
1741
  {
1667
1742
  ...commonProps,
1743
+ searchParams: state.searchParams,
1668
1744
  onResetSuccess: () => {
1745
+ console.log("\u2705 ResetPasswordForm - onResetSuccess called");
1669
1746
  handleScreenChange("login");
1670
1747
  }
1671
1748
  }
1672
1749
  );
1673
1750
  default:
1751
+ console.log("\u{1F3E0} Rendering LoginForm (default)");
1674
1752
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LoginForm_default, { ...commonProps, onLoginSuccess });
1675
1753
  }
1676
1754
  };
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,
@@ -211,10 +223,13 @@ function loginStateReducer(state, action) {
211
223
  // Clear related errors when updating form data
212
224
  errors: {
213
225
  ...state.errors,
214
- ...Object.keys(action.payload).reduce((acc, key) => ({
215
- ...acc,
216
- [key]: void 0
217
- }), {})
226
+ ...Object.keys(action.payload).reduce(
227
+ (acc, key) => ({
228
+ ...acc,
229
+ [key]: void 0
230
+ }),
231
+ {}
232
+ )
218
233
  }
219
234
  };
220
235
  case "SET_LOADING":
@@ -282,6 +297,11 @@ var LoginStateProvider = ({
282
297
  config: providedConfig,
283
298
  autoReadFromCookies = true
284
299
  }) => {
300
+ console.log("\u{1F3D7}\uFE0F LoginStateProvider - Component initialized with:", {
301
+ initialScreen,
302
+ providedConfig,
303
+ autoReadFromCookies
304
+ });
285
305
  const [state, dispatch] = useReducer(loginStateReducer, {
286
306
  ...initialState,
287
307
  currentScreen: initialScreen
@@ -342,6 +362,11 @@ var LoginStateProvider = ({
342
362
  }
343
363
  }, [initialScreen]);
344
364
  const setScreen = (screen2, params) => {
365
+ console.log("\u{1F504} LoginStateProvider - setScreen called:", {
366
+ currentScreen: state.currentScreen,
367
+ targetScreen: screen2,
368
+ params
369
+ });
345
370
  dispatch({ type: "SET_SCREEN", payload: { screen: screen2, params } });
346
371
  };
347
372
  const updateFormData = (data) => {
@@ -1042,7 +1067,14 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1042
1067
  onScreenChange?.("login");
1043
1068
  };
1044
1069
  const handleGoToCheckCode = () => {
1070
+ console.log("\u{1F4E7} ForgotPasswordForm - handleGoToCheckCode called:", {
1071
+ emailSent,
1072
+ codeAlreadyExists,
1073
+ email,
1074
+ onScreenChange: !!onScreenChange
1075
+ });
1045
1076
  if (emailSent || codeAlreadyExists) {
1077
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating to checkCode with email:", email);
1046
1078
  onScreenChange?.("checkCode", { email });
1047
1079
  return;
1048
1080
  }
@@ -1054,6 +1086,7 @@ var ForgotPasswordForm = ({ onScreenChange, onError }) => {
1054
1086
  setHelperTextEmail(t("forgotPassword.invalidEmail"));
1055
1087
  return;
1056
1088
  }
1089
+ console.log("\u{1F4E7} ForgotPasswordForm - Navigating to checkCode with validated email:", email);
1057
1090
  onScreenChange?.("checkCode", { email });
1058
1091
  };
1059
1092
  if (emailSent || codeAlreadyExists) {
@@ -1149,14 +1182,21 @@ var ResetPasswordForm = ({ onScreenChange, onError, searchParams, onResetSuccess
1149
1182
  }
1150
1183
  return parsedError.message || t("error.unknown");
1151
1184
  };
1185
+ const getParam = (key) => {
1186
+ if (!searchParams) return null;
1187
+ if (searchParams instanceof URLSearchParams) {
1188
+ return searchParams.get(key);
1189
+ }
1190
+ return searchParams[key] || null;
1191
+ };
1152
1192
  useEffect5(() => {
1153
1193
  if (!searchParams) {
1154
1194
  return;
1155
1195
  }
1156
1196
  if (searchParams) {
1157
- const fromCodeVerificationParam = searchParams.get("fromCodeVerification");
1158
- const emailParam = searchParams.get("email");
1159
- const codeParam = searchParams.get("code");
1197
+ const fromCodeVerificationParam = getParam("fromCodeVerification");
1198
+ const emailParam = getParam("email");
1199
+ const codeParam = getParam("code");
1160
1200
  if (fromCodeVerificationParam === "true" && emailParam && codeParam) {
1161
1201
  setEmail(emailParam);
1162
1202
  setCode(codeParam);
@@ -1165,7 +1205,7 @@ var ResetPasswordForm = ({ onScreenChange, onError, searchParams, onResetSuccess
1165
1205
  setValidatingCode(false);
1166
1206
  return;
1167
1207
  }
1168
- const linkParam = searchParams.get("link");
1208
+ const linkParam = getParam("link");
1169
1209
  if (linkParam) {
1170
1210
  try {
1171
1211
  const decodedLink = decodeURIComponent(linkParam);
@@ -1382,6 +1422,11 @@ import { useState as useState5, useEffect as useEffect6 } from "react";
1382
1422
  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
1423
  import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1384
1424
  var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1425
+ console.log("\u{1F522} CheckCodeForm - Component initialized with props:", {
1426
+ onScreenChange: !!onScreenChange,
1427
+ onError: !!onError,
1428
+ searchParams
1429
+ });
1385
1430
  const { crudify: crudify3 } = useCrudify();
1386
1431
  const [code, setCode] = useState5("");
1387
1432
  const [loading, setLoading] = useState5(false);
@@ -1389,6 +1434,13 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1389
1434
  const [helperTextCode, setHelperTextCode] = useState5(null);
1390
1435
  const [email, setEmail] = useState5("");
1391
1436
  const { t } = useTranslation();
1437
+ const getParam = (key) => {
1438
+ if (!searchParams) return null;
1439
+ if (searchParams instanceof URLSearchParams) {
1440
+ return searchParams.get(key);
1441
+ }
1442
+ return searchParams[key] || null;
1443
+ };
1392
1444
  const translateError = (parsedError) => {
1393
1445
  const possibleKeys = [
1394
1446
  `errors.auth.${parsedError.code}`,
@@ -1406,10 +1458,17 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1406
1458
  return parsedError.message || t("error.unknown");
1407
1459
  };
1408
1460
  useEffect6(() => {
1409
- const emailParam = searchParams?.get("email");
1461
+ console.log("\u{1F522} CheckCodeForm - useEffect triggered:", {
1462
+ searchParams,
1463
+ onScreenChange: !!onScreenChange
1464
+ });
1465
+ const emailParam = getParam("email");
1466
+ console.log("\u{1F522} CheckCodeForm - emailParam extracted:", emailParam);
1410
1467
  if (emailParam) {
1468
+ console.log("\u{1F522} CheckCodeForm - Setting email:", emailParam);
1411
1469
  setEmail(emailParam);
1412
1470
  } else {
1471
+ console.log("\u{1F522} CheckCodeForm - No email found, redirecting to forgotPassword");
1413
1472
  onScreenChange?.("forgotPassword");
1414
1473
  }
1415
1474
  }, [searchParams, onScreenChange]);
@@ -1453,6 +1512,7 @@ var CheckCodeForm = ({ onScreenChange, onError, searchParams }) => {
1453
1512
  }
1454
1513
  };
1455
1514
  const handleBack = () => {
1515
+ console.log("\u{1F522} CheckCodeForm - handleBack called");
1456
1516
  onScreenChange?.("forgotPassword");
1457
1517
  };
1458
1518
  const handleCodeChange = (event) => {
@@ -1594,10 +1654,22 @@ var CrudifyLoginInternal = ({
1594
1654
  const { t } = useTranslation();
1595
1655
  const { state, setScreen } = useLoginState();
1596
1656
  const handleScreenChange = (screen2, params) => {
1657
+ console.log("\u{1F504} CrudifyLoginInternal - handleScreenChange called:", {
1658
+ currentScreen: state.currentScreen,
1659
+ newScreen: screen2,
1660
+ params,
1661
+ stateSearchParams: state.searchParams
1662
+ });
1597
1663
  setScreen(screen2, params);
1598
1664
  onScreenChange?.(screen2, params);
1665
+ console.log("\u2705 CrudifyLoginInternal - screen change completed");
1599
1666
  };
1600
1667
  const renderCurrentForm = () => {
1668
+ console.log("\u{1F3A8} CrudifyLoginInternal - renderCurrentForm called:", {
1669
+ currentScreen: state.currentScreen,
1670
+ searchParams: state.searchParams,
1671
+ config: state.config
1672
+ });
1601
1673
  const commonProps = {
1602
1674
  onScreenChange: handleScreenChange,
1603
1675
  onExternalNavigate,
@@ -1606,20 +1678,26 @@ var CrudifyLoginInternal = ({
1606
1678
  };
1607
1679
  switch (state.currentScreen) {
1608
1680
  case "forgotPassword":
1681
+ console.log("\u{1F4E7} Rendering ForgotPasswordForm");
1609
1682
  return /* @__PURE__ */ jsx9(ForgotPasswordForm_default, { ...commonProps });
1610
1683
  case "checkCode":
1611
- return /* @__PURE__ */ jsx9(CheckCodeForm_default, { ...commonProps });
1684
+ console.log("\u{1F522} Rendering CheckCodeForm with params:", state.searchParams);
1685
+ return /* @__PURE__ */ jsx9(CheckCodeForm_default, { ...commonProps, searchParams: state.searchParams });
1612
1686
  case "resetPassword":
1687
+ console.log("\u{1F510} Rendering ResetPasswordForm with params:", state.searchParams);
1613
1688
  return /* @__PURE__ */ jsx9(
1614
1689
  ResetPasswordForm_default,
1615
1690
  {
1616
1691
  ...commonProps,
1692
+ searchParams: state.searchParams,
1617
1693
  onResetSuccess: () => {
1694
+ console.log("\u2705 ResetPasswordForm - onResetSuccess called");
1618
1695
  handleScreenChange("login");
1619
1696
  }
1620
1697
  }
1621
1698
  );
1622
1699
  default:
1700
+ console.log("\u{1F3E0} Rendering LoginForm (default)");
1623
1701
  return /* @__PURE__ */ jsx9(LoginForm_default, { ...commonProps, onLoginSuccess });
1624
1702
  }
1625
1703
  };
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.74",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",