@atlaskit/collab-provider 14.0.8 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,6 @@ import { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform'
10
10
  import { getCollabState, sendableSteps } from '@atlaskit/prosemirror-collab';
11
11
  import { Transaction } from '@atlaskit/editor-prosemirror/state';
12
12
  import { JSONTransformer } from '@atlaskit/editor-json-transformer';
13
- import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
15
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
15
  import { ACK_MAX_TRY, EVENT_ACTION, EVENT_STATUS, CatchupEventReason } from '../helpers/const';
@@ -92,7 +91,7 @@ export var DocumentService = /*#__PURE__*/function () {
92
91
  */
93
92
  _defineProperty(this, "catchupv2", /*#__PURE__*/function () {
94
93
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(reason, reconnectionMetadata, sessionId) {
95
- var start, _this$analyticsHelper2, latency, _latency, errorMessage, _this$analyticsHelper3, _this$analyticsHelper4;
94
+ var start, _this$analyticsHelper2, latency, _latency, errorMessage, _this$analyticsHelper3;
96
95
  return _regeneratorRuntime.wrap(function _callee$(_context) {
97
96
  while (1) switch (_context.prev = _context.next) {
98
97
  case 0:
@@ -143,42 +142,33 @@ export var DocumentService = /*#__PURE__*/function () {
143
142
  latency: latency,
144
143
  version: _this.getCurrentPmVersion()
145
144
  });
146
- _context.next = 20;
145
+ _context.next = 21;
147
146
  break;
148
147
  case 16:
149
148
  _context.prev = 16;
150
149
  _context.t0 = _context["catch"](8);
151
150
  _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
152
- if (fg('platform_collab_do_not_client_error_log')) {
153
- errorMessage = _context.t0 instanceof Error ? _context.t0.message : String(_context.t0);
154
- if (!errorMessage.includes('TypeError') && !(_context.t0 instanceof TypeError)) {
155
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.FAILURE, {
156
- latency: _latency,
157
- reason: reason,
158
- unconfirmedStepsLength: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.unconfirmedStepsLength,
159
- disconnectionPeriodSeconds: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.disconnectionPeriodSeconds
160
- });
161
- }
162
- } else {
163
- (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.FAILURE, {
151
+ errorMessage = _context.t0 instanceof Error ? _context.t0.message : String(_context.t0);
152
+ if (!errorMessage.includes('TypeError') && !(_context.t0 instanceof TypeError)) {
153
+ (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendActionEvent(EVENT_ACTION.CATCHUP, EVENT_STATUS.FAILURE, {
164
154
  latency: _latency,
165
155
  reason: reason,
166
156
  unconfirmedStepsLength: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.unconfirmedStepsLength,
167
157
  disconnectionPeriodSeconds: reconnectionMetadata === null || reconnectionMetadata === void 0 ? void 0 : reconnectionMetadata.disconnectionPeriodSeconds
168
158
  });
169
159
  }
170
- case 20:
171
- _context.prev = 20;
160
+ case 21:
161
+ _context.prev = 21;
172
162
  _this.stepQueue.resumeQueue();
173
163
  _this.processQueue();
174
164
  _this.sendStepsFromCurrentState(); // this will eventually retry catchup as it calls throttledCommitStep which will either catchup on onStepsAdded or onErrorHandled
175
165
  _this.stepRejectCounter = 0;
176
- return _context.finish(20);
177
- case 26:
166
+ return _context.finish(21);
167
+ case 27:
178
168
  case "end":
179
169
  return _context.stop();
180
170
  }
181
- }, _callee, null, [[8, 16, 20, 26]]);
171
+ }, _callee, null, [[8, 16, 21, 27]]);
182
172
  }));
183
173
  return function (_x, _x2, _x3) {
184
174
  return _ref.apply(this, arguments);
@@ -188,8 +178,8 @@ export var DocumentService = /*#__PURE__*/function () {
188
178
  var _this$getState;
189
179
  var state = (_this$getState = _this.getState) === null || _this$getState === void 0 ? void 0 : _this$getState.call(_this);
190
180
  if (!state) {
191
- var _this$analyticsHelper5;
192
- (_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');
181
+ var _this$analyticsHelper4;
182
+ (_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');
193
183
  return 0;
194
184
  }
195
185
  return _this.getVersionFromCollabState(state, 'collab-provider: getCurrentPmVersion');
@@ -197,7 +187,7 @@ export var DocumentService = /*#__PURE__*/function () {
197
187
  // Ignored via go/ees005
198
188
  // eslint-disable-next-line require-await
199
189
  _defineProperty(this, "getCurrentState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
200
- var _this$getState2, _this$analyticsHelper7, _this$analyticsHelper6, state, adfDocument, version, currentState, measure, _this$analyticsHelper8, _this$analyticsHelper9, _measure;
190
+ var _this$getState2, _this$analyticsHelper6, _this$analyticsHelper5, state, adfDocument, version, currentState, measure, _this$analyticsHelper7, _this$analyticsHelper8, _measure;
201
191
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
202
192
  while (1) switch (_context2.prev = _context2.next) {
203
193
  case 0:
@@ -206,7 +196,7 @@ export var DocumentService = /*#__PURE__*/function () {
206
196
 
207
197
  // Convert ProseMirror document in Editor state to ADF document
208
198
  if (!((_this$getState2 = _this.getState) !== null && _this$getState2 !== void 0 && _this$getState2.call(_this))) {
209
- (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
199
+ (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(new Error('Editor state is undefined'), 'getCurrentState called without state');
210
200
  }
211
201
  // Ignored via go/ees005
212
202
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -219,7 +209,7 @@ export var DocumentService = /*#__PURE__*/function () {
219
209
  stepVersion: version
220
210
  };
221
211
  measure = stopMeasure(MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
222
- (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.SUCCESS, {
212
+ (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.SUCCESS, {
223
213
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
224
214
  });
225
215
  return _context2.abrupt("return", currentState);
@@ -227,10 +217,10 @@ export var DocumentService = /*#__PURE__*/function () {
227
217
  _context2.prev = 12;
228
218
  _context2.t0 = _context2["catch"](0);
229
219
  _measure = stopMeasure(MEASURE_NAME.GET_CURRENT_STATE, _this.analyticsHelper);
230
- (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.FAILURE, {
220
+ (_this$analyticsHelper7 = _this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(EVENT_ACTION.GET_CURRENT_STATE, EVENT_STATUS.FAILURE, {
231
221
  latency: _measure === null || _measure === void 0 ? void 0 : _measure.duration
232
222
  });
233
- (_this$analyticsHelper9 = _this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
223
+ (_this$analyticsHelper8 = _this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(_context2.t0, 'Error while returning ADF version of current draft document');
234
224
  throw _context2.t0;
235
225
  case 18:
236
226
  case "end":
@@ -262,8 +252,8 @@ export var DocumentService = /*#__PURE__*/function () {
262
252
  }
263
253
  return false;
264
254
  } catch (err) {
265
- var _this$analyticsHelper0;
266
- (_this$analyticsHelper0 = _this.analyticsHelper) === null || _this$analyticsHelper0 === void 0 || _this$analyticsHelper0.sendErrorEvent(err, 'Error while checking for new clientId for same userId in steps');
255
+ var _this$analyticsHelper9;
256
+ (_this$analyticsHelper9 = _this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(err, 'Error while checking for new clientId for same userId in steps');
267
257
  return false;
268
258
  }
269
259
  });
@@ -271,8 +261,8 @@ export var DocumentService = /*#__PURE__*/function () {
271
261
  var _this$getState3, _sendableSteps;
272
262
  var state = (_this$getState3 = _this.getState) === null || _this$getState3 === void 0 ? void 0 : _this$getState3.call(_this);
273
263
  if (!state) {
274
- var _this$analyticsHelper1;
275
- (_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');
264
+ var _this$analyticsHelper0;
265
+ (_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');
276
266
  return;
277
267
  }
278
268
  return (_sendableSteps = sendableSteps(state)) === null || _sendableSteps === void 0 ? void 0 : _sendableSteps.origins;
@@ -281,8 +271,8 @@ export var DocumentService = /*#__PURE__*/function () {
281
271
  var _this$getState4, _sendableSteps2;
282
272
  var state = (_this$getState4 = _this.getState) === null || _this$getState4 === void 0 ? void 0 : _this$getState4.call(_this);
283
273
  if (!state) {
284
- var _this$analyticsHelper10;
285
- (_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');
274
+ var _this$analyticsHelper1;
275
+ (_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');
286
276
  return;
287
277
  }
288
278
  return (_sendableSteps2 = sendableSteps(state)) === null || _sendableSteps2 === void 0 ? void 0 : _sendableSteps2.steps;
@@ -325,8 +315,8 @@ export var DocumentService = /*#__PURE__*/function () {
325
315
  return userId;
326
316
  }));
327
317
  } catch (stepsAddedError) {
328
- var _this$analyticsHelper11;
329
- (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(stepsAddedError, ADD_STEPS_PROVIDER_ERROR_MSG);
318
+ var _this$analyticsHelper10;
319
+ (_this$analyticsHelper10 = _this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(stepsAddedError, ADD_STEPS_PROVIDER_ERROR_MSG);
330
320
  _this.onErrorHandled({
331
321
  message: ADD_STEPS_PROVIDER_ERROR_MSG,
332
322
  data: {
@@ -366,7 +356,7 @@ export var DocumentService = /*#__PURE__*/function () {
366
356
  // Triggered when page recovery has emitted an 'init' event on a page client is currently connected to.
367
357
  _defineProperty(this, "onRestore", /*#__PURE__*/function () {
368
358
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6) {
369
- 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;
359
+ 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;
370
360
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
371
361
  while (1) switch (_context3.prev = _context3.next) {
372
362
  case 0:
@@ -405,7 +395,7 @@ export var DocumentService = /*#__PURE__*/function () {
405
395
  });
406
396
  _this.metadataService.updateMetadata(metadata);
407
397
  _context3.prev = 13;
408
- (_this$analyticsHelper12 = _this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
398
+ (_this$analyticsHelper11 = _this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
409
399
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
410
400
  obfuscatedSteps: obfuscatedSteps,
411
401
  obfuscatedDoc: obfuscatedDoc,
@@ -446,12 +436,12 @@ export var DocumentService = /*#__PURE__*/function () {
446
436
  return ProseMirrorStep.fromJSON(state.schema, s);
447
437
  });
448
438
  if (stepsToBeApplied && stepsToBeApplied.length > 0) {
449
- (_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
439
+ (_this$analyticsHelper12 = _this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
450
440
  stepsCount: stepsToBeApplied.length
451
441
  });
452
442
  _this.applyLocalSteps(stepsToBeApplied);
453
443
  } else {
454
- (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
444
+ (_this$analyticsHelper13 = _this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.INFO, {
455
445
  reason: 'fetchGeneratedDiffSteps returned no steps'
456
446
  });
457
447
  }
@@ -461,9 +451,9 @@ export var DocumentService = /*#__PURE__*/function () {
461
451
  case 31:
462
452
  _context3.prev = 31;
463
453
  _context3.t1 = _context3["catch"](22);
464
- (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
454
+ (_this$analyticsHelper14 = _this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(_context3.t1, "Error fetchGeneratedDiffSteps with steps-only mode");
465
455
  case 34:
466
- (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
456
+ (_this$analyticsHelper15 = _this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.SUCCESS, {
467
457
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
468
458
  hasTitle: !!(metadata !== null && metadata !== void 0 && metadata.title),
469
459
  useReconcile: useReconcile,
@@ -476,14 +466,14 @@ export var DocumentService = /*#__PURE__*/function () {
476
466
  case 37:
477
467
  _context3.prev = 37;
478
468
  _context3.t2 = _context3["catch"](10);
479
- (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
469
+ (_this$analyticsHelper16 = _this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendActionEvent(EVENT_ACTION.REINITIALISE_DOCUMENT, EVENT_STATUS.FAILURE, {
480
470
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length,
481
471
  useReconcile: useReconcile,
482
472
  clientId: _this.clientId,
483
473
  targetClientId: targetClientId,
484
474
  triggeredByCatchup: !!targetClientId
485
475
  });
486
- (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
476
+ (_this$analyticsHelper17 = _this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(_context3.t2, "Error while reinitialising document. Use Reconcile: ".concat(useReconcile));
487
477
  _this.onErrorHandled({
488
478
  message: 'Caught error while trying to recover the document',
489
479
  data: {
@@ -504,7 +494,7 @@ export var DocumentService = /*#__PURE__*/function () {
504
494
  }());
505
495
  _defineProperty(this, "getFinalAcknowledgedState", /*#__PURE__*/function () {
506
496
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(reason) {
507
- var _this$analyticsHelper19, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper20, _this$analyticsHelper21, _measure2;
497
+ var _this$analyticsHelper18, finalAcknowledgedState, currentState, reconcileResponse, measure, _this$analyticsHelper19, _this$analyticsHelper20, _measure2;
508
498
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
509
499
  while (1) switch (_context4.prev = _context4.next) {
510
500
  case 0:
@@ -539,7 +529,7 @@ export var DocumentService = /*#__PURE__*/function () {
539
529
  };
540
530
  case 20:
541
531
  measure = stopMeasure(MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
542
- (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.SUCCESS, {
532
+ (_this$analyticsHelper18 = _this.analyticsHelper) === null || _this$analyticsHelper18 === void 0 || _this$analyticsHelper18.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.SUCCESS, {
543
533
  latency: measure === null || measure === void 0 ? void 0 : measure.duration
544
534
  });
545
535
  _this.aggressiveCatchup = false;
@@ -549,10 +539,10 @@ export var DocumentService = /*#__PURE__*/function () {
549
539
  _context4.t1 = _context4["catch"](1);
550
540
  _this.aggressiveCatchup = false;
551
541
  _measure2 = stopMeasure(MEASURE_NAME.PUBLISH_PAGE, _this.analyticsHelper);
552
- (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.FAILURE, {
542
+ (_this$analyticsHelper19 = _this.analyticsHelper) === null || _this$analyticsHelper19 === void 0 || _this$analyticsHelper19.sendActionEvent(EVENT_ACTION.PUBLISH_PAGE, EVENT_STATUS.FAILURE, {
553
543
  latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration
554
544
  });
555
- (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
545
+ (_this$analyticsHelper20 = _this.analyticsHelper) === null || _this$analyticsHelper20 === void 0 || _this$analyticsHelper20.sendErrorEvent(_context4.t1, 'Error while returning ADF version of the final draft document');
556
546
  throw _context4.t1;
557
547
  case 33:
558
548
  case "end":
@@ -587,7 +577,7 @@ export var DocumentService = /*#__PURE__*/function () {
587
577
  // ESS-5023: only emit error event if updated client version is still behind server version
588
578
  // client version could become higher than server version due to user editing or plugin adding steps
589
579
  if (updatedVersion < version) {
590
- var _doc$content, _this$analyticsHelper22;
580
+ var _doc$content, _this$analyticsHelper21;
591
581
  var error = new UpdateDocumentError('Failed to update the document', {
592
582
  newVersion: version,
593
583
  editorVersion: updatedVersion,
@@ -596,7 +586,7 @@ export var DocumentService = /*#__PURE__*/function () {
596
586
  isDocContentValid: isDocContentValid,
597
587
  caller: caller
598
588
  });
599
- (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendErrorEvent(error, 'Failed to update the document in document service');
589
+ (_this$analyticsHelper21 = _this.analyticsHelper) === null || _this$analyticsHelper21 === void 0 || _this$analyticsHelper21.sendErrorEvent(error, 'Failed to update the document in document service');
600
590
  if (_this.enableErrorOnFailedDocumentApply) {
601
591
  _this.onErrorHandled({
602
592
  message: 'The provider failed to apply changes to the editor',
@@ -613,8 +603,8 @@ export var DocumentService = /*#__PURE__*/function () {
613
603
  }
614
604
  // Otherwise just fail silently for now
615
605
  } else {
616
- var _this$analyticsHelper23, _doc$content2;
617
- (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendActionEvent(EVENT_ACTION.UPDATE_DOCUMENT, EVENT_STATUS.SUCCESS, {
606
+ var _this$analyticsHelper22, _doc$content2;
607
+ (_this$analyticsHelper22 = _this.analyticsHelper) === null || _this$analyticsHelper22 === void 0 || _this$analyticsHelper22.sendActionEvent(EVENT_ACTION.UPDATE_DOCUMENT, EVENT_STATUS.SUCCESS, {
618
608
  newVersion: version,
619
609
  editorVersion: updatedVersion,
620
610
  isDocTruthy: !!doc,
@@ -629,8 +619,8 @@ export var DocumentService = /*#__PURE__*/function () {
629
619
  try {
630
620
  var _this$getState6;
631
621
  if (!((_this$getState6 = _this.getState) !== null && _this$getState6 !== void 0 && _this$getState6.call(_this))) {
632
- var _this$analyticsHelper24;
633
- (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
622
+ var _this$analyticsHelper23;
623
+ (_this$analyticsHelper23 = _this.analyticsHelper) === null || _this$analyticsHelper23 === void 0 || _this$analyticsHelper23.sendErrorEvent(new Error('Editor state is undefined'), 'validatePMJSONDocument called without state');
634
624
  }
635
625
  // Ignored via go/ees005
636
626
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -660,7 +650,7 @@ export var DocumentService = /*#__PURE__*/function () {
660
650
  */
661
651
  _defineProperty(this, "commitUnconfirmedSteps", /*#__PURE__*/function () {
662
652
  var _ref0 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(reason) {
663
- 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;
653
+ 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;
664
654
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
665
655
  while (1) switch (_context5.prev = _context5.next) {
666
656
  case 0:
@@ -679,7 +669,7 @@ export var DocumentService = /*#__PURE__*/function () {
679
669
  lastTr = unconfirmedTrs === null || unconfirmedTrs === void 0 ? void 0 : unconfirmedTrs[unconfirmedTrs.length - 1];
680
670
  isLastTrConfirmed = false;
681
671
  if (!((_this$getState7 = _this.getState) !== null && _this$getState7 !== void 0 && _this$getState7.call(_this))) {
682
- (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
672
+ (_this$analyticsHelper24 = _this.analyticsHelper) === null || _this$analyticsHelper24 === void 0 || _this$analyticsHelper24.sendErrorEvent(new Error('Editor state is undefined'), 'commitUnconfirmedSteps called without state');
683
673
  }
684
674
  case 9:
685
675
  if (isLastTrConfirmed) {
@@ -729,7 +719,7 @@ export var DocumentService = /*#__PURE__*/function () {
729
719
  break;
730
720
  case 22:
731
721
  measure = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
732
- (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.SUCCESS, {
722
+ (_this$analyticsHelper25 = _this.analyticsHelper) === null || _this$analyticsHelper25 === void 0 || _this$analyticsHelper25.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.SUCCESS, {
733
723
  latency: measure === null || measure === void 0 ? void 0 : measure.duration,
734
724
  // upon success, emit the total number of unconfirmed steps we synced
735
725
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
@@ -741,11 +731,11 @@ export var DocumentService = /*#__PURE__*/function () {
741
731
  _context5.prev = 26;
742
732
  _context5.t0 = _context5["catch"](1);
743
733
  _measure3 = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS, _this.analyticsHelper);
744
- (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.FAILURE, {
734
+ (_this$analyticsHelper26 = _this.analyticsHelper) === null || _this$analyticsHelper26 === void 0 || _this$analyticsHelper26.sendActionEvent(EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS, EVENT_STATUS.FAILURE, {
745
735
  latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
746
736
  numUnconfirmedSteps: unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length
747
737
  });
748
- (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
738
+ (_this$analyticsHelper27 = _this.analyticsHelper) === null || _this$analyticsHelper27 === void 0 || _this$analyticsHelper27.sendErrorEvent(_context5.t0, 'Error while committing unconfirmed steps');
749
739
  throw _context5.t0;
750
740
  case 32:
751
741
  case "end":
@@ -758,17 +748,17 @@ export var DocumentService = /*#__PURE__*/function () {
758
748
  };
759
749
  }());
760
750
  _defineProperty(this, "onStepRejectedError", function () {
761
- var _this$analyticsHelper29;
751
+ var _this$analyticsHelper28;
762
752
  _this.stepRejectCounter++;
763
753
  logger("Steps rejected (tries=".concat(_this.stepRejectCounter, ")"));
764
- (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.SEND_STEPS_RETRY, EVENT_STATUS.INFO, {
754
+ (_this$analyticsHelper28 = _this.analyticsHelper) === null || _this$analyticsHelper28 === void 0 || _this$analyticsHelper28.sendActionEvent(EVENT_ACTION.SEND_STEPS_RETRY, EVENT_STATUS.INFO, {
765
755
  count: _this.stepRejectCounter
766
756
  });
767
757
  var maxRetries = _this.aggressiveCatchup ? MAX_STEP_REJECTED_ERROR_AGGRESSIVE : MAX_STEP_REJECTED_ERROR;
768
758
  if (_this.stepRejectCounter >= maxRetries) {
769
- var _this$analyticsHelper30;
759
+ var _this$analyticsHelper29;
770
760
  logger("The steps were rejected too many times (tries=".concat(_this.stepRejectCounter, ", limit=").concat(MAX_STEP_REJECTED_ERROR, "). Trying to catch-up."));
771
- (_this$analyticsHelper30 = _this.analyticsHelper) === null || _this$analyticsHelper30 === void 0 || _this$analyticsHelper30.sendActionEvent(EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, EVENT_STATUS.INFO);
761
+ (_this$analyticsHelper29 = _this.analyticsHelper) === null || _this$analyticsHelper29 === void 0 || _this$analyticsHelper29.sendActionEvent(EVENT_ACTION.CATCHUP_AFTER_MAX_SEND_STEPS_RETRY, EVENT_STATUS.INFO);
772
762
  _this.throttledCatchupv2(CatchupEventReason.STEPS_REJECTED);
773
763
  } else {
774
764
  // If committing steps failed try again automatically in 1s
@@ -824,15 +814,15 @@ export var DocumentService = /*#__PURE__*/function () {
824
814
  value: function getVersionFromCollabState(state, resource) {
825
815
  var collabState = getCollabState(state);
826
816
  if (!collabState) {
827
- var _this$analyticsHelper31;
828
- (_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"));
817
+ var _this$analyticsHelper30;
818
+ (_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"));
829
819
  return 0;
830
820
  }
831
821
 
832
822
  // This should not happen in usual, just add error event in case it happens
833
823
  if (collabState.version === undefined) {
834
- var _this$analyticsHelper32;
835
- (_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"));
824
+ var _this$analyticsHelper31;
825
+ (_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"));
836
826
  return 0;
837
827
  }
838
828
  return collabState.version;
@@ -908,7 +898,7 @@ export var DocumentService = /*#__PURE__*/function () {
908
898
  logger("Processing data. Version \"".concat(version, "\"."));
909
899
  if (steps !== null && steps !== void 0 && steps.length) {
910
900
  try {
911
- var _this$analyticsHelper33;
901
+ var _this$analyticsHelper32;
912
902
  var clientIds = steps.map(function (_ref1) {
913
903
  var clientId = _ref1.clientId;
914
904
  return clientId;
@@ -930,13 +920,13 @@ export var DocumentService = /*#__PURE__*/function () {
930
920
  return _this2.sendStepsFromCurrentState();
931
921
  }, 100);
932
922
  }
933
- (_this$analyticsHelper33 = this.analyticsHelper) === null || _this$analyticsHelper33 === void 0 || _this$analyticsHelper33.sendActionEvent(EVENT_ACTION.PROCESS_STEPS, EVENT_STATUS.SUCCESS);
923
+ (_this$analyticsHelper32 = this.analyticsHelper) === null || _this$analyticsHelper32 === void 0 || _this$analyticsHelper32.sendActionEvent(EVENT_ACTION.PROCESS_STEPS, EVENT_STATUS.SUCCESS);
934
924
  } catch (error) {
935
- var _this$analyticsHelper34;
925
+ var _this$analyticsHelper33;
936
926
  // ESS-6421: log if error processing steps when there are steps from the same userId but not the same clientId
937
927
  var userIdMatch = this.isStepsFromNewClientIdForSameUserId(steps);
938
928
  logger("Processing steps failed with error: ".concat(error, ". Triggering catch up call."));
939
- (_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");
929
+ (_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");
940
930
  this.throttledCatchupv2(CatchupEventReason.PROCESS_STEPS);
941
931
  }
942
932
  }
@@ -988,8 +978,8 @@ export var DocumentService = /*#__PURE__*/function () {
988
978
  var _this$getState0;
989
979
  var state = (_this$getState0 = this.getState) === null || _this$getState0 === void 0 ? void 0 : _this$getState0.call(this);
990
980
  if (!state) {
991
- var _this$analyticsHelper35;
992
- (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
981
+ var _this$analyticsHelper34;
982
+ (_this$analyticsHelper34 = this.analyticsHelper) === null || _this$analyticsHelper34 === void 0 || _this$analyticsHelper34.sendErrorEvent(new Error('Editor state is undefined'), 'sendStepsFromCurrentState called without state');
993
983
  return;
994
984
  }
995
985
  this.send(null, null, state, sendAnalyticsEvent, reason);
@@ -1040,8 +1030,8 @@ export var DocumentService = /*#__PURE__*/function () {
1040
1030
  // to ensure that analytics events with the number of unconfirmed steps is only
1041
1031
  // sent once on connection (as opposed to on every step)
1042
1032
  if (sendAnalyticsEvent) {
1043
- var _this$analyticsHelper36;
1044
- (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(EVENT_ACTION.HAS_UNCONFIRMED_STEPS, EVENT_STATUS.INFO, {
1033
+ var _this$analyticsHelper35;
1034
+ (_this$analyticsHelper35 = this.analyticsHelper) === null || _this$analyticsHelper35 === void 0 || _this$analyticsHelper35.sendActionEvent(EVENT_ACTION.HAS_UNCONFIRMED_STEPS, EVENT_STATUS.INFO, {
1045
1035
  numUnconfirmedSteps: (unconfirmedSteps === null || unconfirmedSteps === void 0 ? void 0 : unconfirmedSteps.length) || 0
1046
1036
  });
1047
1037
  }
@@ -1050,12 +1040,12 @@ export var DocumentService = /*#__PURE__*/function () {
1050
1040
  }
1051
1041
  var rebased = tr === null || tr === void 0 ? void 0 : tr.getMeta('rebasedData');
1052
1042
  if (rebased) {
1053
- var _this$analyticsHelper37;
1043
+ var _this$analyticsHelper36;
1054
1044
  var obfuscatedUnconfirmedSteps = this.obfuscateStepsAndState(rebased.unconfirmedSteps).obfuscatedSteps;
1055
1045
  var obfuscatedRemoteSteps = this.obfuscateStepsAndState(rebased.remoteSteps);
1056
1046
  var obfuscatedRebasedSteps = this.obfuscateStepsAndState(unconfirmedSteps).obfuscatedSteps;
1057
1047
  // send analtyics on unconfirmed steps
1058
- (_this$analyticsHelper37 = this.analyticsHelper) === null || _this$analyticsHelper37 === void 0 || _this$analyticsHelper37.sendActionEvent(EVENT_ACTION.STEPS_REBASED, EVENT_STATUS.INFO, {
1048
+ (_this$analyticsHelper36 = this.analyticsHelper) === null || _this$analyticsHelper36 === void 0 || _this$analyticsHelper36.sendActionEvent(EVENT_ACTION.STEPS_REBASED, EVENT_STATUS.INFO, {
1059
1049
  obfuscatedUnconfirmedSteps: obfuscatedUnconfirmedSteps,
1060
1050
  obfuscatedRemoteSteps: obfuscatedRemoteSteps,
1061
1051
  obfuscatedRebasedSteps: obfuscatedRebasedSteps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "14.0.8",
3
+ "version": "14.1.0",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,14 +29,14 @@
29
29
  "@atlaskit/adf-utils": "^19.26.0",
30
30
  "@atlaskit/analytics-gas-types": "^5.1.0",
31
31
  "@atlaskit/analytics-listeners": "^9.1.0",
32
- "@atlaskit/anonymous-assets": "^0.0.13",
32
+ "@atlaskit/anonymous-assets": "^0.0.14",
33
33
  "@atlaskit/editor-json-transformer": "^8.31.0",
34
34
  "@atlaskit/editor-prosemirror": "7.0.0",
35
35
  "@atlaskit/feature-gate-js-client": "^5.5.0",
36
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
37
37
  "@atlaskit/prosemirror-collab": "^0.22.0",
38
38
  "@atlaskit/react-ufo": "^4.15.0",
39
- "@atlaskit/tmp-editor-statsig": "^13.39.0",
39
+ "@atlaskit/tmp-editor-statsig": "^14.0.0",
40
40
  "@atlaskit/ufo": "^0.4.0",
41
41
  "@atlaskit/util-service-support": "^6.3.0",
42
42
  "@babel/runtime": "^7.0.0",
@@ -71,12 +71,9 @@
71
71
  },
72
72
  "add_session_id_to_catchup_query": {
73
73
  "type": "boolean"
74
- },
75
- "platform_collab_do_not_client_error_log": {
76
- "type": "boolean"
77
74
  }
78
75
  },
79
76
  "peerDependencies": {
80
- "@atlaskit/editor-common": "^110.32.0"
77
+ "@atlaskit/editor-common": "^110.36.0"
81
78
  }
82
79
  }