@atlaskit/profilecard 25.7.5 → 25.7.6
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/dist/cjs/client/ProfileCardClient.js +27 -26
- package/dist/cjs/client/RovoAgentCardClient.js +19 -19
- package/dist/cjs/client/TeamCentralCardClient.js +27 -26
- package/dist/cjs/client/UserProfileCardClient.js +8 -8
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +12 -12
- package/dist/cjs/client/getTeamFromAGG.js +5 -5
- package/dist/cjs/client/graphqlUtils.js +12 -12
- package/dist/cjs/components/Agent/Actions.js +4 -4
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +5 -5
- package/dist/cjs/components/Agent/AgentProfileCard.js +28 -27
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +28 -28
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +32 -32
- package/dist/cjs/components/Agent/hooks/duplicateFetch.js +36 -36
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +14 -14
- package/dist/cjs/components/User/ProfileCardTrigger.js +16 -16
- package/dist/cjs/components/common/ProfileCardTrigger.js +2 -2
- package/dist/cjs/util/analytics.js +2 -2
- package/dist/cjs/util/useProfileInfo.js +11 -11
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/User/ProfileCardTrigger.js +1 -1
- package/dist/es2019/util/analytics.js +2 -2
- package/dist/esm/client/ProfileCardClient.js +27 -26
- package/dist/esm/client/RovoAgentCardClient.js +19 -19
- package/dist/esm/client/TeamCentralCardClient.js +27 -26
- package/dist/esm/client/UserProfileCardClient.js +8 -8
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +12 -12
- package/dist/esm/client/getTeamFromAGG.js +5 -5
- package/dist/esm/client/graphqlUtils.js +12 -12
- package/dist/esm/components/Agent/Actions.js +4 -4
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +5 -5
- package/dist/esm/components/Agent/AgentProfileCard.js +27 -26
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +27 -27
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +31 -31
- package/dist/esm/components/Agent/hooks/duplicateFetch.js +36 -36
- package/dist/esm/components/Agent/hooks/useAgentActions.js +14 -14
- package/dist/esm/components/User/ProfileCardTrigger.js +15 -15
- package/dist/esm/components/common/ProfileCardTrigger.js +2 -2
- package/dist/esm/util/analytics.js +2 -2
- package/dist/esm/util/useProfileInfo.js +11 -11
- package/package.json +3 -6
|
@@ -65,17 +65,17 @@ export var buildAggUserQuery = function buildAggUserQuery(userId) {
|
|
|
65
65
|
var queryAGGUser = /*#__PURE__*/function () {
|
|
66
66
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, userId) {
|
|
67
67
|
var query, _yield$AGGQuery, user;
|
|
68
|
-
return _regeneratorRuntime.wrap(function
|
|
68
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
69
69
|
while (1) switch (_context.prev = _context.next) {
|
|
70
70
|
case 0:
|
|
71
71
|
query = buildAggUserQuery(userId);
|
|
72
|
-
_context.next =
|
|
72
|
+
_context.next = 1;
|
|
73
73
|
return AGGQuery(url, query);
|
|
74
|
-
case
|
|
74
|
+
case 1:
|
|
75
75
|
_yield$AGGQuery = _context.sent;
|
|
76
76
|
user = _yield$AGGQuery.user;
|
|
77
77
|
return _context.abrupt("return", user);
|
|
78
|
-
case
|
|
78
|
+
case 2:
|
|
79
79
|
case "end":
|
|
80
80
|
return _context.stop();
|
|
81
81
|
}
|
|
@@ -100,15 +100,15 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
100
100
|
var _makeRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_cloudId, userId) {
|
|
101
101
|
var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5;
|
|
102
102
|
var gatewayGraphqlUrl, urlWithOperationName, userQueryPromise, user, timestring, localWeekdayIndex, timeFormat;
|
|
103
|
-
return _regeneratorRuntime.wrap(function
|
|
103
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
104
104
|
while (1) switch (_context2.prev = _context2.next) {
|
|
105
105
|
case 0:
|
|
106
106
|
gatewayGraphqlUrl = this.options.gatewayGraphqlUrl || '/gateway/api/graphql';
|
|
107
107
|
urlWithOperationName = "".concat(gatewayGraphqlUrl, "?operationName=aggUserQuery");
|
|
108
108
|
userQueryPromise = queryAGGUser(urlWithOperationName, userId);
|
|
109
|
-
_context2.next =
|
|
109
|
+
_context2.next = 1;
|
|
110
110
|
return userQueryPromise;
|
|
111
|
-
case
|
|
111
|
+
case 1:
|
|
112
112
|
user = _context2.sent;
|
|
113
113
|
localWeekdayIndex = new Date().getDay().toString();
|
|
114
114
|
timeFormat = 'h:mmaaa';
|
|
@@ -134,7 +134,7 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
134
134
|
companyName: (_user$extendedProfile5 = user.extendedProfile) === null || _user$extendedProfile5 === void 0 ? void 0 : _user$extendedProfile5.organization,
|
|
135
135
|
timestring: timestring
|
|
136
136
|
}));
|
|
137
|
-
case
|
|
137
|
+
case 2:
|
|
138
138
|
case "end":
|
|
139
139
|
return _context2.stop();
|
|
140
140
|
}
|
|
@@ -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', "25.7.
|
|
7
|
+
headers.append('atl-client-version', "25.7.5");
|
|
8
8
|
return headers;
|
|
9
9
|
};
|
|
10
10
|
export function getOrgIdForCloudIdFromAGG(_x, _x2) {
|
|
@@ -12,8 +12,8 @@ export function getOrgIdForCloudIdFromAGG(_x, _x2) {
|
|
|
12
12
|
}
|
|
13
13
|
function _getOrgIdForCloudIdFromAGG() {
|
|
14
14
|
_getOrgIdForCloudIdFromAGG = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, cloudId) {
|
|
15
|
-
var query, _yield$AGGQuery, tenantContexts;
|
|
16
|
-
return _regeneratorRuntime.wrap(function
|
|
15
|
+
var query, _yield$AGGQuery, tenantContexts, _t;
|
|
16
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
19
19
|
query = {
|
|
@@ -23,27 +23,27 @@ function _getOrgIdForCloudIdFromAGG() {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
_context.prev = 1;
|
|
26
|
-
_context.next =
|
|
26
|
+
_context.next = 2;
|
|
27
27
|
return AGGQuery(url, query, addHeaders);
|
|
28
|
-
case
|
|
28
|
+
case 2:
|
|
29
29
|
_yield$AGGQuery = _context.sent;
|
|
30
30
|
tenantContexts = _yield$AGGQuery.tenantContexts;
|
|
31
31
|
if (!(!tenantContexts || tenantContexts.length === 0 || tenantContexts[0] === null)) {
|
|
32
|
-
_context.next =
|
|
32
|
+
_context.next = 3;
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
return _context.abrupt("return", null);
|
|
36
|
-
case
|
|
36
|
+
case 3:
|
|
37
37
|
return _context.abrupt("return", tenantContexts[0].orgId);
|
|
38
|
-
case
|
|
39
|
-
_context.prev =
|
|
40
|
-
|
|
38
|
+
case 4:
|
|
39
|
+
_context.prev = 4;
|
|
40
|
+
_t = _context["catch"](1);
|
|
41
41
|
return _context.abrupt("return", null);
|
|
42
|
-
case
|
|
42
|
+
case 5:
|
|
43
43
|
case "end":
|
|
44
44
|
return _context.stop();
|
|
45
45
|
}
|
|
46
|
-
}, _callee, null, [[1,
|
|
46
|
+
}, _callee, null, [[1, 4]]);
|
|
47
47
|
}));
|
|
48
48
|
return _getOrgIdForCloudIdFromAGG.apply(this, arguments);
|
|
49
49
|
}
|
|
@@ -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', "25.7.
|
|
62
|
+
headers.append('atl-client-version', "25.7.5");
|
|
63
63
|
return headers;
|
|
64
64
|
};
|
|
65
65
|
export function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -68,20 +68,20 @@ export function getTeamFromAGG(_x, _x2, _x3) {
|
|
|
68
68
|
function _getTeamFromAGG() {
|
|
69
69
|
_getTeamFromAGG = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, teamId, siteId) {
|
|
70
70
|
var query, _yield$AGGQuery, Team;
|
|
71
|
-
return _regeneratorRuntime.wrap(function
|
|
71
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
72
72
|
while (1) switch (_context.prev = _context.next) {
|
|
73
73
|
case 0:
|
|
74
74
|
query = buildGatewayQuery({
|
|
75
75
|
teamId: teamId,
|
|
76
76
|
siteId: siteId
|
|
77
77
|
});
|
|
78
|
-
_context.next =
|
|
78
|
+
_context.next = 1;
|
|
79
79
|
return AGGQuery(url, query, addHeaders);
|
|
80
|
-
case
|
|
80
|
+
case 1:
|
|
81
81
|
_yield$AGGQuery = _context.sent;
|
|
82
82
|
Team = _yield$AGGQuery.Team;
|
|
83
83
|
return _context.abrupt("return", convertTeam(Team));
|
|
84
|
-
case
|
|
84
|
+
case 2:
|
|
85
85
|
case "end":
|
|
86
86
|
return _context.stop();
|
|
87
87
|
}
|
|
@@ -29,12 +29,12 @@ function _directoryGraphqlQuery() {
|
|
|
29
29
|
_directoryGraphqlQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(serviceUrl, query) {
|
|
30
30
|
var processHeaders,
|
|
31
31
|
_args = arguments;
|
|
32
|
-
return _regeneratorRuntime.wrap(function
|
|
32
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
33
33
|
while (1) switch (_context.prev = _context.next) {
|
|
34
34
|
case 0:
|
|
35
35
|
processHeaders = _args.length > 2 && _args[2] !== undefined ? _args[2] : id;
|
|
36
36
|
return _context.abrupt("return", graphQLQuery(serviceUrl, query, processHeaders, handleDirectoryGraphQLErrors));
|
|
37
|
-
case
|
|
37
|
+
case 1:
|
|
38
38
|
case "end":
|
|
39
39
|
return _context.stop();
|
|
40
40
|
}
|
|
@@ -49,12 +49,12 @@ function _AGGQuery() {
|
|
|
49
49
|
_AGGQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(serviceUrl, query) {
|
|
50
50
|
var processHeaders,
|
|
51
51
|
_args2 = arguments;
|
|
52
|
-
return _regeneratorRuntime.wrap(function
|
|
52
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
53
53
|
while (1) switch (_context2.prev = _context2.next) {
|
|
54
54
|
case 0:
|
|
55
55
|
processHeaders = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : id;
|
|
56
56
|
return _context2.abrupt("return", graphQLQuery(serviceUrl, query, processHeaders, handleAGGErrors));
|
|
57
|
-
case
|
|
57
|
+
case 1:
|
|
58
58
|
case "end":
|
|
59
59
|
return _context2.stop();
|
|
60
60
|
}
|
|
@@ -77,13 +77,13 @@ function _graphQLQuery() {
|
|
|
77
77
|
_json$extensions$gate,
|
|
78
78
|
_json$extensions,
|
|
79
79
|
_args3 = arguments;
|
|
80
|
-
return _regeneratorRuntime.wrap(function
|
|
80
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
81
81
|
while (1) switch (_context3.prev = _context3.next) {
|
|
82
82
|
case 0:
|
|
83
83
|
processHeaders = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : id;
|
|
84
84
|
handleErrors = _args3.length > 3 ? _args3[3] : undefined;
|
|
85
85
|
headers = processHeaders(buildHeaders());
|
|
86
|
-
_context3.next =
|
|
86
|
+
_context3.next = 1;
|
|
87
87
|
return fetch(new Request(serviceUrl, {
|
|
88
88
|
method: 'POST',
|
|
89
89
|
credentials: 'include',
|
|
@@ -91,24 +91,24 @@ function _graphQLQuery() {
|
|
|
91
91
|
headers: headers,
|
|
92
92
|
body: JSON.stringify(query)
|
|
93
93
|
}));
|
|
94
|
-
case
|
|
94
|
+
case 1:
|
|
95
95
|
response = _context3.sent;
|
|
96
96
|
traceIdFromHeaders = response === null || response === void 0 || (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get('atl-traceid');
|
|
97
97
|
if (response.ok) {
|
|
98
|
-
_context3.next =
|
|
98
|
+
_context3.next = 2;
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
101
101
|
throw new HttpError(response.status, response.statusText, traceIdFromHeaders);
|
|
102
|
-
case
|
|
103
|
-
_context3.next =
|
|
102
|
+
case 2:
|
|
103
|
+
_context3.next = 3;
|
|
104
104
|
return response.json();
|
|
105
|
-
case
|
|
105
|
+
case 3:
|
|
106
106
|
json = _context3.sent;
|
|
107
107
|
if (json.errors) {
|
|
108
108
|
handleErrors(json.errors, (_json$extensions$gate = (_json$extensions = json.extensions) === null || _json$extensions === void 0 || (_json$extensions = _json$extensions.gateway) === null || _json$extensions === void 0 ? void 0 : _json$extensions.request_id) !== null && _json$extensions$gate !== void 0 ? _json$extensions$gate : traceIdFromHeaders);
|
|
109
109
|
}
|
|
110
110
|
return _context3.abrupt("return", json.data);
|
|
111
|
-
case
|
|
111
|
+
case 4:
|
|
112
112
|
case "end":
|
|
113
113
|
return _context3.stop();
|
|
114
114
|
}
|
|
@@ -38,12 +38,12 @@ export var AgentActions = function AgentActions(_ref) {
|
|
|
38
38
|
var isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
|
|
39
39
|
var loadAgentPermissions = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
40
40
|
var _yield$resourceClient, _yield$resourceClient2, AGENT_CREATE, AGENT_UPDATE, AGENT_DEACTIVATE;
|
|
41
|
-
return _regeneratorRuntime.wrap(function
|
|
41
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
42
42
|
while (1) switch (_context.prev = _context.next) {
|
|
43
43
|
case 0:
|
|
44
|
-
_context.next =
|
|
44
|
+
_context.next = 1;
|
|
45
45
|
return resourceClient.getRovoAgentPermissions(agent.id);
|
|
46
|
-
case
|
|
46
|
+
case 1:
|
|
47
47
|
_yield$resourceClient = _context.sent;
|
|
48
48
|
_yield$resourceClient2 = _yield$resourceClient.permissions;
|
|
49
49
|
AGENT_CREATE = _yield$resourceClient2.AGENT_CREATE;
|
|
@@ -54,7 +54,7 @@ export var AgentActions = function AgentActions(_ref) {
|
|
|
54
54
|
isEditEnabled: AGENT_UPDATE.permitted,
|
|
55
55
|
isDeleteEnabled: AGENT_DEACTIVATE.permitted
|
|
56
56
|
});
|
|
57
|
-
case
|
|
57
|
+
case 2:
|
|
58
58
|
case "end":
|
|
59
59
|
return _context.stop();
|
|
60
60
|
}
|
|
@@ -14,18 +14,18 @@ export var AgentDeleteConfirmationModal = function AgentDeleteConfirmationModal(
|
|
|
14
14
|
var _useIntl = useIntl(),
|
|
15
15
|
formatMessage = _useIntl.formatMessage;
|
|
16
16
|
var handleDeleteAgent = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
17
|
-
return _regeneratorRuntime.wrap(function
|
|
17
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
18
18
|
while (1) switch (_context.prev = _context.next) {
|
|
19
19
|
case 0:
|
|
20
20
|
if (!agentId) {
|
|
21
|
-
_context.next =
|
|
21
|
+
_context.next = 2;
|
|
22
22
|
break;
|
|
23
23
|
}
|
|
24
|
-
_context.next =
|
|
24
|
+
_context.next = 1;
|
|
25
25
|
return onSubmit();
|
|
26
|
-
case
|
|
26
|
+
case 1:
|
|
27
27
|
onClose();
|
|
28
|
-
case
|
|
28
|
+
case 2:
|
|
29
29
|
case "end":
|
|
30
30
|
return _context.stop();
|
|
31
31
|
}
|
|
@@ -91,49 +91,50 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
91
91
|
setStarCount(agent === null || agent === void 0 ? void 0 : agent.favourite_count);
|
|
92
92
|
}, [agent === null || agent === void 0 ? void 0 : agent.favourite, agent === null || agent === void 0 ? void 0 : agent.favourite_count]);
|
|
93
93
|
var handleSetFavourite = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
94
|
-
|
|
94
|
+
var _t;
|
|
95
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
95
96
|
while (1) switch (_context.prev = _context.next) {
|
|
96
97
|
case 0:
|
|
97
98
|
if (!(agent !== null && agent !== void 0 && agent.id)) {
|
|
98
|
-
_context.next =
|
|
99
|
+
_context.next = 4;
|
|
99
100
|
break;
|
|
100
101
|
}
|
|
101
102
|
_context.prev = 1;
|
|
102
|
-
_context.next =
|
|
103
|
+
_context.next = 2;
|
|
103
104
|
return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireEvent);
|
|
104
|
-
case
|
|
105
|
+
case 2:
|
|
105
106
|
if (isStarred) {
|
|
106
107
|
setStarCount(starCount ? starCount - 1 : 0);
|
|
107
108
|
} else {
|
|
108
109
|
setStarCount((starCount || 0) + 1);
|
|
109
110
|
}
|
|
110
111
|
setIsStarred(!isStarred);
|
|
111
|
-
_context.next =
|
|
112
|
+
_context.next = 4;
|
|
112
113
|
break;
|
|
113
|
-
case
|
|
114
|
-
_context.prev =
|
|
115
|
-
|
|
116
|
-
case
|
|
114
|
+
case 3:
|
|
115
|
+
_context.prev = 3;
|
|
116
|
+
_t = _context["catch"](1);
|
|
117
|
+
case 4:
|
|
117
118
|
case "end":
|
|
118
119
|
return _context.stop();
|
|
119
120
|
}
|
|
120
|
-
}, _callee, null, [[1,
|
|
121
|
+
}, _callee, null, [[1, 3]]);
|
|
121
122
|
})), [agent === null || agent === void 0 ? void 0 : agent.id, fireEvent, isStarred, resourceClient, starCount]);
|
|
122
123
|
var handleOnDelete = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
123
|
-
var _onDeleteAgent, restore;
|
|
124
|
-
return _regeneratorRuntime.wrap(function
|
|
124
|
+
var _onDeleteAgent, restore, _t2;
|
|
125
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
125
126
|
while (1) switch (_context2.prev = _context2.next) {
|
|
126
127
|
case 0:
|
|
127
128
|
if (!(agent && onDeleteAgent)) {
|
|
128
|
-
_context2.next =
|
|
129
|
+
_context2.next = 4;
|
|
129
130
|
break;
|
|
130
131
|
}
|
|
131
132
|
// Optimistically remove from cache
|
|
132
133
|
_onDeleteAgent = onDeleteAgent(agent.id), restore = _onDeleteAgent.restore;
|
|
133
|
-
_context2.prev =
|
|
134
|
-
_context2.next =
|
|
134
|
+
_context2.prev = 1;
|
|
135
|
+
_context2.next = 2;
|
|
135
136
|
return resourceClient.deleteAgent(agent.id, fireEvent);
|
|
136
|
-
case
|
|
137
|
+
case 2:
|
|
137
138
|
addFlag === null || addFlag === void 0 || addFlag({
|
|
138
139
|
title: formatMessage(messages.agentDeletedSuccessFlagTitle),
|
|
139
140
|
description: formatMessage(messages.agentDeletedSuccessFlagDescription, {
|
|
@@ -142,11 +143,11 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
142
143
|
type: 'success',
|
|
143
144
|
id: 'ptc-directory.agent-profile.delete-agent-success'
|
|
144
145
|
});
|
|
145
|
-
_context2.next =
|
|
146
|
+
_context2.next = 4;
|
|
146
147
|
break;
|
|
147
|
-
case
|
|
148
|
-
_context2.prev =
|
|
149
|
-
|
|
148
|
+
case 3:
|
|
149
|
+
_context2.prev = 3;
|
|
150
|
+
_t2 = _context2["catch"](1);
|
|
150
151
|
// Restore agent to cache on error
|
|
151
152
|
restore();
|
|
152
153
|
addFlag === null || addFlag === void 0 || addFlag({
|
|
@@ -155,11 +156,11 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
155
156
|
type: 'error',
|
|
156
157
|
id: 'ptc-directory.agent-profile.delete-agent-error'
|
|
157
158
|
});
|
|
158
|
-
case
|
|
159
|
+
case 4:
|
|
159
160
|
case "end":
|
|
160
161
|
return _context2.stop();
|
|
161
162
|
}
|
|
162
|
-
}, _callee2, null, [[
|
|
163
|
+
}, _callee2, null, [[1, 3]]);
|
|
163
164
|
})), [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireEvent]);
|
|
164
165
|
useEffect(function () {
|
|
165
166
|
if (!isLoading && agent) {
|
|
@@ -271,14 +272,14 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
271
272
|
return _onCopyAgent(agent.id);
|
|
272
273
|
},
|
|
273
274
|
onDuplicateAgent: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
274
|
-
return _regeneratorRuntime.wrap(function
|
|
275
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
275
276
|
while (1) switch (_context3.prev = _context3.next) {
|
|
276
277
|
case 0:
|
|
277
|
-
_context3.next =
|
|
278
|
+
_context3.next = 1;
|
|
278
279
|
return onDuplicateAgent(agent.id);
|
|
279
|
-
case
|
|
280
|
+
case 1:
|
|
280
281
|
return _context3.abrupt("return", _context3.sent);
|
|
281
|
-
case
|
|
282
|
+
case 2:
|
|
282
283
|
case "end":
|
|
283
284
|
return _context3.stop();
|
|
284
285
|
}
|
|
@@ -43,20 +43,20 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
43
43
|
var profileHref = navResult.href;
|
|
44
44
|
var getCreator = useCallback( /*#__PURE__*/function () {
|
|
45
45
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
46
|
-
var creator_type, creator, authoringTeam, _authoringTeam$displa, _authoringTeam$profil, _userCreatorInfo$full, userCreatorInfo, currentCreatorUserId, creatorInfo;
|
|
47
|
-
return _regeneratorRuntime.wrap(function
|
|
46
|
+
var creator_type, creator, authoringTeam, _authoringTeam$displa, _authoringTeam$profil, _userCreatorInfo$full, userCreatorInfo, currentCreatorUserId, creatorInfo, _t;
|
|
47
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
48
48
|
while (1) switch (_context.prev = _context.next) {
|
|
49
49
|
case 0:
|
|
50
50
|
creator_type = _ref.creator_type, creator = _ref.creator, authoringTeam = _ref.authoringTeam;
|
|
51
51
|
_context.prev = 1;
|
|
52
52
|
currentCreatorUserId = fg('jira_ai_fix_agent_profile_card_flashing') ? creator_type === 'CUSTOMER' && creator ? getAAIDFromARI(creator) : undefined : creatorUserId;
|
|
53
53
|
if (!(currentCreatorUserId && props.cloudId)) {
|
|
54
|
-
_context.next =
|
|
54
|
+
_context.next = 3;
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
57
|
-
_context.next =
|
|
57
|
+
_context.next = 2;
|
|
58
58
|
return props.resourceClient.getProfile(props.cloudId, currentCreatorUserId, fireEvent);
|
|
59
|
-
case
|
|
59
|
+
case 2:
|
|
60
60
|
userCreatorInfo = _context.sent;
|
|
61
61
|
if (fg('jira_ai_fix_agent_profile_card_flashing')) {
|
|
62
62
|
profileHref = navigateToTeamsApp({
|
|
@@ -67,7 +67,7 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
67
67
|
cloudId: props.cloudId
|
|
68
68
|
}).href;
|
|
69
69
|
}
|
|
70
|
-
case
|
|
70
|
+
case 3:
|
|
71
71
|
creatorInfo = getAgentCreator({
|
|
72
72
|
creatorType: creator_type !== null && creator_type !== void 0 ? creator_type : '',
|
|
73
73
|
authoringTeam: authoringTeam ? {
|
|
@@ -81,33 +81,33 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
81
81
|
forgeCreator: creator !== null && creator !== void 0 ? creator : undefined
|
|
82
82
|
});
|
|
83
83
|
return _context.abrupt("return", creatorInfo);
|
|
84
|
-
case
|
|
85
|
-
_context.prev =
|
|
86
|
-
|
|
84
|
+
case 4:
|
|
85
|
+
_context.prev = 4;
|
|
86
|
+
_t = _context["catch"](1);
|
|
87
87
|
return _context.abrupt("return", undefined);
|
|
88
|
-
case
|
|
88
|
+
case 5:
|
|
89
89
|
case "end":
|
|
90
90
|
return _context.stop();
|
|
91
91
|
}
|
|
92
|
-
}, _callee, null, [[1,
|
|
92
|
+
}, _callee, null, [[1, 4]]);
|
|
93
93
|
}));
|
|
94
94
|
return function (_x) {
|
|
95
95
|
return _ref2.apply(this, arguments);
|
|
96
96
|
};
|
|
97
97
|
}(), [creatorUserId, fireEvent, props.cloudId, props.resourceClient, profileHref]);
|
|
98
98
|
var fetchData = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
99
|
-
var _profileResult$aggDat, _profileResult$aggDat2, profileResult, profileData, creatorInfoProps, agentCreatorInfo;
|
|
100
|
-
return _regeneratorRuntime.wrap(function
|
|
99
|
+
var _profileResult$aggDat, _profileResult$aggDat2, profileResult, profileData, creatorInfoProps, agentCreatorInfo, _t2;
|
|
100
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
101
101
|
while (1) switch (_context2.prev = _context2.next) {
|
|
102
102
|
case 0:
|
|
103
103
|
setIsLoading(true);
|
|
104
104
|
_context2.prev = 1;
|
|
105
|
-
_context2.next =
|
|
105
|
+
_context2.next = 2;
|
|
106
106
|
return props.resourceClient.getRovoAgentProfile({
|
|
107
107
|
type: 'identity',
|
|
108
108
|
value: props.accountId
|
|
109
109
|
}, fireEvent);
|
|
110
|
-
case
|
|
110
|
+
case 2:
|
|
111
111
|
profileResult = _context2.sent;
|
|
112
112
|
profileData = profileResult.restData;
|
|
113
113
|
creatorInfoProps = {
|
|
@@ -115,28 +115,28 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
115
115
|
creator: (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined,
|
|
116
116
|
authoringTeam: (_profileResult$aggDat = (_profileResult$aggDat2 = profileResult.aggData) === null || _profileResult$aggDat2 === void 0 ? void 0 : _profileResult$aggDat2.authoringTeam) !== null && _profileResult$aggDat !== void 0 ? _profileResult$aggDat : undefined
|
|
117
117
|
};
|
|
118
|
-
_context2.next =
|
|
118
|
+
_context2.next = 3;
|
|
119
119
|
return getCreator(creatorInfoProps);
|
|
120
|
-
case
|
|
120
|
+
case 3:
|
|
121
121
|
agentCreatorInfo = _context2.sent;
|
|
122
122
|
setAgentData(_objectSpread(_objectSpread({}, profileData), {}, {
|
|
123
123
|
creatorInfo: agentCreatorInfo
|
|
124
124
|
}));
|
|
125
|
-
_context2.next =
|
|
125
|
+
_context2.next = 5;
|
|
126
126
|
break;
|
|
127
|
-
case
|
|
128
|
-
_context2.prev =
|
|
129
|
-
|
|
130
|
-
setError(
|
|
131
|
-
case
|
|
132
|
-
_context2.prev =
|
|
127
|
+
case 4:
|
|
128
|
+
_context2.prev = 4;
|
|
129
|
+
_t2 = _context2["catch"](1);
|
|
130
|
+
setError(_t2);
|
|
131
|
+
case 5:
|
|
132
|
+
_context2.prev = 5;
|
|
133
133
|
setIsLoading(false);
|
|
134
|
-
return _context2.finish(
|
|
135
|
-
case
|
|
134
|
+
return _context2.finish(5);
|
|
135
|
+
case 6:
|
|
136
136
|
case "end":
|
|
137
137
|
return _context2.stop();
|
|
138
138
|
}
|
|
139
|
-
}, _callee2, null, [[1,
|
|
139
|
+
}, _callee2, null, [[1, 4, 5, 6]]);
|
|
140
140
|
})), [fireEvent, getCreator, props.accountId, props.resourceClient]);
|
|
141
141
|
|
|
142
142
|
// Depend on accountId rather than fetchData to avoid a re-fetch loop:
|
|
@@ -29,54 +29,54 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
29
29
|
*/
|
|
30
30
|
var getCreator = /*#__PURE__*/function () {
|
|
31
31
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
32
|
-
var creator_type, creator, authoringTeam, _userId, _authoringTeam$displa, _authoringTeam$profil, _navigateToTeamsApp, profileHref, creatorInfo;
|
|
33
|
-
return _regeneratorRuntime.wrap(function
|
|
32
|
+
var creator_type, creator, authoringTeam, _userId, _authoringTeam$displa, _authoringTeam$profil, _navigateToTeamsApp, profileHref, creatorInfo, _t, _t2;
|
|
33
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
34
34
|
while (1) switch (_context.prev = _context.next) {
|
|
35
35
|
case 0:
|
|
36
36
|
creator_type = _ref2.creator_type, creator = _ref2.creator, authoringTeam = _ref2.authoringTeam;
|
|
37
37
|
if (creator) {
|
|
38
|
-
_context.next =
|
|
38
|
+
_context.next = 1;
|
|
39
39
|
break;
|
|
40
40
|
}
|
|
41
41
|
return _context.abrupt("return", undefined);
|
|
42
|
-
case
|
|
42
|
+
case 1:
|
|
43
43
|
if (!(isForgeAgentByCreatorType(creator_type) && fg('rovo_agent_support_a2a_avatar'))) {
|
|
44
|
-
_context.next =
|
|
44
|
+
_context.next = 2;
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
return _context.abrupt("return", {
|
|
48
48
|
type: 'THIRD_PARTY',
|
|
49
49
|
name: creator !== null && creator !== void 0 ? creator : ''
|
|
50
50
|
});
|
|
51
|
-
case
|
|
52
|
-
|
|
53
|
-
_context.next =
|
|
51
|
+
case 2:
|
|
52
|
+
_t = creator_type;
|
|
53
|
+
_context.next = _t === 'SYSTEM' ? 3 : _t === 'THIRD_PARTY' ? 4 : _t === 'FORGE' ? 5 : _t === 'CUSTOMER' ? 6 : 12;
|
|
54
54
|
break;
|
|
55
|
-
case
|
|
55
|
+
case 3:
|
|
56
56
|
return _context.abrupt("return", {
|
|
57
57
|
type: 'SYSTEM'
|
|
58
58
|
});
|
|
59
|
-
case
|
|
59
|
+
case 4:
|
|
60
60
|
return _context.abrupt("return", {
|
|
61
61
|
type: 'THIRD_PARTY',
|
|
62
62
|
name: creator !== null && creator !== void 0 ? creator : ''
|
|
63
63
|
});
|
|
64
|
-
case
|
|
64
|
+
case 5:
|
|
65
65
|
return _context.abrupt("return", {
|
|
66
66
|
type: 'THIRD_PARTY',
|
|
67
67
|
name: creator !== null && creator !== void 0 ? creator : ''
|
|
68
68
|
});
|
|
69
|
-
case
|
|
69
|
+
case 6:
|
|
70
70
|
_userId = getAAIDFromARI(creator) || '';
|
|
71
|
-
_context.prev =
|
|
71
|
+
_context.prev = 7;
|
|
72
72
|
if (!(!_userId || !cloudId)) {
|
|
73
|
-
_context.next =
|
|
73
|
+
_context.next = 8;
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
return _context.abrupt("return", undefined);
|
|
77
|
-
case
|
|
77
|
+
case 8:
|
|
78
78
|
if (!authoringTeam) {
|
|
79
|
-
_context.next =
|
|
79
|
+
_context.next = 9;
|
|
80
80
|
break;
|
|
81
81
|
}
|
|
82
82
|
return _context.abrupt("return", {
|
|
@@ -84,7 +84,7 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
84
84
|
name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
|
|
85
85
|
profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
|
|
86
86
|
});
|
|
87
|
-
case
|
|
87
|
+
case 9:
|
|
88
88
|
_navigateToTeamsApp = navigateToTeamsApp({
|
|
89
89
|
type: 'USER',
|
|
90
90
|
payload: {
|
|
@@ -92,9 +92,9 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
92
92
|
},
|
|
93
93
|
cloudId: cloudId
|
|
94
94
|
}), profileHref = _navigateToTeamsApp.href;
|
|
95
|
-
_context.next =
|
|
95
|
+
_context.next = 10;
|
|
96
96
|
return props.resourceClient.getProfile(cloudId, _userId, fireEvent);
|
|
97
|
-
case
|
|
97
|
+
case 10:
|
|
98
98
|
creatorInfo = _context.sent;
|
|
99
99
|
return _context.abrupt("return", {
|
|
100
100
|
type: 'CUSTOMER',
|
|
@@ -102,17 +102,17 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
102
102
|
profileLink: fg('platform-adopt-teams-nav-config') ? profileHref : "/people/".concat(_userId),
|
|
103
103
|
id: _userId
|
|
104
104
|
});
|
|
105
|
-
case
|
|
106
|
-
_context.prev =
|
|
107
|
-
|
|
105
|
+
case 11:
|
|
106
|
+
_context.prev = 11;
|
|
107
|
+
_t2 = _context["catch"](7);
|
|
108
108
|
return _context.abrupt("return", undefined);
|
|
109
|
-
case
|
|
109
|
+
case 12:
|
|
110
110
|
return _context.abrupt("return", undefined);
|
|
111
|
-
case
|
|
111
|
+
case 13:
|
|
112
112
|
case "end":
|
|
113
113
|
return _context.stop();
|
|
114
114
|
}
|
|
115
|
-
}, _callee, null, [[
|
|
115
|
+
}, _callee, null, [[7, 11]]);
|
|
116
116
|
}));
|
|
117
117
|
return function getCreator(_x) {
|
|
118
118
|
return _ref3.apply(this, arguments);
|
|
@@ -122,29 +122,29 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
122
122
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
123
123
|
var _agentProfileResult$a, _agentProfileResult$a2;
|
|
124
124
|
var agentProfileResult, agentInfo, agentCreatorInfo;
|
|
125
|
-
return _regeneratorRuntime.wrap(function
|
|
125
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
126
126
|
while (1) switch (_context2.prev = _context2.next) {
|
|
127
127
|
case 0:
|
|
128
|
-
_context2.next =
|
|
128
|
+
_context2.next = 1;
|
|
129
129
|
return resourceClient.getRovoAgentProfile({
|
|
130
130
|
type: agentIdType,
|
|
131
131
|
value: userId
|
|
132
132
|
}, fireEvent);
|
|
133
|
-
case
|
|
133
|
+
case 1:
|
|
134
134
|
agentProfileResult = _context2.sent;
|
|
135
135
|
agentInfo = agentProfileResult.restData;
|
|
136
|
-
_context2.next =
|
|
136
|
+
_context2.next = 2;
|
|
137
137
|
return getCreator({
|
|
138
138
|
creator_type: agentInfo.creator_type,
|
|
139
139
|
creator: agentInfo.creator || undefined,
|
|
140
140
|
authoringTeam: (_agentProfileResult$a = (_agentProfileResult$a2 = agentProfileResult.aggData) === null || _agentProfileResult$a2 === void 0 ? void 0 : _agentProfileResult$a2.authoringTeam) !== null && _agentProfileResult$a !== void 0 ? _agentProfileResult$a : undefined
|
|
141
141
|
});
|
|
142
|
-
case
|
|
142
|
+
case 2:
|
|
143
143
|
agentCreatorInfo = _context2.sent;
|
|
144
144
|
return _context2.abrupt("return", _objectSpread(_objectSpread({}, agentInfo), {}, {
|
|
145
145
|
creatorInfo: agentCreatorInfo
|
|
146
146
|
}));
|
|
147
|
-
case
|
|
147
|
+
case 3:
|
|
148
148
|
case "end":
|
|
149
149
|
return _context2.stop();
|
|
150
150
|
}
|