@instructure/quiz-core 17.46.2-rc.5 → 17.47.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.
- package/CHANGELOG.md +16 -0
- package/es/banks/components/AddToBankModal/index.js +6 -0
- package/es/banks/components/AddToBankModal/presenter.js +128 -6
- package/es/banks/components/BankEntry/presenter.js +4 -3
- package/es/banks/components/BankEntryRow/presenter.js +1 -3
- package/es/building/api/items.js +21 -5
- package/es/building/api/stimuli.js +21 -5
- package/es/building/components/resources/ItemFeedbackModal/presenter.js +1 -4
- package/es/building/components/resources/quiz/instructions/Edit/presenter.js +1 -3
- package/es/building/components/resources/quiz/instructions/Show/index.js +1 -3
- package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +1 -3
- package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/es/common/actions/config.js +7 -1
- package/es/common/components/ConfirmationModal/presenter.js +1 -1
- package/es/common/components/SDKApp/index.js +10 -2
- package/es/common/components/layout/sidebar/SidebarItem/presenter.js +1 -3
- package/es/common/components/resources/entry/EntrySave/index.js +11 -5
- package/es/common/components/resources/entry/EntrySave/presenter.js +95 -21
- package/es/common/components/resources/item/ItemEdit/index.js +1 -2
- package/es/common/components/resources/item/ItemEdit/presenter.js +0 -2
- package/es/common/components/resources/item/ItemOverride/index.js +1 -2
- package/es/common/components/resources/item/ItemOverride/presenter.js +2 -4
- package/es/common/components/resources/quiz/instructions/Instructions.js +1 -3
- package/es/common/components/resources/sessionItemResult/ResultStimulus/index.js +1 -3
- package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +3 -7
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +1 -0
- package/es/common/components/resources/stimulus/StimulusEditInfo/presenter.js +1 -3
- package/es/common/components/resources/stimulus/StimulusShowInfo/index.js +1 -3
- package/es/common/reducers/config.js +4 -1
- package/es/common/util/RceConfigProvider.js +51 -35
- package/es/common/util/interactionTypePropsHelper.js +2 -5
- package/es/common/util/rceChecker.js +1 -1
- package/es/common/util/windowChecks.js +6 -5
- package/es/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -3
- package/lib/banks/components/AddToBankModal/index.js +9 -0
- package/lib/banks/components/AddToBankModal/presenter.js +135 -6
- package/lib/banks/components/BankEntry/presenter.js +4 -3
- package/lib/banks/components/BankEntryRow/presenter.js +1 -4
- package/lib/building/api/items.js +23 -5
- package/lib/building/api/stimuli.js +23 -5
- package/lib/building/components/resources/ItemFeedbackModal/presenter.js +1 -5
- package/lib/building/components/resources/quiz/instructions/Edit/presenter.js +1 -4
- package/lib/building/components/resources/quiz/instructions/Show/index.js +1 -4
- package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +1 -4
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/lib/common/actions/config.js +8 -0
- package/lib/common/components/ConfirmationModal/presenter.js +1 -1
- package/lib/common/components/SDKApp/index.js +9 -1
- package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +1 -4
- package/lib/common/components/resources/entry/EntrySave/index.js +15 -2
- package/lib/common/components/resources/entry/EntrySave/presenter.js +96 -21
- package/lib/common/components/resources/item/ItemEdit/index.js +1 -2
- package/lib/common/components/resources/item/ItemEdit/presenter.js +0 -2
- package/lib/common/components/resources/item/ItemOverride/index.js +1 -2
- package/lib/common/components/resources/item/ItemOverride/presenter.js +2 -4
- package/lib/common/components/resources/quiz/instructions/Instructions.js +1 -4
- package/lib/common/components/resources/sessionItemResult/ResultStimulus/index.js +1 -4
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +3 -8
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +1 -0
- package/lib/common/components/resources/stimulus/StimulusEditInfo/presenter.js +1 -4
- package/lib/common/components/resources/stimulus/StimulusShowInfo/index.js +1 -4
- package/lib/common/reducers/config.js +3 -0
- package/lib/common/util/RceConfigProvider.js +50 -34
- package/lib/common/util/interactionTypePropsHelper.js +2 -6
- package/lib/common/util/rceChecker.js +1 -1
- package/lib/common/util/windowChecks.js +13 -7
- package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -4
- package/package.json +10 -10
|
@@ -6,6 +6,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
6
6
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
7
|
import React, { Component } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
9
10
|
import { Button } from '@instructure/ui-buttons';
|
|
10
11
|
import { View } from '@instructure/ui-view';
|
|
11
12
|
import { API_INPUT_VALIDATION_ERROR } from '@instructure/quiz-common';
|
|
@@ -39,11 +40,75 @@ export var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
39
40
|
_this.props.screenreaderNotification(msg);
|
|
40
41
|
};
|
|
41
42
|
|
|
43
|
+
_this.confirmShareableContent = function () {
|
|
44
|
+
var _this$props = _this.props,
|
|
45
|
+
canvasOrigin = _this$props.canvasOrigin,
|
|
46
|
+
checkContentShareability = _this$props.checkContentShareability,
|
|
47
|
+
entry = _this$props.entry,
|
|
48
|
+
withConfirm = _this$props.withConfirm;
|
|
49
|
+
|
|
50
|
+
_this.setState({
|
|
51
|
+
canSubmit: false
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
checkContentShareability(entry.getWorkingInstance(), canvasOrigin).then(function () {
|
|
55
|
+
_this.successfulSubmit();
|
|
56
|
+
}).catch( /*#__PURE__*/function () {
|
|
57
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(err) {
|
|
58
|
+
var _err$response, _err$response2;
|
|
59
|
+
|
|
60
|
+
var body, text;
|
|
61
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
_context.next = 2;
|
|
66
|
+
return (_err$response = err.response) === null || _err$response === void 0 ? void 0 : _err$response.json();
|
|
67
|
+
|
|
68
|
+
case 2:
|
|
69
|
+
body = _context.sent;
|
|
70
|
+
text = t('There was an error attempting to validate shareability.');
|
|
71
|
+
|
|
72
|
+
if (((_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : _err$response2.status) === 400 && body.shareable === false) {
|
|
73
|
+
text = t('You are attempting to save content containing course links which may not work when used in other courses.');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
withConfirm(function () {
|
|
77
|
+
_this.successfulSubmit();
|
|
78
|
+
}, {
|
|
79
|
+
title: t('Are you sure?'),
|
|
80
|
+
text: text,
|
|
81
|
+
continueText: t('Save anyway'),
|
|
82
|
+
onCancel: function onCancel() {
|
|
83
|
+
_this.setState({
|
|
84
|
+
canSubmit: true
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
case 6:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context.stop();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, _callee);
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
return function (_x) {
|
|
98
|
+
return _ref.apply(this, arguments);
|
|
99
|
+
};
|
|
100
|
+
}());
|
|
101
|
+
};
|
|
102
|
+
|
|
42
103
|
_this.onSubmit = function (e) {
|
|
43
104
|
e.preventDefault();
|
|
44
105
|
|
|
45
106
|
if (_this.props.isValid) {
|
|
46
|
-
_this.
|
|
107
|
+
if (_this.props.checkBankedContentShareabilityEnabled && _this.props.shouldValidateShareableContent) {
|
|
108
|
+
_this.confirmShareableContent();
|
|
109
|
+
} else {
|
|
110
|
+
_this.successfulSubmit();
|
|
111
|
+
}
|
|
47
112
|
} else {
|
|
48
113
|
_this.createScreenReaderNotification();
|
|
49
114
|
|
|
@@ -87,24 +152,24 @@ export var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
87
152
|
}, {
|
|
88
153
|
key: "successfulSubmit",
|
|
89
154
|
value: function () {
|
|
90
|
-
var _successfulSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
155
|
+
var _successfulSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
91
156
|
var validationResult;
|
|
92
|
-
return _regeneratorRuntime.wrap(function
|
|
157
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
93
158
|
while (1) {
|
|
94
|
-
switch (
|
|
159
|
+
switch (_context2.prev = _context2.next) {
|
|
95
160
|
case 0:
|
|
96
161
|
this.setState({
|
|
97
162
|
canSubmit: false
|
|
98
163
|
});
|
|
99
|
-
|
|
100
|
-
|
|
164
|
+
_context2.prev = 1;
|
|
165
|
+
_context2.next = 4;
|
|
101
166
|
return this.props.submitHandler();
|
|
102
167
|
|
|
103
168
|
case 4:
|
|
104
|
-
validationResult =
|
|
169
|
+
validationResult = _context2.sent;
|
|
105
170
|
|
|
106
171
|
if (!(validationResult === API_INPUT_VALIDATION_ERROR)) {
|
|
107
|
-
|
|
172
|
+
_context2.next = 8;
|
|
108
173
|
break;
|
|
109
174
|
}
|
|
110
175
|
|
|
@@ -112,16 +177,16 @@ export var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
112
177
|
throw new Error('User input validation error received from API.');
|
|
113
178
|
|
|
114
179
|
case 8:
|
|
115
|
-
|
|
180
|
+
_context2.next = 14;
|
|
116
181
|
break;
|
|
117
182
|
|
|
118
183
|
case 10:
|
|
119
|
-
|
|
120
|
-
|
|
184
|
+
_context2.prev = 10;
|
|
185
|
+
_context2.t0 = _context2["catch"](1);
|
|
121
186
|
this.setState({
|
|
122
187
|
canSubmit: true
|
|
123
188
|
});
|
|
124
|
-
return
|
|
189
|
+
return _context2.abrupt("return");
|
|
125
190
|
|
|
126
191
|
case 14:
|
|
127
192
|
this.props.switchOffEditing();
|
|
@@ -130,10 +195,10 @@ export var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
130
195
|
|
|
131
196
|
case 17:
|
|
132
197
|
case "end":
|
|
133
|
-
return
|
|
198
|
+
return _context2.stop();
|
|
134
199
|
}
|
|
135
200
|
}
|
|
136
|
-
},
|
|
201
|
+
}, _callee2, this, [[1, 10]]);
|
|
137
202
|
}));
|
|
138
203
|
|
|
139
204
|
function successfulSubmit() {
|
|
@@ -168,28 +233,37 @@ export var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
168
233
|
return EntrySave;
|
|
169
234
|
}(Component);
|
|
170
235
|
EntrySave.propTypes = {
|
|
171
|
-
displayPosition: PropTypes.number,
|
|
172
|
-
disableSubmit: PropTypes.bool,
|
|
173
|
-
guid: PropTypes.string,
|
|
174
|
-
submitHandler: PropTypes.func.isRequired,
|
|
175
236
|
cancelHandler: PropTypes.func,
|
|
237
|
+
canvasOrigin: PropTypes.string,
|
|
238
|
+
checkBankedContentShareabilityEnabled: PropTypes.bool,
|
|
239
|
+
checkContentShareability: PropTypes.func.isRequired,
|
|
176
240
|
clearChanges: PropTypes.func.isRequired,
|
|
177
241
|
// From connected component
|
|
178
242
|
clearNextQuizEntry: PropTypes.func.isRequired,
|
|
243
|
+
disableSubmit: PropTypes.bool,
|
|
244
|
+
displayPosition: PropTypes.number,
|
|
245
|
+
entry: ImmutablePropTypes.record.isRequired,
|
|
246
|
+
guid: PropTypes.string,
|
|
179
247
|
hideError: PropTypes.func.isRequired,
|
|
248
|
+
initialFocusId: PropTypes.string,
|
|
180
249
|
isValid: PropTypes.bool.isRequired,
|
|
181
250
|
showError: PropTypes.func.isRequired,
|
|
182
251
|
screenreaderNotification: PropTypes.func.isRequired,
|
|
252
|
+
shouldValidateShareableContent: PropTypes.bool,
|
|
253
|
+
submitHandler: PropTypes.func.isRequired,
|
|
183
254
|
// from makescrollable / from props being passed in occasionally
|
|
184
255
|
switchOnEditing: PropTypes.func.isRequired,
|
|
185
256
|
switchOffEditing: PropTypes.func.isRequired,
|
|
186
|
-
|
|
257
|
+
withConfirm: PropTypes.func.isRequired
|
|
187
258
|
};
|
|
188
259
|
EntrySave.defaultProps = {
|
|
189
|
-
displayPosition: null,
|
|
190
260
|
cancelHandler: noop,
|
|
261
|
+
canvasOrigin: '',
|
|
262
|
+
checkBankedContentShareabilityEnabled: false,
|
|
263
|
+
displayPosition: null,
|
|
191
264
|
disableSubmit: false,
|
|
192
265
|
guid: null,
|
|
193
|
-
initialFocusId: null
|
|
266
|
+
initialFocusId: null,
|
|
267
|
+
shouldValidateShareableContent: false
|
|
194
268
|
};
|
|
195
269
|
export default EntrySave;
|
|
@@ -37,8 +37,7 @@ export function mapStateToProps(state, props) {
|
|
|
37
37
|
partialDeepScoringEnabled: featureOn('partial_deep_scoring'),
|
|
38
38
|
partialScoringEnabled: featureOn('partial_scoring'),
|
|
39
39
|
quizId: getActiveQuizId(state),
|
|
40
|
-
showCalculator: featureOn('calculator_per_question')
|
|
41
|
-
useNewRce: featureOn('use_new_rce')
|
|
40
|
+
showCalculator: featureOn('calculator_per_question')
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
|
|
@@ -180,7 +180,6 @@ ItemEdit.propTypes = {
|
|
|
180
180
|
setUploadStatus: PropTypes.func.isRequired,
|
|
181
181
|
initialFocusId: PropTypes.string,
|
|
182
182
|
showCalculator: PropTypes.bool,
|
|
183
|
-
useNewRce: PropTypes.bool,
|
|
184
183
|
clearValidationErrorsFromApi: PropTypes.func.isRequired,
|
|
185
184
|
validationErrorsFromApi: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.shape({
|
|
186
185
|
type: PropTypes.string,
|
|
@@ -199,7 +198,6 @@ ItemEdit.defaultProps = {
|
|
|
199
198
|
partialScoringEnabled: false,
|
|
200
199
|
initialFocusId: null,
|
|
201
200
|
showCalculator: false,
|
|
202
|
-
useNewRce: false,
|
|
203
201
|
validationErrorsFromApi: {}
|
|
204
202
|
};
|
|
205
203
|
export default ItemEdit;
|
|
@@ -18,8 +18,7 @@ function mapStateToProps(state, props) {
|
|
|
18
18
|
oneQuestionAtATime: isActiveQuizWorkingInstanceOneQuestionAtATime(state),
|
|
19
19
|
partialDeepScoringEnabled: featureOn('partial_deep_scoring'),
|
|
20
20
|
partialScoringEnabled: featureOn('partial_scoring'),
|
|
21
|
-
quizId: getActiveQuizId(state)
|
|
22
|
-
useNewRce: featureOn('use_new_rce')
|
|
21
|
+
quizId: getActiveQuizId(state)
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -76,13 +76,11 @@ ItemOverride.propTypes = {
|
|
|
76
76
|
partialScoringEnabled: PropTypes.bool,
|
|
77
77
|
quizId: PropTypes.string.isRequired,
|
|
78
78
|
screenreaderNotification: PropTypes.func.isRequired,
|
|
79
|
-
setOneQuestionAtATime: PropTypes.func.isRequired
|
|
80
|
-
useNewRce: PropTypes.bool
|
|
79
|
+
setOneQuestionAtATime: PropTypes.func.isRequired
|
|
81
80
|
};
|
|
82
81
|
ItemOverride.defaultProps = {
|
|
83
82
|
errorsAreShowing: false,
|
|
84
83
|
partialScoringEnabled: false,
|
|
85
|
-
partialDeepScoringEnabled: false
|
|
86
|
-
useNewRce: false
|
|
84
|
+
partialDeepScoringEnabled: false
|
|
87
85
|
};
|
|
88
86
|
export default ItemOverride;
|
|
@@ -10,7 +10,6 @@ import React, { Component } from 'react';
|
|
|
10
10
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
11
11
|
import { themeable } from '@instructure/ui-themeable';
|
|
12
12
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
13
|
-
import { isNewRCEEnabled } from "../../../../util/rceChecker.js";
|
|
14
13
|
import makeScrollable from "../../../shared/functionality/makeScrollable.js"; // ================================
|
|
15
14
|
// renders the quiz instructions on
|
|
16
15
|
// the Preview and Take pages
|
|
@@ -44,8 +43,7 @@ export var QuizInstructions = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
44
43
|
tabIndex: "-1"
|
|
45
44
|
}, /*#__PURE__*/React.createElement(RichContentRenderer, {
|
|
46
45
|
customStyles: styles.text,
|
|
47
|
-
content: this.props.quiz.instructions
|
|
48
|
-
useNewRce: isNewRCEEnabled()
|
|
46
|
+
content: this.props.quiz.instructions
|
|
49
47
|
}));
|
|
50
48
|
}
|
|
51
49
|
}]);
|
|
@@ -10,7 +10,6 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
11
11
|
import { themeable } from '@instructure/ui-themeable';
|
|
12
12
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
13
|
-
import { isNewRCEEnabled } from "../../../../util/rceChecker.js";
|
|
14
13
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
15
14
|
var styles = {
|
|
16
15
|
componentId: 'fcFqb',
|
|
@@ -66,8 +65,7 @@ export var ResultStimulus = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
66
65
|
}, /*#__PURE__*/React.createElement("div", {
|
|
67
66
|
className: styles.title
|
|
68
67
|
}, title)), /*#__PURE__*/React.createElement(RichContentRenderer, {
|
|
69
|
-
content: body
|
|
70
|
-
useNewRce: isNewRCEEnabled()
|
|
68
|
+
content: body
|
|
71
69
|
}));
|
|
72
70
|
}
|
|
73
71
|
}, {
|
|
@@ -18,7 +18,6 @@ import { View } from '@instructure/ui-view';
|
|
|
18
18
|
import { PresentationContent } from '@instructure/ui-a11y-content';
|
|
19
19
|
import { themeable } from '@instructure/ui-themeable';
|
|
20
20
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
21
|
-
import { isNewRCEEnabled } from "../../../../util/rceChecker.js";
|
|
22
21
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
23
22
|
import PositionBox from "../../positionBox/PositionBox.js";
|
|
24
23
|
import { COMPONENT_RESULT } from '@instructure/quiz-common';
|
|
@@ -191,8 +190,7 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
191
190
|
className: styles.textPadding
|
|
192
191
|
}, /*#__PURE__*/React.createElement(RichContentRenderer, {
|
|
193
192
|
customStyles: styles.itemFeedbackText,
|
|
194
|
-
content: feedbackContent
|
|
195
|
-
useNewRce: isNewRCEEnabled()
|
|
193
|
+
content: feedbackContent
|
|
196
194
|
})));
|
|
197
195
|
}
|
|
198
196
|
}
|
|
@@ -236,8 +234,7 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
236
234
|
className: styles.itemFeedbackLabel
|
|
237
235
|
}, t('Feedback from grader')), /*#__PURE__*/React.createElement(RichContentRenderer, {
|
|
238
236
|
customStyles: styles.itemFeedbackText,
|
|
239
|
-
content: graderFeedback.content
|
|
240
|
-
useNewRce: isNewRCEEnabled()
|
|
237
|
+
content: graderFeedback.content
|
|
241
238
|
}));
|
|
242
239
|
} else {
|
|
243
240
|
return this.renderFeedbackBox(graderFeedback.content, t('Feedback from grader'));
|
|
@@ -277,8 +274,7 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
277
274
|
properties: simpleItem.properties || {},
|
|
278
275
|
scoringData: simpleSessionItem.scoringData,
|
|
279
276
|
scoredData: simpleSessionItemResult.scoredData,
|
|
280
|
-
itemResultsModifications: simpleResultsModifications[simpleSessionItem.id]
|
|
281
|
-
useNewRce: isNewRCEEnabled()
|
|
277
|
+
itemResultsModifications: simpleResultsModifications[simpleSessionItem.id]
|
|
282
278
|
})), this.renderItemFeedback(simpleSessionItemResult));
|
|
283
279
|
}
|
|
284
280
|
}, {
|
|
@@ -376,6 +376,7 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
376
376
|
onAdd: this.handleAddToBank,
|
|
377
377
|
onContinue: this.handleAddToBankContinue,
|
|
378
378
|
getEntry: this.getEntryForBank,
|
|
379
|
+
workingEntry: this.props.workingStimulus,
|
|
379
380
|
entryId: this.props.guid,
|
|
380
381
|
entryType: this.props.quizEntry.entryType
|
|
381
382
|
});
|
|
@@ -16,7 +16,6 @@ import { themeable } from '@instructure/ui-themeable';
|
|
|
16
16
|
import { Heading } from '@instructure/ui-heading';
|
|
17
17
|
import RichContentInput from "../../../RichContentInput/index.js";
|
|
18
18
|
import { toErrors } from "../../../../util/instUIMessages.js";
|
|
19
|
-
import { isNewRCEEnabled } from "../../../../util/rceChecker.js";
|
|
20
19
|
import Errors from "../../../shared/errors/Errors.js";
|
|
21
20
|
import { SimpleSelect } from '@instructure/ui-simple-select';
|
|
22
21
|
import { IconUpdownLine } from '@instructure/ui-icons';
|
|
@@ -177,8 +176,7 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
177
176
|
onKeyUp: this.onBodyChange,
|
|
178
177
|
onBlur: this.onBodyChange,
|
|
179
178
|
onChange: this.onBodyChange,
|
|
180
|
-
uploadPath: this.fileUploadUrl()
|
|
181
|
-
useNewRce: isNewRCEEnabled()
|
|
179
|
+
uploadPath: this.fileUploadUrl()
|
|
182
180
|
}), /*#__PURE__*/React.createElement(Errors, {
|
|
183
181
|
errorList: this.errorsList('body')
|
|
184
182
|
})), /*#__PURE__*/React.createElement("div", {
|
|
@@ -8,7 +8,6 @@ import { Heading } from '@instructure/ui-heading';
|
|
|
8
8
|
import { Text } from '@instructure/ui-text';
|
|
9
9
|
import { View } from '@instructure/ui-view';
|
|
10
10
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
11
|
-
import { isNewRCEEnabled } from "../../../../util/rceChecker.js";
|
|
12
11
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
13
12
|
|
|
14
13
|
var StimulusShowInfo = /*#__PURE__*/function (_Component) {
|
|
@@ -58,8 +57,7 @@ var StimulusShowInfo = /*#__PURE__*/function (_Component) {
|
|
|
58
57
|
}, this.props.stimulus.title), instructions, /*#__PURE__*/React.createElement("div", {
|
|
59
58
|
"data-automation": "sdk-stimulus-LeftPanelShow-content"
|
|
60
59
|
}, /*#__PURE__*/React.createElement(RichContentRenderer, {
|
|
61
|
-
content: this.props.stimulus.body
|
|
62
|
-
useNewRce: isNewRCEEnabled()
|
|
60
|
+
content: this.props.stimulus.body
|
|
63
61
|
})));
|
|
64
62
|
}
|
|
65
63
|
}]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fromJS } from 'immutable';
|
|
2
|
-
import { SET_API_ENDPOINT, SET_USER_TOKEN } from '@instructure/quiz-common';
|
|
2
|
+
import { SET_API_ENDPOINT, SET_CANVAS_ORIGIN, SET_USER_TOKEN } from '@instructure/quiz-common';
|
|
3
3
|
var defaultState = fromJS({
|
|
4
4
|
apiEndpoint: ''
|
|
5
5
|
});
|
|
@@ -11,6 +11,9 @@ export default (function () {
|
|
|
11
11
|
case SET_API_ENDPOINT:
|
|
12
12
|
return state.set('apiEndpoint', action.payload);
|
|
13
13
|
|
|
14
|
+
case SET_CANVAS_ORIGIN:
|
|
15
|
+
return state.set('canvasOrigin', action.payload);
|
|
16
|
+
|
|
14
17
|
case SET_USER_TOKEN:
|
|
15
18
|
return state.set('userToken', action.payload);
|
|
16
19
|
|
|
@@ -14,7 +14,7 @@ import { RceConfigContext, RceConfigKeys } from '@instructure/quiz-common';
|
|
|
14
14
|
import { addError } from "../actions/alerts.js";
|
|
15
15
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
16
16
|
import { extractTextFromHtml } from '@instructure/quiz-interactions';
|
|
17
|
-
import {
|
|
17
|
+
import { isQuizTaking, isQuizBuilding } from "./windowChecks.js";
|
|
18
18
|
|
|
19
19
|
var _ref4 = /*#__PURE__*/React.createElement(Card, {
|
|
20
20
|
wrapped: true
|
|
@@ -50,39 +50,37 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
|
|
|
50
50
|
switch (_context.prev = _context.next) {
|
|
51
51
|
case 0:
|
|
52
52
|
if (hasAllPropsForRcs()) {
|
|
53
|
-
_context.next =
|
|
53
|
+
_context.next = 2;
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
handleErrorFunc('Invalid RCS configuration');
|
|
58
57
|
return _context.abrupt("return");
|
|
59
58
|
|
|
60
|
-
case
|
|
61
|
-
_context.next =
|
|
59
|
+
case 2:
|
|
60
|
+
_context.next = 4;
|
|
62
61
|
return props.rcsJwtRefreshFn(jwt);
|
|
63
62
|
|
|
64
|
-
case
|
|
63
|
+
case 4:
|
|
65
64
|
response = _context.sent;
|
|
66
65
|
refreshedToken = response === null || response === void 0 ? void 0 : (_response$json = response.json) === null || _response$json === void 0 ? void 0 : _response$json.token; // inst-redux-service-middleware response structure
|
|
67
66
|
|
|
68
67
|
if (refreshedToken) {
|
|
69
|
-
_context.next =
|
|
68
|
+
_context.next = 11;
|
|
70
69
|
break;
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
handleErrorFunc('Unable to refresh RCS token');
|
|
74
72
|
normalizedStem = questionStem !== null && questionStem !== void 0 ? questionStem : 'Unknown stem';
|
|
75
73
|
extractedText = extractTextFromHtml(normalizedStem);
|
|
76
|
-
|
|
74
|
+
handleError(t('Error while answering "{stem}": Full functionality of the Rich Content Editor may not have been available to the user.', {
|
|
77
75
|
stem: extractedText
|
|
78
76
|
}));
|
|
79
77
|
return _context.abrupt("return");
|
|
80
78
|
|
|
81
|
-
case
|
|
79
|
+
case 11:
|
|
82
80
|
setJwt(refreshedToken);
|
|
83
81
|
setTokenFn(refreshedToken);
|
|
84
82
|
|
|
85
|
-
case
|
|
83
|
+
case 13:
|
|
86
84
|
case "end":
|
|
87
85
|
return _context.stop();
|
|
88
86
|
}
|
|
@@ -95,26 +93,44 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
|
|
|
95
93
|
};
|
|
96
94
|
}();
|
|
97
95
|
|
|
98
|
-
var
|
|
99
|
-
|
|
96
|
+
var handleError = function handleError(quizLogMessage) {
|
|
97
|
+
if (shouldAlertUser()) {
|
|
98
|
+
alertTheUser(alertMessage());
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (shouldsetEventToQuizLog()) {
|
|
102
|
+
setEventToQuizLog(quizLogMessage);
|
|
103
|
+
}
|
|
100
104
|
};
|
|
101
105
|
|
|
102
|
-
var
|
|
103
|
-
|
|
106
|
+
var alertTheUser = function alertTheUser(message) {
|
|
107
|
+
store.dispatch(addError(message));
|
|
108
|
+
};
|
|
104
109
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
rendererEnhancement: _defineProperty({}, RceConfigKeys.canvasOrigin, props.canvasOrigin),
|
|
108
|
-
featureFlags: (_featureFlags = {}, _defineProperty(_featureFlags, RceConfigKeys.isNewRCEAppsEnabled, props.isNewRCEAppsEnabled), _defineProperty(_featureFlags, RceConfigKeys.rce5Renderer, props.rce5Renderer), _featureFlags)
|
|
109
|
-
};
|
|
110
|
+
var setEventToQuizLog = function setEventToQuizLog(message) {
|
|
111
|
+
props.setEventToQuizLog(message);
|
|
110
112
|
};
|
|
111
113
|
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
var alertMessage = function alertMessage() {
|
|
115
|
+
return isQuizTaking() ? t('The Rich Content Editor has encountered an issue. ' + 'It has been logged for your instructor to review. Please refresh and try again.') : t('The Rich Content Editor has encountered an issue. Please refresh and try again.');
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
var shouldAlertUser = function shouldAlertUser() {
|
|
119
|
+
return isQuizTaking() || isQuizBuilding();
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
var shouldsetEventToQuizLog = function shouldsetEventToQuizLog() {
|
|
123
|
+
return isQuizTaking();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var getConfig = function getConfig() {
|
|
127
|
+
var _featureFlags, _ref2;
|
|
116
128
|
|
|
117
|
-
|
|
129
|
+
return {
|
|
130
|
+
featureFlags: (_featureFlags = {}, _defineProperty(_featureFlags, RceConfigKeys.isNewRCEEnabled, props.isNewRCEEnabled), _defineProperty(_featureFlags, RceConfigKeys.rce5Renderer, props.rce5Renderer), _defineProperty(_featureFlags, RceConfigKeys.isNewRCEAppsEnabled, props.isNewRCEAppsEnabled), _featureFlags),
|
|
131
|
+
rcs: hasAllPropsForRcs() && canvasConfig ? (_ref2 = {}, _defineProperty(_ref2, RceConfigKeys.canvasUserId, props.canvasUserId), _defineProperty(_ref2, RceConfigKeys.contextId, props.contextId), _defineProperty(_ref2, RceConfigKeys.contextType, props.contextType), _defineProperty(_ref2, RceConfigKeys.rcsHost, props.rcsHost), _defineProperty(_ref2, RceConfigKeys.rcsJwt, jwt), _defineProperty(_ref2, RceConfigKeys.rcsJwtRefreshFn, refreshToken), _defineProperty(_ref2, RceConfigKeys.canvasConfig, canvasConfig), _ref2) : null,
|
|
132
|
+
rendererEnhancement: _defineProperty({}, RceConfigKeys.canvasOrigin, props.canvasOrigin)
|
|
133
|
+
};
|
|
118
134
|
};
|
|
119
135
|
|
|
120
136
|
useEffect(function () {
|
|
@@ -124,7 +140,7 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
|
|
|
124
140
|
while (1) {
|
|
125
141
|
switch (_context2.prev = _context2.next) {
|
|
126
142
|
case 0:
|
|
127
|
-
if (!(!props.
|
|
143
|
+
if (!(!props.isNewRCEEnabled && !props.rce5Renderer)) {
|
|
128
144
|
_context2.next = 2;
|
|
129
145
|
break;
|
|
130
146
|
}
|
|
@@ -139,7 +155,7 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
|
|
|
139
155
|
break;
|
|
140
156
|
}
|
|
141
157
|
|
|
142
|
-
|
|
158
|
+
handleError(t('Error: Full functionality of the Rich Content Editor may not have been available to the user.'));
|
|
143
159
|
return _context2.abrupt("return");
|
|
144
160
|
|
|
145
161
|
case 6:
|
|
@@ -163,7 +179,7 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
|
|
|
163
179
|
case 16:
|
|
164
180
|
json = _context2.sent;
|
|
165
181
|
setCanvasConfig(json);
|
|
166
|
-
|
|
182
|
+
setEventToQuizLog(null);
|
|
167
183
|
_context2.next = 25;
|
|
168
184
|
break;
|
|
169
185
|
|
|
@@ -171,7 +187,7 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
|
|
|
171
187
|
_context2.prev = 21;
|
|
172
188
|
_context2.t0 = _context2["catch"](2);
|
|
173
189
|
setCanvasConfig(null);
|
|
174
|
-
|
|
190
|
+
handleError(t('Error: Full functionality of the Rich Content Editor including accessibility features may not have been available to the user.'));
|
|
175
191
|
|
|
176
192
|
case 25:
|
|
177
193
|
_context2.prev = 25;
|
|
@@ -185,10 +201,10 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
|
|
|
185
201
|
}
|
|
186
202
|
}, _callee2, null, [[2, 21, 25, 28]]);
|
|
187
203
|
}))();
|
|
188
|
-
}, [props.
|
|
204
|
+
}, [props.isNewRCEEnabled, props.rce5Renderer]);
|
|
189
205
|
|
|
190
206
|
if (props.loadedApiFeatures) {
|
|
191
|
-
if (props.
|
|
207
|
+
if (props.isNewRCEEnabled || props.rce5Renderer) {
|
|
192
208
|
if (!canvasConfigLoading) {
|
|
193
209
|
return /*#__PURE__*/React.createElement(RceConfigContext.Provider, {
|
|
194
210
|
value: getConfig()
|
|
@@ -203,10 +219,10 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
|
|
|
203
219
|
};
|
|
204
220
|
RceConfigProviderComponent.propTypes = {
|
|
205
221
|
children: PropTypes.node.isRequired,
|
|
206
|
-
|
|
222
|
+
isNewRCEEnabled: PropTypes.bool.isRequired,
|
|
207
223
|
rce5Renderer: PropTypes.bool.isRequired,
|
|
208
224
|
isNewRCEAppsEnabled: PropTypes.bool,
|
|
209
|
-
|
|
225
|
+
setEventToQuizLog: PropTypes.func.isRequired,
|
|
210
226
|
contextId: PropTypes.string,
|
|
211
227
|
contextType: PropTypes.string,
|
|
212
228
|
canvasUserId: PropTypes.string,
|
|
@@ -230,7 +246,7 @@ RceConfigProviderComponent.defaultProps = {
|
|
|
230
246
|
|
|
231
247
|
var mapStateToProps = function mapStateToProps(state, ownProps) {
|
|
232
248
|
return {
|
|
233
|
-
|
|
249
|
+
isNewRCEEnabled: isNewRCEEnabled(),
|
|
234
250
|
rce5Renderer: isRCE5RendererEnabled(),
|
|
235
251
|
isNewRCEAppsEnabled: isNewRCEAppsEnabled(),
|
|
236
252
|
loadedApiFeatures: state.getIn(['ui', 'loadedApiFeatures']) || ownProps.loadedApiFeatures
|
|
@@ -238,7 +254,7 @@ var mapStateToProps = function mapStateToProps(state, ownProps) {
|
|
|
238
254
|
};
|
|
239
255
|
|
|
240
256
|
var mapDispatchToProps = {
|
|
241
|
-
|
|
257
|
+
setEventToQuizLog: setRCEError
|
|
242
258
|
};
|
|
243
259
|
var RceConfigProvider = connect(mapStateToProps, mapDispatchToProps)(RceConfigProviderComponent);
|
|
244
260
|
export { RceConfigProvider };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import RichContentInput from "../components/RichContentInput/index.js";
|
|
2
2
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
3
|
-
import { isNewRCEEnabled } from "../../common/util/rceChecker.js";
|
|
4
3
|
export var propsForInteractionEdit = function propsForInteractionEdit(props, additionalOptions) {
|
|
5
4
|
var item = props.workingItem.toJS();
|
|
6
5
|
|
|
@@ -69,8 +68,7 @@ export var propsForInteractionEdit = function propsForInteractionEdit(props, add
|
|
|
69
68
|
setOneQuestionAtATime: setOneQuestionAtATime,
|
|
70
69
|
stemErrors: props.workingItem.errorsFor('itemBody').toJS(),
|
|
71
70
|
initialFocusId: props.initialFocusId,
|
|
72
|
-
calculatorType: item.calculatorType
|
|
73
|
-
useNewRce: props.useNewRce
|
|
71
|
+
calculatorType: item.calculatorType
|
|
74
72
|
};
|
|
75
73
|
};
|
|
76
74
|
export var propsForInteractionShow = function propsForInteractionShow(item) {
|
|
@@ -83,7 +81,6 @@ export var propsForInteractionShow = function propsForInteractionShow(item) {
|
|
|
83
81
|
itemBody: item.itemBody || '',
|
|
84
82
|
properties: item.properties,
|
|
85
83
|
notifyScreenreader: true,
|
|
86
|
-
scoringData: item.scoringData
|
|
87
|
-
useNewRce: isNewRCEEnabled()
|
|
84
|
+
scoringData: item.scoringData
|
|
88
85
|
};
|
|
89
86
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { featureOn } from "./featureCheck.js";
|
|
2
2
|
var newRCEFeatureName = 'use_new_rce';
|
|
3
|
-
var newRCEAppsFeatureName = '
|
|
3
|
+
var newRCEAppsFeatureName = 'rce5_apps';
|
|
4
4
|
var rce5RendererFeatureName = 'rce5_renderer';
|
|
5
5
|
export function isNewRCEEnabled() {
|
|
6
6
|
return featureOn(newRCEFeatureName);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDuringQuizTake, isDuringQuizBuild } from '@instructure/quiz-common';
|
|
1
2
|
export var media = {
|
|
2
3
|
'phone-break-point': 'only screen and (max-width: 48rem)',
|
|
3
4
|
'tablet-break-point': 'only screen and (max-width: 64rem)'
|
|
@@ -12,9 +13,9 @@ export var onTablet = function onTablet() {
|
|
|
12
13
|
var mediaQueryString = media['tablet-break-point'];
|
|
13
14
|
return !onPhone(windowObj) && windowObj.matchMedia(mediaQueryString).matches;
|
|
14
15
|
};
|
|
15
|
-
export var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
16
|
+
export var isQuizTaking = function isQuizTaking() {
|
|
17
|
+
return isDuringQuizTake();
|
|
18
|
+
};
|
|
19
|
+
export var isQuizBuilding = function isQuizBuilding() {
|
|
20
|
+
return isDuringQuizBuild();
|
|
20
21
|
};
|
|
@@ -14,7 +14,6 @@ import { Heading } from '@instructure/ui-heading';
|
|
|
14
14
|
import { ScreenReaderContent, PresentationContent } from '@instructure/ui-a11y-content';
|
|
15
15
|
import { themeable } from '@instructure/ui-themeable';
|
|
16
16
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
17
|
-
import { isNewRCEEnabled } from "../../../../common/util/rceChecker.js";
|
|
18
17
|
import Card from "../../../../common/components/shared/Card/index.js";
|
|
19
18
|
import ExpandButton from "../../../../common/components/shared/ExpandButton/index.js";
|
|
20
19
|
import Spinner from "../../../../common/components/shared/spinner/Spinner.js";
|
|
@@ -127,8 +126,7 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
127
126
|
value: function renderStem() {
|
|
128
127
|
return /*#__PURE__*/React.createElement(RichContentRenderer, {
|
|
129
128
|
customStyles: styles.stem,
|
|
130
|
-
content: this.props.itemAnalysis.itemBody
|
|
131
|
-
useNewRce: isNewRCEEnabled()
|
|
129
|
+
content: this.props.itemAnalysis.itemBody
|
|
132
130
|
});
|
|
133
131
|
}
|
|
134
132
|
}, {
|