@instructure/quiz-core 22.2.0 → 22.2.2-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.
@@ -30,13 +30,13 @@ export var EventDetails = function EventDetails(_ref) {
30
30
  id: "system-details-attribute"
31
31
  }, t('Attribute')), /*#__PURE__*/React.createElement(Table.ColHeader, {
32
32
  id: "system-details-value"
33
- }, t('Value')))), /*#__PURE__*/React.createElement(Table.Body, null, /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.Cell, null, t('Client IP address')), /*#__PURE__*/React.createElement(Table.Cell, null, /*#__PURE__*/React.createElement(Text, {
33
+ }, t('Value')))), /*#__PURE__*/React.createElement(Table.Body, null, currentEventData.ipAddress && /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.Cell, null, t('Client IP address')), /*#__PURE__*/React.createElement(Table.Cell, null, /*#__PURE__*/React.createElement(Text, {
34
34
  color: validationErrors.ipAddress ? 'danger' : 'primary'
35
35
  }, currentEventData.ipAddress), validationErrors.ipAddress && renderTooltip(validationErrors.ipAddress))), /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.Cell, null, t('Browser session ID')), /*#__PURE__*/React.createElement(Table.Cell, null, /*#__PURE__*/React.createElement(Text, {
36
36
  color: validationErrors.browserSessionID ? 'danger' : 'primary'
37
- }, currentEventData.browserSessionID), validationErrors.browserSessionID && renderTooltip(validationErrors.browserSessionID))), /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.Cell, null, t('Browser')), /*#__PURE__*/React.createElement(Table.Cell, null, /*#__PURE__*/React.createElement(Text, {
37
+ }, currentEventData.browserSessionID), validationErrors.browserSessionID && renderTooltip(validationErrors.browserSessionID))), currentEventData.browserString && /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.Cell, null, t('Browser')), /*#__PURE__*/React.createElement(Table.Cell, null, /*#__PURE__*/React.createElement(Text, {
38
38
  color: validationErrors.browserString ? 'danger' : 'primary'
39
- }, currentEventData.browserString), validationErrors.browserString && renderTooltip(validationErrors.browserString))), /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.Cell, null, t('Operating System')), /*#__PURE__*/React.createElement(Table.Cell, null, /*#__PURE__*/React.createElement(Text, {
39
+ }, currentEventData.browserString), renderTooltip(validationErrors.browserString))), currentEventData.userPlatform && /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.Cell, null, t('Operating System')), /*#__PURE__*/React.createElement(Table.Cell, null, /*#__PURE__*/React.createElement(Text, {
40
40
  color: validationErrors.userPlatform ? 'danger' : 'primary'
41
41
  }, currentEventData.userPlatform), validationErrors.userPlatform && renderTooltip(validationErrors.userPlatform))), answerValue && /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.Cell, null, t('Answer value')), /*#__PURE__*/React.createElement(Table.Cell, null, answerValue)))));
42
42
  };
@@ -5,5 +5,5 @@ export var SessionBreachAlert = function SessionBreachAlert() {
5
5
  return /*#__PURE__*/React.createElement(Alert, {
6
6
  variant: "warning",
7
7
  margin: "small"
8
- }, t('Potential breach: This Quiz appears to have been accessed from multiple devices or browsers.'), /*#__PURE__*/React.createElement("br", null), t('Review the activity log and take appropriate action.'));
8
+ }, t('This Quiz appears to have been accessed from multiple devices or browsers.'), /*#__PURE__*/React.createElement("br", null), t('Review the activity log and take appropriate action.'));
9
9
  };
@@ -19,7 +19,7 @@ export var checkIsBreach = function checkIsBreach(firstEventData, currentEventDa
19
19
  checks.forEach(function (_ref) {
20
20
  var key = _ref.key,
21
21
  message = _ref.message;
22
- if (currentEventData[key] !== firstEventData[key]) {
22
+ if (currentEventData[key] && currentEventData[key] !== firstEventData[key]) {
23
23
  result.isBreach = true;
24
24
  result[key] = message;
25
25
  }
@@ -9,12 +9,16 @@ export var extractSessionData = function extractSessionData(sourceData) {
9
9
  userPlatform: ''
10
10
  };
11
11
  var clientTimestamp = sourceData.getIn(['eventData', 'clientTimestamp']);
12
- var userPlatform = platform.parse(sourceData.getIn(['eventData', 'userAgent']));
12
+ var userAgent = sourceData.getIn(['eventData', 'userAgent']);
13
+ var userPlatform = null;
14
+ if (userAgent) {
15
+ userPlatform = platform.parse(userAgent);
16
+ }
13
17
  return {
14
18
  ipAddress: sourceData.getIn(['eventData', 'ipAddress']),
15
19
  browserSessionID: sourceData.getIn(['eventData', 'browserSessionId']),
16
20
  eventDate: clientTimestamp ? formatDateTimeSeconds(clientTimestamp) : '',
17
- browserString: "".concat(userPlatform.name, " ").concat(userPlatform.version),
18
- userPlatform: userPlatform.os.toString()
21
+ browserString: userPlatform ? "".concat(userPlatform.name, " ").concat(userPlatform.version) : null,
22
+ userPlatform: userPlatform ? userPlatform.os.toString() : null
19
23
  };
20
24
  };
@@ -37,13 +37,13 @@ var EventDetails = exports.EventDetails = function EventDetails(_ref) {
37
37
  id: "system-details-attribute"
38
38
  }, (0, _formatMessage["default"])('Attribute')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.ColHeader, {
39
39
  id: "system-details-value"
40
- }, (0, _formatMessage["default"])('Value')))), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Body, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, (0, _formatMessage["default"])('Client IP address')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, /*#__PURE__*/_react["default"].createElement(_uiText.Text, {
40
+ }, (0, _formatMessage["default"])('Value')))), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Body, null, currentEventData.ipAddress && /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, (0, _formatMessage["default"])('Client IP address')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, /*#__PURE__*/_react["default"].createElement(_uiText.Text, {
41
41
  color: validationErrors.ipAddress ? 'danger' : 'primary'
42
42
  }, currentEventData.ipAddress), validationErrors.ipAddress && renderTooltip(validationErrors.ipAddress))), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, (0, _formatMessage["default"])('Browser session ID')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, /*#__PURE__*/_react["default"].createElement(_uiText.Text, {
43
43
  color: validationErrors.browserSessionID ? 'danger' : 'primary'
44
- }, currentEventData.browserSessionID), validationErrors.browserSessionID && renderTooltip(validationErrors.browserSessionID))), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, (0, _formatMessage["default"])('Browser')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, /*#__PURE__*/_react["default"].createElement(_uiText.Text, {
44
+ }, currentEventData.browserSessionID), validationErrors.browserSessionID && renderTooltip(validationErrors.browserSessionID))), currentEventData.browserString && /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, (0, _formatMessage["default"])('Browser')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, /*#__PURE__*/_react["default"].createElement(_uiText.Text, {
45
45
  color: validationErrors.browserString ? 'danger' : 'primary'
46
- }, currentEventData.browserString), validationErrors.browserString && renderTooltip(validationErrors.browserString))), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, (0, _formatMessage["default"])('Operating System')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, /*#__PURE__*/_react["default"].createElement(_uiText.Text, {
46
+ }, currentEventData.browserString), renderTooltip(validationErrors.browserString))), currentEventData.userPlatform && /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, (0, _formatMessage["default"])('Operating System')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, /*#__PURE__*/_react["default"].createElement(_uiText.Text, {
47
47
  color: validationErrors.userPlatform ? 'danger' : 'primary'
48
48
  }, currentEventData.userPlatform), validationErrors.userPlatform && renderTooltip(validationErrors.userPlatform))), answerValue && /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, (0, _formatMessage["default"])('Answer value')), /*#__PURE__*/_react["default"].createElement(_uiTable.Table.Cell, null, answerValue)))));
49
49
  };
@@ -12,5 +12,5 @@ var SessionBreachAlert = exports.SessionBreachAlert = function SessionBreachAler
12
12
  return /*#__PURE__*/_react["default"].createElement(_uiAlerts.Alert, {
13
13
  variant: "warning",
14
14
  margin: "small"
15
- }, (0, _formatMessage["default"])('Potential breach: This Quiz appears to have been accessed from multiple devices or browsers.'), /*#__PURE__*/_react["default"].createElement("br", null), (0, _formatMessage["default"])('Review the activity log and take appropriate action.'));
15
+ }, (0, _formatMessage["default"])('This Quiz appears to have been accessed from multiple devices or browsers.'), /*#__PURE__*/_react["default"].createElement("br", null), (0, _formatMessage["default"])('Review the activity log and take appropriate action.'));
16
16
  };
@@ -26,7 +26,7 @@ var checkIsBreach = exports.checkIsBreach = function checkIsBreach(firstEventDat
26
26
  checks.forEach(function (_ref) {
27
27
  var key = _ref.key,
28
28
  message = _ref.message;
29
- if (currentEventData[key] !== firstEventData[key]) {
29
+ if (currentEventData[key] && currentEventData[key] !== firstEventData[key]) {
30
30
  result.isBreach = true;
31
31
  result[key] = message;
32
32
  }
@@ -16,12 +16,16 @@ var extractSessionData = exports.extractSessionData = function extractSessionDat
16
16
  userPlatform: ''
17
17
  };
18
18
  var clientTimestamp = sourceData.getIn(['eventData', 'clientTimestamp']);
19
- var userPlatform = _platform["default"].parse(sourceData.getIn(['eventData', 'userAgent']));
19
+ var userAgent = sourceData.getIn(['eventData', 'userAgent']);
20
+ var userPlatform = null;
21
+ if (userAgent) {
22
+ userPlatform = _platform["default"].parse(userAgent);
23
+ }
20
24
  return {
21
25
  ipAddress: sourceData.getIn(['eventData', 'ipAddress']),
22
26
  browserSessionID: sourceData.getIn(['eventData', 'browserSessionId']),
23
27
  eventDate: clientTimestamp ? (0, _quizI18n.formatDateTimeSeconds)(clientTimestamp) : '',
24
- browserString: "".concat(userPlatform.name, " ").concat(userPlatform.version),
25
- userPlatform: userPlatform.os.toString()
28
+ browserString: userPlatform ? "".concat(userPlatform.name, " ").concat(userPlatform.version) : null,
29
+ userPlatform: userPlatform ? userPlatform.os.toString() : null
26
30
  };
27
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "22.2.0",
3
+ "version": "22.2.2-rc.1+0ca67121f",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -10,6 +10,27 @@
10
10
  "type": "git",
11
11
  "url": "https://gerrit.instructure.com/quizzes-ui.git"
12
12
  },
13
+ "scripts": {
14
+ "clean": "ui-build --clean",
15
+ "build": "build-if-changed",
16
+ "build:all": "ui-build --modules es,cjs",
17
+ "build:watch": "ui-build --watch",
18
+ "extract": "extract-translations",
19
+ "lint": "ui-test --lint",
20
+ "lint:fix": "ui-test --lint --fix",
21
+ "eslint:fix": "eslint --fix .",
22
+ "prelint": "pnpm build",
23
+ "pretest": "pnpm build",
24
+ "test": "pnpm test:karma",
25
+ "test:karma": "ui-test",
26
+ "test:watch": "ui-test --watch",
27
+ "snyk:monitor": "snyk monitor",
28
+ "postbuild": "cp src/banks/components/noResults.svg lib/banks/components/; cp src/banks/components/noResults.svg es/banks/components/; pnpm postbuild:errorImage",
29
+ "postbuild:all": "pnpm postbuild",
30
+ "postbuild:errorImage": "cp src/reporting/components/resources/NewQuizAndItemAnalysis/downForRepair.svg es/reporting/components/resources/NewQuizAndItemAnalysis/; cp src/reporting/components/resources/NewQuizAndItemAnalysis/downForRepair.svg lib/reporting/components/resources/NewQuizAndItemAnalysis/",
31
+ "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
32
+ "typecheck": "tsc --noEmit"
33
+ },
13
34
  "keywords": [
14
35
  "react",
15
36
  "react-component",
@@ -25,6 +46,11 @@
25
46
  "@instructure/emotion": "10.14.0",
26
47
  "@instructure/grading-utils": "^1.0.0",
27
48
  "@instructure/outcomes-ui": "3.2.3",
49
+ "@instructure/quiz-common": "22.2.2-rc.1+0ca67121f",
50
+ "@instructure/quiz-i18n": "22.2.2-rc.1+0ca67121f",
51
+ "@instructure/quiz-interactions": "22.2.2-rc.1+0ca67121f",
52
+ "@instructure/quiz-number-input": "22.2.2-rc.1+0ca67121f",
53
+ "@instructure/quiz-rce": "22.2.2-rc.1+0ca67121f",
28
54
  "@instructure/ui-a11y-content": "10.14.0",
29
55
  "@instructure/ui-alerts": "10.14.0",
30
56
  "@instructure/ui-avatar": "10.14.0",
@@ -83,6 +109,7 @@
83
109
  "file-saver": "~2.0.5",
84
110
  "humps": "^2.0.0",
85
111
  "immutable": "^3.8.1",
112
+ "instructure-validations": "22.2.2-rc.1+0ca67121f",
86
113
  "ipaddr.js": "^1.5.4",
87
114
  "isomorphic-fetch": "^2.2.0",
88
115
  "isuuid": "^0.1.0",
@@ -110,15 +137,10 @@
110
137
  "scriptjs": "^2.5.8",
111
138
  "store": "^1.3.20",
112
139
  "striptags": "^2.0.0",
113
- "uuid": "^3.2.1",
114
- "@instructure/quiz-common": "22.2.0",
115
- "@instructure/quiz-interactions": "22.2.0",
116
- "@instructure/quiz-i18n": "22.2.0",
117
- "@instructure/quiz-number-input": "22.2.0",
118
- "instructure-validations": "22.2.0",
119
- "@instructure/quiz-rce": "22.2.0"
140
+ "uuid": "^3.2.1"
120
141
  },
121
142
  "devDependencies": {
143
+ "@instructure/quiz-scripts": "21.0.0",
122
144
  "@instructure/ui-axe-check": "10.14.0",
123
145
  "@instructure/ui-test-utils": "^7.22.1",
124
146
  "@testing-library/react": "^12.1.5",
@@ -136,6 +158,7 @@
136
158
  "jquery": "^2.2.3",
137
159
  "karma-junit-reporter": "^2.0.1",
138
160
  "most-subject": "^5.3.0",
161
+ "quiz-presets": "22.2.2-rc.1+0ca67121f",
139
162
  "react": "^16.8.6",
140
163
  "react-addons-test-utils": "^15.6.2",
141
164
  "react-dom": "^16.8.6",
@@ -143,9 +166,7 @@
143
166
  "redux-mock-store": "^1.3.0",
144
167
  "request": "^2.74.0",
145
168
  "sinon": "^6.1.3",
146
- "sinon-chai": "^3.3.0",
147
- "@instructure/quiz-scripts": "21.0.0",
148
- "quiz-presets": "22.2.0"
169
+ "sinon-chai": "^3.3.0"
149
170
  },
150
171
  "peerDependencies": {
151
172
  "react": "^15 || ^16"
@@ -153,25 +174,5 @@
153
174
  "publishConfig": {
154
175
  "access": "public"
155
176
  },
156
- "scripts": {
157
- "clean": "ui-build --clean",
158
- "build": "build-if-changed",
159
- "build:all": "ui-build --modules es,cjs",
160
- "build:watch": "ui-build --watch",
161
- "extract": "extract-translations",
162
- "lint": "ui-test --lint",
163
- "lint:fix": "ui-test --lint --fix",
164
- "eslint:fix": "eslint --fix .",
165
- "prelint": "pnpm build",
166
- "pretest": "pnpm build",
167
- "test": "pnpm test:karma",
168
- "test:karma": "ui-test",
169
- "test:watch": "ui-test --watch",
170
- "snyk:monitor": "snyk monitor",
171
- "postbuild": "cp src/banks/components/noResults.svg lib/banks/components/; cp src/banks/components/noResults.svg es/banks/components/; pnpm postbuild:errorImage",
172
- "postbuild:all": "pnpm postbuild",
173
- "postbuild:errorImage": "cp src/reporting/components/resources/NewQuizAndItemAnalysis/downForRepair.svg es/reporting/components/resources/NewQuizAndItemAnalysis/; cp src/reporting/components/resources/NewQuizAndItemAnalysis/downForRepair.svg lib/reporting/components/resources/NewQuizAndItemAnalysis/",
174
- "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
175
- "typecheck": "tsc --noEmit"
176
- }
177
- }
177
+ "gitHead": "0ca67121ff17f05c2194f92da0fc889b1ee9d7af"
178
+ }