@atlaskit/user-picker 9.0.1 → 9.0.2

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,11 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 9.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`85c0dcfe911`](https://bitbucket.org/atlassian/atlassian-frontend/commits/85c0dcfe911) - Added analytics event when the sources tooltip is displayed for an external user
8
+
3
9
  ## 9.0.1
4
10
 
5
11
  ### Patch Changes
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.startSession = exports.selectEvent = exports.searchedEvent = exports.focusEvent = exports.failedEvent = exports.deleteEvent = exports.createAndFireEventInElementsChannel = exports.clearEvent = exports.cancelEvent = void 0;
8
+ exports.userInfoEvent = exports.startSession = exports.selectEvent = exports.searchedEvent = exports.focusEvent = exports.failedEvent = exports.deleteEvent = exports.createAndFireEventInElementsChannel = exports.clearEvent = exports.cancelEvent = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
@@ -173,6 +173,15 @@ var failedEvent = function failedEvent(props, _, session, journeyId) {
173
173
 
174
174
  exports.failedEvent = failedEvent;
175
175
 
176
+ var userInfoEvent = function userInfoEvent(sources, accountId) {
177
+ return createEvent('ui', 'displayed', 'userInfo', {
178
+ sources: sources,
179
+ accountId: accountId
180
+ });
181
+ };
182
+
183
+ exports.userInfoEvent = userInfoEvent;
184
+
176
185
  function queryLength(state) {
177
186
  return state.inputValue.length;
178
187
  }
@@ -33,6 +33,10 @@ var _tokens = require("@atlaskit/tokens");
33
33
 
34
34
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
35
35
 
36
+ var _analyticsNext = require("@atlaskit/analytics-next");
37
+
38
+ var _analytics = require("../../analytics");
39
+
36
40
  var _AvatarItemOption = require("../AvatarItemOption");
37
41
 
38
42
  var _SizeableAvatar = require("../SizeableAvatar");
@@ -63,21 +67,21 @@ var emailDomainWrapper = (0, _core.css)({
63
67
  });
64
68
  exports.emailDomainWrapper = emailDomainWrapper;
65
69
 
66
- var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
67
- (0, _inherits2.default)(ExternalUserOption, _React$PureComponent);
70
+ var ExternalUserOptionImpl = /*#__PURE__*/function (_React$PureComponent) {
71
+ (0, _inherits2.default)(ExternalUserOptionImpl, _React$PureComponent);
68
72
 
69
- var _super = _createSuper(ExternalUserOption);
73
+ var _super = _createSuper(ExternalUserOptionImpl);
70
74
 
71
- function ExternalUserOption() {
75
+ function ExternalUserOptionImpl() {
72
76
  var _this;
73
77
 
74
- (0, _classCallCheck2.default)(this, ExternalUserOption);
78
+ (0, _classCallCheck2.default)(this, ExternalUserOptionImpl);
75
79
 
76
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
77
- args[_key] = arguments[_key];
80
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
81
+ _args[_key] = arguments[_key];
78
82
  }
79
83
 
80
- _this = _super.call.apply(_super, [this].concat(args));
84
+ _this = _super.call.apply(_super, [this].concat(_args));
81
85
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getPrimaryText", function () {
82
86
  var name = _this.props.user.name;
83
87
  return (0, _core.jsx)("span", {
@@ -117,16 +121,33 @@ var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
117
121
  name: name
118
122
  });
119
123
  });
124
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireEvent", function (eventCreator) {
125
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
126
+ args[_key2 - 1] = arguments[_key2];
127
+ }
128
+
129
+ var createAnalyticsEvent = _this.props.createAnalyticsEvent;
130
+
131
+ if (createAnalyticsEvent) {
132
+ (0, _analytics.createAndFireEventInElementsChannel)(eventCreator.apply(void 0, args))(createAnalyticsEvent);
133
+ }
134
+ });
135
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onShow", function () {
136
+ var user = _this.props.user;
137
+
138
+ _this.fireEvent(_analytics.userInfoEvent, user.sources, user.id);
139
+ });
120
140
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSourcesInfoTooltip", function () {
121
141
  return _this.props.user.isExternal ? (0, _core.jsx)(_tooltip.default, {
122
142
  content: _this.formattedTooltipContent(),
123
- position: 'right-start'
143
+ position: 'right-start',
144
+ onShow: _this.onShow
124
145
  }, (0, _core.jsx)(_InfoIcon.default, null)) : undefined;
125
146
  });
126
147
  return _this;
127
148
  }
128
149
 
129
- (0, _createClass2.default)(ExternalUserOption, [{
150
+ (0, _createClass2.default)(ExternalUserOptionImpl, [{
130
151
  key: "render",
131
152
  value: function render() {
132
153
  return (0, _core.jsx)(_ExternalAvatarItemOption.ExternalAvatarItemOption, {
@@ -152,7 +173,8 @@ var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
152
173
  });
153
174
  }
154
175
  }]);
155
- return ExternalUserOption;
176
+ return ExternalUserOptionImpl;
156
177
  }(_react.default.PureComponent);
157
178
 
179
+ var ExternalUserOption = (0, _analyticsNext.withAnalyticsEvents)()(ExternalUserOptionImpl);
158
180
  exports.ExternalUserOption = ExternalUserOption;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -115,6 +115,10 @@ export const searchedEvent = (props, state, session, journeyId) => {
115
115
  };
116
116
  export const failedEvent = (props, _, session, journeyId) => createEvent('operational', 'failed', 'userPicker', { ...createDefaultPickerAttributes(props, session, journeyId)
117
117
  });
118
+ export const userInfoEvent = (sources, accountId) => createEvent('ui', 'displayed', 'userInfo', {
119
+ sources,
120
+ accountId
121
+ });
118
122
 
119
123
  function queryLength(state) {
120
124
  return state.inputValue.length;
@@ -6,6 +6,8 @@ import { css, jsx } from '@emotion/core';
6
6
  import { B400, N200, N800 } from '@atlaskit/theme/colors';
7
7
  import { token } from '@atlaskit/tokens';
8
8
  import Tooltip from '@atlaskit/tooltip';
9
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
10
+ import { createAndFireEventInElementsChannel, userInfoEvent } from '../../analytics';
9
11
  import { textWrapper } from '../AvatarItemOption';
10
12
  import { SizeableAvatar } from '../SizeableAvatar';
11
13
  import { ExternalUserSourcesContainer } from '../ExternalUserSourcesContainer';
@@ -23,9 +25,10 @@ export const imageContainer = css({
23
25
  export const emailDomainWrapper = css({
24
26
  fontWeight: 'bold'
25
27
  });
26
- export class ExternalUserOption extends React.PureComponent {
27
- constructor(...args) {
28
- super(...args);
28
+
29
+ class ExternalUserOptionImpl extends React.PureComponent {
30
+ constructor(..._args) {
31
+ super(..._args);
29
32
 
30
33
  _defineProperty(this, "getPrimaryText", () => {
31
34
  const {
@@ -73,9 +76,27 @@ export class ExternalUserOption extends React.PureComponent {
73
76
  });
74
77
  });
75
78
 
79
+ _defineProperty(this, "fireEvent", (eventCreator, ...args) => {
80
+ const {
81
+ createAnalyticsEvent
82
+ } = this.props;
83
+
84
+ if (createAnalyticsEvent) {
85
+ createAndFireEventInElementsChannel(eventCreator(...args))(createAnalyticsEvent);
86
+ }
87
+ });
88
+
89
+ _defineProperty(this, "onShow", () => {
90
+ const {
91
+ user
92
+ } = this.props;
93
+ this.fireEvent(userInfoEvent, user.sources, user.id);
94
+ });
95
+
76
96
  _defineProperty(this, "getSourcesInfoTooltip", () => this.props.user.isExternal ? jsx(Tooltip, {
77
97
  content: this.formattedTooltipContent(),
78
- position: 'right-start'
98
+ position: 'right-start',
99
+ onShow: this.onShow
79
100
  }, jsx(InfoIcon, null)) : undefined);
80
101
  }
81
102
 
@@ -103,4 +124,6 @@ export class ExternalUserOption extends React.PureComponent {
103
124
  }, sourceData => jsx(SourcesTooltipContent, sourceData));
104
125
  }
105
126
 
106
- }
127
+ }
128
+
129
+ export const ExternalUserOption = withAnalyticsEvents()(ExternalUserOptionImpl);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -135,6 +135,12 @@ export var searchedEvent = function searchedEvent(props, state, session, journey
135
135
  export var failedEvent = function failedEvent(props, _, session, journeyId) {
136
136
  return createEvent('operational', 'failed', 'userPicker', _objectSpread({}, createDefaultPickerAttributes(props, session, journeyId)));
137
137
  };
138
+ export var userInfoEvent = function userInfoEvent(sources, accountId) {
139
+ return createEvent('ui', 'displayed', 'userInfo', {
140
+ sources: sources,
141
+ accountId: accountId
142
+ });
143
+ };
138
144
 
139
145
  function queryLength(state) {
140
146
  return state.inputValue.length;
@@ -17,6 +17,8 @@ import { css, jsx } from '@emotion/core';
17
17
  import { B400, N200, N800 } from '@atlaskit/theme/colors';
18
18
  import { token } from '@atlaskit/tokens';
19
19
  import Tooltip from '@atlaskit/tooltip';
20
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
21
+ import { createAndFireEventInElementsChannel, userInfoEvent } from '../../analytics';
20
22
  import { textWrapper } from '../AvatarItemOption';
21
23
  import { SizeableAvatar } from '../SizeableAvatar';
22
24
  import { ExternalUserSourcesContainer } from '../ExternalUserSourcesContainer';
@@ -34,21 +36,22 @@ export var imageContainer = css({
34
36
  export var emailDomainWrapper = css({
35
37
  fontWeight: 'bold'
36
38
  });
37
- export var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
38
- _inherits(ExternalUserOption, _React$PureComponent);
39
39
 
40
- var _super = _createSuper(ExternalUserOption);
40
+ var ExternalUserOptionImpl = /*#__PURE__*/function (_React$PureComponent) {
41
+ _inherits(ExternalUserOptionImpl, _React$PureComponent);
41
42
 
42
- function ExternalUserOption() {
43
+ var _super = _createSuper(ExternalUserOptionImpl);
44
+
45
+ function ExternalUserOptionImpl() {
43
46
  var _this;
44
47
 
45
- _classCallCheck(this, ExternalUserOption);
48
+ _classCallCheck(this, ExternalUserOptionImpl);
46
49
 
47
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
- args[_key] = arguments[_key];
50
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
51
+ _args[_key] = arguments[_key];
49
52
  }
50
53
 
51
- _this = _super.call.apply(_super, [this].concat(args));
54
+ _this = _super.call.apply(_super, [this].concat(_args));
52
55
 
53
56
  _defineProperty(_assertThisInitialized(_this), "getPrimaryText", function () {
54
57
  var name = _this.props.user.name;
@@ -92,17 +95,36 @@ export var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
92
95
  });
93
96
  });
94
97
 
98
+ _defineProperty(_assertThisInitialized(_this), "fireEvent", function (eventCreator) {
99
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
100
+ args[_key2 - 1] = arguments[_key2];
101
+ }
102
+
103
+ var createAnalyticsEvent = _this.props.createAnalyticsEvent;
104
+
105
+ if (createAnalyticsEvent) {
106
+ createAndFireEventInElementsChannel(eventCreator.apply(void 0, args))(createAnalyticsEvent);
107
+ }
108
+ });
109
+
110
+ _defineProperty(_assertThisInitialized(_this), "onShow", function () {
111
+ var user = _this.props.user;
112
+
113
+ _this.fireEvent(userInfoEvent, user.sources, user.id);
114
+ });
115
+
95
116
  _defineProperty(_assertThisInitialized(_this), "getSourcesInfoTooltip", function () {
96
117
  return _this.props.user.isExternal ? jsx(Tooltip, {
97
118
  content: _this.formattedTooltipContent(),
98
- position: 'right-start'
119
+ position: 'right-start',
120
+ onShow: _this.onShow
99
121
  }, jsx(InfoIcon, null)) : undefined;
100
122
  });
101
123
 
102
124
  return _this;
103
125
  }
104
126
 
105
- _createClass(ExternalUserOption, [{
127
+ _createClass(ExternalUserOptionImpl, [{
106
128
  key: "render",
107
129
  value: function render() {
108
130
  return jsx(ExternalAvatarItemOption, {
@@ -129,5 +151,7 @@ export var ExternalUserOption = /*#__PURE__*/function (_React$PureComponent) {
129
151
  }
130
152
  }]);
131
153
 
132
- return ExternalUserOption;
133
- }(React.PureComponent);
154
+ return ExternalUserOptionImpl;
155
+ }(React.PureComponent);
156
+
157
+ export var ExternalUserOption = withAnalyticsEvents()(ExternalUserOptionImpl);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -21,3 +21,4 @@ export declare const cancelEvent: EventCreator;
21
21
  export declare const selectEvent: EventCreator;
22
22
  export declare const searchedEvent: EventCreator;
23
23
  export declare const failedEvent: EventCreator;
24
+ export declare const userInfoEvent: (sources: string[], accountId: string) => AnalyticsEventPayload;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const AsyncExternalUserOption: React.LazyExoticComponent<typeof import("./main").ExternalUserOption>;
2
+ declare const AsyncExternalUserOption: React.LazyExoticComponent<React.ForwardRefExoticComponent<Pick<import("./main").ExternalUserOptionProps, "user" | "status" | "isSelected"> & React.RefAttributes<any>>>;
3
3
  export default AsyncExternalUserOption;
@@ -1,18 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
4
  import { ExternalUser } from '../../types';
4
5
  export declare const imageContainer: import("@emotion/utils").SerializedStyles;
5
6
  export declare const emailDomainWrapper: import("@emotion/utils").SerializedStyles;
6
- export declare type ExternalUserOptionProps = {
7
+ export declare type ExternalUserOptionProps = WithAnalyticsEventsProps & {
7
8
  user: ExternalUser;
8
9
  status?: string;
9
10
  isSelected: boolean;
10
11
  };
11
- export declare class ExternalUserOption extends React.PureComponent<ExternalUserOptionProps> {
12
- render(): JSX.Element;
13
- private getPrimaryText;
14
- private renderSecondaryText;
15
- private renderAvatar;
16
- private getSourcesInfoTooltip;
17
- private formattedTooltipContent;
18
- }
12
+ export declare const ExternalUserOption: React.ForwardRefExoticComponent<Pick<ExternalUserOptionProps, "user" | "status" | "isSelected"> & React.RefAttributes<any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "description": "Fabric component for display a dropdown to select a user from",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -73,7 +73,7 @@
73
73
  "faker": "^4.1.0",
74
74
  "mock-apollo-client": "^0.1.0",
75
75
  "react-intl-next": "npm:react-intl@^5.18.1",
76
- "typescript": "3.9.6"
76
+ "typescript": "3.9.10"
77
77
  },
78
78
  "techstack": {
79
79
  "@repo/internal": {