@atlaskit/profilecard 18.2.2 → 18.2.4
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 +12 -0
- package/dist/cjs/client/CachingClient.js +8 -22
- package/dist/cjs/client/ProfileCardClient.js +0 -18
- package/dist/cjs/client/TeamCentralCardClient.js +2 -55
- package/dist/cjs/client/TeamProfileCardClient.js +0 -36
- package/dist/cjs/client/UserProfileCardClient.js +1 -46
- package/dist/cjs/client/errorUtils.js +4 -6
- package/dist/cjs/client/getTeamFromAGG.js +0 -23
- package/dist/cjs/client/graphqlUtils.js +1 -7
- package/dist/cjs/client/index.js +0 -9
- package/dist/cjs/components/Error/ErrorBoundary.js +0 -14
- package/dist/cjs/components/Error/ErrorIllustration.js +1 -4
- package/dist/cjs/components/Error/ErrorMessage.js +1 -15
- package/dist/cjs/components/Error/index.js +0 -4
- package/dist/cjs/components/Icon/IconLabel.js +2 -23
- package/dist/cjs/components/Icon/index.js +0 -2
- package/dist/cjs/components/Team/TeamLoadingState.js +0 -10
- package/dist/cjs/components/Team/TeamProfileCard.js +29 -87
- package/dist/cjs/components/Team/TeamProfileCardTrigger.js +19 -85
- package/dist/cjs/components/Team/index.js +0 -4
- package/dist/cjs/components/Team/lazyTeamProfileCard.js +0 -6
- package/dist/cjs/components/User/OverflowProfileCardButtons.js +7 -30
- package/dist/cjs/components/User/ProfileCard.js +11 -57
- package/dist/cjs/components/User/ProfileCardDetails.js +11 -40
- package/dist/cjs/components/User/ProfileCardResourced.js +15 -61
- package/dist/cjs/components/User/ProfileCardTrigger.js +8 -63
- package/dist/cjs/components/User/ReportingLinesDetails.js +7 -23
- package/dist/cjs/components/User/UserLoadingState.js +0 -10
- package/dist/cjs/components/User/index.js +0 -5
- package/dist/cjs/components/User/lazyProfileCard.js +0 -6
- package/dist/cjs/i18n/cs.js +0 -1
- package/dist/cjs/i18n/da.js +0 -1
- package/dist/cjs/i18n/de.js +0 -1
- package/dist/cjs/i18n/en.js +0 -1
- package/dist/cjs/i18n/en_GB.js +0 -1
- package/dist/cjs/i18n/en_ZZ.js +0 -1
- package/dist/cjs/i18n/es.js +0 -1
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +0 -1
- package/dist/cjs/i18n/fr.js +0 -1
- package/dist/cjs/i18n/hu.js +0 -1
- package/dist/cjs/i18n/index.js +0 -31
- package/dist/cjs/i18n/is.js +0 -1
- package/dist/cjs/i18n/it.js +0 -1
- package/dist/cjs/i18n/ja.js +0 -1
- package/dist/cjs/i18n/ko.js +0 -1
- package/dist/cjs/i18n/languages.js +0 -1
- package/dist/cjs/i18n/nb.js +0 -1
- package/dist/cjs/i18n/nl.js +0 -1
- package/dist/cjs/i18n/pl.js +0 -1
- package/dist/cjs/i18n/pt_BR.js +0 -1
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ro.js +0 -1
- package/dist/cjs/i18n/ru.js +0 -1
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +0 -1
- package/dist/cjs/i18n/th.js +0 -1
- package/dist/cjs/i18n/tr.js +0 -1
- package/dist/cjs/i18n/uk.js +0 -1
- package/dist/cjs/i18n/vi.js +0 -1
- package/dist/cjs/i18n/zh.js +0 -1
- package/dist/cjs/i18n/zh_TW.js +0 -1
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/internal/filterActions.js +0 -3
- package/dist/cjs/internal/relative-date.js +0 -15
- package/dist/cjs/messages.js +0 -2
- package/dist/cjs/mocks/index.js +0 -5
- package/dist/cjs/mocks/mock-profile-client.js +0 -34
- package/dist/cjs/mocks/mock-team-client.js +0 -16
- package/dist/cjs/mocks/profile-data.js +0 -5
- package/dist/cjs/mocks/reporting-lines-data.js +0 -4
- package/dist/cjs/mocks/simple-mock-clients.js +0 -28
- package/dist/cjs/mocks/team-data.js +7 -12
- package/dist/cjs/mocks/util.js +0 -7
- package/dist/cjs/styled/Card.js +0 -53
- package/dist/cjs/styled/Error.js +0 -18
- package/dist/cjs/styled/ReportingLines.js +0 -16
- package/dist/cjs/styled/TeamCard.js +3 -35
- package/dist/cjs/styled/constants.js +0 -2
- package/dist/cjs/util/analytics.js +1 -36
- package/dist/cjs/util/click.js +0 -2
- package/dist/cjs/util/performance.js +0 -5
- package/dist/cjs/util/withOuterListeners.js +0 -24
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/CachingClient.js +10 -17
- package/dist/es2019/client/ProfileCardClient.js +2 -16
- package/dist/es2019/client/TeamCentralCardClient.js +2 -34
- package/dist/es2019/client/TeamProfileCardClient.js +0 -16
- package/dist/es2019/client/UserProfileCardClient.js +4 -18
- package/dist/es2019/client/errorUtils.js +4 -5
- package/dist/es2019/client/getTeamFromAGG.js +2 -2
- package/dist/es2019/client/graphqlUtils.js +1 -6
- package/dist/es2019/components/Error/ErrorBoundary.js +0 -2
- package/dist/es2019/components/Error/ErrorMessage.js +0 -5
- package/dist/es2019/components/Icon/IconLabel.js +2 -4
- package/dist/es2019/components/Team/TeamProfileCard.js +5 -29
- package/dist/es2019/components/Team/TeamProfileCardTrigger.js +2 -54
- package/dist/es2019/components/Team/lazyTeamProfileCard.js +1 -2
- package/dist/es2019/components/User/OverflowProfileCardButtons.js +0 -1
- package/dist/es2019/components/User/ProfileCard.js +0 -16
- package/dist/es2019/components/User/ProfileCardDetails.js +0 -12
- package/dist/es2019/components/User/ProfileCardResourced.js +0 -25
- package/dist/es2019/components/User/ProfileCardTrigger.js +2 -40
- package/dist/es2019/components/User/ReportingLinesDetails.js +0 -7
- package/dist/es2019/components/User/UserLoadingState.js +0 -2
- package/dist/es2019/components/User/lazyProfileCard.js +1 -2
- package/dist/es2019/index.js +6 -5
- package/dist/es2019/internal/filterActions.js +0 -2
- package/dist/es2019/internal/relative-date.js +0 -7
- package/dist/es2019/mocks/mock-profile-client.js +4 -13
- package/dist/es2019/mocks/mock-team-client.js +0 -5
- package/dist/es2019/mocks/profile-data.js +0 -1
- package/dist/es2019/mocks/simple-mock-clients.js +2 -6
- package/dist/es2019/mocks/team-data.js +0 -1
- package/dist/es2019/mocks/util.js +0 -1
- package/dist/es2019/styled/Card.js +0 -2
- package/dist/es2019/styled/TeamCard.js +4 -1
- package/dist/es2019/util/analytics.js +2 -10
- package/dist/es2019/util/performance.js +0 -2
- package/dist/es2019/util/withOuterListeners.js +0 -10
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/CachingClient.js +8 -20
- package/dist/esm/client/ProfileCardClient.js +0 -14
- package/dist/esm/client/TeamCentralCardClient.js +2 -48
- package/dist/esm/client/TeamProfileCardClient.js +0 -25
- package/dist/esm/client/UserProfileCardClient.js +2 -33
- package/dist/esm/client/errorUtils.js +4 -5
- package/dist/esm/client/getTeamFromAGG.js +0 -8
- package/dist/esm/client/graphqlUtils.js +1 -6
- package/dist/esm/components/Error/ErrorBoundary.js +0 -8
- package/dist/esm/components/Error/ErrorMessage.js +1 -6
- package/dist/esm/components/Icon/IconLabel.js +2 -13
- package/dist/esm/components/Team/TeamProfileCard.js +29 -61
- package/dist/esm/components/Team/TeamProfileCardTrigger.js +19 -83
- package/dist/esm/components/Team/lazyTeamProfileCard.js +1 -2
- package/dist/esm/components/User/OverflowProfileCardButtons.js +7 -12
- package/dist/esm/components/User/ProfileCard.js +11 -31
- package/dist/esm/components/User/ProfileCardDetails.js +11 -26
- package/dist/esm/components/User/ProfileCardResourced.js +15 -48
- package/dist/esm/components/User/ProfileCardTrigger.js +8 -57
- package/dist/esm/components/User/ReportingLinesDetails.js +7 -14
- package/dist/esm/components/User/UserLoadingState.js +0 -2
- package/dist/esm/components/User/lazyProfileCard.js +1 -2
- package/dist/esm/index.js +6 -5
- package/dist/esm/internal/filterActions.js +0 -2
- package/dist/esm/internal/relative-date.js +0 -8
- package/dist/esm/mocks/mock-profile-client.js +0 -28
- package/dist/esm/mocks/mock-team-client.js +0 -11
- package/dist/esm/mocks/profile-data.js +0 -1
- package/dist/esm/mocks/simple-mock-clients.js +0 -20
- package/dist/esm/mocks/team-data.js +7 -8
- package/dist/esm/mocks/util.js +0 -1
- package/dist/esm/styled/Card.js +0 -4
- package/dist/esm/styled/Error.js +0 -2
- package/dist/esm/styled/ReportingLines.js +0 -2
- package/dist/esm/styled/TeamCard.js +4 -3
- package/dist/esm/util/analytics.js +2 -13
- package/dist/esm/util/performance.js +0 -2
- package/dist/esm/util/withOuterListeners.js +0 -17
- package/dist/esm/version.json +1 -1
- package/package.json +8 -4
|
@@ -7,15 +7,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
|
|
11
10
|
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; }
|
|
12
|
-
|
|
13
11
|
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) { _defineProperty(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; }
|
|
14
|
-
|
|
15
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
-
|
|
17
13
|
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; } }
|
|
18
|
-
|
|
19
14
|
import React, { Suspense } from 'react';
|
|
20
15
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
21
16
|
import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
@@ -25,25 +20,17 @@ import { fireEvent } from '../../util/analytics';
|
|
|
25
20
|
import { ErrorMessage } from '../Error';
|
|
26
21
|
import ProfileCard from './ProfileCard';
|
|
27
22
|
import UserLoadingState from './UserLoadingState';
|
|
28
|
-
|
|
29
23
|
var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
30
24
|
_inherits(ProfileCardResourced, _React$PureComponent);
|
|
31
|
-
|
|
32
25
|
var _super = _createSuper(ProfileCardResourced);
|
|
33
|
-
|
|
34
26
|
function ProfileCardResourced() {
|
|
35
27
|
var _this;
|
|
36
|
-
|
|
37
28
|
_classCallCheck(this, ProfileCardResourced);
|
|
38
|
-
|
|
39
29
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
40
30
|
args[_key] = arguments[_key];
|
|
41
31
|
}
|
|
42
|
-
|
|
43
32
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
44
|
-
|
|
45
33
|
_defineProperty(_assertThisInitialized(_this), "_isMounted", false);
|
|
46
|
-
|
|
47
34
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
48
35
|
visible: false,
|
|
49
36
|
isLoading: undefined,
|
|
@@ -54,29 +41,24 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
54
41
|
isKudosEnabled: false,
|
|
55
42
|
kudosDrawerOpen: false
|
|
56
43
|
});
|
|
57
|
-
|
|
58
44
|
_defineProperty(_assertThisInitialized(_this), "fireAnalytics", function (payload) {
|
|
59
45
|
// Don't fire analytics if the component is unmounted
|
|
60
46
|
if (!_this._isMounted) {
|
|
61
47
|
return;
|
|
62
48
|
}
|
|
63
|
-
|
|
64
49
|
if (_this.props.createAnalyticsEvent) {
|
|
65
50
|
fireEvent(_this.props.createAnalyticsEvent, payload);
|
|
66
51
|
}
|
|
67
52
|
});
|
|
68
|
-
|
|
69
53
|
_defineProperty(_assertThisInitialized(_this), "clientFetchProfile", function () {
|
|
70
54
|
var _this$props = _this.props,
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
cloudId = _this$props.cloudId,
|
|
56
|
+
userId = _this$props.userId;
|
|
73
57
|
var isLoading = _this.state.isLoading;
|
|
74
|
-
|
|
75
58
|
if (isLoading === true) {
|
|
76
59
|
// don't fetch data when fetching is in process
|
|
77
60
|
return;
|
|
78
61
|
}
|
|
79
|
-
|
|
80
62
|
_this.setState({
|
|
81
63
|
isLoading: true,
|
|
82
64
|
hasError: false,
|
|
@@ -85,7 +67,6 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
85
67
|
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos()]);
|
|
86
68
|
requests.then(function (res) {
|
|
87
69
|
var _this2;
|
|
88
|
-
|
|
89
70
|
return (_this2 = _this).handleClientSuccess.apply(_this2, _toConsumableArray(res));
|
|
90
71
|
}, function (err) {
|
|
91
72
|
return _this.handleClientError(err);
|
|
@@ -94,26 +75,21 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
94
75
|
});
|
|
95
76
|
});
|
|
96
77
|
});
|
|
97
|
-
|
|
98
78
|
_defineProperty(_assertThisInitialized(_this), "filterActions", function () {
|
|
99
79
|
return filterActions(_this.props.actions, _this.state.data);
|
|
100
80
|
});
|
|
101
|
-
|
|
102
81
|
_defineProperty(_assertThisInitialized(_this), "openKudosDrawer", function () {
|
|
103
82
|
_this.setState({
|
|
104
83
|
kudosDrawerOpen: true
|
|
105
84
|
});
|
|
106
85
|
});
|
|
107
|
-
|
|
108
86
|
_defineProperty(_assertThisInitialized(_this), "closeKudosDrawer", function () {
|
|
109
87
|
_this.setState({
|
|
110
88
|
kudosDrawerOpen: false
|
|
111
89
|
});
|
|
112
90
|
});
|
|
113
|
-
|
|
114
91
|
return _this;
|
|
115
92
|
}
|
|
116
|
-
|
|
117
93
|
_createClass(ProfileCardResourced, [{
|
|
118
94
|
key: "componentDidMount",
|
|
119
95
|
value: function componentDidMount() {
|
|
@@ -124,10 +100,9 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
124
100
|
key: "componentDidUpdate",
|
|
125
101
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
126
102
|
var _this$props2 = this.props,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
103
|
+
userId = _this$props2.userId,
|
|
104
|
+
cloudId = _this$props2.cloudId,
|
|
105
|
+
resourceClient = _this$props2.resourceClient;
|
|
131
106
|
if (userId !== prevProps.userId || cloudId !== prevProps.cloudId || resourceClient !== prevProps.resourceClient) {
|
|
132
107
|
this.setState({
|
|
133
108
|
isLoading: undefined
|
|
@@ -145,7 +120,6 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
145
120
|
if (!this._isMounted) {
|
|
146
121
|
return;
|
|
147
122
|
}
|
|
148
|
-
|
|
149
123
|
this.setState({
|
|
150
124
|
isLoading: false,
|
|
151
125
|
hasError: false,
|
|
@@ -160,7 +134,6 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
160
134
|
if (!this._isMounted) {
|
|
161
135
|
return;
|
|
162
136
|
}
|
|
163
|
-
|
|
164
137
|
this.setState({
|
|
165
138
|
isLoading: false,
|
|
166
139
|
hasError: true,
|
|
@@ -171,19 +144,18 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
171
144
|
key: "render",
|
|
172
145
|
value: function render() {
|
|
173
146
|
var _this$state = this.state,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
147
|
+
isLoading = _this$state.isLoading,
|
|
148
|
+
hasError = _this$state.hasError,
|
|
149
|
+
error = _this$state.error,
|
|
150
|
+
data = _this$state.data,
|
|
151
|
+
reportingLinesData = _this$state.reportingLinesData,
|
|
152
|
+
isKudosEnabled = _this$state.isKudosEnabled;
|
|
180
153
|
var _this$props3 = this.props,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
154
|
+
onReportingLinesClick = _this$props3.onReportingLinesClick,
|
|
155
|
+
cloudId = _this$props3.cloudId,
|
|
156
|
+
userId = _this$props3.userId,
|
|
157
|
+
addFlag = _this$props3.addFlag;
|
|
185
158
|
var isFetchingOrNotStartToFetchYet = isLoading === true || isLoading === undefined;
|
|
186
|
-
|
|
187
159
|
if (isFetchingOrNotStartToFetchYet) {
|
|
188
160
|
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(UserLoadingState, {
|
|
189
161
|
fireAnalytics: this.fireAnalytics
|
|
@@ -195,7 +167,6 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
195
167
|
fireAnalytics: this.fireAnalytics
|
|
196
168
|
}));
|
|
197
169
|
}
|
|
198
|
-
|
|
199
170
|
var newProps = _objectSpread(_objectSpread({
|
|
200
171
|
hasError: hasError,
|
|
201
172
|
errorType: error,
|
|
@@ -210,7 +181,6 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
210
181
|
teamCentralBaseUrl: this.props.resourceClient.getTeamCentralBaseUrl(),
|
|
211
182
|
openKudosDrawer: this.openKudosDrawer
|
|
212
183
|
});
|
|
213
|
-
|
|
214
184
|
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && /*#__PURE__*/React.createElement(Suspense, {
|
|
215
185
|
fallback: null
|
|
216
186
|
}, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
|
|
@@ -229,13 +199,10 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
229
199
|
}))));
|
|
230
200
|
}
|
|
231
201
|
}]);
|
|
232
|
-
|
|
233
202
|
return ProfileCardResourced;
|
|
234
203
|
}(React.PureComponent);
|
|
235
|
-
|
|
236
204
|
_defineProperty(ProfileCardResourced, "defaultProps", {
|
|
237
205
|
actions: []
|
|
238
206
|
});
|
|
239
|
-
|
|
240
207
|
export var ProfileCardResourcedInternal = ProfileCardResourced;
|
|
241
208
|
export default withAnalyticsEvents()(ProfileCardResourced);
|
|
@@ -9,15 +9,10 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
9
9
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
10
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
11
|
var _excluded = ["ref"];
|
|
12
|
-
|
|
13
12
|
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; }
|
|
14
|
-
|
|
15
13
|
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) { _defineProperty(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; }
|
|
16
|
-
|
|
17
14
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
18
|
-
|
|
19
15
|
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
|
-
|
|
21
16
|
import React, { Suspense } from 'react';
|
|
22
17
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
23
18
|
import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
@@ -29,44 +24,30 @@ import { cardTriggered, fireEvent } from '../../util/analytics';
|
|
|
29
24
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
|
|
30
25
|
import { ProfileCardLazy } from './lazyProfileCard';
|
|
31
26
|
import UserLoadingState from './UserLoadingState';
|
|
32
|
-
|
|
33
27
|
var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
34
28
|
_inherits(ProfilecardTrigger, _React$PureComponent);
|
|
35
|
-
|
|
36
29
|
var _super = _createSuper(ProfilecardTrigger);
|
|
37
|
-
|
|
38
30
|
function ProfilecardTrigger() {
|
|
39
31
|
var _this;
|
|
40
|
-
|
|
41
32
|
_classCallCheck(this, ProfilecardTrigger);
|
|
42
|
-
|
|
43
33
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
34
|
args[_key] = arguments[_key];
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
48
|
-
|
|
49
37
|
_defineProperty(_assertThisInitialized(_this), "_isMounted", false);
|
|
50
|
-
|
|
51
38
|
_defineProperty(_assertThisInitialized(_this), "showDelay", _this.props.trigger === 'click' ? 0 : DELAY_MS_SHOW);
|
|
52
|
-
|
|
53
39
|
_defineProperty(_assertThisInitialized(_this), "hideDelay", _this.props.trigger === 'click' ? 0 : DELAY_MS_HIDE);
|
|
54
|
-
|
|
55
40
|
_defineProperty(_assertThisInitialized(_this), "showTimer", 0);
|
|
56
|
-
|
|
57
41
|
_defineProperty(_assertThisInitialized(_this), "hideTimer", 0);
|
|
58
|
-
|
|
59
42
|
_defineProperty(_assertThisInitialized(_this), "fireAnalytics", function (payload) {
|
|
60
43
|
// Don't fire any analytics if the component is unmounted
|
|
61
44
|
if (!_this._isMounted) {
|
|
62
45
|
return;
|
|
63
46
|
}
|
|
64
|
-
|
|
65
47
|
if (_this.props.createAnalyticsEvent) {
|
|
66
48
|
fireEvent(_this.props.createAnalyticsEvent, payload);
|
|
67
49
|
}
|
|
68
50
|
});
|
|
69
|
-
|
|
70
51
|
_defineProperty(_assertThisInitialized(_this), "hideProfilecard", function () {
|
|
71
52
|
clearTimeout(_this.showTimer);
|
|
72
53
|
clearTimeout(_this.hideTimer);
|
|
@@ -76,54 +57,44 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
76
57
|
});
|
|
77
58
|
}, _this.hideDelay);
|
|
78
59
|
});
|
|
79
|
-
|
|
80
60
|
_defineProperty(_assertThisInitialized(_this), "showProfilecard", function () {
|
|
81
61
|
clearTimeout(_this.hideTimer);
|
|
82
62
|
clearTimeout(_this.showTimer);
|
|
83
63
|
_this.showTimer = window.setTimeout(function () {
|
|
84
64
|
if (!_this.state.visible) {
|
|
85
65
|
_this.clientFetchProfile();
|
|
86
|
-
|
|
87
66
|
_this.setState({
|
|
88
67
|
visible: true
|
|
89
68
|
});
|
|
90
69
|
}
|
|
91
70
|
}, _this.showDelay);
|
|
92
71
|
});
|
|
93
|
-
|
|
94
72
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (event) {
|
|
95
73
|
// If the user clicks on the trigger then we don't want that click event to
|
|
96
74
|
// propagate out to parent containers. For example when clicking a mention
|
|
97
75
|
// lozenge in an inline-edit.
|
|
98
76
|
event.stopPropagation();
|
|
99
|
-
|
|
100
77
|
_this.showProfilecard();
|
|
101
|
-
|
|
102
78
|
if (!_this.state.visible) {
|
|
103
79
|
_this.fireAnalytics(cardTriggered('user', 'click'));
|
|
104
80
|
}
|
|
105
81
|
});
|
|
106
|
-
|
|
107
82
|
_defineProperty(_assertThisInitialized(_this), "onMouseEnter", function () {
|
|
108
83
|
_this.showProfilecard();
|
|
109
|
-
|
|
110
84
|
if (!_this.state.visible) {
|
|
111
85
|
_this.fireAnalytics(cardTriggered('user', 'hover'));
|
|
112
86
|
}
|
|
113
87
|
});
|
|
114
|
-
|
|
115
88
|
_defineProperty(_assertThisInitialized(_this), "containerListeners", _this.props.trigger === 'hover' ? {
|
|
116
89
|
onMouseEnter: _this.onMouseEnter,
|
|
117
90
|
onMouseLeave: _this.hideProfilecard
|
|
118
91
|
} : {
|
|
119
92
|
onClick: _this.onClick
|
|
120
93
|
});
|
|
121
|
-
|
|
122
94
|
_defineProperty(_assertThisInitialized(_this), "layerListeners", {
|
|
123
95
|
handleClickOutside: _this.hideProfilecard,
|
|
124
96
|
handleEscapeKeydown: _this.hideProfilecard
|
|
125
97
|
});
|
|
126
|
-
|
|
127
98
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
128
99
|
visible: false,
|
|
129
100
|
isLoading: undefined,
|
|
@@ -135,22 +106,18 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
135
106
|
teamCentralBaseUrl: undefined,
|
|
136
107
|
kudosDrawerOpen: false
|
|
137
108
|
});
|
|
138
|
-
|
|
139
109
|
_defineProperty(_assertThisInitialized(_this), "clientFetchProfile", function () {
|
|
140
110
|
var _this$props = _this.props,
|
|
141
|
-
|
|
142
|
-
|
|
111
|
+
cloudId = _this$props.cloudId,
|
|
112
|
+
userId = _this$props.userId;
|
|
143
113
|
var isLoading = _this.state.isLoading;
|
|
144
|
-
|
|
145
114
|
if (isLoading === true) {
|
|
146
115
|
// don't fetch data when fetching is in process
|
|
147
116
|
return;
|
|
148
117
|
}
|
|
149
|
-
|
|
150
118
|
_this.setState({
|
|
151
119
|
teamCentralBaseUrl: _this.props.resourceClient.getTeamCentralBaseUrl()
|
|
152
120
|
});
|
|
153
|
-
|
|
154
121
|
_this.setState({
|
|
155
122
|
isLoading: true,
|
|
156
123
|
hasError: false,
|
|
@@ -159,7 +126,6 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
159
126
|
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId || '', userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos()]);
|
|
160
127
|
requests.then(function (res) {
|
|
161
128
|
var _this2;
|
|
162
|
-
|
|
163
129
|
return (_this2 = _this).handleClientSuccess.apply(_this2, _toConsumableArray(res));
|
|
164
130
|
}, function (err) {
|
|
165
131
|
return _this.handleClientError(err);
|
|
@@ -168,24 +134,19 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
168
134
|
});
|
|
169
135
|
});
|
|
170
136
|
});
|
|
171
|
-
|
|
172
137
|
_defineProperty(_assertThisInitialized(_this), "openKudosDrawer", function () {
|
|
173
138
|
_this.hideProfilecard();
|
|
174
|
-
|
|
175
139
|
_this.setState({
|
|
176
140
|
kudosDrawerOpen: true
|
|
177
141
|
});
|
|
178
142
|
});
|
|
179
|
-
|
|
180
143
|
_defineProperty(_assertThisInitialized(_this), "closeKudosDrawer", function () {
|
|
181
144
|
_this.setState({
|
|
182
145
|
kudosDrawerOpen: false
|
|
183
146
|
});
|
|
184
147
|
});
|
|
185
|
-
|
|
186
148
|
_defineProperty(_assertThisInitialized(_this), "renderCard", function () {
|
|
187
149
|
var isLoading = _this.state.isLoading;
|
|
188
|
-
|
|
189
150
|
if (isLoading === true || isLoading === undefined) {
|
|
190
151
|
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(UserLoadingState, {
|
|
191
152
|
fireAnalytics: _this.fireAnalytics
|
|
@@ -194,10 +155,8 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
194
155
|
return _this.renderProfileCard();
|
|
195
156
|
}
|
|
196
157
|
});
|
|
197
|
-
|
|
198
158
|
return _this;
|
|
199
159
|
}
|
|
200
|
-
|
|
201
160
|
_createClass(ProfilecardTrigger, [{
|
|
202
161
|
key: "componentDidMount",
|
|
203
162
|
value: function componentDidMount() {
|
|
@@ -207,11 +166,12 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
207
166
|
key: "componentDidUpdate",
|
|
208
167
|
value: function componentDidUpdate(prevProps) {
|
|
209
168
|
var _this$props2 = this.props,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
var visible = this.state.visible;
|
|
169
|
+
userId = _this$props2.userId,
|
|
170
|
+
cloudId = _this$props2.cloudId,
|
|
171
|
+
resourceClient = _this$props2.resourceClient;
|
|
172
|
+
var visible = this.state.visible;
|
|
214
173
|
|
|
174
|
+
// just re-fetching data when the card opens
|
|
215
175
|
if (visible && (userId !== prevProps.userId || cloudId !== prevProps.cloudId || resourceClient !== prevProps.resourceClient)) {
|
|
216
176
|
this.setState({
|
|
217
177
|
isLoading: undefined
|
|
@@ -231,7 +191,6 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
231
191
|
if (!this._isMounted) {
|
|
232
192
|
return;
|
|
233
193
|
}
|
|
234
|
-
|
|
235
194
|
this.setState({
|
|
236
195
|
isLoading: false,
|
|
237
196
|
hasError: false,
|
|
@@ -246,7 +205,6 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
246
205
|
if (!this._isMounted) {
|
|
247
206
|
return;
|
|
248
207
|
}
|
|
249
|
-
|
|
250
208
|
this.setState({
|
|
251
209
|
isLoading: false,
|
|
252
210
|
hasError: true,
|
|
@@ -262,7 +220,6 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
262
220
|
key: "renderProfileCard",
|
|
263
221
|
value: function renderProfileCard() {
|
|
264
222
|
var _this$state$data;
|
|
265
|
-
|
|
266
223
|
var newProps = _objectSpread(_objectSpread({
|
|
267
224
|
userId: this.props.userId,
|
|
268
225
|
isCurrentUser: (_this$state$data = this.state.data) === null || _this$state$data === void 0 ? void 0 : _this$state$data.isCurrentUser,
|
|
@@ -275,7 +232,6 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
275
232
|
cloudId: this.props.cloudId,
|
|
276
233
|
openKudosDrawer: this.openKudosDrawer
|
|
277
234
|
});
|
|
278
|
-
|
|
279
235
|
var wrapperProps = this.props.trigger === 'hover' ? {
|
|
280
236
|
onMouseEnter: this.onMouseEnter,
|
|
281
237
|
onMouseLeave: this.hideProfilecard
|
|
@@ -293,7 +249,6 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
293
249
|
key: "renderWithTrigger",
|
|
294
250
|
value: function renderWithTrigger() {
|
|
295
251
|
var _this3 = this;
|
|
296
|
-
|
|
297
252
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popup, {
|
|
298
253
|
isOpen: !!this.state.visible,
|
|
299
254
|
onClose: this.hideProfilecard,
|
|
@@ -301,8 +256,7 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
301
256
|
content: this.renderCard,
|
|
302
257
|
trigger: function trigger(triggerProps) {
|
|
303
258
|
var ref = triggerProps.ref,
|
|
304
|
-
|
|
305
|
-
|
|
259
|
+
innerProps = _objectWithoutProperties(triggerProps, _excluded);
|
|
306
260
|
return /*#__PURE__*/React.createElement("span", _extends({}, innerProps, _this3.containerListeners, {
|
|
307
261
|
ref: ref,
|
|
308
262
|
"data-testid": _this3.props.testId
|
|
@@ -336,14 +290,11 @@ var ProfilecardTrigger = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
336
290
|
}
|
|
337
291
|
}
|
|
338
292
|
}]);
|
|
339
|
-
|
|
340
293
|
return ProfilecardTrigger;
|
|
341
294
|
}(React.PureComponent);
|
|
342
|
-
|
|
343
295
|
_defineProperty(ProfilecardTrigger, "defaultProps", {
|
|
344
296
|
actions: [],
|
|
345
297
|
trigger: 'hover',
|
|
346
298
|
position: 'bottom-start'
|
|
347
299
|
});
|
|
348
|
-
|
|
349
300
|
export default withAnalyticsEvents()(ProfilecardTrigger);
|
|
@@ -6,26 +6,22 @@ import Button from '@atlaskit/button/custom-theme-button';
|
|
|
6
6
|
import messages from '../../messages';
|
|
7
7
|
import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesHeading, ReportingLinesSection } from '../../styled/ReportingLines';
|
|
8
8
|
import { reportingLinesClicked } from '../../util/analytics';
|
|
9
|
-
|
|
10
9
|
function getProfileHref(userId, profileUrl) {
|
|
11
10
|
return profileUrl ? profileUrl + userId : undefined;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
15
13
|
var _manager$pii, _manager$pii2;
|
|
16
|
-
|
|
17
14
|
var fireAnalyticsWithDuration = props.fireAnalyticsWithDuration,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
_props$reportingLines = props.reportingLines,
|
|
16
|
+
reportingLines = _props$reportingLines === void 0 ? {} : _props$reportingLines,
|
|
17
|
+
reportingLinesProfileUrl = props.reportingLinesProfileUrl,
|
|
18
|
+
onReportingLinesClick = props.onReportingLinesClick;
|
|
22
19
|
var _reportingLines$manag = reportingLines.managers,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
managers = _reportingLines$manag === void 0 ? [] : _reportingLines$manag,
|
|
21
|
+
_reportingLines$repor = reportingLines.reports,
|
|
22
|
+
reports = _reportingLines$repor === void 0 ? [] : _reportingLines$repor;
|
|
26
23
|
var manager = managers.length >= 1 ? managers[0] : undefined;
|
|
27
24
|
var hasReports = reports.length > 0;
|
|
28
|
-
|
|
29
25
|
var getReportingLinesOnClick = function getReportingLinesOnClick(user, userType) {
|
|
30
26
|
return onReportingLinesClick ? function () {
|
|
31
27
|
fireAnalyticsWithDuration(function (duration) {
|
|
@@ -37,7 +33,6 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
37
33
|
onReportingLinesClick(user);
|
|
38
34
|
} : undefined;
|
|
39
35
|
};
|
|
40
|
-
|
|
41
36
|
return /*#__PURE__*/React.createElement(React.Fragment, null, manager && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(ReportingLinesHeading, {
|
|
42
37
|
style: {
|
|
43
38
|
marginBottom: 0
|
|
@@ -56,7 +51,6 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
56
51
|
size: "small",
|
|
57
52
|
data: reports.map(function (member, index) {
|
|
58
53
|
var _member$pii, _member$pii2;
|
|
59
|
-
|
|
60
54
|
return {
|
|
61
55
|
key: member.accountIdentifier,
|
|
62
56
|
name: ((_member$pii = member.pii) === null || _member$pii === void 0 ? void 0 : _member$pii.name) || '',
|
|
@@ -69,5 +63,4 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
69
63
|
testId: "profilecard-reports-avatar-group"
|
|
70
64
|
})));
|
|
71
65
|
};
|
|
72
|
-
|
|
73
66
|
export default ReportingLinesDetails;
|
|
@@ -2,7 +2,6 @@ import React, { useEffect } from 'react';
|
|
|
2
2
|
import AkSpinner from '@atlaskit/spinner';
|
|
3
3
|
import { SpinnerContainer } from '../../styled/Card';
|
|
4
4
|
import { profileCardRendered } from '../../util/analytics';
|
|
5
|
-
|
|
6
5
|
var UserLoadingState = function UserLoadingState(_ref) {
|
|
7
6
|
var fireAnalytics = _ref.fireAnalytics;
|
|
8
7
|
useEffect(function () {
|
|
@@ -10,5 +9,4 @@ var UserLoadingState = function UserLoadingState(_ref) {
|
|
|
10
9
|
}, [fireAnalytics]);
|
|
11
10
|
return /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(AkSpinner, null));
|
|
12
11
|
};
|
|
13
|
-
|
|
14
12
|
export default UserLoadingState;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
2
|
export var ProfileCardLazy = /*#__PURE__*/lazy(function () {
|
|
3
|
-
return import(
|
|
4
|
-
/* webpackChunkName: "@atlaskit-internal_lazy-profilecard" */
|
|
3
|
+
return import( /* webpackChunkName: "@atlaskit-internal_lazy-profilecard" */
|
|
5
4
|
'./ProfileCard');
|
|
6
5
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// Avoid exporting new components in this file as they will affect the bundle size of all consumers
|
|
2
2
|
// importing directly from @atlaskit/profilecard.
|
|
3
|
-
import ProfileCardClient from './client/ProfileCardClient';
|
|
4
|
-
|
|
5
|
-
import TeamProfileClient from './client/TeamProfileCardClient';
|
|
6
|
-
|
|
3
|
+
import ProfileCardClient from './client/ProfileCardClient';
|
|
4
|
+
// Note: when generating and updating Flow types in Jira, `TeamProfileClient` and `TeamProfileCardClient` are the same type
|
|
5
|
+
import TeamProfileClient from './client/TeamProfileCardClient';
|
|
6
|
+
// Note: when generating and updating Flow types in Jira, `UserProfileClient` and `UserProfileCardClient` are the same type
|
|
7
7
|
import UserProfileClient, { modifyResponse } from './client/UserProfileCardClient';
|
|
8
8
|
import TeamProfileCardTrigger from './components/Team/TeamProfileCardTrigger';
|
|
9
9
|
import ProfileCard from './components/User/ProfileCard';
|
|
10
10
|
import ProfileCardResourced from './components/User/ProfileCardResourced';
|
|
11
11
|
import ProfileCardTrigger from './components/User/ProfileCardTrigger';
|
|
12
|
-
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from './util/config';
|
|
12
|
+
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from './util/config';
|
|
13
13
|
|
|
14
|
+
// Legacy Profile Card in Jira still needs to use `withOuterListeners`
|
|
14
15
|
export { default as withOuterListeners } from './util/withOuterListeners';
|
|
15
16
|
// We cannot export this component inside `./components/Team/index.ts` because it breaks the lazyload
|
|
16
17
|
// so we have to export this here. `TeamProfileCard` helps to build legacy team profile card inside Jira FE.
|
|
@@ -8,32 +8,24 @@ export function isValidDate(date) {
|
|
|
8
8
|
}
|
|
9
9
|
export default function getRelativeDateKey(date) {
|
|
10
10
|
var today = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
|
|
11
|
-
|
|
12
11
|
if (!date || !isValidDate(date, today)) {
|
|
13
12
|
return null;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
if (isThisWeek(date)) {
|
|
17
15
|
return 'ThisWeek';
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
if (isThisMonth(date)) {
|
|
21
18
|
return 'ThisMonth';
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
if (date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() - 1) {
|
|
25
21
|
return 'LastMonth';
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
var diffInMonths = differenceInMonths(today, date);
|
|
29
|
-
|
|
30
24
|
if (diffInMonths < 6) {
|
|
31
25
|
return 'AFewMonths';
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
if (diffInMonths <= 12) {
|
|
35
28
|
return 'SeveralMonths';
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
return 'MoreThanAYear';
|
|
39
31
|
}
|