@atlaskit/reactions 21.0.5 → 21.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/analytics/index.js +11 -1
  3. package/dist/cjs/analytics/ufo.js +71 -0
  4. package/dist/cjs/components/Counter.js +20 -20
  5. package/dist/cjs/components/EmojiButton.js +9 -11
  6. package/dist/cjs/components/FlashAnimation.js +19 -17
  7. package/dist/cjs/components/Reaction.js +22 -28
  8. package/dist/cjs/components/ReactionPicker.js +43 -37
  9. package/dist/cjs/components/ReactionTooltip.js +33 -29
  10. package/dist/cjs/components/Reactions.js +15 -17
  11. package/dist/cjs/components/Selector.js +23 -28
  12. package/dist/cjs/components/ShowMore.js +25 -22
  13. package/dist/cjs/components/Trigger.js +11 -16
  14. package/dist/cjs/components/UfoErrorBoundary.js +68 -0
  15. package/dist/cjs/components/index.js +9 -1
  16. package/dist/cjs/containers/ConnectedReactionPicker.js +44 -0
  17. package/dist/cjs/containers/ConnectedReactionsView.js +131 -0
  18. package/dist/cjs/containers/index.js +4 -6
  19. package/dist/cjs/index.js +11 -3
  20. package/dist/cjs/{reaction-store → store}/ReactionConsumer.js +0 -0
  21. package/dist/cjs/{reaction-store → store}/ReactionsStore.js +63 -14
  22. package/dist/cjs/{reaction-store → store}/batched.js +0 -0
  23. package/dist/cjs/{reaction-store → store}/index.js +0 -0
  24. package/dist/cjs/{reaction-store → store}/utils.js +0 -0
  25. package/dist/cjs/version.json +1 -1
  26. package/dist/es2019/analytics/index.js +2 -0
  27. package/dist/es2019/analytics/ufo.js +62 -0
  28. package/dist/es2019/components/Counter.js +18 -18
  29. package/dist/es2019/components/EmojiButton.js +10 -10
  30. package/dist/es2019/components/FlashAnimation.js +16 -15
  31. package/dist/es2019/components/Reaction.js +23 -28
  32. package/dist/es2019/components/ReactionPicker.js +39 -34
  33. package/dist/es2019/components/ReactionTooltip.js +27 -27
  34. package/dist/es2019/components/Reactions.js +16 -16
  35. package/dist/es2019/components/Selector.js +21 -24
  36. package/dist/es2019/components/ShowMore.js +22 -18
  37. package/dist/es2019/components/Trigger.js +10 -14
  38. package/dist/es2019/components/UfoErrorBoundary.js +13 -0
  39. package/dist/es2019/components/index.js +2 -1
  40. package/dist/es2019/containers/ConnectedReactionPicker.js +27 -0
  41. package/dist/es2019/containers/ConnectedReactionsView.js +112 -0
  42. package/dist/es2019/containers/index.js +2 -2
  43. package/dist/es2019/index.js +2 -1
  44. package/dist/es2019/{reaction-store → store}/ReactionConsumer.js +0 -0
  45. package/dist/es2019/{reaction-store → store}/ReactionsStore.js +59 -13
  46. package/dist/es2019/{reaction-store → store}/batched.js +0 -0
  47. package/dist/es2019/{reaction-store → store}/index.js +0 -0
  48. package/dist/es2019/{reaction-store → store}/utils.js +0 -0
  49. package/dist/es2019/version.json +1 -1
  50. package/dist/esm/analytics/index.js +2 -0
  51. package/dist/esm/analytics/ufo.js +62 -0
  52. package/dist/esm/components/Counter.js +18 -17
  53. package/dist/esm/components/EmojiButton.js +9 -10
  54. package/dist/esm/components/FlashAnimation.js +16 -14
  55. package/dist/esm/components/Reaction.js +22 -26
  56. package/dist/esm/components/ReactionPicker.js +39 -34
  57. package/dist/esm/components/ReactionTooltip.js +27 -27
  58. package/dist/esm/components/Reactions.js +15 -16
  59. package/dist/esm/components/Selector.js +20 -24
  60. package/dist/esm/components/ShowMore.js +22 -19
  61. package/dist/esm/components/Trigger.js +10 -14
  62. package/dist/esm/components/UfoErrorBoundary.js +54 -0
  63. package/dist/esm/components/index.js +2 -1
  64. package/dist/esm/containers/ConnectedReactionPicker.js +29 -0
  65. package/dist/esm/containers/ConnectedReactionsView.js +108 -0
  66. package/dist/esm/containers/index.js +2 -2
  67. package/dist/esm/index.js +2 -1
  68. package/dist/esm/{reaction-store → store}/ReactionConsumer.js +0 -0
  69. package/dist/esm/{reaction-store → store}/ReactionsStore.js +61 -13
  70. package/dist/esm/{reaction-store → store}/batched.js +0 -0
  71. package/dist/esm/{reaction-store → store}/index.js +0 -0
  72. package/dist/esm/{reaction-store → store}/utils.js +0 -0
  73. package/dist/esm/version.json +1 -1
  74. package/dist/types/analytics/index.d.ts +1 -0
  75. package/dist/types/analytics/ufo.d.ts +26 -0
  76. package/dist/types/components/Counter.d.ts +4 -3
  77. package/dist/types/components/FlashAnimation.d.ts +3 -1
  78. package/dist/types/components/ReactionPicker.d.ts +2 -1
  79. package/dist/types/components/Reactions.d.ts +7 -5
  80. package/dist/types/components/Selector.d.ts +2 -1
  81. package/dist/types/components/ShowMore.d.ts +4 -0
  82. package/dist/types/components/UfoErrorBoundary.d.ts +8 -0
  83. package/dist/types/components/index.d.ts +2 -0
  84. package/dist/types/containers/ConnectedReactionPicker.d.ts +10 -0
  85. package/dist/types/containers/ConnectedReactionsView.d.ts +19 -0
  86. package/dist/types/containers/index.d.ts +2 -2
  87. package/dist/types/index.d.ts +3 -2
  88. package/dist/types/store/ReactionConsumer.d.ts +29 -0
  89. package/dist/types/{reaction-store → store}/ReactionsStore.d.ts +11 -7
  90. package/dist/types/{reaction-store → store}/batched.d.ts +0 -0
  91. package/dist/types/{reaction-store → store}/index.d.ts +0 -0
  92. package/dist/types/{reaction-store → store}/utils.d.ts +0 -0
  93. package/dist/types/types/Actions.d.ts +6 -0
  94. package/dist/types/types/index.d.ts +1 -1
  95. package/docs/0-intro.tsx +1 -1
  96. package/package.json +7 -6
  97. package/dist/cjs/containers/ReactionsContainer.js +0 -142
  98. package/dist/cjs/containers/ReactionsPickerContainer.js +0 -76
  99. package/dist/es2019/containers/ReactionsContainer.js +0 -96
  100. package/dist/es2019/containers/ReactionsPickerContainer.js +0 -26
  101. package/dist/esm/containers/ReactionsContainer.js +0 -125
  102. package/dist/esm/containers/ReactionsPickerContainer.js +0 -62
  103. package/dist/types/containers/ReactionsContainer.d.ts +0 -22
  104. package/dist/types/containers/ReactionsPickerContainer.d.ts +0 -18
  105. package/dist/types/reaction-store/ReactionConsumer.d.ts +0 -32
@@ -1,142 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
- var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
27
-
28
- var _analyticsNext = require("@atlaskit/analytics-next");
29
-
30
- var _react = _interopRequireDefault(require("react"));
31
-
32
- var _Reactions = require("../components/Reactions");
33
-
34
- var _ReactionConsumer = require("../reaction-store/ReactionConsumer");
35
-
36
- var _ReactionStatus = require("../types/ReactionStatus");
37
-
38
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
39
-
40
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
-
42
- var ReactionsContainerWithoutAnalytics = /*#__PURE__*/function (_React$PureComponent) {
43
- (0, _inherits2.default)(ReactionsContainerWithoutAnalytics, _React$PureComponent);
44
-
45
- var _super = _createSuper(ReactionsContainerWithoutAnalytics);
46
-
47
- function ReactionsContainerWithoutAnalytics() {
48
- var _this;
49
-
50
- (0, _classCallCheck2.default)(this, ReactionsContainerWithoutAnalytics);
51
-
52
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
53
- args[_key] = arguments[_key];
54
- }
55
-
56
- _this = _super.call.apply(_super, [this].concat(args));
57
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderChild", function (props) {
58
- var _this$props = _this.props,
59
- containerAri = _this$props.containerAri,
60
- ari = _this$props.ari;
61
- return /*#__PURE__*/_react.default.createElement(_analyticsNamespacedContext.FabricElementsAnalyticsContext, {
62
- data: {
63
- containerAri: containerAri,
64
- ari: ari
65
- }
66
- }, /*#__PURE__*/_react.default.createElement(_Reactions.Reactions, (0, _extends2.default)({
67
- key: "".concat(_this.props.containerAri, "|").concat(_this.props.ari)
68
- }, _this.props, props)));
69
- });
70
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "stateMapper", function (state) {
71
- var _this$props2 = _this.props,
72
- containerAri = _this$props2.containerAri,
73
- ari = _this$props2.ari;
74
- var reactionsState = state && state.reactions["".concat(containerAri, "|").concat(ari)];
75
-
76
- if (!state || !reactionsState) {
77
- return {
78
- status: _ReactionStatus.ReactionStatus.notLoaded
79
- };
80
- }
81
-
82
- switch (reactionsState.status) {
83
- case _ReactionStatus.ReactionStatus.ready:
84
- return {
85
- reactions: reactionsState.reactions,
86
- status: reactionsState.status,
87
- flash: state.flash["".concat(containerAri, "|").concat(ari)]
88
- };
89
-
90
- default:
91
- return {
92
- status: _ReactionStatus.ReactionStatus.loading
93
- };
94
- }
95
- });
96
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "actionsMapper", function (actions) {
97
- return {
98
- loadReaction: function loadReaction() {
99
- actions.getReactions(_this.props.containerAri, _this.props.ari);
100
- },
101
- onReactionClick: function onReactionClick(emojiId) {
102
- actions.toggleReaction(_this.props.containerAri, _this.props.ari, emojiId);
103
- },
104
- onReactionHover: function onReactionHover(emojiId) {
105
- actions.getDetailedReaction(_this.props.containerAri, _this.props.ari, emojiId);
106
- },
107
- onSelection: function onSelection(emojiId) {
108
- actions.addReaction(_this.props.containerAri, _this.props.ari, emojiId);
109
- }
110
- };
111
- });
112
- return _this;
113
- }
114
-
115
- (0, _createClass2.default)(ReactionsContainerWithoutAnalytics, [{
116
- key: "componentDidMount",
117
- value: function componentDidMount() {
118
- var _this$props3 = this.props,
119
- createAnalyticsEvent = _this$props3.createAnalyticsEvent,
120
- store = _this$props3.store;
121
- Promise.resolve(store).then(function (_store) {
122
- if (_store.setCreateAnalyticsEvent && createAnalyticsEvent) {
123
- _store.setCreateAnalyticsEvent(createAnalyticsEvent);
124
- }
125
- });
126
- }
127
- }, {
128
- key: "render",
129
- value: function render() {
130
- return /*#__PURE__*/_react.default.createElement(_ReactionConsumer.ReactionConsumer, {
131
- store: this.props.store,
132
- actionsMapper: this.actionsMapper,
133
- stateMapper: this.stateMapper
134
- }, this.renderChild);
135
- }
136
- }]);
137
- return ReactionsContainerWithoutAnalytics;
138
- }(_react.default.PureComponent);
139
-
140
- var ReactionsContainer = (0, _analyticsNext.withAnalyticsEvents)()(ReactionsContainerWithoutAnalytics);
141
- var _default = ReactionsContainer;
142
- exports.default = _default;
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
- var _react = _interopRequireDefault(require("react"));
27
-
28
- var _ReactionPicker = require("../components/ReactionPicker");
29
-
30
- var _ReactionConsumer = require("../reaction-store/ReactionConsumer");
31
-
32
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
-
34
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
35
-
36
- var ReactionPickerContainer = /*#__PURE__*/function (_React$PureComponent) {
37
- (0, _inherits2.default)(ReactionPickerContainer, _React$PureComponent);
38
-
39
- var _super = _createSuper(ReactionPickerContainer);
40
-
41
- function ReactionPickerContainer() {
42
- var _this;
43
-
44
- (0, _classCallCheck2.default)(this, ReactionPickerContainer);
45
-
46
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
- args[_key] = arguments[_key];
48
- }
49
-
50
- _this = _super.call.apply(_super, [this].concat(args));
51
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderChild", function (props) {
52
- return /*#__PURE__*/_react.default.createElement(_ReactionPicker.ReactionPicker, (0, _extends2.default)({}, _this.props, props));
53
- });
54
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "actionsMapper", function (actions) {
55
- return {
56
- onSelection: function onSelection(emojiId) {
57
- actions.addReaction(_this.props.containerAri, _this.props.ari, emojiId);
58
- }
59
- };
60
- });
61
- return _this;
62
- }
63
-
64
- (0, _createClass2.default)(ReactionPickerContainer, [{
65
- key: "render",
66
- value: function render() {
67
- return /*#__PURE__*/_react.default.createElement(_ReactionConsumer.ReactionConsumer, {
68
- store: this.props.store,
69
- actionsMapper: this.actionsMapper
70
- }, this.renderChild);
71
- }
72
- }]);
73
- return ReactionPickerContainer;
74
- }(_react.default.PureComponent);
75
-
76
- exports.default = ReactionPickerContainer;
@@ -1,96 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
4
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
5
- import React from 'react';
6
- import { Reactions } from '../components/Reactions';
7
- import { ReactionConsumer } from '../reaction-store/ReactionConsumer';
8
- import { ReactionStatus } from '../types/ReactionStatus';
9
-
10
- class ReactionsContainerWithoutAnalytics extends React.PureComponent {
11
- constructor(...args) {
12
- super(...args);
13
-
14
- _defineProperty(this, "renderChild", props => {
15
- const {
16
- containerAri,
17
- ari
18
- } = this.props;
19
- return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
20
- data: {
21
- containerAri,
22
- ari
23
- }
24
- }, /*#__PURE__*/React.createElement(Reactions, _extends({
25
- key: `${this.props.containerAri}|${this.props.ari}`
26
- }, this.props, props)));
27
- });
28
-
29
- _defineProperty(this, "stateMapper", state => {
30
- const {
31
- containerAri,
32
- ari
33
- } = this.props;
34
- const reactionsState = state && state.reactions[`${containerAri}|${ari}`];
35
-
36
- if (!state || !reactionsState) {
37
- return {
38
- status: ReactionStatus.notLoaded
39
- };
40
- }
41
-
42
- switch (reactionsState.status) {
43
- case ReactionStatus.ready:
44
- return {
45
- reactions: reactionsState.reactions,
46
- status: reactionsState.status,
47
- flash: state.flash[`${containerAri}|${ari}`]
48
- };
49
-
50
- default:
51
- return {
52
- status: ReactionStatus.loading
53
- };
54
- }
55
- });
56
-
57
- _defineProperty(this, "actionsMapper", actions => ({
58
- loadReaction: () => {
59
- actions.getReactions(this.props.containerAri, this.props.ari);
60
- },
61
- onReactionClick: emojiId => {
62
- actions.toggleReaction(this.props.containerAri, this.props.ari, emojiId);
63
- },
64
- onReactionHover: emojiId => {
65
- actions.getDetailedReaction(this.props.containerAri, this.props.ari, emojiId);
66
- },
67
- onSelection: emojiId => {
68
- actions.addReaction(this.props.containerAri, this.props.ari, emojiId);
69
- }
70
- }));
71
- }
72
-
73
- componentDidMount() {
74
- const {
75
- createAnalyticsEvent,
76
- store
77
- } = this.props;
78
- Promise.resolve(store).then(_store => {
79
- if (_store.setCreateAnalyticsEvent && createAnalyticsEvent) {
80
- _store.setCreateAnalyticsEvent(createAnalyticsEvent);
81
- }
82
- });
83
- }
84
-
85
- render() {
86
- return /*#__PURE__*/React.createElement(ReactionConsumer, {
87
- store: this.props.store,
88
- actionsMapper: this.actionsMapper,
89
- stateMapper: this.stateMapper
90
- }, this.renderChild);
91
- }
92
-
93
- }
94
-
95
- const ReactionsContainer = withAnalyticsEvents()(ReactionsContainerWithoutAnalytics);
96
- export default ReactionsContainer;
@@ -1,26 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import React from 'react';
4
- import { ReactionPicker } from '../components/ReactionPicker';
5
- import { ReactionConsumer } from '../reaction-store/ReactionConsumer';
6
- export default class ReactionPickerContainer extends React.PureComponent {
7
- constructor(...args) {
8
- super(...args);
9
-
10
- _defineProperty(this, "renderChild", props => /*#__PURE__*/React.createElement(ReactionPicker, _extends({}, this.props, props)));
11
-
12
- _defineProperty(this, "actionsMapper", actions => ({
13
- onSelection: emojiId => {
14
- actions.addReaction(this.props.containerAri, this.props.ari, emojiId);
15
- }
16
- }));
17
- }
18
-
19
- render() {
20
- return /*#__PURE__*/React.createElement(ReactionConsumer, {
21
- store: this.props.store,
22
- actionsMapper: this.actionsMapper
23
- }, this.renderChild);
24
- }
25
-
26
- }
@@ -1,125 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
-
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
- import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
15
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
16
- import React from 'react';
17
- import { Reactions } from '../components/Reactions';
18
- import { ReactionConsumer } from '../reaction-store/ReactionConsumer';
19
- import { ReactionStatus } from '../types/ReactionStatus';
20
-
21
- var ReactionsContainerWithoutAnalytics = /*#__PURE__*/function (_React$PureComponent) {
22
- _inherits(ReactionsContainerWithoutAnalytics, _React$PureComponent);
23
-
24
- var _super = _createSuper(ReactionsContainerWithoutAnalytics);
25
-
26
- function ReactionsContainerWithoutAnalytics() {
27
- var _this;
28
-
29
- _classCallCheck(this, ReactionsContainerWithoutAnalytics);
30
-
31
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
- args[_key] = arguments[_key];
33
- }
34
-
35
- _this = _super.call.apply(_super, [this].concat(args));
36
-
37
- _defineProperty(_assertThisInitialized(_this), "renderChild", function (props) {
38
- var _this$props = _this.props,
39
- containerAri = _this$props.containerAri,
40
- ari = _this$props.ari;
41
- return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
42
- data: {
43
- containerAri: containerAri,
44
- ari: ari
45
- }
46
- }, /*#__PURE__*/React.createElement(Reactions, _extends({
47
- key: "".concat(_this.props.containerAri, "|").concat(_this.props.ari)
48
- }, _this.props, props)));
49
- });
50
-
51
- _defineProperty(_assertThisInitialized(_this), "stateMapper", function (state) {
52
- var _this$props2 = _this.props,
53
- containerAri = _this$props2.containerAri,
54
- ari = _this$props2.ari;
55
- var reactionsState = state && state.reactions["".concat(containerAri, "|").concat(ari)];
56
-
57
- if (!state || !reactionsState) {
58
- return {
59
- status: ReactionStatus.notLoaded
60
- };
61
- }
62
-
63
- switch (reactionsState.status) {
64
- case ReactionStatus.ready:
65
- return {
66
- reactions: reactionsState.reactions,
67
- status: reactionsState.status,
68
- flash: state.flash["".concat(containerAri, "|").concat(ari)]
69
- };
70
-
71
- default:
72
- return {
73
- status: ReactionStatus.loading
74
- };
75
- }
76
- });
77
-
78
- _defineProperty(_assertThisInitialized(_this), "actionsMapper", function (actions) {
79
- return {
80
- loadReaction: function loadReaction() {
81
- actions.getReactions(_this.props.containerAri, _this.props.ari);
82
- },
83
- onReactionClick: function onReactionClick(emojiId) {
84
- actions.toggleReaction(_this.props.containerAri, _this.props.ari, emojiId);
85
- },
86
- onReactionHover: function onReactionHover(emojiId) {
87
- actions.getDetailedReaction(_this.props.containerAri, _this.props.ari, emojiId);
88
- },
89
- onSelection: function onSelection(emojiId) {
90
- actions.addReaction(_this.props.containerAri, _this.props.ari, emojiId);
91
- }
92
- };
93
- });
94
-
95
- return _this;
96
- }
97
-
98
- _createClass(ReactionsContainerWithoutAnalytics, [{
99
- key: "componentDidMount",
100
- value: function componentDidMount() {
101
- var _this$props3 = this.props,
102
- createAnalyticsEvent = _this$props3.createAnalyticsEvent,
103
- store = _this$props3.store;
104
- Promise.resolve(store).then(function (_store) {
105
- if (_store.setCreateAnalyticsEvent && createAnalyticsEvent) {
106
- _store.setCreateAnalyticsEvent(createAnalyticsEvent);
107
- }
108
- });
109
- }
110
- }, {
111
- key: "render",
112
- value: function render() {
113
- return /*#__PURE__*/React.createElement(ReactionConsumer, {
114
- store: this.props.store,
115
- actionsMapper: this.actionsMapper,
116
- stateMapper: this.stateMapper
117
- }, this.renderChild);
118
- }
119
- }]);
120
-
121
- return ReactionsContainerWithoutAnalytics;
122
- }(React.PureComponent);
123
-
124
- var ReactionsContainer = withAnalyticsEvents()(ReactionsContainerWithoutAnalytics);
125
- export default ReactionsContainer;
@@ -1,62 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
-
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
- import React from 'react';
15
- import { ReactionPicker } from '../components/ReactionPicker';
16
- import { ReactionConsumer } from '../reaction-store/ReactionConsumer';
17
-
18
- var ReactionPickerContainer = /*#__PURE__*/function (_React$PureComponent) {
19
- _inherits(ReactionPickerContainer, _React$PureComponent);
20
-
21
- var _super = _createSuper(ReactionPickerContainer);
22
-
23
- function ReactionPickerContainer() {
24
- var _this;
25
-
26
- _classCallCheck(this, ReactionPickerContainer);
27
-
28
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29
- args[_key] = arguments[_key];
30
- }
31
-
32
- _this = _super.call.apply(_super, [this].concat(args));
33
-
34
- _defineProperty(_assertThisInitialized(_this), "renderChild", function (props) {
35
- return /*#__PURE__*/React.createElement(ReactionPicker, _extends({}, _this.props, props));
36
- });
37
-
38
- _defineProperty(_assertThisInitialized(_this), "actionsMapper", function (actions) {
39
- return {
40
- onSelection: function onSelection(emojiId) {
41
- actions.addReaction(_this.props.containerAri, _this.props.ari, emojiId);
42
- }
43
- };
44
- });
45
-
46
- return _this;
47
- }
48
-
49
- _createClass(ReactionPickerContainer, [{
50
- key: "render",
51
- value: function render() {
52
- return /*#__PURE__*/React.createElement(ReactionConsumer, {
53
- store: this.props.store,
54
- actionsMapper: this.actionsMapper
55
- }, this.renderChild);
56
- }
57
- }]);
58
-
59
- return ReactionPickerContainer;
60
- }(React.PureComponent);
61
-
62
- export { ReactionPickerContainer as default };
@@ -1,22 +0,0 @@
1
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
- import { EmojiProvider } from '@atlaskit/emoji/resource';
3
- import React from 'react';
4
- import { ReactionStoreProp } from '../reaction-store/ReactionConsumer';
5
- export declare type Props = {
6
- containerAri: string;
7
- ari: string;
8
- allowAllEmojis?: boolean;
9
- boundariesElement?: string;
10
- emojiProvider: Promise<EmojiProvider>;
11
- store: ReactionStoreProp;
12
- };
13
- declare class ReactionsContainerWithoutAnalytics extends React.PureComponent<Props & WithAnalyticsEventsProps> {
14
- private renderChild;
15
- private stateMapper;
16
- private actionsMapper;
17
- componentDidMount(): void;
18
- render(): JSX.Element;
19
- }
20
- declare type ReactionsContainer = ReactionsContainerWithoutAnalytics;
21
- declare const ReactionsContainer: React.ForwardRefExoticComponent<Pick<Props & WithAnalyticsEventsProps, "emojiProvider" | "boundariesElement" | "allowAllEmojis" | "containerAri" | "ari" | "store"> & React.RefAttributes<any>>;
22
- export default ReactionsContainer;
@@ -1,18 +0,0 @@
1
- import { EmojiProvider } from '@atlaskit/emoji/resource';
2
- import React from 'react';
3
- import { ReactionStoreProp } from '../reaction-store/ReactionConsumer';
4
- export declare type Props = {
5
- containerAri: string;
6
- ari: string;
7
- emojiProvider: Promise<EmojiProvider>;
8
- miniMode?: boolean;
9
- boundariesElement?: string;
10
- className?: string;
11
- allowAllEmojis?: boolean;
12
- store: ReactionStoreProp;
13
- };
14
- export default class ReactionPickerContainer extends React.PureComponent<Props> {
15
- private renderChild;
16
- private actionsMapper;
17
- render(): JSX.Element;
18
- }
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { ReactionAction } from '../types';
3
- import { ReactionsStore, State } from './ReactionsStore';
4
- export declare type ReactionStoreProp = ReactionsStore | Promise<ReactionsStore>;
5
- export declare type ReactionStoreState = State;
6
- export declare type Actions = {
7
- getReactions: (containerId: string, aris: string) => void;
8
- toggleReaction: ReactionAction;
9
- addReaction: ReactionAction;
10
- getDetailedReaction: ReactionAction;
11
- };
12
- export declare type Props<PropsFromState extends {}, PropsFromActions extends {}> = {
13
- stateMapper?: (state: State) => PropsFromState;
14
- actionsMapper?: (actions: Actions) => PropsFromActions;
15
- children: (props: PropsFromState & PropsFromActions) => React.ReactNode;
16
- store: ReactionStoreProp;
17
- };
18
- declare type ConsumerState = {
19
- store?: ReactionsStore;
20
- };
21
- export declare class ReactionConsumer<PropsFromState extends {}, PropsFromActions extends {}> extends React.PureComponent<Props<PropsFromState, PropsFromActions>, ConsumerState> {
22
- private previousActions;
23
- private propsFromActions;
24
- constructor(props: Props<PropsFromState, PropsFromActions>);
25
- private getPropsFromActions;
26
- private getPropsFromState;
27
- private handleOnChange;
28
- componentDidMount(): void;
29
- componentWillUnmount(): void;
30
- render(): {} | null | undefined;
31
- }
32
- export {};