@nocios/crudify-ui 1.0.63 → 1.0.65
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 +89 -81
- package/dist/index.mjs +97 -89
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -722,78 +722,66 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
722
722
|
crudifyKeys: crudify3 ? Object.keys(crudify3) : null
|
|
723
723
|
});
|
|
724
724
|
if (crudify3 && pendingValidation) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
725
|
+
console.log("\u{1F680} Crudify verified ready! Executing pending validation:", pendingValidation);
|
|
726
|
+
console.log("\u{1F50D} Crudify object details:", {
|
|
727
|
+
hasTransaction: typeof crudify3.transaction === "function",
|
|
728
|
+
hasLogin: typeof crudify3.login === "function",
|
|
729
|
+
crudifyInstance: crudify3
|
|
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?.()
|
|
731
737
|
});
|
|
732
738
|
try {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
console.log("\u{
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
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);
|
|
739
|
+
const data = [
|
|
740
|
+
{
|
|
741
|
+
operation: "validatePasswordResetCode",
|
|
742
|
+
data: { email: emailToValidate, codePassword: codeToValidate }
|
|
743
|
+
}
|
|
744
|
+
];
|
|
745
|
+
console.log("\u{1F4E4} Sending validation request:", data);
|
|
746
|
+
console.log("\u{1F3AF} About to call crudify.transaction...");
|
|
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")]);
|
|
762
756
|
} else {
|
|
763
|
-
|
|
764
|
-
if (response.
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
errorMessage = t("
|
|
772
|
-
} else {
|
|
773
|
-
|
|
774
|
-
if (errorMsg.includes("expired")) {
|
|
775
|
-
errorMessage = t("resetPassword.codeExpiredOrInvalid");
|
|
776
|
-
} else if (errorMsg.includes("invalid")) {
|
|
777
|
-
errorMessage = t("resetPassword.invalidCode");
|
|
778
|
-
}
|
|
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");
|
|
779
768
|
}
|
|
780
769
|
}
|
|
781
|
-
setErrors([errorMessage]);
|
|
782
770
|
}
|
|
783
|
-
|
|
771
|
+
setErrors([errorMessage]);
|
|
784
772
|
}
|
|
785
|
-
} catch (error) {
|
|
786
|
-
console.error("Code validation error:", error);
|
|
787
|
-
setErrors([t("resetPassword.invalidCode")]);
|
|
788
773
|
setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
|
|
789
|
-
} finally {
|
|
790
|
-
setValidatingCode(false);
|
|
791
|
-
setPendingValidation(null);
|
|
792
774
|
}
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
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
|
+
setPendingValidation(null);
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
validateCode(pendingValidation.email, pendingValidation.code);
|
|
797
785
|
}
|
|
798
786
|
}, [crudify3, pendingValidation, t, onNavigate]);
|
|
799
787
|
const validatePassword = (password) => {
|
|
@@ -1130,6 +1118,7 @@ var getCookie = (name) => {
|
|
|
1130
1118
|
|
|
1131
1119
|
// src/components/CrudifyLogin/hooks/useCrudifyLogin.ts
|
|
1132
1120
|
var useCrudifyLogin = (config, _options = {}) => {
|
|
1121
|
+
const [isInitialized, setIsInitialized] = (0, import_react7.useState)(false);
|
|
1133
1122
|
const finalConfig = (0, import_react7.useMemo)(() => {
|
|
1134
1123
|
const publicApiKey = config.publicApiKey || getCookie("publicApiKey") || null;
|
|
1135
1124
|
const rawEnv = config.env || getCookie("environment") || "prod";
|
|
@@ -1158,44 +1147,63 @@ var useCrudifyLogin = (config, _options = {}) => {
|
|
|
1158
1147
|
});
|
|
1159
1148
|
if (!finalConfig.publicApiKey) {
|
|
1160
1149
|
console.log("\u274C No publicApiKey, skipping crudify initialization");
|
|
1150
|
+
setIsInitialized(false);
|
|
1161
1151
|
return;
|
|
1162
1152
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1153
|
+
const initializeCrudify = async () => {
|
|
1154
|
+
try {
|
|
1155
|
+
console.log("\u2699\uFE0F Configuring crudify with env:", finalConfig.env);
|
|
1156
|
+
import_crudify_browser.default.config(finalConfig.env);
|
|
1157
|
+
console.log("\u{1F680} Initializing crudify with publicApiKey:", finalConfig.publicApiKey.substring(0, 10) + "...");
|
|
1158
|
+
import_crudify_browser.default.init(finalConfig.publicApiKey, "none");
|
|
1159
|
+
console.log("\u{1F9EA} Testing crudify initialization...");
|
|
1160
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
1161
|
+
if (typeof import_crudify_browser.default.transaction === "function" && typeof import_crudify_browser.default.login === "function") {
|
|
1162
|
+
console.log("\u2705 Crudify initialization verified and ready");
|
|
1163
|
+
setIsInitialized(true);
|
|
1164
|
+
} else {
|
|
1165
|
+
console.log("\u274C Crudify methods not properly initialized");
|
|
1166
|
+
setIsInitialized(false);
|
|
1167
|
+
}
|
|
1168
|
+
console.log("\u{1F50D} Crudify state after init:", {
|
|
1169
|
+
hasTransaction: typeof import_crudify_browser.default.transaction === "function",
|
|
1170
|
+
hasLogin: typeof import_crudify_browser.default.login === "function",
|
|
1171
|
+
isInitialized: true,
|
|
1172
|
+
crudifyObject: import_crudify_browser.default
|
|
1173
|
+
});
|
|
1174
|
+
} catch (error) {
|
|
1175
|
+
console.error("\u274C Error initializing crudify:", error);
|
|
1176
|
+
setIsInitialized(false);
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
initializeCrudify();
|
|
1177
1180
|
}, [finalConfig.publicApiKey, finalConfig.env]);
|
|
1178
1181
|
const crudifyMethods = (0, import_react7.useMemo)(() => {
|
|
1179
1182
|
console.log("\u{1F504} crudifyMethods useMemo triggered:", {
|
|
1180
1183
|
publicApiKey: !!finalConfig.publicApiKey,
|
|
1184
|
+
isInitialized,
|
|
1181
1185
|
crudifyLogin: typeof import_crudify_browser.default.login,
|
|
1182
1186
|
crudifyTransaction: typeof import_crudify_browser.default.transaction
|
|
1183
1187
|
});
|
|
1184
|
-
if (!finalConfig.publicApiKey) {
|
|
1185
|
-
console.log("\u274C
|
|
1188
|
+
if (!finalConfig.publicApiKey || !isInitialized) {
|
|
1189
|
+
console.log("\u274C Crudify not ready:", {
|
|
1190
|
+
publicApiKey: !!finalConfig.publicApiKey,
|
|
1191
|
+
isInitialized
|
|
1192
|
+
});
|
|
1186
1193
|
return null;
|
|
1187
1194
|
}
|
|
1188
1195
|
const methods = {
|
|
1189
1196
|
login: import_crudify_browser.default.login,
|
|
1190
1197
|
transaction: import_crudify_browser.default.transaction
|
|
1191
1198
|
};
|
|
1192
|
-
console.log("\u2705 Returning crudifyMethods:", {
|
|
1199
|
+
console.log("\u2705 Returning ready crudifyMethods:", {
|
|
1193
1200
|
hasLogin: typeof methods.login === "function",
|
|
1194
1201
|
hasTransaction: typeof methods.transaction === "function",
|
|
1202
|
+
isInitialized,
|
|
1195
1203
|
methods
|
|
1196
1204
|
});
|
|
1197
1205
|
return methods;
|
|
1198
|
-
}, [finalConfig.publicApiKey]);
|
|
1206
|
+
}, [finalConfig.publicApiKey, isInitialized]);
|
|
1199
1207
|
return { crudify: crudifyMethods };
|
|
1200
1208
|
};
|
|
1201
1209
|
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { default as default2 } from "@nocios/crudify-browser";
|
|
|
3
3
|
export * from "@nocios/crudify-browser";
|
|
4
4
|
|
|
5
5
|
// src/components/CrudifyLogin/index.tsx
|
|
6
|
-
import React2, { useState as
|
|
6
|
+
import React2, { useState as useState7, useMemo as useMemo3 } from "react";
|
|
7
7
|
import { Box as Box5, Typography as Typography5 } from "@mui/material";
|
|
8
8
|
|
|
9
9
|
// src/components/CrudifyLogin/context/I18nProvider.tsx
|
|
@@ -678,78 +678,66 @@ var ResetPasswordForm = ({ onNavigate, onError, searchParams, onResetSuccess, cr
|
|
|
678
678
|
crudifyKeys: crudify3 ? Object.keys(crudify3) : null
|
|
679
679
|
});
|
|
680
680
|
if (crudify3 && pendingValidation) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
681
|
+
console.log("\u{1F680} Crudify verified ready! Executing pending validation:", pendingValidation);
|
|
682
|
+
console.log("\u{1F50D} Crudify object details:", {
|
|
683
|
+
hasTransaction: typeof crudify3.transaction === "function",
|
|
684
|
+
hasLogin: typeof crudify3.login === "function",
|
|
685
|
+
crudifyInstance: crudify3
|
|
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?.()
|
|
687
693
|
});
|
|
688
694
|
try {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
console.log("\u{
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
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);
|
|
695
|
+
const data = [
|
|
696
|
+
{
|
|
697
|
+
operation: "validatePasswordResetCode",
|
|
698
|
+
data: { email: emailToValidate, codePassword: codeToValidate }
|
|
699
|
+
}
|
|
700
|
+
];
|
|
701
|
+
console.log("\u{1F4E4} Sending validation request:", data);
|
|
702
|
+
console.log("\u{1F3AF} About to call crudify.transaction...");
|
|
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")]);
|
|
718
712
|
} else {
|
|
719
|
-
|
|
720
|
-
if (response.
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
const
|
|
726
|
-
if (
|
|
727
|
-
errorMessage = t("
|
|
728
|
-
} else {
|
|
729
|
-
|
|
730
|
-
if (errorMsg.includes("expired")) {
|
|
731
|
-
errorMessage = t("resetPassword.codeExpiredOrInvalid");
|
|
732
|
-
} else if (errorMsg.includes("invalid")) {
|
|
733
|
-
errorMessage = t("resetPassword.invalidCode");
|
|
734
|
-
}
|
|
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");
|
|
735
724
|
}
|
|
736
725
|
}
|
|
737
|
-
setErrors([errorMessage]);
|
|
738
726
|
}
|
|
739
|
-
|
|
727
|
+
setErrors([errorMessage]);
|
|
740
728
|
}
|
|
741
|
-
} catch (error) {
|
|
742
|
-
console.error("Code validation error:", error);
|
|
743
|
-
setErrors([t("resetPassword.invalidCode")]);
|
|
744
729
|
setTimeout(() => onNavigate?.("/login/forgotPassword"), 3e3);
|
|
745
|
-
} finally {
|
|
746
|
-
setValidatingCode(false);
|
|
747
|
-
setPendingValidation(null);
|
|
748
730
|
}
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
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
|
+
setPendingValidation(null);
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
validateCode(pendingValidation.email, pendingValidation.code);
|
|
753
741
|
}
|
|
754
742
|
}, [crudify3, pendingValidation, t, onNavigate]);
|
|
755
743
|
const validatePassword = (password) => {
|
|
@@ -1075,7 +1063,7 @@ var CheckCodeForm = ({ onNavigate, onError, searchParams, crudify: crudify3 }) =
|
|
|
1075
1063
|
var CheckCodeForm_default = CheckCodeForm;
|
|
1076
1064
|
|
|
1077
1065
|
// src/components/CrudifyLogin/hooks/useCrudifyLogin.ts
|
|
1078
|
-
import { useMemo as useMemo2, useEffect as useEffect5 } from "react";
|
|
1066
|
+
import { useMemo as useMemo2, useEffect as useEffect5, useState as useState6 } from "react";
|
|
1079
1067
|
import crudify from "@nocios/crudify-browser";
|
|
1080
1068
|
|
|
1081
1069
|
// src/components/CrudifyLogin/utils/cookies.ts
|
|
@@ -1086,6 +1074,7 @@ var getCookie = (name) => {
|
|
|
1086
1074
|
|
|
1087
1075
|
// src/components/CrudifyLogin/hooks/useCrudifyLogin.ts
|
|
1088
1076
|
var useCrudifyLogin = (config, _options = {}) => {
|
|
1077
|
+
const [isInitialized, setIsInitialized] = useState6(false);
|
|
1089
1078
|
const finalConfig = useMemo2(() => {
|
|
1090
1079
|
const publicApiKey = config.publicApiKey || getCookie("publicApiKey") || null;
|
|
1091
1080
|
const rawEnv = config.env || getCookie("environment") || "prod";
|
|
@@ -1114,44 +1103,63 @@ var useCrudifyLogin = (config, _options = {}) => {
|
|
|
1114
1103
|
});
|
|
1115
1104
|
if (!finalConfig.publicApiKey) {
|
|
1116
1105
|
console.log("\u274C No publicApiKey, skipping crudify initialization");
|
|
1106
|
+
setIsInitialized(false);
|
|
1117
1107
|
return;
|
|
1118
1108
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1109
|
+
const initializeCrudify = async () => {
|
|
1110
|
+
try {
|
|
1111
|
+
console.log("\u2699\uFE0F Configuring crudify with env:", finalConfig.env);
|
|
1112
|
+
crudify.config(finalConfig.env);
|
|
1113
|
+
console.log("\u{1F680} Initializing crudify with publicApiKey:", finalConfig.publicApiKey.substring(0, 10) + "...");
|
|
1114
|
+
crudify.init(finalConfig.publicApiKey, "none");
|
|
1115
|
+
console.log("\u{1F9EA} Testing crudify initialization...");
|
|
1116
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
1117
|
+
if (typeof crudify.transaction === "function" && typeof crudify.login === "function") {
|
|
1118
|
+
console.log("\u2705 Crudify initialization verified and ready");
|
|
1119
|
+
setIsInitialized(true);
|
|
1120
|
+
} else {
|
|
1121
|
+
console.log("\u274C Crudify methods not properly initialized");
|
|
1122
|
+
setIsInitialized(false);
|
|
1123
|
+
}
|
|
1124
|
+
console.log("\u{1F50D} Crudify state after init:", {
|
|
1125
|
+
hasTransaction: typeof crudify.transaction === "function",
|
|
1126
|
+
hasLogin: typeof crudify.login === "function",
|
|
1127
|
+
isInitialized: true,
|
|
1128
|
+
crudifyObject: crudify
|
|
1129
|
+
});
|
|
1130
|
+
} catch (error) {
|
|
1131
|
+
console.error("\u274C Error initializing crudify:", error);
|
|
1132
|
+
setIsInitialized(false);
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
initializeCrudify();
|
|
1133
1136
|
}, [finalConfig.publicApiKey, finalConfig.env]);
|
|
1134
1137
|
const crudifyMethods = useMemo2(() => {
|
|
1135
1138
|
console.log("\u{1F504} crudifyMethods useMemo triggered:", {
|
|
1136
1139
|
publicApiKey: !!finalConfig.publicApiKey,
|
|
1140
|
+
isInitialized,
|
|
1137
1141
|
crudifyLogin: typeof crudify.login,
|
|
1138
1142
|
crudifyTransaction: typeof crudify.transaction
|
|
1139
1143
|
});
|
|
1140
|
-
if (!finalConfig.publicApiKey) {
|
|
1141
|
-
console.log("\u274C
|
|
1144
|
+
if (!finalConfig.publicApiKey || !isInitialized) {
|
|
1145
|
+
console.log("\u274C Crudify not ready:", {
|
|
1146
|
+
publicApiKey: !!finalConfig.publicApiKey,
|
|
1147
|
+
isInitialized
|
|
1148
|
+
});
|
|
1142
1149
|
return null;
|
|
1143
1150
|
}
|
|
1144
1151
|
const methods = {
|
|
1145
1152
|
login: crudify.login,
|
|
1146
1153
|
transaction: crudify.transaction
|
|
1147
1154
|
};
|
|
1148
|
-
console.log("\u2705 Returning crudifyMethods:", {
|
|
1155
|
+
console.log("\u2705 Returning ready crudifyMethods:", {
|
|
1149
1156
|
hasLogin: typeof methods.login === "function",
|
|
1150
1157
|
hasTransaction: typeof methods.transaction === "function",
|
|
1158
|
+
isInitialized,
|
|
1151
1159
|
methods
|
|
1152
1160
|
});
|
|
1153
1161
|
return methods;
|
|
1154
|
-
}, [finalConfig.publicApiKey]);
|
|
1162
|
+
}, [finalConfig.publicApiKey, isInitialized]);
|
|
1155
1163
|
return { crudify: crudifyMethods };
|
|
1156
1164
|
};
|
|
1157
1165
|
|
|
@@ -1167,8 +1175,8 @@ var CrudifyLoginInternal = ({
|
|
|
1167
1175
|
autoReadFromCookies = true
|
|
1168
1176
|
}) => {
|
|
1169
1177
|
const { t } = useTranslation();
|
|
1170
|
-
const [currentScreen, setCurrentScreen] =
|
|
1171
|
-
const [searchParams, setSearchParams] =
|
|
1178
|
+
const [currentScreen, setCurrentScreen] = useState7(initialScreen);
|
|
1179
|
+
const [searchParams, setSearchParams] = useState7();
|
|
1172
1180
|
console.log("\u{1F504} CrudifyLoginInternal RENDER:", { currentScreen, initialScreen });
|
|
1173
1181
|
React2.useEffect(() => {
|
|
1174
1182
|
const urlParams = new URLSearchParams(window.location.search);
|
|
@@ -1356,7 +1364,7 @@ var CrudifyLogin = ({
|
|
|
1356
1364
|
var CrudifyLogin_default = CrudifyLogin;
|
|
1357
1365
|
|
|
1358
1366
|
// src/hooks/useUserProfile.ts
|
|
1359
|
-
import { useState as
|
|
1367
|
+
import { useState as useState8, useEffect as useEffect6, useCallback, useRef as useRef2 } from "react";
|
|
1360
1368
|
import crudify2 from "@nocios/crudify-browser";
|
|
1361
1369
|
|
|
1362
1370
|
// src/utils/jwtUtils.ts
|
|
@@ -1402,9 +1410,9 @@ var isTokenExpired = (token) => {
|
|
|
1402
1410
|
// src/hooks/useUserProfile.ts
|
|
1403
1411
|
var useUserProfile = (options = {}) => {
|
|
1404
1412
|
const { autoFetch = true, retryOnError = false, maxRetries = 3 } = options;
|
|
1405
|
-
const [userProfile, setUserProfile] =
|
|
1406
|
-
const [loading, setLoading] =
|
|
1407
|
-
const [error, setError] =
|
|
1413
|
+
const [userProfile, setUserProfile] = useState8(null);
|
|
1414
|
+
const [loading, setLoading] = useState8(false);
|
|
1415
|
+
const [error, setError] = useState8(null);
|
|
1408
1416
|
const abortControllerRef = useRef2(null);
|
|
1409
1417
|
const mountedRef = useRef2(true);
|
|
1410
1418
|
const requestIdRef = useRef2(0);
|