@atlaskit/editor-plugin-avatar-group 3.1.1 → 3.1.2

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/editor-plugin-avatar-group
2
2
 
3
+ ## 3.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#145138](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145138)
8
+ [`0ba0ff24c0e33`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0ba0ff24c0e33) -
9
+ Enable useSharedPluginStateSelector in accessibility, alignment, annotation and avatar-group
10
+ plugins
11
+ - Updated dependencies
12
+
3
13
  ## 3.1.1
4
14
 
5
15
  ### Patch Changes
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _hooks = require("@atlaskit/editor-common/hooks");
11
11
  var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
12
+ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
13
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
14
  var _avatars = require("./avatars");
13
15
  var _inviteToEdit = require("./invite-to-edit");
14
16
  var AvatarsWithPluginState = function AvatarsWithPluginState(props) {
@@ -20,14 +22,34 @@ var AvatarsWithPluginState = function AvatarsWithPluginState(props) {
20
22
  featureFlags = props.featureFlags,
21
23
  editorAnalyticsAPI = props.editorAnalyticsAPI,
22
24
  editorAPI = props.editorAPI;
23
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['collabEdit']),
25
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(editorAPI, ['collabEdit'], {
26
+ disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
27
+ }),
24
28
  collabEditState = _useSharedPluginState.collabEditState;
25
- if (!collabEditState) {
29
+
30
+ // sessionId
31
+ var sessionIdSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(editorAPI, 'collabEdit.sessionId', {
32
+ disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
33
+ });
34
+ var sessionId = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? sessionIdSelector : collabEditState === null || collabEditState === void 0 ? void 0 : collabEditState.sessionId;
35
+
36
+ // activeParticipants
37
+ var activeParticipantsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(editorAPI, 'collabEdit.activeParticipants', {
38
+ disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
39
+ });
40
+ var activeParticipants = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? activeParticipantsSelector : collabEditState === null || collabEditState === void 0 ? void 0 : collabEditState.activeParticipants;
41
+ var initialised = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(editorAPI, 'collabEdit.initialised', {
42
+ disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
43
+ });
44
+ if (!collabEditState && (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)) {
45
+ return null;
46
+ }
47
+ if (!initialised && (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)) {
26
48
  return null;
27
49
  }
28
50
  return /*#__PURE__*/_react.default.createElement(_avatars.Avatars, {
29
- sessionId: collabEditState.sessionId,
30
- participants: collabEditState.activeParticipants,
51
+ sessionId: sessionId,
52
+ participants: activeParticipants,
31
53
  editorView: editorView,
32
54
  featureFlags: featureFlags,
33
55
  editorAnalyticsAPI: editorAnalyticsAPI,
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
3
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
4
  import messages from '@atlaskit/editor-common/messages';
5
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
7
  import { Avatars } from './avatars';
6
8
  import { InviteToEditButton } from './invite-to-edit';
7
9
  const AvatarsWithPluginState = props => {
@@ -17,13 +19,33 @@ const AvatarsWithPluginState = props => {
17
19
  } = props;
18
20
  const {
19
21
  collabEditState
20
- } = useSharedPluginState(editorAPI, ['collabEdit']);
21
- if (!collabEditState) {
22
+ } = useSharedPluginState(editorAPI, ['collabEdit'], {
23
+ disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
24
+ });
25
+
26
+ // sessionId
27
+ const sessionIdSelector = useSharedPluginStateSelector(editorAPI, 'collabEdit.sessionId', {
28
+ disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
29
+ });
30
+ const sessionId = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? sessionIdSelector : collabEditState === null || collabEditState === void 0 ? void 0 : collabEditState.sessionId;
31
+
32
+ // activeParticipants
33
+ const activeParticipantsSelector = useSharedPluginStateSelector(editorAPI, 'collabEdit.activeParticipants', {
34
+ disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
35
+ });
36
+ const activeParticipants = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? activeParticipantsSelector : collabEditState === null || collabEditState === void 0 ? void 0 : collabEditState.activeParticipants;
37
+ const initialised = useSharedPluginStateSelector(editorAPI, 'collabEdit.initialised', {
38
+ disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
39
+ });
40
+ if (!collabEditState && editorExperiment('platform_editor_usesharedpluginstateselector', false)) {
41
+ return null;
42
+ }
43
+ if (!initialised && editorExperiment('platform_editor_usesharedpluginstateselector', true)) {
22
44
  return null;
23
45
  }
24
46
  return /*#__PURE__*/React.createElement(Avatars, {
25
- sessionId: collabEditState.sessionId,
26
- participants: collabEditState.activeParticipants,
47
+ sessionId: sessionId,
48
+ participants: activeParticipants,
27
49
  editorView: editorView,
28
50
  featureFlags: featureFlags,
29
51
  editorAnalyticsAPI: editorAnalyticsAPI,
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
3
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
4
  import messages from '@atlaskit/editor-common/messages';
5
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
7
  import { Avatars } from './avatars';
6
8
  import { InviteToEditButton } from './invite-to-edit';
7
9
  var AvatarsWithPluginState = function AvatarsWithPluginState(props) {
@@ -13,14 +15,34 @@ var AvatarsWithPluginState = function AvatarsWithPluginState(props) {
13
15
  featureFlags = props.featureFlags,
14
16
  editorAnalyticsAPI = props.editorAnalyticsAPI,
15
17
  editorAPI = props.editorAPI;
16
- var _useSharedPluginState = useSharedPluginState(editorAPI, ['collabEdit']),
18
+ var _useSharedPluginState = useSharedPluginState(editorAPI, ['collabEdit'], {
19
+ disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
20
+ }),
17
21
  collabEditState = _useSharedPluginState.collabEditState;
18
- if (!collabEditState) {
22
+
23
+ // sessionId
24
+ var sessionIdSelector = useSharedPluginStateSelector(editorAPI, 'collabEdit.sessionId', {
25
+ disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
26
+ });
27
+ var sessionId = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? sessionIdSelector : collabEditState === null || collabEditState === void 0 ? void 0 : collabEditState.sessionId;
28
+
29
+ // activeParticipants
30
+ var activeParticipantsSelector = useSharedPluginStateSelector(editorAPI, 'collabEdit.activeParticipants', {
31
+ disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
32
+ });
33
+ var activeParticipants = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? activeParticipantsSelector : collabEditState === null || collabEditState === void 0 ? void 0 : collabEditState.activeParticipants;
34
+ var initialised = useSharedPluginStateSelector(editorAPI, 'collabEdit.initialised', {
35
+ disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
36
+ });
37
+ if (!collabEditState && editorExperiment('platform_editor_usesharedpluginstateselector', false)) {
38
+ return null;
39
+ }
40
+ if (!initialised && editorExperiment('platform_editor_usesharedpluginstateselector', true)) {
19
41
  return null;
20
42
  }
21
43
  return /*#__PURE__*/React.createElement(Avatars, {
22
- sessionId: collabEditState.sessionId,
23
- participants: collabEditState.activeParticipants,
44
+ sessionId: sessionId,
45
+ participants: activeParticipants,
24
46
  editorView: editorView,
25
47
  featureFlags: featureFlags,
26
48
  editorAnalyticsAPI: editorAnalyticsAPI,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-avatar-group",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Avatar Group plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/avatar-group": "^12.0.0",
40
- "@atlaskit/editor-common": "^103.15.0",
40
+ "@atlaskit/editor-common": "^103.18.0",
41
41
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
42
42
  "@atlaskit/editor-plugin-collab-edit": "^3.4.0",
43
43
  "@atlaskit/editor-plugin-feature-flags": "^1.4.0",
@@ -47,6 +47,7 @@
47
47
  "@atlaskit/icon": "^25.6.0",
48
48
  "@atlaskit/platform-feature-flags": "^1.1.0",
49
49
  "@atlaskit/theme": "^18.0.0",
50
+ "@atlaskit/tmp-editor-statsig": "^4.14.0",
50
51
  "@atlaskit/tokens": "^4.8.0",
51
52
  "@babel/runtime": "^7.0.0",
52
53
  "@emotion/react": "^11.7.1",