@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
@@ -30,7 +30,9 @@ export var GenericAsyncSearch = /*#__PURE__*/function (_Component) {
30
30
  _classCallCheck(this, GenericAsyncSearch);
31
31
  _this2 = _callSuper(this, GenericAsyncSearch, arguments);
32
32
  _defineProperty(_this2, "setInputRef", function (inputRef) {
33
+ var _this2$props$inputRef, _this2$props;
33
34
  _this2.inputRef = inputRef;
35
+ (_this2$props$inputRef = (_this2$props = _this2.props).inputRef) === null || _this2$props$inputRef === void 0 || _this2$props$inputRef.call(_this2$props, inputRef);
34
36
  });
35
37
  _defineProperty(_this2, "state", {
36
38
  inputValue: _this2.props.selectedOption ? _this2.props.selectedOption.text : '',
@@ -161,7 +163,8 @@ export var GenericAsyncSearch = /*#__PURE__*/function (_Component) {
161
163
  onRequestHighlightOption: this.handleHighlightOption,
162
164
  onRequestSelectOption: this.handleSelectOption,
163
165
  onKeyDown: this.handleKeyDown,
164
- messages: this.props.messages
166
+ messages: this.props.messages,
167
+ isRequired: this.props.isRequired
165
168
  }, this.renderOptions());
166
169
  }
167
170
  }]);
@@ -178,13 +181,17 @@ _defineProperty(GenericAsyncSearch, "propTypes", {
178
181
  }),
179
182
  messages: PropTypes.array,
180
183
  selectAutomation: PropTypes.string,
181
- getOptions: PropTypes.func.isRequired
184
+ getOptions: PropTypes.func.isRequired,
185
+ inputRef: PropTypes.func,
186
+ isRequired: PropTypes.bool
182
187
  });
183
188
  _defineProperty(GenericAsyncSearch, "defaultProps", {
184
189
  debounceDelay: 500,
185
190
  minChars: 3,
186
191
  label: null,
187
192
  placeholder: null,
188
- selectAutomation: null
193
+ selectAutomation: null,
194
+ inputRef: function inputRef() {},
195
+ isRequired: false
189
196
  });
190
197
  export default GenericAsyncSearch;
@@ -61,8 +61,8 @@ export var InteractionTypes = (_dec = withStyleOverrides(generateStyle, generate
61
61
  return _this2.props.addStimulus(true);
62
62
  };
63
63
  Icon = IconPlusLine;
64
- name = t('Passage');
65
- title = t('Add Passage');
64
+ name = t('Text Block');
65
+ title = t('Add Text Block');
66
66
  automation = 'sdk-interaction-button-passage';
67
67
  break;
68
68
  default:
@@ -179,6 +179,7 @@ export var InteractionTypes = (_dec = withStyleOverrides(generateStyle, generate
179
179
  styles: PropTypes.object
180
180
  }), _defineProperty(_InteractionTypes, "defaultProps", {
181
181
  allowStimulusCreation: true,
182
+ allowPassageCreation: false,
182
183
  types: List()
183
184
  }), _InteractionTypes)) || _class);
184
185
  export default InteractionTypes;
@@ -30,6 +30,13 @@ export var posObjFromQuizEntry = cachePreviousArgs(function (quizEntryDragging,
30
30
  // handle dragging items over stimulus
31
31
  if (!quizEntryDragging.hasStimulus && quizEntryHovered.hasStimulus && (onRightHalf || inSidebar)) {
32
32
  if (deepInsideEntry && quizEntryHovered.getNestedEntries().size === 0) {
33
+ if (quizEntryHovered.entryType === 'BankEntry') {
34
+ var bankEntry = quizEntryHovered.getEntry();
35
+ var bankEntryItem = bankEntry === null || bankEntry === void 0 ? void 0 : bankEntry.getEntry();
36
+ if (bankEntryItem !== null && bankEntryItem !== void 0 && bankEntryItem.isPassage) {
37
+ return null;
38
+ }
39
+ }
33
40
  if (quizEntryHovered.isPassage) {
34
41
  return null;
35
42
  }
@@ -67,7 +67,15 @@ export var BankEntry = /*#__PURE__*/function (_ReduxRecord) {
67
67
  }, {
68
68
  key: "isStimulus",
69
69
  get: function get() {
70
- return this.entryType === 'Stimulus';
70
+ var _this$getEntry;
71
+ return this.entryType === 'Stimulus' && !((_this$getEntry = this.getEntry()) !== null && _this$getEntry !== void 0 && _this$getEntry.isPassage);
72
+ }
73
+ }, {
74
+ key: "isPassage",
75
+ get: function get() {
76
+ var _this$getEntry2;
77
+ if (!this.isStimulus) return false;
78
+ return (_this$getEntry2 = this.getEntry()) === null || _this$getEntry2 === void 0 ? void 0 : _this$getEntry2.isPassage;
71
79
  }
72
80
  }]);
73
81
  }(ReduxRecord({
@@ -366,51 +366,63 @@ export var QuizEntry = (_dec = withStateCache(function () {
366
366
  // their own possible string so that translators can better translate the meaning
367
367
  var type;
368
368
  if (this.hasStimulus || this.isBank) {
369
+ if (this.isPassage) {
370
+ type = t('Text Block');
371
+ var opts = {
372
+ type: type,
373
+ start: displayPosition - 1
374
+ };
375
+ return {
376
+ Remove: t('Remove {type} located after position {start, number}.', opts),
377
+ Edit: t('Edit {type} located after position {start, number}.', opts),
378
+ Move: t('Move {type} located after position {start, number}.', opts)
379
+ }[verb];
380
+ }
369
381
  type = this.hasStimulus ? t('Stimulus') : t('Bank');
370
382
  if (this.numItems > 1) {
371
- var opts = {
383
+ var _opts = {
372
384
  type: type,
373
385
  start: displayPosition,
374
386
  end: displayPosition + this.numItems - 1
375
387
  };
376
388
  return {
377
- Remove: t('Remove {type} containing questions {start, number} through {end, number}.', opts),
378
- Edit: t('Edit {type} containing questions {start, number} through {end, number}.', opts),
379
- Move: t('Move {type} containing questions {start, number} through {end, number}.', opts)
389
+ Remove: t('Remove {type} containing questions {start, number} through {end, number}.', _opts),
390
+ Edit: t('Edit {type} containing questions {start, number} through {end, number}.', _opts),
391
+ Move: t('Move {type} containing questions {start, number} through {end, number}.', _opts)
380
392
  }[verb];
381
393
  } else if (this.numItems === 1) {
382
- var _opts = {
394
+ var _opts2 = {
383
395
  type: type,
384
396
  start: displayPosition
385
397
  };
386
398
  return {
387
- Remove: t('Remove {type} containing question {start, number}.', _opts),
388
- Edit: t('Edit {type} containing question {start, number}.', _opts),
389
- Move: t('Move {type} containing question {start, number}.', _opts)
399
+ Remove: t('Remove {type} containing question {start, number}.', _opts2),
400
+ Edit: t('Edit {type} containing question {start, number}.', _opts2),
401
+ Move: t('Move {type} containing question {start, number}.', _opts2)
390
402
  }[verb];
391
403
  } else {
392
- var _opts2 = {
404
+ var _opts3 = {
393
405
  type: type,
394
406
  start: displayPosition - 1
395
407
  };
396
408
  return {
397
- Remove: t('Remove empty {type} located after position {start, number}.', _opts2),
398
- Edit: t('Edit empty {type} located after position {start, number}.', _opts2),
399
- Move: t('Move empty {type} located after position {start, number}.', _opts2)
409
+ Remove: t('Remove empty {type} located after position {start, number}.', _opts3),
410
+ Edit: t('Edit empty {type} located after position {start, number}.', _opts3),
411
+ Move: t('Move empty {type} located after position {start, number}.', _opts3)
400
412
  }[verb];
401
413
  }
402
414
  } else {
403
415
  type = t('Question');
404
- var _opts3 = {
416
+ var _opts4 = {
405
417
  verb: verb,
406
418
  type: type,
407
419
  position: displayPosition
408
420
  };
409
421
  return {
410
- Remove: t('Remove {type} at position {position, number}.', _opts3),
411
- Edit: t('Edit {type} at position {position, number}.', _opts3),
412
- Move: t('Move {type} at position {position, number}.', _opts3),
413
- Copy: t('Copy {type} at position {position, number}.', _opts3)
422
+ Remove: t('Remove {type} at position {position, number}.', _opts4),
423
+ Edit: t('Edit {type} at position {position, number}.', _opts4),
424
+ Move: t('Move {type} at position {position, number}.', _opts4),
425
+ Copy: t('Copy {type} at position {position, number}.', _opts4)
414
426
  }[verb];
415
427
  }
416
428
  }
@@ -85,6 +85,11 @@ export var SessionItem = /*#__PURE__*/function (_ReduxRecord) {
85
85
  get: function get() {
86
86
  return this.type === 'Stimulus';
87
87
  }
88
+ }, {
89
+ key: "isPassage",
90
+ get: function get() {
91
+ return this.isStimulus && this.stimulusRecord.isPassage;
92
+ }
88
93
  }, {
89
94
  key: "stimulusRecord",
90
95
  get: function get() {
@@ -123,6 +128,7 @@ export var SessionItem = /*#__PURE__*/function (_ReduxRecord) {
123
128
  item: {},
124
129
  pointsPossible: null,
125
130
  position: null,
131
+ questionNumber: null,
126
132
  quizEntryId: null,
127
133
  quizSessionId: null,
128
134
  scoringData: {},
@@ -137,19 +137,28 @@ export default (function () {
137
137
  entryType: action.payload.bankEntryType
138
138
  };
139
139
  var stateWithBankEntryMods = updateObjectOfType(stateWithBankMods, TEMPORARY_BANK_ENTRY_ID, bankEntryMods, 'bankEntries');
140
- var bankItemMods = action.payload.bankEntryType === 'Item' ? {
141
- interactionData: action.payload.interactionTypeData.interactionData,
142
- interactionType: action.payload.interactionTypeData.id,
143
- itemBody: action.payload.interactionTypeData.itemBody,
144
- properties: action.payload.interactionTypeData.properties,
145
- scoringData: action.payload.interactionTypeData.scoringData,
146
- title: null
147
- } : {
148
- title: ''
149
- };
140
+ var bankItemMods;
141
+ if (action.payload.bankEntryType === 'Item') {
142
+ bankItemMods = {
143
+ interactionData: action.payload.interactionTypeData.interactionData,
144
+ interactionType: action.payload.interactionTypeData.id,
145
+ itemBody: action.payload.interactionTypeData.itemBody,
146
+ properties: action.payload.interactionTypeData.properties,
147
+ scoringData: action.payload.interactionTypeData.scoringData,
148
+ title: null
149
+ };
150
+ } else {
151
+ var isPassage = action.payload.interactionTypeData.passage;
152
+ bankItemMods = isPassage ? {
153
+ title: '',
154
+ passage: true,
155
+ orientation: 'top'
156
+ } : {
157
+ title: ''
158
+ };
159
+ }
150
160
  var collection = action.payload.bankEntryType === 'Item' ? 'items' : 'stimuli';
151
- var stateWithMods = updateObjectOfType(stateWithBankEntryMods, tempId, bankItemMods, collection);
152
- return stateWithMods;
161
+ return updateObjectOfType(stateWithBankEntryMods, tempId, bankItemMods, collection);
153
162
  }();
154
163
  case CLEAR_NEXT_QUIZ_ENTRY:
155
164
  return state["delete"]('nextQuizEntry');
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
1
2
  import React from 'react';
2
3
  import partial from 'lodash/partial';
3
4
  import { Text } from '@instructure/ui-text';
@@ -45,11 +46,20 @@ export var propsForStimulusVersioningWrapper = function propsForStimulusVersioni
45
46
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
46
47
  args[_key2] = arguments[_key2];
47
48
  }
49
+ var isPassage = args[args.length - 1];
50
+ var restArgs = args.slice(0, -1);
51
+ var itemName = isPassage ? 'text block' : 'stimulus';
52
+ var title = t('Some students have already submitted answers for this {itemName}!', {
53
+ itemName: itemName
54
+ });
55
+ var content = t('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.', {
56
+ itemName: itemName
57
+ });
48
58
  return propsForVersioningWrapper.apply(void 0, [/*#__PURE__*/React.createElement(Text, {
49
59
  color: "primary"
50
60
  }, /*#__PURE__*/React.createElement("b", null, t('Editing a copy.')), "\xA0", t('Statistics from this new copy will appear separate from the previous version.')), /*#__PURE__*/React.createElement(Text, {
51
61
  color: "primary"
52
- }, /*#__PURE__*/React.createElement("b", null, t('Some students have already submitted answers for this stimulus!')), "\xA0", t('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));
62
+ }, /*#__PURE__*/React.createElement("b", null, title), "\xA0", content)].concat(_toConsumableArray(restArgs)));
53
63
  };
54
64
  export var propsForBankEntryVersioningWrapper = function propsForBankEntryVersioningWrapper() {
55
65
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
@@ -84,8 +94,8 @@ export var propsForItemBankEntryEditPrompt = function propsForItemBankEntryEditP
84
94
  };
85
95
  export var propsForStimulusBankEntryEditPrompt = function propsForStimulusBankEntryEditPrompt() {
86
96
  var isPassage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
87
- var title = isPassage ? t('Banked Passage.') : t('Banked Stimulus.');
88
- var content = isPassage ? t('Editing of this passage must take place within the bank.') : t('Editing of this stimulus must take place within the bank.');
97
+ var title = isPassage ? t('Banked Text Block.') : t('Banked Stimulus.');
98
+ var content = isPassage ? t('Editing of this text block must take place within the bank.') : t('Editing of this stimulus must take place within the bank.');
89
99
  var promptComponent = /*#__PURE__*/React.createElement(View, {
90
100
  as: "div",
91
101
  "data-automation": "sdk-editInBanks-warning"
@@ -220,14 +220,14 @@ export var ModerateTray = /*#__PURE__*/function (_Component) {
220
220
  as: "div",
221
221
  direction: "column",
222
222
  height: "100vh"
223
- }, this.renderTitleAndCloseButton(), this.props.atteqApplyChangesToCurrentQuizAttemptsEnabled && /*#__PURE__*/React.createElement(Flex.Item, {
223
+ }, this.renderTitleAndCloseButton(), this.props.atteqApplyChangesToCurrentQuizAttemptsEnabled && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Flex.Item, {
224
224
  padding: "medium medium 0 medium"
225
225
  }, this.renderNameWithTooltip()), /*#__PURE__*/React.createElement(Flex.Item, {
226
- padding: "medium"
227
- }, t('These settings apply to current and all future attempts.')), /*#__PURE__*/React.createElement(Flex.Item, {
226
+ padding: "medium medium 0"
227
+ }, t('These settings apply to current and all future attempts.'))), /*#__PURE__*/React.createElement(Flex.Item, {
228
228
  shouldGrow: true,
229
- padding: "0 medium"
230
- }, this.renderChildren()), this.props.atteqApplyChangesToCurrentQuizAttemptsEnabled && /*#__PURE__*/React.createElement(Flex.Item, null, this.renderFooter())));
229
+ padding: "medium medium 0"
230
+ }, this.renderChildren()), /*#__PURE__*/React.createElement(Flex.Item, null, this.renderFooter())));
231
231
  }
232
232
  }]);
233
233
  }(Component);
@@ -211,7 +211,7 @@ var __remainingQuestionPositions = function __remainingQuestionPositions(session
211
211
  var itemUserResponse = __getResponseForSessionItem(si, responses);
212
212
  return item.hasResponse(itemUserResponse);
213
213
  }).map(function (si) {
214
- return si.get('position');
214
+ return si.get('questionNumber');
215
215
  }).toSet().toJS();
216
216
  };
217
217
  export function showSubmitConfirmModal(quizSessionId) {
@@ -62,7 +62,10 @@ var AddBankEntryModal = exports.AddBankEntryModal = /*#__PURE__*/function (_Comp
62
62
  _this2.props.navigateToBankEntry('new', _this2.props.bankId);
63
63
  });
64
64
  (0, _defineProperty2["default"])(_this2, "addStimulus", function () {
65
- _this2.props.createBankItem(_this2.props.bankId, 'Stimulus');
65
+ var isPassage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
66
+ _this2.props.createBankItem(_this2.props.bankId, 'Stimulus', {
67
+ passage: isPassage
68
+ });
66
69
  _this2.closeAction();
67
70
  _this2.props.navigateToBankEntry('new', _this2.props.bankId);
68
71
  });
@@ -240,18 +240,69 @@ var BankEntry = exports.BankEntry = (_dec = (0, _quizCommon.withStyleOverrides)(
240
240
  value: function isTemporary() {
241
241
  return this.props.entry && this.props.entry.isTemporary();
242
242
  }
243
+ }, {
244
+ key: "getBankEntryTypeSlug",
245
+ value: function getBankEntryTypeSlug() {
246
+ return this.props.bankEntry.entryType;
247
+ }
248
+ }, {
249
+ key: "getEntry",
250
+ value: function getEntry() {
251
+ return this.props.entry;
252
+ }
243
253
  }, {
244
254
  key: "isItemEntry",
245
255
  value: function isItemEntry() {
246
256
  return this.props.bankEntry.entryType === 'Item';
247
257
  }
258
+ }, {
259
+ key: "isStimulusEntry",
260
+ value: function isStimulusEntry() {
261
+ var entry = this.getEntry();
262
+ if (!entry) return false;
263
+ return entry.isStimulus && !entry.isPassage;
264
+ }
265
+ }, {
266
+ key: "isPassageEntry",
267
+ value: function isPassageEntry() {
268
+ var entry = this.getEntry();
269
+ if (!entry) return false;
270
+ return entry.isStimulus && entry.isPassage;
271
+ }
272
+ }, {
273
+ key: "getEditWarning",
274
+ value: function getEditWarning() {
275
+ if (this.isStimulusEntry()) {
276
+ return (0, _formatMessage["default"])('Edits made here will appear on any assessment using this stimulus.');
277
+ }
278
+ if (this.isPassageEntry()) {
279
+ return (0, _formatMessage["default"])('Edits made here will appear on any assessment using this text block.');
280
+ }
281
+ return (0, _formatMessage["default"])('Edits made here will appear on any assessment using this question.');
282
+ }
248
283
  }, {
249
284
  key: "entryLinkName",
250
285
  value: function entryLinkName() {
251
- if (this.isTemporary()) {
252
- return this.isItemEntry() ? (0, _formatMessage["default"])('New Question') : (0, _formatMessage["default"])('New Stimulus');
253
- } else {
254
- return this.isItemEntry() ? (0, _formatMessage["default"])('Edit Question') : (0, _formatMessage["default"])('Edit Stimulus');
286
+ var translations = {
287
+ "new": {
288
+ question: (0, _formatMessage["default"])('New Question'),
289
+ stimulus: (0, _formatMessage["default"])('New Stimulus'),
290
+ passage: (0, _formatMessage["default"])('New Text Block')
291
+ },
292
+ edit: {
293
+ question: (0, _formatMessage["default"])('Edit Question'),
294
+ stimulus: (0, _formatMessage["default"])('Edit Stimulus'),
295
+ passage: (0, _formatMessage["default"])('Edit Text Block')
296
+ }
297
+ };
298
+ var operation = this.isTemporary() ? 'new' : 'edit';
299
+ switch (true) {
300
+ case this.isItemEntry():
301
+ return translations[operation]['question'];
302
+ case this.isStimulusEntry():
303
+ return translations[operation]['stimulus'];
304
+ case this.isPassageEntry():
305
+ return translations[operation]['passage'];
255
306
  }
256
307
  }
257
308
  }, {
@@ -304,19 +355,66 @@ var BankEntry = exports.BankEntry = (_dec = (0, _quizCommon.withStyleOverrides)(
304
355
  });
305
356
  }
306
357
  }
358
+ }, {
359
+ key: "getIdentifier",
360
+ value: function getIdentifier(entry) {
361
+ if (!entry) return;
362
+ switch (true) {
363
+ case this.isItemEntry():
364
+ return (0, _formatMessage["default"])('Question { id }', {
365
+ id: entry.id
366
+ });
367
+ case this.isStimulusEntry():
368
+ return (0, _formatMessage["default"])('Stimulus { id }', {
369
+ id: entry.id
370
+ });
371
+ case this.isPassageEntry():
372
+ return (0, _formatMessage["default"])('Text Block { id }', {
373
+ id: entry.id
374
+ });
375
+ default:
376
+ return;
377
+ }
378
+ }
379
+ }, {
380
+ key: "getTemporaryIdentifier",
381
+ value: function getTemporaryIdentifier() {
382
+ switch (true) {
383
+ case this.isItemEntry():
384
+ return (0, _formatMessage["default"])('New Question');
385
+ case this.isStimulusEntry():
386
+ return (0, _formatMessage["default"])('New Stimulus');
387
+ case this.isPassageEntry():
388
+ return (0, _formatMessage["default"])('New Text Block');
389
+ default:
390
+ return;
391
+ }
392
+ }
393
+ }, {
394
+ key: "getEntryName",
395
+ value: function getEntryName(entry) {
396
+ var _entry$getInteraction;
397
+ if (!entry) return;
398
+ switch (true) {
399
+ case this.isItemEntry():
400
+ return (_entry$getInteraction = entry.getInteractionType()) === null || _entry$getInteraction === void 0 ? void 0 : _entry$getInteraction.name;
401
+ case this.isStimulusEntry():
402
+ return (0, _formatMessage["default"])('Stimulus');
403
+ case this.isPassageEntry():
404
+ return (0, _formatMessage["default"])('Text Block');
405
+ default:
406
+ return;
407
+ }
408
+ }
307
409
  }, {
308
410
  key: "renderHeader",
309
411
  value: function renderHeader(entry) {
310
412
  if (!entry) return;
311
413
  var props = this.editProps(entry);
312
- var identifier = this.isItemEntry() ? (0, _formatMessage["default"])('Question { id }', {
313
- id: entry.id
314
- }) : (0, _formatMessage["default"])('Stimulus { id }', {
315
- id: entry.id
316
- });
317
- var tempIdentifier = this.isItemEntry() ? (0, _formatMessage["default"])('New Question') : (0, _formatMessage["default"])('New Stimulus');
414
+ var identifier = this.getIdentifier(entry);
415
+ var tempIdentifier = this.getTemporaryIdentifier();
318
416
  var itemIdentifier = this.isTemporary() ? tempIdentifier : identifier;
319
- var entryName = this.isItemEntry() ? entry.getInteractionType().name : (0, _formatMessage["default"])('Stimulus');
417
+ var entryName = this.getEntryName(entry);
320
418
  var separator = ' | ';
321
419
  return (0, _emotion.jsx)("div", {
322
420
  css: this.props.styles.header
@@ -550,7 +648,7 @@ var BankEntry = exports.BankEntry = (_dec = (0, _quizCommon.withStyleOverrides)(
550
648
  tags: _this3.visibleTags()
551
649
  });
552
650
  };
553
- var editWarning = this.isItemEntry() ? (0, _formatMessage["default"])('Edits made here will appear on any assessment using this question.') : (0, _formatMessage["default"])('Edits made here will appear on any assessment using this stimulus.');
651
+ var editWarning = this.getEditWarning();
554
652
  return (0, _emotion.jsx)("div", null, (0, _emotion.jsx)("div", {
555
653
  css: this.props.styles.entryEdit
556
654
  }, (0, _emotion.jsx)(_WarningWrapper["default"], versioningProps, canEdit && (0, _emotion.jsx)(_uiAlerts.Alert, {
@@ -67,7 +67,6 @@ var BankEntryRow = exports.BankEntryRow = (_dec = (0, _quizCommon.withStyleOverr
67
67
  _this2.props.setUi(_quizCommon.BUILD_TRAY_POSITION, _this2.props.position + 1);
68
68
  });
69
69
  (0, _defineProperty2["default"])(_this2, "deleteBankEntry", function () {
70
- var deletePreface = _this2.isItemEntry() ? (0, _formatMessage["default"])('Deleting this question:') : (0, _formatMessage["default"])('Deleting this stimulus:');
71
70
  var confirmBody = (0, _emotion.jsx)(_uiAlerts.Alert, {
72
71
  variant: "error",
73
72
  padding: "0"
@@ -75,7 +74,7 @@ var BankEntryRow = exports.BankEntryRow = (_dec = (0, _quizCommon.withStyleOverr
75
74
  css: _this2.props.styles.deleteAlert
76
75
  }, (0, _emotion.jsx)("div", {
77
76
  css: _this2.props.styles.deletePreface
78
- }, deletePreface), (0, _emotion.jsx)(_uiList.List, null, (0, _emotion.jsx)(_uiList.List.Item, null, _formatMessage["default"].rich('will <0>NOT</0> remove it from any assessments', [function (_ref) {
77
+ }, _this2.getDeletePreface()), (0, _emotion.jsx)(_uiList.List, null, (0, _emotion.jsx)(_uiList.List.Item, null, _formatMessage["default"].rich('will <0>NOT</0> remove it from any assessments', [function (_ref) {
79
78
  var children = _ref.children;
80
79
  return (0, _emotion.jsx)(_uiText.Text, {
81
80
  weight: "bold",
@@ -161,20 +160,60 @@ var BankEntryRow = exports.BankEntryRow = (_dec = (0, _quizCommon.withStyleOverr
161
160
  value: function isItemEntry() {
162
161
  return this.props.bankEntry.entryType === 'Item';
163
162
  }
163
+ }, {
164
+ key: "isStimulusEntry",
165
+ value: function isStimulusEntry() {
166
+ var entry = this.getEntry();
167
+ if (!entry) return false;
168
+ return entry.isStimulus && !entry.isPassage;
169
+ }
170
+ }, {
171
+ key: "isPassageEntry",
172
+ value: function isPassageEntry() {
173
+ var entry = this.getEntry();
174
+ if (!entry) return false;
175
+ return entry.isStimulus && entry.isPassage;
176
+ }
164
177
  }, {
165
178
  key: "type",
166
179
  value: function type() {
167
- return this.isItemEntry() ? (0, _formatMessage["default"])('Question') : (0, _formatMessage["default"])('Stimulus');
180
+ if (this.isStimulusEntry()) {
181
+ return (0, _formatMessage["default"])('Stimulus');
182
+ }
183
+ if (this.isPassageEntry()) {
184
+ return (0, _formatMessage["default"])('Text Block');
185
+ }
186
+ return (0, _formatMessage["default"])('Question');
168
187
  }
169
188
  }, {
170
189
  key: "entryIdentifier",
171
190
  value: function entryIdentifier() {
172
- return this.isItemEntry() ? (0, _formatMessage["default"])('Question { itemBody }', {
173
- itemBody: (0, _quizInteractions.extractTextFromHtml)(this.getEntry().title)
174
- }) : (0, _formatMessage["default"])('Stimulus { title }', {
175
- title: this.getEntry().title
191
+ var title = this.getEntry().title;
192
+ if (this.isStimulusEntry()) {
193
+ return (0, _formatMessage["default"])('Stimulus { title }', {
194
+ title: title
195
+ });
196
+ }
197
+ if (this.isPassageEntry()) {
198
+ return (0, _formatMessage["default"])('Text Block { title }', {
199
+ title: title
200
+ });
201
+ }
202
+ return (0, _formatMessage["default"])('Question { itemBody }', {
203
+ itemBody: (0, _quizInteractions.extractTextFromHtml)(title)
176
204
  });
177
205
  }
206
+ }, {
207
+ key: "getDeletePreface",
208
+ value: function getDeletePreface() {
209
+ if (this.isStimulusEntry()) {
210
+ return (0, _formatMessage["default"])('Deleting this stimulus:');
211
+ }
212
+ if (this.isPassageEntry()) {
213
+ return (0, _formatMessage["default"])('Deleting this text block:');
214
+ }
215
+ return (0, _formatMessage["default"])('Deleting this question:');
216
+ }
178
217
  }, {
179
218
  key: "moveModalTitle",
180
219
  value: function moveModalTitle() {
@@ -243,7 +282,12 @@ var BankEntryRow = exports.BankEntryRow = (_dec = (0, _quizCommon.withStyleOverr
243
282
  }, {
244
283
  key: "entryHeader",
245
284
  value: function entryHeader() {
246
- return this.isItemEntry() ? this.getEntry().getInteractionType().name : (0, _formatMessage["default"])('Stimulus');
285
+ var entry = this.getEntry();
286
+ if (this.isItemEntry()) {
287
+ return entry.getInteractionType().name;
288
+ } else {
289
+ return entry.isPassage ? (0, _formatMessage["default"])('Text Block') : (0, _formatMessage["default"])('Stimulus');
290
+ }
247
291
  }
248
292
  }, {
249
293
  key: "renderHeader",