@atlaskit/profilecard 24.19.0 → 24.20.1
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 +18 -21
- 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/AgentProfileCardResourced.js +55 -34
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +55 -33
- 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/AgentProfileCardResourced.js +26 -3
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +26 -3
- 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/AgentProfileCardResourced.js +55 -34
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +55 -33
- 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 +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 24.20.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 24.20.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`c4c9dfedf66a9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4c9dfedf66a9) -
|
|
14
|
+
Introduce agg query to agent profile card, refactor code to handle both REST and GraphQL agg type;
|
|
15
|
+
Implement authoring team to be shown if exist
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 24.19.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -427,7 +445,6 @@
|
|
|
427
445
|
[`c6101121ae1df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c6101121ae1df) -
|
|
428
446
|
Removed unused component props in response to the removal of `isAgentCreatedByUser` from the agent
|
|
429
447
|
dropdown actions component. Changes:
|
|
430
|
-
|
|
431
448
|
- `AgentProfileCard`: removed `isCreatedByViewingUser` / `product` props. `isCreatedByViewingUser`
|
|
432
449
|
is no longer needed for action dropdown permission checks, and `product` is an unused prop
|
|
433
450
|
- `AgentProfileCardResourced`: removed `viewingUserId` / `product` props. `viewingUserId` is no
|
|
@@ -3548,7 +3565,6 @@
|
|
|
3548
3565
|
|
|
3549
3566
|
Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
|
|
3550
3567
|
[6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
|
|
3551
|
-
|
|
3552
3568
|
- @atlaskit/docs@8.3.2
|
|
3553
3569
|
- @atlaskit/avatar@17.1.7
|
|
3554
3570
|
- @atlaskit/button@13.3.7
|
|
@@ -3770,7 +3786,6 @@
|
|
|
3770
3786
|
- [patch][18dfac7332](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/18dfac7332):
|
|
3771
3787
|
|
|
3772
3788
|
In this PR, we are:
|
|
3773
|
-
|
|
3774
3789
|
- Re-introducing dist build folders
|
|
3775
3790
|
- Adding back cjs
|
|
3776
3791
|
- Replacing es5 by cjs and es2015 by esm
|
|
@@ -3831,7 +3846,6 @@
|
|
|
3831
3846
|
## 10.2.5
|
|
3832
3847
|
|
|
3833
3848
|
- [patch][b0ef06c685](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b0ef06c685):
|
|
3834
|
-
|
|
3835
3849
|
- This is just a safety release in case anything strange happened in in the previous one. See Pull
|
|
3836
3850
|
Request #5942 for details
|
|
3837
3851
|
|
|
@@ -3856,7 +3870,6 @@
|
|
|
3856
3870
|
## 10.2.2
|
|
3857
3871
|
|
|
3858
3872
|
- [patch][afd34e36b0](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/afd34e36b0):
|
|
3859
|
-
|
|
3860
3873
|
- Hide public name when it matches the full name
|
|
3861
3874
|
|
|
3862
3875
|
## 10.2.1
|
|
@@ -3869,27 +3882,23 @@
|
|
|
3869
3882
|
## 10.2.0
|
|
3870
3883
|
|
|
3871
3884
|
- [minor][e7d7fe8252](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e7d7fe8252):
|
|
3872
|
-
|
|
3873
3885
|
- Make full name and public name in the same line. Remove `@` symbol in front of public name.
|
|
3874
3886
|
Remove mention icon
|
|
3875
3887
|
|
|
3876
3888
|
## 10.1.0
|
|
3877
3889
|
|
|
3878
3890
|
- [minor][5a49043dac](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/5a49043dac):
|
|
3879
|
-
|
|
3880
3891
|
- Enable strictPropertyInitialization in tsconfig.base
|
|
3881
3892
|
|
|
3882
3893
|
## 10.0.0
|
|
3883
3894
|
|
|
3884
3895
|
- [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
|
|
3885
|
-
|
|
3886
3896
|
- Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
|
|
3887
3897
|
this package, please ensure you use at least this version of react and react-dom.
|
|
3888
3898
|
|
|
3889
3899
|
## 9.0.5
|
|
3890
3900
|
|
|
3891
3901
|
- [patch][d3cad2622e](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/d3cad2622e):
|
|
3892
|
-
|
|
3893
3902
|
- Removes babel-runtime in favour of @babel/runtime
|
|
3894
3903
|
|
|
3895
3904
|
## 9.0.4
|
|
@@ -3904,7 +3913,6 @@
|
|
|
3904
3913
|
## 9.0.3
|
|
3905
3914
|
|
|
3906
3915
|
- [patch][50e8c82ec4](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/50e8c82ec4):
|
|
3907
|
-
|
|
3908
3916
|
- index.ts is now ignored when published to npm to avoid ambiguity between ts and js files
|
|
3909
3917
|
|
|
3910
3918
|
## 9.0.2
|
|
@@ -3938,7 +3946,6 @@
|
|
|
3938
3946
|
## 9.0.0
|
|
3939
3947
|
|
|
3940
3948
|
- [major][bfca144ea5](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/bfca144ea5):
|
|
3941
|
-
|
|
3942
3949
|
- Refactored internal components. Moved to Typescript. Updated named exports. Updated type
|
|
3943
3950
|
definitions.
|
|
3944
3951
|
|
|
@@ -3959,19 +3966,16 @@
|
|
|
3959
3966
|
## 8.0.1
|
|
3960
3967
|
|
|
3961
3968
|
- [patch][9a0c34d490](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9a0c34d490):
|
|
3962
|
-
|
|
3963
3969
|
- Fixes package.json to not exclude built files
|
|
3964
3970
|
|
|
3965
3971
|
## 8.0.0
|
|
3966
3972
|
|
|
3967
3973
|
- [major][dbff4fdcf9](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/dbff4fdcf9):
|
|
3968
|
-
|
|
3969
3974
|
- Remove presence from profilecard now that users cannot use Stride to control it
|
|
3970
3975
|
|
|
3971
3976
|
## 7.0.0
|
|
3972
3977
|
|
|
3973
3978
|
- [major][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
|
|
3974
|
-
|
|
3975
3979
|
- Drop ES5 from all the flow modules
|
|
3976
3980
|
|
|
3977
3981
|
### Dropping CJS support in all @atlaskit packages
|
|
@@ -4016,7 +4020,6 @@
|
|
|
4016
4020
|
## 6.2.0
|
|
4017
4021
|
|
|
4018
4022
|
- [minor][e0e5dd69a7](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e0e5dd69a7):
|
|
4019
|
-
|
|
4020
4023
|
- Support 2 new props "hasStatusLozengeForDisabledAccount" and "customMessageForDisabledAccount"
|
|
4021
4024
|
|
|
4022
4025
|
## 6.1.5
|
|
@@ -4031,13 +4034,11 @@
|
|
|
4031
4034
|
## 6.1.4
|
|
4032
4035
|
|
|
4033
4036
|
- [patch][ba95c0e](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/ba95c0e):
|
|
4034
|
-
|
|
4035
4037
|
- Remove typescript type InjectedIntlProps from flow js code
|
|
4036
4038
|
|
|
4037
4039
|
## 6.1.3
|
|
4038
4040
|
|
|
4039
4041
|
- [patch][3ef5292](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/3ef5292):
|
|
4040
|
-
|
|
4041
4042
|
- Include type definitions in npm package
|
|
4042
4043
|
|
|
4043
4044
|
## 6.1.2
|
|
@@ -4069,7 +4070,6 @@
|
|
|
4069
4070
|
## 6.1.0
|
|
4070
4071
|
|
|
4071
4072
|
- [minor][a2da489](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/a2da489):
|
|
4072
|
-
|
|
4073
4073
|
- - wrap profile card in IntlProvider and support i18n
|
|
4074
4074
|
|
|
4075
4075
|
## 6.0.3
|
|
@@ -4094,19 +4094,16 @@
|
|
|
4094
4094
|
## 6.0.1
|
|
4095
4095
|
|
|
4096
4096
|
- [patch][9d63842](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9d63842):
|
|
4097
|
-
|
|
4098
4097
|
- Fixed a bug where content is not rendered for cards of users whose accounts are closed
|
|
4099
4098
|
|
|
4100
4099
|
## 6.0.0
|
|
4101
4100
|
|
|
4102
4101
|
- [major][9c0844d](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9c0844d):
|
|
4103
|
-
|
|
4104
4102
|
- Replace "isActive" prop with new "status" prop and adding react-intl messages
|
|
4105
4103
|
|
|
4106
4104
|
## 5.0.0
|
|
4107
4105
|
|
|
4108
4106
|
- [major][a6dd6e3](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/a6dd6e3):
|
|
4109
|
-
|
|
4110
4107
|
- Removed isCensored prop as this state no longer exists
|
|
4111
4108
|
|
|
4112
4109
|
## 4.0.10
|
|
@@ -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.20.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.20.0");
|
|
70
70
|
return headers;
|
|
71
71
|
};
|
|
72
72
|
function getTeamFromAGG(_x, _x2, _x3) {
|