touchstudy-core 0.1.85 → 0.1.86
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.
@@ -1,4 +1,3 @@
|
|
1
|
-
import { SignInOTPRequest } from "../configs/types";
|
2
1
|
export declare const getGoogleClientId: () => Promise<import("axios").AxiosResponse<any, any>>;
|
3
2
|
export declare const signInApi: ({ email, password, role }: {
|
4
3
|
email: string;
|
@@ -10,7 +9,11 @@ export declare const signInWithEmailApi: ({ academyDomain, email, reCaptcha }: {
|
|
10
9
|
email: string;
|
11
10
|
reCaptcha: string;
|
12
11
|
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
13
|
-
export declare const signInWithOTPApi: ({ academyDomain, otp,
|
12
|
+
export declare const signInWithOTPApi: ({ academyDomain, otp, role }: {
|
13
|
+
academyDomain: string;
|
14
|
+
otp: number;
|
15
|
+
role?: string | undefined;
|
16
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
14
17
|
export declare const signInWithKeyApi: ({ academyDomain, key, role }: {
|
15
18
|
academyDomain: string;
|
16
19
|
key: string;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { Role } from "../../../utils/constants";
|
3
|
-
import { LoginEmailRequest } from "../configs/types";
|
4
3
|
declare type LoginInfo = {
|
5
4
|
email: string;
|
6
5
|
otp: number | string;
|
@@ -27,7 +26,10 @@ declare const useLogin: ({ history, homeAcademyUrl, homeUrl, registerUrl, role }
|
|
27
26
|
isShowPassword: boolean;
|
28
27
|
setIsShowPassword: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
29
28
|
infoUser: any;
|
30
|
-
handleSubmit: (values:
|
29
|
+
handleSubmit: (values: {
|
30
|
+
email?: string;
|
31
|
+
otp?: number;
|
32
|
+
}) => Promise<void>;
|
31
33
|
setInfoUser: import("react").Dispatch<any>;
|
32
34
|
};
|
33
35
|
export default useLogin;
|
package/dist/index.js
CHANGED
@@ -799,11 +799,16 @@ var BlockLogin = function BlockLogin(_ref3) {
|
|
799
799
|
onSubmit: onSubmit
|
800
800
|
}, function (_ref4) {
|
801
801
|
var errors = _ref4.errors,
|
802
|
+
values = _ref4.values,
|
802
803
|
setFieldValue = _ref4.setFieldValue;
|
804
|
+
console.log({
|
805
|
+
errors: errors,
|
806
|
+
values: values
|
807
|
+
});
|
803
808
|
React.useEffect(function () {
|
804
|
-
if (
|
805
|
-
if (!isOTP && !isEmail) {
|
809
|
+
if (isOTP) {
|
806
810
|
setFieldValue("email", "");
|
811
|
+
} else {
|
807
812
|
setFieldValue("otp", "");
|
808
813
|
}
|
809
814
|
}, [isOTP, isEmail]);
|
@@ -839,9 +844,8 @@ var BlockLogin = function BlockLogin(_ref3) {
|
|
839
844
|
fontSize: "14px",
|
840
845
|
fontWeight: 700,
|
841
846
|
color: colors.blue[700]
|
842
|
-
}, t("sign_in_with_email"))))), (isEmail || isOTP) && React__default.createElement(material.Stack, null, React__default.createElement(material.Stack, {
|
847
|
+
}, t("sign_in_with_email"))))), (isEmail || isOTP) && React__default.createElement(material.Stack, null, !isOTP ? React__default.createElement(material.Stack, {
|
843
848
|
flexDirection: "column",
|
844
|
-
display: isOTP ? "none" : "flex",
|
845
849
|
gap: 1
|
846
850
|
}, React__default.createElement(material.Typography, {
|
847
851
|
fontWeight: 700,
|
@@ -857,9 +861,8 @@ var BlockLogin = function BlockLogin(_ref3) {
|
|
857
861
|
fontSize: "10px",
|
858
862
|
lineHeight: "11.93px",
|
859
863
|
color: !(errors !== null && errors !== void 0 && errors.email) ? "#97A1AF" : "#F34B4B"
|
860
|
-
}, errors === null || errors === void 0 ? void 0 : errors.email))
|
864
|
+
}, errors === null || errors === void 0 ? void 0 : errors.email)) : React__default.createElement(material.Stack, {
|
861
865
|
flexDirection: "column",
|
862
|
-
display: !isOTP ? "none" : "flex",
|
863
866
|
gap: 1
|
864
867
|
}, React__default.createElement(material.Typography, {
|
865
868
|
fontWeight: 700,
|
@@ -898,18 +901,10 @@ var BlockLogin = function BlockLogin(_ref3) {
|
|
898
901
|
color: colors.blue[700]
|
899
902
|
}, t("sign_in_with_google_account"))), React__default.createElement(material.Stack, {
|
900
903
|
flexDirection: "row",
|
901
|
-
justifyContent:
|
904
|
+
justifyContent: "end",
|
902
905
|
gap: 1,
|
903
906
|
mt: 2
|
904
|
-
},
|
905
|
-
variant: "contained",
|
906
|
-
color: "secondary",
|
907
|
-
className: "bg-secondary",
|
908
|
-
onClick: function onClick() {
|
909
|
-
handleSwitchEmail(true);
|
910
|
-
handleSwitchOTP(false);
|
911
|
-
}
|
912
|
-
}, t("back")), React__default.createElement(material.Button, {
|
907
|
+
}, React__default.createElement(material.Button, {
|
913
908
|
variant: "contained",
|
914
909
|
color: "primary",
|
915
910
|
type: "submit",
|
@@ -946,14 +941,10 @@ var signInWithEmailApi = function signInWithEmailApi(_ref2) {
|
|
946
941
|
var signInWithOTPApi = function signInWithOTPApi(_ref3) {
|
947
942
|
var academyDomain = _ref3.academyDomain,
|
948
943
|
otp = _ref3.otp,
|
949
|
-
email = _ref3.email,
|
950
|
-
reCaptcha = _ref3.reCaptcha,
|
951
944
|
role = _ref3.role;
|
952
945
|
return api.post((academyDomain ? SIGN_IN_URL : SIGN_IN_SUPER_ADMIN_URL) + "/otp", {
|
953
946
|
otp: otp,
|
954
|
-
|
955
|
-
role: role,
|
956
|
-
reCaptcha: reCaptcha
|
947
|
+
role: role
|
957
948
|
});
|
958
949
|
};
|
959
950
|
var signInWithKeyApi = function signInWithKeyApi(_ref4) {
|
@@ -1040,9 +1031,6 @@ var useLogin$1 = function useLogin(_ref) {
|
|
1040
1031
|
var handleSubmit = function handleSubmit(values) {
|
1041
1032
|
try {
|
1042
1033
|
var _temp5 = function _temp5() {
|
1043
|
-
setRefreshReCaptcha(function (b) {
|
1044
|
-
return !b;
|
1045
|
-
});
|
1046
1034
|
dispatch(setLoading(false));
|
1047
1035
|
};
|
1048
1036
|
if (!tokenReCaptcha) return Promise.resolve();
|
@@ -1052,13 +1040,11 @@ var useLogin$1 = function useLogin(_ref) {
|
|
1052
1040
|
var _temp4 = _catch(function () {
|
1053
1041
|
function _temp3() {
|
1054
1042
|
var _temp = function () {
|
1055
|
-
if (
|
1043
|
+
if (otp) {
|
1056
1044
|
return Promise.resolve(signInWithOTPApi({
|
1057
1045
|
academyDomain: academyDomain,
|
1058
|
-
email: email,
|
1059
1046
|
otp: otp,
|
1060
|
-
role: role
|
1061
|
-
reCaptcha: tokenReCaptcha
|
1047
|
+
role: role
|
1062
1048
|
})).then(function (res) {
|
1063
1049
|
var loginResponse = res === null || res === void 0 ? void 0 : res.data;
|
1064
1050
|
var isFirstLogin = loginResponse.isFirstLogin,
|
@@ -1075,7 +1061,7 @@ var useLogin$1 = function useLogin(_ref) {
|
|
1075
1061
|
if (_temp && _temp.then) return _temp.then(function () {});
|
1076
1062
|
}
|
1077
1063
|
var _temp2 = function () {
|
1078
|
-
if (email
|
1064
|
+
if (email) {
|
1079
1065
|
return Promise.resolve(signInWithEmailApi({
|
1080
1066
|
academyDomain: academyDomain,
|
1081
1067
|
email: email,
|
@@ -1084,6 +1070,9 @@ var useLogin$1 = function useLogin(_ref) {
|
|
1084
1070
|
reactToastify.toast.success(t("please_check_your_mailbox"));
|
1085
1071
|
handleSwitchOTP(true);
|
1086
1072
|
handleSwitchEmail(false);
|
1073
|
+
setRefreshReCaptcha(function (b) {
|
1074
|
+
return !b;
|
1075
|
+
});
|
1087
1076
|
});
|
1088
1077
|
}
|
1089
1078
|
}();
|
@@ -2481,6 +2470,7 @@ var trick_problem = "함정 문제";
|
|
2481
2470
|
var differential_problem = "변별력 문제";
|
2482
2471
|
var difficult_problem = "어려운 문제";
|
2483
2472
|
var general_problem = "일반적인 문제";
|
2473
|
+
var super_difficult_problem = "엄청 어려운 문제";
|
2484
2474
|
var fingerprint = "지문";
|
2485
2475
|
var end = "종료";
|
2486
2476
|
var ask_for_feedback = "피드백 요청하기";
|
@@ -3265,6 +3255,7 @@ var lang_ko = {
|
|
3265
3255
|
differential_problem: differential_problem,
|
3266
3256
|
difficult_problem: difficult_problem,
|
3267
3257
|
general_problem: general_problem,
|
3258
|
+
super_difficult_problem: super_difficult_problem,
|
3268
3259
|
fingerprint: fingerprint,
|
3269
3260
|
end: end,
|
3270
3261
|
ask_for_feedback: ask_for_feedback,
|
@@ -4089,6 +4080,7 @@ var trick_problem$1 = "Trick problem";
|
|
4089
4080
|
var differential_problem$1 = "Differential problem";
|
4090
4081
|
var difficult_problem$1 = "Difficult problem";
|
4091
4082
|
var general_problem$1 = "General problem";
|
4083
|
+
var super_difficult_problem$1 = "Super difficult problem";
|
4092
4084
|
var fingerprint$1 = "Fingerprint";
|
4093
4085
|
var end$1 = "end";
|
4094
4086
|
var ask_for_feedback$1 = "Ask for feedback";
|
@@ -4874,6 +4866,7 @@ var lang_en = {
|
|
4874
4866
|
differential_problem: differential_problem$1,
|
4875
4867
|
difficult_problem: difficult_problem$1,
|
4876
4868
|
general_problem: general_problem$1,
|
4869
|
+
super_difficult_problem: super_difficult_problem$1,
|
4877
4870
|
fingerprint: fingerprint$1,
|
4878
4871
|
end: end$1,
|
4879
4872
|
ask_for_feedback: ask_for_feedback$1,
|
@@ -14202,13 +14195,13 @@ var CompareGrass = function CompareGrass(_ref2) {
|
|
14202
14195
|
fontSize: "11px"
|
14203
14196
|
},
|
14204
14197
|
className: "" + printStyles["avoid-break-inside"]
|
14205
|
-
}, t("general_problem")), problem === 4 && React__default.createElement(ChipCustom, {
|
14198
|
+
}, t("general_problem")), (problem === 4 || problem === 5) && React__default.createElement(ChipCustom, {
|
14206
14199
|
style: {
|
14207
14200
|
border: "1px solid #FF0000",
|
14208
14201
|
fontSize: "11px"
|
14209
14202
|
},
|
14210
14203
|
className: "" + printStyles["avoid-break-inside"]
|
14211
|
-
}, t("difficult_problem")));
|
14204
|
+
}, t(problem === 4 ? "difficult_problem" : "super_difficult_problem")));
|
14212
14205
|
}))));
|
14213
14206
|
});
|
14214
14207
|
};
|