@atlaskit/mention 19.8.0 → 19.9.2
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 +24 -0
- package/dist/cjs/api/MentionResource.js +7 -0
- package/dist/cjs/config/index.js +3 -3
- package/dist/cjs/default-mention-name-resolver/default-mention-name-resolver.js +3 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/api/MentionResource.js +5 -0
- package/dist/es2019/config/index.js +3 -3
- package/dist/es2019/default-mention-name-resolver/default-mention-name-resolver.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/api/MentionResource.js +6 -0
- package/dist/esm/config/index.js +3 -3
- package/dist/esm/default-mention-name-resolver/default-mention-name-resolver.js +3 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/api/SmartMentionResource.d.ts +4 -6
- package/dist/types/api/SmartMentionTypes.d.ts +1 -2
- package/dist/types/types.d.ts +1 -0
- package/docs/1-in-editor.tsx +4 -4
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/mention
|
|
2
2
|
|
|
3
|
+
## 19.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`570ccaa00bd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/570ccaa00bd) - Add the ability for users in Default Mention Name Resolver to be nullable
|
|
8
|
+
|
|
9
|
+
## 19.9.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`a92e3bdb515`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a92e3bdb515) - Relaxed product enum typing to take in any string
|
|
14
|
+
|
|
15
|
+
## 19.9.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`e65ada9dbbb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e65ada9dbbb) - Debounce MentionResource when debounceTime is passed in
|
|
20
|
+
|
|
21
|
+
## 19.8.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [`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
|
|
26
|
+
|
|
3
27
|
## 19.8.0
|
|
4
28
|
|
|
5
29
|
### Minor 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
|
|
package/dist/cjs/config/index.js
CHANGED
|
@@ -14,18 +14,18 @@ var LOCAL_CONFIG = {
|
|
|
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
15
|
},
|
|
16
16
|
getGraphQLUrl: function getGraphQLUrl(baseUrl) {
|
|
17
|
-
return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/graphql") : "".concat(STG_INSTANCE, "/graphql");
|
|
17
|
+
return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/graphql") : "".concat(STG_INSTANCE, "/gateway/api/graphql");
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
var PRD_CONFIG = {
|
|
21
21
|
getRecommendationServiceUrl: function getRecommendationServiceUrl(baseUrl) {
|
|
22
|
-
return baseUrl ? "/".concat(baseUrl, "/
|
|
22
|
+
return baseUrl ? "/".concat(baseUrl, "/v1/recommendations") : '/gateway/api/v1/recommendations';
|
|
23
23
|
},
|
|
24
24
|
getUsersServiceUrl: function getUsersServiceUrl(productKey) {
|
|
25
25
|
return productKey === 'jira' ? '/rest/api/3/user/bulk' : '/wiki/rest/api/user/bulk';
|
|
26
26
|
},
|
|
27
27
|
getGraphQLUrl: function getGraphQLUrl(baseUrl) {
|
|
28
|
-
return baseUrl ? "/".concat(baseUrl, "/graphql") : '/graphql';
|
|
28
|
+
return baseUrl ? "/".concat(baseUrl, "/graphql") : '/gateway/api/graphql';
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -64,7 +64,8 @@ var DefaultMentionNameResolver = /*#__PURE__*/function () {
|
|
|
64
64
|
key: "lookupName",
|
|
65
65
|
value: function () {
|
|
66
66
|
var _lookupName = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id) {
|
|
67
|
-
var url, data, userInfo;
|
|
67
|
+
var _data$users, url, data, userInfo;
|
|
68
|
+
|
|
68
69
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
69
70
|
while (1) {
|
|
70
71
|
switch (_context2.prev = _context2.next) {
|
|
@@ -89,7 +90,7 @@ var DefaultMentionNameResolver = /*#__PURE__*/function () {
|
|
|
89
90
|
|
|
90
91
|
case 6:
|
|
91
92
|
data = _context2.sent;
|
|
92
|
-
userInfo = data.users.find(function (user) {
|
|
93
|
+
userInfo = (_data$users = data.users) === null || _data$users === void 0 ? void 0 : _data$users.find(function (user) {
|
|
93
94
|
return user.accountId === id;
|
|
94
95
|
});
|
|
95
96
|
return _context2.abrupt("return", userInfo ? {
|
package/dist/cjs/version.json
CHANGED
|
@@ -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) {
|
|
@@ -10,13 +10,13 @@ const LOCAL_CONFIG = {
|
|
|
10
10
|
},
|
|
11
11
|
|
|
12
12
|
getGraphQLUrl(baseUrl) {
|
|
13
|
-
return baseUrl ? `${STG_INSTANCE}/${baseUrl}/graphql` : `${STG_INSTANCE}/graphql`;
|
|
13
|
+
return baseUrl ? `${STG_INSTANCE}/${baseUrl}/graphql` : `${STG_INSTANCE}/gateway/api/graphql`;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
};
|
|
17
17
|
const PRD_CONFIG = {
|
|
18
18
|
getRecommendationServiceUrl(baseUrl) {
|
|
19
|
-
return baseUrl ? `/${baseUrl}/
|
|
19
|
+
return baseUrl ? `/${baseUrl}/v1/recommendations` : '/gateway/api/v1/recommendations';
|
|
20
20
|
},
|
|
21
21
|
|
|
22
22
|
getUsersServiceUrl(productKey) {
|
|
@@ -24,7 +24,7 @@ const PRD_CONFIG = {
|
|
|
24
24
|
},
|
|
25
25
|
|
|
26
26
|
getGraphQLUrl(baseUrl) {
|
|
27
|
-
return baseUrl ? `/${baseUrl}/graphql` : '/graphql';
|
|
27
|
+
return baseUrl ? `/${baseUrl}/graphql` : '/gateway/api/graphql';
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
};
|
|
@@ -27,6 +27,8 @@ export class DefaultMentionNameResolver {
|
|
|
27
27
|
|
|
28
28
|
async lookupName(id) {
|
|
29
29
|
try {
|
|
30
|
+
var _data$users;
|
|
31
|
+
|
|
30
32
|
if (this.cache.has(id)) {
|
|
31
33
|
return {
|
|
32
34
|
id,
|
|
@@ -37,7 +39,7 @@ export class DefaultMentionNameResolver {
|
|
|
37
39
|
|
|
38
40
|
const url = getConfig().getGraphQLUrl(this.baseUrl);
|
|
39
41
|
const data = await makeRequest(url, [id]);
|
|
40
|
-
const userInfo = data.users.find(user => user.accountId === id);
|
|
42
|
+
const userInfo = (_data$users = data.users) === null || _data$users === void 0 ? void 0 : _data$users.find(user => user.accountId === id);
|
|
41
43
|
return userInfo ? {
|
|
42
44
|
id,
|
|
43
45
|
name: userInfo.name,
|
package/dist/es2019/version.json
CHANGED
|
@@ -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
|
|
package/dist/esm/config/index.js
CHANGED
|
@@ -8,18 +8,18 @@ var LOCAL_CONFIG = {
|
|
|
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
9
|
},
|
|
10
10
|
getGraphQLUrl: function getGraphQLUrl(baseUrl) {
|
|
11
|
-
return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/graphql") : "".concat(STG_INSTANCE, "/graphql");
|
|
11
|
+
return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/graphql") : "".concat(STG_INSTANCE, "/gateway/api/graphql");
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
var PRD_CONFIG = {
|
|
15
15
|
getRecommendationServiceUrl: function getRecommendationServiceUrl(baseUrl) {
|
|
16
|
-
return baseUrl ? "/".concat(baseUrl, "/
|
|
16
|
+
return baseUrl ? "/".concat(baseUrl, "/v1/recommendations") : '/gateway/api/v1/recommendations';
|
|
17
17
|
},
|
|
18
18
|
getUsersServiceUrl: function getUsersServiceUrl(productKey) {
|
|
19
19
|
return productKey === 'jira' ? '/rest/api/3/user/bulk' : '/wiki/rest/api/user/bulk';
|
|
20
20
|
},
|
|
21
21
|
getGraphQLUrl: function getGraphQLUrl(baseUrl) {
|
|
22
|
-
return baseUrl ? "/".concat(baseUrl, "/graphql") : '/graphql';
|
|
22
|
+
return baseUrl ? "/".concat(baseUrl, "/graphql") : '/gateway/api/graphql';
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
export var setEnv = function setEnv(newEnv) {
|
|
@@ -50,7 +50,8 @@ export var DefaultMentionNameResolver = /*#__PURE__*/function () {
|
|
|
50
50
|
key: "lookupName",
|
|
51
51
|
value: function () {
|
|
52
52
|
var _lookupName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
|
|
53
|
-
var url, data, userInfo;
|
|
53
|
+
var _data$users, url, data, userInfo;
|
|
54
|
+
|
|
54
55
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
55
56
|
while (1) {
|
|
56
57
|
switch (_context2.prev = _context2.next) {
|
|
@@ -75,7 +76,7 @@ export var DefaultMentionNameResolver = /*#__PURE__*/function () {
|
|
|
75
76
|
|
|
76
77
|
case 6:
|
|
77
78
|
data = _context2.sent;
|
|
78
|
-
userInfo = data.users.find(function (user) {
|
|
79
|
+
userInfo = (_data$users = data.users) === null || _data$users === void 0 ? void 0 : _data$users.find(function (user) {
|
|
79
80
|
return user.accountId === id;
|
|
80
81
|
});
|
|
81
82
|
return _context2.abrupt("return", userInfo ? {
|
package/dist/esm/version.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SupportedProduct } from './SmartMentionTypes';
|
|
2
1
|
import { MentionContextIdentifier, MentionsResult, MentionDescription, MentionNameDetails, MentionNameResolver } from '../types';
|
|
3
2
|
import { AbstractMentionResource, ResolvingMentionProvider } from '../resource';
|
|
4
3
|
export interface SmartMentionConfig {
|
|
@@ -13,12 +12,11 @@ export interface SmartMentionConfig {
|
|
|
13
12
|
*/
|
|
14
13
|
principalId?: string;
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* to add your product onto the SupportedProduct enum.
|
|
15
|
+
* Platform search is only available for certain products. Please
|
|
16
|
+
* reach out to #help-smart-experiences to check.
|
|
17
|
+
* Use productKey='people' if you are waiting for a product scope.
|
|
20
18
|
*/
|
|
21
|
-
productKey:
|
|
19
|
+
productKey: string;
|
|
22
20
|
/**
|
|
23
21
|
* Lucene-type query to proxy onto the search service.
|
|
24
22
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare type SupportedProduct = 'jira' | 'confluence' | 'people' | 'bitbucket';
|
|
2
1
|
export interface RecommendationRequest {
|
|
3
2
|
baseUrl?: string;
|
|
4
3
|
context: Context;
|
|
@@ -21,7 +20,7 @@ export interface Context {
|
|
|
21
20
|
sessionId?: string;
|
|
22
21
|
principalId: string;
|
|
23
22
|
childObjectId?: string;
|
|
24
|
-
productKey:
|
|
23
|
+
productKey: string;
|
|
25
24
|
siteId: string;
|
|
26
25
|
productAttributes?: ProductAttributes;
|
|
27
26
|
}
|
package/dist/types/types.d.ts
CHANGED
package/docs/1-in-editor.tsx
CHANGED
|
@@ -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
|
-
const SmartMentionWithEditorExampleSource = require('!!raw-loader!../examples/
|
|
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.
|
|
3
|
+
"version": "19.9.2",
|
|
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/"
|
|
@@ -36,6 +36,7 @@
|
|
|
36
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": {
|
|
@@ -48,8 +49,8 @@
|
|
|
48
49
|
"@atlaskit/adf-utils": "^14.2.0",
|
|
49
50
|
"@atlaskit/build-utils": "*",
|
|
50
51
|
"@atlaskit/docs": "^9.0.0",
|
|
51
|
-
"@atlaskit/editor-core": "^
|
|
52
|
-
"@atlaskit/editor-test-helpers": "^15.
|
|
52
|
+
"@atlaskit/editor-core": "^151.0.0",
|
|
53
|
+
"@atlaskit/editor-test-helpers": "^15.5.0",
|
|
53
54
|
"@atlaskit/elements-test-helpers": "^0.7.0",
|
|
54
55
|
"@atlaskit/section-message": "^6.0.0",
|
|
55
56
|
"@atlaskit/ssr": "*",
|