@atlaskit/profilecard 24.19.0 → 24.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  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 +50 -34
  6. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +50 -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 +21 -3
  14. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +21 -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 +50 -34
  22. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +50 -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 +8 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 24.20.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c4c9dfedf66a9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4c9dfedf66a9) -
8
+ Introduce agg query to agent profile card, refactor code to handle both REST and GraphQL agg type;
9
+ Implement authoring team to be shown if exist
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 24.19.0
4
16
 
5
17
  ### Minor Changes
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
14
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
@@ -18,10 +19,37 @@ var _analytics = require("../util/analytics");
18
19
  var _performance = require("../util/performance");
19
20
  var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
20
21
  var _errorUtils = require("./errorUtils");
22
+ var _graphqlUtils = require("./graphqlUtils");
21
23
  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; }
22
24
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
25
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
24
26
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
27
+ var buildActivationIdQuery = function buildActivationIdQuery(cloudId, product) {
28
+ return {
29
+ 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",
30
+ variables: {
31
+ cloudId: cloudId,
32
+ product: product
33
+ }
34
+ };
35
+ };
36
+ var buildRovoAgentQueryByAri = function buildRovoAgentQueryByAri(agentAri) {
37
+ return {
38
+ 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",
39
+ variables: {
40
+ agentAri: agentAri
41
+ }
42
+ };
43
+ };
44
+ var buildRovoAgentQueryByAccountId = function buildRovoAgentQueryByAccountId(identityAccountId, cloudId) {
45
+ return {
46
+ 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",
47
+ variables: {
48
+ identityAccountId: identityAccountId,
49
+ cloudId: cloudId
50
+ }
51
+ };
52
+ };
25
53
  var createHeaders = function createHeaders(product, cloudId, isBodyJson) {
26
54
  var headers = new Headers({
27
55
  'X-Product': product,
@@ -47,13 +75,102 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
47
75
  value: function basePath() {
48
76
  return (0, _platformFeatureFlags.fg)('pt-deprecate-assistance-service') ? '/gateway/api/assist/rovo/v1/agents' : '/gateway/api/assist/agents/v1';
49
77
  }
78
+ }, {
79
+ key: "getActivationId",
80
+ value: function () {
81
+ var _getActivationId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(cloudId, product) {
82
+ var _response$tenantConte, _response$tenantConte2;
83
+ var response;
84
+ return _regenerator.default.wrap(function _callee$(_context) {
85
+ while (1) switch (_context.prev = _context.next) {
86
+ case 0:
87
+ _context.next = 2;
88
+ return (0, _graphqlUtils.AGGQuery)('/gateway/api/graphql', buildActivationIdQuery(cloudId, product));
89
+ case 2:
90
+ response = _context.sent;
91
+ 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);
92
+ case 4:
93
+ case "end":
94
+ return _context.stop();
95
+ }
96
+ }, _callee);
97
+ }));
98
+ function getActivationId(_x, _x2) {
99
+ return _getActivationId.apply(this, arguments);
100
+ }
101
+ return getActivationId;
102
+ }()
103
+ }, {
104
+ key: "getAgentByARIAgg",
105
+ value: function () {
106
+ var _getAgentByARIAgg = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(agentAri) {
107
+ var _response$agentStudio;
108
+ var response;
109
+ return _regenerator.default.wrap(function _callee2$(_context2) {
110
+ while (1) switch (_context2.prev = _context2.next) {
111
+ case 0:
112
+ _context2.next = 2;
113
+ return (0, _graphqlUtils.AGGQuery)('/gateway/api/graphql', buildRovoAgentQueryByAri(agentAri));
114
+ case 2:
115
+ response = _context2.sent;
116
+ if (!(((_response$agentStudio = response.agentStudio_agentById) === null || _response$agentStudio === void 0 ? void 0 : _response$agentStudio.__typename) === 'QueryError')) {
117
+ _context2.next = 5;
118
+ break;
119
+ }
120
+ throw new Error("ProfileCard agentStudio_agentById returning QueryError: ".concat(response.agentStudio_agentById.message));
121
+ case 5:
122
+ return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.agentStudio_agentById);
123
+ case 6:
124
+ case "end":
125
+ return _context2.stop();
126
+ }
127
+ }, _callee2);
128
+ }));
129
+ function getAgentByARIAgg(_x3) {
130
+ return _getAgentByARIAgg.apply(this, arguments);
131
+ }
132
+ return getAgentByARIAgg;
133
+ }()
134
+ }, {
135
+ key: "getAgentByAccountIdAgg",
136
+ value: function () {
137
+ var _getAgentByAccountIdAgg = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(identityAccountId, cloudId) {
138
+ var _response$agentStudio2;
139
+ var response;
140
+ return _regenerator.default.wrap(function _callee3$(_context3) {
141
+ while (1) switch (_context3.prev = _context3.next) {
142
+ case 0:
143
+ _context3.next = 2;
144
+ return (0, _graphqlUtils.AGGQuery)('/gateway/api/graphql', buildRovoAgentQueryByAccountId(identityAccountId, cloudId));
145
+ case 2:
146
+ response = _context3.sent;
147
+ if (!(((_response$agentStudio2 = response.agentStudio_agentByIdentityAccountId) === null || _response$agentStudio2 === void 0 ? void 0 : _response$agentStudio2.__typename) === 'QueryError')) {
148
+ _context3.next = 5;
149
+ break;
150
+ }
151
+ throw new Error("ProfileCard agentStudio_agentByIdentityAccountId returning QueryError: ".concat(response.agentStudio_agentByIdentityAccountId.message));
152
+ case 5:
153
+ return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.agentStudio_agentByIdentityAccountId);
154
+ case 6:
155
+ case "end":
156
+ return _context3.stop();
157
+ }
158
+ }, _callee3);
159
+ }));
160
+ function getAgentByAccountIdAgg(_x4, _x5) {
161
+ return _getAgentByAccountIdAgg.apply(this, arguments);
162
+ }
163
+ return getAgentByAccountIdAgg;
164
+ }()
50
165
  }, {
51
166
  key: "makeRequest",
52
- value: function makeRequest(id, cloudId) {
167
+ value: function makeRequest(id, analyticsNext) {
168
+ var _this2 = this;
53
169
  var product = this.options.productIdentifier || 'rovo';
54
170
  var headers = createHeaders(product, this.options.cloudId);
171
+ var restPromise;
55
172
  if (id.type === 'identity') {
56
- return fetch(new Request("".concat(this.basePath(), "/accountid/").concat(id.value), {
173
+ restPromise = fetch(new Request("".concat(this.basePath(), "/accountid/").concat(id.value), {
57
174
  method: 'GET',
58
175
  credentials: 'include',
59
176
  mode: 'cors',
@@ -61,20 +178,71 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
61
178
  })).then(function (response) {
62
179
  return response.json();
63
180
  });
181
+ } else {
182
+ restPromise = fetch(new Request("".concat(this.basePath(), "/").concat(id.value), {
183
+ method: 'GET',
184
+ credentials: 'include',
185
+ mode: 'cors',
186
+ headers: headers
187
+ })).then(function (response) {
188
+ return response.json();
189
+ });
190
+ }
191
+ if (!(0, _platformFeatureFlags.fg)('agent_studio_permissions_settings_m3_profiles')) {
192
+ return restPromise.then(function (restData) {
193
+ return {
194
+ restData: restData,
195
+ aggData: null
196
+ };
197
+ });
64
198
  }
65
- return fetch(new Request("".concat(this.basePath(), "/").concat(id.value), {
66
- method: 'GET',
67
- credentials: 'include',
68
- mode: 'cors',
69
- headers: headers
70
- })).then(function (response) {
71
- return response.json();
199
+ var aggStartTime = (0, _performance.getPageTime)();
200
+ var aggPromise = this.getActivationId(this.options.cloudId || '', this.options.productIdentifier || 'rovo').then(function (activationId) {
201
+ if (!activationId) {
202
+ throw new Error('ProfileCard Activation ID not found');
203
+ }
204
+ if (id.type === 'identity') {
205
+ return _this2.getAgentByAccountIdAgg(id.value, _this2.options.cloudId || '');
206
+ } else {
207
+ var agentAri = "ari:cloud:rovo::agent/activation/".concat(activationId, "/").concat(id.value);
208
+ return _this2.getAgentByARIAgg(agentAri);
209
+ }
210
+ })
211
+ // We are not going to break the flow if the AGG endpoint fails for now
212
+ // @TODO once all the data moved to AGG, we can remove this catch
213
+ .catch(function (error) {
214
+ if (analyticsNext) {
215
+ analyticsNext('operational.rovoAgentProfilecard.failed.request', _objectSpread(_objectSpread({}, (0, _errorUtils.getErrorAttributes)(error)), {}, {
216
+ errorType: 'RovoAgentProfileCardAggError',
217
+ duration: (0, _performance.getPageTime)() - aggStartTime,
218
+ gateway: true,
219
+ firedAt: Math.round((0, _performance.getPageTime)())
220
+ }, _analytics.PACKAGE_META_DATA));
221
+ }
222
+ return Promise.resolve(null);
223
+ });
224
+ return Promise.all([restPromise, aggPromise]).then(function (_ref) {
225
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
226
+ restData = _ref2[0],
227
+ aggData = _ref2[1];
228
+ return {
229
+ restData: restData,
230
+ aggData: aggData
231
+ };
72
232
  });
73
233
  }
234
+
235
+ /**
236
+ * This function will call both REST and AGG endpoints to get the agent profile
237
+ * There are some data that is only available in the AGG endpoint, so we need to call both
238
+ * For any new fields, please only add them to the AGG endpoint
239
+ *
240
+ * @TODO migrate everything to AGG endpoint
241
+ */
74
242
  }, {
75
243
  key: "getProfile",
76
244
  value: function getProfile(id, analytics, analyticsNext) {
77
- var _this2 = this;
245
+ var _this3 = this;
78
246
  if (!id.value) {
79
247
  return Promise.reject(new Error('Id is missing'));
80
248
  }
@@ -98,9 +266,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
98
266
  analytics((0, _analytics.agentRequestAnalytics)('triggered'));
99
267
  }
100
268
  }
101
- _this2.makeRequest(id, _this2.options.cloudId || '').then(function (data) {
102
- if (_this2.cache) {
103
- _this2.setCachedProfile(id.value, data);
269
+ _this3.makeRequest(id, analyticsNext).then(function (data) {
270
+ if (_this3.cache) {
271
+ _this3.setCachedProfile(id.value, data);
104
272
  }
105
273
  if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
106
274
  if (analyticsNext) {
@@ -145,13 +313,13 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
145
313
  }, {
146
314
  key: "deleteAgent",
147
315
  value: function deleteAgent(agentId, analytics, analyticsNext) {
148
- var _this3 = this;
316
+ var _this4 = this;
149
317
  if (!this.options.cloudId) {
150
318
  return Promise.reject(new Error('cloudId is missing'));
151
319
  }
152
320
  return new Promise(function (resolve, reject) {
153
321
  var startTime = (0, _performance.getPageTime)();
154
- var product = _this3.options.productIdentifier || 'rovo';
322
+ var product = _this4.options.productIdentifier || 'rovo';
155
323
  if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
156
324
  if (analyticsNext) {
157
325
  analyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
@@ -163,8 +331,8 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
163
331
  analytics((0, _analytics.agentRequestAnalytics)('triggered'));
164
332
  }
165
333
  }
166
- var headers = createHeaders(product, _this3.options.cloudId);
167
- fetch(new Request("".concat(_this3.basePath(), "/").concat(agentId), {
334
+ var headers = createHeaders(product, _this4.options.cloudId);
335
+ fetch(new Request("".concat(_this4.basePath(), "/").concat(agentId), {
168
336
  method: 'DELETE',
169
337
  credentials: 'include',
170
338
  mode: 'cors',
@@ -213,18 +381,18 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
213
381
  }, {
214
382
  key: "setFavouriteAgent",
215
383
  value: function setFavouriteAgent(agentId, isFavourite, analytics, analyticsNext) {
216
- var _this4 = this;
384
+ var _this5 = this;
217
385
  if (!this.options.cloudId) {
218
386
  return Promise.reject(new Error('cloudId is missing'));
219
387
  }
220
388
  return new Promise( /*#__PURE__*/function () {
221
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
389
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resolve, reject) {
222
390
  var startTime, product, actionSubjectId, requestMethod, headers;
223
- return _regenerator.default.wrap(function _callee$(_context) {
224
- while (1) switch (_context.prev = _context.next) {
391
+ return _regenerator.default.wrap(function _callee4$(_context4) {
392
+ while (1) switch (_context4.prev = _context4.next) {
225
393
  case 0:
226
394
  startTime = (0, _performance.getPageTime)();
227
- product = _this4.options.productIdentifier || 'rovo';
395
+ product = _this5.options.productIdentifier || 'rovo';
228
396
  actionSubjectId = isFavourite ? 'favourite' : 'unfavourite';
229
397
  requestMethod = isFavourite ? 'POST' : 'DELETE';
230
398
  if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
@@ -238,9 +406,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
238
406
  analytics((0, _analytics.agentRequestAnalytics)('triggered', 'actionSubjectId'));
239
407
  }
240
408
  }
241
- headers = createHeaders(product, _this4.options.cloudId);
242
- _context.next = 8;
243
- return fetch(new Request("".concat(_this4.basePath(), "/").concat(agentId, "/favourite"), {
409
+ headers = createHeaders(product, _this5.options.cloudId);
410
+ _context4.next = 8;
411
+ return fetch(new Request("".concat(_this5.basePath(), "/").concat(agentId, "/favourite"), {
244
412
  method: requestMethod,
245
413
  credentials: 'include',
246
414
  mode: 'cors',
@@ -286,25 +454,25 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
286
454
  });
287
455
  case 8:
288
456
  case "end":
289
- return _context.stop();
457
+ return _context4.stop();
290
458
  }
291
- }, _callee);
459
+ }, _callee4);
292
460
  }));
293
- return function (_x, _x2) {
294
- return _ref.apply(this, arguments);
461
+ return function (_x6, _x7) {
462
+ return _ref3.apply(this, arguments);
295
463
  };
296
464
  }());
297
465
  }
298
466
  }, {
299
467
  key: "getPermissions",
300
468
  value: function getPermissions(id, fireAnalytics, fireAnalyticsNext) {
301
- var _this5 = this;
469
+ var _this6 = this;
302
470
  if (!this.options.cloudId) {
303
471
  return Promise.reject(new Error('cloudId is missing'));
304
472
  }
305
473
  return new Promise(function (resolve, reject) {
306
474
  var startTime = (0, _performance.getPageTime)();
307
- var product = _this5.options.productIdentifier || 'rovo';
475
+ var product = _this6.options.productIdentifier || 'rovo';
308
476
  if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
309
477
  if (fireAnalyticsNext) {
310
478
  fireAnalyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
@@ -316,7 +484,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
316
484
  fireAnalytics((0, _analytics.agentRequestAnalytics)('triggered'));
317
485
  }
318
486
  }
319
- var headers = createHeaders(product, _this5.options.cloudId, true);
487
+ var headers = createHeaders(product, _this6.options.cloudId, true);
320
488
  fetch(new Request("/gateway/api/assist/api/rovo/v2/permissions/agents/".concat(id), {
321
489
  method: 'POST',
322
490
  credentials: 'include',
@@ -11,7 +11,7 @@ var _graphqlUtils = require("./graphqlUtils");
11
11
  var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
12
12
  var addHeaders = function addHeaders(headers) {
13
13
  headers.append('atl-client-name', "@atlaskit/profilecard");
14
- headers.append('atl-client-version', "24.18.1");
14
+ headers.append('atl-client-version', "24.19.0");
15
15
  return headers;
16
16
  };
17
17
  function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -66,7 +66,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
66
66
  headers.append('X-ExperimentalApi', 'teams-beta');
67
67
  headers.append('X-ExperimentalApi', 'team-members-beta');
68
68
  headers.append('atl-client-name', "@atlaskit/profilecard");
69
- headers.append('atl-client-version', "24.18.1");
69
+ headers.append('atl-client-version', "24.19.0");
70
70
  return headers;
71
71
  };
72
72
  function getTeamFromAGG(_x, _x2, _x3) {
@@ -57,40 +57,51 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
57
57
  }),
58
58
  profileHref = _navigateToTeamsApp.href;
59
59
  var getCreator = (0, _react.useCallback)( /*#__PURE__*/function () {
60
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(creator_type, creator) {
61
- var creatorInfo;
60
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
61
+ var creator_type, creator, authoringTeam, _authoringTeam$displa, _authoringTeam$profil, creatorInfo;
62
62
  return _regenerator.default.wrap(function _callee$(_context) {
63
63
  while (1) switch (_context.prev = _context.next) {
64
64
  case 0:
65
+ creator_type = _ref.creator_type, creator = _ref.creator, authoringTeam = _ref.authoringTeam;
65
66
  if (creator) {
66
- _context.next = 2;
67
+ _context.next = 3;
67
68
  break;
68
69
  }
69
70
  return _context.abrupt("return", undefined);
70
- case 2:
71
+ case 3:
71
72
  _context.t0 = creator_type;
72
- _context.next = _context.t0 === 'SYSTEM' ? 5 : _context.t0 === 'THIRD_PARTY' ? 6 : _context.t0 === 'CUSTOMER' ? 7 : 19;
73
+ _context.next = _context.t0 === 'SYSTEM' ? 6 : _context.t0 === 'THIRD_PARTY' ? 7 : _context.t0 === 'CUSTOMER' ? 8 : 22;
73
74
  break;
74
- case 5:
75
+ case 6:
75
76
  return _context.abrupt("return", {
76
77
  type: 'SYSTEM'
77
78
  });
78
- case 6:
79
+ case 7:
79
80
  return _context.abrupt("return", {
80
81
  type: 'THIRD_PARTY',
81
82
  name: creator !== null && creator !== void 0 ? creator : ''
82
83
  });
83
- case 7:
84
- _context.prev = 7;
84
+ case 8:
85
+ _context.prev = 8;
85
86
  if (!(!creatorUserId || !props.cloudId)) {
86
- _context.next = 10;
87
+ _context.next = 11;
87
88
  break;
88
89
  }
89
90
  return _context.abrupt("return", undefined);
90
- case 10:
91
- _context.next = 12;
91
+ case 11:
92
+ if (!(authoringTeam && (0, _platformFeatureFlags.fg)('agent_studio_permissions_settings_m3_profiles'))) {
93
+ _context.next = 13;
94
+ break;
95
+ }
96
+ return _context.abrupt("return", {
97
+ type: 'CUSTOMER',
98
+ name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
99
+ profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
100
+ });
101
+ case 13:
102
+ _context.next = 15;
92
103
  return props.resourceClient.getProfile(creatorUserId, props.cloudId, fireAnalytics, fireEventNext);
93
- case 12:
104
+ case 15:
94
105
  creatorInfo = _context.sent;
95
106
  return _context.abrupt("return", {
96
107
  type: 'CUSTOMER',
@@ -98,24 +109,24 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
98
109
  profileLink: (0, _platformFeatureFlags.fg)('platform-adopt-teams-nav-config') ? profileHref : "/people/".concat(creatorUserId),
99
110
  id: creatorUserId
100
111
  });
101
- case 16:
102
- _context.prev = 16;
103
- _context.t1 = _context["catch"](7);
104
- return _context.abrupt("return", undefined);
105
112
  case 19:
113
+ _context.prev = 19;
114
+ _context.t1 = _context["catch"](8);
115
+ return _context.abrupt("return", undefined);
116
+ case 22:
106
117
  return _context.abrupt("return", undefined);
107
- case 20:
118
+ case 23:
108
119
  case "end":
109
120
  return _context.stop();
110
121
  }
111
- }, _callee, null, [[7, 16]]);
122
+ }, _callee, null, [[8, 19]]);
112
123
  }));
113
- return function (_x, _x2) {
114
- return _ref.apply(this, arguments);
124
+ return function (_x) {
125
+ return _ref2.apply(this, arguments);
115
126
  };
116
127
  }(), [creatorUserId, fireAnalytics, fireEventNext, props.cloudId, props.resourceClient, profileHref]);
117
128
  var fetchData = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
118
- var profileData, agentCreatorInfo;
129
+ var _profileResult$aggDat, _profileResult$aggDat2, profileResult, profileData, agentCreatorInfo;
119
130
  return _regenerator.default.wrap(function _callee2$(_context2) {
120
131
  while (1) switch (_context2.prev = _context2.next) {
121
132
  case 0:
@@ -127,29 +138,34 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
127
138
  value: props.accountId
128
139
  }, fireAnalytics, fireEventNext);
129
140
  case 4:
130
- profileData = _context2.sent;
131
- _context2.next = 7;
132
- return getCreator(profileData === null || profileData === void 0 ? void 0 : profileData.creator_type, (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined);
133
- case 7:
141
+ profileResult = _context2.sent;
142
+ profileData = profileResult.restData;
143
+ _context2.next = 8;
144
+ return getCreator({
145
+ creator_type: profileData === null || profileData === void 0 ? void 0 : profileData.creator_type,
146
+ creator: (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined,
147
+ 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
148
+ });
149
+ case 8:
134
150
  agentCreatorInfo = _context2.sent;
135
151
  setAgentData(_objectSpread(_objectSpread({}, profileData), {}, {
136
152
  creatorInfo: agentCreatorInfo
137
153
  }));
138
- _context2.next = 14;
154
+ _context2.next = 15;
139
155
  break;
140
- case 11:
141
- _context2.prev = 11;
156
+ case 12:
157
+ _context2.prev = 12;
142
158
  _context2.t0 = _context2["catch"](1);
143
159
  setError(_context2.t0);
144
- case 14:
145
- _context2.prev = 14;
160
+ case 15:
161
+ _context2.prev = 15;
146
162
  setIsLoading(false);
147
- return _context2.finish(14);
148
- case 17:
163
+ return _context2.finish(15);
164
+ case 18:
149
165
  case "end":
150
166
  return _context2.stop();
151
167
  }
152
- }, _callee2, null, [[1, 11, 14, 17]]);
168
+ }, _callee2, null, [[1, 12, 15, 18]]);
153
169
  })), [fireAnalytics, fireEventNext, getCreator, props.accountId, props.resourceClient]);
154
170
  (0, _react.useEffect)(function () {
155
171
  fetchData();