@atlaskit/profilecard 16.5.0 → 16.6.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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/client/ProfileCardClient.js +2 -2
- package/dist/cjs/client/TeamCentralCardClient.js +14 -9
- package/dist/cjs/components/User/ProfileCard.js +35 -27
- package/dist/cjs/components/User/ProfileCardResourced.js +63 -13
- package/dist/cjs/components/User/ProfileCardTrigger.js +35 -4
- package/dist/cjs/mocks/mock-profile-client.js +5 -0
- package/dist/cjs/styled/Card.js +1 -1
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/ProfileCardClient.js +2 -2
- package/dist/es2019/client/TeamCentralCardClient.js +13 -8
- package/dist/es2019/components/User/ProfileCard.js +32 -22
- package/dist/es2019/components/User/ProfileCardResourced.js +51 -11
- package/dist/es2019/components/User/ProfileCardTrigger.js +35 -4
- package/dist/es2019/mocks/mock-profile-client.js +4 -0
- package/dist/es2019/styled/Card.js +2 -1
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/ProfileCardClient.js +2 -2
- package/dist/esm/client/TeamCentralCardClient.js +14 -9
- package/dist/esm/components/User/ProfileCard.js +37 -27
- package/dist/esm/components/User/ProfileCardResourced.js +57 -13
- package/dist/esm/components/User/ProfileCardTrigger.js +36 -4
- package/dist/esm/mocks/mock-profile-client.js +5 -0
- package/dist/esm/styled/Card.js +1 -1
- package/dist/esm/util/analytics.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/client/TeamCentralCardClient.d.ts +6 -2
- package/dist/types/client/graphqlUtils.d.ts +1 -1
- package/dist/types/components/User/ProfileCard.d.ts +6 -4
- package/dist/types/components/User/ProfileCardResourced.d.ts +3 -1
- package/dist/types/components/User/ProfileCardTrigger.d.ts +2 -0
- package/dist/types/types.d.ts +10 -0
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 16.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`7c691c8e8a9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7c691c8e8a9) - [ux] Launch the give kudos flow via a drawer from the profile-card.
|
|
8
|
+
|
|
3
9
|
## 16.5.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -70,11 +70,11 @@ var ProfileCardClient = /*#__PURE__*/function () {
|
|
|
70
70
|
}, {
|
|
71
71
|
key: "shouldShowGiveKudos",
|
|
72
72
|
value: function shouldShowGiveKudos() {
|
|
73
|
-
var _this$tcClient4, _this$tcClient5;
|
|
73
|
+
var _this$tcClient4, _this$tcClient5, _this$tcClient6;
|
|
74
74
|
|
|
75
75
|
// Check if the kudos feature enabled and if the user has TC
|
|
76
76
|
// if the user does not have TC the tc client will be undefined.
|
|
77
|
-
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);
|
|
77
|
+
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);
|
|
78
78
|
}
|
|
79
79
|
}]);
|
|
80
80
|
return ProfileCardClient;
|
|
@@ -38,11 +38,12 @@ var buildReportingLinesQuery = function buildReportingLinesQuery(aaid) {
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
var buildCheckFeatureFlagQuery = function buildCheckFeatureFlagQuery(featureKey) {
|
|
41
|
+
var buildCheckFeatureFlagQuery = function buildCheckFeatureFlagQuery(featureKey, context) {
|
|
42
42
|
return {
|
|
43
|
-
query: "\n query isFeatureKeyEnabled($featureKey: String
|
|
43
|
+
query: "\n query isFeatureKeyEnabled($featureKey: String!, $context: [IsFeatureEnabledContextInput]) {\n isFeatureEnabled(featureKey: $featureKey, context: $context) {\n enabled\n }\n }\n ",
|
|
44
44
|
variables: {
|
|
45
|
-
featureKey: featureKey
|
|
45
|
+
featureKey: featureKey,
|
|
46
|
+
context: context
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
};
|
|
@@ -74,7 +75,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
74
75
|
(0, _createClass2.default)(TeamCentralCardClient, [{
|
|
75
76
|
key: "makeFeatureFlagCheckRequest",
|
|
76
77
|
value: function () {
|
|
77
|
-
var _makeFeatureFlagCheckRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(featureKey) {
|
|
78
|
+
var _makeFeatureFlagCheckRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(featureKey, context) {
|
|
78
79
|
var query, response;
|
|
79
80
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
80
81
|
while (1) {
|
|
@@ -88,7 +89,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
88
89
|
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
89
90
|
|
|
90
91
|
case 2:
|
|
91
|
-
query = buildCheckFeatureFlagQuery(featureKey);
|
|
92
|
+
query = buildCheckFeatureFlagQuery(featureKey, context);
|
|
92
93
|
_context.next = 5;
|
|
93
94
|
return (0, _graphqlUtils.graphqlQuery)(this.options.teamCentralUrl, query);
|
|
94
95
|
|
|
@@ -104,7 +105,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
104
105
|
}, _callee, this);
|
|
105
106
|
}));
|
|
106
107
|
|
|
107
|
-
function makeFeatureFlagCheckRequest(_x) {
|
|
108
|
+
function makeFeatureFlagCheckRequest(_x, _x2) {
|
|
108
109
|
return _makeFeatureFlagCheckRequest.apply(this, arguments);
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -143,7 +144,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
143
144
|
}, _callee2, this);
|
|
144
145
|
}));
|
|
145
146
|
|
|
146
|
-
function makeRequest(
|
|
147
|
+
function makeRequest(_x3) {
|
|
147
148
|
return _makeRequest.apply(this, arguments);
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -197,7 +198,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
197
198
|
}
|
|
198
199
|
}, {
|
|
199
200
|
key: "getFlagEnabled",
|
|
200
|
-
value: function getFlagEnabled(featureKey) {
|
|
201
|
+
value: function getFlagEnabled(featureKey, productIdentifier) {
|
|
201
202
|
var _this3 = this;
|
|
202
203
|
|
|
203
204
|
if (!featureKey) {
|
|
@@ -212,8 +213,12 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
212
213
|
return Promise.resolve(false);
|
|
213
214
|
}
|
|
214
215
|
|
|
216
|
+
var context = [{
|
|
217
|
+
key: 'productIdentifier',
|
|
218
|
+
value: productIdentifier || 'unset'
|
|
219
|
+
}];
|
|
215
220
|
return new Promise(function (resolve) {
|
|
216
|
-
_this3.makeFeatureFlagCheckRequest(featureKey).then(function (enabled) {
|
|
221
|
+
_this3.makeFeatureFlagCheckRequest(featureKey, context).then(function (enabled) {
|
|
217
222
|
_this3.featureFlagKeys.set(featureKey, enabled);
|
|
218
223
|
|
|
219
224
|
resolve(enabled);
|
|
@@ -89,13 +89,41 @@ var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
89
89
|
_this.props.analytics(id, options);
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "kudosUrl", function () {
|
|
93
|
+
var recipientId = _this.props.userId && "&recipientId=".concat(_this.props.userId) || '';
|
|
94
|
+
var cloudId = _this.props.cloudId && "&cloudId=".concat(_this.props.cloudId) || '';
|
|
95
|
+
return "".concat(_this.props.teamCentralBaseUrl, "/kudos/give?type=individual").concat(recipientId).concat(cloudId);
|
|
96
|
+
});
|
|
97
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "kudosButtonCallback", function () {
|
|
98
|
+
if (_this.props.openKudosDrawer) {
|
|
99
|
+
_this.props.openKudosDrawer();
|
|
95
100
|
} else {
|
|
96
|
-
window.open(
|
|
101
|
+
window.open(_this.kudosUrl());
|
|
97
102
|
}
|
|
98
103
|
});
|
|
104
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderButton", function (action, idx) {
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
|
|
106
|
+
appearance: idx === 0 ? 'default' : 'subtle',
|
|
107
|
+
key: action.id || idx,
|
|
108
|
+
onClick: function onClick(event) {
|
|
109
|
+
_this.callAnalytics(_analytics.AnalyticsName.PROFILE_CARD_CLICK, {
|
|
110
|
+
id: action.id || null,
|
|
111
|
+
duration: _this.durationSince(_this.timeOpen)
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (action.callback && (0, _click.isBasicClick)(event)) {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
|
|
117
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
118
|
+
args[_key - 1] = arguments[_key];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
action.callback.apply(action, [event].concat(args));
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
href: action.link
|
|
125
|
+
}, action.label);
|
|
126
|
+
});
|
|
99
127
|
_this.timeOpen = null;
|
|
100
128
|
|
|
101
129
|
_this.clientFetchProfile = function () {
|
|
@@ -135,9 +163,9 @@ var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
135
163
|
label: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.default.giveKudosButton),
|
|
136
164
|
id: 'give-kudos',
|
|
137
165
|
callback: function callback() {
|
|
138
|
-
_this3.
|
|
166
|
+
_this3.kudosButtonCallback();
|
|
139
167
|
},
|
|
140
|
-
link: this.
|
|
168
|
+
link: this.kudosUrl()
|
|
141
169
|
};
|
|
142
170
|
return actions.concat([kudosAction]);
|
|
143
171
|
}
|
|
@@ -155,27 +183,7 @@ var Profilecard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
155
183
|
|
|
156
184
|
var actions = this.getActions();
|
|
157
185
|
return /*#__PURE__*/_react.default.createElement(_Card.ActionButtonGroup, null, actions.map(function (action, idx) {
|
|
158
|
-
return
|
|
159
|
-
appearance: idx === 0 ? 'default' : 'subtle',
|
|
160
|
-
key: action.id || idx,
|
|
161
|
-
onClick: function onClick(event) {
|
|
162
|
-
_this4.callAnalytics(_analytics.AnalyticsName.PROFILE_CARD_CLICK, {
|
|
163
|
-
id: action.id || null,
|
|
164
|
-
duration: _this4.durationSince(_this4.timeOpen)
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
if (action.callback && (0, _click.isBasicClick)(event)) {
|
|
168
|
-
event.preventDefault();
|
|
169
|
-
|
|
170
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
171
|
-
args[_key - 1] = arguments[_key];
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
action.callback.apply(action, [event].concat(args));
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
href: action.link
|
|
178
|
-
}, action.label);
|
|
186
|
+
return _this4.renderButton(action, idx);
|
|
179
187
|
}));
|
|
180
188
|
}
|
|
181
189
|
}, {
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
@@ -9,6 +11,8 @@ exports.default = void 0;
|
|
|
9
11
|
|
|
10
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
13
|
|
|
14
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
+
|
|
12
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
17
|
|
|
14
18
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -23,7 +27,9 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
23
27
|
|
|
24
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
29
|
|
|
26
|
-
var _react =
|
|
30
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
31
|
+
|
|
32
|
+
var _giveKudos = require("@atlaskit/give-kudos");
|
|
27
33
|
|
|
28
34
|
var _analytics = require("../../internal/analytics");
|
|
29
35
|
|
|
@@ -37,6 +43,10 @@ var _ProfileCard = _interopRequireDefault(require("./ProfileCard"));
|
|
|
37
43
|
|
|
38
44
|
var _UserLoadingState = _interopRequireDefault(require("./UserLoadingState"));
|
|
39
45
|
|
|
46
|
+
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); }
|
|
47
|
+
|
|
48
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
|
+
|
|
40
50
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
51
|
|
|
42
52
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -67,7 +77,9 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
67
77
|
hasError: false,
|
|
68
78
|
error: null,
|
|
69
79
|
data: null,
|
|
70
|
-
reportingLinesData: undefined
|
|
80
|
+
reportingLinesData: undefined,
|
|
81
|
+
isKudosEnabled: false,
|
|
82
|
+
kudosDrawerOpen: false
|
|
71
83
|
});
|
|
72
84
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callAnalytics", function (id) {
|
|
73
85
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -93,9 +105,11 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
93
105
|
hasError: false,
|
|
94
106
|
data: null
|
|
95
107
|
}, function () {
|
|
96
|
-
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId), _this.props.resourceClient.getReportingLines(userId)]);
|
|
108
|
+
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos()]);
|
|
97
109
|
requests.then(function (res) {
|
|
98
|
-
|
|
110
|
+
var _this2;
|
|
111
|
+
|
|
112
|
+
return (_this2 = _this).handleClientSuccess.apply(_this2, (0, _toConsumableArray2.default)(res));
|
|
99
113
|
}, function (err) {
|
|
100
114
|
return _this.handleClientError(err);
|
|
101
115
|
}).catch(function (err) {
|
|
@@ -106,6 +120,16 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
106
120
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "filterActions", function () {
|
|
107
121
|
return (0, _filterActions.default)(_this.props.actions, _this.state.data);
|
|
108
122
|
});
|
|
123
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openKudosDrawer", function () {
|
|
124
|
+
_this.setState({
|
|
125
|
+
kudosDrawerOpen: true
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeKudosDrawer", function () {
|
|
129
|
+
_this.setState({
|
|
130
|
+
kudosDrawerOpen: false
|
|
131
|
+
});
|
|
132
|
+
});
|
|
109
133
|
return _this;
|
|
110
134
|
}
|
|
111
135
|
|
|
@@ -141,7 +165,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
141
165
|
}
|
|
142
166
|
}, {
|
|
143
167
|
key: "handleClientSuccess",
|
|
144
|
-
value: function handleClientSuccess(profileData, reportingLinesData) {
|
|
168
|
+
value: function handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
145
169
|
if (!this._isMounted) {
|
|
146
170
|
return;
|
|
147
171
|
}
|
|
@@ -150,7 +174,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
150
174
|
isLoading: false,
|
|
151
175
|
hasError: false,
|
|
152
176
|
data: profileData,
|
|
153
|
-
reportingLinesData: reportingLinesData
|
|
177
|
+
reportingLinesData: reportingLinesData,
|
|
178
|
+
isKudosEnabled: shouldShowGiveKudos
|
|
154
179
|
});
|
|
155
180
|
}
|
|
156
181
|
}, {
|
|
@@ -174,10 +199,14 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
174
199
|
hasError = _this$state.hasError,
|
|
175
200
|
error = _this$state.error,
|
|
176
201
|
data = _this$state.data,
|
|
177
|
-
reportingLinesData = _this$state.reportingLinesData
|
|
202
|
+
reportingLinesData = _this$state.reportingLinesData,
|
|
203
|
+
isKudosEnabled = _this$state.isKudosEnabled;
|
|
178
204
|
var _this$props3 = this.props,
|
|
179
205
|
analytics = _this$props3.analytics,
|
|
180
|
-
onReportingLinesClick = _this$props3.onReportingLinesClick
|
|
206
|
+
onReportingLinesClick = _this$props3.onReportingLinesClick,
|
|
207
|
+
cloudId = _this$props3.cloudId,
|
|
208
|
+
userId = _this$props3.userId,
|
|
209
|
+
addFlag = _this$props3.addFlag;
|
|
181
210
|
var isFetchingOrNotStartToFetchYet = isLoading === true || isLoading === undefined;
|
|
182
211
|
|
|
183
212
|
if (isFetchingOrNotStartToFetchYet) {
|
|
@@ -189,18 +218,39 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
189
218
|
}));
|
|
190
219
|
}
|
|
191
220
|
|
|
192
|
-
var newProps = _objectSpread({
|
|
221
|
+
var newProps = _objectSpread(_objectSpread({
|
|
193
222
|
hasError: hasError,
|
|
194
223
|
errorType: error,
|
|
195
224
|
clientFetchProfile: this.clientFetchProfile,
|
|
196
225
|
analytics: analytics,
|
|
197
226
|
reportingLines: reportingLinesData,
|
|
198
|
-
onReportingLinesClick: onReportingLinesClick
|
|
199
|
-
|
|
227
|
+
onReportingLinesClick: onReportingLinesClick,
|
|
228
|
+
cloudId: cloudId,
|
|
229
|
+
userId: userId,
|
|
230
|
+
addFlag: addFlag
|
|
231
|
+
}, data), {}, {
|
|
232
|
+
isKudosEnabled: isKudosEnabled,
|
|
233
|
+
teamCentralBaseUrl: this.props.resourceClient.getTeamCentralBaseUrl(),
|
|
234
|
+
openKudosDrawer: this.openKudosDrawer
|
|
235
|
+
});
|
|
200
236
|
|
|
201
|
-
return /*#__PURE__*/_react.default.createElement(_Card.CardWrapper, null, /*#__PURE__*/_react.default.createElement(
|
|
237
|
+
return /*#__PURE__*/_react.default.createElement(_Card.CardWrapper, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isKudosEnabled && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
238
|
+
fallback: null
|
|
239
|
+
}, /*#__PURE__*/_react.default.createElement(_giveKudos.GiveKudosLauncherLazy, {
|
|
240
|
+
isOpen: this.state.kudosDrawerOpen,
|
|
241
|
+
recipient: {
|
|
242
|
+
type: _giveKudos.KudosType.INDIVIDUAL,
|
|
243
|
+
recipientId: this.props.userId
|
|
244
|
+
},
|
|
245
|
+
analytics: this.props.analytics,
|
|
246
|
+
analyticsSource: "profile-card",
|
|
247
|
+
teamCentralBaseUrl: newProps.teamCentralBaseUrl,
|
|
248
|
+
cloudId: this.props.cloudId,
|
|
249
|
+
addFlag: this.props.addFlag,
|
|
250
|
+
onClose: this.closeKudosDrawer
|
|
251
|
+
})), /*#__PURE__*/_react.default.createElement(_ProfileCard.default, (0, _extends2.default)({}, newProps, {
|
|
202
252
|
actions: this.filterActions()
|
|
203
|
-
})));
|
|
253
|
+
}))));
|
|
204
254
|
}
|
|
205
255
|
}]);
|
|
206
256
|
return ProfileCardResourced;
|
|
@@ -31,6 +31,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
31
31
|
|
|
32
32
|
var _react = _interopRequireWildcard(require("react"));
|
|
33
33
|
|
|
34
|
+
var _giveKudos = require("@atlaskit/give-kudos");
|
|
35
|
+
|
|
34
36
|
var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
35
37
|
|
|
36
38
|
var _constants = require("@atlaskit/theme/constants");
|
|
@@ -127,7 +129,8 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
127
129
|
data: null,
|
|
128
130
|
reportingLinesData: undefined,
|
|
129
131
|
shouldShowGiveKudos: false,
|
|
130
|
-
teamCentralBaseUrl: undefined
|
|
132
|
+
teamCentralBaseUrl: undefined,
|
|
133
|
+
kudosDrawerOpen: false
|
|
131
134
|
});
|
|
132
135
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clientFetchProfile", function () {
|
|
133
136
|
var _this$props = _this.props,
|
|
@@ -161,6 +164,18 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
161
164
|
});
|
|
162
165
|
});
|
|
163
166
|
});
|
|
167
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openKudosDrawer", function () {
|
|
168
|
+
_this.hideProfilecard();
|
|
169
|
+
|
|
170
|
+
_this.setState({
|
|
171
|
+
kudosDrawerOpen: true
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeKudosDrawer", function () {
|
|
175
|
+
_this.setState({
|
|
176
|
+
kudosDrawerOpen: false
|
|
177
|
+
});
|
|
178
|
+
});
|
|
164
179
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderCard", function () {
|
|
165
180
|
var isLoading = _this.state.isLoading;
|
|
166
181
|
|
|
@@ -247,7 +262,9 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
247
262
|
reportingLines: this.state.reportingLinesData,
|
|
248
263
|
onReportingLinesClick: this.props.onReportingLinesClick,
|
|
249
264
|
isKudosEnabled: this.state.shouldShowGiveKudos,
|
|
250
|
-
teamCentralBaseUrl: this.state.teamCentralBaseUrl
|
|
265
|
+
teamCentralBaseUrl: this.state.teamCentralBaseUrl,
|
|
266
|
+
cloudId: this.props.cloudId,
|
|
267
|
+
openKudosDrawer: this.openKudosDrawer
|
|
251
268
|
});
|
|
252
269
|
|
|
253
270
|
var wrapperProps = this.props.trigger === 'hover' ? {
|
|
@@ -268,7 +285,7 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
268
285
|
value: function renderWithTrigger() {
|
|
269
286
|
var _this3 = this;
|
|
270
287
|
|
|
271
|
-
return /*#__PURE__*/_react.default.createElement(_popup.default, {
|
|
288
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_popup.default, {
|
|
272
289
|
isOpen: !!this.state.visible,
|
|
273
290
|
onClose: this.hideProfilecard,
|
|
274
291
|
placement: this.props.position,
|
|
@@ -283,7 +300,21 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
283
300
|
},
|
|
284
301
|
zIndex: _constants.layers.modal(),
|
|
285
302
|
shouldUseCaptureOnOutsideClick: true
|
|
286
|
-
})
|
|
303
|
+
}), this.state.shouldShowGiveKudos && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
304
|
+
fallback: null
|
|
305
|
+
}, /*#__PURE__*/_react.default.createElement(_giveKudos.GiveKudosLauncherLazy, {
|
|
306
|
+
isOpen: this.state.kudosDrawerOpen,
|
|
307
|
+
recipient: {
|
|
308
|
+
type: _giveKudos.KudosType.INDIVIDUAL,
|
|
309
|
+
recipientId: this.props.userId
|
|
310
|
+
},
|
|
311
|
+
analytics: this.props.analytics,
|
|
312
|
+
analyticsSource: "profile-card",
|
|
313
|
+
teamCentralBaseUrl: this.state.teamCentralBaseUrl,
|
|
314
|
+
cloudId: this.props.cloudId,
|
|
315
|
+
addFlag: this.props.addFlag,
|
|
316
|
+
onClose: this.closeKudosDrawer
|
|
317
|
+
})));
|
|
287
318
|
}
|
|
288
319
|
}, {
|
|
289
320
|
key: "render",
|
|
@@ -114,6 +114,11 @@ function getMockProfileClient(BaseProfileClient, modifyResponse) {
|
|
|
114
114
|
}, timeout);
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "getFlagEnabled",
|
|
119
|
+
value: function getFlagEnabled(featureKey) {
|
|
120
|
+
return Promise.resolve(true);
|
|
121
|
+
}
|
|
117
122
|
}]);
|
|
118
123
|
return MockTeamCentralClient;
|
|
119
124
|
}(_TeamCentralCardClient.default);
|
package/dist/cjs/styled/Card.js
CHANGED
|
@@ -43,7 +43,7 @@ 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
|
|
|
@@ -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.
|
|
59
|
+
packageVersion: "16.6.0"
|
|
60
60
|
}, attributes), {}, {
|
|
61
61
|
firedAt: (0, _performance.getPageTime)()
|
|
62
62
|
})
|
package/dist/cjs/version.json
CHANGED
|
@@ -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
|
|
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 => {
|
|
@@ -37,14 +37,39 @@ export default class Profilecard extends React.PureComponent {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
_defineProperty(this, "
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
_defineProperty(this, "kudosUrl", () => {
|
|
41
|
+
const recipientId = this.props.userId && `&recipientId=${this.props.userId}` || '';
|
|
42
|
+
const cloudId = this.props.cloudId && `&cloudId=${this.props.cloudId}` || '';
|
|
43
|
+
return `${this.props.teamCentralBaseUrl}/kudos/give?type=individual${recipientId}${cloudId}`;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
_defineProperty(this, "kudosButtonCallback", () => {
|
|
47
|
+
if (this.props.openKudosDrawer) {
|
|
48
|
+
this.props.openKudosDrawer();
|
|
43
49
|
} else {
|
|
44
|
-
window.open(
|
|
50
|
+
window.open(this.kudosUrl());
|
|
45
51
|
}
|
|
46
52
|
});
|
|
47
53
|
|
|
54
|
+
_defineProperty(this, "renderButton", (action, idx) => {
|
|
55
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
56
|
+
appearance: idx === 0 ? 'default' : 'subtle',
|
|
57
|
+
key: action.id || idx,
|
|
58
|
+
onClick: (event, ...args) => {
|
|
59
|
+
this.callAnalytics(AnalyticsName.PROFILE_CARD_CLICK, {
|
|
60
|
+
id: action.id || null,
|
|
61
|
+
duration: this.durationSince(this.timeOpen)
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (action.callback && isBasicClick(event)) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
action.callback(event, ...args);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
href: action.link
|
|
70
|
+
}, action.label);
|
|
71
|
+
});
|
|
72
|
+
|
|
48
73
|
this.timeOpen = null;
|
|
49
74
|
|
|
50
75
|
this.clientFetchProfile = (...args) => {
|
|
@@ -73,9 +98,9 @@ export default class Profilecard extends React.PureComponent {
|
|
|
73
98
|
label: /*#__PURE__*/React.createElement(FormattedMessage, messages.giveKudosButton),
|
|
74
99
|
id: 'give-kudos',
|
|
75
100
|
callback: () => {
|
|
76
|
-
this.
|
|
101
|
+
this.kudosButtonCallback();
|
|
77
102
|
},
|
|
78
|
-
link: this.
|
|
103
|
+
link: this.kudosUrl()
|
|
79
104
|
};
|
|
80
105
|
return actions.concat([kudosAction]);
|
|
81
106
|
}
|
|
@@ -89,22 +114,7 @@ export default class Profilecard extends React.PureComponent {
|
|
|
89
114
|
}
|
|
90
115
|
|
|
91
116
|
const actions = this.getActions();
|
|
92
|
-
return /*#__PURE__*/React.createElement(ActionButtonGroup, null, actions.map((action, idx) =>
|
|
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)));
|
|
117
|
+
return /*#__PURE__*/React.createElement(ActionButtonGroup, null, actions.map((action, idx) => this.renderButton(action, idx)));
|
|
108
118
|
}
|
|
109
119
|
|
|
110
120
|
renderCardDetailsDefault() {
|