@atlaskit/user-picker 8.7.0 → 8.7.3

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,23 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 8.7.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7f37f923832`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f37f923832) - updated analytics event for org people picker in core invites
8
+
9
+ ## 8.7.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`4d4d565e8ad`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4d4d565e8ad) - Skip sending UFO success if already failed
14
+
15
+ ## 8.7.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [`dace9a85101`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dace9a85101) - Add new attribute to analytics events
20
+
3
21
  ## 8.7.0
4
22
 
5
23
  ### Minor Changes
@@ -59,19 +59,21 @@ var checkValidId = function checkValidId(id) {
59
59
 
60
60
  var optionData2Analytics = function optionData2Analytics(option) {
61
61
  var id = option.id,
62
- type = option.type;
62
+ type = option.type; // id's of email types are emails which is PII
63
+
64
+ var validatedData = {
65
+ id: checkValidId(id) ? id : null,
66
+ type: type || null
67
+ };
63
68
 
64
69
  if ((0, _utils.isExternalUser)(option)) {
65
- return {
70
+ return _objectSpread(_objectSpread({}, validatedData), {}, {
66
71
  type: 'external_user',
67
- sources: option.sources
68
- };
72
+ sources: option.sources,
73
+ externalUserType: option.externalUserType
74
+ });
69
75
  } else {
70
- // id's of email types are emails which is PII
71
- return {
72
- id: checkValidId(id) ? id : null,
73
- type: type || null
74
- };
76
+ return validatedData;
75
77
  }
76
78
  };
77
79
 
@@ -152,12 +154,14 @@ var selectEvent = function selectEvent(props, state, session, journeyId) {
152
154
  exports.selectEvent = selectEvent;
153
155
 
154
156
  var searchedEvent = function searchedEvent(props, state, session, journeyId) {
157
+ var searchResults = results(state);
155
158
  return createEvent('operational', 'searched', 'userPicker', _objectSpread(_objectSpread({}, createDefaultPickerAttributes(props, session, journeyId)), {}, {
156
159
  sessionDuration: sessionDuration(session),
157
160
  durationSinceInputChange: durationSinceInputChange(session),
158
161
  queryLength: queryLength(state),
159
162
  isLoading: isLoading(props, state),
160
- results: results(state)
163
+ results: searchResults,
164
+ numberOfResults: searchResults.length
161
165
  }));
162
166
  };
163
167
 
@@ -27,6 +27,8 @@ var _analyticsNext = require("@atlaskit/analytics-next");
27
27
 
28
28
  var _select = _interopRequireWildcard(require("@atlaskit/select"));
29
29
 
30
+ var _ufo = require("@atlaskit/ufo");
31
+
30
32
  var _react = _interopRequireDefault(require("react"));
31
33
 
32
34
  var _BaseUserPicker = require("./BaseUserPicker");
@@ -80,9 +82,12 @@ var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
80
82
  (0, _createClass2.default)(UserPickerWithoutAnalytics, [{
81
83
  key: "componentDidMount",
82
84
  value: function componentDidMount() {
83
- var experienceForId = _ufoExperiences.userPickerRenderedUfoExperience.getInstance(this.ufoId);
85
+ var experienceForId = _ufoExperiences.userPickerRenderedUfoExperience.getInstance(this.ufoId); // Send UFO success if the experience is still in progress i.e. hasn't failed
86
+
84
87
 
85
- experienceForId.success();
88
+ if ([_ufo.UFOExperienceState.IN_PROGRESS.id, _ufo.UFOExperienceState.STARTED.id].includes(experienceForId.state.id)) {
89
+ experienceForId.success();
90
+ }
86
91
  }
87
92
  }, {
88
93
  key: "render",
package/dist/cjs/index.js CHANGED
@@ -63,6 +63,12 @@ Object.defineProperty(exports, "isEmail", {
63
63
  return _utils.isEmail;
64
64
  }
65
65
  });
66
+ Object.defineProperty(exports, "isExternalUser", {
67
+ enumerable: true,
68
+ get: function get() {
69
+ return _utils.isExternalUser;
70
+ }
71
+ });
66
72
  Object.defineProperty(exports, "isTeam", {
67
73
  enumerable: true,
68
74
  get: function get() {
@@ -47,7 +47,11 @@ var UfoErrorBoundary = /*#__PURE__*/function (_React$Component) {
47
47
  (0, _createClass2.default)(UfoErrorBoundary, [{
48
48
  key: "componentDidCatch",
49
49
  value: function componentDidCatch() {
50
- userPickerRenderedUfoExperience.getInstance(this.props.id).failure();
50
+ var instance = userPickerRenderedUfoExperience.getInstance(this.props.id);
51
+
52
+ if (instance.state.id !== _ufo.UFOExperienceState.FAILED.id) {
53
+ instance.failure();
54
+ }
51
55
  }
52
56
  }, {
53
57
  key: "render",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "8.7.0",
3
+ "version": "8.7.3",
4
4
  "sideEffects": false
5
5
  }
@@ -34,19 +34,21 @@ const optionData2Analytics = option => {
34
34
  const {
35
35
  id,
36
36
  type
37
- } = option;
37
+ } = option; // id's of email types are emails which is PII
38
+
39
+ const validatedData = {
40
+ id: checkValidId(id) ? id : null,
41
+ type: type || null
42
+ };
38
43
 
39
44
  if (isExternalUser(option)) {
40
- return {
45
+ return { ...validatedData,
41
46
  type: 'external_user',
42
- sources: option.sources
47
+ sources: option.sources,
48
+ externalUserType: option.externalUserType
43
49
  };
44
50
  } else {
45
- // id's of email types are emails which is PII
46
- return {
47
- id: checkValidId(id) ? id : null,
48
- type: type || null
49
- };
51
+ return validatedData;
50
52
  }
51
53
  };
52
54
 
@@ -100,13 +102,17 @@ export const selectEvent = (props, state, session, journeyId, ...args) => {
100
102
  result: result(args[0])
101
103
  });
102
104
  };
103
- export const searchedEvent = (props, state, session, journeyId) => createEvent('operational', 'searched', 'userPicker', { ...createDefaultPickerAttributes(props, session, journeyId),
104
- sessionDuration: sessionDuration(session),
105
- durationSinceInputChange: durationSinceInputChange(session),
106
- queryLength: queryLength(state),
107
- isLoading: isLoading(props, state),
108
- results: results(state)
109
- });
105
+ export const searchedEvent = (props, state, session, journeyId) => {
106
+ const searchResults = results(state);
107
+ return createEvent('operational', 'searched', 'userPicker', { ...createDefaultPickerAttributes(props, session, journeyId),
108
+ sessionDuration: sessionDuration(session),
109
+ durationSinceInputChange: durationSinceInputChange(session),
110
+ queryLength: queryLength(state),
111
+ isLoading: isLoading(props, state),
112
+ results: searchResults,
113
+ numberOfResults: searchResults.length
114
+ });
115
+ };
110
116
  export const failedEvent = (props, _, session, journeyId) => createEvent('operational', 'failed', 'userPicker', { ...createDefaultPickerAttributes(props, session, journeyId)
111
117
  });
112
118
 
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
4
4
  import Select, { CreatableSelect } from '@atlaskit/select';
5
+ import { UFOExperienceState } from '@atlaskit/ufo';
5
6
  import React from 'react';
6
7
  import { BaseUserPickerWithoutAnalytics } from './BaseUserPicker';
7
8
  import { getStyles } from './styles';
@@ -21,8 +22,11 @@ export class UserPickerWithoutAnalytics extends React.Component {
21
22
  }
22
23
 
23
24
  componentDidMount() {
24
- const experienceForId = experience.getInstance(this.ufoId);
25
- experienceForId.success();
25
+ const experienceForId = experience.getInstance(this.ufoId); // Send UFO success if the experience is still in progress i.e. hasn't failed
26
+
27
+ if ([UFOExperienceState.IN_PROGRESS.id, UFOExperienceState.STARTED.id].includes(experienceForId.state.id)) {
28
+ experienceForId.success();
29
+ }
26
30
  }
27
31
 
28
32
  render() {
@@ -2,6 +2,6 @@ export { isValidEmail } from './components/emailValidation';
2
2
  export { UserPicker as default } from './components/UserPicker';
3
3
  export { getUserRecommendations, hydrateDefaultValues, SmartUserPicker, setSmartUserPickerEnv } from './components/smart-user-picker/index';
4
4
  export { PopupUserPicker } from './components/PopupUserPicker';
5
- export { isEmail, isTeam, isUser } from './components/utils';
5
+ export { isEmail, isExternalUser, isTeam, isUser } from './components/utils';
6
6
  export { // Constants
7
7
  EmailType, GroupType, TeamType, UserType } from './types';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ExperiencePerformanceTypes, ExperienceTypes, ConcurrentExperience } from '@atlaskit/ufo';
2
+ import { ExperiencePerformanceTypes, ExperienceTypes, ConcurrentExperience, UFOExperienceState } from '@atlaskit/ufo';
3
3
  export const userPickerRenderedUfoExperience = new ConcurrentExperience('user-picker-rendered', {
4
4
  platform: {
5
5
  component: 'user-picker'
@@ -9,7 +9,11 @@ export const userPickerRenderedUfoExperience = new ConcurrentExperience('user-pi
9
9
  });
10
10
  export class UfoErrorBoundary extends React.Component {
11
11
  componentDidCatch() {
12
- userPickerRenderedUfoExperience.getInstance(this.props.id).failure();
12
+ const instance = userPickerRenderedUfoExperience.getInstance(this.props.id);
13
+
14
+ if (instance.state.id !== UFOExperienceState.FAILED.id) {
15
+ instance.failure();
16
+ }
13
17
  }
14
18
 
15
19
  render() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "8.7.0",
3
+ "version": "8.7.3",
4
4
  "sideEffects": false
5
5
  }
@@ -42,19 +42,21 @@ var checkValidId = function checkValidId(id) {
42
42
 
43
43
  var optionData2Analytics = function optionData2Analytics(option) {
44
44
  var id = option.id,
45
- type = option.type;
45
+ type = option.type; // id's of email types are emails which is PII
46
+
47
+ var validatedData = {
48
+ id: checkValidId(id) ? id : null,
49
+ type: type || null
50
+ };
46
51
 
47
52
  if (isExternalUser(option)) {
48
- return {
53
+ return _objectSpread(_objectSpread({}, validatedData), {}, {
49
54
  type: 'external_user',
50
- sources: option.sources
51
- };
55
+ sources: option.sources,
56
+ externalUserType: option.externalUserType
57
+ });
52
58
  } else {
53
- // id's of email types are emails which is PII
54
- return {
55
- id: checkValidId(id) ? id : null,
56
- type: type || null
57
- };
59
+ return validatedData;
58
60
  }
59
61
  };
60
62
 
@@ -120,12 +122,14 @@ export var selectEvent = function selectEvent(props, state, session, journeyId)
120
122
  }));
121
123
  };
122
124
  export var searchedEvent = function searchedEvent(props, state, session, journeyId) {
125
+ var searchResults = results(state);
123
126
  return createEvent('operational', 'searched', 'userPicker', _objectSpread(_objectSpread({}, createDefaultPickerAttributes(props, session, journeyId)), {}, {
124
127
  sessionDuration: sessionDuration(session),
125
128
  durationSinceInputChange: durationSinceInputChange(session),
126
129
  queryLength: queryLength(state),
127
130
  isLoading: isLoading(props, state),
128
- results: results(state)
131
+ results: searchResults,
132
+ numberOfResults: searchResults.length
129
133
  }));
130
134
  };
131
135
  export var failedEvent = function failedEvent(props, _, session, journeyId) {
@@ -16,6 +16,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
16
16
 
17
17
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
18
18
  import Select, { CreatableSelect } from '@atlaskit/select';
19
+ import { UFOExperienceState } from '@atlaskit/ufo';
19
20
  import React from 'react';
20
21
  import { BaseUserPickerWithoutAnalytics } from './BaseUserPicker';
21
22
  import { getStyles } from './styles';
@@ -46,8 +47,11 @@ export var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component)
46
47
  _createClass(UserPickerWithoutAnalytics, [{
47
48
  key: "componentDidMount",
48
49
  value: function componentDidMount() {
49
- var experienceForId = experience.getInstance(this.ufoId);
50
- experienceForId.success();
50
+ var experienceForId = experience.getInstance(this.ufoId); // Send UFO success if the experience is still in progress i.e. hasn't failed
51
+
52
+ if ([UFOExperienceState.IN_PROGRESS.id, UFOExperienceState.STARTED.id].includes(experienceForId.state.id)) {
53
+ experienceForId.success();
54
+ }
51
55
  }
52
56
  }, {
53
57
  key: "render",
package/dist/esm/index.js CHANGED
@@ -2,6 +2,6 @@ export { isValidEmail } from './components/emailValidation';
2
2
  export { UserPicker as default } from './components/UserPicker';
3
3
  export { getUserRecommendations, hydrateDefaultValues, SmartUserPicker, setSmartUserPickerEnv } from './components/smart-user-picker/index';
4
4
  export { PopupUserPicker } from './components/PopupUserPicker';
5
- export { isEmail, isTeam, isUser } from './components/utils';
5
+ export { isEmail, isExternalUser, isTeam, isUser } from './components/utils';
6
6
  export { // Constants
7
7
  EmailType, GroupType, TeamType, UserType } from './types';
@@ -9,7 +9,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
9
9
  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; } }
10
10
 
11
11
  import React from 'react';
12
- import { ExperiencePerformanceTypes, ExperienceTypes, ConcurrentExperience } from '@atlaskit/ufo';
12
+ import { ExperiencePerformanceTypes, ExperienceTypes, ConcurrentExperience, UFOExperienceState } from '@atlaskit/ufo';
13
13
  export var userPickerRenderedUfoExperience = new ConcurrentExperience('user-picker-rendered', {
14
14
  platform: {
15
15
  component: 'user-picker'
@@ -31,7 +31,11 @@ export var UfoErrorBoundary = /*#__PURE__*/function (_React$Component) {
31
31
  _createClass(UfoErrorBoundary, [{
32
32
  key: "componentDidCatch",
33
33
  value: function componentDidCatch() {
34
- userPickerRenderedUfoExperience.getInstance(this.props.id).failure();
34
+ var instance = userPickerRenderedUfoExperience.getInstance(this.props.id);
35
+
36
+ if (instance.state.id !== UFOExperienceState.FAILED.id) {
37
+ instance.failure();
38
+ }
35
39
  }
36
40
  }, {
37
41
  key: "render",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "8.7.0",
3
+ "version": "8.7.3",
4
4
  "sideEffects": false
5
5
  }
@@ -4,6 +4,6 @@ export { UserPicker as default } from './components/UserPicker';
4
4
  export { getUserRecommendations, hydrateDefaultValues, SmartUserPicker, setSmartUserPickerEnv, } from './components/smart-user-picker/index';
5
5
  export type { RecommendationRequest, SmartUserPickerProps, SupportedProduct, } from './components/smart-user-picker/index';
6
6
  export { PopupUserPicker } from './components/PopupUserPicker';
7
- export { isEmail, isTeam, isUser } from './components/utils';
7
+ export { isEmail, isExternalUser, isTeam, isUser } from './components/utils';
8
8
  export { EmailType, GroupType, TeamType, UserType, } from './types';
9
9
  export type { ActionTypes, Appearance, AtlasKitSelectChange, AtlaskitSelectValue, DefaultValue, InputActionTypes, LozengeProps, OnChange, OnInputChange, OnOption, OnPicker, Option, OptionData, OptionIdentifier, PopupUserPickerProps, Promisable, Target, UserPickerProps, UserPickerState, Value, Email, Group, GroupHighlight, HighlightRange, LoadOptions, Team, TeamHighlight, User, UserHighlight, ExternalUser, UserSource, } from './types';
@@ -204,6 +204,7 @@ export interface OptionData {
204
204
  export declare const UserType = "user";
205
205
  export declare type UserSource = 'google' | 'slack' | 'microsoft' | 'github' | 'jira' | 'confluence' | 'other-atlassian';
206
206
  export interface ExternalUser extends User {
207
+ externalUserType?: 'crossSite' | 'thirdParty';
207
208
  requiresSourceHydration?: boolean;
208
209
  sources: UserSource[];
209
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "8.7.0",
3
+ "version": "8.7.3",
4
4
  "description": "Fabric component for display a dropdown to select a user from",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"