@instructure/quiz-core 17.60.1-rc.7 → 17.60.1-rc.9

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.
@@ -9,7 +9,7 @@ import { BuildingButtons as BuildingButtonsPresenter } from "./presenter.js";
9
9
  import { getActiveQuiz } from "../../../../../common/selectors/quizzes.js";
10
10
  import { featureOn } from "../../../../../common/util/featureCheck.js";
11
11
  import { startQuizExportJob } from "../../../../../common/actions/quizExport.js";
12
- import { addInfo } from "../../../../../common/actions/alerts.js";
12
+ import { addAlert, addInfo } from "../../../../../common/actions/alerts.js";
13
13
  export function mapStateToProps(state) {
14
14
  var quiz = getActiveQuiz(state);
15
15
  return {
@@ -26,6 +26,7 @@ export function mapStateToProps(state) {
26
26
 
27
27
  var mapDispatchToProps = function mapDispatchToProps(dispatch) {
28
28
  return {
29
+ addAlert: bindActionCreators(addAlert, dispatch),
29
30
  addInfo: bindActionCreators(addInfo, dispatch),
30
31
  openBanksTray: bindActionCreators(setUI.bind(void 0, BUILD_TRAY_OPEN, true), dispatch),
31
32
  setBanksTrayButtonRef: bindActionCreators(partial(setUI, BUILD_TRAY_BUTTON_REF), dispatch),
@@ -71,7 +71,7 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
71
71
  _this.props.contentExport({
72
72
  contextUuid: contextUuid,
73
73
  exportSettings: exportSettings
74
- });
74
+ }, _this.props.addAlert);
75
75
 
76
76
  _this.props.startExport(activeQuizId);
77
77
  }
@@ -202,6 +202,7 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
202
202
  return BuildingButtons;
203
203
  }(Component), _class2.propTypes = {
204
204
  app: PropTypes.string,
205
+ addAlert: PropTypes.func.isRequired,
205
206
  addInfo: PropTypes.func,
206
207
  activeQuizId: PropTypes.string,
207
208
  canExport: PropTypes.bool.isRequired,
@@ -1,7 +1,6 @@
1
1
  import { v4 as uuid } from 'uuid';
2
2
  import { ADD_ALERT, REMOVE_ALERT, DEFAULT_ALERT_TIME } from '@instructure/quiz-common';
3
-
4
- function addAlert(_ref) {
3
+ export function addAlert(_ref) {
5
4
  var message = _ref.message,
6
5
  variant = _ref.variant,
7
6
  _ref$removeIn = _ref.removeIn,
@@ -18,7 +17,6 @@ function addAlert(_ref) {
18
17
  }
19
18
  };
20
19
  }
21
-
22
20
  export function addError(message, removeIn, guid) {
23
21
  return addAlert({
24
22
  message: message,
@@ -18,6 +18,7 @@ import { Provider } from "../../react-redux.js";
18
18
  import store from "../../../reduxStore.js";
19
19
  import { getLocale } from '@instructure/quiz-common';
20
20
  import { set } from "../../actions/ui.js";
21
+ import { addAlert } from "../../actions/alerts.js";
21
22
  import { setAPIEndpoint, setCanvasOrigin, setUserToken } from "../../actions/config.js";
22
23
  import { setContextUuid, setOutcomesEndpoint, setOutcomesToken } from "../../actions/outcomes.js";
23
24
  import { addFeatures, removeFeatures } from "../../actions/features.js";
@@ -53,6 +54,10 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
53
54
  // so we dont implicitly share state
54
55
  // this.store = this.configureStore()
55
56
 
57
+ _this.addAlert = function (opts) {
58
+ _this.store.dispatch(addAlert(opts));
59
+ };
60
+
56
61
  _this.store = store;
57
62
 
58
63
  _this.setLocale();
@@ -154,7 +159,9 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
154
159
  }, /*#__PURE__*/React.createElement("div", {
155
160
  className: styles.sdk,
156
161
  "data-automation": "sdk-app"
157
- }, _ref, props.children)))));
162
+ }, _ref, typeof props.children === 'function' ? props.children({
163
+ addAlert: this.addAlert
164
+ }) : props.children)))));
158
165
  }
159
166
  }]);
160
167
 
@@ -163,7 +170,7 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
163
170
  }(Component), _class2.propTypes = {
164
171
  apiEndpoint: PropTypes.string.isRequired,
165
172
  appContainer: CustomPropTypes.selectors.isRequired,
166
- children: PropTypes.node.isRequired,
173
+ children: PropTypes.oneOf([PropTypes.node, PropTypes.func]).isRequired,
167
174
  contextUuid: PropTypes.string,
168
175
  gradeByQuestionEnabled: PropTypes.bool,
169
176
  itemBankSharingEnabled: PropTypes.bool,
@@ -0,0 +1,33 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import Fetcher from "../../common/util/Fetcher.js";
4
+ var fetcher = new Fetcher();
5
+ export var getQuizAnalysis = /*#__PURE__*/function () {
6
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(quizId) {
7
+ var filter,
8
+ url,
9
+ _args = arguments;
10
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
11
+ while (1) {
12
+ switch (_context.prev = _context.next) {
13
+ case 0:
14
+ filter = _args.length > 1 && _args[1] !== void 0 ? _args[1] : 'last_attempt';
15
+ url = "/api/quizzes/".concat(quizId, "/analyses/quiz_analysis?filter=").concat(filter);
16
+ _context.next = 4;
17
+ return fetcher.get(url);
18
+
19
+ case 4:
20
+ return _context.abrupt("return", _context.sent);
21
+
22
+ case 5:
23
+ case "end":
24
+ return _context.stop();
25
+ }
26
+ }
27
+ }, _callee);
28
+ }));
29
+
30
+ return function getQuizAnalysis(_x) {
31
+ return _ref.apply(this, arguments);
32
+ };
33
+ }();
@@ -50,6 +50,7 @@ function mapStateToProps(state) {
50
50
 
51
51
  var mapDispatchToProps = function mapDispatchToProps(dispatch) {
52
52
  return {
53
+ addAlert: (0, _redux.bindActionCreators)(_alerts.addAlert, dispatch),
53
54
  addInfo: (0, _redux.bindActionCreators)(_alerts.addInfo, dispatch),
54
55
  openBanksTray: (0, _redux.bindActionCreators)(_ui.set.bind(void 0, _quizCommon.BUILD_TRAY_OPEN, true), dispatch),
55
56
  setBanksTrayButtonRef: (0, _redux.bindActionCreators)((0, _partial.default)(_ui.set, _quizCommon.BUILD_TRAY_BUTTON_REF), dispatch),
@@ -96,7 +96,7 @@ var BuildingButtons = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
96
96
  _this.props.contentExport({
97
97
  contextUuid: contextUuid,
98
98
  exportSettings: exportSettings
99
- });
99
+ }, _this.props.addAlert);
100
100
 
101
101
  _this.props.startExport(activeQuizId);
102
102
  }
@@ -226,6 +226,7 @@ var BuildingButtons = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
226
226
  return BuildingButtons;
227
227
  }(_react.Component), _class2.propTypes = {
228
228
  app: _propTypes.default.string,
229
+ addAlert: _propTypes.default.func.isRequired,
229
230
  addInfo: _propTypes.default.func,
230
231
  activeQuizId: _propTypes.default.string,
231
232
  canExport: _propTypes.default.bool.isRequired,
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.addAlert = addAlert;
6
7
  exports.addError = addError;
7
8
  exports.addStickyError = addStickyError;
8
9
  exports.addSuccess = addSuccess;
@@ -37,6 +37,8 @@ var _quizCommon = require("@instructure/quiz-common");
37
37
 
38
38
  var _ui = require("../../actions/ui.js");
39
39
 
40
+ var _alerts = require("../../actions/alerts.js");
41
+
40
42
  var _config = require("../../actions/config.js");
41
43
 
42
44
  var _outcomes = require("../../actions/outcomes.js");
@@ -84,6 +86,10 @@ var SDKApp = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
84
86
  // so we dont implicitly share state
85
87
  // this.store = this.configureStore()
86
88
 
89
+ _this.addAlert = function (opts) {
90
+ _this.store.dispatch((0, _alerts.addAlert)(opts));
91
+ };
92
+
87
93
  _this.store = _reduxStore.default;
88
94
 
89
95
  _this.setLocale();
@@ -185,7 +191,9 @@ var SDKApp = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
185
191
  }, /*#__PURE__*/_react.default.createElement("div", {
186
192
  className: styles.sdk,
187
193
  "data-automation": "sdk-app"
188
- }, _ref, props.children)))));
194
+ }, _ref, typeof props.children === 'function' ? props.children({
195
+ addAlert: this.addAlert
196
+ }) : props.children)))));
189
197
  }
190
198
  }]);
191
199
  SDKApp.displayName = "SDKApp";
@@ -193,7 +201,7 @@ var SDKApp = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
193
201
  }(_react.Component), _class2.propTypes = {
194
202
  apiEndpoint: _propTypes.default.string.isRequired,
195
203
  appContainer: _CustomPropTypes.default.selectors.isRequired,
196
- children: _propTypes.default.node.isRequired,
204
+ children: _propTypes.default.oneOf([_propTypes.default.node, _propTypes.default.func]).isRequired,
197
205
  contextUuid: _propTypes.default.string,
198
206
  gradeByQuestionEnabled: _propTypes.default.bool,
199
207
  itemBankSharingEnabled: _propTypes.default.bool,
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getQuizAnalysis = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _Fetcher = _interopRequireDefault(require("../../common/util/Fetcher.js"));
15
+
16
+ var fetcher = new _Fetcher.default();
17
+
18
+ var getQuizAnalysis = /*#__PURE__*/function () {
19
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(quizId) {
20
+ var filter,
21
+ url,
22
+ _args = arguments;
23
+ return _regenerator.default.wrap(function _callee$(_context) {
24
+ while (1) {
25
+ switch (_context.prev = _context.next) {
26
+ case 0:
27
+ filter = _args.length > 1 && _args[1] !== void 0 ? _args[1] : 'last_attempt';
28
+ url = "/api/quizzes/".concat(quizId, "/analyses/quiz_analysis?filter=").concat(filter);
29
+ _context.next = 4;
30
+ return fetcher.get(url);
31
+
32
+ case 4:
33
+ return _context.abrupt("return", _context.sent);
34
+
35
+ case 5:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }
40
+ }, _callee);
41
+ }));
42
+
43
+ return function getQuizAnalysis(_x) {
44
+ return _ref.apply(this, arguments);
45
+ };
46
+ }();
47
+
48
+ exports.getQuizAnalysis = getQuizAnalysis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "17.60.1-rc.7+bd8e84b98",
3
+ "version": "17.60.1-rc.9+e0e053e20",
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.8",
44
- "@instructure/quiz-common": "17.60.1-rc.7+bd8e84b98",
45
- "@instructure/quiz-i18n": "17.60.1-rc.7+bd8e84b98",
46
- "@instructure/quiz-interactions": "17.60.1-rc.7+bd8e84b98",
47
- "@instructure/quiz-number-input": "17.60.1-rc.7+bd8e84b98",
48
- "@instructure/quiz-rce": "17.60.1-rc.7+bd8e84b98",
44
+ "@instructure/quiz-common": "17.60.1-rc.9+e0e053e20",
45
+ "@instructure/quiz-i18n": "17.60.1-rc.9+e0e053e20",
46
+ "@instructure/quiz-interactions": "17.60.1-rc.9+e0e053e20",
47
+ "@instructure/quiz-number-input": "17.60.1-rc.9+e0e053e20",
48
+ "@instructure/quiz-rce": "17.60.1-rc.9+e0e053e20",
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.60.1-rc.7+bd8e84b98",
109
+ "instructure-validations": "17.60.1-rc.9+e0e053e20",
110
110
  "ipaddr.js": "^1.5.4",
111
111
  "isomorphic-fetch": "^2.2.0",
112
112
  "isuuid": "^0.1.0",
@@ -157,7 +157,7 @@
157
157
  "intl": "^1.2.4",
158
158
  "jquery": "^2.2.3",
159
159
  "most-subject": "^5.3.0",
160
- "quiz-presets": "17.60.1-rc.7+bd8e84b98",
160
+ "quiz-presets": "17.60.1-rc.9+e0e053e20",
161
161
  "react": "^16.8.6",
162
162
  "react-addons-test-utils": "^15.6.2",
163
163
  "react-dom": "^16.8.6",
@@ -173,5 +173,5 @@
173
173
  "publishConfig": {
174
174
  "access": "public"
175
175
  },
176
- "gitHead": "bd8e84b98936ae8e08450357146920b76b08380a"
176
+ "gitHead": "e0e053e208208aca5300cc46f951aac89fc4708b"
177
177
  }