@instructure/quiz-core 22.5.1-rc.0 → 22.5.1-rc.3

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.
@@ -251,16 +251,14 @@ export var BankEntry = (_dec = withStyleOverrides(generateStyle, generateCompone
251
251
  }, {
252
252
  key: "isStimulusEntry",
253
253
  value: function isStimulusEntry() {
254
- var entry = this.getEntry();
255
- if (!entry) return false;
256
- return entry.isStimulus && !entry.isPassage;
254
+ var _this$props$bankEntry;
255
+ return (_this$props$bankEntry = this.props.bankEntry) === null || _this$props$bankEntry === void 0 ? void 0 : _this$props$bankEntry.isStimulusEntry;
257
256
  }
258
257
  }, {
259
258
  key: "isPassageEntry",
260
259
  value: function isPassageEntry() {
261
- var entry = this.getEntry();
262
- if (!entry) return false;
263
- return entry.isStimulus && entry.isPassage;
260
+ var _this$props$bankEntry2;
261
+ return (_this$props$bankEntry2 = this.props.bankEntry) === null || _this$props$bankEntry2 === void 0 ? void 0 : _this$props$bankEntry2.isPassageEntry;
264
262
  }
265
263
  }, {
266
264
  key: "getEditWarning",
@@ -154,16 +154,14 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
154
154
  }, {
155
155
  key: "isStimulusEntry",
156
156
  value: function isStimulusEntry() {
157
- var entry = this.getEntry();
158
- if (!entry) return false;
159
- return entry.isStimulus && !entry.isPassage;
157
+ var _this$props$bankEntry;
158
+ return (_this$props$bankEntry = this.props.bankEntry) === null || _this$props$bankEntry === void 0 ? void 0 : _this$props$bankEntry.isStimulusEntry;
160
159
  }
161
160
  }, {
162
161
  key: "isPassageEntry",
163
162
  value: function isPassageEntry() {
164
- var entry = this.getEntry();
165
- if (!entry) return false;
166
- return entry.isStimulus && entry.isPassage;
163
+ var _this$props$bankEntry2;
164
+ return (_this$props$bankEntry2 = this.props.bankEntry) === null || _this$props$bankEntry2 === void 0 ? void 0 : _this$props$bankEntry2.isPassageEntry;
167
165
  }
168
166
  }, {
169
167
  key: "type",
@@ -166,6 +166,7 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
166
166
  var automationPrefix = stimulus.passage ? 'text-block' : 'stimulus';
167
167
  var message = stimulus.passage ? t('Edit Text Block') : t('Edit Stimulus');
168
168
  return jsx(FormFieldGroup, {
169
+ "data-automation": "stimulus-edit-info",
169
170
  messages: this.inputErrors('onSelf'),
170
171
  description: jsx(ScreenReaderContent, null, message)
171
172
  }, jsx(Heading, {
@@ -77,6 +77,20 @@ export var BankEntry = /*#__PURE__*/function (_ReduxRecord) {
77
77
  if (!this.isStimulus) return false;
78
78
  return (_this$getEntry2 = this.getEntry()) === null || _this$getEntry2 === void 0 ? void 0 : _this$getEntry2.isPassage;
79
79
  }
80
+ }, {
81
+ key: "isStimulusEntry",
82
+ get: function get() {
83
+ var entry = this.getEntry();
84
+ if (!entry) return false;
85
+ return entry.isStimulus && !entry.isPassage;
86
+ }
87
+ }, {
88
+ key: "isPassageEntry",
89
+ get: function get() {
90
+ var entry = this.getEntry();
91
+ if (!entry) return false;
92
+ return entry.isStimulus && entry.isPassage;
93
+ }
80
94
  }]);
81
95
  }(ReduxRecord({
82
96
  id: '0',
@@ -207,6 +207,7 @@ export var QuizSession = /*#__PURE__*/function (_ReduxRecord) {
207
207
  user: Map(),
208
208
  // Good candidate for another Record - Still relevant?
209
209
  bolaSessionItemsCount: null,
210
- buildOnLastAttempt: null
210
+ buildOnLastAttempt: null,
211
+ multipleSessionAttempt: false
211
212
  }));
212
213
  export default QuizSession;
@@ -48,13 +48,8 @@ export var propsForStimulusVersioningWrapper = function propsForStimulusVersioni
48
48
  }
49
49
  var isPassage = args[args.length - 1];
50
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
- });
51
+ var title = isPassage ? t('Some students have already submitted answers for this text block!') : t('Some students have already submitted answers for this stimulus!');
52
+ var content = isPassage ? t('You can apply your edits to a copy of this text block' + ' which will only be seen by students that have not taken the assessment.' + ' Attached questions will be copied as well.') : 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.');
58
53
  return propsForVersioningWrapper.apply(void 0, [/*#__PURE__*/React.createElement(Text, {
59
54
  color: "primary"
60
55
  }, /*#__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, {
@@ -21,7 +21,7 @@ function _callSuper(_this, derived, args) {
21
21
  }
22
22
  /** @jsx jsx */
23
23
  /* eslint "array-callback-return": "warn" */
24
- import { Component } from 'react';
24
+ import React, { Component } from 'react';
25
25
  import PropTypes from 'prop-types';
26
26
  import ImmutablePropTypes from 'react-immutable-proptypes';
27
27
  import { AccessibleContent, PresentationContent } from '@instructure/ui-a11y-content';
@@ -31,7 +31,7 @@ import { Link } from '@instructure/ui-link';
31
31
  import { Avatar } from '@instructure/ui-avatar';
32
32
  import { View } from '@instructure/ui-view';
33
33
  import { Table } from '@instructure/ui-table';
34
- import { IconEditLine, IconWarningLine } from '@instructure/ui-icons';
34
+ import { IconEditLine, IconWarningLine, IconWarningSolid } from '@instructure/ui-icons';
35
35
  import { IconButton } from '@instructure/ui-buttons';
36
36
  import { jsx } from '@instructure/emotion';
37
37
  import t from '@instructure/quiz-i18n/es/format-message';
@@ -39,6 +39,7 @@ import { withI18nSupport, withStyleOverrides } from '@instructure/quiz-common';
39
39
  import FormattedDuration from '../../../../common/components/shared/FormattedDuration';
40
40
  import generateStyle from './styles';
41
41
  import generateComponentTheme from './theme';
42
+ import { Tooltip } from '@instructure/ui-tooltip';
42
43
  var DASHES = '---';
43
44
  export var ModerateTableRow = (_dec = withStyleOverrides(generateStyle, generateComponentTheme), _dec(_class = (_ModerateTableRow = /*#__PURE__*/function (_withI18nSupport) {
44
45
  function ModerateTableRow() {
@@ -223,6 +224,26 @@ export var ModerateTableRow = (_dec = withStyleOverrides(generateStyle, generate
223
224
  }, message);
224
225
  });
225
226
  }
227
+ }, {
228
+ key: "renderLogMessage",
229
+ value: function renderLogMessage() {
230
+ var multipleSessionAttempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
231
+ var message = arguments.length > 1 ? arguments[1] : undefined;
232
+ return jsx(React.Fragment, null, jsx(Text, {
233
+ color: multipleSessionAttempt ? 'danger' : 'brand'
234
+ }, message), multipleSessionAttempt && jsx(Tooltip, {
235
+ renderTip: t('Multiple sessions detected'),
236
+ placement: "end",
237
+ on: ['click', 'hover', 'focus']
238
+ }, jsx(IconButton, {
239
+ screenReaderLabel: t('Multiple sessions detected'),
240
+ color: 'danger',
241
+ size: 'small',
242
+ renderIcon: IconWarningSolid,
243
+ withBackground: false,
244
+ withBorder: false
245
+ })));
246
+ }
226
247
  }, {
227
248
  key: "renderLogLinks",
228
249
  value: function renderLogLinks(quizSessions) {
@@ -240,6 +261,7 @@ export var ModerateTableRow = (_dec = withStyleOverrides(generateStyle, generate
240
261
  return quizSessions.map(function (quizSession) {
241
262
  var quizSessionId = quizSession.get('id');
242
263
  var message = quizSession.inProgress() || quizSession.reopeningGraded() ? t('In Progress') : t('View Log');
264
+ var logMessage = _this7.renderLogMessage(quizSession.get('multipleSessionAttempt'), message);
243
265
  function onClick(event) {
244
266
  onModerateLogClick({
245
267
  id: id,
@@ -253,7 +275,7 @@ export var ModerateTableRow = (_dec = withStyleOverrides(generateStyle, generate
253
275
  }, jsx(Link, {
254
276
  onClick: onClick,
255
277
  "data-automation": "sdk-moderation-moderate-session-log-link"
256
- }, message));
278
+ }, logMessage));
257
279
  });
258
280
  }
259
281
  }, {
@@ -258,16 +258,14 @@ var BankEntry = exports.BankEntry = (_dec = (0, _quizCommon.withStyleOverrides)(
258
258
  }, {
259
259
  key: "isStimulusEntry",
260
260
  value: function isStimulusEntry() {
261
- var entry = this.getEntry();
262
- if (!entry) return false;
263
- return entry.isStimulus && !entry.isPassage;
261
+ var _this$props$bankEntry;
262
+ return (_this$props$bankEntry = this.props.bankEntry) === null || _this$props$bankEntry === void 0 ? void 0 : _this$props$bankEntry.isStimulusEntry;
264
263
  }
265
264
  }, {
266
265
  key: "isPassageEntry",
267
266
  value: function isPassageEntry() {
268
- var entry = this.getEntry();
269
- if (!entry) return false;
270
- return entry.isStimulus && entry.isPassage;
267
+ var _this$props$bankEntry2;
268
+ return (_this$props$bankEntry2 = this.props.bankEntry) === null || _this$props$bankEntry2 === void 0 ? void 0 : _this$props$bankEntry2.isPassageEntry;
271
269
  }
272
270
  }, {
273
271
  key: "getEditWarning",
@@ -163,16 +163,14 @@ var BankEntryRow = exports.BankEntryRow = (_dec = (0, _quizCommon.withStyleOverr
163
163
  }, {
164
164
  key: "isStimulusEntry",
165
165
  value: function isStimulusEntry() {
166
- var entry = this.getEntry();
167
- if (!entry) return false;
168
- return entry.isStimulus && !entry.isPassage;
166
+ var _this$props$bankEntry;
167
+ return (_this$props$bankEntry = this.props.bankEntry) === null || _this$props$bankEntry === void 0 ? void 0 : _this$props$bankEntry.isStimulusEntry;
169
168
  }
170
169
  }, {
171
170
  key: "isPassageEntry",
172
171
  value: function isPassageEntry() {
173
- var entry = this.getEntry();
174
- if (!entry) return false;
175
- return entry.isStimulus && entry.isPassage;
172
+ var _this$props$bankEntry2;
173
+ return (_this$props$bankEntry2 = this.props.bankEntry) === null || _this$props$bankEntry2 === void 0 ? void 0 : _this$props$bankEntry2.isPassageEntry;
176
174
  }
177
175
  }, {
178
176
  key: "type",
@@ -173,6 +173,7 @@ var StimulusEditInfo = exports.StimulusEditInfo = (_dec = (0, _quizCommon.withSt
173
173
  var automationPrefix = stimulus.passage ? 'text-block' : 'stimulus';
174
174
  var message = stimulus.passage ? (0, _formatMessage["default"])('Edit Text Block') : (0, _formatMessage["default"])('Edit Stimulus');
175
175
  return (0, _emotion.jsx)(_quizCommon.FormFieldGroup, {
176
+ "data-automation": "stimulus-edit-info",
176
177
  messages: this.inputErrors('onSelf'),
177
178
  description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, message)
178
179
  }, (0, _emotion.jsx)(_uiHeading.Heading, {
@@ -84,6 +84,20 @@ var BankEntry = exports.BankEntry = /*#__PURE__*/function (_ReduxRecord) {
84
84
  if (!this.isStimulus) return false;
85
85
  return (_this$getEntry2 = this.getEntry()) === null || _this$getEntry2 === void 0 ? void 0 : _this$getEntry2.isPassage;
86
86
  }
87
+ }, {
88
+ key: "isStimulusEntry",
89
+ get: function get() {
90
+ var entry = this.getEntry();
91
+ if (!entry) return false;
92
+ return entry.isStimulus && !entry.isPassage;
93
+ }
94
+ }, {
95
+ key: "isPassageEntry",
96
+ get: function get() {
97
+ var entry = this.getEntry();
98
+ if (!entry) return false;
99
+ return entry.isStimulus && entry.isPassage;
100
+ }
87
101
  }]);
88
102
  }((0, _reduxRecord["default"])({
89
103
  id: '0',
@@ -214,6 +214,7 @@ var QuizSession = exports.QuizSession = /*#__PURE__*/function (_ReduxRecord) {
214
214
  user: (0, _immutable.Map)(),
215
215
  // Good candidate for another Record - Still relevant?
216
216
  bolaSessionItemsCount: null,
217
- buildOnLastAttempt: null
217
+ buildOnLastAttempt: null,
218
+ multipleSessionAttempt: false
218
219
  }));
219
220
  var _default = exports["default"] = QuizSession;
@@ -55,13 +55,8 @@ var propsForStimulusVersioningWrapper = exports.propsForStimulusVersioningWrappe
55
55
  }
56
56
  var isPassage = args[args.length - 1];
57
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
- });
58
+ var title = isPassage ? (0, _formatMessage["default"])('Some students have already submitted answers for this text block!') : (0, _formatMessage["default"])('Some students have already submitted answers for this stimulus!');
59
+ var content = isPassage ? (0, _formatMessage["default"])('You can apply your edits to a copy of this text block' + ' which will only be seen by students that have not taken the assessment.' + ' Attached questions will be copied as well.') : (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.');
65
60
  return propsForVersioningWrapper.apply(void 0, [/*#__PURE__*/_react["default"].createElement(_uiText.Text, {
66
61
  color: "primary"
67
62
  }, /*#__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, {
@@ -11,7 +11,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
11
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _react = require("react");
14
+ var _react = _interopRequireWildcard(require("react"));
15
15
  var _propTypes = _interopRequireDefault(require("prop-types"));
16
16
  var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));
17
17
  var _uiA11yContent = require("@instructure/ui-a11y-content");
@@ -29,9 +29,12 @@ var _quizCommon = require("@instructure/quiz-common");
29
29
  var _FormattedDuration = _interopRequireDefault(require("../../../../common/components/shared/FormattedDuration"));
30
30
  var _styles = _interopRequireDefault(require("./styles"));
31
31
  var _theme = _interopRequireDefault(require("./theme"));
32
+ var _uiTooltip = require("@instructure/ui-tooltip");
32
33
  var _dec, _class, _ModerateTableRow;
33
34
  /** @jsx jsx */
34
35
  /* eslint "array-callback-return": "warn" */
36
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
38
  function _callSuper(_this, derived, args) {
36
39
  function isNativeReflectConstruct() {
37
40
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
@@ -230,6 +233,26 @@ var ModerateTableRow = exports.ModerateTableRow = (_dec = (0, _quizCommon.withSt
230
233
  }, message);
231
234
  });
232
235
  }
236
+ }, {
237
+ key: "renderLogMessage",
238
+ value: function renderLogMessage() {
239
+ var multipleSessionAttempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
240
+ var message = arguments.length > 1 ? arguments[1] : undefined;
241
+ return (0, _emotion.jsx)(_react["default"].Fragment, null, (0, _emotion.jsx)(_uiText.Text, {
242
+ color: multipleSessionAttempt ? 'danger' : 'brand'
243
+ }, message), multipleSessionAttempt && (0, _emotion.jsx)(_uiTooltip.Tooltip, {
244
+ renderTip: (0, _formatMessage["default"])('Multiple sessions detected'),
245
+ placement: "end",
246
+ on: ['click', 'hover', 'focus']
247
+ }, (0, _emotion.jsx)(_uiButtons.IconButton, {
248
+ screenReaderLabel: (0, _formatMessage["default"])('Multiple sessions detected'),
249
+ color: 'danger',
250
+ size: 'small',
251
+ renderIcon: _uiIcons.IconWarningSolid,
252
+ withBackground: false,
253
+ withBorder: false
254
+ })));
255
+ }
233
256
  }, {
234
257
  key: "renderLogLinks",
235
258
  value: function renderLogLinks(quizSessions) {
@@ -247,6 +270,7 @@ var ModerateTableRow = exports.ModerateTableRow = (_dec = (0, _quizCommon.withSt
247
270
  return quizSessions.map(function (quizSession) {
248
271
  var quizSessionId = quizSession.get('id');
249
272
  var message = quizSession.inProgress() || quizSession.reopeningGraded() ? (0, _formatMessage["default"])('In Progress') : (0, _formatMessage["default"])('View Log');
273
+ var logMessage = _this7.renderLogMessage(quizSession.get('multipleSessionAttempt'), message);
250
274
  function onClick(event) {
251
275
  onModerateLogClick({
252
276
  id: id,
@@ -260,7 +284,7 @@ var ModerateTableRow = exports.ModerateTableRow = (_dec = (0, _quizCommon.withSt
260
284
  }, (0, _emotion.jsx)(_uiLink.Link, {
261
285
  onClick: onClick,
262
286
  "data-automation": "sdk-moderation-moderate-session-log-link"
263
- }, message));
287
+ }, logMessage));
264
288
  });
265
289
  }
266
290
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "22.5.1-rc.0+a38ba1888",
3
+ "version": "22.5.1-rc.3+9e80eae7f",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -46,11 +46,11 @@
46
46
  "@instructure/emotion": "10.14.0",
47
47
  "@instructure/grading-utils": "^1.0.0",
48
48
  "@instructure/outcomes-ui": "3.2.3",
49
- "@instructure/quiz-common": "22.5.1-rc.0+a38ba1888",
50
- "@instructure/quiz-i18n": "22.5.1-rc.0+a38ba1888",
51
- "@instructure/quiz-interactions": "22.5.1-rc.0+a38ba1888",
52
- "@instructure/quiz-number-input": "22.5.1-rc.0+a38ba1888",
53
- "@instructure/quiz-rce": "22.5.1-rc.0+a38ba1888",
49
+ "@instructure/quiz-common": "22.5.1-rc.3+9e80eae7f",
50
+ "@instructure/quiz-i18n": "22.5.1-rc.3+9e80eae7f",
51
+ "@instructure/quiz-interactions": "22.5.1-rc.3+9e80eae7f",
52
+ "@instructure/quiz-number-input": "22.5.1-rc.3+9e80eae7f",
53
+ "@instructure/quiz-rce": "22.5.1-rc.3+9e80eae7f",
54
54
  "@instructure/ui-a11y-content": "10.14.0",
55
55
  "@instructure/ui-alerts": "10.14.0",
56
56
  "@instructure/ui-avatar": "10.14.0",
@@ -109,7 +109,7 @@
109
109
  "file-saver": "~2.0.5",
110
110
  "humps": "^2.0.0",
111
111
  "immutable": "^3.8.1",
112
- "instructure-validations": "22.5.1-rc.0+a38ba1888",
112
+ "instructure-validations": "22.5.1-rc.3+9e80eae7f",
113
113
  "ipaddr.js": "^1.5.4",
114
114
  "isomorphic-fetch": "^2.2.0",
115
115
  "isuuid": "^0.1.0",
@@ -158,7 +158,7 @@
158
158
  "jquery": "^2.2.3",
159
159
  "karma-junit-reporter": "^2.0.1",
160
160
  "most-subject": "^5.3.0",
161
- "quiz-presets": "22.5.1-rc.0+a38ba1888",
161
+ "quiz-presets": "22.5.1-rc.3+9e80eae7f",
162
162
  "react": "^16.8.6",
163
163
  "react-addons-test-utils": "^15.6.2",
164
164
  "react-dom": "^16.8.6",
@@ -174,5 +174,5 @@
174
174
  "publishConfig": {
175
175
  "access": "public"
176
176
  },
177
- "gitHead": "a38ba18881a7196bb841d679072efe03d3cdddbc"
177
+ "gitHead": "9e80eae7f4e99735bd7692001dfec5eaeae9ea31"
178
178
  }