@atlaskit/reactions 21.3.2 → 21.4.0
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 +23 -0
- package/dist/cjs/analytics/constants.js +9 -0
- package/dist/cjs/analytics/ufo.js +10 -2
- package/dist/cjs/components/Counter.js +1 -0
- package/dist/cjs/components/ReactionPicker.js +13 -2
- package/dist/cjs/components/ReactionTooltip.js +3 -14
- package/dist/cjs/components/Reactions.js +3 -3
- package/dist/cjs/components/UfoErrorBoundary.js +13 -3
- package/dist/cjs/containers/ConnectedReactionsView.js +15 -7
- package/dist/cjs/store/ReactionsStore.js +52 -10
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/constants.js +2 -0
- package/dist/es2019/analytics/ufo.js +3 -1
- package/dist/es2019/components/Counter.js +2 -1
- package/dist/es2019/components/ReactionPicker.js +13 -2
- package/dist/es2019/components/ReactionTooltip.js +2 -6
- package/dist/es2019/components/Reactions.js +3 -3
- package/dist/es2019/components/UfoErrorBoundary.js +13 -3
- package/dist/es2019/containers/ConnectedReactionsView.js +15 -9
- package/dist/es2019/store/ReactionsStore.js +48 -10
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/constants.js +2 -0
- package/dist/esm/analytics/ufo.js +5 -1
- package/dist/esm/components/Counter.js +2 -1
- package/dist/esm/components/ReactionPicker.js +13 -2
- package/dist/esm/components/ReactionTooltip.js +2 -7
- package/dist/esm/components/Reactions.js +3 -3
- package/dist/esm/components/UfoErrorBoundary.js +13 -3
- package/dist/esm/containers/ConnectedReactionsView.js +15 -7
- package/dist/esm/store/ReactionsStore.js +50 -10
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/constants.d.ts +1 -0
- package/dist/types/analytics/ufo.d.ts +1 -0
- package/dist/types/components/ReactionTooltip.d.ts +1 -0
- package/dist/types/components/UfoErrorBoundary.d.ts +4 -3
- package/dist/types/store/ReactionsStore.d.ts +2 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/reactions
|
|
2
2
|
|
|
3
|
+
## 21.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`34155ee7563`](https://bitbucket.org/atlassian/atlassian-frontend/commits/34155ee7563) - add sampling for 2 ufo experiences to reduce volume of analytics
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 21.3.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`c3f9e9bce1c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c3f9e9bce1c) - Add custom information to failure and abort events for UFO experiences
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 21.3.3
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`7f1dd280229`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f1dd280229) - Fix styling issue in the reaction emoji while hovering on it for the first time
|
|
25
|
+
|
|
3
26
|
## 21.3.2
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SAMPLING_RATE_REACTIONS_RENDERED_EXP = void 0;
|
|
7
|
+
// This rate is used in fetching emoji resource
|
|
8
|
+
var SAMPLING_RATE_REACTIONS_RENDERED_EXP = 0.02;
|
|
9
|
+
exports.SAMPLING_RATE_REACTIONS_RENDERED_EXP = SAMPLING_RATE_REACTIONS_RENDERED_EXP;
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ReactionsRendered = exports.ReactionsRemove = exports.ReactionsAdd = exports.ReactionDetailsFetch = exports.PickerRender = exports.ExperienceName = exports.ComponentName = void 0;
|
|
6
|
+
exports.sampledReactionsRendered = exports.ReactionsRendered = exports.ReactionsRemove = exports.ReactionsAdd = exports.ReactionDetailsFetch = exports.PickerRender = exports.ExperienceName = exports.ComponentName = void 0;
|
|
7
7
|
|
|
8
8
|
var _ufo = require("@atlaskit/ufo");
|
|
9
9
|
|
|
10
|
+
var _emoji = require("@atlaskit/emoji");
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* Helper method for create the config type for an individual/Concurrent experience
|
|
12
14
|
* @param componentName
|
|
@@ -78,4 +80,10 @@ var ReactionDetailsFetch = new _ufo.ConcurrentExperience(ExperienceName.REACTION
|
|
|
78
80
|
|
|
79
81
|
exports.ReactionDetailsFetch = ReactionDetailsFetch;
|
|
80
82
|
var ReactionsRemove = new _ufo.ConcurrentExperience(ExperienceName.REACTION_REMOVED, createExperienceConfig(ComponentName.REACTIONS, _ufo.ExperienceTypes.Experience, _ufo.ExperiencePerformanceTypes.InlineResult));
|
|
81
|
-
exports.ReactionsRemove = ReactionsRemove;
|
|
83
|
+
exports.ReactionsRemove = ReactionsRemove;
|
|
84
|
+
|
|
85
|
+
var sampledReactionsRendered = function sampledReactionsRendered(instanceId) {
|
|
86
|
+
return (0, _emoji.withSampling)(ReactionsRendered.getInstance(instanceId));
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
exports.sampledReactionsRendered = sampledReactionsRendered;
|
|
@@ -26,6 +26,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
28
|
/** @jsx jsx */
|
|
29
|
+
// eslint-disable-next-line @atlaskit/design-system/no-banned-imports
|
|
29
30
|
var counterTestId = 'counter-container';
|
|
30
31
|
exports.counterTestId = counterTestId;
|
|
31
32
|
var countStyle = (0, _core.css)({
|
|
@@ -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
|
}, {
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -11,12 +9,12 @@ exports.ReactionTooltip = void 0;
|
|
|
11
9
|
|
|
12
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
11
|
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
14
|
var _core = require("@emotion/core");
|
|
15
15
|
|
|
16
16
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
17
17
|
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
18
|
var _reactIntlNext = require("react-intl-next");
|
|
21
19
|
|
|
22
20
|
var _tokens = require("@atlaskit/tokens");
|
|
@@ -25,10 +23,6 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
25
23
|
|
|
26
24
|
var _i18n = require("./i18n");
|
|
27
25
|
|
|
28
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
-
|
|
32
26
|
/** @jsx jsx */
|
|
33
27
|
var verticalMargin = 5;
|
|
34
28
|
var tooltipStyle = (0, _core.css)({
|
|
@@ -64,12 +58,7 @@ var ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
64
58
|
var emojiName = _ref.emojiName,
|
|
65
59
|
children = _ref.children,
|
|
66
60
|
users = _ref.reaction.users;
|
|
67
|
-
|
|
68
|
-
if (!users || users.length === 0) {
|
|
69
|
-
return (0, _core.jsx)(_react.Fragment, null, _react.default.Children.only(children));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var content = (0, _core.jsx)("div", {
|
|
61
|
+
var content = !users || users.length === 0 ? null : (0, _core.jsx)("div", {
|
|
73
62
|
css: tooltipStyle
|
|
74
63
|
}, (0, _core.jsx)("ul", null, emojiName ? (0, _core.jsx)("li", {
|
|
75
64
|
css: emojiNameStyle
|
|
@@ -50,7 +50,7 @@ var reactionStyle = (0, _core.css)({
|
|
|
50
50
|
// top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
|
|
51
51
|
margin: '2px 4px 0 4px'
|
|
52
52
|
});
|
|
53
|
-
var
|
|
53
|
+
var wrapperStyle = (0, _core.css)({
|
|
54
54
|
display: 'flex',
|
|
55
55
|
flexWrap: 'wrap',
|
|
56
56
|
position: 'relative',
|
|
@@ -58,7 +58,7 @@ var reactionsStyle = (0, _core.css)({
|
|
|
58
58
|
borderRadius: '15px',
|
|
59
59
|
// To allow to row spacing of 2px on wrap, and 0px on first row
|
|
60
60
|
marginTop: '-2px',
|
|
61
|
-
'
|
|
61
|
+
'> :first-of-type > :first-child': {
|
|
62
62
|
marginLeft: 0
|
|
63
63
|
}
|
|
64
64
|
});
|
|
@@ -177,7 +177,7 @@ var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
177
177
|
key: "render",
|
|
178
178
|
value: function render() {
|
|
179
179
|
return (0, _core.jsx)("div", {
|
|
180
|
-
css:
|
|
180
|
+
css: wrapperStyle
|
|
181
181
|
}, this.props.reactions.map(this.renderReaction), this.renderPicker());
|
|
182
182
|
}
|
|
183
183
|
}]);
|
|
@@ -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
|
|
51
|
-
|
|
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,9 +34,10 @@ 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
|
-
experienceInstance.current = _ReactionsStore.ufoExperiences.render
|
|
40
|
+
experienceInstance.current = _ReactionsStore.ufoExperiences.render(ari);
|
|
40
41
|
}, [ari]);
|
|
41
42
|
(0, _react.useEffect)(function () {
|
|
42
43
|
Promise.resolve(store).then(function (_store) {
|
|
@@ -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,
|
|
@@ -23,6 +23,10 @@ var _batched = require("./batched");
|
|
|
23
23
|
|
|
24
24
|
var utils = _interopRequireWildcard(require("./utils"));
|
|
25
25
|
|
|
26
|
+
var _constants = require("../analytics/constants");
|
|
27
|
+
|
|
28
|
+
var _ufo = require("../analytics/ufo");
|
|
29
|
+
|
|
26
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
31
|
|
|
28
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -46,9 +50,11 @@ var ufoExperiences = {
|
|
|
46
50
|
remove: Analytics.UFO.ReactionsRemove,
|
|
47
51
|
|
|
48
52
|
/**
|
|
49
|
-
* Experience when the list of reactions gets rendered
|
|
53
|
+
* Experience when the list of reactions gets rendered with sampling
|
|
50
54
|
*/
|
|
51
|
-
render:
|
|
55
|
+
render: function render(instanceId) {
|
|
56
|
+
return (0, _ufo.sampledReactionsRendered)(instanceId);
|
|
57
|
+
},
|
|
52
58
|
|
|
53
59
|
/**
|
|
54
60
|
* Experience when a reaction details gets fetched
|
|
@@ -166,7 +172,15 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
166
172
|
|
|
167
173
|
exp.failure({
|
|
168
174
|
metadata: {
|
|
169
|
-
error: error
|
|
175
|
+
error: error,
|
|
176
|
+
source: 'Reaction-Store',
|
|
177
|
+
data: {
|
|
178
|
+
containerAri: containerAri,
|
|
179
|
+
ari: ari,
|
|
180
|
+
emojiId: emojiId,
|
|
181
|
+
metadata: _this.metadata
|
|
182
|
+
},
|
|
183
|
+
reason: 'addReaction fetch failed'
|
|
170
184
|
}
|
|
171
185
|
});
|
|
172
186
|
}
|
|
@@ -191,7 +205,15 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
191
205
|
// ufo add reaction failure
|
|
192
206
|
exp.failure({
|
|
193
207
|
metadata: {
|
|
194
|
-
error: error
|
|
208
|
+
error: error,
|
|
209
|
+
source: 'Reaction-Store',
|
|
210
|
+
data: {
|
|
211
|
+
containerAri: containerAri,
|
|
212
|
+
ari: ari,
|
|
213
|
+
emojiId: emojiId,
|
|
214
|
+
metadata: _this.metadata
|
|
215
|
+
},
|
|
216
|
+
reason: 'deleteReaction fetch failed'
|
|
195
217
|
}
|
|
196
218
|
});
|
|
197
219
|
});
|
|
@@ -204,11 +226,14 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
204
226
|
* TODO:
|
|
205
227
|
* 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
228
|
*/
|
|
207
|
-
var
|
|
229
|
+
var sampledExp = ufoExperiences.render(containerAri);
|
|
230
|
+
var arisArr = aris.reduce(utils.flattenAris); // ufo start reaction experience
|
|
208
231
|
|
|
209
|
-
|
|
232
|
+
sampledExp.start({
|
|
233
|
+
samplingRate: _constants.SAMPLING_RATE_REACTIONS_RENDERED_EXP
|
|
234
|
+
});
|
|
210
235
|
|
|
211
|
-
_this.client.getReactions(containerAri,
|
|
236
|
+
_this.client.getReactions(containerAri, arisArr).then(function (value) {
|
|
212
237
|
Object.keys(value).map(function (ari) {
|
|
213
238
|
var reactionsState = _this.getReactionsState(containerAri, ari);
|
|
214
239
|
|
|
@@ -221,14 +246,24 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
221
246
|
Analytics.createAndFireSafe(_this.createAnalyticsEvent, Analytics.createRestSucceededEvent, 'getReactions');
|
|
222
247
|
}
|
|
223
248
|
|
|
224
|
-
|
|
249
|
+
sampledExp.success();
|
|
225
250
|
}).catch(function (error) {
|
|
226
251
|
if ((0, utils.isRealErrorFromService)(error.code)) {
|
|
227
252
|
if (_this.createAnalyticsEvent) {
|
|
228
253
|
Analytics.createAndFireSafe(_this.createAnalyticsEvent, Analytics.createRestFailedEvent, 'getReactions', error.code);
|
|
229
254
|
}
|
|
230
255
|
|
|
231
|
-
|
|
256
|
+
sampledExp.failure({
|
|
257
|
+
metadata: {
|
|
258
|
+
error: error,
|
|
259
|
+
source: 'Reaction-Store',
|
|
260
|
+
data: {
|
|
261
|
+
containerAri: containerAri,
|
|
262
|
+
aris: arisArr.join(',')
|
|
263
|
+
},
|
|
264
|
+
reason: 'getReactions fetch failed'
|
|
265
|
+
}
|
|
266
|
+
});
|
|
232
267
|
return Promise.reject(error);
|
|
233
268
|
}
|
|
234
269
|
});
|
|
@@ -248,7 +283,14 @@ var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
248
283
|
// ufo get reaction details failure
|
|
249
284
|
exp.failure({
|
|
250
285
|
metadata: {
|
|
251
|
-
error: error
|
|
286
|
+
error: error,
|
|
287
|
+
source: 'Reaction-Store',
|
|
288
|
+
data: {
|
|
289
|
+
containerAri: containerAri,
|
|
290
|
+
ari: ari,
|
|
291
|
+
emojiId: emojiId
|
|
292
|
+
},
|
|
293
|
+
reason: 'getDetailedReaction fetch failed'
|
|
252
294
|
}
|
|
253
295
|
});
|
|
254
296
|
});
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConcurrentExperience, UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
|
|
2
|
+
import { withSampling } from '@atlaskit/emoji';
|
|
2
3
|
/**
|
|
3
4
|
* Initial experience config object (deferred from @atlaskit/ufo inner types)
|
|
4
5
|
* TODO: Check if possible to add this to exported types from @atlaskit/ufo
|
|
@@ -66,4 +67,5 @@ export const ReactionDetailsFetch = new ConcurrentExperience(ExperienceName.REAC
|
|
|
66
67
|
* Experience when a reaction emoji gets removed/decrement
|
|
67
68
|
*/
|
|
68
69
|
|
|
69
|
-
export const ReactionsRemove = new ConcurrentExperience(ExperienceName.REACTION_REMOVED, createExperienceConfig(ComponentName.REACTIONS, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
|
|
70
|
+
export const ReactionsRemove = new ConcurrentExperience(ExperienceName.REACTION_REMOVED, createExperienceConfig(ComponentName.REACTIONS, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
|
|
71
|
+
export const sampledReactionsRendered = instanceId => withSampling(ReactionsRendered.getInstance(instanceId));
|
|
@@ -3,7 +3,8 @@ import { jsx, css } from '@emotion/core';
|
|
|
3
3
|
import { N500, B400 } from '@atlaskit/theme/colors';
|
|
4
4
|
import { token } from '@atlaskit/tokens';
|
|
5
5
|
import React, { memo } from 'react';
|
|
6
|
-
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
|
|
6
|
+
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion'; // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
|
|
7
|
+
|
|
7
8
|
import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
|
|
8
9
|
export const counterTestId = 'counter-container';
|
|
9
10
|
export const countStyle = css({
|
|
@@ -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,9 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
+
import React from 'react';
|
|
4
5
|
import { jsx, css } from '@emotion/core';
|
|
5
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
|
-
import React, { Fragment } from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import { token } from '@atlaskit/tokens';
|
|
9
9
|
import { N90 } from '@atlaskit/theme/colors';
|
|
@@ -44,11 +44,7 @@ export const ReactionTooltip = ({
|
|
|
44
44
|
users
|
|
45
45
|
}
|
|
46
46
|
}) => {
|
|
47
|
-
|
|
48
|
-
return jsx(Fragment, null, React.Children.only(children));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const content = jsx("div", {
|
|
47
|
+
const content = !users || users.length === 0 ? null : jsx("div", {
|
|
52
48
|
css: tooltipStyle
|
|
53
49
|
}, jsx("ul", null, emojiName ? jsx("li", {
|
|
54
50
|
css: emojiNameStyle
|
|
@@ -16,7 +16,7 @@ const reactionStyle = css({
|
|
|
16
16
|
// top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
|
|
17
17
|
margin: '2px 4px 0 4px'
|
|
18
18
|
});
|
|
19
|
-
const
|
|
19
|
+
const wrapperStyle = css({
|
|
20
20
|
display: 'flex',
|
|
21
21
|
flexWrap: 'wrap',
|
|
22
22
|
position: 'relative',
|
|
@@ -24,7 +24,7 @@ const reactionsStyle = css({
|
|
|
24
24
|
borderRadius: '15px',
|
|
25
25
|
// To allow to row spacing of 2px on wrap, and 0px on first row
|
|
26
26
|
marginTop: '-2px',
|
|
27
|
-
'
|
|
27
|
+
'> :first-of-type > :first-child': {
|
|
28
28
|
marginLeft: 0
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -134,7 +134,7 @@ export class ReactionsWithoutAnalytics extends React.PureComponent {
|
|
|
134
134
|
|
|
135
135
|
render() {
|
|
136
136
|
return jsx("div", {
|
|
137
|
-
css:
|
|
137
|
+
css: wrapperStyle
|
|
138
138
|
}, this.props.reactions.map(this.renderReaction), this.renderPicker());
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export class UfoErrorBoundary extends React.Component {
|
|
3
|
-
componentDidCatch() {
|
|
4
|
-
for (const
|
|
5
|
-
|
|
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,10 +13,11 @@ 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
|
-
experienceInstance.current = ufoExperiences.render
|
|
20
|
+
experienceInstance.current = ufoExperiences.render(ari);
|
|
20
21
|
}, [ari]);
|
|
21
22
|
useEffect(() => {
|
|
22
23
|
Promise.resolve(store).then(_store => {
|
|
@@ -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,
|
|
@@ -4,6 +4,8 @@ import * as Types from '../types';
|
|
|
4
4
|
import { batch, batchByKey } from './batched';
|
|
5
5
|
import * as utils from './utils';
|
|
6
6
|
import { isRealErrorFromService } from './utils';
|
|
7
|
+
import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../analytics/constants';
|
|
8
|
+
import { sampledReactionsRendered } from '../analytics/ufo';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Set of all available UFO experiences relating to reaction element
|
|
@@ -20,9 +22,9 @@ export const ufoExperiences = {
|
|
|
20
22
|
remove: Analytics.UFO.ReactionsRemove,
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
|
-
* Experience when the list of reactions gets rendered
|
|
25
|
+
* Experience when the list of reactions gets rendered with sampling
|
|
24
26
|
*/
|
|
25
|
-
render:
|
|
27
|
+
render: instanceId => sampledReactionsRendered(instanceId),
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* Experience when a reaction details gets fetched
|
|
@@ -131,7 +133,15 @@ export class MemoryReactionsStore {
|
|
|
131
133
|
|
|
132
134
|
exp.failure({
|
|
133
135
|
metadata: {
|
|
134
|
-
error
|
|
136
|
+
error,
|
|
137
|
+
source: 'Reaction-Store',
|
|
138
|
+
data: {
|
|
139
|
+
containerAri,
|
|
140
|
+
ari,
|
|
141
|
+
emojiId,
|
|
142
|
+
metadata: this.metadata
|
|
143
|
+
},
|
|
144
|
+
reason: 'addReaction fetch failed'
|
|
135
145
|
}
|
|
136
146
|
});
|
|
137
147
|
}
|
|
@@ -157,7 +167,15 @@ export class MemoryReactionsStore {
|
|
|
157
167
|
// ufo add reaction failure
|
|
158
168
|
exp.failure({
|
|
159
169
|
metadata: {
|
|
160
|
-
error
|
|
170
|
+
error,
|
|
171
|
+
source: 'Reaction-Store',
|
|
172
|
+
data: {
|
|
173
|
+
containerAri,
|
|
174
|
+
ari,
|
|
175
|
+
emojiId,
|
|
176
|
+
metadata: this.metadata
|
|
177
|
+
},
|
|
178
|
+
reason: 'deleteReaction fetch failed'
|
|
161
179
|
}
|
|
162
180
|
});
|
|
163
181
|
});
|
|
@@ -172,10 +190,13 @@ export class MemoryReactionsStore {
|
|
|
172
190
|
* TODO:
|
|
173
191
|
* 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
192
|
*/
|
|
175
|
-
const
|
|
193
|
+
const sampledExp = ufoExperiences.render(containerAri);
|
|
194
|
+
const arisArr = aris.reduce(utils.flattenAris); // ufo start reaction experience
|
|
176
195
|
|
|
177
|
-
|
|
178
|
-
|
|
196
|
+
sampledExp.start({
|
|
197
|
+
samplingRate: SAMPLING_RATE_REACTIONS_RENDERED_EXP
|
|
198
|
+
});
|
|
199
|
+
this.client.getReactions(containerAri, arisArr).then(value => {
|
|
179
200
|
Object.keys(value).map(ari => {
|
|
180
201
|
const reactionsState = this.getReactionsState(containerAri, ari);
|
|
181
202
|
const reactions = reactionsState && reactionsState.status === Types.ReactionStatus.ready ? reactionsState.reactions : undefined;
|
|
@@ -186,14 +207,24 @@ export class MemoryReactionsStore {
|
|
|
186
207
|
Analytics.createAndFireSafe(this.createAnalyticsEvent, Analytics.createRestSucceededEvent, 'getReactions');
|
|
187
208
|
}
|
|
188
209
|
|
|
189
|
-
|
|
210
|
+
sampledExp.success();
|
|
190
211
|
}).catch(error => {
|
|
191
212
|
if (isRealErrorFromService(error.code)) {
|
|
192
213
|
if (this.createAnalyticsEvent) {
|
|
193
214
|
Analytics.createAndFireSafe(this.createAnalyticsEvent, Analytics.createRestFailedEvent, 'getReactions', error.code);
|
|
194
215
|
}
|
|
195
216
|
|
|
196
|
-
|
|
217
|
+
sampledExp.failure({
|
|
218
|
+
metadata: {
|
|
219
|
+
error,
|
|
220
|
+
source: 'Reaction-Store',
|
|
221
|
+
data: {
|
|
222
|
+
containerAri,
|
|
223
|
+
aris: arisArr.join(',')
|
|
224
|
+
},
|
|
225
|
+
reason: 'getReactions fetch failed'
|
|
226
|
+
}
|
|
227
|
+
});
|
|
197
228
|
return Promise.reject(error);
|
|
198
229
|
}
|
|
199
230
|
});
|
|
@@ -214,7 +245,14 @@ export class MemoryReactionsStore {
|
|
|
214
245
|
// ufo get reaction details failure
|
|
215
246
|
exp.failure({
|
|
216
247
|
metadata: {
|
|
217
|
-
error
|
|
248
|
+
error,
|
|
249
|
+
source: 'Reaction-Store',
|
|
250
|
+
data: {
|
|
251
|
+
containerAri,
|
|
252
|
+
ari,
|
|
253
|
+
emojiId
|
|
254
|
+
},
|
|
255
|
+
reason: 'getDetailedReaction fetch failed'
|
|
218
256
|
}
|
|
219
257
|
});
|
|
220
258
|
});
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConcurrentExperience, UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
|
|
2
|
+
import { withSampling } from '@atlaskit/emoji';
|
|
2
3
|
/**
|
|
3
4
|
* Initial experience config object (deferred from @atlaskit/ufo inner types)
|
|
4
5
|
* TODO: Check if possible to add this to exported types from @atlaskit/ufo
|
|
@@ -66,4 +67,7 @@ export var ReactionDetailsFetch = new ConcurrentExperience(ExperienceName.REACTI
|
|
|
66
67
|
* Experience when a reaction emoji gets removed/decrement
|
|
67
68
|
*/
|
|
68
69
|
|
|
69
|
-
export var ReactionsRemove = new ConcurrentExperience(ExperienceName.REACTION_REMOVED, createExperienceConfig(ComponentName.REACTIONS, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
|
|
70
|
+
export var ReactionsRemove = new ConcurrentExperience(ExperienceName.REACTION_REMOVED, createExperienceConfig(ComponentName.REACTIONS, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
|
|
71
|
+
export var sampledReactionsRendered = function sampledReactionsRendered(instanceId) {
|
|
72
|
+
return withSampling(ReactionsRendered.getInstance(instanceId));
|
|
73
|
+
};
|
|
@@ -3,7 +3,8 @@ import { jsx, css } from '@emotion/core';
|
|
|
3
3
|
import { N500, B400 } from '@atlaskit/theme/colors';
|
|
4
4
|
import { token } from '@atlaskit/tokens';
|
|
5
5
|
import React, { memo } from 'react';
|
|
6
|
-
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
|
|
6
|
+
import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion'; // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
|
|
7
|
+
|
|
7
8
|
import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
|
|
8
9
|
export var counterTestId = 'counter-container';
|
|
9
10
|
export var countStyle = css({
|
|
@@ -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
|
}, {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
+
import React from 'react';
|
|
4
5
|
import { jsx, css } from '@emotion/core';
|
|
5
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
|
-
import React, { Fragment } from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import { token } from '@atlaskit/tokens';
|
|
9
9
|
import { N90 } from '@atlaskit/theme/colors';
|
|
@@ -41,12 +41,7 @@ export var ReactionTooltip = function ReactionTooltip(_ref) {
|
|
|
41
41
|
var emojiName = _ref.emojiName,
|
|
42
42
|
children = _ref.children,
|
|
43
43
|
users = _ref.reaction.users;
|
|
44
|
-
|
|
45
|
-
if (!users || users.length === 0) {
|
|
46
|
-
return jsx(Fragment, null, React.Children.only(children));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
var content = jsx("div", {
|
|
44
|
+
var content = !users || users.length === 0 ? null : jsx("div", {
|
|
50
45
|
css: tooltipStyle
|
|
51
46
|
}, jsx("ul", null, emojiName ? jsx("li", {
|
|
52
47
|
css: emojiNameStyle
|
|
@@ -26,7 +26,7 @@ var reactionStyle = css({
|
|
|
26
26
|
// top margin of 2px to allow spacing between rows when wrapped (paired with top margin in reactionsStyle)
|
|
27
27
|
margin: '2px 4px 0 4px'
|
|
28
28
|
});
|
|
29
|
-
var
|
|
29
|
+
var wrapperStyle = css({
|
|
30
30
|
display: 'flex',
|
|
31
31
|
flexWrap: 'wrap',
|
|
32
32
|
position: 'relative',
|
|
@@ -34,7 +34,7 @@ var reactionsStyle = css({
|
|
|
34
34
|
borderRadius: '15px',
|
|
35
35
|
// To allow to row spacing of 2px on wrap, and 0px on first row
|
|
36
36
|
marginTop: '-2px',
|
|
37
|
-
'
|
|
37
|
+
'> :first-of-type > :first-child': {
|
|
38
38
|
marginLeft: 0
|
|
39
39
|
}
|
|
40
40
|
});
|
|
@@ -162,7 +162,7 @@ export var ReactionsWithoutAnalytics = /*#__PURE__*/function (_React$PureCompone
|
|
|
162
162
|
key: "render",
|
|
163
163
|
value: function render() {
|
|
164
164
|
return jsx("div", {
|
|
165
|
-
css:
|
|
165
|
+
css: wrapperStyle
|
|
166
166
|
}, this.props.reactions.map(this.renderReaction), this.renderPicker());
|
|
167
167
|
}
|
|
168
168
|
}]);
|
|
@@ -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
|
|
38
|
-
|
|
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,9 +12,10 @@ 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
|
-
experienceInstance.current = ufoExperiences.render
|
|
18
|
+
experienceInstance.current = ufoExperiences.render(ari);
|
|
18
19
|
}, [ari]);
|
|
19
20
|
useEffect(function () {
|
|
20
21
|
Promise.resolve(store).then(function (_store) {
|
|
@@ -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,
|
|
@@ -11,6 +11,8 @@ import * as Types from '../types';
|
|
|
11
11
|
import { batch, batchByKey } from './batched';
|
|
12
12
|
import * as utils from './utils';
|
|
13
13
|
import { isRealErrorFromService } from './utils';
|
|
14
|
+
import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../analytics/constants';
|
|
15
|
+
import { sampledReactionsRendered } from '../analytics/ufo';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Set of all available UFO experiences relating to reaction element
|
|
@@ -27,9 +29,11 @@ export var ufoExperiences = {
|
|
|
27
29
|
remove: Analytics.UFO.ReactionsRemove,
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
|
-
* Experience when the list of reactions gets rendered
|
|
32
|
+
* Experience when the list of reactions gets rendered with sampling
|
|
31
33
|
*/
|
|
32
|
-
render:
|
|
34
|
+
render: function render(instanceId) {
|
|
35
|
+
return sampledReactionsRendered(instanceId);
|
|
36
|
+
},
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
39
|
* Experience when a reaction details gets fetched
|
|
@@ -154,7 +158,15 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
154
158
|
|
|
155
159
|
exp.failure({
|
|
156
160
|
metadata: {
|
|
157
|
-
error: error
|
|
161
|
+
error: error,
|
|
162
|
+
source: 'Reaction-Store',
|
|
163
|
+
data: {
|
|
164
|
+
containerAri: containerAri,
|
|
165
|
+
ari: ari,
|
|
166
|
+
emojiId: emojiId,
|
|
167
|
+
metadata: _this.metadata
|
|
168
|
+
},
|
|
169
|
+
reason: 'addReaction fetch failed'
|
|
158
170
|
}
|
|
159
171
|
});
|
|
160
172
|
}
|
|
@@ -180,7 +192,15 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
180
192
|
// ufo add reaction failure
|
|
181
193
|
exp.failure({
|
|
182
194
|
metadata: {
|
|
183
|
-
error: error
|
|
195
|
+
error: error,
|
|
196
|
+
source: 'Reaction-Store',
|
|
197
|
+
data: {
|
|
198
|
+
containerAri: containerAri,
|
|
199
|
+
ari: ari,
|
|
200
|
+
emojiId: emojiId,
|
|
201
|
+
metadata: _this.metadata
|
|
202
|
+
},
|
|
203
|
+
reason: 'deleteReaction fetch failed'
|
|
184
204
|
}
|
|
185
205
|
});
|
|
186
206
|
});
|
|
@@ -195,11 +215,14 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
195
215
|
* TODO:
|
|
196
216
|
* 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
217
|
*/
|
|
198
|
-
var
|
|
218
|
+
var sampledExp = ufoExperiences.render(containerAri);
|
|
219
|
+
var arisArr = aris.reduce(utils.flattenAris); // ufo start reaction experience
|
|
199
220
|
|
|
200
|
-
|
|
221
|
+
sampledExp.start({
|
|
222
|
+
samplingRate: SAMPLING_RATE_REACTIONS_RENDERED_EXP
|
|
223
|
+
});
|
|
201
224
|
|
|
202
|
-
_this.client.getReactions(containerAri,
|
|
225
|
+
_this.client.getReactions(containerAri, arisArr).then(function (value) {
|
|
203
226
|
Object.keys(value).map(function (ari) {
|
|
204
227
|
var reactionsState = _this.getReactionsState(containerAri, ari);
|
|
205
228
|
|
|
@@ -212,14 +235,24 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
212
235
|
Analytics.createAndFireSafe(_this.createAnalyticsEvent, Analytics.createRestSucceededEvent, 'getReactions');
|
|
213
236
|
}
|
|
214
237
|
|
|
215
|
-
|
|
238
|
+
sampledExp.success();
|
|
216
239
|
}).catch(function (error) {
|
|
217
240
|
if (isRealErrorFromService(error.code)) {
|
|
218
241
|
if (_this.createAnalyticsEvent) {
|
|
219
242
|
Analytics.createAndFireSafe(_this.createAnalyticsEvent, Analytics.createRestFailedEvent, 'getReactions', error.code);
|
|
220
243
|
}
|
|
221
244
|
|
|
222
|
-
|
|
245
|
+
sampledExp.failure({
|
|
246
|
+
metadata: {
|
|
247
|
+
error: error,
|
|
248
|
+
source: 'Reaction-Store',
|
|
249
|
+
data: {
|
|
250
|
+
containerAri: containerAri,
|
|
251
|
+
aris: arisArr.join(',')
|
|
252
|
+
},
|
|
253
|
+
reason: 'getReactions fetch failed'
|
|
254
|
+
}
|
|
255
|
+
});
|
|
223
256
|
return Promise.reject(error);
|
|
224
257
|
}
|
|
225
258
|
});
|
|
@@ -242,7 +275,14 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
|
|
|
242
275
|
// ufo get reaction details failure
|
|
243
276
|
exp.failure({
|
|
244
277
|
metadata: {
|
|
245
|
-
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'
|
|
246
286
|
}
|
|
247
287
|
});
|
|
248
288
|
});
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SAMPLING_RATE_REACTIONS_RENDERED_EXP = 0.02;
|
|
@@ -37,3 +37,4 @@ export declare const ReactionDetailsFetch: ConcurrentExperience;
|
|
|
37
37
|
* Experience when a reaction emoji gets removed/decrement
|
|
38
38
|
*/
|
|
39
39
|
export declare const ReactionsRemove: ConcurrentExperience;
|
|
40
|
+
export declare const sampledReactionsRendered: (instanceId: string) => import("@atlaskit/emoji").WithSamplingUFOExperience;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ErrorInfo } from 'react';
|
|
2
2
|
import { UFOExperience } from '@atlaskit/ufo';
|
|
3
|
+
import { WithSamplingUFOExperience } from '@atlaskit/emoji';
|
|
3
4
|
export declare class UfoErrorBoundary extends React.Component<{
|
|
4
|
-
experiences: UFOExperience[];
|
|
5
|
+
experiences: UFOExperience[] | WithSamplingUFOExperience[];
|
|
5
6
|
}> {
|
|
6
|
-
componentDidCatch(): void;
|
|
7
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
7
8
|
render(): React.ReactNode;
|
|
8
9
|
}
|
|
@@ -29,9 +29,9 @@ export declare const ufoExperiences: {
|
|
|
29
29
|
*/
|
|
30
30
|
remove: import("@atlaskit/ufo").ConcurrentExperience;
|
|
31
31
|
/**
|
|
32
|
-
* Experience when the list of reactions gets rendered
|
|
32
|
+
* Experience when the list of reactions gets rendered with sampling
|
|
33
33
|
*/
|
|
34
|
-
render: import("@atlaskit/
|
|
34
|
+
render: (instanceId: string) => import("@atlaskit/emoji").WithSamplingUFOExperience;
|
|
35
35
|
/**
|
|
36
36
|
* Experience when a reaction details gets fetched
|
|
37
37
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/reactions",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.4.0",
|
|
4
4
|
"description": "Reactions component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/analytics-gas-types": "^5.0.0",
|
|
29
|
-
"@atlaskit/analytics-namespaced-context": "^6.
|
|
29
|
+
"@atlaskit/analytics-namespaced-context": "^6.5.0",
|
|
30
30
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
31
31
|
"@atlaskit/button": "^16.3.0",
|
|
32
|
-
"@atlaskit/ds-lib": "^
|
|
33
|
-
"@atlaskit/emoji": "^
|
|
32
|
+
"@atlaskit/ds-lib": "^2.0.0",
|
|
33
|
+
"@atlaskit/emoji": "^65.0.0",
|
|
34
34
|
"@atlaskit/icon": "^21.10.0",
|
|
35
|
-
"@atlaskit/motion": "^1.
|
|
35
|
+
"@atlaskit/motion": "^1.2.0",
|
|
36
36
|
"@atlaskit/popper": "^5.0.0",
|
|
37
37
|
"@atlaskit/theme": "^12.1.0",
|
|
38
38
|
"@atlaskit/tokens": "^0.10.0",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@atlaskit/analytics-viewer": "^0.4.5",
|
|
52
52
|
"@atlaskit/docs": "^9.0.0",
|
|
53
|
-
"@atlaskit/editor-test-helpers": "^17.
|
|
53
|
+
"@atlaskit/editor-test-helpers": "^17.1.0",
|
|
54
54
|
"@atlaskit/elements-test-helpers": "^0.7.0",
|
|
55
55
|
"@atlaskit/tooltip": "^17.5.0",
|
|
56
|
-
"@atlaskit/util-data-test": "^17.
|
|
56
|
+
"@atlaskit/util-data-test": "^17.4.0",
|
|
57
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
58
58
|
"@atlassian/ufo": "^0.1.0",
|
|
59
59
|
"@types/webpack-dev-server": "^3.11.2",
|