@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
@@ -130,25 +130,17 @@ function _is_native_reflect_construct() {
130
130
  return !!result;
131
131
  })();
132
132
  }
133
- function _ts_decorate(decorators, target, key, desc) {
134
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
135
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
136
- 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;
137
- return c > 3 && r && Object.defineProperty(target, key, r), r;
138
- }
139
133
  import { Component } from 'react';
140
134
  import PropTypes from 'prop-types';
141
135
  import ImmutablePropTypes from 'react-immutable-proptypes';
142
136
  import partial from 'lodash/partial';
143
137
  import { DragSource } from 'react-dnd';
144
- import { IconAiColoredSolid, IconBankLine } from '@instructure/ui-icons';
145
138
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
146
139
  import { jsx } from '@instructure/emotion';
147
140
  import { FillBlankInteractionType } from '@instructure/quiz-interactions';
148
- import { TOP, withStyleOverrides } from '@instructure/quiz-common';
141
+ import { TOP, withStyleOverrides, Flex } from '@instructure/quiz-common';
149
142
  import t from '@instructure/quiz-i18n/format-message';
150
143
  import { convertFITBtoRich } from '../../../../../common/util/fitbCopyHelper';
151
- import Item from '../../../../../common/records/Item';
152
144
  import Overlay from '../../../../../common/components/shared/overlay';
153
145
  import ActionButtons from '../../ActionButtons';
154
146
  import { ItemTypes, dragSource, collectDrag } from '../../../../../common/components/shared/drag_and_drop/dragAndDropUtils';
@@ -156,15 +148,14 @@ import PositionBox from '../../../../../common/components/resources/positionBox/
156
148
  import DragAndDropZone from '../../../../../common/components/shared/drag_and_drop/DragAndDropZone';
157
149
  import generateStyle from './styles';
158
150
  import generateComponentTheme from './theme';
159
- import { Tooltip } from '@instructure/ui-tooltip';
160
- import { View } from '@instructure/ui-view';
161
- var QuizEntryShow = /*#__PURE__*/ function(Component) {
151
+ import { LeftHeader } from './components/LeftHeader';
152
+ var BaseQuizEntryShow = /*#__PURE__*/ function(Component) {
162
153
  "use strict";
163
- _inherits(QuizEntryShow, Component);
164
- function QuizEntryShow() {
165
- _class_call_check(this, QuizEntryShow);
154
+ _inherits(BaseQuizEntryShow, Component);
155
+ function BaseQuizEntryShow() {
156
+ _class_call_check(this, BaseQuizEntryShow);
166
157
  var _this;
167
- _this = _call_super(this, QuizEntryShow, arguments), _define_property(_this, "state", {
158
+ _this = _call_super(this, BaseQuizEntryShow, arguments), _define_property(_this, "state", {
168
159
  editAfterCall: null,
169
160
  copyAfterCall: null
170
161
  }), _define_property(_this, "editingOn", function() {
@@ -215,7 +206,7 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
215
206
  });
216
207
  return _this;
217
208
  }
218
- _create_class(QuizEntryShow, [
209
+ _create_class(BaseQuizEntryShow, [
219
210
  {
220
211
  key: "componentDidUpdate",
221
212
  value: function componentDidUpdate() {
@@ -266,14 +257,6 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
266
257
  return false;
267
258
  }
268
259
  },
269
- {
270
- key: "getPointsText",
271
- value: function getPointsText(points) {
272
- return t("{\n points, plural,\n one {# point}\n other {# points}\n }", {
273
- points: points
274
- });
275
- }
276
- },
277
260
  {
278
261
  key: "removalDialogData",
279
262
  value: function removalDialogData() {
@@ -291,71 +274,6 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
291
274
  return this.props.quizEntries.size === 1;
292
275
  }
293
276
  },
294
- {
295
- key: "renderPointsPossible",
296
- value: function renderPointsPossible() {
297
- if (_instanceof(this.props.entry, Item)) {
298
- var pointsPossible = this.props.quizEntry.pointsPossible;
299
- return /*#__PURE__*/ jsx("div", {
300
- className: "points",
301
- css: this.props.styles.points,
302
- "data-automation": "sdk-points-possible-div"
303
- }, this.getPointsText(pointsPossible || 0));
304
- }
305
- }
306
- },
307
- {
308
- key: "renderInteractionType",
309
- value: function renderInteractionType() {
310
- if (_instanceof(this.props.entry, Item)) {
311
- var interactionTypeName = this.props.entry.getInteractionType().name || this.props.interactionTypeName;
312
- return /*#__PURE__*/ jsx("div", {
313
- css: this.props.styles.interactionTypeName,
314
- "data-automation": "sdk-interaction-type-name-div"
315
- }, interactionTypeName);
316
- }
317
- }
318
- },
319
- {
320
- key: "renderBankedContent",
321
- value: function renderBankedContent() {
322
- if (this.props.quizEntry.isBank || this.props.quizEntry.isBankEntry) {
323
- return /*#__PURE__*/ jsx(IconBankLine, null);
324
- }
325
- }
326
- },
327
- {
328
- key: "renderAiGeneratedContent",
329
- value: function renderAiGeneratedContent() {
330
- if (!this.props.quizEntry.isAiGenerated) {
331
- return null;
332
- }
333
- return /*#__PURE__*/ jsx(View, {
334
- stacking: "topmost"
335
- }, /*#__PURE__*/ jsx(Tooltip, {
336
- renderTip: t('This question was generated using AI'),
337
- placement: "top center",
338
- on: [
339
- 'hover',
340
- 'focus'
341
- ]
342
- }, /*#__PURE__*/ jsx(IconAiColoredSolid, {
343
- color: "primary",
344
- "aria-label": t('This question was generated using AI')
345
- })));
346
- }
347
- },
348
- {
349
- key: "renderLeftHeader",
350
- value: function renderLeftHeader() {
351
- return /*#__PURE__*/ jsx("div", {
352
- css: this.props.styles.leftHeader
353
- }, this.renderBankedContent(), this.renderAiGeneratedContent(), this.renderInteractionType(), this.renderPointsPossible(), /*#__PURE__*/ jsx("div", {
354
- css: this.props.styles.title,
355
- "data-automation": "sdk-quiz-entry-title-div"
356
- }, this.props.entry.title));
357
- }
358
- },
359
277
  {
360
278
  key: "setInert",
361
279
  value: function setInert(node) {
@@ -365,7 +283,7 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
365
283
  {
366
284
  key: "render",
367
285
  value: function render() {
368
- var _this_props = this.props, connectDragPreview = _this_props.connectDragPreview, displayPosition = _this_props.displayPosition, draggingOver = _this_props.draggingOver, draggingAboveHalf = _this_props.draggingAboveHalf, quizEntry = _this_props.quizEntry, stimulusOrientation = _this_props.stimulusOrientation, isContentLockedByBlueprint = _this_props.isContentLockedByBlueprint, lockBlueprintContentEnabled = _this_props.lockBlueprintContentEnabled;
286
+ var _this_props = this.props, connectDragPreview = _this_props.connectDragPreview, displayPosition = _this_props.displayPosition, draggingOver = _this_props.draggingOver, draggingAboveHalf = _this_props.draggingAboveHalf, quizEntry = _this_props.quizEntry, stimulusOrientation = _this_props.stimulusOrientation, isContentLockedByBlueprint = _this_props.isContentLockedByBlueprint, lockBlueprintContentEnabled = _this_props.lockBlueprintContentEnabled, interactionTypeName = _this_props.interactionTypeName, entry = _this_props.entry, isSurvey = _this_props.isSurvey;
369
287
  var positionToDisplay = this.props.quizEntry.positionToDisplay(displayPosition);
370
288
  var positionText = t('Preview of question at position {position}', {
371
289
  position: positionToDisplay
@@ -398,7 +316,16 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
398
316
  position: positionToDisplay,
399
317
  headingText: positionText,
400
318
  headingLevel: quizEntry.isInStimulus ? 'h3' : 'h2'
401
- }), this.renderLeftHeader(), /*#__PURE__*/ jsx(ActionButtons, {
319
+ }), /*#__PURE__*/ jsx(Flex.Item, {
320
+ shouldGrow: true,
321
+ overflowX: "hidden",
322
+ overflowY: "hidden"
323
+ }, /*#__PURE__*/ jsx(LeftHeader, {
324
+ quizEntry: quizEntry,
325
+ entry: entry,
326
+ interactionTypeName: interactionTypeName,
327
+ isSurvey: isSurvey
328
+ })), /*#__PURE__*/ jsx(ActionButtons, {
402
329
  connectDragSource: this.props.connectDragSource,
403
330
  displayPosition: this.props.displayPosition,
404
331
  onDelete: this.removeItem,
@@ -422,11 +349,11 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
422
349
  }
423
350
  }
424
351
  ]);
425
- return QuizEntryShow;
352
+ return BaseQuizEntryShow;
426
353
  }(Component);
427
- _define_property(QuizEntryShow, "displayName", 'QuizEntryShow');
428
- _define_property(QuizEntryShow, "componentId", "Quizzes".concat(QuizEntryShow.displayName));
429
- _define_property(QuizEntryShow, "propTypes", {
354
+ _define_property(BaseQuizEntryShow, "displayName", 'QuizEntryShow');
355
+ _define_property(BaseQuizEntryShow, "componentId", "Quizzes".concat(BaseQuizEntryShow.displayName));
356
+ _define_property(BaseQuizEntryShow, "propTypes", {
430
357
  children: PropTypes.oneOfType([
431
358
  PropTypes.arrayOf(PropTypes.node),
432
359
  PropTypes.node
@@ -461,9 +388,10 @@ _define_property(QuizEntryShow, "propTypes", {
461
388
  switchOnEditing: PropTypes.func.isRequired,
462
389
  updateItemCallStatus: PropTypes.string.isRequired,
463
390
  withConfirm: PropTypes.func.isRequired,
464
- styles: PropTypes.object
391
+ styles: PropTypes.object,
392
+ isSurvey: PropTypes.bool
465
393
  });
466
- _define_property(QuizEntryShow, "defaultProps", {
394
+ _define_property(BaseQuizEntryShow, "defaultProps", {
467
395
  children: null,
468
396
  draggingOver: false,
469
397
  draggingAboveHalf: false,
@@ -478,9 +406,6 @@ _define_property(QuizEntryShow, "defaultProps", {
478
406
  richFITBInteractionID: '',
479
407
  stimulusOrientation: null
480
408
  });
481
- QuizEntryShow = _ts_decorate([
482
- withStyleOverrides(generateStyle, generateComponentTheme)
483
- ], QuizEntryShow);
484
- export var QuizEntryShowRaw = QuizEntryShow;
409
+ export var QuizEntryShow = withStyleOverrides(generateStyle, generateComponentTheme)(BaseQuizEntryShow);
485
410
  export var QuizEntryShowPresenter = DragSource(ItemTypes.QUIZ_ENTRY, dragSource, collectDrag)(QuizEntryShow);
486
411
  export default QuizEntryShowPresenter;
@@ -52,15 +52,6 @@ function _object_spread_props(target, source) {
52
52
  }
53
53
  var generateStyle = function(componentTheme) {
54
54
  var mp = '@media print';
55
- var interactionTypeStyles = {
56
- color: componentTheme.titleInteractionTypeNamePointsColor,
57
- fontSize: componentTheme.titleInteractionTypeNamePointsFontSize,
58
- marginLeft: componentTheme.titleInteractionTypeNamePointsLeftMargin,
59
- marginRight: componentTheme.titleInteractionTypeNamePointsRightMargin,
60
- textOverflow: 'ellipsis',
61
- overflow: 'hidden',
62
- whiteSpace: 'nowrap'
63
- };
64
55
  var optionsButtonDragDropStyle = {
65
56
  backgroundColor: 'transparent',
66
57
  border: 'none',
@@ -116,9 +107,6 @@ var generateStyle = function(componentTheme) {
116
107
  backgroundColor: 'initial'
117
108
  }
118
109
  },
119
- title: interactionTypeStyles,
120
- interactionTypeName: interactionTypeStyles,
121
- points: interactionTypeStyles,
122
110
  itemHolder: {
123
111
  overflowWrap: 'anywhere',
124
112
  margin: componentTheme.itemHolderMargin
@@ -11,7 +11,8 @@ export function withConfirm(onContinue) {
11
11
  continueVariant: void 0,
12
12
  cancelText: void 0,
13
13
  size: void 0,
14
- shouldReturnFocus: true
14
+ shouldReturnFocus: true,
15
+ submitButtonDisabled: false
15
16
  };
16
17
  var modalOptions = Object.assign({}, defaultConfirmOptions, opts);
17
18
  return {
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
2
2
  import { connect } from '../../react-redux';
3
3
  import { bool, node, func } from 'prop-types';
4
4
  import { getFeatures } from '../../api/features';
5
- import { QuizzesSpinner as Spinner } from '../shared/spinner/Spinner';
5
+ import { Spinner } from '../shared/spinner/Spinner';
6
6
  import { Card } from '../shared/Card';
7
7
  export var ApiFeatureFlagInitializerComponent = function(props) {
8
8
  useEffect(function() {
@@ -30,7 +30,7 @@ import { bindActionCreators } from 'redux';
30
30
  import { Map } from 'immutable';
31
31
  import { connect } from '../../react-redux';
32
32
  import { closeModal } from '../../actions/modal';
33
- import ConfirmationModal from './presenter';
33
+ import { ConfirmationModal } from './presenter';
34
34
  var mapStateToProps = function(state) {
35
35
  var modal = state.get('modal');
36
36
  return _object_spread({
@@ -1,165 +1,57 @@
1
- function _assert_this_initialized(self) {
2
- if (self === void 0) {
3
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4
- }
5
- return self;
6
- }
7
- function _call_super(_this, derived, args) {
8
- derived = _get_prototype_of(derived);
9
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
10
- }
11
- function _class_call_check(instance, Constructor) {
12
- if (!(instance instanceof Constructor)) {
13
- throw new TypeError("Cannot call a class as a function");
14
- }
15
- }
16
- function _defineProperties(target, props) {
17
- for(var i = 0; i < props.length; i++){
18
- var descriptor = props[i];
19
- descriptor.enumerable = descriptor.enumerable || false;
20
- descriptor.configurable = true;
21
- if ("value" in descriptor) descriptor.writable = true;
22
- Object.defineProperty(target, descriptor.key, descriptor);
23
- }
24
- }
25
- function _create_class(Constructor, protoProps, staticProps) {
26
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27
- if (staticProps) _defineProperties(Constructor, staticProps);
28
- return Constructor;
29
- }
30
- function _define_property(obj, key, value) {
31
- if (key in obj) {
32
- Object.defineProperty(obj, key, {
33
- value: value,
34
- enumerable: true,
35
- configurable: true,
36
- writable: true
37
- });
38
- } else {
39
- obj[key] = value;
40
- }
41
- return obj;
42
- }
43
- function _get_prototype_of(o) {
44
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
45
- return o.__proto__ || Object.getPrototypeOf(o);
46
- };
47
- return _get_prototype_of(o);
48
- }
49
- function _inherits(subClass, superClass) {
50
- if (typeof superClass !== "function" && superClass !== null) {
51
- throw new TypeError("Super expression must either be null or a function");
52
- }
53
- subClass.prototype = Object.create(superClass && superClass.prototype, {
54
- constructor: {
55
- value: subClass,
56
- writable: true,
57
- configurable: true
58
- }
59
- });
60
- if (superClass) _set_prototype_of(subClass, superClass);
61
- }
62
- function _possible_constructor_return(self, call) {
63
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
64
- return call;
65
- }
66
- return _assert_this_initialized(self);
67
- }
68
- function _set_prototype_of(o, p) {
69
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
70
- o.__proto__ = p;
71
- return o;
72
- };
73
- return _set_prototype_of(o, p);
74
- }
75
- function _type_of(obj) {
76
- "@swc/helpers - typeof";
77
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
78
- }
79
- function _is_native_reflect_construct() {
80
- try {
81
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
82
- } catch (_) {}
83
- return (_is_native_reflect_construct = function() {
84
- return !!result;
85
- })();
86
- }
87
- import React, { Component } from 'react';
1
+ import React, { useCallback } from 'react';
88
2
  import PropTypes from 'prop-types';
89
3
  import { Button, CloseButton } from '@instructure/ui-buttons';
90
4
  import { Text } from '@instructure/ui-text';
91
5
  import { Heading } from '@instructure/ui-heading';
92
6
  import t from '@instructure/quiz-i18n/format-message';
93
7
  import { ImportantModal, ModalHeader, ModalBody, ModalFooter, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
94
- export var ConfirmationModal = /*#__PURE__*/ function(Component) {
95
- "use strict";
96
- _inherits(ConfirmationModal, Component);
97
- function ConfirmationModal() {
98
- _class_call_check(this, ConfirmationModal);
99
- var _this;
100
- _this = _call_super(this, ConfirmationModal, arguments), _define_property(_this, "state", {
101
- action: null
102
- }), _define_property(_this, "continueAction", function() {
103
- _this.setState({
104
- action: 'continue'
105
- }, _this.props.closeModal);
106
- }), _define_property(_this, "cancelAction", function() {
107
- _this.setState({
108
- action: 'cancel'
109
- }, _this.props.closeModal);
110
- }), _define_property(_this, "doAction", function() {
111
- var _this_props = _this.props, onContinue = _this_props.onContinue, onCancel = _this_props.onCancel;
112
- if (_this.state.action === 'continue') {
113
- onContinue && onContinue();
114
- } else if (_this.state.action === 'cancel') {
115
- onCancel && onCancel();
116
- }
117
- _this.setState({
118
- action: null
119
- });
120
- });
121
- return _this;
122
- }
123
- _create_class(ConfirmationModal, [
124
- {
125
- key: "render",
126
- value: function render() {
127
- var _this_props = this.props, title = _this_props.title, text = _this_props.text, cancelText = _this_props.cancelText, continueText = _this_props.continueText, size = _this_props.size, shouldReturnFocus = _this_props.shouldReturnFocus, continueVariant = _this_props.continueVariant, automationPrefix = _this_props.automationPrefix;
128
- return /*#__PURE__*/ React.createElement(ImportantModal, {
129
- open: this.props.modalOpen,
130
- size: size || 'small',
131
- label: title || t('Confirm'),
132
- onDismiss: this.cancelAction,
133
- "data-automation": automationPrefix ? "sdk-".concat(automationPrefix, "-confirmation-modal") : 'sdk-confirmation-modal',
134
- shouldReturnFocus: shouldReturnFocus,
135
- onClose: this.doAction
136
- }, /*#__PURE__*/ React.createElement(ModalHeader, null, /*#__PURE__*/ React.createElement(Heading, {
137
- level: "reset",
138
- as: "h2",
139
- "data-automation": automationPrefix ? "sdk-".concat(automationPrefix, "-confirmation-modal-heading") : 'sdk-confirmation-modal-heading'
140
- }, title || t('Confirm')), /*#__PURE__*/ React.createElement(CloseButton, {
141
- onClick: this.cancelAction,
142
- placement: "end",
143
- offset: "medium",
144
- screenReaderLabel: t('Close')
145
- })), /*#__PURE__*/ React.createElement(ModalBody, null, /*#__PURE__*/ React.createElement(Text, {
146
- color: "primary"
147
- }, text || t('Are you sure?'))), /*#__PURE__*/ React.createElement(ModalFooter, null, /*#__PURE__*/ React.createElement(Button, {
148
- onClick: this.cancelAction,
149
- margin: XSMALL_SIDE_MARGIN,
150
- "data-automation": automationPrefix ? "sdk-".concat(automationPrefix, "-confirmation-modal-cancel") : 'sdk-confirmation-modal-cancel'
151
- }, cancelText || t('Cancel')), /*#__PURE__*/ React.createElement(Button, {
152
- color: continueVariant || 'primary',
153
- onClick: this.continueAction,
154
- margin: XSMALL_SIDE_MARGIN,
155
- "data-automation": automationPrefix ? "sdk-".concat(automationPrefix, "-confirmation-modal-confirm") : 'sdk-confirmation-modal-confirm'
156
- }, continueText || t('Confirm'))));
157
- }
158
- }
8
+ export function ConfirmationModal(param) {
9
+ var closeModal = param.closeModal, modalOpen = param.modalOpen, title = param.title, text = param.text, cancelText = param.cancelText, continueText = param.continueText, continueVariant = param.continueVariant, size = param.size, _param_shouldReturnFocus = param.shouldReturnFocus, shouldReturnFocus = _param_shouldReturnFocus === void 0 ? true : _param_shouldReturnFocus, submitButtonDisabled = param.submitButtonDisabled, onContinue = param.onContinue, onCancel = param.onCancel, automationPrefix = param.automationPrefix;
10
+ var continueAction = useCallback(function() {
11
+ onContinue && onContinue();
12
+ closeModal();
13
+ }, [
14
+ onContinue,
15
+ closeModal
16
+ ]);
17
+ var cancelAction = useCallback(function() {
18
+ onCancel && onCancel();
19
+ closeModal();
20
+ }, [
21
+ onCancel,
22
+ closeModal
159
23
  ]);
160
- return ConfirmationModal;
161
- }(Component);
162
- _define_property(ConfirmationModal, "propTypes", {
24
+ return /*#__PURE__*/ React.createElement(ImportantModal, {
25
+ open: modalOpen,
26
+ size: size || 'small',
27
+ label: title || t('Confirm'),
28
+ onDismiss: cancelAction,
29
+ "data-automation": automationPrefix ? "sdk-".concat(automationPrefix, "-confirmation-modal") : 'sdk-confirmation-modal',
30
+ shouldReturnFocus: shouldReturnFocus
31
+ }, /*#__PURE__*/ React.createElement(ModalHeader, null, /*#__PURE__*/ React.createElement(Heading, {
32
+ level: "reset",
33
+ as: "h2",
34
+ "data-automation": automationPrefix ? "sdk-".concat(automationPrefix, "-confirmation-modal-heading") : 'sdk-confirmation-modal-heading'
35
+ }, title || t('Confirm')), /*#__PURE__*/ React.createElement(CloseButton, {
36
+ onClick: cancelAction,
37
+ placement: "end",
38
+ offset: "medium",
39
+ screenReaderLabel: t('Close')
40
+ })), /*#__PURE__*/ React.createElement(ModalBody, null, /*#__PURE__*/ React.createElement(Text, {
41
+ color: "primary"
42
+ }, text || t('Are you sure?'))), /*#__PURE__*/ React.createElement(ModalFooter, null, /*#__PURE__*/ React.createElement(Button, {
43
+ onClick: cancelAction,
44
+ margin: XSMALL_SIDE_MARGIN,
45
+ "data-automation": automationPrefix ? "sdk-".concat(automationPrefix, "-confirmation-modal-cancel") : 'sdk-confirmation-modal-cancel'
46
+ }, cancelText || t('Cancel')), /*#__PURE__*/ React.createElement(Button, {
47
+ color: continueVariant || 'primary',
48
+ disabled: submitButtonDisabled,
49
+ onClick: continueAction,
50
+ margin: XSMALL_SIDE_MARGIN,
51
+ "data-automation": automationPrefix ? "sdk-".concat(automationPrefix, "-confirmation-modal-confirm") : 'sdk-confirmation-modal-confirm'
52
+ }, continueText || t('Confirm'))));
53
+ }
54
+ ConfirmationModal.propTypes = {
163
55
  closeModal: PropTypes.func.isRequired,
164
56
  modalOpen: PropTypes.bool.isRequired,
165
57
  title: PropTypes.string,
@@ -172,20 +64,8 @@ _define_property(ConfirmationModal, "propTypes", {
172
64
  continueVariant: PropTypes.string,
173
65
  size: PropTypes.string,
174
66
  shouldReturnFocus: PropTypes.bool,
67
+ submitButtonDisabled: PropTypes.bool,
175
68
  onContinue: PropTypes.func,
176
69
  onCancel: PropTypes.func,
177
70
  automationPrefix: PropTypes.string
178
- });
179
- _define_property(ConfirmationModal, "defaultProps", {
180
- title: null,
181
- text: null,
182
- cancelText: null,
183
- continueText: null,
184
- continueVariant: null,
185
- size: null,
186
- shouldReturnFocus: true,
187
- onContinue: null,
188
- onCancel: null,
189
- automationPrefix: null
190
- });
191
- export default ConfirmationModal;
71
+ };
@@ -219,7 +219,7 @@ function _ts_generator(thisArg, body) {
219
219
  import React, { useEffect, useState } from 'react';
220
220
  import ImmutablePropTypes from 'react-immutable-proptypes';
221
221
  import PropTypes from 'prop-types';
222
- import { QuizzesSpinner as Spinner } from '../shared/spinner/Spinner';
222
+ import { Spinner } from '../shared/spinner/Spinner';
223
223
  import { Card } from '../shared/Card';
224
224
  import { RceConfigContext } from '@instructure/quiz-common';
225
225
  import { hasAllPropsForRcs } from './rceConfigUtils';
@@ -97,7 +97,7 @@ import { DragDropContext } from 'react-dnd';
97
97
  import { jsx } from '@instructure/emotion';
98
98
  import { ApplyLocale } from '@instructure/ui-i18n';
99
99
  import { Provider } from '../../react-redux';
100
- import store from '../../../reduxStore';
100
+ import store, { setAppDispatch } from '../../../reduxStore';
101
101
  import { getLocale, withStyleOverrides } from '@instructure/quiz-common';
102
102
  import { set } from '../../actions/ui';
103
103
  import { addAlert } from '../../actions/alerts';
@@ -112,13 +112,14 @@ import ConfirmationModal from '../ConfirmationModal';
112
112
  import { setupFormatMessage } from '@instructure/quiz-i18n';
113
113
  import RceConfigProvider from '../RceConfigProvider';
114
114
  import { ApiFeatureFlagInitializer } from '../ApiFeatureFlagInitializer';
115
- export var SDKApp = /*#__PURE__*/ function(Component) {
115
+ var UndecoratedSDKApp = /*#__PURE__*/ function(Component) {
116
116
  "use strict";
117
- _inherits(SDKApp, Component);
118
- function SDKApp(props) {
119
- _class_call_check(this, SDKApp);
117
+ _inherits(UndecoratedSDKApp, Component);
118
+ function UndecoratedSDKApp(props) {
119
+ _class_call_check(this, UndecoratedSDKApp);
120
120
  var _this;
121
- _this = _call_super(this, SDKApp, [
121
+ var _this_props_rceConfig;
122
+ _this = _call_super(this, UndecoratedSDKApp, [
122
123
  props
123
124
  ]), _define_property(_this, "addAlert", function(opts) {
124
125
  _this.store.dispatch(addAlert(opts));
@@ -126,11 +127,30 @@ export var SDKApp = /*#__PURE__*/ function(Component) {
126
127
  // TODO: move to something like this down the line
127
128
  // so we dont implicitly share state
128
129
  // this.store = this.configureStore()
130
+ setAppDispatch(props.appDispatch);
129
131
  _this.store = store;
130
132
  _this.setLocale();
133
+ // Initialize Redux store with props BEFORE render to prevent race conditions
134
+ // where child components make API calls before the token is set
135
+ _this.store.dispatch([
136
+ setAPIEndpoint(_this.props.apiEndpoint),
137
+ setCanvasOrigin((_this_props_rceConfig = _this.props.rceConfig) === null || _this_props_rceConfig === void 0 ? void 0 : _this_props_rceConfig.canvasOrigin),
138
+ _this.setAppContainer(_this.props.appContainer),
139
+ setUserToken(_this.props.userToken),
140
+ setOutcomesEndpoint(_this.props.outcomesEndpoint),
141
+ setOutcomesToken(_this.props.outcomesToken),
142
+ setContextUuid(_this.props.contextUuid),
143
+ setExternalAccountUuid(_this.props.externalAccountUuid)
144
+ ]);
145
+ if (_this.props.itemBankSharingEnabled) {
146
+ _this.store.dispatch(addFeatures('item_bank_sharing'));
147
+ }
148
+ if (_this.props.gradeByQuestionEnabled !== null) {
149
+ _this.store.dispatch(setGradeByQuestionEnabled(_this.props.gradeByQuestionEnabled));
150
+ }
131
151
  return _this;
132
152
  }
133
- _create_class(SDKApp, [
153
+ _create_class(UndecoratedSDKApp, [
134
154
  {
135
155
  key: "setLocale",
136
156
  value: function setLocale() {
@@ -151,28 +171,6 @@ export var SDKApp = /*#__PURE__*/ function(Component) {
151
171
  return set('appContainer', selectors);
152
172
  }
153
173
  },
154
- {
155
- key: "UNSAFE_componentWillMount",
156
- value: function UNSAFE_componentWillMount() {
157
- var _this_props_rceConfig;
158
- this.store.dispatch([
159
- setAPIEndpoint(this.props.apiEndpoint),
160
- setCanvasOrigin((_this_props_rceConfig = this.props.rceConfig) === null || _this_props_rceConfig === void 0 ? void 0 : _this_props_rceConfig.canvasOrigin),
161
- this.setAppContainer(this.props.appContainer),
162
- setUserToken(this.props.userToken),
163
- setOutcomesEndpoint(this.props.outcomesEndpoint),
164
- setOutcomesToken(this.props.outcomesToken),
165
- setContextUuid(this.props.contextUuid),
166
- setExternalAccountUuid(this.props.externalAccountUuid)
167
- ]);
168
- if (this.props.itemBankSharingEnabled) {
169
- this.store.dispatch(addFeatures('item_bank_sharing'));
170
- }
171
- if (this.props.gradeByQuestionEnabled !== null) {
172
- this.store.dispatch(setGradeByQuestionEnabled(this.props.gradeByQuestionEnabled));
173
- }
174
- }
175
- },
176
174
  {
177
175
  key: "componentDidMount",
178
176
  value: function componentDidMount() {
@@ -236,11 +234,11 @@ export var SDKApp = /*#__PURE__*/ function(Component) {
236
234
  }
237
235
  }
238
236
  ]);
239
- return SDKApp;
237
+ return UndecoratedSDKApp;
240
238
  }(Component);
241
- _define_property(SDKApp, "displayName", 'SDKApp');
242
- _define_property(SDKApp, "componentId", "Quizzes".concat(SDKApp.displayName));
243
- _define_property(SDKApp, "propTypes", {
239
+ _define_property(UndecoratedSDKApp, "displayName", 'SDKApp');
240
+ _define_property(UndecoratedSDKApp, "componentId", "Quizzes".concat(UndecoratedSDKApp.displayName));
241
+ _define_property(UndecoratedSDKApp, "propTypes", {
244
242
  apiEndpoint: PropTypes.string.isRequired,
245
243
  appContainer: CustomPropTypes.selectors.isRequired,
246
244
  children: PropTypes.oneOfType([
@@ -272,12 +270,13 @@ _define_property(SDKApp, "propTypes", {
272
270
  })),
273
271
  userToken: PropTypes.string.isRequired,
274
272
  disableAlertLiveRegion: PropTypes.bool,
273
+ appDispatch: PropTypes.func.isRequired,
275
274
  styles: PropTypes.object
276
275
  });
277
- _define_property(SDKApp, "contextTypes", {
276
+ _define_property(UndecoratedSDKApp, "contextTypes", {
278
277
  locale: PropTypes.string
279
278
  });
280
- _define_property(SDKApp, "defaultProps", {
279
+ _define_property(UndecoratedSDKApp, "defaultProps", {
281
280
  contextUuid: '',
282
281
  externalAccountUuid: '',
283
282
  gradeByQuestionEnabled: null,
@@ -290,8 +289,8 @@ _define_property(SDKApp, "defaultProps", {
290
289
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
291
290
  disableAlertLiveRegion: false
292
291
  });
293
- SDKApp = _ts_decorate([
292
+ UndecoratedSDKApp = _ts_decorate([
294
293
  withStyleOverrides(generateStyle, null)
295
- ], SDKApp);
296
- export var DragDroppableSDKApp = DragDropContext(HTML5Backend)(SDKApp);
297
- export default DragDroppableSDKApp;
294
+ ], UndecoratedSDKApp);
295
+ export var SDKApp = DragDropContext(HTML5Backend)(UndecoratedSDKApp);
296
+ export default SDKApp;