@atlaskit/profilecard 19.1.1 → 19.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 19.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`052672d7eca`](https://bitbucket.org/atlassian/atlassian-frontend/commits/052672d7eca) - Added errorSource to analytics events, added tests for fail events
8
+
9
+ ## 19.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`2af6359970f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2af6359970f) - [ux] This change (related to TSLA-521) adds an onFocus handler for the profile card trigger that performs the same behavior as onHover. The change also adds an onBlur handler.
14
+
3
15
  ## 19.1.1
4
16
 
5
17
  ### Patch Changes
@@ -18,6 +18,7 @@ var getErrorAttributes = function getErrorAttributes(error) {
18
18
  errorMessage: error === null || error === void 0 ? void 0 : error.message,
19
19
  errorStatus: error === null || error === void 0 ? void 0 : error.code,
20
20
  errorReason: (error === null || error === void 0 ? void 0 : error.reason) || 'default',
21
+ errorSource: error === null || error === void 0 ? void 0 : error.source,
21
22
  isSLOFailure: !isIgnoredError(error),
22
23
  traceId: (_error$traceId = error === null || error === void 0 ? void 0 : error.traceId) !== null && _error$traceId !== void 0 ? _error$traceId : undefined
23
24
  };
@@ -46,7 +46,7 @@ function graphqlQuery(serviceUrl, query) {
46
46
  return Promise.reject({
47
47
  reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || ((_json$errors$2 = json.errors[0]) === null || _json$errors$2 === void 0 ? void 0 : (_json$errors$2$extens = _json$errors$2.extensions) === null || _json$errors$2$extens === void 0 ? void 0 : _json$errors$2$extens.classification) || 'default',
48
48
  code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode,
49
- errorSource: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
49
+ source: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
50
50
  message: json.errors[0].message,
51
51
  traceId: (_json$extensions = json.extensions) === null || _json$extensions === void 0 ? void 0 : (_json$extensions$gate = _json$extensions.gateway) === null || _json$extensions$gate === void 0 ? void 0 : _json$extensions$gate.request_id
52
52
  });
@@ -95,6 +95,12 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
95
95
  _this.fireAnalytics((0, _analytics.cardTriggered)('user', 'hover'));
96
96
  }
97
97
  });
98
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFocus", function () {
99
+ _this.showProfilecard();
100
+ if (!_this.state.visible) {
101
+ _this.fireAnalytics((0, _analytics.cardTriggered)('user', 'hover'));
102
+ }
103
+ });
98
104
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyPress", function (event) {
99
105
  if (event.key === 'Enter' || event.key === ' ') {
100
106
  event.preventDefault();
@@ -106,7 +112,9 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
106
112
  });
107
113
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "containerListeners", _this.props.trigger === 'hover' ? {
108
114
  onMouseEnter: _this.onMouseEnter,
109
- onMouseLeave: _this.hideProfilecard
115
+ onMouseLeave: _this.hideProfilecard,
116
+ onFocus: _this.onFocus,
117
+ onBlur: _this.hideProfilecard
110
118
  } : {
111
119
  onClick: _this.onClick,
112
120
  onKeyPress: _this.onKeyPress
@@ -254,7 +262,8 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
254
262
  });
255
263
  var wrapperProps = this.props.trigger === 'hover' ? {
256
264
  onMouseEnter: this.onMouseEnter,
257
- onMouseLeave: this.hideProfilecard
265
+ onMouseLeave: this.hideProfilecard,
266
+ onFocus: this.onFocus
258
267
  } : {};
259
268
  return /*#__PURE__*/_react.default.createElement("div", wrapperProps, this.state.visible && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
260
269
  fallback: null
@@ -280,8 +289,8 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
280
289
  return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, innerProps, _this3.containerListeners, {
281
290
  ref: ref,
282
291
  "data-testid": _this3.props.testId,
283
- tabIndex: 0,
284
- role: _this3.props.trigger !== 'hover' ? 'button' : ''
292
+ role: _this3.props.trigger !== 'hover' ? 'button' : '',
293
+ tabIndex: 0
285
294
  }), _this3.props.children);
286
295
  },
287
296
  zIndex: _constants.layers.modal(),
@@ -24,20 +24,24 @@ function getMockTeamClient(data) {
24
24
  (0, _createClass2.default)(MockTeamClient, [{
25
25
  key: "makeRequest",
26
26
  value: function makeRequest(teamId) {
27
+ var _data$error, _data$error2, _data$error3, _data$error4, _data$error5;
28
+ var errorResponse = {
29
+ reason: (_data$error = data.error) === null || _data$error === void 0 ? void 0 : _data$error.reason,
30
+ code: (_data$error2 = data.error) === null || _data$error2 === void 0 ? void 0 : _data$error2.code,
31
+ source: (_data$error3 = data.error) === null || _data$error3 === void 0 ? void 0 : _data$error3.source,
32
+ message: (_data$error4 = data.error) === null || _data$error4 === void 0 ? void 0 : _data$error4.message,
33
+ traceId: (_data$error5 = data.error) === null || _data$error5 === void 0 ? void 0 : _data$error5.traceId
34
+ };
27
35
  if (!data.timeout) {
28
36
  if (data.error && Math.random() < data.errorRate) {
29
- return Promise.reject({
30
- reason: data.error
31
- });
37
+ return Promise.reject(errorResponse);
32
38
  }
33
39
  return Promise.resolve(data.team);
34
40
  }
35
41
  return new Promise(function (resolve, reject) {
36
42
  setTimeout(function () {
37
43
  if (data.error && Math.random() < data.errorRate) {
38
- reject({
39
- reason: data.error
40
- });
44
+ reject(errorResponse);
41
45
  }
42
46
  return resolve(data.team);
43
47
  }, data.timeout);
@@ -44,7 +44,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
44
44
  actionSubjectId: actionSubjectId,
45
45
  attributes: _objectSpread(_objectSpread({
46
46
  packageName: "@atlaskit/profilecard",
47
- packageVersion: "19.1.1"
47
+ packageVersion: "19.2.1"
48
48
  }, attributes), {}, {
49
49
  firedAt: Math.round((0, _performance.getPageTime)())
50
50
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.1.1"
3
+ "version": "19.2.1"
4
4
  }
@@ -12,6 +12,7 @@ export const getErrorAttributes = error => {
12
12
  errorMessage: error === null || error === void 0 ? void 0 : error.message,
13
13
  errorStatus: error === null || error === void 0 ? void 0 : error.code,
14
14
  errorReason: (error === null || error === void 0 ? void 0 : error.reason) || 'default',
15
+ errorSource: error === null || error === void 0 ? void 0 : error.source,
15
16
  isSLOFailure: !isIgnoredError(error),
16
17
  traceId: (_error$traceId = error === null || error === void 0 ? void 0 : error.traceId) !== null && _error$traceId !== void 0 ? _error$traceId : undefined
17
18
  };
@@ -35,7 +35,7 @@ export function graphqlQuery(serviceUrl, query, processHeaders = id) {
35
35
  return Promise.reject({
36
36
  reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || ((_json$errors$2 = json.errors[0]) === null || _json$errors$2 === void 0 ? void 0 : (_json$errors$2$extens = _json$errors$2.extensions) === null || _json$errors$2$extens === void 0 ? void 0 : _json$errors$2$extens.classification) || 'default',
37
37
  code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode,
38
- errorSource: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
38
+ source: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
39
39
  message: json.errors[0].message,
40
40
  traceId: (_json$extensions = json.extensions) === null || _json$extensions === void 0 ? void 0 : (_json$extensions$gate = _json$extensions.gateway) === null || _json$extensions$gate === void 0 ? void 0 : _json$extensions$gate.request_id
41
41
  });
@@ -65,6 +65,12 @@ class ProfilecardTrigger extends React.PureComponent {
65
65
  this.fireAnalytics(cardTriggered('user', 'hover'));
66
66
  }
67
67
  });
68
+ _defineProperty(this, "onFocus", () => {
69
+ this.showProfilecard();
70
+ if (!this.state.visible) {
71
+ this.fireAnalytics(cardTriggered('user', 'hover'));
72
+ }
73
+ });
68
74
  _defineProperty(this, "onKeyPress", event => {
69
75
  if (event.key === 'Enter' || event.key === ' ') {
70
76
  event.preventDefault();
@@ -76,7 +82,9 @@ class ProfilecardTrigger extends React.PureComponent {
76
82
  });
77
83
  _defineProperty(this, "containerListeners", this.props.trigger === 'hover' ? {
78
84
  onMouseEnter: this.onMouseEnter,
79
- onMouseLeave: this.hideProfilecard
85
+ onMouseLeave: this.hideProfilecard,
86
+ onFocus: this.onFocus,
87
+ onBlur: this.hideProfilecard
80
88
  } : {
81
89
  onClick: this.onClick,
82
90
  onKeyPress: this.onKeyPress
@@ -210,7 +218,8 @@ class ProfilecardTrigger extends React.PureComponent {
210
218
  };
211
219
  const wrapperProps = this.props.trigger === 'hover' ? {
212
220
  onMouseEnter: this.onMouseEnter,
213
- onMouseLeave: this.hideProfilecard
221
+ onMouseLeave: this.hideProfilecard,
222
+ onFocus: this.onFocus
214
223
  } : {};
215
224
  return /*#__PURE__*/React.createElement("div", wrapperProps, this.state.visible && /*#__PURE__*/React.createElement(Suspense, {
216
225
  fallback: null
@@ -235,8 +244,8 @@ class ProfilecardTrigger extends React.PureComponent {
235
244
  return /*#__PURE__*/React.createElement("span", _extends({}, innerProps, this.containerListeners, {
236
245
  ref: ref,
237
246
  "data-testid": this.props.testId,
238
- tabIndex: 0,
239
- role: this.props.trigger !== 'hover' ? 'button' : ''
247
+ role: this.props.trigger !== 'hover' ? 'button' : '',
248
+ tabIndex: 0
240
249
  }), this.props.children);
241
250
  },
242
251
  zIndex: layers.modal(),
@@ -2,20 +2,24 @@ import TeamProfileCardClient from '../client/TeamProfileCardClient';
2
2
  export default function getMockTeamClient(data) {
3
3
  return class MockTeamClient extends TeamProfileCardClient {
4
4
  makeRequest(teamId) {
5
+ var _data$error, _data$error2, _data$error3, _data$error4, _data$error5;
6
+ const errorResponse = {
7
+ reason: (_data$error = data.error) === null || _data$error === void 0 ? void 0 : _data$error.reason,
8
+ code: (_data$error2 = data.error) === null || _data$error2 === void 0 ? void 0 : _data$error2.code,
9
+ source: (_data$error3 = data.error) === null || _data$error3 === void 0 ? void 0 : _data$error3.source,
10
+ message: (_data$error4 = data.error) === null || _data$error4 === void 0 ? void 0 : _data$error4.message,
11
+ traceId: (_data$error5 = data.error) === null || _data$error5 === void 0 ? void 0 : _data$error5.traceId
12
+ };
5
13
  if (!data.timeout) {
6
14
  if (data.error && Math.random() < data.errorRate) {
7
- return Promise.reject({
8
- reason: data.error
9
- });
15
+ return Promise.reject(errorResponse);
10
16
  }
11
17
  return Promise.resolve(data.team);
12
18
  }
13
19
  return new Promise((resolve, reject) => {
14
20
  setTimeout(() => {
15
21
  if (data.error && Math.random() < data.errorRate) {
16
- reject({
17
- reason: data.error
18
- });
22
+ reject(errorResponse);
19
23
  }
20
24
  return resolve(data.team);
21
25
  }, data.timeout);
@@ -31,7 +31,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
31
31
  actionSubjectId,
32
32
  attributes: {
33
33
  packageName: "@atlaskit/profilecard",
34
- packageVersion: "19.1.1",
34
+ packageVersion: "19.2.1",
35
35
  ...attributes,
36
36
  firedAt: Math.round(getPageTime())
37
37
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.1.1"
3
+ "version": "19.2.1"
4
4
  }
@@ -12,6 +12,7 @@ export var getErrorAttributes = function getErrorAttributes(error) {
12
12
  errorMessage: error === null || error === void 0 ? void 0 : error.message,
13
13
  errorStatus: error === null || error === void 0 ? void 0 : error.code,
14
14
  errorReason: (error === null || error === void 0 ? void 0 : error.reason) || 'default',
15
+ errorSource: error === null || error === void 0 ? void 0 : error.source,
15
16
  isSLOFailure: !isIgnoredError(error),
16
17
  traceId: (_error$traceId = error === null || error === void 0 ? void 0 : error.traceId) !== null && _error$traceId !== void 0 ? _error$traceId : undefined
17
18
  };
@@ -40,7 +40,7 @@ export function graphqlQuery(serviceUrl, query) {
40
40
  return Promise.reject({
41
41
  reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || ((_json$errors$2 = json.errors[0]) === null || _json$errors$2 === void 0 ? void 0 : (_json$errors$2$extens = _json$errors$2.extensions) === null || _json$errors$2$extens === void 0 ? void 0 : _json$errors$2$extens.classification) || 'default',
42
42
  code: (_json$errors$3 = json.errors[0]) === null || _json$errors$3 === void 0 ? void 0 : (_json$errors$3$extens = _json$errors$3.extensions) === null || _json$errors$3$extens === void 0 ? void 0 : _json$errors$3$extens.statusCode,
43
- errorSource: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
43
+ source: (_json$errors$4 = json.errors[0]) === null || _json$errors$4 === void 0 ? void 0 : (_json$errors$4$extens = _json$errors$4.extensions) === null || _json$errors$4$extens === void 0 ? void 0 : _json$errors$4$extens.errorSource,
44
44
  message: json.errors[0].message,
45
45
  traceId: (_json$extensions = json.extensions) === null || _json$extensions === void 0 ? void 0 : (_json$extensions$gate = _json$extensions.gateway) === null || _json$extensions$gate === void 0 ? void 0 : _json$extensions$gate.request_id
46
46
  });
@@ -85,6 +85,12 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
85
85
  _this.fireAnalytics(cardTriggered('user', 'hover'));
86
86
  }
87
87
  });
88
+ _defineProperty(_assertThisInitialized(_this), "onFocus", function () {
89
+ _this.showProfilecard();
90
+ if (!_this.state.visible) {
91
+ _this.fireAnalytics(cardTriggered('user', 'hover'));
92
+ }
93
+ });
88
94
  _defineProperty(_assertThisInitialized(_this), "onKeyPress", function (event) {
89
95
  if (event.key === 'Enter' || event.key === ' ') {
90
96
  event.preventDefault();
@@ -96,7 +102,9 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
96
102
  });
97
103
  _defineProperty(_assertThisInitialized(_this), "containerListeners", _this.props.trigger === 'hover' ? {
98
104
  onMouseEnter: _this.onMouseEnter,
99
- onMouseLeave: _this.hideProfilecard
105
+ onMouseLeave: _this.hideProfilecard,
106
+ onFocus: _this.onFocus,
107
+ onBlur: _this.hideProfilecard
100
108
  } : {
101
109
  onClick: _this.onClick,
102
110
  onKeyPress: _this.onKeyPress
@@ -244,7 +252,8 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
244
252
  });
245
253
  var wrapperProps = this.props.trigger === 'hover' ? {
246
254
  onMouseEnter: this.onMouseEnter,
247
- onMouseLeave: this.hideProfilecard
255
+ onMouseLeave: this.hideProfilecard,
256
+ onFocus: this.onFocus
248
257
  } : {};
249
258
  return /*#__PURE__*/React.createElement("div", wrapperProps, this.state.visible && /*#__PURE__*/React.createElement(Suspense, {
250
259
  fallback: null
@@ -270,8 +279,8 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
270
279
  return /*#__PURE__*/React.createElement("span", _extends({}, innerProps, _this3.containerListeners, {
271
280
  ref: ref,
272
281
  "data-testid": _this3.props.testId,
273
- tabIndex: 0,
274
- role: _this3.props.trigger !== 'hover' ? 'button' : ''
282
+ role: _this3.props.trigger !== 'hover' ? 'button' : '',
283
+ tabIndex: 0
275
284
  }), _this3.props.children);
276
285
  },
277
286
  zIndex: layers.modal(),
@@ -17,20 +17,24 @@ export default function getMockTeamClient(data) {
17
17
  _createClass(MockTeamClient, [{
18
18
  key: "makeRequest",
19
19
  value: function makeRequest(teamId) {
20
+ var _data$error, _data$error2, _data$error3, _data$error4, _data$error5;
21
+ var errorResponse = {
22
+ reason: (_data$error = data.error) === null || _data$error === void 0 ? void 0 : _data$error.reason,
23
+ code: (_data$error2 = data.error) === null || _data$error2 === void 0 ? void 0 : _data$error2.code,
24
+ source: (_data$error3 = data.error) === null || _data$error3 === void 0 ? void 0 : _data$error3.source,
25
+ message: (_data$error4 = data.error) === null || _data$error4 === void 0 ? void 0 : _data$error4.message,
26
+ traceId: (_data$error5 = data.error) === null || _data$error5 === void 0 ? void 0 : _data$error5.traceId
27
+ };
20
28
  if (!data.timeout) {
21
29
  if (data.error && Math.random() < data.errorRate) {
22
- return Promise.reject({
23
- reason: data.error
24
- });
30
+ return Promise.reject(errorResponse);
25
31
  }
26
32
  return Promise.resolve(data.team);
27
33
  }
28
34
  return new Promise(function (resolve, reject) {
29
35
  setTimeout(function () {
30
36
  if (data.error && Math.random() < data.errorRate) {
31
- reject({
32
- reason: data.error
33
- });
37
+ reject(errorResponse);
34
38
  }
35
39
  return resolve(data.team);
36
40
  }, data.timeout);
@@ -38,7 +38,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
38
38
  actionSubjectId: actionSubjectId,
39
39
  attributes: _objectSpread(_objectSpread({
40
40
  packageName: "@atlaskit/profilecard",
41
- packageVersion: "19.1.1"
41
+ packageVersion: "19.2.1"
42
42
  }, attributes), {}, {
43
43
  firedAt: Math.round(getPageTime())
44
44
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.1.1"
3
+ "version": "19.2.1"
4
4
  }
@@ -3,6 +3,7 @@ export declare const getErrorAttributes: (error?: GraphQLError | undefined) => {
3
3
  errorMessage: string | undefined;
4
4
  errorStatus: number | undefined;
5
5
  errorReason: string;
6
+ errorSource: string | undefined;
6
7
  isSLOFailure: boolean;
7
8
  traceId: string | undefined;
8
9
  };
@@ -5,7 +5,7 @@ interface Query {
5
5
  export interface GraphQLError {
6
6
  code?: number;
7
7
  reason?: string;
8
- errorSource?: string;
8
+ source?: string;
9
9
  message?: string;
10
10
  traceId?: string;
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.1.1",
3
+ "version": "19.2.1",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/menu": "^1.5.0",
53
53
  "@atlaskit/popup": "^1.5.0",
54
54
  "@atlaskit/spinner": "^15.4.0",
55
- "@atlaskit/theme": "^12.2.0",
55
+ "@atlaskit/theme": "^12.3.0",
56
56
  "@atlaskit/tokens": "^1.2.0",
57
57
  "@babel/runtime": "^7.0.0",
58
58
  "@emotion/react": "^11.7.1",