@atlaskit/profilecard 19.28.1 → 20.0.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 +13 -0
- package/dist/cjs/client/ProfileCardClient.js +3 -4
- package/dist/cjs/client/TeamCentralCardClient.js +65 -114
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/mocks/mock-profile-client.js +0 -5
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/es2019/client/ProfileCardClient.js +4 -4
- package/dist/es2019/client/TeamCentralCardClient.js +31 -66
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/mocks/mock-profile-client.js +0 -3
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/esm/client/ProfileCardClient.js +3 -4
- package/dist/esm/client/TeamCentralCardClient.js +64 -113
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/mocks/mock-profile-client.js +0 -5
- package/dist/esm/util/analytics.js +1 -1
- package/dist/types/client/ProfileCardClient.d.ts +2 -2
- package/dist/types/client/TeamCentralCardClient.d.ts +18 -20
- package/dist/types/types.d.ts +2 -6
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +2 -2
- package/dist/types-ts4.5/client/TeamCentralCardClient.d.ts +18 -20
- package/dist/types-ts4.5/types.d.ts +2 -6
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 20.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#144443](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/144443)
|
|
8
|
+
[`8e1afd419b5e4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8e1afd419b5e4) -
|
|
9
|
+
Add flagged behaviour to call Atlassian Home APIs via sharded routes, and centralise the
|
|
10
|
+
configuration of Stargate routes so that we can appropriately shard the calls
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 19.28.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
11
|
var _atlassianContext = require("@atlaskit/atlassian-context");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _RovoAgentCardClient = _interopRequireDefault(require("./RovoAgentCardClient"));
|
|
13
14
|
var _TeamCentralCardClient = _interopRequireDefault(require("./TeamCentralCardClient"));
|
|
14
15
|
var _TeamProfileCardClient = _interopRequireDefault(require("./TeamProfileCardClient"));
|
|
@@ -101,9 +102,7 @@ function maybeCreateTeamCentralClient(config, clients) {
|
|
|
101
102
|
if (clients !== null && clients !== void 0 && clients.teamCentralClient) {
|
|
102
103
|
return clients.teamCentralClient;
|
|
103
104
|
}
|
|
104
|
-
var
|
|
105
|
-
return
|
|
106
|
-
teamCentralUrl: teamCentralUrl
|
|
107
|
-
})) : undefined;
|
|
105
|
+
var teamCentralEnabled = (0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls') ? config.teamCentralDisabled !== true : config.teamCentralUrl;
|
|
106
|
+
return teamCentralEnabled ? new _TeamCentralCardClient.default(_objectSpread({}, config)) : undefined;
|
|
108
107
|
}
|
|
109
108
|
var _default = exports.default = ProfileCardClient;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = exports.buildReportingLinesQuery =
|
|
7
|
+
exports.default = exports.buildReportingLinesQuery = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -12,6 +12,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _CachingClient2 = _interopRequireDefault(require("./CachingClient"));
|
|
16
17
|
var _graphqlUtils = require("./graphqlUtils");
|
|
17
18
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
@@ -24,20 +25,6 @@ var buildReportingLinesQuery = exports.buildReportingLinesQuery = function build
|
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
};
|
|
27
|
-
var buildCheckFeatureFlagQuery = exports.buildCheckFeatureFlagQuery = function buildCheckFeatureFlagQuery(featureKey, context) {
|
|
28
|
-
return {
|
|
29
|
-
query: "\n query isFeatureKeyEnabled($featureKey: String!, $context: [IsFeatureEnabledContextInput]) {\n isFeatureEnabled(featureKey: $featureKey, context: $context) {\n enabled\n }\n }\n ",
|
|
30
|
-
variables: {
|
|
31
|
-
featureKey: featureKey,
|
|
32
|
-
context: context || []
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
function hasTCWorkspace(config) {
|
|
37
|
-
return config.cloudId ? fetch("/gateway/api/watermelon/organization/containsAnyWorkspace?cloudId=".concat(config.cloudId)).then(function (res) {
|
|
38
|
-
return !res || res && res.ok;
|
|
39
|
-
}) : Promise.resolve(false);
|
|
40
|
-
}
|
|
41
28
|
var isTCReadyPromiseMap = new Map();
|
|
42
29
|
var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
43
30
|
(0, _inherits2.default)(TeamCentralCardClient, _CachingClient);
|
|
@@ -57,7 +44,6 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
57
44
|
_this = _super.call(this, options);
|
|
58
45
|
_this.options = options;
|
|
59
46
|
_this.bypassOnFailure = false;
|
|
60
|
-
_this.featureFlagKeys = new Map();
|
|
61
47
|
_this.isTCReadyPromise = _this.createTcReadyPromise(options);
|
|
62
48
|
return _this;
|
|
63
49
|
}
|
|
@@ -67,75 +53,13 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
67
53
|
if (config.cloudId) {
|
|
68
54
|
var promise = isTCReadyPromiseMap.get(config.cloudId);
|
|
69
55
|
if (!promise) {
|
|
70
|
-
promise = hasTCWorkspace(config);
|
|
56
|
+
promise = this.hasTCWorkspace(config);
|
|
71
57
|
isTCReadyPromiseMap.set(config.cloudId, promise);
|
|
72
58
|
}
|
|
73
59
|
return promise;
|
|
74
60
|
}
|
|
75
61
|
return Promise.resolve(true);
|
|
76
62
|
}
|
|
77
|
-
}, {
|
|
78
|
-
key: "makeFeatureFlagCheckRequest",
|
|
79
|
-
value: function () {
|
|
80
|
-
var _makeFeatureFlagCheckRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(featureKey, context) {
|
|
81
|
-
var query, response;
|
|
82
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
83
|
-
while (1) switch (_context.prev = _context.next) {
|
|
84
|
-
case 0:
|
|
85
|
-
if (this.options.teamCentralUrl) {
|
|
86
|
-
_context.next = 2;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
90
|
-
case 2:
|
|
91
|
-
query = buildCheckFeatureFlagQuery(featureKey, context);
|
|
92
|
-
_context.next = 5;
|
|
93
|
-
return (0, _graphqlUtils.directoryGraphqlQuery)("".concat(this.options.teamCentralUrl, "?operationName=isFeatureKeyEnabled"), query);
|
|
94
|
-
case 5:
|
|
95
|
-
response = _context.sent;
|
|
96
|
-
return _context.abrupt("return", response.isFeatureEnabled.enabled);
|
|
97
|
-
case 7:
|
|
98
|
-
case "end":
|
|
99
|
-
return _context.stop();
|
|
100
|
-
}
|
|
101
|
-
}, _callee, this);
|
|
102
|
-
}));
|
|
103
|
-
function makeFeatureFlagCheckRequest(_x, _x2) {
|
|
104
|
-
return _makeFeatureFlagCheckRequest.apply(this, arguments);
|
|
105
|
-
}
|
|
106
|
-
return makeFeatureFlagCheckRequest;
|
|
107
|
-
}()
|
|
108
|
-
}, {
|
|
109
|
-
key: "makeRequest",
|
|
110
|
-
value: function () {
|
|
111
|
-
var _makeRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(userId) {
|
|
112
|
-
var query, response;
|
|
113
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
114
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
115
|
-
case 0:
|
|
116
|
-
if (this.options.teamCentralUrl) {
|
|
117
|
-
_context2.next = 2;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
121
|
-
case 2:
|
|
122
|
-
query = buildReportingLinesQuery(userId);
|
|
123
|
-
_context2.next = 5;
|
|
124
|
-
return (0, _graphqlUtils.directoryGraphqlQuery)("".concat(this.options.teamCentralUrl, "?operationName=ReportingLines"), query);
|
|
125
|
-
case 5:
|
|
126
|
-
response = _context2.sent;
|
|
127
|
-
return _context2.abrupt("return", response.reportingLines);
|
|
128
|
-
case 7:
|
|
129
|
-
case "end":
|
|
130
|
-
return _context2.stop();
|
|
131
|
-
}
|
|
132
|
-
}, _callee2, this);
|
|
133
|
-
}));
|
|
134
|
-
function makeRequest(_x3) {
|
|
135
|
-
return _makeRequest.apply(this, arguments);
|
|
136
|
-
}
|
|
137
|
-
return makeRequest;
|
|
138
|
-
}()
|
|
139
63
|
}, {
|
|
140
64
|
key: "getReportingLines",
|
|
141
65
|
value: function getReportingLines(userId) {
|
|
@@ -187,43 +111,58 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
187
111
|
});
|
|
188
112
|
});
|
|
189
113
|
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* `public` so that mock client can override it; do not use it otherwise!
|
|
117
|
+
*/
|
|
190
118
|
}, {
|
|
191
|
-
key: "
|
|
192
|
-
value: function
|
|
193
|
-
var
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
if (_this3.bypassOnFailure) {
|
|
203
|
-
return Promise.resolve(false);
|
|
204
|
-
}
|
|
205
|
-
var context = [{
|
|
206
|
-
key: 'productIdentifier',
|
|
207
|
-
value: productIdentifier || 'unset'
|
|
208
|
-
}];
|
|
209
|
-
return new Promise(function (resolve) {
|
|
210
|
-
_this3.makeFeatureFlagCheckRequest(featureKey, context).then(function (enabled) {
|
|
211
|
-
_this3.featureFlagKeys.set(featureKey, enabled);
|
|
212
|
-
resolve(enabled);
|
|
213
|
-
}).catch(function (error) {
|
|
214
|
-
if ((error === null || error === void 0 ? void 0 : error.status) === 401 || (error === null || error === void 0 ? void 0 : error.status) === 403) {
|
|
215
|
-
// Trigger circuit breaker
|
|
216
|
-
_this3.bypassOnFailure = true;
|
|
119
|
+
key: "makeRequest",
|
|
120
|
+
value: (function () {
|
|
121
|
+
var _makeRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(userId) {
|
|
122
|
+
var query, response, _query, _response;
|
|
123
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
124
|
+
while (1) switch (_context.prev = _context.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
if (!(0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls')) {
|
|
127
|
+
_context.next = 10;
|
|
128
|
+
break;
|
|
217
129
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
130
|
+
if (!(this.options.teamCentralDisabled === true)) {
|
|
131
|
+
_context.next = 3;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
throw new Error('makeRequest cannot be called when the client has been disabled');
|
|
135
|
+
case 3:
|
|
136
|
+
query = buildReportingLinesQuery(userId);
|
|
137
|
+
_context.next = 6;
|
|
138
|
+
return (0, _graphqlUtils.directoryGraphqlQuery)('/gateway/api/watermelon/graphql?operationName=ReportingLines', query);
|
|
139
|
+
case 6:
|
|
140
|
+
response = _context.sent;
|
|
141
|
+
return _context.abrupt("return", response.reportingLines);
|
|
142
|
+
case 10:
|
|
143
|
+
if (this.options.teamCentralUrl) {
|
|
144
|
+
_context.next = 12;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
148
|
+
case 12:
|
|
149
|
+
_query = buildReportingLinesQuery(userId);
|
|
150
|
+
_context.next = 15;
|
|
151
|
+
return (0, _graphqlUtils.directoryGraphqlQuery)("".concat(this.options.teamCentralUrl, "?operationName=ReportingLines"), _query);
|
|
152
|
+
case 15:
|
|
153
|
+
_response = _context.sent;
|
|
154
|
+
return _context.abrupt("return", _response.reportingLines);
|
|
155
|
+
case 17:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context.stop();
|
|
158
|
+
}
|
|
159
|
+
}, _callee, this);
|
|
160
|
+
}));
|
|
161
|
+
function makeRequest(_x) {
|
|
162
|
+
return _makeRequest.apply(this, arguments);
|
|
163
|
+
}
|
|
164
|
+
return makeRequest;
|
|
165
|
+
}())
|
|
227
166
|
}, {
|
|
228
167
|
key: "checkWorkspaceExists",
|
|
229
168
|
value: function checkWorkspaceExists() {
|
|
@@ -236,6 +175,18 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
236
175
|
return Promise.resolve(false);
|
|
237
176
|
});
|
|
238
177
|
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "hasTCWorkspace",
|
|
180
|
+
value: function hasTCWorkspace(config) {
|
|
181
|
+
if (config.cloudId) {
|
|
182
|
+
var maybeShardedPath = (0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls') ? "/townsquare/s/".concat(config.cloudId) : '/watermelon';
|
|
183
|
+
return fetch("/gateway/api".concat(maybeShardedPath, "/organization/containsAnyWorkspace?cloudId=").concat(config.cloudId)).then(function (res) {
|
|
184
|
+
return !res || res && res.ok;
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
return Promise.resolve(false);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
239
190
|
}, {
|
|
240
191
|
key: "filterReportingLinesUser",
|
|
241
192
|
value: function filterReportingLinesUser() {
|
|
@@ -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', "
|
|
60
|
+
headers.append('atl-client-version', "20.0.0");
|
|
61
61
|
return headers;
|
|
62
62
|
};
|
|
63
63
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -89,11 +89,6 @@ function getMockProfileClient(BaseProfileClient, modifyResponse) {
|
|
|
89
89
|
}, timeout);
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
}, {
|
|
93
|
-
key: "getFlagEnabled",
|
|
94
|
-
value: function getFlagEnabled(featureKey) {
|
|
95
|
-
return Promise.resolve(true);
|
|
96
|
-
}
|
|
97
92
|
}]);
|
|
98
93
|
return MockTeamCentralClient;
|
|
99
94
|
}(_TeamCentralCardClient.default);
|
|
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
45
45
|
actionSubjectId: actionSubjectId,
|
|
46
46
|
attributes: _objectSpread(_objectSpread({
|
|
47
47
|
packageName: "@atlaskit/profilecard",
|
|
48
|
-
packageVersion: "
|
|
48
|
+
packageVersion: "20.0.0"
|
|
49
49
|
}, attributes), {}, {
|
|
50
50
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
51
51
|
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isFedRamp } from '@atlaskit/atlassian-context';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import RovoAgentCardClient from './RovoAgentCardClient';
|
|
3
4
|
import TeamCentralCardClient from './TeamCentralCardClient';
|
|
4
5
|
import TeamProfileCardClient from './TeamProfileCardClient';
|
|
@@ -72,10 +73,9 @@ function maybeCreateTeamCentralClient(config, clients) {
|
|
|
72
73
|
if (clients !== null && clients !== void 0 && clients.teamCentralClient) {
|
|
73
74
|
return clients.teamCentralClient;
|
|
74
75
|
}
|
|
75
|
-
const
|
|
76
|
-
return
|
|
77
|
-
...config
|
|
78
|
-
teamCentralUrl
|
|
76
|
+
const teamCentralEnabled = fg('enable_ptc_sharded_townsquare_calls') ? config.teamCentralDisabled !== true : config.teamCentralUrl;
|
|
77
|
+
return teamCentralEnabled ? new TeamCentralCardClient({
|
|
78
|
+
...config
|
|
79
79
|
}) : undefined;
|
|
80
80
|
}
|
|
81
81
|
export default ProfileCardClient;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import CachingClient from './CachingClient';
|
|
2
3
|
import { directoryGraphqlQuery } from './graphqlUtils';
|
|
3
4
|
export const buildReportingLinesQuery = aaid => ({
|
|
@@ -30,24 +31,6 @@ export const buildReportingLinesQuery = aaid => ({
|
|
|
30
31
|
aaid
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
|
-
export const buildCheckFeatureFlagQuery = (featureKey, context) => ({
|
|
34
|
-
query: `
|
|
35
|
-
query isFeatureKeyEnabled($featureKey: String!, $context: [IsFeatureEnabledContextInput]) {
|
|
36
|
-
isFeatureEnabled(featureKey: $featureKey, context: $context) {
|
|
37
|
-
enabled
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
`,
|
|
41
|
-
variables: {
|
|
42
|
-
featureKey,
|
|
43
|
-
context: context || []
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
function hasTCWorkspace(config) {
|
|
47
|
-
return config.cloudId ? fetch(`/gateway/api/watermelon/organization/containsAnyWorkspace?cloudId=${config.cloudId}`).then(res => {
|
|
48
|
-
return !res || res && res.ok;
|
|
49
|
-
}) : Promise.resolve(false);
|
|
50
|
-
}
|
|
51
34
|
let isTCReadyPromiseMap = new Map();
|
|
52
35
|
class TeamCentralCardClient extends CachingClient {
|
|
53
36
|
/**
|
|
@@ -63,36 +46,19 @@ class TeamCentralCardClient extends CachingClient {
|
|
|
63
46
|
super(options);
|
|
64
47
|
this.options = options;
|
|
65
48
|
this.bypassOnFailure = false;
|
|
66
|
-
this.featureFlagKeys = new Map();
|
|
67
49
|
this.isTCReadyPromise = this.createTcReadyPromise(options);
|
|
68
50
|
}
|
|
69
51
|
createTcReadyPromise(config) {
|
|
70
52
|
if (config.cloudId) {
|
|
71
53
|
let promise = isTCReadyPromiseMap.get(config.cloudId);
|
|
72
54
|
if (!promise) {
|
|
73
|
-
promise = hasTCWorkspace(config);
|
|
55
|
+
promise = this.hasTCWorkspace(config);
|
|
74
56
|
isTCReadyPromiseMap.set(config.cloudId, promise);
|
|
75
57
|
}
|
|
76
58
|
return promise;
|
|
77
59
|
}
|
|
78
60
|
return Promise.resolve(true);
|
|
79
61
|
}
|
|
80
|
-
async makeFeatureFlagCheckRequest(featureKey, context) {
|
|
81
|
-
if (!this.options.teamCentralUrl) {
|
|
82
|
-
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
83
|
-
}
|
|
84
|
-
const query = buildCheckFeatureFlagQuery(featureKey, context);
|
|
85
|
-
const response = await directoryGraphqlQuery(`${this.options.teamCentralUrl}?operationName=isFeatureKeyEnabled`, query);
|
|
86
|
-
return response.isFeatureEnabled.enabled;
|
|
87
|
-
}
|
|
88
|
-
async makeRequest(userId) {
|
|
89
|
-
if (!this.options.teamCentralUrl) {
|
|
90
|
-
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
91
|
-
}
|
|
92
|
-
const query = buildReportingLinesQuery(userId);
|
|
93
|
-
const response = await directoryGraphqlQuery(`${this.options.teamCentralUrl}?operationName=ReportingLines`, query);
|
|
94
|
-
return response.reportingLines;
|
|
95
|
-
}
|
|
96
62
|
getReportingLines(userId) {
|
|
97
63
|
return this.isTCReadyPromise.then(workSpaceExists => {
|
|
98
64
|
if (workSpaceExists) {
|
|
@@ -139,37 +105,26 @@ class TeamCentralCardClient extends CachingClient {
|
|
|
139
105
|
reports: []
|
|
140
106
|
}));
|
|
141
107
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
if (this.bypassOnFailure) {
|
|
152
|
-
return Promise.resolve(false);
|
|
153
|
-
}
|
|
154
|
-
const context = [{
|
|
155
|
-
key: 'productIdentifier',
|
|
156
|
-
value: productIdentifier || 'unset'
|
|
157
|
-
}];
|
|
158
|
-
return new Promise(resolve => {
|
|
159
|
-
this.makeFeatureFlagCheckRequest(featureKey, context).then(enabled => {
|
|
160
|
-
this.featureFlagKeys.set(featureKey, enabled);
|
|
161
|
-
resolve(enabled);
|
|
162
|
-
}).catch(error => {
|
|
163
|
-
if ((error === null || error === void 0 ? void 0 : error.status) === 401 || (error === null || error === void 0 ? void 0 : error.status) === 403) {
|
|
164
|
-
// Trigger circuit breaker
|
|
165
|
-
this.bypassOnFailure = true;
|
|
166
|
-
}
|
|
167
|
-
resolve(false);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* `public` so that mock client can override it; do not use it otherwise!
|
|
111
|
+
*/
|
|
112
|
+
async makeRequest(userId) {
|
|
113
|
+
if (fg('enable_ptc_sharded_townsquare_calls')) {
|
|
114
|
+
if (this.options.teamCentralDisabled === true) {
|
|
115
|
+
throw new Error('makeRequest cannot be called when the client has been disabled');
|
|
170
116
|
}
|
|
171
|
-
|
|
172
|
-
|
|
117
|
+
const query = buildReportingLinesQuery(userId);
|
|
118
|
+
const response = await directoryGraphqlQuery('/gateway/api/watermelon/graphql?operationName=ReportingLines', query);
|
|
119
|
+
return response.reportingLines;
|
|
120
|
+
} else {
|
|
121
|
+
if (!this.options.teamCentralUrl) {
|
|
122
|
+
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
123
|
+
}
|
|
124
|
+
const query = buildReportingLinesQuery(userId);
|
|
125
|
+
const response = await directoryGraphqlQuery(`${this.options.teamCentralUrl}?operationName=ReportingLines`, query);
|
|
126
|
+
return response.reportingLines;
|
|
127
|
+
}
|
|
173
128
|
}
|
|
174
129
|
checkWorkspaceExists() {
|
|
175
130
|
return this.isTCReadyPromise.then(workSpaceExists => {
|
|
@@ -179,6 +134,16 @@ class TeamCentralCardClient extends CachingClient {
|
|
|
179
134
|
return Promise.resolve(false);
|
|
180
135
|
}, () => Promise.resolve(false));
|
|
181
136
|
}
|
|
137
|
+
hasTCWorkspace(config) {
|
|
138
|
+
if (config.cloudId) {
|
|
139
|
+
const maybeShardedPath = fg('enable_ptc_sharded_townsquare_calls') ? `/townsquare/s/${config.cloudId}` : '/watermelon';
|
|
140
|
+
return fetch(`/gateway/api${maybeShardedPath}/organization/containsAnyWorkspace?cloudId=${config.cloudId}`).then(res => {
|
|
141
|
+
return !res || res && res.ok;
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
return Promise.resolve(false);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
182
147
|
filterReportingLinesUser(users = []) {
|
|
183
148
|
return users.filter(user => user.identifierType === 'ATLASSIAN_ID');
|
|
184
149
|
}
|
|
@@ -67,7 +67,7 @@ export const addHeaders = headers => {
|
|
|
67
67
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
68
68
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
69
69
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
70
|
-
headers.append('atl-client-version', "
|
|
70
|
+
headers.append('atl-client-version', "20.0.0");
|
|
71
71
|
return headers;
|
|
72
72
|
};
|
|
73
73
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
@@ -54,9 +54,6 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
|
|
|
54
54
|
}, timeout);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
getFlagEnabled(featureKey) {
|
|
58
|
-
return Promise.resolve(true);
|
|
59
|
-
}
|
|
60
57
|
}
|
|
61
58
|
return class MockProfileClient extends BaseProfileClient {
|
|
62
59
|
constructor(options, clients = {}) {
|
|
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
|
|
|
32
32
|
actionSubjectId,
|
|
33
33
|
attributes: {
|
|
34
34
|
packageName: "@atlaskit/profilecard",
|
|
35
|
-
packageVersion: "
|
|
35
|
+
packageVersion: "20.0.0",
|
|
36
36
|
...attributes,
|
|
37
37
|
firedAt: Math.round(getPageTime())
|
|
38
38
|
}
|
|
@@ -4,6 +4,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
4
4
|
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; }
|
|
5
5
|
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) { _defineProperty(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; }
|
|
6
6
|
import { isFedRamp } from '@atlaskit/atlassian-context';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import RovoAgentCardClient from './RovoAgentCardClient';
|
|
8
9
|
import TeamCentralCardClient from './TeamCentralCardClient';
|
|
9
10
|
import TeamProfileCardClient from './TeamProfileCardClient';
|
|
@@ -94,9 +95,7 @@ function maybeCreateTeamCentralClient(config, clients) {
|
|
|
94
95
|
if (clients !== null && clients !== void 0 && clients.teamCentralClient) {
|
|
95
96
|
return clients.teamCentralClient;
|
|
96
97
|
}
|
|
97
|
-
var
|
|
98
|
-
return
|
|
99
|
-
teamCentralUrl: teamCentralUrl
|
|
100
|
-
})) : undefined;
|
|
98
|
+
var teamCentralEnabled = fg('enable_ptc_sharded_townsquare_calls') ? config.teamCentralDisabled !== true : config.teamCentralUrl;
|
|
99
|
+
return teamCentralEnabled ? new TeamCentralCardClient(_objectSpread({}, config)) : undefined;
|
|
101
100
|
}
|
|
102
101
|
export default ProfileCardClient;
|
|
@@ -7,6 +7,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
9
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import CachingClient from './CachingClient';
|
|
11
12
|
import { directoryGraphqlQuery } from './graphqlUtils';
|
|
12
13
|
export var buildReportingLinesQuery = function buildReportingLinesQuery(aaid) {
|
|
@@ -17,20 +18,6 @@ export var buildReportingLinesQuery = function buildReportingLinesQuery(aaid) {
|
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
20
|
};
|
|
20
|
-
export var buildCheckFeatureFlagQuery = function buildCheckFeatureFlagQuery(featureKey, context) {
|
|
21
|
-
return {
|
|
22
|
-
query: "\n query isFeatureKeyEnabled($featureKey: String!, $context: [IsFeatureEnabledContextInput]) {\n isFeatureEnabled(featureKey: $featureKey, context: $context) {\n enabled\n }\n }\n ",
|
|
23
|
-
variables: {
|
|
24
|
-
featureKey: featureKey,
|
|
25
|
-
context: context || []
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
function hasTCWorkspace(config) {
|
|
30
|
-
return config.cloudId ? fetch("/gateway/api/watermelon/organization/containsAnyWorkspace?cloudId=".concat(config.cloudId)).then(function (res) {
|
|
31
|
-
return !res || res && res.ok;
|
|
32
|
-
}) : Promise.resolve(false);
|
|
33
|
-
}
|
|
34
21
|
var isTCReadyPromiseMap = new Map();
|
|
35
22
|
var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
36
23
|
_inherits(TeamCentralCardClient, _CachingClient);
|
|
@@ -50,7 +37,6 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
50
37
|
_this = _super.call(this, options);
|
|
51
38
|
_this.options = options;
|
|
52
39
|
_this.bypassOnFailure = false;
|
|
53
|
-
_this.featureFlagKeys = new Map();
|
|
54
40
|
_this.isTCReadyPromise = _this.createTcReadyPromise(options);
|
|
55
41
|
return _this;
|
|
56
42
|
}
|
|
@@ -60,75 +46,13 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
60
46
|
if (config.cloudId) {
|
|
61
47
|
var promise = isTCReadyPromiseMap.get(config.cloudId);
|
|
62
48
|
if (!promise) {
|
|
63
|
-
promise = hasTCWorkspace(config);
|
|
49
|
+
promise = this.hasTCWorkspace(config);
|
|
64
50
|
isTCReadyPromiseMap.set(config.cloudId, promise);
|
|
65
51
|
}
|
|
66
52
|
return promise;
|
|
67
53
|
}
|
|
68
54
|
return Promise.resolve(true);
|
|
69
55
|
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "makeFeatureFlagCheckRequest",
|
|
72
|
-
value: function () {
|
|
73
|
-
var _makeFeatureFlagCheckRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(featureKey, context) {
|
|
74
|
-
var query, response;
|
|
75
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
76
|
-
while (1) switch (_context.prev = _context.next) {
|
|
77
|
-
case 0:
|
|
78
|
-
if (this.options.teamCentralUrl) {
|
|
79
|
-
_context.next = 2;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
83
|
-
case 2:
|
|
84
|
-
query = buildCheckFeatureFlagQuery(featureKey, context);
|
|
85
|
-
_context.next = 5;
|
|
86
|
-
return directoryGraphqlQuery("".concat(this.options.teamCentralUrl, "?operationName=isFeatureKeyEnabled"), query);
|
|
87
|
-
case 5:
|
|
88
|
-
response = _context.sent;
|
|
89
|
-
return _context.abrupt("return", response.isFeatureEnabled.enabled);
|
|
90
|
-
case 7:
|
|
91
|
-
case "end":
|
|
92
|
-
return _context.stop();
|
|
93
|
-
}
|
|
94
|
-
}, _callee, this);
|
|
95
|
-
}));
|
|
96
|
-
function makeFeatureFlagCheckRequest(_x, _x2) {
|
|
97
|
-
return _makeFeatureFlagCheckRequest.apply(this, arguments);
|
|
98
|
-
}
|
|
99
|
-
return makeFeatureFlagCheckRequest;
|
|
100
|
-
}()
|
|
101
|
-
}, {
|
|
102
|
-
key: "makeRequest",
|
|
103
|
-
value: function () {
|
|
104
|
-
var _makeRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(userId) {
|
|
105
|
-
var query, response;
|
|
106
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
107
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
108
|
-
case 0:
|
|
109
|
-
if (this.options.teamCentralUrl) {
|
|
110
|
-
_context2.next = 2;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
114
|
-
case 2:
|
|
115
|
-
query = buildReportingLinesQuery(userId);
|
|
116
|
-
_context2.next = 5;
|
|
117
|
-
return directoryGraphqlQuery("".concat(this.options.teamCentralUrl, "?operationName=ReportingLines"), query);
|
|
118
|
-
case 5:
|
|
119
|
-
response = _context2.sent;
|
|
120
|
-
return _context2.abrupt("return", response.reportingLines);
|
|
121
|
-
case 7:
|
|
122
|
-
case "end":
|
|
123
|
-
return _context2.stop();
|
|
124
|
-
}
|
|
125
|
-
}, _callee2, this);
|
|
126
|
-
}));
|
|
127
|
-
function makeRequest(_x3) {
|
|
128
|
-
return _makeRequest.apply(this, arguments);
|
|
129
|
-
}
|
|
130
|
-
return makeRequest;
|
|
131
|
-
}()
|
|
132
56
|
}, {
|
|
133
57
|
key: "getReportingLines",
|
|
134
58
|
value: function getReportingLines(userId) {
|
|
@@ -180,43 +104,58 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
180
104
|
});
|
|
181
105
|
});
|
|
182
106
|
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* `public` so that mock client can override it; do not use it otherwise!
|
|
110
|
+
*/
|
|
183
111
|
}, {
|
|
184
|
-
key: "
|
|
185
|
-
value: function
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
if (_this3.bypassOnFailure) {
|
|
196
|
-
return Promise.resolve(false);
|
|
197
|
-
}
|
|
198
|
-
var context = [{
|
|
199
|
-
key: 'productIdentifier',
|
|
200
|
-
value: productIdentifier || 'unset'
|
|
201
|
-
}];
|
|
202
|
-
return new Promise(function (resolve) {
|
|
203
|
-
_this3.makeFeatureFlagCheckRequest(featureKey, context).then(function (enabled) {
|
|
204
|
-
_this3.featureFlagKeys.set(featureKey, enabled);
|
|
205
|
-
resolve(enabled);
|
|
206
|
-
}).catch(function (error) {
|
|
207
|
-
if ((error === null || error === void 0 ? void 0 : error.status) === 401 || (error === null || error === void 0 ? void 0 : error.status) === 403) {
|
|
208
|
-
// Trigger circuit breaker
|
|
209
|
-
_this3.bypassOnFailure = true;
|
|
112
|
+
key: "makeRequest",
|
|
113
|
+
value: (function () {
|
|
114
|
+
var _makeRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(userId) {
|
|
115
|
+
var query, response, _query, _response;
|
|
116
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
117
|
+
while (1) switch (_context.prev = _context.next) {
|
|
118
|
+
case 0:
|
|
119
|
+
if (!fg('enable_ptc_sharded_townsquare_calls')) {
|
|
120
|
+
_context.next = 10;
|
|
121
|
+
break;
|
|
210
122
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
123
|
+
if (!(this.options.teamCentralDisabled === true)) {
|
|
124
|
+
_context.next = 3;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
throw new Error('makeRequest cannot be called when the client has been disabled');
|
|
128
|
+
case 3:
|
|
129
|
+
query = buildReportingLinesQuery(userId);
|
|
130
|
+
_context.next = 6;
|
|
131
|
+
return directoryGraphqlQuery('/gateway/api/watermelon/graphql?operationName=ReportingLines', query);
|
|
132
|
+
case 6:
|
|
133
|
+
response = _context.sent;
|
|
134
|
+
return _context.abrupt("return", response.reportingLines);
|
|
135
|
+
case 10:
|
|
136
|
+
if (this.options.teamCentralUrl) {
|
|
137
|
+
_context.next = 12;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
throw new Error('options.teamCentralUrl is a required parameter for retrieving Team Central data');
|
|
141
|
+
case 12:
|
|
142
|
+
_query = buildReportingLinesQuery(userId);
|
|
143
|
+
_context.next = 15;
|
|
144
|
+
return directoryGraphqlQuery("".concat(this.options.teamCentralUrl, "?operationName=ReportingLines"), _query);
|
|
145
|
+
case 15:
|
|
146
|
+
_response = _context.sent;
|
|
147
|
+
return _context.abrupt("return", _response.reportingLines);
|
|
148
|
+
case 17:
|
|
149
|
+
case "end":
|
|
150
|
+
return _context.stop();
|
|
151
|
+
}
|
|
152
|
+
}, _callee, this);
|
|
153
|
+
}));
|
|
154
|
+
function makeRequest(_x) {
|
|
155
|
+
return _makeRequest.apply(this, arguments);
|
|
156
|
+
}
|
|
157
|
+
return makeRequest;
|
|
158
|
+
}())
|
|
220
159
|
}, {
|
|
221
160
|
key: "checkWorkspaceExists",
|
|
222
161
|
value: function checkWorkspaceExists() {
|
|
@@ -229,6 +168,18 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
229
168
|
return Promise.resolve(false);
|
|
230
169
|
});
|
|
231
170
|
}
|
|
171
|
+
}, {
|
|
172
|
+
key: "hasTCWorkspace",
|
|
173
|
+
value: function hasTCWorkspace(config) {
|
|
174
|
+
if (config.cloudId) {
|
|
175
|
+
var maybeShardedPath = fg('enable_ptc_sharded_townsquare_calls') ? "/townsquare/s/".concat(config.cloudId) : '/watermelon';
|
|
176
|
+
return fetch("/gateway/api".concat(maybeShardedPath, "/organization/containsAnyWorkspace?cloudId=").concat(config.cloudId)).then(function (res) {
|
|
177
|
+
return !res || res && res.ok;
|
|
178
|
+
});
|
|
179
|
+
} else {
|
|
180
|
+
return Promise.resolve(false);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
232
183
|
}, {
|
|
233
184
|
key: "filterReportingLinesUser",
|
|
234
185
|
value: function filterReportingLinesUser() {
|
|
@@ -48,7 +48,7 @@ export var addHeaders = function addHeaders(headers) {
|
|
|
48
48
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
49
49
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
50
50
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
51
|
-
headers.append('atl-client-version', "
|
|
51
|
+
headers.append('atl-client-version', "20.0.0");
|
|
52
52
|
return headers;
|
|
53
53
|
};
|
|
54
54
|
export function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -82,11 +82,6 @@ export default function getMockProfileClient(BaseProfileClient, modifyResponse)
|
|
|
82
82
|
}, timeout);
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "getFlagEnabled",
|
|
87
|
-
value: function getFlagEnabled(featureKey) {
|
|
88
|
-
return Promise.resolve(true);
|
|
89
|
-
}
|
|
90
85
|
}]);
|
|
91
86
|
return MockTeamCentralClient;
|
|
92
87
|
}(TeamCentralCardClient);
|
|
@@ -39,7 +39,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
39
39
|
actionSubjectId: actionSubjectId,
|
|
40
40
|
attributes: _objectSpread(_objectSpread({
|
|
41
41
|
packageName: "@atlaskit/profilecard",
|
|
42
|
-
packageVersion: "
|
|
42
|
+
packageVersion: "20.0.0"
|
|
43
43
|
}, attributes), {}, {
|
|
44
44
|
firedAt: Math.round(getPageTime())
|
|
45
45
|
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
2
|
-
import { type AgentIdType, type ClientOverrides, type ProfileClientOptions, type TeamCentralReportingLinesData } from '../types';
|
|
2
|
+
import { type AgentIdType, type ClientOverrides, type ProfileClient, type ProfileClientOptions, type TeamCentralReportingLinesData } from '../types';
|
|
3
3
|
import RovoAgentCardClient from './RovoAgentCardClient';
|
|
4
4
|
import TeamCentralCardClient from './TeamCentralCardClient';
|
|
5
5
|
import TeamProfileCardClient from './TeamProfileCardClient';
|
|
6
6
|
import UserProfileCardClient from './UserProfileCardClient';
|
|
7
|
-
declare class ProfileCardClient {
|
|
7
|
+
declare class ProfileCardClient implements ProfileClient {
|
|
8
8
|
userClient: UserProfileCardClient;
|
|
9
9
|
teamClient: TeamProfileCardClient;
|
|
10
10
|
tcClient?: TeamCentralCardClient;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import CachingClient from './CachingClient';
|
|
1
|
+
import { type TeamCentralReportingLinesData } from '../types';
|
|
2
|
+
import CachingClient, { type CacheConfig } from './CachingClient';
|
|
3
3
|
export declare const buildReportingLinesQuery: (aaid: string) => {
|
|
4
4
|
query: string;
|
|
5
5
|
variables: {
|
|
6
6
|
aaid: string;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type FeatureFlagExtraContext = {
|
|
20
|
-
key: string;
|
|
21
|
-
value: string;
|
|
9
|
+
export type TeamCentralCardClientOptions = CacheConfig & {
|
|
10
|
+
cloudId?: string;
|
|
11
|
+
teamCentralDisabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
* Enables Team Central functionality if enabled e.g. /gateway/api/watermelon/graphql
|
|
15
|
+
*/
|
|
16
|
+
teamCentralUrl?: string;
|
|
17
|
+
/** URL to the Team Central app e.g. team.atlassian.com */
|
|
18
|
+
teamCentralBaseUrl?: string;
|
|
22
19
|
};
|
|
23
20
|
declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLinesData> {
|
|
24
21
|
options: TeamCentralCardClientOptions;
|
|
@@ -31,15 +28,16 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
|
|
|
31
28
|
* catch a pretty specific edge case.
|
|
32
29
|
*/
|
|
33
30
|
bypassOnFailure: boolean;
|
|
34
|
-
featureFlagKeys: Map<string, boolean>;
|
|
35
31
|
isTCReadyPromise: Promise<boolean>;
|
|
36
32
|
constructor(options: TeamCentralCardClientOptions);
|
|
37
|
-
createTcReadyPromise(config:
|
|
38
|
-
makeFeatureFlagCheckRequest(featureKey: string, context?: FeatureFlagExtraContext[]): Promise<boolean>;
|
|
39
|
-
makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
33
|
+
createTcReadyPromise(config: TeamCentralCardClientOptions): Promise<boolean>;
|
|
40
34
|
getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
41
|
-
|
|
35
|
+
/**
|
|
36
|
+
* `public` so that mock client can override it; do not use it otherwise!
|
|
37
|
+
*/
|
|
38
|
+
makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
42
39
|
checkWorkspaceExists(): Promise<boolean>;
|
|
40
|
+
private hasTCWorkspace;
|
|
43
41
|
private filterReportingLinesUser;
|
|
44
42
|
}
|
|
45
43
|
export default TeamCentralCardClient;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type React from 'react';
|
|
|
2
2
|
import { type IntlShape } from 'react-intl-next';
|
|
3
3
|
import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
4
|
import type RovoAgentCardClient from './client/RovoAgentCardClient';
|
|
5
|
-
import type TeamCentralCardClient from './client/TeamCentralCardClient';
|
|
5
|
+
import { type default as TeamCentralCardClient, type TeamCentralCardClientOptions } from './client/TeamCentralCardClient';
|
|
6
6
|
import type TeamProfileCardClient from './client/TeamProfileCardClient';
|
|
7
7
|
import type UserProfileCardClient from './client/UserProfileCardClient';
|
|
8
8
|
export interface ApiClientResponse {
|
|
@@ -448,7 +448,7 @@ export type ProfileCardErrorType = {
|
|
|
448
448
|
export type TeamProfileCardErrorType = {
|
|
449
449
|
reason: 'default' | 'NotFound' | 'TEAMS_FORBIDDEN';
|
|
450
450
|
} | null;
|
|
451
|
-
export interface ProfileClientOptions {
|
|
451
|
+
export interface ProfileClientOptions extends TeamCentralCardClientOptions {
|
|
452
452
|
/**
|
|
453
453
|
* pf-directory url
|
|
454
454
|
* When we clean up CloudUser migration FF, we should remove this prop
|
|
@@ -461,10 +461,6 @@ export interface ProfileClientOptions {
|
|
|
461
461
|
gatewayGraphqlUrl?: string;
|
|
462
462
|
cacheSize?: number;
|
|
463
463
|
cacheMaxAge?: number;
|
|
464
|
-
/** Enables Team Central functionality if enabled e.g. /gateway/api/watermelon/graphql*/
|
|
465
|
-
teamCentralUrl?: string;
|
|
466
|
-
/** URL to the Team Central app e.g. team.atlassian.com */
|
|
467
|
-
teamCentralBaseUrl?: string;
|
|
468
464
|
/** Name of integrating product e.g. jira, atlas, confluence **/
|
|
469
465
|
productIdentifier?: string;
|
|
470
466
|
cloudId?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
2
|
-
import { type AgentIdType, type ClientOverrides, type ProfileClientOptions, type TeamCentralReportingLinesData } from '../types';
|
|
2
|
+
import { type AgentIdType, type ClientOverrides, type ProfileClient, type ProfileClientOptions, type TeamCentralReportingLinesData } from '../types';
|
|
3
3
|
import RovoAgentCardClient from './RovoAgentCardClient';
|
|
4
4
|
import TeamCentralCardClient from './TeamCentralCardClient';
|
|
5
5
|
import TeamProfileCardClient from './TeamProfileCardClient';
|
|
6
6
|
import UserProfileCardClient from './UserProfileCardClient';
|
|
7
|
-
declare class ProfileCardClient {
|
|
7
|
+
declare class ProfileCardClient implements ProfileClient {
|
|
8
8
|
userClient: UserProfileCardClient;
|
|
9
9
|
teamClient: TeamProfileCardClient;
|
|
10
10
|
tcClient?: TeamCentralCardClient;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import CachingClient from './CachingClient';
|
|
1
|
+
import { type TeamCentralReportingLinesData } from '../types';
|
|
2
|
+
import CachingClient, { type CacheConfig } from './CachingClient';
|
|
3
3
|
export declare const buildReportingLinesQuery: (aaid: string) => {
|
|
4
4
|
query: string;
|
|
5
5
|
variables: {
|
|
6
6
|
aaid: string;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type FeatureFlagExtraContext = {
|
|
20
|
-
key: string;
|
|
21
|
-
value: string;
|
|
9
|
+
export type TeamCentralCardClientOptions = CacheConfig & {
|
|
10
|
+
cloudId?: string;
|
|
11
|
+
teamCentralDisabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
* Enables Team Central functionality if enabled e.g. /gateway/api/watermelon/graphql
|
|
15
|
+
*/
|
|
16
|
+
teamCentralUrl?: string;
|
|
17
|
+
/** URL to the Team Central app e.g. team.atlassian.com */
|
|
18
|
+
teamCentralBaseUrl?: string;
|
|
22
19
|
};
|
|
23
20
|
declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLinesData> {
|
|
24
21
|
options: TeamCentralCardClientOptions;
|
|
@@ -31,15 +28,16 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
|
|
|
31
28
|
* catch a pretty specific edge case.
|
|
32
29
|
*/
|
|
33
30
|
bypassOnFailure: boolean;
|
|
34
|
-
featureFlagKeys: Map<string, boolean>;
|
|
35
31
|
isTCReadyPromise: Promise<boolean>;
|
|
36
32
|
constructor(options: TeamCentralCardClientOptions);
|
|
37
|
-
createTcReadyPromise(config:
|
|
38
|
-
makeFeatureFlagCheckRequest(featureKey: string, context?: FeatureFlagExtraContext[]): Promise<boolean>;
|
|
39
|
-
makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
33
|
+
createTcReadyPromise(config: TeamCentralCardClientOptions): Promise<boolean>;
|
|
40
34
|
getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
41
|
-
|
|
35
|
+
/**
|
|
36
|
+
* `public` so that mock client can override it; do not use it otherwise!
|
|
37
|
+
*/
|
|
38
|
+
makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
42
39
|
checkWorkspaceExists(): Promise<boolean>;
|
|
40
|
+
private hasTCWorkspace;
|
|
43
41
|
private filterReportingLinesUser;
|
|
44
42
|
}
|
|
45
43
|
export default TeamCentralCardClient;
|
|
@@ -2,7 +2,7 @@ import type React from 'react';
|
|
|
2
2
|
import { type IntlShape } from 'react-intl-next';
|
|
3
3
|
import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
4
|
import type RovoAgentCardClient from './client/RovoAgentCardClient';
|
|
5
|
-
import type TeamCentralCardClient from './client/TeamCentralCardClient';
|
|
5
|
+
import { type default as TeamCentralCardClient, type TeamCentralCardClientOptions } from './client/TeamCentralCardClient';
|
|
6
6
|
import type TeamProfileCardClient from './client/TeamProfileCardClient';
|
|
7
7
|
import type UserProfileCardClient from './client/UserProfileCardClient';
|
|
8
8
|
export interface ApiClientResponse {
|
|
@@ -454,7 +454,7 @@ export type ProfileCardErrorType = {
|
|
|
454
454
|
export type TeamProfileCardErrorType = {
|
|
455
455
|
reason: 'default' | 'NotFound' | 'TEAMS_FORBIDDEN';
|
|
456
456
|
} | null;
|
|
457
|
-
export interface ProfileClientOptions {
|
|
457
|
+
export interface ProfileClientOptions extends TeamCentralCardClientOptions {
|
|
458
458
|
/**
|
|
459
459
|
* pf-directory url
|
|
460
460
|
* When we clean up CloudUser migration FF, we should remove this prop
|
|
@@ -467,10 +467,6 @@ export interface ProfileClientOptions {
|
|
|
467
467
|
gatewayGraphqlUrl?: string;
|
|
468
468
|
cacheSize?: number;
|
|
469
469
|
cacheMaxAge?: number;
|
|
470
|
-
/** Enables Team Central functionality if enabled e.g. /gateway/api/watermelon/graphql*/
|
|
471
|
-
teamCentralUrl?: string;
|
|
472
|
-
/** URL to the Team Central app e.g. team.atlassian.com */
|
|
473
|
-
teamCentralBaseUrl?: string;
|
|
474
470
|
/** Name of integrating product e.g. jira, atlas, confluence **/
|
|
475
471
|
productIdentifier?: string;
|
|
476
472
|
cloudId?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"description": "A React component to display a card with user information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/atlassian-context": "^0.0.1",
|
|
54
54
|
"@atlaskit/avatar": "^21.15.0",
|
|
55
55
|
"@atlaskit/avatar-group": "^9.11.0",
|
|
56
|
-
"@atlaskit/button": "^20.
|
|
56
|
+
"@atlaskit/button": "^20.2.0",
|
|
57
57
|
"@atlaskit/dropdown-menu": "^12.18.0",
|
|
58
58
|
"@atlaskit/empty-state": "^7.11.0",
|
|
59
59
|
"@atlaskit/focus-ring": "^1.6.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
66
66
|
"@atlaskit/popup": "^1.27.0",
|
|
67
67
|
"@atlaskit/primitives": "^12.2.0",
|
|
68
|
-
"@atlaskit/rovo-agent-components": "^1.
|
|
68
|
+
"@atlaskit/rovo-agent-components": "^1.6.0",
|
|
69
69
|
"@atlaskit/spinner": "^16.3.0",
|
|
70
70
|
"@atlaskit/theme": "^13.0.0",
|
|
71
71
|
"@atlaskit/tokens": "^1.61.0",
|
|
@@ -116,6 +116,9 @@
|
|
|
116
116
|
"enable_appropriate_reading_order_in_profile_card": {
|
|
117
117
|
"type": "boolean"
|
|
118
118
|
},
|
|
119
|
+
"enable_ptc_sharded_townsquare_calls": {
|
|
120
|
+
"type": "boolean"
|
|
121
|
+
},
|
|
119
122
|
"migrate_cloud_user_to_agg_user_query_profile_card": {
|
|
120
123
|
"type": "boolean"
|
|
121
124
|
},
|