@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
@@ -1,7 +1,8 @@
1
- import { teamRequestAnalytics } from '../util/analytics';
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { PACKAGE_META_DATA, teamRequestAnalytics } from '../util/analytics';
2
3
  import { getPageTime } from '../util/performance';
3
4
  import CachingClient from './CachingClient';
4
- import { getErrorAttributes } from './errorUtils';
5
+ import { DEPRECATED_getErrorAttributes, getErrorAttributes } from './errorUtils';
5
6
  import { getTeamFromAGG } from './getTeamFromAGG';
6
7
  export default class TeamProfileCardClient extends CachingClient {
7
8
  constructor(options) {
@@ -14,7 +15,7 @@ export default class TeamProfileCardClient extends CachingClient {
14
15
  }
15
16
  return getTeamFromAGG(this.options.gatewayGraphqlUrl, teamId, this.options.cloudId);
16
17
  }
17
- getProfile(teamId, orgId, analytics) {
18
+ getProfile(teamId, orgId, analytics, analyticsNext) {
18
19
  if (!teamId) {
19
20
  return Promise.reject(new Error('teamId is missing'));
20
21
  }
@@ -24,27 +25,59 @@ export default class TeamProfileCardClient extends CachingClient {
24
25
  }
25
26
  return new Promise((resolve, reject) => {
26
27
  const startTime = getPageTime();
27
- if (analytics) {
28
- analytics(teamRequestAnalytics('triggered'));
28
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
29
+ if (analyticsNext) {
30
+ analyticsNext('operational.teamProfileCard.triggered.request', {
31
+ firedAt: Math.round(getPageTime()),
32
+ ...PACKAGE_META_DATA
33
+ });
34
+ }
35
+ } else {
36
+ if (analytics) {
37
+ analytics(teamRequestAnalytics('triggered'));
38
+ }
29
39
  }
30
40
  this.makeRequest(teamId, orgId).then(data => {
31
41
  if (this.cache) {
32
42
  this.setCachedProfile(teamId, data);
33
43
  }
34
- if (analytics) {
35
- analytics(teamRequestAnalytics('succeeded', {
36
- duration: getPageTime() - startTime,
37
- gateway: true
38
- }));
44
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
45
+ if (analyticsNext) {
46
+ analyticsNext('operational.teamProfileCard.succeeded.request', {
47
+ duration: getPageTime() - startTime,
48
+ gateway: true,
49
+ firedAt: Math.round(getPageTime()),
50
+ ...PACKAGE_META_DATA
51
+ });
52
+ }
53
+ } else {
54
+ if (analytics) {
55
+ analytics(teamRequestAnalytics('succeeded', {
56
+ duration: getPageTime() - startTime,
57
+ gateway: true
58
+ }));
59
+ }
39
60
  }
40
61
  resolve(data);
41
62
  }).catch(error => {
42
- if (analytics) {
43
- analytics(teamRequestAnalytics('failed', {
44
- duration: getPageTime() - startTime,
45
- ...getErrorAttributes(error),
46
- gateway: true
47
- }));
63
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
64
+ if (analyticsNext) {
65
+ analyticsNext('operational.teamProfileCard.failed.request', {
66
+ duration: getPageTime() - startTime,
67
+ ...getErrorAttributes(error),
68
+ gateway: true,
69
+ firedAt: Math.round(getPageTime()),
70
+ ...PACKAGE_META_DATA
71
+ });
72
+ }
73
+ } else {
74
+ if (analytics) {
75
+ analytics(teamRequestAnalytics('failed', {
76
+ duration: getPageTime() - startTime,
77
+ ...DEPRECATED_getErrorAttributes(error),
78
+ gateway: true
79
+ }));
80
+ }
48
81
  }
49
82
  reject(error);
50
83
  });
@@ -5,7 +5,7 @@ import { PACKAGE_META_DATA, userRequestAnalytics } from '../util/analytics';
5
5
  import { localTime } from '../util/date';
6
6
  import { getPageTime } from '../util/performance';
7
7
  import CachingClient from './CachingClient';
8
- import { getErrorAttributes } from './errorUtils';
8
+ import { DEPRECATED_getErrorAttributes, getErrorAttributes } from './errorUtils';
9
9
  import { AGGQuery } from './graphqlUtils';
10
10
 
11
11
  /**
@@ -195,16 +195,9 @@ export default class UserProfileCardClient extends CachingClient {
195
195
  }).catch(error => {
196
196
  if (fg('ptc-enable-profile-card-analytics-refactor')) {
197
197
  if (analyticsNext) {
198
- const errorAttributes = getErrorAttributes(error);
199
198
  analyticsNext('operational.profilecard.failed.request', {
200
199
  duration: getPageTime() - startTime,
201
- ...errorAttributes,
202
- traceId: errorAttributes.traceId || null,
203
- errorCategory: errorAttributes.errorCategory || null,
204
- errorType: errorAttributes.errorType || null,
205
- errorPath: errorAttributes.errorPath || null,
206
- errorNumber: errorAttributes.errorNumber || null,
207
- errorStatusCode: errorAttributes.errorStatusCode || null,
200
+ ...getErrorAttributes(error),
208
201
  firedAt: Math.round(getPageTime()),
209
202
  ...PACKAGE_META_DATA
210
203
  });
@@ -213,7 +206,7 @@ export default class UserProfileCardClient extends CachingClient {
213
206
  if (analytics) {
214
207
  analytics(userRequestAnalytics('failed', {
215
208
  duration: getPageTime() - startTime,
216
- ...getErrorAttributes(error)
209
+ ...DEPRECATED_getErrorAttributes(error)
217
210
  }));
218
211
  }
219
212
  }
@@ -15,12 +15,12 @@ function isIgnoredError(error) {
15
15
  }
16
16
  return false;
17
17
  }
18
- export const getErrorAttributes = error => {
18
+ export const DEPRECATED_getErrorAttributes = error => {
19
19
  if (error instanceof DirectoryGraphQLErrors) {
20
20
  return {
21
21
  errorMessage: error.message,
22
22
  errorCount: error.errors.length,
23
- errorDetails: error.errors.map(getErrorAttributes),
23
+ errorDetails: error.errors.map(DEPRECATED_getErrorAttributes),
24
24
  isSLOFailure: !error.errors.every(isIgnoredError),
25
25
  traceId: error.traceId
26
26
  };
@@ -37,7 +37,7 @@ export const getErrorAttributes = error => {
37
37
  return {
38
38
  errorMessage: error.message,
39
39
  errorCount: error.errors.length,
40
- errorDetails: error.errors.map(getErrorAttributes),
40
+ errorDetails: error.errors.map(DEPRECATED_getErrorAttributes),
41
41
  isSLOFailure: !error.errors.every(isIgnoredError),
42
42
  traceId: error.traceId
43
43
  };
@@ -49,6 +49,84 @@ export const getErrorAttributes = error => {
49
49
  isSLOFailure: !isIgnoredError(error),
50
50
  errorCategory: error.classification
51
51
  };
52
+ } else if (error instanceof Error) {
53
+ // Jira custom profile card client error, they wrap the error & put the underlying error in the cause property
54
+ if (error.message.startsWith('Unable to fetch user:')) {
55
+ if (error.hasOwnProperty('cause')) {
56
+ const causeError = error.cause;
57
+ if (causeError instanceof DirectoryGraphQLErrors || causeError instanceof AGGErrors) {
58
+ return DEPRECATED_getErrorAttributes(causeError);
59
+ }
60
+ }
61
+ return {
62
+ errorMessage: error.message,
63
+ isSLOFailure: false
64
+ };
65
+ }
66
+ return {
67
+ errorMessage: error.message,
68
+ isSLOFailure: true
69
+ };
70
+ }
71
+
72
+ // Unknown
73
+ return {
74
+ errorMessage: 'Unknown error',
75
+ isSLOFailure: true
76
+ };
77
+ };
78
+ export const getErrorAttributes = error => {
79
+ const defaultErrorAttributes = {
80
+ errorCount: null,
81
+ errorDetails: null,
82
+ errorCategory: null,
83
+ errorType: null,
84
+ errorPath: null,
85
+ errorNumber: null,
86
+ errorStatusCode: null,
87
+ traceId: null
88
+ };
89
+ if (error instanceof DirectoryGraphQLErrors) {
90
+ var _error$traceId;
91
+ return {
92
+ ...defaultErrorAttributes,
93
+ errorMessage: error.message,
94
+ errorCount: error.errors.length,
95
+ errorDetails: error.errors.map(getErrorAttributes),
96
+ isSLOFailure: !error.errors.every(isIgnoredError),
97
+ traceId: (_error$traceId = error.traceId) !== null && _error$traceId !== void 0 ? _error$traceId : null
98
+ };
99
+ } else if (error instanceof DirectoryGraphQLError) {
100
+ var _error$errorNumber;
101
+ return {
102
+ ...defaultErrorAttributes,
103
+ errorMessage: error.message,
104
+ errorCategory: error.category,
105
+ errorType: error.type,
106
+ errorPath: error.path,
107
+ errorNumber: (_error$errorNumber = error.errorNumber) !== null && _error$errorNumber !== void 0 ? _error$errorNumber : null,
108
+ isSLOFailure: !isIgnoredError(error)
109
+ };
110
+ } else if (error instanceof AGGErrors) {
111
+ var _error$traceId2;
112
+ return {
113
+ ...defaultErrorAttributes,
114
+ errorMessage: error.message,
115
+ errorCount: error.errors.length,
116
+ errorDetails: error.errors.map(getErrorAttributes),
117
+ isSLOFailure: !error.errors.every(isIgnoredError),
118
+ traceId: (_error$traceId2 = error.traceId) !== null && _error$traceId2 !== void 0 ? _error$traceId2 : null
119
+ };
120
+ } else if (error instanceof AGGError) {
121
+ var _error$errorType, _error$statusCode, _error$classification;
122
+ return {
123
+ ...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
+ };
52
130
  } else if (error instanceof Error) {
53
131
  // Jira custom profile card client error, they wrap the error & put the underlying error in the cause property
54
132
  if (error.message.startsWith('Unable to fetch user:')) {
@@ -59,11 +137,13 @@ export const getErrorAttributes = error => {
59
137
  }
60
138
  }
61
139
  return {
140
+ ...defaultErrorAttributes,
62
141
  errorMessage: error.message,
63
142
  isSLOFailure: false
64
143
  };
65
144
  }
66
145
  return {
146
+ ...defaultErrorAttributes,
67
147
  errorMessage: error.message,
68
148
  isSLOFailure: true
69
149
  };
@@ -71,6 +151,7 @@ export const getErrorAttributes = error => {
71
151
 
72
152
  // Unknown
73
153
  return {
154
+ ...defaultErrorAttributes,
74
155
  errorMessage: 'Unknown error',
75
156
  isSLOFailure: true
76
157
  };
@@ -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', "24.13.7");
9
+ headers.append('atl-client-version', "0.0.0-development");
10
10
  return headers;
11
11
  };
12
12
  export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
@@ -77,7 +77,7 @@ export const addHeaders = headers => {
77
77
  headers.append('X-ExperimentalApi', 'teams-beta');
78
78
  headers.append('X-ExperimentalApi', 'team-members-beta');
79
79
  headers.append('atl-client-name', "@atlaskit/profilecard");
80
- headers.append('atl-client-version', "24.13.7");
80
+ headers.append('atl-client-version', "0.0.0-development");
81
81
  return headers;
82
82
  };
83
83
  export async function getTeamFromAGG(url, teamId, siteId) {
@@ -3,10 +3,13 @@ import { defineMessages, useIntl } from 'react-intl-next';
3
3
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
4
  import Button from '@atlaskit/button/new';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
6
7
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
7
8
  import { Box, Inline, xcss } from '@atlaskit/primitives';
8
9
  import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
10
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
9
11
  import { fireEvent } from '../../util/analytics';
12
+ import { AgentActions as AgentActionsCompiled } from './ActionsCompiled';
10
13
  import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
11
14
  const chatToAgentButtonContainer = xcss({
12
15
  width: '100%'
@@ -37,7 +40,7 @@ const actionsWrapperStyles = xcss({
37
40
  marginBlockStart: 'space.200',
38
41
  color: 'color.text'
39
42
  });
40
- export const AgentActions = ({
43
+ const _AgentActions = ({
41
44
  onEditAgent,
42
45
  onDeleteAgent,
43
46
  onDuplicateAgent,
@@ -53,6 +56,9 @@ export const AgentActions = ({
53
56
  const {
54
57
  createAnalyticsEvent
55
58
  } = useAnalyticsEvents();
59
+ const {
60
+ fireEvent: fireEventNext
61
+ } = useAnalyticsEventsNext();
56
62
  const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
57
63
  const isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
58
64
  const loadAgentPermissions = useCallback(async () => {
@@ -72,17 +78,24 @@ export const AgentActions = ({
72
78
  };
73
79
  }, [agent.id, resourceClient]);
74
80
  const handleDeleteAgent = useCallback(() => {
75
- fireEvent(createAnalyticsEvent, {
76
- action: 'clicked',
77
- actionSubject: 'button',
78
- actionSubjectId: 'deleteAgentButton',
79
- attributes: {
81
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
82
+ fireEventNext('ui.button.clicked.deleteAgentButton', {
80
83
  agentId: agent.id,
81
84
  source: 'agentProfileCard'
82
- }
83
- });
85
+ });
86
+ } else {
87
+ fireEvent(createAnalyticsEvent, {
88
+ action: 'clicked',
89
+ actionSubject: 'button',
90
+ actionSubjectId: 'deleteAgentButton',
91
+ attributes: {
92
+ agentId: agent.id,
93
+ source: 'agentProfileCard'
94
+ }
95
+ });
96
+ }
84
97
  setIsDeleteModalOpen(true);
85
- }, [agent.id, createAnalyticsEvent]);
98
+ }, [agent.id, createAnalyticsEvent, fireEventNext]);
86
99
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
87
100
  space: "space.100",
88
101
  xcss: actionsWrapperStyles
@@ -114,7 +127,8 @@ export const AgentActions = ({
114
127
  loadPermissionsOnMount: true,
115
128
  onViewAgentFullProfileClick: onViewFullProfileClick,
116
129
  doesAgentHaveIdentityAccountId: !!agent.identity_account_id,
117
- shouldTriggerStopPropagation: true
130
+ shouldTriggerStopPropagation: true,
131
+ dropdownMenuTestId: "agent-dropdown-menu"
118
132
  })), /*#__PURE__*/React.createElement(AgentDeleteConfirmationModal, {
119
133
  isOpen: isDeleteModalOpen,
120
134
  onClose: () => {
@@ -131,4 +145,5 @@ const messages = defineMessages({
131
145
  defaultMessage: 'Chat to Agent',
132
146
  description: 'Text for the "chat to agent" action to chat to the agent'
133
147
  }
134
- });
148
+ });
149
+ export const AgentActions = componentWithFG('profilecard_primitives_compiled', AgentActionsCompiled, _AgentActions);
@@ -0,0 +1,19 @@
1
+
2
+ ._189ee4h9{border-width:var(--ds-border-width,1px)}
3
+ ._18zrv77o{padding-inline:var(--ds-space-025,2px)}
4
+ ._1h6dmuej{border-color:var(--ds-border,#091e4224)}._15a5nqa1{border-top-style:solid}
5
+ ._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
6
+ ._1bah1h6o{justify-content:center}
7
+ ._1bsb1osq{width:100%}
8
+ ._1e0c1txw{display:flex}
9
+ ._1nmz1hna{word-break:break-word}
10
+ ._1pfhpxbi{margin-block-start:var(--ds-space-200,1pc)}
11
+ ._1ul9gktf{min-width:20px}
12
+ ._4t3igktf{height:20px}
13
+ ._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
14
+ ._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
15
+ ._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
16
+ ._o5721jtm{white-space:pre-wrap}
17
+ ._syaz1fxt{color:var(--ds-text,#172b4d)}
18
+ ._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
19
+ ._y3gn1e5h{text-align:left}
@@ -0,0 +1,127 @@
1
+ /* ActionsCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import "./ActionsCompiled.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React, { useCallback, useState } from 'react';
5
+ import { defineMessages, useIntl } from 'react-intl-next';
6
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
+ import Button from '@atlaskit/button/new';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
+ import { Box, Inline } from '@atlaskit/primitives/compiled';
10
+ import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
11
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
12
+ import { fireEvent } from '../../util/analytics';
13
+ import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
14
+ const styles = {
15
+ chatToAgentButtonContainer: "_1bsb1osq",
16
+ chatToAgentButtonWrapper: "_1e0c1txw _1bah1h6o _k48p1wq8 _4t3igktf",
17
+ chatPillButtonInlineStyles: "_18zrv77o",
18
+ chatPillTextStyles: "_1nmz1hna _y3gn1e5h _o5721jtm",
19
+ chatPillIconWrapper: "_1ul9gktf _4t3igktf",
20
+ actionsWrapperStyles: "_189ee4h9 _1h6dmuej _15a5nqa1 _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi _1pfhpxbi _syaz1fxt"
21
+ };
22
+ export const AgentActions = ({
23
+ onEditAgent,
24
+ onDeleteAgent,
25
+ onDuplicateAgent,
26
+ onCopyAgent,
27
+ onChatClick,
28
+ onViewFullProfileClick,
29
+ agent,
30
+ resourceClient
31
+ }) => {
32
+ const {
33
+ formatMessage
34
+ } = useIntl();
35
+ const {
36
+ createAnalyticsEvent
37
+ } = useAnalyticsEvents();
38
+ const {
39
+ fireEvent: fireEventNext
40
+ } = useAnalyticsEventsNext();
41
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
42
+ const isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
43
+ const loadAgentPermissions = useCallback(async () => {
44
+ const {
45
+ permissions: {
46
+ AGENT_CREATE,
47
+ AGENT_UPDATE,
48
+ AGENT_DEACTIVATE
49
+ }
50
+ } = await resourceClient.getRovoAgentPermissions(agent.id);
51
+ return {
52
+ ...(fg('agent_studio_fe_permissions_settings_m1') && {
53
+ isCreateEnabled: AGENT_CREATE.permitted
54
+ }),
55
+ isEditEnabled: AGENT_UPDATE.permitted,
56
+ isDeleteEnabled: AGENT_DEACTIVATE.permitted
57
+ };
58
+ }, [agent.id, resourceClient]);
59
+ const handleDeleteAgent = useCallback(() => {
60
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
61
+ fireEventNext('ui.button.clicked.deleteAgentButton', {
62
+ agentId: agent.id,
63
+ source: 'agentProfileCard'
64
+ });
65
+ } else {
66
+ fireEvent(createAnalyticsEvent, {
67
+ action: 'clicked',
68
+ actionSubject: 'button',
69
+ actionSubjectId: 'deleteAgentButton',
70
+ attributes: {
71
+ agentId: agent.id,
72
+ source: 'agentProfileCard'
73
+ }
74
+ });
75
+ }
76
+ setIsDeleteModalOpen(true);
77
+ }, [agent.id, createAnalyticsEvent, fireEventNext]);
78
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
79
+ space: "space.100",
80
+ xcss: styles.actionsWrapperStyles
81
+ }, /*#__PURE__*/React.createElement(Box, {
82
+ xcss: styles.chatToAgentButtonContainer
83
+ }, /*#__PURE__*/React.createElement(Button, {
84
+ shouldFitContainer: true,
85
+ onClick: e => {
86
+ e.stopPropagation();
87
+ onChatClick(e);
88
+ }
89
+ }, /*#__PURE__*/React.createElement(Box, {
90
+ xcss: styles.chatToAgentButtonWrapper
91
+ }, /*#__PURE__*/React.createElement(Inline, {
92
+ space: "space.050",
93
+ xcss: styles.chatPillButtonInlineStyles,
94
+ alignBlock: "center"
95
+ }, /*#__PURE__*/React.createElement(Box, {
96
+ xcss: styles.chatPillIconWrapper
97
+ }, /*#__PURE__*/React.createElement(ChatPillIcon, null)), /*#__PURE__*/React.createElement(Box, {
98
+ xcss: styles.chatPillTextStyles
99
+ }, formatMessage(messages.actionChatToAgent)))))), /*#__PURE__*/React.createElement(AgentDropdownMenu, {
100
+ agentId: agent.id,
101
+ onDeleteAgent: handleDeleteAgent,
102
+ onEditAgent: onEditAgent,
103
+ onDuplicateAgent: onDuplicateAgent,
104
+ onCopyAgent: onCopyAgent,
105
+ isForgeAgent: isForgeAgent,
106
+ loadAgentPermissions: loadAgentPermissions,
107
+ loadPermissionsOnMount: true,
108
+ onViewAgentFullProfileClick: onViewFullProfileClick,
109
+ doesAgentHaveIdentityAccountId: !!agent.identity_account_id,
110
+ shouldTriggerStopPropagation: true
111
+ })), /*#__PURE__*/React.createElement(AgentDeleteConfirmationModal, {
112
+ isOpen: isDeleteModalOpen,
113
+ onClose: () => {
114
+ setIsDeleteModalOpen(false);
115
+ },
116
+ onSubmit: onDeleteAgent,
117
+ agentId: agent.id,
118
+ agentName: agent.name
119
+ }));
120
+ };
121
+ const messages = defineMessages({
122
+ actionChatToAgent: {
123
+ id: 'ptc-directory.agent-profile.action.dropdown.chat-to-agent.nonfinal',
124
+ defaultMessage: 'Chat to Agent',
125
+ description: 'Text for the "chat to agent" action to chat to the agent'
126
+ }
127
+ });
@@ -2,8 +2,7 @@ import React, { useCallback } from 'react';
2
2
  import { defineMessages, useIntl } from 'react-intl-next';
3
3
  import Button from '@atlaskit/button/new';
4
4
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
5
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
6
- import { Text } from '@atlaskit/primitives';
5
+ import { Text } from '@atlaskit/primitives/compiled';
7
6
  export const AgentDeleteConfirmationModal = ({
8
7
  onClose,
9
8
  agentName,
@@ -1,13 +1,18 @@
1
1
  import React, { useCallback, useEffect, useState } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
4
6
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
5
7
  import { Box, Stack, xcss } from '@atlaskit/primitives';
6
8
  import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
7
- import { fireEvent, profileCardRendered } from '../../util/analytics';
9
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
10
+ import { fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
11
+ import { getPageTime } from '../../util/performance';
8
12
  import { LoadingState } from '../common/LoadingState';
9
13
  import { ErrorMessage } from '../Error';
10
14
  import { AgentActions } from './Actions';
15
+ import { default as AgentProfileCardCompiled } from './AgentProfileCardCompiled';
11
16
  import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
12
17
  import { ConversationStarters } from './ConversationStarters';
13
18
  import { useAgentUrlActions } from './hooks/useAgentActions';
@@ -55,6 +60,9 @@ const AgentProfileCard = ({
55
60
  const {
56
61
  formatMessage
57
62
  } = useIntl();
63
+ const {
64
+ fireEvent: fireEventNext
65
+ } = useAnalyticsEventsNext();
58
66
  const userDefinedConversationStarters = agent === null || agent === void 0 ? 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(starter => {
59
67
  return {
60
68
  message: starter,
@@ -76,7 +84,7 @@ const AgentProfileCard = ({
76
84
  const handleSetFavourite = useCallback(async () => {
77
85
  if (agent !== null && agent !== void 0 && agent.id) {
78
86
  try {
79
- await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
87
+ await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics, fireEventNext);
80
88
  if (isStarred) {
81
89
  setStarCount(starCount ? starCount - 1 : 0);
82
90
  } else {
@@ -85,7 +93,7 @@ const AgentProfileCard = ({
85
93
  setIsStarred(!isStarred);
86
94
  } catch (error) {}
87
95
  }
88
- }, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
96
+ }, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, fireEventNext, isStarred, resourceClient, starCount]);
89
97
  const handleOnDelete = useCallback(async () => {
90
98
  if (agent && onDeleteAgent) {
91
99
  // Optimistically remove from cache
@@ -93,7 +101,7 @@ const AgentProfileCard = ({
93
101
  restore
94
102
  } = onDeleteAgent(agent.id);
95
103
  try {
96
- await resourceClient.deleteAgent(agent.id, fireAnalytics);
104
+ await resourceClient.deleteAgent(agent.id, fireAnalytics, fireEventNext);
97
105
  addFlag === null || addFlag === void 0 ? void 0 : addFlag({
98
106
  title: formatMessage(messages.agentDeletedSuccessFlagTitle),
99
107
  description: formatMessage(messages.agentDeletedSuccessFlagDescription, {
@@ -113,25 +121,31 @@ const AgentProfileCard = ({
113
121
  });
114
122
  }
115
123
  }
116
- }, [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics]);
124
+ }, [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics, fireEventNext]);
117
125
  useEffect(() => {
118
126
  if (!isLoading && agent) {
119
- fireAnalytics(profileCardRendered('agent', 'content'));
127
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
128
+ fireEventNext(`ui.rovoAgentProfilecard.rendered.content`, {
129
+ ...PACKAGE_META_DATA,
130
+ firedAt: Math.round(getPageTime())
131
+ });
132
+ } else {
133
+ fireAnalytics(profileCardRendered('agent', 'content'));
134
+ }
120
135
  }
121
- }, [agent, fireAnalytics, isLoading]);
136
+ }, [agent, fireAnalytics, fireEventNext, isLoading]);
122
137
  if (isLoading) {
123
138
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
124
139
  profileType: "agent",
125
- fireAnalytics: fireAnalytics
140
+ fireAnalytics: fireAnalytics,
141
+ fireAnalyticsNext: fireEventNext
126
142
  }));
127
143
  }
128
144
  if (hasError || !agent) {
129
145
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
130
146
  errorType: errorType,
131
- fireAnalytics: fireAnalytics
132
- // TODO: Add fireAnalyticsNext
133
- ,
134
- fireAnalyticsNext: () => {}
147
+ fireAnalytics: fireAnalytics,
148
+ fireAnalyticsNext: fireEventNext
135
149
  }));
136
150
  }
137
151
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
@@ -192,4 +206,5 @@ const AgentProfileCard = ({
192
206
  onViewFullProfileClick: () => onViewFullProfile(agent.id)
193
207
  })));
194
208
  };
195
- export default AgentProfileCard;
209
+ const AgentProfileCardExport = componentWithFG('profilecard_primitives_compiled', AgentProfileCardCompiled, AgentProfileCard);
210
+ export default AgentProfileCardExport;
@@ -0,0 +1,8 @@
1
+
2
+ ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
3
+ ._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}._154i1ejb{top:var(--ds-space-300,24px)}
4
+ ._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
5
+ ._1ltvpxbi{left:var(--ds-space-200,1pc)}
6
+ ._1q51xy5q{padding-block-start:var(--ds-space-400,2pc)}
7
+ ._kqswh2mm{position:relative}
8
+ ._kqswstnw{position:absolute}