@atlaskit/profilecard 24.14.0 → 24.15.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.
Files changed (159) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/__tests__/vr-tests/__snapshots__/user-profilecard/error-state--default.png +0 -0
  3. package/__tests__/vr-tests/agent-profilecard.vr.tsx +7 -1
  4. package/__tests__/vr-tests/user-profilecard.vr.tsx +42 -6
  5. package/dist/cjs/client/ProfileCardClient.js +10 -10
  6. package/dist/cjs/client/RovoAgentCardClient.js +172 -56
  7. package/dist/cjs/client/TeamProfileCardClient.js +44 -14
  8. package/dist/cjs/client/UserProfileCardClient.js +2 -9
  9. package/dist/cjs/client/errorUtils.js +83 -5
  10. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
  11. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  12. package/dist/cjs/components/Agent/Actions.js +25 -11
  13. package/dist/cjs/components/Agent/ActionsCompiled.compiled.css +19 -0
  14. package/dist/cjs/components/Agent/ActionsCompiled.js +150 -0
  15. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +2 -4
  16. package/dist/cjs/components/Agent/AgentProfileCard.js +28 -14
  17. package/dist/cjs/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  18. package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +257 -0
  19. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
  20. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
  21. package/dist/cjs/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  22. package/dist/cjs/components/Agent/AgentProfileCardWrapper.js +9 -8
  23. package/dist/cjs/components/Agent/ConversationStarters.js +2 -4
  24. package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
  25. package/dist/cjs/components/Error/ErrorMessage.js +3 -3
  26. package/dist/cjs/components/Team/TeamForbiddenErrorState.js +21 -6
  27. package/dist/cjs/components/Team/TeamLoadingState.js +21 -6
  28. package/dist/cjs/components/Team/TeamProfileCard.js +155 -60
  29. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +107 -36
  30. package/dist/cjs/components/User/ProfileCardDetails.compiled.css +0 -1
  31. package/dist/cjs/components/User/ProfileCardDetails.js +2 -4
  32. package/dist/cjs/components/User/ReportingLinesDetails.js +4 -1
  33. package/dist/cjs/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  34. package/dist/cjs/components/User/ReportingLinesDetailsCompiled.js +109 -0
  35. package/dist/cjs/components/common/ProfileCardWrapper.compiled.css +1 -0
  36. package/dist/cjs/components/common/ProfileCardWrapper.js +9 -8
  37. package/dist/cjs/components/team-profile-card/main.js +18 -9
  38. package/dist/cjs/components/team-profile-card/team-actions/more-actions/index.js +2 -4
  39. package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
  40. package/dist/cjs/styled/CoverImage.compiled.css +2 -0
  41. package/dist/cjs/styled/CoverImage.js +4 -2
  42. package/dist/cjs/styled/Error.compiled.css +0 -2
  43. package/dist/cjs/styled/Error.js +5 -3
  44. package/dist/cjs/util/analytics.js +57 -2
  45. package/dist/es2019/client/ProfileCardClient.js +10 -10
  46. package/dist/es2019/client/RovoAgentCardClient.js +186 -58
  47. package/dist/es2019/client/TeamProfileCardClient.js +49 -16
  48. package/dist/es2019/client/UserProfileCardClient.js +3 -10
  49. package/dist/es2019/client/errorUtils.js +84 -3
  50. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
  51. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  52. package/dist/es2019/components/Agent/Actions.js +26 -11
  53. package/dist/es2019/components/Agent/ActionsCompiled.compiled.css +19 -0
  54. package/dist/es2019/components/Agent/ActionsCompiled.js +127 -0
  55. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +1 -2
  56. package/dist/es2019/components/Agent/AgentProfileCard.js +28 -13
  57. package/dist/es2019/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  58. package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +200 -0
  59. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
  60. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
  61. package/dist/es2019/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  62. package/dist/es2019/components/Agent/AgentProfileCardWrapper.js +8 -7
  63. package/dist/es2019/components/Agent/ConversationStarters.js +1 -3
  64. package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
  65. package/dist/es2019/components/Error/ErrorMessage.js +1 -2
  66. package/dist/es2019/components/Team/TeamForbiddenErrorState.js +17 -6
  67. package/dist/es2019/components/Team/TeamLoadingState.js +17 -6
  68. package/dist/es2019/components/Team/TeamProfileCard.js +144 -54
  69. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +75 -12
  70. package/dist/es2019/components/User/ProfileCardDetails.compiled.css +0 -1
  71. package/dist/es2019/components/User/ProfileCardDetails.js +1 -4
  72. package/dist/es2019/components/User/ReportingLinesDetails.js +4 -1
  73. package/dist/es2019/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  74. package/dist/es2019/components/User/ReportingLinesDetailsCompiled.js +96 -0
  75. package/dist/es2019/components/common/ProfileCardWrapper.compiled.css +1 -0
  76. package/dist/es2019/components/common/ProfileCardWrapper.js +8 -7
  77. package/dist/es2019/components/team-profile-card/main.js +19 -9
  78. package/dist/es2019/components/team-profile-card/team-actions/more-actions/index.js +1 -2
  79. package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
  80. package/dist/es2019/styled/CoverImage.compiled.css +2 -0
  81. package/dist/es2019/styled/CoverImage.js +4 -2
  82. package/dist/es2019/styled/Error.compiled.css +0 -2
  83. package/dist/es2019/styled/Error.js +6 -4
  84. package/dist/es2019/util/analytics.js +57 -2
  85. package/dist/esm/client/ProfileCardClient.js +10 -10
  86. package/dist/esm/client/RovoAgentCardClient.js +174 -58
  87. package/dist/esm/client/TeamProfileCardClient.js +46 -16
  88. package/dist/esm/client/UserProfileCardClient.js +3 -10
  89. package/dist/esm/client/errorUtils.js +82 -4
  90. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
  91. package/dist/esm/client/getTeamFromAGG.js +1 -1
  92. package/dist/esm/components/Agent/Actions.js +25 -11
  93. package/dist/esm/components/Agent/ActionsCompiled.compiled.css +19 -0
  94. package/dist/esm/components/Agent/ActionsCompiled.js +141 -0
  95. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +1 -2
  96. package/dist/esm/components/Agent/AgentProfileCard.js +29 -13
  97. package/dist/esm/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  98. package/dist/esm/components/Agent/AgentProfileCardCompiled.js +248 -0
  99. package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
  100. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
  101. package/dist/esm/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  102. package/dist/esm/components/Agent/AgentProfileCardWrapper.js +8 -7
  103. package/dist/esm/components/Agent/ConversationStarters.js +1 -3
  104. package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
  105. package/dist/esm/components/Error/ErrorMessage.js +1 -2
  106. package/dist/esm/components/Team/TeamForbiddenErrorState.js +22 -7
  107. package/dist/esm/components/Team/TeamLoadingState.js +22 -7
  108. package/dist/esm/components/Team/TeamProfileCard.js +156 -61
  109. package/dist/esm/components/Team/TeamProfileCardTrigger.js +106 -36
  110. package/dist/esm/components/User/ProfileCardDetails.compiled.css +0 -1
  111. package/dist/esm/components/User/ProfileCardDetails.js +1 -4
  112. package/dist/esm/components/User/ReportingLinesDetails.js +4 -1
  113. package/dist/esm/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  114. package/dist/esm/components/User/ReportingLinesDetailsCompiled.js +102 -0
  115. package/dist/esm/components/common/ProfileCardWrapper.compiled.css +1 -0
  116. package/dist/esm/components/common/ProfileCardWrapper.js +8 -7
  117. package/dist/esm/components/team-profile-card/main.js +18 -9
  118. package/dist/esm/components/team-profile-card/team-actions/more-actions/index.js +1 -2
  119. package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
  120. package/dist/esm/styled/CoverImage.compiled.css +2 -0
  121. package/dist/esm/styled/CoverImage.js +4 -2
  122. package/dist/esm/styled/Error.compiled.css +0 -2
  123. package/dist/esm/styled/Error.js +6 -4
  124. package/dist/esm/util/analytics.js +57 -2
  125. package/dist/types/client/ProfileCardClient.d.ts +5 -5
  126. package/dist/types/client/RovoAgentCardClient.d.ts +5 -4
  127. package/dist/types/client/TeamProfileCardClient.d.ts +2 -1
  128. package/dist/types/client/errorUtils.d.ts +2 -1
  129. package/dist/types/client/types.d.ts +14 -2
  130. package/dist/types/components/Agent/Actions.d.ts +10 -1
  131. package/dist/types/components/Agent/ActionsCompiled.d.ts +14 -0
  132. package/dist/types/components/Agent/AgentProfileCard.d.ts +13 -3
  133. package/dist/types/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
  134. package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +12 -1
  135. package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +2 -1
  136. package/dist/types/components/Team/TeamLoadingState.d.ts +2 -1
  137. package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +7 -2
  138. package/dist/types/components/User/ReportingLinesDetails.d.ts +2 -2
  139. package/dist/types/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
  140. package/dist/types/types.d.ts +2 -0
  141. package/dist/types/util/analytics.d.ts +46 -2
  142. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -5
  143. package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +5 -4
  144. package/dist/types-ts4.5/client/TeamProfileCardClient.d.ts +2 -1
  145. package/dist/types-ts4.5/client/errorUtils.d.ts +2 -1
  146. package/dist/types-ts4.5/client/types.d.ts +14 -2
  147. package/dist/types-ts4.5/components/Agent/Actions.d.ts +10 -1
  148. package/dist/types-ts4.5/components/Agent/ActionsCompiled.d.ts +14 -0
  149. package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +13 -3
  150. package/dist/types-ts4.5/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
  151. package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +12 -1
  152. package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +2 -1
  153. package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +2 -1
  154. package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +7 -2
  155. package/dist/types-ts4.5/components/User/ReportingLinesDetails.d.ts +2 -2
  156. package/dist/types-ts4.5/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
  157. package/dist/types-ts4.5/types.d.ts +2 -0
  158. package/dist/types-ts4.5/util/analytics.d.ts +46 -2
  159. package/package.json +15 -9
@@ -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: function 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
  });
@@ -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
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
4
- import { Box, xcss } from '@atlaskit/primitives';
5
- var styles = xcss({
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,
@@ -8,6 +8,7 @@ import { getATLContextUrl } from '@atlaskit/atlassian-context';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers';
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 { encodeParamsToUrl } from '../../../util/url';
13
14
  export var firstCharUpper = function firstCharUpper(str) {
@@ -31,6 +32,8 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
31
32
  publishWithPostMessage = _useRovoPostMessageTo.publishWithPostMessage;
32
33
  var _useAnalyticsEvents = useAnalyticsEvents(),
33
34
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
35
+ var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
36
+ fireEventNext = _useAnalyticsEventsNe.fireEvent;
34
37
  var onEditAgent = useCallback(function (agentId) {
35
38
  var url = "".concat(getATLContextUrl('home'), "/chat/agents/").concat(agentId, "/edit");
36
39
  var urlWithParams = encodeParamsToUrl(url, _objectSpread({
@@ -39,27 +42,41 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
39
42
  cloudId: cloudId
40
43
  })));
41
44
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
42
- fireEvent(createAnalyticsEvent, {
43
- action: 'clicked',
44
- actionSubject: 'button',
45
- actionSubjectId: 'editAgentButton',
46
- attributes: {
45
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
46
+ fireEventNext('ui.button.clicked.editAgentButton', {
47
47
  agentId: agentId,
48
48
  source: source
49
- }
50
- });
51
- }, [cloudId, createAnalyticsEvent, source]);
49
+ });
50
+ } else {
51
+ fireEvent(createAnalyticsEvent, {
52
+ action: 'clicked',
53
+ actionSubject: 'button',
54
+ actionSubjectId: 'editAgentButton',
55
+ attributes: {
56
+ agentId: agentId,
57
+ source: source
58
+ }
59
+ });
60
+ }
61
+ }, [cloudId, createAnalyticsEvent, fireEventNext, source]);
52
62
  var onCopyAgent = function onCopyAgent(agentId) {
53
63
  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: {
64
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
65
+ fireEventNext('ui.button.clicked.copyAgentLinkButton', {
59
66
  agentId: agentId,
60
67
  source: source
61
- }
62
- });
68
+ });
69
+ } else {
70
+ fireEvent(createAnalyticsEvent, {
71
+ action: 'clicked',
72
+ actionSubject: 'button',
73
+ actionSubjectId: 'copyAgentLinkButton',
74
+ attributes: {
75
+ agentId: agentId,
76
+ source: source
77
+ }
78
+ });
79
+ }
63
80
  };
64
81
  var onDuplicateAgent = useCallback(function (agentId) {
65
82
  var baseUrl = "".concat(getATLContextUrl('home'), "/chat/agents/new");
@@ -71,16 +88,23 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
71
88
  pathway: 'agents-create'
72
89
  })));
73
90
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
74
- fireEvent(createAnalyticsEvent, {
75
- action: 'clicked',
76
- actionSubject: 'button',
77
- actionSubjectId: 'duplicateAgentButton',
78
- attributes: {
91
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
92
+ fireEventNext('ui.button.clicked.duplicateAgentButton', {
79
93
  agentId: agentId,
80
94
  source: source
81
- }
82
- });
83
- }, [cloudId, createAnalyticsEvent, source]);
95
+ });
96
+ } else {
97
+ fireEvent(createAnalyticsEvent, {
98
+ action: 'clicked',
99
+ actionSubject: 'button',
100
+ actionSubjectId: 'duplicateAgentButton',
101
+ attributes: {
102
+ agentId: agentId,
103
+ source: source
104
+ }
105
+ });
106
+ }
107
+ }, [cloudId, createAnalyticsEvent, fireEventNext, source]);
84
108
  var onConversationStarter = function onConversationStarter(_ref4) {
85
109
  var agentId = _ref4.agentId,
86
110
  prompt = _ref4.prompt;
@@ -155,15 +179,22 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
155
179
  } else {
156
180
  window.open("".concat(window.location.origin, "/people/agent/").concat(agentId), '_blank', 'noopener, noreferrer');
157
181
  }
158
- fireEvent(createAnalyticsEvent, {
159
- action: 'clicked',
160
- actionSubject: 'button',
161
- actionSubjectId: 'viewAgentFullProfileButton',
162
- attributes: {
182
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
183
+ fireEventNext('ui.button.clicked.viewAgentFullProfileButton', {
163
184
  agentId: agentId,
164
185
  source: source
165
- }
166
- });
186
+ });
187
+ } else {
188
+ fireEvent(createAnalyticsEvent, {
189
+ action: 'clicked',
190
+ actionSubject: 'button',
191
+ actionSubjectId: 'viewAgentFullProfileButton',
192
+ attributes: {
193
+ agentId: agentId,
194
+ source: source
195
+ }
196
+ });
197
+ }
167
198
  };
168
199
  return {
169
200
  onEditAgent: onEditAgent,
@@ -6,8 +6,7 @@ import Button from '@atlaskit/button/new';
6
6
  import CrossCircleIcon from '@atlaskit/icon/core/cross-circle';
7
7
  import IconError from '@atlaskit/icon/glyph/cross-circle';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
10
- import { Text } from '@atlaskit/primitives';
9
+ import { Text } from '@atlaskit/primitives/compiled';
11
10
  import { ErrorTitle, ErrorWrapper } from '../../styled/Error';
12
11
  import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
13
12
  var ErrorMessage = function ErrorMessage(props) {
@@ -1,20 +1,35 @@
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 { useIntl } from 'react-intl-next';
3
6
  import EmptyState from '@atlaskit/empty-state';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
4
8
  import messages from '../../messages';
5
9
  import { AccessLockSVGWrapper, TeamForbiddenErrorStateWrapper } from '../../styled/TeamCard';
6
- import { profileCardRendered } from '../../util/analytics';
10
+ import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
11
+ import { getPageTime } from '../../util/performance';
7
12
  import AccessLockSVG from '../Error/AccessLockSVG';
8
13
  export default (function (props) {
9
- var analytics = props.analytics;
14
+ var analytics = props.analytics,
15
+ analyticsNext = props.analyticsNext;
10
16
  var intl = useIntl();
11
17
  useEffect(function () {
12
- analytics(function (duration) {
13
- return profileCardRendered('team', 'error', {
14
- duration: duration
18
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
19
+ analyticsNext('ui.teamProfileCard.rendered.error', function (duration) {
20
+ return _objectSpread({
21
+ duration: duration,
22
+ firedAt: Math.round(getPageTime())
23
+ }, PACKAGE_META_DATA);
15
24
  });
16
- });
17
- }, [analytics]);
25
+ } else {
26
+ analytics(function (duration) {
27
+ return profileCardRendered('team', 'error', {
28
+ duration: duration
29
+ });
30
+ });
31
+ }
32
+ }, [analytics, analyticsNext]);
18
33
  return /*#__PURE__*/React.createElement(TeamForbiddenErrorStateWrapper, {
19
34
  testId: "team-profilecard-forbidden-error-state"
20
35
  }, /*#__PURE__*/React.createElement(EmptyState, {
@@ -1,16 +1,31 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  import React, { useEffect } from 'react';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
2
6
  import Spinner from '@atlaskit/spinner';
3
7
  import { CardContent, CardHeader, CardWrapper, LoadingWrapper } from '../../styled/TeamTrigger';
4
- import { profileCardRendered } from '../../util/analytics';
8
+ import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
9
+ import { getPageTime } from '../../util/performance';
5
10
  export default (function (props) {
6
- var analytics = props.analytics;
11
+ var analytics = props.analytics,
12
+ analyticsNext = props.analyticsNext;
7
13
  useEffect(function () {
8
- analytics(function (duration) {
9
- return profileCardRendered('team', 'spinner', {
10
- duration: duration
14
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
15
+ analyticsNext('ui.teamProfileCard.rendered.spinner', function (duration) {
16
+ return _objectSpread({
17
+ duration: duration,
18
+ firedAt: Math.round(getPageTime())
19
+ }, PACKAGE_META_DATA);
11
20
  });
12
- });
13
- }, [analytics]);
21
+ } else {
22
+ analytics(function (duration) {
23
+ return profileCardRendered('team', 'spinner', {
24
+ duration: duration
25
+ });
26
+ });
27
+ }
28
+ }, [analytics, analyticsNext]);
14
29
  return /*#__PURE__*/React.createElement(CardWrapper, {
15
30
  testId: "team-profilecard"
16
31
  }, /*#__PURE__*/React.createElement(CardHeader, {