@atlaskit/profilecard 16.5.0 → 16.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/client/ProfileCardClient.js +2 -2
  3. package/dist/cjs/client/TeamCentralCardClient.js +14 -9
  4. package/dist/cjs/components/User/OverflowProfileCardButtons.js +69 -0
  5. package/dist/cjs/components/User/ProfileCard.js +51 -28
  6. package/dist/cjs/components/User/ProfileCardResourced.js +63 -13
  7. package/dist/cjs/components/User/ProfileCardTrigger.js +35 -4
  8. package/dist/cjs/messages.js +5 -0
  9. package/dist/cjs/mocks/mock-profile-client.js +5 -0
  10. package/dist/cjs/styled/Card.js +21 -17
  11. package/dist/cjs/util/analytics.js +1 -1
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/es2019/client/ProfileCardClient.js +2 -2
  14. package/dist/es2019/client/TeamCentralCardClient.js +13 -8
  15. package/dist/es2019/components/User/OverflowProfileCardButtons.js +33 -0
  16. package/dist/es2019/components/User/ProfileCard.js +40 -22
  17. package/dist/es2019/components/User/ProfileCardResourced.js +51 -11
  18. package/dist/es2019/components/User/ProfileCardTrigger.js +35 -4
  19. package/dist/es2019/messages.js +5 -0
  20. package/dist/es2019/mocks/mock-profile-client.js +4 -0
  21. package/dist/es2019/styled/Card.js +8 -1
  22. package/dist/es2019/util/analytics.js +1 -1
  23. package/dist/es2019/version.json +1 -1
  24. package/dist/esm/client/ProfileCardClient.js +2 -2
  25. package/dist/esm/client/TeamCentralCardClient.js +14 -9
  26. package/dist/esm/components/User/OverflowProfileCardButtons.js +43 -0
  27. package/dist/esm/components/User/ProfileCard.js +51 -28
  28. package/dist/esm/components/User/ProfileCardResourced.js +57 -13
  29. package/dist/esm/components/User/ProfileCardTrigger.js +36 -4
  30. package/dist/esm/messages.js +5 -0
  31. package/dist/esm/mocks/mock-profile-client.js +5 -0
  32. package/dist/esm/styled/Card.js +17 -16
  33. package/dist/esm/util/analytics.js +1 -1
  34. package/dist/esm/version.json +1 -1
  35. package/dist/types/client/TeamCentralCardClient.d.ts +6 -2
  36. package/dist/types/client/graphqlUtils.d.ts +1 -1
  37. package/dist/types/components/User/OverflowProfileCardButtons.d.ts +8 -0
  38. package/dist/types/components/User/ProfileCard.d.ts +7 -4
  39. package/dist/types/components/User/ProfileCardResourced.d.ts +3 -1
  40. package/dist/types/components/User/ProfileCardTrigger.d.ts +2 -0
  41. package/dist/types/messages.d.ts +5 -0
  42. package/dist/types/styled/Card.d.ts +1 -0
  43. package/dist/types/types.d.ts +10 -0
  44. package/package.json +4 -1
@@ -22,11 +22,12 @@ var buildReportingLinesQuery = function buildReportingLinesQuery(aaid) {
22
22
  };
23
23
  };
24
24
 
25
- var buildCheckFeatureFlagQuery = function buildCheckFeatureFlagQuery(featureKey) {
25
+ var buildCheckFeatureFlagQuery = function buildCheckFeatureFlagQuery(featureKey, context) {
26
26
  return {
27
- query: "\n query isFeatureKeyEnabled($featureKey: String!) {\n isFeatureEnabled(featureKey: $featureKey) {\n enabled\n }\n }\n ",
27
+ query: "\n query isFeatureKeyEnabled($featureKey: String!, $context: [IsFeatureEnabledContextInput]) {\n isFeatureEnabled(featureKey: $featureKey, context: $context) {\n enabled\n }\n }\n ",
28
28
  variables: {
29
- featureKey: featureKey
29
+ featureKey: featureKey,
30
+ context: context || []
30
31
  }
31
32
  };
32
33
  };
@@ -59,7 +60,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
59
60
  _createClass(TeamCentralCardClient, [{
60
61
  key: "makeFeatureFlagCheckRequest",
61
62
  value: function () {
62
- var _makeFeatureFlagCheckRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(featureKey) {
63
+ var _makeFeatureFlagCheckRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(featureKey, context) {
63
64
  var query, response;
64
65
  return _regeneratorRuntime.wrap(function _callee$(_context) {
65
66
  while (1) {
@@ -73,7 +74,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
73
74
  throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
74
75
 
75
76
  case 2:
76
- query = buildCheckFeatureFlagQuery(featureKey);
77
+ query = buildCheckFeatureFlagQuery(featureKey, context);
77
78
  _context.next = 5;
78
79
  return graphqlQuery(this.options.teamCentralUrl, query);
79
80
 
@@ -89,7 +90,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
89
90
  }, _callee, this);
90
91
  }));
91
92
 
92
- function makeFeatureFlagCheckRequest(_x) {
93
+ function makeFeatureFlagCheckRequest(_x, _x2) {
93
94
  return _makeFeatureFlagCheckRequest.apply(this, arguments);
94
95
  }
95
96
 
@@ -128,7 +129,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
128
129
  }, _callee2, this);
129
130
  }));
130
131
 
131
- function makeRequest(_x2) {
132
+ function makeRequest(_x3) {
132
133
  return _makeRequest.apply(this, arguments);
133
134
  }
134
135
 
@@ -182,7 +183,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
182
183
  }
183
184
  }, {
184
185
  key: "getFlagEnabled",
185
- value: function getFlagEnabled(featureKey) {
186
+ value: function getFlagEnabled(featureKey, productIdentifier) {
186
187
  var _this3 = this;
187
188
 
188
189
  if (!featureKey) {
@@ -197,8 +198,12 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
197
198
  return Promise.resolve(false);
198
199
  }
199
200
 
201
+ var context = [{
202
+ key: 'productIdentifier',
203
+ value: productIdentifier || 'unset'
204
+ }];
200
205
  return new Promise(function (resolve) {
201
- _this3.makeFeatureFlagCheckRequest(featureKey).then(function (enabled) {
206
+ _this3.makeFeatureFlagCheckRequest(featureKey, context).then(function (enabled) {
202
207
  _this3.featureFlagKeys.set(featureKey, enabled);
203
208
 
204
209
  resolve(enabled);
@@ -0,0 +1,43 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["triggerRef", "isSelected", "testId"];
4
+ import React from 'react';
5
+ import { useIntl } from 'react-intl-next';
6
+ import Button from '@atlaskit/button/custom-theme-button';
7
+ import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
8
+ import MoreIcon from '@atlaskit/icon/glyph/more';
9
+ import messages from '../../messages';
10
+ import { OverflowActionButtonsWrapper } from '../../styled/Card';
11
+ export var OverflowProfileCardButtons = function OverflowProfileCardButtons(props) {
12
+ var intl = useIntl();
13
+ return /*#__PURE__*/React.createElement(OverflowActionButtonsWrapper, null, /*#__PURE__*/React.createElement(DropdownMenu, {
14
+ placement: 'bottom-end',
15
+ trigger: function trigger(_ref) {
16
+ var triggerRef = _ref.triggerRef,
17
+ isSelected = _ref.isSelected,
18
+ testId = _ref.testId,
19
+ providedProps = _objectWithoutProperties(_ref, _excluded);
20
+
21
+ return /*#__PURE__*/React.createElement(Button, _extends({
22
+ type: "button"
23
+ }, providedProps, {
24
+ ref: triggerRef,
25
+ iconBefore: /*#__PURE__*/React.createElement(MoreIcon, {
26
+ label: intl.formatMessage(messages.profileCardMoreIconLabel)
27
+ })
28
+ }));
29
+ }
30
+ }, /*#__PURE__*/React.createElement(DropdownItemGroup, null, props.actions.map(function (action) {
31
+ return /*#__PURE__*/React.createElement(DropdownItem, {
32
+ key: action.id,
33
+ onClick: function onClick(event) {
34
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
35
+ args[_key - 1] = arguments[_key];
36
+ }
37
+
38
+ props.onItemClick(action, args, event);
39
+ },
40
+ href: action.link
41
+ }, action.label);
42
+ }))));
43
+ };
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
5
  import _createClass from "@babel/runtime/helpers/createClass";
5
6
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -28,6 +29,7 @@ import { ActionButtonGroup, ActionsFlexSpacer, AppTitleLabel, CardContainer, Car
28
29
  import { isBasicClick } from '../../util/click';
29
30
  import { ErrorMessage } from '../Error';
30
31
  import { IconLabel } from '../Icon';
32
+ import { OverflowProfileCardButtons } from './OverflowProfileCardButtons';
31
33
  import ReportingLinesDetails from './ReportingLinesDetails';
32
34
 
33
35
  var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
@@ -61,14 +63,35 @@ var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
61
63
  }
62
64
  });
63
65
 
64
- _defineProperty(_assertThisInitialized(_this), "giveKudosCallback", function (clickedUserId) {
65
- if (clickedUserId) {
66
- window.open("".concat(_this.props.teamCentralBaseUrl, "/give-kudos?type=individual&recipientId=").concat(clickedUserId));
66
+ _defineProperty(_assertThisInitialized(_this), "kudosUrl", function () {
67
+ var recipientId = _this.props.userId && "&recipientId=".concat(_this.props.userId) || '';
68
+ var cloudId = _this.props.cloudId && "&cloudId=".concat(_this.props.cloudId) || '';
69
+ return "".concat(_this.props.teamCentralBaseUrl, "/kudos/give?type=individual").concat(recipientId).concat(cloudId);
70
+ });
71
+
72
+ _defineProperty(_assertThisInitialized(_this), "kudosButtonCallback", function () {
73
+ if (_this.props.openKudosDrawer) {
74
+ _this.props.openKudosDrawer();
67
75
  } else {
68
- window.open("".concat(_this.props.teamCentralBaseUrl, "/give-kudos?type=individual"));
76
+ window.open(_this.kudosUrl());
69
77
  }
70
78
  });
71
79
 
80
+ _defineProperty(_assertThisInitialized(_this), "renderButton", function (action, idx) {
81
+ return /*#__PURE__*/React.createElement(Button, {
82
+ appearance: idx === 0 ? 'default' : 'subtle',
83
+ key: action.id || idx,
84
+ onClick: function onClick(event) {
85
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
86
+ args[_key - 1] = arguments[_key];
87
+ }
88
+
89
+ return _this.onActionClick(action, args, event);
90
+ },
91
+ href: action.link
92
+ }, action.label);
93
+ });
94
+
72
95
  _this.timeOpen = null;
73
96
 
74
97
  _this.clientFetchProfile = function () {
@@ -108,9 +131,9 @@ var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
108
131
  label: /*#__PURE__*/React.createElement(FormattedMessage, messages.giveKudosButton),
109
132
  id: 'give-kudos',
110
133
  callback: function callback() {
111
- _this3.giveKudosCallback(_this3.props.userId);
134
+ _this3.kudosButtonCallback();
112
135
  },
113
- link: this.props.userId ? "".concat(this.props.teamCentralBaseUrl, "/give-kudos?type=individual&recipientId=").concat(this.props.userId) : "".concat(this.props.teamCentralBaseUrl, "/give-kudos?type=individual")
136
+ link: this.kudosUrl()
114
137
  };
115
138
  return actions.concat([kudosAction]);
116
139
  }
@@ -127,30 +150,30 @@ var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
127
150
  }
128
151
 
129
152
  var actions = this.getActions();
130
- return /*#__PURE__*/React.createElement(ActionButtonGroup, null, actions.map(function (action, idx) {
131
- return /*#__PURE__*/React.createElement(Button, {
132
- appearance: idx === 0 ? 'default' : 'subtle',
133
- key: action.id || idx,
134
- onClick: function onClick(event) {
135
- _this4.callAnalytics(AnalyticsName.PROFILE_CARD_CLICK, {
136
- id: action.id || null,
137
- duration: _this4.durationSince(_this4.timeOpen)
138
- });
139
-
140
- if (action.callback && isBasicClick(event)) {
141
- event.preventDefault();
142
-
143
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
144
- args[_key - 1] = arguments[_key];
145
- }
146
-
147
- action.callback.apply(action, [event].concat(args));
148
- }
149
- },
150
- href: action.link
151
- }, action.label);
153
+ var firstTwoActions = actions.slice(0, 2);
154
+ var restOfActions = actions && actions.length > 2 ? actions.slice(2) : undefined;
155
+ return /*#__PURE__*/React.createElement(ActionButtonGroup, null, firstTwoActions.map(function (action, idx) {
156
+ return _this4.renderButton(action, idx);
157
+ }), restOfActions && /*#__PURE__*/React.createElement(OverflowProfileCardButtons, {
158
+ actions: restOfActions,
159
+ onItemClick: function onItemClick(action, args, event) {
160
+ return _this4.onActionClick(action, args, event);
161
+ }
152
162
  }));
153
163
  }
164
+ }, {
165
+ key: "onActionClick",
166
+ value: function onActionClick(action, args, event) {
167
+ this.callAnalytics(AnalyticsName.PROFILE_CARD_CLICK, {
168
+ id: action.id || null,
169
+ duration: this.durationSince(this.timeOpen)
170
+ });
171
+
172
+ if (action.callback && isBasicClick(event)) {
173
+ event.preventDefault();
174
+ action.callback.apply(action, [event].concat(_toConsumableArray(args)));
175
+ }
176
+ }
154
177
  }, {
155
178
  key: "renderCardDetailsDefault",
156
179
  value: function renderCardDetailsDefault() {
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
5
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -15,7 +16,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
15
16
 
16
17
  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; } }
17
18
 
18
- import React from 'react';
19
+ import React, { Suspense } from 'react';
20
+ import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
19
21
  import { AnalyticsName } from '../../internal/analytics';
20
22
  import filterActions from '../../internal/filterActions';
21
23
  import { CardWrapper } from '../../styled/Card';
@@ -47,7 +49,9 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
47
49
  hasError: false,
48
50
  error: null,
49
51
  data: null,
50
- reportingLinesData: undefined
52
+ reportingLinesData: undefined,
53
+ isKudosEnabled: false,
54
+ kudosDrawerOpen: false
51
55
  });
52
56
 
53
57
  _defineProperty(_assertThisInitialized(_this), "callAnalytics", function (id) {
@@ -75,9 +79,11 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
75
79
  hasError: false,
76
80
  data: null
77
81
  }, function () {
78
- var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId), _this.props.resourceClient.getReportingLines(userId)]);
82
+ var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos()]);
79
83
  requests.then(function (res) {
80
- return _this.handleClientSuccess(res[0], res[1]);
84
+ var _this2;
85
+
86
+ return (_this2 = _this).handleClientSuccess.apply(_this2, _toConsumableArray(res));
81
87
  }, function (err) {
82
88
  return _this.handleClientError(err);
83
89
  }).catch(function (err) {
@@ -90,6 +96,18 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
90
96
  return filterActions(_this.props.actions, _this.state.data);
91
97
  });
92
98
 
99
+ _defineProperty(_assertThisInitialized(_this), "openKudosDrawer", function () {
100
+ _this.setState({
101
+ kudosDrawerOpen: true
102
+ });
103
+ });
104
+
105
+ _defineProperty(_assertThisInitialized(_this), "closeKudosDrawer", function () {
106
+ _this.setState({
107
+ kudosDrawerOpen: false
108
+ });
109
+ });
110
+
93
111
  return _this;
94
112
  }
95
113
 
@@ -125,7 +143,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
125
143
  }
126
144
  }, {
127
145
  key: "handleClientSuccess",
128
- value: function handleClientSuccess(profileData, reportingLinesData) {
146
+ value: function handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
129
147
  if (!this._isMounted) {
130
148
  return;
131
149
  }
@@ -134,7 +152,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
134
152
  isLoading: false,
135
153
  hasError: false,
136
154
  data: profileData,
137
- reportingLinesData: reportingLinesData
155
+ reportingLinesData: reportingLinesData,
156
+ isKudosEnabled: shouldShowGiveKudos
138
157
  });
139
158
  }
140
159
  }, {
@@ -158,10 +177,14 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
158
177
  hasError = _this$state.hasError,
159
178
  error = _this$state.error,
160
179
  data = _this$state.data,
161
- reportingLinesData = _this$state.reportingLinesData;
180
+ reportingLinesData = _this$state.reportingLinesData,
181
+ isKudosEnabled = _this$state.isKudosEnabled;
162
182
  var _this$props3 = this.props,
163
183
  analytics = _this$props3.analytics,
164
- onReportingLinesClick = _this$props3.onReportingLinesClick;
184
+ onReportingLinesClick = _this$props3.onReportingLinesClick,
185
+ cloudId = _this$props3.cloudId,
186
+ userId = _this$props3.userId,
187
+ addFlag = _this$props3.addFlag;
165
188
  var isFetchingOrNotStartToFetchYet = isLoading === true || isLoading === undefined;
166
189
 
167
190
  if (isFetchingOrNotStartToFetchYet) {
@@ -173,18 +196,39 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
173
196
  }));
174
197
  }
175
198
 
176
- var newProps = _objectSpread({
199
+ var newProps = _objectSpread(_objectSpread({
177
200
  hasError: hasError,
178
201
  errorType: error,
179
202
  clientFetchProfile: this.clientFetchProfile,
180
203
  analytics: analytics,
181
204
  reportingLines: reportingLinesData,
182
- onReportingLinesClick: onReportingLinesClick
183
- }, data);
205
+ onReportingLinesClick: onReportingLinesClick,
206
+ cloudId: cloudId,
207
+ userId: userId,
208
+ addFlag: addFlag
209
+ }, data), {}, {
210
+ isKudosEnabled: isKudosEnabled,
211
+ teamCentralBaseUrl: this.props.resourceClient.getTeamCentralBaseUrl(),
212
+ openKudosDrawer: this.openKudosDrawer
213
+ });
184
214
 
185
- return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(ProfileCard, _extends({}, newProps, {
215
+ return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && /*#__PURE__*/React.createElement(Suspense, {
216
+ fallback: null
217
+ }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
218
+ isOpen: this.state.kudosDrawerOpen,
219
+ recipient: {
220
+ type: KudosType.INDIVIDUAL,
221
+ recipientId: this.props.userId
222
+ },
223
+ analytics: this.props.analytics,
224
+ analyticsSource: "profile-card",
225
+ teamCentralBaseUrl: newProps.teamCentralBaseUrl,
226
+ cloudId: this.props.cloudId,
227
+ addFlag: this.props.addFlag,
228
+ onClose: this.closeKudosDrawer
229
+ })), /*#__PURE__*/React.createElement(ProfileCard, _extends({}, newProps, {
186
230
  actions: this.filterActions()
187
- })));
231
+ }))));
188
232
  }
189
233
  }]);
190
234
 
@@ -19,6 +19,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
19
19
  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
20
 
21
21
  import React, { Suspense } from 'react';
22
+ import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
22
23
  import Popup from '@atlaskit/popup';
23
24
  import { layers } from '@atlaskit/theme/constants';
24
25
  import _filterActions from '../../internal/filterActions';
@@ -106,7 +107,8 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
106
107
  data: null,
107
108
  reportingLinesData: undefined,
108
109
  shouldShowGiveKudos: false,
109
- teamCentralBaseUrl: undefined
110
+ teamCentralBaseUrl: undefined,
111
+ kudosDrawerOpen: false
110
112
  });
111
113
 
112
114
  _defineProperty(_assertThisInitialized(_this), "clientFetchProfile", function () {
@@ -142,6 +144,20 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
142
144
  });
143
145
  });
144
146
 
147
+ _defineProperty(_assertThisInitialized(_this), "openKudosDrawer", function () {
148
+ _this.hideProfilecard();
149
+
150
+ _this.setState({
151
+ kudosDrawerOpen: true
152
+ });
153
+ });
154
+
155
+ _defineProperty(_assertThisInitialized(_this), "closeKudosDrawer", function () {
156
+ _this.setState({
157
+ kudosDrawerOpen: false
158
+ });
159
+ });
160
+
145
161
  _defineProperty(_assertThisInitialized(_this), "renderCard", function () {
146
162
  var isLoading = _this.state.isLoading;
147
163
 
@@ -229,7 +245,9 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
229
245
  reportingLines: this.state.reportingLinesData,
230
246
  onReportingLinesClick: this.props.onReportingLinesClick,
231
247
  isKudosEnabled: this.state.shouldShowGiveKudos,
232
- teamCentralBaseUrl: this.state.teamCentralBaseUrl
248
+ teamCentralBaseUrl: this.state.teamCentralBaseUrl,
249
+ cloudId: this.props.cloudId,
250
+ openKudosDrawer: this.openKudosDrawer
233
251
  });
234
252
 
235
253
  var wrapperProps = this.props.trigger === 'hover' ? {
@@ -250,7 +268,7 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
250
268
  value: function renderWithTrigger() {
251
269
  var _this3 = this;
252
270
 
253
- return /*#__PURE__*/React.createElement(Popup, {
271
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popup, {
254
272
  isOpen: !!this.state.visible,
255
273
  onClose: this.hideProfilecard,
256
274
  placement: this.props.position,
@@ -266,7 +284,21 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
266
284
  },
267
285
  zIndex: layers.modal(),
268
286
  shouldUseCaptureOnOutsideClick: true
269
- });
287
+ }), this.state.shouldShowGiveKudos && /*#__PURE__*/React.createElement(Suspense, {
288
+ fallback: null
289
+ }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
290
+ isOpen: this.state.kudosDrawerOpen,
291
+ recipient: {
292
+ type: KudosType.INDIVIDUAL,
293
+ recipientId: this.props.userId
294
+ },
295
+ analytics: this.props.analytics,
296
+ analyticsSource: "profile-card",
297
+ teamCentralBaseUrl: this.state.teamCentralBaseUrl,
298
+ cloudId: this.props.cloudId,
299
+ addFlag: this.props.addFlag,
300
+ onClose: this.closeKudosDrawer
301
+ })));
270
302
  }
271
303
  }, {
272
304
  key: "render",
@@ -144,6 +144,11 @@ var messages = defineMessages({
144
144
  id: 'pt.profile-card.give-kudos',
145
145
  defaultMessage: 'Give kudos',
146
146
  description: 'Title for the button on the profile card for a user to give a kudos'
147
+ },
148
+ profileCardMoreIconLabel: {
149
+ id: 'pt.profile-card.more-icon-label',
150
+ defaultMessage: 'More',
151
+ description: 'Label for the meatballs icon on the profile card, which when clicked will provide more options'
147
152
  }
148
153
  });
149
154
  export default messages;
@@ -98,6 +98,11 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
98
98
  }, timeout);
99
99
  });
100
100
  }
101
+ }, {
102
+ key: "getFlagEnabled",
103
+ value: function getFlagEnabled(featureKey) {
104
+ return Promise.resolve(true);
105
+ }
101
106
  }]);
102
107
 
103
108
  return MockTeamCentralClient;
@@ -1,6 +1,6 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
 
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
4
4
 
5
5
  import styled, { css } from 'styled-components';
6
6
  import { borderRadius, fontSizeSmall, gridSize } from '@atlaskit/theme/constants';
@@ -14,21 +14,22 @@ export var CardContainerEmpty = styled.div(_templateObject || (_templateObject =
14
14
  export var CardWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: ", "px;\n width: ", "px;\n"])), bgColor, borderRadius, gridSize() * 45);
15
15
  export var ProfileImage = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: ", "px;\n left: ", "px;\n"])), gridSize() * 3, gridSize() * 3);
16
16
  export var ActionsFlexSpacer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex: 1 0 auto;\n"])));
17
- export var ActionButtonGroup = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n user-select: none;\n margin: ", "px 0 0 0;\n text-align: right;\n\n button,\n a {\n margin-left: ", "px;\n\n &:first-child {\n margin-left: 0;\n }\n }\n"])), 2 * gridSize(), gridSize);
18
- export var CardContent = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n min-height: ", "px;\n"])), gridSize() * 17);
19
- export var DetailsGroup = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n margin-left: ", "px;\n width: ", "px;\n"])), gridSize() * 14.5, gridSize() * 24.5);
20
- export var DisabledInfo = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: ", "px;\n color: ", ";\n margin: ", "px 0 0 0;\n line-height: ", "px;\n"])), fontSizeSmall, labelTextColor, gridSize() * 1.5, gridSize() * 2);
21
- export var FullNameLabel = styled.span(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n font-size: 18px;\n color: ", ";\n margin: ", ";\n line-height: ", "em;\n"])), function (props) {
17
+ export var ActionButtonGroup = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n user-select: none;\n margin: ", "px 0 0 0;\n text-align: right;\n\n button,\n a,\n span {\n margin-left: ", "px;\n\n &:first-child {\n margin-left: 0;\n }\n }\n"])), 2 * gridSize(), gridSize);
18
+ export var OverflowActionButtonsWrapper = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: inline-block;\n width: 32px;\n height: 32px;\n margin-left: ", "px;\n"])), gridSize);
19
+ export var CardContent = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n min-height: ", "px;\n"])), gridSize() * 17);
20
+ export var DetailsGroup = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n margin-left: ", "px;\n width: ", "px;\n"])), gridSize() * 14.5, gridSize() * 24.5);
21
+ export var DisabledInfo = styled.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: ", "px;\n color: ", ";\n margin: ", "px 0 0 0;\n line-height: ", "px;\n"])), fontSizeSmall, labelTextColor, gridSize() * 1.5, gridSize() * 2);
22
+ export var FullNameLabel = styled.span(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n font-size: 18px;\n color: ", ";\n margin: ", ";\n line-height: ", "em;\n"])), function (props) {
22
23
  return props.isDisabledAccount ? headerTextColorInactive : headerTextColor;
23
24
  }, function (props) {
24
25
  return getFullNameMargin(props);
25
26
  }, 24 / 18);
26
- export var LozengeWrapper = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-top: ", "px;\n text-transform: uppercase;\n display: block;\n"])), gridSize() * 2);
27
- export var CustomLozengeContainer = styled(LozengeWrapper)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n margin-top: ", "px;\n > * {\n margin-top: ", "px;\n &:not(:last-child) {\n margin-right: ", "px;\n }\n }\n"])), gridSize() * 1.5, gridSize() / 2, gridSize() / 2);
28
- export var JobTitleLabel = styled.span(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n font-size: 14px;\n color: ", ";\n margin: 0 0 ", "px 0;\n line-height: ", "em;\n"])), headerTextColor, gridSize() * 1.5, 24 / 14);
29
- export var AppTitleLabel = styled.span(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n background: ", ";\n color: ", ";\n border-radius: ", ";\n padding: 0 6px;\n width: fit-content;\n font-weight: bold;\n text-transform: uppercase;\n\n font-size: 12px;\n margin: 4px 0 ", "px 0;\n line-height: ", "em;\n"])), appLabelBgColor, appLabelTextColor, borderRadius(), gridSize() * 1.5, 24 / 14);
30
- export var SpinnerContainer = styled.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n height: ", "px;\n justify-content: center;\n position: relative;\n"])), gridSize() * 12);
31
- export var CardContainer = styled.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n position: relative;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background-image: linear-gradient(\n to bottom,\n ", "\n 0%,\n ", "\n 100%\n );\n background-repeat: no-repeat;\n background-size: 100% ", "px;\n box-sizing: content-box;\n padding: ", "px;\n ", "\n"])), function (props) {
27
+ export var LozengeWrapper = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-top: ", "px;\n text-transform: uppercase;\n display: block;\n"])), gridSize() * 2);
28
+ export var CustomLozengeContainer = styled(LozengeWrapper)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n margin-top: ", "px;\n > * {\n margin-top: ", "px;\n &:not(:last-child) {\n margin-right: ", "px;\n }\n }\n"])), gridSize() * 1.5, gridSize() / 2, gridSize() / 2);
29
+ export var JobTitleLabel = styled.span(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n font-size: 14px;\n color: ", ";\n margin: 0 0 ", "px 0;\n line-height: ", "em;\n"])), headerTextColor, gridSize() * 1.5, 24 / 14);
30
+ export var AppTitleLabel = styled.span(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n background: ", ";\n color: ", ";\n border-radius: ", ";\n padding: 0 6px;\n width: fit-content;\n font-weight: bold;\n text-transform: uppercase;\n\n font-size: 12px;\n margin: 4px 0 ", "px 0;\n line-height: ", "em;\n"])), appLabelBgColor, appLabelTextColor, borderRadius(), gridSize() * 1.5, 24 / 14);
31
+ export var SpinnerContainer = styled.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n height: ", "px;\n justify-content: center;\n position: relative;\n"])), gridSize() * 12);
32
+ export var CardContainer = styled.div(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n position: relative;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background-image: linear-gradient(\n to bottom,\n ", "\n 0%,\n ", "\n 100%\n );\n background-repeat: no-repeat;\n background-size: 100% ", "px;\n box-sizing: content-box;\n padding: ", "px;\n ", "\n"])), function (props) {
32
33
  return props.isDisabledUser ? headerBgColorDisabledUser : headerBgColor;
33
34
  }, function (props) {
34
35
  return props.isDisabledUser ? headerBgColorDisabledUser : headerBgColor;
@@ -37,8 +38,8 @@ export var CardContainer = styled.div(_templateObject15 || (_templateObject15 =
37
38
  return '';
38
39
  }
39
40
 
40
- return css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n box-shadow: ", ";\n border-radius: ", "px;\n "])), boxShadow, borderRadius);
41
+ return css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n box-shadow: ", ";\n border-radius: ", "px;\n "])), boxShadow, borderRadius);
41
42
  });
42
- export var DetailsLabel = styled.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n line-height: ", "px;\n font-size: ", "px;\n margin: ", "px 0 0 0;\n white-space: nowrap;\n\n & + & {\n margin-top: ", "px;\n }\n"])), gridSize() * 3, gridSize() * 1.5, gridSize() * 2, gridSize() / 4);
43
- export var DetailsLabelIcon = styled.div(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n display: flex;\n flex-shrink: 0;\n color: ", ";\n width: ", "px;\n height: ", "px;\n padding: ", "px;\n vertical-align: top;\n\n svg {\n width: 100%;\n height: 100%;\n }\n"])), labelIconColor, gridSize() * 2, gridSize() * 2, gridSize() / 2);
44
- export var DetailsLabelText = styled.span(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n color: ", ";\n padding-left: ", "px;\n"])), labelTextColor, gridSize() / 2);
43
+ export var DetailsLabel = styled.div(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n line-height: ", "px;\n font-size: ", "px;\n margin: ", "px 0 0 0;\n white-space: nowrap;\n\n & + & {\n margin-top: ", "px;\n }\n"])), gridSize() * 3, gridSize() * 1.5, gridSize() * 2, gridSize() / 4);
44
+ export var DetailsLabelIcon = styled.div(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n display: flex;\n flex-shrink: 0;\n color: ", ";\n width: ", "px;\n height: ", "px;\n padding: ", "px;\n vertical-align: top;\n\n svg {\n width: 100%;\n height: 100%;\n }\n"])), labelIconColor, gridSize() * 2, gridSize() * 2, gridSize() / 2);
45
+ export var DetailsLabelText = styled.span(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n color: ", ";\n padding-left: ", "px;\n"])), labelTextColor, gridSize() / 2);
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
45
45
  actionSubjectId: actionSubjectId,
46
46
  attributes: _objectSpread(_objectSpread({
47
47
  packageName: "@atlaskit/profilecard",
48
- packageVersion: "16.5.0"
48
+ packageVersion: "16.7.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: getPageTime()
51
51
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.5.0"
3
+ "version": "16.7.0"
4
4
  }
@@ -3,6 +3,10 @@ import CachingClient from './CachingClient';
3
3
  declare type TeamCentralCardClientOptions = ProfileClientOptions & {
4
4
  teamCentralUrl: string;
5
5
  };
6
+ declare type FeatureFlagExtraContext = {
7
+ key: string;
8
+ value: string;
9
+ };
6
10
  declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLinesData> {
7
11
  options: TeamCentralCardClientOptions;
8
12
  /**
@@ -16,10 +20,10 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
16
20
  bypassOnFailure: boolean;
17
21
  featureFlagKeys: Map<string, boolean>;
18
22
  constructor(options: TeamCentralCardClientOptions);
19
- makeFeatureFlagCheckRequest(featureKey: string): Promise<boolean>;
23
+ makeFeatureFlagCheckRequest(featureKey: string, context?: FeatureFlagExtraContext[]): Promise<boolean>;
20
24
  makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
21
25
  getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
22
- getFlagEnabled(featureKey: string): Promise<boolean>;
26
+ getFlagEnabled(featureKey: string, productIdentifier?: string): Promise<boolean>;
23
27
  private filterReportingLinesUser;
24
28
  }
25
29
  export default TeamCentralCardClient;
@@ -1,6 +1,6 @@
1
1
  interface Query {
2
2
  query: string;
3
- variables: Record<string, string>;
3
+ variables: Record<string, any>;
4
4
  }
5
5
  export interface GraphQLError {
6
6
  code?: number;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ProfileCardAction } from '../../types';
3
+ declare type OverflowButtonsProps = {
4
+ actions: ProfileCardAction[];
5
+ onItemClick: (action: ProfileCardAction, args: any, event: React.MouseEvent | React.KeyboardEvent) => void;
6
+ };
7
+ export declare const OverflowProfileCardButtons: (props: OverflowButtonsProps) => JSX.Element;
8
+ export {};
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { LozengeProps, ProfilecardProps } from '../../types';
1
+ import React, { ReactElement } from 'react';
2
+ import { LozengeProps, ProfileCardAction, ProfilecardProps } from '../../types';
3
3
  export default class Profilecard extends React.PureComponent<ProfilecardProps> {
4
4
  static defaultProps: ProfilecardProps;
5
5
  private timeOpen;
@@ -10,9 +10,12 @@ export default class Profilecard extends React.PureComponent<ProfilecardProps> {
10
10
  callAnalytics: (id: string, options: any) => void;
11
11
  componentDidMount(): void;
12
12
  renderErrorMessage(): JSX.Element;
13
- giveKudosCallback: (clickedUserId?: string | undefined) => void;
14
- getActions(): import("../../types").ProfileCardAction[];
13
+ kudosUrl: () => string;
14
+ kudosButtonCallback: () => void;
15
+ getActions(): ProfileCardAction[];
16
+ renderButton: (action: ProfileCardAction, idx: number) => ReactElement;
15
17
  renderActionsButtons(): JSX.Element | null;
18
+ private onActionClick;
16
19
  renderCardDetailsDefault(): JSX.Element;
17
20
  renderCardDetailsForDisabledAccount(): JSX.Element;
18
21
  getDisabledAccountName(): string | JSX.Element | null | undefined;
@@ -9,8 +9,10 @@ export default class ProfileCardResourced extends React.PureComponent<ProfileCar
9
9
  componentWillUnmount(): void;
10
10
  private callAnalytics;
11
11
  clientFetchProfile: () => void;
12
- handleClientSuccess(profileData: ProfileCardClientData, reportingLinesData: TeamCentralReportingLinesData): void;
12
+ handleClientSuccess(profileData: ProfileCardClientData, reportingLinesData: TeamCentralReportingLinesData, shouldShowGiveKudos: boolean): void;
13
13
  handleClientError(err: any): void;
14
14
  filterActions: () => ProfileCardAction[];
15
+ openKudosDrawer: () => void;
16
+ closeKudosDrawer: () => void;
15
17
  render(): React.ReactNode;
16
18
  }