@atlaskit/editor-plugin-collab-edit 17.0.3 → 17.0.5

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
+ ## 17.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3059547e2a266`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3059547e2a266) -
8
+ [ux] Extract the configurable post-apply AI highlight and telepointer into a shared plugin and
9
+ trigger it for collab-edit backend updates behind the
10
+ `platform_editor_ai_unified_post_apply_chrome` experiment. Connected top-level blocks share one
11
+ telepointer, separated groups receive their own, and consumers can supply an optional agent avatar
12
+ identity. Producers resolve dynamic configuration and presentation before sending chrome metadata,
13
+ and each Rovo frontend update starts with a fresh Post Stream Review range set.
14
+ - Updated dependencies
15
+
16
+ ## 17.0.4
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 17.0.3
4
23
 
5
24
  ### Patch Changes
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.registerAllCustomSteps = exports.handleTelePointer = exports.handlePresence = exports.handleInit = exports.handleConnection = exports.getSendableSelection = exports.applyRemoteSteps = exports.applyRemoteData = void 0;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
10
  var allAdfSchemaSteps = _interopRequireWildcard(require("@atlaskit/adf-schema/steps"));
9
11
  var allAtlaskitCustomSteps = _interopRequireWildcard(require("@atlaskit/custom-steps"));
12
+ var _collabAgentEditChrome = require("@atlaskit/editor-common/collab-agent-edit-chrome");
10
13
  var _collabAgentRemoteEditReview = require("@atlaskit/editor-common/collab-agent-remote-edit-review");
11
14
  var _state = require("@atlaskit/editor-prosemirror/state");
12
15
  var _transformOverride = require("@atlaskit/editor-prosemirror/transform-override");
16
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
13
17
  var _fg = require("@atlaskit/platform-feature-flags/fg");
14
18
  var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
15
19
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
@@ -21,12 +25,11 @@ var _agentEditRequester = require("./main/agent-edit-requester");
21
25
  var _agentShimmerRanges = require("./main/agent-shimmer-ranges");
22
26
  var _utils = require("./utils");
23
27
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
- // Ignored via go/ees005
28
+ 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; }
29
+ 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; } // Ignored via go/ees005
25
30
  // eslint-disable-next-line import/no-namespace
26
-
27
31
  // Ignored via go/ees005
28
32
  // eslint-disable-next-line import/no-namespace
29
-
30
33
  /*
31
34
  * This is a non-op function to force ProseMirror to load and register all custom steps in the same bundle
32
35
  */
@@ -97,7 +100,24 @@ var applyRemoteSteps = exports.applyRemoteSteps = function applyRemoteSteps(json
97
100
  var shimmerDurationMs = 0;
98
101
  var highlightDurationMs = 0;
99
102
  var agentShimmers = [];
100
- if ((0, _expValEquals.expValEquals)('platform_editor_agent_be_streaming', 'isEnabled', true)) {
103
+ var isUnifiedPostApplyChromeEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_ai_unified_post_apply_chrome');
104
+ if (isUnifiedPostApplyChromeEnabled && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_agent_be_streaming')) {
105
+ var ranges = (0, _agentShimmerRanges.getAgentEditChromeRanges)(json, steps, tr, view, function (reason, agentType, error) {
106
+ return editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.getAgentEditShimmerNotShownPayload)(reason, agentType, error))(tr);
107
+ });
108
+ var requester = (0, _agentEditRequester.getAgentEditRequester)(json, view);
109
+ if (ranges.length && requester) {
110
+ // Collab supplies a machine agent type, not a display name; preserve the legacy
111
+ // uppercase telepointer label.
112
+ var telepointerLabel = requester.agentType.trim().toUpperCase();
113
+ tr.setMeta(_collabAgentEditChrome.AGENT_EDIT_CHROME_DATA, _objectSpread(_objectSpread(_objectSpread({}, (0, _collabAgentEditChrome.getAgentEditChromeDynamicConfig)()), telepointerLabel ? {
114
+ telepointerLabel: telepointerLabel
115
+ } : {}), {}, {
116
+ ranges: ranges
117
+ }));
118
+ }
119
+ }
120
+ if (!isUnifiedPostApplyChromeEnabled && (0, _expValEquals.expValEquals)('platform_editor_agent_be_streaming', 'isEnabled', true)) {
101
121
  // The skeleton and purple-highlight phases toggle independently. `shimmerDurationMs` is the
102
122
  // skeleton lifetime; `0` skips the skeleton (an edit can still get the purple highlight).
103
123
  shimmerDurationMs = (0, _expVal.expVal)('platform_editor_agent_be_streaming', 'shimmerDurationMs', _agentShimmerDecorations.AGENT_SHIMMER_DEFAULT_DURATION_MS);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isPositionNeutralStep = exports.getMarkStepRange = exports.getAgentShimmerRanges = void 0;
6
+ exports.isPositionNeutralStep = exports.getMarkStepRange = exports.getAgentShimmerRanges = exports.getAgentEditChromeRanges = void 0;
7
7
  var _collabAgentReviewSliceCompare = require("@atlaskit/editor-common/collab-agent-review-slice-compare");
8
8
  var _monitoring = require("@atlaskit/editor-common/monitoring");
9
9
  var _transform = require("@atlaskit/editor-prosemirror/transform");
@@ -80,11 +80,8 @@ var topLevelBlockContentEnd = function topLevelBlockContentEnd(doc, pos) {
80
80
  * rebased local step changed sizes (a rare, safe degrade). Any unexpected error also degrades to no
81
81
  * shimmer, so this never throws into the shared remote-step handler.
82
82
  */
83
- var getAgentShimmerRanges = exports.getAgentShimmerRanges = function getAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) {
83
+ var deriveAgentShimmerRanges = function deriveAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) {
84
84
  var _json$find;
85
- if (!(0, _expValEquals.expValEquals)('platform_editor_agent_be_streaming', 'isEnabled', true)) {
86
- return [];
87
- }
88
85
  // The two phases toggle independently: `shimmerDurationMs` sizes the skeleton, `highlightDurationMs`
89
86
  // sizes the purple highlight, and `0` on either skips just that phase. Nothing to reveal only when
90
87
  // both are off.
@@ -251,4 +248,28 @@ var getAgentShimmerRanges = exports.getAgentShimmerRanges = function getAgentShi
251
248
  onNotShown === null || onNotShown === void 0 || onNotShown('captureThrew', agentType, err);
252
249
  return [];
253
250
  }
251
+ };
252
+ var getAgentShimmerRanges = exports.getAgentShimmerRanges = function getAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) {
253
+ if (!(0, _expValEquals.expValEquals)('platform_editor_agent_be_streaming', 'isEnabled', true)) {
254
+ return [];
255
+ }
256
+ return deriveAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown);
257
+ };
258
+
259
+ /**
260
+ * Produces only the neutral changed ranges needed by the shared AI chrome.
261
+ * The caller supplies lifetime configuration and any presentation override separately,
262
+ * together with these ranges, in `AgentEditChromeData`.
263
+ */
264
+ var getAgentEditChromeRanges = exports.getAgentEditChromeRanges = function getAgentEditChromeRanges(json, steps, tr, view, onNotShown) {
265
+ // Reuse legacy range derivation with skeleton and telepointer output disabled. A non-zero
266
+ // highlight duration keeps capture enabled; the returned legacy phase and duration are discarded.
267
+ return deriveAgentShimmerRanges(json, steps, tr, view, 0, 1, false, onNotShown).map(function (_ref) {
268
+ var from = _ref.from,
269
+ to = _ref.to;
270
+ return {
271
+ from: from,
272
+ to: to
273
+ };
274
+ });
254
275
  };
@@ -4,9 +4,11 @@ import * as allAdfSchemaSteps from '@atlaskit/adf-schema/steps';
4
4
  // Ignored via go/ees005
5
5
  // eslint-disable-next-line import/no-namespace
6
6
  import * as allAtlaskitCustomSteps from '@atlaskit/custom-steps';
7
+ import { AGENT_EDIT_CHROME_DATA, getAgentEditChromeDynamicConfig } from '@atlaskit/editor-common/collab-agent-edit-chrome';
7
8
  import { AGENT_REMOTE_EDIT_REVIEW_DATA } from '@atlaskit/editor-common/collab-agent-remote-edit-review';
8
9
  import { AllSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
9
10
  import { Step } from '@atlaskit/editor-prosemirror/transform-override';
11
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
10
12
  import { fg } from '@atlaskit/platform-feature-flags/fg';
11
13
  import { receiveTransaction } from '@atlaskit/prosemirror-collab';
12
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -15,7 +17,7 @@ import { getAgentEditShimmerNotShownPayload } from './analytics';
15
17
  import { getAgentEditSegments } from './main/agent-review-segments';
16
18
  import { ADD_AGENT_SHIMMER_META, AGENT_EDIT_HIGHLIGHT_DEFAULT_DURATION_MS, AGENT_SHIMMER_DEFAULT_DURATION_MS, HIGHLIGHT_AGENT_SHIMMER_META, REMOVE_AGENT_SHIMMER_META } from './main/agent-shimmer-decorations';
17
19
  import { getAgentEditRequester } from './main/agent-edit-requester';
18
- import { getAgentShimmerRanges } from './main/agent-shimmer-ranges';
20
+ import { getAgentEditChromeRanges, getAgentShimmerRanges } from './main/agent-shimmer-ranges';
19
21
  import { replaceDocument } from './utils';
20
22
 
21
23
  /*
@@ -101,7 +103,24 @@ export const applyRemoteSteps = (json, view, userIds, options, editorAnalyticsAp
101
103
  let shimmerDurationMs = 0;
102
104
  let highlightDurationMs = 0;
103
105
  let agentShimmers = [];
104
- if (expValEquals('platform_editor_agent_be_streaming', 'isEnabled', true)) {
106
+ const isUnifiedPostApplyChromeEnabled = isExperimentEnabled('platform_editor_ai_unified_post_apply_chrome');
107
+ if (isUnifiedPostApplyChromeEnabled && isExperimentEnabled('platform_editor_agent_be_streaming')) {
108
+ const ranges = getAgentEditChromeRanges(json, steps, tr, view, (reason, agentType, error) => editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(getAgentEditShimmerNotShownPayload(reason, agentType, error))(tr));
109
+ const requester = getAgentEditRequester(json, view);
110
+ if (ranges.length && requester) {
111
+ // Collab supplies a machine agent type, not a display name; preserve the legacy
112
+ // uppercase telepointer label.
113
+ const telepointerLabel = requester.agentType.trim().toUpperCase();
114
+ tr.setMeta(AGENT_EDIT_CHROME_DATA, {
115
+ ...getAgentEditChromeDynamicConfig(),
116
+ ...(telepointerLabel ? {
117
+ telepointerLabel
118
+ } : {}),
119
+ ranges
120
+ });
121
+ }
122
+ }
123
+ if (!isUnifiedPostApplyChromeEnabled && expValEquals('platform_editor_agent_be_streaming', 'isEnabled', true)) {
105
124
  // The skeleton and purple-highlight phases toggle independently. `shimmerDurationMs` is the
106
125
  // skeleton lifetime; `0` skips the skeleton (an edit can still get the purple highlight).
107
126
  shimmerDurationMs = expVal('platform_editor_agent_be_streaming', 'shimmerDurationMs', AGENT_SHIMMER_DEFAULT_DURATION_MS);
@@ -70,11 +70,8 @@ const topLevelBlockContentEnd = (doc, pos) => {
70
70
  * rebased local step changed sizes (a rare, safe degrade). Any unexpected error also degrades to no
71
71
  * shimmer, so this never throws into the shared remote-step handler.
72
72
  */
73
- export const getAgentShimmerRanges = (json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) => {
73
+ const deriveAgentShimmerRanges = (json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) => {
74
74
  var _json$find;
75
- if (!expValEquals('platform_editor_agent_be_streaming', 'isEnabled', true)) {
76
- return [];
77
- }
78
75
  // The two phases toggle independently: `shimmerDurationMs` sizes the skeleton, `highlightDurationMs`
79
76
  // sizes the purple highlight, and `0` on either skips just that phase. Nothing to reveal only when
80
77
  // both are off.
@@ -233,4 +230,27 @@ export const getAgentShimmerRanges = (json, steps, tr, view, shimmerDurationMs,
233
230
  onNotShown === null || onNotShown === void 0 ? void 0 : onNotShown('captureThrew', agentType, err);
234
231
  return [];
235
232
  }
233
+ };
234
+ export const getAgentShimmerRanges = (json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) => {
235
+ if (!expValEquals('platform_editor_agent_be_streaming', 'isEnabled', true)) {
236
+ return [];
237
+ }
238
+ return deriveAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown);
239
+ };
240
+
241
+ /**
242
+ * Produces only the neutral changed ranges needed by the shared AI chrome.
243
+ * The caller supplies lifetime configuration and any presentation override separately,
244
+ * together with these ranges, in `AgentEditChromeData`.
245
+ */
246
+ export const getAgentEditChromeRanges = (json, steps, tr, view, onNotShown) => {
247
+ // Reuse legacy range derivation with skeleton and telepointer output disabled. A non-zero
248
+ // highlight duration keeps capture enabled; the returned legacy phase and duration are discarded.
249
+ return deriveAgentShimmerRanges(json, steps, tr, view, 0, 1, false, onNotShown).map(({
250
+ from,
251
+ to
252
+ }) => ({
253
+ from,
254
+ to
255
+ }));
236
256
  };
@@ -1,12 +1,17 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
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
+ 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; }
1
4
  // Ignored via go/ees005
2
5
  // eslint-disable-next-line import/no-namespace
3
6
  import * as allAdfSchemaSteps from '@atlaskit/adf-schema/steps';
4
7
  // Ignored via go/ees005
5
8
  // eslint-disable-next-line import/no-namespace
6
9
  import * as allAtlaskitCustomSteps from '@atlaskit/custom-steps';
10
+ import { AGENT_EDIT_CHROME_DATA, getAgentEditChromeDynamicConfig } from '@atlaskit/editor-common/collab-agent-edit-chrome';
7
11
  import { AGENT_REMOTE_EDIT_REVIEW_DATA } from '@atlaskit/editor-common/collab-agent-remote-edit-review';
8
12
  import { AllSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
9
13
  import { Step } from '@atlaskit/editor-prosemirror/transform-override';
14
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
10
15
  import { fg } from '@atlaskit/platform-feature-flags/fg';
11
16
  import { receiveTransaction } from '@atlaskit/prosemirror-collab';
12
17
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -15,7 +20,7 @@ import { getAgentEditShimmerNotShownPayload } from './analytics';
15
20
  import { getAgentEditSegments } from './main/agent-review-segments';
16
21
  import { ADD_AGENT_SHIMMER_META, AGENT_EDIT_HIGHLIGHT_DEFAULT_DURATION_MS, AGENT_SHIMMER_DEFAULT_DURATION_MS, HIGHLIGHT_AGENT_SHIMMER_META, REMOVE_AGENT_SHIMMER_META } from './main/agent-shimmer-decorations';
17
22
  import { getAgentEditRequester } from './main/agent-edit-requester';
18
- import { getAgentShimmerRanges } from './main/agent-shimmer-ranges';
23
+ import { getAgentEditChromeRanges, getAgentShimmerRanges } from './main/agent-shimmer-ranges';
19
24
  import { replaceDocument } from './utils';
20
25
 
21
26
  /*
@@ -88,7 +93,24 @@ export var applyRemoteSteps = function applyRemoteSteps(json, view, userIds, opt
88
93
  var shimmerDurationMs = 0;
89
94
  var highlightDurationMs = 0;
90
95
  var agentShimmers = [];
91
- if (expValEquals('platform_editor_agent_be_streaming', 'isEnabled', true)) {
96
+ var isUnifiedPostApplyChromeEnabled = isExperimentEnabled('platform_editor_ai_unified_post_apply_chrome');
97
+ if (isUnifiedPostApplyChromeEnabled && isExperimentEnabled('platform_editor_agent_be_streaming')) {
98
+ var ranges = getAgentEditChromeRanges(json, steps, tr, view, function (reason, agentType, error) {
99
+ return editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(getAgentEditShimmerNotShownPayload(reason, agentType, error))(tr);
100
+ });
101
+ var requester = getAgentEditRequester(json, view);
102
+ if (ranges.length && requester) {
103
+ // Collab supplies a machine agent type, not a display name; preserve the legacy
104
+ // uppercase telepointer label.
105
+ var telepointerLabel = requester.agentType.trim().toUpperCase();
106
+ tr.setMeta(AGENT_EDIT_CHROME_DATA, _objectSpread(_objectSpread(_objectSpread({}, getAgentEditChromeDynamicConfig()), telepointerLabel ? {
107
+ telepointerLabel: telepointerLabel
108
+ } : {}), {}, {
109
+ ranges: ranges
110
+ }));
111
+ }
112
+ }
113
+ if (!isUnifiedPostApplyChromeEnabled && expValEquals('platform_editor_agent_be_streaming', 'isEnabled', true)) {
92
114
  // The skeleton and purple-highlight phases toggle independently. `shimmerDurationMs` is the
93
115
  // skeleton lifetime; `0` skips the skeleton (an edit can still get the purple highlight).
94
116
  shimmerDurationMs = expVal('platform_editor_agent_be_streaming', 'shimmerDurationMs', AGENT_SHIMMER_DEFAULT_DURATION_MS);
@@ -74,11 +74,8 @@ var topLevelBlockContentEnd = function topLevelBlockContentEnd(doc, pos) {
74
74
  * rebased local step changed sizes (a rare, safe degrade). Any unexpected error also degrades to no
75
75
  * shimmer, so this never throws into the shared remote-step handler.
76
76
  */
77
- export var getAgentShimmerRanges = function getAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) {
77
+ var deriveAgentShimmerRanges = function deriveAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) {
78
78
  var _json$find;
79
- if (!expValEquals('platform_editor_agent_be_streaming', 'isEnabled', true)) {
80
- return [];
81
- }
82
79
  // The two phases toggle independently: `shimmerDurationMs` sizes the skeleton, `highlightDurationMs`
83
80
  // sizes the purple highlight, and `0` on either skips just that phase. Nothing to reveal only when
84
81
  // both are off.
@@ -245,4 +242,28 @@ export var getAgentShimmerRanges = function getAgentShimmerRanges(json, steps, t
245
242
  onNotShown === null || onNotShown === void 0 || onNotShown('captureThrew', agentType, err);
246
243
  return [];
247
244
  }
245
+ };
246
+ export var getAgentShimmerRanges = function getAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown) {
247
+ if (!expValEquals('platform_editor_agent_be_streaming', 'isEnabled', true)) {
248
+ return [];
249
+ }
250
+ return deriveAgentShimmerRanges(json, steps, tr, view, shimmerDurationMs, highlightDurationMs, telepointerEnabled, onNotShown);
251
+ };
252
+
253
+ /**
254
+ * Produces only the neutral changed ranges needed by the shared AI chrome.
255
+ * The caller supplies lifetime configuration and any presentation override separately,
256
+ * together with these ranges, in `AgentEditChromeData`.
257
+ */
258
+ export var getAgentEditChromeRanges = function getAgentEditChromeRanges(json, steps, tr, view, onNotShown) {
259
+ // Reuse legacy range derivation with skeleton and telepointer output disabled. A non-zero
260
+ // highlight duration keeps capture enabled; the returned legacy phase and duration are discarded.
261
+ return deriveAgentShimmerRanges(json, steps, tr, view, 0, 1, false, onNotShown).map(function (_ref) {
262
+ var from = _ref.from,
263
+ to = _ref.to;
264
+ return {
265
+ from: from,
266
+ to: to
267
+ };
268
+ });
248
269
  };
@@ -1,4 +1,5 @@
1
1
  import type { AgentEditShimmerNotShownReason } from '@atlaskit/editor-common/analytics/types/agent-edit-shimmer-events';
2
+ import type { AgentEditChromeRange } from '@atlaskit/editor-common/collab-agent-edit-chrome';
2
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
4
  import type { Step } from '@atlaskit/editor-prosemirror/transform-override';
4
5
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
@@ -8,20 +9,10 @@ export declare const getMarkStepRange: (step: Step) => {
8
9
  from: number;
9
10
  to: number;
10
11
  } | null;
12
+ export declare const getAgentShimmerRanges: (json: any[], steps: Step[], tr: Transaction, view: EditorView, shimmerDurationMs: number, highlightDurationMs: number, telepointerEnabled: boolean, onNotShown?: (reason: AgentEditShimmerNotShownReason, agentType?: string, error?: Error) => void) => AgentShimmerRange[];
11
13
  /**
12
- * Derive the shimmer ranges for the agent-authored steps in a received batch, in final-doc
13
- * coordinates. `agentType` present agent-authored (per the NCS↔Editor steps contract). Each
14
- * emitted range is expanded to the whole top-level block(s) the agent touched, which the plugin
15
- * covers with the skeleton shimmer. Ranges with no new content (pure deletions) are dropped.
16
- *
17
- * Steps whose new content is in the same or directly-adjacent top-level block are coalesced into one
18
- * range, so an edit that arrives as several steps in a region shimmers as a single unit. Edits
19
- * separated by an untouched block stay independent.
20
- *
21
- * Correctness: the range math assumes `tr` is a linear 1:1 apply of `steps`. Under the native collab
22
- * plugin, `receiveTransaction` rebases incoming steps over unconfirmed local steps when they exist;
23
- * that only invalidates our positions if a local step shifted positions, so we skip solely when a
24
- * rebased local step changed sizes (a rare, safe degrade). Any unexpected error also degrades to no
25
- * shimmer, so this never throws into the shared remote-step handler.
14
+ * Produces only the neutral changed ranges needed by the shared AI chrome.
15
+ * The caller supplies lifetime configuration and any presentation override separately,
16
+ * together with these ranges, in `AgentEditChromeData`.
26
17
  */
27
- export declare const getAgentShimmerRanges: (json: any[], steps: Step[], tr: Transaction, view: EditorView, shimmerDurationMs: number, highlightDurationMs: number, telepointerEnabled: boolean, onNotShown?: (reason: AgentEditShimmerNotShownReason, agentType?: string, error?: Error) => void) => AgentShimmerRange[];
18
+ export declare const getAgentEditChromeRanges: (json: any[], steps: Step[], tr: Transaction, view: EditorView, onNotShown?: (reason: AgentEditShimmerNotShownReason, agentType?: string, error?: Error) => void) => AgentEditChromeRange[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "17.0.3",
3
+ "version": "17.0.5",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@atlaskit/adf-schema": "^57.2.0",
23
23
  "@atlaskit/custom-steps": "^1.0.0",
24
- "@atlaskit/editor-json-transformer": "^9.6.0",
24
+ "@atlaskit/editor-json-transformer": "^9.7.0",
25
25
  "@atlaskit/editor-plugin-analytics": "^16.0.0",
26
26
  "@atlaskit/editor-plugin-connectivity": "^16.0.0",
27
27
  "@atlaskit/editor-plugin-editor-viewmode": "^18.0.0",
@@ -32,13 +32,13 @@
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": "^163.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^164.1.0",
36
36
  "@atlaskit/tokens": "^16.8.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "memoize-one": "^6.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@atlaskit/editor-common": "^120.3.0",
41
+ "@atlaskit/editor-common": "^120.6.0",
42
42
  "react": "^18.2.0 || ^19.2.0",
43
43
  "react-dom": "^18.2.0 || ^19.2.0"
44
44
  },