@instructure/quiz-core 17.67.0 → 17.67.1-rc.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.
@@ -23,22 +23,21 @@ export var fetchReportsStatus = /*#__PURE__*/function () {
23
23
  setGenerationInProgress(false);
24
24
  }
25
25
 
26
- _context.next = 14;
27
- break;
26
+ return _context.abrupt("return", isReportGenerationReady);
28
27
 
29
- case 9:
30
- _context.prev = 9;
28
+ case 10:
29
+ _context.prev = 10;
31
30
  _context.t0 = _context["catch"](1);
32
31
  addError(getFailedToFetchReports());
33
32
  setStatusPollingInProgress(false);
34
33
  setGenerationInProgress(false);
35
34
 
36
- case 14:
35
+ case 15:
37
36
  case "end":
38
37
  return _context.stop();
39
38
  }
40
39
  }
41
- }, _callee, null, [[1, 9]]);
40
+ }, _callee, null, [[1, 10]]);
42
41
  }));
43
42
 
44
43
  return function fetchReportsStatus(_x) {
@@ -1,7 +1,7 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/regenerator";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- import React, { useEffect, useRef } from 'react';
4
+ import React, { useEffect } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { itemAnalysisPropType, quizAnalysisPropType } from "./propTypes.js";
7
7
  import { fetchReports } from "./fetchReports.js";
@@ -31,7 +31,6 @@ export var withAnalysisStatePresenter = function withAnalysisStatePresenter(Orig
31
31
  passThroughProps = _objectWithoutProperties(_ref, ["quizAnalysis", "itemAnalyses", "fetchInProgress", "generationInProgress", "analysisError", "setQuizAnalysis", "addError", "setItemAnalyses", "setFetchInProgress", "setGenerationInProgress", "setAnalysisError", "activeQuizId", "generateAnalysis", "fetchQuizAnalysis", "fetchItemAnalyses", "fetchAnalysesStatus", "statusPollingInProgress", "setStatusPollingInProgress", "pollingInterval"]);
32
32
 
33
33
  WithAnalysisStatePresenter.displayName = "WithAnalysisStatePresenter(".concat(OriginalComponent.displayName || OriginalComponent.name, ")");
34
- var runningInterval = useRef(null);
35
34
 
36
35
  var instrumentedFetchReports = function instrumentedFetchReports() {
37
36
  return fetchReports({
@@ -64,15 +63,15 @@ export var withAnalysisStatePresenter = function withAnalysisStatePresenter(Orig
64
63
  }
65
64
 
66
65
  function _generateReports() {
67
- _generateReports = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
66
+ _generateReports = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
68
67
  var filter,
69
68
  generationConfig,
70
- _args2 = arguments;
71
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
69
+ _args3 = arguments;
70
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
72
71
  while (1) {
73
- switch (_context2.prev = _context2.next) {
72
+ switch (_context3.prev = _context3.next) {
74
73
  case 0:
75
- filter = _args2.length > 0 && _args2[0] !== void 0 ? _args2[0] : 'last_attempt';
74
+ filter = _args3.length > 0 && _args3[0] !== void 0 ? _args3[0] : 'last_attempt';
76
75
  generationConfig = {
77
76
  filter: filter,
78
77
  generateAnalysis: generateAnalysis,
@@ -80,15 +79,15 @@ export var withAnalysisStatePresenter = function withAnalysisStatePresenter(Orig
80
79
  setStatusPollingInProgress: setStatusPollingInProgress,
81
80
  addError: addError
82
81
  };
83
- _context2.next = 4;
82
+ _context3.next = 4;
84
83
  return triggerReportGeneration(generationConfig);
85
84
 
86
85
  case 4:
87
86
  case "end":
88
- return _context2.stop();
87
+ return _context3.stop();
89
88
  }
90
89
  }
91
- }, _callee2);
90
+ }, _callee3);
92
91
  }));
93
92
  return _generateReports.apply(this, arguments);
94
93
  }
@@ -126,20 +125,36 @@ export var withAnalysisStatePresenter = function withAnalysisStatePresenter(Orig
126
125
 
127
126
  fetchIfNeeded();
128
127
  }, []);
129
- useEffect(function () {
130
- if (statusPollingInProgress && !runningInterval.current) {
131
- runningInterval.current = setInterval(instrumentedStatusFetching, pollingInterval);
132
- }
133
128
 
134
- if (!statusPollingInProgress && runningInterval.current) {
135
- clearInterval(runningInterval.current);
136
- runningInterval.current = null;
137
- } // unmount cleanup
129
+ var recursiveInstrumentedStatusFetching = /*#__PURE__*/function () {
130
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
131
+ var isReportGenerationReady;
132
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
133
+ while (1) {
134
+ switch (_context2.prev = _context2.next) {
135
+ case 0:
136
+ _context2.next = 2;
137
+ return instrumentedStatusFetching();
138
138
 
139
+ case 2:
140
+ isReportGenerationReady = _context2.sent;
141
+ !isReportGenerationReady && setTimeout(recursiveInstrumentedStatusFetching, pollingInterval);
139
142
 
140
- return function () {
141
- return clearInterval(runningInterval.current);
143
+ case 4:
144
+ case "end":
145
+ return _context2.stop();
146
+ }
147
+ }
148
+ }, _callee2);
149
+ }));
150
+
151
+ return function recursiveInstrumentedStatusFetching() {
152
+ return _ref3.apply(this, arguments);
142
153
  };
154
+ }();
155
+
156
+ useEffect(function () {
157
+ statusPollingInProgress && recursiveInstrumentedStatusFetching();
143
158
  }, [statusPollingInProgress]);
144
159
  return /*#__PURE__*/React.createElement(OriginalComponent, Object.assign({
145
160
  quizAnalysis: quizAnalysis,
@@ -35,22 +35,21 @@ var fetchReportsStatus = /*#__PURE__*/function () {
35
35
  setGenerationInProgress(false);
36
36
  }
37
37
 
38
- _context.next = 14;
39
- break;
38
+ return _context.abrupt("return", isReportGenerationReady);
40
39
 
41
- case 9:
42
- _context.prev = 9;
40
+ case 10:
41
+ _context.prev = 10;
43
42
  _context.t0 = _context["catch"](1);
44
43
  addError((0, _errorMessages.getFailedToFetchReports)());
45
44
  setStatusPollingInProgress(false);
46
45
  setGenerationInProgress(false);
47
46
 
48
- case 14:
47
+ case 15:
49
48
  case "end":
50
49
  return _context.stop();
51
50
  }
52
51
  }
53
- }, _callee, null, [[1, 9]]);
52
+ }, _callee, null, [[1, 10]]);
54
53
  }));
55
54
 
56
55
  return function fetchReportsStatus(_x) {
@@ -50,7 +50,6 @@ var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalCom
50
50
  pollingInterval = _ref.pollingInterval,
51
51
  passThroughProps = (0, _objectWithoutProperties2.default)(_ref, ["quizAnalysis", "itemAnalyses", "fetchInProgress", "generationInProgress", "analysisError", "setQuizAnalysis", "addError", "setItemAnalyses", "setFetchInProgress", "setGenerationInProgress", "setAnalysisError", "activeQuizId", "generateAnalysis", "fetchQuizAnalysis", "fetchItemAnalyses", "fetchAnalysesStatus", "statusPollingInProgress", "setStatusPollingInProgress", "pollingInterval"]);
52
52
  WithAnalysisStatePresenter.displayName = "WithAnalysisStatePresenter(".concat(OriginalComponent.displayName || OriginalComponent.name, ")");
53
- var runningInterval = (0, _react.useRef)(null);
54
53
 
55
54
  var instrumentedFetchReports = function instrumentedFetchReports() {
56
55
  return (0, _fetchReports.fetchReports)({
@@ -83,15 +82,15 @@ var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalCom
83
82
  }
84
83
 
85
84
  function _generateReports() {
86
- _generateReports = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
85
+ _generateReports = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
87
86
  var filter,
88
87
  generationConfig,
89
- _args2 = arguments;
90
- return _regenerator.default.wrap(function _callee2$(_context2) {
88
+ _args3 = arguments;
89
+ return _regenerator.default.wrap(function _callee3$(_context3) {
91
90
  while (1) {
92
- switch (_context2.prev = _context2.next) {
91
+ switch (_context3.prev = _context3.next) {
93
92
  case 0:
94
- filter = _args2.length > 0 && _args2[0] !== void 0 ? _args2[0] : 'last_attempt';
93
+ filter = _args3.length > 0 && _args3[0] !== void 0 ? _args3[0] : 'last_attempt';
95
94
  generationConfig = {
96
95
  filter: filter,
97
96
  generateAnalysis: generateAnalysis,
@@ -99,15 +98,15 @@ var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalCom
99
98
  setStatusPollingInProgress: setStatusPollingInProgress,
100
99
  addError: addError
101
100
  };
102
- _context2.next = 4;
101
+ _context3.next = 4;
103
102
  return (0, _generateReports2.generateReports)(generationConfig);
104
103
 
105
104
  case 4:
106
105
  case "end":
107
- return _context2.stop();
106
+ return _context3.stop();
108
107
  }
109
108
  }
110
- }, _callee2);
109
+ }, _callee3);
111
110
  }));
112
111
  return _generateReports.apply(this, arguments);
113
112
  }
@@ -145,20 +144,36 @@ var withAnalysisStatePresenter = function withAnalysisStatePresenter(OriginalCom
145
144
 
146
145
  fetchIfNeeded();
147
146
  }, []);
148
- (0, _react.useEffect)(function () {
149
- if (statusPollingInProgress && !runningInterval.current) {
150
- runningInterval.current = setInterval(instrumentedStatusFetching, pollingInterval);
151
- }
152
147
 
153
- if (!statusPollingInProgress && runningInterval.current) {
154
- clearInterval(runningInterval.current);
155
- runningInterval.current = null;
156
- } // unmount cleanup
148
+ var recursiveInstrumentedStatusFetching = /*#__PURE__*/function () {
149
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
150
+ var isReportGenerationReady;
151
+ return _regenerator.default.wrap(function _callee2$(_context2) {
152
+ while (1) {
153
+ switch (_context2.prev = _context2.next) {
154
+ case 0:
155
+ _context2.next = 2;
156
+ return instrumentedStatusFetching();
157
157
 
158
+ case 2:
159
+ isReportGenerationReady = _context2.sent;
160
+ !isReportGenerationReady && setTimeout(recursiveInstrumentedStatusFetching, pollingInterval);
158
161
 
159
- return function () {
160
- return clearInterval(runningInterval.current);
162
+ case 4:
163
+ case "end":
164
+ return _context2.stop();
165
+ }
166
+ }
167
+ }, _callee2);
168
+ }));
169
+
170
+ return function recursiveInstrumentedStatusFetching() {
171
+ return _ref3.apply(this, arguments);
161
172
  };
173
+ }();
174
+
175
+ (0, _react.useEffect)(function () {
176
+ statusPollingInProgress && recursiveInstrumentedStatusFetching();
162
177
  }, [statusPollingInProgress]);
163
178
  return /*#__PURE__*/_react.default.createElement(OriginalComponent, Object.assign({
164
179
  quizAnalysis: quizAnalysis,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "17.67.0",
3
+ "version": "17.67.1-rc.0+7afeb9ec9",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -42,11 +42,11 @@
42
42
  "dependencies": {
43
43
  "@instructure/grading-utils": "^1.0.0",
44
44
  "@instructure/outcomes-ui": "^2.1.9",
45
- "@instructure/quiz-common": "^17.67.0",
46
- "@instructure/quiz-i18n": "^17.67.0",
47
- "@instructure/quiz-interactions": "^17.67.0",
48
- "@instructure/quiz-number-input": "^17.67.0",
49
- "@instructure/quiz-rce": "^17.67.0",
45
+ "@instructure/quiz-common": "17.67.1-rc.0+7afeb9ec9",
46
+ "@instructure/quiz-i18n": "17.67.1-rc.0+7afeb9ec9",
47
+ "@instructure/quiz-interactions": "17.67.1-rc.0+7afeb9ec9",
48
+ "@instructure/quiz-number-input": "17.67.1-rc.0+7afeb9ec9",
49
+ "@instructure/quiz-rce": "17.67.1-rc.0+7afeb9ec9",
50
50
  "@instructure/ui-a11y-content": "^7.20.0",
51
51
  "@instructure/ui-alerts": "^7.20.0",
52
52
  "@instructure/ui-avatar": "^7.20.0",
@@ -107,7 +107,7 @@
107
107
  "eventemitter3": "^3.1.0",
108
108
  "humps": "^2.0.0",
109
109
  "immutable": "^3.8.1",
110
- "instructure-validations": "^17.67.0",
110
+ "instructure-validations": "17.67.1-rc.0+7afeb9ec9",
111
111
  "ipaddr.js": "^1.5.4",
112
112
  "isomorphic-fetch": "^2.2.0",
113
113
  "isuuid": "^0.1.0",
@@ -139,7 +139,7 @@
139
139
  "uuid": "^3.2.1"
140
140
  },
141
141
  "devDependencies": {
142
- "@instructure/quiz-scripts": "^17.67.0",
142
+ "@instructure/quiz-scripts": "17.67.0",
143
143
  "@instructure/ui-axe-check": "^7.20.0",
144
144
  "@instructure/ui-babel-preset": "^7.20.0",
145
145
  "@instructure/ui-karma-config": "^7.20.0",
@@ -158,7 +158,7 @@
158
158
  "intl": "^1.2.4",
159
159
  "jquery": "^2.2.3",
160
160
  "most-subject": "^5.3.0",
161
- "quiz-presets": "^17.67.0",
161
+ "quiz-presets": "17.67.1-rc.0+7afeb9ec9",
162
162
  "react": "^16.8.6",
163
163
  "react-addons-test-utils": "^15.6.2",
164
164
  "react-dom": "^16.8.6",
@@ -174,5 +174,5 @@
174
174
  "publishConfig": {
175
175
  "access": "public"
176
176
  },
177
- "gitHead": "b2b943153d890a1ba691ba3a346edfcb4d1d6be5"
177
+ "gitHead": "7afeb9ec94ab66b70ef4c1cf9dbd19b8eb9f8acd"
178
178
  }