@atlaskit/profilecard 25.7.5 → 25.7.7
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 +14 -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/styled/Card.compiled.css +1 -1
- package/dist/cjs/styled/Card.js +1 -1
- 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/styled/Card.compiled.css +1 -1
- package/dist/es2019/styled/Card.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/styled/Card.compiled.css +1 -1
- package/dist/esm/styled/Card.js +1 -1
- package/dist/esm/util/analytics.js +2 -2
- package/dist/esm/util/useProfileInfo.js +11 -11
- package/package.json +7 -10
|
@@ -118,22 +118,22 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
118
118
|
value: (function () {
|
|
119
119
|
var _makeRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(userId) {
|
|
120
120
|
var query, response;
|
|
121
|
-
return _regeneratorRuntime.wrap(function
|
|
121
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
122
122
|
while (1) switch (_context.prev = _context.next) {
|
|
123
123
|
case 0:
|
|
124
124
|
if (!(this.options.teamCentralDisabled === true)) {
|
|
125
|
-
_context.next =
|
|
125
|
+
_context.next = 1;
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
throw new Error('makeRequest cannot be called when the client has been disabled');
|
|
129
|
-
case
|
|
129
|
+
case 1:
|
|
130
130
|
query = buildReportingLinesQuery(userId);
|
|
131
|
-
_context.next =
|
|
131
|
+
_context.next = 2;
|
|
132
132
|
return directoryGraphqlQuery('/gateway/api/watermelon/graphql?operationName=ReportingLines', query);
|
|
133
|
-
case
|
|
133
|
+
case 2:
|
|
134
134
|
response = _context.sent;
|
|
135
135
|
return _context.abrupt("return", response.reportingLines);
|
|
136
|
-
case
|
|
136
|
+
case 3:
|
|
137
137
|
case "end":
|
|
138
138
|
return _context.stop();
|
|
139
139
|
}
|
|
@@ -149,7 +149,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
149
149
|
value: function () {
|
|
150
150
|
var _checkWorkspaceExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
151
151
|
var workspaceExistsPromise;
|
|
152
|
-
return _regeneratorRuntime.wrap(function
|
|
152
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
153
153
|
while (1) switch (_context2.prev = _context2.next) {
|
|
154
154
|
case 0:
|
|
155
155
|
workspaceExistsPromise = fg('enable_ptc_townsquare_reporting_lines_unsharded') ? this.workspaceExistsWithTypePromise.then(function (workspaceExistsWithType) {
|
|
@@ -163,7 +163,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
163
163
|
}, function () {
|
|
164
164
|
return Promise.resolve(false);
|
|
165
165
|
}));
|
|
166
|
-
case
|
|
166
|
+
case 1:
|
|
167
167
|
case "end":
|
|
168
168
|
return _context2.stop();
|
|
169
169
|
}
|
|
@@ -178,15 +178,16 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
178
178
|
key: "getIsGlobalExperienceWorkspace",
|
|
179
179
|
value: function () {
|
|
180
180
|
var _getIsGlobalExperienceWorkspace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
181
|
-
|
|
181
|
+
var _t;
|
|
182
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
182
183
|
while (1) switch (_context3.prev = _context3.next) {
|
|
183
184
|
case 0:
|
|
184
|
-
_context3.next =
|
|
185
|
+
_context3.next = 1;
|
|
185
186
|
return this.workspaceExistsWithTypePromise;
|
|
187
|
+
case 1:
|
|
188
|
+
_t = _context3.sent;
|
|
189
|
+
return _context3.abrupt("return", _t === 'GLOBAL_EXPERIENCE');
|
|
186
190
|
case 2:
|
|
187
|
-
_context3.t0 = _context3.sent;
|
|
188
|
-
return _context3.abrupt("return", _context3.t0 === 'GLOBAL_EXPERIENCE');
|
|
189
|
-
case 4:
|
|
190
191
|
case "end":
|
|
191
192
|
return _context3.stop();
|
|
192
193
|
}
|
|
@@ -231,37 +232,37 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
231
232
|
key: "getWorkspaceExistsWithType",
|
|
232
233
|
value: function () {
|
|
233
234
|
var _getWorkspaceExistsWithType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cloudId) {
|
|
234
|
-
var response, workspaceType;
|
|
235
|
-
return _regeneratorRuntime.wrap(function
|
|
235
|
+
var response, workspaceType, _t2;
|
|
236
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
236
237
|
while (1) switch (_context4.prev = _context4.next) {
|
|
237
238
|
case 0:
|
|
238
239
|
_context4.prev = 0;
|
|
239
|
-
_context4.next =
|
|
240
|
+
_context4.next = 1;
|
|
240
241
|
return fetch("".concat(this.getShardedApiPath(cloudId), "/workspace/existsWithWorkspaceType?cloudId=").concat(cloudId), {
|
|
241
242
|
credentials: 'include'
|
|
242
243
|
});
|
|
243
|
-
case
|
|
244
|
+
case 1:
|
|
244
245
|
response = _context4.sent;
|
|
245
246
|
if (!response.ok) {
|
|
246
|
-
_context4.next =
|
|
247
|
+
_context4.next = 3;
|
|
247
248
|
break;
|
|
248
249
|
}
|
|
249
|
-
_context4.next =
|
|
250
|
+
_context4.next = 2;
|
|
250
251
|
return response.text();
|
|
251
|
-
case
|
|
252
|
+
case 2:
|
|
252
253
|
workspaceType = _context4.sent;
|
|
253
254
|
return _context4.abrupt("return", workspaceType);
|
|
254
|
-
case
|
|
255
|
+
case 3:
|
|
255
256
|
return _context4.abrupt("return", undefined);
|
|
256
|
-
case
|
|
257
|
-
_context4.prev =
|
|
258
|
-
|
|
257
|
+
case 4:
|
|
258
|
+
_context4.prev = 4;
|
|
259
|
+
_t2 = _context4["catch"](0);
|
|
259
260
|
return _context4.abrupt("return", undefined);
|
|
260
|
-
case
|
|
261
|
+
case 5:
|
|
261
262
|
case "end":
|
|
262
263
|
return _context4.stop();
|
|
263
264
|
}
|
|
264
|
-
}, _callee4, this, [[0,
|
|
265
|
+
}, _callee4, this, [[0, 4]]);
|
|
265
266
|
}));
|
|
266
267
|
function getWorkspaceExistsWithType(_x2) {
|
|
267
268
|
return _getWorkspaceExistsWithType.apply(this, arguments);
|
|
@@ -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.6");
|
|
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.6");
|
|
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:
|