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