@instructure/quiz-core 22.0.0 → 22.2.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 (53) hide show
  1. package/es/banks/components/AddBankEntryModal/presenter.js +4 -1
  2. package/es/banks/components/BankEntry/presenter.js +110 -12
  3. package/es/banks/components/BankEntryRow/presenter.js +52 -8
  4. package/es/banks/components/CopyMoveBankEntryModal/presenter.js +84 -15
  5. package/es/building/components/resources/DeleteStimulusModal/presenter.js +13 -7
  6. package/es/common/components/layout/sidebar/Stimulus/Collection/presenter.js +6 -3
  7. package/es/common/components/layout/sidebar/Stimulus/presenter.js +103 -40
  8. package/es/common/components/layout/sidebar/Stimulus/styles.js +2 -26
  9. package/es/common/components/layout/sidebar/Stimulus/theme.js +1 -10
  10. package/es/common/components/resources/BankSelection/presenter.js +31 -8
  11. package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +20 -20
  12. package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -2
  13. package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +40 -37
  14. package/es/common/components/resources/stimulus/StimulusEditInfo/presenter.js +6 -5
  15. package/es/common/components/resources/stimulus/StimulusShow/index.js +1 -1
  16. package/es/common/components/resources/stimulus/StimulusShowInfo/index.js +1 -1
  17. package/es/common/components/shared/GenericAsyncSearch/GenericAsyncSearch.js +10 -3
  18. package/es/common/components/shared/InteractionTypes/presenter.js +3 -2
  19. package/es/common/components/shared/drag_and_drop/dragAndDropUtils.js +7 -0
  20. package/es/common/records/BankEntry.js +9 -1
  21. package/es/common/records/QuizEntry.js +29 -17
  22. package/es/common/records/SessionItem.js +6 -0
  23. package/es/common/reducers/modifications.js +21 -12
  24. package/es/common/util/warningHelpers.js +13 -3
  25. package/es/moderating/components/sidebar/ModerateTray/presenter.js +5 -5
  26. package/es/taking/api/taking.js +1 -1
  27. package/lib/banks/components/AddBankEntryModal/presenter.js +4 -1
  28. package/lib/banks/components/BankEntry/presenter.js +110 -12
  29. package/lib/banks/components/BankEntryRow/presenter.js +52 -8
  30. package/lib/banks/components/CopyMoveBankEntryModal/presenter.js +84 -15
  31. package/lib/building/components/resources/DeleteStimulusModal/presenter.js +13 -7
  32. package/lib/common/components/layout/sidebar/Stimulus/Collection/presenter.js +6 -3
  33. package/lib/common/components/layout/sidebar/Stimulus/presenter.js +103 -40
  34. package/lib/common/components/layout/sidebar/Stimulus/styles.js +2 -26
  35. package/lib/common/components/layout/sidebar/Stimulus/theme.js +1 -10
  36. package/lib/common/components/resources/BankSelection/presenter.js +31 -8
  37. package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +20 -20
  38. package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -2
  39. package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +40 -37
  40. package/lib/common/components/resources/stimulus/StimulusEditInfo/presenter.js +6 -5
  41. package/lib/common/components/resources/stimulus/StimulusShow/index.js +1 -1
  42. package/lib/common/components/resources/stimulus/StimulusShowInfo/index.js +1 -1
  43. package/lib/common/components/shared/GenericAsyncSearch/GenericAsyncSearch.js +10 -3
  44. package/lib/common/components/shared/InteractionTypes/presenter.js +3 -2
  45. package/lib/common/components/shared/drag_and_drop/dragAndDropUtils.js +7 -0
  46. package/lib/common/records/BankEntry.js +9 -1
  47. package/lib/common/records/QuizEntry.js +29 -17
  48. package/lib/common/records/SessionItem.js +6 -0
  49. package/lib/common/reducers/modifications.js +21 -12
  50. package/lib/common/util/warningHelpers.js +13 -3
  51. package/lib/moderating/components/sidebar/ModerateTray/presenter.js +5 -5
  52. package/lib/taking/api/taking.js +1 -1
  53. package/package.json +8 -8
@@ -98,9 +98,9 @@ var SessionItemResult = exports.SessionItemResult = (_dec = (0, _quizCommon.with
98
98
  return typeof this.pointsPossible === 'number';
99
99
  }
100
100
  }, {
101
- key: "position",
102
- value: function position() {
103
- return this.props.sessionItem.position;
101
+ key: "questionNumber",
102
+ value: function questionNumber() {
103
+ return this.props.sessionItem.questionNumber;
104
104
  }
105
105
  }, {
106
106
  key: "unscorable",
@@ -186,38 +186,38 @@ var SessionItemResult = exports.SessionItemResult = (_dec = (0, _quizCommon.with
186
186
  value: function renderHeader() {
187
187
  return (0, _emotion.jsx)("div", {
188
188
  css: this.props.styles.sessionItemResultHeader
189
- }, this.renderResultPosition(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
189
+ }, this.renderResultQuestionNumber(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
190
190
  }
191
191
  }, {
192
- key: "renderResultPosition",
193
- value: function renderResultPosition() {
194
- var position = this.position();
195
- var positionText;
192
+ key: "renderResultQuestionNumber",
193
+ value: function renderResultQuestionNumber() {
194
+ var questionNumber = this.questionNumber();
195
+ var questionNumberText;
196
196
  if (this.regraded() && this.unscorable()) {
197
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question. This question has been regraded.', {
198
- position: position
197
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question. This question has been regraded.', {
198
+ questionNumber: questionNumber
199
199
  });
200
200
  } else if (this.regraded()) {
201
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. This question has been regraded.', {
202
- position: position
201
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. This question has been regraded.', {
202
+ questionNumber: questionNumber
203
203
  });
204
204
  } else if (this.unscorable() && this.props.editGraderFeedback) {
205
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question.', {
206
- position: position
205
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question.', {
206
+ questionNumber: questionNumber
207
207
  });
208
208
  } else if (this.unscorable()) {
209
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question. Please inform your instructor.', {
210
- position: position
209
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question. Please inform your instructor.', {
210
+ questionNumber: questionNumber
211
211
  });
212
212
  } else {
213
- positionText = (0, _formatMessage["default"])('Results for question {position, number}.', {
214
- position: position
213
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}.', {
214
+ questionNumber: questionNumber
215
215
  });
216
216
  }
217
217
  return (0, _emotion.jsx)(_PositionBox["default"], {
218
- position: position,
218
+ position: questionNumber,
219
219
  headingLevel: "h3",
220
- headingText: positionText
220
+ headingText: questionNumberText
221
221
  });
222
222
  }
223
223
  }, {
@@ -121,7 +121,7 @@ var Stimulus = exports.Stimulus = (_dec = (0, _quizCommon.withStyleOverrides)(_s
121
121
  key: "renderStimulusPanel",
122
122
  value: function renderStimulusPanel() {
123
123
  var StimulusComponent = this.props.isEditing ? _StimulusEdit["default"] : _StimulusShow["default"];
124
- var automationPrefix = this.isPassage() ? 'passage' : 'stimulus';
124
+ var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
125
125
  var connectDragPreview = this.props.connectDragPreview;
126
126
  return connectDragPreview((0, _emotion.jsx)("div", {
127
127
  "data-automation": "sdk-".concat(automationPrefix, "-LeftPanelShow")
@@ -149,7 +149,7 @@ var Stimulus = exports.Stimulus = (_dec = (0, _quizCommon.withStyleOverrides)(_s
149
149
  }, {
150
150
  key: "renderPanels",
151
151
  value: function renderPanels(propsForDnDZone) {
152
- var automationPrefix = this.isPassage() ? 'passage' : 'stimulus';
152
+ var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
153
153
  return (0, _emotion.jsx)("div", {
154
154
  css: this.props.styles.stimulus,
155
155
  ref: this.props.dndRef,
@@ -87,11 +87,11 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
87
87
  inStimulus: false
88
88
  });
89
89
  }, {
90
- title: isPassage ? (0, _formatMessage["default"])('Confirm Passage Removal') : (0, _formatMessage["default"])('Confirm Stimulus Removal'),
91
- text: isPassage ? (0, _formatMessage["default"])('Are you sure you want to remove this passage?') : (0, _formatMessage["default"])('Are you sure you want to remove this stimulus?'),
92
- continueText: isPassage ? (0, _formatMessage["default"])('Remove Passage') : (0, _formatMessage["default"])('Remove Stimulus'),
93
- cancelText: isPassage ? (0, _formatMessage["default"])('Keep Passage ') : (0, _formatMessage["default"])('Keep Stimulus'),
94
- automationPrefix: isPassage ? 'passage' : 'stimulus'
90
+ title: isPassage ? (0, _formatMessage["default"])('Confirm Text Block Removal') : (0, _formatMessage["default"])('Confirm Stimulus Removal'),
91
+ text: isPassage ? (0, _formatMessage["default"])('Are you sure you want to remove this text block?') : (0, _formatMessage["default"])('Are you sure you want to remove this stimulus?'),
92
+ continueText: isPassage ? (0, _formatMessage["default"])('Remove Text Block') : (0, _formatMessage["default"])('Remove Stimulus'),
93
+ cancelText: isPassage ? (0, _formatMessage["default"])('Keep Text Block ') : (0, _formatMessage["default"])('Keep Stimulus'),
94
+ automationPrefix: isPassage ? 'text-block' : 'stimulus'
95
95
  });
96
96
  });
97
97
  (0, _defineProperty2["default"])(_this2, "handleDeleteStimulus", function () {
@@ -152,73 +152,74 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
152
152
  });
153
153
  (0, _defineProperty2["default"])(_this2, "onSubmit", /*#__PURE__*/function () {
154
154
  var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(e) {
155
- var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, stimulusData;
155
+ var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, message, stimulusData;
156
156
  return _regenerator["default"].wrap(function _callee2$(_context2) {
157
157
  while (1) switch (_context2.prev = _context2.next) {
158
158
  case 0:
159
159
  _this2$props2 = _this2.props, stimulus = _this2$props2.stimulus, workingStimulus = _this2$props2.workingStimulus, quizId = _this2$props2.quizId, quizEntry = _this2$props2.quizEntry;
160
160
  if (workingStimulus.isValid()) {
161
- _context2.next = 8;
161
+ _context2.next = 9;
162
162
  break;
163
163
  }
164
- _context2.next = 4;
164
+ message = _this2.isPassage() ? (0, _formatMessage["default"])('Text Block not saved due to validation errors with the data.') : (0, _formatMessage["default"])('Stimulus not saved due to validation errors with the data.');
165
+ _context2.next = 5;
165
166
  return _this2.props.showError(_this2.props.guid);
166
- case 4:
167
- _this2.props.screenreaderNotification((0, _formatMessage["default"])('Simulus not saved due to validation errors with the data.'));
167
+ case 5:
168
+ _this2.props.screenreaderNotification(message);
168
169
  _this2.props.clearNextQuizEntry();
169
170
  _this2.focusFirstErrorField();
170
171
  return _context2.abrupt("return");
171
- case 8:
172
+ case 9:
172
173
  _this2.setState({
173
174
  canSubmit: false
174
175
  });
175
176
  _this2.props.hideError(_this2.props.guid);
176
- _context2.prev = 10;
177
+ _context2.prev = 11;
177
178
  if (!stimulus.isTemporary()) {
178
- _context2.next = 17;
179
+ _context2.next = 18;
179
180
  break;
180
181
  }
181
- _context2.next = 14;
182
+ _context2.next = 15;
182
183
  return _this2.props.createStimulusAndQuizEntry(quizId, workingStimulus.toJS(), quizEntry);
183
- case 14:
184
+ case 15:
184
185
  _this2.props.clearTemporaryStimulus(quizId);
185
- _context2.next = 28;
186
+ _context2.next = 29;
186
187
  break;
187
- case 17:
188
+ case 18:
188
189
  if (!_this2.props.shouldClone) {
189
- _context2.next = 26;
190
+ _context2.next = 27;
190
191
  break;
191
192
  }
192
- _context2.next = 20;
193
+ _context2.next = 21;
193
194
  return _this2.props.createStimulus(workingStimulus, _this2.props.quizId, 'quiz', workingStimulus.id);
194
- case 20:
195
+ case 21:
195
196
  stimulusData = _context2.sent;
196
- _context2.next = 23;
197
+ _context2.next = 24;
197
198
  return _this2.handleStimulusCreated(stimulusData);
198
- case 23:
199
+ case 24:
199
200
  _this2.props.clearTemporaryStimulus(quizId);
200
- _context2.next = 28;
201
+ _context2.next = 29;
201
202
  break;
202
- case 26:
203
- _context2.next = 28;
203
+ case 27:
204
+ _context2.next = 29;
204
205
  return _this2.props.updateStimulus(workingStimulus.toJS(), quizId);
205
- case 28:
206
- _context2.next = 34;
206
+ case 29:
207
+ _context2.next = 35;
207
208
  break;
208
- case 30:
209
- _context2.prev = 30;
210
- _context2.t0 = _context2["catch"](10);
209
+ case 31:
210
+ _context2.prev = 31;
211
+ _context2.t0 = _context2["catch"](11);
211
212
  _this2.setState({
212
213
  canSubmit: true
213
214
  });
214
215
  throw _context2.t0;
215
- case 34:
216
- _this2.afterSubmit();
217
216
  case 35:
217
+ _this2.afterSubmit();
218
+ case 36:
218
219
  case "end":
219
220
  return _context2.stop();
220
221
  }
221
- }, _callee2, null, [[10, 30]]);
222
+ }, _callee2, null, [[11, 31]]);
222
223
  }));
223
224
  return function (_x2) {
224
225
  return _ref2.apply(this, arguments);
@@ -322,10 +323,11 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
322
323
  }, {
323
324
  key: "afterSubmit",
324
325
  value: function afterSubmit() {
326
+ var message = this.isPassage() ? (0, _formatMessage["default"])('Changes to text block saved.') : (0, _formatMessage["default"])('Changes to stimulus saved.');
325
327
  this.props.switchOffEditing();
326
328
  this.clearModifications();
327
329
  this.props.setUi(_quizCommon.SHOULD_CLONE_ITEM, false);
328
- this.props.screenreaderNotification((0, _formatMessage["default"])('Changes to stimulus saved.'));
330
+ this.props.screenreaderNotification(message);
329
331
  if (this.props.nextQuizEntry) {
330
332
  this.createNextQuizEntry();
331
333
  }
@@ -371,8 +373,8 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
371
373
  }, {
372
374
  key: "renderStimulusEdit",
373
375
  value: function renderStimulusEdit() {
374
- var stimulusLabel = this.isPassage() ? (0, _formatMessage["default"])('Passage') : (0, _formatMessage["default"])('Stimulus');
375
- var automationPrefix = this.isPassage() ? 'passage' : 'stimulus';
376
+ var stimulusLabel = this.isPassage() ? (0, _formatMessage["default"])('Text Block') : (0, _formatMessage["default"])('Stimulus');
377
+ var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
376
378
  return (0, _emotion.jsx)("div", null, (0, _emotion.jsx)("div", {
377
379
  css: this.props.styles.stimulus,
378
380
  ref: this.handleRef
@@ -428,9 +430,10 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
428
430
  var _this$props = this.props,
429
431
  stimulus = _this$props.stimulus,
430
432
  quizEntry = _this$props.quizEntry;
433
+ var isPassage = stimulus.isPassage;
431
434
  var needsWarning = stimulus.isImmutable() || quizEntry.isArchivedBankEntry;
432
435
  var propForWrapperFunc = quizEntry.isArchivedBankEntry ? _warningHelpers.propsForBankEntryVersioningWrapper : _warningHelpers.propsForStimulusVersioningWrapper;
433
- var propsForStimulusVersioning = propForWrapperFunc(needsWarning, this.props.shouldClone, (0, _partial["default"])(this.props.setUi, _quizCommon.SHOULD_CLONE_ITEM), this.props.switchOffEditing, true, quizEntry.isArchivedBankEntry ? 'info' : 'warning');
436
+ var propsForStimulusVersioning = propForWrapperFunc(needsWarning, this.props.shouldClone, (0, _partial["default"])(this.props.setUi, _quizCommon.SHOULD_CLONE_ITEM), this.props.switchOffEditing, true, quizEntry.isArchivedBankEntry ? 'info' : 'warning', isPassage);
434
437
  var hasWarningWrapper = needsWarning && !this.props.shouldClone;
435
438
  return (0, _emotion.jsx)(_WarningWrapper["default"], propsForStimulusVersioning, hasWarningWrapper ? (0, _emotion.jsx)(_StimulusShowInfo["default"], this.props) : this.renderStimulusEdit());
436
439
  }
@@ -79,9 +79,9 @@ var StimulusEditInfo = exports.StimulusEditInfo = (_dec = (0, _quizCommon.withSt
79
79
  key: "headerText",
80
80
  value: function headerText(stimulus) {
81
81
  if (stimulus.isTemporary()) {
82
- return stimulus.passage ? (0, _formatMessage["default"])('Add Passage') : (0, _formatMessage["default"])('Add Stimulus');
82
+ return stimulus.passage ? (0, _formatMessage["default"])('Add Text Block') : (0, _formatMessage["default"])('Add Stimulus');
83
83
  } else {
84
- return stimulus.passage ? (0, _formatMessage["default"])('Edit Passage') : (0, _formatMessage["default"])('Edit Stimulus');
84
+ return stimulus.passage ? (0, _formatMessage["default"])('Edit Text Block') : (0, _formatMessage["default"])('Edit Stimulus');
85
85
  }
86
86
  }
87
87
  }, {
@@ -125,7 +125,7 @@ var StimulusEditInfo = exports.StimulusEditInfo = (_dec = (0, _quizCommon.withSt
125
125
  }
126
126
  return (0, _emotion.jsx)(_uiAlerts.Alert, {
127
127
  variant: "warning"
128
- }, (0, _formatMessage["default"])('The passage sections may not appear in their original order due to the shuffle setting.'));
128
+ }, (0, _formatMessage["default"])('The text block sections may not appear in their original order due to the shuffle setting.'));
129
129
  }
130
130
  }, {
131
131
  key: "renderInstructions",
@@ -170,10 +170,11 @@ var StimulusEditInfo = exports.StimulusEditInfo = (_dec = (0, _quizCommon.withSt
170
170
  var stimulus = this.props.workingStimulus;
171
171
  var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
172
172
  var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
173
- var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
173
+ var automationPrefix = stimulus.passage ? 'text-block' : 'stimulus';
174
+ var message = stimulus.passage ? (0, _formatMessage["default"])('Edit Text Block') : (0, _formatMessage["default"])('Edit Stimulus');
174
175
  return (0, _emotion.jsx)(_quizCommon.FormFieldGroup, {
175
176
  messages: this.inputErrors('onSelf'),
176
- description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Edit Stimulus'))
177
+ description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, message)
177
178
  }, (0, _emotion.jsx)(_uiHeading.Heading, {
178
179
  level: "h3",
179
180
  as: "h2"
@@ -65,7 +65,7 @@ var StimulusShow = exports.StimulusShow = (_dec = (0, _quizCommon.withStyleOverr
65
65
  }, {
66
66
  key: "render",
67
67
  value: function render() {
68
- var stimulusLabel = this.props.stimulus.passage ? (0, _formatMessage["default"])('Passage') : (0, _formatMessage["default"])('Stimulus');
68
+ var stimulusLabel = this.props.stimulus.passage ? (0, _formatMessage["default"])('Text Block') : (0, _formatMessage["default"])('Stimulus');
69
69
  return (0, _emotion.jsx)(_overlay["default"], {
70
70
  onClick: this.switchOnEditing,
71
71
  wrapperStyles: this.props.styles.stimulusWrapper,
@@ -44,7 +44,7 @@ var StimulusShowInfo = /*#__PURE__*/function (_Component) {
44
44
  key: "render",
45
45
  value: function render() {
46
46
  var stimulus = this.props.stimulus;
47
- var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
47
+ var automationPrefix = stimulus.passage ? 'text-block' : 'stimulus';
48
48
  var instructions = stimulus.instructions && /*#__PURE__*/_react["default"].createElement(_uiView.View, {
49
49
  as: "div",
50
50
  padding: "small",
@@ -39,7 +39,9 @@ var GenericAsyncSearch = exports.GenericAsyncSearch = /*#__PURE__*/function (_Co
39
39
  (0, _classCallCheck2["default"])(this, GenericAsyncSearch);
40
40
  _this2 = _callSuper(this, GenericAsyncSearch, arguments);
41
41
  (0, _defineProperty2["default"])(_this2, "setInputRef", function (inputRef) {
42
+ var _this2$props$inputRef, _this2$props;
42
43
  _this2.inputRef = inputRef;
44
+ (_this2$props$inputRef = (_this2$props = _this2.props).inputRef) === null || _this2$props$inputRef === void 0 || _this2$props$inputRef.call(_this2$props, inputRef);
43
45
  });
44
46
  (0, _defineProperty2["default"])(_this2, "state", {
45
47
  inputValue: _this2.props.selectedOption ? _this2.props.selectedOption.text : '',
@@ -170,7 +172,8 @@ var GenericAsyncSearch = exports.GenericAsyncSearch = /*#__PURE__*/function (_Co
170
172
  onRequestHighlightOption: this.handleHighlightOption,
171
173
  onRequestSelectOption: this.handleSelectOption,
172
174
  onKeyDown: this.handleKeyDown,
173
- messages: this.props.messages
175
+ messages: this.props.messages,
176
+ isRequired: this.props.isRequired
174
177
  }, this.renderOptions());
175
178
  }
176
179
  }]);
@@ -187,13 +190,17 @@ var GenericAsyncSearch = exports.GenericAsyncSearch = /*#__PURE__*/function (_Co
187
190
  }),
188
191
  messages: _propTypes["default"].array,
189
192
  selectAutomation: _propTypes["default"].string,
190
- getOptions: _propTypes["default"].func.isRequired
193
+ getOptions: _propTypes["default"].func.isRequired,
194
+ inputRef: _propTypes["default"].func,
195
+ isRequired: _propTypes["default"].bool
191
196
  });
192
197
  (0, _defineProperty2["default"])(GenericAsyncSearch, "defaultProps", {
193
198
  debounceDelay: 500,
194
199
  minChars: 3,
195
200
  label: null,
196
201
  placeholder: null,
197
- selectAutomation: null
202
+ selectAutomation: null,
203
+ inputRef: function inputRef() {},
204
+ isRequired: false
198
205
  });
199
206
  var _default = exports["default"] = GenericAsyncSearch;
@@ -68,8 +68,8 @@ var InteractionTypes = exports.InteractionTypes = (_dec = (0, _quizCommon.withSt
68
68
  return _this2.props.addStimulus(true);
69
69
  };
70
70
  Icon = _uiIcons.IconPlusLine;
71
- name = (0, _formatMessage["default"])('Passage');
72
- title = (0, _formatMessage["default"])('Add Passage');
71
+ name = (0, _formatMessage["default"])('Text Block');
72
+ title = (0, _formatMessage["default"])('Add Text Block');
73
73
  automation = 'sdk-interaction-button-passage';
74
74
  break;
75
75
  default:
@@ -186,6 +186,7 @@ var InteractionTypes = exports.InteractionTypes = (_dec = (0, _quizCommon.withSt
186
186
  styles: _propTypes["default"].object
187
187
  }), (0, _defineProperty2["default"])(_InteractionTypes, "defaultProps", {
188
188
  allowStimulusCreation: true,
189
+ allowPassageCreation: false,
189
190
  types: (0, _immutable.List)()
190
191
  }), _InteractionTypes)) || _class);
191
192
  var _default = exports["default"] = InteractionTypes;
@@ -49,6 +49,13 @@ var posObjFromQuizEntry = exports.posObjFromQuizEntry = (0, _cachePreviousArgs["
49
49
  // handle dragging items over stimulus
50
50
  if (!quizEntryDragging.hasStimulus && quizEntryHovered.hasStimulus && (onRightHalf || inSidebar)) {
51
51
  if (deepInsideEntry && quizEntryHovered.getNestedEntries().size === 0) {
52
+ if (quizEntryHovered.entryType === 'BankEntry') {
53
+ var bankEntry = quizEntryHovered.getEntry();
54
+ var bankEntryItem = bankEntry === null || bankEntry === void 0 ? void 0 : bankEntry.getEntry();
55
+ if (bankEntryItem !== null && bankEntryItem !== void 0 && bankEntryItem.isPassage) {
56
+ return null;
57
+ }
58
+ }
52
59
  if (quizEntryHovered.isPassage) {
53
60
  return null;
54
61
  }
@@ -74,7 +74,15 @@ var BankEntry = exports.BankEntry = /*#__PURE__*/function (_ReduxRecord) {
74
74
  }, {
75
75
  key: "isStimulus",
76
76
  get: function get() {
77
- return this.entryType === 'Stimulus';
77
+ var _this$getEntry;
78
+ return this.entryType === 'Stimulus' && !((_this$getEntry = this.getEntry()) !== null && _this$getEntry !== void 0 && _this$getEntry.isPassage);
79
+ }
80
+ }, {
81
+ key: "isPassage",
82
+ get: function get() {
83
+ var _this$getEntry2;
84
+ if (!this.isStimulus) return false;
85
+ return (_this$getEntry2 = this.getEntry()) === null || _this$getEntry2 === void 0 ? void 0 : _this$getEntry2.isPassage;
78
86
  }
79
87
  }]);
80
88
  }((0, _reduxRecord["default"])({
@@ -375,51 +375,63 @@ var QuizEntry = exports.QuizEntry = (_dec = (0, _withStateCache["default"])(func
375
375
  // their own possible string so that translators can better translate the meaning
376
376
  var type;
377
377
  if (this.hasStimulus || this.isBank) {
378
+ if (this.isPassage) {
379
+ type = (0, _formatMessage["default"])('Text Block');
380
+ var opts = {
381
+ type: type,
382
+ start: displayPosition - 1
383
+ };
384
+ return {
385
+ Remove: (0, _formatMessage["default"])('Remove {type} located after position {start, number}.', opts),
386
+ Edit: (0, _formatMessage["default"])('Edit {type} located after position {start, number}.', opts),
387
+ Move: (0, _formatMessage["default"])('Move {type} located after position {start, number}.', opts)
388
+ }[verb];
389
+ }
378
390
  type = this.hasStimulus ? (0, _formatMessage["default"])('Stimulus') : (0, _formatMessage["default"])('Bank');
379
391
  if (this.numItems > 1) {
380
- var opts = {
392
+ var _opts = {
381
393
  type: type,
382
394
  start: displayPosition,
383
395
  end: displayPosition + this.numItems - 1
384
396
  };
385
397
  return {
386
- Remove: (0, _formatMessage["default"])('Remove {type} containing questions {start, number} through {end, number}.', opts),
387
- Edit: (0, _formatMessage["default"])('Edit {type} containing questions {start, number} through {end, number}.', opts),
388
- Move: (0, _formatMessage["default"])('Move {type} containing questions {start, number} through {end, number}.', opts)
398
+ Remove: (0, _formatMessage["default"])('Remove {type} containing questions {start, number} through {end, number}.', _opts),
399
+ Edit: (0, _formatMessage["default"])('Edit {type} containing questions {start, number} through {end, number}.', _opts),
400
+ Move: (0, _formatMessage["default"])('Move {type} containing questions {start, number} through {end, number}.', _opts)
389
401
  }[verb];
390
402
  } else if (this.numItems === 1) {
391
- var _opts = {
403
+ var _opts2 = {
392
404
  type: type,
393
405
  start: displayPosition
394
406
  };
395
407
  return {
396
- Remove: (0, _formatMessage["default"])('Remove {type} containing question {start, number}.', _opts),
397
- Edit: (0, _formatMessage["default"])('Edit {type} containing question {start, number}.', _opts),
398
- Move: (0, _formatMessage["default"])('Move {type} containing question {start, number}.', _opts)
408
+ Remove: (0, _formatMessage["default"])('Remove {type} containing question {start, number}.', _opts2),
409
+ Edit: (0, _formatMessage["default"])('Edit {type} containing question {start, number}.', _opts2),
410
+ Move: (0, _formatMessage["default"])('Move {type} containing question {start, number}.', _opts2)
399
411
  }[verb];
400
412
  } else {
401
- var _opts2 = {
413
+ var _opts3 = {
402
414
  type: type,
403
415
  start: displayPosition - 1
404
416
  };
405
417
  return {
406
- Remove: (0, _formatMessage["default"])('Remove empty {type} located after position {start, number}.', _opts2),
407
- Edit: (0, _formatMessage["default"])('Edit empty {type} located after position {start, number}.', _opts2),
408
- Move: (0, _formatMessage["default"])('Move empty {type} located after position {start, number}.', _opts2)
418
+ Remove: (0, _formatMessage["default"])('Remove empty {type} located after position {start, number}.', _opts3),
419
+ Edit: (0, _formatMessage["default"])('Edit empty {type} located after position {start, number}.', _opts3),
420
+ Move: (0, _formatMessage["default"])('Move empty {type} located after position {start, number}.', _opts3)
409
421
  }[verb];
410
422
  }
411
423
  } else {
412
424
  type = (0, _formatMessage["default"])('Question');
413
- var _opts3 = {
425
+ var _opts4 = {
414
426
  verb: verb,
415
427
  type: type,
416
428
  position: displayPosition
417
429
  };
418
430
  return {
419
- Remove: (0, _formatMessage["default"])('Remove {type} at position {position, number}.', _opts3),
420
- Edit: (0, _formatMessage["default"])('Edit {type} at position {position, number}.', _opts3),
421
- Move: (0, _formatMessage["default"])('Move {type} at position {position, number}.', _opts3),
422
- Copy: (0, _formatMessage["default"])('Copy {type} at position {position, number}.', _opts3)
431
+ Remove: (0, _formatMessage["default"])('Remove {type} at position {position, number}.', _opts4),
432
+ Edit: (0, _formatMessage["default"])('Edit {type} at position {position, number}.', _opts4),
433
+ Move: (0, _formatMessage["default"])('Move {type} at position {position, number}.', _opts4),
434
+ Copy: (0, _formatMessage["default"])('Copy {type} at position {position, number}.', _opts4)
423
435
  }[verb];
424
436
  }
425
437
  }
@@ -92,6 +92,11 @@ var SessionItem = exports.SessionItem = /*#__PURE__*/function (_ReduxRecord) {
92
92
  get: function get() {
93
93
  return this.type === 'Stimulus';
94
94
  }
95
+ }, {
96
+ key: "isPassage",
97
+ get: function get() {
98
+ return this.isStimulus && this.stimulusRecord.isPassage;
99
+ }
95
100
  }, {
96
101
  key: "stimulusRecord",
97
102
  get: function get() {
@@ -130,6 +135,7 @@ var SessionItem = exports.SessionItem = /*#__PURE__*/function (_ReduxRecord) {
130
135
  item: {},
131
136
  pointsPossible: null,
132
137
  position: null,
138
+ questionNumber: null,
133
139
  quizEntryId: null,
134
140
  quizSessionId: null,
135
141
  scoringData: {},
@@ -144,19 +144,28 @@ var _default = exports["default"] = function _default() {
144
144
  entryType: action.payload.bankEntryType
145
145
  };
146
146
  var stateWithBankEntryMods = updateObjectOfType(stateWithBankMods, _quizCommon.TEMPORARY_BANK_ENTRY_ID, bankEntryMods, 'bankEntries');
147
- var bankItemMods = action.payload.bankEntryType === 'Item' ? {
148
- interactionData: action.payload.interactionTypeData.interactionData,
149
- interactionType: action.payload.interactionTypeData.id,
150
- itemBody: action.payload.interactionTypeData.itemBody,
151
- properties: action.payload.interactionTypeData.properties,
152
- scoringData: action.payload.interactionTypeData.scoringData,
153
- title: null
154
- } : {
155
- title: ''
156
- };
147
+ var bankItemMods;
148
+ if (action.payload.bankEntryType === 'Item') {
149
+ bankItemMods = {
150
+ interactionData: action.payload.interactionTypeData.interactionData,
151
+ interactionType: action.payload.interactionTypeData.id,
152
+ itemBody: action.payload.interactionTypeData.itemBody,
153
+ properties: action.payload.interactionTypeData.properties,
154
+ scoringData: action.payload.interactionTypeData.scoringData,
155
+ title: null
156
+ };
157
+ } else {
158
+ var isPassage = action.payload.interactionTypeData.passage;
159
+ bankItemMods = isPassage ? {
160
+ title: '',
161
+ passage: true,
162
+ orientation: 'top'
163
+ } : {
164
+ title: ''
165
+ };
166
+ }
157
167
  var collection = action.payload.bankEntryType === 'Item' ? 'items' : 'stimuli';
158
- var stateWithMods = updateObjectOfType(stateWithBankEntryMods, tempId, bankItemMods, collection);
159
- return stateWithMods;
168
+ return updateObjectOfType(stateWithBankEntryMods, tempId, bankItemMods, collection);
160
169
  }();
161
170
  case _quizCommon.CLEAR_NEXT_QUIZ_ENTRY:
162
171
  return state["delete"]('nextQuizEntry');
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.propsForStimulusVersioningWrapper = exports.propsForStimulusBankEntryEditPrompt = exports.propsForItemVersioningWrapper = exports.propsForItemBankEntryEditPrompt = exports.propsForBankEntryVersioningWrapper = exports.propsForBankEntryUnauthorizedEdit = exports.propsForBankEntryEditPrompt = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
9
  var _react = _interopRequireDefault(require("react"));
9
10
  var _partial = _interopRequireDefault(require("lodash/partial"));
10
11
  var _uiText = require("@instructure/ui-text");
@@ -52,11 +53,20 @@ var propsForStimulusVersioningWrapper = exports.propsForStimulusVersioningWrappe
52
53
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
53
54
  args[_key2] = arguments[_key2];
54
55
  }
56
+ var isPassage = args[args.length - 1];
57
+ var restArgs = args.slice(0, -1);
58
+ var itemName = isPassage ? 'text block' : 'stimulus';
59
+ var title = (0, _formatMessage["default"])('Some students have already submitted answers for this {itemName}!', {
60
+ itemName: itemName
61
+ });
62
+ var content = (0, _formatMessage["default"])('You can apply your edits to a copy of this {itemName}' + ' which will only be seen by students that have not taken the assessment.' + ' Attached questions will be copied as well.', {
63
+ itemName: itemName
64
+ });
55
65
  return propsForVersioningWrapper.apply(void 0, [/*#__PURE__*/_react["default"].createElement(_uiText.Text, {
56
66
  color: "primary"
57
67
  }, /*#__PURE__*/_react["default"].createElement("b", null, (0, _formatMessage["default"])('Editing a copy.')), "\xA0", (0, _formatMessage["default"])('Statistics from this new copy will appear separate from the previous version.')), /*#__PURE__*/_react["default"].createElement(_uiText.Text, {
58
68
  color: "primary"
59
- }, /*#__PURE__*/_react["default"].createElement("b", null, (0, _formatMessage["default"])('Some students have already submitted answers for this stimulus!')), "\xA0", (0, _formatMessage["default"])('You can apply your edits to a copy of this stimulus' + ' which will only be seen by students that have not taken the assessment.' + ' Attached questions will be copied as well.'))].concat(args));
69
+ }, /*#__PURE__*/_react["default"].createElement("b", null, title), "\xA0", content)].concat((0, _toConsumableArray2["default"])(restArgs)));
60
70
  };
61
71
  var propsForBankEntryVersioningWrapper = exports.propsForBankEntryVersioningWrapper = function propsForBankEntryVersioningWrapper() {
62
72
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
@@ -91,8 +101,8 @@ var propsForItemBankEntryEditPrompt = exports.propsForItemBankEntryEditPrompt =
91
101
  };
92
102
  var propsForStimulusBankEntryEditPrompt = exports.propsForStimulusBankEntryEditPrompt = function propsForStimulusBankEntryEditPrompt() {
93
103
  var isPassage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
94
- var title = isPassage ? (0, _formatMessage["default"])('Banked Passage.') : (0, _formatMessage["default"])('Banked Stimulus.');
95
- var content = isPassage ? (0, _formatMessage["default"])('Editing of this passage must take place within the bank.') : (0, _formatMessage["default"])('Editing of this stimulus must take place within the bank.');
104
+ var title = isPassage ? (0, _formatMessage["default"])('Banked Text Block.') : (0, _formatMessage["default"])('Banked Stimulus.');
105
+ var content = isPassage ? (0, _formatMessage["default"])('Editing of this text block must take place within the bank.') : (0, _formatMessage["default"])('Editing of this stimulus must take place within the bank.');
96
106
  var promptComponent = /*#__PURE__*/_react["default"].createElement(_uiView.View, {
97
107
  as: "div",
98
108
  "data-automation": "sdk-editInBanks-warning"
@@ -229,14 +229,14 @@ var ModerateTray = exports.ModerateTray = /*#__PURE__*/function (_Component) {
229
229
  as: "div",
230
230
  direction: "column",
231
231
  height: "100vh"
232
- }, this.renderTitleAndCloseButton(), this.props.atteqApplyChangesToCurrentQuizAttemptsEnabled && /*#__PURE__*/_react["default"].createElement(_quizCommon.Flex.Item, {
232
+ }, this.renderTitleAndCloseButton(), this.props.atteqApplyChangesToCurrentQuizAttemptsEnabled && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_quizCommon.Flex.Item, {
233
233
  padding: "medium medium 0 medium"
234
234
  }, this.renderNameWithTooltip()), /*#__PURE__*/_react["default"].createElement(_quizCommon.Flex.Item, {
235
- padding: "medium"
236
- }, (0, _formatMessage["default"])('These settings apply to current and all future attempts.')), /*#__PURE__*/_react["default"].createElement(_quizCommon.Flex.Item, {
235
+ padding: "medium medium 0"
236
+ }, (0, _formatMessage["default"])('These settings apply to current and all future attempts.'))), /*#__PURE__*/_react["default"].createElement(_quizCommon.Flex.Item, {
237
237
  shouldGrow: true,
238
- padding: "0 medium"
239
- }, this.renderChildren()), this.props.atteqApplyChangesToCurrentQuizAttemptsEnabled && /*#__PURE__*/_react["default"].createElement(_quizCommon.Flex.Item, null, this.renderFooter())));
238
+ padding: "medium medium 0"
239
+ }, this.renderChildren()), /*#__PURE__*/_react["default"].createElement(_quizCommon.Flex.Item, null, this.renderFooter())));
240
240
  }
241
241
  }]);
242
242
  }(_react.Component);
@@ -234,7 +234,7 @@ var __remainingQuestionPositions = function __remainingQuestionPositions(session
234
234
  var itemUserResponse = __getResponseForSessionItem(si, responses);
235
235
  return item.hasResponse(itemUserResponse);
236
236
  }).map(function (si) {
237
- return si.get('position');
237
+ return si.get('questionNumber');
238
238
  }).toSet().toJS();
239
239
  };
240
240
  function showSubmitConfirmModal(quizSessionId) {