@atlaskit/editor-plugin-type-ahead 17.1.10 → 17.2.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,23 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 17.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c263d4de33054`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c263d4de33054) -
8
+ Render retryable agent mention load errors in the typeahead menu behind
9
+ `platform_editor_agent_mentions_rovo_query_timeout`.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 17.1.11
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 17.1.10
4
22
 
5
23
  ### Patch Changes
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.skipForwardToSafeItem = exports.skipBackwardToSafeItem = exports.moveSelectedIndex = exports.isTypeAheadOpen = exports.isTypeAheadHandler = exports.isTypeAheadAllowed = exports.getTypeAheadQuery = exports.getTypeAheadListAriaLabels = exports.getTypeAheadHandler = exports.getPluginState = exports.findHandlerByTrigger = exports.findHandler = void 0;
7
+ var _messages = require("@atlaskit/editor-common/messages");
7
8
  var _typeAhead = require("@atlaskit/editor-common/type-ahead");
9
+ var _types = require("@atlaskit/mention/types");
8
10
  var _fg = require("@atlaskit/platform-feature-flags/fg");
9
11
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
10
12
  var _updateSelectedIndex = require("./commands/update-selected-index");
@@ -162,6 +164,9 @@ var moveSelectedIndex = exports.moveSelectedIndex = function moveSelectedIndex(_
162
164
  (0, _updateSelectedIndex.updateSelectedIndex)(nextIndex, api)(editorView.state, editorView.dispatch);
163
165
  };
164
166
  };
167
+ var isAgentMentionLoadError = function isAgentMentionLoadError(mention) {
168
+ return (mention === null || mention === void 0 ? void 0 : mention.id) === _types.AGENT_MENTION_LOAD_ERROR_ID && mention.isPlaceholder === true && mention.placeholderType === 'error' && mention.appType === 'agent';
169
+ };
165
170
  var getTypeAheadListAriaLabels = exports.getTypeAheadListAriaLabels = function getTypeAheadListAriaLabels(trigger, intl, item) {
166
171
  var _item$emoji, _item$emoji2, _item$emoji3;
167
172
  switch (trigger) {
@@ -173,7 +178,7 @@ var getTypeAheadListAriaLabels = exports.getTypeAheadListAriaLabels = function g
173
178
  var shortName = (item === null || item === void 0 || (_item$mention3 = item.mention) === null || _item$mention3 === void 0 ? void 0 : _item$mention3.mentionName) || '';
174
179
  return {
175
180
  popupAriaLabel: intl.formatMessage(_typeAhead.typeAheadListMessages.mentionPopupLabel),
176
- listItemAriaLabel: description ? intl.formatMessage(_typeAhead.typeAheadListMessages.mentionListItemLabelWithDescription, {
181
+ listItemAriaLabel: isAgentMentionLoadError(item === null || item === void 0 ? void 0 : item.mention) ? "".concat(intl.formatMessage(_messages.mentionMessages.typeAheadSectionAgentsLoadError), ". ").concat(intl.formatMessage(_messages.mentionMessages.typeAheadSectionAgentsRetry)) : description ? intl.formatMessage(_typeAhead.typeAheadListMessages.mentionListItemLabelWithDescription, {
177
182
  name: name,
178
183
  shortName: shortName,
179
184
  description: description
@@ -1,4 +1,6 @@
1
+ import { mentionMessages } from '@atlaskit/editor-common/messages';
1
2
  import { TypeAheadAvailableNodes, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
3
+ import { AGENT_MENTION_LOAD_ERROR_ID } from '@atlaskit/mention/types';
2
4
  import { fg } from '@atlaskit/platform-feature-flags/fg';
3
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
4
6
  import { updateSelectedIndex } from './commands/update-selected-index';
@@ -158,6 +160,7 @@ export const moveSelectedIndex = ({
158
160
  }
159
161
  updateSelectedIndex(nextIndex, api)(editorView.state, editorView.dispatch);
160
162
  };
163
+ const isAgentMentionLoadError = mention => (mention === null || mention === void 0 ? void 0 : mention.id) === AGENT_MENTION_LOAD_ERROR_ID && mention.isPlaceholder === true && mention.placeholderType === 'error' && mention.appType === 'agent';
161
164
  export const getTypeAheadListAriaLabels = (trigger, intl, item) => {
162
165
  var _item$emoji, _item$emoji2, _item$emoji3;
163
166
  switch (trigger) {
@@ -169,7 +172,7 @@ export const getTypeAheadListAriaLabels = (trigger, intl, item) => {
169
172
  const shortName = (item === null || item === void 0 ? void 0 : (_item$mention3 = item.mention) === null || _item$mention3 === void 0 ? void 0 : _item$mention3.mentionName) || '';
170
173
  return {
171
174
  popupAriaLabel: intl.formatMessage(typeAheadListMessages.mentionPopupLabel),
172
- listItemAriaLabel: description ? intl.formatMessage(typeAheadListMessages.mentionListItemLabelWithDescription, {
175
+ listItemAriaLabel: isAgentMentionLoadError(item === null || item === void 0 ? void 0 : item.mention) ? `${intl.formatMessage(mentionMessages.typeAheadSectionAgentsLoadError)}. ${intl.formatMessage(mentionMessages.typeAheadSectionAgentsRetry)}` : description ? intl.formatMessage(typeAheadListMessages.mentionListItemLabelWithDescription, {
173
176
  name,
174
177
  shortName,
175
178
  description
@@ -1,4 +1,6 @@
1
+ import { mentionMessages } from '@atlaskit/editor-common/messages';
1
2
  import { TypeAheadAvailableNodes, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
3
+ import { AGENT_MENTION_LOAD_ERROR_ID } from '@atlaskit/mention/types';
2
4
  import { fg } from '@atlaskit/platform-feature-flags/fg';
3
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
4
6
  import { updateSelectedIndex } from './commands/update-selected-index';
@@ -156,6 +158,9 @@ export var moveSelectedIndex = function moveSelectedIndex(_ref4) {
156
158
  updateSelectedIndex(nextIndex, api)(editorView.state, editorView.dispatch);
157
159
  };
158
160
  };
161
+ var isAgentMentionLoadError = function isAgentMentionLoadError(mention) {
162
+ return (mention === null || mention === void 0 ? void 0 : mention.id) === AGENT_MENTION_LOAD_ERROR_ID && mention.isPlaceholder === true && mention.placeholderType === 'error' && mention.appType === 'agent';
163
+ };
159
164
  export var getTypeAheadListAriaLabels = function getTypeAheadListAriaLabels(trigger, intl, item) {
160
165
  var _item$emoji, _item$emoji2, _item$emoji3;
161
166
  switch (trigger) {
@@ -167,7 +172,7 @@ export var getTypeAheadListAriaLabels = function getTypeAheadListAriaLabels(trig
167
172
  var shortName = (item === null || item === void 0 || (_item$mention3 = item.mention) === null || _item$mention3 === void 0 ? void 0 : _item$mention3.mentionName) || '';
168
173
  return {
169
174
  popupAriaLabel: intl.formatMessage(typeAheadListMessages.mentionPopupLabel),
170
- listItemAriaLabel: description ? intl.formatMessage(typeAheadListMessages.mentionListItemLabelWithDescription, {
175
+ listItemAriaLabel: isAgentMentionLoadError(item === null || item === void 0 ? void 0 : item.mention) ? "".concat(intl.formatMessage(mentionMessages.typeAheadSectionAgentsLoadError), ". ").concat(intl.formatMessage(mentionMessages.typeAheadSectionAgentsRetry)) : description ? intl.formatMessage(typeAheadListMessages.mentionListItemLabelWithDescription, {
171
176
  name: name,
172
177
  shortName: shortName,
173
178
  description: description
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "17.1.10",
3
+ "version": "17.2.0",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,13 +35,14 @@
35
35
  "@atlaskit/heading": "^7.2.0",
36
36
  "@atlaskit/icon": "^37.6.0",
37
37
  "@atlaskit/insm": "^3.0.0",
38
+ "@atlaskit/mention": "^28.0.0",
38
39
  "@atlaskit/menu": "^10.2.0",
39
40
  "@atlaskit/platform-feature-experiments": "^0.3.0",
40
41
  "@atlaskit/platform-feature-flags": "^2.2.0",
41
42
  "@atlaskit/primitives": "^22.5.0",
42
43
  "@atlaskit/prosemirror-history": "^1.2.0",
43
44
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^176.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^177.0.0",
45
46
  "@atlaskit/tokens": "^16.11.0",
46
47
  "@atlaskit/visually-hidden": "^4.4.0",
47
48
  "@babel/runtime": "^7.0.0",