@atlaskit/collab-provider 7.6.1 → 7.6.3

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.
@@ -283,12 +283,14 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
283
283
  _defineProperty(_assertThisInitialized(_this), "onErrorHandled", function (error) {
284
284
  if (error && error.data) {
285
285
  if (error.data.code === 'HEAD_VERSION_UPDATE_FAILED' || error.data.code === 'VERSION_NUMBER_ALREADY_EXISTS') {
286
+ var measure = stopMeasure(MEASURE_NAME.ADD_STEPS);
286
287
  triggerCollabAnalyticsEvent({
287
288
  eventAction: EVENT_ACTION.ADD_STEPS,
288
289
  attributes: {
289
290
  eventStatus: EVENT_STATUS.FAILURE,
290
291
  error: error,
291
- documentAri: _this.config.documentAri
292
+ documentAri: _this.config.documentAri,
293
+ latency: measure === null || measure === void 0 ? void 0 : measure.duration
292
294
  }
293
295
  }, _this.analyticsClient);
294
296
  _this.stepRejectCounter++;
@@ -571,7 +573,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
571
573
  _defineProperty(_assertThisInitialized(_this), "getFinalAcknowledgedState", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
572
574
  var _this$metadata$title;
573
575
 
574
- var maxAttemptsToSync, count, unconfirmedState, state, adfDocument, measure, _measure2;
576
+ var maxAttemptsToSync, count, unconfirmedState, state, adfDocument, measure, _measure3;
575
577
 
576
578
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
577
579
  while (1) {
@@ -587,32 +589,33 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
587
589
  }
588
590
 
589
591
  return _context4.delegateYield( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
590
- var unconfirmedTrs, lastTr, isLastTrConfirmed, nextUnconfirmedState, nextUnconfirmedTrs, _state;
592
+ var unconfirmedTrs, lastTr, isLastTrConfirmed, nextUnconfirmedState, nextUnconfirmedTrs, _state, _measure2, measure;
591
593
 
592
594
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
593
595
  while (1) {
594
596
  switch (_context3.prev = _context3.next) {
595
597
  case 0:
596
- // We use origins here as steps can be rebased. When steps are rebased a new step is created.
598
+ startMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS); // We use origins here as steps can be rebased. When steps are rebased a new step is created.
597
599
  // This means that we can not track if it has been removed from the unconfirmed array or not.
598
600
  // Origins points to the original transaction that the step was created in. This is never changed
599
601
  // and gets passed down when a step is rebased.
602
+
600
603
  unconfirmedTrs = unconfirmedState.origins;
601
604
  lastTr = unconfirmedTrs[unconfirmedTrs.length - 1];
602
605
  isLastTrConfirmed = false;
603
606
 
604
- case 3:
607
+ case 4:
605
608
  if (isLastTrConfirmed) {
606
- _context3.next = 14;
609
+ _context3.next = 17;
607
610
  break;
608
611
  }
609
612
 
610
613
  _this.sendStepsFromCurrentState();
611
614
 
612
- _context3.next = 7;
613
- return sleep(500);
615
+ _context3.next = 8;
616
+ return sleep(1000);
614
617
 
615
- case 7:
618
+ case 8:
616
619
  nextUnconfirmedState = _this.getUnconfirmedSteps();
617
620
 
618
621
  if (nextUnconfirmedState && nextUnconfirmedState.steps.length) {
@@ -625,7 +628,7 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
625
628
  }
626
629
 
627
630
  if (!(!isLastTrConfirmed && count++ >= maxAttemptsToSync)) {
628
- _context3.next = 12;
631
+ _context3.next = 15;
629
632
  break;
630
633
  }
631
634
 
@@ -641,13 +644,33 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
641
644
  });
642
645
  }
643
646
 
644
- throw new Error("Can't syncup with Collab Service");
645
-
646
- case 12:
647
- _context3.next = 3;
647
+ _measure2 = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS);
648
+ triggerCollabAnalyticsEvent({
649
+ eventAction: EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS,
650
+ attributes: {
651
+ eventStatus: EVENT_STATUS.FAILURE,
652
+ latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration,
653
+ documentAri: _this.config.documentAri
654
+ }
655
+ }, _this.analyticsClient);
656
+ throw new Error("Can't sync up with Collab Service");
657
+
658
+ case 15:
659
+ _context3.next = 4;
648
660
  break;
649
661
 
650
- case 14:
662
+ case 17:
663
+ measure = stopMeasure(MEASURE_NAME.COMMIT_UNCONFIRMED_STEPS);
664
+ triggerCollabAnalyticsEvent({
665
+ eventAction: EVENT_ACTION.COMMIT_UNCONFIRMED_STEPS,
666
+ attributes: {
667
+ eventStatus: EVENT_STATUS.SUCCESS,
668
+ latency: measure === null || measure === void 0 ? void 0 : measure.duration,
669
+ documentAri: _this.config.documentAri
670
+ }
671
+ }, _this.analyticsClient);
672
+
673
+ case 19:
651
674
  case "end":
652
675
  return _context3.stop();
653
676
  }
@@ -671,12 +694,12 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
671
694
  }
672
695
  }, _this.analyticsClient);
673
696
  } catch (error) {
674
- _measure2 = stopMeasure(MEASURE_NAME.CONVERT_PM_TO_ADF);
697
+ _measure3 = stopMeasure(MEASURE_NAME.CONVERT_PM_TO_ADF);
675
698
  triggerCollabAnalyticsEvent({
676
699
  eventAction: EVENT_ACTION.CONVERT_PM_TO_ADF,
677
700
  attributes: {
678
701
  eventStatus: EVENT_STATUS.FAILURE,
679
- latency: _measure2 === null || _measure2 === void 0 ? void 0 : _measure2.duration,
702
+ latency: _measure3 === null || _measure3 === void 0 ? void 0 : _measure3.duration,
680
703
  error: error,
681
704
  documentAri: _this.config.documentAri
682
705
  }
@@ -776,11 +799,12 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
776
799
 
777
800
  if (!steps || !steps.length) {
778
801
  return;
779
- } // Avoid reference issues using a
802
+ }
803
+
804
+ startMeasure(MEASURE_NAME.ADD_STEPS); // Avoid reference issues using a
780
805
  // method outside of the provider
781
806
  // scope
782
807
 
783
-
784
808
  throttledCommitStep({
785
809
  channel: this.channel,
786
810
  userId: this.userId,
@@ -843,14 +867,16 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
843
867
  json: steps,
844
868
  version: version,
845
869
  userIds: clientIds
846
- }); // If steps can apply to local editor sucessfully, no need to accumulate the error counter.
870
+ }); // If steps can apply to local editor successfully, no need to accumulate the error counter.
847
871
 
848
872
  this.stepRejectCounter = 0;
873
+ var measure = stopMeasure(MEASURE_NAME.ADD_STEPS);
849
874
  triggerCollabAnalyticsEvent({
850
875
  eventAction: EVENT_ACTION.ADD_STEPS,
851
876
  attributes: {
852
877
  eventStatus: EVENT_STATUS.SUCCESS,
853
- documentAri: this.config.documentAri
878
+ documentAri: this.config.documentAri,
879
+ latency: measure === null || measure === void 0 ? void 0 : measure.duration
854
880
  }
855
881
  }, this.analyticsClient);
856
882
  this.emitTelepointersFromSteps(steps); // Resend local steps if none of the received steps originated with us!
@@ -17,6 +17,7 @@ export function createSocketIOSocket(url, auth, productInfo) {
17
17
  reconnectionDelayMax: SOCKET_IO_OPTIONS.RECONNECTION_DELAY_MAX,
18
18
  reconnectionDelay: SOCKET_IO_OPTIONS.RECONNECTION_DELAY,
19
19
  randomizationFactor: SOCKET_IO_OPTIONS.RANDOMIZATION_FACTOR,
20
+ closeOnBeforeunload: false,
20
21
  withCredentials: true,
21
22
  transports: ['polling', 'websocket'],
22
23
  path: "/".concat(pathname.split('/')[1], "/socket.io"),
@@ -0,0 +1,5 @@
1
+ export var name = "@atlaskit/collab-provider";
2
+ export var version = "7.6.3";
3
+ export var nextMajorVersion = function nextMajorVersion() {
4
+ return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "7.6.1",
3
+ "version": "7.6.3",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,9 @@ export declare enum MEASURE_NAME {
2
2
  CALLING_CATCHUP_API = "callingCatchupApi",
3
3
  SOCKET_CONNECT = "socketConnect",
4
4
  DOCUMENT_INIT = "documentInit",
5
- CONVERT_PM_TO_ADF = "convertPMToADF"
5
+ CONVERT_PM_TO_ADF = "convertPMToADF",
6
+ ADD_STEPS = "addSteps",
7
+ COMMIT_UNCONFIRMED_STEPS = "commitUnconfirmedSteps"
6
8
  }
7
9
  export declare function startMeasure(measureName: MEASURE_NAME): void;
8
10
  export declare function stopMeasure(measureName: MEASURE_NAME, onMeasureComplete?: (duration: number, startTime: number) => void): {
@@ -1,5 +1,4 @@
1
1
  import { ErrorPayload } from '../types';
2
- export declare const ATTRIBUTES_PACKAGE = "collabProvider";
3
2
  export declare const EVENT_SUBJECT = "collab";
4
3
  export declare enum COLLAB_SERVICE {
5
4
  NCS = "ncs",
@@ -11,7 +10,8 @@ export declare enum EVENT_ACTION {
11
10
  DOCUMENT_INIT = "documentInit",
12
11
  ADD_STEPS = "addSteps",
13
12
  CONVERT_PM_TO_ADF = "convertPMToADF",
14
- UPDATE_PARTICIPANTS = "updateParticipants"
13
+ UPDATE_PARTICIPANTS = "updateParticipants",
14
+ COMMIT_UNCONFIRMED_STEPS = "commitUnconfirmedSteps"
15
15
  }
16
16
  export declare enum EVENT_STATUS {
17
17
  SUCCESS = "SUCCESS",
@@ -28,4 +28,4 @@ export declare type AnalyticsEvent = {
28
28
  participants?: number;
29
29
  };
30
30
  };
31
- export declare const ACK_MAX_TRY = 10;
31
+ export declare const ACK_MAX_TRY = 30;
@@ -0,0 +1,3 @@
1
+ export declare const name: string;
2
+ export declare const version: string;
3
+ export declare const nextMajorVersion: () => string;
@@ -2,7 +2,9 @@ export declare enum MEASURE_NAME {
2
2
  CALLING_CATCHUP_API = "callingCatchupApi",
3
3
  SOCKET_CONNECT = "socketConnect",
4
4
  DOCUMENT_INIT = "documentInit",
5
- CONVERT_PM_TO_ADF = "convertPMToADF"
5
+ CONVERT_PM_TO_ADF = "convertPMToADF",
6
+ ADD_STEPS = "addSteps",
7
+ COMMIT_UNCONFIRMED_STEPS = "commitUnconfirmedSteps"
6
8
  }
7
9
  export declare function startMeasure(measureName: MEASURE_NAME): void;
8
10
  export declare function stopMeasure(measureName: MEASURE_NAME, onMeasureComplete?: (duration: number, startTime: number) => void): {
@@ -1,5 +1,4 @@
1
1
  import { ErrorPayload } from '../types';
2
- export declare const ATTRIBUTES_PACKAGE = "collabProvider";
3
2
  export declare const EVENT_SUBJECT = "collab";
4
3
  export declare enum COLLAB_SERVICE {
5
4
  NCS = "ncs",
@@ -11,7 +10,8 @@ export declare enum EVENT_ACTION {
11
10
  DOCUMENT_INIT = "documentInit",
12
11
  ADD_STEPS = "addSteps",
13
12
  CONVERT_PM_TO_ADF = "convertPMToADF",
14
- UPDATE_PARTICIPANTS = "updateParticipants"
13
+ UPDATE_PARTICIPANTS = "updateParticipants",
14
+ COMMIT_UNCONFIRMED_STEPS = "commitUnconfirmedSteps"
15
15
  }
16
16
  export declare enum EVENT_STATUS {
17
17
  SUCCESS = "SUCCESS",
@@ -28,4 +28,4 @@ export declare type AnalyticsEvent = {
28
28
  participants?: number;
29
29
  };
30
30
  };
31
- export declare const ACK_MAX_TRY = 10;
31
+ export declare const ACK_MAX_TRY = 30;
@@ -0,0 +1,3 @@
1
+ export declare const name: string;
2
+ export declare const version: string;
3
+ export declare const nextMajorVersion: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "7.6.1",
3
+ "version": "7.6.3",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -15,7 +15,8 @@
15
15
  "typesVersions": {
16
16
  ">=4.0 <4.5": {
17
17
  "*": [
18
- "dist/types-ts4.0/*"
18
+ "dist/types-ts4.0/*",
19
+ "dist/types-ts4.0/index.d.ts"
19
20
  ]
20
21
  }
21
22
  },
@@ -30,7 +31,7 @@
30
31
  "dependencies": {
31
32
  "@atlaskit/analytics-gas-types": "5.0.9",
32
33
  "@atlaskit/analytics-listeners": "^8.3.0",
33
- "@atlaskit/editor-common": "^69.3.0",
34
+ "@atlaskit/editor-common": "^70.2.0",
34
35
  "@atlaskit/editor-json-transformer": "^8.8.0",
35
36
  "@atlaskit/util-service-support": "^6.1.0",
36
37
  "@babel/runtime": "^7.0.0",
@@ -39,7 +40,7 @@
39
40
  "prosemirror-collab": "^1.2.2",
40
41
  "prosemirror-state": "1.3.4",
41
42
  "prosemirror-transform": "1.3.2",
42
- "socket.io-client": "^4.0.0"
43
+ "socket.io-client": "^4.1.3"
43
44
  },
44
45
  "techstack": {
45
46
  "@atlassian/frontend": {
@@ -47,7 +48,10 @@
47
48
  },
48
49
  "@repo/internal": {
49
50
  "deprecation": "no-deprecated-imports",
50
- "theming": "tokens"
51
+ "theming": "tokens",
52
+ "styling": [
53
+ "emotion"
54
+ ]
51
55
  }
52
56
  },
53
57
  "devDependencies": {