@atlaskit/editor-plugin-tasks-and-decisions 2.7.3 → 2.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 2.7.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#147528](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147528)
8
+ [`76697633ae0d5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/76697633ae0d5) -
9
+ ED-25126 adding analytic events for requestToEdit and dismiss functionality
10
+ - Updated dependencies
11
+
3
12
  ## 2.7.3
4
13
 
5
14
  ### Patch Changes
@@ -19,6 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
19
19
  var _reactIntlNext = require("react-intl-next");
20
20
  var _steps = require("@atlaskit/adf-schema/steps");
21
21
  var _analyticsNext = require("@atlaskit/analytics-next");
22
+ var _analytics = require("@atlaskit/editor-common/analytics");
22
23
  var _hooks = require("@atlaskit/editor-common/hooks");
23
24
  var _messages = require("@atlaskit/editor-common/messages");
24
25
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
@@ -87,6 +88,17 @@ var RequestToEditButton = function RequestToEditButton(_ref) {
87
88
  xcss: pressableStyles
88
89
  }, formatMessage(_messages.tasksAndDecisionsMessages.requestToEdit)));
89
90
  };
91
+ var anaylyticsEventPayload = function anaylyticsEventPayload(action) {
92
+ return {
93
+ action: action,
94
+ actionSubject: _analytics.ACTION_SUBJECT.REQUEST_TO_EDIT_POP_UP,
95
+ eventType: _analytics.EVENT_TYPE.UI,
96
+ attributes: {
97
+ platform: _analytics.PLATFORMS.WEB,
98
+ mode: _analytics.MODE.EDITOR
99
+ }
100
+ };
101
+ };
90
102
  var TaskItemWrapper = function TaskItemWrapper(_ref2) {
91
103
  var localId = _ref2.localId,
92
104
  forwardRef = _ref2.forwardRef,
@@ -116,7 +128,7 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
116
128
  getPos: getPos,
117
129
  api: api
118
130
  });
119
- var onHandleEdit = function onHandleEdit() {
131
+ var onHandleEdit = function onHandleEdit(editorAnalyticsAPI) {
120
132
  if ((0, _platformFeatureFlags.fg)('editor_request_to_edit_task')) {
121
133
  var _api$taskDecision;
122
134
  setRequested(true);
@@ -133,9 +145,14 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
133
145
  requestToEdit();
134
146
  }
135
147
  }
148
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(anaylyticsEventPayload(_analytics.ACTION.REQUEST_TO_EDIT))(tr);
136
149
  editorView.dispatch(tr);
137
150
  }
138
151
  };
152
+ var onHandleDismiss = function onHandleDismiss(editorAnalyticsAPI) {
153
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.fireAnalyticsEvent(anaylyticsEventPayload(_analytics.ACTION.DISMISSED));
154
+ setIsOpen(false);
155
+ };
139
156
  var onHandleClick = function onHandleClick() {
140
157
  if ((0, _platformFeatureFlags.fg)('editor_request_to_edit_task')) {
141
158
  setIsOpen(true);
@@ -155,7 +172,8 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
155
172
  return /*#__PURE__*/_react.default.createElement(_popup.default, {
156
173
  isOpen: isOpen,
157
174
  onClose: function onClose() {
158
- return setIsOpen(false);
175
+ var _api$analytics;
176
+ return onHandleDismiss(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
159
177
  },
160
178
  content: function content() {
161
179
  var _api$editorViewMode;
@@ -168,12 +186,16 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
168
186
  }, formatMessage(_messages.tasksAndDecisionsMessages.editAccessTitle)), /*#__PURE__*/_react.default.createElement("div", null, formatMessage(_messages.tasksAndDecisionsMessages.requestToEditDescription)), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
169
187
  xcss: wrapperBoxStyles
170
188
  }, requested ? /*#__PURE__*/_react.default.createElement(RequestedMessage, null) : /*#__PURE__*/_react.default.createElement(RequestToEditButton, {
171
- onClick: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' ? onHandleEdit : undefined
189
+ onClick: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' ? function () {
190
+ var _api$analytics2;
191
+ return onHandleEdit(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
192
+ } : undefined
172
193
  }), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
173
194
  xcss: dotStyles
174
195
  }), /*#__PURE__*/_react.default.createElement(_primitives.Box, null, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
175
196
  onClick: function onClick() {
176
- return setIsOpen(false);
197
+ var _api$analytics3;
198
+ return onHandleDismiss(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
177
199
  },
178
200
  xcss: pressableStyles
179
201
  }, formatMessage(_messages.tasksAndDecisionsMessages.dismiss))))));
@@ -3,6 +3,7 @@ import React, { useState } from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
4
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
5
5
  import { AnalyticsListener } from '@atlaskit/analytics-next';
6
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE, MODE, PLATFORMS } from '@atlaskit/editor-common/analytics';
6
7
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
8
  import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
8
9
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
@@ -68,6 +69,17 @@ const RequestToEditButton = ({
68
69
  xcss: pressableStyles
69
70
  }, formatMessage(tasksAndDecisionsMessages.requestToEdit)));
70
71
  };
72
+ const anaylyticsEventPayload = action => {
73
+ return {
74
+ action,
75
+ actionSubject: ACTION_SUBJECT.REQUEST_TO_EDIT_POP_UP,
76
+ eventType: EVENT_TYPE.UI,
77
+ attributes: {
78
+ platform: PLATFORMS.WEB,
79
+ mode: MODE.EDITOR
80
+ }
81
+ };
82
+ };
71
83
  const TaskItemWrapper = ({
72
84
  localId,
73
85
  forwardRef,
@@ -94,7 +106,7 @@ const TaskItemWrapper = ({
94
106
  getPos,
95
107
  api
96
108
  });
97
- const onHandleEdit = () => {
109
+ const onHandleEdit = editorAnalyticsAPI => {
98
110
  if (fg('editor_request_to_edit_task')) {
99
111
  var _api$taskDecision, _api$taskDecision$sha;
100
112
  setRequested(true);
@@ -113,9 +125,14 @@ const TaskItemWrapper = ({
113
125
  requestToEdit();
114
126
  }
115
127
  }
128
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(anaylyticsEventPayload(ACTION.REQUEST_TO_EDIT))(tr);
116
129
  editorView.dispatch(tr);
117
130
  }
118
131
  };
132
+ const onHandleDismiss = editorAnalyticsAPI => {
133
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.fireAnalyticsEvent(anaylyticsEventPayload(ACTION.DISMISSED));
134
+ setIsOpen(false);
135
+ };
119
136
  const onHandleClick = () => {
120
137
  if (fg('editor_request_to_edit_task')) {
121
138
  setIsOpen(true);
@@ -134,7 +151,10 @@ const TaskItemWrapper = ({
134
151
  }
135
152
  return /*#__PURE__*/React.createElement(Popup, {
136
153
  isOpen: isOpen,
137
- onClose: () => setIsOpen(false),
154
+ onClose: () => {
155
+ var _api$analytics;
156
+ return onHandleDismiss(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
157
+ },
138
158
  content: () => {
139
159
  var _api$editorViewMode, _api$editorViewMode$s;
140
160
  return /*#__PURE__*/React.createElement(Box, {
@@ -146,11 +166,17 @@ const TaskItemWrapper = ({
146
166
  }, formatMessage(tasksAndDecisionsMessages.editAccessTitle)), /*#__PURE__*/React.createElement("div", null, formatMessage(tasksAndDecisionsMessages.requestToEditDescription)), /*#__PURE__*/React.createElement(Box, {
147
167
  xcss: wrapperBoxStyles
148
168
  }, requested ? /*#__PURE__*/React.createElement(RequestedMessage, null) : /*#__PURE__*/React.createElement(RequestToEditButton, {
149
- onClick: (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view' ? onHandleEdit : undefined
169
+ onClick: (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view' ? () => {
170
+ var _api$analytics2;
171
+ return onHandleEdit(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
172
+ } : undefined
150
173
  }), /*#__PURE__*/React.createElement(Box, {
151
174
  xcss: dotStyles
152
175
  }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
153
- onClick: () => setIsOpen(false),
176
+ onClick: () => {
177
+ var _api$analytics3;
178
+ return onHandleDismiss(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
179
+ },
154
180
  xcss: pressableStyles
155
181
  }, formatMessage(tasksAndDecisionsMessages.dismiss))))));
156
182
  },
@@ -15,6 +15,7 @@ import React, { useState } from 'react';
15
15
  import { useIntl } from 'react-intl-next';
16
16
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
17
17
  import { AnalyticsListener } from '@atlaskit/analytics-next';
18
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE, MODE, PLATFORMS } from '@atlaskit/editor-common/analytics';
18
19
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
19
20
  import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
20
21
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
@@ -77,6 +78,17 @@ var RequestToEditButton = function RequestToEditButton(_ref) {
77
78
  xcss: pressableStyles
78
79
  }, formatMessage(tasksAndDecisionsMessages.requestToEdit)));
79
80
  };
81
+ var anaylyticsEventPayload = function anaylyticsEventPayload(action) {
82
+ return {
83
+ action: action,
84
+ actionSubject: ACTION_SUBJECT.REQUEST_TO_EDIT_POP_UP,
85
+ eventType: EVENT_TYPE.UI,
86
+ attributes: {
87
+ platform: PLATFORMS.WEB,
88
+ mode: MODE.EDITOR
89
+ }
90
+ };
91
+ };
80
92
  var TaskItemWrapper = function TaskItemWrapper(_ref2) {
81
93
  var localId = _ref2.localId,
82
94
  forwardRef = _ref2.forwardRef,
@@ -106,7 +118,7 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
106
118
  getPos: getPos,
107
119
  api: api
108
120
  });
109
- var onHandleEdit = function onHandleEdit() {
121
+ var onHandleEdit = function onHandleEdit(editorAnalyticsAPI) {
110
122
  if (fg('editor_request_to_edit_task')) {
111
123
  var _api$taskDecision;
112
124
  setRequested(true);
@@ -123,9 +135,14 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
123
135
  requestToEdit();
124
136
  }
125
137
  }
138
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(anaylyticsEventPayload(ACTION.REQUEST_TO_EDIT))(tr);
126
139
  editorView.dispatch(tr);
127
140
  }
128
141
  };
142
+ var onHandleDismiss = function onHandleDismiss(editorAnalyticsAPI) {
143
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.fireAnalyticsEvent(anaylyticsEventPayload(ACTION.DISMISSED));
144
+ setIsOpen(false);
145
+ };
129
146
  var onHandleClick = function onHandleClick() {
130
147
  if (fg('editor_request_to_edit_task')) {
131
148
  setIsOpen(true);
@@ -145,7 +162,8 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
145
162
  return /*#__PURE__*/React.createElement(Popup, {
146
163
  isOpen: isOpen,
147
164
  onClose: function onClose() {
148
- return setIsOpen(false);
165
+ var _api$analytics;
166
+ return onHandleDismiss(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
149
167
  },
150
168
  content: function content() {
151
169
  var _api$editorViewMode;
@@ -158,12 +176,16 @@ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
158
176
  }, formatMessage(tasksAndDecisionsMessages.editAccessTitle)), /*#__PURE__*/React.createElement("div", null, formatMessage(tasksAndDecisionsMessages.requestToEditDescription)), /*#__PURE__*/React.createElement(Box, {
159
177
  xcss: wrapperBoxStyles
160
178
  }, requested ? /*#__PURE__*/React.createElement(RequestedMessage, null) : /*#__PURE__*/React.createElement(RequestToEditButton, {
161
- onClick: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' ? onHandleEdit : undefined
179
+ onClick: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' ? function () {
180
+ var _api$analytics2;
181
+ return onHandleEdit(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
182
+ } : undefined
162
183
  }), /*#__PURE__*/React.createElement(Box, {
163
184
  xcss: dotStyles
164
185
  }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
165
186
  onClick: function onClick() {
166
- return setIsOpen(false);
187
+ var _api$analytics3;
188
+ return onHandleDismiss(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
167
189
  },
168
190
  xcss: pressableStyles
169
191
  }, formatMessage(tasksAndDecisionsMessages.dismiss))))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "2.7.3",
3
+ "version": "2.7.4",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/editor-plugin-type-ahead": "^1.8.0",
42
42
  "@atlaskit/editor-prosemirror": "6.0.0",
43
43
  "@atlaskit/heading": "2.4.6",
44
- "@atlaskit/icon": "22.20.0",
44
+ "@atlaskit/icon": "22.20.1",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
46
  "@atlaskit/popup": "1.27.2",
47
47
  "@atlaskit/primitives": "12.2.2",