@nocios/crudify-ui 1.0.61 → 1.0.63
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 +66 -54
- package/dist/index.mjs +66 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -504,7 +504,7 @@ var LoginForm_default = LoginForm;
|
|
|
504
504
|
var import_react4 = require("react");
|
|
505
505
|
var import_material2 = require("@mui/material");
|
|
506
506
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
507
|
-
var ForgotPasswordForm = ({
|
|
507
|
+
var ForgotPasswordForm = ({ onNavigate, onError, crudify: crudify3 }) => {
|
|
508
508
|
const [email, setEmail] = (0, import_react4.useState)("");
|
|
509
509
|
const [loading, setLoading] = (0, import_react4.useState)(false);
|
|
510
510
|
const [errors, setErrors] = (0, import_react4.useState)([]);
|
|
@@ -656,7 +656,7 @@ var ForgotPasswordForm_default = ForgotPasswordForm;
|
|
|
656
656
|
var import_react5 = require("react");
|
|
657
657
|
var import_material3 = require("@mui/material");
|
|
658
658
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
659
|
-
var ResetPasswordForm = ({
|
|
659
|
+
var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, crudify: crudify3 }) => {
|
|
660
660
|
const [newPassword, setNewPassword] = (0, import_react5.useState)("");
|
|
661
661
|
const [confirmPassword, setConfirmPassword] = (0, import_react5.useState)("");
|
|
662
662
|
const [loading, setLoading] = (0, import_react5.useState)(false);
|
|
@@ -722,66 +722,78 @@ var ResetPasswordForm = ({ config, onNavigate, onError, searchParams, onResetSuc
|
|
|
722
722
|
crudifyKeys: crudify3 ? Object.keys(crudify3) : null
|
|
723
723
|
});
|
|
724
724
|
if (crudify3 && pendingValidation) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
const validateCode = async (emailToValidate, codeToValidate) => {
|
|
732
|
-
console.log("\u{1F50D} Validating reset code:", { emailToValidate, codeToValidate });
|
|
733
|
-
console.log("\u{1F4CB} Pre-validation crudify check:", {
|
|
734
|
-
crudify: !!crudify3,
|
|
735
|
-
transaction: typeof crudify3?.transaction,
|
|
736
|
-
crudifyString: crudify3?.toString?.()
|
|
725
|
+
const timer = setTimeout(() => {
|
|
726
|
+
console.log("\u{1F680} Crudify ready! Executing pending validation after delay:", pendingValidation);
|
|
727
|
+
console.log("\u{1F50D} Crudify object details:", {
|
|
728
|
+
hasTransaction: typeof crudify3.transaction === "function",
|
|
729
|
+
hasLogin: typeof crudify3.login === "function",
|
|
730
|
+
crudifyInstance: crudify3
|
|
737
731
|
});
|
|
738
732
|
try {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
console.log("\u{
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
733
|
+
if (!crudify3.transaction) {
|
|
734
|
+
console.log("\u274C Crudify transaction method not available, deferring validation");
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
} catch (error) {
|
|
738
|
+
console.log("\u274C Error checking crudify state, deferring validation:", error);
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
const validateCode = async (emailToValidate, codeToValidate) => {
|
|
742
|
+
console.log("\u{1F50D} Validating reset code:", { emailToValidate, codeToValidate });
|
|
743
|
+
console.log("\u{1F4CB} Pre-validation crudify check:", {
|
|
744
|
+
crudify: !!crudify3,
|
|
745
|
+
transaction: typeof crudify3?.transaction,
|
|
746
|
+
crudifyString: crudify3?.toString?.()
|
|
747
|
+
});
|
|
748
|
+
try {
|
|
749
|
+
const data = [
|
|
750
|
+
{
|
|
751
|
+
operation: "validatePasswordResetCode",
|
|
752
|
+
data: { email: emailToValidate, codePassword: codeToValidate }
|
|
753
|
+
}
|
|
754
|
+
];
|
|
755
|
+
console.log("\u{1F4E4} Sending validation request:", data);
|
|
756
|
+
console.log("\u{1F3AF} About to call crudify.transaction...");
|
|
757
|
+
const response = await crudify3.transaction(data);
|
|
758
|
+
console.log("\u{1F4E5} Validation response:", response);
|
|
759
|
+
if (response.success) {
|
|
760
|
+
console.log("\u2705 Code validation successful");
|
|
761
|
+
setCodeValidated(true);
|
|
756
762
|
} else {
|
|
757
|
-
|
|
758
|
-
if (response.
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
errorMessage = t("
|
|
766
|
-
} else
|
|
767
|
-
|
|
763
|
+
console.log("\u274C Code validation failed:", response);
|
|
764
|
+
if (response.data?.response?.status === "TOO_MANY_REQUESTS") {
|
|
765
|
+
setErrors([t("errors.auth.TOO_MANY_REQUESTS")]);
|
|
766
|
+
} else {
|
|
767
|
+
let errorMessage = t("resetPassword.invalidCode");
|
|
768
|
+
if (response.errors?._error) {
|
|
769
|
+
const error = response.errors._error[0];
|
|
770
|
+
if (error === "TOO_MANY_REQUESTS") {
|
|
771
|
+
errorMessage = t("errors.auth.TOO_MANY_REQUESTS");
|
|
772
|
+
} else {
|
|
773
|
+
const errorMsg = error?.toLowerCase() || "";
|
|
774
|
+
if (errorMsg.includes("expired")) {
|
|
775
|
+
errorMessage = t("resetPassword.codeExpiredOrInvalid");
|
|
776
|
+
} else if (errorMsg.includes("invalid")) {
|
|
777
|
+
errorMessage = t("resetPassword.invalidCode");
|
|
778
|
+
}
|
|
768
779
|
}
|
|
769
780
|
}
|
|
781
|
+
setErrors([errorMessage]);
|
|
770
782
|
}
|
|
771
|
-
|
|
783
|
+
setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
|
|
772
784
|
}
|
|
785
|
+
} catch (error) {
|
|
786
|
+
console.error("Code validation error:", error);
|
|
787
|
+
setErrors([t("resetPassword.invalidCode")]);
|
|
773
788
|
setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
|
|
789
|
+
} finally {
|
|
790
|
+
setValidatingCode(false);
|
|
791
|
+
setPendingValidation(null);
|
|
774
792
|
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
} finally {
|
|
780
|
-
setValidatingCode(false);
|
|
781
|
-
setPendingValidation(null);
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
validateCode(pendingValidation.email, pendingValidation.code);
|
|
793
|
+
};
|
|
794
|
+
validateCode(pendingValidation.email, pendingValidation.code);
|
|
795
|
+
}, 100);
|
|
796
|
+
return () => clearTimeout(timer);
|
|
785
797
|
}
|
|
786
798
|
}, [crudify3, pendingValidation, t, onNavigate]);
|
|
787
799
|
const validatePassword = (password) => {
|
|
@@ -971,7 +983,7 @@ var ResetPasswordForm_default = ResetPasswordForm;
|
|
|
971
983
|
var import_react6 = require("react");
|
|
972
984
|
var import_material4 = require("@mui/material");
|
|
973
985
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
974
|
-
var CheckCodeForm = ({
|
|
986
|
+
var CheckCodeForm = ({ onNavigate, onError, searchParams, crudify: crudify3 }) => {
|
|
975
987
|
const [code, setCode] = (0, import_react6.useState)("");
|
|
976
988
|
const [loading, setLoading] = (0, import_react6.useState)(false);
|
|
977
989
|
const [errors, setErrors] = (0, import_react6.useState)([]);
|
package/dist/index.mjs
CHANGED
|
@@ -460,7 +460,7 @@ var LoginForm_default = LoginForm;
|
|
|
460
460
|
import { useState as useState3 } from "react";
|
|
461
461
|
import { Typography as Typography2, TextField as TextField2, Button as Button2, Box as Box2, CircularProgress as CircularProgress2, Alert as Alert2, Link as Link2 } from "@mui/material";
|
|
462
462
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
463
|
-
var ForgotPasswordForm = ({
|
|
463
|
+
var ForgotPasswordForm = ({ onNavigate, onError, crudify: crudify3 }) => {
|
|
464
464
|
const [email, setEmail] = useState3("");
|
|
465
465
|
const [loading, setLoading] = useState3(false);
|
|
466
466
|
const [errors, setErrors] = useState3([]);
|
|
@@ -612,7 +612,7 @@ var ForgotPasswordForm_default = ForgotPasswordForm;
|
|
|
612
612
|
import { useState as useState4, useEffect as useEffect3 } from "react";
|
|
613
613
|
import { Typography as Typography3, TextField as TextField3, Button as Button3, Box as Box3, CircularProgress as CircularProgress3, Alert as Alert3, Link as Link3 } from "@mui/material";
|
|
614
614
|
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
615
|
-
var ResetPasswordForm = ({
|
|
615
|
+
var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, crudify: crudify3 }) => {
|
|
616
616
|
const [newPassword, setNewPassword] = useState4("");
|
|
617
617
|
const [confirmPassword, setConfirmPassword] = useState4("");
|
|
618
618
|
const [loading, setLoading] = useState4(false);
|
|
@@ -678,66 +678,78 @@ var ResetPasswordForm = ({ config, onNavigate, onError, searchParams, onResetSuc
|
|
|
678
678
|
crudifyKeys: crudify3 ? Object.keys(crudify3) : null
|
|
679
679
|
});
|
|
680
680
|
if (crudify3 && pendingValidation) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
const validateCode = async (emailToValidate, codeToValidate) => {
|
|
688
|
-
console.log("\u{1F50D} Validating reset code:", { emailToValidate, codeToValidate });
|
|
689
|
-
console.log("\u{1F4CB} Pre-validation crudify check:", {
|
|
690
|
-
crudify: !!crudify3,
|
|
691
|
-
transaction: typeof crudify3?.transaction,
|
|
692
|
-
crudifyString: crudify3?.toString?.()
|
|
681
|
+
const timer = setTimeout(() => {
|
|
682
|
+
console.log("\u{1F680} Crudify ready! Executing pending validation after delay:", pendingValidation);
|
|
683
|
+
console.log("\u{1F50D} Crudify object details:", {
|
|
684
|
+
hasTransaction: typeof crudify3.transaction === "function",
|
|
685
|
+
hasLogin: typeof crudify3.login === "function",
|
|
686
|
+
crudifyInstance: crudify3
|
|
693
687
|
});
|
|
694
688
|
try {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
console.log("\u{
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
689
|
+
if (!crudify3.transaction) {
|
|
690
|
+
console.log("\u274C Crudify transaction method not available, deferring validation");
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
} catch (error) {
|
|
694
|
+
console.log("\u274C Error checking crudify state, deferring validation:", error);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
const validateCode = async (emailToValidate, codeToValidate) => {
|
|
698
|
+
console.log("\u{1F50D} Validating reset code:", { emailToValidate, codeToValidate });
|
|
699
|
+
console.log("\u{1F4CB} Pre-validation crudify check:", {
|
|
700
|
+
crudify: !!crudify3,
|
|
701
|
+
transaction: typeof crudify3?.transaction,
|
|
702
|
+
crudifyString: crudify3?.toString?.()
|
|
703
|
+
});
|
|
704
|
+
try {
|
|
705
|
+
const data = [
|
|
706
|
+
{
|
|
707
|
+
operation: "validatePasswordResetCode",
|
|
708
|
+
data: { email: emailToValidate, codePassword: codeToValidate }
|
|
709
|
+
}
|
|
710
|
+
];
|
|
711
|
+
console.log("\u{1F4E4} Sending validation request:", data);
|
|
712
|
+
console.log("\u{1F3AF} About to call crudify.transaction...");
|
|
713
|
+
const response = await crudify3.transaction(data);
|
|
714
|
+
console.log("\u{1F4E5} Validation response:", response);
|
|
715
|
+
if (response.success) {
|
|
716
|
+
console.log("\u2705 Code validation successful");
|
|
717
|
+
setCodeValidated(true);
|
|
712
718
|
} else {
|
|
713
|
-
|
|
714
|
-
if (response.
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
721
|
-
errorMessage = t("
|
|
722
|
-
} else
|
|
723
|
-
|
|
719
|
+
console.log("\u274C Code validation failed:", response);
|
|
720
|
+
if (response.data?.response?.status === "TOO_MANY_REQUESTS") {
|
|
721
|
+
setErrors([t("errors.auth.TOO_MANY_REQUESTS")]);
|
|
722
|
+
} else {
|
|
723
|
+
let errorMessage = t("resetPassword.invalidCode");
|
|
724
|
+
if (response.errors?._error) {
|
|
725
|
+
const error = response.errors._error[0];
|
|
726
|
+
if (error === "TOO_MANY_REQUESTS") {
|
|
727
|
+
errorMessage = t("errors.auth.TOO_MANY_REQUESTS");
|
|
728
|
+
} else {
|
|
729
|
+
const errorMsg = error?.toLowerCase() || "";
|
|
730
|
+
if (errorMsg.includes("expired")) {
|
|
731
|
+
errorMessage = t("resetPassword.codeExpiredOrInvalid");
|
|
732
|
+
} else if (errorMsg.includes("invalid")) {
|
|
733
|
+
errorMessage = t("resetPassword.invalidCode");
|
|
734
|
+
}
|
|
724
735
|
}
|
|
725
736
|
}
|
|
737
|
+
setErrors([errorMessage]);
|
|
726
738
|
}
|
|
727
|
-
|
|
739
|
+
setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
|
|
728
740
|
}
|
|
741
|
+
} catch (error) {
|
|
742
|
+
console.error("Code validation error:", error);
|
|
743
|
+
setErrors([t("resetPassword.invalidCode")]);
|
|
729
744
|
setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
|
|
745
|
+
} finally {
|
|
746
|
+
setValidatingCode(false);
|
|
747
|
+
setPendingValidation(null);
|
|
730
748
|
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
} finally {
|
|
736
|
-
setValidatingCode(false);
|
|
737
|
-
setPendingValidation(null);
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
validateCode(pendingValidation.email, pendingValidation.code);
|
|
749
|
+
};
|
|
750
|
+
validateCode(pendingValidation.email, pendingValidation.code);
|
|
751
|
+
}, 100);
|
|
752
|
+
return () => clearTimeout(timer);
|
|
741
753
|
}
|
|
742
754
|
}, [crudify3, pendingValidation, t, onNavigate]);
|
|
743
755
|
const validatePassword = (password) => {
|
|
@@ -927,7 +939,7 @@ var ResetPasswordForm_default = ResetPasswordForm;
|
|
|
927
939
|
import { useState as useState5, useEffect as useEffect4 } from "react";
|
|
928
940
|
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";
|
|
929
941
|
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
930
|
-
var CheckCodeForm = ({
|
|
942
|
+
var CheckCodeForm = ({ onNavigate, onError, searchParams, crudify: crudify3 }) => {
|
|
931
943
|
const [code, setCode] = useState5("");
|
|
932
944
|
const [loading, setLoading] = useState5(false);
|
|
933
945
|
const [errors, setErrors] = useState5([]);
|