@instructure/quiz-core 17.51.0 → 17.51.1-rc.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.
@@ -27,6 +27,13 @@ export function addError(message, removeIn, guid) {
27
27
  guid: guid
28
28
  });
29
29
  }
30
+ export function addStickyError(message, guid) {
31
+ return addAlert({
32
+ message: message,
33
+ variant: 'stickyerror',
34
+ guid: guid
35
+ });
36
+ }
30
37
  export function addSuccess(message) {
31
38
  return addAlert({
32
39
  message: message,
@@ -1,11 +1,11 @@
1
1
  import store from "../../../reduxStore.js";
2
- import { addError } from "../../actions/alerts.js";
2
+ import { addStickyError } from "../../actions/alerts.js";
3
3
  import { setRCEError } from "../../actions/rce.js";
4
4
  import { isQuizBuilding, isQuizTaking } from "../../util/windowChecks.js";
5
5
  import { userAlertMsgBuilding, userAlertMsgTaking } from "./rceConfigErrorMessages.js";
6
6
 
7
7
  var alertTheUser = function alertTheUser(message) {
8
- store.dispatch(addError(message));
8
+ store.dispatch(addStickyError(message));
9
9
  };
10
10
 
11
11
  var getAlertMessage = function getAlertMessage() {
@@ -45,6 +45,18 @@ export var Alerts = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
45
45
  return _this.renderScreenreaderAlert(alert);
46
46
  }
47
47
 
48
+ if (alert.variant === 'stickyerror') {
49
+ return /*#__PURE__*/React.createElement("div", {
50
+ key: alert.uuid,
51
+ className: styles.alertHolder
52
+ }, /*#__PURE__*/React.createElement(Alert, {
53
+ variant: "error",
54
+ onDismiss: closeAlert,
55
+ closeButtonLabel: t('Close'),
56
+ transition: "none"
57
+ }, alert.message));
58
+ }
59
+
48
60
  return /*#__PURE__*/React.createElement("div", {
49
61
  key: alert.uuid,
50
62
  className: styles.alertHolder
@@ -74,6 +86,19 @@ export var Alerts = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
74
86
  }, {
75
87
  key: "render",
76
88
  value: function render() {
89
+ var hasStickyErrors = this.props.alerts.toJS().find(function (alert) {
90
+ return alert.variant === 'stickyerror';
91
+ });
92
+
93
+ if (hasStickyErrors) {
94
+ return /*#__PURE__*/React.createElement("div", {
95
+ className: styles.alerts,
96
+ style: {
97
+ zIndex: '99999'
98
+ }
99
+ }, this.renderAlerts());
100
+ }
101
+
77
102
  return /*#__PURE__*/React.createElement("div", {
78
103
  className: styles.alerts
79
104
  }, this.renderAlerts());
@@ -6,7 +6,7 @@ var alertTimerMiddleware = function alertTimerMiddleware(store) {
6
6
  return function (action) {
7
7
  var delay = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : setTimeout;
8
8
 
9
- if (action && action.type === ADD_ALERT && action.payload.removeIn) {
9
+ if (action && action.type === ADD_ALERT && action.payload.removeIn && action.payload.variant != 'stickyerror') {
10
10
  var remove = function remove() {
11
11
  store.dispatch(removeAlert(action.payload.uuid));
12
12
  }; // injected for testing
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.addError = addError;
7
+ exports.addStickyError = addStickyError;
7
8
  exports.addSuccess = addSuccess;
8
9
  exports.addInfo = addInfo;
9
10
  exports.screenreaderNotification = screenreaderNotification;
@@ -40,6 +41,14 @@ function addError(message, removeIn, guid) {
40
41
  });
41
42
  }
42
43
 
44
+ function addStickyError(message, guid) {
45
+ return addAlert({
46
+ message: message,
47
+ variant: 'stickyerror',
48
+ guid: guid
49
+ });
50
+ }
51
+
43
52
  function addSuccess(message) {
44
53
  return addAlert({
45
54
  message: message,
@@ -18,7 +18,7 @@ var _windowChecks = require("../../util/windowChecks.js");
18
18
  var _rceConfigErrorMessages = require("./rceConfigErrorMessages.js");
19
19
 
20
20
  var alertTheUser = function alertTheUser(message) {
21
- _reduxStore.default.dispatch((0, _alerts.addError)(message));
21
+ _reduxStore.default.dispatch((0, _alerts.addStickyError)(message));
22
22
  };
23
23
 
24
24
  var getAlertMessage = function getAlertMessage() {
@@ -68,6 +68,18 @@ var Alerts = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
68
68
  return _this.renderScreenreaderAlert(alert);
69
69
  }
70
70
 
71
+ if (alert.variant === 'stickyerror') {
72
+ return /*#__PURE__*/_react.default.createElement("div", {
73
+ key: alert.uuid,
74
+ className: styles.alertHolder
75
+ }, /*#__PURE__*/_react.default.createElement(_uiAlerts.Alert, {
76
+ variant: "error",
77
+ onDismiss: closeAlert,
78
+ closeButtonLabel: (0, _formatMessage.default)('Close'),
79
+ transition: "none"
80
+ }, alert.message));
81
+ }
82
+
71
83
  return /*#__PURE__*/_react.default.createElement("div", {
72
84
  key: alert.uuid,
73
85
  className: styles.alertHolder
@@ -97,6 +109,19 @@ var Alerts = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
97
109
  }, {
98
110
  key: "render",
99
111
  value: function render() {
112
+ var hasStickyErrors = this.props.alerts.toJS().find(function (alert) {
113
+ return alert.variant === 'stickyerror';
114
+ });
115
+
116
+ if (hasStickyErrors) {
117
+ return /*#__PURE__*/_react.default.createElement("div", {
118
+ className: styles.alerts,
119
+ style: {
120
+ zIndex: '99999'
121
+ }
122
+ }, this.renderAlerts());
123
+ }
124
+
100
125
  return /*#__PURE__*/_react.default.createElement("div", {
101
126
  className: styles.alerts
102
127
  }, this.renderAlerts());
@@ -14,7 +14,7 @@ var alertTimerMiddleware = function alertTimerMiddleware(store) {
14
14
  return function (action) {
15
15
  var delay = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : setTimeout;
16
16
 
17
- if (action && action.type === _quizCommon.ADD_ALERT && action.payload.removeIn) {
17
+ if (action && action.type === _quizCommon.ADD_ALERT && action.payload.removeIn && action.payload.variant != 'stickyerror') {
18
18
  var remove = function remove() {
19
19
  store.dispatch((0, _alerts.removeAlert)(action.payload.uuid));
20
20
  }; // injected for testing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "17.51.0",
3
+ "version": "17.51.1-rc.1+d2c000bb6",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -41,11 +41,11 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "@instructure/outcomes-ui": "^2.1.6",
44
- "@instructure/quiz-common": "^17.51.0",
45
- "@instructure/quiz-i18n": "^17.51.0",
46
- "@instructure/quiz-interactions": "^17.51.0",
47
- "@instructure/quiz-number-input": "^17.51.0",
48
- "@instructure/quiz-rce": "^17.51.0",
44
+ "@instructure/quiz-common": "17.51.1-rc.1+d2c000bb6",
45
+ "@instructure/quiz-i18n": "17.51.1-rc.1+d2c000bb6",
46
+ "@instructure/quiz-interactions": "17.51.1-rc.1+d2c000bb6",
47
+ "@instructure/quiz-number-input": "17.51.1-rc.1+d2c000bb6",
48
+ "@instructure/quiz-rce": "17.51.1-rc.1+d2c000bb6",
49
49
  "@instructure/ui-a11y-content": "^7.20.0",
50
50
  "@instructure/ui-alerts": "^7.20.0",
51
51
  "@instructure/ui-avatar": "^7.20.0",
@@ -106,7 +106,7 @@
106
106
  "eventemitter3": "^3.1.0",
107
107
  "humps": "^2.0.0",
108
108
  "immutable": "^3.8.1",
109
- "instructure-validations": "^17.51.0",
109
+ "instructure-validations": "17.51.1-rc.1+d2c000bb6",
110
110
  "ipaddr.js": "^1.5.4",
111
111
  "isomorphic-fetch": "^2.2.0",
112
112
  "isuuid": "^0.1.0",
@@ -137,7 +137,7 @@
137
137
  "uuid": "^3.2.1"
138
138
  },
139
139
  "devDependencies": {
140
- "@instructure/quiz-scripts": "^17.51.0",
140
+ "@instructure/quiz-scripts": "17.51.0",
141
141
  "@instructure/ui-axe-check": "^7.20.0",
142
142
  "@instructure/ui-babel-preset": "^7.20.0",
143
143
  "@instructure/ui-karma-config": "^7.20.0",
@@ -156,7 +156,7 @@
156
156
  "intl": "^1.2.4",
157
157
  "jquery": "^2.2.3",
158
158
  "most-subject": "^5.3.0",
159
- "quiz-presets": "^17.51.0",
159
+ "quiz-presets": "17.51.1-rc.1+d2c000bb6",
160
160
  "react": "^16.8.6",
161
161
  "react-addons-test-utils": "^15.6.2",
162
162
  "react-dom": "^16.8.6",
@@ -172,5 +172,5 @@
172
172
  "publishConfig": {
173
173
  "access": "public"
174
174
  },
175
- "gitHead": "40c987c703fe620e2c3b0c8f3ce4436fbba64f62"
175
+ "gitHead": "d2c000bb6a9b9d7dc679d4d413e0922948fe9162"
176
176
  }