@atlaskit/editor-plugin-type-ahead 2.6.4 → 2.7.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,17 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#149096](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/149096)
8
+ [`831e11ae4484e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/831e11ae4484e) -
9
+ ED-27855 remove duplicate typeahead invoked events
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 2.6.4
4
16
 
5
17
  ### Patch Changes
@@ -46,15 +46,25 @@ var createOpenAtTransaction = function createOpenAtTransaction(editorAnalyticsAP
46
46
  })({
47
47
  tr: tr
48
48
  });
49
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
50
- action: _analytics.ACTION.INVOKED,
51
- actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
52
- actionSubjectId: triggerHandler.id,
53
- attributes: {
54
- inputMethod: inputMethod
55
- },
56
- eventType: _analytics.EVENT_TYPE.UI
57
- })(tr);
49
+
50
+ // This function is called from the editor-plugin-emoji and editor-plugin-type-ahead
51
+ // createOpenAtTransaction <- createOpenTypeAhead <- actions.open
52
+ // <- emoji-plugin (Not used)
53
+ // <- type-ahead-plugin (Used)
54
+ // and this caused the analytics event to be fired twice, as other places are relying on the
55
+ // `onEditorViewStateUpdated` method to fire the analytics event
56
+ // We want to disable this event
57
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics_3')) {
58
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
59
+ action: _analytics.ACTION.INVOKED,
60
+ actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
61
+ actionSubjectId: triggerHandler.id,
62
+ attributes: {
63
+ inputMethod: inputMethod
64
+ },
65
+ eventType: _analytics.EVENT_TYPE.UI
66
+ })(tr);
67
+ }
58
68
  return true;
59
69
  };
60
70
  };
@@ -299,16 +309,33 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
299
309
  // if the typeahead opens another typeahead via the quickInsert we do NOT want to fire this analytic event (mentions and emojis) as it is already being fired from editor-plugin-analytics
300
310
  var isDuplicateInvokedEvent = newPluginState.inputMethod === _analytics.INPUT_METHOD.QUICK_INSERT && Object.values(_typeAhead.TypeAheadAvailableNodes).includes(newTriggerHandler.id);
301
311
  if (!isDuplicateInvokedEvent) {
302
- var _api$analytics3;
303
- 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({
304
- action: _analytics.ACTION.INVOKED,
305
- actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
306
- actionSubjectId: newTriggerHandler.id || 'not_set',
307
- attributes: {
308
- inputMethod: newPluginState.inputMethod || _analytics.INPUT_METHOD.KEYBOARD
309
- },
310
- eventType: _analytics.EVENT_TYPE.UI
311
- });
312
+ if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics_3')) {
313
+ var _api$analytics3;
314
+ 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({
315
+ action: _analytics.ACTION.INVOKED,
316
+ actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
317
+ actionSubjectId: newTriggerHandler.id || 'not_set',
318
+ attributes: {
319
+ inputMethod: newPluginState.inputMethod || _analytics.INPUT_METHOD.KEYBOARD
320
+ },
321
+ eventType: _analytics.EVENT_TYPE.UI
322
+ }, undefined, {
323
+ context: {
324
+ selection: newEditorState.selection
325
+ }
326
+ });
327
+ } else {
328
+ var _api$analytics4;
329
+ 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({
330
+ action: _analytics.ACTION.INVOKED,
331
+ actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
332
+ actionSubjectId: newTriggerHandler.id || 'not_set',
333
+ attributes: {
334
+ inputMethod: newPluginState.inputMethod || _analytics.INPUT_METHOD.KEYBOARD
335
+ },
336
+ eventType: _analytics.EVENT_TYPE.UI
337
+ });
338
+ }
312
339
  }
313
340
  } else if (oldIsOpen && !newIsOpen && (0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
314
341
  var _api$metrics2;
@@ -38,15 +38,25 @@ const createOpenAtTransaction = editorAnalyticsAPI => props => tr => {
38
38
  })({
39
39
  tr
40
40
  });
41
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
42
- action: ACTION.INVOKED,
43
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
44
- actionSubjectId: triggerHandler.id,
45
- attributes: {
46
- inputMethod
47
- },
48
- eventType: EVENT_TYPE.UI
49
- })(tr);
41
+
42
+ // This function is called from the editor-plugin-emoji and editor-plugin-type-ahead
43
+ // createOpenAtTransaction <- createOpenTypeAhead <- actions.open
44
+ // <- emoji-plugin (Not used)
45
+ // <- type-ahead-plugin (Used)
46
+ // and this caused the analytics event to be fired twice, as other places are relying on the
47
+ // `onEditorViewStateUpdated` method to fire the analytics event
48
+ // We want to disable this event
49
+ if (!fg('platform_editor_controls_patch_analytics_3')) {
50
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
51
+ action: ACTION.INVOKED,
52
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
53
+ actionSubjectId: triggerHandler.id,
54
+ attributes: {
55
+ inputMethod
56
+ },
57
+ eventType: EVENT_TYPE.UI
58
+ })(tr);
59
+ }
50
60
  return true;
51
61
  };
52
62
  const createOpenTypeAhead = (editorViewRef, editorAnalyticsAPI) => props => {
@@ -299,16 +309,33 @@ export const typeAheadPlugin = ({
299
309
  // if the typeahead opens another typeahead via the quickInsert we do NOT want to fire this analytic event (mentions and emojis) as it is already being fired from editor-plugin-analytics
300
310
  const isDuplicateInvokedEvent = newPluginState.inputMethod === INPUT_METHOD.QUICK_INSERT && Object.values(TypeAheadAvailableNodes).includes(newTriggerHandler.id);
301
311
  if (!isDuplicateInvokedEvent) {
302
- var _api$analytics3, _api$analytics3$actio;
303
- 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({
304
- action: ACTION.INVOKED,
305
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
306
- actionSubjectId: newTriggerHandler.id || 'not_set',
307
- attributes: {
308
- inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
309
- },
310
- eventType: EVENT_TYPE.UI
311
- });
312
+ if (fg('platform_editor_controls_patch_analytics_3')) {
313
+ var _api$analytics3, _api$analytics3$actio;
314
+ 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({
315
+ action: ACTION.INVOKED,
316
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
317
+ actionSubjectId: newTriggerHandler.id || 'not_set',
318
+ attributes: {
319
+ inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
320
+ },
321
+ eventType: EVENT_TYPE.UI
322
+ }, undefined, {
323
+ context: {
324
+ selection: newEditorState.selection
325
+ }
326
+ });
327
+ } else {
328
+ var _api$analytics4, _api$analytics4$actio;
329
+ 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({
330
+ action: ACTION.INVOKED,
331
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
332
+ actionSubjectId: newTriggerHandler.id || 'not_set',
333
+ attributes: {
334
+ inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
335
+ },
336
+ eventType: EVENT_TYPE.UI
337
+ });
338
+ }
312
339
  }
313
340
  } else if (oldIsOpen && !newIsOpen && fg('platform_editor_ease_of_use_metrics')) {
314
341
  var _api$metrics2;
@@ -38,15 +38,25 @@ var createOpenAtTransaction = function createOpenAtTransaction(editorAnalyticsAP
38
38
  })({
39
39
  tr: tr
40
40
  });
41
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
42
- action: ACTION.INVOKED,
43
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
44
- actionSubjectId: triggerHandler.id,
45
- attributes: {
46
- inputMethod: inputMethod
47
- },
48
- eventType: EVENT_TYPE.UI
49
- })(tr);
41
+
42
+ // This function is called from the editor-plugin-emoji and editor-plugin-type-ahead
43
+ // createOpenAtTransaction <- createOpenTypeAhead <- actions.open
44
+ // <- emoji-plugin (Not used)
45
+ // <- type-ahead-plugin (Used)
46
+ // and this caused the analytics event to be fired twice, as other places are relying on the
47
+ // `onEditorViewStateUpdated` method to fire the analytics event
48
+ // We want to disable this event
49
+ if (!fg('platform_editor_controls_patch_analytics_3')) {
50
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
51
+ action: ACTION.INVOKED,
52
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
53
+ actionSubjectId: triggerHandler.id,
54
+ attributes: {
55
+ inputMethod: inputMethod
56
+ },
57
+ eventType: EVENT_TYPE.UI
58
+ })(tr);
59
+ }
50
60
  return true;
51
61
  };
52
62
  };
@@ -291,16 +301,33 @@ export var typeAheadPlugin = function typeAheadPlugin(_ref) {
291
301
  // if the typeahead opens another typeahead via the quickInsert we do NOT want to fire this analytic event (mentions and emojis) as it is already being fired from editor-plugin-analytics
292
302
  var isDuplicateInvokedEvent = newPluginState.inputMethod === INPUT_METHOD.QUICK_INSERT && Object.values(TypeAheadAvailableNodes).includes(newTriggerHandler.id);
293
303
  if (!isDuplicateInvokedEvent) {
294
- var _api$analytics3;
295
- 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({
296
- action: ACTION.INVOKED,
297
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
298
- actionSubjectId: newTriggerHandler.id || 'not_set',
299
- attributes: {
300
- inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
301
- },
302
- eventType: EVENT_TYPE.UI
303
- });
304
+ if (fg('platform_editor_controls_patch_analytics_3')) {
305
+ var _api$analytics3;
306
+ 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({
307
+ action: ACTION.INVOKED,
308
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
309
+ actionSubjectId: newTriggerHandler.id || 'not_set',
310
+ attributes: {
311
+ inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
312
+ },
313
+ eventType: EVENT_TYPE.UI
314
+ }, undefined, {
315
+ context: {
316
+ selection: newEditorState.selection
317
+ }
318
+ });
319
+ } else {
320
+ var _api$analytics4;
321
+ 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({
322
+ action: ACTION.INVOKED,
323
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
324
+ actionSubjectId: newTriggerHandler.id || 'not_set',
325
+ attributes: {
326
+ inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
327
+ },
328
+ eventType: EVENT_TYPE.UI
329
+ });
330
+ }
304
331
  }
305
332
  } else if (oldIsOpen && !newIsOpen && fg('platform_editor_ease_of_use_metrics')) {
306
333
  var _api$metrics2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "2.6.4",
3
+ "version": "2.7.0",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,9 +34,9 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
- "@atlaskit/editor-common": "^105.0.0",
37
+ "@atlaskit/editor-common": "^105.1.0",
38
38
  "@atlaskit/editor-element-browser": "^0.1.0",
39
- "@atlaskit/editor-plugin-analytics": "^2.2.0",
39
+ "@atlaskit/editor-plugin-analytics": "^2.3.0",
40
40
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
41
41
  "@atlaskit/editor-plugin-context-panel": "^4.1.0",
42
42
  "@atlaskit/editor-plugin-metrics": "^3.4.0",
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/primitives": "^14.7.0",
50
50
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
51
51
  "@atlaskit/theme": "^18.0.0",
52
- "@atlaskit/tmp-editor-statsig": "^4.19.0",
52
+ "@atlaskit/tmp-editor-statsig": "^4.20.0",
53
53
  "@atlaskit/tokens": "^4.8.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1",
@@ -117,6 +117,9 @@
117
117
  "platform_editor_controls_patch_analytics": {
118
118
  "type": "boolean"
119
119
  },
120
+ "platform_editor_controls_patch_analytics_3": {
121
+ "type": "boolean"
122
+ },
120
123
  "platform_editor_ease_of_use_metrics": {
121
124
  "type": "boolean"
122
125
  },