@instructure/quiz-core 22.10.2 → 22.11.1

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 (43) hide show
  1. package/es/banks/api/banks.js +18 -97
  2. package/es/banks/components/SharingModal/index.js +6 -3
  3. package/es/banks/components/SharingModal/presenter.js +207 -131
  4. package/es/building/api/items.js +120 -24
  5. package/es/building/api/quizEntries.js +78 -15
  6. package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +11 -2
  7. package/es/common/actions/sharedBanks.js +13 -1
  8. package/es/common/actions/sharingModal.js +7 -0
  9. package/es/common/components/resources/quiz/AddContent/Body/index.js +1 -1
  10. package/es/common/components/resources/quiz/AddContent/Body/presenter.js +129 -141
  11. package/es/common/components/resources/quiz/AddContent/Modal/presenter.js +59 -72
  12. package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +126 -119
  13. package/es/common/components/shared/InteractionTypes/index.js +1 -4
  14. package/es/common/components/shared/InteractionTypes/presenter.js +1 -3
  15. package/es/common/middleware/sharedBanksMiddleware.js +243 -0
  16. package/es/common/records/Item.js +2 -1
  17. package/es/common/records/QuizEntry.js +7 -0
  18. package/es/common/reducers/sharingModal.js +17 -0
  19. package/es/common/util/useRemoteComponent.js +127 -0
  20. package/es/configureStore.js +4 -1
  21. package/es/index.js +3 -2
  22. package/lib/banks/api/banks.js +17 -96
  23. package/lib/banks/components/SharingModal/index.js +5 -2
  24. package/lib/banks/components/SharingModal/presenter.js +205 -129
  25. package/lib/building/api/items.js +120 -23
  26. package/lib/building/api/quizEntries.js +78 -14
  27. package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +10 -1
  28. package/lib/common/actions/sharedBanks.js +13 -1
  29. package/lib/common/actions/sharingModal.js +13 -0
  30. package/lib/common/components/resources/quiz/AddContent/Body/index.js +1 -1
  31. package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +132 -141
  32. package/lib/common/components/resources/quiz/AddContent/Modal/presenter.js +59 -74
  33. package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +127 -119
  34. package/lib/common/components/shared/InteractionTypes/index.js +1 -4
  35. package/lib/common/components/shared/InteractionTypes/presenter.js +1 -3
  36. package/lib/common/middleware/sharedBanksMiddleware.js +250 -0
  37. package/lib/common/records/Item.js +2 -1
  38. package/lib/common/records/QuizEntry.js +7 -0
  39. package/lib/common/reducers/sharingModal.js +23 -0
  40. package/lib/common/util/useRemoteComponent.js +134 -0
  41. package/lib/configureStore.js +4 -1
  42. package/lib/index.js +22 -0
  43. package/package.json +8 -8
@@ -1,143 +1,137 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
4
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- var _dec, _class, _AddContentBody;
8
- function _callSuper(_this, derived, args) {
9
- function isNativeReflectConstruct() {
10
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
11
- if (Reflect.construct.sham) return false;
12
- if (typeof Proxy === "function") return true;
13
- try {
14
- return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
15
- } catch (e) {
16
- return false;
17
- }
18
- }
19
- derived = _getPrototypeOf(derived);
20
- return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
21
- }
22
1
  /** @jsx jsx */
23
- import { Component } from 'react';
24
- import PropTypes from 'prop-types';
25
- import ImmutablePropTypes from 'react-immutable-proptypes';
26
- import first from 'lodash/first';
27
- import { IconBankLine } from '@instructure/ui-icons';
28
- import { IconButton } from '@instructure/ui-buttons';
2
+ import { jsx } from '@instructure/emotion';
3
+ import { BUILD_TRAY_OPEN, BUILD_TRAY_POSITION, BUILD_TRAY_STIMULUS_ID, withStyleOverrides } from '@instructure/quiz-common';
4
+ import t from '@instructure/quiz-i18n/es/format-message';
5
+ import { Button, IconButton } from '@instructure/ui-buttons';
29
6
  import { Grid } from '@instructure/ui-grid';
30
- import { View } from '@instructure/ui-view';
7
+ import { IconAiSolid, IconBankLine } from '@instructure/ui-icons';
31
8
  import { Text } from '@instructure/ui-text';
32
- import { jsx } from '@instructure/emotion';
9
+ import { View } from '@instructure/ui-view';
10
+ import first from 'lodash/first';
11
+ import PropTypes from 'prop-types';
12
+ import React, { useCallback } from 'react';
13
+ import ImmutablePropTypes from 'react-immutable-proptypes';
33
14
  import InteractionTypes from '../../../../shared/InteractionTypes';
34
- import t from '@instructure/quiz-i18n/es/format-message';
35
- import { BUILD_TRAY_OPEN, BUILD_TRAY_POSITION, BUILD_TRAY_STIMULUS_ID, withStyleOverrides } from '@instructure/quiz-common';
36
15
  import generateStyle from './styles';
37
16
  import generateComponentTheme from './theme';
38
- export var AddContentBody = (_dec = withStyleOverrides(generateStyle, generateComponentTheme), _dec(_class = (_AddContentBody = /*#__PURE__*/function (_Component) {
39
- function AddContentBody() {
40
- var _this2;
41
- _classCallCheck(this, AddContentBody);
42
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
- args[_key] = arguments[_key];
17
+ function UnstyledAddContentBody(_ref) {
18
+ var allowStimulusCreation = _ref.allowStimulusCreation,
19
+ createItem = _ref.createItem,
20
+ createStimulus = _ref.createStimulus,
21
+ editingQuizEntry = _ref.editingQuizEntry,
22
+ interactionTypes = _ref.interactionTypes,
23
+ _ref$onOpenBankTray = _ref.onOpenBankTray,
24
+ onOpenBankTray = _ref$onOpenBankTray === void 0 ? function () {} : _ref$onOpenBankTray,
25
+ _ref$onAddItem = _ref.onAddItem,
26
+ onAddItem = _ref$onAddItem === void 0 ? function () {} : _ref$onAddItem,
27
+ parentEntryId = _ref.parentEntryId,
28
+ position = _ref.position,
29
+ quizEntryWithErrorsShowing = _ref.quizEntryWithErrorsShowing,
30
+ quizId = _ref.quizId,
31
+ screenreaderNotification = _ref.screenreaderNotification,
32
+ setNextQuizEntry = _ref.setNextQuizEntry,
33
+ setUi = _ref.setUi,
34
+ _ref$showHeaderText = _ref.showHeaderText,
35
+ showHeaderText = _ref$showHeaderText === void 0 ? true : _ref$showHeaderText,
36
+ stimulusId = _ref.stimulusId,
37
+ styles = _ref.styles,
38
+ _ref$slotProps = _ref.slotProps,
39
+ slotProps = _ref$slotProps === void 0 ? {} : _ref$slotProps;
40
+ var openBankTray = useCallback(function () {
41
+ onOpenBankTray();
42
+ setUi(BUILD_TRAY_OPEN, true);
43
+ setUi(BUILD_TRAY_POSITION, position);
44
+ setUi(BUILD_TRAY_STIMULUS_ID, parentEntryId);
45
+ }, [onOpenBankTray, setUi, position, parentEntryId]);
46
+ var addStimulus = useCallback(function (isPassage) {
47
+ if (editingQuizEntry) {
48
+ setNextQuizEntry(null, quizId, position);
49
+ } else {
50
+ createStimulus(quizId, position, isPassage);
44
51
  }
45
- _this2 = _callSuper(this, AddContentBody, [].concat(args));
46
- // ==============================
47
- // ACTIONS
48
- // ==============================
49
- _defineProperty(_this2, "openBankTray", function () {
50
- _this2.props.onOpenBankTray();
51
- _this2.props.setUi(BUILD_TRAY_OPEN, true);
52
- _this2.props.setUi(BUILD_TRAY_POSITION, _this2.props.position);
53
- _this2.props.setUi(BUILD_TRAY_STIMULUS_ID, _this2.props.parentEntryId);
54
- });
55
- _defineProperty(_this2, "addStimulus", function (isPassage) {
56
- if (_this2.props.editingQuizEntry) {
57
- _this2.props.setNextQuizEntry(null, _this2.props.quizId, _this2.props.position);
58
- } else {
59
- _this2.props.createStimulus(_this2.props.quizId, _this2.props.position, isPassage);
60
- }
61
- _this2.props.onAddItem();
62
- });
63
- _defineProperty(_this2, "addItem", function (interactionTypeData) {
64
- if (_this2.props.quizEntryWithErrorsShowing) {
65
- _this2.props.screenreaderNotification(t('Question {itemPosition, number} cannot be saved due to invalid input data', {
66
- itemPosition: Math.ceil(_this2.props.quizEntryWithErrorsShowing.position)
67
- }));
52
+ onAddItem();
53
+ }, [editingQuizEntry, setNextQuizEntry, quizId, position, createStimulus, onAddItem]);
54
+ var addItem = useCallback(function (interactionTypeData) {
55
+ if (quizEntryWithErrorsShowing) {
56
+ screenreaderNotification(t('Question {itemPosition, number} cannot be saved due to invalid input data', {
57
+ itemPosition: Math.ceil(quizEntryWithErrorsShowing.position)
58
+ }));
59
+ } else {
60
+ if (editingQuizEntry) {
61
+ setNextQuizEntry(interactionTypeData, quizId, position, stimulusId, parentEntryId);
68
62
  } else {
69
- var _this2$props = _this2.props,
70
- quizId = _this2$props.quizId,
71
- position = _this2$props.position,
72
- stimulusId = _this2$props.stimulusId,
73
- parentEntryId = _this2$props.parentEntryId;
74
- if (_this2.props.editingQuizEntry) {
75
- _this2.props.setNextQuizEntry(interactionTypeData, quizId, position, stimulusId, parentEntryId);
76
- } else {
77
- var defaultInteractionData = interactionTypeData.getDefaultInteractionData();
78
- var scoringData = interactionTypeData.getDefaultScoringData(defaultInteractionData);
79
- _this2.props.createItem(quizId, position, {
80
- id: interactionTypeData.id,
81
- interactionData: defaultInteractionData,
82
- itemBody: interactionTypeData.itemBody,
83
- properties: interactionTypeData.defaultProperties,
84
- scoringAlgorithm: interactionTypeData.scoringAlgorithmDefault,
85
- scoringData: scoringData,
86
- userResponseType: first(interactionTypeData.userResponseTypeOptions)
87
- }, parentEntryId, stimulusId);
88
- }
63
+ var defaultInteractionData = interactionTypeData.getDefaultInteractionData();
64
+ var scoringData = interactionTypeData.getDefaultScoringData(defaultInteractionData);
65
+ createItem(quizId, position, {
66
+ id: interactionTypeData.id,
67
+ interactionData: defaultInteractionData,
68
+ itemBody: interactionTypeData.itemBody,
69
+ properties: interactionTypeData.defaultProperties,
70
+ scoringAlgorithm: interactionTypeData.scoringAlgorithmDefault,
71
+ scoringData: scoringData,
72
+ userResponseType: first(interactionTypeData.userResponseTypeOptions)
73
+ }, parentEntryId, stimulusId);
89
74
  }
90
- _this2.props.onAddItem();
91
- });
92
- // ==============================
93
- // RENDERING
94
- // ==============================
95
- _defineProperty(_this2, "renderBankButton", function () {
96
- return jsx(IconButton, {
97
- size: "large",
98
- onClick: _this2.openBankTray,
99
- "data-automation": "sdk-add-banked-content-button",
100
- screenReaderLabel: t('Add banked content')
101
- }, jsx(IconBankLine, null));
102
- });
103
- _defineProperty(_this2, "renderPopoverHeader", function () {
104
- var text = _this2.props.showHeaderText ? t('Insert Content') : '';
105
- return jsx("div", {
106
- css: _this2.props.styles.popoverHeaderBox
107
- }, jsx("div", {
108
- css: _this2.props.styles.popoverHeader
109
- }, jsx(Grid, {
110
- vAlign: "middle",
111
- colSpacing: "none",
112
- rowSpacing: "none"
113
- }, jsx(Grid.Row, null, jsx(Grid.Col, null, jsx(Text, {
114
- color: "primary"
115
- }, text)), jsx(Grid.Col, {
116
- width: "auto"
117
- }, _this2.renderBankButton())))));
118
- });
119
- return _this2;
120
- }
121
- _inherits(AddContentBody, _Component);
122
- return _createClass(AddContentBody, [{
123
- key: "render",
124
- value: function render() {
125
- return jsx("div", {
126
- css: this.props.styles.popoverContent,
127
- role: "dialog",
128
- "aria-label": t('Insert Content')
129
- }, this.renderPopoverHeader(), jsx(View, {
130
- padding: "small"
131
- }, jsx(InteractionTypes, {
132
- columns: 2,
133
- addItem: this.addItem,
134
- addStimulus: this.addStimulus,
135
- allowStimulusCreation: this.props.allowStimulusCreation,
136
- types: this.props.interactionTypes
137
- })));
138
75
  }
139
- }]);
140
- }(Component), _defineProperty(_AddContentBody, "displayName", 'AddContentBody'), _defineProperty(_AddContentBody, "componentId", "Quizzes".concat(_AddContentBody.displayName)), _defineProperty(_AddContentBody, "propTypes", {
76
+ onAddItem();
77
+ }, [quizEntryWithErrorsShowing, screenreaderNotification, editingQuizEntry, setNextQuizEntry, quizId, position, stimulusId, parentEntryId, createItem, onAddItem]);
78
+ var renderBankButton = function renderBankButton() {
79
+ return jsx(IconButton, {
80
+ size: "large",
81
+ onClick: openBankTray,
82
+ "data-automation": "sdk-add-banked-content-button",
83
+ screenReaderLabel: t('Add banked content')
84
+ }, jsx(IconBankLine, null));
85
+ };
86
+ var renderPopoverHeader = function renderPopoverHeader() {
87
+ var _slotProps$quizGenera, _slotProps$quizGenera2, _slotProps$quizGenera3;
88
+ var text = showHeaderText ? t('Insert Content') : '';
89
+ return jsx("div", {
90
+ css: styles.popoverHeaderBox
91
+ }, jsx("div", {
92
+ css: styles.popoverHeader
93
+ }, jsx(Grid, {
94
+ vAlign: "middle",
95
+ colSpacing: "none",
96
+ rowSpacing: "none"
97
+ }, jsx(Grid.Row, null, jsx(Grid.Col, null, jsx(Text, {
98
+ color: "primary"
99
+ }, text)), jsx(Grid.Col, {
100
+ width: "auto"
101
+ }, renderBankButton())))), ((_slotProps$quizGenera = slotProps.quizGenerationButton) === null || _slotProps$quizGenera === void 0 ? void 0 : _slotProps$quizGenera.visible) && jsx(View, {
102
+ as: "div",
103
+ padding: "x-small 0 small"
104
+ }, jsx(Button, {
105
+ color: "ai-primary",
106
+ display: "block",
107
+ renderIcon: IconAiSolid,
108
+ onClick: (_slotProps$quizGenera2 = slotProps.quizGenerationButton) === null || _slotProps$quizGenera2 === void 0 ? void 0 : _slotProps$quizGenera2.onClick,
109
+ disabled: (_slotProps$quizGenera3 = slotProps.quizGenerationButton) === null || _slotProps$quizGenera3 === void 0 ? void 0 : _slotProps$quizGenera3.disabled
110
+ }, t('Generate with AI'))));
111
+ };
112
+ return jsx("div", {
113
+ css: styles.popoverContent,
114
+ role: "dialog",
115
+ "aria-label": t('Insert Content')
116
+ }, renderPopoverHeader(), jsx(View, {
117
+ padding: "small"
118
+ }, jsx(InteractionTypes, {
119
+ columns: 2,
120
+ addItem: addItem,
121
+ addStimulus: addStimulus,
122
+ allowStimulusCreation: allowStimulusCreation,
123
+ types: interactionTypes
124
+ })));
125
+ }
126
+ export var AddContentBody = withStyleOverrides(generateStyle, generateComponentTheme)(UnstyledAddContentBody);
127
+ export var quizGenerationButtonPropTypes = PropTypes.shape({
128
+ onClick: PropTypes.func.isRequired,
129
+ visible: PropTypes.bool,
130
+ disabled: PropTypes.bool
131
+ });
132
+ AddContentBody.displayName = 'AddContentBody';
133
+ AddContentBody.componentId = "Quizzes".concat(AddContentBody.displayName);
134
+ AddContentBody.propTypes = {
141
135
  allowStimulusCreation: PropTypes.bool.isRequired,
142
136
  createItem: PropTypes.func.isRequired,
143
137
  createStimulus: PropTypes.func.isRequired,
@@ -154,15 +148,9 @@ export var AddContentBody = (_dec = withStyleOverrides(generateStyle, generateCo
154
148
  setUi: PropTypes.func.isRequired,
155
149
  showHeaderText: PropTypes.bool,
156
150
  stimulusId: PropTypes.string,
157
- styles: PropTypes.object
158
- }), _defineProperty(_AddContentBody, "defaultProps", {
159
- editingQuizEntry: void 0,
160
- interactionTypes: void 0,
161
- onAddItem: Function.prototype,
162
- parentEntryId: void 0,
163
- onOpenBankTray: Function.prototype,
164
- quizEntryWithErrorsShowing: void 0,
165
- showHeaderText: true,
166
- stimulusId: void 0
167
- }), _AddContentBody)) || _class);
151
+ styles: PropTypes.object,
152
+ slotProps: PropTypes.shape({
153
+ quizGenerationButton: quizGenerationButtonPropTypes
154
+ })
155
+ };
168
156
  export default AddContentBody;
@@ -1,88 +1,75 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
4
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- function _callSuper(_this, derived, args) {
8
- function isNativeReflectConstruct() {
9
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
10
- if (Reflect.construct.sham) return false;
11
- if (typeof Proxy === "function") return true;
12
- try {
13
- return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
14
- } catch (e) {
15
- return false;
16
- }
17
- }
18
- derived = _getPrototypeOf(derived);
19
- return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
20
- }
21
- import React, { Component } from 'react';
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
+ import React from 'react';
22
5
  import PropTypes from 'prop-types';
23
6
  import { Button, CloseButton } from '@instructure/ui-buttons';
24
7
  import { Heading } from '@instructure/ui-heading';
25
8
  import { Modal, ModalHeader, ModalBody, ModalFooter } from '@instructure/quiz-common';
26
9
  import t from '@instructure/quiz-i18n/es/format-message';
27
10
  import AddContentBody from '../Body';
28
- export var AddContentModal = /*#__PURE__*/function (_Component) {
29
- function AddContentModal() {
30
- _classCallCheck(this, AddContentModal);
31
- return _callSuper(this, AddContentModal, arguments);
32
- }
33
- _inherits(AddContentModal, _Component);
34
- return _createClass(AddContentModal, [{
35
- key: "cancelButton",
36
- value: function cancelButton() {
37
- return /*#__PURE__*/React.createElement(Button, {
38
- onClick: this.props.closeModal
39
- }, t('Cancel'));
40
- }
41
- }, {
42
- key: "renderContent",
43
- value: function renderContent() {
44
- return /*#__PURE__*/React.createElement(AddContentBody, {
45
- allowStimulusCreation: this.props.allowStimulusCreation,
46
- onOpenBankTray: this.props.closeModal,
47
- onAddItem: this.props.closeModal,
48
- parentEntryId: this.props.parentEntryId,
49
- position: this.props.position,
50
- quizId: this.props.quizId,
51
- showHeaderText: false,
52
- stimulusId: this.props.stimulusId
53
- });
11
+ import { quizGenerationButtonPropTypes } from '../Body/presenter';
12
+ export function AddContentModal(_ref) {
13
+ var allowStimulusCreation = _ref.allowStimulusCreation,
14
+ closeModal = _ref.closeModal,
15
+ modalOpen = _ref.modalOpen,
16
+ _ref$parentEntryId = _ref.parentEntryId,
17
+ parentEntryId = _ref$parentEntryId === void 0 ? void 0 : _ref$parentEntryId,
18
+ position = _ref.position,
19
+ quizId = _ref.quizId,
20
+ _ref$stimulusId = _ref.stimulusId,
21
+ stimulusId = _ref$stimulusId === void 0 ? void 0 : _ref$stimulusId,
22
+ _ref$slotProps = _ref.slotProps,
23
+ slotProps = _ref$slotProps === void 0 ? {} : _ref$slotProps;
24
+ var handleGenerateWithAiClick = function handleGenerateWithAiClick() {
25
+ var _slotProps$quizGenera, _slotProps$quizGenera2;
26
+ slotProps === null || slotProps === void 0 || (_slotProps$quizGenera = slotProps.quizGenerationButton) === null || _slotProps$quizGenera === void 0 || (_slotProps$quizGenera2 = _slotProps$quizGenera.onClick) === null || _slotProps$quizGenera2 === void 0 || _slotProps$quizGenera2.call(_slotProps$quizGenera, position);
27
+ closeModal();
28
+ };
29
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Modal, {
30
+ open: modalOpen,
31
+ onDismiss: closeModal,
32
+ size: "large",
33
+ label: t('Add Content')
34
+ }, /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(Heading, {
35
+ level: "reset",
36
+ as: "h2"
37
+ }, t('Insert Content')), /*#__PURE__*/React.createElement(CloseButton, {
38
+ onClick: closeModal,
39
+ placement: "end",
40
+ offset: "medium",
41
+ screenReaderLabel: t('Close')
42
+ })), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(AddContentBody, {
43
+ allowStimulusCreation: allowStimulusCreation,
44
+ onOpenBankTray: closeModal,
45
+ onAddItem: closeModal,
46
+ parentEntryId: parentEntryId,
47
+ position: position,
48
+ quizId: quizId,
49
+ showHeaderText: false,
50
+ stimulusId: stimulusId,
51
+ slotProps: {
52
+ quizGenerationButton: _objectSpread(_objectSpread({}, (slotProps === null || slotProps === void 0 ? void 0 : slotProps.quizGenerationButton) || {}), {}, {
53
+ onClick: handleGenerateWithAiClick
54
+ })
54
55
  }
55
- }, {
56
- key: "render",
57
- value: function render() {
58
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Modal, {
59
- open: this.props.modalOpen,
60
- onDismiss: this.props.closeModal,
61
- size: "large",
62
- label: t('Add Content')
63
- }, /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(Heading, {
64
- level: "reset",
65
- as: "h2"
66
- }, t('Insert Content')), /*#__PURE__*/React.createElement(CloseButton, {
67
- onClick: this.props.closeModal,
68
- placement: "end",
69
- offset: "medium",
70
- screenReaderLabel: t('Close')
71
- })), /*#__PURE__*/React.createElement(ModalBody, null, this.renderContent()), /*#__PURE__*/React.createElement(ModalFooter, null, this.cancelButton())));
72
- }
73
- }]);
74
- }(Component);
75
- _defineProperty(AddContentModal, "propTypes", {
56
+ })), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
57
+ onClick: closeModal
58
+ }, t('Cancel')))));
59
+ }
60
+ AddContentModal.propTypes = {
76
61
  allowStimulusCreation: PropTypes.bool.isRequired,
77
62
  closeModal: PropTypes.func.isRequired,
78
63
  modalOpen: PropTypes.bool.isRequired,
79
64
  parentEntryId: PropTypes.string,
80
65
  position: PropTypes.number.isRequired,
81
66
  quizId: PropTypes.string.isRequired,
82
- stimulusId: PropTypes.string
83
- });
84
- _defineProperty(AddContentModal, "defaultProps", {
67
+ stimulusId: PropTypes.string,
68
+ slotProps: PropTypes.shape({
69
+ quizGenerationButton: quizGenerationButtonPropTypes
70
+ })
71
+ };
72
+ AddContentModal.defaultProps = {
85
73
  parentEntryId: void 0,
86
74
  stimulusId: void 0
87
- });
88
- export default AddContentModal;
75
+ };