@instructure/quiz-core 17.29.2-rc.6 → 17.30.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 +18 -0
- package/es/banks/components/BanksList/presenter.js +0 -4
- package/es/building/api/quizEntries.js +13 -1
- package/es/building/components/layout/header/BuildingButtons/presenter.js +2 -2
- package/es/common/actions/quizEntries.js +10 -1
- package/es/common/components/shared/PrintTrigger/index.js +11 -2
- package/es/common/components/shared/PrintTrigger/presenter.js +27 -7
- package/es/common/reducers/quizEntries.js +10 -1
- package/lib/banks/components/BanksList/presenter.js +0 -4
- package/lib/building/api/quizEntries.js +16 -0
- package/lib/building/components/layout/header/BuildingButtons/presenter.js +2 -2
- package/lib/common/actions/quizEntries.js +11 -0
- package/lib/common/components/shared/PrintTrigger/index.js +14 -2
- package/lib/common/components/shared/PrintTrigger/presenter.js +28 -7
- package/lib/common/reducers/quizEntries.js +9 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [17.30.0](https://gerrit.instructure.com/quizzes-ui/compare/v17.29.1...v17.30.0) (2022-05-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **NumberInput:** Apply decimal input type ([2a95b39](https://gerrit.instructure.com/quizzes-ui/commits/2a95b39ac74a9810fe7c264ad42cbe4b673e84d6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **banks:** banks list accepts usedByCourseEnabled ff ([37bb540](https://gerrit.instructure.com/quizzes-ui/commits/37bb5402fb66e1c00bf5b5b590b2cc000464b9d5))
|
|
17
|
+
* **banks:** remove stimulus info from Item Banks page ([4ca4689](https://gerrit.instructure.com/quizzes-ui/commits/4ca468999a94b2db8c058e5c967f8d02da8a851d))
|
|
18
|
+
* **printing:** support async item sampling from banks ([099a2f4](https://gerrit.instructure.com/quizzes-ui/commits/099a2f46f8391b853d6faa1f554dc9094ee46e0b))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [17.29.1](https://gerrit.instructure.com/quizzes-ui/compare/v17.29.0...v17.29.1) (2022-04-06)
|
|
7
25
|
|
|
8
26
|
**Note:** Version bump only for package @instructure/quiz-core
|
|
@@ -265,7 +265,6 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
265
265
|
_createClass(BanksList, [{
|
|
266
266
|
key: "renderDetails",
|
|
267
267
|
value: function renderDetails(bank) {
|
|
268
|
-
var numStimuli = bank.entryCount - bank.itemEntryCount;
|
|
269
268
|
var separator = ' | ';
|
|
270
269
|
var lastUsedInfo = bank.lastUsed() && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PresentationContent, null, separator), t('Last used { lastUsedDate }', {
|
|
271
270
|
lastUsedDate: this.formatDateMedium(bank.lastUsed())
|
|
@@ -277,9 +276,6 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
|
|
|
277
276
|
updatedDate: this.formatDateMedium(bank.updatedAt())
|
|
278
277
|
}), /*#__PURE__*/React.createElement(PresentationContent, null, separator), t("{\n count, plural,\n one {# Question Total}\n other {# Questions Total}\n }", {
|
|
279
278
|
count: bank.itemEntryCount
|
|
280
|
-
}), /*#__PURE__*/React.createElement(PresentationContent, null, separator), t("{numQuestions} Associated Across\n {numStimuli, plural,\n one {# Stimulus}\n other {# Stimuli}\n }", {
|
|
281
|
-
numQuestions: 0,
|
|
282
|
-
numStimuli: numStimuli
|
|
283
279
|
}), lastUsedInfo));
|
|
284
280
|
}
|
|
285
281
|
}, {
|
|
@@ -5,16 +5,18 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
5
5
|
import pick from 'lodash/pick';
|
|
6
6
|
import pickBy from 'lodash/pickBy';
|
|
7
7
|
import { decamelize } from 'humps';
|
|
8
|
+
import { fromJS } from 'immutable';
|
|
8
9
|
import Fetcher from "../../common/util/Fetcher.js";
|
|
9
10
|
import ExhaustivePaginatedFetcher from "../../common/util/ExhaustivePaginatedFetcher.js";
|
|
10
11
|
import { scrollToItem } from "../../common/actions/scrolling.js";
|
|
11
12
|
import ThunkQueue from "../../common/util/ThunkQueue.js";
|
|
12
13
|
import noop from "../../common/util/noop.js";
|
|
14
|
+
import camelizedVals from "../../common/api/camelizeHelpers.js";
|
|
13
15
|
import { CLONE_QUIZ_ENTRY_CALL, CREATE_QUIZ_ENTRY_CALL, DELETE_QUIZ_ENTRY_CALL, DO_NOTHING, UPDATE_QUIZ_ENTRY_CALL, DELETED_QUIZ_ENTRY, MOVED_QUIZ_ENTRY } from '@instructure/quiz-common';
|
|
14
16
|
import { createItem } from "./items.js";
|
|
15
17
|
import { createStimulus } from "./stimuli.js";
|
|
16
18
|
import { addError } from "../../common/actions/alerts.js";
|
|
17
|
-
import { deleteQuizEntry as deleteQuizEntryAction, deleteStimulusEntry as deleteStimulusEntryAction, moveQuizEntry as moveQuizEntryAction } from "../../common/actions/quizEntries.js";
|
|
19
|
+
import { deleteQuizEntry as deleteQuizEntryAction, deleteStimulusEntry as deleteStimulusEntryAction, moveQuizEntry as moveQuizEntryAction, updateSampleItems as updateSampleItemsAction } from "../../common/actions/quizEntries.js";
|
|
18
20
|
import { set as setUI } from "../../common/actions/ui.js";
|
|
19
21
|
import { associateQuizEntries, disassociateQuizEntry } from "../../common/actions/quizzes.js";
|
|
20
22
|
import { handleQuizEntriesResponse, handleQuizEntryResponse } from "../../common/api/callHandlers.js";
|
|
@@ -59,6 +61,16 @@ export function getQuizEntries(quizId) {
|
|
|
59
61
|
return handleQuizEntriesGet(dispatch, quizId, data);
|
|
60
62
|
}).then(cb);
|
|
61
63
|
};
|
|
64
|
+
}
|
|
65
|
+
export function getSampleItemsForQuizEntry(quizId, quizEntryId) {
|
|
66
|
+
var url = "/api/quizzes/".concat(quizId, "/quiz_entries/").concat(quizEntryId, "/sample_items");
|
|
67
|
+
return function (dispatch, getState) {
|
|
68
|
+
var fetcher = new ExhaustivePaginatedFetcher();
|
|
69
|
+
return fetcher.get(url).then(function (data) {
|
|
70
|
+
var sampleItems = camelizedVals(data);
|
|
71
|
+
dispatch(updateSampleItemsAction(quizEntryId, fromJS(sampleItems)));
|
|
72
|
+
});
|
|
73
|
+
};
|
|
62
74
|
} // =====================
|
|
63
75
|
// =====================
|
|
64
76
|
// CREATE
|
|
@@ -98,7 +98,7 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
98
98
|
key: "printKey",
|
|
99
99
|
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
100
100
|
onSelect: function onSelect() {
|
|
101
|
-
return handlePrint(PRINT_CURRENT_PAGE
|
|
101
|
+
return handlePrint(PRINT_CURRENT_PAGE);
|
|
102
102
|
},
|
|
103
103
|
"data-automation": "sdk-print-key-menuitem"
|
|
104
104
|
}, /*#__PURE__*/React.createElement(IconPrinterLine, {
|
|
@@ -109,7 +109,7 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
109
109
|
key: "printBlank",
|
|
110
110
|
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
111
111
|
onSelect: function onSelect() {
|
|
112
|
-
return handlePrint(PRINT_BLANK
|
|
112
|
+
return handlePrint(PRINT_BLANK);
|
|
113
113
|
},
|
|
114
114
|
"data-automation": "sdk-print-blank-menuitem"
|
|
115
115
|
}, /*#__PURE__*/React.createElement(IconPrinterLine, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ADD_QUIZ_ENTRIES, ADD_QUIZ_ENTRY, DELETE_QUIZ_ENTRY, DELETE_STIMULUS_ENTRY, MOVE_QUIZ_ENTRY } from '@instructure/quiz-common';
|
|
1
|
+
import { ADD_QUIZ_ENTRIES, ADD_QUIZ_ENTRY, DELETE_QUIZ_ENTRY, DELETE_STIMULUS_ENTRY, MOVE_QUIZ_ENTRY, UPDATE_SAMPLE_ITEMS } from '@instructure/quiz-common';
|
|
2
2
|
export function addQuizEntries(quizEntries) {
|
|
3
3
|
return {
|
|
4
4
|
type: ADD_QUIZ_ENTRIES,
|
|
@@ -37,4 +37,13 @@ export function moveQuizEntry(id, position, stimulusQuizEntryId) {
|
|
|
37
37
|
stimulusQuizEntryId: stimulusQuizEntryId
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
+
}
|
|
41
|
+
export function updateSampleItems(id, sampleItems) {
|
|
42
|
+
return {
|
|
43
|
+
type: UPDATE_SAMPLE_ITEMS,
|
|
44
|
+
payload: {
|
|
45
|
+
id: id,
|
|
46
|
+
sampleItems: sampleItems
|
|
47
|
+
}
|
|
48
|
+
};
|
|
40
49
|
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { bindActionCreators } from 'redux';
|
|
2
|
+
import { Map } from 'immutable';
|
|
2
3
|
import { connect } from "../../../react-redux.js";
|
|
3
4
|
import { PrintTrigger as PrintTriggerPresenter } from "./presenter.js";
|
|
4
5
|
import { PRINT_FONT_SIZE_MODAL } from '@instructure/quiz-common';
|
|
5
6
|
import * as printingActions from "../../../actions/printing.js";
|
|
6
7
|
import * as modalActions from "../../../actions/modal.js";
|
|
8
|
+
import * as quizEntriesApiActions from "../../../../building/api/quizEntries.js";
|
|
9
|
+
import { featureOn } from "../../../util/featureCheck.js";
|
|
7
10
|
export function mapStateToProps(state) {
|
|
8
11
|
return {
|
|
9
12
|
appContainer: state.getIn(['ui', 'appContainer']),
|
|
13
|
+
asyncSampleItemsEnabled: featureOn('async_sample_items'),
|
|
14
|
+
bankQuizEntryIds: state.get('quizEntries', Map()).filter(function (quizEntry) {
|
|
15
|
+
return quizEntry.get('entryType') === 'Bank';
|
|
16
|
+
}).keySeq().toArray(),
|
|
10
17
|
printFontSizeModalOpen: state.getIn(['modal', 'isOpen']) === PRINT_FONT_SIZE_MODAL,
|
|
11
|
-
persistedPrintFontSize: state.getIn(['printing', 'fontSizePreference'])
|
|
18
|
+
persistedPrintFontSize: state.getIn(['printing', 'fontSizePreference']),
|
|
19
|
+
activeQuizId: state.getIn(['quizzes', 'activeQuizId'])
|
|
12
20
|
};
|
|
13
21
|
}
|
|
14
22
|
|
|
@@ -17,7 +25,8 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
17
25
|
openPrintFontSizeModal: bindActionCreators(modalActions.openModal.bind(modalActions, PRINT_FONT_SIZE_MODAL), dispatch),
|
|
18
26
|
closePrintFontSizeModal: bindActionCreators(modalActions.closeModal.bind(modalActions, PRINT_FONT_SIZE_MODAL), dispatch),
|
|
19
27
|
persistPrintFontSize: bindActionCreators(printingActions.persistPrintFontSizePreference.bind(printingActions), dispatch),
|
|
20
|
-
setPrintFontSize: bindActionCreators(printingActions.setPrintFontSizePreference.bind(printingActions), dispatch)
|
|
28
|
+
setPrintFontSize: bindActionCreators(printingActions.setPrintFontSizePreference.bind(printingActions), dispatch),
|
|
29
|
+
getSampleItemsForQuizEntry: bindActionCreators(quizEntriesApiActions.getSampleItemsForQuizEntry.bind(quizEntriesApiActions), dispatch)
|
|
21
30
|
};
|
|
22
31
|
};
|
|
23
32
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
@@ -39,7 +40,20 @@ export var PrintTrigger = /*#__PURE__*/function (_Component) {
|
|
|
39
40
|
waitingForPrintingToBeReady: true
|
|
40
41
|
});
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
var sampleItemFetchPromises = [];
|
|
44
|
+
|
|
45
|
+
if (_this.props.asyncSampleItemsEnabled) {
|
|
46
|
+
var _this$props = _this.props,
|
|
47
|
+
activeQuizId = _this$props.activeQuizId,
|
|
48
|
+
bankQuizEntryIds = _this$props.bankQuizEntryIds,
|
|
49
|
+
getSampleItemsForQuizEntry = _this$props.getSampleItemsForQuizEntry;
|
|
50
|
+
sampleItemFetchPromises = bankQuizEntryIds.map(function (bankQuizEntryId) {
|
|
51
|
+
return getSampleItemsForQuizEntry(activeQuizId, bankQuizEntryId);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var allPromises = [].concat(_toConsumableArray(sampleItemFetchPromises), [ensureImagesLoaded(), printFontSizeModalClose]);
|
|
56
|
+
Promise.all(allPromises).then(function () {
|
|
43
57
|
_this.setState({
|
|
44
58
|
waitingForPrintingToBeReady: false
|
|
45
59
|
});
|
|
@@ -114,18 +128,24 @@ export var PrintTrigger = /*#__PURE__*/function (_Component) {
|
|
|
114
128
|
return PrintTrigger;
|
|
115
129
|
}(Component);
|
|
116
130
|
PrintTrigger.propTypes = {
|
|
131
|
+
activeQuizId: PropTypes.string.isRequired,
|
|
117
132
|
appContainer: CustomPropTypes.selectors,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
printFontSizeModalOpen: PropTypes.bool.isRequired,
|
|
121
|
-
openPrintFontSizeModal: PropTypes.func.isRequired,
|
|
133
|
+
asyncSampleItemsEnabled: PropTypes.bool,
|
|
134
|
+
bankQuizEntryIds: PropTypes.arrayOf(PropTypes.string),
|
|
122
135
|
closePrintFontSizeModal: PropTypes.func.isRequired,
|
|
136
|
+
getSampleItemsForQuizEntry: PropTypes.func.isRequired,
|
|
123
137
|
navigateToPreviewPrint: PropTypes.func,
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
openPrintFontSizeModal: PropTypes.func.isRequired,
|
|
139
|
+
persistedPrintFontSize: PropTypes.string,
|
|
140
|
+
persistPrintFontSize: PropTypes.func.isRequired,
|
|
141
|
+
printFontSizeModalOpen: PropTypes.bool.isRequired,
|
|
142
|
+
render: PropTypes.func.isRequired,
|
|
143
|
+
setPrintFontSize: PropTypes.func.isRequired
|
|
126
144
|
};
|
|
127
145
|
PrintTrigger.defaultProps = {
|
|
128
146
|
appContainer: null,
|
|
147
|
+
asyncSampleItemsEnabled: false,
|
|
148
|
+
bankQuizEntryIds: [],
|
|
129
149
|
persistedPrintFontSize: 'medium',
|
|
130
150
|
navigateToPreviewPrint: function navigateToPreviewPrint() {}
|
|
131
151
|
};
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
2
2
|
import { fromJS, Map } from 'immutable';
|
|
3
3
|
import keyBy from 'lodash/keyBy';
|
|
4
4
|
import isArrayLike from 'lodash/isArrayLike';
|
|
5
|
-
import { ADD_QUIZ_ENTRIES, ADD_QUIZ_ENTRY, DELETE_QUIZ_ENTRY, DELETE_STIMULUS_ENTRY, MOVE_QUIZ_ENTRY } from '@instructure/quiz-common';
|
|
5
|
+
import { ADD_QUIZ_ENTRIES, ADD_QUIZ_ENTRY, DELETE_QUIZ_ENTRY, DELETE_STIMULUS_ENTRY, MOVE_QUIZ_ENTRY, UPDATE_SAMPLE_ITEMS } from '@instructure/quiz-common';
|
|
6
6
|
|
|
7
7
|
var addQuizEntries = function addQuizEntries(state, quizEntries) {
|
|
8
8
|
var quizEntriesHash = keyBy(quizEntries, 'id');
|
|
@@ -141,6 +141,12 @@ var moveQuizEntry = function moveQuizEntry(state, _ref4) {
|
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
+
var updateSampleItems = function updateSampleItems(state, _ref5) {
|
|
145
|
+
var id = _ref5.id,
|
|
146
|
+
sampleItems = _ref5.sampleItems;
|
|
147
|
+
return state.setIn([id, 'sampleItems'], sampleItems);
|
|
148
|
+
};
|
|
149
|
+
|
|
144
150
|
export default (function () {
|
|
145
151
|
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Map();
|
|
146
152
|
var action = arguments.length > 1 ? arguments[1] : void 0;
|
|
@@ -161,6 +167,9 @@ export default (function () {
|
|
|
161
167
|
case MOVE_QUIZ_ENTRY:
|
|
162
168
|
return moveQuizEntry(state, action.payload);
|
|
163
169
|
|
|
170
|
+
case UPDATE_SAMPLE_ITEMS:
|
|
171
|
+
return updateSampleItems(state, action.payload);
|
|
172
|
+
|
|
164
173
|
default:
|
|
165
174
|
return state;
|
|
166
175
|
}
|
|
@@ -301,7 +301,6 @@ var BanksList = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _de
|
|
|
301
301
|
(0, _createClass2.default)(BanksList, [{
|
|
302
302
|
key: "renderDetails",
|
|
303
303
|
value: function renderDetails(bank) {
|
|
304
|
-
var numStimuli = bank.entryCount - bank.itemEntryCount;
|
|
305
304
|
var separator = ' | ';
|
|
306
305
|
|
|
307
306
|
var lastUsedInfo = bank.lastUsed() && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_uiA11yContent.PresentationContent, null, separator), (0, _formatMessage.default)('Last used { lastUsedDate }', {
|
|
@@ -315,9 +314,6 @@ var BanksList = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _de
|
|
|
315
314
|
updatedDate: this.formatDateMedium(bank.updatedAt())
|
|
316
315
|
}), /*#__PURE__*/_react.default.createElement(_uiA11yContent.PresentationContent, null, separator), (0, _formatMessage.default)("{\n count, plural,\n one {# Question Total}\n other {# Questions Total}\n }", {
|
|
317
316
|
count: bank.itemEntryCount
|
|
318
|
-
}), /*#__PURE__*/_react.default.createElement(_uiA11yContent.PresentationContent, null, separator), (0, _formatMessage.default)("{numQuestions} Associated Across\n {numStimuli, plural,\n one {# Stimulus}\n other {# Stimuli}\n }", {
|
|
319
|
-
numQuestions: 0,
|
|
320
|
-
numStimuli: numStimuli
|
|
321
317
|
}), lastUsedInfo));
|
|
322
318
|
}
|
|
323
319
|
}, {
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.getQuizEntry = getQuizEntry;
|
|
9
9
|
exports.getQuizEntries = getQuizEntries;
|
|
10
|
+
exports.getSampleItemsForQuizEntry = getSampleItemsForQuizEntry;
|
|
10
11
|
exports.createQuizEntry = createQuizEntry;
|
|
11
12
|
exports.updateQuizEntry = updateQuizEntry;
|
|
12
13
|
exports.cloneQuizEntry = cloneQuizEntry;
|
|
@@ -30,6 +31,8 @@ var _pickBy = _interopRequireDefault(require("lodash/pickBy"));
|
|
|
30
31
|
|
|
31
32
|
var _humps = require("humps");
|
|
32
33
|
|
|
34
|
+
var _immutable = require("immutable");
|
|
35
|
+
|
|
33
36
|
var _Fetcher = _interopRequireDefault(require("../../common/util/Fetcher.js"));
|
|
34
37
|
|
|
35
38
|
var _ExhaustivePaginatedFetcher = _interopRequireDefault(require("../../common/util/ExhaustivePaginatedFetcher.js"));
|
|
@@ -40,6 +43,8 @@ var _ThunkQueue = _interopRequireDefault(require("../../common/util/ThunkQueue.j
|
|
|
40
43
|
|
|
41
44
|
var _noop = _interopRequireDefault(require("../../common/util/noop.js"));
|
|
42
45
|
|
|
46
|
+
var _camelizeHelpers = _interopRequireDefault(require("../../common/api/camelizeHelpers.js"));
|
|
47
|
+
|
|
43
48
|
var _quizCommon = require("@instructure/quiz-common");
|
|
44
49
|
|
|
45
50
|
var _items = require("./items.js");
|
|
@@ -101,6 +106,17 @@ function getQuizEntries(quizId) {
|
|
|
101
106
|
return handleQuizEntriesGet(dispatch, quizId, data);
|
|
102
107
|
}).then(cb);
|
|
103
108
|
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getSampleItemsForQuizEntry(quizId, quizEntryId) {
|
|
112
|
+
var url = "/api/quizzes/".concat(quizId, "/quiz_entries/").concat(quizEntryId, "/sample_items");
|
|
113
|
+
return function (dispatch, getState) {
|
|
114
|
+
var fetcher = new _ExhaustivePaginatedFetcher.default();
|
|
115
|
+
return fetcher.get(url).then(function (data) {
|
|
116
|
+
var sampleItems = (0, _camelizeHelpers.default)(data);
|
|
117
|
+
dispatch((0, _quizEntries.updateSampleItems)(quizEntryId, (0, _immutable.fromJS)(sampleItems)));
|
|
118
|
+
});
|
|
119
|
+
};
|
|
104
120
|
} // =====================
|
|
105
121
|
// =====================
|
|
106
122
|
// CREATE
|
|
@@ -123,7 +123,7 @@ var BuildingButtons = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
123
123
|
key: "printKey",
|
|
124
124
|
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
125
125
|
onSelect: function onSelect() {
|
|
126
|
-
return handlePrint(_quizCommon.PRINT_CURRENT_PAGE
|
|
126
|
+
return handlePrint(_quizCommon.PRINT_CURRENT_PAGE);
|
|
127
127
|
},
|
|
128
128
|
"data-automation": "sdk-print-key-menuitem"
|
|
129
129
|
}, /*#__PURE__*/_react.default.createElement(_uiIcons.IconPrinterLine, {
|
|
@@ -134,7 +134,7 @@ var BuildingButtons = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
134
134
|
key: "printBlank",
|
|
135
135
|
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
136
136
|
onSelect: function onSelect() {
|
|
137
|
-
return handlePrint(_quizCommon.PRINT_BLANK
|
|
137
|
+
return handlePrint(_quizCommon.PRINT_BLANK);
|
|
138
138
|
},
|
|
139
139
|
"data-automation": "sdk-print-blank-menuitem"
|
|
140
140
|
}, /*#__PURE__*/_react.default.createElement(_uiIcons.IconPrinterLine, {
|
|
@@ -8,6 +8,7 @@ exports.addQuizEntry = addQuizEntry;
|
|
|
8
8
|
exports.deleteQuizEntry = deleteQuizEntry;
|
|
9
9
|
exports.deleteStimulusEntry = deleteStimulusEntry;
|
|
10
10
|
exports.moveQuizEntry = moveQuizEntry;
|
|
11
|
+
exports.updateSampleItems = updateSampleItems;
|
|
11
12
|
|
|
12
13
|
var _quizCommon = require("@instructure/quiz-common");
|
|
13
14
|
|
|
@@ -53,4 +54,14 @@ function moveQuizEntry(id, position, stimulusQuizEntryId) {
|
|
|
53
54
|
stimulusQuizEntryId: stimulusQuizEntryId
|
|
54
55
|
}
|
|
55
56
|
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function updateSampleItems(id, sampleItems) {
|
|
60
|
+
return {
|
|
61
|
+
type: _quizCommon.UPDATE_SAMPLE_ITEMS,
|
|
62
|
+
payload: {
|
|
63
|
+
id: id,
|
|
64
|
+
sampleItems: sampleItems
|
|
65
|
+
}
|
|
66
|
+
};
|
|
56
67
|
}
|
|
@@ -10,6 +10,8 @@ exports.default = exports.PrintTrigger = void 0;
|
|
|
10
10
|
|
|
11
11
|
var _redux = require("redux");
|
|
12
12
|
|
|
13
|
+
var _immutable = require("immutable");
|
|
14
|
+
|
|
13
15
|
var _reactRedux = require("../../../react-redux.js");
|
|
14
16
|
|
|
15
17
|
var _presenter = require("./presenter.js");
|
|
@@ -20,11 +22,20 @@ var printingActions = _interopRequireWildcard(require("../../../actions/printing
|
|
|
20
22
|
|
|
21
23
|
var modalActions = _interopRequireWildcard(require("../../../actions/modal.js"));
|
|
22
24
|
|
|
25
|
+
var quizEntriesApiActions = _interopRequireWildcard(require("../../../../building/api/quizEntries.js"));
|
|
26
|
+
|
|
27
|
+
var _featureCheck = require("../../../util/featureCheck.js");
|
|
28
|
+
|
|
23
29
|
function mapStateToProps(state) {
|
|
24
30
|
return {
|
|
25
31
|
appContainer: state.getIn(['ui', 'appContainer']),
|
|
32
|
+
asyncSampleItemsEnabled: (0, _featureCheck.featureOn)('async_sample_items'),
|
|
33
|
+
bankQuizEntryIds: state.get('quizEntries', (0, _immutable.Map)()).filter(function (quizEntry) {
|
|
34
|
+
return quizEntry.get('entryType') === 'Bank';
|
|
35
|
+
}).keySeq().toArray(),
|
|
26
36
|
printFontSizeModalOpen: state.getIn(['modal', 'isOpen']) === _quizCommon.PRINT_FONT_SIZE_MODAL,
|
|
27
|
-
persistedPrintFontSize: state.getIn(['printing', 'fontSizePreference'])
|
|
37
|
+
persistedPrintFontSize: state.getIn(['printing', 'fontSizePreference']),
|
|
38
|
+
activeQuizId: state.getIn(['quizzes', 'activeQuizId'])
|
|
28
39
|
};
|
|
29
40
|
}
|
|
30
41
|
|
|
@@ -33,7 +44,8 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
33
44
|
openPrintFontSizeModal: (0, _redux.bindActionCreators)(modalActions.openModal.bind(modalActions, _quizCommon.PRINT_FONT_SIZE_MODAL), dispatch),
|
|
34
45
|
closePrintFontSizeModal: (0, _redux.bindActionCreators)(modalActions.closeModal.bind(modalActions, _quizCommon.PRINT_FONT_SIZE_MODAL), dispatch),
|
|
35
46
|
persistPrintFontSize: (0, _redux.bindActionCreators)(printingActions.persistPrintFontSizePreference.bind(printingActions), dispatch),
|
|
36
|
-
setPrintFontSize: (0, _redux.bindActionCreators)(printingActions.setPrintFontSizePreference.bind(printingActions), dispatch)
|
|
47
|
+
setPrintFontSize: (0, _redux.bindActionCreators)(printingActions.setPrintFontSizePreference.bind(printingActions), dispatch),
|
|
48
|
+
getSampleItemsForQuizEntry: (0, _redux.bindActionCreators)(quizEntriesApiActions.getSampleItemsForQuizEntry.bind(quizEntriesApiActions), dispatch)
|
|
37
49
|
};
|
|
38
50
|
};
|
|
39
51
|
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = exports.PrintTrigger = void 0;
|
|
11
11
|
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
15
|
|
|
14
16
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -63,7 +65,20 @@ var PrintTrigger = /*#__PURE__*/function (_Component) {
|
|
|
63
65
|
waitingForPrintingToBeReady: true
|
|
64
66
|
});
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
var sampleItemFetchPromises = [];
|
|
69
|
+
|
|
70
|
+
if (_this.props.asyncSampleItemsEnabled) {
|
|
71
|
+
var _this$props = _this.props,
|
|
72
|
+
activeQuizId = _this$props.activeQuizId,
|
|
73
|
+
bankQuizEntryIds = _this$props.bankQuizEntryIds,
|
|
74
|
+
getSampleItemsForQuizEntry = _this$props.getSampleItemsForQuizEntry;
|
|
75
|
+
sampleItemFetchPromises = bankQuizEntryIds.map(function (bankQuizEntryId) {
|
|
76
|
+
return getSampleItemsForQuizEntry(activeQuizId, bankQuizEntryId);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var allPromises = [].concat((0, _toConsumableArray2.default)(sampleItemFetchPromises), [(0, _printUtils.ensureImagesLoaded)(), printFontSizeModalClose]);
|
|
81
|
+
Promise.all(allPromises).then(function () {
|
|
67
82
|
_this.setState({
|
|
68
83
|
waitingForPrintingToBeReady: false
|
|
69
84
|
});
|
|
@@ -139,18 +154,24 @@ var PrintTrigger = /*#__PURE__*/function (_Component) {
|
|
|
139
154
|
|
|
140
155
|
exports.PrintTrigger = PrintTrigger;
|
|
141
156
|
PrintTrigger.propTypes = {
|
|
157
|
+
activeQuizId: _propTypes.default.string.isRequired,
|
|
142
158
|
appContainer: _CustomPropTypes.default.selectors,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
printFontSizeModalOpen: _propTypes.default.bool.isRequired,
|
|
146
|
-
openPrintFontSizeModal: _propTypes.default.func.isRequired,
|
|
159
|
+
asyncSampleItemsEnabled: _propTypes.default.bool,
|
|
160
|
+
bankQuizEntryIds: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
147
161
|
closePrintFontSizeModal: _propTypes.default.func.isRequired,
|
|
162
|
+
getSampleItemsForQuizEntry: _propTypes.default.func.isRequired,
|
|
148
163
|
navigateToPreviewPrint: _propTypes.default.func,
|
|
149
|
-
|
|
150
|
-
|
|
164
|
+
openPrintFontSizeModal: _propTypes.default.func.isRequired,
|
|
165
|
+
persistedPrintFontSize: _propTypes.default.string,
|
|
166
|
+
persistPrintFontSize: _propTypes.default.func.isRequired,
|
|
167
|
+
printFontSizeModalOpen: _propTypes.default.bool.isRequired,
|
|
168
|
+
render: _propTypes.default.func.isRequired,
|
|
169
|
+
setPrintFontSize: _propTypes.default.func.isRequired
|
|
151
170
|
};
|
|
152
171
|
PrintTrigger.defaultProps = {
|
|
153
172
|
appContainer: null,
|
|
173
|
+
asyncSampleItemsEnabled: false,
|
|
174
|
+
bankQuizEntryIds: [],
|
|
154
175
|
persistedPrintFontSize: 'medium',
|
|
155
176
|
navigateToPreviewPrint: function navigateToPreviewPrint() {}
|
|
156
177
|
};
|
|
@@ -154,6 +154,12 @@ var moveQuizEntry = function moveQuizEntry(state, _ref4) {
|
|
|
154
154
|
});
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
+
var updateSampleItems = function updateSampleItems(state, _ref5) {
|
|
158
|
+
var id = _ref5.id,
|
|
159
|
+
sampleItems = _ref5.sampleItems;
|
|
160
|
+
return state.setIn([id, 'sampleItems'], sampleItems);
|
|
161
|
+
};
|
|
162
|
+
|
|
157
163
|
var _default = function _default() {
|
|
158
164
|
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (0, _immutable.Map)();
|
|
159
165
|
var action = arguments.length > 1 ? arguments[1] : void 0;
|
|
@@ -174,6 +180,9 @@ var _default = function _default() {
|
|
|
174
180
|
case _quizCommon.MOVE_QUIZ_ENTRY:
|
|
175
181
|
return moveQuizEntry(state, action.payload);
|
|
176
182
|
|
|
183
|
+
case _quizCommon.UPDATE_SAMPLE_ITEMS:
|
|
184
|
+
return updateSampleItems(state, action.payload);
|
|
185
|
+
|
|
177
186
|
default:
|
|
178
187
|
return state;
|
|
179
188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.30.0",
|
|
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.
|
|
45
|
-
"@instructure/quiz-i18n": "17.
|
|
46
|
-
"@instructure/quiz-interactions": "17.
|
|
47
|
-
"@instructure/quiz-number-input": "17.
|
|
48
|
-
"@instructure/quiz-rce": "17.
|
|
44
|
+
"@instructure/quiz-common": "^17.30.0",
|
|
45
|
+
"@instructure/quiz-i18n": "^17.30.0",
|
|
46
|
+
"@instructure/quiz-interactions": "^17.30.0",
|
|
47
|
+
"@instructure/quiz-number-input": "^17.30.0",
|
|
48
|
+
"@instructure/quiz-rce": "^17.30.0",
|
|
49
49
|
"@instructure/ui-a11y-content": "^7.11.0",
|
|
50
50
|
"@instructure/ui-alerts": "^7.11.0",
|
|
51
51
|
"@instructure/ui-avatar": "^7.11.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.
|
|
109
|
+
"instructure-validations": "^17.30.0",
|
|
110
110
|
"ipaddr.js": "^1.5.4",
|
|
111
111
|
"isomorphic-fetch": "^2.2.0",
|
|
112
112
|
"isuuid": "^0.1.0",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"uuid": "^3.2.1"
|
|
138
138
|
},
|
|
139
139
|
"devDependencies": {
|
|
140
|
-
"@instructure/quiz-scripts": "17.
|
|
140
|
+
"@instructure/quiz-scripts": "^17.30.0",
|
|
141
141
|
"@instructure/ui-axe-check": "^7.11.0",
|
|
142
142
|
"@instructure/ui-babel-preset": "^7.11.0",
|
|
143
143
|
"@instructure/ui-karma-config": "^7.11.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.
|
|
159
|
+
"quiz-presets": "^17.30.0",
|
|
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": "0051eb4175d8726afddd2c5620cece18214a0cce"
|
|
176
176
|
}
|