@atlaskit/collab-provider 19.0.4 → 19.0.6

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.
@@ -100,28 +100,28 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
100
100
  */
101
101
  (0, _defineProperty2.default)(this, "catchupv2", /*#__PURE__*/function () {
102
102
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(reason, reconnectionMetadata, sessionId) {
103
- var start, _this$analyticsHelper2, latency, _latency, errorMessage, _this$analyticsHelper3;
104
- return _regenerator.default.wrap(function _callee$(_context) {
103
+ var start, _this$analyticsHelper2, latency, _latency, errorMessage, _this$analyticsHelper3, _t;
104
+ return _regenerator.default.wrap(function (_context) {
105
105
  while (1) switch (_context.prev = _context.next) {
106
106
  case 0:
107
107
  start = new Date().getTime(); // if the queue is already paused, we are busy with something else, so don't proceed.
108
108
  if (!_this.stepQueue.isPaused()) {
109
- _context.next = 4;
109
+ _context.next = 1;
110
110
  break;
111
111
  }
112
112
  logger("Queue is paused. Aborting.");
113
113
  return _context.abrupt("return");
114
- case 4:
114
+ case 1:
115
115
  if (!_this.isNameSpaceLocked()) {
116
- _context.next = 7;
116
+ _context.next = 2;
117
117
  break;
118
118
  }
119
119
  logger("catchupv2: Document is locked. Aborting.");
120
120
  return _context.abrupt("return");
121
- case 7:
121
+ case 2:
122
122
  _this.stepQueue.pauseQueue();
123
- _context.prev = 8;
124
- _context.next = 11;
123
+ _context.prev = 3;
124
+ _context.next = 4;
125
125
  return (0, _catchupv.catchupv2)({
126
126
  getCurrentPmVersion: _this.getCurrentPmVersion,
127
127
  fetchCatchupv2: _this.fetchCatchupv2,
@@ -144,21 +144,21 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
144
144
  },
145
145
  getState: _this.getState
146
146
  });
147
- case 11:
147
+ case 4:
148
148
  _this.catchUpOutofSync = _context.sent;
149
149
  latency = new Date().getTime() - start;
150
150
  (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.SUCCESS, {
151
151
  latency: latency,
152
152
  version: _this.getCurrentPmVersion()
153
153
  });
154
- _context.next = 21;
154
+ _context.next = 6;
155
155
  break;
156
- case 16:
157
- _context.prev = 16;
158
- _context.t0 = _context["catch"](8);
156
+ case 5:
157
+ _context.prev = 5;
158
+ _t = _context["catch"](3);
159
159
  _latency = new Date().getTime() - start; // Skip client side errors; TypeErrors are client side errors https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch
160
- errorMessage = _context.t0 instanceof Error ? _context.t0.message : String(_context.t0);
161
- if (!errorMessage.includes('TypeError') && !(_context.t0 instanceof TypeError)) {
160
+ errorMessage = _t instanceof Error ? _t.message : String(_t);
161
+ if (!errorMessage.includes('TypeError') && !(_t instanceof TypeError)) {
162
162
  (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
163
163
  latency: _latency,
164
164
  reason: reason,
@@ -166,18 +166,18 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
166
166
  disconnectionPeriodSeconds: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.disconnectionPeriodSeconds
167
167
  });
168
168
  }
169
- case 21:
170
- _context.prev = 21;
169
+ case 6:
170
+ _context.prev = 6;
171
171
  _this.stepQueue.resumeQueue();
172
172
  _this.processQueue();
173
173
  _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
174
174
  _this.stepRejectCounter = 0;
175
- return _context.finish(21);
176
- case 27:
175
+ return _context.finish(6);
176
+ case 7:
177
177
  case "end":
178
178
  return _context.stop();
179
179
  }
180
- }, _callee, null, [[8, 16, 21, 27]]);
180
+ }, _callee, null, [[3, 5, 6, 7]]);
181
181
  }));
182
182
  return function (_x, _x2, _x3) {
183
183
  return _ref.apply(this, arguments);
@@ -196,8 +196,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
196
196
  // Ignored via go/ees005
197
197
  // eslint-disable-next-line require-await
198
198
  (0, _defineProperty2.default)(this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
199
- var _this$getState2, _this$analyticsHelper6, _this$analyticsHelper5, state, adfDocument, version, currentState, measure, _this$analyticsHelper7, _this$analyticsHelper8, _measure;
200
- return _regenerator.default.wrap(function _callee2$(_context2) {
199
+ var _this$getState2, _this$analyticsHelper6, _this$analyticsHelper5, state, adfDocument, version, currentState, measure, _this$analyticsHelper7, _this$analyticsHelper8, _measure, _t2;
200
+ return _regenerator.default.wrap(function (_context2) {
201
201
  while (1) switch (_context2.prev = _context2.next) {
202
202
  case 0:
203
203
  _context2.prev = 0;
@@ -222,20 +222,20 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
222
222
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
223
223
  });
224
224
  return _context2.abrupt("return", currentState);
225
- case 12:
226
- _context2.prev = 12;
227
- _context2.t0 = _context2["catch"](0);
225
+ case 1:
226
+ _context2.prev = 1;
227
+ _t2 = _context2["catch"](0);
228
228
  _measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
229
229
  (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
230
230
  latency: _measure === null || _measure === void 0 ? void 0 : _measure.duration
231
231
  });
232
- (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
233
- throw _context2.t0;
234
- case 18:
232
+ (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(_t2, 'Error while returning ADF version of current draft document');
233
+ throw _t2;
234
+ case 2:
235
235
  case "end":
236
236
  return _context2.stop();
237
237
  }
238
- }, _callee2, null, [[0, 12]]);
238
+ }, _callee2, null, [[0, 1]]);
239
239
  })));
240
240
  (0, _defineProperty2.default)(this, "isStepsFromNewClientIdForSameUserId", function (steps) {
241
241
  try {
@@ -365,8 +365,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
365
365
  // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
366
366
  (0, _defineProperty2.default)(this, "onRestore", /*#__PURE__*/function () {
367
367
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref6) {
368
- var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$obfuscateStepsA, obfuscatedSteps, obfuscatedDoc, _this$analyticsHelper15, _this$analyticsHelper11, _this$getState5, generatedDiffStepsResponse, generatedSteps, state, stepsToBeApplied, _this$analyticsHelper12, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper16, _this$analyticsHelper17;
369
- return _regenerator.default.wrap(function _callee3$(_context3) {
368
+ var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$obfuscateStepsA, obfuscatedSteps, obfuscatedDoc, _this$analyticsHelper15, _this$analyticsHelper11, _this$getState5, generatedDiffStepsResponse, generatedSteps, state, stepsToBeApplied, _this$analyticsHelper12, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper16, _this$analyticsHelper17, _t3, _t4, _t5;
369
+ return _regenerator.default.wrap(function (_context3) {
370
370
  while (1) switch (_context3.prev = _context3.next) {
371
371
  case 0:
372
372
  doc = _ref6.doc, version = _ref6.version, metadata = _ref6.metadata, targetClientId = _ref6.targetClientId;
@@ -374,21 +374,21 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
374
374
  _this.hasRecovered = true;
375
375
  }
376
376
  if (!(targetClientId && _this.clientId !== targetClientId)) {
377
- _context3.next = 4;
377
+ _context3.next = 1;
378
378
  break;
379
379
  }
380
380
  return _context3.abrupt("return");
381
- case 4:
381
+ case 1:
382
382
  // We preserve these as they will be lost apon this.updateDocument. This is because we are using document recovery.
383
383
  // We can then reconcile the document with the preserved state.
384
384
  unconfirmedSteps = _this.getUnconfirmedSteps();
385
- _context3.next = 7;
385
+ _context3.next = 2;
386
386
  return _this.getCurrentState();
387
- case 7:
387
+ case 2:
388
388
  currentState = _context3.sent;
389
389
  useReconcile = Boolean((unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) && currentState && !targetClientId);
390
390
  _this$obfuscateStepsA = _this.obfuscateStepsAndState(unconfirmedSteps, currentState), obfuscatedSteps = _this$obfuscateStepsA.obfuscatedSteps, obfuscatedDoc = _this$obfuscateStepsA.obfuscatedDoc;
391
- _context3.prev = 10;
391
+ _context3.prev = 3;
392
392
  // Reset the editor,
393
393
  // - Replace the document, keep in sync with the server
394
394
  // - Replace the version number, so editor is in sync with NCS server and can commit new changes.
@@ -403,7 +403,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
403
403
  caller: 'onRestore'
404
404
  });
405
405
  _this.metadataService.updateMetadata(metadata);
406
- _context3.prev = 13;
406
+ _context3.prev = 4;
407
407
  (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
408
408
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
409
409
  obfuscatedSteps: obfuscatedSteps,
@@ -416,11 +416,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
416
416
  if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
417
417
  _this.applyLocalSteps(unconfirmedSteps);
418
418
  }
419
- _context3.next = 34;
419
+ _context3.next = 9;
420
420
  break;
421
- case 18:
422
- _context3.prev = 18;
423
- _context3.t0 = _context3["catch"](13);
421
+ case 5:
422
+ _context3.prev = 5;
423
+ _t3 = _context3["catch"](4);
424
424
  // Extract generatedSteps from fetchReconcile response
425
425
  // and apply them to the editor state.
426
426
  _this.onErrorHandled({
@@ -433,10 +433,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
433
433
  }
434
434
  });
435
435
  useReconcile = false;
436
- _context3.prev = 22;
437
- _context3.next = 25;
436
+ _context3.prev = 6;
437
+ _context3.next = 7;
438
438
  return _this.fetchGeneratedDiffSteps(JSON.stringify(currentState.content), 'fe-restore-fetch-generated-steps');
439
- case 25:
439
+ case 7:
440
440
  generatedDiffStepsResponse = _context3.sent;
441
441
  generatedSteps = generatedDiffStepsResponse.generatedSteps;
442
442
  state = (_this$getState5 = _this.getState) === null || _this$getState5 === void 0 ? void 0 : _this$getState5.call(_this);
@@ -455,13 +455,13 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
455
455
  });
456
456
  }
457
457
  }
458
- _context3.next = 34;
458
+ _context3.next = 9;
459
459
  break;
460
- case 31:
461
- _context3.prev = 31;
462
- _context3.t1 = _context3["catch"](22);
463
- (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
464
- case 34:
460
+ case 8:
461
+ _context3.prev = 8;
462
+ _t4 = _context3["catch"](6);
463
+ (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_t4, "Error fetchGeneratedDiffSteps with steps-only mode");
464
+ case 9:
465
465
  (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
466
466
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
467
467
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
@@ -470,11 +470,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
470
470
  targetClientId: targetClientId,
471
471
  triggeredByCatchup: !!targetClientId
472
472
  });
473
- _context3.next = 42;
473
+ _context3.next = 11;
474
474
  break;
475
- case 37:
476
- _context3.prev = 37;
477
- _context3.t2 = _context3["catch"](10);
475
+ case 10:
476
+ _context3.prev = 10;
477
+ _t5 = _context3["catch"](3);
478
478
  (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
479
479
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
480
480
  useReconcile: useReconcile,
@@ -482,7 +482,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
482
482
  targetClientId: targetClientId,
483
483
  triggeredByCatchup: !!targetClientId
484
484
  });
485
- (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
485
+ (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(_t5, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
486
486
  _this.onErrorHandled({
487
487
  message: 'Caught error while trying to recover the document',
488
488
  data: {
@@ -491,11 +491,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
491
491
  code: _internalErrors.INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR
492
492
  }
493
493
  });
494
- case 42:
494
+ case 11:
495
495
  case "end":
496
496
  return _context3.stop();
497
497
  }
498
- }, _callee3, null, [[10, 37], [13, 18], [22, 31]]);
498
+ }, _callee3, null, [[3, 10], [4, 5], [6, 8]]);
499
499
  }));
500
500
  return function (_x4) {
501
501
  return _ref7.apply(this, arguments);
@@ -503,61 +503,61 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
503
503
  }());
504
504
  (0, _defineProperty2.default)(this, "getFinalAcknowledgedState", /*#__PURE__*/function () {
505
505
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(reason) {
506
- var _this$analyticsHelper18, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper19, _this$analyticsHelper20, _measure2;
507
- return _regenerator.default.wrap(function _callee4$(_context4) {
506
+ var _this$analyticsHelper18, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper19, _this$analyticsHelper20, _measure2, _t6, _t7;
507
+ return _regenerator.default.wrap(function (_context4) {
508
508
  while (1) switch (_context4.prev = _context4.next) {
509
509
  case 0:
510
510
  _this.aggressiveCatchup = true;
511
511
  _context4.prev = 1;
512
512
  (0, _performance.startMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
513
- _context4.prev = 3;
514
- _context4.next = 6;
513
+ _context4.prev = 2;
514
+ _context4.next = 3;
515
515
  return _this.commitUnconfirmedSteps(reason);
516
- case 6:
517
- _context4.next = 8;
516
+ case 3:
517
+ _context4.next = 4;
518
518
  return _this.getCurrentState();
519
- case 8:
519
+ case 4:
520
520
  finalAcknowledgedState = _context4.sent;
521
- _context4.next = 20;
521
+ _context4.next = 8;
522
522
  break;
523
- case 11:
524
- _context4.prev = 11;
525
- _context4.t0 = _context4["catch"](3);
526
- _context4.next = 15;
523
+ case 5:
524
+ _context4.prev = 5;
525
+ _t6 = _context4["catch"](2);
526
+ _context4.next = 6;
527
527
  return _this.getCurrentState();
528
- case 15:
528
+ case 6:
529
529
  currentState = _context4.sent;
530
- _context4.next = 18;
530
+ _context4.next = 7;
531
531
  return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-final-ack');
532
- case 18:
532
+ case 7:
533
533
  reconcileResponse = _context4.sent;
534
534
  finalAcknowledgedState = {
535
535
  content: JSON.parse(reconcileResponse.document),
536
536
  title: currentState.title,
537
537
  stepVersion: reconcileResponse.version
538
538
  };
539
- case 20:
539
+ case 8:
540
540
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
541
541
  (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
542
542
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
543
543
  });
544
544
  _this.aggressiveCatchup = false;
545
545
  return _context4.abrupt("return", finalAcknowledgedState);
546
- case 26:
547
- _context4.prev = 26;
548
- _context4.t1 = _context4["catch"](1);
546
+ case 9:
547
+ _context4.prev = 9;
548
+ _t7 = _context4["catch"](1);
549
549
  _this.aggressiveCatchup = false;
550
550
  _measure2 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
551
551
  (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
552
552
  latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
553
553
  });
554
- (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
555
- throw _context4.t1;
556
- case 33:
554
+ (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendErrorEvent(_t7, 'Error while returning ADF version of the final draft document');
555
+ throw _t7;
556
+ case 10:
557
557
  case "end":
558
558
  return _context4.stop();
559
559
  }
560
- }, _callee4, null, [[1, 26], [3, 11]]);
560
+ }, _callee4, null, [[1, 9], [2, 5]]);
561
561
  }));
562
562
  return function (_x5) {
563
563
  return _ref8.apply(this, arguments);
@@ -659,14 +659,14 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
659
659
  */
660
660
  (0, _defineProperty2.default)(this, "commitUnconfirmedSteps", /*#__PURE__*/function () {
661
661
  var _ref0 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(reason) {
662
- var unconfirmedSteps, _this$getState7, _this$analyticsHelper25, count, unconfirmedTrs, lastTr, isLastTrConfirmed, _this$analyticsHelper24, nextUnconfirmedSteps, nextUnconfirmedTrs, _this$getUnconfirmedS, state, version, unconfirmedStepsInfoUGCRemoved, error, measure, _this$analyticsHelper26, _this$analyticsHelper27, _measure3;
663
- return _regenerator.default.wrap(function _callee5$(_context5) {
662
+ var unconfirmedSteps, _this$getState7, _this$analyticsHelper25, count, unconfirmedTrs, lastTr, isLastTrConfirmed, _this$analyticsHelper24, nextUnconfirmedSteps, nextUnconfirmedTrs, _this$getUnconfirmedS, state, version, unconfirmedStepsInfoUGCRemoved, error, measure, _this$analyticsHelper26, _this$analyticsHelper27, _measure3, _t8;
663
+ return _regenerator.default.wrap(function (_context5) {
664
664
  while (1) switch (_context5.prev = _context5.next) {
665
665
  case 0:
666
666
  unconfirmedSteps = _this.getUnconfirmedSteps();
667
667
  _context5.prev = 1;
668
668
  if (!(unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length)) {
669
- _context5.next = 24;
669
+ _context5.next = 6;
670
670
  break;
671
671
  }
672
672
  (0, _performance.startMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
@@ -680,16 +680,16 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
680
680
  if (!((_this$getState7 = _this.getState) !== null && _this$getState7 !== void 0 && _this$getState7.call(_this))) {
681
681
  (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
682
682
  }
683
- case 9:
683
+ case 2:
684
684
  if (isLastTrConfirmed) {
685
- _context5.next = 22;
685
+ _context5.next = 5;
686
686
  break;
687
687
  }
688
688
  // this makes all commitUnconfirmedSteps skip the waiting time, which means draft-sync is sped up too.
689
689
  _this.sendStepsFromCurrentState(undefined, 'publish');
690
- _context5.next = 13;
690
+ _context5.next = 3;
691
691
  return (0, _utils.sleep)(500);
692
- case 13:
692
+ case 3:
693
693
  nextUnconfirmedSteps = _this.getUnconfirmedSteps();
694
694
  if (nextUnconfirmedSteps !== null && nextUnconfirmedSteps !== void 0 && nextUnconfirmedSteps.length) {
695
695
  nextUnconfirmedTrs = _this.getUnconfirmedStepsOrigins();
@@ -700,7 +700,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
700
700
  isLastTrConfirmed = true;
701
701
  }
702
702
  if (!(!isLastTrConfirmed && count++ >= _const.ACK_MAX_TRY)) {
703
- _context5.next = 20;
703
+ _context5.next = 4;
704
704
  break;
705
705
  }
706
706
  if (_this.onSyncUpError) {
@@ -723,34 +723,34 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
723
723
  unconfirmedStepsInfo: unconfirmedStepsInfoUGCRemoved ? JSON.stringify(unconfirmedStepsInfoUGCRemoved) : 'Unable to generate UGC removed step info'
724
724
  });
725
725
  throw error;
726
- case 20:
727
- _context5.next = 9;
726
+ case 4:
727
+ _context5.next = 2;
728
728
  break;
729
- case 22:
729
+ case 5:
730
730
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
731
731
  (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
732
732
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
733
733
  // upon success, emit the total number of unconfirmed steps we synced
734
734
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
735
735
  });
736
- case 24:
737
- _context5.next = 32;
736
+ case 6:
737
+ _context5.next = 8;
738
738
  break;
739
- case 26:
740
- _context5.prev = 26;
741
- _context5.t0 = _context5["catch"](1);
739
+ case 7:
740
+ _context5.prev = 7;
741
+ _t8 = _context5["catch"](1);
742
742
  _measure3 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
743
743
  (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
744
744
  latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
745
745
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
746
746
  });
747
- (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
748
- throw _context5.t0;
749
- case 32:
747
+ (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendErrorEvent(_t8, 'Error while committing unconfirmed steps');
748
+ throw _t8;
749
+ case 8:
750
750
  case "end":
751
751
  return _context5.stop();
752
752
  }
753
- }, _callee5, null, [[1, 26]]);
753
+ }, _callee5, null, [[1, 7]]);
754
754
  }));
755
755
  return function (_x6) {
756
756
  return _ref0.apply(this, arguments);
@@ -221,8 +221,8 @@ function logObfuscatedSteps(_x, _x2) {
221
221
  }
222
222
  function _logObfuscatedSteps() {
223
223
  _logObfuscatedSteps = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(oldState, newState) {
224
- var _states$new, _states$old, stepsFromOldState, stepsFromNewState, states;
225
- return _regenerator.default.wrap(function _callee$(_context) {
224
+ var _states$new, _states$old, stepsFromOldState, stepsFromNewState, states, _t;
225
+ return _regenerator.default.wrap(function (_context) {
226
226
  while (1) switch (_context.prev = _context.next) {
227
227
  case 0:
228
228
  _context.prev = 0;
@@ -232,36 +232,36 @@ function _logObfuscatedSteps() {
232
232
  new: (0, _prosemirrorCollab.sendableSteps)(newState)
233
233
  };
234
234
  if (!((_states$new = states.new) !== null && _states$new !== void 0 && _states$new.steps)) {
235
- _context.next = 7;
235
+ _context.next = 2;
236
236
  break;
237
237
  }
238
- _context.next = 6;
238
+ _context.next = 1;
239
239
  return toObfuscatedSteps(states.new.steps);
240
- case 6:
240
+ case 1:
241
241
  stepsFromNewState = _context.sent;
242
- case 7:
242
+ case 2:
243
243
  if (!((_states$old = states.old) !== null && _states$old !== void 0 && _states$old.steps)) {
244
- _context.next = 11;
244
+ _context.next = 4;
245
245
  break;
246
246
  }
247
- _context.next = 10;
247
+ _context.next = 3;
248
248
  return toObfuscatedSteps(states.old.steps);
249
- case 10:
249
+ case 3:
250
250
  stepsFromOldState = _context.sent;
251
- case 11:
251
+ case 4:
252
252
  return _context.abrupt("return", {
253
253
  stepsFromOldState: stepsFromOldState,
254
254
  stepsFromNewState: stepsFromNewState
255
255
  });
256
- case 14:
257
- _context.prev = 14;
258
- _context.t0 = _context["catch"](0);
259
- return _context.abrupt("return", new _customErrors.CustomError('Failed to obfuscate steps', _context.t0));
260
- case 17:
256
+ case 5:
257
+ _context.prev = 5;
258
+ _t = _context["catch"](0);
259
+ return _context.abrupt("return", new _customErrors.CustomError('Failed to obfuscate steps', _t));
260
+ case 6:
261
261
  case "end":
262
262
  return _context.stop();
263
263
  }
264
- }, _callee, null, [[0, 14]]);
264
+ }, _callee, null, [[0, 5]]);
265
265
  }));
266
266
  return _logObfuscatedSteps.apply(this, arguments);
267
267
  }
@@ -277,17 +277,17 @@ function toObfuscatedSteps(_x3) {
277
277
  function _toObfuscatedSteps() {
278
278
  _toObfuscatedSteps = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(steps) {
279
279
  var _steps;
280
- return _regenerator.default.wrap(function _callee2$(_context2) {
280
+ return _regenerator.default.wrap(function (_context2) {
281
281
  while (1) switch (_context2.prev = _context2.next) {
282
282
  case 0:
283
- _context2.next = 2;
283
+ _context2.next = 1;
284
284
  return Promise.resolve(steps.slice().map(function (s) {
285
285
  return s.toJSON();
286
286
  }));
287
- case 2:
287
+ case 1:
288
288
  _steps = _context2.sent;
289
289
  return _context2.abrupt("return", JSON.stringify(getObfuscatedSteps(_steps)));
290
- case 4:
290
+ case 2:
291
291
  case "end":
292
292
  return _context2.stop();
293
293
  }
@@ -33,7 +33,7 @@ var NamespaceService = exports.NamespaceService = /*#__PURE__*/(0, _createClass2
33
33
  (0, _defineProperty2.default)(this, "onNamespaceStatusChanged", /*#__PURE__*/function () {
34
34
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
35
35
  var isLocked, waitTimeInMs, timestamp, start;
36
- return _regenerator.default.wrap(function _callee$(_context) {
36
+ return _regenerator.default.wrap(function (_context) {
37
37
  while (1) switch (_context.prev = _context.next) {
38
38
  case 0:
39
39
  isLocked = _ref.isLocked, waitTimeInMs = _ref.waitTimeInMs, timestamp = _ref.timestamp;
@@ -44,7 +44,7 @@ var NamespaceService = exports.NamespaceService = /*#__PURE__*/(0, _createClass2
44
44
  timestamp: timestamp
45
45
  });
46
46
  if (!(isLocked && waitTimeInMs)) {
47
- _context.next = 8;
47
+ _context.next = 1;
48
48
  break;
49
49
  }
50
50
  _this.isNamespaceLocked = true;
@@ -61,10 +61,10 @@ var NamespaceService = exports.NamespaceService = /*#__PURE__*/(0, _createClass2
61
61
  _this.isNamespaceLocked = false;
62
62
  }, waitTimeInMs);
63
63
  return _context.abrupt("return");
64
- case 8:
64
+ case 1:
65
65
  _this.isNamespaceLocked = false;
66
66
  logger("The page lock has expired");
67
- case 10:
67
+ case 2:
68
68
  case "end":
69
69
  return _context.stop();
70
70
  }
@@ -16,13 +16,13 @@ var DEFAULT_BATCH_FETCH_SIZE = 25;
16
16
  var createParticipantFromPayload = exports.createParticipantFromPayload = /*#__PURE__*/function () {
17
17
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(payload, getUser) {
18
18
  var sessionId, timestamp, clientId, userId, permit, presenceId, presenceActivity, user, participant;
19
- return _regenerator.default.wrap(function _callee$(_context) {
19
+ return _regenerator.default.wrap(function (_context) {
20
20
  while (1) switch (_context.prev = _context.next) {
21
21
  case 0:
22
22
  sessionId = payload.sessionId, timestamp = payload.timestamp, clientId = payload.clientId, userId = payload.userId, permit = payload.permit, presenceId = payload.presenceId, presenceActivity = payload.presenceActivity;
23
- _context.next = 3;
23
+ _context.next = 1;
24
24
  return getUser === null || getUser === void 0 ? void 0 : getUser(userId);
25
- case 3:
25
+ case 1:
26
26
  user = _context.sent;
27
27
  participant = {
28
28
  name: (user === null || user === void 0 ? void 0 : user.name) || '',
@@ -39,7 +39,7 @@ var createParticipantFromPayload = exports.createParticipantFromPayload = /*#__P
39
39
  isHydrated: !!user
40
40
  };
41
41
  return _context.abrupt("return", participant);
42
- case 6:
42
+ case 2:
43
43
  case "end":
44
44
  return _context.stop();
45
45
  }
@@ -65,7 +65,7 @@ var createParticipantFromPayload = exports.createParticipantFromPayload = /*#__P
65
65
  var fetchParticipants = exports.fetchParticipants = /*#__PURE__*/function () {
66
66
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(participantsState, batchProps) {
67
67
  var _batchProps$batchSize, batchSize, getUsers, participantsToHydrate, participants, aaids, users, hydratedParticipants;
68
- return _regenerator.default.wrap(function _callee2$(_context2) {
68
+ return _regenerator.default.wrap(function (_context2) {
69
69
  while (1) switch (_context2.prev = _context2.next) {
70
70
  case 0:
71
71
  _batchProps$batchSize = batchProps.batchSize, batchSize = _batchProps$batchSize === void 0 ? DEFAULT_BATCH_FETCH_SIZE : _batchProps$batchSize, getUsers = batchProps.getUsers;
@@ -74,18 +74,18 @@ var fetchParticipants = exports.fetchParticipants = /*#__PURE__*/function () {
74
74
  });
75
75
  participants = participantsToHydrate.splice(0, batchSize);
76
76
  if (participants.length) {
77
- _context2.next = 5;
77
+ _context2.next = 1;
78
78
  break;
79
79
  }
80
80
  return _context2.abrupt("return", []);
81
- case 5:
81
+ case 1:
82
82
  aaids = new Set();
83
83
  participants.forEach(function (p) {
84
84
  aaids.add(p.userId);
85
85
  });
86
- _context2.next = 9;
86
+ _context2.next = 2;
87
87
  return getUsers === null || getUsers === void 0 ? void 0 : getUsers((0, _toConsumableArray2.default)(aaids.values()));
88
- case 9:
88
+ case 2:
89
89
  users = _context2.sent;
90
90
  hydratedParticipants = [];
91
91
  users === null || users === void 0 || users.forEach(function (user) {
@@ -113,7 +113,7 @@ var fetchParticipants = exports.fetchParticipants = /*#__PURE__*/function () {
113
113
  });
114
114
  });
115
115
  return _context2.abrupt("return", hydratedParticipants);
116
- case 13:
116
+ case 3:
117
117
  case "end":
118
118
  return _context2.stop();
119
119
  }