@atlaskit/profilecard 20.14.0 → 21.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 21.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#169629](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169629)
8
+ [`8657e106f5a52`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8657e106f5a52) -
9
+ Remove feature gate that moved calls to status to be sharded, and moved the URL configuration back
10
+ inside of the component (instead of exposing it outwards unnecessarily)
11
+
12
+ N.B. for the breaking changes, there are a couple of props going into the PTC components,
13
+ `teamCentralUrl` and `teamCentralBaseUrl`, that have been removed because they are no longer
14
+ necessary. These props made consuemrs of the component choose the URL, but a change was made
15
+ previously to move it back inside of the component and resolve it internally, so consumers of the
16
+ component need not configure this any more.
17
+
18
+ Consequently, if you are trying to upgrade to the major version bumps, you just need to remove
19
+ those props, as they're otherwise being ignored 🙏
20
+
3
21
  ## 20.14.0
4
22
 
5
23
  ### Minor Changes
@@ -11,7 +11,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
13
  var _atlassianContext = require("@atlaskit/atlassian-context");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _RovoAgentCardClient = _interopRequireDefault(require("./RovoAgentCardClient"));
16
15
  var _TeamCentralCardClient = _interopRequireDefault(require("./TeamCentralCardClient"));
17
16
  var _TeamProfileCardClient = _interopRequireDefault(require("./TeamProfileCardClient"));
@@ -66,54 +65,48 @@ var ProfileCardClient = /*#__PURE__*/function () {
66
65
  key: "getTeamCentralBaseUrl",
67
66
  value: function () {
68
67
  var _getTeamCentralBaseUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(teamCentralScopes) {
69
- var _this$tcClient3, isGlobalExperienceWorkspace, suffix, orgId;
68
+ var isGlobalExperienceWorkspace, suffix, orgId;
70
69
  return _regenerator.default.wrap(function _callee$(_context) {
71
70
  while (1) switch (_context.prev = _context.next) {
72
71
  case 0:
73
- if ((0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls')) {
74
- _context.next = 2;
75
- break;
76
- }
77
- return _context.abrupt("return", Promise.resolve((_this$tcClient3 = this.tcClient) === null || _this$tcClient3 === void 0 ? void 0 : _this$tcClient3.options.teamCentralBaseUrl));
78
- case 2:
79
72
  if (!(this.tcClient === undefined)) {
80
- _context.next = 4;
73
+ _context.next = 2;
81
74
  break;
82
75
  }
83
76
  return _context.abrupt("return", Promise.resolve(undefined));
84
- case 4:
85
- _context.next = 6;
77
+ case 2:
78
+ _context.next = 4;
86
79
  return this.tcClient.getIsGlobalExperienceWorkspace();
87
- case 6:
80
+ case 4:
88
81
  isGlobalExperienceWorkspace = _context.sent;
89
82
  if (isGlobalExperienceWorkspace) {
90
- _context.next = 9;
83
+ _context.next = 7;
91
84
  break;
92
85
  }
93
86
  return _context.abrupt("return", Promise.resolve((0, _atlassianContext.getATLContextUrl)('team')));
94
- case 9:
87
+ case 7:
95
88
  suffix = '';
96
89
  if (!(teamCentralScopes !== undefined)) {
97
- _context.next = 18;
90
+ _context.next = 16;
98
91
  break;
99
92
  }
100
- _context.next = 13;
93
+ _context.next = 11;
101
94
  return this.tcClient.getOrgId();
102
- case 13:
95
+ case 11:
103
96
  orgId = _context.sent;
104
97
  if (!(orgId === null)) {
105
- _context.next = 16;
98
+ _context.next = 14;
106
99
  break;
107
100
  }
108
101
  return _context.abrupt("return", Promise.resolve(undefined));
109
- case 16:
102
+ case 14:
110
103
  suffix += "/o/".concat(orgId);
111
104
  if (teamCentralScopes.withSiteContext) {
112
105
  suffix += "/s/".concat(this.tcClient.options.cloudId);
113
106
  }
114
- case 18:
107
+ case 16:
115
108
  return _context.abrupt("return", Promise.resolve("".concat((0, _atlassianContext.getATLContextUrl)('home')).concat(suffix)));
116
- case 19:
109
+ case 17:
117
110
  case "end":
118
111
  return _context.stop();
119
112
  }
@@ -193,7 +186,7 @@ function maybeCreateTeamCentralClient(config, clients) {
193
186
  if (clients !== null && clients !== void 0 && clients.teamCentralClient) {
194
187
  return clients.teamCentralClient;
195
188
  }
196
- var teamCentralEnabled = (0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls') ? config.teamCentralDisabled !== true : config.teamCentralUrl;
189
+ var teamCentralEnabled = config.teamCentralDisabled !== true;
197
190
  return teamCentralEnabled ? new _TeamCentralCardClient.default(_objectSpread({}, config)) : undefined;
198
191
  }
199
192
  var _default = exports.default = ProfileCardClient;
@@ -12,7 +12,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
12
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
17
16
  var _getOrgIdForCloudIdFromAGG = require("./getOrgIdForCloudIdFromAGG");
18
17
  var _graphqlUtils = require("./graphqlUtils");
@@ -124,40 +123,23 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
124
123
  key: "makeRequest",
125
124
  value: (function () {
126
125
  var _makeRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(userId) {
127
- var query, response, _query, _response;
126
+ var query, response;
128
127
  return _regenerator.default.wrap(function _callee$(_context) {
129
128
  while (1) switch (_context.prev = _context.next) {
130
129
  case 0:
131
- if (!(0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls')) {
132
- _context.next = 10;
133
- break;
134
- }
135
130
  if (!(this.options.teamCentralDisabled === true)) {
136
- _context.next = 3;
131
+ _context.next = 2;
137
132
  break;
138
133
  }
139
134
  throw new Error('makeRequest cannot be called when the client has been disabled');
140
- case 3:
135
+ case 2:
141
136
  query = buildReportingLinesQuery(userId);
142
- _context.next = 6;
137
+ _context.next = 5;
143
138
  return (0, _graphqlUtils.directoryGraphqlQuery)('/gateway/api/watermelon/graphql?operationName=ReportingLines', query);
144
- case 6:
139
+ case 5:
145
140
  response = _context.sent;
146
141
  return _context.abrupt("return", response.reportingLines);
147
- case 10:
148
- if (this.options.teamCentralUrl) {
149
- _context.next = 12;
150
- break;
151
- }
152
- throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
153
- case 12:
154
- _query = buildReportingLinesQuery(userId);
155
- _context.next = 15;
156
- return (0, _graphqlUtils.directoryGraphqlQuery)("".concat(this.options.teamCentralUrl, "?operationName=ReportingLines"), _query);
157
- case 15:
158
- _response = _context.sent;
159
- return _context.abrupt("return", _response.reportingLines);
160
- case 17:
142
+ case 7:
161
143
  case "end":
162
144
  return _context.stop();
163
145
  }
@@ -193,9 +175,6 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
193
175
  }, {
194
176
  key: "preloadIsGlobalExperienceWorkspace",
195
177
  value: function preloadIsGlobalExperienceWorkspace(cloudId) {
196
- if (!(0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls')) {
197
- return Promise.resolve(false);
198
- }
199
178
  if (cloudId === undefined) {
200
179
  return Promise.resolve(false);
201
180
  }
@@ -211,8 +190,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
211
190
  key: "hasTCWorkspace",
212
191
  value: function hasTCWorkspace(config) {
213
192
  if (config.cloudId) {
214
- var maybeShardedApiPath = this.getMaybeShardedApiPath(config.cloudId);
215
- return fetch("".concat(maybeShardedApiPath, "/organization/containsAnyWorkspace?cloudId=").concat(config.cloudId)).then(function (res) {
193
+ return fetch("".concat(this.getShardedApiPath(config.cloudId), "/organization/containsAnyWorkspace?cloudId=").concat(config.cloudId)).then(function (res) {
216
194
  return !res || res && res.ok;
217
195
  });
218
196
  } else {
@@ -223,38 +201,37 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
223
201
  key: "isGlobalExperienceWorkspaceForCloudId",
224
202
  value: function () {
225
203
  var _isGlobalExperienceWorkspaceForCloudId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(cloudId) {
226
- var maybeShardedApiPath, response, workspaceType;
204
+ var response, workspaceType;
227
205
  return _regenerator.default.wrap(function _callee2$(_context2) {
228
206
  while (1) switch (_context2.prev = _context2.next) {
229
207
  case 0:
230
- maybeShardedApiPath = this.getMaybeShardedApiPath(cloudId);
231
- _context2.prev = 1;
232
- _context2.next = 4;
233
- return fetch("".concat(maybeShardedApiPath, "/workspace/existsWithWorkspaceType?cloudId=").concat(cloudId), {
208
+ _context2.prev = 0;
209
+ _context2.next = 3;
210
+ return fetch("".concat(this.getShardedApiPath(cloudId), "/workspace/existsWithWorkspaceType?cloudId=").concat(cloudId), {
234
211
  credentials: 'include'
235
212
  });
236
- case 4:
213
+ case 3:
237
214
  response = _context2.sent;
238
215
  if (!response.ok) {
239
- _context2.next = 10;
216
+ _context2.next = 9;
240
217
  break;
241
218
  }
242
- _context2.next = 8;
219
+ _context2.next = 7;
243
220
  return response.text();
244
- case 8:
221
+ case 7:
245
222
  workspaceType = _context2.sent;
246
223
  return _context2.abrupt("return", Promise.resolve(workspaceType === 'GLOBAL_EXPERIENCE'));
247
- case 10:
224
+ case 9:
248
225
  return _context2.abrupt("return", Promise.resolve(false));
249
- case 13:
250
- _context2.prev = 13;
251
- _context2.t0 = _context2["catch"](1);
226
+ case 12:
227
+ _context2.prev = 12;
228
+ _context2.t0 = _context2["catch"](0);
252
229
  return _context2.abrupt("return", Promise.resolve(false));
253
- case 16:
230
+ case 15:
254
231
  case "end":
255
232
  return _context2.stop();
256
233
  }
257
- }, _callee2, this, [[1, 13]]);
234
+ }, _callee2, this, [[0, 12]]);
258
235
  }));
259
236
  function isGlobalExperienceWorkspaceForCloudId(_x2) {
260
237
  return _isGlobalExperienceWorkspaceForCloudId.apply(this, arguments);
@@ -264,9 +241,6 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
264
241
  }, {
265
242
  key: "preloadOrgId",
266
243
  value: function preloadOrgId(gatewayGraphqlUrl, cloudId, orgId) {
267
- if (!(0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls')) {
268
- return Promise.resolve(null);
269
- }
270
244
  if (cloudId === undefined) {
271
245
  return Promise.resolve(null);
272
246
  }
@@ -282,10 +256,9 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
282
256
  return orgIdForCloudIdPromise;
283
257
  }
284
258
  }, {
285
- key: "getMaybeShardedApiPath",
286
- value: function getMaybeShardedApiPath(cloudId) {
287
- var maybeShardedPath = (0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls') ? "/townsquare/s/".concat(cloudId) : '/watermelon';
288
- return "/gateway/api".concat(maybeShardedPath);
259
+ key: "getShardedApiPath",
260
+ value: function getShardedApiPath(cloudId) {
261
+ return "/gateway/api/townsquare/s/".concat(cloudId);
289
262
  }
290
263
  }, {
291
264
  key: "filterReportingLinesUser",
@@ -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', "20.14.0");
14
+ headers.append('atl-client-version', "21.0.0");
15
15
  return headers;
16
16
  };
17
17
  function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -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.14.0");
60
+ headers.append('atl-client-version', "21.0.0");
61
61
  return headers;
62
62
  };
63
63
  function getTeamFromAGG(_x, _x2, _x3) {
@@ -101,7 +101,6 @@ 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',
105
104
  gatewayGraphqlUrl: 'defaultGatewayGraphqlUrl'
106
105
  }))
107
106
  }, clients));
@@ -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.14.0"
48
+ packageVersion: "21.0.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: Math.round((0, _performance.getPageTime)())
51
51
  })
@@ -1,5 +1,4 @@
1
1
  import { getATLContextUrl, isFedRamp } from '@atlaskit/atlassian-context';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import RovoAgentCardClient from './RovoAgentCardClient';
4
3
  import TeamCentralCardClient from './TeamCentralCardClient';
5
4
  import TeamProfileCardClient from './TeamProfileCardClient';
@@ -44,10 +43,6 @@ class ProfileCardClient {
44
43
  });
45
44
  }
46
45
  async getTeamCentralBaseUrl(teamCentralScopes) {
47
- if (!fg('enable_ptc_sharded_townsquare_calls')) {
48
- var _this$tcClient3;
49
- return Promise.resolve((_this$tcClient3 = this.tcClient) === null || _this$tcClient3 === void 0 ? void 0 : _this$tcClient3.options.teamCentralBaseUrl);
50
- }
51
46
  if (this.tcClient === undefined) {
52
47
  return Promise.resolve(undefined);
53
48
  }
@@ -98,7 +93,7 @@ function maybeCreateTeamCentralClient(config, clients) {
98
93
  if (clients !== null && clients !== void 0 && clients.teamCentralClient) {
99
94
  return clients.teamCentralClient;
100
95
  }
101
- const teamCentralEnabled = fg('enable_ptc_sharded_townsquare_calls') ? config.teamCentralDisabled !== true : config.teamCentralUrl;
96
+ const teamCentralEnabled = config.teamCentralDisabled !== true;
102
97
  return teamCentralEnabled ? new TeamCentralCardClient({
103
98
  ...config
104
99
  }) : undefined;
@@ -1,4 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
1
  import CachingClient from './CachingClient';
3
2
  import { getOrgIdForCloudIdFromAGG } from './getOrgIdForCloudIdFromAGG';
4
3
  import { directoryGraphqlQuery } from './graphqlUtils';
@@ -115,21 +114,12 @@ class TeamCentralCardClient extends CachingClient {
115
114
  * `public` so that mock client can override it; do not use it otherwise!
116
115
  */
117
116
  async makeRequest(userId) {
118
- if (fg('enable_ptc_sharded_townsquare_calls')) {
119
- if (this.options.teamCentralDisabled === true) {
120
- throw new Error('makeRequest cannot be called when the client has been disabled');
121
- }
122
- const query = buildReportingLinesQuery(userId);
123
- const response = await directoryGraphqlQuery('/gateway/api/watermelon/graphql?operationName=ReportingLines', query);
124
- return response.reportingLines;
125
- } else {
126
- if (!this.options.teamCentralUrl) {
127
- throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
128
- }
129
- const query = buildReportingLinesQuery(userId);
130
- const response = await directoryGraphqlQuery(`${this.options.teamCentralUrl}?operationName=ReportingLines`, query);
131
- return response.reportingLines;
117
+ if (this.options.teamCentralDisabled === true) {
118
+ throw new Error('makeRequest cannot be called when the client has been disabled');
132
119
  }
120
+ const query = buildReportingLinesQuery(userId);
121
+ const response = await directoryGraphqlQuery('/gateway/api/watermelon/graphql?operationName=ReportingLines', query);
122
+ return response.reportingLines;
133
123
  }
134
124
  checkWorkspaceExists() {
135
125
  return this.isTCReadyPromise.then(workSpaceExists => {
@@ -146,9 +136,6 @@ class TeamCentralCardClient extends CachingClient {
146
136
  return this.orgIdPromise;
147
137
  }
148
138
  preloadIsGlobalExperienceWorkspace(cloudId) {
149
- if (!fg('enable_ptc_sharded_townsquare_calls')) {
150
- return Promise.resolve(false);
151
- }
152
139
  if (cloudId === undefined) {
153
140
  return Promise.resolve(false);
154
141
  }
@@ -162,8 +149,7 @@ class TeamCentralCardClient extends CachingClient {
162
149
  }
163
150
  hasTCWorkspace(config) {
164
151
  if (config.cloudId) {
165
- const maybeShardedApiPath = this.getMaybeShardedApiPath(config.cloudId);
166
- return fetch(`${maybeShardedApiPath}/organization/containsAnyWorkspace?cloudId=${config.cloudId}`).then(res => {
152
+ return fetch(`${this.getShardedApiPath(config.cloudId)}/organization/containsAnyWorkspace?cloudId=${config.cloudId}`).then(res => {
167
153
  return !res || res && res.ok;
168
154
  });
169
155
  } else {
@@ -171,9 +157,8 @@ class TeamCentralCardClient extends CachingClient {
171
157
  }
172
158
  }
173
159
  async isGlobalExperienceWorkspaceForCloudId(cloudId) {
174
- const maybeShardedApiPath = this.getMaybeShardedApiPath(cloudId);
175
160
  try {
176
- const response = await fetch(`${maybeShardedApiPath}/workspace/existsWithWorkspaceType?cloudId=${cloudId}`, {
161
+ const response = await fetch(`${this.getShardedApiPath(cloudId)}/workspace/existsWithWorkspaceType?cloudId=${cloudId}`, {
177
162
  credentials: 'include'
178
163
  });
179
164
  if (response.ok) {
@@ -186,9 +171,6 @@ class TeamCentralCardClient extends CachingClient {
186
171
  }
187
172
  }
188
173
  preloadOrgId(gatewayGraphqlUrl, cloudId, orgId) {
189
- if (!fg('enable_ptc_sharded_townsquare_calls')) {
190
- return Promise.resolve(null);
191
- }
192
174
  if (cloudId === undefined) {
193
175
  return Promise.resolve(null);
194
176
  }
@@ -203,9 +185,8 @@ class TeamCentralCardClient extends CachingClient {
203
185
  orgIdPromiseCache.set(cloudId, orgIdForCloudIdPromise);
204
186
  return orgIdForCloudIdPromise;
205
187
  }
206
- getMaybeShardedApiPath(cloudId) {
207
- const maybeShardedPath = fg('enable_ptc_sharded_townsquare_calls') ? `/townsquare/s/${cloudId}` : '/watermelon';
208
- return `/gateway/api${maybeShardedPath}`;
188
+ getShardedApiPath(cloudId) {
189
+ return `/gateway/api/townsquare/s/${cloudId}`;
209
190
  }
210
191
  filterReportingLinesUser(users = []) {
211
192
  return users.filter(user => user.identifierType === 'ATLASSIAN_ID');
@@ -6,7 +6,7 @@ const ORG_ID_FROM_CLOUD_ID_QUERY = `query OrgIdFromCloudId($cloudId: ID!) {
6
6
  }`;
7
7
  const addHeaders = headers => {
8
8
  headers.append('atl-client-name', "@atlaskit/profilecard");
9
- headers.append('atl-client-version', "20.14.0");
9
+ headers.append('atl-client-version', "21.0.0");
10
10
  return headers;
11
11
  };
12
12
  export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
@@ -68,7 +68,7 @@ export const addHeaders = headers => {
68
68
  headers.append('X-ExperimentalApi', 'teams-beta');
69
69
  headers.append('X-ExperimentalApi', 'team-members-beta');
70
70
  headers.append('atl-client-name', "@atlaskit/profilecard");
71
- headers.append('atl-client-version', "20.14.0");
71
+ headers.append('atl-client-version', "21.0.0");
72
72
  return headers;
73
73
  };
74
74
  export async function getTeamFromAGG(url, teamId, siteId) {
@@ -61,7 +61,6 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
61
61
  userClient: new MockUserClient(options),
62
62
  teamCentralClient: new MockTeamCentralClient({
63
63
  ...options,
64
- teamCentralUrl: 'defaultTeamCentralUrl',
65
64
  gatewayGraphqlUrl: 'defaultGatewayGraphqlUrl'
66
65
  }),
67
66
  ...clients
@@ -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.14.0",
35
+ packageVersion: "21.0.0",
36
36
  ...attributes,
37
37
  firedAt: Math.round(getPageTime())
38
38
  }
@@ -6,7 +6,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  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; }
7
7
  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; }
8
8
  import { getATLContextUrl, isFedRamp } from '@atlaskit/atlassian-context';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import RovoAgentCardClient from './RovoAgentCardClient';
11
10
  import TeamCentralCardClient from './TeamCentralCardClient';
12
11
  import TeamProfileCardClient from './TeamProfileCardClient';
@@ -59,54 +58,48 @@ var ProfileCardClient = /*#__PURE__*/function () {
59
58
  key: "getTeamCentralBaseUrl",
60
59
  value: function () {
61
60
  var _getTeamCentralBaseUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(teamCentralScopes) {
62
- var _this$tcClient3, isGlobalExperienceWorkspace, suffix, orgId;
61
+ var isGlobalExperienceWorkspace, suffix, orgId;
63
62
  return _regeneratorRuntime.wrap(function _callee$(_context) {
64
63
  while (1) switch (_context.prev = _context.next) {
65
64
  case 0:
66
- if (fg('enable_ptc_sharded_townsquare_calls')) {
67
- _context.next = 2;
68
- break;
69
- }
70
- return _context.abrupt("return", Promise.resolve((_this$tcClient3 = this.tcClient) === null || _this$tcClient3 === void 0 ? void 0 : _this$tcClient3.options.teamCentralBaseUrl));
71
- case 2:
72
65
  if (!(this.tcClient === undefined)) {
73
- _context.next = 4;
66
+ _context.next = 2;
74
67
  break;
75
68
  }
76
69
  return _context.abrupt("return", Promise.resolve(undefined));
77
- case 4:
78
- _context.next = 6;
70
+ case 2:
71
+ _context.next = 4;
79
72
  return this.tcClient.getIsGlobalExperienceWorkspace();
80
- case 6:
73
+ case 4:
81
74
  isGlobalExperienceWorkspace = _context.sent;
82
75
  if (isGlobalExperienceWorkspace) {
83
- _context.next = 9;
76
+ _context.next = 7;
84
77
  break;
85
78
  }
86
79
  return _context.abrupt("return", Promise.resolve(getATLContextUrl('team')));
87
- case 9:
80
+ case 7:
88
81
  suffix = '';
89
82
  if (!(teamCentralScopes !== undefined)) {
90
- _context.next = 18;
83
+ _context.next = 16;
91
84
  break;
92
85
  }
93
- _context.next = 13;
86
+ _context.next = 11;
94
87
  return this.tcClient.getOrgId();
95
- case 13:
88
+ case 11:
96
89
  orgId = _context.sent;
97
90
  if (!(orgId === null)) {
98
- _context.next = 16;
91
+ _context.next = 14;
99
92
  break;
100
93
  }
101
94
  return _context.abrupt("return", Promise.resolve(undefined));
102
- case 16:
95
+ case 14:
103
96
  suffix += "/o/".concat(orgId);
104
97
  if (teamCentralScopes.withSiteContext) {
105
98
  suffix += "/s/".concat(this.tcClient.options.cloudId);
106
99
  }
107
- case 18:
100
+ case 16:
108
101
  return _context.abrupt("return", Promise.resolve("".concat(getATLContextUrl('home')).concat(suffix)));
109
- case 19:
102
+ case 17:
110
103
  case "end":
111
104
  return _context.stop();
112
105
  }
@@ -186,7 +179,7 @@ function maybeCreateTeamCentralClient(config, clients) {
186
179
  if (clients !== null && clients !== void 0 && clients.teamCentralClient) {
187
180
  return clients.teamCentralClient;
188
181
  }
189
- var teamCentralEnabled = fg('enable_ptc_sharded_townsquare_calls') ? config.teamCentralDisabled !== true : config.teamCentralUrl;
182
+ var teamCentralEnabled = config.teamCentralDisabled !== true;
190
183
  return teamCentralEnabled ? new TeamCentralCardClient(_objectSpread({}, config)) : undefined;
191
184
  }
192
185
  export default ProfileCardClient;
@@ -7,7 +7,6 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import CachingClient from './CachingClient';
12
11
  import { getOrgIdForCloudIdFromAGG } from './getOrgIdForCloudIdFromAGG';
13
12
  import { directoryGraphqlQuery } from './graphqlUtils';
@@ -117,40 +116,23 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
117
116
  key: "makeRequest",
118
117
  value: (function () {
119
118
  var _makeRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(userId) {
120
- var query, response, _query, _response;
119
+ var query, response;
121
120
  return _regeneratorRuntime.wrap(function _callee$(_context) {
122
121
  while (1) switch (_context.prev = _context.next) {
123
122
  case 0:
124
- if (!fg('enable_ptc_sharded_townsquare_calls')) {
125
- _context.next = 10;
126
- break;
127
- }
128
123
  if (!(this.options.teamCentralDisabled === true)) {
129
- _context.next = 3;
124
+ _context.next = 2;
130
125
  break;
131
126
  }
132
127
  throw new Error('makeRequest cannot be called when the client has been disabled');
133
- case 3:
128
+ case 2:
134
129
  query = buildReportingLinesQuery(userId);
135
- _context.next = 6;
130
+ _context.next = 5;
136
131
  return directoryGraphqlQuery('/gateway/api/watermelon/graphql?operationName=ReportingLines', query);
137
- case 6:
132
+ case 5:
138
133
  response = _context.sent;
139
134
  return _context.abrupt("return", response.reportingLines);
140
- case 10:
141
- if (this.options.teamCentralUrl) {
142
- _context.next = 12;
143
- break;
144
- }
145
- throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
146
- case 12:
147
- _query = buildReportingLinesQuery(userId);
148
- _context.next = 15;
149
- return directoryGraphqlQuery("".concat(this.options.teamCentralUrl, "?operationName=ReportingLines"), _query);
150
- case 15:
151
- _response = _context.sent;
152
- return _context.abrupt("return", _response.reportingLines);
153
- case 17:
135
+ case 7:
154
136
  case "end":
155
137
  return _context.stop();
156
138
  }
@@ -186,9 +168,6 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
186
168
  }, {
187
169
  key: "preloadIsGlobalExperienceWorkspace",
188
170
  value: function preloadIsGlobalExperienceWorkspace(cloudId) {
189
- if (!fg('enable_ptc_sharded_townsquare_calls')) {
190
- return Promise.resolve(false);
191
- }
192
171
  if (cloudId === undefined) {
193
172
  return Promise.resolve(false);
194
173
  }
@@ -204,8 +183,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
204
183
  key: "hasTCWorkspace",
205
184
  value: function hasTCWorkspace(config) {
206
185
  if (config.cloudId) {
207
- var maybeShardedApiPath = this.getMaybeShardedApiPath(config.cloudId);
208
- return fetch("".concat(maybeShardedApiPath, "/organization/containsAnyWorkspace?cloudId=").concat(config.cloudId)).then(function (res) {
186
+ return fetch("".concat(this.getShardedApiPath(config.cloudId), "/organization/containsAnyWorkspace?cloudId=").concat(config.cloudId)).then(function (res) {
209
187
  return !res || res && res.ok;
210
188
  });
211
189
  } else {
@@ -216,38 +194,37 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
216
194
  key: "isGlobalExperienceWorkspaceForCloudId",
217
195
  value: function () {
218
196
  var _isGlobalExperienceWorkspaceForCloudId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cloudId) {
219
- var maybeShardedApiPath, response, workspaceType;
197
+ var response, workspaceType;
220
198
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
221
199
  while (1) switch (_context2.prev = _context2.next) {
222
200
  case 0:
223
- maybeShardedApiPath = this.getMaybeShardedApiPath(cloudId);
224
- _context2.prev = 1;
225
- _context2.next = 4;
226
- return fetch("".concat(maybeShardedApiPath, "/workspace/existsWithWorkspaceType?cloudId=").concat(cloudId), {
201
+ _context2.prev = 0;
202
+ _context2.next = 3;
203
+ return fetch("".concat(this.getShardedApiPath(cloudId), "/workspace/existsWithWorkspaceType?cloudId=").concat(cloudId), {
227
204
  credentials: 'include'
228
205
  });
229
- case 4:
206
+ case 3:
230
207
  response = _context2.sent;
231
208
  if (!response.ok) {
232
- _context2.next = 10;
209
+ _context2.next = 9;
233
210
  break;
234
211
  }
235
- _context2.next = 8;
212
+ _context2.next = 7;
236
213
  return response.text();
237
- case 8:
214
+ case 7:
238
215
  workspaceType = _context2.sent;
239
216
  return _context2.abrupt("return", Promise.resolve(workspaceType === 'GLOBAL_EXPERIENCE'));
240
- case 10:
217
+ case 9:
241
218
  return _context2.abrupt("return", Promise.resolve(false));
242
- case 13:
243
- _context2.prev = 13;
244
- _context2.t0 = _context2["catch"](1);
219
+ case 12:
220
+ _context2.prev = 12;
221
+ _context2.t0 = _context2["catch"](0);
245
222
  return _context2.abrupt("return", Promise.resolve(false));
246
- case 16:
223
+ case 15:
247
224
  case "end":
248
225
  return _context2.stop();
249
226
  }
250
- }, _callee2, this, [[1, 13]]);
227
+ }, _callee2, this, [[0, 12]]);
251
228
  }));
252
229
  function isGlobalExperienceWorkspaceForCloudId(_x2) {
253
230
  return _isGlobalExperienceWorkspaceForCloudId.apply(this, arguments);
@@ -257,9 +234,6 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
257
234
  }, {
258
235
  key: "preloadOrgId",
259
236
  value: function preloadOrgId(gatewayGraphqlUrl, cloudId, orgId) {
260
- if (!fg('enable_ptc_sharded_townsquare_calls')) {
261
- return Promise.resolve(null);
262
- }
263
237
  if (cloudId === undefined) {
264
238
  return Promise.resolve(null);
265
239
  }
@@ -275,10 +249,9 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
275
249
  return orgIdForCloudIdPromise;
276
250
  }
277
251
  }, {
278
- key: "getMaybeShardedApiPath",
279
- value: function getMaybeShardedApiPath(cloudId) {
280
- var maybeShardedPath = fg('enable_ptc_sharded_townsquare_calls') ? "/townsquare/s/".concat(cloudId) : '/watermelon';
281
- return "/gateway/api".concat(maybeShardedPath);
252
+ key: "getShardedApiPath",
253
+ value: function getShardedApiPath(cloudId) {
254
+ return "/gateway/api/townsquare/s/".concat(cloudId);
282
255
  }
283
256
  }, {
284
257
  key: "filterReportingLinesUser",
@@ -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', "20.14.0");
7
+ headers.append('atl-client-version', "21.0.0");
8
8
  return headers;
9
9
  };
10
10
  export function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -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.14.0");
51
+ headers.append('atl-client-version', "21.0.0");
52
52
  return headers;
53
53
  };
54
54
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -94,7 +94,6 @@ 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',
98
97
  gatewayGraphqlUrl: 'defaultGatewayGraphqlUrl'
99
98
  }))
100
99
  }, clients));
@@ -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.14.0"
42
+ packageVersion: "21.0.0"
43
43
  }, attributes), {}, {
44
44
  firedAt: Math.round(getPageTime())
45
45
  })
@@ -15,13 +15,6 @@ export type TeamCentralCardClientOptions = CacheConfig & {
15
15
  */
16
16
  orgId?: string;
17
17
  teamCentralDisabled?: boolean;
18
- /**
19
- * @deprecated
20
- * Enables Team Central functionality if enabled e.g. /gateway/api/watermelon/graphql
21
- */
22
- teamCentralUrl?: string;
23
- /** URL to the Team Central app e.g. team.atlassian.com */
24
- teamCentralBaseUrl?: string;
25
18
  };
26
19
  declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLinesData> {
27
20
  options: TeamCentralCardClientOptions;
@@ -51,7 +44,7 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
51
44
  private hasTCWorkspace;
52
45
  private isGlobalExperienceWorkspaceForCloudId;
53
46
  private preloadOrgId;
54
- private getMaybeShardedApiPath;
47
+ private getShardedApiPath;
55
48
  private filterReportingLinesUser;
56
49
  }
57
50
  export default TeamCentralCardClient;
@@ -15,13 +15,6 @@ export type TeamCentralCardClientOptions = CacheConfig & {
15
15
  */
16
16
  orgId?: string;
17
17
  teamCentralDisabled?: boolean;
18
- /**
19
- * @deprecated
20
- * Enables Team Central functionality if enabled e.g. /gateway/api/watermelon/graphql
21
- */
22
- teamCentralUrl?: string;
23
- /** URL to the Team Central app e.g. team.atlassian.com */
24
- teamCentralBaseUrl?: string;
25
18
  };
26
19
  declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLinesData> {
27
20
  options: TeamCentralCardClientOptions;
@@ -51,7 +44,7 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
51
44
  private hasTCWorkspace;
52
45
  private isGlobalExperienceWorkspaceForCloudId;
53
46
  private preloadOrgId;
54
- private getMaybeShardedApiPath;
47
+ private getShardedApiPath;
55
48
  private filterReportingLinesUser;
56
49
  }
57
50
  export default TeamCentralCardClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "20.14.0",
3
+ "version": "21.0.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -122,9 +122,6 @@
122
122
  "enable_appropriate_reading_order_in_profile_card": {
123
123
  "type": "boolean"
124
124
  },
125
- "enable_ptc_sharded_townsquare_calls": {
126
- "type": "boolean"
127
- },
128
125
  "enable_agent_profile_card": {
129
126
  "type": "boolean"
130
127
  },