@atlaskit/profilecard 20.9.0 → 20.11.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 +20 -0
- package/afm-post-office/tsconfig.json +1 -1
- package/dist/cjs/client/ProfileCardClient.js +10 -4
- package/dist/cjs/client/RovoAgentCardClient.js +57 -12
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/Actions.js +54 -11
- package/dist/cjs/components/Agent/AgentProfileCard.js +6 -1
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +47 -67
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +5 -1
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/es2019/client/ProfileCardClient.js +8 -4
- package/dist/es2019/client/RovoAgentCardClient.js +48 -10
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/Actions.js +33 -4
- package/dist/es2019/components/Agent/AgentProfileCard.js +5 -2
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +29 -37
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +5 -1
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/esm/client/ProfileCardClient.js +10 -4
- package/dist/esm/client/RovoAgentCardClient.js +57 -12
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/Actions.js +56 -13
- package/dist/esm/components/Agent/AgentProfileCard.js +6 -1
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +48 -68
- package/dist/esm/components/Agent/hooks/useAgentActions.js +5 -1
- package/dist/esm/util/analytics.js +1 -1
- package/dist/types/client/ProfileCardClient.d.ts +1 -0
- package/dist/types/client/RovoAgentCardClient.d.ts +2 -1
- package/dist/types/components/Agent/Actions.d.ts +4 -2
- package/dist/types/components/Agent/AgentProfileCardResourced.d.ts +1 -1
- package/dist/types/components/Agent/hooks/useAgentActions.d.ts +1 -0
- package/dist/types/types.d.ts +7 -0
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +1 -0
- package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +2 -1
- package/dist/types-ts4.5/components/Agent/Actions.d.ts +4 -2
- package/dist/types-ts4.5/components/Agent/AgentProfileCardResourced.d.ts +1 -1
- package/dist/types-ts4.5/components/Agent/hooks/useAgentActions.d.ts +1 -0
- package/dist/types-ts4.5/types.d.ts +7 -0
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 20.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#163611](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163611)
|
|
8
|
+
[`559a5e24a2892`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/559a5e24a2892) -
|
|
9
|
+
Fix asynchronous loading of agent profile card
|
|
10
|
+
|
|
11
|
+
## 20.10.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#163699](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163699)
|
|
16
|
+
[`f946e35c60150`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f946e35c60150) -
|
|
17
|
+
Refactor to use shared agent dropdown from @atlaskit/rovo-agent-components
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 20.9.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -165,17 +165,23 @@ var ProfileCardClient = /*#__PURE__*/function () {
|
|
|
165
165
|
var _this$rovoAgentClient2;
|
|
166
166
|
return (_this$rovoAgentClient2 = this.rovoAgentClient) === null || _this$rovoAgentClient2 === void 0 ? void 0 : _this$rovoAgentClient2.getProfile(id, analytics);
|
|
167
167
|
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "getRovoAgentPermissions",
|
|
170
|
+
value: function getRovoAgentPermissions(id, fireAnalytics) {
|
|
171
|
+
var _this$rovoAgentClient3;
|
|
172
|
+
return (_this$rovoAgentClient3 = this.rovoAgentClient) === null || _this$rovoAgentClient3 === void 0 ? void 0 : _this$rovoAgentClient3.getPermissions(id, fireAnalytics);
|
|
173
|
+
}
|
|
168
174
|
}, {
|
|
169
175
|
key: "deleteAgent",
|
|
170
176
|
value: function deleteAgent(id, analytics) {
|
|
171
|
-
var _this$
|
|
172
|
-
return (_this$
|
|
177
|
+
var _this$rovoAgentClient4;
|
|
178
|
+
return (_this$rovoAgentClient4 = this.rovoAgentClient) === null || _this$rovoAgentClient4 === void 0 ? void 0 : _this$rovoAgentClient4.deleteAgent(id, analytics);
|
|
173
179
|
}
|
|
174
180
|
}, {
|
|
175
181
|
key: "setFavouriteAgent",
|
|
176
182
|
value: function setFavouriteAgent(id, isFavourite, analytics) {
|
|
177
|
-
var _this$
|
|
178
|
-
return (_this$
|
|
183
|
+
var _this$rovoAgentClient5;
|
|
184
|
+
return (_this$rovoAgentClient5 = this.rovoAgentClient) === null || _this$rovoAgentClient5 === void 0 ? void 0 : _this$rovoAgentClient5.setFavouriteAgent(id, isFavourite, analytics);
|
|
179
185
|
}
|
|
180
186
|
}]);
|
|
181
187
|
return ProfileCardClient;
|
|
@@ -7,29 +7,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
16
|
var _analytics = require("../util/analytics");
|
|
17
17
|
var _performance = require("../util/performance");
|
|
18
18
|
var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
|
|
19
19
|
var _errorUtils = require("./errorUtils");
|
|
20
|
-
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
21
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
20
|
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
21
|
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
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
|
|
22
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
23
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
24
|
+
var createHeaders = function createHeaders(product, cloudId, isBodyJson) {
|
|
25
|
+
var headers = new Headers({
|
|
26
|
+
'X-Product': product,
|
|
27
|
+
'X-Experience-Id': 'profile-card',
|
|
28
|
+
'X-Cloudid': cloudId || ''
|
|
29
|
+
});
|
|
30
|
+
if (isBodyJson) {
|
|
31
|
+
headers.set('Content-Type', 'application/json');
|
|
32
|
+
}
|
|
33
|
+
return headers;
|
|
33
34
|
};
|
|
34
35
|
var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClient) {
|
|
35
36
|
(0, _inherits2.default)(RovoAgentCardClient, _CachingClient);
|
|
@@ -202,6 +203,50 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
202
203
|
};
|
|
203
204
|
}());
|
|
204
205
|
}
|
|
206
|
+
}, {
|
|
207
|
+
key: "getPermissions",
|
|
208
|
+
value: function getPermissions(id, fireAnalytics) {
|
|
209
|
+
var _this5 = this;
|
|
210
|
+
if (!this.options.cloudId) {
|
|
211
|
+
return Promise.reject(new Error('cloudId is missing'));
|
|
212
|
+
}
|
|
213
|
+
return new Promise(function (resolve, reject) {
|
|
214
|
+
var startTime = (0, _performance.getPageTime)();
|
|
215
|
+
var product = _this5.options.productIdentifier || 'rovo';
|
|
216
|
+
if (fireAnalytics) {
|
|
217
|
+
fireAnalytics((0, _analytics.agentRequestAnalytics)('triggered'));
|
|
218
|
+
}
|
|
219
|
+
var headers = createHeaders(product, _this5.options.cloudId, true);
|
|
220
|
+
fetch(new Request("/gateway/api/assist/api/rovo/v2/permissions/agents/".concat(id), {
|
|
221
|
+
method: 'POST',
|
|
222
|
+
credentials: 'include',
|
|
223
|
+
mode: 'cors',
|
|
224
|
+
headers: headers,
|
|
225
|
+
body: JSON.stringify({
|
|
226
|
+
permission_ids: ['AGENT_CREATE', 'AGENT_UPDATE', 'AGENT_DELETE', 'AGENT_DEACTIVATE', 'AGENT_READ']
|
|
227
|
+
})
|
|
228
|
+
})).then(function (response) {
|
|
229
|
+
return response.json();
|
|
230
|
+
}).then(function (data) {
|
|
231
|
+
if (fireAnalytics) {
|
|
232
|
+
fireAnalytics((0, _analytics.agentRequestAnalytics)('succeeded', 'getAgentPermissions', {
|
|
233
|
+
duration: (0, _performance.getPageTime)() - startTime,
|
|
234
|
+
gateway: true
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
resolve(data);
|
|
238
|
+
}).catch(function (error) {
|
|
239
|
+
if (fireAnalytics) {
|
|
240
|
+
fireAnalytics((0, _analytics.agentRequestAnalytics)('failed', 'getAgentPermissions', _objectSpread(_objectSpread({
|
|
241
|
+
duration: (0, _performance.getPageTime)() - startTime
|
|
242
|
+
}, (0, _errorUtils.getErrorAttributes)(error)), {}, {
|
|
243
|
+
gateway: true
|
|
244
|
+
})));
|
|
245
|
+
}
|
|
246
|
+
reject(error);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
}
|
|
205
250
|
}]);
|
|
206
251
|
return RovoAgentCardClient;
|
|
207
252
|
}(_CachingClient2.default);
|
|
@@ -11,7 +11,7 @@ var _graphqlUtils = require("./graphqlUtils");
|
|
|
11
11
|
var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
|
|
12
12
|
var addHeaders = function addHeaders(headers) {
|
|
13
13
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
14
|
-
headers.append('atl-client-version', "20.
|
|
14
|
+
headers.append('atl-client-version', "20.11.0");
|
|
15
15
|
return headers;
|
|
16
16
|
};
|
|
17
17
|
function getOrgIdForCloudIdFromAGG(_x, _x2) {
|
|
@@ -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', "20.
|
|
60
|
+
headers.append('atl-client-version', "20.11.0");
|
|
61
61
|
return headers;
|
|
62
62
|
};
|
|
63
63
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -8,12 +8,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.AgentActions = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
15
|
var _reactIntlNext = require("react-intl-next");
|
|
14
16
|
var _new = _interopRequireWildcard(require("@atlaskit/button/new"));
|
|
15
17
|
var _dropdownMenu = _interopRequireWildcard(require("@atlaskit/dropdown-menu"));
|
|
16
18
|
var _showMoreHorizontalMore = _interopRequireDefault(require("@atlaskit/icon/core/migration/show-more-horizontal--more"));
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
20
|
var _primitives = require("@atlaskit/primitives");
|
|
18
21
|
var _rovoAgentComponents = require("@atlaskit/rovo-agent-components");
|
|
19
22
|
var _AgentDeleteConfirmationModal = require("./AgentDeleteConfirmationModal");
|
|
@@ -82,13 +85,38 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref3) {
|
|
|
82
85
|
onDuplicateAgent = _ref3.onDuplicateAgent,
|
|
83
86
|
onCopyAgent = _ref3.onCopyAgent,
|
|
84
87
|
onChatClick = _ref3.onChatClick,
|
|
85
|
-
|
|
88
|
+
onViewFullProfileClick = _ref3.onViewFullProfileClick,
|
|
89
|
+
agent = _ref3.agent,
|
|
90
|
+
resourceClient = _ref3.resourceClient;
|
|
86
91
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
87
92
|
formatMessage = _useIntl.formatMessage;
|
|
88
93
|
var _useState = (0, _react.useState)(false),
|
|
89
94
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
90
95
|
isDeleteModalOpen = _useState2[0],
|
|
91
96
|
setIsDeleteModalOpen = _useState2[1];
|
|
97
|
+
var isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
|
|
98
|
+
var loadAgentPermissions = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
99
|
+
var _yield$resourceClient, _yield$resourceClient2, AGENT_UPDATE, AGENT_DEACTIVATE;
|
|
100
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
101
|
+
while (1) switch (_context.prev = _context.next) {
|
|
102
|
+
case 0:
|
|
103
|
+
_context.next = 2;
|
|
104
|
+
return resourceClient.getRovoAgentPermissions(agent.id);
|
|
105
|
+
case 2:
|
|
106
|
+
_yield$resourceClient = _context.sent;
|
|
107
|
+
_yield$resourceClient2 = _yield$resourceClient.permissions;
|
|
108
|
+
AGENT_UPDATE = _yield$resourceClient2.AGENT_UPDATE;
|
|
109
|
+
AGENT_DEACTIVATE = _yield$resourceClient2.AGENT_DEACTIVATE;
|
|
110
|
+
return _context.abrupt("return", {
|
|
111
|
+
isEditEnabled: AGENT_UPDATE.permitted,
|
|
112
|
+
isDeleteEnabled: AGENT_DEACTIVATE.permitted
|
|
113
|
+
});
|
|
114
|
+
case 7:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context.stop();
|
|
117
|
+
}
|
|
118
|
+
}, _callee);
|
|
119
|
+
})), [agent.id, resourceClient]);
|
|
92
120
|
var agentActions = buildAgentActions({
|
|
93
121
|
onDuplicateAgent: onDuplicateAgent,
|
|
94
122
|
onCopyAgent: onCopyAgent,
|
|
@@ -120,10 +148,25 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref3) {
|
|
|
120
148
|
xcss: chatPillIconWrapper
|
|
121
149
|
}, /*#__PURE__*/_react.default.createElement(_rovoAgentComponents.ChatPillIcon, null)), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
122
150
|
xcss: chatPillTextStyles
|
|
123
|
-
}, formatMessage(messages.actionChatToAgent)))))), /*#__PURE__*/_react.default.createElement(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
151
|
+
}, formatMessage(messages.actionChatToAgent)))))), (0, _platformFeatureFlags.fg)('rovo_use_agent_permissions') ? /*#__PURE__*/_react.default.createElement(_rovoAgentComponents.AgentDropdownMenu, {
|
|
152
|
+
agentId: agent.id,
|
|
153
|
+
isAgentCreatedByUser: isAgentCreatedByCurrentUser !== null && isAgentCreatedByCurrentUser !== void 0 ? isAgentCreatedByCurrentUser : false,
|
|
154
|
+
onDeleteAgent: function onDeleteAgent() {
|
|
155
|
+
return setIsDeleteModalOpen(true);
|
|
156
|
+
},
|
|
157
|
+
onEditAgent: onEditAgent,
|
|
158
|
+
onDuplicateAgent: onDuplicateAgent,
|
|
159
|
+
onCopyAgent: onCopyAgent,
|
|
160
|
+
isForgeAgent: isForgeAgent,
|
|
161
|
+
loadAgentPermissions: loadAgentPermissions,
|
|
162
|
+
loadPermissionsOnMount: true,
|
|
163
|
+
onViewAgentFullProfileClick: onViewFullProfileClick,
|
|
164
|
+
doesAgentHaveIdentityAccountId: !!agent.identity_account_id,
|
|
165
|
+
shouldTriggerStopPropagation: true
|
|
166
|
+
}) : /*#__PURE__*/_react.default.createElement(_dropdownMenu.default, {
|
|
167
|
+
trigger: function trigger(_ref5) {
|
|
168
|
+
var triggerRef = _ref5.triggerRef,
|
|
169
|
+
props = (0, _objectWithoutProperties2.default)(_ref5, _excluded);
|
|
127
170
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, null, /*#__PURE__*/_react.default.createElement(_new.IconButton, (0, _extends2.default)({}, props, {
|
|
128
171
|
icon: _showMoreHorizontalMore.default,
|
|
129
172
|
label: "more",
|
|
@@ -136,9 +179,9 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref3) {
|
|
|
136
179
|
})));
|
|
137
180
|
},
|
|
138
181
|
placement: "bottom-end"
|
|
139
|
-
}, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, null, agentActions.map(function (
|
|
140
|
-
var text =
|
|
141
|
-
_onClick =
|
|
182
|
+
}, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, null, agentActions.map(function (_ref6, idx) {
|
|
183
|
+
var text = _ref6.text,
|
|
184
|
+
_onClick = _ref6.onClick;
|
|
142
185
|
return /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
143
186
|
key: idx,
|
|
144
187
|
onClick: function onClick(e) {
|
|
@@ -148,9 +191,9 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref3) {
|
|
|
148
191
|
}, text);
|
|
149
192
|
})), isAgentCreatedByCurrentUser && /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, {
|
|
150
193
|
hasSeparator: true
|
|
151
|
-
}, agentSetting.map(function (
|
|
152
|
-
var text =
|
|
153
|
-
_onClick2 =
|
|
194
|
+
}, agentSetting.map(function (_ref7, idx) {
|
|
195
|
+
var text = _ref7.text,
|
|
196
|
+
_onClick2 = _ref7.onClick;
|
|
154
197
|
return /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
155
198
|
key: idx,
|
|
156
199
|
onClick: function onClick(e) {
|
|
@@ -59,7 +59,8 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
59
59
|
_onCopyAgent = _useAgentUrlActions.onCopyAgent,
|
|
60
60
|
_onDuplicateAgent = _useAgentUrlActions.onDuplicateAgent,
|
|
61
61
|
onOpenChatFullScreen = _useAgentUrlActions.onOpenChat,
|
|
62
|
-
onConversationStarter = _useAgentUrlActions.onConversationStarter
|
|
62
|
+
onConversationStarter = _useAgentUrlActions.onConversationStarter,
|
|
63
|
+
onViewFullProfile = _useAgentUrlActions.onViewFullProfile;
|
|
63
64
|
var _useState = (0, _react.useState)(false),
|
|
64
65
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
65
66
|
isStarred = _useState2[0],
|
|
@@ -232,6 +233,10 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
232
233
|
onDeleteAgent: handleOnDelete,
|
|
233
234
|
onChatClick: function onChatClick() {
|
|
234
235
|
return _onChatClick ? _onChatClick() : onOpenChatFullScreen(agent.id);
|
|
236
|
+
},
|
|
237
|
+
resourceClient: resourceClient,
|
|
238
|
+
onViewFullProfileClick: function onViewFullProfileClick() {
|
|
239
|
+
return onViewFullProfile(agent.id);
|
|
235
240
|
}
|
|
236
241
|
})));
|
|
237
242
|
};
|
|
@@ -102,65 +102,46 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
102
102
|
return _ref.apply(this, arguments);
|
|
103
103
|
};
|
|
104
104
|
}(), [creatorUserId, fireAnalytics, props.cloudId, props.resourceClient]);
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}, fireAnalytics);
|
|
110
|
-
}, [fireAnalytics, props.accountId, props.resourceClient]);
|
|
111
|
-
var fetchData = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
112
|
-
var getAgentData, agentData;
|
|
113
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
114
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
105
|
+
var fetchData = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
106
|
+
var profileData, agentCreatorInfo;
|
|
107
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
108
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
115
109
|
case 0:
|
|
116
110
|
setIsLoading(true);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
_context2.next = 2;
|
|
124
|
-
return getAgentInfo();
|
|
125
|
-
case 2:
|
|
126
|
-
profileData = _context2.sent;
|
|
127
|
-
_context2.next = 5;
|
|
128
|
-
return getCreator(profileData === null || profileData === void 0 ? void 0 : profileData.creator_type, (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined);
|
|
129
|
-
case 5:
|
|
130
|
-
agentCreatorInfo = _context2.sent;
|
|
131
|
-
return _context2.abrupt("return", _objectSpread(_objectSpread({}, profileData), {}, {
|
|
132
|
-
creatorInfo: agentCreatorInfo
|
|
133
|
-
}));
|
|
134
|
-
case 7:
|
|
135
|
-
case "end":
|
|
136
|
-
return _context2.stop();
|
|
137
|
-
}
|
|
138
|
-
}, _callee2);
|
|
139
|
-
}));
|
|
140
|
-
return function getAgentData() {
|
|
141
|
-
return _ref3.apply(this, arguments);
|
|
142
|
-
};
|
|
143
|
-
}();
|
|
144
|
-
_context3.next = 4;
|
|
145
|
-
return getAgentData();
|
|
111
|
+
_context2.prev = 1;
|
|
112
|
+
_context2.next = 4;
|
|
113
|
+
return props.resourceClient.getRovoAgentProfile({
|
|
114
|
+
type: 'identity',
|
|
115
|
+
value: props.accountId
|
|
116
|
+
}, fireAnalytics);
|
|
146
117
|
case 4:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
118
|
+
profileData = _context2.sent;
|
|
119
|
+
_context2.next = 7;
|
|
120
|
+
return getCreator(profileData === null || profileData === void 0 ? void 0 : profileData.creator_type, (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined);
|
|
150
121
|
case 7:
|
|
122
|
+
agentCreatorInfo = _context2.sent;
|
|
123
|
+
setAgentData(_objectSpread(_objectSpread({}, profileData), {}, {
|
|
124
|
+
creatorInfo: agentCreatorInfo
|
|
125
|
+
}));
|
|
126
|
+
_context2.next = 14;
|
|
127
|
+
break;
|
|
128
|
+
case 11:
|
|
129
|
+
_context2.prev = 11;
|
|
130
|
+
_context2.t0 = _context2["catch"](1);
|
|
131
|
+
setError(_context2.t0);
|
|
132
|
+
case 14:
|
|
133
|
+
_context2.prev = 14;
|
|
134
|
+
setIsLoading(false);
|
|
135
|
+
return _context2.finish(14);
|
|
136
|
+
case 17:
|
|
151
137
|
case "end":
|
|
152
|
-
return
|
|
138
|
+
return _context2.stop();
|
|
153
139
|
}
|
|
154
|
-
},
|
|
155
|
-
})), [
|
|
140
|
+
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
141
|
+
})), [fireAnalytics, getCreator, props.accountId, props.resourceClient]);
|
|
156
142
|
(0, _react.useEffect)(function () {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
} catch (error) {
|
|
160
|
-
setIsLoading(false);
|
|
161
|
-
setError(error);
|
|
162
|
-
}
|
|
163
|
-
}, [fetchData, getAgentInfo, getCreator, props.accountId, props.cloudId, props.resourceClient]);
|
|
143
|
+
fetchData();
|
|
144
|
+
}, [fetchData]);
|
|
164
145
|
if (error || !isLoading && !agentData) {
|
|
165
146
|
return /*#__PURE__*/_react.default.createElement(_AgentProfileCardWrapper.AgentProfileCardWrapper, null, /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
|
|
166
147
|
reload: function reload() {
|
|
@@ -170,19 +151,18 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
170
151
|
fireAnalytics: function fireAnalytics() {}
|
|
171
152
|
}));
|
|
172
153
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
return null;
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
155
|
+
fallback: null
|
|
156
|
+
}, /*#__PURE__*/_react.default.createElement(_lazyAgentProfileCard.AgentProfileCardLazy, {
|
|
157
|
+
agent: agentData,
|
|
158
|
+
isLoading: isLoading,
|
|
159
|
+
hasError: !!error,
|
|
160
|
+
isCreatedByViewingUser: creatorUserId === props.viewingUserId,
|
|
161
|
+
product: props.product,
|
|
162
|
+
onConversationStartersClick: props.onConversationStartersClick,
|
|
163
|
+
onChatClick: props.onChatClick,
|
|
164
|
+
addFlag: props.addFlag,
|
|
165
|
+
resourceClient: props.resourceClient,
|
|
166
|
+
cloudId: props.cloudId
|
|
167
|
+
}));
|
|
188
168
|
};
|
|
@@ -75,11 +75,15 @@ var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlAction
|
|
|
75
75
|
})));
|
|
76
76
|
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
77
77
|
};
|
|
78
|
+
var onViewFullProfile = function onViewFullProfile(agentId) {
|
|
79
|
+
window.open("".concat(window.location.origin, "/people/agent/").concat(agentId), '_blank', 'noopener, noreferrer');
|
|
80
|
+
};
|
|
78
81
|
return {
|
|
79
82
|
onEditAgent: onEditAgent,
|
|
80
83
|
onCopyAgent: onCopyAgent,
|
|
81
84
|
onDuplicateAgent: onDuplicateAgent,
|
|
82
85
|
onOpenChat: onOpenChat,
|
|
83
|
-
onConversationStarter: onConversationStarter
|
|
86
|
+
onConversationStarter: onConversationStarter,
|
|
87
|
+
onViewFullProfile: onViewFullProfile
|
|
84
88
|
};
|
|
85
89
|
};
|
|
@@ -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: "20.
|
|
48
|
+
packageVersion: "20.11.0"
|
|
49
49
|
}, attributes), {}, {
|
|
50
50
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
51
51
|
})
|
|
@@ -78,13 +78,17 @@ class ProfileCardClient {
|
|
|
78
78
|
var _this$rovoAgentClient2;
|
|
79
79
|
return (_this$rovoAgentClient2 = this.rovoAgentClient) === null || _this$rovoAgentClient2 === void 0 ? void 0 : _this$rovoAgentClient2.getProfile(id, analytics);
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
getRovoAgentPermissions(id, fireAnalytics) {
|
|
82
82
|
var _this$rovoAgentClient3;
|
|
83
|
-
return (_this$rovoAgentClient3 = this.rovoAgentClient) === null || _this$rovoAgentClient3 === void 0 ? void 0 : _this$rovoAgentClient3.
|
|
83
|
+
return (_this$rovoAgentClient3 = this.rovoAgentClient) === null || _this$rovoAgentClient3 === void 0 ? void 0 : _this$rovoAgentClient3.getPermissions(id, fireAnalytics);
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
deleteAgent(id, analytics) {
|
|
86
86
|
var _this$rovoAgentClient4;
|
|
87
|
-
return (_this$rovoAgentClient4 = this.rovoAgentClient) === null || _this$rovoAgentClient4 === void 0 ? void 0 : _this$rovoAgentClient4.
|
|
87
|
+
return (_this$rovoAgentClient4 = this.rovoAgentClient) === null || _this$rovoAgentClient4 === void 0 ? void 0 : _this$rovoAgentClient4.deleteAgent(id, analytics);
|
|
88
|
+
}
|
|
89
|
+
setFavouriteAgent(id, isFavourite, analytics) {
|
|
90
|
+
var _this$rovoAgentClient5;
|
|
91
|
+
return (_this$rovoAgentClient5 = this.rovoAgentClient) === null || _this$rovoAgentClient5 === void 0 ? void 0 : _this$rovoAgentClient5.setFavouriteAgent(id, isFavourite, analytics);
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
function maybeCreateTeamCentralClient(config, clients) {
|
|
@@ -2,17 +2,16 @@ import { agentRequestAnalytics } from '../util/analytics';
|
|
|
2
2
|
import { getPageTime } from '../util/performance';
|
|
3
3
|
import CachingClient from './CachingClient';
|
|
4
4
|
import { getErrorAttributes } from './errorUtils';
|
|
5
|
-
const createHeaders = (product, cloudId) => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'X-Cloudid': cloudId || ''
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
return new Headers({
|
|
14
|
-
...(config.headers || {})
|
|
5
|
+
const createHeaders = (product, cloudId, isBodyJson) => {
|
|
6
|
+
const headers = new Headers({
|
|
7
|
+
'X-Product': product,
|
|
8
|
+
'X-Experience-Id': 'profile-card',
|
|
9
|
+
'X-Cloudid': cloudId || ''
|
|
15
10
|
});
|
|
11
|
+
if (isBodyJson) {
|
|
12
|
+
headers.set('Content-Type', 'application/json');
|
|
13
|
+
}
|
|
14
|
+
return headers;
|
|
16
15
|
};
|
|
17
16
|
export default class RovoAgentCardClient extends CachingClient {
|
|
18
17
|
constructor(options) {
|
|
@@ -150,4 +149,43 @@ export default class RovoAgentCardClient extends CachingClient {
|
|
|
150
149
|
});
|
|
151
150
|
});
|
|
152
151
|
}
|
|
152
|
+
getPermissions(id, fireAnalytics) {
|
|
153
|
+
if (!this.options.cloudId) {
|
|
154
|
+
return Promise.reject(new Error('cloudId is missing'));
|
|
155
|
+
}
|
|
156
|
+
return new Promise((resolve, reject) => {
|
|
157
|
+
const startTime = getPageTime();
|
|
158
|
+
const product = this.options.productIdentifier || 'rovo';
|
|
159
|
+
if (fireAnalytics) {
|
|
160
|
+
fireAnalytics(agentRequestAnalytics('triggered'));
|
|
161
|
+
}
|
|
162
|
+
const headers = createHeaders(product, this.options.cloudId, true);
|
|
163
|
+
fetch(new Request(`/gateway/api/assist/api/rovo/v2/permissions/agents/${id}`, {
|
|
164
|
+
method: 'POST',
|
|
165
|
+
credentials: 'include',
|
|
166
|
+
mode: 'cors',
|
|
167
|
+
headers,
|
|
168
|
+
body: JSON.stringify({
|
|
169
|
+
permission_ids: ['AGENT_CREATE', 'AGENT_UPDATE', 'AGENT_DELETE', 'AGENT_DEACTIVATE', 'AGENT_READ']
|
|
170
|
+
})
|
|
171
|
+
})).then(response => response.json()).then(data => {
|
|
172
|
+
if (fireAnalytics) {
|
|
173
|
+
fireAnalytics(agentRequestAnalytics('succeeded', 'getAgentPermissions', {
|
|
174
|
+
duration: getPageTime() - startTime,
|
|
175
|
+
gateway: true
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
resolve(data);
|
|
179
|
+
}).catch(error => {
|
|
180
|
+
if (fireAnalytics) {
|
|
181
|
+
fireAnalytics(agentRequestAnalytics('failed', 'getAgentPermissions', {
|
|
182
|
+
duration: getPageTime() - startTime,
|
|
183
|
+
...getErrorAttributes(error),
|
|
184
|
+
gateway: true
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
reject(error);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
153
191
|
}
|
|
@@ -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', "20.
|
|
9
|
+
headers.append('atl-client-version', "20.11.0");
|
|
10
10
|
return headers;
|
|
11
11
|
};
|
|
12
12
|
export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
|
|
@@ -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', "20.
|
|
70
|
+
headers.append('atl-client-version', "20.11.0");
|
|
71
71
|
return headers;
|
|
72
72
|
};
|
|
73
73
|
export async function getTeamFromAGG(url, teamId, siteId) {
|