@atlaskit/editor-plugin-ufo 2.1.1 → 3.1.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 +48 -0
- package/afm-cc/tsconfig.json +6 -3
- package/afm-jira/tsconfig.json +3 -3
- package/afm-post-office/tsconfig.json +3 -3
- package/afm-volt/tsconfig.json +30 -0
- package/dist/cjs/pm-plugins/traceUFOInteractionOnFirstInteraction.js +48 -0
- package/dist/cjs/ufoPlugin.js +15 -13
- package/dist/es2019/pm-plugins/traceUFOInteractionOnFirstInteraction.js +38 -0
- package/dist/es2019/ufoPlugin.js +15 -13
- package/dist/esm/pm-plugins/traceUFOInteractionOnFirstInteraction.js +40 -0
- package/dist/esm/ufoPlugin.js +15 -13
- package/dist/types/pm-plugins/traceUFOInteractionOnFirstInteraction.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/traceUFOInteractionOnFirstInteraction.d.ts +2 -0
- package/package.json +6 -7
- package/src/pm-plugins/traceUFOInteractionOnFirstInteraction.ts +59 -0
- package/src/ufoPlugin.tsx +15 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-ufo
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#183937](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183937)
|
|
8
|
+
[`5826fd37730ab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5826fd37730ab) -
|
|
9
|
+
Triggers traceUFOInteraction on first editor interaction to avoid vc90 blindspots
|
|
10
|
+
|
|
11
|
+
## 3.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#181024](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181024)
|
|
16
|
+
[`8e80c487ca307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e80c487ca307) - ##
|
|
17
|
+
Make `@atlaskit/editor-common` a peer dependency
|
|
18
|
+
|
|
19
|
+
**WHAT:** `@atlaskit/editor-common` has been moved from `dependencies` to `peerDependencies` in
|
|
20
|
+
all editor plugin packages.
|
|
21
|
+
|
|
22
|
+
**WHY:** This change ensures that only a single version of `@atlaskit/editor-common` is used in
|
|
23
|
+
consuming applications, preventing issues caused by multiple versions of singleton libraries (such
|
|
24
|
+
as context mismatches or duplicated state). This is especially important for packages that rely on
|
|
25
|
+
shared context or singletons.
|
|
26
|
+
|
|
27
|
+
**HOW TO ADJUST:**
|
|
28
|
+
|
|
29
|
+
- Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
|
|
30
|
+
any of these editor plugins.
|
|
31
|
+
- Ensure the version you install matches the version required by the plugins.
|
|
32
|
+
- You can use the
|
|
33
|
+
[`check-peer-dependencies`](https://www.npmjs.com/package/check-peer-dependencies) package to
|
|
34
|
+
verify that all required peer dependencies are installed and compatible.
|
|
35
|
+
- Example install command:
|
|
36
|
+
```
|
|
37
|
+
npm install @atlaskit/editor-common
|
|
38
|
+
```
|
|
39
|
+
or
|
|
40
|
+
```
|
|
41
|
+
yarn add @atlaskit/editor-common
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Note:** This is a breaking change. If `@atlaskit/editor-common` is not installed at the
|
|
45
|
+
application level, you may see errors or unexpected behavior.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies
|
|
50
|
+
|
|
3
51
|
## 2.1.1
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -17,14 +17,17 @@
|
|
|
17
17
|
"../src/**/examples.*"
|
|
18
18
|
],
|
|
19
19
|
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../editor-common/afm-cc/tsconfig.json"
|
|
22
|
-
},
|
|
23
20
|
{
|
|
24
21
|
"path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
|
|
25
22
|
},
|
|
26
23
|
{
|
|
27
24
|
"path": "../../../react-ufo/atlaskit/afm-cc/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../tmp-editor-statsig/afm-cc/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-common/afm-cc/tsconfig.json"
|
|
28
31
|
}
|
|
29
32
|
]
|
|
30
33
|
}
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"../src/**/examples.*"
|
|
18
18
|
],
|
|
19
19
|
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../editor-common/afm-jira/tsconfig.json"
|
|
22
|
-
},
|
|
23
20
|
{
|
|
24
21
|
"path": "../../../platform/feature-flags/afm-jira/tsconfig.json"
|
|
25
22
|
},
|
|
26
23
|
{
|
|
27
24
|
"path": "../../../react-ufo/atlaskit/afm-jira/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-common/afm-jira/tsconfig.json"
|
|
28
28
|
}
|
|
29
29
|
]
|
|
30
30
|
}
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"../src/**/examples.*"
|
|
18
18
|
],
|
|
19
19
|
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../editor-common/afm-post-office/tsconfig.json"
|
|
22
|
-
},
|
|
23
20
|
{
|
|
24
21
|
"path": "../../../platform/feature-flags/afm-post-office/tsconfig.json"
|
|
25
22
|
},
|
|
26
23
|
{
|
|
27
24
|
"path": "../../../react-ufo/atlaskit/afm-post-office/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-common/afm-post-office/tsconfig.json"
|
|
28
28
|
}
|
|
29
29
|
]
|
|
30
30
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.volt.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es5",
|
|
5
|
+
"outDir": "../../../../../volt/tsDist/@atlaskit__editor-plugin-ufo/app",
|
|
6
|
+
"rootDir": "../",
|
|
7
|
+
"composite": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"../src/**/*.ts",
|
|
11
|
+
"../src/**/*.tsx"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"../src/**/__tests__/*",
|
|
15
|
+
"../src/**/*.test.*",
|
|
16
|
+
"../src/**/test.*",
|
|
17
|
+
"../src/**/examples.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../editor-common/afm-volt/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../../platform/feature-flags/afm-volt/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../../react-ufo/atlaskit/afm-volt/tsconfig.json"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.traceUFOInteractionOnFirstInteraction = void 0;
|
|
8
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
|
+
var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
|
|
10
|
+
var _traceInteraction = _interopRequireDefault(require("@atlaskit/react-ufo/trace-interaction"));
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
13
|
+
|
|
14
|
+
var traceUFOInteractionOnFirstInteraction = exports.traceUFOInteractionOnFirstInteraction = function traceUFOInteractionOnFirstInteraction() {
|
|
15
|
+
var aborted = false;
|
|
16
|
+
function abortIfNotAborted(event) {
|
|
17
|
+
if (aborted) {
|
|
18
|
+
// opt out of additional logic if already aborted
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
|
|
22
|
+
if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
|
|
23
|
+
(0, _traceInteraction.default)('new_interaction', event);
|
|
24
|
+
}
|
|
25
|
+
aborted = true;
|
|
26
|
+
}
|
|
27
|
+
return new _safePlugin.SafePlugin({
|
|
28
|
+
props: {
|
|
29
|
+
handleDOMEvents: {
|
|
30
|
+
mouseover: function mouseover(_view, event) {
|
|
31
|
+
if ((0, _expValEquals.expValEquals)('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
abortIfNotAborted(event);
|
|
35
|
+
},
|
|
36
|
+
mouseenter: function mouseenter(_view, event) {
|
|
37
|
+
if ((0, _expValEquals.expValEquals)('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
abortIfNotAborted(event);
|
|
41
|
+
},
|
|
42
|
+
mousedown: function mousedown(_view, event) {
|
|
43
|
+
return abortIfNotAborted(event);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
package/dist/cjs/ufoPlugin.js
CHANGED
|
@@ -4,23 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ufoPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
|
+
var _traceUFOInteractionOnFirstInteraction = require("./pm-plugins/traceUFOInteractionOnFirstInteraction");
|
|
9
9
|
var ufoPlugin = exports.ufoPlugin = function ufoPlugin() {
|
|
10
10
|
return {
|
|
11
11
|
name: 'ufo',
|
|
12
12
|
pmPlugins: function pmPlugins() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
var _process;
|
|
14
|
+
var isSSR = Boolean((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR);
|
|
15
|
+
if (isSSR) {
|
|
16
|
+
// This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
if ((0, _expValEquals.expValEquals)('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'control')) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return [{
|
|
23
|
+
name: 'traceUFOInteractionOnFirstInteraction',
|
|
24
|
+
plugin: _traceUFOInteractionOnFirstInteraction.traceUFOInteractionOnFirstInteraction
|
|
25
|
+
}];
|
|
24
26
|
}
|
|
25
27
|
};
|
|
26
28
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
2
|
+
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';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
+
export const traceUFOInteractionOnFirstInteraction = () => {
|
|
7
|
+
let aborted = false;
|
|
8
|
+
function abortIfNotAborted(event) {
|
|
9
|
+
if (aborted) {
|
|
10
|
+
// opt out of additional logic if already aborted
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const activeInteraction = getActiveInteraction();
|
|
14
|
+
if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
|
|
15
|
+
traceUFOInteraction('new_interaction', event);
|
|
16
|
+
}
|
|
17
|
+
aborted = true;
|
|
18
|
+
}
|
|
19
|
+
return new SafePlugin({
|
|
20
|
+
props: {
|
|
21
|
+
handleDOMEvents: {
|
|
22
|
+
mouseover: (_view, event) => {
|
|
23
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
abortIfNotAborted(event);
|
|
27
|
+
},
|
|
28
|
+
mouseenter: (_view, event) => {
|
|
29
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
abortIfNotAborted(event);
|
|
33
|
+
},
|
|
34
|
+
mousedown: (_view, event) => abortIfNotAborted(event)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
package/dist/es2019/ufoPlugin.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
|
+
import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
|
|
3
3
|
export const ufoPlugin = () => ({
|
|
4
4
|
name: 'ufo',
|
|
5
5
|
pmPlugins() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
var _process, _process$env;
|
|
7
|
+
const isSSR = Boolean((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.REACT_SSR);
|
|
8
|
+
if (isSSR) {
|
|
9
|
+
// This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'control')) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return [{
|
|
16
|
+
name: 'traceUFOInteractionOnFirstInteraction',
|
|
17
|
+
plugin: traceUFOInteractionOnFirstInteraction
|
|
18
|
+
}];
|
|
17
19
|
}
|
|
18
20
|
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
2
|
+
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';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
+
export var traceUFOInteractionOnFirstInteraction = function traceUFOInteractionOnFirstInteraction() {
|
|
7
|
+
var aborted = false;
|
|
8
|
+
function abortIfNotAborted(event) {
|
|
9
|
+
if (aborted) {
|
|
10
|
+
// opt out of additional logic if already aborted
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
var activeInteraction = getActiveInteraction();
|
|
14
|
+
if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
|
|
15
|
+
traceUFOInteraction('new_interaction', event);
|
|
16
|
+
}
|
|
17
|
+
aborted = true;
|
|
18
|
+
}
|
|
19
|
+
return new SafePlugin({
|
|
20
|
+
props: {
|
|
21
|
+
handleDOMEvents: {
|
|
22
|
+
mouseover: function mouseover(_view, event) {
|
|
23
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
abortIfNotAborted(event);
|
|
27
|
+
},
|
|
28
|
+
mouseenter: function mouseenter(_view, event) {
|
|
29
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'only_mousedown_event')) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
abortIfNotAborted(event);
|
|
33
|
+
},
|
|
34
|
+
mousedown: function mousedown(_view, event) {
|
|
35
|
+
return abortIfNotAborted(event);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
package/dist/esm/ufoPlugin.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
|
+
import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
|
|
3
3
|
export var ufoPlugin = function ufoPlugin() {
|
|
4
4
|
return {
|
|
5
5
|
name: 'ufo',
|
|
6
6
|
pmPlugins: function pmPlugins() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
var _process;
|
|
8
|
+
var isSSR = Boolean((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR);
|
|
9
|
+
if (isSSR) {
|
|
10
|
+
// This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'control')) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return [{
|
|
17
|
+
name: 'traceUFOInteractionOnFirstInteraction',
|
|
18
|
+
plugin: traceUFOInteractionOnFirstInteraction
|
|
19
|
+
}];
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-ufo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Ufo plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Editor: Lego",
|
|
12
12
|
"releaseModel": "continuous",
|
|
13
|
-
"singleton": true
|
|
14
|
-
"runReact18": true
|
|
13
|
+
"singleton": true
|
|
15
14
|
},
|
|
16
15
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
17
16
|
"main": "dist/cjs/index.js",
|
|
@@ -32,13 +31,14 @@
|
|
|
32
31
|
".": "./src/index.ts"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@atlaskit/editor-common": "^107.0.0",
|
|
36
34
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
37
35
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
38
|
-
"@atlaskit/react-ufo": "^3.
|
|
36
|
+
"@atlaskit/react-ufo": "^3.14.0",
|
|
37
|
+
"@atlaskit/tmp-editor-statsig": "^9.3.0",
|
|
39
38
|
"@babel/runtime": "^7.0.0"
|
|
40
39
|
},
|
|
41
40
|
"peerDependencies": {
|
|
41
|
+
"@atlaskit/editor-common": "^107.7.0",
|
|
42
42
|
"react": "^18.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -79,6 +79,5 @@
|
|
|
79
79
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
80
80
|
]
|
|
81
81
|
}
|
|
82
|
-
}
|
|
83
|
-
"platform-feature-flags": {}
|
|
82
|
+
}
|
|
84
83
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
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 { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
|
|
8
|
+
export const traceUFOInteractionOnFirstInteraction = () => {
|
|
9
|
+
let aborted = false;
|
|
10
|
+
|
|
11
|
+
function abortIfNotAborted(event: Event) {
|
|
12
|
+
if (aborted) {
|
|
13
|
+
// opt out of additional logic if already aborted
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const activeInteraction = getActiveInteraction();
|
|
18
|
+
|
|
19
|
+
if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
|
|
20
|
+
traceUFOInteraction('new_interaction', event);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
aborted = true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return new SafePlugin({
|
|
27
|
+
props: {
|
|
28
|
+
handleDOMEvents: {
|
|
29
|
+
mouseover: (_view: EditorView, event: Event) => {
|
|
30
|
+
if (
|
|
31
|
+
expValEquals(
|
|
32
|
+
'cc_editor_interactions_trigger_traceufointeraction',
|
|
33
|
+
'cohort',
|
|
34
|
+
'only_mousedown_event',
|
|
35
|
+
)
|
|
36
|
+
) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
abortIfNotAborted(event);
|
|
41
|
+
},
|
|
42
|
+
mouseenter: (_view: EditorView, event: Event) => {
|
|
43
|
+
if (
|
|
44
|
+
expValEquals(
|
|
45
|
+
'cc_editor_interactions_trigger_traceufointeraction',
|
|
46
|
+
'cohort',
|
|
47
|
+
'only_mousedown_event',
|
|
48
|
+
)
|
|
49
|
+
) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
abortIfNotAborted(event);
|
|
54
|
+
},
|
|
55
|
+
mousedown: (_view: EditorView, event: Event) => abortIfNotAborted(event),
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
};
|
package/src/ufoPlugin.tsx
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
|
+
|
|
3
|
+
import { traceUFOInteractionOnFirstInteraction } from './pm-plugins/traceUFOInteractionOnFirstInteraction';
|
|
2
4
|
import type { UfoPlugin } from './ufoPluginType';
|
|
3
5
|
|
|
4
6
|
export const ufoPlugin: UfoPlugin = () => ({
|
|
5
7
|
name: 'ufo',
|
|
6
8
|
|
|
7
9
|
pmPlugins() {
|
|
8
|
-
|
|
10
|
+
const isSSR = Boolean(process?.env?.REACT_SSR);
|
|
11
|
+
|
|
12
|
+
if (isSSR) {
|
|
13
|
+
// This plugin is not needed in SSR environments - and uses apis which are not available in SSR internally
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (expValEquals('cc_editor_interactions_trigger_traceufointeraction', 'cohort', 'control')) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
9
20
|
|
|
10
|
-
// This experimental plugin has been abandoned as per ED-27989
|
|
11
|
-
/*
|
|
12
21
|
return [
|
|
13
22
|
{
|
|
14
|
-
name: '
|
|
15
|
-
plugin:
|
|
23
|
+
name: 'traceUFOInteractionOnFirstInteraction',
|
|
24
|
+
plugin: traceUFOInteractionOnFirstInteraction,
|
|
16
25
|
},
|
|
17
26
|
];
|
|
18
|
-
*/
|
|
19
27
|
},
|
|
20
28
|
});
|