@atlaskit/profilecard 24.13.7 → 24.14.1
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 +21 -0
- package/__tests__/vr-tests/__snapshots__/user-profilecard/error-state--default.png +0 -0
- package/__tests__/vr-tests/agent-profilecard.vr.tsx +7 -1
- package/__tests__/vr-tests/user-profilecard.vr.tsx +42 -6
- package/afm-cc/tsconfig.json +6 -0
- package/afm-dev-agents/tsconfig.json +6 -0
- package/afm-jira/tsconfig.json +6 -0
- package/afm-passionfruit/tsconfig.json +6 -0
- package/afm-post-office/tsconfig.json +6 -0
- package/afm-rovo-extension/tsconfig.json +6 -0
- package/afm-townsquare/tsconfig.json +6 -0
- package/dist/cjs/client/ProfileCardClient.js +2 -2
- package/dist/cjs/client/UserProfileCardClient.js +45 -11
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/Actions.js +5 -2
- package/dist/cjs/components/Agent/ActionsCompiled.compiled.css +19 -0
- package/dist/cjs/components/Agent/ActionsCompiled.js +140 -0
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +2 -4
- package/dist/cjs/components/Agent/AgentProfileCard.js +8 -1
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +242 -0
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +2 -1
- package/dist/cjs/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
- package/dist/cjs/components/Agent/AgentProfileCardWrapper.js +9 -8
- package/dist/cjs/components/Agent/ConversationStarters.js +2 -4
- package/dist/cjs/components/Error/ErrorMessage.js +20 -9
- package/dist/cjs/components/Team/TeamProfileCardTrigger.js +3 -3
- package/dist/cjs/components/User/OverflowProfileCardButtons.js +22 -7
- package/dist/cjs/components/User/ProfileCard.js +80 -28
- package/dist/cjs/components/User/ProfileCardDetails.compiled.css +0 -1
- package/dist/cjs/components/User/ProfileCardDetails.js +4 -5
- package/dist/cjs/components/User/ProfileCardResourced.js +40 -16
- package/dist/cjs/components/User/ProfileCardTrigger.js +52 -12
- package/dist/cjs/components/User/ReportingLinesDetails.js +40 -12
- package/dist/cjs/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
- package/dist/cjs/components/User/ReportingLinesDetailsCompiled.js +109 -0
- package/dist/cjs/components/User/UserLoadingState.js +15 -3
- package/dist/cjs/components/common/LoadingState.js +17 -3
- package/dist/cjs/components/common/ProfileCardTrigger.js +29 -7
- package/dist/cjs/components/common/ProfileCardWrapper.compiled.css +1 -0
- package/dist/cjs/components/common/ProfileCardWrapper.js +12 -9
- package/dist/cjs/components/team-profile-card/team-actions/more-actions/index.js +2 -4
- package/dist/cjs/styled/CoverImage.compiled.css +2 -0
- package/dist/cjs/styled/CoverImage.js +4 -2
- package/dist/cjs/styled/Error.compiled.css +0 -2
- package/dist/cjs/styled/Error.js +5 -3
- package/dist/cjs/util/analytics.js +7 -3
- package/dist/es2019/client/ProfileCardClient.js +2 -2
- package/dist/es2019/client/UserProfileCardClient.js +50 -13
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/Actions.js +5 -2
- package/dist/es2019/components/Agent/ActionsCompiled.compiled.css +19 -0
- package/dist/es2019/components/Agent/ActionsCompiled.js +116 -0
- package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +1 -2
- package/dist/es2019/components/Agent/AgentProfileCard.js +8 -1
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +186 -0
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +2 -1
- package/dist/es2019/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
- package/dist/es2019/components/Agent/AgentProfileCardWrapper.js +8 -7
- package/dist/es2019/components/Agent/ConversationStarters.js +1 -3
- package/dist/es2019/components/Error/ErrorMessage.js +18 -8
- package/dist/es2019/components/Team/TeamProfileCardTrigger.js +1 -2
- package/dist/es2019/components/User/OverflowProfileCardButtons.js +18 -7
- package/dist/es2019/components/User/ProfileCard.js +72 -25
- package/dist/es2019/components/User/ProfileCardDetails.compiled.css +0 -1
- package/dist/es2019/components/User/ProfileCardDetails.js +3 -5
- package/dist/es2019/components/User/ProfileCardResourced.js +25 -4
- package/dist/es2019/components/User/ProfileCardTrigger.js +54 -13
- package/dist/es2019/components/User/ReportingLinesDetails.js +34 -10
- package/dist/es2019/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
- package/dist/es2019/components/User/ReportingLinesDetailsCompiled.js +96 -0
- package/dist/es2019/components/User/UserLoadingState.js +14 -4
- package/dist/es2019/components/common/LoadingState.js +16 -4
- package/dist/es2019/components/common/ProfileCardTrigger.js +26 -7
- package/dist/es2019/components/common/ProfileCardWrapper.compiled.css +1 -0
- package/dist/es2019/components/common/ProfileCardWrapper.js +11 -8
- package/dist/es2019/components/team-profile-card/team-actions/more-actions/index.js +1 -2
- package/dist/es2019/styled/CoverImage.compiled.css +2 -0
- package/dist/es2019/styled/CoverImage.js +4 -2
- package/dist/es2019/styled/Error.compiled.css +0 -2
- package/dist/es2019/styled/Error.js +6 -4
- package/dist/es2019/util/analytics.js +6 -2
- package/dist/esm/client/ProfileCardClient.js +2 -2
- package/dist/esm/client/UserProfileCardClient.js +46 -12
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/Actions.js +5 -2
- package/dist/esm/components/Agent/ActionsCompiled.compiled.css +19 -0
- package/dist/esm/components/Agent/ActionsCompiled.js +131 -0
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +1 -2
- package/dist/esm/components/Agent/AgentProfileCard.js +8 -1
- package/dist/esm/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
- package/dist/esm/components/Agent/AgentProfileCardCompiled.js +233 -0
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +2 -1
- package/dist/esm/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
- package/dist/esm/components/Agent/AgentProfileCardWrapper.js +8 -7
- package/dist/esm/components/Agent/ConversationStarters.js +1 -3
- package/dist/esm/components/Error/ErrorMessage.js +20 -8
- package/dist/esm/components/Team/TeamProfileCardTrigger.js +1 -2
- package/dist/esm/components/User/OverflowProfileCardButtons.js +23 -8
- package/dist/esm/components/User/ProfileCard.js +80 -28
- package/dist/esm/components/User/ProfileCardDetails.compiled.css +0 -1
- package/dist/esm/components/User/ProfileCardDetails.js +3 -5
- package/dist/esm/components/User/ProfileCardResourced.js +40 -16
- package/dist/esm/components/User/ProfileCardTrigger.js +53 -13
- package/dist/esm/components/User/ReportingLinesDetails.js +41 -12
- package/dist/esm/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
- package/dist/esm/components/User/ReportingLinesDetailsCompiled.js +102 -0
- package/dist/esm/components/User/UserLoadingState.js +16 -4
- package/dist/esm/components/common/LoadingState.js +18 -4
- package/dist/esm/components/common/ProfileCardTrigger.js +30 -8
- package/dist/esm/components/common/ProfileCardWrapper.compiled.css +1 -0
- package/dist/esm/components/common/ProfileCardWrapper.js +11 -8
- package/dist/esm/components/team-profile-card/team-actions/more-actions/index.js +1 -2
- package/dist/esm/styled/CoverImage.compiled.css +2 -0
- package/dist/esm/styled/CoverImage.js +4 -2
- package/dist/esm/styled/Error.compiled.css +0 -2
- package/dist/esm/styled/Error.js +6 -4
- package/dist/esm/util/analytics.js +6 -2
- package/dist/types/client/ProfileCardClient.d.ts +2 -1
- package/dist/types/client/UserProfileCardClient.d.ts +2 -1
- package/dist/types/components/Agent/Actions.d.ts +10 -1
- package/dist/types/components/Agent/ActionsCompiled.d.ts +14 -0
- package/dist/types/components/Agent/AgentProfileCard.d.ts +13 -3
- package/dist/types/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
- package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +12 -1
- package/dist/types/components/Error/ErrorMessage.d.ts +2 -0
- package/dist/types/components/User/ProfileCard.d.ts +3 -2
- package/dist/types/components/User/ProfileCardResourced.d.ts +4 -2
- package/dist/types/components/User/ReportingLinesDetails.d.ts +2 -2
- package/dist/types/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
- package/dist/types/components/User/UserLoadingState.d.ts +3 -1
- package/dist/types/components/User/lazyProfileCard.d.ts +1 -1
- package/dist/types/components/common/LoadingState.d.ts +3 -1
- package/dist/types/components/common/ProfileCardWrapper.d.ts +2 -1
- package/dist/types/components/common/types.d.ts +3 -0
- package/dist/types/types.d.ts +13 -6
- package/dist/types/util/analytics.d.ts +5 -0
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +2 -1
- package/dist/types-ts4.5/client/UserProfileCardClient.d.ts +2 -1
- package/dist/types-ts4.5/components/Agent/Actions.d.ts +10 -1
- package/dist/types-ts4.5/components/Agent/ActionsCompiled.d.ts +14 -0
- package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +13 -3
- package/dist/types-ts4.5/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
- package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +12 -1
- package/dist/types-ts4.5/components/Error/ErrorMessage.d.ts +2 -0
- package/dist/types-ts4.5/components/User/ProfileCard.d.ts +3 -2
- package/dist/types-ts4.5/components/User/ProfileCardResourced.d.ts +4 -2
- package/dist/types-ts4.5/components/User/ReportingLinesDetails.d.ts +2 -2
- package/dist/types-ts4.5/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
- package/dist/types-ts4.5/components/User/UserLoadingState.d.ts +3 -1
- package/dist/types-ts4.5/components/User/lazyProfileCard.d.ts +1 -1
- package/dist/types-ts4.5/components/common/LoadingState.d.ts +3 -1
- package/dist/types-ts4.5/components/common/ProfileCardWrapper.d.ts +2 -1
- package/dist/types-ts4.5/components/common/types.d.ts +3 -0
- package/dist/types-ts4.5/types.d.ts +13 -6
- package/dist/types-ts4.5/util/analytics.d.ts +5 -0
- package/package.json +20 -9
|
@@ -13,6 +13,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
13
13
|
import React, { Suspense } from 'react';
|
|
14
14
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
15
15
|
import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
16
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
17
|
+
import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
|
|
16
18
|
import filterActions from '../../internal/filterActions';
|
|
17
19
|
import { CardWrapper } from '../../styled/UserTrigger';
|
|
18
20
|
import { fireEvent } from '../../util/analytics';
|
|
@@ -48,10 +50,23 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
48
50
|
fireEvent(_this.props.createAnalyticsEvent, payload);
|
|
49
51
|
}
|
|
50
52
|
});
|
|
53
|
+
_defineProperty(_this, "fireAnalyticsNext", function (eventKey) {
|
|
54
|
+
// Don't fire analytics if the component is unmounted
|
|
55
|
+
if (!_this._isMounted) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (_this.props.fireEvent) {
|
|
59
|
+
var _this$props;
|
|
60
|
+
for (var _len2 = arguments.length, attributes = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
61
|
+
attributes[_key2 - 1] = arguments[_key2];
|
|
62
|
+
}
|
|
63
|
+
(_this$props = _this.props).fireEvent.apply(_this$props, [eventKey].concat(attributes));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
51
66
|
_defineProperty(_this, "clientFetchProfile", function () {
|
|
52
|
-
var _this$
|
|
53
|
-
cloudId = _this$
|
|
54
|
-
userId = _this$
|
|
67
|
+
var _this$props2 = _this.props,
|
|
68
|
+
cloudId = _this$props2.cloudId,
|
|
69
|
+
userId = _this$props2.userId;
|
|
55
70
|
var isLoading = _this.state.isLoading;
|
|
56
71
|
if (isLoading === true) {
|
|
57
72
|
// don't fetch data when fetching is in process
|
|
@@ -62,7 +77,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
62
77
|
hasError: false,
|
|
63
78
|
data: null
|
|
64
79
|
}, function () {
|
|
65
|
-
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl({
|
|
80
|
+
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics, _this.fireAnalyticsNext), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl({
|
|
66
81
|
withOrgContext: true,
|
|
67
82
|
withSiteContext: true
|
|
68
83
|
})]);
|
|
@@ -101,10 +116,10 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
116
|
}, {
|
|
102
117
|
key: "componentDidUpdate",
|
|
103
118
|
value: function componentDidUpdate(prevProps) {
|
|
104
|
-
var _this$
|
|
105
|
-
userId = _this$
|
|
106
|
-
cloudId = _this$
|
|
107
|
-
resourceClient = _this$
|
|
119
|
+
var _this$props3 = this.props,
|
|
120
|
+
userId = _this$props3.userId,
|
|
121
|
+
cloudId = _this$props3.cloudId,
|
|
122
|
+
resourceClient = _this$props3.resourceClient;
|
|
108
123
|
if (userId !== prevProps.userId || cloudId !== prevProps.cloudId || resourceClient !== prevProps.resourceClient) {
|
|
109
124
|
this.setState({
|
|
110
125
|
isLoading: undefined
|
|
@@ -154,15 +169,16 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
154
169
|
reportingLinesData = _this$state.reportingLinesData,
|
|
155
170
|
isKudosEnabled = _this$state.isKudosEnabled,
|
|
156
171
|
teamCentralBaseUrl = _this$state.teamCentralBaseUrl;
|
|
157
|
-
var _this$
|
|
158
|
-
onReportingLinesClick = _this$
|
|
159
|
-
cloudId = _this$
|
|
160
|
-
userId = _this$
|
|
161
|
-
addFlag = _this$
|
|
172
|
+
var _this$props4 = this.props,
|
|
173
|
+
onReportingLinesClick = _this$props4.onReportingLinesClick,
|
|
174
|
+
cloudId = _this$props4.cloudId,
|
|
175
|
+
userId = _this$props4.userId,
|
|
176
|
+
addFlag = _this$props4.addFlag;
|
|
162
177
|
var isFetchingOrNotStartToFetchYet = isLoading === true || isLoading === undefined;
|
|
163
178
|
if (isFetchingOrNotStartToFetchYet) {
|
|
164
179
|
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(UserLoadingState, {
|
|
165
|
-
fireAnalytics: this.fireAnalytics
|
|
180
|
+
fireAnalytics: this.fireAnalytics,
|
|
181
|
+
fireAnalyticsNext: this.fireAnalyticsNext
|
|
166
182
|
}));
|
|
167
183
|
} else if (hasError) {
|
|
168
184
|
return /*#__PURE__*/React.createElement(CardWrapper, {
|
|
@@ -170,7 +186,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
170
186
|
}, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
171
187
|
errorType: error,
|
|
172
188
|
reload: this.clientFetchProfile,
|
|
173
|
-
fireAnalytics: this.fireAnalytics
|
|
189
|
+
fireAnalytics: this.fireAnalytics,
|
|
190
|
+
fireAnalyticsNext: this.fireAnalyticsNext
|
|
174
191
|
}));
|
|
175
192
|
}
|
|
176
193
|
var newProps = _objectSpread(_objectSpread({
|
|
@@ -210,4 +227,11 @@ _defineProperty(ProfileCardResourced, "defaultProps", {
|
|
|
210
227
|
actions: []
|
|
211
228
|
});
|
|
212
229
|
export var ProfileCardResourcedInternal = ProfileCardResourced;
|
|
213
|
-
|
|
230
|
+
var ProfileCardResourcedWithAnalytics = function ProfileCardResourcedWithAnalytics(props) {
|
|
231
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
232
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
233
|
+
return /*#__PURE__*/React.createElement(ProfileCardResourced, _extends({
|
|
234
|
+
fireEvent: fireEvent
|
|
235
|
+
}, props));
|
|
236
|
+
};
|
|
237
|
+
export default componentWithFG('ptc-enable-profile-card-analytics-refactor', ProfileCardResourcedWithAnalytics, withAnalyticsEvents()(ProfileCardResourced));
|
|
@@ -21,12 +21,14 @@ import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Popup from '@atlaskit/popup';
|
|
23
23
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
24
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
24
25
|
import { layers } from '@atlaskit/theme/constants';
|
|
25
26
|
import filterActionsInner from '../../internal/filterActions';
|
|
26
27
|
import getLabelMessage from '../../internal/getLabelMessage';
|
|
27
28
|
import { CardWrapper } from '../../styled/UserTrigger';
|
|
28
|
-
import { cardTriggered, fireEvent } from '../../util/analytics';
|
|
29
|
+
import { cardTriggered, fireEvent, PACKAGE_META_DATA } from '../../util/analytics';
|
|
29
30
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
|
|
31
|
+
import { getPageTime } from '../../util/performance';
|
|
30
32
|
import { AgentProfileCardResourced } from '../Agent/AgentProfileCardResourced';
|
|
31
33
|
import { ProfileCardLazy } from './lazyProfileCard';
|
|
32
34
|
import UserLoadingState from './UserLoadingState';
|
|
@@ -147,6 +149,8 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
147
149
|
isTriggeredUsingKeyboard = _useState18[0],
|
|
148
150
|
setTriggeredUsingKeyboard = _useState18[1];
|
|
149
151
|
var triggerRef = useRef(null);
|
|
152
|
+
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
153
|
+
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
150
154
|
useEffect(function () {
|
|
151
155
|
isMounted.current = true;
|
|
152
156
|
return function () {
|
|
@@ -165,6 +169,17 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
165
169
|
setShouldShowGiveKudos(false);
|
|
166
170
|
setTeamCentralBaseUrl(undefined);
|
|
167
171
|
}, [userId]);
|
|
172
|
+
|
|
173
|
+
// Create a wrapper function that has the same interface as fireEventNext but includes isMounted check
|
|
174
|
+
var fireAnalyticsNext = useCallback(function (eventKey) {
|
|
175
|
+
if (!isMounted.current) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
for (var _len = arguments.length, attributes = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
179
|
+
attributes[_key - 1] = arguments[_key];
|
|
180
|
+
}
|
|
181
|
+
fireEventNext.apply(void 0, [eventKey].concat(attributes));
|
|
182
|
+
}, [fireEventNext]);
|
|
168
183
|
var fireAnalytics = useCallback(function (payload) {
|
|
169
184
|
// Don't fire any analytics if the component is unmounted
|
|
170
185
|
if (!isMounted.current) {
|
|
@@ -228,7 +243,7 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
228
243
|
setError(null);
|
|
229
244
|
setData(null);
|
|
230
245
|
_context.prev = 6;
|
|
231
|
-
requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
|
|
246
|
+
requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics, fireAnalyticsNext), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
|
|
232
247
|
withOrgContext: true,
|
|
233
248
|
withSiteContext: true
|
|
234
249
|
})]);
|
|
@@ -248,7 +263,7 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
248
263
|
return _context.stop();
|
|
249
264
|
}
|
|
250
265
|
}, _callee, null, [[6, 14]]);
|
|
251
|
-
})), [cloudId, fireAnalytics, isLoading, resourceClient, userId, handleClientSuccess, handleClientError]);
|
|
266
|
+
})), [cloudId, fireAnalytics, fireAnalyticsNext, isLoading, resourceClient, userId, handleClientSuccess, handleClientError]);
|
|
252
267
|
var showProfilecard = useCallback(function () {
|
|
253
268
|
clearTimeout(hideTimer.current);
|
|
254
269
|
clearTimeout(showTimer.current);
|
|
@@ -267,25 +282,46 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
267
282
|
event.stopPropagation();
|
|
268
283
|
showProfilecard();
|
|
269
284
|
if (!visible) {
|
|
270
|
-
|
|
285
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
286
|
+
fireAnalyticsNext('ui.profilecard.triggered', _objectSpread({
|
|
287
|
+
method: 'click',
|
|
288
|
+
firedAt: Math.round(getPageTime())
|
|
289
|
+
}, PACKAGE_META_DATA));
|
|
290
|
+
} else {
|
|
291
|
+
fireAnalytics(cardTriggered('user', 'click'));
|
|
292
|
+
}
|
|
271
293
|
}
|
|
272
|
-
}, [fireAnalytics, showProfilecard, visible]);
|
|
294
|
+
}, [fireAnalytics, fireAnalyticsNext, showProfilecard, visible]);
|
|
273
295
|
var onMouseEnter = useCallback(function () {
|
|
274
296
|
showProfilecard();
|
|
275
297
|
if (!visible) {
|
|
276
|
-
|
|
298
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
299
|
+
fireAnalyticsNext('ui.profilecard.triggered', _objectSpread({
|
|
300
|
+
method: 'hover',
|
|
301
|
+
firedAt: Math.round(getPageTime())
|
|
302
|
+
}, PACKAGE_META_DATA));
|
|
303
|
+
} else {
|
|
304
|
+
fireAnalytics(cardTriggered('user', 'hover'));
|
|
305
|
+
}
|
|
277
306
|
}
|
|
278
|
-
}, [fireAnalytics, showProfilecard, visible]);
|
|
307
|
+
}, [fireAnalytics, fireAnalyticsNext, showProfilecard, visible]);
|
|
279
308
|
var onKeyPress = useCallback(function (event) {
|
|
280
309
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
281
310
|
event.preventDefault();
|
|
282
311
|
setTriggeredUsingKeyboard(true);
|
|
283
312
|
showProfilecard();
|
|
284
313
|
if (!visible) {
|
|
285
|
-
|
|
314
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
315
|
+
fireAnalyticsNext('ui.profilecard.triggered', _objectSpread({
|
|
316
|
+
method: 'click',
|
|
317
|
+
firedAt: Math.round(getPageTime())
|
|
318
|
+
}, PACKAGE_META_DATA));
|
|
319
|
+
} else {
|
|
320
|
+
fireAnalytics(cardTriggered('user', 'click'));
|
|
321
|
+
}
|
|
286
322
|
}
|
|
287
323
|
}
|
|
288
|
-
}, [fireAnalytics, showProfilecard, visible]);
|
|
324
|
+
}, [fireAnalytics, fireAnalyticsNext, showProfilecard, visible]);
|
|
289
325
|
var onFocus = useCallback(function () {
|
|
290
326
|
showProfilecard();
|
|
291
327
|
}, [showProfilecard]);
|
|
@@ -365,7 +401,8 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
365
401
|
offset: offset !== null && offset !== void 0 ? offset : [0, 8],
|
|
366
402
|
content: function content() {
|
|
367
403
|
return /*#__PURE__*/React.createElement("div", wrapperProps, showLoading ? /*#__PURE__*/React.createElement(LoadingView, {
|
|
368
|
-
fireAnalytics: fireAnalytics
|
|
404
|
+
fireAnalytics: fireAnalytics,
|
|
405
|
+
fireAnalyticsNext: fireAnalyticsNext
|
|
369
406
|
}) : visible && /*#__PURE__*/React.createElement(ProfileCardContent, {
|
|
370
407
|
profilecardProps: profilecardProps,
|
|
371
408
|
isAgent: !!(data !== null && data !== void 0 && data.isAgent),
|
|
@@ -440,7 +477,8 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
440
477
|
offset: offset !== null && offset !== void 0 ? offset : [0, 8],
|
|
441
478
|
content: function content() {
|
|
442
479
|
return /*#__PURE__*/React.createElement("div", wrapperProps, showLoading ? /*#__PURE__*/React.createElement(LoadingView, {
|
|
443
|
-
fireAnalytics: fireAnalytics
|
|
480
|
+
fireAnalytics: fireAnalytics,
|
|
481
|
+
fireAnalyticsNext: fireAnalyticsNext
|
|
444
482
|
}) : visible && /*#__PURE__*/React.createElement(ProfileCardContent, {
|
|
445
483
|
profilecardProps: profilecardProps,
|
|
446
484
|
isAgent: !!(data !== null && data !== void 0 && data.isAgent),
|
|
@@ -506,10 +544,12 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
506
544
|
})));
|
|
507
545
|
}
|
|
508
546
|
var LoadingView = function LoadingView(_ref4) {
|
|
509
|
-
var fireAnalytics = _ref4.fireAnalytics
|
|
547
|
+
var fireAnalytics = _ref4.fireAnalytics,
|
|
548
|
+
fireAnalyticsNext = _ref4.fireAnalyticsNext;
|
|
510
549
|
return /*#__PURE__*/React.createElement(CardWrapper, {
|
|
511
550
|
testId: "profilecard.profilecardtrigger.loading"
|
|
512
551
|
}, /*#__PURE__*/React.createElement(UserLoadingState, {
|
|
513
|
-
fireAnalytics: fireAnalytics
|
|
552
|
+
fireAnalytics: fireAnalytics,
|
|
553
|
+
fireAnalyticsNext: fireAnalyticsNext
|
|
514
554
|
}));
|
|
515
555
|
};
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
/* ReportingLinesDetails.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import "./ReportingLinesDetails.compiled.css";
|
|
3
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
7
|
import React from 'react';
|
|
5
8
|
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
6
9
|
import Avatar from '@atlaskit/avatar';
|
|
7
10
|
import AvatarGroup from '@atlaskit/avatar-group';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
8
13
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
9
14
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
10
15
|
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
11
16
|
import messages from '../../messages';
|
|
12
17
|
import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
|
|
13
|
-
import { reportingLinesClicked } from '../../util/analytics';
|
|
18
|
+
import { PACKAGE_META_DATA, reportingLinesClicked } from '../../util/analytics';
|
|
19
|
+
import { getPageTime } from '../../util/performance';
|
|
20
|
+
import { default as ReportingLinesDetailsCompiled } from './ReportingLinesDetailsCompiled';
|
|
14
21
|
function getProfileHref(userId, profileUrl) {
|
|
15
22
|
return profileUrl ? profileUrl + userId : undefined;
|
|
16
23
|
}
|
|
@@ -32,6 +39,7 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
32
39
|
var _useIntl = useIntl(),
|
|
33
40
|
formatMessage = _useIntl.formatMessage;
|
|
34
41
|
var fireAnalyticsWithDuration = props.fireAnalyticsWithDuration,
|
|
42
|
+
fireAnalyticsWithDurationNext = props.fireAnalyticsWithDurationNext,
|
|
35
43
|
_props$reportingLines = props.reportingLines,
|
|
36
44
|
reportingLines = _props$reportingLines === void 0 ? {} : _props$reportingLines,
|
|
37
45
|
reportingLinesProfileUrl = props.reportingLinesProfileUrl,
|
|
@@ -44,12 +52,22 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
44
52
|
var hasReports = reports.length > 0;
|
|
45
53
|
var getReportingLinesOnClick = function getReportingLinesOnClick(user, userType) {
|
|
46
54
|
return onReportingLinesClick ? function () {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
56
|
+
fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', function (duration) {
|
|
57
|
+
return _objectSpread({
|
|
58
|
+
duration: duration,
|
|
59
|
+
userType: userType,
|
|
60
|
+
firedAt: Math.round(getPageTime())
|
|
61
|
+
}, PACKAGE_META_DATA);
|
|
51
62
|
});
|
|
52
|
-
}
|
|
63
|
+
} else {
|
|
64
|
+
fireAnalyticsWithDuration(function (duration) {
|
|
65
|
+
return reportingLinesClicked({
|
|
66
|
+
duration: duration,
|
|
67
|
+
userType: userType
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
53
71
|
onReportingLinesClick(user);
|
|
54
72
|
} : undefined;
|
|
55
73
|
};
|
|
@@ -58,12 +76,22 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
58
76
|
if (onReportingLinesClick) {
|
|
59
77
|
shouldPreventDefault = onReportingLinesClick(user) === false;
|
|
60
78
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
80
|
+
fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', function (duration) {
|
|
81
|
+
return _objectSpread({
|
|
82
|
+
duration: duration,
|
|
83
|
+
userType: userType,
|
|
84
|
+
firedAt: Math.round(getPageTime())
|
|
85
|
+
}, PACKAGE_META_DATA);
|
|
65
86
|
});
|
|
66
|
-
}
|
|
87
|
+
} else {
|
|
88
|
+
fireAnalyticsWithDuration(function (duration) {
|
|
89
|
+
return reportingLinesClicked({
|
|
90
|
+
duration: duration,
|
|
91
|
+
userType: userType
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
67
95
|
if (shouldPreventDefault) {
|
|
68
96
|
return;
|
|
69
97
|
}
|
|
@@ -107,4 +135,5 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
107
135
|
showMoreButtonProps: showMoreButtonProps
|
|
108
136
|
})));
|
|
109
137
|
};
|
|
110
|
-
|
|
138
|
+
var ReportingLinesDetailsExport = componentWithFG('profilecard_primitives_compiled', ReportingLinesDetailsCompiled, ReportingLinesDetails);
|
|
139
|
+
export default ReportingLinesDetailsExport;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
._11c81vhk{font:var(--ds-font-heading-xxsmall,normal 600 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._19bvze3t{padding-left:var(--ds-space-0,0)}
|
|
3
|
+
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
4
|
+
._ca0qze3t{padding-top:var(--ds-space-0,0)}
|
|
5
|
+
._k48p1pd9{font-weight:var(--ds-font-weight-semibold,600)}
|
|
6
|
+
._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
|
|
7
|
+
._otyru2gc{margin-bottom:var(--ds-space-100,8px)}
|
|
8
|
+
._otyrze3t{margin-bottom:var(--ds-space-0,0)}
|
|
9
|
+
._syaz1fxt{color:var(--ds-text,#172b4d)}
|
|
10
|
+
._u5f3ze3t{padding-right:var(--ds-space-0,0)}
|
|
11
|
+
._irr3166n:hover{background-color:var(--ds-background-neutral-subtle-hovered,#091e420f)}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* ReportingLinesDetailsCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./ReportingLinesDetailsCompiled.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
6
|
+
import Avatar from '@atlaskit/avatar';
|
|
7
|
+
import AvatarGroup from '@atlaskit/avatar-group';
|
|
8
|
+
import { cx } from '@atlaskit/css';
|
|
9
|
+
import { Box, Pressable } from '@atlaskit/primitives/compiled';
|
|
10
|
+
import messages from '../../messages';
|
|
11
|
+
import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
|
|
12
|
+
import { reportingLinesClicked } from '../../util/analytics';
|
|
13
|
+
function getProfileHref(userId, profileUrl) {
|
|
14
|
+
return profileUrl ? profileUrl + userId : undefined;
|
|
15
|
+
}
|
|
16
|
+
var styles = {
|
|
17
|
+
reportingLinesButton: "_ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _bfhksm61 _irr3166n",
|
|
18
|
+
reportingLinesHeadingDefaultStyles: "_11c81vhk _syaz1fxt _k48p1pd9 _otyru2gc",
|
|
19
|
+
reportingLinesHeadingStyles: "_otyrze3t"
|
|
20
|
+
};
|
|
21
|
+
var avatarGroupMaxCount = 5;
|
|
22
|
+
var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
23
|
+
var _manager$pii, _manager$pii2;
|
|
24
|
+
var _useIntl = useIntl(),
|
|
25
|
+
formatMessage = _useIntl.formatMessage;
|
|
26
|
+
var fireAnalyticsWithDuration = props.fireAnalyticsWithDuration,
|
|
27
|
+
_props$reportingLines = props.reportingLines,
|
|
28
|
+
reportingLines = _props$reportingLines === void 0 ? {} : _props$reportingLines,
|
|
29
|
+
reportingLinesProfileUrl = props.reportingLinesProfileUrl,
|
|
30
|
+
onReportingLinesClick = props.onReportingLinesClick;
|
|
31
|
+
var _reportingLines$manag = reportingLines.managers,
|
|
32
|
+
managers = _reportingLines$manag === void 0 ? [] : _reportingLines$manag,
|
|
33
|
+
_reportingLines$repor = reportingLines.reports,
|
|
34
|
+
reports = _reportingLines$repor === void 0 ? [] : _reportingLines$repor;
|
|
35
|
+
var manager = managers.length >= 1 ? managers[0] : undefined;
|
|
36
|
+
var hasReports = reports.length > 0;
|
|
37
|
+
var getReportingLinesOnClick = function getReportingLinesOnClick(user, userType) {
|
|
38
|
+
return onReportingLinesClick ? function () {
|
|
39
|
+
fireAnalyticsWithDuration(function (duration) {
|
|
40
|
+
return reportingLinesClicked({
|
|
41
|
+
duration: duration,
|
|
42
|
+
userType: userType
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
onReportingLinesClick(user);
|
|
46
|
+
} : undefined;
|
|
47
|
+
};
|
|
48
|
+
var onReportingLinksClick = function onReportingLinksClick(user, userType, href) {
|
|
49
|
+
var shouldPreventDefault = false;
|
|
50
|
+
if (onReportingLinesClick) {
|
|
51
|
+
shouldPreventDefault = onReportingLinesClick(user) === false;
|
|
52
|
+
}
|
|
53
|
+
fireAnalyticsWithDuration(function (duration) {
|
|
54
|
+
return reportingLinesClicked({
|
|
55
|
+
duration: duration,
|
|
56
|
+
userType: userType
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
if (shouldPreventDefault) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (href) {
|
|
63
|
+
window.location.href = href;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var showMoreButtonProps = {
|
|
67
|
+
'aria-label': formatMessage(messages.profileCardMoreReportingLinesLabel, {
|
|
68
|
+
count: reports.length - avatarGroupMaxCount + 1
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, manager && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(Box, {
|
|
72
|
+
xcss: cx(styles.reportingLinesHeadingDefaultStyles, styles.reportingLinesHeadingStyles)
|
|
73
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.managerSectionHeading)), /*#__PURE__*/React.createElement(OffsetWrapper, null, /*#__PURE__*/React.createElement(Pressable, {
|
|
74
|
+
onClick: function onClick() {
|
|
75
|
+
return onReportingLinksClick(manager, 'manager', getProfileHref(manager.accountIdentifier, reportingLinesProfileUrl));
|
|
76
|
+
},
|
|
77
|
+
isDisabled: !onReportingLinesClick,
|
|
78
|
+
xcss: styles.reportingLinesButton
|
|
79
|
+
}, /*#__PURE__*/React.createElement(ManagerSection, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
80
|
+
size: "xsmall",
|
|
81
|
+
src: (_manager$pii = manager.pii) === null || _manager$pii === void 0 ? void 0 : _manager$pii.picture
|
|
82
|
+
}), /*#__PURE__*/React.createElement(ManagerName, null, (_manager$pii2 = manager.pii) === null || _manager$pii2 === void 0 ? void 0 : _manager$pii2.name))))), hasReports && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(Box, {
|
|
83
|
+
xcss: styles.reportingLinesHeadingDefaultStyles
|
|
84
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.directReportsSectionHeading)), /*#__PURE__*/React.createElement(AvatarGroup, {
|
|
85
|
+
appearance: "stack",
|
|
86
|
+
size: "small",
|
|
87
|
+
data: reports.map(function (member) {
|
|
88
|
+
var _member$pii, _member$pii2;
|
|
89
|
+
return {
|
|
90
|
+
key: member.accountIdentifier,
|
|
91
|
+
name: ((_member$pii = member.pii) === null || _member$pii === void 0 ? void 0 : _member$pii.name) || '',
|
|
92
|
+
src: (_member$pii2 = member.pii) === null || _member$pii2 === void 0 ? void 0 : _member$pii2.picture,
|
|
93
|
+
href: getProfileHref(member.accountIdentifier, reportingLinesProfileUrl),
|
|
94
|
+
onClick: getReportingLinesOnClick(member, 'direct-report')
|
|
95
|
+
};
|
|
96
|
+
}),
|
|
97
|
+
maxCount: avatarGroupMaxCount,
|
|
98
|
+
testId: "profilecard-reports-avatar-group",
|
|
99
|
+
showMoreButtonProps: showMoreButtonProps
|
|
100
|
+
})));
|
|
101
|
+
};
|
|
102
|
+
export default ReportingLinesDetails;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import React, { useEffect } from 'react';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
6
|
import AkSpinner from '@atlaskit/spinner';
|
|
3
7
|
import { SpinnerContainer } from '../../styled/UserTrigger';
|
|
4
|
-
import { profileCardRendered } from '../../util/analytics';
|
|
8
|
+
import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
9
|
+
import { getPageTime } from '../../util/performance';
|
|
5
10
|
var UserLoadingState = function UserLoadingState(_ref) {
|
|
6
|
-
var fireAnalytics = _ref.fireAnalytics
|
|
11
|
+
var fireAnalytics = _ref.fireAnalytics,
|
|
12
|
+
fireAnalyticsNext = _ref.fireAnalyticsNext;
|
|
7
13
|
useEffect(function () {
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
15
|
+
fireAnalyticsNext('ui.profilecard.rendered.spinner', _objectSpread({
|
|
16
|
+
firedAt: Math.round(getPageTime())
|
|
17
|
+
}, PACKAGE_META_DATA));
|
|
18
|
+
} else {
|
|
19
|
+
fireAnalytics(profileCardRendered('user', 'spinner'));
|
|
20
|
+
}
|
|
21
|
+
}, [fireAnalytics, fireAnalyticsNext]);
|
|
10
22
|
return /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(AkSpinner, null));
|
|
11
23
|
};
|
|
12
24
|
export default UserLoadingState;
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import React, { useEffect } from 'react';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
6
|
import AkSpinner from '@atlaskit/spinner';
|
|
3
7
|
import { SpinnerContainer } from '../../styled/UserTrigger';
|
|
4
|
-
import { profileCardRendered } from '../../util/analytics';
|
|
8
|
+
import { getActionSubject, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
9
|
+
import { getPageTime } from '../../util/performance';
|
|
5
10
|
export var LoadingState = function LoadingState(_ref) {
|
|
6
11
|
var fireAnalytics = _ref.fireAnalytics,
|
|
12
|
+
fireAnalyticsNext = _ref.fireAnalyticsNext,
|
|
7
13
|
profileType = _ref.profileType;
|
|
8
14
|
useEffect(function () {
|
|
9
|
-
if (
|
|
10
|
-
|
|
15
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
16
|
+
if (fireAnalyticsNext) {
|
|
17
|
+
fireAnalyticsNext("ui.".concat(getActionSubject(profileType), ".rendered.spinner"), _objectSpread({
|
|
18
|
+
firedAt: Math.round(getPageTime())
|
|
19
|
+
}, PACKAGE_META_DATA));
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
if (fireAnalytics) {
|
|
23
|
+
fireAnalytics(profileCardRendered(profileType, 'spinner'));
|
|
24
|
+
}
|
|
11
25
|
}
|
|
12
|
-
}, [fireAnalytics, profileType]);
|
|
26
|
+
}, [fireAnalytics, fireAnalyticsNext, profileType]);
|
|
13
27
|
return /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(AkSpinner, null));
|
|
14
28
|
};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["trigger", "ariaLabelledBy", "children", "renderProfileCard", "fetchProfile", "disabledAriaAttributes", "profileCardType", "fireAnalytics"],
|
|
6
|
+
var _excluded = ["trigger", "ariaLabelledBy", "children", "renderProfileCard", "fetchProfile", "disabledAriaAttributes", "profileCardType", "testId", "fireAnalytics", "fireAnalyticsNext"],
|
|
6
7
|
_excluded2 = ["aria-expanded", "aria-haspopup"];
|
|
7
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
11
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
13
|
import Popup from '@atlaskit/popup';
|
|
10
14
|
import { layers } from '@atlaskit/theme/constants';
|
|
11
|
-
import { cardTriggered } from '../../util/analytics';
|
|
15
|
+
import { cardTriggered, getActionSubject, PACKAGE_META_DATA } from '../../util/analytics';
|
|
16
|
+
import { getPageTime } from '../../util/performance';
|
|
12
17
|
import { useProfileInfo } from '../../util/useProfileInfo';
|
|
13
18
|
import { LoadingState } from './LoadingState';
|
|
14
19
|
import { PopupTrigger } from './PopupTrigger';
|
|
@@ -24,7 +29,9 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
24
29
|
fetchProfile = _ref.fetchProfile,
|
|
25
30
|
disabledAriaAttributes = _ref.disabledAriaAttributes,
|
|
26
31
|
profileCardType = _ref.profileCardType,
|
|
32
|
+
testId = _ref.testId,
|
|
27
33
|
fireAnalytics = _ref.fireAnalytics,
|
|
34
|
+
fireAnalyticsNext = _ref.fireAnalyticsNext,
|
|
28
35
|
popupProps = _objectWithoutProperties(_ref, _excluded);
|
|
29
36
|
var showDelay = _trigger === 'click' ? 0 : DELAY_MS_SHOW;
|
|
30
37
|
var hideDelay = _trigger === 'click' ? 0 : DELAY_MS_HIDE;
|
|
@@ -69,8 +76,18 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
69
76
|
if (!visible) {
|
|
70
77
|
getProfileData === null || getProfileData === void 0 || getProfileData();
|
|
71
78
|
setVisible(true);
|
|
72
|
-
if (
|
|
73
|
-
|
|
79
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
80
|
+
if (fireAnalyticsNext) {
|
|
81
|
+
fireAnalyticsNext("ui.".concat(getActionSubject(profileCardType), ".triggered"), _objectSpread(_objectSpread({
|
|
82
|
+
method: _trigger
|
|
83
|
+
}, PACKAGE_META_DATA), {}, {
|
|
84
|
+
firedAt: Math.round(getPageTime())
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
if (fireAnalytics) {
|
|
89
|
+
fireAnalytics(cardTriggered(profileCardType, _trigger));
|
|
90
|
+
}
|
|
74
91
|
}
|
|
75
92
|
}
|
|
76
93
|
}, showDelay);
|
|
@@ -79,7 +96,7 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
79
96
|
return _context.stop();
|
|
80
97
|
}
|
|
81
98
|
}, _callee);
|
|
82
|
-
})), [showDelay, visible, getProfileData, fireAnalytics, profileCardType, _trigger]);
|
|
99
|
+
})), [showDelay, visible, getProfileData, fireAnalytics, profileCardType, _trigger, fireAnalyticsNext]);
|
|
83
100
|
var onMouseEnter = useCallback(function () {
|
|
84
101
|
showProfilecard();
|
|
85
102
|
}, [showProfilecard]);
|
|
@@ -100,7 +117,8 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
100
117
|
showProfilecard: showProfilecard,
|
|
101
118
|
children: children,
|
|
102
119
|
ariaLabelledBy: ariaLabelledBy,
|
|
103
|
-
trigger: _trigger
|
|
120
|
+
trigger: _trigger,
|
|
121
|
+
"data-testid": testId
|
|
104
122
|
}));
|
|
105
123
|
},
|
|
106
124
|
content: function content() {
|
|
@@ -110,9 +128,13 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
110
128
|
React.createElement("div", {
|
|
111
129
|
onMouseEnter: onMouseEnter,
|
|
112
130
|
onMouseLeave: hideProfilecard,
|
|
113
|
-
onFocus: showProfilecard
|
|
114
|
-
|
|
131
|
+
onFocus: showProfilecard,
|
|
132
|
+
"data-testid": "profile-card--trigger-content"
|
|
133
|
+
}, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, {
|
|
134
|
+
testId: "profilecard.profilecardtrigger.loading"
|
|
135
|
+
}, /*#__PURE__*/React.createElement(LoadingState, {
|
|
115
136
|
fireAnalytics: fireAnalytics,
|
|
137
|
+
fireAnalyticsNext: fireAnalyticsNext,
|
|
116
138
|
profileType: profileCardType
|
|
117
139
|
})) : renderProfileCard({
|
|
118
140
|
profileData: profileData,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._1bsb1gwv{width:360px}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
/* ProfileCardWrapper.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./ProfileCardWrapper.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
width: '360px'
|
|
7
|
-
});
|
|
5
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
|
+
var styles = {
|
|
7
|
+
wrapper: "_1bsb1gwv"
|
|
8
|
+
};
|
|
8
9
|
export var ProfileCardWrapper = function ProfileCardWrapper(_ref) {
|
|
9
|
-
var children = _ref.children
|
|
10
|
+
var children = _ref.children,
|
|
11
|
+
testId = _ref.testId;
|
|
10
12
|
return /*#__PURE__*/React.createElement(Box, {
|
|
11
|
-
xcss: styles
|
|
13
|
+
xcss: styles.wrapper,
|
|
14
|
+
testId: testId
|
|
12
15
|
}, children);
|
|
13
16
|
};
|