@atlaskit/collab-provider 26.0.9 → 26.0.10
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 +13 -0
- package/dist/cjs/document/document-service.js +38 -51
- package/dist/cjs/provider/commit-step.js +1 -4
- package/dist/cjs/provider/index.js +2 -3
- package/dist/cjs/socket-io-provider.js +2 -8
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/document/document-service.js +38 -51
- package/dist/es2019/provider/commit-step.js +1 -4
- package/dist/es2019/provider/index.js +2 -3
- package/dist/es2019/socket-io-provider.js +2 -8
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/document/document-service.js +38 -51
- package/dist/esm/provider/commit-step.js +1 -4
- package/dist/esm/provider/index.js +2 -3
- package/dist/esm/socket-io-provider.js +2 -8
- package/dist/esm/version-wrapper.js +1 -1
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/collab-provider
|
|
2
2
|
|
|
3
|
+
## 26.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0f5c0015f457f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f5c0015f457f) -
|
|
8
|
+
Remove feature gate `platform-editor-collab-edit-websocket-only`. Collab editing on commercial and
|
|
9
|
+
non-GCP tenants reverts to the default polling-first transport strategy.
|
|
10
|
+
- [`962e8dc0188bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/962e8dc0188bf) -
|
|
11
|
+
Clean up `platform_editor_offline_editing_web` with `isEnabled: true` for Confluence, keeping
|
|
12
|
+
offline editing and recovery behavior enabled. Remove the retired experiment from the editor
|
|
13
|
+
Statsig configuration; consumers must stop querying or overriding this experiment.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 26.0.9
|
|
4
17
|
|
|
5
18
|
### 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
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
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
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1156
|
-
var
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
if
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
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
|
-
|
|
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,
|
|
162
|
-
offlineReplaceStepsLength: (0,
|
|
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 '
|
|
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.
|
|
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
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
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
|
-
|
|
965
|
-
|
|
966
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
if
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
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
|
-
|
|
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:
|
|
142
|
-
offlineReplaceStepsLength:
|
|
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 '
|
|
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;
|
|
@@ -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
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
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
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1150
|
-
var
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
if
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
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
|
-
|
|
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:
|
|
156
|
-
offlineReplaceStepsLength:
|
|
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 '
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/collab-provider",
|
|
3
|
-
"version": "26.0.
|
|
3
|
+
"version": "26.0.10",
|
|
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.
|
|
33
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
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.
|
|
70
|
+
"@atlaskit/editor-common": "^121.5.0"
|
|
74
71
|
}
|
|
75
72
|
}
|