@atlaskit/profilecard 19.24.0 → 19.25.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,20 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 19.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#134139](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134139)
8
+ [`6cb20b026ce66`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6cb20b026ce66) -
9
+ Set start count after making agent favourite
10
+ - [#135893](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/135893)
11
+ [`089338b763495`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/089338b763495) -
12
+ Show agents in team profile
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 19.24.0
4
19
 
5
20
  ### Minor Changes
@@ -57,7 +57,7 @@ var addHeaders = exports.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', "19.24.0");
60
+ headers.append('atl-client-version', "19.25.0");
61
61
  return headers;
62
62
  };
63
63
  function getTeamFromAGG(_x, _x2, _x3) {
@@ -64,11 +64,16 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
64
64
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
65
65
  isStarred = _useState2[0],
66
66
  setIsStarred = _useState2[1];
67
+ var _useState3 = (0, _react.useState)(),
68
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
69
+ starCount = _useState4[0],
70
+ setStarCount = _useState4[1];
67
71
  var _useIntl = (0, _reactIntlNext.useIntl)(),
68
72
  formatMessage = _useIntl.formatMessage;
69
73
  (0, _react.useEffect)(function () {
70
74
  setIsStarred(!!(agent !== null && agent !== void 0 && agent.favourite));
71
- }, [agent === null || agent === void 0 ? void 0 : agent.favourite]);
75
+ setStarCount(agent === null || agent === void 0 ? void 0 : agent.favourite_count);
76
+ }, [agent === null || agent === void 0 ? void 0 : agent.favourite, agent === null || agent === void 0 ? void 0 : agent.favourite_count]);
72
77
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
73
78
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
74
79
  var fireAnalytics = (0, _react.useCallback)(function (payload) {
@@ -81,25 +86,30 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
81
86
  while (1) switch (_context.prev = _context.next) {
82
87
  case 0:
83
88
  if (!(agent !== null && agent !== void 0 && agent.id)) {
84
- _context.next = 9;
89
+ _context.next = 10;
85
90
  break;
86
91
  }
87
92
  _context.prev = 1;
88
93
  _context.next = 4;
89
94
  return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
90
95
  case 4:
96
+ if (isStarred) {
97
+ setStarCount(starCount ? starCount - 1 : 0);
98
+ } else {
99
+ setStarCount((starCount || 0) + 1);
100
+ }
91
101
  setIsStarred(!isStarred);
92
- _context.next = 9;
102
+ _context.next = 10;
93
103
  break;
94
- case 7:
95
- _context.prev = 7;
104
+ case 8:
105
+ _context.prev = 8;
96
106
  _context.t0 = _context["catch"](1);
97
- case 9:
107
+ case 10:
98
108
  case "end":
99
109
  return _context.stop();
100
110
  }
101
- }, _callee, null, [[1, 7]]);
102
- })), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient]);
111
+ }, _callee, null, [[1, 8]]);
112
+ })), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
103
113
  var handleOnDelete = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
104
114
  return _regenerator.default.wrap(function _callee2$(_context2) {
105
115
  while (1) switch (_context2.prev = _context2.next) {
@@ -184,7 +194,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
184
194
  onCreatorLinkClick: function onCreatorLinkClick() {}
185
195
  }),
186
196
  starCountRender: /*#__PURE__*/_react.default.createElement(_rovoAgentComponents.AgentStarCount, {
187
- starCount: agent.favourite_count,
197
+ starCount: starCount,
188
198
  isLoading: false
189
199
  }),
190
200
  agentDescription: agent.description
@@ -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: "19.24.0"
48
+ packageVersion: "19.25.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: Math.round((0, _performance.getPageTime)())
51
51
  })
@@ -67,7 +67,7 @@ export const addHeaders = headers => {
67
67
  headers.append('X-ExperimentalApi', 'teams-beta');
68
68
  headers.append('X-ExperimentalApi', 'team-members-beta');
69
69
  headers.append('atl-client-name', "@atlaskit/profilecard");
70
- headers.append('atl-client-version', "19.24.0");
70
+ headers.append('atl-client-version', "19.25.0");
71
71
  return headers;
72
72
  };
73
73
  export async function getTeamFromAGG(url, teamId, siteId) {
@@ -49,12 +49,14 @@ const AgentProfileCard = ({
49
49
  cloudId: cloudId || ''
50
50
  });
51
51
  const [isStarred, setIsStarred] = useState(false);
52
+ const [starCount, setStarCount] = useState();
52
53
  const {
53
54
  formatMessage
54
55
  } = useIntl();
55
56
  useEffect(() => {
56
57
  setIsStarred(!!(agent !== null && agent !== void 0 && agent.favourite));
57
- }, [agent === null || agent === void 0 ? void 0 : agent.favourite]);
58
+ setStarCount(agent === null || agent === void 0 ? void 0 : agent.favourite_count);
59
+ }, [agent === null || agent === void 0 ? void 0 : agent.favourite, agent === null || agent === void 0 ? void 0 : agent.favourite_count]);
58
60
  const {
59
61
  createAnalyticsEvent
60
62
  } = useAnalyticsEvents();
@@ -67,10 +69,15 @@ const AgentProfileCard = ({
67
69
  if (agent !== null && agent !== void 0 && agent.id) {
68
70
  try {
69
71
  await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
72
+ if (isStarred) {
73
+ setStarCount(starCount ? starCount - 1 : 0);
74
+ } else {
75
+ setStarCount((starCount || 0) + 1);
76
+ }
70
77
  setIsStarred(!isStarred);
71
78
  } catch (error) {}
72
79
  }
73
- }, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient]);
80
+ }, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
74
81
  const handleOnDelete = useCallback(async () => {
75
82
  if (agent) {
76
83
  try {
@@ -140,7 +147,7 @@ const AgentProfileCard = ({
140
147
  onCreatorLinkClick: () => {}
141
148
  }),
142
149
  starCountRender: /*#__PURE__*/React.createElement(AgentStarCount, {
143
- starCount: agent.favourite_count,
150
+ starCount: starCount,
144
151
  isLoading: false
145
152
  }),
146
153
  agentDescription: agent.description
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
32
32
  actionSubjectId,
33
33
  attributes: {
34
34
  packageName: "@atlaskit/profilecard",
35
- packageVersion: "19.24.0",
35
+ packageVersion: "19.25.0",
36
36
  ...attributes,
37
37
  firedAt: Math.round(getPageTime())
38
38
  }
@@ -48,7 +48,7 @@ export var addHeaders = function addHeaders(headers) {
48
48
  headers.append('X-ExperimentalApi', 'teams-beta');
49
49
  headers.append('X-ExperimentalApi', 'team-members-beta');
50
50
  headers.append('atl-client-name', "@atlaskit/profilecard");
51
- headers.append('atl-client-version', "19.24.0");
51
+ headers.append('atl-client-version', "19.25.0");
52
52
  return headers;
53
53
  };
54
54
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -54,11 +54,16 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
54
54
  _useState2 = _slicedToArray(_useState, 2),
55
55
  isStarred = _useState2[0],
56
56
  setIsStarred = _useState2[1];
57
+ var _useState3 = useState(),
58
+ _useState4 = _slicedToArray(_useState3, 2),
59
+ starCount = _useState4[0],
60
+ setStarCount = _useState4[1];
57
61
  var _useIntl = useIntl(),
58
62
  formatMessage = _useIntl.formatMessage;
59
63
  useEffect(function () {
60
64
  setIsStarred(!!(agent !== null && agent !== void 0 && agent.favourite));
61
- }, [agent === null || agent === void 0 ? void 0 : agent.favourite]);
65
+ setStarCount(agent === null || agent === void 0 ? void 0 : agent.favourite_count);
66
+ }, [agent === null || agent === void 0 ? void 0 : agent.favourite, agent === null || agent === void 0 ? void 0 : agent.favourite_count]);
62
67
  var _useAnalyticsEvents = useAnalyticsEvents(),
63
68
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
64
69
  var fireAnalytics = useCallback(function (payload) {
@@ -71,25 +76,30 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
71
76
  while (1) switch (_context.prev = _context.next) {
72
77
  case 0:
73
78
  if (!(agent !== null && agent !== void 0 && agent.id)) {
74
- _context.next = 9;
79
+ _context.next = 10;
75
80
  break;
76
81
  }
77
82
  _context.prev = 1;
78
83
  _context.next = 4;
79
84
  return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
80
85
  case 4:
86
+ if (isStarred) {
87
+ setStarCount(starCount ? starCount - 1 : 0);
88
+ } else {
89
+ setStarCount((starCount || 0) + 1);
90
+ }
81
91
  setIsStarred(!isStarred);
82
- _context.next = 9;
92
+ _context.next = 10;
83
93
  break;
84
- case 7:
85
- _context.prev = 7;
94
+ case 8:
95
+ _context.prev = 8;
86
96
  _context.t0 = _context["catch"](1);
87
- case 9:
97
+ case 10:
88
98
  case "end":
89
99
  return _context.stop();
90
100
  }
91
- }, _callee, null, [[1, 7]]);
92
- })), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient]);
101
+ }, _callee, null, [[1, 8]]);
102
+ })), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
93
103
  var handleOnDelete = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
94
104
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
95
105
  while (1) switch (_context2.prev = _context2.next) {
@@ -174,7 +184,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
174
184
  onCreatorLinkClick: function onCreatorLinkClick() {}
175
185
  }),
176
186
  starCountRender: /*#__PURE__*/React.createElement(AgentStarCount, {
177
- starCount: agent.favourite_count,
187
+ starCount: starCount,
178
188
  isLoading: false
179
189
  }),
180
190
  agentDescription: agent.description
@@ -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: "19.24.0"
42
+ packageVersion: "19.25.0"
43
43
  }, attributes), {}, {
44
44
  firedAt: Math.round(getPageTime())
45
45
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.24.0",
3
+ "version": "19.25.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -23,10 +23,6 @@
23
23
  "atlaskit:src": "src/index.ts",
24
24
  "atlassian": {
25
25
  "team": "People and Teams Collective",
26
- "releaseModel": "continuous",
27
- "productPushConsumption": [
28
- "jira"
29
- ],
30
26
  "website": {
31
27
  "name": "Profilecard"
32
28
  }
@@ -67,9 +63,9 @@
67
63
  "@atlaskit/menu": "^2.12.0",
68
64
  "@atlaskit/modal-dialog": "^12.15.2",
69
65
  "@atlaskit/platform-feature-flags": "^0.3.0",
70
- "@atlaskit/popup": "^1.23.0",
71
- "@atlaskit/primitives": "^12.0.0",
72
- "@atlaskit/rovo-agent-components": "1.1.0",
66
+ "@atlaskit/popup": "^1.24.0",
67
+ "@atlaskit/primitives": "^12.1.0",
68
+ "@atlaskit/rovo-agent-components": "^1.1.0",
73
69
  "@atlaskit/spinner": "^16.3.0",
74
70
  "@atlaskit/theme": "^13.0.0",
75
71
  "@atlaskit/tokens": "^1.59.0",