@atlaskit/collab-provider 25.2.0 → 25.2.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,15 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 25.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f330bc1939dac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f330bc1939dac) -
8
+ Extend websocket-only transport to collab editing, behind the
9
+ platform-editor-collab-edit-websocket-only feature gate (excludes long-polling-only tenants).
10
+ Previously websocket-only applied to presence only.
11
+ - Updated dependencies
12
+
3
13
  ## 25.2.0
4
14
 
5
15
  ### Minor Changes
@@ -19,20 +19,47 @@ function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, analyticsH
19
19
  pathname = _URL.pathname,
20
20
  hostname = _URL.hostname;
21
21
  var socketIOOptions = _config.SOCKET_IO_OPTIONS;
22
- // Polling first
22
+ // Default: polling first, with WebSocket upgrade fallback
23
23
  var transports = ['polling', 'websocket'];
24
- if (isPresenceOnly) {
25
- // Presence-specific configuration
26
- if ((0, _fg.fg)('platform-editor-presence-websocket-only')) {
27
- // https://socket.io/docs/v4/client-options/#transports
28
- // WebSocket first, if fails, try polling
29
- transports = ['websocket'];
30
- }
31
- socketIOOptions = _config.SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
32
- } else {
33
- if ((0, _utils.isGCPtenant)(hostname) && (0, _fg.fg)('collab_edit_via_websocket_only_for_gcp')) {
34
- transports = ['websocket'];
24
+
25
+ // Determine transport strategy based on connection type and tenant.
26
+ // https://socket.io/docs/v4/client-options/#transports
27
+
28
+ var getConnectionCase = function getConnectionCase() {
29
+ if (isPresenceOnly) {
30
+ // Presence connections: all tenants (commercial, GCP, IC, etc.)
31
+ return 'presence';
32
+ } else if ((0, _utils.isGCPtenant)(hostname)) {
33
+ // Collab editing: GCP tenant
34
+ return 'gcp-collab';
35
+ } else {
36
+ // Collab editing: commercial and all other tenants
37
+ return 'collab-edit';
35
38
  }
39
+ };
40
+ switch (getConnectionCase()) {
41
+ case 'presence':
42
+ // Presence for all tenants (commercial, GCP, IC, …): WebSocket only when flag is enabled
43
+ socketIOOptions = _config.SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
44
+ if ((0, _fg.fg)('platform-editor-presence-websocket-only')) {
45
+ transports = ['websocket'];
46
+ }
47
+ break;
48
+ case 'gcp-collab':
49
+ // GCP: use WebSocket for all collab editing as well
50
+ if ((0, _fg.fg)('collab_edit_via_websocket_only_for_gcp')) {
51
+ transports = ['websocket'];
52
+ }
53
+ break;
54
+ case 'collab-edit':
55
+ // Collab edit (commercial and all other tenants): WebSocket only when flag is enabled, otherwise polling fallback
56
+ if ((0, _fg.fg)('platform-editor-collab-edit-websocket-only')) {
57
+ transports = ['websocket'];
58
+ }
59
+ break;
60
+ default:
61
+ // Default: polling first, with WebSocket upgrade fallback
62
+ break;
36
63
  }
37
64
  var extraHeaders = {
38
65
  'x-product': (0, _utils.getProduct)(productInfo),
@@ -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 = "25.1.6";
8
+ var version = exports.version = "25.2.0";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -9,20 +9,47 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
9
9
  hostname
10
10
  } = new URL(url);
11
11
  let socketIOOptions = SOCKET_IO_OPTIONS;
12
- // Polling first
12
+ // Default: polling first, with WebSocket upgrade fallback
13
13
  let transports = ['polling', 'websocket'];
14
- if (isPresenceOnly) {
15
- // Presence-specific configuration
16
- if (fg('platform-editor-presence-websocket-only')) {
17
- // https://socket.io/docs/v4/client-options/#transports
18
- // WebSocket first, if fails, try polling
19
- transports = ['websocket'];
20
- }
21
- socketIOOptions = SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
22
- } else {
23
- if (isGCPtenant(hostname) && fg('collab_edit_via_websocket_only_for_gcp')) {
24
- transports = ['websocket'];
14
+
15
+ // Determine transport strategy based on connection type and tenant.
16
+ // https://socket.io/docs/v4/client-options/#transports
17
+
18
+ const getConnectionCase = () => {
19
+ if (isPresenceOnly) {
20
+ // Presence connections: all tenants (commercial, GCP, IC, etc.)
21
+ return 'presence';
22
+ } else if (isGCPtenant(hostname)) {
23
+ // Collab editing: GCP tenant
24
+ return 'gcp-collab';
25
+ } else {
26
+ // Collab editing: commercial and all other tenants
27
+ return 'collab-edit';
25
28
  }
29
+ };
30
+ switch (getConnectionCase()) {
31
+ case 'presence':
32
+ // Presence for all tenants (commercial, GCP, IC, …): WebSocket only when flag is enabled
33
+ socketIOOptions = SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
34
+ if (fg('platform-editor-presence-websocket-only')) {
35
+ transports = ['websocket'];
36
+ }
37
+ break;
38
+ case 'gcp-collab':
39
+ // GCP: use WebSocket for all collab editing as well
40
+ if (fg('collab_edit_via_websocket_only_for_gcp')) {
41
+ transports = ['websocket'];
42
+ }
43
+ break;
44
+ case 'collab-edit':
45
+ // Collab edit (commercial and all other tenants): WebSocket only when flag is enabled, otherwise polling fallback
46
+ if (fg('platform-editor-collab-edit-websocket-only')) {
47
+ transports = ['websocket'];
48
+ }
49
+ break;
50
+ default:
51
+ // Default: polling first, with WebSocket upgrade fallback
52
+ break;
26
53
  }
27
54
  const extraHeaders = {
28
55
  'x-product': getProduct(productInfo),
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "25.1.6";
2
+ export const version = "25.2.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -11,20 +11,47 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly, ana
11
11
  pathname = _URL.pathname,
12
12
  hostname = _URL.hostname;
13
13
  var socketIOOptions = SOCKET_IO_OPTIONS;
14
- // Polling first
14
+ // Default: polling first, with WebSocket upgrade fallback
15
15
  var transports = ['polling', 'websocket'];
16
- if (isPresenceOnly) {
17
- // Presence-specific configuration
18
- if (fg('platform-editor-presence-websocket-only')) {
19
- // https://socket.io/docs/v4/client-options/#transports
20
- // WebSocket first, if fails, try polling
21
- transports = ['websocket'];
22
- }
23
- socketIOOptions = SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
24
- } else {
25
- if (isGCPtenant(hostname) && fg('collab_edit_via_websocket_only_for_gcp')) {
26
- transports = ['websocket'];
16
+
17
+ // Determine transport strategy based on connection type and tenant.
18
+ // https://socket.io/docs/v4/client-options/#transports
19
+
20
+ var getConnectionCase = function getConnectionCase() {
21
+ if (isPresenceOnly) {
22
+ // Presence connections: all tenants (commercial, GCP, IC, etc.)
23
+ return 'presence';
24
+ } else if (isGCPtenant(hostname)) {
25
+ // Collab editing: GCP tenant
26
+ return 'gcp-collab';
27
+ } else {
28
+ // Collab editing: commercial and all other tenants
29
+ return 'collab-edit';
27
30
  }
31
+ };
32
+ switch (getConnectionCase()) {
33
+ case 'presence':
34
+ // Presence for all tenants (commercial, GCP, IC, …): WebSocket only when flag is enabled
35
+ socketIOOptions = SOCKET_IO_OPTIONS_WITH_HIGH_JITTER;
36
+ if (fg('platform-editor-presence-websocket-only')) {
37
+ transports = ['websocket'];
38
+ }
39
+ break;
40
+ case 'gcp-collab':
41
+ // GCP: use WebSocket for all collab editing as well
42
+ if (fg('collab_edit_via_websocket_only_for_gcp')) {
43
+ transports = ['websocket'];
44
+ }
45
+ break;
46
+ case 'collab-edit':
47
+ // Collab edit (commercial and all other tenants): WebSocket only when flag is enabled, otherwise polling fallback
48
+ if (fg('platform-editor-collab-edit-websocket-only')) {
49
+ transports = ['websocket'];
50
+ }
51
+ break;
52
+ default:
53
+ // Default: polling first, with WebSocket upgrade fallback
54
+ break;
28
55
  }
29
56
  var extraHeaders = {
30
57
  'x-product': getProduct(productInfo),
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "25.1.6";
2
+ export var version = "25.2.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "25.2.0",
3
+ "version": "25.2.1",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -64,9 +64,12 @@
64
64
  },
65
65
  "platform_editor_blocked_document_ux": {
66
66
  "type": "boolean"
67
+ },
68
+ "platform-editor-collab-edit-websocket-only": {
69
+ "type": "boolean"
67
70
  }
68
71
  },
69
72
  "peerDependencies": {
70
- "@atlaskit/editor-common": "^120.14.0"
73
+ "@atlaskit/editor-common": "^120.15.0"
71
74
  }
72
75
  }