@atlaskit/profilecard 23.9.0 → 23.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 23.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#147535](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147535)
8
+ [`cb92395c4a53d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cb92395c4a53d) -
9
+ [ux] implement the function of "give kudos" in the TeamProfileCardWithContainer
10
+
11
+ ## 23.9.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 23.9.0
4
18
 
5
19
  ### Minor Changes
@@ -11,7 +11,7 @@ var _graphqlUtils = require("./graphqlUtils");
11
11
  var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
12
12
  var addHeaders = function addHeaders(headers) {
13
13
  headers.append('atl-client-name', "@atlaskit/profilecard");
14
- headers.append('atl-client-version', "23.9.0");
14
+ headers.append('atl-client-version', "23.10.0");
15
15
  return headers;
16
16
  };
17
17
  function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -66,7 +66,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
66
66
  headers.append('X-ExperimentalApi', 'teams-beta');
67
67
  headers.append('X-ExperimentalApi', 'team-members-beta');
68
68
  headers.append('atl-client-name', "@atlaskit/profilecard");
69
- headers.append('atl-client-version', "23.9.0");
69
+ headers.append('atl-client-version', "23.10.0");
70
70
  return headers;
71
71
  };
72
72
  function getTeamFromAGG(_x, _x2, _x3) {
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.TeamProfileCard = void 0;
10
10
  require("./main.compiled.css");
11
11
  var _runtime = require("@compiled/react/runtime");
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
14
  var _react = _interopRequireWildcard(require("react"));
13
15
  var _reactIntlNext = require("react-intl-next");
14
16
  var _analyticsNext = require("@atlaskit/analytics-next");
@@ -22,6 +24,7 @@ var _analytics = require("../../util/analytics");
22
24
  var _teamActions = require("./team-actions");
23
25
  var _main = require("./team-connections/main");
24
26
  var _teamContainersSkeleton = require("./team-containers-skeleton");
27
+ var _excluded = ["containerId", "teamId", "displayName", "description", "avatarImageUrl", "headerImageUrl", "memberAvatars", "memberCount", "cloudId", "userId", "isVerified", "teamProfileUrl"];
25
28
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
26
29
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
30
  var noop = function noop() {};
@@ -68,8 +71,7 @@ var TeamProfileCard = exports.TeamProfileCard = function TeamProfileCard(_ref3)
68
71
  userId = _ref3.userId,
69
72
  isVerified = _ref3.isVerified,
70
73
  teamProfileUrl = _ref3.teamProfileUrl,
71
- isKudosEnabled = _ref3.isKudosEnabled,
72
- otherActions = _ref3.otherActions;
74
+ props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
73
75
  var _useTeamContainers = (0, _teamsPublic.useTeamContainers)(teamId),
74
76
  teamContainers = _useTeamContainers.teamContainers,
75
77
  loading = _useTeamContainers.loading;
@@ -150,11 +152,11 @@ var TeamProfileCard = exports.TeamProfileCard = function TeamProfileCard(_ref3)
150
152
  },
151
153
  filterContainerId: containerId,
152
154
  isDisplayedOnProfileCard: true
153
- })), isKudosEnabled || otherActions ? /*#__PURE__*/_react.default.createElement(_teamActions.ButtonSection, {
155
+ })), props.isKudosEnabled || props.otherActions ? /*#__PURE__*/_react.default.createElement(_teamActions.ButtonSection, (0, _extends2.default)({
154
156
  teamProfileUrl: teamProfileUrl,
155
- isKudosEnabled: isKudosEnabled,
156
- otherActions: otherActions
157
- }) : teamProfileUrl && /*#__PURE__*/_react.default.createElement(_compiled.Stack, {
157
+ cloudId: cloudId,
158
+ teamId: teamId
159
+ }, props)) : teamProfileUrl && /*#__PURE__*/_react.default.createElement(_compiled.Stack, {
158
160
  xcss: styles.viewProfileContainerStyles
159
161
  }, /*#__PURE__*/_react.default.createElement(_compiled.Pressable, {
160
162
  onClick: onClick,
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.mockTeamContainersQueries = exports.mockProfileData = void 0;
8
8
  var _client = _interopRequireDefault(require("fetch-mock/cjs/client"));
9
9
  var mockProfileData = exports.mockProfileData = {
10
- teamId: '8ee37950-7de7-41ec-aee2-2c02c95949f4',
10
+ teamId: 'ari:cloud:identity::team/8ee37950-7de7-41ec-aee2-2c02c95949f4',
11
11
  displayName: 'THE SUPER TEAM',
12
12
  description: "Super team's super description - This is a very long line, adding more lines here to test the line limit of 3 that we enforce on the description of the team. In case the description very long, it should display an elipses at the end and hide that content that is overflowing",
13
13
  avatarImageUrl: 'https://test-prod-issue-create.atlassian.net/wiki/download/attachments/35061761/SUP-default?version=1&modificationDate=1739217199215&cacheVersion=1&api=v2',
@@ -10,15 +10,20 @@ exports.ButtonSection = void 0;
10
10
  require("./index.compiled.css");
11
11
  var _runtime = require("@compiled/react/runtime");
12
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
15
  var _react = _interopRequireWildcard(require("react"));
14
16
  var _reactIntlNext = require("react-intl-next");
15
17
  var _analyticsNext = require("@atlaskit/analytics-next");
16
18
  var _new = require("@atlaskit/button/new");
19
+ var _giveKudos = require("@atlaskit/give-kudos");
17
20
  var _menu = require("@atlaskit/menu");
18
21
  var _primitives = require("@atlaskit/primitives");
22
+ var _getTeamFromAGG = require("../../../client/getTeamFromAGG");
19
23
  var _analytics = require("../../../util/analytics");
20
24
  var _messages = require("./messages");
21
25
  var _moreActions = require("./more-actions");
26
+ var _excluded = ["teamProfileUrl", "isKudosEnabled", "otherActions"];
22
27
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
28
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
29
  var GIVE_KUDOS_ACTION_ID = 'give-kudos';
@@ -29,11 +34,16 @@ var styles = {
29
34
  var ButtonSection = exports.ButtonSection = function ButtonSection(_ref) {
30
35
  var teamProfileUrl = _ref.teamProfileUrl,
31
36
  isKudosEnabled = _ref.isKudosEnabled,
32
- otherActions = _ref.otherActions;
37
+ otherActions = _ref.otherActions,
38
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
33
39
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
34
40
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
35
41
  var _useIntl = (0, _reactIntlNext.useIntl)(),
36
42
  formatMessage = _useIntl.formatMessage;
43
+ var _useState = (0, _react.useState)(false),
44
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
45
+ isKudosOpen = _useState2[0],
46
+ setIsKudosOpen = _useState2[1];
37
47
  var onTeamProfileClick = (0, _react.useCallback)(function () {
38
48
  if (createAnalyticsEvent) {
39
49
  (0, _analytics.fireEvent)(createAnalyticsEvent, {
@@ -44,17 +54,24 @@ var ButtonSection = exports.ButtonSection = function ButtonSection(_ref) {
44
54
  });
45
55
  }
46
56
  }, [createAnalyticsEvent]);
57
+ var onKudosClick = (0, _react.useCallback)(function () {
58
+ setIsKudosOpen(true);
59
+ }, []);
47
60
  var extraActions = [];
61
+ var kudosProps = null;
48
62
  if (isKudosEnabled) {
49
63
  extraActions.push({
50
64
  id: GIVE_KUDOS_ACTION_ID,
51
- item: /*#__PURE__*/_react.default.createElement(_menu.ButtonItem, null, formatMessage(_messages.messages.giveKudos))
65
+ item: /*#__PURE__*/_react.default.createElement(_menu.ButtonItem, {
66
+ onClick: onKudosClick
67
+ }, formatMessage(_messages.messages.giveKudos))
52
68
  });
69
+ kudosProps = props;
53
70
  }
54
71
  if (otherActions) {
55
72
  extraActions.push.apply(extraActions, (0, _toConsumableArray2.default)(otherActions));
56
73
  }
57
- return /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
74
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
58
75
  xcss: styles.containerStyles
59
76
  }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
60
77
  space: "space.050"
@@ -67,5 +84,19 @@ var ButtonSection = exports.ButtonSection = function ButtonSection(_ref) {
67
84
  shouldFitContainer: true
68
85
  }, formatMessage(_messages.messages.viewProfile))), extraActions.length > 0 && /*#__PURE__*/_react.default.createElement(_moreActions.MoreActions, {
69
86
  actions: extraActions
87
+ }))), isKudosEnabled && kudosProps && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
88
+ fallback: null
89
+ }, /*#__PURE__*/_react.default.createElement(_giveKudos.GiveKudosLauncherLazy, {
90
+ isOpen: isKudosOpen,
91
+ onClose: function onClose() {
92
+ return setIsKudosOpen(false);
93
+ },
94
+ recipient: {
95
+ type: _giveKudos.KudosType.TEAM,
96
+ recipientId: (0, _getTeamFromAGG.extractIdFromAri)(kudosProps.teamId)
97
+ },
98
+ analyticsSource: kudosProps.analyticsSource,
99
+ teamCentralBaseUrl: kudosProps.teamCentralBaseUrl,
100
+ cloudId: kudosProps.cloudId
70
101
  })));
71
102
  };
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
45
45
  actionSubjectId: actionSubjectId,
46
46
  attributes: _objectSpread(_objectSpread({
47
47
  packageName: "@atlaskit/profilecard",
48
- packageVersion: "23.9.0"
48
+ packageVersion: "23.10.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: Math.round((0, _performance.getPageTime)())
51
51
  })
@@ -6,7 +6,7 @@ const ORG_ID_FROM_CLOUD_ID_QUERY = `query OrgIdFromCloudId($cloudId: ID!) {
6
6
  }`;
7
7
  const addHeaders = headers => {
8
8
  headers.append('atl-client-name', "@atlaskit/profilecard");
9
- headers.append('atl-client-version', "23.9.0");
9
+ headers.append('atl-client-version', "23.10.0");
10
10
  return headers;
11
11
  };
12
12
  export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
@@ -75,7 +75,7 @@ export const addHeaders = headers => {
75
75
  headers.append('X-ExperimentalApi', 'teams-beta');
76
76
  headers.append('X-ExperimentalApi', 'team-members-beta');
77
77
  headers.append('atl-client-name', "@atlaskit/profilecard");
78
- headers.append('atl-client-version', "23.9.0");
78
+ headers.append('atl-client-version', "23.10.0");
79
79
  return headers;
80
80
  };
81
81
  export async function getTeamFromAGG(url, teamId, siteId) {
@@ -1,4 +1,5 @@
1
1
  /* main.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import "./main.compiled.css";
3
4
  import { ax, ix } from "@compiled/react/runtime";
4
5
  import React, { useCallback, useMemo } from 'react';
@@ -56,8 +57,7 @@ export const TeamProfileCard = ({
56
57
  userId,
57
58
  isVerified,
58
59
  teamProfileUrl,
59
- isKudosEnabled,
60
- otherActions
60
+ ...props
61
61
  }) => {
62
62
  const {
63
63
  teamContainers,
@@ -137,11 +137,11 @@ export const TeamProfileCard = ({
137
137
  },
138
138
  filterContainerId: containerId,
139
139
  isDisplayedOnProfileCard: true
140
- })), isKudosEnabled || otherActions ? /*#__PURE__*/React.createElement(ButtonSection, {
140
+ })), props.isKudosEnabled || props.otherActions ? /*#__PURE__*/React.createElement(ButtonSection, _extends({
141
141
  teamProfileUrl: teamProfileUrl,
142
- isKudosEnabled: isKudosEnabled,
143
- otherActions: otherActions
144
- }) : teamProfileUrl && /*#__PURE__*/React.createElement(Stack, {
142
+ cloudId: cloudId,
143
+ teamId: teamId
144
+ }, props)) : teamProfileUrl && /*#__PURE__*/React.createElement(Stack, {
145
145
  xcss: styles.viewProfileContainerStyles
146
146
  }, /*#__PURE__*/React.createElement(Pressable, {
147
147
  onClick: onClick,
@@ -1,6 +1,6 @@
1
1
  import fetchMock from 'fetch-mock/cjs/client';
2
2
  export const mockProfileData = {
3
- teamId: '8ee37950-7de7-41ec-aee2-2c02c95949f4',
3
+ teamId: 'ari:cloud:identity::team/8ee37950-7de7-41ec-aee2-2c02c95949f4',
4
4
  displayName: 'THE SUPER TEAM',
5
5
  description: "Super team's super description - This is a very long line, adding more lines here to test the line limit of 3 that we enforce on the description of the team. In case the description very long, it should display an elipses at the end and hide that content that is overflowing",
6
6
  avatarImageUrl: 'https://test-prod-issue-create.atlassian.net/wiki/download/attachments/35061761/SUP-default?version=1&modificationDate=1739217199215&cacheVersion=1&api=v2',
@@ -1,12 +1,14 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  import "./index.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import React, { useCallback } from 'react';
4
+ import React, { Suspense, useCallback, useState } from 'react';
5
5
  import { useIntl } from 'react-intl-next';
6
6
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
7
  import { LinkButton } from '@atlaskit/button/new';
8
+ import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
8
9
  import { ButtonItem } from '@atlaskit/menu';
9
10
  import { Box, Inline, Stack } from '@atlaskit/primitives';
11
+ import { extractIdFromAri } from '../../../client/getTeamFromAGG';
10
12
  import { fireEvent } from '../../../util/analytics';
11
13
  import { messages } from './messages';
12
14
  import { MoreActions } from './more-actions';
@@ -18,7 +20,8 @@ const styles = {
18
20
  export const ButtonSection = ({
19
21
  teamProfileUrl,
20
22
  isKudosEnabled,
21
- otherActions
23
+ otherActions,
24
+ ...props
22
25
  }) => {
23
26
  const {
24
27
  createAnalyticsEvent
@@ -26,6 +29,7 @@ export const ButtonSection = ({
26
29
  const {
27
30
  formatMessage
28
31
  } = useIntl();
32
+ const [isKudosOpen, setIsKudosOpen] = useState(false);
29
33
  const onTeamProfileClick = useCallback(() => {
30
34
  if (createAnalyticsEvent) {
31
35
  fireEvent(createAnalyticsEvent, {
@@ -36,17 +40,24 @@ export const ButtonSection = ({
36
40
  });
37
41
  }
38
42
  }, [createAnalyticsEvent]);
43
+ const onKudosClick = useCallback(() => {
44
+ setIsKudosOpen(true);
45
+ }, []);
39
46
  const extraActions = [];
47
+ let kudosProps = null;
40
48
  if (isKudosEnabled) {
41
49
  extraActions.push({
42
50
  id: GIVE_KUDOS_ACTION_ID,
43
- item: /*#__PURE__*/React.createElement(ButtonItem, null, formatMessage(messages.giveKudos))
51
+ item: /*#__PURE__*/React.createElement(ButtonItem, {
52
+ onClick: onKudosClick
53
+ }, formatMessage(messages.giveKudos))
44
54
  });
55
+ kudosProps = props;
45
56
  }
46
57
  if (otherActions) {
47
58
  extraActions.push(...otherActions);
48
59
  }
49
- return /*#__PURE__*/React.createElement(Stack, {
60
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Stack, {
50
61
  xcss: styles.containerStyles
51
62
  }, /*#__PURE__*/React.createElement(Inline, {
52
63
  space: "space.050"
@@ -59,5 +70,17 @@ export const ButtonSection = ({
59
70
  shouldFitContainer: true
60
71
  }, formatMessage(messages.viewProfile))), extraActions.length > 0 && /*#__PURE__*/React.createElement(MoreActions, {
61
72
  actions: extraActions
73
+ }))), isKudosEnabled && kudosProps && /*#__PURE__*/React.createElement(Suspense, {
74
+ fallback: null
75
+ }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
76
+ isOpen: isKudosOpen,
77
+ onClose: () => setIsKudosOpen(false),
78
+ recipient: {
79
+ type: KudosType.TEAM,
80
+ recipientId: extractIdFromAri(kudosProps.teamId)
81
+ },
82
+ analyticsSource: kudosProps.analyticsSource,
83
+ teamCentralBaseUrl: kudosProps.teamCentralBaseUrl,
84
+ cloudId: kudosProps.cloudId
62
85
  })));
63
86
  };
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
32
32
  actionSubjectId,
33
33
  attributes: {
34
34
  packageName: "@atlaskit/profilecard",
35
- packageVersion: "23.9.0",
35
+ packageVersion: "23.10.0",
36
36
  ...attributes,
37
37
  firedAt: Math.round(getPageTime())
38
38
  }
@@ -4,7 +4,7 @@ import { AGGQuery } from './graphqlUtils';
4
4
  var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
5
5
  var addHeaders = function addHeaders(headers) {
6
6
  headers.append('atl-client-name', "@atlaskit/profilecard");
7
- headers.append('atl-client-version', "23.9.0");
7
+ headers.append('atl-client-version', "23.10.0");
8
8
  return headers;
9
9
  };
10
10
  export function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -57,7 +57,7 @@ export var addHeaders = function addHeaders(headers) {
57
57
  headers.append('X-ExperimentalApi', 'teams-beta');
58
58
  headers.append('X-ExperimentalApi', 'team-members-beta');
59
59
  headers.append('atl-client-name', "@atlaskit/profilecard");
60
- headers.append('atl-client-version', "23.9.0");
60
+ headers.append('atl-client-version', "23.10.0");
61
61
  return headers;
62
62
  };
63
63
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -1,4 +1,7 @@
1
1
  /* main.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["containerId", "teamId", "displayName", "description", "avatarImageUrl", "headerImageUrl", "memberAvatars", "memberCount", "cloudId", "userId", "isVerified", "teamProfileUrl"];
2
5
  import "./main.compiled.css";
3
6
  import { ax, ix } from "@compiled/react/runtime";
4
7
  import React, { useCallback, useMemo } from 'react';
@@ -58,8 +61,7 @@ export var TeamProfileCard = function TeamProfileCard(_ref3) {
58
61
  userId = _ref3.userId,
59
62
  isVerified = _ref3.isVerified,
60
63
  teamProfileUrl = _ref3.teamProfileUrl,
61
- isKudosEnabled = _ref3.isKudosEnabled,
62
- otherActions = _ref3.otherActions;
64
+ props = _objectWithoutProperties(_ref3, _excluded);
63
65
  var _useTeamContainers = useTeamContainers(teamId),
64
66
  teamContainers = _useTeamContainers.teamContainers,
65
67
  loading = _useTeamContainers.loading;
@@ -140,11 +142,11 @@ export var TeamProfileCard = function TeamProfileCard(_ref3) {
140
142
  },
141
143
  filterContainerId: containerId,
142
144
  isDisplayedOnProfileCard: true
143
- })), isKudosEnabled || otherActions ? /*#__PURE__*/React.createElement(ButtonSection, {
145
+ })), props.isKudosEnabled || props.otherActions ? /*#__PURE__*/React.createElement(ButtonSection, _extends({
144
146
  teamProfileUrl: teamProfileUrl,
145
- isKudosEnabled: isKudosEnabled,
146
- otherActions: otherActions
147
- }) : teamProfileUrl && /*#__PURE__*/React.createElement(Stack, {
147
+ cloudId: cloudId,
148
+ teamId: teamId
149
+ }, props)) : teamProfileUrl && /*#__PURE__*/React.createElement(Stack, {
148
150
  xcss: styles.viewProfileContainerStyles
149
151
  }, /*#__PURE__*/React.createElement(Pressable, {
150
152
  onClick: onClick,
@@ -1,6 +1,6 @@
1
1
  import fetchMock from 'fetch-mock/cjs/client';
2
2
  export var mockProfileData = {
3
- teamId: '8ee37950-7de7-41ec-aee2-2c02c95949f4',
3
+ teamId: 'ari:cloud:identity::team/8ee37950-7de7-41ec-aee2-2c02c95949f4',
4
4
  displayName: 'THE SUPER TEAM',
5
5
  description: "Super team's super description - This is a very long line, adding more lines here to test the line limit of 3 that we enforce on the description of the team. In case the description very long, it should display an elipses at the end and hide that content that is overflowing",
6
6
  avatarImageUrl: 'https://test-prod-issue-create.atlassian.net/wiki/download/attachments/35061761/SUP-default?version=1&modificationDate=1739217199215&cacheVersion=1&api=v2',
@@ -1,13 +1,18 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["teamProfileUrl", "isKudosEnabled", "otherActions"];
3
6
  import "./index.compiled.css";
4
7
  import { ax, ix } from "@compiled/react/runtime";
5
- import React, { useCallback } from 'react';
8
+ import React, { Suspense, useCallback, useState } from 'react';
6
9
  import { useIntl } from 'react-intl-next';
7
10
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
8
11
  import { LinkButton } from '@atlaskit/button/new';
12
+ import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
9
13
  import { ButtonItem } from '@atlaskit/menu';
10
14
  import { Box, Inline, Stack } from '@atlaskit/primitives';
15
+ import { extractIdFromAri } from '../../../client/getTeamFromAGG';
11
16
  import { fireEvent } from '../../../util/analytics';
12
17
  import { messages } from './messages';
13
18
  import { MoreActions } from './more-actions';
@@ -19,11 +24,16 @@ var styles = {
19
24
  export var ButtonSection = function ButtonSection(_ref) {
20
25
  var teamProfileUrl = _ref.teamProfileUrl,
21
26
  isKudosEnabled = _ref.isKudosEnabled,
22
- otherActions = _ref.otherActions;
27
+ otherActions = _ref.otherActions,
28
+ props = _objectWithoutProperties(_ref, _excluded);
23
29
  var _useAnalyticsEvents = useAnalyticsEvents(),
24
30
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
25
31
  var _useIntl = useIntl(),
26
32
  formatMessage = _useIntl.formatMessage;
33
+ var _useState = useState(false),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ isKudosOpen = _useState2[0],
36
+ setIsKudosOpen = _useState2[1];
27
37
  var onTeamProfileClick = useCallback(function () {
28
38
  if (createAnalyticsEvent) {
29
39
  fireEvent(createAnalyticsEvent, {
@@ -34,17 +44,24 @@ export var ButtonSection = function ButtonSection(_ref) {
34
44
  });
35
45
  }
36
46
  }, [createAnalyticsEvent]);
47
+ var onKudosClick = useCallback(function () {
48
+ setIsKudosOpen(true);
49
+ }, []);
37
50
  var extraActions = [];
51
+ var kudosProps = null;
38
52
  if (isKudosEnabled) {
39
53
  extraActions.push({
40
54
  id: GIVE_KUDOS_ACTION_ID,
41
- item: /*#__PURE__*/React.createElement(ButtonItem, null, formatMessage(messages.giveKudos))
55
+ item: /*#__PURE__*/React.createElement(ButtonItem, {
56
+ onClick: onKudosClick
57
+ }, formatMessage(messages.giveKudos))
42
58
  });
59
+ kudosProps = props;
43
60
  }
44
61
  if (otherActions) {
45
62
  extraActions.push.apply(extraActions, _toConsumableArray(otherActions));
46
63
  }
47
- return /*#__PURE__*/React.createElement(Stack, {
64
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Stack, {
48
65
  xcss: styles.containerStyles
49
66
  }, /*#__PURE__*/React.createElement(Inline, {
50
67
  space: "space.050"
@@ -57,5 +74,19 @@ export var ButtonSection = function ButtonSection(_ref) {
57
74
  shouldFitContainer: true
58
75
  }, formatMessage(messages.viewProfile))), extraActions.length > 0 && /*#__PURE__*/React.createElement(MoreActions, {
59
76
  actions: extraActions
77
+ }))), isKudosEnabled && kudosProps && /*#__PURE__*/React.createElement(Suspense, {
78
+ fallback: null
79
+ }, /*#__PURE__*/React.createElement(GiveKudosLauncherLazy, {
80
+ isOpen: isKudosOpen,
81
+ onClose: function onClose() {
82
+ return setIsKudosOpen(false);
83
+ },
84
+ recipient: {
85
+ type: KudosType.TEAM,
86
+ recipientId: extractIdFromAri(kudosProps.teamId)
87
+ },
88
+ analyticsSource: kudosProps.analyticsSource,
89
+ teamCentralBaseUrl: kudosProps.teamCentralBaseUrl,
90
+ cloudId: kudosProps.cloudId
60
91
  })));
61
92
  };
@@ -39,7 +39,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
39
39
  actionSubjectId: actionSubjectId,
40
40
  attributes: _objectSpread(_objectSpread({
41
41
  packageName: "@atlaskit/profilecard",
42
- packageVersion: "23.9.0"
42
+ packageVersion: "23.10.0"
43
43
  }, attributes), {}, {
44
44
  firedAt: Math.round(getPageTime())
45
45
  })
@@ -1,10 +1,7 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import React from 'react';
1
+ /// <reference types="react" />
6
2
  import { type AvatarProps } from '@atlaskit/avatar-group';
7
- interface TeamProfileCardProps {
3
+ import { ButtonSectionProps } from './team-actions';
4
+ type TeamProfileCardProps = {
8
5
  containerId: string;
9
6
  teamId: string;
10
7
  displayName: string;
@@ -17,11 +14,6 @@ interface TeamProfileCardProps {
17
14
  userId: string;
18
15
  isVerified?: boolean;
19
16
  teamProfileUrl?: string;
20
- isKudosEnabled?: boolean;
21
- otherActions?: {
22
- id: string;
23
- item: React.ReactNode;
24
- }[];
25
- }
26
- export declare const TeamProfileCard: ({ containerId, teamId, displayName, description, avatarImageUrl, headerImageUrl, memberAvatars, memberCount, cloudId, userId, isVerified, teamProfileUrl, isKudosEnabled, otherActions, }: TeamProfileCardProps) => JSX.Element;
17
+ } & ButtonSectionProps;
18
+ export declare const TeamProfileCard: ({ containerId, teamId, displayName, description, avatarImageUrl, headerImageUrl, memberAvatars, memberCount, cloudId, userId, isVerified, teamProfileUrl, ...props }: TeamProfileCardProps) => JSX.Element;
27
19
  export {};
@@ -1,9 +1,19 @@
1
1
  import React from 'react';
2
2
  import { ActionItem } from './more-actions';
3
- type ButtonSectionProps = {
3
+ type BaseButtonSectionProps = {
4
4
  teamProfileUrl?: string;
5
- isKudosEnabled?: boolean;
6
5
  otherActions?: ActionItem[];
6
+ cloudId: string;
7
+ teamId: string;
7
8
  };
8
- export declare const ButtonSection: ({ teamProfileUrl, isKudosEnabled, otherActions, }: ButtonSectionProps) => React.JSX.Element;
9
+ type KudosEnabledProps = BaseButtonSectionProps & {
10
+ isKudosEnabled: true;
11
+ teamCentralBaseUrl: string;
12
+ analyticsSource: string;
13
+ };
14
+ type KudosDisabledProps = BaseButtonSectionProps & {
15
+ isKudosEnabled?: false;
16
+ };
17
+ export type ButtonSectionProps = KudosEnabledProps | KudosDisabledProps;
18
+ export declare const ButtonSection: ({ teamProfileUrl, isKudosEnabled, otherActions, ...props }: ButtonSectionProps) => React.JSX.Element;
9
19
  export {};
@@ -1,10 +1,7 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import React from 'react';
1
+ /// <reference types="react" />
6
2
  import { type AvatarProps } from '@atlaskit/avatar-group';
7
- interface TeamProfileCardProps {
3
+ import { ButtonSectionProps } from './team-actions';
4
+ type TeamProfileCardProps = {
8
5
  containerId: string;
9
6
  teamId: string;
10
7
  displayName: string;
@@ -17,11 +14,6 @@ interface TeamProfileCardProps {
17
14
  userId: string;
18
15
  isVerified?: boolean;
19
16
  teamProfileUrl?: string;
20
- isKudosEnabled?: boolean;
21
- otherActions?: {
22
- id: string;
23
- item: React.ReactNode;
24
- }[];
25
- }
26
- export declare const TeamProfileCard: ({ containerId, teamId, displayName, description, avatarImageUrl, headerImageUrl, memberAvatars, memberCount, cloudId, userId, isVerified, teamProfileUrl, isKudosEnabled, otherActions, }: TeamProfileCardProps) => JSX.Element;
17
+ } & ButtonSectionProps;
18
+ export declare const TeamProfileCard: ({ containerId, teamId, displayName, description, avatarImageUrl, headerImageUrl, memberAvatars, memberCount, cloudId, userId, isVerified, teamProfileUrl, ...props }: TeamProfileCardProps) => JSX.Element;
27
19
  export {};
@@ -1,9 +1,19 @@
1
1
  import React from 'react';
2
2
  import { ActionItem } from './more-actions';
3
- type ButtonSectionProps = {
3
+ type BaseButtonSectionProps = {
4
4
  teamProfileUrl?: string;
5
- isKudosEnabled?: boolean;
6
5
  otherActions?: ActionItem[];
6
+ cloudId: string;
7
+ teamId: string;
7
8
  };
8
- export declare const ButtonSection: ({ teamProfileUrl, isKudosEnabled, otherActions, }: ButtonSectionProps) => React.JSX.Element;
9
+ type KudosEnabledProps = BaseButtonSectionProps & {
10
+ isKudosEnabled: true;
11
+ teamCentralBaseUrl: string;
12
+ analyticsSource: string;
13
+ };
14
+ type KudosDisabledProps = BaseButtonSectionProps & {
15
+ isKudosEnabled?: false;
16
+ };
17
+ export type ButtonSectionProps = KudosEnabledProps | KudosDisabledProps;
18
+ export declare const ButtonSection: ({ teamProfileUrl, isKudosEnabled, otherActions, ...props }: ButtonSectionProps) => React.JSX.Element;
9
19
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "23.9.0",
3
+ "version": "23.10.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -64,14 +64,14 @@
64
64
  "@atlaskit/icon": "^25.6.0",
65
65
  "@atlaskit/logo": "^16.0.0",
66
66
  "@atlaskit/lozenge": "^12.2.0",
67
- "@atlaskit/menu": "^3.2.0",
67
+ "@atlaskit/menu": "^4.0.0",
68
68
  "@atlaskit/modal-dialog": "^14.1.0",
69
69
  "@atlaskit/people-teams-ui-public": "^3.1.0",
70
70
  "@atlaskit/platform-feature-flags": "^1.1.0",
71
71
  "@atlaskit/popup": "^4.1.0",
72
72
  "@atlaskit/primitives": "^14.4.0",
73
73
  "@atlaskit/rovo-agent-components": "^2.7.0",
74
- "@atlaskit/rovo-triggers": "^2.10.0",
74
+ "@atlaskit/rovo-triggers": "^2.11.0",
75
75
  "@atlaskit/spinner": "^18.0.0",
76
76
  "@atlaskit/teams-avatar": "^2.3.0",
77
77
  "@atlaskit/teams-public": "^0.24.0",