@atlaskit/editor-plugin-base 0.3.4 → 0.3.6

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,18 @@
1
1
  # @atlaskit/editor-plugin-base
2
2
 
3
+ ## 0.3.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#70152](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70152) [`53ed3673df28`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/53ed3673df28) - Updating adf-schema version to 35.5.1
8
+
9
+ ## 0.3.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#68640](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68640) [`6a3ea210641a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6a3ea210641a) - Create new context identifier plugin which contains the provider.
14
+ - Updated dependencies
15
+
3
16
  ## 0.3.4
4
17
 
5
18
  ### Patch Changes
@@ -12,7 +12,6 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
12
12
  var _commands = require("@atlaskit/editor-prosemirror/commands");
13
13
  var _history = require("@atlaskit/editor-prosemirror/history");
14
14
  var _commands2 = require("./commands");
15
- var _contextIdentifier = _interopRequireWildcard(require("./pm-plugins/context-identifier"));
16
15
  var _disableSpellChecking = _interopRequireDefault(require("./pm-plugins/disable-spell-checking"));
17
16
  var _filterSteps = _interopRequireDefault(require("./pm-plugins/filter-steps"));
18
17
  var _frozenEditor = _interopRequireDefault(require("./pm-plugins/frozen-editor"));
@@ -32,7 +31,6 @@ var basePlugin = function basePlugin(_ref) {
32
31
  name: 'base',
33
32
  getSharedState: function getSharedState(editorState) {
34
33
  return {
35
- contextIdentifier: (0, _contextIdentifier.getContextIdentifier)(editorState),
36
34
  keyboardHeight: (0, _scrollGutter.getKeyboardHeight)(editorState)
37
35
  };
38
36
  },
@@ -73,7 +71,7 @@ var basePlugin = function basePlugin(_ref) {
73
71
  plugin: function plugin(_ref3) {
74
72
  var _options$inputTrackin;
75
73
  var dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
76
- return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? (0, _frozenEditor.default)(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
74
+ return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? (0, _frozenEditor.default)(api === null || api === void 0 ? void 0 : api.contextIdentifier)(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
77
75
  }
78
76
  }, {
79
77
  name: 'history',
@@ -94,13 +92,6 @@ var basePlugin = function basePlugin(_ref) {
94
92
  }
95
93
  }));
96
94
  }
97
- }, {
98
- name: 'contextIdentifier',
99
- plugin: function plugin(_ref4) {
100
- var dispatch = _ref4.dispatch,
101
- providerFactory = _ref4.providerFactory;
102
- return (0, _contextIdentifier.default)(dispatch, providerFactory);
103
- }
104
95
  });
105
96
  if (options && options.allowScrollGutter) {
106
97
  plugins.push({
@@ -13,7 +13,6 @@ var _utils = require("@atlaskit/editor-common/utils");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _frozenEditor = require("../utils/frozen-editor");
15
15
  var _inputLatencyTracking = _interopRequireDefault(require("../utils/input-latency-tracking"));
16
- var _contextIdentifier = require("./context-identifier");
17
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
18
  var frozenEditorPluginKey = exports.frozenEditorPluginKey = new _state.PluginKey('frozenEditor');
@@ -25,234 +24,238 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
25
24
  var DEFAULT_TRACK_SEVERITY_ENABLED = false;
26
25
  var DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = exports.DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
27
26
  var DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = exports.DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
28
- var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEvent, view, time, getNodeCount, interactionType, severity) {
29
- var _getContextIdentifier;
30
- var state = view.state;
31
- var nodesCount = getNodeCount(state);
32
- return dispatchAnalyticsEvent({
33
- action: _analytics.ACTION.BROWSER_FREEZE,
34
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
35
- attributes: _objectSpread(_objectSpread({
36
- objectId: (_getContextIdentifier = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier === void 0 ? void 0 : _getContextIdentifier.objectId,
37
- freezeTime: time,
38
- nodeSize: state.doc.nodeSize
39
- }, nodesCount), {}, {
40
- interactionType: interactionType,
41
- severity: severity
42
- }),
43
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
44
- });
27
+ var dispatchLongTaskEvent = function dispatchLongTaskEvent(contextIdentifierPlugin) {
28
+ return function (dispatchAnalyticsEvent, view, time, getNodeCount, interactionType, severity) {
29
+ var _contextIdentifierPlu;
30
+ var state = view.state;
31
+ var nodesCount = getNodeCount(state);
32
+ return dispatchAnalyticsEvent({
33
+ action: _analytics.ACTION.BROWSER_FREEZE,
34
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
35
+ attributes: _objectSpread(_objectSpread({
36
+ objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu === void 0 || (_contextIdentifierPlu = _contextIdentifierPlu.contextIdentifierProvider) === null || _contextIdentifierPlu === void 0 ? void 0 : _contextIdentifierPlu.objectId,
37
+ freezeTime: time,
38
+ nodeSize: state.doc.nodeSize
39
+ }, nodesCount), {}, {
40
+ interactionType: interactionType,
41
+ severity: severity
42
+ }),
43
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
44
+ });
45
+ };
45
46
  };
46
- var _default = exports.default = function _default(dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) {
47
- var interactionType;
48
- var inputLatencyTracker = null;
49
- var inputLatencySingleKeyTracker = null;
50
- var inputLatencyRenderedTracker = null;
51
- if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
52
- interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.LOADING);
53
- }
54
- var samplingRate = inputTracking && typeof inputTracking.samplingRate === 'number' ? inputTracking.samplingRate : DEFAULT_KEYSTROKE_SAMPLING_LIMIT;
55
- var slowThreshold = inputTracking && typeof inputTracking.slowThreshold === 'number' ? inputTracking.slowThreshold : DEFAULT_SLOW_THRESHOLD;
56
- var freezeThreshold = inputTracking && typeof inputTracking.freezeThreshold === 'number' ? inputTracking.freezeThreshold : DEFAULT_FREEZE_THRESHOLD;
57
- var allowCountNodes = inputTracking && inputTracking.countNodes;
58
- var prevNodeCountState = null;
59
- var prevNodeCount = {};
47
+ var _default = exports.default = function _default(contextIdentifierPlugin) {
48
+ return function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) {
49
+ var interactionType;
50
+ var inputLatencyTracker = null;
51
+ var inputLatencySingleKeyTracker = null;
52
+ var inputLatencyRenderedTracker = null;
53
+ if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
54
+ interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.LOADING);
55
+ }
56
+ var samplingRate = inputTracking && typeof inputTracking.samplingRate === 'number' ? inputTracking.samplingRate : DEFAULT_KEYSTROKE_SAMPLING_LIMIT;
57
+ var slowThreshold = inputTracking && typeof inputTracking.slowThreshold === 'number' ? inputTracking.slowThreshold : DEFAULT_SLOW_THRESHOLD;
58
+ var freezeThreshold = inputTracking && typeof inputTracking.freezeThreshold === 'number' ? inputTracking.freezeThreshold : DEFAULT_FREEZE_THRESHOLD;
59
+ var allowCountNodes = inputTracking && inputTracking.countNodes;
60
+ var prevNodeCountState = null;
61
+ var prevNodeCount = {};
60
62
 
61
- // Cache the result as we were calling this multiple times
62
- // and has potential to be expensive
63
- var getNodeCount = function getNodeCount(state) {
64
- if (state === prevNodeCountState) {
63
+ // Cache the result as we were calling this multiple times
64
+ // and has potential to be expensive
65
+ var getNodeCount = function getNodeCount(state) {
66
+ if (state === prevNodeCountState) {
67
+ return prevNodeCount;
68
+ }
69
+ prevNodeCount = allowCountNodes ? (0, _utils.countNodes)(state) : {};
70
+ prevNodeCountState = state;
65
71
  return prevNodeCount;
66
- }
67
- prevNodeCount = allowCountNodes ? (0, _utils.countNodes)(state) : {};
68
- prevNodeCountState = state;
69
- return prevNodeCount;
70
- };
71
- var shouldTrackSeverity = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.trackSeverity) || DEFAULT_TRACK_SEVERITY_ENABLED;
72
- var severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
73
- var severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
74
- var createDispatchSample = function createDispatchSample(action, view) {
75
- return function (time, severity) {
76
- var _getContextIdentifier2;
77
- var state = view.state;
78
- var nodesCount = getNodeCount(state);
79
- var samplePayload = {
80
- action: action,
81
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
82
- attributes: _objectSpread(_objectSpread({
83
- time: time,
84
- nodeSize: state.doc.nodeSize
85
- }, nodesCount), {}, {
86
- objectId: (_getContextIdentifier2 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId,
87
- severity: shouldTrackSeverity ? severity : undefined
88
- }),
89
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
72
+ };
73
+ var shouldTrackSeverity = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.trackSeverity) || DEFAULT_TRACK_SEVERITY_ENABLED;
74
+ var severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
75
+ var severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
76
+ var createDispatchSample = function createDispatchSample(action, view) {
77
+ return function (time, severity) {
78
+ var _contextIdentifierPlu2;
79
+ var state = view.state;
80
+ var nodesCount = getNodeCount(state);
81
+ var samplePayload = {
82
+ action: action,
83
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
84
+ attributes: _objectSpread(_objectSpread({
85
+ time: time,
86
+ nodeSize: state.doc.nodeSize
87
+ }, nodesCount), {}, {
88
+ objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu2 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu2 === void 0 || (_contextIdentifierPlu2 = _contextIdentifierPlu2.contextIdentifierProvider) === null || _contextIdentifierPlu2 === void 0 ? void 0 : _contextIdentifierPlu2.objectId,
89
+ severity: shouldTrackSeverity ? severity : undefined
90
+ }),
91
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
92
+ };
93
+ dispatchAnalyticsEvent(samplePayload);
90
94
  };
91
- dispatchAnalyticsEvent(samplePayload);
92
95
  };
93
- };
94
- var createDispatchAverage = function createDispatchAverage(action, view) {
95
- return function (_ref, severity) {
96
- var _getContextIdentifier3;
97
- var mean = _ref.mean,
98
- median = _ref.median,
99
- sampleSize = _ref.sampleSize;
100
- var state = view.state;
101
- var nodeCount = getNodeCount(state);
102
- var averagePayload = {
103
- action: action,
104
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
105
- attributes: _objectSpread(_objectSpread({
106
- mean: mean,
107
- median: median,
108
- sampleSize: sampleSize
109
- }, nodeCount), {}, {
110
- nodeSize: state.doc.nodeSize,
111
- severity: shouldTrackSeverity ? severity : undefined,
112
- objectId: (_getContextIdentifier3 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId
113
- }),
114
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
96
+ var createDispatchAverage = function createDispatchAverage(action, view) {
97
+ return function (_ref, severity) {
98
+ var _contextIdentifierPlu3;
99
+ var mean = _ref.mean,
100
+ median = _ref.median,
101
+ sampleSize = _ref.sampleSize;
102
+ var state = view.state;
103
+ var nodeCount = getNodeCount(state);
104
+ var averagePayload = {
105
+ action: action,
106
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
107
+ attributes: _objectSpread(_objectSpread({
108
+ mean: mean,
109
+ median: median,
110
+ sampleSize: sampleSize
111
+ }, nodeCount), {}, {
112
+ nodeSize: state.doc.nodeSize,
113
+ severity: shouldTrackSeverity ? severity : undefined,
114
+ objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu3 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu3 === void 0 || (_contextIdentifierPlu3 = _contextIdentifierPlu3.contextIdentifierProvider) === null || _contextIdentifierPlu3 === void 0 ? void 0 : _contextIdentifierPlu3.objectId
115
+ }),
116
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
117
+ };
118
+ dispatchAnalyticsEvent(averagePayload);
115
119
  };
116
- dispatchAnalyticsEvent(averagePayload);
117
120
  };
118
- };
119
- return new _safePlugin.SafePlugin({
120
- key: frozenEditorPluginKey,
121
- props: (0, _utils.isPerformanceAPIAvailable)() ? {
122
- handleTextInput: function handleTextInput(view) {
123
- if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
124
- interactionType = _analytics.BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
125
- }
126
- if (inputLatencyTracker) {
127
- var end = inputLatencyTracker.start();
121
+ return new _safePlugin.SafePlugin({
122
+ key: frozenEditorPluginKey,
123
+ props: (0, _utils.isPerformanceAPIAvailable)() ? {
124
+ handleTextInput: function handleTextInput(view) {
125
+ if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
126
+ interactionType = _analytics.BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
127
+ }
128
+ if (inputLatencyTracker) {
129
+ var end = inputLatencyTracker.start();
128
130
 
129
- // This is called after all handleTextInput events are executed which means first handleTextInput time incorporates following handleTextInput processing time
130
- // Also this is called before browser rendering so it doesn't count it.
131
- requestAnimationFrame(end);
132
- }
133
- if (inputLatencySingleKeyTracker) {
134
- var _end = inputLatencySingleKeyTracker.start();
131
+ // This is called after all handleTextInput events are executed which means first handleTextInput time incorporates following handleTextInput processing time
132
+ // Also this is called before browser rendering so it doesn't count it.
133
+ requestAnimationFrame(end);
134
+ }
135
+ if (inputLatencySingleKeyTracker) {
136
+ var _end = inputLatencySingleKeyTracker.start();
135
137
 
136
- // This is executed before next handleTextInput when multiple keypress events are in one animation frame
137
- // so it tracks individual keypress processing time
138
- Promise.resolve().then(_end);
139
- }
140
- if (inputLatencyRenderedTracker) {
141
- var _end2 = inputLatencyRenderedTracker.start();
138
+ // This is executed before next handleTextInput when multiple keypress events are in one animation frame
139
+ // so it tracks individual keypress processing time
140
+ Promise.resolve().then(_end);
141
+ }
142
+ if (inputLatencyRenderedTracker) {
143
+ var _end2 = inputLatencyRenderedTracker.start();
142
144
 
143
- // This is called at the next event loop so it counts browser rendering time.
144
- setTimeout(_end2);
145
- }
146
- return false;
147
- },
148
- handleDOMEvents: browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? {
149
- click: function click() {
150
- interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.CLICKING);
145
+ // This is called at the next event loop so it counts browser rendering time.
146
+ setTimeout(_end2);
147
+ }
151
148
  return false;
152
149
  },
153
- paste: function paste() {
154
- interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.PASTING);
155
- return false;
156
- }
157
- } : undefined
158
- } : undefined,
159
- view: function view(_view) {
160
- if (!(0, _utils.isPerformanceObserverAvailable)()) {
161
- return {};
162
- }
163
- var experienceStore = ufo ? _ufo.ExperienceStore.getInstance(_view) : undefined;
164
- if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
165
- inputLatencyTracker = new _inputLatencyTracking.default({
166
- samplingRate: samplingRate,
167
- slowThreshold: slowThreshold,
168
- normalThreshold: severityThresholdNormal,
169
- degradedThreshold: severityThresholdDegraded,
170
- onSampleStart: function onSampleStart() {
171
- experienceStore === null || experienceStore === void 0 || experienceStore.start(_ufo.EditorExperience.typing);
172
- },
173
- onSampleEnd: function onSampleEnd(time, _ref2) {
174
- var _getContextIdentifier4;
175
- var isSlow = _ref2.isSlow,
176
- severity = _ref2.severity;
177
- var state = _view.state;
178
- var nodesCount = getNodeCount(state);
179
- if (isSlow) {
180
- experienceStore === null || experienceStore === void 0 || experienceStore.addMetadata(_ufo.EditorExperience.typing, {
181
- slowInput: true
182
- });
183
- }
184
- experienceStore === null || experienceStore === void 0 || experienceStore.success(_ufo.EditorExperience.typing, _objectSpread(_objectSpread({
185
- nodeSize: state.doc.nodeSize
186
- }, nodesCount), {}, {
187
- objectId: (_getContextIdentifier4 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
188
- time: time,
189
- severity: shouldTrackSeverity ? severity : undefined
190
- }));
150
+ handleDOMEvents: browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? {
151
+ click: function click() {
152
+ interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.CLICKING);
153
+ return false;
191
154
  },
192
- dispatchSample: createDispatchSample(_analytics.ACTION.INPUT_PERF_SAMPLING, _view),
193
- dispatchAverage: createDispatchAverage(_analytics.ACTION.INPUT_PERF_SAMPLING_AVG, _view),
194
- onSlowInput: function onSlowInput(time) {
195
- var _getContextIdentifier5;
196
- var state = _view.state;
197
- var nodesCount = getNodeCount(state);
198
- dispatchAnalyticsEvent({
199
- action: _analytics.ACTION.SLOW_INPUT,
200
- actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
201
- attributes: _objectSpread(_objectSpread({
202
- time: time,
155
+ paste: function paste() {
156
+ interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.PASTING);
157
+ return false;
158
+ }
159
+ } : undefined
160
+ } : undefined,
161
+ view: function view(_view) {
162
+ if (!(0, _utils.isPerformanceObserverAvailable)()) {
163
+ return {};
164
+ }
165
+ var experienceStore = ufo ? _ufo.ExperienceStore.getInstance(_view) : undefined;
166
+ if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
167
+ inputLatencyTracker = new _inputLatencyTracking.default({
168
+ samplingRate: samplingRate,
169
+ slowThreshold: slowThreshold,
170
+ normalThreshold: severityThresholdNormal,
171
+ degradedThreshold: severityThresholdDegraded,
172
+ onSampleStart: function onSampleStart() {
173
+ experienceStore === null || experienceStore === void 0 || experienceStore.start(_ufo.EditorExperience.typing);
174
+ },
175
+ onSampleEnd: function onSampleEnd(time, _ref2) {
176
+ var _contextIdentifierPlu4;
177
+ var isSlow = _ref2.isSlow,
178
+ severity = _ref2.severity;
179
+ var state = _view.state;
180
+ var nodesCount = getNodeCount(state);
181
+ if (isSlow) {
182
+ experienceStore === null || experienceStore === void 0 || experienceStore.addMetadata(_ufo.EditorExperience.typing, {
183
+ slowInput: true
184
+ });
185
+ }
186
+ experienceStore === null || experienceStore === void 0 || experienceStore.success(_ufo.EditorExperience.typing, _objectSpread(_objectSpread({
203
187
  nodeSize: state.doc.nodeSize
204
188
  }, nodesCount), {}, {
205
- objectId: (_getContextIdentifier5 = (0, _contextIdentifier.getContextIdentifier)(state)) === null || _getContextIdentifier5 === void 0 ? void 0 : _getContextIdentifier5.objectId
206
- }),
207
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
208
- });
209
- }
210
- });
211
- }
212
- if (inputTracking !== null && inputTracking !== void 0 && inputTracking.trackSingleKeypress) {
213
- inputLatencySingleKeyTracker = new _inputLatencyTracking.default({
214
- samplingRate: samplingRate,
215
- slowThreshold: slowThreshold,
216
- normalThreshold: severityThresholdNormal,
217
- degradedThreshold: severityThresholdDegraded,
218
- dispatchSample: createDispatchSample(_analytics.ACTION.INPUT_PERF_SAMPLING_SINGLE_KEYPRESS, _view),
219
- dispatchAverage: createDispatchAverage(_analytics.ACTION.INPUT_PERF_SAMPLING_SINGLE_KEYPRESS_AVG, _view)
220
- });
221
- }
222
- if (inputTracking !== null && inputTracking !== void 0 && inputTracking.trackRenderingTime) {
223
- inputLatencyRenderedTracker = new _inputLatencyTracking.default({
224
- samplingRate: samplingRate,
225
- slowThreshold: slowThreshold,
226
- normalThreshold: severityThresholdNormal,
227
- degradedThreshold: severityThresholdDegraded,
228
- dispatchSample: createDispatchSample(_analytics.ACTION.INPUT_PERF_SAMPLING_RENDERED, _view),
229
- dispatchAverage: createDispatchAverage(_analytics.ACTION.INPUT_PERF_SAMPLING_RENDERED_AVG, _view)
230
- });
231
- }
232
- var observer;
233
- try {
234
- observer = new PerformanceObserver(function (list) {
235
- var perfEntries = list.getEntries();
236
- for (var i = 0; i < perfEntries.length; i++) {
237
- var duration = perfEntries[i].duration;
238
- if (duration > freezeThreshold) {
239
- dispatchLongTaskEvent(dispatchAnalyticsEvent, _view, duration, getNodeCount, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? interactionType : undefined, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackSeverity ? (0, _utils.getAnalyticsEventSeverity)(duration, browserFreezeTracking.severityNormalThreshold || NORMAL_SEVERITY_THRESHOLD, browserFreezeTracking.severityDegradedThreshold || DEGRADED_SEVERITY_THRESHOLD) : undefined);
189
+ objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu4 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu4 === void 0 || (_contextIdentifierPlu4 = _contextIdentifierPlu4.contextIdentifierProvider) === null || _contextIdentifierPlu4 === void 0 ? void 0 : _contextIdentifierPlu4.objectId,
190
+ time: time,
191
+ severity: shouldTrackSeverity ? severity : undefined
192
+ }));
193
+ },
194
+ dispatchSample: createDispatchSample(_analytics.ACTION.INPUT_PERF_SAMPLING, _view),
195
+ dispatchAverage: createDispatchAverage(_analytics.ACTION.INPUT_PERF_SAMPLING_AVG, _view),
196
+ onSlowInput: function onSlowInput(time) {
197
+ var _contextIdentifierPlu5;
198
+ var state = _view.state;
199
+ var nodesCount = getNodeCount(state);
200
+ dispatchAnalyticsEvent({
201
+ action: _analytics.ACTION.SLOW_INPUT,
202
+ actionSubject: _analytics.ACTION_SUBJECT.EDITOR,
203
+ attributes: _objectSpread(_objectSpread({
204
+ time: time,
205
+ nodeSize: state.doc.nodeSize
206
+ }, nodesCount), {}, {
207
+ objectId: contextIdentifierPlugin === null || contextIdentifierPlugin === void 0 || (_contextIdentifierPlu5 = contextIdentifierPlugin.sharedState.currentState()) === null || _contextIdentifierPlu5 === void 0 || (_contextIdentifierPlu5 = _contextIdentifierPlu5.contextIdentifierProvider) === null || _contextIdentifierPlu5 === void 0 ? void 0 : _contextIdentifierPlu5.objectId
208
+ }),
209
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
210
+ });
240
211
  }
241
- }
242
- });
243
-
244
- // register observer for long task notifications
245
- observer.observe({
246
- entryTypes: ['longtask']
247
- });
248
- } catch (e) {}
249
- return {
250
- destroy: function destroy() {
251
- var _inputLatencyTracker, _observer;
252
- (_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 || _inputLatencyTracker.flush();
253
- (_observer = observer) === null || _observer === void 0 || _observer.disconnect();
212
+ });
254
213
  }
255
- };
256
- }
257
- });
214
+ if (inputTracking !== null && inputTracking !== void 0 && inputTracking.trackSingleKeypress) {
215
+ inputLatencySingleKeyTracker = new _inputLatencyTracking.default({
216
+ samplingRate: samplingRate,
217
+ slowThreshold: slowThreshold,
218
+ normalThreshold: severityThresholdNormal,
219
+ degradedThreshold: severityThresholdDegraded,
220
+ dispatchSample: createDispatchSample(_analytics.ACTION.INPUT_PERF_SAMPLING_SINGLE_KEYPRESS, _view),
221
+ dispatchAverage: createDispatchAverage(_analytics.ACTION.INPUT_PERF_SAMPLING_SINGLE_KEYPRESS_AVG, _view)
222
+ });
223
+ }
224
+ if (inputTracking !== null && inputTracking !== void 0 && inputTracking.trackRenderingTime) {
225
+ inputLatencyRenderedTracker = new _inputLatencyTracking.default({
226
+ samplingRate: samplingRate,
227
+ slowThreshold: slowThreshold,
228
+ normalThreshold: severityThresholdNormal,
229
+ degradedThreshold: severityThresholdDegraded,
230
+ dispatchSample: createDispatchSample(_analytics.ACTION.INPUT_PERF_SAMPLING_RENDERED, _view),
231
+ dispatchAverage: createDispatchAverage(_analytics.ACTION.INPUT_PERF_SAMPLING_RENDERED_AVG, _view)
232
+ });
233
+ }
234
+ var observer;
235
+ try {
236
+ observer = new PerformanceObserver(function (list) {
237
+ var perfEntries = list.getEntries();
238
+ for (var i = 0; i < perfEntries.length; i++) {
239
+ var duration = perfEntries[i].duration;
240
+ if (duration > freezeThreshold) {
241
+ dispatchLongTaskEvent(contextIdentifierPlugin)(dispatchAnalyticsEvent, _view, duration, getNodeCount, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? interactionType : undefined, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackSeverity ? (0, _utils.getAnalyticsEventSeverity)(duration, browserFreezeTracking.severityNormalThreshold || NORMAL_SEVERITY_THRESHOLD, browserFreezeTracking.severityDegradedThreshold || DEGRADED_SEVERITY_THRESHOLD) : undefined);
242
+ }
243
+ }
244
+ });
245
+
246
+ // register observer for long task notifications
247
+ observer.observe({
248
+ entryTypes: ['longtask']
249
+ });
250
+ } catch (e) {}
251
+ return {
252
+ destroy: function destroy() {
253
+ var _inputLatencyTracker, _observer;
254
+ (_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 || _inputLatencyTracker.flush();
255
+ (_observer = observer) === null || _observer === void 0 || _observer.disconnect();
256
+ }
257
+ };
258
+ }
259
+ });
260
+ };
258
261
  };
@@ -3,7 +3,6 @@ import { keymap } from '@atlaskit/editor-common/keymaps';
3
3
  import { baseKeymap } from '@atlaskit/editor-prosemirror/commands';
4
4
  import { history } from '@atlaskit/editor-prosemirror/history';
5
5
  import { setKeyboardHeight } from './commands';
6
- import contextIdentifierPlugin, { getContextIdentifier } from './pm-plugins/context-identifier';
7
6
  import disableSpellcheckingPlugin from './pm-plugins/disable-spell-checking';
8
7
  import filterStepsPlugin from './pm-plugins/filter-steps';
9
8
  import frozenEditor from './pm-plugins/frozen-editor';
@@ -20,7 +19,6 @@ const basePlugin = ({
20
19
  name: 'base',
21
20
  getSharedState(editorState) {
22
21
  return {
23
- contextIdentifier: getContextIdentifier(editorState),
24
22
  keyboardHeight: getKeyboardHeight(editorState)
25
23
  };
26
24
  },
@@ -59,7 +57,7 @@ const basePlugin = ({
59
57
  dispatchAnalyticsEvent
60
58
  }) => {
61
59
  var _options$inputTrackin;
62
- return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? frozenEditor(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
60
+ return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? frozenEditor(api === null || api === void 0 ? void 0 : api.contextIdentifier)(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
63
61
  }
64
62
  }, {
65
63
  name: 'history',
@@ -73,12 +71,6 @@ const basePlugin = ({
73
71
  'Mod-[': () => true,
74
72
  'Mod-]': () => true
75
73
  })
76
- }, {
77
- name: 'contextIdentifier',
78
- plugin: ({
79
- dispatch,
80
- providerFactory
81
- }) => contextIdentifierPlugin(dispatch, providerFactory)
82
74
  });
83
75
  if (options && options.allowScrollGutter) {
84
76
  plugins.push({