@atlaskit/editor-plugin-annotation 2.7.2 → 2.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 2.7.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.7.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#146979](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146979)
14
+ [`5cea1d6e69c56`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5cea1d6e69c56) -
15
+ ED-27655: Moving annotation plugin options from confluence's full page editor preset to the
16
+ confluence-presets.
17
+ - Updated dependencies
18
+
3
19
  ## 2.7.2
4
20
 
5
21
  ### Patch Changes
@@ -244,6 +244,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
244
244
  // This ensures that the selected annotation is unresolved
245
245
  annotations && annotations[selectedAnnotationId] === false) {
246
246
  var _options$selectCommen;
247
+ // Under the confluence_comments_select_comment_experience feature flag, the selectComponentExperience is using a simplified object, which is why it's type asserted.
247
248
  (_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
248
249
  }
249
250
  }
@@ -26,4 +26,9 @@ 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
- };
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
+ */
@@ -180,6 +180,7 @@ export const inlineCommentPlugin = options => {
180
180
  // This ensures that the selected annotation is unresolved
181
181
  annotations && annotations[selectedAnnotationId] === false) {
182
182
  var _options$selectCommen;
183
+ // Under the confluence_comments_select_comment_experience feature flag, the selectComponentExperience is using a simplified object, which is why it's type asserted.
183
184
  (_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 ? void 0 : _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
184
185
  }
185
186
  }
@@ -22,4 +22,9 @@ 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
- };
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
+ */
@@ -237,6 +237,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
237
237
  // This ensures that the selected annotation is unresolved
238
238
  annotations && annotations[selectedAnnotationId] === false) {
239
239
  var _options$selectCommen;
240
+ // Under the confluence_comments_select_comment_experience feature flag, the selectComponentExperience is using a simplified object, which is why it's type asserted.
240
241
  (_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
241
242
  }
242
243
  }
@@ -22,4 +22,9 @@ 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
- };
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
+ */
@@ -1,4 +1,4 @@
1
1
  export { annotationPlugin } from './annotationPlugin';
2
2
  export type { AnnotationPlugin, AnnotationPluginOptions } from './annotationPluginType';
3
- export type { AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationState, AnnotationTypeProvider, InlineCommentState, TargetType, InlineCommentInputMethod, } from './types';
3
+ export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCompoundExperience, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, SelectInlineCommentCompoundExperience, SelectInlineCommentCompoundExperienceEntryPoint, SimpleSelectInlineCommentCompoundExperience, StartAttributes, TargetType, } from './types';
4
4
  export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
@@ -1,5 +1,6 @@
1
1
  import type React from 'react';
2
2
  import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
4
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
5
  import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
5
6
  /**
@@ -104,28 +105,8 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
104
105
  };
105
106
  export interface AnnotationProviders {
106
107
  inlineComment: InlineCommentAnnotationProvider;
107
- createCommentExperience?: {
108
- start: (_: {
109
- attributes: {
110
- pageClass: 'editor';
111
- commentType: 'inline';
112
- annotationId?: undefined;
113
- } | {
114
- pageClass: 'editor';
115
- commentType: 'block';
116
- blockType: 'media';
117
- annotationId?: undefined;
118
- };
119
- }) => void;
120
- initExperience: {
121
- start: () => void;
122
- };
123
- };
124
- selectCommentExperience?: {
125
- selectAnnotation: {
126
- complete: (annotationId: string) => void;
127
- };
128
- };
108
+ createCommentExperience?: InlineCommentCompoundExperience;
109
+ selectCommentExperience?: SimpleSelectInlineCommentCompoundExperience;
129
110
  annotationManager?: AnnotationManager;
130
111
  }
131
112
  export declare enum AnnotationSelectionType {
@@ -152,4 +133,135 @@ export type DraftBookmark = {
152
133
  head: number;
153
134
  isBlockNode?: boolean;
154
135
  };
136
+ type ExperienceAttributes = {
137
+ [key: string]: string | number | boolean | string[] | number[];
138
+ };
139
+ type InlineCommentAttributes = {
140
+ pageClass: 'editor';
141
+ commentType: 'inline';
142
+ annotationId?: undefined;
143
+ } | {
144
+ pageClass: 'editor';
145
+ commentType: 'block';
146
+ blockType: 'media';
147
+ annotationId?: undefined;
148
+ } | {
149
+ pageClass: 'renderer';
150
+ commentType: 'inline';
151
+ annotationId: string;
152
+ } | {
153
+ pageClass: 'renderer';
154
+ commentType: 'block';
155
+ blockType: 'media';
156
+ annotationId: string;
157
+ };
158
+ export type SelectInlineCommentCompoundExperienceEntryPoint = 'create-comment' | 'annotation-change' | 'comment-navigation' | 'keyboard-navigation' | 'sidebar' | 'unknown:RendererFocus' | 'unknown:InlineComment' | 'unknown:CommentsPanelList';
159
+ export type StartAttributes = {
160
+ pageClass: 'editor' | 'renderer';
161
+ /**
162
+ * This is optional as in some scenarios the entry point does not know
163
+ * what type of comment is being selected (e.g. comment navigation, sidebar).
164
+ **/
165
+ commentType?: 'block' | 'inline';
166
+ blockType?: 'media';
167
+ annotationId: string;
168
+ entryPoint: Exclude<SelectInlineCommentCompoundExperienceEntryPoint, 'keyboard-navigation' | 'comment-navigation'>;
169
+ linkedCompoundTaskId?: string;
170
+ } | {
171
+ pageClass: 'editor' | 'renderer';
172
+ /**
173
+ * This is optional as in some scenarios the entry point does not know
174
+ * what type of comment is being selected (e.g. comment navigation, sidebar).
175
+ **/
176
+ commentType?: 'block' | 'inline';
177
+ blockType?: 'media';
178
+ entryPoint: 'keyboard-navigation' | 'comment-navigation';
179
+ linkedCompoundTaskId?: string;
180
+ };
181
+ type ExperienceDebugFunction = (params: {
182
+ createAnalyticsEvent: CreateUIAnalyticsEvent;
183
+ error: Error;
184
+ extraAttributes?: ExperienceAttributes;
185
+ }) => void;
186
+ export type InlineCommentCompoundExperience = {
187
+ start: (params: {
188
+ attributes: InlineCommentAttributes;
189
+ }) => void;
190
+ debug: ExperienceDebugFunction;
191
+ addCommonAttributes: (commonAttributes: ExperienceAttributes) => void;
192
+ attachCommonAttributes: (experienceName: string) => void;
193
+ initExperience: {
194
+ start: () => void;
195
+ fail: (error: Error) => void;
196
+ softFail: (error: Error) => void;
197
+ abort: (params: {
198
+ abortReason: 'Draft annotation removed from document';
199
+ }) => void;
200
+ complete: () => void;
201
+ debug: ExperienceDebugFunction;
202
+ };
203
+ draftToPublishExperience: {
204
+ start: () => void;
205
+ publishFailed: (error: Error) => void;
206
+ publishSucceeded: () => void;
207
+ abort: (params: {
208
+ abortReason: 'Create Comment UI dismissed' | 'Unable to apply annotation to document';
209
+ }) => void;
210
+ fail: (error: Error, attributes?: ExperienceAttributes) => void;
211
+ dismissed: () => void;
212
+ softFail: (error: Error) => void;
213
+ complete: () => void;
214
+ debug: ExperienceDebugFunction;
215
+ debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
216
+ };
217
+ attachCommentExperience: {
218
+ start: () => void;
219
+ fail: (error: Error, attributes?: ExperienceAttributes) => void;
220
+ complete: () => void;
221
+ debug: ExperienceDebugFunction;
222
+ debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
223
+ };
224
+ };
225
+ export type SelectInlineCommentCompoundExperience = {
226
+ _start: (startAttributes: StartAttributes) => void;
227
+ addCommonAttributes: (additionalCommonAttributes: {
228
+ [key: string]: string | number | boolean;
229
+ }) => void;
230
+ abort: (params: {
231
+ abortReason: 'test abort';
232
+ }) => void;
233
+ selectAnnotation: {
234
+ debug: ExperienceDebugFunction;
235
+ start: (startAttributes: StartAttributes) => void;
236
+ abort: (params: {
237
+ abortReason: 'Comment navigation when only one comment';
238
+ }) => void;
239
+ complete: (startAttributes: StartAttributes) => void;
240
+ };
241
+ showComment: {
242
+ debug: ExperienceDebugFunction;
243
+ debugPoint: (message: string, attributes?: {
244
+ [key: string]: string | number | boolean;
245
+ }) => void;
246
+ start: (startAttributes: StartAttributes & {
247
+ annotationId: string;
248
+ }) => void;
249
+ abort: (params: {
250
+ abortReason: 'Non inline comment being shown' | 'Comment sidebar dismissed';
251
+ }) => void;
252
+ fail: (error: Error, extraAttributes?: {
253
+ misalignedBy: number;
254
+ }) => void;
255
+ complete: () => void;
256
+ };
257
+ };
258
+ /**
259
+ * Alternative to SelectInlineCommentCompoundExperience, used for the annotation plugin options
260
+ * in the confluence editor presets. See createFullPageEditorPreset.ts or annotationPluginOptions.ts for usage.
261
+ */
262
+ export type SimpleSelectInlineCommentCompoundExperience = {
263
+ selectAnnotation: {
264
+ complete: (annotationId: string) => void;
265
+ };
266
+ };
155
267
  export {};
@@ -1,4 +1,4 @@
1
1
  export { annotationPlugin } from './annotationPlugin';
2
2
  export type { AnnotationPlugin, AnnotationPluginOptions } from './annotationPluginType';
3
- export type { AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationState, AnnotationTypeProvider, InlineCommentState, TargetType, InlineCommentInputMethod, } from './types';
3
+ export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCompoundExperience, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, SelectInlineCommentCompoundExperience, SelectInlineCommentCompoundExperienceEntryPoint, SimpleSelectInlineCommentCompoundExperience, StartAttributes, TargetType, } from './types';
4
4
  export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
@@ -1,5 +1,6 @@
1
1
  import type React from 'react';
2
2
  import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
3
4
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
5
  import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
5
6
  /**
@@ -104,28 +105,8 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
104
105
  };
105
106
  export interface AnnotationProviders {
106
107
  inlineComment: InlineCommentAnnotationProvider;
107
- createCommentExperience?: {
108
- start: (_: {
109
- attributes: {
110
- pageClass: 'editor';
111
- commentType: 'inline';
112
- annotationId?: undefined;
113
- } | {
114
- pageClass: 'editor';
115
- commentType: 'block';
116
- blockType: 'media';
117
- annotationId?: undefined;
118
- };
119
- }) => void;
120
- initExperience: {
121
- start: () => void;
122
- };
123
- };
124
- selectCommentExperience?: {
125
- selectAnnotation: {
126
- complete: (annotationId: string) => void;
127
- };
128
- };
108
+ createCommentExperience?: InlineCommentCompoundExperience;
109
+ selectCommentExperience?: SimpleSelectInlineCommentCompoundExperience;
129
110
  annotationManager?: AnnotationManager;
130
111
  }
131
112
  export declare enum AnnotationSelectionType {
@@ -152,4 +133,135 @@ export type DraftBookmark = {
152
133
  head: number;
153
134
  isBlockNode?: boolean;
154
135
  };
136
+ type ExperienceAttributes = {
137
+ [key: string]: string | number | boolean | string[] | number[];
138
+ };
139
+ type InlineCommentAttributes = {
140
+ pageClass: 'editor';
141
+ commentType: 'inline';
142
+ annotationId?: undefined;
143
+ } | {
144
+ pageClass: 'editor';
145
+ commentType: 'block';
146
+ blockType: 'media';
147
+ annotationId?: undefined;
148
+ } | {
149
+ pageClass: 'renderer';
150
+ commentType: 'inline';
151
+ annotationId: string;
152
+ } | {
153
+ pageClass: 'renderer';
154
+ commentType: 'block';
155
+ blockType: 'media';
156
+ annotationId: string;
157
+ };
158
+ export type SelectInlineCommentCompoundExperienceEntryPoint = 'create-comment' | 'annotation-change' | 'comment-navigation' | 'keyboard-navigation' | 'sidebar' | 'unknown:RendererFocus' | 'unknown:InlineComment' | 'unknown:CommentsPanelList';
159
+ export type StartAttributes = {
160
+ pageClass: 'editor' | 'renderer';
161
+ /**
162
+ * This is optional as in some scenarios the entry point does not know
163
+ * what type of comment is being selected (e.g. comment navigation, sidebar).
164
+ **/
165
+ commentType?: 'block' | 'inline';
166
+ blockType?: 'media';
167
+ annotationId: string;
168
+ entryPoint: Exclude<SelectInlineCommentCompoundExperienceEntryPoint, 'keyboard-navigation' | 'comment-navigation'>;
169
+ linkedCompoundTaskId?: string;
170
+ } | {
171
+ pageClass: 'editor' | 'renderer';
172
+ /**
173
+ * This is optional as in some scenarios the entry point does not know
174
+ * what type of comment is being selected (e.g. comment navigation, sidebar).
175
+ **/
176
+ commentType?: 'block' | 'inline';
177
+ blockType?: 'media';
178
+ entryPoint: 'keyboard-navigation' | 'comment-navigation';
179
+ linkedCompoundTaskId?: string;
180
+ };
181
+ type ExperienceDebugFunction = (params: {
182
+ createAnalyticsEvent: CreateUIAnalyticsEvent;
183
+ error: Error;
184
+ extraAttributes?: ExperienceAttributes;
185
+ }) => void;
186
+ export type InlineCommentCompoundExperience = {
187
+ start: (params: {
188
+ attributes: InlineCommentAttributes;
189
+ }) => void;
190
+ debug: ExperienceDebugFunction;
191
+ addCommonAttributes: (commonAttributes: ExperienceAttributes) => void;
192
+ attachCommonAttributes: (experienceName: string) => void;
193
+ initExperience: {
194
+ start: () => void;
195
+ fail: (error: Error) => void;
196
+ softFail: (error: Error) => void;
197
+ abort: (params: {
198
+ abortReason: 'Draft annotation removed from document';
199
+ }) => void;
200
+ complete: () => void;
201
+ debug: ExperienceDebugFunction;
202
+ };
203
+ draftToPublishExperience: {
204
+ start: () => void;
205
+ publishFailed: (error: Error) => void;
206
+ publishSucceeded: () => void;
207
+ abort: (params: {
208
+ abortReason: 'Create Comment UI dismissed' | 'Unable to apply annotation to document';
209
+ }) => void;
210
+ fail: (error: Error, attributes?: ExperienceAttributes) => void;
211
+ dismissed: () => void;
212
+ softFail: (error: Error) => void;
213
+ complete: () => void;
214
+ debug: ExperienceDebugFunction;
215
+ debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
216
+ };
217
+ attachCommentExperience: {
218
+ start: () => void;
219
+ fail: (error: Error, attributes?: ExperienceAttributes) => void;
220
+ complete: () => void;
221
+ debug: ExperienceDebugFunction;
222
+ debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
223
+ };
224
+ };
225
+ export type SelectInlineCommentCompoundExperience = {
226
+ _start: (startAttributes: StartAttributes) => void;
227
+ addCommonAttributes: (additionalCommonAttributes: {
228
+ [key: string]: string | number | boolean;
229
+ }) => void;
230
+ abort: (params: {
231
+ abortReason: 'test abort';
232
+ }) => void;
233
+ selectAnnotation: {
234
+ debug: ExperienceDebugFunction;
235
+ start: (startAttributes: StartAttributes) => void;
236
+ abort: (params: {
237
+ abortReason: 'Comment navigation when only one comment';
238
+ }) => void;
239
+ complete: (startAttributes: StartAttributes) => void;
240
+ };
241
+ showComment: {
242
+ debug: ExperienceDebugFunction;
243
+ debugPoint: (message: string, attributes?: {
244
+ [key: string]: string | number | boolean;
245
+ }) => void;
246
+ start: (startAttributes: StartAttributes & {
247
+ annotationId: string;
248
+ }) => void;
249
+ abort: (params: {
250
+ abortReason: 'Non inline comment being shown' | 'Comment sidebar dismissed';
251
+ }) => void;
252
+ fail: (error: Error, extraAttributes?: {
253
+ misalignedBy: number;
254
+ }) => void;
255
+ complete: () => void;
256
+ };
257
+ };
258
+ /**
259
+ * Alternative to SelectInlineCommentCompoundExperience, used for the annotation plugin options
260
+ * in the confluence editor presets. See createFullPageEditorPreset.ts or annotationPluginOptions.ts for usage.
261
+ */
262
+ export type SimpleSelectInlineCommentCompoundExperience = {
263
+ selectAnnotation: {
264
+ complete: (annotationId: string) => void;
265
+ };
266
+ };
155
267
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^47.6.0",
35
- "@atlaskit/editor-common": "^103.18.0",
35
+ "@atlaskit/analytics-next": "^11.0.0",
36
+ "@atlaskit/editor-common": "^104.0.0",
36
37
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
37
38
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
38
39
  "@atlaskit/editor-plugin-editor-viewmode-effects": "^2.0.0",
@@ -41,7 +42,7 @@
41
42
  "@atlaskit/icon": "^25.6.0",
42
43
  "@atlaskit/onboarding": "^14.0.0",
43
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^4.14.0",
45
+ "@atlaskit/tmp-editor-statsig": "^4.16.0",
45
46
  "@babel/runtime": "^7.0.0"
46
47
  },
47
48
  "peerDependencies": {