@atlaskit/smart-user-picker 8.0.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlassian/smart-user-picker
2
2
 
3
+ ## 8.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#139492](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139492)
8
+ [`27030518ad18e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/27030518ad18e) -
9
+ The SmartUserPicker currently calls the teams v3 api which has been deprecated since December,
10
+ resulting in 404 api calls. This change has updated the api from v3 to v4 so that api calls can be
11
+ made and data successfull retrieved.
12
+
3
13
  ## 8.0.0
4
14
 
5
15
  ### Major Changes
@@ -11,7 +11,7 @@ var _uuid = require("uuid");
11
11
  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; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
13
  var packageName = "@atlaskit/smart-user-picker";
14
- var packageVersion = "8.0.0";
14
+ var packageVersion = "8.0.1";
15
15
  var startSession = exports.startSession = function startSession() {
16
16
  return {
17
17
  id: (0, _uuid.v4)(),
@@ -380,7 +380,7 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
380
380
  case 0:
381
381
  _context2.prev = 0;
382
382
  _context2.next = 3;
383
- return (0, _service.hydrateDefaultValues)(this.props.baseUrl, this.props.defaultValue, this.props.productKey);
383
+ return (0, _service.hydrateDefaultValues)(this.props.baseUrl, this.props.defaultValue, this.props.productKey, this.props.siteId);
384
384
  case 3:
385
385
  value = _context2.sent;
386
386
  this.setState({
@@ -15,7 +15,7 @@ var config = exports.config = {
15
15
  getGraphQLUrl: function getGraphQLUrl(baseUrl) {
16
16
  return baseUrl ? "".concat(baseUrl, "/gateway/api/graphql") : "/gateway/api/graphql";
17
17
  },
18
- getTeamsUrl: function getTeamsUrl(baseUrl) {
19
- return baseUrl ? "".concat(baseUrl, "/gateway/api/v3/teams") : "/gateway/api/v3/teams";
18
+ getTeamsUrl: function getTeamsUrl(id, baseUrl, siteId) {
19
+ return baseUrl ? "".concat(baseUrl, "/gateway/api/v4/teams/").concat(id, "?siteId=").concat(siteId !== null && siteId !== void 0 ? siteId : 'None') : "/gateway/api/v4/teams/".concat(id, "?siteId=").concat(siteId !== null && siteId !== void 0 ? siteId : 'None');
20
20
  }
21
21
  };
@@ -93,7 +93,7 @@ var isOptionData = function isOptionData(option) {
93
93
  return option.name !== undefined;
94
94
  };
95
95
  var hydrateTeamIds = /*#__PURE__*/function () {
96
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(baseUrl, values) {
96
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(baseUrl, values, siteId) {
97
97
  var legionPromises;
98
98
  return _regenerator.default.wrap(function _callee$(_context) {
99
99
  while (1) switch (_context.prev = _context.next) {
@@ -107,7 +107,8 @@ var hydrateTeamIds = /*#__PURE__*/function () {
107
107
  legionPromises = values.map(function (value) {
108
108
  return (0, _teamsClient.default)({
109
109
  baseUrl: baseUrl,
110
- id: value.id
110
+ id: value.id,
111
+ siteId: siteId
111
112
  });
112
113
  });
113
114
  _context.next = 5;
@@ -120,7 +121,7 @@ var hydrateTeamIds = /*#__PURE__*/function () {
120
121
  }
121
122
  }, _callee);
122
123
  }));
123
- return function hydrateTeamIds(_x, _x2) {
124
+ return function hydrateTeamIds(_x, _x2, _x3) {
124
125
  return _ref.apply(this, arguments);
125
126
  };
126
127
  }();
@@ -166,15 +167,15 @@ var hydrateAccountIds = /*#__PURE__*/function () {
166
167
  }
167
168
  }, _callee2);
168
169
  }));
169
- return function hydrateAccountIds(_x3, _x4, _x5) {
170
+ return function hydrateAccountIds(_x4, _x5, _x6) {
170
171
  return _ref2.apply(this, arguments);
171
172
  };
172
173
  }();
173
- function hydrateDefaultValues(_x6, _x7, _x8) {
174
+ function hydrateDefaultValues(_x7, _x8, _x9, _x10) {
174
175
  return _hydrateDefaultValues.apply(this, arguments);
175
176
  }
176
177
  function _hydrateDefaultValues() {
177
- _hydrateDefaultValues = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(baseUrl, value, productKey) {
178
+ _hydrateDefaultValues = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(baseUrl, value, productKey, siteId) {
178
179
  var values, _yield$Promise$all, _yield$Promise$all2, hydratedUsers, hydratedTeams, hydratedOptions;
179
180
  return _regenerator.default.wrap(function _callee3$(_context3) {
180
181
  while (1) switch (_context3.prev = _context3.next) {
@@ -199,7 +200,7 @@ function _hydrateDefaultValues() {
199
200
  return !isOptionData(val) && val.type === 'user';
200
201
  })), hydrateTeamIds(baseUrl, values.filter(function (val) {
201
202
  return !isOptionData(val) && val.type === 'team';
202
- }))]);
203
+ }), siteId)]);
203
204
  case 7:
204
205
  _yield$Promise$all = _context3.sent;
205
206
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
@@ -19,7 +19,7 @@ var transformTeam = function transformTeam(team, id) {
19
19
  };
20
20
  };
21
21
  var hydrateTeamFromLegion = function hydrateTeamFromLegion(request) {
22
- var url = "".concat(_config.config.getTeamsUrl(request.baseUrl), "/").concat(request.id);
22
+ var url = _config.config.getTeamsUrl(request.id, request.baseUrl, request.siteId);
23
23
  return fetch(url, {
24
24
  method: 'GET',
25
25
  credentials: 'include',
@@ -1,7 +1,7 @@
1
1
  import { createAndFireEvent } from '@atlaskit/analytics-next';
2
2
  import { v4 as uuid } from 'uuid';
3
3
  const packageName = "@atlaskit/smart-user-picker";
4
- const packageVersion = "8.0.0";
4
+ const packageVersion = "8.0.1";
5
5
  export const startSession = () => ({
6
6
  id: uuid(),
7
7
  start: Date.now(),
@@ -284,7 +284,7 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
284
284
  }
285
285
  async componentDidMount() {
286
286
  try {
287
- const value = await hydrateDefaultValues(this.props.baseUrl, this.props.defaultValue, this.props.productKey);
287
+ const value = await hydrateDefaultValues(this.props.baseUrl, this.props.defaultValue, this.props.productKey, this.props.siteId);
288
288
  this.setState({
289
289
  defaultValue: value
290
290
  });
@@ -8,7 +8,7 @@ export const config = {
8
8
  getGraphQLUrl(baseUrl) {
9
9
  return baseUrl ? `${baseUrl}/gateway/api/graphql` : `/gateway/api/graphql`;
10
10
  },
11
- getTeamsUrl(baseUrl) {
12
- return baseUrl ? `${baseUrl}/gateway/api/v3/teams` : `/gateway/api/v3/teams`;
11
+ getTeamsUrl(id, baseUrl, siteId) {
12
+ return baseUrl ? `${baseUrl}/gateway/api/v4/teams/${id}?siteId=${siteId !== null && siteId !== void 0 ? siteId : 'None'}` : `/gateway/api/v4/teams/${id}?siteId=${siteId !== null && siteId !== void 0 ? siteId : 'None'}`;
13
13
  }
14
14
  };
@@ -66,13 +66,14 @@ const sortResults = (options, sortIds) => {
66
66
  const isOptionData = option => {
67
67
  return option.name !== undefined;
68
68
  };
69
- const hydrateTeamIds = async (baseUrl, values) => {
69
+ const hydrateTeamIds = async (baseUrl, values, siteId) => {
70
70
  if (values.length === 0) {
71
71
  return [];
72
72
  }
73
73
  const legionPromises = values.map(value => hydrateTeamFromLegion({
74
74
  baseUrl,
75
- id: value.id
75
+ id: value.id,
76
+ siteId
76
77
  }));
77
78
  return await Promise.all(legionPromises);
78
79
  };
@@ -89,7 +90,7 @@ const hydrateAccountIds = async (baseUrl, productKey, values) => {
89
90
  accountIds
90
91
  }) : await getHydratedUsersFromPrs(baseUrl, accountIds);
91
92
  };
92
- async function hydrateDefaultValues(baseUrl, value, productKey) {
93
+ async function hydrateDefaultValues(baseUrl, value, productKey, siteId) {
93
94
  //return if no value
94
95
  if (!value || Array.isArray(value) && value.length === 0) {
95
96
  return [];
@@ -100,7 +101,7 @@ async function hydrateDefaultValues(baseUrl, value, productKey) {
100
101
  if (!values.some(val => !isOptionData(val))) {
101
102
  return value;
102
103
  }
103
- const [hydratedUsers, hydratedTeams] = await Promise.all([hydrateAccountIds(baseUrl, productKey, values.filter(val => !isOptionData(val) && val.type === 'user')), hydrateTeamIds(baseUrl, values.filter(val => !isOptionData(val) && val.type === 'team'))]);
104
+ const [hydratedUsers, hydratedTeams] = await Promise.all([hydrateAccountIds(baseUrl, productKey, values.filter(val => !isOptionData(val) && val.type === 'user')), hydrateTeamIds(baseUrl, values.filter(val => !isOptionData(val) && val.type === 'team'), siteId)]);
104
105
  const hydratedOptions = values.filter(val => isOptionData(val)).map(val => val).concat(hydratedUsers).concat(hydratedTeams);
105
106
  return sortResults(hydratedOptions, values);
106
107
  }
@@ -9,7 +9,7 @@ const transformTeam = (team, id) => {
9
9
  };
10
10
  };
11
11
  const hydrateTeamFromLegion = request => {
12
- const url = `${config.getTeamsUrl(request.baseUrl)}/${request.id}`;
12
+ const url = config.getTeamsUrl(request.id, request.baseUrl, request.siteId);
13
13
  return fetch(url, {
14
14
  method: 'GET',
15
15
  credentials: 'include',
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { createAndFireEvent } from '@atlaskit/analytics-next';
5
5
  import { v4 as uuid } from 'uuid';
6
6
  var packageName = "@atlaskit/smart-user-picker";
7
- var packageVersion = "8.0.0";
7
+ var packageVersion = "8.0.1";
8
8
  export var startSession = function startSession() {
9
9
  return {
10
10
  id: uuid(),
@@ -370,7 +370,7 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
370
370
  case 0:
371
371
  _context2.prev = 0;
372
372
  _context2.next = 3;
373
- return hydrateDefaultValues(this.props.baseUrl, this.props.defaultValue, this.props.productKey);
373
+ return hydrateDefaultValues(this.props.baseUrl, this.props.defaultValue, this.props.productKey, this.props.siteId);
374
374
  case 3:
375
375
  value = _context2.sent;
376
376
  this.setState({
@@ -9,7 +9,7 @@ export var config = {
9
9
  getGraphQLUrl: function getGraphQLUrl(baseUrl) {
10
10
  return baseUrl ? "".concat(baseUrl, "/gateway/api/graphql") : "/gateway/api/graphql";
11
11
  },
12
- getTeamsUrl: function getTeamsUrl(baseUrl) {
13
- return baseUrl ? "".concat(baseUrl, "/gateway/api/v3/teams") : "/gateway/api/v3/teams";
12
+ getTeamsUrl: function getTeamsUrl(id, baseUrl, siteId) {
13
+ return baseUrl ? "".concat(baseUrl, "/gateway/api/v4/teams/").concat(id, "?siteId=").concat(siteId !== null && siteId !== void 0 ? siteId : 'None') : "/gateway/api/v4/teams/".concat(id, "?siteId=").concat(siteId !== null && siteId !== void 0 ? siteId : 'None');
14
14
  }
15
15
  };
@@ -86,7 +86,7 @@ var isOptionData = function isOptionData(option) {
86
86
  return option.name !== undefined;
87
87
  };
88
88
  var hydrateTeamIds = /*#__PURE__*/function () {
89
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(baseUrl, values) {
89
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(baseUrl, values, siteId) {
90
90
  var legionPromises;
91
91
  return _regeneratorRuntime.wrap(function _callee$(_context) {
92
92
  while (1) switch (_context.prev = _context.next) {
@@ -100,7 +100,8 @@ var hydrateTeamIds = /*#__PURE__*/function () {
100
100
  legionPromises = values.map(function (value) {
101
101
  return hydrateTeamFromLegion({
102
102
  baseUrl: baseUrl,
103
- id: value.id
103
+ id: value.id,
104
+ siteId: siteId
104
105
  });
105
106
  });
106
107
  _context.next = 5;
@@ -113,7 +114,7 @@ var hydrateTeamIds = /*#__PURE__*/function () {
113
114
  }
114
115
  }, _callee);
115
116
  }));
116
- return function hydrateTeamIds(_x, _x2) {
117
+ return function hydrateTeamIds(_x, _x2, _x3) {
117
118
  return _ref.apply(this, arguments);
118
119
  };
119
120
  }();
@@ -159,15 +160,15 @@ var hydrateAccountIds = /*#__PURE__*/function () {
159
160
  }
160
161
  }, _callee2);
161
162
  }));
162
- return function hydrateAccountIds(_x3, _x4, _x5) {
163
+ return function hydrateAccountIds(_x4, _x5, _x6) {
163
164
  return _ref2.apply(this, arguments);
164
165
  };
165
166
  }();
166
- function hydrateDefaultValues(_x6, _x7, _x8) {
167
+ function hydrateDefaultValues(_x7, _x8, _x9, _x10) {
167
168
  return _hydrateDefaultValues.apply(this, arguments);
168
169
  }
169
170
  function _hydrateDefaultValues() {
170
- _hydrateDefaultValues = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(baseUrl, value, productKey) {
171
+ _hydrateDefaultValues = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(baseUrl, value, productKey, siteId) {
171
172
  var values, _yield$Promise$all, _yield$Promise$all2, hydratedUsers, hydratedTeams, hydratedOptions;
172
173
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
173
174
  while (1) switch (_context3.prev = _context3.next) {
@@ -192,7 +193,7 @@ function _hydrateDefaultValues() {
192
193
  return !isOptionData(val) && val.type === 'user';
193
194
  })), hydrateTeamIds(baseUrl, values.filter(function (val) {
194
195
  return !isOptionData(val) && val.type === 'team';
195
- }))]);
196
+ }), siteId)]);
196
197
  case 7:
197
198
  _yield$Promise$all = _context3.sent;
198
199
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
@@ -12,7 +12,7 @@ var transformTeam = function transformTeam(team, id) {
12
12
  };
13
13
  };
14
14
  var hydrateTeamFromLegion = function hydrateTeamFromLegion(request) {
15
- var url = "".concat(config.getTeamsUrl(request.baseUrl), "/").concat(request.id);
15
+ var url = config.getTeamsUrl(request.id, request.baseUrl, request.siteId);
16
16
  return fetch(url, {
17
17
  method: 'GET',
18
18
  credentials: 'include',
@@ -2,5 +2,5 @@ export declare const config: {
2
2
  getRecommendationServiceUrl(baseUrl: string): string;
3
3
  getUsersServiceUrl(productKey: string, baseUrl?: string): string;
4
4
  getGraphQLUrl(baseUrl?: string): string;
5
- getTeamsUrl(baseUrl?: string): string;
5
+ getTeamsUrl(id: string, baseUrl?: string, siteId?: string): string;
6
6
  };
@@ -4,5 +4,5 @@ export interface UsersRequest {
4
4
  accountIds: string[];
5
5
  productKey: 'jira' | 'confluence';
6
6
  }
7
- declare function hydrateDefaultValues(baseUrl: string | undefined, value: DefaultValue, productKey: string): Promise<DefaultValue>;
7
+ declare function hydrateDefaultValues(baseUrl: string | undefined, value: DefaultValue, productKey: string, siteId: string | undefined): Promise<DefaultValue>;
8
8
  export default hydrateDefaultValues;
@@ -2,6 +2,7 @@ import { type Team } from '@atlaskit/user-picker';
2
2
  type LegionRequest = {
3
3
  baseUrl?: string;
4
4
  id: string;
5
+ siteId?: string;
5
6
  };
6
7
  export type LegionResponse = {
7
8
  id: string;
@@ -2,5 +2,5 @@ export declare const config: {
2
2
  getRecommendationServiceUrl(baseUrl: string): string;
3
3
  getUsersServiceUrl(productKey: string, baseUrl?: string): string;
4
4
  getGraphQLUrl(baseUrl?: string): string;
5
- getTeamsUrl(baseUrl?: string): string;
5
+ getTeamsUrl(id: string, baseUrl?: string, siteId?: string): string;
6
6
  };
@@ -4,5 +4,5 @@ export interface UsersRequest {
4
4
  accountIds: string[];
5
5
  productKey: 'jira' | 'confluence';
6
6
  }
7
- declare function hydrateDefaultValues(baseUrl: string | undefined, value: DefaultValue, productKey: string): Promise<DefaultValue>;
7
+ declare function hydrateDefaultValues(baseUrl: string | undefined, value: DefaultValue, productKey: string, siteId: string | undefined): Promise<DefaultValue>;
8
8
  export default hydrateDefaultValues;
@@ -2,6 +2,7 @@ import { type Team } from '@atlaskit/user-picker';
2
2
  type LegionRequest = {
3
3
  baseUrl?: string;
4
4
  id: string;
5
+ siteId?: string;
5
6
  };
6
7
  export type LegionResponse = {
7
8
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-user-picker",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,7 +53,7 @@
53
53
  "react-dom": "^18.2.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@atlaskit/select": "^19.0.0",
56
+ "@atlaskit/select": "^20.3.0",
57
57
  "@atlaskit/util-data-test": "^18.0.0",
58
58
  "@testing-library/dom": "^10.1.0",
59
59
  "@testing-library/react": "^13.4.0",