@atlaskit/profilecard 24.41.0 → 24.42.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 (62) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/afm-cc/tsconfig.json +0 -6
  3. package/dist/cjs/components/Agent/Actions.js +7 -24
  4. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +1 -1
  5. package/dist/cjs/components/Agent/hooks/useAgentActions.js +20 -72
  6. package/dist/cjs/components/Team/TeamForbiddenErrorState.js +8 -18
  7. package/dist/cjs/components/Team/TeamLoadingState.js +8 -18
  8. package/dist/cjs/components/Team/TeamProfileCard.js +76 -162
  9. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +2 -4
  10. package/dist/cjs/components/User/OverflowProfileCardButtons.js +9 -19
  11. package/dist/cjs/components/User/ProfileCard.js +37 -85
  12. package/dist/cjs/components/User/ProfileCardDetails.js +1 -2
  13. package/dist/cjs/components/User/ReportingLinesDetails.js +14 -34
  14. package/dist/cjs/components/common/ProfileCardTrigger.js +9 -17
  15. package/dist/cjs/components/team-profile-card/main.js +4 -20
  16. package/dist/cjs/components/team-profile-card/team-connections/main.js +6 -22
  17. package/dist/cjs/util/analytics.js +1 -29
  18. package/dist/es2019/components/Agent/Actions.js +7 -25
  19. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +1 -1
  20. package/dist/es2019/components/Agent/hooks/useAgentActions.js +20 -73
  21. package/dist/es2019/components/Team/TeamForbiddenErrorState.js +8 -16
  22. package/dist/es2019/components/Team/TeamLoadingState.js +8 -16
  23. package/dist/es2019/components/Team/TeamProfileCard.js +72 -146
  24. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +2 -4
  25. package/dist/es2019/components/User/OverflowProfileCardButtons.js +9 -17
  26. package/dist/es2019/components/User/ProfileCard.js +35 -79
  27. package/dist/es2019/components/User/ProfileCardDetails.js +1 -2
  28. package/dist/es2019/components/User/ReportingLinesDetails.js +13 -29
  29. package/dist/es2019/components/common/ProfileCardTrigger.js +9 -17
  30. package/dist/es2019/components/team-profile-card/main.js +4 -21
  31. package/dist/es2019/components/team-profile-card/team-connections/main.js +6 -23
  32. package/dist/es2019/util/analytics.js +0 -27
  33. package/dist/esm/components/Agent/Actions.js +7 -24
  34. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +1 -1
  35. package/dist/esm/components/Agent/hooks/useAgentActions.js +20 -72
  36. package/dist/esm/components/Team/TeamForbiddenErrorState.js +9 -19
  37. package/dist/esm/components/Team/TeamLoadingState.js +9 -19
  38. package/dist/esm/components/Team/TeamProfileCard.js +77 -163
  39. package/dist/esm/components/Team/TeamProfileCardTrigger.js +2 -4
  40. package/dist/esm/components/User/OverflowProfileCardButtons.js +10 -20
  41. package/dist/esm/components/User/ProfileCard.js +38 -86
  42. package/dist/esm/components/User/ProfileCardDetails.js +1 -2
  43. package/dist/esm/components/User/ReportingLinesDetails.js +15 -35
  44. package/dist/esm/components/common/ProfileCardTrigger.js +10 -18
  45. package/dist/esm/components/team-profile-card/main.js +4 -20
  46. package/dist/esm/components/team-profile-card/team-connections/main.js +6 -22
  47. package/dist/esm/util/analytics.js +0 -29
  48. package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +1 -2
  49. package/dist/types/components/Team/TeamLoadingState.d.ts +1 -2
  50. package/dist/types/components/User/ProfileCard.d.ts +2 -3
  51. package/dist/types/components/User/lazyProfileCard.d.ts +1 -1
  52. package/dist/types/components/common/types.d.ts +1 -3
  53. package/dist/types/types.d.ts +3 -10
  54. package/dist/types/util/analytics.d.ts +2 -17
  55. package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +1 -2
  56. package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +1 -2
  57. package/dist/types-ts4.5/components/User/ProfileCard.d.ts +2 -3
  58. package/dist/types-ts4.5/components/User/lazyProfileCard.d.ts +1 -1
  59. package/dist/types-ts4.5/components/common/types.d.ts +1 -3
  60. package/dist/types-ts4.5/types.d.ts +3 -10
  61. package/dist/types-ts4.5/util/analytics.d.ts +2 -17
  62. package/package.json +2 -7
@@ -179,7 +179,6 @@ var ProfileCardDetails = exports.ProfileCardDetails = function ProfileCardDetail
179
179
  reportingLines: props.reportingLines,
180
180
  reportingLinesProfileUrl: props.reportingLinesProfileUrl,
181
181
  onReportingLinesClick: props.onReportingLinesClick,
182
- fireAnalyticsWithDuration: props.fireAnalyticsWithDuration,
183
- fireAnalyticsWithDurationNext: props.fireAnalyticsWithDurationNext
182
+ fireAnalyticsWithDuration: props.fireAnalyticsWithDuration
184
183
  }));
185
184
  };
@@ -14,7 +14,6 @@ var _reactIntlNext = require("react-intl-next");
14
14
  var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
15
15
  var _avatarGroup = _interopRequireDefault(require("@atlaskit/avatar-group"));
16
16
  var _css = require("@atlaskit/css");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
17
  var _compiled = require("@atlaskit/primitives/compiled");
19
18
  var _messages = _interopRequireDefault(require("../../messages"));
20
19
  var _ReportingLines = require("../../styled/ReportingLines");
@@ -36,7 +35,6 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
36
35
  var _useIntl = (0, _reactIntlNext.useIntl)(),
37
36
  formatMessage = _useIntl.formatMessage;
38
37
  var fireAnalyticsWithDuration = props.fireAnalyticsWithDuration,
39
- fireAnalyticsWithDurationNext = props.fireAnalyticsWithDurationNext,
40
38
  _props$reportingLines = props.reportingLines,
41
39
  reportingLines = _props$reportingLines === void 0 ? {} : _props$reportingLines,
42
40
  reportingLinesProfileUrl = props.reportingLinesProfileUrl,
@@ -49,22 +47,13 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
49
47
  var hasReports = reports.length > 0;
50
48
  var getReportingLinesOnClick = function getReportingLinesOnClick(user, userType) {
51
49
  return onReportingLinesClick ? function () {
52
- if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
53
- fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', function (duration) {
54
- return _objectSpread({
55
- duration: duration,
56
- userType: userType,
57
- firedAt: Math.round((0, _performance.getPageTime)())
58
- }, _analytics.PACKAGE_META_DATA);
59
- });
60
- } else {
61
- fireAnalyticsWithDuration(function (duration) {
62
- return (0, _analytics.reportingLinesClicked)({
63
- duration: duration,
64
- userType: userType
65
- });
66
- });
67
- }
50
+ fireAnalyticsWithDuration('ui.profilecard.clicked.reportingLines', function (duration) {
51
+ return _objectSpread({
52
+ duration: duration,
53
+ userType: userType,
54
+ firedAt: Math.round((0, _performance.getPageTime)())
55
+ }, _analytics.PACKAGE_META_DATA);
56
+ });
68
57
  onReportingLinesClick(user);
69
58
  } : undefined;
70
59
  };
@@ -73,22 +62,13 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
73
62
  if (onReportingLinesClick) {
74
63
  shouldPreventDefault = onReportingLinesClick(user) === false;
75
64
  }
76
- if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
77
- fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', function (duration) {
78
- return _objectSpread({
79
- duration: duration,
80
- userType: userType,
81
- firedAt: Math.round((0, _performance.getPageTime)())
82
- }, _analytics.PACKAGE_META_DATA);
83
- });
84
- } else {
85
- fireAnalyticsWithDuration(function (duration) {
86
- return (0, _analytics.reportingLinesClicked)({
87
- duration: duration,
88
- userType: userType
89
- });
90
- });
91
- }
65
+ fireAnalyticsWithDuration('ui.profilecard.clicked.reportingLines', function (duration) {
66
+ return _objectSpread({
67
+ duration: duration,
68
+ userType: userType,
69
+ firedAt: Math.round((0, _performance.getPageTime)())
70
+ }, _analytics.PACKAGE_META_DATA);
71
+ });
92
72
  if (shouldPreventDefault) {
93
73
  return;
94
74
  }
@@ -13,7 +13,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
13
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
15
  var _react = _interopRequireWildcard(require("react"));
16
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
16
  var _popup = _interopRequireDefault(require("@atlaskit/popup"));
18
17
  var _constants = require("@atlaskit/theme/constants");
19
18
  var _analytics = require("../../util/analytics");
@@ -22,7 +21,7 @@ var _useProfileInfo2 = require("../../util/useProfileInfo");
22
21
  var _LoadingState = require("./LoadingState");
23
22
  var _PopupTrigger = require("./PopupTrigger");
24
23
  var _ProfileCardWrapper = require("./ProfileCardWrapper");
25
- var _excluded = ["trigger", "ariaLabelledBy", "children", "renderProfileCard", "fetchProfile", "disabledAriaAttributes", "profileCardType", "testId", "fireAnalytics", "fireAnalyticsNext"],
24
+ var _excluded = ["trigger", "ariaLabelledBy", "children", "renderProfileCard", "fetchProfile", "disabledAriaAttributes", "profileCardType", "testId", "fireAnalytics"],
26
25
  _excluded2 = ["aria-expanded", "aria-haspopup"];
27
26
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
28
27
  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; }
@@ -40,7 +39,6 @@ function ProfileCardTriggerInner(_ref, ref) {
40
39
  profileCardType = _ref.profileCardType,
41
40
  testId = _ref.testId,
42
41
  fireAnalytics = _ref.fireAnalytics,
43
- fireAnalyticsNext = _ref.fireAnalyticsNext,
44
42
  popupProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
45
43
  var showDelay = _trigger === 'click' ? 0 : DELAY_MS_SHOW;
46
44
  var hideDelay = _trigger === 'click' ? 0 : DELAY_MS_HIDE;
@@ -85,18 +83,12 @@ function ProfileCardTriggerInner(_ref, ref) {
85
83
  if (!visible) {
86
84
  getProfileData === null || getProfileData === void 0 || getProfileData();
87
85
  setVisible(true);
88
- if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
89
- if (fireAnalyticsNext) {
90
- fireAnalyticsNext("ui.".concat((0, _analytics.getActionSubject)(profileCardType), ".triggered"), _objectSpread(_objectSpread({
91
- method: _trigger
92
- }, _analytics.PACKAGE_META_DATA), {}, {
93
- firedAt: Math.round((0, _performance.getPageTime)())
94
- }));
95
- }
96
- } else {
97
- if (fireAnalytics) {
98
- fireAnalytics((0, _analytics.cardTriggered)(profileCardType, _trigger));
99
- }
86
+ if (fireAnalytics) {
87
+ fireAnalytics("ui.".concat((0, _analytics.getActionSubject)(profileCardType), ".triggered"), _objectSpread(_objectSpread({
88
+ method: _trigger
89
+ }, _analytics.PACKAGE_META_DATA), {}, {
90
+ firedAt: Math.round((0, _performance.getPageTime)())
91
+ }));
100
92
  }
101
93
  }
102
94
  }, showDelay);
@@ -105,7 +97,7 @@ function ProfileCardTriggerInner(_ref, ref) {
105
97
  return _context.stop();
106
98
  }
107
99
  }, _callee);
108
- })), [showDelay, visible, getProfileData, fireAnalytics, profileCardType, _trigger, fireAnalyticsNext]);
100
+ })), [showDelay, visible, getProfileData, fireAnalytics, profileCardType, _trigger]);
109
101
  var onMouseEnter = (0, _react.useCallback)(function () {
110
102
  showProfilecard();
111
103
  }, [showProfilecard]);
@@ -141,7 +133,7 @@ function ProfileCardTriggerInner(_ref, ref) {
141
133
  }, isLoading ? /*#__PURE__*/_react.default.createElement(_ProfileCardWrapper.ProfileCardWrapper, {
142
134
  testId: "profilecard.profilecardtrigger.loading"
143
135
  }, /*#__PURE__*/_react.default.createElement(_LoadingState.LoadingState, {
144
- fireAnalytics: fireAnalyticsNext,
136
+ fireAnalytics: fireAnalytics,
145
137
  profileType: profileCardType
146
138
  })) : renderProfileCard({
147
139
  profileData: profileData,
@@ -14,17 +14,14 @@ var _runtime = require("@compiled/react/runtime");
14
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
15
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
16
16
  var _reactIntlNext = require("react-intl-next");
17
- var _analyticsNext = require("@atlaskit/analytics-next");
18
17
  var _avatarGroup = _interopRequireDefault(require("@atlaskit/avatar-group"));
19
18
  var _heading = _interopRequireDefault(require("@atlaskit/heading"));
20
19
  var _linkItem = _interopRequireDefault(require("@atlaskit/menu/link-item"));
21
20
  var _verifiedTeamIcon = require("@atlaskit/people-teams-ui-public/verified-team-icon");
22
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
21
  var _compiled = require("@atlaskit/primitives/compiled");
24
22
  var _teamsAppInternalAnalytics = require("@atlaskit/teams-app-internal-analytics");
25
23
  var _teamsAvatar = _interopRequireDefault(require("@atlaskit/teams-avatar"));
26
24
  var _teamsPublic = require("@atlaskit/teams-public");
27
- var _analytics = require("../../util/analytics");
28
25
  var _TeamAppTile = _interopRequireDefault(require("../common/assets/TeamAppTile.svg"));
29
26
  var _teamActions = require("./team-actions");
30
27
  var _main = require("./team-connections/main");
@@ -60,10 +57,8 @@ var TeamProfileCard = exports.TeamProfileCard = function TeamProfileCard(_ref) {
60
57
  var _useTeamContainers = (0, _teamsPublic.useTeamContainers)(teamId),
61
58
  teamContainers = _useTeamContainers.teamContainers,
62
59
  loading = _useTeamContainers.loading;
63
- var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
64
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
65
- var _useAnalyticsEventsNe = (0, _teamsAppInternalAnalytics.useAnalyticsEvents)(),
66
- fireEventNext = _useAnalyticsEventsNe.fireEvent;
60
+ var _useAnalyticsEvents = (0, _teamsAppInternalAnalytics.useAnalyticsEvents)(),
61
+ fireEvent = _useAnalyticsEvents.fireEvent;
67
62
  // Ensure that the current container is not the only connection for this team before showing the "Where we work" section
68
63
  var hasOtherTeamConnections = (0, _react.useMemo)(function () {
69
64
  return teamContainers.filter(function (tc) {
@@ -71,19 +66,8 @@ var TeamProfileCard = exports.TeamProfileCard = function TeamProfileCard(_ref) {
71
66
  }).length < teamContainers.length;
72
67
  }, [containerId, teamContainers]);
73
68
  var onClick = (0, _react.useCallback)(function () {
74
- if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
75
- fireEventNext('ui.button.clicked.viewTeamProfileButton', {});
76
- } else {
77
- if (createAnalyticsEvent) {
78
- (0, _analytics.fireEvent)(createAnalyticsEvent, {
79
- action: 'clicked',
80
- actionSubject: 'button',
81
- actionSubjectId: 'viewTeamProfileButton',
82
- attributes: {}
83
- });
84
- }
85
- }
86
- }, [createAnalyticsEvent, fireEventNext]);
69
+ fireEvent('ui.button.clicked.viewTeamProfileButton', {});
70
+ }, [fireEvent]);
87
71
  return /*#__PURE__*/React.createElement(_compiled.Box, {
88
72
  xcss: styles.wrapperStyles,
89
73
  testId: "team-card-".concat(teamId)
@@ -9,13 +9,10 @@ exports.TeamConnections = void 0;
9
9
  require("./main.compiled.css");
10
10
  var _runtime = require("@compiled/react/runtime");
11
11
  var _react = _interopRequireWildcard(require("react"));
12
- var _analyticsNext = require("@atlaskit/analytics-next");
13
12
  var _menu = require("@atlaskit/menu");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
13
  var _compiled = require("@atlaskit/primitives/compiled");
16
14
  var _teamsAppInternalAnalytics = require("@atlaskit/teams-app-internal-analytics");
17
15
  var _teamsPublic = require("@atlaskit/teams-public");
18
- var _analytics = require("../../../util/analytics");
19
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
17
  var styles = {
21
18
  containerTypeIconButtonStyles: "_18u01wug _4t3i7vkz _1bsb7vkz"
@@ -33,26 +30,13 @@ var TeamConnections = exports.TeamConnections = function TeamConnections(_ref) {
33
30
  description = _getContainerProperti.description,
34
31
  icon = _getContainerProperti.icon,
35
32
  containerTypeText = _getContainerProperti.containerTypeText;
36
- var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
37
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
38
- var _useAnalyticsEventsNe = (0, _teamsAppInternalAnalytics.useAnalyticsEvents)(),
39
- fireEventNext = _useAnalyticsEventsNe.fireEvent;
33
+ var _useAnalyticsEvents = (0, _teamsAppInternalAnalytics.useAnalyticsEvents)(),
34
+ fireEvent = _useAnalyticsEvents.fireEvent;
40
35
  var onClick = (0, _react.useCallback)(function () {
41
- if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
42
- fireEventNext('ui.teamConnectionItem.clicked.teamProfileCard', {
43
- container: containerType
44
- });
45
- } else {
46
- (0, _analytics.fireEvent)(createAnalyticsEvent, {
47
- action: 'clicked',
48
- actionSubject: 'teamConnectionItem',
49
- actionSubjectId: 'teamProfileCard',
50
- attributes: {
51
- container: containerType
52
- }
53
- });
54
- }
55
- }, [containerType, createAnalyticsEvent, fireEventNext]);
36
+ fireEvent('ui.teamConnectionItem.clicked.teamProfileCard', {
37
+ container: containerType
38
+ });
39
+ }, [containerType, fireEvent]);
56
40
  return /*#__PURE__*/_react.default.createElement(_menu.LinkItem, {
57
41
  href: link,
58
42
  onClick: onClick,
@@ -4,43 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.userRequestAnalytics = exports.teamRequestAnalytics = exports.teamAvatarClicked = exports.reportingLinesClicked = exports.profileCardRendered = exports.moreMembersClicked = exports.moreActionsClicked = exports.getActionSubject = exports.fireEvent = exports.errorRetryClicked = exports.cardTriggered = exports.agentRequestAnalytics = exports.actionClicked = exports.PACKAGE_META_DATA = void 0;
7
+ exports.userRequestAnalytics = exports.teamRequestAnalytics = exports.teamAvatarClicked = exports.reportingLinesClicked = exports.profileCardRendered = exports.moreMembersClicked = exports.moreActionsClicked = exports.getActionSubject = exports.errorRetryClicked = exports.cardTriggered = exports.agentRequestAnalytics = exports.actionClicked = exports.PACKAGE_META_DATA = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _performance = require("./performance");
10
10
  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; }
11
11
  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) { (0, _defineProperty2.default)(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; }
12
- /** Below lines are copied from teams common analytics */
13
- var ANALYTICS_CHANNEL = 'peopleTeams';
14
12
  var PACKAGE_META_DATA = exports.PACKAGE_META_DATA = {
15
13
  packageName: "@atlaskit/profilecard",
16
14
  packageVersion: "0.0.0-development"
17
15
  };
18
- var runItLater = function runItLater(cb) {
19
- var requestIdleCallback = window.requestIdleCallback;
20
- if (typeof requestIdleCallback === 'function') {
21
- return requestIdleCallback(cb);
22
- }
23
- if (typeof window.requestAnimationFrame === 'function') {
24
- return window.requestAnimationFrame(cb);
25
- }
26
- return function () {
27
- return setTimeout(cb);
28
- };
29
- };
30
- /**
31
- * @private
32
- * @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
33
- */
34
- var fireEvent = exports.fireEvent = function fireEvent(createAnalyticsEvent, body) {
35
- if (!createAnalyticsEvent) {
36
- return;
37
- }
38
- runItLater(function () {
39
- createAnalyticsEvent(body).fire(ANALYTICS_CHANNEL);
40
- });
41
- };
42
- /** Above lines are copied from teams common analytics */
43
-
44
16
  var TEAM_SUBJECT = 'teamProfileCard';
45
17
  var USER_SUBJECT = 'profilecard';
46
18
  var AGENT_SUBJECT = 'rovoAgentProfilecard';
@@ -3,13 +3,10 @@ import "./Actions.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback, useState } from 'react';
5
5
  import { defineMessages, useIntl } from 'react-intl-next';
6
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
6
  import Button from '@atlaskit/button/new';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
7
  import { Box, Inline } from '@atlaskit/primitives/compiled';
10
8
  import { AgentDropdownMenu } from '@atlaskit/rovo-agent-components/ui/AgentDropdownMenu';
11
- import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
12
- import { fireEvent } from '../../util/analytics';
9
+ import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
13
10
  import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
14
11
  const styles = {
15
12
  chatToAgentButtonContainer: "_1bsb1osq",
@@ -32,11 +29,8 @@ export const AgentActions = ({
32
29
  formatMessage
33
30
  } = useIntl();
34
31
  const {
35
- createAnalyticsEvent
32
+ fireEvent
36
33
  } = useAnalyticsEvents();
37
- const {
38
- fireEvent: fireEventNext
39
- } = useAnalyticsEventsNext();
40
34
  const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
41
35
  const isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
42
36
  const loadAgentPermissions = useCallback(async () => {
@@ -54,24 +48,12 @@ export const AgentActions = ({
54
48
  };
55
49
  }, [agent.id, resourceClient]);
56
50
  const handleDeleteAgent = useCallback(() => {
57
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
58
- fireEventNext('ui.button.clicked.deleteAgentButton', {
59
- agentId: agent.id,
60
- source: 'agentProfileCard'
61
- });
62
- } else {
63
- fireEvent(createAnalyticsEvent, {
64
- action: 'clicked',
65
- actionSubject: 'button',
66
- actionSubjectId: 'deleteAgentButton',
67
- attributes: {
68
- agentId: agent.id,
69
- source: 'agentProfileCard'
70
- }
71
- });
72
- }
51
+ fireEvent('ui.button.clicked.deleteAgentButton', {
52
+ agentId: agent.id,
53
+ source: 'agentProfileCard'
54
+ });
73
55
  setIsDeleteModalOpen(true);
74
- }, [agent.id, createAnalyticsEvent, fireEventNext]);
56
+ }, [agent.id, fireEvent]);
75
57
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
76
58
  space: "space.100",
77
59
  xcss: styles.actionsWrapperStyles
@@ -129,7 +129,7 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
129
129
  trigger: "hover",
130
130
  renderProfileCard: renderProfileCard,
131
131
  fetchProfile: fetchAgentProfile,
132
- fireAnalyticsNext: fireEvent,
132
+ fireAnalytics: fireEvent,
133
133
  profileCardType: "agent"
134
134
  }));
135
135
  });
@@ -1,11 +1,9 @@
1
1
  import { useCallback } from 'react';
2
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
3
2
  import { getATLContextUrl } from '@atlaskit/atlassian-context';
4
3
  import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers/post-message-to-pubsub';
6
5
  import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
7
- import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
8
- import { fireEvent } from '../../../util/analytics';
6
+ import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
9
7
  import { encodeParamsToUrl } from '../../../util/url';
10
8
  import { getAtlassianStudioAgentDuplicateUrl, getAtlassianStudioAgentEditUrl } from '../utils';
11
9
  export const firstCharUpper = str => str.charAt(0).toUpperCase() + str.slice(1);
@@ -25,74 +23,35 @@ export const useAgentUrlActions = ({
25
23
  publishWithPostMessage
26
24
  } = useRovoPostMessageToPubsub();
27
25
  const {
28
- createAnalyticsEvent
26
+ fireEvent
29
27
  } = useAnalyticsEvents();
30
- const {
31
- fireEvent: fireEventNext
32
- } = useAnalyticsEventsNext();
33
28
  const onEditAgent = useCallback(agentId => {
34
29
  const url = getAtlassianStudioAgentEditUrl(cloudId, agentId);
35
30
  window.open(url, '_blank', 'noopener, noreferrer');
36
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
37
- fireEventNext('ui.button.clicked.editAgentButton', {
38
- agentId,
39
- source
40
- });
41
- } else {
42
- fireEvent(createAnalyticsEvent, {
43
- action: 'clicked',
44
- actionSubject: 'button',
45
- actionSubjectId: 'editAgentButton',
46
- attributes: {
47
- agentId,
48
- source
49
- }
50
- });
51
- }
52
- }, [cloudId, createAnalyticsEvent, fireEventNext, source]);
31
+ fireEvent('ui.button.clicked.editAgentButton', {
32
+ agentId,
33
+ source
34
+ });
35
+ }, [cloudId, fireEvent, source]);
53
36
  const onCopyAgent = agentId => {
54
37
  const url = `${window.location.origin}/people/agent/${agentId}`;
55
38
  const urlWithParams = encodeParamsToUrl(url, {
56
39
  cloudId
57
40
  });
58
41
  navigator.clipboard.writeText(urlWithParams);
59
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
60
- fireEventNext('ui.button.clicked.copyAgentLinkButton', {
61
- agentId,
62
- source
63
- });
64
- } else {
65
- fireEvent(createAnalyticsEvent, {
66
- action: 'clicked',
67
- actionSubject: 'button',
68
- actionSubjectId: 'copyAgentLinkButton',
69
- attributes: {
70
- agentId,
71
- source
72
- }
73
- });
74
- }
42
+ fireEvent('ui.button.clicked.copyAgentLinkButton', {
43
+ agentId,
44
+ source
45
+ });
75
46
  };
76
47
  const onDuplicateAgent = useCallback(agentId => {
77
48
  const url = getAtlassianStudioAgentDuplicateUrl(cloudId, agentId);
78
49
  window.open(url, '_blank', 'noopener, noreferrer');
79
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
80
- fireEventNext('ui.button.clicked.duplicateAgentButton', {
81
- agentId,
82
- source
83
- });
84
- } else {
85
- fireEvent(createAnalyticsEvent, {
86
- action: 'clicked',
87
- actionSubject: 'button',
88
- actionSubjectId: 'duplicateAgentButton',
89
- attributes: {
90
- agentId,
91
- source
92
- }
93
- });
94
- }
95
- }, [cloudId, createAnalyticsEvent, fireEventNext, source]);
50
+ fireEvent('ui.button.clicked.duplicateAgentButton', {
51
+ agentId,
52
+ source
53
+ });
54
+ }, [cloudId, fireEvent, source]);
96
55
  const onConversationStarter = ({
97
56
  agentId,
98
57
  prompt
@@ -171,22 +130,10 @@ export const useAgentUrlActions = ({
171
130
  } else {
172
131
  window.open(`${window.location.origin}/people/agent/${agentId}`, '_blank', 'noopener, noreferrer');
173
132
  }
174
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
175
- fireEventNext('ui.button.clicked.viewAgentFullProfileButton', {
176
- agentId,
177
- source
178
- });
179
- } else {
180
- fireEvent(createAnalyticsEvent, {
181
- action: 'clicked',
182
- actionSubject: 'button',
183
- actionSubjectId: 'viewAgentFullProfileButton',
184
- attributes: {
185
- agentId,
186
- source
187
- }
188
- });
189
- }
133
+ fireEvent('ui.button.clicked.viewAgentFullProfileButton', {
134
+ agentId,
135
+ source
136
+ });
190
137
  };
191
138
  return {
192
139
  onEditAgent,
@@ -1,31 +1,23 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import EmptyState from '@atlaskit/empty-state';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import messages from '../../messages';
6
5
  import { AccessLockSVGWrapper, TeamForbiddenErrorStateWrapper } from '../../styled/TeamCard';
7
- import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
6
+ import { PACKAGE_META_DATA } from '../../util/analytics';
8
7
  import { getPageTime } from '../../util/performance';
9
8
  import AccessLockSVG from '../Error/AccessLockSVG';
10
9
  export default (props => {
11
10
  const {
12
- analytics,
13
- analyticsNext
11
+ analytics
14
12
  } = props;
15
13
  const intl = useIntl();
16
14
  useEffect(() => {
17
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
18
- analyticsNext('ui.teamProfileCard.rendered.error', duration => ({
19
- duration,
20
- firedAt: Math.round(getPageTime()),
21
- ...PACKAGE_META_DATA
22
- }));
23
- } else {
24
- analytics(duration => profileCardRendered('team', 'error', {
25
- duration
26
- }));
27
- }
28
- }, [analytics, analyticsNext]);
15
+ analytics('ui.teamProfileCard.rendered.error', duration => ({
16
+ duration,
17
+ firedAt: Math.round(getPageTime()),
18
+ ...PACKAGE_META_DATA
19
+ }));
20
+ }, [analytics]);
29
21
  return /*#__PURE__*/React.createElement(TeamForbiddenErrorStateWrapper, {
30
22
  testId: "team-profilecard-forbidden-error-state"
31
23
  }, /*#__PURE__*/React.createElement(EmptyState, {
@@ -1,27 +1,19 @@
1
1
  import React, { useEffect } from 'react';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import Spinner from '@atlaskit/spinner';
4
3
  import { CardContent, CardHeader, CardWrapper, LoadingWrapper } from '../../styled/TeamTrigger';
5
- import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
4
+ import { PACKAGE_META_DATA } from '../../util/analytics';
6
5
  import { getPageTime } from '../../util/performance';
7
6
  export default (props => {
8
7
  const {
9
- analytics,
10
- analyticsNext
8
+ analytics
11
9
  } = props;
12
10
  useEffect(() => {
13
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
14
- analyticsNext('ui.teamProfileCard.rendered.spinner', duration => ({
15
- duration,
16
- firedAt: Math.round(getPageTime()),
17
- ...PACKAGE_META_DATA
18
- }));
19
- } else {
20
- analytics(duration => profileCardRendered('team', 'spinner', {
21
- duration
22
- }));
23
- }
24
- }, [analytics, analyticsNext]);
11
+ analytics('ui.teamProfileCard.rendered.spinner', duration => ({
12
+ duration,
13
+ firedAt: Math.round(getPageTime()),
14
+ ...PACKAGE_META_DATA
15
+ }));
16
+ }, [analytics]);
25
17
  return /*#__PURE__*/React.createElement(CardWrapper, {
26
18
  testId: "team-profilecard"
27
19
  }, /*#__PURE__*/React.createElement(CardHeader, {