@atlaskit/profilecard 23.21.20 → 23.21.21

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 23.21.21
4
+
5
+ ### Patch Changes
6
+
7
+ - [#192008](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/192008)
8
+ [`191a9be1b1ba0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/191a9be1b1ba0) -
9
+ added agent edit/duplicate/delete/view/copy action analytics
10
+ - Updated dependencies
11
+
3
12
  ## 23.21.20
4
13
 
5
14
  ### Patch Changes
@@ -11,7 +11,7 @@ var _graphqlUtils = require("./graphqlUtils");
11
11
  var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
12
12
  var addHeaders = function addHeaders(headers) {
13
13
  headers.append('atl-client-name', "@atlaskit/profilecard");
14
- headers.append('atl-client-version', "23.21.19");
14
+ headers.append('atl-client-version', "23.21.20");
15
15
  return headers;
16
16
  };
17
17
  function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -65,7 +65,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
65
65
  headers.append('X-ExperimentalApi', 'teams-beta');
66
66
  headers.append('X-ExperimentalApi', 'team-members-beta');
67
67
  headers.append('atl-client-name', "@atlaskit/profilecard");
68
- headers.append('atl-client-version', "23.21.19");
68
+ headers.append('atl-client-version', "23.21.20");
69
69
  return headers;
70
70
  };
71
71
  function getTeamFromAGG(_x, _x2, _x3) {
@@ -11,9 +11,11 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _reactIntlNext = require("react-intl-next");
14
+ var _analyticsNext = require("@atlaskit/analytics-next");
14
15
  var _new = _interopRequireDefault(require("@atlaskit/button/new"));
15
16
  var _primitives = require("@atlaskit/primitives");
16
17
  var _rovoAgentComponents = require("@atlaskit/rovo-agent-components");
18
+ var _analytics = require("../../util/analytics");
17
19
  var _AgentDeleteConfirmationModal = require("./AgentDeleteConfirmationModal");
18
20
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
19
21
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
@@ -59,6 +61,8 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref) {
59
61
  resourceClient = _ref.resourceClient;
60
62
  var _useIntl = (0, _reactIntlNext.useIntl)(),
61
63
  formatMessage = _useIntl.formatMessage;
64
+ var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
65
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
62
66
  var _useState = (0, _react.useState)(false),
63
67
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
64
68
  isDeleteModalOpen = _useState2[0],
@@ -86,6 +90,18 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref) {
86
90
  }
87
91
  }, _callee);
88
92
  })), [agent.id, resourceClient]);
93
+ var handleDeleteAgent = (0, _react.useCallback)(function () {
94
+ (0, _analytics.fireEvent)(createAnalyticsEvent, {
95
+ action: 'clicked',
96
+ actionSubject: 'button',
97
+ actionSubjectId: 'deleteAgentButton',
98
+ attributes: {
99
+ agentId: agent.id,
100
+ source: 'agentProfileCard'
101
+ }
102
+ });
103
+ setIsDeleteModalOpen(true);
104
+ }, [agent.id, createAnalyticsEvent]);
89
105
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
90
106
  space: "space.100",
91
107
  xcss: actionsWrapperStyles
@@ -109,9 +125,7 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref) {
109
125
  }, formatMessage(messages.actionChatToAgent)))))), /*#__PURE__*/_react.default.createElement(_rovoAgentComponents.AgentDropdownMenu, {
110
126
  agentId: agent.id,
111
127
  isAgentCreatedByUser: isAgentCreatedByCurrentUser !== null && isAgentCreatedByCurrentUser !== void 0 ? isAgentCreatedByCurrentUser : false,
112
- onDeleteAgent: function onDeleteAgent() {
113
- return setIsDeleteModalOpen(true);
114
- },
128
+ onDeleteAgent: handleDeleteAgent,
115
129
  onEditAgent: onEditAgent,
116
130
  onDuplicateAgent: onDuplicateAgent,
117
131
  onCopyAgent: onCopyAgent,
@@ -54,7 +54,8 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
54
54
  resourceClient = _ref.resourceClient,
55
55
  addFlag = _ref.addFlag;
56
56
  var _useAgentUrlActions = (0, _useAgentActions.useAgentUrlActions)({
57
- cloudId: cloudId || ''
57
+ cloudId: cloudId || '',
58
+ source: 'agentProfileCard'
58
59
  }),
59
60
  _onEditAgent = _useAgentUrlActions.onEditAgent,
60
61
  _onCopyAgent = _useAgentUrlActions.onCopyAgent,
@@ -8,10 +8,12 @@ exports.useAgentUrlActions = exports.firstCharUpper = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = require("react");
11
+ var _analyticsNext = require("@atlaskit/analytics-next");
11
12
  var _atlassianContext = require("@atlaskit/atlassian-context");
12
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _rovoTriggers = require("@atlaskit/rovo-triggers");
14
15
  var _navigation = require("@atlaskit/teams-app-config/navigation");
16
+ var _analytics = require("../../../util/analytics");
15
17
  var _url = require("../../../util/url");
16
18
  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; }
17
19
  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) { (0, _defineProperty2.default)(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; }
@@ -30,9 +32,12 @@ var createRovoParams = function createRovoParams(params) {
30
32
  return rovoParams;
31
33
  };
32
34
  var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlActions(_ref3) {
33
- var cloudId = _ref3.cloudId;
35
+ var cloudId = _ref3.cloudId,
36
+ source = _ref3.source;
34
37
  var _useRovoPostMessageTo = (0, _rovoTriggers.useRovoPostMessageToPubsub)(),
35
38
  publishWithPostMessage = _useRovoPostMessageTo.publishWithPostMessage;
39
+ var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
40
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
36
41
  var onEditAgent = (0, _react.useCallback)(function (agentId) {
37
42
  var url = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat/agents/").concat(agentId, "/edit");
38
43
  var urlWithParams = (0, _url.encodeParamsToUrl)(url, _objectSpread({
@@ -41,9 +46,27 @@ var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlAction
41
46
  cloudId: cloudId
42
47
  })));
43
48
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
44
- }, [cloudId]);
49
+ (0, _analytics.fireEvent)(createAnalyticsEvent, {
50
+ action: 'clicked',
51
+ actionSubject: 'button',
52
+ actionSubjectId: 'editAgentButton',
53
+ attributes: {
54
+ agentId: agentId,
55
+ source: source
56
+ }
57
+ });
58
+ }, [cloudId, createAnalyticsEvent, source]);
45
59
  var onCopyAgent = function onCopyAgent(agentId) {
46
60
  navigator.clipboard.writeText("".concat(window.location.origin, "/people/agent/").concat(agentId));
61
+ (0, _analytics.fireEvent)(createAnalyticsEvent, {
62
+ action: 'clicked',
63
+ actionSubject: 'button',
64
+ actionSubjectId: 'copyAgentLinkButton',
65
+ attributes: {
66
+ agentId: agentId,
67
+ source: source
68
+ }
69
+ });
47
70
  };
48
71
  var onDuplicateAgent = (0, _react.useCallback)(function (agentId) {
49
72
  var baseUrl = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat/agents/new");
@@ -55,7 +78,16 @@ var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlAction
55
78
  pathway: 'agents-create'
56
79
  })));
57
80
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
58
- }, [cloudId]);
81
+ (0, _analytics.fireEvent)(createAnalyticsEvent, {
82
+ action: 'clicked',
83
+ actionSubject: 'button',
84
+ actionSubjectId: 'duplicateAgentButton',
85
+ attributes: {
86
+ agentId: agentId,
87
+ source: source
88
+ }
89
+ });
90
+ }, [cloudId, createAnalyticsEvent, source]);
59
91
  var onConversationStarter = function onConversationStarter(_ref4) {
60
92
  var agentId = _ref4.agentId,
61
93
  prompt = _ref4.prompt;
@@ -130,6 +162,15 @@ var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlAction
130
162
  } else {
131
163
  window.open("".concat(window.location.origin, "/people/agent/").concat(agentId), '_blank', 'noopener, noreferrer');
132
164
  }
165
+ (0, _analytics.fireEvent)(createAnalyticsEvent, {
166
+ action: 'clicked',
167
+ actionSubject: 'button',
168
+ actionSubjectId: 'viewAgentFullProfileButton',
169
+ attributes: {
170
+ agentId: agentId,
171
+ source: source
172
+ }
173
+ });
133
174
  };
134
175
  return {
135
176
  onEditAgent: onEditAgent,
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
45
45
  actionSubjectId: actionSubjectId,
46
46
  attributes: _objectSpread(_objectSpread({
47
47
  packageName: "@atlaskit/profilecard",
48
- packageVersion: "23.21.19"
48
+ packageVersion: "23.21.20"
49
49
  }, attributes), {}, {
50
50
  firedAt: Math.round((0, _performance.getPageTime)())
51
51
  })
@@ -6,7 +6,7 @@ const ORG_ID_FROM_CLOUD_ID_QUERY = `query OrgIdFromCloudId($cloudId: ID!) {
6
6
  }`;
7
7
  const addHeaders = headers => {
8
8
  headers.append('atl-client-name', "@atlaskit/profilecard");
9
- headers.append('atl-client-version', "23.21.19");
9
+ headers.append('atl-client-version', "23.21.20");
10
10
  return headers;
11
11
  };
12
12
  export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
@@ -74,7 +74,7 @@ export const addHeaders = headers => {
74
74
  headers.append('X-ExperimentalApi', 'teams-beta');
75
75
  headers.append('X-ExperimentalApi', 'team-members-beta');
76
76
  headers.append('atl-client-name', "@atlaskit/profilecard");
77
- headers.append('atl-client-version', "23.21.19");
77
+ headers.append('atl-client-version', "23.21.20");
78
78
  return headers;
79
79
  };
80
80
  export async function getTeamFromAGG(url, teamId, siteId) {
@@ -1,9 +1,11 @@
1
1
  import React, { useCallback, useState } from 'react';
2
2
  import { defineMessages, useIntl } from 'react-intl-next';
3
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
3
4
  import Button from '@atlaskit/button/new';
4
5
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
5
6
  import { Box, Inline, xcss } from '@atlaskit/primitives';
6
7
  import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
8
+ import { fireEvent } from '../../util/analytics';
7
9
  import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
8
10
  const chatToAgentButtonContainer = xcss({
9
11
  width: '100%'
@@ -48,6 +50,9 @@ export const AgentActions = ({
48
50
  const {
49
51
  formatMessage
50
52
  } = useIntl();
53
+ const {
54
+ createAnalyticsEvent
55
+ } = useAnalyticsEvents();
51
56
  const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
52
57
  const isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
53
58
  const loadAgentPermissions = useCallback(async () => {
@@ -62,6 +67,18 @@ export const AgentActions = ({
62
67
  isDeleteEnabled: AGENT_DEACTIVATE.permitted
63
68
  };
64
69
  }, [agent.id, resourceClient]);
70
+ const handleDeleteAgent = useCallback(() => {
71
+ fireEvent(createAnalyticsEvent, {
72
+ action: 'clicked',
73
+ actionSubject: 'button',
74
+ actionSubjectId: 'deleteAgentButton',
75
+ attributes: {
76
+ agentId: agent.id,
77
+ source: 'agentProfileCard'
78
+ }
79
+ });
80
+ setIsDeleteModalOpen(true);
81
+ }, [agent.id, createAnalyticsEvent]);
65
82
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
66
83
  space: "space.100",
67
84
  xcss: actionsWrapperStyles
@@ -85,7 +102,7 @@ export const AgentActions = ({
85
102
  }, formatMessage(messages.actionChatToAgent)))))), /*#__PURE__*/React.createElement(AgentDropdownMenu, {
86
103
  agentId: agent.id,
87
104
  isAgentCreatedByUser: isAgentCreatedByCurrentUser !== null && isAgentCreatedByCurrentUser !== void 0 ? isAgentCreatedByCurrentUser : false,
88
- onDeleteAgent: () => setIsDeleteModalOpen(true),
105
+ onDeleteAgent: handleDeleteAgent,
89
106
  onEditAgent: onEditAgent,
90
107
  onDuplicateAgent: onDuplicateAgent,
91
108
  onCopyAgent: onCopyAgent,
@@ -48,7 +48,8 @@ const AgentProfileCard = ({
48
48
  onConversationStarter,
49
49
  onViewFullProfile
50
50
  } = useAgentUrlActions({
51
- cloudId: cloudId || ''
51
+ cloudId: cloudId || '',
52
+ source: 'agentProfileCard'
52
53
  });
53
54
  const [isStarred, setIsStarred] = useState(false);
54
55
  const [starCount, setStarCount] = useState();
@@ -1,8 +1,10 @@
1
1
  import { useCallback } from 'react';
2
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
2
3
  import { getATLContextUrl } from '@atlaskit/atlassian-context';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers';
5
6
  import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
7
+ import { fireEvent } from '../../../util/analytics';
6
8
  import { encodeParamsToUrl } from '../../../util/url';
7
9
  export const firstCharUpper = str => str.charAt(0).toUpperCase() + str.slice(1);
8
10
  const ROVO_PARAM_PREFIX = 'rovoChat';
@@ -14,11 +16,15 @@ const createRovoParams = params => {
14
16
  return rovoParams;
15
17
  };
16
18
  export const useAgentUrlActions = ({
17
- cloudId
19
+ cloudId,
20
+ source
18
21
  }) => {
19
22
  const {
20
23
  publishWithPostMessage
21
24
  } = useRovoPostMessageToPubsub();
25
+ const {
26
+ createAnalyticsEvent
27
+ } = useAnalyticsEvents();
22
28
  const onEditAgent = useCallback(agentId => {
23
29
  const url = `${getATLContextUrl('home')}/chat/agents/${agentId}/edit`;
24
30
  const urlWithParams = encodeParamsToUrl(url, {
@@ -28,9 +34,27 @@ export const useAgentUrlActions = ({
28
34
  })
29
35
  });
30
36
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
31
- }, [cloudId]);
37
+ fireEvent(createAnalyticsEvent, {
38
+ action: 'clicked',
39
+ actionSubject: 'button',
40
+ actionSubjectId: 'editAgentButton',
41
+ attributes: {
42
+ agentId,
43
+ source
44
+ }
45
+ });
46
+ }, [cloudId, createAnalyticsEvent, source]);
32
47
  const onCopyAgent = agentId => {
33
48
  navigator.clipboard.writeText(`${window.location.origin}/people/agent/${agentId}`);
49
+ fireEvent(createAnalyticsEvent, {
50
+ action: 'clicked',
51
+ actionSubject: 'button',
52
+ actionSubjectId: 'copyAgentLinkButton',
53
+ attributes: {
54
+ agentId,
55
+ source
56
+ }
57
+ });
34
58
  };
35
59
  const onDuplicateAgent = useCallback(agentId => {
36
60
  const baseUrl = `${getATLContextUrl('home')}/chat/agents/new`;
@@ -43,7 +67,16 @@ export const useAgentUrlActions = ({
43
67
  })
44
68
  });
45
69
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
46
- }, [cloudId]);
70
+ fireEvent(createAnalyticsEvent, {
71
+ action: 'clicked',
72
+ actionSubject: 'button',
73
+ actionSubjectId: 'duplicateAgentButton',
74
+ attributes: {
75
+ agentId,
76
+ source
77
+ }
78
+ });
79
+ }, [cloudId, createAnalyticsEvent, source]);
47
80
  const onConversationStarter = ({
48
81
  agentId,
49
82
  prompt
@@ -122,6 +155,15 @@ export const useAgentUrlActions = ({
122
155
  } else {
123
156
  window.open(`${window.location.origin}/people/agent/${agentId}`, '_blank', 'noopener, noreferrer');
124
157
  }
158
+ fireEvent(createAnalyticsEvent, {
159
+ action: 'clicked',
160
+ actionSubject: 'button',
161
+ actionSubjectId: 'viewAgentFullProfileButton',
162
+ attributes: {
163
+ agentId,
164
+ source
165
+ }
166
+ });
125
167
  };
126
168
  return {
127
169
  onEditAgent,
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
32
32
  actionSubjectId,
33
33
  attributes: {
34
34
  packageName: "@atlaskit/profilecard",
35
- packageVersion: "23.21.19",
35
+ packageVersion: "23.21.20",
36
36
  ...attributes,
37
37
  firedAt: Math.round(getPageTime())
38
38
  }
@@ -4,7 +4,7 @@ import { AGGQuery } from './graphqlUtils';
4
4
  var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
5
5
  var addHeaders = function addHeaders(headers) {
6
6
  headers.append('atl-client-name', "@atlaskit/profilecard");
7
- headers.append('atl-client-version', "23.21.19");
7
+ headers.append('atl-client-version', "23.21.20");
8
8
  return headers;
9
9
  };
10
10
  export function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -56,7 +56,7 @@ export var addHeaders = function addHeaders(headers) {
56
56
  headers.append('X-ExperimentalApi', 'teams-beta');
57
57
  headers.append('X-ExperimentalApi', 'team-members-beta');
58
58
  headers.append('atl-client-name', "@atlaskit/profilecard");
59
- headers.append('atl-client-version', "23.21.19");
59
+ headers.append('atl-client-version', "23.21.20");
60
60
  return headers;
61
61
  };
62
62
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -3,10 +3,12 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import React, { useCallback, useState } from 'react';
5
5
  import { defineMessages, useIntl } from 'react-intl-next';
6
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
7
  import Button from '@atlaskit/button/new';
7
8
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
8
9
  import { Box, Inline, xcss } from '@atlaskit/primitives';
9
10
  import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
11
+ import { fireEvent } from '../../util/analytics';
10
12
  import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
11
13
  var chatToAgentButtonContainer = xcss({
12
14
  width: '100%'
@@ -49,6 +51,8 @@ export var AgentActions = function AgentActions(_ref) {
49
51
  resourceClient = _ref.resourceClient;
50
52
  var _useIntl = useIntl(),
51
53
  formatMessage = _useIntl.formatMessage;
54
+ var _useAnalyticsEvents = useAnalyticsEvents(),
55
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
52
56
  var _useState = useState(false),
53
57
  _useState2 = _slicedToArray(_useState, 2),
54
58
  isDeleteModalOpen = _useState2[0],
@@ -76,6 +80,18 @@ export var AgentActions = function AgentActions(_ref) {
76
80
  }
77
81
  }, _callee);
78
82
  })), [agent.id, resourceClient]);
83
+ var handleDeleteAgent = useCallback(function () {
84
+ fireEvent(createAnalyticsEvent, {
85
+ action: 'clicked',
86
+ actionSubject: 'button',
87
+ actionSubjectId: 'deleteAgentButton',
88
+ attributes: {
89
+ agentId: agent.id,
90
+ source: 'agentProfileCard'
91
+ }
92
+ });
93
+ setIsDeleteModalOpen(true);
94
+ }, [agent.id, createAnalyticsEvent]);
79
95
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
80
96
  space: "space.100",
81
97
  xcss: actionsWrapperStyles
@@ -99,9 +115,7 @@ export var AgentActions = function AgentActions(_ref) {
99
115
  }, formatMessage(messages.actionChatToAgent)))))), /*#__PURE__*/React.createElement(AgentDropdownMenu, {
100
116
  agentId: agent.id,
101
117
  isAgentCreatedByUser: isAgentCreatedByCurrentUser !== null && isAgentCreatedByCurrentUser !== void 0 ? isAgentCreatedByCurrentUser : false,
102
- onDeleteAgent: function onDeleteAgent() {
103
- return setIsDeleteModalOpen(true);
104
- },
118
+ onDeleteAgent: handleDeleteAgent,
105
119
  onEditAgent: onEditAgent,
106
120
  onDuplicateAgent: onDuplicateAgent,
107
121
  onCopyAgent: onCopyAgent,
@@ -44,7 +44,8 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
44
44
  resourceClient = _ref.resourceClient,
45
45
  addFlag = _ref.addFlag;
46
46
  var _useAgentUrlActions = useAgentUrlActions({
47
- cloudId: cloudId || ''
47
+ cloudId: cloudId || '',
48
+ source: 'agentProfileCard'
48
49
  }),
49
50
  _onEditAgent = _useAgentUrlActions.onEditAgent,
50
51
  _onCopyAgent = _useAgentUrlActions.onCopyAgent,
@@ -3,10 +3,12 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  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; }
4
4
  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
5
  import { useCallback } from 'react';
6
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
7
  import { getATLContextUrl } from '@atlaskit/atlassian-context';
7
8
  import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers';
9
10
  import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
11
+ import { fireEvent } from '../../../util/analytics';
10
12
  import { encodeParamsToUrl } from '../../../util/url';
11
13
  export var firstCharUpper = function firstCharUpper(str) {
12
14
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -23,9 +25,12 @@ var createRovoParams = function createRovoParams(params) {
23
25
  return rovoParams;
24
26
  };
25
27
  export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
26
- var cloudId = _ref3.cloudId;
28
+ var cloudId = _ref3.cloudId,
29
+ source = _ref3.source;
27
30
  var _useRovoPostMessageTo = useRovoPostMessageToPubsub(),
28
31
  publishWithPostMessage = _useRovoPostMessageTo.publishWithPostMessage;
32
+ var _useAnalyticsEvents = useAnalyticsEvents(),
33
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
29
34
  var onEditAgent = useCallback(function (agentId) {
30
35
  var url = "".concat(getATLContextUrl('home'), "/chat/agents/").concat(agentId, "/edit");
31
36
  var urlWithParams = encodeParamsToUrl(url, _objectSpread({
@@ -34,9 +39,27 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
34
39
  cloudId: cloudId
35
40
  })));
36
41
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
37
- }, [cloudId]);
42
+ fireEvent(createAnalyticsEvent, {
43
+ action: 'clicked',
44
+ actionSubject: 'button',
45
+ actionSubjectId: 'editAgentButton',
46
+ attributes: {
47
+ agentId: agentId,
48
+ source: source
49
+ }
50
+ });
51
+ }, [cloudId, createAnalyticsEvent, source]);
38
52
  var onCopyAgent = function onCopyAgent(agentId) {
39
53
  navigator.clipboard.writeText("".concat(window.location.origin, "/people/agent/").concat(agentId));
54
+ fireEvent(createAnalyticsEvent, {
55
+ action: 'clicked',
56
+ actionSubject: 'button',
57
+ actionSubjectId: 'copyAgentLinkButton',
58
+ attributes: {
59
+ agentId: agentId,
60
+ source: source
61
+ }
62
+ });
40
63
  };
41
64
  var onDuplicateAgent = useCallback(function (agentId) {
42
65
  var baseUrl = "".concat(getATLContextUrl('home'), "/chat/agents/new");
@@ -48,7 +71,16 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
48
71
  pathway: 'agents-create'
49
72
  })));
50
73
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
51
- }, [cloudId]);
74
+ fireEvent(createAnalyticsEvent, {
75
+ action: 'clicked',
76
+ actionSubject: 'button',
77
+ actionSubjectId: 'duplicateAgentButton',
78
+ attributes: {
79
+ agentId: agentId,
80
+ source: source
81
+ }
82
+ });
83
+ }, [cloudId, createAnalyticsEvent, source]);
52
84
  var onConversationStarter = function onConversationStarter(_ref4) {
53
85
  var agentId = _ref4.agentId,
54
86
  prompt = _ref4.prompt;
@@ -123,6 +155,15 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
123
155
  } else {
124
156
  window.open("".concat(window.location.origin, "/people/agent/").concat(agentId), '_blank', 'noopener, noreferrer');
125
157
  }
158
+ fireEvent(createAnalyticsEvent, {
159
+ action: 'clicked',
160
+ actionSubject: 'button',
161
+ actionSubjectId: 'viewAgentFullProfileButton',
162
+ attributes: {
163
+ agentId: agentId,
164
+ source: source
165
+ }
166
+ });
126
167
  };
127
168
  return {
128
169
  onEditAgent: onEditAgent,
@@ -39,7 +39,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
39
39
  actionSubjectId: actionSubjectId,
40
40
  attributes: _objectSpread(_objectSpread({
41
41
  packageName: "@atlaskit/profilecard",
42
- packageVersion: "23.21.19"
42
+ packageVersion: "23.21.20"
43
43
  }, attributes), {}, {
44
44
  firedAt: Math.round(getPageTime())
45
45
  })
@@ -1,6 +1,7 @@
1
1
  export declare const firstCharUpper: (str: string) => string;
2
- export declare const useAgentUrlActions: ({ cloudId }: {
2
+ export declare const useAgentUrlActions: ({ cloudId, source }: {
3
3
  cloudId: string;
4
+ source: string;
4
5
  }) => {
5
6
  onEditAgent: (agentId: string) => void;
6
7
  onCopyAgent: (agentId: string) => void;
@@ -1,6 +1,7 @@
1
1
  export declare const firstCharUpper: (str: string) => string;
2
- export declare const useAgentUrlActions: ({ cloudId }: {
2
+ export declare const useAgentUrlActions: ({ cloudId, source }: {
3
3
  cloudId: string;
4
+ source: string;
4
5
  }) => {
5
6
  onEditAgent: (agentId: string) => void;
6
7
  onCopyAgent: (agentId: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "23.21.20",
3
+ "version": "23.21.21",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -61,7 +61,7 @@
61
61
  "@atlaskit/feature-gate-js-client": "^5.5.0",
62
62
  "@atlaskit/give-kudos": "^4.3.0",
63
63
  "@atlaskit/heading": "^5.2.0",
64
- "@atlaskit/icon": "^27.7.0",
64
+ "@atlaskit/icon": "^27.8.0",
65
65
  "@atlaskit/link": "^3.2.0",
66
66
  "@atlaskit/logo": "^19.6.0",
67
67
  "@atlaskit/lozenge": "^13.0.0",