@atlaskit/editor-plugin-type-ahead 1.4.0 → 1.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 1.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#116224](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116224)
8
+ [`ff938650963d9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ff938650963d9) -
9
+ ED-23775 This change prevents duplicated analytic events from firing when inserting mentions and
10
+ emojis via the quickInsert typeAhead menu.
11
+
3
12
  ## 1.4.0
4
13
 
5
14
  ### Minor Changes
@@ -279,16 +279,20 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
279
279
  newTriggerHandler.onOpen(newEditorState);
280
280
  }
281
281
  if (newTriggerHandler && isANewHandler) {
282
- var _api$analytics3;
283
- 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({
284
- action: _analytics.ACTION.INVOKED,
285
- actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
286
- actionSubjectId: newTriggerHandler.id || 'not_set',
287
- attributes: {
288
- inputMethod: newPluginState.inputMethod || _analytics.INPUT_METHOD.KEYBOARD
289
- },
290
- eventType: _analytics.EVENT_TYPE.UI
291
- });
282
+ // 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
283
+ var isDuplicateInvokedEvent = newPluginState.inputMethod === _analytics.INPUT_METHOD.QUICK_INSERT && Object.values(_typeAhead.TypeAheadAvailableNodes).includes(newTriggerHandler.id);
284
+ if (!isDuplicateInvokedEvent) {
285
+ var _api$analytics3;
286
+ 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({
287
+ action: _analytics.ACTION.INVOKED,
288
+ actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
289
+ actionSubjectId: newTriggerHandler.id || 'not_set',
290
+ attributes: {
291
+ inputMethod: newPluginState.inputMethod || _analytics.INPUT_METHOD.KEYBOARD
292
+ },
293
+ eventType: _analytics.EVENT_TYPE.UI
294
+ });
295
+ }
292
296
  }
293
297
  }
294
298
  };
@@ -10,7 +10,7 @@ import React from 'react';
10
10
  import { typeAheadQuery } from '@atlaskit/adf-schema';
11
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
- import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
13
+ import { SelectItemMode, TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
14
14
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
15
15
  import { insertTypeAheadItem } from './commands/insert-type-ahead-item';
16
16
  import { inputRulePlugin } from './pm-plugins/input-rules';
@@ -279,16 +279,20 @@ export const typeAheadPlugin = ({
279
279
  newTriggerHandler.onOpen(newEditorState);
280
280
  }
281
281
  if (newTriggerHandler && isANewHandler) {
282
- var _api$analytics3, _api$analytics3$actio;
283
- 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({
284
- action: ACTION.INVOKED,
285
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
286
- actionSubjectId: newTriggerHandler.id || 'not_set',
287
- attributes: {
288
- inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
289
- },
290
- eventType: EVENT_TYPE.UI
291
- });
282
+ // 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
283
+ const isDuplicateInvokedEvent = newPluginState.inputMethod === INPUT_METHOD.QUICK_INSERT && Object.values(TypeAheadAvailableNodes).includes(newTriggerHandler.id);
284
+ if (!isDuplicateInvokedEvent) {
285
+ var _api$analytics3, _api$analytics3$actio;
286
+ 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({
287
+ action: ACTION.INVOKED,
288
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
289
+ actionSubjectId: newTriggerHandler.id || 'not_set',
290
+ attributes: {
291
+ inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
292
+ },
293
+ eventType: EVENT_TYPE.UI
294
+ });
295
+ }
292
296
  }
293
297
  }
294
298
  };
@@ -10,7 +10,7 @@ import React from 'react';
10
10
  import { typeAheadQuery } from '@atlaskit/adf-schema';
11
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
- import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
13
+ import { SelectItemMode, TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
14
14
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
15
15
  import { insertTypeAheadItem } from './commands/insert-type-ahead-item';
16
16
  import { inputRulePlugin } from './pm-plugins/input-rules';
@@ -271,16 +271,20 @@ export var typeAheadPlugin = function typeAheadPlugin(_ref) {
271
271
  newTriggerHandler.onOpen(newEditorState);
272
272
  }
273
273
  if (newTriggerHandler && isANewHandler) {
274
- var _api$analytics3;
275
- 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({
276
- action: ACTION.INVOKED,
277
- actionSubject: ACTION_SUBJECT.TYPEAHEAD,
278
- actionSubjectId: newTriggerHandler.id || 'not_set',
279
- attributes: {
280
- inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
281
- },
282
- eventType: EVENT_TYPE.UI
283
- });
274
+ // 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
275
+ var isDuplicateInvokedEvent = newPluginState.inputMethod === INPUT_METHOD.QUICK_INSERT && Object.values(TypeAheadAvailableNodes).includes(newTriggerHandler.id);
276
+ if (!isDuplicateInvokedEvent) {
277
+ var _api$analytics3;
278
+ 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({
279
+ action: ACTION.INVOKED,
280
+ actionSubject: ACTION_SUBJECT.TYPEAHEAD,
281
+ actionSubjectId: newTriggerHandler.id || 'not_set',
282
+ attributes: {
283
+ inputMethod: newPluginState.inputMethod || INPUT_METHOD.KEYBOARD
284
+ },
285
+ eventType: EVENT_TYPE.UI
286
+ });
287
+ }
284
288
  }
285
289
  }
286
290
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,11 +33,11 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^38.0.0",
36
- "@atlaskit/editor-common": "^83.3.0",
36
+ "@atlaskit/editor-common": "^83.4.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
38
38
  "@atlaskit/editor-prosemirror": "4.0.1",
39
39
  "@atlaskit/editor-shared-styles": "^2.12.0",
40
- "@atlaskit/menu": "^2.5.0",
40
+ "@atlaskit/menu": "^2.6.0",
41
41
  "@atlaskit/prosemirror-input-rules": "^3.1.0",
42
42
  "@atlaskit/theme": "^12.11.0",
43
43
  "@atlaskit/tokens": "^1.53.0",