@atlaskit/profilecard 19.25.0 → 19.26.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 +16 -0
- package/dist/cjs/client/UserProfileCardClient.js +10 -34
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- 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/UserProfileCardClient.js +0 -17
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- 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/UserProfileCardClient.js +10 -34
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- 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/types.d.ts +0 -3
- package/dist/types-ts4.5/components/common/PopupTrigger.d.ts +2 -3
- package/dist/types-ts4.5/types.d.ts +0 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 19.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#134885](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134885)
|
|
8
|
+
[`17a1076221589`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/17a1076221589) -
|
|
9
|
+
PTC-9930 Removed the check if user is in site
|
|
10
|
+
|
|
11
|
+
## 19.25.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#136007](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136007)
|
|
16
|
+
[`f41e92bc2025c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f41e92bc2025c) -
|
|
17
|
+
Fix pathway not set for full screen conversation starter
|
|
18
|
+
|
|
3
19
|
## 19.25.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -78,19 +78,6 @@ var buildAggUserQuery = exports.buildAggUserQuery = function buildAggUserQuery(u
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
var getUserInSiteUserBase = function getUserInSiteUserBase(cloudId, userId) {
|
|
82
|
-
return fetch(new Request("/gateway/api/teams/site/".concat(cloudId, "/users/").concat(userId, "/exists"), {
|
|
83
|
-
method: 'GET',
|
|
84
|
-
credentials: 'include',
|
|
85
|
-
mode: 'cors',
|
|
86
|
-
headers: {
|
|
87
|
-
Accept: 'application/json',
|
|
88
|
-
'X-header-client-id': 'ptc-fe'
|
|
89
|
-
}
|
|
90
|
-
})).then(function (response) {
|
|
91
|
-
return response.json();
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
81
|
var queryAGGUser = /*#__PURE__*/function () {
|
|
95
82
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, userId) {
|
|
96
83
|
var query, _yield$AGGQuery, user;
|
|
@@ -128,30 +115,19 @@ var UserProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
|
|
|
128
115
|
key: "makeRequest",
|
|
129
116
|
value: function () {
|
|
130
117
|
var _makeRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(cloudId, userId) {
|
|
131
|
-
var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5, gatewayGraphqlUrl,
|
|
118
|
+
var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5, gatewayGraphqlUrl, userQueryPromise, user, timestring, localWeekdayIndex, query, response;
|
|
132
119
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
133
120
|
while (1) switch (_context2.prev = _context2.next) {
|
|
134
121
|
case 0:
|
|
135
122
|
if (!(0, _platformFeatureFlags.fg)('migrate_cloud_user_to_agg_user_query_profile_card')) {
|
|
136
|
-
_context2.next =
|
|
123
|
+
_context2.next = 11;
|
|
137
124
|
break;
|
|
138
125
|
}
|
|
139
126
|
gatewayGraphqlUrl = this.options.gatewayGraphqlUrl || '/gateway/api/graphql';
|
|
140
|
-
userCheckPromise = getUserInSiteUserBase(cloudId, userId);
|
|
141
127
|
userQueryPromise = queryAGGUser(gatewayGraphqlUrl, userId);
|
|
142
|
-
_context2.next =
|
|
143
|
-
return userCheckPromise;
|
|
144
|
-
case 6:
|
|
145
|
-
checkUserPresentInSiteRes = _context2.sent;
|
|
146
|
-
if (checkUserPresentInSiteRes.isPresent) {
|
|
147
|
-
_context2.next = 9;
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
throw new Error('Unable to fetch user: User does not exist in this site');
|
|
151
|
-
case 9:
|
|
152
|
-
_context2.next = 11;
|
|
128
|
+
_context2.next = 5;
|
|
153
129
|
return userQueryPromise;
|
|
154
|
-
case
|
|
130
|
+
case 5:
|
|
155
131
|
user = _context2.sent;
|
|
156
132
|
localWeekdayIndex = new Date().getDay().toString();
|
|
157
133
|
if (user.zoneinfo) {
|
|
@@ -175,20 +151,20 @@ var UserProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
|
|
|
175
151
|
companyName: (_user$extendedProfile5 = user.extendedProfile) === null || _user$extendedProfile5 === void 0 ? void 0 : _user$extendedProfile5.organization,
|
|
176
152
|
timestring: timestring
|
|
177
153
|
}));
|
|
178
|
-
case
|
|
154
|
+
case 11:
|
|
179
155
|
if (this.options.url) {
|
|
180
|
-
_context2.next =
|
|
156
|
+
_context2.next = 13;
|
|
181
157
|
break;
|
|
182
158
|
}
|
|
183
159
|
throw new Error('options.url is a required parameter');
|
|
184
|
-
case
|
|
160
|
+
case 13:
|
|
185
161
|
query = buildUserQuery(cloudId, userId);
|
|
186
|
-
_context2.next =
|
|
162
|
+
_context2.next = 16;
|
|
187
163
|
return (0, _graphqlUtils.directoryGraphqlQuery)(this.options.url, query);
|
|
188
|
-
case
|
|
164
|
+
case 16:
|
|
189
165
|
response = _context2.sent;
|
|
190
166
|
return _context2.abrupt("return", modifyResponse(response));
|
|
191
|
-
case
|
|
167
|
+
case 18:
|
|
192
168
|
case "end":
|
|
193
169
|
return _context2.stop();
|
|
194
170
|
}
|
|
@@ -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.26.0");
|
|
61
61
|
return headers;
|
|
62
62
|
};
|
|
63
63
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -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.26.0"
|
|
49
49
|
}, attributes), {}, {
|
|
50
50
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
51
51
|
})
|
|
@@ -104,17 +104,6 @@ export const buildAggUserQuery = userId => ({
|
|
|
104
104
|
userId
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
|
-
const getUserInSiteUserBase = (cloudId, userId) => {
|
|
108
|
-
return fetch(new Request(`/gateway/api/teams/site/${cloudId}/users/${userId}/exists`, {
|
|
109
|
-
method: 'GET',
|
|
110
|
-
credentials: 'include',
|
|
111
|
-
mode: 'cors',
|
|
112
|
-
headers: {
|
|
113
|
-
Accept: 'application/json',
|
|
114
|
-
'X-header-client-id': 'ptc-fe'
|
|
115
|
-
}
|
|
116
|
-
})).then(response => response.json());
|
|
117
|
-
};
|
|
118
107
|
const queryAGGUser = async (url, userId) => {
|
|
119
108
|
const query = buildAggUserQuery(userId);
|
|
120
109
|
const {
|
|
@@ -131,13 +120,7 @@ export default class UserProfileCardClient extends CachingClient {
|
|
|
131
120
|
if (fg('migrate_cloud_user_to_agg_user_query_profile_card')) {
|
|
132
121
|
var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5;
|
|
133
122
|
const gatewayGraphqlUrl = this.options.gatewayGraphqlUrl || '/gateway/api/graphql';
|
|
134
|
-
const userCheckPromise = getUserInSiteUserBase(cloudId, userId);
|
|
135
123
|
const userQueryPromise = queryAGGUser(gatewayGraphqlUrl, userId);
|
|
136
|
-
const checkUserPresentInSiteRes = await userCheckPromise;
|
|
137
|
-
if (!checkUserPresentInSiteRes.isPresent) {
|
|
138
|
-
// Use this error message to not trouble SLO, check out getErrorAttributes for reference
|
|
139
|
-
throw new Error('Unable to fetch user: User does not exist in this site');
|
|
140
|
-
}
|
|
141
124
|
const user = await userQueryPromise;
|
|
142
125
|
let timestring;
|
|
143
126
|
const localWeekdayIndex = new Date().getDay().toString();
|
|
@@ -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.26.0");
|
|
71
71
|
return headers;
|
|
72
72
|
};
|
|
73
73
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
@@ -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.26.0",
|
|
36
36
|
...attributes,
|
|
37
37
|
firedAt: Math.round(getPageTime())
|
|
38
38
|
}
|
|
@@ -72,19 +72,6 @@ export var buildAggUserQuery = function buildAggUserQuery(userId) {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
-
var getUserInSiteUserBase = function getUserInSiteUserBase(cloudId, userId) {
|
|
76
|
-
return fetch(new Request("/gateway/api/teams/site/".concat(cloudId, "/users/").concat(userId, "/exists"), {
|
|
77
|
-
method: 'GET',
|
|
78
|
-
credentials: 'include',
|
|
79
|
-
mode: 'cors',
|
|
80
|
-
headers: {
|
|
81
|
-
Accept: 'application/json',
|
|
82
|
-
'X-header-client-id': 'ptc-fe'
|
|
83
|
-
}
|
|
84
|
-
})).then(function (response) {
|
|
85
|
-
return response.json();
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
75
|
var queryAGGUser = /*#__PURE__*/function () {
|
|
89
76
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, userId) {
|
|
90
77
|
var query, _yield$AGGQuery, user;
|
|
@@ -122,30 +109,19 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
122
109
|
key: "makeRequest",
|
|
123
110
|
value: function () {
|
|
124
111
|
var _makeRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cloudId, userId) {
|
|
125
|
-
var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5, gatewayGraphqlUrl,
|
|
112
|
+
var _user$extendedProfile, _user$extendedProfile2, _user$extendedProfile3, _user$extendedProfile4, _user$extendedProfile5, gatewayGraphqlUrl, userQueryPromise, user, timestring, localWeekdayIndex, query, response;
|
|
126
113
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
127
114
|
while (1) switch (_context2.prev = _context2.next) {
|
|
128
115
|
case 0:
|
|
129
116
|
if (!fg('migrate_cloud_user_to_agg_user_query_profile_card')) {
|
|
130
|
-
_context2.next =
|
|
117
|
+
_context2.next = 11;
|
|
131
118
|
break;
|
|
132
119
|
}
|
|
133
120
|
gatewayGraphqlUrl = this.options.gatewayGraphqlUrl || '/gateway/api/graphql';
|
|
134
|
-
userCheckPromise = getUserInSiteUserBase(cloudId, userId);
|
|
135
121
|
userQueryPromise = queryAGGUser(gatewayGraphqlUrl, userId);
|
|
136
|
-
_context2.next =
|
|
137
|
-
return userCheckPromise;
|
|
138
|
-
case 6:
|
|
139
|
-
checkUserPresentInSiteRes = _context2.sent;
|
|
140
|
-
if (checkUserPresentInSiteRes.isPresent) {
|
|
141
|
-
_context2.next = 9;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
throw new Error('Unable to fetch user: User does not exist in this site');
|
|
145
|
-
case 9:
|
|
146
|
-
_context2.next = 11;
|
|
122
|
+
_context2.next = 5;
|
|
147
123
|
return userQueryPromise;
|
|
148
|
-
case
|
|
124
|
+
case 5:
|
|
149
125
|
user = _context2.sent;
|
|
150
126
|
localWeekdayIndex = new Date().getDay().toString();
|
|
151
127
|
if (user.zoneinfo) {
|
|
@@ -169,20 +145,20 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
169
145
|
companyName: (_user$extendedProfile5 = user.extendedProfile) === null || _user$extendedProfile5 === void 0 ? void 0 : _user$extendedProfile5.organization,
|
|
170
146
|
timestring: timestring
|
|
171
147
|
}));
|
|
172
|
-
case
|
|
148
|
+
case 11:
|
|
173
149
|
if (this.options.url) {
|
|
174
|
-
_context2.next =
|
|
150
|
+
_context2.next = 13;
|
|
175
151
|
break;
|
|
176
152
|
}
|
|
177
153
|
throw new Error('options.url is a required parameter');
|
|
178
|
-
case
|
|
154
|
+
case 13:
|
|
179
155
|
query = buildUserQuery(cloudId, userId);
|
|
180
|
-
_context2.next =
|
|
156
|
+
_context2.next = 16;
|
|
181
157
|
return directoryGraphqlQuery(this.options.url, query);
|
|
182
|
-
case
|
|
158
|
+
case 16:
|
|
183
159
|
response = _context2.sent;
|
|
184
160
|
return _context2.abrupt("return", modifyResponse(response));
|
|
185
|
-
case
|
|
161
|
+
case 18:
|
|
186
162
|
case "end":
|
|
187
163
|
return _context2.stop();
|
|
188
164
|
}
|
|
@@ -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.26.0");
|
|
52
52
|
return headers;
|
|
53
53
|
};
|
|
54
54
|
export function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -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.26.0"
|
|
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;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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;
|