@atlaskit/renderer 109.28.1 → 109.28.2

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,15 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 109.28.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#100662](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100662)
8
+ [`3d61cd8f2afe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3d61cd8f2afe) -
9
+ [ED-23355] Update annotation viewed event to with attributes nodeType and method to capture
10
+ usage for comments on media
11
+ - Updated dependencies
12
+
3
13
  ## 109.28.1
4
14
 
5
15
  ### Patch Changes
@@ -176,7 +176,10 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
176
176
  if (updateSubscriber) {
177
177
  updateSubscriber.emit(_types.AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
178
178
  annotationIds: activeParentIds,
179
- eventTarget: e.target
179
+ eventTarget: e.target,
180
+ // use mediaSingle here to align with annotation viewed event dispatched in editor
181
+ eventTargetType: 'mediaSingle',
182
+ viewMethod: _analytics.VIEW_METHOD.BADGE
180
183
  });
181
184
  }
182
185
  };
@@ -32,12 +32,14 @@ var MentionItem = exports.default = /*#__PURE__*/function (_PureComponent) {
32
32
  id = _this$props.id,
33
33
  providers = _this$props.providers,
34
34
  text = _this$props.text,
35
- accessLevel = _this$props.accessLevel;
35
+ accessLevel = _this$props.accessLevel,
36
+ localId = _this$props.localId;
36
37
  return /*#__PURE__*/_react.default.createElement(_mention.Mention, {
37
38
  id: id,
38
39
  text: text,
39
40
  accessLevel: accessLevel,
40
41
  providers: providers,
42
+ localId: localId,
41
43
  eventHandlers: eventHandlers && eventHandlers.mention
42
44
  });
43
45
  }
@@ -56,7 +56,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
56
56
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
57
57
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
58
58
  var packageName = "@atlaskit/renderer";
59
- var packageVersion = "109.28.1";
59
+ var packageVersion = "109.28.2";
60
60
  var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
61
61
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
62
62
  (0, _inherits2.default)(Renderer, _PureComponent);
@@ -78,14 +78,17 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
78
78
  annotationClickEvent = _useState6[0],
79
79
  setAnnotationClickEvent = _useState6[1];
80
80
  var updateSubscriber = props.updateSubscriber,
81
- createAnalyticsEvent = props.createAnalyticsEvent;
81
+ createAnalyticsEvent = props.createAnalyticsEvent,
82
+ isCommentsOnMediaAnalyticsEnabled = props.isCommentsOnMediaAnalyticsEnabled;
82
83
  (0, _react.useLayoutEffect)(function () {
83
84
  if (!updateSubscriber) {
84
85
  return;
85
86
  }
86
87
  var clickCb = function clickCb(_ref3) {
87
88
  var annotationIds = _ref3.annotationIds,
88
- eventTarget = _ref3.eventTarget;
89
+ eventTarget = _ref3.eventTarget,
90
+ eventTargetType = _ref3.eventTargetType,
91
+ viewMethod = _ref3.viewMethod;
89
92
  var annotationsByType = annotationIds.filter(function (id) {
90
93
  return !!id;
91
94
  }).map(function (id) {
@@ -100,9 +103,12 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
100
103
  actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
101
104
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
102
105
  eventType: _analytics.EVENT_TYPE.TRACK,
103
- attributes: {
106
+ attributes: _objectSpread({
104
107
  overlap: annotationsByType.length || 0
105
- }
108
+ }, isCommentsOnMediaAnalyticsEnabled && {
109
+ targetNodeType: eventTargetType,
110
+ method: viewMethod
111
+ })
106
112
  }).fire(_analyticsListeners.FabricChannel.editor);
107
113
  }
108
114
  setAnnotationClickEvent({
@@ -122,6 +128,6 @@ var useAnnotationClickEvent = exports.useAnnotationClickEvent = function useAnno
122
128
  updateSubscriber.off(_types.AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
123
129
  updateSubscriber.off(_types.AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
124
130
  };
125
- }, [updateSubscriber, createAnalyticsEvent]);
131
+ }, [updateSubscriber, createAnalyticsEvent, isCommentsOnMediaAnalyticsEnabled]);
126
132
  return annotationClickEvent;
127
133
  };
@@ -16,9 +16,11 @@ var AnnotationView = exports.AnnotationView = function AnnotationView(props) {
16
16
  var actionContext = (0, _react.useContext)(_RendererActionsContext.RendererContext);
17
17
  var inlineCommentProvider = providers && providers.inlineComment;
18
18
  var updateSubscriber = inlineCommentProvider && inlineCommentProvider.updateSubscriber || null;
19
+ var isCommentsOnMediaAnalyticsEnabled = inlineCommentProvider === null || inlineCommentProvider === void 0 ? void 0 : inlineCommentProvider.isCommentsOnMediaAnalyticsEnabled;
19
20
  var viewComponentProps = (0, _hooks.useAnnotationClickEvent)({
20
21
  updateSubscriber: updateSubscriber,
21
- createAnalyticsEvent: props.createAnalyticsEvent
22
+ createAnalyticsEvent: props.createAnalyticsEvent,
23
+ isCommentsOnMediaAnalyticsEnabled: isCommentsOnMediaAnalyticsEnabled
22
24
  });
23
25
  var ViewComponent = inlineCommentProvider && inlineCommentProvider.viewComponent;
24
26
  var deleteAnnotation = (0, _react.useMemo)(function () {
@@ -12,7 +12,7 @@ import { MediaCard } from '../../../ui/MediaCard';
12
12
  import { AnnotationMarkStates } from '@atlaskit/adf-schema';
13
13
  import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
14
14
  import { getEventHandler } from '../../../utils';
15
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
15
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
16
16
  import { MODE, PLATFORM } from '../../../analytics/events';
17
17
  import AnnotationComponent from '../../marks/annotation';
18
18
  import { AnnotationsDraftContext, ProvidersContext } from '../../../ui/annotations/context';
@@ -161,7 +161,10 @@ const CommentBadgeWrapper = ({
161
161
  if (updateSubscriber) {
162
162
  updateSubscriber.emit(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
163
163
  annotationIds: activeParentIds,
164
- eventTarget: e.target
164
+ eventTarget: e.target,
165
+ // use mediaSingle here to align with annotation viewed event dispatched in editor
166
+ eventTargetType: 'mediaSingle',
167
+ viewMethod: VIEW_METHOD.BADGE
165
168
  });
166
169
  }
167
170
  };
@@ -8,13 +8,15 @@ export default class MentionItem extends PureComponent {
8
8
  id,
9
9
  providers,
10
10
  text,
11
- accessLevel
11
+ accessLevel,
12
+ localId
12
13
  } = this.props;
13
14
  return /*#__PURE__*/React.createElement(Mention, {
14
15
  id: id,
15
16
  text: text,
16
17
  accessLevel: accessLevel,
17
18
  providers: providers,
19
+ localId: localId,
18
20
  eventHandlers: eventHandlers && eventHandlers.mention
19
21
  });
20
22
  }
@@ -37,7 +37,7 @@ import { nodeToReact } from '../../react/nodes';
37
37
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
38
38
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
39
39
  const packageName = "@atlaskit/renderer";
40
- const packageVersion = "109.28.1";
40
+ const packageVersion = "109.28.2";
41
41
  export const defaultNodeComponents = nodeToReact;
42
42
  export class Renderer extends PureComponent {
43
43
  constructor(props) {
@@ -67,7 +67,8 @@ export const useAnnotationClickEvent = props => {
67
67
  const [annotationClickEvent, setAnnotationClickEvent] = useState(null);
68
68
  const {
69
69
  updateSubscriber,
70
- createAnalyticsEvent
70
+ createAnalyticsEvent,
71
+ isCommentsOnMediaAnalyticsEnabled
71
72
  } = props;
72
73
  useLayoutEffect(() => {
73
74
  if (!updateSubscriber) {
@@ -75,7 +76,9 @@ export const useAnnotationClickEvent = props => {
75
76
  }
76
77
  const clickCb = ({
77
78
  annotationIds,
78
- eventTarget
79
+ eventTarget,
80
+ eventTargetType,
81
+ viewMethod
79
82
  }) => {
80
83
  const annotationsByType = annotationIds.filter(id => !!id).map(id => ({
81
84
  id,
@@ -88,7 +91,11 @@ export const useAnnotationClickEvent = props => {
88
91
  actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
89
92
  eventType: EVENT_TYPE.TRACK,
90
93
  attributes: {
91
- overlap: annotationsByType.length || 0
94
+ overlap: annotationsByType.length || 0,
95
+ ...(isCommentsOnMediaAnalyticsEnabled && {
96
+ targetNodeType: eventTargetType,
97
+ method: viewMethod
98
+ })
92
99
  }
93
100
  }).fire(FabricChannel.editor);
94
101
  }
@@ -109,6 +116,6 @@ export const useAnnotationClickEvent = props => {
109
116
  updateSubscriber.off(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
110
117
  updateSubscriber.off(AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
111
118
  };
112
- }, [updateSubscriber, createAnalyticsEvent]);
119
+ }, [updateSubscriber, createAnalyticsEvent, isCommentsOnMediaAnalyticsEnabled]);
113
120
  return annotationClickEvent;
114
121
  };
@@ -7,9 +7,11 @@ const AnnotationView = props => {
7
7
  const actionContext = useContext(RendererContext);
8
8
  const inlineCommentProvider = providers && providers.inlineComment;
9
9
  const updateSubscriber = inlineCommentProvider && inlineCommentProvider.updateSubscriber || null;
10
+ const isCommentsOnMediaAnalyticsEnabled = inlineCommentProvider === null || inlineCommentProvider === void 0 ? void 0 : inlineCommentProvider.isCommentsOnMediaAnalyticsEnabled;
10
11
  const viewComponentProps = useAnnotationClickEvent({
11
12
  updateSubscriber,
12
- createAnalyticsEvent: props.createAnalyticsEvent
13
+ createAnalyticsEvent: props.createAnalyticsEvent,
14
+ isCommentsOnMediaAnalyticsEnabled
13
15
  });
14
16
  const ViewComponent = inlineCommentProvider && inlineCommentProvider.viewComponent;
15
17
  const deleteAnnotation = useMemo(() => annotationInfo => actionContext.deleteAnnotation(annotationInfo.id, annotationInfo.type), [actionContext]);
@@ -27,7 +27,7 @@ import { MediaCard } from '../../../ui/MediaCard';
27
27
  import { AnnotationMarkStates } from '@atlaskit/adf-schema';
28
28
  import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
29
29
  import { getEventHandler } from '../../../utils';
30
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
30
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
31
31
  import { MODE, PLATFORM } from '../../../analytics/events';
32
32
  import AnnotationComponent from '../../marks/annotation';
33
33
  import { AnnotationsDraftContext, ProvidersContext } from '../../../ui/annotations/context';
@@ -167,7 +167,10 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref5) {
167
167
  if (updateSubscriber) {
168
168
  updateSubscriber.emit(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, {
169
169
  annotationIds: activeParentIds,
170
- eventTarget: e.target
170
+ eventTarget: e.target,
171
+ // use mediaSingle here to align with annotation viewed event dispatched in editor
172
+ eventTargetType: 'mediaSingle',
173
+ viewMethod: VIEW_METHOD.BADGE
171
174
  });
172
175
  }
173
176
  };
@@ -23,12 +23,14 @@ var MentionItem = /*#__PURE__*/function (_PureComponent) {
23
23
  id = _this$props.id,
24
24
  providers = _this$props.providers,
25
25
  text = _this$props.text,
26
- accessLevel = _this$props.accessLevel;
26
+ accessLevel = _this$props.accessLevel,
27
+ localId = _this$props.localId;
27
28
  return /*#__PURE__*/React.createElement(Mention, {
28
29
  id: id,
29
30
  text: text,
30
31
  accessLevel: accessLevel,
31
32
  providers: providers,
33
+ localId: localId,
32
34
  eventHandlers: eventHandlers && eventHandlers.mention
33
35
  });
34
36
  }
@@ -47,7 +47,7 @@ import { nodeToReact } from '../../react/nodes';
47
47
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
48
48
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
49
49
  var packageName = "@atlaskit/renderer";
50
- var packageVersion = "109.28.1";
50
+ var packageVersion = "109.28.2";
51
51
  export var defaultNodeComponents = nodeToReact;
52
52
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
53
53
  _inherits(Renderer, _PureComponent);
@@ -71,14 +71,17 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
71
71
  annotationClickEvent = _useState6[0],
72
72
  setAnnotationClickEvent = _useState6[1];
73
73
  var updateSubscriber = props.updateSubscriber,
74
- createAnalyticsEvent = props.createAnalyticsEvent;
74
+ createAnalyticsEvent = props.createAnalyticsEvent,
75
+ isCommentsOnMediaAnalyticsEnabled = props.isCommentsOnMediaAnalyticsEnabled;
75
76
  useLayoutEffect(function () {
76
77
  if (!updateSubscriber) {
77
78
  return;
78
79
  }
79
80
  var clickCb = function clickCb(_ref3) {
80
81
  var annotationIds = _ref3.annotationIds,
81
- eventTarget = _ref3.eventTarget;
82
+ eventTarget = _ref3.eventTarget,
83
+ eventTargetType = _ref3.eventTargetType,
84
+ viewMethod = _ref3.viewMethod;
82
85
  var annotationsByType = annotationIds.filter(function (id) {
83
86
  return !!id;
84
87
  }).map(function (id) {
@@ -93,9 +96,12 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
93
96
  actionSubject: ACTION_SUBJECT.ANNOTATION,
94
97
  actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
95
98
  eventType: EVENT_TYPE.TRACK,
96
- attributes: {
99
+ attributes: _objectSpread({
97
100
  overlap: annotationsByType.length || 0
98
- }
101
+ }, isCommentsOnMediaAnalyticsEnabled && {
102
+ targetNodeType: eventTargetType,
103
+ method: viewMethod
104
+ })
99
105
  }).fire(FabricChannel.editor);
100
106
  }
101
107
  setAnnotationClickEvent({
@@ -115,6 +121,6 @@ export var useAnnotationClickEvent = function useAnnotationClickEvent(props) {
115
121
  updateSubscriber.off(AnnotationUpdateEvent.ON_ANNOTATION_CLICK, clickCb);
116
122
  updateSubscriber.off(AnnotationUpdateEvent.DESELECT_ANNOTATIONS, deselectCb);
117
123
  };
118
- }, [updateSubscriber, createAnalyticsEvent]);
124
+ }, [updateSubscriber, createAnalyticsEvent, isCommentsOnMediaAnalyticsEnabled]);
119
125
  return annotationClickEvent;
120
126
  };
@@ -7,9 +7,11 @@ var AnnotationView = function AnnotationView(props) {
7
7
  var actionContext = useContext(RendererContext);
8
8
  var inlineCommentProvider = providers && providers.inlineComment;
9
9
  var updateSubscriber = inlineCommentProvider && inlineCommentProvider.updateSubscriber || null;
10
+ var isCommentsOnMediaAnalyticsEnabled = inlineCommentProvider === null || inlineCommentProvider === void 0 ? void 0 : inlineCommentProvider.isCommentsOnMediaAnalyticsEnabled;
10
11
  var viewComponentProps = useAnnotationClickEvent({
11
12
  updateSubscriber: updateSubscriber,
12
- createAnalyticsEvent: props.createAnalyticsEvent
13
+ createAnalyticsEvent: props.createAnalyticsEvent,
14
+ isCommentsOnMediaAnalyticsEnabled: isCommentsOnMediaAnalyticsEnabled
13
15
  });
14
16
  var ViewComponent = inlineCommentProvider && inlineCommentProvider.viewComponent;
15
17
  var deleteAnnotation = useMemo(function () {
@@ -1,5 +1,5 @@
1
1
  import { PureComponent } from 'react';
2
- import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { EventHandlers } from '@atlaskit/editor-common/ui';
4
4
  export interface Props {
5
5
  id: string;
@@ -7,6 +7,7 @@ export interface Props {
7
7
  eventHandlers?: EventHandlers;
8
8
  text: string;
9
9
  accessLevel?: string;
10
+ localId?: string;
10
11
  }
11
12
  export default class MentionItem extends PureComponent<Props, {}> {
12
13
  render(): JSX.Element;
@@ -14,5 +14,7 @@ type UseAnnotationUpdateSatteByEventProps = {
14
14
  export declare const useAnnotationStateByTypeEvent: ({ type, updateSubscriber, }: UseAnnotationUpdateSatteByEventProps) => Record<string, AnnotationMarkStates | null>;
15
15
  export declare const useHasFocusEvent: ({ id, updateSubscriber, }: ListenEventProps) => boolean;
16
16
  type AnnotationsWithClickTarget = Pick<InlineCommentViewComponentProps, 'annotations' | 'clickElementTarget'> | null;
17
- export declare const useAnnotationClickEvent: (props: Pick<ListenEventProps, 'updateSubscriber' | 'createAnalyticsEvent'>) => AnnotationsWithClickTarget;
17
+ export declare const useAnnotationClickEvent: (props: Pick<ListenEventProps, "createAnalyticsEvent" | "updateSubscriber"> & {
18
+ isCommentsOnMediaAnalyticsEnabled?: boolean | undefined;
19
+ }) => AnnotationsWithClickTarget;
18
20
  export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
+ import { type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  type Props = {
4
4
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { PureComponent } from 'react';
2
- import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { EventHandlers } from '@atlaskit/editor-common/ui';
4
4
  export interface Props {
5
5
  id: string;
@@ -7,6 +7,7 @@ export interface Props {
7
7
  eventHandlers?: EventHandlers;
8
8
  text: string;
9
9
  accessLevel?: string;
10
+ localId?: string;
10
11
  }
11
12
  export default class MentionItem extends PureComponent<Props, {}> {
12
13
  render(): JSX.Element;
@@ -14,5 +14,7 @@ type UseAnnotationUpdateSatteByEventProps = {
14
14
  export declare const useAnnotationStateByTypeEvent: ({ type, updateSubscriber, }: UseAnnotationUpdateSatteByEventProps) => Record<string, AnnotationMarkStates | null>;
15
15
  export declare const useHasFocusEvent: ({ id, updateSubscriber, }: ListenEventProps) => boolean;
16
16
  type AnnotationsWithClickTarget = Pick<InlineCommentViewComponentProps, 'annotations' | 'clickElementTarget'> | null;
17
- export declare const useAnnotationClickEvent: (props: Pick<ListenEventProps, 'updateSubscriber' | 'createAnalyticsEvent'>) => AnnotationsWithClickTarget;
17
+ export declare const useAnnotationClickEvent: (props: Pick<ListenEventProps, "createAnalyticsEvent" | "updateSubscriber"> & {
18
+ isCommentsOnMediaAnalyticsEnabled?: boolean | undefined;
19
+ }) => AnnotationsWithClickTarget;
18
20
  export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
+ import { type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  type Props = {
4
4
  createAnalyticsEvent?: CreateUIAnalyticsEvent;
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.28.1",
3
+ "version": "109.28.2",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/analytics-next": "^9.3.0",
32
32
  "@atlaskit/button": "^17.14.0",
33
33
  "@atlaskit/code": "^15.2.0",
34
- "@atlaskit/editor-common": "^80.3.0",
34
+ "@atlaskit/editor-common": "^80.4.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.13.0",
36
36
  "@atlaskit/editor-palette": "1.6.0",
37
37
  "@atlaskit/editor-prosemirror": "4.0.1",