@instructure/quiz-core 17.45.1-rc.1 → 17.45.1

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 CHANGED
@@ -3,6 +3,17 @@
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.45.1](https://gerrit.instructure.com/quizzes-ui/compare/v17.45.0...v17.45.1) (2022-12-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **RCE:** prevent double requests with use_new_rce enabled ([a59dd40](https://gerrit.instructure.com/quizzes-ui/commits/a59dd404e5e28b14b94b79ec1526be2d44e816cb))
12
+
13
+
14
+
15
+
16
+
6
17
  # [17.45.0](https://gerrit.instructure.com/quizzes-ui/compare/v17.44.0...v17.45.0) (2022-12-13)
7
18
 
8
19
 
@@ -1,4 +1,4 @@
1
- import { CLEAR_UI, MERGE_UI, SET_UI, TOGGLE_UI, OCCLUDE_QUIZ_ENTRIES, ACTIVE_BANK_CHANGE, ACTIVE_BANK_ENTRY_CHANGE } from '@instructure/quiz-common';
1
+ import { CLEAR_UI, MERGE_UI, SET_UI, TOGGLE_UI, OCCLUDE_QUIZ_ENTRIES, ACTIVE_BANK_CHANGE, ACTIVE_BANK_ENTRY_CHANGE, LOADED_API_FEATURES } from '@instructure/quiz-common';
2
2
  export var clear = function clear(key) {
3
3
  return {
4
4
  payload: key,
@@ -47,6 +47,12 @@ export var newActiveBankEntry = function newActiveBankEntry(activeBankEntryId) {
47
47
  payload: activeBankEntryId
48
48
  };
49
49
  };
50
+ export var loadedApiFeatures = function loadedApiFeatures(loaded) {
51
+ return {
52
+ type: LOADED_API_FEATURES,
53
+ payload: loaded
54
+ };
55
+ };
50
56
  export var setActiveCalculatorId = function setActiveCalculatorId(id) {
51
57
  return set('activeCalculatorId', id);
52
58
  };
@@ -1,5 +1,6 @@
1
1
  import Fetcher from "../util/Fetcher.js";
2
2
  import { addFeatures } from "../actions/features.js";
3
+ import { loadedApiFeatures } from "../actions/ui.js";
3
4
  export var getFeatures = function getFeatures() {
4
5
  var url = '/api/features';
5
6
  return function (dispatch, getState) {
@@ -9,6 +10,8 @@ export var getFeatures = function getFeatures() {
9
10
  dispatch(addFeatures(featuresList));
10
11
  };
11
12
 
12
- return fetcher.get(url).then(addFeaturesToStore);
13
+ return fetcher.get(url).then(addFeaturesToStore).then(function () {
14
+ return dispatch(loadedApiFeatures(true));
15
+ });
13
16
  };
14
17
  };
@@ -1,5 +1,5 @@
1
1
  import { fromJS } from 'immutable';
2
- import { ACTIVE_BANK_CHANGE, ACTIVE_BANK_ENTRY_CHANGE, CLEAR_UI, MERGE_UI, SET_UI, TOGGLE_UI, OCCLUDE_QUIZ_ENTRIES } from '@instructure/quiz-common';
2
+ import { ACTIVE_BANK_CHANGE, ACTIVE_BANK_ENTRY_CHANGE, CLEAR_UI, MERGE_UI, SET_UI, TOGGLE_UI, OCCLUDE_QUIZ_ENTRIES, LOADED_API_FEATURES } from '@instructure/quiz-common';
3
3
 
4
4
  var toggle = function toggle(state, key) {
5
5
  return state.update(key, function (value) {
@@ -34,6 +34,9 @@ export default (function () {
34
34
  case ACTIVE_BANK_ENTRY_CHANGE:
35
35
  return state.set('activeBankEntryId', action.payload);
36
36
 
37
+ case LOADED_API_FEATURES:
38
+ return state.set('loadedApiFeatures', action.payload);
39
+
37
40
  default:
38
41
  return state;
39
42
  }
@@ -185,10 +185,20 @@ export var RceConfigProviderComponent = function RceConfigProviderComponent(prop
185
185
  }, _callee2, null, [[2, 21, 25, 28]]);
186
186
  }))();
187
187
  }, [props.useNewRce]);
188
- if (!props.useNewRce) return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
189
- return canvasConfigLoading ? _ref4 : /*#__PURE__*/React.createElement(RceConfigContext.Provider, {
190
- value: getConfig()
191
- }, props.children);
188
+
189
+ if (props.loadedApiFeatures) {
190
+ if (props.useNewRce) {
191
+ if (!canvasConfigLoading) {
192
+ return /*#__PURE__*/React.createElement(RceConfigContext.Provider, {
193
+ value: getConfig()
194
+ }, props.children);
195
+ }
196
+ } else {
197
+ return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
198
+ }
199
+ }
200
+
201
+ return _ref4;
192
202
  };
193
203
  RceConfigProviderComponent.propTypes = {
194
204
  children: PropTypes.node.isRequired,
@@ -200,7 +210,8 @@ RceConfigProviderComponent.propTypes = {
200
210
  rcsHost: PropTypes.string,
201
211
  rcsJwt: PropTypes.string,
202
212
  rcsJwtRefreshFn: PropTypes.func,
203
- canvasOrigin: PropTypes.string
213
+ canvasOrigin: PropTypes.string,
214
+ loadedApiFeatures: PropTypes.bool
204
215
  };
205
216
  RceConfigProviderComponent.defaultProps = {
206
217
  contextId: null,
@@ -209,12 +220,14 @@ RceConfigProviderComponent.defaultProps = {
209
220
  rcsHost: null,
210
221
  rcsJwt: null,
211
222
  rcsJwtRefreshFn: null,
212
- canvasOrigin: null
223
+ canvasOrigin: null,
224
+ loadedApiFeatures: false
213
225
  };
214
226
 
215
- var mapStateToProps = function mapStateToProps() {
227
+ var mapStateToProps = function mapStateToProps(state, ownProps) {
216
228
  return {
217
- useNewRce: isNewRCEEnabled()
229
+ useNewRce: isNewRCEEnabled(),
230
+ loadedApiFeatures: state.getIn(['ui', 'loadedApiFeatures']) || ownProps.loadedApiFeatures
218
231
  };
219
232
  };
220
233
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setActiveCalculatorId = exports.newActiveBankEntry = exports.newActiveBank = exports.occludeQuizEntries = exports.merge = exports.set = exports.toggle = exports.clear = void 0;
6
+ exports.setActiveCalculatorId = exports.loadedApiFeatures = exports.newActiveBankEntry = exports.newActiveBank = exports.occludeQuizEntries = exports.merge = exports.set = exports.toggle = exports.clear = void 0;
7
7
 
8
8
  var _quizCommon = require("@instructure/quiz-common");
9
9
 
@@ -76,6 +76,15 @@ var newActiveBankEntry = function newActiveBankEntry(activeBankEntryId) {
76
76
 
77
77
  exports.newActiveBankEntry = newActiveBankEntry;
78
78
 
79
+ var loadedApiFeatures = function loadedApiFeatures(loaded) {
80
+ return {
81
+ type: _quizCommon.LOADED_API_FEATURES,
82
+ payload: loaded
83
+ };
84
+ };
85
+
86
+ exports.loadedApiFeatures = loadedApiFeatures;
87
+
79
88
  var setActiveCalculatorId = function setActiveCalculatorId(id) {
80
89
  return set('activeCalculatorId', id);
81
90
  };
@@ -11,6 +11,8 @@ var _Fetcher = _interopRequireDefault(require("../util/Fetcher.js"));
11
11
 
12
12
  var _features = require("../actions/features.js");
13
13
 
14
+ var _ui = require("../actions/ui.js");
15
+
14
16
  var getFeatures = function getFeatures() {
15
17
  var url = '/api/features';
16
18
  return function (dispatch, getState) {
@@ -20,7 +22,9 @@ var getFeatures = function getFeatures() {
20
22
  dispatch((0, _features.addFeatures)(featuresList));
21
23
  };
22
24
 
23
- return fetcher.get(url).then(addFeaturesToStore);
25
+ return fetcher.get(url).then(addFeaturesToStore).then(function () {
26
+ return dispatch((0, _ui.loadedApiFeatures)(true));
27
+ });
24
28
  };
25
29
  };
26
30
 
@@ -43,6 +43,9 @@ var _default = function _default() {
43
43
  case _quizCommon.ACTIVE_BANK_ENTRY_CHANGE:
44
44
  return state.set('activeBankEntryId', action.payload);
45
45
 
46
+ case _quizCommon.LOADED_API_FEATURES:
47
+ return state.set('loadedApiFeatures', action.payload);
48
+
46
49
  default:
47
50
  return state;
48
51
  }
@@ -212,10 +212,20 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(props) {
212
212
  }, _callee2, null, [[2, 21, 25, 28]]);
213
213
  }))();
214
214
  }, [props.useNewRce]);
215
- if (!props.useNewRce) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
216
- return canvasConfigLoading ? _ref4 : /*#__PURE__*/_react.default.createElement(_quizCommon.RceConfigContext.Provider, {
217
- value: getConfig()
218
- }, props.children);
215
+
216
+ if (props.loadedApiFeatures) {
217
+ if (props.useNewRce) {
218
+ if (!canvasConfigLoading) {
219
+ return /*#__PURE__*/_react.default.createElement(_quizCommon.RceConfigContext.Provider, {
220
+ value: getConfig()
221
+ }, props.children);
222
+ }
223
+ } else {
224
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
225
+ }
226
+ }
227
+
228
+ return _ref4;
219
229
  };
220
230
 
221
231
  exports.RceConfigProviderComponent = RceConfigProviderComponent;
@@ -229,7 +239,8 @@ RceConfigProviderComponent.propTypes = {
229
239
  rcsHost: _propTypes.default.string,
230
240
  rcsJwt: _propTypes.default.string,
231
241
  rcsJwtRefreshFn: _propTypes.default.func,
232
- canvasOrigin: _propTypes.default.string
242
+ canvasOrigin: _propTypes.default.string,
243
+ loadedApiFeatures: _propTypes.default.bool
233
244
  };
234
245
  RceConfigProviderComponent.defaultProps = {
235
246
  contextId: null,
@@ -238,12 +249,14 @@ RceConfigProviderComponent.defaultProps = {
238
249
  rcsHost: null,
239
250
  rcsJwt: null,
240
251
  rcsJwtRefreshFn: null,
241
- canvasOrigin: null
252
+ canvasOrigin: null,
253
+ loadedApiFeatures: false
242
254
  };
243
255
 
244
- var mapStateToProps = function mapStateToProps() {
256
+ var mapStateToProps = function mapStateToProps(state, ownProps) {
245
257
  return {
246
- useNewRce: (0, _rceChecker.default)()
258
+ useNewRce: (0, _rceChecker.default)(),
259
+ loadedApiFeatures: state.getIn(['ui', 'loadedApiFeatures']) || ownProps.loadedApiFeatures
247
260
  };
248
261
  };
249
262
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "17.45.1-rc.1+652efed20",
3
+ "version": "17.45.1",
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.1-rc.1+652efed20",
45
- "@instructure/quiz-i18n": "17.45.1-rc.1+652efed20",
46
- "@instructure/quiz-interactions": "17.45.1-rc.1+652efed20",
47
- "@instructure/quiz-number-input": "17.45.1-rc.1+652efed20",
48
- "@instructure/quiz-rce": "17.45.1-rc.1+652efed20",
44
+ "@instructure/quiz-common": "^17.45.1",
45
+ "@instructure/quiz-i18n": "^17.45.1",
46
+ "@instructure/quiz-interactions": "^17.45.1",
47
+ "@instructure/quiz-number-input": "^17.45.1",
48
+ "@instructure/quiz-rce": "^17.45.1",
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.45.1-rc.1+652efed20",
109
+ "instructure-validations": "^17.45.1",
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.45.0",
140
+ "@instructure/quiz-scripts": "^17.45.1",
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.45.1-rc.1+652efed20",
159
+ "quiz-presets": "^17.45.1",
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": "652efed2087649c08c7ffeb10345e87685b51332"
175
+ "gitHead": "49b722f452778f3da3ce45a945e87c4427e7c8e7"
176
176
  }