@atlaskit/editor-plugin-annotation 2.9.3 → 2.9.5

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,25 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 2.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#165439](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165439)
8
+ [`1b15e228a1e86`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1b15e228a1e86) -
9
+ Fixed an issue which meant the new annotation manager still realied on a FG to be enabled when in
10
+ fact it should be enabled if an instance of the manager is supplied. Thie removed all dependencies
11
+ relying on the FG.
12
+
13
+ ## 2.9.4
14
+
15
+ ### Patch Changes
16
+
17
+ - [#144021](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/144021)
18
+ [`8357b7ad2daa6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8357b7ad2daa6) -
19
+ Added config option for starting viewInlineCommentTraceUFOPress for inline-comments
20
+ annotationPlugin
21
+ - Updated dependencies
22
+
3
23
  ## 2.9.3
4
24
 
5
25
  ### Patch Changes
@@ -61,6 +61,7 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
61
61
  editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
62
62
  featureFlagsPluginState: featureFlags,
63
63
  selectCommentExperience: annotationProviders.selectCommentExperience,
64
+ viewInlineCommentTraceUFOPress: annotationProviders.viewInlineCommentTraceUFOPress,
64
65
  annotationManager: annotationProviders.annotationManager,
65
66
  api: api
66
67
  });
@@ -266,16 +266,23 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
266
266
  var _ref5 = (0, _utils2.getPluginState)(_prevState) || {},
267
267
  prevSelectedAnnotations = _ref5.selectedAnnotations;
268
268
  var selectedAnnotationId = selectedAnnotations && selectedAnnotations.length !== 0 && selectedAnnotations[0].id ? selectedAnnotations[0].id : undefined;
269
+
269
270
  // If the new state has an unresolved selected annotation, and it's different from
270
- // the previous one then we mark the select annotation experience as complete.
271
+ // the previous one then...
271
272
  if (
272
273
  //This checks the selected annotation is different from the previous one
273
274
  selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 || (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
274
275
  // This ensures that the selected annotation is unresolved
275
276
  annotations && annotations[selectedAnnotationId] === false) {
276
277
  var _options$selectCommen;
278
+ // ...we mark the select annotation experience as complete.
277
279
  // The selectComponentExperience is using a simplified object, which is why it's type asserted.
278
280
  (_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
281
+ if ((0, _platformFeatureFlags.fg)('cc_comments_track_view_inline_comment_action')) {
282
+ var _options$viewInlineCo;
283
+ // ...and start a new UFO press trace since the selected comment is changing
284
+ (_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 || _options$viewInlineCo.call(options);
285
+ }
279
286
  }
280
287
  if (annotationManager) {
281
288
  // In the Editor, Annotations can be selected in three ways:
@@ -26,9 +26,4 @@ var AnnotationTestIds = exports.AnnotationTestIds = {
26
26
  floatingToolbarCreateButton: "".concat(prefix, "-toolbar-create-button"),
27
27
  componentSave: "".concat(prefix, "-dummy-save-button"),
28
28
  componentClose: "".concat(prefix, "-dummy-close-button")
29
- };
30
-
31
- /**
32
- * Alternative to SelectInlineCommentCompoundExperience, used for the annotation plugin options
33
- * in the confluence editor presets. See createFullPageEditorPreset.ts or annotationPluginOptions.ts for usage.
34
- */
29
+ };
@@ -51,13 +51,15 @@ var useInlineCommentViewPluginState = (0, _hooks.sharedPluginStateHookMigratorFa
51
51
  var isOpeningMediaCommentFromToolbar = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'annotation.isOpeningMediaCommentFromToolbar');
52
52
  // eslint-disable-next-line react-hooks/rules-of-hooks
53
53
  var selectAnnotationMethod = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'annotation.selectAnnotationMethod');
54
+ var isAnnotationManagerEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'annotation.isAnnotationManagerEnabled');
54
55
  return {
55
56
  bookmark: bookmark,
56
57
  selectedAnnotations: selectedAnnotations,
57
58
  annotations: annotations,
58
59
  isInlineCommentViewClosed: isInlineCommentViewClosed,
59
60
  isOpeningMediaCommentFromToolbar: isOpeningMediaCommentFromToolbar,
60
- selectAnnotationMethod: selectAnnotationMethod
61
+ selectAnnotationMethod: selectAnnotationMethod,
62
+ isAnnotationManagerEnabled: isAnnotationManagerEnabled
61
63
  };
62
64
  }, function (_ref2) {
63
65
  var state = _ref2.state;
@@ -68,7 +70,8 @@ var useInlineCommentViewPluginState = (0, _hooks.sharedPluginStateHookMigratorFa
68
70
  annotations: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.annotations,
69
71
  isInlineCommentViewClosed: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isInlineCommentViewClosed,
70
72
  isOpeningMediaCommentFromToolbar: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isOpeningMediaCommentFromToolbar,
71
- selectAnnotationMethod: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.selectAnnotationMethod
73
+ selectAnnotationMethod: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.selectAnnotationMethod,
74
+ isAnnotationManagerEnabled: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isAnnotationManagerEnabled
72
75
  };
73
76
  });
74
77
  function InlineCommentView(_ref3) {
@@ -93,7 +96,8 @@ function InlineCommentView(_ref3) {
93
96
  isInlineCommentViewClosed = _useInlineCommentView.isInlineCommentViewClosed,
94
97
  isOpeningMediaCommentFromToolbar = _useInlineCommentView.isOpeningMediaCommentFromToolbar,
95
98
  selectAnnotationMethod = _useInlineCommentView.selectAnnotationMethod,
96
- selectedAnnotations = _useInlineCommentView.selectedAnnotations;
99
+ selectedAnnotations = _useInlineCommentView.selectedAnnotations,
100
+ isAnnotationManagerEnabled = _useInlineCommentView.isAnnotationManagerEnabled;
97
101
  var annotationsList = (0, _utils3.getAllAnnotations)(editorView.state.doc);
98
102
  var selection = (0, _utils3.getSelectionPositions)(state, {
99
103
  bookmark: bookmark
@@ -160,7 +164,7 @@ function InlineCommentView(_ref3) {
160
164
  textSelection: textSelection,
161
165
  wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged,
162
166
  onCreate: function onCreate(id) {
163
- if (!(0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
167
+ if (!isAnnotationManagerEnabled) {
164
168
  var createAnnotationResult = (0, _editorCommands.createAnnotation)(editorAnalyticsAPI, editorAPI)(id, _adfSchema.AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch);
165
169
  !editorView.hasFocus() && editorView.focus();
166
170
  if (!createAnnotationResult && (0, _platformFeatureFlags.fg)('confluence_frontend_handle_annotation_error')) {
@@ -169,7 +173,7 @@ function InlineCommentView(_ref3) {
169
173
  }
170
174
  },
171
175
  onClose: function onClose() {
172
- if (!(0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
176
+ if (!isAnnotationManagerEnabled) {
173
177
  (0, _editorCommands.setInlineCommentDraftState)(editorAnalyticsAPI)(false)(editorView.state, editorView.dispatch);
174
178
  !editorView.hasFocus() && editorView.focus();
175
179
  }
@@ -52,6 +52,7 @@ export const annotationPlugin = ({
52
52
  editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
53
53
  featureFlagsPluginState: featureFlags,
54
54
  selectCommentExperience: annotationProviders.selectCommentExperience,
55
+ viewInlineCommentTraceUFOPress: annotationProviders.viewInlineCommentTraceUFOPress,
55
56
  annotationManager: annotationProviders.annotationManager,
56
57
  api
57
58
  });
@@ -201,16 +201,23 @@ export const inlineCommentPlugin = options => {
201
201
  selectedAnnotations: prevSelectedAnnotations
202
202
  } = getPluginState(_prevState) || {};
203
203
  const selectedAnnotationId = selectedAnnotations && selectedAnnotations.length !== 0 && selectedAnnotations[0].id ? selectedAnnotations[0].id : undefined;
204
+
204
205
  // If the new state has an unresolved selected annotation, and it's different from
205
- // the previous one then we mark the select annotation experience as complete.
206
+ // the previous one then...
206
207
  if (
207
208
  //This checks the selected annotation is different from the previous one
208
209
  selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 ? void 0 : (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
209
210
  // This ensures that the selected annotation is unresolved
210
211
  annotations && annotations[selectedAnnotationId] === false) {
211
212
  var _options$selectCommen;
213
+ // ...we mark the select annotation experience as complete.
212
214
  // The selectComponentExperience is using a simplified object, which is why it's type asserted.
213
215
  (_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 ? void 0 : _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
216
+ if (fg('cc_comments_track_view_inline_comment_action')) {
217
+ var _options$viewInlineCo;
218
+ // ...and start a new UFO press trace since the selected comment is changing
219
+ (_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 ? void 0 : _options$viewInlineCo.call(options);
220
+ }
214
221
  }
215
222
  if (annotationManager) {
216
223
  // In the Editor, Annotations can be selected in three ways:
@@ -22,9 +22,4 @@ export const AnnotationTestIds = {
22
22
  floatingToolbarCreateButton: `${prefix}-toolbar-create-button`,
23
23
  componentSave: `${prefix}-dummy-save-button`,
24
24
  componentClose: `${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
+ };
@@ -42,13 +42,15 @@ const useInlineCommentViewPluginState = sharedPluginStateHookMigratorFactory(({
42
42
  const isOpeningMediaCommentFromToolbar = useSharedPluginStateSelector(api, 'annotation.isOpeningMediaCommentFromToolbar');
43
43
  // eslint-disable-next-line react-hooks/rules-of-hooks
44
44
  const selectAnnotationMethod = useSharedPluginStateSelector(api, 'annotation.selectAnnotationMethod');
45
+ const isAnnotationManagerEnabled = useSharedPluginStateSelector(api, 'annotation.isAnnotationManagerEnabled');
45
46
  return {
46
47
  bookmark,
47
48
  selectedAnnotations,
48
49
  annotations,
49
50
  isInlineCommentViewClosed,
50
51
  isOpeningMediaCommentFromToolbar,
51
- selectAnnotationMethod
52
+ selectAnnotationMethod,
53
+ isAnnotationManagerEnabled
52
54
  };
53
55
  }, ({
54
56
  state
@@ -60,7 +62,8 @@ const useInlineCommentViewPluginState = sharedPluginStateHookMigratorFactory(({
60
62
  annotations: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.annotations,
61
63
  isInlineCommentViewClosed: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isInlineCommentViewClosed,
62
64
  isOpeningMediaCommentFromToolbar: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isOpeningMediaCommentFromToolbar,
63
- selectAnnotationMethod: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.selectAnnotationMethod
65
+ selectAnnotationMethod: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.selectAnnotationMethod,
66
+ isAnnotationManagerEnabled: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isAnnotationManagerEnabled
64
67
  };
65
68
  });
66
69
  export function InlineCommentView({
@@ -89,7 +92,8 @@ export function InlineCommentView({
89
92
  isInlineCommentViewClosed,
90
93
  isOpeningMediaCommentFromToolbar,
91
94
  selectAnnotationMethod,
92
- selectedAnnotations
95
+ selectedAnnotations,
96
+ isAnnotationManagerEnabled
93
97
  } = useInlineCommentViewPluginState({
94
98
  api: editorAPI,
95
99
  state
@@ -160,7 +164,7 @@ export function InlineCommentView({
160
164
  textSelection: textSelection,
161
165
  wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged,
162
166
  onCreate: id => {
163
- if (!fg('platform_editor_comments_api_manager')) {
167
+ if (!isAnnotationManagerEnabled) {
164
168
  const createAnnotationResult = createAnnotation(editorAnalyticsAPI, editorAPI)(id, AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch);
165
169
  !editorView.hasFocus() && editorView.focus();
166
170
  if (!createAnnotationResult && fg('confluence_frontend_handle_annotation_error')) {
@@ -169,7 +173,7 @@ export function InlineCommentView({
169
173
  }
170
174
  },
171
175
  onClose: () => {
172
- if (!fg('platform_editor_comments_api_manager')) {
176
+ if (!isAnnotationManagerEnabled) {
173
177
  setInlineCommentDraftState(editorAnalyticsAPI)(false)(editorView.state, editorView.dispatch);
174
178
  !editorView.hasFocus() && editorView.focus();
175
179
  }
@@ -54,6 +54,7 @@ export var annotationPlugin = function annotationPlugin(_ref) {
54
54
  editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions,
55
55
  featureFlagsPluginState: featureFlags,
56
56
  selectCommentExperience: annotationProviders.selectCommentExperience,
57
+ viewInlineCommentTraceUFOPress: annotationProviders.viewInlineCommentTraceUFOPress,
57
58
  annotationManager: annotationProviders.annotationManager,
58
59
  api: api
59
60
  });
@@ -259,16 +259,23 @@ 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
280
  if (annotationManager) {
274
281
  // In the Editor, Annotations can be selected in three ways:
@@ -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
+ };
@@ -42,13 +42,15 @@ var useInlineCommentViewPluginState = sharedPluginStateHookMigratorFactory(funct
42
42
  var isOpeningMediaCommentFromToolbar = useSharedPluginStateSelector(api, 'annotation.isOpeningMediaCommentFromToolbar');
43
43
  // eslint-disable-next-line react-hooks/rules-of-hooks
44
44
  var selectAnnotationMethod = useSharedPluginStateSelector(api, 'annotation.selectAnnotationMethod');
45
+ var isAnnotationManagerEnabled = useSharedPluginStateSelector(api, 'annotation.isAnnotationManagerEnabled');
45
46
  return {
46
47
  bookmark: bookmark,
47
48
  selectedAnnotations: selectedAnnotations,
48
49
  annotations: annotations,
49
50
  isInlineCommentViewClosed: isInlineCommentViewClosed,
50
51
  isOpeningMediaCommentFromToolbar: isOpeningMediaCommentFromToolbar,
51
- selectAnnotationMethod: selectAnnotationMethod
52
+ selectAnnotationMethod: selectAnnotationMethod,
53
+ isAnnotationManagerEnabled: isAnnotationManagerEnabled
52
54
  };
53
55
  }, function (_ref2) {
54
56
  var state = _ref2.state;
@@ -59,7 +61,8 @@ var useInlineCommentViewPluginState = sharedPluginStateHookMigratorFactory(funct
59
61
  annotations: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.annotations,
60
62
  isInlineCommentViewClosed: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isInlineCommentViewClosed,
61
63
  isOpeningMediaCommentFromToolbar: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isOpeningMediaCommentFromToolbar,
62
- selectAnnotationMethod: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.selectAnnotationMethod
64
+ selectAnnotationMethod: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.selectAnnotationMethod,
65
+ isAnnotationManagerEnabled: inlineCommentState === null || inlineCommentState === void 0 ? void 0 : inlineCommentState.isAnnotationManagerEnabled
63
66
  };
64
67
  });
65
68
  export function InlineCommentView(_ref3) {
@@ -84,7 +87,8 @@ export function InlineCommentView(_ref3) {
84
87
  isInlineCommentViewClosed = _useInlineCommentView.isInlineCommentViewClosed,
85
88
  isOpeningMediaCommentFromToolbar = _useInlineCommentView.isOpeningMediaCommentFromToolbar,
86
89
  selectAnnotationMethod = _useInlineCommentView.selectAnnotationMethod,
87
- selectedAnnotations = _useInlineCommentView.selectedAnnotations;
90
+ selectedAnnotations = _useInlineCommentView.selectedAnnotations,
91
+ isAnnotationManagerEnabled = _useInlineCommentView.isAnnotationManagerEnabled;
88
92
  var annotationsList = getAllAnnotations(editorView.state.doc);
89
93
  var selection = getSelectionPositions(state, {
90
94
  bookmark: bookmark
@@ -151,7 +155,7 @@ export function InlineCommentView(_ref3) {
151
155
  textSelection: textSelection,
152
156
  wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged,
153
157
  onCreate: function onCreate(id) {
154
- if (!fg('platform_editor_comments_api_manager')) {
158
+ if (!isAnnotationManagerEnabled) {
155
159
  var createAnnotationResult = createAnnotation(editorAnalyticsAPI, editorAPI)(id, AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch);
156
160
  !editorView.hasFocus() && editorView.focus();
157
161
  if (!createAnnotationResult && fg('confluence_frontend_handle_annotation_error')) {
@@ -160,7 +164,7 @@ export function InlineCommentView(_ref3) {
160
164
  }
161
165
  },
162
166
  onClose: function onClose() {
163
- if (!fg('platform_editor_comments_api_manager')) {
167
+ if (!isAnnotationManagerEnabled) {
164
168
  setInlineCommentDraftState(editorAnalyticsAPI)(false)(editorView.state, editorView.dispatch);
165
169
  !editorView.hasFocus() && editorView.focus();
166
170
  }
@@ -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
  }
@@ -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
  }
@@ -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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "2.9.3",
3
+ "version": "2.9.5",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^47.6.0",
35
- "@atlaskit/analytics-next": "^11.0.0",
35
+ "@atlaskit/analytics-next": "^11.1.0",
36
36
  "@atlaskit/editor-common": "^106.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
38
38
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/icon": "^26.4.0",
43
43
  "@atlaskit/onboarding": "^14.2.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
- "@atlaskit/tmp-editor-statsig": "^5.7.0",
45
+ "@atlaskit/tmp-editor-statsig": "^5.10.0",
46
46
  "@babel/runtime": "^7.0.0"
47
47
  },
48
48
  "peerDependencies": {
@@ -95,7 +95,8 @@
95
95
  },
96
96
  "platform-feature-flags": {
97
97
  "platform_editor_comments_api_manager": {
98
- "type": "boolean"
98
+ "type": "boolean",
99
+ "referenceOnly": true
99
100
  },
100
101
  "editor_inline_comments_on_inline_nodes": {
101
102
  "type": "boolean"
@@ -115,6 +116,9 @@
115
116
  "platform_editor_listen_for_focussed_query_param": {
116
117
  "type": "boolean"
117
118
  },
119
+ "cc_comments_track_view_inline_comment_action": {
120
+ "type": "boolean"
121
+ },
118
122
  "confluence_frontend_handle_annotation_error": {
119
123
  "type": "boolean"
120
124
  },