@atlaskit/collab-provider 9.41.0 → 9.41.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.
@@ -19,7 +19,6 @@ var _internalErrors = require("../errors/internal-errors");
19
19
  var _utils = require("../helpers/utils");
20
20
  var _provider = require("../provider");
21
21
  var _commitStep = require("../provider/commit-step");
22
- var _catchup = require("./catchup");
23
22
  var _catchupv = require("./catchupv2");
24
23
  var _stepQueueState = require("./step-queue-state");
25
24
  var _customErrors = require("../errors/custom-errors");
@@ -37,7 +36,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
37
36
  * @param participantsService - The participants service, used when users are detected active when making changes to the document
38
37
  * and to emit their telepointers from steps they add
39
38
  * @param analyticsHelper - Helper for analytics events
40
- * @param fetchCatchup - StepMap based - Function to fetch "catchup" data, data required to rebase current steps to the latest version.
41
39
  * @param fetchCatchupv2 - Step based - Function to fetch "catchupv2" data, data required to rebase current steps to the latest version.
42
40
  * @param fetchReconcile - Function to call "reconcile" from NCS backend
43
41
  * @param providerEmitCallback - Callback for emitting events to listeners on the provider
@@ -47,10 +45,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
47
45
  * @param metadataService
48
46
  * @param enableErrorOnFailedDocumentApply - Enable failed document update exceptions.
49
47
  */
50
- function DocumentService(participantsService, analyticsHelper, fetchCatchup, fetchCatchupv2, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, isNameSpaceLocked) {
48
+ function DocumentService(participantsService, analyticsHelper, fetchCatchupv2, fetchReconcile, providerEmitCallback, broadcast, getUserId, onErrorHandled, metadataService, isNameSpaceLocked) {
51
49
  var _this = this;
52
- var enableErrorOnFailedDocumentApply = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
53
- var options = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : {
50
+ var enableErrorOnFailedDocumentApply = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
51
+ var options = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : {
54
52
  __livePage: false
55
53
  };
56
54
  (0, _classCallCheck2.default)(this, DocumentService);
@@ -58,75 +56,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
58
56
  (0, _defineProperty2.default)(this, "stepRejectCounter", 0);
59
57
  (0, _defineProperty2.default)(this, "aggressiveCatchup", false);
60
58
  (0, _defineProperty2.default)(this, "catchUpOutofSync", false);
61
- /**
62
- * To prevent calling catchup to often, use lodash throttle to reduce the frequency
63
- */
64
- (0, _defineProperty2.default)(this, "throttledCatchup", (0, _throttle.default)(function () {
65
- return _this.catchup();
66
- }, CATCHUP_THROTTLE, {
67
- leading: false,
68
- // TODO: why shouldn't this be leading?
69
- trailing: true
70
- }));
71
- /**
72
- * Called when:
73
- * * session established(offline -> online)
74
- * * try to accept steps but version is behind.
75
- */
76
- (0, _defineProperty2.default)(this, "catchup", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
77
- var start, _this$analyticsHelper, latency, _this$analyticsHelper2, _latency;
78
- return _regenerator.default.wrap(function _callee$(_context) {
79
- while (1) switch (_context.prev = _context.next) {
80
- case 0:
81
- start = new Date().getTime(); // if the queue is already paused, we are busy with something else, so don't proceed.
82
- if (!_this.stepQueue.isPaused()) {
83
- _context.next = 4;
84
- break;
85
- }
86
- logger("Queue is paused. Aborting.");
87
- return _context.abrupt("return");
88
- case 4:
89
- _this.stepQueue.pauseQueue();
90
- _context.prev = 5;
91
- _context.next = 8;
92
- return (0, _catchup.catchup)({
93
- getCurrentPmVersion: _this.getCurrentPmVersion,
94
- fetchCatchup: _this.fetchCatchup,
95
- getUnconfirmedSteps: _this.getUnconfirmedSteps,
96
- filterQueue: _this.stepQueue.filterQueue,
97
- applyLocalSteps: _this.applyLocalSteps,
98
- updateDocument: _this.updateDocument,
99
- updateMetadata: _this.metadataService.updateMetadata,
100
- analyticsHelper: _this.analyticsHelper,
101
- clientId: _this.clientId
102
- });
103
- case 8:
104
- latency = new Date().getTime() - start;
105
- (_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 || _this$analyticsHelper.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.SUCCESS, {
106
- latency: latency
107
- });
108
- _context.next = 16;
109
- break;
110
- case 12:
111
- _context.prev = 12;
112
- _context.t0 = _context["catch"](5);
113
- _latency = new Date().getTime() - start;
114
- (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
115
- latency: _latency
116
- });
117
- case 16:
118
- _context.prev = 16;
119
- _this.stepQueue.resumeQueue();
120
- _this.processQueue();
121
- _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls commitStepQueue which will either catchup on onStepsAdded or onErrorHandled
122
- _this.stepRejectCounter = 0;
123
- return _context.finish(16);
124
- case 22:
125
- case "end":
126
- return _context.stop();
127
- }
128
- }, _callee, null, [[5, 12, 16, 22]]);
129
- })));
130
59
  /**
131
60
  * To prevent calling catchup to often, use lodash throttle to reduce the frequency
132
61
  * @param reason - optional reason to attach.
@@ -145,29 +74,29 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
145
74
  * @param reason - optional reason to attach.
146
75
  */
147
76
  (0, _defineProperty2.default)(this, "catchupv2", /*#__PURE__*/function () {
148
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(reason) {
149
- var start, _this$analyticsHelper3, latency, _this$analyticsHelper4, _latency2;
150
- return _regenerator.default.wrap(function _callee2$(_context2) {
151
- while (1) switch (_context2.prev = _context2.next) {
77
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(reason) {
78
+ var start, _this$analyticsHelper, latency, _this$analyticsHelper2, _latency;
79
+ return _regenerator.default.wrap(function _callee$(_context) {
80
+ while (1) switch (_context.prev = _context.next) {
152
81
  case 0:
153
82
  start = new Date().getTime(); // if the queue is already paused, we are busy with something else, so don't proceed.
154
83
  if (!_this.stepQueue.isPaused()) {
155
- _context2.next = 4;
84
+ _context.next = 4;
156
85
  break;
157
86
  }
158
87
  logger("Queue is paused. Aborting.");
159
- return _context2.abrupt("return");
88
+ return _context.abrupt("return");
160
89
  case 4:
161
90
  if (!_this.isNameSpaceLocked()) {
162
- _context2.next = 7;
91
+ _context.next = 7;
163
92
  break;
164
93
  }
165
94
  logger("catchupv2: Document is locked. Aborting.");
166
- return _context2.abrupt("return");
95
+ return _context.abrupt("return");
167
96
  case 7:
168
97
  _this.stepQueue.pauseQueue();
169
- _context2.prev = 8;
170
- _context2.next = 11;
98
+ _context.prev = 8;
99
+ _context.next = 11;
171
100
  return (0, _catchupv.catchupv2)({
172
101
  getCurrentPmVersion: _this.getCurrentPmVersion,
173
102
  fetchCatchupv2: _this.fetchCatchupv2,
@@ -179,58 +108,58 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
179
108
  reason: reason
180
109
  });
181
110
  case 11:
182
- _this.catchUpOutofSync = _context2.sent;
111
+ _this.catchUpOutofSync = _context.sent;
183
112
  latency = new Date().getTime() - start;
184
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.SUCCESS, {
113
+ (_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 || _this$analyticsHelper.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.SUCCESS, {
185
114
  latency: latency
186
115
  });
187
- _context2.next = 20;
116
+ _context.next = 20;
188
117
  break;
189
118
  case 16:
190
- _context2.prev = 16;
191
- _context2.t0 = _context2["catch"](8);
192
- _latency2 = new Date().getTime() - start;
193
- (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
194
- latency: _latency2
119
+ _context.prev = 16;
120
+ _context.t0 = _context["catch"](8);
121
+ _latency = new Date().getTime() - start;
122
+ (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
123
+ latency: _latency
195
124
  });
196
125
  case 20:
197
- _context2.prev = 20;
126
+ _context.prev = 20;
198
127
  _this.stepQueue.resumeQueue();
199
128
  _this.processQueue();
200
129
  _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
201
130
  _this.stepRejectCounter = 0;
202
- return _context2.finish(20);
131
+ return _context.finish(20);
203
132
  case 26:
204
133
  case "end":
205
- return _context2.stop();
134
+ return _context.stop();
206
135
  }
207
- }, _callee2, null, [[8, 16, 20, 26]]);
136
+ }, _callee, null, [[8, 16, 20, 26]]);
208
137
  }));
209
138
  return function (_x) {
210
- return _ref2.apply(this, arguments);
139
+ return _ref.apply(this, arguments);
211
140
  };
212
141
  }());
213
142
  (0, _defineProperty2.default)(this, "getCurrentPmVersion", function () {
214
143
  var _this$getState;
215
144
  var state = (_this$getState = _this.getState) === null || _this$getState === void 0 ? void 0 : _this$getState.call(_this);
216
145
  if (!state) {
217
- var _this$analyticsHelper5;
218
- (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
146
+ var _this$analyticsHelper3;
147
+ (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
219
148
  return 0;
220
149
  }
221
150
  return _this.getVersionFromCollabState(state, 'collab-provider: getCurrentPmVersion');
222
151
  });
223
- (0, _defineProperty2.default)(this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
224
- var _this$getState2, _this$analyticsHelper7, _this$analyticsHelper6, state, adfDocument, version, currentState, measure, _this$analyticsHelper8, _this$analyticsHelper9, _measure;
225
- return _regenerator.default.wrap(function _callee3$(_context3) {
226
- while (1) switch (_context3.prev = _context3.next) {
152
+ (0, _defineProperty2.default)(this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
153
+ var _this$getState2, _this$analyticsHelper5, _this$analyticsHelper4, state, adfDocument, version, currentState, measure, _this$analyticsHelper6, _this$analyticsHelper7, _measure;
154
+ return _regenerator.default.wrap(function _callee2$(_context2) {
155
+ while (1) switch (_context2.prev = _context2.next) {
227
156
  case 0:
228
- _context3.prev = 0;
157
+ _context2.prev = 0;
229
158
  (0, _performance.startMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
230
159
 
231
160
  // Convert ProseMirror document in Editor state to ADF document
232
161
  if (!((_this$getState2 = _this.getState) !== null && _this$getState2 !== void 0 && _this$getState2.call(_this))) {
233
- (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
162
+ (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
234
163
  }
235
164
  state = _this.getState();
236
165
  adfDocument = new _editorJsonTransformer.JSONTransformer().encode(state.doc);
@@ -241,31 +170,31 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
241
170
  stepVersion: version
242
171
  };
243
172
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
244
- (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
173
+ (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
245
174
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
246
175
  });
247
- return _context3.abrupt("return", currentState);
176
+ return _context2.abrupt("return", currentState);
248
177
  case 12:
249
- _context3.prev = 12;
250
- _context3.t0 = _context3["catch"](0);
178
+ _context2.prev = 12;
179
+ _context2.t0 = _context2["catch"](0);
251
180
  _measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
252
- (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
181
+ (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
253
182
  latency: _measure === null || _measure === void 0 ? void 0 : _measure.duration
254
183
  });
255
- (_this$analyticsHelper9 = _this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(_context3.t0, 'Error while returning ADF version of current draft document');
256
- throw _context3.t0;
184
+ (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
185
+ throw _context2.t0;
257
186
  case 18:
258
187
  case "end":
259
- return _context3.stop();
188
+ return _context2.stop();
260
189
  }
261
- }, _callee3, null, [[0, 12]]);
190
+ }, _callee2, null, [[0, 12]]);
262
191
  })));
263
192
  (0, _defineProperty2.default)(this, "getUnconfirmedStepsOrigins", function () {
264
193
  var _this$getState3, _sendableSteps;
265
194
  var state = (_this$getState3 = _this.getState) === null || _this$getState3 === void 0 ? void 0 : _this$getState3.call(_this);
266
195
  if (!state) {
267
- var _this$analyticsHelper10;
268
- (_this$analyticsHelper10 = _this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedStepsOrigins called without state');
196
+ var _this$analyticsHelper8;
197
+ (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedStepsOrigins called without state');
269
198
  return;
270
199
  }
271
200
  return (_sendableSteps = (0, _prosemirrorCollab.sendableSteps)(state)) === null || _sendableSteps === void 0 ? void 0 : _sendableSteps.origins;
@@ -274,8 +203,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
274
203
  var _this$getState4, _sendableSteps2;
275
204
  var state = (_this$getState4 = _this.getState) === null || _this$getState4 === void 0 ? void 0 : _this$getState4.call(_this);
276
205
  if (!state) {
277
- var _this$analyticsHelper11;
278
- (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedSteps called without state');
206
+ var _this$analyticsHelper9;
207
+ (_this$analyticsHelper9 = _this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedSteps called without state');
279
208
  return;
280
209
  }
281
210
  return (_sendableSteps2 = (0, _prosemirrorCollab.sendableSteps)(state)) === null || _sendableSteps2 === void 0 ? void 0 : _sendableSteps2.steps;
@@ -310,13 +239,13 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
310
239
  _this.stepQueue.queueSteps(data);
311
240
  _this.throttledCatchupv2(_const.CatchupEventReason.STEPS_ADDED);
312
241
  }
313
- _this.participantsService.updateLastActive(data.steps.map(function (_ref4) {
314
- var userId = _ref4.userId;
242
+ _this.participantsService.updateLastActive(data.steps.map(function (_ref3) {
243
+ var userId = _ref3.userId;
315
244
  return userId;
316
245
  }));
317
246
  } catch (stepsAddedError) {
318
- var _this$analyticsHelper12;
319
- (_this$analyticsHelper12 = _this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(stepsAddedError, 'Error while adding steps in the provider');
247
+ var _this$analyticsHelper10;
248
+ (_this$analyticsHelper10 = _this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(stepsAddedError, 'Error while adding steps in the provider');
320
249
  _this.onErrorHandled({
321
250
  message: 'Error while adding steps in the provider',
322
251
  data: {
@@ -329,27 +258,27 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
329
258
  });
330
259
  // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
331
260
  (0, _defineProperty2.default)(this, "onRestore", /*#__PURE__*/function () {
332
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(_ref5) {
333
- var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper15;
334
- return _regenerator.default.wrap(function _callee4$(_context4) {
335
- while (1) switch (_context4.prev = _context4.next) {
261
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref4) {
262
+ var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$analyticsHelper11, _this$analyticsHelper12, _this$analyticsHelper13;
263
+ return _regenerator.default.wrap(function _callee3$(_context3) {
264
+ while (1) switch (_context3.prev = _context3.next) {
336
265
  case 0:
337
- doc = _ref5.doc, version = _ref5.version, metadata = _ref5.metadata, targetClientId = _ref5.targetClientId;
266
+ doc = _ref4.doc, version = _ref4.version, metadata = _ref4.metadata, targetClientId = _ref4.targetClientId;
338
267
  if (!(targetClientId && _this.clientId !== targetClientId)) {
339
- _context4.next = 3;
268
+ _context3.next = 3;
340
269
  break;
341
270
  }
342
- return _context4.abrupt("return");
271
+ return _context3.abrupt("return");
343
272
  case 3:
344
273
  // We preserve these as they will be lost apon this.updateDocument. This is because we are using document recovery.
345
274
  // We can then reconcile the document with the preserved state.
346
275
  unconfirmedSteps = _this.getUnconfirmedSteps();
347
- _context4.next = 6;
276
+ _context3.next = 6;
348
277
  return _this.getCurrentState();
349
278
  case 6:
350
- currentState = _context4.sent;
279
+ currentState = _context3.sent;
351
280
  useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
352
- _context4.prev = 8;
281
+ _context3.prev = 8;
353
282
  // Reset the editor,
354
283
  // - Replace the document, keep in sync with the server
355
284
  // - Replace the version number, so editor is in sync with NCS server and can commit new changes.
@@ -366,13 +295,13 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
366
295
 
367
296
  // If there are unconfirmed steps, attempt to reconcile our current state with with recovered document
368
297
  if (!(useReconcile && currentState)) {
369
- _context4.next = 16;
298
+ _context3.next = 16;
370
299
  break;
371
300
  }
372
- _context4.next = 14;
301
+ _context3.next = 14;
373
302
  return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
374
303
  case 14:
375
- _context4.next = 17;
304
+ _context3.next = 17;
376
305
  break;
377
306
  case 16:
378
307
  if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
@@ -381,25 +310,25 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
381
310
  _this.applyLocalSteps(unconfirmedSteps);
382
311
  }
383
312
  case 17:
384
- (_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
313
+ (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
385
314
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
386
315
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
387
316
  useReconcile: useReconcile,
388
317
  clientId: _this.clientId,
389
318
  targetClientId: targetClientId
390
319
  });
391
- _context4.next = 25;
320
+ _context3.next = 25;
392
321
  break;
393
322
  case 20:
394
- _context4.prev = 20;
395
- _context4.t0 = _context4["catch"](8);
396
- (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
323
+ _context3.prev = 20;
324
+ _context3.t0 = _context3["catch"](8);
325
+ (_this$analyticsHelper12 = _this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
397
326
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
398
327
  useReconcile: useReconcile,
399
328
  clientId: _this.clientId,
400
329
  targetClientId: targetClientId
401
330
  });
402
- (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(_context4.t0, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
331
+ (_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(_context3.t0, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
403
332
  _this.onErrorHandled({
404
333
  message: 'Caught error while trying to recover the document',
405
334
  data: {
@@ -410,43 +339,43 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
410
339
  });
411
340
  case 25:
412
341
  case "end":
413
- return _context4.stop();
342
+ return _context3.stop();
414
343
  }
415
- }, _callee4, null, [[8, 20]]);
344
+ }, _callee3, null, [[8, 20]]);
416
345
  }));
417
346
  return function (_x2) {
418
- return _ref6.apply(this, arguments);
347
+ return _ref5.apply(this, arguments);
419
348
  };
420
349
  }());
421
- (0, _defineProperty2.default)(this, "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
422
- var _this$analyticsHelper16, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper17, _this$analyticsHelper18, _measure2;
423
- return _regenerator.default.wrap(function _callee5$(_context5) {
424
- while (1) switch (_context5.prev = _context5.next) {
350
+ (0, _defineProperty2.default)(this, "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
351
+ var _this$analyticsHelper14, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper15, _this$analyticsHelper16, _measure2;
352
+ return _regenerator.default.wrap(function _callee4$(_context4) {
353
+ while (1) switch (_context4.prev = _context4.next) {
425
354
  case 0:
426
355
  _this.aggressiveCatchup = true;
427
- _context5.prev = 1;
356
+ _context4.prev = 1;
428
357
  (0, _performance.startMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
429
- _context5.prev = 3;
430
- _context5.next = 6;
358
+ _context4.prev = 3;
359
+ _context4.next = 6;
431
360
  return _this.commitUnconfirmedSteps();
432
361
  case 6:
433
- _context5.next = 8;
362
+ _context4.next = 8;
434
363
  return _this.getCurrentState();
435
364
  case 8:
436
- finalAcknowledgedState = _context5.sent;
437
- _context5.next = 20;
365
+ finalAcknowledgedState = _context4.sent;
366
+ _context4.next = 20;
438
367
  break;
439
368
  case 11:
440
- _context5.prev = 11;
441
- _context5.t0 = _context5["catch"](3);
442
- _context5.next = 15;
369
+ _context4.prev = 11;
370
+ _context4.t0 = _context4["catch"](3);
371
+ _context4.next = 15;
443
372
  return _this.getCurrentState();
444
373
  case 15:
445
- currentState = _context5.sent;
446
- _context5.next = 18;
374
+ currentState = _context4.sent;
375
+ _context4.next = 18;
447
376
  return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-final-ack');
448
377
  case 18:
449
- reconcileResponse = _context5.sent;
378
+ reconcileResponse = _context4.sent;
450
379
  finalAcknowledgedState = {
451
380
  content: JSON.parse(reconcileResponse.document),
452
381
  title: currentState.title,
@@ -454,32 +383,32 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
454
383
  };
455
384
  case 20:
456
385
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
457
- (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
386
+ (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
458
387
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
459
388
  });
460
389
  _this.aggressiveCatchup = false;
461
- return _context5.abrupt("return", finalAcknowledgedState);
390
+ return _context4.abrupt("return", finalAcknowledgedState);
462
391
  case 26:
463
- _context5.prev = 26;
464
- _context5.t1 = _context5["catch"](1);
392
+ _context4.prev = 26;
393
+ _context4.t1 = _context4["catch"](1);
465
394
  _this.aggressiveCatchup = false;
466
395
  _measure2 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
467
- (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
396
+ (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
468
397
  latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
469
398
  });
470
- (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendErrorEvent(_context5.t1, 'Error while returning ADF version of the final draft document');
471
- throw _context5.t1;
399
+ (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
400
+ throw _context4.t1;
472
401
  case 33:
473
402
  case "end":
474
- return _context5.stop();
403
+ return _context4.stop();
475
404
  }
476
- }, _callee5, null, [[1, 26], [3, 11]]);
405
+ }, _callee4, null, [[1, 26], [3, 11]]);
477
406
  })));
478
- (0, _defineProperty2.default)(this, "updateDocument", function (_ref8) {
479
- var doc = _ref8.doc,
480
- version = _ref8.version,
481
- metadata = _ref8.metadata,
482
- reserveCursor = _ref8.reserveCursor;
407
+ (0, _defineProperty2.default)(this, "updateDocument", function (_ref7) {
408
+ var doc = _ref7.doc,
409
+ version = _ref7.version,
410
+ metadata = _ref7.metadata,
411
+ reserveCursor = _ref7.reserveCursor;
483
412
  _this.providerEmitCallback('init', _objectSpread({
484
413
  doc: doc,
485
414
  version: version,
@@ -495,7 +424,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
495
424
  // ESS-5023: only emit error event if updated client version is still behind server version
496
425
  // client version could become higher than server version due to user editing or plugin adding steps
497
426
  if (updatedVersion < version) {
498
- var _doc$content, _this$analyticsHelper19;
427
+ var _doc$content, _this$analyticsHelper17;
499
428
  var error = new _customErrors.UpdateDocumentError('Failed to update the document', {
500
429
  newVersion: version,
501
430
  editorVersion: updatedVersion,
@@ -503,7 +432,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
503
432
  docHasContent: (doc === null || doc === void 0 || (_doc$content = doc.content) === null || _doc$content === void 0 ? void 0 : _doc$content.length) >= 1,
504
433
  isDocContentValid: isDocContentValid
505
434
  });
506
- (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendErrorEvent(error, 'Failed to update the document in document service');
435
+ (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(error, 'Failed to update the document in document service');
507
436
  if (_this.enableErrorOnFailedDocumentApply) {
508
437
  _this.onErrorHandled({
509
438
  message: 'The provider failed to apply changes to the editor',
@@ -520,8 +449,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
520
449
  }
521
450
  // Otherwise just fail silently for now
522
451
  } else {
523
- var _this$analyticsHelper20, _doc$content2;
524
- (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendActionEvent(_const.EVENT_ACTION.UPDATE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
452
+ var _this$analyticsHelper18, _doc$content2;
453
+ (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendActionEvent(_const.EVENT_ACTION.UPDATE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
525
454
  newVersion: version,
526
455
  editorVersion: updatedVersion,
527
456
  isDocTruthy: !!doc,
@@ -534,8 +463,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
534
463
  try {
535
464
  var _this$getState5;
536
465
  if (!((_this$getState5 = _this.getState) !== null && _this$getState5 !== void 0 && _this$getState5.call(_this))) {
537
- var _this$analyticsHelper21;
538
- (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
466
+ var _this$analyticsHelper19;
467
+ (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
539
468
  }
540
469
  var state = _this.getState();
541
470
  var content = (doc.content || []).map(function (child) {
@@ -557,15 +486,15 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
557
486
  * Commit the unconfirmed local steps to the back-end service
558
487
  * @throws {Error} Couldn't sync the steps after retrying 30 times
559
488
  */
560
- (0, _defineProperty2.default)(this, "commitUnconfirmedSteps", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
561
- var unconfirmedSteps, _this$getState6, _this$analyticsHelper23, count, unconfirmedTrs, lastTr, isLastTrConfirmed, _this$analyticsHelper22, nextUnconfirmedSteps, nextUnconfirmedTrs, _this$getUnconfirmedS, state, version, unconfirmedStepsInfoUGCRemoved, error, measure, _this$analyticsHelper24, _this$analyticsHelper25, _measure3;
562
- return _regenerator.default.wrap(function _callee6$(_context6) {
563
- while (1) switch (_context6.prev = _context6.next) {
489
+ (0, _defineProperty2.default)(this, "commitUnconfirmedSteps", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
490
+ var unconfirmedSteps, _this$getState6, _this$analyticsHelper21, count, unconfirmedTrs, lastTr, isLastTrConfirmed, _this$analyticsHelper20, nextUnconfirmedSteps, nextUnconfirmedTrs, _this$getUnconfirmedS, state, version, unconfirmedStepsInfoUGCRemoved, error, measure, _this$analyticsHelper22, _this$analyticsHelper23, _measure3;
491
+ return _regenerator.default.wrap(function _callee5$(_context5) {
492
+ while (1) switch (_context5.prev = _context5.next) {
564
493
  case 0:
565
494
  unconfirmedSteps = _this.getUnconfirmedSteps();
566
- _context6.prev = 1;
495
+ _context5.prev = 1;
567
496
  if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
568
- _context6.next = 24;
497
+ _context5.next = 24;
569
498
  break;
570
499
  }
571
500
  (0, _performance.startMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
@@ -577,15 +506,15 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
577
506
  lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
578
507
  isLastTrConfirmed = false;
579
508
  if (!((_this$getState6 = _this.getState) !== null && _this$getState6 !== void 0 && _this$getState6.call(_this))) {
580
- (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
509
+ (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
581
510
  }
582
511
  case 9:
583
512
  if (isLastTrConfirmed) {
584
- _context6.next = 22;
513
+ _context5.next = 22;
585
514
  break;
586
515
  }
587
516
  _this.sendStepsFromCurrentState();
588
- _context6.next = 13;
517
+ _context5.next = 13;
589
518
  return (0, _utils.sleep)(500);
590
519
  case 13:
591
520
  nextUnconfirmedSteps = _this.getUnconfirmedSteps();
@@ -598,7 +527,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
598
527
  isLastTrConfirmed = true;
599
528
  }
600
529
  if (!(!isLastTrConfirmed && count++ >= _const.ACK_MAX_TRY)) {
601
- _context6.next = 20;
530
+ _context5.next = 20;
602
531
  break;
603
532
  }
604
533
  if (_this.onSyncUpError) {
@@ -620,46 +549,46 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
620
549
  });
621
550
  throw error;
622
551
  case 20:
623
- _context6.next = 9;
552
+ _context5.next = 9;
624
553
  break;
625
554
  case 22:
626
555
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
627
- (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
556
+ (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
628
557
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
629
558
  // upon success, emit the total number of unconfirmed steps we synced
630
559
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
631
560
  });
632
561
  case 24:
633
- _context6.next = 32;
562
+ _context5.next = 32;
634
563
  break;
635
564
  case 26:
636
- _context6.prev = 26;
637
- _context6.t0 = _context6["catch"](1);
565
+ _context5.prev = 26;
566
+ _context5.t0 = _context5["catch"](1);
638
567
  _measure3 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
639
- (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
568
+ (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
640
569
  latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
641
570
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
642
571
  });
643
- (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendErrorEvent(_context6.t0, 'Error while committing unconfirmed steps');
644
- throw _context6.t0;
572
+ (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
573
+ throw _context5.t0;
645
574
  case 32:
646
575
  case "end":
647
- return _context6.stop();
576
+ return _context5.stop();
648
577
  }
649
- }, _callee6, null, [[1, 26]]);
578
+ }, _callee5, null, [[1, 26]]);
650
579
  })));
651
580
  (0, _defineProperty2.default)(this, "onStepRejectedError", function () {
652
- var _this$analyticsHelper26;
581
+ var _this$analyticsHelper24;
653
582
  _this.stepRejectCounter++;
654
583
  logger("Steps rejected (tries=".concat(_this.stepRejectCounter, ")"));
655
- (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO, {
584
+ (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO, {
656
585
  count: _this.stepRejectCounter
657
586
  });
658
587
  var maxRetries = _this.aggressiveCatchup ? _provider.MAX_STEP_REJECTED_ERROR_AGGRESSIVE : _provider.MAX_STEP_REJECTED_ERROR;
659
588
  if (_this.stepRejectCounter >= maxRetries) {
660
- var _this$analyticsHelper27;
589
+ var _this$analyticsHelper25;
661
590
  logger("The steps were rejected too many times (tries=".concat(_this.stepRejectCounter, ", limit=").concat(_provider.MAX_STEP_REJECTED_ERROR, "). Trying to catch-up."));
662
- (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendActionEvent(_const.EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO);
591
+ (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendActionEvent(_const.EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO);
663
592
  _this.throttledCatchupv2(_const.CatchupEventReason.STEPS_REJECTED);
664
593
  } else {
665
594
  // If committing steps failed try again automatically in 1s
@@ -673,7 +602,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
673
602
  });
674
603
  this.participantsService = participantsService;
675
604
  this.analyticsHelper = analyticsHelper;
676
- this.fetchCatchup = fetchCatchup;
677
605
  this.fetchCatchupv2 = fetchCatchupv2;
678
606
  this.fetchReconcile = fetchReconcile;
679
607
  this.providerEmitCallback = providerEmitCallback;
@@ -691,15 +619,15 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
691
619
  value: function getVersionFromCollabState(state, resource) {
692
620
  var collabState = (0, _prosemirrorCollab.getCollabState)(state);
693
621
  if (!collabState) {
694
- var _this$analyticsHelper28;
695
- (_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), "".concat(resource, " called without collab state"));
622
+ var _this$analyticsHelper26;
623
+ (_this$analyticsHelper26 = this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), "".concat(resource, " called without collab state"));
696
624
  return 0;
697
625
  }
698
626
 
699
627
  // This should not happen in usual, just add error event in case it happens
700
628
  if (collabState.version === undefined) {
701
- var _this$analyticsHelper29;
702
- (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), "".concat(resource, " called with collab state missing version info"));
629
+ var _this$analyticsHelper27;
630
+ (_this$analyticsHelper27 = this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), "".concat(resource, " called with collab state missing version info"));
703
631
  return 0;
704
632
  }
705
633
  return collabState.version;
@@ -733,8 +661,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
733
661
  logger("Processing data. Version \"".concat(version, "\"."));
734
662
  if (steps !== null && steps !== void 0 && steps.length) {
735
663
  try {
736
- var clientIds = steps.map(function (_ref10) {
737
- var clientId = _ref10.clientId;
664
+ var clientIds = steps.map(function (_ref9) {
665
+ var clientId = _ref9.clientId;
738
666
  return clientId;
739
667
  });
740
668
  this.providerEmitCallback('data', {
@@ -753,19 +681,19 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
753
681
  }, 100);
754
682
  }
755
683
  } catch (error) {
756
- var _this$analyticsHelper30;
684
+ var _this$analyticsHelper28;
757
685
  logger("Processing steps failed with error: ".concat(error, ". Triggering catch up call."));
758
- (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 || _this$analyticsHelper30.sendErrorEvent(error, 'Error while processing steps');
686
+ (_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendErrorEvent(error, 'Error while processing steps');
759
687
  this.throttledCatchupv2(_const.CatchupEventReason.PROCESS_STEPS);
760
688
  }
761
689
  }
762
690
  }
763
691
  }, {
764
692
  key: "setup",
765
- value: function setup(_ref11) {
766
- var getState = _ref11.getState,
767
- onSyncUpError = _ref11.onSyncUpError,
768
- clientId = _ref11.clientId;
693
+ value: function setup(_ref10) {
694
+ var getState = _ref10.getState,
695
+ onSyncUpError = _ref10.onSyncUpError,
696
+ clientId = _ref10.clientId;
769
697
  this.getState = getState;
770
698
  this.onSyncUpError = onSyncUpError || noop;
771
699
  this.clientId = clientId;
@@ -785,8 +713,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
785
713
  var _this$getState7;
786
714
  var state = (_this$getState7 = this.getState) === null || _this$getState7 === void 0 ? void 0 : _this$getState7.call(this);
787
715
  if (!state) {
788
- var _this$analyticsHelper31;
789
- (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 || _this$analyticsHelper31.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
716
+ var _this$analyticsHelper29;
717
+ (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
790
718
  return;
791
719
  }
792
720
  this.send(null, null, state, sendAnalyticsEvent);
@@ -811,8 +739,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
811
739
  // to ensure that analytics events with the number of unconfirmed steps is only
812
740
  // sent once on connection (as opposed to on every step)
813
741
  if (sendAnalyticsEvent) {
814
- var _this$analyticsHelper32;
815
- (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 || _this$analyticsHelper32.sendActionEvent(_const.EVENT_ACTION.HAS_UNCONFIRMED_STEPS, _const.EVENT_STATUS.INFO, {
742
+ var _this$analyticsHelper30;
743
+ (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 || _this$analyticsHelper30.sendActionEvent(_const.EVENT_ACTION.HAS_UNCONFIRMED_STEPS, _const.EVENT_STATUS.INFO, {
816
744
  numUnconfirmedSteps: (unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) || 0
817
745
  });
818
746
  }