@atlaskit/editor-plugin-table 15.0.11 → 15.0.12

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,14 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 15.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c0ef0bedb49c0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0ef0bedb49c0) -
8
+ EDITOR-1391 only send table width information events if there are tables, add enums and boolean
9
+ values for table width, editor width and scrollbar existence for ingestion in signalfx
10
+ - Updated dependencies
11
+
3
12
  ## 15.0.11
4
13
 
5
14
  ### Patch Changes
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -7,8 +8,10 @@ exports.generateResizedPayload = exports.generateResizeFrameRatePayloads = void
7
8
  exports.getSelectedCellInfo = getSelectedCellInfo;
8
9
  exports.getSelectedTableInfo = getSelectedTableInfo;
9
10
  exports.withEditorAnalyticsAPI = exports.useMeasureFramerate = exports.reduceResizeFrameRateSamples = exports.getWidthInfoPayload = void 0;
11
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
12
  var _react = require("react");
11
13
  var _analytics = require("@atlaskit/editor-common/analytics");
14
+ var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
12
15
  var _tableMap = require("@atlaskit/editor-tables/table-map");
13
16
  var _utils = require("@atlaskit/editor-tables/utils");
14
17
  var _colgroup = require("../table-resizing/utils/colgroup");
@@ -229,11 +232,25 @@ var getWidthInfoPayload = exports.getWidthInfoPayload = function getWidthInfoPay
229
232
  }
230
233
  }
231
234
  });
235
+
236
+ // only send the event if there are tables on the page
237
+ if (tablesInfo.length === 0) {
238
+ return undefined;
239
+ }
240
+ var maxTableWidth = Math.max.apply(Math, (0, _toConsumableArray2.default)(tablesInfo.map(function (table) {
241
+ return table.tableWidth;
242
+ })));
232
243
  return {
233
244
  action: _analytics.TABLE_ACTION.TABLE_WIDTH_INFO,
234
245
  actionSubject: _analytics.ACTION_SUBJECT.TABLE,
235
246
  attributes: {
236
247
  editorWidth: editorWidth,
248
+ editorWidthBreakpoint: (0, _analytics2.getBreakpointKey)(editorWidth),
249
+ hasTableWithScrollbar: tablesInfo.some(function (table) {
250
+ return table.hasScrollbar;
251
+ }),
252
+ hasTableWiderThanEditor: maxTableWidth > editorWidth,
253
+ maxTableWidthBreakpoint: (0, _analytics2.getBreakpointKey)(maxTableWidth),
237
254
  tableWidthInfo: tablesInfo,
238
255
  mode: 'editor'
239
256
  },
@@ -431,7 +431,10 @@ var tablePlugin = function tablePlugin(_ref) {
431
431
  var _api$width$sharedStat2;
432
432
  var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
433
433
  if (editorWidth && editorViewRef.current) {
434
- dispatchAnalyticsEvent((0, _analytics2.getWidthInfoPayload)(editorViewRef.current, editorWidth));
434
+ var payload = (0, _analytics2.getWidthInfoPayload)(editorViewRef.current, editorWidth);
435
+ if (payload) {
436
+ dispatchAnalyticsEvent(payload);
437
+ }
435
438
  }
436
439
  };
437
440
  if (window && typeof window.requestIdleCallback === 'function') {
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
3
+ import { getBreakpointKey } from '@atlaskit/editor-common/utils/analytics';
3
4
  import { TableMap } from '@atlaskit/editor-tables/table-map';
4
5
  import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
5
6
  import { hasTableBeenResized } from '../table-resizing/utils/colgroup';
@@ -206,11 +207,21 @@ export const getWidthInfoPayload = (editorView, editorWidth) => {
206
207
  }
207
208
  }
208
209
  });
210
+
211
+ // only send the event if there are tables on the page
212
+ if (tablesInfo.length === 0) {
213
+ return undefined;
214
+ }
215
+ const maxTableWidth = Math.max(...tablesInfo.map(table => table.tableWidth));
209
216
  return {
210
217
  action: TABLE_ACTION.TABLE_WIDTH_INFO,
211
218
  actionSubject: ACTION_SUBJECT.TABLE,
212
219
  attributes: {
213
- editorWidth: editorWidth,
220
+ editorWidth,
221
+ editorWidthBreakpoint: getBreakpointKey(editorWidth),
222
+ hasTableWithScrollbar: tablesInfo.some(table => table.hasScrollbar),
223
+ hasTableWiderThanEditor: maxTableWidth > editorWidth,
224
+ maxTableWidthBreakpoint: getBreakpointKey(maxTableWidth),
214
225
  tableWidthInfo: tablesInfo,
215
226
  mode: 'editor'
216
227
  },
@@ -420,7 +420,10 @@ const tablePlugin = ({
420
420
  var _api$width$sharedStat2;
421
421
  const editorWidth = api === null || api === void 0 ? void 0 : (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
422
422
  if (editorWidth && editorViewRef.current) {
423
- dispatchAnalyticsEvent(getWidthInfoPayload(editorViewRef.current, editorWidth));
423
+ const payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
424
+ if (payload) {
425
+ dispatchAnalyticsEvent(payload);
426
+ }
424
427
  }
425
428
  };
426
429
  if (window && typeof window.requestIdleCallback === 'function') {
@@ -1,5 +1,7 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import { useEffect, useRef } from 'react';
2
3
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
4
+ import { getBreakpointKey } from '@atlaskit/editor-common/utils/analytics';
3
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
4
6
  import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
5
7
  import { hasTableBeenResized } from '../table-resizing/utils/colgroup';
@@ -220,11 +222,25 @@ export var getWidthInfoPayload = function getWidthInfoPayload(editorView, editor
220
222
  }
221
223
  }
222
224
  });
225
+
226
+ // only send the event if there are tables on the page
227
+ if (tablesInfo.length === 0) {
228
+ return undefined;
229
+ }
230
+ var maxTableWidth = Math.max.apply(Math, _toConsumableArray(tablesInfo.map(function (table) {
231
+ return table.tableWidth;
232
+ })));
223
233
  return {
224
234
  action: TABLE_ACTION.TABLE_WIDTH_INFO,
225
235
  actionSubject: ACTION_SUBJECT.TABLE,
226
236
  attributes: {
227
237
  editorWidth: editorWidth,
238
+ editorWidthBreakpoint: getBreakpointKey(editorWidth),
239
+ hasTableWithScrollbar: tablesInfo.some(function (table) {
240
+ return table.hasScrollbar;
241
+ }),
242
+ hasTableWiderThanEditor: maxTableWidth > editorWidth,
243
+ maxTableWidthBreakpoint: getBreakpointKey(maxTableWidth),
228
244
  tableWidthInfo: tablesInfo,
229
245
  mode: 'editor'
230
246
  },
@@ -422,7 +422,10 @@ var tablePlugin = function tablePlugin(_ref) {
422
422
  var _api$width$sharedStat2;
423
423
  var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
424
424
  if (editorWidth && editorViewRef.current) {
425
- dispatchAnalyticsEvent(getWidthInfoPayload(editorViewRef.current, editorWidth));
425
+ var payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
426
+ if (payload) {
427
+ dispatchAnalyticsEvent(payload);
428
+ }
426
429
  }
427
430
  };
428
431
  if (window && typeof window.requestIdleCallback === 'function') {
@@ -44,5 +44,5 @@ export declare const useMeasureFramerate: (config?: UseMeasureFramerateConfig) =
44
44
  endMeasure: () => number[];
45
45
  countFrames: () => void;
46
46
  };
47
- export declare const getWidthInfoPayload: (editorView: EditorView, editorWidth: number) => TableEventPayload;
47
+ export declare const getWidthInfoPayload: (editorView: EditorView, editorWidth: number) => TableEventPayload | undefined;
48
48
  export {};
@@ -44,5 +44,5 @@ export declare const useMeasureFramerate: (config?: UseMeasureFramerateConfig) =
44
44
  endMeasure: () => number[];
45
45
  countFrames: () => void;
46
46
  };
47
- export declare const getWidthInfoPayload: (editorView: EditorView, editorWidth: number) => TableEventPayload;
47
+ export declare const getWidthInfoPayload: (editorView: EditorView, editorWidth: number) => TableEventPayload | undefined;
48
48
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "15.0.11",
3
+ "version": "15.0.12",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -72,7 +72,7 @@
72
72
  "uuid": "^3.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^110.10.0",
75
+ "@atlaskit/editor-common": "^110.11.0",
76
76
  "react": "^18.2.0",
77
77
  "react-dom": "^18.2.0",
78
78
  "react-intl-next": "npm:react-intl@^5.18.1"