@atlaskit/smart-user-picker 8.6.0 → 8.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlassian/smart-user-picker
2
2
 
3
+ ## 8.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ae3f597598ae8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ae3f597598ae8) -
8
+ Added prop to toggle the ability to return only verified teams. Only applies when includeTeams is
9
+ true.
10
+
3
11
  ## 8.6.0
4
12
 
5
13
  ### Minor Changes
@@ -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", "fetchOptions"];
35
+ var _excluded = ["allowEmail", "enableEmailSearch", "allowEmailSelectionWhenEmailMatched"];
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; }
@@ -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, 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;
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, verifiedTeams, 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, 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;
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, verifiedTeams = _this$props.verifiedTeams, 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);
@@ -149,6 +149,7 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
149
149
  maxNumberOfResults: maxNumberOfResults,
150
150
  query: query,
151
151
  searchEmail: isEmail,
152
+ verifiedTeams: verifiedTeams,
152
153
  /*
153
154
  For email-based searches, we have decided to filter out apps.
154
155
  Also - because the other 2 filters ((NOT not_mentionable:true) AND (account_status:active)) are included
@@ -252,6 +253,19 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
252
253
  }
253
254
  }
254
255
 
256
+ // Filter to only verified teams when verifiedTeams is true and feature flag is enabled
257
+ if (verifiedTeams && includeTeams && (0, _platformFeatureFlags.fg)('smart-user-picker-managed-teams-gate')) {
258
+ recommendedUsers = recommendedUsers.filter(function (option) {
259
+ if ((0, _userPicker.isTeam)(option)) {
260
+ // Only include teams that are verified
261
+ // The verified property is set by the transformer from the server response
262
+ var team = option;
263
+ return team.verified === true;
264
+ }
265
+ return true; // Keep non-team options
266
+ });
267
+ }
268
+
255
269
  // Track if email search found matches for conditional allowEmail logic
256
270
  if (isEmail) {
257
271
  _this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
@@ -260,50 +274,50 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
260
274
  }
261
275
  elapsedTimeMilli = window.performance.now() - startTime;
262
276
  if (!transformOptions) {
263
- _context.next = 41;
277
+ _context.next = 42;
264
278
  break;
265
279
  }
266
- _context.next = 38;
280
+ _context.next = 39;
267
281
  return transformOptions(recommendedUsers, _query);
268
- case 38:
282
+ case 39:
269
283
  _context.t0 = _context.sent;
270
- _context.next = 42;
284
+ _context.next = 43;
271
285
  break;
272
- case 41:
273
- _context.t0 = recommendedUsers;
274
286
  case 42:
287
+ _context.t0 = recommendedUsers;
288
+ case 43:
275
289
  transformedOptions = _context.t0;
276
290
  if (!(transformedOptions.length === 0 && onEmpty)) {
277
- _context.next = 58;
291
+ _context.next = 59;
278
292
  break;
279
293
  }
280
- _context.next = 46;
294
+ _context.next = 47;
281
295
  return onEmpty(_query);
282
- case 46:
296
+ case 47:
283
297
  _context.t3 = _yield$onEmpty = _context.sent;
284
298
  _context.t2 = _context.t3 !== null;
285
299
  if (!_context.t2) {
286
- _context.next = 50;
300
+ _context.next = 51;
287
301
  break;
288
302
  }
289
303
  _context.t2 = _yield$onEmpty !== void 0;
290
- case 50:
304
+ case 51:
291
305
  if (!_context.t2) {
292
- _context.next = 54;
306
+ _context.next = 55;
293
307
  break;
294
308
  }
295
309
  _context.t4 = _yield$onEmpty;
296
- _context.next = 55;
310
+ _context.next = 56;
297
311
  break;
298
- case 54:
299
- _context.t4 = [];
300
312
  case 55:
313
+ _context.t4 = [];
314
+ case 56:
301
315
  _context.t1 = _context.t4;
302
- _context.next = 59;
316
+ _context.next = 60;
303
317
  break;
304
- case 58:
305
- _context.t1 = transformedOptions;
306
318
  case 59:
319
+ _context.t1 = transformedOptions;
320
+ case 60:
307
321
  displayedUsers = _context.t1;
308
322
  _this.setState(function (state) {
309
323
  var applicable = state.query === _query;
@@ -325,10 +339,10 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
325
339
  loading: loading
326
340
  };
327
341
  });
328
- _context.next = 92;
342
+ _context.next = 93;
329
343
  break;
330
- case 63:
331
- _context.prev = 63;
344
+ case 64:
345
+ _context.prev = 64;
332
346
  _context.t5 = _context["catch"](6);
333
347
  is5xxEvent = checkIf500Event(_context.t5.statusCode);
334
348
  if (!closed && !onError && is5xxEvent) {
@@ -341,35 +355,35 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
341
355
  });
342
356
  onErrorProducedError = false;
343
357
  defaultUsers = [];
344
- _context.prev = 70;
358
+ _context.prev = 71;
345
359
  if (!onError) {
346
- _context.next = 80;
360
+ _context.next = 81;
347
361
  break;
348
362
  }
349
- _context.next = 74;
363
+ _context.next = 75;
350
364
  return onError(_context.t5, recommendationsRequest);
351
- case 74:
365
+ case 75:
352
366
  _context.t7 = _context.sent;
353
367
  if (_context.t7) {
354
- _context.next = 77;
368
+ _context.next = 78;
355
369
  break;
356
370
  }
357
371
  _context.t7 = [];
358
- case 77:
372
+ case 78:
359
373
  _context.t6 = _context.t7;
360
- _context.next = 81;
374
+ _context.next = 82;
361
375
  break;
362
- case 80:
363
- _context.t6 = [];
364
376
  case 81:
377
+ _context.t6 = [];
378
+ case 82:
365
379
  defaultUsers = _context.t6;
366
- _context.next = 87;
380
+ _context.next = 88;
367
381
  break;
368
- case 84:
369
- _context.prev = 84;
370
- _context.t8 = _context["catch"](70);
382
+ case 85:
383
+ _context.prev = 85;
384
+ _context.t8 = _context["catch"](71);
371
385
  onErrorProducedError = true;
372
- case 87:
386
+ case 88:
373
387
  if (onErrorProducedError && is5xxEvent) {
374
388
  // Log error from fallback data source `onError` to UFO
375
389
  _this.optionsShownUfoExperienceInstance.failure(ufoEndStateConfig(_this.props.fieldId));
@@ -386,11 +400,11 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
386
400
  elapsedTimeMilli: _elapsedTimeMilli,
387
401
  productAttributes: productAttributes
388
402
  });
389
- case 92:
403
+ case 93:
390
404
  case "end":
391
405
  return _context.stop();
392
406
  }
393
- }, _callee, null, [[6, 63], [70, 84]]);
407
+ }, _callee, null, [[6, 64], [71, 85]]);
394
408
  })), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
395
409
  (0, _defineProperty2.default)(_this, "onInputChange", function (newQuery, sessionId) {
396
410
  var query = newQuery || '';
@@ -562,7 +576,6 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
562
576
  allowEmail = _this$props2.allowEmail,
563
577
  enableEmailSearch = _this$props2.enableEmailSearch,
564
578
  allowEmailSelectionWhenEmailMatched = _this$props2.allowEmailSelectionWhenEmailMatched,
565
- fetchOptions = _this$props2.fetchOptions,
566
579
  restProps = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
567
580
 
568
581
  // Determine whether to allow email selection based on allowEmailSelectionWhenEmailMatched, if needed
@@ -598,6 +611,7 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
598
611
  debounceTime: DEFAULT_DEBOUNCE_TIME_MS,
599
612
  userResolvers: [],
600
613
  enableEmailSearch: false,
601
- allowEmailSelectionWhenEmailMatched: true
614
+ allowEmailSelectionWhenEmailMatched: true,
615
+ verifiedTeams: false
602
616
  });
603
617
  var SmartUserPicker = exports.SmartUserPicker = (0, _analyticsNext.withAnalyticsEvents)()((0, _reactIntlNext.injectIntl)(SmartUserPickerWithoutAnalytics));
@@ -103,6 +103,7 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
103
103
  onError,
104
104
  overrideByline,
105
105
  displayEmailInByline,
106
+ verifiedTeams,
106
107
  orgId,
107
108
  principalId,
108
109
  productAttributes,
@@ -140,6 +141,7 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
140
141
  maxNumberOfResults,
141
142
  query,
142
143
  searchEmail: isEmail,
144
+ verifiedTeams,
143
145
  /*
144
146
  For email-based searches, we have decided to filter out apps.
145
147
  Also - because the other 2 filters ((NOT not_mentionable:true) AND (account_status:active)) are included
@@ -198,6 +200,19 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
198
200
  }
199
201
  }
200
202
 
203
+ // Filter to only verified teams when verifiedTeams is true and feature flag is enabled
204
+ if (verifiedTeams && includeTeams && fg('smart-user-picker-managed-teams-gate')) {
205
+ recommendedUsers = recommendedUsers.filter(option => {
206
+ if (isTeam(option)) {
207
+ // Only include teams that are verified
208
+ // The verified property is set by the transformer from the server response
209
+ const team = option;
210
+ return team.verified === true;
211
+ }
212
+ return true; // Keep non-team options
213
+ });
214
+ }
215
+
201
216
  // Track if email search found matches for conditional allowEmail logic
202
217
  if (isEmail) {
203
218
  this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
@@ -240,7 +255,7 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
240
255
  let defaultUsers = [];
241
256
  try {
242
257
  defaultUsers = onError ? (await onError(e, recommendationsRequest)) || [] : [];
243
- } catch (error) {
258
+ } catch {
244
259
  onErrorProducedError = true;
245
260
  }
246
261
  if (onErrorProducedError && is5xxEvent) {
@@ -402,7 +417,6 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
402
417
  allowEmail,
403
418
  enableEmailSearch,
404
419
  allowEmailSelectionWhenEmailMatched,
405
- fetchOptions,
406
420
  ...restProps
407
421
  } = this.props;
408
422
 
@@ -440,6 +454,7 @@ _defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
440
454
  debounceTime: DEFAULT_DEBOUNCE_TIME_MS,
441
455
  userResolvers: [],
442
456
  enableEmailSearch: false,
443
- allowEmailSelectionWhenEmailMatched: true
457
+ allowEmailSelectionWhenEmailMatched: true,
458
+ verifiedTeams: false
444
459
  });
445
460
  export const SmartUserPicker = withAnalyticsEvents()(injectIntl(SmartUserPickerWithoutAnalytics));
@@ -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", "fetchOptions"];
12
+ var _excluded = ["allowEmail", "enableEmailSearch", "allowEmailSelectionWhenEmailMatched"];
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; }
@@ -110,12 +110,12 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
110
110
  });
111
111
  _defineProperty(_this, "memoizedFilterOptions", memoizeOne(_this.filterOptions));
112
112
  _defineProperty(_this, "getUsers", debounce( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
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
+ 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, verifiedTeams, 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;
114
114
  return _regeneratorRuntime.wrap(function _callee$(_context) {
115
115
  while (1) switch (_context.prev = _context.next) {
116
116
  case 0:
117
117
  _this$state = _this.state, query = _this$state.query, sessionId = _this$state.sessionId, closed = _this$state.closed;
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
+ _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, verifiedTeams = _this$props.verifiedTeams, 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;
119
119
  maxNumberOfResults = maxOptions || 100;
120
120
  startTime = window.performance.now(); // Check if this is an email search
121
121
  isEmail = enableEmailSearch && isEmailQuery(query);
@@ -141,6 +141,7 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
141
141
  maxNumberOfResults: maxNumberOfResults,
142
142
  query: query,
143
143
  searchEmail: isEmail,
144
+ verifiedTeams: verifiedTeams,
144
145
  /*
145
146
  For email-based searches, we have decided to filter out apps.
146
147
  Also - because the other 2 filters ((NOT not_mentionable:true) AND (account_status:active)) are included
@@ -244,6 +245,19 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
244
245
  }
245
246
  }
246
247
 
248
+ // Filter to only verified teams when verifiedTeams is true and feature flag is enabled
249
+ if (verifiedTeams && includeTeams && fg('smart-user-picker-managed-teams-gate')) {
250
+ recommendedUsers = recommendedUsers.filter(function (option) {
251
+ if (isTeam(option)) {
252
+ // Only include teams that are verified
253
+ // The verified property is set by the transformer from the server response
254
+ var team = option;
255
+ return team.verified === true;
256
+ }
257
+ return true; // Keep non-team options
258
+ });
259
+ }
260
+
247
261
  // Track if email search found matches for conditional allowEmail logic
248
262
  if (isEmail) {
249
263
  _this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
@@ -252,50 +266,50 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
252
266
  }
253
267
  elapsedTimeMilli = window.performance.now() - startTime;
254
268
  if (!transformOptions) {
255
- _context.next = 41;
269
+ _context.next = 42;
256
270
  break;
257
271
  }
258
- _context.next = 38;
272
+ _context.next = 39;
259
273
  return transformOptions(recommendedUsers, _query);
260
- case 38:
274
+ case 39:
261
275
  _context.t0 = _context.sent;
262
- _context.next = 42;
276
+ _context.next = 43;
263
277
  break;
264
- case 41:
265
- _context.t0 = recommendedUsers;
266
278
  case 42:
279
+ _context.t0 = recommendedUsers;
280
+ case 43:
267
281
  transformedOptions = _context.t0;
268
282
  if (!(transformedOptions.length === 0 && onEmpty)) {
269
- _context.next = 58;
283
+ _context.next = 59;
270
284
  break;
271
285
  }
272
- _context.next = 46;
286
+ _context.next = 47;
273
287
  return onEmpty(_query);
274
- case 46:
288
+ case 47:
275
289
  _context.t3 = _yield$onEmpty = _context.sent;
276
290
  _context.t2 = _context.t3 !== null;
277
291
  if (!_context.t2) {
278
- _context.next = 50;
292
+ _context.next = 51;
279
293
  break;
280
294
  }
281
295
  _context.t2 = _yield$onEmpty !== void 0;
282
- case 50:
296
+ case 51:
283
297
  if (!_context.t2) {
284
- _context.next = 54;
298
+ _context.next = 55;
285
299
  break;
286
300
  }
287
301
  _context.t4 = _yield$onEmpty;
288
- _context.next = 55;
302
+ _context.next = 56;
289
303
  break;
290
- case 54:
291
- _context.t4 = [];
292
304
  case 55:
305
+ _context.t4 = [];
306
+ case 56:
293
307
  _context.t1 = _context.t4;
294
- _context.next = 59;
308
+ _context.next = 60;
295
309
  break;
296
- case 58:
297
- _context.t1 = transformedOptions;
298
310
  case 59:
311
+ _context.t1 = transformedOptions;
312
+ case 60:
299
313
  displayedUsers = _context.t1;
300
314
  _this.setState(function (state) {
301
315
  var applicable = state.query === _query;
@@ -317,10 +331,10 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
317
331
  loading: loading
318
332
  };
319
333
  });
320
- _context.next = 92;
334
+ _context.next = 93;
321
335
  break;
322
- case 63:
323
- _context.prev = 63;
336
+ case 64:
337
+ _context.prev = 64;
324
338
  _context.t5 = _context["catch"](6);
325
339
  is5xxEvent = checkIf500Event(_context.t5.statusCode);
326
340
  if (!closed && !onError && is5xxEvent) {
@@ -333,35 +347,35 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
333
347
  });
334
348
  onErrorProducedError = false;
335
349
  defaultUsers = [];
336
- _context.prev = 70;
350
+ _context.prev = 71;
337
351
  if (!onError) {
338
- _context.next = 80;
352
+ _context.next = 81;
339
353
  break;
340
354
  }
341
- _context.next = 74;
355
+ _context.next = 75;
342
356
  return onError(_context.t5, recommendationsRequest);
343
- case 74:
357
+ case 75:
344
358
  _context.t7 = _context.sent;
345
359
  if (_context.t7) {
346
- _context.next = 77;
360
+ _context.next = 78;
347
361
  break;
348
362
  }
349
363
  _context.t7 = [];
350
- case 77:
364
+ case 78:
351
365
  _context.t6 = _context.t7;
352
- _context.next = 81;
366
+ _context.next = 82;
353
367
  break;
354
- case 80:
355
- _context.t6 = [];
356
368
  case 81:
369
+ _context.t6 = [];
370
+ case 82:
357
371
  defaultUsers = _context.t6;
358
- _context.next = 87;
372
+ _context.next = 88;
359
373
  break;
360
- case 84:
361
- _context.prev = 84;
362
- _context.t8 = _context["catch"](70);
374
+ case 85:
375
+ _context.prev = 85;
376
+ _context.t8 = _context["catch"](71);
363
377
  onErrorProducedError = true;
364
- case 87:
378
+ case 88:
365
379
  if (onErrorProducedError && is5xxEvent) {
366
380
  // Log error from fallback data source `onError` to UFO
367
381
  _this.optionsShownUfoExperienceInstance.failure(ufoEndStateConfig(_this.props.fieldId));
@@ -378,11 +392,11 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
378
392
  elapsedTimeMilli: _elapsedTimeMilli,
379
393
  productAttributes: productAttributes
380
394
  });
381
- case 92:
395
+ case 93:
382
396
  case "end":
383
397
  return _context.stop();
384
398
  }
385
- }, _callee, null, [[6, 63], [70, 84]]);
399
+ }, _callee, null, [[6, 64], [71, 85]]);
386
400
  })), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
387
401
  _defineProperty(_this, "onInputChange", function (newQuery, sessionId) {
388
402
  var query = newQuery || '';
@@ -554,7 +568,6 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
554
568
  allowEmail = _this$props2.allowEmail,
555
569
  enableEmailSearch = _this$props2.enableEmailSearch,
556
570
  allowEmailSelectionWhenEmailMatched = _this$props2.allowEmailSelectionWhenEmailMatched,
557
- fetchOptions = _this$props2.fetchOptions,
558
571
  restProps = _objectWithoutProperties(_this$props2, _excluded);
559
572
 
560
573
  // Determine whether to allow email selection based on allowEmailSelectionWhenEmailMatched, if needed
@@ -592,6 +605,7 @@ _defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
592
605
  debounceTime: DEFAULT_DEBOUNCE_TIME_MS,
593
606
  userResolvers: [],
594
607
  enableEmailSearch: false,
595
- allowEmailSelectionWhenEmailMatched: true
608
+ allowEmailSelectionWhenEmailMatched: true,
609
+ verifiedTeams: false
596
610
  });
597
611
  export var SmartUserPicker = withAnalyticsEvents()(injectIntl(SmartUserPickerWithoutAnalytics));
@@ -21,6 +21,7 @@ export declare class SmartUserPickerWithoutAnalytics extends React.Component<Pro
21
21
  userResolvers: never[];
22
22
  enableEmailSearch: boolean;
23
23
  allowEmailSelectionWhenEmailMatched: boolean;
24
+ verifiedTeams: boolean;
24
25
  };
25
26
  constructor(props: Props & WrappedComponentProps);
26
27
  componentDidMount(): Promise<void>;
@@ -23,6 +23,7 @@ export interface RecommendationRequest {
23
23
  includeTeams?: boolean;
24
24
  includeNonLicensedUsers?: boolean;
25
25
  searchEmail?: boolean;
26
+ verifiedTeams?: boolean;
26
27
  }
27
28
  type OnError = (error: any, request: RecommendationRequest) => Promise<OptionData[]> | void;
28
29
  type OnValueError = (error: any, defaultValue: DefaultValue) => Promise<OptionData[]> | void;
@@ -126,6 +127,10 @@ export interface SmartProps {
126
127
  * Whether to include teams in the resultset. @default false
127
128
  */
128
129
  includeTeams?: boolean;
130
+ /**
131
+ * When set to true, only returns verified teams. Only applies when includeTeams is true. @default false
132
+ */
133
+ verifiedTeams?: boolean;
129
134
  /**
130
135
  * Whether to include users in the resultset. @default true
131
136
  */
@@ -21,6 +21,7 @@ export declare class SmartUserPickerWithoutAnalytics extends React.Component<Pro
21
21
  userResolvers: never[];
22
22
  enableEmailSearch: boolean;
23
23
  allowEmailSelectionWhenEmailMatched: boolean;
24
+ verifiedTeams: boolean;
24
25
  };
25
26
  constructor(props: Props & WrappedComponentProps);
26
27
  componentDidMount(): Promise<void>;
@@ -23,6 +23,7 @@ export interface RecommendationRequest {
23
23
  includeTeams?: boolean;
24
24
  includeNonLicensedUsers?: boolean;
25
25
  searchEmail?: boolean;
26
+ verifiedTeams?: boolean;
26
27
  }
27
28
  type OnError = (error: any, request: RecommendationRequest) => Promise<OptionData[]> | void;
28
29
  type OnValueError = (error: any, defaultValue: DefaultValue) => Promise<OptionData[]> | void;
@@ -126,6 +127,10 @@ export interface SmartProps {
126
127
  * Whether to include teams in the resultset. @default false
127
128
  */
128
129
  includeTeams?: boolean;
130
+ /**
131
+ * When set to true, only returns verified teams. Only applies when includeTeams is true. @default false
132
+ */
133
+ verifiedTeams?: boolean;
129
134
  /**
130
135
  * Whether to include users in the resultset. @default true
131
136
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-user-picker",
3
- "version": "8.6.0",
3
+ "version": "8.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -66,6 +66,9 @@
66
66
  },
67
67
  "smart-user-picker-load-options-gate": {
68
68
  "type": "boolean"
69
+ },
70
+ "smart-user-picker-managed-teams-gate": {
71
+ "type": "boolean"
69
72
  }
70
73
  }
71
74
  }