@instructure/quiz-core 17.46.2-rc.12 → 17.46.2-rc.13
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/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/building/api/items.js +21 -5
- package/es/building/api/stimuli.js +21 -5
- 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/resources/entry/EntrySave/index.js +11 -5
- package/es/common/components/resources/entry/EntrySave/presenter.js +95 -21
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +1 -0
- package/es/common/reducers/config.js +4 -1
- 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/building/api/items.js +23 -5
- package/lib/building/api/stimuli.js +23 -5
- 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/resources/entry/EntrySave/index.js +15 -2
- package/lib/common/components/resources/entry/EntrySave/presenter.js +96 -21
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +1 -0
- package/lib/common/reducers/config.js +3 -0
- package/package.json +9 -9
|
@@ -25,6 +25,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
25
25
|
|
|
26
26
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
27
|
|
|
28
|
+
var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));
|
|
29
|
+
|
|
28
30
|
var _uiButtons = require("@instructure/ui-buttons");
|
|
29
31
|
|
|
30
32
|
var _uiView = require("@instructure/ui-view");
|
|
@@ -63,11 +65,75 @@ var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
63
65
|
_this.props.screenreaderNotification(msg);
|
|
64
66
|
};
|
|
65
67
|
|
|
68
|
+
_this.confirmShareableContent = function () {
|
|
69
|
+
var _this$props = _this.props,
|
|
70
|
+
canvasOrigin = _this$props.canvasOrigin,
|
|
71
|
+
checkContentShareability = _this$props.checkContentShareability,
|
|
72
|
+
entry = _this$props.entry,
|
|
73
|
+
withConfirm = _this$props.withConfirm;
|
|
74
|
+
|
|
75
|
+
_this.setState({
|
|
76
|
+
canSubmit: false
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
checkContentShareability(entry.getWorkingInstance(), canvasOrigin).then(function () {
|
|
80
|
+
_this.successfulSubmit();
|
|
81
|
+
}).catch( /*#__PURE__*/function () {
|
|
82
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(err) {
|
|
83
|
+
var _err$response, _err$response2;
|
|
84
|
+
|
|
85
|
+
var body, text;
|
|
86
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
87
|
+
while (1) {
|
|
88
|
+
switch (_context.prev = _context.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
_context.next = 2;
|
|
91
|
+
return (_err$response = err.response) === null || _err$response === void 0 ? void 0 : _err$response.json();
|
|
92
|
+
|
|
93
|
+
case 2:
|
|
94
|
+
body = _context.sent;
|
|
95
|
+
text = (0, _formatMessage.default)('There was an error attempting to validate shareability.');
|
|
96
|
+
|
|
97
|
+
if (((_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : _err$response2.status) === 400 && body.shareable === false) {
|
|
98
|
+
text = (0, _formatMessage.default)('You are attempting to save content containing course links which may not work when used in other courses.');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
withConfirm(function () {
|
|
102
|
+
_this.successfulSubmit();
|
|
103
|
+
}, {
|
|
104
|
+
title: (0, _formatMessage.default)('Are you sure?'),
|
|
105
|
+
text: text,
|
|
106
|
+
continueText: (0, _formatMessage.default)('Save anyway'),
|
|
107
|
+
onCancel: function onCancel() {
|
|
108
|
+
_this.setState({
|
|
109
|
+
canSubmit: true
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
case 6:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context.stop();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}, _callee);
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
return function (_x) {
|
|
123
|
+
return _ref.apply(this, arguments);
|
|
124
|
+
};
|
|
125
|
+
}());
|
|
126
|
+
};
|
|
127
|
+
|
|
66
128
|
_this.onSubmit = function (e) {
|
|
67
129
|
e.preventDefault();
|
|
68
130
|
|
|
69
131
|
if (_this.props.isValid) {
|
|
70
|
-
_this.
|
|
132
|
+
if (_this.props.checkBankedContentShareabilityEnabled && _this.props.shouldValidateShareableContent) {
|
|
133
|
+
_this.confirmShareableContent();
|
|
134
|
+
} else {
|
|
135
|
+
_this.successfulSubmit();
|
|
136
|
+
}
|
|
71
137
|
} else {
|
|
72
138
|
_this.createScreenReaderNotification();
|
|
73
139
|
|
|
@@ -111,24 +177,24 @@ var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
111
177
|
}, {
|
|
112
178
|
key: "successfulSubmit",
|
|
113
179
|
value: function () {
|
|
114
|
-
var _successfulSubmit = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
180
|
+
var _successfulSubmit = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
115
181
|
var validationResult;
|
|
116
|
-
return _regenerator.default.wrap(function
|
|
182
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
117
183
|
while (1) {
|
|
118
|
-
switch (
|
|
184
|
+
switch (_context2.prev = _context2.next) {
|
|
119
185
|
case 0:
|
|
120
186
|
this.setState({
|
|
121
187
|
canSubmit: false
|
|
122
188
|
});
|
|
123
|
-
|
|
124
|
-
|
|
189
|
+
_context2.prev = 1;
|
|
190
|
+
_context2.next = 4;
|
|
125
191
|
return this.props.submitHandler();
|
|
126
192
|
|
|
127
193
|
case 4:
|
|
128
|
-
validationResult =
|
|
194
|
+
validationResult = _context2.sent;
|
|
129
195
|
|
|
130
196
|
if (!(validationResult === _quizCommon.API_INPUT_VALIDATION_ERROR)) {
|
|
131
|
-
|
|
197
|
+
_context2.next = 8;
|
|
132
198
|
break;
|
|
133
199
|
}
|
|
134
200
|
|
|
@@ -136,16 +202,16 @@ var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
136
202
|
throw new Error('User input validation error received from API.');
|
|
137
203
|
|
|
138
204
|
case 8:
|
|
139
|
-
|
|
205
|
+
_context2.next = 14;
|
|
140
206
|
break;
|
|
141
207
|
|
|
142
208
|
case 10:
|
|
143
|
-
|
|
144
|
-
|
|
209
|
+
_context2.prev = 10;
|
|
210
|
+
_context2.t0 = _context2["catch"](1);
|
|
145
211
|
this.setState({
|
|
146
212
|
canSubmit: true
|
|
147
213
|
});
|
|
148
|
-
return
|
|
214
|
+
return _context2.abrupt("return");
|
|
149
215
|
|
|
150
216
|
case 14:
|
|
151
217
|
this.props.switchOffEditing();
|
|
@@ -154,10 +220,10 @@ var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
154
220
|
|
|
155
221
|
case 17:
|
|
156
222
|
case "end":
|
|
157
|
-
return
|
|
223
|
+
return _context2.stop();
|
|
158
224
|
}
|
|
159
225
|
}
|
|
160
|
-
},
|
|
226
|
+
}, _callee2, this, [[1, 10]]);
|
|
161
227
|
}));
|
|
162
228
|
|
|
163
229
|
function successfulSubmit() {
|
|
@@ -193,29 +259,38 @@ var EntrySave = /*#__PURE__*/function (_Component) {
|
|
|
193
259
|
|
|
194
260
|
exports.EntrySave = EntrySave;
|
|
195
261
|
EntrySave.propTypes = {
|
|
196
|
-
displayPosition: _propTypes.default.number,
|
|
197
|
-
disableSubmit: _propTypes.default.bool,
|
|
198
|
-
guid: _propTypes.default.string,
|
|
199
|
-
submitHandler: _propTypes.default.func.isRequired,
|
|
200
262
|
cancelHandler: _propTypes.default.func,
|
|
263
|
+
canvasOrigin: _propTypes.default.string,
|
|
264
|
+
checkBankedContentShareabilityEnabled: _propTypes.default.bool,
|
|
265
|
+
checkContentShareability: _propTypes.default.func.isRequired,
|
|
201
266
|
clearChanges: _propTypes.default.func.isRequired,
|
|
202
267
|
// From connected component
|
|
203
268
|
clearNextQuizEntry: _propTypes.default.func.isRequired,
|
|
269
|
+
disableSubmit: _propTypes.default.bool,
|
|
270
|
+
displayPosition: _propTypes.default.number,
|
|
271
|
+
entry: _reactImmutableProptypes.default.record.isRequired,
|
|
272
|
+
guid: _propTypes.default.string,
|
|
204
273
|
hideError: _propTypes.default.func.isRequired,
|
|
274
|
+
initialFocusId: _propTypes.default.string,
|
|
205
275
|
isValid: _propTypes.default.bool.isRequired,
|
|
206
276
|
showError: _propTypes.default.func.isRequired,
|
|
207
277
|
screenreaderNotification: _propTypes.default.func.isRequired,
|
|
278
|
+
shouldValidateShareableContent: _propTypes.default.bool,
|
|
279
|
+
submitHandler: _propTypes.default.func.isRequired,
|
|
208
280
|
// from makescrollable / from props being passed in occasionally
|
|
209
281
|
switchOnEditing: _propTypes.default.func.isRequired,
|
|
210
282
|
switchOffEditing: _propTypes.default.func.isRequired,
|
|
211
|
-
|
|
283
|
+
withConfirm: _propTypes.default.func.isRequired
|
|
212
284
|
};
|
|
213
285
|
EntrySave.defaultProps = {
|
|
214
|
-
displayPosition: null,
|
|
215
286
|
cancelHandler: _noop.default,
|
|
287
|
+
canvasOrigin: '',
|
|
288
|
+
checkBankedContentShareabilityEnabled: false,
|
|
289
|
+
displayPosition: null,
|
|
216
290
|
disableSubmit: false,
|
|
217
291
|
guid: null,
|
|
218
|
-
initialFocusId: null
|
|
292
|
+
initialFocusId: null,
|
|
293
|
+
shouldValidateShareableContent: false
|
|
219
294
|
};
|
|
220
295
|
var _default = EntrySave;
|
|
221
296
|
exports.default = _default;
|
|
@@ -413,6 +413,7 @@ var StimulusEdit = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
413
413
|
onAdd: this.handleAddToBank,
|
|
414
414
|
onContinue: this.handleAddToBankContinue,
|
|
415
415
|
getEntry: this.getEntryForBank,
|
|
416
|
+
workingEntry: this.props.workingStimulus,
|
|
416
417
|
entryId: this.props.guid,
|
|
417
418
|
entryType: this.props.quizEntry.entryType
|
|
418
419
|
});
|
|
@@ -21,6 +21,9 @@ var _default = function _default() {
|
|
|
21
21
|
case _quizCommon.SET_API_ENDPOINT:
|
|
22
22
|
return state.set('apiEndpoint', action.payload);
|
|
23
23
|
|
|
24
|
+
case _quizCommon.SET_CANVAS_ORIGIN:
|
|
25
|
+
return state.set('canvasOrigin', action.payload);
|
|
26
|
+
|
|
24
27
|
case _quizCommon.SET_USER_TOKEN:
|
|
25
28
|
return state.set('userToken', action.payload);
|
|
26
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.46.2-rc.
|
|
3
|
+
"version": "17.46.2-rc.13+6f637eeea",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@instructure/outcomes-ui": "^2.1.2",
|
|
44
|
-
"@instructure/quiz-common": "17.46.2-rc.
|
|
45
|
-
"@instructure/quiz-i18n": "17.46.2-rc.
|
|
46
|
-
"@instructure/quiz-interactions": "17.46.2-rc.
|
|
47
|
-
"@instructure/quiz-number-input": "17.46.2-rc.
|
|
48
|
-
"@instructure/quiz-rce": "17.46.2-rc.
|
|
44
|
+
"@instructure/quiz-common": "17.46.2-rc.13+6f637eeea",
|
|
45
|
+
"@instructure/quiz-i18n": "17.46.2-rc.13+6f637eeea",
|
|
46
|
+
"@instructure/quiz-interactions": "17.46.2-rc.13+6f637eeea",
|
|
47
|
+
"@instructure/quiz-number-input": "17.46.2-rc.13+6f637eeea",
|
|
48
|
+
"@instructure/quiz-rce": "17.46.2-rc.13+6f637eeea",
|
|
49
49
|
"@instructure/ui-a11y-content": "^7.20.0",
|
|
50
50
|
"@instructure/ui-alerts": "^7.20.0",
|
|
51
51
|
"@instructure/ui-avatar": "^7.20.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"eventemitter3": "^3.1.0",
|
|
107
107
|
"humps": "^2.0.0",
|
|
108
108
|
"immutable": "^3.8.1",
|
|
109
|
-
"instructure-validations": "17.46.2-rc.
|
|
109
|
+
"instructure-validations": "17.46.2-rc.13+6f637eeea",
|
|
110
110
|
"ipaddr.js": "^1.5.4",
|
|
111
111
|
"isomorphic-fetch": "^2.2.0",
|
|
112
112
|
"isuuid": "^0.1.0",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"intl": "^1.2.4",
|
|
157
157
|
"jquery": "^2.2.3",
|
|
158
158
|
"most-subject": "^5.3.0",
|
|
159
|
-
"quiz-presets": "17.46.2-rc.
|
|
159
|
+
"quiz-presets": "17.46.2-rc.13+6f637eeea",
|
|
160
160
|
"react": "^16.8.6",
|
|
161
161
|
"react-addons-test-utils": "^15.6.2",
|
|
162
162
|
"react-dom": "^16.8.6",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"publishConfig": {
|
|
173
173
|
"access": "public"
|
|
174
174
|
},
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "6f637eeea7510a882f6fef1c8ecb4924d3157b0e"
|
|
176
176
|
}
|