@atlaskit/profilecard 19.24.0 → 19.25.1
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 +23 -0
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/AgentProfileCard.js +19 -9
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +2 -2
- package/dist/cjs/components/common/PopupTrigger.js +6 -8
- package/dist/cjs/components/common/ProfileCardTrigger.js +1 -1
- package/dist/cjs/util/analytics.js +2 -2
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/AgentProfileCard.js +10 -3
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +2 -2
- package/dist/es2019/components/common/PopupTrigger.js +10 -12
- package/dist/es2019/components/common/ProfileCardTrigger.js +1 -1
- package/dist/es2019/util/analytics.js +2 -2
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/AgentProfileCard.js +19 -9
- package/dist/esm/components/Agent/hooks/useAgentActions.js +2 -2
- package/dist/esm/components/common/PopupTrigger.js +6 -8
- package/dist/esm/components/common/ProfileCardTrigger.js +1 -1
- package/dist/esm/util/analytics.js +2 -2
- package/dist/types/components/common/PopupTrigger.d.ts +2 -3
- package/dist/types-ts4.5/components/common/PopupTrigger.d.ts +2 -3
- package/package.json +4 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 19.25.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#136007](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136007)
|
|
8
|
+
[`f41e92bc2025c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f41e92bc2025c) -
|
|
9
|
+
Fix pathway not set for full screen conversation starter
|
|
10
|
+
|
|
11
|
+
## 19.25.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#134139](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134139)
|
|
16
|
+
[`6cb20b026ce66`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6cb20b026ce66) -
|
|
17
|
+
Set start count after making agent favourite
|
|
18
|
+
- [#135893](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/135893)
|
|
19
|
+
[`089338b763495`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/089338b763495) -
|
|
20
|
+
Show agents in team profile
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 19.24.0
|
|
4
27
|
|
|
5
28
|
### 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.
|
|
60
|
+
headers.append('atl-client-version', "19.25.1");
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
102
|
+
_context.next = 10;
|
|
93
103
|
break;
|
|
94
|
-
case
|
|
95
|
-
_context.prev =
|
|
104
|
+
case 8:
|
|
105
|
+
_context.prev = 8;
|
|
96
106
|
_context.t0 = _context["catch"](1);
|
|
97
|
-
case
|
|
107
|
+
case 10:
|
|
98
108
|
case "end":
|
|
99
109
|
return _context.stop();
|
|
100
110
|
}
|
|
101
|
-
}, _callee, null, [[1,
|
|
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:
|
|
197
|
+
starCount: starCount,
|
|
188
198
|
isLoading: false
|
|
189
199
|
}),
|
|
190
200
|
agentDescription: agent.description
|
|
@@ -22,7 +22,6 @@ var createRovoParams = function createRovoParams(params) {
|
|
|
22
22
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
23
23
|
key = _ref2[0],
|
|
24
24
|
value = _ref2[1];
|
|
25
|
-
rovoParams["".concat(ROVO_PARAM_PREFIX, ".").concat(key)] = encodeURIComponent(value);
|
|
26
25
|
rovoParams["".concat(ROVO_PARAM_PREFIX).concat(firstCharUpper(key))] = encodeURIComponent(value);
|
|
27
26
|
});
|
|
28
27
|
return rovoParams;
|
|
@@ -61,7 +60,8 @@ var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlAction
|
|
|
61
60
|
}, createRovoParams({
|
|
62
61
|
cloudId: cloudId,
|
|
63
62
|
agentId: agentId,
|
|
64
|
-
prompt: prompt
|
|
63
|
+
prompt: prompt,
|
|
64
|
+
pathway: 'chat'
|
|
65
65
|
})));
|
|
66
66
|
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
67
67
|
};
|
|
@@ -9,13 +9,12 @@ exports.PopupTrigger = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _excluded = ["children", "trigger", "
|
|
12
|
+
var _excluded = ["children", "trigger", "showProfilecard", "hideProfilecard", "ariaLabelledBy"];
|
|
13
13
|
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); }
|
|
14
14
|
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 && Object.prototype.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; }
|
|
15
|
-
var
|
|
15
|
+
var PopupTriggerInner = function PopupTriggerInner(_ref, ref) {
|
|
16
16
|
var children = _ref.children,
|
|
17
17
|
trigger = _ref.trigger,
|
|
18
|
-
forwardRef = _ref.forwardRef,
|
|
19
18
|
showProfilecard = _ref.showProfilecard,
|
|
20
19
|
hideProfilecard = _ref.hideProfilecard,
|
|
21
20
|
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
@@ -30,9 +29,7 @@ var PopupTrigger = exports.PopupTrigger = function PopupTrigger(_ref) {
|
|
|
30
29
|
}
|
|
31
30
|
}, [showProfilecard]);
|
|
32
31
|
var onClick = (0, _react.useCallback)(function (event) {
|
|
33
|
-
//
|
|
34
|
-
// propagate out to parent containers. For example when clicking a mention
|
|
35
|
-
// lozenge in an inline-edit.
|
|
32
|
+
// Prevent the click event from propagating to parent containers.
|
|
36
33
|
event.stopPropagation();
|
|
37
34
|
showProfilecard();
|
|
38
35
|
}, [showProfilecard]);
|
|
@@ -48,7 +45,8 @@ var PopupTrigger = exports.PopupTrigger = function PopupTrigger(_ref) {
|
|
|
48
45
|
};
|
|
49
46
|
}, [hideProfilecard, onClick, onKeyPress, onMouseEnter, trigger]);
|
|
50
47
|
return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, props, containerListeners, {
|
|
51
|
-
ref:
|
|
48
|
+
ref: ref,
|
|
52
49
|
"aria-labelledby": ariaLabelledBy
|
|
53
50
|
}), children);
|
|
54
|
-
};
|
|
51
|
+
};
|
|
52
|
+
var PopupTrigger = exports.PopupTrigger = /*#__PURE__*/_react.default.forwardRef(PopupTriggerInner);
|
|
@@ -100,7 +100,7 @@ function ProfileCardTrigger(_ref) {
|
|
|
100
100
|
__ = triggerProps['aria-haspopup'],
|
|
101
101
|
restInnerProps = (0, _objectWithoutProperties2.default)(triggerProps, _excluded2);
|
|
102
102
|
return /*#__PURE__*/_react.default.createElement(_PopupTrigger.PopupTrigger, (0, _extends2.default)({}, disabledAriaAttributes ? restInnerProps : triggerProps, {
|
|
103
|
-
|
|
103
|
+
ref: triggerProps.ref,
|
|
104
104
|
hideProfilecard: hideProfilecard,
|
|
105
105
|
showProfilecard: showProfilecard,
|
|
106
106
|
children: children,
|
|
@@ -35,7 +35,7 @@ var fireEvent = exports.fireEvent = function fireEvent(createAnalyticsEvent, bod
|
|
|
35
35
|
|
|
36
36
|
var TEAM_SUBJECT = 'teamProfileCard';
|
|
37
37
|
var USER_SUBJECT = 'profilecard';
|
|
38
|
-
var AGENT_SUBJECT = '
|
|
38
|
+
var AGENT_SUBJECT = 'rovoAgentProfilecard';
|
|
39
39
|
var createEvent = function createEvent(eventType, action, actionSubject, actionSubjectId) {
|
|
40
40
|
var attributes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
41
41
|
return {
|
|
@@ -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.
|
|
48
|
+
packageVersion: "19.25.1"
|
|
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.
|
|
70
|
+
headers.append('atl-client-version', "19.25.1");
|
|
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
|
-
|
|
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:
|
|
150
|
+
starCount: starCount,
|
|
144
151
|
isLoading: false
|
|
145
152
|
}),
|
|
146
153
|
agentDescription: agent.description
|
|
@@ -6,7 +6,6 @@ const ROVO_PARAM_PREFIX = 'rovoChat';
|
|
|
6
6
|
const createRovoParams = params => {
|
|
7
7
|
const rovoParams = {};
|
|
8
8
|
Object.entries(params).forEach(([key, value]) => {
|
|
9
|
-
rovoParams[`${ROVO_PARAM_PREFIX}.${key}`] = encodeURIComponent(value);
|
|
10
9
|
rovoParams[`${ROVO_PARAM_PREFIX}${firstCharUpper(key)}`] = encodeURIComponent(value);
|
|
11
10
|
});
|
|
12
11
|
return rovoParams;
|
|
@@ -49,7 +48,8 @@ export const useAgentUrlActions = ({
|
|
|
49
48
|
...createRovoParams({
|
|
50
49
|
cloudId,
|
|
51
50
|
agentId,
|
|
52
|
-
prompt
|
|
51
|
+
prompt,
|
|
52
|
+
pathway: 'chat'
|
|
53
53
|
})
|
|
54
54
|
});
|
|
55
55
|
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useMemo } from 'react';
|
|
3
|
-
|
|
3
|
+
const PopupTriggerInner = ({
|
|
4
4
|
children,
|
|
5
5
|
trigger,
|
|
6
|
-
forwardRef,
|
|
7
6
|
showProfilecard,
|
|
8
7
|
hideProfilecard,
|
|
9
8
|
ariaLabelledBy,
|
|
10
9
|
...props
|
|
11
|
-
}) => {
|
|
10
|
+
}, ref) => {
|
|
12
11
|
const onMouseEnter = useCallback(() => {
|
|
13
12
|
showProfilecard();
|
|
14
13
|
}, [showProfilecard]);
|
|
@@ -19,23 +18,22 @@ export const PopupTrigger = ({
|
|
|
19
18
|
}
|
|
20
19
|
}, [showProfilecard]);
|
|
21
20
|
const onClick = useCallback(event => {
|
|
22
|
-
//
|
|
23
|
-
// propagate out to parent containers. For example when clicking a mention
|
|
24
|
-
// lozenge in an inline-edit.
|
|
21
|
+
// Prevent the click event from propagating to parent containers.
|
|
25
22
|
event.stopPropagation();
|
|
26
23
|
showProfilecard();
|
|
27
24
|
}, [showProfilecard]);
|
|
28
25
|
const containerListeners = useMemo(() => trigger === 'hover' ? {
|
|
29
|
-
onMouseEnter
|
|
26
|
+
onMouseEnter,
|
|
30
27
|
onMouseLeave: hideProfilecard,
|
|
31
28
|
onBlur: hideProfilecard,
|
|
32
|
-
onKeyPress
|
|
29
|
+
onKeyPress
|
|
33
30
|
} : {
|
|
34
|
-
onClick
|
|
35
|
-
onKeyPress
|
|
31
|
+
onClick,
|
|
32
|
+
onKeyPress
|
|
36
33
|
}, [hideProfilecard, onClick, onKeyPress, onMouseEnter, trigger]);
|
|
37
34
|
return /*#__PURE__*/React.createElement("span", _extends({}, props, containerListeners, {
|
|
38
|
-
ref:
|
|
35
|
+
ref: ref,
|
|
39
36
|
"aria-labelledby": ariaLabelledBy
|
|
40
37
|
}), children);
|
|
41
|
-
};
|
|
38
|
+
};
|
|
39
|
+
export const PopupTrigger = /*#__PURE__*/React.forwardRef(PopupTriggerInner);
|
|
@@ -77,7 +77,7 @@ function ProfileCardTrigger({
|
|
|
77
77
|
...restInnerProps
|
|
78
78
|
} = triggerProps;
|
|
79
79
|
return /*#__PURE__*/React.createElement(PopupTrigger, _extends({}, disabledAriaAttributes ? restInnerProps : triggerProps, {
|
|
80
|
-
|
|
80
|
+
ref: triggerProps.ref,
|
|
81
81
|
hideProfilecard: hideProfilecard,
|
|
82
82
|
showProfilecard: showProfilecard,
|
|
83
83
|
children: children,
|
|
@@ -24,7 +24,7 @@ export const fireEvent = (createAnalyticsEvent, body) => {
|
|
|
24
24
|
|
|
25
25
|
const TEAM_SUBJECT = 'teamProfileCard';
|
|
26
26
|
const USER_SUBJECT = 'profilecard';
|
|
27
|
-
const AGENT_SUBJECT = '
|
|
27
|
+
const AGENT_SUBJECT = 'rovoAgentProfilecard';
|
|
28
28
|
const createEvent = (eventType, action, actionSubject, actionSubjectId, attributes = {}) => ({
|
|
29
29
|
eventType,
|
|
30
30
|
action,
|
|
@@ -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.
|
|
35
|
+
packageVersion: "19.25.1",
|
|
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.
|
|
51
|
+
headers.append('atl-client-version', "19.25.1");
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
92
|
+
_context.next = 10;
|
|
83
93
|
break;
|
|
84
|
-
case
|
|
85
|
-
_context.prev =
|
|
94
|
+
case 8:
|
|
95
|
+
_context.prev = 8;
|
|
86
96
|
_context.t0 = _context["catch"](1);
|
|
87
|
-
case
|
|
97
|
+
case 10:
|
|
88
98
|
case "end":
|
|
89
99
|
return _context.stop();
|
|
90
100
|
}
|
|
91
|
-
}, _callee, null, [[1,
|
|
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:
|
|
187
|
+
starCount: starCount,
|
|
178
188
|
isLoading: false
|
|
179
189
|
}),
|
|
180
190
|
agentDescription: agent.description
|
|
@@ -15,7 +15,6 @@ var createRovoParams = function createRovoParams(params) {
|
|
|
15
15
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
16
16
|
key = _ref2[0],
|
|
17
17
|
value = _ref2[1];
|
|
18
|
-
rovoParams["".concat(ROVO_PARAM_PREFIX, ".").concat(key)] = encodeURIComponent(value);
|
|
19
18
|
rovoParams["".concat(ROVO_PARAM_PREFIX).concat(firstCharUpper(key))] = encodeURIComponent(value);
|
|
20
19
|
});
|
|
21
20
|
return rovoParams;
|
|
@@ -54,7 +53,8 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
|
|
|
54
53
|
}, createRovoParams({
|
|
55
54
|
cloudId: cloudId,
|
|
56
55
|
agentId: agentId,
|
|
57
|
-
prompt: prompt
|
|
56
|
+
prompt: prompt,
|
|
57
|
+
pathway: 'chat'
|
|
58
58
|
})));
|
|
59
59
|
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
60
60
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "trigger", "
|
|
3
|
+
var _excluded = ["children", "trigger", "showProfilecard", "hideProfilecard", "ariaLabelledBy"];
|
|
4
4
|
import React, { useCallback, useMemo } from 'react';
|
|
5
|
-
|
|
5
|
+
var PopupTriggerInner = function PopupTriggerInner(_ref, ref) {
|
|
6
6
|
var children = _ref.children,
|
|
7
7
|
trigger = _ref.trigger,
|
|
8
|
-
forwardRef = _ref.forwardRef,
|
|
9
8
|
showProfilecard = _ref.showProfilecard,
|
|
10
9
|
hideProfilecard = _ref.hideProfilecard,
|
|
11
10
|
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
@@ -20,9 +19,7 @@ export var PopupTrigger = function PopupTrigger(_ref) {
|
|
|
20
19
|
}
|
|
21
20
|
}, [showProfilecard]);
|
|
22
21
|
var onClick = useCallback(function (event) {
|
|
23
|
-
//
|
|
24
|
-
// propagate out to parent containers. For example when clicking a mention
|
|
25
|
-
// lozenge in an inline-edit.
|
|
22
|
+
// Prevent the click event from propagating to parent containers.
|
|
26
23
|
event.stopPropagation();
|
|
27
24
|
showProfilecard();
|
|
28
25
|
}, [showProfilecard]);
|
|
@@ -38,7 +35,8 @@ export var PopupTrigger = function PopupTrigger(_ref) {
|
|
|
38
35
|
};
|
|
39
36
|
}, [hideProfilecard, onClick, onKeyPress, onMouseEnter, trigger]);
|
|
40
37
|
return /*#__PURE__*/React.createElement("span", _extends({}, props, containerListeners, {
|
|
41
|
-
ref:
|
|
38
|
+
ref: ref,
|
|
42
39
|
"aria-labelledby": ariaLabelledBy
|
|
43
40
|
}), children);
|
|
44
|
-
};
|
|
41
|
+
};
|
|
42
|
+
export var PopupTrigger = /*#__PURE__*/React.forwardRef(PopupTriggerInner);
|
|
@@ -90,7 +90,7 @@ function ProfileCardTrigger(_ref) {
|
|
|
90
90
|
__ = triggerProps['aria-haspopup'],
|
|
91
91
|
restInnerProps = _objectWithoutProperties(triggerProps, _excluded2);
|
|
92
92
|
return /*#__PURE__*/React.createElement(PopupTrigger, _extends({}, disabledAriaAttributes ? restInnerProps : triggerProps, {
|
|
93
|
-
|
|
93
|
+
ref: triggerProps.ref,
|
|
94
94
|
hideProfilecard: hideProfilecard,
|
|
95
95
|
showProfilecard: showProfilecard,
|
|
96
96
|
children: children,
|
|
@@ -29,7 +29,7 @@ export var fireEvent = function fireEvent(createAnalyticsEvent, body) {
|
|
|
29
29
|
|
|
30
30
|
var TEAM_SUBJECT = 'teamProfileCard';
|
|
31
31
|
var USER_SUBJECT = 'profilecard';
|
|
32
|
-
var AGENT_SUBJECT = '
|
|
32
|
+
var AGENT_SUBJECT = 'rovoAgentProfilecard';
|
|
33
33
|
var createEvent = function createEvent(eventType, action, actionSubject, actionSubjectId) {
|
|
34
34
|
var attributes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
35
35
|
return {
|
|
@@ -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.
|
|
42
|
+
packageVersion: "19.25.1"
|
|
43
43
|
}, attributes), {}, {
|
|
44
44
|
firedAt: Math.round(getPageTime())
|
|
45
45
|
})
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type TriggerProps } from '@atlaskit/popup';
|
|
3
3
|
import { type ProfileCardTriggerProps } from './types';
|
|
4
|
-
export declare const PopupTrigger: <T>(
|
|
4
|
+
export declare const PopupTrigger: <T>(props: Partial<TriggerProps> & {
|
|
5
5
|
showProfilecard: () => void;
|
|
6
6
|
hideProfilecard: () => void;
|
|
7
|
-
|
|
8
|
-
} & Pick<ProfileCardTriggerProps<T>, "trigger" | "children" | "ariaLabelledBy">) => JSX.Element;
|
|
7
|
+
} & Pick<ProfileCardTriggerProps<T>, 'ariaLabelledBy' | 'trigger' | 'children'> & React.RefAttributes<HTMLSpanElement>) => JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type TriggerProps } from '@atlaskit/popup';
|
|
3
3
|
import { type ProfileCardTriggerProps } from './types';
|
|
4
|
-
export declare const PopupTrigger: <T>(
|
|
4
|
+
export declare const PopupTrigger: <T>(props: Partial<TriggerProps> & {
|
|
5
5
|
showProfilecard: () => void;
|
|
6
6
|
hideProfilecard: () => void;
|
|
7
|
-
|
|
8
|
-
} & Pick<ProfileCardTriggerProps<T>, "trigger" | "children" | "ariaLabelledBy">) => JSX.Element;
|
|
7
|
+
} & Pick<ProfileCardTriggerProps<T>, 'ariaLabelledBy' | 'trigger' | 'children'> & React.RefAttributes<HTMLSpanElement>) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.25.1",
|
|
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.
|
|
71
|
-
"@atlaskit/primitives": "^12.
|
|
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",
|