@atlaskit/profilecard 24.14.1 → 24.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/__tests__/vr-tests/agent-profilecard.vr.tsx +5 -5
- package/__tests__/vr-tests/user-profilecard.vr.tsx +30 -30
- package/dist/cjs/client/ProfileCardClient.js +10 -10
- package/dist/cjs/client/RovoAgentCardClient.js +172 -56
- package/dist/cjs/client/TeamProfileCardClient.js +44 -14
- package/dist/cjs/client/UserProfileCardClient.js +2 -9
- package/dist/cjs/client/errorUtils.js +83 -5
- package/dist/cjs/components/Agent/Actions.js +20 -9
- package/dist/cjs/components/Agent/ActionsCompiled.js +18 -8
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/cjs/components/Agent/AgentProfileCard.js +24 -14
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +23 -8
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
- package/dist/cjs/components/Team/TeamForbiddenErrorState.js +21 -6
- package/dist/cjs/components/Team/TeamLoadingState.js +21 -6
- package/dist/cjs/components/Team/TeamProfileCard.js +155 -60
- package/dist/cjs/components/Team/TeamProfileCardTrigger.js +104 -33
- package/dist/cjs/components/common/ProfileCardTrigger.js +3 -1
- package/dist/cjs/components/team-profile-card/main.js +18 -9
- package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/cjs/util/analytics.js +55 -0
- package/dist/es2019/client/ProfileCardClient.js +10 -10
- package/dist/es2019/client/RovoAgentCardClient.js +186 -58
- package/dist/es2019/client/TeamProfileCardClient.js +49 -16
- package/dist/es2019/client/UserProfileCardClient.js +3 -10
- package/dist/es2019/client/errorUtils.js +84 -3
- package/dist/es2019/components/Agent/Actions.js +21 -9
- package/dist/es2019/components/Agent/ActionsCompiled.js +19 -8
- package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/es2019/components/Agent/AgentProfileCard.js +24 -13
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +23 -9
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
- package/dist/es2019/components/Team/TeamForbiddenErrorState.js +17 -6
- package/dist/es2019/components/Team/TeamLoadingState.js +17 -6
- package/dist/es2019/components/Team/TeamProfileCard.js +144 -54
- package/dist/es2019/components/Team/TeamProfileCardTrigger.js +74 -10
- package/dist/es2019/components/common/ProfileCardTrigger.js +3 -1
- package/dist/es2019/components/team-profile-card/main.js +19 -9
- package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
- package/dist/es2019/util/analytics.js +55 -0
- package/dist/esm/client/ProfileCardClient.js +10 -10
- package/dist/esm/client/RovoAgentCardClient.js +174 -58
- package/dist/esm/client/TeamProfileCardClient.js +46 -16
- package/dist/esm/client/UserProfileCardClient.js +3 -10
- package/dist/esm/client/errorUtils.js +82 -4
- package/dist/esm/components/Agent/Actions.js +20 -9
- package/dist/esm/components/Agent/ActionsCompiled.js +18 -8
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/esm/components/Agent/AgentProfileCard.js +25 -13
- package/dist/esm/components/Agent/AgentProfileCardCompiled.js +24 -9
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
- package/dist/esm/components/Team/TeamForbiddenErrorState.js +22 -7
- package/dist/esm/components/Team/TeamLoadingState.js +22 -7
- package/dist/esm/components/Team/TeamProfileCard.js +156 -61
- package/dist/esm/components/Team/TeamProfileCardTrigger.js +105 -34
- package/dist/esm/components/common/ProfileCardTrigger.js +3 -1
- package/dist/esm/components/team-profile-card/main.js +18 -9
- package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/esm/util/analytics.js +55 -0
- package/dist/types/client/ProfileCardClient.d.ts +5 -5
- package/dist/types/client/RovoAgentCardClient.d.ts +5 -4
- package/dist/types/client/TeamProfileCardClient.d.ts +2 -1
- package/dist/types/client/errorUtils.d.ts +2 -1
- package/dist/types/client/types.d.ts +14 -2
- package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +2 -1
- package/dist/types/components/Team/TeamLoadingState.d.ts +2 -1
- package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +7 -2
- package/dist/types/types.d.ts +2 -0
- package/dist/types/util/analytics.d.ts +46 -2
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -5
- package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +5 -4
- package/dist/types-ts4.5/client/TeamProfileCardClient.d.ts +2 -1
- package/dist/types-ts4.5/client/errorUtils.d.ts +2 -1
- package/dist/types-ts4.5/client/types.d.ts +14 -2
- package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +2 -1
- package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +2 -1
- package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +7 -2
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/util/analytics.d.ts +46 -2
- package/package.json +8 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import { agentRequestAnalytics } from '../util/analytics';
|
|
2
|
+
import { agentRequestAnalytics, PACKAGE_META_DATA } from '../util/analytics';
|
|
3
3
|
import { getPageTime } from '../util/performance';
|
|
4
4
|
import CachingClient from './CachingClient';
|
|
5
|
-
import { getErrorAttributes } from './errorUtils';
|
|
5
|
+
import { DEPRECATED_getErrorAttributes, getErrorAttributes } from './errorUtils';
|
|
6
6
|
const createHeaders = (product, cloudId, isBodyJson) => {
|
|
7
7
|
const headers = new Headers({
|
|
8
8
|
'X-Product': product,
|
|
@@ -40,7 +40,7 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
40
40
|
headers
|
|
41
41
|
})).then(response => response.json());
|
|
42
42
|
}
|
|
43
|
-
getProfile(id, analytics) {
|
|
43
|
+
getProfile(id, analytics, analyticsNext) {
|
|
44
44
|
if (!id.value) {
|
|
45
45
|
return Promise.reject(new Error('Id is missing'));
|
|
46
46
|
}
|
|
@@ -53,41 +53,82 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
53
53
|
}
|
|
54
54
|
return new Promise((resolve, reject) => {
|
|
55
55
|
const startTime = getPageTime();
|
|
56
|
-
if (analytics) {
|
|
57
|
-
|
|
56
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
57
|
+
if (analyticsNext) {
|
|
58
|
+
analyticsNext('operational.rovoAgentProfilecard.triggered.request', {
|
|
59
|
+
firedAt: Math.round(getPageTime()),
|
|
60
|
+
...PACKAGE_META_DATA
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
if (analytics) {
|
|
65
|
+
analytics(agentRequestAnalytics('triggered'));
|
|
66
|
+
}
|
|
58
67
|
}
|
|
59
68
|
this.makeRequest(id, this.options.cloudId || '').then(data => {
|
|
60
69
|
if (this.cache) {
|
|
61
70
|
this.setCachedProfile(id.value, data);
|
|
62
71
|
}
|
|
63
|
-
if (analytics) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
73
|
+
if (analyticsNext) {
|
|
74
|
+
analyticsNext('operational.rovoAgentProfilecard.succeeded.request', {
|
|
75
|
+
duration: getPageTime() - startTime,
|
|
76
|
+
gateway: true,
|
|
77
|
+
firedAt: Math.round(getPageTime()),
|
|
78
|
+
...PACKAGE_META_DATA
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
if (analytics) {
|
|
83
|
+
analytics(agentRequestAnalytics('succeeded', 'request', {
|
|
84
|
+
duration: getPageTime() - startTime,
|
|
85
|
+
gateway: true
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
68
88
|
}
|
|
69
89
|
resolve(data);
|
|
70
90
|
}).catch(error => {
|
|
71
|
-
if (analytics) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
91
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
92
|
+
if (analyticsNext) {
|
|
93
|
+
analyticsNext('operational.rovoAgentProfilecard.failed.request', {
|
|
94
|
+
duration: getPageTime() - startTime,
|
|
95
|
+
...getErrorAttributes(error),
|
|
96
|
+
gateway: true,
|
|
97
|
+
firedAt: Math.round(getPageTime()),
|
|
98
|
+
...PACKAGE_META_DATA
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
if (analytics) {
|
|
103
|
+
analytics(agentRequestAnalytics('failed', 'request', {
|
|
104
|
+
duration: getPageTime() - startTime,
|
|
105
|
+
...DEPRECATED_getErrorAttributes(error),
|
|
106
|
+
gateway: true
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
77
109
|
}
|
|
78
110
|
reject(error);
|
|
79
111
|
});
|
|
80
112
|
});
|
|
81
113
|
}
|
|
82
|
-
deleteAgent(agentId, analytics) {
|
|
114
|
+
deleteAgent(agentId, analytics, analyticsNext) {
|
|
83
115
|
if (!this.options.cloudId) {
|
|
84
116
|
return Promise.reject(new Error('cloudId is missing'));
|
|
85
117
|
}
|
|
86
118
|
return new Promise((resolve, reject) => {
|
|
87
119
|
const startTime = getPageTime();
|
|
88
120
|
const product = this.options.productIdentifier || 'rovo';
|
|
89
|
-
if (analytics) {
|
|
90
|
-
|
|
121
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
122
|
+
if (analyticsNext) {
|
|
123
|
+
analyticsNext('operational.rovoAgentProfilecard.triggered.request', {
|
|
124
|
+
firedAt: Math.round(getPageTime()),
|
|
125
|
+
...PACKAGE_META_DATA
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
if (analytics) {
|
|
130
|
+
analytics(agentRequestAnalytics('triggered'));
|
|
131
|
+
}
|
|
91
132
|
}
|
|
92
133
|
const headers = createHeaders(product, this.options.cloudId);
|
|
93
134
|
fetch(new Request(`${this.basePath()}/${agentId}`, {
|
|
@@ -96,26 +137,49 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
96
137
|
mode: 'cors',
|
|
97
138
|
headers
|
|
98
139
|
})).then(() => {
|
|
99
|
-
if (analytics) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
140
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
141
|
+
if (analyticsNext) {
|
|
142
|
+
analyticsNext('operational.rovoAgentProfilecard.succeeded.deleteAgent', {
|
|
143
|
+
duration: getPageTime() - startTime,
|
|
144
|
+
gateway: true,
|
|
145
|
+
firedAt: Math.round(getPageTime()),
|
|
146
|
+
...PACKAGE_META_DATA
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
if (analytics) {
|
|
151
|
+
analytics(agentRequestAnalytics('succeeded', 'deleteAgent', {
|
|
152
|
+
duration: getPageTime() - startTime,
|
|
153
|
+
gateway: true
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
104
156
|
}
|
|
105
157
|
resolve();
|
|
106
158
|
}).catch(error => {
|
|
107
|
-
if (analytics) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
159
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
160
|
+
if (analyticsNext) {
|
|
161
|
+
analyticsNext('operational.rovoAgentProfilecard.failed.deleteAgent', {
|
|
162
|
+
duration: getPageTime() - startTime,
|
|
163
|
+
...getErrorAttributes(error),
|
|
164
|
+
gateway: true,
|
|
165
|
+
firedAt: Math.round(getPageTime()),
|
|
166
|
+
...PACKAGE_META_DATA
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
if (analytics) {
|
|
171
|
+
analytics(agentRequestAnalytics('failed', 'deleteAgent', {
|
|
172
|
+
duration: getPageTime() - startTime,
|
|
173
|
+
...DEPRECATED_getErrorAttributes(error),
|
|
174
|
+
gateway: true
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
113
177
|
}
|
|
114
178
|
reject(error);
|
|
115
179
|
});
|
|
116
180
|
});
|
|
117
181
|
}
|
|
118
|
-
setFavouriteAgent(agentId, isFavourite, analytics) {
|
|
182
|
+
setFavouriteAgent(agentId, isFavourite, analytics, analyticsNext) {
|
|
119
183
|
if (!this.options.cloudId) {
|
|
120
184
|
return Promise.reject(new Error('cloudId is missing'));
|
|
121
185
|
}
|
|
@@ -124,8 +188,17 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
124
188
|
const product = this.options.productIdentifier || 'rovo';
|
|
125
189
|
const actionSubjectId = isFavourite ? 'favourite' : 'unfavourite';
|
|
126
190
|
const requestMethod = isFavourite ? 'POST' : 'DELETE';
|
|
127
|
-
if (analytics) {
|
|
128
|
-
|
|
191
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
192
|
+
if (analyticsNext) {
|
|
193
|
+
analyticsNext(`operational.rovoAgentProfilecard.triggered.${actionSubjectId}`, {
|
|
194
|
+
firedAt: Math.round(getPageTime()),
|
|
195
|
+
...PACKAGE_META_DATA
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
if (analytics) {
|
|
200
|
+
analytics(agentRequestAnalytics('triggered', 'actionSubjectId'));
|
|
201
|
+
}
|
|
129
202
|
}
|
|
130
203
|
const headers = createHeaders(product, this.options.cloudId);
|
|
131
204
|
await fetch(new Request(`${this.basePath()}/${agentId}/favourite`, {
|
|
@@ -134,34 +207,66 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
134
207
|
mode: 'cors',
|
|
135
208
|
headers
|
|
136
209
|
})).then(() => {
|
|
137
|
-
if (analytics) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
210
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
211
|
+
if (analyticsNext) {
|
|
212
|
+
analyticsNext(`operational.rovoAgentProfilecard.succeeded.${actionSubjectId}`, {
|
|
213
|
+
duration: getPageTime() - startTime,
|
|
214
|
+
gateway: true,
|
|
215
|
+
firedAt: Math.round(getPageTime()),
|
|
216
|
+
...PACKAGE_META_DATA
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
if (analytics) {
|
|
221
|
+
analytics(agentRequestAnalytics('succeeded', actionSubjectId, {
|
|
222
|
+
duration: getPageTime() - startTime,
|
|
223
|
+
gateway: true
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
142
226
|
}
|
|
143
227
|
resolve();
|
|
144
228
|
}).catch(error => {
|
|
145
|
-
if (analytics) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
229
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
230
|
+
if (analyticsNext) {
|
|
231
|
+
analyticsNext(`operational.rovoAgentProfilecard.failed.${actionSubjectId}`, {
|
|
232
|
+
duration: getPageTime() - startTime,
|
|
233
|
+
...getErrorAttributes(error),
|
|
234
|
+
gateway: true,
|
|
235
|
+
firedAt: Math.round(getPageTime()),
|
|
236
|
+
...PACKAGE_META_DATA
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
if (analytics) {
|
|
241
|
+
analytics(agentRequestAnalytics('failed', actionSubjectId, {
|
|
242
|
+
duration: getPageTime() - startTime,
|
|
243
|
+
...DEPRECATED_getErrorAttributes(error),
|
|
244
|
+
gateway: true
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
151
247
|
}
|
|
152
248
|
reject(error);
|
|
153
249
|
});
|
|
154
250
|
});
|
|
155
251
|
}
|
|
156
|
-
getPermissions(id, fireAnalytics) {
|
|
252
|
+
getPermissions(id, fireAnalytics, fireAnalyticsNext) {
|
|
157
253
|
if (!this.options.cloudId) {
|
|
158
254
|
return Promise.reject(new Error('cloudId is missing'));
|
|
159
255
|
}
|
|
160
256
|
return new Promise((resolve, reject) => {
|
|
161
257
|
const startTime = getPageTime();
|
|
162
258
|
const product = this.options.productIdentifier || 'rovo';
|
|
163
|
-
if (
|
|
164
|
-
|
|
259
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
260
|
+
if (fireAnalyticsNext) {
|
|
261
|
+
fireAnalyticsNext('operational.rovoAgentProfilecard.triggered.request', {
|
|
262
|
+
firedAt: Math.round(getPageTime()),
|
|
263
|
+
...PACKAGE_META_DATA
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
if (fireAnalytics) {
|
|
268
|
+
fireAnalytics(agentRequestAnalytics('triggered'));
|
|
269
|
+
}
|
|
165
270
|
}
|
|
166
271
|
const headers = createHeaders(product, this.options.cloudId, true);
|
|
167
272
|
fetch(new Request(`/gateway/api/assist/api/rovo/v2/permissions/agents/${id}`, {
|
|
@@ -173,20 +278,43 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
173
278
|
permission_ids: ['AGENT_CREATE', 'AGENT_UPDATE', 'AGENT_DELETE', 'AGENT_DEACTIVATE', 'AGENT_READ']
|
|
174
279
|
})
|
|
175
280
|
})).then(response => response.json()).then(data => {
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
281
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
282
|
+
if (fireAnalyticsNext) {
|
|
283
|
+
fireAnalyticsNext('operational.rovoAgentProfilecard.succeeded.getAgentPermissions', {
|
|
284
|
+
duration: getPageTime() - startTime,
|
|
285
|
+
gateway: true,
|
|
286
|
+
firedAt: Math.round(getPageTime()),
|
|
287
|
+
...PACKAGE_META_DATA
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
if (fireAnalytics) {
|
|
292
|
+
fireAnalytics(agentRequestAnalytics('succeeded', 'getAgentPermissions', {
|
|
293
|
+
duration: getPageTime() - startTime,
|
|
294
|
+
gateway: true
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
181
297
|
}
|
|
182
298
|
resolve(data);
|
|
183
299
|
}).catch(error => {
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
300
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
301
|
+
if (fireAnalyticsNext) {
|
|
302
|
+
fireAnalyticsNext('operational.rovoAgentProfilecard.failed.getAgentPermissions', {
|
|
303
|
+
duration: getPageTime() - startTime,
|
|
304
|
+
...getErrorAttributes(error),
|
|
305
|
+
gateway: true,
|
|
306
|
+
firedAt: Math.round(getPageTime()),
|
|
307
|
+
...PACKAGE_META_DATA
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
if (fireAnalytics) {
|
|
312
|
+
fireAnalytics(agentRequestAnalytics('failed', 'getAgentPermissions', {
|
|
313
|
+
duration: getPageTime() - startTime,
|
|
314
|
+
...DEPRECATED_getErrorAttributes(error),
|
|
315
|
+
gateway: true
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
190
318
|
}
|
|
191
319
|
reject(error);
|
|
192
320
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
...
|
|
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
|
-
...
|
|
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
|
|
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(
|
|
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(
|
|
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
|
};
|
|
@@ -7,6 +7,7 @@ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
8
8
|
import { Box, Inline, xcss } from '@atlaskit/primitives';
|
|
9
9
|
import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
|
|
10
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
10
11
|
import { fireEvent } from '../../util/analytics';
|
|
11
12
|
import { AgentActions as AgentActionsCompiled } from './ActionsCompiled';
|
|
12
13
|
import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
|
|
@@ -55,6 +56,9 @@ const _AgentActions = ({
|
|
|
55
56
|
const {
|
|
56
57
|
createAnalyticsEvent
|
|
57
58
|
} = useAnalyticsEvents();
|
|
59
|
+
const {
|
|
60
|
+
fireEvent: fireEventNext
|
|
61
|
+
} = useAnalyticsEventsNext();
|
|
58
62
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
|
59
63
|
const isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
|
|
60
64
|
const loadAgentPermissions = useCallback(async () => {
|
|
@@ -74,17 +78,24 @@ const _AgentActions = ({
|
|
|
74
78
|
};
|
|
75
79
|
}, [agent.id, resourceClient]);
|
|
76
80
|
const handleDeleteAgent = useCallback(() => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
actionSubject: 'button',
|
|
80
|
-
actionSubjectId: 'deleteAgentButton',
|
|
81
|
-
attributes: {
|
|
81
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
82
|
+
fireEventNext('ui.button.clicked.deleteAgentButton', {
|
|
82
83
|
agentId: agent.id,
|
|
83
84
|
source: 'agentProfileCard'
|
|
84
|
-
}
|
|
85
|
-
}
|
|
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
|
+
}
|
|
86
97
|
setIsDeleteModalOpen(true);
|
|
87
|
-
}, [agent.id, createAnalyticsEvent]);
|
|
98
|
+
}, [agent.id, createAnalyticsEvent, fireEventNext]);
|
|
88
99
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
|
|
89
100
|
space: "space.100",
|
|
90
101
|
xcss: actionsWrapperStyles
|
|
@@ -116,7 +127,8 @@ const _AgentActions = ({
|
|
|
116
127
|
loadPermissionsOnMount: true,
|
|
117
128
|
onViewAgentFullProfileClick: onViewFullProfileClick,
|
|
118
129
|
doesAgentHaveIdentityAccountId: !!agent.identity_account_id,
|
|
119
|
-
shouldTriggerStopPropagation: true
|
|
130
|
+
shouldTriggerStopPropagation: true,
|
|
131
|
+
dropdownMenuTestId: "agent-dropdown-menu"
|
|
120
132
|
})), /*#__PURE__*/React.createElement(AgentDeleteConfirmationModal, {
|
|
121
133
|
isOpen: isDeleteModalOpen,
|
|
122
134
|
onClose: () => {
|