@atlaskit/profilecard 20.6.1 → 20.7.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 (43) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/client/ProfileCardClient.js +32 -6
  3. package/dist/cjs/client/TeamCentralCardClient.js +28 -0
  4. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +56 -0
  5. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  6. package/dist/cjs/components/Agent/Actions.js +0 -1
  7. package/dist/cjs/components/Icon/IconLabel.js +5 -1
  8. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +7 -2
  9. package/dist/cjs/components/User/ProfileCardResourced.js +5 -2
  10. package/dist/cjs/components/User/ProfileCardTrigger.js +8 -3
  11. package/dist/cjs/mocks/mock-profile-client.js +2 -1
  12. package/dist/cjs/util/analytics.js +1 -1
  13. package/dist/es2019/client/ProfileCardClient.js +17 -3
  14. package/dist/es2019/client/TeamCentralCardClient.js +24 -0
  15. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +32 -0
  16. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  17. package/dist/es2019/components/Agent/Actions.js +0 -1
  18. package/dist/es2019/components/Icon/IconLabel.js +5 -1
  19. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +7 -2
  20. package/dist/es2019/components/User/ProfileCardResourced.js +5 -2
  21. package/dist/es2019/components/User/ProfileCardTrigger.js +8 -3
  22. package/dist/es2019/mocks/mock-profile-client.js +2 -1
  23. package/dist/es2019/util/analytics.js +1 -1
  24. package/dist/esm/client/ProfileCardClient.js +32 -6
  25. package/dist/esm/client/TeamCentralCardClient.js +28 -0
  26. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +49 -0
  27. package/dist/esm/client/getTeamFromAGG.js +1 -1
  28. package/dist/esm/components/Agent/Actions.js +0 -1
  29. package/dist/esm/components/Icon/IconLabel.js +5 -1
  30. package/dist/esm/components/Team/TeamProfileCardTrigger.js +7 -2
  31. package/dist/esm/components/User/ProfileCardResourced.js +5 -2
  32. package/dist/esm/components/User/ProfileCardTrigger.js +8 -3
  33. package/dist/esm/mocks/mock-profile-client.js +2 -1
  34. package/dist/esm/util/analytics.js +1 -1
  35. package/dist/types/client/ProfileCardClient.d.ts +5 -1
  36. package/dist/types/client/TeamCentralCardClient.d.ts +9 -0
  37. package/dist/types/client/getOrgIdForCloudIdFromAGG.d.ts +1 -0
  38. package/dist/types/types.d.ts +3 -2
  39. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -1
  40. package/dist/types-ts4.5/client/TeamCentralCardClient.d.ts +9 -0
  41. package/dist/types-ts4.5/client/getOrgIdForCloudIdFromAGG.d.ts +1 -0
  42. package/dist/types-ts4.5/types.d.ts +3 -2
  43. package/package.json +8 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 20.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#155340](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155340)
8
+ [`4d0a5f27783bc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4d0a5f27783bc) -
9
+ Add deep-linking for the creation of kudos, as well as for the project directory
10
+
11
+ ### Patch Changes
12
+
13
+ - [#154021](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154021)
14
+ [`6867203830e28`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6867203830e28) -
15
+ [ux] Fix Chat button padding in agent profile card
16
+ - Updated dependencies
17
+
18
+ ## 20.6.2
19
+
20
+ ### Patch Changes
21
+
22
+ - [#154451](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154451)
23
+ [`1a6038f97ae73`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1a6038f97ae73) -
24
+ A11Y-8044 Fix description list mark-up used inappropriately in profile card
25
+
3
26
  ## 20.6.1
4
27
 
5
28
  ### Patch Changes
@@ -32,7 +32,7 @@ var ProfileCardClient = /*#__PURE__*/function () {
32
32
  this.userClient = (clients === null || clients === void 0 ? void 0 : clients.userClient) || new _UserProfileCardClient.default(withDefaultConfig);
33
33
  this.teamClient = (clients === null || clients === void 0 ? void 0 : clients.teamClient) || new _TeamProfileCardClient.default(withDefaultConfig);
34
34
  this.rovoAgentClient = (clients === null || clients === void 0 ? void 0 : clients.rovoAgentClient) || new _RovoAgentCardClient.default(withDefaultConfig);
35
- this.tcClient = maybeCreateTeamCentralClient(config, clients);
35
+ this.tcClient = maybeCreateTeamCentralClient(withDefaultConfig, clients);
36
36
  }
37
37
  (0, _createClass2.default)(ProfileCardClient, [{
38
38
  key: "flushCache",
@@ -65,8 +65,8 @@ var ProfileCardClient = /*#__PURE__*/function () {
65
65
  }, {
66
66
  key: "getTeamCentralBaseUrl",
67
67
  value: function () {
68
- var _getTeamCentralBaseUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
69
- var _this$tcClient3, isGlobalExperienceWorkspace;
68
+ var _getTeamCentralBaseUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(teamCentralScopes) {
69
+ var _this$tcClient3, isGlobalExperienceWorkspace, suffix, orgId;
70
70
  return _regenerator.default.wrap(function _callee$(_context) {
71
71
  while (1) switch (_context.prev = _context.next) {
72
72
  case 0:
@@ -86,14 +86,40 @@ var ProfileCardClient = /*#__PURE__*/function () {
86
86
  return this.tcClient.getIsGlobalExperienceWorkspace();
87
87
  case 6:
88
88
  isGlobalExperienceWorkspace = _context.sent;
89
- return _context.abrupt("return", Promise.resolve(isGlobalExperienceWorkspace ? (0, _atlassianContext.getATLContextUrl)('home') : (0, _atlassianContext.getATLContextUrl)('team')));
90
- case 8:
89
+ if (isGlobalExperienceWorkspace) {
90
+ _context.next = 9;
91
+ break;
92
+ }
93
+ return _context.abrupt("return", Promise.resolve((0, _atlassianContext.getATLContextUrl)('team')));
94
+ case 9:
95
+ suffix = '';
96
+ if (!(teamCentralScopes !== undefined)) {
97
+ _context.next = 18;
98
+ break;
99
+ }
100
+ _context.next = 13;
101
+ return this.tcClient.getOrgId();
102
+ case 13:
103
+ orgId = _context.sent;
104
+ if (!(orgId === null)) {
105
+ _context.next = 16;
106
+ break;
107
+ }
108
+ return _context.abrupt("return", Promise.resolve(undefined));
109
+ case 16:
110
+ suffix += "/o/".concat(orgId);
111
+ if (teamCentralScopes.withSiteContext) {
112
+ suffix += "/s/".concat(this.tcClient.options.cloudId);
113
+ }
114
+ case 18:
115
+ return _context.abrupt("return", Promise.resolve("".concat((0, _atlassianContext.getATLContextUrl)('home')).concat(suffix)));
116
+ case 19:
91
117
  case "end":
92
118
  return _context.stop();
93
119
  }
94
120
  }, _callee, this);
95
121
  }));
96
- function getTeamCentralBaseUrl() {
122
+ function getTeamCentralBaseUrl(_x) {
97
123
  return _getTeamCentralBaseUrl.apply(this, arguments);
98
124
  }
99
125
  return getTeamCentralBaseUrl;
@@ -14,6 +14,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
16
  var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
17
+ var _getOrgIdForCloudIdFromAGG = require("./getOrgIdForCloudIdFromAGG");
17
18
  var _graphqlUtils = require("./graphqlUtils");
18
19
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
19
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
@@ -27,6 +28,7 @@ var buildReportingLinesQuery = exports.buildReportingLinesQuery = function build
27
28
  };
28
29
  var isTCReadyPromiseMap = new Map();
29
30
  var globalExperiencePromiseCache = new Map();
31
+ var orgIdPromiseCache = new Map();
30
32
  var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
31
33
  (0, _inherits2.default)(TeamCentralCardClient, _CachingClient);
32
34
  var _super = _createSuper(TeamCentralCardClient);
@@ -47,6 +49,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
47
49
  _this.bypassOnFailure = false;
48
50
  _this.isTCReadyPromise = _this.createTcReadyPromise(options);
49
51
  _this.isGlobalExperienceWorkspacePromise = _this.preloadIsGlobalExperienceWorkspace(options.cloudId);
52
+ _this.orgIdPromise = _this.preloadOrgId(options.gatewayGraphqlUrl, options.cloudId, options.orgId);
50
53
  return _this;
51
54
  }
52
55
  (0, _createClass2.default)(TeamCentralCardClient, [{
@@ -182,6 +185,11 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
182
185
  value: function getIsGlobalExperienceWorkspace() {
183
186
  return this.isGlobalExperienceWorkspacePromise;
184
187
  }
188
+ }, {
189
+ key: "getOrgId",
190
+ value: function getOrgId() {
191
+ return this.orgIdPromise;
192
+ }
185
193
  }, {
186
194
  key: "preloadIsGlobalExperienceWorkspace",
187
195
  value: function preloadIsGlobalExperienceWorkspace(cloudId) {
@@ -253,6 +261,26 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
253
261
  }
254
262
  return isGlobalExperienceWorkspaceForCloudId;
255
263
  }()
264
+ }, {
265
+ key: "preloadOrgId",
266
+ value: function preloadOrgId(gatewayGraphqlUrl, cloudId, orgId) {
267
+ if (!(0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls')) {
268
+ return Promise.resolve(null);
269
+ }
270
+ if (cloudId === undefined) {
271
+ return Promise.resolve(null);
272
+ }
273
+ if (orgId !== undefined) {
274
+ return Promise.resolve(orgId);
275
+ }
276
+ var maybeOrgIdForCloudIdPromise = orgIdPromiseCache.get(cloudId);
277
+ if (maybeOrgIdForCloudIdPromise !== undefined) {
278
+ return maybeOrgIdForCloudIdPromise;
279
+ }
280
+ var orgIdForCloudIdPromise = (0, _getOrgIdForCloudIdFromAGG.getOrgIdForCloudIdFromAGG)(gatewayGraphqlUrl, cloudId);
281
+ orgIdPromiseCache.set(cloudId, orgIdForCloudIdPromise);
282
+ return orgIdForCloudIdPromise;
283
+ }
256
284
  }, {
257
285
  key: "getMaybeShardedApiPath",
258
286
  value: function getMaybeShardedApiPath(cloudId) {
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getOrgIdForCloudIdFromAGG = getOrgIdForCloudIdFromAGG;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _graphqlUtils = require("./graphqlUtils");
11
+ var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
12
+ var addHeaders = function addHeaders(headers) {
13
+ headers.append('atl-client-name', "@atlaskit/profilecard");
14
+ headers.append('atl-client-version', "20.7.0");
15
+ return headers;
16
+ };
17
+ function getOrgIdForCloudIdFromAGG(_x, _x2) {
18
+ return _getOrgIdForCloudIdFromAGG.apply(this, arguments);
19
+ }
20
+ function _getOrgIdForCloudIdFromAGG() {
21
+ _getOrgIdForCloudIdFromAGG = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, cloudId) {
22
+ var query, _yield$AGGQuery, tenantContexts;
23
+ return _regenerator.default.wrap(function _callee$(_context) {
24
+ while (1) switch (_context.prev = _context.next) {
25
+ case 0:
26
+ query = {
27
+ query: ORG_ID_FROM_CLOUD_ID_QUERY,
28
+ variables: {
29
+ cloudId: cloudId
30
+ }
31
+ };
32
+ _context.prev = 1;
33
+ _context.next = 4;
34
+ return (0, _graphqlUtils.AGGQuery)(url, query, addHeaders);
35
+ case 4:
36
+ _yield$AGGQuery = _context.sent;
37
+ tenantContexts = _yield$AGGQuery.tenantContexts;
38
+ if (!(!tenantContexts || tenantContexts.length === 0 || tenantContexts[0] === null)) {
39
+ _context.next = 8;
40
+ break;
41
+ }
42
+ return _context.abrupt("return", null);
43
+ case 8:
44
+ return _context.abrupt("return", tenantContexts[0].orgId);
45
+ case 11:
46
+ _context.prev = 11;
47
+ _context.t0 = _context["catch"](1);
48
+ return _context.abrupt("return", null);
49
+ case 14:
50
+ case "end":
51
+ return _context.stop();
52
+ }
53
+ }, _callee, null, [[1, 11]]);
54
+ }));
55
+ return _getOrgIdForCloudIdFromAGG.apply(this, arguments);
56
+ }
@@ -57,7 +57,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
57
57
  headers.append('X-ExperimentalApi', 'teams-beta');
58
58
  headers.append('X-ExperimentalApi', 'team-members-beta');
59
59
  headers.append('atl-client-name', "@atlaskit/profilecard");
60
- headers.append('atl-client-version', "20.6.1");
60
+ headers.append('atl-client-version', "20.7.0");
61
61
  return headers;
62
62
  };
63
63
  function getTeamFromAGG(_x, _x2, _x3) {
@@ -27,7 +27,6 @@ var chatToAgentButtonWrapper = (0, _primitives.xcss)({
27
27
  display: 'flex',
28
28
  justifyContent: 'center',
29
29
  lineHeight: '20px',
30
- padding: 'space.075',
31
30
  fontWeight: '500'
32
31
  });
33
32
  var chatPillButtonInlineStyles = (0, _primitives.xcss)({
@@ -46,7 +46,11 @@ var IconLabel = exports.default = /*#__PURE__*/function (_React$PureComponent) {
46
46
  LEGACY_size: "small",
47
47
  color: "currentColor"
48
48
  }) : null;
49
- return /*#__PURE__*/_react.default.createElement(_Card.DetailsLabel, null, /*#__PURE__*/_react.default.createElement(_Card.DetailsLabelIcon, null, displayIcon), /*#__PURE__*/_react.default.createElement(_Card.DetailsLabelText, null, this.props.children));
49
+ return /*#__PURE__*/_react.default.createElement(_Card.DetailsLabel, null, /*#__PURE__*/_react.default.createElement(_Card.DetailsLabelIcon, {
50
+ as: "dt"
51
+ }, displayIcon), /*#__PURE__*/_react.default.createElement(_Card.DetailsLabelText, {
52
+ as: "dd"
53
+ }, this.props.children));
50
54
  }
51
55
  }]);
52
56
  return IconLabel;
@@ -186,7 +186,10 @@ var TeamProfileCardTriggerInternal = exports.TeamProfileCardTriggerInternal = /*
186
186
  var fireEvent = function fireEvent(event) {
187
187
  _this.fireAnalytics(event);
188
188
  };
189
- var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl()]);
189
+ var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl({
190
+ withOrgContext: true,
191
+ withSiteContext: true
192
+ })]);
190
193
  requests.then(function (res) {
191
194
  var _this2;
192
195
  return (_this2 = _this).handleClientSuccess.apply(_this2, (0, _toConsumableArray2.default)(res));
@@ -369,7 +372,9 @@ var TeamProfileCardTriggerInternal = exports.TeamProfileCardTriggerInternal = /*
369
372
  return _this4.renderTrigger(triggerProps);
370
373
  },
371
374
  zIndex: _constants.layers.modal(),
372
- shouldFlip: true,
375
+ shouldFlip: true
376
+ // eslint-disable-next-line jsx-a11y/no-autofocus
377
+ ,
373
378
  autoFocus: this.props.trigger !== 'hover' && !this.openedByHover,
374
379
  shouldRenderToParent: (0, _platformFeatureFlags.fg)('enable_appropriate_reading_order_in_profile_card')
375
380
  }));
@@ -75,7 +75,10 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
75
75
  hasError: false,
76
76
  data: null
77
77
  }, function () {
78
- var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl()]);
78
+ var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl({
79
+ withOrgContext: true,
80
+ withSiteContext: true
81
+ })]);
79
82
  requests.then(function (res) {
80
83
  var _this2;
81
84
  return (_this2 = _this).handleClientSuccess.apply(_this2, (0, _toConsumableArray2.default)(res));
@@ -196,7 +199,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
196
199
  teamCentralBaseUrl: teamCentralBaseUrl,
197
200
  openKudosDrawer: this.openKudosDrawer
198
201
  });
199
- return /*#__PURE__*/_react.default.createElement(_Card.CardWrapper, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isKudosEnabled && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
202
+ return /*#__PURE__*/_react.default.createElement(_Card.CardWrapper, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isKudosEnabled && newProps.teamCentralBaseUrl && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
200
203
  fallback: null
201
204
  }, /*#__PURE__*/_react.default.createElement(_giveKudos.GiveKudosLauncherLazy, {
202
205
  isOpen: this.state.kudosDrawerOpen,
@@ -226,7 +226,10 @@ function ProfilecardTriggerNext(_ref2) {
226
226
  setError(null);
227
227
  setData(null);
228
228
  _context.prev = 6;
229
- requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl()]);
229
+ requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
230
+ withOrgContext: true,
231
+ withSiteContext: true
232
+ })]);
230
233
  _context.next = 10;
231
234
  return requests;
232
235
  case 10:
@@ -378,9 +381,11 @@ function ProfilecardTriggerNext(_ref2) {
378
381
  }), children);
379
382
  },
380
383
  zIndex: _constants.layers.modal(),
381
- shouldUseCaptureOnOutsideClick: true,
384
+ shouldUseCaptureOnOutsideClick: true
385
+ // eslint-disable-next-line jsx-a11y/no-autofocus
386
+ ,
382
387
  autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click'
383
- }), shouldShowGiveKudos && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
388
+ }), shouldShowGiveKudos && teamCentralBaseUrl && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
384
389
  fallback: null
385
390
  }, /*#__PURE__*/_react.default.createElement(_giveKudos.GiveKudosLauncherLazy, {
386
391
  isOpen: kudosDrawerOpen,
@@ -101,7 +101,8 @@ function getMockProfileClient(BaseProfileClient, modifyResponse) {
101
101
  return _super3.call(this, options, _objectSpread({
102
102
  userClient: new MockUserClient(options),
103
103
  teamCentralClient: new MockTeamCentralClient(_objectSpread(_objectSpread({}, options), {}, {
104
- teamCentralUrl: 'defaultTeamCentralUrl'
104
+ teamCentralUrl: 'defaultTeamCentralUrl',
105
+ gatewayGraphqlUrl: 'defaultGatewayGraphqlUrl'
105
106
  }))
106
107
  }, clients));
107
108
  }
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
45
45
  actionSubjectId: actionSubjectId,
46
46
  attributes: _objectSpread(_objectSpread({
47
47
  packageName: "@atlaskit/profilecard",
48
- packageVersion: "20.6.1"
48
+ packageVersion: "20.7.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: Math.round((0, _performance.getPageTime)())
51
51
  })
@@ -21,7 +21,7 @@ class ProfileCardClient {
21
21
  this.userClient = (clients === null || clients === void 0 ? void 0 : clients.userClient) || new UserProfileCardClient(withDefaultConfig);
22
22
  this.teamClient = (clients === null || clients === void 0 ? void 0 : clients.teamClient) || new TeamProfileCardClient(withDefaultConfig);
23
23
  this.rovoAgentClient = (clients === null || clients === void 0 ? void 0 : clients.rovoAgentClient) || new RovoAgentCardClient(withDefaultConfig);
24
- this.tcClient = maybeCreateTeamCentralClient(config, clients);
24
+ this.tcClient = maybeCreateTeamCentralClient(withDefaultConfig, clients);
25
25
  }
26
26
  flushCache() {
27
27
  var _this$tcClient, _this$rovoAgentClient;
@@ -43,7 +43,7 @@ class ProfileCardClient {
43
43
  reports: []
44
44
  });
45
45
  }
46
- async getTeamCentralBaseUrl() {
46
+ async getTeamCentralBaseUrl(teamCentralScopes) {
47
47
  if (!fg('enable_ptc_sharded_townsquare_calls')) {
48
48
  var _this$tcClient3;
49
49
  return Promise.resolve((_this$tcClient3 = this.tcClient) === null || _this$tcClient3 === void 0 ? void 0 : _this$tcClient3.options.teamCentralBaseUrl);
@@ -52,7 +52,21 @@ class ProfileCardClient {
52
52
  return Promise.resolve(undefined);
53
53
  }
54
54
  const isGlobalExperienceWorkspace = await this.tcClient.getIsGlobalExperienceWorkspace();
55
- return Promise.resolve(isGlobalExperienceWorkspace ? getATLContextUrl('home') : getATLContextUrl('team'));
55
+ if (!isGlobalExperienceWorkspace) {
56
+ return Promise.resolve(getATLContextUrl('team'));
57
+ }
58
+ let suffix = '';
59
+ if (teamCentralScopes !== undefined) {
60
+ const orgId = await this.tcClient.getOrgId();
61
+ if (orgId === null) {
62
+ return Promise.resolve(undefined);
63
+ }
64
+ suffix += `/o/${orgId}`;
65
+ if (teamCentralScopes.withSiteContext) {
66
+ suffix += `/s/${this.tcClient.options.cloudId}`;
67
+ }
68
+ }
69
+ return Promise.resolve(`${getATLContextUrl('home')}${suffix}`);
56
70
  }
57
71
  async shouldShowGiveKudos() {
58
72
  if (!this.tcClient || !(await this.getTeamCentralBaseUrl())) {
@@ -1,5 +1,6 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
2
  import CachingClient from './CachingClient';
3
+ import { getOrgIdForCloudIdFromAGG } from './getOrgIdForCloudIdFromAGG';
3
4
  import { directoryGraphqlQuery } from './graphqlUtils';
4
5
  export const buildReportingLinesQuery = aaid => ({
5
6
  query: `
@@ -33,6 +34,7 @@ export const buildReportingLinesQuery = aaid => ({
33
34
  });
34
35
  let isTCReadyPromiseMap = new Map();
35
36
  const globalExperiencePromiseCache = new Map();
37
+ const orgIdPromiseCache = new Map();
36
38
  class TeamCentralCardClient extends CachingClient {
37
39
  /**
38
40
  * Simple circuit breaker to avoid making unnecessary calls to Team Central on auth failures
@@ -49,6 +51,7 @@ class TeamCentralCardClient extends CachingClient {
49
51
  this.bypassOnFailure = false;
50
52
  this.isTCReadyPromise = this.createTcReadyPromise(options);
51
53
  this.isGlobalExperienceWorkspacePromise = this.preloadIsGlobalExperienceWorkspace(options.cloudId);
54
+ this.orgIdPromise = this.preloadOrgId(options.gatewayGraphqlUrl, options.cloudId, options.orgId);
52
55
  }
53
56
  createTcReadyPromise(config) {
54
57
  if (config.cloudId) {
@@ -139,6 +142,9 @@ class TeamCentralCardClient extends CachingClient {
139
142
  getIsGlobalExperienceWorkspace() {
140
143
  return this.isGlobalExperienceWorkspacePromise;
141
144
  }
145
+ getOrgId() {
146
+ return this.orgIdPromise;
147
+ }
142
148
  preloadIsGlobalExperienceWorkspace(cloudId) {
143
149
  if (!fg('enable_ptc_sharded_townsquare_calls')) {
144
150
  return Promise.resolve(false);
@@ -179,6 +185,24 @@ class TeamCentralCardClient extends CachingClient {
179
185
  return Promise.resolve(false);
180
186
  }
181
187
  }
188
+ preloadOrgId(gatewayGraphqlUrl, cloudId, orgId) {
189
+ if (!fg('enable_ptc_sharded_townsquare_calls')) {
190
+ return Promise.resolve(null);
191
+ }
192
+ if (cloudId === undefined) {
193
+ return Promise.resolve(null);
194
+ }
195
+ if (orgId !== undefined) {
196
+ return Promise.resolve(orgId);
197
+ }
198
+ const maybeOrgIdForCloudIdPromise = orgIdPromiseCache.get(cloudId);
199
+ if (maybeOrgIdForCloudIdPromise !== undefined) {
200
+ return maybeOrgIdForCloudIdPromise;
201
+ }
202
+ const orgIdForCloudIdPromise = getOrgIdForCloudIdFromAGG(gatewayGraphqlUrl, cloudId);
203
+ orgIdPromiseCache.set(cloudId, orgIdForCloudIdPromise);
204
+ return orgIdForCloudIdPromise;
205
+ }
182
206
  getMaybeShardedApiPath(cloudId) {
183
207
  const maybeShardedPath = fg('enable_ptc_sharded_townsquare_calls') ? `/townsquare/s/${cloudId}` : '/watermelon';
184
208
  return `/gateway/api${maybeShardedPath}`;
@@ -0,0 +1,32 @@
1
+ import { AGGQuery } from './graphqlUtils';
2
+ const ORG_ID_FROM_CLOUD_ID_QUERY = `query OrgIdFromCloudId($cloudId: ID!) {
3
+ tenantContexts(cloudIds: [$cloudId]) {
4
+ orgId
5
+ }
6
+ }`;
7
+ const addHeaders = headers => {
8
+ headers.append('atl-client-name', "@atlaskit/profilecard");
9
+ headers.append('atl-client-version', "20.7.0");
10
+ return headers;
11
+ };
12
+ export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
13
+ const query = {
14
+ query: ORG_ID_FROM_CLOUD_ID_QUERY,
15
+ variables: {
16
+ cloudId
17
+ }
18
+ };
19
+ try {
20
+ const {
21
+ tenantContexts
22
+ } = await AGGQuery(url, query, addHeaders);
23
+ if (!tenantContexts || tenantContexts.length === 0 || tenantContexts[0] === null) {
24
+ return null;
25
+ }
26
+ return tenantContexts[0].orgId;
27
+ } catch (err) {
28
+ // don't bubble up the error, and let consumers handle it as if the cloud ID
29
+ // doesn't resolve to an org ID
30
+ return null;
31
+ }
32
+ }
@@ -67,7 +67,7 @@ export const addHeaders = headers => {
67
67
  headers.append('X-ExperimentalApi', 'teams-beta');
68
68
  headers.append('X-ExperimentalApi', 'team-members-beta');
69
69
  headers.append('atl-client-name', "@atlaskit/profilecard");
70
- headers.append('atl-client-version', "20.6.1");
70
+ headers.append('atl-client-version', "20.7.0");
71
71
  return headers;
72
72
  };
73
73
  export async function getTeamFromAGG(url, teamId, siteId) {
@@ -14,7 +14,6 @@ const chatToAgentButtonWrapper = xcss({
14
14
  display: 'flex',
15
15
  justifyContent: 'center',
16
16
  lineHeight: '20px',
17
- padding: 'space.075',
18
17
  fontWeight: '500'
19
18
  });
20
19
  const chatPillButtonInlineStyles = xcss({
@@ -24,7 +24,11 @@ export default class IconLabel extends React.PureComponent {
24
24
  LEGACY_size: "small",
25
25
  color: "currentColor"
26
26
  }) : null;
27
- return /*#__PURE__*/React.createElement(DetailsLabel, null, /*#__PURE__*/React.createElement(DetailsLabelIcon, null, displayIcon), /*#__PURE__*/React.createElement(DetailsLabelText, null, this.props.children));
27
+ return /*#__PURE__*/React.createElement(DetailsLabel, null, /*#__PURE__*/React.createElement(DetailsLabelIcon, {
28
+ as: "dt"
29
+ }, displayIcon), /*#__PURE__*/React.createElement(DetailsLabelText, {
30
+ as: "dd"
31
+ }, this.props.children));
28
32
  }
29
33
  }
30
34
  _defineProperty(IconLabel, "defaultProps", {
@@ -161,7 +161,10 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
161
161
  const fireEvent = event => {
162
162
  this.fireAnalytics(event);
163
163
  };
164
- const requests = Promise.all([this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl()]);
164
+ const requests = Promise.all([this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl({
165
+ withOrgContext: true,
166
+ withSiteContext: true
167
+ })]);
165
168
  requests.then(res => this.handleClientSuccess(...res), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
166
169
  });
167
170
  });
@@ -324,7 +327,9 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
324
327
  content: this.renderProfileCard,
325
328
  trigger: triggerProps => this.renderTrigger(triggerProps),
326
329
  zIndex: layers.modal(),
327
- shouldFlip: true,
330
+ shouldFlip: true
331
+ // eslint-disable-next-line jsx-a11y/no-autofocus
332
+ ,
328
333
  autoFocus: this.props.trigger !== 'hover' && !this.openedByHover,
329
334
  shouldRenderToParent: fg('enable_appropriate_reading_order_in_profile_card')
330
335
  }));
@@ -50,7 +50,10 @@ class ProfileCardResourced extends React.PureComponent {
50
50
  hasError: false,
51
51
  data: null
52
52
  }, () => {
53
- const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId, this.fireAnalytics), this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl()]);
53
+ const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId, this.fireAnalytics), this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl({
54
+ withOrgContext: true,
55
+ withSiteContext: true
56
+ })]);
54
57
  requests.then(res => this.handleClientSuccess(...res), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
55
58
  });
56
59
  });
@@ -152,7 +155,7 @@ class ProfileCardResourced extends React.PureComponent {
152
155
  teamCentralBaseUrl,
153
156
  openKudosDrawer: this.openKudosDrawer
154
157
  };
155
- return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && /*#__PURE__*/React.createElement(Suspense, {
158
+ return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && newProps.teamCentralBaseUrl && /*#__PURE__*/React.createElement(Suspense, {
156
159
  fallback: null
157
160
  }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
158
161
  isOpen: this.state.kudosDrawerOpen,
@@ -171,7 +171,10 @@ export default function ProfilecardTriggerNext({
171
171
  setError(null);
172
172
  setData(null);
173
173
  try {
174
- const requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl()]);
174
+ const requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
175
+ withOrgContext: true,
176
+ withSiteContext: true
177
+ })]);
175
178
  const responses = await requests;
176
179
  handleClientSuccess(...responses);
177
180
  } catch (err) {
@@ -310,9 +313,11 @@ export default function ProfilecardTriggerNext({
310
313
  }), children);
311
314
  },
312
315
  zIndex: layers.modal(),
313
- shouldUseCaptureOnOutsideClick: true,
316
+ shouldUseCaptureOnOutsideClick: true
317
+ // eslint-disable-next-line jsx-a11y/no-autofocus
318
+ ,
314
319
  autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click'
315
- }), shouldShowGiveKudos && /*#__PURE__*/React.createElement(Suspense, {
320
+ }), shouldShowGiveKudos && teamCentralBaseUrl && /*#__PURE__*/React.createElement(Suspense, {
316
321
  fallback: null
317
322
  }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
318
323
  isOpen: kudosDrawerOpen,
@@ -61,7 +61,8 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
61
61
  userClient: new MockUserClient(options),
62
62
  teamCentralClient: new MockTeamCentralClient({
63
63
  ...options,
64
- teamCentralUrl: 'defaultTeamCentralUrl'
64
+ teamCentralUrl: 'defaultTeamCentralUrl',
65
+ gatewayGraphqlUrl: 'defaultGatewayGraphqlUrl'
65
66
  }),
66
67
  ...clients
67
68
  });
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
32
32
  actionSubjectId,
33
33
  attributes: {
34
34
  packageName: "@atlaskit/profilecard",
35
- packageVersion: "20.6.1",
35
+ packageVersion: "20.7.0",
36
36
  ...attributes,
37
37
  firedAt: Math.round(getPageTime())
38
38
  }
@@ -25,7 +25,7 @@ var ProfileCardClient = /*#__PURE__*/function () {
25
25
  this.userClient = (clients === null || clients === void 0 ? void 0 : clients.userClient) || new UserProfileCardClient(withDefaultConfig);
26
26
  this.teamClient = (clients === null || clients === void 0 ? void 0 : clients.teamClient) || new TeamProfileCardClient(withDefaultConfig);
27
27
  this.rovoAgentClient = (clients === null || clients === void 0 ? void 0 : clients.rovoAgentClient) || new RovoAgentCardClient(withDefaultConfig);
28
- this.tcClient = maybeCreateTeamCentralClient(config, clients);
28
+ this.tcClient = maybeCreateTeamCentralClient(withDefaultConfig, clients);
29
29
  }
30
30
  _createClass(ProfileCardClient, [{
31
31
  key: "flushCache",
@@ -58,8 +58,8 @@ var ProfileCardClient = /*#__PURE__*/function () {
58
58
  }, {
59
59
  key: "getTeamCentralBaseUrl",
60
60
  value: function () {
61
- var _getTeamCentralBaseUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
62
- var _this$tcClient3, isGlobalExperienceWorkspace;
61
+ var _getTeamCentralBaseUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(teamCentralScopes) {
62
+ var _this$tcClient3, isGlobalExperienceWorkspace, suffix, orgId;
63
63
  return _regeneratorRuntime.wrap(function _callee$(_context) {
64
64
  while (1) switch (_context.prev = _context.next) {
65
65
  case 0:
@@ -79,14 +79,40 @@ var ProfileCardClient = /*#__PURE__*/function () {
79
79
  return this.tcClient.getIsGlobalExperienceWorkspace();
80
80
  case 6:
81
81
  isGlobalExperienceWorkspace = _context.sent;
82
- return _context.abrupt("return", Promise.resolve(isGlobalExperienceWorkspace ? getATLContextUrl('home') : getATLContextUrl('team')));
83
- case 8:
82
+ if (isGlobalExperienceWorkspace) {
83
+ _context.next = 9;
84
+ break;
85
+ }
86
+ return _context.abrupt("return", Promise.resolve(getATLContextUrl('team')));
87
+ case 9:
88
+ suffix = '';
89
+ if (!(teamCentralScopes !== undefined)) {
90
+ _context.next = 18;
91
+ break;
92
+ }
93
+ _context.next = 13;
94
+ return this.tcClient.getOrgId();
95
+ case 13:
96
+ orgId = _context.sent;
97
+ if (!(orgId === null)) {
98
+ _context.next = 16;
99
+ break;
100
+ }
101
+ return _context.abrupt("return", Promise.resolve(undefined));
102
+ case 16:
103
+ suffix += "/o/".concat(orgId);
104
+ if (teamCentralScopes.withSiteContext) {
105
+ suffix += "/s/".concat(this.tcClient.options.cloudId);
106
+ }
107
+ case 18:
108
+ return _context.abrupt("return", Promise.resolve("".concat(getATLContextUrl('home')).concat(suffix)));
109
+ case 19:
84
110
  case "end":
85
111
  return _context.stop();
86
112
  }
87
113
  }, _callee, this);
88
114
  }));
89
- function getTeamCentralBaseUrl() {
115
+ function getTeamCentralBaseUrl(_x) {
90
116
  return _getTeamCentralBaseUrl.apply(this, arguments);
91
117
  }
92
118
  return getTeamCentralBaseUrl;
@@ -9,6 +9,7 @@ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
11
  import CachingClient from './CachingClient';
12
+ import { getOrgIdForCloudIdFromAGG } from './getOrgIdForCloudIdFromAGG';
12
13
  import { directoryGraphqlQuery } from './graphqlUtils';
13
14
  export var buildReportingLinesQuery = function buildReportingLinesQuery(aaid) {
14
15
  return {
@@ -20,6 +21,7 @@ export var buildReportingLinesQuery = function buildReportingLinesQuery(aaid) {
20
21
  };
21
22
  var isTCReadyPromiseMap = new Map();
22
23
  var globalExperiencePromiseCache = new Map();
24
+ var orgIdPromiseCache = new Map();
23
25
  var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
24
26
  _inherits(TeamCentralCardClient, _CachingClient);
25
27
  var _super = _createSuper(TeamCentralCardClient);
@@ -40,6 +42,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
40
42
  _this.bypassOnFailure = false;
41
43
  _this.isTCReadyPromise = _this.createTcReadyPromise(options);
42
44
  _this.isGlobalExperienceWorkspacePromise = _this.preloadIsGlobalExperienceWorkspace(options.cloudId);
45
+ _this.orgIdPromise = _this.preloadOrgId(options.gatewayGraphqlUrl, options.cloudId, options.orgId);
43
46
  return _this;
44
47
  }
45
48
  _createClass(TeamCentralCardClient, [{
@@ -175,6 +178,11 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
175
178
  value: function getIsGlobalExperienceWorkspace() {
176
179
  return this.isGlobalExperienceWorkspacePromise;
177
180
  }
181
+ }, {
182
+ key: "getOrgId",
183
+ value: function getOrgId() {
184
+ return this.orgIdPromise;
185
+ }
178
186
  }, {
179
187
  key: "preloadIsGlobalExperienceWorkspace",
180
188
  value: function preloadIsGlobalExperienceWorkspace(cloudId) {
@@ -246,6 +254,26 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
246
254
  }
247
255
  return isGlobalExperienceWorkspaceForCloudId;
248
256
  }()
257
+ }, {
258
+ key: "preloadOrgId",
259
+ value: function preloadOrgId(gatewayGraphqlUrl, cloudId, orgId) {
260
+ if (!fg('enable_ptc_sharded_townsquare_calls')) {
261
+ return Promise.resolve(null);
262
+ }
263
+ if (cloudId === undefined) {
264
+ return Promise.resolve(null);
265
+ }
266
+ if (orgId !== undefined) {
267
+ return Promise.resolve(orgId);
268
+ }
269
+ var maybeOrgIdForCloudIdPromise = orgIdPromiseCache.get(cloudId);
270
+ if (maybeOrgIdForCloudIdPromise !== undefined) {
271
+ return maybeOrgIdForCloudIdPromise;
272
+ }
273
+ var orgIdForCloudIdPromise = getOrgIdForCloudIdFromAGG(gatewayGraphqlUrl, cloudId);
274
+ orgIdPromiseCache.set(cloudId, orgIdForCloudIdPromise);
275
+ return orgIdForCloudIdPromise;
276
+ }
249
277
  }, {
250
278
  key: "getMaybeShardedApiPath",
251
279
  value: function getMaybeShardedApiPath(cloudId) {
@@ -0,0 +1,49 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { AGGQuery } from './graphqlUtils';
4
+ var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
5
+ var addHeaders = function addHeaders(headers) {
6
+ headers.append('atl-client-name', "@atlaskit/profilecard");
7
+ headers.append('atl-client-version', "20.7.0");
8
+ return headers;
9
+ };
10
+ export function getOrgIdForCloudIdFromAGG(_x, _x2) {
11
+ return _getOrgIdForCloudIdFromAGG.apply(this, arguments);
12
+ }
13
+ function _getOrgIdForCloudIdFromAGG() {
14
+ _getOrgIdForCloudIdFromAGG = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, cloudId) {
15
+ var query, _yield$AGGQuery, tenantContexts;
16
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
17
+ while (1) switch (_context.prev = _context.next) {
18
+ case 0:
19
+ query = {
20
+ query: ORG_ID_FROM_CLOUD_ID_QUERY,
21
+ variables: {
22
+ cloudId: cloudId
23
+ }
24
+ };
25
+ _context.prev = 1;
26
+ _context.next = 4;
27
+ return AGGQuery(url, query, addHeaders);
28
+ case 4:
29
+ _yield$AGGQuery = _context.sent;
30
+ tenantContexts = _yield$AGGQuery.tenantContexts;
31
+ if (!(!tenantContexts || tenantContexts.length === 0 || tenantContexts[0] === null)) {
32
+ _context.next = 8;
33
+ break;
34
+ }
35
+ return _context.abrupt("return", null);
36
+ case 8:
37
+ return _context.abrupt("return", tenantContexts[0].orgId);
38
+ case 11:
39
+ _context.prev = 11;
40
+ _context.t0 = _context["catch"](1);
41
+ return _context.abrupt("return", null);
42
+ case 14:
43
+ case "end":
44
+ return _context.stop();
45
+ }
46
+ }, _callee, null, [[1, 11]]);
47
+ }));
48
+ return _getOrgIdForCloudIdFromAGG.apply(this, arguments);
49
+ }
@@ -48,7 +48,7 @@ export var addHeaders = function addHeaders(headers) {
48
48
  headers.append('X-ExperimentalApi', 'teams-beta');
49
49
  headers.append('X-ExperimentalApi', 'team-members-beta');
50
50
  headers.append('atl-client-name', "@atlaskit/profilecard");
51
- headers.append('atl-client-version', "20.6.1");
51
+ headers.append('atl-client-version', "20.7.0");
52
52
  return headers;
53
53
  };
54
54
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -17,7 +17,6 @@ var chatToAgentButtonWrapper = xcss({
17
17
  display: 'flex',
18
18
  justifyContent: 'center',
19
19
  lineHeight: '20px',
20
- padding: 'space.075',
21
20
  fontWeight: '500'
22
21
  });
23
22
  var chatPillButtonInlineStyles = xcss({
@@ -39,7 +39,11 @@ var IconLabel = /*#__PURE__*/function (_React$PureComponent) {
39
39
  LEGACY_size: "small",
40
40
  color: "currentColor"
41
41
  }) : null;
42
- return /*#__PURE__*/React.createElement(DetailsLabel, null, /*#__PURE__*/React.createElement(DetailsLabelIcon, null, displayIcon), /*#__PURE__*/React.createElement(DetailsLabelText, null, this.props.children));
42
+ return /*#__PURE__*/React.createElement(DetailsLabel, null, /*#__PURE__*/React.createElement(DetailsLabelIcon, {
43
+ as: "dt"
44
+ }, displayIcon), /*#__PURE__*/React.createElement(DetailsLabelText, {
45
+ as: "dd"
46
+ }, this.props.children));
43
47
  }
44
48
  }]);
45
49
  return IconLabel;
@@ -176,7 +176,10 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
176
176
  var fireEvent = function fireEvent(event) {
177
177
  _this.fireAnalytics(event);
178
178
  };
179
- var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl()]);
179
+ var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl({
180
+ withOrgContext: true,
181
+ withSiteContext: true
182
+ })]);
180
183
  requests.then(function (res) {
181
184
  var _this2;
182
185
  return (_this2 = _this).handleClientSuccess.apply(_this2, _toConsumableArray(res));
@@ -359,7 +362,9 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
359
362
  return _this4.renderTrigger(triggerProps);
360
363
  },
361
364
  zIndex: layers.modal(),
362
- shouldFlip: true,
365
+ shouldFlip: true
366
+ // eslint-disable-next-line jsx-a11y/no-autofocus
367
+ ,
363
368
  autoFocus: this.props.trigger !== 'hover' && !this.openedByHover,
364
369
  shouldRenderToParent: fg('enable_appropriate_reading_order_in_profile_card')
365
370
  }));
@@ -65,7 +65,10 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
65
65
  hasError: false,
66
66
  data: null
67
67
  }, function () {
68
- var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl()]);
68
+ var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl({
69
+ withOrgContext: true,
70
+ withSiteContext: true
71
+ })]);
69
72
  requests.then(function (res) {
70
73
  var _this2;
71
74
  return (_this2 = _this).handleClientSuccess.apply(_this2, _toConsumableArray(res));
@@ -186,7 +189,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
186
189
  teamCentralBaseUrl: teamCentralBaseUrl,
187
190
  openKudosDrawer: this.openKudosDrawer
188
191
  });
189
- return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && /*#__PURE__*/React.createElement(Suspense, {
192
+ return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && newProps.teamCentralBaseUrl && /*#__PURE__*/React.createElement(Suspense, {
190
193
  fallback: null
191
194
  }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
192
195
  isOpen: this.state.kudosDrawerOpen,
@@ -216,7 +216,10 @@ export default function ProfilecardTriggerNext(_ref2) {
216
216
  setError(null);
217
217
  setData(null);
218
218
  _context.prev = 6;
219
- requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl()]);
219
+ requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
220
+ withOrgContext: true,
221
+ withSiteContext: true
222
+ })]);
220
223
  _context.next = 10;
221
224
  return requests;
222
225
  case 10:
@@ -368,9 +371,11 @@ export default function ProfilecardTriggerNext(_ref2) {
368
371
  }), children);
369
372
  },
370
373
  zIndex: layers.modal(),
371
- shouldUseCaptureOnOutsideClick: true,
374
+ shouldUseCaptureOnOutsideClick: true
375
+ // eslint-disable-next-line jsx-a11y/no-autofocus
376
+ ,
372
377
  autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click'
373
- }), shouldShowGiveKudos && /*#__PURE__*/React.createElement(Suspense, {
378
+ }), shouldShowGiveKudos && teamCentralBaseUrl && /*#__PURE__*/React.createElement(Suspense, {
374
379
  fallback: null
375
380
  }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
376
381
  isOpen: kudosDrawerOpen,
@@ -94,7 +94,8 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
94
94
  return _super3.call(this, options, _objectSpread({
95
95
  userClient: new MockUserClient(options),
96
96
  teamCentralClient: new MockTeamCentralClient(_objectSpread(_objectSpread({}, options), {}, {
97
- teamCentralUrl: 'defaultTeamCentralUrl'
97
+ teamCentralUrl: 'defaultTeamCentralUrl',
98
+ gatewayGraphqlUrl: 'defaultGatewayGraphqlUrl'
98
99
  }))
99
100
  }, clients));
100
101
  }
@@ -39,7 +39,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
39
39
  actionSubjectId: actionSubjectId,
40
40
  attributes: _objectSpread(_objectSpread({
41
41
  packageName: "@atlaskit/profilecard",
42
- packageVersion: "20.6.1"
42
+ packageVersion: "20.7.0"
43
43
  }, attributes), {}, {
44
44
  firedAt: Math.round(getPageTime())
45
45
  })
@@ -4,6 +4,10 @@ import RovoAgentCardClient from './RovoAgentCardClient';
4
4
  import TeamCentralCardClient from './TeamCentralCardClient';
5
5
  import TeamProfileCardClient from './TeamProfileCardClient';
6
6
  import UserProfileCardClient from './UserProfileCardClient';
7
+ export type TeamCentralScopes = {
8
+ withOrgContext: true;
9
+ withSiteContext: boolean;
10
+ };
7
11
  declare class ProfileCardClient implements ProfileClient {
8
12
  userClient: UserProfileCardClient;
9
13
  teamClient: TeamProfileCardClient;
@@ -14,7 +18,7 @@ declare class ProfileCardClient implements ProfileClient {
14
18
  getProfile(cloudId: string, userId: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<any>;
15
19
  getTeamProfile(teamId: string, orgId?: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").Team>;
16
20
  getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
17
- getTeamCentralBaseUrl(): Promise<string | undefined>;
21
+ getTeamCentralBaseUrl(teamCentralScopes?: TeamCentralScopes): Promise<string | undefined>;
18
22
  shouldShowGiveKudos(): Promise<boolean>;
19
23
  getRovoAgentProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").RovoAgent>;
20
24
  deleteAgent(id: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
@@ -8,6 +8,12 @@ export declare const buildReportingLinesQuery: (aaid: string) => {
8
8
  };
9
9
  export type TeamCentralCardClientOptions = CacheConfig & {
10
10
  cloudId?: string;
11
+ gatewayGraphqlUrl: string;
12
+ /**
13
+ * If provided, will avoid resolving the org ID internally from the cloud ID,
14
+ * and use the provided org ID instead
15
+ */
16
+ orgId?: string;
11
17
  teamCentralDisabled?: boolean;
12
18
  /**
13
19
  * @deprecated
@@ -30,6 +36,7 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
30
36
  bypassOnFailure: boolean;
31
37
  isTCReadyPromise: Promise<boolean>;
32
38
  private isGlobalExperienceWorkspacePromise;
39
+ private orgIdPromise;
33
40
  constructor(options: TeamCentralCardClientOptions);
34
41
  createTcReadyPromise(config: TeamCentralCardClientOptions): Promise<boolean>;
35
42
  getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
@@ -39,9 +46,11 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
39
46
  makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
40
47
  checkWorkspaceExists(): Promise<boolean>;
41
48
  getIsGlobalExperienceWorkspace(): Promise<boolean>;
49
+ getOrgId(): Promise<string | null>;
42
50
  private preloadIsGlobalExperienceWorkspace;
43
51
  private hasTCWorkspace;
44
52
  private isGlobalExperienceWorkspaceForCloudId;
53
+ private preloadOrgId;
45
54
  private getMaybeShardedApiPath;
46
55
  private filterReportingLinesUser;
47
56
  }
@@ -0,0 +1 @@
1
+ export declare function getOrgIdForCloudIdFromAGG(url: string, cloudId: string): Promise<string | null>;
@@ -1,6 +1,7 @@
1
1
  import type React from 'react';
2
2
  import { type IntlShape } from 'react-intl-next';
3
3
  import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import { type TeamCentralScopes } from './client/ProfileCardClient';
4
5
  import type RovoAgentCardClient from './client/RovoAgentCardClient';
5
6
  import { type default as TeamCentralCardClient, type TeamCentralCardClientOptions } from './client/TeamCentralCardClient';
6
7
  import type TeamProfileCardClient from './client/TeamProfileCardClient';
@@ -439,7 +440,7 @@ export interface ProfileClient {
439
440
  getTeamProfile: (teamId: string, orgId?: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<Team>;
440
441
  getReportingLines: (userId: string) => Promise<TeamCentralReportingLinesData>;
441
442
  shouldShowGiveKudos: () => Promise<boolean>;
442
- getTeamCentralBaseUrl: () => Promise<string | undefined>;
443
+ getTeamCentralBaseUrl: (teamCentralScopes?: TeamCentralScopes) => Promise<string | undefined>;
443
444
  getRovoAgentProfile: (id: AgentIdType, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<RovoAgent>;
444
445
  deleteAgent: (id: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
445
446
  setFavouriteAgent: (id: string, isFavourite: boolean, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
@@ -451,7 +452,7 @@ export type ProfileCardErrorType = {
451
452
  export type TeamProfileCardErrorType = {
452
453
  reason: 'default' | 'NotFound' | 'TEAMS_FORBIDDEN';
453
454
  } | null;
454
- export interface ProfileClientOptions extends TeamCentralCardClientOptions {
455
+ export interface ProfileClientOptions extends Omit<TeamCentralCardClientOptions, 'gatewayGraphqlUrl'> {
455
456
  /**
456
457
  * pf-directory url
457
458
  * When we clean up CloudUser migration FF, we should remove this prop
@@ -4,6 +4,10 @@ import RovoAgentCardClient from './RovoAgentCardClient';
4
4
  import TeamCentralCardClient from './TeamCentralCardClient';
5
5
  import TeamProfileCardClient from './TeamProfileCardClient';
6
6
  import UserProfileCardClient from './UserProfileCardClient';
7
+ export type TeamCentralScopes = {
8
+ withOrgContext: true;
9
+ withSiteContext: boolean;
10
+ };
7
11
  declare class ProfileCardClient implements ProfileClient {
8
12
  userClient: UserProfileCardClient;
9
13
  teamClient: TeamProfileCardClient;
@@ -14,7 +18,7 @@ declare class ProfileCardClient implements ProfileClient {
14
18
  getProfile(cloudId: string, userId: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<any>;
15
19
  getTeamProfile(teamId: string, orgId?: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").Team>;
16
20
  getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
17
- getTeamCentralBaseUrl(): Promise<string | undefined>;
21
+ getTeamCentralBaseUrl(teamCentralScopes?: TeamCentralScopes): Promise<string | undefined>;
18
22
  shouldShowGiveKudos(): Promise<boolean>;
19
23
  getRovoAgentProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").RovoAgent>;
20
24
  deleteAgent(id: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
@@ -8,6 +8,12 @@ export declare const buildReportingLinesQuery: (aaid: string) => {
8
8
  };
9
9
  export type TeamCentralCardClientOptions = CacheConfig & {
10
10
  cloudId?: string;
11
+ gatewayGraphqlUrl: string;
12
+ /**
13
+ * If provided, will avoid resolving the org ID internally from the cloud ID,
14
+ * and use the provided org ID instead
15
+ */
16
+ orgId?: string;
11
17
  teamCentralDisabled?: boolean;
12
18
  /**
13
19
  * @deprecated
@@ -30,6 +36,7 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
30
36
  bypassOnFailure: boolean;
31
37
  isTCReadyPromise: Promise<boolean>;
32
38
  private isGlobalExperienceWorkspacePromise;
39
+ private orgIdPromise;
33
40
  constructor(options: TeamCentralCardClientOptions);
34
41
  createTcReadyPromise(config: TeamCentralCardClientOptions): Promise<boolean>;
35
42
  getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
@@ -39,9 +46,11 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
39
46
  makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
40
47
  checkWorkspaceExists(): Promise<boolean>;
41
48
  getIsGlobalExperienceWorkspace(): Promise<boolean>;
49
+ getOrgId(): Promise<string | null>;
42
50
  private preloadIsGlobalExperienceWorkspace;
43
51
  private hasTCWorkspace;
44
52
  private isGlobalExperienceWorkspaceForCloudId;
53
+ private preloadOrgId;
45
54
  private getMaybeShardedApiPath;
46
55
  private filterReportingLinesUser;
47
56
  }
@@ -0,0 +1 @@
1
+ export declare function getOrgIdForCloudIdFromAGG(url: string, cloudId: string): Promise<string | null>;
@@ -1,6 +1,7 @@
1
1
  import type React from 'react';
2
2
  import { type IntlShape } from 'react-intl-next';
3
3
  import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import { type TeamCentralScopes } from './client/ProfileCardClient';
4
5
  import type RovoAgentCardClient from './client/RovoAgentCardClient';
5
6
  import { type default as TeamCentralCardClient, type TeamCentralCardClientOptions } from './client/TeamCentralCardClient';
6
7
  import type TeamProfileCardClient from './client/TeamProfileCardClient';
@@ -445,7 +446,7 @@ export interface ProfileClient {
445
446
  getTeamProfile: (teamId: string, orgId?: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<Team>;
446
447
  getReportingLines: (userId: string) => Promise<TeamCentralReportingLinesData>;
447
448
  shouldShowGiveKudos: () => Promise<boolean>;
448
- getTeamCentralBaseUrl: () => Promise<string | undefined>;
449
+ getTeamCentralBaseUrl: (teamCentralScopes?: TeamCentralScopes) => Promise<string | undefined>;
449
450
  getRovoAgentProfile: (id: AgentIdType, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<RovoAgent>;
450
451
  deleteAgent: (id: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
451
452
  setFavouriteAgent: (id: string, isFavourite: boolean, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
@@ -457,7 +458,7 @@ export type ProfileCardErrorType = {
457
458
  export type TeamProfileCardErrorType = {
458
459
  reason: 'default' | 'NotFound' | 'TEAMS_FORBIDDEN';
459
460
  } | null;
460
- export interface ProfileClientOptions extends TeamCentralCardClientOptions {
461
+ export interface ProfileClientOptions extends Omit<TeamCentralCardClientOptions, 'gatewayGraphqlUrl'> {
461
462
  /**
462
463
  * pf-directory url
463
464
  * When we clean up CloudUser migration FF, we should remove this prop
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "20.6.1",
3
+ "version": "20.7.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -54,17 +54,17 @@
54
54
  "@atlaskit/atlassian-context": "^0.0.2",
55
55
  "@atlaskit/avatar": "^21.15.0",
56
56
  "@atlaskit/avatar-group": "^10.0.0",
57
- "@atlaskit/button": "^20.2.0",
58
- "@atlaskit/dropdown-menu": "^12.20.0",
59
- "@atlaskit/empty-state": "^7.11.0",
57
+ "@atlaskit/button": "^20.3.0",
58
+ "@atlaskit/dropdown-menu": "^12.21.0",
59
+ "@atlaskit/empty-state": "^7.12.0",
60
60
  "@atlaskit/focus-ring": "^1.6.0",
61
61
  "@atlaskit/give-kudos": "^2.2.0",
62
- "@atlaskit/icon": "^22.22.0",
63
- "@atlaskit/lozenge": "^11.11.0",
62
+ "@atlaskit/icon": "^22.23.0",
63
+ "@atlaskit/lozenge": "^11.12.0",
64
64
  "@atlaskit/menu": "^2.13.0",
65
65
  "@atlaskit/modal-dialog": "^12.17.0",
66
66
  "@atlaskit/platform-feature-flags": "^0.3.0",
67
- "@atlaskit/popup": "^1.28.0",
67
+ "@atlaskit/popup": "^1.29.0",
68
68
  "@atlaskit/primitives": "^12.2.0",
69
69
  "@atlaskit/rovo-agent-components": "^1.6.0",
70
70
  "@atlaskit/spinner": "^16.3.0",
@@ -86,6 +86,7 @@
86
86
  },
87
87
  "devDependencies": {
88
88
  "@af/visual-regression": "*",
89
+ "@atlassian/a11y-jest-testing": "*",
89
90
  "@atlassian/feature-flags-test-utils": "*",
90
91
  "@atlassian/ptc-test-utils": "^0.8.0",
91
92
  "@testing-library/react": "^12.1.5",