@atlaskit/profilecard 26.5.5 → 26.7.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 +16 -0
- package/dist/cjs/client/RovoAgentCardClient.js +78 -1
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/client/sharedAgentProfileCache.js +16 -0
- package/dist/cjs/components/Agent/AgentProfileCard.js +4 -2
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +4 -2
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +2 -1
- package/dist/cjs/util/analytics.js +2 -2
- package/dist/es2019/client/RovoAgentCardClient.js +73 -1
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/client/sharedAgentProfileCache.js +11 -0
- package/dist/es2019/components/Agent/AgentProfileCard.js +3 -2
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +4 -2
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +2 -1
- package/dist/es2019/util/analytics.js +2 -2
- package/dist/esm/client/RovoAgentCardClient.js +78 -1
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/client/sharedAgentProfileCache.js +11 -0
- package/dist/esm/components/Agent/AgentProfileCard.js +4 -2
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +4 -2
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +2 -1
- package/dist/esm/util/analytics.js +2 -2
- package/dist/types/client/RovoAgentCardClient.d.ts +7 -0
- package/dist/types/client/sharedAgentProfileCache.d.ts +13 -0
- package/dist/types/components/Agent/AgentProfileCard.d.ts +1 -1
- package/dist/types/components/Agent/AgentProfileCardResourced.d.ts +2 -0
- package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +1 -1
- package/dist/types/types.d.ts +3 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 26.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`93235e9d6a758`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/93235e9d6a758) -
|
|
8
|
+
Add a hideStarButton prop to the agent profile card (AgentProfileCard, AgentProfileCardResourced,
|
|
9
|
+
AgentProfileCardTrigger) so consumers can hide the favourite/star icon — e.g. for the Rovo profile
|
|
10
|
+
card and private agent profile card.
|
|
11
|
+
|
|
12
|
+
## 26.6.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [`7fe653c5ef53b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7fe653c5ef53b) -
|
|
17
|
+
Fix agent profile card favourite status not updating until page refresh.
|
|
18
|
+
|
|
3
19
|
## 26.5.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -8,6 +8,7 @@ exports.default = exports.AgentForbiddenError = void 0;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
11
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -22,8 +23,10 @@ var _rovoAgentUtils = require("../util/rovoAgentUtils");
|
|
|
22
23
|
var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
|
|
23
24
|
var _errorUtils = require("./errorUtils");
|
|
24
25
|
var _graphqlUtils = require("./graphqlUtils");
|
|
26
|
+
var _sharedAgentProfileCache = require("./sharedAgentProfileCache");
|
|
25
27
|
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; }
|
|
26
28
|
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; }
|
|
29
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
27
30
|
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)); }
|
|
28
31
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
29
32
|
var AgentForbiddenError = exports.AgentForbiddenError = /*#__PURE__*/function (_Error) {
|
|
@@ -98,6 +101,41 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
98
101
|
value: function basePath() {
|
|
99
102
|
return '/gateway/api/assist/rovo/v1/agents';
|
|
100
103
|
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "sharedCacheKey",
|
|
106
|
+
value: function sharedCacheKey(idValue) {
|
|
107
|
+
var _this$options$cloudId;
|
|
108
|
+
return "".concat((_this$options$cloudId = this.options.cloudId) !== null && _this$options$cloudId !== void 0 ? _this$options$cloudId : '', ":").concat(idValue);
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "getCachedProfile",
|
|
112
|
+
value: function getCachedProfile(idValue) {
|
|
113
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_agent_profile_card_favourite_sync')) {
|
|
114
|
+
return _superPropGet(RovoAgentCardClient, "getCachedProfile", this, 3)([idValue]);
|
|
115
|
+
}
|
|
116
|
+
var key = this.sharedCacheKey(idValue);
|
|
117
|
+
var cached = _sharedAgentProfileCache.sharedAgentProfileCache.get(key);
|
|
118
|
+
if (!cached) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
if (cached.expire < Date.now()) {
|
|
122
|
+
_sharedAgentProfileCache.sharedAgentProfileCache.delete(key);
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
return cached.profile;
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "setCachedProfile",
|
|
129
|
+
value: function setCachedProfile(idValue, profile) {
|
|
130
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_agent_profile_card_favourite_sync')) {
|
|
131
|
+
_superPropGet(RovoAgentCardClient, "setCachedProfile", this, 3)([idValue, profile]);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
_sharedAgentProfileCache.sharedAgentProfileCache.set(this.sharedCacheKey(idValue), {
|
|
135
|
+
expire: Date.now() + (this.config.cacheMaxAge || _sharedAgentProfileCache.SHARED_CACHE_MAX_AGE),
|
|
136
|
+
profile: profile
|
|
137
|
+
});
|
|
138
|
+
}
|
|
101
139
|
}, {
|
|
102
140
|
key: "getActivationId",
|
|
103
141
|
value: function () {
|
|
@@ -282,7 +320,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
282
320
|
}, _analytics.PACKAGE_META_DATA));
|
|
283
321
|
}
|
|
284
322
|
_this4.makeRequest(id, analytics).then(function (data) {
|
|
285
|
-
if (_this4.cache) {
|
|
323
|
+
if (_this4.cache || (0, _platformFeatureFlags.fg)('platform_editor_agent_profile_card_favourite_sync')) {
|
|
286
324
|
_this4.setCachedProfile(id.value, data);
|
|
287
325
|
}
|
|
288
326
|
if (analytics) {
|
|
@@ -386,6 +424,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
386
424
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
387
425
|
}, _analytics.PACKAGE_META_DATA));
|
|
388
426
|
}
|
|
427
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_agent_profile_card_favourite_sync')) {
|
|
428
|
+
_this6.syncFavouriteToCache(agentId, isFavourite);
|
|
429
|
+
}
|
|
389
430
|
resolve();
|
|
390
431
|
}).catch(function (error) {
|
|
391
432
|
if (analytics) {
|
|
@@ -409,6 +450,42 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
409
450
|
};
|
|
410
451
|
}());
|
|
411
452
|
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Keeps the shared agent profile cache in sync with the favourite state
|
|
456
|
+
*/
|
|
457
|
+
}, {
|
|
458
|
+
key: "syncFavouriteToCache",
|
|
459
|
+
value: function syncFavouriteToCache(agentId, isFavourite) {
|
|
460
|
+
var _this$options$cloudId2;
|
|
461
|
+
var prefix = "".concat((_this$options$cloudId2 = this.options.cloudId) !== null && _this$options$cloudId2 !== void 0 ? _this$options$cloudId2 : '', ":");
|
|
462
|
+
var keysToUpdate = [];
|
|
463
|
+
_sharedAgentProfileCache.sharedAgentProfileCache.forEach(function (cached, key) {
|
|
464
|
+
var _cached$profile;
|
|
465
|
+
if (key.startsWith(prefix) && ((_cached$profile = cached.profile) === null || _cached$profile === void 0 || (_cached$profile = _cached$profile.restData) === null || _cached$profile === void 0 ? void 0 : _cached$profile.id) === agentId) {
|
|
466
|
+
keysToUpdate.push(key);
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
keysToUpdate.forEach(function (key) {
|
|
470
|
+
var _restData$favourite_c;
|
|
471
|
+
var cached = _sharedAgentProfileCache.sharedAgentProfileCache.get(key);
|
|
472
|
+
if (!cached) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
var restData = cached.profile.restData;
|
|
476
|
+
var wasFavourite = restData.favourite;
|
|
477
|
+
var currentCount = (_restData$favourite_c = restData.favourite_count) !== null && _restData$favourite_c !== void 0 ? _restData$favourite_c : 0;
|
|
478
|
+
var favouriteCount = isFavourite ? currentCount + (wasFavourite ? 0 : 1) : Math.max(0, currentCount - (wasFavourite ? 1 : 0));
|
|
479
|
+
_sharedAgentProfileCache.sharedAgentProfileCache.set(key, _objectSpread(_objectSpread({}, cached), {}, {
|
|
480
|
+
profile: _objectSpread(_objectSpread({}, cached.profile), {}, {
|
|
481
|
+
restData: _objectSpread(_objectSpread({}, restData), {}, {
|
|
482
|
+
favourite: isFavourite,
|
|
483
|
+
favourite_count: favouriteCount
|
|
484
|
+
})
|
|
485
|
+
})
|
|
486
|
+
}));
|
|
487
|
+
});
|
|
488
|
+
}
|
|
412
489
|
}, {
|
|
413
490
|
key: "getPermissions",
|
|
414
491
|
value: function getPermissions(id, fireAnalytics) {
|
|
@@ -11,7 +11,7 @@ var _graphqlUtils = require("./graphqlUtils");
|
|
|
11
11
|
var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
|
|
12
12
|
var addHeaders = function addHeaders(headers) {
|
|
13
13
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
14
|
-
headers.append('atl-client-version', "26.
|
|
14
|
+
headers.append('atl-client-version', "26.6.0");
|
|
15
15
|
return headers;
|
|
16
16
|
};
|
|
17
17
|
function getOrgIdForCloudIdFromAGG(_x, _x2) {
|
|
@@ -66,7 +66,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
|
|
|
66
66
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
67
67
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
68
68
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
69
|
-
headers.append('atl-client-version', "26.
|
|
69
|
+
headers.append('atl-client-version', "26.6.0");
|
|
70
70
|
return headers;
|
|
71
71
|
};
|
|
72
72
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sharedAgentProfileCache = exports.SHARED_CACHE_MAX_AGE = void 0;
|
|
7
|
+
var _lru_map = require("lru_map");
|
|
8
|
+
/**
|
|
9
|
+
* Module-level agent profile cache shared across every `RovoAgentCardClient`
|
|
10
|
+
* instance
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var SHARED_CACHE_SIZE = 50;
|
|
14
|
+
var SHARED_CACHE_MAX_AGE = exports.SHARED_CACHE_MAX_AGE = 5 * 60 * 1000; // 5 minutes
|
|
15
|
+
|
|
16
|
+
var sharedAgentProfileCache = exports.sharedAgentProfileCache = new _lru_map.LRUMap(SHARED_CACHE_SIZE);
|
|
@@ -64,7 +64,9 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
64
64
|
_ref$hideConversation = _ref.hideConversationStarters,
|
|
65
65
|
hideConversationStarters = _ref$hideConversation === void 0 ? false : _ref$hideConversation,
|
|
66
66
|
_ref$hideAgentActions = _ref.hideAgentActions,
|
|
67
|
-
hideAgentActions = _ref$hideAgentActions === void 0 ? false : _ref$hideAgentActions
|
|
67
|
+
hideAgentActions = _ref$hideAgentActions === void 0 ? false : _ref$hideAgentActions,
|
|
68
|
+
_ref$hideStarButton = _ref.hideStarButton,
|
|
69
|
+
hideStarButton = _ref$hideStarButton === void 0 ? false : _ref$hideStarButton;
|
|
68
70
|
var _useAgentUrlActions = (0, _useAgentActions.useAgentUrlActions)({
|
|
69
71
|
cloudId: cloudId || '',
|
|
70
72
|
email: email,
|
|
@@ -230,7 +232,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
230
232
|
agentName: agent.name,
|
|
231
233
|
isStarred: isStarred,
|
|
232
234
|
onStarToggle: handleSetFavourite,
|
|
233
|
-
showStarButton: !isRovoDev,
|
|
235
|
+
showStarButton: !isRovoDev && !hideStarButton,
|
|
234
236
|
isHidden: agent.visibility === 'PRIVATE',
|
|
235
237
|
creatorRender: ((_agent$creatorInfo = agent.creatorInfo) === null || _agent$creatorInfo === void 0 ? void 0 : _agent$creatorInfo.type) && /*#__PURE__*/_react.default.createElement(_AgentProfileInfo.AgentProfileCreator, {
|
|
236
238
|
creator: {
|
|
@@ -200,7 +200,8 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
200
200
|
cloudId: props.cloudId,
|
|
201
201
|
hideAgentActions: true,
|
|
202
202
|
hideConversationStarters: true,
|
|
203
|
-
hideAiDisclaimer: true
|
|
203
|
+
hideAiDisclaimer: true,
|
|
204
|
+
hideStarButton: props.hideStarButton
|
|
204
205
|
})));
|
|
205
206
|
}
|
|
206
207
|
if (error || !isLoading && !agentData) {
|
|
@@ -227,6 +228,7 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
227
228
|
hideMoreActions: props.hideMoreActions,
|
|
228
229
|
hideAiDisclaimer: props.hideAiDisclaimer,
|
|
229
230
|
hideConversationStarters: props.hideConversationStarters,
|
|
230
|
-
hideAgentActions: props.hideAgentActions
|
|
231
|
+
hideAgentActions: props.hideAgentActions,
|
|
232
|
+
hideStarButton: props.hideStarButton
|
|
231
233
|
}));
|
|
232
234
|
};
|
|
@@ -178,7 +178,8 @@ var AgentProfileCardTrigger = exports.AgentProfileCardTrigger = /*#__PURE__*/(0,
|
|
|
178
178
|
onConversationStartersClick: props.onConversationStartersClick,
|
|
179
179
|
resourceClient: props.resourceClient,
|
|
180
180
|
onDeleteAgent: props.onDeleteAgent,
|
|
181
|
-
addFlag: props.addFlag
|
|
181
|
+
addFlag: props.addFlag,
|
|
182
|
+
hideStarButton: props.hideStarButton
|
|
182
183
|
}));
|
|
183
184
|
};
|
|
184
185
|
return /*#__PURE__*/_react.default.createElement(_ProfileCardTrigger.default, (0, _extends2.default)({}, props, {
|
|
@@ -12,7 +12,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
12
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) { (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; }
|
|
13
13
|
var PACKAGE_META_DATA = exports.PACKAGE_META_DATA = {
|
|
14
14
|
packageName: (_process$env$_PACKAGE = "@atlaskit/profilecard") !== null && _process$env$_PACKAGE !== void 0 ? _process$env$_PACKAGE : '',
|
|
15
|
-
packageVersion: (_process$env$_PACKAGE2 = "26.
|
|
15
|
+
packageVersion: (_process$env$_PACKAGE2 = "26.6.0") !== null && _process$env$_PACKAGE2 !== void 0 ? _process$env$_PACKAGE2 : ''
|
|
16
16
|
};
|
|
17
17
|
var TEAM_SUBJECT = 'teamProfileCard';
|
|
18
18
|
var USER_SUBJECT = 'profilecard';
|
|
@@ -31,7 +31,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
31
31
|
actionSubjectId: actionSubjectId,
|
|
32
32
|
attributes: _objectSpread(_objectSpread({
|
|
33
33
|
packageName: "@atlaskit/profilecard",
|
|
34
|
-
packageVersion: "26.
|
|
34
|
+
packageVersion: "26.6.0"
|
|
35
35
|
}, attributes), {}, {
|
|
36
36
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
37
37
|
})
|
|
@@ -6,6 +6,7 @@ import { USER_ARI_PREFIX } from '../util/rovoAgentUtils';
|
|
|
6
6
|
import CachingClient from './CachingClient';
|
|
7
7
|
import { getErrorAttributes } from './errorUtils';
|
|
8
8
|
import { AGGQuery } from './graphqlUtils';
|
|
9
|
+
import { SHARED_CACHE_MAX_AGE, sharedAgentProfileCache } from './sharedAgentProfileCache';
|
|
9
10
|
export class AgentForbiddenError extends Error {
|
|
10
11
|
constructor() {
|
|
11
12
|
super('Agent access forbidden');
|
|
@@ -111,6 +112,35 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
111
112
|
basePath() {
|
|
112
113
|
return '/gateway/api/assist/rovo/v1/agents';
|
|
113
114
|
}
|
|
115
|
+
sharedCacheKey(idValue) {
|
|
116
|
+
var _this$options$cloudId;
|
|
117
|
+
return `${(_this$options$cloudId = this.options.cloudId) !== null && _this$options$cloudId !== void 0 ? _this$options$cloudId : ''}:${idValue}`;
|
|
118
|
+
}
|
|
119
|
+
getCachedProfile(idValue) {
|
|
120
|
+
if (!fg('platform_editor_agent_profile_card_favourite_sync')) {
|
|
121
|
+
return super.getCachedProfile(idValue);
|
|
122
|
+
}
|
|
123
|
+
const key = this.sharedCacheKey(idValue);
|
|
124
|
+
const cached = sharedAgentProfileCache.get(key);
|
|
125
|
+
if (!cached) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
if (cached.expire < Date.now()) {
|
|
129
|
+
sharedAgentProfileCache.delete(key);
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
return cached.profile;
|
|
133
|
+
}
|
|
134
|
+
setCachedProfile(idValue, profile) {
|
|
135
|
+
if (!fg('platform_editor_agent_profile_card_favourite_sync')) {
|
|
136
|
+
super.setCachedProfile(idValue, profile);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
sharedAgentProfileCache.set(this.sharedCacheKey(idValue), {
|
|
140
|
+
expire: Date.now() + (this.config.cacheMaxAge || SHARED_CACHE_MAX_AGE),
|
|
141
|
+
profile
|
|
142
|
+
});
|
|
143
|
+
}
|
|
114
144
|
async getActivationId(cloudId, product) {
|
|
115
145
|
var _response$tenantConte, _response$tenantConte2, _response$tenantConte3, _response$tenantConte4;
|
|
116
146
|
const response = await AGGQuery('/gateway/api/graphql', buildActivationIdQuery(cloudId, product));
|
|
@@ -221,7 +251,7 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
221
251
|
});
|
|
222
252
|
}
|
|
223
253
|
this.makeRequest(id, analytics).then(data => {
|
|
224
|
-
if (this.cache) {
|
|
254
|
+
if (this.cache || fg('platform_editor_agent_profile_card_favourite_sync')) {
|
|
225
255
|
this.setCachedProfile(id.value, data);
|
|
226
256
|
}
|
|
227
257
|
if (analytics) {
|
|
@@ -320,6 +350,9 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
320
350
|
...PACKAGE_META_DATA
|
|
321
351
|
});
|
|
322
352
|
}
|
|
353
|
+
if (fg('platform_editor_agent_profile_card_favourite_sync')) {
|
|
354
|
+
this.syncFavouriteToCache(agentId, isFavourite);
|
|
355
|
+
}
|
|
323
356
|
resolve();
|
|
324
357
|
}).catch(error => {
|
|
325
358
|
if (analytics) {
|
|
@@ -335,6 +368,45 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
335
368
|
});
|
|
336
369
|
});
|
|
337
370
|
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Keeps the shared agent profile cache in sync with the favourite state
|
|
374
|
+
*/
|
|
375
|
+
syncFavouriteToCache(agentId, isFavourite) {
|
|
376
|
+
var _this$options$cloudId2;
|
|
377
|
+
const prefix = `${(_this$options$cloudId2 = this.options.cloudId) !== null && _this$options$cloudId2 !== void 0 ? _this$options$cloudId2 : ''}:`;
|
|
378
|
+
const keysToUpdate = [];
|
|
379
|
+
sharedAgentProfileCache.forEach((cached, key) => {
|
|
380
|
+
var _cached$profile, _cached$profile$restD;
|
|
381
|
+
if (key.startsWith(prefix) && ((_cached$profile = cached.profile) === null || _cached$profile === void 0 ? void 0 : (_cached$profile$restD = _cached$profile.restData) === null || _cached$profile$restD === void 0 ? void 0 : _cached$profile$restD.id) === agentId) {
|
|
382
|
+
keysToUpdate.push(key);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
keysToUpdate.forEach(key => {
|
|
386
|
+
var _restData$favourite_c;
|
|
387
|
+
const cached = sharedAgentProfileCache.get(key);
|
|
388
|
+
if (!cached) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const {
|
|
392
|
+
restData
|
|
393
|
+
} = cached.profile;
|
|
394
|
+
const wasFavourite = restData.favourite;
|
|
395
|
+
const currentCount = (_restData$favourite_c = restData.favourite_count) !== null && _restData$favourite_c !== void 0 ? _restData$favourite_c : 0;
|
|
396
|
+
const favouriteCount = isFavourite ? currentCount + (wasFavourite ? 0 : 1) : Math.max(0, currentCount - (wasFavourite ? 1 : 0));
|
|
397
|
+
sharedAgentProfileCache.set(key, {
|
|
398
|
+
...cached,
|
|
399
|
+
profile: {
|
|
400
|
+
...cached.profile,
|
|
401
|
+
restData: {
|
|
402
|
+
...restData,
|
|
403
|
+
favourite: isFavourite,
|
|
404
|
+
favourite_count: favouriteCount
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
}
|
|
338
410
|
getPermissions(id, fireAnalytics) {
|
|
339
411
|
if (!this.options.cloudId) {
|
|
340
412
|
return Promise.reject(new Error('cloudId is missing'));
|
|
@@ -6,7 +6,7 @@ const ORG_ID_FROM_CLOUD_ID_QUERY = `query OrgIdFromCloudId($cloudId: ID!) {
|
|
|
6
6
|
}`;
|
|
7
7
|
const addHeaders = headers => {
|
|
8
8
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
9
|
-
headers.append('atl-client-version', "26.
|
|
9
|
+
headers.append('atl-client-version', "26.6.0");
|
|
10
10
|
return headers;
|
|
11
11
|
};
|
|
12
12
|
export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
|
|
@@ -78,7 +78,7 @@ export const addHeaders = headers => {
|
|
|
78
78
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
79
79
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
80
80
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
81
|
-
headers.append('atl-client-version', "26.
|
|
81
|
+
headers.append('atl-client-version', "26.6.0");
|
|
82
82
|
return headers;
|
|
83
83
|
};
|
|
84
84
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LRUMap } from 'lru_map';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Module-level agent profile cache shared across every `RovoAgentCardClient`
|
|
5
|
+
* instance
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const SHARED_CACHE_SIZE = 50;
|
|
9
|
+
export const SHARED_CACHE_MAX_AGE = 5 * 60 * 1000; // 5 minutes
|
|
10
|
+
|
|
11
|
+
export const sharedAgentProfileCache = new LRUMap(SHARED_CACHE_SIZE);
|
|
@@ -45,7 +45,8 @@ const AgentProfileCard = ({
|
|
|
45
45
|
hideMoreActions,
|
|
46
46
|
hideAiDisclaimer = false,
|
|
47
47
|
hideConversationStarters = false,
|
|
48
|
-
hideAgentActions = false
|
|
48
|
+
hideAgentActions = false,
|
|
49
|
+
hideStarButton = false
|
|
49
50
|
}) => {
|
|
50
51
|
var _agent$user_defined_c, _agent$external_confi, _agent$external_confi2, _agent$creatorInfo, _agent$creatorInfo2, _agent$creatorInfo3, _agent$creatorInfo4;
|
|
51
52
|
const {
|
|
@@ -180,7 +181,7 @@ const AgentProfileCard = ({
|
|
|
180
181
|
agentName: agent.name,
|
|
181
182
|
isStarred: isStarred,
|
|
182
183
|
onStarToggle: handleSetFavourite,
|
|
183
|
-
showStarButton: !isRovoDev,
|
|
184
|
+
showStarButton: !isRovoDev && !hideStarButton,
|
|
184
185
|
isHidden: agent.visibility === 'PRIVATE',
|
|
185
186
|
creatorRender: ((_agent$creatorInfo = agent.creatorInfo) === null || _agent$creatorInfo === void 0 ? void 0 : _agent$creatorInfo.type) && /*#__PURE__*/React.createElement(AgentProfileCreator, {
|
|
186
187
|
creator: {
|
|
@@ -138,7 +138,8 @@ export const AgentProfileCardResourced = props => {
|
|
|
138
138
|
cloudId: props.cloudId,
|
|
139
139
|
hideAgentActions: true,
|
|
140
140
|
hideConversationStarters: true,
|
|
141
|
-
hideAiDisclaimer: true
|
|
141
|
+
hideAiDisclaimer: true,
|
|
142
|
+
hideStarButton: props.hideStarButton
|
|
142
143
|
})));
|
|
143
144
|
}
|
|
144
145
|
if (error || !isLoading && !agentData) {
|
|
@@ -165,6 +166,7 @@ export const AgentProfileCardResourced = props => {
|
|
|
165
166
|
hideMoreActions: props.hideMoreActions,
|
|
166
167
|
hideAiDisclaimer: props.hideAiDisclaimer,
|
|
167
168
|
hideConversationStarters: props.hideConversationStarters,
|
|
168
|
-
hideAgentActions: props.hideAgentActions
|
|
169
|
+
hideAgentActions: props.hideAgentActions,
|
|
170
|
+
hideStarButton: props.hideStarButton
|
|
169
171
|
}));
|
|
170
172
|
};
|
|
@@ -123,7 +123,8 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
|
|
|
123
123
|
onConversationStartersClick: props.onConversationStartersClick,
|
|
124
124
|
resourceClient: props.resourceClient,
|
|
125
125
|
onDeleteAgent: props.onDeleteAgent,
|
|
126
|
-
addFlag: props.addFlag
|
|
126
|
+
addFlag: props.addFlag,
|
|
127
|
+
hideStarButton: props.hideStarButton
|
|
127
128
|
}));
|
|
128
129
|
};
|
|
129
130
|
return /*#__PURE__*/React.createElement(ProfileCardTrigger, _extends({}, props, {
|
|
@@ -2,7 +2,7 @@ var _process$env$_PACKAGE, _process$env$_PACKAGE2;
|
|
|
2
2
|
import { getPageTime } from './performance';
|
|
3
3
|
export const PACKAGE_META_DATA = {
|
|
4
4
|
packageName: (_process$env$_PACKAGE = "@atlaskit/profilecard") !== null && _process$env$_PACKAGE !== void 0 ? _process$env$_PACKAGE : '',
|
|
5
|
-
packageVersion: (_process$env$_PACKAGE2 = "26.
|
|
5
|
+
packageVersion: (_process$env$_PACKAGE2 = "26.6.0") !== null && _process$env$_PACKAGE2 !== void 0 ? _process$env$_PACKAGE2 : ''
|
|
6
6
|
};
|
|
7
7
|
const TEAM_SUBJECT = 'teamProfileCard';
|
|
8
8
|
const USER_SUBJECT = 'profilecard';
|
|
@@ -19,7 +19,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
|
|
|
19
19
|
actionSubjectId,
|
|
20
20
|
attributes: {
|
|
21
21
|
packageName: "@atlaskit/profilecard",
|
|
22
|
-
packageVersion: "26.
|
|
22
|
+
packageVersion: "26.6.0",
|
|
23
23
|
...attributes,
|
|
24
24
|
firedAt: Math.round(getPageTime())
|
|
25
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _get from "@babel/runtime/helpers/get";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
5
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
@@ -10,6 +11,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
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
13
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
14
|
+
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; }
|
|
13
15
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
16
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -19,6 +21,7 @@ import { USER_ARI_PREFIX } from '../util/rovoAgentUtils';
|
|
|
19
21
|
import CachingClient from './CachingClient';
|
|
20
22
|
import { getErrorAttributes } from './errorUtils';
|
|
21
23
|
import { AGGQuery } from './graphqlUtils';
|
|
24
|
+
import { SHARED_CACHE_MAX_AGE, sharedAgentProfileCache } from './sharedAgentProfileCache';
|
|
22
25
|
export var AgentForbiddenError = /*#__PURE__*/function (_Error) {
|
|
23
26
|
function AgentForbiddenError() {
|
|
24
27
|
var _this;
|
|
@@ -91,6 +94,41 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
91
94
|
value: function basePath() {
|
|
92
95
|
return '/gateway/api/assist/rovo/v1/agents';
|
|
93
96
|
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "sharedCacheKey",
|
|
99
|
+
value: function sharedCacheKey(idValue) {
|
|
100
|
+
var _this$options$cloudId;
|
|
101
|
+
return "".concat((_this$options$cloudId = this.options.cloudId) !== null && _this$options$cloudId !== void 0 ? _this$options$cloudId : '', ":").concat(idValue);
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "getCachedProfile",
|
|
105
|
+
value: function getCachedProfile(idValue) {
|
|
106
|
+
if (!fg('platform_editor_agent_profile_card_favourite_sync')) {
|
|
107
|
+
return _superPropGet(RovoAgentCardClient, "getCachedProfile", this, 3)([idValue]);
|
|
108
|
+
}
|
|
109
|
+
var key = this.sharedCacheKey(idValue);
|
|
110
|
+
var cached = sharedAgentProfileCache.get(key);
|
|
111
|
+
if (!cached) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
if (cached.expire < Date.now()) {
|
|
115
|
+
sharedAgentProfileCache.delete(key);
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return cached.profile;
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "setCachedProfile",
|
|
122
|
+
value: function setCachedProfile(idValue, profile) {
|
|
123
|
+
if (!fg('platform_editor_agent_profile_card_favourite_sync')) {
|
|
124
|
+
_superPropGet(RovoAgentCardClient, "setCachedProfile", this, 3)([idValue, profile]);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
sharedAgentProfileCache.set(this.sharedCacheKey(idValue), {
|
|
128
|
+
expire: Date.now() + (this.config.cacheMaxAge || SHARED_CACHE_MAX_AGE),
|
|
129
|
+
profile: profile
|
|
130
|
+
});
|
|
131
|
+
}
|
|
94
132
|
}, {
|
|
95
133
|
key: "getActivationId",
|
|
96
134
|
value: function () {
|
|
@@ -275,7 +313,7 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
275
313
|
}, PACKAGE_META_DATA));
|
|
276
314
|
}
|
|
277
315
|
_this4.makeRequest(id, analytics).then(function (data) {
|
|
278
|
-
if (_this4.cache) {
|
|
316
|
+
if (_this4.cache || fg('platform_editor_agent_profile_card_favourite_sync')) {
|
|
279
317
|
_this4.setCachedProfile(id.value, data);
|
|
280
318
|
}
|
|
281
319
|
if (analytics) {
|
|
@@ -379,6 +417,9 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
379
417
|
firedAt: Math.round(getPageTime())
|
|
380
418
|
}, PACKAGE_META_DATA));
|
|
381
419
|
}
|
|
420
|
+
if (fg('platform_editor_agent_profile_card_favourite_sync')) {
|
|
421
|
+
_this6.syncFavouriteToCache(agentId, isFavourite);
|
|
422
|
+
}
|
|
382
423
|
resolve();
|
|
383
424
|
}).catch(function (error) {
|
|
384
425
|
if (analytics) {
|
|
@@ -402,6 +443,42 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
402
443
|
};
|
|
403
444
|
}());
|
|
404
445
|
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Keeps the shared agent profile cache in sync with the favourite state
|
|
449
|
+
*/
|
|
450
|
+
}, {
|
|
451
|
+
key: "syncFavouriteToCache",
|
|
452
|
+
value: function syncFavouriteToCache(agentId, isFavourite) {
|
|
453
|
+
var _this$options$cloudId2;
|
|
454
|
+
var prefix = "".concat((_this$options$cloudId2 = this.options.cloudId) !== null && _this$options$cloudId2 !== void 0 ? _this$options$cloudId2 : '', ":");
|
|
455
|
+
var keysToUpdate = [];
|
|
456
|
+
sharedAgentProfileCache.forEach(function (cached, key) {
|
|
457
|
+
var _cached$profile;
|
|
458
|
+
if (key.startsWith(prefix) && ((_cached$profile = cached.profile) === null || _cached$profile === void 0 || (_cached$profile = _cached$profile.restData) === null || _cached$profile === void 0 ? void 0 : _cached$profile.id) === agentId) {
|
|
459
|
+
keysToUpdate.push(key);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
keysToUpdate.forEach(function (key) {
|
|
463
|
+
var _restData$favourite_c;
|
|
464
|
+
var cached = sharedAgentProfileCache.get(key);
|
|
465
|
+
if (!cached) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
var restData = cached.profile.restData;
|
|
469
|
+
var wasFavourite = restData.favourite;
|
|
470
|
+
var currentCount = (_restData$favourite_c = restData.favourite_count) !== null && _restData$favourite_c !== void 0 ? _restData$favourite_c : 0;
|
|
471
|
+
var favouriteCount = isFavourite ? currentCount + (wasFavourite ? 0 : 1) : Math.max(0, currentCount - (wasFavourite ? 1 : 0));
|
|
472
|
+
sharedAgentProfileCache.set(key, _objectSpread(_objectSpread({}, cached), {}, {
|
|
473
|
+
profile: _objectSpread(_objectSpread({}, cached.profile), {}, {
|
|
474
|
+
restData: _objectSpread(_objectSpread({}, restData), {}, {
|
|
475
|
+
favourite: isFavourite,
|
|
476
|
+
favourite_count: favouriteCount
|
|
477
|
+
})
|
|
478
|
+
})
|
|
479
|
+
}));
|
|
480
|
+
});
|
|
481
|
+
}
|
|
405
482
|
}, {
|
|
406
483
|
key: "getPermissions",
|
|
407
484
|
value: function getPermissions(id, fireAnalytics) {
|
|
@@ -4,7 +4,7 @@ import { AGGQuery } from './graphqlUtils';
|
|
|
4
4
|
var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
|
|
5
5
|
var addHeaders = function addHeaders(headers) {
|
|
6
6
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
7
|
-
headers.append('atl-client-version', "26.
|
|
7
|
+
headers.append('atl-client-version', "26.6.0");
|
|
8
8
|
return headers;
|
|
9
9
|
};
|
|
10
10
|
export function getOrgIdForCloudIdFromAGG(_x, _x2) {
|
|
@@ -59,7 +59,7 @@ export var addHeaders = function addHeaders(headers) {
|
|
|
59
59
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
60
60
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
61
61
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
62
|
-
headers.append('atl-client-version', "26.
|
|
62
|
+
headers.append('atl-client-version', "26.6.0");
|
|
63
63
|
return headers;
|
|
64
64
|
};
|
|
65
65
|
export function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LRUMap } from 'lru_map';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Module-level agent profile cache shared across every `RovoAgentCardClient`
|
|
5
|
+
* instance
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var SHARED_CACHE_SIZE = 50;
|
|
9
|
+
export var SHARED_CACHE_MAX_AGE = 5 * 60 * 1000; // 5 minutes
|
|
10
|
+
|
|
11
|
+
export var sharedAgentProfileCache = new LRUMap(SHARED_CACHE_SIZE);
|
|
@@ -55,7 +55,9 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
55
55
|
_ref$hideConversation = _ref.hideConversationStarters,
|
|
56
56
|
hideConversationStarters = _ref$hideConversation === void 0 ? false : _ref$hideConversation,
|
|
57
57
|
_ref$hideAgentActions = _ref.hideAgentActions,
|
|
58
|
-
hideAgentActions = _ref$hideAgentActions === void 0 ? false : _ref$hideAgentActions
|
|
58
|
+
hideAgentActions = _ref$hideAgentActions === void 0 ? false : _ref$hideAgentActions,
|
|
59
|
+
_ref$hideStarButton = _ref.hideStarButton,
|
|
60
|
+
hideStarButton = _ref$hideStarButton === void 0 ? false : _ref$hideStarButton;
|
|
59
61
|
var _useAgentUrlActions = useAgentUrlActions({
|
|
60
62
|
cloudId: cloudId || '',
|
|
61
63
|
email: email,
|
|
@@ -221,7 +223,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
221
223
|
agentName: agent.name,
|
|
222
224
|
isStarred: isStarred,
|
|
223
225
|
onStarToggle: handleSetFavourite,
|
|
224
|
-
showStarButton: !isRovoDev,
|
|
226
|
+
showStarButton: !isRovoDev && !hideStarButton,
|
|
225
227
|
isHidden: agent.visibility === 'PRIVATE',
|
|
226
228
|
creatorRender: ((_agent$creatorInfo = agent.creatorInfo) === null || _agent$creatorInfo === void 0 ? void 0 : _agent$creatorInfo.type) && /*#__PURE__*/React.createElement(AgentProfileCreator, {
|
|
227
229
|
creator: {
|
|
@@ -191,7 +191,8 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
191
191
|
cloudId: props.cloudId,
|
|
192
192
|
hideAgentActions: true,
|
|
193
193
|
hideConversationStarters: true,
|
|
194
|
-
hideAiDisclaimer: true
|
|
194
|
+
hideAiDisclaimer: true,
|
|
195
|
+
hideStarButton: props.hideStarButton
|
|
195
196
|
})));
|
|
196
197
|
}
|
|
197
198
|
if (error || !isLoading && !agentData) {
|
|
@@ -218,6 +219,7 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
218
219
|
hideMoreActions: props.hideMoreActions,
|
|
219
220
|
hideAiDisclaimer: props.hideAiDisclaimer,
|
|
220
221
|
hideConversationStarters: props.hideConversationStarters,
|
|
221
|
-
hideAgentActions: props.hideAgentActions
|
|
222
|
+
hideAgentActions: props.hideAgentActions,
|
|
223
|
+
hideStarButton: props.hideStarButton
|
|
222
224
|
}));
|
|
223
225
|
};
|
|
@@ -169,7 +169,8 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
169
169
|
onConversationStartersClick: props.onConversationStartersClick,
|
|
170
170
|
resourceClient: props.resourceClient,
|
|
171
171
|
onDeleteAgent: props.onDeleteAgent,
|
|
172
|
-
addFlag: props.addFlag
|
|
172
|
+
addFlag: props.addFlag,
|
|
173
|
+
hideStarButton: props.hideStarButton
|
|
173
174
|
}));
|
|
174
175
|
};
|
|
175
176
|
return /*#__PURE__*/React.createElement(ProfileCardTrigger, _extends({}, props, {
|
|
@@ -5,7 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { getPageTime } from './performance';
|
|
6
6
|
export var PACKAGE_META_DATA = {
|
|
7
7
|
packageName: (_process$env$_PACKAGE = "@atlaskit/profilecard") !== null && _process$env$_PACKAGE !== void 0 ? _process$env$_PACKAGE : '',
|
|
8
|
-
packageVersion: (_process$env$_PACKAGE2 = "26.
|
|
8
|
+
packageVersion: (_process$env$_PACKAGE2 = "26.6.0") !== null && _process$env$_PACKAGE2 !== void 0 ? _process$env$_PACKAGE2 : ''
|
|
9
9
|
};
|
|
10
10
|
var TEAM_SUBJECT = 'teamProfileCard';
|
|
11
11
|
var USER_SUBJECT = 'profilecard';
|
|
@@ -24,7 +24,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
24
24
|
actionSubjectId: actionSubjectId,
|
|
25
25
|
attributes: _objectSpread(_objectSpread({
|
|
26
26
|
packageName: "@atlaskit/profilecard",
|
|
27
|
-
packageVersion: "26.
|
|
27
|
+
packageVersion: "26.6.0"
|
|
28
28
|
}, attributes), {}, {
|
|
29
29
|
firedAt: Math.round(getPageTime())
|
|
30
30
|
})
|
|
@@ -9,6 +9,9 @@ export default class RovoAgentCardClient extends CachingClient<RovoAgentCardClie
|
|
|
9
9
|
options: ProfileClientOptions;
|
|
10
10
|
constructor(options: ProfileClientOptions);
|
|
11
11
|
private basePath;
|
|
12
|
+
private sharedCacheKey;
|
|
13
|
+
getCachedProfile(idValue: string): RovoAgentCardClientResult | null;
|
|
14
|
+
setCachedProfile(idValue: string, profile: RovoAgentCardClientResult): void;
|
|
12
15
|
private getActivationId;
|
|
13
16
|
private getAgentByARIAgg;
|
|
14
17
|
private getAgentByAccountIdAgg;
|
|
@@ -23,5 +26,9 @@ export default class RovoAgentCardClient extends CachingClient<RovoAgentCardClie
|
|
|
23
26
|
getProfile(id: AgentIdType, analytics?: FireEventType): Promise<RovoAgentCardClientResult>;
|
|
24
27
|
deleteAgent(agentId: string, analytics?: FireEventType): Promise<void>;
|
|
25
28
|
setFavouriteAgent(agentId: string, isFavourite: boolean, analytics?: FireEventType): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Keeps the shared agent profile cache in sync with the favourite state
|
|
31
|
+
*/
|
|
32
|
+
private syncFavouriteToCache;
|
|
26
33
|
getPermissions(id: string, fireAnalytics?: FireEventType): Promise<AgentPermissions>;
|
|
27
34
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LRUMap } from 'lru_map';
|
|
2
|
+
import type { RovoAgentCardClientResult } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Module-level agent profile cache shared across every `RovoAgentCardClient`
|
|
5
|
+
* instance
|
|
6
|
+
*/
|
|
7
|
+
type CachedAgentProfile = {
|
|
8
|
+
expire: number;
|
|
9
|
+
profile: RovoAgentCardClientResult;
|
|
10
|
+
};
|
|
11
|
+
export declare const SHARED_CACHE_MAX_AGE: number;
|
|
12
|
+
export declare const sharedAgentProfileCache: LRUMap<string, CachedAgentProfile>;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type AgentProfileCardProps } from '../../types';
|
|
3
|
-
declare const AgentProfileCard: ({ agent, isLoading, cloudId, email, onChatClick, hasError, errorType, onConversationStartersClick, resourceClient, addFlag, onDeleteAgent, hideMoreActions, hideAiDisclaimer, hideConversationStarters, hideAgentActions, }: AgentProfileCardProps) => React.JSX.Element;
|
|
3
|
+
declare const AgentProfileCard: ({ agent, isLoading, cloudId, email, onChatClick, hasError, errorType, onConversationStartersClick, resourceClient, addFlag, onDeleteAgent, hideMoreActions, hideAiDisclaimer, hideConversationStarters, hideAgentActions, hideStarButton, }: AgentProfileCardProps) => React.JSX.Element;
|
|
4
4
|
export default AgentProfileCard;
|
|
@@ -18,6 +18,8 @@ export type AgentProfileCardResourcedProps = {
|
|
|
18
18
|
hideConversationStarters?: boolean;
|
|
19
19
|
/** Hide the agent actions (chat button and dropdown menu). Defaults to false (agent actions are shown by default). */
|
|
20
20
|
hideAgentActions?: boolean;
|
|
21
|
+
/** Hide the favourite (star) button. Defaults to false (the star is shown). */
|
|
22
|
+
hideStarButton?: boolean;
|
|
21
23
|
/** Name shown in reduced card when user lacks permission */
|
|
22
24
|
agentName?: string;
|
|
23
25
|
} & AgentActionsType;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type LazyExoticComponent } from 'react';
|
|
2
2
|
import type { AgentProfileCardProps } from '../../types';
|
|
3
|
-
export declare const AgentProfileCardLazy: LazyExoticComponent<({ agent, isLoading, cloudId, onChatClick, hasError, errorType, onConversationStartersClick, resourceClient, addFlag, onDeleteAgent, hideMoreActions, hideAiDisclaimer, hideConversationStarters, hideAgentActions, }: AgentProfileCardProps) => React.JSX.Element>;
|
|
3
|
+
export declare const AgentProfileCardLazy: LazyExoticComponent<({ agent, isLoading, cloudId, onChatClick, hasError, errorType, onConversationStartersClick, resourceClient, addFlag, onDeleteAgent, hideMoreActions, hideAiDisclaimer, hideConversationStarters, hideAgentActions, hideStarButton, }: AgentProfileCardProps) => React.JSX.Element>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -311,6 +311,7 @@ export interface AgentProfileCardTriggerProps extends AgentActionsType {
|
|
|
311
311
|
onDeleteAgent?: (agentId: string) => {
|
|
312
312
|
restore: () => void;
|
|
313
313
|
};
|
|
314
|
+
hideStarButton?: boolean;
|
|
314
315
|
}
|
|
315
316
|
export type AgentProfileCardProps = {
|
|
316
317
|
resourceClient: ProfileClient;
|
|
@@ -332,6 +333,8 @@ export type AgentProfileCardProps = {
|
|
|
332
333
|
hideConversationStarters?: boolean;
|
|
333
334
|
/** Hide the agent actions (chat button and dropdown menu). Defaults to false (agent actions are shown by default). */
|
|
334
335
|
hideAgentActions?: boolean;
|
|
336
|
+
/** Hide the favourite (star) button. Defaults to false (the star is shown). */
|
|
337
|
+
hideStarButton?: boolean;
|
|
335
338
|
} & AgentActionsType;
|
|
336
339
|
export type StatusType = 'active' | 'inactive' | 'closed';
|
|
337
340
|
export type TriggerType = 'hover' | 'click';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.7.0",
|
|
4
4
|
"description": "A React component to display a card with user information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -181,6 +181,9 @@
|
|
|
181
181
|
"fix_aria_attribute_violation_on_agent_card_trigger": {
|
|
182
182
|
"type": "boolean"
|
|
183
183
|
},
|
|
184
|
+
"platform_editor_agent_profile_card_favourite_sync": {
|
|
185
|
+
"type": "boolean"
|
|
186
|
+
},
|
|
184
187
|
"platform_editor_reduced_agent_profile_card": {
|
|
185
188
|
"type": "boolean"
|
|
186
189
|
}
|