@atlaskit/editor-plugin-ufo 2.0.0 → 2.0.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,11 @@
1
1
  # @atlaskit/editor-plugin-ufo
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 2.0.0
4
10
 
5
11
  ### Major Changes
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.disableTTVCOnFirstUserInteraction = void 0;
6
+ exports.abortUFOMeasurementOnFirstUserInteraction = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
- var _vc = require("@atlaskit/react-ufo/vc");
8
+ var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
9
9
  /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
10
10
 
11
11
  function bind(target, event, controller, listener) {
@@ -25,24 +25,7 @@ function bind(target, event, controller, listener) {
25
25
  };
26
26
  }
27
27
  var AbortEvent = ['wheel', 'keydown', 'mousedown', 'pointerdown', 'pointerup', 'touchend', 'scroll', 'mouseover'];
28
- var ttvcAbort = function ttvcAbort() {
29
- var vc = (0, _vc.getVCObserver)();
30
- if (!vc ||
31
- // For reasons that goes beyond my understand,
32
- // the type is not properly set.
33
- // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/169231
34
- // @ts-expect-error
35
- typeof vc.abortCalculation !== 'function') {
36
- return;
37
- }
38
-
39
- // For reasons that goes beyond my understand,
40
- // the type is not properly set.
41
- // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/169231
42
- // @ts-expect-error
43
- vc.abortCalculation();
44
- };
45
- var disableTTVCOnFirstUserInteraction = exports.disableTTVCOnFirstUserInteraction = function disableTTVCOnFirstUserInteraction() {
28
+ var abortUFOMeasurementOnFirstUserInteraction = exports.abortUFOMeasurementOnFirstUserInteraction = function abortUFOMeasurementOnFirstUserInteraction() {
46
29
  if (typeof window.AbortController !== 'function') {
47
30
  return;
48
31
  }
@@ -64,7 +47,7 @@ var disableTTVCOnFirstUserInteraction = exports.disableTTVCOnFirstUserInteractio
64
47
  for (var _i = 0, _AbortEvent = AbortEvent; _i < _AbortEvent.length; _i++) {
65
48
  var abortEventName = _AbortEvent[_i];
66
49
  unbindCallbacks.add(bind(dom, abortEventName, controller, function () {
67
- ttvcAbort();
50
+ (0, _interactionMetrics.abortAll)('new_interaction');
68
51
  unbindFirstInteractionEvents();
69
52
  }));
70
53
  }
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ufoPlugin = void 0;
7
7
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
- var _disableTTVCOnFirstUserInteraction = require("./pm-plugins/disableTTVCOnFirstUserInteraction");
8
+ var _abortUFOMeasurementOnFirstUserInteraction = require("./pm-plugins/abortUFOMeasurementOnFirstUserInteraction");
9
9
  var isSSR = Boolean(process.env.REACT_SSR);
10
10
  var ufoPlugin = exports.ufoPlugin = function ufoPlugin() {
11
11
  return {
@@ -16,8 +16,8 @@ var ufoPlugin = exports.ufoPlugin = function ufoPlugin() {
16
16
  return [];
17
17
  }
18
18
  return [{
19
- name: 'disableTTVCOnFirstUserInteraction',
20
- plugin: _disableTTVCOnFirstUserInteraction.disableTTVCOnFirstUserInteraction
19
+ name: 'abortUFOMeasurementOnFirstUserInteraction',
20
+ plugin: _abortUFOMeasurementOnFirstUserInteraction.abortUFOMeasurementOnFirstUserInteraction
21
21
  }];
22
22
  }
23
23
  };
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { getVCObserver } from '@atlaskit/react-ufo/vc';
3
+ import { abortAll } from '@atlaskit/react-ufo/interaction-metrics';
4
4
  function bind(target, event, controller, listener) {
5
5
  // Safe check for rare cases where window doesn't exist
6
6
  if (!target || typeof target.addEventListener !== 'function') {
@@ -18,24 +18,7 @@ function bind(target, event, controller, listener) {
18
18
  };
19
19
  }
20
20
  const AbortEvent = ['wheel', 'keydown', 'mousedown', 'pointerdown', 'pointerup', 'touchend', 'scroll', 'mouseover'];
21
- const ttvcAbort = () => {
22
- const vc = getVCObserver();
23
- if (!vc ||
24
- // For reasons that goes beyond my understand,
25
- // the type is not properly set.
26
- // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/169231
27
- // @ts-expect-error
28
- typeof vc.abortCalculation !== 'function') {
29
- return;
30
- }
31
-
32
- // For reasons that goes beyond my understand,
33
- // the type is not properly set.
34
- // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/169231
35
- // @ts-expect-error
36
- vc.abortCalculation();
37
- };
38
- export const disableTTVCOnFirstUserInteraction = () => {
21
+ export const abortUFOMeasurementOnFirstUserInteraction = () => {
39
22
  if (typeof window.AbortController !== 'function') {
40
23
  return;
41
24
  }
@@ -58,7 +41,7 @@ export const disableTTVCOnFirstUserInteraction = () => {
58
41
  } = view;
59
42
  for (const abortEventName of AbortEvent) {
60
43
  unbindCallbacks.add(bind(dom, abortEventName, controller, () => {
61
- ttvcAbort();
44
+ abortAll('new_interaction');
62
45
  unbindFirstInteractionEvents();
63
46
  }));
64
47
  }
@@ -1,5 +1,5 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- import { disableTTVCOnFirstUserInteraction } from './pm-plugins/disableTTVCOnFirstUserInteraction';
2
+ import { abortUFOMeasurementOnFirstUserInteraction } from './pm-plugins/abortUFOMeasurementOnFirstUserInteraction';
3
3
  const isSSR = Boolean(process.env.REACT_SSR);
4
4
  export const ufoPlugin = () => ({
5
5
  name: 'ufo',
@@ -9,8 +9,8 @@ export const ufoPlugin = () => ({
9
9
  return [];
10
10
  }
11
11
  return [{
12
- name: 'disableTTVCOnFirstUserInteraction',
13
- plugin: disableTTVCOnFirstUserInteraction
12
+ name: 'abortUFOMeasurementOnFirstUserInteraction',
13
+ plugin: abortUFOMeasurementOnFirstUserInteraction
14
14
  }];
15
15
  }
16
16
  });
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { getVCObserver } from '@atlaskit/react-ufo/vc';
3
+ import { abortAll } from '@atlaskit/react-ufo/interaction-metrics';
4
4
  function bind(target, event, controller, listener) {
5
5
  // Safe check for rare cases where window doesn't exist
6
6
  if (!target || typeof target.addEventListener !== 'function') {
@@ -18,24 +18,7 @@ function bind(target, event, controller, listener) {
18
18
  };
19
19
  }
20
20
  var AbortEvent = ['wheel', 'keydown', 'mousedown', 'pointerdown', 'pointerup', 'touchend', 'scroll', 'mouseover'];
21
- var ttvcAbort = function ttvcAbort() {
22
- var vc = getVCObserver();
23
- if (!vc ||
24
- // For reasons that goes beyond my understand,
25
- // the type is not properly set.
26
- // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/169231
27
- // @ts-expect-error
28
- typeof vc.abortCalculation !== 'function') {
29
- return;
30
- }
31
-
32
- // For reasons that goes beyond my understand,
33
- // the type is not properly set.
34
- // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/169231
35
- // @ts-expect-error
36
- vc.abortCalculation();
37
- };
38
- export var disableTTVCOnFirstUserInteraction = function disableTTVCOnFirstUserInteraction() {
21
+ export var abortUFOMeasurementOnFirstUserInteraction = function abortUFOMeasurementOnFirstUserInteraction() {
39
22
  if (typeof window.AbortController !== 'function') {
40
23
  return;
41
24
  }
@@ -57,7 +40,7 @@ export var disableTTVCOnFirstUserInteraction = function disableTTVCOnFirstUserIn
57
40
  for (var _i = 0, _AbortEvent = AbortEvent; _i < _AbortEvent.length; _i++) {
58
41
  var abortEventName = _AbortEvent[_i];
59
42
  unbindCallbacks.add(bind(dom, abortEventName, controller, function () {
60
- ttvcAbort();
43
+ abortAll('new_interaction');
61
44
  unbindFirstInteractionEvents();
62
45
  }));
63
46
  }
@@ -1,5 +1,5 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- import { disableTTVCOnFirstUserInteraction } from './pm-plugins/disableTTVCOnFirstUserInteraction';
2
+ import { abortUFOMeasurementOnFirstUserInteraction } from './pm-plugins/abortUFOMeasurementOnFirstUserInteraction';
3
3
  var isSSR = Boolean(process.env.REACT_SSR);
4
4
  export var ufoPlugin = function ufoPlugin() {
5
5
  return {
@@ -10,8 +10,8 @@ export var ufoPlugin = function ufoPlugin() {
10
10
  return [];
11
11
  }
12
12
  return [{
13
- name: 'disableTTVCOnFirstUserInteraction',
14
- plugin: disableTTVCOnFirstUserInteraction
13
+ name: 'abortUFOMeasurementOnFirstUserInteraction',
14
+ plugin: abortUFOMeasurementOnFirstUserInteraction
15
15
  }];
16
16
  }
17
17
  };
@@ -0,0 +1,2 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ export declare const abortUFOMeasurementOnFirstUserInteraction: () => SafePlugin<any> | undefined;
@@ -0,0 +1,2 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ export declare const abortUFOMeasurementOnFirstUserInteraction: () => SafePlugin<any> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-ufo",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Ufo plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,10 +32,10 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/editor-common": "^100.0.0",
35
+ "@atlaskit/editor-common": "^101.0.0",
36
36
  "@atlaskit/editor-prosemirror": "7.0.0",
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
- "@atlaskit/react-ufo": "^3.0.0",
38
+ "@atlaskit/react-ufo": "^3.2.0",
39
39
  "@babel/runtime": "^7.0.0"
40
40
  },
41
41
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { getVCObserver } from '@atlaskit/react-ufo/vc';
3
+ import { abortAll } from '@atlaskit/react-ufo/interaction-metrics';
4
4
 
5
5
  function bind(
6
6
  target: HTMLElement,
@@ -48,28 +48,7 @@ const AbortEvent: ReadonlyArray<FirstUserInteractionEvents> = [
48
48
  'mouseover',
49
49
  ];
50
50
 
51
- const ttvcAbort = () => {
52
- const vc = getVCObserver();
53
-
54
- if (
55
- !vc ||
56
- // For reasons that goes beyond my understand,
57
- // the type is not properly set.
58
- // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/169231
59
- // @ts-expect-error
60
- typeof vc.abortCalculation !== 'function'
61
- ) {
62
- return;
63
- }
64
-
65
- // For reasons that goes beyond my understand,
66
- // the type is not properly set.
67
- // https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/169231
68
- // @ts-expect-error
69
- vc.abortCalculation();
70
- };
71
-
72
- export const disableTTVCOnFirstUserInteraction = () => {
51
+ export const abortUFOMeasurementOnFirstUserInteraction = () => {
73
52
  if (typeof window.AbortController !== 'function') {
74
53
  return;
75
54
  }
@@ -96,7 +75,7 @@ export const disableTTVCOnFirstUserInteraction = () => {
96
75
  for (const abortEventName of AbortEvent) {
97
76
  unbindCallbacks.add(
98
77
  bind(dom, abortEventName, controller, () => {
99
- ttvcAbort();
78
+ abortAll('new_interaction');
100
79
 
101
80
  unbindFirstInteractionEvents();
102
81
  }),
package/src/ufoPlugin.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
2
 
3
- import { disableTTVCOnFirstUserInteraction } from './pm-plugins/disableTTVCOnFirstUserInteraction';
3
+ import { abortUFOMeasurementOnFirstUserInteraction } from './pm-plugins/abortUFOMeasurementOnFirstUserInteraction';
4
4
  import type { UfoPlugin } from './ufoPluginType';
5
5
 
6
6
  const isSSR = Boolean(process.env.REACT_SSR);
@@ -16,8 +16,8 @@ export const ufoPlugin: UfoPlugin = () => ({
16
16
 
17
17
  return [
18
18
  {
19
- name: 'disableTTVCOnFirstUserInteraction',
20
- plugin: disableTTVCOnFirstUserInteraction,
19
+ name: 'abortUFOMeasurementOnFirstUserInteraction',
20
+ plugin: abortUFOMeasurementOnFirstUserInteraction,
21
21
  },
22
22
  ];
23
23
  },
@@ -1,2 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare const disableTTVCOnFirstUserInteraction: () => SafePlugin<any> | undefined;
@@ -1,2 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare const disableTTVCOnFirstUserInteraction: () => SafePlugin<any> | undefined;