@atlaskit/profilecard 24.14.1 → 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 (81) hide show
  1. package/CHANGELOG.md +11 -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/AgentProfileCard.js +24 -14
  12. package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +23 -8
  13. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
  14. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
  15. package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
  16. package/dist/cjs/components/Team/TeamForbiddenErrorState.js +21 -6
  17. package/dist/cjs/components/Team/TeamLoadingState.js +21 -6
  18. package/dist/cjs/components/Team/TeamProfileCard.js +155 -60
  19. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +104 -33
  20. package/dist/cjs/components/team-profile-card/main.js +18 -9
  21. package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
  22. package/dist/cjs/util/analytics.js +55 -0
  23. package/dist/es2019/client/ProfileCardClient.js +10 -10
  24. package/dist/es2019/client/RovoAgentCardClient.js +186 -58
  25. package/dist/es2019/client/TeamProfileCardClient.js +49 -16
  26. package/dist/es2019/client/UserProfileCardClient.js +3 -10
  27. package/dist/es2019/client/errorUtils.js +84 -3
  28. package/dist/es2019/components/Agent/Actions.js +21 -9
  29. package/dist/es2019/components/Agent/ActionsCompiled.js +19 -8
  30. package/dist/es2019/components/Agent/AgentProfileCard.js +24 -13
  31. package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +23 -9
  32. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
  33. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
  34. package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
  35. package/dist/es2019/components/Team/TeamForbiddenErrorState.js +17 -6
  36. package/dist/es2019/components/Team/TeamLoadingState.js +17 -6
  37. package/dist/es2019/components/Team/TeamProfileCard.js +144 -54
  38. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +74 -10
  39. package/dist/es2019/components/team-profile-card/main.js +19 -9
  40. package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
  41. package/dist/es2019/util/analytics.js +55 -0
  42. package/dist/esm/client/ProfileCardClient.js +10 -10
  43. package/dist/esm/client/RovoAgentCardClient.js +174 -58
  44. package/dist/esm/client/TeamProfileCardClient.js +46 -16
  45. package/dist/esm/client/UserProfileCardClient.js +3 -10
  46. package/dist/esm/client/errorUtils.js +82 -4
  47. package/dist/esm/components/Agent/Actions.js +20 -9
  48. package/dist/esm/components/Agent/ActionsCompiled.js +18 -8
  49. package/dist/esm/components/Agent/AgentProfileCard.js +25 -13
  50. package/dist/esm/components/Agent/AgentProfileCardCompiled.js +24 -9
  51. package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
  52. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
  53. package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
  54. package/dist/esm/components/Team/TeamForbiddenErrorState.js +22 -7
  55. package/dist/esm/components/Team/TeamLoadingState.js +22 -7
  56. package/dist/esm/components/Team/TeamProfileCard.js +156 -61
  57. package/dist/esm/components/Team/TeamProfileCardTrigger.js +105 -34
  58. package/dist/esm/components/team-profile-card/main.js +18 -9
  59. package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
  60. package/dist/esm/util/analytics.js +55 -0
  61. package/dist/types/client/ProfileCardClient.d.ts +5 -5
  62. package/dist/types/client/RovoAgentCardClient.d.ts +5 -4
  63. package/dist/types/client/TeamProfileCardClient.d.ts +2 -1
  64. package/dist/types/client/errorUtils.d.ts +2 -1
  65. package/dist/types/client/types.d.ts +14 -2
  66. package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +2 -1
  67. package/dist/types/components/Team/TeamLoadingState.d.ts +2 -1
  68. package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +7 -2
  69. package/dist/types/types.d.ts +2 -0
  70. package/dist/types/util/analytics.d.ts +46 -2
  71. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -5
  72. package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +5 -4
  73. package/dist/types-ts4.5/client/TeamProfileCardClient.d.ts +2 -1
  74. package/dist/types-ts4.5/client/errorUtils.d.ts +2 -1
  75. package/dist/types-ts4.5/client/types.d.ts +14 -2
  76. package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +2 -1
  77. package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +2 -1
  78. package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +7 -2
  79. package/dist/types-ts4.5/types.d.ts +2 -0
  80. package/dist/types-ts4.5/util/analytics.d.ts +46 -2
  81. package/package.json +6 -6
@@ -6,6 +6,8 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _inherits from "@babel/runtime/helpers/inherits";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
11
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
12
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
13
  import React, { Suspense } from 'react';
@@ -13,12 +15,14 @@ import { FormattedMessage, injectIntl } from 'react-intl-next';
13
15
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
14
16
  import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
15
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
16
19
  import Popup from '@atlaskit/popup';
17
20
  import { Box } from '@atlaskit/primitives/compiled';
21
+ import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
18
22
  import { layers } from '@atlaskit/theme/constants';
19
23
  import _filterActions from '../../internal/filterActions';
20
24
  import messages from '../../messages';
21
- import { cardTriggered, fireEvent, profileCardRendered } from '../../util/analytics';
25
+ import { cardTriggered, fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
22
26
  import { isBasicClick } from '../../util/click';
23
27
  import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
24
28
  import { getPageTime } from '../../util/performance';
@@ -47,10 +51,28 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
47
51
  fireEvent(_this.props.createAnalyticsEvent, payload);
48
52
  }
49
53
  });
54
+ _defineProperty(_this, "fireAnalyticsNext", function (eventKey) {
55
+ // Don't fire any analytics if the component is unmounted
56
+ if (!_this._isMounted) {
57
+ return;
58
+ }
59
+ if (_this.props.fireEvent) {
60
+ var _this$props;
61
+ for (var _len2 = arguments.length, attributes = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
62
+ attributes[_key2 - 1] = arguments[_key2];
63
+ }
64
+ (_this$props = _this.props).fireEvent.apply(_this$props, [eventKey].concat(attributes));
65
+ }
66
+ });
50
67
  _defineProperty(_this, "fireAnalyticsWithDuration", function (generator) {
51
68
  var event = generator(getPageTime() - _this.openTime);
52
69
  _this.fireAnalytics(event);
53
70
  });
71
+ _defineProperty(_this, "fireAnalyticsWithDurationNext", function (eventKey, generator) {
72
+ var duration = getPageTime() - _this.openTime;
73
+ var attributes = generator(duration);
74
+ _this.fireAnalyticsNext(eventKey, attributes);
75
+ });
54
76
  _defineProperty(_this, "hideProfilecard", function () {
55
77
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
56
78
  clearTimeout(_this.showTimer);
@@ -92,7 +114,16 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
92
114
  _this.openedByHover = false;
93
115
  _this.showProfilecard(0);
94
116
  if (!_this.state.visible) {
95
- _this.fireAnalytics(cardTriggered('team', 'click', _this.props.teamId));
117
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
118
+ _this.fireAnalyticsNext('ui.teamProfileCard.triggered', _objectSpread(_objectSpread({
119
+ method: 'click'
120
+ }, PACKAGE_META_DATA), {}, {
121
+ firedAt: Math.round(getPageTime()),
122
+ teamId: _this.props.teamId
123
+ }));
124
+ } else {
125
+ _this.fireAnalytics(cardTriggered('team', 'click', _this.props.teamId));
126
+ }
96
127
  }
97
128
  }
98
129
  });
@@ -102,7 +133,16 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
102
133
  }
103
134
  if (!_this.state.visible) {
104
135
  _this.openedByHover = true;
105
- _this.fireAnalytics(cardTriggered('team', 'hover', _this.props.teamId));
136
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
137
+ _this.fireAnalyticsNext('ui.teamProfileCard.triggered', _objectSpread(_objectSpread({
138
+ method: 'hover'
139
+ }, PACKAGE_META_DATA), {}, {
140
+ firedAt: Math.round(getPageTime()),
141
+ teamId: _this.props.teamId
142
+ }));
143
+ } else {
144
+ _this.fireAnalytics(cardTriggered('team', 'hover', _this.props.teamId));
145
+ }
106
146
  }
107
147
  _this.showProfilecard(DELAY_MS_SHOW);
108
148
  });
@@ -122,7 +162,15 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
122
162
  });
123
163
  _this.showProfilecard(0);
124
164
  if (!_this.state.visible) {
125
- _this.fireAnalytics(cardTriggered('team', 'click', _this.props.teamId));
165
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
166
+ _this.fireAnalyticsNext('ui.teamProfileCard.triggered', _objectSpread({
167
+ method: 'click',
168
+ firedAt: Math.round(getPageTime()),
169
+ teamId: _this.props.teamId
170
+ }, PACKAGE_META_DATA));
171
+ } else {
172
+ _this.fireAnalytics(cardTriggered('team', 'click', _this.props.teamId));
173
+ }
126
174
  }
127
175
  }
128
176
  });
@@ -175,9 +223,9 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
175
223
  isTriggeredByKeyboard: false
176
224
  });
177
225
  _defineProperty(_this, "clientFetchProfile", function () {
178
- var _this$props = _this.props,
179
- orgId = _this$props.orgId,
180
- teamId = _this$props.teamId;
226
+ var _this$props2 = _this.props,
227
+ orgId = _this$props2.orgId,
228
+ teamId = _this$props2.teamId;
181
229
  var isLoading = _this.state.isLoading;
182
230
  if (isLoading === true) {
183
231
  // don't fetch data when fetching is in process
@@ -190,13 +238,20 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
190
238
  var fireEvent = function fireEvent(event) {
191
239
  _this.fireAnalytics(event);
192
240
  };
193
- var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl({
241
+ var fireAnalyticsNext = function fireAnalyticsNext(eventKey) {
242
+ var _this2;
243
+ for (var _len3 = arguments.length, attributes = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
244
+ attributes[_key3 - 1] = arguments[_key3];
245
+ }
246
+ (_this2 = _this).fireAnalyticsNext.apply(_this2, [eventKey].concat(attributes));
247
+ };
248
+ var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent, fireAnalyticsNext), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl({
194
249
  withOrgContext: true,
195
250
  withSiteContext: true
196
251
  })]);
197
252
  requests.then(function (res) {
198
- var _this2;
199
- return (_this2 = _this).handleClientSuccess.apply(_this2, _toConsumableArray(res));
253
+ var _this3;
254
+ return (_this3 = _this).handleClientSuccess.apply(_this3, _toConsumableArray(res));
200
255
  }, function (err) {
201
256
  return _this.handleClientError(err);
202
257
  }).catch(function (err) {
@@ -205,20 +260,27 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
205
260
  });
206
261
  });
207
262
  _defineProperty(_this, "onErrorBoundary", function () {
208
- _this.fireAnalytics(profileCardRendered('team', 'errorBoundary', {
209
- duration: 0
210
- }));
263
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
264
+ _this.fireAnalyticsNext('ui.teamProfileCard.rendered.errorBoundary', _objectSpread(_objectSpread({}, PACKAGE_META_DATA), {}, {
265
+ firedAt: Math.round(getPageTime()),
266
+ duration: 0
267
+ }));
268
+ } else {
269
+ _this.fireAnalytics(profileCardRendered('team', 'errorBoundary', {
270
+ duration: 0
271
+ }));
272
+ }
211
273
  _this.setState({
212
274
  renderError: true
213
275
  });
214
276
  });
215
277
  _defineProperty(_this, "renderProfileCard", function () {
216
- var _this$props2 = _this.props,
217
- generateUserLink = _this$props2.generateUserLink,
218
- onUserClick = _this$props2.onUserClick,
219
- viewingUserId = _this$props2.viewingUserId,
220
- viewProfileLink = _this$props2.viewProfileLink,
221
- viewProfileOnClick = _this$props2.viewProfileOnClick;
278
+ var _this$props3 = _this.props,
279
+ generateUserLink = _this$props3.generateUserLink,
280
+ onUserClick = _this$props3.onUserClick,
281
+ viewingUserId = _this$props3.viewingUserId,
282
+ viewProfileLink = _this$props3.viewProfileLink,
283
+ viewProfileOnClick = _this$props3.viewProfileOnClick;
222
284
  var _this$state = _this.state,
223
285
  data = _this$state.data,
224
286
  error = _this$state.error,
@@ -228,6 +290,7 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
228
290
  clientFetchProfile: _this.clientFetchProfile,
229
291
  actions: _this.filterActions(),
230
292
  analytics: _this.fireAnalyticsWithDuration,
293
+ analyticsNext: _this.fireAnalyticsWithDurationNext,
231
294
  team: data || undefined,
232
295
  generateUserLink: generateUserLink,
233
296
  onUserClick: onUserClick,
@@ -237,7 +300,8 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
237
300
  };
238
301
  return /*#__PURE__*/React.createElement("div", _this.cardListeners, _this.state.visible && /*#__PURE__*/React.createElement(Suspense, {
239
302
  fallback: /*#__PURE__*/React.createElement(TeamLoadingState, {
240
- analytics: _this.fireAnalyticsWithDuration
303
+ analytics: _this.fireAnalyticsWithDuration,
304
+ analyticsNext: _this.fireAnalyticsWithDurationNext
241
305
  })
242
306
  }, /*#__PURE__*/React.createElement(TeamProfileCardLazy, _extends({}, newProps, {
243
307
  isLoading: isLoading,
@@ -263,11 +327,11 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
263
327
  }));
264
328
  });
265
329
  _defineProperty(_this, "renderTrigger", function (triggerProps) {
266
- var _this$props3 = _this.props,
267
- children = _this$props3.children,
268
- intl = _this$props3.intl,
269
- triggerLinkType = _this$props3.triggerLinkType,
270
- viewProfileLink = _this$props3.viewProfileLink;
330
+ var _this$props4 = _this.props,
331
+ children = _this$props4.children,
332
+ intl = _this$props4.intl,
333
+ triggerLinkType = _this$props4.triggerLinkType,
334
+ viewProfileLink = _this$props4.viewProfileLink;
271
335
  if (triggerLinkType === 'none') {
272
336
  return /*#__PURE__*/React.createElement(React.Fragment, null, _this.renderKudosLauncher(), /*#__PURE__*/React.createElement(Box, _extends({
273
337
  as: "span",
@@ -302,10 +366,10 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
302
366
  }, {
303
367
  key: "componentDidUpdate",
304
368
  value: function componentDidUpdate(prevProps) {
305
- var _this$props4 = this.props,
306
- orgId = _this$props4.orgId,
307
- teamId = _this$props4.teamId,
308
- resourceClient = _this$props4.resourceClient;
369
+ var _this$props5 = this.props,
370
+ orgId = _this$props5.orgId,
371
+ teamId = _this$props5.teamId,
372
+ resourceClient = _this$props5.resourceClient;
309
373
  var visible = this.state.visible;
310
374
 
311
375
  // just re-fetching data when the card opens
@@ -351,14 +415,14 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
351
415
  }, {
352
416
  key: "filterActions",
353
417
  value: function filterActions() {
354
- var _this3 = this;
418
+ var _this4 = this;
355
419
  var actions = _filterActions(this.props.actions, this.state.data);
356
420
  if (this.state.shouldShowGiveKudos) {
357
421
  var kudosAction = {
358
422
  label: /*#__PURE__*/React.createElement(FormattedMessage, messages.giveKudosButton),
359
423
  id: 'give-kudos',
360
424
  callback: function callback() {
361
- _this3.openKudosDrawer();
425
+ _this4.openKudosDrawer();
362
426
  },
363
427
  link: this.kudosUrl()
364
428
  };
@@ -369,7 +433,7 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
369
433
  }, {
370
434
  key: "renderPopup",
371
435
  value: function renderPopup() {
372
- var _this4 = this;
436
+ var _this5 = this;
373
437
  if (this.state.renderError) {
374
438
  return this.props.children;
375
439
  }
@@ -381,7 +445,7 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
381
445
  placement: this.props.position,
382
446
  content: this.renderProfileCard,
383
447
  trigger: function trigger(triggerProps) {
384
- return _this4.renderTrigger(triggerProps);
448
+ return _this5.renderTrigger(triggerProps);
385
449
  },
386
450
  zIndex: layers.modal(),
387
451
  shouldFlip: true,
@@ -407,4 +471,11 @@ _defineProperty(TeamProfileCardTriggerInternal, "defaultProps", {
407
471
  triggerLinkType: 'link',
408
472
  shouldRenderToParent: true
409
473
  });
410
- export default withAnalyticsEvents()(injectIntl(TeamProfileCardTriggerInternal));
474
+ var TeamProfileCardTriggerWithAnalytics = function TeamProfileCardTriggerWithAnalytics(props) {
475
+ var _useAnalyticsEvents = useAnalyticsEvents(),
476
+ fireEvent = _useAnalyticsEvents.fireEvent;
477
+ return /*#__PURE__*/React.createElement(TeamProfileCardTriggerInternal, _extends({}, props, {
478
+ fireEvent: fireEvent
479
+ }));
480
+ };
481
+ export default componentWithFG('ptc-enable-profile-card-analytics-refactor', injectIntl(TeamProfileCardTriggerWithAnalytics), withAnalyticsEvents()(injectIntl(TeamProfileCardTriggerInternal)));
@@ -11,7 +11,9 @@ import AvatarGroup from '@atlaskit/avatar-group';
11
11
  import Heading from '@atlaskit/heading';
12
12
  import LinkItem from '@atlaskit/menu/link-item';
13
13
  import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { Box, Flex, Inline, Pressable, Stack, Text } from '@atlaskit/primitives/compiled';
16
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
15
17
  import TeamAvatar from '@atlaskit/teams-avatar';
16
18
  import { TeamContainers, useTeamContainers } from '@atlaskit/teams-public';
17
19
  import { fireEvent } from '../../util/analytics';
@@ -73,6 +75,8 @@ export var TeamProfileCard = function TeamProfileCard(_ref3) {
73
75
  loading = _useTeamContainers.loading;
74
76
  var _useAnalyticsEvents = useAnalyticsEvents(),
75
77
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
78
+ var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
79
+ fireEventNext = _useAnalyticsEventsNe.fireEvent;
76
80
  // Ensure that the current container is not the only connection for this team before showing the "Where we work" section
77
81
  var hasOtherTeamConnections = useMemo(function () {
78
82
  return teamContainers.filter(function (tc) {
@@ -83,18 +87,22 @@ export var TeamProfileCard = function TeamProfileCard(_ref3) {
83
87
  // TODO: set isNewLayout to be true when clean up 'team-bi-directional-container-connection' experiment
84
88
  var isNewLayout = Boolean(props.isKudosEnabled || props.otherActions);
85
89
  var onClick = useCallback(function () {
86
- if (createAnalyticsEvent) {
87
- fireEvent(createAnalyticsEvent, {
88
- action: 'clicked',
89
- actionSubject: 'button',
90
- actionSubjectId: 'viewTeamProfileButton',
91
- attributes: {}
92
- });
90
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
91
+ fireEventNext('ui.button.clicked.viewTeamProfileButton', {});
92
+ } else {
93
+ if (createAnalyticsEvent) {
94
+ fireEvent(createAnalyticsEvent, {
95
+ action: 'clicked',
96
+ actionSubject: 'button',
97
+ actionSubjectId: 'viewTeamProfileButton',
98
+ attributes: {}
99
+ });
100
+ }
93
101
  }
94
102
  if (!isNewLayout) {
95
103
  window.open(teamProfileUrl, '_blank');
96
104
  }
97
- }, [createAnalyticsEvent, teamProfileUrl, isNewLayout]);
105
+ }, [createAnalyticsEvent, teamProfileUrl, isNewLayout, fireEventNext]);
98
106
  if (isNewLayout) {
99
107
  return /*#__PURE__*/React.createElement(Box, {
100
108
  xcss: styles.wrapperStyles,
@@ -179,7 +187,8 @@ export var TeamProfileCard = function TeamProfileCard(_ref3) {
179
187
  testId: "team-app-tile",
180
188
  alt: "team-app-tile",
181
189
  xcss: styles.teamAppTileStyles
182
- })
190
+ }),
191
+ testId: "team-profile-card-profile-link-item"
183
192
  }, /*#__PURE__*/React.createElement(Text, {
184
193
  maxLines: 1,
185
194
  color: "color.text"
@@ -4,7 +4,9 @@ import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback } from 'react';
5
5
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
6
  import { LinkItem } from '@atlaskit/menu';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { Box, Inline, Stack, Text } from '@atlaskit/primitives/compiled';
9
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
8
10
  import { ContainerIcon, getContainerProperties } from '@atlaskit/teams-public';
9
11
  import { fireEvent } from '../../../util/analytics';
10
12
  var styles = {
@@ -27,16 +29,24 @@ export var TeamConnections = function TeamConnections(_ref) {
27
29
  containerTypeText = _getContainerProperti.containerTypeText;
28
30
  var _useAnalyticsEvents = useAnalyticsEvents(),
29
31
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
32
+ var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
33
+ fireEventNext = _useAnalyticsEventsNe.fireEvent;
30
34
  var onClick = useCallback(function () {
31
- fireEvent(createAnalyticsEvent, {
32
- action: 'clicked',
33
- actionSubject: 'teamConnectionItem',
34
- actionSubjectId: 'teamProfileCard',
35
- attributes: {
35
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
36
+ fireEventNext('ui.teamConnectionItem.clicked.teamProfileCard', {
36
37
  container: containerType
37
- }
38
- });
39
- }, [containerType, createAnalyticsEvent]);
38
+ });
39
+ } else {
40
+ fireEvent(createAnalyticsEvent, {
41
+ action: 'clicked',
42
+ actionSubject: 'teamConnectionItem',
43
+ actionSubjectId: 'teamProfileCard',
44
+ attributes: {
45
+ container: containerType
46
+ }
47
+ });
48
+ }
49
+ }, [containerType, createAnalyticsEvent, fireEventNext]);
40
50
  return /*#__PURE__*/React.createElement(LinkItem, {
41
51
  href: link,
42
52
  onClick: onClick,
@@ -81,16 +91,24 @@ export var NewTeamConnections = function NewTeamConnections(_ref2) {
81
91
  containerTypeText = _getContainerProperti2.containerTypeText;
82
92
  var _useAnalyticsEvents2 = useAnalyticsEvents(),
83
93
  createAnalyticsEvent = _useAnalyticsEvents2.createAnalyticsEvent;
94
+ var _useAnalyticsEventsNe2 = useAnalyticsEventsNext(),
95
+ fireEventNext = _useAnalyticsEventsNe2.fireEvent;
84
96
  var onClick = useCallback(function () {
85
- fireEvent(createAnalyticsEvent, {
86
- action: 'clicked',
87
- actionSubject: 'teamConnectionItem',
88
- actionSubjectId: 'teamProfileCard',
89
- attributes: {
97
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
98
+ fireEventNext('ui.teamConnectionItem.clicked.teamProfileCard', {
90
99
  container: containerType
91
- }
92
- });
93
- }, [containerType, createAnalyticsEvent]);
100
+ });
101
+ } else {
102
+ fireEvent(createAnalyticsEvent, {
103
+ action: 'clicked',
104
+ actionSubject: 'teamConnectionItem',
105
+ actionSubjectId: 'teamProfileCard',
106
+ attributes: {
107
+ container: containerType
108
+ }
109
+ });
110
+ }
111
+ }, [containerType, createAnalyticsEvent, fireEventNext]);
94
112
  return /*#__PURE__*/React.createElement(LinkItem, {
95
113
  href: link,
96
114
  onClick: onClick,
@@ -114,7 +132,8 @@ export var NewTeamConnections = function NewTeamConnections(_ref2) {
114
132
  backgroundColor: 'color.background.neutral.subtle',
115
133
  xcss: styles.containerTypeIconButtonStyles,
116
134
  testId: "container-type-icon"
117
- }, icon)
135
+ }, icon),
136
+ testId: "team-connection-item"
118
137
  }, /*#__PURE__*/React.createElement(Text, {
119
138
  maxLines: 1,
120
139
  color: "color.text"
@@ -70,6 +70,11 @@ export var getActionSubject = function getActionSubject(type) {
70
70
  return 'user';
71
71
  }
72
72
  };
73
+
74
+ /**
75
+ * @private
76
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
77
+ */
73
78
  export var cardTriggered = function cardTriggered(type, method, teamId) {
74
79
  return createEvent('ui', 'triggered', getActionSubject(type), undefined, _objectSpread({
75
80
  method: method
@@ -77,33 +82,83 @@ export var cardTriggered = function cardTriggered(type, method, teamId) {
77
82
  teamId: teamId
78
83
  } : {}));
79
84
  };
85
+
86
+ /**
87
+ * @private
88
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
89
+ */
80
90
  export var teamRequestAnalytics = function teamRequestAnalytics(action, attributes) {
81
91
  return createEvent('operational', action, TEAM_SUBJECT, 'request', attributes);
82
92
  };
93
+
94
+ /**
95
+ * @private
96
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
97
+ */
83
98
  export var userRequestAnalytics = function userRequestAnalytics(action, attributes) {
84
99
  return createEvent('operational', action, USER_SUBJECT, 'request', attributes);
85
100
  };
101
+
102
+ /**
103
+ * @private
104
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
105
+ */
86
106
  export var profileCardRendered = function profileCardRendered(type, actionSubjectId, attributes) {
87
107
  return createEvent('ui', 'rendered', getActionSubject(type), actionSubjectId, attributes);
88
108
  };
109
+
110
+ /**
111
+ * @private
112
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
113
+ */
89
114
  export var actionClicked = function actionClicked(type, attributes) {
90
115
  return createEvent('ui', 'clicked', getActionSubject(type), 'action', attributes);
91
116
  };
117
+
118
+ /**
119
+ * @private
120
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
121
+ */
92
122
  export var reportingLinesClicked = function reportingLinesClicked(attributes) {
93
123
  return createEvent('ui', 'clicked', USER_SUBJECT, 'reportingLines', attributes);
94
124
  };
125
+
126
+ /**
127
+ * @private
128
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
129
+ */
95
130
  export var moreActionsClicked = function moreActionsClicked(type, attributes) {
96
131
  return createEvent('ui', 'clicked', getActionSubject(type), 'moreActions', attributes);
97
132
  };
133
+
134
+ /**
135
+ * @private
136
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
137
+ */
98
138
  export var teamAvatarClicked = function teamAvatarClicked(attributes) {
99
139
  return createEvent('ui', 'clicked', TEAM_SUBJECT, 'avatar', attributes);
100
140
  };
141
+
142
+ /**
143
+ * @private
144
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
145
+ */
101
146
  export var moreMembersClicked = function moreMembersClicked(attributes) {
102
147
  return createEvent('ui', 'clicked', TEAM_SUBJECT, 'moreMembers', attributes);
103
148
  };
149
+
150
+ /**
151
+ * @private
152
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
153
+ */
104
154
  export var errorRetryClicked = function errorRetryClicked(attributes) {
105
155
  return createEvent('ui', 'clicked', TEAM_SUBJECT, 'errorRetry', attributes);
106
156
  };
157
+
158
+ /**
159
+ * @private
160
+ * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
161
+ */
107
162
  export var agentRequestAnalytics = function agentRequestAnalytics(action, actionSubjectId, attributes) {
108
163
  return createEvent('operational', action, AGENT_SUBJECT, actionSubjectId || 'request', attributes);
109
164
  };
@@ -17,13 +17,13 @@ declare class ProfileCardClient implements ProfileClient {
17
17
  constructor(config: ProfileClientOptions, clients?: ClientOverrides);
18
18
  flushCache(): void;
19
19
  getProfile(cloudId: string, userId: string, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<any>;
20
- getTeamProfile(teamId: string, orgId?: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").Team>;
20
+ getTeamProfile(teamId: string, orgId?: string, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<import("../types").Team>;
21
21
  getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
22
22
  getTeamCentralBaseUrl(teamCentralScopes?: TeamCentralScopes): Promise<string | undefined>;
23
23
  shouldShowGiveKudos(): Promise<boolean>;
24
- getRovoAgentProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").RovoAgent>;
25
- getRovoAgentPermissions(id: string, fireAnalytics?: ((event: AnalyticsEventPayload) => void) | undefined): Promise<import("../types").AgentPermissions>;
26
- deleteAgent(id: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
27
- setFavouriteAgent(id: string, isFavourite: boolean, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
24
+ getRovoAgentProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<import("../types").RovoAgent>;
25
+ getRovoAgentPermissions(id: string, fireAnalytics?: ((event: AnalyticsEventPayload) => void) | undefined, analyticsNext?: FireEventType): Promise<import("../types").AgentPermissions>;
26
+ deleteAgent(id: string, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<void>;
27
+ setFavouriteAgent(id: string, isFavourite: boolean, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<void>;
28
28
  }
29
29
  export default ProfileCardClient;
@@ -1,4 +1,5 @@
1
1
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
+ import { type FireEventType } from '@atlaskit/teams-app-internal-analytics';
2
3
  import type { AgentIdType, AgentPermissions, ProfileClientOptions, RovoAgent } from '../types';
3
4
  import CachingClient from './CachingClient';
4
5
  export default class RovoAgentCardClient extends CachingClient<RovoAgent> {
@@ -6,8 +7,8 @@ export default class RovoAgentCardClient extends CachingClient<RovoAgent> {
6
7
  constructor(options: ProfileClientOptions);
7
8
  private basePath;
8
9
  makeRequest(id: AgentIdType, cloudId: string): Promise<RovoAgent>;
9
- getProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void): Promise<RovoAgent>;
10
- deleteAgent(agentId: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
11
- setFavouriteAgent(agentId: string, isFavourite: boolean, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
12
- getPermissions(id: string, fireAnalytics?: (event: AnalyticsEventPayload) => void): Promise<AgentPermissions>;
10
+ getProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<RovoAgent>;
11
+ deleteAgent(agentId: string, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<void>;
12
+ setFavouriteAgent(agentId: string, isFavourite: boolean, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<void>;
13
+ getPermissions(id: string, fireAnalytics?: (event: AnalyticsEventPayload) => void, fireAnalyticsNext?: FireEventType): Promise<AgentPermissions>;
13
14
  }
@@ -1,9 +1,10 @@
1
1
  import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
+ import { type FireEventType } from '@atlaskit/teams-app-internal-analytics';
2
3
  import type { ProfileClientOptions, Team } from '../types';
3
4
  import CachingClient from './CachingClient';
4
5
  export default class TeamProfileCardClient extends CachingClient<Team> {
5
6
  options: ProfileClientOptions;
6
7
  constructor(options: ProfileClientOptions);
7
8
  makeRequest(teamId: string, _orgId: string | undefined): Promise<Team>;
8
- getProfile(teamId: string, orgId: string | undefined, analytics?: (event: AnalyticsEventPayload) => void): Promise<Team>;
9
+ getProfile(teamId: string, orgId: string | undefined, analytics?: (event: AnalyticsEventPayload) => void, analyticsNext?: FireEventType): Promise<Team>;
9
10
  }
@@ -1,5 +1,6 @@
1
1
  import { AGGError, AGGErrors, DirectoryGraphQLError, DirectoryGraphQLErrors } from '../util/errors';
2
- import { type ErrorAttributes } from './types';
2
+ import { type DEPRECATED_ErrorAttributes, type ErrorAttributes } from './types';
3
+ export declare const DEPRECATED_getErrorAttributes: (error?: DirectoryGraphQLErrors | Error | unknown | DirectoryGraphQLError | AGGError | AGGErrors) => DEPRECATED_ErrorAttributes;
3
4
  export declare const getErrorAttributes: (error?: DirectoryGraphQLErrors | Error | unknown | DirectoryGraphQLError | AGGError | AGGErrors) => ErrorAttributes;
4
5
  export declare const handleDirectoryGraphQLErrors: (errors: unknown, traceId: string | null) => void;
5
6
  export declare const handleAGGErrors: (errors: unknown, traceId: string | null) => void;
@@ -1,6 +1,6 @@
1
- export type ErrorAttributes = {
1
+ export type DEPRECATED_ErrorAttributes = {
2
2
  errorCount?: number;
3
- errorDetails?: Omit<ErrorAttributes, 'errorDetails'>[];
3
+ errorDetails?: Omit<DEPRECATED_ErrorAttributes, 'errorDetails'>[];
4
4
  errorMessage: string;
5
5
  errorCategory?: string;
6
6
  errorType?: string;
@@ -10,3 +10,15 @@ export type ErrorAttributes = {
10
10
  traceId?: string | null;
11
11
  errorStatusCode?: number;
12
12
  };
13
+ export type ErrorAttributes = {
14
+ errorCount: number | null;
15
+ errorDetails: Omit<ErrorAttributes, 'errorDetails'>[] | null;
16
+ errorMessage: string;
17
+ errorCategory: string | null;
18
+ errorType: string | null;
19
+ errorPath: string | null;
20
+ errorNumber: number | null;
21
+ isSLOFailure: boolean;
22
+ traceId: string | null;
23
+ errorStatusCode: number | null;
24
+ };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { type AnalyticsFunction } from '../../types';
2
+ import { type AnalyticsFunction, type AnalyticsFunctionNext } from '../../types';
3
3
  declare const _default: (props: {
4
4
  analytics: AnalyticsFunction;
5
+ analyticsNext: AnalyticsFunctionNext;
5
6
  }) => React.JSX.Element;
6
7
  export default _default;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { type AnalyticsFunction } from '../../types';
2
+ import { type AnalyticsFunction, type AnalyticsFunctionNext } from '../../types';
3
3
  declare const _default: (props: {
4
4
  analytics: AnalyticsFunction;
5
+ analyticsNext: AnalyticsFunctionNext;
5
6
  }) => React.JSX.Element;
6
7
  export default _default;