@atlaskit/collab-provider 11.2.4 → 11.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 11.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e860af1658f2d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e860af1658f2d) -
8
+ Ensure we are always sending the latest state while step merging
9
+ - Updated dependencies
10
+
11
+ ## 11.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`72f94befc61f2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/72f94befc61f2) -
16
+ replace method-style signatures with function-style signatures
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 11.2.4
4
23
 
5
24
  ### Patch Changes
@@ -1013,11 +1013,18 @@ var DocumentService = exports.DocumentService = /*#__PURE__*/function () {
1013
1013
  * @param reason
1014
1014
  * @example
1015
1015
  */
1016
- function send(tr, _oldState, newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
1016
+ function send(tr, _oldState, _newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
1017
1017
  ) {
1018
- var _this3 = this;
1018
+ var _this$getState1,
1019
+ _this$getState10,
1020
+ _this3 = this;
1019
1021
  var offlineEditingEnabled = (0, _experiments.editorExperiment)('platform_editor_offline_editing_web', true);
1020
1022
  var onlineStepMergingEnabled = (0, _expValEquals.expValEquals)('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
1023
+ // We don't trust `_newState` not to be stale
1024
+ // ED-29051 - the `onEditorViewStateUpdated` can have a stale state in edge cases. We need
1025
+ // to always ensure we're sending the latest state and unconfirmed steps so we use the state
1026
+ // from editorView directly (via getState).
1027
+ var newState = onlineStepMergingEnabled ? (_this$getState1 = (_this$getState10 = this.getState) === null || _this$getState10 === void 0 ? void 0 : _this$getState10.call(this)) !== null && _this$getState1 !== void 0 ? _this$getState1 : _newState : _newState;
1021
1028
 
1022
1029
  // Don't send any steps before we're ready.
1023
1030
  if (offlineEditingEnabled || onlineStepMergingEnabled) {
@@ -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 = "11.2.3";
8
+ var version = exports.version = "11.3.1";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -880,10 +880,16 @@ export class DocumentService {
880
880
  * @param reason
881
881
  * @example
882
882
  */
883
- send(tr, _oldState, newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
883
+ send(tr, _oldState, _newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
884
884
  ) {
885
+ var _this$getState1, _this$getState10;
885
886
  const offlineEditingEnabled = editorExperiment('platform_editor_offline_editing_web', true);
886
887
  const onlineStepMergingEnabled = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
888
+ // We don't trust `_newState` not to be stale
889
+ // ED-29051 - the `onEditorViewStateUpdated` can have a stale state in edge cases. We need
890
+ // to always ensure we're sending the latest state and unconfirmed steps so we use the state
891
+ // from editorView directly (via getState).
892
+ const newState = onlineStepMergingEnabled ? (_this$getState1 = (_this$getState10 = this.getState) === null || _this$getState10 === void 0 ? void 0 : _this$getState10.call(this)) !== null && _this$getState1 !== void 0 ? _this$getState1 : _newState : _newState;
887
893
 
888
894
  // Don't send any steps before we're ready.
889
895
  if (offlineEditingEnabled || onlineStepMergingEnabled) {
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "11.2.3";
2
+ export const version = "11.3.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1006,11 +1006,18 @@ export var DocumentService = /*#__PURE__*/function () {
1006
1006
  * @param reason
1007
1007
  * @example
1008
1008
  */
1009
- function send(tr, _oldState, newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
1009
+ function send(tr, _oldState, _newState, sendAnalyticsEvent, reason // only used for publish and draft-sync events - when called through getFinalAcknowledgedState
1010
1010
  ) {
1011
- var _this3 = this;
1011
+ var _this$getState1,
1012
+ _this$getState10,
1013
+ _this3 = this;
1012
1014
  var offlineEditingEnabled = editorExperiment('platform_editor_offline_editing_web', true);
1013
1015
  var onlineStepMergingEnabled = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
1016
+ // We don't trust `_newState` not to be stale
1017
+ // ED-29051 - the `onEditorViewStateUpdated` can have a stale state in edge cases. We need
1018
+ // to always ensure we're sending the latest state and unconfirmed steps so we use the state
1019
+ // from editorView directly (via getState).
1020
+ var newState = onlineStepMergingEnabled ? (_this$getState1 = (_this$getState10 = this.getState) === null || _this$getState10 === void 0 ? void 0 : _this$getState10.call(this)) !== null && _this$getState1 !== void 0 ? _this$getState1 : _newState : _newState;
1014
1021
 
1015
1022
  // Don't send any steps before we're ready.
1016
1023
  if (offlineEditingEnabled || onlineStepMergingEnabled) {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "11.2.3";
2
+ export var version = "11.3.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -188,5 +188,5 @@ export declare class DocumentService implements DocumentServiceInterface {
188
188
  * @param reason
189
189
  * @example
190
190
  */
191
- send(tr: Transaction | null, _oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean, reason?: GetResolvedEditorStateReason): void;
191
+ send(tr: Transaction | null, _oldState: EditorState | null, _newState: EditorState, sendAnalyticsEvent?: boolean, reason?: GetResolvedEditorStateReason): void;
192
192
  }
@@ -4,34 +4,34 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
4
4
  import type { InternalError } from '../errors/internal-errors';
5
5
  import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
6
6
  export interface DocumentServiceInterface {
7
- setup(params: {
7
+ setup: (params: {
8
8
  getState: () => EditorState;
9
9
  onSyncUpError?: SyncUpErrorFunction;
10
10
  clientId: number | string | undefined;
11
- }): this;
12
- updateDocument(params: {
11
+ }) => this;
12
+ updateDocument: (params: {
13
13
  doc: any;
14
14
  version: number;
15
15
  metadata: any;
16
16
  reserveCursor?: boolean;
17
- }): void;
18
- onRestore(params: {
17
+ }) => void;
18
+ onRestore: (params: {
19
19
  doc: any;
20
20
  version: number;
21
21
  metadata: any;
22
- }): void;
23
- onStepsAdded(data: {
22
+ }) => void;
23
+ onStepsAdded: (data: {
24
24
  version: number;
25
25
  steps: any[];
26
- }): void;
27
- onStepRejectedError(): void;
28
- send(tr: Transaction | null, oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean): void;
29
- sendStepsFromCurrentState(sendAnalyticsEvent?: boolean, reason?: GetResolvedEditorStateReason): void;
30
- throttledCatchupv2(): void;
31
- getCurrentState(): Promise<ResolvedEditorState>;
32
- getFinalAcknowledgedState(reason: GetResolvedEditorStateReason): Promise<ResolvedEditorState>;
33
- getIsNamespaceLocked(): boolean;
34
- getUnconfirmedSteps(): readonly ProseMirrorStep[] | undefined;
35
- getCurrentPmVersion(): number;
26
+ }) => void;
27
+ onStepRejectedError: () => void;
28
+ send: (tr: Transaction | null, oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean) => void;
29
+ sendStepsFromCurrentState: (sendAnalyticsEvent?: boolean, reason?: GetResolvedEditorStateReason) => void;
30
+ throttledCatchupv2: () => void;
31
+ getCurrentState: () => Promise<ResolvedEditorState>;
32
+ getFinalAcknowledgedState: (reason: GetResolvedEditorStateReason) => Promise<ResolvedEditorState>;
33
+ getIsNamespaceLocked: () => boolean;
34
+ getUnconfirmedSteps: () => readonly ProseMirrorStep[] | undefined;
35
+ getCurrentPmVersion: () => number;
36
36
  onErrorHandled: (error: InternalError) => void;
37
37
  }
@@ -12,7 +12,7 @@ export type BatchProps = {
12
12
  /** how often the debounce should run. Defaults to {@link ./participants-service#DEFAULT_FETCH_USERS_INTERVAL} if none provided **/
13
13
  debounceTime?: number;
14
14
  getUsers?: GetUsersType;
15
- onError?(error: unknown): void;
15
+ onError?: (error: unknown) => void;
16
16
  /** when to stop fetching users. eg. if this = 5, we won't attempt to hydrate more than 5 **/
17
17
  participantsLimit?: number;
18
18
  };
@@ -13,9 +13,9 @@ export interface CollabEventDisconnectedData {
13
13
  reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
14
14
  }
15
15
  export interface Storage {
16
- get(key: string): Promise<string>;
17
- set(key: string, value: string): Promise<void>;
18
- delete(key: string): Promise<void>;
16
+ get: (key: string) => Promise<string>;
17
+ set: (key: string, value: string) => Promise<void>;
18
+ delete: (key: string) => Promise<void>;
19
19
  }
20
20
  export interface InitialDraft {
21
21
  document: JSONDocNode;
@@ -188,5 +188,5 @@ export declare class DocumentService implements DocumentServiceInterface {
188
188
  * @param reason
189
189
  * @example
190
190
  */
191
- send(tr: Transaction | null, _oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean, reason?: GetResolvedEditorStateReason): void;
191
+ send(tr: Transaction | null, _oldState: EditorState | null, _newState: EditorState, sendAnalyticsEvent?: boolean, reason?: GetResolvedEditorStateReason): void;
192
192
  }
@@ -4,34 +4,34 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
4
4
  import type { InternalError } from '../errors/internal-errors';
5
5
  import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
6
6
  export interface DocumentServiceInterface {
7
- setup(params: {
7
+ setup: (params: {
8
8
  getState: () => EditorState;
9
9
  onSyncUpError?: SyncUpErrorFunction;
10
10
  clientId: number | string | undefined;
11
- }): this;
12
- updateDocument(params: {
11
+ }) => this;
12
+ updateDocument: (params: {
13
13
  doc: any;
14
14
  version: number;
15
15
  metadata: any;
16
16
  reserveCursor?: boolean;
17
- }): void;
18
- onRestore(params: {
17
+ }) => void;
18
+ onRestore: (params: {
19
19
  doc: any;
20
20
  version: number;
21
21
  metadata: any;
22
- }): void;
23
- onStepsAdded(data: {
22
+ }) => void;
23
+ onStepsAdded: (data: {
24
24
  version: number;
25
25
  steps: any[];
26
- }): void;
27
- onStepRejectedError(): void;
28
- send(tr: Transaction | null, oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean): void;
29
- sendStepsFromCurrentState(sendAnalyticsEvent?: boolean, reason?: GetResolvedEditorStateReason): void;
30
- throttledCatchupv2(): void;
31
- getCurrentState(): Promise<ResolvedEditorState>;
32
- getFinalAcknowledgedState(reason: GetResolvedEditorStateReason): Promise<ResolvedEditorState>;
33
- getIsNamespaceLocked(): boolean;
34
- getUnconfirmedSteps(): readonly ProseMirrorStep[] | undefined;
35
- getCurrentPmVersion(): number;
26
+ }) => void;
27
+ onStepRejectedError: () => void;
28
+ send: (tr: Transaction | null, oldState: EditorState | null, newState: EditorState, sendAnalyticsEvent?: boolean) => void;
29
+ sendStepsFromCurrentState: (sendAnalyticsEvent?: boolean, reason?: GetResolvedEditorStateReason) => void;
30
+ throttledCatchupv2: () => void;
31
+ getCurrentState: () => Promise<ResolvedEditorState>;
32
+ getFinalAcknowledgedState: (reason: GetResolvedEditorStateReason) => Promise<ResolvedEditorState>;
33
+ getIsNamespaceLocked: () => boolean;
34
+ getUnconfirmedSteps: () => readonly ProseMirrorStep[] | undefined;
35
+ getCurrentPmVersion: () => number;
36
36
  onErrorHandled: (error: InternalError) => void;
37
37
  }
@@ -12,7 +12,7 @@ export type BatchProps = {
12
12
  /** how often the debounce should run. Defaults to {@link ./participants-service#DEFAULT_FETCH_USERS_INTERVAL} if none provided **/
13
13
  debounceTime?: number;
14
14
  getUsers?: GetUsersType;
15
- onError?(error: unknown): void;
15
+ onError?: (error: unknown) => void;
16
16
  /** when to stop fetching users. eg. if this = 5, we won't attempt to hydrate more than 5 **/
17
17
  participantsLimit?: number;
18
18
  };
@@ -13,9 +13,9 @@ export interface CollabEventDisconnectedData {
13
13
  reason: 'CLIENT_DISCONNECT' | 'SERVER_DISCONNECT' | 'SOCKET_CLOSED' | 'SOCKET_ERROR' | 'SOCKET_TIMEOUT' | 'UNKNOWN_DISCONNECT';
14
14
  }
15
15
  export interface Storage {
16
- get(key: string): Promise<string>;
17
- set(key: string, value: string): Promise<void>;
18
- delete(key: string): Promise<void>;
16
+ get: (key: string) => Promise<string>;
17
+ set: (key: string, value: string) => Promise<void>;
18
+ delete: (key: string) => Promise<void>;
19
19
  }
20
20
  export interface InitialDraft {
21
21
  document: JSONDocNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "11.2.4",
3
+ "version": "11.3.1",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,13 +36,13 @@
36
36
  "@atlaskit/analytics-gas-types": "^5.1.0",
37
37
  "@atlaskit/analytics-listeners": "^9.0.0",
38
38
  "@atlaskit/anonymous-assets": "^0.0.4",
39
- "@atlaskit/editor-json-transformer": "^8.25.0",
39
+ "@atlaskit/editor-json-transformer": "^8.27.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/feature-gate-js-client": "^5.5.0",
42
42
  "@atlaskit/platform-feature-flags": "^1.1.0",
43
43
  "@atlaskit/prosemirror-collab": "^0.17.0",
44
44
  "@atlaskit/react-ufo": "^4.4.0",
45
- "@atlaskit/tmp-editor-statsig": "^11.3.0",
45
+ "@atlaskit/tmp-editor-statsig": "^11.5.0",
46
46
  "@atlaskit/ufo": "^0.4.0",
47
47
  "@atlaskit/util-service-support": "^6.3.0",
48
48
  "@babel/runtime": "^7.0.0",
@@ -68,7 +68,7 @@
68
68
  }
69
69
  },
70
70
  "devDependencies": {
71
- "@atlaskit/adf-schema": "^50.2.0",
71
+ "@atlaskit/adf-schema": "^50.2.1",
72
72
  "@atlassian/feature-flags-test-utils": "^0.3.0"
73
73
  },
74
74
  "platform-feature-flags": {
@@ -86,6 +86,6 @@
86
86
  }
87
87
  },
88
88
  "peerDependencies": {
89
- "@atlaskit/editor-common": "^107.25.0"
89
+ "@atlaskit/editor-common": "^107.28.0"
90
90
  }
91
91
  }