@atlaskit/collab-provider 10.1.2 → 10.2.0

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,22 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 10.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#169676](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169676)
8
+ [`141d88bf511d4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/141d88bf511d4) -
9
+ [ux] EDF-2302 Facepile bug fixes - rehydration, avatar update + analytics
10
+
11
+ ## 10.1.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#165765](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165765)
16
+ [`3f441f30e6507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f441f30e6507) -
17
+ Bump adf-schema to 46.0.0
18
+ - Updated dependencies
19
+
3
20
  ## 10.1.2
4
21
 
5
22
  ### Patch Changes
@@ -41,6 +41,7 @@ var ParticipantsService = exports.ParticipantsService = /*#__PURE__*/function ()
41
41
  var sendPresenceJoined = arguments.length > 5 ? arguments[5] : undefined;
42
42
  var getPresenceData = arguments.length > 6 ? arguments[6] : undefined;
43
43
  var setUserId = arguments.length > 7 ? arguments[7] : undefined;
44
+ var getAIProviderActiveIds = arguments.length > 8 ? arguments[8] : undefined;
44
45
  (0, _classCallCheck2.default)(this, ParticipantsService);
45
46
  (0, _defineProperty2.default)(this, "sendAIProviderChanged", function (payload) {
46
47
  var isFacepileExperimentEnabled = _featureGateJsClient.default.getExperimentValue('platform_editor_ai_facepile', 'isEnabled', false);
@@ -50,20 +51,44 @@ var ParticipantsService = exports.ParticipantsService = /*#__PURE__*/function ()
50
51
  payload.permit[propKey] = false;
51
52
  }
52
53
  }
53
- var presencePayload = {
54
- sessionId: "".concat(payload.providerId, "::").concat(payload.sessionId),
55
- userId: payload.providerId,
56
- clientId: "".concat(payload.providerId, "::").concat(payload.clientId),
57
- permit: payload.permit,
58
- timestamp: Date.now()
59
- };
54
+ var presencePayload = _this.buildAIProviderPresencePayload(payload.providerId);
60
55
  if (payload.action === 'add') {
61
- _this.channelBroadcast('participant:updated', presencePayload);
56
+ _this.sendAIProviderParticipantUpdated(presencePayload);
62
57
  } else if (payload.action === 'remove') {
63
- _this.channelBroadcast('participant:left', presencePayload);
58
+ _this.sendAIProviderParticipantLeft(presencePayload);
64
59
  }
65
60
  }
66
61
  });
62
+ (0, _defineProperty2.default)(this, "buildAIProviderPresencePayload", function (providerId) {
63
+ var defaultPresenceData = _this.getPresenceData();
64
+ var presencePayload = {
65
+ sessionId: "".concat(providerId, "::").concat(defaultPresenceData.sessionId),
66
+ userId: providerId,
67
+ clientId: "".concat(providerId, "::").concat(defaultPresenceData.clientId),
68
+ permit: {
69
+ isPermittedToComment: false,
70
+ isPermittedToEdit: false,
71
+ isPermittedToView: false
72
+ },
73
+ timestamp: Date.now()
74
+ };
75
+ return presencePayload;
76
+ });
77
+ (0, _defineProperty2.default)(this, "sendAIProviderParticipantUpdated", function (payload) {
78
+ _this.channelBroadcast('participant:updated', payload);
79
+ });
80
+ (0, _defineProperty2.default)(this, "sendAIProviderParticipantLeft", function (payload) {
81
+ _this.channelBroadcast('participant:left', payload);
82
+ });
83
+ // Refresh current AI providers
84
+ (0, _defineProperty2.default)(this, "sendAIProvidersPresence", function () {
85
+ if (_this.getAIProviderActiveIds) {
86
+ _this.getAIProviderActiveIds().forEach(function (aiProviderId) {
87
+ var presenceData = _this.buildAIProviderPresencePayload(aiProviderId);
88
+ _this.sendAIProviderParticipantUpdated(presenceData);
89
+ });
90
+ }
91
+ });
67
92
  /**
68
93
  * Carries out 3 things: 1) enriches the participant with user data, 2) updates the participantsState, 3) emits the presence event
69
94
  * @param payload Payload from incoming socket event
@@ -290,6 +315,9 @@ var ParticipantsService = exports.ParticipantsService = /*#__PURE__*/function ()
290
315
  _this.presenceUpdateTimeout = window.setTimeout(function () {
291
316
  return _this.sendPresence();
292
317
  }, SEND_PRESENCE_INTERVAL);
318
+
319
+ // Expose existing AI providers to the newly joined user
320
+ _this.sendAIProvidersPresence();
293
321
  } catch (error) {
294
322
  var _this$analyticsHelper7;
295
323
  // We don't want to throw errors for Presence features as they tend to self-restore
@@ -375,6 +403,7 @@ var ParticipantsService = exports.ParticipantsService = /*#__PURE__*/function ()
375
403
  this.sendPresenceJoined = sendPresenceJoined;
376
404
  this.getPresenceData = getPresenceData;
377
405
  this.setUserId = setUserId;
406
+ this.getAIProviderActiveIds = getAIProviderActiveIds;
378
407
  }
379
408
  (0, _createClass2.default)(ParticipantsService, [{
380
409
  key: "emitTelepointersFromSteps",
@@ -65,6 +65,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
65
65
  // It determines if the provider should initialize immediately and will only be true if:
66
66
  // the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
67
67
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isBufferingEnabled", false);
68
+ // Local IDs of active AI Providers
69
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "aiProviderActiveIds", []);
68
70
  /**
69
71
  * Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
70
72
  * Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
@@ -196,6 +198,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
196
198
  }
197
199
  }
198
200
  });
201
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getAIProviderActiveIds", function () {
202
+ return _this.aiProviderActiveIds;
203
+ });
199
204
  // Note: this gets triggered on page reload for Firefox (not other browsers) because of closeOnBeforeunload: false
200
205
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDisconnected", function (_ref4) {
201
206
  var reason = _ref4.reason;
@@ -297,7 +302,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
297
302
  _this.initialDraft = _this.config.initialDraft;
298
303
  _this.isBufferingEnabled = Boolean(_this.config.isBufferingEnabled);
299
304
  _this.isProviderInitialized = false;
300
- _this.participantsService = new _participantsService.ParticipantsService(_this.analyticsHelper, undefined, _this.emitCallback, _this.config.getUser, _this.channel.broadcast, _this.channel.sendPresenceJoined, _this.getPresenceData, _this.setUserId);
305
+ _this.participantsService = new _participantsService.ParticipantsService(_this.analyticsHelper, undefined, _this.emitCallback, _this.config.getUser, _this.channel.broadcast, _this.channel.sendPresenceJoined, _this.getPresenceData, _this.setUserId, _this.getAIProviderActiveIds);
301
306
  _this.metadataService = new _metadataService.MetadataService(_this.emitCallback, _this.channel.sendMetadata);
302
307
  _this.namespaceService = new _namespaceService.NamespaceService();
303
308
  _this.presenceId = _this.config.presenceId;
@@ -508,6 +513,12 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
508
513
  (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
509
514
  }
510
515
  }
516
+ }, {
517
+ key: "setAIProviderActiveIds",
518
+ value: function setAIProviderActiveIds() {
519
+ var ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
520
+ this.aiProviderActiveIds = ids;
521
+ }
511
522
  }, {
512
523
  key: "destroy",
513
524
  value:
@@ -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 = "10.1.2";
8
+ var version = exports.version = "10.2.0";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -19,7 +19,7 @@ const SEND_PRESENCE_INTERVAL = 150 * 1000; // 150 seconds
19
19
  * @param sendPresenceJoined Callback to Channel class
20
20
  */
21
21
  export class ParticipantsService {
22
- constructor(analyticsHelper, participantsState = new ParticipantsState(), emit, getUser, channelBroadcast, sendPresenceJoined, getPresenceData, setUserId) {
22
+ constructor(analyticsHelper, participantsState = new ParticipantsState(), emit, getUser, channelBroadcast, sendPresenceJoined, getPresenceData, setUserId, getAIProviderActiveIds) {
23
23
  _defineProperty(this, "sendAIProviderChanged", payload => {
24
24
  const isFacepileExperimentEnabled = FeatureGates.getExperimentValue('platform_editor_ai_facepile', 'isEnabled', false);
25
25
  if (isFacepileExperimentEnabled && payload.providerId) {
@@ -28,20 +28,44 @@ export class ParticipantsService {
28
28
  payload.permit[propKey] = false;
29
29
  }
30
30
  }
31
- const presencePayload = {
32
- sessionId: `${payload.providerId}::${payload.sessionId}`,
33
- userId: payload.providerId,
34
- clientId: `${payload.providerId}::${payload.clientId}`,
35
- permit: payload.permit,
36
- timestamp: Date.now()
37
- };
31
+ const presencePayload = this.buildAIProviderPresencePayload(payload.providerId);
38
32
  if (payload.action === 'add') {
39
- this.channelBroadcast('participant:updated', presencePayload);
33
+ this.sendAIProviderParticipantUpdated(presencePayload);
40
34
  } else if (payload.action === 'remove') {
41
- this.channelBroadcast('participant:left', presencePayload);
35
+ this.sendAIProviderParticipantLeft(presencePayload);
42
36
  }
43
37
  }
44
38
  });
39
+ _defineProperty(this, "buildAIProviderPresencePayload", providerId => {
40
+ const defaultPresenceData = this.getPresenceData();
41
+ const presencePayload = {
42
+ sessionId: `${providerId}::${defaultPresenceData.sessionId}`,
43
+ userId: providerId,
44
+ clientId: `${providerId}::${defaultPresenceData.clientId}`,
45
+ permit: {
46
+ isPermittedToComment: false,
47
+ isPermittedToEdit: false,
48
+ isPermittedToView: false
49
+ },
50
+ timestamp: Date.now()
51
+ };
52
+ return presencePayload;
53
+ });
54
+ _defineProperty(this, "sendAIProviderParticipantUpdated", payload => {
55
+ this.channelBroadcast('participant:updated', payload);
56
+ });
57
+ _defineProperty(this, "sendAIProviderParticipantLeft", payload => {
58
+ this.channelBroadcast('participant:left', payload);
59
+ });
60
+ // Refresh current AI providers
61
+ _defineProperty(this, "sendAIProvidersPresence", () => {
62
+ if (this.getAIProviderActiveIds) {
63
+ this.getAIProviderActiveIds().forEach(aiProviderId => {
64
+ const presenceData = this.buildAIProviderPresencePayload(aiProviderId);
65
+ this.sendAIProviderParticipantUpdated(presenceData);
66
+ });
67
+ }
68
+ });
45
69
  /**
46
70
  * Carries out 3 things: 1) enriches the participant with user data, 2) updates the participantsState, 3) emits the presence event
47
71
  * @param payload Payload from incoming socket event
@@ -236,6 +260,9 @@ export class ParticipantsService {
236
260
  const data = this.getPresenceData();
237
261
  this.channelBroadcast('participant:updated', data);
238
262
  this.presenceUpdateTimeout = window.setTimeout(() => this.sendPresence(), SEND_PRESENCE_INTERVAL);
263
+
264
+ // Expose existing AI providers to the newly joined user
265
+ this.sendAIProvidersPresence();
239
266
  } catch (error) {
240
267
  var _this$analyticsHelper7;
241
268
  // We don't want to throw errors for Presence features as they tend to self-restore
@@ -321,6 +348,7 @@ export class ParticipantsService {
321
348
  this.sendPresenceJoined = sendPresenceJoined;
322
349
  this.getPresenceData = getPresenceData;
323
350
  this.setUserId = setUserId;
351
+ this.getAIProviderActiveIds = getAIProviderActiveIds;
324
352
  }
325
353
  /**
326
354
  * Called on receiving steps, emits each step's telepointer
@@ -41,6 +41,8 @@ export class Provider extends Emitter {
41
41
  // It determines if the provider should initialize immediately and will only be true if:
42
42
  // the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
43
43
  _defineProperty(this, "isBufferingEnabled", false);
44
+ // Local IDs of active AI Providers
45
+ _defineProperty(this, "aiProviderActiveIds", []);
44
46
  /**
45
47
  * Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
46
48
  * Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
@@ -172,6 +174,9 @@ export class Provider extends Emitter {
172
174
  }
173
175
  }
174
176
  });
177
+ _defineProperty(this, "getAIProviderActiveIds", () => {
178
+ return this.aiProviderActiveIds;
179
+ });
175
180
  // Note: this gets triggered on page reload for Firefox (not other browsers) because of closeOnBeforeunload: false
176
181
  _defineProperty(this, "onDisconnected", ({
177
182
  reason
@@ -250,7 +255,7 @@ export class Provider extends Emitter {
250
255
  this.initialDraft = this.config.initialDraft;
251
256
  this.isBufferingEnabled = Boolean(this.config.isBufferingEnabled);
252
257
  this.isProviderInitialized = false;
253
- this.participantsService = new ParticipantsService(this.analyticsHelper, undefined, this.emitCallback, this.config.getUser, this.channel.broadcast, this.channel.sendPresenceJoined, this.getPresenceData, this.setUserId);
258
+ this.participantsService = new ParticipantsService(this.analyticsHelper, undefined, this.emitCallback, this.config.getUser, this.channel.broadcast, this.channel.sendPresenceJoined, this.getPresenceData, this.setUserId, this.getAIProviderActiveIds);
254
259
  this.metadataService = new MetadataService(this.emitCallback, this.channel.sendMetadata);
255
260
  this.namespaceService = new NamespaceService();
256
261
  this.presenceId = this.config.presenceId;
@@ -448,6 +453,9 @@ export class Provider extends Emitter {
448
453
  (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
449
454
  }
450
455
  }
456
+ setAIProviderActiveIds(ids = []) {
457
+ this.aiProviderActiveIds = ids;
458
+ }
451
459
  /**
452
460
  * "Destroy" the provider, disconnect it's connection to the back-end service and unsubscribe all event listeners on the provider.
453
461
  * Used by Jira products (JWM, JPD) to disable the provider
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "10.1.2";
2
+ export const version = "10.2.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -34,6 +34,7 @@ export var ParticipantsService = /*#__PURE__*/function () {
34
34
  var sendPresenceJoined = arguments.length > 5 ? arguments[5] : undefined;
35
35
  var getPresenceData = arguments.length > 6 ? arguments[6] : undefined;
36
36
  var setUserId = arguments.length > 7 ? arguments[7] : undefined;
37
+ var getAIProviderActiveIds = arguments.length > 8 ? arguments[8] : undefined;
37
38
  _classCallCheck(this, ParticipantsService);
38
39
  _defineProperty(this, "sendAIProviderChanged", function (payload) {
39
40
  var isFacepileExperimentEnabled = FeatureGates.getExperimentValue('platform_editor_ai_facepile', 'isEnabled', false);
@@ -43,20 +44,44 @@ export var ParticipantsService = /*#__PURE__*/function () {
43
44
  payload.permit[propKey] = false;
44
45
  }
45
46
  }
46
- var presencePayload = {
47
- sessionId: "".concat(payload.providerId, "::").concat(payload.sessionId),
48
- userId: payload.providerId,
49
- clientId: "".concat(payload.providerId, "::").concat(payload.clientId),
50
- permit: payload.permit,
51
- timestamp: Date.now()
52
- };
47
+ var presencePayload = _this.buildAIProviderPresencePayload(payload.providerId);
53
48
  if (payload.action === 'add') {
54
- _this.channelBroadcast('participant:updated', presencePayload);
49
+ _this.sendAIProviderParticipantUpdated(presencePayload);
55
50
  } else if (payload.action === 'remove') {
56
- _this.channelBroadcast('participant:left', presencePayload);
51
+ _this.sendAIProviderParticipantLeft(presencePayload);
57
52
  }
58
53
  }
59
54
  });
55
+ _defineProperty(this, "buildAIProviderPresencePayload", function (providerId) {
56
+ var defaultPresenceData = _this.getPresenceData();
57
+ var presencePayload = {
58
+ sessionId: "".concat(providerId, "::").concat(defaultPresenceData.sessionId),
59
+ userId: providerId,
60
+ clientId: "".concat(providerId, "::").concat(defaultPresenceData.clientId),
61
+ permit: {
62
+ isPermittedToComment: false,
63
+ isPermittedToEdit: false,
64
+ isPermittedToView: false
65
+ },
66
+ timestamp: Date.now()
67
+ };
68
+ return presencePayload;
69
+ });
70
+ _defineProperty(this, "sendAIProviderParticipantUpdated", function (payload) {
71
+ _this.channelBroadcast('participant:updated', payload);
72
+ });
73
+ _defineProperty(this, "sendAIProviderParticipantLeft", function (payload) {
74
+ _this.channelBroadcast('participant:left', payload);
75
+ });
76
+ // Refresh current AI providers
77
+ _defineProperty(this, "sendAIProvidersPresence", function () {
78
+ if (_this.getAIProviderActiveIds) {
79
+ _this.getAIProviderActiveIds().forEach(function (aiProviderId) {
80
+ var presenceData = _this.buildAIProviderPresencePayload(aiProviderId);
81
+ _this.sendAIProviderParticipantUpdated(presenceData);
82
+ });
83
+ }
84
+ });
60
85
  /**
61
86
  * Carries out 3 things: 1) enriches the participant with user data, 2) updates the participantsState, 3) emits the presence event
62
87
  * @param payload Payload from incoming socket event
@@ -283,6 +308,9 @@ export var ParticipantsService = /*#__PURE__*/function () {
283
308
  _this.presenceUpdateTimeout = window.setTimeout(function () {
284
309
  return _this.sendPresence();
285
310
  }, SEND_PRESENCE_INTERVAL);
311
+
312
+ // Expose existing AI providers to the newly joined user
313
+ _this.sendAIProvidersPresence();
286
314
  } catch (error) {
287
315
  var _this$analyticsHelper7;
288
316
  // We don't want to throw errors for Presence features as they tend to self-restore
@@ -368,6 +396,7 @@ export var ParticipantsService = /*#__PURE__*/function () {
368
396
  this.sendPresenceJoined = sendPresenceJoined;
369
397
  this.getPresenceData = getPresenceData;
370
398
  this.setUserId = setUserId;
399
+ this.getAIProviderActiveIds = getAIProviderActiveIds;
371
400
  }
372
401
  _createClass(ParticipantsService, [{
373
402
  key: "emitTelepointersFromSteps",
@@ -58,6 +58,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
58
58
  // It determines if the provider should initialize immediately and will only be true if:
59
59
  // the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
60
60
  _defineProperty(_assertThisInitialized(_this), "isBufferingEnabled", false);
61
+ // Local IDs of active AI Providers
62
+ _defineProperty(_assertThisInitialized(_this), "aiProviderActiveIds", []);
61
63
  /**
62
64
  * Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
63
65
  * Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
@@ -189,6 +191,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
189
191
  }
190
192
  }
191
193
  });
194
+ _defineProperty(_assertThisInitialized(_this), "getAIProviderActiveIds", function () {
195
+ return _this.aiProviderActiveIds;
196
+ });
192
197
  // Note: this gets triggered on page reload for Firefox (not other browsers) because of closeOnBeforeunload: false
193
198
  _defineProperty(_assertThisInitialized(_this), "onDisconnected", function (_ref4) {
194
199
  var reason = _ref4.reason;
@@ -290,7 +295,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
290
295
  _this.initialDraft = _this.config.initialDraft;
291
296
  _this.isBufferingEnabled = Boolean(_this.config.isBufferingEnabled);
292
297
  _this.isProviderInitialized = false;
293
- _this.participantsService = new ParticipantsService(_this.analyticsHelper, undefined, _this.emitCallback, _this.config.getUser, _this.channel.broadcast, _this.channel.sendPresenceJoined, _this.getPresenceData, _this.setUserId);
298
+ _this.participantsService = new ParticipantsService(_this.analyticsHelper, undefined, _this.emitCallback, _this.config.getUser, _this.channel.broadcast, _this.channel.sendPresenceJoined, _this.getPresenceData, _this.setUserId, _this.getAIProviderActiveIds);
294
299
  _this.metadataService = new MetadataService(_this.emitCallback, _this.channel.sendMetadata);
295
300
  _this.namespaceService = new NamespaceService();
296
301
  _this.presenceId = _this.config.presenceId;
@@ -501,6 +506,12 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
501
506
  (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
502
507
  }
503
508
  }
509
+ }, {
510
+ key: "setAIProviderActiveIds",
511
+ value: function setAIProviderActiveIds() {
512
+ var ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
513
+ this.aiProviderActiveIds = ids;
514
+ }
504
515
  }, {
505
516
  key: "destroy",
506
517
  value:
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "10.1.2";
2
+ export var version = "10.2.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -21,9 +21,10 @@ export declare class ParticipantsService {
21
21
  private sendPresenceJoined;
22
22
  private getPresenceData;
23
23
  private setUserId;
24
+ private getAIProviderActiveIds?;
24
25
  private participantUpdateTimeout;
25
26
  private presenceUpdateTimeout;
26
- constructor(analyticsHelper: AnalyticsHelper | undefined, participantsState: ParticipantsState, emit: (evt: 'presence' | 'telepointer' | 'disconnected' | 'activity:join' | 'activity:ack', data: CollabEventPresenceData | CollabTelepointerPayload | CollabEventDisconnectedData | CollabActivityData) => void, getUser: GetUserType, channelBroadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, sendPresenceJoined: () => void, getPresenceData: () => PresenceData, setUserId: (id: string) => void);
27
+ constructor(analyticsHelper: AnalyticsHelper | undefined, participantsState: ParticipantsState, emit: (evt: 'presence' | 'telepointer' | 'disconnected' | 'activity:join' | 'activity:ack', data: CollabEventPresenceData | CollabTelepointerPayload | CollabEventDisconnectedData | CollabActivityData) => void, getUser: GetUserType, channelBroadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, sendPresenceJoined: () => void, getPresenceData: () => PresenceData, setUserId: (id: string) => void, getAIProviderActiveIds?: (() => string[]) | undefined);
27
28
  sendAIProviderChanged: (payload: {
28
29
  userId: string;
29
30
  sessionId: string;
@@ -32,6 +33,10 @@ export declare class ParticipantsService {
32
33
  action: 'add' | 'remove';
33
34
  permit?: UserPermitType;
34
35
  }) => void;
36
+ private buildAIProviderPresencePayload;
37
+ private sendAIProviderParticipantUpdated;
38
+ private sendAIProviderParticipantLeft;
39
+ private sendAIProvidersPresence;
35
40
  /**
36
41
  * Carries out 3 things: 1) enriches the participant with user data, 2) updates the participantsState, 3) emits the presence event
37
42
  * @param payload Payload from incoming socket event
@@ -31,6 +31,7 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
31
31
  private readonly metadataService;
32
32
  private readonly documentService;
33
33
  private readonly namespaceService;
34
+ private aiProviderActiveIds;
34
35
  /**
35
36
  * Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
36
37
  * Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
@@ -95,6 +96,8 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
95
96
  * @param {string} data.sessionId Identifier identifying the session
96
97
  */
97
98
  sendMessage(data: CollabTelepointerPayload | CollabActivityJoinPayload | CollabActivityAckPayload | CollabActivityAIProviderChangedPayload): void;
99
+ setAIProviderActiveIds(ids?: string[]): void;
100
+ private getAIProviderActiveIds;
98
101
  private onDisconnected;
99
102
  /**
100
103
  * "Destroy" the provider, disconnect it's connection to the back-end service and unsubscribe all event listeners on the provider.
@@ -21,9 +21,10 @@ export declare class ParticipantsService {
21
21
  private sendPresenceJoined;
22
22
  private getPresenceData;
23
23
  private setUserId;
24
+ private getAIProviderActiveIds?;
24
25
  private participantUpdateTimeout;
25
26
  private presenceUpdateTimeout;
26
- constructor(analyticsHelper: AnalyticsHelper | undefined, participantsState: ParticipantsState, emit: (evt: 'presence' | 'telepointer' | 'disconnected' | 'activity:join' | 'activity:ack', data: CollabEventPresenceData | CollabTelepointerPayload | CollabEventDisconnectedData | CollabActivityData) => void, getUser: GetUserType, channelBroadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, sendPresenceJoined: () => void, getPresenceData: () => PresenceData, setUserId: (id: string) => void);
27
+ constructor(analyticsHelper: AnalyticsHelper | undefined, participantsState: ParticipantsState, emit: (evt: 'presence' | 'telepointer' | 'disconnected' | 'activity:join' | 'activity:ack', data: CollabEventPresenceData | CollabTelepointerPayload | CollabEventDisconnectedData | CollabActivityData) => void, getUser: GetUserType, channelBroadcast: <K extends keyof ChannelEvent>(type: K, data: Omit<ChannelEvent[K], 'timestamp'>, callback?: Function) => void, sendPresenceJoined: () => void, getPresenceData: () => PresenceData, setUserId: (id: string) => void, getAIProviderActiveIds?: (() => string[]) | undefined);
27
28
  sendAIProviderChanged: (payload: {
28
29
  userId: string;
29
30
  sessionId: string;
@@ -32,6 +33,10 @@ export declare class ParticipantsService {
32
33
  action: 'add' | 'remove';
33
34
  permit?: UserPermitType;
34
35
  }) => void;
36
+ private buildAIProviderPresencePayload;
37
+ private sendAIProviderParticipantUpdated;
38
+ private sendAIProviderParticipantLeft;
39
+ private sendAIProvidersPresence;
35
40
  /**
36
41
  * Carries out 3 things: 1) enriches the participant with user data, 2) updates the participantsState, 3) emits the presence event
37
42
  * @param payload Payload from incoming socket event
@@ -31,6 +31,7 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
31
31
  private readonly metadataService;
32
32
  private readonly documentService;
33
33
  private readonly namespaceService;
34
+ private aiProviderActiveIds;
34
35
  /**
35
36
  * Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
36
37
  * Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
@@ -95,6 +96,8 @@ export declare class Provider extends Emitter<CollabEvents> implements BaseEvent
95
96
  * @param {string} data.sessionId Identifier identifying the session
96
97
  */
97
98
  sendMessage(data: CollabTelepointerPayload | CollabActivityJoinPayload | CollabActivityAckPayload | CollabActivityAIProviderChangedPayload): void;
99
+ setAIProviderActiveIds(ids?: string[]): void;
100
+ private getAIProviderActiveIds;
98
101
  private onDisconnected;
99
102
  /**
100
103
  * "Destroy" the provider, disconnect it's connection to the back-end service and unsubscribe all event listeners on the provider.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "10.1.2",
3
+ "version": "10.2.0",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/analytics-gas-types": "^5.1.0",
36
36
  "@atlaskit/analytics-listeners": "^8.13.0",
37
- "@atlaskit/editor-common": "^95.6.0",
37
+ "@atlaskit/editor-common": "^95.8.0",
38
38
  "@atlaskit/editor-json-transformer": "^8.21.0",
39
39
  "@atlaskit/editor-prosemirror": "6.0.0",
40
40
  "@atlaskit/feature-gate-js-client": "^4.22.0",
@@ -63,7 +63,7 @@
63
63
  }
64
64
  },
65
65
  "devDependencies": {
66
- "@atlaskit/adf-schema": "^44.2.0",
66
+ "@atlaskit/adf-schema": "^46.1.0",
67
67
  "@atlassian/feature-flags-test-utils": "^0.2.0",
68
68
  "typescript": "~5.4.2"
69
69
  },