@instructure/quiz-core 22.12.0 → 22.13.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.
@@ -138,7 +138,7 @@ export function createBulkQuizEntries(items, _ref) {
138
138
  var quizId = _ref.quizId,
139
139
  startPosition = _ref.startPosition,
140
140
  _ref$pointsPossible = _ref.pointsPossible,
141
- pointsPossible = _ref$pointsPossible === void 0 ? 1 : _ref$pointsPossible,
141
+ pointsPossible = _ref$pointsPossible === void 0 ? [] : _ref$pointsPossible,
142
142
  _ref$requireFocus = _ref.requireFocus,
143
143
  requireFocus = _ref$requireFocus === void 0 ? true : _ref$requireFocus;
144
144
  var url = "/api/quizzes/".concat(quizId, "/quiz_entries/bulk");
@@ -147,7 +147,7 @@ export function createBulkQuizEntries(items, _ref) {
147
147
  quizId: quizId,
148
148
  entryId: item.id,
149
149
  entryType: 'Item',
150
- points_possible: pointsPossible,
150
+ points_possible: (pointsPossible === null || pointsPossible === void 0 ? void 0 : pointsPossible[index]) || 1,
151
151
  position: Math.max(startPosition, 1) + index,
152
152
  stimulus_quiz_entry_id: null
153
153
  };
@@ -36,7 +36,9 @@ function UnstyledAddContentBody(_ref) {
36
36
  stimulusId = _ref.stimulusId,
37
37
  styles = _ref.styles,
38
38
  _ref$slotProps = _ref.slotProps,
39
- slotProps = _ref$slotProps === void 0 ? {} : _ref$slotProps;
39
+ slotProps = _ref$slotProps === void 0 ? {} : _ref$slotProps,
40
+ _ref$containerType = _ref.containerType,
41
+ containerType = _ref$containerType === void 0 ? 'popover' : _ref$containerType;
40
42
  var openBankTray = useCallback(function () {
41
43
  onOpenBankTray();
42
44
  setUi(BUILD_TRAY_OPEN, true);
@@ -100,10 +102,13 @@ function UnstyledAddContentBody(_ref) {
100
102
  width: "auto"
101
103
  }, renderBankButton())))), ((_slotProps$quizGenera = slotProps.quizGenerationButton) === null || _slotProps$quizGenera === void 0 ? void 0 : _slotProps$quizGenera.visible) && jsx(View, {
102
104
  as: "div",
103
- padding: "x-small 0 small"
105
+ maxWidth: containerType === 'modal' ? '100%' : '50%',
106
+ padding: containerType === 'modal' ? 'x-small 0 small' : 'x-small x-small small 0'
104
107
  }, jsx(Button, {
105
- color: "ai-primary",
108
+ size: "small",
106
109
  display: "block",
110
+ color: "ai-primary",
111
+ textAlign: "start",
107
112
  renderIcon: IconAiSolid,
108
113
  onClick: (_slotProps$quizGenera2 = slotProps.quizGenerationButton) === null || _slotProps$quizGenera2 === void 0 ? void 0 : _slotProps$quizGenera2.onClick,
109
114
  disabled: (_slotProps$quizGenera3 = slotProps.quizGenerationButton) === null || _slotProps$quizGenera3 === void 0 ? void 0 : _slotProps$quizGenera3.disabled
@@ -48,6 +48,7 @@ export function AddContentModal(_ref) {
48
48
  quizId: quizId,
49
49
  showHeaderText: false,
50
50
  stimulusId: stimulusId,
51
+ containerType: "modal",
51
52
  slotProps: {
52
53
  quizGenerationButton: _objectSpread(_objectSpread({}, (slotProps === null || slotProps === void 0 ? void 0 : slotProps.quizGenerationButton) || {}), {}, {
53
54
  onClick: handleGenerateWithAiClick
@@ -74,8 +74,10 @@ function UnstyledAddContentPopover(_ref) {
74
74
  });
75
75
  };
76
76
  var renderPopoverButton = function renderPopoverButton() {
77
+ var _slotProps$quizGenera3;
77
78
  return jsx(Popover, {
78
79
  on: "click",
80
+ placement: slotProps !== null && slotProps !== void 0 && (_slotProps$quizGenera3 = slotProps.quizGenerationButton) !== null && _slotProps$quizGenera3 !== void 0 && _slotProps$quizGenera3.visible ? 'end center' : 'bottom center',
79
81
  onShowContent: showContent,
80
82
  onHideContent: hideContent,
81
83
  isShowingContent: isEditing,
@@ -2,8 +2,11 @@ import Fetcher from '../../common/util/Fetcher';
2
2
  import withDynamoPagination from '../../common/util/withDynamoPagination';
3
3
  import { handleQuizSessionEventsResponse } from '../../common/api/callHandlers';
4
4
  import { QUIZ_SESSION_EVENTS_FETCH_CALL } from '@instructure/quiz-common';
5
- export function getQuizSessionEvents(quizSessionId) {
5
+ export function getQuizSessionEvents(quizSessionId, launchToken) {
6
6
  var url = "/api/quiz_sessions/".concat(quizSessionId, "/quiz_session_events");
7
+ if (launchToken) {
8
+ url += "?launch_token=".concat(launchToken);
9
+ }
7
10
  var fetcher = Reflect.construct(withDynamoPagination(Fetcher), [{
8
11
  callType: QUIZ_SESSION_EVENTS_FETCH_CALL
9
12
  }]);
@@ -156,7 +156,7 @@ function createBulkQuizEntries(items, _ref) {
156
156
  var quizId = _ref.quizId,
157
157
  startPosition = _ref.startPosition,
158
158
  _ref$pointsPossible = _ref.pointsPossible,
159
- pointsPossible = _ref$pointsPossible === void 0 ? 1 : _ref$pointsPossible,
159
+ pointsPossible = _ref$pointsPossible === void 0 ? [] : _ref$pointsPossible,
160
160
  _ref$requireFocus = _ref.requireFocus,
161
161
  requireFocus = _ref$requireFocus === void 0 ? true : _ref$requireFocus;
162
162
  var url = "/api/quizzes/".concat(quizId, "/quiz_entries/bulk");
@@ -165,7 +165,7 @@ function createBulkQuizEntries(items, _ref) {
165
165
  quizId: quizId,
166
166
  entryId: item.id,
167
167
  entryType: 'Item',
168
- points_possible: pointsPossible,
168
+ points_possible: (pointsPossible === null || pointsPossible === void 0 ? void 0 : pointsPossible[index]) || 1,
169
169
  position: Math.max(startPosition, 1) + index,
170
170
  stimulus_quiz_entry_id: null
171
171
  };
@@ -46,7 +46,9 @@ function UnstyledAddContentBody(_ref) {
46
46
  stimulusId = _ref.stimulusId,
47
47
  styles = _ref.styles,
48
48
  _ref$slotProps = _ref.slotProps,
49
- slotProps = _ref$slotProps === void 0 ? {} : _ref$slotProps;
49
+ slotProps = _ref$slotProps === void 0 ? {} : _ref$slotProps,
50
+ _ref$containerType = _ref.containerType,
51
+ containerType = _ref$containerType === void 0 ? 'popover' : _ref$containerType;
50
52
  var openBankTray = (0, _react.useCallback)(function () {
51
53
  onOpenBankTray();
52
54
  setUi(_quizCommon.BUILD_TRAY_OPEN, true);
@@ -110,10 +112,13 @@ function UnstyledAddContentBody(_ref) {
110
112
  width: "auto"
111
113
  }, renderBankButton())))), ((_slotProps$quizGenera = slotProps.quizGenerationButton) === null || _slotProps$quizGenera === void 0 ? void 0 : _slotProps$quizGenera.visible) && (0, _emotion.jsx)(_uiView.View, {
112
114
  as: "div",
113
- padding: "x-small 0 small"
115
+ maxWidth: containerType === 'modal' ? '100%' : '50%',
116
+ padding: containerType === 'modal' ? 'x-small 0 small' : 'x-small x-small small 0'
114
117
  }, (0, _emotion.jsx)(_uiButtons.Button, {
115
- color: "ai-primary",
118
+ size: "small",
116
119
  display: "block",
120
+ color: "ai-primary",
121
+ textAlign: "start",
117
122
  renderIcon: _uiIcons.IconAiSolid,
118
123
  onClick: (_slotProps$quizGenera2 = slotProps.quizGenerationButton) === null || _slotProps$quizGenera2 === void 0 ? void 0 : _slotProps$quizGenera2.onClick,
119
124
  disabled: (_slotProps$quizGenera3 = slotProps.quizGenerationButton) === null || _slotProps$quizGenera3 === void 0 ? void 0 : _slotProps$quizGenera3.disabled
@@ -55,6 +55,7 @@ function AddContentModal(_ref) {
55
55
  quizId: quizId,
56
56
  showHeaderText: false,
57
57
  stimulusId: stimulusId,
58
+ containerType: "modal",
58
59
  slotProps: {
59
60
  quizGenerationButton: _objectSpread(_objectSpread({}, (slotProps === null || slotProps === void 0 ? void 0 : slotProps.quizGenerationButton) || {}), {}, {
60
61
  onClick: handleGenerateWithAiClick
@@ -82,8 +82,10 @@ function UnstyledAddContentPopover(_ref) {
82
82
  });
83
83
  };
84
84
  var renderPopoverButton = function renderPopoverButton() {
85
+ var _slotProps$quizGenera3;
85
86
  return (0, _emotion.jsx)(_uiPopover.Popover, {
86
87
  on: "click",
88
+ placement: slotProps !== null && slotProps !== void 0 && (_slotProps$quizGenera3 = slotProps.quizGenerationButton) !== null && _slotProps$quizGenera3 !== void 0 && _slotProps$quizGenera3.visible ? 'end center' : 'bottom center',
87
89
  onShowContent: showContent,
88
90
  onHideContent: hideContent,
89
91
  isShowingContent: isEditing,
@@ -9,8 +9,11 @@ var _Fetcher = _interopRequireDefault(require("../../common/util/Fetcher"));
9
9
  var _withDynamoPagination = _interopRequireDefault(require("../../common/util/withDynamoPagination"));
10
10
  var _callHandlers = require("../../common/api/callHandlers");
11
11
  var _quizCommon = require("@instructure/quiz-common");
12
- function getQuizSessionEvents(quizSessionId) {
12
+ function getQuizSessionEvents(quizSessionId, launchToken) {
13
13
  var url = "/api/quiz_sessions/".concat(quizSessionId, "/quiz_session_events");
14
+ if (launchToken) {
15
+ url += "?launch_token=".concat(launchToken);
16
+ }
14
17
  var fetcher = Reflect.construct((0, _withDynamoPagination["default"])(_Fetcher["default"]), [{
15
18
  callType: _quizCommon.QUIZ_SESSION_EVENTS_FETCH_CALL
16
19
  }]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "22.12.0",
3
+ "version": "22.13.1",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -111,12 +111,12 @@
111
111
  "store": "^1.3.20",
112
112
  "striptags": "^2.0.0",
113
113
  "uuid": "^3.2.1",
114
- "@instructure/quiz-common": "22.12.0",
115
- "@instructure/quiz-i18n": "22.12.0",
116
- "@instructure/quiz-number-input": "22.12.0",
117
- "@instructure/quiz-interactions": "22.12.0",
118
- "instructure-validations": "22.12.0",
119
- "@instructure/quiz-rce": "22.12.0"
114
+ "@instructure/quiz-common": "22.13.1",
115
+ "@instructure/quiz-i18n": "22.13.1",
116
+ "@instructure/quiz-interactions": "22.13.1",
117
+ "@instructure/quiz-number-input": "22.13.1",
118
+ "@instructure/quiz-rce": "22.13.1",
119
+ "instructure-validations": "22.13.1"
120
120
  },
121
121
  "devDependencies": {
122
122
  "@instructure/ui-axe-check": "10.17.0",
@@ -145,7 +145,7 @@
145
145
  "sinon": "^6.1.3",
146
146
  "sinon-chai": "^3.3.0",
147
147
  "@instructure/quiz-scripts": "21.0.0",
148
- "quiz-presets": "22.12.0"
148
+ "quiz-presets": "22.13.1"
149
149
  },
150
150
  "peerDependencies": {
151
151
  "react": "^15 || ^16"
@@ -161,6 +161,7 @@
161
161
  "lint": "ui-test --lint",
162
162
  "lint:fix": "ui-test --lint --fix",
163
163
  "eslint:fix": "eslint --fix .",
164
+ "eslint:errors": "eslint --quiet --fix .",
164
165
  "test": "pnpm test:karma",
165
166
  "test:karma": "ui-test",
166
167
  "test:watch": "ui-test --watch",