@atlaskit/editor-plugin-annotation 2.9.2 → 2.9.4

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.
@@ -86,6 +86,7 @@ var fetchState = /*#__PURE__*/function () {
86
86
  var initialState = function initialState() {
87
87
  var disallowOnWhitespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
88
88
  var featureFlagsPluginState = arguments.length > 1 ? arguments[1] : undefined;
89
+ var isAnnotationManagerEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
89
90
  return {
90
91
  annotations: {},
91
92
  selectedAnnotations: [],
@@ -100,7 +101,8 @@ var initialState = function initialState() {
100
101
  featureFlagsPluginState: featureFlagsPluginState,
101
102
  isDrafting: false,
102
103
  pendingSelectedAnnotations: [],
103
- pendingSelectedAnnotationsUpdateCount: 0
104
+ pendingSelectedAnnotationsUpdateCount: 0,
105
+ isAnnotationManagerEnabled: isAnnotationManagerEnabled
104
106
  };
105
107
  };
106
108
  var hideToolbar = function hideToolbar(state, dispatch) {
@@ -157,7 +159,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
157
159
  annotationManager = options.annotationManager;
158
160
  return new SafePlugin({
159
161
  key: inlineCommentPluginKey,
160
- state: createPluginState(options.dispatch, initialState(provider.disallowOnWhitespace, featureFlagsPluginState)),
162
+ state: createPluginState(options.dispatch, initialState(provider.disallowOnWhitespace, featureFlagsPluginState, !!annotationManager)),
161
163
  view: function view(editorView) {
162
164
  var allowAnnotationFn;
163
165
  var startDraftFn;
@@ -167,25 +169,23 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
167
169
  var setIsAnnotationSelectedFn;
168
170
  var setIsAnnotationHoveredFn;
169
171
  var clearAnnotationFn;
170
- if (annotationManager && fg('platform_editor_comments_api_manager')) {
172
+ if (annotationManager) {
171
173
  allowAnnotationFn = allowAnnotation(editorView, options);
172
174
  startDraftFn = startDraft(editorView, options);
173
175
  clearDraftFn = clearDraft(editorView, options);
174
176
  applyDraftFn = applyDraft(editorView, options);
175
177
  getDraftFn = getDraft(editorView, options);
178
+ setIsAnnotationSelectedFn = setIsAnnotationSelected(editorView, options);
179
+ setIsAnnotationHoveredFn = setIsAnnotationHovered(editorView, options);
180
+ clearAnnotationFn = clearAnnotation(editorView, options);
176
181
  annotationManager.hook('allowAnnotation', allowAnnotationFn);
177
182
  annotationManager.hook('startDraft', startDraftFn);
178
183
  annotationManager.hook('clearDraft', clearDraftFn);
179
184
  annotationManager.hook('applyDraft', applyDraftFn);
180
185
  annotationManager.hook('getDraft', getDraftFn);
181
- if (fg('platform_editor_comments_api_manager_select')) {
182
- setIsAnnotationSelectedFn = setIsAnnotationSelected(editorView, options);
183
- setIsAnnotationHoveredFn = setIsAnnotationHovered(editorView, options);
184
- clearAnnotationFn = clearAnnotation(editorView, options);
185
- annotationManager.hook('setIsAnnotationSelected', setIsAnnotationSelectedFn);
186
- annotationManager.hook('setIsAnnotationHovered', setIsAnnotationHoveredFn);
187
- annotationManager.hook('clearAnnotation', clearAnnotationFn);
188
- }
186
+ annotationManager.hook('setIsAnnotationSelected', setIsAnnotationSelectedFn);
187
+ annotationManager.hook('setIsAnnotationHovered', setIsAnnotationHoveredFn);
188
+ annotationManager.hook('clearAnnotation', clearAnnotationFn);
189
189
  }
190
190
  // Get initial state
191
191
  // Need to pass `editorView` to mitigate editor state going stale
@@ -259,18 +259,25 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
259
259
  var _ref5 = getPluginState(_prevState) || {},
260
260
  prevSelectedAnnotations = _ref5.selectedAnnotations;
261
261
  var selectedAnnotationId = selectedAnnotations && selectedAnnotations.length !== 0 && selectedAnnotations[0].id ? selectedAnnotations[0].id : undefined;
262
+
262
263
  // If the new state has an unresolved selected annotation, and it's different from
263
- // the previous one then we mark the select annotation experience as complete.
264
+ // the previous one then...
264
265
  if (
265
266
  //This checks the selected annotation is different from the previous one
266
267
  selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 || (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
267
268
  // This ensures that the selected annotation is unresolved
268
269
  annotations && annotations[selectedAnnotationId] === false) {
269
270
  var _options$selectCommen;
271
+ // ...we mark the select annotation experience as complete.
270
272
  // The selectComponentExperience is using a simplified object, which is why it's type asserted.
271
273
  (_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
274
+ if (fg('cc_comments_track_view_inline_comment_action')) {
275
+ var _options$viewInlineCo;
276
+ // ...and start a new UFO press trace since the selected comment is changing
277
+ (_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 || _options$viewInlineCo.call(options);
278
+ }
272
279
  }
273
- if (fg('platform_editor_comments_api_manager_select')) {
280
+ if (annotationManager) {
274
281
  // In the Editor, Annotations can be selected in three ways:
275
282
  // 1. By clicking on the annotation in the editor
276
283
  // 2. By using the annotation manager to select the annotation
@@ -288,7 +295,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
288
295
  // Need to set a lock to avoid calling gate multiple times. The lock will be released
289
296
  // when the preemptive gate is complete.
290
297
  isPreemptiveGateActive = true;
291
- annotationManager === null || annotationManager === void 0 || annotationManager.checkPreemptiveGate().then(function (canSelectAnnotation) {
298
+ annotationManager.checkPreemptiveGate().then(function (canSelectAnnotation) {
292
299
  var _ref8 = getPluginState(view.state) || {},
293
300
  isDrafting = _ref8.isDrafting,
294
301
  latestPendingSelectedAnnotations = _ref8.pendingSelectedAnnotations,
@@ -307,8 +314,8 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
307
314
  return pendingAnnotation.id === annotation.id;
308
315
  })) === -1;
309
316
  }).forEach(function (annotation) {
310
- var _options$annotationMa, _getAnnotationInlineN;
311
- (_options$annotationMa = options.annotationManager) === null || _options$annotationMa === void 0 || _options$annotationMa.emit({
317
+ var _getAnnotationInlineN;
318
+ annotationManager.emit({
312
319
  name: 'annotationSelectionChanged',
313
320
  data: {
314
321
  annotationId: annotation.id,
@@ -320,9 +327,9 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
320
327
 
321
328
  // Notify the annotation manager that the pending selection has changed.
322
329
  latestPendingSelectedAnnotations === null || latestPendingSelectedAnnotations === void 0 || latestPendingSelectedAnnotations.forEach(function (_ref9) {
323
- var _options$annotationMa2, _getAnnotationInlineN2;
330
+ var _getAnnotationInlineN2;
324
331
  var id = _ref9.id;
325
- (_options$annotationMa2 = options.annotationManager) === null || _options$annotationMa2 === void 0 || _options$annotationMa2.emit({
332
+ annotationManager.emit({
326
333
  name: 'annotationSelectionChanged',
327
334
  data: {
328
335
  annotationId: id,
@@ -345,8 +352,8 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
345
352
  });
346
353
  }
347
354
  }
348
- var _ref10 = getPluginState(view.state) || {},
349
- dirtyAnnotations = _ref10.dirtyAnnotations;
355
+ var _ref0 = getPluginState(view.state) || {},
356
+ dirtyAnnotations = _ref0.dirtyAnnotations;
350
357
  if (!dirtyAnnotations) {
351
358
  return;
352
359
  }
@@ -359,7 +366,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
359
366
  if (updateSubscriber) {
360
367
  updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn).off('sethoveredannotation', setHoveredAnnotationFn).off('removehoveredannotation', removeHoveredannotationFn).off('closeinlinecomment', closeInlineCommentFn);
361
368
  }
362
- if (annotationManager && fg('platform_editor_comments_api_manager')) {
369
+ if (annotationManager) {
363
370
  annotationManager.unhook('allowAnnotation', allowAnnotationFn);
364
371
  annotationManager.unhook('startDraft', startDraftFn);
365
372
  annotationManager.unhook('clearDraft', clearDraftFn);
@@ -409,13 +416,13 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
409
416
  if (isSelected && !(pluginState !== null && pluginState !== void 0 && pluginState.isInlineCommentViewClosed)) {
410
417
  return false;
411
418
  }
412
- var _ref11 = pluginState || {},
413
- annotations = _ref11.annotations;
419
+ var _ref1 = pluginState || {},
420
+ annotations = _ref1.annotations;
414
421
  var isUnresolved = annotations && annotations[annotationId] === false;
415
422
  if (!isUnresolved) {
416
423
  return false;
417
424
  }
418
- if (fg('platform_editor_comments_api_manager_select')) {
425
+ if (annotationManager) {
419
426
  var _pluginState$pendingS;
420
427
  // The manager disable setting the selected annotation on click because in the editor this is already
421
428
  // handled by the selection update handler. When the manager is enabled, and a selection changes it's pushed into
@@ -438,13 +445,13 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
438
445
  },
439
446
  decorations: function decorations(state) {
440
447
  // highlight comments, depending on state
441
- var _ref12 = getPluginState(state) || {},
442
- draftDecorationSet = _ref12.draftDecorationSet,
443
- annotations = _ref12.annotations,
444
- selectedAnnotations = _ref12.selectedAnnotations,
445
- isVisible = _ref12.isVisible,
446
- isInlineCommentViewClosed = _ref12.isInlineCommentViewClosed,
447
- hoveredAnnotations = _ref12.hoveredAnnotations;
448
+ var _ref10 = getPluginState(state) || {},
449
+ draftDecorationSet = _ref10.draftDecorationSet,
450
+ annotations = _ref10.annotations,
451
+ selectedAnnotations = _ref10.selectedAnnotations,
452
+ isVisible = _ref10.isVisible,
453
+ isInlineCommentViewClosed = _ref10.isInlineCommentViewClosed,
454
+ hoveredAnnotations = _ref10.hoveredAnnotations;
448
455
  var decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : DecorationSet.empty;
449
456
  var focusDecorations = [];
450
457
 
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { pluginFactory } from '@atlaskit/editor-common/utils';
5
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import reducer from './reducer';
9
8
  import { decorationKey, findAnnotationsInSelection, inlineCommentPluginKey, isBlockNodeAnnotationsSelected, isSelectedAnnotationsChanged } from './utils';
10
9
  var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
@@ -104,7 +103,6 @@ var getSelectionChangeHandlerNew = function getSelectionChangeHandlerNew(reopenC
104
103
 
105
104
  // NOTE: I've left this commented code here as a reference that the previous old code would reset the selected annotations
106
105
  // if the selection is empty. If this is no longer needed, we can remove this code.
107
- // clean up with platform_editor_comments_api_manager_select
108
106
  // if (selectedAnnotations.length === 0) {
109
107
  // return {
110
108
  // ...pluginState,
@@ -133,7 +131,11 @@ var getSelectionChangeHandlerNew = function getSelectionChangeHandlerNew(reopenC
133
131
  };
134
132
  var getSelectionChangedHandler = function getSelectionChangedHandler(reopenCommentView) {
135
133
  return function (tr, pluginState) {
136
- return fg('platform_editor_comments_api_manager_select') ? getSelectionChangeHandlerNew(reopenCommentView)(tr, pluginState) : getSelectionChangeHandlerOld(reopenCommentView)(tr, pluginState);
134
+ return pluginState.isAnnotationManagerEnabled ?
135
+ // if platform_editor_comments_api_manager == true
136
+ getSelectionChangeHandlerNew(reopenCommentView)(tr, pluginState) :
137
+ // else if platform_editor_comments_api_manager == false
138
+ getSelectionChangeHandlerOld(reopenCommentView)(tr, pluginState);
137
139
  };
138
140
  };
139
141
  var _pluginFactory = pluginFactory(inlineCommentPluginKey, reducer, {
@@ -31,7 +31,7 @@ export default (function (pluginState, action) {
31
31
  isOpeningMediaCommentFromToolbar: false
32
32
  }, fg('platform_editor_annotation_selected_annotation') && {
33
33
  selectedAnnotations: []
34
- }), fg('platform_editor_comments_api_manager_select') && {
34
+ }), pluginState.isAnnotationManagerEnabled && {
35
35
  selectedAnnotations: []
36
36
  });
37
37
  case ACTIONS.ADD_INLINE_COMMENT:
@@ -41,7 +41,7 @@ export default (function (pluginState, action) {
41
41
  annotations: _objectSpread(_objectSpread({}, pluginState.annotations), action.data.inlineComments),
42
42
  isInlineCommentViewClosed: false,
43
43
  selectAnnotationMethod: undefined
44
- }, fg('platform_editor_comments_api_manager_select') && {
44
+ }, pluginState.isAnnotationManagerEnabled && {
45
45
  skipSelectionHandling: true
46
46
  });
47
47
  case ACTIONS.INLINE_COMMENT_SET_VISIBLE:
@@ -126,7 +126,7 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
126
126
  pageMode: 'edit'
127
127
  }
128
128
  });
129
- if (annotationManager && fg('platform_editor_comments_api_manager')) {
129
+ if (annotationManager) {
130
130
  annotationManager.checkPreemptiveGate().then(function (canStartDraft) {
131
131
  if (canStartDraft) {
132
132
  createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
@@ -22,9 +22,4 @@ export var AnnotationTestIds = {
22
22
  floatingToolbarCreateButton: "".concat(prefix, "-toolbar-create-button"),
23
23
  componentSave: "".concat(prefix, "-dummy-save-button"),
24
24
  componentClose: "".concat(prefix, "-dummy-close-button")
25
- };
26
-
27
- /**
28
- * Alternative to SelectInlineCommentCompoundExperience, used for the annotation plugin options
29
- * in the confluence editor presets. See createFullPageEditorPreset.ts or annotationPluginOptions.ts for usage.
30
- */
25
+ };
@@ -1,4 +1,4 @@
1
1
  export { annotationPlugin } from './annotationPlugin';
2
2
  export type { AnnotationPlugin, AnnotationPluginOptions } from './annotationPluginType';
3
- export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCompoundExperience, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, SelectAbortReasons, SelectParentAbortReasons, SelectInlineCommentCompoundExperience, SelectInlineCommentCompoundExperienceEntryPoint, SimpleSelectInlineCommentCompoundExperience, StartAttributes, TargetType, } from './types';
3
+ export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, TargetType, } from './types';
4
4
  export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
@@ -25,6 +25,7 @@ export interface InlineCommentPluginOptions {
25
25
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
26
26
  featureFlagsPluginState?: FeatureFlags;
27
27
  selectCommentExperience?: AnnotationProviders['selectCommentExperience'];
28
+ viewInlineCommentTraceUFOPress?: AnnotationProviders['viewInlineCommentTraceUFOPress'];
28
29
  annotationManager?: AnnotationManager;
29
30
  api?: AnnotationPluginInjectionAPI;
30
31
  }
@@ -162,4 +163,8 @@ export type InlineCommentPluginState = {
162
163
  * if the pendingSelectedAnnotations has been updated since the last time it was flushed to selectedAnnotations.
163
164
  */
164
165
  pendingSelectedAnnotationsUpdateCount: number;
166
+ /**
167
+ * A simple toggle to indicate if the annotation manager is enabled.
168
+ */
169
+ isAnnotationManagerEnabled: boolean;
165
170
  };
@@ -1,6 +1,5 @@
1
1
  import type React from 'react';
2
2
  import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
4
3
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
4
  import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
6
5
  /**
@@ -111,8 +110,29 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
111
110
  };
112
111
  export interface AnnotationProviders {
113
112
  inlineComment: InlineCommentAnnotationProvider;
114
- createCommentExperience?: InlineCommentCompoundExperience;
115
- selectCommentExperience?: SimpleSelectInlineCommentCompoundExperience;
113
+ createCommentExperience?: {
114
+ start: (_: {
115
+ attributes: {
116
+ pageClass: 'editor';
117
+ commentType: 'inline';
118
+ annotationId?: undefined;
119
+ } | {
120
+ pageClass: 'editor';
121
+ commentType: 'block';
122
+ blockType: 'media';
123
+ annotationId?: undefined;
124
+ };
125
+ }) => void;
126
+ initExperience: {
127
+ start: () => void;
128
+ };
129
+ };
130
+ selectCommentExperience?: {
131
+ selectAnnotation: {
132
+ complete: (annotationId: string) => void;
133
+ };
134
+ };
135
+ viewInlineCommentTraceUFOPress?: () => void;
116
136
  annotationManager?: AnnotationManager;
117
137
  }
118
138
  export declare enum AnnotationSelectionType {
@@ -139,137 +159,4 @@ export type DraftBookmark = {
139
159
  head: number;
140
160
  isBlockNode?: boolean;
141
161
  };
142
- type ExperienceAttributes = {
143
- [key: string]: string | number | boolean | string[] | number[];
144
- };
145
- type InlineCommentAttributes = {
146
- pageClass: 'editor';
147
- commentType: 'inline';
148
- annotationId?: undefined;
149
- } | {
150
- pageClass: 'editor';
151
- commentType: 'block';
152
- blockType: 'media';
153
- annotationId?: undefined;
154
- } | {
155
- pageClass: 'renderer';
156
- commentType: 'inline';
157
- annotationId: string;
158
- } | {
159
- pageClass: 'renderer';
160
- commentType: 'block';
161
- blockType: 'media';
162
- annotationId: string;
163
- };
164
- export type SelectInlineCommentCompoundExperienceEntryPoint = 'create-comment' | 'annotation-change' | 'comment-navigation' | 'keyboard-navigation' | 'sidebar' | 'unknown:RendererFocus' | 'unknown:InlineComment' | 'unknown:CommentsPanelList';
165
- export type StartAttributes = {
166
- pageClass: 'editor' | 'renderer';
167
- /**
168
- * This is optional as in some scenarios the entry point does not know
169
- * what type of comment is being selected (e.g. comment navigation, sidebar).
170
- **/
171
- commentType?: 'block' | 'inline';
172
- blockType?: 'media';
173
- annotationId: string;
174
- entryPoint: Exclude<SelectInlineCommentCompoundExperienceEntryPoint, 'keyboard-navigation' | 'comment-navigation'>;
175
- } | {
176
- pageClass: 'editor' | 'renderer';
177
- /**
178
- * This is optional as in some scenarios the entry point does not know
179
- * what type of comment is being selected (e.g. comment navigation, sidebar).
180
- **/
181
- commentType?: 'block' | 'inline';
182
- blockType?: 'media';
183
- entryPoint: 'keyboard-navigation' | 'comment-navigation';
184
- };
185
- type ExperienceDebugFunction = (params: {
186
- createAnalyticsEvent: CreateUIAnalyticsEvent;
187
- error: Error;
188
- extraAttributes?: ExperienceAttributes;
189
- }) => void;
190
- export type InlineCommentCompoundExperience = {
191
- start: (params: {
192
- attributes: InlineCommentAttributes;
193
- }) => void;
194
- debug: ExperienceDebugFunction;
195
- addCommonAttributes: (commonAttributes: ExperienceAttributes) => void;
196
- attachCommonAttributes: (experienceName: string) => void;
197
- initExperience: {
198
- start: () => void;
199
- fail: (error: Error) => void;
200
- softFail: (error: Error) => void;
201
- abort: (params: {
202
- abortReason: 'Draft annotation removed from document';
203
- }) => void;
204
- complete: () => void;
205
- debug: ExperienceDebugFunction;
206
- debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
207
- };
208
- draftToPublishExperience: {
209
- start: () => void;
210
- publishFailed: (error: Error) => void;
211
- publishSucceeded: () => void;
212
- abort: (params: {
213
- abortReason: 'Create Comment UI dismissed' | 'Unable to apply annotation to document';
214
- }) => void;
215
- fail: (error: Error, attributes?: ExperienceAttributes) => void;
216
- dismissed: () => void;
217
- softFail: (error: Error) => void;
218
- complete: () => void;
219
- debug: ExperienceDebugFunction;
220
- debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
221
- };
222
- attachCommentExperience: {
223
- start: () => void;
224
- fail: (error: Error, attributes?: ExperienceAttributes) => void;
225
- complete: () => void;
226
- debug: ExperienceDebugFunction;
227
- debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
228
- };
229
- };
230
- export type SelectAbortReasons = 'test abort' | 'Comment being resolved';
231
- export type SelectParentAbortReasons = 'Parent experience aborting with reason: test abort' | 'Parent experience aborting with reason: Comment being resolved';
232
- export type SelectInlineCommentCompoundExperience = {
233
- _start: (startAttributes: StartAttributes) => void;
234
- addCommonAttributes: (additionalCommonAttributes: {
235
- [key: string]: boolean | null | number | string | undefined | Array<number | string>;
236
- }) => void;
237
- abort: (params: {
238
- abortReason: SelectAbortReasons;
239
- abortSubexperiences?: boolean;
240
- }) => void;
241
- selectAnnotation: {
242
- debug: ExperienceDebugFunction;
243
- start: (startAttributes: StartAttributes) => void;
244
- abort: (params: {
245
- abortReason: 'Comment navigation when only one comment' | 'Navigating to general comment' | SelectParentAbortReasons;
246
- }) => void;
247
- complete: (startAttributes: StartAttributes) => void;
248
- };
249
- showComment: {
250
- debug: ExperienceDebugFunction;
251
- debugPoint: (message: string, attributes?: {
252
- [key: string]: string | number | boolean;
253
- }) => void;
254
- start: (startAttributes: StartAttributes & {
255
- annotationId: string;
256
- }) => void;
257
- abort: (params: {
258
- abortReason: 'Non inline comment being shown' | 'Comment sidebar dismissed' | 'InlineComment component unmounted' | SelectParentAbortReasons;
259
- }) => void;
260
- fail: (error: Error, extraAttributes?: {
261
- misalignedBy: number;
262
- }) => void;
263
- complete: () => void;
264
- };
265
- };
266
- /**
267
- * Alternative to SelectInlineCommentCompoundExperience, used for the annotation plugin options
268
- * in the confluence editor presets. See createFullPageEditorPreset.ts or annotationPluginOptions.ts for usage.
269
- */
270
- export type SimpleSelectInlineCommentCompoundExperience = {
271
- selectAnnotation: {
272
- complete: (annotationId: string) => void;
273
- };
274
- };
275
162
  export {};
@@ -1,4 +1,4 @@
1
1
  export { annotationPlugin } from './annotationPlugin';
2
2
  export type { AnnotationPlugin, AnnotationPluginOptions } from './annotationPluginType';
3
- export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCompoundExperience, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, SelectAbortReasons, SelectParentAbortReasons, SelectInlineCommentCompoundExperience, SelectInlineCommentCompoundExperienceEntryPoint, SimpleSelectInlineCommentCompoundExperience, StartAttributes, TargetType, } from './types';
3
+ export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, TargetType, } from './types';
4
4
  export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
@@ -25,6 +25,7 @@ export interface InlineCommentPluginOptions {
25
25
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
26
26
  featureFlagsPluginState?: FeatureFlags;
27
27
  selectCommentExperience?: AnnotationProviders['selectCommentExperience'];
28
+ viewInlineCommentTraceUFOPress?: AnnotationProviders['viewInlineCommentTraceUFOPress'];
28
29
  annotationManager?: AnnotationManager;
29
30
  api?: AnnotationPluginInjectionAPI;
30
31
  }
@@ -162,4 +163,8 @@ export type InlineCommentPluginState = {
162
163
  * if the pendingSelectedAnnotations has been updated since the last time it was flushed to selectedAnnotations.
163
164
  */
164
165
  pendingSelectedAnnotationsUpdateCount: number;
166
+ /**
167
+ * A simple toggle to indicate if the annotation manager is enabled.
168
+ */
169
+ isAnnotationManagerEnabled: boolean;
165
170
  };
@@ -1,6 +1,5 @@
1
1
  import type React from 'react';
2
2
  import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
- import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
4
3
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
4
  import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
6
5
  /**
@@ -111,8 +110,29 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
111
110
  };
112
111
  export interface AnnotationProviders {
113
112
  inlineComment: InlineCommentAnnotationProvider;
114
- createCommentExperience?: InlineCommentCompoundExperience;
115
- selectCommentExperience?: SimpleSelectInlineCommentCompoundExperience;
113
+ createCommentExperience?: {
114
+ start: (_: {
115
+ attributes: {
116
+ pageClass: 'editor';
117
+ commentType: 'inline';
118
+ annotationId?: undefined;
119
+ } | {
120
+ pageClass: 'editor';
121
+ commentType: 'block';
122
+ blockType: 'media';
123
+ annotationId?: undefined;
124
+ };
125
+ }) => void;
126
+ initExperience: {
127
+ start: () => void;
128
+ };
129
+ };
130
+ selectCommentExperience?: {
131
+ selectAnnotation: {
132
+ complete: (annotationId: string) => void;
133
+ };
134
+ };
135
+ viewInlineCommentTraceUFOPress?: () => void;
116
136
  annotationManager?: AnnotationManager;
117
137
  }
118
138
  export declare enum AnnotationSelectionType {
@@ -139,137 +159,4 @@ export type DraftBookmark = {
139
159
  head: number;
140
160
  isBlockNode?: boolean;
141
161
  };
142
- type ExperienceAttributes = {
143
- [key: string]: string | number | boolean | string[] | number[];
144
- };
145
- type InlineCommentAttributes = {
146
- pageClass: 'editor';
147
- commentType: 'inline';
148
- annotationId?: undefined;
149
- } | {
150
- pageClass: 'editor';
151
- commentType: 'block';
152
- blockType: 'media';
153
- annotationId?: undefined;
154
- } | {
155
- pageClass: 'renderer';
156
- commentType: 'inline';
157
- annotationId: string;
158
- } | {
159
- pageClass: 'renderer';
160
- commentType: 'block';
161
- blockType: 'media';
162
- annotationId: string;
163
- };
164
- export type SelectInlineCommentCompoundExperienceEntryPoint = 'create-comment' | 'annotation-change' | 'comment-navigation' | 'keyboard-navigation' | 'sidebar' | 'unknown:RendererFocus' | 'unknown:InlineComment' | 'unknown:CommentsPanelList';
165
- export type StartAttributes = {
166
- pageClass: 'editor' | 'renderer';
167
- /**
168
- * This is optional as in some scenarios the entry point does not know
169
- * what type of comment is being selected (e.g. comment navigation, sidebar).
170
- **/
171
- commentType?: 'block' | 'inline';
172
- blockType?: 'media';
173
- annotationId: string;
174
- entryPoint: Exclude<SelectInlineCommentCompoundExperienceEntryPoint, 'keyboard-navigation' | 'comment-navigation'>;
175
- } | {
176
- pageClass: 'editor' | 'renderer';
177
- /**
178
- * This is optional as in some scenarios the entry point does not know
179
- * what type of comment is being selected (e.g. comment navigation, sidebar).
180
- **/
181
- commentType?: 'block' | 'inline';
182
- blockType?: 'media';
183
- entryPoint: 'keyboard-navigation' | 'comment-navigation';
184
- };
185
- type ExperienceDebugFunction = (params: {
186
- createAnalyticsEvent: CreateUIAnalyticsEvent;
187
- error: Error;
188
- extraAttributes?: ExperienceAttributes;
189
- }) => void;
190
- export type InlineCommentCompoundExperience = {
191
- start: (params: {
192
- attributes: InlineCommentAttributes;
193
- }) => void;
194
- debug: ExperienceDebugFunction;
195
- addCommonAttributes: (commonAttributes: ExperienceAttributes) => void;
196
- attachCommonAttributes: (experienceName: string) => void;
197
- initExperience: {
198
- start: () => void;
199
- fail: (error: Error) => void;
200
- softFail: (error: Error) => void;
201
- abort: (params: {
202
- abortReason: 'Draft annotation removed from document';
203
- }) => void;
204
- complete: () => void;
205
- debug: ExperienceDebugFunction;
206
- debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
207
- };
208
- draftToPublishExperience: {
209
- start: () => void;
210
- publishFailed: (error: Error) => void;
211
- publishSucceeded: () => void;
212
- abort: (params: {
213
- abortReason: 'Create Comment UI dismissed' | 'Unable to apply annotation to document';
214
- }) => void;
215
- fail: (error: Error, attributes?: ExperienceAttributes) => void;
216
- dismissed: () => void;
217
- softFail: (error: Error) => void;
218
- complete: () => void;
219
- debug: ExperienceDebugFunction;
220
- debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
221
- };
222
- attachCommentExperience: {
223
- start: () => void;
224
- fail: (error: Error, attributes?: ExperienceAttributes) => void;
225
- complete: () => void;
226
- debug: ExperienceDebugFunction;
227
- debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
228
- };
229
- };
230
- export type SelectAbortReasons = 'test abort' | 'Comment being resolved';
231
- export type SelectParentAbortReasons = 'Parent experience aborting with reason: test abort' | 'Parent experience aborting with reason: Comment being resolved';
232
- export type SelectInlineCommentCompoundExperience = {
233
- _start: (startAttributes: StartAttributes) => void;
234
- addCommonAttributes: (additionalCommonAttributes: {
235
- [key: string]: boolean | null | number | string | undefined | Array<number | string>;
236
- }) => void;
237
- abort: (params: {
238
- abortReason: SelectAbortReasons;
239
- abortSubexperiences?: boolean;
240
- }) => void;
241
- selectAnnotation: {
242
- debug: ExperienceDebugFunction;
243
- start: (startAttributes: StartAttributes) => void;
244
- abort: (params: {
245
- abortReason: 'Comment navigation when only one comment' | 'Navigating to general comment' | SelectParentAbortReasons;
246
- }) => void;
247
- complete: (startAttributes: StartAttributes) => void;
248
- };
249
- showComment: {
250
- debug: ExperienceDebugFunction;
251
- debugPoint: (message: string, attributes?: {
252
- [key: string]: string | number | boolean;
253
- }) => void;
254
- start: (startAttributes: StartAttributes & {
255
- annotationId: string;
256
- }) => void;
257
- abort: (params: {
258
- abortReason: 'Non inline comment being shown' | 'Comment sidebar dismissed' | 'InlineComment component unmounted' | SelectParentAbortReasons;
259
- }) => void;
260
- fail: (error: Error, extraAttributes?: {
261
- misalignedBy: number;
262
- }) => void;
263
- complete: () => void;
264
- };
265
- };
266
- /**
267
- * Alternative to SelectInlineCommentCompoundExperience, used for the annotation plugin options
268
- * in the confluence editor presets. See createFullPageEditorPreset.ts or annotationPluginOptions.ts for usage.
269
- */
270
- export type SimpleSelectInlineCommentCompoundExperience = {
271
- selectAnnotation: {
272
- complete: (annotationId: string) => void;
273
- };
274
- };
275
162
  export {};