@atlaskit/reactions 21.3.3 → 21.3.4

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,12 @@
1
1
  # @atlaskit/reactions
2
2
 
3
+ ## 21.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c3f9e9bce1c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c3f9e9bce1c) - Add custom information to failure and abort events for UFO experiences
8
+ - Updated dependencies
9
+
3
10
  ## 21.3.3
4
11
 
5
12
  ### Patch Changes
@@ -189,7 +189,12 @@ var ReactionPicker = /*#__PURE__*/function (_PureComponent) {
189
189
  value: function componentWillUnmount() {
190
190
  document.removeEventListener('click', this.handleClickOutside);
191
191
 
192
- _analytics.UFO.PickerRender.abort();
192
+ _analytics.UFO.PickerRender.abort({
193
+ metadata: {
194
+ source: 'Reaction-Picker',
195
+ reason: 'unmount'
196
+ }
197
+ });
193
198
  }
194
199
  }, {
195
200
  key: "close",
@@ -199,7 +204,13 @@ var ReactionPicker = /*#__PURE__*/function (_PureComponent) {
199
204
  showFullPicker: false
200
205
  }, function () {
201
206
  // ufo abort reaction experience
202
- _analytics.UFO.PickerRender.abort();
207
+ _analytics.UFO.PickerRender.abort({
208
+ metadata: {
209
+ emojiId: _emojiId,
210
+ source: 'Reaction-Picker',
211
+ reason: 'close dialog'
212
+ }
213
+ });
203
214
  });
204
215
  }
205
216
  }, {
@@ -41,14 +41,24 @@ var UfoErrorBoundary = /*#__PURE__*/function (_React$Component) {
41
41
 
42
42
  (0, _createClass2.default)(UfoErrorBoundary, [{
43
43
  key: "componentDidCatch",
44
- value: function componentDidCatch() {
44
+ value: function componentDidCatch(error, errorInfo) {
45
45
  var _iterator = _createForOfIteratorHelper(this.props.experiences),
46
46
  _step;
47
47
 
48
48
  try {
49
49
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
50
- var e = _step.value;
51
- e.failure();
50
+ var exp = _step.value;
51
+ exp.failure({
52
+ metadata: {
53
+ source: 'UfoErrorBoundary',
54
+ reason: 'error',
55
+ error: {
56
+ name: error.name,
57
+ message: error.message,
58
+ infoStack: errorInfo.componentStack
59
+ }
60
+ }
61
+ });
52
62
  }
53
63
  } catch (err) {
54
64
  _iterator.e(err);
@@ -34,7 +34,8 @@ var ReactionsView = function ReactionsView(props) {
34
34
  var experienceInstance = (0, _react.useRef)();
35
35
  var ari = props.ari,
36
36
  createAnalyticsEvent = props.createAnalyticsEvent,
37
- store = props.store;
37
+ store = props.store,
38
+ containerAri = props.containerAri;
38
39
  (0, _react.useEffect)(function () {
39
40
  experienceInstance.current = _ReactionsStore.ufoExperiences.render.getInstance(ari);
40
41
  }, [ari]);
@@ -47,16 +48,23 @@ var ReactionsView = function ReactionsView(props) {
47
48
  }, [createAnalyticsEvent, store]); // abort when component gets unmounted
48
49
 
49
50
  (0, _react.useEffect)(function () {
50
- return function () {
51
+ return function cleanup() {
51
52
  var _experienceInstance$c;
52
53
 
53
- (_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort();
54
+ (_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort({
55
+ metadata: {
56
+ source: 'Connected-Reactions-View',
57
+ data: {
58
+ ari: ari,
59
+ containerAri: containerAri
60
+ },
61
+ reason: 'unmount'
62
+ }
63
+ });
54
64
  };
55
- }, [experienceInstance]);
65
+ }, [experienceInstance, containerAri, ari]);
56
66
 
57
67
  var renderChildren = function renderChildren(innerProps) {
58
- var containerAri = props.containerAri,
59
- ari = props.ari;
60
68
  return /*#__PURE__*/_react.default.createElement(_analyticsNamespacedContext.FabricElementsAnalyticsContext, {
61
69
  data: {
62
70
  containerAri: containerAri,
@@ -166,7 +166,15 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
166
166
 
167
167
  exp.failure({
168
168
  metadata: {
169
- error: error
169
+ error: error,
170
+ source: 'Reaction-Store',
171
+ data: {
172
+ containerAri: containerAri,
173
+ ari: ari,
174
+ emojiId: emojiId,
175
+ metadata: _this.metadata
176
+ },
177
+ reason: 'addReaction fetch failed'
170
178
  }
171
179
  });
172
180
  }
@@ -191,7 +199,15 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
191
199
  // ufo add reaction failure
192
200
  exp.failure({
193
201
  metadata: {
194
- error: error
202
+ error: error,
203
+ source: 'Reaction-Store',
204
+ data: {
205
+ containerAri: containerAri,
206
+ ari: ari,
207
+ emojiId: emojiId,
208
+ metadata: _this.metadata
209
+ },
210
+ reason: 'deleteReaction fetch failed'
195
211
  }
196
212
  });
197
213
  });
@@ -204,11 +220,12 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
204
220
  * TODO:
205
221
  * All reactions are usually fetched in a single call to reactions-service. Need to check why "getReactions" gets called randomly 1-2 times everytime on each fetch request despite using same containerAri.
206
222
  */
207
- var exp = ufoExperiences.render.getInstance(containerAri); // ufo start reaction experience
223
+ var exp = ufoExperiences.render.getInstance(containerAri);
224
+ var arisArr = aris.reduce(utils.flattenAris); // ufo start reaction experience
208
225
 
209
226
  exp.start();
210
227
 
211
- _this.client.getReactions(containerAri, aris.reduce(utils.flattenAris)).then(function (value) {
228
+ _this.client.getReactions(containerAri, arisArr).then(function (value) {
212
229
  Object.keys(value).map(function (ari) {
213
230
  var reactionsState = _this.getReactionsState(containerAri, ari);
214
231
 
@@ -228,7 +245,17 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
228
245
  Analytics.createAndFireSafe(_this.createAnalyticsEvent, Analytics.createRestFailedEvent, 'getReactions', error.code);
229
246
  }
230
247
 
231
- exp.failure();
248
+ exp.failure({
249
+ metadata: {
250
+ error: error,
251
+ source: 'Reaction-Store',
252
+ data: {
253
+ containerAri: containerAri,
254
+ aris: arisArr.join(',')
255
+ },
256
+ reason: 'getReactions fetch failed'
257
+ }
258
+ });
232
259
  return Promise.reject(error);
233
260
  }
234
261
  });
@@ -248,7 +275,14 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
248
275
  // ufo get reaction details failure
249
276
  exp.failure({
250
277
  metadata: {
251
- error: error
278
+ error: error,
279
+ source: 'Reaction-Store',
280
+ data: {
281
+ containerAri: containerAri,
282
+ ari: ari,
283
+ emojiId: emojiId
284
+ },
285
+ reason: 'getDetailedReaction fetch failed'
252
286
  }
253
287
  });
254
288
  });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "21.3.3"
3
+ "version": "21.3.4"
4
4
  }
@@ -143,7 +143,12 @@ export class ReactionPicker extends PureComponent {
143
143
 
144
144
  componentWillUnmount() {
145
145
  document.removeEventListener('click', this.handleClickOutside);
146
- UFO.PickerRender.abort();
146
+ UFO.PickerRender.abort({
147
+ metadata: {
148
+ source: 'Reaction-Picker',
149
+ reason: 'unmount'
150
+ }
151
+ });
147
152
  }
148
153
 
149
154
  close(_emojiId) {
@@ -152,7 +157,13 @@ export class ReactionPicker extends PureComponent {
152
157
  showFullPicker: false
153
158
  }, () => {
154
159
  // ufo abort reaction experience
155
- UFO.PickerRender.abort();
160
+ UFO.PickerRender.abort({
161
+ metadata: {
162
+ emojiId: _emojiId,
163
+ source: 'Reaction-Picker',
164
+ reason: 'close dialog'
165
+ }
166
+ });
156
167
  });
157
168
  }
158
169
 
@@ -1,8 +1,18 @@
1
1
  import React from 'react';
2
2
  export class UfoErrorBoundary extends React.Component {
3
- componentDidCatch() {
4
- for (const e of this.props.experiences) {
5
- e.failure();
3
+ componentDidCatch(error, errorInfo) {
4
+ for (const exp of this.props.experiences) {
5
+ exp.failure({
6
+ metadata: {
7
+ source: 'UfoErrorBoundary',
8
+ reason: 'error',
9
+ error: {
10
+ name: error.name,
11
+ message: error.message,
12
+ infoStack: errorInfo.componentStack
13
+ }
14
+ }
15
+ });
6
16
  }
7
17
  }
8
18
 
@@ -13,7 +13,8 @@ const ReactionsView = props => {
13
13
  const {
14
14
  ari,
15
15
  createAnalyticsEvent,
16
- store
16
+ store,
17
+ containerAri
17
18
  } = props;
18
19
  useEffect(() => {
19
20
  experienceInstance.current = ufoExperiences.render.getInstance(ari);
@@ -27,18 +28,23 @@ const ReactionsView = props => {
27
28
  }, [createAnalyticsEvent, store]); // abort when component gets unmounted
28
29
 
29
30
  useEffect(() => {
30
- return () => {
31
+ return function cleanup() {
31
32
  var _experienceInstance$c;
32
33
 
33
- (_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort();
34
+ (_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort({
35
+ metadata: {
36
+ source: 'Connected-Reactions-View',
37
+ data: {
38
+ ari,
39
+ containerAri
40
+ },
41
+ reason: 'unmount'
42
+ }
43
+ });
34
44
  };
35
- }, [experienceInstance]);
45
+ }, [experienceInstance, containerAri, ari]);
36
46
 
37
47
  const renderChildren = innerProps => {
38
- const {
39
- containerAri,
40
- ari
41
- } = props;
42
48
  return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
43
49
  data: {
44
50
  containerAri,
@@ -131,7 +131,15 @@ export class MemoryReactionsStore {
131
131
 
132
132
  exp.failure({
133
133
  metadata: {
134
- error
134
+ error,
135
+ source: 'Reaction-Store',
136
+ data: {
137
+ containerAri,
138
+ ari,
139
+ emojiId,
140
+ metadata: this.metadata
141
+ },
142
+ reason: 'addReaction fetch failed'
135
143
  }
136
144
  });
137
145
  }
@@ -157,7 +165,15 @@ export class MemoryReactionsStore {
157
165
  // ufo add reaction failure
158
166
  exp.failure({
159
167
  metadata: {
160
- error
168
+ error,
169
+ source: 'Reaction-Store',
170
+ data: {
171
+ containerAri,
172
+ ari,
173
+ emojiId,
174
+ metadata: this.metadata
175
+ },
176
+ reason: 'deleteReaction fetch failed'
161
177
  }
162
178
  });
163
179
  });
@@ -172,10 +188,11 @@ export class MemoryReactionsStore {
172
188
  * TODO:
173
189
  * All reactions are usually fetched in a single call to reactions-service. Need to check why "getReactions" gets called randomly 1-2 times everytime on each fetch request despite using same containerAri.
174
190
  */
175
- const exp = ufoExperiences.render.getInstance(containerAri); // ufo start reaction experience
191
+ const exp = ufoExperiences.render.getInstance(containerAri);
192
+ const arisArr = aris.reduce(utils.flattenAris); // ufo start reaction experience
176
193
 
177
194
  exp.start();
178
- this.client.getReactions(containerAri, aris.reduce(utils.flattenAris)).then(value => {
195
+ this.client.getReactions(containerAri, arisArr).then(value => {
179
196
  Object.keys(value).map(ari => {
180
197
  const reactionsState = this.getReactionsState(containerAri, ari);
181
198
  const reactions = reactionsState && reactionsState.status === Types.ReactionStatus.ready ? reactionsState.reactions : undefined;
@@ -193,7 +210,17 @@ export class MemoryReactionsStore {
193
210
  Analytics.createAndFireSafe(this.createAnalyticsEvent, Analytics.createRestFailedEvent, 'getReactions', error.code);
194
211
  }
195
212
 
196
- exp.failure();
213
+ exp.failure({
214
+ metadata: {
215
+ error,
216
+ source: 'Reaction-Store',
217
+ data: {
218
+ containerAri,
219
+ aris: arisArr.join(',')
220
+ },
221
+ reason: 'getReactions fetch failed'
222
+ }
223
+ });
197
224
  return Promise.reject(error);
198
225
  }
199
226
  });
@@ -214,7 +241,14 @@ export class MemoryReactionsStore {
214
241
  // ufo get reaction details failure
215
242
  exp.failure({
216
243
  metadata: {
217
- error
244
+ error,
245
+ source: 'Reaction-Store',
246
+ data: {
247
+ containerAri,
248
+ ari,
249
+ emojiId
250
+ },
251
+ reason: 'getDetailedReaction fetch failed'
218
252
  }
219
253
  });
220
254
  });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "21.3.3"
3
+ "version": "21.3.4"
4
4
  }
@@ -166,7 +166,12 @@ export var ReactionPicker = /*#__PURE__*/function (_PureComponent) {
166
166
  key: "componentWillUnmount",
167
167
  value: function componentWillUnmount() {
168
168
  document.removeEventListener('click', this.handleClickOutside);
169
- UFO.PickerRender.abort();
169
+ UFO.PickerRender.abort({
170
+ metadata: {
171
+ source: 'Reaction-Picker',
172
+ reason: 'unmount'
173
+ }
174
+ });
170
175
  }
171
176
  }, {
172
177
  key: "close",
@@ -176,7 +181,13 @@ export var ReactionPicker = /*#__PURE__*/function (_PureComponent) {
176
181
  showFullPicker: false
177
182
  }, function () {
178
183
  // ufo abort reaction experience
179
- UFO.PickerRender.abort();
184
+ UFO.PickerRender.abort({
185
+ metadata: {
186
+ emojiId: _emojiId,
187
+ source: 'Reaction-Picker',
188
+ reason: 'close dialog'
189
+ }
190
+ });
180
191
  });
181
192
  }
182
193
  }, {
@@ -28,14 +28,24 @@ export var UfoErrorBoundary = /*#__PURE__*/function (_React$Component) {
28
28
 
29
29
  _createClass(UfoErrorBoundary, [{
30
30
  key: "componentDidCatch",
31
- value: function componentDidCatch() {
31
+ value: function componentDidCatch(error, errorInfo) {
32
32
  var _iterator = _createForOfIteratorHelper(this.props.experiences),
33
33
  _step;
34
34
 
35
35
  try {
36
36
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
37
- var e = _step.value;
38
- e.failure();
37
+ var exp = _step.value;
38
+ exp.failure({
39
+ metadata: {
40
+ source: 'UfoErrorBoundary',
41
+ reason: 'error',
42
+ error: {
43
+ name: error.name,
44
+ message: error.message,
45
+ infoStack: errorInfo.componentStack
46
+ }
47
+ }
48
+ });
39
49
  }
40
50
  } catch (err) {
41
51
  _iterator.e(err);
@@ -12,7 +12,8 @@ var ReactionsView = function ReactionsView(props) {
12
12
  var experienceInstance = useRef();
13
13
  var ari = props.ari,
14
14
  createAnalyticsEvent = props.createAnalyticsEvent,
15
- store = props.store;
15
+ store = props.store,
16
+ containerAri = props.containerAri;
16
17
  useEffect(function () {
17
18
  experienceInstance.current = ufoExperiences.render.getInstance(ari);
18
19
  }, [ari]);
@@ -25,16 +26,23 @@ var ReactionsView = function ReactionsView(props) {
25
26
  }, [createAnalyticsEvent, store]); // abort when component gets unmounted
26
27
 
27
28
  useEffect(function () {
28
- return function () {
29
+ return function cleanup() {
29
30
  var _experienceInstance$c;
30
31
 
31
- (_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort();
32
+ (_experienceInstance$c = experienceInstance.current) === null || _experienceInstance$c === void 0 ? void 0 : _experienceInstance$c.abort({
33
+ metadata: {
34
+ source: 'Connected-Reactions-View',
35
+ data: {
36
+ ari: ari,
37
+ containerAri: containerAri
38
+ },
39
+ reason: 'unmount'
40
+ }
41
+ });
32
42
  };
33
- }, [experienceInstance]);
43
+ }, [experienceInstance, containerAri, ari]);
34
44
 
35
45
  var renderChildren = function renderChildren(innerProps) {
36
- var containerAri = props.containerAri,
37
- ari = props.ari;
38
46
  return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
39
47
  data: {
40
48
  containerAri: containerAri,
@@ -154,7 +154,15 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
154
154
 
155
155
  exp.failure({
156
156
  metadata: {
157
- error: error
157
+ error: error,
158
+ source: 'Reaction-Store',
159
+ data: {
160
+ containerAri: containerAri,
161
+ ari: ari,
162
+ emojiId: emojiId,
163
+ metadata: _this.metadata
164
+ },
165
+ reason: 'addReaction fetch failed'
158
166
  }
159
167
  });
160
168
  }
@@ -180,7 +188,15 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
180
188
  // ufo add reaction failure
181
189
  exp.failure({
182
190
  metadata: {
183
- error: error
191
+ error: error,
192
+ source: 'Reaction-Store',
193
+ data: {
194
+ containerAri: containerAri,
195
+ ari: ari,
196
+ emojiId: emojiId,
197
+ metadata: _this.metadata
198
+ },
199
+ reason: 'deleteReaction fetch failed'
184
200
  }
185
201
  });
186
202
  });
@@ -195,11 +211,12 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
195
211
  * TODO:
196
212
  * All reactions are usually fetched in a single call to reactions-service. Need to check why "getReactions" gets called randomly 1-2 times everytime on each fetch request despite using same containerAri.
197
213
  */
198
- var exp = ufoExperiences.render.getInstance(containerAri); // ufo start reaction experience
214
+ var exp = ufoExperiences.render.getInstance(containerAri);
215
+ var arisArr = aris.reduce(utils.flattenAris); // ufo start reaction experience
199
216
 
200
217
  exp.start();
201
218
 
202
- _this.client.getReactions(containerAri, aris.reduce(utils.flattenAris)).then(function (value) {
219
+ _this.client.getReactions(containerAri, arisArr).then(function (value) {
203
220
  Object.keys(value).map(function (ari) {
204
221
  var reactionsState = _this.getReactionsState(containerAri, ari);
205
222
 
@@ -219,7 +236,17 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
219
236
  Analytics.createAndFireSafe(_this.createAnalyticsEvent, Analytics.createRestFailedEvent, 'getReactions', error.code);
220
237
  }
221
238
 
222
- exp.failure();
239
+ exp.failure({
240
+ metadata: {
241
+ error: error,
242
+ source: 'Reaction-Store',
243
+ data: {
244
+ containerAri: containerAri,
245
+ aris: arisArr.join(',')
246
+ },
247
+ reason: 'getReactions fetch failed'
248
+ }
249
+ });
223
250
  return Promise.reject(error);
224
251
  }
225
252
  });
@@ -242,7 +269,14 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
242
269
  // ufo get reaction details failure
243
270
  exp.failure({
244
271
  metadata: {
245
- error: error
272
+ error: error,
273
+ source: 'Reaction-Store',
274
+ data: {
275
+ containerAri: containerAri,
276
+ ari: ari,
277
+ emojiId: emojiId
278
+ },
279
+ reason: 'getDetailedReaction fetch failed'
246
280
  }
247
281
  });
248
282
  });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "21.3.3"
3
+ "version": "21.3.4"
4
4
  }
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import React, { ErrorInfo } from 'react';
2
2
  import { UFOExperience } from '@atlaskit/ufo';
3
3
  export declare class UfoErrorBoundary extends React.Component<{
4
4
  experiences: UFOExperience[];
5
5
  }> {
6
- componentDidCatch(): void;
6
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
7
7
  render(): React.ReactNode;
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "21.3.3",
3
+ "version": "21.3.4",
4
4
  "description": "Reactions component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/analytics-namespaced-context": "^6.4.0",
30
30
  "@atlaskit/analytics-next": "^8.2.0",
31
31
  "@atlaskit/button": "^16.3.0",
32
- "@atlaskit/ds-lib": "^1.4.0",
32
+ "@atlaskit/ds-lib": "^2.0.0",
33
33
  "@atlaskit/emoji": "^64.7.0",
34
34
  "@atlaskit/icon": "^21.10.0",
35
35
  "@atlaskit/motion": "^1.1.0",