@atlaskit/smart-user-picker 6.0.3 → 6.0.5

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.
Files changed (129) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics.js +12 -37
  3. package/dist/cjs/components/MessagesIntlProvider.js +4 -22
  4. package/dist/cjs/components/SmartUserPicker.js +22 -123
  5. package/dist/cjs/components/index.js +0 -7
  6. package/dist/cjs/i18n/cs.js +0 -1
  7. package/dist/cjs/i18n/da.js +0 -1
  8. package/dist/cjs/i18n/de.js +0 -1
  9. package/dist/cjs/i18n/en_ZZ.js +0 -1
  10. package/dist/cjs/i18n/es.js +0 -1
  11. package/dist/cjs/i18n/et.js +0 -1
  12. package/dist/cjs/i18n/fi.js +0 -1
  13. package/dist/cjs/i18n/fr.js +0 -1
  14. package/dist/cjs/i18n/hu.js +0 -1
  15. package/dist/cjs/i18n/index.js +0 -31
  16. package/dist/cjs/i18n/it.js +0 -1
  17. package/dist/cjs/i18n/ja.js +0 -1
  18. package/dist/cjs/i18n/ko.js +0 -1
  19. package/dist/cjs/i18n/nb.js +0 -1
  20. package/dist/cjs/i18n/nl.js +0 -1
  21. package/dist/cjs/i18n/pl.js +0 -1
  22. package/dist/cjs/i18n/pt_BR.js +0 -1
  23. package/dist/cjs/i18n/pt_PT.js +0 -1
  24. package/dist/cjs/i18n/ru.js +0 -1
  25. package/dist/cjs/i18n/sk.js +0 -1
  26. package/dist/cjs/i18n/sv.js +0 -1
  27. package/dist/cjs/i18n/th.js +0 -1
  28. package/dist/cjs/i18n/tr.js +0 -1
  29. package/dist/cjs/i18n/uk.js +0 -1
  30. package/dist/cjs/i18n/vi.js +0 -1
  31. package/dist/cjs/i18n/zh.js +0 -1
  32. package/dist/cjs/i18n/zh_TW.js +0 -1
  33. package/dist/cjs/i18n.js +0 -2
  34. package/dist/cjs/index.js +0 -4
  35. package/dist/cjs/service/default-value-hydration-client.js +0 -49
  36. package/dist/cjs/service/graphqlUtils.js +0 -5
  37. package/dist/cjs/service/index.js +0 -3
  38. package/dist/cjs/service/recommendation-client.js +0 -11
  39. package/dist/cjs/service/teams-client.js +0 -10
  40. package/dist/cjs/service/users-client.js +2 -20
  41. package/dist/cjs/service/users-transformer.js +0 -17
  42. package/dist/cjs/types.js +0 -1
  43. package/dist/cjs/ufoExperiences.js +8 -26
  44. package/dist/cjs/util/i18n-util.js +0 -43
  45. package/dist/cjs/version.json +1 -1
  46. package/dist/es2019/analytics.js +12 -10
  47. package/dist/es2019/components/MessagesIntlProvider.js +2 -4
  48. package/dist/es2019/components/SmartUserPicker.js +23 -55
  49. package/dist/es2019/components/index.js +0 -2
  50. package/dist/es2019/config/index.js +0 -4
  51. package/dist/es2019/index.js +4 -2
  52. package/dist/es2019/service/default-value-hydration-client.js +4 -22
  53. package/dist/es2019/service/graphqlUtils.js +0 -4
  54. package/dist/es2019/service/recommendation-client.js +0 -4
  55. package/dist/es2019/service/teams-client.js +2 -5
  56. package/dist/es2019/service/users-client.js +2 -6
  57. package/dist/es2019/service/users-transformer.js +0 -11
  58. package/dist/es2019/types.js +0 -1
  59. package/dist/es2019/ufoExperiences.js +8 -7
  60. package/dist/es2019/util/i18n-util.js +30 -120
  61. package/dist/es2019/version.json +1 -1
  62. package/dist/esm/analytics.js +12 -19
  63. package/dist/esm/components/MessagesIntlProvider.js +4 -11
  64. package/dist/esm/components/SmartUserPicker.js +24 -115
  65. package/dist/esm/components/index.js +0 -2
  66. package/dist/esm/index.js +4 -2
  67. package/dist/esm/service/default-value-hydration-client.js +0 -40
  68. package/dist/esm/service/graphqlUtils.js +0 -4
  69. package/dist/esm/service/recommendation-client.js +0 -7
  70. package/dist/esm/service/teams-client.js +0 -7
  71. package/dist/esm/service/users-client.js +2 -13
  72. package/dist/esm/service/users-transformer.js +0 -13
  73. package/dist/esm/types.js +0 -1
  74. package/dist/esm/ufoExperiences.js +8 -13
  75. package/dist/esm/util/i18n-util.js +30 -126
  76. package/dist/esm/version.json +1 -1
  77. package/package.json +7 -14
  78. package/report.api.md +26 -5
  79. package/tmp/api-report-tmp.d.ts +268 -0
  80. package/dist/types-ts4.0/analytics.d.ts +0 -21
  81. package/dist/types-ts4.0/components/MessagesIntlProvider.d.ts +0 -9
  82. package/dist/types-ts4.0/components/SmartUserPicker.d.ts +0 -34
  83. package/dist/types-ts4.0/components/index.d.ts +0 -4
  84. package/dist/types-ts4.0/config/index.d.ts +0 -6
  85. package/dist/types-ts4.0/i18n/cs.d.ts +0 -18
  86. package/dist/types-ts4.0/i18n/da.d.ts +0 -18
  87. package/dist/types-ts4.0/i18n/de.d.ts +0 -18
  88. package/dist/types-ts4.0/i18n/en.d.ts +0 -7
  89. package/dist/types-ts4.0/i18n/en_GB.d.ts +0 -7
  90. package/dist/types-ts4.0/i18n/en_ZZ.d.ts +0 -18
  91. package/dist/types-ts4.0/i18n/es.d.ts +0 -18
  92. package/dist/types-ts4.0/i18n/et.d.ts +0 -8
  93. package/dist/types-ts4.0/i18n/fi.d.ts +0 -18
  94. package/dist/types-ts4.0/i18n/fr.d.ts +0 -18
  95. package/dist/types-ts4.0/i18n/hu.d.ts +0 -18
  96. package/dist/types-ts4.0/i18n/index.d.ts +0 -36
  97. package/dist/types-ts4.0/i18n/is.d.ts +0 -7
  98. package/dist/types-ts4.0/i18n/it.d.ts +0 -18
  99. package/dist/types-ts4.0/i18n/ja.d.ts +0 -18
  100. package/dist/types-ts4.0/i18n/ko.d.ts +0 -18
  101. package/dist/types-ts4.0/i18n/languages.d.ts +0 -27
  102. package/dist/types-ts4.0/i18n/nb.d.ts +0 -18
  103. package/dist/types-ts4.0/i18n/nl.d.ts +0 -18
  104. package/dist/types-ts4.0/i18n/pl.d.ts +0 -18
  105. package/dist/types-ts4.0/i18n/pt_BR.d.ts +0 -18
  106. package/dist/types-ts4.0/i18n/pt_PT.d.ts +0 -8
  107. package/dist/types-ts4.0/i18n/ro.d.ts +0 -7
  108. package/dist/types-ts4.0/i18n/ru.d.ts +0 -18
  109. package/dist/types-ts4.0/i18n/sk.d.ts +0 -8
  110. package/dist/types-ts4.0/i18n/sv.d.ts +0 -18
  111. package/dist/types-ts4.0/i18n/th.d.ts +0 -18
  112. package/dist/types-ts4.0/i18n/tr.d.ts +0 -18
  113. package/dist/types-ts4.0/i18n/uk.d.ts +0 -18
  114. package/dist/types-ts4.0/i18n/vi.d.ts +0 -18
  115. package/dist/types-ts4.0/i18n/zh.d.ts +0 -18
  116. package/dist/types-ts4.0/i18n/zh_TW.d.ts +0 -18
  117. package/dist/types-ts4.0/i18n.d.ts +0 -47
  118. package/dist/types-ts4.0/index.d.ts +0 -5
  119. package/dist/types-ts4.0/service/constants.d.ts +0 -4
  120. package/dist/types-ts4.0/service/default-value-hydration-client.d.ts +0 -8
  121. package/dist/types-ts4.0/service/graphqlUtils.d.ts +0 -14
  122. package/dist/types-ts4.0/service/index.d.ts +0 -2
  123. package/dist/types-ts4.0/service/recommendation-client.d.ts +0 -5
  124. package/dist/types-ts4.0/service/teams-client.d.ts +0 -12
  125. package/dist/types-ts4.0/service/users-client.d.ts +0 -11
  126. package/dist/types-ts4.0/service/users-transformer.d.ts +0 -22
  127. package/dist/types-ts4.0/types.d.ts +0 -207
  128. package/dist/types-ts4.0/ufoExperiences.d.ts +0 -11
  129. package/dist/types-ts4.0/util/i18n-util.d.ts +0 -11
@@ -7,17 +7,11 @@ import _inherits from "@babel/runtime/helpers/inherits";
7
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
-
11
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
-
13
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
-
15
12
  import _regeneratorRuntime from "@babel/runtime/regenerator";
16
-
17
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
18
-
19
14
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
-
21
15
  import React from 'react';
22
16
  import debounce from 'lodash/debounce';
23
17
  import { v4 as uuidV4 } from 'uuid';
@@ -31,48 +25,43 @@ import MessagesIntlProvider from './MessagesIntlProvider';
31
25
  import { getUserRecommendations, hydrateDefaultValues } from '../service';
32
26
  import { smartUserPickerOptionsShownUfoExperience } from '../ufoExperiences';
33
27
  var DEFAULT_DEBOUNCE_TIME_MS = 150;
34
-
28
+ var ufoEndStateConfig = function ufoEndStateConfig(fieldId) {
29
+ return {
30
+ metadata: {
31
+ contextType: fieldId
32
+ }
33
+ };
34
+ };
35
35
  var hasContextChanged = function hasContextChanged(oldContext, newContext) {
36
36
  return oldContext.siteId !== newContext.siteId || oldContext.orgId !== newContext.orgId || oldContext.productKey !== newContext.productKey || oldContext.principalId !== newContext.principalId || oldContext.containerId !== newContext.containerId || oldContext.objectId !== newContext.objectId || oldContext.childObjectId !== newContext.childObjectId;
37
37
  };
38
-
39
38
  var stringContains = function stringContains(str, substr) {
40
39
  if (str === null || str === undefined) {
41
40
  return false;
42
41
  }
43
-
44
42
  if (substr === null || substr === '' || substr === undefined) {
45
43
  return true;
46
44
  }
47
-
48
45
  return str.toLowerCase().includes(substr.toLowerCase());
49
46
  };
50
-
51
47
  var getUsersForAnalytics = function getUsersForAnalytics(users) {
52
48
  return (users || []).map(function (_ref) {
53
49
  var id = _ref.id,
54
- type = _ref.type;
50
+ type = _ref.type;
55
51
  return {
56
52
  id: id,
57
53
  type: type
58
54
  };
59
55
  });
60
56
  };
61
-
62
57
  export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
63
58
  _inherits(SmartUserPickerWithoutAnalytics, _React$Component);
64
-
65
59
  var _super = _createSuper(SmartUserPickerWithoutAnalytics);
66
-
67
60
  function SmartUserPickerWithoutAnalytics(props) {
68
61
  var _this$props$debounceT;
69
-
70
62
  var _this;
71
-
72
63
  _classCallCheck(this, SmartUserPickerWithoutAnalytics);
73
-
74
64
  _this = _super.call(this, props);
75
-
76
65
  _defineProperty(_assertThisInitialized(_this), "state", {
77
66
  users: [],
78
67
  loading: false,
@@ -81,7 +70,6 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
81
70
  defaultValue: [],
82
71
  bootstrapOptions: []
83
72
  });
84
-
85
73
  _defineProperty(_assertThisInitialized(_this), "abortOptionsShownUfoExperience", function () {
86
74
  if (_this.optionsShownUfoExperienceInstance.state.id === UFOExperienceState.STARTED.id) {
87
75
  // There may be an existing UFO timing running from previous key entry or focus,
@@ -89,34 +77,25 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
89
77
  _this.optionsShownUfoExperienceInstance.abort();
90
78
  }
91
79
  });
92
-
93
80
  _defineProperty(_assertThisInitialized(_this), "startOptionsShownUfoExperience", function () {
94
81
  _this.abortOptionsShownUfoExperience();
95
-
96
82
  _this.optionsShownUfoExperienceInstance.start();
97
83
  });
98
-
99
84
  _defineProperty(_assertThisInitialized(_this), "fireEvent", function (eventCreator) {
100
85
  var createAnalyticsEvent = _this.props.createAnalyticsEvent;
101
-
102
86
  if (createAnalyticsEvent) {
103
87
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
104
88
  args[_key - 1] = arguments[_key];
105
89
  }
106
-
107
90
  createAndFireEventInElementsChannel(eventCreator.apply(void 0, [_this.props, _this.state].concat(args)))(createAnalyticsEvent);
108
91
  }
109
92
  });
110
-
111
93
  _defineProperty(_assertThisInitialized(_this), "filterOptions", function (users, query, propFilterOptions) {
112
94
  return propFilterOptions ? propFilterOptions(users, query) : users;
113
95
  });
114
-
115
96
  _defineProperty(_assertThisInitialized(_this), "memoizedFilterOptions", memoizeOne(_this.filterOptions));
116
-
117
97
  _defineProperty(_assertThisInitialized(_this), "getUsers", debounce( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
118
98
  var _this$state, query, sessionId, closed, _this$props, baseUrl, childObjectId, containerId, fieldId, includeGroups, includeTeams, includeUsers, intl, maxOptions, objectId, onEmpty, onError, orgId, principalId, productAttributes, productKey, searchQueryFilter, siteId, maxNumberOfResults, startTime, recommendationsRequest, _yield$onEmpty, recommendedUsers, elapsedTimeMilli, displayedUsers, onErrorProducedError, defaultUsers, _elapsedTimeMilli;
119
-
120
99
  return _regeneratorRuntime.wrap(function _callee$(_context) {
121
100
  while (1) {
122
101
  switch (_context.prev = _context.next) {
@@ -147,64 +126,48 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
147
126
  searchQueryFilter: searchQueryFilter
148
127
  };
149
128
  _context.prev = 5;
150
-
151
129
  _this.fireEvent(requestUsersEvent);
152
-
153
130
  _context.next = 9;
154
131
  return getUserRecommendations(recommendationsRequest, intl);
155
-
156
132
  case 9:
157
133
  recommendedUsers = _context.sent;
158
134
  elapsedTimeMilli = window.performance.now() - startTime;
159
-
160
135
  if (!(recommendedUsers.length === 0 && onEmpty)) {
161
136
  _context.next = 26;
162
137
  break;
163
138
  }
164
-
165
139
  _context.next = 14;
166
140
  return onEmpty(query);
167
-
168
141
  case 14:
169
142
  _context.t2 = _yield$onEmpty = _context.sent;
170
143
  _context.t1 = _context.t2 !== null;
171
-
172
144
  if (!_context.t1) {
173
145
  _context.next = 18;
174
146
  break;
175
147
  }
176
-
177
148
  _context.t1 = _yield$onEmpty !== void 0;
178
-
179
149
  case 18:
180
150
  if (!_context.t1) {
181
151
  _context.next = 22;
182
152
  break;
183
153
  }
184
-
185
154
  _context.t3 = _yield$onEmpty;
186
155
  _context.next = 23;
187
156
  break;
188
-
189
157
  case 22:
190
158
  _context.t3 = [];
191
-
192
159
  case 23:
193
160
  _context.t0 = _context.t3;
194
161
  _context.next = 27;
195
162
  break;
196
-
197
163
  case 26:
198
164
  _context.t0 = recommendedUsers;
199
-
200
165
  case 27:
201
166
  displayedUsers = _context.t0;
202
-
203
167
  _this.setState(function (state) {
204
168
  var applicable = state.query === query;
205
169
  var users = applicable ? displayedUsers : state.users;
206
170
  var loading = !applicable;
207
-
208
171
  _this.fireEvent(successfulRequestUsersEvent, {
209
172
  users: getUsersForAnalytics(recommendedUsers),
210
173
  elapsedTimeMilli: elapsedTimeMilli,
@@ -212,88 +175,68 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
212
175
  productAttributes: productAttributes,
213
176
  applicable: applicable
214
177
  });
215
-
216
178
  return {
217
179
  users: users,
218
180
  loading: loading
219
181
  };
220
182
  });
221
-
222
183
  _context.next = 58;
223
184
  break;
224
-
225
185
  case 31:
226
186
  _context.prev = 31;
227
187
  _context.t4 = _context["catch"](5);
228
-
229
188
  if (!closed && !onError) {
230
189
  // If the user lookup fails while the menu is open, and the consumer is not providing a
231
190
  // fallback data source via the onError prop, then send UFO failure
232
- _this.optionsShownUfoExperienceInstance.failure();
191
+ _this.optionsShownUfoExperienceInstance.failure(ufoEndStateConfig(_this.props.fieldId));
233
192
  }
234
-
235
193
  _this.setState({
236
194
  users: []
237
195
  });
238
-
239
196
  onErrorProducedError = false;
240
197
  defaultUsers = [];
241
198
  _context.prev = 37;
242
-
243
199
  if (!onError) {
244
200
  _context.next = 47;
245
201
  break;
246
202
  }
247
-
248
203
  _context.next = 41;
249
204
  return onError(_context.t4, recommendationsRequest);
250
-
251
205
  case 41:
252
206
  _context.t6 = _context.sent;
253
-
254
207
  if (_context.t6) {
255
208
  _context.next = 44;
256
209
  break;
257
210
  }
258
-
259
211
  _context.t6 = [];
260
-
261
212
  case 44:
262
213
  _context.t5 = _context.t6;
263
214
  _context.next = 48;
264
215
  break;
265
-
266
216
  case 47:
267
217
  _context.t5 = [];
268
-
269
218
  case 48:
270
219
  defaultUsers = _context.t5;
271
220
  _context.next = 54;
272
221
  break;
273
-
274
222
  case 51:
275
223
  _context.prev = 51;
276
224
  _context.t7 = _context["catch"](37);
277
225
  onErrorProducedError = true;
278
-
279
226
  case 54:
280
227
  if (onErrorProducedError) {
281
228
  // Log error from fallback data source `onError` to UFO
282
- _this.optionsShownUfoExperienceInstance.failure();
229
+ _this.optionsShownUfoExperienceInstance.failure(ufoEndStateConfig(_this.props.fieldId));
283
230
  }
284
-
285
231
  _this.setState({
286
232
  users: defaultUsers,
287
233
  loading: false
288
234
  });
289
-
290
235
  _elapsedTimeMilli = window.performance.now() - startTime;
291
-
292
236
  _this.fireEvent(failedRequestUsersEvent, {
293
237
  elapsedTimeMilli: _elapsedTimeMilli,
294
238
  productAttributes: productAttributes
295
239
  });
296
-
297
240
  case 58:
298
241
  case "end":
299
242
  return _context.stop();
@@ -301,80 +244,64 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
301
244
  }
302
245
  }, _callee, null, [[5, 31], [37, 51]]);
303
246
  })), (_this$props$debounceT = _this.props.debounceTime) !== null && _this$props$debounceT !== void 0 ? _this$props$debounceT : 0));
304
-
305
247
  _defineProperty(_assertThisInitialized(_this), "onInputChange", function (newQuery, sessionId) {
306
248
  var query = newQuery || '';
307
249
  var closed = _this.state.closed;
308
-
309
250
  if (query === _this.state.query) {
310
251
  return;
311
252
  }
312
-
313
253
  if (!closed) {
314
254
  // If the input has been typed into and the dropdown has not been closed
315
255
  // (i.e. input blurred) then start the UFO timer.
316
256
  // If there's a previous UFO timer running for the same "options shown" experience,
317
257
  // it will be aborted first.
318
258
  _this.startOptionsShownUfoExperience();
319
-
320
259
  _this.setState({
321
260
  loading: true,
322
261
  query: query,
323
262
  sessionId: sessionId
324
263
  });
325
-
326
264
  if (_this.props.onInputChange) {
327
265
  _this.props.onInputChange(query, sessionId);
328
266
  }
329
267
  }
330
268
  });
331
-
332
269
  _defineProperty(_assertThisInitialized(_this), "filterUsers", function () {
333
270
  var _this$state2 = _this.state,
334
- loading = _this$state2.loading,
335
- users = _this$state2.users,
336
- query = _this$state2.query;
337
-
338
- var filteredUsers = _this.memoizedFilterOptions(users, query, _this.props.filterOptions); //If bootstrapOptions have been passed in and it is bootstrap
339
-
340
-
271
+ loading = _this$state2.loading,
272
+ users = _this$state2.users,
273
+ query = _this$state2.query;
274
+ var filteredUsers = _this.memoizedFilterOptions(users, query, _this.props.filterOptions);
275
+ //If bootstrapOptions have been passed in and it is bootstrap
341
276
  if (_this.props.bootstrapOptions && _this.props.bootstrapOptions.length !== 0 && query === '') {
342
277
  var bootstrapFilteredUsers = _this.memoizedFilterOptions(_this.props.bootstrapOptions, query, _this.props.filterOptions);
343
-
344
278
  _this.fireEvent(filterUsersEvent, {
345
279
  filtered: getUsersForAnalytics(bootstrapFilteredUsers),
346
280
  all: getUsersForAnalytics(_this.props.bootstrapOptions)
347
281
  });
348
-
349
282
  return bootstrapFilteredUsers;
350
- } // while when not loading just return already filtered result from server.
351
-
352
-
283
+ }
284
+ // while when not loading just return already filtered result from server.
353
285
  if (!loading) {
354
286
  return filteredUsers;
355
287
  }
356
-
357
288
  var queryFilteredUsers = filteredUsers.filter(function (user) {
358
289
  return stringContains(user.name, query);
359
290
  });
360
-
361
291
  _this.fireEvent(filterUsersEvent, {
362
292
  filtered: getUsersForAnalytics(queryFilteredUsers),
363
293
  all: getUsersForAnalytics(users)
364
- }); // when loading filter previous result.
365
-
294
+ });
366
295
 
296
+ // when loading filter previous result.
367
297
  return filteredUsers;
368
298
  });
369
-
370
299
  _defineProperty(_assertThisInitialized(_this), "onFocus", function (sessionId) {
371
300
  var state = {
372
301
  query: '',
373
302
  closed: false
374
303
  };
375
-
376
304
  _this.startOptionsShownUfoExperience();
377
-
378
305
  if (_this.state.users.length === 0) {
379
306
  state.sessionId = sessionId;
380
307
  state.loading = true;
@@ -385,40 +312,32 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
385
312
  sessionId: sessionId
386
313
  });
387
314
  }
388
-
389
315
  _this.setState(function (currentState) {
390
316
  return _objectSpread(_objectSpread({}, currentState), state);
391
317
  });
392
-
393
318
  if (_this.props.onFocus) {
394
319
  _this.props.onFocus(sessionId);
395
320
  }
396
321
  });
397
-
398
322
  _defineProperty(_assertThisInitialized(_this), "onBlur", function (sessionId) {
399
323
  _this.getUsers.cancel();
324
+ _this.abortOptionsShownUfoExperience();
400
325
 
401
- _this.abortOptionsShownUfoExperience(); // clear old users if query is populated so that on refocus,
326
+ // clear old users if query is populated so that on refocus,
402
327
  // the old list is not shown
403
-
404
-
405
328
  var users = _this.state.query.length === 0 ? _this.state.users : [];
406
-
407
329
  _this.setState({
408
330
  loading: false,
409
331
  closed: true,
410
332
  users: users
411
333
  });
412
-
413
334
  if (_this.props.onBlur) {
414
335
  _this.props.onBlur(sessionId);
415
336
  }
416
337
  });
417
-
418
338
  _this.optionsShownUfoExperienceInstance = smartUserPickerOptionsShownUfoExperience.getInstance(props.inputId || props.fieldId);
419
339
  return _this;
420
340
  }
421
-
422
341
  _createClass(SmartUserPickerWithoutAnalytics, [{
423
342
  key: "componentDidMount",
424
343
  value: function () {
@@ -431,7 +350,6 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
431
350
  _context2.prev = 0;
432
351
  _context2.next = 3;
433
352
  return hydrateDefaultValues(this.props.baseUrl, this.props.defaultValue, this.props.productKey);
434
-
435
353
  case 3:
436
354
  value = _context2.sent;
437
355
  this.setState({
@@ -439,22 +357,18 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
439
357
  });
440
358
  _context2.next = 13;
441
359
  break;
442
-
443
360
  case 7:
444
361
  _context2.prev = 7;
445
362
  _context2.t0 = _context2["catch"](0);
446
363
  _context2.next = 11;
447
364
  return this.props.onValueError ? this.props.onValueError(_context2.t0, this.props.defaultValue) || Promise.resolve([]) : Promise.resolve([]);
448
-
449
365
  case 11:
450
366
  defaultValue = _context2.sent;
451
367
  this.setState({
452
368
  defaultValue: defaultValue
453
369
  });
454
-
455
370
  case 13:
456
371
  prefetch = this.props.prefetch;
457
-
458
372
  if (prefetch) {
459
373
  sessionId = uuidV4();
460
374
  this.fireEvent(mountedWithPrefetchEvent, {
@@ -464,7 +378,6 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
464
378
  sessionId: sessionId
465
379
  });
466
380
  }
467
-
468
381
  case 15:
469
382
  case "end":
470
383
  return _context2.stop();
@@ -472,11 +385,9 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
472
385
  }
473
386
  }, _callee2, this, [[0, 7]]);
474
387
  }));
475
-
476
388
  function componentDidMount() {
477
389
  return _componentDidMount.apply(this, arguments);
478
390
  }
479
-
480
391
  return componentDidMount;
481
392
  }()
482
393
  }, {
@@ -487,14 +398,13 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
487
398
  users: []
488
399
  });
489
400
  }
490
-
491
401
  if ((this.state.sessionId !== prevState.sessionId || this.state.query !== prevState.query) && (this.state.query !== '' || !this.props.bootstrapOptions)) {
492
402
  this.getUsers();
493
403
  } else if (!this.state.closed && !this.state.loading) {
494
404
  // If the component has rendered (including its dropdown list) and it
495
405
  // is not loading anything further, send the success UFO event
496
406
  if (![UFOExperienceState.FAILED.id, UFOExperienceState.SUCCEEDED.id].includes(this.optionsShownUfoExperienceInstance.state.id)) {
497
- this.optionsShownUfoExperienceInstance.success();
407
+ this.optionsShownUfoExperienceInstance.success(ufoEndStateConfig(this.props.fieldId));
498
408
  }
499
409
  }
500
410
  }
@@ -511,10 +421,10 @@ export var SmartUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compo
511
421
  })));
512
422
  }
513
423
  }]);
514
-
515
424
  return SmartUserPickerWithoutAnalytics;
516
- }(React.Component); // TODO: Smart User picker team will have to add a type annotation here
425
+ }(React.Component);
517
426
 
427
+ // TODO: Smart User picker team will have to add a type annotation here
518
428
  _defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
519
429
  baseUrl: '',
520
430
  includeUsers: true,
@@ -524,5 +434,4 @@ _defineProperty(SmartUserPickerWithoutAnalytics, "defaultProps", {
524
434
  principalId: 'Context',
525
435
  debounceTime: DEFAULT_DEBOUNCE_TIME_MS
526
436
  });
527
-
528
437
  export var SmartUserPicker = withAnalyticsEvents()(injectIntl(SmartUserPickerWithoutAnalytics));
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { SmartUserPicker } from './SmartUserPicker';
3
3
  import MessagesIntlProvider from './MessagesIntlProvider';
4
4
  import { useUFOConcurrentExperience, smartUserPickerRenderedUfoExperience, UfoErrorBoundary } from '../ufoExperiences';
5
-
6
5
  var SmartUserPickerWithIntlProvider = function SmartUserPickerWithIntlProvider(props) {
7
6
  var ufoId = props.inputId || props.fieldId;
8
7
  useUFOConcurrentExperience(smartUserPickerRenderedUfoExperience, ufoId);
@@ -10,5 +9,4 @@ var SmartUserPickerWithIntlProvider = function SmartUserPickerWithIntlProvider(p
10
9
  id: ufoId
11
10
  }, /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(SmartUserPicker, props)));
12
11
  };
13
-
14
12
  export default SmartUserPickerWithIntlProvider;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export { default } from './components';
2
2
  export { getUserRecommendations, hydrateDefaultValues } from './service';
3
- export { //Utils
4
- isEmail, isTeam, isUser, isValidEmail, // Constants
3
+ export {
4
+ //Utils
5
+ isEmail, isTeam, isUser, isValidEmail,
6
+ // Constants
5
7
  EmailType, GroupType, TeamType, UserType } from '@atlaskit/user-picker';