@atlaskit/collab-provider 28.1.0 → 28.2.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,30 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 28.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d2d4a126ef64e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2d4a126ef64e) -
8
+ Gate the periodic AI-provider presence re-broadcast behind platform_move_presence_agents, matching
9
+ the existing gating of the ai-provider:change send in Provider.sendMessage. When the gate is
10
+ enabled the presence heartbeat no longer re-announces editor AI plugin provider ids, which
11
+ previously registered a duplicate, agentType-less presence participant for an agent that was
12
+ already present under its AAID and caused it to render as the External agent fallback.
13
+ - Updated dependencies
14
+
15
+ ## 28.2.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`9461b21b24472`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9461b21b24472) -
20
+ Add the recovery:required provider event with a reason payload so Confluence can reset an NCS
21
+ document on request. NCS sends the event to the document's current socket. Rollout is controlled
22
+ by NCS emitting the event.
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 28.1.0
4
29
 
5
30
  ### Minor Changes
@@ -637,6 +637,9 @@ var Channel = exports.Channel = /*#__PURE__*/function (_Emitter) {
637
637
  this.socket.on('steps:added', function (data) {
638
638
  _this2.emit('steps:added', data);
639
639
  });
640
+ this.socket.on('recovery:required', function (data) {
641
+ _this2.emit('recovery:required', data);
642
+ });
640
643
  this.socket.on('participant:telepointer', function (_ref7) {
641
644
  var timestamp = _ref7.timestamp,
642
645
  data = _ref7.data;
@@ -820,8 +820,16 @@ var ParticipantsService = exports.ParticipantsService = /*#__PURE__*/function ()
820
820
  return _this.sendPresence();
821
821
  }, SEND_PRESENCE_INTERVAL);
822
822
 
823
- // Expose existing AI providers to the newly joined user
824
- _this.sendAIProvidersPresence();
823
+ // Expose existing AI providers to the newly joined user.
824
+ //
825
+ // Gated to match the `ai-provider:change` send in `Provider.sendMessage`. Under the new
826
+ // agent-presence path an agent is registered from its own authored steps, keyed on its
827
+ // AAID and carrying an `agentType`. These ids come from the editor AI plugin instead,
828
+ // keyed on the agent's Convo-AI id with no `agentType`, so re-broadcasting them adds a
829
+ // second, unresolvable participant for an agent that is already present.
830
+ if (!(0, _fg.fg)('platform_move_presence_agents')) {
831
+ _this.sendAIProvidersPresence();
832
+ }
825
833
  } catch (error) {
826
834
  var _this$analyticsHelper9;
827
835
  // We don't want to throw errors for Presence features as they tend to self-restore
@@ -194,7 +194,11 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
194
194
  }).on('restore', _this.documentService.onRestore).on('permission', function (permit) {
195
195
  _this.permit = Object.assign(_this.permit, permit);
196
196
  _this.emit('permission', permit);
197
- }).on('steps:added', _this.documentService.onStepsAdded).on('metadata:changed', _this.metadataService.onMetadataChanged).on('participant:telepointer', function (payload) {
197
+ }).on('steps:added', _this.documentService.onStepsAdded).on('recovery:required', function (payload) {
198
+ if (typeof (payload === null || payload === void 0 ? void 0 : payload.reason) === 'string') {
199
+ _this.emit('recovery:required', payload);
200
+ }
201
+ }).on('metadata:changed', _this.metadataService.onMetadataChanged).on('participant:telepointer', function (payload) {
198
202
  return _this.participantsService.onParticipantTelepointer(payload, _this.sessionId);
199
203
  }).on('presence:joined', _this.participantsService.onPresenceJoined).on('presence', _this.participantsService.onPresence).on('participant:left', _this.participantsService.onParticipantLeft).on('participant:updated', _this.participantsService.onParticipantUpdated).on('disconnect', _this.onDisconnected.bind(_this)).on('error', _this.onErrorHandled).on('status', /*#__PURE__*/function () {
200
204
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(status) {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/collab-provider";
8
- var version = exports.version = "28.0.0";
8
+ var version = exports.version = "28.2.0";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -459,6 +459,9 @@ export class Channel extends Emitter {
459
459
  this.socket.on('steps:added', data => {
460
460
  this.emit('steps:added', data);
461
461
  });
462
+ this.socket.on('recovery:required', data => {
463
+ this.emit('recovery:required', data);
464
+ });
462
465
  this.socket.on('participant:telepointer', ({
463
466
  timestamp,
464
467
  data
@@ -659,8 +659,16 @@ export class ParticipantsService {
659
659
  this.channelBroadcast('participant:updated', data);
660
660
  this.presenceUpdateTimeout = window.setTimeout(() => this.sendPresence(), SEND_PRESENCE_INTERVAL);
661
661
 
662
- // Expose existing AI providers to the newly joined user
663
- this.sendAIProvidersPresence();
662
+ // Expose existing AI providers to the newly joined user.
663
+ //
664
+ // Gated to match the `ai-provider:change` send in `Provider.sendMessage`. Under the new
665
+ // agent-presence path an agent is registered from its own authored steps, keyed on its
666
+ // AAID and carrying an `agentType`. These ids come from the editor AI plugin instead,
667
+ // keyed on the agent's Convo-AI id with no `agentType`, so re-broadcasting them adds a
668
+ // second, unresolvable participant for an agent that is already present.
669
+ if (!fg('platform_move_presence_agents')) {
670
+ this.sendAIProvidersPresence();
671
+ }
664
672
  } catch (error) {
665
673
  var _this$analyticsHelper9;
666
674
  // We don't want to throw errors for Presence features as they tend to self-restore
@@ -175,7 +175,11 @@ export class Provider extends Emitter {
175
175
  }).on('restore', this.documentService.onRestore).on('permission', permit => {
176
176
  this.permit = Object.assign(this.permit, permit);
177
177
  this.emit('permission', permit);
178
- }).on('steps:added', this.documentService.onStepsAdded).on('metadata:changed', this.metadataService.onMetadataChanged).on('participant:telepointer', payload => this.participantsService.onParticipantTelepointer(payload, this.sessionId)).on('presence:joined', this.participantsService.onPresenceJoined).on('presence', this.participantsService.onPresence).on('participant:left', this.participantsService.onParticipantLeft).on('participant:updated', this.participantsService.onParticipantUpdated).on('disconnect', this.onDisconnected.bind(this)).on('error', this.onErrorHandled).on('status', async status => {
178
+ }).on('steps:added', this.documentService.onStepsAdded).on('recovery:required', payload => {
179
+ if (typeof (payload === null || payload === void 0 ? void 0 : payload.reason) === 'string') {
180
+ this.emit('recovery:required', payload);
181
+ }
182
+ }).on('metadata:changed', this.metadataService.onMetadataChanged).on('participant:telepointer', payload => this.participantsService.onParticipantTelepointer(payload, this.sessionId)).on('presence:joined', this.participantsService.onPresenceJoined).on('presence', this.participantsService.onPresence).on('participant:left', this.participantsService.onParticipantLeft).on('participant:updated', this.participantsService.onParticipantUpdated).on('disconnect', this.onDisconnected.bind(this)).on('error', this.onErrorHandled).on('status', async status => {
179
183
  await this.namespaceService.onNamespaceStatusChanged(status);
180
184
  const isLocked = this.namespaceService.getIsNamespaceLocked();
181
185
  this.emit('namespace-lock:check', {
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "28.0.0";
2
+ export const version = "28.2.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -630,6 +630,9 @@ export var Channel = /*#__PURE__*/function (_Emitter) {
630
630
  this.socket.on('steps:added', function (data) {
631
631
  _this2.emit('steps:added', data);
632
632
  });
633
+ this.socket.on('recovery:required', function (data) {
634
+ _this2.emit('recovery:required', data);
635
+ });
633
636
  this.socket.on('participant:telepointer', function (_ref7) {
634
637
  var timestamp = _ref7.timestamp,
635
638
  data = _ref7.data;
@@ -813,8 +813,16 @@ export var ParticipantsService = /*#__PURE__*/function () {
813
813
  return _this.sendPresence();
814
814
  }, SEND_PRESENCE_INTERVAL);
815
815
 
816
- // Expose existing AI providers to the newly joined user
817
- _this.sendAIProvidersPresence();
816
+ // Expose existing AI providers to the newly joined user.
817
+ //
818
+ // Gated to match the `ai-provider:change` send in `Provider.sendMessage`. Under the new
819
+ // agent-presence path an agent is registered from its own authored steps, keyed on its
820
+ // AAID and carrying an `agentType`. These ids come from the editor AI plugin instead,
821
+ // keyed on the agent's Convo-AI id with no `agentType`, so re-broadcasting them adds a
822
+ // second, unresolvable participant for an agent that is already present.
823
+ if (!fg('platform_move_presence_agents')) {
824
+ _this.sendAIProvidersPresence();
825
+ }
818
826
  } catch (error) {
819
827
  var _this$analyticsHelper9;
820
828
  // We don't want to throw errors for Presence features as they tend to self-restore
@@ -188,7 +188,11 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
188
188
  }).on('restore', _this.documentService.onRestore).on('permission', function (permit) {
189
189
  _this.permit = Object.assign(_this.permit, permit);
190
190
  _this.emit('permission', permit);
191
- }).on('steps:added', _this.documentService.onStepsAdded).on('metadata:changed', _this.metadataService.onMetadataChanged).on('participant:telepointer', function (payload) {
191
+ }).on('steps:added', _this.documentService.onStepsAdded).on('recovery:required', function (payload) {
192
+ if (typeof (payload === null || payload === void 0 ? void 0 : payload.reason) === 'string') {
193
+ _this.emit('recovery:required', payload);
194
+ }
195
+ }).on('metadata:changed', _this.metadataService.onMetadataChanged).on('participant:telepointer', function (payload) {
192
196
  return _this.participantsService.onParticipantTelepointer(payload, _this.sessionId);
193
197
  }).on('presence:joined', _this.participantsService.onPresenceJoined).on('presence', _this.participantsService.onPresence).on('participant:left', _this.participantsService.onParticipantLeft).on('participant:updated', _this.participantsService.onParticipantUpdated).on('disconnect', _this.onDisconnected.bind(_this)).on('error', _this.onErrorHandled).on('status', /*#__PURE__*/function () {
194
198
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(status) {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "28.0.0";
2
+ export var version = "28.2.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -5,7 +5,7 @@ import type { InternalError } from './errors/internal-errors';
5
5
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer/types';
6
6
  import type { BatchProps, GetUserType } from './participants/participants-helper';
7
7
  import type AnalyticsHelper from './analytics/analytics-helper';
8
- import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, PresenceActivity } from '@atlaskit/editor-common/collab';
8
+ import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, PresenceActivity, CollabRecoveryRequiredPayload } from '@atlaskit/editor-common/collab';
9
9
  import type { CatchupEventReason } from './helpers/const';
10
10
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
11
11
  export interface CollabEventDisconnectedData {
@@ -244,6 +244,7 @@ export type ChannelEvent = {
244
244
  presence: PresencePayload;
245
245
  'presence:joined': PresencePayload;
246
246
  reconnected: null;
247
+ 'recovery:required': CollabRecoveryRequiredPayload;
247
248
  restore: InitPayload;
248
249
  status: NamespaceStatus;
249
250
  'steps:added': StepsPayload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "28.1.0",
3
+ "version": "28.2.1",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -75,6 +75,6 @@
75
75
  }
76
76
  },
77
77
  "peerDependencies": {
78
- "@atlaskit/editor-common": "^123.0.0"
78
+ "@atlaskit/editor-common": "^123.1.0"
79
79
  }
80
80
  }