@atlaskit/smart-user-picker 5.0.3 → 5.1.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 +22 -0
- package/dist/cjs/components/SmartUserPicker.js +58 -20
- package/dist/cjs/service/default-value-hydration-client.js +2 -2
- package/dist/cjs/service/users-client.js +2 -2
- package/dist/cjs/service/users-transformer.js +1 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/SmartUserPicker.js +32 -20
- package/dist/es2019/service/users-transformer.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/SmartUserPicker.js +58 -19
- package/dist/esm/service/default-value-hydration-client.js +1 -1
- package/dist/esm/service/users-client.js +1 -1
- package/dist/esm/service/users-transformer.js +1 -0
- package/dist/esm/util/i18n-util.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/components/SmartUserPicker.d.ts +0 -1
- package/dist/types/types.d.ts +0 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlassian/smart-user-picker
|
|
2
2
|
|
|
3
|
+
## 5.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`cc40ab95bd4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cc40ab95bd4) - Adds a list of team members under OptionData for Teams
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 5.0.5
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
|
|
18
|
+
|
|
19
|
+
## 5.0.4
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`f805f47c19a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f805f47c19a) - Smart User Picker now catches errors emitted from the optional `onError` fallback data source, and also now only sends a UFO failure event if the primary data source (URS) fails AND the `onError` prop either fails or is not provided.
|
|
24
|
+
|
|
3
25
|
## 5.0.3
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.SmartUserPickerWithoutAnalytics = exports.SmartUserPicker = void 0;
|
|
9
9
|
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
11
|
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -103,7 +103,6 @@ var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
103
103
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
104
104
|
users: [],
|
|
105
105
|
loading: false,
|
|
106
|
-
error: false,
|
|
107
106
|
closed: true,
|
|
108
107
|
query: '',
|
|
109
108
|
defaultValue: [],
|
|
@@ -137,21 +136,21 @@ var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
137
136
|
});
|
|
138
137
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "memoizedFilterOptions", (0, _memoizeOne.default)(_this.filterOptions));
|
|
139
138
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getUsers", (0, _debounce.default)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
140
|
-
var _this$state, query, sessionId, closed, _this$props,
|
|
139
|
+
var _this$state, query, sessionId, closed, _this$props, baseUrl, childObjectId, containerId, fieldId, includeGroups, includeTeams, includeUsers, intl, maxOptions, objectId, onEmpty, onError, orgId, principalId, productAttributes, productKey, searchQueryFilter, siteId, maxNumberOfResults, startTime, recommendationsRequest, _yield$onEmpty, recommendedUsers, elapsedTimeMilli, displayedUsers, onErrorProducedError, defaultUsers, _elapsedTimeMilli;
|
|
141
140
|
|
|
142
141
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
143
142
|
while (1) {
|
|
144
143
|
switch (_context.prev = _context.next) {
|
|
145
144
|
case 0:
|
|
146
145
|
_this$state = _this.state, query = _this$state.query, sessionId = _this$state.sessionId, closed = _this$state.closed;
|
|
147
|
-
_this$props = _this.props,
|
|
146
|
+
_this$props = _this.props, baseUrl = _this$props.baseUrl, childObjectId = _this$props.childObjectId, containerId = _this$props.containerId, fieldId = _this$props.fieldId, includeGroups = _this$props.includeGroups, includeTeams = _this$props.includeTeams, includeUsers = _this$props.includeUsers, intl = _this$props.intl, maxOptions = _this$props.maxOptions, objectId = _this$props.objectId, onEmpty = _this$props.onEmpty, onError = _this$props.onError, orgId = _this$props.orgId, principalId = _this$props.principalId, productAttributes = _this$props.productAttributes, productKey = _this$props.productKey, searchQueryFilter = _this$props.searchQueryFilter, siteId = _this$props.siteId;
|
|
148
147
|
maxNumberOfResults = maxOptions || 100;
|
|
149
148
|
startTime = window.performance.now();
|
|
150
149
|
recommendationsRequest = {
|
|
151
150
|
baseUrl: baseUrl,
|
|
152
151
|
context: {
|
|
153
152
|
containerId: containerId,
|
|
154
|
-
contextType:
|
|
153
|
+
contextType: fieldId,
|
|
155
154
|
objectId: objectId,
|
|
156
155
|
principalId: principalId,
|
|
157
156
|
productKey: productKey,
|
|
@@ -241,47 +240,87 @@ var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
241
240
|
};
|
|
242
241
|
});
|
|
243
242
|
|
|
244
|
-
_context.next =
|
|
243
|
+
_context.next = 58;
|
|
245
244
|
break;
|
|
246
245
|
|
|
247
246
|
case 31:
|
|
248
247
|
_context.prev = 31;
|
|
249
248
|
_context.t4 = _context["catch"](5);
|
|
250
249
|
|
|
251
|
-
if (!closed) {
|
|
252
|
-
// If the user lookup fails while the menu is open,
|
|
253
|
-
//
|
|
250
|
+
if (!closed && !onError) {
|
|
251
|
+
// If the user lookup fails while the menu is open, and the consumer is not providing a
|
|
252
|
+
// fallback data source via the onError prop, then send UFO failure
|
|
254
253
|
_this.optionsShownUfoExperienceInstance.failure();
|
|
255
254
|
}
|
|
256
255
|
|
|
257
256
|
_this.setState({
|
|
258
|
-
users: []
|
|
259
|
-
error: true
|
|
257
|
+
users: []
|
|
260
258
|
});
|
|
261
259
|
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
onErrorProducedError = false;
|
|
261
|
+
defaultUsers = [];
|
|
262
|
+
_context.prev = 37;
|
|
264
263
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
264
|
+
if (!onError) {
|
|
265
|
+
_context.next = 47;
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
_context.next = 41;
|
|
270
|
+
return onError(_context.t4, recommendationsRequest);
|
|
271
|
+
|
|
272
|
+
case 41:
|
|
273
|
+
_context.t6 = _context.sent;
|
|
274
|
+
|
|
275
|
+
if (_context.t6) {
|
|
276
|
+
_context.next = 44;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
_context.t6 = [];
|
|
281
|
+
|
|
282
|
+
case 44:
|
|
283
|
+
_context.t5 = _context.t6;
|
|
284
|
+
_context.next = 48;
|
|
285
|
+
break;
|
|
286
|
+
|
|
287
|
+
case 47:
|
|
288
|
+
_context.t5 = [];
|
|
289
|
+
|
|
290
|
+
case 48:
|
|
291
|
+
defaultUsers = _context.t5;
|
|
292
|
+
_context.next = 54;
|
|
293
|
+
break;
|
|
294
|
+
|
|
295
|
+
case 51:
|
|
296
|
+
_context.prev = 51;
|
|
297
|
+
_context.t7 = _context["catch"](37);
|
|
298
|
+
onErrorProducedError = true;
|
|
299
|
+
|
|
300
|
+
case 54:
|
|
301
|
+
if (onErrorProducedError) {
|
|
302
|
+
// Log error from fallback data source `onError` to UFO
|
|
303
|
+
_this.optionsShownUfoExperienceInstance.failure();
|
|
304
|
+
}
|
|
268
305
|
|
|
269
306
|
_this.setState({
|
|
270
307
|
users: defaultUsers,
|
|
271
308
|
loading: false
|
|
272
309
|
});
|
|
273
310
|
|
|
311
|
+
_elapsedTimeMilli = window.performance.now() - startTime;
|
|
312
|
+
|
|
274
313
|
_this.fireEvent(_analytics.failedRequestUsersEvent, {
|
|
275
314
|
elapsedTimeMilli: _elapsedTimeMilli,
|
|
276
315
|
productAttributes: productAttributes
|
|
277
316
|
});
|
|
278
317
|
|
|
279
|
-
case
|
|
318
|
+
case 58:
|
|
280
319
|
case "end":
|
|
281
320
|
return _context.stop();
|
|
282
321
|
}
|
|
283
322
|
}
|
|
284
|
-
}, _callee, null, [[5, 31]]);
|
|
323
|
+
}, _callee, null, [[5, 31], [37, 51]]);
|
|
285
324
|
})), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
|
|
286
325
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInputChange", function (newQuery, sessionId) {
|
|
287
326
|
var query = newQuery || '';
|
|
@@ -494,7 +533,6 @@ var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
494
533
|
|
|
495
534
|
exports.SmartUserPickerWithoutAnalytics = SmartUserPickerWithoutAnalytics;
|
|
496
535
|
(0, _defineProperty2.default)(SmartUserPickerWithoutAnalytics, "defaultProps", {
|
|
497
|
-
onError: function onError() {},
|
|
498
536
|
baseUrl: '',
|
|
499
537
|
includeUsers: true,
|
|
500
538
|
includeGroups: false,
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
11
|
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
16
|
var _userPicker = require("@atlaskit/user-picker");
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
16
|
var _constants = require("./constants");
|
|
@@ -60,6 +60,7 @@ var transformUser = function transformUser(item, intl) {
|
|
|
60
60
|
description: team.description || '',
|
|
61
61
|
name: team.displayName || '',
|
|
62
62
|
memberCount: team.memberCount,
|
|
63
|
+
members: team.members,
|
|
63
64
|
includesYou: team.includesYou,
|
|
64
65
|
avatarUrl: team.largeAvatarImageUrl || team.smallAvatarImageUrl
|
|
65
66
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -45,7 +45,6 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
|
|
|
45
45
|
_defineProperty(this, "state", {
|
|
46
46
|
users: [],
|
|
47
47
|
loading: false,
|
|
48
|
-
error: false,
|
|
49
48
|
closed: true,
|
|
50
49
|
query: '',
|
|
51
50
|
defaultValue: [],
|
|
@@ -86,22 +85,24 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
|
|
|
86
85
|
closed
|
|
87
86
|
} = this.state;
|
|
88
87
|
const {
|
|
89
|
-
containerId,
|
|
90
|
-
childObjectId,
|
|
91
|
-
objectId,
|
|
92
|
-
principalId,
|
|
93
|
-
productKey,
|
|
94
|
-
siteId,
|
|
95
|
-
orgId,
|
|
96
88
|
baseUrl,
|
|
97
|
-
|
|
89
|
+
childObjectId,
|
|
90
|
+
containerId,
|
|
91
|
+
fieldId,
|
|
98
92
|
includeGroups,
|
|
99
93
|
includeTeams,
|
|
94
|
+
includeUsers,
|
|
95
|
+
intl,
|
|
100
96
|
maxOptions,
|
|
101
|
-
|
|
97
|
+
objectId,
|
|
102
98
|
onEmpty,
|
|
99
|
+
onError,
|
|
100
|
+
orgId,
|
|
101
|
+
principalId,
|
|
103
102
|
productAttributes,
|
|
104
|
-
|
|
103
|
+
productKey,
|
|
104
|
+
searchQueryFilter,
|
|
105
|
+
siteId
|
|
105
106
|
} = this.props;
|
|
106
107
|
const maxNumberOfResults = maxOptions || 100;
|
|
107
108
|
const startTime = window.performance.now();
|
|
@@ -109,7 +110,7 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
|
|
|
109
110
|
baseUrl,
|
|
110
111
|
context: {
|
|
111
112
|
containerId,
|
|
112
|
-
contextType:
|
|
113
|
+
contextType: fieldId,
|
|
113
114
|
objectId,
|
|
114
115
|
principalId,
|
|
115
116
|
productKey,
|
|
@@ -151,22 +152,34 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
|
|
|
151
152
|
};
|
|
152
153
|
});
|
|
153
154
|
} catch (e) {
|
|
154
|
-
if (!closed) {
|
|
155
|
-
// If the user lookup fails while the menu is open,
|
|
156
|
-
//
|
|
155
|
+
if (!closed && !onError) {
|
|
156
|
+
// If the user lookup fails while the menu is open, and the consumer is not providing a
|
|
157
|
+
// fallback data source via the onError prop, then send UFO failure
|
|
157
158
|
this.optionsShownUfoExperienceInstance.failure();
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
this.setState({
|
|
161
|
-
users: []
|
|
162
|
-
error: true
|
|
162
|
+
users: []
|
|
163
163
|
});
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
let onErrorProducedError = false;
|
|
165
|
+
let defaultUsers = [];
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
defaultUsers = onError ? (await onError(e, recommendationsRequest)) || [] : [];
|
|
169
|
+
} catch (error) {
|
|
170
|
+
onErrorProducedError = true;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (onErrorProducedError) {
|
|
174
|
+
// Log error from fallback data source `onError` to UFO
|
|
175
|
+
this.optionsShownUfoExperienceInstance.failure();
|
|
176
|
+
}
|
|
177
|
+
|
|
166
178
|
this.setState({
|
|
167
179
|
users: defaultUsers,
|
|
168
180
|
loading: false
|
|
169
181
|
});
|
|
182
|
+
const elapsedTimeMilli = window.performance.now() - startTime;
|
|
170
183
|
this.fireEvent(failedRequestUsersEvent, {
|
|
171
184
|
elapsedTimeMilli,
|
|
172
185
|
productAttributes
|
|
@@ -340,7 +353,6 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
|
|
|
340
353
|
} // TODO: Smart User picker team will have to add a type annotation here
|
|
341
354
|
|
|
342
355
|
_defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
|
|
343
|
-
onError: () => {},
|
|
344
356
|
baseUrl: '',
|
|
345
357
|
includeUsers: true,
|
|
346
358
|
includeGroups: false,
|
|
@@ -51,6 +51,7 @@ const transformUser = (item, intl) => {
|
|
|
51
51
|
description: team.description || '',
|
|
52
52
|
name: team.displayName || '',
|
|
53
53
|
memberCount: team.memberCount,
|
|
54
|
+
members: team.members,
|
|
54
55
|
includesYou: team.includesYou,
|
|
55
56
|
avatarUrl: team.largeAvatarImageUrl || team.smallAvatarImageUrl
|
|
56
57
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -13,6 +12,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
13
12
|
|
|
14
13
|
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; }
|
|
15
14
|
|
|
15
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
16
|
+
|
|
16
17
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
18
|
|
|
18
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -75,7 +76,6 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
|
|
|
75
76
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
76
77
|
users: [],
|
|
77
78
|
loading: false,
|
|
78
|
-
error: false,
|
|
79
79
|
closed: true,
|
|
80
80
|
query: '',
|
|
81
81
|
defaultValue: [],
|
|
@@ -115,21 +115,21 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
|
|
|
115
115
|
_defineProperty(_assertThisInitialized(_this), "memoizedFilterOptions", memoizeOne(_this.filterOptions));
|
|
116
116
|
|
|
117
117
|
_defineProperty(_assertThisInitialized(_this), "getUsers", debounce( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
118
|
-
var _this$state, query, sessionId, closed, _this$props,
|
|
118
|
+
var _this$state, query, sessionId, closed, _this$props, baseUrl, childObjectId, containerId, fieldId, includeGroups, includeTeams, includeUsers, intl, maxOptions, objectId, onEmpty, onError, orgId, principalId, productAttributes, productKey, searchQueryFilter, siteId, maxNumberOfResults, startTime, recommendationsRequest, _yield$onEmpty, recommendedUsers, elapsedTimeMilli, displayedUsers, onErrorProducedError, defaultUsers, _elapsedTimeMilli;
|
|
119
119
|
|
|
120
120
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
121
121
|
while (1) {
|
|
122
122
|
switch (_context.prev = _context.next) {
|
|
123
123
|
case 0:
|
|
124
124
|
_this$state = _this.state, query = _this$state.query, sessionId = _this$state.sessionId, closed = _this$state.closed;
|
|
125
|
-
_this$props = _this.props,
|
|
125
|
+
_this$props = _this.props, baseUrl = _this$props.baseUrl, childObjectId = _this$props.childObjectId, containerId = _this$props.containerId, fieldId = _this$props.fieldId, includeGroups = _this$props.includeGroups, includeTeams = _this$props.includeTeams, includeUsers = _this$props.includeUsers, intl = _this$props.intl, maxOptions = _this$props.maxOptions, objectId = _this$props.objectId, onEmpty = _this$props.onEmpty, onError = _this$props.onError, orgId = _this$props.orgId, principalId = _this$props.principalId, productAttributes = _this$props.productAttributes, productKey = _this$props.productKey, searchQueryFilter = _this$props.searchQueryFilter, siteId = _this$props.siteId;
|
|
126
126
|
maxNumberOfResults = maxOptions || 100;
|
|
127
127
|
startTime = window.performance.now();
|
|
128
128
|
recommendationsRequest = {
|
|
129
129
|
baseUrl: baseUrl,
|
|
130
130
|
context: {
|
|
131
131
|
containerId: containerId,
|
|
132
|
-
contextType:
|
|
132
|
+
contextType: fieldId,
|
|
133
133
|
objectId: objectId,
|
|
134
134
|
principalId: principalId,
|
|
135
135
|
productKey: productKey,
|
|
@@ -219,47 +219,87 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
|
|
|
219
219
|
};
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
-
_context.next =
|
|
222
|
+
_context.next = 58;
|
|
223
223
|
break;
|
|
224
224
|
|
|
225
225
|
case 31:
|
|
226
226
|
_context.prev = 31;
|
|
227
227
|
_context.t4 = _context["catch"](5);
|
|
228
228
|
|
|
229
|
-
if (!closed) {
|
|
230
|
-
// If the user lookup fails while the menu is open,
|
|
231
|
-
//
|
|
229
|
+
if (!closed && !onError) {
|
|
230
|
+
// If the user lookup fails while the menu is open, and the consumer is not providing a
|
|
231
|
+
// fallback data source via the onError prop, then send UFO failure
|
|
232
232
|
_this.optionsShownUfoExperienceInstance.failure();
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
_this.setState({
|
|
236
|
-
users: []
|
|
237
|
-
error: true
|
|
236
|
+
users: []
|
|
238
237
|
});
|
|
239
238
|
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
onErrorProducedError = false;
|
|
240
|
+
defaultUsers = [];
|
|
241
|
+
_context.prev = 37;
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
if (!onError) {
|
|
244
|
+
_context.next = 47;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
_context.next = 41;
|
|
249
|
+
return onError(_context.t4, recommendationsRequest);
|
|
250
|
+
|
|
251
|
+
case 41:
|
|
252
|
+
_context.t6 = _context.sent;
|
|
253
|
+
|
|
254
|
+
if (_context.t6) {
|
|
255
|
+
_context.next = 44;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
_context.t6 = [];
|
|
260
|
+
|
|
261
|
+
case 44:
|
|
262
|
+
_context.t5 = _context.t6;
|
|
263
|
+
_context.next = 48;
|
|
264
|
+
break;
|
|
265
|
+
|
|
266
|
+
case 47:
|
|
267
|
+
_context.t5 = [];
|
|
268
|
+
|
|
269
|
+
case 48:
|
|
270
|
+
defaultUsers = _context.t5;
|
|
271
|
+
_context.next = 54;
|
|
272
|
+
break;
|
|
273
|
+
|
|
274
|
+
case 51:
|
|
275
|
+
_context.prev = 51;
|
|
276
|
+
_context.t7 = _context["catch"](37);
|
|
277
|
+
onErrorProducedError = true;
|
|
278
|
+
|
|
279
|
+
case 54:
|
|
280
|
+
if (onErrorProducedError) {
|
|
281
|
+
// Log error from fallback data source `onError` to UFO
|
|
282
|
+
_this.optionsShownUfoExperienceInstance.failure();
|
|
283
|
+
}
|
|
246
284
|
|
|
247
285
|
_this.setState({
|
|
248
286
|
users: defaultUsers,
|
|
249
287
|
loading: false
|
|
250
288
|
});
|
|
251
289
|
|
|
290
|
+
_elapsedTimeMilli = window.performance.now() - startTime;
|
|
291
|
+
|
|
252
292
|
_this.fireEvent(failedRequestUsersEvent, {
|
|
253
293
|
elapsedTimeMilli: _elapsedTimeMilli,
|
|
254
294
|
productAttributes: productAttributes
|
|
255
295
|
});
|
|
256
296
|
|
|
257
|
-
case
|
|
297
|
+
case 58:
|
|
258
298
|
case "end":
|
|
259
299
|
return _context.stop();
|
|
260
300
|
}
|
|
261
301
|
}
|
|
262
|
-
}, _callee, null, [[5, 31]]);
|
|
302
|
+
}, _callee, null, [[5, 31], [37, 51]]);
|
|
263
303
|
})), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
|
|
264
304
|
|
|
265
305
|
_defineProperty(_assertThisInitialized(_this), "onInputChange", function (newQuery, sessionId) {
|
|
@@ -476,7 +516,6 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
|
|
|
476
516
|
}(React.Component); // TODO: Smart User picker team will have to add a type annotation here
|
|
477
517
|
|
|
478
518
|
_defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
|
|
479
|
-
onError: function onError() {},
|
|
480
519
|
baseUrl: '',
|
|
481
520
|
includeUsers: true,
|
|
482
521
|
includeGroups: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import { UserType } from '@atlaskit/user-picker';
|
|
5
5
|
import { getConfig } from '../config';
|
|
6
6
|
import getHydratedUsersFromPrs from './users-client';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
3
|
|
|
5
4
|
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; }
|
|
6
5
|
|
|
7
6
|
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; }
|
|
8
7
|
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
9
|
import { UNKNOWN_USER } from './constants';
|
|
10
10
|
import { graphqlQuery } from './graphqlUtils';
|
|
11
11
|
import { getConfig } from '../config';
|
|
@@ -51,6 +51,7 @@ var transformUser = function transformUser(item, intl) {
|
|
|
51
51
|
description: team.description || '',
|
|
52
52
|
name: team.displayName || '',
|
|
53
53
|
memberCount: team.memberCount,
|
|
54
|
+
members: team.members,
|
|
54
55
|
includesYou: team.includesYou,
|
|
55
56
|
avatarUrl: team.largeAvatarImageUrl || team.smallAvatarImageUrl
|
|
56
57
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Tries to get the most specific messages bundle for a given locale.
|
package/dist/esm/version.json
CHANGED
|
@@ -9,7 +9,7 @@ export declare type UserPickerSession = {
|
|
|
9
9
|
lastKey?: number;
|
|
10
10
|
};
|
|
11
11
|
export declare const startSession: () => UserPickerSession;
|
|
12
|
-
export declare const createAndFireEventInElementsChannel: (payload:
|
|
12
|
+
export declare const createAndFireEventInElementsChannel: (payload: AnalyticsEventPayload) => (createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
|
|
13
13
|
export interface SmartEventCreator {
|
|
14
14
|
(props: Props, ...args: any[]): AnalyticsEventPayload;
|
|
15
15
|
}
|
|
@@ -8,7 +8,6 @@ export declare class SmartUserPickerWithoutAnalytics extends React.Component<Pro
|
|
|
8
8
|
state: State;
|
|
9
9
|
optionsShownUfoExperienceInstance: UFOExperience;
|
|
10
10
|
static defaultProps: {
|
|
11
|
-
onError: () => void;
|
|
12
11
|
baseUrl: string;
|
|
13
12
|
includeUsers: boolean;
|
|
14
13
|
includeGroups: boolean;
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-user-picker",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
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.
|
|
27
|
+
"@atlaskit/user-picker": "^9.1.0",
|
|
28
28
|
"@babel/runtime": "^7.0.0",
|
|
29
29
|
"lodash": "^4.17.21",
|
|
30
30
|
"memoize-one": "^6.0.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"react-dom": "^16.8.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@atlaskit/button": "^16.
|
|
39
|
+
"@atlaskit/button": "^16.3.0",
|
|
40
40
|
"@atlaskit/docs": "*",
|
|
41
41
|
"@atlaskit/elements-test-helpers": "^0.7.0",
|
|
42
42
|
"@atlaskit/modal-dialog": "^12.2.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"fetch-mock": "^8.0.0",
|
|
51
51
|
"graphql-tag": "^2.10.1",
|
|
52
52
|
"mock-apollo-client": "^0.1.0",
|
|
53
|
-
"typescript": "
|
|
53
|
+
"typescript": "4.2.4"
|
|
54
54
|
},
|
|
55
55
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
56
56
|
}
|