@atlaskit/smart-user-picker 5.1.2 → 6.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,23 @@
1
1
  # @atlassian/smart-user-picker
2
2
 
3
+ ## 6.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
8
+
9
+ ## 6.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`be2c0ae7ba4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/be2c0ae7ba4) - The `setSmartUserPickerEnv` export has been removed. This should be a no-op upgrade as it was only used internally for test/example files in other packages.
14
+
15
+ ## 5.1.3
16
+
17
+ ### Patch Changes
18
+
19
+ - [`977329d177c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/977329d177c) - Import version json and use attributes rather than importing directly
20
+
3
21
  ## 5.1.2
4
22
 
5
23
  ### Patch Changes
@@ -13,12 +13,15 @@ var _analyticsNext = require("@atlaskit/analytics-next");
13
13
 
14
14
  var _uuid = require("uuid");
15
15
 
16
- var _version = require("./version.json");
16
+ var _version = _interopRequireDefault(require("./version.json"));
17
17
 
18
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
19
 
20
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
21
 
22
+ var packageName = _version.default.name;
23
+ var packageVersion = _version.default.version;
24
+
22
25
  var startSession = function startSession() {
23
26
  return {
24
27
  id: (0, _uuid.v4)(),
@@ -41,8 +44,8 @@ var createEvent = function createEvent(eventType, action, actionSubject) {
41
44
  action: action,
42
45
  actionSubject: actionSubject,
43
46
  attributes: _objectSpread({
44
- packageName: _version.name,
45
- packageVersion: _version.version
47
+ packageName: packageName,
48
+ packageVersion: packageVersion
46
49
  }, attributes)
47
50
  };
48
51
  };
@@ -3,24 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setSmartUserPickerEnv = exports.getConfig = void 0;
7
- var env = 'prod';
8
- var STG_INSTANCE = 'https://api-private.stg.atlassian.com';
9
- var LOCAL_CONFIG = {
10
- getRecommendationServiceUrl: function getRecommendationServiceUrl(baseUrl) {
11
- return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/gateway/api/v1/recommendations") : "".concat(STG_INSTANCE, "/gateway/api/v1/recommendations");
12
- },
13
- getUsersServiceUrl: function getUsersServiceUrl(productKey) {
14
- return productKey === 'jira' ? "https://jdog.jira-dev.com/rest/api/3/user/bulk" : "https://pug.jira-dev.com/wiki/rest/api/user/bulk";
15
- },
16
- getGraphQLUrl: function getGraphQLUrl(baseUrl) {
17
- return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/gateway/api/graphql") : "".concat(STG_INSTANCE, "/gateway/api/graphql");
18
- },
19
- getTeamsUrl: function getTeamsUrl(baseUrl) {
20
- return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/gateway/api/v3/teams") : "".concat(STG_INSTANCE, "/gateway/api/v3/teams");
21
- }
22
- };
23
- var PRD_CONFIG = {
6
+ exports.config = void 0;
7
+ var config = {
24
8
  getRecommendationServiceUrl: function getRecommendationServiceUrl(baseUrl) {
25
9
  return baseUrl ? "".concat(baseUrl, "/gateway/api/v1/recommendations") : '/gateway/api/v1/recommendations';
26
10
  },
@@ -34,17 +18,5 @@ var PRD_CONFIG = {
34
18
  getTeamsUrl: function getTeamsUrl(baseUrl) {
35
19
  return baseUrl ? "".concat(baseUrl, "/gateway/api/v3/teams") : "/gateway/api/v3/teams";
36
20
  }
37
- }; // TODO remove this once no external code is calling it
38
-
39
- var setSmartUserPickerEnv = function setSmartUserPickerEnv(newEnv) {
40
- return env = newEnv;
41
- }; // TODO remove this once no external code is calling it
42
-
43
-
44
- exports.setSmartUserPickerEnv = setSmartUserPickerEnv;
45
-
46
- var getConfig = function getConfig() {
47
- return env === 'local' ? LOCAL_CONFIG : PRD_CONFIG;
48
21
  };
49
-
50
- exports.getConfig = getConfig;
22
+ exports.config = config;
package/dist/cjs/index.js CHANGED
@@ -71,17 +71,9 @@ Object.defineProperty(exports, "isValidEmail", {
71
71
  return _userPicker.isValidEmail;
72
72
  }
73
73
  });
74
- Object.defineProperty(exports, "setSmartUserPickerEnv", {
75
- enumerable: true,
76
- get: function get() {
77
- return _config.setSmartUserPickerEnv;
78
- }
79
- });
80
74
 
81
75
  var _components = _interopRequireDefault(require("./components"));
82
76
 
83
77
  var _service = require("./service");
84
78
 
85
- var _userPicker = require("@atlaskit/user-picker");
86
-
87
- var _config = require("./config");
79
+ var _userPicker = require("@atlaskit/user-picker");
@@ -24,7 +24,7 @@ var _teamsClient = _interopRequireDefault(require("./teams-client"));
24
24
  var _constants = require("./constants");
25
25
 
26
26
  var getHydratedUsersFromProducts = function getHydratedUsersFromProducts(request) {
27
- var url = "".concat((0, _config.getConfig)().getUsersServiceUrl(request.productKey, request.baseUrl));
27
+ var url = "".concat(_config.config.getUsersServiceUrl(request.productKey, request.baseUrl));
28
28
  var params = new URLSearchParams();
29
29
  request.accountIds.map(function (id) {
30
30
  return params.append('accountId', id);
@@ -20,7 +20,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
20
20
  var getUserRecommendations = function getUserRecommendations(request, intl) {
21
21
  var _request$context, _request$context$prod;
22
22
 
23
- var url = (0, _config.getConfig)().getRecommendationServiceUrl(request.baseUrl || '');
23
+ var url = _config.config.getRecommendationServiceUrl(request.baseUrl || '');
24
+
24
25
  return fetch(url, {
25
26
  method: 'POST',
26
27
  credentials: 'include',
@@ -27,7 +27,7 @@ var transformTeam = function transformTeam(team, id) {
27
27
  };
28
28
 
29
29
  var hydrateTeamFromLegion = function hydrateTeamFromLegion(request) {
30
- var url = "".concat((0, _config.getConfig)().getTeamsUrl(request.baseUrl), "/").concat(request.id);
30
+ var url = "".concat(_config.config.getTeamsUrl(request.baseUrl), "/").concat(request.id);
31
31
  return fetch(url, {
32
32
  method: 'GET',
33
33
  credentials: 'include',
@@ -78,7 +78,8 @@ var modifyResponse = function modifyResponse(users) {
78
78
  };
79
79
 
80
80
  var getHydratedUsers = function getHydratedUsers(baseUrl, userIds) {
81
- var url = (0, _config.getConfig)().getGraphQLUrl(baseUrl);
81
+ var url = _config.config.getGraphQLUrl(baseUrl);
82
+
82
83
  return new Promise(function (resolve) {
83
84
  makeRequest(url, userIds).then(function (data) {
84
85
  resolve(modifyResponse(data.users));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-user-picker",
3
- "version": "5.1.2",
3
+ "version": "6.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,8 @@
1
1
  import { createAndFireEvent } from '@atlaskit/analytics-next';
2
2
  import { v4 as uuid } from 'uuid';
3
- import { name as packageName, version as packageVersion } from './version.json';
3
+ import versionJson from './version.json';
4
+ const packageName = versionJson.name;
5
+ const packageVersion = versionJson.version;
4
6
  export const startSession = () => ({
5
7
  id: uuid(),
6
8
  start: Date.now(),
@@ -1,24 +1,4 @@
1
- let env = 'prod';
2
- const STG_INSTANCE = 'https://api-private.stg.atlassian.com';
3
- const LOCAL_CONFIG = {
4
- getRecommendationServiceUrl(baseUrl) {
5
- return baseUrl ? `${STG_INSTANCE}/${baseUrl}/gateway/api/v1/recommendations` : `${STG_INSTANCE}/gateway/api/v1/recommendations`;
6
- },
7
-
8
- getUsersServiceUrl(productKey) {
9
- return productKey === 'jira' ? `https://jdog.jira-dev.com/rest/api/3/user/bulk` : `https://pug.jira-dev.com/wiki/rest/api/user/bulk`;
10
- },
11
-
12
- getGraphQLUrl(baseUrl) {
13
- return baseUrl ? `${STG_INSTANCE}/${baseUrl}/gateway/api/graphql` : `${STG_INSTANCE}/gateway/api/graphql`;
14
- },
15
-
16
- getTeamsUrl(baseUrl) {
17
- return baseUrl ? `${STG_INSTANCE}/${baseUrl}/gateway/api/v3/teams` : `${STG_INSTANCE}/gateway/api/v3/teams`;
18
- }
19
-
20
- };
21
- const PRD_CONFIG = {
1
+ export const config = {
22
2
  getRecommendationServiceUrl(baseUrl) {
23
3
  return baseUrl ? `${baseUrl}/gateway/api/v1/recommendations` : '/gateway/api/v1/recommendations';
24
4
  },
@@ -35,8 +15,4 @@ const PRD_CONFIG = {
35
15
  return baseUrl ? `${baseUrl}/gateway/api/v3/teams` : `/gateway/api/v3/teams`;
36
16
  }
37
17
 
38
- }; // TODO remove this once no external code is calling it
39
-
40
- export const setSmartUserPickerEnv = newEnv => env = newEnv; // TODO remove this once no external code is calling it
41
-
42
- export const getConfig = () => env === 'local' ? LOCAL_CONFIG : PRD_CONFIG;
18
+ };
@@ -2,5 +2,4 @@ export { default } from './components';
2
2
  export { getUserRecommendations, hydrateDefaultValues } from './service';
3
3
  export { //Utils
4
4
  isEmail, isTeam, isUser, isValidEmail, // Constants
5
- EmailType, GroupType, TeamType, UserType } from '@atlaskit/user-picker';
6
- export { setSmartUserPickerEnv } from './config';
5
+ EmailType, GroupType, TeamType, UserType } from '@atlaskit/user-picker';
@@ -1,11 +1,11 @@
1
1
  import { UserType } from '@atlaskit/user-picker';
2
- import { getConfig } from '../config';
2
+ import { config } from '../config';
3
3
  import getHydratedUsersFromPrs from './users-client';
4
4
  import hydrateTeamFromLegion from './teams-client';
5
5
  import { UNKNOWN } from './constants';
6
6
 
7
7
  const getHydratedUsersFromProducts = request => {
8
- const url = `${getConfig().getUsersServiceUrl(request.productKey, request.baseUrl)}`;
8
+ const url = `${config.getUsersServiceUrl(request.productKey, request.baseUrl)}`;
9
9
  let params = new URLSearchParams();
10
10
  request.accountIds.map(id => params.append('accountId', id));
11
11
  params.append('maxResults', '2000');
@@ -1,10 +1,10 @@
1
1
  import { transformUsers } from './users-transformer';
2
- import { getConfig } from '../config';
2
+ import { config } from '../config';
3
3
 
4
4
  const getUserRecommendations = (request, intl) => {
5
5
  var _request$context, _request$context$prod;
6
6
 
7
- const url = getConfig().getRecommendationServiceUrl(request.baseUrl || '');
7
+ const url = config.getRecommendationServiceUrl(request.baseUrl || '');
8
8
  return fetch(url, {
9
9
  method: 'POST',
10
10
  credentials: 'include',
@@ -1,4 +1,4 @@
1
- import { getConfig } from '../config';
1
+ import { config } from '../config';
2
2
  import { UNKNOWN_TEAM } from './constants';
3
3
 
4
4
  const transformTeam = (team, id) => {
@@ -11,7 +11,7 @@ const transformTeam = (team, id) => {
11
11
  };
12
12
 
13
13
  const hydrateTeamFromLegion = request => {
14
- const url = `${getConfig().getTeamsUrl(request.baseUrl)}/${request.id}`;
14
+ const url = `${config.getTeamsUrl(request.baseUrl)}/${request.id}`;
15
15
  return fetch(url, {
16
16
  method: 'GET',
17
17
  credentials: 'include',
@@ -1,6 +1,6 @@
1
1
  import { UNKNOWN_USER } from './constants';
2
2
  import { graphqlQuery } from './graphqlUtils';
3
- import { getConfig } from '../config';
3
+ import { config } from '../config';
4
4
 
5
5
  /**
6
6
  * @param {string} accountIds ids to hydrate
@@ -36,7 +36,7 @@ const modifyResponse = users => users.map(({
36
36
  }));
37
37
 
38
38
  const getHydratedUsers = (baseUrl, userIds) => {
39
- const url = getConfig().getGraphQLUrl(baseUrl);
39
+ const url = config.getGraphQLUrl(baseUrl);
40
40
  return new Promise(resolve => {
41
41
  makeRequest(url, userIds).then(data => {
42
42
  resolve(modifyResponse(data.users));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-user-picker",
3
- "version": "5.1.2",
3
+ "version": "6.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  import { createAndFireEvent } from '@atlaskit/analytics-next';
8
8
  import { v4 as uuid } from 'uuid';
9
- import { name as packageName, version as packageVersion } from './version.json';
9
+ import versionJson from './version.json';
10
+ var packageName = versionJson.name;
11
+ var packageVersion = versionJson.version;
10
12
  export var startSession = function startSession() {
11
13
  return {
12
14
  id: uuid(),
@@ -1,20 +1,4 @@
1
- var env = 'prod';
2
- var STG_INSTANCE = 'https://api-private.stg.atlassian.com';
3
- var LOCAL_CONFIG = {
4
- getRecommendationServiceUrl: function getRecommendationServiceUrl(baseUrl) {
5
- return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/gateway/api/v1/recommendations") : "".concat(STG_INSTANCE, "/gateway/api/v1/recommendations");
6
- },
7
- getUsersServiceUrl: function getUsersServiceUrl(productKey) {
8
- return productKey === 'jira' ? "https://jdog.jira-dev.com/rest/api/3/user/bulk" : "https://pug.jira-dev.com/wiki/rest/api/user/bulk";
9
- },
10
- getGraphQLUrl: function getGraphQLUrl(baseUrl) {
11
- return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/gateway/api/graphql") : "".concat(STG_INSTANCE, "/gateway/api/graphql");
12
- },
13
- getTeamsUrl: function getTeamsUrl(baseUrl) {
14
- return baseUrl ? "".concat(STG_INSTANCE, "/").concat(baseUrl, "/gateway/api/v3/teams") : "".concat(STG_INSTANCE, "/gateway/api/v3/teams");
15
- }
16
- };
17
- var PRD_CONFIG = {
1
+ export var config = {
18
2
  getRecommendationServiceUrl: function getRecommendationServiceUrl(baseUrl) {
19
3
  return baseUrl ? "".concat(baseUrl, "/gateway/api/v1/recommendations") : '/gateway/api/v1/recommendations';
20
4
  },
@@ -28,12 +12,4 @@ var PRD_CONFIG = {
28
12
  getTeamsUrl: function getTeamsUrl(baseUrl) {
29
13
  return baseUrl ? "".concat(baseUrl, "/gateway/api/v3/teams") : "/gateway/api/v3/teams";
30
14
  }
31
- }; // TODO remove this once no external code is calling it
32
-
33
- export var setSmartUserPickerEnv = function setSmartUserPickerEnv(newEnv) {
34
- return env = newEnv;
35
- }; // TODO remove this once no external code is calling it
36
-
37
- export var getConfig = function getConfig() {
38
- return env === 'local' ? LOCAL_CONFIG : PRD_CONFIG;
39
15
  };
package/dist/esm/index.js CHANGED
@@ -2,5 +2,4 @@ export { default } from './components';
2
2
  export { getUserRecommendations, hydrateDefaultValues } from './service';
3
3
  export { //Utils
4
4
  isEmail, isTeam, isUser, isValidEmail, // Constants
5
- EmailType, GroupType, TeamType, UserType } from '@atlaskit/user-picker';
6
- export { setSmartUserPickerEnv } from './config';
5
+ EmailType, GroupType, TeamType, UserType } from '@atlaskit/user-picker';
@@ -2,13 +2,13 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { UserType } from '@atlaskit/user-picker';
5
- import { getConfig } from '../config';
5
+ import { config } from '../config';
6
6
  import getHydratedUsersFromPrs from './users-client';
7
7
  import hydrateTeamFromLegion from './teams-client';
8
8
  import { UNKNOWN } from './constants';
9
9
 
10
10
  var getHydratedUsersFromProducts = function getHydratedUsersFromProducts(request) {
11
- var url = "".concat(getConfig().getUsersServiceUrl(request.productKey, request.baseUrl));
11
+ var url = "".concat(config.getUsersServiceUrl(request.productKey, request.baseUrl));
12
12
  var params = new URLSearchParams();
13
13
  request.accountIds.map(function (id) {
14
14
  return params.append('accountId', id);
@@ -5,12 +5,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
 
7
7
  import { transformUsers } from './users-transformer';
8
- import { getConfig } from '../config';
8
+ import { config } from '../config';
9
9
 
10
10
  var getUserRecommendations = function getUserRecommendations(request, intl) {
11
11
  var _request$context, _request$context$prod;
12
12
 
13
- var url = getConfig().getRecommendationServiceUrl(request.baseUrl || '');
13
+ var url = config.getRecommendationServiceUrl(request.baseUrl || '');
14
14
  return fetch(url, {
15
15
  method: 'POST',
16
16
  credentials: 'include',
@@ -4,7 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
4
4
 
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
 
7
- import { getConfig } from '../config';
7
+ import { config } from '../config';
8
8
  import { UNKNOWN_TEAM } from './constants';
9
9
 
10
10
  var transformTeam = function transformTeam(team, id) {
@@ -17,7 +17,7 @@ var transformTeam = function transformTeam(team, id) {
17
17
  };
18
18
 
19
19
  var hydrateTeamFromLegion = function hydrateTeamFromLegion(request) {
20
- var url = "".concat(getConfig().getTeamsUrl(request.baseUrl), "/").concat(request.id);
20
+ var url = "".concat(config.getTeamsUrl(request.baseUrl), "/").concat(request.id);
21
21
  return fetch(url, {
22
22
  method: 'GET',
23
23
  credentials: 'include',
@@ -8,7 +8,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  import { UNKNOWN_USER } from './constants';
10
10
  import { graphqlQuery } from './graphqlUtils';
11
- import { getConfig } from '../config';
11
+ import { config } from '../config';
12
12
 
13
13
  /**
14
14
  * @param {string} accountIds ids to hydrate
@@ -65,7 +65,7 @@ var modifyResponse = function modifyResponse(users) {
65
65
  };
66
66
 
67
67
  var getHydratedUsers = function getHydratedUsers(baseUrl, userIds) {
68
- var url = getConfig().getGraphQLUrl(baseUrl);
68
+ var url = config.getGraphQLUrl(baseUrl);
69
69
  return new Promise(function (resolve) {
70
70
  makeRequest(url, userIds).then(function (data) {
71
71
  resolve(modifyResponse(data.users));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-user-picker",
3
- "version": "5.1.2",
3
+ "version": "6.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -24,7 +24,7 @@ export declare class SmartUserPickerWithoutAnalytics extends React.Component<Pro
24
24
  private fireEvent;
25
25
  filterOptions: (users: OptionData[], query: string, propFilterOptions?: FilterOptions | undefined) => OptionData[];
26
26
  memoizedFilterOptions: import("memoize-one").MemoizedFn<(users: OptionData[], query: string, propFilterOptions?: FilterOptions | undefined) => OptionData[]>;
27
- getUsers: (() => Promise<void>) & import("lodash").Cancelable;
27
+ getUsers: import("lodash").DebouncedFunc<() => Promise<void>>;
28
28
  onInputChange: (newQuery?: string | undefined, sessionId?: string | undefined) => void;
29
29
  filterUsers: () => OptionData[];
30
30
  onFocus: (sessionId?: string | undefined) => void;
@@ -1,9 +1,6 @@
1
- interface Config {
1
+ export declare const config: {
2
2
  getRecommendationServiceUrl(baseUrl: string): string;
3
3
  getUsersServiceUrl(productKey: string, baseUrl?: string): string;
4
- getGraphQLUrl(baseUrl: string | undefined): string;
5
- getTeamsUrl(baseUrl: string | undefined): string;
6
- }
7
- export declare const setSmartUserPickerEnv: (newEnv: 'prod' | 'local') => "prod" | "local";
8
- export declare const getConfig: () => Config;
9
- export {};
4
+ getGraphQLUrl(baseUrl?: string | undefined): string;
5
+ getTeamsUrl(baseUrl?: string | undefined): string;
6
+ };
@@ -3,4 +3,3 @@ export { getUserRecommendations, hydrateDefaultValues } from './service';
3
3
  export type { RecommendationRequest, Props, State } from './types';
4
4
  export { isEmail, isTeam, isUser, isValidEmail, EmailType, GroupType, TeamType, UserType, } from '@atlaskit/user-picker';
5
5
  export type { ActionTypes, Appearance, AtlasKitSelectChange, AtlaskitSelectValue, DefaultValue, EmailValidationResponse, EmailValidator, InputActionTypes, LozengeProps, OnChange, OnInputChange, OnOption, OnPicker, Option, OptionData, OptionIdentifier, PopupUserPickerProps, Promisable, Target, UserPickerProps, UserPickerState, Value, Email, Group, GroupHighlight, HighlightRange, LoadOptions, Team, TeamHighlight, TeamMember, User, UserHighlight, ExternalUser, UserSource, } from '@atlaskit/user-picker';
6
- export { setSmartUserPickerEnv } from './config';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-user-picker",
3
- "version": "5.1.2",
3
+ "version": "6.0.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/"
6
6
  },
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@atlaskit/analytics-next": "^8.2.0",
26
26
  "@atlaskit/ufo": "^0.1.0",
27
- "@atlaskit/user-picker": "^9.2.0",
27
+ "@atlaskit/user-picker": "^9.3.0",
28
28
  "@babel/runtime": "^7.0.0",
29
29
  "lodash": "^4.17.21",
30
30
  "memoize-one": "^6.0.0",
@@ -40,17 +40,17 @@
40
40
  "@atlaskit/docs": "*",
41
41
  "@atlaskit/elements-test-helpers": "^0.7.0",
42
42
  "@atlaskit/modal-dialog": "^12.2.0",
43
- "@atlaskit/select": "^15.3.0",
43
+ "@atlaskit/select": "^15.6.0",
44
44
  "@atlaskit/textfield": "^5.0.0",
45
45
  "@atlaskit/theme": "^12.1.0",
46
- "@atlaskit/util-data-test": "^17.3.0",
46
+ "@atlaskit/util-data-test": "^17.5.0",
47
47
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
48
48
  "enzyme": "^3.10.0",
49
49
  "enzyme-react-intl": "^2.0.6",
50
50
  "fetch-mock": "^8.0.0",
51
51
  "graphql-tag": "^2.10.1",
52
52
  "mock-apollo-client": "^0.1.0",
53
- "typescript": "4.2.4"
53
+ "typescript": "4.3.5"
54
54
  },
55
55
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
56
56
  }
package/report.api.md CHANGED
@@ -1,6 +1,8 @@
1
- ## API Report File for "@atlaskit/smart-user-picker"
1
+ ## API Report File for "@atlaskit/smart-user-picker".
2
2
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
4
6
 
5
7
  ```ts
6
8
  import { ActionTypes } from '@atlaskit/user-picker';
@@ -57,6 +59,41 @@ export { AtlasKitSelectChange };
57
59
 
58
60
  export { AtlaskitSelectValue };
59
61
 
62
+ declare interface BitbucketAttributes {
63
+ /**
64
+ * Identifies whether this is a public repository or not.
65
+ */
66
+ isPublicRepo?: boolean;
67
+ /**
68
+ * A list of bitbucket workspace Ids used within container result set and noted in analytics.
69
+ */
70
+ workspaceIds?: string[];
71
+ /**
72
+ * The users current email domain which may be used to boost the results for relevant users.
73
+ */
74
+ emailDomain?: string;
75
+ }
76
+
77
+ declare interface ConfluenceAttributes {
78
+ /**
79
+ * Identifies whether this user is a confluence guest
80
+ */
81
+ isEntitledConfluenceExternalCollaborator?: boolean;
82
+ }
83
+
84
+ declare interface Context {
85
+ containerId?: string;
86
+ contextType: string;
87
+ objectId?: string;
88
+ sessionId?: string;
89
+ principalId?: string;
90
+ childObjectId?: string;
91
+ productKey: string;
92
+ siteId: string;
93
+ organizationId?: string;
94
+ productAttributes?: ProductAttributes;
95
+ }
96
+
60
97
  export { DefaultValue };
61
98
 
62
99
  export { Email };
@@ -69,8 +106,12 @@ export { EmailValidator };
69
106
 
70
107
  export { ExternalUser };
71
108
 
72
- // @public (undocumented)
73
- export const getUserRecommendations: (
109
+ declare type FilterOptions = (
110
+ options: OptionData[],
111
+ query: string,
112
+ ) => OptionData[];
113
+
114
+ export declare const getUserRecommendations: (
74
115
  request: RecommendationRequest,
75
116
  intl: IntlShape,
76
117
  ) => Promise<OptionData[]>;
@@ -83,8 +124,7 @@ export { GroupType };
83
124
 
84
125
  export { HighlightRange };
85
126
 
86
- // @public (undocumented)
87
- export function hydrateDefaultValues(
127
+ export declare function hydrateDefaultValues(
88
128
  baseUrl: string | undefined,
89
129
  value: DefaultValue,
90
130
  productKey: string,
@@ -106,12 +146,24 @@ export { LozengeProps };
106
146
 
107
147
  export { OnChange };
108
148
 
149
+ declare type OnEmpty = (query: string) => Promise<OptionData[]>;
150
+
151
+ declare type OnError = (
152
+ error: any,
153
+ request: RecommendationRequest,
154
+ ) => Promise<OptionData[]> | void;
155
+
109
156
  export { OnInputChange };
110
157
 
111
158
  export { OnOption };
112
159
 
113
160
  export { OnPicker };
114
161
 
162
+ declare type OnValueError = (
163
+ error: any,
164
+ defaultValue: DefaultValue,
165
+ ) => Promise<OptionData[]> | void;
166
+
115
167
  export { Option_2 as Option };
116
168
 
117
169
  export { OptionData };
@@ -120,62 +172,167 @@ export { OptionIdentifier };
120
172
 
121
173
  export { PopupUserPickerProps };
122
174
 
175
+ declare type ProductAttributes = BitbucketAttributes | ConfluenceAttributes;
176
+
123
177
  export { Promisable };
124
178
 
125
- // @public (undocumented)
126
- export interface Props
179
+ export declare interface Props
127
180
  extends SmartProps,
128
181
  UserPickerProps,
129
182
  WithAnalyticsEventsProps {
183
+ /**
184
+ * The pre-selected values for the smart user picker. Supports only Users and Teams default value hydration.
185
+ * If the `DefaultValue` contains only an `id` and `type` (it conforms to an `OptionIdentifier`)
186
+ * then the values will be automatically hydrated.
187
+ * If the value has a `name` then it is considered hydrated and will be ignored.
188
+ * Uses Confluence and Jira if called from there, else uses Identity or Legion for teams. If a value could not be found, or there was
189
+ * a network failure during the hydration, the value will be rendered with the label 'Unknown'. Else, if there were any other error
190
+ * during default value hydration, no default values will be rendered, use `onValueError` to handle this.
191
+ * `defaultValue` differs from `value` in that it sets the initial value then leaves the component 'uncontrolled'
192
+ * whereas setting the `value` prop delegates responsibility for maintaining the value to the caller
193
+ * (i.e. listen to `onChange`)
194
+ */
130
195
  defaultValue?: DefaultValue;
196
+ /**
197
+ * Identifier for informing the server on where the user picker has been mounted.
198
+ * Unlike User Picker, the fieldId in Smart User Picker is mandatory.
199
+ * The server uses the fieldId to determine which model to utilize when
200
+ * generating suggestions.
201
+ * All fieldId's will be bucketed into a model that provides generic smart results,
202
+ * except "assignee", "mentions" which are specifically trained for Jira Assignee and
203
+ * @Mentions. For specifically trained models, please contact #help-smart-experiences.
204
+ */
131
205
  fieldId: string;
132
206
  }
133
207
 
134
- // @public (undocumented)
135
- export interface RecommendationRequest {
136
- // (undocumented)
208
+ export declare interface RecommendationRequest {
137
209
  baseUrl?: string;
138
- // (undocumented)
139
210
  context: Context;
140
- // (undocumented)
141
- includeGroups?: boolean;
142
- // (undocumented)
143
- includeTeams?: boolean;
144
- // (undocumented)
145
- includeUsers?: boolean;
146
- // (undocumented)
147
211
  maxNumberOfResults: number;
148
- // (undocumented)
149
212
  query?: string;
150
- // (undocumented)
151
213
  searchQueryFilter?: string;
214
+ includeUsers?: boolean;
215
+ includeGroups?: boolean;
216
+ includeTeams?: boolean;
152
217
  }
153
218
 
154
- // @public (undocumented)
155
- export const setSmartUserPickerEnv: (
156
- newEnv: 'prod' | 'local',
157
- ) => 'prod' | 'local';
219
+ declare interface SmartProps {
220
+ /**
221
+ * The base URL of the site eg: hello.atlassian.net
222
+ */
223
+ baseUrl?: string;
224
+ /**
225
+ * Hydrated user suggestions to show when the query is blank. If not provided, smart user picker
226
+ * will still provide a smart-ranked list of suggestions for blank queries. Please refer to @atlaskit/user-picker
227
+ * for OptionData type.
228
+ */
229
+ bootstrapOptions?: OptionData[];
230
+ /**
231
+ * Context information for analytics. Eg: if a user picker was put inside a comment, the childObjectId would be
232
+ * the ID of the comment. Optional, but please provide if available.
233
+ */
234
+ childObjectId?: string;
235
+ /**
236
+ * The container Id to identify context.
237
+ *
238
+ * e.g. Jira: projectId. Confluence: spaceId. Bitbucket: repositoryId.
239
+ */
240
+ containerId?: string;
241
+ /**
242
+ * Time to debounce the suggestions fetching (in milliseconds). Defaults to 150ms.
243
+ */
244
+ debounceTime?: number;
245
+ /**
246
+ * Function to transform options suggested by the server before showing to the user. Can be used to filter out suggestions.
247
+ * The results of filterOptions are the results displayed in the suggestions UI.
248
+ */
249
+ filterOptions?: FilterOptions;
250
+ /**
251
+ * Whether to include groups in the resultset. Only supported for Confluence. @default false
252
+ */
253
+ includeGroups?: boolean;
254
+ /**
255
+ * Whether to include teams in the resultset. @default false
256
+ */
257
+ includeTeams?: boolean;
258
+ /**
259
+ * Whether to include users in the resultset. @default true
260
+ */
261
+ includeUsers?: boolean;
262
+ /**
263
+ * An identifier of the closest context object, e.g. issueId, pageId, pullRequestId.
264
+ * Used for analytics. Optional, but please include if available.
265
+ */
266
+ objectId?: string;
267
+ /**
268
+ * Custom handler to give opportunity for caller to return list of options when server returns empty list.
269
+ * this is called if server returns empty list. This will NOT be called if props.filterOptions returns empty list.
270
+ */
271
+ onEmpty?: OnEmpty;
272
+ /**
273
+ * Error handler for when the server fails to suggest users and returns with an error response.
274
+ * `error`: the error.
275
+ * `RecommendationRequest`: the original recommendationRequest containing the query and other search parameters.
276
+ * This may be used to provide a fail over search direct to the product backend.
277
+ * Helper fail over clients exist under /helpers.
278
+ * Note that OnError results are filtered.
279
+ */
280
+ onError?: OnError;
281
+ /**
282
+ * Error handler used to provide OptionData[] values when the server fails to hydrate the `defaultValue` prop's values.
283
+ */
284
+ onValueError?: OnValueError;
285
+ /**
286
+ * Prefetch the list of suggested assignees before the user picker is focused.
287
+ * WARNING: please consider carefully before deciding to prefetch your suggestions
288
+ * as this will increase the load on the recommendations services (has caused HOTs).
289
+ * Please give #help-smart-experiences a ballpark on the expected request volume.
290
+ */
291
+ prefetch?: boolean;
292
+ /**
293
+ * Id of the user interacting with the component.
294
+ * If principalId is not provided, server will extract principalId from the context header, assuming that the user is logged in
295
+ * when making the request. @default “context”
296
+ */
297
+ principalId?: string;
298
+ /**
299
+ * Product-specific Attributes - you should pass in the attribute type that matches your current SupportedProduct.
300
+ * Currently we support additional attributes (BitbucketAttributes) for bitbucket and (ConfluenceAttributes) for Confluence.
301
+ */
302
+ productAttributes?: ProductAttributes;
303
+ /**
304
+ * Product identifier. If you are an NPF, please ensure your product has been onboarded with
305
+ * Cross-product user-search @see https://developer.atlassian.com/cloud/cross-product-user-search/
306
+ * If you are still waiting for CPUS, you can use the `people` productKey in the interim.
307
+ */
308
+ productKey: string;
309
+ /**
310
+ * Filter to be applied to the eventual query to CPUS for user suggestions.
311
+ * Example:`account_status:"active" AND (NOT email_domain:"connect.atlassian.com")`
312
+ * will remove inactive users from the list of suggestions.
313
+ */
314
+ searchQueryFilter?: string;
315
+ /**
316
+ * Identifier for the product's tenant, also known as tenantId or cloudId
317
+ */
318
+ siteId: string;
319
+ /**
320
+ * Identifier for the organization in which to search for teams.
321
+ */
322
+ orgId?: string;
323
+ }
158
324
 
159
- // @public (undocumented)
160
- const SmartUserPickerWithIntlProvider: React_2.FunctionComponent<Props>;
325
+ declare const SmartUserPickerWithIntlProvider: React_2.FunctionComponent<Props>;
161
326
  export default SmartUserPickerWithIntlProvider;
162
327
 
163
- // @public (undocumented)
164
- export interface State {
165
- // (undocumented)
166
- bootstrapOptions: OptionData[];
167
- // (undocumented)
168
- closed: boolean;
169
- // (undocumented)
170
- defaultValue?: DefaultValue;
171
- // (undocumented)
328
+ export declare interface State {
329
+ users: OptionData[];
172
330
  loading: boolean;
173
- // (undocumented)
331
+ closed: boolean;
174
332
  query: string;
175
- // (undocumented)
176
333
  sessionId?: string;
177
- // (undocumented)
178
- users: OptionData[];
334
+ defaultValue?: DefaultValue;
335
+ bootstrapOptions: OptionData[];
179
336
  }
180
337
 
181
338
  export { Target };
@@ -202,5 +359,5 @@ export { UserType };
202
359
 
203
360
  export { Value };
204
361
 
205
- // (No @packageDocumentation comment for this package)
362
+ export {};
206
363
  ```