@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
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/* AgentProfileCardCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import "./AgentProfileCardCompiled.compiled.css";
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
import { useIntl } from 'react-intl-next';
|
|
9
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
+
import { Box, Stack } from '@atlaskit/primitives/compiled';
|
|
11
|
+
import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
|
|
12
|
+
import { fireEvent, profileCardRendered } from '../../util/analytics';
|
|
13
|
+
import { LoadingState } from '../common/LoadingState';
|
|
14
|
+
import { ErrorMessage } from '../Error';
|
|
15
|
+
import { AgentActions } from './Actions';
|
|
16
|
+
import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
|
|
17
|
+
import { ConversationStarters } from './ConversationStarters';
|
|
18
|
+
import { useAgentUrlActions } from './hooks/useAgentActions';
|
|
19
|
+
import { messages } from './messages';
|
|
20
|
+
var styles = {
|
|
21
|
+
detailWrapper: "_18zrpxbi _1q51xy5q",
|
|
22
|
+
avatarStyles: "_kqswstnw _154i1ejb _1ltvpxbi",
|
|
23
|
+
cardContainerStyles: "_2rko1mok _16qs1cd0 _kqswh2mm"
|
|
24
|
+
};
|
|
25
|
+
var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
26
|
+
var _agent$user_defined_c, _agent$external_confi, _agent$external_confi2, _agent$creatorInfo, _agent$creatorInfo2, _agent$creatorInfo3, _agent$creatorInfo4;
|
|
27
|
+
var agent = _ref.agent,
|
|
28
|
+
isLoading = _ref.isLoading,
|
|
29
|
+
cloudId = _ref.cloudId,
|
|
30
|
+
onChatClick = _ref.onChatClick,
|
|
31
|
+
hasError = _ref.hasError,
|
|
32
|
+
errorType = _ref.errorType,
|
|
33
|
+
onConversationStartersClick = _ref.onConversationStartersClick,
|
|
34
|
+
resourceClient = _ref.resourceClient,
|
|
35
|
+
addFlag = _ref.addFlag,
|
|
36
|
+
onDeleteAgent = _ref.onDeleteAgent;
|
|
37
|
+
var _useAgentUrlActions = useAgentUrlActions({
|
|
38
|
+
cloudId: cloudId || '',
|
|
39
|
+
source: 'agentProfileCard'
|
|
40
|
+
}),
|
|
41
|
+
_onEditAgent = _useAgentUrlActions.onEditAgent,
|
|
42
|
+
_onCopyAgent = _useAgentUrlActions.onCopyAgent,
|
|
43
|
+
_onDuplicateAgent = _useAgentUrlActions.onDuplicateAgent,
|
|
44
|
+
onOpenChatFullScreen = _useAgentUrlActions.onOpenChat,
|
|
45
|
+
onConversationStarter = _useAgentUrlActions.onConversationStarter,
|
|
46
|
+
onViewFullProfile = _useAgentUrlActions.onViewFullProfile;
|
|
47
|
+
var _useState = useState(false),
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
isStarred = _useState2[0],
|
|
50
|
+
setIsStarred = _useState2[1];
|
|
51
|
+
var _useState3 = useState(),
|
|
52
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
+
starCount = _useState4[0],
|
|
54
|
+
setStarCount = _useState4[1];
|
|
55
|
+
var _useIntl = useIntl(),
|
|
56
|
+
formatMessage = _useIntl.formatMessage;
|
|
57
|
+
var userDefinedConversationStarters = agent === null || agent === void 0 || (_agent$user_defined_c = agent.user_defined_conversation_starters) === null || _agent$user_defined_c === void 0 ? void 0 : _agent$user_defined_c.map(function (starter) {
|
|
58
|
+
return {
|
|
59
|
+
message: starter,
|
|
60
|
+
type: 'user-defined'
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
useEffect(function () {
|
|
64
|
+
setIsStarred(!!(agent !== null && agent !== void 0 && agent.favourite));
|
|
65
|
+
setStarCount(agent === null || agent === void 0 ? void 0 : agent.favourite_count);
|
|
66
|
+
}, [agent === null || agent === void 0 ? void 0 : agent.favourite, agent === null || agent === void 0 ? void 0 : agent.favourite_count]);
|
|
67
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
68
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
69
|
+
var fireAnalytics = useCallback(function (payload) {
|
|
70
|
+
if (createAnalyticsEvent) {
|
|
71
|
+
fireEvent(createAnalyticsEvent, payload);
|
|
72
|
+
}
|
|
73
|
+
}, [createAnalyticsEvent]);
|
|
74
|
+
var handleSetFavourite = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
75
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
76
|
+
while (1) switch (_context.prev = _context.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
if (!(agent !== null && agent !== void 0 && agent.id)) {
|
|
79
|
+
_context.next = 10;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
_context.prev = 1;
|
|
83
|
+
_context.next = 4;
|
|
84
|
+
return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
|
|
85
|
+
case 4:
|
|
86
|
+
if (isStarred) {
|
|
87
|
+
setStarCount(starCount ? starCount - 1 : 0);
|
|
88
|
+
} else {
|
|
89
|
+
setStarCount((starCount || 0) + 1);
|
|
90
|
+
}
|
|
91
|
+
setIsStarred(!isStarred);
|
|
92
|
+
_context.next = 10;
|
|
93
|
+
break;
|
|
94
|
+
case 8:
|
|
95
|
+
_context.prev = 8;
|
|
96
|
+
_context.t0 = _context["catch"](1);
|
|
97
|
+
case 10:
|
|
98
|
+
case "end":
|
|
99
|
+
return _context.stop();
|
|
100
|
+
}
|
|
101
|
+
}, _callee, null, [[1, 8]]);
|
|
102
|
+
})), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
|
|
103
|
+
var handleOnDelete = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
104
|
+
var _onDeleteAgent, restore;
|
|
105
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
106
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
if (!(agent && onDeleteAgent)) {
|
|
109
|
+
_context2.next = 12;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
// Optimistically remove from cache
|
|
113
|
+
_onDeleteAgent = onDeleteAgent(agent.id), restore = _onDeleteAgent.restore;
|
|
114
|
+
_context2.prev = 2;
|
|
115
|
+
_context2.next = 5;
|
|
116
|
+
return resourceClient.deleteAgent(agent.id, fireAnalytics);
|
|
117
|
+
case 5:
|
|
118
|
+
addFlag === null || addFlag === void 0 || addFlag({
|
|
119
|
+
title: formatMessage(messages.agentDeletedSuccessFlagTitle),
|
|
120
|
+
description: formatMessage(messages.agentDeletedSuccessFlagDescription, {
|
|
121
|
+
agentName: agent.name
|
|
122
|
+
}),
|
|
123
|
+
type: 'success',
|
|
124
|
+
id: 'ptc-directory.agent-profile.delete-agent-success'
|
|
125
|
+
});
|
|
126
|
+
_context2.next = 12;
|
|
127
|
+
break;
|
|
128
|
+
case 8:
|
|
129
|
+
_context2.prev = 8;
|
|
130
|
+
_context2.t0 = _context2["catch"](2);
|
|
131
|
+
// Restore agent to cache on error
|
|
132
|
+
restore();
|
|
133
|
+
addFlag === null || addFlag === void 0 || addFlag({
|
|
134
|
+
title: formatMessage(messages.agentDeletedErrorFlagTitle),
|
|
135
|
+
description: formatMessage(messages.agentDeletedErrorFlagDescription),
|
|
136
|
+
type: 'error',
|
|
137
|
+
id: 'ptc-directory.agent-profile.delete-agent-error'
|
|
138
|
+
});
|
|
139
|
+
case 12:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context2.stop();
|
|
142
|
+
}
|
|
143
|
+
}, _callee2, null, [[2, 8]]);
|
|
144
|
+
})), [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics]);
|
|
145
|
+
useEffect(function () {
|
|
146
|
+
if (!isLoading && agent) {
|
|
147
|
+
fireAnalytics(profileCardRendered('agent', 'content'));
|
|
148
|
+
}
|
|
149
|
+
}, [agent, fireAnalytics, isLoading]);
|
|
150
|
+
if (isLoading) {
|
|
151
|
+
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
|
|
152
|
+
profileType: "agent",
|
|
153
|
+
fireAnalytics: fireAnalytics
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
if (hasError || !agent) {
|
|
157
|
+
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
158
|
+
fireAnalyticsNext: function fireAnalyticsNext() {},
|
|
159
|
+
errorType: errorType,
|
|
160
|
+
fireAnalytics: fireAnalytics
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
|
|
164
|
+
xcss: styles.cardContainerStyles
|
|
165
|
+
}, /*#__PURE__*/React.createElement(AgentBanner, {
|
|
166
|
+
agentId: agent.id,
|
|
167
|
+
agentNamedId: (_agent$external_confi = agent.external_config_reference) !== null && _agent$external_confi !== void 0 ? _agent$external_confi : agent.named_id,
|
|
168
|
+
height: 96,
|
|
169
|
+
agentIdentityAccountId: agent.identity_account_id
|
|
170
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
171
|
+
xcss: styles.avatarStyles
|
|
172
|
+
}, /*#__PURE__*/React.createElement(AgentAvatar, {
|
|
173
|
+
agentId: agent.id,
|
|
174
|
+
agentNamedId: (_agent$external_confi2 = agent.external_config_reference) !== null && _agent$external_confi2 !== void 0 ? _agent$external_confi2 : agent.named_id,
|
|
175
|
+
agentIdentityAccountId: agent.identity_account_id,
|
|
176
|
+
size: "xlarge",
|
|
177
|
+
isForgeAgent: agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY',
|
|
178
|
+
forgeAgentIconUrl: agent.icon
|
|
179
|
+
})), /*#__PURE__*/React.createElement(Stack, {
|
|
180
|
+
space: "space.100",
|
|
181
|
+
xcss: styles.detailWrapper
|
|
182
|
+
}, /*#__PURE__*/React.createElement(AgentProfileInfo, {
|
|
183
|
+
agentName: agent.name,
|
|
184
|
+
isStarred: isStarred,
|
|
185
|
+
onStarToggle: handleSetFavourite,
|
|
186
|
+
isHidden: agent.visibility === 'PRIVATE',
|
|
187
|
+
creatorRender: ((_agent$creatorInfo = agent.creatorInfo) === null || _agent$creatorInfo === void 0 ? void 0 : _agent$creatorInfo.type) && /*#__PURE__*/React.createElement(AgentProfileCreator, {
|
|
188
|
+
creator: {
|
|
189
|
+
type: (_agent$creatorInfo2 = agent.creatorInfo) === null || _agent$creatorInfo2 === void 0 ? void 0 : _agent$creatorInfo2.type,
|
|
190
|
+
name: ((_agent$creatorInfo3 = agent.creatorInfo) === null || _agent$creatorInfo3 === void 0 ? void 0 : _agent$creatorInfo3.name) || '',
|
|
191
|
+
profileLink: ((_agent$creatorInfo4 = agent.creatorInfo) === null || _agent$creatorInfo4 === void 0 ? void 0 : _agent$creatorInfo4.profileLink) || ''
|
|
192
|
+
},
|
|
193
|
+
isLoading: false,
|
|
194
|
+
onCreatorLinkClick: function onCreatorLinkClick() {}
|
|
195
|
+
}),
|
|
196
|
+
starCountRender: /*#__PURE__*/React.createElement(AgentStarCount, {
|
|
197
|
+
starCount: starCount,
|
|
198
|
+
isLoading: false
|
|
199
|
+
}),
|
|
200
|
+
agentDescription: agent.description
|
|
201
|
+
}), /*#__PURE__*/React.createElement(ConversationStarters, {
|
|
202
|
+
isAgentDefault: agent.is_default,
|
|
203
|
+
userDefinedConversationStarters: userDefinedConversationStarters,
|
|
204
|
+
onConversationStarterClick: function onConversationStarterClick(conversationStarter) {
|
|
205
|
+
onConversationStartersClick ? onConversationStartersClick(conversationStarter) : onConversationStarter({
|
|
206
|
+
agentId: agent.id,
|
|
207
|
+
prompt: conversationStarter.message
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
})), /*#__PURE__*/React.createElement(AgentActions, {
|
|
211
|
+
agent: agent,
|
|
212
|
+
onEditAgent: function onEditAgent() {
|
|
213
|
+
return _onEditAgent(agent.id);
|
|
214
|
+
},
|
|
215
|
+
onCopyAgent: function onCopyAgent() {
|
|
216
|
+
return _onCopyAgent(agent.id);
|
|
217
|
+
},
|
|
218
|
+
onDuplicateAgent: function onDuplicateAgent() {
|
|
219
|
+
return _onDuplicateAgent(agent.id);
|
|
220
|
+
},
|
|
221
|
+
onDeleteAgent: handleOnDelete,
|
|
222
|
+
onChatClick: onChatClick ? function (event) {
|
|
223
|
+
return onChatClick(event);
|
|
224
|
+
} : function () {
|
|
225
|
+
return onOpenChatFullScreen(agent.id, agent.name);
|
|
226
|
+
},
|
|
227
|
+
resourceClient: resourceClient,
|
|
228
|
+
onViewFullProfileClick: function onViewFullProfileClick() {
|
|
229
|
+
return onViewFullProfile(agent.id);
|
|
230
|
+
}
|
|
231
|
+
})));
|
|
232
|
+
};
|
|
233
|
+
export default AgentProfileCard;
|
|
@@ -148,7 +148,8 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
148
148
|
fetchData();
|
|
149
149
|
},
|
|
150
150
|
errorType: error || null,
|
|
151
|
-
fireAnalytics: function fireAnalytics() {}
|
|
151
|
+
fireAnalytics: function fireAnalytics() {},
|
|
152
|
+
fireAnalyticsNext: function fireAnalyticsNext() {}
|
|
152
153
|
}));
|
|
153
154
|
}
|
|
154
155
|
return /*#__PURE__*/React.createElement(Suspense, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._1bsb1gwv{width:360px}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
/* AgentProfileCardWrapper.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import "./AgentProfileCardWrapper.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 AgentProfileCardWrapper = function AgentProfileCardWrapper(_ref) {
|
|
9
10
|
var children = _ref.children;
|
|
10
11
|
return /*#__PURE__*/React.createElement(Box, {
|
|
11
|
-
xcss: styles
|
|
12
|
+
xcss: styles.wrapper
|
|
12
13
|
}, children);
|
|
13
14
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
4
|
-
import { Stack } from '@atlaskit/primitives';
|
|
2
|
+
import { Stack } from '@atlaskit/primitives/compiled';
|
|
5
3
|
import { AgentConversationStarters } from '@atlaskit/rovo-agent-components';
|
|
6
4
|
export var ConversationStarters = function ConversationStarters(_ref) {
|
|
7
5
|
var isAgentDefault = _ref.isAgentDefault,
|
|
@@ -1,25 +1,37 @@
|
|
|
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';
|
|
2
5
|
import Button from '@atlaskit/button/new';
|
|
3
6
|
import CrossCircleIcon from '@atlaskit/icon/core/cross-circle';
|
|
4
7
|
import IconError from '@atlaskit/icon/glyph/cross-circle';
|
|
5
|
-
|
|
6
|
-
import { Text } from '@atlaskit/primitives';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
7
10
|
import { ErrorTitle, ErrorWrapper } from '../../styled/Error';
|
|
8
|
-
import { profileCardRendered } from '../../util/analytics';
|
|
11
|
+
import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
9
12
|
var ErrorMessage = function ErrorMessage(props) {
|
|
10
13
|
var errorType = props.errorType || {
|
|
11
14
|
reason: 'default'
|
|
12
15
|
};
|
|
13
16
|
var errorReason = errorType.reason;
|
|
14
17
|
var fireAnalytics = props.fireAnalytics,
|
|
18
|
+
fireAnalyticsNext = props.fireAnalyticsNext,
|
|
15
19
|
reload = props.reload;
|
|
16
20
|
var hasRetry = !!reload;
|
|
17
21
|
useEffect(function () {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
23
|
+
fireAnalyticsNext('ui.profilecard.rendered.error', _objectSpread({
|
|
24
|
+
hasRetry: hasRetry,
|
|
25
|
+
errorType: errorReason,
|
|
26
|
+
firedAt: Math.round(performance.now())
|
|
27
|
+
}, PACKAGE_META_DATA));
|
|
28
|
+
} else {
|
|
29
|
+
fireAnalytics(profileCardRendered('user', 'error', {
|
|
30
|
+
hasRetry: hasRetry,
|
|
31
|
+
errorType: errorReason
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}, [errorReason, fireAnalytics, fireAnalyticsNext, hasRetry]);
|
|
23
35
|
var errorContent = function errorContent() {
|
|
24
36
|
if (errorReason === 'NotFound') {
|
|
25
37
|
return /*#__PURE__*/React.createElement(ErrorTitle, null, "The user is no longer available for the site");
|
|
@@ -14,8 +14,7 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
14
14
|
import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
16
|
import Popup from '@atlaskit/popup';
|
|
17
|
-
|
|
18
|
-
import { Box } from '@atlaskit/primitives';
|
|
17
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
19
18
|
import { layers } from '@atlaskit/theme/constants';
|
|
20
19
|
import _filterActions from '../../internal/filterActions';
|
|
21
20
|
import messages from '../../messages';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
5
|
var _excluded = ["triggerRef", "isSelected", "testId"];
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
5
8
|
import React, { useCallback, useState } from 'react';
|
|
6
9
|
import { useIntl } from 'react-intl-next';
|
|
7
10
|
import { IconButton } from '@atlaskit/button/new';
|
|
@@ -10,7 +13,8 @@ import MoreIcon from '@atlaskit/icon/core/migration/show-more-horizontal--more';
|
|
|
10
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
14
|
import messages from '../../messages';
|
|
12
15
|
import { OverflowActionButtonsWrapper } from '../../styled/Card';
|
|
13
|
-
import { moreActionsClicked } from '../../util/analytics';
|
|
16
|
+
import { moreActionsClicked, PACKAGE_META_DATA } from '../../util/analytics';
|
|
17
|
+
import { getPageTime } from '../../util/performance';
|
|
14
18
|
export var ACTION_OVERFLOW_THRESHOLD = 2;
|
|
15
19
|
export var OverflowProfileCardButtons = function OverflowProfileCardButtons(props) {
|
|
16
20
|
var intl = useIntl();
|
|
@@ -19,22 +23,33 @@ export var OverflowProfileCardButtons = function OverflowProfileCardButtons(prop
|
|
|
19
23
|
setOpen = _useState2[1];
|
|
20
24
|
var actions = props.actions,
|
|
21
25
|
onItemClick = props.onItemClick,
|
|
22
|
-
fireAnalyticsWithDuration = props.fireAnalyticsWithDuration
|
|
26
|
+
fireAnalyticsWithDuration = props.fireAnalyticsWithDuration,
|
|
27
|
+
fireAnalyticsWithDurationNext = props.fireAnalyticsWithDurationNext;
|
|
23
28
|
var numActions = actions.length + ACTION_OVERFLOW_THRESHOLD;
|
|
24
29
|
var onOpenChange = useCallback(function (_ref) {
|
|
25
30
|
var nextOpen = _ref.isOpen;
|
|
26
31
|
setOpen(function (prevOpen) {
|
|
27
32
|
if (nextOpen && !prevOpen) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
34
|
+
fireAnalyticsWithDurationNext('ui.profilecard.clicked.moreActions', function (duration) {
|
|
35
|
+
return _objectSpread({
|
|
36
|
+
duration: duration,
|
|
37
|
+
numActions: numActions,
|
|
38
|
+
firedAt: Math.round(getPageTime())
|
|
39
|
+
}, PACKAGE_META_DATA);
|
|
32
40
|
});
|
|
33
|
-
}
|
|
41
|
+
} else {
|
|
42
|
+
fireAnalyticsWithDuration(function (duration) {
|
|
43
|
+
return moreActionsClicked('user', {
|
|
44
|
+
duration: duration,
|
|
45
|
+
numActions: numActions
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
34
49
|
}
|
|
35
50
|
return nextOpen;
|
|
36
51
|
});
|
|
37
|
-
}, [numActions, fireAnalyticsWithDuration]);
|
|
52
|
+
}, [numActions, fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
|
|
38
53
|
return /*#__PURE__*/React.createElement(OverflowActionButtonsWrapper, {
|
|
39
54
|
testId: "profilecard-actions-overflow"
|
|
40
55
|
}, /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
8
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
9
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
10
|
import Avatar from '@atlaskit/avatar';
|
|
8
11
|
import { LinkButton } from '@atlaskit/button/new';
|
|
9
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
10
14
|
import Spinner from '@atlaskit/spinner';
|
|
15
|
+
import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
|
|
11
16
|
import { N0 } from '@atlaskit/theme/colors';
|
|
12
17
|
import messages from '../../messages';
|
|
13
18
|
import { ActionButtonGroup, ActionsFlexSpacer, AnimatedKudosButton, AnimationWrapper, CardContainer, CardContent, KudosBlobAnimation, ProfileImage } from '../../styled/Card';
|
|
14
19
|
import { CardWrapper, SpinnerContainer } from '../../styled/UserTrigger';
|
|
15
|
-
import { actionClicked, fireEvent, profileCardRendered } from '../../util/analytics';
|
|
20
|
+
import { actionClicked, fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
16
21
|
import { isBasicClick } from '../../util/click';
|
|
17
22
|
import { getPageTime } from '../../util/performance';
|
|
18
23
|
import { ErrorMessage } from '../Error';
|
|
@@ -58,6 +63,8 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
|
|
|
58
63
|
_useState2 = _slicedToArray(_useState, 1),
|
|
59
64
|
openTime = _useState2[0];
|
|
60
65
|
var createAnalyticsEvent = props.createAnalyticsEvent;
|
|
66
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
67
|
+
fireEventNext = _useAnalyticsEvents.fireEvent;
|
|
61
68
|
var fireAnalytics = useCallback(function (payload) {
|
|
62
69
|
if (createAnalyticsEvent) {
|
|
63
70
|
fireEvent(createAnalyticsEvent, payload);
|
|
@@ -68,6 +75,11 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
|
|
|
68
75
|
var event = generator(elapsed);
|
|
69
76
|
fireAnalytics(event);
|
|
70
77
|
}, [fireAnalytics, openTime]);
|
|
78
|
+
var fireAnalyticsWithDurationNext = useCallback(function (eventKey, generator) {
|
|
79
|
+
var duration = getPageTime() - openTime;
|
|
80
|
+
var attributes = generator(duration);
|
|
81
|
+
fireEventNext(eventKey, attributes);
|
|
82
|
+
}, [openTime, fireEventNext]);
|
|
71
83
|
var _useKudos = useKudos(props.cloudId, props.userId, props.teamCentralBaseUrl, props.openKudosDrawer),
|
|
72
84
|
kudosAction = _useKudos.kudosAction;
|
|
73
85
|
var _props$actions = props.actions,
|
|
@@ -88,24 +100,36 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
|
|
|
88
100
|
var canRender = !hasError && !isLoading && !!(fullName || status === 'closed');
|
|
89
101
|
useEffect(function () {
|
|
90
102
|
if (canRender) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
104
|
+
fireAnalyticsWithDurationNext('ui.profilecard.rendered.content', function (duration) {
|
|
105
|
+
return _objectSpread({
|
|
106
|
+
duration: duration,
|
|
107
|
+
numActions: realActions.length,
|
|
108
|
+
firedAt: Math.round(getPageTime())
|
|
109
|
+
}, PACKAGE_META_DATA);
|
|
95
110
|
});
|
|
96
|
-
}
|
|
111
|
+
} else {
|
|
112
|
+
fireAnalyticsWithDuration(function (duration) {
|
|
113
|
+
return profileCardRendered('user', 'content', {
|
|
114
|
+
duration: duration,
|
|
115
|
+
numActions: realActions.length
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
97
119
|
}
|
|
98
|
-
}, [canRender, fireAnalyticsWithDuration, realActions]);
|
|
120
|
+
}, [canRender, fireAnalyticsWithDuration, fireAnalyticsWithDurationNext, realActions]);
|
|
99
121
|
if (hasError) {
|
|
100
122
|
return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
101
123
|
reload: props.clientFetchProfile,
|
|
102
124
|
errorType: props.errorType || null,
|
|
103
|
-
fireAnalytics: fireAnalytics
|
|
125
|
+
fireAnalytics: fireAnalytics,
|
|
126
|
+
fireAnalyticsNext: fireEventNext
|
|
104
127
|
}));
|
|
105
128
|
}
|
|
106
129
|
if (isLoading) {
|
|
107
130
|
return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(LoadingView, {
|
|
108
|
-
fireAnalyticsWithDuration: fireAnalyticsWithDuration
|
|
131
|
+
fireAnalyticsWithDuration: fireAnalyticsWithDuration,
|
|
132
|
+
fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
|
|
109
133
|
}));
|
|
110
134
|
}
|
|
111
135
|
if (!canRender) {
|
|
@@ -121,36 +145,53 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
|
|
|
121
145
|
borderColor: "var(--ds-shadow-overlay, ".concat(N0, ")")
|
|
122
146
|
})), /*#__PURE__*/React.createElement(CardContent, null, /*#__PURE__*/React.createElement(ProfileCardDetails, _extends({}, props, {
|
|
123
147
|
status: status,
|
|
124
|
-
fireAnalyticsWithDuration: fireAnalyticsWithDuration
|
|
148
|
+
fireAnalyticsWithDuration: fireAnalyticsWithDuration,
|
|
149
|
+
fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
|
|
125
150
|
})), realActions && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ActionsFlexSpacer, null), /*#__PURE__*/React.createElement(Actions, _extends({}, fg('jfp_a11y_team_profile_card_actions_label') && {
|
|
126
151
|
fullName: fullName
|
|
127
152
|
}, {
|
|
128
153
|
fullName: fullName,
|
|
129
154
|
actions: realActions,
|
|
130
155
|
fireAnalyticsWithDuration: fireAnalyticsWithDuration,
|
|
131
|
-
isTriggeredUsingKeyboard: props.isTriggeredUsingKeyboard
|
|
156
|
+
isTriggeredUsingKeyboard: props.isTriggeredUsingKeyboard,
|
|
157
|
+
fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
|
|
132
158
|
}))))));
|
|
133
159
|
};
|
|
134
160
|
var Actions = function Actions(_ref) {
|
|
135
161
|
var actions = _ref.actions,
|
|
136
162
|
fireAnalyticsWithDuration = _ref.fireAnalyticsWithDuration,
|
|
163
|
+
fireAnalyticsWithDurationNext = _ref.fireAnalyticsWithDurationNext,
|
|
137
164
|
isTriggeredUsingKeyboard = _ref.isTriggeredUsingKeyboard,
|
|
138
165
|
fullName = _ref.fullName;
|
|
139
166
|
var onActionClick = useCallback(function (action, args, event, index) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
167
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
168
|
+
fireAnalyticsWithDurationNext('ui.profilecard.clicked.action', function (duration) {
|
|
169
|
+
return _objectSpread({
|
|
170
|
+
method: 'click',
|
|
171
|
+
firedAt: Math.round(getPageTime()),
|
|
172
|
+
duration: duration,
|
|
173
|
+
hasHref: !!action.link,
|
|
174
|
+
hasOnClick: !!action.callback,
|
|
175
|
+
index: index,
|
|
176
|
+
actionId: action.id || 'no-id-specified'
|
|
177
|
+
}, PACKAGE_META_DATA);
|
|
147
178
|
});
|
|
148
|
-
}
|
|
179
|
+
} else {
|
|
180
|
+
fireAnalyticsWithDuration(function (duration) {
|
|
181
|
+
return actionClicked('user', {
|
|
182
|
+
duration: duration,
|
|
183
|
+
hasHref: !!action.link,
|
|
184
|
+
hasOnClick: !!action.callback,
|
|
185
|
+
index: index,
|
|
186
|
+
actionId: action.id || 'no-id-specified'
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}
|
|
149
190
|
if (action.callback && isBasicClick(event)) {
|
|
150
191
|
event.preventDefault();
|
|
151
192
|
action.callback.apply(action, [event].concat(_toConsumableArray(args)));
|
|
152
193
|
}
|
|
153
|
-
}, [fireAnalyticsWithDuration]);
|
|
194
|
+
}, [fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
|
|
154
195
|
if (!actions || actions.length === 0) {
|
|
155
196
|
return null;
|
|
156
197
|
}
|
|
@@ -184,6 +225,7 @@ var Actions = function Actions(_ref) {
|
|
|
184
225
|
}), overflowActions && /*#__PURE__*/React.createElement(OverflowProfileCardButtons, _extends({
|
|
185
226
|
actions: overflowActions,
|
|
186
227
|
fireAnalyticsWithDuration: fireAnalyticsWithDuration,
|
|
228
|
+
fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext,
|
|
187
229
|
onItemClick: function onItemClick(action, args, event, index) {
|
|
188
230
|
return onActionClick(action, args, event, index + ACTION_OVERFLOW_THRESHOLD);
|
|
189
231
|
}
|
|
@@ -191,17 +233,27 @@ var Actions = function Actions(_ref) {
|
|
|
191
233
|
fullName: fullName
|
|
192
234
|
})));
|
|
193
235
|
};
|
|
194
|
-
var LoadingView = function LoadingView(_ref2) {
|
|
195
|
-
var fireAnalyticsWithDuration = _ref2.fireAnalyticsWithDuration
|
|
236
|
+
export var LoadingView = function LoadingView(_ref2) {
|
|
237
|
+
var fireAnalyticsWithDuration = _ref2.fireAnalyticsWithDuration,
|
|
238
|
+
fireAnalyticsWithDurationNext = _ref2.fireAnalyticsWithDurationNext;
|
|
196
239
|
useEffect(function () {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
240
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
241
|
+
fireAnalyticsWithDurationNext('ui.profilecard.rendered.spinner', function (duration) {
|
|
242
|
+
return _objectSpread({
|
|
243
|
+
firedAt: Math.round(getPageTime()),
|
|
244
|
+
duration: duration
|
|
245
|
+
}, PACKAGE_META_DATA);
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
fireAnalyticsWithDuration(function (duration) {
|
|
249
|
+
return profileCardRendered('user', 'spinner', {
|
|
250
|
+
duration: duration
|
|
251
|
+
});
|
|
200
252
|
});
|
|
201
|
-
}
|
|
202
|
-
}, [fireAnalyticsWithDuration]);
|
|
253
|
+
}
|
|
254
|
+
}, [fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
|
|
203
255
|
return /*#__PURE__*/React.createElement(SpinnerContainer, {
|
|
204
256
|
testId: "profilecard-spinner-container"
|
|
205
257
|
}, /*#__PURE__*/React.createElement(Spinner, null));
|
|
206
258
|
};
|
|
207
|
-
export default withAnalyticsEvents()(ProfilecardInternal);
|
|
259
|
+
export default componentWithFG('ptc-enable-profile-card-analytics-refactor', ProfilecardInternal, withAnalyticsEvents()(ProfilecardInternal));
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
._18u0ze3t{margin-left:var(--ds-space-0,0)}
|
|
6
6
|
._19bvze3t{padding-left:var(--ds-space-0,0)}
|
|
7
7
|
._19pkxy5q{margin-top:var(--ds-space-400,2pc)}
|
|
8
|
-
._19pkze3t{margin-top:var(--ds-space-0,0)}
|
|
9
8
|
._1bguutpp#profilecard-name-label{margin-bottom:var(--ds-space-150,9pt)}
|
|
10
9
|
._1bto1l2s{text-overflow:ellipsis}
|
|
11
10
|
._1hpmutpp#profilecard-name-label{margin-top:var(--ds-space-150,9pt)}
|
|
@@ -9,16 +9,13 @@ import { cx } from '@compiled/react';
|
|
|
9
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
10
10
|
import Lozenge from '@atlaskit/lozenge';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
|
|
13
|
-
import { Text } from '@atlaskit/primitives';
|
|
14
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
12
|
+
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
15
13
|
import relativeDate from '../../internal/relative-date';
|
|
16
14
|
import messages from '../../messages';
|
|
17
15
|
import { AppTitleLabel, CustomLozengeContainer, DetailsGroup, DisabledInfo, JobTitleLabel, LozengeWrapper } from '../../styled/Card';
|
|
18
16
|
import { IconLabel } from '../Icon';
|
|
19
17
|
import ReportingLinesDetails from './ReportingLinesDetails';
|
|
20
18
|
var styles = {
|
|
21
|
-
detailedListWrapper: "_19pkze3t _2hwxze3t _otyrze3t _18u0ze3t _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t",
|
|
22
19
|
detailedListWrapperNext: "_19pkxy5q _2hwxze3t _otyrze3t _18u0ze3t _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t",
|
|
23
20
|
fullNameLabel: "_1reo15vq _18m915vq _11c81ixg _1bto1l2s _o5721q9c",
|
|
24
21
|
noMetaLabel: "_2hwxidpf _18u0idpf _rcujxy5q _1l6uutpp",
|
|
@@ -134,6 +131,7 @@ export var ProfileCardDetails = function ProfileCardDetails(props) {
|
|
|
134
131
|
reportingLines: props.reportingLines,
|
|
135
132
|
reportingLinesProfileUrl: props.reportingLinesProfileUrl,
|
|
136
133
|
onReportingLinesClick: props.onReportingLinesClick,
|
|
137
|
-
fireAnalyticsWithDuration: props.fireAnalyticsWithDuration
|
|
134
|
+
fireAnalyticsWithDuration: props.fireAnalyticsWithDuration,
|
|
135
|
+
fireAnalyticsWithDurationNext: props.fireAnalyticsWithDurationNext
|
|
138
136
|
}));
|
|
139
137
|
};
|