@atlaskit/profilecard 26.5.3 → 26.5.4
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 +7 -0
- package/dist/cjs/client/RovoAgentCardClient.js +44 -25
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +37 -1
- package/dist/cjs/util/analytics.js +2 -2
- package/dist/es2019/client/RovoAgentCardClient.js +20 -2
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +34 -1
- package/dist/es2019/util/analytics.js +2 -2
- package/dist/esm/client/RovoAgentCardClient.js +43 -24
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +37 -1
- package/dist/esm/util/analytics.js +2 -2
- package/dist/types/client/RovoAgentCardClient.d.ts +4 -0
- package/dist/types/components/Agent/AgentProfileCardResourced.d.ts +2 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 26.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`14023b8bbf880`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/14023b8bbf880) -
|
|
8
|
+
[ux] Shows reduced profile card when user lacks permission to read/access agent mention on page
|
|
9
|
+
|
|
3
10
|
## 26.5.3
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -4,16 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = void 0;
|
|
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
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
14
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
17
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _analytics = require("../util/analytics");
|
|
19
20
|
var _performance = require("../util/performance");
|
|
@@ -25,6 +26,18 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
25
26
|
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; }
|
|
26
27
|
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)); }
|
|
27
28
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
29
|
+
var AgentForbiddenError = exports.AgentForbiddenError = /*#__PURE__*/function (_Error) {
|
|
30
|
+
function AgentForbiddenError() {
|
|
31
|
+
var _this;
|
|
32
|
+
(0, _classCallCheck2.default)(this, AgentForbiddenError);
|
|
33
|
+
_this = _callSuper(this, AgentForbiddenError, ['Agent access forbidden']);
|
|
34
|
+
(0, _defineProperty2.default)(_this, "status", 403);
|
|
35
|
+
_this.name = 'AgentForbiddenError';
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
(0, _inherits2.default)(AgentForbiddenError, _Error);
|
|
39
|
+
return (0, _createClass2.default)(AgentForbiddenError);
|
|
40
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
28
41
|
var buildActivationIdQuery = function buildActivationIdQuery(cloudId, product) {
|
|
29
42
|
return {
|
|
30
43
|
query: "\n\t\tquery RovoAgentProfileCard_ActivationQuery($cloudId: ID!, $product: String!) {\n\t\t\ttenantContexts(cloudIds: [$cloudId]) {\n\t\t\t\tactivationIdByProduct(product: $product) {\n\t\t\t\t\tactive\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t",
|
|
@@ -73,11 +86,11 @@ var createHeaders = function createHeaders(product, cloudId, isBodyJson) {
|
|
|
73
86
|
};
|
|
74
87
|
var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClient) {
|
|
75
88
|
function RovoAgentCardClient(options) {
|
|
76
|
-
var
|
|
89
|
+
var _this2;
|
|
77
90
|
(0, _classCallCheck2.default)(this, RovoAgentCardClient);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return
|
|
91
|
+
_this2 = _callSuper(this, RovoAgentCardClient, [options]);
|
|
92
|
+
_this2.options = options;
|
|
93
|
+
return _this2;
|
|
81
94
|
}
|
|
82
95
|
(0, _inherits2.default)(RovoAgentCardClient, _CachingClient);
|
|
83
96
|
return (0, _createClass2.default)(RovoAgentCardClient, [{
|
|
@@ -175,7 +188,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
175
188
|
}, {
|
|
176
189
|
key: "makeRequest",
|
|
177
190
|
value: function makeRequest(id, analytics) {
|
|
178
|
-
var
|
|
191
|
+
var _this3 = this;
|
|
179
192
|
var product = this.options.productIdentifier || 'rovo';
|
|
180
193
|
var headers = createHeaders(product, this.options.cloudId);
|
|
181
194
|
var restPromise;
|
|
@@ -186,6 +199,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
186
199
|
mode: 'cors',
|
|
187
200
|
headers: headers
|
|
188
201
|
})).then(function (response) {
|
|
202
|
+
if (response.status === 403 && (0, _platformFeatureFlags.fg)('platform_editor_reduced_agent_profile_card')) {
|
|
203
|
+
throw new AgentForbiddenError();
|
|
204
|
+
}
|
|
189
205
|
return response.json();
|
|
190
206
|
});
|
|
191
207
|
} else {
|
|
@@ -195,6 +211,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
195
211
|
mode: 'cors',
|
|
196
212
|
headers: headers
|
|
197
213
|
})).then(function (response) {
|
|
214
|
+
if (response.status === 403 && (0, _platformFeatureFlags.fg)('platform_editor_reduced_agent_profile_card')) {
|
|
215
|
+
throw new AgentForbiddenError();
|
|
216
|
+
}
|
|
198
217
|
return response.json();
|
|
199
218
|
});
|
|
200
219
|
}
|
|
@@ -204,10 +223,10 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
204
223
|
throw new Error('ProfileCard Activation ID not found');
|
|
205
224
|
}
|
|
206
225
|
if (id.type === 'identity') {
|
|
207
|
-
return
|
|
226
|
+
return _this3.getAgentByAccountIdAgg(id.value, _this3.options.cloudId || '');
|
|
208
227
|
} else {
|
|
209
228
|
var agentAri = "ari:cloud:rovo::agent/activation/".concat(activationId, "/").concat(id.value);
|
|
210
|
-
return
|
|
229
|
+
return _this3.getAgentByARIAgg(agentAri);
|
|
211
230
|
}
|
|
212
231
|
})
|
|
213
232
|
// We are not going to break the flow if the AGG endpoint fails for now
|
|
@@ -244,7 +263,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
244
263
|
}, {
|
|
245
264
|
key: "getProfile",
|
|
246
265
|
value: function getProfile(id, analytics) {
|
|
247
|
-
var
|
|
266
|
+
var _this4 = this;
|
|
248
267
|
if (!id.value) {
|
|
249
268
|
return Promise.reject(new Error('Id is missing'));
|
|
250
269
|
}
|
|
@@ -262,9 +281,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
262
281
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
263
282
|
}, _analytics.PACKAGE_META_DATA));
|
|
264
283
|
}
|
|
265
|
-
|
|
266
|
-
if (
|
|
267
|
-
|
|
284
|
+
_this4.makeRequest(id, analytics).then(function (data) {
|
|
285
|
+
if (_this4.cache) {
|
|
286
|
+
_this4.setCachedProfile(id.value, data);
|
|
268
287
|
}
|
|
269
288
|
if (analytics) {
|
|
270
289
|
analytics('operational.rovoAgentProfilecard.succeeded.request', _objectSpread({
|
|
@@ -290,20 +309,20 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
290
309
|
}, {
|
|
291
310
|
key: "deleteAgent",
|
|
292
311
|
value: function deleteAgent(agentId, analytics) {
|
|
293
|
-
var
|
|
312
|
+
var _this5 = this;
|
|
294
313
|
if (!this.options.cloudId) {
|
|
295
314
|
return Promise.reject(new Error('cloudId is missing'));
|
|
296
315
|
}
|
|
297
316
|
return new Promise(function (resolve, reject) {
|
|
298
317
|
var startTime = (0, _performance.getPageTime)();
|
|
299
|
-
var product =
|
|
318
|
+
var product = _this5.options.productIdentifier || 'rovo';
|
|
300
319
|
if (analytics) {
|
|
301
320
|
analytics('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
|
|
302
321
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
303
322
|
}, _analytics.PACKAGE_META_DATA));
|
|
304
323
|
}
|
|
305
|
-
var headers = createHeaders(product,
|
|
306
|
-
fetch(new Request("".concat(
|
|
324
|
+
var headers = createHeaders(product, _this5.options.cloudId);
|
|
325
|
+
fetch(new Request("".concat(_this5.basePath(), "/").concat(agentId), {
|
|
307
326
|
method: 'DELETE',
|
|
308
327
|
credentials: 'include',
|
|
309
328
|
mode: 'cors',
|
|
@@ -333,7 +352,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
333
352
|
}, {
|
|
334
353
|
key: "setFavouriteAgent",
|
|
335
354
|
value: function setFavouriteAgent(agentId, isFavourite, analytics) {
|
|
336
|
-
var
|
|
355
|
+
var _this6 = this;
|
|
337
356
|
if (!this.options.cloudId) {
|
|
338
357
|
return Promise.reject(new Error('cloudId is missing'));
|
|
339
358
|
}
|
|
@@ -344,7 +363,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
344
363
|
while (1) switch (_context4.prev = _context4.next) {
|
|
345
364
|
case 0:
|
|
346
365
|
startTime = (0, _performance.getPageTime)();
|
|
347
|
-
product =
|
|
366
|
+
product = _this6.options.productIdentifier || 'rovo';
|
|
348
367
|
actionSubjectId = isFavourite ? 'favourite' : 'unfavourite';
|
|
349
368
|
requestMethod = isFavourite ? 'POST' : 'DELETE';
|
|
350
369
|
if (analytics) {
|
|
@@ -352,9 +371,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
352
371
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
353
372
|
}, _analytics.PACKAGE_META_DATA));
|
|
354
373
|
}
|
|
355
|
-
headers = createHeaders(product,
|
|
374
|
+
headers = createHeaders(product, _this6.options.cloudId);
|
|
356
375
|
_context4.next = 1;
|
|
357
|
-
return fetch(new Request("".concat(
|
|
376
|
+
return fetch(new Request("".concat(_this6.basePath(), "/").concat(agentId, "/favourite"), {
|
|
358
377
|
method: requestMethod,
|
|
359
378
|
credentials: 'include',
|
|
360
379
|
mode: 'cors',
|
|
@@ -393,19 +412,19 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
393
412
|
}, {
|
|
394
413
|
key: "getPermissions",
|
|
395
414
|
value: function getPermissions(id, fireAnalytics) {
|
|
396
|
-
var
|
|
415
|
+
var _this7 = this;
|
|
397
416
|
if (!this.options.cloudId) {
|
|
398
417
|
return Promise.reject(new Error('cloudId is missing'));
|
|
399
418
|
}
|
|
400
419
|
return new Promise(function (resolve, reject) {
|
|
401
420
|
var startTime = (0, _performance.getPageTime)();
|
|
402
|
-
var product =
|
|
421
|
+
var product = _this7.options.productIdentifier || 'rovo';
|
|
403
422
|
if (fireAnalytics) {
|
|
404
423
|
fireAnalytics('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
|
|
405
424
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
406
425
|
}, _analytics.PACKAGE_META_DATA));
|
|
407
426
|
}
|
|
408
|
-
var headers = createHeaders(product,
|
|
427
|
+
var headers = createHeaders(product, _this7.options.cloudId, true);
|
|
409
428
|
fetch(new Request("/gateway/api/assist/api/rovo/v2/permissions/agents/".concat(id), {
|
|
410
429
|
method: 'POST',
|
|
411
430
|
credentials: 'include',
|
|
@@ -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.5.
|
|
14
|
+
headers.append('atl-client-version', "26.5.3");
|
|
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.5.
|
|
69
|
+
headers.append('atl-client-version', "26.5.3");
|
|
70
70
|
return headers;
|
|
71
71
|
};
|
|
72
72
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -15,6 +15,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
15
15
|
var _AgentProfileInfo = require("@atlaskit/rovo-agent-components/ui/AgentProfileInfo");
|
|
16
16
|
var _navigation = require("@atlaskit/teams-app-config/navigation");
|
|
17
17
|
var _teamsAppInternalAnalytics = require("@atlaskit/teams-app-internal-analytics");
|
|
18
|
+
var _RovoAgentCardClient = require("../../client/RovoAgentCardClient");
|
|
18
19
|
var _rovoAgentUtils = require("../../util/rovoAgentUtils");
|
|
19
20
|
var _ErrorMessage = _interopRequireDefault(require("../Error/ErrorMessage"));
|
|
20
21
|
var _AgentProfileCardWrapper = require("./AgentProfileCardWrapper");
|
|
@@ -37,6 +38,10 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
37
38
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
38
39
|
error = _useState6[0],
|
|
39
40
|
setError = _useState6[1];
|
|
41
|
+
var _useState7 = (0, _react.useState)(true),
|
|
42
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
43
|
+
isPermitted = _useState8[0],
|
|
44
|
+
setIsPermitted = _useState8[1];
|
|
40
45
|
var _useAnalyticsEventsNe = (0, _teamsAppInternalAnalytics.useAnalyticsEvents)(),
|
|
41
46
|
fireEvent = _useAnalyticsEventsNe.fireEvent;
|
|
42
47
|
var creatorUserId = (0, _react.useMemo)(function () {
|
|
@@ -136,7 +141,11 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
136
141
|
case 4:
|
|
137
142
|
_context2.prev = 4;
|
|
138
143
|
_t2 = _context2["catch"](1);
|
|
139
|
-
|
|
144
|
+
if (_t2 instanceof _RovoAgentCardClient.AgentForbiddenError && (0, _platformFeatureFlags.fg)('platform_editor_reduced_agent_profile_card')) {
|
|
145
|
+
setIsPermitted(false);
|
|
146
|
+
} else {
|
|
147
|
+
setError(_t2);
|
|
148
|
+
}
|
|
140
149
|
case 5:
|
|
141
150
|
_context2.prev = 5;
|
|
142
151
|
setIsLoading(false);
|
|
@@ -167,6 +176,33 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
167
176
|
}
|
|
168
177
|
fetchData();
|
|
169
178
|
}, [fetchData]);
|
|
179
|
+
if (!isPermitted && (0, _platformFeatureFlags.fg)('platform_editor_reduced_agent_profile_card')) {
|
|
180
|
+
var _props$agentName;
|
|
181
|
+
return /*#__PURE__*/_react.default.createElement(_AgentProfileCardWrapper.AgentProfileCardWrapper, null, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
182
|
+
fallback: null
|
|
183
|
+
}, /*#__PURE__*/_react.default.createElement(_lazyAgentProfileCard.AgentProfileCardLazy, {
|
|
184
|
+
agent: {
|
|
185
|
+
id: '',
|
|
186
|
+
named_id: '',
|
|
187
|
+
name: (_props$agentName = props.agentName) !== null && _props$agentName !== void 0 ? _props$agentName : '',
|
|
188
|
+
description: "\xA0",
|
|
189
|
+
creator_type: 'CUSTOMER',
|
|
190
|
+
is_default: false,
|
|
191
|
+
actor_type: 'AGENT',
|
|
192
|
+
user_defined_conversation_starters: null,
|
|
193
|
+
favourite: false,
|
|
194
|
+
favourite_count: 0,
|
|
195
|
+
identity_account_id: props.accountId,
|
|
196
|
+
creatorInfo: undefined
|
|
197
|
+
},
|
|
198
|
+
isLoading: false,
|
|
199
|
+
resourceClient: props.resourceClient,
|
|
200
|
+
cloudId: props.cloudId,
|
|
201
|
+
hideAgentActions: true,
|
|
202
|
+
hideConversationStarters: true,
|
|
203
|
+
hideAiDisclaimer: true
|
|
204
|
+
})));
|
|
205
|
+
}
|
|
170
206
|
if (error || !isLoading && !agentData) {
|
|
171
207
|
return /*#__PURE__*/_react.default.createElement(_AgentProfileCardWrapper.AgentProfileCardWrapper, null, /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
|
|
172
208
|
reload: function reload() {
|
|
@@ -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.5.
|
|
15
|
+
packageVersion: (_process$env$_PACKAGE2 = "26.5.3") !== 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.5.
|
|
34
|
+
packageVersion: "26.5.3"
|
|
35
35
|
}, attributes), {}, {
|
|
36
36
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
37
37
|
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { PACKAGE_META_DATA } from '../util/analytics';
|
|
3
4
|
import { getPageTime } from '../util/performance';
|
|
@@ -5,6 +6,13 @@ import { USER_ARI_PREFIX } from '../util/rovoAgentUtils';
|
|
|
5
6
|
import CachingClient from './CachingClient';
|
|
6
7
|
import { getErrorAttributes } from './errorUtils';
|
|
7
8
|
import { AGGQuery } from './graphqlUtils';
|
|
9
|
+
export class AgentForbiddenError extends Error {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('Agent access forbidden');
|
|
12
|
+
_defineProperty(this, "status", 403);
|
|
13
|
+
this.name = 'AgentForbiddenError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
8
16
|
const buildActivationIdQuery = (cloudId, product) => ({
|
|
9
17
|
query: `
|
|
10
18
|
query RovoAgentProfileCard_ActivationQuery($cloudId: ID!, $product: String!) {
|
|
@@ -134,14 +142,24 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
134
142
|
credentials: 'include',
|
|
135
143
|
mode: 'cors',
|
|
136
144
|
headers
|
|
137
|
-
})).then(response =>
|
|
145
|
+
})).then(response => {
|
|
146
|
+
if (response.status === 403 && fg('platform_editor_reduced_agent_profile_card')) {
|
|
147
|
+
throw new AgentForbiddenError();
|
|
148
|
+
}
|
|
149
|
+
return response.json();
|
|
150
|
+
});
|
|
138
151
|
} else {
|
|
139
152
|
restPromise = fetch(new Request(`${this.basePath()}/${id.value}`, {
|
|
140
153
|
method: 'GET',
|
|
141
154
|
credentials: 'include',
|
|
142
155
|
mode: 'cors',
|
|
143
156
|
headers
|
|
144
|
-
})).then(response =>
|
|
157
|
+
})).then(response => {
|
|
158
|
+
if (response.status === 403 && fg('platform_editor_reduced_agent_profile_card')) {
|
|
159
|
+
throw new AgentForbiddenError();
|
|
160
|
+
}
|
|
161
|
+
return response.json();
|
|
162
|
+
});
|
|
145
163
|
}
|
|
146
164
|
const aggStartTime = getPageTime();
|
|
147
165
|
const aggPromise = this.getActivationId(this.options.cloudId || '', this.options.productIdentifier || 'rovo').then(activationId => {
|
|
@@ -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.5.
|
|
9
|
+
headers.append('atl-client-version', "26.5.3");
|
|
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.5.
|
|
81
|
+
headers.append('atl-client-version', "26.5.3");
|
|
82
82
|
return headers;
|
|
83
83
|
};
|
|
84
84
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
@@ -3,6 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { getAgentCreator } from '@atlaskit/rovo-agent-components/ui/AgentProfileInfo';
|
|
4
4
|
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
5
5
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
6
|
+
import { AgentForbiddenError } from '../../client/RovoAgentCardClient';
|
|
6
7
|
import { getAAIDFromARI } from '../../util/rovoAgentUtils';
|
|
7
8
|
import ErrorMessage from '../Error/ErrorMessage';
|
|
8
9
|
import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
|
|
@@ -13,6 +14,7 @@ export const AgentProfileCardResourced = props => {
|
|
|
13
14
|
// avoiding a brief error screen flash before the useEffect fires.
|
|
14
15
|
const [isLoading, setIsLoading] = useState(fg('jira_ai_fix_agent_profile_card_flashing') || fg('confluence_fix_agent_profile_card_flash'));
|
|
15
16
|
const [error, setError] = useState();
|
|
17
|
+
const [isPermitted, setIsPermitted] = useState(true);
|
|
16
18
|
const {
|
|
17
19
|
fireEvent
|
|
18
20
|
} = useAnalyticsEventsNext();
|
|
@@ -83,7 +85,11 @@ export const AgentProfileCardResourced = props => {
|
|
|
83
85
|
creatorInfo: agentCreatorInfo
|
|
84
86
|
});
|
|
85
87
|
} catch (err) {
|
|
86
|
-
|
|
88
|
+
if (err instanceof AgentForbiddenError && fg('platform_editor_reduced_agent_profile_card')) {
|
|
89
|
+
setIsPermitted(false);
|
|
90
|
+
} else {
|
|
91
|
+
setError(err);
|
|
92
|
+
}
|
|
87
93
|
} finally {
|
|
88
94
|
setIsLoading(false);
|
|
89
95
|
}
|
|
@@ -108,6 +114,33 @@ export const AgentProfileCardResourced = props => {
|
|
|
108
114
|
}
|
|
109
115
|
fetchData();
|
|
110
116
|
}, [fetchData]);
|
|
117
|
+
if (!isPermitted && fg('platform_editor_reduced_agent_profile_card')) {
|
|
118
|
+
var _props$agentName;
|
|
119
|
+
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Suspense, {
|
|
120
|
+
fallback: null
|
|
121
|
+
}, /*#__PURE__*/React.createElement(AgentProfileCardLazy, {
|
|
122
|
+
agent: {
|
|
123
|
+
id: '',
|
|
124
|
+
named_id: '',
|
|
125
|
+
name: (_props$agentName = props.agentName) !== null && _props$agentName !== void 0 ? _props$agentName : '',
|
|
126
|
+
description: '\u00A0',
|
|
127
|
+
creator_type: 'CUSTOMER',
|
|
128
|
+
is_default: false,
|
|
129
|
+
actor_type: 'AGENT',
|
|
130
|
+
user_defined_conversation_starters: null,
|
|
131
|
+
favourite: false,
|
|
132
|
+
favourite_count: 0,
|
|
133
|
+
identity_account_id: props.accountId,
|
|
134
|
+
creatorInfo: undefined
|
|
135
|
+
},
|
|
136
|
+
isLoading: false,
|
|
137
|
+
resourceClient: props.resourceClient,
|
|
138
|
+
cloudId: props.cloudId,
|
|
139
|
+
hideAgentActions: true,
|
|
140
|
+
hideConversationStarters: true,
|
|
141
|
+
hideAiDisclaimer: true
|
|
142
|
+
})));
|
|
143
|
+
}
|
|
111
144
|
if (error || !isLoading && !agentData) {
|
|
112
145
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
113
146
|
reload: () => {
|
|
@@ -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.
|
|
5
|
+
packageVersion: (_process$env$_PACKAGE2 = "26.5.3") !== 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.5.
|
|
22
|
+
packageVersion: "26.5.3",
|
|
23
23
|
...attributes,
|
|
24
24
|
firedAt: Math.round(getPageTime())
|
|
25
25
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
+
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
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; }
|
|
10
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; }
|
|
11
12
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
@@ -18,6 +19,18 @@ import { USER_ARI_PREFIX } from '../util/rovoAgentUtils';
|
|
|
18
19
|
import CachingClient from './CachingClient';
|
|
19
20
|
import { getErrorAttributes } from './errorUtils';
|
|
20
21
|
import { AGGQuery } from './graphqlUtils';
|
|
22
|
+
export var AgentForbiddenError = /*#__PURE__*/function (_Error) {
|
|
23
|
+
function AgentForbiddenError() {
|
|
24
|
+
var _this;
|
|
25
|
+
_classCallCheck(this, AgentForbiddenError);
|
|
26
|
+
_this = _callSuper(this, AgentForbiddenError, ['Agent access forbidden']);
|
|
27
|
+
_defineProperty(_this, "status", 403);
|
|
28
|
+
_this.name = 'AgentForbiddenError';
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
_inherits(AgentForbiddenError, _Error);
|
|
32
|
+
return _createClass(AgentForbiddenError);
|
|
33
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
21
34
|
var buildActivationIdQuery = function buildActivationIdQuery(cloudId, product) {
|
|
22
35
|
return {
|
|
23
36
|
query: "\n\t\tquery RovoAgentProfileCard_ActivationQuery($cloudId: ID!, $product: String!) {\n\t\t\ttenantContexts(cloudIds: [$cloudId]) {\n\t\t\t\tactivationIdByProduct(product: $product) {\n\t\t\t\t\tactive\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t",
|
|
@@ -66,11 +79,11 @@ var createHeaders = function createHeaders(product, cloudId, isBodyJson) {
|
|
|
66
79
|
};
|
|
67
80
|
var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
68
81
|
function RovoAgentCardClient(options) {
|
|
69
|
-
var
|
|
82
|
+
var _this2;
|
|
70
83
|
_classCallCheck(this, RovoAgentCardClient);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return
|
|
84
|
+
_this2 = _callSuper(this, RovoAgentCardClient, [options]);
|
|
85
|
+
_this2.options = options;
|
|
86
|
+
return _this2;
|
|
74
87
|
}
|
|
75
88
|
_inherits(RovoAgentCardClient, _CachingClient);
|
|
76
89
|
return _createClass(RovoAgentCardClient, [{
|
|
@@ -168,7 +181,7 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
168
181
|
}, {
|
|
169
182
|
key: "makeRequest",
|
|
170
183
|
value: function makeRequest(id, analytics) {
|
|
171
|
-
var
|
|
184
|
+
var _this3 = this;
|
|
172
185
|
var product = this.options.productIdentifier || 'rovo';
|
|
173
186
|
var headers = createHeaders(product, this.options.cloudId);
|
|
174
187
|
var restPromise;
|
|
@@ -179,6 +192,9 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
179
192
|
mode: 'cors',
|
|
180
193
|
headers: headers
|
|
181
194
|
})).then(function (response) {
|
|
195
|
+
if (response.status === 403 && fg('platform_editor_reduced_agent_profile_card')) {
|
|
196
|
+
throw new AgentForbiddenError();
|
|
197
|
+
}
|
|
182
198
|
return response.json();
|
|
183
199
|
});
|
|
184
200
|
} else {
|
|
@@ -188,6 +204,9 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
188
204
|
mode: 'cors',
|
|
189
205
|
headers: headers
|
|
190
206
|
})).then(function (response) {
|
|
207
|
+
if (response.status === 403 && fg('platform_editor_reduced_agent_profile_card')) {
|
|
208
|
+
throw new AgentForbiddenError();
|
|
209
|
+
}
|
|
191
210
|
return response.json();
|
|
192
211
|
});
|
|
193
212
|
}
|
|
@@ -197,10 +216,10 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
197
216
|
throw new Error('ProfileCard Activation ID not found');
|
|
198
217
|
}
|
|
199
218
|
if (id.type === 'identity') {
|
|
200
|
-
return
|
|
219
|
+
return _this3.getAgentByAccountIdAgg(id.value, _this3.options.cloudId || '');
|
|
201
220
|
} else {
|
|
202
221
|
var agentAri = "ari:cloud:rovo::agent/activation/".concat(activationId, "/").concat(id.value);
|
|
203
|
-
return
|
|
222
|
+
return _this3.getAgentByARIAgg(agentAri);
|
|
204
223
|
}
|
|
205
224
|
})
|
|
206
225
|
// We are not going to break the flow if the AGG endpoint fails for now
|
|
@@ -237,7 +256,7 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
237
256
|
}, {
|
|
238
257
|
key: "getProfile",
|
|
239
258
|
value: function getProfile(id, analytics) {
|
|
240
|
-
var
|
|
259
|
+
var _this4 = this;
|
|
241
260
|
if (!id.value) {
|
|
242
261
|
return Promise.reject(new Error('Id is missing'));
|
|
243
262
|
}
|
|
@@ -255,9 +274,9 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
255
274
|
firedAt: Math.round(getPageTime())
|
|
256
275
|
}, PACKAGE_META_DATA));
|
|
257
276
|
}
|
|
258
|
-
|
|
259
|
-
if (
|
|
260
|
-
|
|
277
|
+
_this4.makeRequest(id, analytics).then(function (data) {
|
|
278
|
+
if (_this4.cache) {
|
|
279
|
+
_this4.setCachedProfile(id.value, data);
|
|
261
280
|
}
|
|
262
281
|
if (analytics) {
|
|
263
282
|
analytics('operational.rovoAgentProfilecard.succeeded.request', _objectSpread({
|
|
@@ -283,20 +302,20 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
283
302
|
}, {
|
|
284
303
|
key: "deleteAgent",
|
|
285
304
|
value: function deleteAgent(agentId, analytics) {
|
|
286
|
-
var
|
|
305
|
+
var _this5 = this;
|
|
287
306
|
if (!this.options.cloudId) {
|
|
288
307
|
return Promise.reject(new Error('cloudId is missing'));
|
|
289
308
|
}
|
|
290
309
|
return new Promise(function (resolve, reject) {
|
|
291
310
|
var startTime = getPageTime();
|
|
292
|
-
var product =
|
|
311
|
+
var product = _this5.options.productIdentifier || 'rovo';
|
|
293
312
|
if (analytics) {
|
|
294
313
|
analytics('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
|
|
295
314
|
firedAt: Math.round(getPageTime())
|
|
296
315
|
}, PACKAGE_META_DATA));
|
|
297
316
|
}
|
|
298
|
-
var headers = createHeaders(product,
|
|
299
|
-
fetch(new Request("".concat(
|
|
317
|
+
var headers = createHeaders(product, _this5.options.cloudId);
|
|
318
|
+
fetch(new Request("".concat(_this5.basePath(), "/").concat(agentId), {
|
|
300
319
|
method: 'DELETE',
|
|
301
320
|
credentials: 'include',
|
|
302
321
|
mode: 'cors',
|
|
@@ -326,7 +345,7 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
326
345
|
}, {
|
|
327
346
|
key: "setFavouriteAgent",
|
|
328
347
|
value: function setFavouriteAgent(agentId, isFavourite, analytics) {
|
|
329
|
-
var
|
|
348
|
+
var _this6 = this;
|
|
330
349
|
if (!this.options.cloudId) {
|
|
331
350
|
return Promise.reject(new Error('cloudId is missing'));
|
|
332
351
|
}
|
|
@@ -337,7 +356,7 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
337
356
|
while (1) switch (_context4.prev = _context4.next) {
|
|
338
357
|
case 0:
|
|
339
358
|
startTime = getPageTime();
|
|
340
|
-
product =
|
|
359
|
+
product = _this6.options.productIdentifier || 'rovo';
|
|
341
360
|
actionSubjectId = isFavourite ? 'favourite' : 'unfavourite';
|
|
342
361
|
requestMethod = isFavourite ? 'POST' : 'DELETE';
|
|
343
362
|
if (analytics) {
|
|
@@ -345,9 +364,9 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
345
364
|
firedAt: Math.round(getPageTime())
|
|
346
365
|
}, PACKAGE_META_DATA));
|
|
347
366
|
}
|
|
348
|
-
headers = createHeaders(product,
|
|
367
|
+
headers = createHeaders(product, _this6.options.cloudId);
|
|
349
368
|
_context4.next = 1;
|
|
350
|
-
return fetch(new Request("".concat(
|
|
369
|
+
return fetch(new Request("".concat(_this6.basePath(), "/").concat(agentId, "/favourite"), {
|
|
351
370
|
method: requestMethod,
|
|
352
371
|
credentials: 'include',
|
|
353
372
|
mode: 'cors',
|
|
@@ -386,19 +405,19 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
386
405
|
}, {
|
|
387
406
|
key: "getPermissions",
|
|
388
407
|
value: function getPermissions(id, fireAnalytics) {
|
|
389
|
-
var
|
|
408
|
+
var _this7 = this;
|
|
390
409
|
if (!this.options.cloudId) {
|
|
391
410
|
return Promise.reject(new Error('cloudId is missing'));
|
|
392
411
|
}
|
|
393
412
|
return new Promise(function (resolve, reject) {
|
|
394
413
|
var startTime = getPageTime();
|
|
395
|
-
var product =
|
|
414
|
+
var product = _this7.options.productIdentifier || 'rovo';
|
|
396
415
|
if (fireAnalytics) {
|
|
397
416
|
fireAnalytics('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
|
|
398
417
|
firedAt: Math.round(getPageTime())
|
|
399
418
|
}, PACKAGE_META_DATA));
|
|
400
419
|
}
|
|
401
|
-
var headers = createHeaders(product,
|
|
420
|
+
var headers = createHeaders(product, _this7.options.cloudId, true);
|
|
402
421
|
fetch(new Request("/gateway/api/assist/api/rovo/v2/permissions/agents/".concat(id), {
|
|
403
422
|
method: 'POST',
|
|
404
423
|
credentials: 'include',
|
|
@@ -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.5.
|
|
7
|
+
headers.append('atl-client-version', "26.5.3");
|
|
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.5.
|
|
62
|
+
headers.append('atl-client-version', "26.5.3");
|
|
63
63
|
return headers;
|
|
64
64
|
};
|
|
65
65
|
export function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -9,6 +9,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
9
9
|
import { getAgentCreator } from '@atlaskit/rovo-agent-components/ui/AgentProfileInfo';
|
|
10
10
|
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
11
11
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
12
|
+
import { AgentForbiddenError } from '../../client/RovoAgentCardClient';
|
|
12
13
|
import { getAAIDFromARI } from '../../util/rovoAgentUtils';
|
|
13
14
|
import ErrorMessage from '../Error/ErrorMessage';
|
|
14
15
|
import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
|
|
@@ -28,6 +29,10 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
28
29
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
29
30
|
error = _useState6[0],
|
|
30
31
|
setError = _useState6[1];
|
|
32
|
+
var _useState7 = useState(true),
|
|
33
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
34
|
+
isPermitted = _useState8[0],
|
|
35
|
+
setIsPermitted = _useState8[1];
|
|
31
36
|
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
32
37
|
fireEvent = _useAnalyticsEventsNe.fireEvent;
|
|
33
38
|
var creatorUserId = useMemo(function () {
|
|
@@ -127,7 +132,11 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
127
132
|
case 4:
|
|
128
133
|
_context2.prev = 4;
|
|
129
134
|
_t2 = _context2["catch"](1);
|
|
130
|
-
|
|
135
|
+
if (_t2 instanceof AgentForbiddenError && fg('platform_editor_reduced_agent_profile_card')) {
|
|
136
|
+
setIsPermitted(false);
|
|
137
|
+
} else {
|
|
138
|
+
setError(_t2);
|
|
139
|
+
}
|
|
131
140
|
case 5:
|
|
132
141
|
_context2.prev = 5;
|
|
133
142
|
setIsLoading(false);
|
|
@@ -158,6 +167,33 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
158
167
|
}
|
|
159
168
|
fetchData();
|
|
160
169
|
}, [fetchData]);
|
|
170
|
+
if (!isPermitted && fg('platform_editor_reduced_agent_profile_card')) {
|
|
171
|
+
var _props$agentName;
|
|
172
|
+
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Suspense, {
|
|
173
|
+
fallback: null
|
|
174
|
+
}, /*#__PURE__*/React.createElement(AgentProfileCardLazy, {
|
|
175
|
+
agent: {
|
|
176
|
+
id: '',
|
|
177
|
+
named_id: '',
|
|
178
|
+
name: (_props$agentName = props.agentName) !== null && _props$agentName !== void 0 ? _props$agentName : '',
|
|
179
|
+
description: "\xA0",
|
|
180
|
+
creator_type: 'CUSTOMER',
|
|
181
|
+
is_default: false,
|
|
182
|
+
actor_type: 'AGENT',
|
|
183
|
+
user_defined_conversation_starters: null,
|
|
184
|
+
favourite: false,
|
|
185
|
+
favourite_count: 0,
|
|
186
|
+
identity_account_id: props.accountId,
|
|
187
|
+
creatorInfo: undefined
|
|
188
|
+
},
|
|
189
|
+
isLoading: false,
|
|
190
|
+
resourceClient: props.resourceClient,
|
|
191
|
+
cloudId: props.cloudId,
|
|
192
|
+
hideAgentActions: true,
|
|
193
|
+
hideConversationStarters: true,
|
|
194
|
+
hideAiDisclaimer: true
|
|
195
|
+
})));
|
|
196
|
+
}
|
|
161
197
|
if (error || !isLoading && !agentData) {
|
|
162
198
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
163
199
|
reload: function reload() {
|
|
@@ -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.5.
|
|
8
|
+
packageVersion: (_process$env$_PACKAGE2 = "26.5.3") !== 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.5.
|
|
27
|
+
packageVersion: "26.5.3"
|
|
28
28
|
}, attributes), {}, {
|
|
29
29
|
firedAt: Math.round(getPageTime())
|
|
30
30
|
})
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type FireEventType } from '@atlaskit/teams-app-internal-analytics';
|
|
2
2
|
import type { AgentIdType, AgentPermissions, ProfileClientOptions, RovoAgentCardClientResult } from '../types';
|
|
3
3
|
import CachingClient from './CachingClient';
|
|
4
|
+
export declare class AgentForbiddenError extends Error {
|
|
5
|
+
status: number;
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
4
8
|
export default class RovoAgentCardClient extends CachingClient<RovoAgentCardClientResult> {
|
|
5
9
|
options: ProfileClientOptions;
|
|
6
10
|
constructor(options: ProfileClientOptions);
|
|
@@ -18,5 +18,7 @@ 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
|
+
/** Name shown in reduced card when user lacks permission */
|
|
22
|
+
agentName?: string;
|
|
21
23
|
} & AgentActionsType;
|
|
22
24
|
export declare const AgentProfileCardResourced: (props: AgentProfileCardResourcedProps) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "26.5.
|
|
3
|
+
"version": "26.5.4",
|
|
4
4
|
"description": "A React component to display a card with user information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -180,6 +180,9 @@
|
|
|
180
180
|
},
|
|
181
181
|
"fix_aria_attribute_violation_on_agent_card_trigger": {
|
|
182
182
|
"type": "boolean"
|
|
183
|
+
},
|
|
184
|
+
"platform_editor_reduced_agent_profile_card": {
|
|
185
|
+
"type": "boolean"
|
|
183
186
|
}
|
|
184
187
|
},
|
|
185
188
|
"sideEffects": [
|