@atlaskit/profilecard 24.19.0 → 24.20.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +18 -21
  2. package/dist/cjs/client/RovoAgentCardClient.js +201 -33
  3. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
  4. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  5. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +55 -34
  6. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +55 -33
  7. package/dist/cjs/mocks/agent-data.js +7 -1
  8. package/dist/cjs/mocks/simple-mock-clients.js +8 -3
  9. package/dist/cjs/util/analytics.js +2 -2
  10. package/dist/es2019/client/RovoAgentCardClient.js +135 -9
  11. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
  12. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  13. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +26 -3
  14. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +26 -3
  15. package/dist/es2019/mocks/agent-data.js +6 -0
  16. package/dist/es2019/mocks/simple-mock-clients.js +6 -3
  17. package/dist/es2019/util/analytics.js +2 -2
  18. package/dist/esm/client/RovoAgentCardClient.js +202 -34
  19. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
  20. package/dist/esm/client/getTeamFromAGG.js +1 -1
  21. package/dist/esm/components/Agent/AgentProfileCardResourced.js +55 -34
  22. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +55 -33
  23. package/dist/esm/mocks/agent-data.js +6 -0
  24. package/dist/esm/mocks/simple-mock-clients.js +6 -3
  25. package/dist/esm/util/analytics.js +2 -2
  26. package/dist/types/client/ProfileCardClient.d.ts +1 -1
  27. package/dist/types/client/RovoAgentCardClient.d.ts +14 -4
  28. package/dist/types/mocks/agent-data.d.ts +2 -1
  29. package/dist/types/mocks/simple-mock-clients.d.ts +2 -2
  30. package/dist/types/types.d.ts +11 -1
  31. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +1 -1
  32. package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +14 -4
  33. package/dist/types-ts4.5/mocks/agent-data.d.ts +2 -1
  34. package/dist/types-ts4.5/mocks/simple-mock-clients.d.ts +2 -2
  35. package/dist/types-ts4.5/types.d.ts +11 -1
  36. package/package.json +10 -7
@@ -30,7 +30,16 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
30
30
  fireEvent(createAnalyticsEvent, payload);
31
31
  }
32
32
  }, [createAnalyticsEvent]);
33
- const getCreator = async (creator_type, creator) => {
33
+
34
+ /**
35
+ * @TODO replace with `getAgentCreator` from `@atlassian/rovo-agent-components`
36
+ * @deprecated use `getAgentCreator` from `@atlassian/rovo-agent-components`
37
+ */
38
+ const getCreator = async ({
39
+ creator_type,
40
+ creator,
41
+ authoringTeam
42
+ }) => {
34
43
  if (!creator) {
35
44
  return undefined;
36
45
  }
@@ -55,6 +64,14 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
55
64
  if (!userId || !cloudId) {
56
65
  return undefined;
57
66
  }
67
+ if (authoringTeam && fg('agent_studio_permissions_settings_m3_profiles')) {
68
+ var _authoringTeam$displa, _authoringTeam$profil;
69
+ return {
70
+ type: 'CUSTOMER',
71
+ name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
72
+ profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
73
+ };
74
+ }
58
75
  const {
59
76
  href: profileHref
60
77
  } = navigateToTeamsApp({
@@ -79,11 +96,17 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
79
96
  }
80
97
  };
81
98
  const fetchAgentProfile = async () => {
82
- const agentInfo = await resourceClient.getRovoAgentProfile({
99
+ var _agentProfileResult$a, _agentProfileResult$a2;
100
+ const agentProfileResult = await resourceClient.getRovoAgentProfile({
83
101
  type: 'agent',
84
102
  value: userId
85
103
  }, fireAnalytics, fireEventNext);
86
- const agentCreatorInfo = await getCreator(agentInfo.creator_type, agentInfo.creator || undefined);
104
+ const agentInfo = agentProfileResult.restData;
105
+ const agentCreatorInfo = await getCreator({
106
+ creator_type: agentInfo.creator_type,
107
+ creator: agentInfo.creator || undefined,
108
+ 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
109
+ });
87
110
  return {
88
111
  ...agentInfo,
89
112
  creatorInfo: agentCreatorInfo
@@ -11,4 +11,10 @@ const agentData = {
11
11
  user_defined_conversation_starters: [],
12
12
  deactivated: false
13
13
  };
14
+ export const agentAggData = {
15
+ authoringTeam: {
16
+ displayName: 'Profile card agent',
17
+ profileUrl: 'https://example.com/profile'
18
+ }
19
+ };
14
20
  export default agentData;
@@ -2,7 +2,7 @@ import ProfileCardClient from '../client/ProfileCardClient';
2
2
  import RovoAgentCardClient from '../client/RovoAgentCardClient';
3
3
  import TeamProfileCardClient from '../client/TeamProfileCardClient';
4
4
  import UserProfileCardClient from '../client/UserProfileCardClient';
5
- import agentData from './agent-data';
5
+ import agentData, { agentAggData } from './agent-data';
6
6
  import profiles from './profile-data';
7
7
  import teamData from './team-data';
8
8
  import { getTimeString, getWeekday } from './util';
@@ -31,8 +31,11 @@ class SimpleMockUserClient extends UserProfileCardClient {
31
31
  }
32
32
  }
33
33
  class SimpleMockAgentClient extends RovoAgentCardClient {
34
- makeRequest(id, cloudId) {
35
- return Promise.resolve(agentData);
34
+ makeRequest(id) {
35
+ return Promise.resolve({
36
+ restData: agentData,
37
+ aggData: agentAggData
38
+ });
36
39
  }
37
40
  }
38
41
  const args = {
@@ -4,7 +4,7 @@ import { getPageTime } from './performance';
4
4
  const ANALYTICS_CHANNEL = 'peopleTeams';
5
5
  export const PACKAGE_META_DATA = {
6
6
  packageName: "@atlaskit/profilecard",
7
- packageVersion: "24.18.1"
7
+ packageVersion: "24.20.0"
8
8
  };
9
9
  const runItLater = cb => {
10
10
  const requestIdleCallback = window.requestIdleCallback;
@@ -45,7 +45,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
45
45
  actionSubjectId,
46
46
  attributes: {
47
47
  packageName: "@atlaskit/profilecard",
48
- packageVersion: "24.18.1",
48
+ packageVersion: "24.20.0",
49
49
  ...attributes,
50
50
  firedAt: Math.round(getPageTime())
51
51
  }
@@ -1,13 +1,14 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
5
  import _createClass from "@babel/runtime/helpers/createClass";
5
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
8
  import _inherits from "@babel/runtime/helpers/inherits";
8
- import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  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
10
  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
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
12
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
13
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
14
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -15,6 +16,33 @@ import { agentRequestAnalytics, PACKAGE_META_DATA } from '../util/analytics';
15
16
  import { getPageTime } from '../util/performance';
16
17
  import CachingClient from './CachingClient';
17
18
  import { DEPRECATED_getErrorAttributes, getErrorAttributes } from './errorUtils';
19
+ import { AGGQuery } from './graphqlUtils';
20
+ var buildActivationIdQuery = function buildActivationIdQuery(cloudId, product) {
21
+ return {
22
+ 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",
23
+ variables: {
24
+ cloudId: cloudId,
25
+ product: product
26
+ }
27
+ };
28
+ };
29
+ var buildRovoAgentQueryByAri = function buildRovoAgentQueryByAri(agentAri) {
30
+ return {
31
+ query: "\n\t query RovoAgentProfileCard_AgentQueryByAri($agentAri: ID!) {\n\t\t\tagentStudio_agentById(id: $agentAri) @optIn(to: \"AgentStudio\") {\n\t\t\t __typename\n\t\t\t\t... on AgentStudioAssistant {\n\t\t\t\t\tauthoringTeam {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t... on QueryError {\n\t\t\t\t\tmessage\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t",
32
+ variables: {
33
+ agentAri: agentAri
34
+ }
35
+ };
36
+ };
37
+ var buildRovoAgentQueryByAccountId = function buildRovoAgentQueryByAccountId(identityAccountId, cloudId) {
38
+ return {
39
+ query: "\n\t\tquery RovoAgentProfileCard_AgentQueryByAccountId($identityAccountId: ID!, $cloudId: ID!) {\n\t\t\tagentStudio_agentByIdentityAccountId(identityAccountId: $identityAccountId, cloudId: $cloudId) @optIn(to: \"AgentStudio\") {\n\t\t\t __typename\n\t\t\t\t... on AgentStudioAssistant {\n\t\t\t\t\tauthoringTeam {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\tprofileUrl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t... on QueryError {\n\t\t\t\t\tmessage\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t",
40
+ variables: {
41
+ identityAccountId: identityAccountId,
42
+ cloudId: cloudId
43
+ }
44
+ };
45
+ };
18
46
  var createHeaders = function createHeaders(product, cloudId, isBodyJson) {
19
47
  var headers = new Headers({
20
48
  'X-Product': product,
@@ -40,13 +68,111 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
40
68
  value: function basePath() {
41
69
  return fg('pt-deprecate-assistance-service') ? '/gateway/api/assist/rovo/v1/agents' : '/gateway/api/assist/agents/v1';
42
70
  }
71
+ }, {
72
+ key: "getActivationId",
73
+ value: function () {
74
+ var _getActivationId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(cloudId, product) {
75
+ var _response$tenantConte, _response$tenantConte2;
76
+ var response;
77
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
78
+ while (1) switch (_context.prev = _context.next) {
79
+ case 0:
80
+ _context.next = 2;
81
+ return AGGQuery('/gateway/api/graphql', buildActivationIdQuery(cloudId, product));
82
+ case 2:
83
+ response = _context.sent;
84
+ return _context.abrupt("return", (_response$tenantConte = response === null || response === void 0 || (_response$tenantConte2 = response.tenantContexts) === null || _response$tenantConte2 === void 0 || (_response$tenantConte2 = _response$tenantConte2[0]) === null || _response$tenantConte2 === void 0 || (_response$tenantConte2 = _response$tenantConte2.activationIdByProduct) === null || _response$tenantConte2 === void 0 ? void 0 : _response$tenantConte2.active) !== null && _response$tenantConte !== void 0 ? _response$tenantConte : null);
85
+ case 4:
86
+ case "end":
87
+ return _context.stop();
88
+ }
89
+ }, _callee);
90
+ }));
91
+ function getActivationId(_x, _x2) {
92
+ return _getActivationId.apply(this, arguments);
93
+ }
94
+ return getActivationId;
95
+ }()
96
+ }, {
97
+ key: "getAgentByARIAgg",
98
+ value: function () {
99
+ var _getAgentByARIAgg = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(agentAri) {
100
+ var _response$agentStudio;
101
+ var response;
102
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
103
+ while (1) switch (_context2.prev = _context2.next) {
104
+ case 0:
105
+ _context2.next = 2;
106
+ return AGGQuery('/gateway/api/graphql', buildRovoAgentQueryByAri(agentAri));
107
+ case 2:
108
+ response = _context2.sent;
109
+ if (!(((_response$agentStudio = response.agentStudio_agentById) === null || _response$agentStudio === void 0 ? void 0 : _response$agentStudio.__typename) === 'QueryError')) {
110
+ _context2.next = 5;
111
+ break;
112
+ }
113
+ throw new Error("ProfileCard agentStudio_agentById returning QueryError: ".concat(response.agentStudio_agentById.message));
114
+ case 5:
115
+ return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.agentStudio_agentById);
116
+ case 6:
117
+ case "end":
118
+ return _context2.stop();
119
+ }
120
+ }, _callee2);
121
+ }));
122
+ function getAgentByARIAgg(_x3) {
123
+ return _getAgentByARIAgg.apply(this, arguments);
124
+ }
125
+ return getAgentByARIAgg;
126
+ }()
127
+ }, {
128
+ key: "getAgentByAccountIdAgg",
129
+ value: function () {
130
+ var _getAgentByAccountIdAgg = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(identityAccountId, cloudId) {
131
+ var _response$agentStudio2;
132
+ var response;
133
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
134
+ while (1) switch (_context3.prev = _context3.next) {
135
+ case 0:
136
+ _context3.next = 2;
137
+ return AGGQuery('/gateway/api/graphql', buildRovoAgentQueryByAccountId(identityAccountId, cloudId));
138
+ case 2:
139
+ response = _context3.sent;
140
+ if (!(((_response$agentStudio2 = response.agentStudio_agentByIdentityAccountId) === null || _response$agentStudio2 === void 0 ? void 0 : _response$agentStudio2.__typename) === 'QueryError')) {
141
+ _context3.next = 5;
142
+ break;
143
+ }
144
+ throw new Error("ProfileCard agentStudio_agentByIdentityAccountId returning QueryError: ".concat(response.agentStudio_agentByIdentityAccountId.message));
145
+ case 5:
146
+ return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.agentStudio_agentByIdentityAccountId);
147
+ case 6:
148
+ case "end":
149
+ return _context3.stop();
150
+ }
151
+ }, _callee3);
152
+ }));
153
+ function getAgentByAccountIdAgg(_x4, _x5) {
154
+ return _getAgentByAccountIdAgg.apply(this, arguments);
155
+ }
156
+ return getAgentByAccountIdAgg;
157
+ }()
43
158
  }, {
44
159
  key: "makeRequest",
45
- value: function makeRequest(id, cloudId) {
160
+ value: function makeRequest(id, analyticsNext) {
161
+ var _this2 = this;
46
162
  var product = this.options.productIdentifier || 'rovo';
47
163
  var headers = createHeaders(product, this.options.cloudId);
164
+ var restPromise;
48
165
  if (id.type === 'identity') {
49
- return fetch(new Request("".concat(this.basePath(), "/accountid/").concat(id.value), {
166
+ restPromise = fetch(new Request("".concat(this.basePath(), "/accountid/").concat(id.value), {
167
+ method: 'GET',
168
+ credentials: 'include',
169
+ mode: 'cors',
170
+ headers: headers
171
+ })).then(function (response) {
172
+ return response.json();
173
+ });
174
+ } else {
175
+ restPromise = fetch(new Request("".concat(this.basePath(), "/").concat(id.value), {
50
176
  method: 'GET',
51
177
  credentials: 'include',
52
178
  mode: 'cors',
@@ -55,19 +181,61 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
55
181
  return response.json();
56
182
  });
57
183
  }
58
- return fetch(new Request("".concat(this.basePath(), "/").concat(id.value), {
59
- method: 'GET',
60
- credentials: 'include',
61
- mode: 'cors',
62
- headers: headers
63
- })).then(function (response) {
64
- return response.json();
184
+ if (!fg('agent_studio_permissions_settings_m3_profiles')) {
185
+ return restPromise.then(function (restData) {
186
+ return {
187
+ restData: restData,
188
+ aggData: null
189
+ };
190
+ });
191
+ }
192
+ var aggStartTime = getPageTime();
193
+ var aggPromise = this.getActivationId(this.options.cloudId || '', this.options.productIdentifier || 'rovo').then(function (activationId) {
194
+ if (!activationId) {
195
+ throw new Error('ProfileCard Activation ID not found');
196
+ }
197
+ if (id.type === 'identity') {
198
+ return _this2.getAgentByAccountIdAgg(id.value, _this2.options.cloudId || '');
199
+ } else {
200
+ var agentAri = "ari:cloud:rovo::agent/activation/".concat(activationId, "/").concat(id.value);
201
+ return _this2.getAgentByARIAgg(agentAri);
202
+ }
203
+ })
204
+ // We are not going to break the flow if the AGG endpoint fails for now
205
+ // @TODO once all the data moved to AGG, we can remove this catch
206
+ .catch(function (error) {
207
+ if (analyticsNext) {
208
+ analyticsNext('operational.rovoAgentProfilecard.failed.request', _objectSpread(_objectSpread({}, getErrorAttributes(error)), {}, {
209
+ errorType: 'RovoAgentProfileCardAggError',
210
+ duration: getPageTime() - aggStartTime,
211
+ gateway: true,
212
+ firedAt: Math.round(getPageTime())
213
+ }, PACKAGE_META_DATA));
214
+ }
215
+ return Promise.resolve(null);
216
+ });
217
+ return Promise.all([restPromise, aggPromise]).then(function (_ref) {
218
+ var _ref2 = _slicedToArray(_ref, 2),
219
+ restData = _ref2[0],
220
+ aggData = _ref2[1];
221
+ return {
222
+ restData: restData,
223
+ aggData: aggData
224
+ };
65
225
  });
66
226
  }
227
+
228
+ /**
229
+ * This function will call both REST and AGG endpoints to get the agent profile
230
+ * There are some data that is only available in the AGG endpoint, so we need to call both
231
+ * For any new fields, please only add them to the AGG endpoint
232
+ *
233
+ * @TODO migrate everything to AGG endpoint
234
+ */
67
235
  }, {
68
236
  key: "getProfile",
69
237
  value: function getProfile(id, analytics, analyticsNext) {
70
- var _this2 = this;
238
+ var _this3 = this;
71
239
  if (!id.value) {
72
240
  return Promise.reject(new Error('Id is missing'));
73
241
  }
@@ -91,9 +259,9 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
91
259
  analytics(agentRequestAnalytics('triggered'));
92
260
  }
93
261
  }
94
- _this2.makeRequest(id, _this2.options.cloudId || '').then(function (data) {
95
- if (_this2.cache) {
96
- _this2.setCachedProfile(id.value, data);
262
+ _this3.makeRequest(id, analyticsNext).then(function (data) {
263
+ if (_this3.cache) {
264
+ _this3.setCachedProfile(id.value, data);
97
265
  }
98
266
  if (fg('ptc-enable-profile-card-analytics-refactor')) {
99
267
  if (analyticsNext) {
@@ -138,13 +306,13 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
138
306
  }, {
139
307
  key: "deleteAgent",
140
308
  value: function deleteAgent(agentId, analytics, analyticsNext) {
141
- var _this3 = this;
309
+ var _this4 = this;
142
310
  if (!this.options.cloudId) {
143
311
  return Promise.reject(new Error('cloudId is missing'));
144
312
  }
145
313
  return new Promise(function (resolve, reject) {
146
314
  var startTime = getPageTime();
147
- var product = _this3.options.productIdentifier || 'rovo';
315
+ var product = _this4.options.productIdentifier || 'rovo';
148
316
  if (fg('ptc-enable-profile-card-analytics-refactor')) {
149
317
  if (analyticsNext) {
150
318
  analyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
@@ -156,8 +324,8 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
156
324
  analytics(agentRequestAnalytics('triggered'));
157
325
  }
158
326
  }
159
- var headers = createHeaders(product, _this3.options.cloudId);
160
- fetch(new Request("".concat(_this3.basePath(), "/").concat(agentId), {
327
+ var headers = createHeaders(product, _this4.options.cloudId);
328
+ fetch(new Request("".concat(_this4.basePath(), "/").concat(agentId), {
161
329
  method: 'DELETE',
162
330
  credentials: 'include',
163
331
  mode: 'cors',
@@ -206,18 +374,18 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
206
374
  }, {
207
375
  key: "setFavouriteAgent",
208
376
  value: function setFavouriteAgent(agentId, isFavourite, analytics, analyticsNext) {
209
- var _this4 = this;
377
+ var _this5 = this;
210
378
  if (!this.options.cloudId) {
211
379
  return Promise.reject(new Error('cloudId is missing'));
212
380
  }
213
381
  return new Promise( /*#__PURE__*/function () {
214
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve, reject) {
382
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(resolve, reject) {
215
383
  var startTime, product, actionSubjectId, requestMethod, headers;
216
- return _regeneratorRuntime.wrap(function _callee$(_context) {
217
- while (1) switch (_context.prev = _context.next) {
384
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
385
+ while (1) switch (_context4.prev = _context4.next) {
218
386
  case 0:
219
387
  startTime = getPageTime();
220
- product = _this4.options.productIdentifier || 'rovo';
388
+ product = _this5.options.productIdentifier || 'rovo';
221
389
  actionSubjectId = isFavourite ? 'favourite' : 'unfavourite';
222
390
  requestMethod = isFavourite ? 'POST' : 'DELETE';
223
391
  if (fg('ptc-enable-profile-card-analytics-refactor')) {
@@ -231,9 +399,9 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
231
399
  analytics(agentRequestAnalytics('triggered', 'actionSubjectId'));
232
400
  }
233
401
  }
234
- headers = createHeaders(product, _this4.options.cloudId);
235
- _context.next = 8;
236
- return fetch(new Request("".concat(_this4.basePath(), "/").concat(agentId, "/favourite"), {
402
+ headers = createHeaders(product, _this5.options.cloudId);
403
+ _context4.next = 8;
404
+ return fetch(new Request("".concat(_this5.basePath(), "/").concat(agentId, "/favourite"), {
237
405
  method: requestMethod,
238
406
  credentials: 'include',
239
407
  mode: 'cors',
@@ -279,25 +447,25 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
279
447
  });
280
448
  case 8:
281
449
  case "end":
282
- return _context.stop();
450
+ return _context4.stop();
283
451
  }
284
- }, _callee);
452
+ }, _callee4);
285
453
  }));
286
- return function (_x, _x2) {
287
- return _ref.apply(this, arguments);
454
+ return function (_x6, _x7) {
455
+ return _ref3.apply(this, arguments);
288
456
  };
289
457
  }());
290
458
  }
291
459
  }, {
292
460
  key: "getPermissions",
293
461
  value: function getPermissions(id, fireAnalytics, fireAnalyticsNext) {
294
- var _this5 = this;
462
+ var _this6 = this;
295
463
  if (!this.options.cloudId) {
296
464
  return Promise.reject(new Error('cloudId is missing'));
297
465
  }
298
466
  return new Promise(function (resolve, reject) {
299
467
  var startTime = getPageTime();
300
- var product = _this5.options.productIdentifier || 'rovo';
468
+ var product = _this6.options.productIdentifier || 'rovo';
301
469
  if (fg('ptc-enable-profile-card-analytics-refactor')) {
302
470
  if (fireAnalyticsNext) {
303
471
  fireAnalyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
@@ -309,7 +477,7 @@ var RovoAgentCardClient = /*#__PURE__*/function (_CachingClient) {
309
477
  fireAnalytics(agentRequestAnalytics('triggered'));
310
478
  }
311
479
  }
312
- var headers = createHeaders(product, _this5.options.cloudId, true);
480
+ var headers = createHeaders(product, _this6.options.cloudId, true);
313
481
  fetch(new Request("/gateway/api/assist/api/rovo/v2/permissions/agents/".concat(id), {
314
482
  method: 'POST',
315
483
  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', "24.18.1");
7
+ headers.append('atl-client-version', "24.20.0");
8
8
  return headers;
9
9
  };
10
10
  export function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -59,7 +59,7 @@ export var addHeaders = function addHeaders(headers) {
59
59
  headers.append('X-ExperimentalApi', 'teams-beta');
60
60
  headers.append('X-ExperimentalApi', 'team-members-beta');
61
61
  headers.append('atl-client-name', "@atlaskit/profilecard");
62
- headers.append('atl-client-version', "24.18.1");
62
+ headers.append('atl-client-version', "24.20.0");
63
63
  return headers;
64
64
  };
65
65
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -47,41 +47,57 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
47
47
  cloudId: props.cloudId
48
48
  }),
49
49
  profileHref = _navigateToTeamsApp.href;
50
+
51
+ /**
52
+ * @TODO replace with `getAgentCreator` from `@atlassian/rovo-agent-components`
53
+ * @deprecated use `getAgentCreator` from `@atlassian/rovo-agent-components`
54
+ */
50
55
  var getCreator = useCallback( /*#__PURE__*/function () {
51
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(creator_type, creator) {
52
- var creatorInfo;
56
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
57
+ var creator_type, creator, authoringTeam, _authoringTeam$displa, _authoringTeam$profil, creatorInfo;
53
58
  return _regeneratorRuntime.wrap(function _callee$(_context) {
54
59
  while (1) switch (_context.prev = _context.next) {
55
60
  case 0:
61
+ creator_type = _ref.creator_type, creator = _ref.creator, authoringTeam = _ref.authoringTeam;
56
62
  if (creator) {
57
- _context.next = 2;
63
+ _context.next = 3;
58
64
  break;
59
65
  }
60
66
  return _context.abrupt("return", undefined);
61
- case 2:
67
+ case 3:
62
68
  _context.t0 = creator_type;
63
- _context.next = _context.t0 === 'SYSTEM' ? 5 : _context.t0 === 'THIRD_PARTY' ? 6 : _context.t0 === 'CUSTOMER' ? 7 : 19;
69
+ _context.next = _context.t0 === 'SYSTEM' ? 6 : _context.t0 === 'THIRD_PARTY' ? 7 : _context.t0 === 'CUSTOMER' ? 8 : 22;
64
70
  break;
65
- case 5:
71
+ case 6:
66
72
  return _context.abrupt("return", {
67
73
  type: 'SYSTEM'
68
74
  });
69
- case 6:
75
+ case 7:
70
76
  return _context.abrupt("return", {
71
77
  type: 'THIRD_PARTY',
72
78
  name: creator !== null && creator !== void 0 ? creator : ''
73
79
  });
74
- case 7:
75
- _context.prev = 7;
80
+ case 8:
81
+ _context.prev = 8;
76
82
  if (!(!creatorUserId || !props.cloudId)) {
77
- _context.next = 10;
83
+ _context.next = 11;
78
84
  break;
79
85
  }
80
86
  return _context.abrupt("return", undefined);
81
- case 10:
82
- _context.next = 12;
87
+ case 11:
88
+ if (!(authoringTeam && fg('agent_studio_permissions_settings_m3_profiles'))) {
89
+ _context.next = 13;
90
+ break;
91
+ }
92
+ return _context.abrupt("return", {
93
+ type: 'CUSTOMER',
94
+ name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
95
+ profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
96
+ });
97
+ case 13:
98
+ _context.next = 15;
83
99
  return props.resourceClient.getProfile(creatorUserId, props.cloudId, fireAnalytics, fireEventNext);
84
- case 12:
100
+ case 15:
85
101
  creatorInfo = _context.sent;
86
102
  return _context.abrupt("return", {
87
103
  type: 'CUSTOMER',
@@ -89,24 +105,24 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
89
105
  profileLink: fg('platform-adopt-teams-nav-config') ? profileHref : "/people/".concat(creatorUserId),
90
106
  id: creatorUserId
91
107
  });
92
- case 16:
93
- _context.prev = 16;
94
- _context.t1 = _context["catch"](7);
95
- return _context.abrupt("return", undefined);
96
108
  case 19:
109
+ _context.prev = 19;
110
+ _context.t1 = _context["catch"](8);
111
+ return _context.abrupt("return", undefined);
112
+ case 22:
97
113
  return _context.abrupt("return", undefined);
98
- case 20:
114
+ case 23:
99
115
  case "end":
100
116
  return _context.stop();
101
117
  }
102
- }, _callee, null, [[7, 16]]);
118
+ }, _callee, null, [[8, 19]]);
103
119
  }));
104
- return function (_x, _x2) {
105
- return _ref.apply(this, arguments);
120
+ return function (_x) {
121
+ return _ref2.apply(this, arguments);
106
122
  };
107
123
  }(), [creatorUserId, fireAnalytics, fireEventNext, props.cloudId, props.resourceClient, profileHref]);
108
124
  var fetchData = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
109
- var profileData, agentCreatorInfo;
125
+ var _profileResult$aggDat, _profileResult$aggDat2, profileResult, profileData, agentCreatorInfo;
110
126
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
111
127
  while (1) switch (_context2.prev = _context2.next) {
112
128
  case 0:
@@ -118,29 +134,34 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
118
134
  value: props.accountId
119
135
  }, fireAnalytics, fireEventNext);
120
136
  case 4:
121
- profileData = _context2.sent;
122
- _context2.next = 7;
123
- return getCreator(profileData === null || profileData === void 0 ? void 0 : profileData.creator_type, (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined);
124
- case 7:
137
+ profileResult = _context2.sent;
138
+ profileData = profileResult.restData;
139
+ _context2.next = 8;
140
+ return getCreator({
141
+ creator_type: profileData === null || profileData === void 0 ? void 0 : profileData.creator_type,
142
+ creator: (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined,
143
+ 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
144
+ });
145
+ case 8:
125
146
  agentCreatorInfo = _context2.sent;
126
147
  setAgentData(_objectSpread(_objectSpread({}, profileData), {}, {
127
148
  creatorInfo: agentCreatorInfo
128
149
  }));
129
- _context2.next = 14;
150
+ _context2.next = 15;
130
151
  break;
131
- case 11:
132
- _context2.prev = 11;
152
+ case 12:
153
+ _context2.prev = 12;
133
154
  _context2.t0 = _context2["catch"](1);
134
155
  setError(_context2.t0);
135
- case 14:
136
- _context2.prev = 14;
156
+ case 15:
157
+ _context2.prev = 15;
137
158
  setIsLoading(false);
138
- return _context2.finish(14);
139
- case 17:
159
+ return _context2.finish(15);
160
+ case 18:
140
161
  case "end":
141
162
  return _context2.stop();
142
163
  }
143
- }, _callee2, null, [[1, 11, 14, 17]]);
164
+ }, _callee2, null, [[1, 12, 15, 18]]);
144
165
  })), [fireAnalytics, fireEventNext, getCreator, props.accountId, props.resourceClient]);
145
166
  useEffect(function () {
146
167
  fetchData();