@atlaskit/smart-user-picker 8.8.0 → 8.9.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,12 @@
1
1
  # @atlassian/smart-user-picker
2
2
 
3
+ ## 8.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1d3de95b5af00`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1d3de95b5af00) -
8
+ Refactor verifiedTeams filter
9
+
3
10
  ## 8.8.0
4
11
 
5
12
  ### Minor Changes
@@ -149,7 +149,8 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
149
149
  maxNumberOfResults: maxNumberOfResults,
150
150
  query: query,
151
151
  searchEmail: isEmail,
152
- verifiedTeams: verifiedTeams,
152
+ // Only request verified teams when both the prop is true and the feature flag is enabled
153
+ verifiedTeams: verifiedTeams && (0, _platformFeatureFlags.fg)('smart-user-picker-managed-teams-gate'),
153
154
  /*
154
155
  For email-based searches, we have decided to filter out apps.
155
156
  Also - because the other 2 filters ((NOT not_mentionable:true) AND (account_status:active)) are included
@@ -255,19 +256,6 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
255
256
  }
256
257
  }
257
258
 
258
- // Filter to only verified teams when verifiedTeams is true and feature flag is enabled
259
- if (verifiedTeams && includeTeams && (0, _platformFeatureFlags.fg)('smart-user-picker-managed-teams-gate')) {
260
- recommendedUsers = recommendedUsers.filter(function (option) {
261
- if ((0, _userPicker.isTeam)(option)) {
262
- // Only include teams that are verified
263
- // The verified property is set by the transformer from the server response
264
- var team = option;
265
- return team.verified === true;
266
- }
267
- return true; // Keep non-team options
268
- });
269
- }
270
-
271
259
  // Track if email search found matches for conditional allowEmail logic
272
260
  if (isEmail) {
273
261
  _this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
@@ -276,50 +264,50 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
276
264
  }
277
265
  elapsedTimeMilli = window.performance.now() - startTime;
278
266
  if (!transformOptions) {
279
- _context.next = 42;
267
+ _context.next = 41;
280
268
  break;
281
269
  }
282
- _context.next = 39;
270
+ _context.next = 38;
283
271
  return transformOptions(recommendedUsers, _query);
284
- case 39:
272
+ case 38:
285
273
  _context.t0 = _context.sent;
286
- _context.next = 43;
274
+ _context.next = 42;
287
275
  break;
288
- case 42:
276
+ case 41:
289
277
  _context.t0 = recommendedUsers;
290
- case 43:
278
+ case 42:
291
279
  transformedOptions = _context.t0;
292
280
  if (!(transformedOptions.length === 0 && onEmpty)) {
293
- _context.next = 59;
281
+ _context.next = 58;
294
282
  break;
295
283
  }
296
- _context.next = 47;
284
+ _context.next = 46;
297
285
  return onEmpty(_query);
298
- case 47:
286
+ case 46:
299
287
  _context.t3 = _yield$onEmpty = _context.sent;
300
288
  _context.t2 = _context.t3 !== null;
301
289
  if (!_context.t2) {
302
- _context.next = 51;
290
+ _context.next = 50;
303
291
  break;
304
292
  }
305
293
  _context.t2 = _yield$onEmpty !== void 0;
306
- case 51:
294
+ case 50:
307
295
  if (!_context.t2) {
308
- _context.next = 55;
296
+ _context.next = 54;
309
297
  break;
310
298
  }
311
299
  _context.t4 = _yield$onEmpty;
312
- _context.next = 56;
300
+ _context.next = 55;
313
301
  break;
314
- case 55:
302
+ case 54:
315
303
  _context.t4 = [];
316
- case 56:
304
+ case 55:
317
305
  _context.t1 = _context.t4;
318
- _context.next = 60;
306
+ _context.next = 59;
319
307
  break;
320
- case 59:
308
+ case 58:
321
309
  _context.t1 = transformedOptions;
322
- case 60:
310
+ case 59:
323
311
  displayedUsers = _context.t1;
324
312
  _this.setState(function (state) {
325
313
  var applicable = state.query === _query;
@@ -341,10 +329,10 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
341
329
  loading: loading
342
330
  };
343
331
  });
344
- _context.next = 93;
332
+ _context.next = 92;
345
333
  break;
346
- case 64:
347
- _context.prev = 64;
334
+ case 63:
335
+ _context.prev = 63;
348
336
  _context.t5 = _context["catch"](6);
349
337
  is5xxEvent = checkIf500Event(_context.t5.statusCode);
350
338
  if (!closed && !onError && is5xxEvent) {
@@ -357,35 +345,35 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
357
345
  });
358
346
  onErrorProducedError = false;
359
347
  defaultUsers = [];
360
- _context.prev = 71;
348
+ _context.prev = 70;
361
349
  if (!onError) {
362
- _context.next = 81;
350
+ _context.next = 80;
363
351
  break;
364
352
  }
365
- _context.next = 75;
353
+ _context.next = 74;
366
354
  return onError(_context.t5, recommendationsRequest);
367
- case 75:
355
+ case 74:
368
356
  _context.t7 = _context.sent;
369
357
  if (_context.t7) {
370
- _context.next = 78;
358
+ _context.next = 77;
371
359
  break;
372
360
  }
373
361
  _context.t7 = [];
374
- case 78:
362
+ case 77:
375
363
  _context.t6 = _context.t7;
376
- _context.next = 82;
364
+ _context.next = 81;
377
365
  break;
378
- case 81:
366
+ case 80:
379
367
  _context.t6 = [];
380
- case 82:
368
+ case 81:
381
369
  defaultUsers = _context.t6;
382
- _context.next = 88;
370
+ _context.next = 87;
383
371
  break;
384
- case 85:
385
- _context.prev = 85;
386
- _context.t8 = _context["catch"](71);
372
+ case 84:
373
+ _context.prev = 84;
374
+ _context.t8 = _context["catch"](70);
387
375
  onErrorProducedError = true;
388
- case 88:
376
+ case 87:
389
377
  if (onErrorProducedError && is5xxEvent) {
390
378
  // Log error from fallback data source `onError` to UFO
391
379
  _this.optionsShownUfoExperienceInstance.failure(ufoEndStateConfig(_this.props.fieldId));
@@ -402,11 +390,11 @@ var SmartUserPickerWithoutAnalytics = exports.SmartUserPickerWithoutAnalytics =
402
390
  elapsedTimeMilli: _elapsedTimeMilli,
403
391
  productAttributes: productAttributes
404
392
  });
405
- case 93:
393
+ case 92:
406
394
  case "end":
407
395
  return _context.stop();
408
396
  }
409
- }, _callee, null, [[6, 64], [71, 85]]);
397
+ }, _callee, null, [[6, 63], [70, 84]]);
410
398
  })), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
411
399
  (0, _defineProperty2.default)(_this, "onInputChange", function (newQuery, sessionId) {
412
400
  var query = newQuery || '';
@@ -27,6 +27,7 @@ var getUserRecommendations = function getUserRecommendations(request, intl) {
27
27
  includeNonLicensedUsers: request.includeNonLicensedUsers,
28
28
  maxNumberOfResults: request.maxNumberOfResults,
29
29
  performSearchQueryOnly: false,
30
+ isVerifiedTeamFilter: request.verifiedTeams,
30
31
  searchQuery: _objectSpread(_objectSpread({
31
32
  cpusQueryHighlights: {
32
33
  query: '',
@@ -142,7 +142,8 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
142
142
  maxNumberOfResults,
143
143
  query,
144
144
  searchEmail: isEmail,
145
- verifiedTeams,
145
+ // Only request verified teams when both the prop is true and the feature flag is enabled
146
+ verifiedTeams: verifiedTeams && fg('smart-user-picker-managed-teams-gate'),
146
147
  /*
147
148
  For email-based searches, we have decided to filter out apps.
148
149
  Also - because the other 2 filters ((NOT not_mentionable:true) AND (account_status:active)) are included
@@ -204,19 +205,6 @@ export class SmartUserPickerWithoutAnalytics extends React.Component {
204
205
  }
205
206
  }
206
207
 
207
- // Filter to only verified teams when verifiedTeams is true and feature flag is enabled
208
- if (verifiedTeams && includeTeams && fg('smart-user-picker-managed-teams-gate')) {
209
- recommendedUsers = recommendedUsers.filter(option => {
210
- if (isTeam(option)) {
211
- // Only include teams that are verified
212
- // The verified property is set by the transformer from the server response
213
- const team = option;
214
- return team.verified === true;
215
- }
216
- return true; // Keep non-team options
217
- });
218
- }
219
-
220
208
  // Track if email search found matches for conditional allowEmail logic
221
209
  if (isEmail) {
222
210
  this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
@@ -17,6 +17,7 @@ const getUserRecommendations = (request, intl) => {
17
17
  includeNonLicensedUsers: request.includeNonLicensedUsers,
18
18
  maxNumberOfResults: request.maxNumberOfResults,
19
19
  performSearchQueryOnly: false,
20
+ isVerifiedTeamFilter: request.verifiedTeams,
20
21
  searchQuery: {
21
22
  cpusQueryHighlights: {
22
23
  query: '',
@@ -141,7 +141,8 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
141
141
  maxNumberOfResults: maxNumberOfResults,
142
142
  query: query,
143
143
  searchEmail: isEmail,
144
- verifiedTeams: verifiedTeams,
144
+ // Only request verified teams when both the prop is true and the feature flag is enabled
145
+ verifiedTeams: verifiedTeams && fg('smart-user-picker-managed-teams-gate'),
145
146
  /*
146
147
  For email-based searches, we have decided to filter out apps.
147
148
  Also - because the other 2 filters ((NOT not_mentionable:true) AND (account_status:active)) are included
@@ -247,19 +248,6 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
247
248
  }
248
249
  }
249
250
 
250
- // Filter to only verified teams when verifiedTeams is true and feature flag is enabled
251
- if (verifiedTeams && includeTeams && fg('smart-user-picker-managed-teams-gate')) {
252
- recommendedUsers = recommendedUsers.filter(function (option) {
253
- if (isTeam(option)) {
254
- // Only include teams that are verified
255
- // The verified property is set by the transformer from the server response
256
- var team = option;
257
- return team.verified === true;
258
- }
259
- return true; // Keep non-team options
260
- });
261
- }
262
-
263
251
  // Track if email search found matches for conditional allowEmail logic
264
252
  if (isEmail) {
265
253
  _this.lastEmailSearchFoundMatches = recommendedUsers.length > 0;
@@ -268,50 +256,50 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
268
256
  }
269
257
  elapsedTimeMilli = window.performance.now() - startTime;
270
258
  if (!transformOptions) {
271
- _context.next = 42;
259
+ _context.next = 41;
272
260
  break;
273
261
  }
274
- _context.next = 39;
262
+ _context.next = 38;
275
263
  return transformOptions(recommendedUsers, _query);
276
- case 39:
264
+ case 38:
277
265
  _context.t0 = _context.sent;
278
- _context.next = 43;
266
+ _context.next = 42;
279
267
  break;
280
- case 42:
268
+ case 41:
281
269
  _context.t0 = recommendedUsers;
282
- case 43:
270
+ case 42:
283
271
  transformedOptions = _context.t0;
284
272
  if (!(transformedOptions.length === 0 && onEmpty)) {
285
- _context.next = 59;
273
+ _context.next = 58;
286
274
  break;
287
275
  }
288
- _context.next = 47;
276
+ _context.next = 46;
289
277
  return onEmpty(_query);
290
- case 47:
278
+ case 46:
291
279
  _context.t3 = _yield$onEmpty = _context.sent;
292
280
  _context.t2 = _context.t3 !== null;
293
281
  if (!_context.t2) {
294
- _context.next = 51;
282
+ _context.next = 50;
295
283
  break;
296
284
  }
297
285
  _context.t2 = _yield$onEmpty !== void 0;
298
- case 51:
286
+ case 50:
299
287
  if (!_context.t2) {
300
- _context.next = 55;
288
+ _context.next = 54;
301
289
  break;
302
290
  }
303
291
  _context.t4 = _yield$onEmpty;
304
- _context.next = 56;
292
+ _context.next = 55;
305
293
  break;
306
- case 55:
294
+ case 54:
307
295
  _context.t4 = [];
308
- case 56:
296
+ case 55:
309
297
  _context.t1 = _context.t4;
310
- _context.next = 60;
298
+ _context.next = 59;
311
299
  break;
312
- case 59:
300
+ case 58:
313
301
  _context.t1 = transformedOptions;
314
- case 60:
302
+ case 59:
315
303
  displayedUsers = _context.t1;
316
304
  _this.setState(function (state) {
317
305
  var applicable = state.query === _query;
@@ -333,10 +321,10 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
333
321
  loading: loading
334
322
  };
335
323
  });
336
- _context.next = 93;
324
+ _context.next = 92;
337
325
  break;
338
- case 64:
339
- _context.prev = 64;
326
+ case 63:
327
+ _context.prev = 63;
340
328
  _context.t5 = _context["catch"](6);
341
329
  is5xxEvent = checkIf500Event(_context.t5.statusCode);
342
330
  if (!closed && !onError && is5xxEvent) {
@@ -349,35 +337,35 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
349
337
  });
350
338
  onErrorProducedError = false;
351
339
  defaultUsers = [];
352
- _context.prev = 71;
340
+ _context.prev = 70;
353
341
  if (!onError) {
354
- _context.next = 81;
342
+ _context.next = 80;
355
343
  break;
356
344
  }
357
- _context.next = 75;
345
+ _context.next = 74;
358
346
  return onError(_context.t5, recommendationsRequest);
359
- case 75:
347
+ case 74:
360
348
  _context.t7 = _context.sent;
361
349
  if (_context.t7) {
362
- _context.next = 78;
350
+ _context.next = 77;
363
351
  break;
364
352
  }
365
353
  _context.t7 = [];
366
- case 78:
354
+ case 77:
367
355
  _context.t6 = _context.t7;
368
- _context.next = 82;
356
+ _context.next = 81;
369
357
  break;
370
- case 81:
358
+ case 80:
371
359
  _context.t6 = [];
372
- case 82:
360
+ case 81:
373
361
  defaultUsers = _context.t6;
374
- _context.next = 88;
362
+ _context.next = 87;
375
363
  break;
376
- case 85:
377
- _context.prev = 85;
378
- _context.t8 = _context["catch"](71);
364
+ case 84:
365
+ _context.prev = 84;
366
+ _context.t8 = _context["catch"](70);
379
367
  onErrorProducedError = true;
380
- case 88:
368
+ case 87:
381
369
  if (onErrorProducedError && is5xxEvent) {
382
370
  // Log error from fallback data source `onError` to UFO
383
371
  _this.optionsShownUfoExperienceInstance.failure(ufoEndStateConfig(_this.props.fieldId));
@@ -394,11 +382,11 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
394
382
  elapsedTimeMilli: _elapsedTimeMilli,
395
383
  productAttributes: productAttributes
396
384
  });
397
- case 93:
385
+ case 92:
398
386
  case "end":
399
387
  return _context.stop();
400
388
  }
401
- }, _callee, null, [[6, 64], [71, 85]]);
389
+ }, _callee, null, [[6, 63], [70, 84]]);
402
390
  })), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
403
391
  _defineProperty(_this, "onInputChange", function (newQuery, sessionId) {
404
392
  var query = newQuery || '';
@@ -20,6 +20,7 @@ var getUserRecommendations = function getUserRecommendations(request, intl) {
20
20
  includeNonLicensedUsers: request.includeNonLicensedUsers,
21
21
  maxNumberOfResults: request.maxNumberOfResults,
22
22
  performSearchQueryOnly: false,
23
+ isVerifiedTeamFilter: request.verifiedTeams,
23
24
  searchQuery: _objectSpread(_objectSpread({
24
25
  cpusQueryHighlights: {
25
26
  query: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-user-picker",
3
- "version": "8.8.0",
3
+ "version": "8.9.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.18.0",
41
+ "@atlaskit/user-picker": "^11.19.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "lodash": "^4.17.21",
44
44
  "memoize-one": "^6.0.0",
@@ -51,9 +51,9 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@atlaskit/select": "^21.6.0",
54
- "@atlaskit/util-data-test": "^18.3.0",
54
+ "@atlaskit/util-data-test": "^18.4.0",
55
55
  "@testing-library/dom": "^10.1.0",
56
- "@testing-library/react": "^13.4.0",
56
+ "@testing-library/react": "^16.3.0",
57
57
  "@testing-library/user-event": "^14.4.3",
58
58
  "enzyme": "^3.10.0",
59
59
  "fetch-mock": "^8.0.0",