@nocios/crudify-ui 1.0.57 → 1.0.58

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
@@ -730,56 +730,6 @@ var ResetPasswordForm = ({ config, onNavigate, onError, searchParams, onResetSuc
730
730
  const { t } = useTranslation();
731
731
  const { crudify: crudify3 } = useCrudifyLogin(config);
732
732
  (0, import_react6.useEffect)(() => {
733
- const validateCode = async (emailToValidate, codeToValidate) => {
734
- if (!crudify3) {
735
- console.log("\u23F3 Crudify not ready yet, skipping validation");
736
- return;
737
- }
738
- console.log("\u{1F50D} Validating reset code:", { emailToValidate, codeToValidate });
739
- try {
740
- const data = [
741
- {
742
- operation: "validatePasswordResetCode",
743
- data: { email: emailToValidate, codePassword: codeToValidate }
744
- }
745
- ];
746
- console.log("\u{1F4E4} Sending validation request:", data);
747
- const response = await crudify3.transaction(data);
748
- console.log("\u{1F4E5} Validation response:", response);
749
- if (response.success) {
750
- console.log("\u2705 Code validation successful");
751
- setCodeValidated(true);
752
- } else {
753
- console.log("\u274C Code validation failed:", response);
754
- if (response.data?.response?.status === "TOO_MANY_REQUESTS") {
755
- setErrors([t("errors.auth.TOO_MANY_REQUESTS")]);
756
- } else {
757
- let errorMessage = t("resetPassword.invalidCode");
758
- if (response.errors?._error) {
759
- const error = response.errors._error[0];
760
- if (error === "TOO_MANY_REQUESTS") {
761
- errorMessage = t("errors.auth.TOO_MANY_REQUESTS");
762
- } else {
763
- const errorMsg = error?.toLowerCase() || "";
764
- if (errorMsg.includes("expired")) {
765
- errorMessage = t("resetPassword.codeExpiredOrInvalid");
766
- } else if (errorMsg.includes("invalid")) {
767
- errorMessage = t("resetPassword.invalidCode");
768
- }
769
- }
770
- }
771
- setErrors([errorMessage]);
772
- }
773
- setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
774
- }
775
- } catch (error) {
776
- console.error("Code validation error:", error);
777
- setErrors([t("resetPassword.invalidCode")]);
778
- setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
779
- } finally {
780
- setValidatingCode(false);
781
- }
782
- };
783
733
  if (searchParams) {
784
734
  const fromCodeVerificationParam = searchParams.get("fromCodeVerification");
785
735
  const emailParam = searchParams.get("email");
@@ -802,12 +752,8 @@ var ResetPasswordForm = ({ config, onNavigate, onError, searchParams, onResetSuc
802
752
  setCode(linkCode);
803
753
  setEmail(linkEmail);
804
754
  setFromCodeVerification(false);
805
- if (!crudify3) {
806
- console.log("\u23F3 Crudify not ready, saving pending validation");
807
- setPendingValidation({ email: linkEmail, code: linkCode });
808
- } else {
809
- validateCode(linkEmail, linkCode);
810
- }
755
+ console.log("\u23F3 Setting pending validation for reset link");
756
+ setPendingValidation({ email: linkEmail, code: linkCode });
811
757
  return;
812
758
  }
813
759
  } catch (error) {
@@ -818,7 +764,8 @@ var ResetPasswordForm = ({ config, onNavigate, onError, searchParams, onResetSuc
818
764
  setEmail(emailParam);
819
765
  setCode(codeParam);
820
766
  setFromCodeVerification(false);
821
- validateCode(emailParam, codeParam);
767
+ console.log("\u23F3 Setting pending validation for direct params");
768
+ setPendingValidation({ email: emailParam, code: codeParam });
822
769
  return;
823
770
  }
824
771
  }
package/dist/index.mjs CHANGED
@@ -686,56 +686,6 @@ var ResetPasswordForm = ({ config, onNavigate, onError, searchParams, onResetSuc
686
686
  const { t } = useTranslation();
687
687
  const { crudify: crudify3 } = useCrudifyLogin(config);
688
688
  useEffect4(() => {
689
- const validateCode = async (emailToValidate, codeToValidate) => {
690
- if (!crudify3) {
691
- console.log("\u23F3 Crudify not ready yet, skipping validation");
692
- return;
693
- }
694
- console.log("\u{1F50D} Validating reset code:", { emailToValidate, codeToValidate });
695
- try {
696
- const data = [
697
- {
698
- operation: "validatePasswordResetCode",
699
- data: { email: emailToValidate, codePassword: codeToValidate }
700
- }
701
- ];
702
- console.log("\u{1F4E4} Sending validation request:", data);
703
- const response = await crudify3.transaction(data);
704
- console.log("\u{1F4E5} Validation response:", response);
705
- if (response.success) {
706
- console.log("\u2705 Code validation successful");
707
- setCodeValidated(true);
708
- } else {
709
- console.log("\u274C Code validation failed:", response);
710
- if (response.data?.response?.status === "TOO_MANY_REQUESTS") {
711
- setErrors([t("errors.auth.TOO_MANY_REQUESTS")]);
712
- } else {
713
- let errorMessage = t("resetPassword.invalidCode");
714
- if (response.errors?._error) {
715
- const error = response.errors._error[0];
716
- if (error === "TOO_MANY_REQUESTS") {
717
- errorMessage = t("errors.auth.TOO_MANY_REQUESTS");
718
- } else {
719
- const errorMsg = error?.toLowerCase() || "";
720
- if (errorMsg.includes("expired")) {
721
- errorMessage = t("resetPassword.codeExpiredOrInvalid");
722
- } else if (errorMsg.includes("invalid")) {
723
- errorMessage = t("resetPassword.invalidCode");
724
- }
725
- }
726
- }
727
- setErrors([errorMessage]);
728
- }
729
- setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
730
- }
731
- } catch (error) {
732
- console.error("Code validation error:", error);
733
- setErrors([t("resetPassword.invalidCode")]);
734
- setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
735
- } finally {
736
- setValidatingCode(false);
737
- }
738
- };
739
689
  if (searchParams) {
740
690
  const fromCodeVerificationParam = searchParams.get("fromCodeVerification");
741
691
  const emailParam = searchParams.get("email");
@@ -758,12 +708,8 @@ var ResetPasswordForm = ({ config, onNavigate, onError, searchParams, onResetSuc
758
708
  setCode(linkCode);
759
709
  setEmail(linkEmail);
760
710
  setFromCodeVerification(false);
761
- if (!crudify3) {
762
- console.log("\u23F3 Crudify not ready, saving pending validation");
763
- setPendingValidation({ email: linkEmail, code: linkCode });
764
- } else {
765
- validateCode(linkEmail, linkCode);
766
- }
711
+ console.log("\u23F3 Setting pending validation for reset link");
712
+ setPendingValidation({ email: linkEmail, code: linkCode });
767
713
  return;
768
714
  }
769
715
  } catch (error) {
@@ -774,7 +720,8 @@ var ResetPasswordForm = ({ config, onNavigate, onError, searchParams, onResetSuc
774
720
  setEmail(emailParam);
775
721
  setCode(codeParam);
776
722
  setFromCodeVerification(false);
777
- validateCode(emailParam, codeParam);
723
+ console.log("\u23F3 Setting pending validation for direct params");
724
+ setPendingValidation({ email: emailParam, code: codeParam });
778
725
  return;
779
726
  }
780
727
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",