@instructure/quiz-core 17.38.1-rc.0 → 17.38.1-rc.3
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.
|
@@ -161,6 +161,7 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
|
|
|
161
161
|
contextType: PropTypes.string.isRequired,
|
|
162
162
|
canvasUserId: PropTypes.string.isRequired,
|
|
163
163
|
rcsHost: PropTypes.string.isRequired,
|
|
164
|
+
rcsJwt: PropTypes.string.isRequired,
|
|
164
165
|
rcsJwtRefreshFn: PropTypes.func.isRequired
|
|
165
166
|
}),
|
|
166
167
|
timeZone: PropTypes.string,
|
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import React, { useState
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { connect } from "../../common/react-redux.js";
|
|
6
6
|
import isNewRCEEnabled from "./rceChecker.js";
|
|
7
|
-
import { RceConfigContext, RceConfigKeys
|
|
7
|
+
import { RceConfigContext, RceConfigKeys } from '@instructure/quiz-common';
|
|
8
8
|
|
|
9
9
|
var RceConfigProviderComponent = function RceConfigProviderComponent(props) {
|
|
10
|
-
var _useState = useState(
|
|
10
|
+
var _useState = useState(props.rcsJwt),
|
|
11
11
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12
12
|
jwt = _useState2[0],
|
|
13
13
|
setJwt = _useState2[1];
|
|
14
14
|
|
|
15
|
-
var _useState3 = useState(TokenFetchStatus.initial),
|
|
16
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
17
|
-
status = _useState4[0],
|
|
18
|
-
setStatus = _useState4[1];
|
|
19
|
-
|
|
20
15
|
var hasAllPropsForNewRce = function hasAllPropsForNewRce() {
|
|
21
|
-
return props.useNewRce && !!(props.contextId && props.contextType && props.canvasUserId && props.rcsHost && props.rcsJwtRefreshFn);
|
|
16
|
+
return props.useNewRce && !!(props.contextId && props.contextType && props.canvasUserId && props.rcsHost && props.rcsJwtRefreshFn && props.rcsJwt);
|
|
22
17
|
};
|
|
23
18
|
|
|
24
19
|
var getToken = function getToken() {
|
|
25
20
|
if (!hasAllPropsForNewRce()) return;
|
|
26
|
-
setStatus(TokenFetchStatus.pending);
|
|
27
21
|
return new Promise(function (resolve, reject) {
|
|
28
22
|
props.rcsJwtRefreshFn().then(function (response) {
|
|
29
23
|
var token = response.token;
|
|
30
|
-
setStatus(TokenFetchStatus.success);
|
|
31
24
|
setJwt(token);
|
|
32
25
|
resolve(response);
|
|
33
26
|
}, function () {
|
|
34
|
-
setStatus(TokenFetchStatus.failed);
|
|
35
27
|
reject();
|
|
36
28
|
});
|
|
37
29
|
});
|
|
@@ -47,13 +39,10 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(props) {
|
|
|
47
39
|
var getConfig = function getConfig() {
|
|
48
40
|
var _config;
|
|
49
41
|
|
|
50
|
-
var config = (_config = {}, _defineProperty(_config, RceConfigKeys.useNewRce, props.useNewRce), _defineProperty(_config, RceConfigKeys.canvasUserId, props.canvasUserId), _defineProperty(_config, RceConfigKeys.contextId, props.contextId), _defineProperty(_config, RceConfigKeys.contextType, props.contextType), _defineProperty(_config, RceConfigKeys.rcsHost, props.rcsHost), _defineProperty(_config, RceConfigKeys.rcsJwt, jwt), _defineProperty(_config, RceConfigKeys.rcsJwtRefreshFn, refreshToken),
|
|
42
|
+
var config = (_config = {}, _defineProperty(_config, RceConfigKeys.useNewRce, props.useNewRce), _defineProperty(_config, RceConfigKeys.canvasUserId, props.canvasUserId), _defineProperty(_config, RceConfigKeys.contextId, props.contextId), _defineProperty(_config, RceConfigKeys.contextType, props.contextType), _defineProperty(_config, RceConfigKeys.rcsHost, props.rcsHost), _defineProperty(_config, RceConfigKeys.rcsJwt, jwt), _defineProperty(_config, RceConfigKeys.rcsJwtRefreshFn, refreshToken), _config);
|
|
51
43
|
return config;
|
|
52
44
|
};
|
|
53
45
|
|
|
54
|
-
useEffect(function () {
|
|
55
|
-
getToken();
|
|
56
|
-
}, [props.useNewRce]);
|
|
57
46
|
if (!hasAllPropsForNewRce()) return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
|
|
58
47
|
return /*#__PURE__*/React.createElement(RceConfigContext.Provider, {
|
|
59
48
|
value: getConfig()
|
|
@@ -67,6 +56,7 @@ RceConfigProviderComponent.propTypes = {
|
|
|
67
56
|
contextType: PropTypes.string,
|
|
68
57
|
canvasUserId: PropTypes.string,
|
|
69
58
|
rcsHost: PropTypes.string,
|
|
59
|
+
rcsJwt: PropTypes.string,
|
|
70
60
|
rcsJwtRefreshFn: PropTypes.func
|
|
71
61
|
};
|
|
72
62
|
RceConfigProviderComponent.defaultProps = {
|
|
@@ -74,6 +64,7 @@ RceConfigProviderComponent.defaultProps = {
|
|
|
74
64
|
contextType: null,
|
|
75
65
|
canvasUserId: null,
|
|
76
66
|
rcsHost: null,
|
|
67
|
+
rcsJwt: null,
|
|
77
68
|
rcsJwtRefreshFn: null
|
|
78
69
|
};
|
|
79
70
|
|
|
@@ -190,6 +190,7 @@ var SDKApp = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
|
|
|
190
190
|
contextType: _propTypes.default.string.isRequired,
|
|
191
191
|
canvasUserId: _propTypes.default.string.isRequired,
|
|
192
192
|
rcsHost: _propTypes.default.string.isRequired,
|
|
193
|
+
rcsJwt: _propTypes.default.string.isRequired,
|
|
193
194
|
rcsJwtRefreshFn: _propTypes.default.func.isRequired
|
|
194
195
|
}),
|
|
195
196
|
timeZone: _propTypes.default.string,
|
|
@@ -24,31 +24,23 @@ var _rceChecker = _interopRequireDefault(require("./rceChecker.js"));
|
|
|
24
24
|
var _quizCommon = require("@instructure/quiz-common");
|
|
25
25
|
|
|
26
26
|
var RceConfigProviderComponent = function RceConfigProviderComponent(props) {
|
|
27
|
-
var _useState = (0, _react.useState)(
|
|
27
|
+
var _useState = (0, _react.useState)(props.rcsJwt),
|
|
28
28
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
29
29
|
jwt = _useState2[0],
|
|
30
30
|
setJwt = _useState2[1];
|
|
31
31
|
|
|
32
|
-
var _useState3 = (0, _react.useState)(_quizCommon.TokenFetchStatus.initial),
|
|
33
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
34
|
-
status = _useState4[0],
|
|
35
|
-
setStatus = _useState4[1];
|
|
36
|
-
|
|
37
32
|
var hasAllPropsForNewRce = function hasAllPropsForNewRce() {
|
|
38
|
-
return props.useNewRce && !!(props.contextId && props.contextType && props.canvasUserId && props.rcsHost && props.rcsJwtRefreshFn);
|
|
33
|
+
return props.useNewRce && !!(props.contextId && props.contextType && props.canvasUserId && props.rcsHost && props.rcsJwtRefreshFn && props.rcsJwt);
|
|
39
34
|
};
|
|
40
35
|
|
|
41
36
|
var getToken = function getToken() {
|
|
42
37
|
if (!hasAllPropsForNewRce()) return;
|
|
43
|
-
setStatus(_quizCommon.TokenFetchStatus.pending);
|
|
44
38
|
return new Promise(function (resolve, reject) {
|
|
45
39
|
props.rcsJwtRefreshFn().then(function (response) {
|
|
46
40
|
var token = response.token;
|
|
47
|
-
setStatus(_quizCommon.TokenFetchStatus.success);
|
|
48
41
|
setJwt(token);
|
|
49
42
|
resolve(response);
|
|
50
43
|
}, function () {
|
|
51
|
-
setStatus(_quizCommon.TokenFetchStatus.failed);
|
|
52
44
|
reject();
|
|
53
45
|
});
|
|
54
46
|
});
|
|
@@ -64,13 +56,10 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(props) {
|
|
|
64
56
|
var getConfig = function getConfig() {
|
|
65
57
|
var _config;
|
|
66
58
|
|
|
67
|
-
var config = (_config = {}, (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.useNewRce, props.useNewRce), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.canvasUserId, props.canvasUserId), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.contextId, props.contextId), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.contextType, props.contextType), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.rcsHost, props.rcsHost), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.rcsJwt, jwt), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.rcsJwtRefreshFn, refreshToken),
|
|
59
|
+
var config = (_config = {}, (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.useNewRce, props.useNewRce), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.canvasUserId, props.canvasUserId), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.contextId, props.contextId), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.contextType, props.contextType), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.rcsHost, props.rcsHost), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.rcsJwt, jwt), (0, _defineProperty2.default)(_config, _quizCommon.RceConfigKeys.rcsJwtRefreshFn, refreshToken), _config);
|
|
68
60
|
return config;
|
|
69
61
|
};
|
|
70
62
|
|
|
71
|
-
(0, _react.useEffect)(function () {
|
|
72
|
-
getToken();
|
|
73
|
-
}, [props.useNewRce]);
|
|
74
63
|
if (!hasAllPropsForNewRce()) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
|
|
75
64
|
return /*#__PURE__*/_react.default.createElement(_quizCommon.RceConfigContext.Provider, {
|
|
76
65
|
value: getConfig()
|
|
@@ -84,6 +73,7 @@ RceConfigProviderComponent.propTypes = {
|
|
|
84
73
|
contextType: _propTypes.default.string,
|
|
85
74
|
canvasUserId: _propTypes.default.string,
|
|
86
75
|
rcsHost: _propTypes.default.string,
|
|
76
|
+
rcsJwt: _propTypes.default.string,
|
|
87
77
|
rcsJwtRefreshFn: _propTypes.default.func
|
|
88
78
|
};
|
|
89
79
|
RceConfigProviderComponent.defaultProps = {
|
|
@@ -91,6 +81,7 @@ RceConfigProviderComponent.defaultProps = {
|
|
|
91
81
|
contextType: null,
|
|
92
82
|
canvasUserId: null,
|
|
93
83
|
rcsHost: null,
|
|
84
|
+
rcsJwt: null,
|
|
94
85
|
rcsJwtRefreshFn: null
|
|
95
86
|
};
|
|
96
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.38.1-rc.
|
|
3
|
+
"version": "17.38.1-rc.3+aaf9845e5",
|
|
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.38.1-rc.
|
|
45
|
-
"@instructure/quiz-i18n": "17.38.1-rc.
|
|
46
|
-
"@instructure/quiz-interactions": "17.38.1-rc.
|
|
47
|
-
"@instructure/quiz-number-input": "17.38.1-rc.
|
|
48
|
-
"@instructure/quiz-rce": "17.38.1-rc.
|
|
44
|
+
"@instructure/quiz-common": "17.38.1-rc.3+aaf9845e5",
|
|
45
|
+
"@instructure/quiz-i18n": "17.38.1-rc.3+aaf9845e5",
|
|
46
|
+
"@instructure/quiz-interactions": "17.38.1-rc.3+aaf9845e5",
|
|
47
|
+
"@instructure/quiz-number-input": "17.38.1-rc.3+aaf9845e5",
|
|
48
|
+
"@instructure/quiz-rce": "17.38.1-rc.3+aaf9845e5",
|
|
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.38.1-rc.
|
|
109
|
+
"instructure-validations": "17.38.1-rc.3+aaf9845e5",
|
|
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.38.1-rc.
|
|
140
|
+
"@instructure/quiz-scripts": "17.38.1-rc.3+aaf9845e5",
|
|
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.38.1-rc.
|
|
159
|
+
"quiz-presets": "17.38.1-rc.3+aaf9845e5",
|
|
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": "aaf9845e5b1b4d6692de912cb7d266e4bd7142be"
|
|
176
176
|
}
|