@instructure/quiz-core 20.11.3-rc.22 → 20.11.3-rc.24

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.
@@ -510,7 +510,9 @@ export var Bank = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
510
510
  scope: PropTypes.shape({
511
511
  type: PropTypes.string,
512
512
  uuid: PropTypes.string,
513
- title: PropTypes.string
513
+ title: PropTypes.string,
514
+ launch_context_uuid: PropTypes.string,
515
+ root_account_name: PropTypes.string
514
516
  }),
515
517
  courseSharedBank: ImmutablePropTypes.map,
516
518
  returnToUrl: PropTypes.string,
@@ -190,7 +190,8 @@ export var BankEntry = (_dec = withStyle(generateStyle, generateComponentTheme),
190
190
  shouldValidateShareableContent: true,
191
191
  stimulus: entry,
192
192
  submitHandler: _this.submitHandler,
193
- validationErrorsFromApi: _this.state.validationErrorsFromApi
193
+ validationErrorsFromApi: _this.state.validationErrorsFromApi,
194
+ scope: _this.props.scope
194
195
  };
195
196
  };
196
197
 
@@ -686,7 +687,9 @@ export var BankEntry = (_dec = withStyle(generateStyle, generateComponentTheme),
686
687
  scope: PropTypes.objectOf(PropTypes.shape({
687
688
  type: PropTypes.string,
688
689
  uuid: PropTypes.string,
689
- title: PropTypes.string
690
+ title: PropTypes.string,
691
+ launch_context_uuid: PropTypes.string,
692
+ root_account_name: PropTypes.string
690
693
  })),
691
694
  returnToUrl: PropTypes.string,
692
695
  // from consumer
@@ -16,7 +16,7 @@ function mapStateToProps(state, props) {
16
16
  var sortOrder = pageData.get('sortOrder', 'ascending');
17
17
  var searchTerms = pageData.get('searchTerms', null);
18
18
  var searchSelection = pageData.get('searchSelection', []);
19
- var rootAccountUuid = state.getIn(['outcomes', 'contextUuid']);
19
+ var rootAccountUuid = state.getIn(['outcomes', 'externalAccountUuid']);
20
20
  return {
21
21
  itemBankSearchTableEnabled: featureOn('item_bank_search_table'),
22
22
  improvedBankSharingEnabled: featureOn('improved_bank_sharing'),
@@ -131,12 +131,6 @@ export var Banks = (_dec = withStyle(generateStyle, generateComponentTheme), _de
131
131
  _this.props.merge(BANKS_BANK_FILTERS, {
132
132
  scopeType: scopeType
133
133
  });
134
-
135
- if (scopeType === 'account') {
136
- _this.setState({
137
- hiddenAccountSearch: true
138
- });
139
- }
140
134
  };
141
135
 
142
136
  _this.getSortingOrderIcon = function () {
@@ -191,7 +191,9 @@ export var CreateBankModal = (_dec = withStyle(generateStyle, generateComponentT
191
191
  itemBanksScope: PropTypes.shape({
192
192
  type: PropTypes.string,
193
193
  uuid: PropTypes.string,
194
- title: PropTypes.string
194
+ title: PropTypes.string,
195
+ launch_context_uuid: PropTypes.string,
196
+ root_account_name: PropTypes.string
195
197
  }),
196
198
  // eslint-disable-next-line react/require-default-props,react/forbid-prop-types
197
199
  styles: PropTypes.object
@@ -87,7 +87,8 @@ export var BanksTray = /*#__PURE__*/function (_Component) {
87
87
  bankId: activeBankId,
88
88
  bankEntryId: activeBankEntryId,
89
89
  navigateToBanks: this.clearActiveBank,
90
- navigateToBank: this.navigateToBank
90
+ navigateToBank: this.navigateToBank,
91
+ scope: this.props.itemBanksScope
91
92
  });
92
93
  } else {
93
94
  return /*#__PURE__*/React.createElement(Bank, {
@@ -200,7 +201,9 @@ BanksTray.propTypes = {
200
201
  itemBanksScope: PropTypes.shape({
201
202
  type: PropTypes.string,
202
203
  uuid: PropTypes.string,
203
- title: PropTypes.string
204
+ title: PropTypes.string,
205
+ launch_context_uuid: PropTypes.string,
206
+ root_account_name: PropTypes.string
204
207
  })
205
208
  };
206
209
  BanksTray.defaultProps = {
@@ -1,10 +1,16 @@
1
- import { SET_CONTEXT_UUID, SET_OUTCOMES_ENDPOINT, SET_OUTCOMES_TOKEN } from '@instructure/quiz-common';
1
+ import { SET_CONTEXT_UUID, SET_OUTCOMES_ENDPOINT, SET_OUTCOMES_TOKEN, SET_EXTERNAL_ACCOUNT_UUID } from '@instructure/quiz-common';
2
2
  export function setContextUuid(contextUuid) {
3
3
  return {
4
4
  type: SET_CONTEXT_UUID,
5
5
  payload: contextUuid
6
6
  };
7
7
  }
8
+ export function setExternalAccountUuid(externalAccountUuid) {
9
+ return {
10
+ type: SET_EXTERNAL_ACCOUNT_UUID,
11
+ payload: externalAccountUuid
12
+ };
13
+ }
8
14
  export function setOutcomesEndpoint(endpoint) {
9
15
  return {
10
16
  type: SET_OUTCOMES_ENDPOINT,
@@ -22,7 +22,7 @@ import { getLocale } from '@instructure/quiz-common';
22
22
  import { set } from "../../actions/ui.js";
23
23
  import { addAlert } from "../../actions/alerts.js";
24
24
  import { setAPIEndpoint, setCanvasOrigin, setUserToken } from "../../actions/config.js";
25
- import { setContextUuid, setOutcomesEndpoint, setOutcomesToken } from "../../actions/outcomes.js";
25
+ import { setContextUuid, setOutcomesEndpoint, setOutcomesToken, setExternalAccountUuid } from "../../actions/outcomes.js";
26
26
  import { addFeatures, removeFeatures } from "../../actions/features.js";
27
27
  import { setGradeByQuestionEnabled } from "../../actions/grading.js";
28
28
  import { renderAlerts } from "../../util/renderAlerts.js";
@@ -81,7 +81,7 @@ export var SDKApp = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp
81
81
  value: function componentWillMount() {
82
82
  var _this$props$rceConfig;
83
83
 
84
- this.store.dispatch([setAPIEndpoint(this.props.apiEndpoint), setCanvasOrigin((_this$props$rceConfig = this.props.rceConfig) === null || _this$props$rceConfig === void 0 ? void 0 : _this$props$rceConfig.canvasOrigin), this.setAppContainer(this.props.appContainer), setUserToken(this.props.userToken), setOutcomesEndpoint(this.props.outcomesEndpoint), setOutcomesToken(this.props.outcomesToken), setContextUuid(this.props.contextUuid)]);
84
+ this.store.dispatch([setAPIEndpoint(this.props.apiEndpoint), setCanvasOrigin((_this$props$rceConfig = this.props.rceConfig) === null || _this$props$rceConfig === void 0 ? void 0 : _this$props$rceConfig.canvasOrigin), this.setAppContainer(this.props.appContainer), setUserToken(this.props.userToken), setOutcomesEndpoint(this.props.outcomesEndpoint), setOutcomesToken(this.props.outcomesToken), setContextUuid(this.props.contextUuid), setExternalAccountUuid(this.props.externalAccountUuid)]);
85
85
 
86
86
  if (this.props.itemBankSharingEnabled) {
87
87
  this.store.dispatch(addFeatures('item_bank_sharing'));
@@ -139,6 +139,10 @@ export var SDKApp = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp
139
139
  if (newProps.gradeByQuestionEnabled !== this.props.gradeByQuestionEnabled && this.props.gradeByQuestionEnabled !== null) {
140
140
  this.store.dispatch(setGradeByQuestionEnabled(newProps.gradeByQuestionEnabled));
141
141
  }
142
+
143
+ if (newProps.externalAccountUuid !== this.props.externalAccountUuid) {
144
+ this.store.dispatch(setExternalAccountUuid(newProps.externalAccountUuid));
145
+ }
142
146
  }
143
147
  }, {
144
148
  key: "render",
@@ -167,6 +171,7 @@ export var SDKApp = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp
167
171
  appContainer: CustomPropTypes.selectors.isRequired,
168
172
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
169
173
  contextUuid: PropTypes.string,
174
+ externalAccountUuid: PropTypes.string,
170
175
  gradeByQuestionEnabled: PropTypes.bool,
171
176
  itemBankSharingEnabled: PropTypes.bool,
172
177
  // ESLint seems to this the "locale" prop is unused even though it definitely is
@@ -196,6 +201,7 @@ export var SDKApp = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp
196
201
  locale: PropTypes.string
197
202
  }, _class2.defaultProps = {
198
203
  contextUuid: '',
204
+ externalAccountUuid: '',
199
205
  gradeByQuestionEnabled: null,
200
206
  itemBankSharingEnabled: false,
201
207
  locale: null,
@@ -19,7 +19,8 @@ export function mapStateToProps(state, props) {
19
19
  var workingItem = props.entry.getWorkingInstance();
20
20
  var isValid = workingItem.isValid();
21
21
  var errorsShowing = state.get('errorsShowing', Map());
22
- var errorsAreShowing = errorsShowing.get(props.guid);
22
+ var errorsAreShowing = errorsShowing.get(props.guid); // Null must always be passed to contextUuid when working with banks
23
+
23
24
  var contextUuid = props.contextUuid === void 0 ? state.getIn(['outcomes', 'contextUuid']) : props.contextUuid;
24
25
  return {
25
26
  answerFeedbackEnabled: featureOn('answer_level_feedback'),
@@ -37,7 +38,9 @@ export function mapStateToProps(state, props) {
37
38
  partialDeepScoringEnabled: featureOn('partial_deep_scoring'),
38
39
  partialScoringEnabled: featureOn('partial_scoring'),
39
40
  quizId: getActiveQuizId(state),
40
- showCalculator: featureOn('calculator_per_question')
41
+ showCalculator: featureOn('calculator_per_question'),
42
+ scope: props.scope,
43
+ rootAccountUuid: state.getIn(['outcomes', 'externalAccountUuid'])
41
44
  };
42
45
  }
43
46
 
@@ -16,6 +16,7 @@ import t from '@instructure/quiz-i18n/es/format-message';
16
16
  import { propsForInteractionEdit } from "../../../../util/interactionTypePropsHelper.js";
17
17
  import elementsForSelectors from "../../../../../common/util/ElementsForSelectors.js";
18
18
  import { toErrors } from "../../../../util/instUIMessages.js";
19
+ import { featureOn } from "../../../../../common/util/featureCheck.js";
19
20
  export var ItemEdit = /*#__PURE__*/function (_Component) {
20
21
  _inherits(ItemEdit, _Component);
21
22
 
@@ -73,27 +74,53 @@ export var ItemEdit = /*#__PURE__*/function (_Component) {
73
74
  workingItem = _this$props.workingItem;
74
75
  var itemId = guid || workingItem.get('id');
75
76
  var outcomeAlignmentSetGuid = workingItem.get('outcomeAlignmentSetGuid');
77
+ var launchContexts = [];
78
+ var rootAccountName = this.props.scope.root_account_name;
79
+ var launchContextUuid = this.props.scope.launch_context_uuid;
80
+ var launchContextTitle = this.props.scope.title; // If editing within a quiz, there is no account launch context
81
+
82
+ if (featureOn('sub_account_bank_sharing') && rootAccountName) {
83
+ launchContexts.push({
84
+ uuid: this.props.rootAccountUuid,
85
+ name: rootAccountName
86
+ }); // Add if it is a course or sub-account launch context
87
+
88
+ if (launchContextUuid && launchContextUuid !== this.props.rootAccountUuid) {
89
+ launchContexts.push({
90
+ uuid: launchContextUuid,
91
+ name: launchContextTitle
92
+ });
93
+ }
94
+ }
95
+
76
96
  var options = [];
77
97
 
78
98
  if (this.props.outcomesEndpoint) {
79
99
  options.push({
80
100
  key: 'outcomes',
81
- title: /*#__PURE__*/React.createElement("span", null, t('Align to Outcomes'), " ", /*#__PURE__*/React.createElement(OutcomeCount, {
101
+ title: /*#__PURE__*/React.createElement("span", null, t('Align to Outcomes'), /*#__PURE__*/React.createElement(OutcomeCount, Object.assign({
82
102
  alignmentSetId: outcomeAlignmentSetGuid,
83
103
  artifactType: "quizEntry",
84
104
  artifactId: itemId,
85
- contextUuid: this.props.contextUuid,
105
+ contextUuid: this.props.contextUuid // Both components need to be aware of the launch contexts
106
+
107
+ }, launchContexts.length > 0 && {
108
+ launchContexts: launchContexts
109
+ }, {
86
110
  host: this.props.outcomesEndpoint,
87
111
  jwt: this.props.outcomesToken,
88
112
  screenreaderNotification: this.props.screenreaderNotification,
89
113
  liveRegion: liveRegion
90
- })),
91
- component: /*#__PURE__*/React.createElement(OutcomeAlignments, {
114
+ }))),
115
+ component: /*#__PURE__*/React.createElement(OutcomeAlignments, Object.assign({
92
116
  artifactType: "quizEntry",
93
117
  artifactId: itemId,
94
118
  applicationElement: this.applicationElement,
95
119
  alignmentSetId: outcomeAlignmentSetGuid,
96
- contextUuid: this.props.contextUuid,
120
+ contextUuid: this.props.contextUuid
121
+ }, launchContexts.length > 0 && {
122
+ launchContexts: launchContexts
123
+ }, {
97
124
  emptySetHeading: t('Align Institution outcomes to this question.'),
98
125
  host: this.props.outcomesEndpoint,
99
126
  jwt: this.props.outcomesToken,
@@ -102,7 +129,7 @@ export var ItemEdit = /*#__PURE__*/function (_Component) {
102
129
  onUpdate: this.onOutcomeAlignmentSetChange,
103
130
  screenreaderNotification: this.props.screenreaderNotification,
104
131
  liveRegion: liveRegion
105
- })
132
+ }))
106
133
  });
107
134
  }
108
135
 
@@ -171,7 +198,15 @@ ItemEdit.propTypes = {
171
198
  validationErrorsFromApi: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.shape({
172
199
  type: PropTypes.string,
173
200
  text: PropTypes.string
174
- })))
201
+ }))),
202
+ scope: PropTypes.shape({
203
+ type: PropTypes.string,
204
+ uuid: PropTypes.string,
205
+ title: PropTypes.string,
206
+ launch_context_uuid: PropTypes.string,
207
+ root_account_name: PropTypes.string
208
+ }),
209
+ rootAccountUuid: PropTypes.string
175
210
  };
176
211
  ItemEdit.defaultProps = {
177
212
  additionalOptions: [],
@@ -186,6 +221,8 @@ ItemEdit.defaultProps = {
186
221
  quizId: null,
187
222
  initialFocusId: null,
188
223
  showCalculator: false,
189
- validationErrorsFromApi: {}
224
+ validationErrorsFromApi: {},
225
+ scope: {},
226
+ rootAccountUuid: null
190
227
  };
191
228
  export default ItemEdit;
@@ -1,9 +1,10 @@
1
1
  import { fromJS } from 'immutable';
2
- import { SET_CONTEXT_UUID, SET_OUTCOMES_ENDPOINT, SET_OUTCOMES_TOKEN } from '@instructure/quiz-common';
2
+ import { SET_CONTEXT_UUID, SET_OUTCOMES_ENDPOINT, SET_OUTCOMES_TOKEN, SET_EXTERNAL_ACCOUNT_UUID } from '@instructure/quiz-common';
3
3
  var defaultState = fromJS({
4
4
  contextUuid: '',
5
5
  outcomesEndpoint: '',
6
- outcomesToken: ''
6
+ outcomesToken: '',
7
+ externalAccountUuid: ''
7
8
  });
8
9
  export default (function () {
9
10
  var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultState;
@@ -19,6 +20,9 @@ export default (function () {
19
20
  case SET_OUTCOMES_TOKEN:
20
21
  return state.set('outcomesToken', action.payload);
21
22
 
23
+ case SET_EXTERNAL_ACCOUNT_UUID:
24
+ return state.set('externalAccountUuid', action.payload);
25
+
22
26
  default:
23
27
  return state;
24
28
  }
@@ -553,7 +553,9 @@ var Bank = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
553
553
  scope: _propTypes.default.shape({
554
554
  type: _propTypes.default.string,
555
555
  uuid: _propTypes.default.string,
556
- title: _propTypes.default.string
556
+ title: _propTypes.default.string,
557
+ launch_context_uuid: _propTypes.default.string,
558
+ root_account_name: _propTypes.default.string
557
559
  }),
558
560
  courseSharedBank: _reactImmutableProptypes.default.map,
559
561
  returnToUrl: _propTypes.default.string,
@@ -240,7 +240,8 @@ var BankEntry = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
240
240
  shouldValidateShareableContent: true,
241
241
  stimulus: entry,
242
242
  submitHandler: _this.submitHandler,
243
- validationErrorsFromApi: _this.state.validationErrorsFromApi
243
+ validationErrorsFromApi: _this.state.validationErrorsFromApi,
244
+ scope: _this.props.scope
244
245
  };
245
246
  };
246
247
 
@@ -735,7 +736,9 @@ var BankEntry = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
735
736
  scope: _propTypes.default.objectOf(_propTypes.default.shape({
736
737
  type: _propTypes.default.string,
737
738
  uuid: _propTypes.default.string,
738
- title: _propTypes.default.string
739
+ title: _propTypes.default.string,
740
+ launch_context_uuid: _propTypes.default.string,
741
+ root_account_name: _propTypes.default.string
739
742
  })),
740
743
  returnToUrl: _propTypes.default.string,
741
744
  // from consumer
@@ -34,7 +34,7 @@ function mapStateToProps(state, props) {
34
34
  var sortOrder = pageData.get('sortOrder', 'ascending');
35
35
  var searchTerms = pageData.get('searchTerms', null);
36
36
  var searchSelection = pageData.get('searchSelection', []);
37
- var rootAccountUuid = state.getIn(['outcomes', 'contextUuid']);
37
+ var rootAccountUuid = state.getIn(['outcomes', 'externalAccountUuid']);
38
38
  return {
39
39
  itemBankSearchTableEnabled: (0, _featureCheck.featureOn)('item_bank_search_table'),
40
40
  improvedBankSharingEnabled: (0, _featureCheck.featureOn)('improved_bank_sharing'),
@@ -171,12 +171,6 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
171
171
  _this.props.merge(_quizCommon.BANKS_BANK_FILTERS, {
172
172
  scopeType: scopeType
173
173
  });
174
-
175
- if (scopeType === 'account') {
176
- _this.setState({
177
- hiddenAccountSearch: true
178
- });
179
- }
180
174
  };
181
175
 
182
176
  _this.getSortingOrderIcon = function () {
@@ -215,7 +215,9 @@ var CreateBankModal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.de
215
215
  itemBanksScope: _propTypes.default.shape({
216
216
  type: _propTypes.default.string,
217
217
  uuid: _propTypes.default.string,
218
- title: _propTypes.default.string
218
+ title: _propTypes.default.string,
219
+ launch_context_uuid: _propTypes.default.string,
220
+ root_account_name: _propTypes.default.string
219
221
  }),
220
222
  // eslint-disable-next-line react/require-default-props,react/forbid-prop-types
221
223
  styles: _propTypes.default.object
@@ -115,7 +115,8 @@ var BanksTray = /*#__PURE__*/function (_Component) {
115
115
  bankId: activeBankId,
116
116
  bankEntryId: activeBankEntryId,
117
117
  navigateToBanks: this.clearActiveBank,
118
- navigateToBank: this.navigateToBank
118
+ navigateToBank: this.navigateToBank,
119
+ scope: this.props.itemBanksScope
119
120
  });
120
121
  } else {
121
122
  return /*#__PURE__*/_react.default.createElement(_index3.default, {
@@ -229,7 +230,9 @@ BanksTray.propTypes = {
229
230
  itemBanksScope: _propTypes.default.shape({
230
231
  type: _propTypes.default.string,
231
232
  uuid: _propTypes.default.string,
232
- title: _propTypes.default.string
233
+ title: _propTypes.default.string,
234
+ launch_context_uuid: _propTypes.default.string,
235
+ root_account_name: _propTypes.default.string
233
236
  })
234
237
  };
235
238
  BanksTray.defaultProps = {
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.setContextUuid = setContextUuid;
7
+ exports.setExternalAccountUuid = setExternalAccountUuid;
7
8
  exports.setOutcomesEndpoint = setOutcomesEndpoint;
8
9
  exports.setOutcomesToken = setOutcomesToken;
9
10
 
@@ -16,6 +17,13 @@ function setContextUuid(contextUuid) {
16
17
  };
17
18
  }
18
19
 
20
+ function setExternalAccountUuid(externalAccountUuid) {
21
+ return {
22
+ type: _quizCommon.SET_EXTERNAL_ACCOUNT_UUID,
23
+ payload: externalAccountUuid
24
+ };
25
+ }
26
+
19
27
  function setOutcomesEndpoint(endpoint) {
20
28
  return {
21
29
  type: _quizCommon.SET_OUTCOMES_ENDPOINT,
@@ -108,7 +108,7 @@ var SDKApp = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class
108
108
  value: function componentWillMount() {
109
109
  var _this$props$rceConfig;
110
110
 
111
- this.store.dispatch([(0, _config.setAPIEndpoint)(this.props.apiEndpoint), (0, _config.setCanvasOrigin)((_this$props$rceConfig = this.props.rceConfig) === null || _this$props$rceConfig === void 0 ? void 0 : _this$props$rceConfig.canvasOrigin), this.setAppContainer(this.props.appContainer), (0, _config.setUserToken)(this.props.userToken), (0, _outcomes.setOutcomesEndpoint)(this.props.outcomesEndpoint), (0, _outcomes.setOutcomesToken)(this.props.outcomesToken), (0, _outcomes.setContextUuid)(this.props.contextUuid)]);
111
+ this.store.dispatch([(0, _config.setAPIEndpoint)(this.props.apiEndpoint), (0, _config.setCanvasOrigin)((_this$props$rceConfig = this.props.rceConfig) === null || _this$props$rceConfig === void 0 ? void 0 : _this$props$rceConfig.canvasOrigin), this.setAppContainer(this.props.appContainer), (0, _config.setUserToken)(this.props.userToken), (0, _outcomes.setOutcomesEndpoint)(this.props.outcomesEndpoint), (0, _outcomes.setOutcomesToken)(this.props.outcomesToken), (0, _outcomes.setContextUuid)(this.props.contextUuid), (0, _outcomes.setExternalAccountUuid)(this.props.externalAccountUuid)]);
112
112
 
113
113
  if (this.props.itemBankSharingEnabled) {
114
114
  this.store.dispatch((0, _features.addFeatures)('item_bank_sharing'));
@@ -166,6 +166,10 @@ var SDKApp = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class
166
166
  if (newProps.gradeByQuestionEnabled !== this.props.gradeByQuestionEnabled && this.props.gradeByQuestionEnabled !== null) {
167
167
  this.store.dispatch((0, _grading.setGradeByQuestionEnabled)(newProps.gradeByQuestionEnabled));
168
168
  }
169
+
170
+ if (newProps.externalAccountUuid !== this.props.externalAccountUuid) {
171
+ this.store.dispatch((0, _outcomes.setExternalAccountUuid)(newProps.externalAccountUuid));
172
+ }
169
173
  }
170
174
  }, {
171
175
  key: "render",
@@ -193,6 +197,7 @@ var SDKApp = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class
193
197
  appContainer: _CustomPropTypes.default.selectors.isRequired,
194
198
  children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
195
199
  contextUuid: _propTypes.default.string,
200
+ externalAccountUuid: _propTypes.default.string,
196
201
  gradeByQuestionEnabled: _propTypes.default.bool,
197
202
  itemBankSharingEnabled: _propTypes.default.bool,
198
203
  // ESLint seems to this the "locale" prop is unused even though it definitely is
@@ -222,6 +227,7 @@ var SDKApp = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class
222
227
  locale: _propTypes.default.string
223
228
  }, _class2.defaultProps = {
224
229
  contextUuid: '',
230
+ externalAccountUuid: '',
225
231
  gradeByQuestionEnabled: null,
226
232
  itemBankSharingEnabled: false,
227
233
  locale: null,
@@ -47,7 +47,8 @@ function mapStateToProps(state, props) {
47
47
  var workingItem = props.entry.getWorkingInstance();
48
48
  var isValid = workingItem.isValid();
49
49
  var errorsShowing = state.get('errorsShowing', (0, _immutable.Map)());
50
- var errorsAreShowing = errorsShowing.get(props.guid);
50
+ var errorsAreShowing = errorsShowing.get(props.guid); // Null must always be passed to contextUuid when working with banks
51
+
51
52
  var contextUuid = props.contextUuid === void 0 ? state.getIn(['outcomes', 'contextUuid']) : props.contextUuid;
52
53
  return {
53
54
  answerFeedbackEnabled: (0, _featureCheck.featureOn)('answer_level_feedback'),
@@ -65,7 +66,9 @@ function mapStateToProps(state, props) {
65
66
  partialDeepScoringEnabled: (0, _featureCheck.featureOn)('partial_deep_scoring'),
66
67
  partialScoringEnabled: (0, _featureCheck.featureOn)('partial_scoring'),
67
68
  quizId: (0, _quizzes2.getActiveQuizId)(state),
68
- showCalculator: (0, _featureCheck.featureOn)('calculator_per_question')
69
+ showCalculator: (0, _featureCheck.featureOn)('calculator_per_question'),
70
+ scope: props.scope,
71
+ rootAccountUuid: state.getIn(['outcomes', 'externalAccountUuid'])
69
72
  };
70
73
  }
71
74
 
@@ -45,6 +45,8 @@ var _ElementsForSelectors = _interopRequireDefault(require("../../../../../commo
45
45
 
46
46
  var _instUIMessages = require("../../../../util/instUIMessages.js");
47
47
 
48
+ var _featureCheck = require("../../../../../common/util/featureCheck.js");
49
+
48
50
  var ItemEdit = /*#__PURE__*/function (_Component) {
49
51
  (0, _inherits2.default)(ItemEdit, _Component);
50
52
 
@@ -102,27 +104,53 @@ var ItemEdit = /*#__PURE__*/function (_Component) {
102
104
  workingItem = _this$props.workingItem;
103
105
  var itemId = guid || workingItem.get('id');
104
106
  var outcomeAlignmentSetGuid = workingItem.get('outcomeAlignmentSetGuid');
107
+ var launchContexts = [];
108
+ var rootAccountName = this.props.scope.root_account_name;
109
+ var launchContextUuid = this.props.scope.launch_context_uuid;
110
+ var launchContextTitle = this.props.scope.title; // If editing within a quiz, there is no account launch context
111
+
112
+ if ((0, _featureCheck.featureOn)('sub_account_bank_sharing') && rootAccountName) {
113
+ launchContexts.push({
114
+ uuid: this.props.rootAccountUuid,
115
+ name: rootAccountName
116
+ }); // Add if it is a course or sub-account launch context
117
+
118
+ if (launchContextUuid && launchContextUuid !== this.props.rootAccountUuid) {
119
+ launchContexts.push({
120
+ uuid: launchContextUuid,
121
+ name: launchContextTitle
122
+ });
123
+ }
124
+ }
125
+
105
126
  var options = [];
106
127
 
107
128
  if (this.props.outcomesEndpoint) {
108
129
  options.push({
109
130
  key: 'outcomes',
110
- title: /*#__PURE__*/_react.default.createElement("span", null, (0, _formatMessage.default)('Align to Outcomes'), " ", /*#__PURE__*/_react.default.createElement(_OutcomeCount.default, {
131
+ title: /*#__PURE__*/_react.default.createElement("span", null, (0, _formatMessage.default)('Align to Outcomes'), /*#__PURE__*/_react.default.createElement(_OutcomeCount.default, Object.assign({
111
132
  alignmentSetId: outcomeAlignmentSetGuid,
112
133
  artifactType: "quizEntry",
113
134
  artifactId: itemId,
114
- contextUuid: this.props.contextUuid,
135
+ contextUuid: this.props.contextUuid // Both components need to be aware of the launch contexts
136
+
137
+ }, launchContexts.length > 0 && {
138
+ launchContexts: launchContexts
139
+ }, {
115
140
  host: this.props.outcomesEndpoint,
116
141
  jwt: this.props.outcomesToken,
117
142
  screenreaderNotification: this.props.screenreaderNotification,
118
143
  liveRegion: _quizCommon.liveRegion
119
- })),
120
- component: /*#__PURE__*/_react.default.createElement(_OutcomeAlignments.default, {
144
+ }))),
145
+ component: /*#__PURE__*/_react.default.createElement(_OutcomeAlignments.default, Object.assign({
121
146
  artifactType: "quizEntry",
122
147
  artifactId: itemId,
123
148
  applicationElement: this.applicationElement,
124
149
  alignmentSetId: outcomeAlignmentSetGuid,
125
- contextUuid: this.props.contextUuid,
150
+ contextUuid: this.props.contextUuid
151
+ }, launchContexts.length > 0 && {
152
+ launchContexts: launchContexts
153
+ }, {
126
154
  emptySetHeading: (0, _formatMessage.default)('Align Institution outcomes to this question.'),
127
155
  host: this.props.outcomesEndpoint,
128
156
  jwt: this.props.outcomesToken,
@@ -131,7 +159,7 @@ var ItemEdit = /*#__PURE__*/function (_Component) {
131
159
  onUpdate: this.onOutcomeAlignmentSetChange,
132
160
  screenreaderNotification: this.props.screenreaderNotification,
133
161
  liveRegion: _quizCommon.liveRegion
134
- })
162
+ }))
135
163
  });
136
164
  }
137
165
 
@@ -201,7 +229,15 @@ ItemEdit.propTypes = {
201
229
  validationErrorsFromApi: _propTypes.default.objectOf(_propTypes.default.arrayOf(_propTypes.default.shape({
202
230
  type: _propTypes.default.string,
203
231
  text: _propTypes.default.string
204
- })))
232
+ }))),
233
+ scope: _propTypes.default.shape({
234
+ type: _propTypes.default.string,
235
+ uuid: _propTypes.default.string,
236
+ title: _propTypes.default.string,
237
+ launch_context_uuid: _propTypes.default.string,
238
+ root_account_name: _propTypes.default.string
239
+ }),
240
+ rootAccountUuid: _propTypes.default.string
205
241
  };
206
242
  ItemEdit.defaultProps = {
207
243
  additionalOptions: [],
@@ -216,7 +252,9 @@ ItemEdit.defaultProps = {
216
252
  quizId: null,
217
253
  initialFocusId: null,
218
254
  showCalculator: false,
219
- validationErrorsFromApi: {}
255
+ validationErrorsFromApi: {},
256
+ scope: {},
257
+ rootAccountUuid: null
220
258
  };
221
259
  var _default = ItemEdit;
222
260
  exports.default = _default;
@@ -12,7 +12,8 @@ var _quizCommon = require("@instructure/quiz-common");
12
12
  var defaultState = (0, _immutable.fromJS)({
13
13
  contextUuid: '',
14
14
  outcomesEndpoint: '',
15
- outcomesToken: ''
15
+ outcomesToken: '',
16
+ externalAccountUuid: ''
16
17
  });
17
18
 
18
19
  var _default = function _default() {
@@ -29,6 +30,9 @@ var _default = function _default() {
29
30
  case _quizCommon.SET_OUTCOMES_TOKEN:
30
31
  return state.set('outcomesToken', action.payload);
31
32
 
33
+ case _quizCommon.SET_EXTERNAL_ACCOUNT_UUID:
34
+ return state.set('externalAccountUuid', action.payload);
35
+
32
36
  default:
33
37
  return state;
34
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "20.11.3-rc.22+e192ae436",
3
+ "version": "20.11.3-rc.24+b00b50ab5",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -43,12 +43,12 @@
43
43
  "dependencies": {
44
44
  "@instructure/emotion": "^8.51.0",
45
45
  "@instructure/grading-utils": "^1.0.0",
46
- "@instructure/outcomes-ui": "^3.2.0",
47
- "@instructure/quiz-common": "20.11.3-rc.22+e192ae436",
48
- "@instructure/quiz-i18n": "20.11.3-rc.22+e192ae436",
49
- "@instructure/quiz-interactions": "20.11.3-rc.22+e192ae436",
50
- "@instructure/quiz-number-input": "20.11.3-rc.22+e192ae436",
51
- "@instructure/quiz-rce": "20.11.3-rc.22+e192ae436",
46
+ "@instructure/outcomes-ui": "^3.2.1",
47
+ "@instructure/quiz-common": "20.11.3-rc.24+b00b50ab5",
48
+ "@instructure/quiz-i18n": "20.11.3-rc.24+b00b50ab5",
49
+ "@instructure/quiz-interactions": "20.11.3-rc.24+b00b50ab5",
50
+ "@instructure/quiz-number-input": "20.11.3-rc.24+b00b50ab5",
51
+ "@instructure/quiz-rce": "20.11.3-rc.24+b00b50ab5",
52
52
  "@instructure/ui-a11y-content": "^8.51.0",
53
53
  "@instructure/ui-alerts": "^8.51.0",
54
54
  "@instructure/ui-avatar": "^8.51.0",
@@ -112,7 +112,7 @@
112
112
  "file-saver": "~2.0.5",
113
113
  "humps": "^2.0.0",
114
114
  "immutable": "^3.8.1",
115
- "instructure-validations": "20.11.3-rc.22+e192ae436",
115
+ "instructure-validations": "20.11.3-rc.24+b00b50ab5",
116
116
  "ipaddr.js": "^1.5.4",
117
117
  "isomorphic-fetch": "^2.2.0",
118
118
  "isuuid": "^0.1.0",
@@ -163,7 +163,7 @@
163
163
  "intl": "^1.2.4",
164
164
  "jquery": "^2.2.3",
165
165
  "most-subject": "^5.3.0",
166
- "quiz-presets": "20.11.3-rc.22+e192ae436",
166
+ "quiz-presets": "20.11.3-rc.24+b00b50ab5",
167
167
  "react": "^16.8.6",
168
168
  "react-addons-test-utils": "^15.6.2",
169
169
  "react-dom": "^16.8.6",
@@ -179,5 +179,5 @@
179
179
  "publishConfig": {
180
180
  "access": "public"
181
181
  },
182
- "gitHead": "e192ae436fbe1242d1b979e7a04360ff794ac567"
182
+ "gitHead": "b00b50ab5632eba679487d4936bc8fd4d2e6a8de"
183
183
  }