@atlaskit/mention 27.17.1 → 27.18.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 +34 -0
- package/dist/cjs/api/AbstractMentionResource.js +111 -0
- package/dist/cjs/api/AbstractPresenceResource.js +41 -0
- package/dist/cjs/api/AbstractResource.js +48 -0
- package/dist/cjs/api/Callback.js +5 -0
- package/dist/cjs/api/DefaultMentionNameResolver.js +178 -0
- package/dist/cjs/api/DefaultPresenceCache.js +159 -0
- package/dist/cjs/api/DefaultPresenceParser.js +91 -0
- package/dist/cjs/api/HttpError.js +16 -0
- package/dist/cjs/api/MentionNameResolver.js +13 -201
- package/dist/cjs/api/MentionResource.js +52 -157
- package/dist/cjs/api/PresenceResource.js +39 -263
- package/dist/cjs/api/Queue.js +5 -0
- package/dist/cjs/api/isResolvingMentionProvider.js +9 -0
- package/dist/cjs/api/mergeNameResolverQueues.js +36 -0
- package/dist/cjs/components/Mention/MentionInternal.js +247 -0
- package/dist/cjs/components/Mention/ResourcedMention.js +5 -4
- package/dist/cjs/components/Mention/index.js +29 -243
- package/dist/cjs/components/MentionAvatar/index.js +5 -4
- package/dist/cjs/components/MentionItem/index.js +18 -12
- package/dist/cjs/components/MentionList/index.js +4 -3
- package/dist/cjs/components/MentionPicker/MentionPicker.js +231 -0
- package/dist/cjs/components/MentionPicker/index.js +18 -225
- package/dist/cjs/components/MessagesIntlProvider/index.js +2 -2
- package/dist/cjs/components/ResourcedMentionList/ResourcedMentionListWithoutAnalytics.js +228 -0
- package/dist/cjs/components/ResourcedMentionList/index.js +14 -223
- package/dist/cjs/index.js +17 -15
- package/dist/cjs/is-agent-mention.js +12 -0
- package/dist/cjs/is-app-mention.js +10 -0
- package/dist/cjs/is-promise.js +9 -0
- package/dist/cjs/is-restricted.js +10 -0
- package/dist/cjs/is-special-mention-text.js +9 -0
- package/dist/cjs/is-special-mention.js +10 -0
- package/dist/cjs/is-team-mention.js +10 -0
- package/dist/cjs/resource.js +15 -12
- package/dist/cjs/team-resource.js +9 -9
- package/dist/cjs/typeahead.js +4 -0
- package/dist/cjs/types.js +71 -30
- package/dist/cjs/util/actual-mouse-move.js +14 -0
- package/dist/cjs/util/analytics.js +91 -107
- package/dist/cjs/util/build-sli-payload.js +27 -0
- package/dist/cjs/util/fire-analytics-mention-event.js +32 -0
- package/dist/cjs/util/fire-analytics-mention-hydration-event.js +33 -0
- package/dist/cjs/util/fire-analytics-mention-typeahead-event.js +34 -0
- package/dist/cjs/util/fire-analytics.js +18 -0
- package/dist/cjs/util/fire-sli-analytics-event.js +16 -0
- package/dist/cjs/util/get-messages-for-locale.js +233 -0
- package/dist/cjs/util/i18n.js +9 -254
- package/dist/cjs/util/left-click.js +9 -0
- package/dist/cjs/util/mouse-location.js +12 -0
- package/dist/cjs/util/mouse.js +1 -26
- package/dist/cjs/util/package-name.js +7 -0
- package/dist/cjs/util/package-version.js +7 -0
- package/dist/cjs/util/prop-formatter.js +25 -0
- package/dist/es2019/api/AbstractMentionResource.js +73 -0
- package/dist/es2019/api/AbstractPresenceResource.js +17 -0
- package/dist/es2019/api/AbstractResource.js +33 -0
- package/dist/es2019/api/Callback.js +1 -0
- package/dist/es2019/api/DefaultMentionNameResolver.js +152 -0
- package/dist/es2019/api/DefaultPresenceCache.js +111 -0
- package/dist/es2019/api/DefaultPresenceParser.js +58 -0
- package/dist/es2019/api/HttpError.js +8 -0
- package/dist/es2019/api/MentionNameResolver.js +13 -176
- package/dist/es2019/api/MentionResource.js +28 -122
- package/dist/es2019/api/PresenceResource.js +19 -185
- package/dist/es2019/api/Queue.js +1 -0
- package/dist/es2019/api/isResolvingMentionProvider.js +1 -0
- package/dist/es2019/api/mergeNameResolverQueues.js +25 -0
- package/dist/es2019/components/Mention/MentionInternal.js +225 -0
- package/dist/es2019/components/Mention/ResourcedMention.js +4 -3
- package/dist/es2019/components/Mention/index.js +19 -223
- package/dist/es2019/components/MentionAvatar/index.js +3 -2
- package/dist/es2019/components/MentionItem/index.js +14 -8
- package/dist/es2019/components/MentionList/index.js +2 -1
- package/dist/es2019/components/MentionPicker/MentionPicker.js +198 -0
- package/dist/es2019/components/MentionPicker/index.js +15 -198
- package/dist/es2019/components/MessagesIntlProvider/index.js +1 -1
- package/dist/es2019/components/ResourcedMentionList/ResourcedMentionListWithoutAnalytics.js +187 -0
- package/dist/es2019/components/ResourcedMentionList/index.js +9 -187
- package/dist/es2019/element.js +5 -0
- package/dist/es2019/index.js +13 -9
- package/dist/es2019/is-agent-mention.js +6 -0
- package/dist/es2019/is-app-mention.js +4 -0
- package/dist/es2019/is-promise.js +1 -0
- package/dist/es2019/is-restricted.js +4 -0
- package/dist/es2019/is-special-mention-text.js +3 -0
- package/dist/es2019/is-special-mention.js +4 -0
- package/dist/es2019/is-team-mention.js +4 -0
- package/dist/es2019/item.js +5 -0
- package/dist/es2019/resource.js +15 -5
- package/dist/es2019/team-resource.js +10 -4
- package/dist/es2019/typeahead.js +5 -0
- package/dist/es2019/types.js +30 -21
- package/dist/es2019/util/actual-mouse-move.js +8 -0
- package/dist/es2019/util/analytics.js +35 -91
- package/dist/es2019/util/build-sli-payload.js +18 -0
- package/dist/es2019/util/fire-analytics-mention-event.js +24 -0
- package/dist/es2019/util/fire-analytics-mention-hydration-event.js +25 -0
- package/dist/es2019/util/fire-analytics-mention-typeahead-event.js +24 -0
- package/dist/es2019/util/fire-analytics.js +10 -0
- package/dist/es2019/util/fire-sli-analytics-event.js +8 -0
- package/dist/es2019/util/get-messages-for-locale.js +145 -0
- package/dist/es2019/util/i18n.js +2 -165
- package/dist/es2019/util/left-click.js +3 -0
- package/dist/es2019/util/mouse-location.js +6 -0
- package/dist/es2019/util/mouse.js +0 -18
- package/dist/es2019/util/package-name.js +1 -0
- package/dist/es2019/util/package-version.js +1 -0
- package/dist/es2019/util/prop-formatter.js +18 -0
- package/dist/esm/api/AbstractMentionResource.js +104 -0
- package/dist/esm/api/AbstractPresenceResource.js +34 -0
- package/dist/esm/api/AbstractResource.js +41 -0
- package/dist/esm/api/Callback.js +1 -0
- package/dist/esm/api/DefaultMentionNameResolver.js +171 -0
- package/dist/esm/api/DefaultPresenceCache.js +152 -0
- package/dist/esm/api/DefaultPresenceParser.js +84 -0
- package/dist/esm/api/HttpError.js +9 -0
- package/dist/esm/api/MentionNameResolver.js +13 -198
- package/dist/esm/api/MentionResource.js +30 -154
- package/dist/esm/api/PresenceResource.js +22 -256
- package/dist/esm/api/Queue.js +1 -0
- package/dist/esm/api/isResolvingMentionProvider.js +3 -0
- package/dist/esm/api/mergeNameResolverQueues.js +29 -0
- package/dist/esm/components/Mention/MentionInternal.js +242 -0
- package/dist/esm/components/Mention/ResourcedMention.js +4 -3
- package/dist/esm/components/Mention/index.js +19 -240
- package/dist/esm/components/MentionAvatar/index.js +3 -2
- package/dist/esm/components/MentionItem/index.js +14 -8
- package/dist/esm/components/MentionList/index.js +2 -1
- package/dist/esm/components/MentionPicker/MentionPicker.js +225 -0
- package/dist/esm/components/MentionPicker/index.js +15 -225
- package/dist/esm/components/MessagesIntlProvider/index.js +1 -1
- package/dist/esm/components/ResourcedMentionList/ResourcedMentionListWithoutAnalytics.js +221 -0
- package/dist/esm/components/ResourcedMentionList/index.js +9 -221
- package/dist/esm/element.js +5 -0
- package/dist/esm/index.js +13 -9
- package/dist/esm/is-agent-mention.js +6 -0
- package/dist/esm/is-app-mention.js +4 -0
- package/dist/esm/is-promise.js +3 -0
- package/dist/esm/is-restricted.js +4 -0
- package/dist/esm/is-special-mention-text.js +3 -0
- package/dist/esm/is-special-mention.js +4 -0
- package/dist/esm/is-team-mention.js +4 -0
- package/dist/esm/item.js +5 -0
- package/dist/esm/resource.js +15 -5
- package/dist/esm/team-resource.js +10 -4
- package/dist/esm/typeahead.js +5 -0
- package/dist/esm/types.js +30 -23
- package/dist/esm/util/actual-mouse-move.js +8 -0
- package/dist/esm/util/analytics.js +35 -105
- package/dist/esm/util/build-sli-payload.js +20 -0
- package/dist/esm/util/fire-analytics-mention-event.js +26 -0
- package/dist/esm/util/fire-analytics-mention-hydration-event.js +27 -0
- package/dist/esm/util/fire-analytics-mention-typeahead-event.js +28 -0
- package/dist/esm/util/fire-analytics.js +12 -0
- package/dist/esm/util/fire-sli-analytics-event.js +10 -0
- package/dist/esm/util/get-messages-for-locale.js +163 -0
- package/dist/esm/util/i18n.js +2 -183
- package/dist/esm/util/left-click.js +3 -0
- package/dist/esm/util/mouse-location.js +6 -0
- package/dist/esm/util/mouse.js +0 -18
- package/dist/esm/util/package-name.js +1 -0
- package/dist/esm/util/package-version.js +1 -0
- package/dist/esm/util/prop-formatter.js +18 -0
- package/dist/types/api/AbstractMentionResource.d.ts +15 -0
- package/dist/types/api/AbstractPresenceResource.d.ts +6 -0
- package/dist/types/api/AbstractResource.d.ts +11 -0
- package/dist/types/api/Callback.d.ts +4 -0
- package/dist/types/api/DefaultMentionNameResolver.d.ts +27 -0
- package/dist/types/api/DefaultPresenceCache.d.ts +57 -0
- package/dist/types/api/DefaultPresenceParser.d.ts +8 -0
- package/dist/types/api/HttpError.d.ts +7 -0
- package/dist/types/api/MentionNameResolver.d.ts +14 -35
- package/dist/types/api/MentionResource.d.ts +18 -33
- package/dist/types/api/PresenceResource.d.ts +15 -69
- package/dist/types/api/Queue.d.ts +2 -0
- package/dist/types/api/isResolvingMentionProvider.d.ts +2 -0
- package/dist/types/api/mergeNameResolverQueues.d.ts +6 -0
- package/dist/types/components/Mention/MentionInternal.d.ts +27 -0
- package/dist/types/components/Mention/ResourcedMention.d.ts +1 -1
- package/dist/types/components/Mention/index.d.ts +9 -20
- package/dist/types/components/MentionAvatar/index.d.ts +1 -1
- package/dist/types/components/MentionItem/index.d.ts +4 -1
- package/dist/types/components/MentionPicker/MentionPicker.d.ts +46 -0
- package/dist/types/components/MentionPicker/index.d.ts +5 -42
- package/dist/types/components/ResourcedMentionList/ResourcedMentionListWithoutAnalytics.d.ts +30 -0
- package/dist/types/components/ResourcedMentionList/index.d.ts +5 -27
- package/dist/types/element.d.ts +3 -0
- package/dist/types/index.d.ts +15 -10
- package/dist/types/is-agent-mention.d.ts +2 -0
- package/dist/types/is-app-mention.d.ts +2 -0
- package/dist/types/is-promise.d.ts +1 -0
- package/dist/types/is-restricted.d.ts +1 -0
- package/dist/types/is-special-mention-text.d.ts +1 -0
- package/dist/types/is-special-mention.d.ts +2 -0
- package/dist/types/is-team-mention.d.ts +2 -0
- package/dist/types/item.d.ts +3 -0
- package/dist/types/resource.d.ts +15 -6
- package/dist/types/team-resource.d.ts +10 -4
- package/dist/types/typeahead.d.ts +3 -0
- package/dist/types/types.d.ts +28 -8
- package/dist/types/util/actual-mouse-move.d.ts +2 -0
- package/dist/types/util/analytics.d.ts +33 -10
- package/dist/types/util/build-sli-payload.d.ts +4 -0
- package/dist/types/util/fire-analytics-mention-event.d.ts +1 -0
- package/dist/types/util/fire-analytics-mention-hydration-event.d.ts +1 -0
- package/dist/types/util/fire-analytics-mention-typeahead-event.d.ts +1 -0
- package/dist/types/util/fire-analytics.d.ts +1 -0
- package/dist/types/util/fire-sli-analytics-event.d.ts +1 -0
- package/dist/types/util/get-messages-for-locale.d.ts +11 -0
- package/dist/types/util/i18n.d.ts +0 -15
- package/dist/types/util/left-click.d.ts +2 -0
- package/dist/types/util/mouse-location.d.ts +3 -0
- package/dist/types/util/mouse.d.ts +0 -4
- package/dist/types/util/package-name.d.ts +1 -0
- package/dist/types/util/package-version.d.ts +1 -0
- package/dist/types/util/prop-formatter.d.ts +5 -0
- package/package.json +1 -1
- package/dist/cjs/i18n/index.js +0 -216
- package/dist/es2019/i18n/index.js +0 -37
- package/dist/esm/i18n/index.js +0 -37
- package/dist/types/i18n/index.d.ts +0 -37
- /package/dist/cjs/components/Mention/{index.compiled.css → MentionInternal.compiled.css} +0 -0
- /package/dist/es2019/components/Mention/{index.compiled.css → MentionInternal.compiled.css} +0 -0
- /package/dist/esm/components/Mention/{index.compiled.css → MentionInternal.compiled.css} +0 -0
|
@@ -1,64 +1,27 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
3
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
4
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
|
-
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; } } }; }
|
|
8
|
-
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; } }
|
|
9
|
-
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; }
|
|
10
7
|
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; }
|
|
11
8
|
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) { _defineProperty(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; }
|
|
12
9
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
13
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
12
|
+
|
|
14
13
|
import { buildAtlAttributionHeaderValue } from '../util/atl-attribution';
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
14
|
+
import { AbstractPresenceResource } from './AbstractPresenceResource';
|
|
15
|
+
import { DefaultPresenceCache } from './DefaultPresenceCache';
|
|
16
|
+
import { DefaultPresenceParser } from './DefaultPresenceParser';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Configuration for the PresenceResource, which manages real-time user
|
|
20
20
|
* presence (online/offline/busy/focus status) by querying a GraphQL-based
|
|
21
21
|
* presence service.
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_classCallCheck(this, CacheEntry);
|
|
26
|
-
this.presence = pres;
|
|
27
|
-
this.expiry = Date.now() + timeout;
|
|
28
|
-
}
|
|
29
|
-
return _createClass(CacheEntry, [{
|
|
30
|
-
key: "expired",
|
|
31
|
-
value: function expired() {
|
|
32
|
-
return Date.now() > this.expiry;
|
|
33
|
-
}
|
|
34
|
-
}]);
|
|
35
|
-
}();
|
|
36
|
-
var AbstractPresenceResource = /*#__PURE__*/function (_AbstractResource) {
|
|
37
|
-
function AbstractPresenceResource() {
|
|
38
|
-
_classCallCheck(this, AbstractPresenceResource);
|
|
39
|
-
return _callSuper(this, AbstractPresenceResource, arguments);
|
|
40
|
-
}
|
|
41
|
-
_inherits(AbstractPresenceResource, _AbstractResource);
|
|
42
|
-
return _createClass(AbstractPresenceResource, [{
|
|
43
|
-
key: "refreshPresence",
|
|
44
|
-
value: function refreshPresence(userIds) {
|
|
45
|
-
throw new Error("not yet implemented.\nParams: userIds=".concat(userIds));
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "notifyListeners",
|
|
49
|
-
value: function notifyListeners(presences) {
|
|
50
|
-
this.changeListeners.forEach(function (listener, key) {
|
|
51
|
-
try {
|
|
52
|
-
listener(presences);
|
|
53
|
-
} catch (e) {
|
|
54
|
-
// ignore error from listener
|
|
55
|
-
debug("error from listener '".concat(key, "', ignoring"), e);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}]);
|
|
60
|
-
}(AbstractResource);
|
|
61
|
-
var PresenceResource = /*#__PURE__*/function (_AbstractPresenceReso) {
|
|
23
|
+
|
|
24
|
+
export var PresenceResource = /*#__PURE__*/function (_AbstractPresenceReso) {
|
|
62
25
|
function PresenceResource(config) {
|
|
63
26
|
var _this;
|
|
64
27
|
_classCallCheck(this, PresenceResource);
|
|
@@ -137,216 +100,19 @@ var PresenceResource = /*#__PURE__*/function (_AbstractPresenceReso) {
|
|
|
137
100
|
}
|
|
138
101
|
}]);
|
|
139
102
|
}(AbstractPresenceResource);
|
|
140
|
-
export
|
|
141
|
-
function DefaultPresenceCache(cacheTimeout, cacheTrigger) {
|
|
142
|
-
_classCallCheck(this, DefaultPresenceCache);
|
|
143
|
-
this.expiryInMillis = cacheTimeout ? cacheTimeout : DefaultPresenceCache.defaultTimeout;
|
|
144
|
-
this.flushTrigger = cacheTrigger ? cacheTrigger : DefaultPresenceCache.defaultFlushTrigger;
|
|
145
|
-
this.cache = {};
|
|
146
|
-
this.size = 0;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Precondition: _delete is only called internally if userId exists in cache
|
|
151
|
-
* Removes cache entry
|
|
152
|
-
* @param userId
|
|
153
|
-
*/
|
|
154
|
-
return _createClass(DefaultPresenceCache, [{
|
|
155
|
-
key: "_delete",
|
|
156
|
-
value: function _delete(userId) {
|
|
157
|
-
delete this.cache[userId];
|
|
158
|
-
this.size--;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Checks a cache entry and calls delete if the info has expired
|
|
163
|
-
* @param userId
|
|
164
|
-
*/
|
|
165
|
-
}, {
|
|
166
|
-
key: "_deleteIfExpired",
|
|
167
|
-
value: function _deleteIfExpired(userId) {
|
|
168
|
-
if (this.contains(userId) && this.cache[userId].expired()) {
|
|
169
|
-
this._delete(userId);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Cleans expired entries from cache
|
|
175
|
-
*/
|
|
176
|
-
}, {
|
|
177
|
-
key: "_removeExpired",
|
|
178
|
-
value: function _removeExpired() {
|
|
179
|
-
var _this3 = this;
|
|
180
|
-
Object.keys(this.cache).forEach(function (id) {
|
|
181
|
-
_this3._deleteIfExpired(id);
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Checks if a user exists in the cache
|
|
187
|
-
* @param userId
|
|
188
|
-
*/
|
|
189
|
-
}, {
|
|
190
|
-
key: "contains",
|
|
191
|
-
value: function contains(userId) {
|
|
192
|
-
return this.cache.hasOwnProperty(userId);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Retrieves a presence from the cache after checking for expired entries
|
|
197
|
-
* @param userId - to index the cache
|
|
198
|
-
* @returns Presence - the presence that matches the userId
|
|
199
|
-
*/
|
|
200
|
-
}, {
|
|
201
|
-
key: "get",
|
|
202
|
-
value: function get(userId) {
|
|
203
|
-
this._deleteIfExpired(userId);
|
|
204
|
-
if (!this.contains(userId)) {
|
|
205
|
-
return {};
|
|
206
|
-
}
|
|
207
|
-
return this.cache[userId].presence;
|
|
208
|
-
}
|
|
103
|
+
export default PresenceResource;
|
|
209
104
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
*/
|
|
215
|
-
}, {
|
|
216
|
-
key: "getBulk",
|
|
217
|
-
value: function getBulk(userIds) {
|
|
218
|
-
var presences = {};
|
|
219
|
-
var _iterator = _createForOfIteratorHelper(userIds),
|
|
220
|
-
_step;
|
|
221
|
-
try {
|
|
222
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
223
|
-
var _userId = _step.value;
|
|
224
|
-
if (this.contains(_userId)) {
|
|
225
|
-
presences[_userId] = this.get(_userId);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
} catch (err) {
|
|
229
|
-
_iterator.e(err);
|
|
230
|
-
} finally {
|
|
231
|
-
_iterator.f();
|
|
232
|
-
}
|
|
233
|
-
return presences;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* For a given list of ids, returns a subset
|
|
238
|
-
* of all the ids with missing cache entries.
|
|
239
|
-
* @param userIds - to index the cache
|
|
240
|
-
* @returns string[] - ids missing from the cache
|
|
241
|
-
*/
|
|
242
|
-
}, {
|
|
243
|
-
key: "getMissingUserIds",
|
|
244
|
-
value: function getMissingUserIds(userIds) {
|
|
245
|
-
var _this4 = this;
|
|
246
|
-
return userIds.filter(function (id) {
|
|
247
|
-
return !_this4.contains(id);
|
|
248
|
-
});
|
|
249
|
-
}
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated Use `import { DefaultPresenceCache } from '@atlaskit/mention/presence-resource'` instead.
|
|
107
|
+
*/
|
|
108
|
+
export { DefaultPresenceCache } from './DefaultPresenceCache';
|
|
250
109
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
* @param presMap
|
|
256
|
-
*/
|
|
257
|
-
}, {
|
|
258
|
-
key: "update",
|
|
259
|
-
value: function update(presMap) {
|
|
260
|
-
var _this5 = this;
|
|
261
|
-
if (this.size >= this.flushTrigger) {
|
|
262
|
-
this._removeExpired();
|
|
263
|
-
}
|
|
264
|
-
Object.keys(presMap).forEach(function (userId) {
|
|
265
|
-
_this5.cache[userId] = new CacheEntry(presMap[userId], _this5.expiryInMillis);
|
|
266
|
-
_this5.size++;
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
}]);
|
|
270
|
-
}();
|
|
271
|
-
_defineProperty(DefaultPresenceCache, "defaultTimeout", 20000);
|
|
272
|
-
_defineProperty(DefaultPresenceCache, "defaultFlushTrigger", 50);
|
|
273
|
-
export var DefaultPresenceParser = /*#__PURE__*/function () {
|
|
274
|
-
function DefaultPresenceParser() {
|
|
275
|
-
_classCallCheck(this, DefaultPresenceParser);
|
|
276
|
-
}
|
|
277
|
-
return _createClass(DefaultPresenceParser, [{
|
|
278
|
-
key: "mapState",
|
|
279
|
-
value: function mapState(state) {
|
|
280
|
-
if (state === 'unavailable') {
|
|
281
|
-
return 'offline';
|
|
282
|
-
} else if (state === 'available') {
|
|
283
|
-
return 'online';
|
|
284
|
-
} else {
|
|
285
|
-
return state;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}, {
|
|
289
|
-
key: "parse",
|
|
290
|
-
value: function parse(response) {
|
|
291
|
-
var presences = {};
|
|
292
|
-
if (response.hasOwnProperty('data') && response['data'].hasOwnProperty('PresenceBulk')) {
|
|
293
|
-
var results = response['data'].PresenceBulk;
|
|
294
|
-
// Store map of state and time indexed by userId. Ignore null results.
|
|
295
|
-
var _iterator2 = _createForOfIteratorHelper(results),
|
|
296
|
-
_step2;
|
|
297
|
-
try {
|
|
298
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
299
|
-
var user = _step2.value;
|
|
300
|
-
if (user.userId && user.state) {
|
|
301
|
-
var _state = DefaultPresenceParser.extractState(user) || user.state;
|
|
302
|
-
presences[user.userId] = {
|
|
303
|
-
status: this.mapState(_state)
|
|
304
|
-
};
|
|
305
|
-
} else if (!user.hasOwnProperty('userId') || !user.hasOwnProperty('state')) {
|
|
306
|
-
// eslint-disable-next-line no-console
|
|
307
|
-
console.error('Unexpected response from presence service contains keys: ' + Object.keys(user));
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
} catch (err) {
|
|
311
|
-
_iterator2.e(err);
|
|
312
|
-
} finally {
|
|
313
|
-
_iterator2.f();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return presences;
|
|
317
|
-
}
|
|
318
|
-
}], [{
|
|
319
|
-
key: "extractState",
|
|
320
|
-
value: function extractState(presence) {
|
|
321
|
-
if (DefaultPresenceParser.isFocusState(presence)) {
|
|
322
|
-
return DefaultPresenceParser.FOCUS_STATE;
|
|
323
|
-
}
|
|
324
|
-
return presence.state;
|
|
325
|
-
}
|
|
110
|
+
/**
|
|
111
|
+
* @deprecated Use `import { DefaultPresenceParser } from '@atlaskit/mention/presence-resource'` instead.
|
|
112
|
+
*/
|
|
113
|
+
export { DefaultPresenceParser } from './DefaultPresenceParser';
|
|
326
114
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
*/
|
|
332
|
-
}, {
|
|
333
|
-
key: "isFocusState",
|
|
334
|
-
value: function isFocusState(presence) {
|
|
335
|
-
if (presence.stateMetadata) {
|
|
336
|
-
try {
|
|
337
|
-
var metadata = JSON.parse(presence.stateMetadata);
|
|
338
|
-
return metadata && !!metadata.focus;
|
|
339
|
-
} catch (e) {
|
|
340
|
-
// eslint-disable-next-line no-console
|
|
341
|
-
console.error("Failed to parse presence's stateMetadata for user with id ".concat(presence.userId, ": ").concat(presence.stateMetadata));
|
|
342
|
-
// eslint-disable-next-line no-console
|
|
343
|
-
console.error(e);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
}]);
|
|
349
|
-
}();
|
|
350
|
-
_defineProperty(DefaultPresenceParser, "FOCUS_STATE", 'focus');
|
|
351
|
-
export { AbstractPresenceResource };
|
|
352
|
-
export default PresenceResource;
|
|
115
|
+
/**
|
|
116
|
+
* @deprecated Use `import { AbstractPresenceResource } from '@atlaskit/mention/presence-resource'` instead.
|
|
117
|
+
*/
|
|
118
|
+
export { AbstractPresenceResource } from './AbstractPresenceResource';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
/**
|
|
4
|
+
* Merge the two queues making sure to merge callback arrays for items in queueB already in queueA.
|
|
5
|
+
* This addresses [this ticket](https://product-fabric.atlassian.net/browse/QS-3789).
|
|
6
|
+
*/
|
|
7
|
+
export function mergeNameResolverQueues(queueA, queueB) {
|
|
8
|
+
var queueBeingMerged = new Map(_toConsumableArray(queueA));
|
|
9
|
+
|
|
10
|
+
// now add the items from the second queue that are not already in the
|
|
11
|
+
// merged queue being built
|
|
12
|
+
_toConsumableArray(queueB).forEach(function (item) {
|
|
13
|
+
var _item = _slicedToArray(item, 2),
|
|
14
|
+
key = _item[0],
|
|
15
|
+
queueBCallbacks = _item[1];
|
|
16
|
+
var itemAlreadyInMergedQueue = queueBeingMerged.has(key);
|
|
17
|
+
if (!itemAlreadyInMergedQueue) {
|
|
18
|
+
queueBeingMerged.set(key, queueBCallbacks);
|
|
19
|
+
} else {
|
|
20
|
+
var _queueBeingMerged$get;
|
|
21
|
+
// item already in merged queue, merge the callback arrays
|
|
22
|
+
var queueACallbacks = (_queueBeingMerged$get = queueBeingMerged.get(key)) !== null && _queueBeingMerged$get !== void 0 ? _queueBeingMerged$get : [];
|
|
23
|
+
var mergedCallbacks = new Set([].concat(_toConsumableArray(queueBCallbacks), _toConsumableArray(queueACallbacks)));
|
|
24
|
+
var deduplicatedCallbacks = Array.from(mergedCallbacks.values()); // prevents calling them twice
|
|
25
|
+
queueBeingMerged.set(key, deduplicatedCallbacks);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return queueBeingMerged;
|
|
29
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/* MentionInternal.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
import "./MentionInternal.compiled.css";
|
|
10
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
11
|
+
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; }
|
|
12
|
+
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) { _defineProperty(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; }
|
|
13
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
|
+
/* eslint-disable @atlaskit/design-system/no-deprecated-imports, @typescript-eslint/ban-types -- Preserve existing mention implementation while focus-ring usage is reviewed separately. */
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import FocusRing from '@atlaskit/focus-ring';
|
|
19
|
+
import { UFOExperienceState } from '@atlaskit/ufo';
|
|
20
|
+
import { UNKNOWN_USER_ID } from '../../_constants';
|
|
21
|
+
import { isRestricted } from '../../is-restricted';
|
|
22
|
+
import { MentionType } from '../../types';
|
|
23
|
+
import { UnknownUserError } from '../../util/i18n';
|
|
24
|
+
import AsyncDisabledMentionTooltip from '../DisabledMentionTooltip';
|
|
25
|
+
import MessagesIntlProvider from '../MessagesIntlProvider';
|
|
26
|
+
import AsyncNoAccessTooltip from '../NoAccessTooltip';
|
|
27
|
+
import PrimitiveMention from './PrimitiveMention';
|
|
28
|
+
import { ANALYTICS_HOVER_DELAY } from './index';
|
|
29
|
+
import { UfoErrorBoundary, mentionRenderedUfoExperience } from './ufoExperiences';
|
|
30
|
+
var avatarStyles = null;
|
|
31
|
+
var avatarFallbackStyles = null;
|
|
32
|
+
var avatarImageStyles = null;
|
|
33
|
+
var agentAvatarStyles = null;
|
|
34
|
+
export var MentionInternal = /*#__PURE__*/function (_React$PureComponent) {
|
|
35
|
+
function MentionInternal(props) {
|
|
36
|
+
var _this;
|
|
37
|
+
_classCallCheck(this, MentionInternal);
|
|
38
|
+
_this = _callSuper(this, MentionInternal, [props]);
|
|
39
|
+
_defineProperty(_this, "state", {
|
|
40
|
+
hasAvatarError: false
|
|
41
|
+
});
|
|
42
|
+
_defineProperty(_this, "handleAvatarError", function () {
|
|
43
|
+
_this.setState({
|
|
44
|
+
hasAvatarError: true
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
_defineProperty(_this, "handleOnClick", function (e) {
|
|
48
|
+
var _this$props = _this.props,
|
|
49
|
+
id = _this$props.id,
|
|
50
|
+
text = _this$props.text,
|
|
51
|
+
onClick = _this$props.onClick,
|
|
52
|
+
isDisabled = _this$props.isDisabled;
|
|
53
|
+
if (isDisabled) {
|
|
54
|
+
// Disabled chips do not invoke their click handler.
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (onClick) {
|
|
58
|
+
onClick(id, text, e);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
_defineProperty(_this, "handleOnMouseEnter", function (e) {
|
|
62
|
+
var _this$props2 = _this.props,
|
|
63
|
+
id = _this$props2.id,
|
|
64
|
+
text = _this$props2.text,
|
|
65
|
+
onMouseEnter = _this$props2.onMouseEnter,
|
|
66
|
+
onHover = _this$props2.onHover;
|
|
67
|
+
if (onMouseEnter) {
|
|
68
|
+
onMouseEnter(id, text, e);
|
|
69
|
+
}
|
|
70
|
+
_this.hoverTimeout = window.setTimeout(function () {
|
|
71
|
+
if (onHover) {
|
|
72
|
+
onHover();
|
|
73
|
+
}
|
|
74
|
+
_this.hoverTimeout = undefined;
|
|
75
|
+
}, ANALYTICS_HOVER_DELAY);
|
|
76
|
+
});
|
|
77
|
+
_defineProperty(_this, "handleOnMouseLeave", function (e) {
|
|
78
|
+
var _this$props3 = _this.props,
|
|
79
|
+
id = _this$props3.id,
|
|
80
|
+
text = _this$props3.text,
|
|
81
|
+
onMouseLeave = _this$props3.onMouseLeave;
|
|
82
|
+
if (onMouseLeave) {
|
|
83
|
+
onMouseLeave(id, text, e);
|
|
84
|
+
}
|
|
85
|
+
if (_this.hoverTimeout) {
|
|
86
|
+
clearTimeout(_this.hoverTimeout);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
_defineProperty(_this, "getMentionType", function () {
|
|
90
|
+
var _this$props4 = _this.props,
|
|
91
|
+
accessLevel = _this$props4.accessLevel,
|
|
92
|
+
isHighlighted = _this$props4.isHighlighted,
|
|
93
|
+
isDisabled = _this$props4.isDisabled;
|
|
94
|
+
if (isDisabled) {
|
|
95
|
+
return MentionType.DISABLED;
|
|
96
|
+
}
|
|
97
|
+
if (isHighlighted) {
|
|
98
|
+
return MentionType.SELF;
|
|
99
|
+
}
|
|
100
|
+
if (isRestricted(accessLevel)) {
|
|
101
|
+
return MentionType.RESTRICTED;
|
|
102
|
+
}
|
|
103
|
+
return MentionType.DEFAULT;
|
|
104
|
+
});
|
|
105
|
+
mentionRenderedUfoExperience.getInstance(props.id).start();
|
|
106
|
+
return _this;
|
|
107
|
+
}
|
|
108
|
+
_inherits(MentionInternal, _React$PureComponent);
|
|
109
|
+
return _createClass(MentionInternal, [{
|
|
110
|
+
key: "componentDidMount",
|
|
111
|
+
value: function componentDidMount() {
|
|
112
|
+
mentionRenderedUfoExperience.getInstance(this.props.id).success();
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "componentWillUnmount",
|
|
116
|
+
value: function componentWillUnmount() {
|
|
117
|
+
if (this.hoverTimeout) {
|
|
118
|
+
clearTimeout(this.hoverTimeout);
|
|
119
|
+
}
|
|
120
|
+
var ufoInstance = mentionRenderedUfoExperience.getInstance(this.props.id);
|
|
121
|
+
if ([UFOExperienceState['STARTED'], UFOExperienceState['IN_PROGRESS']].includes(ufoInstance.state)) {
|
|
122
|
+
ufoInstance.abort();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "renderUnknownUserError",
|
|
127
|
+
value: function renderUnknownUserError(id) {
|
|
128
|
+
return /*#__PURE__*/React.createElement(UnknownUserError, {
|
|
129
|
+
values: {
|
|
130
|
+
userId: id.slice(-5)
|
|
131
|
+
}
|
|
132
|
+
}, function (message) {
|
|
133
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, "@".concat(message));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "render",
|
|
138
|
+
value: function render() {
|
|
139
|
+
var handleAvatarError = this.handleAvatarError,
|
|
140
|
+
handleOnClick = this.handleOnClick,
|
|
141
|
+
handleOnMouseEnter = this.handleOnMouseEnter,
|
|
142
|
+
handleOnMouseLeave = this.handleOnMouseLeave,
|
|
143
|
+
props = this.props;
|
|
144
|
+
var appType = props.appType,
|
|
145
|
+
avatarUrl = props.avatarUrl,
|
|
146
|
+
text = props.text,
|
|
147
|
+
id = props.id,
|
|
148
|
+
accessLevel = props.accessLevel,
|
|
149
|
+
localId = props.localId,
|
|
150
|
+
disabledTooltip = props.disabledTooltip,
|
|
151
|
+
isAvatarImagePreShaped = props.isAvatarImagePreShaped,
|
|
152
|
+
renderAvatarSlot = props.renderAvatarSlot;
|
|
153
|
+
var mentionType = this.getMentionType();
|
|
154
|
+
var failedMention = text === "@".concat(UNKNOWN_USER_ID);
|
|
155
|
+
var showAvatarSlot = Boolean(renderAvatarSlot) && !failedMention;
|
|
156
|
+
var visibleText = showAvatarSlot && text.startsWith('@') ? text.slice(1) : text;
|
|
157
|
+
var shouldApplyAgentShape = appType === 'agent' && !isAvatarImagePreShaped;
|
|
158
|
+
var shouldRenderAvatar = avatarUrl && !this.state.hasAvatarError;
|
|
159
|
+
var showRestrictedTooltip = mentionType === MentionType.RESTRICTED;
|
|
160
|
+
var showDisabledTooltip = mentionType === MentionType.DISABLED && !!disabledTooltip;
|
|
161
|
+
|
|
162
|
+
// A11y: when the chip is in the disabled visual state, expose
|
|
163
|
+
// `aria-disabled` so assistive tech announces it as such. The
|
|
164
|
+
// disabled-tooltip text is mirrored into `aria-label` so the
|
|
165
|
+
// announcement carries the reason even without portal-id wiring for
|
|
166
|
+
// `aria-describedby`.
|
|
167
|
+
var isDisabledChip = mentionType === MentionType.DISABLED;
|
|
168
|
+
var disabledA11yProps = isDisabledChip ? _objectSpread({
|
|
169
|
+
'aria-disabled': true,
|
|
170
|
+
tabIndex: 0
|
|
171
|
+
}, disabledTooltip ? {
|
|
172
|
+
'aria-label': "".concat(text || '@...', " \u2014 ").concat(disabledTooltip)
|
|
173
|
+
} : {}) : {};
|
|
174
|
+
var mentionComponent = /*#__PURE__*/React.createElement(FocusRing, null, /*#__PURE__*/React.createElement(PrimitiveMention, _extends({
|
|
175
|
+
isAvatarVisible: showAvatarSlot,
|
|
176
|
+
mentionType: mentionType,
|
|
177
|
+
onClick: handleOnClick,
|
|
178
|
+
onMouseEnter: handleOnMouseEnter,
|
|
179
|
+
onMouseLeave: handleOnMouseLeave,
|
|
180
|
+
spellCheck: false,
|
|
181
|
+
"data-testid": "mention-".concat(id),
|
|
182
|
+
"data-mention-type": mentionType,
|
|
183
|
+
"data-mention-tooltip": showRestrictedTooltip || showDisabledTooltip
|
|
184
|
+
}, disabledA11yProps), failedMention ? this.renderUnknownUserError(id) : showAvatarSlot ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
185
|
+
"aria-hidden": "true",
|
|
186
|
+
"data-testid": "mention-avatar-slot",
|
|
187
|
+
className: ax(["_1reo15vq _18m915vq _2rko1rr0 _1e0c116y _1bsb7vkz _4t3i7vkz _4cvr1h6o _1bah1h6o _1o9zidpf _12l21b66 _s7n410e5", shouldApplyAgentShape && "_2rkoidpf _mkrz1l17", this.state.hasAvatarError && "_s7n41q9y"])
|
|
188
|
+
}, shouldRenderAvatar ? /*#__PURE__*/React.createElement("img", {
|
|
189
|
+
alt: "",
|
|
190
|
+
decoding: "async",
|
|
191
|
+
draggable: false,
|
|
192
|
+
height: 16,
|
|
193
|
+
loading: "lazy",
|
|
194
|
+
onError: handleAvatarError,
|
|
195
|
+
src: avatarUrl,
|
|
196
|
+
"data-testid": "mention-avatar",
|
|
197
|
+
width: 16,
|
|
198
|
+
className: ax(["_1e0c1ule _1bsb1osq _4t3i1osq _5ral1dfr"])
|
|
199
|
+
}) : this.state.hasAvatarError ? '@' : null), /*#__PURE__*/React.createElement("span", null, visibleText || '...')) : text || '@...'));
|
|
200
|
+
var ssrPlaceholderProp = props.ssrPlaceholderId ? {
|
|
201
|
+
'data-ssr-placeholder': props.ssrPlaceholderId
|
|
202
|
+
} : {};
|
|
203
|
+
var wrappedMention = function () {
|
|
204
|
+
if (showRestrictedTooltip) {
|
|
205
|
+
return /*#__PURE__*/React.createElement(React.Suspense, {
|
|
206
|
+
fallback: mentionComponent
|
|
207
|
+
}, /*#__PURE__*/React.createElement(AsyncNoAccessTooltip, {
|
|
208
|
+
name: text
|
|
209
|
+
}, mentionComponent));
|
|
210
|
+
}
|
|
211
|
+
if (showDisabledTooltip) {
|
|
212
|
+
return /*#__PURE__*/React.createElement(React.Suspense, {
|
|
213
|
+
fallback: mentionComponent
|
|
214
|
+
}, /*#__PURE__*/React.createElement(AsyncDisabledMentionTooltip, {
|
|
215
|
+
tooltip: disabledTooltip
|
|
216
|
+
}, mentionComponent));
|
|
217
|
+
}
|
|
218
|
+
return mentionComponent;
|
|
219
|
+
}();
|
|
220
|
+
return /*#__PURE__*/React.createElement(UfoErrorBoundary, {
|
|
221
|
+
id: id
|
|
222
|
+
}, /*#__PURE__*/React.createElement("span", _extends({
|
|
223
|
+
id: localId,
|
|
224
|
+
"data-mention-id": id,
|
|
225
|
+
"data-local-id": localId,
|
|
226
|
+
"data-access-level": accessLevel,
|
|
227
|
+
spellCheck: false
|
|
228
|
+
}, ssrPlaceholderProp), /*#__PURE__*/React.createElement(MessagesIntlProvider, null, wrappedMention)));
|
|
229
|
+
}
|
|
230
|
+
}], [{
|
|
231
|
+
key: "getDerivedStateFromProps",
|
|
232
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
233
|
+
if (props.avatarUrl !== state.avatarUrl) {
|
|
234
|
+
return {
|
|
235
|
+
avatarUrl: props.avatarUrl,
|
|
236
|
+
hasAvatarError: false
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
}]);
|
|
242
|
+
}(React.PureComponent);
|
|
@@ -7,10 +7,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
7
7
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { isResolvingMentionProvider } from '../../api/
|
|
11
|
-
import { isPromise
|
|
12
|
-
import
|
|
10
|
+
import { isResolvingMentionProvider } from '../../api/isResolvingMentionProvider';
|
|
11
|
+
import { isPromise } from '../../is-promise';
|
|
12
|
+
import { MentionNameStatus } from '../../types';
|
|
13
13
|
import debug from '../../util/logger';
|
|
14
|
+
import Mention, { UNKNOWN_USER_ID } from './';
|
|
14
15
|
var ResourcedMention = /*#__PURE__*/function (_React$PureComponent) {
|
|
15
16
|
function ResourcedMention(_props) {
|
|
16
17
|
var _this;
|