@atlaskit/mention 22.0.0 → 22.1.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 +16 -0
- package/dist/cjs/api/MentionResource.js +111 -112
- package/dist/cjs/api/PresenceResource.js +1 -1
- package/dist/cjs/api/TeamMentionResource.js +95 -101
- package/dist/cjs/api/analytics.js +4 -4
- package/dist/cjs/components/LockCircleIcon/index.js +1 -1
- package/dist/cjs/components/Mention/PrimitiveMention.js +1 -0
- package/dist/cjs/components/MentionItem/index.js +1 -0
- package/dist/cjs/components/MentionList/index.js +1 -2
- package/dist/cjs/components/MentionListError/GenericErrorIllustration.js +1 -1
- package/dist/cjs/components/MentionPicker/index.js +8 -8
- package/dist/cjs/components/NoAccessTooltip/index.js +1 -1
- package/dist/cjs/components/ResourcedMentionList/index.js +2 -4
- package/dist/cjs/components/Scrollable/index.js +1 -0
- package/dist/cjs/types.js +16 -16
- package/dist/cjs/util/analytics.js +12 -12
- package/dist/cjs/util/i18n.js +194 -196
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/api/MentionResource.js +5 -1
- package/dist/es2019/api/analytics.js +3 -3
- package/dist/es2019/components/MentionItem/index.js +1 -0
- package/dist/es2019/components/MentionList/index.js +1 -2
- package/dist/es2019/components/MentionPicker/index.js +8 -9
- package/dist/es2019/components/ResourcedMentionList/index.js +2 -6
- package/dist/es2019/components/Scrollable/index.js +1 -0
- package/dist/es2019/types.js +12 -12
- package/dist/es2019/util/analytics.js +9 -9
- package/dist/es2019/version.json +1 -1
- package/dist/esm/api/MentionResource.js +109 -113
- package/dist/esm/api/PresenceResource.js +1 -1
- package/dist/esm/api/TeamMentionResource.js +95 -101
- package/dist/esm/api/analytics.js +3 -3
- package/dist/esm/components/MentionItem/index.js +1 -0
- package/dist/esm/components/MentionList/index.js +1 -2
- package/dist/esm/components/MentionPicker/index.js +8 -8
- package/dist/esm/components/ResourcedMentionList/index.js +2 -4
- package/dist/esm/components/Scrollable/index.js +1 -0
- package/dist/esm/types.js +12 -12
- package/dist/esm/util/analytics.js +9 -9
- package/dist/esm/util/i18n.js +134 -136
- package/dist/esm/version.json +1 -1
- package/package.json +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/mention
|
|
2
2
|
|
|
3
|
+
## 22.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 22.0.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
18
|
+
|
|
3
19
|
## 22.0.0
|
|
4
20
|
|
|
5
21
|
### Major Changes
|
|
@@ -24,6 +24,13 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
24
24
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
25
|
var MAX_QUERY_ITEMS = 100;
|
|
26
26
|
var MAX_NOTIFIED_ITEMS = 20;
|
|
27
|
+
|
|
28
|
+
// Re-exporting types to prevent breaking change
|
|
29
|
+
// Re-exporting types to prevent breaking change
|
|
30
|
+
/**
|
|
31
|
+
* Support
|
|
32
|
+
*/
|
|
33
|
+
|
|
27
34
|
var emptySecurityProvider = function emptySecurityProvider() {
|
|
28
35
|
return {
|
|
29
36
|
params: {},
|
|
@@ -229,40 +236,38 @@ var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
|
|
|
229
236
|
var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query, contextIdentifier) {
|
|
230
237
|
var searchTime, results, searchResponse;
|
|
231
238
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
232
|
-
while (1) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
_context.next = 8;
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
_context.next = 5;
|
|
242
|
-
return this.initialState(contextIdentifier);
|
|
243
|
-
case 5:
|
|
244
|
-
results = _context.sent;
|
|
245
|
-
_context.next = 13;
|
|
246
|
-
break;
|
|
247
|
-
case 8:
|
|
248
|
-
this.activeSearches.add(query);
|
|
249
|
-
searchResponse = this.search(query, contextIdentifier);
|
|
250
|
-
_context.next = 12;
|
|
251
|
-
return searchResponse.mentions;
|
|
252
|
-
case 12:
|
|
253
|
-
results = _context.sent;
|
|
254
|
-
case 13:
|
|
255
|
-
this.notify(searchTime, results, query);
|
|
256
|
-
_context.next = 19;
|
|
239
|
+
while (1) switch (_context.prev = _context.next) {
|
|
240
|
+
case 0:
|
|
241
|
+
_context.prev = 0;
|
|
242
|
+
searchTime = Date.now();
|
|
243
|
+
if (query) {
|
|
244
|
+
_context.next = 8;
|
|
257
245
|
break;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
246
|
+
}
|
|
247
|
+
_context.next = 5;
|
|
248
|
+
return this.initialState(contextIdentifier);
|
|
249
|
+
case 5:
|
|
250
|
+
results = _context.sent;
|
|
251
|
+
_context.next = 13;
|
|
252
|
+
break;
|
|
253
|
+
case 8:
|
|
254
|
+
this.activeSearches.add(query);
|
|
255
|
+
searchResponse = this.search(query, contextIdentifier);
|
|
256
|
+
_context.next = 12;
|
|
257
|
+
return searchResponse.mentions;
|
|
258
|
+
case 12:
|
|
259
|
+
results = _context.sent;
|
|
260
|
+
case 13:
|
|
261
|
+
this.notify(searchTime, results, query);
|
|
262
|
+
_context.next = 19;
|
|
263
|
+
break;
|
|
264
|
+
case 16:
|
|
265
|
+
_context.prev = 16;
|
|
266
|
+
_context.t0 = _context["catch"](0);
|
|
267
|
+
this.notifyError(_context.t0, query);
|
|
268
|
+
case 19:
|
|
269
|
+
case "end":
|
|
270
|
+
return _context.stop();
|
|
266
271
|
}
|
|
267
272
|
}, _callee, this, [[0, 16]]);
|
|
268
273
|
}));
|
|
@@ -374,30 +379,28 @@ var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
|
|
|
374
379
|
var _remoteInitialState = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(contextIdentifier) {
|
|
375
380
|
var queryParams, options, result;
|
|
376
381
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
377
|
-
while (1) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
return _context2.stop();
|
|
400
|
-
}
|
|
382
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
383
|
+
case 0:
|
|
384
|
+
queryParams = this.getQueryParams(contextIdentifier);
|
|
385
|
+
options = {
|
|
386
|
+
path: 'bootstrap',
|
|
387
|
+
queryParams: queryParams
|
|
388
|
+
};
|
|
389
|
+
_context2.prev = 2;
|
|
390
|
+
_context2.next = 5;
|
|
391
|
+
return _utilServiceSupport.utils.requestService(this.config, options);
|
|
392
|
+
case 5:
|
|
393
|
+
result = _context2.sent;
|
|
394
|
+
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _analytics.SliNames.INITIAL_STATE, _analytics.Actions.SUCCEEDED);
|
|
395
|
+
return _context2.abrupt("return", this.transformServiceResponse(result, ''));
|
|
396
|
+
case 10:
|
|
397
|
+
_context2.prev = 10;
|
|
398
|
+
_context2.t0 = _context2["catch"](2);
|
|
399
|
+
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _analytics.SliNames.INITIAL_STATE, _analytics.Actions.FAILED);
|
|
400
|
+
throw _context2.t0;
|
|
401
|
+
case 14:
|
|
402
|
+
case "end":
|
|
403
|
+
return _context2.stop();
|
|
401
404
|
}
|
|
402
405
|
}, _callee2, this, [[2, 10]]);
|
|
403
406
|
}));
|
|
@@ -419,32 +422,30 @@ var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
|
|
|
419
422
|
var _remoteSearch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(query, contextIdentifier) {
|
|
420
423
|
var options, result;
|
|
421
424
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
422
|
-
while (1) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
return _context3.stop();
|
|
447
|
-
}
|
|
425
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
426
|
+
case 0:
|
|
427
|
+
options = {
|
|
428
|
+
path: 'search',
|
|
429
|
+
queryParams: _objectSpread({
|
|
430
|
+
query: query,
|
|
431
|
+
limit: MAX_QUERY_ITEMS
|
|
432
|
+
}, this.getQueryParams(contextIdentifier))
|
|
433
|
+
};
|
|
434
|
+
_context3.prev = 1;
|
|
435
|
+
_context3.next = 4;
|
|
436
|
+
return _utilServiceSupport.utils.requestService(this.config, options);
|
|
437
|
+
case 4:
|
|
438
|
+
result = _context3.sent;
|
|
439
|
+
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _analytics.SliNames.SEARCH, _analytics.Actions.SUCCEEDED);
|
|
440
|
+
return _context3.abrupt("return", this.transformServiceResponse(result, query));
|
|
441
|
+
case 9:
|
|
442
|
+
_context3.prev = 9;
|
|
443
|
+
_context3.t0 = _context3["catch"](1);
|
|
444
|
+
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _analytics.SliNames.SEARCH, _analytics.Actions.FAILED);
|
|
445
|
+
throw _context3.t0;
|
|
446
|
+
case 13:
|
|
447
|
+
case "end":
|
|
448
|
+
return _context3.stop();
|
|
448
449
|
}
|
|
449
450
|
}, _callee3, this, [[1, 9]]);
|
|
450
451
|
}));
|
|
@@ -479,35 +480,33 @@ var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
|
|
|
479
480
|
var _recordSelection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(mention, contextIdentifier) {
|
|
480
481
|
var options, sliName, result;
|
|
481
482
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
482
|
-
while (1) {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
return _context4.stop();
|
|
510
|
-
}
|
|
483
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
484
|
+
case 0:
|
|
485
|
+
options = {
|
|
486
|
+
path: 'record',
|
|
487
|
+
queryParams: _objectSpread({
|
|
488
|
+
selectedUserId: mention.id
|
|
489
|
+
}, this.getQueryParams(contextIdentifier)),
|
|
490
|
+
requestInit: {
|
|
491
|
+
method: 'POST'
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
sliName = (0, _types.isTeamMention)(mention) ? _analytics.SliNames.SELECT_TEAM : _analytics.SliNames.SELECT;
|
|
495
|
+
_context4.prev = 2;
|
|
496
|
+
_context4.next = 5;
|
|
497
|
+
return _utilServiceSupport.utils.requestService(this.config, options);
|
|
498
|
+
case 5:
|
|
499
|
+
result = _context4.sent;
|
|
500
|
+
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, sliName, _analytics.Actions.SUCCEEDED);
|
|
501
|
+
return _context4.abrupt("return", result);
|
|
502
|
+
case 10:
|
|
503
|
+
_context4.prev = 10;
|
|
504
|
+
_context4.t0 = _context4["catch"](2);
|
|
505
|
+
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, sliName, _analytics.Actions.FAILED);
|
|
506
|
+
throw _context4.t0;
|
|
507
|
+
case 14:
|
|
508
|
+
case "end":
|
|
509
|
+
return _context4.stop();
|
|
511
510
|
}
|
|
512
511
|
}, _callee4, this, [[2, 10]]);
|
|
513
512
|
}));
|
|
@@ -15,7 +15,7 @@ var _logger = _interopRequireDefault(require("../util/logger"));
|
|
|
15
15
|
var _MentionResource = require("./MentionResource");
|
|
16
16
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
17
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
21
|
var CacheEntry = /*#__PURE__*/function () {
|
|
@@ -71,22 +71,20 @@ var TeamMentionResource = /*#__PURE__*/function (_MentionResource) {
|
|
|
71
71
|
var _remoteInitialStateTeamAndUsers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(contextIdentifier) {
|
|
72
72
|
var emptyQuery, getUserPromise, queryParams, options, getTeamsPromise;
|
|
73
73
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
74
|
-
while (1) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return _context.stop();
|
|
89
|
-
}
|
|
74
|
+
while (1) switch (_context.prev = _context.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
emptyQuery = '';
|
|
77
|
+
getUserPromise = (0, _get2.default)((0, _getPrototypeOf2.default)(TeamMentionResource.prototype), "remoteInitialState", this).call(this, contextIdentifier);
|
|
78
|
+
queryParams = this.getQueryParamsOfTeamMentionConfig(contextIdentifier);
|
|
79
|
+
options = {
|
|
80
|
+
path: 'bootstrap',
|
|
81
|
+
queryParams: queryParams
|
|
82
|
+
};
|
|
83
|
+
getTeamsPromise = _utilServiceSupport.utils.requestService(this.teamMentionConfig, options);
|
|
84
|
+
this.handleBothRequests(emptyQuery, getUserPromise, getTeamsPromise);
|
|
85
|
+
case 6:
|
|
86
|
+
case "end":
|
|
87
|
+
return _context.stop();
|
|
90
88
|
}
|
|
91
89
|
}, _callee, this);
|
|
92
90
|
}));
|
|
@@ -109,70 +107,68 @@ var TeamMentionResource = /*#__PURE__*/function (_MentionResource) {
|
|
|
109
107
|
var _this2 = this;
|
|
110
108
|
var searchTime, accumulatedResults, notifyWhenOneRequestDone, userResults, userRequestError, teamRequestError, teamsResult;
|
|
111
109
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
112
|
-
while (1) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
111
|
+
case 0:
|
|
112
|
+
searchTime = Date.now();
|
|
113
|
+
accumulatedResults = {
|
|
114
|
+
mentions: [],
|
|
115
|
+
query: query
|
|
116
|
+
};
|
|
117
|
+
notifyWhenOneRequestDone = function notifyWhenOneRequestDone(results, hasTeamResults) {
|
|
118
|
+
// just update UI for the last query string
|
|
119
|
+
if (query !== _this2.lastSearchQuery) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
116
122
|
accumulatedResults = {
|
|
117
|
-
mentions: [],
|
|
123
|
+
mentions: [].concat((0, _toConsumableArray2.default)(accumulatedResults.mentions), (0, _toConsumableArray2.default)(results.mentions)),
|
|
118
124
|
query: query
|
|
119
125
|
};
|
|
120
|
-
notifyWhenOneRequestDone = function notifyWhenOneRequestDone(results, hasTeamResults) {
|
|
121
|
-
// just update UI for the last query string
|
|
122
|
-
if (query !== _this2.lastSearchQuery) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
accumulatedResults = {
|
|
126
|
-
mentions: [].concat((0, _toConsumableArray2.default)(accumulatedResults.mentions), (0, _toConsumableArray2.default)(results.mentions)),
|
|
127
|
-
query: query
|
|
128
|
-
};
|
|
129
126
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
userRequestError = null;
|
|
138
|
-
teamRequestError = null;
|
|
139
|
-
_context2.prev = 5;
|
|
140
|
-
_context2.next = 8;
|
|
141
|
-
return userRequest;
|
|
142
|
-
case 8:
|
|
143
|
-
userResults = _context2.sent;
|
|
144
|
-
notifyWhenOneRequestDone(userResults, false);
|
|
145
|
-
_context2.next = 15;
|
|
146
|
-
break;
|
|
147
|
-
case 12:
|
|
148
|
-
_context2.prev = 12;
|
|
149
|
-
_context2.t0 = _context2["catch"](5);
|
|
150
|
-
userRequestError = _context2.t0;
|
|
151
|
-
case 15:
|
|
152
|
-
_context2.prev = 15;
|
|
153
|
-
_context2.next = 18;
|
|
154
|
-
return teamRequest;
|
|
155
|
-
case 18:
|
|
156
|
-
teamsResult = _context2.sent;
|
|
157
|
-
// update search time after team results returns
|
|
158
|
-
notifyWhenOneRequestDone(Array.isArray(teamsResult) ? this.convertTeamResultToMentionResult(teamsResult, query) : teamsResult, true);
|
|
159
|
-
_context2.next = 25;
|
|
160
|
-
break;
|
|
161
|
-
case 22:
|
|
162
|
-
_context2.prev = 22;
|
|
163
|
-
_context2.t1 = _context2["catch"](15);
|
|
164
|
-
teamRequestError = _context2.t1;
|
|
165
|
-
case 25:
|
|
166
|
-
// both requests fail, show one of errors in UI
|
|
167
|
-
if (userRequestError && teamRequestError) {
|
|
168
|
-
this.notifyError(userRequestError, query);
|
|
169
|
-
(0, _logger.default)('User mention request fails. ', userRequestError);
|
|
170
|
-
(0, _logger.default)('Team mention request fails. ', teamRequestError);
|
|
127
|
+
// we need to calculate different `duration` for user and team request.
|
|
128
|
+
if (hasTeamResults) {
|
|
129
|
+
_this2.notify(searchTime, accumulatedResults, query);
|
|
130
|
+
} else {
|
|
131
|
+
(0, _get2.default)((0, _getPrototypeOf2.default)(TeamMentionResource.prototype), "notify", _this2).call(_this2, searchTime, accumulatedResults, query);
|
|
171
132
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
133
|
+
};
|
|
134
|
+
userRequestError = null;
|
|
135
|
+
teamRequestError = null;
|
|
136
|
+
_context2.prev = 5;
|
|
137
|
+
_context2.next = 8;
|
|
138
|
+
return userRequest;
|
|
139
|
+
case 8:
|
|
140
|
+
userResults = _context2.sent;
|
|
141
|
+
notifyWhenOneRequestDone(userResults, false);
|
|
142
|
+
_context2.next = 15;
|
|
143
|
+
break;
|
|
144
|
+
case 12:
|
|
145
|
+
_context2.prev = 12;
|
|
146
|
+
_context2.t0 = _context2["catch"](5);
|
|
147
|
+
userRequestError = _context2.t0;
|
|
148
|
+
case 15:
|
|
149
|
+
_context2.prev = 15;
|
|
150
|
+
_context2.next = 18;
|
|
151
|
+
return teamRequest;
|
|
152
|
+
case 18:
|
|
153
|
+
teamsResult = _context2.sent;
|
|
154
|
+
// update search time after team results returns
|
|
155
|
+
notifyWhenOneRequestDone(Array.isArray(teamsResult) ? this.convertTeamResultToMentionResult(teamsResult, query) : teamsResult, true);
|
|
156
|
+
_context2.next = 25;
|
|
157
|
+
break;
|
|
158
|
+
case 22:
|
|
159
|
+
_context2.prev = 22;
|
|
160
|
+
_context2.t1 = _context2["catch"](15);
|
|
161
|
+
teamRequestError = _context2.t1;
|
|
162
|
+
case 25:
|
|
163
|
+
// both requests fail, show one of errors in UI
|
|
164
|
+
if (userRequestError && teamRequestError) {
|
|
165
|
+
this.notifyError(userRequestError, query);
|
|
166
|
+
(0, _logger.default)('User mention request fails. ', userRequestError);
|
|
167
|
+
(0, _logger.default)('Team mention request fails. ', teamRequestError);
|
|
168
|
+
}
|
|
169
|
+
case 26:
|
|
170
|
+
case "end":
|
|
171
|
+
return _context2.stop();
|
|
176
172
|
}
|
|
177
173
|
}, _callee2, this, [[5, 12], [15, 22]]);
|
|
178
174
|
}));
|
|
@@ -221,32 +217,30 @@ var TeamMentionResource = /*#__PURE__*/function (_MentionResource) {
|
|
|
221
217
|
var _remoteTeamSearch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(query, contextIdentifier) {
|
|
222
218
|
var options, teamResult;
|
|
223
219
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
224
|
-
while (1) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return _context3.stop();
|
|
249
|
-
}
|
|
220
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
221
|
+
case 0:
|
|
222
|
+
options = {
|
|
223
|
+
path: 'search',
|
|
224
|
+
queryParams: _objectSpread({
|
|
225
|
+
query: query,
|
|
226
|
+
limit: MAX_QUERY_TEAMS
|
|
227
|
+
}, this.getQueryParamsOfTeamMentionConfig(contextIdentifier))
|
|
228
|
+
};
|
|
229
|
+
_context3.prev = 1;
|
|
230
|
+
_context3.next = 4;
|
|
231
|
+
return _utilServiceSupport.utils.requestService(this.teamMentionConfig, options);
|
|
232
|
+
case 4:
|
|
233
|
+
teamResult = _context3.sent;
|
|
234
|
+
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _analytics.SliNames.SEARCH_TEAM, _analytics.Actions.SUCCEEDED);
|
|
235
|
+
return _context3.abrupt("return", this.convertTeamResultToMentionResult(teamResult, query));
|
|
236
|
+
case 9:
|
|
237
|
+
_context3.prev = 9;
|
|
238
|
+
_context3.t0 = _context3["catch"](1);
|
|
239
|
+
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _analytics.SliNames.SEARCH_TEAM, _analytics.Actions.FAILED);
|
|
240
|
+
throw _context3.t0;
|
|
241
|
+
case 13:
|
|
242
|
+
case "end":
|
|
243
|
+
return _context3.stop();
|
|
250
244
|
}
|
|
251
245
|
}, _callee3, this, [[1, 9]]);
|
|
252
246
|
}));
|
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.defaultAttributes = exports.SMART_EVENT_TYPE = exports.Actions = void 0;
|
|
7
7
|
var SMART_EVENT_TYPE = 'smart';
|
|
8
8
|
exports.SMART_EVENT_TYPE = SMART_EVENT_TYPE;
|
|
9
|
-
var Actions
|
|
10
|
-
exports.Actions = Actions;
|
|
11
|
-
(function (Actions) {
|
|
9
|
+
var Actions = /*#__PURE__*/function (Actions) {
|
|
12
10
|
Actions["REQUESTED"] = "requested";
|
|
13
11
|
Actions["SUCCESSFUL"] = "successful";
|
|
14
12
|
Actions["SEARCHED"] = "searched";
|
|
15
13
|
Actions["FAILED"] = "failed";
|
|
16
14
|
Actions["SELECTED"] = "selected";
|
|
17
|
-
|
|
15
|
+
return Actions;
|
|
16
|
+
}({});
|
|
17
|
+
exports.Actions = Actions;
|
|
18
18
|
var defaultAttributes = function defaultAttributes(context) {
|
|
19
19
|
return {
|
|
20
20
|
context: (context === null || context === void 0 ? void 0 : context.objectId) || '',
|
|
@@ -11,7 +11,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || (0, _typeof2.default)(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
12
|
var AsyncLockCircleIcon = /*#__PURE__*/(0, _react.lazy)(function () {
|
|
13
13
|
return Promise.resolve().then(function () {
|
|
14
|
-
return _interopRequireWildcard(require('@atlaskit/icon/glyph/lock-circle'));
|
|
14
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_mention/LockCircleIcon" */'@atlaskit/icon/glyph/lock-circle'));
|
|
15
15
|
}).then(function (module) {
|
|
16
16
|
return {
|
|
17
17
|
default: module.default
|
|
@@ -16,6 +16,7 @@ var _types = require("../../types");
|
|
|
16
16
|
var _react2 = require("react");
|
|
17
17
|
var _excluded = ["mentionType"];
|
|
18
18
|
var _mentionStyle, _templateObject;
|
|
19
|
+
/** @jsx jsx */
|
|
19
20
|
var mentionStyle = (_mentionStyle = {}, (0, _defineProperty2.default)(_mentionStyle, _types.MentionType.SELF, {
|
|
20
21
|
background: (0, _components.themed)({
|
|
21
22
|
light: "var(--ds-background-brand-bold, ".concat(_colors.B400, ")"),
|
|
@@ -63,6 +63,7 @@ var MentionItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
63
63
|
args[_key] = arguments[_key];
|
|
64
64
|
}
|
|
65
65
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
66
|
+
// internal, used for callbacks
|
|
66
67
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMentionSelected", function (event) {
|
|
67
68
|
if ((0, _mouse.leftClick)(event) && _this.props.onSelection) {
|
|
68
69
|
event.preventDefault();
|
|
@@ -53,6 +53,7 @@ var MentionList = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
53
53
|
var _this;
|
|
54
54
|
(0, _classCallCheck2.default)(this, MentionList);
|
|
55
55
|
_this = _super.call(this, props);
|
|
56
|
+
// API
|
|
56
57
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectNext", function () {
|
|
57
58
|
var newIndex = wrapIndex(_this.props.mentions, _this.state.selectedIndex + 1);
|
|
58
59
|
_this.selectIndex(newIndex);
|
|
@@ -150,8 +151,6 @@ var MentionList = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
150
151
|
// integration tests. Will remove / fix once known
|
|
151
152
|
// emit(elem, mentionListRenderedEvent);
|
|
152
153
|
}
|
|
153
|
-
|
|
154
|
-
// API
|
|
155
154
|
}, {
|
|
156
155
|
key: "revealItem",
|
|
157
156
|
value:
|
|
@@ -13,7 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _styles = require("./styles");
|
|
15
15
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
16
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
17
17
|
var GenericErrorIllustration = /*#__PURE__*/function (_React$PureComponent) {
|
|
18
18
|
(0, _inherits2.default)(GenericErrorIllustration, _React$PureComponent);
|
|
19
19
|
var _super = _createSuper(GenericErrorIllustration);
|
|
@@ -64,6 +64,13 @@ var MentionPicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
64
64
|
}
|
|
65
65
|
return 0;
|
|
66
66
|
});
|
|
67
|
+
/**
|
|
68
|
+
* Called after the 'visible' state is changed to decide whether the onOpen or onClose
|
|
69
|
+
* handlers should be called.
|
|
70
|
+
*
|
|
71
|
+
* It should be noted that the visible state of the component is not considered in
|
|
72
|
+
* this function. Instead the old state and new state should be passed as parameters.
|
|
73
|
+
*/
|
|
67
74
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFilterVisibilityChange", function (oldVisibility, newVisibility) {
|
|
68
75
|
if (oldVisibility !== newVisibility) {
|
|
69
76
|
if (newVisibility) {
|
|
@@ -77,6 +84,7 @@ var MentionPicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
86
|
});
|
|
87
|
+
// internal, used for callbacks
|
|
80
88
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "filterChange", function (mentions, query, stats) {
|
|
81
89
|
(0, _logger.default)('ak-mention-picker.filterChange', mentions.length);
|
|
82
90
|
var wasVisible = _this.state.visible;
|
|
@@ -158,14 +166,6 @@ var MentionPicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
158
166
|
resourceProvider.unsubscribe(this.subscriberKey);
|
|
159
167
|
}
|
|
160
168
|
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Called after the 'visible' state is changed to decide whether the onOpen or onClose
|
|
164
|
-
* handlers should be called.
|
|
165
|
-
*
|
|
166
|
-
* It should be noted that the visible state of the component is not considered in
|
|
167
|
-
* this function. Instead the old state and new state should be passed as parameters.
|
|
168
|
-
*/
|
|
169
169
|
}, {
|
|
170
170
|
key: "render",
|
|
171
171
|
value: function render() {
|