@atlaskit/editor-plugin-mentions 18.3.3 → 18.3.5
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 +15 -0
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/type-ahead/AgentMentionLoadErrorItem.compiled.css +14 -0
- package/dist/cjs/ui/type-ahead/AgentMentionLoadErrorItem.js +52 -0
- package/dist/cjs/ui/type-ahead/index.js +97 -72
- package/dist/cjs/ui/type-ahead/utils.js +6 -2
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/type-ahead/AgentMentionLoadErrorItem.compiled.css +14 -0
- package/dist/es2019/ui/type-ahead/AgentMentionLoadErrorItem.js +44 -0
- package/dist/es2019/ui/type-ahead/index.js +33 -13
- package/dist/es2019/ui/type-ahead/utils.js +3 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/type-ahead/AgentMentionLoadErrorItem.compiled.css +14 -0
- package/dist/esm/ui/type-ahead/AgentMentionLoadErrorItem.js +43 -0
- package/dist/esm/ui/type-ahead/index.js +98 -73
- package/dist/esm/ui/type-ahead/utils.js +5 -1
- package/dist/types/ui/type-ahead/AgentMentionLoadErrorItem.d.ts +5 -0
- package/dist/types/ui/type-ahead/utils.d.ts +5 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 18.3.5
|
|
4
|
+
|
|
5
|
+
### Patch 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
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 18.3.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 18.3.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -43,7 +43,7 @@ var ACTIONS = exports.ACTIONS = {
|
|
|
43
43
|
CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
|
|
44
44
|
};
|
|
45
45
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
46
|
-
var PACKAGE_VERSION = "18.3.
|
|
46
|
+
var PACKAGE_VERSION = "18.3.4";
|
|
47
47
|
var setProvider = function setProvider(provider) {
|
|
48
48
|
return function (state, dispatch) {
|
|
49
49
|
if (dispatch) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._189eidpf{border-width:0}
|
|
3
|
+
._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
|
|
4
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
|
|
5
|
+
._1bsb1osq{width:100%}
|
|
6
|
+
._1e0c1txw{display:flex}
|
|
7
|
+
._1tke1ylp{min-height:40px}
|
|
8
|
+
._4cvr1h6o{align-items:center}
|
|
9
|
+
._80omtlke{cursor:pointer}
|
|
10
|
+
._bfhk1j28{background-color:transparent}
|
|
11
|
+
._syaz13af{color:var(--ds-link,#1868db)}
|
|
12
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
13
|
+
._vchhusvi{box-sizing:border-box}
|
|
14
|
+
._y3gn1e5h{text-align:left}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* AgentMentionLoadErrorItem.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.AgentMentionLoadErrorItem = void 0;
|
|
10
|
+
require("./AgentMentionLoadErrorItem.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
14
|
+
var _reactIntl = require("react-intl");
|
|
15
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
16
|
+
var _statusError = _interopRequireDefault(require("@atlaskit/icon/core/status-error"));
|
|
17
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
var styles = {
|
|
20
|
+
retryRow: "_11c8fhey _189eidpf _1rjcu2gc _18zrutpp _4cvr1h6o _bfhk1j28 _vchhusvi _syazazsu _80omtlke _1e0c1txw _1tke1ylp _y3gn1e5h _1bsb1osq",
|
|
21
|
+
retryText: "_11c8fhey _syaz13af"
|
|
22
|
+
};
|
|
23
|
+
var AgentMentionLoadErrorItem = exports.AgentMentionLoadErrorItem = function AgentMentionLoadErrorItem(_ref) {
|
|
24
|
+
var onRetry = _ref.onRetry;
|
|
25
|
+
var intl = (0, _reactIntl.useIntl)();
|
|
26
|
+
var handleMouseDown = (0, _react.useCallback)(function (event) {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
}, []);
|
|
29
|
+
var handleClick = (0, _react.useCallback)(function (event) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
onRetry();
|
|
32
|
+
}, [onRetry]);
|
|
33
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
34
|
+
type: "button",
|
|
35
|
+
tabIndex: -1,
|
|
36
|
+
onMouseDown: handleMouseDown,
|
|
37
|
+
onClick: handleClick,
|
|
38
|
+
"data-testid": "agent-mention-load-error-item",
|
|
39
|
+
className: (0, _runtime.ax)([styles.retryRow])
|
|
40
|
+
}, /*#__PURE__*/React.createElement(_compiled.Inline, {
|
|
41
|
+
alignBlock: "center",
|
|
42
|
+
space: "space.100"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(_statusError.default, {
|
|
44
|
+
label: "",
|
|
45
|
+
color: "var(--ds-icon-danger, #C9372C)"
|
|
46
|
+
}), /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
47
|
+
as: "span",
|
|
48
|
+
color: "color.text.subtle"
|
|
49
|
+
}, intl.formatMessage(_messages.mentionMessages.typeAheadSectionAgentsLoadError)), /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
className: (0, _runtime.ax)([styles.retryText])
|
|
51
|
+
}, intl.formatMessage(_messages.mentionMessages.typeAheadSectionAgentsRetry))));
|
|
52
|
+
};
|
|
@@ -30,6 +30,7 @@ var _utils2 = require("../../pm-plugins/utils");
|
|
|
30
30
|
var _InviteItem = _interopRequireWildcard(require("../InviteItem"));
|
|
31
31
|
var _InviteItemWithEmailDomain = _interopRequireDefault(require("../InviteItem/InviteItemWithEmailDomain"));
|
|
32
32
|
var _analytics = require("./analytics");
|
|
33
|
+
var _AgentMentionLoadErrorItem = require("./AgentMentionLoadErrorItem");
|
|
33
34
|
var _MentionItemWithProfileCard = require("./MentionItemWithProfileCard");
|
|
34
35
|
var _utils3 = require("./utils");
|
|
35
36
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -41,6 +42,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
41
42
|
var isAgentTypeAheadItem = function isAgentTypeAheadItem(item) {
|
|
42
43
|
return item.mention ? (0, _utils3.isAgentMention)(item.mention) : false;
|
|
43
44
|
};
|
|
45
|
+
var isAgentMentionLoadErrorEnabled = function isAgentMentionLoadErrorEnabled(mention) {
|
|
46
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_agent_mentions_rovo_query_timeout') && (0, _utils3.isAgentMentionLoadError)(mention);
|
|
47
|
+
};
|
|
44
48
|
var isSearchOrderedAgentTypeAheadItem = function isSearchOrderedAgentTypeAheadItem(item) {
|
|
45
49
|
return !!item.mention && (0, _utils3.isExplicitAgentMention)(item.mention);
|
|
46
50
|
};
|
|
@@ -55,9 +59,12 @@ var shouldApplyMentionSearchOrder = function shouldApplyMentionSearchOrder(query
|
|
|
55
59
|
// `RovoChatMentionResource`) while the slower agent source resolves. It
|
|
56
60
|
// renders as a skeleton row via `@atlaskit/mention`'s `MentionItem` and
|
|
57
61
|
// must never be inserted or counted in rendered-mention analytics.
|
|
58
|
-
var
|
|
62
|
+
var isMentionPlaceholder = function isMentionPlaceholder(mention) {
|
|
59
63
|
return !!(mention !== null && mention !== void 0 && mention.isPlaceholder);
|
|
60
64
|
};
|
|
65
|
+
var isLoadingPlaceholder = function isLoadingPlaceholder(mention) {
|
|
66
|
+
return isMentionPlaceholder(mention) && !isAgentMentionLoadErrorEnabled(mention);
|
|
67
|
+
};
|
|
61
68
|
var createInviteItem = function createInviteItem(_ref) {
|
|
62
69
|
var mentionProvider = _ref.mentionProvider,
|
|
63
70
|
onInviteItemMount = _ref.onInviteItemMount,
|
|
@@ -118,13 +125,28 @@ var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(_ref4) {
|
|
|
118
125
|
profilecardProvider = _ref4.profilecardProvider;
|
|
119
126
|
return function (mention) {
|
|
120
127
|
var itemHeight = useRefreshedItemHeight ? _item.MENTION_ITEM_HEIGHT_REFRESHED : _item.MENTION_ITEM_HEIGHT;
|
|
128
|
+
if (isAgentMentionLoadErrorEnabled(mention)) {
|
|
129
|
+
return {
|
|
130
|
+
title: mention.id,
|
|
131
|
+
render: function render(_ref5) {
|
|
132
|
+
var onClick = _ref5.onClick;
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement(_AgentMentionLoadErrorItem.AgentMentionLoadErrorItem, {
|
|
134
|
+
onRetry: onClick
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
getCustomComponentHeight: function getCustomComponentHeight() {
|
|
138
|
+
return itemHeight;
|
|
139
|
+
},
|
|
140
|
+
mention: mention
|
|
141
|
+
};
|
|
142
|
+
}
|
|
121
143
|
if (isLoadingPlaceholder(mention) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_search_order')) {
|
|
122
144
|
return {
|
|
123
145
|
title: mention.id,
|
|
124
146
|
isNonInteractive: true,
|
|
125
|
-
render: function render(
|
|
126
|
-
var isSelected =
|
|
127
|
-
onClick =
|
|
147
|
+
render: function render(_ref6) {
|
|
148
|
+
var isSelected = _ref6.isSelected,
|
|
149
|
+
onClick = _ref6.onClick;
|
|
128
150
|
return /*#__PURE__*/_react.default.createElement(_MentionItemWithProfileCard.MentionItemWithProfileCard, {
|
|
129
151
|
mention: mention,
|
|
130
152
|
selected: isSelected,
|
|
@@ -141,10 +163,10 @@ var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(_ref4) {
|
|
|
141
163
|
}
|
|
142
164
|
return {
|
|
143
165
|
title: mention.id,
|
|
144
|
-
render: function render(
|
|
145
|
-
var isSelected =
|
|
146
|
-
onClick =
|
|
147
|
-
onHover =
|
|
166
|
+
render: function render(_ref7) {
|
|
167
|
+
var isSelected = _ref7.isSelected,
|
|
168
|
+
onClick = _ref7.onClick,
|
|
169
|
+
onHover = _ref7.onHover;
|
|
148
170
|
return (0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false) && (0, _fg.fg)('platform_editor_mention_typeahead_profilecard') ? /*#__PURE__*/_react.default.createElement(_MentionItemWithProfileCard.MentionItemWithProfileCard, {
|
|
149
171
|
mention: mention,
|
|
150
172
|
selected: isSelected,
|
|
@@ -198,12 +220,12 @@ function memoize(fn
|
|
|
198
220
|
};
|
|
199
221
|
}
|
|
200
222
|
var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAheadAnalytics(fireEvent) {
|
|
201
|
-
return function (
|
|
202
|
-
var query =
|
|
203
|
-
mentions =
|
|
204
|
-
stats =
|
|
205
|
-
mentionTypeaheadSessionId =
|
|
206
|
-
agentAnalytics =
|
|
223
|
+
return function (_ref8) {
|
|
224
|
+
var query = _ref8.query,
|
|
225
|
+
mentions = _ref8.mentions,
|
|
226
|
+
stats = _ref8.stats,
|
|
227
|
+
mentionTypeaheadSessionId = _ref8.mentionTypeaheadSessionId,
|
|
228
|
+
agentAnalytics = _ref8.agentAnalytics;
|
|
207
229
|
var duration = 0;
|
|
208
230
|
var userOrTeamIds = null;
|
|
209
231
|
var teams = null;
|
|
@@ -305,30 +327,29 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
305
327
|
* `createTypeAheadConfig` and intentionally mutated here as a
|
|
306
328
|
* side-effect — preserves the existing single-shot semantics.
|
|
307
329
|
*/
|
|
308
|
-
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(
|
|
309
|
-
var fireEvent =
|
|
310
|
-
getFirstQueryWithoutResults =
|
|
311
|
-
setFirstQueryWithoutResults =
|
|
312
|
-
hasFiredInviteItemViewed =
|
|
313
|
-
markInviteItemViewed =
|
|
314
|
-
toItem =
|
|
315
|
-
enableAgentSectioning =
|
|
316
|
-
return function (
|
|
317
|
-
var mentions =
|
|
318
|
-
query =
|
|
319
|
-
stats =
|
|
320
|
-
mentionProvider =
|
|
321
|
-
contextIdentifierProvider =
|
|
322
|
-
sessionId =
|
|
330
|
+
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(_ref9) {
|
|
331
|
+
var fireEvent = _ref9.fireEvent,
|
|
332
|
+
getFirstQueryWithoutResults = _ref9.getFirstQueryWithoutResults,
|
|
333
|
+
setFirstQueryWithoutResults = _ref9.setFirstQueryWithoutResults,
|
|
334
|
+
hasFiredInviteItemViewed = _ref9.hasFiredInviteItemViewed,
|
|
335
|
+
markInviteItemViewed = _ref9.markInviteItemViewed,
|
|
336
|
+
toItem = _ref9.toItem,
|
|
337
|
+
enableAgentSectioning = _ref9.enableAgentSectioning;
|
|
338
|
+
return function (_ref0) {
|
|
339
|
+
var mentions = _ref0.mentions,
|
|
340
|
+
query = _ref0.query,
|
|
341
|
+
stats = _ref0.stats,
|
|
342
|
+
mentionProvider = _ref0.mentionProvider,
|
|
343
|
+
contextIdentifierProvider = _ref0.contextIdentifierProvider,
|
|
344
|
+
sessionId = _ref0.sessionId;
|
|
323
345
|
var displayMentions = shouldApplyMentionSearchOrder(query) ? (0, _utils3.orderMentionsForDisplay)(mentions) : mentions;
|
|
324
346
|
var mentionItems = displayMentions.map(function (mention) {
|
|
325
347
|
return toItem(mention);
|
|
326
348
|
});
|
|
327
|
-
//
|
|
328
|
-
//
|
|
329
|
-
// and no-results bookkeeping so it isn't counted as a real result.
|
|
349
|
+
// Provider placeholders stay in `mentionItems` so loading/error rows render,
|
|
350
|
+
// but they are not real mention results for analytics or agent counts.
|
|
330
351
|
var realMentions = displayMentions.filter(function (mention) {
|
|
331
|
-
return !
|
|
352
|
+
return !isMentionPlaceholder(mention);
|
|
332
353
|
});
|
|
333
354
|
var agentCount = realMentions.filter(_utils3.isAgentMention).length;
|
|
334
355
|
var agentAnalytics = {
|
|
@@ -373,18 +394,18 @@ var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToType
|
|
|
373
394
|
})(mentionItems);
|
|
374
395
|
};
|
|
375
396
|
};
|
|
376
|
-
var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeAheadConfig(
|
|
377
|
-
var sanitizePrivateContent =
|
|
378
|
-
mentionInsertDisplayName =
|
|
379
|
-
fireEvent =
|
|
380
|
-
HighlightComponent =
|
|
381
|
-
api =
|
|
382
|
-
handleMentionsChanged =
|
|
383
|
-
|
|
384
|
-
enableAgentSectioning =
|
|
385
|
-
|
|
386
|
-
showAgentMentionsLabsLozenge =
|
|
387
|
-
profilecardProvider =
|
|
397
|
+
var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeAheadConfig(_ref1) {
|
|
398
|
+
var sanitizePrivateContent = _ref1.sanitizePrivateContent,
|
|
399
|
+
mentionInsertDisplayName = _ref1.mentionInsertDisplayName,
|
|
400
|
+
fireEvent = _ref1.fireEvent,
|
|
401
|
+
HighlightComponent = _ref1.HighlightComponent,
|
|
402
|
+
api = _ref1.api,
|
|
403
|
+
handleMentionsChanged = _ref1.handleMentionsChanged,
|
|
404
|
+
_ref1$enableAgentSect = _ref1.enableAgentSectioning,
|
|
405
|
+
enableAgentSectioning = _ref1$enableAgentSect === void 0 ? false : _ref1$enableAgentSect,
|
|
406
|
+
_ref1$showAgentMentio = _ref1.showAgentMentionsLabsLozenge,
|
|
407
|
+
showAgentMentionsLabsLozenge = _ref1$showAgentMentio === void 0 ? false : _ref1$showAgentMentio,
|
|
408
|
+
profilecardProvider = _ref1.profilecardProvider;
|
|
388
409
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
389
410
|
var sessionId = (0, _uuid.v4)();
|
|
390
411
|
var firstQueryWithoutResults = null;
|
|
@@ -424,18 +445,18 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
424
445
|
}
|
|
425
446
|
return null;
|
|
426
447
|
},
|
|
427
|
-
getItems: function getItems(
|
|
448
|
+
getItems: function getItems(_ref10) {
|
|
428
449
|
var _api$contextIdentifie, _api$contextIdentifie2;
|
|
429
|
-
var query =
|
|
430
|
-
editorState =
|
|
450
|
+
var query = _ref10.query,
|
|
451
|
+
editorState = _ref10.editorState;
|
|
431
452
|
lastTypeAheadQuery = query || '';
|
|
432
453
|
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
433
454
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
434
455
|
return Promise.resolve([]);
|
|
435
456
|
}
|
|
436
457
|
var mentionProvider = pluginState.mentionProvider;
|
|
437
|
-
var
|
|
438
|
-
contextIdentifierProvider =
|
|
458
|
+
var _ref11 = (_api$contextIdentifie = api === null || api === void 0 || (_api$contextIdentifie2 = api.contextIdentifier) === null || _api$contextIdentifie2 === void 0 ? void 0 : _api$contextIdentifie2.sharedState.currentState()) !== null && _api$contextIdentifie !== void 0 ? _api$contextIdentifie : {},
|
|
459
|
+
contextIdentifierProvider = _ref11.contextIdentifierProvider;
|
|
439
460
|
return new Promise(function (resolve, reject) {
|
|
440
461
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
441
462
|
var key = "loadingMentionsForTypeAhead_".concat((0, _uuid.v4)());
|
|
@@ -470,8 +491,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
470
491
|
}));
|
|
471
492
|
});
|
|
472
493
|
},
|
|
473
|
-
getSections: function getSections(
|
|
474
|
-
var intl =
|
|
494
|
+
getSections: function getSections(_ref12) {
|
|
495
|
+
var intl = _ref12.intl;
|
|
475
496
|
if (!enableAgentSectioning) {
|
|
476
497
|
return [];
|
|
477
498
|
}
|
|
@@ -516,12 +537,12 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
516
537
|
lastTypeAheadQuery = '';
|
|
517
538
|
_hasFiredInviteItemViewed = false;
|
|
518
539
|
},
|
|
519
|
-
selectItem: function selectItem(state, item, insert,
|
|
540
|
+
selectItem: function selectItem(state, item, insert, _ref13) {
|
|
520
541
|
var _api$contextIdentifie3, _api$contextIdentifie4;
|
|
521
|
-
var mode =
|
|
522
|
-
stats =
|
|
523
|
-
query =
|
|
524
|
-
sourceListItem =
|
|
542
|
+
var mode = _ref13.mode,
|
|
543
|
+
stats = _ref13.stats,
|
|
544
|
+
query = _ref13.query,
|
|
545
|
+
sourceListItem = _ref13.sourceListItem;
|
|
525
546
|
var schema = state.schema;
|
|
526
547
|
|
|
527
548
|
// Placeholder isn't selectable. Return `false` (not a transaction) so
|
|
@@ -531,6 +552,15 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
531
552
|
}
|
|
532
553
|
var pluginState = (0, _utils2.getMentionPluginState)(state);
|
|
533
554
|
var mentionProvider = pluginState.mentionProvider;
|
|
555
|
+
var _ref14 = (_api$contextIdentifie3 = api === null || api === void 0 || (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {},
|
|
556
|
+
contextIdentifierProvider = _ref14.contextIdentifierProvider;
|
|
557
|
+
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
558
|
+
sessionId: sessionId
|
|
559
|
+
});
|
|
560
|
+
if (isAgentMentionLoadErrorEnabled(item.mention)) {
|
|
561
|
+
mentionProvider === null || mentionProvider === void 0 || mentionProvider.filter(query || '', mentionContext);
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
534
564
|
var _item$mention = item.mention,
|
|
535
565
|
id = _item$mention.id,
|
|
536
566
|
name = _item$mention.name,
|
|
@@ -538,11 +568,6 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
538
568
|
accessLevel = _item$mention.accessLevel,
|
|
539
569
|
userType = _item$mention.userType,
|
|
540
570
|
isXProductUser = _item$mention.isXProductUser;
|
|
541
|
-
var _ref13 = (_api$contextIdentifie3 = api === null || api === void 0 || (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {},
|
|
542
|
-
contextIdentifierProvider = _ref13.contextIdentifierProvider;
|
|
543
|
-
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
544
|
-
sessionId: sessionId
|
|
545
|
-
});
|
|
546
571
|
var isAgentMentionSelection = (0, _utils3.isAgentMention)(item.mention);
|
|
547
572
|
var isAgentMentionInsertion = isAgentMentionSelection && (0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false);
|
|
548
573
|
// userType can be missing for provider-only agent mentions. Copy/paste cannot
|
|
@@ -666,11 +691,11 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
666
691
|
}
|
|
667
692
|
return tr;
|
|
668
693
|
},
|
|
669
|
-
dismiss: function dismiss(
|
|
670
|
-
var editorState =
|
|
671
|
-
query =
|
|
672
|
-
stats =
|
|
673
|
-
wasItemInserted =
|
|
694
|
+
dismiss: function dismiss(_ref15) {
|
|
695
|
+
var editorState = _ref15.editorState,
|
|
696
|
+
query = _ref15.query,
|
|
697
|
+
stats = _ref15.stats,
|
|
698
|
+
wasItemInserted = _ref15.wasItemInserted;
|
|
674
699
|
firstQueryWithoutResults = null;
|
|
675
700
|
_hasFiredInviteItemViewed = false;
|
|
676
701
|
var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
|
|
@@ -715,10 +740,10 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
715
740
|
* so we only attach it when the gate is on — otherwise the proven
|
|
716
741
|
* single-shot `getItems` path continues to drive every consumer.
|
|
717
742
|
*/
|
|
718
|
-
var subscribeToItemsUpdates = function subscribeToItemsUpdates(
|
|
743
|
+
var subscribeToItemsUpdates = function subscribeToItemsUpdates(_ref16) {
|
|
719
744
|
var _api$contextIdentifie5, _api$contextIdentifie6;
|
|
720
|
-
var query =
|
|
721
|
-
editorState =
|
|
745
|
+
var query = _ref16.query,
|
|
746
|
+
editorState = _ref16.editorState;
|
|
722
747
|
lastTypeAheadQuery = query || '';
|
|
723
748
|
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
724
749
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
@@ -730,8 +755,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
730
755
|
};
|
|
731
756
|
}
|
|
732
757
|
var mentionProvider = pluginState.mentionProvider;
|
|
733
|
-
var
|
|
734
|
-
contextIdentifierProvider =
|
|
758
|
+
var _ref17 = (_api$contextIdentifie5 = api === null || api === void 0 || (_api$contextIdentifie6 = api.contextIdentifier) === null || _api$contextIdentifie6 === void 0 ? void 0 : _api$contextIdentifie6.sharedState.currentState()) !== null && _api$contextIdentifie5 !== void 0 ? _api$contextIdentifie5 : {},
|
|
759
|
+
contextIdentifierProvider = _ref17.contextIdentifierProvider;
|
|
735
760
|
|
|
736
761
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
737
762
|
var key = "loadingMentionsForTypeAhead_".concat((0, _uuid.v4)());
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.shouldKeepInviteItem = exports.orderMentionsForDisplay = exports.isTeamType = exports.isTeamStats = exports.isInviteItem = exports.isExplicitAgentMention = exports.isBotOrTeamMention = exports.isAgentUserType = exports.isAgentMention = exports.getMentionDisplayGroup = void 0;
|
|
6
|
+
exports.shouldKeepInviteItem = exports.orderMentionsForDisplay = exports.isTeamType = exports.isTeamStats = exports.isInviteItem = exports.isExplicitAgentMention = exports.isBotOrTeamMention = exports.isAgentUserType = exports.isAgentMentionLoadError = exports.isAgentMention = exports.getMentionDisplayGroup = void 0;
|
|
7
|
+
var _types = require("@atlaskit/mention/types");
|
|
7
8
|
var _InviteItem = require("../InviteItem");
|
|
8
9
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
9
10
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -35,13 +36,16 @@ var isAgentMention = exports.isAgentMention = function isAgentMention(mention) {
|
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* True when the mention is explicitly an agent, not a generic APP/bot.
|
|
38
|
-
* Prefer this over
|
|
39
|
+
* Prefer this over `isAgentMention` when ordering the search display
|
|
39
40
|
* list behind `platform_editor_mention_search_order` — bare `userType: 'APP'`
|
|
40
41
|
* is a bot unless `appType === 'agent'`.
|
|
41
42
|
*/
|
|
42
43
|
var isExplicitAgentMention = exports.isExplicitAgentMention = function isExplicitAgentMention(mention) {
|
|
43
44
|
return mention.appType === 'agent' || mention.userType === 'AGENT';
|
|
44
45
|
};
|
|
46
|
+
var isAgentMentionLoadError = exports.isAgentMentionLoadError = function isAgentMentionLoadError(mention) {
|
|
47
|
+
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';
|
|
48
|
+
};
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
* Connect/app bots and teams. Explicit agents are excluded so they can be
|
|
@@ -32,7 +32,7 @@ export const ACTIONS = {
|
|
|
32
32
|
CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
|
|
33
33
|
};
|
|
34
34
|
const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
35
|
-
const PACKAGE_VERSION = "18.3.
|
|
35
|
+
const PACKAGE_VERSION = "18.3.4";
|
|
36
36
|
const setProvider = provider => (state, dispatch) => {
|
|
37
37
|
if (dispatch) {
|
|
38
38
|
dispatch(state.tr.setMeta(mentionPluginKey, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._189eidpf{border-width:0}
|
|
3
|
+
._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
|
|
4
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
|
|
5
|
+
._1bsb1osq{width:100%}
|
|
6
|
+
._1e0c1txw{display:flex}
|
|
7
|
+
._1tke1ylp{min-height:40px}
|
|
8
|
+
._4cvr1h6o{align-items:center}
|
|
9
|
+
._80omtlke{cursor:pointer}
|
|
10
|
+
._bfhk1j28{background-color:transparent}
|
|
11
|
+
._syaz13af{color:var(--ds-link,#1868db)}
|
|
12
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
13
|
+
._vchhusvi{box-sizing:border-box}
|
|
14
|
+
._y3gn1e5h{text-align:left}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* AgentMentionLoadErrorItem.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
+
import "./AgentMentionLoadErrorItem.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
import { useIntl } from 'react-intl';
|
|
7
|
+
import { mentionMessages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import StatusErrorIcon from '@atlaskit/icon/core/status-error';
|
|
9
|
+
import { Inline, Text } from '@atlaskit/primitives/compiled';
|
|
10
|
+
const styles = {
|
|
11
|
+
retryRow: "_11c8fhey _189eidpf _1rjcu2gc _18zrutpp _4cvr1h6o _bfhk1j28 _vchhusvi _syazazsu _80omtlke _1e0c1txw _1tke1ylp _y3gn1e5h _1bsb1osq",
|
|
12
|
+
retryText: "_11c8fhey _syaz13af"
|
|
13
|
+
};
|
|
14
|
+
export const AgentMentionLoadErrorItem = ({
|
|
15
|
+
onRetry
|
|
16
|
+
}) => {
|
|
17
|
+
const intl = useIntl();
|
|
18
|
+
const handleMouseDown = useCallback(event => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
}, []);
|
|
21
|
+
const handleClick = useCallback(event => {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
onRetry();
|
|
24
|
+
}, [onRetry]);
|
|
25
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
26
|
+
type: "button",
|
|
27
|
+
tabIndex: -1,
|
|
28
|
+
onMouseDown: handleMouseDown,
|
|
29
|
+
onClick: handleClick,
|
|
30
|
+
"data-testid": "agent-mention-load-error-item",
|
|
31
|
+
className: ax([styles.retryRow])
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
33
|
+
alignBlock: "center",
|
|
34
|
+
space: "space.100"
|
|
35
|
+
}, /*#__PURE__*/React.createElement(StatusErrorIcon, {
|
|
36
|
+
label: "",
|
|
37
|
+
color: "var(--ds-icon-danger, #C9372C)"
|
|
38
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
39
|
+
as: "span",
|
|
40
|
+
color: "color.text.subtle"
|
|
41
|
+
}, intl.formatMessage(mentionMessages.typeAheadSectionAgentsLoadError)), /*#__PURE__*/React.createElement("span", {
|
|
42
|
+
className: ax([styles.retryText])
|
|
43
|
+
}, intl.formatMessage(mentionMessages.typeAheadSectionAgentsRetry))));
|
|
44
|
+
};
|
|
@@ -20,9 +20,11 @@ import { getMentionPluginState } from '../../pm-plugins/utils';
|
|
|
20
20
|
import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
21
21
|
import InviteItemWithEmailDomain from '../InviteItem/InviteItemWithEmailDomain';
|
|
22
22
|
import { buildTypeAheadCancelPayload, buildTypeAheadInsertedPayload, buildTypeAheadInviteItemClickedPayload, buildTypeAheadInviteItemViewedPayload, buildTypeAheadRenderedPayload } from './analytics';
|
|
23
|
+
import { AgentMentionLoadErrorItem } from './AgentMentionLoadErrorItem';
|
|
23
24
|
import { MentionItemWithProfileCard } from './MentionItemWithProfileCard';
|
|
24
|
-
import { isAgentMention, isBotOrTeamMention, isExplicitAgentMention, isInviteItem, isTeamStats, isTeamType, orderMentionsForDisplay, shouldKeepInviteItem } from './utils';
|
|
25
|
+
import { isAgentMention, isAgentMentionLoadError, isBotOrTeamMention, isExplicitAgentMention, isInviteItem, isTeamStats, isTeamType, orderMentionsForDisplay, shouldKeepInviteItem } from './utils';
|
|
25
26
|
const isAgentTypeAheadItem = item => item.mention ? isAgentMention(item.mention) : false;
|
|
27
|
+
const isAgentMentionLoadErrorEnabled = mention => isExperimentEnabled('platform_editor_agent_mentions_rovo_query_timeout') && isAgentMentionLoadError(mention);
|
|
26
28
|
const isSearchOrderedAgentTypeAheadItem = item => !!item.mention && isExplicitAgentMention(item.mention);
|
|
27
29
|
const isSearchOrderedPersonTypeAheadItem = item => !!item.mention && !isInviteItem(item.mention) && !isExplicitAgentMention(item.mention) && !isBotOrTeamMention(item.mention);
|
|
28
30
|
const shouldApplyMentionSearchOrder = query => isExperimentEnabled('platform_editor_mention_search_order') && query.trim().length > 0;
|
|
@@ -31,7 +33,8 @@ const shouldApplyMentionSearchOrder = query => isExperimentEnabled('platform_edi
|
|
|
31
33
|
// `RovoChatMentionResource`) while the slower agent source resolves. It
|
|
32
34
|
// renders as a skeleton row via `@atlaskit/mention`'s `MentionItem` and
|
|
33
35
|
// must never be inserted or counted in rendered-mention analytics.
|
|
34
|
-
const
|
|
36
|
+
const isMentionPlaceholder = mention => !!(mention !== null && mention !== void 0 && mention.isPlaceholder);
|
|
37
|
+
const isLoadingPlaceholder = mention => isMentionPlaceholder(mention) && !isAgentMentionLoadErrorEnabled(mention);
|
|
35
38
|
const createInviteItem = ({
|
|
36
39
|
mentionProvider,
|
|
37
40
|
onInviteItemMount,
|
|
@@ -91,6 +94,20 @@ const makeMentionToTypeaheadItem = ({
|
|
|
91
94
|
profilecardProvider
|
|
92
95
|
}) => mention => {
|
|
93
96
|
const itemHeight = useRefreshedItemHeight ? MENTION_ITEM_HEIGHT_REFRESHED : MENTION_ITEM_HEIGHT;
|
|
97
|
+
if (isAgentMentionLoadErrorEnabled(mention)) {
|
|
98
|
+
return {
|
|
99
|
+
title: mention.id,
|
|
100
|
+
render: ({
|
|
101
|
+
onClick
|
|
102
|
+
}) => /*#__PURE__*/React.createElement(AgentMentionLoadErrorItem, {
|
|
103
|
+
onRetry: onClick
|
|
104
|
+
}),
|
|
105
|
+
getCustomComponentHeight: () => {
|
|
106
|
+
return itemHeight;
|
|
107
|
+
},
|
|
108
|
+
mention
|
|
109
|
+
};
|
|
110
|
+
}
|
|
94
111
|
if (isLoadingPlaceholder(mention) && isExperimentEnabled('platform_editor_mention_search_order')) {
|
|
95
112
|
return {
|
|
96
113
|
title: mention.id,
|
|
@@ -289,10 +306,9 @@ const makeTransformMentionsToTypeAheadItems = ({
|
|
|
289
306
|
}) => {
|
|
290
307
|
const displayMentions = shouldApplyMentionSearchOrder(query) ? orderMentionsForDisplay(mentions) : mentions;
|
|
291
308
|
const mentionItems = displayMentions.map(mention => toItem(mention));
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
|
|
295
|
-
const realMentions = displayMentions.filter(mention => !isLoadingPlaceholder(mention));
|
|
309
|
+
// Provider placeholders stay in `mentionItems` so loading/error rows render,
|
|
310
|
+
// but they are not real mention results for analytics or agent counts.
|
|
311
|
+
const realMentions = displayMentions.filter(mention => !isMentionPlaceholder(mention));
|
|
296
312
|
const agentCount = realMentions.filter(isAgentMention).length;
|
|
297
313
|
const agentAnalytics = {
|
|
298
314
|
agentCount,
|
|
@@ -498,6 +514,17 @@ export const createTypeAheadConfig = ({
|
|
|
498
514
|
const {
|
|
499
515
|
mentionProvider
|
|
500
516
|
} = pluginState;
|
|
517
|
+
const {
|
|
518
|
+
contextIdentifierProvider
|
|
519
|
+
} = (_api$contextIdentifie3 = api === null || api === void 0 ? void 0 : (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {};
|
|
520
|
+
const mentionContext = {
|
|
521
|
+
...contextIdentifierProvider,
|
|
522
|
+
sessionId
|
|
523
|
+
};
|
|
524
|
+
if (isAgentMentionLoadErrorEnabled(item.mention)) {
|
|
525
|
+
mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.filter(query || '', mentionContext);
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
501
528
|
const {
|
|
502
529
|
id,
|
|
503
530
|
name,
|
|
@@ -506,13 +533,6 @@ export const createTypeAheadConfig = ({
|
|
|
506
533
|
userType,
|
|
507
534
|
isXProductUser
|
|
508
535
|
} = item.mention;
|
|
509
|
-
const {
|
|
510
|
-
contextIdentifierProvider
|
|
511
|
-
} = (_api$contextIdentifie3 = api === null || api === void 0 ? void 0 : (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {};
|
|
512
|
-
const mentionContext = {
|
|
513
|
-
...contextIdentifierProvider,
|
|
514
|
-
sessionId
|
|
515
|
-
};
|
|
516
536
|
const isAgentMentionSelection = isAgentMention(item.mention);
|
|
517
537
|
const isAgentMentionInsertion = isAgentMentionSelection && expVal('platform_editor_agent_mentions', 'isEnabled', false);
|
|
518
538
|
// userType can be missing for provider-only agent mentions. Copy/paste cannot
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AGENT_MENTION_LOAD_ERROR_ID } from '@atlaskit/mention/types';
|
|
1
2
|
import { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
2
3
|
|
|
3
4
|
// Ignored via go/ees005
|
|
@@ -17,11 +18,12 @@ export const isAgentMention = mention => isAgentUserType(mention.userType) || me
|
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* True when the mention is explicitly an agent, not a generic APP/bot.
|
|
20
|
-
* Prefer this over
|
|
21
|
+
* Prefer this over `isAgentMention` when ordering the search display
|
|
21
22
|
* list behind `platform_editor_mention_search_order` — bare `userType: 'APP'`
|
|
22
23
|
* is a bot unless `appType === 'agent'`.
|
|
23
24
|
*/
|
|
24
25
|
export const isExplicitAgentMention = mention => mention.appType === 'agent' || mention.userType === 'AGENT';
|
|
26
|
+
export 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';
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Connect/app bots and teams. Explicit agents are excluded so they can be
|
|
@@ -35,7 +35,7 @@ export var ACTIONS = {
|
|
|
35
35
|
CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
|
|
36
36
|
};
|
|
37
37
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
38
|
-
var PACKAGE_VERSION = "18.3.
|
|
38
|
+
var PACKAGE_VERSION = "18.3.4";
|
|
39
39
|
var setProvider = function setProvider(provider) {
|
|
40
40
|
return function (state, dispatch) {
|
|
41
41
|
if (dispatch) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
._11c8fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._189eidpf{border-width:0}
|
|
3
|
+
._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
|
|
4
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
|
|
5
|
+
._1bsb1osq{width:100%}
|
|
6
|
+
._1e0c1txw{display:flex}
|
|
7
|
+
._1tke1ylp{min-height:40px}
|
|
8
|
+
._4cvr1h6o{align-items:center}
|
|
9
|
+
._80omtlke{cursor:pointer}
|
|
10
|
+
._bfhk1j28{background-color:transparent}
|
|
11
|
+
._syaz13af{color:var(--ds-link,#1868db)}
|
|
12
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
13
|
+
._vchhusvi{box-sizing:border-box}
|
|
14
|
+
._y3gn1e5h{text-align:left}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* AgentMentionLoadErrorItem.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
+
import "./AgentMentionLoadErrorItem.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
import { useIntl } from 'react-intl';
|
|
7
|
+
import { mentionMessages } from '@atlaskit/editor-common/messages';
|
|
8
|
+
import StatusErrorIcon from '@atlaskit/icon/core/status-error';
|
|
9
|
+
import { Inline, Text } from '@atlaskit/primitives/compiled';
|
|
10
|
+
var styles = {
|
|
11
|
+
retryRow: "_11c8fhey _189eidpf _1rjcu2gc _18zrutpp _4cvr1h6o _bfhk1j28 _vchhusvi _syazazsu _80omtlke _1e0c1txw _1tke1ylp _y3gn1e5h _1bsb1osq",
|
|
12
|
+
retryText: "_11c8fhey _syaz13af"
|
|
13
|
+
};
|
|
14
|
+
export var AgentMentionLoadErrorItem = function AgentMentionLoadErrorItem(_ref) {
|
|
15
|
+
var onRetry = _ref.onRetry;
|
|
16
|
+
var intl = useIntl();
|
|
17
|
+
var handleMouseDown = useCallback(function (event) {
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
}, []);
|
|
20
|
+
var handleClick = useCallback(function (event) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
onRetry();
|
|
23
|
+
}, [onRetry]);
|
|
24
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
tabIndex: -1,
|
|
27
|
+
onMouseDown: handleMouseDown,
|
|
28
|
+
onClick: handleClick,
|
|
29
|
+
"data-testid": "agent-mention-load-error-item",
|
|
30
|
+
className: ax([styles.retryRow])
|
|
31
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
32
|
+
alignBlock: "center",
|
|
33
|
+
space: "space.100"
|
|
34
|
+
}, /*#__PURE__*/React.createElement(StatusErrorIcon, {
|
|
35
|
+
label: "",
|
|
36
|
+
color: "var(--ds-icon-danger, #C9372C)"
|
|
37
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
38
|
+
as: "span",
|
|
39
|
+
color: "color.text.subtle"
|
|
40
|
+
}, intl.formatMessage(mentionMessages.typeAheadSectionAgentsLoadError)), /*#__PURE__*/React.createElement("span", {
|
|
41
|
+
className: ax([styles.retryText])
|
|
42
|
+
}, intl.formatMessage(mentionMessages.typeAheadSectionAgentsRetry))));
|
|
43
|
+
};
|
|
@@ -27,11 +27,15 @@ import { getMentionPluginState } from '../../pm-plugins/utils';
|
|
|
27
27
|
import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
28
28
|
import InviteItemWithEmailDomain from '../InviteItem/InviteItemWithEmailDomain';
|
|
29
29
|
import { buildTypeAheadCancelPayload, buildTypeAheadInsertedPayload, buildTypeAheadInviteItemClickedPayload, buildTypeAheadInviteItemViewedPayload, buildTypeAheadRenderedPayload } from './analytics';
|
|
30
|
+
import { AgentMentionLoadErrorItem } from './AgentMentionLoadErrorItem';
|
|
30
31
|
import { MentionItemWithProfileCard } from './MentionItemWithProfileCard';
|
|
31
|
-
import { isAgentMention, isBotOrTeamMention, isExplicitAgentMention, isInviteItem, isTeamStats, isTeamType, orderMentionsForDisplay, shouldKeepInviteItem } from './utils';
|
|
32
|
+
import { isAgentMention, isAgentMentionLoadError, isBotOrTeamMention, isExplicitAgentMention, isInviteItem, isTeamStats, isTeamType, orderMentionsForDisplay, shouldKeepInviteItem } from './utils';
|
|
32
33
|
var isAgentTypeAheadItem = function isAgentTypeAheadItem(item) {
|
|
33
34
|
return item.mention ? isAgentMention(item.mention) : false;
|
|
34
35
|
};
|
|
36
|
+
var isAgentMentionLoadErrorEnabled = function isAgentMentionLoadErrorEnabled(mention) {
|
|
37
|
+
return isExperimentEnabled('platform_editor_agent_mentions_rovo_query_timeout') && isAgentMentionLoadError(mention);
|
|
38
|
+
};
|
|
35
39
|
var isSearchOrderedAgentTypeAheadItem = function isSearchOrderedAgentTypeAheadItem(item) {
|
|
36
40
|
return !!item.mention && isExplicitAgentMention(item.mention);
|
|
37
41
|
};
|
|
@@ -46,9 +50,12 @@ var shouldApplyMentionSearchOrder = function shouldApplyMentionSearchOrder(query
|
|
|
46
50
|
// `RovoChatMentionResource`) while the slower agent source resolves. It
|
|
47
51
|
// renders as a skeleton row via `@atlaskit/mention`'s `MentionItem` and
|
|
48
52
|
// must never be inserted or counted in rendered-mention analytics.
|
|
49
|
-
var
|
|
53
|
+
var isMentionPlaceholder = function isMentionPlaceholder(mention) {
|
|
50
54
|
return !!(mention !== null && mention !== void 0 && mention.isPlaceholder);
|
|
51
55
|
};
|
|
56
|
+
var isLoadingPlaceholder = function isLoadingPlaceholder(mention) {
|
|
57
|
+
return isMentionPlaceholder(mention) && !isAgentMentionLoadErrorEnabled(mention);
|
|
58
|
+
};
|
|
52
59
|
var createInviteItem = function createInviteItem(_ref) {
|
|
53
60
|
var mentionProvider = _ref.mentionProvider,
|
|
54
61
|
onInviteItemMount = _ref.onInviteItemMount,
|
|
@@ -109,13 +116,28 @@ var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(_ref4) {
|
|
|
109
116
|
profilecardProvider = _ref4.profilecardProvider;
|
|
110
117
|
return function (mention) {
|
|
111
118
|
var itemHeight = useRefreshedItemHeight ? MENTION_ITEM_HEIGHT_REFRESHED : MENTION_ITEM_HEIGHT;
|
|
119
|
+
if (isAgentMentionLoadErrorEnabled(mention)) {
|
|
120
|
+
return {
|
|
121
|
+
title: mention.id,
|
|
122
|
+
render: function render(_ref5) {
|
|
123
|
+
var onClick = _ref5.onClick;
|
|
124
|
+
return /*#__PURE__*/React.createElement(AgentMentionLoadErrorItem, {
|
|
125
|
+
onRetry: onClick
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
getCustomComponentHeight: function getCustomComponentHeight() {
|
|
129
|
+
return itemHeight;
|
|
130
|
+
},
|
|
131
|
+
mention: mention
|
|
132
|
+
};
|
|
133
|
+
}
|
|
112
134
|
if (isLoadingPlaceholder(mention) && isExperimentEnabled('platform_editor_mention_search_order')) {
|
|
113
135
|
return {
|
|
114
136
|
title: mention.id,
|
|
115
137
|
isNonInteractive: true,
|
|
116
|
-
render: function render(
|
|
117
|
-
var isSelected =
|
|
118
|
-
onClick =
|
|
138
|
+
render: function render(_ref6) {
|
|
139
|
+
var isSelected = _ref6.isSelected,
|
|
140
|
+
onClick = _ref6.onClick;
|
|
119
141
|
return /*#__PURE__*/React.createElement(MentionItemWithProfileCard, {
|
|
120
142
|
mention: mention,
|
|
121
143
|
selected: isSelected,
|
|
@@ -132,10 +154,10 @@ var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(_ref4) {
|
|
|
132
154
|
}
|
|
133
155
|
return {
|
|
134
156
|
title: mention.id,
|
|
135
|
-
render: function render(
|
|
136
|
-
var isSelected =
|
|
137
|
-
onClick =
|
|
138
|
-
onHover =
|
|
157
|
+
render: function render(_ref7) {
|
|
158
|
+
var isSelected = _ref7.isSelected,
|
|
159
|
+
onClick = _ref7.onClick,
|
|
160
|
+
onHover = _ref7.onHover;
|
|
139
161
|
return expVal('platform_editor_agent_mentions', 'isEnabled', false) && fg('platform_editor_mention_typeahead_profilecard') ? /*#__PURE__*/React.createElement(MentionItemWithProfileCard, {
|
|
140
162
|
mention: mention,
|
|
141
163
|
selected: isSelected,
|
|
@@ -189,12 +211,12 @@ export function memoize(fn
|
|
|
189
211
|
};
|
|
190
212
|
}
|
|
191
213
|
var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAheadAnalytics(fireEvent) {
|
|
192
|
-
return function (
|
|
193
|
-
var query =
|
|
194
|
-
mentions =
|
|
195
|
-
stats =
|
|
196
|
-
mentionTypeaheadSessionId =
|
|
197
|
-
agentAnalytics =
|
|
214
|
+
return function (_ref8) {
|
|
215
|
+
var query = _ref8.query,
|
|
216
|
+
mentions = _ref8.mentions,
|
|
217
|
+
stats = _ref8.stats,
|
|
218
|
+
mentionTypeaheadSessionId = _ref8.mentionTypeaheadSessionId,
|
|
219
|
+
agentAnalytics = _ref8.agentAnalytics;
|
|
198
220
|
var duration = 0;
|
|
199
221
|
var userOrTeamIds = null;
|
|
200
222
|
var teams = null;
|
|
@@ -296,30 +318,29 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
296
318
|
* `createTypeAheadConfig` and intentionally mutated here as a
|
|
297
319
|
* side-effect — preserves the existing single-shot semantics.
|
|
298
320
|
*/
|
|
299
|
-
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(
|
|
300
|
-
var fireEvent =
|
|
301
|
-
getFirstQueryWithoutResults =
|
|
302
|
-
setFirstQueryWithoutResults =
|
|
303
|
-
hasFiredInviteItemViewed =
|
|
304
|
-
markInviteItemViewed =
|
|
305
|
-
toItem =
|
|
306
|
-
enableAgentSectioning =
|
|
307
|
-
return function (
|
|
308
|
-
var mentions =
|
|
309
|
-
query =
|
|
310
|
-
stats =
|
|
311
|
-
mentionProvider =
|
|
312
|
-
contextIdentifierProvider =
|
|
313
|
-
sessionId =
|
|
321
|
+
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(_ref9) {
|
|
322
|
+
var fireEvent = _ref9.fireEvent,
|
|
323
|
+
getFirstQueryWithoutResults = _ref9.getFirstQueryWithoutResults,
|
|
324
|
+
setFirstQueryWithoutResults = _ref9.setFirstQueryWithoutResults,
|
|
325
|
+
hasFiredInviteItemViewed = _ref9.hasFiredInviteItemViewed,
|
|
326
|
+
markInviteItemViewed = _ref9.markInviteItemViewed,
|
|
327
|
+
toItem = _ref9.toItem,
|
|
328
|
+
enableAgentSectioning = _ref9.enableAgentSectioning;
|
|
329
|
+
return function (_ref0) {
|
|
330
|
+
var mentions = _ref0.mentions,
|
|
331
|
+
query = _ref0.query,
|
|
332
|
+
stats = _ref0.stats,
|
|
333
|
+
mentionProvider = _ref0.mentionProvider,
|
|
334
|
+
contextIdentifierProvider = _ref0.contextIdentifierProvider,
|
|
335
|
+
sessionId = _ref0.sessionId;
|
|
314
336
|
var displayMentions = shouldApplyMentionSearchOrder(query) ? orderMentionsForDisplay(mentions) : mentions;
|
|
315
337
|
var mentionItems = displayMentions.map(function (mention) {
|
|
316
338
|
return toItem(mention);
|
|
317
339
|
});
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
// and no-results bookkeeping so it isn't counted as a real result.
|
|
340
|
+
// Provider placeholders stay in `mentionItems` so loading/error rows render,
|
|
341
|
+
// but they are not real mention results for analytics or agent counts.
|
|
321
342
|
var realMentions = displayMentions.filter(function (mention) {
|
|
322
|
-
return !
|
|
343
|
+
return !isMentionPlaceholder(mention);
|
|
323
344
|
});
|
|
324
345
|
var agentCount = realMentions.filter(isAgentMention).length;
|
|
325
346
|
var agentAnalytics = {
|
|
@@ -364,18 +385,18 @@ var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToType
|
|
|
364
385
|
})(mentionItems);
|
|
365
386
|
};
|
|
366
387
|
};
|
|
367
|
-
export var createTypeAheadConfig = function createTypeAheadConfig(
|
|
368
|
-
var sanitizePrivateContent =
|
|
369
|
-
mentionInsertDisplayName =
|
|
370
|
-
fireEvent =
|
|
371
|
-
HighlightComponent =
|
|
372
|
-
api =
|
|
373
|
-
handleMentionsChanged =
|
|
374
|
-
|
|
375
|
-
enableAgentSectioning =
|
|
376
|
-
|
|
377
|
-
showAgentMentionsLabsLozenge =
|
|
378
|
-
profilecardProvider =
|
|
388
|
+
export var createTypeAheadConfig = function createTypeAheadConfig(_ref1) {
|
|
389
|
+
var sanitizePrivateContent = _ref1.sanitizePrivateContent,
|
|
390
|
+
mentionInsertDisplayName = _ref1.mentionInsertDisplayName,
|
|
391
|
+
fireEvent = _ref1.fireEvent,
|
|
392
|
+
HighlightComponent = _ref1.HighlightComponent,
|
|
393
|
+
api = _ref1.api,
|
|
394
|
+
handleMentionsChanged = _ref1.handleMentionsChanged,
|
|
395
|
+
_ref1$enableAgentSect = _ref1.enableAgentSectioning,
|
|
396
|
+
enableAgentSectioning = _ref1$enableAgentSect === void 0 ? false : _ref1$enableAgentSect,
|
|
397
|
+
_ref1$showAgentMentio = _ref1.showAgentMentionsLabsLozenge,
|
|
398
|
+
showAgentMentionsLabsLozenge = _ref1$showAgentMentio === void 0 ? false : _ref1$showAgentMentio,
|
|
399
|
+
profilecardProvider = _ref1.profilecardProvider;
|
|
379
400
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
380
401
|
var sessionId = uuid();
|
|
381
402
|
var firstQueryWithoutResults = null;
|
|
@@ -415,18 +436,18 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
|
415
436
|
}
|
|
416
437
|
return null;
|
|
417
438
|
},
|
|
418
|
-
getItems: function getItems(
|
|
439
|
+
getItems: function getItems(_ref10) {
|
|
419
440
|
var _api$contextIdentifie, _api$contextIdentifie2;
|
|
420
|
-
var query =
|
|
421
|
-
editorState =
|
|
441
|
+
var query = _ref10.query,
|
|
442
|
+
editorState = _ref10.editorState;
|
|
422
443
|
lastTypeAheadQuery = query || '';
|
|
423
444
|
var pluginState = getMentionPluginState(editorState);
|
|
424
445
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
425
446
|
return Promise.resolve([]);
|
|
426
447
|
}
|
|
427
448
|
var mentionProvider = pluginState.mentionProvider;
|
|
428
|
-
var
|
|
429
|
-
contextIdentifierProvider =
|
|
449
|
+
var _ref11 = (_api$contextIdentifie = api === null || api === void 0 || (_api$contextIdentifie2 = api.contextIdentifier) === null || _api$contextIdentifie2 === void 0 ? void 0 : _api$contextIdentifie2.sharedState.currentState()) !== null && _api$contextIdentifie !== void 0 ? _api$contextIdentifie : {},
|
|
450
|
+
contextIdentifierProvider = _ref11.contextIdentifierProvider;
|
|
430
451
|
return new Promise(function (resolve, reject) {
|
|
431
452
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
432
453
|
var key = "loadingMentionsForTypeAhead_".concat(uuid());
|
|
@@ -461,8 +482,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
|
461
482
|
}));
|
|
462
483
|
});
|
|
463
484
|
},
|
|
464
|
-
getSections: function getSections(
|
|
465
|
-
var intl =
|
|
485
|
+
getSections: function getSections(_ref12) {
|
|
486
|
+
var intl = _ref12.intl;
|
|
466
487
|
if (!enableAgentSectioning) {
|
|
467
488
|
return [];
|
|
468
489
|
}
|
|
@@ -507,12 +528,12 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
|
507
528
|
lastTypeAheadQuery = '';
|
|
508
529
|
_hasFiredInviteItemViewed = false;
|
|
509
530
|
},
|
|
510
|
-
selectItem: function selectItem(state, item, insert,
|
|
531
|
+
selectItem: function selectItem(state, item, insert, _ref13) {
|
|
511
532
|
var _api$contextIdentifie3, _api$contextIdentifie4;
|
|
512
|
-
var mode =
|
|
513
|
-
stats =
|
|
514
|
-
query =
|
|
515
|
-
sourceListItem =
|
|
533
|
+
var mode = _ref13.mode,
|
|
534
|
+
stats = _ref13.stats,
|
|
535
|
+
query = _ref13.query,
|
|
536
|
+
sourceListItem = _ref13.sourceListItem;
|
|
516
537
|
var schema = state.schema;
|
|
517
538
|
|
|
518
539
|
// Placeholder isn't selectable. Return `false` (not a transaction) so
|
|
@@ -522,6 +543,15 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
|
522
543
|
}
|
|
523
544
|
var pluginState = getMentionPluginState(state);
|
|
524
545
|
var mentionProvider = pluginState.mentionProvider;
|
|
546
|
+
var _ref14 = (_api$contextIdentifie3 = api === null || api === void 0 || (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {},
|
|
547
|
+
contextIdentifierProvider = _ref14.contextIdentifierProvider;
|
|
548
|
+
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
549
|
+
sessionId: sessionId
|
|
550
|
+
});
|
|
551
|
+
if (isAgentMentionLoadErrorEnabled(item.mention)) {
|
|
552
|
+
mentionProvider === null || mentionProvider === void 0 || mentionProvider.filter(query || '', mentionContext);
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
525
555
|
var _item$mention = item.mention,
|
|
526
556
|
id = _item$mention.id,
|
|
527
557
|
name = _item$mention.name,
|
|
@@ -529,11 +559,6 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
|
529
559
|
accessLevel = _item$mention.accessLevel,
|
|
530
560
|
userType = _item$mention.userType,
|
|
531
561
|
isXProductUser = _item$mention.isXProductUser;
|
|
532
|
-
var _ref13 = (_api$contextIdentifie3 = api === null || api === void 0 || (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {},
|
|
533
|
-
contextIdentifierProvider = _ref13.contextIdentifierProvider;
|
|
534
|
-
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
535
|
-
sessionId: sessionId
|
|
536
|
-
});
|
|
537
562
|
var isAgentMentionSelection = isAgentMention(item.mention);
|
|
538
563
|
var isAgentMentionInsertion = isAgentMentionSelection && expVal('platform_editor_agent_mentions', 'isEnabled', false);
|
|
539
564
|
// userType can be missing for provider-only agent mentions. Copy/paste cannot
|
|
@@ -657,11 +682,11 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
|
657
682
|
}
|
|
658
683
|
return tr;
|
|
659
684
|
},
|
|
660
|
-
dismiss: function dismiss(
|
|
661
|
-
var editorState =
|
|
662
|
-
query =
|
|
663
|
-
stats =
|
|
664
|
-
wasItemInserted =
|
|
685
|
+
dismiss: function dismiss(_ref15) {
|
|
686
|
+
var editorState = _ref15.editorState,
|
|
687
|
+
query = _ref15.query,
|
|
688
|
+
stats = _ref15.stats,
|
|
689
|
+
wasItemInserted = _ref15.wasItemInserted;
|
|
665
690
|
firstQueryWithoutResults = null;
|
|
666
691
|
_hasFiredInviteItemViewed = false;
|
|
667
692
|
var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
|
|
@@ -706,10 +731,10 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
|
706
731
|
* so we only attach it when the gate is on — otherwise the proven
|
|
707
732
|
* single-shot `getItems` path continues to drive every consumer.
|
|
708
733
|
*/
|
|
709
|
-
var subscribeToItemsUpdates = function subscribeToItemsUpdates(
|
|
734
|
+
var subscribeToItemsUpdates = function subscribeToItemsUpdates(_ref16) {
|
|
710
735
|
var _api$contextIdentifie5, _api$contextIdentifie6;
|
|
711
|
-
var query =
|
|
712
|
-
editorState =
|
|
736
|
+
var query = _ref16.query,
|
|
737
|
+
editorState = _ref16.editorState;
|
|
713
738
|
lastTypeAheadQuery = query || '';
|
|
714
739
|
var pluginState = getMentionPluginState(editorState);
|
|
715
740
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
@@ -721,8 +746,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
|
721
746
|
};
|
|
722
747
|
}
|
|
723
748
|
var mentionProvider = pluginState.mentionProvider;
|
|
724
|
-
var
|
|
725
|
-
contextIdentifierProvider =
|
|
749
|
+
var _ref17 = (_api$contextIdentifie5 = api === null || api === void 0 || (_api$contextIdentifie6 = api.contextIdentifier) === null || _api$contextIdentifie6 === void 0 ? void 0 : _api$contextIdentifie6.sharedState.currentState()) !== null && _api$contextIdentifie5 !== void 0 ? _api$contextIdentifie5 : {},
|
|
750
|
+
contextIdentifierProvider = _ref17.contextIdentifierProvider;
|
|
726
751
|
|
|
727
752
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
728
753
|
var key = "loadingMentionsForTypeAhead_".concat(uuid());
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
3
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
|
+
import { AGENT_MENTION_LOAD_ERROR_ID } from '@atlaskit/mention/types';
|
|
4
5
|
import { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
5
6
|
|
|
6
7
|
// Ignored via go/ees005
|
|
@@ -30,13 +31,16 @@ export var isAgentMention = function isAgentMention(mention) {
|
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* True when the mention is explicitly an agent, not a generic APP/bot.
|
|
33
|
-
* Prefer this over
|
|
34
|
+
* Prefer this over `isAgentMention` when ordering the search display
|
|
34
35
|
* list behind `platform_editor_mention_search_order` — bare `userType: 'APP'`
|
|
35
36
|
* is a bot unless `appType === 'agent'`.
|
|
36
37
|
*/
|
|
37
38
|
export var isExplicitAgentMention = function isExplicitAgentMention(mention) {
|
|
38
39
|
return mention.appType === 'agent' || mention.userType === 'AGENT';
|
|
39
40
|
};
|
|
41
|
+
export var isAgentMentionLoadError = function isAgentMentionLoadError(mention) {
|
|
42
|
+
return (mention === null || mention === void 0 ? void 0 : mention.id) === AGENT_MENTION_LOAD_ERROR_ID && mention.isPlaceholder === true && mention.placeholderType === 'error' && mention.appType === 'agent';
|
|
43
|
+
};
|
|
40
44
|
|
|
41
45
|
/**
|
|
42
46
|
* Connect/app bots and teams. Explicit agents are excluded so they can be
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type MentionDescription } from '@atlaskit/mention/types';
|
|
2
2
|
export declare const isTeamType: (userType: any) => boolean;
|
|
3
3
|
export declare const isTeamStats: (stat: any) => boolean;
|
|
4
4
|
export declare const isInviteItem: (mention: MentionDescription) => boolean;
|
|
@@ -6,11 +6,14 @@ export declare const isAgentUserType: (userType: string | undefined) => boolean;
|
|
|
6
6
|
export declare const isAgentMention: (mention: Pick<MentionDescription, 'appType' | 'userType'>) => boolean;
|
|
7
7
|
/**
|
|
8
8
|
* True when the mention is explicitly an agent, not a generic APP/bot.
|
|
9
|
-
* Prefer this over
|
|
9
|
+
* Prefer this over `isAgentMention` when ordering the search display
|
|
10
10
|
* list behind `platform_editor_mention_search_order` — bare `userType: 'APP'`
|
|
11
11
|
* is a bot unless `appType === 'agent'`.
|
|
12
12
|
*/
|
|
13
13
|
export declare const isExplicitAgentMention: (mention: Pick<MentionDescription, 'appType' | 'userType'>) => boolean;
|
|
14
|
+
export declare const isAgentMentionLoadError: (mention: (Partial<Pick<MentionDescription, 'appType' | 'id' | 'isPlaceholder' | 'userType'>> & {
|
|
15
|
+
placeholderType?: string;
|
|
16
|
+
}) | undefined) => boolean;
|
|
14
17
|
/**
|
|
15
18
|
* Connect/app bots and teams. Explicit agents are excluded so they can be
|
|
16
19
|
* lifted above this group in the hardcoded display order.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "18.3.
|
|
3
|
+
"version": "18.3.5",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"@atlaskit/editor-plugin-base": "^17.1.0",
|
|
29
29
|
"@atlaskit/editor-plugin-context-identifier": "^16.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-selection": "^16.1.0",
|
|
31
|
-
"@atlaskit/editor-plugin-type-ahead": "^17.
|
|
31
|
+
"@atlaskit/editor-plugin-type-ahead": "^17.2.0",
|
|
32
32
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
33
33
|
"@atlaskit/feature-gate-js-client": "^6.0.0",
|
|
34
34
|
"@atlaskit/icon": "^37.6.0",
|
|
35
35
|
"@atlaskit/insm": "^3.0.0",
|
|
36
36
|
"@atlaskit/link": "^5.1.0",
|
|
37
37
|
"@atlaskit/lozenge": "^15.4.0",
|
|
38
|
-
"@atlaskit/mention": "^
|
|
38
|
+
"@atlaskit/mention": "^28.0.0",
|
|
39
39
|
"@atlaskit/node-data-provider": "^17.0.0",
|
|
40
40
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/section-message": "^10.2.0",
|
|
48
48
|
"@atlaskit/teams-app-config": "^3.1.0",
|
|
49
49
|
"@atlaskit/theme": "^28.2.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^177.0.0",
|
|
51
51
|
"@atlaskit/tokens": "^16.11.0",
|
|
52
52
|
"@atlaskit/tooltip": "^24.3.0",
|
|
53
53
|
"@atlaskit/user-picker": "^13.12.0",
|