@atlaskit/editor-plugin-collab-edit 7.1.8 → 7.1.10

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,19 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 7.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [`750abc612bfa7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/750abc612bfa7) -
8
+ Fixed step analytic reporting
9
+ - Updated dependencies
10
+
11
+ ## 7.1.9
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 7.1.8
4
18
 
5
19
  ### Patch Changes
@@ -58,6 +58,13 @@ var sanitizeStep = exports.sanitizeStep = function sanitizeStep(step) {
58
58
  sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
59
59
  } else if (step instanceof _transform.AddMarkStep || step instanceof _transform.RemoveMarkStep || step instanceof _transform.RemoveNodeMarkStep || step instanceof _transform.AddNodeMarkStep) {
60
60
  sanitizedStep.markType = step.mark.type.name;
61
+ } else if (step instanceof _steps.BatchAttrsStep) {
62
+ var batched = step.data.map(function (_ref) {
63
+ var nodeType = _ref.nodeType,
64
+ attrs = _ref.attrs;
65
+ return "".concat(nodeType, "_").concat(Object.keys(attrs).sort().join('_'));
66
+ });
67
+ sanitizedStep.attr = batched.sort().join('_');
61
68
  }
62
69
  return sanitizedStep;
63
70
  };
@@ -84,10 +91,10 @@ var groupSteps = exports.groupSteps = function groupSteps(sanitizedSteps) {
84
91
  var grouped = groupBy(sanitizedSteps, function (e) {
85
92
  return Object.values(e).join('_');
86
93
  });
87
- return Object.entries(grouped).reduce(function (acc, _ref) {
88
- var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
89
- key = _ref2[0],
90
- value = _ref2[1];
94
+ return Object.entries(grouped).reduce(function (acc, _ref2) {
95
+ var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
96
+ key = _ref3[0],
97
+ value = _ref3[1];
91
98
  acc[key] = Array.isArray(value) ? value.length : 0;
92
99
  return acc;
93
100
  }, {});
@@ -153,11 +160,11 @@ var getScheduler = function getScheduler(obj) {
153
160
  * @param {Readonly<Transaction[]>} props.transactions - The transactions that contain the steps.
154
161
  * @param {(data: StepMetadataAnalytics[]) => void} props.onTrackDataProcessed - Callback function to be called with the processed data.
155
162
  */
156
- var track = exports.track = function track(_ref3) {
157
- var api = _ref3.api,
158
- newEditorState = _ref3.newEditorState,
159
- transactions = _ref3.transactions,
160
- onTrackDataProcessed = _ref3.onTrackDataProcessed;
163
+ var track = exports.track = function track(_ref4) {
164
+ var api = _ref4.api,
165
+ newEditorState = _ref4.newEditorState,
166
+ transactions = _ref4.transactions,
167
+ onTrackDataProcessed = _ref4.onTrackDataProcessed;
161
168
  var newSteps = transactions.flatMap(function (t) {
162
169
  return t.steps;
163
170
  });
@@ -1,4 +1,4 @@
1
- import { AnalyticsStep, SetAttrsStep } from '@atlaskit/adf-schema/steps';
1
+ import { AnalyticsStep, SetAttrsStep, BatchAttrsStep } from '@atlaskit/adf-schema/steps';
2
2
  import { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, RemoveMarkStep, RemoveNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
3
3
  import { sendableSteps } from '@atlaskit/prosemirror-collab';
4
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -47,6 +47,12 @@ export const sanitizeStep = step => {
47
47
  sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
48
48
  } else if (step instanceof AddMarkStep || step instanceof RemoveMarkStep || step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep) {
49
49
  sanitizedStep.markType = step.mark.type.name;
50
+ } else if (step instanceof BatchAttrsStep) {
51
+ const batched = step.data.map(({
52
+ nodeType,
53
+ attrs
54
+ }) => `${nodeType}_${Object.keys(attrs).sort().join('_')}`);
55
+ sanitizedStep.attr = batched.sort().join('_');
50
56
  }
51
57
  return sanitizedStep;
52
58
  };
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
3
3
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
4
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
- import { AnalyticsStep, SetAttrsStep } from '@atlaskit/adf-schema/steps';
5
+ import { AnalyticsStep, SetAttrsStep, BatchAttrsStep } from '@atlaskit/adf-schema/steps';
6
6
  import { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, RemoveMarkStep, RemoveNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
7
7
  import { sendableSteps } from '@atlaskit/prosemirror-collab';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -51,6 +51,13 @@ export var sanitizeStep = function sanitizeStep(step) {
51
51
  sanitizedStep.attr = Object.keys(step.attrs).sort().join('_');
52
52
  } else if (step instanceof AddMarkStep || step instanceof RemoveMarkStep || step instanceof RemoveNodeMarkStep || step instanceof AddNodeMarkStep) {
53
53
  sanitizedStep.markType = step.mark.type.name;
54
+ } else if (step instanceof BatchAttrsStep) {
55
+ var batched = step.data.map(function (_ref) {
56
+ var nodeType = _ref.nodeType,
57
+ attrs = _ref.attrs;
58
+ return "".concat(nodeType, "_").concat(Object.keys(attrs).sort().join('_'));
59
+ });
60
+ sanitizedStep.attr = batched.sort().join('_');
54
61
  }
55
62
  return sanitizedStep;
56
63
  };
@@ -77,10 +84,10 @@ export var groupSteps = function groupSteps(sanitizedSteps) {
77
84
  var grouped = groupBy(sanitizedSteps, function (e) {
78
85
  return Object.values(e).join('_');
79
86
  });
80
- return Object.entries(grouped).reduce(function (acc, _ref) {
81
- var _ref2 = _slicedToArray(_ref, 2),
82
- key = _ref2[0],
83
- value = _ref2[1];
87
+ return Object.entries(grouped).reduce(function (acc, _ref2) {
88
+ var _ref3 = _slicedToArray(_ref2, 2),
89
+ key = _ref3[0],
90
+ value = _ref3[1];
84
91
  acc[key] = Array.isArray(value) ? value.length : 0;
85
92
  return acc;
86
93
  }, {});
@@ -146,11 +153,11 @@ var getScheduler = function getScheduler(obj) {
146
153
  * @param {Readonly<Transaction[]>} props.transactions - The transactions that contain the steps.
147
154
  * @param {(data: StepMetadataAnalytics[]) => void} props.onTrackDataProcessed - Callback function to be called with the processed data.
148
155
  */
149
- export var track = function track(_ref3) {
150
- var api = _ref3.api,
151
- newEditorState = _ref3.newEditorState,
152
- transactions = _ref3.transactions,
153
- onTrackDataProcessed = _ref3.onTrackDataProcessed;
156
+ export var track = function track(_ref4) {
157
+ var api = _ref4.api,
158
+ newEditorState = _ref4.newEditorState,
159
+ transactions = _ref4.transactions,
160
+ onTrackDataProcessed = _ref4.onTrackDataProcessed;
154
161
  var newSteps = transactions.flatMap(function (t) {
155
162
  return t.steps;
156
163
  });
@@ -1,6 +1,6 @@
1
1
  import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
2
- import { type Step } from '@atlaskit/editor-prosemirror/dist/types/transform';
3
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { type Step } from '@atlaskit/editor-prosemirror/transform';
4
4
  export type PrivateCollabEditOptions = CollabEditOptions & {
5
5
  hideTelecursorOnLoad?: boolean;
6
6
  onSyncUpError?: SyncUpErrorFunction;
@@ -1,6 +1,6 @@
1
1
  import type { CollabEditOptions, CollabEditProvider, CollabEventConflictPayload, CollabParticipant, SyncUpErrorFunction } from '@atlaskit/editor-common/collab';
2
- import { type Step } from '@atlaskit/editor-prosemirror/dist/types/transform';
3
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
+ import { type Step } from '@atlaskit/editor-prosemirror/transform';
4
4
  export type PrivateCollabEditOptions = CollabEditOptions & {
5
5
  hideTelecursorOnLoad?: boolean;
6
6
  onSyncUpError?: SyncUpErrorFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "7.1.8",
3
+ "version": "7.1.10",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,29 +27,29 @@
27
27
  "sideEffects": false,
28
28
  "atlaskit:src": "src/index.ts",
29
29
  "dependencies": {
30
- "@atlaskit/adf-schema": "^51.5.1",
30
+ "@atlaskit/adf-schema": "^51.5.0",
31
31
  "@atlaskit/custom-steps": "^0.16.0",
32
32
  "@atlaskit/editor-json-transformer": "^8.31.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
34
34
  "@atlaskit/editor-plugin-connectivity": "^6.0.0",
35
35
  "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
36
36
  "@atlaskit/editor-plugin-feature-flags": "^5.0.0",
37
- "@atlaskit/editor-prosemirror": "7.0.0",
37
+ "@atlaskit/editor-prosemirror": "^7.2.0",
38
38
  "@atlaskit/editor-shared-styles": "^3.10.0",
39
39
  "@atlaskit/frontend-utilities": "^3.2.0",
40
40
  "@atlaskit/platform-feature-flags": "^1.1.0",
41
41
  "@atlaskit/prosemirror-collab": "^0.22.0",
42
- "@atlaskit/tmp-editor-statsig": "^14.5.0",
42
+ "@atlaskit/tmp-editor-statsig": "^15.10.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "memoize-one": "^6.0.0"
45
45
  },
46
46
  "peerDependencies": {
47
- "@atlaskit/editor-common": "^110.38.0",
47
+ "@atlaskit/editor-common": "^110.42.0",
48
48
  "react": "^18.2.0",
49
49
  "react-dom": "^18.2.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@testing-library/react": "^13.4.0",
52
+ "@testing-library/react": "^16.3.0",
53
53
  "wait-for-expect": "^1.2.0"
54
54
  },
55
55
  "techstack": {