@atlaskit/editor-plugin-quick-insert 2.3.0 → 2.4.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,18 @@
1
1
  # @atlaskit/editor-plugin-quick-insert
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#139089](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139089)
8
+ [`69dcdc0c4a543`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/69dcdc0c4a543) -
9
+ ED-26588 Start activity session and persist active session when type ahead and element broswer is
10
+ open
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 2.3.0
4
17
 
5
18
  ### Minor Changes
@@ -14,6 +14,7 @@ var _reactIntlNext = require("react-intl-next");
14
14
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
15
15
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
16
16
  var _typeAhead = require("@atlaskit/editor-common/type-ahead");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
19
  var _commands = require("./pm-plugins/commands");
19
20
  var _pluginKey = require("./pm-plugins/plugin-key");
@@ -58,6 +59,15 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
58
59
  openElementBrowserModal: options !== null && options !== void 0 && options.enableElementBrowser ? function () {
59
60
  api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
60
61
  var tr = _ref3.tr;
62
+ if ((0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
63
+ var _api$metrics;
64
+ api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 || _api$metrics.commands.handleIntentToStartEdit({
65
+ shouldStartTimer: false,
66
+ shouldPersistActiveSession: true
67
+ })({
68
+ tr: tr
69
+ });
70
+ }
61
71
  (0, _commands.openElementBrowserModal)({
62
72
  tr: tr
63
73
  });
@@ -134,13 +144,27 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
134
144
  }
135
145
  },
136
146
  commands: {
137
- openElementBrowserModal: _commands.openElementBrowserModal,
147
+ openElementBrowserModal: function openElementBrowserModal(_ref7) {
148
+ var tr = _ref7.tr;
149
+ if ((0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
150
+ var _api$metrics2;
151
+ api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 || _api$metrics2.commands.handleIntentToStartEdit({
152
+ shouldStartTimer: false,
153
+ shouldPersistActiveSession: true
154
+ })({
155
+ tr: tr
156
+ });
157
+ }
158
+ return (0, _commands.openElementBrowserModal)({
159
+ tr: tr
160
+ });
161
+ },
138
162
  addQuickInsertItem: function addQuickInsertItem(item) {
139
- return function (_ref7) {
163
+ return function (_ref8) {
140
164
  var _api$quickInsert$shar2, _api$quickInsert2;
141
- var tr = _ref7.tr;
142
- var _ref8 = (_api$quickInsert$shar2 = api === null || api === void 0 || (_api$quickInsert2 = api.quickInsert) === null || _api$quickInsert2 === void 0 ? void 0 : _api$quickInsert2.sharedState.currentState()) !== null && _api$quickInsert$shar2 !== void 0 ? _api$quickInsert$shar2 : {},
143
- lazyDefaultItems = _ref8.lazyDefaultItems;
165
+ var tr = _ref8.tr;
166
+ var _ref9 = (_api$quickInsert$shar2 = api === null || api === void 0 || (_api$quickInsert2 = api.quickInsert) === null || _api$quickInsert2 === void 0 ? void 0 : _api$quickInsert2.sharedState.currentState()) !== null && _api$quickInsert$shar2 !== void 0 ? _api$quickInsert$shar2 : {},
167
+ lazyDefaultItems = _ref9.lazyDefaultItems;
144
168
  var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
145
169
  var memoisedNewItems = (0, _quickInsert.memoProcessQuickInsertItems)([item], intl);
146
170
  return tr.setMeta(_pluginKey.pluginKey, {
@@ -198,7 +222,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
198
222
  },
199
223
  view: function view(editorView) {
200
224
  var providerHandler = /*#__PURE__*/function () {
201
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_name, providerPromise) {
225
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_name, providerPromise) {
202
226
  var provider, providedItems;
203
227
  return _regenerator.default.wrap(function _callee$(_context) {
204
228
  while (1) switch (_context.prev = _context.next) {
@@ -234,7 +258,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
234
258
  }, _callee, null, [[1, 11]]);
235
259
  }));
236
260
  return function providerHandler(_x, _x2) {
237
- return _ref9.apply(this, arguments);
261
+ return _ref10.apply(this, arguments);
238
262
  };
239
263
  }();
240
264
  providerFactory.subscribe('quickInsertProvider', providerHandler);
@@ -9,6 +9,7 @@ exports.default = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _hooks = require("@atlaskit/editor-common/hooks");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _commands = require("../../pm-plugins/commands");
13
14
  var _ModalElementBrowser = _interopRequireDefault(require("./ModalElementBrowser"));
14
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -21,7 +22,8 @@ var Modal = function Modal(_ref) {
21
22
  editorView = _ref.editorView,
22
23
  helpUrl = _ref.helpUrl,
23
24
  insertItem = _ref.insertItem,
24
- getSuggestions = _ref.getSuggestions;
25
+ getSuggestions = _ref.getSuggestions,
26
+ api = _ref.api;
25
27
  var getItems = (0, _react.useCallback)(function (query, category) {
26
28
  var _getSuggestions$map, _getSuggestions;
27
29
  return (_getSuggestions$map = getSuggestions === null || getSuggestions === void 0 || (_getSuggestions = getSuggestions({
@@ -48,12 +50,20 @@ var Modal = function Modal(_ref) {
48
50
  var insertableItem = _react.default.useRef(null);
49
51
  var onInsertItem = (0, _react.useCallback)(function (item) {
50
52
  (0, _commands.closeElementBrowserModal)()(editorView.state, editorView.dispatch);
53
+ if ((0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
54
+ var _api$metrics;
55
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.startActiveSessionTimer());
56
+ }
51
57
  insertableItem.current = item;
52
- }, [editorView]);
58
+ }, [editorView, api]);
53
59
  var onClose = (0, _react.useCallback)(function () {
54
60
  (0, _commands.closeElementBrowserModal)()(editorView.state, editorView.dispatch);
61
+ if ((0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
62
+ var _api$metrics2;
63
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 ? void 0 : _api$metrics2.commands.startActiveSessionTimer());
64
+ }
55
65
  focusInEditor();
56
- }, [editorView, focusInEditor]);
66
+ }, [editorView, focusInEditor, api]);
57
67
  var onCloseComplete = (0, _react.useCallback)(function () {
58
68
  if (!insertableItem.current) {
59
69
  focusInEditor();
@@ -89,6 +99,7 @@ var _default = exports.default = function _default(_ref2) {
89
99
  helpUrl: helpUrl,
90
100
  isOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
91
101
  insertItem: pluginInjectionAPI === null || pluginInjectionAPI === void 0 || (_pluginInjectionAPI$q = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q === void 0 || (_pluginInjectionAPI$q = _pluginInjectionAPI$q.actions) === null || _pluginInjectionAPI$q === void 0 ? void 0 : _pluginInjectionAPI$q.insertItem,
92
- getSuggestions: pluginInjectionAPI === null || pluginInjectionAPI === void 0 || (_pluginInjectionAPI$q2 = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q2 === void 0 || (_pluginInjectionAPI$q2 = _pluginInjectionAPI$q2.actions) === null || _pluginInjectionAPI$q2 === void 0 ? void 0 : _pluginInjectionAPI$q2.getSuggestions
102
+ getSuggestions: pluginInjectionAPI === null || pluginInjectionAPI === void 0 || (_pluginInjectionAPI$q2 = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q2 === void 0 || (_pluginInjectionAPI$q2 = _pluginInjectionAPI$q2.actions) === null || _pluginInjectionAPI$q2 === void 0 ? void 0 : _pluginInjectionAPI$q2.getSuggestions,
103
+ api: pluginInjectionAPI
93
104
  });
94
105
  };
@@ -3,6 +3,7 @@ import { useIntl } from 'react-intl-next';
3
3
  import { memoProcessQuickInsertItems } from '@atlaskit/editor-common/quick-insert';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
8
  import { createInsertItem, openElementBrowserModal } from './pm-plugins/commands';
8
9
  import { pluginKey } from './pm-plugins/plugin-key';
@@ -48,6 +49,15 @@ export const quickInsertPlugin = ({
48
49
  api === null || api === void 0 ? void 0 : api.core.actions.execute(({
49
50
  tr
50
51
  }) => {
52
+ if (fg('platform_editor_ease_of_use_metrics')) {
53
+ var _api$metrics;
54
+ api === null || api === void 0 ? void 0 : (_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.handleIntentToStartEdit({
55
+ shouldStartTimer: false,
56
+ shouldPersistActiveSession: true
57
+ })({
58
+ tr
59
+ });
60
+ }
51
61
  openElementBrowserModal({
52
62
  tr
53
63
  });
@@ -126,7 +136,22 @@ export const quickInsertPlugin = ({
126
136
  }
127
137
  },
128
138
  commands: {
129
- openElementBrowserModal,
139
+ openElementBrowserModal: ({
140
+ tr
141
+ }) => {
142
+ if (fg('platform_editor_ease_of_use_metrics')) {
143
+ var _api$metrics2;
144
+ api === null || api === void 0 ? void 0 : (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 ? void 0 : _api$metrics2.commands.handleIntentToStartEdit({
145
+ shouldStartTimer: false,
146
+ shouldPersistActiveSession: true
147
+ })({
148
+ tr
149
+ });
150
+ }
151
+ return openElementBrowserModal({
152
+ tr
153
+ });
154
+ },
130
155
  addQuickInsertItem: item => ({
131
156
  tr
132
157
  }) => {
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { closeElementBrowserModal } from '../../pm-plugins/commands';
4
5
  import ModalElementBrowser from './ModalElementBrowser';
5
6
  const Modal = ({
@@ -8,7 +9,8 @@ const Modal = ({
8
9
  editorView,
9
10
  helpUrl,
10
11
  insertItem,
11
- getSuggestions
12
+ getSuggestions,
13
+ api
12
14
  }) => {
13
15
  const getItems = useCallback((query, category) => {
14
16
  var _getSuggestions$map, _getSuggestions;
@@ -37,12 +39,20 @@ const Modal = ({
37
39
  const insertableItem = React.useRef(null);
38
40
  const onInsertItem = useCallback(item => {
39
41
  closeElementBrowserModal()(editorView.state, editorView.dispatch);
42
+ if (fg('platform_editor_ease_of_use_metrics')) {
43
+ var _api$metrics;
44
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.startActiveSessionTimer());
45
+ }
40
46
  insertableItem.current = item;
41
- }, [editorView]);
47
+ }, [editorView, api]);
42
48
  const onClose = useCallback(() => {
43
49
  closeElementBrowserModal()(editorView.state, editorView.dispatch);
50
+ if (fg('platform_editor_ease_of_use_metrics')) {
51
+ var _api$metrics2;
52
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 ? void 0 : _api$metrics2.commands.startActiveSessionTimer());
53
+ }
44
54
  focusInEditor();
45
- }, [editorView, focusInEditor]);
55
+ }, [editorView, focusInEditor, api]);
46
56
  const onCloseComplete = useCallback(() => {
47
57
  if (!insertableItem.current) {
48
58
  focusInEditor();
@@ -80,6 +90,7 @@ export default (({
80
90
  helpUrl: helpUrl,
81
91
  isOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
82
92
  insertItem: pluginInjectionAPI === null || pluginInjectionAPI === void 0 ? void 0 : (_pluginInjectionAPI$q = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q === void 0 ? void 0 : (_pluginInjectionAPI$q2 = _pluginInjectionAPI$q.actions) === null || _pluginInjectionAPI$q2 === void 0 ? void 0 : _pluginInjectionAPI$q2.insertItem,
83
- getSuggestions: pluginInjectionAPI === null || pluginInjectionAPI === void 0 ? void 0 : (_pluginInjectionAPI$q3 = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q3 === void 0 ? void 0 : (_pluginInjectionAPI$q4 = _pluginInjectionAPI$q3.actions) === null || _pluginInjectionAPI$q4 === void 0 ? void 0 : _pluginInjectionAPI$q4.getSuggestions
93
+ getSuggestions: pluginInjectionAPI === null || pluginInjectionAPI === void 0 ? void 0 : (_pluginInjectionAPI$q3 = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q3 === void 0 ? void 0 : (_pluginInjectionAPI$q4 = _pluginInjectionAPI$q3.actions) === null || _pluginInjectionAPI$q4 === void 0 ? void 0 : _pluginInjectionAPI$q4.getSuggestions,
94
+ api: pluginInjectionAPI
84
95
  });
85
96
  });
@@ -9,8 +9,9 @@ import { useIntl } from 'react-intl-next';
9
9
  import { memoProcessQuickInsertItems } from '@atlaskit/editor-common/quick-insert';
10
10
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
11
11
  import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
- import { createInsertItem, openElementBrowserModal } from './pm-plugins/commands';
14
+ import { createInsertItem, openElementBrowserModal as _openElementBrowserModal } from './pm-plugins/commands';
14
15
  import { pluginKey } from './pm-plugins/plugin-key';
15
16
  import ModalElementBrowser from './ui/ModalElementBrowser';
16
17
  import { getQuickInsertSuggestions } from './ui/search';
@@ -51,7 +52,16 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
51
52
  openElementBrowserModal: options !== null && options !== void 0 && options.enableElementBrowser ? function () {
52
53
  api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
53
54
  var tr = _ref3.tr;
54
- openElementBrowserModal({
55
+ if (fg('platform_editor_ease_of_use_metrics')) {
56
+ var _api$metrics;
57
+ api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 || _api$metrics.commands.handleIntentToStartEdit({
58
+ shouldStartTimer: false,
59
+ shouldPersistActiveSession: true
60
+ })({
61
+ tr: tr
62
+ });
63
+ }
64
+ _openElementBrowserModal({
55
65
  tr: tr
56
66
  });
57
67
  return tr;
@@ -127,13 +137,27 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
127
137
  }
128
138
  },
129
139
  commands: {
130
- openElementBrowserModal: openElementBrowserModal,
140
+ openElementBrowserModal: function openElementBrowserModal(_ref7) {
141
+ var tr = _ref7.tr;
142
+ if (fg('platform_editor_ease_of_use_metrics')) {
143
+ var _api$metrics2;
144
+ api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 || _api$metrics2.commands.handleIntentToStartEdit({
145
+ shouldStartTimer: false,
146
+ shouldPersistActiveSession: true
147
+ })({
148
+ tr: tr
149
+ });
150
+ }
151
+ return _openElementBrowserModal({
152
+ tr: tr
153
+ });
154
+ },
131
155
  addQuickInsertItem: function addQuickInsertItem(item) {
132
- return function (_ref7) {
156
+ return function (_ref8) {
133
157
  var _api$quickInsert$shar2, _api$quickInsert2;
134
- var tr = _ref7.tr;
135
- var _ref8 = (_api$quickInsert$shar2 = api === null || api === void 0 || (_api$quickInsert2 = api.quickInsert) === null || _api$quickInsert2 === void 0 ? void 0 : _api$quickInsert2.sharedState.currentState()) !== null && _api$quickInsert$shar2 !== void 0 ? _api$quickInsert$shar2 : {},
136
- lazyDefaultItems = _ref8.lazyDefaultItems;
158
+ var tr = _ref8.tr;
159
+ var _ref9 = (_api$quickInsert$shar2 = api === null || api === void 0 || (_api$quickInsert2 = api.quickInsert) === null || _api$quickInsert2 === void 0 ? void 0 : _api$quickInsert2.sharedState.currentState()) !== null && _api$quickInsert$shar2 !== void 0 ? _api$quickInsert$shar2 : {},
160
+ lazyDefaultItems = _ref9.lazyDefaultItems;
137
161
  var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
138
162
  var memoisedNewItems = memoProcessQuickInsertItems([item], intl);
139
163
  return tr.setMeta(pluginKey, {
@@ -191,7 +215,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
191
215
  },
192
216
  view: function view(editorView) {
193
217
  var providerHandler = /*#__PURE__*/function () {
194
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, providerPromise) {
218
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, providerPromise) {
195
219
  var provider, providedItems;
196
220
  return _regeneratorRuntime.wrap(function _callee$(_context) {
197
221
  while (1) switch (_context.prev = _context.next) {
@@ -227,7 +251,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
227
251
  }, _callee, null, [[1, 11]]);
228
252
  }));
229
253
  return function providerHandler(_x, _x2) {
230
- return _ref9.apply(this, arguments);
254
+ return _ref10.apply(this, arguments);
231
255
  };
232
256
  }();
233
257
  providerFactory.subscribe('quickInsertProvider', providerHandler);
@@ -3,6 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
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
4
  import React, { useCallback } from 'react';
5
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { closeElementBrowserModal } from '../../pm-plugins/commands';
7
8
  import ModalElementBrowser from './ModalElementBrowser';
8
9
  var Modal = function Modal(_ref) {
@@ -11,7 +12,8 @@ var Modal = function Modal(_ref) {
11
12
  editorView = _ref.editorView,
12
13
  helpUrl = _ref.helpUrl,
13
14
  insertItem = _ref.insertItem,
14
- getSuggestions = _ref.getSuggestions;
15
+ getSuggestions = _ref.getSuggestions,
16
+ api = _ref.api;
15
17
  var getItems = useCallback(function (query, category) {
16
18
  var _getSuggestions$map, _getSuggestions;
17
19
  return (_getSuggestions$map = getSuggestions === null || getSuggestions === void 0 || (_getSuggestions = getSuggestions({
@@ -38,12 +40,20 @@ var Modal = function Modal(_ref) {
38
40
  var insertableItem = React.useRef(null);
39
41
  var onInsertItem = useCallback(function (item) {
40
42
  closeElementBrowserModal()(editorView.state, editorView.dispatch);
43
+ if (fg('platform_editor_ease_of_use_metrics')) {
44
+ var _api$metrics;
45
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.startActiveSessionTimer());
46
+ }
41
47
  insertableItem.current = item;
42
- }, [editorView]);
48
+ }, [editorView, api]);
43
49
  var onClose = useCallback(function () {
44
50
  closeElementBrowserModal()(editorView.state, editorView.dispatch);
51
+ if (fg('platform_editor_ease_of_use_metrics')) {
52
+ var _api$metrics2;
53
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 ? void 0 : _api$metrics2.commands.startActiveSessionTimer());
54
+ }
45
55
  focusInEditor();
46
- }, [editorView, focusInEditor]);
56
+ }, [editorView, focusInEditor, api]);
47
57
  var onCloseComplete = useCallback(function () {
48
58
  if (!insertableItem.current) {
49
59
  focusInEditor();
@@ -79,6 +89,7 @@ export default (function (_ref2) {
79
89
  helpUrl: helpUrl,
80
90
  isOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
81
91
  insertItem: pluginInjectionAPI === null || pluginInjectionAPI === void 0 || (_pluginInjectionAPI$q = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q === void 0 || (_pluginInjectionAPI$q = _pluginInjectionAPI$q.actions) === null || _pluginInjectionAPI$q === void 0 ? void 0 : _pluginInjectionAPI$q.insertItem,
82
- getSuggestions: pluginInjectionAPI === null || pluginInjectionAPI === void 0 || (_pluginInjectionAPI$q2 = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q2 === void 0 || (_pluginInjectionAPI$q2 = _pluginInjectionAPI$q2.actions) === null || _pluginInjectionAPI$q2 === void 0 ? void 0 : _pluginInjectionAPI$q2.getSuggestions
92
+ getSuggestions: pluginInjectionAPI === null || pluginInjectionAPI === void 0 || (_pluginInjectionAPI$q2 = pluginInjectionAPI.quickInsert) === null || _pluginInjectionAPI$q2 === void 0 || (_pluginInjectionAPI$q2 = _pluginInjectionAPI$q2.actions) === null || _pluginInjectionAPI$q2 === void 0 ? void 0 : _pluginInjectionAPI$q2.getSuggestions,
93
+ api: pluginInjectionAPI
83
94
  });
84
95
  });
@@ -2,6 +2,7 @@ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { Command, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, OptionalPlugin, QuickInsertHandler, QuickInsertPluginOptions as CommonQuickInsertPluginOptions, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
4
4
  import { type ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
5
+ import { type MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
5
6
  import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
6
7
  export type QuickInsertSharedState = CommonQuickInsertSharedState & {
7
8
  typeAheadHandler: TypeAheadHandler;
@@ -9,7 +10,11 @@ export type QuickInsertSharedState = CommonQuickInsertSharedState & {
9
10
  export type QuickInsertPluginOptions = CommonQuickInsertPluginOptions;
10
11
  export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
11
12
  pluginConfiguration: QuickInsertPluginOptions | undefined;
12
- dependencies: [TypeAheadPlugin, OptionalPlugin<ConnectivityPlugin>];
13
+ dependencies: [
14
+ TypeAheadPlugin,
15
+ OptionalPlugin<ConnectivityPlugin>,
16
+ OptionalPlugin<MetricsPlugin>
17
+ ];
13
18
  sharedState: QuickInsertSharedState | null;
14
19
  actions: {
15
20
  openTypeAhead: (inputMethod: TypeAheadInputMethod, removePrefixTriggerOnCancel?: boolean) => boolean;
@@ -2,6 +2,7 @@ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { Command, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, OptionalPlugin, QuickInsertHandler, QuickInsertPluginOptions as CommonQuickInsertPluginOptions, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
4
4
  import { type ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
5
+ import { type MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
5
6
  import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
6
7
  export type QuickInsertSharedState = CommonQuickInsertSharedState & {
7
8
  typeAheadHandler: TypeAheadHandler;
@@ -11,7 +12,8 @@ export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
11
12
  pluginConfiguration: QuickInsertPluginOptions | undefined;
12
13
  dependencies: [
13
14
  TypeAheadPlugin,
14
- OptionalPlugin<ConnectivityPlugin>
15
+ OptionalPlugin<ConnectivityPlugin>,
16
+ OptionalPlugin<MetricsPlugin>
15
17
  ];
16
18
  sharedState: QuickInsertSharedState | null;
17
19
  actions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-quick-insert",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Quick insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,16 +34,17 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/button": "^23.0.0",
37
- "@atlaskit/editor-common": "^103.4.0",
37
+ "@atlaskit/editor-common": "^103.9.0",
38
38
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
39
- "@atlaskit/editor-plugin-type-ahead": "^2.3.0",
39
+ "@atlaskit/editor-plugin-metrics": "^3.4.0",
40
+ "@atlaskit/editor-plugin-type-ahead": "^2.5.0",
40
41
  "@atlaskit/editor-prosemirror": "7.0.0",
41
- "@atlaskit/icon": "^25.5.0",
42
+ "@atlaskit/icon": "^25.6.0",
42
43
  "@atlaskit/modal-dialog": "^14.1.0",
43
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
45
  "@atlaskit/theme": "^18.0.0",
45
- "@atlaskit/tmp-editor-statsig": "^4.6.0",
46
- "@atlaskit/tokens": "^4.7.0",
46
+ "@atlaskit/tmp-editor-statsig": "^4.11.0",
47
+ "@atlaskit/tokens": "^4.8.0",
47
48
  "@babel/runtime": "^7.0.0",
48
49
  "@emotion/react": "^11.7.1"
49
50
  },
@@ -99,6 +100,9 @@
99
100
  "platform-feature-flags": {
100
101
  "platform_editor_quick_insert_dedupe_title_desc": {
101
102
  "type": "boolean"
103
+ },
104
+ "platform_editor_ease_of_use_metrics": {
105
+ "type": "boolean"
102
106
  }
103
107
  }
104
108
  }