@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.
Files changed (87) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/__tests__/vr-tests/agent-profilecard.vr.tsx +5 -5
  3. package/__tests__/vr-tests/user-profilecard.vr.tsx +30 -30
  4. package/dist/cjs/client/ProfileCardClient.js +10 -10
  5. package/dist/cjs/client/RovoAgentCardClient.js +172 -56
  6. package/dist/cjs/client/TeamProfileCardClient.js +44 -14
  7. package/dist/cjs/client/UserProfileCardClient.js +2 -9
  8. package/dist/cjs/client/errorUtils.js +83 -5
  9. package/dist/cjs/components/Agent/Actions.js +20 -9
  10. package/dist/cjs/components/Agent/ActionsCompiled.js +18 -8
  11. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +3 -1
  12. package/dist/cjs/components/Agent/AgentProfileCard.js +24 -14
  13. package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +23 -8
  14. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
  15. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
  16. package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
  17. package/dist/cjs/components/Team/TeamForbiddenErrorState.js +21 -6
  18. package/dist/cjs/components/Team/TeamLoadingState.js +21 -6
  19. package/dist/cjs/components/Team/TeamProfileCard.js +155 -60
  20. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +104 -33
  21. package/dist/cjs/components/common/ProfileCardTrigger.js +3 -1
  22. package/dist/cjs/components/team-profile-card/main.js +18 -9
  23. package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
  24. package/dist/cjs/util/analytics.js +55 -0
  25. package/dist/es2019/client/ProfileCardClient.js +10 -10
  26. package/dist/es2019/client/RovoAgentCardClient.js +186 -58
  27. package/dist/es2019/client/TeamProfileCardClient.js +49 -16
  28. package/dist/es2019/client/UserProfileCardClient.js +3 -10
  29. package/dist/es2019/client/errorUtils.js +84 -3
  30. package/dist/es2019/components/Agent/Actions.js +21 -9
  31. package/dist/es2019/components/Agent/ActionsCompiled.js +19 -8
  32. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +3 -1
  33. package/dist/es2019/components/Agent/AgentProfileCard.js +24 -13
  34. package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +23 -9
  35. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
  36. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
  37. package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
  38. package/dist/es2019/components/Team/TeamForbiddenErrorState.js +17 -6
  39. package/dist/es2019/components/Team/TeamLoadingState.js +17 -6
  40. package/dist/es2019/components/Team/TeamProfileCard.js +144 -54
  41. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +74 -10
  42. package/dist/es2019/components/common/ProfileCardTrigger.js +3 -1
  43. package/dist/es2019/components/team-profile-card/main.js +19 -9
  44. package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
  45. package/dist/es2019/util/analytics.js +55 -0
  46. package/dist/esm/client/ProfileCardClient.js +10 -10
  47. package/dist/esm/client/RovoAgentCardClient.js +174 -58
  48. package/dist/esm/client/TeamProfileCardClient.js +46 -16
  49. package/dist/esm/client/UserProfileCardClient.js +3 -10
  50. package/dist/esm/client/errorUtils.js +82 -4
  51. package/dist/esm/components/Agent/Actions.js +20 -9
  52. package/dist/esm/components/Agent/ActionsCompiled.js +18 -8
  53. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +3 -1
  54. package/dist/esm/components/Agent/AgentProfileCard.js +25 -13
  55. package/dist/esm/components/Agent/AgentProfileCardCompiled.js +24 -9
  56. package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
  57. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
  58. package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
  59. package/dist/esm/components/Team/TeamForbiddenErrorState.js +22 -7
  60. package/dist/esm/components/Team/TeamLoadingState.js +22 -7
  61. package/dist/esm/components/Team/TeamProfileCard.js +156 -61
  62. package/dist/esm/components/Team/TeamProfileCardTrigger.js +105 -34
  63. package/dist/esm/components/common/ProfileCardTrigger.js +3 -1
  64. package/dist/esm/components/team-profile-card/main.js +18 -9
  65. package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
  66. package/dist/esm/util/analytics.js +55 -0
  67. package/dist/types/client/ProfileCardClient.d.ts +5 -5
  68. package/dist/types/client/RovoAgentCardClient.d.ts +5 -4
  69. package/dist/types/client/TeamProfileCardClient.d.ts +2 -1
  70. package/dist/types/client/errorUtils.d.ts +2 -1
  71. package/dist/types/client/types.d.ts +14 -2
  72. package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +2 -1
  73. package/dist/types/components/Team/TeamLoadingState.d.ts +2 -1
  74. package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +7 -2
  75. package/dist/types/types.d.ts +2 -0
  76. package/dist/types/util/analytics.d.ts +46 -2
  77. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -5
  78. package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +5 -4
  79. package/dist/types-ts4.5/client/TeamProfileCardClient.d.ts +2 -1
  80. package/dist/types-ts4.5/client/errorUtils.d.ts +2 -1
  81. package/dist/types-ts4.5/client/types.d.ts +14 -2
  82. package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +2 -1
  83. package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +2 -1
  84. package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +7 -2
  85. package/dist/types-ts4.5/types.d.ts +2 -0
  86. package/dist/types-ts4.5/util/analytics.d.ts +46 -2
  87. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 24.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2c8944fdcb401`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2c8944fdcb401) -
8
+ [ux] ENGHEALTH-40632 Add hasCloseButton to ModalHeader
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 24.15.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [`86f959878c6d4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/86f959878c6d4) -
19
+ Migrated team and agent profile card analytics to teams-app-internal-analytics
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 24.14.1
4
26
 
5
27
  ### Patch Changes
@@ -3,9 +3,9 @@ import { snapshot } from '@af/visual-regression';
3
3
  import { AgentProfileCardExample } from '../../examples/13-agent-profilecard';
4
4
 
5
5
  snapshot(AgentProfileCardExample, {
6
- hooks: {
7
- flags: {
8
- profilecard_primitives_compiled: true,
9
- }
10
- }
6
+ hooks: {
7
+ flags: {
8
+ profilecard_primitives_compiled: true,
9
+ },
10
+ },
11
11
  });
@@ -10,44 +10,44 @@ import {
10
10
  } from '../../examples/03-profilecard-overview';
11
11
 
12
12
  snapshot(ErrorState, {
13
- hooks: {
14
- flags: {
15
- profilecard_primitives_compiled: true,
16
- }
17
- }
13
+ hooks: {
14
+ flags: {
15
+ profilecard_primitives_compiled: true,
16
+ },
17
+ },
18
18
  });
19
19
  snapshot(ErrorStateNotFound, {
20
- hooks: {
21
- flags: {
22
- profilecard_primitives_compiled: true,
23
- }
24
- }
20
+ hooks: {
21
+ flags: {
22
+ profilecard_primitives_compiled: true,
23
+ },
24
+ },
25
25
  });
26
26
  snapshot(BestCaseProfile, {
27
- hooks: {
28
- flags: {
29
- profilecard_primitives_compiled: true,
30
- }
31
- }
27
+ hooks: {
28
+ flags: {
29
+ profilecard_primitives_compiled: true,
30
+ },
31
+ },
32
32
  });
33
33
  snapshot(WorstCaseProfile, {
34
- hooks: {
35
- flags: {
36
- profilecard_primitives_compiled: true,
37
- }
38
- }
34
+ hooks: {
35
+ flags: {
36
+ profilecard_primitives_compiled: true,
37
+ },
38
+ },
39
39
  });
40
40
  snapshot(BotCaseProfile, {
41
- hooks: {
42
- flags: {
43
- profilecard_primitives_compiled: true,
44
- }
45
- }
41
+ hooks: {
42
+ flags: {
43
+ profilecard_primitives_compiled: true,
44
+ },
45
+ },
46
46
  });
47
47
  snapshot(AlternateActions, {
48
- hooks: {
49
- flags: {
50
- profilecard_primitives_compiled: true,
51
- }
52
- }
48
+ hooks: {
49
+ flags: {
50
+ profilecard_primitives_compiled: true,
51
+ },
52
+ },
53
53
  });
@@ -49,8 +49,8 @@ var ProfileCardClient = /*#__PURE__*/function () {
49
49
  }
50
50
  }, {
51
51
  key: "getTeamProfile",
52
- value: function getTeamProfile(teamId, orgId, analytics) {
53
- return this.teamClient.getProfile(teamId, orgId, analytics);
52
+ value: function getTeamProfile(teamId, orgId, analytics, analyticsNext) {
53
+ return this.teamClient.getProfile(teamId, orgId, analytics, analyticsNext);
54
54
  }
55
55
  }, {
56
56
  key: "getReportingLines",
@@ -154,27 +154,27 @@ var ProfileCardClient = /*#__PURE__*/function () {
154
154
  }()
155
155
  }, {
156
156
  key: "getRovoAgentProfile",
157
- value: function getRovoAgentProfile(id, analytics) {
157
+ value: function getRovoAgentProfile(id, analytics, analyticsNext) {
158
158
  var _this$rovoAgentClient2;
159
- return (_this$rovoAgentClient2 = this.rovoAgentClient) === null || _this$rovoAgentClient2 === void 0 ? void 0 : _this$rovoAgentClient2.getProfile(id, analytics);
159
+ return (_this$rovoAgentClient2 = this.rovoAgentClient) === null || _this$rovoAgentClient2 === void 0 ? void 0 : _this$rovoAgentClient2.getProfile(id, analytics, analyticsNext);
160
160
  }
161
161
  }, {
162
162
  key: "getRovoAgentPermissions",
163
- value: function getRovoAgentPermissions(id, fireAnalytics) {
163
+ value: function getRovoAgentPermissions(id, fireAnalytics, analyticsNext) {
164
164
  var _this$rovoAgentClient3;
165
- return (_this$rovoAgentClient3 = this.rovoAgentClient) === null || _this$rovoAgentClient3 === void 0 ? void 0 : _this$rovoAgentClient3.getPermissions(id, fireAnalytics);
165
+ return (_this$rovoAgentClient3 = this.rovoAgentClient) === null || _this$rovoAgentClient3 === void 0 ? void 0 : _this$rovoAgentClient3.getPermissions(id, fireAnalytics, analyticsNext);
166
166
  }
167
167
  }, {
168
168
  key: "deleteAgent",
169
- value: function deleteAgent(id, analytics) {
169
+ value: function deleteAgent(id, analytics, analyticsNext) {
170
170
  var _this$rovoAgentClient4;
171
- return (_this$rovoAgentClient4 = this.rovoAgentClient) === null || _this$rovoAgentClient4 === void 0 ? void 0 : _this$rovoAgentClient4.deleteAgent(id, analytics);
171
+ return (_this$rovoAgentClient4 = this.rovoAgentClient) === null || _this$rovoAgentClient4 === void 0 ? void 0 : _this$rovoAgentClient4.deleteAgent(id, analytics, analyticsNext);
172
172
  }
173
173
  }, {
174
174
  key: "setFavouriteAgent",
175
- value: function setFavouriteAgent(id, isFavourite, analytics) {
175
+ value: function setFavouriteAgent(id, isFavourite, analytics, analyticsNext) {
176
176
  var _this$rovoAgentClient5;
177
- return (_this$rovoAgentClient5 = this.rovoAgentClient) === null || _this$rovoAgentClient5 === void 0 ? void 0 : _this$rovoAgentClient5.setFavouriteAgent(id, isFavourite, analytics);
177
+ return (_this$rovoAgentClient5 = this.rovoAgentClient) === null || _this$rovoAgentClient5 === void 0 ? void 0 : _this$rovoAgentClient5.setFavouriteAgent(id, isFavourite, analytics, analyticsNext);
178
178
  }
179
179
  }]);
180
180
  }();
@@ -73,7 +73,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
73
73
  }
74
74
  }, {
75
75
  key: "getProfile",
76
- value: function getProfile(id, analytics) {
76
+ value: function getProfile(id, analytics, analyticsNext) {
77
77
  var _this2 = this;
78
78
  if (!id.value) {
79
79
  return Promise.reject(new Error('Id is missing'));
@@ -87,27 +87,56 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
87
87
  }
88
88
  return new Promise(function (resolve, reject) {
89
89
  var startTime = (0, _performance.getPageTime)();
90
- if (analytics) {
91
- analytics((0, _analytics.agentRequestAnalytics)('triggered'));
90
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
91
+ if (analyticsNext) {
92
+ analyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
93
+ firedAt: Math.round((0, _performance.getPageTime)())
94
+ }, _analytics.PACKAGE_META_DATA));
95
+ }
96
+ } else {
97
+ if (analytics) {
98
+ analytics((0, _analytics.agentRequestAnalytics)('triggered'));
99
+ }
92
100
  }
93
101
  _this2.makeRequest(id, _this2.options.cloudId || '').then(function (data) {
94
102
  if (_this2.cache) {
95
103
  _this2.setCachedProfile(id.value, data);
96
104
  }
97
- if (analytics) {
98
- analytics((0, _analytics.agentRequestAnalytics)('succeeded', 'request', {
99
- duration: (0, _performance.getPageTime)() - startTime,
100
- gateway: true
101
- }));
105
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
106
+ if (analyticsNext) {
107
+ analyticsNext('operational.rovoAgentProfilecard.succeeded.request', _objectSpread({
108
+ duration: (0, _performance.getPageTime)() - startTime,
109
+ gateway: true,
110
+ firedAt: Math.round((0, _performance.getPageTime)())
111
+ }, _analytics.PACKAGE_META_DATA));
112
+ }
113
+ } else {
114
+ if (analytics) {
115
+ analytics((0, _analytics.agentRequestAnalytics)('succeeded', 'request', {
116
+ duration: (0, _performance.getPageTime)() - startTime,
117
+ gateway: true
118
+ }));
119
+ }
102
120
  }
103
121
  resolve(data);
104
122
  }).catch(function (error) {
105
- if (analytics) {
106
- analytics((0, _analytics.agentRequestAnalytics)('failed', 'request', _objectSpread(_objectSpread({
107
- duration: (0, _performance.getPageTime)() - startTime
108
- }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
109
- gateway: true
110
- })));
123
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
124
+ if (analyticsNext) {
125
+ analyticsNext('operational.rovoAgentProfilecard.failed.request', _objectSpread(_objectSpread({
126
+ duration: (0, _performance.getPageTime)() - startTime
127
+ }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
128
+ gateway: true,
129
+ firedAt: Math.round((0, _performance.getPageTime)())
130
+ }, _analytics.PACKAGE_META_DATA));
131
+ }
132
+ } else {
133
+ if (analytics) {
134
+ analytics((0, _analytics.agentRequestAnalytics)('failed', 'request', _objectSpread(_objectSpread({
135
+ duration: (0, _performance.getPageTime)() - startTime
136
+ }, (0, _errorUtils.DEPRECATED_getErrorAttributes)(error)), {}, {
137
+ gateway: true
138
+ })));
139
+ }
111
140
  }
112
141
  reject(error);
113
142
  });
@@ -115,7 +144,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
115
144
  }
116
145
  }, {
117
146
  key: "deleteAgent",
118
- value: function deleteAgent(agentId, analytics) {
147
+ value: function deleteAgent(agentId, analytics, analyticsNext) {
119
148
  var _this3 = this;
120
149
  if (!this.options.cloudId) {
121
150
  return Promise.reject(new Error('cloudId is missing'));
@@ -123,8 +152,16 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
123
152
  return new Promise(function (resolve, reject) {
124
153
  var startTime = (0, _performance.getPageTime)();
125
154
  var product = _this3.options.productIdentifier || 'rovo';
126
- if (analytics) {
127
- analytics((0, _analytics.agentRequestAnalytics)('triggered'));
155
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
156
+ if (analyticsNext) {
157
+ analyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
158
+ firedAt: Math.round((0, _performance.getPageTime)())
159
+ }, _analytics.PACKAGE_META_DATA));
160
+ }
161
+ } else {
162
+ if (analytics) {
163
+ analytics((0, _analytics.agentRequestAnalytics)('triggered'));
164
+ }
128
165
  }
129
166
  var headers = createHeaders(product, _this3.options.cloudId);
130
167
  fetch(new Request("".concat(_this3.basePath(), "/").concat(agentId), {
@@ -133,20 +170,41 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
133
170
  mode: 'cors',
134
171
  headers: headers
135
172
  })).then(function () {
136
- if (analytics) {
137
- analytics((0, _analytics.agentRequestAnalytics)('succeeded', 'deleteAgent', {
138
- duration: (0, _performance.getPageTime)() - startTime,
139
- gateway: true
140
- }));
173
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
174
+ if (analyticsNext) {
175
+ analyticsNext('operational.rovoAgentProfilecard.succeeded.deleteAgent', _objectSpread({
176
+ duration: (0, _performance.getPageTime)() - startTime,
177
+ gateway: true,
178
+ firedAt: Math.round((0, _performance.getPageTime)())
179
+ }, _analytics.PACKAGE_META_DATA));
180
+ }
181
+ } else {
182
+ if (analytics) {
183
+ analytics((0, _analytics.agentRequestAnalytics)('succeeded', 'deleteAgent', {
184
+ duration: (0, _performance.getPageTime)() - startTime,
185
+ gateway: true
186
+ }));
187
+ }
141
188
  }
142
189
  resolve();
143
190
  }).catch(function (error) {
144
- if (analytics) {
145
- analytics((0, _analytics.agentRequestAnalytics)('failed', 'deleteAgent', _objectSpread(_objectSpread({
146
- duration: (0, _performance.getPageTime)() - startTime
147
- }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
148
- gateway: true
149
- })));
191
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
192
+ if (analyticsNext) {
193
+ analyticsNext('operational.rovoAgentProfilecard.failed.deleteAgent', _objectSpread(_objectSpread({
194
+ duration: (0, _performance.getPageTime)() - startTime
195
+ }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
196
+ gateway: true,
197
+ firedAt: Math.round((0, _performance.getPageTime)())
198
+ }, _analytics.PACKAGE_META_DATA));
199
+ }
200
+ } else {
201
+ if (analytics) {
202
+ analytics((0, _analytics.agentRequestAnalytics)('failed', 'deleteAgent', _objectSpread(_objectSpread({
203
+ duration: (0, _performance.getPageTime)() - startTime
204
+ }, (0, _errorUtils.DEPRECATED_getErrorAttributes)(error)), {}, {
205
+ gateway: true
206
+ })));
207
+ }
150
208
  }
151
209
  reject(error);
152
210
  });
@@ -154,7 +212,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
154
212
  }
155
213
  }, {
156
214
  key: "setFavouriteAgent",
157
- value: function setFavouriteAgent(agentId, isFavourite, analytics) {
215
+ value: function setFavouriteAgent(agentId, isFavourite, analytics, analyticsNext) {
158
216
  var _this4 = this;
159
217
  if (!this.options.cloudId) {
160
218
  return Promise.reject(new Error('cloudId is missing'));
@@ -169,8 +227,16 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
169
227
  product = _this4.options.productIdentifier || 'rovo';
170
228
  actionSubjectId = isFavourite ? 'favourite' : 'unfavourite';
171
229
  requestMethod = isFavourite ? 'POST' : 'DELETE';
172
- if (analytics) {
173
- analytics((0, _analytics.agentRequestAnalytics)('triggered', 'actionSubjectId'));
230
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
231
+ if (analyticsNext) {
232
+ analyticsNext("operational.rovoAgentProfilecard.triggered.".concat(actionSubjectId), _objectSpread({
233
+ firedAt: Math.round((0, _performance.getPageTime)())
234
+ }, _analytics.PACKAGE_META_DATA));
235
+ }
236
+ } else {
237
+ if (analytics) {
238
+ analytics((0, _analytics.agentRequestAnalytics)('triggered', 'actionSubjectId'));
239
+ }
174
240
  }
175
241
  headers = createHeaders(product, _this4.options.cloudId);
176
242
  _context.next = 8;
@@ -180,20 +246,41 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
180
246
  mode: 'cors',
181
247
  headers: headers
182
248
  })).then(function () {
183
- if (analytics) {
184
- analytics((0, _analytics.agentRequestAnalytics)('succeeded', actionSubjectId, {
185
- duration: (0, _performance.getPageTime)() - startTime,
186
- gateway: true
187
- }));
249
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
250
+ if (analyticsNext) {
251
+ analyticsNext("operational.rovoAgentProfilecard.succeeded.".concat(actionSubjectId), _objectSpread({
252
+ duration: (0, _performance.getPageTime)() - startTime,
253
+ gateway: true,
254
+ firedAt: Math.round((0, _performance.getPageTime)())
255
+ }, _analytics.PACKAGE_META_DATA));
256
+ }
257
+ } else {
258
+ if (analytics) {
259
+ analytics((0, _analytics.agentRequestAnalytics)('succeeded', actionSubjectId, {
260
+ duration: (0, _performance.getPageTime)() - startTime,
261
+ gateway: true
262
+ }));
263
+ }
188
264
  }
189
265
  resolve();
190
266
  }).catch(function (error) {
191
- if (analytics) {
192
- analytics((0, _analytics.agentRequestAnalytics)('failed', actionSubjectId, _objectSpread(_objectSpread({
193
- duration: (0, _performance.getPageTime)() - startTime
194
- }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
195
- gateway: true
196
- })));
267
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
268
+ if (analyticsNext) {
269
+ analyticsNext("operational.rovoAgentProfilecard.failed.".concat(actionSubjectId), _objectSpread(_objectSpread({
270
+ duration: (0, _performance.getPageTime)() - startTime
271
+ }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
272
+ gateway: true,
273
+ firedAt: Math.round((0, _performance.getPageTime)())
274
+ }, _analytics.PACKAGE_META_DATA));
275
+ }
276
+ } else {
277
+ if (analytics) {
278
+ analytics((0, _analytics.agentRequestAnalytics)('failed', actionSubjectId, _objectSpread(_objectSpread({
279
+ duration: (0, _performance.getPageTime)() - startTime
280
+ }, (0, _errorUtils.DEPRECATED_getErrorAttributes)(error)), {}, {
281
+ gateway: true
282
+ })));
283
+ }
197
284
  }
198
285
  reject(error);
199
286
  });
@@ -210,7 +297,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
210
297
  }
211
298
  }, {
212
299
  key: "getPermissions",
213
- value: function getPermissions(id, fireAnalytics) {
300
+ value: function getPermissions(id, fireAnalytics, fireAnalyticsNext) {
214
301
  var _this5 = this;
215
302
  if (!this.options.cloudId) {
216
303
  return Promise.reject(new Error('cloudId is missing'));
@@ -218,8 +305,16 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
218
305
  return new Promise(function (resolve, reject) {
219
306
  var startTime = (0, _performance.getPageTime)();
220
307
  var product = _this5.options.productIdentifier || 'rovo';
221
- if (fireAnalytics) {
222
- fireAnalytics((0, _analytics.agentRequestAnalytics)('triggered'));
308
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
309
+ if (fireAnalyticsNext) {
310
+ fireAnalyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
311
+ firedAt: Math.round((0, _performance.getPageTime)())
312
+ }, _analytics.PACKAGE_META_DATA));
313
+ }
314
+ } else {
315
+ if (fireAnalytics) {
316
+ fireAnalytics((0, _analytics.agentRequestAnalytics)('triggered'));
317
+ }
223
318
  }
224
319
  var headers = createHeaders(product, _this5.options.cloudId, true);
225
320
  fetch(new Request("/gateway/api/assist/api/rovo/v2/permissions/agents/".concat(id), {
@@ -233,20 +328,41 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
233
328
  })).then(function (response) {
234
329
  return response.json();
235
330
  }).then(function (data) {
236
- if (fireAnalytics) {
237
- fireAnalytics((0, _analytics.agentRequestAnalytics)('succeeded', 'getAgentPermissions', {
238
- duration: (0, _performance.getPageTime)() - startTime,
239
- gateway: true
240
- }));
331
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
332
+ if (fireAnalyticsNext) {
333
+ fireAnalyticsNext('operational.rovoAgentProfilecard.succeeded.getAgentPermissions', _objectSpread({
334
+ duration: (0, _performance.getPageTime)() - startTime,
335
+ gateway: true,
336
+ firedAt: Math.round((0, _performance.getPageTime)())
337
+ }, _analytics.PACKAGE_META_DATA));
338
+ }
339
+ } else {
340
+ if (fireAnalytics) {
341
+ fireAnalytics((0, _analytics.agentRequestAnalytics)('succeeded', 'getAgentPermissions', {
342
+ duration: (0, _performance.getPageTime)() - startTime,
343
+ gateway: true
344
+ }));
345
+ }
241
346
  }
242
347
  resolve(data);
243
348
  }).catch(function (error) {
244
- if (fireAnalytics) {
245
- fireAnalytics((0, _analytics.agentRequestAnalytics)('failed', 'getAgentPermissions', _objectSpread(_objectSpread({
246
- duration: (0, _performance.getPageTime)() - startTime
247
- }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
248
- gateway: true
249
- })));
349
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
350
+ if (fireAnalyticsNext) {
351
+ fireAnalyticsNext('operational.rovoAgentProfilecard.failed.getAgentPermissions', _objectSpread(_objectSpread({
352
+ duration: (0, _performance.getPageTime)() - startTime
353
+ }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
354
+ gateway: true,
355
+ firedAt: Math.round((0, _performance.getPageTime)())
356
+ }, _analytics.PACKAGE_META_DATA));
357
+ }
358
+ } else {
359
+ if (fireAnalytics) {
360
+ fireAnalytics((0, _analytics.agentRequestAnalytics)('failed', 'getAgentPermissions', _objectSpread(_objectSpread({
361
+ duration: (0, _performance.getPageTime)() - startTime
362
+ }, (0, _errorUtils.DEPRECATED_getErrorAttributes)(error)), {}, {
363
+ gateway: true
364
+ })));
365
+ }
250
366
  }
251
367
  reject(error);
252
368
  });
@@ -11,6 +11,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
11
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _analytics = require("../util/analytics");
15
16
  var _performance = require("../util/performance");
16
17
  var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
@@ -39,7 +40,7 @@ var TeamProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
39
40
  }
40
41
  }, {
41
42
  key: "getProfile",
42
- value: function getProfile(teamId, orgId, analytics) {
43
+ value: function getProfile(teamId, orgId, analytics, analyticsNext) {
43
44
  var _this2 = this;
44
45
  if (!teamId) {
45
46
  return Promise.reject(new Error('teamId is missing'));
@@ -50,27 +51,56 @@ var TeamProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
50
51
  }
51
52
  return new Promise(function (resolve, reject) {
52
53
  var startTime = (0, _performance.getPageTime)();
53
- if (analytics) {
54
- analytics((0, _analytics.teamRequestAnalytics)('triggered'));
54
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
55
+ if (analyticsNext) {
56
+ analyticsNext('operational.teamProfileCard.triggered.request', _objectSpread({
57
+ firedAt: Math.round((0, _performance.getPageTime)())
58
+ }, _analytics.PACKAGE_META_DATA));
59
+ }
60
+ } else {
61
+ if (analytics) {
62
+ analytics((0, _analytics.teamRequestAnalytics)('triggered'));
63
+ }
55
64
  }
56
65
  _this2.makeRequest(teamId, orgId).then(function (data) {
57
66
  if (_this2.cache) {
58
67
  _this2.setCachedProfile(teamId, data);
59
68
  }
60
- if (analytics) {
61
- analytics((0, _analytics.teamRequestAnalytics)('succeeded', {
62
- duration: (0, _performance.getPageTime)() - startTime,
63
- gateway: true
64
- }));
69
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
70
+ if (analyticsNext) {
71
+ analyticsNext('operational.teamProfileCard.succeeded.request', _objectSpread({
72
+ duration: (0, _performance.getPageTime)() - startTime,
73
+ gateway: true,
74
+ firedAt: Math.round((0, _performance.getPageTime)())
75
+ }, _analytics.PACKAGE_META_DATA));
76
+ }
77
+ } else {
78
+ if (analytics) {
79
+ analytics((0, _analytics.teamRequestAnalytics)('succeeded', {
80
+ duration: (0, _performance.getPageTime)() - startTime,
81
+ gateway: true
82
+ }));
83
+ }
65
84
  }
66
85
  resolve(data);
67
86
  }).catch(function (error) {
68
- if (analytics) {
69
- analytics((0, _analytics.teamRequestAnalytics)('failed', _objectSpread(_objectSpread({
70
- duration: (0, _performance.getPageTime)() - startTime
71
- }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
72
- gateway: true
73
- })));
87
+ if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
88
+ if (analyticsNext) {
89
+ analyticsNext('operational.teamProfileCard.failed.request', _objectSpread(_objectSpread({
90
+ duration: (0, _performance.getPageTime)() - startTime
91
+ }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
92
+ gateway: true,
93
+ firedAt: Math.round((0, _performance.getPageTime)())
94
+ }, _analytics.PACKAGE_META_DATA));
95
+ }
96
+ } else {
97
+ if (analytics) {
98
+ analytics((0, _analytics.teamRequestAnalytics)('failed', _objectSpread(_objectSpread({
99
+ duration: (0, _performance.getPageTime)() - startTime
100
+ }, (0, _errorUtils.DEPRECATED_getErrorAttributes)(error)), {}, {
101
+ gateway: true
102
+ })));
103
+ }
74
104
  }
75
105
  reject(error);
76
106
  });
@@ -198,16 +198,9 @@ var UserProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
198
198
  }).catch(function (error) {
199
199
  if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
200
200
  if (analyticsNext) {
201
- var errorAttributes = (0, _errorUtils.getErrorAttributes)(error);
202
201
  analyticsNext('operational.profilecard.failed.request', _objectSpread(_objectSpread({
203
202
  duration: (0, _performance.getPageTime)() - startTime
204
- }, errorAttributes), {}, {
205
- traceId: errorAttributes.traceId || null,
206
- errorCategory: errorAttributes.errorCategory || null,
207
- errorType: errorAttributes.errorType || null,
208
- errorPath: errorAttributes.errorPath || null,
209
- errorNumber: errorAttributes.errorNumber || null,
210
- errorStatusCode: errorAttributes.errorStatusCode || null,
203
+ }, (0, _errorUtils.getErrorAttributes)(error)), {}, {
211
204
  firedAt: Math.round((0, _performance.getPageTime)())
212
205
  }, _analytics.PACKAGE_META_DATA));
213
206
  }
@@ -215,7 +208,7 @@ var UserProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
215
208
  if (analytics) {
216
209
  analytics((0, _analytics.userRequestAnalytics)('failed', _objectSpread({
217
210
  duration: (0, _performance.getPageTime)() - startTime
218
- }, (0, _errorUtils.getErrorAttributes)(error))));
211
+ }, (0, _errorUtils.DEPRECATED_getErrorAttributes)(error))));
219
212
  }
220
213
  }
221
214
  reject(error);