@atlaskit/mention 19.7.1 → 19.9.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/mention
2
2
 
3
+ ## 19.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e65ada9dbbb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e65ada9dbbb) - Debounce MentionResource when debounceTime is passed in
8
+
9
+ ## 19.8.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`e5e658bc51d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e5e658bc51d) - Fix for mention default name provider using an incorrect API endpoint when no baseUrl was supplied to SmartMentionResource
14
+
15
+ ## 19.8.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`9871a89fe5d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9871a89fe5d) - SmartMentionResource now has a default name resolver if one is not provided. You can still provide the `mentionNameResolver` in the config when instantiating SmartMentionResource if a custom name resolver is needed.
20
+
21
+ ## 19.7.2
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+
3
27
  ## 19.7.1
4
28
 
5
29
  ### Patch Changes
@@ -31,6 +31,8 @@ var _logger = _interopRequireDefault(require("../util/logger"));
31
31
 
32
32
  var _analytics = require("../util/analytics");
33
33
 
34
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
35
+
34
36
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
35
37
 
36
38
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -221,6 +223,11 @@ var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
221
223
  _this.inviteExperimentCohort = config.inviteExperimentCohort;
222
224
  _this.onInviteItemClick = config.onInviteItemClick;
223
225
  _this.userRole = config.userRole || 'basic';
226
+
227
+ if (_this.config.debounceTime) {
228
+ _this.filter = (0, _debounce.default)(_this.filter, _this.config.debounceTime);
229
+ }
230
+
224
231
  return _this;
225
232
  }
226
233
 
@@ -7,12 +7,12 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
11
 
14
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
13
 
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+
16
16
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
17
 
18
18
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -35,6 +35,8 @@ var _types = require("../types");
35
35
 
36
36
  var _resource = require("../resource");
37
37
 
38
+ var _defaultMentionNameResolver = require("../default-mention-name-resolver/default-mention-name-resolver");
39
+
38
40
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
39
41
 
40
42
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -45,6 +47,9 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
45
47
 
46
48
  var CONTEXT_TYPE = 'Mentions';
47
49
 
50
+ var isSmartMentionConfigWithMentionNameResolver = function isSmartMentionConfigWithMentionNameResolver(smartMentionConfig) {
51
+ return !!smartMentionConfig.mentionNameResolver;
52
+ };
48
53
  /*
49
54
  * This is a provider implementation which calls URS to provide a list of recommended users/teams to mention.
50
55
  * The entryPoint hierarchy is : Editor -> editor-core -> plugins -> mentions -> typeAhead -> getItems -> pluginState.pluginProvider.filter
@@ -52,6 +57,8 @@ var CONTEXT_TYPE = 'Mentions';
52
57
  * https://bitbucket.org/atlassian/atlassian-frontend/src/0884032d85f11f43c13532cd21f13f696b0d28a7/packages/editor/editor-core/src/plugins/mentions/index.tsx#lines-219
53
58
  *
54
59
  */
60
+
61
+
55
62
  var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
56
63
  (0, _inherits2.default)(SmartMentionResource, _AbstractMentionResou);
57
64
 
@@ -61,9 +68,18 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
61
68
  var _this;
62
69
 
63
70
  (0, _classCallCheck2.default)(this, SmartMentionResource);
64
- _this = _super.call(this);
65
- _this.smartMentionConfig = smartMentionConfig;
66
- _this.lastReturnedSearch = 0;
71
+ _this = _super.call(this); // If the product doesn't provide a mention name resolve, use the default resolver so that
72
+ // mention names can be looked up from PRS without configuration.
73
+
74
+ _this.smartMentionConfig = isSmartMentionConfigWithMentionNameResolver(smartMentionConfig) ? smartMentionConfig : _objectSpread(_objectSpread({}, smartMentionConfig), {}, {
75
+ mentionNameResolver: new _defaultMentionNameResolver.DefaultMentionNameResolver(smartMentionConfig.baseUrl)
76
+ });
77
+ _this.lastReturnedSearch = 0; // Set the environment used for mention lookup API calls (defaults to production)
78
+
79
+ if (smartMentionConfig.env) {
80
+ (0, _config.setEnv)(smartMentionConfig.env);
81
+ }
82
+
67
83
  return _this;
68
84
  }
69
85
 
@@ -147,11 +163,6 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
147
163
  startTime = window.performance.now();
148
164
  conf = this.smartMentionConfig;
149
165
  maxNumberOfResults = conf.maxNumberOfResults || 100;
150
-
151
- if (conf.env) {
152
- (0, _config.setEnv)(conf.env);
153
- }
154
-
155
166
  request = {
156
167
  baseUrl: conf.baseUrl,
157
168
  context: _objectSpread(_objectSpread({}, conf), {}, {
@@ -167,14 +178,14 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
167
178
  maxNumberOfResults: maxNumberOfResults,
168
179
  query: query
169
180
  };
170
- _context2.prev = 5;
181
+ _context2.prev = 4;
171
182
 
172
183
  this._notifyAnalyticsListeners(_analytics.SMART_EVENT_TYPE, 'users', _analytics.Actions.REQUESTED, (0, _analytics.defaultAttributes)(contextIdentifier));
173
184
 
174
- _context2.next = 9;
185
+ _context2.next = 8;
175
186
  return (0, _recommendationClient.default)(request);
176
187
 
177
- case 9:
188
+ case 8:
178
189
  users = _context2.sent;
179
190
  elapsedTimeMilli = window.performance.now() - startTime;
180
191
  usersForAnalytics = (0, _analytics.getUsersForAnalytics)(users);
@@ -191,9 +202,9 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
191
202
  query: query
192
203
  });
193
204
 
194
- case 17:
195
- _context2.prev = 17;
196
- _context2.t0 = _context2["catch"](5);
205
+ case 16:
206
+ _context2.prev = 16;
207
+ _context2.t0 = _context2["catch"](4);
197
208
  _elapsedTimeMilli = window.performance.now() - startTime;
198
209
 
199
210
  this._notifyAnalyticsListeners(_analytics.SMART_EVENT_TYPE, 'usersRequest', _analytics.Actions.FAILED, _objectSpread({
@@ -202,12 +213,12 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
202
213
 
203
214
  throw new Error(_context2.t0);
204
215
 
205
- case 22:
216
+ case 21:
206
217
  case "end":
207
218
  return _context2.stop();
208
219
  }
209
220
  }
210
- }, _callee2, this, [[5, 17]]);
221
+ }, _callee2, this, [[4, 16]]);
211
222
  }));
212
223
 
213
224
  function getRecommendedMentions(_x3, _x4) {
@@ -302,27 +313,17 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
302
313
  }, {
303
314
  key: "cacheMentionName",
304
315
  value: function cacheMentionName(id, mentionName) {
305
- if (this.smartMentionConfig.mentionNameResolver) {
306
- this.smartMentionConfig.mentionNameResolver.cacheName(id, mentionName);
307
- }
316
+ this.smartMentionConfig.mentionNameResolver.cacheName(id, mentionName);
308
317
  }
309
318
  }, {
310
319
  key: "resolveMentionName",
311
320
  value: function resolveMentionName(id) {
312
- if (!this.smartMentionConfig.mentionNameResolver) {
313
- return {
314
- id: id,
315
- name: '',
316
- status: _types.MentionNameStatus.UNKNOWN
317
- };
318
- }
319
-
320
321
  return this.smartMentionConfig.mentionNameResolver.lookupName(id);
321
322
  }
322
323
  }, {
323
324
  key: "supportsMentionNameResolving",
324
325
  value: function supportsMentionNameResolving() {
325
- return !!this.smartMentionConfig.mentionNameResolver;
326
+ return true;
326
327
  }
327
328
  }, {
328
329
  key: "recordMentionSelection",
@@ -12,14 +12,20 @@ var LOCAL_CONFIG = {
12
12
  },
13
13
  getUsersServiceUrl: function getUsersServiceUrl(productKey) {
14
14
  return productKey === 'jira' ? "https://jdog.jira-dev.com/rest/api/3/user/bulk" : "https://pug.jira-dev.com/wiki/rest/api/user/bulk";
15
+ },
16
+ getGraphQLUrl: function getGraphQLUrl(baseUrl) {
17
+ return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/graphql") : "".concat(STG_INSTANCE, "/gateway/api/graphql");
15
18
  }
16
19
  };
17
20
  var PRD_CONFIG = {
18
21
  getRecommendationServiceUrl: function getRecommendationServiceUrl(baseUrl) {
19
- return baseUrl ? "/".concat(baseUrl, "/gateway/api/v1/recommendations") : '/gateway/api/v1/recommendations';
22
+ return baseUrl ? "/".concat(baseUrl, "/v1/recommendations") : '/gateway/api/v1/recommendations';
20
23
  },
21
24
  getUsersServiceUrl: function getUsersServiceUrl(productKey) {
22
- return productKey === 'jira' ? "/rest/api/3/user/bulk" : "/wiki/rest/api/user/bulk";
25
+ return productKey === 'jira' ? '/rest/api/3/user/bulk' : '/wiki/rest/api/user/bulk';
26
+ },
27
+ getGraphQLUrl: function getGraphQLUrl(baseUrl) {
28
+ return baseUrl ? "/".concat(baseUrl, "/graphql") : '/gateway/api/graphql';
23
29
  }
24
30
  };
25
31
 
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.DefaultMentionNameResolver = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
15
+
16
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
+
18
+ var _types = require("../types");
19
+
20
+ var _graphqlUtils = require("./graphqlUtils");
21
+
22
+ var _config = require("../config");
23
+
24
+ var buildUsersQuery = function buildUsersQuery(accountIds) {
25
+ return {
26
+ query: "query usersQuery($accountIds: [ID!]!) {\n users(accountIds: $accountIds) {\n name\n accountId\n }\n }",
27
+ variables: {
28
+ accountIds: accountIds
29
+ }
30
+ };
31
+ };
32
+
33
+ var makeRequest = /*#__PURE__*/function () {
34
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, accountIds) {
35
+ var query;
36
+ return _regenerator.default.wrap(function _callee$(_context) {
37
+ while (1) {
38
+ switch (_context.prev = _context.next) {
39
+ case 0:
40
+ query = buildUsersQuery(accountIds);
41
+ return _context.abrupt("return", (0, _graphqlUtils.graphqlQuery)(url, query));
42
+
43
+ case 2:
44
+ case "end":
45
+ return _context.stop();
46
+ }
47
+ }
48
+ }, _callee);
49
+ }));
50
+
51
+ return function makeRequest(_x, _x2) {
52
+ return _ref.apply(this, arguments);
53
+ };
54
+ }();
55
+
56
+ var DefaultMentionNameResolver = /*#__PURE__*/function () {
57
+ function DefaultMentionNameResolver(baseUrl) {
58
+ (0, _classCallCheck2.default)(this, DefaultMentionNameResolver);
59
+ this.baseUrl = baseUrl;
60
+ this.cache = new Map();
61
+ }
62
+
63
+ (0, _createClass2.default)(DefaultMentionNameResolver, [{
64
+ key: "lookupName",
65
+ value: function () {
66
+ var _lookupName = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id) {
67
+ var url, data, userInfo;
68
+ return _regenerator.default.wrap(function _callee2$(_context2) {
69
+ while (1) {
70
+ switch (_context2.prev = _context2.next) {
71
+ case 0:
72
+ _context2.prev = 0;
73
+
74
+ if (!this.cache.has(id)) {
75
+ _context2.next = 3;
76
+ break;
77
+ }
78
+
79
+ return _context2.abrupt("return", {
80
+ id: id,
81
+ name: this.cache.get(id),
82
+ status: _types.MentionNameStatus.OK
83
+ });
84
+
85
+ case 3:
86
+ url = (0, _config.getConfig)().getGraphQLUrl(this.baseUrl);
87
+ _context2.next = 6;
88
+ return makeRequest(url, [id]);
89
+
90
+ case 6:
91
+ data = _context2.sent;
92
+ userInfo = data.users.find(function (user) {
93
+ return user.accountId === id;
94
+ });
95
+ return _context2.abrupt("return", userInfo ? {
96
+ id: id,
97
+ name: userInfo.name,
98
+ status: _types.MentionNameStatus.OK
99
+ } : {
100
+ id: id,
101
+ status: _types.MentionNameStatus.UNKNOWN
102
+ });
103
+
104
+ case 11:
105
+ _context2.prev = 11;
106
+ _context2.t0 = _context2["catch"](0);
107
+ return _context2.abrupt("return", {
108
+ id: id,
109
+ status: _types.MentionNameStatus.UNKNOWN
110
+ });
111
+
112
+ case 14:
113
+ case "end":
114
+ return _context2.stop();
115
+ }
116
+ }
117
+ }, _callee2, this, [[0, 11]]);
118
+ }));
119
+
120
+ function lookupName(_x3) {
121
+ return _lookupName.apply(this, arguments);
122
+ }
123
+
124
+ return lookupName;
125
+ }()
126
+ }, {
127
+ key: "cacheName",
128
+ value: function cacheName(id, name) {
129
+ this.cache.set(id, name);
130
+ }
131
+ }]);
132
+ return DefaultMentionNameResolver;
133
+ }();
134
+
135
+ exports.DefaultMentionNameResolver = DefaultMentionNameResolver;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.graphqlQuery = graphqlQuery;
7
+
8
+ var buildHeaders = function buildHeaders() {
9
+ var headers = new Headers();
10
+ headers.append('Content-Type', 'application/json');
11
+ return headers;
12
+ };
13
+
14
+ /**
15
+ * @param {string} serviceUrl - GraphQL service endpoint
16
+ * @param {Query} query - GraphQL query
17
+ */
18
+ function graphqlQuery(serviceUrl, query) {
19
+ var headers = buildHeaders();
20
+ return fetch(new Request("".concat(serviceUrl), {
21
+ method: 'POST',
22
+ credentials: 'include',
23
+ mode: 'cors',
24
+ headers: headers,
25
+ body: JSON.stringify(query)
26
+ })).then(function (response) {
27
+ if (!response.ok) {
28
+ return Promise.reject({
29
+ code: response.status,
30
+ reason: response.statusText
31
+ });
32
+ }
33
+
34
+ return response;
35
+ }).then(function (response) {
36
+ return response.json();
37
+ }).then(function (json) {
38
+ if (json.errors) {
39
+ var _json$errors$;
40
+
41
+ return Promise.reject({
42
+ reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || 'default'
43
+ });
44
+ }
45
+
46
+ return json.data;
47
+ });
48
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.7.1",
3
+ "version": "19.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -6,6 +6,7 @@ const MAX_NOTIFIED_ITEMS = 20;
6
6
  // Re-exporting types to prevent breaking change
7
7
  // Re-exporting types to prevent breaking change
8
8
  import { SLI_EVENT_TYPE, Actions, SliNames } from '../util/analytics';
9
+ import debounce from 'lodash/debounce';
9
10
 
10
11
  const emptySecurityProvider = () => {
11
12
  return {
@@ -148,6 +149,10 @@ export class MentionResource extends AbstractMentionResource {
148
149
  this.inviteExperimentCohort = config.inviteExperimentCohort;
149
150
  this.onInviteItemClick = config.onInviteItemClick;
150
151
  this.userRole = config.userRole || 'basic';
152
+
153
+ if (this.config.debounceTime) {
154
+ this.filter = debounce(this.filter, this.config.debounceTime);
155
+ }
151
156
  }
152
157
 
153
158
  shouldHighlightMention(mention) {
@@ -1,12 +1,13 @@
1
- import { SMART_EVENT_TYPE, Actions } from './analytics';
1
+ import { SMART_EVENT_TYPE, Actions, getUsersForAnalytics, defaultAttributes } from './analytics';
2
2
  import getUserRecommendations from './recommendationClient';
3
3
  import { setEnv } from '../config';
4
4
  import { EntityType } from './SmartMentionTypes';
5
- import { UserAccessLevel, UserType as MentionUserType, MentionNameStatus } from '../types';
6
- import { getUsersForAnalytics, defaultAttributes } from './analytics';
5
+ import { UserAccessLevel, UserType as MentionUserType } from '../types';
7
6
  import { AbstractMentionResource } from '../resource';
7
+ import { DefaultMentionNameResolver } from '../default-mention-name-resolver/default-mention-name-resolver';
8
8
  const CONTEXT_TYPE = 'Mentions';
9
9
 
10
+ const isSmartMentionConfigWithMentionNameResolver = smartMentionConfig => !!smartMentionConfig.mentionNameResolver;
10
11
  /*
11
12
  * This is a provider implementation which calls URS to provide a list of recommended users/teams to mention.
12
13
  * The entryPoint hierarchy is : Editor -> editor-core -> plugins -> mentions -> typeAhead -> getItems -> pluginState.pluginProvider.filter
@@ -14,11 +15,21 @@ const CONTEXT_TYPE = 'Mentions';
14
15
  * https://bitbucket.org/atlassian/atlassian-frontend/src/0884032d85f11f43c13532cd21f13f696b0d28a7/packages/editor/editor-core/src/plugins/mentions/index.tsx#lines-219
15
16
  *
16
17
  */
18
+
19
+
17
20
  class SmartMentionResource extends AbstractMentionResource {
18
21
  constructor(smartMentionConfig) {
19
- super();
20
- this.smartMentionConfig = smartMentionConfig;
21
- this.lastReturnedSearch = 0;
22
+ super(); // If the product doesn't provide a mention name resolve, use the default resolver so that
23
+ // mention names can be looked up from PRS without configuration.
24
+
25
+ this.smartMentionConfig = isSmartMentionConfigWithMentionNameResolver(smartMentionConfig) ? smartMentionConfig : { ...smartMentionConfig,
26
+ mentionNameResolver: new DefaultMentionNameResolver(smartMentionConfig.baseUrl)
27
+ };
28
+ this.lastReturnedSearch = 0; // Set the environment used for mention lookup API calls (defaults to production)
29
+
30
+ if (smartMentionConfig.env) {
31
+ setEnv(smartMentionConfig.env);
32
+ }
22
33
  }
23
34
 
24
35
  shouldHighlightMention(mention) {
@@ -61,11 +72,6 @@ class SmartMentionResource extends AbstractMentionResource {
61
72
  const startTime = window.performance.now();
62
73
  const conf = this.smartMentionConfig;
63
74
  const maxNumberOfResults = conf.maxNumberOfResults || 100;
64
-
65
- if (conf.env) {
66
- setEnv(conf.env);
67
- }
68
-
69
75
  const request = {
70
76
  baseUrl: conf.baseUrl,
71
77
  context: { ...conf,
@@ -190,25 +196,15 @@ class SmartMentionResource extends AbstractMentionResource {
190
196
  }
191
197
 
192
198
  cacheMentionName(id, mentionName) {
193
- if (this.smartMentionConfig.mentionNameResolver) {
194
- this.smartMentionConfig.mentionNameResolver.cacheName(id, mentionName);
195
- }
199
+ this.smartMentionConfig.mentionNameResolver.cacheName(id, mentionName);
196
200
  }
197
201
 
198
202
  resolveMentionName(id) {
199
- if (!this.smartMentionConfig.mentionNameResolver) {
200
- return {
201
- id,
202
- name: '',
203
- status: MentionNameStatus.UNKNOWN
204
- };
205
- }
206
-
207
203
  return this.smartMentionConfig.mentionNameResolver.lookupName(id);
208
204
  }
209
205
 
210
206
  supportsMentionNameResolving() {
211
- return !!this.smartMentionConfig.mentionNameResolver;
207
+ return true;
212
208
  }
213
209
 
214
210
  recordMentionSelection(_mention) {
@@ -7,16 +7,24 @@ const LOCAL_CONFIG = {
7
7
 
8
8
  getUsersServiceUrl(productKey) {
9
9
  return productKey === 'jira' ? `https://jdog.jira-dev.com/rest/api/3/user/bulk` : `https://pug.jira-dev.com/wiki/rest/api/user/bulk`;
10
+ },
11
+
12
+ getGraphQLUrl(baseUrl) {
13
+ return baseUrl ? `${STG_INSTANCE}/${baseUrl}/graphql` : `${STG_INSTANCE}/gateway/api/graphql`;
10
14
  }
11
15
 
12
16
  };
13
17
  const PRD_CONFIG = {
14
18
  getRecommendationServiceUrl(baseUrl) {
15
- return baseUrl ? `/${baseUrl}/gateway/api/v1/recommendations` : '/gateway/api/v1/recommendations';
19
+ return baseUrl ? `/${baseUrl}/v1/recommendations` : '/gateway/api/v1/recommendations';
16
20
  },
17
21
 
18
22
  getUsersServiceUrl(productKey) {
19
- return productKey === 'jira' ? `/rest/api/3/user/bulk` : `/wiki/rest/api/user/bulk`;
23
+ return productKey === 'jira' ? '/rest/api/3/user/bulk' : '/wiki/rest/api/user/bulk';
24
+ },
25
+
26
+ getGraphQLUrl(baseUrl) {
27
+ return baseUrl ? `/${baseUrl}/graphql` : '/gateway/api/graphql';
20
28
  }
21
29
 
22
30
  };
@@ -0,0 +1,62 @@
1
+ import { MentionNameStatus } from '../types';
2
+ import { graphqlQuery } from './graphqlUtils';
3
+ import { getConfig } from '../config';
4
+
5
+ const buildUsersQuery = accountIds => ({
6
+ query: `query usersQuery($accountIds: [ID!]!) {
7
+ users(accountIds: $accountIds) {
8
+ name
9
+ accountId
10
+ }
11
+ }`,
12
+ variables: {
13
+ accountIds
14
+ }
15
+ });
16
+
17
+ const makeRequest = async (url, accountIds) => {
18
+ const query = buildUsersQuery(accountIds);
19
+ return graphqlQuery(url, query);
20
+ };
21
+
22
+ export class DefaultMentionNameResolver {
23
+ constructor(baseUrl) {
24
+ this.baseUrl = baseUrl;
25
+ this.cache = new Map();
26
+ }
27
+
28
+ async lookupName(id) {
29
+ try {
30
+ if (this.cache.has(id)) {
31
+ return {
32
+ id,
33
+ name: this.cache.get(id),
34
+ status: MentionNameStatus.OK
35
+ };
36
+ }
37
+
38
+ const url = getConfig().getGraphQLUrl(this.baseUrl);
39
+ const data = await makeRequest(url, [id]);
40
+ const userInfo = data.users.find(user => user.accountId === id);
41
+ return userInfo ? {
42
+ id,
43
+ name: userInfo.name,
44
+ status: MentionNameStatus.OK
45
+ } : {
46
+ id,
47
+ status: MentionNameStatus.UNKNOWN
48
+ };
49
+ } catch (error) {
50
+ // on network error, return original list with label 'Unknown'
51
+ return {
52
+ id,
53
+ status: MentionNameStatus.UNKNOWN
54
+ };
55
+ }
56
+ }
57
+
58
+ cacheName(id, name) {
59
+ this.cache.set(id, name);
60
+ }
61
+
62
+ }
@@ -0,0 +1,39 @@
1
+ const buildHeaders = () => {
2
+ const headers = new Headers();
3
+ headers.append('Content-Type', 'application/json');
4
+ return headers;
5
+ };
6
+
7
+ /**
8
+ * @param {string} serviceUrl - GraphQL service endpoint
9
+ * @param {Query} query - GraphQL query
10
+ */
11
+ export function graphqlQuery(serviceUrl, query) {
12
+ const headers = buildHeaders();
13
+ return fetch(new Request(`${serviceUrl}`, {
14
+ method: 'POST',
15
+ credentials: 'include',
16
+ mode: 'cors',
17
+ headers,
18
+ body: JSON.stringify(query)
19
+ })).then(response => {
20
+ if (!response.ok) {
21
+ return Promise.reject({
22
+ code: response.status,
23
+ reason: response.statusText
24
+ });
25
+ }
26
+
27
+ return response;
28
+ }).then(response => response.json()).then(json => {
29
+ if (json.errors) {
30
+ var _json$errors$;
31
+
32
+ return Promise.reject({
33
+ reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || 'default'
34
+ });
35
+ }
36
+
37
+ return json.data;
38
+ });
39
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.7.1",
3
+ "version": "19.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -23,6 +23,7 @@ var MAX_NOTIFIED_ITEMS = 20;
23
23
  // Re-exporting types to prevent breaking change
24
24
  // Re-exporting types to prevent breaking change
25
25
  import { SLI_EVENT_TYPE, Actions, SliNames } from '../util/analytics';
26
+ import debounce from 'lodash/debounce';
26
27
 
27
28
  var emptySecurityProvider = function emptySecurityProvider() {
28
29
  return {
@@ -204,6 +205,11 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
204
205
  _this.inviteExperimentCohort = config.inviteExperimentCohort;
205
206
  _this.onInviteItemClick = config.onInviteItemClick;
206
207
  _this.userRole = config.userRole || 'basic';
208
+
209
+ if (_this.config.debounceTime) {
210
+ _this.filter = debounce(_this.filter, _this.config.debounceTime);
211
+ }
212
+
207
213
  return _this;
208
214
  }
209
215
 
@@ -1,6 +1,6 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
5
  import _createClass from "@babel/runtime/helpers/createClass";
6
6
  import _inherits from "@babel/runtime/helpers/inherits";
@@ -15,15 +15,18 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
15
15
 
16
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; } }
17
17
 
18
- import { SMART_EVENT_TYPE, Actions } from './analytics';
18
+ import { SMART_EVENT_TYPE, Actions, getUsersForAnalytics, defaultAttributes } from './analytics';
19
19
  import getUserRecommendations from './recommendationClient';
20
20
  import { setEnv } from '../config';
21
21
  import { EntityType } from './SmartMentionTypes';
22
- import { UserAccessLevel, UserType as MentionUserType, MentionNameStatus } from '../types';
23
- import { getUsersForAnalytics, defaultAttributes } from './analytics';
22
+ import { UserAccessLevel, UserType as MentionUserType } from '../types';
24
23
  import { AbstractMentionResource } from '../resource';
24
+ import { DefaultMentionNameResolver } from '../default-mention-name-resolver/default-mention-name-resolver';
25
25
  var CONTEXT_TYPE = 'Mentions';
26
26
 
27
+ var isSmartMentionConfigWithMentionNameResolver = function isSmartMentionConfigWithMentionNameResolver(smartMentionConfig) {
28
+ return !!smartMentionConfig.mentionNameResolver;
29
+ };
27
30
  /*
28
31
  * This is a provider implementation which calls URS to provide a list of recommended users/teams to mention.
29
32
  * The entryPoint hierarchy is : Editor -> editor-core -> plugins -> mentions -> typeAhead -> getItems -> pluginState.pluginProvider.filter
@@ -31,6 +34,8 @@ var CONTEXT_TYPE = 'Mentions';
31
34
  * https://bitbucket.org/atlassian/atlassian-frontend/src/0884032d85f11f43c13532cd21f13f696b0d28a7/packages/editor/editor-core/src/plugins/mentions/index.tsx#lines-219
32
35
  *
33
36
  */
37
+
38
+
34
39
  var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
35
40
  _inherits(SmartMentionResource, _AbstractMentionResou);
36
41
 
@@ -41,9 +46,18 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
41
46
 
42
47
  _classCallCheck(this, SmartMentionResource);
43
48
 
44
- _this = _super.call(this);
45
- _this.smartMentionConfig = smartMentionConfig;
46
- _this.lastReturnedSearch = 0;
49
+ _this = _super.call(this); // If the product doesn't provide a mention name resolve, use the default resolver so that
50
+ // mention names can be looked up from PRS without configuration.
51
+
52
+ _this.smartMentionConfig = isSmartMentionConfigWithMentionNameResolver(smartMentionConfig) ? smartMentionConfig : _objectSpread(_objectSpread({}, smartMentionConfig), {}, {
53
+ mentionNameResolver: new DefaultMentionNameResolver(smartMentionConfig.baseUrl)
54
+ });
55
+ _this.lastReturnedSearch = 0; // Set the environment used for mention lookup API calls (defaults to production)
56
+
57
+ if (smartMentionConfig.env) {
58
+ setEnv(smartMentionConfig.env);
59
+ }
60
+
47
61
  return _this;
48
62
  }
49
63
 
@@ -127,11 +141,6 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
127
141
  startTime = window.performance.now();
128
142
  conf = this.smartMentionConfig;
129
143
  maxNumberOfResults = conf.maxNumberOfResults || 100;
130
-
131
- if (conf.env) {
132
- setEnv(conf.env);
133
- }
134
-
135
144
  request = {
136
145
  baseUrl: conf.baseUrl,
137
146
  context: _objectSpread(_objectSpread({}, conf), {}, {
@@ -147,14 +156,14 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
147
156
  maxNumberOfResults: maxNumberOfResults,
148
157
  query: query
149
158
  };
150
- _context2.prev = 5;
159
+ _context2.prev = 4;
151
160
 
152
161
  this._notifyAnalyticsListeners(SMART_EVENT_TYPE, 'users', Actions.REQUESTED, defaultAttributes(contextIdentifier));
153
162
 
154
- _context2.next = 9;
163
+ _context2.next = 8;
155
164
  return getUserRecommendations(request);
156
165
 
157
- case 9:
166
+ case 8:
158
167
  users = _context2.sent;
159
168
  elapsedTimeMilli = window.performance.now() - startTime;
160
169
  usersForAnalytics = getUsersForAnalytics(users);
@@ -171,9 +180,9 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
171
180
  query: query
172
181
  });
173
182
 
174
- case 17:
175
- _context2.prev = 17;
176
- _context2.t0 = _context2["catch"](5);
183
+ case 16:
184
+ _context2.prev = 16;
185
+ _context2.t0 = _context2["catch"](4);
177
186
  _elapsedTimeMilli = window.performance.now() - startTime;
178
187
 
179
188
  this._notifyAnalyticsListeners(SMART_EVENT_TYPE, 'usersRequest', Actions.FAILED, _objectSpread({
@@ -182,12 +191,12 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
182
191
 
183
192
  throw new Error(_context2.t0);
184
193
 
185
- case 22:
194
+ case 21:
186
195
  case "end":
187
196
  return _context2.stop();
188
197
  }
189
198
  }
190
- }, _callee2, this, [[5, 17]]);
199
+ }, _callee2, this, [[4, 16]]);
191
200
  }));
192
201
 
193
202
  function getRecommendedMentions(_x3, _x4) {
@@ -282,27 +291,17 @@ var SmartMentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
282
291
  }, {
283
292
  key: "cacheMentionName",
284
293
  value: function cacheMentionName(id, mentionName) {
285
- if (this.smartMentionConfig.mentionNameResolver) {
286
- this.smartMentionConfig.mentionNameResolver.cacheName(id, mentionName);
287
- }
294
+ this.smartMentionConfig.mentionNameResolver.cacheName(id, mentionName);
288
295
  }
289
296
  }, {
290
297
  key: "resolveMentionName",
291
298
  value: function resolveMentionName(id) {
292
- if (!this.smartMentionConfig.mentionNameResolver) {
293
- return {
294
- id: id,
295
- name: '',
296
- status: MentionNameStatus.UNKNOWN
297
- };
298
- }
299
-
300
299
  return this.smartMentionConfig.mentionNameResolver.lookupName(id);
301
300
  }
302
301
  }, {
303
302
  key: "supportsMentionNameResolving",
304
303
  value: function supportsMentionNameResolving() {
305
- return !!this.smartMentionConfig.mentionNameResolver;
304
+ return true;
306
305
  }
307
306
  }, {
308
307
  key: "recordMentionSelection",
@@ -6,14 +6,20 @@ var LOCAL_CONFIG = {
6
6
  },
7
7
  getUsersServiceUrl: function getUsersServiceUrl(productKey) {
8
8
  return productKey === 'jira' ? "https://jdog.jira-dev.com/rest/api/3/user/bulk" : "https://pug.jira-dev.com/wiki/rest/api/user/bulk";
9
+ },
10
+ getGraphQLUrl: function getGraphQLUrl(baseUrl) {
11
+ return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/graphql") : "".concat(STG_INSTANCE, "/gateway/api/graphql");
9
12
  }
10
13
  };
11
14
  var PRD_CONFIG = {
12
15
  getRecommendationServiceUrl: function getRecommendationServiceUrl(baseUrl) {
13
- return baseUrl ? "/".concat(baseUrl, "/gateway/api/v1/recommendations") : '/gateway/api/v1/recommendations';
16
+ return baseUrl ? "/".concat(baseUrl, "/v1/recommendations") : '/gateway/api/v1/recommendations';
14
17
  },
15
18
  getUsersServiceUrl: function getUsersServiceUrl(productKey) {
16
- return productKey === 'jira' ? "/rest/api/3/user/bulk" : "/wiki/rest/api/user/bulk";
19
+ return productKey === 'jira' ? '/rest/api/3/user/bulk' : '/wiki/rest/api/user/bulk';
20
+ },
21
+ getGraphQLUrl: function getGraphQLUrl(baseUrl) {
22
+ return baseUrl ? "/".concat(baseUrl, "/graphql") : '/gateway/api/graphql';
17
23
  }
18
24
  };
19
25
  export var setEnv = function setEnv(newEnv) {
@@ -0,0 +1,120 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
+ import { MentionNameStatus } from '../types';
6
+ import { graphqlQuery } from './graphqlUtils';
7
+ import { getConfig } from '../config';
8
+
9
+ var buildUsersQuery = function buildUsersQuery(accountIds) {
10
+ return {
11
+ query: "query usersQuery($accountIds: [ID!]!) {\n users(accountIds: $accountIds) {\n name\n accountId\n }\n }",
12
+ variables: {
13
+ accountIds: accountIds
14
+ }
15
+ };
16
+ };
17
+
18
+ var makeRequest = /*#__PURE__*/function () {
19
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, accountIds) {
20
+ var query;
21
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
22
+ while (1) {
23
+ switch (_context.prev = _context.next) {
24
+ case 0:
25
+ query = buildUsersQuery(accountIds);
26
+ return _context.abrupt("return", graphqlQuery(url, query));
27
+
28
+ case 2:
29
+ case "end":
30
+ return _context.stop();
31
+ }
32
+ }
33
+ }, _callee);
34
+ }));
35
+
36
+ return function makeRequest(_x, _x2) {
37
+ return _ref.apply(this, arguments);
38
+ };
39
+ }();
40
+
41
+ export var DefaultMentionNameResolver = /*#__PURE__*/function () {
42
+ function DefaultMentionNameResolver(baseUrl) {
43
+ _classCallCheck(this, DefaultMentionNameResolver);
44
+
45
+ this.baseUrl = baseUrl;
46
+ this.cache = new Map();
47
+ }
48
+
49
+ _createClass(DefaultMentionNameResolver, [{
50
+ key: "lookupName",
51
+ value: function () {
52
+ var _lookupName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
53
+ var url, data, userInfo;
54
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
55
+ while (1) {
56
+ switch (_context2.prev = _context2.next) {
57
+ case 0:
58
+ _context2.prev = 0;
59
+
60
+ if (!this.cache.has(id)) {
61
+ _context2.next = 3;
62
+ break;
63
+ }
64
+
65
+ return _context2.abrupt("return", {
66
+ id: id,
67
+ name: this.cache.get(id),
68
+ status: MentionNameStatus.OK
69
+ });
70
+
71
+ case 3:
72
+ url = getConfig().getGraphQLUrl(this.baseUrl);
73
+ _context2.next = 6;
74
+ return makeRequest(url, [id]);
75
+
76
+ case 6:
77
+ data = _context2.sent;
78
+ userInfo = data.users.find(function (user) {
79
+ return user.accountId === id;
80
+ });
81
+ return _context2.abrupt("return", userInfo ? {
82
+ id: id,
83
+ name: userInfo.name,
84
+ status: MentionNameStatus.OK
85
+ } : {
86
+ id: id,
87
+ status: MentionNameStatus.UNKNOWN
88
+ });
89
+
90
+ case 11:
91
+ _context2.prev = 11;
92
+ _context2.t0 = _context2["catch"](0);
93
+ return _context2.abrupt("return", {
94
+ id: id,
95
+ status: MentionNameStatus.UNKNOWN
96
+ });
97
+
98
+ case 14:
99
+ case "end":
100
+ return _context2.stop();
101
+ }
102
+ }
103
+ }, _callee2, this, [[0, 11]]);
104
+ }));
105
+
106
+ function lookupName(_x3) {
107
+ return _lookupName.apply(this, arguments);
108
+ }
109
+
110
+ return lookupName;
111
+ }()
112
+ }, {
113
+ key: "cacheName",
114
+ value: function cacheName(id, name) {
115
+ this.cache.set(id, name);
116
+ }
117
+ }]);
118
+
119
+ return DefaultMentionNameResolver;
120
+ }();
@@ -0,0 +1,41 @@
1
+ var buildHeaders = function buildHeaders() {
2
+ var headers = new Headers();
3
+ headers.append('Content-Type', 'application/json');
4
+ return headers;
5
+ };
6
+
7
+ /**
8
+ * @param {string} serviceUrl - GraphQL service endpoint
9
+ * @param {Query} query - GraphQL query
10
+ */
11
+ export function graphqlQuery(serviceUrl, query) {
12
+ var headers = buildHeaders();
13
+ return fetch(new Request("".concat(serviceUrl), {
14
+ method: 'POST',
15
+ credentials: 'include',
16
+ mode: 'cors',
17
+ headers: headers,
18
+ body: JSON.stringify(query)
19
+ })).then(function (response) {
20
+ if (!response.ok) {
21
+ return Promise.reject({
22
+ code: response.status,
23
+ reason: response.statusText
24
+ });
25
+ }
26
+
27
+ return response;
28
+ }).then(function (response) {
29
+ return response.json();
30
+ }).then(function (json) {
31
+ if (json.errors) {
32
+ var _json$errors$;
33
+
34
+ return Promise.reject({
35
+ reason: ((_json$errors$ = json.errors[0]) === null || _json$errors$ === void 0 ? void 0 : _json$errors$.category) || 'default'
36
+ });
37
+ }
38
+
39
+ return json.data;
40
+ });
41
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.7.1",
3
+ "version": "19.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,7 @@
1
1
  interface Config {
2
2
  getRecommendationServiceUrl(baseUrl: string): string;
3
3
  getUsersServiceUrl(productKey: string): string;
4
+ getGraphQLUrl(baseUrl: string | undefined): string;
4
5
  }
5
6
  export declare const setEnv: (newEnv: 'prod' | 'local') => "prod" | "local";
6
7
  export declare const getConfig: () => Config;
@@ -0,0 +1,8 @@
1
+ import { MentionNameResolver, MentionNameDetails } from '../types';
2
+ export declare class DefaultMentionNameResolver implements MentionNameResolver {
3
+ private baseUrl?;
4
+ private readonly cache;
5
+ constructor(baseUrl?: string);
6
+ lookupName(id: string): Promise<MentionNameDetails>;
7
+ cacheName(id: string, name: string): void;
8
+ }
@@ -0,0 +1,14 @@
1
+ interface Query {
2
+ query: string;
3
+ variables: Record<string, string> | Record<string, string[]>;
4
+ }
5
+ export interface GraphQLError {
6
+ code?: number;
7
+ reason: string;
8
+ }
9
+ /**
10
+ * @param {string} serviceUrl - GraphQL service endpoint
11
+ * @param {Query} query - GraphQL query
12
+ */
13
+ export declare function graphqlQuery<D>(serviceUrl: string, query: Query): Promise<D>;
14
+ export {};
@@ -1,6 +1,5 @@
1
1
  import MentionResource, { AbstractMentionResource, MentionContextIdentifier, MentionProvider, ResolvingMentionProvider, MentionStats, MentionResourceConfig, TeamMentionResourceConfig, isResolvingMentionProvider } from './api/MentionResource';
2
- import { SmartMentionConfig } from './api/SmartMentionResource';
3
- import SmartMentionResource from './api/SmartMentionResource';
2
+ import SmartMentionResource, { SmartMentionConfig } from './api/SmartMentionResource';
4
3
  import TeamMentionResource from './api/TeamMentionResource';
5
4
  import PresenceResource, { PresenceProvider, AbstractPresenceResource } from './api/PresenceResource';
6
5
  import { DefaultMentionNameResolver, MentionNameResolver } from './api/MentionNameResolver';
@@ -31,6 +31,7 @@ export interface MentionResourceConfig extends ServiceConfig {
31
31
  onInviteItemClick?: (flow: InviteFlow) => void;
32
32
  userRole?: UserRole;
33
33
  productName?: string;
34
+ debounceTime?: number;
34
35
  }
35
36
  export interface ResourceProvider<Result> {
36
37
  /**
@@ -9,10 +9,10 @@ import {
9
9
  import SectionMessage from '@atlaskit/section-message';
10
10
 
11
11
  const MentionProps = require('!!extract-react-types-loader!../src/api/extract-react-types/smart-config-props');
12
- import MentionWithEditorExample from '../examples/14-mention-with-editor';
13
- const MentionWithEditorExampleSource = require('!!raw-loader!../examples/14-mention-with-editor');
14
- import SmartMentionWithEditorExample from '../examples/15-smart-mention-resource';
15
- const SmartMentionWithEditorExampleSource = require('!!raw-loader!../examples/15-smart-mention-resource');
12
+ import MentionWithEditorExample from '../examples/14-mention-with-editor-extending-abstract-mention-resource';
13
+ const MentionWithEditorExampleSource = require('!!raw-loader!../examples/14-mention-with-editor-extending-abstract-mention-resource');
14
+ import SmartMentionWithEditorExample from '../examples/16-smart-mention-resource';
15
+ const SmartMentionWithEditorExampleSource = require('!!raw-loader!../examples/16-smart-mention-resource');
16
16
 
17
17
  export default md`
18
18
  ${(<AtlassianInternalWarning />)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.7.1",
3
+ "version": "19.9.0",
4
4
  "description": "A React component used to display user profiles in a list for 'Mention' functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,14 +28,15 @@
28
28
  "dependencies": {
29
29
  "@atlaskit/analytics-gas-types": "^5.0.0",
30
30
  "@atlaskit/analytics-next": "^8.0.0",
31
- "@atlaskit/avatar": "^20.2.0",
31
+ "@atlaskit/avatar": "^20.5.0",
32
32
  "@atlaskit/button": "^16.0.0",
33
- "@atlaskit/icon": "^21.8.0",
33
+ "@atlaskit/icon": "^21.9.0",
34
34
  "@atlaskit/lozenge": "^11.0.0",
35
- "@atlaskit/theme": "^11.5.0",
36
- "@atlaskit/tooltip": "^17.2.0",
35
+ "@atlaskit/theme": "^12.0.0",
36
+ "@atlaskit/tooltip": "^17.5.0",
37
37
  "@atlaskit/util-service-support": "^6.0.0",
38
38
  "@babel/runtime": "^7.0.0",
39
+ "lodash": "^4.17.15",
39
40
  "uuid": "^3.1.0"
40
41
  },
41
42
  "peerDependencies": {
@@ -45,9 +46,10 @@
45
46
  "styled-components": "^3.2.6"
46
47
  },
47
48
  "devDependencies": {
49
+ "@atlaskit/adf-utils": "^14.2.0",
48
50
  "@atlaskit/build-utils": "*",
49
51
  "@atlaskit/docs": "^9.0.0",
50
- "@atlaskit/editor-core": "^149.0.0",
52
+ "@atlaskit/editor-core": "^150.0.0",
51
53
  "@atlaskit/editor-test-helpers": "^15.4.0",
52
54
  "@atlaskit/elements-test-helpers": "^0.7.0",
53
55
  "@atlaskit/section-message": "^6.0.0",