@atlaskit/editor-plugin-collab-edit 15.0.8 → 16.0.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 +23 -0
- package/dist/cjs/pm-plugins/main/agent-review-segments.js +10 -0
- package/dist/cjs/pm-plugins/track-steps.js +0 -1
- package/dist/es2019/pm-plugins/main/agent-review-segments.js +10 -0
- package/dist/es2019/pm-plugins/track-steps.js +0 -1
- package/dist/esm/pm-plugins/main/agent-review-segments.js +10 -0
- package/dist/esm/pm-plugins/track-steps.js +0 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 16.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 16.0.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`ddb1f3da1e991`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ddb1f3da1e991) -
|
|
14
|
+
Track acceptance rate for backend-persisted agent edits. These arrive as remote collab steps
|
|
15
|
+
rather than frontend-streamed transformations, so they previously started no analytics session and
|
|
16
|
+
were absent from the metric. They now reuse the existing survival definition, and are recorded
|
|
17
|
+
only on the requesting user's client.
|
|
18
|
+
|
|
19
|
+
Gated by `platform_editor_agent_be_streaming`, which controls whether remote agent steps are
|
|
20
|
+
annotated at all, and by the agent type allowlist in
|
|
21
|
+
`platform_editor_backend_review_moment_agent_types`, which defaults to empty. Recording cannot
|
|
22
|
+
occur unless both permit it.
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 15.0.8
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -7,6 +7,7 @@ exports.getAgentEditSegments = exports.REVIEW_MOMENT_AGENT_TYPES_CONFIG = void 0
|
|
|
7
7
|
var _expVal = require("@atlaskit/platform-feature-experiments/exp-val");
|
|
8
8
|
var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
|
|
9
9
|
var _agentShimmerRanges = require("./agent-shimmer-ranges");
|
|
10
|
+
var _pluginKey = require("./plugin-key");
|
|
10
11
|
// Statsig dynamic config: which BE-streaming `agentType` values may open Review Moment.
|
|
11
12
|
// Code default is `[]` (fail closed) until the list is set in Statsig.
|
|
12
13
|
var REVIEW_MOMENT_AGENT_TYPES_CONFIG = exports.REVIEW_MOMENT_AGENT_TYPES_CONFIG = 'platform_editor_backend_review_moment_agent_types';
|
|
@@ -99,6 +100,7 @@ var mapToBeforeDoc = function mapToBeforeDoc(steps, pos, stepIndex, bias) {
|
|
|
99
100
|
* @param view the editor view (for the collab rebase guard)
|
|
100
101
|
*/
|
|
101
102
|
var getAgentEditSegments = exports.getAgentEditSegments = function getAgentEditSegments(json, steps, tr, view) {
|
|
103
|
+
var _collabPluginState$ac;
|
|
102
104
|
// `agentType` present ⇒ agent-authored (per the NCS↔Editor steps contract). Read
|
|
103
105
|
// from the first agent step; it is identical across a batch.
|
|
104
106
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -118,6 +120,13 @@ var getAgentEditSegments = exports.getAgentEditSegments = function getAgentEditS
|
|
|
118
120
|
// The user the agent acted on behalf of (the requester). Optional/additive on the
|
|
119
121
|
// step contract, so it may be absent.
|
|
120
122
|
var actorUserId = typeof (agentStep === null || agentStep === void 0 ? void 0 : agentStep.userId) === 'string' ? agentStep.userId : undefined;
|
|
123
|
+
// Resolve the local user's AAID via the collab session: the plugin state knows this
|
|
124
|
+
// client's session id, and the participant list maps that to a `userId`. Both are
|
|
125
|
+
// optional, so an unresolvable identity degrades to `false` (see the contract).
|
|
126
|
+
var collabPluginState = _pluginKey.pluginKey.getState(view.state);
|
|
127
|
+
var localSessionId = collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.sessionId;
|
|
128
|
+
var localUserId = localSessionId ? collabPluginState === null || collabPluginState === void 0 || (_collabPluginState$ac = collabPluginState.activeParticipants) === null || _collabPluginState$ac === void 0 || (_collabPluginState$ac = _collabPluginState$ac.get(localSessionId)) === null || _collabPluginState$ac === void 0 ? void 0 : _collabPluginState$ac.userId : undefined;
|
|
129
|
+
var isLocalUserRequester = actorUserId !== undefined && localUserId !== undefined && actorUserId === localUserId;
|
|
121
130
|
// Which agent instance wrote the batch. Additive on the step contract like
|
|
122
131
|
// `userId`, so treat it as optional. Carried for contract clarity / future
|
|
123
132
|
// per-agent attribution; nothing consumes it yet.
|
|
@@ -280,6 +289,7 @@ var getAgentEditSegments = exports.getAgentEditSegments = function getAgentEditS
|
|
|
280
289
|
agentId: agentId,
|
|
281
290
|
agentType: agentType,
|
|
282
291
|
complete: complete,
|
|
292
|
+
isLocalUserRequester: isLocalUserRequester,
|
|
283
293
|
segments: segments
|
|
284
294
|
};
|
|
285
295
|
} catch (_unused3) {
|
|
@@ -17,7 +17,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
17
17
|
function groupBy(array, keyGetter) {
|
|
18
18
|
// Check group by exists, and that it's a function. If so, use the native browser code
|
|
19
19
|
if ('groupBy' in Object && typeof Object.groupBy === 'function') {
|
|
20
|
-
// @ts-ignore TS2322 - Type 'Partial<Record<string, T[]>>' is not assignable to type 'Record<string, T[]>'.
|
|
21
20
|
return Object.groupBy(array, keyGetter);
|
|
22
21
|
}
|
|
23
22
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { expVal } from '@atlaskit/platform-feature-experiments/exp-val';
|
|
2
2
|
import { getCollabState } from '@atlaskit/prosemirror-collab';
|
|
3
3
|
import { isPositionNeutralStep } from './agent-shimmer-ranges';
|
|
4
|
+
import { pluginKey } from './plugin-key';
|
|
4
5
|
|
|
5
6
|
// Statsig dynamic config: which BE-streaming `agentType` values may open Review Moment.
|
|
6
7
|
// Code default is `[]` (fail closed) until the list is set in Statsig.
|
|
@@ -88,6 +89,7 @@ const mapToBeforeDoc = (steps, pos, stepIndex, bias) => {
|
|
|
88
89
|
* @param view the editor view (for the collab rebase guard)
|
|
89
90
|
*/
|
|
90
91
|
export const getAgentEditSegments = (json, steps, tr, view) => {
|
|
92
|
+
var _collabPluginState$ac, _collabPluginState$ac2;
|
|
91
93
|
// `agentType` present ⇒ agent-authored (per the NCS↔Editor steps contract). Read
|
|
92
94
|
// from the first agent step; it is identical across a batch.
|
|
93
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -105,6 +107,13 @@ export const getAgentEditSegments = (json, steps, tr, view) => {
|
|
|
105
107
|
// The user the agent acted on behalf of (the requester). Optional/additive on the
|
|
106
108
|
// step contract, so it may be absent.
|
|
107
109
|
const actorUserId = typeof (agentStep === null || agentStep === void 0 ? void 0 : agentStep.userId) === 'string' ? agentStep.userId : undefined;
|
|
110
|
+
// Resolve the local user's AAID via the collab session: the plugin state knows this
|
|
111
|
+
// client's session id, and the participant list maps that to a `userId`. Both are
|
|
112
|
+
// optional, so an unresolvable identity degrades to `false` (see the contract).
|
|
113
|
+
const collabPluginState = pluginKey.getState(view.state);
|
|
114
|
+
const localSessionId = collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.sessionId;
|
|
115
|
+
const localUserId = localSessionId ? collabPluginState === null || collabPluginState === void 0 ? void 0 : (_collabPluginState$ac = collabPluginState.activeParticipants) === null || _collabPluginState$ac === void 0 ? void 0 : (_collabPluginState$ac2 = _collabPluginState$ac.get(localSessionId)) === null || _collabPluginState$ac2 === void 0 ? void 0 : _collabPluginState$ac2.userId : undefined;
|
|
116
|
+
const isLocalUserRequester = actorUserId !== undefined && localUserId !== undefined && actorUserId === localUserId;
|
|
108
117
|
// Which agent instance wrote the batch. Additive on the step contract like
|
|
109
118
|
// `userId`, so treat it as optional. Carried for contract clarity / future
|
|
110
119
|
// per-agent attribution; nothing consumes it yet.
|
|
@@ -261,6 +270,7 @@ export const getAgentEditSegments = (json, steps, tr, view) => {
|
|
|
261
270
|
agentId,
|
|
262
271
|
agentType,
|
|
263
272
|
complete,
|
|
273
|
+
isLocalUserRequester,
|
|
264
274
|
segments
|
|
265
275
|
};
|
|
266
276
|
} catch {
|
|
@@ -7,7 +7,6 @@ import { updateNcsSessionStepMetrics } from './track-step-metrics';
|
|
|
7
7
|
function groupBy(array, keyGetter) {
|
|
8
8
|
// Check group by exists, and that it's a function. If so, use the native browser code
|
|
9
9
|
if ('groupBy' in Object && typeof Object.groupBy === 'function') {
|
|
10
|
-
// @ts-ignore TS2322 - Type 'Partial<Record<string, T[]>>' is not assignable to type 'Record<string, T[]>'.
|
|
11
10
|
return Object.groupBy(array, keyGetter);
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { expVal } from '@atlaskit/platform-feature-experiments/exp-val';
|
|
2
2
|
import { getCollabState } from '@atlaskit/prosemirror-collab';
|
|
3
3
|
import { isPositionNeutralStep } from './agent-shimmer-ranges';
|
|
4
|
+
import { pluginKey } from './plugin-key';
|
|
4
5
|
|
|
5
6
|
// Statsig dynamic config: which BE-streaming `agentType` values may open Review Moment.
|
|
6
7
|
// Code default is `[]` (fail closed) until the list is set in Statsig.
|
|
@@ -94,6 +95,7 @@ var mapToBeforeDoc = function mapToBeforeDoc(steps, pos, stepIndex, bias) {
|
|
|
94
95
|
* @param view the editor view (for the collab rebase guard)
|
|
95
96
|
*/
|
|
96
97
|
export var getAgentEditSegments = function getAgentEditSegments(json, steps, tr, view) {
|
|
98
|
+
var _collabPluginState$ac;
|
|
97
99
|
// `agentType` present ⇒ agent-authored (per the NCS↔Editor steps contract). Read
|
|
98
100
|
// from the first agent step; it is identical across a batch.
|
|
99
101
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -113,6 +115,13 @@ export var getAgentEditSegments = function getAgentEditSegments(json, steps, tr,
|
|
|
113
115
|
// The user the agent acted on behalf of (the requester). Optional/additive on the
|
|
114
116
|
// step contract, so it may be absent.
|
|
115
117
|
var actorUserId = typeof (agentStep === null || agentStep === void 0 ? void 0 : agentStep.userId) === 'string' ? agentStep.userId : undefined;
|
|
118
|
+
// Resolve the local user's AAID via the collab session: the plugin state knows this
|
|
119
|
+
// client's session id, and the participant list maps that to a `userId`. Both are
|
|
120
|
+
// optional, so an unresolvable identity degrades to `false` (see the contract).
|
|
121
|
+
var collabPluginState = pluginKey.getState(view.state);
|
|
122
|
+
var localSessionId = collabPluginState === null || collabPluginState === void 0 ? void 0 : collabPluginState.sessionId;
|
|
123
|
+
var localUserId = localSessionId ? collabPluginState === null || collabPluginState === void 0 || (_collabPluginState$ac = collabPluginState.activeParticipants) === null || _collabPluginState$ac === void 0 || (_collabPluginState$ac = _collabPluginState$ac.get(localSessionId)) === null || _collabPluginState$ac === void 0 ? void 0 : _collabPluginState$ac.userId : undefined;
|
|
124
|
+
var isLocalUserRequester = actorUserId !== undefined && localUserId !== undefined && actorUserId === localUserId;
|
|
116
125
|
// Which agent instance wrote the batch. Additive on the step contract like
|
|
117
126
|
// `userId`, so treat it as optional. Carried for contract clarity / future
|
|
118
127
|
// per-agent attribution; nothing consumes it yet.
|
|
@@ -275,6 +284,7 @@ export var getAgentEditSegments = function getAgentEditSegments(json, steps, tr,
|
|
|
275
284
|
agentId: agentId,
|
|
276
285
|
agentType: agentType,
|
|
277
286
|
complete: complete,
|
|
287
|
+
isLocalUserRequester: isLocalUserRequester,
|
|
278
288
|
segments: segments
|
|
279
289
|
};
|
|
280
290
|
} catch (_unused3) {
|
|
@@ -11,7 +11,6 @@ import { updateNcsSessionStepMetrics } from './track-step-metrics';
|
|
|
11
11
|
function groupBy(array, keyGetter) {
|
|
12
12
|
// Check group by exists, and that it's a function. If so, use the native browser code
|
|
13
13
|
if ('groupBy' in Object && typeof Object.groupBy === 'function') {
|
|
14
|
-
// @ts-ignore TS2322 - Type 'Partial<Record<string, T[]>>' is not assignable to type 'Record<string, T[]>'.
|
|
15
14
|
return Object.groupBy(array, keyGetter);
|
|
16
15
|
}
|
|
17
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-collab-edit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.1",
|
|
4
4
|
"description": "Collab Edit plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -19,26 +19,26 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"atlaskit:src": "src/index.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@atlaskit/adf-schema": "^
|
|
22
|
+
"@atlaskit/adf-schema": "^57.0.0",
|
|
23
23
|
"@atlaskit/custom-steps": "^1.0.0",
|
|
24
|
-
"@atlaskit/editor-json-transformer": "^9.
|
|
25
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
26
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
27
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
28
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
24
|
+
"@atlaskit/editor-json-transformer": "^9.4.0",
|
|
25
|
+
"@atlaskit/editor-plugin-analytics": "^15.0.0",
|
|
26
|
+
"@atlaskit/editor-plugin-connectivity": "^15.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^17.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-feature-flags": "^14.0.0",
|
|
29
29
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
30
30
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
31
31
|
"@atlaskit/frontend-utilities": "^4.1.0",
|
|
32
32
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
33
33
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
34
34
|
"@atlaskit/prosemirror-collab": "^1.0.0",
|
|
35
|
-
"@atlaskit/tmp-editor-statsig": "^147.
|
|
35
|
+
"@atlaskit/tmp-editor-statsig": "^147.1.0",
|
|
36
36
|
"@atlaskit/tokens": "^16.7.0",
|
|
37
37
|
"@babel/runtime": "^7.0.0",
|
|
38
38
|
"memoize-one": "^6.0.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@atlaskit/editor-common": "^
|
|
41
|
+
"@atlaskit/editor-common": "^119.4.0",
|
|
42
42
|
"react": "^18.2.0 || ^19.2.0",
|
|
43
43
|
"react-dom": "^18.2.0 || ^19.2.0"
|
|
44
44
|
},
|