mario-core 2.9.238-layout → 2.9.238-release

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 CHANGED
@@ -7,9 +7,10 @@ var React = require('react');
7
7
  var React__default = _interopDefault(React);
8
8
  var reactstrap = require('reactstrap');
9
9
  var reactRouterDom = require('react-router-dom');
10
+ var reactRedux = require('react-redux');
10
11
  var formik = require('formik');
11
12
  var yup = require('yup');
12
- var reactRedux = require('react-redux');
13
+ var msalBrowser = require('@azure/msal-browser');
13
14
  var toolkit = require('@reduxjs/toolkit');
14
15
  var axios = _interopDefault(require('axios'));
15
16
  var amplitude = _interopDefault(require('amplitude-js'));
@@ -1845,6 +1846,7 @@ var accommodation_set = "Accommodation Set";
1845
1846
  var add_new_accommodation = "Add new accommodation";
1846
1847
  var print_my_accommodations = "Print my accommodations";
1847
1848
  var my_learning_progress = "My Learning Progress";
1849
+ var weekly_quests = "Weekly quests";
1848
1850
  var responses_comparisons = "Responses Comparisons";
1849
1851
  var dropdown_and_verbal_questions_responses = "Dropdown and Verbal Questions Responses";
1850
1852
  var mario_tools = "MARIO TOOLS";
@@ -3813,6 +3815,7 @@ var lang_us = {
3813
3815
  my_learning_progress: my_learning_progress,
3814
3816
  "here_your_teacher_can_edit_or_add_your_accommodation_details._please_note_that_you_can_view_the_information,_but_for_any_edits_or_additions,_kindly_contact_your_teacher_directly.": "Here your teacher can edit or add your accommodation details. Please note that you can view the information, but for any edits or additions, kindly contact your teacher directly.",
3815
3817
  "this_is_a_brand_new_beta_version_for_your_personal_learning_journey._you_can_think_about_what_you_want_like_to_do_and_how_you_like_to_learn._we_advise_you_to_do_it_gradually_per_section_and_visit_it_once_a_month.": "This is a brand new beta version for your personal learning journey. You can think about what you want like to do and how you like to learn. We advise you to do it gradually per section and visit it once a month.",
3818
+ weekly_quests: weekly_quests,
3816
3819
  responses_comparisons: responses_comparisons,
3817
3820
  dropdown_and_verbal_questions_responses: dropdown_and_verbal_questions_responses,
3818
3821
  mario_tools: mario_tools,
@@ -4522,6 +4525,7 @@ var do_you_want_to_share_a_survey_to_teachers$1 = "Do you want to share a survey
4522
4525
  var you_can_share_this_survey_to_teachers_to_get_more_insight_about_your_student$1 = "You can share this survey to teachers to get more insight about your student.";
4523
4526
  var skip$1 = "skip";
4524
4527
  var survey_questions$1 = "Survey questions";
4528
+ var weekly_quests$1 = "Weekly quests";
4525
4529
  var add_survey_question$1 = "Add Survey Question";
4526
4530
  var additional_question$1 = "Additional Question";
4527
4531
  var add_additional_question$1 = "Add additional question";
@@ -5778,13 +5782,13 @@ var accommodation_set$1 = "Accommodation Set";
5778
5782
  var add_new_accommodation$1 = "Add new accommodation";
5779
5783
  var print_my_accommodations$1 = "Print my accommodations";
5780
5784
  var my_learning_progress$1 = "My Learning Progress";
5785
+ var inactive_students$1 = "Inactive Students";
5781
5786
  var responses_comparisons$1 = "Responses Comparisons";
5782
5787
  var dropdown_and_verbal_questions_responses$1 = "Dropdown and Verbal Questions Responses";
5783
5788
  var mario_tools$1 = "MARIO TOOLS";
5784
5789
  var customize$1 = "Customize";
5785
5790
  var techical_settings$1 = "Technical Settings";
5786
5791
  var data_import_export$1 = "Data Import/Export";
5787
- var inactive_students$1 = "Inactive Students";
5788
5792
  var admin_general_tips$1 = "Admin General Tips";
5789
5793
  var school_usage$1 = "School Usage";
5790
5794
  var total_conversations_time$1 = "Total Conversations Time";
@@ -6476,6 +6480,7 @@ var lang_uk = {
6476
6480
  you_can_share_this_survey_to_teachers_to_get_more_insight_about_your_student: you_can_share_this_survey_to_teachers_to_get_more_insight_about_your_student$1,
6477
6481
  skip: skip$1,
6478
6482
  survey_questions: survey_questions$1,
6483
+ weekly_quests: weekly_quests$1,
6479
6484
  add_survey_question: add_survey_question$1,
6480
6485
  additional_question: additional_question$1,
6481
6486
  add_additional_question: add_additional_question$1,
@@ -7745,6 +7750,7 @@ var lang_uk = {
7745
7750
  print_my_accommodations: print_my_accommodations$1,
7746
7751
  my_learning_progress: my_learning_progress$1,
7747
7752
  "here_your_teacher_can_edit_or_add_your_accommodation_details._please_note_that_you_can_view_the_information,_but_for_any_edits_or_additions,_kindly_contact_your_teacher_directly.": "Here your teacher can edit or add your accommodation details. Please note that you can view the information, but for any edits or additions, kindly contact your teacher directly.",
7753
+ inactive_students: inactive_students$1,
7748
7754
  "this_is_a_brand_new_beta_version_for_your_personal_learning_journey._you_can_think_about_what_you_want_like_to_do_and_how_you_like_to_learn._we_advise_you_to_do_it_gradually_per_section_and_visit_it_once_a_month.": "This is a brand new beta version for your personal learning journey. You can think about what you want like to do and how you like to learn. We advise you to do it gradually per section and visit it once a month.",
7749
7755
  responses_comparisons: responses_comparisons$1,
7750
7756
  dropdown_and_verbal_questions_responses: dropdown_and_verbal_questions_responses$1,
@@ -7752,7 +7758,6 @@ var lang_uk = {
7752
7758
  customize: customize$1,
7753
7759
  techical_settings: techical_settings$1,
7754
7760
  data_import_export: data_import_export$1,
7755
- inactive_students: inactive_students$1,
7756
7761
  admin_general_tips: admin_general_tips$1,
7757
7762
  school_usage: school_usage$1,
7758
7763
  total_conversations_time: total_conversations_time$1,
@@ -12521,8 +12526,6 @@ var performance$4 = "Actuación";
12521
12526
  var not_enough_challenge_leading_to_boredom_and_lack_of_interest$3 = "No hay suficientes desafíos lo que lleva al aburrimiento y la falta de interés.";
12522
12527
  var calm_and_relaxed_but_not_enough_motivation_to_perform_at_my_best$3 = "Tranquilo y relajado pero no hay suficiente motivación para dar lo mejor de mí.";
12523
12528
  var manageable_levels_of_stress_allowing_me_to_perform_at_my_best$3 = "Niveles manejables de estrés que me permiten rendir al máximo.";
12524
- var still_in_control_but_starting_to_feel_the_pressure$3 = "Aún tengo el control pero empiezo a sentir la presión.";
12525
- var too_much_pressure_and_really_struggling_to_manage_my_workload$3 = "Demasiada presión y muchas dificultades para gestionar mi carga de trabajo.";
12526
12529
  var import_emails_by_csv$3 = "Importar correo electrónico por csv";
12527
12530
  var request_number$3 = "Número de solicitud";
12528
12531
  var select_or_input_class_type$3 = "Seleccione o ingrese el tipo de clase";
@@ -13602,7 +13605,7 @@ var customize$3 = "Personalizar";
13602
13605
  var techical_settings$3 = "Configuración técnica";
13603
13606
  var data_import_export$3 = "Importación/Exportación de datos";
13604
13607
  var question_text$3 = "Texto de la pregunta";
13605
- var weekly_quests = "Misiones semanales";
13608
+ var weekly_quests$2 = "Misiones semanales";
13606
13609
  var inactive_students$3 = "Estudiantes inactivos";
13607
13610
  var admin_general_tips$3 = "Consejos generales para el administrador";
13608
13611
  var school_usage$3 = "Uso escolar";
@@ -14455,8 +14458,6 @@ var lang_es = {
14455
14458
  not_enough_challenge_leading_to_boredom_and_lack_of_interest: not_enough_challenge_leading_to_boredom_and_lack_of_interest$3,
14456
14459
  calm_and_relaxed_but_not_enough_motivation_to_perform_at_my_best: calm_and_relaxed_but_not_enough_motivation_to_perform_at_my_best$3,
14457
14460
  manageable_levels_of_stress_allowing_me_to_perform_at_my_best: manageable_levels_of_stress_allowing_me_to_perform_at_my_best$3,
14458
- still_in_control_but_starting_to_feel_the_pressure: still_in_control_but_starting_to_feel_the_pressure$3,
14459
- too_much_pressure_and_really_struggling_to_manage_my_workload: too_much_pressure_and_really_struggling_to_manage_my_workload$3,
14460
14461
  import_emails_by_csv: import_emails_by_csv$3,
14461
14462
  request_number: request_number$3,
14462
14463
  select_or_input_class_type: select_or_input_class_type$3,
@@ -15541,7 +15542,7 @@ var lang_es = {
15541
15542
  techical_settings: techical_settings$3,
15542
15543
  data_import_export: data_import_export$3,
15543
15544
  question_text: question_text$3,
15544
- weekly_quests: weekly_quests,
15545
+ weekly_quests: weekly_quests$2,
15545
15546
  inactive_students: inactive_students$3,
15546
15547
  admin_general_tips: admin_general_tips$3,
15547
15548
  school_usage: school_usage$3,
@@ -16424,8 +16425,8 @@ var performance$5 = "表现";
16424
16425
  var not_enough_challenge_leading_to_boredom_and_lack_of_interest$4 = "挑战不够,导致无聊和缺乏兴趣。";
16425
16426
  var calm_and_relaxed_but_not_enough_motivation_to_perform_at_my_best$4 = "平静而放松,但没有足够的动力来发挥我的最佳水平。";
16426
16427
  var manageable_levels_of_stress_allowing_me_to_perform_at_my_best$4 = "可控的压力水平让我能够发挥出最佳水平。";
16427
- var still_in_control_but_starting_to_feel_the_pressure$4 = "仍在控制之中,但开始感到压力。";
16428
- var too_much_pressure_and_really_struggling_to_manage_my_workload$4 = "压力过大,真的很难管理我的工作量。";
16428
+ var still_in_control_but_starting_to_feel_the_pressure$3 = "仍在控制之中,但开始感到压力。";
16429
+ var too_much_pressure_and_really_struggling_to_manage_my_workload$3 = "压力过大,真的很难管理我的工作量。";
16429
16430
  var import_emails_by_csv$4 = "通过 csv 导入电子邮件";
16430
16431
  var request_number$4 = "请求编号";
16431
16432
  var select_or_input_class_type$4 = "选择或输入班级类型";
@@ -17505,7 +17506,7 @@ var customize$4 = "自定义";
17505
17506
  var techical_settings$4 = "技术设置";
17506
17507
  var data_import_export$4 = "数据导入/导出";
17507
17508
  var question_text$4 = "问题文本";
17508
- var weekly_quests$1 = "每周任务";
17509
+ var weekly_quests$3 = "每周任务";
17509
17510
  var inactive_students$4 = "非活跃学生";
17510
17511
  var admin_general_tips$4 = "管理员一般提示";
17511
17512
  var school_usage$4 = "学校使用";
@@ -18385,8 +18386,8 @@ var lang_zh = {
18385
18386
  not_enough_challenge_leading_to_boredom_and_lack_of_interest: not_enough_challenge_leading_to_boredom_and_lack_of_interest$4,
18386
18387
  calm_and_relaxed_but_not_enough_motivation_to_perform_at_my_best: calm_and_relaxed_but_not_enough_motivation_to_perform_at_my_best$4,
18387
18388
  manageable_levels_of_stress_allowing_me_to_perform_at_my_best: manageable_levels_of_stress_allowing_me_to_perform_at_my_best$4,
18388
- still_in_control_but_starting_to_feel_the_pressure: still_in_control_but_starting_to_feel_the_pressure$4,
18389
- too_much_pressure_and_really_struggling_to_manage_my_workload: too_much_pressure_and_really_struggling_to_manage_my_workload$4,
18389
+ still_in_control_but_starting_to_feel_the_pressure: still_in_control_but_starting_to_feel_the_pressure$3,
18390
+ too_much_pressure_and_really_struggling_to_manage_my_workload: too_much_pressure_and_really_struggling_to_manage_my_workload$3,
18390
18391
  import_emails_by_csv: import_emails_by_csv$4,
18391
18392
  request_number: request_number$4,
18392
18393
  select_or_input_class_type: select_or_input_class_type$4,
@@ -19471,7 +19472,7 @@ var lang_zh = {
19471
19472
  techical_settings: techical_settings$4,
19472
19473
  data_import_export: data_import_export$4,
19473
19474
  question_text: question_text$4,
19474
- weekly_quests: weekly_quests$1,
19475
+ weekly_quests: weekly_quests$3,
19475
19476
  inactive_students: inactive_students$4,
19476
19477
  admin_general_tips: admin_general_tips$4,
19477
19478
  school_usage: school_usage$4,
@@ -37173,6 +37174,8 @@ var setModal = toolkit.createAction("common/setModal");
37173
37174
  var setUser = toolkit.createAction("common/setUser");
37174
37175
  var setSidebar = toolkit.createAction("common/setSidebar");
37175
37176
  var setAlert = toolkit.createAction("common/setAlert");
37177
+ var setIsLoginGoogle = toolkit.createAction("common/setIsLoginGoogle");
37178
+ var setInforUserGoogle = toolkit.createAction("common/setInforUserGoogle");
37176
37179
  var reset = toolkit.createAction("common/reset");
37177
37180
  var showMenuBar = toolkit.createAction("common/showMenuBar");
37178
37181
  var showFontSize = toolkit.createAction("common/showFontSize");
@@ -37236,13 +37239,11 @@ var apiUpload = axios.create({
37236
37239
  return i.interceptors.response.use(function (response) {
37237
37240
  return response;
37238
37241
  }, function (error) {
37239
- var _error$response$confi, _error$response$confi2, _error$response$confi3, _error$response$confi4;
37240
-
37241
37242
  console.log({
37242
37243
  error: error
37243
37244
  });
37244
37245
 
37245
- if (error.response.status === 401 && !((_error$response$confi = error.response.config) !== null && _error$response$confi !== void 0 && (_error$response$confi2 = _error$response$confi.url) !== null && _error$response$confi2 !== void 0 && _error$response$confi2.includes("cookieyes"))) {
37246
+ if (error.response.status === 401) {
37246
37247
  Object.keys(localStorage).forEach(function (key) {
37247
37248
  if (!key.includes('learning-plan')) delete localStorage[key];
37248
37249
  });
@@ -37259,13 +37260,16 @@ var apiUpload = axios.create({
37259
37260
  amplitude.getInstance().resetSessionId();
37260
37261
  }
37261
37262
 
37262
- localStorage.setItem("USER_EMAIL", "");
37263
+ localStorage.removeItem(ACCESS_TOKEN);
37264
+ localStorage.removeItem("USER_EMAIL");
37265
+ localStorage.removeItem("ROLES");
37263
37266
  window.location.href = "/login";
37264
37267
  }
37265
37268
 
37266
- if (error.response.status == 403 && !((_error$response$confi3 = error.response.config) !== null && _error$response$confi3 !== void 0 && (_error$response$confi4 = _error$response$confi3.url) !== null && _error$response$confi4 !== void 0 && _error$response$confi4.includes("cookieyes"))) {
37269
+ if (error.response.status == 403) {
37267
37270
  localStorage.removeItem(ACCESS_TOKEN);
37268
37271
  localStorage.removeItem("USER_EMAIL");
37272
+ localStorage.removeItem("ROLES");
37269
37273
  window.location.href = "/login";
37270
37274
  }
37271
37275
 
@@ -37309,8 +37313,12 @@ var checkResetToken = function checkResetToken(token, key) {
37309
37313
  var resetPassword = function resetPassword(data) {
37310
37314
  return api.post(ACCOUNT_URL + "/resetpassword", data);
37311
37315
  };
37312
- var checkUserGoogle = function checkUserGoogle(body) {
37313
- return api.post(USER_URL + "/check-user", body);
37316
+ var checkUserGoogle = function checkUserGoogle(type, body) {
37317
+ return api.post(USER_URL + "/check-user", body, {
37318
+ params: {
37319
+ type: type
37320
+ }
37321
+ });
37314
37322
  };
37315
37323
  var getAllLoginTeacher = function getAllLoginTeacher(param) {
37316
37324
  return api.get(TEACHER_URL + "/get-teacher-login", {
@@ -37332,6 +37340,14 @@ var getSchoolSettings = function getSchoolSettings() {
37332
37340
  return api.get(SCHOOL_URL + "/settings");
37333
37341
  };
37334
37342
 
37343
+ var TypeLogin;
37344
+
37345
+ (function (TypeLogin) {
37346
+ TypeLogin[TypeLogin["Google"] = 0] = "Google";
37347
+ TypeLogin[TypeLogin["ClassLink"] = 1] = "ClassLink";
37348
+ TypeLogin[TypeLogin["MicrosoftSSO"] = 2] = "MicrosoftSSO";
37349
+ })(TypeLogin || (TypeLogin = {}));
37350
+
37335
37351
  var LoginType;
37336
37352
 
37337
37353
  (function (LoginType) {
@@ -37340,6 +37356,48 @@ var LoginType;
37340
37356
  LoginType[LoginType["Impersonate"] = 2] = "Impersonate";
37341
37357
  })(LoginType || (LoginType = {}));
37342
37358
 
37359
+ var msalConfig = {
37360
+ auth: {
37361
+ clientId: "90c6897c-f17b-475e-a7a8-9a19651e0060",
37362
+ authority: "https://login.microsoftonline.com/common",
37363
+ redirectUri: window.location.origin + "/login"
37364
+ },
37365
+ cache: {
37366
+ cacheLocation: "sessionStorage",
37367
+ storeAuthStateInCookie: false
37368
+ },
37369
+ system: {
37370
+ loggerOptions: {
37371
+ loggerCallback: function loggerCallback(level, message, containsPii) {
37372
+ if (containsPii) {
37373
+ return;
37374
+ }
37375
+
37376
+ switch (level) {
37377
+ case msalBrowser.LogLevel.Error:
37378
+ console.error(message);
37379
+ return;
37380
+
37381
+ case msalBrowser.LogLevel.Info:
37382
+ console.info(message);
37383
+ return;
37384
+
37385
+ case msalBrowser.LogLevel.Verbose:
37386
+ console.debug(message);
37387
+ return;
37388
+
37389
+ case msalBrowser.LogLevel.Warning:
37390
+ console.warn(message);
37391
+ return;
37392
+
37393
+ default:
37394
+ return;
37395
+ }
37396
+ }
37397
+ }
37398
+ }
37399
+ };
37400
+
37343
37401
  var defaultInfo = {
37344
37402
  email: "",
37345
37403
  password: "",
@@ -37362,36 +37420,39 @@ var useLogin = function useLogin() {
37362
37420
  openLogin = _useState[0],
37363
37421
  setOpenLogin = _useState[1];
37364
37422
 
37365
- var _useState2 = React.useState(false),
37366
- isLoginGoogle = _useState2[0],
37367
- setIsLoginGoogle = _useState2[1];
37368
-
37369
- var _useState3 = React.useState(""),
37370
- googleClientId = _useState3[0],
37371
- setGoogleClientId = _useState3[1];
37423
+ var isLoginGoogle = reactRedux.useSelector(function (state) {
37424
+ return state.common.isLoginGoogle;
37425
+ });
37372
37426
 
37373
- var _useState4 = React.useState(""),
37374
- googleRecaptchaId = _useState4[0],
37375
- setGoogleRecaptchaId = _useState4[1];
37427
+ var _useState2 = React.useState(""),
37428
+ googleClientId = _useState2[0],
37429
+ setGoogleClientId = _useState2[1];
37376
37430
 
37377
- var _useState5 = React.useState(),
37378
- infoUser = _useState5[0],
37379
- setInfoUser = _useState5[1];
37431
+ var _useState3 = React.useState(""),
37432
+ googleRecaptchaId = _useState3[0],
37433
+ setGoogleRecaptchaId = _useState3[1];
37380
37434
 
37435
+ var infoUser = reactRedux.useSelector(function (state) {
37436
+ return state.common.inforUserGoogle;
37437
+ });
37381
37438
  var params = new URLSearchParams(location.search);
37382
37439
  var loginClassLink = params.get("type") === "classlink";
37383
37440
  var tokenClassLink = params.get("token");
37384
37441
 
37385
- var _useState6 = React.useState(false),
37386
- openModelAssign = _useState6[0];
37442
+ var _useState4 = React.useState(false),
37443
+ openModelAssign = _useState4[0];
37444
+
37445
+ var _useState5 = React.useState(),
37446
+ msalInstance = _useState5[0],
37447
+ setMsalInstance = _useState5[1];
37387
37448
 
37388
37449
  var toggle = React.useCallback(function () {
37389
37450
  setOpenLogin(!openLogin);
37390
37451
  }, [openLogin]);
37391
37452
 
37392
- var _useState7 = React.useState(false),
37393
- isShowPassword = _useState7[0],
37394
- setIsShowPassword = _useState7[1];
37453
+ var _useState6 = React.useState(false),
37454
+ isShowPassword = _useState6[0],
37455
+ setIsShowPassword = _useState6[1];
37395
37456
 
37396
37457
  React.useEffect(function () {
37397
37458
  document.title = TITLE;
@@ -37573,40 +37634,51 @@ var useLogin = function useLogin() {
37573
37634
  }
37574
37635
  };
37575
37636
 
37576
- var fnIsCheckLogin = React.useCallback(function (data, token, clickHandler) {
37637
+ var fnIsCheckLogin = React.useCallback(function (type, data, token, clickHandler) {
37577
37638
  try {
37578
- var _temp14 = function _temp14() {
37639
+ var _temp16 = function _temp16() {
37579
37640
  dispatch(setLoading(false));
37580
37641
  };
37581
37642
 
37582
37643
  dispatch(setLoading(true));
37583
37644
 
37584
- var _temp15 = _catch(function () {
37585
- return Promise.resolve(checkUserGoogle(data)).then(function (res) {
37645
+ var _temp17 = _catch(function () {
37646
+ return Promise.resolve(checkUserGoogle(type, data)).then(function (res) {
37586
37647
  var checkUser = res.data;
37587
37648
 
37588
- var _temp11 = function () {
37649
+ var _temp13 = function () {
37589
37650
  if (checkUser) {
37590
- return Promise.resolve(clickHandler()).then(function (clickHandlerRes) {
37591
- var dataUser = {
37592
- email: data.email,
37593
- captcha: clickHandlerRes,
37594
- isLoginGoogle: true,
37595
- rememberMe: false,
37596
- password: "default",
37597
- accessToken: token,
37598
- loginType: LoginType.Google
37599
- };
37600
- return Promise.resolve(userLogin(dataUser)).then(function () {
37601
- setIsLoginGoogle(false);
37651
+ var _temp18 = function _temp18() {
37652
+ return Promise.resolve(userLogin(_dataUser)).then(function () {
37653
+ dispatch(setIsLoginGoogle(false));
37602
37654
  });
37603
- });
37655
+ };
37656
+
37657
+ var _dataUser = {
37658
+ email: data.email,
37659
+ isLoginGoogle: true,
37660
+ rememberMe: false,
37661
+ password: "default",
37662
+ accessToken: token,
37663
+ captcha: "",
37664
+ loginType: LoginType.Google
37665
+ };
37666
+
37667
+ var _temp19 = function () {
37668
+ if (clickHandler != null) {
37669
+ return Promise.resolve(clickHandler()).then(function (clickHandlerRes) {
37670
+ _dataUser.captcha = clickHandlerRes;
37671
+ });
37672
+ }
37673
+ }();
37674
+
37675
+ return _temp19 && _temp19.then ? _temp19.then(_temp18) : _temp18(_temp19);
37604
37676
  } else {
37605
- setIsLoginGoogle(true);
37677
+ dispatch(setIsLoginGoogle(true));
37606
37678
  }
37607
37679
  }();
37608
37680
 
37609
- if (_temp11 && _temp11.then) return _temp11.then(function () {});
37681
+ if (_temp13 && _temp13.then) return _temp13.then(function () {});
37610
37682
  });
37611
37683
  }, function (err) {
37612
37684
  var _err$response4, _err$response4$data;
@@ -37617,7 +37689,7 @@ var useLogin = function useLogin() {
37617
37689
  }));
37618
37690
  });
37619
37691
 
37620
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(_temp14) : _temp14(_temp15));
37692
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(_temp16) : _temp16(_temp17));
37621
37693
  } catch (e) {
37622
37694
  return Promise.reject(e);
37623
37695
  }
@@ -37625,14 +37697,14 @@ var useLogin = function useLogin() {
37625
37697
 
37626
37698
  var submitLogin = function submitLogin(teacherId, clickHandler) {
37627
37699
  try {
37628
- var _temp19 = function _temp19() {
37629
- setIsLoginGoogle(false);
37700
+ var _temp23 = function _temp23() {
37701
+ dispatch(setIsLoginGoogle(false));
37630
37702
  dispatch(setLoading(false));
37631
37703
  };
37632
37704
 
37633
37705
  dispatch(setLoading(true));
37634
37706
 
37635
- var _temp20 = _catch(function () {
37707
+ var _temp24 = _catch(function () {
37636
37708
  var data = {
37637
37709
  firstName: infoUser.firstName,
37638
37710
  lastName: infoUser.lastName,
@@ -37643,7 +37715,7 @@ var useLogin = function useLogin() {
37643
37715
  teacherId: teacherId
37644
37716
  };
37645
37717
  return Promise.resolve(registerUserStudent(data)).then(function (res) {
37646
- var _temp16 = function () {
37718
+ var _temp20 = function () {
37647
37719
  if (res.data) {
37648
37720
  return Promise.resolve(clickHandler()).then(function (clickHandlerRes) {
37649
37721
  var dataLogin = {
@@ -37655,7 +37727,7 @@ var useLogin = function useLogin() {
37655
37727
  accessToken: infoUser.accessToken,
37656
37728
  loginType: LoginType.Google
37657
37729
  };
37658
- setIsLoginGoogle(false);
37730
+ dispatch(setIsLoginGoogle(false));
37659
37731
  return Promise.resolve(userLogin(dataLogin)).then(function () {
37660
37732
  history.push(HOMEPAGE_STUDENT);
37661
37733
  });
@@ -37663,7 +37735,7 @@ var useLogin = function useLogin() {
37663
37735
  }
37664
37736
  }();
37665
37737
 
37666
- if (_temp16 && _temp16.then) return _temp16.then(function () {});
37738
+ if (_temp20 && _temp20.then) return _temp20.then(function () {});
37667
37739
  });
37668
37740
  }, function (err) {
37669
37741
  var _err$response5, _err$response5$data;
@@ -37674,7 +37746,7 @@ var useLogin = function useLogin() {
37674
37746
  }));
37675
37747
  });
37676
37748
 
37677
- return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(_temp19) : _temp19(_temp20));
37749
+ return Promise.resolve(_temp24 && _temp24.then ? _temp24.then(_temp23) : _temp23(_temp24));
37678
37750
  } catch (e) {
37679
37751
  return Promise.reject(e);
37680
37752
  }
@@ -37682,7 +37754,7 @@ var useLogin = function useLogin() {
37682
37754
 
37683
37755
  var getInformationSetting = function getInformationSetting() {
37684
37756
  try {
37685
- var _temp22 = _catch(function () {
37757
+ var _temp26 = _catch(function () {
37686
37758
  return Promise.resolve(getSchoolSettings()).then(function (res) {
37687
37759
  dispatch(setSandboxMode(res.data.isSandboxMode));
37688
37760
  });
@@ -37690,14 +37762,89 @@ var useLogin = function useLogin() {
37690
37762
  console.error(err);
37691
37763
  });
37692
37764
 
37693
- return Promise.resolve(_temp22 && _temp22.then ? _temp22.then(function () {}) : void 0);
37765
+ return Promise.resolve(_temp26 && _temp26.then ? _temp26.then(function () {}) : void 0);
37766
+ } catch (e) {
37767
+ return Promise.reject(e);
37768
+ }
37769
+ };
37770
+
37771
+ var fnLoginSSO = function fnLoginSSO(clickHandler) {
37772
+ try {
37773
+ msalInstance.handleRedirectPromise().then(function (tokenResponse) {
37774
+ try {
37775
+ var _temp29 = function () {
37776
+ if (!tokenResponse) {
37777
+ var accounts = msalInstance.getAllAccounts();
37778
+
37779
+ var _temp30 = function () {
37780
+ if (accounts.length === 0) {
37781
+ msalInstance.loginRedirect();
37782
+ } else {
37783
+ var currentAccount = accounts[0];
37784
+ return Promise.resolve(getCurrentAccount(currentAccount, clickHandler)).then(function () {});
37785
+ }
37786
+ }();
37787
+
37788
+ if (_temp30 && _temp30.then) return _temp30.then(function () {});
37789
+ } else {
37790
+ var currentAccount = tokenResponse.account;
37791
+ return Promise.resolve(getCurrentAccount(currentAccount, clickHandler)).then(function () {});
37792
+ }
37793
+ }();
37794
+
37795
+ return Promise.resolve(_temp29 && _temp29.then ? _temp29.then(function () {}) : void 0);
37796
+ } catch (e) {
37797
+ return Promise.reject(e);
37798
+ }
37799
+ })["catch"](function (err) {
37800
+ console.error(err);
37801
+ });
37802
+ return Promise.resolve();
37803
+ } catch (e) {
37804
+ return Promise.reject(e);
37805
+ }
37806
+ };
37807
+
37808
+ var getCurrentAccount = function getCurrentAccount(account, clickHandler) {
37809
+ try {
37810
+ var fullName = account.name;
37811
+ var infoLogin = {
37812
+ firstName: fullName.split(' ').slice(0, -1).join(' '),
37813
+ lastName: fullName.split(' ').slice(-1).join(' '),
37814
+ fullName: fullName,
37815
+ imageUrl: "",
37816
+ email: account.username,
37817
+ accessToken: account.idTokenClaims.aio,
37818
+ googleId: account.tenantId
37819
+ };
37820
+ dispatch(setInforUserGoogle(infoLogin));
37821
+ return Promise.resolve(fnIsCheckLogin(TypeLogin.MicrosoftSSO, infoLogin, account.idTokenClaims.aio, clickHandler)).then(function () {});
37822
+ } catch (e) {
37823
+ return Promise.reject(e);
37824
+ }
37825
+ };
37826
+
37827
+ var initInformationSSO = function initInformationSSO() {
37828
+ try {
37829
+ var _msalInstance = new msalBrowser.PublicClientApplication(msalConfig);
37830
+
37831
+ setMsalInstance(_msalInstance);
37832
+ return Promise.resolve();
37694
37833
  } catch (e) {
37695
37834
  return Promise.reject(e);
37696
37835
  }
37697
37836
  };
37698
37837
 
37838
+ React.useEffect(function () {
37839
+ var redirectUrl = window.location.href;
37840
+
37841
+ if (!!msalInstance && redirectUrl.includes("code") && redirectUrl.includes("client_info")) {
37842
+ fnLoginSSO();
37843
+ }
37844
+ }, [JSON.stringify(msalInstance)]);
37699
37845
  React.useEffect(function () {
37700
37846
  getInformationSetting();
37847
+ initInformationSSO();
37701
37848
  }, []);
37702
37849
  return {
37703
37850
  defaultInfo: defaultInfo,
@@ -37709,13 +37856,12 @@ var useLogin = function useLogin() {
37709
37856
  fnIsCheckLogin: fnIsCheckLogin,
37710
37857
  isLoginGoogle: isLoginGoogle,
37711
37858
  infoUser: infoUser,
37712
- setInfoUser: setInfoUser,
37713
37859
  submitLogin: submitLogin,
37714
- setIsLoginGoogle: setIsLoginGoogle,
37715
37860
  googleClientId: googleClientId,
37716
37861
  googleRecaptchaId: googleRecaptchaId,
37717
37862
  handleCancelModelAssign: handleCancelModelAssign,
37718
- openModelAssign: openModelAssign
37863
+ openModelAssign: openModelAssign,
37864
+ fnLoginSSO: fnLoginSSO
37719
37865
  };
37720
37866
  };
37721
37867
 
@@ -37743,8 +37889,7 @@ var BlockSelectTeacher = function BlockSelectTeacher(_ref) {
37743
37889
  openModal = _ref.openModal,
37744
37890
  onSubmit = _ref.onSubmit,
37745
37891
  token = _ref.token,
37746
- email = _ref.email,
37747
- setOpenModal = _ref.setOpenModal;
37892
+ email = _ref.email;
37748
37893
 
37749
37894
  var _useState = React.useState(false),
37750
37895
  modal = _useState[0],
@@ -37753,12 +37898,6 @@ var BlockSelectTeacher = function BlockSelectTeacher(_ref) {
37753
37898
  React.useEffect(function () {
37754
37899
  setModal(openModal);
37755
37900
  }, [openModal]);
37756
-
37757
- var toggle = function toggle() {
37758
- setModal(!modal);
37759
- setOpenModal(!modal);
37760
- };
37761
-
37762
37901
  var dispatch = reactRedux.useDispatch();
37763
37902
 
37764
37903
  var _useState2 = React.useState([]),
@@ -37778,6 +37917,12 @@ var BlockSelectTeacher = function BlockSelectTeacher(_ref) {
37778
37917
  setLoading = _useState5[1];
37779
37918
 
37780
37919
  var timeout = React.useRef();
37920
+
37921
+ var toggle = function toggle() {
37922
+ setModal(!modal);
37923
+ dispatch(setIsLoginGoogle(!modal));
37924
+ };
37925
+
37781
37926
  var loadData = React.useCallback(function () {
37782
37927
  try {
37783
37928
  var _temp3 = function _temp3() {
@@ -37886,16 +38031,17 @@ var BlockLogin = function BlockLogin(_ref) {
37886
38031
  setIsShowPassword = _useLogin.setIsShowPassword,
37887
38032
  fnIsCheckLogin = _useLogin.fnIsCheckLogin,
37888
38033
  isLoginGoogle = _useLogin.isLoginGoogle,
37889
- setInfoUser = _useLogin.setInfoUser,
37890
38034
  submitLogin = _useLogin.submitLogin,
37891
38035
  infoUser = _useLogin.infoUser,
37892
- setIsLoginGoogle = _useLogin.setIsLoginGoogle,
37893
- googleClientId = _useLogin.googleClientId;
38036
+ googleClientId = _useLogin.googleClientId,
38037
+ fnLoginSSO = _useLogin.fnLoginSSO;
37894
38038
 
37895
38039
  var togglePasswordVisible = function togglePasswordVisible() {
37896
38040
  return setIsShowPassword(!isShowPassword);
37897
38041
  };
37898
38042
 
38043
+ var dispatch = reactRedux.useDispatch();
38044
+
37899
38045
  var _useGoogleReCaptcha = reactGoogleRecaptchaV3.useGoogleReCaptcha(),
37900
38046
  executeRecaptcha = _useGoogleReCaptcha.executeRecaptcha;
37901
38047
 
@@ -37929,6 +38075,7 @@ var BlockLogin = function BlockLogin(_ref) {
37929
38075
  return;
37930
38076
  }
37931
38077
 
38078
+ console.log("assss");
37932
38079
  var infoLogin = {
37933
38080
  firstName: givenName,
37934
38081
  lastName: familyName,
@@ -37938,8 +38085,8 @@ var BlockLogin = function BlockLogin(_ref) {
37938
38085
  accessToken: accessToken,
37939
38086
  googleId: googleId
37940
38087
  };
37941
- setInfoUser(infoLogin);
37942
- fnIsCheckLogin(infoLogin, accessToken, clickHandler);
38088
+ dispatch(setInforUserGoogle(infoLogin));
38089
+ fnIsCheckLogin(TypeLogin.Google, infoLogin, accessToken, clickHandler);
37943
38090
  }
37944
38091
  };
37945
38092
 
@@ -38024,6 +38171,15 @@ var BlockLogin = function BlockLogin(_ref) {
38024
38171
  cookiePolicy: 'single_host_origin',
38025
38172
  className: "" + styles["btn-login-google"]
38026
38173
  })), React__default.createElement("div", {
38174
+ className: styles["btn-login-sso"] + " mb-3"
38175
+ }, React__default.createElement("div", {
38176
+ className: styles["btn-login-with-sso"],
38177
+ onClick: function onClick() {
38178
+ return fnLoginSSO(clickHandler);
38179
+ }
38180
+ }, React__default.createElement("img", {
38181
+ src: "images/Single-Sign-On.png"
38182
+ }), " Login with SSO")), React__default.createElement("div", {
38027
38183
  className: "d-flex justify-content-between"
38028
38184
  }, React__default.createElement(reactRouterDom.Link, {
38029
38185
  to: "/forgot-password",
@@ -38046,8 +38202,7 @@ var BlockLogin = function BlockLogin(_ref) {
38046
38202
  },
38047
38203
  openModal: isLoginGoogle,
38048
38204
  token: infoUser.accessToken,
38049
- email: infoUser.email,
38050
- setOpenModal: setIsLoginGoogle
38205
+ email: infoUser.email
38051
38206
  }));
38052
38207
  };
38053
38208
 
@@ -47062,6 +47217,8 @@ var initialState = {
47062
47217
  isEnableSurvey: false,
47063
47218
  isConversationOneToOne: false,
47064
47219
  isSandboxMode: false,
47220
+ isLoginGoogle: false,
47221
+ inforUserGoogle: null,
47065
47222
  language: DEFAULT_LANGUAGE_CODE,
47066
47223
  amplitude: {
47067
47224
  user_id: "",
@@ -47087,6 +47244,10 @@ var commonReducer = toolkit.createReducer(initialState, function (builder) {
47087
47244
  state.user = action.payload;
47088
47245
  }).addCase(setSidebar, function (state, action) {
47089
47246
  state.sidebarShow = action.payload;
47247
+ }).addCase(setIsLoginGoogle, function (state, action) {
47248
+ state.isLoginGoogle = action.payload;
47249
+ }).addCase(setInforUserGoogle, function (state, action) {
47250
+ state.inforUserGoogle = action.payload;
47090
47251
  }).addCase(setAlert, function (state, action) {
47091
47252
  state.alert = action.payload;
47092
47253
  }).addCase(reset, function (_state, _action) {
@@ -47962,6 +48123,24 @@ var navMobileReducer = toolkit.createReducer(initialState$B, function (builder)
47962
48123
  });
47963
48124
  });
47964
48125
 
48126
+ var setWeeklyQuestList = toolkit.createAction("setWeeklyQuestList");
48127
+ var setOpenModelCongratulation = toolkit.createAction("setOpenModelCongratulation");
48128
+
48129
+ var initialState$C = {
48130
+ isOpenModelCongratulation: false,
48131
+ lastQuest: undefined,
48132
+ weeklyQuests: []
48133
+ };
48134
+ var weeklyQuestReducer = toolkit.createReducer(initialState$C, function (builder) {
48135
+ builder.addCase(setWeeklyQuestList, function (state, action) {
48136
+ state.weeklyQuests = action.payload;
48137
+ }).addCase(setOpenModelCongratulation, function (state, action) {
48138
+ state.isOpenModelCongratulation = action.payload;
48139
+ }).addCase(reset, function (_state, _action) {
48140
+ return initialState$C;
48141
+ });
48142
+ });
48143
+
47965
48144
  var rootReducer = combineReducers({
47966
48145
  common: commonReducer,
47967
48146
  classes: classReducer,
@@ -48002,7 +48181,8 @@ var rootReducer = combineReducers({
48002
48181
  widget: widgetReducer,
48003
48182
  bandScores: commonReducer$h,
48004
48183
  schoolBlankDays: commonReducer$i,
48005
- navMobileReducer: navMobileReducer
48184
+ navMobileReducer: navMobileReducer,
48185
+ weeklyQuests: weeklyQuestReducer
48006
48186
  });
48007
48187
 
48008
48188
  var store = toolkit.configureStore({
@@ -48458,6 +48638,7 @@ var TheLayout = function TheLayout(_ref) {
48458
48638
 
48459
48639
  var resetAuth = function resetAuth() {
48460
48640
  localStorage.removeItem(ACCESS_TOKEN);
48641
+ localStorage.removeItem("ROLES");
48461
48642
  history.push("/");
48462
48643
  };
48463
48644
 
@@ -48625,6 +48806,7 @@ exports.setMailCategory = setMailCategory;
48625
48806
  exports.setModal = setModal;
48626
48807
  exports.setMoveItemQuestion = setMoveItemQuestion;
48627
48808
  exports.setMyStudent = setMyStudent;
48809
+ exports.setOpenModelCongratulation = setOpenModelCongratulation;
48628
48810
  exports.setQuestionByCategory = setQuestionByCategory;
48629
48811
  exports.setQuestionCateList = setQuestionCateList;
48630
48812
  exports.setQuestionList = setQuestionList;
@@ -48648,6 +48830,7 @@ exports.setTurnOffPassWhenChangeMode = setTurnOffPassWhenChangeMode;
48648
48830
  exports.setTutorialScreenList = setTutorialScreenList;
48649
48831
  exports.setUser = setUser;
48650
48832
  exports.setUserList = setUserList;
48833
+ exports.setWeeklyQuestList = setWeeklyQuestList;
48651
48834
  exports.showFontSize = showFontSize;
48652
48835
  exports.showMenuBar = showMenuBar;
48653
48836
  exports.store = store;