@atlaskit/collab-provider 26.0.9 → 27.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,24 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 27.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 26.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - [`0f5c0015f457f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f5c0015f457f) -
14
+ Remove feature gate `platform-editor-collab-edit-websocket-only`. Collab editing on commercial and
15
+ non-GCP tenants reverts to the default polling-first transport strategy.
16
+ - [`962e8dc0188bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/962e8dc0188bf) -
17
+ Clean up `platform_editor_offline_editing_web` with `isEnabled: true` for Confluence, keeping
18
+ offline editing and recovery behavior enabled. Remove the retired experiment from the editor
19
+ Statsig configuration; consumers must stop querying or overriding this experiment.
20
+ - Updated dependencies
21
+
3
22
  ## 26.0.9
4
23
 
5
24
  ### Patch Changes
@@ -17,7 +17,6 @@ var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
17
17
  var _state = require("@atlaskit/editor-prosemirror/state");
18
18
  var _JSONTransformer = require("@atlaskit/editor-json-transformer/JSONTransformer-2");
19
19
  var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure");
20
- var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
21
20
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
22
21
  var _const = require("../helpers/const");
23
22
  var _performance = require("../analytics/performance");
@@ -790,13 +789,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
790
789
  * mutated in: `packages/editor/editor-plugin-collab-edit/src/pm-plugins/mergeUnconfirmed.ts`
791
790
  */
792
791
  (0, _defineProperty2.default)(this, "lockSteps", function () {
793
- if ((0, _editorExperiment.editorExperiment)('platform_editor_offline_editing_web', true) || (0, _expValEquals.expValEquals)('platform_editor_enable_single_player_step_merging', 'isEnabled', true)) {
794
- var _this$getState8;
795
- var currentState = (_this$getState8 = _this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(_this);
796
- if (currentState) {
797
- var _sendableSteps$origin, _sendableSteps3;
798
- _this.lockStepOrigins((_sendableSteps$origin = (_sendableSteps3 = (0, _prosemirrorCollab.sendableSteps)(currentState)) === null || _sendableSteps3 === void 0 ? void 0 : _sendableSteps3.origins) !== null && _sendableSteps$origin !== void 0 ? _sendableSteps$origin : []);
799
- }
792
+ var _this$getState8;
793
+ var currentState = (_this$getState8 = _this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(_this);
794
+ if (currentState) {
795
+ var _sendableSteps$origin, _sendableSteps3;
796
+ _this.lockStepOrigins((_sendableSteps$origin = (_sendableSteps3 = (0, _prosemirrorCollab.sendableSteps)(currentState)) === null || _sendableSteps3 === void 0 ? void 0 : _sendableSteps3.origins) !== null && _sendableSteps$origin !== void 0 ? _sendableSteps$origin : []);
800
797
  }
801
798
  });
802
799
  (0, _defineProperty2.default)(this, "lockStepOrigins", function (origins) {
@@ -854,9 +851,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
854
851
  */
855
852
  function notifyReconnectionConflict(steps) {
856
853
  var _this$getState9, _getCollabState;
857
- if ((0, _editorExperiment.editorExperiment)('platform_editor_offline_editing_web', false)) {
858
- return;
859
- }
860
854
  var state = (_this$getState9 = this.getState) === null || _this$getState9 === void 0 ? void 0 : _this$getState9.call(this);
861
855
  var unconfirmedSteps = state ? (_getCollabState = (0, _prosemirrorCollab.getCollabState)(state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.unconfirmed : undefined;
862
856
  if (steps.length > 0 && state && unconfirmedSteps && unconfirmedSteps.length > 0) {
@@ -1099,7 +1093,6 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1099
1093
  var _this$getState1,
1100
1094
  _this$getState10,
1101
1095
  _this4 = this;
1102
- var offlineEditingEnabled = (0, _editorExperiment.editorExperiment)('platform_editor_offline_editing_web', true);
1103
1096
  var onlineStepMergingEnabled = (0, _expValEquals.expValEquals)('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
1104
1097
  // We don't trust `_newState` not to be stale
1105
1098
  // ED-29051 - the `onEditorViewStateUpdated` can have a stale state in edge cases. We need
@@ -1108,20 +1101,16 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1108
1101
  var newState = onlineStepMergingEnabled ? (_this$getState1 = (_this$getState10 = this.getState) === null || _this$getState10 === void 0 ? void 0 : _this$getState10.call(this)) !== null && _this$getState1 !== void 0 ? _this$getState1 : _newState : _newState;
1109
1102
 
1110
1103
  // Don't send any steps before we're ready.
1111
- if (offlineEditingEnabled || onlineStepMergingEnabled) {
1112
- var enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
1113
- if (!this.getConnected() || enableOnlineStepMerging) {
1114
- return;
1115
- }
1104
+ var enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
1105
+ if (!this.getConnected() || enableOnlineStepMerging) {
1106
+ return;
1116
1107
  }
1117
1108
  var unconfirmedStepsData = (0, _prosemirrorCollab.sendableSteps)(newState);
1118
1109
  var version = this.getVersionFromCollabState(newState, 'collab-provider: send');
1119
1110
  if (!unconfirmedStepsData) {
1120
1111
  return;
1121
1112
  }
1122
- if (offlineEditingEnabled || onlineStepMergingEnabled) {
1123
- this.lockStepOrigins(unconfirmedStepsData.origins);
1124
- }
1113
+ this.lockStepOrigins(unconfirmedStepsData.origins);
1125
1114
  var unconfirmedSteps = unconfirmedStepsData.steps;
1126
1115
  // sendAnalyticsEvent is only true when buffering is enabled,
1127
1116
  // to ensure that analytics events with the number of unconfirmed steps is only
@@ -1152,37 +1141,35 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1152
1141
  versionAfter: version
1153
1142
  });
1154
1143
  }
1155
- if ((0, _editorExperiment.editorExperiment)('platform_editor_offline_editing_web', true)) {
1156
- var containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(function (tr) {
1157
- var _tr$getMeta;
1158
- return tr instanceof _state.Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
1159
- });
1160
- if (containsOfflineSteps && !this.timeoutExceeded) {
1161
- // Only start timer if we're online and don't already have one running
1162
- if (this.getConnected() && !this.timeout) {
1163
- this.timeout = setTimeout(function () {
1164
- // If the timer expires and we're still online, handle the offline steps.
1165
- // Otherwise, clear the timer so it can restart when we're online again.
1166
- if (_this4.getConnected()) {
1167
- _this4.timeoutExceeded = true;
1168
- var updatedUnconfirmedStepsData = (0, _prosemirrorCollab.sendableSteps)(newState);
1169
- updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 || updatedUnconfirmedStepsData.origins.forEach(function (origin) {
1170
- if (origin instanceof _state.Transaction && origin.getMeta('isOffline')) {
1171
- origin.setMeta('isOffline', false);
1172
- }
1173
- });
1174
- } else {
1175
- _this4.timeout = undefined;
1176
- }
1177
- }, 6000);
1178
- }
1179
- return;
1180
- } else if (this.timeoutExceeded) {
1181
- this.timeoutExceeded = false;
1182
- if (this.timeout) {
1183
- clearTimeout(this.timeout);
1184
- this.timeout = undefined;
1185
- }
1144
+ var containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(function (tr) {
1145
+ var _tr$getMeta;
1146
+ return tr instanceof _state.Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
1147
+ });
1148
+ if (containsOfflineSteps && !this.timeoutExceeded) {
1149
+ // Only start timer if we're online and don't already have one running
1150
+ if (this.getConnected() && !this.timeout) {
1151
+ this.timeout = setTimeout(function () {
1152
+ // If the timer expires and we're still online, handle the offline steps.
1153
+ // Otherwise, clear the timer so it can restart when we're online again.
1154
+ if (_this4.getConnected()) {
1155
+ _this4.timeoutExceeded = true;
1156
+ var updatedUnconfirmedStepsData = (0, _prosemirrorCollab.sendableSteps)(newState);
1157
+ updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 || updatedUnconfirmedStepsData.origins.forEach(function (origin) {
1158
+ if (origin instanceof _state.Transaction && origin.getMeta('isOffline')) {
1159
+ origin.setMeta('isOffline', false);
1160
+ }
1161
+ });
1162
+ } else {
1163
+ _this4.timeout = undefined;
1164
+ }
1165
+ }, 6000);
1166
+ }
1167
+ return;
1168
+ } else if (this.timeoutExceeded) {
1169
+ this.timeoutExceeded = false;
1170
+ if (this.timeout) {
1171
+ clearTimeout(this.timeout);
1172
+ this.timeout = undefined;
1186
1173
  }
1187
1174
  }
1188
1175
 
@@ -15,7 +15,6 @@ var _ncsErrors = require("../errors/ncs-errors");
15
15
  var _utils = require("../helpers/utils");
16
16
  var _transactionAgentAttribution = require("@atlaskit/editor-common/transaction-agent-attribution");
17
17
  var _fg = require("@atlaskit/platform-feature-flags/fg");
18
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
19
18
  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; }
20
19
  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; }
21
20
  var logger = (0, _utils.createLogger)('commit-step', 'black');
@@ -124,9 +123,7 @@ var CommitStepService = exports.CommitStepService = /*#__PURE__*/function () {
124
123
  return step;
125
124
  });
126
125
  }
127
- if ((0, _expValEquals.expValEquals)('platform_editor_offline_editing_web', 'isEnabled', true)) {
128
- stepsWithClientAndUserId = this.addOfflineMetadata(stepsWithClientAndUserId, stepOrigins);
129
- }
126
+ stepsWithClientAndUserId = this.addOfflineMetadata(stepsWithClientAndUserId, stepOrigins);
130
127
  var start = new Date().getTime();
131
128
  var ADD_STEPS_ACKNOWLEDGEMENT_ERROR_MSG = 'Error while adding steps - Invalid Acknowledgement';
132
129
  var ADD_STEPS_BROADCAST_ERROR_MSG = 'Error while adding steps - Broadcast threw exception';
@@ -19,7 +19,6 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
19
19
  var _emitter = require("../emitter");
20
20
  var _channel = require("../channel");
21
21
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
22
- var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
23
22
  var _utils = require("../helpers/utils");
24
23
  var _analyticsHelper = _interopRequireDefault(require("../analytics/analytics-helper"));
25
24
  var _telepointersHelper = require("../participants/telepointers-helper");
@@ -158,8 +157,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
158
157
  if (offlineDuration !== undefined) {
159
158
  _this.documentService.throttledCatchupv2(_const.CatchupEventReason.RECONNECTED, {
160
159
  disconnectionPeriodSeconds: Math.floor(offlineDuration / 1000),
161
- offlineStepsLength: (0, _editorExperiment.editorExperiment)('platform_editor_offline_editing_web', true) ? (0, _getOfflineStepsLength.getOfflineStepsLength)(_this.documentService.getUnconfirmedSteps(), _this.documentService.getUnconfirmedStepsOrigins()) : undefined,
162
- offlineReplaceStepsLength: (0, _editorExperiment.editorExperiment)('platform_editor_offline_editing_web', true) ? (0, _getOfflineStepsLength.getOfflineReplaceStepsLength)(_this.documentService.getUnconfirmedSteps(), _this.documentService.getUnconfirmedStepsOrigins()) : undefined,
160
+ offlineStepsLength: (0, _getOfflineStepsLength.getOfflineStepsLength)(_this.documentService.getUnconfirmedSteps(), _this.documentService.getUnconfirmedStepsOrigins()),
161
+ offlineReplaceStepsLength: (0, _getOfflineStepsLength.getOfflineReplaceStepsLength)(_this.documentService.getUnconfirmedSteps(), _this.documentService.getUnconfirmedStepsOrigins()),
163
162
  unconfirmedStepsLength: unconfirmedStepsLength
164
163
  }, _this.sessionId);
165
164
  } else if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_early_exit_return_draft')) {
@@ -33,8 +33,8 @@ function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsH
33
33
  // Collab editing: GCP tenant
34
34
  return 'gcp-collab';
35
35
  } else {
36
- // Collab editing: commercial and all other tenants
37
- return 'collab-edit';
36
+ // Collab editing: commercial and all other tenants — polling first, with WebSocket upgrade fallback
37
+ return 'default';
38
38
  }
39
39
  };
40
40
  switch (getConnectionCase()) {
@@ -51,12 +51,6 @@ function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsH
51
51
  transports = ['websocket'];
52
52
  }
53
53
  break;
54
- case 'collab-edit':
55
- // Collab edit (commercial and all other tenants): WebSocket only when flag is enabled, otherwise polling fallback
56
- if ((0, _fg.fg)('platform-editor-collab-edit-websocket-only')) {
57
- transports = ['websocket'];
58
- }
59
- break;
60
54
  default:
61
55
  // Default: polling first, with WebSocket upgrade fallback
62
56
  break;
@@ -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 = "26.0.9";
8
+ var version = exports.version = "26.0.10";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -5,7 +5,6 @@ import { getCollabState, sendableSteps } from '@atlaskit/prosemirror-collab';
5
5
  import { Transaction } from '@atlaskit/editor-prosemirror/state';
6
6
  import { JSONTransformer } from '@atlaskit/editor-json-transformer/JSONTransformer-2';
7
7
  import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
8
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
9
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
9
  import { ACK_MAX_TRY, EVENT_ACTION, EVENT_STATUS, CatchupEventReason } from '../helpers/const';
11
10
  import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
@@ -678,13 +677,11 @@ export class DocumentService {
678
677
  * mutated in: `packages/editor/editor-plugin-collab-edit/src/pm-plugins/mergeUnconfirmed.ts`
679
678
  */
680
679
  _defineProperty(this, "lockSteps", () => {
681
- if (editorExperiment('platform_editor_offline_editing_web', true) || expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true)) {
682
- var _this$getState8;
683
- const currentState = (_this$getState8 = this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(this);
684
- if (currentState) {
685
- var _sendableSteps$origin, _sendableSteps3;
686
- this.lockStepOrigins((_sendableSteps$origin = (_sendableSteps3 = sendableSteps(currentState)) === null || _sendableSteps3 === void 0 ? void 0 : _sendableSteps3.origins) !== null && _sendableSteps$origin !== void 0 ? _sendableSteps$origin : []);
687
- }
680
+ var _this$getState8;
681
+ const currentState = (_this$getState8 = this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(this);
682
+ if (currentState) {
683
+ var _sendableSteps$origin, _sendableSteps3;
684
+ this.lockStepOrigins((_sendableSteps$origin = (_sendableSteps3 = sendableSteps(currentState)) === null || _sendableSteps3 === void 0 ? void 0 : _sendableSteps3.origins) !== null && _sendableSteps$origin !== void 0 ? _sendableSteps$origin : []);
688
685
  }
689
686
  });
690
687
  _defineProperty(this, "lockStepOrigins", origins => {
@@ -737,9 +734,6 @@ export class DocumentService {
737
734
  */
738
735
  notifyReconnectionConflict(steps) {
739
736
  var _this$getState9, _getCollabState;
740
- if (editorExperiment('platform_editor_offline_editing_web', false)) {
741
- return;
742
- }
743
737
  const state = (_this$getState9 = this.getState) === null || _this$getState9 === void 0 ? void 0 : _this$getState9.call(this);
744
738
  const unconfirmedSteps = state ? (_getCollabState = getCollabState(state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.unconfirmed : undefined;
745
739
  if (steps.length > 0 && state && unconfirmedSteps && unconfirmedSteps.length > 0) {
@@ -952,7 +946,6 @@ export class DocumentService {
952
946
  send(tr, _oldState, _newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
953
947
  ) {
954
948
  var _this$getState1, _this$getState10;
955
- const offlineEditingEnabled = editorExperiment('platform_editor_offline_editing_web', true);
956
949
  const onlineStepMergingEnabled = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
957
950
  // We don't trust `_newState` not to be stale
958
951
  // ED-29051 - the `onEditorViewStateUpdated` can have a stale state in edge cases. We need
@@ -961,20 +954,16 @@ export class DocumentService {
961
954
  const newState = onlineStepMergingEnabled ? (_this$getState1 = (_this$getState10 = this.getState) === null || _this$getState10 === void 0 ? void 0 : _this$getState10.call(this)) !== null && _this$getState1 !== void 0 ? _this$getState1 : _newState : _newState;
962
955
 
963
956
  // Don't send any steps before we're ready.
964
- if (offlineEditingEnabled || onlineStepMergingEnabled) {
965
- const enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
966
- if (!this.getConnected() || enableOnlineStepMerging) {
967
- return;
968
- }
957
+ const enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
958
+ if (!this.getConnected() || enableOnlineStepMerging) {
959
+ return;
969
960
  }
970
961
  const unconfirmedStepsData = sendableSteps(newState);
971
962
  const version = this.getVersionFromCollabState(newState, 'collab-provider: send');
972
963
  if (!unconfirmedStepsData) {
973
964
  return;
974
965
  }
975
- if (offlineEditingEnabled || onlineStepMergingEnabled) {
976
- this.lockStepOrigins(unconfirmedStepsData.origins);
977
- }
966
+ this.lockStepOrigins(unconfirmedStepsData.origins);
978
967
  const unconfirmedSteps = unconfirmedStepsData.steps;
979
968
  // sendAnalyticsEvent is only true when buffering is enabled,
980
969
  // to ensure that analytics events with the number of unconfirmed steps is only
@@ -1005,37 +994,35 @@ export class DocumentService {
1005
994
  versionAfter: version
1006
995
  });
1007
996
  }
1008
- if (editorExperiment('platform_editor_offline_editing_web', true)) {
1009
- const containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(tr => {
1010
- var _tr$getMeta;
1011
- return tr instanceof Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
1012
- });
1013
- if (containsOfflineSteps && !this.timeoutExceeded) {
1014
- // Only start timer if we're online and don't already have one running
1015
- if (this.getConnected() && !this.timeout) {
1016
- this.timeout = setTimeout(() => {
1017
- // If the timer expires and we're still online, handle the offline steps.
1018
- // Otherwise, clear the timer so it can restart when we're online again.
1019
- if (this.getConnected()) {
1020
- this.timeoutExceeded = true;
1021
- const updatedUnconfirmedStepsData = sendableSteps(newState);
1022
- updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 ? void 0 : updatedUnconfirmedStepsData.origins.forEach(origin => {
1023
- if (origin instanceof Transaction && origin.getMeta('isOffline')) {
1024
- origin.setMeta('isOffline', false);
1025
- }
1026
- });
1027
- } else {
1028
- this.timeout = undefined;
1029
- }
1030
- }, 6000);
1031
- }
1032
- return;
1033
- } else if (this.timeoutExceeded) {
1034
- this.timeoutExceeded = false;
1035
- if (this.timeout) {
1036
- clearTimeout(this.timeout);
1037
- this.timeout = undefined;
1038
- }
997
+ const containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(tr => {
998
+ var _tr$getMeta;
999
+ return tr instanceof Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
1000
+ });
1001
+ if (containsOfflineSteps && !this.timeoutExceeded) {
1002
+ // Only start timer if we're online and don't already have one running
1003
+ if (this.getConnected() && !this.timeout) {
1004
+ this.timeout = setTimeout(() => {
1005
+ // If the timer expires and we're still online, handle the offline steps.
1006
+ // Otherwise, clear the timer so it can restart when we're online again.
1007
+ if (this.getConnected()) {
1008
+ this.timeoutExceeded = true;
1009
+ const updatedUnconfirmedStepsData = sendableSteps(newState);
1010
+ updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 ? void 0 : updatedUnconfirmedStepsData.origins.forEach(origin => {
1011
+ if (origin instanceof Transaction && origin.getMeta('isOffline')) {
1012
+ origin.setMeta('isOffline', false);
1013
+ }
1014
+ });
1015
+ } else {
1016
+ this.timeout = undefined;
1017
+ }
1018
+ }, 6000);
1019
+ }
1020
+ return;
1021
+ } else if (this.timeoutExceeded) {
1022
+ this.timeoutExceeded = false;
1023
+ if (this.timeout) {
1024
+ clearTimeout(this.timeout);
1025
+ this.timeout = undefined;
1039
1026
  }
1040
1027
  }
1041
1028
 
@@ -5,7 +5,6 @@ import { NCS_ERROR_CODE } from '../errors/ncs-errors';
5
5
  import { createLogger } from '../helpers/utils';
6
6
  import { AGENT_ATTRIBUTION_META } from '@atlaskit/editor-common/transaction-agent-attribution';
7
7
  import { fg } from '@atlaskit/platform-feature-flags/fg';
8
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
8
  const logger = createLogger('commit-step', 'black');
10
9
  export const RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
11
10
  export class CommitStepService {
@@ -114,9 +113,7 @@ export class CommitStepService {
114
113
  return step;
115
114
  });
116
115
  }
117
- if (expValEquals('platform_editor_offline_editing_web', 'isEnabled', true)) {
118
- stepsWithClientAndUserId = this.addOfflineMetadata(stepsWithClientAndUserId, stepOrigins);
119
- }
116
+ stepsWithClientAndUserId = this.addOfflineMetadata(stepsWithClientAndUserId, stepOrigins);
120
117
  const start = new Date().getTime();
121
118
  const ADD_STEPS_ACKNOWLEDGEMENT_ERROR_MSG = 'Error while adding steps - Invalid Acknowledgement';
122
119
  const ADD_STEPS_BROADCAST_ERROR_MSG = 'Error while adding steps - Broadcast threw exception';
@@ -5,7 +5,6 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
5
5
  import { Emitter } from '../emitter';
6
6
  import { Channel } from '../channel';
7
7
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
9
8
  import { createLogger, logObfuscatedSteps } from '../helpers/utils';
10
9
  import AnalyticsHelper from '../analytics/analytics-helper';
11
10
  import { telepointerCallback } from '../participants/telepointers-helper';
@@ -138,8 +137,8 @@ export class Provider extends Emitter {
138
137
  if (offlineDuration !== undefined) {
139
138
  this.documentService.throttledCatchupv2(CatchupEventReason.RECONNECTED, {
140
139
  disconnectionPeriodSeconds: Math.floor(offlineDuration / 1000),
141
- offlineStepsLength: editorExperiment('platform_editor_offline_editing_web', true) ? getOfflineStepsLength(this.documentService.getUnconfirmedSteps(), this.documentService.getUnconfirmedStepsOrigins()) : undefined,
142
- offlineReplaceStepsLength: editorExperiment('platform_editor_offline_editing_web', true) ? getOfflineReplaceStepsLength(this.documentService.getUnconfirmedSteps(), this.documentService.getUnconfirmedStepsOrigins()) : undefined,
140
+ offlineStepsLength: getOfflineStepsLength(this.documentService.getUnconfirmedSteps(), this.documentService.getUnconfirmedStepsOrigins()),
141
+ offlineReplaceStepsLength: getOfflineReplaceStepsLength(this.documentService.getUnconfirmedSteps(), this.documentService.getUnconfirmedStepsOrigins()),
143
142
  unconfirmedStepsLength: unconfirmedStepsLength
144
143
  }, this.sessionId);
145
144
  } else if (isExperimentEnabled('platform_editor_early_exit_return_draft')) {
@@ -23,8 +23,8 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
23
23
  // Collab editing: GCP tenant
24
24
  return 'gcp-collab';
25
25
  } else {
26
- // Collab editing: commercial and all other tenants
27
- return 'collab-edit';
26
+ // Collab editing: commercial and all other tenants — polling first, with WebSocket upgrade fallback
27
+ return 'default';
28
28
  }
29
29
  };
30
30
  switch (getConnectionCase()) {
@@ -41,12 +41,6 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
41
41
  transports = ['websocket'];
42
42
  }
43
43
  break;
44
- case 'collab-edit':
45
- // Collab edit (commercial and all other tenants): WebSocket only when flag is enabled, otherwise polling fallback
46
- if (fg('platform-editor-collab-edit-websocket-only')) {
47
- transports = ['websocket'];
48
- }
49
- break;
50
44
  default:
51
45
  // Default: polling first, with WebSocket upgrade fallback
52
46
  break;
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "26.0.9";
2
+ export const version = "26.0.10";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -15,7 +15,6 @@ import { getCollabState, sendableSteps } from '@atlaskit/prosemirror-collab';
15
15
  import { Transaction } from '@atlaskit/editor-prosemirror/state';
16
16
  import { JSONTransformer } from '@atlaskit/editor-json-transformer/JSONTransformer-2';
17
17
  import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
18
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
19
18
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
20
19
  import { ACK_MAX_TRY, EVENT_ACTION, EVENT_STATUS, CatchupEventReason } from '../helpers/const';
21
20
  import { MEASURE_NAME, startMeasure, stopMeasure } from '../analytics/performance';
@@ -784,13 +783,11 @@ export var DocumentService = /*#__PURE__*/function () {
784
783
  * mutated in: `packages/editor/editor-plugin-collab-edit/src/pm-plugins/mergeUnconfirmed.ts`
785
784
  */
786
785
  _defineProperty(this, "lockSteps", function () {
787
- if (editorExperiment('platform_editor_offline_editing_web', true) || expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true)) {
788
- var _this$getState8;
789
- var currentState = (_this$getState8 = _this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(_this);
790
- if (currentState) {
791
- var _sendableSteps$origin, _sendableSteps3;
792
- _this.lockStepOrigins((_sendableSteps$origin = (_sendableSteps3 = sendableSteps(currentState)) === null || _sendableSteps3 === void 0 ? void 0 : _sendableSteps3.origins) !== null && _sendableSteps$origin !== void 0 ? _sendableSteps$origin : []);
793
- }
786
+ var _this$getState8;
787
+ var currentState = (_this$getState8 = _this.getState) === null || _this$getState8 === void 0 ? void 0 : _this$getState8.call(_this);
788
+ if (currentState) {
789
+ var _sendableSteps$origin, _sendableSteps3;
790
+ _this.lockStepOrigins((_sendableSteps$origin = (_sendableSteps3 = sendableSteps(currentState)) === null || _sendableSteps3 === void 0 ? void 0 : _sendableSteps3.origins) !== null && _sendableSteps$origin !== void 0 ? _sendableSteps$origin : []);
794
791
  }
795
792
  });
796
793
  _defineProperty(this, "lockStepOrigins", function (origins) {
@@ -848,9 +845,6 @@ export var DocumentService = /*#__PURE__*/function () {
848
845
  */
849
846
  function notifyReconnectionConflict(steps) {
850
847
  var _this$getState9, _getCollabState;
851
- if (editorExperiment('platform_editor_offline_editing_web', false)) {
852
- return;
853
- }
854
848
  var state = (_this$getState9 = this.getState) === null || _this$getState9 === void 0 ? void 0 : _this$getState9.call(this);
855
849
  var unconfirmedSteps = state ? (_getCollabState = getCollabState(state)) === null || _getCollabState === void 0 ? void 0 : _getCollabState.unconfirmed : undefined;
856
850
  if (steps.length > 0 && state && unconfirmedSteps && unconfirmedSteps.length > 0) {
@@ -1093,7 +1087,6 @@ export var DocumentService = /*#__PURE__*/function () {
1093
1087
  var _this$getState1,
1094
1088
  _this$getState10,
1095
1089
  _this4 = this;
1096
- var offlineEditingEnabled = editorExperiment('platform_editor_offline_editing_web', true);
1097
1090
  var onlineStepMergingEnabled = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
1098
1091
  // We don't trust `_newState` not to be stale
1099
1092
  // ED-29051 - the `onEditorViewStateUpdated` can have a stale state in edge cases. We need
@@ -1102,20 +1095,16 @@ export var DocumentService = /*#__PURE__*/function () {
1102
1095
  var newState = onlineStepMergingEnabled ? (_this$getState1 = (_this$getState10 = this.getState) === null || _this$getState10 === void 0 ? void 0 : _this$getState10.call(this)) !== null && _this$getState1 !== void 0 ? _this$getState1 : _newState : _newState;
1103
1096
 
1104
1097
  // Don't send any steps before we're ready.
1105
- if (offlineEditingEnabled || onlineStepMergingEnabled) {
1106
- var enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
1107
- if (!this.getConnected() || enableOnlineStepMerging) {
1108
- return;
1109
- }
1098
+ var enableOnlineStepMerging = onlineStepMergingEnabled && !this.commitStepService.getReadyToCommitStatus();
1099
+ if (!this.getConnected() || enableOnlineStepMerging) {
1100
+ return;
1110
1101
  }
1111
1102
  var unconfirmedStepsData = sendableSteps(newState);
1112
1103
  var version = this.getVersionFromCollabState(newState, 'collab-provider: send');
1113
1104
  if (!unconfirmedStepsData) {
1114
1105
  return;
1115
1106
  }
1116
- if (offlineEditingEnabled || onlineStepMergingEnabled) {
1117
- this.lockStepOrigins(unconfirmedStepsData.origins);
1118
- }
1107
+ this.lockStepOrigins(unconfirmedStepsData.origins);
1119
1108
  var unconfirmedSteps = unconfirmedStepsData.steps;
1120
1109
  // sendAnalyticsEvent is only true when buffering is enabled,
1121
1110
  // to ensure that analytics events with the number of unconfirmed steps is only
@@ -1146,37 +1135,35 @@ export var DocumentService = /*#__PURE__*/function () {
1146
1135
  versionAfter: version
1147
1136
  });
1148
1137
  }
1149
- if (editorExperiment('platform_editor_offline_editing_web', true)) {
1150
- var containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(function (tr) {
1151
- var _tr$getMeta;
1152
- return tr instanceof Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
1153
- });
1154
- if (containsOfflineSteps && !this.timeoutExceeded) {
1155
- // Only start timer if we're online and don't already have one running
1156
- if (this.getConnected() && !this.timeout) {
1157
- this.timeout = setTimeout(function () {
1158
- // If the timer expires and we're still online, handle the offline steps.
1159
- // Otherwise, clear the timer so it can restart when we're online again.
1160
- if (_this4.getConnected()) {
1161
- _this4.timeoutExceeded = true;
1162
- var updatedUnconfirmedStepsData = sendableSteps(newState);
1163
- updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 || updatedUnconfirmedStepsData.origins.forEach(function (origin) {
1164
- if (origin instanceof Transaction && origin.getMeta('isOffline')) {
1165
- origin.setMeta('isOffline', false);
1166
- }
1167
- });
1168
- } else {
1169
- _this4.timeout = undefined;
1170
- }
1171
- }, 6000);
1172
- }
1173
- return;
1174
- } else if (this.timeoutExceeded) {
1175
- this.timeoutExceeded = false;
1176
- if (this.timeout) {
1177
- clearTimeout(this.timeout);
1178
- this.timeout = undefined;
1179
- }
1138
+ var containsOfflineSteps = unconfirmedStepsData === null || unconfirmedStepsData === void 0 ? void 0 : unconfirmedStepsData.origins.some(function (tr) {
1139
+ var _tr$getMeta;
1140
+ return tr instanceof Transaction ? (_tr$getMeta = tr.getMeta('isOffline')) !== null && _tr$getMeta !== void 0 ? _tr$getMeta : false : false;
1141
+ });
1142
+ if (containsOfflineSteps && !this.timeoutExceeded) {
1143
+ // Only start timer if we're online and don't already have one running
1144
+ if (this.getConnected() && !this.timeout) {
1145
+ this.timeout = setTimeout(function () {
1146
+ // If the timer expires and we're still online, handle the offline steps.
1147
+ // Otherwise, clear the timer so it can restart when we're online again.
1148
+ if (_this4.getConnected()) {
1149
+ _this4.timeoutExceeded = true;
1150
+ var updatedUnconfirmedStepsData = sendableSteps(newState);
1151
+ updatedUnconfirmedStepsData === null || updatedUnconfirmedStepsData === void 0 || updatedUnconfirmedStepsData.origins.forEach(function (origin) {
1152
+ if (origin instanceof Transaction && origin.getMeta('isOffline')) {
1153
+ origin.setMeta('isOffline', false);
1154
+ }
1155
+ });
1156
+ } else {
1157
+ _this4.timeout = undefined;
1158
+ }
1159
+ }, 6000);
1160
+ }
1161
+ return;
1162
+ } else if (this.timeoutExceeded) {
1163
+ this.timeoutExceeded = false;
1164
+ if (this.timeout) {
1165
+ clearTimeout(this.timeout);
1166
+ this.timeout = undefined;
1180
1167
  }
1181
1168
  }
1182
1169
 
@@ -10,7 +10,6 @@ import { NCS_ERROR_CODE } from '../errors/ncs-errors';
10
10
  import { createLogger } from '../helpers/utils';
11
11
  import { AGENT_ATTRIBUTION_META } from '@atlaskit/editor-common/transaction-agent-attribution';
12
12
  import { fg } from '@atlaskit/platform-feature-flags/fg';
13
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
13
  var logger = createLogger('commit-step', 'black');
15
14
  export var RESET_READYTOCOMMIT_INTERVAL_MS = 5000;
16
15
  export var CommitStepService = /*#__PURE__*/function () {
@@ -117,9 +116,7 @@ export var CommitStepService = /*#__PURE__*/function () {
117
116
  return step;
118
117
  });
119
118
  }
120
- if (expValEquals('platform_editor_offline_editing_web', 'isEnabled', true)) {
121
- stepsWithClientAndUserId = this.addOfflineMetadata(stepsWithClientAndUserId, stepOrigins);
122
- }
119
+ stepsWithClientAndUserId = this.addOfflineMetadata(stepsWithClientAndUserId, stepOrigins);
123
120
  var start = new Date().getTime();
124
121
  var ADD_STEPS_ACKNOWLEDGEMENT_ERROR_MSG = 'Error while adding steps - Invalid Acknowledgement';
125
122
  var ADD_STEPS_BROADCAST_ERROR_MSG = 'Error while adding steps - Broadcast threw exception';
@@ -18,7 +18,6 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
18
18
  import { Emitter } from '../emitter';
19
19
  import { Channel } from '../channel';
20
20
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
21
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
22
21
  import { createLogger, logObfuscatedSteps } from '../helpers/utils';
23
22
  import AnalyticsHelper from '../analytics/analytics-helper';
24
23
  import { telepointerCallback } from '../participants/telepointers-helper';
@@ -152,8 +151,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
152
151
  if (offlineDuration !== undefined) {
153
152
  _this.documentService.throttledCatchupv2(CatchupEventReason.RECONNECTED, {
154
153
  disconnectionPeriodSeconds: Math.floor(offlineDuration / 1000),
155
- offlineStepsLength: editorExperiment('platform_editor_offline_editing_web', true) ? getOfflineStepsLength(_this.documentService.getUnconfirmedSteps(), _this.documentService.getUnconfirmedStepsOrigins()) : undefined,
156
- offlineReplaceStepsLength: editorExperiment('platform_editor_offline_editing_web', true) ? getOfflineReplaceStepsLength(_this.documentService.getUnconfirmedSteps(), _this.documentService.getUnconfirmedStepsOrigins()) : undefined,
154
+ offlineStepsLength: getOfflineStepsLength(_this.documentService.getUnconfirmedSteps(), _this.documentService.getUnconfirmedStepsOrigins()),
155
+ offlineReplaceStepsLength: getOfflineReplaceStepsLength(_this.documentService.getUnconfirmedSteps(), _this.documentService.getUnconfirmedStepsOrigins()),
157
156
  unconfirmedStepsLength: unconfirmedStepsLength
158
157
  }, _this.sessionId);
159
158
  } else if (isExperimentEnabled('platform_editor_early_exit_return_draft')) {
@@ -25,8 +25,8 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
25
25
  // Collab editing: GCP tenant
26
26
  return 'gcp-collab';
27
27
  } else {
28
- // Collab editing: commercial and all other tenants
29
- return 'collab-edit';
28
+ // Collab editing: commercial and all other tenants — polling first, with WebSocket upgrade fallback
29
+ return 'default';
30
30
  }
31
31
  };
32
32
  switch (getConnectionCase()) {
@@ -43,12 +43,6 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
43
43
  transports = ['websocket'];
44
44
  }
45
45
  break;
46
- case 'collab-edit':
47
- // Collab edit (commercial and all other tenants): WebSocket only when flag is enabled, otherwise polling fallback
48
- if (fg('platform-editor-collab-edit-websocket-only')) {
49
- transports = ['websocket'];
50
- }
51
- break;
52
46
  default:
53
47
  // Default: polling first, with WebSocket upgrade fallback
54
48
  break;
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "26.0.9";
2
+ export var version = "26.0.10";
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": "26.0.9",
3
+ "version": "27.0.0",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,8 +29,8 @@
29
29
  "@atlaskit/platform-feature-experiments": "^0.3.0",
30
30
  "@atlaskit/platform-feature-flags": "^2.2.0",
31
31
  "@atlaskit/prosemirror-collab": "^1.1.0",
32
- "@atlaskit/react-ufo": "^7.9.0",
33
- "@atlaskit/tmp-editor-statsig": "^187.0.0",
32
+ "@atlaskit/react-ufo": "^7.10.0",
33
+ "@atlaskit/tmp-editor-statsig": "^188.0.0",
34
34
  "@atlaskit/ufo": "^1.2.0",
35
35
  "@atlaskit/util-service-support": "^7.4.0",
36
36
  "@babel/runtime": "^7.0.0",
@@ -64,12 +64,9 @@
64
64
  },
65
65
  "platform_editor_blocked_document_ux": {
66
66
  "type": "boolean"
67
- },
68
- "platform-editor-collab-edit-websocket-only": {
69
- "type": "boolean"
70
67
  }
71
68
  },
72
69
  "peerDependencies": {
73
- "@atlaskit/editor-common": "^121.4.0"
70
+ "@atlaskit/editor-common": "^122.0.0"
74
71
  }
75
72
  }