@atlaskit/mention 27.13.2 → 27.14.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,27 @@
1
1
  # @atlaskit/mention
2
2
 
3
+ ## 27.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 27.14.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`e801feda9c00b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e801feda9c00b) -
14
+ [ux] Add `isAgentMention` to `@atlaskit/mention/types`, and mark agent mention items with a
15
+ `data-mention-is-agent` attribute for typeahead spotlight targeting.
16
+ ```ts
17
+ import { isAgentMention } from '@atlaskit/mention/types';
18
+ isAgentMention(mention); // true for AGENT userType, or APP with an agent appType
19
+ ```
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 27.13.2
4
26
 
5
27
  ### Patch Changes
@@ -162,7 +162,12 @@ var MentionItem = exports.default = /*#__PURE__*/function (_React$PureComponent)
162
162
  var restricted = (0, _types.isRestricted)(accessLevel);
163
163
  var nameHighlights = highlight && highlight.name;
164
164
  var xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon, #292A2E)";
165
- var RowStyle = (0, _expValEquals.expValEquals)('platform_editor_agent_mentions', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_agent_mentions_drop_one_fixes') ? _styles.RowStyleNext : _styles.RowStyle;
165
+ var RowStyle = _styles.RowStyle;
166
+ var isAgent = false;
167
+ if ((0, _expValEquals.expValEquals)('platform_editor_agent_mentions', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_agent_mentions_drop_one_fixes')) {
168
+ RowStyle = _styles.RowStyleNext;
169
+ isAgent = (0, _types.isAgentMention)(mention);
170
+ }
166
171
  return /*#__PURE__*/_react.default.createElement(_MessagesIntlProvider.default, null, /*#__PURE__*/_react.default.createElement(_styles.MentionItemStyle, {
167
172
  selected: selected,
168
173
  height: height,
@@ -173,6 +178,7 @@ var MentionItem = exports.default = /*#__PURE__*/function (_React$PureComponent)
173
178
  "data-testid": "mention-item-".concat(id),
174
179
  "data-mention-id": id,
175
180
  "data-mention-name": mentionName,
181
+ "data-mention-is-agent": isAgent ? 'true' : undefined,
176
182
  "data-selected": selected,
177
183
  ref: forwardedRef
178
184
  }, /*#__PURE__*/_react.default.createElement(RowStyle, null, /*#__PURE__*/_react.default.createElement(_styles.AvatarStyle, {
package/dist/cjs/types.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.UserType = exports.UserAccessLevel = exports.SliNames = exports.MentionType = exports.MentionNameStatus = exports.ComponentNames = exports.Actions = void 0;
7
+ exports.isAgentMention = isAgentMention;
7
8
  exports.isAppMention = isAppMention;
8
9
  exports.isPromise = void 0;
9
10
  exports.isRestricted = isRestricted;
@@ -102,6 +103,11 @@ function isSpecialMention(mention) {
102
103
  function isAppMention(mention) {
103
104
  return mention.userType && mention.userType === UserType[UserType.APP];
104
105
  }
106
+ function isAgentMention(mention) {
107
+ // Like `isAgentTypeAheadItem` in `editor-plugin-mentions/src/ui/type-ahead/index.tsx`
108
+ // and `isAgentUserType` in `editor-plugin-mentions/src/pm-plugins/agent.ts`
109
+ return mention.userType === UserType[UserType.APP] || mention.userType === 'AGENT' || mention.appType === 'agent';
110
+ }
105
111
  function isTeamMention(mention) {
106
112
  return mention.userType && mention.userType === UserType[UserType.TEAM];
107
113
  }
@@ -12,7 +12,7 @@ var _types = require("../types");
12
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
14
  var packageName = "@atlaskit/mention";
15
- var packageVersion = "27.13.1";
15
+ var packageVersion = "27.14.0";
16
16
  var SLI_EVENT_TYPE = exports.SLI_EVENT_TYPE = 'sli';
17
17
  var SMART_EVENT_TYPE = exports.SMART_EVENT_TYPE = 'smart';
18
18
  var fireAnalyticsMentionTypeaheadEvent = exports.fireAnalyticsMentionTypeaheadEvent = function fireAnalyticsMentionTypeaheadEvent(props) {
@@ -6,7 +6,7 @@ import Tag from '@atlaskit/tag';
6
6
  import React from 'react';
7
7
  import EditorPanelIcon from '@atlaskit/icon/core/status-information';
8
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
- import { isRestricted } from '../../types';
9
+ import { isAgentMention, isRestricted } from '../../types';
10
10
  import { NoAccessLabel } from '../../util/i18n';
11
11
  import { leftClick } from '../../util/mouse';
12
12
  import AsyncNoAccessTooltip from '../NoAccessTooltip';
@@ -131,7 +131,12 @@ export default class MentionItem extends React.PureComponent {
131
131
  const restricted = isRestricted(accessLevel);
132
132
  const nameHighlights = highlight && highlight.name;
133
133
  const xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon, #292A2E)";
134
- const RowStyle = expValEquals('platform_editor_agent_mentions', 'isEnabled', true) && fg('platform_editor_agent_mentions_drop_one_fixes') ? RowStyleNext : RowStyleLegacy;
134
+ let RowStyle = RowStyleLegacy;
135
+ let isAgent = false;
136
+ if (expValEquals('platform_editor_agent_mentions', 'isEnabled', true) && fg('platform_editor_agent_mentions_drop_one_fixes')) {
137
+ RowStyle = RowStyleNext;
138
+ isAgent = isAgentMention(mention);
139
+ }
135
140
  return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(MentionItemStyle, {
136
141
  selected: selected,
137
142
  height: height,
@@ -142,6 +147,7 @@ export default class MentionItem extends React.PureComponent {
142
147
  "data-testid": `mention-item-${id}`,
143
148
  "data-mention-id": id,
144
149
  "data-mention-name": mentionName,
150
+ "data-mention-is-agent": isAgent ? 'true' : undefined,
145
151
  "data-selected": selected,
146
152
  ref: forwardedRef
147
153
  }, /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, {
@@ -96,6 +96,11 @@ export function isSpecialMention(mention) {
96
96
  export function isAppMention(mention) {
97
97
  return mention.userType && mention.userType === UserType[UserType.APP];
98
98
  }
99
+ export function isAgentMention(mention) {
100
+ // Like `isAgentTypeAheadItem` in `editor-plugin-mentions/src/ui/type-ahead/index.tsx`
101
+ // and `isAgentUserType` in `editor-plugin-mentions/src/pm-plugins/agent.ts`
102
+ return mention.userType === UserType[UserType.APP] || mention.userType === 'AGENT' || mention.appType === 'agent';
103
+ }
99
104
  export function isTeamMention(mention) {
100
105
  return mention.userType && mention.userType === UserType[UserType.TEAM];
101
106
  }
@@ -2,7 +2,7 @@ import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-t
2
2
  import { ELEMENTS_CHANNEL } from '../_constants';
3
3
  import { ComponentNames, isSpecialMentionText } from '../types';
4
4
  const packageName = "@atlaskit/mention";
5
- const packageVersion = "27.13.1";
5
+ const packageVersion = "27.14.0";
6
6
  export const SLI_EVENT_TYPE = 'sli';
7
7
  export const SMART_EVENT_TYPE = 'smart';
8
8
  export const fireAnalyticsMentionTypeaheadEvent = props => (action, duration, userIds = [], query) => {
@@ -14,7 +14,7 @@ import Tag from '@atlaskit/tag';
14
14
  import React from 'react';
15
15
  import EditorPanelIcon from '@atlaskit/icon/core/status-information';
16
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
- import { isRestricted } from '../../types';
17
+ import { isAgentMention, isRestricted } from '../../types';
18
18
  import { NoAccessLabel } from '../../util/i18n';
19
19
  import { leftClick } from '../../util/mouse';
20
20
  import AsyncNoAccessTooltip from '../NoAccessTooltip';
@@ -142,7 +142,12 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
142
142
  var restricted = isRestricted(accessLevel);
143
143
  var nameHighlights = highlight && highlight.name;
144
144
  var xProductUserInfoIconColor = selected ? "var(--ds-icon-selected, #1868DB)" : "var(--ds-icon, #292A2E)";
145
- var RowStyle = expValEquals('platform_editor_agent_mentions', 'isEnabled', true) && fg('platform_editor_agent_mentions_drop_one_fixes') ? RowStyleNext : RowStyleLegacy;
145
+ var RowStyle = RowStyleLegacy;
146
+ var isAgent = false;
147
+ if (expValEquals('platform_editor_agent_mentions', 'isEnabled', true) && fg('platform_editor_agent_mentions_drop_one_fixes')) {
148
+ RowStyle = RowStyleNext;
149
+ isAgent = isAgentMention(mention);
150
+ }
146
151
  return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(MentionItemStyle, {
147
152
  selected: selected,
148
153
  height: height,
@@ -153,6 +158,7 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
153
158
  "data-testid": "mention-item-".concat(id),
154
159
  "data-mention-id": id,
155
160
  "data-mention-name": mentionName,
161
+ "data-mention-is-agent": isAgent ? 'true' : undefined,
156
162
  "data-selected": selected,
157
163
  ref: forwardedRef
158
164
  }, /*#__PURE__*/React.createElement(RowStyle, null, /*#__PURE__*/React.createElement(AvatarStyle, {
package/dist/esm/types.js CHANGED
@@ -96,6 +96,11 @@ export function isSpecialMention(mention) {
96
96
  export function isAppMention(mention) {
97
97
  return mention.userType && mention.userType === UserType[UserType.APP];
98
98
  }
99
+ export function isAgentMention(mention) {
100
+ // Like `isAgentTypeAheadItem` in `editor-plugin-mentions/src/ui/type-ahead/index.tsx`
101
+ // and `isAgentUserType` in `editor-plugin-mentions/src/pm-plugins/agent.ts`
102
+ return mention.userType === UserType[UserType.APP] || mention.userType === 'AGENT' || mention.appType === 'agent';
103
+ }
99
104
  export function isTeamMention(mention) {
100
105
  return mention.userType && mention.userType === UserType[UserType.TEAM];
101
106
  }
@@ -5,7 +5,7 @@ import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-t
5
5
  import { ELEMENTS_CHANNEL } from '../_constants';
6
6
  import { ComponentNames, isSpecialMentionText } from '../types';
7
7
  var packageName = "@atlaskit/mention";
8
- var packageVersion = "27.13.1";
8
+ var packageVersion = "27.14.0";
9
9
  export var SLI_EVENT_TYPE = 'sli';
10
10
  export var SMART_EVENT_TYPE = 'smart';
11
11
  export var fireAnalyticsMentionTypeaheadEvent = function fireAnalyticsMentionTypeaheadEvent(props) {
@@ -330,6 +330,7 @@ export interface MentionNameDetails {
330
330
  export declare function isRestricted(accessLevel?: string): boolean;
331
331
  export declare function isSpecialMention(mention: MentionDescription): boolean;
332
332
  export declare function isAppMention(mention: MentionDescription): boolean | '' | undefined;
333
+ export declare function isAgentMention(mention: MentionDescription): boolean;
333
334
  export declare function isTeamMention(mention: MentionDescription): boolean | '' | undefined;
334
335
  export declare function isSpecialMentionText(mentionText: string): boolean | '';
335
336
  export declare const isPromise: <T>(p: any) => p is Promise<T>;
package/docs/0-intro.tsx CHANGED
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { md, Props, Example, code, AtlassianInternalWarning } from '@atlaskit/docs';
3
3
 
4
4
  import SimpleMentionExample from '../examples/00-simple-mention-item.vr.ap';
5
- const SimpleMentionSource = require('!!raw-loader!../examples/00-simple-mention-item');
5
+ const SimpleMentionSource = require('!!raw-loader!../examples/00-simple-mention-item.vr.ap');
6
6
 
7
7
  const MentionProps = require('!!extract-react-types-loader!../src/components/Mention');
8
8
 
@@ -43,12 +43,13 @@ const _default_1: any = md`
43
43
  },
44
44
  });
45
45
 
46
- ReactDOM.render(
46
+ const root = createRoot(container);
47
+ root.render(
47
48
  <MentionTypeAhead
48
49
  resourceProvider={mentionProvider}
49
50
  query="John"
50
51
  onSelection={(mention) => { /* do something */ }}
51
- />, container);`}
52
+ />);`}
52
53
 
53
54
  ### Note:
54
55
 
package/package.json CHANGED
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/skeleton": "^4.2.0",
42
42
  "@atlaskit/tag": "^15.4.0",
43
43
  "@atlaskit/teams-avatar": "^4.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^143.0.0",
44
+ "@atlaskit/tmp-editor-statsig": "^144.0.0",
45
45
  "@atlaskit/tokens": "^16.4.0",
46
46
  "@atlaskit/tooltip": "^24.0.0",
47
47
  "@atlaskit/ufo": "^1.0.0",
@@ -125,5 +125,5 @@
125
125
  }
126
126
  },
127
127
  "types": "dist/types/index.d.ts",
128
- "version": "27.13.2"
128
+ "version": "27.14.1"
129
129
  }