@instructure/quiz-core 17.41.1-rc.1 → 17.41.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.
@@ -2,6 +2,7 @@ import * as immutable from 'immutable';
2
2
  import { Bank as BankPresenter } from "./presenter.js";
3
3
  import { connect } from "../../../common/react-redux.js";
4
4
  import BankRecord from "../../../common/records/Bank.js";
5
+ import { getActiveQuiz } from "../../../common/selectors/quizzes.js";
5
6
  import { getBank } from "../../../banks/api/banks.js";
6
7
  import { getBankEntries } from "../../../banks/api/bankEntries.js";
7
8
  import { createQuizEntry } from "../../../building/api/quizEntries.js";
@@ -14,8 +15,12 @@ import { featureOn } from "../../../common/util/featureCheck.js";
14
15
  function mapStateToProps(state, props) {
15
16
  var bank = new BankRecord(state.getIn(['banks', props.bankId]));
16
17
  var search = state.get('bankSearch', immutable.Map());
18
+ var activeQuiz = getActiveQuiz(state);
19
+ var lockBlueprintContentEnabled = featureOn('lock_blueprint_content');
20
+ var isQuizContentLocked = activeQuiz && activeQuiz.originalQuizLockedByBlueprint && lockBlueprintContentEnabled;
17
21
  return {
18
22
  bank: bank,
23
+ isQuizContentLocked: isQuizContentLocked,
19
24
  search: search,
20
25
  useBankSearch: featureOn('item_bank_search'),
21
26
  position: state.getIn(['ui', BUILD_TRAY_POSITION]),
@@ -158,7 +158,8 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
158
158
  addEntryToQuiz: addEntryFunc,
159
159
  bank: _this.props.bank,
160
160
  navigateToBankEntry: _this.props.navigateToBankEntry,
161
- recordIds: recordIds
161
+ recordIds: recordIds,
162
+ isQuizContentLocked: _this.props.isQuizContentLocked
162
163
  });
163
164
  };
164
165
 
@@ -242,7 +243,7 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
242
243
  value: function renderMultiAdd() {
243
244
  var isEmpty = this.props.bank.itemEntryCount === 0;
244
245
 
245
- if (this.props.isCompact && !isEmpty) {
246
+ if (this.props.isCompact && !this.props.isQuizContentLocked && !isEmpty) {
246
247
  return /*#__PURE__*/React.createElement(Button, {
247
248
  onClick: this.addBankToQuiz,
248
249
  margin: "small none",
@@ -315,6 +316,7 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
315
316
  getBank: PropTypes.func.isRequired,
316
317
  getBankEntries: PropTypes.func.isRequired,
317
318
  isCompact: PropTypes.bool,
319
+ isQuizContentLocked: PropTypes.bool.isRequired,
318
320
  navigateToBanks: PropTypes.func.isRequired,
319
321
  // can be from consumer
320
322
  navigateToBankEntry: PropTypes.func.isRequired,
@@ -346,6 +348,7 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
346
348
  position: 0,
347
349
  stimulusId: null,
348
350
  scope: {},
349
- returnToUrl: null
351
+ returnToUrl: null,
352
+ isQuizContentLocked: false
350
353
  }, _temp)) || _class);
351
354
  export default Bank;
@@ -44,7 +44,8 @@ export var BankEntriesList = (_dec = themeable(theme, styles), _dec(_class = (_t
44
44
  bankEntry: entry,
45
45
  bank: _this.props.bank,
46
46
  navigateToBankEntry: _this.props.navigateToBankEntry,
47
- addEntryToQuiz: _this.props.addEntryToQuiz
47
+ addEntryToQuiz: _this.props.addEntryToQuiz,
48
+ isQuizContentLocked: _this.props.isQuizContentLocked
48
49
  }));
49
50
  };
50
51
 
@@ -64,8 +65,10 @@ export var BankEntriesList = (_dec = themeable(theme, styles), _dec(_class = (_t
64
65
  addEntryToQuiz: PropTypes.func,
65
66
  bank: ImmutablePropTypes.record.isRequired,
66
67
  bankEntries: ImmutablePropTypes.list.isRequired,
67
- navigateToBankEntry: PropTypes.func.isRequired
68
+ navigateToBankEntry: PropTypes.func.isRequired,
69
+ isQuizContentLocked: PropTypes.bool.isRequired
68
70
  }, _class2.defaultProps = {
69
- addEntryToQuiz: null
71
+ addEntryToQuiz: null,
72
+ isQuizContentLocked: false
70
73
  }, _temp)) || _class);
71
74
  export default BankEntriesList;
@@ -217,7 +217,7 @@ export var BankEntryRow = (_dec = themeable(theme, styles), _dec(_class = (_temp
217
217
  }, {
218
218
  key: "renderAddButton",
219
219
  value: function renderAddButton() {
220
- if (this.props.addEntryToQuiz) {
220
+ if (!this.props.isQuizContentLocked && this.props.addEntryToQuiz) {
221
221
  var title = t('Add {type} to this quiz', {
222
222
  type: this.type()
223
223
  });
@@ -384,6 +384,7 @@ export var BankEntryRow = (_dec = themeable(theme, styles), _dec(_class = (_temp
384
384
  clearUi: PropTypes.func.isRequired,
385
385
  createItem: PropTypes.func.isRequired,
386
386
  createStimulus: PropTypes.func.isRequired,
387
+ isQuizContentLocked: PropTypes.bool.isRequired,
387
388
  isExpanded: PropTypes.bool,
388
389
  navigateToBankEntry: PropTypes.func.isRequired,
389
390
  openModal: PropTypes.func.isRequired,
@@ -403,6 +404,7 @@ export var BankEntryRow = (_dec = themeable(theme, styles), _dec(_class = (_temp
403
404
  activeQuizId: null,
404
405
  addEntryToQuiz: null,
405
406
  stimulusId: null,
407
+ isQuizContentLocked: false,
406
408
  isExpanded: false,
407
409
  position: 0,
408
410
  setEditButtonFocus: false,
@@ -17,6 +17,8 @@ var _reactRedux = require("../../../common/react-redux.js");
17
17
 
18
18
  var _Bank = _interopRequireDefault(require("../../../common/records/Bank.js"));
19
19
 
20
+ var _quizzes = require("../../../common/selectors/quizzes.js");
21
+
20
22
  var _banks = require("../../../banks/api/banks.js");
21
23
 
22
24
  var _bankEntries = require("../../../banks/api/bankEntries.js");
@@ -36,8 +38,12 @@ var _featureCheck = require("../../../common/util/featureCheck.js");
36
38
  function mapStateToProps(state, props) {
37
39
  var bank = new _Bank.default(state.getIn(['banks', props.bankId]));
38
40
  var search = state.get('bankSearch', immutable.Map());
41
+ var activeQuiz = (0, _quizzes.getActiveQuiz)(state);
42
+ var lockBlueprintContentEnabled = (0, _featureCheck.featureOn)('lock_blueprint_content');
43
+ var isQuizContentLocked = activeQuiz && activeQuiz.originalQuizLockedByBlueprint && lockBlueprintContentEnabled;
39
44
  return {
40
45
  bank: bank,
46
+ isQuizContentLocked: isQuizContentLocked,
41
47
  search: search,
42
48
  useBankSearch: (0, _featureCheck.featureOn)('item_bank_search'),
43
49
  position: state.getIn(['ui', _quizCommon.BUILD_TRAY_POSITION]),
@@ -196,7 +196,8 @@ var Bank = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_cl
196
196
  addEntryToQuiz: addEntryFunc,
197
197
  bank: _this.props.bank,
198
198
  navigateToBankEntry: _this.props.navigateToBankEntry,
199
- recordIds: recordIds
199
+ recordIds: recordIds,
200
+ isQuizContentLocked: _this.props.isQuizContentLocked
200
201
  });
201
202
  };
202
203
 
@@ -280,7 +281,7 @@ var Bank = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_cl
280
281
  value: function renderMultiAdd() {
281
282
  var isEmpty = this.props.bank.itemEntryCount === 0;
282
283
 
283
- if (this.props.isCompact && !isEmpty) {
284
+ if (this.props.isCompact && !this.props.isQuizContentLocked && !isEmpty) {
284
285
  return /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
285
286
  onClick: this.addBankToQuiz,
286
287
  margin: "small none",
@@ -352,6 +353,7 @@ var Bank = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_cl
352
353
  getBank: _propTypes.default.func.isRequired,
353
354
  getBankEntries: _propTypes.default.func.isRequired,
354
355
  isCompact: _propTypes.default.bool,
356
+ isQuizContentLocked: _propTypes.default.bool.isRequired,
355
357
  navigateToBanks: _propTypes.default.func.isRequired,
356
358
  // can be from consumer
357
359
  navigateToBankEntry: _propTypes.default.func.isRequired,
@@ -383,7 +385,8 @@ var Bank = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_cl
383
385
  position: 0,
384
386
  stimulusId: null,
385
387
  scope: {},
386
- returnToUrl: null
388
+ returnToUrl: null,
389
+ isQuizContentLocked: false
387
390
  }, _temp)) || _class);
388
391
  exports.Bank = Bank;
389
392
  var _default = Bank;
@@ -65,7 +65,8 @@ var BankEntriesList = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
65
65
  bankEntry: entry,
66
66
  bank: _this.props.bank,
67
67
  navigateToBankEntry: _this.props.navigateToBankEntry,
68
- addEntryToQuiz: _this.props.addEntryToQuiz
68
+ addEntryToQuiz: _this.props.addEntryToQuiz,
69
+ isQuizContentLocked: _this.props.isQuizContentLocked
69
70
  }));
70
71
  };
71
72
 
@@ -84,9 +85,11 @@ var BankEntriesList = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
84
85
  addEntryToQuiz: _propTypes.default.func,
85
86
  bank: _reactImmutableProptypes.default.record.isRequired,
86
87
  bankEntries: _reactImmutableProptypes.default.list.isRequired,
87
- navigateToBankEntry: _propTypes.default.func.isRequired
88
+ navigateToBankEntry: _propTypes.default.func.isRequired,
89
+ isQuizContentLocked: _propTypes.default.bool.isRequired
88
90
  }, _class2.defaultProps = {
89
- addEntryToQuiz: null
91
+ addEntryToQuiz: null,
92
+ isQuizContentLocked: false
90
93
  }, _temp)) || _class);
91
94
  exports.BankEntriesList = BankEntriesList;
92
95
  var _default = BankEntriesList;
@@ -259,7 +259,7 @@ var BankEntryRow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
259
259
  }, {
260
260
  key: "renderAddButton",
261
261
  value: function renderAddButton() {
262
- if (this.props.addEntryToQuiz) {
262
+ if (!this.props.isQuizContentLocked && this.props.addEntryToQuiz) {
263
263
  var title = (0, _formatMessage.default)('Add {type} to this quiz', {
264
264
  type: this.type()
265
265
  });
@@ -426,6 +426,7 @@ var BankEntryRow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
426
426
  clearUi: _propTypes.default.func.isRequired,
427
427
  createItem: _propTypes.default.func.isRequired,
428
428
  createStimulus: _propTypes.default.func.isRequired,
429
+ isQuizContentLocked: _propTypes.default.bool.isRequired,
429
430
  isExpanded: _propTypes.default.bool,
430
431
  navigateToBankEntry: _propTypes.default.func.isRequired,
431
432
  openModal: _propTypes.default.func.isRequired,
@@ -445,6 +446,7 @@ var BankEntryRow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
445
446
  activeQuizId: null,
446
447
  addEntryToQuiz: null,
447
448
  stimulusId: null,
449
+ isQuizContentLocked: false,
448
450
  isExpanded: false,
449
451
  position: 0,
450
452
  setEditButtonFocus: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "17.41.1-rc.1+44971655e",
3
+ "version": "17.41.1-rc.2+4ee219bd8",
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.41.1-rc.1+44971655e",
45
- "@instructure/quiz-i18n": "17.41.1-rc.1+44971655e",
46
- "@instructure/quiz-interactions": "17.41.1-rc.1+44971655e",
47
- "@instructure/quiz-number-input": "17.41.1-rc.1+44971655e",
48
- "@instructure/quiz-rce": "17.41.1-rc.1+44971655e",
44
+ "@instructure/quiz-common": "17.41.1-rc.2+4ee219bd8",
45
+ "@instructure/quiz-i18n": "17.41.1-rc.2+4ee219bd8",
46
+ "@instructure/quiz-interactions": "17.41.1-rc.2+4ee219bd8",
47
+ "@instructure/quiz-number-input": "17.41.1-rc.2+4ee219bd8",
48
+ "@instructure/quiz-rce": "17.41.1-rc.2+4ee219bd8",
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.41.1-rc.1+44971655e",
109
+ "instructure-validations": "17.41.1-rc.2+4ee219bd8",
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.41.1-rc.1+44971655e",
140
+ "@instructure/quiz-scripts": "17.41.1-rc.2+4ee219bd8",
141
141
  "@instructure/ui-axe-check": "^7.20.0",
142
142
  "@instructure/ui-babel-preset": "^7.20.0",
143
143
  "@instructure/ui-karma-config": "^7.20.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.41.1-rc.1+44971655e",
159
+ "quiz-presets": "17.41.1-rc.2+4ee219bd8",
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": "44971655ee872f205ea6222a5ddebc4cc95918ee"
175
+ "gitHead": "4ee219bd850a5f80f240a4cd3ceaf6af13a01f07"
176
176
  }