@atlaskit/reactions 22.12.0 → 22.13.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/analytics/index.js +1 -1
  3. package/dist/cjs/containers/ConnectedReactionsView/ConnectedReactionsView.js +16 -4
  4. package/dist/cjs/i18n/en.js +1 -0
  5. package/dist/cjs/i18n/en_GB.js +1 -0
  6. package/dist/cjs/i18n/en_ZZ.js +1 -0
  7. package/dist/cjs/store/MemoryReactionsStore.js +7 -4
  8. package/dist/cjs/types/Actions.js +5 -1
  9. package/dist/cjs/types/Updater.js +5 -1
  10. package/dist/cjs/types/reaction.js +13 -1
  11. package/dist/es2019/analytics/index.js +1 -1
  12. package/dist/es2019/containers/ConnectedReactionsView/ConnectedReactionsView.js +15 -3
  13. package/dist/es2019/i18n/en.js +1 -0
  14. package/dist/es2019/i18n/en_GB.js +1 -0
  15. package/dist/es2019/i18n/en_ZZ.js +1 -0
  16. package/dist/es2019/store/MemoryReactionsStore.js +7 -4
  17. package/dist/es2019/types/Actions.js +1 -0
  18. package/dist/es2019/types/Updater.js +1 -0
  19. package/dist/es2019/types/reaction.js +13 -0
  20. package/dist/esm/analytics/index.js +1 -1
  21. package/dist/esm/containers/ConnectedReactionsView/ConnectedReactionsView.js +16 -4
  22. package/dist/esm/i18n/en.js +1 -0
  23. package/dist/esm/i18n/en_GB.js +1 -0
  24. package/dist/esm/i18n/en_ZZ.js +1 -0
  25. package/dist/esm/store/MemoryReactionsStore.js +7 -4
  26. package/dist/esm/types/Actions.js +1 -0
  27. package/dist/esm/types/Updater.js +1 -0
  28. package/dist/esm/types/reaction.js +13 -0
  29. package/dist/types/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +6 -1
  30. package/dist/types/i18n/en.d.ts +1 -0
  31. package/dist/types/i18n/en_GB.d.ts +1 -0
  32. package/dist/types/i18n/en_ZZ.d.ts +1 -0
  33. package/dist/types/store/MemoryReactionsStore.d.ts +3 -2
  34. package/dist/types/types/Actions.d.ts +2 -1
  35. package/dist/types/types/Updater.d.ts +2 -1
  36. package/dist/types/types/reaction.d.ts +12 -0
  37. package/dist/types-ts4.5/containers/ConnectedReactionsView/ConnectedReactionsView.d.ts +6 -1
  38. package/dist/types-ts4.5/i18n/en.d.ts +1 -0
  39. package/dist/types-ts4.5/i18n/en_GB.d.ts +1 -0
  40. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +1 -0
  41. package/dist/types-ts4.5/store/MemoryReactionsStore.d.ts +3 -2
  42. package/dist/types-ts4.5/types/Actions.d.ts +2 -1
  43. package/dist/types-ts4.5/types/Updater.d.ts +2 -1
  44. package/dist/types-ts4.5/types/reaction.d.ts +12 -0
  45. package/package.json +7 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/reactions
2
2
 
3
+ ## 22.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#138899](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/138899)
8
+ [`5d280e98cb44f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5d280e98cb44f) -
9
+ Add on reactions success callback to reactions component
10
+
11
+ ## 22.12.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 22.12.0
4
18
 
5
19
  ### Minor Changes
@@ -11,7 +11,7 @@ var _analyticsGasTypes = require("@atlaskit/analytics-gas-types");
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
13
  var packageName = "@atlaskit/reactions";
14
- var packageVersion = "22.12.0";
14
+ var packageVersion = "22.13.0";
15
15
  /**
16
16
  * TODO: move to utility package?
17
17
  * A random sampling function
@@ -17,7 +17,8 @@ var _analyticsNext = require("@atlaskit/analytics-next");
17
17
  var _components = require("../../components");
18
18
  var _store2 = require("../../store");
19
19
  var _types = require("../../types");
20
- var _excluded = ["ari", "containerAri", "store", "particleEffectByEmojiEnabled"];
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
+ var _excluded = ["ari", "containerAri", "store", "particleEffectByEmojiEnabled", "onReactionSuccess"];
21
22
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
23
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
24
  /**
@@ -63,18 +64,28 @@ var mapStateToPropsHelper = exports.mapStateToPropsHelper = function mapStateToP
63
64
  /**
64
65
  * Export the mapper function outside the component so easier to do unit tests
65
66
  */
66
- var mapDispatchToPropsHelper = exports.mapDispatchToPropsHelper = function mapDispatchToPropsHelper(actions, containerAri, ari) {
67
+ var mapDispatchToPropsHelper = exports.mapDispatchToPropsHelper = function mapDispatchToPropsHelper(actions, containerAri, ari, successCallBack) {
67
68
  return {
68
69
  loadReaction: function loadReaction() {
69
70
  actions.getReactions(containerAri, ari);
70
71
  },
71
72
  onReactionClick: function onReactionClick(emojiId) {
73
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
74
+ if ((0, _platformFeatureFlags.fg)('platform_reaction_success_callback') && successCallBack) {
75
+ actions.toggleReaction(containerAri, ari, emojiId, successCallBack);
76
+ return;
77
+ }
72
78
  actions.toggleReaction(containerAri, ari, emojiId);
73
79
  },
74
80
  getReactionDetails: function getReactionDetails(emojiId) {
75
81
  actions.getDetailedReaction(containerAri, ari, emojiId);
76
82
  },
77
83
  onSelection: function onSelection(emojiId) {
84
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
85
+ if ((0, _platformFeatureFlags.fg)('platform_reaction_success_callback') && successCallBack) {
86
+ actions.addReaction(containerAri, ari, emojiId, successCallBack);
87
+ return;
88
+ }
78
89
  actions.addReaction(containerAri, ari, emojiId);
79
90
  }
80
91
  };
@@ -84,6 +95,7 @@ var ConnectedReactionsView = exports.ConnectedReactionsView = function Connected
84
95
  containerAri = props.containerAri,
85
96
  store = props.store,
86
97
  particleEffectByEmojiEnabled = props.particleEffectByEmojiEnabled,
98
+ onReactionSuccess = props.onReactionSuccess,
87
99
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
88
100
  /**
89
101
  * Reference to the <Reactions /> component instance mandatory props
@@ -132,8 +144,8 @@ var ConnectedReactionsView = exports.ConnectedReactionsView = function Connected
132
144
  * @param actions list of actions in the store instance
133
145
  */
134
146
  var mapDispatchToProps = (0, _react.useCallback)(function (actions) {
135
- return mapDispatchToPropsHelper(actions, containerAri, ari);
136
- }, [ari, containerAri]);
147
+ return mapDispatchToPropsHelper(actions, containerAri, ari, onReactionSuccess);
148
+ }, [ari, containerAri, onReactionSuccess]);
137
149
  (0, _react.useEffect)(function () {
138
150
  (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
139
151
  var _store, state, dispatch;
@@ -21,6 +21,7 @@ var _default = exports.default = {
21
21
  'fabric.reactions.other.reacted.users': '{count, plural, one {and one other} other {and {count} others}}',
22
22
  'fabric.reactions.reactwithemoji': 'React with {emoji} emoji',
23
23
  'fabric.reactions.summary': 'View all user reactions',
24
+ 'reaction-picker-trigger.add.reaction.message': 'Add a reaction',
24
25
  'reactions.dialog.close': 'Close',
25
26
  'reactions.dialog.emoji.name': '{emojiName}',
26
27
  'reactions.dialog.left.navigate': 'Left Navigate',
@@ -21,6 +21,7 @@ var _default = exports.default = {
21
21
  'fabric.reactions.other.reacted.users': '{count, plural, one {and one other} other {and {count} others}}',
22
22
  'fabric.reactions.reactwithemoji': 'React with {emoji} emoji',
23
23
  'fabric.reactions.summary': 'View all user reactions',
24
+ 'reaction-picker-trigger.add.reaction.message': 'Add a reaction',
24
25
  'reactions.dialog.close': 'Close',
25
26
  'reactions.dialog.emoji.name': '{emojiName}',
26
27
  'reactions.dialog.left.navigate': 'Left Navigate',
@@ -21,6 +21,7 @@ var _default = exports.default = {
21
21
  'fabric.reactions.other.reacted.users': '{count, plural, one {⁣⁢and one other‍⁠؜⁠⁡‌⁠⁠⁠⁣⁤} other {⁣⁢and {count} others‍⁠؜⁠⁡‌⁠⁠⁠⁣⁤}}',
22
22
  'fabric.reactions.reactwithemoji': '⁣⁢React with {emoji} emoji‌‍؜‍⁡⁠⁡⁣⁤',
23
23
  'fabric.reactions.summary': '⁣⁢View all user reactions‌⁡‍⁡‌‌⁡‌⁠‍⁡⁠⁣⁤',
24
+ 'reaction-picker-trigger.add.reaction.message': '⁣⁢Add a reaction‌⁡‍؜؜⁠؜؜⁠⁠⁣⁤',
24
25
  'reactions.dialog.close': '⁣⁢Close‍⁡‌؜‍⁡‌‌⁣⁤',
25
26
  'reactions.dialog.emoji.name': '⁣⁢{emojiName}⁡‌‌‍؜⁠⁡‍⁡؜⁠‌‌‍‍⁡⁣⁤',
26
27
  'reactions.dialog.left.navigate': '⁣⁢Left Navigate؜‍‌؜⁠؜⁡‍⁠⁠⁡⁣⁤',
@@ -14,6 +14,7 @@ var _batched = require("./batched");
14
14
  var _utils = require("./utils");
15
15
  var _constants = require("../shared/constants");
16
16
  var _ufo = require("../ufo");
17
+ var _reaction = require("../types/reaction");
17
18
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
19
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
20
  /**
@@ -133,7 +134,7 @@ var MemoryReactionsStore = exports.MemoryReactionsStore = /*#__PURE__*/function
133
134
  });
134
135
  };
135
136
  });
136
- (0, _defineProperty2.default)(this, "doAddReaction", function (reaction) {
137
+ (0, _defineProperty2.default)(this, "doAddReaction", function (reaction, onSuccess) {
137
138
  var containerAri = reaction.containerAri,
138
139
  ari = reaction.ari,
139
140
  emojiId = reaction.emojiId;
@@ -156,6 +157,7 @@ var MemoryReactionsStore = exports.MemoryReactionsStore = /*#__PURE__*/function
156
157
  }
157
158
  // ufo add reaction success
158
159
  exp.success();
160
+ onSuccess === null || onSuccess === void 0 || onSuccess(_reaction.ReactionUpdateType.added, ari, emojiId);
159
161
  }).catch(function (error) {
160
162
  if ((0, _utils.isRealErrorFromService)(error.code)) {
161
163
  _this.createAnalyticsEvent && (0, _analytics.createAndFireSafe)(_this.createAnalyticsEvent, _analytics.createRestFailedEvent, 'addReaction', error.code);
@@ -170,7 +172,7 @@ var MemoryReactionsStore = exports.MemoryReactionsStore = /*#__PURE__*/function
170
172
  return Promise.reject(error);
171
173
  });
172
174
  });
173
- (0, _defineProperty2.default)(this, "doRemoveReaction", function (reaction) {
175
+ (0, _defineProperty2.default)(this, "doRemoveReaction", function (reaction, onSuccess) {
174
176
  var containerAri = reaction.containerAri,
175
177
  ari = reaction.ari,
176
178
  emojiId = reaction.emojiId;
@@ -191,6 +193,7 @@ var MemoryReactionsStore = exports.MemoryReactionsStore = /*#__PURE__*/function
191
193
  _this.client.deleteReaction(containerAri, ari, emojiId, _this.metadata).then(function (_) {
192
194
  // ufo add reaction success
193
195
  exp.success();
196
+ onSuccess === null || onSuccess === void 0 || onSuccess(_reaction.ReactionUpdateType.removed, ari, emojiId);
194
197
  }).catch(function (error) {
195
198
  // ufo add reaction failure
196
199
  exp.failure({
@@ -359,7 +362,7 @@ var MemoryReactionsStore = exports.MemoryReactionsStore = /*#__PURE__*/function
359
362
  key: "withReaction",
360
363
  value: function withReaction(reactedCallback, notReactedCallback) {
361
364
  var _this3 = this;
362
- return function (containerAri, ari, emojiId) {
365
+ return function (containerAri, ari, emojiId, onSuccess) {
363
366
  _this3.withReadyReaction(containerAri, ari)(function (reactionsState) {
364
367
  var reaction = reactionsState.reactions.find((0, _utils.byEmojiId)(emojiId)) || {
365
368
  containerAri: containerAri,
@@ -369,7 +372,7 @@ var MemoryReactionsStore = exports.MemoryReactionsStore = /*#__PURE__*/function
369
372
  reacted: false
370
373
  };
371
374
  var callback = reaction.reacted || !notReactedCallback ? reactedCallback : notReactedCallback;
372
- var updatedReaction = callback(reaction);
375
+ var updatedReaction = callback(reaction, onSuccess);
373
376
  if (updatedReaction && !(updatedReaction instanceof Function)) {
374
377
  return (0, _utils.readyState)(reactionsState.reactions.map((0, _utils.updateByEmojiId)(emojiId, updatedReaction)));
375
378
  }
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ReactionStatus = void 0;
6
+ exports.ReactionUpdateType = exports.ReactionStatus = void 0;
7
7
  /**
8
8
  * Collection of reactions as object (key is unique id from containerAri and ari combined)
9
9
  */
@@ -33,6 +33,18 @@ exports.ReactionStatus = void 0;
33
33
  * @param emojiId id of emoji
34
34
  * @param event (Optional) custom DOM event handler callback
35
35
  */
36
+ var ReactionUpdateType = exports.ReactionUpdateType = /*#__PURE__*/function (ReactionUpdateType) {
37
+ ReactionUpdateType["added"] = "added";
38
+ ReactionUpdateType["removed"] = "removed";
39
+ return ReactionUpdateType;
40
+ }({});
41
+ /**
42
+ * Event handler that is invoked when a reaction update is successful.
43
+ *
44
+ * @param {ReactionUpdateType} action - The action performed on the reaction.
45
+ * @param ari - The ARI (Atlassian Resource Identifier) of the entity.
46
+ * @param emojiId - The ID of the emoji used in the reaction.
47
+ */
36
48
  /**
37
49
  * Condition of the reaction when gets loaded from the store
38
50
  */
@@ -1,7 +1,7 @@
1
1
  import { createAndFireEvent } from '@atlaskit/analytics-next';
2
2
  import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
3
3
  const packageName = "@atlaskit/reactions";
4
- const packageVersion = "22.12.0";
4
+ const packageVersion = "22.13.0";
5
5
  /**
6
6
  * TODO: move to utility package?
7
7
  * A random sampling function
@@ -5,6 +5,7 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
5
5
  import { Reactions, UfoErrorBoundary } from '../../components';
6
6
  import { ufoExperiences } from '../../store';
7
7
  import { ReactionStatus } from '../../types';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
 
9
10
  /**
10
11
  * State Props required for <Reactions />
@@ -49,18 +50,28 @@ export const mapStateToPropsHelper = (containerAri, ari, particleEffectByEmojiEn
49
50
  /**
50
51
  * Export the mapper function outside the component so easier to do unit tests
51
52
  */
52
- export const mapDispatchToPropsHelper = (actions, containerAri, ari) => {
53
+ export const mapDispatchToPropsHelper = (actions, containerAri, ari, successCallBack) => {
53
54
  return {
54
55
  loadReaction: () => {
55
56
  actions.getReactions(containerAri, ari);
56
57
  },
57
58
  onReactionClick: emojiId => {
59
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
60
+ if (fg('platform_reaction_success_callback') && successCallBack) {
61
+ actions.toggleReaction(containerAri, ari, emojiId, successCallBack);
62
+ return;
63
+ }
58
64
  actions.toggleReaction(containerAri, ari, emojiId);
59
65
  },
60
66
  getReactionDetails: emojiId => {
61
67
  actions.getDetailedReaction(containerAri, ari, emojiId);
62
68
  },
63
69
  onSelection: emojiId => {
70
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
71
+ if (fg('platform_reaction_success_callback') && successCallBack) {
72
+ actions.addReaction(containerAri, ari, emojiId, successCallBack);
73
+ return;
74
+ }
64
75
  actions.addReaction(containerAri, ari, emojiId);
65
76
  }
66
77
  };
@@ -71,6 +82,7 @@ export const ConnectedReactionsView = props => {
71
82
  containerAri,
72
83
  store,
73
84
  particleEffectByEmojiEnabled,
85
+ onReactionSuccess,
74
86
  ...rest
75
87
  } = props;
76
88
  /**
@@ -115,8 +127,8 @@ export const ConnectedReactionsView = props => {
115
127
  * @param actions list of actions in the store instance
116
128
  */
117
129
  const mapDispatchToProps = useCallback(actions => {
118
- return mapDispatchToPropsHelper(actions, containerAri, ari);
119
- }, [ari, containerAri]);
130
+ return mapDispatchToPropsHelper(actions, containerAri, ari, onReactionSuccess);
131
+ }, [ari, containerAri, onReactionSuccess]);
120
132
  useEffect(() => {
121
133
  (async () => {
122
134
  const _store = await Promise.resolve(store);
@@ -15,6 +15,7 @@ export default {
15
15
  'fabric.reactions.other.reacted.users': '{count, plural, one {and one other} other {and {count} others}}',
16
16
  'fabric.reactions.reactwithemoji': 'React with {emoji} emoji',
17
17
  'fabric.reactions.summary': 'View all user reactions',
18
+ 'reaction-picker-trigger.add.reaction.message': 'Add a reaction',
18
19
  'reactions.dialog.close': 'Close',
19
20
  'reactions.dialog.emoji.name': '{emojiName}',
20
21
  'reactions.dialog.left.navigate': 'Left Navigate',
@@ -15,6 +15,7 @@ export default {
15
15
  'fabric.reactions.other.reacted.users': '{count, plural, one {and one other} other {and {count} others}}',
16
16
  'fabric.reactions.reactwithemoji': 'React with {emoji} emoji',
17
17
  'fabric.reactions.summary': 'View all user reactions',
18
+ 'reaction-picker-trigger.add.reaction.message': 'Add a reaction',
18
19
  'reactions.dialog.close': 'Close',
19
20
  'reactions.dialog.emoji.name': '{emojiName}',
20
21
  'reactions.dialog.left.navigate': 'Left Navigate',
@@ -15,6 +15,7 @@ export default {
15
15
  'fabric.reactions.other.reacted.users': '{count, plural, one {⁣⁢and one other‍⁠؜⁠⁡‌⁠⁠⁠⁣⁤} other {⁣⁢and {count} others‍⁠؜⁠⁡‌⁠⁠⁠⁣⁤}}',
16
16
  'fabric.reactions.reactwithemoji': '⁣⁢React with {emoji} emoji‌‍؜‍⁡⁠⁡⁣⁤',
17
17
  'fabric.reactions.summary': '⁣⁢View all user reactions‌⁡‍⁡‌‌⁡‌⁠‍⁡⁠⁣⁤',
18
+ 'reaction-picker-trigger.add.reaction.message': '⁣⁢Add a reaction‌⁡‍؜؜⁠؜؜⁠⁠⁣⁤',
18
19
  'reactions.dialog.close': '⁣⁢Close‍⁡‌؜‍⁡‌‌⁣⁤',
19
20
  'reactions.dialog.emoji.name': '⁣⁢{emojiName}⁡‌‌‍؜⁠⁡‍⁡؜⁠‌‌‍‍⁡⁣⁤',
20
21
  'reactions.dialog.left.navigate': '⁣⁢Left Navigate؜‍‌؜⁠؜⁡‍⁠⁠⁡⁣⁤',
@@ -5,6 +5,7 @@ import { batch, batchByKey } from './batched';
5
5
  import { addOne, byEmojiId, flattenAris, getReactionsSortFunction, isRealErrorFromService, readyState, removeOne, updateByEmojiId } from './utils';
6
6
  import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../shared/constants';
7
7
  import { ReactionsAdd, ReactionDetailsFetch, ReactionsRemove, sampledReactionsRendered } from '../ufo';
8
+ import { ReactionUpdateType } from '../types/reaction';
8
9
 
9
10
  /**
10
11
  * Set of all available UFO experiences relating to reaction element
@@ -121,7 +122,7 @@ export class MemoryReactionsStore {
121
122
  return readyState(reactions);
122
123
  });
123
124
  });
124
- _defineProperty(this, "doAddReaction", reaction => {
125
+ _defineProperty(this, "doAddReaction", (reaction, onSuccess) => {
125
126
  const {
126
127
  containerAri,
127
128
  ari,
@@ -146,6 +147,7 @@ export class MemoryReactionsStore {
146
147
  }
147
148
  // ufo add reaction success
148
149
  exp.success();
150
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ReactionUpdateType.added, ari, emojiId);
149
151
  }).catch(error => {
150
152
  if (isRealErrorFromService(error.code)) {
151
153
  this.createAnalyticsEvent && createAndFireSafe(this.createAnalyticsEvent, createRestFailedEvent, 'addReaction', error.code);
@@ -160,7 +162,7 @@ export class MemoryReactionsStore {
160
162
  return Promise.reject(error);
161
163
  });
162
164
  });
163
- _defineProperty(this, "doRemoveReaction", reaction => {
165
+ _defineProperty(this, "doRemoveReaction", (reaction, onSuccess) => {
164
166
  const {
165
167
  containerAri,
166
168
  ari,
@@ -183,6 +185,7 @@ export class MemoryReactionsStore {
183
185
  this.client.deleteReaction(containerAri, ari, emojiId, this.metadata).then(_ => {
184
186
  // ufo add reaction success
185
187
  exp.success();
188
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ReactionUpdateType.removed, ari, emojiId);
186
189
  }).catch(error => {
187
190
  // ufo add reaction failure
188
191
  exp.failure({
@@ -351,7 +354,7 @@ export class MemoryReactionsStore {
351
354
  * emojiId. If some state is returned, the new state will be applied.
352
355
  */
353
356
  withReaction(reactedCallback, notReactedCallback) {
354
- return (containerAri, ari, emojiId) => {
357
+ return (containerAri, ari, emojiId, onSuccess) => {
355
358
  this.withReadyReaction(containerAri, ari)(reactionsState => {
356
359
  const reaction = reactionsState.reactions.find(byEmojiId(emojiId)) || {
357
360
  containerAri,
@@ -361,7 +364,7 @@ export class MemoryReactionsStore {
361
364
  reacted: false
362
365
  };
363
366
  const callback = reaction.reacted || !notReactedCallback ? reactedCallback : notReactedCallback;
364
- const updatedReaction = callback(reaction);
367
+ const updatedReaction = callback(reaction, onSuccess);
365
368
  if (updatedReaction && !(updatedReaction instanceof Function)) {
366
369
  return readyState(reactionsState.reactions.map(updateByEmojiId(emojiId, updatedReaction)));
367
370
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -34,6 +34,19 @@
34
34
  * @param event (Optional) custom DOM event handler callback
35
35
  */
36
36
 
37
+ export let ReactionUpdateType = /*#__PURE__*/function (ReactionUpdateType) {
38
+ ReactionUpdateType["added"] = "added";
39
+ ReactionUpdateType["removed"] = "removed";
40
+ return ReactionUpdateType;
41
+ }({});
42
+ /**
43
+ * Event handler that is invoked when a reaction update is successful.
44
+ *
45
+ * @param {ReactionUpdateType} action - The action performed on the reaction.
46
+ * @param ari - The ARI (Atlassian Resource Identifier) of the entity.
47
+ * @param emojiId - The ID of the emoji used in the reaction.
48
+ */
49
+
37
50
  /**
38
51
  * Condition of the reaction when gets loaded from the store
39
52
  */
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { createAndFireEvent } from '@atlaskit/analytics-next';
5
5
  import { UI_EVENT_TYPE, OPERATIONAL_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
6
6
  var packageName = "@atlaskit/reactions";
7
- var packageVersion = "22.12.0";
7
+ var packageVersion = "22.13.0";
8
8
  /**
9
9
  * TODO: move to utility package?
10
10
  * A random sampling function
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["ari", "containerAri", "store", "particleEffectByEmojiEnabled"];
5
+ var _excluded = ["ari", "containerAri", "store", "particleEffectByEmojiEnabled", "onReactionSuccess"];
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
7
  import React, { useCallback, useEffect, useRef, useState } from 'react';
8
8
  import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
@@ -10,6 +10,7 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
10
10
  import { Reactions, UfoErrorBoundary } from '../../components';
11
11
  import { ufoExperiences } from '../../store';
12
12
  import { ReactionStatus } from '../../types';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
 
14
15
  /**
15
16
  * State Props required for <Reactions />
@@ -54,18 +55,28 @@ export var mapStateToPropsHelper = function mapStateToPropsHelper(containerAri,
54
55
  /**
55
56
  * Export the mapper function outside the component so easier to do unit tests
56
57
  */
57
- export var mapDispatchToPropsHelper = function mapDispatchToPropsHelper(actions, containerAri, ari) {
58
+ export var mapDispatchToPropsHelper = function mapDispatchToPropsHelper(actions, containerAri, ari, successCallBack) {
58
59
  return {
59
60
  loadReaction: function loadReaction() {
60
61
  actions.getReactions(containerAri, ari);
61
62
  },
62
63
  onReactionClick: function onReactionClick(emojiId) {
64
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
65
+ if (fg('platform_reaction_success_callback') && successCallBack) {
66
+ actions.toggleReaction(containerAri, ari, emojiId, successCallBack);
67
+ return;
68
+ }
63
69
  actions.toggleReaction(containerAri, ari, emojiId);
64
70
  },
65
71
  getReactionDetails: function getReactionDetails(emojiId) {
66
72
  actions.getDetailedReaction(containerAri, ari, emojiId);
67
73
  },
68
74
  onSelection: function onSelection(emojiId) {
75
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
76
+ if (fg('platform_reaction_success_callback') && successCallBack) {
77
+ actions.addReaction(containerAri, ari, emojiId, successCallBack);
78
+ return;
79
+ }
69
80
  actions.addReaction(containerAri, ari, emojiId);
70
81
  }
71
82
  };
@@ -75,6 +86,7 @@ export var ConnectedReactionsView = function ConnectedReactionsView(props) {
75
86
  containerAri = props.containerAri,
76
87
  store = props.store,
77
88
  particleEffectByEmojiEnabled = props.particleEffectByEmojiEnabled,
89
+ onReactionSuccess = props.onReactionSuccess,
78
90
  rest = _objectWithoutProperties(props, _excluded);
79
91
  /**
80
92
  * Reference to the <Reactions /> component instance mandatory props
@@ -123,8 +135,8 @@ export var ConnectedReactionsView = function ConnectedReactionsView(props) {
123
135
  * @param actions list of actions in the store instance
124
136
  */
125
137
  var mapDispatchToProps = useCallback(function (actions) {
126
- return mapDispatchToPropsHelper(actions, containerAri, ari);
127
- }, [ari, containerAri]);
138
+ return mapDispatchToPropsHelper(actions, containerAri, ari, onReactionSuccess);
139
+ }, [ari, containerAri, onReactionSuccess]);
128
140
  useEffect(function () {
129
141
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
130
142
  var _store, state, dispatch;
@@ -15,6 +15,7 @@ export default {
15
15
  'fabric.reactions.other.reacted.users': '{count, plural, one {and one other} other {and {count} others}}',
16
16
  'fabric.reactions.reactwithemoji': 'React with {emoji} emoji',
17
17
  'fabric.reactions.summary': 'View all user reactions',
18
+ 'reaction-picker-trigger.add.reaction.message': 'Add a reaction',
18
19
  'reactions.dialog.close': 'Close',
19
20
  'reactions.dialog.emoji.name': '{emojiName}',
20
21
  'reactions.dialog.left.navigate': 'Left Navigate',
@@ -15,6 +15,7 @@ export default {
15
15
  'fabric.reactions.other.reacted.users': '{count, plural, one {and one other} other {and {count} others}}',
16
16
  'fabric.reactions.reactwithemoji': 'React with {emoji} emoji',
17
17
  'fabric.reactions.summary': 'View all user reactions',
18
+ 'reaction-picker-trigger.add.reaction.message': 'Add a reaction',
18
19
  'reactions.dialog.close': 'Close',
19
20
  'reactions.dialog.emoji.name': '{emojiName}',
20
21
  'reactions.dialog.left.navigate': 'Left Navigate',
@@ -15,6 +15,7 @@ export default {
15
15
  'fabric.reactions.other.reacted.users': '{count, plural, one {⁣⁢and one other‍⁠؜⁠⁡‌⁠⁠⁠⁣⁤} other {⁣⁢and {count} others‍⁠؜⁠⁡‌⁠⁠⁠⁣⁤}}',
16
16
  'fabric.reactions.reactwithemoji': '⁣⁢React with {emoji} emoji‌‍؜‍⁡⁠⁡⁣⁤',
17
17
  'fabric.reactions.summary': '⁣⁢View all user reactions‌⁡‍⁡‌‌⁡‌⁠‍⁡⁠⁣⁤',
18
+ 'reaction-picker-trigger.add.reaction.message': '⁣⁢Add a reaction‌⁡‍؜؜⁠؜؜⁠⁠⁣⁤',
18
19
  'reactions.dialog.close': '⁣⁢Close‍⁡‌؜‍⁡‌‌⁣⁤',
19
20
  'reactions.dialog.emoji.name': '⁣⁢{emojiName}⁡‌‌‍؜⁠⁡‍⁡؜⁠‌‌‍‍⁡⁣⁤',
20
21
  'reactions.dialog.left.navigate': '⁣⁢Left Navigate؜‍‌؜⁠؜⁡‍⁠⁠⁡⁣⁤',
@@ -9,6 +9,7 @@ import { batch, batchByKey } from './batched';
9
9
  import { addOne, byEmojiId, flattenAris, getReactionsSortFunction, isRealErrorFromService, readyState, removeOne, updateByEmojiId } from './utils';
10
10
  import { SAMPLING_RATE_REACTIONS_RENDERED_EXP } from '../shared/constants';
11
11
  import { ReactionsAdd, ReactionDetailsFetch, ReactionsRemove, sampledReactionsRendered } from '../ufo';
12
+ import { ReactionUpdateType } from '../types/reaction';
12
13
 
13
14
  /**
14
15
  * Set of all available UFO experiences relating to reaction element
@@ -128,7 +129,7 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
128
129
  });
129
130
  };
130
131
  });
131
- _defineProperty(this, "doAddReaction", function (reaction) {
132
+ _defineProperty(this, "doAddReaction", function (reaction, onSuccess) {
132
133
  var containerAri = reaction.containerAri,
133
134
  ari = reaction.ari,
134
135
  emojiId = reaction.emojiId;
@@ -151,6 +152,7 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
151
152
  }
152
153
  // ufo add reaction success
153
154
  exp.success();
155
+ onSuccess === null || onSuccess === void 0 || onSuccess(ReactionUpdateType.added, ari, emojiId);
154
156
  }).catch(function (error) {
155
157
  if (isRealErrorFromService(error.code)) {
156
158
  _this.createAnalyticsEvent && createAndFireSafe(_this.createAnalyticsEvent, createRestFailedEvent, 'addReaction', error.code);
@@ -165,7 +167,7 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
165
167
  return Promise.reject(error);
166
168
  });
167
169
  });
168
- _defineProperty(this, "doRemoveReaction", function (reaction) {
170
+ _defineProperty(this, "doRemoveReaction", function (reaction, onSuccess) {
169
171
  var containerAri = reaction.containerAri,
170
172
  ari = reaction.ari,
171
173
  emojiId = reaction.emojiId;
@@ -186,6 +188,7 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
186
188
  _this.client.deleteReaction(containerAri, ari, emojiId, _this.metadata).then(function (_) {
187
189
  // ufo add reaction success
188
190
  exp.success();
191
+ onSuccess === null || onSuccess === void 0 || onSuccess(ReactionUpdateType.removed, ari, emojiId);
189
192
  }).catch(function (error) {
190
193
  // ufo add reaction failure
191
194
  exp.failure({
@@ -354,7 +357,7 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
354
357
  key: "withReaction",
355
358
  value: function withReaction(reactedCallback, notReactedCallback) {
356
359
  var _this3 = this;
357
- return function (containerAri, ari, emojiId) {
360
+ return function (containerAri, ari, emojiId, onSuccess) {
358
361
  _this3.withReadyReaction(containerAri, ari)(function (reactionsState) {
359
362
  var reaction = reactionsState.reactions.find(byEmojiId(emojiId)) || {
360
363
  containerAri: containerAri,
@@ -364,7 +367,7 @@ export var MemoryReactionsStore = /*#__PURE__*/function () {
364
367
  reacted: false
365
368
  };
366
369
  var callback = reaction.reacted || !notReactedCallback ? reactedCallback : notReactedCallback;
367
- var updatedReaction = callback(reaction);
370
+ var updatedReaction = callback(reaction, onSuccess);
368
371
  if (updatedReaction && !(updatedReaction instanceof Function)) {
369
372
  return readyState(reactionsState.reactions.map(updateByEmojiId(emojiId, updatedReaction)));
370
373
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -34,6 +34,19 @@
34
34
  * @param event (Optional) custom DOM event handler callback
35
35
  */
36
36
 
37
+ export var ReactionUpdateType = /*#__PURE__*/function (ReactionUpdateType) {
38
+ ReactionUpdateType["added"] = "added";
39
+ ReactionUpdateType["removed"] = "removed";
40
+ return ReactionUpdateType;
41
+ }({});
42
+ /**
43
+ * Event handler that is invoked when a reaction update is successful.
44
+ *
45
+ * @param {ReactionUpdateType} action - The action performed on the reaction.
46
+ * @param ari - The ARI (Atlassian Resource Identifier) of the entity.
47
+ * @param emojiId - The ID of the emoji used in the reaction.
48
+ */
49
+
37
50
  /**
38
51
  * Condition of the reaction when gets loaded from the store
39
52
  */
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type ReactionsProps, type ReactionPickerProps } from '../../components';
3
3
  import { ReactionStatus, type Actions, type State, type StorePropInput } from '../../types';
4
+ import { type ReactionUpdateSuccess } from '../../types/reaction';
4
5
  export interface ConnectedReactionsViewProps extends Pick<ReactionsProps, 'quickReactionEmojis' | 'onDialogOpenCallback' | 'onDialogCloseCallback' | 'onDialogSelectReactionCallback' | 'allowUserDialog' | 'allowAllEmojis' | 'emojiProvider' | 'emojiPickerSize' | 'miniMode' | 'summaryViewEnabled' | 'subtleReactionsSummaryAndPicker'>, Pick<ReactionPickerProps, 'pickerQuickReactionEmojiIds'> {
5
6
  /**
6
7
  * Wrapper id for reactions list
@@ -20,6 +21,10 @@ export interface ConnectedReactionsViewProps extends Pick<ReactionsProps, 'quick
20
21
  * Optional boolean to control if particle animation on reactions appear
21
22
  */
22
23
  particleEffectByEmojiEnabled?: boolean;
24
+ /**
25
+ * Callback function when a reaction is successfully added
26
+ */
27
+ onReactionSuccess?: ReactionUpdateSuccess;
23
28
  }
24
29
  /**
25
30
  * Export the mapper function outside the component so easier to do unit tests
@@ -42,7 +47,7 @@ export declare const mapStateToPropsHelper: (containerAri: string, ari: string,
42
47
  /**
43
48
  * Export the mapper function outside the component so easier to do unit tests
44
49
  */
45
- export declare const mapDispatchToPropsHelper: (actions: Actions, containerAri: string, ari: string) => {
50
+ export declare const mapDispatchToPropsHelper: (actions: Actions, containerAri: string, ari: string, successCallBack?: ReactionUpdateSuccess) => {
46
51
  loadReaction: () => void;
47
52
  onReactionClick: (emojiId: string) => void;
48
53
  getReactionDetails: (emojiId: string) => void;
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  'fabric.reactions.other.reacted.users': string;
14
14
  'fabric.reactions.reactwithemoji': string;
15
15
  'fabric.reactions.summary': string;
16
+ 'reaction-picker-trigger.add.reaction.message': string;
16
17
  'reactions.dialog.close': string;
17
18
  'reactions.dialog.emoji.name': string;
18
19
  'reactions.dialog.left.navigate': string;
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  'fabric.reactions.other.reacted.users': string;
14
14
  'fabric.reactions.reactwithemoji': string;
15
15
  'fabric.reactions.summary': string;
16
+ 'reaction-picker-trigger.add.reaction.message': string;
16
17
  'reactions.dialog.close': string;
17
18
  'reactions.dialog.emoji.name': string;
18
19
  'reactions.dialog.left.navigate': string;
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  'fabric.reactions.other.reacted.users': string;
14
14
  'fabric.reactions.reactwithemoji': string;
15
15
  'fabric.reactions.summary': string;
16
+ 'reaction-picker-trigger.add.reaction.message': string;
16
17
  'reactions.dialog.close': string;
17
18
  'reactions.dialog.emoji.name': string;
18
19
  'reactions.dialog.left.navigate': string;
@@ -1,5 +1,6 @@
1
1
  import { type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import { type Client, type OnChangeCallback, type State, type Store } from '../types';
3
+ import { type ReactionUpdateSuccess } from '../types/reaction';
3
4
  /**
4
5
  * Set of all available UFO experiences relating to reaction element
5
6
  */
@@ -86,8 +87,8 @@ export declare class MemoryReactionsStore implements Store {
86
87
  private doRemoveReaction;
87
88
  setCreateAnalyticsEvent: (createAnalyticsEvent?: CreateUIAnalyticsEvent) => void;
88
89
  getReactions: (key: string, ...args: string[]) => void;
89
- toggleReaction: (containerAri: string, ari: string, emojiId: string) => void;
90
- addReaction: (containerAri: string, ari: string, emojiId: string) => void;
90
+ toggleReaction: (containerAri: string, ari: string, emojiId: string, onSuccess?: ReactionUpdateSuccess) => void;
91
+ addReaction: (containerAri: string, ari: string, emojiId: string, onSuccess?: ReactionUpdateSuccess) => void;
91
92
  getDetailedReaction: (containerAri: string, ari: string, emojiId: string) => void;
92
93
  getState: () => State;
93
94
  onChange: (callback: OnChangeCallback) => void;
@@ -1,10 +1,11 @@
1
+ import { type ReactionUpdateSuccess } from './reaction';
1
2
  /**
2
3
  * Event callback by the client to the API
3
4
  * @param containerAri the container for reactions/ari in the page (attached to the "quickReactionEmojis" prop)
4
5
  * @param ariunique Atlassian identifier for an emoji (attached to the "quickReactionEmojis" prop)
5
6
  * @param emojiId unique identifier guid for the emoji
6
7
  */
7
- export type ReactionAction = (containerAri: string, ari: string, emojiId: string) => void;
8
+ export type ReactionAction = (containerAri: string, ari: string, emojiId: string, onSuccess?: ReactionUpdateSuccess) => void;
8
9
  export type Actions = {
9
10
  /**
10
11
  * Retrieve reaction collection api
@@ -1 +1,2 @@
1
- export type Updater<T> = (original: T) => T | void;
1
+ import { type ReactionUpdateSuccess } from './reaction';
2
+ export type Updater<T> = (original: T, onSuccess?: ReactionUpdateSuccess) => T | void;
@@ -79,6 +79,18 @@ export type ReactionMouseEnter = (emojiId: string, event?: React.MouseEvent<any>
79
79
  * @param event (Optional) custom DOM event handler callback
80
80
  */
81
81
  export type ReactionFocused = (emojiId: string, event?: React.FocusEvent<any>) => void;
82
+ export declare enum ReactionUpdateType {
83
+ added = "added",
84
+ removed = "removed"
85
+ }
86
+ /**
87
+ * Event handler that is invoked when a reaction update is successful.
88
+ *
89
+ * @param {ReactionUpdateType} action - The action performed on the reaction.
90
+ * @param ari - The ARI (Atlassian Resource Identifier) of the entity.
91
+ * @param emojiId - The ID of the emoji used in the reaction.
92
+ */
93
+ export type ReactionUpdateSuccess = (action: ReactionUpdateType, ari: string, emojiId: string) => void;
82
94
  /**
83
95
  * Condition of the reaction when gets loaded from the store
84
96
  */
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type ReactionsProps, type ReactionPickerProps } from '../../components';
3
3
  import { ReactionStatus, type Actions, type State, type StorePropInput } from '../../types';
4
+ import { type ReactionUpdateSuccess } from '../../types/reaction';
4
5
  export interface ConnectedReactionsViewProps extends Pick<ReactionsProps, 'quickReactionEmojis' | 'onDialogOpenCallback' | 'onDialogCloseCallback' | 'onDialogSelectReactionCallback' | 'allowUserDialog' | 'allowAllEmojis' | 'emojiProvider' | 'emojiPickerSize' | 'miniMode' | 'summaryViewEnabled' | 'subtleReactionsSummaryAndPicker'>, Pick<ReactionPickerProps, 'pickerQuickReactionEmojiIds'> {
5
6
  /**
6
7
  * Wrapper id for reactions list
@@ -20,6 +21,10 @@ export interface ConnectedReactionsViewProps extends Pick<ReactionsProps, 'quick
20
21
  * Optional boolean to control if particle animation on reactions appear
21
22
  */
22
23
  particleEffectByEmojiEnabled?: boolean;
24
+ /**
25
+ * Callback function when a reaction is successfully added
26
+ */
27
+ onReactionSuccess?: ReactionUpdateSuccess;
23
28
  }
24
29
  /**
25
30
  * Export the mapper function outside the component so easier to do unit tests
@@ -42,7 +47,7 @@ export declare const mapStateToPropsHelper: (containerAri: string, ari: string,
42
47
  /**
43
48
  * Export the mapper function outside the component so easier to do unit tests
44
49
  */
45
- export declare const mapDispatchToPropsHelper: (actions: Actions, containerAri: string, ari: string) => {
50
+ export declare const mapDispatchToPropsHelper: (actions: Actions, containerAri: string, ari: string, successCallBack?: ReactionUpdateSuccess) => {
46
51
  loadReaction: () => void;
47
52
  onReactionClick: (emojiId: string) => void;
48
53
  getReactionDetails: (emojiId: string) => void;
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  'fabric.reactions.other.reacted.users': string;
14
14
  'fabric.reactions.reactwithemoji': string;
15
15
  'fabric.reactions.summary': string;
16
+ 'reaction-picker-trigger.add.reaction.message': string;
16
17
  'reactions.dialog.close': string;
17
18
  'reactions.dialog.emoji.name': string;
18
19
  'reactions.dialog.left.navigate': string;
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  'fabric.reactions.other.reacted.users': string;
14
14
  'fabric.reactions.reactwithemoji': string;
15
15
  'fabric.reactions.summary': string;
16
+ 'reaction-picker-trigger.add.reaction.message': string;
16
17
  'reactions.dialog.close': string;
17
18
  'reactions.dialog.emoji.name': string;
18
19
  'reactions.dialog.left.navigate': string;
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  'fabric.reactions.other.reacted.users': string;
14
14
  'fabric.reactions.reactwithemoji': string;
15
15
  'fabric.reactions.summary': string;
16
+ 'reaction-picker-trigger.add.reaction.message': string;
16
17
  'reactions.dialog.close': string;
17
18
  'reactions.dialog.emoji.name': string;
18
19
  'reactions.dialog.left.navigate': string;
@@ -1,5 +1,6 @@
1
1
  import { type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import { type Client, type OnChangeCallback, type State, type Store } from '../types';
3
+ import { type ReactionUpdateSuccess } from '../types/reaction';
3
4
  /**
4
5
  * Set of all available UFO experiences relating to reaction element
5
6
  */
@@ -86,8 +87,8 @@ export declare class MemoryReactionsStore implements Store {
86
87
  private doRemoveReaction;
87
88
  setCreateAnalyticsEvent: (createAnalyticsEvent?: CreateUIAnalyticsEvent) => void;
88
89
  getReactions: (key: string, ...args: string[]) => void;
89
- toggleReaction: (containerAri: string, ari: string, emojiId: string) => void;
90
- addReaction: (containerAri: string, ari: string, emojiId: string) => void;
90
+ toggleReaction: (containerAri: string, ari: string, emojiId: string, onSuccess?: ReactionUpdateSuccess) => void;
91
+ addReaction: (containerAri: string, ari: string, emojiId: string, onSuccess?: ReactionUpdateSuccess) => void;
91
92
  getDetailedReaction: (containerAri: string, ari: string, emojiId: string) => void;
92
93
  getState: () => State;
93
94
  onChange: (callback: OnChangeCallback) => void;
@@ -1,10 +1,11 @@
1
+ import { type ReactionUpdateSuccess } from './reaction';
1
2
  /**
2
3
  * Event callback by the client to the API
3
4
  * @param containerAri the container for reactions/ari in the page (attached to the "quickReactionEmojis" prop)
4
5
  * @param ariunique Atlassian identifier for an emoji (attached to the "quickReactionEmojis" prop)
5
6
  * @param emojiId unique identifier guid for the emoji
6
7
  */
7
- export type ReactionAction = (containerAri: string, ari: string, emojiId: string) => void;
8
+ export type ReactionAction = (containerAri: string, ari: string, emojiId: string, onSuccess?: ReactionUpdateSuccess) => void;
8
9
  export type Actions = {
9
10
  /**
10
11
  * Retrieve reaction collection api
@@ -1 +1,2 @@
1
- export type Updater<T> = (original: T) => T | void;
1
+ import { type ReactionUpdateSuccess } from './reaction';
2
+ export type Updater<T> = (original: T, onSuccess?: ReactionUpdateSuccess) => T | void;
@@ -79,6 +79,18 @@ export type ReactionMouseEnter = (emojiId: string, event?: React.MouseEvent<any>
79
79
  * @param event (Optional) custom DOM event handler callback
80
80
  */
81
81
  export type ReactionFocused = (emojiId: string, event?: React.FocusEvent<any>) => void;
82
+ export declare enum ReactionUpdateType {
83
+ added = "added",
84
+ removed = "removed"
85
+ }
86
+ /**
87
+ * Event handler that is invoked when a reaction update is successful.
88
+ *
89
+ * @param {ReactionUpdateType} action - The action performed on the reaction.
90
+ * @param ari - The ARI (Atlassian Resource Identifier) of the entity.
91
+ * @param emojiId - The ID of the emoji used in the reaction.
92
+ */
93
+ export type ReactionUpdateSuccess = (action: ReactionUpdateType, ari: string, emojiId: string) => void;
82
94
  /**
83
95
  * Condition of the reaction when gets loaded from the store
84
96
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/reactions",
3
- "version": "22.12.0",
3
+ "version": "22.13.0",
4
4
  "description": "Reactions component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -42,8 +42,8 @@
42
42
  "@atlaskit/modal-dialog": "^12.15.0",
43
43
  "@atlaskit/motion": "^1.9.0",
44
44
  "@atlaskit/platform-feature-flags": "^0.3.0",
45
- "@atlaskit/popper": "^6.2.0",
46
- "@atlaskit/popup": "1.24.2",
45
+ "@atlaskit/popper": "^6.3.0",
46
+ "@atlaskit/popup": "1.25.0",
47
47
  "@atlaskit/primitives": "^12.1.0",
48
48
  "@atlaskit/spinner": "^16.3.0",
49
49
  "@atlaskit/tabs": "^16.4.0",
@@ -64,6 +64,7 @@
64
64
  "devDependencies": {
65
65
  "@atlaskit/elements-test-helpers": "^0.7.0",
66
66
  "@atlaskit/util-data-test": "^17.9.0",
67
+ "@atlassian/feature-flags-test-utils": "^0.2.0",
67
68
  "@emotion/jest": "^11.8.0",
68
69
  "@testing-library/dom": "^10.1.0",
69
70
  "@testing-library/jest-dom": "^6.4.5",
@@ -111,6 +112,9 @@
111
112
  "platform-feature-flags": {
112
113
  "platform-component-visual-refresh": {
113
114
  "type": "boolean"
115
+ },
116
+ "platform_reaction_success_callback": {
117
+ "type": "boolean"
114
118
  }
115
119
  }
116
120
  }