@atlaskit/editor-plugin-block-menu 4.0.8 → 4.0.9

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,13 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 4.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`bbb9bb5594379`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bbb9bb5594379) -
8
+ Add eventCategory attribute in the payload of `elementConverted` event from Block menu
9
+ - Updated dependencies
10
+
3
11
  ## 4.0.8
4
12
 
5
13
  ### Patch Changes
@@ -136,6 +136,7 @@ var formatNode = exports.formatNode = function formatNode(api) {
136
136
  attributes: {
137
137
  from: sourceTypeName,
138
138
  to: targetType,
139
+ eventCategory: (0, _utils2.getConversionType)(sourceTypeName, targetType),
139
140
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.MOUSE,
140
141
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.BLOCK_MENU,
141
142
  conversionSource: 'emptyList'
@@ -176,6 +177,7 @@ var formatNode = exports.formatNode = function formatNode(api) {
176
177
  attributes: {
177
178
  from: _sourceTypeName,
178
179
  to: targetType,
180
+ eventCategory: (0, _utils2.getConversionType)(_sourceTypeName, targetType),
179
181
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.MOUSE,
180
182
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.BLOCK_MENU,
181
183
  conversionSource: conversionSource
@@ -232,6 +234,7 @@ var formatNode = exports.formatNode = function formatNode(api) {
232
234
  attributes: {
233
235
  from: _sourceTypeName2,
234
236
  to: targetType,
237
+ eventCategory: (0, _utils2.getConversionType)(_sourceTypeName2, targetType),
235
238
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.MOUSE,
236
239
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.BLOCK_MENU
237
240
  }
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.isListNodeType = exports.isListNode = exports.isLayoutNodeType = exports.isLayoutNode = exports.isHeadingOrParagraphNode = exports.isContainerNodeType = exports.isContainerNode = exports.isBlockNodeType = exports.isBlockNodeForExtraction = exports.isBlockNode = exports.getTargetNodeInfo = exports.getMarksWithBreakout = exports.getContentSupportChecker = exports.filterMarksForTargetNodeType = exports.convertNodeToInlineContent = exports.convertCodeBlockContentToParagraphs = void 0;
7
+ exports.isListNodeType = exports.isListNode = exports.isLayoutNodeType = exports.isLayoutNode = exports.isHeadingOrParagraphNode = exports.isContainerNodeType = exports.isContainerNode = exports.isBlockNodeType = exports.isBlockNodeForExtraction = exports.isBlockNode = exports.getTargetNodeInfo = exports.getMarksWithBreakout = exports.getConversionType = exports.getContentSupportChecker = exports.filterMarksForTargetNodeType = exports.convertNodeToInlineContent = exports.convertCodeBlockContentToParagraphs = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _model = require("@atlaskit/editor-prosemirror/model");
10
10
  var getTargetNodeInfo = exports.getTargetNodeInfo = function getTargetNodeInfo(targetType, nodes) {
@@ -221,4 +221,38 @@ var getMarksWithBreakout = exports.getMarksWithBreakout = function getMarksWithB
221
221
  return hasBreakoutMark ? allowedMarks : [].concat((0, _toConsumableArray2.default)(allowedMarks), [sourceBreakoutMark]);
222
222
  }
223
223
  return allowedMarks;
224
+ };
225
+
226
+ /**
227
+ * Determines the conversion type based on source and target node types
228
+ * This is for analytics use - these types match existing analytics events for consistency
229
+ */
230
+ var getConversionType = exports.getConversionType = function getConversionType(from, to) {
231
+ // Block node insertion: block-like elements inserted from empty line or wrapping text/list
232
+ var blockNodes = ['panel', 'expand', 'codeBlock', 'layoutSection', 'taskList'];
233
+ var textNodes = ['paragraph', 'blockquote'];
234
+ var headingNodes = ['heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6'];
235
+ var listNodes = ['bulletList', 'orderedList'];
236
+
237
+ // Check if converting to block nodes from text/heading/list nodes
238
+ if (blockNodes.includes(to) && (textNodes.includes(from) || headingNodes.includes(from) || listNodes.includes(from))) {
239
+ return 'blockNodeInserted';
240
+ }
241
+
242
+ // Check if converting from paragraph/blockquote to list
243
+ if (listNodes.includes(to) && textNodes.includes(from)) {
244
+ return 'listInserted';
245
+ }
246
+
247
+ // Check if converting from list to paragraph/heading/blockquote or between list types
248
+ if (listNodes.includes(from) && (listNodes.includes(to) || textNodes.includes(to))) {
249
+ return 'listConverted';
250
+ }
251
+
252
+ // Text formatting: conversions among paragraph/headings/blockquote
253
+ if ((textNodes.includes(from) || headingNodes.includes(from)) && (textNodes.includes(to) || headingNodes.includes(to))) {
254
+ return 'textFormatted';
255
+ }
256
+ // For other conversions, we do not have a matching event category
257
+ return undefined;
224
258
  };
@@ -7,7 +7,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
7
7
  import { setSelectionAfterTransform } from './selection';
8
8
  import { createDefaultLayoutSection } from './transforms/layout-transforms';
9
9
  import { transformNodeToTargetType } from './transforms/transformNodeToTargetType';
10
- import { isListNodeType } from './transforms/utils';
10
+ import { isListNodeType, getConversionType } from './transforms/utils';
11
11
 
12
12
  /**
13
13
  * Handles formatting when selection is empty by inserting a new target node
@@ -141,6 +141,7 @@ export const formatNode = api => (targetType, analyticsAttrs) => {
141
141
  attributes: {
142
142
  from: sourceTypeName,
143
143
  to: targetType,
144
+ eventCategory: getConversionType(sourceTypeName, targetType),
144
145
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
145
146
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU,
146
147
  conversionSource: 'emptyList'
@@ -181,6 +182,7 @@ export const formatNode = api => (targetType, analyticsAttrs) => {
181
182
  attributes: {
182
183
  from: sourceTypeName,
183
184
  to: targetType,
185
+ eventCategory: getConversionType(sourceTypeName, targetType),
184
186
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
185
187
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU,
186
188
  conversionSource
@@ -237,6 +239,7 @@ export const formatNode = api => (targetType, analyticsAttrs) => {
237
239
  attributes: {
238
240
  from: sourceTypeName,
239
241
  to: targetType,
242
+ eventCategory: getConversionType(sourceTypeName, targetType),
240
243
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
241
244
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU
242
245
  }
@@ -209,4 +209,38 @@ export const getMarksWithBreakout = (sourceNode, targetNodeType) => {
209
209
  return hasBreakoutMark ? allowedMarks : [...allowedMarks, sourceBreakoutMark];
210
210
  }
211
211
  return allowedMarks;
212
+ };
213
+
214
+ /**
215
+ * Determines the conversion type based on source and target node types
216
+ * This is for analytics use - these types match existing analytics events for consistency
217
+ */
218
+ export const getConversionType = (from, to) => {
219
+ // Block node insertion: block-like elements inserted from empty line or wrapping text/list
220
+ const blockNodes = ['panel', 'expand', 'codeBlock', 'layoutSection', 'taskList'];
221
+ const textNodes = ['paragraph', 'blockquote'];
222
+ const headingNodes = ['heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6'];
223
+ const listNodes = ['bulletList', 'orderedList'];
224
+
225
+ // Check if converting to block nodes from text/heading/list nodes
226
+ if (blockNodes.includes(to) && (textNodes.includes(from) || headingNodes.includes(from) || listNodes.includes(from))) {
227
+ return 'blockNodeInserted';
228
+ }
229
+
230
+ // Check if converting from paragraph/blockquote to list
231
+ if (listNodes.includes(to) && textNodes.includes(from)) {
232
+ return 'listInserted';
233
+ }
234
+
235
+ // Check if converting from list to paragraph/heading/blockquote or between list types
236
+ if (listNodes.includes(from) && (listNodes.includes(to) || textNodes.includes(to))) {
237
+ return 'listConverted';
238
+ }
239
+
240
+ // Text formatting: conversions among paragraph/headings/blockquote
241
+ if ((textNodes.includes(from) || headingNodes.includes(from)) && (textNodes.includes(to) || headingNodes.includes(to))) {
242
+ return 'textFormatted';
243
+ }
244
+ // For other conversions, we do not have a matching event category
245
+ return undefined;
212
246
  };
@@ -7,7 +7,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
7
7
  import { setSelectionAfterTransform } from './selection';
8
8
  import { createDefaultLayoutSection } from './transforms/layout-transforms';
9
9
  import { transformNodeToTargetType } from './transforms/transformNodeToTargetType';
10
- import { isListNodeType } from './transforms/utils';
10
+ import { isListNodeType, getConversionType } from './transforms/utils';
11
11
 
12
12
  /**
13
13
  * Handles formatting when selection is empty by inserting a new target node
@@ -131,6 +131,7 @@ export var formatNode = function formatNode(api) {
131
131
  attributes: {
132
132
  from: sourceTypeName,
133
133
  to: targetType,
134
+ eventCategory: getConversionType(sourceTypeName, targetType),
134
135
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
135
136
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU,
136
137
  conversionSource: 'emptyList'
@@ -171,6 +172,7 @@ export var formatNode = function formatNode(api) {
171
172
  attributes: {
172
173
  from: _sourceTypeName,
173
174
  to: targetType,
175
+ eventCategory: getConversionType(_sourceTypeName, targetType),
174
176
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
175
177
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU,
176
178
  conversionSource: conversionSource
@@ -227,6 +229,7 @@ export var formatNode = function formatNode(api) {
227
229
  attributes: {
228
230
  from: _sourceTypeName2,
229
231
  to: targetType,
232
+ eventCategory: getConversionType(_sourceTypeName2, targetType),
230
233
  inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
231
234
  triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU
232
235
  }
@@ -214,4 +214,38 @@ export var getMarksWithBreakout = function getMarksWithBreakout(sourceNode, targ
214
214
  return hasBreakoutMark ? allowedMarks : [].concat(_toConsumableArray(allowedMarks), [sourceBreakoutMark]);
215
215
  }
216
216
  return allowedMarks;
217
+ };
218
+
219
+ /**
220
+ * Determines the conversion type based on source and target node types
221
+ * This is for analytics use - these types match existing analytics events for consistency
222
+ */
223
+ export var getConversionType = function getConversionType(from, to) {
224
+ // Block node insertion: block-like elements inserted from empty line or wrapping text/list
225
+ var blockNodes = ['panel', 'expand', 'codeBlock', 'layoutSection', 'taskList'];
226
+ var textNodes = ['paragraph', 'blockquote'];
227
+ var headingNodes = ['heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6'];
228
+ var listNodes = ['bulletList', 'orderedList'];
229
+
230
+ // Check if converting to block nodes from text/heading/list nodes
231
+ if (blockNodes.includes(to) && (textNodes.includes(from) || headingNodes.includes(from) || listNodes.includes(from))) {
232
+ return 'blockNodeInserted';
233
+ }
234
+
235
+ // Check if converting from paragraph/blockquote to list
236
+ if (listNodes.includes(to) && textNodes.includes(from)) {
237
+ return 'listInserted';
238
+ }
239
+
240
+ // Check if converting from list to paragraph/heading/blockquote or between list types
241
+ if (listNodes.includes(from) && (listNodes.includes(to) || textNodes.includes(to))) {
242
+ return 'listConverted';
243
+ }
244
+
245
+ // Text formatting: conversions among paragraph/headings/blockquote
246
+ if ((textNodes.includes(from) || headingNodes.includes(from)) && (textNodes.includes(to) || headingNodes.includes(to))) {
247
+ return 'textFormatted';
248
+ }
249
+ // For other conversions, we do not have a matching event category
250
+ return undefined;
217
251
  };
@@ -38,3 +38,8 @@ export declare const filterMarksForTargetNodeType: (content: Fragment, targetNod
38
38
  */
39
39
  export declare const convertCodeBlockContentToParagraphs: (codeBlockNode: PMNode, schema: Schema) => PMNode[];
40
40
  export declare const getMarksWithBreakout: (sourceNode: PMNode, targetNodeType: NodeType) => readonly Mark[];
41
+ /**
42
+ * Determines the conversion type based on source and target node types
43
+ * This is for analytics use - these types match existing analytics events for consistency
44
+ */
45
+ export declare const getConversionType: (from: string, to: string) => "blockNodeInserted" | "listInserted" | "listConverted" | "textFormatted" | undefined;
@@ -38,3 +38,8 @@ export declare const filterMarksForTargetNodeType: (content: Fragment, targetNod
38
38
  */
39
39
  export declare const convertCodeBlockContentToParagraphs: (codeBlockNode: PMNode, schema: Schema) => PMNode[];
40
40
  export declare const getMarksWithBreakout: (sourceNode: PMNode, targetNodeType: NodeType) => readonly Mark[];
41
+ /**
42
+ * Determines the conversion type based on source and target node types
43
+ * This is for analytics use - these types match existing analytics events for consistency
44
+ */
45
+ export declare const getConversionType: (from: string, to: string) => "blockNodeInserted" | "listInserted" | "listConverted" | "textFormatted" | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "4.0.8",
3
+ "version": "4.0.9",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",