@instructure/quiz-core 22.16.0 → 22.17.0

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.
Files changed (159) hide show
  1. package/es/banks/components/BankEntry/presenter.js +1 -1
  2. package/es/banks/components/SharingModal/presenter.js +1 -1
  3. package/es/building/api/quizEntries.js +25 -5
  4. package/es/building/components/layout/header/BuildingButtons/index.js +1 -0
  5. package/es/building/components/layout/header/BuildingButtons/presenter.js +4 -0
  6. package/es/building/components/resources/ItemFeedbackModal/index.js +4 -1
  7. package/es/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
  8. package/es/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
  9. package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
  10. package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
  11. package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
  12. package/es/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
  13. package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
  14. package/es/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
  15. package/es/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
  16. package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
  17. package/es/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
  18. package/es/common/actions/modal.js +2 -1
  19. package/es/common/components/ApiFeatureFlagInitializer/index.js +1 -1
  20. package/es/common/components/ConfirmationModal/index.js +1 -1
  21. package/es/common/components/ConfirmationModal/presenter.js +49 -169
  22. package/es/common/components/RceConfigProvider/presenter.js +1 -1
  23. package/es/common/components/SDKApp/index.js +38 -39
  24. package/es/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
  25. package/es/common/components/layout/sidebar/Sidebar/index.js +29 -57
  26. package/es/common/components/layout/sidebar/SidebarItem/index.js +5 -1
  27. package/es/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
  28. package/es/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
  29. package/es/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
  30. package/{lib/common/components/resources/quizSessionResult/Header → es/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
  31. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
  32. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
  33. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
  34. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
  35. package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
  36. package/es/common/components/resources/item/ItemEdit/index.js +5 -3
  37. package/es/common/components/resources/item/ItemEdit/presenter.js +3 -2
  38. package/es/common/components/resources/item/ItemShow/index.js +2 -1
  39. package/es/common/components/resources/quiz/AddContent/Body/index.js +4 -2
  40. package/es/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
  41. package/es/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
  42. package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
  43. package/es/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
  44. package/es/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
  45. package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
  46. package/es/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
  47. package/es/common/components/resources/stimulus/Stimulus/index.js +4 -1
  48. package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
  49. package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
  50. package/es/common/components/shared/PaginatedCollection/presenter.js +1 -1
  51. package/es/common/components/shared/PrintTrigger/presenter.js +1 -1
  52. package/es/common/components/shared/spinner/Spinner.js +15 -16
  53. package/es/common/middleware/appSyncMiddleware.js +19 -0
  54. package/es/common/records/Quiz.js +8 -1
  55. package/es/common/records/QuizEntry.js +8 -1
  56. package/es/common/records/SessionItem.js +2 -1
  57. package/es/common/records/SessionItemResult.js +24 -0
  58. package/es/common/util/interactionTypePropsHelper.js +4 -2
  59. package/es/common/util/isMissing.js +4 -0
  60. package/es/configureStore.js +3 -1
  61. package/es/index.js +6 -4
  62. package/es/moderating/components/resources/ModerateTable/presenter.js +15 -10
  63. package/es/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
  64. package/es/moderating/components/resources/ModerateTableRow/styles.js +0 -4
  65. package/es/reduxStore.js +4 -0
  66. package/es/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
  67. package/es/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
  68. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
  69. package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
  70. package/es/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
  71. package/es/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
  72. package/es/taking/api/taking.js +45 -10
  73. package/lib/banks/components/BankEntry/presenter.js +1 -1
  74. package/lib/banks/components/SharingModal/presenter.js +1 -1
  75. package/lib/building/api/quizEntries.js +25 -5
  76. package/lib/building/components/layout/header/BuildingButtons/index.js +1 -0
  77. package/lib/building/components/layout/header/BuildingButtons/presenter.js +4 -0
  78. package/lib/building/components/resources/ItemFeedbackModal/index.js +4 -1
  79. package/lib/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
  80. package/lib/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
  81. package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
  82. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
  83. package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
  84. package/lib/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
  85. package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
  86. package/lib/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
  87. package/lib/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
  88. package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
  89. package/lib/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
  90. package/lib/common/actions/modal.js +2 -1
  91. package/lib/common/components/ApiFeatureFlagInitializer/index.js +1 -1
  92. package/lib/common/components/ConfirmationModal/index.js +1 -1
  93. package/lib/common/components/ConfirmationModal/presenter.js +49 -169
  94. package/lib/common/components/RceConfigProvider/presenter.js +1 -1
  95. package/lib/common/components/SDKApp/index.js +38 -39
  96. package/lib/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
  97. package/lib/common/components/layout/sidebar/Sidebar/index.js +29 -57
  98. package/lib/common/components/layout/sidebar/SidebarItem/index.js +5 -1
  99. package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
  100. package/lib/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
  101. package/lib/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
  102. package/{es/common/components/resources/quizSessionResult/Header → lib/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
  103. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
  104. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
  105. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
  106. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
  107. package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
  108. package/lib/common/components/resources/item/ItemEdit/index.js +5 -3
  109. package/lib/common/components/resources/item/ItemEdit/presenter.js +3 -2
  110. package/lib/common/components/resources/item/ItemShow/index.js +2 -1
  111. package/lib/common/components/resources/quiz/AddContent/Body/index.js +4 -2
  112. package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
  113. package/lib/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
  114. package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
  115. package/lib/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
  116. package/lib/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
  117. package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
  118. package/lib/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
  119. package/lib/common/components/resources/stimulus/Stimulus/index.js +4 -1
  120. package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
  121. package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
  122. package/lib/common/components/shared/PaginatedCollection/presenter.js +1 -1
  123. package/lib/common/components/shared/PrintTrigger/presenter.js +1 -1
  124. package/lib/common/components/shared/spinner/Spinner.js +15 -16
  125. package/lib/common/middleware/appSyncMiddleware.js +19 -0
  126. package/lib/common/records/Quiz.js +8 -1
  127. package/lib/common/records/QuizEntry.js +8 -1
  128. package/lib/common/records/SessionItem.js +2 -1
  129. package/lib/common/records/SessionItemResult.js +24 -0
  130. package/lib/common/util/interactionTypePropsHelper.js +4 -2
  131. package/lib/common/util/isMissing.js +4 -0
  132. package/lib/configureStore.js +3 -1
  133. package/lib/index.js +6 -4
  134. package/lib/moderating/components/resources/ModerateTable/presenter.js +15 -10
  135. package/lib/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
  136. package/lib/moderating/components/resources/ModerateTableRow/styles.js +0 -4
  137. package/lib/reduxStore.js +4 -0
  138. package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
  139. package/lib/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
  140. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
  141. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
  142. package/lib/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
  143. package/lib/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
  144. package/lib/taking/api/taking.js +45 -10
  145. package/package.json +10 -10
  146. package/es/building/components/resources/ItemFeedbackModal/styles.js +0 -13
  147. package/es/building/components/resources/ItemFeedbackModal/theme.js +0 -7
  148. package/es/common/components/resources/quizSessionResult/Info/index.js +0 -410
  149. package/es/common/components/resources/quizSessionResult/Info/styles.js +0 -58
  150. package/es/common/components/resources/quizSessionResult/Info/theme.js +0 -13
  151. package/lib/building/components/resources/ItemFeedbackModal/styles.js +0 -13
  152. package/lib/building/components/resources/ItemFeedbackModal/theme.js +0 -7
  153. package/lib/common/components/resources/quizSessionResult/Info/index.js +0 -410
  154. package/lib/common/components/resources/quizSessionResult/Info/styles.js +0 -58
  155. package/lib/common/components/resources/quizSessionResult/Info/theme.js +0 -13
  156. /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
  157. /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
  158. /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
  159. /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
@@ -234,7 +234,7 @@ import ItemEdit from '../../../common/components/resources/item/ItemEdit';
234
234
  import ItemFeedbackModal from '../../../building/components/resources/ItemFeedbackModal';
235
235
  import ItemShow from '../../../common/components/resources/item/ItemShow';
236
236
  import Page from '../../../common/components/layout/Page';
237
- import Spinner from '../../../common/components/shared/spinner/Spinner';
237
+ import { Spinner } from '../../../common/components/shared/spinner/Spinner';
238
238
  import StimulusEditInfo from '../../../common/components/resources/stimulus/StimulusEditInfo';
239
239
  import StimulusShowInfo from '../../../common/components/resources/stimulus/StimulusShowInfo';
240
240
  import TagSuggestSelect from '../../../common/components/shared/TagSuggestSelect';
@@ -228,7 +228,7 @@ import CustomPropTypes from '../../../common/util/CustomPropTypes';
228
228
  import ShareList from './ShareList';
229
229
  import AsyncSearch from '../AsyncSearch';
230
230
  import RootAccountSharing from './RootAccountSharing';
231
- import Spinner from '../../../common/components/shared/spinner/Spinner';
231
+ import { Spinner } from '../../../common/components/shared/spinner/Spinner';
232
232
  import generateStyle from './styles';
233
233
  import generateComponentTheme from './theme';
234
234
  import t from '@instructure/quiz-i18n/format-message';
@@ -305,14 +305,11 @@ export var createItemAndQuizEntry = queue.wrapActionCreator(function(quizId, ite
305
305
  export function createQuizEntry(quizId, entryId, entryType, entryProperties) {
306
306
  var requireFocus = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
307
307
  var url = "/api/quizzes/".concat(quizId, "/quiz_entries");
308
- var quizEntryParams = _object_spread({
308
+ var body = buildCreateQuizEntryBody(_object_spread({
309
309
  quizId: quizId,
310
310
  entryType: entryType,
311
311
  entryId: entryId
312
- }, entryProperties);
313
- var body = JSON.stringify({
314
- quiz_entry: quizEntryParams
315
- });
312
+ }, entryProperties));
316
313
  return function(dispatch, getState) {
317
314
  var fetcher = new Fetcher({
318
315
  callType: CREATE_QUIZ_ENTRY_CALL,
@@ -334,6 +331,29 @@ export function createQuizEntry(quizId, entryId, entryType, entryProperties) {
334
331
  });
335
332
  };
336
333
  }
334
+ var propertiesKeys = [
335
+ 'required'
336
+ ];
337
+ function buildCreateQuizEntryBody(entryProps) {
338
+ var _Object_keys_reduce = Object.keys(entryProps).reduce(function(acc, key) {
339
+ if (propertiesKeys.includes(key)) {
340
+ // eslint-disable-next-line no-param-reassign
341
+ acc.properties[key] = entryProps[key];
342
+ } else {
343
+ // eslint-disable-next-line no-param-reassign
344
+ acc.params[key] = entryProps[key];
345
+ }
346
+ return acc;
347
+ }, {
348
+ properties: {},
349
+ params: {}
350
+ }), properties = _Object_keys_reduce.properties, params = _Object_keys_reduce.params;
351
+ return JSON.stringify({
352
+ quiz_entry: _object_spread({
353
+ properties: properties
354
+ }, params)
355
+ });
356
+ }
337
357
  export function createBulkQuizEntries(items, param) {
338
358
  var quizId = param.quizId, startPosition = param.startPosition, _param_pointsPossible = param.pointsPossible, pointsPossible = _param_pointsPossible === void 0 ? [] : _param_pointsPossible, _param_requireFocus = param.requireFocus, requireFocus = _param_requireFocus === void 0 ? true : _param_requireFocus;
339
359
  var url = "/api/quizzes/".concat(quizId, "/quiz_entries/bulk");
@@ -23,6 +23,7 @@ export function mapStateToProps(state) {
23
23
  isEditing: state.get('editing') && state.get('editing').some(function(elem) {
24
24
  return elem;
25
25
  }),
26
+ isSurvey: quiz.isSurvey(),
26
27
  printingEnabled: featureOn('printing')
27
28
  };
28
29
  }
@@ -269,6 +269,7 @@ export var BuildingButtons = /*#__PURE__*/ function(Component) {
269
269
  return /*#__PURE__*/ jsx(Drilldown.Option, {
270
270
  id: key,
271
271
  key: key,
272
+ disabled: this.props.isSurvey,
272
273
  onOptionClick: onClick,
273
274
  "data-automation": menuItemDataAutomation
274
275
  }, /*#__PURE__*/ jsx(IconBankLine, {
@@ -280,6 +281,7 @@ export var BuildingButtons = /*#__PURE__*/ function(Component) {
280
281
  }
281
282
  return /*#__PURE__*/ jsx(Menu.Item, {
282
283
  key: key,
284
+ disabled: this.props.isSurvey,
283
285
  onSelect: onClick,
284
286
  "data-automation": menuItemDataAutomation
285
287
  }, /*#__PURE__*/ jsx(IconBankLine, {
@@ -435,6 +437,7 @@ _define_property(BuildingButtons, "propTypes", {
435
437
  enableItemBanking: PropTypes.bool,
436
438
  hasQuestions: PropTypes.bool.isRequired,
437
439
  isEditing: PropTypes.bool.isRequired,
440
+ isSurvey: PropTypes.bool,
438
441
  navigateToBanks: PropTypes.func.isRequired,
439
442
  navigateToPreviewPrint: PropTypes.func.isRequired,
440
443
  openBanksTray: PropTypes.func.isRequired,
@@ -458,6 +461,7 @@ _define_property(BuildingButtons, "defaultProps", {
458
461
  contentExportEnabled: false,
459
462
  contentExport: null,
460
463
  enableItemBanking: true,
464
+ isSurvey: false,
461
465
  quizSaving: false,
462
466
  speedgraderLink: null,
463
467
  contextUuid: null,
@@ -8,6 +8,7 @@ import { set } from '../../../../common/actions/ui';
8
8
  import { getModalTrigger } from '../../../../common/util/modalHelpers';
9
9
  import { generateImportModalId } from '../../../../common/components/ImportModal';
10
10
  import { ITEM_FEEDBACK_MODAL, ITEM_FEEDBACK_MODAL_ITEM, ITEM_FEEDBACK_MODAL_FEEDBACK } from '@instructure/quiz-common';
11
+ import { getActiveQuiz } from '../../../../common/selectors/quizzes';
11
12
  function mapStateToProps(state, props) {
12
13
  var nestedModals = [
13
14
  'correct',
@@ -19,6 +20,7 @@ function mapStateToProps(state, props) {
19
20
  'isOpen'
20
21
  ]);
21
22
  var importModalOpen = nestedModals.includes(openModal);
23
+ var quiz = getActiveQuiz(state);
22
24
  return {
23
25
  importModalOpen: importModalOpen,
24
26
  modalOpen: openModal === ITEM_FEEDBACK_MODAL,
@@ -30,7 +32,8 @@ function mapStateToProps(state, props) {
30
32
  'ui',
31
33
  ITEM_FEEDBACK_MODAL_FEEDBACK
32
34
  ]) || Map(),
33
- modalTrigger: getModalTrigger(state)
35
+ modalTrigger: getModalTrigger(state),
36
+ isSurvey: quiz.isSurvey()
34
37
  };
35
38
  }
36
39
  var mapDispatchToProps = {
@@ -84,23 +84,27 @@ function _is_native_reflect_construct() {
84
84
  return !!result;
85
85
  })();
86
86
  }
87
- function _ts_decorate(decorators, target, key, desc) {
88
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
90
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91
- return c > 3 && r && Object.defineProperty(target, key, r), r;
92
- }
93
- import { Component } from 'react';
87
+ import React, { Component } from 'react';
94
88
  import PropTypes from 'prop-types';
95
89
  import ImmutablePropTypes from 'react-immutable-proptypes';
96
90
  import { Button, CloseButton } from '@instructure/ui-buttons';
91
+ import { View } from '@instructure/ui-view';
97
92
  import { Heading } from '@instructure/ui-heading';
98
93
  import { jsx } from '@instructure/emotion';
99
94
  import { RichContentRenderer, RichContentInput, RCE_THREE_LINES_HEIGHT } from '@instructure/quiz-rce';
100
95
  import t from '@instructure/quiz-i18n/format-message';
101
- import { Modal, ModalHeader, ModalBody, ModalFooter, ITEM_FEEDBACK_MODAL_FEEDBACK, XSMALL_SIDE_MARGIN, withStyleOverrides } from '@instructure/quiz-common';
102
- import generateStyle from './styles';
103
- import generateComponentTheme from './theme';
96
+ import { Modal, ModalHeader, ModalBody, ModalFooter, ITEM_FEEDBACK_MODAL_FEEDBACK, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
97
+ function FeedbackInput(param) {
98
+ var textAreaId = param.textAreaId, label = param.label, content = param.content, onChange = param.onChange;
99
+ return /*#__PURE__*/ jsx(RichContentInput, {
100
+ textareaId: textAreaId,
101
+ label: label,
102
+ plainTextLabel: label,
103
+ defaultContent: content,
104
+ onChange: onChange,
105
+ height: RCE_THREE_LINES_HEIGHT
106
+ });
107
+ }
104
108
  export var ItemFeedbackModal = /*#__PURE__*/ function(Component) {
105
109
  "use strict";
106
110
  _inherits(ItemFeedbackModal, Component);
@@ -145,35 +149,12 @@ export var ItemFeedbackModal = /*#__PURE__*/ function(Component) {
145
149
  }, t('Done'));
146
150
  }
147
151
  },
148
- {
149
- key: "renderRichContentInput",
150
- value: function renderRichContentInput(key, label) {
151
- return /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx("br", null), /*#__PURE__*/ jsx("label", {
152
- css: this.props.styles.feedbackLabel,
153
- htmlFor: key
154
- }, label), /*#__PURE__*/ jsx(RichContentInput, {
155
- label: "",
156
- textareaId: key,
157
- defaultContent: this.props.feedback.get(key),
158
- onChange: this.onFeedbackWrapper(key),
159
- height: RCE_THREE_LINES_HEIGHT
160
- }));
161
- }
162
- },
163
- {
164
- key: "renderContent",
165
- value: function renderContent() {
166
- return /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx(RichContentRenderer, {
167
- customStyles: this.props.styles.itemStem,
168
- content: this.props.item.itemBody
169
- }), this.renderRichContentInput('correct', t('For a correct answer')), this.renderRichContentInput('incorrect', t('For an incorrect answer')), this.renderRichContentInput('neutral', t('Provide general feedback (regardless of answer)')));
170
- }
171
- },
172
152
  {
173
153
  key: "render",
174
154
  value: function render() {
175
- return /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx(Modal, {
176
- open: this.props.modalOpen || this.props.importModalOpen,
155
+ var _this_props = this.props, modalOpen = _this_props.modalOpen, importModalOpen = _this_props.importModalOpen, feedback = _this_props.feedback, item = _this_props.item, isSurvey = _this_props.isSurvey;
156
+ return /*#__PURE__*/ jsx(Modal, {
157
+ open: modalOpen || importModalOpen,
177
158
  onClose: this.closeAction,
178
159
  size: "large",
179
160
  label: t('Student Feedback'),
@@ -187,7 +168,32 @@ export var ItemFeedbackModal = /*#__PURE__*/ function(Component) {
187
168
  placement: "end",
188
169
  offset: "medium",
189
170
  screenReaderLabel: t('Close')
190
- })), /*#__PURE__*/ jsx(ModalBody, null, this.renderContent()), /*#__PURE__*/ jsx(ModalFooter, null, this.cancelButton(), this.doneButton())));
171
+ })), /*#__PURE__*/ jsx(ModalBody, null, /*#__PURE__*/ jsx(View, {
172
+ as: "div",
173
+ margin: "0 0 medium 0"
174
+ }, /*#__PURE__*/ jsx(RichContentRenderer, {
175
+ customStyles: {
176
+ whiteSpace: 'nowrap',
177
+ overflow: 'hidden',
178
+ textOverflow: 'ellipsis'
179
+ },
180
+ content: item.itemBody
181
+ })), !isSurvey && /*#__PURE__*/ jsx(React.Fragment, null, /*#__PURE__*/ jsx(FeedbackInput, {
182
+ textAreaId: "correct",
183
+ label: t('For a correct answer'),
184
+ content: feedback.get('correct'),
185
+ onChange: this.onFeedbackWrapper('correct')
186
+ }), /*#__PURE__*/ jsx(FeedbackInput, {
187
+ textAreaId: "incorrect",
188
+ label: t('For an incorrect answer'),
189
+ content: feedback.get('incorrect'),
190
+ onChange: this.onFeedbackWrapper('incorrect')
191
+ })), /*#__PURE__*/ jsx(FeedbackInput, {
192
+ textAreaId: "neutral",
193
+ label: t('Provide general feedback (regardless of answer)'),
194
+ content: feedback.get('neutral'),
195
+ onChange: this.onFeedbackWrapper('neutral')
196
+ })), /*#__PURE__*/ jsx(ModalFooter, null, this.cancelButton(), this.doneButton()));
191
197
  }
192
198
  }
193
199
  ]);
@@ -204,12 +210,9 @@ _define_property(ItemFeedbackModal, "propTypes", {
204
210
  modalOpen: PropTypes.bool.isRequired,
205
211
  setUi: PropTypes.func.isRequired,
206
212
  modalTrigger: PropTypes.instanceOf(Component),
207
- styles: PropTypes.object
213
+ isSurvey: PropTypes.bool.isRequired
208
214
  });
209
215
  _define_property(ItemFeedbackModal, "defaultProps", {
210
216
  modalTrigger: null
211
217
  });
212
- ItemFeedbackModal = _ts_decorate([
213
- withStyleOverrides(generateStyle, generateComponentTheme)
214
- ], ItemFeedbackModal);
215
218
  export default ItemFeedbackModal;
@@ -58,7 +58,8 @@ export var mapStateToProps = function(state, props) {
58
58
  tagAssociations: tagAssociations,
59
59
  useBankTags: useBankTags,
60
60
  workingEntry: entry.getWorkingInstance(),
61
- workingQuizEntry: props.quizEntry.getWorkingInstance()
61
+ workingQuizEntry: props.quizEntry.getWorkingInstance(),
62
+ isSurvey: activeQuiz.isSurvey()
62
63
  };
63
64
  };
64
65
  var dispatchToProps = {
@@ -265,7 +265,8 @@ export var QuizEntry = /*#__PURE__*/ function(Component) {
265
265
  key: "additionalEditOptions",
266
266
  value: function additionalEditOptions(item) {
267
267
  var options = [];
268
- if (this.props.quizEntry.entryType === 'Item') {
268
+ // Don't show item banking options for surveys (both graded and ungraded)
269
+ if (this.props.quizEntry.entryType === 'Item' && !this.props.isSurvey) {
269
270
  options.push({
270
271
  key: 'banks',
271
272
  title: t('Item Banking'),
@@ -293,7 +294,8 @@ export var QuizEntry = /*#__PURE__*/ function(Component) {
293
294
  initialFocusId: this.props.initialFocusId,
294
295
  validationErrorsFromApi: this.props.validationErrorsFromApi,
295
296
  clearValidationErrorsFromApi: this.props.clearValidationErrorsFromApi,
296
- separatorConfig: this.props.separatorConfig
297
+ separatorConfig: this.props.separatorConfig,
298
+ isSurvey: this.props.isSurvey
297
299
  };
298
300
  }
299
301
  },
@@ -538,6 +540,7 @@ _define_property(QuizEntry, "propTypes", {
538
540
  decimalSeparator: PropTypes.string,
539
541
  thousandSeparator: PropTypes.string
540
542
  }),
543
+ isSurvey: PropTypes.bool,
541
544
  styles: PropTypes.object
542
545
  });
543
546
  _define_property(QuizEntry, "defaultProps", {
@@ -548,6 +551,7 @@ _define_property(QuizEntry, "defaultProps", {
548
551
  initialFocusId: null,
549
552
  isContentLockedByBlueprint: false,
550
553
  isEditing: false,
554
+ isSurvey: false,
551
555
  partialDeepScoringEnabled: false,
552
556
  partialScoringEnabled: false,
553
557
  scrollKey: void 0,
@@ -1,6 +1,7 @@
1
1
  import { connect } from '../../../../../../common/react-redux';
2
2
  import makeEditable from '../../../../../../common/components/shared/functionality/makeEditable';
3
3
  import QuizEntryEditFooter from './presenter';
4
+ import { getActiveQuiz } from '../../../../../../common/selectors/quizzes';
4
5
  export function mapStateToProps(state, props) {
5
6
  var entry = props.entry, quizEntry = props.quizEntry, workingQuizEntry = props.workingQuizEntry;
6
7
  var workingEntry;
@@ -12,8 +13,11 @@ export function mapStateToProps(state, props) {
12
13
  // Bank quizEntry with Item entry.
13
14
  workingEntry = entry.getWorkingInstance();
14
15
  }
16
+ var quiz = getActiveQuiz(state);
17
+ var isSurvey = quiz.isSurvey();
15
18
  return {
16
- workingEntry: workingEntry
19
+ workingEntry: workingEntry,
20
+ isSurvey: isSurvey
17
21
  };
18
22
  }
19
23
  export default makeEditable(connect(mapStateToProps)(QuizEntryEditFooter));
@@ -142,6 +142,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
142
142
  import { View } from '@instructure/ui-view';
143
143
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
144
144
  import { Text } from '@instructure/ui-text';
145
+ import { Checkbox } from '@instructure/ui-checkbox';
145
146
  import NumberInput from '@instructure/quiz-number-input';
146
147
  import { IconButton } from '@instructure/ui-buttons';
147
148
  import { jsx } from '@instructure/emotion';
@@ -161,6 +162,18 @@ function countDecimals(normalizedPointsString) {
161
162
  var _normalizedPointsString_split = _sliced_to_array(normalizedPointsString.split('.'), 2), _ = _normalizedPointsString_split[0], decimals = _normalizedPointsString_split[1];
162
163
  return decimals ? decimals.length : 0;
163
164
  }
165
+ function RequiredCheckbox(props) {
166
+ var isRequired = props.isRequired, onChange = props.onChange;
167
+ return /*#__PURE__*/ jsx(View, {
168
+ margin: "0 small 0 0"
169
+ }, /*#__PURE__*/ jsx(Checkbox, {
170
+ label: "Required",
171
+ value: "medium",
172
+ variant: "toggle",
173
+ onChange: onChange,
174
+ checked: isRequired
175
+ }));
176
+ }
164
177
  export var QuizEntryEditFooter = /*#__PURE__*/ function(Component) {
165
178
  "use strict";
166
179
  _inherits(QuizEntryEditFooter, Component);
@@ -200,13 +213,23 @@ export var QuizEntryEditFooter = /*#__PURE__*/ function(Component) {
200
213
  normalizedPoints: normalizedPoints
201
214
  });
202
215
  }
216
+ }), _define_property(_this, "handleRequiredChange", function(event) {
217
+ var checked = event.target.checked;
218
+ _this.props.changeQuizEntryProperties(_this.props.quizEntry.id, {
219
+ required: checked
220
+ });
221
+ _this.setState({
222
+ isRequired: checked
223
+ });
203
224
  }), _define_property(_this, "handleButtonRef", function(node) {
204
225
  _this.addFeedbackButton = node;
205
226
  });
206
227
  var points = _this.getPoints();
228
+ var isRequired = _this.getIsRequired();
207
229
  _this.state = {
208
230
  points: points,
209
- normalizedPoints: points
231
+ normalizedPoints: points,
232
+ isRequired: isRequired
210
233
  };
211
234
  return _this;
212
235
  }
@@ -229,6 +252,12 @@ export var QuizEntryEditFooter = /*#__PURE__*/ function(Component) {
229
252
  return workingQuizEntry.regradeAdjustedPointsPossible(workingEntry.id) || workingQuizEntry.pointsPossible || 0;
230
253
  }
231
254
  },
255
+ {
256
+ key: "getIsRequired",
257
+ value: function getIsRequired() {
258
+ return this.props.workingQuizEntry.isRequired || false;
259
+ }
260
+ },
232
261
  {
233
262
  key: "pointsDisabled",
234
263
  value: function pointsDisabled() {
@@ -293,9 +322,14 @@ export var QuizEntryEditFooter = /*#__PURE__*/ function(Component) {
293
322
  {
294
323
  key: "renderLeftFooter",
295
324
  value: function renderLeftFooter() {
325
+ var isRequired = this.state.isRequired;
326
+ var component = this.props.isSurvey ? /*#__PURE__*/ jsx(RequiredCheckbox, {
327
+ isRequired: isRequired,
328
+ onChange: this.handleRequiredChange
329
+ }) : this.renderPointsSection();
296
330
  return /*#__PURE__*/ jsx("div", {
297
331
  css: this.props.styles.leftFooter
298
- }, this.renderPointsSection(), this.renderFeedbackSection());
332
+ }, component, this.renderFeedbackSection());
299
333
  }
300
334
  },
301
335
  {
@@ -343,6 +377,7 @@ _define_property(QuizEntryEditFooter, "componentId", "Quizzes".concat(QuizEntryE
343
377
  _define_property(QuizEntryEditFooter, "propTypes", {
344
378
  alternativeRightFooter: PropTypes.func,
345
379
  changeQuizEntryPoints: PropTypes.func.isRequired,
380
+ changeQuizEntryProperties: PropTypes.func.isRequired,
346
381
  clearChanges: PropTypes.func.isRequired,
347
382
  disableSubmit: PropTypes.bool,
348
383
  displayPosition: PropTypes.number.isRequired,
@@ -359,7 +394,8 @@ _define_property(QuizEntryEditFooter, "propTypes", {
359
394
  workingEntry: ImmutablePropTypes.record.isRequired,
360
395
  // This prop is flagged as unused, but it is actually used
361
396
  workingQuizEntry: ImmutablePropTypes.record.isRequired,
362
- styles: PropTypes.object
397
+ styles: PropTypes.object,
398
+ isSurvey: PropTypes.bool.isRequired
363
399
  });
364
400
  _define_property(QuizEntryEditFooter, "defaultProps", {
365
401
  alternativeRightFooter: null,
@@ -74,6 +74,7 @@ function mapDispatchToProps(dispatch) {
74
74
  newActiveBank: bindActionCreators(newActiveBank, dispatch),
75
75
  changeItemTitle: boundModificationActions.changeItemTitle,
76
76
  changeQuizEntryPoints: boundModificationActions.changeQuizEntryPoints,
77
+ changeQuizEntryProperties: boundModificationActions.changeQuizEntryProperties,
77
78
  clearModifications: boundModificationActions.clearModifications,
78
79
  clearTemporaryItem: boundModificationActions.clearTemporaryItem,
79
80
  clearNextQuizEntry: boundModificationActions.clearNextQuizEntry,
@@ -530,6 +530,7 @@ var QuizEntryEdit = /*#__PURE__*/ function(Component) {
530
530
  var footerProps = pick(this.props, [
531
531
  'alternativeRightFooter',
532
532
  'changeQuizEntryPoints',
533
+ 'changeQuizEntryProperties',
533
534
  'clearTemporaryItem',
534
535
  'displayPosition',
535
536
  'entry',
@@ -0,0 +1,151 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _instanceof(left, right) {
15
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
16
+ return !!right[Symbol.hasInstance](left);
17
+ } else {
18
+ return left instanceof right;
19
+ }
20
+ }
21
+ function _object_spread(target) {
22
+ for(var i = 1; i < arguments.length; i++){
23
+ var source = arguments[i] != null ? arguments[i] : {};
24
+ var ownKeys = Object.keys(source);
25
+ if (typeof Object.getOwnPropertySymbols === "function") {
26
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
27
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
28
+ }));
29
+ }
30
+ ownKeys.forEach(function(key) {
31
+ _define_property(target, key, source[key]);
32
+ });
33
+ }
34
+ return target;
35
+ }
36
+ import React from 'react';
37
+ import PropTypes from 'prop-types';
38
+ import ImmutablePropTypes from 'react-immutable-proptypes';
39
+ import t from '@instructure/quiz-i18n/format-message';
40
+ import { IconBankLine, IconAiColoredSolid } from '@instructure/ui-icons';
41
+ import { Flex } from '@instructure/quiz-common';
42
+ import { TruncateText } from '@instructure/ui-truncate-text';
43
+ import { Text } from '@instructure/ui-text';
44
+ import { View } from '@instructure/ui-view';
45
+ import { Tooltip } from '@instructure/ui-tooltip';
46
+ import { Item } from '../../../../../../common/records';
47
+ function QuizEntryLeftHeaderText(param) {
48
+ var content = param.content, textProps = param.textProps, viewProps = param.viewProps;
49
+ return /*#__PURE__*/ React.createElement(View, _object_spread({
50
+ as: "div"
51
+ }, viewProps), /*#__PURE__*/ React.createElement(TruncateText, {
52
+ color: "secondary"
53
+ }, /*#__PURE__*/ React.createElement(Text, _object_spread({
54
+ color: "secondary",
55
+ size: "small"
56
+ }, textProps), content)));
57
+ }
58
+ QuizEntryLeftHeaderText.propTypes = {
59
+ content: PropTypes.string.isRequired,
60
+ textProps: PropTypes.shape(Text.propTypes),
61
+ viewProps: PropTypes.shape(View.propTypes)
62
+ };
63
+ function BankedContent(param) {
64
+ var quizEntry = param.quizEntry;
65
+ if (!quizEntry.isBank && !quizEntry.isBankEntry) {
66
+ return null;
67
+ }
68
+ return /*#__PURE__*/ React.createElement(View, {
69
+ stacking: "topmost"
70
+ }, /*#__PURE__*/ React.createElement(IconBankLine, null));
71
+ }
72
+ function AiGeneratedContent() {
73
+ return /*#__PURE__*/ React.createElement(View, {
74
+ stacking: "topmost"
75
+ }, /*#__PURE__*/ React.createElement(Tooltip, {
76
+ renderTip: t('This question was generated using AI'),
77
+ placement: "top center",
78
+ on: [
79
+ 'hover',
80
+ 'focus'
81
+ ]
82
+ }, /*#__PURE__*/ React.createElement(IconAiColoredSolid, {
83
+ color: "primary",
84
+ "aria-label": t('This question was generated using AI')
85
+ })));
86
+ }
87
+ export function InteractionTypeName(param) {
88
+ var name = param.name, _param_defaultValue = param.defaultValue, defaultValue = _param_defaultValue === void 0 ? null : _param_defaultValue, textProps = param.textProps;
89
+ if (!name && !defaultValue) {
90
+ return null;
91
+ }
92
+ var interactionName = name || defaultValue;
93
+ return /*#__PURE__*/ React.createElement(QuizEntryLeftHeaderText, {
94
+ content: interactionName,
95
+ viewProps: {
96
+ 'data-automation': 'sdk-interaction-type-name-div'
97
+ },
98
+ textProps: textProps
99
+ });
100
+ }
101
+ InteractionTypeName.propTypes = {
102
+ name: PropTypes.string.isRequired,
103
+ defaultValue: PropTypes.string,
104
+ textProps: PropTypes.shape(Text.propTypes)
105
+ };
106
+ export function RequiredIndicator() {
107
+ return /*#__PURE__*/ React.createElement(QuizEntryLeftHeaderText, {
108
+ content: t('(Required)'),
109
+ textProps: {
110
+ fontStyle: 'italic'
111
+ }
112
+ });
113
+ }
114
+ export function PointsPossible(param) {
115
+ var pointsPossible = param.pointsPossible;
116
+ return /*#__PURE__*/ React.createElement(QuizEntryLeftHeaderText, {
117
+ content: t("{\n points, plural,\n one {# point}\n other {# points}\n }", {
118
+ points: pointsPossible || 0
119
+ }),
120
+ viewProps: {
121
+ className: 'points',
122
+ 'data-automation': 'sdk-points-possible-div'
123
+ }
124
+ });
125
+ }
126
+ export function LeftHeader(param) {
127
+ var quizEntry = param.quizEntry, entry = param.entry, interactionTypeName = param.interactionTypeName, isSurvey = param.isSurvey;
128
+ return /*#__PURE__*/ React.createElement(Flex, {
129
+ alignItems: "center",
130
+ height: "100%",
131
+ gap: "mediumSmall"
132
+ }, /*#__PURE__*/ React.createElement(BankedContent, {
133
+ quizEntry: quizEntry
134
+ }), quizEntry.isAiGenerated && /*#__PURE__*/ React.createElement(AiGeneratedContent, null), _instanceof(entry, Item) && /*#__PURE__*/ React.createElement(InteractionTypeName, {
135
+ name: entry.getInteractionType().name,
136
+ defaultValue: interactionTypeName
137
+ }), !isSurvey && /*#__PURE__*/ React.createElement(PointsPossible, {
138
+ pointsPossible: quizEntry.pointsPossible
139
+ }), entry.title && /*#__PURE__*/ React.createElement(QuizEntryLeftHeaderText, {
140
+ content: entry.title,
141
+ viewProps: {
142
+ 'data-automation': 'sdk-quiz-entry-title-div'
143
+ }
144
+ }), quizEntry.isRequired && /*#__PURE__*/ React.createElement(RequiredIndicator, null));
145
+ }
146
+ LeftHeader.propTypes = {
147
+ entry: ImmutablePropTypes.record.isRequired,
148
+ quizEntry: ImmutablePropTypes.record.isRequired,
149
+ isSurvey: PropTypes.bool,
150
+ interactionTypeName: PropTypes.string
151
+ };
@@ -5,7 +5,7 @@ import { createItem } from '../../../../../common/actions/modifications';
5
5
  import { removeQuizEntry } from '../../../../api/quizEntries';
6
6
  import { withConfirm } from '../../../../../common/actions/modal';
7
7
  import { QuizEntryShowPresenter } from './presenter';
8
- import { getQuizEntryWithErrorsShowing } from '../../../../../common/selectors/quizzes';
8
+ import { getQuizEntryWithErrorsShowing, getActiveQuiz } from '../../../../../common/selectors/quizzes';
9
9
  import { CREATE_ITEM_CALL, UPDATE_ITEM_CALL } from '@instructure/quiz-common';
10
10
  import { featureOn } from '../../../../../common/util/featureCheck';
11
11
  function mapStateToProps(state, props) {
@@ -31,6 +31,8 @@ function mapStateToProps(state, props) {
31
31
  ], Map()).find(function(interactionType) {
32
32
  return interactionType.get('slug') === 'rich-fill-blank';
33
33
  });
34
+ var quiz = getActiveQuiz(state);
35
+ var isSurvey = quiz.isSurvey();
34
36
  return {
35
37
  createItemCallStatus: state.getIn([
36
38
  'calls',
@@ -48,7 +50,8 @@ function mapStateToProps(state, props) {
48
50
  'calls',
49
51
  UPDATE_ITEM_CALL,
50
52
  'requestStatus'
51
- ], '')
53
+ ], ''),
54
+ isSurvey: isSurvey
52
55
  };
53
56
  }
54
57
  var mapDispatchToProps = {