@atlaskit/mention 24.4.11 → 24.5.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 +8 -0
- package/afm-cc/tsconfig.json +0 -1
- package/afm-jira/tsconfig.json +0 -1
- package/afm-products/tsconfig.json +0 -1
- package/dist/cjs/api/MentionResource.js +41 -22
- package/dist/cjs/api/PresenceResource.js +17 -2
- package/dist/cjs/api/TeamMentionResource.js +26 -15
- package/dist/cjs/types.js +7 -0
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/cjs/util/atl-attribution.js +26 -0
- package/dist/es2019/api/MentionResource.js +23 -2
- package/dist/es2019/api/PresenceResource.js +18 -1
- package/dist/es2019/api/TeamMentionResource.js +15 -2
- package/dist/es2019/types.js +8 -0
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/es2019/util/atl-attribution.js +21 -0
- package/dist/esm/api/MentionResource.js +41 -22
- package/dist/esm/api/PresenceResource.js +18 -2
- package/dist/esm/api/TeamMentionResource.js +27 -16
- package/dist/esm/types.js +8 -0
- package/dist/esm/util/analytics.js +1 -1
- package/dist/esm/util/atl-attribution.js +20 -0
- package/dist/types/api/MentionResource.d.ts +14 -0
- package/dist/types/api/PresenceResource.d.ts +40 -0
- package/dist/types/types.d.ts +62 -0
- package/dist/types/util/atl-attribution.d.ts +8 -0
- package/dist/types-ts4.5/api/MentionResource.d.ts +14 -0
- package/dist/types-ts4.5/api/PresenceResource.d.ts +40 -0
- package/dist/types-ts4.5/types.d.ts +62 -0
- package/dist/types-ts4.5/util/atl-attribution.d.ts +8 -0
- package/package.json +5 -2
- package/tsconfig.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/mention
|
|
2
2
|
|
|
3
|
+
## 24.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`7c31932dc85c7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7c31932dc85c7) -
|
|
8
|
+
Adds ability to send custom headers to API requests and adds atl-attribution header to
|
|
9
|
+
PresenceResource API requests
|
|
10
|
+
|
|
3
11
|
## 24.4.11
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -13,6 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
15
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _utilServiceSupport = require("@atlaskit/util-service-support");
|
|
17
18
|
var _types = require("../types");
|
|
18
19
|
var _logger = _interopRequireDefault(require("../util/logger"));
|
|
@@ -28,6 +29,14 @@ var MAX_NOTIFIED_ITEMS = 20;
|
|
|
28
29
|
// Re-exporting types to prevent breaking change
|
|
29
30
|
// Re-exporting types to prevent breaking change
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for the TeamMentionResource, which extends {@link MentionResourceConfig}
|
|
34
|
+
* to support fetching team mentions from a separate team search service endpoint.
|
|
35
|
+
*
|
|
36
|
+
* Used as the second argument when constructing a {@link TeamMentionResource}, alongside
|
|
37
|
+
* a standard `MentionResourceConfig` for user mentions.
|
|
38
|
+
*/
|
|
39
|
+
|
|
31
40
|
/**
|
|
32
41
|
* Support
|
|
33
42
|
*/
|
|
@@ -364,32 +373,37 @@ var MentionResource = exports.MentionResource = /*#__PURE__*/function (_Abstract
|
|
|
364
373
|
key: "remoteInitialState",
|
|
365
374
|
value: (function () {
|
|
366
375
|
var _remoteInitialState = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(contextIdentifier) {
|
|
367
|
-
var queryParams, options, result;
|
|
376
|
+
var queryParams, configHeaders, options, result;
|
|
368
377
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
369
378
|
while (1) switch (_context2.prev = _context2.next) {
|
|
370
379
|
case 0:
|
|
371
380
|
queryParams = this.getQueryParams(contextIdentifier);
|
|
372
|
-
|
|
381
|
+
configHeaders = (0, _platformFeatureFlags.fg)('mentions_custom_headers') ? this.config.headers : undefined;
|
|
382
|
+
options = _objectSpread({
|
|
373
383
|
path: 'bootstrap',
|
|
374
384
|
queryParams: queryParams
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
385
|
+
}, configHeaders && {
|
|
386
|
+
requestInit: {
|
|
387
|
+
headers: configHeaders
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
_context2.prev = 3;
|
|
391
|
+
_context2.next = 6;
|
|
378
392
|
return _utilServiceSupport.utils.requestService(this.config, options);
|
|
379
|
-
case
|
|
393
|
+
case 6:
|
|
380
394
|
result = _context2.sent;
|
|
381
395
|
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _types.SliNames.INITIAL_STATE, _types.Actions.SUCCEEDED);
|
|
382
396
|
return _context2.abrupt("return", this.transformServiceResponse(result, ''));
|
|
383
|
-
case
|
|
384
|
-
_context2.prev =
|
|
385
|
-
_context2.t0 = _context2["catch"](
|
|
397
|
+
case 11:
|
|
398
|
+
_context2.prev = 11;
|
|
399
|
+
_context2.t0 = _context2["catch"](3);
|
|
386
400
|
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _types.SliNames.INITIAL_STATE, _types.Actions.FAILED);
|
|
387
401
|
throw _context2.t0;
|
|
388
|
-
case
|
|
402
|
+
case 15:
|
|
389
403
|
case "end":
|
|
390
404
|
return _context2.stop();
|
|
391
405
|
}
|
|
392
|
-
}, _callee2, this, [[
|
|
406
|
+
}, _callee2, this, [[3, 11]]);
|
|
393
407
|
}));
|
|
394
408
|
function remoteInitialState(_x3) {
|
|
395
409
|
return _remoteInitialState.apply(this, arguments);
|
|
@@ -407,34 +421,39 @@ var MentionResource = exports.MentionResource = /*#__PURE__*/function (_Abstract
|
|
|
407
421
|
key: "remoteSearch",
|
|
408
422
|
value: function () {
|
|
409
423
|
var _remoteSearch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(query, contextIdentifier) {
|
|
410
|
-
var options, result;
|
|
424
|
+
var configHeaders, options, result;
|
|
411
425
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
412
426
|
while (1) switch (_context3.prev = _context3.next) {
|
|
413
427
|
case 0:
|
|
414
|
-
|
|
428
|
+
configHeaders = (0, _platformFeatureFlags.fg)('mentions_custom_headers') ? this.config.headers : undefined;
|
|
429
|
+
options = _objectSpread({
|
|
415
430
|
path: 'search',
|
|
416
431
|
queryParams: _objectSpread({
|
|
417
432
|
query: query,
|
|
418
433
|
limit: MAX_QUERY_ITEMS
|
|
419
434
|
}, this.getQueryParams(contextIdentifier))
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
435
|
+
}, configHeaders && {
|
|
436
|
+
requestInit: {
|
|
437
|
+
headers: configHeaders
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
_context3.prev = 2;
|
|
441
|
+
_context3.next = 5;
|
|
423
442
|
return _utilServiceSupport.utils.requestService(this.config, options);
|
|
424
|
-
case
|
|
443
|
+
case 5:
|
|
425
444
|
result = _context3.sent;
|
|
426
445
|
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _types.SliNames.SEARCH, _types.Actions.SUCCEEDED);
|
|
427
446
|
return _context3.abrupt("return", this.transformServiceResponse(result, query));
|
|
428
|
-
case
|
|
429
|
-
_context3.prev =
|
|
430
|
-
_context3.t0 = _context3["catch"](
|
|
447
|
+
case 10:
|
|
448
|
+
_context3.prev = 10;
|
|
449
|
+
_context3.t0 = _context3["catch"](2);
|
|
431
450
|
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _types.SliNames.SEARCH, _types.Actions.FAILED);
|
|
432
451
|
throw _context3.t0;
|
|
433
|
-
case
|
|
452
|
+
case 14:
|
|
434
453
|
case "end":
|
|
435
454
|
return _context3.stop();
|
|
436
455
|
}
|
|
437
|
-
}, _callee3, this, [[
|
|
456
|
+
}, _callee3, this, [[2, 10]]);
|
|
438
457
|
}));
|
|
439
458
|
function remoteSearch(_x4, _x5) {
|
|
440
459
|
return _remoteSearch.apply(this, arguments);
|
|
@@ -11,13 +11,22 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
11
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
+
var _atlAttribution = require("../util/atl-attribution");
|
|
14
16
|
var _logger = _interopRequireDefault(require("../util/logger"));
|
|
15
17
|
var _MentionResource = require("./MentionResource");
|
|
16
18
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
17
19
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
20
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
23
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
20
24
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for the PresenceResource, which manages real-time user
|
|
27
|
+
* presence (online/offline/busy/focus status) by querying a GraphQL-based
|
|
28
|
+
* presence service.
|
|
29
|
+
*/
|
|
21
30
|
var CacheEntry = /*#__PURE__*/function () {
|
|
22
31
|
function CacheEntry(pres, timeout) {
|
|
23
32
|
(0, _classCallCheck2.default)(this, CacheEntry);
|
|
@@ -108,11 +117,17 @@ var PresenceResource = /*#__PURE__*/function (_AbstractPresenceReso) {
|
|
|
108
117
|
if (this.config.productId) {
|
|
109
118
|
query.variables['productId'] = this.config.productId;
|
|
110
119
|
}
|
|
120
|
+
var configHeaders = (0, _platformFeatureFlags.fg)('mentions_custom_headers') ? this.config.headers : undefined;
|
|
121
|
+
var atlAttributionHeader = (0, _atlAttribution.buildAtlAttributionHeaderValue)({
|
|
122
|
+
cloudId: this.config.cloudId,
|
|
123
|
+
productId: this.config.productId,
|
|
124
|
+
activationId: this.config.activationId
|
|
125
|
+
});
|
|
111
126
|
var options = {
|
|
112
127
|
method: 'POST',
|
|
113
|
-
headers: {
|
|
128
|
+
headers: _objectSpread(_objectSpread({
|
|
114
129
|
'Content-Type': 'application/json'
|
|
115
|
-
},
|
|
130
|
+
}, atlAttributionHeader), configHeaders),
|
|
116
131
|
credentials: 'include',
|
|
117
132
|
body: JSON.stringify(query)
|
|
118
133
|
};
|
|
@@ -16,6 +16,7 @@ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
|
16
16
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _analytics = require("./../util/analytics");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _utilServiceSupport = require("@atlaskit/util-service-support");
|
|
20
21
|
var _types = require("../types");
|
|
21
22
|
var _MentionResource2 = _interopRequireDefault(require("./MentionResource"));
|
|
@@ -68,20 +69,25 @@ var TeamMentionResource = exports.default = /*#__PURE__*/function (_MentionResou
|
|
|
68
69
|
key: "remoteInitialStateTeamAndUsers",
|
|
69
70
|
value: (function () {
|
|
70
71
|
var _remoteInitialStateTeamAndUsers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(contextIdentifier) {
|
|
71
|
-
var emptyQuery, getUserPromise, queryParams, options, getTeamsPromise;
|
|
72
|
+
var emptyQuery, getUserPromise, queryParams, configHeaders, options, getTeamsPromise;
|
|
72
73
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
73
74
|
while (1) switch (_context.prev = _context.next) {
|
|
74
75
|
case 0:
|
|
75
76
|
emptyQuery = '';
|
|
76
77
|
getUserPromise = _superPropGet(TeamMentionResource, "remoteInitialState", this, 3)([contextIdentifier]);
|
|
77
78
|
queryParams = this.getQueryParamsOfTeamMentionConfig(contextIdentifier);
|
|
78
|
-
|
|
79
|
+
configHeaders = (0, _platformFeatureFlags.fg)('mentions_custom_headers') ? this.teamMentionConfig.headers : undefined;
|
|
80
|
+
options = _objectSpread({
|
|
79
81
|
path: 'bootstrap',
|
|
80
82
|
queryParams: queryParams
|
|
81
|
-
}
|
|
83
|
+
}, configHeaders && {
|
|
84
|
+
requestInit: {
|
|
85
|
+
headers: configHeaders
|
|
86
|
+
}
|
|
87
|
+
});
|
|
82
88
|
getTeamsPromise = _utilServiceSupport.utils.requestService(this.teamMentionConfig, options);
|
|
83
89
|
this.handleBothRequests(emptyQuery, getUserPromise, getTeamsPromise);
|
|
84
|
-
case
|
|
90
|
+
case 7:
|
|
85
91
|
case "end":
|
|
86
92
|
return _context.stop();
|
|
87
93
|
}
|
|
@@ -214,34 +220,39 @@ var TeamMentionResource = exports.default = /*#__PURE__*/function (_MentionResou
|
|
|
214
220
|
key: "remoteTeamSearch",
|
|
215
221
|
value: function () {
|
|
216
222
|
var _remoteTeamSearch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(query, contextIdentifier) {
|
|
217
|
-
var options, teamResult;
|
|
223
|
+
var configHeaders, options, teamResult;
|
|
218
224
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
219
225
|
while (1) switch (_context3.prev = _context3.next) {
|
|
220
226
|
case 0:
|
|
221
|
-
|
|
227
|
+
configHeaders = (0, _platformFeatureFlags.fg)('mentions_custom_headers') ? this.teamMentionConfig.headers : undefined;
|
|
228
|
+
options = _objectSpread({
|
|
222
229
|
path: 'search',
|
|
223
230
|
queryParams: _objectSpread({
|
|
224
231
|
query: query,
|
|
225
232
|
limit: MAX_QUERY_TEAMS
|
|
226
233
|
}, this.getQueryParamsOfTeamMentionConfig(contextIdentifier))
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
234
|
+
}, configHeaders && {
|
|
235
|
+
requestInit: {
|
|
236
|
+
headers: configHeaders
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
_context3.prev = 2;
|
|
240
|
+
_context3.next = 5;
|
|
230
241
|
return _utilServiceSupport.utils.requestService(this.teamMentionConfig, options);
|
|
231
|
-
case
|
|
242
|
+
case 5:
|
|
232
243
|
teamResult = _context3.sent;
|
|
233
244
|
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _types.SliNames.SEARCH_TEAM, _types.Actions.SUCCEEDED);
|
|
234
245
|
return _context3.abrupt("return", this.convertTeamResultToMentionResult(teamResult, query));
|
|
235
|
-
case
|
|
236
|
-
_context3.prev =
|
|
237
|
-
_context3.t0 = _context3["catch"](
|
|
246
|
+
case 10:
|
|
247
|
+
_context3.prev = 10;
|
|
248
|
+
_context3.t0 = _context3["catch"](2);
|
|
238
249
|
this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, _types.SliNames.SEARCH_TEAM, _types.Actions.FAILED);
|
|
239
250
|
throw _context3.t0;
|
|
240
|
-
case
|
|
251
|
+
case 14:
|
|
241
252
|
case "end":
|
|
242
253
|
return _context3.stop();
|
|
243
254
|
}
|
|
244
|
-
}, _callee3, this, [[
|
|
255
|
+
}, _callee3, this, [[2, 10]]);
|
|
245
256
|
}));
|
|
246
257
|
function remoteTeamSearch(_x5, _x6) {
|
|
247
258
|
return _remoteTeamSearch.apply(this, arguments);
|
package/dist/cjs/types.js
CHANGED
|
@@ -10,6 +10,13 @@ exports.isRestricted = isRestricted;
|
|
|
10
10
|
exports.isSpecialMention = isSpecialMention;
|
|
11
11
|
exports.isSpecialMentionText = isSpecialMentionText;
|
|
12
12
|
exports.isTeamMention = isTeamMention;
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for the MentionResource, which provides a JavaScript API
|
|
15
|
+
* for fetching and searching user mentions from a remote service.
|
|
16
|
+
*
|
|
17
|
+
* Extends {@link ServiceConfig} which provides the base `url`, `securityProvider`,
|
|
18
|
+
* and `refreshedSecurityProvider` fields.
|
|
19
|
+
*/
|
|
13
20
|
// data is returned from team search service
|
|
14
21
|
var MentionType = exports.MentionType = /*#__PURE__*/function (MentionType) {
|
|
15
22
|
MentionType[MentionType["SELF"] = 0] = "SELF";
|
|
@@ -12,7 +12,7 @@ var _types = require("../types");
|
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
14
|
var packageName = "@atlaskit/mention";
|
|
15
|
-
var packageVersion = "
|
|
15
|
+
var packageVersion = "0.0.0-development";
|
|
16
16
|
var SLI_EVENT_TYPE = exports.SLI_EVENT_TYPE = 'sli';
|
|
17
17
|
var SMART_EVENT_TYPE = exports.SMART_EVENT_TYPE = 'smart';
|
|
18
18
|
var fireAnalyticsMentionTypeaheadEvent = exports.fireAnalyticsMentionTypeaheadEvent = function fireAnalyticsMentionTypeaheadEvent(props) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildAtlAttributionHeaderValue = buildAtlAttributionHeaderValue;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
|
+
function buildAtlAttributionHeaderValue(config) {
|
|
9
|
+
if (!(0, _platformFeatureFlags.fg)('mentions_custom_headers')) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
var cloudId = config.cloudId,
|
|
13
|
+
activationId = config.activationId,
|
|
14
|
+
_config$productId = config.productId,
|
|
15
|
+
productId = _config$productId === void 0 ? 'platform' : _config$productId;
|
|
16
|
+
var value = {
|
|
17
|
+
tenantId: cloudId,
|
|
18
|
+
product: productId
|
|
19
|
+
};
|
|
20
|
+
if (activationId) {
|
|
21
|
+
value.atlWorkspaceId = "ari:cloud:".concat(productId, ":").concat(cloudId, ":workspace/").concat(activationId);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
'atl-attribution': JSON.stringify(value)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { utils as serviceUtils } from '@atlaskit/util-service-support';
|
|
2
3
|
import { isAppMention, isTeamMention, MentionNameStatus, SliNames, Actions } from '../types';
|
|
3
4
|
import debug from '../util/logger';
|
|
@@ -9,6 +10,14 @@ const MAX_NOTIFIED_ITEMS = 20;
|
|
|
9
10
|
import { SLI_EVENT_TYPE } from '../util/analytics';
|
|
10
11
|
import debounce from 'lodash/debounce';
|
|
11
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for the TeamMentionResource, which extends {@link MentionResourceConfig}
|
|
15
|
+
* to support fetching team mentions from a separate team search service endpoint.
|
|
16
|
+
*
|
|
17
|
+
* Used as the second argument when constructing a {@link TeamMentionResource}, alongside
|
|
18
|
+
* a standard `MentionResourceConfig` for user mentions.
|
|
19
|
+
*/
|
|
20
|
+
|
|
12
21
|
/**
|
|
13
22
|
* Support
|
|
14
23
|
*/
|
|
@@ -257,9 +266,15 @@ export class MentionResource extends AbstractMentionResource {
|
|
|
257
266
|
*/
|
|
258
267
|
async remoteInitialState(contextIdentifier) {
|
|
259
268
|
const queryParams = this.getQueryParams(contextIdentifier);
|
|
269
|
+
const configHeaders = fg('mentions_custom_headers') ? this.config.headers : undefined;
|
|
260
270
|
const options = {
|
|
261
271
|
path: 'bootstrap',
|
|
262
|
-
queryParams
|
|
272
|
+
queryParams,
|
|
273
|
+
...(configHeaders && {
|
|
274
|
+
requestInit: {
|
|
275
|
+
headers: configHeaders
|
|
276
|
+
}
|
|
277
|
+
})
|
|
263
278
|
};
|
|
264
279
|
try {
|
|
265
280
|
const result = await serviceUtils.requestService(this.config, options);
|
|
@@ -276,13 +291,19 @@ export class MentionResource extends AbstractMentionResource {
|
|
|
276
291
|
};
|
|
277
292
|
}
|
|
278
293
|
async remoteSearch(query, contextIdentifier) {
|
|
294
|
+
const configHeaders = fg('mentions_custom_headers') ? this.config.headers : undefined;
|
|
279
295
|
const options = {
|
|
280
296
|
path: 'search',
|
|
281
297
|
queryParams: {
|
|
282
298
|
query,
|
|
283
299
|
limit: MAX_QUERY_ITEMS,
|
|
284
300
|
...this.getQueryParams(contextIdentifier)
|
|
285
|
-
}
|
|
301
|
+
},
|
|
302
|
+
...(configHeaders && {
|
|
303
|
+
requestInit: {
|
|
304
|
+
headers: configHeaders
|
|
305
|
+
}
|
|
306
|
+
})
|
|
286
307
|
};
|
|
287
308
|
try {
|
|
288
309
|
const result = await serviceUtils.requestService(this.config, options);
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { buildAtlAttributionHeaderValue } from '../util/atl-attribution';
|
|
2
4
|
import debug from '../util/logger';
|
|
3
5
|
import { AbstractResource } from './MentionResource';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for the PresenceResource, which manages real-time user
|
|
9
|
+
* presence (online/offline/busy/focus status) by querying a GraphQL-based
|
|
10
|
+
* presence service.
|
|
11
|
+
*/
|
|
12
|
+
|
|
4
13
|
class CacheEntry {
|
|
5
14
|
constructor(pres, timeout) {
|
|
6
15
|
this.presence = pres;
|
|
@@ -70,10 +79,18 @@ class PresenceResource extends AbstractPresenceResource {
|
|
|
70
79
|
if (this.config.productId) {
|
|
71
80
|
query.variables['productId'] = this.config.productId;
|
|
72
81
|
}
|
|
82
|
+
const configHeaders = fg('mentions_custom_headers') ? this.config.headers : undefined;
|
|
83
|
+
const atlAttributionHeader = buildAtlAttributionHeaderValue({
|
|
84
|
+
cloudId: this.config.cloudId,
|
|
85
|
+
productId: this.config.productId,
|
|
86
|
+
activationId: this.config.activationId
|
|
87
|
+
});
|
|
73
88
|
const options = {
|
|
74
89
|
method: 'POST',
|
|
75
90
|
headers: {
|
|
76
|
-
'Content-Type': 'application/json'
|
|
91
|
+
'Content-Type': 'application/json',
|
|
92
|
+
...atlAttributionHeader,
|
|
93
|
+
...configHeaders
|
|
77
94
|
},
|
|
78
95
|
credentials: 'include',
|
|
79
96
|
body: JSON.stringify(query)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { SLI_EVENT_TYPE } from './../util/analytics';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { utils as serviceUtils } from '@atlaskit/util-service-support';
|
|
4
5
|
import { UserType, UserAccessLevel, SliNames, Actions } from '../types';
|
|
5
6
|
import MentionResource from './MentionResource';
|
|
@@ -41,9 +42,15 @@ export default class TeamMentionResource extends MentionResource {
|
|
|
41
42
|
const emptyQuery = '';
|
|
42
43
|
const getUserPromise = super.remoteInitialState(contextIdentifier);
|
|
43
44
|
const queryParams = this.getQueryParamsOfTeamMentionConfig(contextIdentifier);
|
|
45
|
+
const configHeaders = fg('mentions_custom_headers') ? this.teamMentionConfig.headers : undefined;
|
|
44
46
|
const options = {
|
|
45
47
|
path: 'bootstrap',
|
|
46
|
-
queryParams
|
|
48
|
+
queryParams,
|
|
49
|
+
...(configHeaders && {
|
|
50
|
+
requestInit: {
|
|
51
|
+
headers: configHeaders
|
|
52
|
+
}
|
|
53
|
+
})
|
|
47
54
|
};
|
|
48
55
|
const getTeamsPromise = serviceUtils.requestService(this.teamMentionConfig, options);
|
|
49
56
|
this.handleBothRequests(emptyQuery, getUserPromise, getTeamsPromise);
|
|
@@ -137,13 +144,19 @@ export default class TeamMentionResource extends MentionResource {
|
|
|
137
144
|
return super.remoteSearch(query, contextIdentifier);
|
|
138
145
|
}
|
|
139
146
|
async remoteTeamSearch(query, contextIdentifier) {
|
|
147
|
+
const configHeaders = fg('mentions_custom_headers') ? this.teamMentionConfig.headers : undefined;
|
|
140
148
|
const options = {
|
|
141
149
|
path: 'search',
|
|
142
150
|
queryParams: {
|
|
143
151
|
query,
|
|
144
152
|
limit: MAX_QUERY_TEAMS,
|
|
145
153
|
...this.getQueryParamsOfTeamMentionConfig(contextIdentifier)
|
|
146
|
-
}
|
|
154
|
+
},
|
|
155
|
+
...(configHeaders && {
|
|
156
|
+
requestInit: {
|
|
157
|
+
headers: configHeaders
|
|
158
|
+
}
|
|
159
|
+
})
|
|
147
160
|
};
|
|
148
161
|
try {
|
|
149
162
|
const teamResult = await serviceUtils.requestService(this.teamMentionConfig, options);
|
package/dist/es2019/types.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the MentionResource, which provides a JavaScript API
|
|
3
|
+
* for fetching and searching user mentions from a remote service.
|
|
4
|
+
*
|
|
5
|
+
* Extends {@link ServiceConfig} which provides the base `url`, `securityProvider`,
|
|
6
|
+
* and `refreshedSecurityProvider` fields.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
// data is returned from team search service
|
|
2
10
|
|
|
3
11
|
export let MentionType = /*#__PURE__*/function (MentionType) {
|
|
@@ -2,7 +2,7 @@ import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-t
|
|
|
2
2
|
import { ELEMENTS_CHANNEL } from '../_constants';
|
|
3
3
|
import { ComponentNames, isSpecialMentionText } from '../types';
|
|
4
4
|
const packageName = "@atlaskit/mention";
|
|
5
|
-
const packageVersion = "
|
|
5
|
+
const packageVersion = "0.0.0-development";
|
|
6
6
|
export const SLI_EVENT_TYPE = 'sli';
|
|
7
7
|
export const SMART_EVENT_TYPE = 'smart';
|
|
8
8
|
export const fireAnalyticsMentionTypeaheadEvent = props => (action, duration, userIds = [], query) => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
export function buildAtlAttributionHeaderValue(config) {
|
|
3
|
+
if (!fg('mentions_custom_headers')) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
const {
|
|
7
|
+
cloudId,
|
|
8
|
+
activationId,
|
|
9
|
+
productId = 'platform'
|
|
10
|
+
} = config;
|
|
11
|
+
const value = {
|
|
12
|
+
tenantId: cloudId,
|
|
13
|
+
product: productId
|
|
14
|
+
};
|
|
15
|
+
if (activationId) {
|
|
16
|
+
value.atlWorkspaceId = `ari:cloud:${productId}:${cloudId}:workspace/${activationId}`;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
'atl-attribution': JSON.stringify(value)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -10,6 +10,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
11
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
12
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { utils as serviceUtils } from '@atlaskit/util-service-support';
|
|
14
15
|
import { isAppMention, isTeamMention, MentionNameStatus, SliNames, Actions } from '../types';
|
|
15
16
|
import debug from '../util/logger';
|
|
@@ -21,6 +22,14 @@ var MAX_NOTIFIED_ITEMS = 20;
|
|
|
21
22
|
import { SLI_EVENT_TYPE } from '../util/analytics';
|
|
22
23
|
import debounce from 'lodash/debounce';
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for the TeamMentionResource, which extends {@link MentionResourceConfig}
|
|
27
|
+
* to support fetching team mentions from a separate team search service endpoint.
|
|
28
|
+
*
|
|
29
|
+
* Used as the second argument when constructing a {@link TeamMentionResource}, alongside
|
|
30
|
+
* a standard `MentionResourceConfig` for user mentions.
|
|
31
|
+
*/
|
|
32
|
+
|
|
24
33
|
/**
|
|
25
34
|
* Support
|
|
26
35
|
*/
|
|
@@ -357,32 +366,37 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
|
|
|
357
366
|
key: "remoteInitialState",
|
|
358
367
|
value: (function () {
|
|
359
368
|
var _remoteInitialState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(contextIdentifier) {
|
|
360
|
-
var queryParams, options, result;
|
|
369
|
+
var queryParams, configHeaders, options, result;
|
|
361
370
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
362
371
|
while (1) switch (_context2.prev = _context2.next) {
|
|
363
372
|
case 0:
|
|
364
373
|
queryParams = this.getQueryParams(contextIdentifier);
|
|
365
|
-
|
|
374
|
+
configHeaders = fg('mentions_custom_headers') ? this.config.headers : undefined;
|
|
375
|
+
options = _objectSpread({
|
|
366
376
|
path: 'bootstrap',
|
|
367
377
|
queryParams: queryParams
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
|
|
378
|
+
}, configHeaders && {
|
|
379
|
+
requestInit: {
|
|
380
|
+
headers: configHeaders
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
_context2.prev = 3;
|
|
384
|
+
_context2.next = 6;
|
|
371
385
|
return serviceUtils.requestService(this.config, options);
|
|
372
|
-
case
|
|
386
|
+
case 6:
|
|
373
387
|
result = _context2.sent;
|
|
374
388
|
this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.INITIAL_STATE, Actions.SUCCEEDED);
|
|
375
389
|
return _context2.abrupt("return", this.transformServiceResponse(result, ''));
|
|
376
|
-
case
|
|
377
|
-
_context2.prev =
|
|
378
|
-
_context2.t0 = _context2["catch"](
|
|
390
|
+
case 11:
|
|
391
|
+
_context2.prev = 11;
|
|
392
|
+
_context2.t0 = _context2["catch"](3);
|
|
379
393
|
this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.INITIAL_STATE, Actions.FAILED);
|
|
380
394
|
throw _context2.t0;
|
|
381
|
-
case
|
|
395
|
+
case 15:
|
|
382
396
|
case "end":
|
|
383
397
|
return _context2.stop();
|
|
384
398
|
}
|
|
385
|
-
}, _callee2, this, [[
|
|
399
|
+
}, _callee2, this, [[3, 11]]);
|
|
386
400
|
}));
|
|
387
401
|
function remoteInitialState(_x3) {
|
|
388
402
|
return _remoteInitialState.apply(this, arguments);
|
|
@@ -400,34 +414,39 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
|
|
|
400
414
|
key: "remoteSearch",
|
|
401
415
|
value: function () {
|
|
402
416
|
var _remoteSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(query, contextIdentifier) {
|
|
403
|
-
var options, result;
|
|
417
|
+
var configHeaders, options, result;
|
|
404
418
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
405
419
|
while (1) switch (_context3.prev = _context3.next) {
|
|
406
420
|
case 0:
|
|
407
|
-
|
|
421
|
+
configHeaders = fg('mentions_custom_headers') ? this.config.headers : undefined;
|
|
422
|
+
options = _objectSpread({
|
|
408
423
|
path: 'search',
|
|
409
424
|
queryParams: _objectSpread({
|
|
410
425
|
query: query,
|
|
411
426
|
limit: MAX_QUERY_ITEMS
|
|
412
427
|
}, this.getQueryParams(contextIdentifier))
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
428
|
+
}, configHeaders && {
|
|
429
|
+
requestInit: {
|
|
430
|
+
headers: configHeaders
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
_context3.prev = 2;
|
|
434
|
+
_context3.next = 5;
|
|
416
435
|
return serviceUtils.requestService(this.config, options);
|
|
417
|
-
case
|
|
436
|
+
case 5:
|
|
418
437
|
result = _context3.sent;
|
|
419
438
|
this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH, Actions.SUCCEEDED);
|
|
420
439
|
return _context3.abrupt("return", this.transformServiceResponse(result, query));
|
|
421
|
-
case
|
|
422
|
-
_context3.prev =
|
|
423
|
-
_context3.t0 = _context3["catch"](
|
|
440
|
+
case 10:
|
|
441
|
+
_context3.prev = 10;
|
|
442
|
+
_context3.t0 = _context3["catch"](2);
|
|
424
443
|
this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH, Actions.FAILED);
|
|
425
444
|
throw _context3.t0;
|
|
426
|
-
case
|
|
445
|
+
case 14:
|
|
427
446
|
case "end":
|
|
428
447
|
return _context3.stop();
|
|
429
448
|
}
|
|
430
|
-
}, _callee3, this, [[
|
|
449
|
+
}, _callee3, this, [[2, 10]]);
|
|
431
450
|
}));
|
|
432
451
|
function remoteSearch(_x4, _x5) {
|
|
433
452
|
return _remoteSearch.apply(this, arguments);
|
|
@@ -7,10 +7,20 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
7
7
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
8
8
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
9
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
12
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
|
+
import { buildAtlAttributionHeaderValue } from '../util/atl-attribution';
|
|
12
16
|
import debug from '../util/logger';
|
|
13
17
|
import { AbstractResource } from './MentionResource';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for the PresenceResource, which manages real-time user
|
|
21
|
+
* presence (online/offline/busy/focus status) by querying a GraphQL-based
|
|
22
|
+
* presence service.
|
|
23
|
+
*/
|
|
14
24
|
var CacheEntry = /*#__PURE__*/function () {
|
|
15
25
|
function CacheEntry(pres, timeout) {
|
|
16
26
|
_classCallCheck(this, CacheEntry);
|
|
@@ -101,11 +111,17 @@ var PresenceResource = /*#__PURE__*/function (_AbstractPresenceReso) {
|
|
|
101
111
|
if (this.config.productId) {
|
|
102
112
|
query.variables['productId'] = this.config.productId;
|
|
103
113
|
}
|
|
114
|
+
var configHeaders = fg('mentions_custom_headers') ? this.config.headers : undefined;
|
|
115
|
+
var atlAttributionHeader = buildAtlAttributionHeaderValue({
|
|
116
|
+
cloudId: this.config.cloudId,
|
|
117
|
+
productId: this.config.productId,
|
|
118
|
+
activationId: this.config.activationId
|
|
119
|
+
});
|
|
104
120
|
var options = {
|
|
105
121
|
method: 'POST',
|
|
106
|
-
headers: {
|
|
122
|
+
headers: _objectSpread(_objectSpread({
|
|
107
123
|
'Content-Type': 'application/json'
|
|
108
|
-
},
|
|
124
|
+
}, atlAttributionHeader), configHeaders),
|
|
109
125
|
credentials: 'include',
|
|
110
126
|
body: JSON.stringify(query)
|
|
111
127
|
};
|
|
@@ -7,13 +7,14 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
7
7
|
import _get from "@babel/runtime/helpers/get";
|
|
8
8
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
13
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
14
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
15
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
16
16
|
import { SLI_EVENT_TYPE } from './../util/analytics';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { utils as serviceUtils } from '@atlaskit/util-service-support';
|
|
18
19
|
import { UserType, UserAccessLevel, SliNames, Actions } from '../types';
|
|
19
20
|
import MentionResource from './MentionResource';
|
|
@@ -61,20 +62,25 @@ var TeamMentionResource = /*#__PURE__*/function (_MentionResource) {
|
|
|
61
62
|
key: "remoteInitialStateTeamAndUsers",
|
|
62
63
|
value: (function () {
|
|
63
64
|
var _remoteInitialStateTeamAndUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(contextIdentifier) {
|
|
64
|
-
var emptyQuery, getUserPromise, queryParams, options, getTeamsPromise;
|
|
65
|
+
var emptyQuery, getUserPromise, queryParams, configHeaders, options, getTeamsPromise;
|
|
65
66
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
66
67
|
while (1) switch (_context.prev = _context.next) {
|
|
67
68
|
case 0:
|
|
68
69
|
emptyQuery = '';
|
|
69
70
|
getUserPromise = _superPropGet(TeamMentionResource, "remoteInitialState", this, 3)([contextIdentifier]);
|
|
70
71
|
queryParams = this.getQueryParamsOfTeamMentionConfig(contextIdentifier);
|
|
71
|
-
|
|
72
|
+
configHeaders = fg('mentions_custom_headers') ? this.teamMentionConfig.headers : undefined;
|
|
73
|
+
options = _objectSpread({
|
|
72
74
|
path: 'bootstrap',
|
|
73
75
|
queryParams: queryParams
|
|
74
|
-
}
|
|
76
|
+
}, configHeaders && {
|
|
77
|
+
requestInit: {
|
|
78
|
+
headers: configHeaders
|
|
79
|
+
}
|
|
80
|
+
});
|
|
75
81
|
getTeamsPromise = serviceUtils.requestService(this.teamMentionConfig, options);
|
|
76
82
|
this.handleBothRequests(emptyQuery, getUserPromise, getTeamsPromise);
|
|
77
|
-
case
|
|
83
|
+
case 7:
|
|
78
84
|
case "end":
|
|
79
85
|
return _context.stop();
|
|
80
86
|
}
|
|
@@ -207,34 +213,39 @@ var TeamMentionResource = /*#__PURE__*/function (_MentionResource) {
|
|
|
207
213
|
key: "remoteTeamSearch",
|
|
208
214
|
value: function () {
|
|
209
215
|
var _remoteTeamSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(query, contextIdentifier) {
|
|
210
|
-
var options, teamResult;
|
|
216
|
+
var configHeaders, options, teamResult;
|
|
211
217
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
212
218
|
while (1) switch (_context3.prev = _context3.next) {
|
|
213
219
|
case 0:
|
|
214
|
-
|
|
220
|
+
configHeaders = fg('mentions_custom_headers') ? this.teamMentionConfig.headers : undefined;
|
|
221
|
+
options = _objectSpread({
|
|
215
222
|
path: 'search',
|
|
216
223
|
queryParams: _objectSpread({
|
|
217
224
|
query: query,
|
|
218
225
|
limit: MAX_QUERY_TEAMS
|
|
219
226
|
}, this.getQueryParamsOfTeamMentionConfig(contextIdentifier))
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
}, configHeaders && {
|
|
228
|
+
requestInit: {
|
|
229
|
+
headers: configHeaders
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
_context3.prev = 2;
|
|
233
|
+
_context3.next = 5;
|
|
223
234
|
return serviceUtils.requestService(this.teamMentionConfig, options);
|
|
224
|
-
case
|
|
235
|
+
case 5:
|
|
225
236
|
teamResult = _context3.sent;
|
|
226
237
|
this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH_TEAM, Actions.SUCCEEDED);
|
|
227
238
|
return _context3.abrupt("return", this.convertTeamResultToMentionResult(teamResult, query));
|
|
228
|
-
case
|
|
229
|
-
_context3.prev =
|
|
230
|
-
_context3.t0 = _context3["catch"](
|
|
239
|
+
case 10:
|
|
240
|
+
_context3.prev = 10;
|
|
241
|
+
_context3.t0 = _context3["catch"](2);
|
|
231
242
|
this._notifyAnalyticsListeners(SLI_EVENT_TYPE, SliNames.SEARCH_TEAM, Actions.FAILED);
|
|
232
243
|
throw _context3.t0;
|
|
233
|
-
case
|
|
244
|
+
case 14:
|
|
234
245
|
case "end":
|
|
235
246
|
return _context3.stop();
|
|
236
247
|
}
|
|
237
|
-
}, _callee3, this, [[
|
|
248
|
+
}, _callee3, this, [[2, 10]]);
|
|
238
249
|
}));
|
|
239
250
|
function remoteTeamSearch(_x5, _x6) {
|
|
240
251
|
return _remoteTeamSearch.apply(this, arguments);
|
package/dist/esm/types.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the MentionResource, which provides a JavaScript API
|
|
3
|
+
* for fetching and searching user mentions from a remote service.
|
|
4
|
+
*
|
|
5
|
+
* Extends {@link ServiceConfig} which provides the base `url`, `securityProvider`,
|
|
6
|
+
* and `refreshedSecurityProvider` fields.
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
// data is returned from team search service
|
|
2
10
|
|
|
3
11
|
export var MentionType = /*#__PURE__*/function (MentionType) {
|
|
@@ -5,7 +5,7 @@ import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-t
|
|
|
5
5
|
import { ELEMENTS_CHANNEL } from '../_constants';
|
|
6
6
|
import { ComponentNames, isSpecialMentionText } from '../types';
|
|
7
7
|
var packageName = "@atlaskit/mention";
|
|
8
|
-
var packageVersion = "
|
|
8
|
+
var packageVersion = "0.0.0-development";
|
|
9
9
|
export var SLI_EVENT_TYPE = 'sli';
|
|
10
10
|
export var SMART_EVENT_TYPE = 'smart';
|
|
11
11
|
export var fireAnalyticsMentionTypeaheadEvent = function fireAnalyticsMentionTypeaheadEvent(props) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
export function buildAtlAttributionHeaderValue(config) {
|
|
3
|
+
if (!fg('mentions_custom_headers')) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
var cloudId = config.cloudId,
|
|
7
|
+
activationId = config.activationId,
|
|
8
|
+
_config$productId = config.productId,
|
|
9
|
+
productId = _config$productId === void 0 ? 'platform' : _config$productId;
|
|
10
|
+
var value = {
|
|
11
|
+
tenantId: cloudId,
|
|
12
|
+
product: productId
|
|
13
|
+
};
|
|
14
|
+
if (activationId) {
|
|
15
|
+
value.atlWorkspaceId = "ari:cloud:".concat(productId, ":").concat(cloudId, ":workspace/").concat(activationId);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
'atl-attribution': JSON.stringify(value)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { type AnalyticsCallback, type ErrorCallback, type InfoCallback, type InviteFlow, type MentionContextIdentifier, type MentionDescription, type MentionNameDetails, type MentionProvider, type MentionResourceConfig, type MentionsResult, type MentionStats, type ResourceProvider, type ResultCallback, type UserRole } from '../types';
|
|
2
2
|
export type { MentionStats, ResultCallback, ErrorCallback, InfoCallback, MentionResourceConfig, ResourceProvider, MentionContextIdentifier, MentionProvider, } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the TeamMentionResource, which extends {@link MentionResourceConfig}
|
|
5
|
+
* to support fetching team mentions from a separate team search service endpoint.
|
|
6
|
+
*
|
|
7
|
+
* Used as the second argument when constructing a {@link TeamMentionResource}, alongside
|
|
8
|
+
* a standard `MentionResourceConfig` for user mentions.
|
|
9
|
+
*/
|
|
3
10
|
export interface TeamMentionResourceConfig extends MentionResourceConfig {
|
|
11
|
+
/**
|
|
12
|
+
* A custom resolver function to generate the URL for a team's profile page.
|
|
13
|
+
* If not provided, a default link of `{window.location.origin}/people/team/{teamId}` is used.
|
|
14
|
+
*
|
|
15
|
+
* @param teamId - The ID of the team (with any ARI prefix already trimmed).
|
|
16
|
+
* @returns The full URL to the team's profile page.
|
|
17
|
+
*/
|
|
4
18
|
teamLinkResolver?: (teamId: string) => string;
|
|
5
19
|
}
|
|
6
20
|
/**
|
|
@@ -3,12 +3,52 @@ import { AbstractResource, type ResourceProvider } from './MentionResource';
|
|
|
3
3
|
export interface PresenceMap {
|
|
4
4
|
[userId: string]: Presence;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for the PresenceResource, which manages real-time user
|
|
8
|
+
* presence (online/offline/busy/focus status) by querying a GraphQL-based
|
|
9
|
+
* presence service.
|
|
10
|
+
*/
|
|
6
11
|
export interface PresenceResourceConfig {
|
|
12
|
+
/**
|
|
13
|
+
* The activation ID for the current product instance, used to build
|
|
14
|
+
* the `atl-attribution` header for presence service requests.
|
|
15
|
+
*/
|
|
16
|
+
activationId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A custom cache implementation for storing presence data. If not provided,
|
|
19
|
+
* a {@link DefaultPresenceCache} is used with the specified `cacheExpiry`.
|
|
20
|
+
*/
|
|
7
21
|
cache?: PresenceCache;
|
|
22
|
+
/**
|
|
23
|
+
* The expiry time in milliseconds for cached presence entries.
|
|
24
|
+
* Defaults to 20,000ms (20 seconds) when using the default cache.
|
|
25
|
+
*/
|
|
8
26
|
cacheExpiry?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The cloud ID (organization ID) of the Atlassian site. Required.
|
|
29
|
+
* Used as the `organizationId` variable in the presence GraphQL query.
|
|
30
|
+
*/
|
|
9
31
|
cloudId: string;
|
|
32
|
+
/**
|
|
33
|
+
* Custom HTTP headers to include in presence service requests.
|
|
34
|
+
* Only applied when the `mentions_custom_headers` feature flag is enabled.
|
|
35
|
+
*/
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* A custom parser for transforming raw presence service responses into
|
|
39
|
+
* a {@link PresenceMap}. If not provided, a {@link DefaultPresenceParser} is used,
|
|
40
|
+
* which maps `'available'` → `'online'` and `'unavailable'` → `'offline'`.
|
|
41
|
+
*/
|
|
10
42
|
parser?: PresenceParser;
|
|
43
|
+
/**
|
|
44
|
+
* The product identifier (e.g. `'confluence'`, `'jira'`) passed as the
|
|
45
|
+
* `product` variable in the presence GraphQL query to scope results.
|
|
46
|
+
*/
|
|
11
47
|
productId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The base URL of the presence service endpoint. Required.
|
|
50
|
+
* A trailing slash will be appended automatically if not present.
|
|
51
|
+
*/
|
|
12
52
|
url: string;
|
|
13
53
|
}
|
|
14
54
|
export interface PresenceCache {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -21,16 +21,78 @@ export interface AnalyticsCallback {
|
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
}): void;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for the MentionResource, which provides a JavaScript API
|
|
26
|
+
* for fetching and searching user mentions from a remote service.
|
|
27
|
+
*
|
|
28
|
+
* Extends {@link ServiceConfig} which provides the base `url`, `securityProvider`,
|
|
29
|
+
* and `refreshedSecurityProvider` fields.
|
|
30
|
+
*/
|
|
24
31
|
export interface MentionResourceConfig extends ServiceConfig {
|
|
32
|
+
/**
|
|
33
|
+
* The ID of the container (e.g. a Confluence space or Jira project) used to scope
|
|
34
|
+
* mention search results. Can be overridden by `MentionContextIdentifier.containerId`.
|
|
35
|
+
*/
|
|
25
36
|
containerId?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Debounce time in milliseconds for the `filter` method. When set, rapid successive
|
|
39
|
+
* calls to `filter` will be debounced to reduce the number of network requests.
|
|
40
|
+
*/
|
|
26
41
|
debounceTime?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Custom HTTP headers to include in mention service requests.
|
|
44
|
+
* Only applied when the `mentions_custom_headers` feature flag is enabled.
|
|
45
|
+
*/
|
|
46
|
+
headers?: Record<string, string>;
|
|
47
|
+
/**
|
|
48
|
+
* Callback to invite a cross-product user. Invoked when a user from another
|
|
49
|
+
* Atlassian product is selected for mention and needs to be invited.
|
|
50
|
+
*
|
|
51
|
+
* @param userId - The ID of the user to invite.
|
|
52
|
+
* @param mentionName - The display name of the user being invited.
|
|
53
|
+
* @returns A promise that resolves when the invitation is complete.
|
|
54
|
+
*/
|
|
27
55
|
inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* A resolver for looking up and caching mention display names by user ID.
|
|
58
|
+
* Used by `ResolvingMentionProvider` to resolve names for mentions that
|
|
59
|
+
* only have an ID (e.g. when rendering stored mention nodes).
|
|
60
|
+
*/
|
|
28
61
|
mentionNameResolver?: MentionNameResolver;
|
|
62
|
+
/**
|
|
63
|
+
* Callback invoked when the inline invite item is clicked in the mention picker.
|
|
64
|
+
*
|
|
65
|
+
* @param flow - The type of invite flow, either `'mention'` or `'assign'`.
|
|
66
|
+
*/
|
|
29
67
|
onInviteItemClick?: (flow: InviteFlow) => void;
|
|
68
|
+
/**
|
|
69
|
+
* The product identifier (e.g. `'confluence'`, `'jira'`) sent as a query parameter
|
|
70
|
+
* (`productIdentifier`) to the mention service for product-scoped results.
|
|
71
|
+
*/
|
|
30
72
|
productId?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The display name of the product, exposed on the `MentionProvider` for use
|
|
75
|
+
* by invite-related UI components.
|
|
76
|
+
*/
|
|
31
77
|
productName?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to enable the inline invite functionality in the mention picker,
|
|
80
|
+
* allowing users to invite people who are not yet part of the site.
|
|
81
|
+
*/
|
|
32
82
|
shouldEnableInvite?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* A function to determine whether a given mention should be visually highlighted
|
|
85
|
+
* (e.g. as a self-mention). When provided, it is called for each mention to decide
|
|
86
|
+
* if the `MentionType.SELF` styling should be applied.
|
|
87
|
+
*
|
|
88
|
+
* @param mention - The mention to evaluate.
|
|
89
|
+
* @returns `true` if the mention should be highlighted.
|
|
90
|
+
*/
|
|
33
91
|
shouldHighlightMention?: (mention: MentionDescription) => boolean;
|
|
92
|
+
/**
|
|
93
|
+
* The role of the current user, used to determine invite permissions
|
|
94
|
+
* in the mention picker. Defaults to `'basic'` if not provided.
|
|
95
|
+
*/
|
|
34
96
|
userRole?: UserRole;
|
|
35
97
|
}
|
|
36
98
|
export interface ResourceProvider<Result> {
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { type AnalyticsCallback, type ErrorCallback, type InfoCallback, type InviteFlow, type MentionContextIdentifier, type MentionDescription, type MentionNameDetails, type MentionProvider, type MentionResourceConfig, type MentionsResult, type MentionStats, type ResourceProvider, type ResultCallback, type UserRole } from '../types';
|
|
2
2
|
export type { MentionStats, ResultCallback, ErrorCallback, InfoCallback, MentionResourceConfig, ResourceProvider, MentionContextIdentifier, MentionProvider, } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the TeamMentionResource, which extends {@link MentionResourceConfig}
|
|
5
|
+
* to support fetching team mentions from a separate team search service endpoint.
|
|
6
|
+
*
|
|
7
|
+
* Used as the second argument when constructing a {@link TeamMentionResource}, alongside
|
|
8
|
+
* a standard `MentionResourceConfig` for user mentions.
|
|
9
|
+
*/
|
|
3
10
|
export interface TeamMentionResourceConfig extends MentionResourceConfig {
|
|
11
|
+
/**
|
|
12
|
+
* A custom resolver function to generate the URL for a team's profile page.
|
|
13
|
+
* If not provided, a default link of `{window.location.origin}/people/team/{teamId}` is used.
|
|
14
|
+
*
|
|
15
|
+
* @param teamId - The ID of the team (with any ARI prefix already trimmed).
|
|
16
|
+
* @returns The full URL to the team's profile page.
|
|
17
|
+
*/
|
|
4
18
|
teamLinkResolver?: (teamId: string) => string;
|
|
5
19
|
}
|
|
6
20
|
/**
|
|
@@ -3,12 +3,52 @@ import { AbstractResource, type ResourceProvider } from './MentionResource';
|
|
|
3
3
|
export interface PresenceMap {
|
|
4
4
|
[userId: string]: Presence;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for the PresenceResource, which manages real-time user
|
|
8
|
+
* presence (online/offline/busy/focus status) by querying a GraphQL-based
|
|
9
|
+
* presence service.
|
|
10
|
+
*/
|
|
6
11
|
export interface PresenceResourceConfig {
|
|
12
|
+
/**
|
|
13
|
+
* The activation ID for the current product instance, used to build
|
|
14
|
+
* the `atl-attribution` header for presence service requests.
|
|
15
|
+
*/
|
|
16
|
+
activationId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A custom cache implementation for storing presence data. If not provided,
|
|
19
|
+
* a {@link DefaultPresenceCache} is used with the specified `cacheExpiry`.
|
|
20
|
+
*/
|
|
7
21
|
cache?: PresenceCache;
|
|
22
|
+
/**
|
|
23
|
+
* The expiry time in milliseconds for cached presence entries.
|
|
24
|
+
* Defaults to 20,000ms (20 seconds) when using the default cache.
|
|
25
|
+
*/
|
|
8
26
|
cacheExpiry?: number;
|
|
27
|
+
/**
|
|
28
|
+
* The cloud ID (organization ID) of the Atlassian site. Required.
|
|
29
|
+
* Used as the `organizationId` variable in the presence GraphQL query.
|
|
30
|
+
*/
|
|
9
31
|
cloudId: string;
|
|
32
|
+
/**
|
|
33
|
+
* Custom HTTP headers to include in presence service requests.
|
|
34
|
+
* Only applied when the `mentions_custom_headers` feature flag is enabled.
|
|
35
|
+
*/
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* A custom parser for transforming raw presence service responses into
|
|
39
|
+
* a {@link PresenceMap}. If not provided, a {@link DefaultPresenceParser} is used,
|
|
40
|
+
* which maps `'available'` → `'online'` and `'unavailable'` → `'offline'`.
|
|
41
|
+
*/
|
|
10
42
|
parser?: PresenceParser;
|
|
43
|
+
/**
|
|
44
|
+
* The product identifier (e.g. `'confluence'`, `'jira'`) passed as the
|
|
45
|
+
* `product` variable in the presence GraphQL query to scope results.
|
|
46
|
+
*/
|
|
11
47
|
productId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The base URL of the presence service endpoint. Required.
|
|
50
|
+
* A trailing slash will be appended automatically if not present.
|
|
51
|
+
*/
|
|
12
52
|
url: string;
|
|
13
53
|
}
|
|
14
54
|
export interface PresenceCache {
|
|
@@ -21,16 +21,78 @@ export interface AnalyticsCallback {
|
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
}): void;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for the MentionResource, which provides a JavaScript API
|
|
26
|
+
* for fetching and searching user mentions from a remote service.
|
|
27
|
+
*
|
|
28
|
+
* Extends {@link ServiceConfig} which provides the base `url`, `securityProvider`,
|
|
29
|
+
* and `refreshedSecurityProvider` fields.
|
|
30
|
+
*/
|
|
24
31
|
export interface MentionResourceConfig extends ServiceConfig {
|
|
32
|
+
/**
|
|
33
|
+
* The ID of the container (e.g. a Confluence space or Jira project) used to scope
|
|
34
|
+
* mention search results. Can be overridden by `MentionContextIdentifier.containerId`.
|
|
35
|
+
*/
|
|
25
36
|
containerId?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Debounce time in milliseconds for the `filter` method. When set, rapid successive
|
|
39
|
+
* calls to `filter` will be debounced to reduce the number of network requests.
|
|
40
|
+
*/
|
|
26
41
|
debounceTime?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Custom HTTP headers to include in mention service requests.
|
|
44
|
+
* Only applied when the `mentions_custom_headers` feature flag is enabled.
|
|
45
|
+
*/
|
|
46
|
+
headers?: Record<string, string>;
|
|
47
|
+
/**
|
|
48
|
+
* Callback to invite a cross-product user. Invoked when a user from another
|
|
49
|
+
* Atlassian product is selected for mention and needs to be invited.
|
|
50
|
+
*
|
|
51
|
+
* @param userId - The ID of the user to invite.
|
|
52
|
+
* @param mentionName - The display name of the user being invited.
|
|
53
|
+
* @returns A promise that resolves when the invitation is complete.
|
|
54
|
+
*/
|
|
27
55
|
inviteXProductUser?: (userId: string, mentionName: string) => Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* A resolver for looking up and caching mention display names by user ID.
|
|
58
|
+
* Used by `ResolvingMentionProvider` to resolve names for mentions that
|
|
59
|
+
* only have an ID (e.g. when rendering stored mention nodes).
|
|
60
|
+
*/
|
|
28
61
|
mentionNameResolver?: MentionNameResolver;
|
|
62
|
+
/**
|
|
63
|
+
* Callback invoked when the inline invite item is clicked in the mention picker.
|
|
64
|
+
*
|
|
65
|
+
* @param flow - The type of invite flow, either `'mention'` or `'assign'`.
|
|
66
|
+
*/
|
|
29
67
|
onInviteItemClick?: (flow: InviteFlow) => void;
|
|
68
|
+
/**
|
|
69
|
+
* The product identifier (e.g. `'confluence'`, `'jira'`) sent as a query parameter
|
|
70
|
+
* (`productIdentifier`) to the mention service for product-scoped results.
|
|
71
|
+
*/
|
|
30
72
|
productId?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The display name of the product, exposed on the `MentionProvider` for use
|
|
75
|
+
* by invite-related UI components.
|
|
76
|
+
*/
|
|
31
77
|
productName?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to enable the inline invite functionality in the mention picker,
|
|
80
|
+
* allowing users to invite people who are not yet part of the site.
|
|
81
|
+
*/
|
|
32
82
|
shouldEnableInvite?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* A function to determine whether a given mention should be visually highlighted
|
|
85
|
+
* (e.g. as a self-mention). When provided, it is called for each mention to decide
|
|
86
|
+
* if the `MentionType.SELF` styling should be applied.
|
|
87
|
+
*
|
|
88
|
+
* @param mention - The mention to evaluate.
|
|
89
|
+
* @returns `true` if the mention should be highlighted.
|
|
90
|
+
*/
|
|
33
91
|
shouldHighlightMention?: (mention: MentionDescription) => boolean;
|
|
92
|
+
/**
|
|
93
|
+
* The role of the current user, used to determine invite permissions
|
|
94
|
+
* in the mention picker. Defaults to `'basic'` if not provided.
|
|
95
|
+
*/
|
|
34
96
|
userRole?: UserRole;
|
|
35
97
|
}
|
|
36
98
|
export interface ResourceProvider<Result> {
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@atlaskit/afm-i18n-platform-elements-mention": "2.7.0",
|
|
23
23
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
24
24
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
25
|
-
"@atlaskit/avatar": "^25.
|
|
25
|
+
"@atlaskit/avatar": "^25.8.0",
|
|
26
26
|
"@atlaskit/focus-ring": "^3.0.0",
|
|
27
27
|
"@atlaskit/heading": "^5.3.0",
|
|
28
28
|
"@atlaskit/icon": "^31.0.0",
|
|
@@ -83,6 +83,9 @@
|
|
|
83
83
|
"jira_ai_agent_avatar_issue_view_comment_mentions": {
|
|
84
84
|
"type": "boolean"
|
|
85
85
|
},
|
|
86
|
+
"mentions_custom_headers": {
|
|
87
|
+
"type": "boolean"
|
|
88
|
+
},
|
|
86
89
|
"team-avatar-in-mention-picker": {
|
|
87
90
|
"type": "boolean"
|
|
88
91
|
}
|
|
@@ -112,5 +115,5 @@
|
|
|
112
115
|
]
|
|
113
116
|
}
|
|
114
117
|
},
|
|
115
|
-
"version": "24.
|
|
118
|
+
"version": "24.5.0"
|
|
116
119
|
}
|