@atlaskit/profilecard 24.18.1 → 24.20.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 +19 -0
- package/__tests__/vr-tests/__snapshots__/agent-profilecard/agent-profile-card-example--default.png +0 -0
- package/dist/cjs/client/RovoAgentCardClient.js +201 -33
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/Actions.js +3 -3
- package/dist/cjs/components/Agent/ActionsCompiled.js +3 -3
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +50 -34
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +50 -33
- package/dist/cjs/components/common/ProfileCardTrigger.js +1 -1
- package/dist/cjs/mocks/agent-data.js +7 -1
- package/dist/cjs/mocks/simple-mock-clients.js +8 -3
- package/dist/cjs/util/analytics.js +2 -2
- package/dist/es2019/client/RovoAgentCardClient.js +135 -9
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/Actions.js +3 -3
- package/dist/es2019/components/Agent/ActionsCompiled.js +3 -3
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +21 -3
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +21 -3
- package/dist/es2019/components/common/ProfileCardTrigger.js +1 -1
- package/dist/es2019/mocks/agent-data.js +6 -0
- package/dist/es2019/mocks/simple-mock-clients.js +6 -3
- package/dist/es2019/util/analytics.js +2 -2
- package/dist/esm/client/RovoAgentCardClient.js +202 -34
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/Actions.js +3 -3
- package/dist/esm/components/Agent/ActionsCompiled.js +3 -3
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +50 -34
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +50 -33
- package/dist/esm/components/common/ProfileCardTrigger.js +1 -1
- package/dist/esm/mocks/agent-data.js +6 -0
- package/dist/esm/mocks/simple-mock-clients.js +6 -3
- package/dist/esm/util/analytics.js +2 -2
- package/dist/types/client/ProfileCardClient.d.ts +1 -1
- package/dist/types/client/RovoAgentCardClient.d.ts +14 -4
- package/dist/types/mocks/agent-data.d.ts +2 -1
- package/dist/types/mocks/simple-mock-clients.d.ts +2 -2
- package/dist/types/types.d.ts +11 -1
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +1 -1
- package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +14 -4
- package/dist/types-ts4.5/mocks/agent-data.d.ts +2 -1
- package/dist/types-ts4.5/mocks/simple-mock-clients.d.ts +2 -2
- package/dist/types-ts4.5/types.d.ts +11 -1
- package/package.json +12 -9
|
@@ -43,43 +43,54 @@ var AgentProfileCardTrigger = exports.AgentProfileCardTrigger = /*#__PURE__*/(0,
|
|
|
43
43
|
}
|
|
44
44
|
}, [createAnalyticsEvent]);
|
|
45
45
|
var getCreator = /*#__PURE__*/function () {
|
|
46
|
-
var
|
|
47
|
-
var _userId, _navigateToTeamsApp, profileHref, creatorInfo;
|
|
46
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref2) {
|
|
47
|
+
var creator_type, creator, authoringTeam, _userId, _authoringTeam$displa, _authoringTeam$profil, _navigateToTeamsApp, profileHref, creatorInfo;
|
|
48
48
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
49
49
|
while (1) switch (_context.prev = _context.next) {
|
|
50
50
|
case 0:
|
|
51
|
+
creator_type = _ref2.creator_type, creator = _ref2.creator, authoringTeam = _ref2.authoringTeam;
|
|
51
52
|
if (creator) {
|
|
52
|
-
_context.next =
|
|
53
|
+
_context.next = 3;
|
|
53
54
|
break;
|
|
54
55
|
}
|
|
55
56
|
return _context.abrupt("return", undefined);
|
|
56
|
-
case
|
|
57
|
+
case 3:
|
|
57
58
|
_context.t0 = creator_type;
|
|
58
|
-
_context.next = _context.t0 === 'SYSTEM' ?
|
|
59
|
+
_context.next = _context.t0 === 'SYSTEM' ? 6 : _context.t0 === 'THIRD_PARTY' ? 7 : _context.t0 === 'FORGE' ? 8 : _context.t0 === 'CUSTOMER' ? 9 : 25;
|
|
59
60
|
break;
|
|
60
|
-
case
|
|
61
|
+
case 6:
|
|
61
62
|
return _context.abrupt("return", {
|
|
62
63
|
type: 'SYSTEM'
|
|
63
64
|
});
|
|
64
|
-
case
|
|
65
|
+
case 7:
|
|
65
66
|
return _context.abrupt("return", {
|
|
66
67
|
type: 'THIRD_PARTY',
|
|
67
68
|
name: creator !== null && creator !== void 0 ? creator : ''
|
|
68
69
|
});
|
|
69
|
-
case
|
|
70
|
+
case 8:
|
|
70
71
|
return _context.abrupt("return", {
|
|
71
72
|
type: 'THIRD_PARTY',
|
|
72
73
|
name: creator !== null && creator !== void 0 ? creator : ''
|
|
73
74
|
});
|
|
74
|
-
case
|
|
75
|
+
case 9:
|
|
75
76
|
_userId = (0, _rovoAgentUtils.getAAIDFromARI)(creator) || '';
|
|
76
|
-
_context.prev =
|
|
77
|
+
_context.prev = 10;
|
|
77
78
|
if (!(!_userId || !cloudId)) {
|
|
78
|
-
_context.next =
|
|
79
|
+
_context.next = 13;
|
|
79
80
|
break;
|
|
80
81
|
}
|
|
81
82
|
return _context.abrupt("return", undefined);
|
|
82
|
-
case
|
|
83
|
+
case 13:
|
|
84
|
+
if (!(authoringTeam && (0, _platformFeatureFlags.fg)('agent_studio_permissions_settings_m3_profiles'))) {
|
|
85
|
+
_context.next = 15;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return _context.abrupt("return", {
|
|
89
|
+
type: 'CUSTOMER',
|
|
90
|
+
name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
|
|
91
|
+
profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
|
|
92
|
+
});
|
|
93
|
+
case 15:
|
|
83
94
|
_navigateToTeamsApp = (0, _navigation.navigateToTeamsApp)({
|
|
84
95
|
type: 'USER',
|
|
85
96
|
payload: {
|
|
@@ -87,9 +98,9 @@ var AgentProfileCardTrigger = exports.AgentProfileCardTrigger = /*#__PURE__*/(0,
|
|
|
87
98
|
},
|
|
88
99
|
cloudId: cloudId
|
|
89
100
|
}), profileHref = _navigateToTeamsApp.href;
|
|
90
|
-
_context.next =
|
|
101
|
+
_context.next = 18;
|
|
91
102
|
return props.resourceClient.getProfile(cloudId, _userId, fireAnalytics, fireEventNext);
|
|
92
|
-
case
|
|
103
|
+
case 18:
|
|
93
104
|
creatorInfo = _context.sent;
|
|
94
105
|
return _context.abrupt("return", {
|
|
95
106
|
type: 'CUSTOMER',
|
|
@@ -97,25 +108,26 @@ var AgentProfileCardTrigger = exports.AgentProfileCardTrigger = /*#__PURE__*/(0,
|
|
|
97
108
|
profileLink: (0, _platformFeatureFlags.fg)('platform-adopt-teams-nav-config') ? profileHref : "/people/".concat(_userId),
|
|
98
109
|
id: _userId
|
|
99
110
|
});
|
|
100
|
-
case 19:
|
|
101
|
-
_context.prev = 19;
|
|
102
|
-
_context.t1 = _context["catch"](9);
|
|
103
|
-
return _context.abrupt("return", undefined);
|
|
104
111
|
case 22:
|
|
112
|
+
_context.prev = 22;
|
|
113
|
+
_context.t1 = _context["catch"](10);
|
|
114
|
+
return _context.abrupt("return", undefined);
|
|
115
|
+
case 25:
|
|
105
116
|
return _context.abrupt("return", undefined);
|
|
106
|
-
case
|
|
117
|
+
case 26:
|
|
107
118
|
case "end":
|
|
108
119
|
return _context.stop();
|
|
109
120
|
}
|
|
110
|
-
}, _callee, null, [[
|
|
121
|
+
}, _callee, null, [[10, 22]]);
|
|
111
122
|
}));
|
|
112
|
-
return function getCreator(_x
|
|
113
|
-
return
|
|
123
|
+
return function getCreator(_x) {
|
|
124
|
+
return _ref3.apply(this, arguments);
|
|
114
125
|
};
|
|
115
126
|
}();
|
|
116
127
|
var fetchAgentProfile = /*#__PURE__*/function () {
|
|
117
|
-
var
|
|
118
|
-
var
|
|
128
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
129
|
+
var _agentProfileResult$a, _agentProfileResult$a2;
|
|
130
|
+
var agentProfileResult, agentInfo, agentCreatorInfo;
|
|
119
131
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
120
132
|
while (1) switch (_context2.prev = _context2.next) {
|
|
121
133
|
case 0:
|
|
@@ -125,27 +137,32 @@ var AgentProfileCardTrigger = exports.AgentProfileCardTrigger = /*#__PURE__*/(0,
|
|
|
125
137
|
value: userId
|
|
126
138
|
}, fireAnalytics, fireEventNext);
|
|
127
139
|
case 2:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
140
|
+
agentProfileResult = _context2.sent;
|
|
141
|
+
agentInfo = agentProfileResult.restData;
|
|
142
|
+
_context2.next = 6;
|
|
143
|
+
return getCreator({
|
|
144
|
+
creator_type: agentInfo.creator_type,
|
|
145
|
+
creator: agentInfo.creator || undefined,
|
|
146
|
+
authoringTeam: (_agentProfileResult$a = (_agentProfileResult$a2 = agentProfileResult.aggData) === null || _agentProfileResult$a2 === void 0 ? void 0 : _agentProfileResult$a2.authoringTeam) !== null && _agentProfileResult$a !== void 0 ? _agentProfileResult$a : undefined
|
|
147
|
+
});
|
|
148
|
+
case 6:
|
|
132
149
|
agentCreatorInfo = _context2.sent;
|
|
133
150
|
return _context2.abrupt("return", _objectSpread(_objectSpread({}, agentInfo), {}, {
|
|
134
151
|
creatorInfo: agentCreatorInfo
|
|
135
152
|
}));
|
|
136
|
-
case
|
|
153
|
+
case 8:
|
|
137
154
|
case "end":
|
|
138
155
|
return _context2.stop();
|
|
139
156
|
}
|
|
140
157
|
}, _callee2);
|
|
141
158
|
}));
|
|
142
159
|
return function fetchAgentProfile() {
|
|
143
|
-
return
|
|
160
|
+
return _ref4.apply(this, arguments);
|
|
144
161
|
};
|
|
145
162
|
}();
|
|
146
|
-
var renderProfileCard = function renderProfileCard(
|
|
147
|
-
var profileData =
|
|
148
|
-
error =
|
|
163
|
+
var renderProfileCard = function renderProfileCard(_ref5) {
|
|
164
|
+
var profileData = _ref5.profileData,
|
|
165
|
+
error = _ref5.error;
|
|
149
166
|
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
150
167
|
fallback: null
|
|
151
168
|
}, /*#__PURE__*/_react.default.createElement(_lazyAgentProfileCard.AgentProfileCardLazy, {
|
|
@@ -133,7 +133,7 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
133
133
|
content: function content() {
|
|
134
134
|
return (
|
|
135
135
|
/*#__PURE__*/
|
|
136
|
-
// eslint-disable-next-line
|
|
136
|
+
// eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
|
|
137
137
|
_react.default.createElement("div", {
|
|
138
138
|
onMouseEnter: onMouseEnter
|
|
139
139
|
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.agentAggData = void 0;
|
|
7
7
|
var agentData = {
|
|
8
8
|
id: 'agentId',
|
|
9
9
|
name: 'Profile card agent',
|
|
@@ -17,4 +17,10 @@ var agentData = {
|
|
|
17
17
|
user_defined_conversation_starters: [],
|
|
18
18
|
deactivated: false
|
|
19
19
|
};
|
|
20
|
+
var agentAggData = exports.agentAggData = {
|
|
21
|
+
authoringTeam: {
|
|
22
|
+
displayName: 'Profile card agent',
|
|
23
|
+
profileUrl: 'https://example.com/profile'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
20
26
|
var _default = exports.default = agentData;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -15,10 +16,11 @@ var _ProfileCardClient = _interopRequireDefault(require("../client/ProfileCardCl
|
|
|
15
16
|
var _RovoAgentCardClient2 = _interopRequireDefault(require("../client/RovoAgentCardClient"));
|
|
16
17
|
var _TeamProfileCardClient = _interopRequireDefault(require("../client/TeamProfileCardClient"));
|
|
17
18
|
var _UserProfileCardClient = _interopRequireDefault(require("../client/UserProfileCardClient"));
|
|
18
|
-
var _agentData =
|
|
19
|
+
var _agentData = _interopRequireWildcard(require("./agent-data"));
|
|
19
20
|
var _profileData = _interopRequireDefault(require("./profile-data"));
|
|
20
21
|
var _teamData = _interopRequireDefault(require("./team-data"));
|
|
21
22
|
var _util = require("./util");
|
|
23
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
22
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
26
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
@@ -68,8 +70,11 @@ var SimpleMockAgentClient = /*#__PURE__*/function (_RovoAgentCardClient) {
|
|
|
68
70
|
(0, _inherits2.default)(SimpleMockAgentClient, _RovoAgentCardClient);
|
|
69
71
|
return (0, _createClass2.default)(SimpleMockAgentClient, [{
|
|
70
72
|
key: "makeRequest",
|
|
71
|
-
value: function makeRequest(id
|
|
72
|
-
return Promise.resolve(
|
|
73
|
+
value: function makeRequest(id) {
|
|
74
|
+
return Promise.resolve({
|
|
75
|
+
restData: _agentData.default,
|
|
76
|
+
aggData: _agentData.agentAggData
|
|
77
|
+
});
|
|
73
78
|
}
|
|
74
79
|
}]);
|
|
75
80
|
}(_RovoAgentCardClient2.default);
|
|
@@ -13,7 +13,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
13
13
|
var ANALYTICS_CHANNEL = 'peopleTeams';
|
|
14
14
|
var PACKAGE_META_DATA = exports.PACKAGE_META_DATA = {
|
|
15
15
|
packageName: "@atlaskit/profilecard",
|
|
16
|
-
packageVersion: "24.
|
|
16
|
+
packageVersion: "24.19.0"
|
|
17
17
|
};
|
|
18
18
|
var runItLater = function runItLater(cb) {
|
|
19
19
|
var requestIdleCallback = window.requestIdleCallback;
|
|
@@ -58,7 +58,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
58
58
|
actionSubjectId: actionSubjectId,
|
|
59
59
|
attributes: _objectSpread(_objectSpread({
|
|
60
60
|
packageName: "@atlaskit/profilecard",
|
|
61
|
-
packageVersion: "24.
|
|
61
|
+
packageVersion: "24.19.0"
|
|
62
62
|
}, attributes), {}, {
|
|
63
63
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
64
64
|
})
|
|
@@ -3,6 +3,64 @@ import { agentRequestAnalytics, PACKAGE_META_DATA } from '../util/analytics';
|
|
|
3
3
|
import { getPageTime } from '../util/performance';
|
|
4
4
|
import CachingClient from './CachingClient';
|
|
5
5
|
import { DEPRECATED_getErrorAttributes, getErrorAttributes } from './errorUtils';
|
|
6
|
+
import { AGGQuery } from './graphqlUtils';
|
|
7
|
+
const buildActivationIdQuery = (cloudId, product) => ({
|
|
8
|
+
query: `
|
|
9
|
+
query RovoAgentProfileCard_ActivationQuery($cloudId: ID!, $product: String!) {
|
|
10
|
+
tenantContexts(cloudIds: [$cloudId]) {
|
|
11
|
+
activationIdByProduct(product: $product) {
|
|
12
|
+
active
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`,
|
|
17
|
+
variables: {
|
|
18
|
+
cloudId,
|
|
19
|
+
product
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const buildRovoAgentQueryByAri = agentAri => ({
|
|
23
|
+
query: `
|
|
24
|
+
query RovoAgentProfileCard_AgentQueryByAri($agentAri: ID!) {
|
|
25
|
+
agentStudio_agentById(id: $agentAri) @optIn(to: "AgentStudio") {
|
|
26
|
+
__typename
|
|
27
|
+
... on AgentStudioAssistant {
|
|
28
|
+
authoringTeam {
|
|
29
|
+
displayName
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
... on QueryError {
|
|
33
|
+
message
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
variables: {
|
|
39
|
+
agentAri
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const buildRovoAgentQueryByAccountId = (identityAccountId, cloudId) => ({
|
|
43
|
+
query: `
|
|
44
|
+
query RovoAgentProfileCard_AgentQueryByAccountId($identityAccountId: ID!, $cloudId: ID!) {
|
|
45
|
+
agentStudio_agentByIdentityAccountId(identityAccountId: $identityAccountId, cloudId: $cloudId) @optIn(to: "AgentStudio") {
|
|
46
|
+
__typename
|
|
47
|
+
... on AgentStudioAssistant {
|
|
48
|
+
authoringTeam {
|
|
49
|
+
displayName
|
|
50
|
+
profileUrl
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
... on QueryError {
|
|
54
|
+
message
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`,
|
|
59
|
+
variables: {
|
|
60
|
+
identityAccountId,
|
|
61
|
+
cloudId
|
|
62
|
+
}
|
|
63
|
+
});
|
|
6
64
|
const createHeaders = (product, cloudId, isBodyJson) => {
|
|
7
65
|
const headers = new Headers({
|
|
8
66
|
'X-Product': product,
|
|
@@ -22,24 +80,92 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
22
80
|
basePath() {
|
|
23
81
|
return fg('pt-deprecate-assistance-service') ? '/gateway/api/assist/rovo/v1/agents' : '/gateway/api/assist/agents/v1';
|
|
24
82
|
}
|
|
25
|
-
|
|
83
|
+
async getActivationId(cloudId, product) {
|
|
84
|
+
var _response$tenantConte, _response$tenantConte2, _response$tenantConte3, _response$tenantConte4;
|
|
85
|
+
const response = await AGGQuery('/gateway/api/graphql', buildActivationIdQuery(cloudId, product));
|
|
86
|
+
return (_response$tenantConte = response === null || response === void 0 ? void 0 : (_response$tenantConte2 = response.tenantContexts) === null || _response$tenantConte2 === void 0 ? void 0 : (_response$tenantConte3 = _response$tenantConte2[0]) === null || _response$tenantConte3 === void 0 ? void 0 : (_response$tenantConte4 = _response$tenantConte3.activationIdByProduct) === null || _response$tenantConte4 === void 0 ? void 0 : _response$tenantConte4.active) !== null && _response$tenantConte !== void 0 ? _response$tenantConte : null;
|
|
87
|
+
}
|
|
88
|
+
async getAgentByARIAgg(agentAri) {
|
|
89
|
+
var _response$agentStudio;
|
|
90
|
+
const response = await AGGQuery('/gateway/api/graphql', buildRovoAgentQueryByAri(agentAri));
|
|
91
|
+
if (((_response$agentStudio = response.agentStudio_agentById) === null || _response$agentStudio === void 0 ? void 0 : _response$agentStudio.__typename) === 'QueryError') {
|
|
92
|
+
throw new Error(`ProfileCard agentStudio_agentById returning QueryError: ${response.agentStudio_agentById.message}`);
|
|
93
|
+
}
|
|
94
|
+
return response === null || response === void 0 ? void 0 : response.agentStudio_agentById;
|
|
95
|
+
}
|
|
96
|
+
async getAgentByAccountIdAgg(identityAccountId, cloudId) {
|
|
97
|
+
var _response$agentStudio2;
|
|
98
|
+
const response = await AGGQuery('/gateway/api/graphql', buildRovoAgentQueryByAccountId(identityAccountId, cloudId));
|
|
99
|
+
if (((_response$agentStudio2 = response.agentStudio_agentByIdentityAccountId) === null || _response$agentStudio2 === void 0 ? void 0 : _response$agentStudio2.__typename) === 'QueryError') {
|
|
100
|
+
throw new Error(`ProfileCard agentStudio_agentByIdentityAccountId returning QueryError: ${response.agentStudio_agentByIdentityAccountId.message}`);
|
|
101
|
+
}
|
|
102
|
+
return response === null || response === void 0 ? void 0 : response.agentStudio_agentByIdentityAccountId;
|
|
103
|
+
}
|
|
104
|
+
makeRequest(id, analyticsNext) {
|
|
26
105
|
const product = this.options.productIdentifier || 'rovo';
|
|
27
106
|
const headers = createHeaders(product, this.options.cloudId);
|
|
107
|
+
let restPromise;
|
|
28
108
|
if (id.type === 'identity') {
|
|
29
|
-
|
|
109
|
+
restPromise = fetch(new Request(`${this.basePath()}/accountid/${id.value}`, {
|
|
110
|
+
method: 'GET',
|
|
111
|
+
credentials: 'include',
|
|
112
|
+
mode: 'cors',
|
|
113
|
+
headers
|
|
114
|
+
})).then(response => response.json());
|
|
115
|
+
} else {
|
|
116
|
+
restPromise = fetch(new Request(`${this.basePath()}/${id.value}`, {
|
|
30
117
|
method: 'GET',
|
|
31
118
|
credentials: 'include',
|
|
32
119
|
mode: 'cors',
|
|
33
120
|
headers
|
|
34
121
|
})).then(response => response.json());
|
|
35
122
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
123
|
+
if (!fg('agent_studio_permissions_settings_m3_profiles')) {
|
|
124
|
+
return restPromise.then(restData => ({
|
|
125
|
+
restData,
|
|
126
|
+
aggData: null
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
const aggStartTime = getPageTime();
|
|
130
|
+
const aggPromise = this.getActivationId(this.options.cloudId || '', this.options.productIdentifier || 'rovo').then(activationId => {
|
|
131
|
+
if (!activationId) {
|
|
132
|
+
throw new Error('ProfileCard Activation ID not found');
|
|
133
|
+
}
|
|
134
|
+
if (id.type === 'identity') {
|
|
135
|
+
return this.getAgentByAccountIdAgg(id.value, this.options.cloudId || '');
|
|
136
|
+
} else {
|
|
137
|
+
const agentAri = `ari:cloud:rovo::agent/activation/${activationId}/${id.value}`;
|
|
138
|
+
return this.getAgentByARIAgg(agentAri);
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
// We are not going to break the flow if the AGG endpoint fails for now
|
|
142
|
+
// @TODO once all the data moved to AGG, we can remove this catch
|
|
143
|
+
.catch(error => {
|
|
144
|
+
if (analyticsNext) {
|
|
145
|
+
analyticsNext('operational.rovoAgentProfilecard.failed.request', {
|
|
146
|
+
...getErrorAttributes(error),
|
|
147
|
+
errorType: 'RovoAgentProfileCardAggError',
|
|
148
|
+
duration: getPageTime() - aggStartTime,
|
|
149
|
+
gateway: true,
|
|
150
|
+
firedAt: Math.round(getPageTime()),
|
|
151
|
+
...PACKAGE_META_DATA
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return Promise.resolve(null);
|
|
155
|
+
});
|
|
156
|
+
return Promise.all([restPromise, aggPromise]).then(([restData, aggData]) => ({
|
|
157
|
+
restData,
|
|
158
|
+
aggData
|
|
159
|
+
}));
|
|
42
160
|
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* This function will call both REST and AGG endpoints to get the agent profile
|
|
164
|
+
* There are some data that is only available in the AGG endpoint, so we need to call both
|
|
165
|
+
* For any new fields, please only add them to the AGG endpoint
|
|
166
|
+
*
|
|
167
|
+
* @TODO migrate everything to AGG endpoint
|
|
168
|
+
*/
|
|
43
169
|
getProfile(id, analytics, analyticsNext) {
|
|
44
170
|
if (!id.value) {
|
|
45
171
|
return Promise.reject(new Error('Id is missing'));
|
|
@@ -65,7 +191,7 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
65
191
|
analytics(agentRequestAnalytics('triggered'));
|
|
66
192
|
}
|
|
67
193
|
}
|
|
68
|
-
this.makeRequest(id,
|
|
194
|
+
this.makeRequest(id, analyticsNext).then(data => {
|
|
69
195
|
if (this.cache) {
|
|
70
196
|
this.setCachedProfile(id.value, data);
|
|
71
197
|
}
|
|
@@ -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', "24.
|
|
9
|
+
headers.append('atl-client-version', "24.19.0");
|
|
10
10
|
return headers;
|
|
11
11
|
};
|
|
12
12
|
export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
|
|
@@ -77,7 +77,7 @@ export const addHeaders = headers => {
|
|
|
77
77
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
78
78
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
79
79
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
80
|
-
headers.append('atl-client-version', "24.
|
|
80
|
+
headers.append('atl-client-version', "24.19.0");
|
|
81
81
|
return headers;
|
|
82
82
|
};
|
|
83
83
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
@@ -142,9 +142,9 @@ const _AgentActions = ({
|
|
|
142
142
|
};
|
|
143
143
|
const messages = defineMessages({
|
|
144
144
|
actionChatToAgent: {
|
|
145
|
-
id: 'ptc-directory.agent-profile.action.dropdown.chat-
|
|
146
|
-
defaultMessage: 'Chat
|
|
147
|
-
description: 'Text for the "chat
|
|
145
|
+
id: 'ptc-directory.agent-profile.action.dropdown.chat-with-agent',
|
|
146
|
+
defaultMessage: 'Chat with Agent',
|
|
147
|
+
description: 'Text for the "chat with agent" action to chat to the agent'
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
export const AgentActions = componentWithFG('profilecard_primitives_compiled', AgentActionsCompiled, _AgentActions);
|
|
@@ -121,8 +121,8 @@ export const AgentActions = ({
|
|
|
121
121
|
};
|
|
122
122
|
const messages = defineMessages({
|
|
123
123
|
actionChatToAgent: {
|
|
124
|
-
id: 'ptc-directory.agent-profile.action.dropdown.chat-
|
|
125
|
-
defaultMessage: 'Chat
|
|
126
|
-
description: 'Text for the "chat
|
|
124
|
+
id: 'ptc-directory.agent-profile.action.dropdown.chat-with-agent',
|
|
125
|
+
defaultMessage: 'Chat with Agent',
|
|
126
|
+
description: 'Text for the "chat with agent" action to chat to the agent'
|
|
127
127
|
}
|
|
128
128
|
});
|
|
@@ -33,7 +33,11 @@ export const AgentProfileCardResourced = props => {
|
|
|
33
33
|
},
|
|
34
34
|
cloudId: props.cloudId
|
|
35
35
|
});
|
|
36
|
-
const getCreator = useCallback(async (
|
|
36
|
+
const getCreator = useCallback(async ({
|
|
37
|
+
creator_type,
|
|
38
|
+
creator,
|
|
39
|
+
authoringTeam
|
|
40
|
+
}) => {
|
|
37
41
|
if (!creator) {
|
|
38
42
|
return undefined;
|
|
39
43
|
}
|
|
@@ -52,6 +56,14 @@ export const AgentProfileCardResourced = props => {
|
|
|
52
56
|
if (!creatorUserId || !props.cloudId) {
|
|
53
57
|
return undefined;
|
|
54
58
|
}
|
|
59
|
+
if (authoringTeam && fg('agent_studio_permissions_settings_m3_profiles')) {
|
|
60
|
+
var _authoringTeam$displa, _authoringTeam$profil;
|
|
61
|
+
return {
|
|
62
|
+
type: 'CUSTOMER',
|
|
63
|
+
name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
|
|
64
|
+
profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
|
|
65
|
+
};
|
|
66
|
+
}
|
|
55
67
|
const creatorInfo = await props.resourceClient.getProfile(creatorUserId, props.cloudId, fireAnalytics, fireEventNext);
|
|
56
68
|
return {
|
|
57
69
|
type: 'CUSTOMER',
|
|
@@ -69,11 +81,17 @@ export const AgentProfileCardResourced = props => {
|
|
|
69
81
|
const fetchData = useCallback(async () => {
|
|
70
82
|
setIsLoading(true);
|
|
71
83
|
try {
|
|
72
|
-
|
|
84
|
+
var _profileResult$aggDat, _profileResult$aggDat2;
|
|
85
|
+
const profileResult = await props.resourceClient.getRovoAgentProfile({
|
|
73
86
|
type: 'identity',
|
|
74
87
|
value: props.accountId
|
|
75
88
|
}, fireAnalytics, fireEventNext);
|
|
76
|
-
const
|
|
89
|
+
const profileData = profileResult.restData;
|
|
90
|
+
const agentCreatorInfo = await getCreator({
|
|
91
|
+
creator_type: profileData === null || profileData === void 0 ? void 0 : profileData.creator_type,
|
|
92
|
+
creator: (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined,
|
|
93
|
+
authoringTeam: (_profileResult$aggDat = (_profileResult$aggDat2 = profileResult.aggData) === null || _profileResult$aggDat2 === void 0 ? void 0 : _profileResult$aggDat2.authoringTeam) !== null && _profileResult$aggDat !== void 0 ? _profileResult$aggDat : undefined
|
|
94
|
+
});
|
|
77
95
|
setAgentData({
|
|
78
96
|
...profileData,
|
|
79
97
|
creatorInfo: agentCreatorInfo
|
|
@@ -30,7 +30,11 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
|
|
|
30
30
|
fireEvent(createAnalyticsEvent, payload);
|
|
31
31
|
}
|
|
32
32
|
}, [createAnalyticsEvent]);
|
|
33
|
-
const getCreator = async (
|
|
33
|
+
const getCreator = async ({
|
|
34
|
+
creator_type,
|
|
35
|
+
creator,
|
|
36
|
+
authoringTeam
|
|
37
|
+
}) => {
|
|
34
38
|
if (!creator) {
|
|
35
39
|
return undefined;
|
|
36
40
|
}
|
|
@@ -55,6 +59,14 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
|
|
|
55
59
|
if (!userId || !cloudId) {
|
|
56
60
|
return undefined;
|
|
57
61
|
}
|
|
62
|
+
if (authoringTeam && fg('agent_studio_permissions_settings_m3_profiles')) {
|
|
63
|
+
var _authoringTeam$displa, _authoringTeam$profil;
|
|
64
|
+
return {
|
|
65
|
+
type: 'CUSTOMER',
|
|
66
|
+
name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
|
|
67
|
+
profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
|
|
68
|
+
};
|
|
69
|
+
}
|
|
58
70
|
const {
|
|
59
71
|
href: profileHref
|
|
60
72
|
} = navigateToTeamsApp({
|
|
@@ -79,11 +91,17 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
|
|
|
79
91
|
}
|
|
80
92
|
};
|
|
81
93
|
const fetchAgentProfile = async () => {
|
|
82
|
-
|
|
94
|
+
var _agentProfileResult$a, _agentProfileResult$a2;
|
|
95
|
+
const agentProfileResult = await resourceClient.getRovoAgentProfile({
|
|
83
96
|
type: 'agent',
|
|
84
97
|
value: userId
|
|
85
98
|
}, fireAnalytics, fireEventNext);
|
|
86
|
-
const
|
|
99
|
+
const agentInfo = agentProfileResult.restData;
|
|
100
|
+
const agentCreatorInfo = await getCreator({
|
|
101
|
+
creator_type: agentInfo.creator_type,
|
|
102
|
+
creator: agentInfo.creator || undefined,
|
|
103
|
+
authoringTeam: (_agentProfileResult$a = (_agentProfileResult$a2 = agentProfileResult.aggData) === null || _agentProfileResult$a2 === void 0 ? void 0 : _agentProfileResult$a2.authoringTeam) !== null && _agentProfileResult$a !== void 0 ? _agentProfileResult$a : undefined
|
|
104
|
+
});
|
|
87
105
|
return {
|
|
88
106
|
...agentInfo,
|
|
89
107
|
creatorInfo: agentCreatorInfo
|
|
@@ -105,7 +105,7 @@ function ProfileCardTriggerInner({
|
|
|
105
105
|
},
|
|
106
106
|
content: () =>
|
|
107
107
|
/*#__PURE__*/
|
|
108
|
-
// eslint-disable-next-line
|
|
108
|
+
// eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
|
|
109
109
|
React.createElement("div", {
|
|
110
110
|
onMouseEnter: onMouseEnter
|
|
111
111
|
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
@@ -11,4 +11,10 @@ const agentData = {
|
|
|
11
11
|
user_defined_conversation_starters: [],
|
|
12
12
|
deactivated: false
|
|
13
13
|
};
|
|
14
|
+
export const agentAggData = {
|
|
15
|
+
authoringTeam: {
|
|
16
|
+
displayName: 'Profile card agent',
|
|
17
|
+
profileUrl: 'https://example.com/profile'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
14
20
|
export default agentData;
|
|
@@ -2,7 +2,7 @@ import ProfileCardClient from '../client/ProfileCardClient';
|
|
|
2
2
|
import RovoAgentCardClient from '../client/RovoAgentCardClient';
|
|
3
3
|
import TeamProfileCardClient from '../client/TeamProfileCardClient';
|
|
4
4
|
import UserProfileCardClient from '../client/UserProfileCardClient';
|
|
5
|
-
import agentData from './agent-data';
|
|
5
|
+
import agentData, { agentAggData } from './agent-data';
|
|
6
6
|
import profiles from './profile-data';
|
|
7
7
|
import teamData from './team-data';
|
|
8
8
|
import { getTimeString, getWeekday } from './util';
|
|
@@ -31,8 +31,11 @@ class SimpleMockUserClient extends UserProfileCardClient {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
class SimpleMockAgentClient extends RovoAgentCardClient {
|
|
34
|
-
makeRequest(id
|
|
35
|
-
return Promise.resolve(
|
|
34
|
+
makeRequest(id) {
|
|
35
|
+
return Promise.resolve({
|
|
36
|
+
restData: agentData,
|
|
37
|
+
aggData: agentAggData
|
|
38
|
+
});
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
const args = {
|
|
@@ -4,7 +4,7 @@ import { getPageTime } from './performance';
|
|
|
4
4
|
const ANALYTICS_CHANNEL = 'peopleTeams';
|
|
5
5
|
export const PACKAGE_META_DATA = {
|
|
6
6
|
packageName: "@atlaskit/profilecard",
|
|
7
|
-
packageVersion: "24.
|
|
7
|
+
packageVersion: "24.19.0"
|
|
8
8
|
};
|
|
9
9
|
const runItLater = cb => {
|
|
10
10
|
const requestIdleCallback = window.requestIdleCallback;
|
|
@@ -45,7 +45,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
|
|
|
45
45
|
actionSubjectId,
|
|
46
46
|
attributes: {
|
|
47
47
|
packageName: "@atlaskit/profilecard",
|
|
48
|
-
packageVersion: "24.
|
|
48
|
+
packageVersion: "24.19.0",
|
|
49
49
|
...attributes,
|
|
50
50
|
firedAt: Math.round(getPageTime())
|
|
51
51
|
}
|