@atlaskit/editor-core 198.2.0 → 198.2.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-core
2
2
 
3
+ ## 198.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#147461](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147461)
8
+ [`5f0dad925df3b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5f0dad925df3b) -
9
+ Remove content retrieval tracking to decouple editor-core from editor actions. Should have no
10
+ affect on functionality.
11
+
3
12
  ## 198.2.0
4
13
 
5
14
  ### Minor Changes
@@ -14,7 +14,6 @@ var _v = _interopRequireDefault(require("uuid/v4"));
14
14
  var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
15
15
  var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
16
16
  var _analytics = require("@atlaskit/editor-common/analytics");
17
- var _hooks = require("@atlaskit/editor-common/hooks");
18
17
  var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
19
18
  var _ufo = require("@atlaskit/editor-common/ufo");
20
19
  var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
@@ -28,7 +27,6 @@ var _useMeasureEditorMountTime = _interopRequireDefault(require("./hooks/useMeas
28
27
  var _useMemoEditorProps = _interopRequireDefault(require("./hooks/useMemoEditorProps"));
29
28
  var _useProviderFactory = _interopRequireDefault(require("./hooks/useProviderFactory"));
30
29
  var _sendDurationAnalytics = _interopRequireDefault(require("./utils/sendDurationAnalytics"));
31
- var _trackEditorActions = _interopRequireDefault(require("./utils/trackEditorActions"));
32
30
  /**
33
31
  * @jsxRuntime classic
34
32
  * @jsx jsx
@@ -57,11 +55,6 @@ function Editor(passedProps) {
57
55
  var handleAnalyticsEvent = (0, _react.useCallback)(function (data) {
58
56
  (0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)(data);
59
57
  }, [createAnalyticsEvent]);
60
- (0, _hooks.useConstructor)(function () {
61
- (0, _trackEditorActions.default)(editorActions, props.performanceTracking, function (value) {
62
- return handleAnalyticsEvent(value);
63
- });
64
- });
65
58
  var getExperienceStore = (0, _react.useCallback)(function () {
66
59
  return experienceStore.current;
67
60
  }, []);
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "198.2.0";
8
+ var version = exports.version = "198.2.1";
@@ -12,7 +12,6 @@ import uuid from 'uuid/v4';
12
12
  import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
13
13
  import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
14
14
  import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
15
- import { useConstructor } from '@atlaskit/editor-common/hooks';
16
15
  import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
17
16
  import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
18
17
  import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils/analytics';
@@ -26,7 +25,6 @@ import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
26
25
  import useMemoEditorProps from './hooks/useMemoEditorProps';
27
26
  import useProviderFactory from './hooks/useProviderFactory';
28
27
  import sendDurationAnalytics from './utils/sendDurationAnalytics';
29
- import trackEditorActions from './utils/trackEditorActions';
30
28
 
31
29
  /**
32
30
  * Editor wrapper that deals with the lifecycle logic of the editor
@@ -48,9 +46,6 @@ function Editor(passedProps) {
48
46
  const handleAnalyticsEvent = useCallback(data => {
49
47
  fireAnalyticsEvent(createAnalyticsEvent)(data);
50
48
  }, [createAnalyticsEvent]);
51
- useConstructor(() => {
52
- trackEditorActions(editorActions, props.performanceTracking, value => handleAnalyticsEvent(value));
53
- });
54
49
  const getExperienceStore = useCallback(() => {
55
50
  return experienceStore.current;
56
51
  }, []);
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "198.2.0";
2
+ export const version = "198.2.1";
@@ -12,7 +12,6 @@ import uuid from 'uuid/v4';
12
12
  import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
13
13
  import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
14
14
  import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
15
- import { useConstructor } from '@atlaskit/editor-common/hooks';
16
15
  import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
17
16
  import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
18
17
  import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils/analytics';
@@ -26,7 +25,6 @@ import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
26
25
  import useMemoEditorProps from './hooks/useMemoEditorProps';
27
26
  import useProviderFactory from './hooks/useProviderFactory';
28
27
  import sendDurationAnalytics from './utils/sendDurationAnalytics';
29
- import trackEditorActions from './utils/trackEditorActions';
30
28
 
31
29
  /**
32
30
  * Editor wrapper that deals with the lifecycle logic of the editor
@@ -49,11 +47,6 @@ function Editor(passedProps) {
49
47
  var handleAnalyticsEvent = useCallback(function (data) {
50
48
  fireAnalyticsEvent(createAnalyticsEvent)(data);
51
49
  }, [createAnalyticsEvent]);
52
- useConstructor(function () {
53
- trackEditorActions(editorActions, props.performanceTracking, function (value) {
54
- return handleAnalyticsEvent(value);
55
- });
56
- });
57
50
  var getExperienceStore = useCallback(function () {
58
51
  return experienceStore.current;
59
52
  }, []);
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "198.2.0";
2
+ export var version = "198.2.1";
@@ -3440,7 +3440,10 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
3440
3440
  }, import("@atlaskit/editor-common/types").FeatureFlags>>];
3441
3441
  sharedState: import("@atlaskit/editor-plugin-media-insert").MediaInsertPluginState;
3442
3442
  commands: {
3443
- showMediaInsertPopup: (target?: HTMLElement | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
3443
+ showMediaInsertPopup: (mountInfo?: {
3444
+ ref: HTMLElement;
3445
+ mountPoint: HTMLElement;
3446
+ } | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
3444
3447
  };
3445
3448
  }, undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
3446
3449
  pluginConfiguration: import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined;
@@ -3491,7 +3491,10 @@ export default function createUniversalPresetInternal({ appearance, props, featu
3491
3491
  }, FeatureFlags>>];
3492
3492
  sharedState: import("@atlaskit/editor-plugins/media-insert").MediaInsertPluginState;
3493
3493
  commands: {
3494
- showMediaInsertPopup: (target?: HTMLElement | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
3494
+ showMediaInsertPopup: (mountInfo?: {
3495
+ ref: HTMLElement;
3496
+ mountPoint: HTMLElement;
3497
+ } | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
3495
3498
  };
3496
3499
  }, undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
3497
3500
  pluginConfiguration: import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined;
@@ -3440,7 +3440,10 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
3440
3440
  }, import("@atlaskit/editor-common/types").FeatureFlags>>];
3441
3441
  sharedState: import("@atlaskit/editor-plugin-media-insert").MediaInsertPluginState;
3442
3442
  commands: {
3443
- showMediaInsertPopup: (target?: HTMLElement | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
3443
+ showMediaInsertPopup: (mountInfo?: {
3444
+ ref: HTMLElement;
3445
+ mountPoint: HTMLElement;
3446
+ } | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
3444
3447
  };
3445
3448
  }, undefined> | undefined, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
3446
3449
  pluginConfiguration: import("@atlaskit/editor-plugins/media/types").MediaOptions | undefined;
@@ -4219,7 +4219,10 @@ export declare function createUniversalPreset({ props, prevProps, initialPluginC
4219
4219
  ];
4220
4220
  sharedState: import("@atlaskit/editor-plugin-media-insert").MediaInsertPluginState;
4221
4221
  commands: {
4222
- showMediaInsertPopup: (target?: HTMLElement | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
4222
+ showMediaInsertPopup: (mountInfo?: {
4223
+ ref: HTMLElement;
4224
+ mountPoint: HTMLElement;
4225
+ } | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
4223
4226
  };
4224
4227
  }, undefined> | undefined,
4225
4228
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
@@ -4270,7 +4270,10 @@ export default function createUniversalPresetInternal({ appearance, props, featu
4270
4270
  ];
4271
4271
  sharedState: import("@atlaskit/editor-plugins/media-insert").MediaInsertPluginState;
4272
4272
  commands: {
4273
- showMediaInsertPopup: (target?: HTMLElement | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
4273
+ showMediaInsertPopup: (mountInfo?: {
4274
+ ref: HTMLElement;
4275
+ mountPoint: HTMLElement;
4276
+ } | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
4274
4277
  };
4275
4278
  }, undefined> | undefined,
4276
4279
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
@@ -4219,7 +4219,10 @@ export default function useUniversalPreset({ props, initialPluginConfiguration }
4219
4219
  ];
4220
4220
  sharedState: import("@atlaskit/editor-plugin-media-insert").MediaInsertPluginState;
4221
4221
  commands: {
4222
- showMediaInsertPopup: (target?: HTMLElement | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
4222
+ showMediaInsertPopup: (mountInfo?: {
4223
+ ref: HTMLElement;
4224
+ mountPoint: HTMLElement;
4225
+ } | undefined) => import("@atlaskit/editor-common/types").EditorCommand;
4223
4226
  };
4224
4227
  }, undefined> | undefined,
4225
4228
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"media", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "198.2.0",
3
+ "version": "198.2.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/editor-prosemirror": "6.0.0",
51
51
  "@atlaskit/editor-shared-styles": "^3.0.0",
52
52
  "@atlaskit/emoji": "^67.8.0",
53
- "@atlaskit/icon": "^22.19.0",
53
+ "@atlaskit/icon": "^22.20.0",
54
54
  "@atlaskit/media-card": "^78.5.0",
55
55
  "@atlaskit/mention": "^23.3.0",
56
56
  "@atlaskit/platform-feature-flags": "^0.3.0",
@@ -272,6 +272,10 @@
272
272
  },
273
273
  "platform_editor_remove_use_preset_context": {
274
274
  "type": "boolean"
275
+ },
276
+ "platform_editor_context_panel_support_multiple": {
277
+ "type": "boolean",
278
+ "referenceOnly": true
275
279
  }
276
280
  },
277
281
  "stricter": {
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = trackEditorActions;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
- /**
12
- *
13
- * Util function to be used with the Editor to track the EditorActions prop
14
- *
15
- * @param editorActions
16
- * @param performanceTracking
17
- * @param handleAnalyticsEvent
18
- * @returns
19
- */
20
- function trackEditorActions(editorActions, performanceTracking, handleAnalyticsEvent) {
21
- var _performanceTracking$;
22
- if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.contentRetrievalTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled) {
23
- var DEFAULT_SAMPLING_RATE = 100;
24
- var getValue = editorActions.getValue.bind(editorActions);
25
- if (!editorActions._contentRetrievalTracking) {
26
- editorActions._contentRetrievalTracking = {
27
- samplingCounters: {
28
- success: 1,
29
- failure: 1
30
- },
31
- getValueTracked: false
32
- };
33
- }
34
- var _editorActions$_conte = editorActions._contentRetrievalTracking,
35
- samplingCounters = _editorActions$_conte.samplingCounters,
36
- getValueTracked = _editorActions$_conte.getValueTracked;
37
- if (!getValueTracked) {
38
- var getValueWithTracking = /*#__PURE__*/function () {
39
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
40
- var _performanceTracking$2, _performanceTracking$3, value, _performanceTracking$4, _performanceTracking$5, _performanceTracking$6;
41
- return _regenerator.default.wrap(function _callee$(_context) {
42
- while (1) switch (_context.prev = _context.next) {
43
- case 0:
44
- _context.prev = 0;
45
- _context.next = 3;
46
- return getValue();
47
- case 3:
48
- value = _context.sent;
49
- if (samplingCounters.success === ((_performanceTracking$2 = performanceTracking === null || performanceTracking === void 0 || (_performanceTracking$3 = performanceTracking.contentRetrievalTracking) === null || _performanceTracking$3 === void 0 ? void 0 : _performanceTracking$3.successSamplingRate) !== null && _performanceTracking$2 !== void 0 ? _performanceTracking$2 : DEFAULT_SAMPLING_RATE)) {
50
- handleAnalyticsEvent({
51
- payload: {
52
- action: _analytics.ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
53
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
54
- attributes: {
55
- success: true
56
- },
57
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
58
- }
59
- });
60
- samplingCounters.success = 0;
61
- }
62
- samplingCounters.success++;
63
- return _context.abrupt("return", value);
64
- case 9:
65
- _context.prev = 9;
66
- _context.t0 = _context["catch"](0);
67
- if (samplingCounters.failure === ((_performanceTracking$4 = performanceTracking === null || performanceTracking === void 0 || (_performanceTracking$5 = performanceTracking.contentRetrievalTracking) === null || _performanceTracking$5 === void 0 ? void 0 : _performanceTracking$5.failureSamplingRate) !== null && _performanceTracking$4 !== void 0 ? _performanceTracking$4 : DEFAULT_SAMPLING_RATE)) {
68
- handleAnalyticsEvent({
69
- payload: {
70
- action: _analytics.ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
71
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
72
- attributes: {
73
- success: false,
74
- errorInfo: _context.t0.toString(),
75
- errorStack: performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$6 = performanceTracking.contentRetrievalTracking) !== null && _performanceTracking$6 !== void 0 && _performanceTracking$6.reportErrorStack ? _context.t0.stack : undefined
76
- },
77
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
78
- }
79
- });
80
- samplingCounters.failure = 0;
81
- }
82
- samplingCounters.failure++;
83
- throw _context.t0;
84
- case 14:
85
- case "end":
86
- return _context.stop();
87
- }
88
- }, _callee, null, [[0, 9]]);
89
- }));
90
- return function getValueWithTracking() {
91
- return _ref.apply(this, arguments);
92
- };
93
- }();
94
- editorActions.getValue = getValueWithTracking;
95
- editorActions._contentRetrievalTracking.getValueTracked = true;
96
- }
97
- }
98
- return editorActions;
99
- }
@@ -1,78 +0,0 @@
1
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
- /**
3
- *
4
- * Util function to be used with the Editor to track the EditorActions prop
5
- *
6
- * @param editorActions
7
- * @param performanceTracking
8
- * @param handleAnalyticsEvent
9
- * @returns
10
- */
11
- export default function trackEditorActions(editorActions, performanceTracking, handleAnalyticsEvent) {
12
- var _performanceTracking$;
13
- if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.contentRetrievalTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled) {
14
- const DEFAULT_SAMPLING_RATE = 100;
15
- const getValue = editorActions.getValue.bind(editorActions);
16
- if (!editorActions._contentRetrievalTracking) {
17
- editorActions._contentRetrievalTracking = {
18
- samplingCounters: {
19
- success: 1,
20
- failure: 1
21
- },
22
- getValueTracked: false
23
- };
24
- }
25
- const {
26
- _contentRetrievalTracking: {
27
- samplingCounters,
28
- getValueTracked
29
- }
30
- } = editorActions;
31
- if (!getValueTracked) {
32
- const getValueWithTracking = async () => {
33
- try {
34
- var _performanceTracking$2, _performanceTracking$3;
35
- const value = await getValue();
36
- if (samplingCounters.success === ((_performanceTracking$2 = performanceTracking === null || performanceTracking === void 0 ? void 0 : (_performanceTracking$3 = performanceTracking.contentRetrievalTracking) === null || _performanceTracking$3 === void 0 ? void 0 : _performanceTracking$3.successSamplingRate) !== null && _performanceTracking$2 !== void 0 ? _performanceTracking$2 : DEFAULT_SAMPLING_RATE)) {
37
- handleAnalyticsEvent({
38
- payload: {
39
- action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
40
- actionSubject: ACTION_SUBJECT.EDITOR,
41
- attributes: {
42
- success: true
43
- },
44
- eventType: EVENT_TYPE.OPERATIONAL
45
- }
46
- });
47
- samplingCounters.success = 0;
48
- }
49
- samplingCounters.success++;
50
- return value;
51
- } catch (err) {
52
- var _performanceTracking$4, _performanceTracking$5;
53
- if (samplingCounters.failure === ((_performanceTracking$4 = performanceTracking === null || performanceTracking === void 0 ? void 0 : (_performanceTracking$5 = performanceTracking.contentRetrievalTracking) === null || _performanceTracking$5 === void 0 ? void 0 : _performanceTracking$5.failureSamplingRate) !== null && _performanceTracking$4 !== void 0 ? _performanceTracking$4 : DEFAULT_SAMPLING_RATE)) {
54
- var _performanceTracking$6;
55
- handleAnalyticsEvent({
56
- payload: {
57
- action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
58
- actionSubject: ACTION_SUBJECT.EDITOR,
59
- attributes: {
60
- success: false,
61
- errorInfo: err.toString(),
62
- errorStack: performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$6 = performanceTracking.contentRetrievalTracking) !== null && _performanceTracking$6 !== void 0 && _performanceTracking$6.reportErrorStack ? err.stack : undefined
63
- },
64
- eventType: EVENT_TYPE.OPERATIONAL
65
- }
66
- });
67
- samplingCounters.failure = 0;
68
- }
69
- samplingCounters.failure++;
70
- throw err;
71
- }
72
- };
73
- editorActions.getValue = getValueWithTracking;
74
- editorActions._contentRetrievalTracking.getValueTracked = true;
75
- }
76
- }
77
- return editorActions;
78
- }
@@ -1,92 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
- /**
5
- *
6
- * Util function to be used with the Editor to track the EditorActions prop
7
- *
8
- * @param editorActions
9
- * @param performanceTracking
10
- * @param handleAnalyticsEvent
11
- * @returns
12
- */
13
- export default function trackEditorActions(editorActions, performanceTracking, handleAnalyticsEvent) {
14
- var _performanceTracking$;
15
- if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.contentRetrievalTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled) {
16
- var DEFAULT_SAMPLING_RATE = 100;
17
- var getValue = editorActions.getValue.bind(editorActions);
18
- if (!editorActions._contentRetrievalTracking) {
19
- editorActions._contentRetrievalTracking = {
20
- samplingCounters: {
21
- success: 1,
22
- failure: 1
23
- },
24
- getValueTracked: false
25
- };
26
- }
27
- var _editorActions$_conte = editorActions._contentRetrievalTracking,
28
- samplingCounters = _editorActions$_conte.samplingCounters,
29
- getValueTracked = _editorActions$_conte.getValueTracked;
30
- if (!getValueTracked) {
31
- var getValueWithTracking = /*#__PURE__*/function () {
32
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
33
- var _performanceTracking$2, _performanceTracking$3, value, _performanceTracking$4, _performanceTracking$5, _performanceTracking$6;
34
- return _regeneratorRuntime.wrap(function _callee$(_context) {
35
- while (1) switch (_context.prev = _context.next) {
36
- case 0:
37
- _context.prev = 0;
38
- _context.next = 3;
39
- return getValue();
40
- case 3:
41
- value = _context.sent;
42
- if (samplingCounters.success === ((_performanceTracking$2 = performanceTracking === null || performanceTracking === void 0 || (_performanceTracking$3 = performanceTracking.contentRetrievalTracking) === null || _performanceTracking$3 === void 0 ? void 0 : _performanceTracking$3.successSamplingRate) !== null && _performanceTracking$2 !== void 0 ? _performanceTracking$2 : DEFAULT_SAMPLING_RATE)) {
43
- handleAnalyticsEvent({
44
- payload: {
45
- action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
46
- actionSubject: ACTION_SUBJECT.EDITOR,
47
- attributes: {
48
- success: true
49
- },
50
- eventType: EVENT_TYPE.OPERATIONAL
51
- }
52
- });
53
- samplingCounters.success = 0;
54
- }
55
- samplingCounters.success++;
56
- return _context.abrupt("return", value);
57
- case 9:
58
- _context.prev = 9;
59
- _context.t0 = _context["catch"](0);
60
- if (samplingCounters.failure === ((_performanceTracking$4 = performanceTracking === null || performanceTracking === void 0 || (_performanceTracking$5 = performanceTracking.contentRetrievalTracking) === null || _performanceTracking$5 === void 0 ? void 0 : _performanceTracking$5.failureSamplingRate) !== null && _performanceTracking$4 !== void 0 ? _performanceTracking$4 : DEFAULT_SAMPLING_RATE)) {
61
- handleAnalyticsEvent({
62
- payload: {
63
- action: ACTION.EDITOR_CONTENT_RETRIEVAL_PERFORMED,
64
- actionSubject: ACTION_SUBJECT.EDITOR,
65
- attributes: {
66
- success: false,
67
- errorInfo: _context.t0.toString(),
68
- errorStack: performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$6 = performanceTracking.contentRetrievalTracking) !== null && _performanceTracking$6 !== void 0 && _performanceTracking$6.reportErrorStack ? _context.t0.stack : undefined
69
- },
70
- eventType: EVENT_TYPE.OPERATIONAL
71
- }
72
- });
73
- samplingCounters.failure = 0;
74
- }
75
- samplingCounters.failure++;
76
- throw _context.t0;
77
- case 14:
78
- case "end":
79
- return _context.stop();
80
- }
81
- }, _callee, null, [[0, 9]]);
82
- }));
83
- return function getValueWithTracking() {
84
- return _ref.apply(this, arguments);
85
- };
86
- }();
87
- editorActions.getValue = getValueWithTracking;
88
- editorActions._contentRetrievalTracking.getValueTracked = true;
89
- }
90
- }
91
- return editorActions;
92
- }
@@ -1,29 +0,0 @@
1
- import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
2
- import type EditorActions from '../../actions';
3
- import type { PerformanceTracking } from '../../types/performance-tracking';
4
- /**
5
- *
6
- * Util function to be used with the Editor to track the EditorActions prop
7
- *
8
- * @param editorActions
9
- * @param performanceTracking
10
- * @param handleAnalyticsEvent
11
- * @returns
12
- */
13
- export default function trackEditorActions(editorActions: EditorActions & {
14
- _contentRetrievalTracking?: {
15
- getValueTracked: boolean;
16
- samplingCounters: {
17
- success: number;
18
- failure: number;
19
- };
20
- };
21
- }, performanceTracking: PerformanceTracking | undefined, handleAnalyticsEvent: FireAnalyticsCallback): EditorActions<any> & {
22
- _contentRetrievalTracking?: {
23
- getValueTracked: boolean;
24
- samplingCounters: {
25
- success: number;
26
- failure: number;
27
- };
28
- } | undefined;
29
- };
@@ -1,29 +0,0 @@
1
- import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
2
- import type EditorActions from '../../actions';
3
- import type { PerformanceTracking } from '../../types/performance-tracking';
4
- /**
5
- *
6
- * Util function to be used with the Editor to track the EditorActions prop
7
- *
8
- * @param editorActions
9
- * @param performanceTracking
10
- * @param handleAnalyticsEvent
11
- * @returns
12
- */
13
- export default function trackEditorActions(editorActions: EditorActions & {
14
- _contentRetrievalTracking?: {
15
- getValueTracked: boolean;
16
- samplingCounters: {
17
- success: number;
18
- failure: number;
19
- };
20
- };
21
- }, performanceTracking: PerformanceTracking | undefined, handleAnalyticsEvent: FireAnalyticsCallback): EditorActions<any> & {
22
- _contentRetrievalTracking?: {
23
- getValueTracked: boolean;
24
- samplingCounters: {
25
- success: number;
26
- failure: number;
27
- };
28
- } | undefined;
29
- };