@atlaskit/collab-provider 11.3.2 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 12.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 11.3.2
4
10
 
5
11
  ### Patch Changes
@@ -63,4 +63,4 @@
63
63
  "path": "../../editor-common/afm-cc/tsconfig.json"
64
64
  }
65
65
  ]
66
- }
66
+ }
@@ -27,7 +27,6 @@ var _customErrors = require("../errors/custom-errors");
27
27
  var _catchupv = require("./catchupv2");
28
28
  var _stepQueueState = require("./step-queue-state");
29
29
  var _getConflictChanges = require("./getConflictChanges");
30
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
31
30
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
32
31
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
33
32
  var CATCHUP_THROTTLE = 1 * 1000; // 1 second
@@ -361,7 +360,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
361
360
  // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
362
361
  (0, _defineProperty2.default)(this, "onRestore", /*#__PURE__*/function () {
363
362
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref6) {
364
- var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$obfuscateStepsA, obfuscatedSteps, obfuscatedDoc, _this$analyticsHelper16, _this$analyticsHelper11, _this$getState5, generatedDiffStepsResponse, generatedSteps, state, stepsToBeApplied, _this$analyticsHelper12, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper15, _this$analyticsHelper17, _this$analyticsHelper18;
363
+ 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;
365
364
  return _regenerator.default.wrap(function _callee3$(_context3) {
366
365
  while (1) switch (_context3.prev = _context3.next) {
367
366
  case 0:
@@ -412,15 +411,13 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
412
411
  if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
413
412
  _this.applyLocalSteps(unconfirmedSteps);
414
413
  }
415
- _context3.next = 41;
414
+ _context3.next = 34;
416
415
  break;
417
416
  case 18:
418
417
  _context3.prev = 18;
419
418
  _context3.t0 = _context3["catch"](13);
420
- if (!(0, _platformFeatureFlags.fg)('platform-editor-reconcile-return-generated-steps')) {
421
- _context3.next = 37;
422
- break;
423
- }
419
+ // Extract generatedSteps from fetchReconcile response
420
+ // and apply them to the editor state.
424
421
  _this.onErrorHandled({
425
422
  message: "Content synced with your team's edits. You may want to check for conflicting edits that could override your changes.",
426
423
  data: {
@@ -431,10 +428,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
431
428
  }
432
429
  });
433
430
  useReconcile = false;
434
- _context3.prev = 23;
435
- _context3.next = 26;
431
+ _context3.prev = 22;
432
+ _context3.next = 25;
436
433
  return _this.fetchGeneratedDiffSteps(JSON.stringify(currentState.content), 'fe-restore-fetch-generated-steps');
437
- case 26:
434
+ case 25:
438
435
  generatedDiffStepsResponse = _context3.sent;
439
436
  generatedSteps = generatedDiffStepsResponse.generatedSteps;
440
437
  state = (_this$getState5 = _this.getState) === null || _this$getState5 === void 0 ? void 0 : _this$getState5.call(_this);
@@ -453,23 +450,14 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
453
450
  });
454
451
  }
455
452
  }
456
- _context3.next = 35;
453
+ _context3.next = 34;
457
454
  break;
458
- case 32:
459
- _context3.prev = 32;
460
- _context3.t1 = _context3["catch"](23);
455
+ case 31:
456
+ _context3.prev = 31;
457
+ _context3.t1 = _context3["catch"](22);
461
458
  (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
462
- case 35:
463
- _context3.next = 41;
464
- break;
465
- case 37:
466
- (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(_context3.t0, "Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile");
467
- useReconcile = true;
468
- // Feature flag disabled - fallback to full document reconcile
469
- _context3.next = 41;
470
- return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
471
- case 41:
472
- (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
459
+ case 34:
460
+ (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
473
461
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
474
462
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
475
463
  useReconcile: useReconcile,
@@ -477,19 +465,19 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
477
465
  targetClientId: targetClientId,
478
466
  triggeredByCatchup: !!targetClientId
479
467
  });
480
- _context3.next = 49;
468
+ _context3.next = 42;
481
469
  break;
482
- case 44:
483
- _context3.prev = 44;
470
+ case 37:
471
+ _context3.prev = 37;
484
472
  _context3.t2 = _context3["catch"](10);
485
- (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
473
+ (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
486
474
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
487
475
  useReconcile: useReconcile,
488
476
  clientId: _this.clientId,
489
477
  targetClientId: targetClientId,
490
478
  triggeredByCatchup: !!targetClientId
491
479
  });
492
- (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
480
+ (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
493
481
  _this.onErrorHandled({
494
482
  message: 'Caught error while trying to recover the document',
495
483
  data: {
@@ -498,11 +486,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
498
486
  code: _internalErrors.INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR
499
487
  }
500
488
  });
501
- case 49:
489
+ case 42:
502
490
  case "end":
503
491
  return _context3.stop();
504
492
  }
505
- }, _callee3, null, [[10, 44], [13, 18], [23, 32]]);
493
+ }, _callee3, null, [[10, 37], [13, 18], [22, 31]]);
506
494
  }));
507
495
  return function (_x4) {
508
496
  return _ref7.apply(this, arguments);
@@ -510,7 +498,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
510
498
  }());
511
499
  (0, _defineProperty2.default)(this, "getFinalAcknowledgedState", /*#__PURE__*/function () {
512
500
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(reason) {
513
- var _this$analyticsHelper19, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper20, _this$analyticsHelper21, _measure2;
501
+ var _this$analyticsHelper18, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper19, _this$analyticsHelper20, _measure2;
514
502
  return _regenerator.default.wrap(function _callee4$(_context4) {
515
503
  while (1) switch (_context4.prev = _context4.next) {
516
504
  case 0:
@@ -545,7 +533,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
545
533
  };
546
534
  case 20:
547
535
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
548
- (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
536
+ (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
549
537
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
550
538
  });
551
539
  _this.aggressiveCatchup = false;
@@ -555,10 +543,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
555
543
  _context4.t1 = _context4["catch"](1);
556
544
  _this.aggressiveCatchup = false;
557
545
  _measure2 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
558
- (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
546
+ (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
559
547
  latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
560
548
  });
561
- (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
549
+ (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
562
550
  throw _context4.t1;
563
551
  case 33:
564
552
  case "end":
@@ -593,7 +581,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
593
581
  // ESS-5023: only emit error event if updated client version is still behind server version
594
582
  // client version could become higher than server version due to user editing or plugin adding steps
595
583
  if (updatedVersion < version) {
596
- var _doc$content, _this$analyticsHelper22;
584
+ var _doc$content, _this$analyticsHelper21;
597
585
  var error = new _customErrors.UpdateDocumentError('Failed to update the document', {
598
586
  newVersion: version,
599
587
  editorVersion: updatedVersion,
@@ -602,7 +590,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
602
590
  isDocContentValid: isDocContentValid,
603
591
  caller: caller
604
592
  });
605
- (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendErrorEvent(error, 'Failed to update the document in document service');
593
+ (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(error, 'Failed to update the document in document service');
606
594
  if (_this.enableErrorOnFailedDocumentApply) {
607
595
  _this.onErrorHandled({
608
596
  message: 'The provider failed to apply changes to the editor',
@@ -619,8 +607,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
619
607
  }
620
608
  // Otherwise just fail silently for now
621
609
  } else {
622
- var _this$analyticsHelper23, _doc$content2;
623
- (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendActionEvent(_const.EVENT_ACTION.UPDATE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
610
+ var _this$analyticsHelper22, _doc$content2;
611
+ (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendActionEvent(_const.EVENT_ACTION.UPDATE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
624
612
  newVersion: version,
625
613
  editorVersion: updatedVersion,
626
614
  isDocTruthy: !!doc,
@@ -635,8 +623,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
635
623
  try {
636
624
  var _this$getState6;
637
625
  if (!((_this$getState6 = _this.getState) !== null && _this$getState6 !== void 0 && _this$getState6.call(_this))) {
638
- var _this$analyticsHelper24;
639
- (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
626
+ var _this$analyticsHelper23;
627
+ (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
640
628
  }
641
629
  // Ignored via go/ees005
642
630
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -666,7 +654,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
666
654
  */
667
655
  (0, _defineProperty2.default)(this, "commitUnconfirmedSteps", /*#__PURE__*/function () {
668
656
  var _ref0 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(reason) {
669
- var unconfirmedSteps, _this$getState7, _this$analyticsHelper26, count, unconfirmedTrs, lastTr, isLastTrConfirmed, _this$analyticsHelper25, nextUnconfirmedSteps, nextUnconfirmedTrs, _this$getUnconfirmedS, state, version, unconfirmedStepsInfoUGCRemoved, error, measure, _this$analyticsHelper27, _this$analyticsHelper28, _measure3;
657
+ 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;
670
658
  return _regenerator.default.wrap(function _callee5$(_context5) {
671
659
  while (1) switch (_context5.prev = _context5.next) {
672
660
  case 0:
@@ -685,7 +673,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
685
673
  lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
686
674
  isLastTrConfirmed = false;
687
675
  if (!((_this$getState7 = _this.getState) !== null && _this$getState7 !== void 0 && _this$getState7.call(_this))) {
688
- (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
676
+ (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
689
677
  }
690
678
  case 9:
691
679
  if (isLastTrConfirmed) {
@@ -735,7 +723,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
735
723
  break;
736
724
  case 22:
737
725
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
738
- (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
726
+ (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
739
727
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
740
728
  // upon success, emit the total number of unconfirmed steps we synced
741
729
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
@@ -747,11 +735,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
747
735
  _context5.prev = 26;
748
736
  _context5.t0 = _context5["catch"](1);
749
737
  _measure3 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
750
- (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
738
+ (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
751
739
  latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
752
740
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
753
741
  });
754
- (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
742
+ (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
755
743
  throw _context5.t0;
756
744
  case 32:
757
745
  case "end":
@@ -764,17 +752,17 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
764
752
  };
765
753
  }());
766
754
  (0, _defineProperty2.default)(this, "onStepRejectedError", function () {
767
- var _this$analyticsHelper29;
755
+ var _this$analyticsHelper28;
768
756
  _this.stepRejectCounter++;
769
757
  logger("Steps rejected (tries=".concat(_this.stepRejectCounter, ")"));
770
- (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO, {
758
+ (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO, {
771
759
  count: _this.stepRejectCounter
772
760
  });
773
761
  var maxRetries = _this.aggressiveCatchup ? _provider.MAX_STEP_REJECTED_ERROR_AGGRESSIVE : _provider.MAX_STEP_REJECTED_ERROR;
774
762
  if (_this.stepRejectCounter >= maxRetries) {
775
- var _this$analyticsHelper30;
763
+ var _this$analyticsHelper29;
776
764
  logger("The steps were rejected too many times (tries=".concat(_this.stepRejectCounter, ", limit=").concat(_provider.MAX_STEP_REJECTED_ERROR, "). Trying to catch-up."));
777
- (_this$analyticsHelper30 = _this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 || _this$analyticsHelper30.sendActionEvent(_const.EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO);
765
+ (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(_const.EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO);
778
766
  _this.throttledCatchupv2(_const.CatchupEventReason.STEPS_REJECTED);
779
767
  } else {
780
768
  // If committing steps failed try again automatically in 1s
@@ -830,15 +818,15 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
830
818
  value: function getVersionFromCollabState(state, resource) {
831
819
  var collabState = (0, _prosemirrorCollab.getCollabState)(state);
832
820
  if (!collabState) {
833
- var _this$analyticsHelper31;
834
- (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 || _this$analyticsHelper31.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), "".concat(resource, " called without collab state"));
821
+ var _this$analyticsHelper30;
822
+ (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 || _this$analyticsHelper30.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), "".concat(resource, " called without collab state"));
835
823
  return 0;
836
824
  }
837
825
 
838
826
  // This should not happen in usual, just add error event in case it happens
839
827
  if (collabState.version === undefined) {
840
- var _this$analyticsHelper32;
841
- (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 || _this$analyticsHelper32.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), "".concat(resource, " called with collab state missing version info"));
828
+ var _this$analyticsHelper31;
829
+ (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 || _this$analyticsHelper31.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), "".concat(resource, " called with collab state missing version info"));
842
830
  return 0;
843
831
  }
844
832
  return collabState.version;
@@ -914,7 +902,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
914
902
  logger("Processing data. Version \"".concat(version, "\"."));
915
903
  if (steps !== null && steps !== void 0 && steps.length) {
916
904
  try {
917
- var _this$analyticsHelper33;
905
+ var _this$analyticsHelper32;
918
906
  var clientIds = steps.map(function (_ref1) {
919
907
  var clientId = _ref1.clientId;
920
908
  return clientId;
@@ -936,13 +924,13 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
936
924
  return _this2.sendStepsFromCurrentState();
937
925
  }, 100);
938
926
  }
939
- (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendActionEvent(_const.EVENT_ACTION.PROCESS_STEPS, _const.EVENT_STATUS.SUCCESS);
927
+ (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 || _this$analyticsHelper32.sendActionEvent(_const.EVENT_ACTION.PROCESS_STEPS, _const.EVENT_STATUS.SUCCESS);
940
928
  } catch (error) {
941
- var _this$analyticsHelper34;
929
+ var _this$analyticsHelper33;
942
930
  // ESS-6421: log if error processing steps when there are steps from the same userId but not the same clientId
943
931
  var userIdMatch = this.isStepsFromNewClientIdForSameUserId(steps);
944
932
  logger("Processing steps failed with error: ".concat(error, ". Triggering catch up call."));
945
- (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 || _this$analyticsHelper34.sendErrorEvent(error, userIdMatch ? "Error while processing steps with new clientId" : "Error while processing steps");
933
+ (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendErrorEvent(error, userIdMatch ? "Error while processing steps with new clientId" : "Error while processing steps");
946
934
  this.throttledCatchupv2(_const.CatchupEventReason.PROCESS_STEPS);
947
935
  }
948
936
  }
@@ -994,8 +982,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
994
982
  var _this$getState0;
995
983
  var state = (_this$getState0 = this.getState) === null || _this$getState0 === void 0 ? void 0 : _this$getState0.call(this);
996
984
  if (!state) {
997
- var _this$analyticsHelper35;
998
- (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
985
+ var _this$analyticsHelper34;
986
+ (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 || _this$analyticsHelper34.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
999
987
  return;
1000
988
  }
1001
989
  this.send(null, null, state, sendAnalyticsEvent, reason);
@@ -1046,8 +1034,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1046
1034
  // to ensure that analytics events with the number of unconfirmed steps is only
1047
1035
  // sent once on connection (as opposed to on every step)
1048
1036
  if (sendAnalyticsEvent) {
1049
- var _this$analyticsHelper36;
1050
- (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(_const.EVENT_ACTION.HAS_UNCONFIRMED_STEPS, _const.EVENT_STATUS.INFO, {
1037
+ var _this$analyticsHelper35;
1038
+ (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendActionEvent(_const.EVENT_ACTION.HAS_UNCONFIRMED_STEPS, _const.EVENT_STATUS.INFO, {
1051
1039
  numUnconfirmedSteps: (unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) || 0
1052
1040
  });
1053
1041
  }
@@ -1056,12 +1044,12 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1056
1044
  }
1057
1045
  var rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
1058
1046
  if (rebased) {
1059
- var _this$analyticsHelper37;
1047
+ var _this$analyticsHelper36;
1060
1048
  var obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
1061
1049
  var obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
1062
1050
  var obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
1063
1051
  // send analtyics on unconfirmed steps
1064
- (_this$analyticsHelper37 = this.analyticsHelper) === null || _this$analyticsHelper37 === void 0 || _this$analyticsHelper37.sendActionEvent(_const.EVENT_ACTION.STEPS_REBASED, _const.EVENT_STATUS.INFO, {
1052
+ (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(_const.EVENT_ACTION.STEPS_REBASED, _const.EVENT_STATUS.INFO, {
1065
1053
  obfuscatedUnconfirmedSteps: obfuscatedUnconfirmedSteps,
1066
1054
  obfuscatedRemoteSteps: obfuscatedRemoteSteps,
1067
1055
  obfuscatedRebasedSteps: obfuscatedRebasedSteps,
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/collab-provider";
8
- var version = exports.version = "11.3.1";
8
+ var version = exports.version = "0.0.0-development";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -16,7 +16,6 @@ import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
16
16
  import { catchupv2 } from './catchupv2';
17
17
  import { StepQueueState } from './step-queue-state';
18
18
  import { getConflictChanges } from './getConflictChanges';
19
- import { fg } from '@atlaskit/platform-feature-flags';
20
19
  const CATCHUP_THROTTLE = 1 * 1000; // 1 second
21
20
 
22
21
  const noop = () => {};
@@ -348,7 +347,7 @@ export class DocumentService {
348
347
  obfuscatedDoc
349
348
  } = this.obfuscateStepsAndState(unconfirmedSteps, currentState);
350
349
  try {
351
- var _this$analyticsHelper16;
350
+ var _this$analyticsHelper15;
352
351
  // Reset the editor,
353
352
  // - Replace the document, keep in sync with the server
354
353
  // - Replace the version number, so editor is in sync with NCS server and can commit new changes.
@@ -380,52 +379,44 @@ export class DocumentService {
380
379
  } catch (applyLocalStepsError) {
381
380
  // Extract generatedSteps from fetchReconcile response
382
381
  // and apply them to the editor state.
383
- if (fg('platform-editor-reconcile-return-generated-steps')) {
384
- this.onErrorHandled({
385
- message: `Content synced with your team's edits. You may want to check for conflicting edits that could override your changes.`,
386
- data: {
387
- code: INTERNAL_ERROR_CODE.OUT_OF_SYNC_CLIENT_DATA_LOSS_EVENT,
388
- meta: {
389
- reason: 'fe-restore-fetch-generated-steps'
390
- }
382
+ this.onErrorHandled({
383
+ message: `Content synced with your team's edits. You may want to check for conflicting edits that could override your changes.`,
384
+ data: {
385
+ code: INTERNAL_ERROR_CODE.OUT_OF_SYNC_CLIENT_DATA_LOSS_EVENT,
386
+ meta: {
387
+ reason: 'fe-restore-fetch-generated-steps'
391
388
  }
392
- });
393
- useReconcile = false;
394
- try {
395
- var _this$getState5;
396
- const generatedDiffStepsResponse = await this.fetchGeneratedDiffSteps(JSON.stringify(currentState.content), 'fe-restore-fetch-generated-steps');
397
- const {
398
- generatedSteps
399
- } = generatedDiffStepsResponse;
400
- const state = (_this$getState5 = this.getState) === null || _this$getState5 === void 0 ? void 0 : _this$getState5.call(this);
401
- if (state !== null && state !== void 0 && state.schema) {
402
- const stepsToBeApplied = generatedSteps === null || generatedSteps === void 0 ? void 0 : generatedSteps.map(s => ProseMirrorStep.fromJSON(state.schema, s));
403
- if (stepsToBeApplied && stepsToBeApplied.length > 0) {
404
- var _this$analyticsHelper12;
405
- (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 ? void 0 : _this$analyticsHelper12.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
406
- stepsCount: stepsToBeApplied.length
407
- });
408
- this.applyLocalSteps(stepsToBeApplied);
409
- } else {
410
- var _this$analyticsHelper13;
411
- (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
412
- reason: 'fetchGeneratedDiffSteps returned no steps'
413
- });
414
- }
389
+ }
390
+ });
391
+ useReconcile = false;
392
+ try {
393
+ var _this$getState5;
394
+ const generatedDiffStepsResponse = await this.fetchGeneratedDiffSteps(JSON.stringify(currentState.content), 'fe-restore-fetch-generated-steps');
395
+ const {
396
+ generatedSteps
397
+ } = generatedDiffStepsResponse;
398
+ const state = (_this$getState5 = this.getState) === null || _this$getState5 === void 0 ? void 0 : _this$getState5.call(this);
399
+ if (state !== null && state !== void 0 && state.schema) {
400
+ const stepsToBeApplied = generatedSteps === null || generatedSteps === void 0 ? void 0 : generatedSteps.map(s => ProseMirrorStep.fromJSON(state.schema, s));
401
+ if (stepsToBeApplied && stepsToBeApplied.length > 0) {
402
+ var _this$analyticsHelper12;
403
+ (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 ? void 0 : _this$analyticsHelper12.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
404
+ stepsCount: stepsToBeApplied.length
405
+ });
406
+ this.applyLocalSteps(stepsToBeApplied);
407
+ } else {
408
+ var _this$analyticsHelper13;
409
+ (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
410
+ reason: 'fetchGeneratedDiffSteps returned no steps'
411
+ });
415
412
  }
416
- } catch (reconcileError) {
417
- var _this$analyticsHelper14;
418
- (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendErrorEvent(reconcileError, `Error fetchGeneratedDiffSteps with steps-only mode`);
419
413
  }
420
- } else {
421
- var _this$analyticsHelper15;
422
- (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendErrorEvent(applyLocalStepsError, `Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile`);
423
- useReconcile = true;
424
- // Feature flag disabled - fallback to full document reconcile
425
- await this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
414
+ } catch (reconcileError) {
415
+ var _this$analyticsHelper14;
416
+ (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendErrorEvent(reconcileError, `Error fetchGeneratedDiffSteps with steps-only mode`);
426
417
  }
427
418
  }
428
- (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
419
+ (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
429
420
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
430
421
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
431
422
  useReconcile,
@@ -434,15 +425,15 @@ export class DocumentService {
434
425
  triggeredByCatchup: !!targetClientId
435
426
  });
436
427
  } catch (restoreError) {
437
- var _this$analyticsHelper17, _this$analyticsHelper18;
438
- (_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 ? void 0 : _this$analyticsHelper17.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
428
+ var _this$analyticsHelper16, _this$analyticsHelper17;
429
+ (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
439
430
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
440
431
  useReconcile,
441
432
  clientId: this.clientId,
442
433
  targetClientId,
443
434
  triggeredByCatchup: !!targetClientId
444
435
  });
445
- (_this$analyticsHelper18 = this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 ? void 0 : _this$analyticsHelper18.sendErrorEvent(restoreError, `Error while reinitialising document. Use Reconcile: ${useReconcile}`);
436
+ (_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 ? void 0 : _this$analyticsHelper17.sendErrorEvent(restoreError, `Error while reinitialising document. Use Reconcile: ${useReconcile}`);
446
437
  this.onErrorHandled({
447
438
  message: 'Caught error while trying to recover the document',
448
439
  data: {
@@ -456,7 +447,7 @@ export class DocumentService {
456
447
  _defineProperty(this, "getFinalAcknowledgedState", async reason => {
457
448
  this.aggressiveCatchup = true;
458
449
  try {
459
- var _this$analyticsHelper19;
450
+ var _this$analyticsHelper18;
460
451
  startMeasure(MEASURE_NAME.PUBLISH_PAGE, this.analyticsHelper);
461
452
  let finalAcknowledgedState;
462
453
  try {
@@ -473,19 +464,19 @@ export class DocumentService {
473
464
  };
474
465
  }
475
466
  const measure = stopMeasure(MEASURE_NAME.PUBLISH_PAGE, this.analyticsHelper);
476
- (_this$analyticsHelper19 = this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 ? void 0 : _this$analyticsHelper19.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.SUCCESS, {
467
+ (_this$analyticsHelper18 = this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 ? void 0 : _this$analyticsHelper18.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.SUCCESS, {
477
468
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
478
469
  });
479
470
  this.aggressiveCatchup = false;
480
471
  return finalAcknowledgedState;
481
472
  } catch (error) {
482
- var _this$analyticsHelper20, _this$analyticsHelper21;
473
+ var _this$analyticsHelper19, _this$analyticsHelper20;
483
474
  this.aggressiveCatchup = false;
484
475
  const measure = stopMeasure(MEASURE_NAME.PUBLISH_PAGE, this.analyticsHelper);
485
- (_this$analyticsHelper20 = this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 ? void 0 : _this$analyticsHelper20.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.FAILURE, {
476
+ (_this$analyticsHelper19 = this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 ? void 0 : _this$analyticsHelper19.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.FAILURE, {
486
477
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
487
478
  });
488
- (_this$analyticsHelper21 = this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 ? void 0 : _this$analyticsHelper21.sendErrorEvent(error, 'Error while returning ADF version of the final draft document');
479
+ (_this$analyticsHelper20 = this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 ? void 0 : _this$analyticsHelper20.sendErrorEvent(error, 'Error while returning ADF version of the final draft document');
489
480
  throw error; // Reject the promise so the consumer can react to it failing
490
481
  }
491
482
  });
@@ -514,7 +505,7 @@ export class DocumentService {
514
505
  // ESS-5023: only emit error event if updated client version is still behind server version
515
506
  // client version could become higher than server version due to user editing or plugin adding steps
516
507
  if (updatedVersion < version) {
517
- var _doc$content, _this$analyticsHelper22;
508
+ var _doc$content, _this$analyticsHelper21;
518
509
  const error = new UpdateDocumentError('Failed to update the document', {
519
510
  newVersion: version,
520
511
  editorVersion: updatedVersion,
@@ -523,7 +514,7 @@ export class DocumentService {
523
514
  isDocContentValid,
524
515
  caller
525
516
  });
526
- (_this$analyticsHelper22 = this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 ? void 0 : _this$analyticsHelper22.sendErrorEvent(error, 'Failed to update the document in document service');
517
+ (_this$analyticsHelper21 = this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 ? void 0 : _this$analyticsHelper21.sendErrorEvent(error, 'Failed to update the document in document service');
527
518
  if (this.enableErrorOnFailedDocumentApply) {
528
519
  this.onErrorHandled({
529
520
  message: 'The provider failed to apply changes to the editor',
@@ -540,8 +531,8 @@ export class DocumentService {
540
531
  }
541
532
  // Otherwise just fail silently for now
542
533
  } else {
543
- var _this$analyticsHelper23, _doc$content2;
544
- (_this$analyticsHelper23 = this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 ? void 0 : _this$analyticsHelper23.sendActionEvent(EVENT_ACTION.UPDATE_DOCUMENT, EVENT_STATUS.SUCCESS, {
534
+ var _this$analyticsHelper22, _doc$content2;
535
+ (_this$analyticsHelper22 = this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 ? void 0 : _this$analyticsHelper22.sendActionEvent(EVENT_ACTION.UPDATE_DOCUMENT, EVENT_STATUS.SUCCESS, {
545
536
  newVersion: version,
546
537
  editorVersion: updatedVersion,
547
538
  isDocTruthy: !!doc,
@@ -556,8 +547,8 @@ export class DocumentService {
556
547
  try {
557
548
  var _this$getState6;
558
549
  if (!((_this$getState6 = this.getState) !== null && _this$getState6 !== void 0 && _this$getState6.call(this))) {
559
- var _this$analyticsHelper24;
560
- (_this$analyticsHelper24 = this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 ? void 0 : _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
550
+ var _this$analyticsHelper23;
551
+ (_this$analyticsHelper23 = this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 ? void 0 : _this$analyticsHelper23.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
561
552
  }
562
553
  // Ignored via go/ees005
563
554
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -587,7 +578,7 @@ export class DocumentService {
587
578
  const unconfirmedSteps = this.getUnconfirmedSteps();
588
579
  try {
589
580
  if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
590
- var _this$getState7, _this$analyticsHelper26;
581
+ var _this$getState7, _this$analyticsHelper25;
591
582
  startMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, this.analyticsHelper);
592
583
  let count = 0;
593
584
  // We use origins here as steps can be rebased. When steps are rebased a new step is created.
@@ -598,8 +589,8 @@ export class DocumentService {
598
589
  const lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
599
590
  let isLastTrConfirmed = false;
600
591
  if (!((_this$getState7 = this.getState) !== null && _this$getState7 !== void 0 && _this$getState7.call(this))) {
601
- var _this$analyticsHelper25;
602
- (_this$analyticsHelper25 = this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 ? void 0 : _this$analyticsHelper25.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
592
+ var _this$analyticsHelper24;
593
+ (_this$analyticsHelper24 = this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 ? void 0 : _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
603
594
  }
604
595
  while (!isLastTrConfirmed) {
605
596
  // this makes all commitUnconfirmedSteps skip the waiting time, which means draft-sync is sped up too.
@@ -635,35 +626,35 @@ export class DocumentService {
635
626
  }
636
627
  }
637
628
  const measure = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, this.analyticsHelper);
638
- (_this$analyticsHelper26 = this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 ? void 0 : _this$analyticsHelper26.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.SUCCESS, {
629
+ (_this$analyticsHelper25 = this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 ? void 0 : _this$analyticsHelper25.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.SUCCESS, {
639
630
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
640
631
  // upon success, emit the total number of unconfirmed steps we synced
641
632
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
642
633
  });
643
634
  }
644
635
  } catch (error) {
645
- var _this$analyticsHelper27, _this$analyticsHelper28;
636
+ var _this$analyticsHelper26, _this$analyticsHelper27;
646
637
  const measure = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, this.analyticsHelper);
647
- (_this$analyticsHelper27 = this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 ? void 0 : _this$analyticsHelper27.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.FAILURE, {
638
+ (_this$analyticsHelper26 = this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 ? void 0 : _this$analyticsHelper26.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.FAILURE, {
648
639
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
649
640
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
650
641
  });
651
- (_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 ? void 0 : _this$analyticsHelper28.sendErrorEvent(error, 'Error while committing unconfirmed steps');
642
+ (_this$analyticsHelper27 = this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 ? void 0 : _this$analyticsHelper27.sendErrorEvent(error, 'Error while committing unconfirmed steps');
652
643
  throw error;
653
644
  }
654
645
  });
655
646
  _defineProperty(this, "onStepRejectedError", () => {
656
- var _this$analyticsHelper29;
647
+ var _this$analyticsHelper28;
657
648
  this.stepRejectCounter++;
658
649
  logger(`Steps rejected (tries=${this.stepRejectCounter})`);
659
- (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 ? void 0 : _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.SEND_STEPS_RETRY, EVENT_STATUS.INFO, {
650
+ (_this$analyticsHelper28 = this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 ? void 0 : _this$analyticsHelper28.sendActionEvent(EVENT_ACTION.SEND_STEPS_RETRY, EVENT_STATUS.INFO, {
660
651
  count: this.stepRejectCounter
661
652
  });
662
653
  const maxRetries = this.aggressiveCatchup ? MAX_STEP_REJECTED_ERROR_AGGRESSIVE : MAX_STEP_REJECTED_ERROR;
663
654
  if (this.stepRejectCounter >= maxRetries) {
664
- var _this$analyticsHelper30;
655
+ var _this$analyticsHelper29;
665
656
  logger(`The steps were rejected too many times (tries=${this.stepRejectCounter}, limit=${MAX_STEP_REJECTED_ERROR}). Trying to catch-up.`);
666
- (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 ? void 0 : _this$analyticsHelper30.sendActionEvent(EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, EVENT_STATUS.INFO);
657
+ (_this$analyticsHelper29 = this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 ? void 0 : _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, EVENT_STATUS.INFO);
667
658
  this.throttledCatchupv2(CatchupEventReason.STEPS_REJECTED);
668
659
  } else {
669
660
  // If committing steps failed try again automatically in 1s
@@ -715,15 +706,15 @@ export class DocumentService {
715
706
  getVersionFromCollabState(state, resource) {
716
707
  const collabState = getCollabState(state);
717
708
  if (!collabState) {
718
- var _this$analyticsHelper31;
719
- (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 ? void 0 : _this$analyticsHelper31.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), `${resource} called without collab state`);
709
+ var _this$analyticsHelper30;
710
+ (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 ? void 0 : _this$analyticsHelper30.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), `${resource} called without collab state`);
720
711
  return 0;
721
712
  }
722
713
 
723
714
  // This should not happen in usual, just add error event in case it happens
724
715
  if (collabState.version === undefined) {
725
- var _this$analyticsHelper32;
726
- (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 ? void 0 : _this$analyticsHelper32.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), `${resource} called with collab state missing version info`);
716
+ var _this$analyticsHelper31;
717
+ (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 ? void 0 : _this$analyticsHelper31.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), `${resource} called with collab state missing version info`);
727
718
  return 0;
728
719
  }
729
720
  return collabState.version;
@@ -794,7 +785,7 @@ export class DocumentService {
794
785
  logger(`Processing data. Version "${version}".`);
795
786
  if (steps !== null && steps !== void 0 && steps.length) {
796
787
  try {
797
- var _this$analyticsHelper33;
788
+ var _this$analyticsHelper32;
798
789
  const clientIds = steps.map(({
799
790
  clientId
800
791
  }) => clientId);
@@ -813,13 +804,13 @@ export class DocumentService {
813
804
  if (clientIds.indexOf(this.clientId) === -1) {
814
805
  setTimeout(() => this.sendStepsFromCurrentState(), 100);
815
806
  }
816
- (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 ? void 0 : _this$analyticsHelper33.sendActionEvent(EVENT_ACTION.PROCESS_STEPS, EVENT_STATUS.SUCCESS);
807
+ (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 ? void 0 : _this$analyticsHelper32.sendActionEvent(EVENT_ACTION.PROCESS_STEPS, EVENT_STATUS.SUCCESS);
817
808
  } catch (error) {
818
- var _this$analyticsHelper34;
809
+ var _this$analyticsHelper33;
819
810
  // ESS-6421: log if error processing steps when there are steps from the same userId but not the same clientId
820
811
  const userIdMatch = this.isStepsFromNewClientIdForSameUserId(steps);
821
812
  logger(`Processing steps failed with error: ${error}. Triggering catch up call.`);
822
- (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 ? void 0 : _this$analyticsHelper34.sendErrorEvent(error, userIdMatch ? `Error while processing steps with new clientId` : `Error while processing steps`);
813
+ (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 ? void 0 : _this$analyticsHelper33.sendErrorEvent(error, userIdMatch ? `Error while processing steps with new clientId` : `Error while processing steps`);
823
814
  this.throttledCatchupv2(CatchupEventReason.PROCESS_STEPS);
824
815
  }
825
816
  }
@@ -864,8 +855,8 @@ export class DocumentService {
864
855
  var _this$getState0;
865
856
  const state = (_this$getState0 = this.getState) === null || _this$getState0 === void 0 ? void 0 : _this$getState0.call(this);
866
857
  if (!state) {
867
- var _this$analyticsHelper35;
868
- (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 ? void 0 : _this$analyticsHelper35.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
858
+ var _this$analyticsHelper34;
859
+ (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 ? void 0 : _this$analyticsHelper34.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
869
860
  return;
870
861
  }
871
862
  this.send(null, null, state, sendAnalyticsEvent, reason);
@@ -911,8 +902,8 @@ export class DocumentService {
911
902
  // to ensure that analytics events with the number of unconfirmed steps is only
912
903
  // sent once on connection (as opposed to on every step)
913
904
  if (sendAnalyticsEvent) {
914
- var _this$analyticsHelper36;
915
- (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 ? void 0 : _this$analyticsHelper36.sendActionEvent(EVENT_ACTION.HAS_UNCONFIRMED_STEPS, EVENT_STATUS.INFO, {
905
+ var _this$analyticsHelper35;
906
+ (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 ? void 0 : _this$analyticsHelper35.sendActionEvent(EVENT_ACTION.HAS_UNCONFIRMED_STEPS, EVENT_STATUS.INFO, {
916
907
  numUnconfirmedSteps: (unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) || 0
917
908
  });
918
909
  }
@@ -921,12 +912,12 @@ export class DocumentService {
921
912
  }
922
913
  const rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
923
914
  if (rebased) {
924
- var _this$analyticsHelper37;
915
+ var _this$analyticsHelper36;
925
916
  const obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
926
917
  const obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
927
918
  const obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
928
919
  // send analtyics on unconfirmed steps
929
- (_this$analyticsHelper37 = this.analyticsHelper) === null || _this$analyticsHelper37 === void 0 ? void 0 : _this$analyticsHelper37.sendActionEvent(EVENT_ACTION.STEPS_REBASED, EVENT_STATUS.INFO, {
920
+ (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 ? void 0 : _this$analyticsHelper36.sendActionEvent(EVENT_ACTION.STEPS_REBASED, EVENT_STATUS.INFO, {
930
921
  obfuscatedUnconfirmedSteps,
931
922
  obfuscatedRemoteSteps,
932
923
  obfuscatedRebasedSteps,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "11.3.1";
2
+ export const version = "0.0.0-development";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -22,7 +22,6 @@ import { CantSyncUpError, UpdateDocumentError } from '../errors/custom-errors';
22
22
  import { catchupv2 } from './catchupv2';
23
23
  import { StepQueueState } from './step-queue-state';
24
24
  import { getConflictChanges } from './getConflictChanges';
25
- import { fg } from '@atlaskit/platform-feature-flags';
26
25
  var CATCHUP_THROTTLE = 1 * 1000; // 1 second
27
26
 
28
27
  var noop = function noop() {};
@@ -354,7 +353,7 @@ export var DocumentService = /*#__PURE__*/function () {
354
353
  // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
355
354
  _defineProperty(this, "onRestore", /*#__PURE__*/function () {
356
355
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6) {
357
- var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$obfuscateStepsA, obfuscatedSteps, obfuscatedDoc, _this$analyticsHelper16, _this$analyticsHelper11, _this$getState5, generatedDiffStepsResponse, generatedSteps, state, stepsToBeApplied, _this$analyticsHelper12, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper15, _this$analyticsHelper17, _this$analyticsHelper18;
356
+ 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;
358
357
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
359
358
  while (1) switch (_context3.prev = _context3.next) {
360
359
  case 0:
@@ -405,15 +404,13 @@ export var DocumentService = /*#__PURE__*/function () {
405
404
  if (unconfirmedSteps !== null && unconfirmedSteps !== void 0 && unconfirmedSteps.length) {
406
405
  _this.applyLocalSteps(unconfirmedSteps);
407
406
  }
408
- _context3.next = 41;
407
+ _context3.next = 34;
409
408
  break;
410
409
  case 18:
411
410
  _context3.prev = 18;
412
411
  _context3.t0 = _context3["catch"](13);
413
- if (!fg('platform-editor-reconcile-return-generated-steps')) {
414
- _context3.next = 37;
415
- break;
416
- }
412
+ // Extract generatedSteps from fetchReconcile response
413
+ // and apply them to the editor state.
417
414
  _this.onErrorHandled({
418
415
  message: "Content synced with your team's edits. You may want to check for conflicting edits that could override your changes.",
419
416
  data: {
@@ -424,10 +421,10 @@ export var DocumentService = /*#__PURE__*/function () {
424
421
  }
425
422
  });
426
423
  useReconcile = false;
427
- _context3.prev = 23;
428
- _context3.next = 26;
424
+ _context3.prev = 22;
425
+ _context3.next = 25;
429
426
  return _this.fetchGeneratedDiffSteps(JSON.stringify(currentState.content), 'fe-restore-fetch-generated-steps');
430
- case 26:
427
+ case 25:
431
428
  generatedDiffStepsResponse = _context3.sent;
432
429
  generatedSteps = generatedDiffStepsResponse.generatedSteps;
433
430
  state = (_this$getState5 = _this.getState) === null || _this$getState5 === void 0 ? void 0 : _this$getState5.call(_this);
@@ -446,23 +443,14 @@ export var DocumentService = /*#__PURE__*/function () {
446
443
  });
447
444
  }
448
445
  }
449
- _context3.next = 35;
446
+ _context3.next = 34;
450
447
  break;
451
- case 32:
452
- _context3.prev = 32;
453
- _context3.t1 = _context3["catch"](23);
448
+ case 31:
449
+ _context3.prev = 31;
450
+ _context3.t1 = _context3["catch"](22);
454
451
  (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
455
- case 35:
456
- _context3.next = 41;
457
- break;
458
- case 37:
459
- (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(_context3.t0, "Error while onRestore with applyLocalSteps. Will fallback to fetchReconcile");
460
- useReconcile = true;
461
- // Feature flag disabled - fallback to full document reconcile
462
- _context3.next = 41;
463
- return _this.fetchReconcile(JSON.stringify(currentState.content), 'fe-restore');
464
- case 41:
465
- (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
452
+ case 34:
453
+ (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
466
454
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
467
455
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
468
456
  useReconcile: useReconcile,
@@ -470,19 +458,19 @@ export var DocumentService = /*#__PURE__*/function () {
470
458
  targetClientId: targetClientId,
471
459
  triggeredByCatchup: !!targetClientId
472
460
  });
473
- _context3.next = 49;
461
+ _context3.next = 42;
474
462
  break;
475
- case 44:
476
- _context3.prev = 44;
463
+ case 37:
464
+ _context3.prev = 37;
477
465
  _context3.t2 = _context3["catch"](10);
478
- (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
466
+ (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
479
467
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
480
468
  useReconcile: useReconcile,
481
469
  clientId: _this.clientId,
482
470
  targetClientId: targetClientId,
483
471
  triggeredByCatchup: !!targetClientId
484
472
  });
485
- (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
473
+ (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
486
474
  _this.onErrorHandled({
487
475
  message: 'Caught error while trying to recover the document',
488
476
  data: {
@@ -491,11 +479,11 @@ export var DocumentService = /*#__PURE__*/function () {
491
479
  code: INTERNAL_ERROR_CODE.DOCUMENT_RESTORE_ERROR
492
480
  }
493
481
  });
494
- case 49:
482
+ case 42:
495
483
  case "end":
496
484
  return _context3.stop();
497
485
  }
498
- }, _callee3, null, [[10, 44], [13, 18], [23, 32]]);
486
+ }, _callee3, null, [[10, 37], [13, 18], [22, 31]]);
499
487
  }));
500
488
  return function (_x4) {
501
489
  return _ref7.apply(this, arguments);
@@ -503,7 +491,7 @@ export var DocumentService = /*#__PURE__*/function () {
503
491
  }());
504
492
  _defineProperty(this, "getFinalAcknowledgedState", /*#__PURE__*/function () {
505
493
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(reason) {
506
- var _this$analyticsHelper19, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper20, _this$analyticsHelper21, _measure2;
494
+ var _this$analyticsHelper18, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper19, _this$analyticsHelper20, _measure2;
507
495
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
508
496
  while (1) switch (_context4.prev = _context4.next) {
509
497
  case 0:
@@ -538,7 +526,7 @@ export var DocumentService = /*#__PURE__*/function () {
538
526
  };
539
527
  case 20:
540
528
  measure = stopMeasure(MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
541
- (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.SUCCESS, {
529
+ (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.SUCCESS, {
542
530
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
543
531
  });
544
532
  _this.aggressiveCatchup = false;
@@ -548,10 +536,10 @@ export var DocumentService = /*#__PURE__*/function () {
548
536
  _context4.t1 = _context4["catch"](1);
549
537
  _this.aggressiveCatchup = false;
550
538
  _measure2 = stopMeasure(MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
551
- (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.FAILURE, {
539
+ (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.FAILURE, {
552
540
  latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
553
541
  });
554
- (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
542
+ (_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
543
  throw _context4.t1;
556
544
  case 33:
557
545
  case "end":
@@ -586,7 +574,7 @@ export var DocumentService = /*#__PURE__*/function () {
586
574
  // ESS-5023: only emit error event if updated client version is still behind server version
587
575
  // client version could become higher than server version due to user editing or plugin adding steps
588
576
  if (updatedVersion < version) {
589
- var _doc$content, _this$analyticsHelper22;
577
+ var _doc$content, _this$analyticsHelper21;
590
578
  var error = new UpdateDocumentError('Failed to update the document', {
591
579
  newVersion: version,
592
580
  editorVersion: updatedVersion,
@@ -595,7 +583,7 @@ export var DocumentService = /*#__PURE__*/function () {
595
583
  isDocContentValid: isDocContentValid,
596
584
  caller: caller
597
585
  });
598
- (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendErrorEvent(error, 'Failed to update the document in document service');
586
+ (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(error, 'Failed to update the document in document service');
599
587
  if (_this.enableErrorOnFailedDocumentApply) {
600
588
  _this.onErrorHandled({
601
589
  message: 'The provider failed to apply changes to the editor',
@@ -612,8 +600,8 @@ export var DocumentService = /*#__PURE__*/function () {
612
600
  }
613
601
  // Otherwise just fail silently for now
614
602
  } else {
615
- var _this$analyticsHelper23, _doc$content2;
616
- (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendActionEvent(EVENT_ACTION.UPDATE_DOCUMENT, EVENT_STATUS.SUCCESS, {
603
+ var _this$analyticsHelper22, _doc$content2;
604
+ (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendActionEvent(EVENT_ACTION.UPDATE_DOCUMENT, EVENT_STATUS.SUCCESS, {
617
605
  newVersion: version,
618
606
  editorVersion: updatedVersion,
619
607
  isDocTruthy: !!doc,
@@ -628,8 +616,8 @@ export var DocumentService = /*#__PURE__*/function () {
628
616
  try {
629
617
  var _this$getState6;
630
618
  if (!((_this$getState6 = _this.getState) !== null && _this$getState6 !== void 0 && _this$getState6.call(_this))) {
631
- var _this$analyticsHelper24;
632
- (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
619
+ var _this$analyticsHelper23;
620
+ (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
633
621
  }
634
622
  // Ignored via go/ees005
635
623
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -659,7 +647,7 @@ export var DocumentService = /*#__PURE__*/function () {
659
647
  */
660
648
  _defineProperty(this, "commitUnconfirmedSteps", /*#__PURE__*/function () {
661
649
  var _ref0 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(reason) {
662
- var unconfirmedSteps, _this$getState7, _this$analyticsHelper26, count, unconfirmedTrs, lastTr, isLastTrConfirmed, _this$analyticsHelper25, nextUnconfirmedSteps, nextUnconfirmedTrs, _this$getUnconfirmedS, state, version, unconfirmedStepsInfoUGCRemoved, error, measure, _this$analyticsHelper27, _this$analyticsHelper28, _measure3;
650
+ 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
651
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
664
652
  while (1) switch (_context5.prev = _context5.next) {
665
653
  case 0:
@@ -678,7 +666,7 @@ export var DocumentService = /*#__PURE__*/function () {
678
666
  lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
679
667
  isLastTrConfirmed = false;
680
668
  if (!((_this$getState7 = _this.getState) !== null && _this$getState7 !== void 0 && _this$getState7.call(_this))) {
681
- (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
669
+ (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
682
670
  }
683
671
  case 9:
684
672
  if (isLastTrConfirmed) {
@@ -728,7 +716,7 @@ export var DocumentService = /*#__PURE__*/function () {
728
716
  break;
729
717
  case 22:
730
718
  measure = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
731
- (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.SUCCESS, {
719
+ (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.SUCCESS, {
732
720
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
733
721
  // upon success, emit the total number of unconfirmed steps we synced
734
722
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
@@ -740,11 +728,11 @@ export var DocumentService = /*#__PURE__*/function () {
740
728
  _context5.prev = 26;
741
729
  _context5.t0 = _context5["catch"](1);
742
730
  _measure3 = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
743
- (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.FAILURE, {
731
+ (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.FAILURE, {
744
732
  latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
745
733
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
746
734
  });
747
- (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
735
+ (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
748
736
  throw _context5.t0;
749
737
  case 32:
750
738
  case "end":
@@ -757,17 +745,17 @@ export var DocumentService = /*#__PURE__*/function () {
757
745
  };
758
746
  }());
759
747
  _defineProperty(this, "onStepRejectedError", function () {
760
- var _this$analyticsHelper29;
748
+ var _this$analyticsHelper28;
761
749
  _this.stepRejectCounter++;
762
750
  logger("Steps rejected (tries=".concat(_this.stepRejectCounter, ")"));
763
- (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.SEND_STEPS_RETRY, EVENT_STATUS.INFO, {
751
+ (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendActionEvent(EVENT_ACTION.SEND_STEPS_RETRY, EVENT_STATUS.INFO, {
764
752
  count: _this.stepRejectCounter
765
753
  });
766
754
  var maxRetries = _this.aggressiveCatchup ? MAX_STEP_REJECTED_ERROR_AGGRESSIVE : MAX_STEP_REJECTED_ERROR;
767
755
  if (_this.stepRejectCounter >= maxRetries) {
768
- var _this$analyticsHelper30;
756
+ var _this$analyticsHelper29;
769
757
  logger("The steps were rejected too many times (tries=".concat(_this.stepRejectCounter, ", limit=").concat(MAX_STEP_REJECTED_ERROR, "). Trying to catch-up."));
770
- (_this$analyticsHelper30 = _this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 || _this$analyticsHelper30.sendActionEvent(EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, EVENT_STATUS.INFO);
758
+ (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, EVENT_STATUS.INFO);
771
759
  _this.throttledCatchupv2(CatchupEventReason.STEPS_REJECTED);
772
760
  } else {
773
761
  // If committing steps failed try again automatically in 1s
@@ -823,15 +811,15 @@ export var DocumentService = /*#__PURE__*/function () {
823
811
  value: function getVersionFromCollabState(state, resource) {
824
812
  var collabState = getCollabState(state);
825
813
  if (!collabState) {
826
- var _this$analyticsHelper31;
827
- (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 || _this$analyticsHelper31.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), "".concat(resource, " called without collab state"));
814
+ var _this$analyticsHelper30;
815
+ (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 || _this$analyticsHelper30.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), "".concat(resource, " called without collab state"));
828
816
  return 0;
829
817
  }
830
818
 
831
819
  // This should not happen in usual, just add error event in case it happens
832
820
  if (collabState.version === undefined) {
833
- var _this$analyticsHelper32;
834
- (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 || _this$analyticsHelper32.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), "".concat(resource, " called with collab state missing version info"));
821
+ var _this$analyticsHelper31;
822
+ (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 || _this$analyticsHelper31.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), "".concat(resource, " called with collab state missing version info"));
835
823
  return 0;
836
824
  }
837
825
  return collabState.version;
@@ -907,7 +895,7 @@ export var DocumentService = /*#__PURE__*/function () {
907
895
  logger("Processing data. Version \"".concat(version, "\"."));
908
896
  if (steps !== null && steps !== void 0 && steps.length) {
909
897
  try {
910
- var _this$analyticsHelper33;
898
+ var _this$analyticsHelper32;
911
899
  var clientIds = steps.map(function (_ref1) {
912
900
  var clientId = _ref1.clientId;
913
901
  return clientId;
@@ -929,13 +917,13 @@ export var DocumentService = /*#__PURE__*/function () {
929
917
  return _this2.sendStepsFromCurrentState();
930
918
  }, 100);
931
919
  }
932
- (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendActionEvent(EVENT_ACTION.PROCESS_STEPS, EVENT_STATUS.SUCCESS);
920
+ (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 || _this$analyticsHelper32.sendActionEvent(EVENT_ACTION.PROCESS_STEPS, EVENT_STATUS.SUCCESS);
933
921
  } catch (error) {
934
- var _this$analyticsHelper34;
922
+ var _this$analyticsHelper33;
935
923
  // ESS-6421: log if error processing steps when there are steps from the same userId but not the same clientId
936
924
  var userIdMatch = this.isStepsFromNewClientIdForSameUserId(steps);
937
925
  logger("Processing steps failed with error: ".concat(error, ". Triggering catch up call."));
938
- (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 || _this$analyticsHelper34.sendErrorEvent(error, userIdMatch ? "Error while processing steps with new clientId" : "Error while processing steps");
926
+ (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendErrorEvent(error, userIdMatch ? "Error while processing steps with new clientId" : "Error while processing steps");
939
927
  this.throttledCatchupv2(CatchupEventReason.PROCESS_STEPS);
940
928
  }
941
929
  }
@@ -987,8 +975,8 @@ export var DocumentService = /*#__PURE__*/function () {
987
975
  var _this$getState0;
988
976
  var state = (_this$getState0 = this.getState) === null || _this$getState0 === void 0 ? void 0 : _this$getState0.call(this);
989
977
  if (!state) {
990
- var _this$analyticsHelper35;
991
- (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
978
+ var _this$analyticsHelper34;
979
+ (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 || _this$analyticsHelper34.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
992
980
  return;
993
981
  }
994
982
  this.send(null, null, state, sendAnalyticsEvent, reason);
@@ -1039,8 +1027,8 @@ export var DocumentService = /*#__PURE__*/function () {
1039
1027
  // to ensure that analytics events with the number of unconfirmed steps is only
1040
1028
  // sent once on connection (as opposed to on every step)
1041
1029
  if (sendAnalyticsEvent) {
1042
- var _this$analyticsHelper36;
1043
- (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(EVENT_ACTION.HAS_UNCONFIRMED_STEPS, EVENT_STATUS.INFO, {
1030
+ var _this$analyticsHelper35;
1031
+ (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendActionEvent(EVENT_ACTION.HAS_UNCONFIRMED_STEPS, EVENT_STATUS.INFO, {
1044
1032
  numUnconfirmedSteps: (unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) || 0
1045
1033
  });
1046
1034
  }
@@ -1049,12 +1037,12 @@ export var DocumentService = /*#__PURE__*/function () {
1049
1037
  }
1050
1038
  var rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
1051
1039
  if (rebased) {
1052
- var _this$analyticsHelper37;
1040
+ var _this$analyticsHelper36;
1053
1041
  var obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
1054
1042
  var obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
1055
1043
  var obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
1056
1044
  // send analtyics on unconfirmed steps
1057
- (_this$analyticsHelper37 = this.analyticsHelper) === null || _this$analyticsHelper37 === void 0 || _this$analyticsHelper37.sendActionEvent(EVENT_ACTION.STEPS_REBASED, EVENT_STATUS.INFO, {
1045
+ (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(EVENT_ACTION.STEPS_REBASED, EVENT_STATUS.INFO, {
1058
1046
  obfuscatedUnconfirmedSteps: obfuscatedUnconfirmedSteps,
1059
1047
  obfuscatedRemoteSteps: obfuscatedRemoteSteps,
1060
1048
  obfuscatedRebasedSteps: obfuscatedRebasedSteps,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "11.3.1";
2
+ export var version = "0.0.0-development";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "11.3.2",
3
+ "version": "12.0.0",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,12 +25,6 @@
25
25
  "atlassian": {
26
26
  "team": "Editor: Collaboration"
27
27
  },
28
- "af:exports": {
29
- ".": "./src/index.ts",
30
- "./socket-io-provider": "./src/socket-io-provider.ts",
31
- "./types": "./src/types.ts",
32
- "./version-wrapper": "./src/version-wrapper.ts"
33
- },
34
28
  "dependencies": {
35
29
  "@atlaskit/adf-utils": "^19.21.0",
36
30
  "@atlaskit/analytics-gas-types": "^5.1.0",
@@ -41,8 +35,8 @@
41
35
  "@atlaskit/feature-gate-js-client": "^5.5.0",
42
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
43
37
  "@atlaskit/prosemirror-collab": "^0.17.0",
44
- "@atlaskit/react-ufo": "^4.4.0",
45
- "@atlaskit/tmp-editor-statsig": "^11.6.0",
38
+ "@atlaskit/react-ufo": "^4.5.0",
39
+ "@atlaskit/tmp-editor-statsig": "^12.0.0",
46
40
  "@atlaskit/ufo": "^0.4.0",
47
41
  "@atlaskit/util-service-support": "^6.3.0",
48
42
  "@babel/runtime": "^7.0.0",
@@ -68,16 +62,13 @@
68
62
  }
69
63
  },
70
64
  "devDependencies": {
71
- "@atlaskit/adf-schema": "^50.2.1",
65
+ "@atlaskit/adf-schema": "^50.2.3",
72
66
  "@atlassian/feature-flags-test-utils": "^0.3.0"
73
67
  },
74
68
  "platform-feature-flags": {
75
69
  "platform_collab_provider_tracingheaders": {
76
70
  "type": "boolean"
77
71
  },
78
- "platform-editor-reconcile-return-generated-steps": {
79
- "type": "boolean"
80
- },
81
72
  "platform-editor-presence-websocket-only": {
82
73
  "type": "boolean"
83
74
  },
@@ -86,6 +77,6 @@
86
77
  }
87
78
  },
88
79
  "peerDependencies": {
89
- "@atlaskit/editor-common": "^107.29.0"
80
+ "@atlaskit/editor-common": "^108.0.0"
90
81
  }
91
82
  }