@atlaskit/editor-plugin-ufo 7.0.0 → 7.0.2

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,20 @@
1
1
  # @atlaskit/editor-plugin-ufo
2
2
 
3
+ ## 7.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`83792cc1d590e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/83792cc1d590e) -
8
+ Abort UFO measurements when user interacts with the editor during VC90 load tracking, gated behind
9
+ platform_editor_abort_ufo_on_user_interaction experiment
10
+ - Updated dependencies
11
+
12
+ ## 7.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 7.0.0
4
19
 
5
20
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../../tsconfig.entry-points.confluence.json",
2
+ "extends": "../../../../tsconfig.local-consumption.json",
3
3
  "compilerOptions": {
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-ufo",
@@ -29,6 +29,9 @@
29
29
  {
30
30
  "path": "../../../react-ufo/atlaskit/afm-cc/tsconfig.json"
31
31
  },
32
+ {
33
+ "path": "../../tmp-editor-statsig/afm-cc/tsconfig.json"
34
+ },
32
35
  {
33
36
  "path": "../../editor-common/afm-cc/tsconfig.json"
34
37
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../../tsconfig.entry-points.jira.json",
2
+ "extends": "../../../../tsconfig.local-consumption.json",
3
3
  "compilerOptions": {
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../jira/tsDist/@atlaskit__editor-plugin-ufo/app",
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../../tsconfig.entry-points.products.json",
2
+ "extends": "../../../../tsconfig.local-consumption.json",
3
3
  "compilerOptions": {
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../tsDist/@atlaskit__editor-plugin-ufo/app",
@@ -1,50 +1,32 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.traceUFOInteractionOnFirstInteraction = void 0;
8
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
+ var _selection = require("@atlaskit/editor-common/selection");
9
+ var _utils = require("@atlaskit/editor-common/utils");
9
10
  var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
10
- var _traceInteraction = _interopRequireDefault(require("@atlaskit/react-ufo/trace-interaction"));
11
- /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
12
-
13
11
  var traceUFOInteractionOnFirstInteraction = exports.traceUFOInteractionOnFirstInteraction = function traceUFOInteractionOnFirstInteraction() {
14
- var aborted = false;
15
- function abortIfNotAborted(event) {
16
- if (aborted) {
17
- // opt out of additional logic if already aborted
18
- return;
19
- }
20
- var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
21
- if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
22
- (0, _traceInteraction.default)('new_interaction', event);
23
- }
24
- aborted = true;
25
- }
26
12
  return new _safePlugin.SafePlugin({
27
- props: {
28
- handleDOMEvents: {
29
- mouseover: function mouseover(_view, event) {
30
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
31
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
32
- // If we did want to re-enable it, we would want to rollout with the ability to gate to specific events like below:
33
- // if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) { return }
34
- abortIfNotAborted(event);
35
- },
36
- mouseenter: function mouseenter(_view, event) {
37
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
38
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
39
- // If we did want to re-enable it, we would want to rollout with the ability to gate to specific events like below:
40
- // if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) { return }
41
-
42
- abortIfNotAborted(event);
43
- },
44
- mousedown: function mousedown(_view, event) {
45
- return abortIfNotAborted(event);
13
+ view: function view() {
14
+ var aborted = false;
15
+ return {
16
+ update: function update(view, prevState) {
17
+ if (aborted) {
18
+ // opt out of additional logic if already aborted
19
+ return;
20
+ }
21
+ if (!view.state.selection.eq(prevState.selection) && !(0, _selection.atTheBeginningOfDoc)(view.state) && !(0, _utils.isEmptyDocument)(view.state.doc)) {
22
+ var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
23
+ if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
24
+ (0, _interactionMetrics.abortAll)('new_interaction', "selection-changed-on-editor-element");
25
+ }
26
+ aborted = true;
27
+ }
46
28
  }
47
- }
29
+ };
48
30
  }
49
31
  });
50
32
  };
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ufoPlugin = void 0;
7
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
+ var _traceUFOInteractionOnFirstInteraction = require("./pm-plugins/traceUFOInteractionOnFirstInteraction");
7
9
  var ufoPlugin = exports.ufoPlugin = function ufoPlugin() {
8
10
  return {
9
11
  name: 'ufo',
@@ -14,17 +16,13 @@ var ufoPlugin = exports.ufoPlugin = function ufoPlugin() {
14
16
  // This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
15
17
  return [];
16
18
  }
17
-
18
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
19
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
19
+ if ((0, _expValEquals.expValEquals)('platform_editor_abort_ufo_on_user_interaction', 'isEnabled', true)) {
20
+ return [{
21
+ name: 'traceUFOInteractionOnFirstInteraction',
22
+ plugin: _traceUFOInteractionOnFirstInteraction.traceUFOInteractionOnFirstInteraction
23
+ }];
24
+ }
20
25
  return [];
21
-
22
- // return [
23
- // {
24
- // name: 'traceUFOInteractionOnFirstInteraction',
25
- // plugin: traceUFOInteractionOnFirstInteraction,
26
- // },
27
- // ];
28
26
  }
29
27
  };
30
28
  };
@@ -1,40 +1,26 @@
1
- /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
4
- import traceUFOInteraction from '@atlaskit/react-ufo/trace-interaction';
2
+ import { atTheBeginningOfDoc } from '@atlaskit/editor-common/selection';
3
+ import { isEmptyDocument } from '@atlaskit/editor-common/utils';
4
+ import { abortAll, getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
5
5
  export const traceUFOInteractionOnFirstInteraction = () => {
6
- let aborted = false;
7
- function abortIfNotAborted(event) {
8
- if (aborted) {
9
- // opt out of additional logic if already aborted
10
- return;
11
- }
12
- const activeInteraction = getActiveInteraction();
13
- if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
14
- traceUFOInteraction('new_interaction', event);
15
- }
16
- aborted = true;
17
- }
18
6
  return new SafePlugin({
19
- props: {
20
- handleDOMEvents: {
21
- mouseover: (_view, event) => {
22
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
23
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
24
- // If we did want to re-enable it, we would want to rollout with the ability to gate to specific events like below:
25
- // if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) { return }
26
- abortIfNotAborted(event);
27
- },
28
- mouseenter: (_view, event) => {
29
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
30
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
31
- // If we did want to re-enable it, we would want to rollout with the ability to gate to specific events like below:
32
- // if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) { return }
33
-
34
- abortIfNotAborted(event);
35
- },
36
- mousedown: (_view, event) => abortIfNotAborted(event)
37
- }
7
+ view() {
8
+ let aborted = false;
9
+ return {
10
+ update(view, prevState) {
11
+ if (aborted) {
12
+ // opt out of additional logic if already aborted
13
+ return;
14
+ }
15
+ if (!view.state.selection.eq(prevState.selection) && !atTheBeginningOfDoc(view.state) && !isEmptyDocument(view.state.doc)) {
16
+ const activeInteraction = getActiveInteraction();
17
+ if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
18
+ abortAll('new_interaction', `selection-changed-on-editor-element`);
19
+ }
20
+ aborted = true;
21
+ }
22
+ }
23
+ };
38
24
  }
39
25
  });
40
26
  };
@@ -1,3 +1,5 @@
1
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
+ import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
1
3
  export const ufoPlugin = () => ({
2
4
  name: 'ufo',
3
5
  pmPlugins() {
@@ -7,16 +9,12 @@ export const ufoPlugin = () => ({
7
9
  // This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
8
10
  return [];
9
11
  }
10
-
11
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
12
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
12
+ if (expValEquals('platform_editor_abort_ufo_on_user_interaction', 'isEnabled', true)) {
13
+ return [{
14
+ name: 'traceUFOInteractionOnFirstInteraction',
15
+ plugin: traceUFOInteractionOnFirstInteraction
16
+ }];
17
+ }
13
18
  return [];
14
-
15
- // return [
16
- // {
17
- // name: 'traceUFOInteractionOnFirstInteraction',
18
- // plugin: traceUFOInteractionOnFirstInteraction,
19
- // },
20
- // ];
21
19
  }
22
20
  });
@@ -1,42 +1,26 @@
1
- /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
4
- import traceUFOInteraction from '@atlaskit/react-ufo/trace-interaction';
2
+ import { atTheBeginningOfDoc } from '@atlaskit/editor-common/selection';
3
+ import { isEmptyDocument } from '@atlaskit/editor-common/utils';
4
+ import { abortAll, getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
5
5
  export var traceUFOInteractionOnFirstInteraction = function traceUFOInteractionOnFirstInteraction() {
6
- var aborted = false;
7
- function abortIfNotAborted(event) {
8
- if (aborted) {
9
- // opt out of additional logic if already aborted
10
- return;
11
- }
12
- var activeInteraction = getActiveInteraction();
13
- if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
14
- traceUFOInteraction('new_interaction', event);
15
- }
16
- aborted = true;
17
- }
18
6
  return new SafePlugin({
19
- props: {
20
- handleDOMEvents: {
21
- mouseover: function mouseover(_view, event) {
22
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
23
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
24
- // If we did want to re-enable it, we would want to rollout with the ability to gate to specific events like below:
25
- // if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) { return }
26
- abortIfNotAborted(event);
27
- },
28
- mouseenter: function mouseenter(_view, event) {
29
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
30
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
31
- // If we did want to re-enable it, we would want to rollout with the ability to gate to specific events like below:
32
- // if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) { return }
33
-
34
- abortIfNotAborted(event);
35
- },
36
- mousedown: function mousedown(_view, event) {
37
- return abortIfNotAborted(event);
7
+ view: function view() {
8
+ var aborted = false;
9
+ return {
10
+ update: function update(view, prevState) {
11
+ if (aborted) {
12
+ // opt out of additional logic if already aborted
13
+ return;
14
+ }
15
+ if (!view.state.selection.eq(prevState.selection) && !atTheBeginningOfDoc(view.state) && !isEmptyDocument(view.state.doc)) {
16
+ var activeInteraction = getActiveInteraction();
17
+ if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
18
+ abortAll('new_interaction', "selection-changed-on-editor-element");
19
+ }
20
+ aborted = true;
21
+ }
38
22
  }
39
- }
23
+ };
40
24
  }
41
25
  });
42
26
  };
@@ -1,3 +1,5 @@
1
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
+ import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
1
3
  export var ufoPlugin = function ufoPlugin() {
2
4
  return {
3
5
  name: 'ufo',
@@ -8,17 +10,13 @@ export var ufoPlugin = function ufoPlugin() {
8
10
  // This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
9
11
  return [];
10
12
  }
11
-
12
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
13
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
13
+ if (expValEquals('platform_editor_abort_ufo_on_user_interaction', 'isEnabled', true)) {
14
+ return [{
15
+ name: 'traceUFOInteractionOnFirstInteraction',
16
+ plugin: traceUFOInteractionOnFirstInteraction
17
+ }];
18
+ }
14
19
  return [];
15
-
16
- // return [
17
- // {
18
- // name: 'traceUFOInteractionOnFirstInteraction',
19
- // plugin: traceUFOInteractionOnFirstInteraction,
20
- // },
21
- // ];
22
20
  }
23
21
  };
24
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-ufo",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "description": "Ufo plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,12 +28,13 @@
28
28
  "sideEffects": false,
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
- "@atlaskit/editor-prosemirror": "^7.2.0",
32
- "@atlaskit/react-ufo": "^4.16.0",
31
+ "@atlaskit/editor-prosemirror": "^7.3.0",
32
+ "@atlaskit/react-ufo": "^5.4.0",
33
+ "@atlaskit/tmp-editor-statsig": "^35.3.0",
33
34
  "@babel/runtime": "^7.0.0"
34
35
  },
35
36
  "peerDependencies": {
36
- "@atlaskit/editor-common": "^111.0.0",
37
+ "@atlaskit/editor-common": "^111.30.0",
37
38
  "react": "^18.2.0"
38
39
  },
39
40
  "techstack": {
@@ -1,47 +1,38 @@
1
- /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { atTheBeginningOfDoc } from '@atlaskit/editor-common/selection';
3
+ import { isEmptyDocument } from '@atlaskit/editor-common/utils';
4
+ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
3
5
  import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import { getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
5
- import traceUFOInteraction from '@atlaskit/react-ufo/trace-interaction';
6
+ import { abortAll, getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
6
7
 
7
8
  export const traceUFOInteractionOnFirstInteraction = () => {
8
- let aborted = false;
9
-
10
- function abortIfNotAborted(event: Event) {
11
- if (aborted) {
12
- // opt out of additional logic if already aborted
13
- return;
14
- }
15
-
16
- const activeInteraction = getActiveInteraction();
17
-
18
- if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
19
- traceUFOInteraction('new_interaction', event);
20
- }
21
-
22
- aborted = true;
23
- }
24
-
25
9
  return new SafePlugin({
26
- props: {
27
- handleDOMEvents: {
28
- mouseover: (_view: EditorView, event: Event) => {
29
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
30
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
31
- // If we did want to re-enable it, we would want to rollout with the ability to gate to specific events like below:
32
- // if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) { return }
33
- abortIfNotAborted(event);
34
- },
35
- mouseenter: (_view: EditorView, event: Event) => {
36
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
37
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
38
- // If we did want to re-enable it, we would want to rollout with the ability to gate to specific events like below:
39
- // if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) { return }
10
+ view() {
11
+ let aborted = false;
12
+ return {
13
+ update(view: EditorView, prevState: EditorState) {
14
+ if (aborted) {
15
+ // opt out of additional logic if already aborted
16
+ return;
17
+ }
18
+
19
+ if (
20
+ !view.state.selection.eq(prevState.selection) &&
21
+ !atTheBeginningOfDoc(view.state) &&
22
+ !isEmptyDocument(view.state.doc)
23
+ ) {
24
+ const activeInteraction = getActiveInteraction();
40
25
 
41
- abortIfNotAborted(event);
26
+ if (
27
+ activeInteraction &&
28
+ ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)
29
+ ) {
30
+ abortAll('new_interaction', `selection-changed-on-editor-element`);
31
+ }
32
+ aborted = true;
33
+ }
42
34
  },
43
- mousedown: (_view: EditorView, event: Event) => abortIfNotAborted(event),
44
- },
35
+ };
45
36
  },
46
37
  });
47
38
  };
package/src/ufoPlugin.tsx CHANGED
@@ -1,3 +1,6 @@
1
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
+
3
+ import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
1
4
  import type { UfoPlugin } from './ufoPluginType';
2
5
 
3
6
  export const ufoPlugin: UfoPlugin = () => ({
@@ -11,15 +14,15 @@ export const ufoPlugin: UfoPlugin = () => ({
11
14
  return [];
12
15
  }
13
16
 
14
- // This Plugin is not currently used as it leads to too high a level of abortions (due to the current TTAI timing being long, and users starting click before TTAI completes).
15
- // This can be reconsidered if we meaningfully reduce our TTAI (ie. <7 seconds)
16
- return [];
17
+ if (expValEquals('platform_editor_abort_ufo_on_user_interaction', 'isEnabled', true)) {
18
+ return [
19
+ {
20
+ name: 'traceUFOInteractionOnFirstInteraction',
21
+ plugin: traceUFOInteractionOnFirstInteraction,
22
+ },
23
+ ];
24
+ }
17
25
 
18
- // return [
19
- // {
20
- // name: 'traceUFOInteractionOnFirstInteraction',
21
- // plugin: traceUFOInteractionOnFirstInteraction,
22
- // },
23
- // ];
26
+ return [];
24
27
  },
25
28
  });
package/tsconfig.app.json CHANGED
@@ -39,6 +39,9 @@
39
39
  },
40
40
  {
41
41
  "path": "../../react-ufo/atlaskit/tsconfig.app.json"
42
+ },
43
+ {
44
+ "path": "../tmp-editor-statsig/tsconfig.app.json"
42
45
  }
43
46
  ]
44
47
  }
package/tsconfig.json CHANGED
@@ -3,7 +3,5 @@
3
3
  "include": [
4
4
  "src/**/*.ts",
5
5
  "src/**/*.tsx"
6
- ],
7
- "compilerOptions": {
8
- }
6
+ ]
9
7
  }
@@ -1,22 +0,0 @@
1
- {
2
- "extends": "../tsconfig",
3
- "compilerOptions": {
4
- "target": "es5",
5
- "paths": {}
6
- },
7
- "include": [
8
- "../src/**/*.ts",
9
- "../src/**/*.tsx"
10
- ],
11
- "exclude": [
12
- "../src/**/__tests__/*",
13
- "../src/**/*.test.*",
14
- "../src/**/test.*",
15
- "../src/**/examples.*",
16
- "../src/**/examples/*",
17
- "../src/**/examples/**/*",
18
- "../src/**/*.stories.*",
19
- "../src/**/stories/*",
20
- "../src/**/stories/**/*"
21
- ]
22
- }