@instructure/quiz-core 17.49.1-rc.4 → 17.49.1-rc.5
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/es/common/components/RceConfigProvider/presenter.js +7 -1
- package/es/common/components/RceConfigProvider/rceConfigMapper.js +11 -3
- package/es/common/components/RceConfigProvider/rceConfigUtils.js +3 -0
- package/lib/common/components/RceConfigProvider/presenter.js +7 -1
- package/lib/common/components/RceConfigProvider/rceConfigMapper.js +10 -2
- package/lib/common/components/RceConfigProvider/rceConfigUtils.js +7 -1
- package/package.json +9 -9
|
@@ -67,6 +67,7 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(_ref2) {
|
|
|
67
67
|
contextId = _ref2.contextId,
|
|
68
68
|
contextType = _ref2.contextType,
|
|
69
69
|
canvasUserId = _ref2.canvasUserId,
|
|
70
|
+
canvasToolId = _ref2.canvasToolId,
|
|
70
71
|
rcsHost = _ref2.rcsHost,
|
|
71
72
|
rcsJwt = _ref2.rcsJwt,
|
|
72
73
|
rcsJwtRefreshFn = _ref2.rcsJwtRefreshFn,
|
|
@@ -101,6 +102,9 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(_ref2) {
|
|
|
101
102
|
isNewRCERendererEnabled: isNewRCERendererEnabled,
|
|
102
103
|
isNewRCEAppsEnabled: isNewRCEAppsEnabled
|
|
103
104
|
};
|
|
105
|
+
var ltiAppParams = {
|
|
106
|
+
canvasToolId: canvasToolId
|
|
107
|
+
};
|
|
104
108
|
var rendererParams = {
|
|
105
109
|
canvasOrigin: canvasOrigin
|
|
106
110
|
};
|
|
@@ -169,7 +173,7 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(_ref2) {
|
|
|
169
173
|
}
|
|
170
174
|
|
|
171
175
|
return /*#__PURE__*/React.createElement(RceConfigContext.Provider, {
|
|
172
|
-
value: mapParamsToRceConfigContext(flags, rcsParams, rendererParams, canvasConfig)
|
|
176
|
+
value: mapParamsToRceConfigContext(flags, rcsParams, rendererParams, canvasConfig, ltiAppParams)
|
|
173
177
|
}, children);
|
|
174
178
|
};
|
|
175
179
|
|
|
@@ -181,6 +185,7 @@ RceConfigProviderComponent.propTypes = {
|
|
|
181
185
|
contextId: PropTypes.string,
|
|
182
186
|
contextType: PropTypes.string,
|
|
183
187
|
canvasUserId: PropTypes.string,
|
|
188
|
+
canvasToolId: PropTypes.string,
|
|
184
189
|
rcsHost: PropTypes.string,
|
|
185
190
|
rcsJwt: PropTypes.string,
|
|
186
191
|
rcsJwtRefreshFn: PropTypes.func,
|
|
@@ -190,6 +195,7 @@ RceConfigProviderComponent.defaultProps = {
|
|
|
190
195
|
contextId: null,
|
|
191
196
|
contextType: null,
|
|
192
197
|
canvasUserId: null,
|
|
198
|
+
canvasToolId: null,
|
|
193
199
|
rcsHost: null,
|
|
194
200
|
rcsJwt: null,
|
|
195
201
|
rcsJwtRefreshFn: null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { RceConfigKeys } from '@instructure/quiz-common';
|
|
3
|
-
import { hasAllPropsForRcs } from "./rceConfigUtils.js";
|
|
3
|
+
import { hasAllPropsForRcs, areLtiAppsConfigured } from "./rceConfigUtils.js";
|
|
4
4
|
|
|
5
5
|
var mapFeatureFlags = function mapFeatureFlags(flags) {
|
|
6
6
|
var _ref;
|
|
@@ -18,14 +18,22 @@ var mapRcs = function mapRcs(rcsParams, canvasConfig) {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
var mapLtiApps = function mapLtiApps(flags, canvasConfig, ltiAppParams) {
|
|
22
|
+
var _ref3;
|
|
23
|
+
|
|
24
|
+
if (!areLtiAppsConfigured(flags, canvasConfig, ltiAppParams)) return null;
|
|
25
|
+
return _ref3 = {}, _defineProperty(_ref3, RceConfigKeys.canvasToolId, ltiAppParams.canvasToolId), _defineProperty(_ref3, RceConfigKeys.editorButtons, canvasConfig.editorButtons), _ref3;
|
|
26
|
+
};
|
|
27
|
+
|
|
21
28
|
var rendererEnhancement = function rendererEnhancement(rendererParams) {
|
|
22
29
|
return _defineProperty({}, RceConfigKeys.canvasOrigin, (rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.canvasOrigin) || null);
|
|
23
30
|
};
|
|
24
31
|
|
|
25
|
-
export var mapParamsToRceConfigContext = function mapParamsToRceConfigContext(flags, rcsParams, rendererParams, canvasConfig) {
|
|
32
|
+
export var mapParamsToRceConfigContext = function mapParamsToRceConfigContext(flags, rcsParams, rendererParams, canvasConfig, ltiAppParams) {
|
|
26
33
|
return {
|
|
27
34
|
featureFlags: mapFeatureFlags(flags),
|
|
28
35
|
rcs: mapRcs(rcsParams, canvasConfig),
|
|
29
|
-
rendererEnhancement: rendererEnhancement(rendererParams)
|
|
36
|
+
rendererEnhancement: rendererEnhancement(rendererParams),
|
|
37
|
+
ltiApps: mapLtiApps(flags, canvasConfig, ltiAppParams)
|
|
30
38
|
};
|
|
31
39
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export var hasAllPropsForRcs = function hasAllPropsForRcs(rcsParams) {
|
|
2
2
|
return !!((rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.contextId) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.contextType) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.canvasUserId) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.rcsHost) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.refreshToken) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.jwt));
|
|
3
3
|
};
|
|
4
|
+
export var areLtiAppsConfigured = function areLtiAppsConfigured(flags, canvasConfig, ltiAppParams) {
|
|
5
|
+
return !!((flags === null || flags === void 0 ? void 0 : flags.isNewRCEAppsEnabled) && (ltiAppParams === null || ltiAppParams === void 0 ? void 0 : ltiAppParams.canvasToolId) && (canvasConfig === null || canvasConfig === void 0 ? void 0 : canvasConfig.editorButtons) && Array.isArray(canvasConfig.editorButtons) && canvasConfig.editorButtons.length > 0);
|
|
6
|
+
};
|
|
4
7
|
export var isRce5Disabled = function isRce5Disabled(flags) {
|
|
5
8
|
return !(flags === null || flags === void 0 ? void 0 : flags.isNewRCEEnabled) && !(flags === null || flags === void 0 ? void 0 : flags.isNewRCERendererEnabled);
|
|
6
9
|
};
|
|
@@ -90,6 +90,7 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(_ref2) {
|
|
|
90
90
|
contextId = _ref2.contextId,
|
|
91
91
|
contextType = _ref2.contextType,
|
|
92
92
|
canvasUserId = _ref2.canvasUserId,
|
|
93
|
+
canvasToolId = _ref2.canvasToolId,
|
|
93
94
|
rcsHost = _ref2.rcsHost,
|
|
94
95
|
rcsJwt = _ref2.rcsJwt,
|
|
95
96
|
rcsJwtRefreshFn = _ref2.rcsJwtRefreshFn,
|
|
@@ -124,6 +125,9 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(_ref2) {
|
|
|
124
125
|
isNewRCERendererEnabled: isNewRCERendererEnabled,
|
|
125
126
|
isNewRCEAppsEnabled: isNewRCEAppsEnabled
|
|
126
127
|
};
|
|
128
|
+
var ltiAppParams = {
|
|
129
|
+
canvasToolId: canvasToolId
|
|
130
|
+
};
|
|
127
131
|
var rendererParams = {
|
|
128
132
|
canvasOrigin: canvasOrigin
|
|
129
133
|
};
|
|
@@ -192,7 +196,7 @@ var RceConfigProviderComponent = function RceConfigProviderComponent(_ref2) {
|
|
|
192
196
|
}
|
|
193
197
|
|
|
194
198
|
return /*#__PURE__*/_react.default.createElement(_quizCommon.RceConfigContext.Provider, {
|
|
195
|
-
value: (0, _rceConfigMapper.mapParamsToRceConfigContext)(flags, rcsParams, rendererParams, canvasConfig)
|
|
199
|
+
value: (0, _rceConfigMapper.mapParamsToRceConfigContext)(flags, rcsParams, rendererParams, canvasConfig, ltiAppParams)
|
|
196
200
|
}, children);
|
|
197
201
|
};
|
|
198
202
|
|
|
@@ -204,6 +208,7 @@ RceConfigProviderComponent.propTypes = {
|
|
|
204
208
|
contextId: _propTypes.default.string,
|
|
205
209
|
contextType: _propTypes.default.string,
|
|
206
210
|
canvasUserId: _propTypes.default.string,
|
|
211
|
+
canvasToolId: _propTypes.default.string,
|
|
207
212
|
rcsHost: _propTypes.default.string,
|
|
208
213
|
rcsJwt: _propTypes.default.string,
|
|
209
214
|
rcsJwtRefreshFn: _propTypes.default.func,
|
|
@@ -213,6 +218,7 @@ RceConfigProviderComponent.defaultProps = {
|
|
|
213
218
|
contextId: null,
|
|
214
219
|
contextType: null,
|
|
215
220
|
canvasUserId: null,
|
|
221
|
+
canvasToolId: null,
|
|
216
222
|
rcsHost: null,
|
|
217
223
|
rcsJwt: null,
|
|
218
224
|
rcsJwtRefreshFn: null,
|
|
@@ -29,15 +29,23 @@ var mapRcs = function mapRcs(rcsParams, canvasConfig) {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
var mapLtiApps = function mapLtiApps(flags, canvasConfig, ltiAppParams) {
|
|
33
|
+
var _ref3;
|
|
34
|
+
|
|
35
|
+
if (!(0, _rceConfigUtils.areLtiAppsConfigured)(flags, canvasConfig, ltiAppParams)) return null;
|
|
36
|
+
return _ref3 = {}, (0, _defineProperty2.default)(_ref3, _quizCommon.RceConfigKeys.canvasToolId, ltiAppParams.canvasToolId), (0, _defineProperty2.default)(_ref3, _quizCommon.RceConfigKeys.editorButtons, canvasConfig.editorButtons), _ref3;
|
|
37
|
+
};
|
|
38
|
+
|
|
32
39
|
var rendererEnhancement = function rendererEnhancement(rendererParams) {
|
|
33
40
|
return (0, _defineProperty2.default)({}, _quizCommon.RceConfigKeys.canvasOrigin, (rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.canvasOrigin) || null);
|
|
34
41
|
};
|
|
35
42
|
|
|
36
|
-
var mapParamsToRceConfigContext = function mapParamsToRceConfigContext(flags, rcsParams, rendererParams, canvasConfig) {
|
|
43
|
+
var mapParamsToRceConfigContext = function mapParamsToRceConfigContext(flags, rcsParams, rendererParams, canvasConfig, ltiAppParams) {
|
|
37
44
|
return {
|
|
38
45
|
featureFlags: mapFeatureFlags(flags),
|
|
39
46
|
rcs: mapRcs(rcsParams, canvasConfig),
|
|
40
|
-
rendererEnhancement: rendererEnhancement(rendererParams)
|
|
47
|
+
rendererEnhancement: rendererEnhancement(rendererParams),
|
|
48
|
+
ltiApps: mapLtiApps(flags, canvasConfig, ltiAppParams)
|
|
41
49
|
};
|
|
42
50
|
};
|
|
43
51
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isRce5Disabled = exports.hasAllPropsForRcs = void 0;
|
|
6
|
+
exports.isRce5Disabled = exports.areLtiAppsConfigured = exports.hasAllPropsForRcs = void 0;
|
|
7
7
|
|
|
8
8
|
var hasAllPropsForRcs = function hasAllPropsForRcs(rcsParams) {
|
|
9
9
|
return !!((rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.contextId) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.contextType) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.canvasUserId) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.rcsHost) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.refreshToken) && (rcsParams === null || rcsParams === void 0 ? void 0 : rcsParams.jwt));
|
|
@@ -11,6 +11,12 @@ var hasAllPropsForRcs = function hasAllPropsForRcs(rcsParams) {
|
|
|
11
11
|
|
|
12
12
|
exports.hasAllPropsForRcs = hasAllPropsForRcs;
|
|
13
13
|
|
|
14
|
+
var areLtiAppsConfigured = function areLtiAppsConfigured(flags, canvasConfig, ltiAppParams) {
|
|
15
|
+
return !!((flags === null || flags === void 0 ? void 0 : flags.isNewRCEAppsEnabled) && (ltiAppParams === null || ltiAppParams === void 0 ? void 0 : ltiAppParams.canvasToolId) && (canvasConfig === null || canvasConfig === void 0 ? void 0 : canvasConfig.editorButtons) && Array.isArray(canvasConfig.editorButtons) && canvasConfig.editorButtons.length > 0);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.areLtiAppsConfigured = areLtiAppsConfigured;
|
|
19
|
+
|
|
14
20
|
var isRce5Disabled = function isRce5Disabled(flags) {
|
|
15
21
|
return !(flags === null || flags === void 0 ? void 0 : flags.isNewRCEEnabled) && !(flags === null || flags === void 0 ? void 0 : flags.isNewRCERendererEnabled);
|
|
16
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "17.49.1-rc.
|
|
3
|
+
"version": "17.49.1-rc.5+64019c505",
|
|
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.49.1-rc.
|
|
45
|
-
"@instructure/quiz-i18n": "17.49.1-rc.
|
|
46
|
-
"@instructure/quiz-interactions": "17.49.1-rc.
|
|
47
|
-
"@instructure/quiz-number-input": "17.49.1-rc.
|
|
48
|
-
"@instructure/quiz-rce": "17.49.1-rc.
|
|
44
|
+
"@instructure/quiz-common": "17.49.1-rc.5+64019c505",
|
|
45
|
+
"@instructure/quiz-i18n": "17.49.1-rc.5+64019c505",
|
|
46
|
+
"@instructure/quiz-interactions": "17.49.1-rc.5+64019c505",
|
|
47
|
+
"@instructure/quiz-number-input": "17.49.1-rc.5+64019c505",
|
|
48
|
+
"@instructure/quiz-rce": "17.49.1-rc.5+64019c505",
|
|
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.49.1-rc.
|
|
109
|
+
"instructure-validations": "17.49.1-rc.5+64019c505",
|
|
110
110
|
"ipaddr.js": "^1.5.4",
|
|
111
111
|
"isomorphic-fetch": "^2.2.0",
|
|
112
112
|
"isuuid": "^0.1.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.49.1-rc.
|
|
159
|
+
"quiz-presets": "17.49.1-rc.5+64019c505",
|
|
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": "64019c505076e70430601ccbed94f7a94898ca21"
|
|
176
176
|
}
|