@atlaskit/profilecard 24.14.1 → 24.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/__tests__/vr-tests/agent-profilecard.vr.tsx +5 -5
- package/__tests__/vr-tests/user-profilecard.vr.tsx +30 -30
- package/dist/cjs/client/ProfileCardClient.js +10 -10
- package/dist/cjs/client/RovoAgentCardClient.js +172 -56
- package/dist/cjs/client/TeamProfileCardClient.js +44 -14
- package/dist/cjs/client/UserProfileCardClient.js +2 -9
- package/dist/cjs/client/errorUtils.js +83 -5
- package/dist/cjs/components/Agent/Actions.js +20 -9
- package/dist/cjs/components/Agent/ActionsCompiled.js +18 -8
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/cjs/components/Agent/AgentProfileCard.js +24 -14
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +23 -8
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
- package/dist/cjs/components/Team/TeamForbiddenErrorState.js +21 -6
- package/dist/cjs/components/Team/TeamLoadingState.js +21 -6
- package/dist/cjs/components/Team/TeamProfileCard.js +155 -60
- package/dist/cjs/components/Team/TeamProfileCardTrigger.js +104 -33
- package/dist/cjs/components/common/ProfileCardTrigger.js +3 -1
- package/dist/cjs/components/team-profile-card/main.js +18 -9
- package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/cjs/util/analytics.js +55 -0
- package/dist/es2019/client/ProfileCardClient.js +10 -10
- package/dist/es2019/client/RovoAgentCardClient.js +186 -58
- package/dist/es2019/client/TeamProfileCardClient.js +49 -16
- package/dist/es2019/client/UserProfileCardClient.js +3 -10
- package/dist/es2019/client/errorUtils.js +84 -3
- package/dist/es2019/components/Agent/Actions.js +21 -9
- package/dist/es2019/components/Agent/ActionsCompiled.js +19 -8
- package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/es2019/components/Agent/AgentProfileCard.js +24 -13
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +23 -9
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
- package/dist/es2019/components/Team/TeamForbiddenErrorState.js +17 -6
- package/dist/es2019/components/Team/TeamLoadingState.js +17 -6
- package/dist/es2019/components/Team/TeamProfileCard.js +144 -54
- package/dist/es2019/components/Team/TeamProfileCardTrigger.js +74 -10
- package/dist/es2019/components/common/ProfileCardTrigger.js +3 -1
- package/dist/es2019/components/team-profile-card/main.js +19 -9
- package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
- package/dist/es2019/util/analytics.js +55 -0
- package/dist/esm/client/ProfileCardClient.js +10 -10
- package/dist/esm/client/RovoAgentCardClient.js +174 -58
- package/dist/esm/client/TeamProfileCardClient.js +46 -16
- package/dist/esm/client/UserProfileCardClient.js +3 -10
- package/dist/esm/client/errorUtils.js +82 -4
- package/dist/esm/components/Agent/Actions.js +20 -9
- package/dist/esm/components/Agent/ActionsCompiled.js +18 -8
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/esm/components/Agent/AgentProfileCard.js +25 -13
- package/dist/esm/components/Agent/AgentProfileCardCompiled.js +24 -9
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
- package/dist/esm/components/Team/TeamForbiddenErrorState.js +22 -7
- package/dist/esm/components/Team/TeamLoadingState.js +22 -7
- package/dist/esm/components/Team/TeamProfileCard.js +156 -61
- package/dist/esm/components/Team/TeamProfileCardTrigger.js +105 -34
- package/dist/esm/components/common/ProfileCardTrigger.js +3 -1
- package/dist/esm/components/team-profile-card/main.js +18 -9
- package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/esm/util/analytics.js +55 -0
- package/dist/types/client/ProfileCardClient.d.ts +5 -5
- package/dist/types/client/RovoAgentCardClient.d.ts +5 -4
- package/dist/types/client/TeamProfileCardClient.d.ts +2 -1
- package/dist/types/client/errorUtils.d.ts +2 -1
- package/dist/types/client/types.d.ts +14 -2
- package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +2 -1
- package/dist/types/components/Team/TeamLoadingState.d.ts +2 -1
- package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +7 -2
- package/dist/types/types.d.ts +2 -0
- package/dist/types/util/analytics.d.ts +46 -2
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -5
- package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +5 -4
- package/dist/types-ts4.5/client/TeamProfileCardClient.d.ts +2 -1
- package/dist/types-ts4.5/client/errorUtils.d.ts +2 -1
- package/dist/types-ts4.5/client/types.d.ts +14 -2
- package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +2 -1
- package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +2 -1
- package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +7 -2
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/util/analytics.d.ts +46 -2
- package/package.json +8 -8
|
@@ -1,3 +1,6 @@
|
|
|
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 { AGGError, AGGErrors, DirectoryGraphQLError, DirectoryGraphQLErrors } from '../util/errors';
|
|
2
5
|
var IGNORED_ERROR_REASONS_DIRECTORY = [
|
|
3
6
|
// Error categories from pf-directory
|
|
@@ -15,12 +18,12 @@ function isIgnoredError(error) {
|
|
|
15
18
|
}
|
|
16
19
|
return false;
|
|
17
20
|
}
|
|
18
|
-
var
|
|
21
|
+
var _DEPRECATED_getErrorAttributes = function DEPRECATED_getErrorAttributes(error) {
|
|
19
22
|
if (error instanceof DirectoryGraphQLErrors) {
|
|
20
23
|
return {
|
|
21
24
|
errorMessage: error.message,
|
|
22
25
|
errorCount: error.errors.length,
|
|
23
|
-
errorDetails: error.errors.map(
|
|
26
|
+
errorDetails: error.errors.map(_DEPRECATED_getErrorAttributes),
|
|
24
27
|
isSLOFailure: !error.errors.every(isIgnoredError),
|
|
25
28
|
traceId: error.traceId
|
|
26
29
|
};
|
|
@@ -37,7 +40,7 @@ var _getErrorAttributes = function getErrorAttributes(error) {
|
|
|
37
40
|
return {
|
|
38
41
|
errorMessage: error.message,
|
|
39
42
|
errorCount: error.errors.length,
|
|
40
|
-
errorDetails: error.errors.map(
|
|
43
|
+
errorDetails: error.errors.map(_DEPRECATED_getErrorAttributes),
|
|
41
44
|
isSLOFailure: !error.errors.every(isIgnoredError),
|
|
42
45
|
traceId: error.traceId
|
|
43
46
|
};
|
|
@@ -55,7 +58,7 @@ var _getErrorAttributes = function getErrorAttributes(error) {
|
|
|
55
58
|
if (error.hasOwnProperty('cause')) {
|
|
56
59
|
var causeError = error.cause;
|
|
57
60
|
if (causeError instanceof DirectoryGraphQLErrors || causeError instanceof AGGErrors) {
|
|
58
|
-
return
|
|
61
|
+
return _DEPRECATED_getErrorAttributes(causeError);
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
return {
|
|
@@ -75,6 +78,81 @@ var _getErrorAttributes = function getErrorAttributes(error) {
|
|
|
75
78
|
isSLOFailure: true
|
|
76
79
|
};
|
|
77
80
|
};
|
|
81
|
+
export { _DEPRECATED_getErrorAttributes as DEPRECATED_getErrorAttributes };
|
|
82
|
+
var _getErrorAttributes = function getErrorAttributes(error) {
|
|
83
|
+
var defaultErrorAttributes = {
|
|
84
|
+
errorCount: null,
|
|
85
|
+
errorDetails: null,
|
|
86
|
+
errorCategory: null,
|
|
87
|
+
errorType: null,
|
|
88
|
+
errorPath: null,
|
|
89
|
+
errorNumber: null,
|
|
90
|
+
errorStatusCode: null,
|
|
91
|
+
traceId: null
|
|
92
|
+
};
|
|
93
|
+
if (error instanceof DirectoryGraphQLErrors) {
|
|
94
|
+
var _error$traceId;
|
|
95
|
+
return _objectSpread(_objectSpread({}, defaultErrorAttributes), {}, {
|
|
96
|
+
errorMessage: error.message,
|
|
97
|
+
errorCount: error.errors.length,
|
|
98
|
+
errorDetails: error.errors.map(_getErrorAttributes),
|
|
99
|
+
isSLOFailure: !error.errors.every(isIgnoredError),
|
|
100
|
+
traceId: (_error$traceId = error.traceId) !== null && _error$traceId !== void 0 ? _error$traceId : null
|
|
101
|
+
});
|
|
102
|
+
} else if (error instanceof DirectoryGraphQLError) {
|
|
103
|
+
var _error$errorNumber;
|
|
104
|
+
return _objectSpread(_objectSpread({}, defaultErrorAttributes), {}, {
|
|
105
|
+
errorMessage: error.message,
|
|
106
|
+
errorCategory: error.category,
|
|
107
|
+
errorType: error.type,
|
|
108
|
+
errorPath: error.path,
|
|
109
|
+
errorNumber: (_error$errorNumber = error.errorNumber) !== null && _error$errorNumber !== void 0 ? _error$errorNumber : null,
|
|
110
|
+
isSLOFailure: !isIgnoredError(error)
|
|
111
|
+
});
|
|
112
|
+
} else if (error instanceof AGGErrors) {
|
|
113
|
+
var _error$traceId2;
|
|
114
|
+
return _objectSpread(_objectSpread({}, defaultErrorAttributes), {}, {
|
|
115
|
+
errorMessage: error.message,
|
|
116
|
+
errorCount: error.errors.length,
|
|
117
|
+
errorDetails: error.errors.map(_getErrorAttributes),
|
|
118
|
+
isSLOFailure: !error.errors.every(isIgnoredError),
|
|
119
|
+
traceId: (_error$traceId2 = error.traceId) !== null && _error$traceId2 !== void 0 ? _error$traceId2 : null
|
|
120
|
+
});
|
|
121
|
+
} else if (error instanceof AGGError) {
|
|
122
|
+
var _error$errorType, _error$statusCode, _error$classification;
|
|
123
|
+
return _objectSpread(_objectSpread({}, defaultErrorAttributes), {}, {
|
|
124
|
+
errorMessage: error.message,
|
|
125
|
+
errorType: (_error$errorType = error.errorType) !== null && _error$errorType !== void 0 ? _error$errorType : null,
|
|
126
|
+
errorStatusCode: (_error$statusCode = error.statusCode) !== null && _error$statusCode !== void 0 ? _error$statusCode : null,
|
|
127
|
+
isSLOFailure: !isIgnoredError(error),
|
|
128
|
+
errorCategory: (_error$classification = error.classification) !== null && _error$classification !== void 0 ? _error$classification : null
|
|
129
|
+
});
|
|
130
|
+
} else if (error instanceof Error) {
|
|
131
|
+
// Jira custom profile card client error, they wrap the error & put the underlying error in the cause property
|
|
132
|
+
if (error.message.startsWith('Unable to fetch user:')) {
|
|
133
|
+
if (error.hasOwnProperty('cause')) {
|
|
134
|
+
var causeError = error.cause;
|
|
135
|
+
if (causeError instanceof DirectoryGraphQLErrors || causeError instanceof AGGErrors) {
|
|
136
|
+
return _getErrorAttributes(causeError);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return _objectSpread(_objectSpread({}, defaultErrorAttributes), {}, {
|
|
140
|
+
errorMessage: error.message,
|
|
141
|
+
isSLOFailure: false
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return _objectSpread(_objectSpread({}, defaultErrorAttributes), {}, {
|
|
145
|
+
errorMessage: error.message,
|
|
146
|
+
isSLOFailure: true
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Unknown
|
|
151
|
+
return _objectSpread(_objectSpread({}, defaultErrorAttributes), {}, {
|
|
152
|
+
errorMessage: 'Unknown error',
|
|
153
|
+
isSLOFailure: true
|
|
154
|
+
});
|
|
155
|
+
};
|
|
78
156
|
export { _getErrorAttributes as getErrorAttributes };
|
|
79
157
|
export var handleDirectoryGraphQLErrors = function handleDirectoryGraphQLErrors(errors, traceId) {
|
|
80
158
|
throw new DirectoryGraphQLErrors(errors, traceId);
|
|
@@ -13,6 +13,7 @@ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
|
13
13
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
14
14
|
import { Box, Inline, xcss } from '@atlaskit/primitives';
|
|
15
15
|
import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
|
|
16
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
16
17
|
import { fireEvent } from '../../util/analytics';
|
|
17
18
|
import { AgentActions as AgentActionsCompiled } from './ActionsCompiled';
|
|
18
19
|
import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
|
|
@@ -58,6 +59,8 @@ var _AgentActions = function _AgentActions(_ref) {
|
|
|
58
59
|
formatMessage = _useIntl.formatMessage;
|
|
59
60
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
60
61
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
62
|
+
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
63
|
+
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
61
64
|
var _useState = useState(false),
|
|
62
65
|
_useState2 = _slicedToArray(_useState, 2),
|
|
63
66
|
isDeleteModalOpen = _useState2[0],
|
|
@@ -89,17 +92,24 @@ var _AgentActions = function _AgentActions(_ref) {
|
|
|
89
92
|
}, _callee);
|
|
90
93
|
})), [agent.id, resourceClient]);
|
|
91
94
|
var handleDeleteAgent = useCallback(function () {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
actionSubject: 'button',
|
|
95
|
-
actionSubjectId: 'deleteAgentButton',
|
|
96
|
-
attributes: {
|
|
95
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
96
|
+
fireEventNext('ui.button.clicked.deleteAgentButton', {
|
|
97
97
|
agentId: agent.id,
|
|
98
98
|
source: 'agentProfileCard'
|
|
99
|
-
}
|
|
100
|
-
}
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
fireEvent(createAnalyticsEvent, {
|
|
102
|
+
action: 'clicked',
|
|
103
|
+
actionSubject: 'button',
|
|
104
|
+
actionSubjectId: 'deleteAgentButton',
|
|
105
|
+
attributes: {
|
|
106
|
+
agentId: agent.id,
|
|
107
|
+
source: 'agentProfileCard'
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
101
111
|
setIsDeleteModalOpen(true);
|
|
102
|
-
}, [agent.id, createAnalyticsEvent]);
|
|
112
|
+
}, [agent.id, createAnalyticsEvent, fireEventNext]);
|
|
103
113
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
|
|
104
114
|
space: "space.100",
|
|
105
115
|
xcss: actionsWrapperStyles
|
|
@@ -131,7 +141,8 @@ var _AgentActions = function _AgentActions(_ref) {
|
|
|
131
141
|
loadPermissionsOnMount: true,
|
|
132
142
|
onViewAgentFullProfileClick: onViewFullProfileClick,
|
|
133
143
|
doesAgentHaveIdentityAccountId: !!agent.identity_account_id,
|
|
134
|
-
shouldTriggerStopPropagation: true
|
|
144
|
+
shouldTriggerStopPropagation: true,
|
|
145
|
+
dropdownMenuTestId: "agent-dropdown-menu"
|
|
135
146
|
})), /*#__PURE__*/React.createElement(AgentDeleteConfirmationModal, {
|
|
136
147
|
isOpen: isDeleteModalOpen,
|
|
137
148
|
onClose: function onClose() {
|
|
@@ -14,6 +14,7 @@ import Button from '@atlaskit/button/new';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
16
16
|
import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
|
|
17
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
17
18
|
import { fireEvent } from '../../util/analytics';
|
|
18
19
|
import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
|
|
19
20
|
var styles = {
|
|
@@ -37,6 +38,8 @@ export var AgentActions = function AgentActions(_ref) {
|
|
|
37
38
|
formatMessage = _useIntl.formatMessage;
|
|
38
39
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
39
40
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
41
|
+
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
42
|
+
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
40
43
|
var _useState = useState(false),
|
|
41
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
45
|
isDeleteModalOpen = _useState2[0],
|
|
@@ -68,17 +71,24 @@ export var AgentActions = function AgentActions(_ref) {
|
|
|
68
71
|
}, _callee);
|
|
69
72
|
})), [agent.id, resourceClient]);
|
|
70
73
|
var handleDeleteAgent = useCallback(function () {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
actionSubject: 'button',
|
|
74
|
-
actionSubjectId: 'deleteAgentButton',
|
|
75
|
-
attributes: {
|
|
74
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
75
|
+
fireEventNext('ui.button.clicked.deleteAgentButton', {
|
|
76
76
|
agentId: agent.id,
|
|
77
77
|
source: 'agentProfileCard'
|
|
78
|
-
}
|
|
79
|
-
}
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
fireEvent(createAnalyticsEvent, {
|
|
81
|
+
action: 'clicked',
|
|
82
|
+
actionSubject: 'button',
|
|
83
|
+
actionSubjectId: 'deleteAgentButton',
|
|
84
|
+
attributes: {
|
|
85
|
+
agentId: agent.id,
|
|
86
|
+
source: 'agentProfileCard'
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
80
90
|
setIsDeleteModalOpen(true);
|
|
81
|
-
}, [agent.id, createAnalyticsEvent]);
|
|
91
|
+
}, [agent.id, createAnalyticsEvent, fireEventNext]);
|
|
82
92
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
|
|
83
93
|
space: "space.100",
|
|
84
94
|
xcss: styles.actionsWrapperStyles
|
|
@@ -33,7 +33,9 @@ export var AgentDeleteConfirmationModal = function AgentDeleteConfirmationModal(
|
|
|
33
33
|
})), [agentId, onClose, onSubmit]);
|
|
34
34
|
return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(Modal, {
|
|
35
35
|
width: "small"
|
|
36
|
-
}, /*#__PURE__*/React.createElement(ModalHeader,
|
|
36
|
+
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
37
|
+
hasCloseButton: true
|
|
38
|
+
}, /*#__PURE__*/React.createElement(ModalTitle, null, formatMessage(messages.title, {
|
|
37
39
|
agentName: agentName
|
|
38
40
|
}))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Text, {
|
|
39
41
|
as: "p"
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
3
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
7
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
5
8
|
import { useIntl } from 'react-intl-next';
|
|
6
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
11
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
8
12
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
9
13
|
import { Box, Stack, xcss } from '@atlaskit/primitives';
|
|
10
14
|
import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
|
|
11
|
-
import {
|
|
15
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
16
|
+
import { fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
17
|
+
import { getPageTime } from '../../util/performance';
|
|
12
18
|
import { LoadingState } from '../common/LoadingState';
|
|
13
19
|
import { ErrorMessage } from '../Error';
|
|
14
20
|
import { AgentActions } from './Actions';
|
|
@@ -63,6 +69,8 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
63
69
|
setStarCount = _useState4[1];
|
|
64
70
|
var _useIntl = useIntl(),
|
|
65
71
|
formatMessage = _useIntl.formatMessage;
|
|
72
|
+
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
73
|
+
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
66
74
|
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) {
|
|
67
75
|
return {
|
|
68
76
|
message: starter,
|
|
@@ -90,7 +98,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
90
98
|
}
|
|
91
99
|
_context.prev = 1;
|
|
92
100
|
_context.next = 4;
|
|
93
|
-
return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
|
|
101
|
+
return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics, fireEventNext);
|
|
94
102
|
case 4:
|
|
95
103
|
if (isStarred) {
|
|
96
104
|
setStarCount(starCount ? starCount - 1 : 0);
|
|
@@ -108,7 +116,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
108
116
|
return _context.stop();
|
|
109
117
|
}
|
|
110
118
|
}, _callee, null, [[1, 8]]);
|
|
111
|
-
})), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
|
|
119
|
+
})), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, fireEventNext, isStarred, resourceClient, starCount]);
|
|
112
120
|
var handleOnDelete = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
113
121
|
var _onDeleteAgent, restore;
|
|
114
122
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -122,7 +130,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
122
130
|
_onDeleteAgent = onDeleteAgent(agent.id), restore = _onDeleteAgent.restore;
|
|
123
131
|
_context2.prev = 2;
|
|
124
132
|
_context2.next = 5;
|
|
125
|
-
return resourceClient.deleteAgent(agent.id, fireAnalytics);
|
|
133
|
+
return resourceClient.deleteAgent(agent.id, fireAnalytics, fireEventNext);
|
|
126
134
|
case 5:
|
|
127
135
|
addFlag === null || addFlag === void 0 || addFlag({
|
|
128
136
|
title: formatMessage(messages.agentDeletedSuccessFlagTitle),
|
|
@@ -150,26 +158,30 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
150
158
|
return _context2.stop();
|
|
151
159
|
}
|
|
152
160
|
}, _callee2, null, [[2, 8]]);
|
|
153
|
-
})), [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics]);
|
|
161
|
+
})), [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics, fireEventNext]);
|
|
154
162
|
useEffect(function () {
|
|
155
163
|
if (!isLoading && agent) {
|
|
156
|
-
|
|
164
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
165
|
+
fireEventNext("ui.rovoAgentProfilecard.rendered.content", _objectSpread(_objectSpread({}, PACKAGE_META_DATA), {}, {
|
|
166
|
+
firedAt: Math.round(getPageTime())
|
|
167
|
+
}));
|
|
168
|
+
} else {
|
|
169
|
+
fireAnalytics(profileCardRendered('agent', 'content'));
|
|
170
|
+
}
|
|
157
171
|
}
|
|
158
|
-
}, [agent, fireAnalytics, isLoading]);
|
|
172
|
+
}, [agent, fireAnalytics, fireEventNext, isLoading]);
|
|
159
173
|
if (isLoading) {
|
|
160
174
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
|
|
161
175
|
profileType: "agent",
|
|
162
|
-
fireAnalytics: fireAnalytics
|
|
176
|
+
fireAnalytics: fireAnalytics,
|
|
177
|
+
fireAnalyticsNext: fireEventNext
|
|
163
178
|
}));
|
|
164
179
|
}
|
|
165
180
|
if (hasError || !agent) {
|
|
166
181
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
167
182
|
errorType: errorType,
|
|
168
|
-
fireAnalytics: fireAnalytics
|
|
169
|
-
|
|
170
|
-
// NOTE: Add it to AgentProfileCardCompiled
|
|
171
|
-
,
|
|
172
|
-
fireAnalyticsNext: function fireAnalyticsNext() {}
|
|
183
|
+
fireAnalytics: fireAnalytics,
|
|
184
|
+
fireAnalyticsNext: fireEventNext
|
|
173
185
|
}));
|
|
174
186
|
}
|
|
175
187
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
/* AgentProfileCardCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
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 "./AgentProfileCardCompiled.compiled.css";
|
|
5
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
6
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
10
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
8
11
|
import { useIntl } from 'react-intl-next';
|
|
9
12
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
14
|
import { Box, Stack } from '@atlaskit/primitives/compiled';
|
|
11
15
|
import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
|
|
12
|
-
import {
|
|
16
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
17
|
+
import { fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
18
|
+
import { getPageTime } from '../../util/performance';
|
|
13
19
|
import { LoadingState } from '../common/LoadingState';
|
|
14
20
|
import { ErrorMessage } from '../Error';
|
|
15
21
|
import { AgentActions } from './Actions';
|
|
@@ -54,6 +60,8 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
54
60
|
setStarCount = _useState4[1];
|
|
55
61
|
var _useIntl = useIntl(),
|
|
56
62
|
formatMessage = _useIntl.formatMessage;
|
|
63
|
+
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
64
|
+
fireAnalyticsNext = _useAnalyticsEventsNe.fireEvent;
|
|
57
65
|
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
66
|
return {
|
|
59
67
|
message: starter,
|
|
@@ -81,7 +89,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
81
89
|
}
|
|
82
90
|
_context.prev = 1;
|
|
83
91
|
_context.next = 4;
|
|
84
|
-
return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
|
|
92
|
+
return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics, fireAnalyticsNext);
|
|
85
93
|
case 4:
|
|
86
94
|
if (isStarred) {
|
|
87
95
|
setStarCount(starCount ? starCount - 1 : 0);
|
|
@@ -99,7 +107,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
99
107
|
return _context.stop();
|
|
100
108
|
}
|
|
101
109
|
}, _callee, null, [[1, 8]]);
|
|
102
|
-
})), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
|
|
110
|
+
})), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, fireAnalyticsNext, isStarred, resourceClient, starCount]);
|
|
103
111
|
var handleOnDelete = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
104
112
|
var _onDeleteAgent, restore;
|
|
105
113
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -113,7 +121,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
113
121
|
_onDeleteAgent = onDeleteAgent(agent.id), restore = _onDeleteAgent.restore;
|
|
114
122
|
_context2.prev = 2;
|
|
115
123
|
_context2.next = 5;
|
|
116
|
-
return resourceClient.deleteAgent(agent.id, fireAnalytics);
|
|
124
|
+
return resourceClient.deleteAgent(agent.id, fireAnalytics, fireAnalyticsNext);
|
|
117
125
|
case 5:
|
|
118
126
|
addFlag === null || addFlag === void 0 || addFlag({
|
|
119
127
|
title: formatMessage(messages.agentDeletedSuccessFlagTitle),
|
|
@@ -141,21 +149,28 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
141
149
|
return _context2.stop();
|
|
142
150
|
}
|
|
143
151
|
}, _callee2, null, [[2, 8]]);
|
|
144
|
-
})), [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics]);
|
|
152
|
+
})), [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics, fireAnalyticsNext]);
|
|
145
153
|
useEffect(function () {
|
|
146
154
|
if (!isLoading && agent) {
|
|
147
|
-
|
|
155
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
156
|
+
fireAnalyticsNext("ui.rovoAgentProfilecard.rendered.content", _objectSpread(_objectSpread({}, PACKAGE_META_DATA), {}, {
|
|
157
|
+
firedAt: Math.round(getPageTime())
|
|
158
|
+
}));
|
|
159
|
+
} else {
|
|
160
|
+
fireAnalytics(profileCardRendered('agent', 'content'));
|
|
161
|
+
}
|
|
148
162
|
}
|
|
149
|
-
}, [agent, fireAnalytics, isLoading]);
|
|
163
|
+
}, [agent, fireAnalytics, isLoading, fireAnalyticsNext]);
|
|
150
164
|
if (isLoading) {
|
|
151
165
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
|
|
152
166
|
profileType: "agent",
|
|
153
|
-
fireAnalytics: fireAnalytics
|
|
167
|
+
fireAnalytics: fireAnalytics,
|
|
168
|
+
fireAnalyticsNext: fireAnalyticsNext
|
|
154
169
|
}));
|
|
155
170
|
}
|
|
156
171
|
if (hasError || !agent) {
|
|
157
172
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
158
|
-
fireAnalyticsNext:
|
|
173
|
+
fireAnalyticsNext: fireAnalyticsNext,
|
|
159
174
|
errorType: errorType,
|
|
160
175
|
fireAnalytics: fireAnalytics
|
|
161
176
|
}));
|
|
@@ -8,6 +8,7 @@ import React, { Suspense, useCallback, useEffect, useMemo, useState } from 'reac
|
|
|
8
8
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
11
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
11
12
|
import { fireEvent } from '../../util/analytics';
|
|
12
13
|
import { getAAIDFromARI } from '../../util/rovoAgentUtils';
|
|
13
14
|
import ErrorMessage from '../Error/ErrorMessage';
|
|
@@ -28,6 +29,8 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
28
29
|
setError = _useState6[1];
|
|
29
30
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
30
31
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
32
|
+
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
33
|
+
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
31
34
|
var fireAnalytics = useCallback(function (payload) {
|
|
32
35
|
if (createAnalyticsEvent) {
|
|
33
36
|
fireEvent(createAnalyticsEvent, payload);
|
|
@@ -77,7 +80,7 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
77
80
|
return _context.abrupt("return", undefined);
|
|
78
81
|
case 10:
|
|
79
82
|
_context.next = 12;
|
|
80
|
-
return props.resourceClient.getProfile(creatorUserId, props.cloudId, fireAnalytics);
|
|
83
|
+
return props.resourceClient.getProfile(creatorUserId, props.cloudId, fireAnalytics, fireEventNext);
|
|
81
84
|
case 12:
|
|
82
85
|
creatorInfo = _context.sent;
|
|
83
86
|
return _context.abrupt("return", {
|
|
@@ -101,7 +104,7 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
101
104
|
return function (_x, _x2) {
|
|
102
105
|
return _ref.apply(this, arguments);
|
|
103
106
|
};
|
|
104
|
-
}(), [creatorUserId, fireAnalytics, props.cloudId, props.resourceClient, profileHref]);
|
|
107
|
+
}(), [creatorUserId, fireAnalytics, fireEventNext, props.cloudId, props.resourceClient, profileHref]);
|
|
105
108
|
var fetchData = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
106
109
|
var profileData, agentCreatorInfo;
|
|
107
110
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -113,7 +116,7 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
113
116
|
return props.resourceClient.getRovoAgentProfile({
|
|
114
117
|
type: 'identity',
|
|
115
118
|
value: props.accountId
|
|
116
|
-
}, fireAnalytics);
|
|
119
|
+
}, fireAnalytics, fireEventNext);
|
|
117
120
|
case 4:
|
|
118
121
|
profileData = _context2.sent;
|
|
119
122
|
_context2.next = 7;
|
|
@@ -138,7 +141,7 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
138
141
|
return _context2.stop();
|
|
139
142
|
}
|
|
140
143
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
141
|
-
})), [fireAnalytics, getCreator, props.accountId, props.resourceClient]);
|
|
144
|
+
})), [fireAnalytics, fireEventNext, getCreator, props.accountId, props.resourceClient]);
|
|
142
145
|
useEffect(function () {
|
|
143
146
|
fetchData();
|
|
144
147
|
}, [fetchData]);
|
|
@@ -149,7 +152,7 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
|
|
|
149
152
|
},
|
|
150
153
|
errorType: error || null,
|
|
151
154
|
fireAnalytics: function fireAnalytics() {},
|
|
152
|
-
fireAnalyticsNext:
|
|
155
|
+
fireAnalyticsNext: fireEventNext
|
|
153
156
|
}));
|
|
154
157
|
}
|
|
155
158
|
return /*#__PURE__*/React.createElement(Suspense, {
|
|
@@ -10,6 +10,7 @@ import React, { forwardRef, Suspense, useCallback } from 'react';
|
|
|
10
10
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
13
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
13
14
|
import { fireEvent } from '../../util/analytics';
|
|
14
15
|
import { getAAIDFromARI } from '../../util/rovoAgentUtils';
|
|
15
16
|
import ProfileCardTrigger from '../common/ProfileCardTrigger';
|
|
@@ -25,6 +26,8 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
25
26
|
cloudId = props.cloudId;
|
|
26
27
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
27
28
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
29
|
+
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
30
|
+
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
28
31
|
var fireAnalytics = useCallback(function (payload) {
|
|
29
32
|
if (createAnalyticsEvent) {
|
|
30
33
|
fireEvent(createAnalyticsEvent, payload);
|
|
@@ -76,7 +79,7 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
76
79
|
cloudId: cloudId
|
|
77
80
|
}), profileHref = _navigateToTeamsApp.href;
|
|
78
81
|
_context.next = 15;
|
|
79
|
-
return props.resourceClient.getProfile(cloudId, _userId, fireAnalytics);
|
|
82
|
+
return props.resourceClient.getProfile(cloudId, _userId, fireAnalytics, fireEventNext);
|
|
80
83
|
case 15:
|
|
81
84
|
creatorInfo = _context.sent;
|
|
82
85
|
return _context.abrupt("return", {
|
|
@@ -111,7 +114,7 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
111
114
|
return resourceClient.getRovoAgentProfile({
|
|
112
115
|
type: 'agent',
|
|
113
116
|
value: userId
|
|
114
|
-
}, fireAnalytics);
|
|
117
|
+
}, fireAnalytics, fireEventNext);
|
|
115
118
|
case 2:
|
|
116
119
|
agentInfo = _context2.sent;
|
|
117
120
|
_context2.next = 5;
|
|
@@ -154,6 +157,7 @@ export var AgentProfileCardTrigger = /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
154
157
|
renderProfileCard: renderProfileCard,
|
|
155
158
|
fetchProfile: fetchAgentProfile,
|
|
156
159
|
fireAnalytics: fireAnalytics,
|
|
160
|
+
fireAnalyticsNext: fireEventNext,
|
|
157
161
|
profileCardType: "agent"
|
|
158
162
|
}));
|
|
159
163
|
});
|