@instructure/quiz-core 17.58.2-rc.6 → 17.58.2-rc.8

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.
Files changed (35) hide show
  1. package/es/banks/api/banks.js +35 -1
  2. package/es/banks/components/Bank/index.js +16 -7
  3. package/es/banks/components/Bank/presenter.js +198 -18
  4. package/es/building/components/resources/BanksTray/presenter.js +2 -1
  5. package/es/common/actions/sharedBanks.js +2 -2
  6. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +2 -0
  7. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +64 -0
  8. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +3 -0
  9. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +2 -0
  10. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +75 -0
  11. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +6 -0
  12. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -0
  13. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +18 -0
  14. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +245 -0
  15. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +9 -0
  16. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +55 -57
  17. package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +5 -16
  18. package/lib/banks/api/banks.js +40 -2
  19. package/lib/banks/components/Bank/index.js +15 -2
  20. package/lib/banks/components/Bank/presenter.js +203 -17
  21. package/lib/building/components/resources/BanksTray/presenter.js +2 -1
  22. package/lib/common/actions/sharedBanks.js +2 -2
  23. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +11 -0
  24. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +83 -0
  25. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +10 -0
  26. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +11 -0
  27. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +95 -0
  28. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +13 -0
  29. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +11 -0
  30. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +27 -0
  31. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +274 -0
  32. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +16 -0
  33. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +59 -62
  34. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +7 -18
  35. package/package.json +9 -9
@@ -11,6 +11,7 @@ import { clear, newActiveBankEntry, newActiveBank } from "../../common/actions/u
11
11
  import t from '@instructure/quiz-i18n/es/format-message';
12
12
  import { handleError } from "../../common/api/helpers.js";
13
13
  import { BANKS_BANK_PAGINATION, BANKS_BANK_ENTRY_PAGINATION, DELETE_BANK_CALL, UPDATE_BANK_CALL, CAN_EDIT, READ_ONLY, REMOVED_ACCESS, SHARED_WITH_USER, SHARED_WITH_COURSE } from '@instructure/quiz-common';
14
+ import { noop } from 'lodash';
14
15
  var banksApiEndpoint = '/api/banks';
15
16
  var DEFAULT_PAGE_SIZE = 100;
16
17
 
@@ -169,7 +170,8 @@ export var deleteBank = function deleteBank(bankId) {
169
170
  });
170
171
  };
171
172
  };
172
- export var shareBank = function shareBank(_shareBank, getUserInfo) {
173
+ export var shareBank = function shareBank(_shareBank) {
174
+ var getUserInfo = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
173
175
  var url = "".concat(banksApiEndpoint, "/").concat(_shareBank.bankId, "/shared_banks");
174
176
  return function (dispatch, getState) {
175
177
  var shareBankData = JSON.stringify({
@@ -213,6 +215,38 @@ export var shareBank = function shareBank(_shareBank, getUserInfo) {
213
215
  });
214
216
  };
215
217
  };
218
+ export var getSharedBank = function getSharedBank(bankId, entityType, entityId) {
219
+ var url = "".concat(banksApiEndpoint, "/").concat(bankId, "/shared_banks");
220
+ var params = {
221
+ entity_type: entityType,
222
+ entity_id: entityId
223
+ };
224
+ return function (dispatch, getState) {
225
+ var fetcher = new Fetcher({
226
+ onError: handleError(dispatch, t('Failed to fetch shared bank.'))
227
+ });
228
+ return fetcher.get(url, params).then(function (sharedBankInfo) {
229
+ // if the API returns no data, we manually add placeholder to the response
230
+ if (sharedBankInfo.length === 0) {
231
+ var placeholder = {
232
+ id: "notshared_".concat(bankId, "_").concat(entityId),
233
+ entityType: entityType,
234
+ entityId: entityId,
235
+ permission: REMOVED_ACCESS,
236
+ bankId: bankId
237
+ };
238
+ sharedBankInfo.push(placeholder);
239
+ }
240
+
241
+ dispatch(handleShareBanksResponse(sharedBankInfo));
242
+ }).catch(function (err) {
243
+ if (err.response.status === 401) {
244
+ dispatch(clear(BANKS_BANK_PAGINATION));
245
+ throw err;
246
+ }
247
+ });
248
+ };
249
+ };
216
250
  export var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
217
251
  var url = "".concat(banksApiEndpoint, "/").concat(bank.id, "/shared_banks");
218
252
  var userSharedBanks = [];
@@ -3,18 +3,21 @@ import { Bank as BankPresenter } from "./presenter.js";
3
3
  import { connect } from "../../../common/react-redux.js";
4
4
  import BankRecord from "../../../common/records/Bank.js";
5
5
  import { getActiveQuiz } from "../../../common/selectors/quizzes.js";
6
- import { getBank } from "../../../banks/api/banks.js";
6
+ import { getBank, getSharedBank, shareBank, updateSharedBankPermission } from "../../../banks/api/banks.js";
7
7
  import { getBankEntries } from "../../../banks/api/bankEntries.js";
8
8
  import { createQuizEntry } from "../../../building/api/quizEntries.js";
9
- import { openModal } from "../../../common/actions/modal.js";
9
+ import { openModal, withConfirm } from "../../../common/actions/modal.js";
10
10
  import { BUILD_TRAY_POSITION, BUILD_TRAY_STIMULUS_ID } from '@instructure/quiz-common';
11
11
  import { screenreaderNotification } from "../../../common/actions/alerts.js";
12
12
  import { reset as resetSearch } from "../../../common/actions/bankSearch.js";
13
+ import { removeSharedBank } from "../../../common/actions/sharedBanks.js";
13
14
  import { featureOn } from "../../../common/util/featureCheck.js";
14
-
15
- function mapStateToProps(state, props) {
15
+ export function mapStateToProps(state, props) {
16
16
  var bank = new BankRecord(state.getIn(['banks', props.bankId]));
17
17
  var search = state.get('bankSearch', immutable.Map());
18
+ var courseSharedBank = state.get('sharedBanks', immutable.Map()).find(function (sharedBank) {
19
+ return sharedBank.get('bankId') === props.bankId && sharedBank.get('entityType') === props.scope.type && sharedBank.get('entityId') === props.scope.uuid;
20
+ });
18
21
  var activeQuiz = getActiveQuiz(state);
19
22
  var lockBlueprintContentEnabled = featureOn('lock_blueprint_content');
20
23
  var isQuizContentLocked = activeQuiz && activeQuiz.originalQuizLockedByBlueprint && lockBlueprintContentEnabled;
@@ -22,20 +25,26 @@ function mapStateToProps(state, props) {
22
25
  bank: bank,
23
26
  isQuizContentLocked: isQuizContentLocked,
24
27
  search: search,
28
+ courseSharedBank: courseSharedBank,
25
29
  useBankSearch: featureOn('item_bank_search'),
26
30
  position: state.getIn(['ui', BUILD_TRAY_POSITION]),
27
31
  stimulusId: state.getIn(['ui', BUILD_TRAY_STIMULUS_ID]),
28
- activeQuizId: state.getIn(['quizzes', 'activeQuizId'])
32
+ activeQuizId: state.getIn(['quizzes', 'activeQuizId']),
33
+ showShareBankFromTray: featureOn('share_bank_from_tray')
29
34
  };
30
35
  }
31
-
32
36
  var mapDispatchToProps = {
33
37
  addEntryToQuiz: createQuizEntry,
34
38
  getBank: getBank,
35
39
  getBankEntries: getBankEntries,
40
+ getSharedBank: getSharedBank,
36
41
  openModal: openModal,
42
+ removeSharedBank: removeSharedBank,
37
43
  resetSearch: resetSearch,
38
- screenreaderNotification: screenreaderNotification
44
+ screenreaderNotification: screenreaderNotification,
45
+ shareBank: shareBank,
46
+ updateSharedBankPermission: updateSharedBankPermission,
47
+ withConfirm: withConfirm
39
48
  };
40
49
  export var Bank = connect(mapStateToProps, mapDispatchToProps)(BankPresenter);
41
50
  export default Bank;
@@ -1,3 +1,6 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
1
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
6
  import _inherits from "@babel/runtime/helpers/esm/inherits";
@@ -10,12 +13,15 @@ import * as immutable from 'immutable';
10
13
  import debounce from 'lodash/debounce';
11
14
  import PropTypes from 'prop-types';
12
15
  import ImmutablePropTypes from 'react-immutable-proptypes';
16
+ import partial from 'lodash/partial';
13
17
  import { IconPlusLine } from '@instructure/ui-icons';
14
18
  import { BreadcrumbLink } from '@instructure/ui-breadcrumb';
15
19
  import { Button } from '@instructure/ui-buttons';
16
20
  import { Heading } from '@instructure/ui-heading';
17
21
  import { AccessibleContent } from '@instructure/ui-a11y-content';
18
22
  import { themeable } from '@instructure/ui-themeable';
23
+ import { Checkbox } from '@instructure/ui-checkbox';
24
+ import { View } from '@instructure/ui-view';
19
25
  import BankRecord from "../../../common/records/Bank.js";
20
26
  import Page from "../../../common/components/layout/Page/index.js";
21
27
  import PaginatedCollection from "../../../common/components/shared/PaginatedCollection/index.js";
@@ -27,7 +33,7 @@ import BankEntriesList from "../../../banks/components/BankEntriesList/index.js"
27
33
  import BankSearch from "../../../banks/components/BankSearch/index.js";
28
34
  import HeaderMenu from "../../../banks/components/HeaderMenu/index.js";
29
35
  import NavWrapper from "../NavWrapper/index.js";
30
- import { ADD_BANK_ENTRY_MODAL, BANKS_BANK_ENTRY_PAGINATION } from '@instructure/quiz-common';
36
+ import { ADD_BANK_ENTRY_MODAL, BANKS_BANK_ENTRY_PAGINATION, CAN_EDIT, REMOVED_ACCESS, READ_ONLY } from '@instructure/quiz-common';
31
37
  var styles = {
32
38
  componentId: 'fWUWr',
33
39
  template: function template(theme) {
@@ -56,6 +62,10 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
56
62
  }
57
63
 
58
64
  _this = _super.call.apply(_super, [this].concat(_args));
65
+ _this.state = {
66
+ sharedWithCourse: false,
67
+ shareWithCourseCheckboxDisabled: true
68
+ };
59
69
 
60
70
  _this.openAddBankEntryModal = function () {
61
71
  _this.props.openModal(ADD_BANK_ENTRY_MODAL, {
@@ -75,6 +85,74 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
75
85
  _this.createBankEntryButton = c;
76
86
  };
77
87
 
88
+ _this.toggleCheckbox = function () {
89
+ // disable until request resolves
90
+ _this.setState({
91
+ shareWithCourseCheckboxDisabled: true
92
+ });
93
+
94
+ _this.changeSharedPermissions();
95
+ };
96
+
97
+ _this.unshareBankWithCourse = /*#__PURE__*/function () {
98
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(sharedBank) {
99
+ var _this$props, updateSharedBankPermission, bankId, getSharedBank, scope;
100
+
101
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
102
+ while (1) {
103
+ switch (_context.prev = _context.next) {
104
+ case 0:
105
+ _this$props = _this.props, updateSharedBankPermission = _this$props.updateSharedBankPermission, bankId = _this$props.bankId, getSharedBank = _this$props.getSharedBank, scope = _this$props.scope;
106
+ _context.next = 3;
107
+ return updateSharedBankPermission(bankId, sharedBank.get('id'), REMOVED_ACCESS);
108
+
109
+ case 3:
110
+ getSharedBank(bankId, scope.type, scope.uuid).catch(function (err) {
111
+ // make sure the user still has access to the bank
112
+ if (err.response.status === 401) {
113
+ _this.props.navigateToBanks();
114
+ }
115
+ });
116
+
117
+ case 4:
118
+ case "end":
119
+ return _context.stop();
120
+ }
121
+ }
122
+ }, _callee);
123
+ }));
124
+
125
+ return function (_x) {
126
+ return _ref.apply(this, arguments);
127
+ };
128
+ }();
129
+
130
+ _this.translatedPermissionLevel = function (permission) {
131
+ var _CAN_EDIT$READ_ONLY$p;
132
+
133
+ return (_CAN_EDIT$READ_ONLY$p = {}, _defineProperty(_CAN_EDIT$READ_ONLY$p, CAN_EDIT, t('edit')), _defineProperty(_CAN_EDIT$READ_ONLY$p, READ_ONLY, t('view')), _CAN_EDIT$READ_ONLY$p)[permission];
134
+ };
135
+
136
+ _this.confirmUnshareBankWithCourse = function () {
137
+ var confirmText = t('You are about to remove { accessLevel } access for { entityTitle } to this bank.', {
138
+ accessLevel: _this.translatedPermissionLevel(_this.props.courseSharedBank.get('permission')),
139
+ entityTitle: _this.props.scope.title
140
+ });
141
+
142
+ _this.props.withConfirm(partial(_this.unshareBankWithCourse, _this.props.courseSharedBank), {
143
+ title: t('Unshare Bank with Course'),
144
+ text: confirmText,
145
+ continueText: t('Confirm'),
146
+ onCancel: _this.onCancelUnshareBankWithCourse
147
+ });
148
+ };
149
+
150
+ _this.onCancelUnshareBankWithCourse = function () {
151
+ _this.setState({
152
+ shareWithCourseCheckboxDisabled: false
153
+ });
154
+ };
155
+
78
156
  _this.addBankToQuiz = function () {
79
157
  var newEntry = QuizEntry.create({
80
158
  entryId: _this.props.bankId,
@@ -100,8 +178,8 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
100
178
  }, _this.renderNewBankEntryButton());
101
179
  };
102
180
 
103
- _this.announceResults = function (_ref) {
104
- var totalPages = _ref.totalPages;
181
+ _this.announceResults = function (_ref2) {
182
+ var totalPages = _ref2.totalPages;
105
183
  var message = t("{\n count, plural,\n =0 {No search results found}\n one {Displaying one page of results}\n other {Displaying # pages of results}\n }", {
106
184
  count: totalPages
107
185
  }); // Audibly announce when search results are ready.
@@ -115,10 +193,10 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
115
193
  _this.debouncedAnnounceResults = debounce(_this.announceResults, 1000);
116
194
 
117
195
  _this.getPage = function (page, search) {
118
- var _this$props = _this.props,
119
- getBankEntries = _this$props.getBankEntries,
120
- bankId = _this$props.bankId,
121
- useBankSearch = _this$props.useBankSearch;
196
+ var _this$props2 = _this.props,
197
+ getBankEntries = _this$props2.getBankEntries,
198
+ bankId = _this$props2.bankId,
199
+ useBankSearch = _this$props2.useBankSearch;
122
200
  var text = search.get('text');
123
201
  var interactionTypes = search.get('interactionTypes', immutable.Set()).toJS();
124
202
  var tagIds = search.get('tags', []).map(function (tag) {
@@ -173,19 +251,68 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
173
251
 
174
252
  if (this.props.onError) {
175
253
  this.props.getBank(this.props.bankId).catch(this.props.onError);
254
+
255
+ if (this.shouldRenderShareWithCourseCheckbox()) {
256
+ this.props.getSharedBank(this.props.bankId, this.props.scope.type, this.props.scope.uuid).catch(this.props.onError);
257
+ }
176
258
  } else {
177
259
  this.props.getBank(this.props.bankId);
260
+
261
+ if (this.shouldRenderShareWithCourseCheckbox()) {
262
+ this.props.getSharedBank(this.props.bankId, this.props.scope.type, this.props.scope.uuid);
263
+ }
264
+ } // when courseSharedBank is already loaded
265
+
266
+
267
+ if (this.props.courseSharedBank) {
268
+ this.setShareWithCourseCheckbox();
178
269
  }
179
270
  }
271
+ }, {
272
+ key: "componentDidUpdate",
273
+ value: function componentDidUpdate(prevProps) {
274
+ var _prevProps$courseShar, _this$props$courseSha;
275
+
276
+ var permissionChanged = ((_prevProps$courseShar = prevProps.courseSharedBank) === null || _prevProps$courseShar === void 0 ? void 0 : _prevProps$courseShar.get('permission')) !== ((_this$props$courseSha = this.props.courseSharedBank) === null || _this$props$courseSha === void 0 ? void 0 : _this$props$courseSha.get('permission'));
277
+
278
+ if (this.props.courseSharedBank && permissionChanged) {
279
+ this.setShareWithCourseCheckbox();
280
+ }
281
+ }
282
+ }, {
283
+ key: "setShareWithCourseCheckbox",
284
+ value: function setShareWithCourseCheckbox() {
285
+ if (this.props.courseSharedBank.get('permission') === REMOVED_ACCESS) {
286
+ this.setState({
287
+ sharedWithCourse: false,
288
+ shareWithCourseCheckboxDisabled: false
289
+ });
290
+ } else {
291
+ this.setState({
292
+ sharedWithCourse: true,
293
+ shareWithCourseCheckboxDisabled: false
294
+ });
295
+ }
296
+ }
297
+ }, {
298
+ key: "componentWillUnmount",
299
+ value: function componentWillUnmount() {
300
+ this.props.removeSharedBank(this.placeholderCourseSharedBankKey());
301
+ }
302
+ }, {
303
+ key: "placeholderCourseSharedBankKey",
304
+ value: function placeholderCourseSharedBankKey() {
305
+ return "notshared_".concat(this.props.bankId, "_").concat(this.props.scope.uuid);
306
+ }
180
307
  }, {
181
308
  key: "renderNav",
182
309
  value: function renderNav() {
183
- var _this$props2 = this.props,
184
- scope = _this$props2.scope,
185
- closeTray = _this$props2.closeTray,
186
- navigateToBanks = _this$props2.navigateToBanks,
187
- navigateToBuild = _this$props2.navigateToBuild,
188
- returnToUrl = _this$props2.returnToUrl;
310
+ var _this$props3 = this.props,
311
+ scope = _this$props3.scope,
312
+ closeTray = _this$props3.closeTray,
313
+ navigateToBanks = _this$props3.navigateToBanks,
314
+ navigateToBuild = _this$props3.navigateToBuild,
315
+ returnToUrl = _this$props3.returnToUrl;
189
316
  var isScopeEmpty = !Object.keys(scope).length;
190
317
  return /*#__PURE__*/React.createElement(NavWrapper, {
191
318
  closeTray: closeTray,
@@ -217,6 +344,50 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
217
344
  });
218
345
  }
219
346
  }
347
+ }, {
348
+ key: "changeSharedPermissions",
349
+ value: function changeSharedPermissions() {
350
+ if (this.props.bank.canEdit()) {
351
+ if (!this.state.sharedWithCourse) {
352
+ var shareBank = {
353
+ entityId: this.props.scope.uuid,
354
+ entityType: this.props.scope.type,
355
+ title: this.props.scope.title,
356
+ permission: READ_ONLY,
357
+ bankId: this.props.bankId
358
+ };
359
+ this.props.removeSharedBank(this.placeholderCourseSharedBankKey());
360
+ this.props.shareBank(shareBank);
361
+ } else {
362
+ this.confirmUnshareBankWithCourse();
363
+ }
364
+ }
365
+ }
366
+ }, {
367
+ key: "shouldRenderShareWithCourseCheckbox",
368
+ value: function shouldRenderShareWithCourseCheckbox() {
369
+ return this.props.showShareBankFromTray && this.props.scope.type === 'course' && this.props.scope.title && this.props.scope.uuid;
370
+ }
371
+ }, {
372
+ key: "renderCheckbox",
373
+ value: function renderCheckbox() {
374
+ if (!this.shouldRenderShareWithCourseCheckbox()) {
375
+ return null;
376
+ }
377
+
378
+ var label = t('Share with { courseName }', {
379
+ courseName: this.props.scope.title
380
+ });
381
+ return /*#__PURE__*/React.createElement(View, {
382
+ margin: "small 0",
383
+ as: "div"
384
+ }, /*#__PURE__*/React.createElement(Checkbox, {
385
+ checked: this.state.sharedWithCourse,
386
+ label: label,
387
+ onChange: this.toggleCheckbox,
388
+ disabled: this.props.bank.canEdit() ? this.state.shareWithCourseCheckboxDisabled : true
389
+ }));
390
+ }
220
391
  }, {
221
392
  key: "renderModals",
222
393
  value: function renderModals() {
@@ -292,7 +463,7 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
292
463
  value: function render() {
293
464
  return /*#__PURE__*/React.createElement(Page, null, this.renderModals(), this.renderNav(), /*#__PURE__*/React.createElement("div", {
294
465
  className: styles.content
295
- }, this.renderName(), /*#__PURE__*/React.createElement("div", {
466
+ }, this.renderName(), this.renderCheckbox(), /*#__PURE__*/React.createElement("div", {
296
467
  className: styles.topMenu
297
468
  }, this.renderTopLeftMenu(), this.renderTopRightMenu()), this.renderSearch(), /*#__PURE__*/React.createElement(PaginatedCollection, {
298
469
  empty: this.emptyLoadText(),
@@ -315,6 +486,7 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
315
486
  closeTray: PropTypes.func,
316
487
  getBank: PropTypes.func.isRequired,
317
488
  getBankEntries: PropTypes.func.isRequired,
489
+ getSharedBank: PropTypes.func.isRequired,
318
490
  isCompact: PropTypes.bool,
319
491
  isQuizContentLocked: PropTypes.bool.isRequired,
320
492
  navigateToBanks: PropTypes.func.isRequired,
@@ -323,20 +495,26 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
323
495
  // can be from consumer
324
496
  navigateToBuild: PropTypes.func,
325
497
  // from consumer
326
- scope: PropTypes.objectOf(PropTypes.shape({
498
+ scope: PropTypes.shape({
327
499
  type: PropTypes.string,
328
500
  uuid: PropTypes.string,
329
501
  title: PropTypes.string
330
- })),
502
+ }),
503
+ courseSharedBank: ImmutablePropTypes.map,
331
504
  returnToUrl: PropTypes.string,
332
505
  // from consumer
333
506
  onError: PropTypes.func,
334
507
  openModal: PropTypes.func.isRequired,
335
508
  position: PropTypes.number,
509
+ removeSharedBank: PropTypes.func.isRequired,
336
510
  resetSearch: PropTypes.func.isRequired,
337
511
  screenreaderNotification: PropTypes.func.isRequired,
338
512
  search: ImmutablePropTypes.map.isRequired,
339
- stimulusId: PropTypes.string
513
+ shareBank: PropTypes.func.isRequired,
514
+ stimulusId: PropTypes.string,
515
+ showShareBankFromTray: PropTypes.bool,
516
+ updateSharedBankPermission: PropTypes.func.isRequired,
517
+ withConfirm: PropTypes.func.isRequired
340
518
  }, _class2.defaultProps = {
341
519
  activeQuizId: null,
342
520
  addEntryToQuiz: null,
@@ -350,6 +528,8 @@ export var Bank = (_dec = themeable(theme, styles), _dec(_class = (_temp = _clas
350
528
  stimulusId: null,
351
529
  scope: {},
352
530
  returnToUrl: null,
353
- isQuizContentLocked: false
531
+ isQuizContentLocked: false,
532
+ showShareBankFromTray: false,
533
+ courseSharedBank: null
354
534
  }, _temp)) || _class);
355
535
  export default Bank;
@@ -95,7 +95,8 @@ export var BanksTray = /*#__PURE__*/function (_Component) {
95
95
  closeTray: this.closeTray,
96
96
  bankId: activeBankId,
97
97
  navigateToBanks: this.clearActiveBank,
98
- navigateToBankEntry: this.props.newActiveBankEntry
98
+ navigateToBankEntry: this.props.newActiveBankEntry,
99
+ scope: this.props.itemBanksScope
99
100
  });
100
101
  }
101
102
  } else {
@@ -14,9 +14,9 @@ export var updateSharedBankPermission = function updateSharedBankPermission(shar
14
14
  }
15
15
  };
16
16
  };
17
- export var removeSharedBank = function removeSharedBank(bankId) {
17
+ export var removeSharedBank = function removeSharedBank(sharedBankId) {
18
18
  return {
19
19
  type: REMOVE_SHARED_BANK,
20
- payload: bankId
20
+ payload: sharedBankId
21
21
  };
22
22
  };
@@ -0,0 +1,2 @@
1
+ import { AnalysisMetric } from "./presenter.js";
2
+ export default AnalysisMetric;
@@ -0,0 +1,64 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+
6
+ var _dec, _class, _class2, _temp;
7
+
8
+ import { themeable } from '@instructure/ui-themeable';
9
+ import theme from "./theme.js";
10
+ var styles = {
11
+ componentId: 'flBnP',
12
+ template: function template(theme) {
13
+ return "\n\n.flBnP_eckF{margin:0;max-width:159px;text-transform:uppercase}";
14
+ },
15
+ 'metricLabel': 'flBnP_eckF'
16
+ };
17
+ import React, { Component } from 'react';
18
+ import { getSanitizedMetricValue } from "../utils.js";
19
+ import { Metric } from '@instructure/ui-metric';
20
+ import PropTypes from 'prop-types';
21
+ export var AnalysisMetric = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
22
+ _inherits(AnalysisMetric, _Component);
23
+
24
+ var _super = _createSuper(AnalysisMetric);
25
+
26
+ function AnalysisMetric() {
27
+ _classCallCheck(this, AnalysisMetric);
28
+
29
+ return _super.apply(this, arguments);
30
+ }
31
+
32
+ _createClass(AnalysisMetric, [{
33
+ key: "render",
34
+ value: function render() {
35
+ var _this$props = this.props,
36
+ metricKey = _this$props.metricKey,
37
+ label = _this$props.label,
38
+ value = _this$props.value,
39
+ suffix = _this$props.suffix;
40
+ return /*#__PURE__*/React.createElement(Metric, {
41
+ theme: {
42
+ valueFontWeight: 500,
43
+ padding: '0'
44
+ },
45
+ textAlign: "start",
46
+ key: metricKey,
47
+ renderLabel: /*#__PURE__*/React.createElement("p", {
48
+ className: styles.metricLabel
49
+ }, label),
50
+ renderValue: getSanitizedMetricValue(value, suffix)
51
+ });
52
+ }
53
+ }]);
54
+
55
+ AnalysisMetric.displayName = "AnalysisMetric";
56
+ return AnalysisMetric;
57
+ }(Component), _class2.propTypes = {
58
+ metricKey: PropTypes.string.isRequired,
59
+ label: PropTypes.string.isRequired,
60
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
61
+ suffix: PropTypes.string
62
+ }, _class2.defaultProps = {
63
+ suffix: ''
64
+ }, _temp)) || _class);
@@ -0,0 +1,3 @@
1
+ export default function generator() {
2
+ return {};
3
+ }
@@ -0,0 +1,2 @@
1
+ import { AnalysisPopoverMetric } from "./presenter.js";
2
+ export default AnalysisPopoverMetric;
@@ -0,0 +1,75 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+
6
+ var _dec, _class, _class2, _temp;
7
+
8
+ import React, { Component } from 'react';
9
+ import { Metric } from '@instructure/ui-metric';
10
+ import { getSanitizedMetricValue } from "../utils.js";
11
+ var styles = {
12
+ componentId: 'bLVhr',
13
+ template: function template(theme) {
14
+ return "\n\n.bLVhr_dqHR{padding-left:5px}\n\n.bLVhr_eckF{margin:0;max-width:159px;text-transform:uppercase}";
15
+ },
16
+ 'popoverContainer': 'bLVhr_dqHR',
17
+ 'metricLabel': 'bLVhr_eckF'
18
+ };
19
+ import MetricPopover from "../MetricPopover/index.js";
20
+ import { themeable } from '@instructure/ui-themeable';
21
+ import theme from "./theme.js";
22
+ import PropTypes from 'prop-types';
23
+ export var AnalysisPopoverMetric = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
24
+ _inherits(AnalysisPopoverMetric, _Component);
25
+
26
+ var _super = _createSuper(AnalysisPopoverMetric);
27
+
28
+ function AnalysisPopoverMetric() {
29
+ _classCallCheck(this, AnalysisPopoverMetric);
30
+
31
+ return _super.apply(this, arguments);
32
+ }
33
+
34
+ _createClass(AnalysisPopoverMetric, [{
35
+ key: "renderLabelWithPopover",
36
+ value: function renderLabelWithPopover(texts) {
37
+ return /*#__PURE__*/React.createElement("p", {
38
+ className: styles.metricLabel
39
+ }, this.props.label, /*#__PURE__*/React.createElement("span", {
40
+ className: styles.popoverContainer
41
+ }, /*#__PURE__*/React.createElement(MetricPopover, texts)));
42
+ }
43
+ }, {
44
+ key: "render",
45
+ value: function render() {
46
+ var _this$props = this.props,
47
+ metricKey = _this$props.metricKey,
48
+ popoverDescription = _this$props.popoverDescription,
49
+ value = _this$props.value;
50
+ return /*#__PURE__*/React.createElement(Metric, {
51
+ theme: {
52
+ valueFontWeight: 500,
53
+ padding: '0'
54
+ },
55
+ textAlign: "start",
56
+ key: metricKey,
57
+ renderLabel: this.renderLabelWithPopover(popoverDescription),
58
+ renderValue: getSanitizedMetricValue(value)
59
+ });
60
+ }
61
+ }]);
62
+
63
+ AnalysisPopoverMetric.displayName = "AnalysisPopoverMetric";
64
+ return AnalysisPopoverMetric;
65
+ }(Component), _class2.propTypes = {
66
+ metricKey: PropTypes.string.isRequired,
67
+ label: PropTypes.string.isRequired,
68
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
69
+ popoverDescription: PropTypes.shape({
70
+ title: PropTypes.string,
71
+ subtitle: PropTypes.string,
72
+ body: PropTypes.string,
73
+ screenReaderLabel: PropTypes.string
74
+ }).isRequired
75
+ }, _temp)) || _class);
@@ -0,0 +1,6 @@
1
+ export default function generator(_ref) {
2
+ var spacing = _ref.spacing;
3
+ return {
4
+ headerPaddingBottom: spacing.medium
5
+ };
6
+ }
@@ -0,0 +1,2 @@
1
+ import { NewItemAnalysis } from "./presenter.js";
2
+ export default NewItemAnalysis;
@@ -0,0 +1,18 @@
1
+ export var difficultyIndex = {
2
+ title: 'Difficulty title',
3
+ subtitle: 'difficulty subtitle',
4
+ body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elementum interdum risus sed condimentum. Duis vel nisi at quam luctus dictum id eu risus. Donec eget tristique justo',
5
+ screenReaderLabel: 'Lorem one'
6
+ };
7
+ export var discriminationIndex = {
8
+ title: 'Discrimination title',
9
+ subtitle: 'discrimination subtitle',
10
+ body: 'Lorem ipsum dolor sit amet',
11
+ screenReaderLabel: 'Lorem two'
12
+ };
13
+ export var pearsonCorrelation = {
14
+ title: 'Pearson correlation title',
15
+ subtitle: 'pearson correlation subtitle',
16
+ body: 'Lorem ipsum dolor sit amet',
17
+ screenReaderLabel: 'Lorem three'
18
+ };