@atlaskit/reactions 22.2.0 → 22.2.2

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.
Files changed (163) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/MockReactionsClient.js +1 -49
  3. package/dist/cjs/analytics/analytics.js +1 -40
  4. package/dist/cjs/analytics/index.js +0 -7
  5. package/dist/cjs/analytics/ufo.js +8 -20
  6. package/dist/cjs/client/ReactionServiceClient.js +2 -16
  7. package/dist/cjs/client/index.js +0 -1
  8. package/dist/cjs/components/Counter/Counter.js +10 -24
  9. package/dist/cjs/components/Counter/index.js +0 -6
  10. package/dist/cjs/components/Counter/styles.js +1 -3
  11. package/dist/cjs/components/EmojiButton/EmojiButton.js +3 -18
  12. package/dist/cjs/components/EmojiButton/index.js +0 -1
  13. package/dist/cjs/components/EmojiButton/styles.js +1 -2
  14. package/dist/cjs/components/FlashAnimation/FlashAnimation.js +1 -11
  15. package/dist/cjs/components/FlashAnimation/index.js +0 -1
  16. package/dist/cjs/components/FlashAnimation/styles.js +1 -3
  17. package/dist/cjs/components/Reaction/Reaction.js +23 -62
  18. package/dist/cjs/components/Reaction/index.js +0 -1
  19. package/dist/cjs/components/Reaction/styles.js +1 -4
  20. package/dist/cjs/components/ReactionDialog/ReactionView.js +6 -29
  21. package/dist/cjs/components/ReactionDialog/ReactionsDialog.js +19 -48
  22. package/dist/cjs/components/ReactionDialog/ReactionsList.js +18 -34
  23. package/dist/cjs/components/ReactionDialog/index.js +0 -1
  24. package/dist/cjs/components/ReactionDialog/styles.js +3 -13
  25. package/dist/cjs/components/ReactionPicker/ReactionPicker.js +41 -71
  26. package/dist/cjs/components/ReactionPicker/index.js +0 -1
  27. package/dist/cjs/components/ReactionPicker/styles.js +1 -4
  28. package/dist/cjs/components/ReactionTooltip/ReactionTooltip.js +13 -28
  29. package/dist/cjs/components/ReactionTooltip/index.js +0 -1
  30. package/dist/cjs/components/ReactionTooltip/styles.js +1 -3
  31. package/dist/cjs/components/Reactions/Reactions.js +48 -86
  32. package/dist/cjs/components/Reactions/index.js +0 -1
  33. package/dist/cjs/components/Reactions/styles.js +1 -2
  34. package/dist/cjs/components/Selector/Selector.js +12 -34
  35. package/dist/cjs/components/Selector/index.js +0 -6
  36. package/dist/cjs/components/Selector/styles.js +2 -5
  37. package/dist/cjs/components/ShowMore/ShowMore.js +5 -19
  38. package/dist/cjs/components/ShowMore/index.js +0 -1
  39. package/dist/cjs/components/ShowMore/styles.js +1 -4
  40. package/dist/cjs/components/Trigger/Trigger.js +6 -22
  41. package/dist/cjs/components/Trigger/index.js +0 -1
  42. package/dist/cjs/components/Trigger/styles.js +3 -13
  43. package/dist/cjs/components/UfoErrorBoundary/UfoErrorBoundary.js +1 -19
  44. package/dist/cjs/components/UfoErrorBoundary/index.js +0 -1
  45. package/dist/cjs/components/index.js +0 -5
  46. package/dist/cjs/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +2 -17
  47. package/dist/cjs/containers/ConnectedReactionPicker/index.js +0 -1
  48. package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +17 -62
  49. package/dist/cjs/containers/ConnectedReactionsView/index.js +0 -1
  50. package/dist/cjs/containers/index.js +0 -4
  51. package/dist/cjs/hooks/index.js +0 -1
  52. package/dist/cjs/hooks/useClickAway.js +2 -5
  53. package/dist/cjs/i18n/cs.js +0 -1
  54. package/dist/cjs/i18n/da.js +0 -1
  55. package/dist/cjs/i18n/de.js +0 -1
  56. package/dist/cjs/i18n/en.js +0 -1
  57. package/dist/cjs/i18n/en_GB.js +0 -1
  58. package/dist/cjs/i18n/en_ZZ.js +0 -1
  59. package/dist/cjs/i18n/es.js +0 -1
  60. package/dist/cjs/i18n/et.js +0 -1
  61. package/dist/cjs/i18n/fi.js +0 -1
  62. package/dist/cjs/i18n/fr.js +0 -1
  63. package/dist/cjs/i18n/hu.js +0 -1
  64. package/dist/cjs/i18n/index.js +0 -30
  65. package/dist/cjs/i18n/it.js +0 -1
  66. package/dist/cjs/i18n/ja.js +0 -1
  67. package/dist/cjs/i18n/ko.js +0 -1
  68. package/dist/cjs/i18n/nb.js +0 -1
  69. package/dist/cjs/i18n/nl.js +0 -1
  70. package/dist/cjs/i18n/pl.js +0 -1
  71. package/dist/cjs/i18n/pt_BR.js +0 -1
  72. package/dist/cjs/i18n/pt_PT.js +0 -1
  73. package/dist/cjs/i18n/ru.js +0 -1
  74. package/dist/cjs/i18n/sk.js +0 -1
  75. package/dist/cjs/i18n/sv.js +0 -1
  76. package/dist/cjs/i18n/th.js +0 -1
  77. package/dist/cjs/i18n/tr.js +0 -1
  78. package/dist/cjs/i18n/uk.js +0 -1
  79. package/dist/cjs/i18n/vi.js +0 -1
  80. package/dist/cjs/i18n/zh.js +0 -1
  81. package/dist/cjs/i18n/zh_TW.js +0 -1
  82. package/dist/cjs/index.js +0 -6
  83. package/dist/cjs/shared/constants.js +5 -6
  84. package/dist/cjs/shared/i18n.js +0 -2
  85. package/dist/cjs/shared/index.js +0 -9
  86. package/dist/cjs/shared/utils.js +6 -25
  87. package/dist/cjs/store/MemoryReactionsStore.js +21 -74
  88. package/dist/cjs/store/ReactionConsumer.js +0 -28
  89. package/dist/cjs/store/batched.js +0 -6
  90. package/dist/cjs/store/index.js +0 -2
  91. package/dist/cjs/store/utils.js +0 -25
  92. package/dist/cjs/types/index.js +0 -1
  93. package/dist/cjs/types/reaction.js +0 -10
  94. package/dist/cjs/version.json +1 -1
  95. package/dist/es2019/MockReactionsClient.js +7 -21
  96. package/dist/es2019/analytics/analytics.js +3 -9
  97. package/dist/es2019/analytics/ufo.js +11 -13
  98. package/dist/es2019/client/ReactionServiceClient.js +4 -13
  99. package/dist/es2019/components/Counter/Counter.js +5 -7
  100. package/dist/es2019/components/EmojiButton/EmojiButton.js +0 -3
  101. package/dist/es2019/components/FlashAnimation/FlashAnimation.js +1 -2
  102. package/dist/es2019/components/Reaction/Reaction.js +3 -12
  103. package/dist/es2019/components/Reaction/styles.js +1 -1
  104. package/dist/es2019/components/ReactionDialog/ReactionView.js +0 -4
  105. package/dist/es2019/components/ReactionDialog/ReactionsDialog.js +6 -15
  106. package/dist/es2019/components/ReactionDialog/ReactionsList.js +4 -3
  107. package/dist/es2019/components/ReactionDialog/styles.js +2 -5
  108. package/dist/es2019/components/ReactionPicker/ReactionPicker.js +14 -19
  109. package/dist/es2019/components/ReactionTooltip/ReactionTooltip.js +1 -2
  110. package/dist/es2019/components/Reactions/Reactions.js +16 -25
  111. package/dist/es2019/components/Selector/Selector.js +5 -11
  112. package/dist/es2019/components/Selector/styles.js +1 -1
  113. package/dist/es2019/components/ShowMore/ShowMore.js +1 -2
  114. package/dist/es2019/components/Trigger/Trigger.js +1 -5
  115. package/dist/es2019/components/UfoErrorBoundary/UfoErrorBoundary.js +0 -3
  116. package/dist/es2019/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +0 -4
  117. package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +8 -20
  118. package/dist/es2019/hooks/useClickAway.js +3 -4
  119. package/dist/es2019/index.js +2 -1
  120. package/dist/es2019/shared/constants.js +5 -5
  121. package/dist/es2019/shared/utils.js +7 -15
  122. package/dist/es2019/store/MemoryReactionsStore.js +36 -61
  123. package/dist/es2019/store/ReactionConsumer.js +1 -12
  124. package/dist/es2019/store/batched.js +0 -2
  125. package/dist/es2019/store/utils.js +4 -8
  126. package/dist/es2019/types/reaction.js +1 -1
  127. package/dist/es2019/version.json +1 -1
  128. package/dist/esm/MockReactionsClient.js +1 -42
  129. package/dist/esm/analytics/analytics.js +1 -12
  130. package/dist/esm/analytics/ufo.js +11 -13
  131. package/dist/esm/client/ReactionServiceClient.js +2 -14
  132. package/dist/esm/components/Counter/Counter.js +12 -15
  133. package/dist/esm/components/EmojiButton/EmojiButton.js +2 -6
  134. package/dist/esm/components/FlashAnimation/FlashAnimation.js +1 -2
  135. package/dist/esm/components/Reaction/Reaction.js +23 -40
  136. package/dist/esm/components/Reaction/styles.js +1 -1
  137. package/dist/esm/components/ReactionDialog/ReactionView.js +5 -14
  138. package/dist/esm/components/ReactionDialog/ReactionsDialog.js +20 -35
  139. package/dist/esm/components/ReactionDialog/ReactionsList.js +17 -20
  140. package/dist/esm/components/ReactionDialog/styles.js +2 -5
  141. package/dist/esm/components/ReactionPicker/ReactionPicker.js +42 -52
  142. package/dist/esm/components/ReactionTooltip/ReactionTooltip.js +14 -16
  143. package/dist/esm/components/Reactions/Reactions.js +49 -62
  144. package/dist/esm/components/Selector/Selector.js +13 -22
  145. package/dist/esm/components/Selector/styles.js +1 -1
  146. package/dist/esm/components/ShowMore/ShowMore.js +6 -7
  147. package/dist/esm/components/Trigger/Trigger.js +7 -11
  148. package/dist/esm/components/Trigger/styles.js +3 -6
  149. package/dist/esm/components/UfoErrorBoundary/UfoErrorBoundary.js +1 -14
  150. package/dist/esm/containers/ConnectedReactionPicker/ConnectedReactionPicker.js +2 -9
  151. package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +17 -43
  152. package/dist/esm/hooks/useClickAway.js +3 -4
  153. package/dist/esm/index.js +2 -1
  154. package/dist/esm/shared/constants.js +5 -5
  155. package/dist/esm/shared/utils.js +7 -17
  156. package/dist/esm/store/MemoryReactionsStore.js +22 -78
  157. package/dist/esm/store/ReactionConsumer.js +0 -23
  158. package/dist/esm/store/batched.js +0 -4
  159. package/dist/esm/store/utils.js +0 -9
  160. package/dist/esm/types/reaction.js +1 -1
  161. package/dist/esm/version.json +1 -1
  162. package/dist/types/components/ReactionDialog/styles.d.ts +1 -2
  163. package/package.json +6 -4
@@ -3,11 +3,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
-
7
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
-
9
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
-
11
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
12
9
  import { constants } from './shared';
13
10
  export var containerAri = 'ari:cloud:owner:demo-cloud-id:container/1';
@@ -31,59 +28,47 @@ export var getUser = function getUser(id, displayName) {
31
28
  }
32
29
  };
33
30
  };
34
-
35
31
  var getReactionKey = function getReactionKey(containerAri, ari) {
36
32
  return "".concat(containerAri, "|").concat(ari);
37
33
  };
38
-
39
34
  var defaultUsers = [getUser('oscar', 'Oscar Wallhult'), getUser('julien', 'Julien Michel Hoarau'), getUser('craig', 'Craig Petchell'), getUser('jerome', 'Jerome Touffe-Blin'), getUser('esoares', 'Eduardo Soares'), getUser('lpereira', 'Luiz Pereira'), getUser('pcurren', 'Paul Curren'), getUser('ttjandra', 'Tara Tjandra'), getUser('severington', 'Ste Everington'), getUser('sguillope', 'Sylvain Guillope'), getUser('alunnon', 'Alex Lunnon'), getUser('bsmith', 'Bob Smith'), getUser('jdoe', 'Jane Doe'), getUser('mhomes', 'Mary Homes'), getUser('ckent', 'Clark Kent')];
40
35
  export var simpleMockData = _defineProperty({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true), getReactionSummary(':thumbsup:', 999, false), getReactionSummary(':astonished:', 9, false), getReactionSummary(':heart:', 99, false)]);
41
-
42
36
  var extendedMockData = _defineProperty({}, getReactionKey(containerAri, ari), [getReactionSummary(':fire:', 1, true, true), getReactionSummary(':thumbsup:', 999, false, true), getReactionSummary(':astonished:', 9, false, true), getReactionSummary(':heart:', 99, false, true), getReactionSummary(':thinking:', 10, false, true), getReactionSummary(':clap:', 99, false, true), getReactionSummary(':thumbsdown:', 2, false, true), getReactionSummary(':bulb:', 16, false, true), getReactionSummary(':star:', 9999, false, true), getReactionSummary(':green_heart:', 9, false, true), getReactionSummary(':blue_heart:', 8392, false, true), getReactionSummary(':broken_heart:', 1, false, true), getReactionSummary(':grinning:', 10601, false, true), getReactionSummary(':slight_smile:', 99, false, true)]);
37
+
43
38
  /**
44
39
  * Mocked version of the client to fetch user information
45
40
  */
46
-
47
-
48
41
  export var MockReactionsClient = /*#__PURE__*/function () {
49
42
  function MockReactionsClient() {
50
43
  var _this = this;
51
-
52
44
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
53
45
  var showExtendedReactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
54
-
55
46
  _classCallCheck(this, MockReactionsClient);
56
-
57
47
  _defineProperty(this, "delayPromise", function () {
58
48
  return new Promise(function (resolve) {
59
49
  return window.setTimeout(resolve, _this.delay);
60
50
  });
61
51
  });
62
-
63
52
  this.delay = delay;
64
53
  this.mockData = showExtendedReactions ? extendedMockData : simpleMockData;
65
54
  }
66
-
67
55
  _createClass(MockReactionsClient, [{
68
56
  key: "getReactions",
69
57
  value: function () {
70
58
  var _getReactions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(containerAri, aris) {
71
59
  var _this2 = this;
72
-
73
60
  return _regeneratorRuntime.wrap(function _callee$(_context) {
74
61
  while (1) {
75
62
  switch (_context.prev = _context.next) {
76
63
  case 0:
77
64
  _context.next = 2;
78
65
  return this.delayPromise();
79
-
80
66
  case 2:
81
67
  return _context.abrupt("return", aris.reduce(function (results, ari) {
82
68
  var reactionKey = getReactionKey(containerAri, ari);
83
69
  results[ari] = _this2.mockData[reactionKey] || [];
84
70
  return results;
85
71
  }, {}));
86
-
87
72
  case 3:
88
73
  case "end":
89
74
  return _context.stop();
@@ -91,11 +76,9 @@ export var MockReactionsClient = /*#__PURE__*/function () {
91
76
  }
92
77
  }, _callee, this);
93
78
  }));
94
-
95
79
  function getReactions(_x, _x2) {
96
80
  return _getReactions.apply(this, arguments);
97
81
  }
98
-
99
82
  return getReactions;
100
83
  }()
101
84
  }, {
@@ -109,30 +92,24 @@ export var MockReactionsClient = /*#__PURE__*/function () {
109
92
  case 0:
110
93
  _context2.next = 2;
111
94
  return this.delayPromise();
112
-
113
95
  case 2:
114
96
  reactionKey = "".concat(containerAri, "|").concat(ari);
115
97
  reactionsMockData = this.mockData[reactionKey];
116
-
117
98
  if (!reactionsMockData) {
118
99
  _context2.next = 9;
119
100
  break;
120
101
  }
121
-
122
102
  reaction = reactionsMockData.find(function (reaction_1) {
123
103
  return reaction_1.emojiId === emojiId;
124
104
  });
125
-
126
105
  if (!reaction) {
127
106
  _context2.next = 9;
128
107
  break;
129
108
  }
130
-
131
109
  users = [].concat(defaultUsers).slice(Math.floor(Math.random() * 4), Math.floor(Math.random() * 9) + 4).slice(0, reaction.count);
132
110
  return _context2.abrupt("return", _objectSpread(_objectSpread({}, reaction), {}, {
133
111
  users: users
134
112
  }));
135
-
136
113
  case 9:
137
114
  return _context2.abrupt("return", {
138
115
  containerAri: containerAri,
@@ -142,7 +119,6 @@ export var MockReactionsClient = /*#__PURE__*/function () {
142
119
  reacted: true,
143
120
  users: []
144
121
  });
145
-
146
122
  case 10:
147
123
  case "end":
148
124
  return _context2.stop();
@@ -150,11 +126,9 @@ export var MockReactionsClient = /*#__PURE__*/function () {
150
126
  }
151
127
  }, _callee2, this);
152
128
  }));
153
-
154
129
  function getDetailedReaction(_x3, _x4, _x5) {
155
130
  return _getDetailedReaction.apply(this, arguments);
156
131
  }
157
-
158
132
  return getDetailedReaction;
159
133
  }()
160
134
  }, {
@@ -168,12 +142,10 @@ export var MockReactionsClient = /*#__PURE__*/function () {
168
142
  case 0:
169
143
  _context3.next = 2;
170
144
  return this.delayPromise();
171
-
172
145
  case 2:
173
146
  reactionKey = getReactionKey(containerAri, ari);
174
147
  found = false;
175
148
  reactionsMockData = this.mockData[reactionKey];
176
-
177
149
  if (reactionsMockData) {
178
150
  this.mockData[reactionKey] = reactionsMockData.map(function (reaction) {
179
151
  if (reaction.emojiId === emojiId) {
@@ -183,11 +155,9 @@ export var MockReactionsClient = /*#__PURE__*/function () {
183
155
  reacted: true
184
156
  });
185
157
  }
186
-
187
158
  return reaction;
188
159
  });
189
160
  }
190
-
191
161
  if (!found) {
192
162
  this.mockData[reactionKey] = [].concat(_toConsumableArray(reactionsMockData ? reactionsMockData : []), [{
193
163
  containerAri: containerAri,
@@ -197,9 +167,7 @@ export var MockReactionsClient = /*#__PURE__*/function () {
197
167
  reacted: true
198
168
  }]);
199
169
  }
200
-
201
170
  return _context3.abrupt("return", this.mockData[reactionKey]);
202
-
203
171
  case 8:
204
172
  case "end":
205
173
  return _context3.stop();
@@ -207,11 +175,9 @@ export var MockReactionsClient = /*#__PURE__*/function () {
207
175
  }
208
176
  }, _callee3, this);
209
177
  }));
210
-
211
178
  function addReaction(_x6, _x7, _x8) {
212
179
  return _addReaction.apply(this, arguments);
213
180
  }
214
-
215
181
  return addReaction;
216
182
  }()
217
183
  }, {
@@ -225,7 +191,6 @@ export var MockReactionsClient = /*#__PURE__*/function () {
225
191
  case 0:
226
192
  _context4.next = 2;
227
193
  return this.delayPromise();
228
-
229
194
  case 2:
230
195
  reactionKey = getReactionKey(containerAri, ari);
231
196
  this.mockData[reactionKey] = this.mockData[reactionKey].map(function (reaction) {
@@ -233,19 +198,16 @@ export var MockReactionsClient = /*#__PURE__*/function () {
233
198
  if (reaction.count === 1) {
234
199
  return undefined;
235
200
  }
236
-
237
201
  return _objectSpread(_objectSpread({}, reaction), {}, {
238
202
  count: reaction.count - 1,
239
203
  reacted: false
240
204
  });
241
205
  }
242
-
243
206
  return reaction;
244
207
  }).filter(function (reaction_1) {
245
208
  return !!reaction_1;
246
209
  });
247
210
  return _context4.abrupt("return", this.mockData[reactionKey]);
248
-
249
211
  case 5:
250
212
  case "end":
251
213
  return _context4.stop();
@@ -253,14 +215,11 @@ export var MockReactionsClient = /*#__PURE__*/function () {
253
215
  }
254
216
  }, _callee4, this);
255
217
  }));
256
-
257
218
  function deleteReaction(_x9, _x10, _x11) {
258
219
  return _deleteReaction.apply(this, arguments);
259
220
  }
260
-
261
221
  return deleteReaction;
262
222
  }()
263
223
  }]);
264
-
265
224
  return MockReactionsClient;
266
225
  }();
@@ -1,9 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  import { createAndFireEvent } from '@atlaskit/analytics-next';
8
5
  import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
9
6
  import { name as packageName, version as packageVersion } from '../version.json';
@@ -13,11 +10,9 @@ export var createAndFireSafe = function createAndFireSafe(createAnalyticsEvent,
13
10
  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
14
11
  args[_key - 2] = arguments[_key];
15
12
  }
16
-
17
13
  createAndFireEventInElementsChannel(creator.apply(void 0, args))(createAnalyticsEvent);
18
14
  }
19
15
  };
20
-
21
16
  var createPayload = function createPayload(action, actionSubject, eventType, actionSubjectId) {
22
17
  return function () {
23
18
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -33,23 +28,18 @@ var createPayload = function createPayload(action, actionSubject, eventType, act
33
28
  };
34
29
  };
35
30
  };
36
-
37
31
  var calculateDuration = function calculateDuration(startTime) {
38
32
  return startTime ? Date.now() - startTime : undefined;
39
33
  };
40
-
41
34
  var getPreviousState = function getPreviousState(reaction) {
42
35
  if (reaction) {
43
36
  if (reaction.reacted) {
44
37
  return 'existingReacted';
45
38
  }
46
-
47
39
  return 'existingNotReacted';
48
40
  }
49
-
50
41
  return 'new';
51
42
  };
52
-
53
43
  export var createRestSucceededEvent = function createRestSucceededEvent(actionSubject) {
54
44
  return createPayload('succeeded', actionSubject, OPERATIONAL_EVENT_TYPE)();
55
45
  };
@@ -102,12 +92,12 @@ export var createReactionClickedEvent = function createReactionClickedEvent(adde
102
92
  emojiId: emojiId
103
93
  });
104
94
  };
95
+
105
96
  /**
106
97
  * Used for store failure metadata for analytics
107
98
  * @param error The error could be a service error with {code, reason} or an Error
108
99
  * @returns any
109
100
  */
110
-
111
101
  export var extractErrorInfo = function extractErrorInfo(error) {
112
102
  if (error instanceof Error) {
113
103
  return {
@@ -115,6 +105,5 @@ export var extractErrorInfo = function extractErrorInfo(error) {
115
105
  message: error.message
116
106
  };
117
107
  }
118
-
119
108
  return error;
120
109
  };
@@ -1,5 +1,6 @@
1
1
  import { ConcurrentExperience, UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
2
2
  import { withSampling } from '@atlaskit/emoji';
3
+
3
4
  /**
4
5
  * Initial experience config object (deferred from @atlaskit/ufo inner types)
5
6
  */
@@ -17,16 +18,15 @@ var createExperienceConfig = function createExperienceConfig(componentName, type
17
18
  performanceType: performanceType
18
19
  };
19
20
  };
21
+
20
22
  /**
21
23
  * Types of experiences
22
24
  */
23
-
24
-
25
25
  export var ExperienceName;
26
+
26
27
  /**
27
28
  * UFO types of components been instrumented
28
29
  */
29
-
30
30
  (function (ExperienceName) {
31
31
  ExperienceName["REACTIONS_RENDERED"] = "reactions-rendered";
32
32
  ExperienceName["PICKER_OPENED"] = "reactions-picker-opened";
@@ -37,54 +37,52 @@ export var ExperienceName;
37
37
  ExperienceName["REACTION_DIALOG_CLOSED"] = "reaction-dialog-closed";
38
38
  ExperienceName["REACTION_DIALOG_SELECTED_REACTION_CHANGED"] = "reaction-dialog-selected-reaction-changed";
39
39
  })(ExperienceName || (ExperienceName = {}));
40
-
41
40
  export var ComponentName;
41
+
42
42
  /**
43
43
  * Experience when the emoji picker is opened
44
44
  */
45
-
46
45
  (function (ComponentName) {
47
46
  ComponentName["PICKER_RENDERED"] = "reactions-picker";
48
47
  ComponentName["REACTIONS"] = "reactions-list";
49
48
  ComponentName["REACTION_ITEM"] = "reaction-item";
50
49
  ComponentName["REACTION_DIALOG"] = "reaction-dialog";
51
50
  })(ComponentName || (ComponentName = {}));
52
-
53
51
  export var PickerRender = new UFOExperience(ExperienceName.PICKER_OPENED, createExperienceConfig(ComponentName.PICKER_RENDERED, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
52
+
54
53
  /**
55
54
  * Experience when the list of reactions gets rendered
56
55
  */
57
-
58
56
  export var ReactionsRendered = new ConcurrentExperience(ExperienceName.REACTIONS_RENDERED, createExperienceConfig(ComponentName.REACTIONS, ExperienceTypes.Load, ExperiencePerformanceTypes.PageSegmentLoad));
57
+
59
58
  /**
60
59
  * Experience when a reaction emoji gets added
61
60
  */
62
-
63
61
  export var ReactionsAdd = new ConcurrentExperience(ExperienceName.REACTION_ADDED, createExperienceConfig(ComponentName.REACTIONS, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
62
+
64
63
  /**
65
64
  * Expeirence when a reaction dialog is opened
66
65
  */
67
-
68
66
  export var ReactionDialogOpened = new UFOExperience(ExperienceName.REACTION_DIALOG_OPENED, createExperienceConfig(ComponentName.REACTION_DIALOG, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
67
+
69
68
  /**
70
69
  * Experience when a reaction dialog is closed
71
70
  */
72
-
73
71
  export var ReactionDialogClosed = new UFOExperience(ExperienceName.REACTION_DIALOG_CLOSED, createExperienceConfig(ComponentName.REACTION_DIALOG, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
72
+
74
73
  /**
75
74
  * Experience when a reaction changed/fetched from inside the modal dialog
76
75
  */
77
-
78
76
  export var ReactionDialogSelectedReactionChanged = new UFOExperience(ExperienceName.REACTION_DIALOG_SELECTED_REACTION_CHANGED, createExperienceConfig(ComponentName.REACTION_DIALOG, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
77
+
79
78
  /**
80
79
  * Experience when a reaction details gets fetched
81
80
  */
82
-
83
81
  export var ReactionDetailsFetch = new ConcurrentExperience(ExperienceName.REACTION_DETAILS_FETCHED, createExperienceConfig(ComponentName.REACTION_ITEM, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
82
+
84
83
  /**
85
84
  * Experience when a reaction emoji gets removed/decrement
86
85
  */
87
-
88
86
  export var ReactionsRemove = new ConcurrentExperience(ExperienceName.REACTION_REMOVED, createExperienceConfig(ComponentName.REACTIONS, ExperienceTypes.Experience, ExperiencePerformanceTypes.InlineResult));
89
87
  export var sampledReactionsRendered = function sampledReactionsRendered(instanceId) {
90
88
  return withSampling(ReactionsRendered.getInstance(instanceId));
@@ -1,13 +1,9 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
-
5
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
6
  import { utils } from '@atlaskit/util-service-support';
10
-
11
7
  /**
12
8
  * Utility class to retrieve/modify all actions on reactions collection
13
9
  */
@@ -27,52 +23,45 @@ export var ReactionServiceClient = /*#__PURE__*/function () {
27
23
  */
28
24
  function ReactionServiceClient(baseUrl, sessionToken) {
29
25
  var _this = this;
30
-
31
26
  _classCallCheck(this, ReactionServiceClient);
32
-
33
27
  _defineProperty(this, "requestService", function (path, options) {
34
28
  return utils.requestService(_this.serviceConfig, _objectSpread(_objectSpread({}, options), {}, {
35
29
  path: path
36
30
  }));
37
31
  });
38
-
39
32
  this.serviceConfig = {
40
33
  url: baseUrl
41
34
  };
42
35
  this.sessionToken = sessionToken;
43
36
  }
37
+
44
38
  /**
45
39
  * Get http headers for the "fetch" request
46
40
  * @param hasBody
47
41
  */
48
-
49
-
50
42
  _createClass(ReactionServiceClient, [{
51
43
  key: "getHeaders",
52
44
  value: function getHeaders() {
53
45
  var headers = {};
54
46
  headers['Accept'] = 'application/json';
55
47
  headers['Content-Type'] = 'application/json';
56
-
57
48
  if (this.sessionToken) {
58
49
  headers['Authorization'] = this.sessionToken;
59
50
  }
60
-
61
51
  return headers;
62
52
  }
53
+
63
54
  /**
64
55
  * Send a request to remote service
65
56
  * @param path endpoint api url
66
57
  * @param options Optional custom params
67
58
  */
68
-
69
59
  }, {
70
60
  key: "getReactions",
71
61
  value: function getReactions(containerAri, aris) {
72
62
  if (aris.length === 0) {
73
63
  return Promise.resolve({});
74
64
  }
75
-
76
65
  return this.requestService('reactions/view', {
77
66
  requestInit: {
78
67
  method: 'POST',
@@ -143,6 +132,5 @@ export var ReactionServiceClient = /*#__PURE__*/function () {
143
132
  });
144
133
  }
145
134
  }]);
146
-
147
135
  return ReactionServiceClient;
148
136
  }();
@@ -1,40 +1,38 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx, css } from '@emotion/react';
4
- import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion'; // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
5
-
4
+ import { SlideIn, ExitingPersistence, mediumDurationMs } from '@atlaskit/motion';
5
+ // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
6
6
  import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
7
7
  import { utils } from '../../shared';
8
8
  import * as styles from './styles';
9
+
9
10
  /**
10
11
  * Test id for component top level div
11
12
  */
12
-
13
13
  export var RENDER_COMPONENT_WRAPPER = 'counter-wrapper';
14
+
14
15
  /**
15
16
  * Test id for wrapper div of the counter inside the slider
16
17
  */
17
-
18
18
  export var RENDER_COUNTER_TESTID = 'counter-container';
19
+
19
20
  /**
20
21
  * Counter label value wrapper div
21
22
  */
22
-
23
23
  export var RENDER_LABEL_TESTID = 'counter_label_wrapper';
24
-
25
24
  /**
26
25
  * Display reaction count next to the emoji button
27
26
  */
28
27
  export var Counter = function Counter(_ref) {
29
28
  var _ref$highlight = _ref.highlight,
30
- highlight = _ref$highlight === void 0 ? false : _ref$highlight,
31
- limit = _ref.limit,
32
- overLimitLabel = _ref.overLimitLabel,
33
- className = _ref.className,
34
- value = _ref.value,
35
- _ref$animationDuratio = _ref.animationDuration,
36
- animationDuration = _ref$animationDuratio === void 0 ? mediumDurationMs : _ref$animationDuratio;
37
-
29
+ highlight = _ref$highlight === void 0 ? false : _ref$highlight,
30
+ limit = _ref.limit,
31
+ overLimitLabel = _ref.overLimitLabel,
32
+ className = _ref.className,
33
+ value = _ref.value,
34
+ _ref$animationDuratio = _ref.animationDuration,
35
+ animationDuration = _ref$animationDuratio === void 0 ? mediumDurationMs : _ref$animationDuratio;
38
36
  var getLabel = function getLabel(value) {
39
37
  // Check if reached limit
40
38
  if (limit && overLimitLabel && value >= limit) {
@@ -45,7 +43,6 @@ export var Counter = function Counter(_ref) {
45
43
  return utils.formatLargeNumber(value);
46
44
  }
47
45
  };
48
-
49
46
  var previousValue = usePreviousValue(value);
50
47
  var label = getLabel(value);
51
48
  var increase = previousValue ? previousValue < value : false;
@@ -6,23 +6,19 @@ import { ResourcedEmoji } from '@atlaskit/emoji';
6
6
  import { i18n, utils } from '../../shared';
7
7
  import * as styles from './styles';
8
8
  export var RENDER_BUTTON_TESTID = 'button-emoji-id';
9
-
10
9
  /**
11
10
  * custom button to render the custom emoji selector inside the reaction picker
12
11
  */
13
12
  export var EmojiButton = function EmojiButton(_ref) {
14
13
  var emojiId = _ref.emojiId,
15
- onClick = _ref.onClick,
16
- emojiProvider = _ref.emojiProvider;
17
-
14
+ onClick = _ref.onClick,
15
+ emojiProvider = _ref.emojiProvider;
18
16
  var onButtonClick = function onButtonClick(event) {
19
17
  event.preventDefault();
20
-
21
18
  if (onClick && utils.isLeftClick(event)) {
22
19
  onClick(emojiId, undefined, event);
23
20
  }
24
21
  };
25
-
26
22
  var intl = useIntl();
27
23
  return jsx("button", {
28
24
  "data-testid": RENDER_BUTTON_TESTID,
@@ -2,15 +2,14 @@
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import * as styles from './styles';
5
-
6
5
  /**
7
6
  * Test id for wrapper FlashAnimation div
8
7
  */
9
8
  export var RENDER_FLASHANIMATION_TESTID = 'flash-animation';
9
+
10
10
  /**
11
11
  * Flash animation background component. See Reaction component for usage.
12
12
  */
13
-
14
13
  export var FlashAnimation = function FlashAnimation(props) {
15
14
  return jsx("div", {
16
15
  className: props.className,