@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
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.SpinnerContainer = exports.ProfileImage = exports.LozengeWrapper = exports.JobTitleLabel = exports.FullNameLabel = exports.DisabledInfo = exports.DetailsLabelText = exports.DetailsLabelIcon = exports.DetailsLabel = exports.DetailsGroup = exports.CustomLozengeContainer = exports.CardWrapper = exports.CardContent = exports.CardContainerEmpty = exports.CardContainer = exports.AppTitleLabel = exports.ActionsFlexSpacer = exports.ActionButtonGroup = void 0;
10
+ exports.SpinnerContainer = exports.ProfileImage = exports.OverflowActionButtonsWrapper = exports.LozengeWrapper = exports.JobTitleLabel = exports.FullNameLabel = exports.DisabledInfo = exports.DetailsLabelText = exports.DetailsLabelIcon = exports.DetailsLabel = exports.DetailsGroup = exports.CustomLozengeContainer = exports.CardWrapper = exports.CardContent = exports.CardContainerEmpty = exports.CardContainer = exports.AppTitleLabel = exports.ActionsFlexSpacer = exports.ActionButtonGroup = void 0;
11
11
 
12
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
13
 
@@ -17,7 +17,7 @@ var _constants = require("@atlaskit/theme/constants");
17
17
 
18
18
  var _constants2 = require("../styled/constants");
19
19
 
20
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
20
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
21
21
 
22
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
23
 
@@ -43,23 +43,27 @@ var ActionsFlexSpacer = _styledComponents.default.div(_templateObject4 || (_temp
43
43
 
44
44
  exports.ActionsFlexSpacer = ActionsFlexSpacer;
45
45
 
46
- var ActionButtonGroup = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\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 * (0, _constants.gridSize)(), _constants.gridSize);
46
+ var ActionButtonGroup = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\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 * (0, _constants.gridSize)(), _constants.gridSize);
47
47
 
48
48
  exports.ActionButtonGroup = ActionButtonGroup;
49
49
 
50
- var CardContent = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n min-height: ", "px;\n"])), (0, _constants.gridSize)() * 17);
50
+ var OverflowActionButtonsWrapper = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n display: inline-block;\n width: 32px;\n height: 32px;\n margin-left: ", "px;\n"])), _constants.gridSize);
51
+
52
+ exports.OverflowActionButtonsWrapper = OverflowActionButtonsWrapper;
53
+
54
+ var CardContent = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n min-height: ", "px;\n"])), (0, _constants.gridSize)() * 17);
51
55
 
52
56
  exports.CardContent = CardContent;
53
57
 
54
- var DetailsGroup = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n margin-left: ", "px;\n width: ", "px;\n"])), (0, _constants.gridSize)() * 14.5, (0, _constants.gridSize)() * 24.5);
58
+ var DetailsGroup = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n margin-left: ", "px;\n width: ", "px;\n"])), (0, _constants.gridSize)() * 14.5, (0, _constants.gridSize)() * 24.5);
55
59
 
56
60
  exports.DetailsGroup = DetailsGroup;
57
61
 
58
- var DisabledInfo = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", "px;\n color: ", ";\n margin: ", "px 0 0 0;\n line-height: ", "px;\n"])), _constants.fontSizeSmall, _constants2.labelTextColor, (0, _constants.gridSize)() * 1.5, (0, _constants.gridSize)() * 2);
62
+ var DisabledInfo = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", "px;\n color: ", ";\n margin: ", "px 0 0 0;\n line-height: ", "px;\n"])), _constants.fontSizeSmall, _constants2.labelTextColor, (0, _constants.gridSize)() * 1.5, (0, _constants.gridSize)() * 2);
59
63
 
60
64
  exports.DisabledInfo = DisabledInfo;
61
65
 
62
- var FullNameLabel = _styledComponents.default.span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\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) {
66
+ var FullNameLabel = _styledComponents.default.span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\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) {
63
67
  return props.isDisabledAccount ? _constants2.headerTextColorInactive : _constants2.headerTextColor;
64
68
  }, function (props) {
65
69
  return getFullNameMargin(props);
@@ -67,25 +71,25 @@ var FullNameLabel = _styledComponents.default.span(_templateObject9 || (_templat
67
71
 
68
72
  exports.FullNameLabel = FullNameLabel;
69
73
 
70
- var LozengeWrapper = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n margin-top: ", "px;\n text-transform: uppercase;\n display: block;\n"])), (0, _constants.gridSize)() * 2);
74
+ var LozengeWrapper = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n margin-top: ", "px;\n text-transform: uppercase;\n display: block;\n"])), (0, _constants.gridSize)() * 2);
71
75
 
72
76
  exports.LozengeWrapper = LozengeWrapper;
73
- var CustomLozengeContainer = (0, _styledComponents.default)(LozengeWrapper)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\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"])), (0, _constants.gridSize)() * 1.5, (0, _constants.gridSize)() / 2, (0, _constants.gridSize)() / 2);
77
+ var CustomLozengeContainer = (0, _styledComponents.default)(LozengeWrapper)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\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"])), (0, _constants.gridSize)() * 1.5, (0, _constants.gridSize)() / 2, (0, _constants.gridSize)() / 2);
74
78
  exports.CustomLozengeContainer = CustomLozengeContainer;
75
79
 
76
- var JobTitleLabel = _styledComponents.default.span(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\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"])), _constants2.headerTextColor, (0, _constants.gridSize)() * 1.5, 24 / 14);
80
+ var JobTitleLabel = _styledComponents.default.span(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\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"])), _constants2.headerTextColor, (0, _constants.gridSize)() * 1.5, 24 / 14);
77
81
 
78
82
  exports.JobTitleLabel = JobTitleLabel;
79
83
 
80
- var AppTitleLabel = _styledComponents.default.span(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\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"])), _constants2.appLabelBgColor, _constants2.appLabelTextColor, (0, _constants.borderRadius)(), (0, _constants.gridSize)() * 1.5, 24 / 14);
84
+ var AppTitleLabel = _styledComponents.default.span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\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"])), _constants2.appLabelBgColor, _constants2.appLabelTextColor, (0, _constants.borderRadius)(), (0, _constants.gridSize)() * 1.5, 24 / 14);
81
85
 
82
86
  exports.AppTitleLabel = AppTitleLabel;
83
87
 
84
- var SpinnerContainer = _styledComponents.default.div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: flex;\n height: ", "px;\n justify-content: center;\n position: relative;\n"])), (0, _constants.gridSize)() * 12);
88
+ var SpinnerContainer = _styledComponents.default.div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: flex;\n height: ", "px;\n justify-content: center;\n position: relative;\n"])), (0, _constants.gridSize)() * 12);
85
89
 
86
90
  exports.SpinnerContainer = SpinnerContainer;
87
91
 
88
- var CardContainer = _styledComponents.default.div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\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) {
92
+ var CardContainer = _styledComponents.default.div(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\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) {
89
93
  return props.isDisabledUser ? _constants2.headerBgColorDisabledUser : _constants2.headerBgColor;
90
94
  }, function (props) {
91
95
  return props.isDisabledUser ? _constants2.headerBgColorDisabledUser : _constants2.headerBgColor;
@@ -94,19 +98,19 @@ var CardContainer = _styledComponents.default.div(_templateObject15 || (_templat
94
98
  return '';
95
99
  }
96
100
 
97
- return (0, _styledComponents.css)(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n box-shadow: ", ";\n border-radius: ", "px;\n "])), _constants2.boxShadow, _constants.borderRadius);
101
+ return (0, _styledComponents.css)(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n box-shadow: ", ";\n border-radius: ", "px;\n "])), _constants2.boxShadow, _constants.borderRadius);
98
102
  });
99
103
 
100
104
  exports.CardContainer = CardContainer;
101
105
 
102
- var DetailsLabel = _styledComponents.default.div(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\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"])), (0, _constants.gridSize)() * 3, (0, _constants.gridSize)() * 1.5, (0, _constants.gridSize)() * 2, (0, _constants.gridSize)() / 4);
106
+ var DetailsLabel = _styledComponents.default.div(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\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"])), (0, _constants.gridSize)() * 3, (0, _constants.gridSize)() * 1.5, (0, _constants.gridSize)() * 2, (0, _constants.gridSize)() / 4);
103
107
 
104
108
  exports.DetailsLabel = DetailsLabel;
105
109
 
106
- var DetailsLabelIcon = _styledComponents.default.div(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\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"])), _constants2.labelIconColor, (0, _constants.gridSize)() * 2, (0, _constants.gridSize)() * 2, (0, _constants.gridSize)() / 2);
110
+ var DetailsLabelIcon = _styledComponents.default.div(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["\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"])), _constants2.labelIconColor, (0, _constants.gridSize)() * 2, (0, _constants.gridSize)() * 2, (0, _constants.gridSize)() / 2);
107
111
 
108
112
  exports.DetailsLabelIcon = DetailsLabelIcon;
109
113
 
110
- var DetailsLabelText = _styledComponents.default.span(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n text-overflow: ellipsis;\n color: ", ";\n padding-left: ", "px;\n"])), _constants2.labelTextColor, (0, _constants.gridSize)() / 2);
114
+ var DetailsLabelText = _styledComponents.default.span(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n text-overflow: ellipsis;\n color: ", ";\n padding-left: ", "px;\n"])), _constants2.labelTextColor, (0, _constants.gridSize)() / 2);
111
115
 
112
116
  exports.DetailsLabelText = DetailsLabelText;
@@ -56,7 +56,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
56
56
  actionSubjectId: actionSubjectId,
57
57
  attributes: _objectSpread(_objectSpread({
58
58
  packageName: "@atlaskit/profilecard",
59
- packageVersion: "16.5.0"
59
+ packageVersion: "16.7.0"
60
60
  }, attributes), {}, {
61
61
  firedAt: (0, _performance.getPageTime)()
62
62
  })
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.5.0"
3
+ "version": "16.7.0"
4
4
  }
@@ -41,11 +41,11 @@ class ProfileCardClient {
41
41
  }
42
42
 
43
43
  shouldShowGiveKudos() {
44
- var _this$tcClient4, _this$tcClient5;
44
+ var _this$tcClient4, _this$tcClient5, _this$tcClient6;
45
45
 
46
46
  // Check if the kudos feature enabled and if the user has TC
47
47
  // if the user does not have TC the tc client will be undefined.
48
- return ((_this$tcClient4 = this.tcClient) === null || _this$tcClient4 === void 0 ? void 0 : _this$tcClient4.options.teamCentralBaseUrl) && ((_this$tcClient5 = this.tcClient) === null || _this$tcClient5 === void 0 ? void 0 : _this$tcClient5.getFlagEnabled('team-central-kudos-enabled-m2')) || Promise.resolve(false);
48
+ return ((_this$tcClient4 = this.tcClient) === null || _this$tcClient4 === void 0 ? void 0 : _this$tcClient4.options.teamCentralBaseUrl) && ((_this$tcClient5 = this.tcClient) === null || _this$tcClient5 === void 0 ? void 0 : _this$tcClient5.getFlagEnabled('team-central-kudos-enabled-m2', (_this$tcClient6 = this.tcClient) === null || _this$tcClient6 === void 0 ? void 0 : _this$tcClient6.options.productIdentifier)) || Promise.resolve(false);
49
49
  }
50
50
 
51
51
  }
@@ -32,16 +32,17 @@ const buildReportingLinesQuery = aaid => ({
32
32
  }
33
33
  });
34
34
 
35
- const buildCheckFeatureFlagQuery = featureKey => ({
35
+ const buildCheckFeatureFlagQuery = (featureKey, context) => ({
36
36
  query: `
37
- query isFeatureKeyEnabled($featureKey: String!) {
38
- isFeatureEnabled(featureKey: $featureKey) {
37
+ query isFeatureKeyEnabled($featureKey: String!, $context: [IsFeatureEnabledContextInput]) {
38
+ isFeatureEnabled(featureKey: $featureKey, context: $context) {
39
39
  enabled
40
40
  }
41
41
  }
42
42
  `,
43
43
  variables: {
44
- featureKey
44
+ featureKey,
45
+ context: context || []
45
46
  }
46
47
  });
47
48
 
@@ -61,12 +62,12 @@ class TeamCentralCardClient extends CachingClient {
61
62
  this.featureFlagKeys = new Map();
62
63
  }
63
64
 
64
- async makeFeatureFlagCheckRequest(featureKey) {
65
+ async makeFeatureFlagCheckRequest(featureKey, context) {
65
66
  if (!this.options.teamCentralUrl) {
66
67
  throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
67
68
  }
68
69
 
69
- const query = buildCheckFeatureFlagQuery(featureKey);
70
+ const query = buildCheckFeatureFlagQuery(featureKey, context);
70
71
  const response = await graphqlQuery(this.options.teamCentralUrl, query);
71
72
  return response.isFeatureEnabled.enabled;
72
73
  }
@@ -124,7 +125,7 @@ class TeamCentralCardClient extends CachingClient {
124
125
  });
125
126
  }
126
127
 
127
- getFlagEnabled(featureKey) {
128
+ getFlagEnabled(featureKey, productIdentifier) {
128
129
  if (!featureKey) {
129
130
  return Promise.reject(new Error('featureKey missing'));
130
131
  }
@@ -137,8 +138,12 @@ class TeamCentralCardClient extends CachingClient {
137
138
  return Promise.resolve(false);
138
139
  }
139
140
 
141
+ const context = [{
142
+ key: 'productIdentifier',
143
+ value: productIdentifier || 'unset'
144
+ }];
140
145
  return new Promise(resolve => {
141
- this.makeFeatureFlagCheckRequest(featureKey).then(enabled => {
146
+ this.makeFeatureFlagCheckRequest(featureKey, context).then(enabled => {
142
147
  this.featureFlagKeys.set(featureKey, enabled);
143
148
  resolve(enabled);
144
149
  }).catch(error => {
@@ -0,0 +1,33 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { useIntl } from 'react-intl-next';
4
+ import Button from '@atlaskit/button/custom-theme-button';
5
+ import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
6
+ import MoreIcon from '@atlaskit/icon/glyph/more';
7
+ import messages from '../../messages';
8
+ import { OverflowActionButtonsWrapper } from '../../styled/Card';
9
+ export const OverflowProfileCardButtons = props => {
10
+ const intl = useIntl();
11
+ return /*#__PURE__*/React.createElement(OverflowActionButtonsWrapper, null, /*#__PURE__*/React.createElement(DropdownMenu, {
12
+ placement: 'bottom-end',
13
+ trigger: ({
14
+ triggerRef,
15
+ isSelected,
16
+ testId,
17
+ ...providedProps
18
+ }) => /*#__PURE__*/React.createElement(Button, _extends({
19
+ type: "button"
20
+ }, providedProps, {
21
+ ref: triggerRef,
22
+ iconBefore: /*#__PURE__*/React.createElement(MoreIcon, {
23
+ label: intl.formatMessage(messages.profileCardMoreIconLabel)
24
+ })
25
+ }))
26
+ }, /*#__PURE__*/React.createElement(DropdownItemGroup, null, props.actions.map(action => /*#__PURE__*/React.createElement(DropdownItem, {
27
+ key: action.id,
28
+ onClick: (event, ...args) => {
29
+ props.onItemClick(action, args, event);
30
+ },
31
+ href: action.link
32
+ }, action.label)))));
33
+ };
@@ -15,6 +15,7 @@ import { ActionButtonGroup, ActionsFlexSpacer, AppTitleLabel, CardContainer, Car
15
15
  import { isBasicClick } from '../../util/click';
16
16
  import { ErrorMessage } from '../Error';
17
17
  import { IconLabel } from '../Icon';
18
+ import { OverflowProfileCardButtons } from './OverflowProfileCardButtons';
18
19
  import ReportingLinesDetails from './ReportingLinesDetails';
19
20
  export default class Profilecard extends React.PureComponent {
20
21
  constructor(props) {
@@ -37,14 +38,29 @@ export default class Profilecard extends React.PureComponent {
37
38
  }
38
39
  });
39
40
 
40
- _defineProperty(this, "giveKudosCallback", clickedUserId => {
41
- if (clickedUserId) {
42
- window.open(`${this.props.teamCentralBaseUrl}/give-kudos?type=individual&recipientId=${clickedUserId}`);
41
+ _defineProperty(this, "kudosUrl", () => {
42
+ const recipientId = this.props.userId && `&recipientId=${this.props.userId}` || '';
43
+ const cloudId = this.props.cloudId && `&cloudId=${this.props.cloudId}` || '';
44
+ return `${this.props.teamCentralBaseUrl}/kudos/give?type=individual${recipientId}${cloudId}`;
45
+ });
46
+
47
+ _defineProperty(this, "kudosButtonCallback", () => {
48
+ if (this.props.openKudosDrawer) {
49
+ this.props.openKudosDrawer();
43
50
  } else {
44
- window.open(`${this.props.teamCentralBaseUrl}/give-kudos?type=individual`);
51
+ window.open(this.kudosUrl());
45
52
  }
46
53
  });
47
54
 
55
+ _defineProperty(this, "renderButton", (action, idx) => {
56
+ return /*#__PURE__*/React.createElement(Button, {
57
+ appearance: idx === 0 ? 'default' : 'subtle',
58
+ key: action.id || idx,
59
+ onClick: (event, ...args) => this.onActionClick(action, args, event),
60
+ href: action.link
61
+ }, action.label);
62
+ });
63
+
48
64
  this.timeOpen = null;
49
65
 
50
66
  this.clientFetchProfile = (...args) => {
@@ -73,9 +89,9 @@ export default class Profilecard extends React.PureComponent {
73
89
  label: /*#__PURE__*/React.createElement(FormattedMessage, messages.giveKudosButton),
74
90
  id: 'give-kudos',
75
91
  callback: () => {
76
- this.giveKudosCallback(this.props.userId);
92
+ this.kudosButtonCallback();
77
93
  },
78
- link: this.props.userId ? `${this.props.teamCentralBaseUrl}/give-kudos?type=individual&recipientId=${this.props.userId}` : `${this.props.teamCentralBaseUrl}/give-kudos?type=individual`
94
+ link: this.kudosUrl()
79
95
  };
80
96
  return actions.concat([kudosAction]);
81
97
  }
@@ -89,22 +105,24 @@ export default class Profilecard extends React.PureComponent {
89
105
  }
90
106
 
91
107
  const actions = this.getActions();
92
- return /*#__PURE__*/React.createElement(ActionButtonGroup, null, actions.map((action, idx) => /*#__PURE__*/React.createElement(Button, {
93
- appearance: idx === 0 ? 'default' : 'subtle',
94
- key: action.id || idx,
95
- onClick: (event, ...args) => {
96
- this.callAnalytics(AnalyticsName.PROFILE_CARD_CLICK, {
97
- id: action.id || null,
98
- duration: this.durationSince(this.timeOpen)
99
- });
100
-
101
- if (action.callback && isBasicClick(event)) {
102
- event.preventDefault();
103
- action.callback(event, ...args);
104
- }
105
- },
106
- href: action.link
107
- }, action.label)));
108
+ const firstTwoActions = actions.slice(0, 2);
109
+ const restOfActions = actions && actions.length > 2 ? actions.slice(2) : undefined;
110
+ return /*#__PURE__*/React.createElement(ActionButtonGroup, null, firstTwoActions.map((action, idx) => this.renderButton(action, idx)), restOfActions && /*#__PURE__*/React.createElement(OverflowProfileCardButtons, {
111
+ actions: restOfActions,
112
+ onItemClick: (action, args, event) => this.onActionClick(action, args, event)
113
+ }));
114
+ }
115
+
116
+ onActionClick(action, args, event) {
117
+ this.callAnalytics(AnalyticsName.PROFILE_CARD_CLICK, {
118
+ id: action.id || null,
119
+ duration: this.durationSince(this.timeOpen)
120
+ });
121
+
122
+ if (action.callback && isBasicClick(event)) {
123
+ event.preventDefault();
124
+ action.callback(event, ...args);
125
+ }
108
126
  }
109
127
 
110
128
  renderCardDetailsDefault() {
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import React from 'react';
3
+ import React, { Suspense } from 'react';
4
+ import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
4
5
  import { AnalyticsName } from '../../internal/analytics';
5
6
  import filterActions from '../../internal/filterActions';
6
7
  import { CardWrapper } from '../../styled/Card';
@@ -19,7 +20,9 @@ export default class ProfileCardResourced extends React.PureComponent {
19
20
  hasError: false,
20
21
  error: null,
21
22
  data: null,
22
- reportingLinesData: undefined
23
+ reportingLinesData: undefined,
24
+ isKudosEnabled: false,
25
+ kudosDrawerOpen: false
23
26
  });
24
27
 
25
28
  _defineProperty(this, "callAnalytics", (id, options = {}) => {
@@ -51,12 +54,24 @@ export default class ProfileCardResourced extends React.PureComponent {
51
54
  hasError: false,
52
55
  data: null
53
56
  }, () => {
54
- const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId), this.props.resourceClient.getReportingLines(userId)]);
55
- requests.then(res => this.handleClientSuccess(res[0], res[1]), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
57
+ const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId), this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos()]);
58
+ requests.then(res => this.handleClientSuccess(...res), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
56
59
  });
57
60
  });
58
61
 
59
62
  _defineProperty(this, "filterActions", () => filterActions(this.props.actions, this.state.data));
63
+
64
+ _defineProperty(this, "openKudosDrawer", () => {
65
+ this.setState({
66
+ kudosDrawerOpen: true
67
+ });
68
+ });
69
+
70
+ _defineProperty(this, "closeKudosDrawer", () => {
71
+ this.setState({
72
+ kudosDrawerOpen: false
73
+ });
74
+ });
60
75
  }
61
76
 
62
77
  componentDidMount() {
@@ -89,7 +104,7 @@ export default class ProfileCardResourced extends React.PureComponent {
89
104
  this._isMounted = false;
90
105
  }
91
106
 
92
- handleClientSuccess(profileData, reportingLinesData) {
107
+ handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
93
108
  if (!this._isMounted) {
94
109
  return;
95
110
  }
@@ -98,7 +113,8 @@ export default class ProfileCardResourced extends React.PureComponent {
98
113
  isLoading: false,
99
114
  hasError: false,
100
115
  data: profileData,
101
- reportingLinesData
116
+ reportingLinesData,
117
+ isKudosEnabled: shouldShowGiveKudos
102
118
  });
103
119
  }
104
120
 
@@ -120,11 +136,15 @@ export default class ProfileCardResourced extends React.PureComponent {
120
136
  hasError,
121
137
  error,
122
138
  data,
123
- reportingLinesData
139
+ reportingLinesData,
140
+ isKudosEnabled
124
141
  } = this.state;
125
142
  const {
126
143
  analytics,
127
- onReportingLinesClick
144
+ onReportingLinesClick,
145
+ cloudId,
146
+ userId,
147
+ addFlag
128
148
  } = this.props;
129
149
  const isFetchingOrNotStartToFetchYet = isLoading === true || isLoading === undefined;
130
150
 
@@ -144,11 +164,31 @@ export default class ProfileCardResourced extends React.PureComponent {
144
164
  analytics,
145
165
  reportingLines: reportingLinesData,
146
166
  onReportingLinesClick: onReportingLinesClick,
147
- ...data
167
+ cloudId,
168
+ userId,
169
+ addFlag,
170
+ ...data,
171
+ isKudosEnabled,
172
+ teamCentralBaseUrl: this.props.resourceClient.getTeamCentralBaseUrl(),
173
+ openKudosDrawer: this.openKudosDrawer
148
174
  };
149
- return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(ProfileCard, _extends({}, newProps, {
175
+ return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && /*#__PURE__*/React.createElement(Suspense, {
176
+ fallback: null
177
+ }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
178
+ isOpen: this.state.kudosDrawerOpen,
179
+ recipient: {
180
+ type: KudosType.INDIVIDUAL,
181
+ recipientId: this.props.userId
182
+ },
183
+ analytics: this.props.analytics,
184
+ analyticsSource: "profile-card",
185
+ teamCentralBaseUrl: newProps.teamCentralBaseUrl,
186
+ cloudId: this.props.cloudId,
187
+ addFlag: this.props.addFlag,
188
+ onClose: this.closeKudosDrawer
189
+ })), /*#__PURE__*/React.createElement(ProfileCard, _extends({}, newProps, {
150
190
  actions: this.filterActions()
151
- })));
191
+ }))));
152
192
  }
153
193
 
154
194
  }
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React, { Suspense } from 'react';
4
+ import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
4
5
  import Popup from '@atlaskit/popup';
5
6
  import { layers } from '@atlaskit/theme/constants';
6
7
  import filterActions from '../../internal/filterActions';
@@ -74,7 +75,8 @@ class ProfilecardTrigger extends React.PureComponent {
74
75
  data: null,
75
76
  reportingLinesData: undefined,
76
77
  shouldShowGiveKudos: false,
77
- teamCentralBaseUrl: undefined
78
+ teamCentralBaseUrl: undefined,
79
+ kudosDrawerOpen: false
78
80
  });
79
81
 
80
82
  _defineProperty(this, "clientFetchProfile", () => {
@@ -104,6 +106,19 @@ class ProfilecardTrigger extends React.PureComponent {
104
106
  });
105
107
  });
106
108
 
109
+ _defineProperty(this, "openKudosDrawer", () => {
110
+ this.hideProfilecard();
111
+ this.setState({
112
+ kudosDrawerOpen: true
113
+ });
114
+ });
115
+
116
+ _defineProperty(this, "closeKudosDrawer", () => {
117
+ this.setState({
118
+ kudosDrawerOpen: false
119
+ });
120
+ });
121
+
107
122
  _defineProperty(this, "renderCard", () => {
108
123
  const {
109
124
  isLoading
@@ -186,7 +201,9 @@ class ProfilecardTrigger extends React.PureComponent {
186
201
  reportingLines: this.state.reportingLinesData,
187
202
  onReportingLinesClick: this.props.onReportingLinesClick,
188
203
  isKudosEnabled: this.state.shouldShowGiveKudos,
189
- teamCentralBaseUrl: this.state.teamCentralBaseUrl
204
+ teamCentralBaseUrl: this.state.teamCentralBaseUrl,
205
+ cloudId: this.props.cloudId,
206
+ openKudosDrawer: this.openKudosDrawer
190
207
  };
191
208
  const wrapperProps = this.props.trigger === 'hover' ? {
192
209
  onMouseEnter: this.showProfilecard,
@@ -203,7 +220,7 @@ class ProfilecardTrigger extends React.PureComponent {
203
220
  }
204
221
 
205
222
  renderWithTrigger() {
206
- return /*#__PURE__*/React.createElement(Popup, {
223
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popup, {
207
224
  isOpen: !!this.state.visible,
208
225
  onClose: this.hideProfilecard,
209
226
  placement: this.props.position,
@@ -220,7 +237,21 @@ class ProfilecardTrigger extends React.PureComponent {
220
237
  },
221
238
  zIndex: layers.modal(),
222
239
  shouldUseCaptureOnOutsideClick: true
223
- });
240
+ }), this.state.shouldShowGiveKudos && /*#__PURE__*/React.createElement(Suspense, {
241
+ fallback: null
242
+ }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
243
+ isOpen: this.state.kudosDrawerOpen,
244
+ recipient: {
245
+ type: KudosType.INDIVIDUAL,
246
+ recipientId: this.props.userId
247
+ },
248
+ analytics: this.props.analytics,
249
+ analyticsSource: "profile-card",
250
+ teamCentralBaseUrl: this.state.teamCentralBaseUrl,
251
+ cloudId: this.props.cloudId,
252
+ addFlag: this.props.addFlag,
253
+ onClose: this.closeKudosDrawer
254
+ })));
224
255
  }
225
256
 
226
257
  render() {
@@ -144,6 +144,11 @@ const 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;
@@ -57,6 +57,10 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
57
57
  });
58
58
  }
59
59
 
60
+ getFlagEnabled(featureKey) {
61
+ return Promise.resolve(true);
62
+ }
63
+
60
64
  }
61
65
 
62
66
  return class MockProfileClient extends BaseProfileClient {
@@ -24,7 +24,8 @@ export const ActionButtonGroup = styled.div`
24
24
  text-align: right;
25
25
 
26
26
  button,
27
- a {
27
+ a,
28
+ span {
28
29
  margin-left: ${gridSize}px;
29
30
 
30
31
  &:first-child {
@@ -32,6 +33,12 @@ export const ActionButtonGroup = styled.div`
32
33
  }
33
34
  }
34
35
  `;
36
+ export const OverflowActionButtonsWrapper = styled.div`
37
+ display: inline-block;
38
+ width: 32px;
39
+ height: 32px;
40
+ margin-left: ${gridSize}px;
41
+ `;
35
42
  export const CardContent = styled.div`
36
43
  display: flex;
37
44
  flex-direction: column;
@@ -35,7 +35,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
35
35
  actionSubjectId,
36
36
  attributes: {
37
37
  packageName: "@atlaskit/profilecard",
38
- packageVersion: "16.5.0",
38
+ packageVersion: "16.7.0",
39
39
  ...attributes,
40
40
  firedAt: getPageTime()
41
41
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "16.5.0"
3
+ "version": "16.7.0"
4
4
  }
@@ -58,11 +58,11 @@ var ProfileCardClient = /*#__PURE__*/function () {
58
58
  }, {
59
59
  key: "shouldShowGiveKudos",
60
60
  value: function shouldShowGiveKudos() {
61
- var _this$tcClient4, _this$tcClient5;
61
+ var _this$tcClient4, _this$tcClient5, _this$tcClient6;
62
62
 
63
63
  // Check if the kudos feature enabled and if the user has TC
64
64
  // if the user does not have TC the tc client will be undefined.
65
- return ((_this$tcClient4 = this.tcClient) === null || _this$tcClient4 === void 0 ? void 0 : _this$tcClient4.options.teamCentralBaseUrl) && ((_this$tcClient5 = this.tcClient) === null || _this$tcClient5 === void 0 ? void 0 : _this$tcClient5.getFlagEnabled('team-central-kudos-enabled-m2')) || Promise.resolve(false);
65
+ return ((_this$tcClient4 = this.tcClient) === null || _this$tcClient4 === void 0 ? void 0 : _this$tcClient4.options.teamCentralBaseUrl) && ((_this$tcClient5 = this.tcClient) === null || _this$tcClient5 === void 0 ? void 0 : _this$tcClient5.getFlagEnabled('team-central-kudos-enabled-m2', (_this$tcClient6 = this.tcClient) === null || _this$tcClient6 === void 0 ? void 0 : _this$tcClient6.options.productIdentifier)) || Promise.resolve(false);
66
66
  }
67
67
  }]);
68
68