@atlaskit/editor-plugin-type-ahead 1.1.9 → 1.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 (38) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/plugin.js +13 -18
  3. package/dist/cjs/pm-plugins/decorations.js +1 -3
  4. package/dist/cjs/pm-plugins/main.js +1 -3
  5. package/dist/cjs/ui/ContentComponent.js +2 -3
  6. package/dist/cjs/ui/TypeAheadMenu.js +3 -3
  7. package/dist/cjs/ui/TypeAheadPopup.js +25 -27
  8. package/dist/cjs/ui/WrapperTypeAhead.js +0 -1
  9. package/dist/es2019/plugin.js +13 -18
  10. package/dist/es2019/pm-plugins/decorations.js +1 -3
  11. package/dist/es2019/pm-plugins/main.js +1 -3
  12. package/dist/es2019/ui/ContentComponent.js +2 -3
  13. package/dist/es2019/ui/TypeAheadMenu.js +3 -3
  14. package/dist/es2019/ui/TypeAheadPopup.js +25 -27
  15. package/dist/es2019/ui/WrapperTypeAhead.js +0 -1
  16. package/dist/esm/plugin.js +14 -19
  17. package/dist/esm/pm-plugins/decorations.js +1 -3
  18. package/dist/esm/pm-plugins/main.js +1 -3
  19. package/dist/esm/ui/ContentComponent.js +2 -3
  20. package/dist/esm/ui/TypeAheadMenu.js +3 -3
  21. package/dist/esm/ui/TypeAheadPopup.js +25 -27
  22. package/dist/esm/ui/WrapperTypeAhead.js +0 -1
  23. package/dist/types/pm-plugins/decorations.d.ts +1 -3
  24. package/dist/types/pm-plugins/main.d.ts +1 -3
  25. package/dist/types/types.d.ts +0 -2
  26. package/dist/types/ui/ContentComponent.d.ts +1 -3
  27. package/dist/types/ui/TypeAheadMenu.d.ts +4 -4
  28. package/dist/types/ui/TypeAheadPopup.d.ts +3 -3
  29. package/dist/types/ui/WrapperTypeAhead.d.ts +1 -3
  30. package/dist/types-ts4.5/pm-plugins/decorations.d.ts +1 -3
  31. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -3
  32. package/dist/types-ts4.5/types.d.ts +0 -2
  33. package/dist/types-ts4.5/ui/ContentComponent.d.ts +1 -3
  34. package/dist/types-ts4.5/ui/TypeAheadMenu.d.ts +4 -4
  35. package/dist/types-ts4.5/ui/TypeAheadPopup.d.ts +3 -3
  36. package/dist/types-ts4.5/ui/WrapperTypeAhead.d.ts +1 -3
  37. package/package.json +6 -7
  38. package/report.api.md +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#99635](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99635)
8
+ [`647b9c0a5da8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/647b9c0a5da8) -
9
+ [ED-23193] Fix typeahead analytics that were not firing to now use EditorAPI to fire events.
10
+ - Updated dependencies
11
+
12
+ ## 1.2.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#99579](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99579)
17
+ [`f222af5687e9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f222af5687e9) -
18
+ Bump adf-schema to 36.3.0 and adf-schema-json to 1.14.0
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 1.1.9
4
25
 
5
26
  ### Patch Changes
@@ -138,9 +138,7 @@ var createCloseTypeAhead = function createCloseTypeAhead(editorViewRef) {
138
138
  */
139
139
  var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
140
140
  var _api$analytics, _api$analytics2;
141
- var options = _ref.config,
142
- api = _ref.api;
143
- var fireAnalyticsCallback = (0, _analytics.fireAnalyticsEvent)(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
141
+ var api = _ref.api;
144
142
  var popupMountRef = {
145
143
  current: null
146
144
  };
@@ -168,8 +166,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
168
166
  getIntl: getIntl,
169
167
  popupMountRef: popupMountRef,
170
168
  reactDispatch: dispatch,
171
- typeAheadHandlers: typeAhead,
172
- createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
169
+ typeAheadHandlers: typeAhead
173
170
  });
174
171
  }
175
172
  }, {
@@ -251,8 +248,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
251
248
  return /*#__PURE__*/_react.default.createElement(_ContentComponent.ContentComponent, {
252
249
  editorView: editorView,
253
250
  popupMountRef: popupMountRef,
254
- api: api,
255
- fireAnalyticsCallback: fireAnalyticsCallback
251
+ api: api
256
252
  });
257
253
  },
258
254
  onEditorViewStateUpdated: function onEditorViewStateUpdated(_ref5) {
@@ -280,17 +276,16 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
280
276
  if (newTriggerHandler !== null && newTriggerHandler !== void 0 && newTriggerHandler.onOpen && isANewHandler) {
281
277
  newTriggerHandler.onOpen(newEditorState);
282
278
  }
283
- if (newTriggerHandler && isANewHandler && options !== null && options !== void 0 && options.createAnalyticsEvent) {
284
- fireAnalyticsCallback({
285
- payload: {
286
- action: _analytics.ACTION.INVOKED,
287
- actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
288
- actionSubjectId: newTriggerHandler.id || 'not_set',
289
- attributes: {
290
- inputMethod: newPluginState.inputMethod || _analytics.INPUT_METHOD.KEYBOARD
291
- },
292
- eventType: _analytics.EVENT_TYPE.UI
293
- }
279
+ if (newTriggerHandler && isANewHandler) {
280
+ var _api$analytics3;
281
+ api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || (_api$analytics3 = _api$analytics3.actions) === null || _api$analytics3 === void 0 || _api$analytics3.fireAnalyticsEvent({
282
+ action: _analytics.ACTION.INVOKED,
283
+ actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
284
+ actionSubjectId: newTriggerHandler.id || 'not_set',
285
+ attributes: {
286
+ inputMethod: newPluginState.inputMethod || _analytics.INPUT_METHOD.KEYBOARD
287
+ },
288
+ eventType: _analytics.EVENT_TYPE.UI
294
289
  });
295
290
  }
296
291
  }
@@ -21,8 +21,7 @@ var _WrapperTypeAhead = require("../ui/WrapperTypeAhead");
21
21
  var _utils = require("../utils");
22
22
  var factoryDecorations = exports.factoryDecorations = function factoryDecorations(_ref) {
23
23
  var intl = _ref.intl,
24
- popupMountRef = _ref.popupMountRef,
25
- createAnalyticsEvent = _ref.createAnalyticsEvent;
24
+ popupMountRef = _ref.popupMountRef;
26
25
  var createDecorations = function createDecorations(tr, _ref2) {
27
26
  var triggerHandler = _ref2.triggerHandler,
28
27
  inputMethod = _ref2.inputMethod,
@@ -86,7 +85,6 @@ var factoryDecorations = exports.factoryDecorations = function factoryDecoration
86
85
  triggerHandler: triggerHandler,
87
86
  editorView: editorView,
88
87
  anchorElement: typeaheadComponent,
89
- createAnalyticsEvent: createAnalyticsEvent,
90
88
  inputMethod: inputMethod,
91
89
  getDecorationPosition: getDecorationPosition,
92
90
  shouldFocusCursorInsideQuery: shouldFocusCursorInsideQuery,
@@ -29,14 +29,12 @@ var hasValidTypeAheadStep = function hasValidTypeAheadStep(tr) {
29
29
  function createPlugin(_ref) {
30
30
  var reactDispatch = _ref.reactDispatch,
31
31
  popupMountRef = _ref.popupMountRef,
32
- createAnalyticsEvent = _ref.createAnalyticsEvent,
33
32
  typeAheadHandlers = _ref.typeAheadHandlers,
34
33
  getIntl = _ref.getIntl;
35
34
  var intl = getIntl();
36
35
  var _factoryDecorations = (0, _decorations.factoryDecorations)({
37
36
  intl: intl,
38
- popupMountRef: popupMountRef,
39
- createAnalyticsEvent: createAnalyticsEvent
37
+ popupMountRef: popupMountRef
40
38
  }),
41
39
  createDecorations = _factoryDecorations.createDecorations,
42
40
  removeDecorations = _factoryDecorations.removeDecorations;
@@ -11,8 +11,7 @@ var _TypeAheadMenu = require("./TypeAheadMenu");
11
11
  function ContentComponent(_ref) {
12
12
  var api = _ref.api,
13
13
  editorView = _ref.editorView,
14
- popupMountRef = _ref.popupMountRef,
15
- fireAnalyticsCallback = _ref.fireAnalyticsCallback;
14
+ popupMountRef = _ref.popupMountRef;
16
15
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['typeAhead']),
17
16
  typeAheadState = _useSharedPluginState.typeAheadState;
18
17
  if (!typeAheadState) {
@@ -22,6 +21,6 @@ function ContentComponent(_ref) {
22
21
  editorView: editorView,
23
22
  popupMountRef: popupMountRef,
24
23
  typeAheadState: typeAheadState,
25
- fireAnalyticsCallback: fireAnalyticsCallback
24
+ api: api
26
25
  });
27
26
  }
@@ -16,7 +16,7 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
16
16
  var editorView = _ref.editorView,
17
17
  popupMountRef = _ref.popupMountRef,
18
18
  typeAheadState = _ref.typeAheadState,
19
- fireAnalyticsCallback = _ref.fireAnalyticsCallback;
19
+ api = _ref.api;
20
20
  var isOpen = typeAheadState.decorationSet.find().length > 0;
21
21
  var triggerHandler = typeAheadState.triggerHandler,
22
22
  items = typeAheadState.items,
@@ -83,13 +83,13 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
83
83
  popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
84
84
  anchorElement: decorationElement,
85
85
  triggerHandler: triggerHandler,
86
- fireAnalyticsCallback: fireAnalyticsCallback,
87
86
  items: items,
88
87
  selectedIndex: selectedIndex,
89
88
  setSelectedItem: setSelectedItem,
90
89
  onItemInsert: insertItem,
91
90
  decorationSet: decorationSet,
92
91
  isEmptyQuery: !query,
93
- cancel: cancel
92
+ cancel: cancel,
93
+ api: api
94
94
  });
95
95
  });
@@ -52,57 +52,55 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
52
52
  items = props.items,
53
53
  selectedIndex = props.selectedIndex,
54
54
  onItemInsert = props.onItemInsert,
55
- fireAnalyticsCallback = props.fireAnalyticsCallback,
56
55
  isEmptyQuery = props.isEmptyQuery,
57
- cancel = props.cancel;
56
+ cancel = props.cancel,
57
+ api = props.api;
58
58
  var ref = (0, _react.useRef)(null);
59
59
  var startTime = (0, _react.useMemo)(function () {
60
60
  return performance.now();
61
61
  },
62
62
  // In case those props changes
63
63
  // we need to recreate the startTime
64
- [items, isEmptyQuery, fireAnalyticsCallback, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
64
+ [items, isEmptyQuery, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
65
65
  );
66
66
  (0, _react.useEffect)(function () {
67
- if (!fireAnalyticsCallback) {
67
+ var _api$analytics, _api$analytics2;
68
+ if (!(api !== null && api !== void 0 && (_api$analytics = api.analytics) !== null && _api$analytics !== void 0 && (_api$analytics = _api$analytics.actions) !== null && _api$analytics !== void 0 && _api$analytics.fireAnalyticsEvent)) {
68
69
  return;
69
70
  }
70
71
  var stopTime = performance.now();
71
72
  var time = stopTime - startTime;
72
- fireAnalyticsCallback({
73
- payload: {
74
- action: _analytics.ACTION.RENDERED,
75
- actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
76
- eventType: _analytics.EVENT_TYPE.OPERATIONAL,
77
- attributes: {
78
- time: time,
79
- items: items.length,
80
- initial: isEmptyQuery
81
- }
73
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
74
+ action: _analytics.ACTION.RENDERED,
75
+ actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
76
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
77
+ attributes: {
78
+ time: time,
79
+ items: items.length,
80
+ initial: isEmptyQuery
82
81
  }
83
82
  });
84
- }, [startTime, items, fireAnalyticsCallback, isEmptyQuery,
83
+ }, [startTime, items, isEmptyQuery,
85
84
  // In case the current triggerHandler changes
86
85
  // e.g: Inserting a mention using the quick insert
87
86
  // we need to send the event again
88
87
  // eslint-disable-next-line react-hooks/exhaustive-deps
89
- triggerHandler]);
88
+ triggerHandler, api]);
90
89
  (0, _react.useEffect)(function () {
91
- if (!fireAnalyticsCallback) {
90
+ var _api$analytics3, _api$analytics4;
91
+ if (!(api !== null && api !== void 0 && (_api$analytics3 = api.analytics) !== null && _api$analytics3 !== void 0 && (_api$analytics3 = _api$analytics3.actions) !== null && _api$analytics3 !== void 0 && _api$analytics3.fireAnalyticsEvent)) {
92
92
  return;
93
93
  }
94
- fireAnalyticsCallback({
95
- payload: {
96
- action: _analytics.ACTION.VIEWED,
97
- actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD_ITEM,
98
- eventType: _analytics.EVENT_TYPE.OPERATIONAL,
99
- attributes: {
100
- index: selectedIndex,
101
- items: items.length
102
- }
94
+ api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || (_api$analytics4 = _api$analytics4.actions) === null || _api$analytics4 === void 0 || _api$analytics4.fireAnalyticsEvent({
95
+ action: _analytics.ACTION.VIEWED,
96
+ actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD_ITEM,
97
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL,
98
+ attributes: {
99
+ index: selectedIndex,
100
+ items: items.length
103
101
  }
104
102
  });
105
- }, [items, fireAnalyticsCallback, selectedIndex,
103
+ }, [items, api, selectedIndex,
106
104
  // In case the current triggerHandler changes
107
105
  // e.g: Inserting a mention using the quick insert
108
106
  // we need to send the event again
@@ -25,7 +25,6 @@ var WrapperTypeAhead = exports.WrapperTypeAhead = /*#__PURE__*/_react.default.me
25
25
  popupsMountPoint = _ref.popupsMountPoint,
26
26
  popupsBoundariesElement = _ref.popupsBoundariesElement,
27
27
  popupsScrollableElement = _ref.popupsScrollableElement,
28
- createAnalyticsEvent = _ref.createAnalyticsEvent,
29
28
  inputMethod = _ref.inputMethod,
30
29
  getDecorationPosition = _ref.getDecorationPosition,
31
30
  reopenQuery = _ref.reopenQuery,
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import React from 'react';
10
10
  import { typeAheadQuery } from '@atlaskit/adf-schema';
11
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
12
12
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
13
13
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
14
14
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -133,11 +133,9 @@ const createCloseTypeAhead = editorViewRef => options => {
133
133
  *
134
134
  */
135
135
  export const typeAheadPlugin = ({
136
- config: options,
137
136
  api
138
137
  }) => {
139
138
  var _api$analytics, _api$analytics2;
140
- const fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
141
139
  const popupMountRef = {
142
140
  current: null
143
141
  };
@@ -164,8 +162,7 @@ export const typeAheadPlugin = ({
164
162
  getIntl,
165
163
  popupMountRef,
166
164
  reactDispatch: dispatch,
167
- typeAheadHandlers: typeAhead,
168
- createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
165
+ typeAheadHandlers: typeAhead
169
166
  })
170
167
  }, {
171
168
  name: 'typeAheadEditorViewRef',
@@ -246,8 +243,7 @@ export const typeAheadPlugin = ({
246
243
  return /*#__PURE__*/React.createElement(ContentComponent, {
247
244
  editorView: editorView,
248
245
  popupMountRef: popupMountRef,
249
- api: api,
250
- fireAnalyticsCallback: fireAnalyticsCallback
246
+ api: api
251
247
  });
252
248
  },
253
249
  onEditorViewStateUpdated({
@@ -280,17 +276,16 @@ export const typeAheadPlugin = ({
280
276
  if (newTriggerHandler !== null && newTriggerHandler !== void 0 && newTriggerHandler.onOpen && isANewHandler) {
281
277
  newTriggerHandler.onOpen(newEditorState);
282
278
  }
283
- if (newTriggerHandler && isANewHandler && options !== null && options !== void 0 && options.createAnalyticsEvent) {
284
- fireAnalyticsCallback({
285
- payload: {
286
- action: ACTION.INVOKED,
287
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
288
- actionSubjectId: newTriggerHandler.id || 'not_set',
289
- attributes: {
290
- inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
291
- },
292
- eventType: EVENT_TYPE.UI
293
- }
279
+ if (newTriggerHandler && isANewHandler) {
280
+ var _api$analytics3, _api$analytics3$actio;
281
+ api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : (_api$analytics3$actio = _api$analytics3.actions) === null || _api$analytics3$actio === void 0 ? void 0 : _api$analytics3$actio.fireAnalyticsEvent({
282
+ action: ACTION.INVOKED,
283
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
284
+ actionSubjectId: newTriggerHandler.id || 'not_set',
285
+ attributes: {
286
+ inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
287
+ },
288
+ eventType: EVENT_TYPE.UI
294
289
  });
295
290
  }
296
291
  }
@@ -14,8 +14,7 @@ import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
14
14
  import { getTypeAheadQuery } from '../utils';
15
15
  export const factoryDecorations = ({
16
16
  intl,
17
- popupMountRef,
18
- createAnalyticsEvent
17
+ popupMountRef
19
18
  }) => {
20
19
  const createDecorations = (tr, {
21
20
  triggerHandler,
@@ -85,7 +84,6 @@ export const factoryDecorations = ({
85
84
  triggerHandler: triggerHandler,
86
85
  editorView: editorView,
87
86
  anchorElement: typeaheadComponent,
88
- createAnalyticsEvent: createAnalyticsEvent,
89
87
  inputMethod: inputMethod,
90
88
  getDecorationPosition: getDecorationPosition,
91
89
  shouldFocusCursorInsideQuery: shouldFocusCursorInsideQuery,
@@ -21,7 +21,6 @@ const hasValidTypeAheadStep = tr => {
21
21
  export function createPlugin({
22
22
  reactDispatch,
23
23
  popupMountRef,
24
- createAnalyticsEvent,
25
24
  typeAheadHandlers,
26
25
  getIntl
27
26
  }) {
@@ -31,8 +30,7 @@ export function createPlugin({
31
30
  removeDecorations
32
31
  } = factoryDecorations({
33
32
  intl,
34
- popupMountRef,
35
- createAnalyticsEvent: createAnalyticsEvent
33
+ popupMountRef
36
34
  });
37
35
  const reducer = createReducer({
38
36
  createDecorations,
@@ -4,8 +4,7 @@ import { TypeAheadMenu } from './TypeAheadMenu';
4
4
  export function ContentComponent({
5
5
  api,
6
6
  editorView,
7
- popupMountRef,
8
- fireAnalyticsCallback
7
+ popupMountRef
9
8
  }) {
10
9
  const {
11
10
  typeAheadState
@@ -17,6 +16,6 @@ export function ContentComponent({
17
16
  editorView: editorView,
18
17
  popupMountRef: popupMountRef,
19
18
  typeAheadState: typeAheadState,
20
- fireAnalyticsCallback: fireAnalyticsCallback
19
+ api: api
21
20
  });
22
21
  }
@@ -7,7 +7,7 @@ export const TypeAheadMenu = /*#__PURE__*/React.memo(({
7
7
  editorView,
8
8
  popupMountRef,
9
9
  typeAheadState,
10
- fireAnalyticsCallback
10
+ api
11
11
  }) => {
12
12
  var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
13
13
  const isOpen = typeAheadState.decorationSet.find().length > 0;
@@ -74,13 +74,13 @@ export const TypeAheadMenu = /*#__PURE__*/React.memo(({
74
74
  popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
75
75
  anchorElement: decorationElement,
76
76
  triggerHandler: triggerHandler,
77
- fireAnalyticsCallback: fireAnalyticsCallback,
78
77
  items: items,
79
78
  selectedIndex: selectedIndex,
80
79
  setSelectedItem: setSelectedItem,
81
80
  onItemInsert: insertItem,
82
81
  decorationSet: decorationSet,
83
82
  isEmptyQuery: !query,
84
- cancel: cancel
83
+ cancel: cancel,
84
+ api: api
85
85
  });
86
86
  });
@@ -42,56 +42,54 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
42
42
  items,
43
43
  selectedIndex,
44
44
  onItemInsert,
45
- fireAnalyticsCallback,
46
45
  isEmptyQuery,
47
- cancel
46
+ cancel,
47
+ api
48
48
  } = props;
49
49
  const ref = useRef(null);
50
50
  const startTime = useMemo(() => performance.now(),
51
51
  // In case those props changes
52
52
  // we need to recreate the startTime
53
- [items, isEmptyQuery, fireAnalyticsCallback, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
53
+ [items, isEmptyQuery, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
54
54
  );
55
55
  useEffect(() => {
56
- if (!fireAnalyticsCallback) {
56
+ var _api$analytics, _api$analytics$action, _api$analytics2, _api$analytics2$actio;
57
+ if (!(api !== null && api !== void 0 && (_api$analytics = api.analytics) !== null && _api$analytics !== void 0 && (_api$analytics$action = _api$analytics.actions) !== null && _api$analytics$action !== void 0 && _api$analytics$action.fireAnalyticsEvent)) {
57
58
  return;
58
59
  }
59
60
  const stopTime = performance.now();
60
61
  const time = stopTime - startTime;
61
- fireAnalyticsCallback({
62
- payload: {
63
- action: ACTION.RENDERED,
64
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
65
- eventType: EVENT_TYPE.OPERATIONAL,
66
- attributes: {
67
- time,
68
- items: items.length,
69
- initial: isEmptyQuery
70
- }
62
+ api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : (_api$analytics2$actio = _api$analytics2.actions) === null || _api$analytics2$actio === void 0 ? void 0 : _api$analytics2$actio.fireAnalyticsEvent({
63
+ action: ACTION.RENDERED,
64
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
65
+ eventType: EVENT_TYPE.OPERATIONAL,
66
+ attributes: {
67
+ time,
68
+ items: items.length,
69
+ initial: isEmptyQuery
71
70
  }
72
71
  });
73
- }, [startTime, items, fireAnalyticsCallback, isEmptyQuery,
72
+ }, [startTime, items, isEmptyQuery,
74
73
  // In case the current triggerHandler changes
75
74
  // e.g: Inserting a mention using the quick insert
76
75
  // we need to send the event again
77
76
  // eslint-disable-next-line react-hooks/exhaustive-deps
78
- triggerHandler]);
77
+ triggerHandler, api]);
79
78
  useEffect(() => {
80
- if (!fireAnalyticsCallback) {
79
+ var _api$analytics3, _api$analytics3$actio, _api$analytics4, _api$analytics4$actio;
80
+ if (!(api !== null && api !== void 0 && (_api$analytics3 = api.analytics) !== null && _api$analytics3 !== void 0 && (_api$analytics3$actio = _api$analytics3.actions) !== null && _api$analytics3$actio !== void 0 && _api$analytics3$actio.fireAnalyticsEvent)) {
81
81
  return;
82
82
  }
83
- fireAnalyticsCallback({
84
- payload: {
85
- action: ACTION.VIEWED,
86
- actionSubject: ACTION_SUBJECT.TYPEAHEAD_ITEM,
87
- eventType: EVENT_TYPE.OPERATIONAL,
88
- attributes: {
89
- index: selectedIndex,
90
- items: items.length
91
- }
83
+ api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : (_api$analytics4$actio = _api$analytics4.actions) === null || _api$analytics4$actio === void 0 ? void 0 : _api$analytics4$actio.fireAnalyticsEvent({
84
+ action: ACTION.VIEWED,
85
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD_ITEM,
86
+ eventType: EVENT_TYPE.OPERATIONAL,
87
+ attributes: {
88
+ index: selectedIndex,
89
+ items: items.length
92
90
  }
93
91
  });
94
- }, [items, fireAnalyticsCallback, selectedIndex,
92
+ }, [items, api, selectedIndex,
95
93
  // In case the current triggerHandler changes
96
94
  // e.g: Inserting a mention using the quick insert
97
95
  // we need to send the event again
@@ -14,7 +14,6 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
14
14
  popupsMountPoint,
15
15
  popupsBoundariesElement,
16
16
  popupsScrollableElement,
17
- createAnalyticsEvent,
18
17
  inputMethod,
19
18
  getDecorationPosition,
20
19
  reopenQuery,
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import React from 'react';
10
10
  import { typeAheadQuery } from '@atlaskit/adf-schema';
11
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
12
12
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
13
13
  import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
14
14
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -130,9 +130,7 @@ var createCloseTypeAhead = function createCloseTypeAhead(editorViewRef) {
130
130
  */
131
131
  export var typeAheadPlugin = function typeAheadPlugin(_ref) {
132
132
  var _api$analytics, _api$analytics2;
133
- var options = _ref.config,
134
- api = _ref.api;
135
- var fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
133
+ var api = _ref.api;
136
134
  var popupMountRef = {
137
135
  current: null
138
136
  };
@@ -160,8 +158,7 @@ export var typeAheadPlugin = function typeAheadPlugin(_ref) {
160
158
  getIntl: getIntl,
161
159
  popupMountRef: popupMountRef,
162
160
  reactDispatch: dispatch,
163
- typeAheadHandlers: typeAhead,
164
- createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
161
+ typeAheadHandlers: typeAhead
165
162
  });
166
163
  }
167
164
  }, {
@@ -243,8 +240,7 @@ export var typeAheadPlugin = function typeAheadPlugin(_ref) {
243
240
  return /*#__PURE__*/React.createElement(ContentComponent, {
244
241
  editorView: editorView,
245
242
  popupMountRef: popupMountRef,
246
- api: api,
247
- fireAnalyticsCallback: fireAnalyticsCallback
243
+ api: api
248
244
  });
249
245
  },
250
246
  onEditorViewStateUpdated: function onEditorViewStateUpdated(_ref5) {
@@ -272,17 +268,16 @@ export var typeAheadPlugin = function typeAheadPlugin(_ref) {
272
268
  if (newTriggerHandler !== null && newTriggerHandler !== void 0 && newTriggerHandler.onOpen && isANewHandler) {
273
269
  newTriggerHandler.onOpen(newEditorState);
274
270
  }
275
- if (newTriggerHandler && isANewHandler && options !== null && options !== void 0 && options.createAnalyticsEvent) {
276
- fireAnalyticsCallback({
277
- payload: {
278
- action: ACTION.INVOKED,
279
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
280
- actionSubjectId: newTriggerHandler.id || 'not_set',
281
- attributes: {
282
- inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
283
- },
284
- eventType: EVENT_TYPE.UI
285
- }
271
+ if (newTriggerHandler && isANewHandler) {
272
+ var _api$analytics3;
273
+ api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || (_api$analytics3 = _api$analytics3.actions) === null || _api$analytics3 === void 0 || _api$analytics3.fireAnalyticsEvent({
274
+ action: ACTION.INVOKED,
275
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
276
+ actionSubjectId: newTriggerHandler.id || 'not_set',
277
+ attributes: {
278
+ inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
279
+ },
280
+ eventType: EVENT_TYPE.UI
286
281
  });
287
282
  }
288
283
  }
@@ -14,8 +14,7 @@ import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
14
14
  import { getTypeAheadQuery } from '../utils';
15
15
  export var factoryDecorations = function factoryDecorations(_ref) {
16
16
  var intl = _ref.intl,
17
- popupMountRef = _ref.popupMountRef,
18
- createAnalyticsEvent = _ref.createAnalyticsEvent;
17
+ popupMountRef = _ref.popupMountRef;
19
18
  var createDecorations = function createDecorations(tr, _ref2) {
20
19
  var triggerHandler = _ref2.triggerHandler,
21
20
  inputMethod = _ref2.inputMethod,
@@ -79,7 +78,6 @@ export var factoryDecorations = function factoryDecorations(_ref) {
79
78
  triggerHandler: triggerHandler,
80
79
  editorView: editorView,
81
80
  anchorElement: typeaheadComponent,
82
- createAnalyticsEvent: createAnalyticsEvent,
83
81
  inputMethod: inputMethod,
84
82
  getDecorationPosition: getDecorationPosition,
85
83
  shouldFocusCursorInsideQuery: shouldFocusCursorInsideQuery,
@@ -23,14 +23,12 @@ var hasValidTypeAheadStep = function hasValidTypeAheadStep(tr) {
23
23
  export function createPlugin(_ref) {
24
24
  var reactDispatch = _ref.reactDispatch,
25
25
  popupMountRef = _ref.popupMountRef,
26
- createAnalyticsEvent = _ref.createAnalyticsEvent,
27
26
  typeAheadHandlers = _ref.typeAheadHandlers,
28
27
  getIntl = _ref.getIntl;
29
28
  var intl = getIntl();
30
29
  var _factoryDecorations = factoryDecorations({
31
30
  intl: intl,
32
- popupMountRef: popupMountRef,
33
- createAnalyticsEvent: createAnalyticsEvent
31
+ popupMountRef: popupMountRef
34
32
  }),
35
33
  createDecorations = _factoryDecorations.createDecorations,
36
34
  removeDecorations = _factoryDecorations.removeDecorations;
@@ -4,8 +4,7 @@ import { TypeAheadMenu } from './TypeAheadMenu';
4
4
  export function ContentComponent(_ref) {
5
5
  var api = _ref.api,
6
6
  editorView = _ref.editorView,
7
- popupMountRef = _ref.popupMountRef,
8
- fireAnalyticsCallback = _ref.fireAnalyticsCallback;
7
+ popupMountRef = _ref.popupMountRef;
9
8
  var _useSharedPluginState = useSharedPluginState(api, ['typeAhead']),
10
9
  typeAheadState = _useSharedPluginState.typeAheadState;
11
10
  if (!typeAheadState) {
@@ -15,6 +14,6 @@ export function ContentComponent(_ref) {
15
14
  editorView: editorView,
16
15
  popupMountRef: popupMountRef,
17
16
  typeAheadState: typeAheadState,
18
- fireAnalyticsCallback: fireAnalyticsCallback
17
+ api: api
19
18
  });
20
19
  }
@@ -9,7 +9,7 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
9
9
  var editorView = _ref.editorView,
10
10
  popupMountRef = _ref.popupMountRef,
11
11
  typeAheadState = _ref.typeAheadState,
12
- fireAnalyticsCallback = _ref.fireAnalyticsCallback;
12
+ api = _ref.api;
13
13
  var isOpen = typeAheadState.decorationSet.find().length > 0;
14
14
  var triggerHandler = typeAheadState.triggerHandler,
15
15
  items = typeAheadState.items,
@@ -76,13 +76,13 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
76
76
  popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
77
77
  anchorElement: decorationElement,
78
78
  triggerHandler: triggerHandler,
79
- fireAnalyticsCallback: fireAnalyticsCallback,
80
79
  items: items,
81
80
  selectedIndex: selectedIndex,
82
81
  setSelectedItem: setSelectedItem,
83
82
  onItemInsert: insertItem,
84
83
  decorationSet: decorationSet,
85
84
  isEmptyQuery: !query,
86
- cancel: cancel
85
+ cancel: cancel,
86
+ api: api
87
87
  });
88
88
  });
@@ -41,57 +41,55 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
41
41
  items = props.items,
42
42
  selectedIndex = props.selectedIndex,
43
43
  onItemInsert = props.onItemInsert,
44
- fireAnalyticsCallback = props.fireAnalyticsCallback,
45
44
  isEmptyQuery = props.isEmptyQuery,
46
- cancel = props.cancel;
45
+ cancel = props.cancel,
46
+ api = props.api;
47
47
  var ref = useRef(null);
48
48
  var startTime = useMemo(function () {
49
49
  return performance.now();
50
50
  },
51
51
  // In case those props changes
52
52
  // we need to recreate the startTime
53
- [items, isEmptyQuery, fireAnalyticsCallback, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
53
+ [items, isEmptyQuery, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
54
54
  );
55
55
  useEffect(function () {
56
- if (!fireAnalyticsCallback) {
56
+ var _api$analytics, _api$analytics2;
57
+ if (!(api !== null && api !== void 0 && (_api$analytics = api.analytics) !== null && _api$analytics !== void 0 && (_api$analytics = _api$analytics.actions) !== null && _api$analytics !== void 0 && _api$analytics.fireAnalyticsEvent)) {
57
58
  return;
58
59
  }
59
60
  var stopTime = performance.now();
60
61
  var time = stopTime - startTime;
61
- fireAnalyticsCallback({
62
- payload: {
63
- action: ACTION.RENDERED,
64
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
65
- eventType: EVENT_TYPE.OPERATIONAL,
66
- attributes: {
67
- time: time,
68
- items: items.length,
69
- initial: isEmptyQuery
70
- }
62
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
63
+ action: ACTION.RENDERED,
64
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
65
+ eventType: EVENT_TYPE.OPERATIONAL,
66
+ attributes: {
67
+ time: time,
68
+ items: items.length,
69
+ initial: isEmptyQuery
71
70
  }
72
71
  });
73
- }, [startTime, items, fireAnalyticsCallback, isEmptyQuery,
72
+ }, [startTime, items, isEmptyQuery,
74
73
  // In case the current triggerHandler changes
75
74
  // e.g: Inserting a mention using the quick insert
76
75
  // we need to send the event again
77
76
  // eslint-disable-next-line react-hooks/exhaustive-deps
78
- triggerHandler]);
77
+ triggerHandler, api]);
79
78
  useEffect(function () {
80
- if (!fireAnalyticsCallback) {
79
+ var _api$analytics3, _api$analytics4;
80
+ if (!(api !== null && api !== void 0 && (_api$analytics3 = api.analytics) !== null && _api$analytics3 !== void 0 && (_api$analytics3 = _api$analytics3.actions) !== null && _api$analytics3 !== void 0 && _api$analytics3.fireAnalyticsEvent)) {
81
81
  return;
82
82
  }
83
- fireAnalyticsCallback({
84
- payload: {
85
- action: ACTION.VIEWED,
86
- actionSubject: ACTION_SUBJECT.TYPEAHEAD_ITEM,
87
- eventType: EVENT_TYPE.OPERATIONAL,
88
- attributes: {
89
- index: selectedIndex,
90
- items: items.length
91
- }
83
+ api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || (_api$analytics4 = _api$analytics4.actions) === null || _api$analytics4 === void 0 || _api$analytics4.fireAnalyticsEvent({
84
+ action: ACTION.VIEWED,
85
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD_ITEM,
86
+ eventType: EVENT_TYPE.OPERATIONAL,
87
+ attributes: {
88
+ index: selectedIndex,
89
+ items: items.length
92
90
  }
93
91
  });
94
- }, [items, fireAnalyticsCallback, selectedIndex,
92
+ }, [items, api, selectedIndex,
95
93
  // In case the current triggerHandler changes
96
94
  // e.g: Inserting a mention using the quick insert
97
95
  // we need to send the event again
@@ -15,7 +15,6 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
15
15
  popupsMountPoint = _ref.popupsMountPoint,
16
16
  popupsBoundariesElement = _ref.popupsBoundariesElement,
17
17
  popupsScrollableElement = _ref.popupsScrollableElement,
18
- createAnalyticsEvent = _ref.createAnalyticsEvent,
19
18
  inputMethod = _ref.inputMethod,
20
19
  getDecorationPosition = _ref.getDecorationPosition,
21
20
  reopenQuery = _ref.reopenQuery,
@@ -1,14 +1,12 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
2
  import type { CreateTypeAheadDecorations, PopupMountPointReference, RemoveTypeAheadDecorations } from '../types';
4
3
  type FactoryProps = {
5
4
  intl: IntlShape;
6
5
  popupMountRef: PopupMountPointReference;
7
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
8
6
  };
9
7
  type FactoryReturn = {
10
8
  createDecorations: CreateTypeAheadDecorations;
11
9
  removeDecorations: RemoveTypeAheadDecorations;
12
10
  };
13
- export declare const factoryDecorations: ({ intl, popupMountRef, createAnalyticsEvent, }: FactoryProps) => FactoryReturn;
11
+ export declare const factoryDecorations: ({ intl, popupMountRef, }: FactoryProps) => FactoryReturn;
14
12
  export {};
@@ -1,5 +1,4 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
4
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
4
  import type { PopupMountPointReference, TypeAheadHandler } from '../types';
@@ -7,8 +6,7 @@ type Props = {
7
6
  reactDispatch: Dispatch;
8
7
  popupMountRef: PopupMountPointReference;
9
8
  typeAheadHandlers: Array<TypeAheadHandler>;
10
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
11
9
  getIntl: () => IntlShape;
12
10
  };
13
- export declare function createPlugin({ reactDispatch, popupMountRef, createAnalyticsEvent, typeAheadHandlers, getIntl, }: Props): SafePlugin;
11
+ export declare function createPlugin({ reactDispatch, popupMountRef, typeAheadHandlers, getIntl, }: Props): SafePlugin;
14
12
  export {};
@@ -1,4 +1,3 @@
1
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
1
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
2
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
3
  import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInsert, TypeAheadItem, TypeAheadItemRenderProps, TypeAheadSelectItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
@@ -66,7 +65,6 @@ export type RemoveTypeAheadDecorations = (decorationSet?: DecorationSet) => bool
66
65
  export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
67
66
  export type TypeAheadPluginOptions = {
68
67
  isMobile?: boolean;
69
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
70
68
  };
71
69
  type OpenTypeAheadProps = {
72
70
  triggerHandler: TypeAheadHandler;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
3
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
4
  import type { PopupMountPointReference, TypeAheadPlugin } from '../types';
@@ -7,7 +6,6 @@ interface ContentComponentProps {
7
6
  api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
8
7
  editorView: EditorView;
9
8
  popupMountRef: PopupMountPointReference;
10
- fireAnalyticsCallback: FireAnalyticsCallback;
11
9
  }
12
- export declare function ContentComponent({ api, editorView, popupMountRef, fireAnalyticsCallback, }: ContentComponentProps): JSX.Element | null;
10
+ export declare function ContentComponent({ api, editorView, popupMountRef, }: ContentComponentProps): JSX.Element | null;
13
11
  export {};
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { PopupMountPointReference, TypeAheadPluginSharedState } from '../types';
4
+ import type { PopupMountPointReference, TypeAheadPlugin, TypeAheadPluginSharedState } from '../types';
5
5
  type TypeAheadMenuType = {
6
6
  typeAheadState: TypeAheadPluginSharedState;
7
7
  editorView: EditorView;
8
8
  popupMountRef: PopupMountPointReference;
9
- fireAnalyticsCallback: FireAnalyticsCallback;
9
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
10
10
  };
11
- export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, fireAnalyticsCallback, }: TypeAheadMenuType) => JSX.Element | null>;
11
+ export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, api }: TypeAheadMenuType) => JSX.Element | null>;
12
12
  export {};
@@ -1,11 +1,11 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
5
4
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
5
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
6
6
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import { CloseSelectionOptions } from '../constants';
8
- import type { OnSelectItem, TypeAheadHandler, TypeAheadItem } from '../types';
8
+ import type { OnSelectItem, TypeAheadHandler, TypeAheadItem, TypeAheadPlugin } from '../types';
9
9
  type TypeAheadPopupProps = {
10
10
  triggerHandler: TypeAheadHandler;
11
11
  editorView: EditorView;
@@ -13,7 +13,6 @@ type TypeAheadPopupProps = {
13
13
  popupsMountPoint?: HTMLElement;
14
14
  popupsBoundariesElement?: HTMLElement;
15
15
  popupsScrollableElement?: HTMLElement;
16
- fireAnalyticsCallback: FireAnalyticsCallback;
17
16
  items: Array<TypeAheadItem>;
18
17
  selectedIndex: number;
19
18
  setSelectedItem: OnSelectItem;
@@ -25,6 +24,7 @@ type TypeAheadPopupProps = {
25
24
  addPrefixTrigger: boolean;
26
25
  forceFocusOnEditor: boolean;
27
26
  }) => void;
27
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
28
28
  };
29
29
  export declare const TypeAheadPopup: React.MemoExoticComponent<(props: TypeAheadPopupProps) => jsx.JSX.Element>;
30
30
  export {};
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
3
  import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
5
4
  type WrapperProps = {
@@ -13,8 +12,7 @@ type WrapperProps = {
13
12
  popupsMountPoint?: HTMLElement;
14
13
  popupsBoundariesElement?: HTMLElement;
15
14
  popupsScrollableElement?: HTMLElement;
16
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
17
15
  inputMethod?: TypeAheadInputMethod;
18
16
  };
19
- export declare const WrapperTypeAhead: React.MemoExoticComponent<({ triggerHandler, editorView, anchorElement, shouldFocusCursorInsideQuery, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, createAnalyticsEvent, inputMethod, getDecorationPosition, reopenQuery, onUndoRedo, }: WrapperProps) => JSX.Element | null>;
17
+ export declare const WrapperTypeAhead: React.MemoExoticComponent<({ triggerHandler, editorView, anchorElement, shouldFocusCursorInsideQuery, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, inputMethod, getDecorationPosition, reopenQuery, onUndoRedo, }: WrapperProps) => JSX.Element | null>;
20
18
  export {};
@@ -1,14 +1,12 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
2
  import type { CreateTypeAheadDecorations, PopupMountPointReference, RemoveTypeAheadDecorations } from '../types';
4
3
  type FactoryProps = {
5
4
  intl: IntlShape;
6
5
  popupMountRef: PopupMountPointReference;
7
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
8
6
  };
9
7
  type FactoryReturn = {
10
8
  createDecorations: CreateTypeAheadDecorations;
11
9
  removeDecorations: RemoveTypeAheadDecorations;
12
10
  };
13
- export declare const factoryDecorations: ({ intl, popupMountRef, createAnalyticsEvent, }: FactoryProps) => FactoryReturn;
11
+ export declare const factoryDecorations: ({ intl, popupMountRef, }: FactoryProps) => FactoryReturn;
14
12
  export {};
@@ -1,5 +1,4 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
4
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
4
  import type { PopupMountPointReference, TypeAheadHandler } from '../types';
@@ -7,8 +6,7 @@ type Props = {
7
6
  reactDispatch: Dispatch;
8
7
  popupMountRef: PopupMountPointReference;
9
8
  typeAheadHandlers: Array<TypeAheadHandler>;
10
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
11
9
  getIntl: () => IntlShape;
12
10
  };
13
- export declare function createPlugin({ reactDispatch, popupMountRef, createAnalyticsEvent, typeAheadHandlers, getIntl, }: Props): SafePlugin;
11
+ export declare function createPlugin({ reactDispatch, popupMountRef, typeAheadHandlers, getIntl, }: Props): SafePlugin;
14
12
  export {};
@@ -1,4 +1,3 @@
1
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
1
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
2
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
3
  import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInsert, TypeAheadItem, TypeAheadItemRenderProps, TypeAheadSelectItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
@@ -66,7 +65,6 @@ export type RemoveTypeAheadDecorations = (decorationSet?: DecorationSet) => bool
66
65
  export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
67
66
  export type TypeAheadPluginOptions = {
68
67
  isMobile?: boolean;
69
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
70
68
  };
71
69
  type OpenTypeAheadProps = {
72
70
  triggerHandler: TypeAheadHandler;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
3
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
4
  import type { PopupMountPointReference, TypeAheadPlugin } from '../types';
@@ -7,7 +6,6 @@ interface ContentComponentProps {
7
6
  api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
8
7
  editorView: EditorView;
9
8
  popupMountRef: PopupMountPointReference;
10
- fireAnalyticsCallback: FireAnalyticsCallback;
11
9
  }
12
- export declare function ContentComponent({ api, editorView, popupMountRef, fireAnalyticsCallback, }: ContentComponentProps): JSX.Element | null;
10
+ export declare function ContentComponent({ api, editorView, popupMountRef, }: ContentComponentProps): JSX.Element | null;
13
11
  export {};
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { PopupMountPointReference, TypeAheadPluginSharedState } from '../types';
4
+ import type { PopupMountPointReference, TypeAheadPlugin, TypeAheadPluginSharedState } from '../types';
5
5
  type TypeAheadMenuType = {
6
6
  typeAheadState: TypeAheadPluginSharedState;
7
7
  editorView: EditorView;
8
8
  popupMountRef: PopupMountPointReference;
9
- fireAnalyticsCallback: FireAnalyticsCallback;
9
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
10
10
  };
11
- export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, fireAnalyticsCallback, }: TypeAheadMenuType) => JSX.Element | null>;
11
+ export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, api }: TypeAheadMenuType) => JSX.Element | null>;
12
12
  export {};
@@ -1,11 +1,11 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
5
4
  import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
5
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
6
6
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import { CloseSelectionOptions } from '../constants';
8
- import type { OnSelectItem, TypeAheadHandler, TypeAheadItem } from '../types';
8
+ import type { OnSelectItem, TypeAheadHandler, TypeAheadItem, TypeAheadPlugin } from '../types';
9
9
  type TypeAheadPopupProps = {
10
10
  triggerHandler: TypeAheadHandler;
11
11
  editorView: EditorView;
@@ -13,7 +13,6 @@ type TypeAheadPopupProps = {
13
13
  popupsMountPoint?: HTMLElement;
14
14
  popupsBoundariesElement?: HTMLElement;
15
15
  popupsScrollableElement?: HTMLElement;
16
- fireAnalyticsCallback: FireAnalyticsCallback;
17
16
  items: Array<TypeAheadItem>;
18
17
  selectedIndex: number;
19
18
  setSelectedItem: OnSelectItem;
@@ -25,6 +24,7 @@ type TypeAheadPopupProps = {
25
24
  addPrefixTrigger: boolean;
26
25
  forceFocusOnEditor: boolean;
27
26
  }) => void;
27
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
28
28
  };
29
29
  export declare const TypeAheadPopup: React.MemoExoticComponent<(props: TypeAheadPopupProps) => jsx.JSX.Element>;
30
30
  export {};
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
3
  import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
5
4
  type WrapperProps = {
@@ -13,8 +12,7 @@ type WrapperProps = {
13
12
  popupsMountPoint?: HTMLElement;
14
13
  popupsBoundariesElement?: HTMLElement;
15
14
  popupsScrollableElement?: HTMLElement;
16
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
17
15
  inputMethod?: TypeAheadInputMethod;
18
16
  };
19
- export declare const WrapperTypeAhead: React.MemoExoticComponent<({ triggerHandler, editorView, anchorElement, shouldFocusCursorInsideQuery, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, createAnalyticsEvent, inputMethod, getDecorationPosition, reopenQuery, onUndoRedo, }: WrapperProps) => JSX.Element | null>;
17
+ export declare const WrapperTypeAhead: React.MemoExoticComponent<({ triggerHandler, editorView, anchorElement, shouldFocusCursorInsideQuery, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, inputMethod, getDecorationPosition, reopenQuery, onUndoRedo, }: WrapperProps) => JSX.Element | null>;
20
18
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "1.1.9",
3
+ "version": "1.2.1",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,13 +32,12 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^36.1.0",
36
- "@atlaskit/analytics-next": "^9.3.0",
37
- "@atlaskit/editor-common": "^80.0.0",
38
- "@atlaskit/editor-plugin-analytics": "^1.1.0",
35
+ "@atlaskit/adf-schema": "^36.3.0",
36
+ "@atlaskit/editor-common": "^80.3.0",
37
+ "@atlaskit/editor-plugin-analytics": "^1.2.0",
39
38
  "@atlaskit/editor-prosemirror": "4.0.1",
40
- "@atlaskit/editor-shared-styles": "^2.10.0",
41
- "@atlaskit/menu": "^2.2.0",
39
+ "@atlaskit/editor-shared-styles": "^2.11.0",
40
+ "@atlaskit/menu": "^2.3.0",
42
41
  "@atlaskit/prosemirror-input-rules": "^3.1.0",
43
42
  "@atlaskit/theme": "^12.8.0",
44
43
  "@atlaskit/tokens": "^1.48.0",
package/report.api.md CHANGED
@@ -17,7 +17,6 @@
17
17
  ```ts
18
18
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
19
  import type { Command } from '@atlaskit/editor-common/types';
20
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
21
20
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
22
21
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
23
22
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
@@ -92,7 +91,6 @@ export const typeAheadPlugin: TypeAheadPlugin;
92
91
  // @public (undocumented)
93
92
  export type TypeAheadPluginOptions = {
94
93
  isMobile?: boolean;
95
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
96
94
  };
97
95
 
98
96
  // @public (undocumented)