@atlaskit/profilecard 19.11.8 → 19.13.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 +20 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/User/ProfileCardTrigger.js +304 -322
- package/dist/cjs/components/User/ProfileCardTriggerNext.js +357 -0
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/User/ProfileCardTrigger.js +273 -267
- package/dist/es2019/components/User/ProfileCardTriggerNext.js +284 -0
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/User/ProfileCardTrigger.js +305 -323
- package/dist/esm/components/User/ProfileCardTriggerNext.js +347 -0
- package/dist/esm/util/analytics.js +1 -1
- package/dist/types/components/User/ProfileCardTrigger.d.ts +1 -1
- package/dist/types/components/User/ProfileCardTriggerNext.d.ts +3 -0
- package/dist/types-ts4.5/components/User/ProfileCardTrigger.d.ts +1 -1
- package/dist/types-ts4.5/components/User/ProfileCardTriggerNext.d.ts +3 -0
- package/package.json +12 -6
|
@@ -1,284 +1,290 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import React, { Suspense } from 'react';
|
|
4
|
+
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
5
|
import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import Popup from '@atlaskit/popup';
|
|
7
8
|
import { layers } from '@atlaskit/theme/constants';
|
|
8
|
-
import
|
|
9
|
-
import getLabelMessage from '../../internal/getLabelMessage';
|
|
9
|
+
import filterActions from '../../internal/filterActions';
|
|
10
10
|
import { CardWrapper } from '../../styled/Card';
|
|
11
11
|
import { cardTriggered, fireEvent } from '../../util/analytics';
|
|
12
12
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
|
|
13
13
|
import { ProfileCardLazy } from './lazyProfileCard';
|
|
14
|
+
import ProfilecardTriggerNext from './ProfileCardTriggerNext';
|
|
14
15
|
import UserLoadingState from './UserLoadingState';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
16
|
+
class ProfilecardTrigger extends React.PureComponent {
|
|
17
|
+
constructor(...args) {
|
|
18
|
+
super(...args);
|
|
19
|
+
_defineProperty(this, "_isMounted", false);
|
|
20
|
+
_defineProperty(this, "showDelay", this.props.trigger === 'click' ? 0 : DELAY_MS_SHOW);
|
|
21
|
+
_defineProperty(this, "hideDelay", this.props.trigger === 'click' ? 0 : DELAY_MS_HIDE);
|
|
22
|
+
_defineProperty(this, "showTimer", 0);
|
|
23
|
+
_defineProperty(this, "hideTimer", 0);
|
|
24
|
+
_defineProperty(this, "fireAnalytics", payload => {
|
|
25
|
+
// Don't fire any analytics if the component is unmounted
|
|
26
|
+
if (!this._isMounted) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (this.props.createAnalyticsEvent) {
|
|
30
|
+
fireEvent(this.props.createAnalyticsEvent, payload);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
_defineProperty(this, "hideProfilecard", () => {
|
|
34
|
+
clearTimeout(this.showTimer);
|
|
35
|
+
clearTimeout(this.hideTimer);
|
|
36
|
+
this.hideTimer = window.setTimeout(() => {
|
|
37
|
+
this.setState({
|
|
38
|
+
visible: false
|
|
39
|
+
});
|
|
40
|
+
}, this.hideDelay);
|
|
41
|
+
});
|
|
42
|
+
_defineProperty(this, "showProfilecard", () => {
|
|
43
|
+
clearTimeout(this.hideTimer);
|
|
44
|
+
clearTimeout(this.showTimer);
|
|
45
|
+
this.showTimer = window.setTimeout(() => {
|
|
46
|
+
if (!this.state.visible) {
|
|
47
|
+
this.clientFetchProfile();
|
|
48
|
+
this.setState({
|
|
49
|
+
visible: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}, this.showDelay);
|
|
53
|
+
});
|
|
54
|
+
_defineProperty(this, "onClick", event => {
|
|
55
|
+
// If the user clicks on the trigger then we don't want that click event to
|
|
56
|
+
// propagate out to parent containers. For example when clicking a mention
|
|
57
|
+
// lozenge in an inline-edit.
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
this.showProfilecard();
|
|
60
|
+
if (!this.state.visible) {
|
|
61
|
+
this.fireAnalytics(cardTriggered('user', 'click'));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
_defineProperty(this, "onMouseEnter", () => {
|
|
65
|
+
this.showProfilecard();
|
|
66
|
+
if (!this.state.visible) {
|
|
67
|
+
this.fireAnalytics(cardTriggered('user', 'hover'));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(this, "onKeyPress", event => {
|
|
71
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
this.showProfilecard();
|
|
74
|
+
if (!this.state.visible) {
|
|
75
|
+
this.fireAnalytics(cardTriggered('user', 'click'));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
_defineProperty(this, "onFocus", () => {
|
|
80
|
+
this.showProfilecard();
|
|
81
|
+
});
|
|
82
|
+
_defineProperty(this, "containerListeners", this.props.trigger === 'hover' ? {
|
|
83
|
+
onMouseEnter: this.onMouseEnter,
|
|
84
|
+
onMouseLeave: this.hideProfilecard,
|
|
85
|
+
onBlur: this.hideProfilecard,
|
|
86
|
+
onKeyPress: this.onKeyPress
|
|
87
|
+
} : {
|
|
88
|
+
onClick: this.onClick,
|
|
89
|
+
onKeyPress: this.onKeyPress
|
|
90
|
+
});
|
|
91
|
+
_defineProperty(this, "layerListeners", {
|
|
92
|
+
handleClickOutside: this.hideProfilecard,
|
|
93
|
+
handleEscapeKeydown: this.hideProfilecard
|
|
94
|
+
});
|
|
95
|
+
_defineProperty(this, "state", {
|
|
96
|
+
visible: false,
|
|
97
|
+
isLoading: undefined,
|
|
98
|
+
hasError: false,
|
|
99
|
+
error: null,
|
|
100
|
+
data: null,
|
|
101
|
+
reportingLinesData: undefined,
|
|
102
|
+
shouldShowGiveKudos: false,
|
|
103
|
+
teamCentralBaseUrl: undefined,
|
|
104
|
+
kudosDrawerOpen: false
|
|
105
|
+
});
|
|
106
|
+
_defineProperty(this, "clientFetchProfile", () => {
|
|
107
|
+
const {
|
|
108
|
+
cloudId,
|
|
109
|
+
userId
|
|
110
|
+
} = this.props;
|
|
111
|
+
const {
|
|
112
|
+
isLoading
|
|
113
|
+
} = this.state;
|
|
114
|
+
if (isLoading === true) {
|
|
115
|
+
// don't fetch data when fetching is in process
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.setState({
|
|
119
|
+
teamCentralBaseUrl: this.props.resourceClient.getTeamCentralBaseUrl()
|
|
120
|
+
});
|
|
121
|
+
this.setState({
|
|
122
|
+
isLoading: true,
|
|
123
|
+
hasError: false,
|
|
124
|
+
data: null
|
|
125
|
+
}, () => {
|
|
126
|
+
const requests = Promise.all([this.props.resourceClient.getProfile(cloudId || '', userId, this.fireAnalytics), this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos()]);
|
|
127
|
+
requests.then(res => this.handleClientSuccess(...res), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
_defineProperty(this, "openKudosDrawer", () => {
|
|
131
|
+
this.hideProfilecard();
|
|
132
|
+
this.setState({
|
|
133
|
+
kudosDrawerOpen: true
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
_defineProperty(this, "closeKudosDrawer", () => {
|
|
137
|
+
this.setState({
|
|
138
|
+
kudosDrawerOpen: false
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
_defineProperty(this, "renderCard", () => {
|
|
142
|
+
const {
|
|
143
|
+
isLoading
|
|
144
|
+
} = this.state;
|
|
145
|
+
if (isLoading === true || isLoading === undefined) {
|
|
146
|
+
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(UserLoadingState, {
|
|
147
|
+
fireAnalytics: this.fireAnalytics
|
|
148
|
+
}));
|
|
149
|
+
} else {
|
|
150
|
+
return this.renderProfileCard();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
componentDidMount() {
|
|
155
|
+
this._isMounted = true;
|
|
156
|
+
}
|
|
157
|
+
componentDidUpdate(prevProps) {
|
|
158
|
+
const {
|
|
159
|
+
userId,
|
|
160
|
+
cloudId,
|
|
161
|
+
resourceClient
|
|
162
|
+
} = this.props;
|
|
163
|
+
const {
|
|
164
|
+
visible
|
|
165
|
+
} = this.state;
|
|
166
|
+
|
|
167
|
+
// just re-fetching data when the card opens
|
|
168
|
+
if (visible && (userId !== prevProps.userId || cloudId !== prevProps.cloudId || resourceClient !== prevProps.resourceClient)) {
|
|
169
|
+
this.setState({
|
|
170
|
+
isLoading: undefined
|
|
171
|
+
}, this.clientFetchProfile);
|
|
104
172
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (!
|
|
173
|
+
}
|
|
174
|
+
componentWillUnmount() {
|
|
175
|
+
this._isMounted = false;
|
|
176
|
+
clearTimeout(this.showTimer);
|
|
177
|
+
clearTimeout(this.hideTimer);
|
|
178
|
+
}
|
|
179
|
+
handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
180
|
+
if (!this._isMounted) {
|
|
113
181
|
return;
|
|
114
182
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
183
|
+
this.setState({
|
|
184
|
+
isLoading: false,
|
|
185
|
+
hasError: false,
|
|
186
|
+
data: profileData,
|
|
187
|
+
reportingLinesData,
|
|
188
|
+
shouldShowGiveKudos
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
handleClientError(err) {
|
|
192
|
+
if (!this._isMounted) {
|
|
122
193
|
return;
|
|
123
194
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
showProfilecard();
|
|
154
|
-
if (!visible) {
|
|
155
|
-
fireAnalytics(cardTriggered('user', 'click'));
|
|
156
|
-
}
|
|
157
|
-
}, [fireAnalytics, showProfilecard, visible]);
|
|
158
|
-
const onMouseEnter = useCallback(() => {
|
|
159
|
-
showProfilecard();
|
|
160
|
-
if (!visible) {
|
|
161
|
-
fireAnalytics(cardTriggered('user', 'hover'));
|
|
162
|
-
}
|
|
163
|
-
}, [fireAnalytics, showProfilecard, visible]);
|
|
164
|
-
const onKeyPress = useCallback(event => {
|
|
165
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
166
|
-
event.preventDefault();
|
|
167
|
-
setTriggeredUsingKeyboard(true);
|
|
168
|
-
showProfilecard();
|
|
169
|
-
if (!visible) {
|
|
170
|
-
fireAnalytics(cardTriggered('user', 'click'));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}, [fireAnalytics, showProfilecard, visible]);
|
|
174
|
-
const onFocus = useCallback(() => {
|
|
175
|
-
showProfilecard();
|
|
176
|
-
}, [showProfilecard]);
|
|
177
|
-
const containerListeners = useMemo(() => trigger === 'hover' ? {
|
|
178
|
-
onMouseEnter: onMouseEnter,
|
|
179
|
-
onMouseLeave: hideProfilecard,
|
|
180
|
-
onBlur: hideProfilecard,
|
|
181
|
-
onKeyPress: onKeyPress
|
|
182
|
-
} : {
|
|
183
|
-
onClick: onClick,
|
|
184
|
-
onKeyPress: onKeyPress
|
|
185
|
-
}, [hideProfilecard, onClick, onKeyPress, onMouseEnter, trigger]);
|
|
186
|
-
const filterActions = useCallback(() => {
|
|
187
|
-
return filterActionsInner(actions, data);
|
|
188
|
-
}, [actions, data]);
|
|
189
|
-
const openKudosDrawer = () => {
|
|
190
|
-
hideProfilecard();
|
|
191
|
-
setKudosDrawerOpen(true);
|
|
192
|
-
};
|
|
193
|
-
const closeKudosDrawer = () => {
|
|
194
|
-
setKudosDrawerOpen(false);
|
|
195
|
-
};
|
|
196
|
-
const showLoading = isLoading === true || isLoading === undefined;
|
|
197
|
-
const wrapperProps = useMemo(() => trigger === 'hover' ? {
|
|
198
|
-
onMouseEnter: onMouseEnter,
|
|
199
|
-
onMouseLeave: hideProfilecard,
|
|
200
|
-
onFocus: onFocus
|
|
201
|
-
} : {}, [hideProfilecard, onFocus, onMouseEnter, trigger]);
|
|
202
|
-
const profilecardProps = {
|
|
203
|
-
userId: userId,
|
|
204
|
-
fullName: prepopulatedData === null || prepopulatedData === void 0 ? void 0 : prepopulatedData.fullName,
|
|
205
|
-
isCurrentUser: data === null || data === void 0 ? void 0 : data.isCurrentUser,
|
|
206
|
-
clientFetchProfile: clientFetchProfile,
|
|
207
|
-
...data,
|
|
208
|
-
reportingLines: reportingLinesData,
|
|
209
|
-
onReportingLinesClick: onReportingLinesClick,
|
|
210
|
-
isKudosEnabled: shouldShowGiveKudos,
|
|
211
|
-
teamCentralBaseUrl: teamCentralBaseUrl,
|
|
212
|
-
cloudId: cloudId,
|
|
213
|
-
openKudosDrawer: openKudosDrawer,
|
|
214
|
-
isTriggeredUsingKeyboard: isTriggeredUsingKeyboard,
|
|
215
|
-
disabledAriaAttributes: disabledAriaAttributes
|
|
216
|
-
};
|
|
217
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popup, {
|
|
218
|
-
isOpen: !!visible,
|
|
219
|
-
onClose: event => {
|
|
220
|
-
hideProfilecard();
|
|
221
|
-
handleKeyboardClose(event);
|
|
222
|
-
},
|
|
223
|
-
placement: position,
|
|
224
|
-
content: () => /*#__PURE__*/React.createElement("div", wrapperProps, showLoading ? /*#__PURE__*/React.createElement(LoadingView, {
|
|
225
|
-
fireAnalytics: fireAnalytics
|
|
226
|
-
}) : visible && /*#__PURE__*/React.createElement(Suspense, {
|
|
195
|
+
this.setState({
|
|
196
|
+
isLoading: false,
|
|
197
|
+
hasError: true,
|
|
198
|
+
error: err
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
filterActions() {
|
|
202
|
+
return filterActions(this.props.actions, this.state.data);
|
|
203
|
+
}
|
|
204
|
+
renderProfileCard() {
|
|
205
|
+
var _this$state$data;
|
|
206
|
+
const newProps = {
|
|
207
|
+
userId: this.props.userId,
|
|
208
|
+
isCurrentUser: (_this$state$data = this.state.data) === null || _this$state$data === void 0 ? void 0 : _this$state$data.isCurrentUser,
|
|
209
|
+
clientFetchProfile: this.clientFetchProfile,
|
|
210
|
+
...this.state.data,
|
|
211
|
+
reportingLines: this.state.reportingLinesData,
|
|
212
|
+
onReportingLinesClick: this.props.onReportingLinesClick,
|
|
213
|
+
isKudosEnabled: this.state.shouldShowGiveKudos,
|
|
214
|
+
teamCentralBaseUrl: this.state.teamCentralBaseUrl,
|
|
215
|
+
cloudId: this.props.cloudId,
|
|
216
|
+
openKudosDrawer: this.openKudosDrawer
|
|
217
|
+
};
|
|
218
|
+
const wrapperProps = this.props.trigger === 'hover' ? {
|
|
219
|
+
onMouseEnter: this.onMouseEnter,
|
|
220
|
+
onMouseLeave: this.hideProfilecard,
|
|
221
|
+
onFocus: this.onFocus
|
|
222
|
+
} : {};
|
|
223
|
+
return /*#__PURE__*/React.createElement("div", wrapperProps, this.state.visible && /*#__PURE__*/React.createElement(Suspense, {
|
|
227
224
|
fallback: null
|
|
228
|
-
}, /*#__PURE__*/React.createElement(ProfileCardLazy, _extends({},
|
|
229
|
-
actions: filterActions(),
|
|
230
|
-
hasError: hasError,
|
|
231
|
-
errorType: error,
|
|
225
|
+
}, /*#__PURE__*/React.createElement(ProfileCardLazy, _extends({}, newProps, {
|
|
226
|
+
actions: this.filterActions(),
|
|
227
|
+
hasError: this.state.hasError,
|
|
228
|
+
errorType: this.state.error,
|
|
232
229
|
withoutElevation: true
|
|
233
|
-
}))))
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
230
|
+
}))));
|
|
231
|
+
}
|
|
232
|
+
renderWithTrigger() {
|
|
233
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popup, {
|
|
234
|
+
isOpen: !!this.state.visible,
|
|
235
|
+
onClose: this.hideProfilecard,
|
|
236
|
+
placement: this.props.position,
|
|
237
|
+
content: this.renderCard,
|
|
238
|
+
trigger: triggerProps => {
|
|
239
|
+
const {
|
|
240
|
+
ref,
|
|
241
|
+
...innerProps
|
|
242
|
+
} = triggerProps;
|
|
243
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, innerProps, this.containerListeners, {
|
|
244
|
+
ref: ref,
|
|
245
|
+
"data-testid": this.props.testId,
|
|
246
|
+
role: "button",
|
|
247
|
+
tabIndex: 0
|
|
248
|
+
}), this.props.children);
|
|
249
|
+
},
|
|
250
|
+
zIndex: layers.modal(),
|
|
251
|
+
shouldUseCaptureOnOutsideClick: true,
|
|
252
|
+
autoFocus: this.props.trigger === 'click'
|
|
253
|
+
}), this.state.shouldShowGiveKudos && /*#__PURE__*/React.createElement(Suspense, {
|
|
254
|
+
fallback: null
|
|
255
|
+
}, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
|
|
256
|
+
isOpen: this.state.kudosDrawerOpen,
|
|
257
|
+
recipient: {
|
|
258
|
+
type: KudosType.INDIVIDUAL,
|
|
259
|
+
recipientId: this.props.userId
|
|
260
|
+
},
|
|
261
|
+
analyticsSource: "profile-card",
|
|
262
|
+
teamCentralBaseUrl: this.state.teamCentralBaseUrl,
|
|
263
|
+
cloudId: this.props.cloudId,
|
|
264
|
+
addFlag: this.props.addFlag,
|
|
265
|
+
onClose: this.closeKudosDrawer
|
|
266
|
+
})));
|
|
267
|
+
}
|
|
268
|
+
render() {
|
|
269
|
+
if (this.props.children) {
|
|
270
|
+
return this.renderWithTrigger();
|
|
271
|
+
} else {
|
|
272
|
+
throw new Error('Component "ProfileCardTrigger" must have "children" property');
|
|
273
|
+
}
|
|
274
|
+
}
|
|
277
275
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
276
|
+
_defineProperty(ProfilecardTrigger, "defaultProps", {
|
|
277
|
+
actions: [],
|
|
278
|
+
trigger: 'hover',
|
|
279
|
+
position: 'bottom-start'
|
|
280
|
+
});
|
|
281
|
+
const ProfilecardTriggerLegacy = withAnalyticsEvents()(ProfilecardTrigger);
|
|
282
|
+
export default function ProfilecardTriggerSwitch(props) {
|
|
283
|
+
return getBooleanFF('platform.profile-card-trigger-next') ? /*#__PURE__*/React.createElement(ProfilecardTriggerNext, _extends({}, props, {
|
|
284
|
+
onVisibilityChange: isVisible => {
|
|
285
|
+
if (props.onVisibilityChange) {
|
|
286
|
+
props.onVisibilityChange(isVisible);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
})) : /*#__PURE__*/React.createElement(ProfilecardTriggerLegacy, props);
|
|
290
|
+
}
|