touchstudy-core 0.1.78 → 0.1.80

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.
@@ -723,7 +723,8 @@ var BlockLogin = function BlockLogin(_ref) {
723
723
  role = _ref$role === void 0 ? Role.Student : _ref$role,
724
724
  homeAcademyUrl = _ref.homeAcademyUrl,
725
725
  homeUrl = _ref.homeUrl,
726
- registerUrl = _ref.registerUrl;
726
+ registerUrl = _ref.registerUrl,
727
+ clientId = _ref.clientId;
727
728
  var language = useSelector(function (state) {
728
729
  var _state$common;
729
730
  return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.language;
@@ -793,7 +794,7 @@ var BlockLogin = function BlockLogin(_ref) {
793
794
  })), React__default.createElement("div", {
794
795
  className: "p-0 mt-1 mb-4"
795
796
  }, React__default.createElement(GoogleLogin, {
796
- clientId: GOOGLE_CLIENT_ID,
797
+ clientId: clientId,
797
798
  buttonText: t("sign_in_with_your_google_account"),
798
799
  onSuccess: onSuccessGoogle,
799
800
  onFailure: onFailureGoogle,
@@ -818,23 +819,29 @@ var useLogin$1 = function useLogin(homeAcademyUrl, homeUrl) {
818
819
  var _useState2 = useState(),
819
820
  infoUser = _useState2[0],
820
821
  setInfoUser = _useState2[1];
822
+ var _useState3 = useState(),
823
+ clientId = _useState3[0],
824
+ setClientId = _useState3[1];
821
825
  var _useTranslation = useTranslation(),
822
826
  t = _useTranslation.t;
823
827
  var toggle = useCallback(function () {
824
828
  setOpenLogin(!openLogin);
825
829
  }, [openLogin]);
826
- var _useState3 = useState(false),
827
- isShowPassword = _useState3[0],
828
- setIsShowPassword = _useState3[1];
830
+ var _useState4 = useState(false),
831
+ isShowPassword = _useState4[0],
832
+ setIsShowPassword = _useState4[1];
833
+ useEffect(function () {
834
+ setClientId(GOOGLE_CLIENT_ID);
835
+ }, []);
829
836
  useEffect(function () {
830
837
  var start = function start() {
831
838
  gapi.client.init({
832
- clientId: GOOGLE_CLIENT_ID,
839
+ clientId: clientId,
833
840
  scope: "email"
834
841
  });
835
842
  };
836
- !!gapi && gapi.load("client:auth2", start);
837
- }, [gapi]);
843
+ gapi && clientId && gapi.load("client:auth2", start);
844
+ }, [gapi, clientId]);
838
845
  useEffect(function () {
839
846
  var token = getAccessToken();
840
847
  var academyDomain = getAcademyDomain();
@@ -845,6 +852,7 @@ var useLogin$1 = function useLogin(homeAcademyUrl, homeUrl) {
845
852
  document.title = t("study_peak") + " | " + t(PAGE_TITLE);
846
853
  }, [t]);
847
854
  return {
855
+ clientId: clientId,
848
856
  defaultInfo: defaultInfo,
849
857
  openLogin: openLogin,
850
858
  toggle: toggle,
@@ -954,7 +962,8 @@ var Login = function Login(_ref) {
954
962
  var history = _ref.history,
955
963
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
956
964
  var _useLogin = useLogin$1(rest.homeAcademyUrl, rest.homeUrl),
957
- defaultInfo = _useLogin.defaultInfo;
965
+ defaultInfo = _useLogin.defaultInfo,
966
+ clientId = _useLogin.clientId;
958
967
  useLanguage(history);
959
968
  return React__default.createElement("div", {
960
969
  className: styles["login"] + " font-family-lato"
@@ -966,9 +975,10 @@ var Login = function Login(_ref) {
966
975
  item: true,
967
976
  xs: 12,
968
977
  className: "d-flex justify-content-center h-100 align-items-center"
969
- }, React__default.createElement(BlockLogin, Object.assign({
978
+ }, clientId && React__default.createElement(BlockLogin, Object.assign({
970
979
  defaultInfo: defaultInfo,
971
- history: history
980
+ history: history,
981
+ clientId: clientId
972
982
  }, rest)))));
973
983
  };
974
984
 
@@ -16760,9 +16770,13 @@ var PrintExamView2 = function PrintExamView2(_ref) {
16760
16770
  var examSessionId = _ref2.examSessionId,
16761
16771
  studentId = _ref2.studentId,
16762
16772
  code = _ref2.code;
16773
+ var width = 200;
16774
+ var height = 200;
16775
+ var left = window.screenX + window.outerWidth / 2 - width / 2;
16776
+ var top = window.screenY + window.outerHeight / 2 - height / 2;
16763
16777
  var url = isTeacher ? window.location.origin + "/teacher/exam-results/" + examSessionId + "/students/" + studentId + "/print" : window.location.origin + "/student/exam-results/" + code + "/print";
16764
16778
  var windowName = isTeacher ? "popup-" + examSessionId + "-" + studentId : "popup-" + code;
16765
- var windowSpecs = "left=" + (window.innerWidth - 100) + ",top=" + (window.innerHeight - 100) + ",width=100,height=100,location=yes,resizable=yes,scrollbars=yes,status=yes";
16779
+ var windowSpecs = "left=" + left + ",top=" + top + ",width=" + width + ",height=" + height + ",location=yes,resizable=yes,scrollbars=yes,status=yes";
16766
16780
  var childWindow = window.open(url, windowName, windowSpecs);
16767
16781
  if (childWindow == null) {
16768
16782
  setErrorLinks(function (prev) {