@atlaskit/collab-provider 14.0.6 → 14.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 14.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 14.0.6
4
10
 
5
11
  ### Patch Changes
@@ -15,6 +15,7 @@ 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");
18
19
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
19
20
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
21
  var _const = require("../helpers/const");
@@ -98,7 +99,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
98
99
  */
99
100
  (0, _defineProperty2.default)(this, "catchupv2", /*#__PURE__*/function () {
100
101
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(reason, reconnectionMetadata, sessionId) {
101
- var start, _this$analyticsHelper2, latency, _this$analyticsHelper3, _latency;
102
+ var start, _this$analyticsHelper2, latency, _latency, errorMessage, _this$analyticsHelper3, _this$analyticsHelper4;
102
103
  return _regenerator.default.wrap(function _callee$(_context) {
103
104
  while (1) switch (_context.prev = _context.next) {
104
105
  case 0:
@@ -154,13 +155,25 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
154
155
  case 16:
155
156
  _context.prev = 16;
156
157
  _context.t0 = _context["catch"](8);
157
- _latency = new Date().getTime() - start;
158
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendActionEvent(_const.EVENT_ACTION.CATCHUP, _const.EVENT_STATUS.FAILURE, {
159
- latency: _latency,
160
- reason: reason,
161
- unconfirmedStepsLength: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.unconfirmedStepsLength,
162
- disconnectionPeriodSeconds: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.disconnectionPeriodSeconds
163
- });
158
+ _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, {
171
+ latency: _latency,
172
+ reason: reason,
173
+ unconfirmedStepsLength: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.unconfirmedStepsLength,
174
+ disconnectionPeriodSeconds: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.disconnectionPeriodSeconds
175
+ });
176
+ }
164
177
  case 20:
165
178
  _context.prev = 20;
166
179
  _this.stepQueue.resumeQueue();
@@ -182,8 +195,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
182
195
  var _this$getState;
183
196
  var state = (_this$getState = _this.getState) === null || _this$getState === void 0 ? void 0 : _this$getState.call(_this);
184
197
  if (!state) {
185
- var _this$analyticsHelper4;
186
- (_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');
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');
187
200
  return 0;
188
201
  }
189
202
  return _this.getVersionFromCollabState(state, 'collab-provider: getCurrentPmVersion');
@@ -191,7 +204,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
191
204
  // Ignored via go/ees005
192
205
  // eslint-disable-next-line require-await
193
206
  (0, _defineProperty2.default)(this, "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
194
- var _this$getState2, _this$analyticsHelper6, _this$analyticsHelper5, state, adfDocument, version, currentState, measure, _this$analyticsHelper7, _this$analyticsHelper8, _measure;
207
+ var _this$getState2, _this$analyticsHelper7, _this$analyticsHelper6, state, adfDocument, version, currentState, measure, _this$analyticsHelper8, _this$analyticsHelper9, _measure;
195
208
  return _regenerator.default.wrap(function _callee2$(_context2) {
196
209
  while (1) switch (_context2.prev = _context2.next) {
197
210
  case 0:
@@ -200,7 +213,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
200
213
 
201
214
  // Convert ProseMirror document in Editor state to ADF document
202
215
  if (!((_this$getState2 = _this.getState) !== null && _this$getState2 !== void 0 && _this$getState2.call(_this))) {
203
- (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
216
+ (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
204
217
  }
205
218
  // Ignored via go/ees005
206
219
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -213,7 +226,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
213
226
  stepVersion: version
214
227
  };
215
228
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
216
- (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
229
+ (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.SUCCESS, {
217
230
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
218
231
  });
219
232
  return _context2.abrupt("return", currentState);
@@ -221,10 +234,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
221
234
  _context2.prev = 12;
222
235
  _context2.t0 = _context2["catch"](0);
223
236
  _measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
224
- (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
237
+ (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendActionEvent(_const.EVENT_ACTION.GET_CURRENT_STATE, _const.EVENT_STATUS.FAILURE, {
225
238
  latency: _measure === null || _measure === void 0 ? void 0 : _measure.duration
226
239
  });
227
- (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
240
+ (_this$analyticsHelper9 = _this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
228
241
  throw _context2.t0;
229
242
  case 18:
230
243
  case "end":
@@ -256,8 +269,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
256
269
  }
257
270
  return false;
258
271
  } catch (err) {
259
- var _this$analyticsHelper9;
260
- (_this$analyticsHelper9 = _this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(err, 'Error while checking for new clientId for same userId in steps');
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');
261
274
  return false;
262
275
  }
263
276
  });
@@ -265,8 +278,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
265
278
  var _this$getState3, _sendableSteps;
266
279
  var state = (_this$getState3 = _this.getState) === null || _this$getState3 === void 0 ? void 0 : _this$getState3.call(_this);
267
280
  if (!state) {
268
- var _this$analyticsHelper0;
269
- (_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');
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');
270
283
  return;
271
284
  }
272
285
  return (_sendableSteps = (0, _prosemirrorCollab.sendableSteps)(state)) === null || _sendableSteps === void 0 ? void 0 : _sendableSteps.origins;
@@ -275,8 +288,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
275
288
  var _this$getState4, _sendableSteps2;
276
289
  var state = (_this$getState4 = _this.getState) === null || _this$getState4 === void 0 ? void 0 : _this$getState4.call(_this);
277
290
  if (!state) {
278
- var _this$analyticsHelper1;
279
- (_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');
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');
280
293
  return;
281
294
  }
282
295
  return (_sendableSteps2 = (0, _prosemirrorCollab.sendableSteps)(state)) === null || _sendableSteps2 === void 0 ? void 0 : _sendableSteps2.steps;
@@ -319,8 +332,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
319
332
  return userId;
320
333
  }));
321
334
  } catch (stepsAddedError) {
322
- var _this$analyticsHelper10;
323
- (_this$analyticsHelper10 = _this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(stepsAddedError, ADD_STEPS_PROVIDER_ERROR_MSG);
335
+ var _this$analyticsHelper11;
336
+ (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(stepsAddedError, ADD_STEPS_PROVIDER_ERROR_MSG);
324
337
  _this.onErrorHandled({
325
338
  message: ADD_STEPS_PROVIDER_ERROR_MSG,
326
339
  data: {
@@ -360,7 +373,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
360
373
  // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
361
374
  (0, _defineProperty2.default)(this, "onRestore", /*#__PURE__*/function () {
362
375
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref6) {
363
- var doc, version, metadata, targetClientId, unconfirmedSteps, currentState, useReconcile, _this$obfuscateStepsA, obfuscatedSteps, obfuscatedDoc, _this$analyticsHelper15, _this$analyticsHelper11, _this$getState5, generatedDiffStepsResponse, generatedSteps, state, stepsToBeApplied, _this$analyticsHelper12, _this$analyticsHelper13, _this$analyticsHelper14, _this$analyticsHelper16, _this$analyticsHelper17;
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;
364
377
  return _regenerator.default.wrap(function _callee3$(_context3) {
365
378
  while (1) switch (_context3.prev = _context3.next) {
366
379
  case 0:
@@ -399,7 +412,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
399
412
  });
400
413
  _this.metadataService.updateMetadata(metadata);
401
414
  _context3.prev = 13;
402
- (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
415
+ (_this$analyticsHelper12 = _this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
403
416
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
404
417
  obfuscatedSteps: obfuscatedSteps,
405
418
  obfuscatedDoc: obfuscatedDoc,
@@ -440,12 +453,12 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
440
453
  return _transform.Step.fromJSON(state.schema, s);
441
454
  });
442
455
  if (stepsToBeApplied && stepsToBeApplied.length > 0) {
443
- (_this$analyticsHelper12 = _this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
456
+ (_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
444
457
  stepsCount: stepsToBeApplied.length
445
458
  });
446
459
  _this.applyLocalSteps(stepsToBeApplied);
447
460
  } else {
448
- (_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
461
+ (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.INFO, {
449
462
  reason: 'fetchGeneratedDiffSteps returned no steps'
450
463
  });
451
464
  }
@@ -455,9 +468,9 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
455
468
  case 31:
456
469
  _context3.prev = 31;
457
470
  _context3.t1 = _context3["catch"](22);
458
- (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
471
+ (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
459
472
  case 34:
460
- (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
473
+ (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
461
474
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
462
475
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
463
476
  useReconcile: useReconcile,
@@ -470,14 +483,14 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
470
483
  case 37:
471
484
  _context3.prev = 37;
472
485
  _context3.t2 = _context3["catch"](10);
473
- (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
486
+ (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendActionEvent(_const.EVENT_ACTION.REINITIALISE_DOCUMENT, _const.EVENT_STATUS.FAILURE, {
474
487
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
475
488
  useReconcile: useReconcile,
476
489
  clientId: _this.clientId,
477
490
  targetClientId: targetClientId,
478
491
  triggeredByCatchup: !!targetClientId
479
492
  });
480
- (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
493
+ (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
481
494
  _this.onErrorHandled({
482
495
  message: 'Caught error while trying to recover the document',
483
496
  data: {
@@ -498,7 +511,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
498
511
  }());
499
512
  (0, _defineProperty2.default)(this, "getFinalAcknowledgedState", /*#__PURE__*/function () {
500
513
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(reason) {
501
- var _this$analyticsHelper18, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper19, _this$analyticsHelper20, _measure2;
514
+ var _this$analyticsHelper19, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper20, _this$analyticsHelper21, _measure2;
502
515
  return _regenerator.default.wrap(function _callee4$(_context4) {
503
516
  while (1) switch (_context4.prev = _context4.next) {
504
517
  case 0:
@@ -533,7 +546,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
533
546
  };
534
547
  case 20:
535
548
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
536
- (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
549
+ (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.SUCCESS, {
537
550
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
538
551
  });
539
552
  _this.aggressiveCatchup = false;
@@ -543,10 +556,10 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
543
556
  _context4.t1 = _context4["catch"](1);
544
557
  _this.aggressiveCatchup = false;
545
558
  _measure2 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
546
- (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
559
+ (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendActionEvent(_const.EVENT_ACTION.PUBLISH_PAGE, _const.EVENT_STATUS.FAILURE, {
547
560
  latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
548
561
  });
549
- (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
562
+ (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
550
563
  throw _context4.t1;
551
564
  case 33:
552
565
  case "end":
@@ -581,7 +594,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
581
594
  // ESS-5023: only emit error event if updated client version is still behind server version
582
595
  // client version could become higher than server version due to user editing or plugin adding steps
583
596
  if (updatedVersion < version) {
584
- var _doc$content, _this$analyticsHelper21;
597
+ var _doc$content, _this$analyticsHelper22;
585
598
  var error = new _customErrors.UpdateDocumentError('Failed to update the document', {
586
599
  newVersion: version,
587
600
  editorVersion: updatedVersion,
@@ -590,7 +603,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
590
603
  isDocContentValid: isDocContentValid,
591
604
  caller: caller
592
605
  });
593
- (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(error, 'Failed to update the document in document service');
606
+ (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendErrorEvent(error, 'Failed to update the document in document service');
594
607
  if (_this.enableErrorOnFailedDocumentApply) {
595
608
  _this.onErrorHandled({
596
609
  message: 'The provider failed to apply changes to the editor',
@@ -607,8 +620,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
607
620
  }
608
621
  // Otherwise just fail silently for now
609
622
  } else {
610
- var _this$analyticsHelper22, _doc$content2;
611
- (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendActionEvent(_const.EVENT_ACTION.UPDATE_DOCUMENT, _const.EVENT_STATUS.SUCCESS, {
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, {
612
625
  newVersion: version,
613
626
  editorVersion: updatedVersion,
614
627
  isDocTruthy: !!doc,
@@ -623,8 +636,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
623
636
  try {
624
637
  var _this$getState6;
625
638
  if (!((_this$getState6 = _this.getState) !== null && _this$getState6 !== void 0 && _this$getState6.call(_this))) {
626
- var _this$analyticsHelper23;
627
- (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
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');
628
641
  }
629
642
  // Ignored via go/ees005
630
643
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -654,7 +667,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
654
667
  */
655
668
  (0, _defineProperty2.default)(this, "commitUnconfirmedSteps", /*#__PURE__*/function () {
656
669
  var _ref0 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(reason) {
657
- var unconfirmedSteps, _this$getState7, _this$analyticsHelper25, count, unconfirmedTrs, lastTr, isLastTrConfirmed, _this$analyticsHelper24, nextUnconfirmedSteps, nextUnconfirmedTrs, _this$getUnconfirmedS, state, version, unconfirmedStepsInfoUGCRemoved, error, measure, _this$analyticsHelper26, _this$analyticsHelper27, _measure3;
670
+ 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;
658
671
  return _regenerator.default.wrap(function _callee5$(_context5) {
659
672
  while (1) switch (_context5.prev = _context5.next) {
660
673
  case 0:
@@ -673,7 +686,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
673
686
  lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
674
687
  isLastTrConfirmed = false;
675
688
  if (!((_this$getState7 = _this.getState) !== null && _this$getState7 !== void 0 && _this$getState7.call(_this))) {
676
- (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
689
+ (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
677
690
  }
678
691
  case 9:
679
692
  if (isLastTrConfirmed) {
@@ -723,7 +736,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
723
736
  break;
724
737
  case 22:
725
738
  measure = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
726
- (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
739
+ (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.SUCCESS, {
727
740
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
728
741
  // upon success, emit the total number of unconfirmed steps we synced
729
742
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
@@ -735,11 +748,11 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
735
748
  _context5.prev = 26;
736
749
  _context5.t0 = _context5["catch"](1);
737
750
  _measure3 = (0, _performance.stopMeasure)(_performance.MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
738
- (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
751
+ (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendActionEvent(_const.EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, _const.EVENT_STATUS.FAILURE, {
739
752
  latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
740
753
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
741
754
  });
742
- (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
755
+ (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
743
756
  throw _context5.t0;
744
757
  case 32:
745
758
  case "end":
@@ -752,17 +765,17 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
752
765
  };
753
766
  }());
754
767
  (0, _defineProperty2.default)(this, "onStepRejectedError", function () {
755
- var _this$analyticsHelper28;
768
+ var _this$analyticsHelper29;
756
769
  _this.stepRejectCounter++;
757
770
  logger("Steps rejected (tries=".concat(_this.stepRejectCounter, ")"));
758
- (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO, {
771
+ (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(_const.EVENT_ACTION.SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO, {
759
772
  count: _this.stepRejectCounter
760
773
  });
761
774
  var maxRetries = _this.aggressiveCatchup ? _provider.MAX_STEP_REJECTED_ERROR_AGGRESSIVE : _provider.MAX_STEP_REJECTED_ERROR;
762
775
  if (_this.stepRejectCounter >= maxRetries) {
763
- var _this$analyticsHelper29;
776
+ var _this$analyticsHelper30;
764
777
  logger("The steps were rejected too many times (tries=".concat(_this.stepRejectCounter, ", limit=").concat(_provider.MAX_STEP_REJECTED_ERROR, "). Trying to catch-up."));
765
- (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(_const.EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, _const.EVENT_STATUS.INFO);
778
+ (_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);
766
779
  _this.throttledCatchupv2(_const.CatchupEventReason.STEPS_REJECTED);
767
780
  } else {
768
781
  // If committing steps failed try again automatically in 1s
@@ -818,15 +831,15 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
818
831
  value: function getVersionFromCollabState(state, resource) {
819
832
  var collabState = (0, _prosemirrorCollab.getCollabState)(state);
820
833
  if (!collabState) {
821
- var _this$analyticsHelper30;
822
- (_this$analyticsHelper30 = this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 || _this$analyticsHelper30.sendErrorEvent(new Error('No collab state when calling ProseMirror function'), "".concat(resource, " called without collab state"));
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"));
823
836
  return 0;
824
837
  }
825
838
 
826
839
  // This should not happen in usual, just add error event in case it happens
827
840
  if (collabState.version === undefined) {
828
- var _this$analyticsHelper31;
829
- (_this$analyticsHelper31 = this.analyticsHelper) === null || _this$analyticsHelper31 === void 0 || _this$analyticsHelper31.sendErrorEvent(new Error('Collab state missing version info when calling ProseMirror function'), "".concat(resource, " called with collab state missing version info"));
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"));
830
843
  return 0;
831
844
  }
832
845
  return collabState.version;
@@ -902,7 +915,7 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
902
915
  logger("Processing data. Version \"".concat(version, "\"."));
903
916
  if (steps !== null && steps !== void 0 && steps.length) {
904
917
  try {
905
- var _this$analyticsHelper32;
918
+ var _this$analyticsHelper33;
906
919
  var clientIds = steps.map(function (_ref1) {
907
920
  var clientId = _ref1.clientId;
908
921
  return clientId;
@@ -924,13 +937,13 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
924
937
  return _this2.sendStepsFromCurrentState();
925
938
  }, 100);
926
939
  }
927
- (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 || _this$analyticsHelper32.sendActionEvent(_const.EVENT_ACTION.PROCESS_STEPS, _const.EVENT_STATUS.SUCCESS);
940
+ (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendActionEvent(_const.EVENT_ACTION.PROCESS_STEPS, _const.EVENT_STATUS.SUCCESS);
928
941
  } catch (error) {
929
- var _this$analyticsHelper33;
942
+ var _this$analyticsHelper34;
930
943
  // ESS-6421: log if error processing steps when there are steps from the same userId but not the same clientId
931
944
  var userIdMatch = this.isStepsFromNewClientIdForSameUserId(steps);
932
945
  logger("Processing steps failed with error: ".concat(error, ". Triggering catch up call."));
933
- (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendErrorEvent(error, userIdMatch ? "Error while processing steps with new clientId" : "Error while processing steps");
946
+ (_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");
934
947
  this.throttledCatchupv2(_const.CatchupEventReason.PROCESS_STEPS);
935
948
  }
936
949
  }
@@ -982,8 +995,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
982
995
  var _this$getState0;
983
996
  var state = (_this$getState0 = this.getState) === null || _this$getState0 === void 0 ? void 0 : _this$getState0.call(this);
984
997
  if (!state) {
985
- var _this$analyticsHelper34;
986
- (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 || _this$analyticsHelper34.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
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');
987
1000
  return;
988
1001
  }
989
1002
  this.send(null, null, state, sendAnalyticsEvent, reason);
@@ -1034,8 +1047,8 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1034
1047
  // to ensure that analytics events with the number of unconfirmed steps is only
1035
1048
  // sent once on connection (as opposed to on every step)
1036
1049
  if (sendAnalyticsEvent) {
1037
- var _this$analyticsHelper35;
1038
- (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendActionEvent(_const.EVENT_ACTION.HAS_UNCONFIRMED_STEPS, _const.EVENT_STATUS.INFO, {
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, {
1039
1052
  numUnconfirmedSteps: (unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) || 0
1040
1053
  });
1041
1054
  }
@@ -1044,12 +1057,12 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1044
1057
  }
1045
1058
  var rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
1046
1059
  if (rebased) {
1047
- var _this$analyticsHelper36;
1060
+ var _this$analyticsHelper37;
1048
1061
  var obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
1049
1062
  var obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
1050
1063
  var obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
1051
1064
  // send analtyics on unconfirmed steps
1052
- (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(_const.EVENT_ACTION.STEPS_REBASED, _const.EVENT_STATUS.INFO, {
1065
+ (_this$analyticsHelper37 = this.analyticsHelper) === null || _this$analyticsHelper37 === void 0 || _this$analyticsHelper37.sendActionEvent(_const.EVENT_ACTION.STEPS_REBASED, _const.EVENT_STATUS.INFO, {
1053
1066
  obfuscatedUnconfirmedSteps: obfuscatedUnconfirmedSteps,
1054
1067
  obfuscatedRemoteSteps: obfuscatedRemoteSteps,
1055
1068
  obfuscatedRebasedSteps: obfuscatedRebasedSteps,
@@ -38,7 +38,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
38
38
  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; }
39
39
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
40
40
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
41
- function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
41
+ function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
42
42
  var logger = (0, _utils.createLogger)('Provider', 'black');
43
43
  var OUT_OF_SYNC_PERIOD = 3 * 1000; // 3 seconds
44
44
 
@@ -464,6 +464,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
464
464
  // generate a temporary id as clientId when it is undefined
465
465
  // prefix temp-cp- indicates collab-provider
466
466
  if (!this.clientId) {
467
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
467
468
  this.clientId = "temp-cp-".concat((0, _uuid.v4)());
468
469
  }
469
470
  this.documentService.setup({
@@ -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.5";
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
  };