@atlaskit/profilecard 19.19.0 → 19.21.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 +28 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +6 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/client/ProfileCardClient.js +11 -3
- package/dist/cjs/client/RovoAgentCardClient.js +2 -5
- package/dist/cjs/client/UserProfileCardClient.js +107 -16
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/Actions.js +44 -27
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +104 -0
- package/dist/cjs/components/Agent/AgentProfileCard.js +42 -10
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +3 -4
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +84 -0
- package/dist/cjs/components/Agent/hooks/useDeleteAgent.js +70 -0
- package/dist/cjs/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
- package/dist/cjs/components/User/ProfileCardTrigger.js +70 -29
- package/dist/cjs/components/common/LoadingState.js +3 -4
- package/dist/cjs/components/common/ProfileCardTrigger.js +5 -2
- package/dist/cjs/util/analytics.js +16 -16
- package/dist/es2019/client/ProfileCardClient.js +15 -3
- package/dist/es2019/client/RovoAgentCardClient.js +2 -5
- package/dist/es2019/client/UserProfileCardClient.js +97 -6
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/Actions.js +38 -25
- package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +82 -0
- package/dist/es2019/components/Agent/AgentProfileCard.js +25 -10
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +3 -4
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +74 -0
- package/dist/es2019/components/Agent/hooks/useDeleteAgent.js +33 -0
- package/dist/es2019/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
- package/dist/es2019/components/User/ProfileCardTrigger.js +51 -9
- package/dist/es2019/components/common/LoadingState.js +2 -3
- package/dist/es2019/components/common/ProfileCardTrigger.js +5 -2
- package/dist/es2019/util/analytics.js +16 -16
- package/dist/esm/client/ProfileCardClient.js +11 -3
- package/dist/esm/client/RovoAgentCardClient.js +2 -5
- package/dist/esm/client/UserProfileCardClient.js +108 -17
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/Actions.js +44 -27
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +94 -0
- package/dist/esm/components/Agent/AgentProfileCard.js +41 -9
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +3 -4
- package/dist/esm/components/Agent/hooks/useAgentActions.js +77 -0
- package/dist/esm/components/Agent/hooks/useDeleteAgent.js +63 -0
- package/dist/esm/components/Agent/{useSetFavouriteAgent.js → hooks/useSetFavouriteAgent.js} +1 -1
- package/dist/esm/components/User/ProfileCardTrigger.js +70 -29
- package/dist/esm/components/common/LoadingState.js +2 -3
- package/dist/esm/components/common/ProfileCardTrigger.js +5 -2
- package/dist/esm/util/analytics.js +16 -16
- package/dist/types/client/UserProfileCardClient.d.ts +7 -1
- package/dist/types/components/Agent/AgentDeleteConfirmationModal.d.ts +10 -0
- package/dist/types/components/Agent/{useAgentActions.d.ts → hooks/useAgentActions.d.ts} +6 -0
- package/dist/types/components/Agent/hooks/useDeleteAgent.d.ts +8 -0
- package/dist/types/components/User/ProfileCardTrigger.d.ts +1 -1
- package/dist/types/components/common/LoadingState.d.ts +2 -2
- package/dist/types/components/common/types.d.ts +1 -2
- package/dist/types/types.d.ts +38 -3
- package/dist/types-ts4.5/client/UserProfileCardClient.d.ts +7 -1
- package/dist/types-ts4.5/components/Agent/AgentDeleteConfirmationModal.d.ts +10 -0
- package/dist/types-ts4.5/components/Agent/{useAgentActions.d.ts → hooks/useAgentActions.d.ts} +6 -0
- package/dist/types-ts4.5/components/Agent/hooks/useDeleteAgent.d.ts +8 -0
- package/dist/types-ts4.5/components/User/ProfileCardTrigger.d.ts +1 -1
- package/dist/types-ts4.5/components/common/LoadingState.d.ts +2 -2
- package/dist/types-ts4.5/components/common/types.d.ts +1 -2
- package/dist/types-ts4.5/types.d.ts +38 -3
- package/package.json +11 -3
- package/dist/cjs/components/Agent/useAgentActions.js +0 -39
- package/dist/es2019/components/Agent/useAgentActions.js +0 -34
- package/dist/esm/components/Agent/useAgentActions.js +0 -33
- /package/dist/types/components/Agent/{useSetFavouriteAgent.d.ts → hooks/useSetFavouriteAgent.d.ts} +0 -0
- /package/dist/types-ts4.5/components/Agent/{useSetFavouriteAgent.d.ts → hooks/useSetFavouriteAgent.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 19.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#133829](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/133829)
|
|
8
|
+
[`63826c22cf753`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/63826c22cf753) -
|
|
9
|
+
Show agent profile card if user is an agent
|
|
10
|
+
- [#132624](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132624)
|
|
11
|
+
[`98d1ec284a292`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/98d1ec284a292) -
|
|
12
|
+
stopPropagation for actions and reduce the delay to show profile card
|
|
13
|
+
- [#133829](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/133829)
|
|
14
|
+
[`63826c22cf753`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/63826c22cf753) -
|
|
15
|
+
Show agent profile card if user is an agent
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
21
|
+
## 19.20.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [#132782](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132782)
|
|
26
|
+
[`8f20b4bc9526a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8f20b4bc9526a) -
|
|
27
|
+
Added default open chat action and delete agent functionality
|
|
28
|
+
- [`3c1c3ee3b4f32`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c1c3ee3b4f32) -
|
|
29
|
+
PTC-9673 Migrate profile card from CloudUser to AGG user
|
|
30
|
+
|
|
3
31
|
## 19.19.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -53,6 +53,9 @@
|
|
|
53
53
|
{
|
|
54
54
|
"path": "../../../design-system/menu/afm-jira/tsconfig.json"
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
"path": "../../../design-system/modal-dialog/afm-jira/tsconfig.json"
|
|
58
|
+
},
|
|
56
59
|
{
|
|
57
60
|
"path": "../../../platform/feature-flags/afm-jira/tsconfig.json"
|
|
58
61
|
},
|
|
@@ -62,6 +65,9 @@
|
|
|
62
65
|
{
|
|
63
66
|
"path": "../../../design-system/primitives/afm-jira/tsconfig.json"
|
|
64
67
|
},
|
|
68
|
+
{
|
|
69
|
+
"path": "../../../ai-mate/rovo-agent-components/afm-jira/tsconfig.json"
|
|
70
|
+
},
|
|
65
71
|
{
|
|
66
72
|
"path": "../../../design-system/spinner/afm-jira/tsconfig.json"
|
|
67
73
|
},
|
|
@@ -15,12 +15,20 @@ var _TeamProfileCardClient = _interopRequireDefault(require("./TeamProfileCardCl
|
|
|
15
15
|
var _UserProfileCardClient = _interopRequireDefault(require("./UserProfileCardClient"));
|
|
16
16
|
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; }
|
|
17
17
|
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; }
|
|
18
|
+
var defaultConfig = {
|
|
19
|
+
gatewayGraphqlUrl: '/gateway/api/graphql'
|
|
20
|
+
};
|
|
18
21
|
var ProfileCardClient = /*#__PURE__*/function () {
|
|
19
22
|
function ProfileCardClient(config, clients) {
|
|
23
|
+
var _config$gatewayGraphq;
|
|
20
24
|
(0, _classCallCheck2.default)(this, ProfileCardClient);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
//This default can be removed once all the clients are updated to pass the gatewayGraphqlUrl
|
|
26
|
+
var withDefaultConfig = _objectSpread(_objectSpread(_objectSpread({}, defaultConfig), config), {
|
|
27
|
+
gatewayGraphqlUrl: (_config$gatewayGraphq = config.gatewayGraphqlUrl) !== null && _config$gatewayGraphq !== void 0 ? _config$gatewayGraphq : defaultConfig.gatewayGraphqlUrl
|
|
28
|
+
});
|
|
29
|
+
this.userClient = (clients === null || clients === void 0 ? void 0 : clients.userClient) || new _UserProfileCardClient.default(withDefaultConfig);
|
|
30
|
+
this.teamClient = (clients === null || clients === void 0 ? void 0 : clients.teamClient) || new _TeamProfileCardClient.default(withDefaultConfig);
|
|
31
|
+
this.rovoAgentClient = (clients === null || clients === void 0 ? void 0 : clients.rovoAgentClient) || new _RovoAgentCardClient.default(withDefaultConfig);
|
|
24
32
|
this.tcClient = maybeCreateTeamCentralClient(config, clients);
|
|
25
33
|
}
|
|
26
34
|
(0, _createClass2.default)(ProfileCardClient, [{
|
|
@@ -33,13 +33,10 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
33
33
|
(0, _createClass2.default)(RovoAgentCardClient, [{
|
|
34
34
|
key: "makeRequest",
|
|
35
35
|
value: function makeRequest(id, cloudId) {
|
|
36
|
-
if (!this.options.productIdentifier) {
|
|
37
|
-
throw new Error('Trying to fetch agents data with no specified config.productIdentifier');
|
|
38
|
-
}
|
|
39
36
|
if (id.type === 'identity') {
|
|
40
|
-
return (0, _getAgentInfo.getAgentDetailsByUserId)(id.value, this.options.productIdentifier, cloudId);
|
|
37
|
+
return (0, _getAgentInfo.getAgentDetailsByUserId)(id.value, this.options.productIdentifier || 'rovo', cloudId);
|
|
41
38
|
}
|
|
42
|
-
return (0, _getAgentInfo.getAgentDetailsByAgentId)(id.value, this.options.productIdentifier, cloudId);
|
|
39
|
+
return (0, _getAgentInfo.getAgentDetailsByAgentId)(id.value, this.options.productIdentifier || 'rovo', cloudId);
|
|
43
40
|
}
|
|
44
41
|
}, {
|
|
45
42
|
key: "getProfile",
|
|
@@ -4,16 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.modifyResponse = exports.default = exports.buildUserQuery = void 0;
|
|
7
|
+
exports.modifyResponse = exports.default = exports.buildUserQuery = exports.buildAggUserQuery = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _analytics = require("../util/analytics");
|
|
18
|
+
var _date = require("../util/date");
|
|
17
19
|
var _performance = require("../util/performance");
|
|
18
20
|
var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
|
|
19
21
|
var _errorUtils = require("./errorUtils");
|
|
@@ -67,6 +69,51 @@ var buildUserQuery = exports.buildUserQuery = function buildUserQuery(cloudId, u
|
|
|
67
69
|
}
|
|
68
70
|
};
|
|
69
71
|
};
|
|
72
|
+
var buildAggUserQuery = exports.buildAggUserQuery = function buildAggUserQuery(userId) {
|
|
73
|
+
return {
|
|
74
|
+
//The query name needs to be app_user_characteristics in order to return appType field
|
|
75
|
+
query: "query app_user_characteristics($userId: ID!) {\n\t\tuser(accountId: $userId) {\n\t\t\tid\n\t\t\tname\n\t\t\tpicture\n\t\t\taccountStatus\n\t\t\t__typename\n\t\t\t... on AtlassianAccountUser {\n\t\t\t\temail\n\t\t\t\tnickname\n\t\t\t\tzoneinfo\n\t\t\t\textendedProfile {\n\t\t\t\t\tjobTitle\n\t\t\t\t\torganization\n\t\t\t\t\tlocation\n\t\t\t\t\tclosedDate\n\t\t\t\t\tinactiveDate\n\t\t\t\t}\n\t\t\t}\n\t\t\t... on CustomerUser {\n\t\t\t\temail\n\t\t\t\tzoneinfo\n\t\t\t}\n\t\t\t... on AppUser {\n \t\t\tappType\n \t\t}\n\t\t}\n\t}",
|
|
76
|
+
variables: {
|
|
77
|
+
userId: userId
|
|
78
|
+
}
|
|
79
|
+
};
|
|
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
|
+
var queryAGGUser = /*#__PURE__*/function () {
|
|
95
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, userId) {
|
|
96
|
+
var query, _yield$AGGQuery, user;
|
|
97
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
98
|
+
while (1) switch (_context.prev = _context.next) {
|
|
99
|
+
case 0:
|
|
100
|
+
query = buildAggUserQuery(userId);
|
|
101
|
+
_context.next = 3;
|
|
102
|
+
return (0, _graphqlUtils.AGGQuery)(url, query);
|
|
103
|
+
case 3:
|
|
104
|
+
_yield$AGGQuery = _context.sent;
|
|
105
|
+
user = _yield$AGGQuery.user;
|
|
106
|
+
return _context.abrupt("return", user);
|
|
107
|
+
case 6:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context.stop();
|
|
110
|
+
}
|
|
111
|
+
}, _callee);
|
|
112
|
+
}));
|
|
113
|
+
return function queryAGGUser(_x, _x2) {
|
|
114
|
+
return _ref.apply(this, arguments);
|
|
115
|
+
};
|
|
116
|
+
}();
|
|
70
117
|
var UserProfileCardClient = exports.default = /*#__PURE__*/function (_CachingClient) {
|
|
71
118
|
(0, _inherits2.default)(UserProfileCardClient, _CachingClient);
|
|
72
119
|
var _super = _createSuper(UserProfileCardClient);
|
|
@@ -80,30 +127,74 @@ var UserProfileCardClient = exports.default = /*#__PURE__*/function (_CachingCli
|
|
|
80
127
|
(0, _createClass2.default)(UserProfileCardClient, [{
|
|
81
128
|
key: "makeRequest",
|
|
82
129
|
value: function () {
|
|
83
|
-
var _makeRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
84
|
-
var query, response;
|
|
85
|
-
return _regenerator.default.wrap(function
|
|
86
|
-
while (1) switch (
|
|
130
|
+
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, userCheckPromise, userQueryPromise, checkUserPresentInSiteRes, user, timestring, localWeekdayIndex, query, response;
|
|
132
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
133
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
87
134
|
case 0:
|
|
135
|
+
if (!(0, _platformFeatureFlags.fg)('migrate_cloud_user_to_agg_user_query_profile_card')) {
|
|
136
|
+
_context2.next = 17;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
gatewayGraphqlUrl = this.options.gatewayGraphqlUrl || '/gateway/api/graphql';
|
|
140
|
+
userCheckPromise = getUserInSiteUserBase(cloudId, userId);
|
|
141
|
+
userQueryPromise = queryAGGUser(gatewayGraphqlUrl, userId);
|
|
142
|
+
_context2.next = 6;
|
|
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;
|
|
153
|
+
return userQueryPromise;
|
|
154
|
+
case 11:
|
|
155
|
+
user = _context2.sent;
|
|
156
|
+
localWeekdayIndex = new Date().getDay().toString();
|
|
157
|
+
if (user.zoneinfo) {
|
|
158
|
+
if ((0, _date.localTime)(user.zoneinfo, 'i') === localWeekdayIndex) {
|
|
159
|
+
timestring = (0, _date.localTime)(user.zoneinfo, 'h:mmbbb') || undefined;
|
|
160
|
+
} else {
|
|
161
|
+
timestring = (0, _date.localTime)(user.zoneinfo, 'eee h:mmbbb') || undefined;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return _context2.abrupt("return", _objectSpread(_objectSpread({}, user), {}, {
|
|
165
|
+
isBot: user.__typename === 'AppUser',
|
|
166
|
+
isAgent: user.appType === 'agent',
|
|
167
|
+
status: user.accountStatus,
|
|
168
|
+
statusModifiedDate: ((_user$extendedProfile = user.extendedProfile) === null || _user$extendedProfile === void 0 ? void 0 : _user$extendedProfile.closedDate) || ((_user$extendedProfile2 = user.extendedProfile) === null || _user$extendedProfile2 === void 0 ? void 0 : _user$extendedProfile2.inactiveDate),
|
|
169
|
+
avatarUrl: user.picture,
|
|
170
|
+
email: user.email,
|
|
171
|
+
fullName: user.name,
|
|
172
|
+
location: (_user$extendedProfile3 = user.extendedProfile) === null || _user$extendedProfile3 === void 0 ? void 0 : _user$extendedProfile3.location,
|
|
173
|
+
meta: (_user$extendedProfile4 = user.extendedProfile) === null || _user$extendedProfile4 === void 0 ? void 0 : _user$extendedProfile4.jobTitle,
|
|
174
|
+
nickname: user.nickname,
|
|
175
|
+
companyName: (_user$extendedProfile5 = user.extendedProfile) === null || _user$extendedProfile5 === void 0 ? void 0 : _user$extendedProfile5.organization,
|
|
176
|
+
timestring: timestring
|
|
177
|
+
}));
|
|
178
|
+
case 17:
|
|
88
179
|
if (this.options.url) {
|
|
89
|
-
|
|
180
|
+
_context2.next = 19;
|
|
90
181
|
break;
|
|
91
182
|
}
|
|
92
183
|
throw new Error('options.url is a required parameter');
|
|
93
|
-
case
|
|
184
|
+
case 19:
|
|
94
185
|
query = buildUserQuery(cloudId, userId);
|
|
95
|
-
|
|
186
|
+
_context2.next = 22;
|
|
96
187
|
return (0, _graphqlUtils.directoryGraphqlQuery)(this.options.url, query);
|
|
97
|
-
case
|
|
98
|
-
response =
|
|
99
|
-
return
|
|
100
|
-
case
|
|
188
|
+
case 22:
|
|
189
|
+
response = _context2.sent;
|
|
190
|
+
return _context2.abrupt("return", modifyResponse(response));
|
|
191
|
+
case 24:
|
|
101
192
|
case "end":
|
|
102
|
-
return
|
|
193
|
+
return _context2.stop();
|
|
103
194
|
}
|
|
104
|
-
},
|
|
195
|
+
}, _callee2, this);
|
|
105
196
|
}));
|
|
106
|
-
function makeRequest(
|
|
197
|
+
function makeRequest(_x3, _x4) {
|
|
107
198
|
return _makeRequest.apply(this, arguments);
|
|
108
199
|
}
|
|
109
200
|
return makeRequest;
|
|
@@ -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.21.0");
|
|
61
61
|
return headers;
|
|
62
62
|
};
|
|
63
63
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -8,30 +8,21 @@ 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
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _reactIntlNext = require("react-intl-next");
|
|
13
14
|
var _new = _interopRequireWildcard(require("@atlaskit/button/new"));
|
|
14
15
|
var _dropdownMenu = _interopRequireWildcard(require("@atlaskit/dropdown-menu"));
|
|
15
16
|
var _showMoreHorizontalMore = _interopRequireDefault(require("@atlaskit/icon/core/migration/show-more-horizontal--more"));
|
|
16
17
|
var _primitives = require("@atlaskit/primitives");
|
|
17
18
|
var _rovoAgentComponents = require("@atlaskit/rovo-agent-components");
|
|
19
|
+
var _AgentDeleteConfirmationModal = require("./AgentDeleteConfirmationModal");
|
|
18
20
|
var _excluded = ["triggerRef"];
|
|
19
21
|
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); }
|
|
20
22
|
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; }
|
|
21
23
|
var chatToAgentButtonContainer = (0, _primitives.xcss)({
|
|
22
24
|
width: '100%'
|
|
23
25
|
});
|
|
24
|
-
var buttonStyles = (0, _primitives.xcss)({
|
|
25
|
-
borderRadius: '3px',
|
|
26
|
-
color: 'color.text',
|
|
27
|
-
backgroundColor: 'color.background.neutral',
|
|
28
|
-
':hover': {
|
|
29
|
-
backgroundColor: 'color.background.neutral.hovered'
|
|
30
|
-
},
|
|
31
|
-
':active': {
|
|
32
|
-
backgroundColor: 'color.background.neutral.pressed'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
26
|
var chatToAgentButtonWrapper = (0, _primitives.xcss)({
|
|
36
27
|
display: 'flex',
|
|
37
28
|
justifyContent: 'center',
|
|
@@ -51,7 +42,7 @@ var chatPillIconWrapper = (0, _primitives.xcss)({
|
|
|
51
42
|
minWidth: '20px',
|
|
52
43
|
height: '20px'
|
|
53
44
|
});
|
|
54
|
-
var
|
|
45
|
+
var actionsWrapperStyles = (0, _primitives.xcss)({
|
|
55
46
|
borderTop: '1px',
|
|
56
47
|
borderTopStyle: 'solid',
|
|
57
48
|
borderColor: 'color.border',
|
|
@@ -90,22 +81,31 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref3) {
|
|
|
90
81
|
onChatClick = _ref3.onChatClick;
|
|
91
82
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
92
83
|
formatMessage = _useIntl.formatMessage;
|
|
84
|
+
var _useState = (0, _react.useState)(false),
|
|
85
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
86
|
+
isDeleteModalOpen = _useState2[0],
|
|
87
|
+
setIsDeleteModalOpen = _useState2[1];
|
|
93
88
|
var agentActions = buildAgentActions({
|
|
94
89
|
onDuplicateAgent: onDuplicateAgent,
|
|
95
90
|
onCopyAgent: onCopyAgent
|
|
96
91
|
});
|
|
97
92
|
var agentSetting = buildAgentSettings({
|
|
98
93
|
onEditAgent: onEditAgent,
|
|
99
|
-
onDeleteAgent: onDeleteAgent
|
|
94
|
+
onDeleteAgent: function onDeleteAgent() {
|
|
95
|
+
setIsDeleteModalOpen(true);
|
|
96
|
+
}
|
|
100
97
|
});
|
|
101
|
-
return /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
102
99
|
space: "space.100",
|
|
103
|
-
xcss:
|
|
100
|
+
xcss: actionsWrapperStyles
|
|
104
101
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
105
|
-
xcss:
|
|
102
|
+
xcss: chatToAgentButtonContainer
|
|
106
103
|
}, /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
107
104
|
shouldFitContainer: true,
|
|
108
|
-
onClick:
|
|
105
|
+
onClick: function onClick(e) {
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
onChatClick();
|
|
108
|
+
}
|
|
109
109
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
110
110
|
xcss: chatToAgentButtonWrapper
|
|
111
111
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
@@ -119,32 +119,49 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref3) {
|
|
|
119
119
|
trigger: function trigger(_ref4) {
|
|
120
120
|
var triggerRef = _ref4.triggerRef,
|
|
121
121
|
props = (0, _objectWithoutProperties2.default)(_ref4, _excluded);
|
|
122
|
-
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
123
|
-
xcss: buttonStyles
|
|
124
|
-
}, /*#__PURE__*/_react.default.createElement(_new.IconButton, (0, _extends2.default)({}, props, {
|
|
122
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, null, /*#__PURE__*/_react.default.createElement(_new.IconButton, (0, _extends2.default)({}, props, {
|
|
125
123
|
icon: _showMoreHorizontalMore.default,
|
|
126
124
|
label: "more",
|
|
127
|
-
ref: triggerRef
|
|
125
|
+
ref: triggerRef,
|
|
126
|
+
onClick: function onClick(e) {
|
|
127
|
+
var _props$onClick;
|
|
128
|
+
e.stopPropagation();
|
|
129
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, e);
|
|
130
|
+
}
|
|
128
131
|
})));
|
|
129
132
|
},
|
|
130
133
|
placement: "bottom-end"
|
|
131
134
|
}, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, null, agentActions.map(function (_ref5, idx) {
|
|
132
135
|
var text = _ref5.text,
|
|
133
|
-
|
|
136
|
+
_onClick = _ref5.onClick;
|
|
134
137
|
return /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
135
138
|
key: idx,
|
|
136
|
-
onClick: onClick
|
|
139
|
+
onClick: function onClick(e) {
|
|
140
|
+
e.stopPropagation();
|
|
141
|
+
_onClick === null || _onClick === void 0 || _onClick();
|
|
142
|
+
}
|
|
137
143
|
}, text);
|
|
138
144
|
})), isAgentCreatedByCurrentUser && /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItemGroup, {
|
|
139
145
|
hasSeparator: true
|
|
140
146
|
}, agentSetting.map(function (_ref6, idx) {
|
|
141
147
|
var text = _ref6.text,
|
|
142
|
-
|
|
148
|
+
_onClick2 = _ref6.onClick;
|
|
143
149
|
return /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
144
150
|
key: idx,
|
|
145
|
-
onClick: onClick
|
|
151
|
+
onClick: function onClick(e) {
|
|
152
|
+
e.stopPropagation();
|
|
153
|
+
_onClick2 === null || _onClick2 === void 0 || _onClick2();
|
|
154
|
+
}
|
|
146
155
|
}, text);
|
|
147
|
-
}))))
|
|
156
|
+
})))), /*#__PURE__*/_react.default.createElement(_AgentDeleteConfirmationModal.AgentDeleteConfirmationModal, {
|
|
157
|
+
isOpen: isDeleteModalOpen,
|
|
158
|
+
onClose: function onClose() {
|
|
159
|
+
setIsDeleteModalOpen(false);
|
|
160
|
+
},
|
|
161
|
+
onSubmit: onDeleteAgent,
|
|
162
|
+
agentId: 'some Id',
|
|
163
|
+
agentName: "agentName"
|
|
164
|
+
}));
|
|
148
165
|
};
|
|
149
166
|
var messages = (0, _reactIntlNext.defineMessages)({
|
|
150
167
|
actionChatToAgent: {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.AgentDeleteConfirmationModal = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _reactIntlNext = require("react-intl-next");
|
|
13
|
+
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
14
|
+
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
15
|
+
var _primitives = require("@atlaskit/primitives");
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
var AgentDeleteConfirmationModal = exports.AgentDeleteConfirmationModal = function AgentDeleteConfirmationModal(_ref) {
|
|
19
|
+
var onClose = _ref.onClose,
|
|
20
|
+
agentName = _ref.agentName,
|
|
21
|
+
isOpen = _ref.isOpen,
|
|
22
|
+
onSubmit = _ref.onSubmit,
|
|
23
|
+
agentId = _ref.agentId;
|
|
24
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
25
|
+
formatMessage = _useIntl.formatMessage;
|
|
26
|
+
var handleDeleteAgent = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
27
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
if (!agentId) {
|
|
31
|
+
_context.next = 4;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
_context.next = 3;
|
|
35
|
+
return onSubmit();
|
|
36
|
+
case 3:
|
|
37
|
+
onClose();
|
|
38
|
+
case 4:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}, _callee);
|
|
43
|
+
})), [agentId, onClose, onSubmit]);
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTransition, null, isOpen && /*#__PURE__*/_react.default.createElement(_modalDialog.default, {
|
|
45
|
+
width: "small"
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_modalDialog.ModalHeader, null, /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTitle, null, formatMessage(messages.title, {
|
|
47
|
+
agentName: agentName
|
|
48
|
+
}))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
49
|
+
as: "p"
|
|
50
|
+
}, formatMessage(messages.body)), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
51
|
+
appearance: "subtle",
|
|
52
|
+
onClick: onClose
|
|
53
|
+
}, formatMessage(messages.cancelText)), /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
54
|
+
appearance: "danger",
|
|
55
|
+
onClick: function onClick(_e, event) {
|
|
56
|
+
handleDeleteAgent();
|
|
57
|
+
}
|
|
58
|
+
}, formatMessage(messages.confirmText))))));
|
|
59
|
+
};
|
|
60
|
+
var messages = (0, _reactIntlNext.defineMessages)({
|
|
61
|
+
cancelText: {
|
|
62
|
+
id: 'ai-mate.agent-modal.agent-delete-confirm.cancel-text',
|
|
63
|
+
defaultMessage: 'Cancel'
|
|
64
|
+
},
|
|
65
|
+
confirmText: {
|
|
66
|
+
id: 'ai-mate.agent-modal.agent-delete-confirm.confirm-text',
|
|
67
|
+
defaultMessage: 'Delete'
|
|
68
|
+
},
|
|
69
|
+
title: {
|
|
70
|
+
id: 'ai-mate.agent-list.delete-agent-confirm-title',
|
|
71
|
+
defaultMessage: 'Delete "{agentName}"?',
|
|
72
|
+
description: 'Title text for the delete agent confirmation modal'
|
|
73
|
+
},
|
|
74
|
+
body: {
|
|
75
|
+
id: 'ai-mate.agent-list.delete-agent-confirm-body',
|
|
76
|
+
defaultMessage: "Are you sure you want to delete this agent? This action cannot be undone.",
|
|
77
|
+
description: 'Body text for the delete agent confirmation modal'
|
|
78
|
+
},
|
|
79
|
+
error: {
|
|
80
|
+
id: 'ai-mate.agent-list.delete-agent-error',
|
|
81
|
+
defaultMessage: 'Could not delete agent',
|
|
82
|
+
description: 'Error message displayed when an agent cannot be deleted'
|
|
83
|
+
},
|
|
84
|
+
errorAgentNotFound: {
|
|
85
|
+
id: 'ai-mate.agent-list.delete-agent-error.agent-not-found',
|
|
86
|
+
defaultMessage: 'That agent could not be found.',
|
|
87
|
+
description: 'Error message displayed when an agent cannot be found'
|
|
88
|
+
},
|
|
89
|
+
errorAgentInUse: {
|
|
90
|
+
id: 'ai-mate.agent-list.delete-agent-error.agent-in-use',
|
|
91
|
+
defaultMessage: 'Agent is currently in use. Try again later.',
|
|
92
|
+
description: 'Error message displayed when an agent is in use'
|
|
93
|
+
},
|
|
94
|
+
errorIncorrectOwner: {
|
|
95
|
+
id: 'ai-mate.agent-list.delete-agent-error.incorrect-owner',
|
|
96
|
+
defaultMessage: 'You cannot delete agents you have not created yourself. Please contact the agent owner.',
|
|
97
|
+
description: 'Error message displayed when the agent owner is incorrect'
|
|
98
|
+
},
|
|
99
|
+
agentDeletedSuccess: {
|
|
100
|
+
id: 'ai-mate.agent-list.delete-agent-success',
|
|
101
|
+
defaultMessage: 'Agent has been deleted!',
|
|
102
|
+
description: 'Success message displayed when an agent is deleted'
|
|
103
|
+
}
|
|
104
|
+
});
|
|
@@ -6,18 +6,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
12
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
11
13
|
var _primitives = require("@atlaskit/primitives");
|
|
12
14
|
var _rovoAgentComponents = require("@atlaskit/rovo-agent-components");
|
|
13
15
|
var _analytics = require("../../util/analytics");
|
|
14
|
-
var _LoadingState =
|
|
16
|
+
var _LoadingState = require("../common/LoadingState");
|
|
15
17
|
var _Error = require("../Error");
|
|
16
18
|
var _Actions = require("./Actions");
|
|
17
19
|
var _AgentProfileCardWrapper = require("./AgentProfileCardWrapper");
|
|
18
20
|
var _ConversationStarters = require("./ConversationStarters");
|
|
19
|
-
var _useAgentActions = require("./useAgentActions");
|
|
20
|
-
var
|
|
21
|
+
var _useAgentActions = require("./hooks/useAgentActions");
|
|
22
|
+
var _useDeleteAgent2 = require("./hooks/useDeleteAgent");
|
|
23
|
+
var _useSetFavouriteAgent2 = require("./hooks/useSetFavouriteAgent");
|
|
21
24
|
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); }
|
|
22
25
|
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; }
|
|
23
26
|
var styles = (0, _primitives.xcss)({
|
|
@@ -50,7 +53,9 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
50
53
|
}),
|
|
51
54
|
_onEditAgent = _useAgentUrlActions.onEditAgent,
|
|
52
55
|
_onCopyAgent = _useAgentUrlActions.onCopyAgent,
|
|
53
|
-
_onDuplicateAgent = _useAgentUrlActions.onDuplicateAgent
|
|
56
|
+
_onDuplicateAgent = _useAgentUrlActions.onDuplicateAgent,
|
|
57
|
+
onOpenChatFullScreecn = _useAgentUrlActions.onOpenChat,
|
|
58
|
+
onConversationStarter = _useAgentUrlActions.onConversationStarter;
|
|
54
59
|
var _useSetFavouriteAgent = (0, _useSetFavouriteAgent2.useSetFavouriteAgent)({
|
|
55
60
|
agentId: agent === null || agent === void 0 ? void 0 : agent.id,
|
|
56
61
|
cloudId: cloudId,
|
|
@@ -59,6 +64,11 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
59
64
|
}),
|
|
60
65
|
isStarred = _useSetFavouriteAgent.isStarred,
|
|
61
66
|
setFavourite = _useSetFavouriteAgent.setFavourite;
|
|
67
|
+
var _useDeleteAgent = (0, _useDeleteAgent2.useDeleteAgent)({
|
|
68
|
+
cloudId: cloudId,
|
|
69
|
+
product: product
|
|
70
|
+
}),
|
|
71
|
+
deleteAgent = _useDeleteAgent.deleteAgent;
|
|
62
72
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
63
73
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
64
74
|
var fireAnalytics = (0, _react.useCallback)(function (payload) {
|
|
@@ -66,13 +76,34 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
66
76
|
(0, _analytics.fireEvent)(createAnalyticsEvent, payload);
|
|
67
77
|
}
|
|
68
78
|
}, [createAnalyticsEvent]);
|
|
79
|
+
var handleOnDelete = /*#__PURE__*/function () {
|
|
80
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
81
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
82
|
+
while (1) switch (_context.prev = _context.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
if (!agent) {
|
|
85
|
+
_context.next = 3;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
_context.next = 3;
|
|
89
|
+
return deleteAgent(agent.id);
|
|
90
|
+
case 3:
|
|
91
|
+
case "end":
|
|
92
|
+
return _context.stop();
|
|
93
|
+
}
|
|
94
|
+
}, _callee);
|
|
95
|
+
}));
|
|
96
|
+
return function handleOnDelete() {
|
|
97
|
+
return _ref2.apply(this, arguments);
|
|
98
|
+
};
|
|
99
|
+
}();
|
|
69
100
|
(0, _react.useEffect)(function () {
|
|
70
101
|
if (!isLoading && agent) {
|
|
71
102
|
fireAnalytics((0, _analytics.profileCardRendered)('agent', 'content'));
|
|
72
103
|
}
|
|
73
104
|
}, [agent, fireAnalytics, isLoading]);
|
|
74
105
|
if (isLoading) {
|
|
75
|
-
return /*#__PURE__*/_react.default.createElement(_AgentProfileCardWrapper.AgentProfileCardWrapper, null, /*#__PURE__*/_react.default.createElement(_LoadingState.
|
|
106
|
+
return /*#__PURE__*/_react.default.createElement(_AgentProfileCardWrapper.AgentProfileCardWrapper, null, /*#__PURE__*/_react.default.createElement(_LoadingState.LoadingState, {
|
|
76
107
|
profileType: "agent",
|
|
77
108
|
fireAnalytics: fireAnalytics
|
|
78
109
|
}));
|
|
@@ -117,7 +148,10 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
117
148
|
isAgentDefault: agent.is_default,
|
|
118
149
|
userDefinedConversationStarters: agent.user_defined_conversation_starters,
|
|
119
150
|
onConversationStarterClick: function onConversationStarterClick(conversationStarter) {
|
|
120
|
-
|
|
151
|
+
onConversationStarter({
|
|
152
|
+
agentId: agent.id,
|
|
153
|
+
prompt: 'conversationStarter'
|
|
154
|
+
});
|
|
121
155
|
}
|
|
122
156
|
})), /*#__PURE__*/_react.default.createElement(_Actions.AgentActions, {
|
|
123
157
|
isAgentCreatedByCurrentUser: isCreatedByViewingUser,
|
|
@@ -130,11 +164,9 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
130
164
|
onDuplicateAgent: function onDuplicateAgent() {
|
|
131
165
|
return _onDuplicateAgent(agent.id);
|
|
132
166
|
},
|
|
133
|
-
onDeleteAgent:
|
|
134
|
-
throw new Error('Function not implemented.');
|
|
135
|
-
},
|
|
167
|
+
onDeleteAgent: handleOnDelete,
|
|
136
168
|
onChatClick: function onChatClick() {
|
|
137
|
-
return onOpenChat
|
|
169
|
+
return onOpenChat ? onOpenChat(agent.id) : onOpenChatFullScreecn();
|
|
138
170
|
}
|
|
139
171
|
})));
|
|
140
172
|
};
|