touchstudy-core 0.1.149 → 0.1.150

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
@@ -21,7 +21,7 @@ var Select = require('react-select');
21
21
  var Select__default = _interopDefault(Select);
22
22
  var CreatableSelect = _interopDefault(require('react-select/creatable'));
23
23
  var axios = _interopDefault(require('axios'));
24
- var _$6 = _interopDefault(require('lodash'));
24
+ var _$8 = _interopDefault(require('lodash'));
25
25
  var reactGoogleLogin = require('@leecheuk/react-google-login');
26
26
  require('moment/locale/ko.js');
27
27
  require('moment/locale/en-au.js');
@@ -1473,6 +1473,7 @@ var order_matters = "순서 상관 있음";
1473
1473
  var order_does_not_matter = "순서 상관 없음";
1474
1474
  var synonym_processing = "답 이음동의어 처리";
1475
1475
  var compare_type = "비교 유형";
1476
+ var answer_cannot_be_empty = "답변은 비워둘 수 없습니다";
1476
1477
  var lang_ko = {
1477
1478
  problem_solving: problem_solving,
1478
1479
  my_story: my_story,
@@ -2583,7 +2584,8 @@ var lang_ko = {
2583
2584
  order_matters: order_matters,
2584
2585
  order_does_not_matter: order_does_not_matter,
2585
2586
  synonym_processing: synonym_processing,
2586
- compare_type: compare_type
2587
+ compare_type: compare_type,
2588
+ answer_cannot_be_empty: answer_cannot_be_empty
2587
2589
  };
2588
2590
 
2589
2591
  var problem_solving$1 = "Problem Solving";
@@ -3717,6 +3719,7 @@ var order_matters$1 = "Order matters";
3717
3719
  var order_does_not_matter$1 = "Order doesn't matter";
3718
3720
  var synonym_processing$1 = "Answer Synonym processing";
3719
3721
  var compare_type$1 = "Compare Type";
3722
+ var answer_cannot_be_empty$1 = "Answer cannot be empty";
3720
3723
  var lang_en = {
3721
3724
  problem_solving: problem_solving$1,
3722
3725
  my_story: my_story$1,
@@ -4829,7 +4832,8 @@ var lang_en = {
4829
4832
  order_matters: order_matters$1,
4830
4833
  order_does_not_matter: order_does_not_matter$1,
4831
4834
  synonym_processing: synonym_processing$1,
4832
- compare_type: compare_type$1
4835
+ compare_type: compare_type$1,
4836
+ answer_cannot_be_empty: answer_cannot_be_empty$1
4833
4837
  };
4834
4838
 
4835
4839
  i18n__default.use(reactI18next.initReactI18next).init({
@@ -6426,7 +6430,7 @@ var getLocalDayOfWeek = function getLocalDayOfWeek(utcDateTime, dayOfWeek) {
6426
6430
  return moment.utc(utcDateTime).add(diff, "days").local().weekday();
6427
6431
  };
6428
6432
  var getUtcDayOfWeek = function getUtcDayOfWeek(localDateTime, dayOfWeek) {
6429
- var currentDayOfWeek = _$6.cloneDeep(localDateTime).local().weekday();
6433
+ var currentDayOfWeek = _$8.cloneDeep(localDateTime).local().weekday();
6430
6434
  var diff = dayOfWeek - currentDayOfWeek;
6431
6435
  if (diff < 0) diff += 7;
6432
6436
  return localDateTime.add(diff, "days").utc().weekday();
@@ -6927,7 +6931,7 @@ var useList = function useList(fetchData, defaultQuery) {
6927
6931
  var _paging$page, _paging$limit;
6928
6932
  return (((_paging$page = paging.page) != null ? _paging$page : 0) - 1) * ((_paging$limit = paging.limit) != null ? _paging$limit : 0) + index + 1;
6929
6933
  };
6930
- var debounceSearch = _$6.debounce(function () {
6934
+ var debounceSearch = _$8.debounce(function () {
6931
6935
  var _textSearchRef$curren;
6932
6936
  setFilter(_extends({}, filter, {
6933
6937
  currentPage: 1,
@@ -12764,7 +12768,7 @@ var ClassForm = function ClassForm(_ref) {
12764
12768
  };
12765
12769
  var handleDeleteWeeklyDays = function handleDeleteWeeklyDays(currentValue) {
12766
12770
  if (formikProp.values.courseWeeklyDays.length <= 1) return;
12767
- var courseWeeklyDays = _$6.cloneDeep(formikProp.values.courseWeeklyDays);
12771
+ var courseWeeklyDays = _$8.cloneDeep(formikProp.values.courseWeeklyDays);
12768
12772
  var newValues = courseWeeklyDays.filter(function (i) {
12769
12773
  var _i$startTime, _currentValue$startTi, _i$endTime, _currentValue$endTime;
12770
12774
  return i.dayOfWeek !== currentValue.dayOfWeek || ((_i$startTime = i.startTime) === null || _i$startTime === void 0 ? void 0 : _i$startTime.format("HH:mm:ss")) !== ((_currentValue$startTi = currentValue.startTime) === null || _currentValue$startTi === void 0 ? void 0 : _currentValue$startTi.format("HH:mm:ss")) || ((_i$endTime = i.endTime) === null || _i$endTime === void 0 ? void 0 : _i$endTime.format("HH:mm:ss")) !== ((_currentValue$endTime = currentValue.endTime) === null || _currentValue$endTime === void 0 ? void 0 : _currentValue$endTime.format("HH:mm:ss"));
@@ -12800,7 +12804,7 @@ var ClassForm = function ClassForm(_ref) {
12800
12804
  var handleChangeWeeklyDayTime = function handleChangeWeeklyDayTime(key, newValue, currentValue) {
12801
12805
  var _extends2;
12802
12806
  var time = newValue === null || newValue === void 0 ? void 0 : newValue.local();
12803
- var courseWeeklyDays = _$6.cloneDeep(formikProp.values.courseWeeklyDays);
12807
+ var courseWeeklyDays = _$8.cloneDeep(formikProp.values.courseWeeklyDays);
12804
12808
  var currentIndex = courseWeeklyDays.findIndex(function (i) {
12805
12809
  var _i$startTime2, _currentValue$startTi2, _i$endTime2, _currentValue$endTime2;
12806
12810
  return i.dayOfWeek === currentValue.dayOfWeek && ((_i$startTime2 = i.startTime) === null || _i$startTime2 === void 0 ? void 0 : _i$startTime2.format("HH:mm:ss")) === ((_currentValue$startTi2 = currentValue.startTime) === null || _currentValue$startTi2 === void 0 ? void 0 : _currentValue$startTi2.format("HH:mm:ss")) && ((_i$endTime2 = i.endTime) === null || _i$endTime2 === void 0 ? void 0 : _i$endTime2.format("HH:mm:ss")) === ((_currentValue$endTime2 = currentValue.endTime) === null || _currentValue$endTime2 === void 0 ? void 0 : _currentValue$endTime2.format("HH:mm:ss"));
@@ -12835,11 +12839,11 @@ var ClassForm = function ClassForm(_ref) {
12835
12839
  }, [JSON.stringify(data)]);
12836
12840
  var minDate = React.useMemo(function () {
12837
12841
  if (!formikProp.values.startDate) return undefined;
12838
- return _$6.cloneDeep(formikProp.values.startDate).add(1, "days");
12842
+ return _$8.cloneDeep(formikProp.values.startDate).add(1, "days");
12839
12843
  }, [formikProp.values.startDate]);
12840
12844
  var maxDate = React.useMemo(function () {
12841
12845
  if (!formikProp.values.endDate) return undefined;
12842
- return _$6.cloneDeep(formikProp.values.endDate).add(1, "days");
12846
+ return _$8.cloneDeep(formikProp.values.endDate).add(1, "days");
12843
12847
  }, [formikProp.values.endDate]);
12844
12848
  var WeeklyDayErrors = formikProp.touched.courseWeeklyDays && formikProp.errors.courseWeeklyDays && React__default.createElement("div", {
12845
12849
  className: "mt-1"
@@ -12856,7 +12860,7 @@ var ClassForm = function ClassForm(_ref) {
12856
12860
  });
12857
12861
  }, [JSON.stringify(formikProp.values.courseWeeklyDays)]);
12858
12862
  var courseWeeklyDays = React.useMemo(function () {
12859
- return _$6.sortBy(formikProp.values.courseWeeklyDays, ["dayOfWeek"]);
12863
+ return _$8.sortBy(formikProp.values.courseWeeklyDays, ["dayOfWeek"]);
12860
12864
  }, [JSON.stringify(formikProp.values.courseWeeklyDays)]);
12861
12865
  return React__default.createElement("div", {
12862
12866
  className: "d-flex flex-column"
@@ -13007,7 +13011,7 @@ var ClassForm = function ClassForm(_ref) {
13007
13011
  value: v.startTime,
13008
13012
  format: "HH:mm",
13009
13013
  open: open === index + "-startTime",
13010
- maxTime: v.endTime ? _$6.cloneDeep(v.endTime).add(-1, "minutes") : undefined,
13014
+ maxTime: v.endTime ? _$8.cloneDeep(v.endTime).add(-1, "minutes") : undefined,
13011
13015
  onAccept: function onAccept(newValue) {
13012
13016
  return handleChangeWeeklyDayTime("startTime", newValue, v);
13013
13017
  },
@@ -13037,7 +13041,7 @@ var ClassForm = function ClassForm(_ref) {
13037
13041
  components: ["TimePicker"]
13038
13042
  }, React__default.createElement(xDatePickers.TimePicker, {
13039
13043
  value: v.endTime,
13040
- minTime: v.startTime ? (_$cloneDeep = _$6.cloneDeep(v.startTime)) === null || _$cloneDeep === void 0 ? void 0 : _$cloneDeep.add(1, "minutes") : undefined,
13044
+ minTime: v.startTime ? (_$cloneDeep = _$8.cloneDeep(v.startTime)) === null || _$cloneDeep === void 0 ? void 0 : _$cloneDeep.add(1, "minutes") : undefined,
13041
13045
  format: "HH:mm",
13042
13046
  open: open === index + "-endTime",
13043
13047
  onAccept: function onAccept(newValue) {
@@ -13170,7 +13174,7 @@ var useStudentInfoDrawer = function useStudentInfoDrawer(props) {
13170
13174
  return _extends({}, state, (_extends2 = {}, _extends2[newValue] = true, _extends2));
13171
13175
  });
13172
13176
  };
13173
- var debounceChangeTab = _$6.debounce(handleChangeTab, 300);
13177
+ var debounceChangeTab = _$8.debounce(handleChangeTab, 300);
13174
13178
  React.useEffect(function () {
13175
13179
  var getStudent = function getStudent() {
13176
13180
  try {
@@ -14729,7 +14733,7 @@ var useNotes = function useNotes(setFilter, filter) {
14729
14733
  var items = (data === null || data === void 0 ? void 0 : data.items) || [];
14730
14734
  var newNotes = items;
14731
14735
  if (filter !== null && filter !== void 0 && filter.currentPage && (filter === null || filter === void 0 ? void 0 : filter.currentPage) > 1) {
14732
- newNotes = [].concat(_$6.uniqBy([].concat(notes, items), "id"));
14736
+ newNotes = [].concat(_$8.uniqBy([].concat(notes, items), "id"));
14733
14737
  }
14734
14738
  setNotes(newNotes);
14735
14739
  });
@@ -14752,7 +14756,7 @@ var useNotes = function useNotes(setFilter, filter) {
14752
14756
  });
14753
14757
  }, [filter === null || filter === void 0 ? void 0 : filter.currentPage, totalPages]);
14754
14758
  var handleNoteAdded = function handleNoteAdded(note) {
14755
- var newNotes = [].concat(_$6.uniqBy([note].concat(notes), "id"));
14759
+ var newNotes = [].concat(_$8.uniqBy([note].concat(notes), "id"));
14756
14760
  setNotes(newNotes);
14757
14761
  };
14758
14762
  var handleNoteUpdated = function handleNoteUpdated(note) {
@@ -15137,7 +15141,7 @@ var useVirtualList = function useVirtualList(studentId, defaultFilter, getItemsA
15137
15141
  var responseItems = (responseData === null || responseData === void 0 ? void 0 : responseData.items) || [];
15138
15142
  var results = responseItems;
15139
15143
  if (filter !== null && filter !== void 0 && filter.currentPage && filter.currentPage > 1) {
15140
- results = [].concat(_$6.uniqBy([].concat(items, responseItems), "id"));
15144
+ results = [].concat(_$8.uniqBy([].concat(items, responseItems), "id"));
15141
15145
  }
15142
15146
  setItems(results);
15143
15147
  });
@@ -15160,7 +15164,7 @@ var useVirtualList = function useVirtualList(studentId, defaultFilter, getItemsA
15160
15164
  });
15161
15165
  }, [filter === null || filter === void 0 ? void 0 : filter.currentPage, totalPages]);
15162
15166
  var handleItemAdded = function handleItemAdded(item) {
15163
- var results = [].concat(_$6.uniqBy([item].concat(items), "id"));
15167
+ var results = [].concat(_$8.uniqBy([item].concat(items), "id"));
15164
15168
  setItems(results);
15165
15169
  };
15166
15170
  var handleItemUpdated = function handleItemUpdated(item) {
@@ -19859,7 +19863,7 @@ var useExamResultData = function useExamResultData(props) {
19859
19863
  topAnswerOrder: i.topAnswerOrder == null ? 0 : i.topAnswerOrder
19860
19864
  });
19861
19865
  });
19862
- var sortedMySeriesQuestionData = _$6.sortBy(questionsData.filter(function (i) {
19866
+ var sortedMySeriesQuestionData = _$8.sortBy(questionsData.filter(function (i) {
19863
19867
  return i.answerOrder !== 0;
19864
19868
  }), ["answerOrder", "questionOrder"]);
19865
19869
  var mySeriesData = [null].concat(sortedMySeriesQuestionData.map(function (item) {
@@ -19869,7 +19873,7 @@ var useExamResultData = function useExamResultData(props) {
19869
19873
  }).map(function () {
19870
19874
  return null;
19871
19875
  }), [null]);
19872
- var sortedTopSeriesQuestionData = _$6.sortBy(questionsData.filter(function (i) {
19876
+ var sortedTopSeriesQuestionData = _$8.sortBy(questionsData.filter(function (i) {
19873
19877
  return i.topAnswerOrder !== 0;
19874
19878
  }), ["topAnswerOrder", "questionOrder"]);
19875
19879
  var topSeriesData = [null].concat(sortedTopSeriesQuestionData.map(function (item) {
@@ -21838,7 +21842,7 @@ var usePreparedExam = function usePreparedExam(_ref) {
21838
21842
  return Promise.reject(e);
21839
21843
  }
21840
21844
  };
21841
- var debounceSearch = _$6.debounce(function () {
21845
+ var debounceSearch = _$8.debounce(function () {
21842
21846
  setTextbookFilter(_extends({}, textbookFilter, {
21843
21847
  currentPage: 1
21844
21848
  }));
@@ -23595,7 +23599,7 @@ var PreparedItem = function PreparedItem(_ref) {
23595
23599
  });
23596
23600
  return React__default.createElement(formik.Form, {
23597
23601
  style: {
23598
- height: !_$6.isEmpty(values) && !textbookList.length ? "100%" : "unset"
23602
+ height: !_$8.isEmpty(values) && !textbookList.length ? "100%" : "unset"
23599
23603
  }
23600
23604
  }, React__default.createElement(material.Stack, null, React__default.createElement(material.Accordion, {
23601
23605
  sx: {
@@ -24001,7 +24005,7 @@ var PreparedItem = function PreparedItem(_ref) {
24001
24005
  open: openConfirmDialog,
24002
24006
  onClose: handleCloseConfirmDialog,
24003
24007
  onSubmit: handleResetFilter
24004
- }), !_$6.isEmpty(values) && !textbookList.length && React__default.createElement(material.Stack, {
24008
+ }), !_$8.isEmpty(values) && !textbookList.length && React__default.createElement(material.Stack, {
24005
24009
  height: 1,
24006
24010
  justifyContent: "center",
24007
24011
  alignItems: "center"
@@ -25371,7 +25375,7 @@ var useStudentClassList = function useStudentClassList(courseId) {
25371
25375
  currentPage: 1
25372
25376
  }));
25373
25377
  };
25374
- var debounceSearch = _$6.debounce(function () {
25378
+ var debounceSearch = _$8.debounce(function () {
25375
25379
  setFilter(_extends({}, filter, {
25376
25380
  currentPage: 1
25377
25381
  }));
@@ -25507,7 +25511,7 @@ var useTeacherClassList = function useTeacherClassList(courseId) {
25507
25511
  currentPage: 1
25508
25512
  }));
25509
25513
  };
25510
- var debounceSearch = _$6.debounce(function () {
25514
+ var debounceSearch = _$8.debounce(function () {
25511
25515
  setFilter(_extends({}, filter, {
25512
25516
  currentPage: 1
25513
25517
  }));
@@ -25820,7 +25824,7 @@ var useClassDetail = function useClassDetail(_ref) {
25820
25824
  });
25821
25825
  }, [JSON.stringify(course)]);
25822
25826
  var convertToRequestBody = function convertToRequestBody(request) {
25823
- var localStartDate = _$6.cloneDeep(request.startDate);
25827
+ var localStartDate = _$8.cloneDeep(request.startDate);
25824
25828
  return _extends({}, request, {
25825
25829
  startDate: request.startDate.utc().format(DATE_TIME_FORMAT),
25826
25830
  endDate: request.endDate.utc().format(DATE_TIME_FORMAT),
@@ -26069,13 +26073,13 @@ var useClassDetail = function useClassDetail(_ref) {
26069
26073
  });
26070
26074
  if (event.target.checked) {
26071
26075
  setSelected(function (prev) {
26072
- return _$6.uniq([].concat(prev, newSelected));
26076
+ return _$8.uniq([].concat(prev, newSelected));
26073
26077
  });
26074
26078
  return;
26075
26079
  }
26076
- setSelected(_$6.difference(selected, newSelected));
26080
+ setSelected(_$8.difference(selected, newSelected));
26077
26081
  };
26078
- var debounceSearch = _$6.debounce(function () {
26082
+ var debounceSearch = _$8.debounce(function () {
26079
26083
  setFilter(_extends({}, filter, {
26080
26084
  currentPage: 1
26081
26085
  }));
@@ -26093,7 +26097,7 @@ var useClassDetail = function useClassDetail(_ref) {
26093
26097
  }) : userList.map(function (n) {
26094
26098
  return n.teacherId;
26095
26099
  });
26096
- var checkLength = _$6.intersection(selected, newSelected).length;
26100
+ var checkLength = _$8.intersection(selected, newSelected).length;
26097
26101
  return checkLength === userLength;
26098
26102
  };
26099
26103
  var handleClear = function handleClear() {
@@ -26128,7 +26132,7 @@ var useClassDetail = function useClassDetail(_ref) {
26128
26132
  }));
26129
26133
  setSelected([]);
26130
26134
  };
26131
- var debounceSort = _$6.debounce(handleSort, 300);
26135
+ var debounceSort = _$8.debounce(handleSort, 300);
26132
26136
  var handleChangePage = function handleChangePage(_, page) {
26133
26137
  setFilter(_extends({}, filter, {
26134
26138
  currentPage: page
@@ -26212,8 +26216,8 @@ var LessonFormBody = function LessonFormBody(_ref) {
26212
26216
  React.useEffect(function () {
26213
26217
  if (open && data) formikProp.setValues(data);else formikProp.setValues(DEFAULT_LESSON_REQUEST);
26214
26218
  }, [open, JSON.stringify(data)]);
26215
- var maxTime = formikProp.values.endTime ? _$6.cloneDeep(formikProp.values.endTime).add(-1, "minutes") : undefined;
26216
- var minTime = formikProp.values.startTime ? _$6.cloneDeep(formikProp.values.startTime).add(1, "minutes") : undefined;
26219
+ var maxTime = formikProp.values.endTime ? _$8.cloneDeep(formikProp.values.endTime).add(-1, "minutes") : undefined;
26220
+ var minTime = formikProp.values.startTime ? _$8.cloneDeep(formikProp.values.startTime).add(1, "minutes") : undefined;
26217
26221
  return React__default.createElement(React.Fragment, null, React__default.createElement(material.DialogContent, {
26218
26222
  sx: {
26219
26223
  overflowY: "unset"
@@ -26780,7 +26784,7 @@ var useClassList = function useClassList(history, classCreateUrl, classUpdateUrl
26780
26784
  currentPage: 1
26781
26785
  }));
26782
26786
  };
26783
- var debounceSearch = _$6.debounce(function () {
26787
+ var debounceSearch = _$8.debounce(function () {
26784
26788
  setClassFilter(_extends({}, classFilter, {
26785
26789
  currentPage: 1
26786
26790
  }));
@@ -27904,7 +27908,7 @@ var useUserList = function useUserList(role) {
27904
27908
  currentPage: 1
27905
27909
  }));
27906
27910
  };
27907
- var debounceSort = _$6.debounce(handleSort, 300);
27911
+ var debounceSort = _$8.debounce(handleSort, 300);
27908
27912
  var getUserById = function getUserById(id) {
27909
27913
  try {
27910
27914
  var _temp8 = function _temp8() {
@@ -28062,7 +28066,7 @@ var useUserList = function useUserList(role) {
28062
28066
  return Promise.reject(e);
28063
28067
  }
28064
28068
  };
28065
- var debounceSearch = _$6.debounce(function () {
28069
+ var debounceSearch = _$8.debounce(function () {
28066
28070
  setFilter(_extends({}, filter, {
28067
28071
  currentPage: 1
28068
28072
  }));
@@ -29375,8 +29379,8 @@ var useExamDetailView = function useExamDetailView(props) {
29375
29379
  var handleAddArticle = function handleAddArticle() {
29376
29380
  var _$maxBy, _$maxBy2;
29377
29381
  if (!exam) return;
29378
- var maxArticle = ((_$maxBy = _$6.maxBy(exam.questions, "article")) === null || _$maxBy === void 0 ? void 0 : _$maxBy.article) || 0;
29379
- var maxOrder = ((_$maxBy2 = _$6.maxBy(exam.questions, "questionOrder")) === null || _$maxBy2 === void 0 ? void 0 : _$maxBy2.questionOrder) || 0;
29382
+ var maxArticle = ((_$maxBy = _$8.maxBy(exam.questions, "article")) === null || _$maxBy === void 0 ? void 0 : _$maxBy.article) || 0;
29383
+ var maxOrder = ((_$maxBy2 = _$8.maxBy(exam.questions, "questionOrder")) === null || _$maxBy2 === void 0 ? void 0 : _$maxBy2.questionOrder) || 0;
29380
29384
  onChangeExam(_extends({}, exam, {
29381
29385
  questions: [].concat(exam.questions, [{
29382
29386
  questionAnswerType: exports.QuestionAnswerType.SingleChoice,
@@ -29424,7 +29428,7 @@ var useExamDetailView = function useExamDetailView(props) {
29424
29428
  var examGroupByArticle = React.useMemo(function () {
29425
29429
  if (!exam) return [];
29426
29430
  var articles = [];
29427
- var groupedArticle = _$6.groupBy(exam.questions, "article");
29431
+ var groupedArticle = _$8.groupBy(exam.questions, "article");
29428
29432
  for (var key in groupedArticle) {
29429
29433
  if (Object.prototype.hasOwnProperty.call(groupedArticle, key)) {
29430
29434
  var _questions$find, _$maxBy3;
@@ -29434,13 +29438,13 @@ var useExamDetailView = function useExamDetailView(props) {
29434
29438
  categoryId: (_questions$find = questions.find(function (i) {
29435
29439
  return !!i.categoryId;
29436
29440
  })) === null || _questions$find === void 0 ? void 0 : _questions$find.categoryId,
29437
- answerCount: ((_$maxBy3 = _$6.maxBy(questions, "numberOfAnswers")) === null || _$maxBy3 === void 0 ? void 0 : _$maxBy3.numberOfAnswers) || DEFAULT_ANSWER_COUNT,
29441
+ answerCount: ((_$maxBy3 = _$8.maxBy(questions, "numberOfAnswers")) === null || _$maxBy3 === void 0 ? void 0 : _$maxBy3.numberOfAnswers) || DEFAULT_ANSWER_COUNT,
29438
29442
  questionCount: questions.length,
29439
29443
  questions: questions
29440
29444
  });
29441
29445
  }
29442
29446
  }
29443
- return _$6.sortBy(articles, "article");
29447
+ return _$8.sortBy(articles, "article");
29444
29448
  }, [JSON.stringify(exam)]);
29445
29449
  var durationOptions = React.useMemo(function () {
29446
29450
  var options = DURATION_OPTIONS.map(function (i) {
@@ -31861,11 +31865,11 @@ var useTextbookShare = function useTextbookShare(props) {
31861
31865
  });
31862
31866
  if (event.target.checked) {
31863
31867
  setSelectedShare(function (prev) {
31864
- return _$6.uniq([].concat(prev, newSelected));
31868
+ return _$8.uniq([].concat(prev, newSelected));
31865
31869
  });
31866
31870
  return;
31867
31871
  }
31868
- setSelectedShare(_$6.difference(selectedShare, newSelected));
31872
+ setSelectedShare(_$8.difference(selectedShare, newSelected));
31869
31873
  };
31870
31874
  var isCheckAllShare = function isCheckAllShare(userLength) {
31871
31875
  var newSelected = isUpdate ? shared.map(function (n) {
@@ -31873,7 +31877,7 @@ var useTextbookShare = function useTextbookShare(props) {
31873
31877
  }) : notShared.map(function (n) {
31874
31878
  return n.id;
31875
31879
  });
31876
- var checkLength = _$6.intersection(selectedShare, newSelected).length;
31880
+ var checkLength = _$8.intersection(selectedShare, newSelected).length;
31877
31881
  return checkLength === userLength;
31878
31882
  };
31879
31883
  var handleClickCheckboxShare = function handleClickCheckboxShare(id) {
@@ -32132,7 +32136,7 @@ var TextbookList = function TextbookList(props) {
32132
32136
  handleUpdateSharedTextbook = _useTextbookShare.handleUpdateSharedTextbook,
32133
32137
  currentModel = _useTextbookShare.currentModel;
32134
32138
  var textbookHeaders = React.useMemo(function () {
32135
- var headers = _$6.clone(TEXTBOOK_HEADERS);
32139
+ var headers = _$8.clone(TEXTBOOK_HEADERS);
32136
32140
  if (isTeacher && isTeacherSite) headers.splice(5, 0, {
32137
32141
  title: "teacher_personal_textbook"
32138
32142
  });
@@ -32727,7 +32731,7 @@ var useNotificationList = function useNotificationList(_ref) {
32727
32731
  currentPage: 1
32728
32732
  }));
32729
32733
  };
32730
- var debounceSearch = _$6.debounce(function () {
32734
+ var debounceSearch = _$8.debounce(function () {
32731
32735
  setNotificationFilter(_extends({}, notificationFilter, {
32732
32736
  currentPage: 1
32733
32737
  }));
@@ -33290,7 +33294,7 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
33290
33294
  return !isTextType(answerType);
33291
33295
  },
33292
33296
  then: function then(schema) {
33293
- return schema.min(2, t("question_answer_required"));
33297
+ return schema.min(1, t("answer_cannot_be_empty"));
33294
33298
  },
33295
33299
  otherwise: function otherwise(schema) {
33296
33300
  return schema.notRequired();
@@ -33299,12 +33303,12 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
33299
33303
  score: yup.number().required(),
33300
33304
  questionOrder: yup.number().required(),
33301
33305
  questionTypeId: yup.number().notRequired(),
33302
- correctTextualAnswers: yup.array().of(yup.string().trim().required(t("short_string_answer_cannot_be_empty"))).when("questionAnswerType", {
33306
+ correctTextualAnswers: yup.array().when("questionAnswerType", {
33303
33307
  is: function is(answerType) {
33304
33308
  return isTextType(answerType);
33305
33309
  },
33306
33310
  then: function then(schema) {
33307
- return schema.min(1, t("question_answer_required"));
33311
+ return schema.of(yup.string().trim().required(t("answer_cannot_be_empty"))).min(1, t("answer_cannot_be_empty"));
33308
33312
  },
33309
33313
  otherwise: function otherwise(schema) {
33310
33314
  return schema.notRequired();
@@ -33314,7 +33318,7 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
33314
33318
  return isTextType(answerType) && answerType !== exports.QuestionAnswerType.ShortAnswer;
33315
33319
  },
33316
33320
  then: function then(schema) {
33317
- return schema.min(2, t("question_answer_required"));
33321
+ return schema.of(yup.string().trim().required(t("answer_cannot_be_empty"))).min(2, t("answer_cannot_be_empty"));
33318
33322
  }
33319
33323
  })
33320
33324
  });
@@ -33454,7 +33458,7 @@ var CustomTextbookTab = function CustomTextbookTab(props) {
33454
33458
  };
33455
33459
 
33456
33460
  var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
33457
- var values = isMath !== undefined ? _$6.cloneDeep(textbook) : textbook;
33461
+ var values = isMath !== undefined ? _$8.cloneDeep(textbook) : textbook;
33458
33462
  if (isMath !== undefined) values.type = isMath;
33459
33463
  for (var key in values) {
33460
33464
  if (values.hasOwnProperty(key)) {
@@ -33469,7 +33473,7 @@ var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
33469
33473
  return values;
33470
33474
  };
33471
33475
  var _resetAllCategoriesAndQuestionTypesBySubject = function resetAllCategoriesAndQuestionTypesBySubject(textbook, subject) {
33472
- var values = subject ? _$6.cloneDeep(textbook) : textbook;
33476
+ var values = subject ? _$8.cloneDeep(textbook) : textbook;
33473
33477
  if (subject) {
33474
33478
  values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
33475
33479
  values.subject = subject;
@@ -33632,7 +33636,7 @@ var isSequentialQuestionGroups = function isSequentialQuestionGroups(questionGro
33632
33636
  return true;
33633
33637
  };
33634
33638
 
33635
- var _ = _$6;
33639
+ var _ = _$8;
33636
33640
  var ArticleBlock = function ArticleBlock(_ref) {
33637
33641
  var errors = _ref.errors,
33638
33642
  expandedIndex = _ref.expandedIndex,
@@ -33977,13 +33981,18 @@ var QuestionOrderName = function QuestionOrderName(_ref) {
33977
33981
  }));
33978
33982
  };
33979
33983
 
33984
+ var _$1 = _$8;
33980
33985
  var QuestionShortInput = function QuestionShortInput(_ref) {
33981
33986
  var name = _ref.name,
33982
33987
  deletable = _ref.deletable,
33988
+ errors = _ref.errors,
33983
33989
  onDelete = _ref.onDelete;
33984
33990
  var _useTranslation = reactI18next.useTranslation(),
33985
33991
  t = _useTranslation.t;
33986
- return React__default.createElement(formik.Field, {
33992
+ var error = _$1.get(errors, name);
33993
+ return React__default.createElement(material.Stack, {
33994
+ direction: "column"
33995
+ }, React__default.createElement(formik.Field, {
33987
33996
  name: name,
33988
33997
  render: function render(_ref2) {
33989
33998
  var field = _ref2.field;
@@ -34000,7 +34009,8 @@ var QuestionShortInput = function QuestionShortInput(_ref) {
34000
34009
  "& input": {
34001
34010
  paddingRight: deletable ? "40px" : undefined
34002
34011
  }
34003
- }
34012
+ },
34013
+ error: !!error
34004
34014
  })), deletable && React__default.createElement(material.Stack, {
34005
34015
  justifyContent: "center",
34006
34016
  alignItems: "center",
@@ -34022,14 +34032,23 @@ var QuestionShortInput = function QuestionShortInput(_ref) {
34022
34032
  size: 12
34023
34033
  })))));
34024
34034
  }
34025
- });
34035
+ }), !!error && React__default.createElement(material.Typography, {
34036
+ fontWeight: 500,
34037
+ fontSize: "10px",
34038
+ lineHeight: "11.93px",
34039
+ mt: 1,
34040
+ color: !error ? "#97A1AF" : "#F34B4B"
34041
+ }, error));
34026
34042
  };
34027
34043
  var isEqual$1 = function isEqual(prev, next) {
34028
- return prev.value === next.value && prev.name == next.name && prev.deletable == next.deletable;
34044
+ var prevError = _$1.get(prev.errors, prev.name);
34045
+ var nextError = _$1.get(next.errors, next.name);
34046
+ return JSON.stringify(prevError) === JSON.stringify(nextError) && prev.value === next.value && prev.name == next.name && prev.deletable == next.deletable;
34029
34047
  };
34030
34048
  var QuestionShortInput$1 = React.memo(QuestionShortInput, isEqual$1);
34031
34049
 
34032
34050
  var _excluded$h = ["onChange"];
34051
+ var _$2 = _$8;
34033
34052
  var BpIcon$1 = material.styled("span")(function (_ref) {
34034
34053
  var theme = _ref.theme;
34035
34054
  return {
@@ -34060,6 +34079,7 @@ var BpCheckedIcon$1 = material.styled(BpIcon$1)({
34060
34079
  }
34061
34080
  });
34062
34081
  var QuestionBlock = function QuestionBlock(_ref2) {
34082
+ var _data$correctTextualA4;
34063
34083
  var answerCount = _ref2.answerCount,
34064
34084
  isMath = _ref2.isMath,
34065
34085
  disabled = _ref2.disabled,
@@ -34069,6 +34089,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34069
34089
  isLoadingQuestionTypes = _ref2.isLoadingQuestionTypes,
34070
34090
  optionKey = _ref2.optionKey,
34071
34091
  questionTypes = _ref2.questionTypes,
34092
+ errors = _ref2.errors,
34072
34093
  setFieldValue = _ref2.setFieldValue,
34073
34094
  onCloseQuestionTypeMenu = _ref2.onCloseQuestionTypeMenu,
34074
34095
  onOpenQuestionTypeMenu = _ref2.onOpenQuestionTypeMenu;
@@ -34077,7 +34098,8 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34077
34098
  var theme = material.useTheme();
34078
34099
  var isTabletUp = material.useMediaQuery(theme.breakpoints.up("lg"));
34079
34100
  var handleCheckMultiChoice = function handleCheckMultiChoice(choice) {
34080
- var updatedAnswers = data.correctAnswers;
34101
+ var _data$correctAnswers;
34102
+ var updatedAnswers = (_data$correctAnswers = data.correctAnswers) != null ? _data$correctAnswers : [];
34081
34103
  if (updatedAnswers.includes(choice)) {
34082
34104
  updatedAnswers = updatedAnswers.filter(function (item) {
34083
34105
  return item !== choice;
@@ -34088,36 +34110,41 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34088
34110
  setFieldValue(path + ".correctAnswers", updatedAnswers);
34089
34111
  };
34090
34112
  var handleAddTextualAnswer = function handleAddTextualAnswer() {
34091
- data.correctTextualAnswers.length === 1 && setFieldValue(path + ".questionAnswerType", exports.QuestionAnswerType.OrderMatters);
34092
- setFieldValue(path + ".correctTextualAnswers", [].concat(data.correctTextualAnswers, [""]));
34113
+ var _data$correctTextualA, _data$correctTextualA2;
34114
+ ((_data$correctTextualA = data.correctTextualAnswers) === null || _data$correctTextualA === void 0 ? void 0 : _data$correctTextualA.length) === 1 && setFieldValue(path + ".questionAnswerType", exports.QuestionAnswerType.OrderMatters);
34115
+ setFieldValue(path + ".correctTextualAnswers", [].concat((_data$correctTextualA2 = data.correctTextualAnswers) != null ? _data$correctTextualA2 : [], [""]));
34093
34116
  };
34094
34117
  var handleRemoveTextualAnswer = function handleRemoveTextualAnswer(remove, index) {
34095
- data.correctTextualAnswers.length === 2 && setFieldValue(path + ".questionAnswerType", exports.QuestionAnswerType.ShortAnswer);
34118
+ var _data$correctTextualA3;
34119
+ ((_data$correctTextualA3 = data.correctTextualAnswers) === null || _data$correctTextualA3 === void 0 ? void 0 : _data$correctTextualA3.length) === 2 && setFieldValue(path + ".questionAnswerType", exports.QuestionAnswerType.ShortAnswer);
34096
34120
  remove(index);
34097
34121
  };
34098
34122
  var handleChangeQuestionAnswerType = function handleChangeQuestionAnswerType(value) {
34099
34123
  switch (value === null || value === void 0 ? void 0 : value.value) {
34100
34124
  case exports.QuestionAnswerType.SingleChoice:
34101
34125
  case exports.QuestionAnswerType.MultipleChoice:
34102
- setFieldValue(path + ".correctTextualAnswers", []);
34126
+ setFieldValue(path + ".correctTextualAnswers", null);
34127
+ if (!data.correctAnswers || data.correctAnswers.length === 0) setFieldValue(path + ".correctAnswers", [1]);
34103
34128
  break;
34104
34129
  default:
34105
- if (data.correctTextualAnswers.length === 0) setFieldValue(path + ".correctTextualAnswers", [""]);
34130
+ if (!data.correctTextualAnswers || data.correctTextualAnswers.length === 0) setFieldValue(path + ".correctTextualAnswers", [""]);
34131
+ setFieldValue(path + ".correctAnswers", null);
34106
34132
  break;
34107
34133
  }
34108
- setFieldValue(path + ".questionAnswerType", (value === null || value === void 0 ? void 0 : value.value) || 0);
34134
+ setFieldValue(path + ".questionAnswerType", (value === null || value === void 0 ? void 0 : value.value) || exports.QuestionAnswerType.SingleChoice);
34109
34135
  };
34110
34136
  var handleChangeCompareType = function handleChangeCompareType(_, value) {
34111
- setFieldValue(path + ".questionAnswerType", Number(value) || 0);
34137
+ setFieldValue(path + ".questionAnswerType", Number(value) || exports.QuestionAnswerType.OrderMatters);
34112
34138
  };
34113
34139
  var handleOpenQuestionTypeMenu = function handleOpenQuestionTypeMenu() {
34114
34140
  onOpenQuestionTypeMenu(path + ".questionTypeId");
34115
34141
  };
34116
- var isIncomplatedTextualAnswers = data.correctTextualAnswers.some(function (i) {
34117
- return !i.trim();
34118
- });
34119
34142
  var isTextAnswerType = isTextType(data.questionAnswerType);
34143
+ var isIncomplatedTextualAnswers = isTextAnswerType && ((_data$correctTextualA4 = data.correctTextualAnswers) === null || _data$correctTextualA4 === void 0 ? void 0 : _data$correctTextualA4.some(function (i) {
34144
+ return !i.trim();
34145
+ }));
34120
34146
  var renderAnswer = function renderAnswer() {
34147
+ var _data$correctAnswers3;
34121
34148
  switch (data.questionAnswerType) {
34122
34149
  case exports.QuestionAnswerType.ShortAnswer:
34123
34150
  case exports.QuestionAnswerType.SynonymProcessing:
@@ -34126,6 +34153,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34126
34153
  return React__default.createElement(formik.FieldArray, {
34127
34154
  name: path + ".correctTextualAnswers"
34128
34155
  }, function (_ref3) {
34156
+ var _data$correctTextualA5;
34129
34157
  var remove = _ref3.remove;
34130
34158
  return React__default.createElement(material.Stack, {
34131
34159
  sx: {
@@ -34139,18 +34167,19 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34139
34167
  gap: "12px",
34140
34168
  flexWrap: "wrap"
34141
34169
  }, React__default.createElement(ListView, {
34142
- data: data.correctTextualAnswers,
34170
+ data: (_data$correctTextualA5 = data.correctTextualAnswers) != null ? _data$correctTextualA5 : [],
34143
34171
  render: function render(_, index) {
34144
34172
  return React__default.createElement(material.Box, {
34145
34173
  key: index,
34146
34174
  minWidth: "200px"
34147
34175
  }, React__default.createElement(QuestionShortInput$1, {
34176
+ errors: errors,
34148
34177
  value: data.correctTextualAnswers[index],
34149
34178
  name: path + ".correctTextualAnswers[" + index + "]",
34150
34179
  onDelete: function onDelete() {
34151
34180
  return handleRemoveTextualAnswer(remove, index);
34152
34181
  },
34153
- deletable: data.correctTextualAnswers.length > 1
34182
+ deletable: data.correctTextualAnswers && data.correctTextualAnswers.length > 1
34154
34183
  }));
34155
34184
  }
34156
34185
  })));
@@ -34165,6 +34194,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34165
34194
  }, function (_, i) {
34166
34195
  return i + 1;
34167
34196
  }).map(function (i) {
34197
+ var _data$correctAnswers2;
34168
34198
  return React__default.createElement(material.FormControlLabel, {
34169
34199
  key: i,
34170
34200
  className: styles$a["question-label"] + " w-fit",
@@ -34172,7 +34202,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34172
34202
  value: i,
34173
34203
  disabled: disabled,
34174
34204
  control: React__default.createElement(material.Checkbox, {
34175
- checked: data.correctAnswers.includes(i),
34205
+ checked: (_data$correctAnswers2 = data.correctAnswers) === null || _data$correctAnswers2 === void 0 ? void 0 : _data$correctAnswers2.includes(i),
34176
34206
  onChange: function onChange(e) {
34177
34207
  return handleCheckMultiChoice(+e.target.value);
34178
34208
  }
@@ -34190,7 +34220,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34190
34220
  }, React__default.createElement(material.FormControl, {
34191
34221
  className: "flex-grow-1 w-100"
34192
34222
  }, React__default.createElement(material.RadioGroup, {
34193
- value: data.correctAnswers[0],
34223
+ value: (_data$correctAnswers3 = data.correctAnswers) === null || _data$correctAnswers3 === void 0 ? void 0 : _data$correctAnswers3[0],
34194
34224
  name: "answers",
34195
34225
  className: "flex-row w-100"
34196
34226
  }, Array.from({
@@ -34198,6 +34228,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34198
34228
  }, function (_, i) {
34199
34229
  return i + 1;
34200
34230
  }).map(function (i) {
34231
+ var _data$correctAnswers4;
34201
34232
  return React__default.createElement(material.FormControlLabel, {
34202
34233
  key: i,
34203
34234
  className: styles$a["question-label"] + " w-fit",
@@ -34209,7 +34240,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34209
34240
  disabled: disabled,
34210
34241
  control: React__default.createElement(material.Radio, {
34211
34242
  size: "small",
34212
- checked: +i === data.correctAnswers[0],
34243
+ checked: +i === ((_data$correctAnswers4 = data.correctAnswers) === null || _data$correctAnswers4 === void 0 ? void 0 : _data$correctAnswers4[0]),
34213
34244
  checkedIcon: React__default.createElement(BpCheckedIcon$1, null),
34214
34245
  icon: React__default.createElement(BpIcon$1, null)
34215
34246
  }),
@@ -34257,7 +34288,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34257
34288
  questionTitleStyle: questionTitleStyle
34258
34289
  })), React__default.createElement(material.Box, {
34259
34290
  flexGrow: 1
34260
- }, data.correctTextualAnswers.length > 1 && React__default.createElement(material.Box, null, React__default.createElement(QuestionCompareType, {
34291
+ }, data.correctTextualAnswers && data.correctTextualAnswers.length > 1 && React__default.createElement(material.Box, null, React__default.createElement(QuestionCompareType, {
34261
34292
  value: data.questionAnswerType,
34262
34293
  onChange: handleChangeCompareType
34263
34294
  })), renderAnswer())), React__default.createElement(material.Stack, {
@@ -34362,6 +34393,8 @@ var QuestionBlock = function QuestionBlock(_ref2) {
34362
34393
  })))));
34363
34394
  };
34364
34395
  var isEqual$2 = function isEqual(prev, next) {
34396
+ var prevError = _$2.get(prev.errors, prev.path);
34397
+ var nextError = _$2.get(next.errors, next.path);
34365
34398
  var isPrevMatched = prev.optionKey === prev.path + ".questionTypeId";
34366
34399
  var isNextMatched = next.optionKey === next.path + ".questionTypeId";
34367
34400
  var prevOptionKey = isPrevMatched ? prev.optionKey : undefined;
@@ -34370,12 +34403,12 @@ var isEqual$2 = function isEqual(prev, next) {
34370
34403
  var nextIsLoadingQuestionTypes = isNextMatched ? next.isLoadingQuestionTypes : undefined;
34371
34404
  var prevQuestionTypes = isPrevMatched ? prev.questionTypes : undefined;
34372
34405
  var nextQuestionTypes = isNextMatched ? next.questionTypes : undefined;
34373
- return prevOptionKey === nextOptionKey && prevIsLoadingQuestionTypes === nextIsLoadingQuestionTypes && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevQuestionTypes) === JSON.stringify(nextQuestionTypes) && prev.path === next.path && prev.isMath == next.isMath && prev.answerCount == next.answerCount && prev.disabled == next.disabled && JSON.stringify(prev.questionTitleStyle) === JSON.stringify(next.questionTitleStyle) && prev.onOpenQuestionTypeMenu == next.onOpenQuestionTypeMenu;
34406
+ return JSON.stringify(prevError) === JSON.stringify(nextError) && prevOptionKey === nextOptionKey && prevIsLoadingQuestionTypes === nextIsLoadingQuestionTypes && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevQuestionTypes) === JSON.stringify(nextQuestionTypes) && prev.path === next.path && prev.isMath == next.isMath && prev.answerCount == next.answerCount && prev.disabled == next.disabled && JSON.stringify(prev.questionTitleStyle) === JSON.stringify(next.questionTitleStyle) && prev.onOpenQuestionTypeMenu == next.onOpenQuestionTypeMenu;
34374
34407
  };
34375
34408
  var QuestionBlock$1 = React.memo(QuestionBlock, isEqual$2);
34376
34409
 
34377
34410
  var _excluded$i = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onQuestioStartOrderChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
34378
- var _$1 = _$6;
34411
+ var _$3 = _$8;
34379
34412
  var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
34380
34413
  var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate, _questions$2;
34381
34414
  var data = _ref.data,
@@ -34400,13 +34433,12 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
34400
34433
  var startOrderRef = React.useRef(null);
34401
34434
  var articles = data.articles,
34402
34435
  questions = data.questions;
34403
- var blockErrors = _$1.get(errors, path);
34404
- console.log(path + ": ", blockErrors);
34436
+ var blockErrors = _$3.get(errors, path);
34405
34437
  var handleOpenQuestionTypeMenu = React.useCallback(function (key) {
34406
34438
  var _data$articles$, _data$articles$$categ, _data$articles$2, _data$articles$2$cate;
34407
34439
  onOpenQuestionTypeMenu(key, (_data$articles$ = data.articles[0]) === null || _data$articles$ === void 0 ? void 0 : (_data$articles$$categ = _data$articles$.categories) === null || _data$articles$$categ === void 0 ? void 0 : _data$articles$$categ[0], (_data$articles$2 = data.articles[0]) === null || _data$articles$2 === void 0 ? void 0 : (_data$articles$2$cate = _data$articles$2.categories) === null || _data$articles$2$cate === void 0 ? void 0 : _data$articles$2$cate[1]);
34408
34440
  }, [(_data$articles$3 = data.articles[0]) === null || _data$articles$3 === void 0 ? void 0 : (_data$articles$3$cate = _data$articles$3.categories) === null || _data$articles$3$cate === void 0 ? void 0 : _data$articles$3$cate[0], (_data$articles$4 = data.articles[0]) === null || _data$articles$4 === void 0 ? void 0 : (_data$articles$4$cate = _data$articles$4.categories) === null || _data$articles$4$cate === void 0 ? void 0 : _data$articles$4$cate[1]]);
34409
- var debounceQuestionStartOrderChange = _$1.debounce(onQuestioStartOrderChange, 300);
34441
+ var debounceQuestionStartOrderChange = _$3.debounce(onQuestioStartOrderChange, 300);
34410
34442
  var handleChangeStartQuestionOrder = function handleChangeStartQuestionOrder(e) {
34411
34443
  var value = e.target.value.replace(/\D/g, '');
34412
34444
  var order = +value;
@@ -34518,8 +34550,8 @@ var isEqual$3 = function isEqual(prev, next) {
34518
34550
  var isNextMatched = next.optionKey.startsWith(next.path);
34519
34551
  var prevOptionKey = isPrevMatched ? prev.optionKey : undefined;
34520
34552
  var nextOptionKey = isNextMatched ? next.optionKey : undefined;
34521
- var prevBlockErrors = _$1.get(prev.errors, prev.path);
34522
- var nextBlockErrors = _$1.get(next.errors, next.path);
34553
+ var prevBlockErrors = _$3.get(prev.errors, prev.path);
34554
+ var nextBlockErrors = _$3.get(next.errors, next.path);
34523
34555
  var prevIsLoadingCategories = isPrevMatched ? prev.isLoadingCategories : undefined;
34524
34556
  var nextIsLoadingCategories = isNextMatched ? next.isLoadingCategories : undefined;
34525
34557
  var prevCategories = isPrevMatched ? prev.categories : undefined;
@@ -34539,7 +34571,7 @@ var isEqual$3 = function isEqual(prev, next) {
34539
34571
  var QuestionGroupBlockBody$1 = React.memo(QuestionGroupBlockBody, isEqual$3);
34540
34572
 
34541
34573
  var _excluded$j = ["expandedIndex", "open", "paths", "path", "isMath", "data", "categories", "isLoadingCategories", "isLoadingQuestionTypes", "questionTypes", "optionKey", "disabled", "onToggle", "onQuestionCountChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
34542
- var _$2 = _$6;
34574
+ var _$4 = _$8;
34543
34575
  var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
34544
34576
  var _data$articles$3, _data$articles$3$cate, _data$articles$3$cate2, _data$articles$4, _data$articles$4$cate, _data$articles$4$cate2;
34545
34577
  var expandedIndex = _ref.expandedIndex,
@@ -34612,9 +34644,11 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
34612
34644
  }));
34613
34645
  } else {
34614
34646
  setFieldValue(path + ".questions", questions.map(function (q) {
34615
- var correctAnswers = q.correctAnswers.filter(function (i) {
34647
+ var _q$correctAnswers$fil, _q$correctAnswers;
34648
+ if (isTextType(q.questionAnswerType)) return _extends({}, q);
34649
+ var correctAnswers = (_q$correctAnswers$fil = (_q$correctAnswers = q.correctAnswers) === null || _q$correctAnswers === void 0 ? void 0 : _q$correctAnswers.filter(function (i) {
34616
34650
  return i <= newAnswerCount;
34617
- });
34651
+ })) != null ? _q$correctAnswers$fil : [1];
34618
34652
  if (correctAnswers.length === 0) correctAnswers = [1];
34619
34653
  return _extends({}, q, {
34620
34654
  numberOfAnswers: newAnswerCount,
@@ -34664,10 +34698,10 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
34664
34698
  }).join(",") : ""].filter(function (i) {
34665
34699
  return !!i;
34666
34700
  }).join(" / ");
34667
- var pageFromError = _$2.get(errors, path + ".pageFrom");
34668
- var pageToError = _$2.get(errors, path + ".pageTo");
34669
- var categoryError = _$2.get(errors, path + ".articles[0].categories");
34670
- var blockErrors = _$2.get(errors, path);
34701
+ var pageFromError = _$4.get(errors, path + ".pageFrom");
34702
+ var pageToError = _$4.get(errors, path + ".pageTo");
34703
+ var categoryError = _$4.get(errors, path + ".articles[0].categories");
34704
+ var blockErrors = _$4.get(errors, path);
34671
34705
  return React__default.createElement(material.Accordion, {
34672
34706
  expanded: open,
34673
34707
  onChange: handleToggle,
@@ -35224,7 +35258,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
35224
35258
  };
35225
35259
 
35226
35260
  var _excluded$l = ["data", "expandedIndex", "open", "path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "categories", "questionTypes", "optionKey", "disabled", "onToggle", "onDelete", "onCopiedPrevQuestionGroup", "onCloseCategoryMenu", "onOpenCategoryMenu", "onOpenSubCategoryMenu", "onOpenQuestionTypeMenu", "onCloseQuestionTypeMenu"];
35227
- var _$3 = _$6;
35261
+ var _$5 = _$8;
35228
35262
  var ChapterBlock = function ChapterBlock(_ref) {
35229
35263
  var data = _ref.data,
35230
35264
  expandedIndex = _ref.expandedIndex,
@@ -35264,10 +35298,10 @@ var ChapterBlock = function ChapterBlock(_ref) {
35264
35298
  chapter: title
35265
35299
  }), title, path.replace(/\[(\d+)\]$/, ""), expandedIndex);
35266
35300
  };
35267
- var pageNameError = _$3.get(errors, path + ".name");
35268
- var pageFromError = _$3.get(errors, path + ".pageFrom");
35269
- var pageToError = _$3.get(errors, path + ".pageTo");
35270
- var blockErrors = _$3.get(errors, path);
35301
+ var pageNameError = _$5.get(errors, path + ".name");
35302
+ var pageFromError = _$5.get(errors, path + ".pageFrom");
35303
+ var pageToError = _$5.get(errors, path + ".pageTo");
35304
+ var blockErrors = _$5.get(errors, path);
35271
35305
  return React__default.createElement(material.Accordion, {
35272
35306
  expanded: open,
35273
35307
  onChange: handleToggle,
@@ -35615,7 +35649,7 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
35615
35649
  return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : (_state$common2$user = _state$common2.user) === null || _state$common2$user === void 0 ? void 0 : _state$common2$user.academyDomain;
35616
35650
  });
35617
35651
  var getOptionFilter = function getOptionFilter() {
35618
- var cloneFilter = _$6.clone(filter);
35652
+ var cloneFilter = _$8.clone(filter);
35619
35653
  for (var key in cloneFilter) {
35620
35654
  if (Object.prototype.hasOwnProperty.call(cloneFilter, key)) {
35621
35655
  var element = cloneFilter[key];
@@ -35765,7 +35799,7 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
35765
35799
  };
35766
35800
  };
35767
35801
 
35768
- var _$4 = _$6;
35802
+ var _$6 = _$8;
35769
35803
  var TextbookContentsTab = function TextbookContentsTab(props) {
35770
35804
  var disabled = props.disabled,
35771
35805
  values = props.values,
@@ -35808,7 +35842,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
35808
35842
  };
35809
35843
  var handleConfirmDeleteBlock = function handleConfirmDeleteBlock() {
35810
35844
  if (!(openConfirmDelete !== null && openConfirmDelete !== void 0 && openConfirmDelete.path)) return;
35811
- var items = _$4.get(values, openConfirmDelete.path, []);
35845
+ var items = _$6.get(values, openConfirmDelete.path, []);
35812
35846
  setFieldValue(openConfirmDelete.path, items.filter(function (_, i) {
35813
35847
  return i !== openConfirmDelete.itemIndex;
35814
35848
  }));
@@ -35848,12 +35882,12 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
35848
35882
  if (!newParts.length) return;
35849
35883
  if (newParts.length < parts.length) {
35850
35884
  var _$get, _$get2, _$get3;
35851
- var subChapters = (_$get = _$4.get(values, newPath + ".subChapters")) != null ? _$get : [];
35885
+ var subChapters = (_$get = _$6.get(values, newPath + ".subChapters")) != null ? _$get : [];
35852
35886
  var questionGroups = [];
35853
- if (!subChapters.length) questionGroups = (_$get2 = _$4.get(values, newPath + ".questionGroups")) != null ? _$get2 : [];else questionGroups = (_$get3 = _$4.get(values, newPath + ".subChapters[" + (subChapters.length - 1) + "].questionGroups")) != null ? _$get3 : [];
35854
- return _$4.last(questionGroups);
35887
+ if (!subChapters.length) questionGroups = (_$get2 = _$6.get(values, newPath + ".questionGroups")) != null ? _$get2 : [];else questionGroups = (_$get3 = _$6.get(values, newPath + ".subChapters[" + (subChapters.length - 1) + "].questionGroups")) != null ? _$get3 : [];
35888
+ return _$6.last(questionGroups);
35855
35889
  }
35856
- return _$4.get(values, newPath);
35890
+ return _$6.get(values, newPath);
35857
35891
  };
35858
35892
  var handleOpenSubCategoryMenu = React.useCallback(function (key, categoryId) {
35859
35893
  setOptionKey(key);
@@ -36345,7 +36379,7 @@ var useSelect = function useSelect(_ref) {
36345
36379
  setLoading = _useState2[1];
36346
36380
  React.useEffect(function () {
36347
36381
  if (!email || !academy) return;
36348
- var fetchData = _$6.debounce(function () {
36382
+ var fetchData = _$8.debounce(function () {
36349
36383
  try {
36350
36384
  var _temp2 = function _temp2() {
36351
36385
  setLoading(false);
@@ -36459,7 +36493,7 @@ var OwnerSelector = function OwnerSelector(_ref) {
36459
36493
  }, errors === null || errors === void 0 ? void 0 : errors.textbookOwners[index].courseId)));
36460
36494
  };
36461
36495
 
36462
- var _$5 = _$6;
36496
+ var _$7 = _$8;
36463
36497
  var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
36464
36498
  var errors = _ref.errors,
36465
36499
  values = _ref.values,
@@ -36532,12 +36566,12 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
36532
36566
  disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id)
36533
36567
  }));
36534
36568
  }
36535
- }), _$5.get(errors, "textbookOwners[" + index + "].email") && React__default.createElement(material.Typography, {
36569
+ }), _$7.get(errors, "textbookOwners[" + index + "].email") && React__default.createElement(material.Typography, {
36536
36570
  fontWeight: 500,
36537
36571
  fontSize: "10px",
36538
36572
  lineHeight: "11.93px",
36539
36573
  color: "#F34B4B"
36540
- }, _$5.get(errors, "textbookOwners[" + index + "].email"))), !!(values !== null && values !== void 0 && (_values$textbookOwner = values.textbookOwners) !== null && _values$textbookOwner !== void 0 && _values$textbookOwner[index].email) && React__default.createElement(OwnerSelector, {
36574
+ }, _$7.get(errors, "textbookOwners[" + index + "].email"))), !!(values !== null && values !== void 0 && (_values$textbookOwner = values.textbookOwners) !== null && _values$textbookOwner !== void 0 && _values$textbookOwner[index].email) && React__default.createElement(OwnerSelector, {
36541
36575
  values: values,
36542
36576
  errors: errors,
36543
36577
  index: index,
@@ -36715,7 +36749,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
36715
36749
  variant: "contained",
36716
36750
  disabled: disabled,
36717
36751
  onClick: function onClick() {
36718
- if (!_$6.isEmpty(errors)) {
36752
+ if (!_$8.isEmpty(errors)) {
36719
36753
  reactToastify.toast.error(i18n.t("please_fill_in_the_blank_fields"));
36720
36754
  }
36721
36755
  },