@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.
Files changed (42) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/api/MentionResource.js +111 -112
  3. package/dist/cjs/api/PresenceResource.js +1 -1
  4. package/dist/cjs/api/TeamMentionResource.js +95 -101
  5. package/dist/cjs/api/analytics.js +4 -4
  6. package/dist/cjs/components/LockCircleIcon/index.js +1 -1
  7. package/dist/cjs/components/Mention/PrimitiveMention.js +1 -0
  8. package/dist/cjs/components/MentionItem/index.js +1 -0
  9. package/dist/cjs/components/MentionList/index.js +1 -2
  10. package/dist/cjs/components/MentionListError/GenericErrorIllustration.js +1 -1
  11. package/dist/cjs/components/MentionPicker/index.js +8 -8
  12. package/dist/cjs/components/NoAccessTooltip/index.js +1 -1
  13. package/dist/cjs/components/ResourcedMentionList/index.js +2 -4
  14. package/dist/cjs/components/Scrollable/index.js +1 -0
  15. package/dist/cjs/types.js +16 -16
  16. package/dist/cjs/util/analytics.js +12 -12
  17. package/dist/cjs/util/i18n.js +194 -196
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/api/MentionResource.js +5 -1
  20. package/dist/es2019/api/analytics.js +3 -3
  21. package/dist/es2019/components/MentionItem/index.js +1 -0
  22. package/dist/es2019/components/MentionList/index.js +1 -2
  23. package/dist/es2019/components/MentionPicker/index.js +8 -9
  24. package/dist/es2019/components/ResourcedMentionList/index.js +2 -6
  25. package/dist/es2019/components/Scrollable/index.js +1 -0
  26. package/dist/es2019/types.js +12 -12
  27. package/dist/es2019/util/analytics.js +9 -9
  28. package/dist/es2019/version.json +1 -1
  29. package/dist/esm/api/MentionResource.js +109 -113
  30. package/dist/esm/api/PresenceResource.js +1 -1
  31. package/dist/esm/api/TeamMentionResource.js +95 -101
  32. package/dist/esm/api/analytics.js +3 -3
  33. package/dist/esm/components/MentionItem/index.js +1 -0
  34. package/dist/esm/components/MentionList/index.js +1 -2
  35. package/dist/esm/components/MentionPicker/index.js +8 -8
  36. package/dist/esm/components/ResourcedMentionList/index.js +2 -4
  37. package/dist/esm/components/Scrollable/index.js +1 -0
  38. package/dist/esm/types.js +12 -12
  39. package/dist/esm/util/analytics.js +9 -9
  40. package/dist/esm/util/i18n.js +134 -136
  41. package/dist/esm/version.json +1 -1
  42. package/package.json +19 -19
@@ -33,6 +33,7 @@ function extractPresences(mentions) {
33
33
  export class ResourcedMentionListWithoutAnalytics extends React.PureComponent {
34
34
  constructor(props) {
35
35
  super(props);
36
+ // API
36
37
  _defineProperty(this, "selectNext", () => {
37
38
  if (this.mentionListRef) {
38
39
  this.mentionListRef.selectNext();
@@ -64,6 +65,7 @@ export class ResourcedMentionListWithoutAnalytics extends React.PureComponent {
64
65
  }
65
66
  return 0;
66
67
  });
68
+ // internal, used for callbacks
67
69
  _defineProperty(this, "filterChange", mentions => {
68
70
  // Retain known presence
69
71
  const currentPresences = extractPresences(this.state.mentions);
@@ -116,9 +118,6 @@ export class ResourcedMentionListWithoutAnalytics extends React.PureComponent {
116
118
  this.unsubscribeMentionProvider(this.props.resourceProvider);
117
119
  this.unsubscribePresenceProvider(this.props.presenceProvider);
118
120
  }
119
-
120
- // API
121
-
122
121
  // internal
123
122
  subscribeMentionProvider(mentionProvider) {
124
123
  if (mentionProvider) {
@@ -173,9 +172,6 @@ export class ResourcedMentionListWithoutAnalytics extends React.PureComponent {
173
172
  this.props.presenceProvider.refreshPresence(ids);
174
173
  }
175
174
  }
176
-
177
- // internal, used for callbacks
178
-
179
175
  render() {
180
176
  const {
181
177
  mentions,
@@ -5,6 +5,7 @@ import { ScrollableStyle } from './styles';
5
5
  export default class Scrollable extends React.PureComponent {
6
6
  constructor(...args) {
7
7
  super(...args);
8
+ // API
8
9
  _defineProperty(this, "reveal", child => {
9
10
  if (child && this.scrollableDiv) {
10
11
  const childNode = findDOMNode(child);
@@ -1,32 +1,32 @@
1
1
  // data is returned from team search service
2
2
 
3
- export let MentionType;
4
- (function (MentionType) {
3
+ export let MentionType = /*#__PURE__*/function (MentionType) {
5
4
  MentionType[MentionType["SELF"] = 0] = "SELF";
6
5
  MentionType[MentionType["RESTRICTED"] = 1] = "RESTRICTED";
7
6
  MentionType[MentionType["DEFAULT"] = 2] = "DEFAULT";
8
- })(MentionType || (MentionType = {}));
9
- export let UserAccessLevel;
10
- (function (UserAccessLevel) {
7
+ return MentionType;
8
+ }({});
9
+ export let UserAccessLevel = /*#__PURE__*/function (UserAccessLevel) {
11
10
  UserAccessLevel[UserAccessLevel["NONE"] = 0] = "NONE";
12
11
  UserAccessLevel[UserAccessLevel["SITE"] = 1] = "SITE";
13
12
  UserAccessLevel[UserAccessLevel["APPLICATION"] = 2] = "APPLICATION";
14
13
  UserAccessLevel[UserAccessLevel["CONTAINER"] = 3] = "CONTAINER";
15
- })(UserAccessLevel || (UserAccessLevel = {}));
16
- export let UserType;
17
- (function (UserType) {
14
+ return UserAccessLevel;
15
+ }({});
16
+ export let UserType = /*#__PURE__*/function (UserType) {
18
17
  UserType[UserType["DEFAULT"] = 0] = "DEFAULT";
19
18
  UserType[UserType["SPECIAL"] = 1] = "SPECIAL";
20
19
  UserType[UserType["APP"] = 2] = "APP";
21
20
  UserType[UserType["TEAM"] = 3] = "TEAM";
22
21
  UserType[UserType["SYSTEM"] = 4] = "SYSTEM";
23
- })(UserType || (UserType = {}));
24
- export let MentionNameStatus;
25
- (function (MentionNameStatus) {
22
+ return UserType;
23
+ }({});
24
+ export let MentionNameStatus = /*#__PURE__*/function (MentionNameStatus) {
26
25
  MentionNameStatus[MentionNameStatus["UNKNOWN"] = 0] = "UNKNOWN";
27
26
  MentionNameStatus[MentionNameStatus["SERVICE_ERROR"] = 1] = "SERVICE_ERROR";
28
27
  MentionNameStatus[MentionNameStatus["OK"] = 2] = "OK";
29
- })(MentionNameStatus || (MentionNameStatus = {}));
28
+ return MentionNameStatus;
29
+ }({});
30
30
  export function isRestricted(accessLevel) {
31
31
  return !!accessLevel && accessLevel === UserAccessLevel[UserAccessLevel.NONE];
32
32
  }
@@ -4,27 +4,27 @@ import { name as packageName, version as packageVersion } from '../version.json'
4
4
  import { isSpecialMentionText } from '../types';
5
5
  export const SLI_EVENT_TYPE = 'sli';
6
6
  export const SMART_EVENT_TYPE = 'smart';
7
- export let SliNames;
8
- (function (SliNames) {
7
+ export let SliNames = /*#__PURE__*/function (SliNames) {
9
8
  SliNames["SEARCH"] = "searchUser";
10
9
  SliNames["SEARCH_TEAM"] = "searchTeam";
11
10
  SliNames["INITIAL_STATE"] = "initialState";
12
11
  SliNames["SELECT"] = "select";
13
12
  SliNames["SELECT_TEAM"] = "selectTeam";
14
- })(SliNames || (SliNames = {}));
15
- export let ComponentNames;
16
- (function (ComponentNames) {
13
+ return SliNames;
14
+ }({});
15
+ export let ComponentNames = /*#__PURE__*/function (ComponentNames) {
17
16
  ComponentNames["TYPEAHEAD"] = "mentionTypeahead";
18
17
  ComponentNames["MENTION"] = "mention";
19
- })(ComponentNames || (ComponentNames = {}));
20
- export let Actions;
21
- (function (Actions) {
18
+ return ComponentNames;
19
+ }({});
20
+ export let Actions = /*#__PURE__*/function (Actions) {
22
21
  Actions["VIEWED"] = "viewed";
23
22
  Actions["CLICKED"] = "clicked";
24
23
  Actions["CLOSED"] = "closed";
25
24
  Actions["SUCCEEDED"] = "succeeded";
26
25
  Actions["FAILED"] = "failed";
27
- })(Actions || (Actions = {}));
26
+ return Actions;
27
+ }({});
28
28
  export const fireAnalyticsMentionTypeaheadEvent = props => (action, duration, userIds = [], query) => {
29
29
  if (props.createAnalyticsEvent) {
30
30
  const eventPayload = {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "22.0.0",
3
+ "version": "22.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -17,9 +17,13 @@ var MAX_QUERY_ITEMS = 100;
17
17
  var MAX_NOTIFIED_ITEMS = 20;
18
18
  // Re-exporting types to prevent breaking change
19
19
  // Re-exporting types to prevent breaking change
20
-
21
20
  import { SLI_EVENT_TYPE, Actions, SliNames } from '../util/analytics';
22
21
  import debounce from 'lodash/debounce';
22
+
23
+ /**
24
+ * Support
25
+ */
26
+
23
27
  var emptySecurityProvider = function emptySecurityProvider() {
24
28
  return {
25
29
  params: {},
@@ -223,40 +227,38 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
223
227
  var _filter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(query, contextIdentifier) {
224
228
  var searchTime, results, searchResponse;
225
229
  return _regeneratorRuntime.wrap(function _callee$(_context) {
226
- while (1) {
227
- switch (_context.prev = _context.next) {
228
- case 0:
229
- _context.prev = 0;
230
- searchTime = Date.now();
231
- if (query) {
232
- _context.next = 8;
233
- break;
234
- }
235
- _context.next = 5;
236
- return this.initialState(contextIdentifier);
237
- case 5:
238
- results = _context.sent;
239
- _context.next = 13;
230
+ while (1) switch (_context.prev = _context.next) {
231
+ case 0:
232
+ _context.prev = 0;
233
+ searchTime = Date.now();
234
+ if (query) {
235
+ _context.next = 8;
240
236
  break;
241
- case 8:
242
- this.activeSearches.add(query);
243
- searchResponse = this.search(query, contextIdentifier);
244
- _context.next = 12;
245
- return searchResponse.mentions;
246
- case 12:
247
- results = _context.sent;
248
- case 13:
249
- this.notify(searchTime, results, query);
250
- _context.next = 19;
251
- break;
252
- case 16:
253
- _context.prev = 16;
254
- _context.t0 = _context["catch"](0);
255
- this.notifyError(_context.t0, query);
256
- case 19:
257
- case "end":
258
- return _context.stop();
259
- }
237
+ }
238
+ _context.next = 5;
239
+ return this.initialState(contextIdentifier);
240
+ case 5:
241
+ results = _context.sent;
242
+ _context.next = 13;
243
+ break;
244
+ case 8:
245
+ this.activeSearches.add(query);
246
+ searchResponse = this.search(query, contextIdentifier);
247
+ _context.next = 12;
248
+ return searchResponse.mentions;
249
+ case 12:
250
+ results = _context.sent;
251
+ case 13:
252
+ this.notify(searchTime, results, query);
253
+ _context.next = 19;
254
+ break;
255
+ case 16:
256
+ _context.prev = 16;
257
+ _context.t0 = _context["catch"](0);
258
+ this.notifyError(_context.t0, query);
259
+ case 19:
260
+ case "end":
261
+ return _context.stop();
260
262
  }
261
263
  }, _callee, this, [[0, 16]]);
262
264
  }));
@@ -368,30 +370,28 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
368
370
  var _remoteInitialState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(contextIdentifier) {
369
371
  var queryParams, options, result;
370
372
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
371
- while (1) {
372
- switch (_context2.prev = _context2.next) {
373
- case 0:
374
- queryParams = this.getQueryParams(contextIdentifier);
375
- options = {
376
- path: 'bootstrap',
377
- queryParams: queryParams
378
- };
379
- _context2.prev = 2;
380
- _context2.next = 5;
381
- return serviceUtils.requestService(this.config, options);
382
- case 5:
383
- result = _context2.sent;
384
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.INITIAL_STATE, Actions.SUCCEEDED);
385
- return _context2.abrupt("return", this.transformServiceResponse(result, ''));
386
- case 10:
387
- _context2.prev = 10;
388
- _context2.t0 = _context2["catch"](2);
389
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.INITIAL_STATE, Actions.FAILED);
390
- throw _context2.t0;
391
- case 14:
392
- case "end":
393
- return _context2.stop();
394
- }
373
+ while (1) switch (_context2.prev = _context2.next) {
374
+ case 0:
375
+ queryParams = this.getQueryParams(contextIdentifier);
376
+ options = {
377
+ path: 'bootstrap',
378
+ queryParams: queryParams
379
+ };
380
+ _context2.prev = 2;
381
+ _context2.next = 5;
382
+ return serviceUtils.requestService(this.config, options);
383
+ case 5:
384
+ result = _context2.sent;
385
+ this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.INITIAL_STATE, Actions.SUCCEEDED);
386
+ return _context2.abrupt("return", this.transformServiceResponse(result, ''));
387
+ case 10:
388
+ _context2.prev = 10;
389
+ _context2.t0 = _context2["catch"](2);
390
+ this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.INITIAL_STATE, Actions.FAILED);
391
+ throw _context2.t0;
392
+ case 14:
393
+ case "end":
394
+ return _context2.stop();
395
395
  }
396
396
  }, _callee2, this, [[2, 10]]);
397
397
  }));
@@ -413,32 +413,30 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
413
413
  var _remoteSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(query, contextIdentifier) {
414
414
  var options, result;
415
415
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
416
- while (1) {
417
- switch (_context3.prev = _context3.next) {
418
- case 0:
419
- options = {
420
- path: 'search',
421
- queryParams: _objectSpread({
422
- query: query,
423
- limit: MAX_QUERY_ITEMS
424
- }, this.getQueryParams(contextIdentifier))
425
- };
426
- _context3.prev = 1;
427
- _context3.next = 4;
428
- return serviceUtils.requestService(this.config, options);
429
- case 4:
430
- result = _context3.sent;
431
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH, Actions.SUCCEEDED);
432
- return _context3.abrupt("return", this.transformServiceResponse(result, query));
433
- case 9:
434
- _context3.prev = 9;
435
- _context3.t0 = _context3["catch"](1);
436
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH, Actions.FAILED);
437
- throw _context3.t0;
438
- case 13:
439
- case "end":
440
- return _context3.stop();
441
- }
416
+ while (1) switch (_context3.prev = _context3.next) {
417
+ case 0:
418
+ options = {
419
+ path: 'search',
420
+ queryParams: _objectSpread({
421
+ query: query,
422
+ limit: MAX_QUERY_ITEMS
423
+ }, this.getQueryParams(contextIdentifier))
424
+ };
425
+ _context3.prev = 1;
426
+ _context3.next = 4;
427
+ return serviceUtils.requestService(this.config, options);
428
+ case 4:
429
+ result = _context3.sent;
430
+ this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH, Actions.SUCCEEDED);
431
+ return _context3.abrupt("return", this.transformServiceResponse(result, query));
432
+ case 9:
433
+ _context3.prev = 9;
434
+ _context3.t0 = _context3["catch"](1);
435
+ this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH, Actions.FAILED);
436
+ throw _context3.t0;
437
+ case 13:
438
+ case "end":
439
+ return _context3.stop();
442
440
  }
443
441
  }, _callee3, this, [[1, 9]]);
444
442
  }));
@@ -473,35 +471,33 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
473
471
  var _recordSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(mention, contextIdentifier) {
474
472
  var options, sliName, result;
475
473
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
476
- while (1) {
477
- switch (_context4.prev = _context4.next) {
478
- case 0:
479
- options = {
480
- path: 'record',
481
- queryParams: _objectSpread({
482
- selectedUserId: mention.id
483
- }, this.getQueryParams(contextIdentifier)),
484
- requestInit: {
485
- method: 'POST'
486
- }
487
- };
488
- sliName = isTeamMention(mention) ? SliNames.SELECT_TEAM : SliNames.SELECT;
489
- _context4.prev = 2;
490
- _context4.next = 5;
491
- return serviceUtils.requestService(this.config, options);
492
- case 5:
493
- result = _context4.sent;
494
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, sliName, Actions.SUCCEEDED);
495
- return _context4.abrupt("return", result);
496
- case 10:
497
- _context4.prev = 10;
498
- _context4.t0 = _context4["catch"](2);
499
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, sliName, Actions.FAILED);
500
- throw _context4.t0;
501
- case 14:
502
- case "end":
503
- return _context4.stop();
504
- }
474
+ while (1) switch (_context4.prev = _context4.next) {
475
+ case 0:
476
+ options = {
477
+ path: 'record',
478
+ queryParams: _objectSpread({
479
+ selectedUserId: mention.id
480
+ }, this.getQueryParams(contextIdentifier)),
481
+ requestInit: {
482
+ method: 'POST'
483
+ }
484
+ };
485
+ sliName = isTeamMention(mention) ? SliNames.SELECT_TEAM : SliNames.SELECT;
486
+ _context4.prev = 2;
487
+ _context4.next = 5;
488
+ return serviceUtils.requestService(this.config, options);
489
+ case 5:
490
+ result = _context4.sent;
491
+ this._notifyAnalyticsListeners(SLI_EVENT_TYPE, sliName, Actions.SUCCEEDED);
492
+ return _context4.abrupt("return", result);
493
+ case 10:
494
+ _context4.prev = 10;
495
+ _context4.t0 = _context4["catch"](2);
496
+ this._notifyAnalyticsListeners(SLI_EVENT_TYPE, sliName, Actions.FAILED);
497
+ throw _context4.t0;
498
+ case 14:
499
+ case "end":
500
+ return _context4.stop();
505
501
  }
506
502
  }, _callee4, this, [[2, 10]]);
507
503
  }));
@@ -6,7 +6,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
6
6
  import _createClass from "@babel/runtime/helpers/createClass";
7
7
  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; } } }; }
8
8
  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); }
9
- 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; }
9
+ 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; }
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  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; } }
12
12
  import debug from '../util/logger';
@@ -64,22 +64,20 @@ var TeamMentionResource = /*#__PURE__*/function (_MentionResource) {
64
64
  var _remoteInitialStateTeamAndUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(contextIdentifier) {
65
65
  var emptyQuery, getUserPromise, queryParams, options, getTeamsPromise;
66
66
  return _regeneratorRuntime.wrap(function _callee$(_context) {
67
- while (1) {
68
- switch (_context.prev = _context.next) {
69
- case 0:
70
- emptyQuery = '';
71
- getUserPromise = _get(_getPrototypeOf(TeamMentionResource.prototype), "remoteInitialState", this).call(this, contextIdentifier);
72
- queryParams = this.getQueryParamsOfTeamMentionConfig(contextIdentifier);
73
- options = {
74
- path: 'bootstrap',
75
- queryParams: queryParams
76
- };
77
- getTeamsPromise = serviceUtils.requestService(this.teamMentionConfig, options);
78
- this.handleBothRequests(emptyQuery, getUserPromise, getTeamsPromise);
79
- case 6:
80
- case "end":
81
- return _context.stop();
82
- }
67
+ while (1) switch (_context.prev = _context.next) {
68
+ case 0:
69
+ emptyQuery = '';
70
+ getUserPromise = _get(_getPrototypeOf(TeamMentionResource.prototype), "remoteInitialState", this).call(this, contextIdentifier);
71
+ queryParams = this.getQueryParamsOfTeamMentionConfig(contextIdentifier);
72
+ options = {
73
+ path: 'bootstrap',
74
+ queryParams: queryParams
75
+ };
76
+ getTeamsPromise = serviceUtils.requestService(this.teamMentionConfig, options);
77
+ this.handleBothRequests(emptyQuery, getUserPromise, getTeamsPromise);
78
+ case 6:
79
+ case "end":
80
+ return _context.stop();
83
81
  }
84
82
  }, _callee, this);
85
83
  }));
@@ -102,70 +100,68 @@ var TeamMentionResource = /*#__PURE__*/function (_MentionResource) {
102
100
  var _this2 = this;
103
101
  var searchTime, accumulatedResults, notifyWhenOneRequestDone, userResults, userRequestError, teamRequestError, teamsResult;
104
102
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
105
- while (1) {
106
- switch (_context2.prev = _context2.next) {
107
- case 0:
108
- searchTime = Date.now();
103
+ while (1) switch (_context2.prev = _context2.next) {
104
+ case 0:
105
+ searchTime = Date.now();
106
+ accumulatedResults = {
107
+ mentions: [],
108
+ query: query
109
+ };
110
+ notifyWhenOneRequestDone = function notifyWhenOneRequestDone(results, hasTeamResults) {
111
+ // just update UI for the last query string
112
+ if (query !== _this2.lastSearchQuery) {
113
+ return;
114
+ }
109
115
  accumulatedResults = {
110
- mentions: [],
116
+ mentions: [].concat(_toConsumableArray(accumulatedResults.mentions), _toConsumableArray(results.mentions)),
111
117
  query: query
112
118
  };
113
- notifyWhenOneRequestDone = function notifyWhenOneRequestDone(results, hasTeamResults) {
114
- // just update UI for the last query string
115
- if (query !== _this2.lastSearchQuery) {
116
- return;
117
- }
118
- accumulatedResults = {
119
- mentions: [].concat(_toConsumableArray(accumulatedResults.mentions), _toConsumableArray(results.mentions)),
120
- query: query
121
- };
122
119
 
123
- // we need to calculate different `duration` for user and team request.
124
- if (hasTeamResults) {
125
- _this2.notify(searchTime, accumulatedResults, query);
126
- } else {
127
- _get(_getPrototypeOf(TeamMentionResource.prototype), "notify", _this2).call(_this2, searchTime, accumulatedResults, query);
128
- }
129
- };
130
- userRequestError = null;
131
- teamRequestError = null;
132
- _context2.prev = 5;
133
- _context2.next = 8;
134
- return userRequest;
135
- case 8:
136
- userResults = _context2.sent;
137
- notifyWhenOneRequestDone(userResults, false);
138
- _context2.next = 15;
139
- break;
140
- case 12:
141
- _context2.prev = 12;
142
- _context2.t0 = _context2["catch"](5);
143
- userRequestError = _context2.t0;
144
- case 15:
145
- _context2.prev = 15;
146
- _context2.next = 18;
147
- return teamRequest;
148
- case 18:
149
- teamsResult = _context2.sent;
150
- // update search time after team results returns
151
- notifyWhenOneRequestDone(Array.isArray(teamsResult) ? this.convertTeamResultToMentionResult(teamsResult, query) : teamsResult, true);
152
- _context2.next = 25;
153
- break;
154
- case 22:
155
- _context2.prev = 22;
156
- _context2.t1 = _context2["catch"](15);
157
- teamRequestError = _context2.t1;
158
- case 25:
159
- // both requests fail, show one of errors in UI
160
- if (userRequestError && teamRequestError) {
161
- this.notifyError(userRequestError, query);
162
- debug('User mention request fails. ', userRequestError);
163
- debug('Team mention request fails. ', teamRequestError);
120
+ // we need to calculate different `duration` for user and team request.
121
+ if (hasTeamResults) {
122
+ _this2.notify(searchTime, accumulatedResults, query);
123
+ } else {
124
+ _get(_getPrototypeOf(TeamMentionResource.prototype), "notify", _this2).call(_this2, searchTime, accumulatedResults, query);
164
125
  }
165
- case 26:
166
- case "end":
167
- return _context2.stop();
168
- }
126
+ };
127
+ userRequestError = null;
128
+ teamRequestError = null;
129
+ _context2.prev = 5;
130
+ _context2.next = 8;
131
+ return userRequest;
132
+ case 8:
133
+ userResults = _context2.sent;
134
+ notifyWhenOneRequestDone(userResults, false);
135
+ _context2.next = 15;
136
+ break;
137
+ case 12:
138
+ _context2.prev = 12;
139
+ _context2.t0 = _context2["catch"](5);
140
+ userRequestError = _context2.t0;
141
+ case 15:
142
+ _context2.prev = 15;
143
+ _context2.next = 18;
144
+ return teamRequest;
145
+ case 18:
146
+ teamsResult = _context2.sent;
147
+ // update search time after team results returns
148
+ notifyWhenOneRequestDone(Array.isArray(teamsResult) ? this.convertTeamResultToMentionResult(teamsResult, query) : teamsResult, true);
149
+ _context2.next = 25;
150
+ break;
151
+ case 22:
152
+ _context2.prev = 22;
153
+ _context2.t1 = _context2["catch"](15);
154
+ teamRequestError = _context2.t1;
155
+ case 25:
156
+ // both requests fail, show one of errors in UI
157
+ if (userRequestError && teamRequestError) {
158
+ this.notifyError(userRequestError, query);
159
+ debug('User mention request fails. ', userRequestError);
160
+ debug('Team mention request fails. ', teamRequestError);
161
+ }
162
+ case 26:
163
+ case "end":
164
+ return _context2.stop();
169
165
  }
170
166
  }, _callee2, this, [[5, 12], [15, 22]]);
171
167
  }));
@@ -214,32 +210,30 @@ var TeamMentionResource = /*#__PURE__*/function (_MentionResource) {
214
210
  var _remoteTeamSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(query, contextIdentifier) {
215
211
  var options, teamResult;
216
212
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
217
- while (1) {
218
- switch (_context3.prev = _context3.next) {
219
- case 0:
220
- options = {
221
- path: 'search',
222
- queryParams: _objectSpread({
223
- query: query,
224
- limit: MAX_QUERY_TEAMS
225
- }, this.getQueryParamsOfTeamMentionConfig(contextIdentifier))
226
- };
227
- _context3.prev = 1;
228
- _context3.next = 4;
229
- return serviceUtils.requestService(this.teamMentionConfig, options);
230
- case 4:
231
- teamResult = _context3.sent;
232
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH_TEAM, Actions.SUCCEEDED);
233
- return _context3.abrupt("return", this.convertTeamResultToMentionResult(teamResult, query));
234
- case 9:
235
- _context3.prev = 9;
236
- _context3.t0 = _context3["catch"](1);
237
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH_TEAM, Actions.FAILED);
238
- throw _context3.t0;
239
- case 13:
240
- case "end":
241
- return _context3.stop();
242
- }
213
+ while (1) switch (_context3.prev = _context3.next) {
214
+ case 0:
215
+ options = {
216
+ path: 'search',
217
+ queryParams: _objectSpread({
218
+ query: query,
219
+ limit: MAX_QUERY_TEAMS
220
+ }, this.getQueryParamsOfTeamMentionConfig(contextIdentifier))
221
+ };
222
+ _context3.prev = 1;
223
+ _context3.next = 4;
224
+ return serviceUtils.requestService(this.teamMentionConfig, options);
225
+ case 4:
226
+ teamResult = _context3.sent;
227
+ this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH_TEAM, Actions.SUCCEEDED);
228
+ return _context3.abrupt("return", this.convertTeamResultToMentionResult(teamResult, query));
229
+ case 9:
230
+ _context3.prev = 9;
231
+ _context3.t0 = _context3["catch"](1);
232
+ this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH_TEAM, Actions.FAILED);
233
+ throw _context3.t0;
234
+ case 13:
235
+ case "end":
236
+ return _context3.stop();
243
237
  }
244
238
  }, _callee3, this, [[1, 9]]);
245
239
  }));