@instructure/quiz-core 17.60.1-rc.0 → 17.60.1-rc.10

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 (45) hide show
  1. package/es/banks/api/banks.js +18 -0
  2. package/es/banks/components/Banks/presenter.js +9 -8
  3. package/es/banks/components/BanksList/index.js +8 -3
  4. package/es/banks/components/BanksList/presenter.js +103 -32
  5. package/es/building/components/layout/header/BuildingButtons/index.js +2 -1
  6. package/es/building/components/layout/header/BuildingButtons/presenter.js +2 -1
  7. package/es/common/actions/alerts.js +1 -3
  8. package/es/common/actions/analyses.js +31 -0
  9. package/es/common/components/SDKApp/index.js +9 -2
  10. package/es/common/reducers/analyses.js +38 -0
  11. package/es/common/selectors/analyses.js +20 -0
  12. package/es/configureStore.js +3 -1
  13. package/es/reporting/api/getAnalysesStatus.js +33 -0
  14. package/es/reporting/api/getItemAnalyses.js +33 -0
  15. package/es/reporting/api/getQuizAnalysis.js +33 -0
  16. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisUpdateDate/index.js +53 -0
  17. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +2 -23
  18. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js +72 -20
  19. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/theme.js +12 -0
  20. package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -12
  21. package/es/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +23 -0
  22. package/es/reporting/components/resources/ReportCard/index.js +1 -1
  23. package/lib/banks/api/banks.js +24 -2
  24. package/lib/banks/components/Banks/presenter.js +9 -8
  25. package/lib/banks/components/BanksList/index.js +9 -2
  26. package/lib/banks/components/BanksList/presenter.js +103 -31
  27. package/lib/building/components/layout/header/BuildingButtons/index.js +1 -0
  28. package/lib/building/components/layout/header/BuildingButtons/presenter.js +2 -1
  29. package/lib/common/actions/alerts.js +1 -0
  30. package/lib/common/actions/analyses.js +47 -0
  31. package/lib/common/components/SDKApp/index.js +10 -2
  32. package/lib/common/reducers/analyses.js +56 -0
  33. package/lib/common/selectors/analyses.js +41 -0
  34. package/lib/configureStore.js +4 -1
  35. package/lib/reporting/api/getAnalysesStatus.js +48 -0
  36. package/lib/reporting/api/getItemAnalyses.js +48 -0
  37. package/lib/reporting/api/getQuizAnalysis.js +48 -0
  38. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisUpdateDate/index.js +74 -0
  39. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +3 -24
  40. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js +77 -20
  41. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/theme.js +19 -0
  42. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -13
  43. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +35 -0
  44. package/lib/reporting/components/resources/ReportCard/index.js +1 -1
  45. package/package.json +9 -9
@@ -12,6 +12,7 @@ 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
14
  import { noop } from 'lodash';
15
+ import { NIL } from 'uuid';
15
16
  var banksApiEndpoint = '/api/banks';
16
17
  var DEFAULT_PAGE_SIZE = 100;
17
18
 
@@ -340,4 +341,21 @@ export var updateSharedBankPermission = function updateSharedBankPermission(bank
340
341
  }
341
342
  });
342
343
  };
344
+ };
345
+ export var createBankCloneJob = function createBankCloneJob(bankId) {
346
+ var userId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : NIL;
347
+ var url = "".concat(banksApiEndpoint, "/").concat(bankId, "/bank_clone_jobs");
348
+ return function (dispatch, getState) {
349
+ var field_overrides = JSON.stringify({
350
+ field_overrides: {
351
+ creator: userId
352
+ }
353
+ });
354
+ var fetcher = new Fetcher({
355
+ onError: handleError(dispatch, t('Failed to create bank clone job.'))
356
+ });
357
+ return fetcher.post(url, {
358
+ body: field_overrides
359
+ });
360
+ };
343
361
  };
@@ -174,7 +174,8 @@ export var Banks = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cla
174
174
  minChars: _this.props.minChars,
175
175
  navigateToBank: _this.props.navigateToBank,
176
176
  onShare: _this.props.onShare,
177
- recordIds: recordIds
177
+ recordIds: recordIds,
178
+ redirectAllBanks: _this.handleBankCreated
178
179
  });
179
180
  };
180
181
 
@@ -386,6 +387,7 @@ export var Banks = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cla
386
387
  }),
387
388
  // from consumer
388
389
  clear: PropTypes.func,
390
+ filtersEnabled: PropTypes.bool,
389
391
  getBanks: PropTypes.func.isRequired,
390
392
  getCourseInfo: PropTypes.func,
391
393
  // from consumer
@@ -397,29 +399,28 @@ export var Banks = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cla
397
399
  // from consumer,
398
400
  getCourseAssignments: PropTypes.func,
399
401
  // from consumer
400
- minChars: PropTypes.number,
401
402
  isCompact: PropTypes.bool,
403
+ merge: PropTypes.func.isRequired,
404
+ minChars: PropTypes.number,
402
405
  navigateToBank: PropTypes.func.isRequired,
403
406
  // can be from consumer
404
407
  navigateToBuild: PropTypes.func,
405
408
  // from consumer
409
+ newItemBankFilterNamesEnabled: PropTypes.bool,
406
410
  onShare: PropTypes.func,
407
411
  // from consumer
408
412
  openModal: PropTypes.func.isRequired,
413
+ returnToUrl: PropTypes.string,
414
+ // from consumer
409
415
  scope: PropTypes.shape({
410
416
  type: PropTypes.string,
411
417
  uuid: PropTypes.string,
412
418
  title: PropTypes.string
413
419
  }).isRequired,
414
- returnToUrl: PropTypes.string,
415
- // from consumer
416
- filtersEnabled: PropTypes.bool,
417
- merge: PropTypes.func.isRequired,
418
420
  scopeType: PropTypes.string,
421
+ searchTerms: PropTypes.string,
419
422
  sortBy: PropTypes.string,
420
423
  sortOrder: PropTypes.string,
421
- searchTerms: PropTypes.string,
422
- newItemBankFilterNamesEnabled: PropTypes.bool,
423
424
  usedByCourseEnabled: PropTypes.bool
424
425
  }, _class2.defaultProps = {
425
426
  closeTray: null,
@@ -3,17 +3,22 @@ import { connect } from "../../../common/react-redux.js";
3
3
  import BanksList from "./presenter.js";
4
4
  import Bank from "../../../common/records/Bank.js";
5
5
  import { openModal, withConfirm } from "../../../common/actions/modal.js";
6
- import { deleteBank } from "../../api/banks.js";
6
+ import { deleteBank, createBankCloneJob } from "../../api/banks.js";
7
+ import { featureOn } from "../../../common/util/featureCheck.js";
8
+ import { addInfo } from "../../../common/actions/alerts.js";
7
9
  export function mapStateToProps(state, props) {
8
10
  return {
9
11
  appContainer: state.getIn(['ui', 'appContainer']),
10
12
  banks: List(props.recordIds).map(function (id) {
11
13
  return Bank.create(state.getIn(['banks', id]));
12
- })
14
+ }),
15
+ duplicateItemBanks: featureOn('duplicate_item_banks')
13
16
  };
14
17
  }
15
18
  export default connect(mapStateToProps, {
16
19
  openModal: openModal,
17
20
  deleteBank: deleteBank,
18
- withConfirm: withConfirm
21
+ withConfirm: withConfirm,
22
+ createBankCloneJob: createBankCloneJob,
23
+ addInfo: addInfo
19
24
  })(BanksList);
@@ -18,8 +18,9 @@ import { Link } from '@instructure/ui-link';
18
18
  import { Heading } from '@instructure/ui-heading';
19
19
  import { PresentationContent, ScreenReaderContent } from '@instructure/ui-a11y-content';
20
20
  import { Button } from '@instructure/ui-buttons';
21
- import { IconEditLine, IconTrashLine, IconShareSolid } from '@instructure/ui-icons';
21
+ import { IconEditLine, IconTrashLine, IconShareSolid, IconCopyLine } from '@instructure/ui-icons';
22
22
  import { Alert } from '@instructure/ui-alerts';
23
+ import { Spinner } from '@instructure/ui-spinner';
23
24
  import { themeable } from '@instructure/ui-themeable';
24
25
  import { EDIT_BANK_MODAL, withI18nSupport } from '@instructure/quiz-common';
25
26
  import CustomPropTypes from "../../../common/util/CustomPropTypes.js";
@@ -42,6 +43,12 @@ var styles = {
42
43
  'deletePreface': 'dgJJi_eTBd'
43
44
  };
44
45
  import theme from "./theme.js";
46
+
47
+ var _ref3 = /*#__PURE__*/React.createElement(Spinner, {
48
+ renderTitle: "Loading",
49
+ size: "x-small"
50
+ });
51
+
45
52
  export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_withI18nSupport) {
46
53
  _inherits(BanksList, _withI18nSupport);
47
54
 
@@ -135,6 +142,29 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
135
142
  }));
136
143
  };
137
144
 
145
+ _this.openDuplicateBankModal = function (bank) {
146
+ return function () {
147
+ _this.createCloneJob = function () {
148
+ _this.props.createBankCloneJob(bank.id, _this.props.currentUser.uuid);
149
+
150
+ _this.props.addInfo( /*#__PURE__*/React.createElement(React.Fragment, null, t('Creating "{name} Copy". Duplicate will appear in ', {
151
+ name: bank.title
152
+ }), /*#__PURE__*/React.createElement(Link, {
153
+ key: bank.id,
154
+ onClick: _this.props.redirectAllBanks
155
+ }, t('\'All Banks\'')), t(' filter.')));
156
+ };
157
+
158
+ _this.props.withConfirm(partial(_this.createCloneJob), {
159
+ text: t('Are you sure you want to duplicate this item bank?'),
160
+ title: t('Duplicate Bank'),
161
+ continueText: t('Duplicate'),
162
+ continueVariant: null,
163
+ size: 'small'
164
+ });
165
+ };
166
+ };
167
+
138
168
  _this.updateSharedCount = function (count) {
139
169
  _this.setState({
140
170
  sharingCount: count
@@ -184,24 +214,41 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
184
214
  };
185
215
  };
186
216
 
187
- return /*#__PURE__*/React.createElement("div", {
188
- className: styles.bankInfo,
189
- "data-automation": "sdk-bank-info",
190
- tabIndex: "-1"
191
- }, /*#__PURE__*/React.createElement("div", {
192
- className: styles.bankTitle
193
- }, /*#__PURE__*/React.createElement(Link, {
194
- onClick: navigateToBank(bank.id),
195
- theme: {
196
- color: _this.theme.bankTitleLinkColor,
197
- hoverColor: _this.theme.bankTitleLinkHoverColor
198
- },
199
- "data-automation": "sdk-banks-list-bank-title-link"
200
- }, /*#__PURE__*/React.createElement(Heading, {
201
- as: "h2",
202
- level: "reset",
203
- "data-automation": "sdk-banks-list-bank-title-heading"
204
- }, bank.title))), _this.renderDetails(bank));
217
+ if (bank.status == 'copying') {
218
+ return /*#__PURE__*/React.createElement("div", {
219
+ className: styles.bankInfo,
220
+ "data-automation": "sdk-bank-info",
221
+ tabIndex: "-1"
222
+ }, /*#__PURE__*/React.createElement("div", {
223
+ className: styles.bankTitle
224
+ }, /*#__PURE__*/React.createElement(Heading, {
225
+ as: "h2",
226
+ level: "reset",
227
+ "data-automation": "sdk-banks-list-bank-title-heading"
228
+ }, bank.title)), /*#__PURE__*/React.createElement("div", {
229
+ className: styles.bankDetails,
230
+ "data-automation": "sdk-banks-list-bank-details"
231
+ }, t('Currently duplicating')));
232
+ } else {
233
+ return /*#__PURE__*/React.createElement("div", {
234
+ className: styles.bankInfo,
235
+ "data-automation": "sdk-bank-info",
236
+ tabIndex: "-1"
237
+ }, /*#__PURE__*/React.createElement("div", {
238
+ className: styles.bankTitle
239
+ }, /*#__PURE__*/React.createElement(Link, {
240
+ onClick: navigateToBank(bank.id),
241
+ theme: {
242
+ color: _this.theme.bankTitleLinkColor,
243
+ hoverColor: _this.theme.bankTitleLinkHoverColor
244
+ },
245
+ "data-automation": "sdk-banks-list-bank-title-link"
246
+ }, /*#__PURE__*/React.createElement(Heading, {
247
+ as: "h2",
248
+ level: "reset",
249
+ "data-automation": "sdk-banks-list-bank-title-heading"
250
+ }, bank.title))), _this.renderDetails(bank));
251
+ }
205
252
  };
206
253
 
207
254
  _this.renderBankOptions = function (bank) {
@@ -230,23 +277,42 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
230
277
  }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Delete bank {name}', {
231
278
  name: bank.title
232
279
  }))));
233
- return /*#__PURE__*/React.createElement("div", {
234
- className: styles.bankOptions
235
- }, /*#__PURE__*/React.createElement(IfFeature, {
236
- name: "item_bank_sharing"
237
- }, /*#__PURE__*/React.createElement(Button, {
238
- onClick: _this.openSharingModal(bank),
239
- name: "Share",
280
+ var duplicateBankOption = /*#__PURE__*/React.createElement(Button, {
281
+ onClick: _this.openDuplicateBankModal(bank),
282
+ name: "Duplicate",
240
283
  size: "small",
241
284
  variant: "icon",
242
- "data-automation": "sdk-shared-bank-share-link",
243
- icon: IconShareSolid,
244
- title: t('Share bank {name}', {
285
+ icon: IconCopyLine,
286
+ title: t('Duplicate bank {name}', {
245
287
  name: bank.title
246
288
  })
247
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Share bank {name}', {
289
+ }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Duplicate bank {name}', {
248
290
  name: bank.title
249
- })))), bank.canEdit() ? bankEditOptions : null);
291
+ })));
292
+
293
+ if (bank.status == 'copying') {
294
+ return /*#__PURE__*/React.createElement("div", {
295
+ className: styles.bankOptions
296
+ }, _ref3);
297
+ } else {
298
+ return /*#__PURE__*/React.createElement("div", {
299
+ className: styles.bankOptions
300
+ }, _this.props.duplicateItemBanks ? duplicateBankOption : null, /*#__PURE__*/React.createElement(IfFeature, {
301
+ name: "item_bank_sharing"
302
+ }, /*#__PURE__*/React.createElement(Button, {
303
+ onClick: _this.openSharingModal(bank),
304
+ name: "Share",
305
+ size: "small",
306
+ variant: "icon",
307
+ "data-automation": "sdk-shared-bank-share-link",
308
+ icon: IconShareSolid,
309
+ title: t('Share bank {name}', {
310
+ name: bank.title
311
+ })
312
+ }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Share bank {name}', {
313
+ name: bank.title
314
+ })))), bank.canEdit() ? bankEditOptions : null);
315
+ }
250
316
  };
251
317
 
252
318
  _this.renderBank = function (bank) {
@@ -325,8 +391,10 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
325
391
  BanksList.displayName = "BanksList";
326
392
  return BanksList;
327
393
  }(withI18nSupport(Component)), _class2.propTypes = {
394
+ addInfo: PropTypes.func.isRequired,
328
395
  appContainer: CustomPropTypes.selectors.isRequired,
329
396
  banks: ImmutablePropTypes.list.isRequired,
397
+ createBankCloneJob: PropTypes.func.isRequired,
330
398
  currentUser: PropTypes.shape({
331
399
  bank_admin: PropTypes.bool,
332
400
  email: PropTypes.string,
@@ -337,6 +405,7 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
337
405
  }),
338
406
  focusCreateBankButton: PropTypes.func.isRequired,
339
407
  deleteBank: PropTypes.func.isRequired,
408
+ duplicateItemBanks: PropTypes.bool,
340
409
  getCourseInfo: PropTypes.func,
341
410
  getUserInfo: PropTypes.func,
342
411
  getShareableCourses: PropTypes.func,
@@ -345,6 +414,7 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
345
414
  navigateToBank: PropTypes.func.isRequired,
346
415
  onShare: PropTypes.func,
347
416
  openModal: PropTypes.func.isRequired,
417
+ redirectAllBanks: PropTypes.func.isRequired,
348
418
  withConfirm: PropTypes.func.isRequired,
349
419
  locale: PropTypes.string,
350
420
  timezone: PropTypes.string
@@ -357,7 +427,8 @@ export var BanksList = (_dec = themeable(theme, styles), _dec(_class = (_temp =
357
427
  minChars: void 0,
358
428
  locale: null,
359
429
  timezone: null,
360
- onShare: function onShare() {}
430
+ onShare: function onShare() {},
431
+ duplicateItemBanks: false
361
432
  }, _class2.contextTypes = {
362
433
  locale: PropTypes.string,
363
434
  timezone: PropTypes.string
@@ -9,7 +9,7 @@ import { BuildingButtons as BuildingButtonsPresenter } from "./presenter.js";
9
9
  import { getActiveQuiz } from "../../../../../common/selectors/quizzes.js";
10
10
  import { featureOn } from "../../../../../common/util/featureCheck.js";
11
11
  import { startQuizExportJob } from "../../../../../common/actions/quizExport.js";
12
- import { addInfo } from "../../../../../common/actions/alerts.js";
12
+ import { addAlert, addInfo } from "../../../../../common/actions/alerts.js";
13
13
  export function mapStateToProps(state) {
14
14
  var quiz = getActiveQuiz(state);
15
15
  return {
@@ -26,6 +26,7 @@ export function mapStateToProps(state) {
26
26
 
27
27
  var mapDispatchToProps = function mapDispatchToProps(dispatch) {
28
28
  return {
29
+ addAlert: bindActionCreators(addAlert, dispatch),
29
30
  addInfo: bindActionCreators(addInfo, dispatch),
30
31
  openBanksTray: bindActionCreators(setUI.bind(void 0, BUILD_TRAY_OPEN, true), dispatch),
31
32
  setBanksTrayButtonRef: bindActionCreators(partial(setUI, BUILD_TRAY_BUTTON_REF), dispatch),
@@ -71,7 +71,7 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
71
71
  _this.props.contentExport({
72
72
  contextUuid: contextUuid,
73
73
  exportSettings: exportSettings
74
- });
74
+ }, _this.props.addAlert);
75
75
 
76
76
  _this.props.startExport(activeQuizId);
77
77
  }
@@ -202,6 +202,7 @@ export var BuildingButtons = (_dec = themeable(theme, styles), _dec(_class = (_t
202
202
  return BuildingButtons;
203
203
  }(Component), _class2.propTypes = {
204
204
  app: PropTypes.string,
205
+ addAlert: PropTypes.func.isRequired,
205
206
  addInfo: PropTypes.func,
206
207
  activeQuizId: PropTypes.string,
207
208
  canExport: PropTypes.bool.isRequired,
@@ -1,7 +1,6 @@
1
1
  import { v4 as uuid } from 'uuid';
2
2
  import { ADD_ALERT, REMOVE_ALERT, DEFAULT_ALERT_TIME } from '@instructure/quiz-common';
3
-
4
- function addAlert(_ref) {
3
+ export function addAlert(_ref) {
5
4
  var message = _ref.message,
6
5
  variant = _ref.variant,
7
6
  _ref$removeIn = _ref.removeIn,
@@ -18,7 +17,6 @@ function addAlert(_ref) {
18
17
  }
19
18
  };
20
19
  }
21
-
22
20
  export function addError(message, removeIn, guid) {
23
21
  return addAlert({
24
22
  message: message,
@@ -0,0 +1,31 @@
1
+ import { SET_QUIZ_ANALYSIS, SET_ITEM_ANALYSES, SET_ANALYSIS_FETCH_IN_PROGRESS, SET_ANALYSIS_GENERATION_IN_PROGRESS, SET_ANALYSIS_ERROR } from '@instructure/quiz-common';
2
+ export function setQuizAnalysis(quizAnalysis) {
3
+ return {
4
+ type: SET_QUIZ_ANALYSIS,
5
+ payload: quizAnalysis
6
+ };
7
+ }
8
+ export function setItemAnalyses(itemAnalyses) {
9
+ return {
10
+ type: SET_ITEM_ANALYSES,
11
+ payload: itemAnalyses
12
+ };
13
+ }
14
+ export function setFetchInProgress(inProgress) {
15
+ return {
16
+ type: SET_ANALYSIS_FETCH_IN_PROGRESS,
17
+ payload: inProgress
18
+ };
19
+ }
20
+ export function setGenerationInProgress(inProgress) {
21
+ return {
22
+ type: SET_ANALYSIS_GENERATION_IN_PROGRESS,
23
+ payload: inProgress
24
+ };
25
+ }
26
+ export function setAnalysisError(error) {
27
+ return {
28
+ type: SET_ANALYSIS_ERROR,
29
+ payload: error
30
+ };
31
+ }
@@ -18,6 +18,7 @@ import { Provider } from "../../react-redux.js";
18
18
  import store from "../../../reduxStore.js";
19
19
  import { getLocale } from '@instructure/quiz-common';
20
20
  import { set } from "../../actions/ui.js";
21
+ import { addAlert } from "../../actions/alerts.js";
21
22
  import { setAPIEndpoint, setCanvasOrigin, setUserToken } from "../../actions/config.js";
22
23
  import { setContextUuid, setOutcomesEndpoint, setOutcomesToken } from "../../actions/outcomes.js";
23
24
  import { addFeatures, removeFeatures } from "../../actions/features.js";
@@ -53,6 +54,10 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
53
54
  // so we dont implicitly share state
54
55
  // this.store = this.configureStore()
55
56
 
57
+ _this.addAlert = function (opts) {
58
+ _this.store.dispatch(addAlert(opts));
59
+ };
60
+
56
61
  _this.store = store;
57
62
 
58
63
  _this.setLocale();
@@ -154,7 +159,9 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
154
159
  }, /*#__PURE__*/React.createElement("div", {
155
160
  className: styles.sdk,
156
161
  "data-automation": "sdk-app"
157
- }, _ref, props.children)))));
162
+ }, _ref, typeof props.children === 'function' ? props.children({
163
+ addAlert: this.addAlert
164
+ }) : props.children)))));
158
165
  }
159
166
  }]);
160
167
 
@@ -163,7 +170,7 @@ export var SDKApp = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
163
170
  }(Component), _class2.propTypes = {
164
171
  apiEndpoint: PropTypes.string.isRequired,
165
172
  appContainer: CustomPropTypes.selectors.isRequired,
166
- children: PropTypes.node.isRequired,
173
+ children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
167
174
  contextUuid: PropTypes.string,
168
175
  gradeByQuestionEnabled: PropTypes.bool,
169
176
  itemBankSharingEnabled: PropTypes.bool,
@@ -0,0 +1,38 @@
1
+ import { fromJS } from 'immutable';
2
+ import { SET_QUIZ_ANALYSIS, SET_ITEM_ANALYSES, SET_ANALYSIS_FETCH_IN_PROGRESS, SET_ANALYSIS_GENERATION_IN_PROGRESS, SET_ANALYSIS_ERROR } from '@instructure/quiz-common';
3
+ export var quizAnalysisKey = 'quizAnalysis';
4
+ export var itemAnalysesKey = 'itemAnalyses';
5
+ export var fetchInProgressKey = 'fetchInProgress';
6
+ export var generationInProgressKey = 'generationInProgress';
7
+ export var errorKey = 'analysisError';
8
+ export var defaultState = fromJS({
9
+ quizAnalysisKey: void 0,
10
+ itemAnalysesKey: void 0,
11
+ fetchStateKey: false,
12
+ generationStateKey: false,
13
+ errorKey: void 0
14
+ });
15
+ export default (function () {
16
+ var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultState;
17
+ var action = arguments.length > 1 ? arguments[1] : void 0;
18
+
19
+ switch (action.type) {
20
+ case SET_QUIZ_ANALYSIS:
21
+ return state.set(quizAnalysisKey, fromJS(action.payload));
22
+
23
+ case SET_ITEM_ANALYSES:
24
+ return state.set(itemAnalysesKey, fromJS(action.payload));
25
+
26
+ case SET_ANALYSIS_FETCH_IN_PROGRESS:
27
+ return state.set(fetchInProgressKey, action.payload);
28
+
29
+ case SET_ANALYSIS_GENERATION_IN_PROGRESS:
30
+ return state.set(generationInProgressKey, action.payload);
31
+
32
+ case SET_ANALYSIS_ERROR:
33
+ return state.set(errorKey, action.payload);
34
+
35
+ default:
36
+ return state;
37
+ }
38
+ });
@@ -0,0 +1,20 @@
1
+ var path = 'analyses';
2
+ export var getQuizAnalysis = function getQuizAnalysis(state) {
3
+ var _state$getIn;
4
+
5
+ return (_state$getIn = state.getIn([path, 'quizAnalysis'])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.toJS();
6
+ };
7
+ export var getItemAnalyses = function getItemAnalyses(state) {
8
+ var _state$getIn2;
9
+
10
+ return (_state$getIn2 = state.getIn([path, 'itemAnalyses'])) === null || _state$getIn2 === void 0 ? void 0 : _state$getIn2.toJS();
11
+ };
12
+ export var getFetchInProgress = function getFetchInProgress(state) {
13
+ return state.getIn([path, 'fetchInProgress'], false);
14
+ };
15
+ export var getGenerationInProgress = function getGenerationInProgress(state) {
16
+ return state.getIn([path, 'generationInProgress'], false);
17
+ };
18
+ export var getAnalysisError = function getAnalysisError(state) {
19
+ return state.getIn([path, 'analysisError']);
20
+ };
@@ -47,6 +47,7 @@ import upload from "./common/reducers/upload.js";
47
47
  import qtiImports from "./common/reducers/qtiImports.js";
48
48
  import printing from "./common/reducers/printing.js";
49
49
  import rce from "./common/reducers/rce.js";
50
+ import analyses from "./common/reducers/analyses.js";
50
51
  import dragAndDrop from "./common/reducers/dragAndDrop.js";
51
52
  import sharedBanks from "./common/reducers/sharedBanks.js";
52
53
  export function configureStore(_ref) {
@@ -116,7 +117,8 @@ export function configureStore(_ref) {
116
117
  taking: taking,
117
118
  ui: ui,
118
119
  upload: upload,
119
- rce: rce
120
+ rce: rce,
121
+ analyses: analyses
120
122
  });
121
123
  return createStoreWithMiddlewareApplied(rootReducer, initialState);
122
124
  }
@@ -0,0 +1,33 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import Fetcher from "../../common/util/Fetcher.js";
4
+ var fetcher = new Fetcher();
5
+ export var getAnalysesStatus = /*#__PURE__*/function () {
6
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(quizId) {
7
+ var filter,
8
+ url,
9
+ _args = arguments;
10
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
11
+ while (1) {
12
+ switch (_context.prev = _context.next) {
13
+ case 0:
14
+ filter = _args.length > 1 && _args[1] !== void 0 ? _args[1] : 'last_attempt';
15
+ url = "/api/quizzes/".concat(quizId, "/analyses/status?filter=").concat(filter);
16
+ _context.next = 4;
17
+ return fetcher.get(url);
18
+
19
+ case 4:
20
+ return _context.abrupt("return", _context.sent);
21
+
22
+ case 5:
23
+ case "end":
24
+ return _context.stop();
25
+ }
26
+ }
27
+ }, _callee);
28
+ }));
29
+
30
+ return function getAnalysesStatus(_x) {
31
+ return _ref.apply(this, arguments);
32
+ };
33
+ }();
@@ -0,0 +1,33 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import Fetcher from "../../common/util/Fetcher.js";
4
+ var fetcher = new Fetcher();
5
+ export var getItemAnalyses = /*#__PURE__*/function () {
6
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(quizId) {
7
+ var filter,
8
+ url,
9
+ _args = arguments;
10
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
11
+ while (1) {
12
+ switch (_context.prev = _context.next) {
13
+ case 0:
14
+ filter = _args.length > 1 && _args[1] !== void 0 ? _args[1] : 'last_attempt';
15
+ url = "/api/quizzes/".concat(quizId, "/analyses/item_analyses?filter=").concat(filter);
16
+ _context.next = 4;
17
+ return fetcher.get(url);
18
+
19
+ case 4:
20
+ return _context.abrupt("return", _context.sent);
21
+
22
+ case 5:
23
+ case "end":
24
+ return _context.stop();
25
+ }
26
+ }
27
+ }, _callee);
28
+ }));
29
+
30
+ return function getItemAnalyses(_x) {
31
+ return _ref.apply(this, arguments);
32
+ };
33
+ }();
@@ -0,0 +1,33 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import Fetcher from "../../common/util/Fetcher.js";
4
+ var fetcher = new Fetcher();
5
+ export var getQuizAnalysis = /*#__PURE__*/function () {
6
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(quizId) {
7
+ var filter,
8
+ url,
9
+ _args = arguments;
10
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
11
+ while (1) {
12
+ switch (_context.prev = _context.next) {
13
+ case 0:
14
+ filter = _args.length > 1 && _args[1] !== void 0 ? _args[1] : 'last_attempt';
15
+ url = "/api/quizzes/".concat(quizId, "/analyses/quiz_analysis?filter=").concat(filter);
16
+ _context.next = 4;
17
+ return fetcher.get(url);
18
+
19
+ case 4:
20
+ return _context.abrupt("return", _context.sent);
21
+
22
+ case 5:
23
+ case "end":
24
+ return _context.stop();
25
+ }
26
+ }
27
+ }, _callee);
28
+ }));
29
+
30
+ return function getQuizAnalysis(_x) {
31
+ return _ref.apply(this, arguments);
32
+ };
33
+ }();