@atlaskit/editor-plugin-avatar-group 8.0.6 → 9.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,22 @@
1
1
  # @atlaskit/editor-plugin-avatar-group
2
2
 
3
+ ## 9.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 8.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`7e46dcf81d78a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7e46dcf81d78a) -
14
+ Ensure aria-label for avatar
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 8.0.6
4
21
 
5
22
  ### Patch Changes
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.Avatars = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@emotion/react");
10
+ var _reactIntlNext = require("react-intl-next");
10
11
  var _avatarGroup = _interopRequireDefault(require("@atlaskit/avatar-group"));
11
12
  var _analytics2 = require("@atlaskit/editor-common/analytics");
12
13
  var _state = require("@atlaskit/editor-prosemirror/state");
@@ -44,6 +45,7 @@ var Avatars = exports.Avatars = /*#__PURE__*/_react.default.memo(function (props
44
45
  var sessionId = props.sessionId,
45
46
  featureFlags = props.featureFlags,
46
47
  editorAPI = props.editorAPI;
48
+ var intl = (0, _reactIntlNext.useIntl)();
47
49
  // .slice() turns ReadonlyArray<CollabParticipant> into a mutable CollabParticipant[]
48
50
  var participants = (_props$participants = props.participants) === null || _props$participants === void 0 || (_props$participants = _props$participants.toArray()) === null || _props$participants === void 0 ? void 0 : _props$participants.slice();
49
51
  if (!participants) {
@@ -52,7 +54,7 @@ var Avatars = exports.Avatars = /*#__PURE__*/_react.default.memo(function (props
52
54
  var avatars = participants.sort(function (p) {
53
55
  return p.sessionId === sessionId ? -1 : 1;
54
56
  }).map(function (participant) {
55
- return (0, _toAvatar.default)(participant, editorAPI);
57
+ return (0, _toAvatar.default)(participant, editorAPI, intl.formatMessage);
56
58
  });
57
59
  if (!avatars.length) {
58
60
  return null;
@@ -8,10 +8,12 @@ exports.default = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
11
+ var _messages = require("@atlaskit/editor-common/messages");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
13
  var _coloredAvatarItem = require("./colored-avatar-item");
12
- var toAvatar = function toAvatar(participant, api) {
14
+ var toAvatar = function toAvatar(participant, api, formatMessage) {
13
15
  return {
14
- name: participant.name,
16
+ name: participant.name || ((0, _platformFeatureFlags.fg)('platform_ally_avatar_button_fix') ? formatMessage(_messages.avatarGroupMessages.anonymousCollaborator) : ''),
15
17
  src: participant.avatar,
16
18
  size: 'medium',
17
19
  presence: /*#__PURE__*/_react.default.createElement(_coloredAvatarItem.ColoredAvatarItem, {
@@ -7,6 +7,7 @@ import React from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { jsx } from '@emotion/react';
10
+ import { useIntl } from 'react-intl-next';
10
11
  import AvatarGroup from '@atlaskit/avatar-group';
11
12
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
12
13
  import { Selection } from '@atlaskit/editor-prosemirror/state';
@@ -40,12 +41,13 @@ export const Avatars = /*#__PURE__*/React.memo(props => {
40
41
  featureFlags,
41
42
  editorAPI
42
43
  } = props;
44
+ const intl = useIntl();
43
45
  // .slice() turns ReadonlyArray<CollabParticipant> into a mutable CollabParticipant[]
44
46
  const participants = (_props$participants = props.participants) === null || _props$participants === void 0 ? void 0 : (_props$participants$t = _props$participants.toArray()) === null || _props$participants$t === void 0 ? void 0 : _props$participants$t.slice();
45
47
  if (!participants) {
46
48
  return null;
47
49
  }
48
- const avatars = participants.sort(p => p.sessionId === sessionId ? -1 : 1).map(participant => toAvatar(participant, editorAPI));
50
+ const avatars = participants.sort(p => p.sessionId === sessionId ? -1 : 1).map(participant => toAvatar(participant, editorAPI, intl.formatMessage));
49
51
  if (!avatars.length) {
50
52
  return null;
51
53
  }
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import memoizeOne from 'memoize-one';
3
+ import { avatarGroupMessages } from '@atlaskit/editor-common/messages';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
3
5
  import { ColoredAvatarItem } from './colored-avatar-item';
4
- const toAvatar = (participant, api) => ({
5
- name: participant.name,
6
+ const toAvatar = (participant, api, formatMessage) => ({
7
+ name: participant.name || (fg('platform_ally_avatar_button_fix') ? formatMessage(avatarGroupMessages.anonymousCollaborator) : ''),
6
8
  src: participant.avatar,
7
9
  size: 'medium',
8
10
  presence: /*#__PURE__*/React.createElement(ColoredAvatarItem, {
@@ -7,6 +7,7 @@ import React from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { jsx } from '@emotion/react';
10
+ import { useIntl } from 'react-intl-next';
10
11
  import AvatarGroup from '@atlaskit/avatar-group';
11
12
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
12
13
  import { Selection } from '@atlaskit/editor-prosemirror/state';
@@ -37,6 +38,7 @@ export var Avatars = /*#__PURE__*/React.memo(function (props) {
37
38
  var sessionId = props.sessionId,
38
39
  featureFlags = props.featureFlags,
39
40
  editorAPI = props.editorAPI;
41
+ var intl = useIntl();
40
42
  // .slice() turns ReadonlyArray<CollabParticipant> into a mutable CollabParticipant[]
41
43
  var participants = (_props$participants = props.participants) === null || _props$participants === void 0 || (_props$participants = _props$participants.toArray()) === null || _props$participants === void 0 ? void 0 : _props$participants.slice();
42
44
  if (!participants) {
@@ -45,7 +47,7 @@ export var Avatars = /*#__PURE__*/React.memo(function (props) {
45
47
  var avatars = participants.sort(function (p) {
46
48
  return p.sessionId === sessionId ? -1 : 1;
47
49
  }).map(function (participant) {
48
- return toAvatar(participant, editorAPI);
50
+ return toAvatar(participant, editorAPI, intl.formatMessage);
49
51
  });
50
52
  if (!avatars.length) {
51
53
  return null;
@@ -1,10 +1,12 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React from 'react';
3
3
  import memoizeOne from 'memoize-one';
4
+ import { avatarGroupMessages } from '@atlaskit/editor-common/messages';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
4
6
  import { ColoredAvatarItem } from './colored-avatar-item';
5
- var toAvatar = function toAvatar(participant, api) {
7
+ var toAvatar = function toAvatar(participant, api, formatMessage) {
6
8
  return {
7
- name: participant.name,
9
+ name: participant.name || (fg('platform_ally_avatar_button_fix') ? formatMessage(avatarGroupMessages.anonymousCollaborator) : ''),
8
10
  src: participant.avatar,
9
11
  size: 'medium',
10
12
  presence: /*#__PURE__*/React.createElement(ColoredAvatarItem, {
@@ -1,6 +1,7 @@
1
+ import type { IntlShape } from 'react-intl-next';
1
2
  import type { AvatarProps } from '@atlaskit/avatar-group';
2
3
  import type { CollabParticipant } from '@atlaskit/editor-common/collab';
3
4
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import type { AvatarGroupPlugin } from '../avatarGroupPluginType';
5
- declare const _default: import("memoize-one").MemoizedFn<(participant: CollabParticipant, api: ExtractInjectionAPI<AvatarGroupPlugin> | undefined) => AvatarProps>;
6
+ declare const _default: import("memoize-one").MemoizedFn<(participant: CollabParticipant, api: ExtractInjectionAPI<AvatarGroupPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => AvatarProps>;
6
7
  export default _default;
@@ -1,6 +1,7 @@
1
+ import type { IntlShape } from 'react-intl-next';
1
2
  import type { AvatarProps } from '@atlaskit/avatar-group';
2
3
  import type { CollabParticipant } from '@atlaskit/editor-common/collab';
3
4
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import type { AvatarGroupPlugin } from '../avatarGroupPluginType';
5
- declare const _default: import("memoize-one").MemoizedFn<(participant: CollabParticipant, api: ExtractInjectionAPI<AvatarGroupPlugin> | undefined) => AvatarProps>;
6
+ declare const _default: import("memoize-one").MemoizedFn<(participant: CollabParticipant, api: ExtractInjectionAPI<AvatarGroupPlugin> | undefined, formatMessage: IntlShape["formatMessage"]) => AvatarProps>;
6
7
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-avatar-group",
3
- "version": "8.0.6",
3
+ "version": "9.0.0",
4
4
  "description": "Avatar Group plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,22 +33,23 @@
33
33
  "atlaskit:src": "src/index.ts",
34
34
  "dependencies": {
35
35
  "@atlaskit/avatar-group": "^12.4.0",
36
- "@atlaskit/editor-plugin-analytics": "^7.0.0",
37
- "@atlaskit/editor-plugin-collab-edit": "^8.0.0",
38
- "@atlaskit/editor-plugin-feature-flags": "^6.0.0",
39
- "@atlaskit/editor-plugin-primary-toolbar": "^8.0.0",
36
+ "@atlaskit/editor-plugin-analytics": "^8.0.0",
37
+ "@atlaskit/editor-plugin-collab-edit": "^9.0.0",
38
+ "@atlaskit/editor-plugin-feature-flags": "^7.0.0",
39
+ "@atlaskit/editor-plugin-primary-toolbar": "^9.0.0",
40
40
  "@atlaskit/editor-prosemirror": "^7.3.0",
41
41
  "@atlaskit/editor-shared-styles": "^3.10.0",
42
42
  "@atlaskit/icon": "^32.0.0",
43
+ "@atlaskit/platform-feature-flags": "^1.1.0",
43
44
  "@atlaskit/theme": "^22.0.0",
44
- "@atlaskit/tokens": "^11.0.0",
45
+ "@atlaskit/tokens": "^11.1.0",
45
46
  "@babel/runtime": "^7.0.0",
46
47
  "@emotion/react": "^11.7.1",
47
48
  "memoize-one": "^6.0.0",
48
49
  "react-intl-next": "npm:react-intl@^5.18.1"
49
50
  },
50
51
  "peerDependencies": {
51
- "@atlaskit/editor-common": "^111.23.0",
52
+ "@atlaskit/editor-common": "^112.0.0",
52
53
  "react": "^18.2.0"
53
54
  },
54
55
  "techstack": {
@@ -91,5 +92,10 @@
91
92
  "no-unused-dependencies": {
92
93
  "checkDevDependencies": true
93
94
  }
95
+ },
96
+ "platform-feature-flags": {
97
+ "platform_ally_avatar_button_fix": {
98
+ "type": "boolean"
99
+ }
94
100
  }
95
101
  }