@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
|
@@ -9,13 +9,10 @@ import { fireEvent } from '../../util/analytics';
|
|
|
9
9
|
import { ErrorMessage } from '../Error';
|
|
10
10
|
import ProfileCard from './ProfileCard';
|
|
11
11
|
import UserLoadingState from './UserLoadingState';
|
|
12
|
-
|
|
13
12
|
class ProfileCardResourced extends React.PureComponent {
|
|
14
13
|
constructor(...args) {
|
|
15
14
|
super(...args);
|
|
16
|
-
|
|
17
15
|
_defineProperty(this, "_isMounted", false);
|
|
18
|
-
|
|
19
16
|
_defineProperty(this, "state", {
|
|
20
17
|
visible: false,
|
|
21
18
|
isLoading: undefined,
|
|
@@ -26,18 +23,15 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
26
23
|
isKudosEnabled: false,
|
|
27
24
|
kudosDrawerOpen: false
|
|
28
25
|
});
|
|
29
|
-
|
|
30
26
|
_defineProperty(this, "fireAnalytics", payload => {
|
|
31
27
|
// Don't fire analytics if the component is unmounted
|
|
32
28
|
if (!this._isMounted) {
|
|
33
29
|
return;
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
if (this.props.createAnalyticsEvent) {
|
|
37
32
|
fireEvent(this.props.createAnalyticsEvent, payload);
|
|
38
33
|
}
|
|
39
34
|
});
|
|
40
|
-
|
|
41
35
|
_defineProperty(this, "clientFetchProfile", () => {
|
|
42
36
|
const {
|
|
43
37
|
cloudId,
|
|
@@ -46,12 +40,10 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
46
40
|
const {
|
|
47
41
|
isLoading
|
|
48
42
|
} = this.state;
|
|
49
|
-
|
|
50
43
|
if (isLoading === true) {
|
|
51
44
|
// don't fetch data when fetching is in process
|
|
52
45
|
return;
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
this.setState({
|
|
56
48
|
isLoading: true,
|
|
57
49
|
hasError: false,
|
|
@@ -61,50 +53,41 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
61
53
|
requests.then(res => this.handleClientSuccess(...res), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
|
|
62
54
|
});
|
|
63
55
|
});
|
|
64
|
-
|
|
65
56
|
_defineProperty(this, "filterActions", () => filterActions(this.props.actions, this.state.data));
|
|
66
|
-
|
|
67
57
|
_defineProperty(this, "openKudosDrawer", () => {
|
|
68
58
|
this.setState({
|
|
69
59
|
kudosDrawerOpen: true
|
|
70
60
|
});
|
|
71
61
|
});
|
|
72
|
-
|
|
73
62
|
_defineProperty(this, "closeKudosDrawer", () => {
|
|
74
63
|
this.setState({
|
|
75
64
|
kudosDrawerOpen: false
|
|
76
65
|
});
|
|
77
66
|
});
|
|
78
67
|
}
|
|
79
|
-
|
|
80
68
|
componentDidMount() {
|
|
81
69
|
this._isMounted = true;
|
|
82
70
|
this.clientFetchProfile();
|
|
83
71
|
}
|
|
84
|
-
|
|
85
72
|
componentDidUpdate(prevProps, prevState) {
|
|
86
73
|
const {
|
|
87
74
|
userId,
|
|
88
75
|
cloudId,
|
|
89
76
|
resourceClient
|
|
90
77
|
} = this.props;
|
|
91
|
-
|
|
92
78
|
if (userId !== prevProps.userId || cloudId !== prevProps.cloudId || resourceClient !== prevProps.resourceClient) {
|
|
93
79
|
this.setState({
|
|
94
80
|
isLoading: undefined
|
|
95
81
|
}, this.clientFetchProfile);
|
|
96
82
|
}
|
|
97
83
|
}
|
|
98
|
-
|
|
99
84
|
componentWillUnmount() {
|
|
100
85
|
this._isMounted = false;
|
|
101
86
|
}
|
|
102
|
-
|
|
103
87
|
handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
104
88
|
if (!this._isMounted) {
|
|
105
89
|
return;
|
|
106
90
|
}
|
|
107
|
-
|
|
108
91
|
this.setState({
|
|
109
92
|
isLoading: false,
|
|
110
93
|
hasError: false,
|
|
@@ -113,19 +96,16 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
113
96
|
isKudosEnabled: shouldShowGiveKudos
|
|
114
97
|
});
|
|
115
98
|
}
|
|
116
|
-
|
|
117
99
|
handleClientError(err) {
|
|
118
100
|
if (!this._isMounted) {
|
|
119
101
|
return;
|
|
120
102
|
}
|
|
121
|
-
|
|
122
103
|
this.setState({
|
|
123
104
|
isLoading: false,
|
|
124
105
|
hasError: true,
|
|
125
106
|
error: err
|
|
126
107
|
});
|
|
127
108
|
}
|
|
128
|
-
|
|
129
109
|
render() {
|
|
130
110
|
const {
|
|
131
111
|
isLoading,
|
|
@@ -142,7 +122,6 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
142
122
|
addFlag
|
|
143
123
|
} = this.props;
|
|
144
124
|
const isFetchingOrNotStartToFetchYet = isLoading === true || isLoading === undefined;
|
|
145
|
-
|
|
146
125
|
if (isFetchingOrNotStartToFetchYet) {
|
|
147
126
|
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(UserLoadingState, {
|
|
148
127
|
fireAnalytics: this.fireAnalytics
|
|
@@ -154,7 +133,6 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
154
133
|
fireAnalytics: this.fireAnalytics
|
|
155
134
|
}));
|
|
156
135
|
}
|
|
157
|
-
|
|
158
136
|
const newProps = {
|
|
159
137
|
hasError,
|
|
160
138
|
errorType: error,
|
|
@@ -186,12 +164,9 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
186
164
|
actions: this.filterActions()
|
|
187
165
|
}))));
|
|
188
166
|
}
|
|
189
|
-
|
|
190
167
|
}
|
|
191
|
-
|
|
192
168
|
_defineProperty(ProfileCardResourced, "defaultProps", {
|
|
193
169
|
actions: []
|
|
194
170
|
});
|
|
195
|
-
|
|
196
171
|
export const ProfileCardResourcedInternal = ProfileCardResourced;
|
|
197
172
|
export default withAnalyticsEvents()(ProfileCardResourced);
|
|
@@ -11,32 +11,23 @@ import { cardTriggered, fireEvent } from '../../util/analytics';
|
|
|
11
11
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
|
|
12
12
|
import { ProfileCardLazy } from './lazyProfileCard';
|
|
13
13
|
import UserLoadingState from './UserLoadingState';
|
|
14
|
-
|
|
15
14
|
class ProfilecardTrigger extends React.PureComponent {
|
|
16
15
|
constructor(...args) {
|
|
17
16
|
super(...args);
|
|
18
|
-
|
|
19
17
|
_defineProperty(this, "_isMounted", false);
|
|
20
|
-
|
|
21
18
|
_defineProperty(this, "showDelay", this.props.trigger === 'click' ? 0 : DELAY_MS_SHOW);
|
|
22
|
-
|
|
23
19
|
_defineProperty(this, "hideDelay", this.props.trigger === 'click' ? 0 : DELAY_MS_HIDE);
|
|
24
|
-
|
|
25
20
|
_defineProperty(this, "showTimer", 0);
|
|
26
|
-
|
|
27
21
|
_defineProperty(this, "hideTimer", 0);
|
|
28
|
-
|
|
29
22
|
_defineProperty(this, "fireAnalytics", payload => {
|
|
30
23
|
// Don't fire any analytics if the component is unmounted
|
|
31
24
|
if (!this._isMounted) {
|
|
32
25
|
return;
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
if (this.props.createAnalyticsEvent) {
|
|
36
28
|
fireEvent(this.props.createAnalyticsEvent, payload);
|
|
37
29
|
}
|
|
38
30
|
});
|
|
39
|
-
|
|
40
31
|
_defineProperty(this, "hideProfilecard", () => {
|
|
41
32
|
clearTimeout(this.showTimer);
|
|
42
33
|
clearTimeout(this.hideTimer);
|
|
@@ -46,7 +37,6 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
46
37
|
});
|
|
47
38
|
}, this.hideDelay);
|
|
48
39
|
});
|
|
49
|
-
|
|
50
40
|
_defineProperty(this, "showProfilecard", () => {
|
|
51
41
|
clearTimeout(this.hideTimer);
|
|
52
42
|
clearTimeout(this.showTimer);
|
|
@@ -59,39 +49,32 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
59
49
|
}
|
|
60
50
|
}, this.showDelay);
|
|
61
51
|
});
|
|
62
|
-
|
|
63
52
|
_defineProperty(this, "onClick", event => {
|
|
64
53
|
// If the user clicks on the trigger then we don't want that click event to
|
|
65
54
|
// propagate out to parent containers. For example when clicking a mention
|
|
66
55
|
// lozenge in an inline-edit.
|
|
67
56
|
event.stopPropagation();
|
|
68
57
|
this.showProfilecard();
|
|
69
|
-
|
|
70
58
|
if (!this.state.visible) {
|
|
71
59
|
this.fireAnalytics(cardTriggered('user', 'click'));
|
|
72
60
|
}
|
|
73
61
|
});
|
|
74
|
-
|
|
75
62
|
_defineProperty(this, "onMouseEnter", () => {
|
|
76
63
|
this.showProfilecard();
|
|
77
|
-
|
|
78
64
|
if (!this.state.visible) {
|
|
79
65
|
this.fireAnalytics(cardTriggered('user', 'hover'));
|
|
80
66
|
}
|
|
81
67
|
});
|
|
82
|
-
|
|
83
68
|
_defineProperty(this, "containerListeners", this.props.trigger === 'hover' ? {
|
|
84
69
|
onMouseEnter: this.onMouseEnter,
|
|
85
70
|
onMouseLeave: this.hideProfilecard
|
|
86
71
|
} : {
|
|
87
72
|
onClick: this.onClick
|
|
88
73
|
});
|
|
89
|
-
|
|
90
74
|
_defineProperty(this, "layerListeners", {
|
|
91
75
|
handleClickOutside: this.hideProfilecard,
|
|
92
76
|
handleEscapeKeydown: this.hideProfilecard
|
|
93
77
|
});
|
|
94
|
-
|
|
95
78
|
_defineProperty(this, "state", {
|
|
96
79
|
visible: false,
|
|
97
80
|
isLoading: undefined,
|
|
@@ -103,7 +86,6 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
103
86
|
teamCentralBaseUrl: undefined,
|
|
104
87
|
kudosDrawerOpen: false
|
|
105
88
|
});
|
|
106
|
-
|
|
107
89
|
_defineProperty(this, "clientFetchProfile", () => {
|
|
108
90
|
const {
|
|
109
91
|
cloudId,
|
|
@@ -112,12 +94,10 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
112
94
|
const {
|
|
113
95
|
isLoading
|
|
114
96
|
} = this.state;
|
|
115
|
-
|
|
116
97
|
if (isLoading === true) {
|
|
117
98
|
// don't fetch data when fetching is in process
|
|
118
99
|
return;
|
|
119
100
|
}
|
|
120
|
-
|
|
121
101
|
this.setState({
|
|
122
102
|
teamCentralBaseUrl: this.props.resourceClient.getTeamCentralBaseUrl()
|
|
123
103
|
});
|
|
@@ -130,25 +110,21 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
130
110
|
requests.then(res => this.handleClientSuccess(...res), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
|
|
131
111
|
});
|
|
132
112
|
});
|
|
133
|
-
|
|
134
113
|
_defineProperty(this, "openKudosDrawer", () => {
|
|
135
114
|
this.hideProfilecard();
|
|
136
115
|
this.setState({
|
|
137
116
|
kudosDrawerOpen: true
|
|
138
117
|
});
|
|
139
118
|
});
|
|
140
|
-
|
|
141
119
|
_defineProperty(this, "closeKudosDrawer", () => {
|
|
142
120
|
this.setState({
|
|
143
121
|
kudosDrawerOpen: false
|
|
144
122
|
});
|
|
145
123
|
});
|
|
146
|
-
|
|
147
124
|
_defineProperty(this, "renderCard", () => {
|
|
148
125
|
const {
|
|
149
126
|
isLoading
|
|
150
127
|
} = this.state;
|
|
151
|
-
|
|
152
128
|
if (isLoading === true || isLoading === undefined) {
|
|
153
129
|
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(UserLoadingState, {
|
|
154
130
|
fireAnalytics: this.fireAnalytics
|
|
@@ -158,11 +134,9 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
158
134
|
}
|
|
159
135
|
});
|
|
160
136
|
}
|
|
161
|
-
|
|
162
137
|
componentDidMount() {
|
|
163
138
|
this._isMounted = true;
|
|
164
139
|
}
|
|
165
|
-
|
|
166
140
|
componentDidUpdate(prevProps) {
|
|
167
141
|
const {
|
|
168
142
|
userId,
|
|
@@ -171,26 +145,24 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
171
145
|
} = this.props;
|
|
172
146
|
const {
|
|
173
147
|
visible
|
|
174
|
-
} = this.state;
|
|
148
|
+
} = this.state;
|
|
175
149
|
|
|
150
|
+
// just re-fetching data when the card opens
|
|
176
151
|
if (visible && (userId !== prevProps.userId || cloudId !== prevProps.cloudId || resourceClient !== prevProps.resourceClient)) {
|
|
177
152
|
this.setState({
|
|
178
153
|
isLoading: undefined
|
|
179
154
|
}, this.clientFetchProfile);
|
|
180
155
|
}
|
|
181
156
|
}
|
|
182
|
-
|
|
183
157
|
componentWillUnmount() {
|
|
184
158
|
this._isMounted = false;
|
|
185
159
|
clearTimeout(this.showTimer);
|
|
186
160
|
clearTimeout(this.hideTimer);
|
|
187
161
|
}
|
|
188
|
-
|
|
189
162
|
handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
190
163
|
if (!this._isMounted) {
|
|
191
164
|
return;
|
|
192
165
|
}
|
|
193
|
-
|
|
194
166
|
this.setState({
|
|
195
167
|
isLoading: false,
|
|
196
168
|
hasError: false,
|
|
@@ -199,26 +171,21 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
199
171
|
shouldShowGiveKudos
|
|
200
172
|
});
|
|
201
173
|
}
|
|
202
|
-
|
|
203
174
|
handleClientError(err) {
|
|
204
175
|
if (!this._isMounted) {
|
|
205
176
|
return;
|
|
206
177
|
}
|
|
207
|
-
|
|
208
178
|
this.setState({
|
|
209
179
|
isLoading: false,
|
|
210
180
|
hasError: true,
|
|
211
181
|
error: err
|
|
212
182
|
});
|
|
213
183
|
}
|
|
214
|
-
|
|
215
184
|
filterActions() {
|
|
216
185
|
return filterActions(this.props.actions, this.state.data);
|
|
217
186
|
}
|
|
218
|
-
|
|
219
187
|
renderProfileCard() {
|
|
220
188
|
var _this$state$data;
|
|
221
|
-
|
|
222
189
|
const newProps = {
|
|
223
190
|
userId: this.props.userId,
|
|
224
191
|
isCurrentUser: (_this$state$data = this.state.data) === null || _this$state$data === void 0 ? void 0 : _this$state$data.isCurrentUser,
|
|
@@ -244,7 +211,6 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
244
211
|
withoutElevation: true
|
|
245
212
|
}))));
|
|
246
213
|
}
|
|
247
|
-
|
|
248
214
|
renderWithTrigger() {
|
|
249
215
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popup, {
|
|
250
216
|
isOpen: !!this.state.visible,
|
|
@@ -279,7 +245,6 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
279
245
|
onClose: this.closeKudosDrawer
|
|
280
246
|
})));
|
|
281
247
|
}
|
|
282
|
-
|
|
283
248
|
render() {
|
|
284
249
|
if (this.props.children) {
|
|
285
250
|
return this.renderWithTrigger();
|
|
@@ -287,13 +252,10 @@ class ProfilecardTrigger extends React.PureComponent {
|
|
|
287
252
|
throw new Error('Component "ProfileCardTrigger" must have "children" property');
|
|
288
253
|
}
|
|
289
254
|
}
|
|
290
|
-
|
|
291
255
|
}
|
|
292
|
-
|
|
293
256
|
_defineProperty(ProfilecardTrigger, "defaultProps", {
|
|
294
257
|
actions: [],
|
|
295
258
|
trigger: 'hover',
|
|
296
259
|
position: 'bottom-start'
|
|
297
260
|
});
|
|
298
|
-
|
|
299
261
|
export default withAnalyticsEvents()(ProfilecardTrigger);
|
|
@@ -6,14 +6,11 @@ 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
|
const ReportingLinesDetails = props => {
|
|
15
13
|
var _manager$pii, _manager$pii2;
|
|
16
|
-
|
|
17
14
|
const {
|
|
18
15
|
fireAnalyticsWithDuration,
|
|
19
16
|
reportingLines = {},
|
|
@@ -26,7 +23,6 @@ const ReportingLinesDetails = props => {
|
|
|
26
23
|
} = reportingLines;
|
|
27
24
|
const manager = managers.length >= 1 ? managers[0] : undefined;
|
|
28
25
|
const hasReports = reports.length > 0;
|
|
29
|
-
|
|
30
26
|
const getReportingLinesOnClick = (user, userType) => onReportingLinesClick ? () => {
|
|
31
27
|
fireAnalyticsWithDuration(duration => reportingLinesClicked({
|
|
32
28
|
duration,
|
|
@@ -34,7 +30,6 @@ const ReportingLinesDetails = props => {
|
|
|
34
30
|
}));
|
|
35
31
|
onReportingLinesClick(user);
|
|
36
32
|
} : undefined;
|
|
37
|
-
|
|
38
33
|
return /*#__PURE__*/React.createElement(React.Fragment, null, manager && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(ReportingLinesHeading, {
|
|
39
34
|
style: {
|
|
40
35
|
marginBottom: 0
|
|
@@ -53,7 +48,6 @@ const ReportingLinesDetails = props => {
|
|
|
53
48
|
size: "small",
|
|
54
49
|
data: reports.map((member, index) => {
|
|
55
50
|
var _member$pii, _member$pii2;
|
|
56
|
-
|
|
57
51
|
return {
|
|
58
52
|
key: member.accountIdentifier,
|
|
59
53
|
name: ((_member$pii = member.pii) === null || _member$pii === void 0 ? void 0 : _member$pii.name) || '',
|
|
@@ -66,5 +60,4 @@ const ReportingLinesDetails = props => {
|
|
|
66
60
|
testId: "profilecard-reports-avatar-group"
|
|
67
61
|
})));
|
|
68
62
|
};
|
|
69
|
-
|
|
70
63
|
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
|
const UserLoadingState = ({
|
|
7
6
|
fireAnalytics
|
|
8
7
|
}) => {
|
|
@@ -11,5 +10,4 @@ const UserLoadingState = ({
|
|
|
11
10
|
}, [fireAnalytics]);
|
|
12
11
|
return /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(AkSpinner, null));
|
|
13
12
|
};
|
|
14
|
-
|
|
15
13
|
export default UserLoadingState;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
export const ProfileCardLazy = /*#__PURE__*/lazy(() => import(
|
|
3
|
-
/* webpackChunkName: "@atlaskit-internal_lazy-profilecard" */
|
|
2
|
+
export const ProfileCardLazy = /*#__PURE__*/lazy(() => import( /* webpackChunkName: "@atlaskit-internal_lazy-profilecard" */
|
|
4
3
|
'./ProfileCard'));
|
package/dist/es2019/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.
|
|
@@ -9,28 +9,21 @@ export default function getRelativeDateKey(date, today = new Date()) {
|
|
|
9
9
|
if (!date || !isValidDate(date, today)) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
if (isThisWeek(date)) {
|
|
14
13
|
return 'ThisWeek';
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
if (isThisMonth(date)) {
|
|
18
16
|
return 'ThisMonth';
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
if (date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() - 1) {
|
|
22
19
|
return 'LastMonth';
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
const diffInMonths = differenceInMonths(today, date);
|
|
26
|
-
|
|
27
22
|
if (diffInMonths < 6) {
|
|
28
23
|
return 'AFewMonths';
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
if (diffInMonths <= 12) {
|
|
32
26
|
return 'SeveralMonths';
|
|
33
27
|
}
|
|
34
|
-
|
|
35
28
|
return 'MoreThanAYear';
|
|
36
29
|
}
|
|
@@ -16,18 +16,16 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
|
|
|
16
16
|
reason: error
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
|
|
20
19
|
const userIdAsIndex = parseInt(userId, 10);
|
|
21
20
|
const profile = profiles[userIdAsIndex] || profiles[0];
|
|
22
|
-
|
|
23
21
|
if (!profile) {
|
|
24
22
|
return reject({
|
|
25
23
|
reason: 'default'
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
const weekday = getWeekday();
|
|
30
|
-
const data = {
|
|
27
|
+
const data = {
|
|
28
|
+
...profile
|
|
31
29
|
};
|
|
32
30
|
data.remoteTimeString = getTimeString();
|
|
33
31
|
data.remoteWeekdayIndex = weekday.index;
|
|
@@ -36,14 +34,11 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
|
|
|
36
34
|
}, timeout);
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
|
-
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
class MockTeamCentralClient extends TeamCentralCardClient {
|
|
43
39
|
createTcReadyPromise(config) {
|
|
44
40
|
return Promise.resolve(true);
|
|
45
41
|
}
|
|
46
|
-
|
|
47
42
|
makeRequest(userId) {
|
|
48
43
|
const timeout = random(1500) + 500;
|
|
49
44
|
const matchError = userId.match(/^error:([0-9a-zA-Z\-]+)$/);
|
|
@@ -55,28 +50,24 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
|
|
|
55
50
|
reason: error
|
|
56
51
|
});
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
return resolve(reportingLinesData);
|
|
60
54
|
}, timeout);
|
|
61
55
|
});
|
|
62
56
|
}
|
|
63
|
-
|
|
64
57
|
getFlagEnabled(featureKey) {
|
|
65
58
|
return Promise.resolve(true);
|
|
66
59
|
}
|
|
67
|
-
|
|
68
60
|
}
|
|
69
|
-
|
|
70
61
|
return class MockProfileClient extends BaseProfileClient {
|
|
71
62
|
constructor(options, clients = {}) {
|
|
72
63
|
super(options, {
|
|
73
64
|
userClient: new MockUserClient(options),
|
|
74
|
-
teamCentralClient: new MockTeamCentralClient({
|
|
65
|
+
teamCentralClient: new MockTeamCentralClient({
|
|
66
|
+
...options,
|
|
75
67
|
teamCentralUrl: 'defaultTeamCentralUrl'
|
|
76
68
|
}),
|
|
77
69
|
...clients
|
|
78
70
|
});
|
|
79
71
|
}
|
|
80
|
-
|
|
81
72
|
};
|
|
82
73
|
}
|
|
@@ -8,10 +8,8 @@ export default function getMockTeamClient(data) {
|
|
|
8
8
|
reason: data.error
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
return Promise.resolve(data.team);
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
return new Promise((resolve, reject) => {
|
|
16
14
|
setTimeout(() => {
|
|
17
15
|
if (data.error && Math.random() < data.errorRate) {
|
|
@@ -19,15 +17,12 @@ export default function getMockTeamClient(data) {
|
|
|
19
17
|
reason: data.error
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
return resolve(data.team);
|
|
24
21
|
}, data.timeout);
|
|
25
22
|
});
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
makeRequestViaGateway(teamId) {
|
|
29
25
|
return this.makeRequest(teamId);
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
};
|
|
33
28
|
}
|
|
@@ -4,7 +4,6 @@ import UserProfileCardClient from '../client/UserProfileCardClient';
|
|
|
4
4
|
import profiles from './profile-data';
|
|
5
5
|
import teamData from './team-data';
|
|
6
6
|
import { getTimeString, getWeekday } from './util';
|
|
7
|
-
|
|
8
7
|
class SimpleMockTeamClient extends TeamProfileCardClient {
|
|
9
8
|
makeRequest(teamId) {
|
|
10
9
|
const simpleMockTeam = teamData({
|
|
@@ -15,23 +14,20 @@ class SimpleMockTeamClient extends TeamProfileCardClient {
|
|
|
15
14
|
...simpleMockTeam
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
class SimpleMockUserClient extends UserProfileCardClient {
|
|
22
19
|
makeRequest(cloudId, userId) {
|
|
23
20
|
const profile = profiles[0];
|
|
24
21
|
const weekday = getWeekday();
|
|
25
|
-
const data = {
|
|
22
|
+
const data = {
|
|
23
|
+
...profile
|
|
26
24
|
};
|
|
27
25
|
data.remoteTimeString = getTimeString();
|
|
28
26
|
data.remoteWeekdayIndex = weekday.index;
|
|
29
27
|
data.remoteWeekdayString = weekday.string;
|
|
30
28
|
return Promise.resolve(data);
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
const args = {
|
|
36
32
|
cacheSize: 10,
|
|
37
33
|
maxCacheAge: 0,
|
|
@@ -3,7 +3,6 @@ const avatarImages = ['data:image/gif;base64,R0lGODdhgACAAPIHAABRzMHT8l6O3o2w6en
|
|
|
3
3
|
];
|
|
4
4
|
|
|
5
5
|
const getAvatar = () => sample(avatarImages);
|
|
6
|
-
|
|
7
6
|
const memberNames = ['Kramer Hatfield', 'Schwartz Mclaughlin', 'Nichole Walter', 'Cleveland Rodriquez', 'Hess Stone', 'Lewis Cervantes', 'Abbott Lamb', 'Conner Duncan', 'Bauer Burch', 'Mcbride Haynes', 'Maddy Estes', 'Nikki Villanueva', 'Adam Burks', 'Milly Walters', 'Phoebe Clarkson', 'Samuel Dunlap', 'Naomi Boyer', 'Silas Gomez', 'Josie Lancaster', 'Fred Kirkpatrick', 'Beck Rutledge', 'Rebecca Woods'];
|
|
8
7
|
const members = memberNames.map((name, index) => ({
|
|
9
8
|
id: index.toString(),
|
|
@@ -5,9 +5,7 @@ import styled from '@emotion/styled';
|
|
|
5
5
|
import { N50A, N60A } from '@atlaskit/theme/colors';
|
|
6
6
|
import { borderRadius, fontSizeSmall, gridSize } from '@atlaskit/theme/constants';
|
|
7
7
|
import { appLabelBgColor, appLabelTextColor, bgColor, headerBgColor, headerBgColorDisabledUser, headerTextColor, headerTextColorInactive, labelIconColor, labelTextColor } from './constants';
|
|
8
|
-
|
|
9
8
|
const getFullNameMargin = props => props.noMeta ? `${gridSize() * 4.5}px 0 ${gridSize() * 1.5}px 0` : `${gridSize() * 1.5}px 0 0 0`;
|
|
10
|
-
|
|
11
9
|
export const CardContainerEmpty = styled.div``;
|
|
12
10
|
export const CardWrapper = styled.div`
|
|
13
11
|
background-color: ${bgColor};
|
|
@@ -76,12 +76,15 @@ export const MoreButton = styled.div`
|
|
|
76
76
|
export const LoadingWrapper = styled.div`
|
|
77
77
|
text-align: center;
|
|
78
78
|
margin-top: ${gridSize() * 5}px;
|
|
79
|
-
`;
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
// export const LoadingTeamName = styled.div`
|
|
80
82
|
// width: 175px;
|
|
81
83
|
// height: ${gridSize () *3)px;
|
|
82
84
|
// border-radius: ${borderRadius}px;
|
|
83
85
|
// background-color: #f4f5f7;
|
|
84
86
|
// `;
|
|
87
|
+
|
|
85
88
|
// export const LoadingMemberCount = styled.div`
|
|
86
89
|
// width: 81px;
|
|
87
90
|
// height: ${gridSize () *2)px;
|