@atlaskit/editor-plugin-mentions 2.7.1 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 2.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#152012](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152012)
8
+ [`30a69f02904da`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30a69f02904da) -
9
+ [ED-23460] Make sure that error analytics in editor-plugin-mentions can fire by using actions from
10
+ editor-plugin-analytics
11
+
12
+ - **@atlaskit/editor-common**: Add types for `@atlaskit/editor-plugin-mentions` analytics
13
+ - **@atlaskit/editor-plugin-mentions**: Switch to using `@atlaskit/editor-plugin-analytics`
14
+ actions so that error events can be queued and fired consistently
15
+ - **@atlaskit/mention**: Move some enums to the types file and export them so they can be used to
16
+ type analytics events
17
+
18
+ ## 2.8.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [#151190](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151190)
23
+ [`a3723b1cdede2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a3723b1cdede2) -
24
+ [ux] [ED-25037] this change bumps @atlaskit/adf-schema from 40.9.0 to 40.9.4 which makes the
25
+ blockquote selectable, adds missing marks to the PM node spec and fixes a bug that converted
26
+ pasted external images to media groups.
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies
31
+
3
32
  ## 2.7.1
4
33
 
5
34
  ### Patch Changes
@@ -1,31 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.buildTypeAheadRenderedPayload = exports.buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInsertedPayload = exports.buildTypeAheadCancelPayload = exports.buildAnalyticsPayload = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _analyticsGasTypes = require("@atlaskit/analytics-gas-types");
6
+ exports.buildTypeAheadRenderedPayload = exports.buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInsertedPayload = exports.buildTypeAheadCancelPayload = void 0;
7
+ var _analytics = require("@atlaskit/editor-common/analytics");
10
8
  var _resource = require("@atlaskit/mention/resource");
11
9
  var _utils = require("./utils");
12
- 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; }
13
- 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; }
14
10
  var componentName = 'mention';
15
- var buildAnalyticsPayload = exports.buildAnalyticsPayload = function buildAnalyticsPayload(actionSubject, action, eventType, sessionId) {
16
- var otherAttributes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
17
- var tags = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
18
- return {
19
- action: action,
20
- actionSubject: actionSubject,
21
- eventType: eventType,
22
- attributes: _objectSpread({
23
- componentName: componentName,
24
- sessionId: sessionId
25
- }, otherAttributes),
26
- tags: tags
27
- };
28
- };
29
11
  var emptyQueryResponse = {
30
12
  queryLength: 0,
31
13
  spaceInQuery: false
@@ -43,13 +25,20 @@ var buildTypeAheadCancelPayload = exports.buildTypeAheadCancelPayload = function
43
25
  var _extractAttributesFro = extractAttributesFromQuery(query),
44
26
  queryLength = _extractAttributesFro.queryLength,
45
27
  spaceInQuery = _extractAttributesFro.spaceInQuery;
46
- return buildAnalyticsPayload('mentionTypeahead', 'cancelled', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
47
- duration: duration,
48
- downKeyCount: downKeyCount,
49
- upKeyCount: upKeyCount,
50
- queryLength: queryLength,
51
- spaceInQuery: spaceInQuery
52
- });
28
+ return {
29
+ action: _analytics.ACTION.CANCELLED,
30
+ actionSubject: _analytics.ACTION_SUBJECT.MENTION_TYPEAHEAD,
31
+ eventType: _analytics.EVENT_TYPE.UI,
32
+ attributes: {
33
+ componentName: componentName,
34
+ duration: duration,
35
+ queryLength: queryLength,
36
+ spaceInQuery: spaceInQuery,
37
+ upKeyCount: upKeyCount,
38
+ downKeyCount: downKeyCount,
39
+ sessionId: sessionId
40
+ }
41
+ };
53
42
  };
54
43
  var getPosition = function getPosition(mentionList, selectedMention) {
55
44
  if (mentionList) {
@@ -68,12 +57,19 @@ var buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemView
68
57
  containerId = _ref.containerId,
69
58
  objectId = _ref.objectId,
70
59
  childObjectId = _ref.childObjectId;
71
- return buildAnalyticsPayload('inviteItem', 'rendered', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
72
- containerId: containerId,
73
- objectId: objectId,
74
- childObjectId: childObjectId,
75
- userRole: userRole
76
- });
60
+ return {
61
+ action: _analytics.ACTION.RENDERED,
62
+ actionSubject: _analytics.ACTION_SUBJECT.INVITE_ITEM,
63
+ eventType: _analytics.EVENT_TYPE.UI,
64
+ attributes: {
65
+ componentName: componentName,
66
+ containerId: containerId,
67
+ objectId: objectId,
68
+ childObjectId: childObjectId,
69
+ userRole: userRole,
70
+ sessionId: sessionId
71
+ }
72
+ };
77
73
  };
78
74
  var buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInviteItemClickedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole) {
79
75
  var _extractAttributesFro2 = extractAttributesFromQuery(query),
@@ -83,57 +79,76 @@ var buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteItemCli
83
79
  containerId = _ref2.containerId,
84
80
  objectId = _ref2.objectId,
85
81
  childObjectId = _ref2.childObjectId;
86
- return buildAnalyticsPayload('inviteItem', isClicked(insertType) ? 'clicked' : 'pressed', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
87
- duration: duration,
88
- queryLength: queryLength,
89
- spaceInQuery: spaceInQuery,
90
- upKeyCount: upKeyCount,
91
- downKeyCount: downKeyCount,
92
- containerId: containerId,
93
- objectId: objectId,
94
- childObjectId: childObjectId,
95
- userRole: userRole
96
- });
82
+ return {
83
+ action: isClicked(insertType) ? _analytics.ACTION.CLICKED : _analytics.ACTION.PRESSED,
84
+ actionSubject: _analytics.ACTION_SUBJECT.INVITE_ITEM,
85
+ eventType: _analytics.EVENT_TYPE.UI,
86
+ attributes: {
87
+ componentName: componentName,
88
+ duration: duration,
89
+ queryLength: queryLength,
90
+ spaceInQuery: spaceInQuery,
91
+ upKeyCount: upKeyCount,
92
+ downKeyCount: downKeyCount,
93
+ containerId: containerId,
94
+ objectId: objectId,
95
+ childObjectId: childObjectId,
96
+ userRole: userRole,
97
+ sessionId: sessionId,
98
+ keyboardKey: isClicked(insertType) ? undefined : insertType
99
+ }
100
+ };
97
101
  };
98
102
  var buildTypeAheadInsertedPayload = exports.buildTypeAheadInsertedPayload = function buildTypeAheadInsertedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, mention, mentionLocalId, mentionList, query, contextIdentifierProvider, taskListId, taskItemId) {
99
103
  var _extractAttributesFro3 = extractAttributesFromQuery(query),
100
104
  queryLength = _extractAttributesFro3.queryLength,
101
105
  spaceInQuery = _extractAttributesFro3.spaceInQuery;
102
- var analyticsPayload = buildAnalyticsPayload('mentionTypeahead', isClicked(insertType) ? 'clicked' : 'pressed', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
103
- duration: duration,
104
- position: getPosition(mentionList, mention),
105
- keyboardKey: isClicked(insertType) ? undefined : insertType,
106
- source: mention.source,
107
- queryLength: queryLength,
108
- spaceInQuery: spaceInQuery,
109
- isSpecial: (0, _resource.isSpecialMention)(mention),
110
- accessLevel: mention.accessLevel || '',
111
- userType: mention.userType,
112
- userId: mention.id,
113
- upKeyCount: upKeyCount,
114
- downKeyCount: downKeyCount,
115
- memberCount: (0, _utils.isTeamType)(mention.userType) && mention.context ? mention.context.memberCount : null,
116
- includesYou: (0, _utils.isTeamType)(mention.userType) && mention.context ? mention.context.includesYou : null,
117
- taskListId: taskListId,
118
- taskItemId: taskItemId,
119
- localId: mentionLocalId
120
- });
106
+ var containerId;
107
+ var objectId;
108
+ var childObjectId;
121
109
  if (contextIdentifierProvider) {
122
- analyticsPayload.containerId = contextIdentifierProvider.containerId || undefined;
123
- analyticsPayload.objectId = contextIdentifierProvider.objectId || undefined;
124
- analyticsPayload.childObjectId = contextIdentifierProvider.childObjectId || undefined;
110
+ containerId = contextIdentifierProvider.containerId || undefined;
111
+ objectId = contextIdentifierProvider.objectId || undefined;
112
+ childObjectId = contextIdentifierProvider.childObjectId || undefined;
125
113
  }
126
- return analyticsPayload;
114
+ return {
115
+ action: isClicked(insertType) ? _analytics.ACTION.CLICKED : _analytics.ACTION.PRESSED,
116
+ actionSubject: _analytics.ACTION_SUBJECT.MENTION_TYPEAHEAD,
117
+ eventType: _analytics.EVENT_TYPE.UI,
118
+ attributes: {
119
+ sessionId: sessionId,
120
+ duration: duration,
121
+ position: getPosition(mentionList, mention),
122
+ keyboardKey: isClicked(insertType) ? undefined : insertType,
123
+ source: mention.source,
124
+ queryLength: queryLength,
125
+ spaceInQuery: spaceInQuery,
126
+ isSpecial: (0, _resource.isSpecialMention)(mention),
127
+ accessLevel: mention.accessLevel || '',
128
+ userType: mention.userType,
129
+ userId: mention.id,
130
+ upKeyCount: upKeyCount,
131
+ downKeyCount: downKeyCount,
132
+ memberCount: (0, _utils.isTeamType)(mention.userType) && mention.context ? mention.context.memberCount : null,
133
+ includesYou: (0, _utils.isTeamType)(mention.userType) && mention.context ? mention.context.includesYou : null,
134
+ taskListId: taskListId,
135
+ taskItemId: taskItemId,
136
+ localId: mentionLocalId,
137
+ containerId: containerId,
138
+ objectId: objectId,
139
+ childObjectId: childObjectId
140
+ }
141
+ };
127
142
  };
128
143
  var buildTypeAheadRenderedPayload = exports.buildTypeAheadRenderedPayload = function buildTypeAheadRenderedPayload(duration, userIds, query, teams) {
129
144
  var _extractAttributesFro4 = extractAttributesFromQuery(query),
130
145
  queryLength = _extractAttributesFro4.queryLength,
131
146
  spaceInQuery = _extractAttributesFro4.spaceInQuery;
132
- var actionSubject = userIds ? 'mentionTypeahead' : 'teamMentionTypeahead';
147
+ var actionSubject = userIds ? _analytics.ACTION_SUBJECT.MENTION_TYPEAHEAD : _analytics.ACTION_SUBJECT.TEAM_MENTION_TYPEAHEAD;
133
148
  return {
134
- action: 'rendered',
149
+ action: _analytics.ACTION.RENDERED,
135
150
  actionSubject: actionSubject,
136
- eventType: _analyticsGasTypes.OPERATIONAL_EVENT_TYPE,
151
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
137
152
  attributes: {
138
153
  componentName: componentName,
139
154
  duration: duration,
@@ -12,7 +12,6 @@ var _adfSchema = require("@atlaskit/adf-schema");
12
12
  var _analytics = require("@atlaskit/editor-common/analytics");
13
13
  var _messages = require("@atlaskit/editor-common/messages");
14
14
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
15
- var _resource = require("@atlaskit/mention/resource");
16
15
  var _key = require("./pm-plugins/key");
17
16
  var _main = require("./pm-plugins/main");
18
17
  var _typeAhead = require("./type-ahead");
@@ -23,17 +22,16 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
23
22
  var options = _ref.config,
24
23
  api = _ref.api;
25
24
  var sessionId = (0, _uuid.default)();
26
- var fireEvent = function fireEvent(payload) {
27
- var _api$analytics$shared, _api$analytics;
28
- var _ref2 = (_api$analytics$shared = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.sharedState.currentState()) !== null && _api$analytics$shared !== void 0 ? _api$analytics$shared : {},
29
- createAnalyticsEvent = _ref2.createAnalyticsEvent;
30
- if (!createAnalyticsEvent) {
25
+ var fireEvent = function fireEvent(payload, channel) {
26
+ var _api$analytics;
27
+ var fireAnalyticsEvent = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent;
28
+ if (!fireAnalyticsEvent) {
31
29
  return;
32
30
  }
33
31
  if (payload.attributes && !payload.attributes.sessionId) {
34
32
  payload.attributes.sessionId = sessionId;
35
33
  }
36
- createAnalyticsEvent(payload).fire(_resource.ELEMENTS_CHANNEL);
34
+ fireAnalyticsEvent(payload, channel);
37
35
  };
38
36
  var typeAhead = (0, _typeAhead.createTypeAheadConfig)({
39
37
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
@@ -59,9 +57,9 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
59
57
  }
60
58
  }];
61
59
  },
62
- secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
63
- var editorView = _ref3.editorView,
64
- disabled = _ref3.disabled;
60
+ secondaryToolbarComponent: function secondaryToolbarComponent(_ref2) {
61
+ var editorView = _ref2.editorView,
62
+ disabled = _ref2.disabled;
65
63
  return /*#__PURE__*/_react.default.createElement(_SecondaryToolbarComponent.SecondaryToolbarComponent, {
66
64
  editorView: editorView,
67
65
  api: api,
@@ -93,8 +91,8 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
93
91
  });
94
92
  },
95
93
  pluginsOptions: {
96
- quickInsert: function quickInsert(_ref4) {
97
- var formatMessage = _ref4.formatMessage;
94
+ quickInsert: function quickInsert(_ref3) {
95
+ var formatMessage = _ref3.formatMessage;
98
96
  return [{
99
97
  id: 'mention',
100
98
  title: formatMessage(_messages.toolbarInsertBlockMessages.mention),
@@ -11,9 +11,10 @@ var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _utils = require("@atlaskit/editor-prosemirror/utils");
13
13
  var _resource = require("@atlaskit/mention/resource");
14
+ var _types = require("@atlaskit/mention/types");
14
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _mention = require("../nodeviews/mention");
16
- var _types = require("../types");
17
+ var _types2 = require("../types");
17
18
  var _key = require("./key");
18
19
  var _utils2 = require("./utils");
19
20
  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; }
@@ -21,6 +22,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
21
22
  var ACTIONS = {
22
23
  SET_PROVIDER: 'SET_PROVIDER'
23
24
  };
25
+ var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
26
+ var PACKAGE_VERSION = "2.9.0";
24
27
  var setProvider = function setProvider(provider) {
25
28
  return function (state, dispatch) {
26
29
  if (dispatch) {
@@ -38,7 +41,16 @@ function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
38
41
  var mentionProvider;
39
42
  var sendAnalytics = function sendAnalytics(event, actionSubject, action, attributes) {
40
43
  if (event === _resource.SLI_EVENT_TYPE || event === _resource.SMART_EVENT_TYPE) {
41
- fireEvent((0, _resource.buildSliPayload)(actionSubject, action, attributes));
44
+ fireEvent({
45
+ action: action,
46
+ actionSubject: actionSubject,
47
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
48
+ attributes: _objectSpread({
49
+ packageName: PACKAGE_NAME,
50
+ packageVersion: PACKAGE_VERSION,
51
+ componentName: _types.ComponentNames.MENTION
52
+ }, attributes)
53
+ }, 'fabricElements');
42
54
  }
43
55
  };
44
56
  return new _safePlugin.SafePlugin({
@@ -103,7 +115,7 @@ function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
103
115
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.MENTION_PROVIDER,
104
116
  eventType: _analytics.EVENT_TYPE.OPERATIONAL,
105
117
  attributes: {
106
- reason: _types.MENTION_PROVIDER_UNDEFINED
118
+ reason: _types2.MENTION_PROVIDER_UNDEFINED
107
119
  }
108
120
  });
109
121
  return setProvider(undefined)(editorView.state, editorView.dispatch);
@@ -122,7 +134,7 @@ function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
122
134
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.MENTION_PROVIDER,
123
135
  eventType: _analytics.EVENT_TYPE.OPERATIONAL,
124
136
  attributes: {
125
- reason: _types.MENTION_PROVIDER_REJECTED
137
+ reason: _types2.MENTION_PROVIDER_REJECTED
126
138
  }
127
139
  });
128
140
  return setProvider(undefined)(editorView.state, editorView.dispatch);
@@ -141,7 +141,7 @@ var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAh
141
141
  });
142
142
  }
143
143
  var payload = (0, _analytics.buildTypeAheadRenderedPayload)(duration, userOrTeamIds, query, teams);
144
- fireEvent(payload);
144
+ fireEvent(payload, 'fabric-elements');
145
145
  };
146
146
  };
147
147
 
@@ -368,7 +368,7 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
368
368
  firstQueryWithoutResults = null;
369
369
  var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
370
370
  if (!wasItemInserted) {
371
- fireEvent((0, _analytics.buildTypeAheadCancelPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
371
+ fireEvent((0, _analytics.buildTypeAheadCancelPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''), 'fabric-elements');
372
372
  }
373
373
  var pluginState = (0, _utils3.getMentionPluginState)(editorState);
374
374
  if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
@@ -1,18 +1,7 @@
1
- import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
1
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
2
  import { isSpecialMention } from '@atlaskit/mention/resource';
3
3
  import { isTeamType } from './utils';
4
4
  const componentName = 'mention';
5
- export const buildAnalyticsPayload = (actionSubject, action, eventType, sessionId, otherAttributes = {}, tags = []) => ({
6
- action,
7
- actionSubject,
8
- eventType,
9
- attributes: {
10
- componentName,
11
- sessionId,
12
- ...otherAttributes
13
- },
14
- tags
15
- });
16
5
  const emptyQueryResponse = {
17
6
  queryLength: 0,
18
7
  spaceInQuery: false
@@ -31,13 +20,20 @@ export const buildTypeAheadCancelPayload = (duration, upKeyCount, downKeyCount,
31
20
  queryLength,
32
21
  spaceInQuery
33
22
  } = extractAttributesFromQuery(query);
34
- return buildAnalyticsPayload('mentionTypeahead', 'cancelled', UI_EVENT_TYPE, sessionId, {
35
- duration,
36
- downKeyCount,
37
- upKeyCount,
38
- queryLength,
39
- spaceInQuery
40
- });
23
+ return {
24
+ action: ACTION.CANCELLED,
25
+ actionSubject: ACTION_SUBJECT.MENTION_TYPEAHEAD,
26
+ eventType: EVENT_TYPE.UI,
27
+ attributes: {
28
+ componentName,
29
+ duration,
30
+ queryLength,
31
+ spaceInQuery,
32
+ upKeyCount,
33
+ downKeyCount,
34
+ sessionId
35
+ }
36
+ };
41
37
  };
42
38
  const getPosition = (mentionList, selectedMention) => {
43
39
  if (mentionList) {
@@ -53,12 +49,19 @@ export const buildTypeAheadInviteItemViewedPayload = (sessionId, contextIdentifi
53
49
  objectId,
54
50
  childObjectId
55
51
  } = contextIdentifierProvider || {};
56
- return buildAnalyticsPayload('inviteItem', 'rendered', UI_EVENT_TYPE, sessionId, {
57
- containerId,
58
- objectId,
59
- childObjectId,
60
- userRole
61
- });
52
+ return {
53
+ action: ACTION.RENDERED,
54
+ actionSubject: ACTION_SUBJECT.INVITE_ITEM,
55
+ eventType: EVENT_TYPE.UI,
56
+ attributes: {
57
+ componentName,
58
+ containerId,
59
+ objectId,
60
+ childObjectId,
61
+ userRole,
62
+ sessionId
63
+ }
64
+ };
62
65
  };
63
66
  export const buildTypeAheadInviteItemClickedPayload = (duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole) => {
64
67
  const {
@@ -70,59 +73,78 @@ export const buildTypeAheadInviteItemClickedPayload = (duration, upKeyCount, dow
70
73
  objectId,
71
74
  childObjectId
72
75
  } = contextIdentifierProvider || {};
73
- return buildAnalyticsPayload('inviteItem', isClicked(insertType) ? 'clicked' : 'pressed', UI_EVENT_TYPE, sessionId, {
74
- duration,
75
- queryLength,
76
- spaceInQuery,
77
- upKeyCount,
78
- downKeyCount,
79
- containerId,
80
- objectId,
81
- childObjectId,
82
- userRole
83
- });
76
+ return {
77
+ action: isClicked(insertType) ? ACTION.CLICKED : ACTION.PRESSED,
78
+ actionSubject: ACTION_SUBJECT.INVITE_ITEM,
79
+ eventType: EVENT_TYPE.UI,
80
+ attributes: {
81
+ componentName,
82
+ duration,
83
+ queryLength,
84
+ spaceInQuery,
85
+ upKeyCount,
86
+ downKeyCount,
87
+ containerId,
88
+ objectId,
89
+ childObjectId,
90
+ userRole,
91
+ sessionId,
92
+ keyboardKey: isClicked(insertType) ? undefined : insertType
93
+ }
94
+ };
84
95
  };
85
96
  export const buildTypeAheadInsertedPayload = (duration, upKeyCount, downKeyCount, sessionId, insertType, mention, mentionLocalId, mentionList, query, contextIdentifierProvider, taskListId, taskItemId) => {
86
97
  const {
87
98
  queryLength,
88
99
  spaceInQuery
89
100
  } = extractAttributesFromQuery(query);
90
- let analyticsPayload = buildAnalyticsPayload('mentionTypeahead', isClicked(insertType) ? 'clicked' : 'pressed', UI_EVENT_TYPE, sessionId, {
91
- duration,
92
- position: getPosition(mentionList, mention),
93
- keyboardKey: isClicked(insertType) ? undefined : insertType,
94
- source: mention.source,
95
- queryLength,
96
- spaceInQuery,
97
- isSpecial: isSpecialMention(mention),
98
- accessLevel: mention.accessLevel || '',
99
- userType: mention.userType,
100
- userId: mention.id,
101
- upKeyCount,
102
- downKeyCount,
103
- memberCount: isTeamType(mention.userType) && mention.context ? mention.context.memberCount : null,
104
- includesYou: isTeamType(mention.userType) && mention.context ? mention.context.includesYou : null,
105
- taskListId,
106
- taskItemId,
107
- localId: mentionLocalId
108
- });
101
+ let containerId;
102
+ let objectId;
103
+ let childObjectId;
109
104
  if (contextIdentifierProvider) {
110
- analyticsPayload.containerId = contextIdentifierProvider.containerId || undefined;
111
- analyticsPayload.objectId = contextIdentifierProvider.objectId || undefined;
112
- analyticsPayload.childObjectId = contextIdentifierProvider.childObjectId || undefined;
105
+ containerId = contextIdentifierProvider.containerId || undefined;
106
+ objectId = contextIdentifierProvider.objectId || undefined;
107
+ childObjectId = contextIdentifierProvider.childObjectId || undefined;
113
108
  }
114
- return analyticsPayload;
109
+ return {
110
+ action: isClicked(insertType) ? ACTION.CLICKED : ACTION.PRESSED,
111
+ actionSubject: ACTION_SUBJECT.MENTION_TYPEAHEAD,
112
+ eventType: EVENT_TYPE.UI,
113
+ attributes: {
114
+ sessionId,
115
+ duration,
116
+ position: getPosition(mentionList, mention),
117
+ keyboardKey: isClicked(insertType) ? undefined : insertType,
118
+ source: mention.source,
119
+ queryLength,
120
+ spaceInQuery,
121
+ isSpecial: isSpecialMention(mention),
122
+ accessLevel: mention.accessLevel || '',
123
+ userType: mention.userType,
124
+ userId: mention.id,
125
+ upKeyCount,
126
+ downKeyCount,
127
+ memberCount: isTeamType(mention.userType) && mention.context ? mention.context.memberCount : null,
128
+ includesYou: isTeamType(mention.userType) && mention.context ? mention.context.includesYou : null,
129
+ taskListId,
130
+ taskItemId,
131
+ localId: mentionLocalId,
132
+ containerId,
133
+ objectId,
134
+ childObjectId
135
+ }
136
+ };
115
137
  };
116
138
  export const buildTypeAheadRenderedPayload = (duration, userIds, query, teams) => {
117
139
  const {
118
140
  queryLength,
119
141
  spaceInQuery
120
142
  } = extractAttributesFromQuery(query);
121
- const actionSubject = userIds ? 'mentionTypeahead' : 'teamMentionTypeahead';
143
+ const actionSubject = userIds ? ACTION_SUBJECT.MENTION_TYPEAHEAD : ACTION_SUBJECT.TEAM_MENTION_TYPEAHEAD;
122
144
  return {
123
- action: 'rendered',
145
+ action: ACTION.RENDERED,
124
146
  actionSubject,
125
- eventType: OPERATIONAL_EVENT_TYPE,
147
+ eventType: EVENT_TYPE.OPERATIONAL,
126
148
  attributes: {
127
149
  componentName,
128
150
  duration,
@@ -4,7 +4,6 @@ import { mention } from '@atlaskit/adf-schema';
4
4
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { IconMention } from '@atlaskit/editor-common/quick-insert';
7
- import { ELEMENTS_CHANNEL } from '@atlaskit/mention/resource';
8
7
  import { mentionPluginKey } from './pm-plugins/key';
9
8
  import { createMentionPlugin } from './pm-plugins/main';
10
9
  import { createTypeAheadConfig } from './type-ahead';
@@ -14,18 +13,16 @@ const mentionsPlugin = ({
14
13
  api
15
14
  }) => {
16
15
  let sessionId = uuid();
17
- const fireEvent = payload => {
18
- var _api$analytics$shared, _api$analytics;
19
- const {
20
- createAnalyticsEvent
21
- } = (_api$analytics$shared = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.sharedState.currentState()) !== null && _api$analytics$shared !== void 0 ? _api$analytics$shared : {};
22
- if (!createAnalyticsEvent) {
16
+ const fireEvent = (payload, channel) => {
17
+ var _api$analytics, _api$analytics$action;
18
+ const fireAnalyticsEvent = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.fireAnalyticsEvent;
19
+ if (!fireAnalyticsEvent) {
23
20
  return;
24
21
  }
25
22
  if (payload.attributes && !payload.attributes.sessionId) {
26
23
  payload.attributes.sessionId = sessionId;
27
24
  }
28
- createAnalyticsEvent(payload).fire(ELEMENTS_CHANNEL);
25
+ fireAnalyticsEvent(payload, channel);
29
26
  };
30
27
  const typeAhead = createTypeAheadConfig({
31
28
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
@@ -2,7 +2,8 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
2
2
  import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
5
- import { buildSliPayload, SLI_EVENT_TYPE, SMART_EVENT_TYPE } from '@atlaskit/mention/resource';
5
+ import { SLI_EVENT_TYPE, SMART_EVENT_TYPE } from '@atlaskit/mention/resource';
6
+ import { ComponentNames } from '@atlaskit/mention/types';
6
7
  import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { MentionNodeView } from '../nodeviews/mention';
8
9
  import { MENTION_PROVIDER_REJECTED, MENTION_PROVIDER_UNDEFINED } from '../types';
@@ -11,6 +12,8 @@ import { canMentionBeCreatedInRange } from './utils';
11
12
  const ACTIONS = {
12
13
  SET_PROVIDER: 'SET_PROVIDER'
13
14
  };
15
+ const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
16
+ const PACKAGE_VERSION = "2.9.0";
14
17
  const setProvider = provider => (state, dispatch) => {
15
18
  if (dispatch) {
16
19
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -26,7 +29,17 @@ export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
26
29
  let mentionProvider;
27
30
  const sendAnalytics = (event, actionSubject, action, attributes) => {
28
31
  if (event === SLI_EVENT_TYPE || event === SMART_EVENT_TYPE) {
29
- fireEvent(buildSliPayload(actionSubject, action, attributes));
32
+ fireEvent({
33
+ action: action,
34
+ actionSubject: actionSubject,
35
+ eventType: EVENT_TYPE.OPERATIONAL,
36
+ attributes: {
37
+ packageName: PACKAGE_NAME,
38
+ packageVersion: PACKAGE_VERSION,
39
+ componentName: ComponentNames.MENTION,
40
+ ...attributes
41
+ }
42
+ }, 'fabricElements');
30
43
  }
31
44
  };
32
45
  return new SafePlugin({
@@ -112,7 +112,7 @@ const buildAndSendElementsTypeAheadAnalytics = fireEvent => ({
112
112
  } : null).filter(m => !!m);
113
113
  }
114
114
  const payload = buildTypeAheadRenderedPayload(duration, userOrTeamIds, query, teams);
115
- fireEvent(payload);
115
+ fireEvent(payload, 'fabric-elements');
116
116
  };
117
117
 
118
118
  /**
@@ -353,7 +353,7 @@ export const createTypeAheadConfig = ({
353
353
  firstQueryWithoutResults = null;
354
354
  const pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
355
355
  if (!wasItemInserted) {
356
- fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
356
+ fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''), 'fabric-elements');
357
357
  }
358
358
  const pluginState = getMentionPluginState(editorState);
359
359
  if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
@@ -1,24 +1,7 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- 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; }
3
- 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) { _defineProperty(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; }
4
- import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-types';
1
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
5
2
  import { isSpecialMention } from '@atlaskit/mention/resource';
6
3
  import { isTeamType } from './utils';
7
4
  var componentName = 'mention';
8
- export var buildAnalyticsPayload = function buildAnalyticsPayload(actionSubject, action, eventType, sessionId) {
9
- var otherAttributes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
10
- var tags = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
11
- return {
12
- action: action,
13
- actionSubject: actionSubject,
14
- eventType: eventType,
15
- attributes: _objectSpread({
16
- componentName: componentName,
17
- sessionId: sessionId
18
- }, otherAttributes),
19
- tags: tags
20
- };
21
- };
22
5
  var emptyQueryResponse = {
23
6
  queryLength: 0,
24
7
  spaceInQuery: false
@@ -36,13 +19,20 @@ export var buildTypeAheadCancelPayload = function buildTypeAheadCancelPayload(du
36
19
  var _extractAttributesFro = extractAttributesFromQuery(query),
37
20
  queryLength = _extractAttributesFro.queryLength,
38
21
  spaceInQuery = _extractAttributesFro.spaceInQuery;
39
- return buildAnalyticsPayload('mentionTypeahead', 'cancelled', UI_EVENT_TYPE, sessionId, {
40
- duration: duration,
41
- downKeyCount: downKeyCount,
42
- upKeyCount: upKeyCount,
43
- queryLength: queryLength,
44
- spaceInQuery: spaceInQuery
45
- });
22
+ return {
23
+ action: ACTION.CANCELLED,
24
+ actionSubject: ACTION_SUBJECT.MENTION_TYPEAHEAD,
25
+ eventType: EVENT_TYPE.UI,
26
+ attributes: {
27
+ componentName: componentName,
28
+ duration: duration,
29
+ queryLength: queryLength,
30
+ spaceInQuery: spaceInQuery,
31
+ upKeyCount: upKeyCount,
32
+ downKeyCount: downKeyCount,
33
+ sessionId: sessionId
34
+ }
35
+ };
46
36
  };
47
37
  var getPosition = function getPosition(mentionList, selectedMention) {
48
38
  if (mentionList) {
@@ -61,12 +51,19 @@ export var buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInvite
61
51
  containerId = _ref.containerId,
62
52
  objectId = _ref.objectId,
63
53
  childObjectId = _ref.childObjectId;
64
- return buildAnalyticsPayload('inviteItem', 'rendered', UI_EVENT_TYPE, sessionId, {
65
- containerId: containerId,
66
- objectId: objectId,
67
- childObjectId: childObjectId,
68
- userRole: userRole
69
- });
54
+ return {
55
+ action: ACTION.RENDERED,
56
+ actionSubject: ACTION_SUBJECT.INVITE_ITEM,
57
+ eventType: EVENT_TYPE.UI,
58
+ attributes: {
59
+ componentName: componentName,
60
+ containerId: containerId,
61
+ objectId: objectId,
62
+ childObjectId: childObjectId,
63
+ userRole: userRole,
64
+ sessionId: sessionId
65
+ }
66
+ };
70
67
  };
71
68
  export var buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInviteItemClickedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole) {
72
69
  var _extractAttributesFro2 = extractAttributesFromQuery(query),
@@ -76,57 +73,76 @@ export var buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInvit
76
73
  containerId = _ref2.containerId,
77
74
  objectId = _ref2.objectId,
78
75
  childObjectId = _ref2.childObjectId;
79
- return buildAnalyticsPayload('inviteItem', isClicked(insertType) ? 'clicked' : 'pressed', UI_EVENT_TYPE, sessionId, {
80
- duration: duration,
81
- queryLength: queryLength,
82
- spaceInQuery: spaceInQuery,
83
- upKeyCount: upKeyCount,
84
- downKeyCount: downKeyCount,
85
- containerId: containerId,
86
- objectId: objectId,
87
- childObjectId: childObjectId,
88
- userRole: userRole
89
- });
76
+ return {
77
+ action: isClicked(insertType) ? ACTION.CLICKED : ACTION.PRESSED,
78
+ actionSubject: ACTION_SUBJECT.INVITE_ITEM,
79
+ eventType: EVENT_TYPE.UI,
80
+ attributes: {
81
+ componentName: componentName,
82
+ duration: duration,
83
+ queryLength: queryLength,
84
+ spaceInQuery: spaceInQuery,
85
+ upKeyCount: upKeyCount,
86
+ downKeyCount: downKeyCount,
87
+ containerId: containerId,
88
+ objectId: objectId,
89
+ childObjectId: childObjectId,
90
+ userRole: userRole,
91
+ sessionId: sessionId,
92
+ keyboardKey: isClicked(insertType) ? undefined : insertType
93
+ }
94
+ };
90
95
  };
91
96
  export var buildTypeAheadInsertedPayload = function buildTypeAheadInsertedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, mention, mentionLocalId, mentionList, query, contextIdentifierProvider, taskListId, taskItemId) {
92
97
  var _extractAttributesFro3 = extractAttributesFromQuery(query),
93
98
  queryLength = _extractAttributesFro3.queryLength,
94
99
  spaceInQuery = _extractAttributesFro3.spaceInQuery;
95
- var analyticsPayload = buildAnalyticsPayload('mentionTypeahead', isClicked(insertType) ? 'clicked' : 'pressed', UI_EVENT_TYPE, sessionId, {
96
- duration: duration,
97
- position: getPosition(mentionList, mention),
98
- keyboardKey: isClicked(insertType) ? undefined : insertType,
99
- source: mention.source,
100
- queryLength: queryLength,
101
- spaceInQuery: spaceInQuery,
102
- isSpecial: isSpecialMention(mention),
103
- accessLevel: mention.accessLevel || '',
104
- userType: mention.userType,
105
- userId: mention.id,
106
- upKeyCount: upKeyCount,
107
- downKeyCount: downKeyCount,
108
- memberCount: isTeamType(mention.userType) && mention.context ? mention.context.memberCount : null,
109
- includesYou: isTeamType(mention.userType) && mention.context ? mention.context.includesYou : null,
110
- taskListId: taskListId,
111
- taskItemId: taskItemId,
112
- localId: mentionLocalId
113
- });
100
+ var containerId;
101
+ var objectId;
102
+ var childObjectId;
114
103
  if (contextIdentifierProvider) {
115
- analyticsPayload.containerId = contextIdentifierProvider.containerId || undefined;
116
- analyticsPayload.objectId = contextIdentifierProvider.objectId || undefined;
117
- analyticsPayload.childObjectId = contextIdentifierProvider.childObjectId || undefined;
104
+ containerId = contextIdentifierProvider.containerId || undefined;
105
+ objectId = contextIdentifierProvider.objectId || undefined;
106
+ childObjectId = contextIdentifierProvider.childObjectId || undefined;
118
107
  }
119
- return analyticsPayload;
108
+ return {
109
+ action: isClicked(insertType) ? ACTION.CLICKED : ACTION.PRESSED,
110
+ actionSubject: ACTION_SUBJECT.MENTION_TYPEAHEAD,
111
+ eventType: EVENT_TYPE.UI,
112
+ attributes: {
113
+ sessionId: sessionId,
114
+ duration: duration,
115
+ position: getPosition(mentionList, mention),
116
+ keyboardKey: isClicked(insertType) ? undefined : insertType,
117
+ source: mention.source,
118
+ queryLength: queryLength,
119
+ spaceInQuery: spaceInQuery,
120
+ isSpecial: isSpecialMention(mention),
121
+ accessLevel: mention.accessLevel || '',
122
+ userType: mention.userType,
123
+ userId: mention.id,
124
+ upKeyCount: upKeyCount,
125
+ downKeyCount: downKeyCount,
126
+ memberCount: isTeamType(mention.userType) && mention.context ? mention.context.memberCount : null,
127
+ includesYou: isTeamType(mention.userType) && mention.context ? mention.context.includesYou : null,
128
+ taskListId: taskListId,
129
+ taskItemId: taskItemId,
130
+ localId: mentionLocalId,
131
+ containerId: containerId,
132
+ objectId: objectId,
133
+ childObjectId: childObjectId
134
+ }
135
+ };
120
136
  };
121
137
  export var buildTypeAheadRenderedPayload = function buildTypeAheadRenderedPayload(duration, userIds, query, teams) {
122
138
  var _extractAttributesFro4 = extractAttributesFromQuery(query),
123
139
  queryLength = _extractAttributesFro4.queryLength,
124
140
  spaceInQuery = _extractAttributesFro4.spaceInQuery;
125
- var actionSubject = userIds ? 'mentionTypeahead' : 'teamMentionTypeahead';
141
+ var actionSubject = userIds ? ACTION_SUBJECT.MENTION_TYPEAHEAD : ACTION_SUBJECT.TEAM_MENTION_TYPEAHEAD;
126
142
  return {
127
- action: 'rendered',
143
+ action: ACTION.RENDERED,
128
144
  actionSubject: actionSubject,
129
- eventType: OPERATIONAL_EVENT_TYPE,
145
+ eventType: EVENT_TYPE.OPERATIONAL,
130
146
  attributes: {
131
147
  componentName: componentName,
132
148
  duration: duration,
@@ -7,7 +7,6 @@ import { mention } from '@atlaskit/adf-schema';
7
7
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
8
8
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
9
9
  import { IconMention } from '@atlaskit/editor-common/quick-insert';
10
- import { ELEMENTS_CHANNEL } from '@atlaskit/mention/resource';
11
10
  import { mentionPluginKey } from './pm-plugins/key';
12
11
  import { createMentionPlugin } from './pm-plugins/main';
13
12
  import { createTypeAheadConfig } from './type-ahead';
@@ -16,17 +15,16 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
16
15
  var options = _ref.config,
17
16
  api = _ref.api;
18
17
  var sessionId = uuid();
19
- var fireEvent = function fireEvent(payload) {
20
- var _api$analytics$shared, _api$analytics;
21
- var _ref2 = (_api$analytics$shared = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.sharedState.currentState()) !== null && _api$analytics$shared !== void 0 ? _api$analytics$shared : {},
22
- createAnalyticsEvent = _ref2.createAnalyticsEvent;
23
- if (!createAnalyticsEvent) {
18
+ var fireEvent = function fireEvent(payload, channel) {
19
+ var _api$analytics;
20
+ var fireAnalyticsEvent = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent;
21
+ if (!fireAnalyticsEvent) {
24
22
  return;
25
23
  }
26
24
  if (payload.attributes && !payload.attributes.sessionId) {
27
25
  payload.attributes.sessionId = sessionId;
28
26
  }
29
- createAnalyticsEvent(payload).fire(ELEMENTS_CHANNEL);
27
+ fireAnalyticsEvent(payload, channel);
30
28
  };
31
29
  var typeAhead = createTypeAheadConfig({
32
30
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
@@ -52,9 +50,9 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
52
50
  }
53
51
  }];
54
52
  },
55
- secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
56
- var editorView = _ref3.editorView,
57
- disabled = _ref3.disabled;
53
+ secondaryToolbarComponent: function secondaryToolbarComponent(_ref2) {
54
+ var editorView = _ref2.editorView,
55
+ disabled = _ref2.disabled;
58
56
  return /*#__PURE__*/React.createElement(SecondaryToolbarComponent, {
59
57
  editorView: editorView,
60
58
  api: api,
@@ -86,8 +84,8 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
86
84
  });
87
85
  },
88
86
  pluginsOptions: {
89
- quickInsert: function quickInsert(_ref4) {
90
- var formatMessage = _ref4.formatMessage;
87
+ quickInsert: function quickInsert(_ref3) {
88
+ var formatMessage = _ref3.formatMessage;
91
89
  return [{
92
90
  id: 'mention',
93
91
  title: formatMessage(messages.mention),
@@ -5,7 +5,8 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
5
5
  import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
8
- import { buildSliPayload, SLI_EVENT_TYPE, SMART_EVENT_TYPE } from '@atlaskit/mention/resource';
8
+ import { SLI_EVENT_TYPE, SMART_EVENT_TYPE } from '@atlaskit/mention/resource';
9
+ import { ComponentNames } from '@atlaskit/mention/types';
9
10
  import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { MentionNodeView } from '../nodeviews/mention';
11
12
  import { MENTION_PROVIDER_REJECTED, MENTION_PROVIDER_UNDEFINED } from '../types';
@@ -14,6 +15,8 @@ import { canMentionBeCreatedInRange } from './utils';
14
15
  var ACTIONS = {
15
16
  SET_PROVIDER: 'SET_PROVIDER'
16
17
  };
18
+ var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
19
+ var PACKAGE_VERSION = "2.9.0";
17
20
  var setProvider = function setProvider(provider) {
18
21
  return function (state, dispatch) {
19
22
  if (dispatch) {
@@ -31,7 +34,16 @@ export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
31
34
  var mentionProvider;
32
35
  var sendAnalytics = function sendAnalytics(event, actionSubject, action, attributes) {
33
36
  if (event === SLI_EVENT_TYPE || event === SMART_EVENT_TYPE) {
34
- fireEvent(buildSliPayload(actionSubject, action, attributes));
37
+ fireEvent({
38
+ action: action,
39
+ actionSubject: actionSubject,
40
+ eventType: EVENT_TYPE.OPERATIONAL,
41
+ attributes: _objectSpread({
42
+ packageName: PACKAGE_NAME,
43
+ packageVersion: PACKAGE_VERSION,
44
+ componentName: ComponentNames.MENTION
45
+ }, attributes)
46
+ }, 'fabricElements');
35
47
  }
36
48
  };
37
49
  return new SafePlugin({
@@ -129,7 +129,7 @@ var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAh
129
129
  });
130
130
  }
131
131
  var payload = buildTypeAheadRenderedPayload(duration, userOrTeamIds, query, teams);
132
- fireEvent(payload);
132
+ fireEvent(payload, 'fabric-elements');
133
133
  };
134
134
  };
135
135
 
@@ -356,7 +356,7 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
356
356
  firstQueryWithoutResults = null;
357
357
  var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
358
358
  if (!wasItemInserted) {
359
- fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
359
+ fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''), 'fabric-elements');
360
360
  }
361
361
  var pluginState = getMentionPluginState(editorState);
362
362
  if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
@@ -1,12 +1,11 @@
1
- import type { EventType, GasPayload } from '@atlaskit/analytics-gas-types';
1
+ import { type AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
2
2
  import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
4
  import type { UserRole } from '@atlaskit/mention';
5
5
  import type { MentionDescription } from '@atlaskit/mention/resource';
6
6
  import type { TeamInfoAttrAnalytics } from './types';
7
- export declare const buildAnalyticsPayload: (actionSubject: string, action: string, eventType: EventType, sessionId: string, otherAttributes?: {}, tags?: Array<string>) => GasPayload;
8
- export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => GasPayload;
9
- export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => GasPayload;
10
- export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => GasPayload;
11
- export declare const buildTypeAheadInsertedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, mention: MentionDescription, mentionLocalId: string, mentionList?: MentionDescription[], query?: string, contextIdentifierProvider?: ContextIdentifierProvider, taskListId?: string, taskItemId?: string) => GasPayload;
12
- export declare const buildTypeAheadRenderedPayload: (duration: number, userIds: Array<string> | null, query: string, teams: TeamInfoAttrAnalytics[] | null) => GasPayload;
7
+ export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => AnalyticsEventPayload;
8
+ export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => AnalyticsEventPayload;
9
+ export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => AnalyticsEventPayload;
10
+ export declare const buildTypeAheadInsertedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, mention: MentionDescription, mentionLocalId: string, mentionList?: MentionDescription[], query?: string, contextIdentifierProvider?: ContextIdentifierProvider, taskListId?: string, taskItemId?: string) => AnalyticsEventPayload;
11
+ export declare const buildTypeAheadRenderedPayload: (duration: number, userIds: Array<string> | null, query: string, teams: TeamInfoAttrAnalytics[] | null) => AnalyticsEventPayload;
@@ -1,5 +1,4 @@
1
- import type { GasPayload } from '@atlaskit/analytics-gas-types';
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
2
  import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
4
- import { type MentionPluginOptions, type MentionPluginState } from '../types';
5
- export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: (payload: GasPayload) => void, options?: MentionPluginOptions): SafePlugin<MentionPluginState>;
3
+ import { type FireElementsChannelEvent, type MentionPluginOptions, type MentionPluginState } from '../types';
4
+ export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: FireElementsChannelEvent, options?: MentionPluginOptions): SafePlugin<MentionPluginState>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
+ import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
3
3
  import { type ProfilecardProvider } from '@atlaskit/editor-common/src/provider-factory/profile-card-provider';
4
4
  import type { NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
5
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
@@ -33,7 +33,7 @@ export type MentionPluginState = {
33
33
  mentions?: Array<MentionDescription>;
34
34
  canInsertMention?: boolean;
35
35
  };
36
- export type FireElementsChannelEvent = <T extends AnalyticsEventPayload>(payload: T) => void;
36
+ export type FireElementsChannelEvent = (payload: AnalyticsEventPayload, channel?: string) => void;
37
37
  export type MentionSharedState = MentionPluginState & {
38
38
  typeAheadHandler: TypeAheadHandler;
39
39
  };
@@ -1,12 +1,11 @@
1
- import type { EventType, GasPayload } from '@atlaskit/analytics-gas-types';
1
+ import { type AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
2
2
  import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
4
  import type { UserRole } from '@atlaskit/mention';
5
5
  import type { MentionDescription } from '@atlaskit/mention/resource';
6
6
  import type { TeamInfoAttrAnalytics } from './types';
7
- export declare const buildAnalyticsPayload: (actionSubject: string, action: string, eventType: EventType, sessionId: string, otherAttributes?: {}, tags?: Array<string>) => GasPayload;
8
- export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => GasPayload;
9
- export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => GasPayload;
10
- export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => GasPayload;
11
- export declare const buildTypeAheadInsertedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, mention: MentionDescription, mentionLocalId: string, mentionList?: MentionDescription[], query?: string, contextIdentifierProvider?: ContextIdentifierProvider, taskListId?: string, taskItemId?: string) => GasPayload;
12
- export declare const buildTypeAheadRenderedPayload: (duration: number, userIds: Array<string> | null, query: string, teams: TeamInfoAttrAnalytics[] | null) => GasPayload;
7
+ export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => AnalyticsEventPayload;
8
+ export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => AnalyticsEventPayload;
9
+ export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => AnalyticsEventPayload;
10
+ export declare const buildTypeAheadInsertedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, mention: MentionDescription, mentionLocalId: string, mentionList?: MentionDescription[], query?: string, contextIdentifierProvider?: ContextIdentifierProvider, taskListId?: string, taskItemId?: string) => AnalyticsEventPayload;
11
+ export declare const buildTypeAheadRenderedPayload: (duration: number, userIds: Array<string> | null, query: string, teams: TeamInfoAttrAnalytics[] | null) => AnalyticsEventPayload;
@@ -1,5 +1,4 @@
1
- import type { GasPayload } from '@atlaskit/analytics-gas-types';
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
2
  import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
4
- import { type MentionPluginOptions, type MentionPluginState } from '../types';
5
- export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: (payload: GasPayload) => void, options?: MentionPluginOptions): SafePlugin<MentionPluginState>;
3
+ import { type FireElementsChannelEvent, type MentionPluginOptions, type MentionPluginState } from '../types';
4
+ export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: FireElementsChannelEvent, options?: MentionPluginOptions): SafePlugin<MentionPluginState>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
+ import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
3
3
  import { type ProfilecardProvider } from '@atlaskit/editor-common/src/provider-factory/profile-card-provider';
4
4
  import type { NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
5
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
@@ -33,7 +33,7 @@ export type MentionPluginState = {
33
33
  mentions?: Array<MentionDescription>;
34
34
  canInsertMention?: boolean;
35
35
  };
36
- export type FireElementsChannelEvent = <T extends AnalyticsEventPayload>(payload: T) => void;
36
+ export type FireElementsChannelEvent = (payload: AnalyticsEventPayload, channel?: string) => void;
37
37
  export type MentionSharedState = MentionPluginState & {
38
38
  typeAheadHandler: TypeAheadHandler;
39
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "2.7.1",
3
+ "version": "2.9.0",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,17 +31,16 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^40.9.0",
35
- "@atlaskit/analytics-gas-types": "^5.1.0",
36
- "@atlaskit/editor-common": "^93.1.0",
37
- "@atlaskit/editor-plugin-analytics": "^1.8.0",
34
+ "@atlaskit/adf-schema": "^40.9.4",
35
+ "@atlaskit/editor-common": "^93.4.0",
36
+ "@atlaskit/editor-plugin-analytics": "^1.10.0",
38
37
  "@atlaskit/editor-plugin-context-identifier": "^1.3.0",
39
- "@atlaskit/editor-plugin-type-ahead": "^1.8.0",
38
+ "@atlaskit/editor-plugin-type-ahead": "^1.9.0",
40
39
  "@atlaskit/editor-prosemirror": "6.0.0",
41
- "@atlaskit/icon": "^22.21.0",
40
+ "@atlaskit/icon": "^22.22.0",
42
41
  "@atlaskit/mention": "^23.3.0",
43
42
  "@atlaskit/platform-feature-flags": "^0.3.0",
44
- "@atlaskit/theme": "^13.0.0",
43
+ "@atlaskit/theme": "^13.1.0",
45
44
  "@atlaskit/tokens": "^2.0.0",
46
45
  "@babel/runtime": "^7.0.0",
47
46
  "@emotion/react": "^11.7.1",
@@ -75,9 +74,6 @@
75
74
  },
76
75
  "@repo/internal": {
77
76
  "dom-events": "use-bind-event-listener",
78
- "analytics": [
79
- "analytics-next"
80
- ],
81
77
  "design-tokens": [
82
78
  "color"
83
79
  ],