@atlaskit/mention 22.0.1 → 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 +10 -0
  2. package/dist/cjs/api/MentionNameResolver.js +0 -2
  3. package/dist/cjs/api/MentionResource.js +113 -122
  4. package/dist/cjs/api/PresenceResource.js +1 -1
  5. package/dist/cjs/api/TeamMentionResource.js +102 -109
  6. package/dist/cjs/api/analytics.js +4 -4
  7. package/dist/cjs/components/LockCircleIcon/index.js +1 -1
  8. package/dist/cjs/components/MentionItem/index.js +2 -1
  9. package/dist/cjs/components/MentionList/index.js +1 -2
  10. package/dist/cjs/components/MentionPicker/index.js +8 -10
  11. package/dist/cjs/components/NoAccessTooltip/index.js +1 -1
  12. package/dist/cjs/components/ResourcedMentionList/index.js +2 -4
  13. package/dist/cjs/components/Scrollable/index.js +2 -1
  14. package/dist/cjs/types.js +16 -16
  15. package/dist/cjs/util/analytics.js +12 -12
  16. package/dist/cjs/util/i18n.js +197 -199
  17. package/dist/cjs/version.json +1 -1
  18. package/dist/es2019/api/MentionNameResolver.js +0 -2
  19. package/dist/es2019/api/analytics.js +3 -3
  20. package/dist/es2019/components/MentionItem/index.js +2 -1
  21. package/dist/es2019/components/MentionList/index.js +1 -2
  22. package/dist/es2019/components/MentionPicker/index.js +8 -11
  23. package/dist/es2019/components/ResourcedMentionList/index.js +2 -6
  24. package/dist/es2019/components/Scrollable/index.js +2 -1
  25. package/dist/es2019/types.js +12 -12
  26. package/dist/es2019/util/analytics.js +9 -9
  27. package/dist/es2019/version.json +1 -1
  28. package/dist/esm/api/MentionNameResolver.js +0 -2
  29. package/dist/esm/api/MentionResource.js +113 -122
  30. package/dist/esm/api/PresenceResource.js +1 -1
  31. package/dist/esm/api/TeamMentionResource.js +102 -109
  32. package/dist/esm/api/analytics.js +3 -3
  33. package/dist/esm/components/MentionItem/index.js +2 -1
  34. package/dist/esm/components/MentionList/index.js +1 -2
  35. package/dist/esm/components/MentionPicker/index.js +8 -10
  36. package/dist/esm/components/ResourcedMentionList/index.js +2 -4
  37. package/dist/esm/components/Scrollable/index.js +2 -1
  38. package/dist/esm/types.js +12 -12
  39. package/dist/esm/util/analytics.js +9 -9
  40. package/dist/esm/util/i18n.js +137 -140
  41. package/dist/esm/version.json +1 -1
  42. package/package.json +18 -18
@@ -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.1",
3
+ "version": "22.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -5,8 +5,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import { MentionNameStatus } from '../types';
6
6
  import { fireAnalyticsMentionHydrationEvent } from '../util/analytics';
7
7
  export var DefaultMentionNameResolver = /*#__PURE__*/function () {
8
- // ms
9
-
10
8
  function DefaultMentionNameResolver(client) {
11
9
  var _this = this;
12
10
  var analyticsProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -1,4 +1,3 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _inherits from "@babel/runtime/helpers/inherits";
@@ -8,7 +7,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
8
7
  import _createClass from "@babel/runtime/helpers/createClass";
9
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
12
11
  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); }; }
13
12
  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; } }
14
13
  import { utils as serviceUtils } from '@atlaskit/util-service-support';
@@ -225,43 +224,41 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
225
224
  }, {
226
225
  key: "filter",
227
226
  value: function () {
228
- var _filter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, contextIdentifier) {
227
+ var _filter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(query, contextIdentifier) {
229
228
  var searchTime, results, searchResponse;
230
- return _regeneratorRuntime().wrap(function _callee$(_context) {
231
- while (1) {
232
- switch (_context.prev = _context.next) {
233
- case 0:
234
- _context.prev = 0;
235
- searchTime = Date.now();
236
- if (query) {
237
- _context.next = 8;
238
- break;
239
- }
240
- _context.next = 5;
241
- return this.initialState(contextIdentifier);
242
- case 5:
243
- results = _context.sent;
244
- _context.next = 13;
245
- break;
246
- case 8:
247
- this.activeSearches.add(query);
248
- searchResponse = this.search(query, contextIdentifier);
249
- _context.next = 12;
250
- return searchResponse.mentions;
251
- case 12:
252
- results = _context.sent;
253
- case 13:
254
- this.notify(searchTime, results, query);
255
- _context.next = 19;
229
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
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;
256
236
  break;
257
- case 16:
258
- _context.prev = 16;
259
- _context.t0 = _context["catch"](0);
260
- this.notifyError(_context.t0, query);
261
- case 19:
262
- case "end":
263
- return _context.stop();
264
- }
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();
265
262
  }
266
263
  }, _callee, this, [[0, 16]]);
267
264
  }));
@@ -370,33 +367,31 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
370
367
  }, {
371
368
  key: "remoteInitialState",
372
369
  value: function () {
373
- var _remoteInitialState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(contextIdentifier) {
370
+ var _remoteInitialState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(contextIdentifier) {
374
371
  var queryParams, options, result;
375
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
376
- while (1) {
377
- switch (_context2.prev = _context2.next) {
378
- case 0:
379
- queryParams = this.getQueryParams(contextIdentifier);
380
- options = {
381
- path: 'bootstrap',
382
- queryParams: queryParams
383
- };
384
- _context2.prev = 2;
385
- _context2.next = 5;
386
- return serviceUtils.requestService(this.config, options);
387
- case 5:
388
- result = _context2.sent;
389
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.INITIAL_STATE, Actions.SUCCEEDED);
390
- return _context2.abrupt("return", this.transformServiceResponse(result, ''));
391
- case 10:
392
- _context2.prev = 10;
393
- _context2.t0 = _context2["catch"](2);
394
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.INITIAL_STATE, Actions.FAILED);
395
- throw _context2.t0;
396
- case 14:
397
- case "end":
398
- return _context2.stop();
399
- }
372
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
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();
400
395
  }
401
396
  }, _callee2, this, [[2, 10]]);
402
397
  }));
@@ -415,35 +410,33 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
415
410
  }, {
416
411
  key: "remoteSearch",
417
412
  value: function () {
418
- var _remoteSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(query, contextIdentifier) {
413
+ var _remoteSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(query, contextIdentifier) {
419
414
  var options, result;
420
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
421
- while (1) {
422
- switch (_context3.prev = _context3.next) {
423
- case 0:
424
- options = {
425
- path: 'search',
426
- queryParams: _objectSpread({
427
- query: query,
428
- limit: MAX_QUERY_ITEMS
429
- }, this.getQueryParams(contextIdentifier))
430
- };
431
- _context3.prev = 1;
432
- _context3.next = 4;
433
- return serviceUtils.requestService(this.config, options);
434
- case 4:
435
- result = _context3.sent;
436
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH, Actions.SUCCEEDED);
437
- return _context3.abrupt("return", this.transformServiceResponse(result, query));
438
- case 9:
439
- _context3.prev = 9;
440
- _context3.t0 = _context3["catch"](1);
441
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH, Actions.FAILED);
442
- throw _context3.t0;
443
- case 13:
444
- case "end":
445
- return _context3.stop();
446
- }
415
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
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();
447
440
  }
448
441
  }, _callee3, this, [[1, 9]]);
449
442
  }));
@@ -475,38 +468,36 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
475
468
  }, {
476
469
  key: "recordSelection",
477
470
  value: function () {
478
- var _recordSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(mention, contextIdentifier) {
471
+ var _recordSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(mention, contextIdentifier) {
479
472
  var options, sliName, result;
480
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
481
- while (1) {
482
- switch (_context4.prev = _context4.next) {
483
- case 0:
484
- options = {
485
- path: 'record',
486
- queryParams: _objectSpread({
487
- selectedUserId: mention.id
488
- }, this.getQueryParams(contextIdentifier)),
489
- requestInit: {
490
- method: 'POST'
491
- }
492
- };
493
- sliName = isTeamMention(mention) ? SliNames.SELECT_TEAM : SliNames.SELECT;
494
- _context4.prev = 2;
495
- _context4.next = 5;
496
- return serviceUtils.requestService(this.config, options);
497
- case 5:
498
- result = _context4.sent;
499
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, sliName, Actions.SUCCEEDED);
500
- return _context4.abrupt("return", result);
501
- case 10:
502
- _context4.prev = 10;
503
- _context4.t0 = _context4["catch"](2);
504
- this._notifyAnalyticsListeners(SLI_EVENT_TYPE, sliName, Actions.FAILED);
505
- throw _context4.t0;
506
- case 14:
507
- case "end":
508
- return _context4.stop();
509
- }
473
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
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();
510
501
  }
511
502
  }, _callee4, this, [[2, 10]]);
512
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';