@atlaskit/editor-plugin-collab-edit 18.0.7 → 18.1.1

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,24 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 18.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 18.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`920a9bc294e07`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/920a9bc294e07) -
14
+ Show names for supported external agents, plus Claude branding and its consistent orange diff
15
+ colour. Share the Claude colour override through getParticipantColor for diff attribution and
16
+ collaboration telepointers behind confluence_ncs_step_diffing_version_history.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 18.0.7
4
23
 
5
24
  ### Patch Changes
@@ -129,6 +129,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
129
129
  if (telepointerData) {
130
130
  var sessionId = telepointerData.sessionId;
131
131
  if (participants.get(sessionId) && sessionId !== sid) {
132
+ var _participants$get;
132
133
  var oldPointers = (0, _utils.findPointers)(this.getPresenceId(sessionId), this.decorationSet);
133
134
  if (oldPointers) {
134
135
  remove = remove.concat(oldPointers);
@@ -153,7 +154,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
153
154
  } catch (err) {
154
155
  this.onError(err);
155
156
  }
156
- add = add.concat((0, _utils.createTelepointers)(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), (0, _utils.hasExistingNudge)(sessionId, this.nudgeAnimations)));
157
+ add = add.concat((0, _utils.createTelepointers)(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), (0, _utils.hasExistingNudge)(sessionId, this.nudgeAnimations), (_participants$get = participants.get(sessionId)) === null || _participants$get === void 0 ? void 0 : _participants$get.agentType));
157
158
  }
158
159
  }
159
160
  if (tr.docChanged) {
@@ -165,6 +166,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
165
166
  if (spec.pointer && spec.pointer.sessionId && spec.key === "telepointer-".concat(spec.pointer.sessionId)) {
166
167
  var step = tr.steps.filter(_utils.isReplaceStep)[0];
167
168
  if (step) {
169
+ var _participants$get2;
168
170
  var _spec$pointer = spec.pointer,
169
171
  _sessionId = _spec$pointer.sessionId,
170
172
  presenceId = _spec$pointer.presenceId;
@@ -172,7 +174,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
172
174
  size = _ref.slice.content.size,
173
175
  _from = _ref.from;
174
176
  var pos = getValidPos(tr, size ? Math.min(_from + size, tr.doc.nodeSize - 3) : Math.max(_from, 1));
175
- add = add.concat((0, _utils.createTelepointers)(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId), (0, _utils.hasExistingNudge)(_sessionId, _this.nudgeAnimations)));
177
+ add = add.concat((0, _utils.createTelepointers)(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId), (0, _utils.hasExistingNudge)(_sessionId, _this.nudgeAnimations), (_participants$get2 = participants.get(_sessionId)) === null || _participants$get2 === void 0 ? void 0 : _participants$get2.agentType));
176
178
  }
177
179
  }
178
180
  }
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.updateNcsSessionStepMetrics = exports.updateNcsActiveSessions = exports.getNcsSessionStepMetrics = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _ncsStepMetrics = require("@atlaskit/editor-common/ncs-step-metrics");
10
- var _frontendUtilities = require("@atlaskit/frontend-utilities");
10
+ var _StorageClient = require("@atlaskit/frontend-utilities/StorageClient");
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
- var storageClient = new _frontendUtilities.StorageClient(_ncsStepMetrics.NCS_STORAGE.NCS_STORAGE_CLIENT_KEY);
13
+ var storageClient = new _StorageClient.StorageClient(_ncsStepMetrics.NCS_STORAGE.NCS_STORAGE_CLIENT_KEY);
14
14
 
15
15
  /**
16
16
  * Gets the current step session metrics for a given session ID
@@ -18,7 +18,8 @@ var _whitespace = require("@atlaskit/editor-common/whitespace");
18
18
  var _state = require("@atlaskit/editor-prosemirror/state");
19
19
  var _transform = require("@atlaskit/editor-prosemirror/transform");
20
20
  var _view = require("@atlaskit/editor-prosemirror/view");
21
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
21
+ var _utils = require("@atlaskit/editor-shared-styles/utils");
22
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
22
23
  var _preserveNodeIdentity = require("./preserve-node-identity");
23
24
  var findPointers = exports.findPointers = function findPointers(id, decorations) {
24
25
  return decorations.find().reduce(
@@ -34,17 +35,17 @@ function style(options) {
34
35
  var borderWidth = "var(--ds-border-width-focused, 2px)";
35
36
  return "border-right: ".concat(borderWidth, " solid ").concat(color, "; margin-right: calc(-1 * ").concat(borderWidth, "); z-index: 1");
36
37
  }
37
- function getAvatarColor(str) {
38
- var participantColor = (0, _editorSharedStyles.getParticipantColor)(str);
38
+ function getAvatarColor(str, agentType) {
39
+ var participantColor = (0, _utils.getParticipantColor)(str, (0, _fg.fg)('confluence_ncs_step_diffing_version_history') ? agentType : undefined);
39
40
  return {
40
41
  index: participantColor.index,
41
42
  backgroundColor: participantColor.color.backgroundColor,
42
43
  textColor: participantColor.color.textColor
43
44
  };
44
45
  }
45
- var createTelepointers = exports.createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId, fullName, isNudged) {
46
+ var createTelepointers = exports.createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId, fullName, isNudged, agentType) {
46
47
  var decorations = [];
47
- var avatarColor = getAvatarColor(presenceId);
48
+ var avatarColor = getAvatarColor(presenceId, agentType);
48
49
  var color = avatarColor.index.toString();
49
50
  if (isSelection) {
50
51
  var className = "telepointer color-".concat(color, " telepointer-selection");
@@ -101,6 +101,7 @@ export class PluginState {
101
101
  sessionId
102
102
  } = telepointerData;
103
103
  if (participants.get(sessionId) && sessionId !== sid) {
104
+ var _participants$get;
104
105
  const oldPointers = findPointers(this.getPresenceId(sessionId), this.decorationSet);
105
106
  if (oldPointers) {
106
107
  remove = remove.concat(oldPointers);
@@ -125,7 +126,7 @@ export class PluginState {
125
126
  } catch (err) {
126
127
  this.onError(err);
127
128
  }
128
- add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations)));
129
+ add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations), (_participants$get = participants.get(sessionId)) === null || _participants$get === void 0 ? void 0 : _participants$get.agentType));
129
130
  }
130
131
  }
131
132
  if (tr.docChanged) {
@@ -137,6 +138,7 @@ export class PluginState {
137
138
  if (spec.pointer && spec.pointer.sessionId && spec.key === `telepointer-${spec.pointer.sessionId}`) {
138
139
  const step = tr.steps.filter(isReplaceStep)[0];
139
140
  if (step) {
141
+ var _participants$get2;
140
142
  const {
141
143
  sessionId,
142
144
  presenceId
@@ -152,7 +154,7 @@ export class PluginState {
152
154
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
155
  } = step;
154
156
  const pos = getValidPos(tr, size ? Math.min(from + size, tr.doc.nodeSize - 3) : Math.max(from, 1));
155
- add = add.concat(createTelepointers(pos, pos, sessionId, false, this.getInitial(sessionId), presenceId, this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations)));
157
+ add = add.concat(createTelepointers(pos, pos, sessionId, false, this.getInitial(sessionId), presenceId, this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations), (_participants$get2 = participants.get(sessionId)) === null || _participants$get2 === void 0 ? void 0 : _participants$get2.agentType));
156
158
  }
157
159
  }
158
160
  }
@@ -1,5 +1,5 @@
1
1
  import { NCS_STORAGE } from '@atlaskit/editor-common/ncs-step-metrics';
2
- import { StorageClient } from '@atlaskit/frontend-utilities';
2
+ import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
3
3
  const storageClient = new StorageClient(NCS_STORAGE.NCS_STORAGE_CLIENT_KEY);
4
4
 
5
5
  /**
@@ -8,7 +8,8 @@ import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/whitespace';
8
8
  import { Transaction, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { AttrStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
10
10
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
11
- import { getParticipantColor } from '@atlaskit/editor-shared-styles';
11
+ import { getParticipantColor } from '@atlaskit/editor-shared-styles/utils';
12
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
12
13
  import { preserveNodeIdentity } from './preserve-node-identity';
13
14
  export const findPointers = (id, decorations) => decorations.find().reduce(
14
15
  // `pointer` is absent on non-telepointer decorations (e.g. the agent-shimmer
@@ -22,17 +23,17 @@ function style(options) {
22
23
  const borderWidth = "var(--ds-border-width-focused, 2px)";
23
24
  return `border-right: ${borderWidth} solid ${color}; margin-right: calc(-1 * ${borderWidth}); z-index: 1`;
24
25
  }
25
- export function getAvatarColor(str) {
26
- const participantColor = getParticipantColor(str);
26
+ export function getAvatarColor(str, agentType) {
27
+ const participantColor = getParticipantColor(str, fg('confluence_ncs_step_diffing_version_history') ? agentType : undefined);
27
28
  return {
28
29
  index: participantColor.index,
29
30
  backgroundColor: participantColor.color.backgroundColor,
30
31
  textColor: participantColor.color.textColor
31
32
  };
32
33
  }
33
- export const createTelepointers = (from, to, sessionId, isSelection, initial, presenceId, fullName, isNudged) => {
34
+ export const createTelepointers = (from, to, sessionId, isSelection, initial, presenceId, fullName, isNudged, agentType) => {
34
35
  const decorations = [];
35
- const avatarColor = getAvatarColor(presenceId);
36
+ const avatarColor = getAvatarColor(presenceId, agentType);
36
37
  const color = avatarColor.index.toString();
37
38
  if (isSelection) {
38
39
  const className = `telepointer color-${color} telepointer-selection`;
@@ -123,6 +123,7 @@ export var PluginState = /*#__PURE__*/function () {
123
123
  if (telepointerData) {
124
124
  var sessionId = telepointerData.sessionId;
125
125
  if (participants.get(sessionId) && sessionId !== sid) {
126
+ var _participants$get;
126
127
  var oldPointers = findPointers(this.getPresenceId(sessionId), this.decorationSet);
127
128
  if (oldPointers) {
128
129
  remove = remove.concat(oldPointers);
@@ -147,7 +148,7 @@ export var PluginState = /*#__PURE__*/function () {
147
148
  } catch (err) {
148
149
  this.onError(err);
149
150
  }
150
- add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations)));
151
+ add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations), (_participants$get = participants.get(sessionId)) === null || _participants$get === void 0 ? void 0 : _participants$get.agentType));
151
152
  }
152
153
  }
153
154
  if (tr.docChanged) {
@@ -159,6 +160,7 @@ export var PluginState = /*#__PURE__*/function () {
159
160
  if (spec.pointer && spec.pointer.sessionId && spec.key === "telepointer-".concat(spec.pointer.sessionId)) {
160
161
  var step = tr.steps.filter(isReplaceStep)[0];
161
162
  if (step) {
163
+ var _participants$get2;
162
164
  var _spec$pointer = spec.pointer,
163
165
  _sessionId = _spec$pointer.sessionId,
164
166
  presenceId = _spec$pointer.presenceId;
@@ -166,7 +168,7 @@ export var PluginState = /*#__PURE__*/function () {
166
168
  size = _ref.slice.content.size,
167
169
  _from = _ref.from;
168
170
  var pos = getValidPos(tr, size ? Math.min(_from + size, tr.doc.nodeSize - 3) : Math.max(_from, 1));
169
- add = add.concat(createTelepointers(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId), hasExistingNudge(_sessionId, _this.nudgeAnimations)));
171
+ add = add.concat(createTelepointers(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId), hasExistingNudge(_sessionId, _this.nudgeAnimations), (_participants$get2 = participants.get(_sessionId)) === null || _participants$get2 === void 0 ? void 0 : _participants$get2.agentType));
170
172
  }
171
173
  }
172
174
  }
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { NCS_STORAGE } from '@atlaskit/editor-common/ncs-step-metrics';
5
- import { StorageClient } from '@atlaskit/frontend-utilities';
5
+ import { StorageClient } from '@atlaskit/frontend-utilities/StorageClient';
6
6
  var storageClient = new StorageClient(NCS_STORAGE.NCS_STORAGE_CLIENT_KEY);
7
7
 
8
8
  /**
@@ -9,7 +9,8 @@ import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/whitespace';
9
9
  import { Transaction, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
10
10
  import { AttrStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
11
11
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
12
- import { getParticipantColor } from '@atlaskit/editor-shared-styles';
12
+ import { getParticipantColor } from '@atlaskit/editor-shared-styles/utils';
13
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
13
14
  import { preserveNodeIdentity } from './preserve-node-identity';
14
15
  export var findPointers = function findPointers(id, decorations) {
15
16
  return decorations.find().reduce(
@@ -25,17 +26,17 @@ function style(options) {
25
26
  var borderWidth = "var(--ds-border-width-focused, 2px)";
26
27
  return "border-right: ".concat(borderWidth, " solid ").concat(color, "; margin-right: calc(-1 * ").concat(borderWidth, "); z-index: 1");
27
28
  }
28
- export function getAvatarColor(str) {
29
- var participantColor = getParticipantColor(str);
29
+ export function getAvatarColor(str, agentType) {
30
+ var participantColor = getParticipantColor(str, fg('confluence_ncs_step_diffing_version_history') ? agentType : undefined);
30
31
  return {
31
32
  index: participantColor.index,
32
33
  backgroundColor: participantColor.color.backgroundColor,
33
34
  textColor: participantColor.color.textColor
34
35
  };
35
36
  }
36
- export var createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId, fullName, isNudged) {
37
+ export var createTelepointers = function createTelepointers(from, to, sessionId, isSelection, initial, presenceId, fullName, isNudged, agentType) {
37
38
  var decorations = [];
38
- var avatarColor = getAvatarColor(presenceId);
39
+ var avatarColor = getAvatarColor(presenceId, agentType);
39
40
  var color = avatarColor.index.toString();
40
41
  if (isSelection) {
41
42
  var className = "telepointer color-".concat(color, " telepointer-selection");
@@ -25,7 +25,7 @@ export type CollabEditPlugin = NextEditorPlugin<'collabEdit', {
25
25
  mark: Mark;
26
26
  pos: number;
27
27
  }) => boolean;
28
- getAvatarColor: (str: string) => {
28
+ getAvatarColor: (str: string, agentType?: string) => {
29
29
  backgroundColor: string;
30
30
  index: number;
31
31
  textColor: string;
@@ -7,12 +7,12 @@ import type { Step } from '@atlaskit/editor-prosemirror/transform-override';
7
7
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
8
8
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
9
  export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[];
10
- export declare function getAvatarColor(str: string): {
10
+ export declare function getAvatarColor(str: string, agentType?: string): {
11
11
  backgroundColor: string;
12
12
  index: number;
13
13
  textColor: string;
14
14
  };
15
- export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string, presenceId: string, fullName: string, isNudged: boolean) => Decoration[];
15
+ export declare const createTelepointers: (from: number, to: number, sessionId: string, isSelection: boolean, initial: string, presenceId: string, fullName: string, isNudged: boolean, agentType?: string) => Decoration[];
16
16
  export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => Transaction;
17
17
  export declare const scrollToCollabCursor: (editorView: EditorView, participants: CollabParticipant[], sessionId: string | undefined, index: number, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => void;
18
18
  export declare const getPositionOfTelepointer: (sessionId: string, decorationSet: DecorationSet) => undefined | number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "18.0.7",
3
+ "version": "18.1.1",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,13 +27,13 @@
27
27
  "@atlaskit/editor-plugin-editor-viewmode": "^19.0.0",
28
28
  "@atlaskit/editor-plugin-feature-flags": "^16.0.0",
29
29
  "@atlaskit/editor-prosemirror": "^8.0.0",
30
- "@atlaskit/editor-shared-styles": "^4.1.0",
30
+ "@atlaskit/editor-shared-styles": "^4.2.0",
31
31
  "@atlaskit/frontend-utilities": "^4.4.0",
32
32
  "@atlaskit/platform-feature-experiments": "^0.3.0",
33
33
  "@atlaskit/platform-feature-flags": "^2.2.0",
34
34
  "@atlaskit/prosemirror-collab": "^1.1.0",
35
- "@atlaskit/tmp-editor-statsig": "^185.0.0",
36
- "@atlaskit/tokens": "^16.11.0",
35
+ "@atlaskit/tmp-editor-statsig": "^187.0.0",
36
+ "@atlaskit/tokens": "^16.12.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "memoize-one": "^6.0.0"
39
39
  },
@@ -49,6 +49,10 @@
49
49
  "wait-for-expect": "^1.2.0"
50
50
  },
51
51
  "platform-feature-flags": {
52
+ "confluence_ncs_step_diffing_version_history": {
53
+ "type": "boolean",
54
+ "referenceOnly": true
55
+ },
52
56
  "platform_editor_agent_be_review_undo": {
53
57
  "type": "boolean"
54
58
  },