@atlaskit/collab-provider 14.0.9 → 14.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 14.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 14.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`5bcd467838123`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5bcd467838123) -
14
+ Clean up platform_collab_do_not_client_error_log FG
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 14.0.9
4
21
 
5
22
  ### Patch Changes
@@ -15,7 +15,6 @@ var _transform = require("@atlaskit/editor-prosemirror/transform");
15
15
  var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
16
16
  var _state = require("@atlaskit/editor-prosemirror/state");
17
17
  var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
18
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
18
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
20
19
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
20
  var _const = require("../helpers/const");
@@ -99,7 +98,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
99
98
  */
100
99
  (0, _defineProperty2.default)(this, "catchupv2", /*#__PURE__*/function () {
101
100
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(reason, reconnectionMetadata, sessionId) {
102
- var start, _this$analyticsHelper2, latency, _latency, errorMessage, _this$analyticsHelper3, _this$analyticsHelper4;
101
+ var start, _this$analyticsHelper2, latency, _latency, errorMessage, _this$analyticsHelper3;
103
102
  return _regenerator.default.wrap(function _callee$(_context) {
104
103
  while (1) switch (_context.prev = _context.next) {
105
104
  case 0:
@@ -150,42 +149,33 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
150
149
  latency: latency,
151
150
  version: _this.getCurrentPmVersion()
152
151
  });
153
- _context.next = 20;
152
+ _context.next = 21;
154
153
  break;
155
154
  case 16:
156
155
  _context.prev = 16;
157
156
  _context.t0 = _context["catch"](8);
158
157
  _latency = new Date().getTime() - start; // Skip client side errors; TypeErrors are client side errors https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch
159
- if ((0, _platformFeatureFlags.fg)('platform_collab_do_not_client_error_log')) {
160
- errorMessage = _context.t0 instanceof Error ? _context.t0.message : String(_context.t0);
161
- if (!errorMessage.includes('TypeError') && !(_context.t0 instanceof TypeError)) {
162
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
163
- latency: _latency,
164
- reason: reason,
165
- unconfirmedStepsLength: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.unconfirmedStepsLength,
166
- disconnectionPeriodSeconds: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.disconnectionPeriodSeconds
167
- });
168
- }
169
- } else {
170
- (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
158
+ errorMessage = _context.t0 instanceof Error ? _context.t0.message : String(_context.t0);
159
+ if (!errorMessage.includes('TypeError') && !(_context.t0 instanceof TypeError)) {
160
+ (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
171
161
  latency: _latency,
172
162
  reason: reason,
173
163
  unconfirmedStepsLength: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.unconfirmedStepsLength,
174
164
  disconnectionPeriodSeconds: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.disconnectionPeriodSeconds
175
165
  });
176
166
  }
177
- case 20:
178
- _context.prev = 20;
167
+ case 21:
168
+ _context.prev = 21;
179
169
  _this.stepQueue.resumeQueue();
180
170
  _this.processQueue();
181
171
  _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
182
172
  _this.stepRejectCounter = 0;
183
- return _context.finish(20);
184
- case 26:
173
+ return _context.finish(21);
174
+ case 27:
185
175
  case "end":
186
176
  return _context.stop();
187
177
  }
188
- }, _callee, null, [[8, 16, 20, 26]]);
178
+ }, _callee, null, [[8, 16, 21, 27]]);
189
179
  }));
190
180
  return function (_x, _x2, _x3) {
191
181
  return _ref.apply(this, arguments);
@@ -195,8 +185,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
195
185
  var _this$getState;
196
186
  var state = (_this$getState = _this.getState) === null || _this$getState === void 0 ? void 0 : _this$getState.call(_this);
197
187
  if (!state) {
198
- var _this$analyticsHelper5;
199
- (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
188
+ var _this$analyticsHelper4;
189
+ (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getCurrentPmVersion called without state');
200
190
  return 0;
201
191
  }
202
192
  return _this.getVersionFromCollabState(state, 'collab-provider: getCurrentPmVersion');
@@ -204,7 +194,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
204
194
  // Ignored via go/ees005
205
195
  // eslint-disable-next-line require-await
206
196
  (0, _defineProperty2.default)(this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
207
- var _this$getState2, _this$analyticsHelper7, _this$analyticsHelper6, state, adfDocument, version, currentState, measure, _this$analyticsHelper8, _this$analyticsHelper9, _measure;
197
+ var _this$getState2, _this$analyticsHelper6, _this$analyticsHelper5, state, adfDocument, version, currentState, measure, _this$analyticsHelper7, _this$analyticsHelper8, _measure;
208
198
  return _regenerator.default.wrap(function _callee2$(_context2) {
209
199
  while (1) switch (_context2.prev = _context2.next) {
210
200
  case 0:
@@ -213,7 +203,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
213
203
 
214
204
  // Convert ProseMirror document in Editor state to ADF document
215
205
  if (!((_this$getState2 = _this.getState) !== null && _this$getState2 !== void 0 && _this$getState2.call(_this))) {
216
- (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
206
+ (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
217
207
  }
218
208
  // Ignored via go/ees005
219
209
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -226,7 +216,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
226
216
  stepVersion: version
227
217
  };
228
218
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
229
- (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
219
+ (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
230
220
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
231
221
  });
232
222
  return _context2.abrupt("return", currentState);
@@ -234,10 +224,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
234
224
  _context2.prev = 12;
235
225
  _context2.t0 = _context2["catch"](0);
236
226
  _measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
237
- (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
227
+ (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
238
228
  latency: _measure === null || _measure === void 0 ? void 0 : _measure.duration
239
229
  });
240
- (_this$analyticsHelper9 = _this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
230
+ (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
241
231
  throw _context2.t0;
242
232
  case 18:
243
233
  case "end":
@@ -269,8 +259,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
269
259
  }
270
260
  return false;
271
261
  } catch (err) {
272
- var _this$analyticsHelper0;
273
- (_this$analyticsHelper0 = _this.analyticsHelper) === null || _this$analyticsHelper0 === void 0 || _this$analyticsHelper0.sendErrorEvent(err, 'Error while checking for new clientId for same userId in steps');
262
+ var _this$analyticsHelper9;
263
+ (_this$analyticsHelper9 = _this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(err, 'Error while checking for new clientId for same userId in steps');
274
264
  return false;
275
265
  }
276
266
  });
@@ -278,8 +268,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
278
268
  var _this$getState3, _sendableSteps;
279
269
  var state = (_this$getState3 = _this.getState) === null || _this$getState3 === void 0 ? void 0 : _this$getState3.call(_this);
280
270
  if (!state) {
281
- var _this$analyticsHelper1;
282
- (_this$analyticsHelper1 = _this.analyticsHelper) === null || _this$analyticsHelper1 === void 0 || _this$analyticsHelper1.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedStepsOrigins called without state');
271
+ var _this$analyticsHelper0;
272
+ (_this$analyticsHelper0 = _this.analyticsHelper) === null || _this$analyticsHelper0 === void 0 || _this$analyticsHelper0.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedStepsOrigins called without state');
283
273
  return;
284
274
  }
285
275
  return (_sendableSteps = (0, _prosemirrorCollab.sendableSteps)(state)) === null || _sendableSteps === void 0 ? void 0 : _sendableSteps.origins;
@@ -288,8 +278,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
288
278
  var _this$getState4, _sendableSteps2;
289
279
  var state = (_this$getState4 = _this.getState) === null || _this$getState4 === void 0 ? void 0 : _this$getState4.call(_this);
290
280
  if (!state) {
291
- var _this$analyticsHelper10;
292
- (_this$analyticsHelper10 = _this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedSteps called without state');
281
+ var _this$analyticsHelper1;
282
+ (_this$analyticsHelper1 = _this.analyticsHelper) === null || _this$analyticsHelper1 === void 0 || _this$analyticsHelper1.sendErrorEvent(new Error('No editor state when calling ProseMirror function'), 'getUnconfirmedSteps called without state');
293
283
  return;
294
284
  }
295
285
  return (_sendableSteps2 = (0, _prosemirrorCollab.sendableSteps)(state)) === null || _sendableSteps2 === void 0 ? void 0 : _sendableSteps2.steps;
@@ -332,8 +322,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
332
322
  return userId;
333
323
  }));
334
324
  } catch (stepsAddedError) {
335
- var _this$analyticsHelper11;
336
- (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(stepsAddedError, ADD_STEPS_PROVIDER_ERROR_MSG);
325
+ var _this$analyticsHelper10;
326
+ (_this$analyticsHelper10 = _this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(stepsAddedError, ADD_STEPS_PROVIDER_ERROR_MSG);
337
327
  _this.onErrorHandled({
338
328
  message: ADD_STEPS_PROVIDER_ERROR_MSG,
339
329
  data: {
@@ -373,7 +363,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
373
363
  // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
374
364
  (0, _defineProperty2.default)(this, "onRestore", /*#__PURE__*/function () {
375
365
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref6) {
376
- var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$obfuscateStepsA, obfuscatedSteps, obfuscatedDoc, _this$analyticsHelper16, _this$analyticsHelper12, _this$getState5, generatedDiffStepsResponse, generatedSteps, state, stepsToBeApplied, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper15, _this$analyticsHelper17, _this$analyticsHelper18;
366
+ 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;
377
367
  return _regenerator.default.wrap(function _callee3$(_context3) {
378
368
  while (1) switch (_context3.prev = _context3.next) {
379
369
  case 0:
@@ -412,7 +402,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
412
402
  });
413
403
  _this.metadataService.updateMetadata(metadata);
414
404
  _context3.prev = 13;
415
- (_this$analyticsHelper12 = _this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
405
+ (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
416
406
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
417
407
  obfuscatedSteps: obfuscatedSteps,
418
408
  obfuscatedDoc: obfuscatedDoc,
@@ -453,12 +443,12 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
453
443
  return _transform.Step.fromJSON(state.schema, s);
454
444
  });
455
445
  if (stepsToBeApplied && stepsToBeApplied.length > 0) {
456
- (_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
446
+ (_this$analyticsHelper12 = _this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
457
447
  stepsCount: stepsToBeApplied.length
458
448
  });
459
449
  _this.applyLocalSteps(stepsToBeApplied);
460
450
  } else {
461
- (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
451
+ (_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
462
452
  reason: 'fetchGeneratedDiffSteps returned no steps'
463
453
  });
464
454
  }
@@ -468,9 +458,9 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
468
458
  case 31:
469
459
  _context3.prev = 31;
470
460
  _context3.t1 = _context3["catch"](22);
471
- (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
461
+ (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
472
462
  case 34:
473
- (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
463
+ (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
474
464
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
475
465
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
476
466
  useReconcile: useReconcile,
@@ -483,14 +473,14 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
483
473
  case 37:
484
474
  _context3.prev = 37;
485
475
  _context3.t2 = _context3["catch"](10);
486
- (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
476
+ (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
487
477
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
488
478
  useReconcile: useReconcile,
489
479
  clientId: _this.clientId,
490
480
  targetClientId: targetClientId,
491
481
  triggeredByCatchup: !!targetClientId
492
482
  });
493
- (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
483
+ (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
494
484
  _this.onErrorHandled({
495
485
  message: 'Caught error while trying to recover the document',
496
486
  data: {
@@ -511,7 +501,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
511
501
  }());
512
502
  (0, _defineProperty2.default)(this, "getFinalAcknowledgedState", /*#__PURE__*/function () {
513
503
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(reason) {
514
- var _this$analyticsHelper19, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper20, _this$analyticsHelper21, _measure2;
504
+ var _this$analyticsHelper18, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper19, _this$analyticsHelper20, _measure2;
515
505
  return _regenerator.default.wrap(function _callee4$(_context4) {
516
506
  while (1) switch (_context4.prev = _context4.next) {
517
507
  case 0:
@@ -546,7 +536,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
546
536
  };
547
537
  case 20:
548
538
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
549
- (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
539
+ (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
550
540
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
551
541
  });
552
542
  _this.aggressiveCatchup = false;
@@ -556,10 +546,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
556
546
  _context4.t1 = _context4["catch"](1);
557
547
  _this.aggressiveCatchup = false;
558
548
  _measure2 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
559
- (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
549
+ (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
560
550
  latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
561
551
  });
562
- (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
552
+ (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
563
553
  throw _context4.t1;
564
554
  case 33:
565
555
  case "end":
@@ -594,7 +584,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
594
584
  // ESS-5023: only emit error event if updated client version is still behind server version
595
585
  // client version could become higher than server version due to user editing or plugin adding steps
596
586
  if (updatedVersion < version) {
597
- var _doc$content, _this$analyticsHelper22;
587
+ var _doc$content, _this$analyticsHelper21;
598
588
  var error = new _customErrors.UpdateDocumentError('Failed to update the document', {
599
589
  newVersion: version,
600
590
  editorVersion: updatedVersion,
@@ -603,7 +593,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
603
593
  isDocContentValid: isDocContentValid,
604
594
  caller: caller
605
595
  });
606
- (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendErrorEvent(error, 'Failed to update the document in document service');
596
+ (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(error, 'Failed to update the document in document service');
607
597
  if (_this.enableErrorOnFailedDocumentApply) {
608
598
  _this.onErrorHandled({
609
599
  message: 'The provider failed to apply changes to the editor',
@@ -620,8 +610,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
620
610
  }
621
611
  // Otherwise just fail silently for now
622
612
  } else {
623
- var _this$analyticsHelper23, _doc$content2;
624
- (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendActionEvent(_const.EVENT_ACTION.UPDATE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
613
+ var _this$analyticsHelper22, _doc$content2;
614
+ (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendActionEvent(_const.EVENT_ACTION.UPDATE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
625
615
  newVersion: version,
626
616
  editorVersion: updatedVersion,
627
617
  isDocTruthy: !!doc,
@@ -636,8 +626,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
636
626
  try {
637
627
  var _this$getState6;
638
628
  if (!((_this$getState6 = _this.getState) !== null && _this$getState6 !== void 0 && _this$getState6.call(_this))) {
639
- var _this$analyticsHelper24;
640
- (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
629
+ var _this$analyticsHelper23;
630
+ (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
641
631
  }
642
632
  // Ignored via go/ees005
643
633
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -667,7 +657,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
667
657
  */
668
658
  (0, _defineProperty2.default)(this, "commitUnconfirmedSteps", /*#__PURE__*/function () {
669
659
  var _ref0 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(reason) {
670
- 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;
660
+ 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;
671
661
  return _regenerator.default.wrap(function _callee5$(_context5) {
672
662
  while (1) switch (_context5.prev = _context5.next) {
673
663
  case 0:
@@ -686,7 +676,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
686
676
  lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
687
677
  isLastTrConfirmed = false;
688
678
  if (!((_this$getState7 = _this.getState) !== null && _this$getState7 !== void 0 && _this$getState7.call(_this))) {
689
- (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
679
+ (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
690
680
  }
691
681
  case 9:
692
682
  if (isLastTrConfirmed) {
@@ -736,7 +726,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
736
726
  break;
737
727
  case 22:
738
728
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
739
- (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
729
+ (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
740
730
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
741
731
  // upon success, emit the total number of unconfirmed steps we synced
742
732
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
@@ -748,11 +738,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
748
738
  _context5.prev = 26;
749
739
  _context5.t0 = _context5["catch"](1);
750
740
  _measure3 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
751
- (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
741
+ (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
752
742
  latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
753
743
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
754
744
  });
755
- (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
745
+ (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
756
746
  throw _context5.t0;
757
747
  case 32:
758
748
  case "end":
@@ -765,17 +755,17 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
765
755
  };
766
756
  }());
767
757
  (0, _defineProperty2.default)(this, "onStepRejectedError", function () {
768
- var _this$analyticsHelper29;
758
+ var _this$analyticsHelper28;
769
759
  _this.stepRejectCounter++;
770
760
  logger("Steps rejected (tries=".concat(_this.stepRejectCounter, ")"));
771
- (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO, {
761
+ (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO, {
772
762
  count: _this.stepRejectCounter
773
763
  });
774
764
  var maxRetries = _this.aggressiveCatchup ? _provider.MAX_STEP_REJECTED_ERROR_AGGRESSIVE : _provider.MAX_STEP_REJECTED_ERROR;
775
765
  if (_this.stepRejectCounter >= maxRetries) {
776
- var _this$analyticsHelper30;
766
+ var _this$analyticsHelper29;
777
767
  logger("The steps were rejected too many times (tries=".concat(_this.stepRejectCounter, ", limit=").concat(_provider.MAX_STEP_REJECTED_ERROR, "). Trying to catch-up."));
778
- (_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);
768
+ (_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);
779
769
  _this.throttledCatchupv2(_const.CatchupEventReason.STEPS_REJECTED);
780
770
  } else {
781
771
  // If committing steps failed try again automatically in 1s
@@ -831,15 +821,15 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
831
821
  value: function getVersionFromCollabState(state, resource) {
832
822
  var collabState = (0, _prosemirrorCollab.getCollabState)(state);
833
823
  if (!collabState) {
834
- var _this$analyticsHelper31;
835
- (_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"));
824
+ var _this$analyticsHelper30;
825
+ (_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"));
836
826
  return 0;
837
827
  }
838
828
 
839
829
  // This should not happen in usual, just add error event in case it happens
840
830
  if (collabState.version === undefined) {
841
- var _this$analyticsHelper32;
842
- (_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"));
831
+ var _this$analyticsHelper31;
832
+ (_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"));
843
833
  return 0;
844
834
  }
845
835
  return collabState.version;
@@ -915,7 +905,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
915
905
  logger("Processing data. Version \"".concat(version, "\"."));
916
906
  if (steps !== null && steps !== void 0 && steps.length) {
917
907
  try {
918
- var _this$analyticsHelper33;
908
+ var _this$analyticsHelper32;
919
909
  var clientIds = steps.map(function (_ref1) {
920
910
  var clientId = _ref1.clientId;
921
911
  return clientId;
@@ -937,13 +927,13 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
937
927
  return _this2.sendStepsFromCurrentState();
938
928
  }, 100);
939
929
  }
940
- (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendActionEvent(_const.EVENT_ACTION.PROCESS_STEPS, _const.EVENT_STATUS.SUCCESS);
930
+ (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 || _this$analyticsHelper32.sendActionEvent(_const.EVENT_ACTION.PROCESS_STEPS, _const.EVENT_STATUS.SUCCESS);
941
931
  } catch (error) {
942
- var _this$analyticsHelper34;
932
+ var _this$analyticsHelper33;
943
933
  // ESS-6421: log if error processing steps when there are steps from the same userId but not the same clientId
944
934
  var userIdMatch = this.isStepsFromNewClientIdForSameUserId(steps);
945
935
  logger("Processing steps failed with error: ".concat(error, ". Triggering catch up call."));
946
- (_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");
936
+ (_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");
947
937
  this.throttledCatchupv2(_const.CatchupEventReason.PROCESS_STEPS);
948
938
  }
949
939
  }
@@ -995,8 +985,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
995
985
  var _this$getState0;
996
986
  var state = (_this$getState0 = this.getState) === null || _this$getState0 === void 0 ? void 0 : _this$getState0.call(this);
997
987
  if (!state) {
998
- var _this$analyticsHelper35;
999
- (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
988
+ var _this$analyticsHelper34;
989
+ (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 || _this$analyticsHelper34.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
1000
990
  return;
1001
991
  }
1002
992
  this.send(null, null, state, sendAnalyticsEvent, reason);
@@ -1047,8 +1037,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1047
1037
  // to ensure that analytics events with the number of unconfirmed steps is only
1048
1038
  // sent once on connection (as opposed to on every step)
1049
1039
  if (sendAnalyticsEvent) {
1050
- var _this$analyticsHelper36;
1051
- (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(_const.EVENT_ACTION.HAS_UNCONFIRMED_STEPS, _const.EVENT_STATUS.INFO, {
1040
+ var _this$analyticsHelper35;
1041
+ (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendActionEvent(_const.EVENT_ACTION.HAS_UNCONFIRMED_STEPS, _const.EVENT_STATUS.INFO, {
1052
1042
  numUnconfirmedSteps: (unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) || 0
1053
1043
  });
1054
1044
  }
@@ -1057,12 +1047,12 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1057
1047
  }
1058
1048
  var rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
1059
1049
  if (rebased) {
1060
- var _this$analyticsHelper37;
1050
+ var _this$analyticsHelper36;
1061
1051
  var obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
1062
1052
  var obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
1063
1053
  var obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
1064
1054
  // send analtyics on unconfirmed steps
1065
- (_this$analyticsHelper37 = this.analyticsHelper) === null || _this$analyticsHelper37 === void 0 || _this$analyticsHelper37.sendActionEvent(_const.EVENT_ACTION.STEPS_REBASED, _const.EVENT_STATUS.INFO, {
1055
+ (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(_const.EVENT_ACTION.STEPS_REBASED, _const.EVENT_STATUS.INFO, {
1066
1056
  obfuscatedUnconfirmedSteps: obfuscatedUnconfirmedSteps,
1067
1057
  obfuscatedRemoteSteps: obfuscatedRemoteSteps,
1068
1058
  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 = "14.0.8";
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
  };