@atlaskit/smart-user-picker 8.4.1 → 8.6.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,25 @@
1
1
  # @atlassian/smart-user-picker
2
2
 
3
+ ## 8.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0d41d4c92fe89`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0d41d4c92fe89) -
8
+ [ux] Added `fetchOptions` prop to SmartUserPicker to support custom option fetching. When
9
+ provided, this function will be called instead of the default recommendation API, allowing
10
+ consumers to override the default fetching behavior with their own implementation.
11
+
12
+ ## 8.5.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [`bef521afc400f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bef521afc400f) -
17
+ Adds prop to set user picker & smart user picker as open/closed
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 8.4.1
4
24
 
5
25
  ### Patch Changes
@@ -4,7 +4,8 @@
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../confluence/tsDist/@atlaskit__smart-user-picker",
6
6
  "rootDir": "../",
7
- "composite": true
7
+ "composite": true,
8
+ "noCheck": true
8
9
  },
9
10
  "include": [
10
11
  "../src/**/*.ts",
@@ -2,9 +2,10 @@
2
2
  "extends": "../../../../tsconfig.entry-points.jira.json",
3
3
  "compilerOptions": {
4
4
  "target": "es5",
5
- "outDir": "../../../../../tsDist/@atlaskit__smart-user-picker/app",
5
+ "outDir": "../../../../../jira/tsDist/@atlaskit__smart-user-picker/app",
6
6
  "rootDir": "../",
7
- "composite": true
7
+ "composite": true,
8
+ "noCheck": true
8
9
  },
9
10
  "include": [
10
11
  "../src/**/*.ts",
@@ -4,7 +4,8 @@
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../tsDist/@atlaskit__smart-user-picker/app",
6
6
  "rootDir": "../",
7
- "composite": true
7
+ "composite": true,
8
+ "noCheck": true
8
9
  },
9
10
  "include": [
10
11
  "../src/**/*.ts",
@@ -9,11 +9,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _analyticsNext = require("@atlaskit/analytics-next");
10
10
  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
- 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; }
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; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
13
13
  var packageName = "@atlaskit/smart-user-picker";
14
14
  var packageVersion = "0.0.0-development";
15
15
  var startSession = exports.startSession = function startSession() {
16
16
  return {
17
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
17
18
  id: (0, _uuid.v4)(),
18
19
  start: Date.now(),
19
20
  inputChangeTime: Date.now(),
@@ -32,7 +32,7 @@ var _MessagesIntlProvider = _interopRequireDefault(require("./MessagesIntlProvid
32
32
  var _types = require("../types");
33
33
  var _service = require("../service");
34
34
  var _ufoExperiences = require("../ufoExperiences");
35
- var _excluded = ["allowEmail", "enableEmailSearch", "allowEmailSelectionWhenEmailMatched"];
35
+ var _excluded = ["allowEmail", "enableEmailSearch", "allowEmailSelectionWhenEmailMatched", "fetchOptions"];
36
36
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
37
37
  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; }
38
38
  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; }
@@ -40,7 +40,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
40
40
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
41
41
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
42
42
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
43
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
43
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
44
44
  var DEFAULT_DEBOUNCE_TIME_MS = 150;
45
45
  var ufoEndStateConfig = function ufoEndStateConfig(fieldId) {
46
46
  return {
@@ -118,12 +118,12 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
118
118
  });
119
119
  (0, _defineProperty2.default)(_this, "memoizedFilterOptions", (0, _memoizeOne.default)(_this.filterOptions));
120
120
  (0, _defineProperty2.default)(_this, "getUsers", (0, _debounce.default)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
121
- var _this$state, query, sessionId, closed, _this$props, baseUrl, childObjectId, containerId, fieldId, includeGroups, includeTeams, includeUsers, includeNonLicensedUsers, intl, maxOptions, objectId, onEmpty, onError, overrideByline, displayEmailInByline, orgId, principalId, productAttributes, productKey, searchQueryFilter, siteId, transformOptions, userResolvers, enableEmailSearch, maxNumberOfResults, startTime, isEmail, recommendationsRequest, _yield$onEmpty, _query, recommendedUsers, userRecommendationsPromise, userResolversPromises, _yield$Promise$all, _yield$Promise$all2, mainRecommendations, userResolverResults, _iterator, _step, option, _iterator2, _step2, _option, elapsedTimeMilli, transformedOptions, displayedUsers, is5xxEvent, onErrorProducedError, defaultUsers, _elapsedTimeMilli;
121
+ var _this$state, query, sessionId, closed, _this$props, baseUrl, childObjectId, containerId, fieldId, includeGroups, includeTeams, includeTeamsUpdates, includeUsers, includeNonLicensedUsers, intl, fetchOptions, maxOptions, objectId, onEmpty, onError, overrideByline, displayEmailInByline, orgId, principalId, productAttributes, productKey, searchQueryFilter, siteId, transformOptions, userResolvers, enableEmailSearch, maxNumberOfResults, startTime, isEmail, recommendationsRequest, _yield$onEmpty, _query, recommendedUsers, userRecommendationsPromise, userResolversPromises, _yield$Promise$all, _yield$Promise$all2, mainRecommendations, userResolverResults, _iterator, _step, option, _iterator2, _step2, _option, _iterator3, _step3, _option2, elapsedTimeMilli, transformedOptions, displayedUsers, is5xxEvent, onErrorProducedError, defaultUsers, _elapsedTimeMilli;
122
122
  return _regenerator.default.wrap(function _callee$(_context) {
123
123
  while (1) switch (_context.prev = _context.next) {
124
124
  case 0:
125
125
  _this$state = _this.state, query = _this$state.query, sessionId = _this$state.sessionId, closed = _this$state.closed;
126
- _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, includeNonLicensedUsers = _this$props.includeNonLicensedUsers, intl = _this$props.intl, maxOptions = _this$props.maxOptions, objectId = _this$props.objectId, onEmpty = _this$props.onEmpty, onError = _this$props.onError, overrideByline = _this$props.overrideByline, displayEmailInByline = _this$props.displayEmailInByline, orgId = _this$props.orgId, principalId = _this$props.principalId, productAttributes = _this$props.productAttributes, productKey = _this$props.productKey, searchQueryFilter = _this$props.searchQueryFilter, siteId = _this$props.siteId, transformOptions = _this$props.transformOptions, userResolvers = _this$props.userResolvers, enableEmailSearch = _this$props.enableEmailSearch;
126
+ _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, includeTeamsUpdates = _this$props.includeTeamsUpdates, includeUsers = _this$props.includeUsers, includeNonLicensedUsers = _this$props.includeNonLicensedUsers, intl = _this$props.intl, fetchOptions = _this$props.fetchOptions, maxOptions = _this$props.maxOptions, objectId = _this$props.objectId, onEmpty = _this$props.onEmpty, onError = _this$props.onError, overrideByline = _this$props.overrideByline, displayEmailInByline = _this$props.displayEmailInByline, orgId = _this$props.orgId, principalId = _this$props.principalId, productAttributes = _this$props.productAttributes, productKey = _this$props.productKey, searchQueryFilter = _this$props.searchQueryFilter, siteId = _this$props.siteId, transformOptions = _this$props.transformOptions, userResolvers = _this$props.userResolvers, enableEmailSearch = _this$props.enableEmailSearch;
127
127
  maxNumberOfResults = maxOptions || 100;
128
128
  startTime = window.performance.now(); // Check if this is an email search
129
129
  isEmail = enableEmailSearch && isEmailQuery(query);
@@ -160,8 +160,19 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
160
160
  _context.prev = 6;
161
161
  _query = _this.state.query;
162
162
  _this.fireEvent(_analytics.requestUsersEvent);
163
+ if (!(fetchOptions && (0, _platformFeatureFlags.fg)('smart-user-picker-load-options-gate'))) {
164
+ _context.next = 15;
165
+ break;
166
+ }
167
+ _context.next = 12;
168
+ return fetchOptions(_query);
169
+ case 12:
170
+ recommendedUsers = _context.sent;
171
+ _context.next = 30;
172
+ break;
173
+ case 15:
163
174
  if (!(0, _platformFeatureFlags.fg)('twcg-444-invite-usd-improvements-m2-gate')) {
164
- _context.next = 21;
175
+ _context.next = 27;
165
176
  break;
166
177
  }
167
178
  userRecommendationsPromise = (0, _service.getUserRecommendations)(recommendationsRequest, intl);
@@ -174,22 +185,22 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
174
185
  return [];
175
186
  });
176
187
  });
177
- _context.next = 14;
188
+ _context.next = 20;
178
189
  return Promise.all([userRecommendationsPromise].concat((0, _toConsumableArray2.default)(userResolversPromises)));
179
- case 14:
190
+ case 20:
180
191
  _yield$Promise$all = _context.sent;
181
192
  _yield$Promise$all2 = (0, _toArray2.default)(_yield$Promise$all);
182
193
  mainRecommendations = _yield$Promise$all2[0];
183
194
  userResolverResults = _yield$Promise$all2.slice(1);
184
195
  recommendedUsers = [mainRecommendations].concat((0, _toConsumableArray2.default)(userResolverResults)).flat();
185
- _context.next = 24;
196
+ _context.next = 30;
186
197
  break;
187
- case 21:
188
- _context.next = 23;
198
+ case 27:
199
+ _context.next = 29;
189
200
  return (0, _service.getUserRecommendations)(recommendationsRequest, intl);
190
- case 23:
201
+ case 29:
191
202
  recommendedUsers = _context.sent;
192
- case 24:
203
+ case 30:
193
204
  if (overrideByline) {
194
205
  _iterator = _createForOfIteratorHelper(recommendedUsers);
195
206
  try {
@@ -225,6 +236,21 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
225
236
  _iterator2.f();
226
237
  }
227
238
  }
239
+ if (includeTeamsUpdates) {
240
+ _iterator3 = _createForOfIteratorHelper(recommendedUsers);
241
+ try {
242
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
243
+ _option2 = _step3.value;
244
+ if ((0, _userPicker.isGroup)(_option2) || (0, _userPicker.isTeam)(_option2)) {
245
+ _option2.includeTeamsUpdates = includeTeamsUpdates;
246
+ }
247
+ }
248
+ } catch (err) {
249
+ _iterator3.e(err);
250
+ } finally {
251
+ _iterator3.f();
252
+ }
253
+ }
228
254
 
229
255
  // Track if email search found matches for conditional allowEmail logic
230
256
  if (isEmail) {
@@ -234,50 +260,50 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
234
260
  }
235
261
  elapsedTimeMilli = window.performance.now() - startTime;
236
262
  if (!transformOptions) {
237
- _context.next = 34;
263
+ _context.next = 41;
238
264
  break;
239
265
  }
240
- _context.next = 31;
266
+ _context.next = 38;
241
267
  return transformOptions(recommendedUsers, _query);
242
- case 31:
268
+ case 38:
243
269
  _context.t0 = _context.sent;
244
- _context.next = 35;
270
+ _context.next = 42;
245
271
  break;
246
- case 34:
272
+ case 41:
247
273
  _context.t0 = recommendedUsers;
248
- case 35:
274
+ case 42:
249
275
  transformedOptions = _context.t0;
250
276
  if (!(transformedOptions.length === 0 && onEmpty)) {
251
- _context.next = 51;
277
+ _context.next = 58;
252
278
  break;
253
279
  }
254
- _context.next = 39;
280
+ _context.next = 46;
255
281
  return onEmpty(_query);
256
- case 39:
282
+ case 46:
257
283
  _context.t3 = _yield$onEmpty = _context.sent;
258
284
  _context.t2 = _context.t3 !== null;
259
285
  if (!_context.t2) {
260
- _context.next = 43;
286
+ _context.next = 50;
261
287
  break;
262
288
  }
263
289
  _context.t2 = _yield$onEmpty !== void 0;
264
- case 43:
290
+ case 50:
265
291
  if (!_context.t2) {
266
- _context.next = 47;
292
+ _context.next = 54;
267
293
  break;
268
294
  }
269
295
  _context.t4 = _yield$onEmpty;
270
- _context.next = 48;
296
+ _context.next = 55;
271
297
  break;
272
- case 47:
298
+ case 54:
273
299
  _context.t4 = [];
274
- case 48:
300
+ case 55:
275
301
  _context.t1 = _context.t4;
276
- _context.next = 52;
302
+ _context.next = 59;
277
303
  break;
278
- case 51:
304
+ case 58:
279
305
  _context.t1 = transformedOptions;
280
- case 52:
306
+ case 59:
281
307
  displayedUsers = _context.t1;
282
308
  _this.setState(function (state) {
283
309
  var applicable = state.query === _query;
@@ -299,10 +325,10 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
299
325
  loading: loading
300
326
  };
301
327
  });
302
- _context.next = 85;
328
+ _context.next = 92;
303
329
  break;
304
- case 56:
305
- _context.prev = 56;
330
+ case 63:
331
+ _context.prev = 63;
306
332
  _context.t5 = _context["catch"](6);
307
333
  is5xxEvent = checkIf500Event(_context.t5.statusCode);
308
334
  if (!closed && !onError && is5xxEvent) {
@@ -315,35 +341,35 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
315
341
  });
316
342
  onErrorProducedError = false;
317
343
  defaultUsers = [];
318
- _context.prev = 63;
344
+ _context.prev = 70;
319
345
  if (!onError) {
320
- _context.next = 73;
346
+ _context.next = 80;
321
347
  break;
322
348
  }
323
- _context.next = 67;
349
+ _context.next = 74;
324
350
  return onError(_context.t5, recommendationsRequest);
325
- case 67:
351
+ case 74:
326
352
  _context.t7 = _context.sent;
327
353
  if (_context.t7) {
328
- _context.next = 70;
354
+ _context.next = 77;
329
355
  break;
330
356
  }
331
357
  _context.t7 = [];
332
- case 70:
358
+ case 77:
333
359
  _context.t6 = _context.t7;
334
- _context.next = 74;
360
+ _context.next = 81;
335
361
  break;
336
- case 73:
362
+ case 80:
337
363
  _context.t6 = [];
338
- case 74:
364
+ case 81:
339
365
  defaultUsers = _context.t6;
340
- _context.next = 80;
366
+ _context.next = 87;
341
367
  break;
342
- case 77:
343
- _context.prev = 77;
344
- _context.t8 = _context["catch"](63);
368
+ case 84:
369
+ _context.prev = 84;
370
+ _context.t8 = _context["catch"](70);
345
371
  onErrorProducedError = true;
346
- case 80:
372
+ case 87:
347
373
  if (onErrorProducedError && is5xxEvent) {
348
374
  // Log error from fallback data source `onError` to UFO
349
375
  _this.optionsShownUfoExperienceInstance.failure(ufoEndStateConfig(_this.props.fieldId));
@@ -360,11 +386,11 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
360
386
  elapsedTimeMilli: _elapsedTimeMilli,
361
387
  productAttributes: productAttributes
362
388
  });
363
- case 85:
389
+ case 92:
364
390
  case "end":
365
391
  return _context.stop();
366
392
  }
367
- }, _callee, null, [[6, 56], [63, 77]]);
393
+ }, _callee, null, [[6, 63], [70, 84]]);
368
394
  })), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
369
395
  (0, _defineProperty2.default)(_this, "onInputChange", function (newQuery, sessionId) {
370
396
  var query = newQuery || '';
@@ -491,6 +517,7 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
491
517
  case 13:
492
518
  prefetch = this.props.prefetch;
493
519
  if (prefetch) {
520
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
494
521
  sessionId = (0, _uuid.v4)();
495
522
  this.fireEvent(_analytics.mountedWithPrefetchEvent, {
496
523
  sessionId: sessionId
@@ -535,6 +562,7 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
535
562
  allowEmail = _this$props2.allowEmail,
536
563
  enableEmailSearch = _this$props2.enableEmailSearch,
537
564
  allowEmailSelectionWhenEmailMatched = _this$props2.allowEmailSelectionWhenEmailMatched,
565
+ fetchOptions = _this$props2.fetchOptions,
538
566
  restProps = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
539
567
 
540
568
  // Determine whether to allow email selection based on allowEmailSelectionWhenEmailMatched, if needed
@@ -551,7 +579,8 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
551
579
  onFocus: this.onFocus,
552
580
  defaultValue: this.state.defaultValue,
553
581
  isLoading: this.props.isLoading || this.state.loading && !this.state.closed && (!this.props.bootstrapOptions || this.state.query !== ''),
554
- options: this.filterUsers()
582
+ options: this.filterUsers(),
583
+ menuIsOpen: this.props.menuIsOpen
555
584
  })));
556
585
  }
557
586
  }]);
@@ -561,6 +590,7 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
561
590
  includeUsers: true,
562
591
  includeGroups: false,
563
592
  includeTeams: false,
593
+ includeTeamsUpdates: false,
564
594
  includeNonLicensedUsers: false,
565
595
  displayEmailInByline: false,
566
596
  prefetch: false,
@@ -1,8 +1,10 @@
1
1
  import { createAndFireEvent } from '@atlaskit/analytics-next';
2
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
2
3
  import { v4 as uuid } from 'uuid';
3
4
  const packageName = "@atlaskit/smart-user-picker";
4
5
  const packageVersion = "0.0.0-development";
5
6
  export const startSession = () => ({
7
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
6
8
  id: uuid(),
7
9
  start: Date.now(),
8
10
  inputChangeTime: Date.now(),
@@ -2,12 +2,13 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
  import debounce from 'lodash/debounce';
5
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
5
6
  import { v4 as uuidV4 } from 'uuid';
6
7
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
7
8
  import memoizeOne from 'memoize-one';
8
9
  import { injectIntl } from 'react-intl-next';
9
10
  import { UFOExperienceState } from '@atlaskit/ufo';
10
- import UserPicker, { isExternalUser, isTeam, isUser, isValidEmail } from '@atlaskit/user-picker';
11
+ import UserPicker, { isExternalUser, isTeam, isGroup, isUser, isValidEmail } from '@atlaskit/user-picker';
11
12
  import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { requestUsersEvent, filterUsersEvent, preparedUsersLoadedEvent, successfulRequestUsersEvent, failedRequestUsersEvent, mountedWithPrefetchEvent, createAndFireEventInElementsChannel, failedUserResolversEvent } from '../analytics';
13
14
  import MessagesIntlProvider from './MessagesIntlProvider';
@@ -91,9 +92,11 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
91
92
  fieldId,
92
93
  includeGroups,
93
94
  includeTeams,
95
+ includeTeamsUpdates,
94
96
  includeUsers,
95
97
  includeNonLicensedUsers,
96
98
  intl,
99
+ fetchOptions,
97
100
  maxOptions,
98
101
  objectId,
99
102
  onEmpty,
@@ -152,7 +155,9 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
152
155
  } = this.state;
153
156
  this.fireEvent(requestUsersEvent);
154
157
  let recommendedUsers;
155
- if (fg('twcg-444-invite-usd-improvements-m2-gate')) {
158
+ if (fetchOptions && fg('smart-user-picker-load-options-gate')) {
159
+ recommendedUsers = await fetchOptions(query);
160
+ } else if (fg('twcg-444-invite-usd-improvements-m2-gate')) {
156
161
  const userRecommendationsPromise = getUserRecommendations(recommendationsRequest, intl);
157
162
  const userResolversPromises = (userResolvers !== null && userResolvers !== void 0 ? userResolvers : []).map(resolver => resolver(query).catch(error => {
158
163
  this.fireEvent(failedUserResolversEvent, {
@@ -185,6 +190,13 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
185
190
  }
186
191
  }
187
192
  }
193
+ if (includeTeamsUpdates) {
194
+ for (let option of recommendedUsers) {
195
+ if (isGroup(option) || isTeam(option)) {
196
+ option.includeTeamsUpdates = includeTeamsUpdates;
197
+ }
198
+ }
199
+ }
188
200
 
189
201
  // Track if email search found matches for conditional allowEmail logic
190
202
  if (isEmail) {
@@ -359,6 +371,7 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
359
371
  prefetch
360
372
  } = this.props;
361
373
  if (prefetch) {
374
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
362
375
  const sessionId = uuidV4();
363
376
  this.fireEvent(mountedWithPrefetchEvent, {
364
377
  sessionId
@@ -389,6 +402,7 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
389
402
  allowEmail,
390
403
  enableEmailSearch,
391
404
  allowEmailSelectionWhenEmailMatched,
405
+ fetchOptions,
392
406
  ...restProps
393
407
  } = this.props;
394
408
 
@@ -406,7 +420,8 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
406
420
  onFocus: this.onFocus,
407
421
  defaultValue: this.state.defaultValue,
408
422
  isLoading: this.props.isLoading || this.state.loading && !this.state.closed && (!this.props.bootstrapOptions || this.state.query !== ''),
409
- options: this.filterUsers()
423
+ options: this.filterUsers(),
424
+ menuIsOpen: this.props.menuIsOpen
410
425
  })));
411
426
  }
412
427
  }
@@ -417,6 +432,7 @@ _defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
417
432
  includeUsers: true,
418
433
  includeGroups: false,
419
434
  includeTeams: false,
435
+ includeTeamsUpdates: false,
420
436
  includeNonLicensedUsers: false,
421
437
  displayEmailInByline: false,
422
438
  prefetch: false,
@@ -2,11 +2,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { createAndFireEvent } from '@atlaskit/analytics-next';
5
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
5
6
  import { v4 as uuid } from 'uuid';
6
7
  var packageName = "@atlaskit/smart-user-picker";
7
8
  var packageVersion = "0.0.0-development";
8
9
  export var startSession = function startSession() {
9
10
  return {
11
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
10
12
  id: uuid(),
11
13
  start: Date.now(),
12
14
  inputChangeTime: Date.now(),
@@ -9,7 +9,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
9
9
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
10
  import _inherits from "@babel/runtime/helpers/inherits";
11
11
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
12
- var _excluded = ["allowEmail", "enableEmailSearch", "allowEmailSelectionWhenEmailMatched"];
12
+ var _excluded = ["allowEmail", "enableEmailSearch", "allowEmailSelectionWhenEmailMatched", "fetchOptions"];
13
13
  import _regeneratorRuntime from "@babel/runtime/regenerator";
14
14
  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; }
15
15
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -20,12 +20,13 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
20
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
21
21
  import React from 'react';
22
22
  import debounce from 'lodash/debounce';
23
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
23
24
  import { v4 as uuidV4 } from 'uuid';
24
25
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
25
26
  import memoizeOne from 'memoize-one';
26
27
  import { injectIntl } from 'react-intl-next';
27
28
  import { UFOExperienceState } from '@atlaskit/ufo';
28
- import UserPicker, { isExternalUser, isTeam, isUser, isValidEmail } from '@atlaskit/user-picker';
29
+ import UserPicker, { isExternalUser, isTeam, isGroup, isUser, isValidEmail } from '@atlaskit/user-picker';
29
30
  import { fg } from '@atlaskit/platform-feature-flags';
30
31
  import { requestUsersEvent, filterUsersEvent, preparedUsersLoadedEvent, successfulRequestUsersEvent, failedRequestUsersEvent, mountedWithPrefetchEvent, createAndFireEventInElementsChannel, failedUserResolversEvent } from '../analytics';
31
32
  import MessagesIntlProvider from './MessagesIntlProvider';
@@ -109,12 +110,12 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
109
110
  });
110
111
  _defineProperty(_this, "memoizedFilterOptions", memoizeOne(_this.filterOptions));
111
112
  _defineProperty(_this, "getUsers", debounce( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
112
- var _this$state, query, sessionId, closed, _this$props, baseUrl, childObjectId, containerId, fieldId, includeGroups, includeTeams, includeUsers, includeNonLicensedUsers, intl, maxOptions, objectId, onEmpty, onError, overrideByline, displayEmailInByline, orgId, principalId, productAttributes, productKey, searchQueryFilter, siteId, transformOptions, userResolvers, enableEmailSearch, maxNumberOfResults, startTime, isEmail, recommendationsRequest, _yield$onEmpty, _query, recommendedUsers, userRecommendationsPromise, userResolversPromises, _yield$Promise$all, _yield$Promise$all2, mainRecommendations, userResolverResults, _iterator, _step, option, _iterator2, _step2, _option, elapsedTimeMilli, transformedOptions, displayedUsers, is5xxEvent, onErrorProducedError, defaultUsers, _elapsedTimeMilli;
113
+ var _this$state, query, sessionId, closed, _this$props, baseUrl, childObjectId, containerId, fieldId, includeGroups, includeTeams, includeTeamsUpdates, includeUsers, includeNonLicensedUsers, intl, fetchOptions, maxOptions, objectId, onEmpty, onError, overrideByline, displayEmailInByline, orgId, principalId, productAttributes, productKey, searchQueryFilter, siteId, transformOptions, userResolvers, enableEmailSearch, maxNumberOfResults, startTime, isEmail, recommendationsRequest, _yield$onEmpty, _query, recommendedUsers, userRecommendationsPromise, userResolversPromises, _yield$Promise$all, _yield$Promise$all2, mainRecommendations, userResolverResults, _iterator, _step, option, _iterator2, _step2, _option, _iterator3, _step3, _option2, elapsedTimeMilli, transformedOptions, displayedUsers, is5xxEvent, onErrorProducedError, defaultUsers, _elapsedTimeMilli;
113
114
  return _regeneratorRuntime.wrap(function _callee$(_context) {
114
115
  while (1) switch (_context.prev = _context.next) {
115
116
  case 0:
116
117
  _this$state = _this.state, query = _this$state.query, sessionId = _this$state.sessionId, closed = _this$state.closed;
117
- _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, includeNonLicensedUsers = _this$props.includeNonLicensedUsers, intl = _this$props.intl, maxOptions = _this$props.maxOptions, objectId = _this$props.objectId, onEmpty = _this$props.onEmpty, onError = _this$props.onError, overrideByline = _this$props.overrideByline, displayEmailInByline = _this$props.displayEmailInByline, orgId = _this$props.orgId, principalId = _this$props.principalId, productAttributes = _this$props.productAttributes, productKey = _this$props.productKey, searchQueryFilter = _this$props.searchQueryFilter, siteId = _this$props.siteId, transformOptions = _this$props.transformOptions, userResolvers = _this$props.userResolvers, enableEmailSearch = _this$props.enableEmailSearch;
118
+ _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, includeTeamsUpdates = _this$props.includeTeamsUpdates, includeUsers = _this$props.includeUsers, includeNonLicensedUsers = _this$props.includeNonLicensedUsers, intl = _this$props.intl, fetchOptions = _this$props.fetchOptions, maxOptions = _this$props.maxOptions, objectId = _this$props.objectId, onEmpty = _this$props.onEmpty, onError = _this$props.onError, overrideByline = _this$props.overrideByline, displayEmailInByline = _this$props.displayEmailInByline, orgId = _this$props.orgId, principalId = _this$props.principalId, productAttributes = _this$props.productAttributes, productKey = _this$props.productKey, searchQueryFilter = _this$props.searchQueryFilter, siteId = _this$props.siteId, transformOptions = _this$props.transformOptions, userResolvers = _this$props.userResolvers, enableEmailSearch = _this$props.enableEmailSearch;
118
119
  maxNumberOfResults = maxOptions || 100;
119
120
  startTime = window.performance.now(); // Check if this is an email search
120
121
  isEmail = enableEmailSearch && isEmailQuery(query);
@@ -151,8 +152,19 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
151
152
  _context.prev = 6;
152
153
  _query = _this.state.query;
153
154
  _this.fireEvent(requestUsersEvent);
155
+ if (!(fetchOptions && fg('smart-user-picker-load-options-gate'))) {
156
+ _context.next = 15;
157
+ break;
158
+ }
159
+ _context.next = 12;
160
+ return fetchOptions(_query);
161
+ case 12:
162
+ recommendedUsers = _context.sent;
163
+ _context.next = 30;
164
+ break;
165
+ case 15:
154
166
  if (!fg('twcg-444-invite-usd-improvements-m2-gate')) {
155
- _context.next = 21;
167
+ _context.next = 27;
156
168
  break;
157
169
  }
158
170
  userRecommendationsPromise = getUserRecommendations(recommendationsRequest, intl);
@@ -165,22 +177,22 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
165
177
  return [];
166
178
  });
167
179
  });
168
- _context.next = 14;
180
+ _context.next = 20;
169
181
  return Promise.all([userRecommendationsPromise].concat(_toConsumableArray(userResolversPromises)));
170
- case 14:
182
+ case 20:
171
183
  _yield$Promise$all = _context.sent;
172
184
  _yield$Promise$all2 = _toArray(_yield$Promise$all);
173
185
  mainRecommendations = _yield$Promise$all2[0];
174
186
  userResolverResults = _yield$Promise$all2.slice(1);
175
187
  recommendedUsers = [mainRecommendations].concat(_toConsumableArray(userResolverResults)).flat();
176
- _context.next = 24;
188
+ _context.next = 30;
177
189
  break;
178
- case 21:
179
- _context.next = 23;
190
+ case 27:
191
+ _context.next = 29;
180
192
  return getUserRecommendations(recommendationsRequest, intl);
181
- case 23:
193
+ case 29:
182
194
  recommendedUsers = _context.sent;
183
- case 24:
195
+ case 30:
184
196
  if (overrideByline) {
185
197
  _iterator = _createForOfIteratorHelper(recommendedUsers);
186
198
  try {
@@ -216,6 +228,21 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
216
228
  _iterator2.f();
217
229
  }
218
230
  }
231
+ if (includeTeamsUpdates) {
232
+ _iterator3 = _createForOfIteratorHelper(recommendedUsers);
233
+ try {
234
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
235
+ _option2 = _step3.value;
236
+ if (isGroup(_option2) || isTeam(_option2)) {
237
+ _option2.includeTeamsUpdates = includeTeamsUpdates;
238
+ }
239
+ }
240
+ } catch (err) {
241
+ _iterator3.e(err);
242
+ } finally {
243
+ _iterator3.f();
244
+ }
245
+ }
219
246
 
220
247
  // Track if email search found matches for conditional allowEmail logic
221
248
  if (isEmail) {
@@ -225,50 +252,50 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
225
252
  }
226
253
  elapsedTimeMilli = window.performance.now() - startTime;
227
254
  if (!transformOptions) {
228
- _context.next = 34;
255
+ _context.next = 41;
229
256
  break;
230
257
  }
231
- _context.next = 31;
258
+ _context.next = 38;
232
259
  return transformOptions(recommendedUsers, _query);
233
- case 31:
260
+ case 38:
234
261
  _context.t0 = _context.sent;
235
- _context.next = 35;
262
+ _context.next = 42;
236
263
  break;
237
- case 34:
264
+ case 41:
238
265
  _context.t0 = recommendedUsers;
239
- case 35:
266
+ case 42:
240
267
  transformedOptions = _context.t0;
241
268
  if (!(transformedOptions.length === 0 && onEmpty)) {
242
- _context.next = 51;
269
+ _context.next = 58;
243
270
  break;
244
271
  }
245
- _context.next = 39;
272
+ _context.next = 46;
246
273
  return onEmpty(_query);
247
- case 39:
274
+ case 46:
248
275
  _context.t3 = _yield$onEmpty = _context.sent;
249
276
  _context.t2 = _context.t3 !== null;
250
277
  if (!_context.t2) {
251
- _context.next = 43;
278
+ _context.next = 50;
252
279
  break;
253
280
  }
254
281
  _context.t2 = _yield$onEmpty !== void 0;
255
- case 43:
282
+ case 50:
256
283
  if (!_context.t2) {
257
- _context.next = 47;
284
+ _context.next = 54;
258
285
  break;
259
286
  }
260
287
  _context.t4 = _yield$onEmpty;
261
- _context.next = 48;
288
+ _context.next = 55;
262
289
  break;
263
- case 47:
290
+ case 54:
264
291
  _context.t4 = [];
265
- case 48:
292
+ case 55:
266
293
  _context.t1 = _context.t4;
267
- _context.next = 52;
294
+ _context.next = 59;
268
295
  break;
269
- case 51:
296
+ case 58:
270
297
  _context.t1 = transformedOptions;
271
- case 52:
298
+ case 59:
272
299
  displayedUsers = _context.t1;
273
300
  _this.setState(function (state) {
274
301
  var applicable = state.query === _query;
@@ -290,10 +317,10 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
290
317
  loading: loading
291
318
  };
292
319
  });
293
- _context.next = 85;
320
+ _context.next = 92;
294
321
  break;
295
- case 56:
296
- _context.prev = 56;
322
+ case 63:
323
+ _context.prev = 63;
297
324
  _context.t5 = _context["catch"](6);
298
325
  is5xxEvent = checkIf500Event(_context.t5.statusCode);
299
326
  if (!closed && !onError && is5xxEvent) {
@@ -306,35 +333,35 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
306
333
  });
307
334
  onErrorProducedError = false;
308
335
  defaultUsers = [];
309
- _context.prev = 63;
336
+ _context.prev = 70;
310
337
  if (!onError) {
311
- _context.next = 73;
338
+ _context.next = 80;
312
339
  break;
313
340
  }
314
- _context.next = 67;
341
+ _context.next = 74;
315
342
  return onError(_context.t5, recommendationsRequest);
316
- case 67:
343
+ case 74:
317
344
  _context.t7 = _context.sent;
318
345
  if (_context.t7) {
319
- _context.next = 70;
346
+ _context.next = 77;
320
347
  break;
321
348
  }
322
349
  _context.t7 = [];
323
- case 70:
350
+ case 77:
324
351
  _context.t6 = _context.t7;
325
- _context.next = 74;
352
+ _context.next = 81;
326
353
  break;
327
- case 73:
354
+ case 80:
328
355
  _context.t6 = [];
329
- case 74:
356
+ case 81:
330
357
  defaultUsers = _context.t6;
331
- _context.next = 80;
358
+ _context.next = 87;
332
359
  break;
333
- case 77:
334
- _context.prev = 77;
335
- _context.t8 = _context["catch"](63);
360
+ case 84:
361
+ _context.prev = 84;
362
+ _context.t8 = _context["catch"](70);
336
363
  onErrorProducedError = true;
337
- case 80:
364
+ case 87:
338
365
  if (onErrorProducedError && is5xxEvent) {
339
366
  // Log error from fallback data source `onError` to UFO
340
367
  _this.optionsShownUfoExperienceInstance.failure(ufoEndStateConfig(_this.props.fieldId));
@@ -351,11 +378,11 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
351
378
  elapsedTimeMilli: _elapsedTimeMilli,
352
379
  productAttributes: productAttributes
353
380
  });
354
- case 85:
381
+ case 92:
355
382
  case "end":
356
383
  return _context.stop();
357
384
  }
358
- }, _callee, null, [[6, 56], [63, 77]]);
385
+ }, _callee, null, [[6, 63], [70, 84]]);
359
386
  })), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
360
387
  _defineProperty(_this, "onInputChange", function (newQuery, sessionId) {
361
388
  var query = newQuery || '';
@@ -482,6 +509,7 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
482
509
  case 13:
483
510
  prefetch = this.props.prefetch;
484
511
  if (prefetch) {
512
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
485
513
  sessionId = uuidV4();
486
514
  this.fireEvent(mountedWithPrefetchEvent, {
487
515
  sessionId: sessionId
@@ -526,6 +554,7 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
526
554
  allowEmail = _this$props2.allowEmail,
527
555
  enableEmailSearch = _this$props2.enableEmailSearch,
528
556
  allowEmailSelectionWhenEmailMatched = _this$props2.allowEmailSelectionWhenEmailMatched,
557
+ fetchOptions = _this$props2.fetchOptions,
529
558
  restProps = _objectWithoutProperties(_this$props2, _excluded);
530
559
 
531
560
  // Determine whether to allow email selection based on allowEmailSelectionWhenEmailMatched, if needed
@@ -542,7 +571,8 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
542
571
  onFocus: this.onFocus,
543
572
  defaultValue: this.state.defaultValue,
544
573
  isLoading: this.props.isLoading || this.state.loading && !this.state.closed && (!this.props.bootstrapOptions || this.state.query !== ''),
545
- options: this.filterUsers()
574
+ options: this.filterUsers(),
575
+ menuIsOpen: this.props.menuIsOpen
546
576
  })));
547
577
  }
548
578
  }]);
@@ -554,6 +584,7 @@ _defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
554
584
  includeUsers: true,
555
585
  includeGroups: false,
556
586
  includeTeams: false,
587
+ includeTeamsUpdates: false,
557
588
  includeNonLicensedUsers: false,
558
589
  displayEmailInByline: false,
559
590
  prefetch: false,
@@ -12,6 +12,7 @@ export declare class SmartUserPickerWithoutAnalytics extends React.Component<Pro
12
12
  includeUsers: boolean;
13
13
  includeGroups: boolean;
14
14
  includeTeams: boolean;
15
+ includeTeamsUpdates: boolean;
15
16
  includeNonLicensedUsers: boolean;
16
17
  displayEmailInByline: boolean;
17
18
  prefetch: boolean;
@@ -228,6 +228,20 @@ export interface SmartProps {
228
228
  * Optional callback to provide additional user resolvers, such as for fetching and adding users from third party sources
229
229
  */
230
230
  userResolvers?: Array<(query: string) => Promise<OptionData[]>>;
231
+ /**
232
+ * Custom fetcher function to load options. When provided, this function will be called
233
+ * instead of the default recommendation API. The function receives the search term
234
+ * and should return a Promise that resolves to an array of OptionData.
235
+ */
236
+ fetchOptions?: (query: string) => Promise<OptionData[]>;
237
+ /**
238
+ * Whether to include teams UI updates in the resultset. @default false
239
+ */
240
+ includeTeamsUpdates?: boolean;
241
+ /** Checks if the footer is focused or not. This is needed to keep the menu open when the footer is focused */
242
+ isFooterFocused?: boolean;
243
+ /** Sets if the footer is focused or not. This is needed to keep the menu open when the footer is focused */
244
+ setIsFooterFocused?: React.Dispatch<React.SetStateAction<boolean>>;
231
245
  }
232
246
  export interface Props extends SmartProps, UserPickerProps, WithAnalyticsEventsProps {
233
247
  /**
@@ -253,5 +267,7 @@ export interface Props extends SmartProps, UserPickerProps, WithAnalyticsEventsP
253
267
  * @Mentions. For specifically trained models, please contact #search-plex.
254
268
  */
255
269
  fieldId: string;
270
+ /** Whether the menu is open or not. */
271
+ menuIsOpen?: boolean;
256
272
  }
257
273
  export {};
@@ -12,6 +12,7 @@ export declare class SmartUserPickerWithoutAnalytics extends React.Component<Pro
12
12
  includeUsers: boolean;
13
13
  includeGroups: boolean;
14
14
  includeTeams: boolean;
15
+ includeTeamsUpdates: boolean;
15
16
  includeNonLicensedUsers: boolean;
16
17
  displayEmailInByline: boolean;
17
18
  prefetch: boolean;
@@ -228,6 +228,20 @@ export interface SmartProps {
228
228
  * Optional callback to provide additional user resolvers, such as for fetching and adding users from third party sources
229
229
  */
230
230
  userResolvers?: Array<(query: string) => Promise<OptionData[]>>;
231
+ /**
232
+ * Custom fetcher function to load options. When provided, this function will be called
233
+ * instead of the default recommendation API. The function receives the search term
234
+ * and should return a Promise that resolves to an array of OptionData.
235
+ */
236
+ fetchOptions?: (query: string) => Promise<OptionData[]>;
237
+ /**
238
+ * Whether to include teams UI updates in the resultset. @default false
239
+ */
240
+ includeTeamsUpdates?: boolean;
241
+ /** Checks if the footer is focused or not. This is needed to keep the menu open when the footer is focused */
242
+ isFooterFocused?: boolean;
243
+ /** Sets if the footer is focused or not. This is needed to keep the menu open when the footer is focused */
244
+ setIsFooterFocused?: React.Dispatch<React.SetStateAction<boolean>>;
231
245
  }
232
246
  export interface Props extends SmartProps, UserPickerProps, WithAnalyticsEventsProps {
233
247
  /**
@@ -253,5 +267,7 @@ export interface Props extends SmartProps, UserPickerProps, WithAnalyticsEventsP
253
267
  * @Mentions. For specifically trained models, please contact #search-plex.
254
268
  */
255
269
  fieldId: string;
270
+ /** Whether the menu is open or not. */
271
+ menuIsOpen?: boolean;
256
272
  }
257
273
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-user-picker",
3
- "version": "8.4.1",
3
+ "version": "8.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/analytics-next": "^11.1.0",
39
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
40
  "@atlaskit/ufo": "^0.4.0",
41
- "@atlaskit/user-picker": "^11.12.0",
41
+ "@atlaskit/user-picker": "^11.18.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "lodash": "^4.17.21",
44
44
  "memoize-one": "^6.0.0",
@@ -50,7 +50,7 @@
50
50
  "react-dom": "^18.2.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@atlaskit/select": "^21.3.0",
53
+ "@atlaskit/select": "^21.6.0",
54
54
  "@atlaskit/util-data-test": "^18.3.0",
55
55
  "@testing-library/dom": "^10.1.0",
56
56
  "@testing-library/react": "^13.4.0",
@@ -63,6 +63,9 @@
63
63
  "platform-feature-flags": {
64
64
  "twcg-444-invite-usd-improvements-m2-gate": {
65
65
  "type": "boolean"
66
+ },
67
+ "smart-user-picker-load-options-gate": {
68
+ "type": "boolean"
66
69
  }
67
70
  }
68
71
  }