@atlaskit/collab-provider 24.0.1 → 24.1.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,21 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 24.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`3c9414f125601`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3c9414f125601) -
8
+ Show editing status for agents detected from agent-authored collaboration steps.
9
+
10
+ ## 24.0.2
11
+
12
+ ### Patch Changes
13
+
14
+ - [`d7528657a607f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d7528657a607f) -
15
+ Feature-gate and serialize agent attribution from matching transaction origins onto native-collab
16
+ steps.
17
+ - Updated dependencies
18
+
3
19
  ## 24.0.1
4
20
 
5
21
  ### Patch Changes
@@ -142,7 +142,9 @@ var ParticipantsService = exports.ParticipantsService = /*#__PURE__*/function ()
142
142
  var sessionId = payload.sessionId;
143
143
  var existing = _this.participantsState.getBySessionId(sessionId);
144
144
  var wasInactive = existing ? Date.now() - existing.lastActive >= AGENT_PRESENCE_INACTIVE_MS : false;
145
- var participant = _objectSpread(_objectSpread({}, payload), {}, {
145
+ var participant = _objectSpread(_objectSpread(_objectSpread({}, payload), (0, _fg.fg)('platform_move_presence_agents') ? {
146
+ presenceActivity: 'editor'
147
+ } : {}), {}, {
146
148
  // `payload.userId` is typed `string | undefined`; here it is always the (string)
147
149
  // providerId, so pin it to satisfy ProviderParticipant.userId (string).
148
150
  userId: providerId,
@@ -13,6 +13,8 @@ var _const = require("../helpers/const");
13
13
  var _types = require("../types");
14
14
  var _ncsErrors = require("../errors/ncs-errors");
15
15
  var _utils = require("../helpers/utils");
16
+ var _transactionAgentAttribution = require("@atlaskit/editor-common/transaction-agent-attribution");
17
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
16
18
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
17
19
  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; }
18
20
  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; }
@@ -36,6 +38,7 @@ var CommitStepService = exports.CommitStepService = /*#__PURE__*/function () {
36
38
  this.onErrorHandled = onErrorHandled;
37
39
  this.readyToCommit = true;
38
40
  this.lastBroadcastRequestAcked = true;
41
+ this.shouldSerializeAgentAttribution = (0, _fg.fg)('platform_editor_agentic_step_attribution');
39
42
  }
40
43
  return (0, _createClass2.default)(CommitStepService, [{
41
44
  key: "commitStepQueue",
@@ -75,11 +78,17 @@ var CommitStepService = exports.CommitStepService = /*#__PURE__*/function () {
75
78
  _this.lastBroadcastRequestAcked = true;
76
79
  logger('reset readyToCommit by timer');
77
80
  }, RESET_READYTOCOMMIT_INTERVAL_MS);
78
- var stepsWithClientAndUserId = steps.map(function (step) {
81
+ var stepsWithClientAndUserId = steps.map(function (step, index) {
82
+ var _stepOrigins$index;
83
+ var agentAttribution = _this.shouldSerializeAgentAttribution ? stepOrigins === null || stepOrigins === void 0 || (_stepOrigins$index = stepOrigins[index]) === null || _stepOrigins$index === void 0 ? void 0 : _stepOrigins$index.getMeta(_transactionAgentAttribution.AGENT_ATTRIBUTION_META) : undefined;
79
84
  return _objectSpread(_objectSpread({}, step.toJSON()), {}, {
80
85
  clientId: clientId,
81
86
  userId: userId
82
- });
87
+ }, agentAttribution ? _objectSpread({
88
+ agentType: agentAttribution.agentType
89
+ }, agentAttribution.agentId !== undefined ? {
90
+ agentId: agentAttribution.agentId
91
+ } : {}) : {});
83
92
  });
84
93
 
85
94
  // Mutate steps to ignore expand expand/collapse changes in live pages
@@ -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 = "24.0.0";
8
+ var version = exports.version = "24.0.2";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -130,6 +130,9 @@ export class ParticipantsService {
130
130
  const wasInactive = existing ? Date.now() - existing.lastActive >= AGENT_PRESENCE_INACTIVE_MS : false;
131
131
  const participant = {
132
132
  ...payload,
133
+ ...(fg('platform_move_presence_agents') ? {
134
+ presenceActivity: 'editor'
135
+ } : {}),
133
136
  // `payload.userId` is typed `string | undefined`; here it is always the (string)
134
137
  // providerId, so pin it to satisfy ProviderParticipant.userId (string).
135
138
  userId: providerId,
@@ -3,6 +3,8 @@ import { ADD_STEPS_TYPE, EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
3
3
  import { AcknowledgementResponseTypes } from '../types';
4
4
  import { NCS_ERROR_CODE } from '../errors/ncs-errors';
5
5
  import { createLogger } from '../helpers/utils';
6
+ import { AGENT_ATTRIBUTION_META } from '@atlaskit/editor-common/transaction-agent-attribution';
7
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
6
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
9
  const logger = createLogger('commit-step', 'black');
8
10
  export const RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
@@ -23,6 +25,7 @@ export class CommitStepService {
23
25
  this.onErrorHandled = onErrorHandled;
24
26
  this.readyToCommit = true;
25
27
  this.lastBroadcastRequestAcked = true;
28
+ this.shouldSerializeAgentAttribution = fg('platform_editor_agentic_step_attribution');
26
29
  }
27
30
  commitStepQueue({
28
31
  steps,
@@ -60,11 +63,21 @@ export class CommitStepService {
60
63
  this.lastBroadcastRequestAcked = true;
61
64
  logger('reset readyToCommit by timer');
62
65
  }, RESET_READYTOCOMMIT_INTERVAL_MS);
63
- let stepsWithClientAndUserId = steps.map(step => ({
64
- ...step.toJSON(),
65
- clientId,
66
- userId
67
- }));
66
+ let stepsWithClientAndUserId = steps.map((step, index) => {
67
+ var _stepOrigins$index;
68
+ const agentAttribution = this.shouldSerializeAgentAttribution ? stepOrigins === null || stepOrigins === void 0 ? void 0 : (_stepOrigins$index = stepOrigins[index]) === null || _stepOrigins$index === void 0 ? void 0 : _stepOrigins$index.getMeta(AGENT_ATTRIBUTION_META) : undefined;
69
+ return {
70
+ ...step.toJSON(),
71
+ clientId,
72
+ userId,
73
+ ...(agentAttribution ? {
74
+ agentType: agentAttribution.agentType,
75
+ ...(agentAttribution.agentId !== undefined ? {
76
+ agentId: agentAttribution.agentId
77
+ } : {})
78
+ } : {})
79
+ };
80
+ });
68
81
 
69
82
  // Mutate steps to ignore expand expand/collapse changes in live pages
70
83
  // This is expected to be a temporary divergence from standard editor behaviour
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "24.0.0";
2
+ export const version = "24.0.2";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -135,7 +135,9 @@ export var ParticipantsService = /*#__PURE__*/function () {
135
135
  var sessionId = payload.sessionId;
136
136
  var existing = _this.participantsState.getBySessionId(sessionId);
137
137
  var wasInactive = existing ? Date.now() - existing.lastActive >= AGENT_PRESENCE_INACTIVE_MS : false;
138
- var participant = _objectSpread(_objectSpread({}, payload), {}, {
138
+ var participant = _objectSpread(_objectSpread(_objectSpread({}, payload), fg('platform_move_presence_agents') ? {
139
+ presenceActivity: 'editor'
140
+ } : {}), {}, {
139
141
  // `payload.userId` is typed `string | undefined`; here it is always the (string)
140
142
  // providerId, so pin it to satisfy ProviderParticipant.userId (string).
141
143
  userId: providerId,
@@ -8,6 +8,8 @@ import { ADD_STEPS_TYPE, EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
8
8
  import { AcknowledgementResponseTypes } from '../types';
9
9
  import { NCS_ERROR_CODE } from '../errors/ncs-errors';
10
10
  import { createLogger } from '../helpers/utils';
11
+ import { AGENT_ATTRIBUTION_META } from '@atlaskit/editor-common/transaction-agent-attribution';
12
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
11
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
14
  var logger = createLogger('commit-step', 'black');
13
15
  export var RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
@@ -29,6 +31,7 @@ export var CommitStepService = /*#__PURE__*/function () {
29
31
  this.onErrorHandled = onErrorHandled;
30
32
  this.readyToCommit = true;
31
33
  this.lastBroadcastRequestAcked = true;
34
+ this.shouldSerializeAgentAttribution = fg('platform_editor_agentic_step_attribution');
32
35
  }
33
36
  return _createClass(CommitStepService, [{
34
37
  key: "commitStepQueue",
@@ -68,11 +71,17 @@ export var CommitStepService = /*#__PURE__*/function () {
68
71
  _this.lastBroadcastRequestAcked = true;
69
72
  logger('reset readyToCommit by timer');
70
73
  }, RESET_READYTOCOMMIT_INTERVAL_MS);
71
- var stepsWithClientAndUserId = steps.map(function (step) {
74
+ var stepsWithClientAndUserId = steps.map(function (step, index) {
75
+ var _stepOrigins$index;
76
+ var agentAttribution = _this.shouldSerializeAgentAttribution ? stepOrigins === null || stepOrigins === void 0 || (_stepOrigins$index = stepOrigins[index]) === null || _stepOrigins$index === void 0 ? void 0 : _stepOrigins$index.getMeta(AGENT_ATTRIBUTION_META) : undefined;
72
77
  return _objectSpread(_objectSpread({}, step.toJSON()), {}, {
73
78
  clientId: clientId,
74
79
  userId: userId
75
- });
80
+ }, agentAttribution ? _objectSpread({
81
+ agentType: agentAttribution.agentType
82
+ }, agentAttribution.agentId !== undefined ? {
83
+ agentId: agentAttribution.agentId
84
+ } : {}) : {});
76
85
  });
77
86
 
78
87
  // Mutate steps to ignore expand expand/collapse changes in live pages
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "24.0.0";
2
+ export var version = "24.0.2";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -13,6 +13,7 @@ export declare class CommitStepService {
13
13
  private onErrorHandled;
14
14
  private readyToCommit;
15
15
  private lastBroadcastRequestAcked;
16
+ private readonly shouldSerializeAgentAttribution;
16
17
  /**
17
18
  * @param broadcast - Callback for broadcasting events to other clients
18
19
  * @param analyticsHelper - Helper for analytics events
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "24.0.1",
3
+ "version": "24.1.0",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -18,18 +18,18 @@
18
18
  "team": "Editor: Collaboration"
19
19
  },
20
20
  "dependencies": {
21
- "@atlaskit/adf-utils": "^20.5.0",
21
+ "@atlaskit/adf-utils": "^20.6.0",
22
22
  "@atlaskit/analytics-gas-types": "^6.0.0",
23
23
  "@atlaskit/analytics-listeners": "^11.1.0",
24
24
  "@atlaskit/anonymous-assets": "^2.8.0",
25
25
  "@atlaskit/atlassian-context": "^1.1.0",
26
- "@atlaskit/editor-json-transformer": "^9.2.0",
26
+ "@atlaskit/editor-json-transformer": "^9.4.0",
27
27
  "@atlaskit/editor-prosemirror": "^8.0.0",
28
28
  "@atlaskit/feature-gate-js-client": "^6.0.0",
29
29
  "@atlaskit/platform-feature-experiments": "^0.3.0",
30
30
  "@atlaskit/platform-feature-flags": "^2.1.0",
31
31
  "@atlaskit/prosemirror-collab": "^1.0.0",
32
- "@atlaskit/react-ufo": "^7.5.0",
32
+ "@atlaskit/react-ufo": "^7.6.0",
33
33
  "@atlaskit/tmp-editor-statsig": "^147.1.0",
34
34
  "@atlaskit/ufo": "^1.0.0",
35
35
  "@atlaskit/util-service-support": "^7.2.0",
@@ -56,7 +56,7 @@
56
56
  }
57
57
  },
58
58
  "devDependencies": {
59
- "@atlaskit/adf-schema": "^56.7.0",
59
+ "@atlaskit/adf-schema": "^57.0.0",
60
60
  "@atlassian/a11y-jest-testing": "^0.15.0",
61
61
  "@atlassian/experiment-test-utils": "^0.2.0",
62
62
  "@atlassian/feature-flags-test-utils": "^1.2.0"
@@ -66,6 +66,9 @@
66
66
  "type": "boolean",
67
67
  "referenceOnly": true
68
68
  },
69
+ "platform_editor_agentic_step_attribution": {
70
+ "type": "boolean"
71
+ },
69
72
  "platform-editor-presence-websocket-only": {
70
73
  "type": "boolean"
71
74
  },
@@ -74,6 +77,6 @@
74
77
  }
75
78
  },
76
79
  "peerDependencies": {
77
- "@atlaskit/editor-common": "^119.1.0"
80
+ "@atlaskit/editor-common": "^119.4.0"
78
81
  }
79
82
  }