@instructure/quiz-core 20.18.1-rc.0 → 20.18.1-rc.2
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/api/bankEntries.js +6 -3
- package/es/common/middleware/quizTimerWebSocketMiddleware.js +7 -13
- package/es/taking/api/taking.js +7 -6
- package/lib/banks/api/bankEntries.js +6 -3
- package/lib/common/middleware/quizTimerWebSocketMiddleware.js +7 -13
- package/lib/taking/api/taking.js +7 -6
- package/package.json +9 -9
|
@@ -113,16 +113,19 @@ export var copyBankEntry = function copyBankEntry(sourceBankId, bankEntryId, des
|
|
|
113
113
|
source_bank_id: sourceBankId,
|
|
114
114
|
source_bank_entry_id: bankEntryId
|
|
115
115
|
};
|
|
116
|
-
|
|
116
|
+
var followUpActions = [clear("".concat(BANKS_BANK_ENTRY_PAGINATION, ":").concat(destinationBankId))];
|
|
117
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'copy', null, followUpActions);
|
|
117
118
|
};
|
|
118
119
|
export var moveBankEntry = function moveBankEntry(sourceBankId, bankEntryId, destinationBankId) {
|
|
119
120
|
var body = {
|
|
120
121
|
source_bank_id: sourceBankId,
|
|
121
122
|
source_bank_entry_id: bankEntryId
|
|
122
123
|
};
|
|
123
|
-
|
|
124
|
+
var followUpActions = [clear("".concat(BANKS_BANK_ENTRY_PAGINATION, ":").concat(destinationBankId)), clear("".concat(BANKS_BANK_ENTRY_PAGINATION, ":").concat(sourceBankId)), getBank(sourceBankId)];
|
|
125
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'move', null, followUpActions);
|
|
124
126
|
};
|
|
125
127
|
export var copyOrMoveBankEntry = function copyOrMoveBankEntry(body, destinationBankId, operation, query_params) {
|
|
128
|
+
var followUpActions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [];
|
|
126
129
|
var url = "/api/banks/".concat(destinationBankId, "/bank_entries/").concat(operation);
|
|
127
130
|
return function (dispatch, getState) {
|
|
128
131
|
var fetcher = new Fetcher({
|
|
@@ -137,7 +140,7 @@ export var copyOrMoveBankEntry = function copyOrMoveBankEntry(body, destinationB
|
|
|
137
140
|
return fetcher.post(url, {
|
|
138
141
|
body: JSON.stringify(body)
|
|
139
142
|
}).then(function (response) {
|
|
140
|
-
dispatch([handleBankEntryResponse(response), associateEntries(destinationBankId, [response.id]), getBank(destinationBankId)]);
|
|
143
|
+
dispatch([handleBankEntryResponse(response), associateEntries(destinationBankId, [response.id]), getBank(destinationBankId)].concat(_toConsumableArray(followUpActions)));
|
|
141
144
|
return response;
|
|
142
145
|
});
|
|
143
146
|
};
|
|
@@ -14,8 +14,9 @@ export var handleExtraTime = function handleExtraTime(extraTimeInSeconds, endAt,
|
|
|
14
14
|
var remainingTimeInMs = new Date(endAt) - Date.now();
|
|
15
15
|
var remainingTimeInSeconds = Math.floor(remainingTimeInMs / 1000);
|
|
16
16
|
var formattedExtraTimeText = formatTime(extraTimeInSeconds);
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var isUnlimited = endAt === null && extraTimeInSeconds === null;
|
|
18
|
+
updateTimeAction(remainingTimeInSeconds, !isUnlimited);
|
|
19
|
+
notifyTimeAdded(!isUnlimited, !isUnlimited ? formattedExtraTimeText : null);
|
|
19
20
|
};
|
|
20
21
|
export var parseJwt = function parseJwt(token) {
|
|
21
22
|
try {
|
|
@@ -43,14 +44,13 @@ export var handleWebSocketMessage = function handleWebSocketMessage(webSocketMes
|
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
var
|
|
47
|
-
var end_at = webSocketMessageData.end_at;
|
|
47
|
+
var type = webSocketMessageData.type;
|
|
48
48
|
|
|
49
|
-
if (
|
|
49
|
+
if (type !== 'accommodation_changed') {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
handleExtraTimeFn(extra_time_in_seconds, end_at, boundTakingApiActions.updateTime, boundTakingApiActions.notifyTimeAdded);
|
|
53
|
+
handleExtraTimeFn(webSocketMessageData.extra_time_in_seconds, webSocketMessageData.end_at, boundTakingApiActions.updateTime, boundTakingApiActions.notifyTimeAdded);
|
|
54
54
|
};
|
|
55
55
|
export var createQuizTimerWebSocketMiddleware = function createQuizTimerWebSocketMiddleware() {
|
|
56
56
|
var createWebsocketFn = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : createWebsocket;
|
|
@@ -59,13 +59,7 @@ export var createQuizTimerWebSocketMiddleware = function createQuizTimerWebSocke
|
|
|
59
59
|
return function (store) {
|
|
60
60
|
return function (next) {
|
|
61
61
|
return function (action) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (!addTimeToExistingQuizSessionsEnabled) {
|
|
65
|
-
return next(action);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (action.type === SET_WS_TOKEN && socket === null) {
|
|
62
|
+
if (action.type === SET_WS_TOKEN && featureOnFn('add_time_to_existing_quiz_sessions') && socket === null) {
|
|
69
63
|
var token = action.payload.wsToken;
|
|
70
64
|
socket = initializeWebSocket(token, createWebsocketFn);
|
|
71
65
|
|
package/es/taking/api/taking.js
CHANGED
|
@@ -244,19 +244,20 @@ export function submitQuiz(quizSessionId) {
|
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
export function notifyTimeAdded(extraTime) {
|
|
247
|
+
export function notifyTimeAdded(isUnlimited, extraTime) {
|
|
248
248
|
return function (dispatch) {
|
|
249
|
-
|
|
249
|
+
var message = isUnlimited ? t('Your original time limit has been extended by { extraTime }', {
|
|
250
250
|
extraTime: extraTime
|
|
251
|
-
}))
|
|
251
|
+
}) : t('Unlimited time accommodation has been added to your quiz');
|
|
252
|
+
return dispatch(addInfo(message));
|
|
252
253
|
};
|
|
253
254
|
}
|
|
254
|
-
export function updateTime(timeInSeconds) {
|
|
255
|
+
export function updateTime(timeInSeconds, timerRunning) {
|
|
255
256
|
return function (dispatch) {
|
|
256
257
|
return dispatch(updateTimerInfo({
|
|
257
258
|
timeLeftInSeconds: timeInSeconds,
|
|
258
|
-
timerRunning:
|
|
259
|
-
timeRecording:
|
|
259
|
+
timerRunning: timerRunning,
|
|
260
|
+
timeRecording: false
|
|
260
261
|
}));
|
|
261
262
|
};
|
|
262
263
|
}
|
|
@@ -150,7 +150,8 @@ var copyBankEntry = function copyBankEntry(sourceBankId, bankEntryId, destinatio
|
|
|
150
150
|
source_bank_id: sourceBankId,
|
|
151
151
|
source_bank_entry_id: bankEntryId
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
var followUpActions = [(0, _ui.clear)("".concat(_quizCommon.BANKS_BANK_ENTRY_PAGINATION, ":").concat(destinationBankId))];
|
|
154
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'copy', null, followUpActions);
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
exports.copyBankEntry = copyBankEntry;
|
|
@@ -160,12 +161,14 @@ var moveBankEntry = function moveBankEntry(sourceBankId, bankEntryId, destinatio
|
|
|
160
161
|
source_bank_id: sourceBankId,
|
|
161
162
|
source_bank_entry_id: bankEntryId
|
|
162
163
|
};
|
|
163
|
-
|
|
164
|
+
var followUpActions = [(0, _ui.clear)("".concat(_quizCommon.BANKS_BANK_ENTRY_PAGINATION, ":").concat(destinationBankId)), (0, _ui.clear)("".concat(_quizCommon.BANKS_BANK_ENTRY_PAGINATION, ":").concat(sourceBankId)), (0, _banks2.getBank)(sourceBankId)];
|
|
165
|
+
return copyOrMoveBankEntry(body, destinationBankId, 'move', null, followUpActions);
|
|
164
166
|
};
|
|
165
167
|
|
|
166
168
|
exports.moveBankEntry = moveBankEntry;
|
|
167
169
|
|
|
168
170
|
var copyOrMoveBankEntry = function copyOrMoveBankEntry(body, destinationBankId, operation, query_params) {
|
|
171
|
+
var followUpActions = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [];
|
|
169
172
|
var url = "/api/banks/".concat(destinationBankId, "/bank_entries/").concat(operation);
|
|
170
173
|
return function (dispatch, getState) {
|
|
171
174
|
var fetcher = new _Fetcher.default({
|
|
@@ -180,7 +183,7 @@ var copyOrMoveBankEntry = function copyOrMoveBankEntry(body, destinationBankId,
|
|
|
180
183
|
return fetcher.post(url, {
|
|
181
184
|
body: JSON.stringify(body)
|
|
182
185
|
}).then(function (response) {
|
|
183
|
-
dispatch([(0, _callHandlers.handleBankEntryResponse)(response), (0, _banks.associateEntries)(destinationBankId, [response.id]), (0, _banks2.getBank)(destinationBankId)]);
|
|
186
|
+
dispatch([(0, _callHandlers.handleBankEntryResponse)(response), (0, _banks.associateEntries)(destinationBankId, [response.id]), (0, _banks2.getBank)(destinationBankId)].concat((0, _toConsumableArray2.default)(followUpActions)));
|
|
184
187
|
return response;
|
|
185
188
|
});
|
|
186
189
|
};
|
|
@@ -30,8 +30,9 @@ var handleExtraTime = function handleExtraTime(extraTimeInSeconds, endAt, update
|
|
|
30
30
|
var remainingTimeInMs = new Date(endAt) - Date.now();
|
|
31
31
|
var remainingTimeInSeconds = Math.floor(remainingTimeInMs / 1000);
|
|
32
32
|
var formattedExtraTimeText = (0, _formatTimespan.formatTime)(extraTimeInSeconds);
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
var isUnlimited = endAt === null && extraTimeInSeconds === null;
|
|
34
|
+
updateTimeAction(remainingTimeInSeconds, !isUnlimited);
|
|
35
|
+
notifyTimeAdded(!isUnlimited, !isUnlimited ? formattedExtraTimeText : null);
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
exports.handleExtraTime = handleExtraTime;
|
|
@@ -68,14 +69,13 @@ var handleWebSocketMessage = function handleWebSocketMessage(webSocketMessage, b
|
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
var
|
|
72
|
-
var end_at = webSocketMessageData.end_at;
|
|
72
|
+
var type = webSocketMessageData.type;
|
|
73
73
|
|
|
74
|
-
if (
|
|
74
|
+
if (type !== 'accommodation_changed') {
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
handleExtraTimeFn(extra_time_in_seconds, end_at, boundTakingApiActions.updateTime, boundTakingApiActions.notifyTimeAdded);
|
|
78
|
+
handleExtraTimeFn(webSocketMessageData.extra_time_in_seconds, webSocketMessageData.end_at, boundTakingApiActions.updateTime, boundTakingApiActions.notifyTimeAdded);
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
exports.handleWebSocketMessage = handleWebSocketMessage;
|
|
@@ -87,13 +87,7 @@ var createQuizTimerWebSocketMiddleware = function createQuizTimerWebSocketMiddle
|
|
|
87
87
|
return function (store) {
|
|
88
88
|
return function (next) {
|
|
89
89
|
return function (action) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (!addTimeToExistingQuizSessionsEnabled) {
|
|
93
|
-
return next(action);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (action.type === _quizCommon.SET_WS_TOKEN && socket === null) {
|
|
90
|
+
if (action.type === _quizCommon.SET_WS_TOKEN && featureOnFn('add_time_to_existing_quiz_sessions') && socket === null) {
|
|
97
91
|
var token = action.payload.wsToken;
|
|
98
92
|
socket = initializeWebSocket(token, createWebsocketFn);
|
|
99
93
|
|
package/lib/taking/api/taking.js
CHANGED
|
@@ -301,20 +301,21 @@ function submitQuiz(quizSessionId) {
|
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
function notifyTimeAdded(extraTime) {
|
|
304
|
+
function notifyTimeAdded(isUnlimited, extraTime) {
|
|
305
305
|
return function (dispatch) {
|
|
306
|
-
|
|
306
|
+
var message = isUnlimited ? (0, _formatMessage.default)('Your original time limit has been extended by { extraTime }', {
|
|
307
307
|
extraTime: extraTime
|
|
308
|
-
})));
|
|
308
|
+
}) : (0, _formatMessage.default)('Unlimited time accommodation has been added to your quiz');
|
|
309
|
+
return dispatch((0, _alerts.addInfo)(message));
|
|
309
310
|
};
|
|
310
311
|
}
|
|
311
312
|
|
|
312
|
-
function updateTime(timeInSeconds) {
|
|
313
|
+
function updateTime(timeInSeconds, timerRunning) {
|
|
313
314
|
return function (dispatch) {
|
|
314
315
|
return dispatch((0, _taking.updateTimerInfo)({
|
|
315
316
|
timeLeftInSeconds: timeInSeconds,
|
|
316
|
-
timerRunning:
|
|
317
|
-
timeRecording:
|
|
317
|
+
timerRunning: timerRunning,
|
|
318
|
+
timeRecording: false
|
|
318
319
|
}));
|
|
319
320
|
};
|
|
320
321
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.18.1-rc.
|
|
3
|
+
"version": "20.18.1-rc.2+2937efc1f",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@instructure/emotion": "^8.51.0",
|
|
45
45
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
46
|
"@instructure/outcomes-ui": "^3.2.2",
|
|
47
|
-
"@instructure/quiz-common": "20.18.1-rc.
|
|
48
|
-
"@instructure/quiz-i18n": "20.18.1-rc.
|
|
49
|
-
"@instructure/quiz-interactions": "20.18.1-rc.
|
|
50
|
-
"@instructure/quiz-number-input": "20.18.1-rc.
|
|
51
|
-
"@instructure/quiz-rce": "20.18.1-rc.
|
|
47
|
+
"@instructure/quiz-common": "20.18.1-rc.2+2937efc1f",
|
|
48
|
+
"@instructure/quiz-i18n": "20.18.1-rc.2+2937efc1f",
|
|
49
|
+
"@instructure/quiz-interactions": "20.18.1-rc.2+2937efc1f",
|
|
50
|
+
"@instructure/quiz-number-input": "20.18.1-rc.2+2937efc1f",
|
|
51
|
+
"@instructure/quiz-rce": "20.18.1-rc.2+2937efc1f",
|
|
52
52
|
"@instructure/ui-a11y-content": "^8.51.0",
|
|
53
53
|
"@instructure/ui-alerts": "^8.51.0",
|
|
54
54
|
"@instructure/ui-avatar": "^8.51.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"file-saver": "~2.0.5",
|
|
112
112
|
"humps": "^2.0.0",
|
|
113
113
|
"immutable": "^3.8.1",
|
|
114
|
-
"instructure-validations": "20.18.1-rc.
|
|
114
|
+
"instructure-validations": "20.18.1-rc.2+2937efc1f",
|
|
115
115
|
"ipaddr.js": "^1.5.4",
|
|
116
116
|
"isomorphic-fetch": "^2.2.0",
|
|
117
117
|
"isuuid": "^0.1.0",
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"jquery": "^2.2.3",
|
|
162
162
|
"karma-junit-reporter": "^2.0.1",
|
|
163
163
|
"most-subject": "^5.3.0",
|
|
164
|
-
"quiz-presets": "20.18.1-rc.
|
|
164
|
+
"quiz-presets": "20.18.1-rc.2+2937efc1f",
|
|
165
165
|
"react": "^16.8.6",
|
|
166
166
|
"react-addons-test-utils": "^15.6.2",
|
|
167
167
|
"react-dom": "^16.8.6",
|
|
@@ -177,5 +177,5 @@
|
|
|
177
177
|
"publishConfig": {
|
|
178
178
|
"access": "public"
|
|
179
179
|
},
|
|
180
|
-
"gitHead": "
|
|
180
|
+
"gitHead": "2937efc1fed97381567c711156370de5fb0a7375"
|
|
181
181
|
}
|