@atlaskit/collab-provider 10.2.2 → 10.3.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/analytics/analytics-helper.js +1 -2
  3. package/dist/cjs/api/api.js +5 -7
  4. package/dist/cjs/api/null-api.js +1 -2
  5. package/dist/cjs/channel.js +34 -37
  6. package/dist/cjs/connectivity/network.js +1 -2
  7. package/dist/cjs/connectivity/reconnect-helper.js +1 -2
  8. package/dist/cjs/document/document-service.js +1 -2
  9. package/dist/cjs/document/null-document-service.js +1 -2
  10. package/dist/cjs/document/step-queue-state.js +1 -2
  11. package/dist/cjs/emitter.js +1 -2
  12. package/dist/cjs/errors/custom-errors.js +54 -69
  13. package/dist/cjs/metadata/metadata-service.js +1 -2
  14. package/dist/cjs/participants/participants-service.js +21 -26
  15. package/dist/cjs/provider/index.js +32 -34
  16. package/dist/cjs/version-wrapper.js +1 -1
  17. package/dist/es2019/participants/participants-service.js +18 -22
  18. package/dist/es2019/version-wrapper.js +1 -1
  19. package/dist/esm/analytics/analytics-helper.js +1 -2
  20. package/dist/esm/api/api.js +5 -7
  21. package/dist/esm/api/null-api.js +1 -2
  22. package/dist/esm/channel.js +34 -37
  23. package/dist/esm/connectivity/network.js +1 -2
  24. package/dist/esm/connectivity/reconnect-helper.js +1 -2
  25. package/dist/esm/document/document-service.js +1 -2
  26. package/dist/esm/document/null-document-service.js +1 -2
  27. package/dist/esm/document/step-queue-state.js +1 -2
  28. package/dist/esm/emitter.js +1 -2
  29. package/dist/esm/errors/custom-errors.js +54 -69
  30. package/dist/esm/metadata/metadata-service.js +1 -2
  31. package/dist/esm/participants/participants-service.js +21 -26
  32. package/dist/esm/provider/index.js +32 -34
  33. package/dist/esm/version-wrapper.js +1 -1
  34. package/package.json +2 -2
@@ -1,22 +1,19 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
4
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
7
6
  import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
8
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
8
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
10
  // Custom Errors
12
11
  export var CustomError = /*#__PURE__*/function (_Error) {
13
- _inherits(CustomError, _Error);
14
- var _super = _createSuper(CustomError);
15
12
  function CustomError(message, error, extraEventAttributes) {
16
13
  var _this;
17
14
  _classCallCheck(this, CustomError);
18
- _this = _super.call(this, message);
19
- _defineProperty(_assertThisInitialized(_this), "getExtraErrorEventAttributes", function () {
15
+ _this = _callSuper(this, CustomError, [message]);
16
+ _defineProperty(_this, "getExtraErrorEventAttributes", function () {
20
17
  return _this.extraEventAttributes;
21
18
  });
22
19
  if (typeof (error === null || error === void 0 ? void 0 : error.message) === 'string') {
@@ -27,7 +24,8 @@ export var CustomError = /*#__PURE__*/function (_Error) {
27
24
  }
28
25
  return _this;
29
26
  }
30
- _createClass(CustomError, [{
27
+ _inherits(CustomError, _Error);
28
+ return _createClass(CustomError, [{
31
29
  key: "toJSON",
32
30
  value: function toJSON() {
33
31
  return {
@@ -36,179 +34,166 @@ export var CustomError = /*#__PURE__*/function (_Error) {
36
34
  };
37
35
  }
38
36
  }]);
39
- return CustomError;
40
37
  }( /*#__PURE__*/_wrapNativeSuper(Error));
41
- export var NotConnectedError = /*#__PURE__*/function (_CustomError) {
42
- _inherits(NotConnectedError, _CustomError);
43
- var _super2 = _createSuper(NotConnectedError);
38
+ export var NotConnectedError = /*#__PURE__*/function (_CustomError2) {
44
39
  function NotConnectedError() {
45
40
  var _this2;
46
41
  _classCallCheck(this, NotConnectedError);
47
42
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
43
  args[_key] = arguments[_key];
49
44
  }
50
- _this2 = _super2.call.apply(_super2, [this].concat(args));
51
- _defineProperty(_assertThisInitialized(_this2), "name", 'NotConnectedError');
45
+ _this2 = _callSuper(this, NotConnectedError, [].concat(args));
46
+ _defineProperty(_this2, "name", 'NotConnectedError');
52
47
  return _this2;
53
48
  }
49
+ _inherits(NotConnectedError, _CustomError2);
54
50
  return _createClass(NotConnectedError);
55
51
  }(CustomError);
56
- export var NotInitializedError = /*#__PURE__*/function (_CustomError2) {
57
- _inherits(NotInitializedError, _CustomError2);
58
- var _super3 = _createSuper(NotInitializedError);
52
+ export var NotInitializedError = /*#__PURE__*/function (_CustomError3) {
59
53
  function NotInitializedError() {
60
54
  var _this3;
61
55
  _classCallCheck(this, NotInitializedError);
62
56
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
63
57
  args[_key2] = arguments[_key2];
64
58
  }
65
- _this3 = _super3.call.apply(_super3, [this].concat(args));
66
- _defineProperty(_assertThisInitialized(_this3), "name", 'NotInitializedError');
59
+ _this3 = _callSuper(this, NotInitializedError, [].concat(args));
60
+ _defineProperty(_this3, "name", 'NotInitializedError');
67
61
  return _this3;
68
62
  }
63
+ _inherits(NotInitializedError, _CustomError3);
69
64
  return _createClass(NotInitializedError);
70
65
  }(CustomError);
71
- export var ProviderInitialisationError = /*#__PURE__*/function (_CustomError3) {
72
- _inherits(ProviderInitialisationError, _CustomError3);
73
- var _super4 = _createSuper(ProviderInitialisationError);
66
+ export var ProviderInitialisationError = /*#__PURE__*/function (_CustomError4) {
74
67
  function ProviderInitialisationError() {
75
68
  var _this4;
76
69
  _classCallCheck(this, ProviderInitialisationError);
77
70
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
78
71
  args[_key3] = arguments[_key3];
79
72
  }
80
- _this4 = _super4.call.apply(_super4, [this].concat(args));
81
- _defineProperty(_assertThisInitialized(_this4), "name", 'ProviderInitialisationError');
73
+ _this4 = _callSuper(this, ProviderInitialisationError, [].concat(args));
74
+ _defineProperty(_this4, "name", 'ProviderInitialisationError');
82
75
  return _this4;
83
76
  }
77
+ _inherits(ProviderInitialisationError, _CustomError4);
84
78
  return _createClass(ProviderInitialisationError);
85
79
  }(CustomError);
86
- export var SendTransactionError = /*#__PURE__*/function (_CustomError4) {
87
- _inherits(SendTransactionError, _CustomError4);
88
- var _super5 = _createSuper(SendTransactionError);
80
+ export var SendTransactionError = /*#__PURE__*/function (_CustomError5) {
89
81
  function SendTransactionError() {
90
82
  var _this5;
91
83
  _classCallCheck(this, SendTransactionError);
92
84
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
93
85
  args[_key4] = arguments[_key4];
94
86
  }
95
- _this5 = _super5.call.apply(_super5, [this].concat(args));
96
- _defineProperty(_assertThisInitialized(_this5), "name", 'SendTransactionError');
87
+ _this5 = _callSuper(this, SendTransactionError, [].concat(args));
88
+ _defineProperty(_this5, "name", 'SendTransactionError');
97
89
  return _this5;
98
90
  }
91
+ _inherits(SendTransactionError, _CustomError5);
99
92
  return _createClass(SendTransactionError);
100
93
  }(CustomError);
101
- export var DestroyError = /*#__PURE__*/function (_CustomError5) {
102
- _inherits(DestroyError, _CustomError5);
103
- var _super6 = _createSuper(DestroyError);
94
+ export var DestroyError = /*#__PURE__*/function (_CustomError6) {
104
95
  function DestroyError() {
105
96
  var _this6;
106
97
  _classCallCheck(this, DestroyError);
107
98
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
108
99
  args[_key5] = arguments[_key5];
109
100
  }
110
- _this6 = _super6.call.apply(_super6, [this].concat(args));
111
- _defineProperty(_assertThisInitialized(_this6), "name", 'DestroyError');
101
+ _this6 = _callSuper(this, DestroyError, [].concat(args));
102
+ _defineProperty(_this6, "name", 'DestroyError');
112
103
  return _this6;
113
104
  }
105
+ _inherits(DestroyError, _CustomError6);
114
106
  return _createClass(DestroyError);
115
107
  }(CustomError);
116
- export var SetTitleError = /*#__PURE__*/function (_CustomError6) {
117
- _inherits(SetTitleError, _CustomError6);
118
- var _super7 = _createSuper(SetTitleError);
108
+ export var SetTitleError = /*#__PURE__*/function (_CustomError7) {
119
109
  function SetTitleError() {
120
110
  var _this7;
121
111
  _classCallCheck(this, SetTitleError);
122
112
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
123
113
  args[_key6] = arguments[_key6];
124
114
  }
125
- _this7 = _super7.call.apply(_super7, [this].concat(args));
126
- _defineProperty(_assertThisInitialized(_this7), "name", 'SetTitleError');
115
+ _this7 = _callSuper(this, SetTitleError, [].concat(args));
116
+ _defineProperty(_this7, "name", 'SetTitleError');
127
117
  return _this7;
128
118
  }
119
+ _inherits(SetTitleError, _CustomError7);
129
120
  return _createClass(SetTitleError);
130
121
  }(CustomError);
131
- export var SetEditorWidthError = /*#__PURE__*/function (_CustomError7) {
132
- _inherits(SetEditorWidthError, _CustomError7);
133
- var _super8 = _createSuper(SetEditorWidthError);
122
+ export var SetEditorWidthError = /*#__PURE__*/function (_CustomError8) {
134
123
  function SetEditorWidthError() {
135
124
  var _this8;
136
125
  _classCallCheck(this, SetEditorWidthError);
137
126
  for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
138
127
  args[_key7] = arguments[_key7];
139
128
  }
140
- _this8 = _super8.call.apply(_super8, [this].concat(args));
141
- _defineProperty(_assertThisInitialized(_this8), "name", 'SetEditorWidthError');
129
+ _this8 = _callSuper(this, SetEditorWidthError, [].concat(args));
130
+ _defineProperty(_this8, "name", 'SetEditorWidthError');
142
131
  return _this8;
143
132
  }
133
+ _inherits(SetEditorWidthError, _CustomError8);
144
134
  return _createClass(SetEditorWidthError);
145
135
  }(CustomError);
146
- export var SetMetadataError = /*#__PURE__*/function (_CustomError8) {
147
- _inherits(SetMetadataError, _CustomError8);
148
- var _super9 = _createSuper(SetMetadataError);
136
+ export var SetMetadataError = /*#__PURE__*/function (_CustomError9) {
149
137
  function SetMetadataError() {
150
138
  var _this9;
151
139
  _classCallCheck(this, SetMetadataError);
152
140
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
153
141
  args[_key8] = arguments[_key8];
154
142
  }
155
- _this9 = _super9.call.apply(_super9, [this].concat(args));
156
- _defineProperty(_assertThisInitialized(_this9), "name", 'SetMetadataError');
143
+ _this9 = _callSuper(this, SetMetadataError, [].concat(args));
144
+ _defineProperty(_this9, "name", 'SetMetadataError');
157
145
  return _this9;
158
146
  }
147
+ _inherits(SetMetadataError, _CustomError9);
159
148
  return _createClass(SetMetadataError);
160
149
  }(CustomError);
161
- export var GetCurrentStateError = /*#__PURE__*/function (_CustomError9) {
162
- _inherits(GetCurrentStateError, _CustomError9);
163
- var _super10 = _createSuper(GetCurrentStateError);
150
+ export var GetCurrentStateError = /*#__PURE__*/function (_CustomError10) {
164
151
  function GetCurrentStateError() {
165
152
  var _this10;
166
153
  _classCallCheck(this, GetCurrentStateError);
167
154
  for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
168
155
  args[_key9] = arguments[_key9];
169
156
  }
170
- _this10 = _super10.call.apply(_super10, [this].concat(args));
171
- _defineProperty(_assertThisInitialized(_this10), "name", 'GetCurrentStateError');
157
+ _this10 = _callSuper(this, GetCurrentStateError, [].concat(args));
158
+ _defineProperty(_this10, "name", 'GetCurrentStateError');
172
159
  return _this10;
173
160
  }
161
+ _inherits(GetCurrentStateError, _CustomError10);
174
162
  return _createClass(GetCurrentStateError);
175
163
  }(CustomError);
176
- export var GetFinalAcknowledgedStateError = /*#__PURE__*/function (_CustomError10) {
177
- _inherits(GetFinalAcknowledgedStateError, _CustomError10);
178
- var _super11 = _createSuper(GetFinalAcknowledgedStateError);
164
+ export var GetFinalAcknowledgedStateError = /*#__PURE__*/function (_CustomError11) {
179
165
  function GetFinalAcknowledgedStateError() {
180
166
  var _this11;
181
167
  _classCallCheck(this, GetFinalAcknowledgedStateError);
182
168
  for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
183
169
  args[_key10] = arguments[_key10];
184
170
  }
185
- _this11 = _super11.call.apply(_super11, [this].concat(args));
186
- _defineProperty(_assertThisInitialized(_this11), "name", 'GetFinalAcknowledgedStateError');
171
+ _this11 = _callSuper(this, GetFinalAcknowledgedStateError, [].concat(args));
172
+ _defineProperty(_this11, "name", 'GetFinalAcknowledgedStateError');
187
173
  return _this11;
188
174
  }
175
+ _inherits(GetFinalAcknowledgedStateError, _CustomError11);
189
176
  return _createClass(GetFinalAcknowledgedStateError);
190
177
  }(CustomError);
191
- export var UpdateDocumentError = /*#__PURE__*/function (_CustomError11) {
192
- _inherits(UpdateDocumentError, _CustomError11);
193
- var _super12 = _createSuper(UpdateDocumentError);
178
+ export var UpdateDocumentError = /*#__PURE__*/function (_CustomError12) {
194
179
  function UpdateDocumentError(message, extraAttributes) {
195
180
  var _this12;
196
181
  _classCallCheck(this, UpdateDocumentError);
197
- _this12 = _super12.call(this, message, undefined, extraAttributes);
198
- _defineProperty(_assertThisInitialized(_this12), "name", 'UpdateDocumentError');
182
+ _this12 = _callSuper(this, UpdateDocumentError, [message, undefined, extraAttributes]);
183
+ _defineProperty(_this12, "name", 'UpdateDocumentError');
199
184
  return _this12;
200
185
  }
186
+ _inherits(UpdateDocumentError, _CustomError12);
201
187
  return _createClass(UpdateDocumentError);
202
188
  }(CustomError);
203
- export var CantSyncUpError = /*#__PURE__*/function (_CustomError12) {
204
- _inherits(CantSyncUpError, _CustomError12);
205
- var _super13 = _createSuper(CantSyncUpError);
189
+ export var CantSyncUpError = /*#__PURE__*/function (_CustomError13) {
206
190
  function CantSyncUpError(message, extraAttributes) {
207
191
  var _this13;
208
192
  _classCallCheck(this, CantSyncUpError);
209
- _this13 = _super13.call(this, message, undefined, extraAttributes);
210
- _defineProperty(_assertThisInitialized(_this13), "name", 'CantSyncUpError');
193
+ _this13 = _callSuper(this, CantSyncUpError, [message, undefined, extraAttributes]);
194
+ _defineProperty(_this13, "name", 'CantSyncUpError');
211
195
  return _this13;
212
196
  }
197
+ _inherits(CantSyncUpError, _CustomError13);
213
198
  return _createClass(CantSyncUpError);
214
199
  }(CustomError);
@@ -44,7 +44,7 @@ export var MetadataService = /*#__PURE__*/function () {
44
44
  this.providerEmitCallback = providerEmitCallback;
45
45
  this.broadcastMetadata = broadcastMetadata;
46
46
  }
47
- _createClass(MetadataService, [{
47
+ return _createClass(MetadataService, [{
48
48
  key: "setTitle",
49
49
  value: function setTitle(title, broadcast) {
50
50
  if (broadcast) {
@@ -65,5 +65,4 @@ export var MetadataService = /*#__PURE__*/function () {
65
65
  this.metadata.editorWidth = editorWidth;
66
66
  }
67
67
  }]);
68
- return MetadataService;
69
68
  }();
@@ -8,7 +8,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
8
8
  import { disconnectedReasonMapper } from '../disconnected-reason-mapper';
9
9
  import { EVENT_ACTION, EVENT_STATUS } from '../helpers/const';
10
10
  import { telepointerFromStep } from './telepointers-helper';
11
- import FeatureGates from '@atlaskit/feature-gate-js-client';
12
11
  import { createParticipantFromPayload as enrichParticipant, PARTICIPANT_UPDATE_INTERVAL } from './participants-helper';
13
12
  import { ParticipantsState } from './participants-state';
14
13
  import { createLogger, isAIProviderID } from '../helpers/utils';
@@ -37,8 +36,7 @@ export var ParticipantsService = /*#__PURE__*/function () {
37
36
  var getAIProviderActiveIds = arguments.length > 8 ? arguments[8] : undefined;
38
37
  _classCallCheck(this, ParticipantsService);
39
38
  _defineProperty(this, "sendAIProviderChanged", function (payload) {
40
- var isFacepileExperimentEnabled = FeatureGates.getExperimentValue('platform_editor_ai_facepile', 'isEnabled', false);
41
- if (isFacepileExperimentEnabled && payload.providerId) {
39
+ if (payload.providerId) {
42
40
  for (var propKey in payload.permit) {
43
41
  if (payload.permit.hasOwnProperty(propKey)) {
44
42
  payload.permit[propKey] = false;
@@ -148,29 +146,27 @@ export var ParticipantsService = /*#__PURE__*/function () {
148
146
  * We emit the `presence` event to update the active avatars in the editor.
149
147
  */
150
148
  _defineProperty(this, "onParticipantLeft", function (payload) {
149
+ var _payload$data;
151
150
  var sessionId = payload.sessionId;
152
- var isFacepileExperimentEnabled = FeatureGates.getExperimentValue('platform_editor_ai_facepile', 'isEnabled', false);
153
- if (isFacepileExperimentEnabled) {
154
- var _payload$data;
155
- // When an agent leaves a session, the backend service returns the original user's
156
- // session ID accompanied by a payload containing the agent's session ID.
157
- // If the user session leaves, we also want to remove all agent sessions associated.
158
- if (payload !== null && payload !== void 0 && (_payload$data = payload.data) !== null && _payload$data !== void 0 && _payload$data.sessionId && isAIProviderID(payload.data.sessionId)) {
159
- sessionId = payload.data.sessionId;
160
- } else {
161
- var associatedAgents = _this.getAIProviderParticipants().filter(function (ap) {
162
- return ap.sessionId.endsWith(sessionId);
163
- });
164
- associatedAgents.forEach(function (agent) {
165
- _this.onParticipantLeft({
166
- sessionId: sessionId,
167
- timestamp: payload.timestamp,
168
- data: agent,
169
- userId: undefined,
170
- clientId: ''
171
- });
151
+
152
+ // When an agent leaves a session, the backend service returns the original user's
153
+ // session ID accompanied by a payload containing the agent's session ID.
154
+ // If the user session leaves, we also want to remove all agent sessions associated.
155
+ if (payload !== null && payload !== void 0 && (_payload$data = payload.data) !== null && _payload$data !== void 0 && _payload$data.sessionId && isAIProviderID(payload.data.sessionId)) {
156
+ sessionId = payload.data.sessionId;
157
+ } else {
158
+ var associatedAgents = _this.getAIProviderParticipants().filter(function (ap) {
159
+ return ap.sessionId.endsWith(sessionId);
160
+ });
161
+ associatedAgents.forEach(function (agent) {
162
+ _this.onParticipantLeft({
163
+ sessionId: sessionId,
164
+ timestamp: payload.timestamp,
165
+ data: agent,
166
+ userId: undefined,
167
+ clientId: ''
172
168
  });
173
- }
169
+ });
174
170
  }
175
171
  _this.participantsState.removeBySessionId(sessionId);
176
172
  _this.emitPresence({
@@ -398,7 +394,7 @@ export var ParticipantsService = /*#__PURE__*/function () {
398
394
  this.setUserId = setUserId;
399
395
  this.getAIProviderActiveIds = getAIProviderActiveIds;
400
396
  }
401
- _createClass(ParticipantsService, [{
397
+ return _createClass(ParticipantsService, [{
402
398
  key: "emitTelepointersFromSteps",
403
399
  value:
404
400
  /**
@@ -415,5 +411,4 @@ export var ParticipantsService = /*#__PURE__*/function () {
415
411
  });
416
412
  }
417
413
  }]);
418
- return ParticipantsService;
419
414
  }();
@@ -1,17 +1,17 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _get from "@babel/runtime/helpers/get";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ import _get from "@babel/runtime/helpers/get";
7
+ import _inherits from "@babel/runtime/helpers/inherits";
9
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
9
  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; }
11
10
  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; }
12
11
  import _regeneratorRuntime from "@babel/runtime/regenerator";
13
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
12
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
14
13
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
15
15
  import { v4 as uuidv4 } from 'uuid';
16
16
  import { Emitter } from '../emitter';
17
17
  import { Channel } from '../channel';
@@ -37,19 +37,17 @@ var OUT_OF_SYNC_PERIOD = 3 * 1000; // 3 seconds
37
37
  export var MAX_STEP_REJECTED_ERROR = 15;
38
38
  export var MAX_STEP_REJECTED_ERROR_AGGRESSIVE = 2;
39
39
  export var Provider = /*#__PURE__*/function (_Emitter) {
40
- _inherits(Provider, _Emitter);
41
- var _super = _createSuper(Provider);
42
40
  function Provider(config) {
43
41
  var _this$config$productI;
44
42
  var _this;
45
43
  _classCallCheck(this, Provider);
46
- _this = _super.call(this);
47
- _defineProperty(_assertThisInitialized(_this), "isChannelInitialized", false);
48
- _defineProperty(_assertThisInitialized(_this), "isProviderInitialized", false);
49
- _defineProperty(_assertThisInitialized(_this), "isBuffered", false);
44
+ _this = _callSuper(this, Provider);
45
+ _defineProperty(_this, "isChannelInitialized", false);
46
+ _defineProperty(_this, "isProviderInitialized", false);
47
+ _defineProperty(_this, "isBuffered", false);
50
48
  // User permit is used to determine if the user is allowed to view, comment or edit the document
51
49
  // Therefore, the initial value is false for all three
52
- _defineProperty(_assertThisInitialized(_this), "permit", {
50
+ _defineProperty(_this, "permit", {
53
51
  isPermittedToView: false,
54
52
  isPermittedToComment: false,
55
53
  isPermittedToEdit: false
@@ -57,16 +55,16 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
57
55
  // isBufferingEnabled is a boolean value passed to the config during provider creation.
58
56
  // It determines if the provider should initialize immediately and will only be true if:
59
57
  // the feature flag is enabled and the initial draft fetched from NCS is also passed in the config.
60
- _defineProperty(_assertThisInitialized(_this), "isBufferingEnabled", false);
58
+ _defineProperty(_this, "isBufferingEnabled", false);
61
59
  // Local IDs of active AI Providers
62
- _defineProperty(_assertThisInitialized(_this), "aiProviderActiveIds", []);
60
+ _defineProperty(_this, "aiProviderActiveIds", []);
63
61
  /**
64
62
  * Wrapper for this.emit, it binds scope for callbacks and waits for initialising of the editor before emitting events.
65
63
  * Waiting for the collab provider to become connected to the editor ensures the editor doesn't miss any events.
66
64
  * @param evt - Event name to emit to subscribers
67
65
  * @param data - Event data to emit to subscribers
68
66
  */
69
- _defineProperty(_assertThisInitialized(_this), "emitCallback", function (evt, data) {
67
+ _defineProperty(_this, "emitCallback", function (evt, data) {
70
68
  return _this.emit(evt, data);
71
69
  });
72
70
  /**
@@ -74,7 +72,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
74
72
  * Catches and logs any errors thrown by document service's updateDocument and updateMetadata methods and destroys the provider in case of errors.
75
73
  * Passing the document, metadata, version (either from the initial draft or from collab service)
76
74
  */
77
- _defineProperty(_assertThisInitialized(_this), "updateDocumentAndMetadata", function (_ref) {
75
+ _defineProperty(_this, "updateDocumentAndMetadata", function (_ref) {
78
76
  var doc = _ref.doc,
79
77
  version = _ref.version,
80
78
  metadata = _ref.metadata;
@@ -93,7 +91,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
93
91
  _this.destroy();
94
92
  }
95
93
  });
96
- _defineProperty(_assertThisInitialized(_this), "initializeChannel", function () {
94
+ _defineProperty(_this, "initializeChannel", function () {
97
95
  _this.emit('connecting', {
98
96
  initial: true
99
97
  });
@@ -154,12 +152,12 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
154
152
  _this.emit('permission', permit);
155
153
  }).on('steps:added', _this.documentService.onStepsAdded).on('metadata:changed', _this.metadataService.onMetadataChanged).on('participant:telepointer', function (payload) {
156
154
  return _this.participantsService.onParticipantTelepointer(payload, _this.sessionId);
157
- }).on('participant:activity-join', _this.participantsService.onParticipantActivityJoin).on('participant:activity-ack', _this.participantsService.onParticipantActivityAck).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(_assertThisInitialized(_this))).on('error', _this.onErrorHandled).on('status', _this.namespaceService.onNamespaceStatusChanged).connect(shouldSkipDocumentInit);
155
+ }).on('participant:activity-join', _this.participantsService.onParticipantActivityJoin).on('participant:activity-ack', _this.participantsService.onParticipantActivityAck).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', _this.namespaceService.onNamespaceStatusChanged).connect(shouldSkipDocumentInit);
158
156
  });
159
- _defineProperty(_assertThisInitialized(_this), "setUserId", function (id) {
157
+ _defineProperty(_this, "setUserId", function (id) {
160
158
  _this.userId = id;
161
159
  });
162
- _defineProperty(_assertThisInitialized(_this), "getPresenceData", function () {
160
+ _defineProperty(_this, "getPresenceData", function () {
163
161
  return {
164
162
  sessionId: _this.sessionId,
165
163
  userId: _this.userId,
@@ -172,7 +170,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
172
170
  /**
173
171
  * @param {InternalError} error The error to handle
174
172
  */
175
- _defineProperty(_assertThisInitialized(_this), "onErrorHandled", function (error) {
173
+ _defineProperty(_this, "onErrorHandled", function (error) {
176
174
  var _error$data, _error$data2;
177
175
  // User tried committing steps but they were rejected because:
178
176
  // HEAD_VERSION_UPDATE_FAILED: the collab service's latest stored step tail version didn't correspond to the head version of the first step submitted
@@ -191,11 +189,11 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
191
189
  }
192
190
  }
193
191
  });
194
- _defineProperty(_assertThisInitialized(_this), "getAIProviderActiveIds", function () {
192
+ _defineProperty(_this, "getAIProviderActiveIds", function () {
195
193
  return _this.aiProviderActiveIds;
196
194
  });
197
195
  // Note: this gets triggered on page reload for Firefox (not other browsers) because of closeOnBeforeunload: false
198
- _defineProperty(_assertThisInitialized(_this), "onDisconnected", function (_ref4) {
196
+ _defineProperty(_this, "onDisconnected", function (_ref4) {
199
197
  var reason = _ref4.reason;
200
198
  _this.disconnectedAt = Date.now();
201
199
  _this.participantsService.disconnect(reason, _this.sessionId);
@@ -203,7 +201,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
203
201
  /**
204
202
  * Returns the documents metadata
205
203
  */
206
- _defineProperty(_assertThisInitialized(_this), "getMetadata", function () {
204
+ _defineProperty(_this, "getMetadata", function () {
207
205
  return _this.metadataService.getMetaData();
208
206
  });
209
207
  /**
@@ -211,7 +209,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
211
209
  * Used for draft sync, a process running every 5s for the first editor of a document to sync the document to the Confluence back-end.
212
210
  * @throws {GetCurrentStateError} Something went wrong while returning the current state
213
211
  */
214
- _defineProperty(_assertThisInitialized(_this), "getCurrentState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
212
+ _defineProperty(_this, "getCurrentState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
215
213
  var _this$analyticsHelper5;
216
214
  return _regeneratorRuntime.wrap(function _callee$(_context) {
217
215
  while (1) switch (_context.prev = _context.next) {
@@ -237,7 +235,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
237
235
  * Used when returning the document to Confluence on publish.
238
236
  * @throws {GetFinalAcknowledgedStateError} Something went wrong while returning the acknowledged state
239
237
  */
240
- _defineProperty(_assertThisInitialized(_this), "getFinalAcknowledgedState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
238
+ _defineProperty(_this, "getFinalAcknowledgedState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
241
239
  var _this$analyticsHelper6;
242
240
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
243
241
  while (1) switch (_context2.prev = _context2.next) {
@@ -258,7 +256,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
258
256
  }
259
257
  }, _callee2, null, [[0, 6]]);
260
258
  })));
261
- _defineProperty(_assertThisInitialized(_this), "getUnconfirmedSteps", function () {
259
+ _defineProperty(_this, "getUnconfirmedSteps", function () {
262
260
  return _this.documentService.getUnconfirmedSteps();
263
261
  });
264
262
  /**
@@ -266,26 +264,26 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
266
264
  *
267
265
  * @returns {number} Returns the current ProseMirror version from the Editor State
268
266
  */
269
- _defineProperty(_assertThisInitialized(_this), "getCurrentPmVersion", function () {
267
+ _defineProperty(_this, "getCurrentPmVersion", function () {
270
268
  return _this.documentService.getCurrentPmVersion();
271
269
  });
272
270
  /**
273
271
  * Used when the provider is disconnected or destroyed to prevent perpetual timers from continuously running
274
272
  */
275
- _defineProperty(_assertThisInitialized(_this), "clearTimers", function () {
273
+ _defineProperty(_this, "clearTimers", function () {
276
274
  clearTimeout(_this.presenceUpdateTimeout);
277
275
  _this.participantsService.clearTimers();
278
276
  });
279
277
  /**
280
278
  *
281
279
  */
282
- _defineProperty(_assertThisInitialized(_this), "getParticipants", function () {
280
+ _defineProperty(_this, "getParticipants", function () {
283
281
  return _this.participantsService.getParticipants();
284
282
  });
285
- _defineProperty(_assertThisInitialized(_this), "getAIProviderParticipants", function () {
283
+ _defineProperty(_this, "getAIProviderParticipants", function () {
286
284
  return _this.participantsService.getAIProviderParticipants();
287
285
  });
288
- _defineProperty(_assertThisInitialized(_this), "getSessionId", function () {
286
+ _defineProperty(_this, "getSessionId", function () {
289
287
  return _this.sessionId;
290
288
  });
291
289
  _this.config = config;
@@ -318,7 +316,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
318
316
  }, 5000);
319
317
  return _this;
320
318
  }
321
- _createClass(Provider, [{
319
+ _inherits(Provider, _Emitter);
320
+ return _createClass(Provider, [{
322
321
  key: "initialize",
323
322
  value:
324
323
  // eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
@@ -548,7 +547,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
548
547
  key: "unsubscribeAll",
549
548
  value: function unsubscribeAll() {
550
549
  try {
551
- _get(_getPrototypeOf(Provider.prototype), "unsubscribeAll", this).call(this);
550
+ _superPropGet(Provider, "unsubscribeAll", this, 3)([]);
552
551
  this.channel.disconnect();
553
552
  if (this.sendStepsTimer) {
554
553
  clearInterval(this.sendStepsTimer);
@@ -635,7 +634,6 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
635
634
  return this.namespaceService.getIsNamespaceLocked();
636
635
  }
637
636
  }]);
638
- return Provider;
639
637
  }(Emitter);
640
638
 
641
639
  /**
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "10.2.2";
2
+ export var version = "10.3.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "10.2.2",
3
+ "version": "10.3.1",
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": "^96.4.0",
37
+ "@atlaskit/editor-common": "^97.0.0",
38
38
  "@atlaskit/editor-json-transformer": "^8.21.0",
39
39
  "@atlaskit/editor-prosemirror": "6.2.1",
40
40
  "@atlaskit/feature-gate-js-client": "^4.22.0",