@atlaskit/profilecard 19.25.1 → 19.26.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,13 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 19.26.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#134885](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134885)
8
+ [`17a1076221589`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/17a1076221589) -
9
+ PTC-9930 Removed the check if user is in site
10
+
3
11
  ## 19.25.1
4
12
 
5
13
  ### Patch Changes
@@ -78,19 +78,6 @@ var buildAggUserQuery = exports.buildAggUserQuery = function buildAggUserQuery(u
78
78
  }
79
79
  };
80
80
  };
81
- var getUserInSiteUserBase = function getUserInSiteUserBase(cloudId, userId) {
82
- return fetch(new Request("/gateway/api/teams/site/".concat(cloudId, "/users/").concat(userId, "/exists"), {
83
- method: 'GET',
84
- credentials: 'include',
85
- mode: 'cors',
86
- headers: {
87
- Accept: 'application/json',
88
- 'X-header-client-id': 'ptc-fe'
89
- }
90
- })).then(function (response) {
91
- return response.json();
92
- });
93
- };
94
81
  var queryAGGUser = /*#__PURE__*/function () {
95
82
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, userId) {
96
83
  var query, _yield$AGGQuery, user;
@@ -128,30 +115,19 @@ var UserProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
128
115
  key: "makeRequest",
129
116
  value: function () {
130
117
  var _makeRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(cloudId, userId) {
131
- var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5, gatewayGraphqlUrl, userCheckPromise, userQueryPromise, checkUserPresentInSiteRes, user, timestring, localWeekdayIndex, query, response;
118
+ var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5, gatewayGraphqlUrl, userQueryPromise, user, timestring, localWeekdayIndex, query, response;
132
119
  return _regenerator.default.wrap(function _callee2$(_context2) {
133
120
  while (1) switch (_context2.prev = _context2.next) {
134
121
  case 0:
135
122
  if (!(0, _platformFeatureFlags.fg)('migrate_cloud_user_to_agg_user_query_profile_card')) {
136
- _context2.next = 17;
123
+ _context2.next = 11;
137
124
  break;
138
125
  }
139
126
  gatewayGraphqlUrl = this.options.gatewayGraphqlUrl || '/gateway/api/graphql';
140
- userCheckPromise = getUserInSiteUserBase(cloudId, userId);
141
127
  userQueryPromise = queryAGGUser(gatewayGraphqlUrl, userId);
142
- _context2.next = 6;
143
- return userCheckPromise;
144
- case 6:
145
- checkUserPresentInSiteRes = _context2.sent;
146
- if (checkUserPresentInSiteRes.isPresent) {
147
- _context2.next = 9;
148
- break;
149
- }
150
- throw new Error('Unable to fetch user: User does not exist in this site');
151
- case 9:
152
- _context2.next = 11;
128
+ _context2.next = 5;
153
129
  return userQueryPromise;
154
- case 11:
130
+ case 5:
155
131
  user = _context2.sent;
156
132
  localWeekdayIndex = new Date().getDay().toString();
157
133
  if (user.zoneinfo) {
@@ -175,20 +151,20 @@ var UserProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
175
151
  companyName: (_user$extendedProfile5 = user.extendedProfile) === null || _user$extendedProfile5 === void 0 ? void 0 : _user$extendedProfile5.organization,
176
152
  timestring: timestring
177
153
  }));
178
- case 17:
154
+ case 11:
179
155
  if (this.options.url) {
180
- _context2.next = 19;
156
+ _context2.next = 13;
181
157
  break;
182
158
  }
183
159
  throw new Error('options.url is a required parameter');
184
- case 19:
160
+ case 13:
185
161
  query = buildUserQuery(cloudId, userId);
186
- _context2.next = 22;
162
+ _context2.next = 16;
187
163
  return (0, _graphqlUtils.directoryGraphqlQuery)(this.options.url, query);
188
- case 22:
164
+ case 16:
189
165
  response = _context2.sent;
190
166
  return _context2.abrupt("return", modifyResponse(response));
191
- case 24:
167
+ case 18:
192
168
  case "end":
193
169
  return _context2.stop();
194
170
  }
@@ -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', "19.25.1");
60
+ headers.append('atl-client-version', "19.26.0");
61
61
  return headers;
62
62
  };
63
63
  function getTeamFromAGG(_x, _x2, _x3) {
@@ -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: "19.25.1"
48
+ packageVersion: "19.26.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: Math.round((0, _performance.getPageTime)())
51
51
  })
@@ -104,17 +104,6 @@ export const buildAggUserQuery = userId => ({
104
104
  userId
105
105
  }
106
106
  });
107
- const getUserInSiteUserBase = (cloudId, userId) => {
108
- return fetch(new Request(`/gateway/api/teams/site/${cloudId}/users/${userId}/exists`, {
109
- method: 'GET',
110
- credentials: 'include',
111
- mode: 'cors',
112
- headers: {
113
- Accept: 'application/json',
114
- 'X-header-client-id': 'ptc-fe'
115
- }
116
- })).then(response => response.json());
117
- };
118
107
  const queryAGGUser = async (url, userId) => {
119
108
  const query = buildAggUserQuery(userId);
120
109
  const {
@@ -131,13 +120,7 @@ export default class UserProfileCardClient extends CachingClient {
131
120
  if (fg('migrate_cloud_user_to_agg_user_query_profile_card')) {
132
121
  var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5;
133
122
  const gatewayGraphqlUrl = this.options.gatewayGraphqlUrl || '/gateway/api/graphql';
134
- const userCheckPromise = getUserInSiteUserBase(cloudId, userId);
135
123
  const userQueryPromise = queryAGGUser(gatewayGraphqlUrl, userId);
136
- const checkUserPresentInSiteRes = await userCheckPromise;
137
- if (!checkUserPresentInSiteRes.isPresent) {
138
- // Use this error message to not trouble SLO, check out getErrorAttributes for reference
139
- throw new Error('Unable to fetch user: User does not exist in this site');
140
- }
141
124
  const user = await userQueryPromise;
142
125
  let timestring;
143
126
  const localWeekdayIndex = new Date().getDay().toString();
@@ -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', "19.25.1");
70
+ headers.append('atl-client-version', "19.26.0");
71
71
  return headers;
72
72
  };
73
73
  export async function getTeamFromAGG(url, teamId, siteId) {
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
32
32
  actionSubjectId,
33
33
  attributes: {
34
34
  packageName: "@atlaskit/profilecard",
35
- packageVersion: "19.25.1",
35
+ packageVersion: "19.26.0",
36
36
  ...attributes,
37
37
  firedAt: Math.round(getPageTime())
38
38
  }
@@ -72,19 +72,6 @@ export var buildAggUserQuery = function buildAggUserQuery(userId) {
72
72
  }
73
73
  };
74
74
  };
75
- var getUserInSiteUserBase = function getUserInSiteUserBase(cloudId, userId) {
76
- return fetch(new Request("/gateway/api/teams/site/".concat(cloudId, "/users/").concat(userId, "/exists"), {
77
- method: 'GET',
78
- credentials: 'include',
79
- mode: 'cors',
80
- headers: {
81
- Accept: 'application/json',
82
- 'X-header-client-id': 'ptc-fe'
83
- }
84
- })).then(function (response) {
85
- return response.json();
86
- });
87
- };
88
75
  var queryAGGUser = /*#__PURE__*/function () {
89
76
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, userId) {
90
77
  var query, _yield$AGGQuery, user;
@@ -122,30 +109,19 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
122
109
  key: "makeRequest",
123
110
  value: function () {
124
111
  var _makeRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cloudId, userId) {
125
- var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5, gatewayGraphqlUrl, userCheckPromise, userQueryPromise, checkUserPresentInSiteRes, user, timestring, localWeekdayIndex, query, response;
112
+ var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5, gatewayGraphqlUrl, userQueryPromise, user, timestring, localWeekdayIndex, query, response;
126
113
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
127
114
  while (1) switch (_context2.prev = _context2.next) {
128
115
  case 0:
129
116
  if (!fg('migrate_cloud_user_to_agg_user_query_profile_card')) {
130
- _context2.next = 17;
117
+ _context2.next = 11;
131
118
  break;
132
119
  }
133
120
  gatewayGraphqlUrl = this.options.gatewayGraphqlUrl || '/gateway/api/graphql';
134
- userCheckPromise = getUserInSiteUserBase(cloudId, userId);
135
121
  userQueryPromise = queryAGGUser(gatewayGraphqlUrl, userId);
136
- _context2.next = 6;
137
- return userCheckPromise;
138
- case 6:
139
- checkUserPresentInSiteRes = _context2.sent;
140
- if (checkUserPresentInSiteRes.isPresent) {
141
- _context2.next = 9;
142
- break;
143
- }
144
- throw new Error('Unable to fetch user: User does not exist in this site');
145
- case 9:
146
- _context2.next = 11;
122
+ _context2.next = 5;
147
123
  return userQueryPromise;
148
- case 11:
124
+ case 5:
149
125
  user = _context2.sent;
150
126
  localWeekdayIndex = new Date().getDay().toString();
151
127
  if (user.zoneinfo) {
@@ -169,20 +145,20 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
169
145
  companyName: (_user$extendedProfile5 = user.extendedProfile) === null || _user$extendedProfile5 === void 0 ? void 0 : _user$extendedProfile5.organization,
170
146
  timestring: timestring
171
147
  }));
172
- case 17:
148
+ case 11:
173
149
  if (this.options.url) {
174
- _context2.next = 19;
150
+ _context2.next = 13;
175
151
  break;
176
152
  }
177
153
  throw new Error('options.url is a required parameter');
178
- case 19:
154
+ case 13:
179
155
  query = buildUserQuery(cloudId, userId);
180
- _context2.next = 22;
156
+ _context2.next = 16;
181
157
  return directoryGraphqlQuery(this.options.url, query);
182
- case 22:
158
+ case 16:
183
159
  response = _context2.sent;
184
160
  return _context2.abrupt("return", modifyResponse(response));
185
- case 24:
161
+ case 18:
186
162
  case "end":
187
163
  return _context2.stop();
188
164
  }
@@ -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', "19.25.1");
51
+ headers.append('atl-client-version', "19.26.0");
52
52
  return headers;
53
53
  };
54
54
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -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: "19.25.1"
42
+ packageVersion: "19.26.0"
43
43
  }, attributes), {}, {
44
44
  firedAt: Math.round(getPageTime())
45
45
  })
@@ -497,7 +497,4 @@ export type TeamsUserQueryResponse = {
497
497
  };
498
498
  appType?: string;
499
499
  };
500
- export interface UserInSiteUserbase {
501
- isPresent: boolean;
502
- }
503
500
  export {};
@@ -503,7 +503,4 @@ export type TeamsUserQueryResponse = {
503
503
  };
504
504
  appType?: string;
505
505
  };
506
- export interface UserInSiteUserbase {
507
- isPresent: boolean;
508
- }
509
506
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.25.1",
3
+ "version": "19.26.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"