@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 24.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c4c9dfedf66a9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4c9dfedf66a9) -
|
|
8
|
+
Introduce agg query to agent profile card, refactor code to handle both REST and GraphQL agg type;
|
|
9
|
+
Implement authoring team to be shown if exist
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 24.19.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`f6a1676c5404f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f6a1676c5404f) -
|
|
20
|
+
Update chat to agent button text
|
|
21
|
+
|
|
3
22
|
## 24.18.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/__tests__/vr-tests/__snapshots__/agent-profilecard/agent-profile-card-example--default.png
CHANGED
|
Binary file
|
|
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -18,10 +19,37 @@ var _analytics = require("../util/analytics");
|
|
|
18
19
|
var _performance = require("../util/performance");
|
|
19
20
|
var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
|
|
20
21
|
var _errorUtils = require("./errorUtils");
|
|
22
|
+
var _graphqlUtils = require("./graphqlUtils");
|
|
21
23
|
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; }
|
|
22
24
|
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; }
|
|
23
25
|
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)); }
|
|
24
26
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
+
var buildActivationIdQuery = function buildActivationIdQuery(cloudId, product) {
|
|
28
|
+
return {
|
|
29
|
+
query: "\n\t\tquery RovoAgentProfileCard_ActivationQuery($cloudId: ID!, $product: String!) {\n\t\t\ttenantContexts(cloudIds: [$cloudId]) {\n\t\t\t\tactivationIdByProduct(product: $product) {\n\t\t\t\t\tactive\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t",
|
|
30
|
+
variables: {
|
|
31
|
+
cloudId: cloudId,
|
|
32
|
+
product: product
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
var buildRovoAgentQueryByAri = function buildRovoAgentQueryByAri(agentAri) {
|
|
37
|
+
return {
|
|
38
|
+
query: "\n\t query RovoAgentProfileCard_AgentQueryByAri($agentAri: ID!) {\n\t\t\tagentStudio_agentById(id: $agentAri) @optIn(to: \"AgentStudio\") {\n\t\t\t __typename\n\t\t\t\t... on AgentStudioAssistant {\n\t\t\t\t\tauthoringTeam {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t... on QueryError {\n\t\t\t\t\tmessage\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t",
|
|
39
|
+
variables: {
|
|
40
|
+
agentAri: agentAri
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
var buildRovoAgentQueryByAccountId = function buildRovoAgentQueryByAccountId(identityAccountId, cloudId) {
|
|
45
|
+
return {
|
|
46
|
+
query: "\n\t\tquery RovoAgentProfileCard_AgentQueryByAccountId($identityAccountId: ID!, $cloudId: ID!) {\n\t\t\tagentStudio_agentByIdentityAccountId(identityAccountId: $identityAccountId, cloudId: $cloudId) @optIn(to: \"AgentStudio\") {\n\t\t\t __typename\n\t\t\t\t... on AgentStudioAssistant {\n\t\t\t\t\tauthoringTeam {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\tprofileUrl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t... on QueryError {\n\t\t\t\t\tmessage\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t",
|
|
47
|
+
variables: {
|
|
48
|
+
identityAccountId: identityAccountId,
|
|
49
|
+
cloudId: cloudId
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
25
53
|
var createHeaders = function createHeaders(product, cloudId, isBodyJson) {
|
|
26
54
|
var headers = new Headers({
|
|
27
55
|
'X-Product': product,
|
|
@@ -47,13 +75,102 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
47
75
|
value: function basePath() {
|
|
48
76
|
return (0, _platformFeatureFlags.fg)('pt-deprecate-assistance-service') ? '/gateway/api/assist/rovo/v1/agents' : '/gateway/api/assist/agents/v1';
|
|
49
77
|
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "getActivationId",
|
|
80
|
+
value: function () {
|
|
81
|
+
var _getActivationId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(cloudId, product) {
|
|
82
|
+
var _response$tenantConte, _response$tenantConte2;
|
|
83
|
+
var response;
|
|
84
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
85
|
+
while (1) switch (_context.prev = _context.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
_context.next = 2;
|
|
88
|
+
return (0, _graphqlUtils.AGGQuery)('/gateway/api/graphql', buildActivationIdQuery(cloudId, product));
|
|
89
|
+
case 2:
|
|
90
|
+
response = _context.sent;
|
|
91
|
+
return _context.abrupt("return", (_response$tenantConte = response === null || response === void 0 || (_response$tenantConte2 = response.tenantContexts) === null || _response$tenantConte2 === void 0 || (_response$tenantConte2 = _response$tenantConte2[0]) === null || _response$tenantConte2 === void 0 || (_response$tenantConte2 = _response$tenantConte2.activationIdByProduct) === null || _response$tenantConte2 === void 0 ? void 0 : _response$tenantConte2.active) !== null && _response$tenantConte !== void 0 ? _response$tenantConte : null);
|
|
92
|
+
case 4:
|
|
93
|
+
case "end":
|
|
94
|
+
return _context.stop();
|
|
95
|
+
}
|
|
96
|
+
}, _callee);
|
|
97
|
+
}));
|
|
98
|
+
function getActivationId(_x, _x2) {
|
|
99
|
+
return _getActivationId.apply(this, arguments);
|
|
100
|
+
}
|
|
101
|
+
return getActivationId;
|
|
102
|
+
}()
|
|
103
|
+
}, {
|
|
104
|
+
key: "getAgentByARIAgg",
|
|
105
|
+
value: function () {
|
|
106
|
+
var _getAgentByARIAgg = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(agentAri) {
|
|
107
|
+
var _response$agentStudio;
|
|
108
|
+
var response;
|
|
109
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
110
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
111
|
+
case 0:
|
|
112
|
+
_context2.next = 2;
|
|
113
|
+
return (0, _graphqlUtils.AGGQuery)('/gateway/api/graphql', buildRovoAgentQueryByAri(agentAri));
|
|
114
|
+
case 2:
|
|
115
|
+
response = _context2.sent;
|
|
116
|
+
if (!(((_response$agentStudio = response.agentStudio_agentById) === null || _response$agentStudio === void 0 ? void 0 : _response$agentStudio.__typename) === 'QueryError')) {
|
|
117
|
+
_context2.next = 5;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
throw new Error("ProfileCard agentStudio_agentById returning QueryError: ".concat(response.agentStudio_agentById.message));
|
|
121
|
+
case 5:
|
|
122
|
+
return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.agentStudio_agentById);
|
|
123
|
+
case 6:
|
|
124
|
+
case "end":
|
|
125
|
+
return _context2.stop();
|
|
126
|
+
}
|
|
127
|
+
}, _callee2);
|
|
128
|
+
}));
|
|
129
|
+
function getAgentByARIAgg(_x3) {
|
|
130
|
+
return _getAgentByARIAgg.apply(this, arguments);
|
|
131
|
+
}
|
|
132
|
+
return getAgentByARIAgg;
|
|
133
|
+
}()
|
|
134
|
+
}, {
|
|
135
|
+
key: "getAgentByAccountIdAgg",
|
|
136
|
+
value: function () {
|
|
137
|
+
var _getAgentByAccountIdAgg = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(identityAccountId, cloudId) {
|
|
138
|
+
var _response$agentStudio2;
|
|
139
|
+
var response;
|
|
140
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
141
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
142
|
+
case 0:
|
|
143
|
+
_context3.next = 2;
|
|
144
|
+
return (0, _graphqlUtils.AGGQuery)('/gateway/api/graphql', buildRovoAgentQueryByAccountId(identityAccountId, cloudId));
|
|
145
|
+
case 2:
|
|
146
|
+
response = _context3.sent;
|
|
147
|
+
if (!(((_response$agentStudio2 = response.agentStudio_agentByIdentityAccountId) === null || _response$agentStudio2 === void 0 ? void 0 : _response$agentStudio2.__typename) === 'QueryError')) {
|
|
148
|
+
_context3.next = 5;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
throw new Error("ProfileCard agentStudio_agentByIdentityAccountId returning QueryError: ".concat(response.agentStudio_agentByIdentityAccountId.message));
|
|
152
|
+
case 5:
|
|
153
|
+
return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.agentStudio_agentByIdentityAccountId);
|
|
154
|
+
case 6:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context3.stop();
|
|
157
|
+
}
|
|
158
|
+
}, _callee3);
|
|
159
|
+
}));
|
|
160
|
+
function getAgentByAccountIdAgg(_x4, _x5) {
|
|
161
|
+
return _getAgentByAccountIdAgg.apply(this, arguments);
|
|
162
|
+
}
|
|
163
|
+
return getAgentByAccountIdAgg;
|
|
164
|
+
}()
|
|
50
165
|
}, {
|
|
51
166
|
key: "makeRequest",
|
|
52
|
-
value: function makeRequest(id,
|
|
167
|
+
value: function makeRequest(id, analyticsNext) {
|
|
168
|
+
var _this2 = this;
|
|
53
169
|
var product = this.options.productIdentifier || 'rovo';
|
|
54
170
|
var headers = createHeaders(product, this.options.cloudId);
|
|
171
|
+
var restPromise;
|
|
55
172
|
if (id.type === 'identity') {
|
|
56
|
-
|
|
173
|
+
restPromise = fetch(new Request("".concat(this.basePath(), "/accountid/").concat(id.value), {
|
|
57
174
|
method: 'GET',
|
|
58
175
|
credentials: 'include',
|
|
59
176
|
mode: 'cors',
|
|
@@ -61,20 +178,71 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
61
178
|
})).then(function (response) {
|
|
62
179
|
return response.json();
|
|
63
180
|
});
|
|
181
|
+
} else {
|
|
182
|
+
restPromise = fetch(new Request("".concat(this.basePath(), "/").concat(id.value), {
|
|
183
|
+
method: 'GET',
|
|
184
|
+
credentials: 'include',
|
|
185
|
+
mode: 'cors',
|
|
186
|
+
headers: headers
|
|
187
|
+
})).then(function (response) {
|
|
188
|
+
return response.json();
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (!(0, _platformFeatureFlags.fg)('agent_studio_permissions_settings_m3_profiles')) {
|
|
192
|
+
return restPromise.then(function (restData) {
|
|
193
|
+
return {
|
|
194
|
+
restData: restData,
|
|
195
|
+
aggData: null
|
|
196
|
+
};
|
|
197
|
+
});
|
|
64
198
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
199
|
+
var aggStartTime = (0, _performance.getPageTime)();
|
|
200
|
+
var aggPromise = this.getActivationId(this.options.cloudId || '', this.options.productIdentifier || 'rovo').then(function (activationId) {
|
|
201
|
+
if (!activationId) {
|
|
202
|
+
throw new Error('ProfileCard Activation ID not found');
|
|
203
|
+
}
|
|
204
|
+
if (id.type === 'identity') {
|
|
205
|
+
return _this2.getAgentByAccountIdAgg(id.value, _this2.options.cloudId || '');
|
|
206
|
+
} else {
|
|
207
|
+
var agentAri = "ari:cloud:rovo::agent/activation/".concat(activationId, "/").concat(id.value);
|
|
208
|
+
return _this2.getAgentByARIAgg(agentAri);
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
// We are not going to break the flow if the AGG endpoint fails for now
|
|
212
|
+
// @TODO once all the data moved to AGG, we can remove this catch
|
|
213
|
+
.catch(function (error) {
|
|
214
|
+
if (analyticsNext) {
|
|
215
|
+
analyticsNext('operational.rovoAgentProfilecard.failed.request', _objectSpread(_objectSpread({}, (0, _errorUtils.getErrorAttributes)(error)), {}, {
|
|
216
|
+
errorType: 'RovoAgentProfileCardAggError',
|
|
217
|
+
duration: (0, _performance.getPageTime)() - aggStartTime,
|
|
218
|
+
gateway: true,
|
|
219
|
+
firedAt: Math.round((0, _performance.getPageTime)())
|
|
220
|
+
}, _analytics.PACKAGE_META_DATA));
|
|
221
|
+
}
|
|
222
|
+
return Promise.resolve(null);
|
|
223
|
+
});
|
|
224
|
+
return Promise.all([restPromise, aggPromise]).then(function (_ref) {
|
|
225
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
226
|
+
restData = _ref2[0],
|
|
227
|
+
aggData = _ref2[1];
|
|
228
|
+
return {
|
|
229
|
+
restData: restData,
|
|
230
|
+
aggData: aggData
|
|
231
|
+
};
|
|
72
232
|
});
|
|
73
233
|
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* This function will call both REST and AGG endpoints to get the agent profile
|
|
237
|
+
* There are some data that is only available in the AGG endpoint, so we need to call both
|
|
238
|
+
* For any new fields, please only add them to the AGG endpoint
|
|
239
|
+
*
|
|
240
|
+
* @TODO migrate everything to AGG endpoint
|
|
241
|
+
*/
|
|
74
242
|
}, {
|
|
75
243
|
key: "getProfile",
|
|
76
244
|
value: function getProfile(id, analytics, analyticsNext) {
|
|
77
|
-
var
|
|
245
|
+
var _this3 = this;
|
|
78
246
|
if (!id.value) {
|
|
79
247
|
return Promise.reject(new Error('Id is missing'));
|
|
80
248
|
}
|
|
@@ -98,9 +266,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
98
266
|
analytics((0, _analytics.agentRequestAnalytics)('triggered'));
|
|
99
267
|
}
|
|
100
268
|
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
269
|
+
_this3.makeRequest(id, analyticsNext).then(function (data) {
|
|
270
|
+
if (_this3.cache) {
|
|
271
|
+
_this3.setCachedProfile(id.value, data);
|
|
104
272
|
}
|
|
105
273
|
if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
|
|
106
274
|
if (analyticsNext) {
|
|
@@ -145,13 +313,13 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
145
313
|
}, {
|
|
146
314
|
key: "deleteAgent",
|
|
147
315
|
value: function deleteAgent(agentId, analytics, analyticsNext) {
|
|
148
|
-
var
|
|
316
|
+
var _this4 = this;
|
|
149
317
|
if (!this.options.cloudId) {
|
|
150
318
|
return Promise.reject(new Error('cloudId is missing'));
|
|
151
319
|
}
|
|
152
320
|
return new Promise(function (resolve, reject) {
|
|
153
321
|
var startTime = (0, _performance.getPageTime)();
|
|
154
|
-
var product =
|
|
322
|
+
var product = _this4.options.productIdentifier || 'rovo';
|
|
155
323
|
if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
|
|
156
324
|
if (analyticsNext) {
|
|
157
325
|
analyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
|
|
@@ -163,8 +331,8 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
163
331
|
analytics((0, _analytics.agentRequestAnalytics)('triggered'));
|
|
164
332
|
}
|
|
165
333
|
}
|
|
166
|
-
var headers = createHeaders(product,
|
|
167
|
-
fetch(new Request("".concat(
|
|
334
|
+
var headers = createHeaders(product, _this4.options.cloudId);
|
|
335
|
+
fetch(new Request("".concat(_this4.basePath(), "/").concat(agentId), {
|
|
168
336
|
method: 'DELETE',
|
|
169
337
|
credentials: 'include',
|
|
170
338
|
mode: 'cors',
|
|
@@ -213,18 +381,18 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
213
381
|
}, {
|
|
214
382
|
key: "setFavouriteAgent",
|
|
215
383
|
value: function setFavouriteAgent(agentId, isFavourite, analytics, analyticsNext) {
|
|
216
|
-
var
|
|
384
|
+
var _this5 = this;
|
|
217
385
|
if (!this.options.cloudId) {
|
|
218
386
|
return Promise.reject(new Error('cloudId is missing'));
|
|
219
387
|
}
|
|
220
388
|
return new Promise( /*#__PURE__*/function () {
|
|
221
|
-
var
|
|
389
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resolve, reject) {
|
|
222
390
|
var startTime, product, actionSubjectId, requestMethod, headers;
|
|
223
|
-
return _regenerator.default.wrap(function
|
|
224
|
-
while (1) switch (
|
|
391
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
392
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
225
393
|
case 0:
|
|
226
394
|
startTime = (0, _performance.getPageTime)();
|
|
227
|
-
product =
|
|
395
|
+
product = _this5.options.productIdentifier || 'rovo';
|
|
228
396
|
actionSubjectId = isFavourite ? 'favourite' : 'unfavourite';
|
|
229
397
|
requestMethod = isFavourite ? 'POST' : 'DELETE';
|
|
230
398
|
if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
|
|
@@ -238,9 +406,9 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
238
406
|
analytics((0, _analytics.agentRequestAnalytics)('triggered', 'actionSubjectId'));
|
|
239
407
|
}
|
|
240
408
|
}
|
|
241
|
-
headers = createHeaders(product,
|
|
242
|
-
|
|
243
|
-
return fetch(new Request("".concat(
|
|
409
|
+
headers = createHeaders(product, _this5.options.cloudId);
|
|
410
|
+
_context4.next = 8;
|
|
411
|
+
return fetch(new Request("".concat(_this5.basePath(), "/").concat(agentId, "/favourite"), {
|
|
244
412
|
method: requestMethod,
|
|
245
413
|
credentials: 'include',
|
|
246
414
|
mode: 'cors',
|
|
@@ -286,25 +454,25 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
286
454
|
});
|
|
287
455
|
case 8:
|
|
288
456
|
case "end":
|
|
289
|
-
return
|
|
457
|
+
return _context4.stop();
|
|
290
458
|
}
|
|
291
|
-
},
|
|
459
|
+
}, _callee4);
|
|
292
460
|
}));
|
|
293
|
-
return function (
|
|
294
|
-
return
|
|
461
|
+
return function (_x6, _x7) {
|
|
462
|
+
return _ref3.apply(this, arguments);
|
|
295
463
|
};
|
|
296
464
|
}());
|
|
297
465
|
}
|
|
298
466
|
}, {
|
|
299
467
|
key: "getPermissions",
|
|
300
468
|
value: function getPermissions(id, fireAnalytics, fireAnalyticsNext) {
|
|
301
|
-
var
|
|
469
|
+
var _this6 = this;
|
|
302
470
|
if (!this.options.cloudId) {
|
|
303
471
|
return Promise.reject(new Error('cloudId is missing'));
|
|
304
472
|
}
|
|
305
473
|
return new Promise(function (resolve, reject) {
|
|
306
474
|
var startTime = (0, _performance.getPageTime)();
|
|
307
|
-
var product =
|
|
475
|
+
var product = _this6.options.productIdentifier || 'rovo';
|
|
308
476
|
if ((0, _platformFeatureFlags.fg)('ptc-enable-profile-card-analytics-refactor')) {
|
|
309
477
|
if (fireAnalyticsNext) {
|
|
310
478
|
fireAnalyticsNext('operational.rovoAgentProfilecard.triggered.request', _objectSpread({
|
|
@@ -316,7 +484,7 @@ var RovoAgentCardClient = exports.default = /*#__PURE__*/function (_CachingClien
|
|
|
316
484
|
fireAnalytics((0, _analytics.agentRequestAnalytics)('triggered'));
|
|
317
485
|
}
|
|
318
486
|
}
|
|
319
|
-
var headers = createHeaders(product,
|
|
487
|
+
var headers = createHeaders(product, _this6.options.cloudId, true);
|
|
320
488
|
fetch(new Request("/gateway/api/assist/api/rovo/v2/permissions/agents/".concat(id), {
|
|
321
489
|
method: 'POST',
|
|
322
490
|
credentials: 'include',
|
|
@@ -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', "24.
|
|
14
|
+
headers.append('atl-client-version', "24.19.0");
|
|
15
15
|
return headers;
|
|
16
16
|
};
|
|
17
17
|
function getOrgIdForCloudIdFromAGG(_x, _x2) {
|
|
@@ -66,7 +66,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
|
|
|
66
66
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
67
67
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
68
68
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
69
|
-
headers.append('atl-client-version', "24.
|
|
69
|
+
headers.append('atl-client-version', "24.19.0");
|
|
70
70
|
return headers;
|
|
71
71
|
};
|
|
72
72
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -164,9 +164,9 @@ var _AgentActions = function _AgentActions(_ref) {
|
|
|
164
164
|
};
|
|
165
165
|
var messages = (0, _reactIntlNext.defineMessages)({
|
|
166
166
|
actionChatToAgent: {
|
|
167
|
-
id: 'ptc-directory.agent-profile.action.dropdown.chat-
|
|
168
|
-
defaultMessage: 'Chat
|
|
169
|
-
description: 'Text for the "chat
|
|
167
|
+
id: 'ptc-directory.agent-profile.action.dropdown.chat-with-agent',
|
|
168
|
+
defaultMessage: 'Chat with Agent',
|
|
169
|
+
description: 'Text for the "chat with agent" action to chat to the agent'
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
var AgentActions = exports.AgentActions = (0, _platformFeatureFlagsReact.componentWithFG)('profilecard_primitives_compiled', _ActionsCompiled.AgentActions, _AgentActions);
|
|
@@ -144,8 +144,8 @@ var AgentActions = exports.AgentActions = function AgentActions(_ref) {
|
|
|
144
144
|
};
|
|
145
145
|
var messages = (0, _reactIntlNext.defineMessages)({
|
|
146
146
|
actionChatToAgent: {
|
|
147
|
-
id: 'ptc-directory.agent-profile.action.dropdown.chat-
|
|
148
|
-
defaultMessage: 'Chat
|
|
149
|
-
description: 'Text for the "chat
|
|
147
|
+
id: 'ptc-directory.agent-profile.action.dropdown.chat-with-agent',
|
|
148
|
+
defaultMessage: 'Chat with Agent',
|
|
149
|
+
description: 'Text for the "chat with agent" action to chat to the agent'
|
|
150
150
|
}
|
|
151
151
|
});
|
|
@@ -57,40 +57,51 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
57
57
|
}),
|
|
58
58
|
profileHref = _navigateToTeamsApp.href;
|
|
59
59
|
var getCreator = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
60
|
-
var
|
|
61
|
-
var creatorInfo;
|
|
60
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
61
|
+
var creator_type, creator, authoringTeam, _authoringTeam$displa, _authoringTeam$profil, creatorInfo;
|
|
62
62
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
63
63
|
while (1) switch (_context.prev = _context.next) {
|
|
64
64
|
case 0:
|
|
65
|
+
creator_type = _ref.creator_type, creator = _ref.creator, authoringTeam = _ref.authoringTeam;
|
|
65
66
|
if (creator) {
|
|
66
|
-
_context.next =
|
|
67
|
+
_context.next = 3;
|
|
67
68
|
break;
|
|
68
69
|
}
|
|
69
70
|
return _context.abrupt("return", undefined);
|
|
70
|
-
case
|
|
71
|
+
case 3:
|
|
71
72
|
_context.t0 = creator_type;
|
|
72
|
-
_context.next = _context.t0 === 'SYSTEM' ?
|
|
73
|
+
_context.next = _context.t0 === 'SYSTEM' ? 6 : _context.t0 === 'THIRD_PARTY' ? 7 : _context.t0 === 'CUSTOMER' ? 8 : 22;
|
|
73
74
|
break;
|
|
74
|
-
case
|
|
75
|
+
case 6:
|
|
75
76
|
return _context.abrupt("return", {
|
|
76
77
|
type: 'SYSTEM'
|
|
77
78
|
});
|
|
78
|
-
case
|
|
79
|
+
case 7:
|
|
79
80
|
return _context.abrupt("return", {
|
|
80
81
|
type: 'THIRD_PARTY',
|
|
81
82
|
name: creator !== null && creator !== void 0 ? creator : ''
|
|
82
83
|
});
|
|
83
|
-
case
|
|
84
|
-
_context.prev =
|
|
84
|
+
case 8:
|
|
85
|
+
_context.prev = 8;
|
|
85
86
|
if (!(!creatorUserId || !props.cloudId)) {
|
|
86
|
-
_context.next =
|
|
87
|
+
_context.next = 11;
|
|
87
88
|
break;
|
|
88
89
|
}
|
|
89
90
|
return _context.abrupt("return", undefined);
|
|
90
|
-
case
|
|
91
|
-
|
|
91
|
+
case 11:
|
|
92
|
+
if (!(authoringTeam && (0, _platformFeatureFlags.fg)('agent_studio_permissions_settings_m3_profiles'))) {
|
|
93
|
+
_context.next = 13;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return _context.abrupt("return", {
|
|
97
|
+
type: 'CUSTOMER',
|
|
98
|
+
name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
|
|
99
|
+
profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
|
|
100
|
+
});
|
|
101
|
+
case 13:
|
|
102
|
+
_context.next = 15;
|
|
92
103
|
return props.resourceClient.getProfile(creatorUserId, props.cloudId, fireAnalytics, fireEventNext);
|
|
93
|
-
case
|
|
104
|
+
case 15:
|
|
94
105
|
creatorInfo = _context.sent;
|
|
95
106
|
return _context.abrupt("return", {
|
|
96
107
|
type: 'CUSTOMER',
|
|
@@ -98,24 +109,24 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
98
109
|
profileLink: (0, _platformFeatureFlags.fg)('platform-adopt-teams-nav-config') ? profileHref : "/people/".concat(creatorUserId),
|
|
99
110
|
id: creatorUserId
|
|
100
111
|
});
|
|
101
|
-
case 16:
|
|
102
|
-
_context.prev = 16;
|
|
103
|
-
_context.t1 = _context["catch"](7);
|
|
104
|
-
return _context.abrupt("return", undefined);
|
|
105
112
|
case 19:
|
|
113
|
+
_context.prev = 19;
|
|
114
|
+
_context.t1 = _context["catch"](8);
|
|
115
|
+
return _context.abrupt("return", undefined);
|
|
116
|
+
case 22:
|
|
106
117
|
return _context.abrupt("return", undefined);
|
|
107
|
-
case
|
|
118
|
+
case 23:
|
|
108
119
|
case "end":
|
|
109
120
|
return _context.stop();
|
|
110
121
|
}
|
|
111
|
-
}, _callee, null, [[
|
|
122
|
+
}, _callee, null, [[8, 19]]);
|
|
112
123
|
}));
|
|
113
|
-
return function (_x
|
|
114
|
-
return
|
|
124
|
+
return function (_x) {
|
|
125
|
+
return _ref2.apply(this, arguments);
|
|
115
126
|
};
|
|
116
127
|
}(), [creatorUserId, fireAnalytics, fireEventNext, props.cloudId, props.resourceClient, profileHref]);
|
|
117
128
|
var fetchData = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
118
|
-
var profileData, agentCreatorInfo;
|
|
129
|
+
var _profileResult$aggDat, _profileResult$aggDat2, profileResult, profileData, agentCreatorInfo;
|
|
119
130
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
120
131
|
while (1) switch (_context2.prev = _context2.next) {
|
|
121
132
|
case 0:
|
|
@@ -127,29 +138,34 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
|
|
|
127
138
|
value: props.accountId
|
|
128
139
|
}, fireAnalytics, fireEventNext);
|
|
129
140
|
case 4:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
141
|
+
profileResult = _context2.sent;
|
|
142
|
+
profileData = profileResult.restData;
|
|
143
|
+
_context2.next = 8;
|
|
144
|
+
return getCreator({
|
|
145
|
+
creator_type: profileData === null || profileData === void 0 ? void 0 : profileData.creator_type,
|
|
146
|
+
creator: (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined,
|
|
147
|
+
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
|
|
148
|
+
});
|
|
149
|
+
case 8:
|
|
134
150
|
agentCreatorInfo = _context2.sent;
|
|
135
151
|
setAgentData(_objectSpread(_objectSpread({}, profileData), {}, {
|
|
136
152
|
creatorInfo: agentCreatorInfo
|
|
137
153
|
}));
|
|
138
|
-
_context2.next =
|
|
154
|
+
_context2.next = 15;
|
|
139
155
|
break;
|
|
140
|
-
case
|
|
141
|
-
_context2.prev =
|
|
156
|
+
case 12:
|
|
157
|
+
_context2.prev = 12;
|
|
142
158
|
_context2.t0 = _context2["catch"](1);
|
|
143
159
|
setError(_context2.t0);
|
|
144
|
-
case
|
|
145
|
-
_context2.prev =
|
|
160
|
+
case 15:
|
|
161
|
+
_context2.prev = 15;
|
|
146
162
|
setIsLoading(false);
|
|
147
|
-
return _context2.finish(
|
|
148
|
-
case
|
|
163
|
+
return _context2.finish(15);
|
|
164
|
+
case 18:
|
|
149
165
|
case "end":
|
|
150
166
|
return _context2.stop();
|
|
151
167
|
}
|
|
152
|
-
}, _callee2, null, [[1,
|
|
168
|
+
}, _callee2, null, [[1, 12, 15, 18]]);
|
|
153
169
|
})), [fireAnalytics, fireEventNext, getCreator, props.accountId, props.resourceClient]);
|
|
154
170
|
(0, _react.useEffect)(function () {
|
|
155
171
|
fetchData();
|