@nocios/crudify-ui 1.0.67 → 1.0.69
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 +32 -1
- package/dist/index.mjs +32 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -669,8 +669,14 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
669
669
|
const [validatingCode, setValidatingCode] = (0, import_react5.useState)(true);
|
|
670
670
|
const [codeValidated, setCodeValidated] = (0, import_react5.useState)(false);
|
|
671
671
|
const [pendingValidation, setPendingValidation] = (0, import_react5.useState)(null);
|
|
672
|
+
const [isValidating, setIsValidating] = (0, import_react5.useState)(false);
|
|
672
673
|
const { t } = useTranslation();
|
|
673
674
|
(0, import_react5.useEffect)(() => {
|
|
675
|
+
if (!searchParams) {
|
|
676
|
+
console.log("\u{1F504} No searchParams yet, waiting...");
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
console.log("\u{1F504} Processing searchParams:", searchParams.toString());
|
|
674
680
|
if (searchParams) {
|
|
675
681
|
const fromCodeVerificationParam = searchParams.get("fromCodeVerification");
|
|
676
682
|
const emailParam = searchParams.get("email");
|
|
@@ -710,6 +716,7 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
710
716
|
return;
|
|
711
717
|
}
|
|
712
718
|
}
|
|
719
|
+
console.log("\u274C No valid reset parameters found");
|
|
713
720
|
setErrors([t("resetPassword.invalidCode")]);
|
|
714
721
|
setValidatingCode(false);
|
|
715
722
|
setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
|
|
@@ -721,13 +728,14 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
721
728
|
crudifyType: typeof crudify3,
|
|
722
729
|
crudifyKeys: crudify3 ? Object.keys(crudify3) : null
|
|
723
730
|
});
|
|
724
|
-
if (crudify3 && pendingValidation) {
|
|
731
|
+
if (crudify3 && pendingValidation && !isValidating) {
|
|
725
732
|
console.log("\u{1F680} Crudify verified ready! Executing pending validation:", pendingValidation);
|
|
726
733
|
console.log("\u{1F50D} Crudify object details:", {
|
|
727
734
|
hasTransaction: typeof crudify3.transaction === "function",
|
|
728
735
|
hasLogin: typeof crudify3.login === "function",
|
|
729
736
|
crudifyInstance: crudify3
|
|
730
737
|
});
|
|
738
|
+
setIsValidating(true);
|
|
731
739
|
const validateCode = async (emailToValidate, codeToValidate) => {
|
|
732
740
|
console.log("\u{1F50D} Validating reset code:", { emailToValidate, codeToValidate });
|
|
733
741
|
console.log("\u{1F4CB} Pre-validation crudify check:", {
|
|
@@ -746,11 +754,33 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
746
754
|
console.log("\u{1F3AF} About to call crudify.transaction...");
|
|
747
755
|
const response = await crudify3.transaction(data);
|
|
748
756
|
console.log("\u{1F4E5} Validation response:", response);
|
|
757
|
+
console.log("\u{1F4E5} Raw response type:", typeof response);
|
|
758
|
+
console.log("\u{1F4E5} Response keys:", Object.keys(response));
|
|
759
|
+
if (response.data) {
|
|
760
|
+
console.log("\u{1F4E5} Response.data type:", typeof response.data);
|
|
761
|
+
console.log("\u{1F4E5} Response.data content:", response.data);
|
|
762
|
+
}
|
|
763
|
+
if (response.data && Array.isArray(response.data)) {
|
|
764
|
+
console.log("\u{1F50D} Checking array response data:", response.data);
|
|
765
|
+
const validationResult = response.data[0];
|
|
766
|
+
if (validationResult && validationResult.response && validationResult.response.status === "OK") {
|
|
767
|
+
console.log("\u2705 Code validation successful (from array data)");
|
|
768
|
+
setCodeValidated(true);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
749
772
|
if (response.success) {
|
|
750
773
|
console.log("\u2705 Code validation successful");
|
|
751
774
|
setCodeValidated(true);
|
|
752
775
|
} else {
|
|
753
776
|
console.log("\u274C Code validation failed:", response);
|
|
777
|
+
console.log("\u274C Full error details:", {
|
|
778
|
+
success: response.success,
|
|
779
|
+
data: response.data,
|
|
780
|
+
errors: response.errors,
|
|
781
|
+
errorCode: response.errorCode,
|
|
782
|
+
fieldsWarning: response.fieldsWarning
|
|
783
|
+
});
|
|
754
784
|
if (response.data?.response?.status === "TOO_MANY_REQUESTS") {
|
|
755
785
|
setErrors([t("errors.auth.TOO_MANY_REQUESTS")]);
|
|
756
786
|
} else {
|
|
@@ -779,6 +809,7 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
779
809
|
} finally {
|
|
780
810
|
setValidatingCode(false);
|
|
781
811
|
setPendingValidation(null);
|
|
812
|
+
setIsValidating(false);
|
|
782
813
|
}
|
|
783
814
|
};
|
|
784
815
|
validateCode(pendingValidation.email, pendingValidation.code);
|
package/dist/index.mjs
CHANGED
|
@@ -625,8 +625,14 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
625
625
|
const [validatingCode, setValidatingCode] = useState4(true);
|
|
626
626
|
const [codeValidated, setCodeValidated] = useState4(false);
|
|
627
627
|
const [pendingValidation, setPendingValidation] = useState4(null);
|
|
628
|
+
const [isValidating, setIsValidating] = useState4(false);
|
|
628
629
|
const { t } = useTranslation();
|
|
629
630
|
useEffect3(() => {
|
|
631
|
+
if (!searchParams) {
|
|
632
|
+
console.log("\u{1F504} No searchParams yet, waiting...");
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
console.log("\u{1F504} Processing searchParams:", searchParams.toString());
|
|
630
636
|
if (searchParams) {
|
|
631
637
|
const fromCodeVerificationParam = searchParams.get("fromCodeVerification");
|
|
632
638
|
const emailParam = searchParams.get("email");
|
|
@@ -666,6 +672,7 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
666
672
|
return;
|
|
667
673
|
}
|
|
668
674
|
}
|
|
675
|
+
console.log("\u274C No valid reset parameters found");
|
|
669
676
|
setErrors([t("resetPassword.invalidCode")]);
|
|
670
677
|
setValidatingCode(false);
|
|
671
678
|
setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
|
|
@@ -677,13 +684,14 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
677
684
|
crudifyType: typeof crudify3,
|
|
678
685
|
crudifyKeys: crudify3 ? Object.keys(crudify3) : null
|
|
679
686
|
});
|
|
680
|
-
if (crudify3 && pendingValidation) {
|
|
687
|
+
if (crudify3 && pendingValidation && !isValidating) {
|
|
681
688
|
console.log("\u{1F680} Crudify verified ready! Executing pending validation:", pendingValidation);
|
|
682
689
|
console.log("\u{1F50D} Crudify object details:", {
|
|
683
690
|
hasTransaction: typeof crudify3.transaction === "function",
|
|
684
691
|
hasLogin: typeof crudify3.login === "function",
|
|
685
692
|
crudifyInstance: crudify3
|
|
686
693
|
});
|
|
694
|
+
setIsValidating(true);
|
|
687
695
|
const validateCode = async (emailToValidate, codeToValidate) => {
|
|
688
696
|
console.log("\u{1F50D} Validating reset code:", { emailToValidate, codeToValidate });
|
|
689
697
|
console.log("\u{1F4CB} Pre-validation crudify check:", {
|
|
@@ -702,11 +710,33 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
702
710
|
console.log("\u{1F3AF} About to call crudify.transaction...");
|
|
703
711
|
const response = await crudify3.transaction(data);
|
|
704
712
|
console.log("\u{1F4E5} Validation response:", response);
|
|
713
|
+
console.log("\u{1F4E5} Raw response type:", typeof response);
|
|
714
|
+
console.log("\u{1F4E5} Response keys:", Object.keys(response));
|
|
715
|
+
if (response.data) {
|
|
716
|
+
console.log("\u{1F4E5} Response.data type:", typeof response.data);
|
|
717
|
+
console.log("\u{1F4E5} Response.data content:", response.data);
|
|
718
|
+
}
|
|
719
|
+
if (response.data && Array.isArray(response.data)) {
|
|
720
|
+
console.log("\u{1F50D} Checking array response data:", response.data);
|
|
721
|
+
const validationResult = response.data[0];
|
|
722
|
+
if (validationResult && validationResult.response && validationResult.response.status === "OK") {
|
|
723
|
+
console.log("\u2705 Code validation successful (from array data)");
|
|
724
|
+
setCodeValidated(true);
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
705
728
|
if (response.success) {
|
|
706
729
|
console.log("\u2705 Code validation successful");
|
|
707
730
|
setCodeValidated(true);
|
|
708
731
|
} else {
|
|
709
732
|
console.log("\u274C Code validation failed:", response);
|
|
733
|
+
console.log("\u274C Full error details:", {
|
|
734
|
+
success: response.success,
|
|
735
|
+
data: response.data,
|
|
736
|
+
errors: response.errors,
|
|
737
|
+
errorCode: response.errorCode,
|
|
738
|
+
fieldsWarning: response.fieldsWarning
|
|
739
|
+
});
|
|
710
740
|
if (response.data?.response?.status === "TOO_MANY_REQUESTS") {
|
|
711
741
|
setErrors([t("errors.auth.TOO_MANY_REQUESTS")]);
|
|
712
742
|
} else {
|
|
@@ -735,6 +765,7 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
735
765
|
} finally {
|
|
736
766
|
setValidatingCode(false);
|
|
737
767
|
setPendingValidation(null);
|
|
768
|
+
setIsValidating(false);
|
|
738
769
|
}
|
|
739
770
|
};
|
|
740
771
|
validateCode(pendingValidation.email, pendingValidation.code);
|