@atlaskit/collab-provider 9.46.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 10.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#165049](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165049)
8
+ [`febce5463e07f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/febce5463e07f) -
9
+ Enable no-re-export rule for a subset of editor packages
10
+
11
+ ### Major
12
+
13
+ #### @atlaskit/collab-provider
14
+
15
+ @atlaskit/collab-provider doesn't export following types anymore:
16
+
17
+ ```
18
+ CollabParticipant,
19
+ CollabEventInitData,
20
+ CollabEventRemoteData,
21
+ CollabEventConnectionData,
22
+ CollabEventConnectingData,
23
+ CollabEventPresenceData,
24
+ ResolvedEditorState,
25
+ CollabConnectedPayload,
26
+ CollabConnectingPayload,
27
+ CollabDisconnectedPayload,
28
+ CollabInitPayload,
29
+ CollabDataPayload,
30
+ CollabTelepointerPayload,
31
+ CollabPresencePayload,
32
+ CollabMetadataPayload,
33
+ CollabLocalStepsPayload,
34
+ CollabCommitStatusEventPayload,
35
+ CollabPermissionEventPayload,
36
+ UserPermitType,
37
+ CollabEvents,
38
+ Metadata,
39
+ StepJson,
40
+ CollabEventTelepointerData,
41
+ CollabSendableSelection,
42
+ CollabEditProvider,
43
+ NewCollabSyncUpErrorAttributes,
44
+ SyncUpErrorFunction,
45
+ CollabEventLocalStepData,
46
+ ```
47
+
48
+ Import them from `@atlaskit/editor-common/collab`.
49
+
50
+ #### @atlaskit/editor-common
51
+
52
+ `@atlaskit/editor-common/provider-factory` doesn't export following types anymore:
53
+
54
+ ```
55
+ CardAdf,
56
+ DatasourceAdf,
57
+ ```
58
+
59
+ Import them from `@atlaskit/smart-card`.
60
+
61
+ ### Patch Changes
62
+
63
+ - [#166394](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166394)
64
+ [`ec83c51a9acba`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ec83c51a9acba) -
65
+ Add analytics on reconnection events
66
+ - Updated dependencies
67
+
3
68
  ## 9.46.0
4
69
 
5
70
  ### Minor Changes
@@ -22,6 +22,7 @@ var EVENT_ACTION = exports.EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
22
22
  EVENT_ACTION["DROPPED_STEPS"] = "droppedStepInCatchup";
23
23
  EVENT_ACTION["WEBSOCKET_MESSAGE_VOLUME_METRIC"] = "websocketMessageVolumeMetric";
24
24
  EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
25
+ EVENT_ACTION["RECONNECTION"] = "providerReconnection";
25
26
  EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
26
27
  EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
27
28
  return EVENT_ACTION;
@@ -136,6 +136,10 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
136
136
  if (initialized && _this.disconnectedAt &&
137
137
  // Offline longer than `OUT_OF_SYNC_PERIOD`
138
138
  Date.now() - _this.disconnectedAt >= OUT_OF_SYNC_PERIOD) {
139
+ var _this$analyticsHelper2;
140
+ (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(_const.EVENT_ACTION.RECONNECTION, _const.EVENT_STATUS.INFO, {
141
+ disconnectionPeriodSeconds: Math.floor((Date.now() - _this.disconnectedAt) / 1000)
142
+ });
139
143
  _this.documentService.throttledCatchupv2(_const.CatchupEventReason.RECONNECTED);
140
144
  }
141
145
  _this.participantsService.startInactiveRemover(_this.sessionId);
@@ -179,13 +183,13 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
179
183
  if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === _ncsErrors.NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === _ncsErrors.NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
180
184
  _this.documentService.onStepRejectedError();
181
185
  } else {
182
- var _this$analyticsHelper2;
183
- (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, 'Error handled');
186
+ var _this$analyticsHelper3;
187
+ (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(error, 'Error handled');
184
188
  var mappedError = (0, _errorCodeMapper.errorCodeMapper)(error);
185
189
  // Only emit errors to Confluence very intentionally because they will disconnect the collab provider
186
190
  if (mappedError) {
187
- var _this$analyticsHelper3;
188
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendProviderErrorEvent(mappedError);
191
+ var _this$analyticsHelper4;
192
+ (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendProviderErrorEvent(mappedError);
189
193
  _this.emit('error', mappedError);
190
194
  }
191
195
  }
@@ -208,7 +212,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
208
212
  * @throws {GetCurrentStateError} Something went wrong while returning the current state
209
213
  */
210
214
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getCurrentState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
211
- var _this$analyticsHelper4;
215
+ var _this$analyticsHelper5;
212
216
  return _regenerator.default.wrap(function _callee$(_context) {
213
217
  while (1) switch (_context.prev = _context.next) {
214
218
  case 0:
@@ -220,7 +224,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
220
224
  case 6:
221
225
  _context.prev = 6;
222
226
  _context.t0 = _context["catch"](0);
223
- (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendErrorEvent(_context.t0, 'Error while returning ADF version of current draft document');
227
+ (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(_context.t0, 'Error while returning ADF version of current draft document');
224
228
  throw new _customErrors.GetCurrentStateError('Error while returning the current state of the draft document', _context.t0);
225
229
  case 10:
226
230
  case "end":
@@ -234,7 +238,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
234
238
  * @throws {GetFinalAcknowledgedStateError} Something went wrong while returning the acknowledged state
235
239
  */
236
240
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getFinalAcknowledgedState", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
237
- var _this$analyticsHelper5;
241
+ var _this$analyticsHelper6;
238
242
  return _regenerator.default.wrap(function _callee2$(_context2) {
239
243
  while (1) switch (_context2.prev = _context2.next) {
240
244
  case 0:
@@ -246,7 +250,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
246
250
  case 6:
247
251
  _context2.prev = 6;
248
252
  _context2.t0 = _context2["catch"](0);
249
- (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(_context2.t0, 'Error while returning ADF version of the final draft document');
253
+ (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendErrorEvent(_context2.t0, 'Error while returning ADF version of the final draft document');
250
254
  throw new _customErrors.GetFinalAcknowledgedStateError('Error while returning the final acknowledged state of the draft document', _context2.t0);
251
255
  case 10:
252
256
  case "end":
@@ -363,7 +367,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
363
367
  clientId: this.clientId
364
368
  });
365
369
  if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
366
- var _this$analyticsHelper6;
370
+ var _this$analyticsHelper7;
367
371
  var _this$initialDraft2 = this.initialDraft,
368
372
  document = _this$initialDraft2.document,
369
373
  version = _this$initialDraft2.version,
@@ -373,7 +377,7 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
373
377
  version: version,
374
378
  metadata: metadata
375
379
  });
376
- (_this$analyticsHelper6 = this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendActionEvent(_const.EVENT_ACTION.PROVIDER_INITIALIZED, _const.EVENT_STATUS.INFO, {
380
+ (_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(_const.EVENT_ACTION.PROVIDER_INITIALIZED, _const.EVENT_STATUS.INFO, {
377
381
  isBuffered: true
378
382
  });
379
383
  }
@@ -382,8 +386,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
382
386
  this.isChannelInitialized = true;
383
387
  }
384
388
  } catch (initError) {
385
- var _this$analyticsHelper7;
386
- (_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendErrorEvent(initError, 'Error while initialising the provider');
389
+ var _this$analyticsHelper8;
390
+ (_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
387
391
  // Throw error so consumers are aware the initialisation failed when initialising themselves
388
392
  throw new _customErrors.ProviderInitialisationError('Provider initialisation error', initError);
389
393
  }
@@ -402,8 +406,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
402
406
  this.isChannelInitialized = true;
403
407
  }
404
408
  } catch (initError) {
405
- var _this$analyticsHelper8;
406
- (_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
409
+ var _this$analyticsHelper9;
410
+ (_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider');
407
411
  // Throw error so consumers are aware the initialisation failed when initialising themselves
408
412
  throw new _customErrors.ProviderInitialisationError('Provider initialisation error', initError);
409
413
  }
@@ -413,9 +417,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
413
417
  key: "checkForCookies",
414
418
  value: function checkForCookies() {
415
419
  if (!global.navigator.cookieEnabled) {
416
- var _this$analyticsHelper9;
420
+ var _this$analyticsHelper10;
417
421
  var initError = new _customErrors.ProviderInitialisationError('Cookies are not enabled. Please enable cookies to use collaborative editing.');
418
- (_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
422
+ (_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
419
423
  throw new _customErrors.ProviderInitialisationError('Provider initialisation error - cookies disabled', initError);
420
424
  }
421
425
  }
@@ -432,14 +436,14 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
432
436
  value: function send(_tr, _oldState, newState) {
433
437
  try {
434
438
  if (this.isViewOnly()) {
435
- var _this$analyticsHelper10;
439
+ var _this$analyticsHelper11;
436
440
  var error = {
437
441
  message: 'Attempted to send steps in view only mode',
438
442
  data: {
439
443
  code: _internalErrors.INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
440
444
  }
441
445
  };
442
- (_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(error, error.message);
446
+ (_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(error, error.message);
443
447
  return;
444
448
  }
445
449
  // Don't send steps while the document is locked (eg. when restoring the document)
@@ -449,8 +453,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
449
453
  }
450
454
  this.documentService.send(_tr, _oldState, newState);
451
455
  } catch (error) {
452
- var _this$analyticsHelper11;
453
- (_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(error, 'Error while sending steps for a transaction');
456
+ var _this$analyticsHelper12;
457
+ (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending steps for a transaction');
454
458
  throw new _customErrors.SendTransactionError('Error while sending steps for a transaction', error);
455
459
  }
456
460
  }
@@ -495,9 +499,9 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
495
499
  this.participantsService.sendAIProviderChanged(_objectSpread(_objectSpread({}, basePayload), data));
496
500
  }
497
501
  } catch (error) {
498
- var _this$analyticsHelper12;
502
+ var _this$analyticsHelper13;
499
503
  // We don't want to throw errors for Presence features as they tend to self-restore
500
- (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending message - telepointer');
504
+ (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
501
505
  }
502
506
  }
503
507
  }, {
@@ -540,8 +544,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
540
544
  this.sendStepsTimer = undefined;
541
545
  }
542
546
  } catch (error) {
543
- var _this$analyticsHelper13;
544
- (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while shutting down the collab provider');
547
+ var _this$analyticsHelper14;
548
+ (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(error, 'Error while shutting down the collab provider');
545
549
  throw new _customErrors.DestroyError('Error while shutting down the collab provider', error);
546
550
  }
547
551
  this.clearTimers();
@@ -564,8 +568,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
564
568
  }
565
569
  this.metadataService.setTitle(title, broadcast);
566
570
  } catch (error) {
567
- var _this$analyticsHelper14;
568
- (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(error, 'Error while setting title');
571
+ var _this$analyticsHelper15;
572
+ (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting title');
569
573
  throw new _customErrors.SetTitleError('Error while setting title', error);
570
574
  }
571
575
  }
@@ -583,8 +587,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
583
587
  try {
584
588
  this.metadataService.setEditorWidth(editorWidth, broadcast);
585
589
  } catch (error) {
586
- var _this$analyticsHelper15;
587
- (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting editor width');
590
+ var _this$analyticsHelper16;
591
+ (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting editor width');
588
592
  throw new _customErrors.SetEditorWidthError('Error while setting editor width', error);
589
593
  }
590
594
  }
@@ -603,8 +607,8 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
603
607
  }
604
608
  this.metadataService.setMetadata(metadata);
605
609
  } catch (error) {
606
- var _this$analyticsHelper16;
607
- (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting metadata');
610
+ var _this$analyticsHelper17;
611
+ (_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(error, 'Error while setting metadata');
608
612
  throw new _customErrors.SetMetadataError('Error while setting metadata', error);
609
613
  }
610
614
  }
package/dist/cjs/types.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AcknowledgementResponseTypes = void 0;
7
- // Re-export values for the /types entry point to this package
8
7
  // types from editor common end
9
8
  // Initial draft
10
9
  // Channel
@@ -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 = "9.46.0";
8
+ var version = exports.version = "10.0.0";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -16,6 +16,7 @@ export let EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
16
16
  EVENT_ACTION["DROPPED_STEPS"] = "droppedStepInCatchup";
17
17
  EVENT_ACTION["WEBSOCKET_MESSAGE_VOLUME_METRIC"] = "websocketMessageVolumeMetric";
18
18
  EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
19
+ EVENT_ACTION["RECONNECTION"] = "providerReconnection";
19
20
  EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
20
21
  EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
21
22
  return EVENT_ACTION;
@@ -1,2 +1,5 @@
1
+ // Disable no-re-export rule for entry point files
2
+ /* eslint-disable @atlaskit/editor/no-re-export */
3
+
1
4
  export { Provider } from './provider';
2
5
  export { PROVIDER_ERROR_CODE } from '@atlaskit/editor-common/collab';
@@ -113,6 +113,10 @@ export class Provider extends Emitter {
113
113
  if (initialized && this.disconnectedAt &&
114
114
  // Offline longer than `OUT_OF_SYNC_PERIOD`
115
115
  Date.now() - this.disconnectedAt >= OUT_OF_SYNC_PERIOD) {
116
+ var _this$analyticsHelper2;
117
+ (_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.RECONNECTION, EVENT_STATUS.INFO, {
118
+ disconnectionPeriodSeconds: Math.floor((Date.now() - this.disconnectedAt) / 1000)
119
+ });
116
120
  this.documentService.throttledCatchupv2(CatchupEventReason.RECONNECTED);
117
121
  }
118
122
  this.participantsService.startInactiveRemover(this.sessionId);
@@ -155,13 +159,13 @@ export class Provider extends Emitter {
155
159
  if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
156
160
  this.documentService.onStepRejectedError();
157
161
  } else {
158
- var _this$analyticsHelper2;
159
- (_this$analyticsHelper2 = this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 ? void 0 : _this$analyticsHelper2.sendErrorEvent(error, 'Error handled');
162
+ var _this$analyticsHelper3;
163
+ (_this$analyticsHelper3 = this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendErrorEvent(error, 'Error handled');
160
164
  const mappedError = errorCodeMapper(error);
161
165
  // Only emit errors to Confluence very intentionally because they will disconnect the collab provider
162
166
  if (mappedError) {
163
- var _this$analyticsHelper3;
164
- (_this$analyticsHelper3 = this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 ? void 0 : _this$analyticsHelper3.sendProviderErrorEvent(mappedError);
167
+ var _this$analyticsHelper4;
168
+ (_this$analyticsHelper4 = this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 ? void 0 : _this$analyticsHelper4.sendProviderErrorEvent(mappedError);
165
169
  this.emit('error', mappedError);
166
170
  }
167
171
  }
@@ -188,8 +192,8 @@ export class Provider extends Emitter {
188
192
  try {
189
193
  return await this.documentService.getCurrentState();
190
194
  } catch (error) {
191
- var _this$analyticsHelper4;
192
- (_this$analyticsHelper4 = this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 ? void 0 : _this$analyticsHelper4.sendErrorEvent(error, 'Error while returning ADF version of current draft document');
195
+ var _this$analyticsHelper5;
196
+ (_this$analyticsHelper5 = this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 ? void 0 : _this$analyticsHelper5.sendErrorEvent(error, 'Error while returning ADF version of current draft document');
193
197
  throw new GetCurrentStateError('Error while returning the current state of the draft document', error); // Reject the promise so the consumer can react to it failing
194
198
  }
195
199
  });
@@ -202,8 +206,8 @@ export class Provider extends Emitter {
202
206
  try {
203
207
  return await this.documentService.getFinalAcknowledgedState();
204
208
  } catch (error) {
205
- var _this$analyticsHelper5;
206
- (_this$analyticsHelper5 = this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 ? void 0 : _this$analyticsHelper5.sendErrorEvent(error, 'Error while returning ADF version of the final draft document');
209
+ var _this$analyticsHelper6;
210
+ (_this$analyticsHelper6 = this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 ? void 0 : _this$analyticsHelper6.sendErrorEvent(error, 'Error while returning ADF version of the final draft document');
207
211
  throw new GetFinalAcknowledgedStateError('Error while returning the final acknowledged state of the draft document', error); // Reject the promise so the consumer can react to it failing
208
212
  }
209
213
  });
@@ -307,7 +311,7 @@ export class Provider extends Emitter {
307
311
  clientId: this.clientId
308
312
  });
309
313
  if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
310
- var _this$analyticsHelper6;
314
+ var _this$analyticsHelper7;
311
315
  const {
312
316
  document,
313
317
  version,
@@ -318,7 +322,7 @@ export class Provider extends Emitter {
318
322
  version,
319
323
  metadata
320
324
  });
321
- (_this$analyticsHelper6 = this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 ? void 0 : _this$analyticsHelper6.sendActionEvent(EVENT_ACTION.PROVIDER_INITIALIZED, EVENT_STATUS.INFO, {
325
+ (_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 ? void 0 : _this$analyticsHelper7.sendActionEvent(EVENT_ACTION.PROVIDER_INITIALIZED, EVENT_STATUS.INFO, {
322
326
  isBuffered: true
323
327
  });
324
328
  }
@@ -327,8 +331,8 @@ export class Provider extends Emitter {
327
331
  this.isChannelInitialized = true;
328
332
  }
329
333
  } catch (initError) {
330
- var _this$analyticsHelper7;
331
- (_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 ? void 0 : _this$analyticsHelper7.sendErrorEvent(initError, 'Error while initialising the provider');
334
+ var _this$analyticsHelper8;
335
+ (_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 ? void 0 : _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
332
336
  // Throw error so consumers are aware the initialisation failed when initialising themselves
333
337
  throw new ProviderInitialisationError('Provider initialisation error', initError);
334
338
  }
@@ -345,8 +349,8 @@ export class Provider extends Emitter {
345
349
  this.isChannelInitialized = true;
346
350
  }
347
351
  } catch (initError) {
348
- var _this$analyticsHelper8;
349
- (_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 ? void 0 : _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
352
+ var _this$analyticsHelper9;
353
+ (_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 ? void 0 : _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider');
350
354
  // Throw error so consumers are aware the initialisation failed when initialising themselves
351
355
  throw new ProviderInitialisationError('Provider initialisation error', initError);
352
356
  }
@@ -354,9 +358,9 @@ export class Provider extends Emitter {
354
358
  }
355
359
  checkForCookies() {
356
360
  if (!global.navigator.cookieEnabled) {
357
- var _this$analyticsHelper9;
361
+ var _this$analyticsHelper10;
358
362
  const initError = new ProviderInitialisationError('Cookies are not enabled. Please enable cookies to use collaborative editing.');
359
- (_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 ? void 0 : _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
363
+ (_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 ? void 0 : _this$analyticsHelper10.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
360
364
  throw new ProviderInitialisationError('Provider initialisation error - cookies disabled', initError);
361
365
  }
362
366
  }
@@ -371,14 +375,14 @@ export class Provider extends Emitter {
371
375
  send(_tr, _oldState, newState) {
372
376
  try {
373
377
  if (this.isViewOnly()) {
374
- var _this$analyticsHelper10;
378
+ var _this$analyticsHelper11;
375
379
  const error = {
376
380
  message: 'Attempted to send steps in view only mode',
377
381
  data: {
378
382
  code: INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
379
383
  }
380
384
  };
381
- (_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 ? void 0 : _this$analyticsHelper10.sendErrorEvent(error, error.message);
385
+ (_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 ? void 0 : _this$analyticsHelper11.sendErrorEvent(error, error.message);
382
386
  return;
383
387
  }
384
388
  // Don't send steps while the document is locked (eg. when restoring the document)
@@ -388,8 +392,8 @@ export class Provider extends Emitter {
388
392
  }
389
393
  this.documentService.send(_tr, _oldState, newState);
390
394
  } catch (error) {
391
- var _this$analyticsHelper11;
392
- (_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 ? void 0 : _this$analyticsHelper11.sendErrorEvent(error, 'Error while sending steps for a transaction');
395
+ var _this$analyticsHelper12;
396
+ (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 ? void 0 : _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending steps for a transaction');
393
397
  throw new SendTransactionError('Error while sending steps for a transaction', error);
394
398
  }
395
399
  }
@@ -435,9 +439,9 @@ export class Provider extends Emitter {
435
439
  });
436
440
  }
437
441
  } catch (error) {
438
- var _this$analyticsHelper12;
442
+ var _this$analyticsHelper13;
439
443
  // We don't want to throw errors for Presence features as they tend to self-restore
440
- (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 ? void 0 : _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending message - telepointer');
444
+ (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
441
445
  }
442
446
  }
443
447
  /**
@@ -473,8 +477,8 @@ export class Provider extends Emitter {
473
477
  this.sendStepsTimer = undefined;
474
478
  }
475
479
  } catch (error) {
476
- var _this$analyticsHelper13;
477
- (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 ? void 0 : _this$analyticsHelper13.sendErrorEvent(error, 'Error while shutting down the collab provider');
480
+ var _this$analyticsHelper14;
481
+ (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendErrorEvent(error, 'Error while shutting down the collab provider');
478
482
  throw new DestroyError('Error while shutting down the collab provider', error);
479
483
  }
480
484
  this.clearTimers();
@@ -495,8 +499,8 @@ export class Provider extends Emitter {
495
499
  }
496
500
  this.metadataService.setTitle(title, broadcast);
497
501
  } catch (error) {
498
- var _this$analyticsHelper14;
499
- (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 ? void 0 : _this$analyticsHelper14.sendErrorEvent(error, 'Error while setting title');
502
+ var _this$analyticsHelper15;
503
+ (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting title');
500
504
  throw new SetTitleError('Error while setting title', error);
501
505
  }
502
506
  }
@@ -512,8 +516,8 @@ export class Provider extends Emitter {
512
516
  try {
513
517
  this.metadataService.setEditorWidth(editorWidth, broadcast);
514
518
  } catch (error) {
515
- var _this$analyticsHelper15;
516
- (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 ? void 0 : _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting editor width');
519
+ var _this$analyticsHelper16;
520
+ (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting editor width');
517
521
  throw new SetEditorWidthError('Error while setting editor width', error);
518
522
  }
519
523
  }
@@ -530,8 +534,8 @@ export class Provider extends Emitter {
530
534
  }
531
535
  this.metadataService.setMetadata(metadata);
532
536
  } catch (error) {
533
- var _this$analyticsHelper16;
534
- (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 ? void 0 : _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting metadata');
537
+ var _this$analyticsHelper17;
538
+ (_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 ? void 0 : _this$analyticsHelper17.sendErrorEvent(error, 'Error while setting metadata');
535
539
  throw new SetMetadataError('Error while setting metadata', error);
536
540
  }
537
541
  }
@@ -1,5 +1,3 @@
1
- // Re-export values for the /types entry point to this package
2
-
3
1
  // types from editor common end
4
2
 
5
3
  // Initial draft
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "9.46.0";
2
+ export const version = "10.0.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -16,6 +16,7 @@ export var EVENT_ACTION = /*#__PURE__*/function (EVENT_ACTION) {
16
16
  EVENT_ACTION["DROPPED_STEPS"] = "droppedStepInCatchup";
17
17
  EVENT_ACTION["WEBSOCKET_MESSAGE_VOLUME_METRIC"] = "websocketMessageVolumeMetric";
18
18
  EVENT_ACTION["PROVIDER_INITIALIZED"] = "providerInitialized";
19
+ EVENT_ACTION["RECONNECTION"] = "providerReconnection";
19
20
  EVENT_ACTION["PROVIDER_SETUP"] = "providerSetup";
20
21
  EVENT_ACTION["HAS_UNCONFIRMED_STEPS"] = "hasUnconfirmedSteps";
21
22
  return EVENT_ACTION;
package/dist/esm/index.js CHANGED
@@ -1,2 +1,5 @@
1
+ // Disable no-re-export rule for entry point files
2
+ /* eslint-disable @atlaskit/editor/no-re-export */
3
+
1
4
  export { Provider } from './provider';
2
5
  export { PROVIDER_ERROR_CODE } from '@atlaskit/editor-common/collab';
@@ -129,6 +129,10 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
129
129
  if (initialized && _this.disconnectedAt &&
130
130
  // Offline longer than `OUT_OF_SYNC_PERIOD`
131
131
  Date.now() - _this.disconnectedAt >= OUT_OF_SYNC_PERIOD) {
132
+ var _this$analyticsHelper2;
133
+ (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendActionEvent(EVENT_ACTION.RECONNECTION, EVENT_STATUS.INFO, {
134
+ disconnectionPeriodSeconds: Math.floor((Date.now() - _this.disconnectedAt) / 1000)
135
+ });
132
136
  _this.documentService.throttledCatchupv2(CatchupEventReason.RECONNECTED);
133
137
  }
134
138
  _this.participantsService.startInactiveRemover(_this.sessionId);
@@ -172,13 +176,13 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
172
176
  if (((_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.code) === NCS_ERROR_CODE.HEAD_VERSION_UPDATE_FAILED || ((_error$data2 = error.data) === null || _error$data2 === void 0 ? void 0 : _error$data2.code) === NCS_ERROR_CODE.VERSION_NUMBER_ALREADY_EXISTS) {
173
177
  _this.documentService.onStepRejectedError();
174
178
  } else {
175
- var _this$analyticsHelper2;
176
- (_this$analyticsHelper2 = _this.analyticsHelper) === null || _this$analyticsHelper2 === void 0 || _this$analyticsHelper2.sendErrorEvent(error, 'Error handled');
179
+ var _this$analyticsHelper3;
180
+ (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendErrorEvent(error, 'Error handled');
177
181
  var mappedError = errorCodeMapper(error);
178
182
  // Only emit errors to Confluence very intentionally because they will disconnect the collab provider
179
183
  if (mappedError) {
180
- var _this$analyticsHelper3;
181
- (_this$analyticsHelper3 = _this.analyticsHelper) === null || _this$analyticsHelper3 === void 0 || _this$analyticsHelper3.sendProviderErrorEvent(mappedError);
184
+ var _this$analyticsHelper4;
185
+ (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendProviderErrorEvent(mappedError);
182
186
  _this.emit('error', mappedError);
183
187
  }
184
188
  }
@@ -201,7 +205,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
201
205
  * @throws {GetCurrentStateError} Something went wrong while returning the current state
202
206
  */
203
207
  _defineProperty(_assertThisInitialized(_this), "getCurrentState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
204
- var _this$analyticsHelper4;
208
+ var _this$analyticsHelper5;
205
209
  return _regeneratorRuntime.wrap(function _callee$(_context) {
206
210
  while (1) switch (_context.prev = _context.next) {
207
211
  case 0:
@@ -213,7 +217,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
213
217
  case 6:
214
218
  _context.prev = 6;
215
219
  _context.t0 = _context["catch"](0);
216
- (_this$analyticsHelper4 = _this.analyticsHelper) === null || _this$analyticsHelper4 === void 0 || _this$analyticsHelper4.sendErrorEvent(_context.t0, 'Error while returning ADF version of current draft document');
220
+ (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(_context.t0, 'Error while returning ADF version of current draft document');
217
221
  throw new GetCurrentStateError('Error while returning the current state of the draft document', _context.t0);
218
222
  case 10:
219
223
  case "end":
@@ -227,7 +231,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
227
231
  * @throws {GetFinalAcknowledgedStateError} Something went wrong while returning the acknowledged state
228
232
  */
229
233
  _defineProperty(_assertThisInitialized(_this), "getFinalAcknowledgedState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
230
- var _this$analyticsHelper5;
234
+ var _this$analyticsHelper6;
231
235
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
232
236
  while (1) switch (_context2.prev = _context2.next) {
233
237
  case 0:
@@ -239,7 +243,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
239
243
  case 6:
240
244
  _context2.prev = 6;
241
245
  _context2.t0 = _context2["catch"](0);
242
- (_this$analyticsHelper5 = _this.analyticsHelper) === null || _this$analyticsHelper5 === void 0 || _this$analyticsHelper5.sendErrorEvent(_context2.t0, 'Error while returning ADF version of the final draft document');
246
+ (_this$analyticsHelper6 = _this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendErrorEvent(_context2.t0, 'Error while returning ADF version of the final draft document');
243
247
  throw new GetFinalAcknowledgedStateError('Error while returning the final acknowledged state of the draft document', _context2.t0);
244
248
  case 10:
245
249
  case "end":
@@ -356,7 +360,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
356
360
  clientId: this.clientId
357
361
  });
358
362
  if (this.isBufferingEnabled && this.initialDraft && !this.isProviderInitialized) {
359
- var _this$analyticsHelper6;
363
+ var _this$analyticsHelper7;
360
364
  var _this$initialDraft2 = this.initialDraft,
361
365
  document = _this$initialDraft2.document,
362
366
  version = _this$initialDraft2.version,
@@ -366,7 +370,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
366
370
  version: version,
367
371
  metadata: metadata
368
372
  });
369
- (_this$analyticsHelper6 = this.analyticsHelper) === null || _this$analyticsHelper6 === void 0 || _this$analyticsHelper6.sendActionEvent(EVENT_ACTION.PROVIDER_INITIALIZED, EVENT_STATUS.INFO, {
373
+ (_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendActionEvent(EVENT_ACTION.PROVIDER_INITIALIZED, EVENT_STATUS.INFO, {
370
374
  isBuffered: true
371
375
  });
372
376
  }
@@ -375,8 +379,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
375
379
  this.isChannelInitialized = true;
376
380
  }
377
381
  } catch (initError) {
378
- var _this$analyticsHelper7;
379
- (_this$analyticsHelper7 = this.analyticsHelper) === null || _this$analyticsHelper7 === void 0 || _this$analyticsHelper7.sendErrorEvent(initError, 'Error while initialising the provider');
382
+ var _this$analyticsHelper8;
383
+ (_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
380
384
  // Throw error so consumers are aware the initialisation failed when initialising themselves
381
385
  throw new ProviderInitialisationError('Provider initialisation error', initError);
382
386
  }
@@ -395,8 +399,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
395
399
  this.isChannelInitialized = true;
396
400
  }
397
401
  } catch (initError) {
398
- var _this$analyticsHelper8;
399
- (_this$analyticsHelper8 = this.analyticsHelper) === null || _this$analyticsHelper8 === void 0 || _this$analyticsHelper8.sendErrorEvent(initError, 'Error while initialising the provider');
402
+ var _this$analyticsHelper9;
403
+ (_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider');
400
404
  // Throw error so consumers are aware the initialisation failed when initialising themselves
401
405
  throw new ProviderInitialisationError('Provider initialisation error', initError);
402
406
  }
@@ -406,9 +410,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
406
410
  key: "checkForCookies",
407
411
  value: function checkForCookies() {
408
412
  if (!global.navigator.cookieEnabled) {
409
- var _this$analyticsHelper9;
413
+ var _this$analyticsHelper10;
410
414
  var initError = new ProviderInitialisationError('Cookies are not enabled. Please enable cookies to use collaborative editing.');
411
- (_this$analyticsHelper9 = this.analyticsHelper) === null || _this$analyticsHelper9 === void 0 || _this$analyticsHelper9.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
415
+ (_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(initError, 'Error while initialising the provider - cookies disabled');
412
416
  throw new ProviderInitialisationError('Provider initialisation error - cookies disabled', initError);
413
417
  }
414
418
  }
@@ -425,14 +429,14 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
425
429
  value: function send(_tr, _oldState, newState) {
426
430
  try {
427
431
  if (this.isViewOnly()) {
428
- var _this$analyticsHelper10;
432
+ var _this$analyticsHelper11;
429
433
  var error = {
430
434
  message: 'Attempted to send steps in view only mode',
431
435
  data: {
432
436
  code: INTERNAL_ERROR_CODE.VIEW_ONLY_STEPS_ERROR
433
437
  }
434
438
  };
435
- (_this$analyticsHelper10 = this.analyticsHelper) === null || _this$analyticsHelper10 === void 0 || _this$analyticsHelper10.sendErrorEvent(error, error.message);
439
+ (_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(error, error.message);
436
440
  return;
437
441
  }
438
442
  // Don't send steps while the document is locked (eg. when restoring the document)
@@ -442,8 +446,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
442
446
  }
443
447
  this.documentService.send(_tr, _oldState, newState);
444
448
  } catch (error) {
445
- var _this$analyticsHelper11;
446
- (_this$analyticsHelper11 = this.analyticsHelper) === null || _this$analyticsHelper11 === void 0 || _this$analyticsHelper11.sendErrorEvent(error, 'Error while sending steps for a transaction');
449
+ var _this$analyticsHelper12;
450
+ (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending steps for a transaction');
447
451
  throw new SendTransactionError('Error while sending steps for a transaction', error);
448
452
  }
449
453
  }
@@ -488,9 +492,9 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
488
492
  this.participantsService.sendAIProviderChanged(_objectSpread(_objectSpread({}, basePayload), data));
489
493
  }
490
494
  } catch (error) {
491
- var _this$analyticsHelper12;
495
+ var _this$analyticsHelper13;
492
496
  // We don't want to throw errors for Presence features as they tend to self-restore
493
- (_this$analyticsHelper12 = this.analyticsHelper) === null || _this$analyticsHelper12 === void 0 || _this$analyticsHelper12.sendErrorEvent(error, 'Error while sending message - telepointer');
497
+ (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while sending message - telepointer');
494
498
  }
495
499
  }
496
500
  }, {
@@ -533,8 +537,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
533
537
  this.sendStepsTimer = undefined;
534
538
  }
535
539
  } catch (error) {
536
- var _this$analyticsHelper13;
537
- (_this$analyticsHelper13 = this.analyticsHelper) === null || _this$analyticsHelper13 === void 0 || _this$analyticsHelper13.sendErrorEvent(error, 'Error while shutting down the collab provider');
540
+ var _this$analyticsHelper14;
541
+ (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(error, 'Error while shutting down the collab provider');
538
542
  throw new DestroyError('Error while shutting down the collab provider', error);
539
543
  }
540
544
  this.clearTimers();
@@ -557,8 +561,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
557
561
  }
558
562
  this.metadataService.setTitle(title, broadcast);
559
563
  } catch (error) {
560
- var _this$analyticsHelper14;
561
- (_this$analyticsHelper14 = this.analyticsHelper) === null || _this$analyticsHelper14 === void 0 || _this$analyticsHelper14.sendErrorEvent(error, 'Error while setting title');
564
+ var _this$analyticsHelper15;
565
+ (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting title');
562
566
  throw new SetTitleError('Error while setting title', error);
563
567
  }
564
568
  }
@@ -576,8 +580,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
576
580
  try {
577
581
  this.metadataService.setEditorWidth(editorWidth, broadcast);
578
582
  } catch (error) {
579
- var _this$analyticsHelper15;
580
- (_this$analyticsHelper15 = this.analyticsHelper) === null || _this$analyticsHelper15 === void 0 || _this$analyticsHelper15.sendErrorEvent(error, 'Error while setting editor width');
583
+ var _this$analyticsHelper16;
584
+ (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting editor width');
581
585
  throw new SetEditorWidthError('Error while setting editor width', error);
582
586
  }
583
587
  }
@@ -596,8 +600,8 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
596
600
  }
597
601
  this.metadataService.setMetadata(metadata);
598
602
  } catch (error) {
599
- var _this$analyticsHelper16;
600
- (_this$analyticsHelper16 = this.analyticsHelper) === null || _this$analyticsHelper16 === void 0 || _this$analyticsHelper16.sendErrorEvent(error, 'Error while setting metadata');
603
+ var _this$analyticsHelper17;
604
+ (_this$analyticsHelper17 = this.analyticsHelper) === null || _this$analyticsHelper17 === void 0 || _this$analyticsHelper17.sendErrorEvent(error, 'Error while setting metadata');
601
605
  throw new SetMetadataError('Error while setting metadata', error);
602
606
  }
603
607
  }
package/dist/esm/types.js CHANGED
@@ -1,5 +1,3 @@
1
- // Re-export values for the /types entry point to this package
2
-
3
1
  // types from editor common end
4
2
 
5
3
  // Initial draft
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "9.46.0";
2
+ export var version = "10.0.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -17,6 +17,7 @@ export declare enum EVENT_ACTION {
17
17
  DROPPED_STEPS = "droppedStepInCatchup",// https://data-portal.internal.atlassian.com/analytics/registry/53724
18
18
  WEBSOCKET_MESSAGE_VOLUME_METRIC = "websocketMessageVolumeMetric",// https://data-portal.internal.atlassian.com/analytics/registry/53596
19
19
  PROVIDER_INITIALIZED = "providerInitialized",// https://data-portal.internal.atlassian.com/analytics/registry/54714
20
+ RECONNECTION = "providerReconnection",// https://data-portal.internal.atlassian.com/analytics/registry/73992
20
21
  PROVIDER_SETUP = "providerSetup",// https://data-portal.internal.atlassian.com/analytics/registry/54715
21
22
  HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps"
22
23
  }
@@ -253,7 +254,14 @@ type UpdateDocumentAnalyticsEvent = {
253
254
  isDocContentValid: boolean;
254
255
  } & BaseActionAnalyticsEventAttributes;
255
256
  };
256
- export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | UpdateDocumentAnalyticsEvent;
257
+ type ReconnectionAnalyticsEvent = {
258
+ eventAction: EVENT_ACTION.RECONNECTION;
259
+ attributes: {
260
+ eventStatus: EVENT_STATUS.SUCCESS;
261
+ disconnectionPeriodSeconds: number;
262
+ } & BaseActionAnalyticsEventAttributes;
263
+ };
264
+ export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | UpdateDocumentAnalyticsEvent | ReconnectionAnalyticsEvent;
257
265
  export declare const ACK_MAX_TRY = 60;
258
266
  export declare const CONFLUENCE = "confluence";
259
267
  /** Enumerable for attaching a reason to catchup (v2) call(s) */
@@ -7,7 +7,6 @@ import type { GetUserType } from './participants/participants-helper';
7
7
  import type AnalyticsHelper from './analytics/analytics-helper';
8
8
  import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, Activity } from '@atlaskit/editor-common/collab';
9
9
  import { type CatchupEventReason } from './helpers/const';
10
- export type { CollabParticipant, CollabEventInitData, CollabEventRemoteData, CollabEventConnectionData, CollabEventConnectingData, CollabEventPresenceData, ResolvedEditorState, CollabConnectedPayload, CollabConnectingPayload, CollabDisconnectedPayload, CollabInitPayload, CollabDataPayload, CollabTelepointerPayload, CollabPresencePayload, CollabMetadataPayload, CollabLocalStepsPayload, CollabCommitStatusEventPayload, CollabPermissionEventPayload, UserPermitType, CollabEvents, Metadata, StepJson, CollabEventTelepointerData, CollabSendableSelection, CollabEditProvider, NewCollabSyncUpErrorAttributes, SyncUpErrorFunction, CollabEventLocalStepData, } from '@atlaskit/editor-common/collab';
11
10
  export interface CollabEventDisconnectedData {
12
11
  sid: string;
13
12
  reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
@@ -215,3 +214,4 @@ export type ProductInformation = {
215
214
  product: string;
216
215
  subProduct?: string;
217
216
  };
217
+ export {};
@@ -17,6 +17,7 @@ export declare enum EVENT_ACTION {
17
17
  DROPPED_STEPS = "droppedStepInCatchup",// https://data-portal.internal.atlassian.com/analytics/registry/53724
18
18
  WEBSOCKET_MESSAGE_VOLUME_METRIC = "websocketMessageVolumeMetric",// https://data-portal.internal.atlassian.com/analytics/registry/53596
19
19
  PROVIDER_INITIALIZED = "providerInitialized",// https://data-portal.internal.atlassian.com/analytics/registry/54714
20
+ RECONNECTION = "providerReconnection",// https://data-portal.internal.atlassian.com/analytics/registry/73992
20
21
  PROVIDER_SETUP = "providerSetup",// https://data-portal.internal.atlassian.com/analytics/registry/54715
21
22
  HAS_UNCONFIRMED_STEPS = "hasUnconfirmedSteps"
22
23
  }
@@ -253,7 +254,14 @@ type UpdateDocumentAnalyticsEvent = {
253
254
  isDocContentValid: boolean;
254
255
  } & BaseActionAnalyticsEventAttributes;
255
256
  };
256
- export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | UpdateDocumentAnalyticsEvent;
257
+ type ReconnectionAnalyticsEvent = {
258
+ eventAction: EVENT_ACTION.RECONNECTION;
259
+ attributes: {
260
+ eventStatus: EVENT_STATUS.SUCCESS;
261
+ disconnectionPeriodSeconds: number;
262
+ } & BaseActionAnalyticsEventAttributes;
263
+ };
264
+ export type ActionAnalyticsEvent = AddStepsSuccessAnalyticsEvent | AddStepsFailureAnalyticsEvent | ReInitDocFailAnalyticsEvent | ReInitDocSuccessAnalyticsEvent | ConnectionSuccessAnalyticsEvent | ConnectionFailureAnalyticsEvent | CatchUpSuccessAnalyticsEvent | CatchUpFailureAnalyticsEvent | DocumentInitSuccessAnalyticsEvent | UpdateParticipantsSuccessAnalyticsEvent | CommitUnconfirmedStepsSuccessAnalyticsEvent | CommitUnconfirmedStepsFailureAnalyticsEvent | PublishPageSuccessAnalyticsEvent | PublishPageFailureAnalyticsEvent | GetCurrentStateSuccessAnalyticsEvent | GetCurrentStateFailureAnalyticsEvent | InvalidateTokenAnalyticsEvent | SendStepsRetryAnalyticsEvent | CatchupAfterMaxSendStepsRetryAnalyticsEvent | CatchUpDroppedStepsEvent | WebsocketMessageVolumeMetricEvent | ProviderInitializedAnalyticsEvent | ProviderSetupAnalyticsEvent | ProviderHasUnconfirmedStepsAnalyticsEvent | UpdateDocumentAnalyticsEvent | ReconnectionAnalyticsEvent;
257
265
  export declare const ACK_MAX_TRY = 60;
258
266
  export declare const CONFLUENCE = "confluence";
259
267
  /** Enumerable for attaching a reason to catchup (v2) call(s) */
@@ -7,7 +7,6 @@ import type { GetUserType } from './participants/participants-helper';
7
7
  import type AnalyticsHelper from './analytics/analytics-helper';
8
8
  import type { StepJson, CollabSendableSelection, Metadata, UserPermitType, Activity } from '@atlaskit/editor-common/collab';
9
9
  import { type CatchupEventReason } from './helpers/const';
10
- export type { CollabParticipant, CollabEventInitData, CollabEventRemoteData, CollabEventConnectionData, CollabEventConnectingData, CollabEventPresenceData, ResolvedEditorState, CollabConnectedPayload, CollabConnectingPayload, CollabDisconnectedPayload, CollabInitPayload, CollabDataPayload, CollabTelepointerPayload, CollabPresencePayload, CollabMetadataPayload, CollabLocalStepsPayload, CollabCommitStatusEventPayload, CollabPermissionEventPayload, UserPermitType, CollabEvents, Metadata, StepJson, CollabEventTelepointerData, CollabSendableSelection, CollabEditProvider, NewCollabSyncUpErrorAttributes, SyncUpErrorFunction, CollabEventLocalStepData, } from '@atlaskit/editor-common/collab';
11
10
  export interface CollabEventDisconnectedData {
12
11
  sid: string;
13
12
  reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
@@ -215,3 +214,4 @@ export type ProductInformation = {
215
214
  product: string;
216
215
  subProduct?: string;
217
216
  };
217
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "9.46.0",
3
+ "version": "10.0.0",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@atlaskit/analytics-gas-types": "^5.1.0",
36
36
  "@atlaskit/analytics-listeners": "^8.11.0",
37
- "@atlaskit/editor-common": "^94.24.0",
37
+ "@atlaskit/editor-common": "^95.0.0",
38
38
  "@atlaskit/editor-json-transformer": "^8.21.0",
39
39
  "@atlaskit/editor-prosemirror": "6.0.0",
40
40
  "@atlaskit/feature-gate-js-client": "^4.22.0",