@atlaskit/profilecard 20.5.0 → 20.6.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 +8 -0
- package/dist/cjs/client/ProfileCardClient.js +68 -9
- package/dist/cjs/client/TeamCentralCardClient.js +74 -2
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Team/TeamProfileCardTrigger.js +3 -3
- package/dist/cjs/components/User/ProfileCardResourced.js +9 -6
- package/dist/cjs/components/User/ProfileCardTrigger.js +12 -12
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/es2019/client/ProfileCardClient.js +13 -6
- package/dist/es2019/client/TeamCentralCardClient.js +41 -2
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Team/TeamProfileCardTrigger.js +3 -3
- package/dist/es2019/components/User/ProfileCardResourced.js +9 -6
- package/dist/es2019/components/User/ProfileCardTrigger.js +3 -3
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/esm/client/ProfileCardClient.js +69 -10
- package/dist/esm/client/TeamCentralCardClient.js +74 -2
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Team/TeamProfileCardTrigger.js +3 -3
- package/dist/esm/components/User/ProfileCardResourced.js +9 -6
- package/dist/esm/components/User/ProfileCardTrigger.js +12 -12
- package/dist/esm/util/analytics.js +1 -1
- package/dist/types/client/ProfileCardClient.d.ts +1 -1
- package/dist/types/client/TeamCentralCardClient.d.ts +5 -0
- package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +1 -1
- package/dist/types/components/User/ProfileCardResourced.d.ts +1 -1
- package/dist/types/types.d.ts +2 -1
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +1 -1
- package/dist/types-ts4.5/client/TeamCentralCardClient.d.ts +5 -0
- package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +1 -1
- package/dist/types-ts4.5/components/User/ProfileCardResourced.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +2 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 20.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#153669](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/153669)
|
|
8
|
+
[`5f8a2c39f1282`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5f8a2c39f1282) -
|
|
9
|
+
Fix links to go to home.a.c or team.a.c depending on the workspace type for profile card
|
|
10
|
+
|
|
3
11
|
## 20.5.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -62,18 +64,75 @@ var ProfileCardClient = /*#__PURE__*/function () {
|
|
|
62
64
|
}
|
|
63
65
|
}, {
|
|
64
66
|
key: "getTeamCentralBaseUrl",
|
|
65
|
-
value: function
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
value: function () {
|
|
68
|
+
var _getTeamCentralBaseUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
69
|
+
var _this$tcClient3, isGlobalExperienceWorkspace;
|
|
70
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
71
|
+
while (1) switch (_context.prev = _context.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
if ((0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls')) {
|
|
74
|
+
_context.next = 2;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return _context.abrupt("return", Promise.resolve((_this$tcClient3 = this.tcClient) === null || _this$tcClient3 === void 0 ? void 0 : _this$tcClient3.options.teamCentralBaseUrl));
|
|
78
|
+
case 2:
|
|
79
|
+
if (!(this.tcClient === undefined)) {
|
|
80
|
+
_context.next = 4;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
return _context.abrupt("return", Promise.resolve(undefined));
|
|
84
|
+
case 4:
|
|
85
|
+
_context.next = 6;
|
|
86
|
+
return this.tcClient.getIsGlobalExperienceWorkspace();
|
|
87
|
+
case 6:
|
|
88
|
+
isGlobalExperienceWorkspace = _context.sent;
|
|
89
|
+
return _context.abrupt("return", Promise.resolve(isGlobalExperienceWorkspace ? (0, _atlassianContext.getATLContextUrl)('home') : (0, _atlassianContext.getATLContextUrl)('team')));
|
|
90
|
+
case 8:
|
|
91
|
+
case "end":
|
|
92
|
+
return _context.stop();
|
|
93
|
+
}
|
|
94
|
+
}, _callee, this);
|
|
95
|
+
}));
|
|
96
|
+
function getTeamCentralBaseUrl() {
|
|
97
|
+
return _getTeamCentralBaseUrl.apply(this, arguments);
|
|
98
|
+
}
|
|
99
|
+
return getTeamCentralBaseUrl;
|
|
100
|
+
}()
|
|
69
101
|
}, {
|
|
70
102
|
key: "shouldShowGiveKudos",
|
|
71
|
-
value: function
|
|
72
|
-
|
|
73
|
-
return
|
|
103
|
+
value: function () {
|
|
104
|
+
var _shouldShowGiveKudos = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
105
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
106
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
_context2.t0 = !this.tcClient;
|
|
109
|
+
if (_context2.t0) {
|
|
110
|
+
_context2.next = 5;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
_context2.next = 4;
|
|
114
|
+
return this.getTeamCentralBaseUrl();
|
|
115
|
+
case 4:
|
|
116
|
+
_context2.t0 = !_context2.sent;
|
|
117
|
+
case 5:
|
|
118
|
+
if (!_context2.t0) {
|
|
119
|
+
_context2.next = 7;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
return _context2.abrupt("return", Promise.resolve(false));
|
|
123
|
+
case 7:
|
|
124
|
+
return _context2.abrupt("return", this.tcClient.checkWorkspaceExists());
|
|
125
|
+
case 8:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context2.stop();
|
|
128
|
+
}
|
|
129
|
+
}, _callee2, this);
|
|
130
|
+
}));
|
|
131
|
+
function shouldShowGiveKudos() {
|
|
132
|
+
return _shouldShowGiveKudos.apply(this, arguments);
|
|
74
133
|
}
|
|
75
|
-
return
|
|
76
|
-
}
|
|
134
|
+
return shouldShowGiveKudos;
|
|
135
|
+
}()
|
|
77
136
|
}, {
|
|
78
137
|
key: "getRovoAgentProfile",
|
|
79
138
|
value: function getRovoAgentProfile(id, analytics) {
|
|
@@ -26,6 +26,7 @@ var buildReportingLinesQuery = exports.buildReportingLinesQuery = function build
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
var isTCReadyPromiseMap = new Map();
|
|
29
|
+
var globalExperiencePromiseCache = new Map();
|
|
29
30
|
var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
30
31
|
(0, _inherits2.default)(TeamCentralCardClient, _CachingClient);
|
|
31
32
|
var _super = _createSuper(TeamCentralCardClient);
|
|
@@ -45,6 +46,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
45
46
|
_this.options = options;
|
|
46
47
|
_this.bypassOnFailure = false;
|
|
47
48
|
_this.isTCReadyPromise = _this.createTcReadyPromise(options);
|
|
49
|
+
_this.isGlobalExperienceWorkspacePromise = _this.preloadIsGlobalExperienceWorkspace(options.cloudId);
|
|
48
50
|
return _this;
|
|
49
51
|
}
|
|
50
52
|
(0, _createClass2.default)(TeamCentralCardClient, [{
|
|
@@ -175,18 +177,88 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
175
177
|
return Promise.resolve(false);
|
|
176
178
|
});
|
|
177
179
|
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "getIsGlobalExperienceWorkspace",
|
|
182
|
+
value: function getIsGlobalExperienceWorkspace() {
|
|
183
|
+
return this.isGlobalExperienceWorkspacePromise;
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
key: "preloadIsGlobalExperienceWorkspace",
|
|
187
|
+
value: function preloadIsGlobalExperienceWorkspace(cloudId) {
|
|
188
|
+
if (!(0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls')) {
|
|
189
|
+
return Promise.resolve(false);
|
|
190
|
+
}
|
|
191
|
+
if (cloudId === undefined) {
|
|
192
|
+
return Promise.resolve(false);
|
|
193
|
+
}
|
|
194
|
+
var maybeIsGlobalExperienceWorkspaceForCloudIdPromise = globalExperiencePromiseCache.get(cloudId);
|
|
195
|
+
if (maybeIsGlobalExperienceWorkspaceForCloudIdPromise !== undefined) {
|
|
196
|
+
return maybeIsGlobalExperienceWorkspaceForCloudIdPromise;
|
|
197
|
+
}
|
|
198
|
+
var isGlobalExperienceWorkspaceForCloudIdPromise = this.isGlobalExperienceWorkspaceForCloudId(cloudId);
|
|
199
|
+
globalExperiencePromiseCache.set(cloudId, isGlobalExperienceWorkspaceForCloudIdPromise);
|
|
200
|
+
return isGlobalExperienceWorkspaceForCloudIdPromise;
|
|
201
|
+
}
|
|
178
202
|
}, {
|
|
179
203
|
key: "hasTCWorkspace",
|
|
180
204
|
value: function hasTCWorkspace(config) {
|
|
181
205
|
if (config.cloudId) {
|
|
182
|
-
var
|
|
183
|
-
return fetch("
|
|
206
|
+
var maybeShardedApiPath = this.getMaybeShardedApiPath(config.cloudId);
|
|
207
|
+
return fetch("".concat(maybeShardedApiPath, "/organization/containsAnyWorkspace?cloudId=").concat(config.cloudId)).then(function (res) {
|
|
184
208
|
return !res || res && res.ok;
|
|
185
209
|
});
|
|
186
210
|
} else {
|
|
187
211
|
return Promise.resolve(false);
|
|
188
212
|
}
|
|
189
213
|
}
|
|
214
|
+
}, {
|
|
215
|
+
key: "isGlobalExperienceWorkspaceForCloudId",
|
|
216
|
+
value: function () {
|
|
217
|
+
var _isGlobalExperienceWorkspaceForCloudId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(cloudId) {
|
|
218
|
+
var maybeShardedApiPath, response, workspaceType;
|
|
219
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
220
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
221
|
+
case 0:
|
|
222
|
+
maybeShardedApiPath = this.getMaybeShardedApiPath(cloudId);
|
|
223
|
+
_context2.prev = 1;
|
|
224
|
+
_context2.next = 4;
|
|
225
|
+
return fetch("".concat(maybeShardedApiPath, "/workspace/existsWithWorkspaceType?cloudId=").concat(cloudId), {
|
|
226
|
+
credentials: 'include'
|
|
227
|
+
});
|
|
228
|
+
case 4:
|
|
229
|
+
response = _context2.sent;
|
|
230
|
+
if (!response.ok) {
|
|
231
|
+
_context2.next = 10;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
_context2.next = 8;
|
|
235
|
+
return response.text();
|
|
236
|
+
case 8:
|
|
237
|
+
workspaceType = _context2.sent;
|
|
238
|
+
return _context2.abrupt("return", Promise.resolve(workspaceType === 'GLOBAL_EXPERIENCE'));
|
|
239
|
+
case 10:
|
|
240
|
+
return _context2.abrupt("return", Promise.resolve(false));
|
|
241
|
+
case 13:
|
|
242
|
+
_context2.prev = 13;
|
|
243
|
+
_context2.t0 = _context2["catch"](1);
|
|
244
|
+
return _context2.abrupt("return", Promise.resolve(false));
|
|
245
|
+
case 16:
|
|
246
|
+
case "end":
|
|
247
|
+
return _context2.stop();
|
|
248
|
+
}
|
|
249
|
+
}, _callee2, this, [[1, 13]]);
|
|
250
|
+
}));
|
|
251
|
+
function isGlobalExperienceWorkspaceForCloudId(_x2) {
|
|
252
|
+
return _isGlobalExperienceWorkspaceForCloudId.apply(this, arguments);
|
|
253
|
+
}
|
|
254
|
+
return isGlobalExperienceWorkspaceForCloudId;
|
|
255
|
+
}()
|
|
256
|
+
}, {
|
|
257
|
+
key: "getMaybeShardedApiPath",
|
|
258
|
+
value: function getMaybeShardedApiPath(cloudId) {
|
|
259
|
+
var maybeShardedPath = (0, _platformFeatureFlags.fg)('enable_ptc_sharded_townsquare_calls') ? "/townsquare/s/".concat(cloudId) : '/watermelon';
|
|
260
|
+
return "/gateway/api".concat(maybeShardedPath);
|
|
261
|
+
}
|
|
190
262
|
}, {
|
|
191
263
|
key: "filterReportingLinesUser",
|
|
192
264
|
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', "20.
|
|
60
|
+
headers.append('atl-client-version', "20.6.0");
|
|
61
61
|
return headers;
|
|
62
62
|
};
|
|
63
63
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -186,7 +186,7 @@ var TeamProfileCardTriggerInternal = exports.TeamProfileCardTriggerInternal = /*
|
|
|
186
186
|
var fireEvent = function fireEvent(event) {
|
|
187
187
|
_this.fireAnalytics(event);
|
|
188
188
|
};
|
|
189
|
-
var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos()]);
|
|
189
|
+
var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl()]);
|
|
190
190
|
requests.then(function (res) {
|
|
191
191
|
var _this2;
|
|
192
192
|
return (_this2 = _this).handleClientSuccess.apply(_this2, (0, _toConsumableArray2.default)(res));
|
|
@@ -309,7 +309,7 @@ var TeamProfileCardTriggerInternal = exports.TeamProfileCardTriggerInternal = /*
|
|
|
309
309
|
}
|
|
310
310
|
}, {
|
|
311
311
|
key: "handleClientSuccess",
|
|
312
|
-
value: function handleClientSuccess(team, shouldShowGiveKudos) {
|
|
312
|
+
value: function handleClientSuccess(team, shouldShowGiveKudos, teamCentralBaseUrl) {
|
|
313
313
|
if (!this._isMounted) {
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
@@ -318,7 +318,7 @@ var TeamProfileCardTriggerInternal = exports.TeamProfileCardTriggerInternal = /*
|
|
|
318
318
|
hasError: false,
|
|
319
319
|
data: team,
|
|
320
320
|
shouldShowGiveKudos: shouldShowGiveKudos,
|
|
321
|
-
teamCentralBaseUrl:
|
|
321
|
+
teamCentralBaseUrl: teamCentralBaseUrl
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
324
|
}, {
|
|
@@ -49,7 +49,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
49
49
|
data: null,
|
|
50
50
|
reportingLinesData: undefined,
|
|
51
51
|
isKudosEnabled: false,
|
|
52
|
-
kudosDrawerOpen: false
|
|
52
|
+
kudosDrawerOpen: false,
|
|
53
|
+
teamCentralBaseUrl: undefined
|
|
53
54
|
});
|
|
54
55
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireAnalytics", function (payload) {
|
|
55
56
|
// Don't fire analytics if the component is unmounted
|
|
@@ -74,7 +75,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
74
75
|
hasError: false,
|
|
75
76
|
data: null
|
|
76
77
|
}, function () {
|
|
77
|
-
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos()]);
|
|
78
|
+
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl()]);
|
|
78
79
|
requests.then(function (res) {
|
|
79
80
|
var _this2;
|
|
80
81
|
return (_this2 = _this).handleClientSuccess.apply(_this2, (0, _toConsumableArray2.default)(res));
|
|
@@ -126,7 +127,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
126
127
|
}
|
|
127
128
|
}, {
|
|
128
129
|
key: "handleClientSuccess",
|
|
129
|
-
value: function handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
130
|
+
value: function handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos, teamCentralBaseUrl) {
|
|
130
131
|
if (!this._isMounted) {
|
|
131
132
|
return;
|
|
132
133
|
}
|
|
@@ -135,7 +136,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
135
136
|
hasError: false,
|
|
136
137
|
data: profileData,
|
|
137
138
|
reportingLinesData: reportingLinesData,
|
|
138
|
-
isKudosEnabled: shouldShowGiveKudos
|
|
139
|
+
isKudosEnabled: shouldShowGiveKudos,
|
|
140
|
+
teamCentralBaseUrl: teamCentralBaseUrl
|
|
139
141
|
});
|
|
140
142
|
}
|
|
141
143
|
}, {
|
|
@@ -159,7 +161,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
159
161
|
error = _this$state.error,
|
|
160
162
|
data = _this$state.data,
|
|
161
163
|
reportingLinesData = _this$state.reportingLinesData,
|
|
162
|
-
isKudosEnabled = _this$state.isKudosEnabled
|
|
164
|
+
isKudosEnabled = _this$state.isKudosEnabled,
|
|
165
|
+
teamCentralBaseUrl = _this$state.teamCentralBaseUrl;
|
|
163
166
|
var _this$props3 = this.props,
|
|
164
167
|
onReportingLinesClick = _this$props3.onReportingLinesClick,
|
|
165
168
|
cloudId = _this$props3.cloudId,
|
|
@@ -190,7 +193,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
190
193
|
addFlag: addFlag
|
|
191
194
|
}, data), {}, {
|
|
192
195
|
isKudosEnabled: isKudosEnabled,
|
|
193
|
-
teamCentralBaseUrl:
|
|
196
|
+
teamCentralBaseUrl: teamCentralBaseUrl,
|
|
194
197
|
openKudosDrawer: this.openKudosDrawer
|
|
195
198
|
});
|
|
196
199
|
return /*#__PURE__*/_react.default.createElement(_Card.CardWrapper, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isKudosEnabled && /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
@@ -191,7 +191,7 @@ function ProfilecardTriggerNext(_ref2) {
|
|
|
191
191
|
setVisible(false);
|
|
192
192
|
onVisibilityChange && onVisibilityChange(false);
|
|
193
193
|
}, [setTriggeredUsingKeyboard, setVisible, onVisibilityChange]);
|
|
194
|
-
var handleClientSuccess = (0, _react.useCallback)(function (profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
194
|
+
var handleClientSuccess = (0, _react.useCallback)(function (profileData, reportingLinesData, shouldShowGiveKudos, teamCentralBaseUrl) {
|
|
195
195
|
if (!isMounted.current) {
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
@@ -199,6 +199,7 @@ function ProfilecardTriggerNext(_ref2) {
|
|
|
199
199
|
setHasError(false);
|
|
200
200
|
setData(profileData);
|
|
201
201
|
setReportingLinesData(reportingLinesData);
|
|
202
|
+
setTeamCentralBaseUrl(teamCentralBaseUrl);
|
|
202
203
|
setShouldShowGiveKudos(shouldShowGiveKudos);
|
|
203
204
|
}, [setHasError, setIsLoading, setData, setReportingLinesData, setShouldShowGiveKudos]);
|
|
204
205
|
var handleClientError = (0, _react.useCallback)(function (err) {
|
|
@@ -220,29 +221,28 @@ function ProfilecardTriggerNext(_ref2) {
|
|
|
220
221
|
}
|
|
221
222
|
return _context.abrupt("return");
|
|
222
223
|
case 2:
|
|
223
|
-
setTeamCentralBaseUrl(resourceClient.getTeamCentralBaseUrl());
|
|
224
224
|
setIsLoading(true);
|
|
225
225
|
setHasError(false);
|
|
226
226
|
setError(null);
|
|
227
227
|
setData(null);
|
|
228
|
-
_context.prev =
|
|
229
|
-
requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos()]);
|
|
230
|
-
_context.next =
|
|
228
|
+
_context.prev = 6;
|
|
229
|
+
requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl()]);
|
|
230
|
+
_context.next = 10;
|
|
231
231
|
return requests;
|
|
232
|
-
case
|
|
232
|
+
case 10:
|
|
233
233
|
responses = _context.sent;
|
|
234
234
|
handleClientSuccess.apply(void 0, (0, _toConsumableArray2.default)(responses));
|
|
235
|
-
_context.next =
|
|
235
|
+
_context.next = 17;
|
|
236
236
|
break;
|
|
237
|
-
case
|
|
238
|
-
_context.prev =
|
|
239
|
-
_context.t0 = _context["catch"](
|
|
237
|
+
case 14:
|
|
238
|
+
_context.prev = 14;
|
|
239
|
+
_context.t0 = _context["catch"](6);
|
|
240
240
|
handleClientError(_context.t0);
|
|
241
|
-
case
|
|
241
|
+
case 17:
|
|
242
242
|
case "end":
|
|
243
243
|
return _context.stop();
|
|
244
244
|
}
|
|
245
|
-
}, _callee, null, [[
|
|
245
|
+
}, _callee, null, [[6, 14]]);
|
|
246
246
|
})), [cloudId, fireAnalytics, isLoading, resourceClient, userId, handleClientSuccess, handleClientError]);
|
|
247
247
|
var showProfilecard = (0, _react.useCallback)(function () {
|
|
248
248
|
clearTimeout(hideTimer.current);
|
|
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
45
45
|
actionSubjectId: actionSubjectId,
|
|
46
46
|
attributes: _objectSpread(_objectSpread({
|
|
47
47
|
packageName: "@atlaskit/profilecard",
|
|
48
|
-
packageVersion: "20.
|
|
48
|
+
packageVersion: "20.6.0"
|
|
49
49
|
}, attributes), {}, {
|
|
50
50
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
51
51
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isFedRamp } from '@atlaskit/atlassian-context';
|
|
1
|
+
import { getATLContextUrl, isFedRamp } from '@atlaskit/atlassian-context';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import RovoAgentCardClient from './RovoAgentCardClient';
|
|
4
4
|
import TeamCentralCardClient from './TeamCentralCardClient';
|
|
@@ -43,12 +43,19 @@ class ProfileCardClient {
|
|
|
43
43
|
reports: []
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
getTeamCentralBaseUrl() {
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
async getTeamCentralBaseUrl() {
|
|
47
|
+
if (!fg('enable_ptc_sharded_townsquare_calls')) {
|
|
48
|
+
var _this$tcClient3;
|
|
49
|
+
return Promise.resolve((_this$tcClient3 = this.tcClient) === null || _this$tcClient3 === void 0 ? void 0 : _this$tcClient3.options.teamCentralBaseUrl);
|
|
50
|
+
}
|
|
51
|
+
if (this.tcClient === undefined) {
|
|
52
|
+
return Promise.resolve(undefined);
|
|
53
|
+
}
|
|
54
|
+
const isGlobalExperienceWorkspace = await this.tcClient.getIsGlobalExperienceWorkspace();
|
|
55
|
+
return Promise.resolve(isGlobalExperienceWorkspace ? getATLContextUrl('home') : getATLContextUrl('team'));
|
|
49
56
|
}
|
|
50
|
-
shouldShowGiveKudos() {
|
|
51
|
-
if (!this.tcClient || !this.getTeamCentralBaseUrl()) {
|
|
57
|
+
async shouldShowGiveKudos() {
|
|
58
|
+
if (!this.tcClient || !(await this.getTeamCentralBaseUrl())) {
|
|
52
59
|
return Promise.resolve(false);
|
|
53
60
|
}
|
|
54
61
|
return this.tcClient.checkWorkspaceExists();
|
|
@@ -32,6 +32,7 @@ export const buildReportingLinesQuery = aaid => ({
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
let isTCReadyPromiseMap = new Map();
|
|
35
|
+
const globalExperiencePromiseCache = new Map();
|
|
35
36
|
class TeamCentralCardClient extends CachingClient {
|
|
36
37
|
/**
|
|
37
38
|
* Simple circuit breaker to avoid making unnecessary calls to Team Central on auth failures
|
|
@@ -47,6 +48,7 @@ class TeamCentralCardClient extends CachingClient {
|
|
|
47
48
|
this.options = options;
|
|
48
49
|
this.bypassOnFailure = false;
|
|
49
50
|
this.isTCReadyPromise = this.createTcReadyPromise(options);
|
|
51
|
+
this.isGlobalExperienceWorkspacePromise = this.preloadIsGlobalExperienceWorkspace(options.cloudId);
|
|
50
52
|
}
|
|
51
53
|
createTcReadyPromise(config) {
|
|
52
54
|
if (config.cloudId) {
|
|
@@ -134,16 +136,53 @@ class TeamCentralCardClient extends CachingClient {
|
|
|
134
136
|
return Promise.resolve(false);
|
|
135
137
|
}, () => Promise.resolve(false));
|
|
136
138
|
}
|
|
139
|
+
getIsGlobalExperienceWorkspace() {
|
|
140
|
+
return this.isGlobalExperienceWorkspacePromise;
|
|
141
|
+
}
|
|
142
|
+
preloadIsGlobalExperienceWorkspace(cloudId) {
|
|
143
|
+
if (!fg('enable_ptc_sharded_townsquare_calls')) {
|
|
144
|
+
return Promise.resolve(false);
|
|
145
|
+
}
|
|
146
|
+
if (cloudId === undefined) {
|
|
147
|
+
return Promise.resolve(false);
|
|
148
|
+
}
|
|
149
|
+
const maybeIsGlobalExperienceWorkspaceForCloudIdPromise = globalExperiencePromiseCache.get(cloudId);
|
|
150
|
+
if (maybeIsGlobalExperienceWorkspaceForCloudIdPromise !== undefined) {
|
|
151
|
+
return maybeIsGlobalExperienceWorkspaceForCloudIdPromise;
|
|
152
|
+
}
|
|
153
|
+
const isGlobalExperienceWorkspaceForCloudIdPromise = this.isGlobalExperienceWorkspaceForCloudId(cloudId);
|
|
154
|
+
globalExperiencePromiseCache.set(cloudId, isGlobalExperienceWorkspaceForCloudIdPromise);
|
|
155
|
+
return isGlobalExperienceWorkspaceForCloudIdPromise;
|
|
156
|
+
}
|
|
137
157
|
hasTCWorkspace(config) {
|
|
138
158
|
if (config.cloudId) {
|
|
139
|
-
const
|
|
140
|
-
return fetch(
|
|
159
|
+
const maybeShardedApiPath = this.getMaybeShardedApiPath(config.cloudId);
|
|
160
|
+
return fetch(`${maybeShardedApiPath}/organization/containsAnyWorkspace?cloudId=${config.cloudId}`).then(res => {
|
|
141
161
|
return !res || res && res.ok;
|
|
142
162
|
});
|
|
143
163
|
} else {
|
|
144
164
|
return Promise.resolve(false);
|
|
145
165
|
}
|
|
146
166
|
}
|
|
167
|
+
async isGlobalExperienceWorkspaceForCloudId(cloudId) {
|
|
168
|
+
const maybeShardedApiPath = this.getMaybeShardedApiPath(cloudId);
|
|
169
|
+
try {
|
|
170
|
+
const response = await fetch(`${maybeShardedApiPath}/workspace/existsWithWorkspaceType?cloudId=${cloudId}`, {
|
|
171
|
+
credentials: 'include'
|
|
172
|
+
});
|
|
173
|
+
if (response.ok) {
|
|
174
|
+
const workspaceType = await response.text();
|
|
175
|
+
return Promise.resolve(workspaceType === 'GLOBAL_EXPERIENCE');
|
|
176
|
+
}
|
|
177
|
+
return Promise.resolve(false);
|
|
178
|
+
} catch (err) {
|
|
179
|
+
return Promise.resolve(false);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
getMaybeShardedApiPath(cloudId) {
|
|
183
|
+
const maybeShardedPath = fg('enable_ptc_sharded_townsquare_calls') ? `/townsquare/s/${cloudId}` : '/watermelon';
|
|
184
|
+
return `/gateway/api${maybeShardedPath}`;
|
|
185
|
+
}
|
|
147
186
|
filterReportingLinesUser(users = []) {
|
|
148
187
|
return users.filter(user => user.identifierType === 'ATLASSIAN_ID');
|
|
149
188
|
}
|
|
@@ -67,7 +67,7 @@ export const addHeaders = headers => {
|
|
|
67
67
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
68
68
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
69
69
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
70
|
-
headers.append('atl-client-version', "20.
|
|
70
|
+
headers.append('atl-client-version', "20.6.0");
|
|
71
71
|
return headers;
|
|
72
72
|
};
|
|
73
73
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
@@ -161,7 +161,7 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
161
161
|
const fireEvent = event => {
|
|
162
162
|
this.fireAnalytics(event);
|
|
163
163
|
};
|
|
164
|
-
const requests = Promise.all([this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), this.props.resourceClient.shouldShowGiveKudos()]);
|
|
164
|
+
const requests = Promise.all([this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl()]);
|
|
165
165
|
requests.then(res => this.handleClientSuccess(...res), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
|
|
166
166
|
});
|
|
167
167
|
});
|
|
@@ -274,7 +274,7 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
274
274
|
clearTimeout(this.showTimer);
|
|
275
275
|
clearTimeout(this.hideTimer);
|
|
276
276
|
}
|
|
277
|
-
handleClientSuccess(team, shouldShowGiveKudos) {
|
|
277
|
+
handleClientSuccess(team, shouldShowGiveKudos, teamCentralBaseUrl) {
|
|
278
278
|
if (!this._isMounted) {
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
@@ -283,7 +283,7 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
283
283
|
hasError: false,
|
|
284
284
|
data: team,
|
|
285
285
|
shouldShowGiveKudos,
|
|
286
|
-
teamCentralBaseUrl
|
|
286
|
+
teamCentralBaseUrl
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
289
|
handleClientError(err) {
|
|
@@ -21,7 +21,8 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
21
21
|
data: null,
|
|
22
22
|
reportingLinesData: undefined,
|
|
23
23
|
isKudosEnabled: false,
|
|
24
|
-
kudosDrawerOpen: false
|
|
24
|
+
kudosDrawerOpen: false,
|
|
25
|
+
teamCentralBaseUrl: undefined
|
|
25
26
|
});
|
|
26
27
|
_defineProperty(this, "fireAnalytics", payload => {
|
|
27
28
|
// Don't fire analytics if the component is unmounted
|
|
@@ -49,7 +50,7 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
49
50
|
hasError: false,
|
|
50
51
|
data: null
|
|
51
52
|
}, () => {
|
|
52
|
-
const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId, this.fireAnalytics), this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos()]);
|
|
53
|
+
const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId, this.fireAnalytics), this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl()]);
|
|
53
54
|
requests.then(res => this.handleClientSuccess(...res), err => this.handleClientError(err)).catch(err => this.handleClientError(err));
|
|
54
55
|
});
|
|
55
56
|
});
|
|
@@ -84,7 +85,7 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
84
85
|
componentWillUnmount() {
|
|
85
86
|
this._isMounted = false;
|
|
86
87
|
}
|
|
87
|
-
handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
88
|
+
handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos, teamCentralBaseUrl) {
|
|
88
89
|
if (!this._isMounted) {
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
@@ -93,7 +94,8 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
93
94
|
hasError: false,
|
|
94
95
|
data: profileData,
|
|
95
96
|
reportingLinesData,
|
|
96
|
-
isKudosEnabled: shouldShowGiveKudos
|
|
97
|
+
isKudosEnabled: shouldShowGiveKudos,
|
|
98
|
+
teamCentralBaseUrl
|
|
97
99
|
});
|
|
98
100
|
}
|
|
99
101
|
handleClientError(err) {
|
|
@@ -113,7 +115,8 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
113
115
|
error,
|
|
114
116
|
data,
|
|
115
117
|
reportingLinesData,
|
|
116
|
-
isKudosEnabled
|
|
118
|
+
isKudosEnabled,
|
|
119
|
+
teamCentralBaseUrl
|
|
117
120
|
} = this.state;
|
|
118
121
|
const {
|
|
119
122
|
onReportingLinesClick,
|
|
@@ -146,7 +149,7 @@ class ProfileCardResourced extends React.PureComponent {
|
|
|
146
149
|
addFlag,
|
|
147
150
|
...data,
|
|
148
151
|
isKudosEnabled,
|
|
149
|
-
teamCentralBaseUrl
|
|
152
|
+
teamCentralBaseUrl,
|
|
150
153
|
openKudosDrawer: this.openKudosDrawer
|
|
151
154
|
};
|
|
152
155
|
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && /*#__PURE__*/React.createElement(Suspense, {
|
|
@@ -142,7 +142,7 @@ export default function ProfilecardTriggerNext({
|
|
|
142
142
|
setVisible(false);
|
|
143
143
|
onVisibilityChange && onVisibilityChange(false);
|
|
144
144
|
}, [setTriggeredUsingKeyboard, setVisible, onVisibilityChange]);
|
|
145
|
-
const handleClientSuccess = useCallback((profileData, reportingLinesData, shouldShowGiveKudos) => {
|
|
145
|
+
const handleClientSuccess = useCallback((profileData, reportingLinesData, shouldShowGiveKudos, teamCentralBaseUrl) => {
|
|
146
146
|
if (!isMounted.current) {
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
@@ -150,6 +150,7 @@ export default function ProfilecardTriggerNext({
|
|
|
150
150
|
setHasError(false);
|
|
151
151
|
setData(profileData);
|
|
152
152
|
setReportingLinesData(reportingLinesData);
|
|
153
|
+
setTeamCentralBaseUrl(teamCentralBaseUrl);
|
|
153
154
|
setShouldShowGiveKudos(shouldShowGiveKudos);
|
|
154
155
|
}, [setHasError, setIsLoading, setData, setReportingLinesData, setShouldShowGiveKudos]);
|
|
155
156
|
const handleClientError = useCallback(err => {
|
|
@@ -165,13 +166,12 @@ export default function ProfilecardTriggerNext({
|
|
|
165
166
|
// don't fetch data when fetching is in process
|
|
166
167
|
return;
|
|
167
168
|
}
|
|
168
|
-
setTeamCentralBaseUrl(resourceClient.getTeamCentralBaseUrl());
|
|
169
169
|
setIsLoading(true);
|
|
170
170
|
setHasError(false);
|
|
171
171
|
setError(null);
|
|
172
172
|
setData(null);
|
|
173
173
|
try {
|
|
174
|
-
const requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos()]);
|
|
174
|
+
const requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl()]);
|
|
175
175
|
const responses = await requests;
|
|
176
176
|
handleClientSuccess(...responses);
|
|
177
177
|
} catch (err) {
|
|
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
|
|
|
32
32
|
actionSubjectId,
|
|
33
33
|
attributes: {
|
|
34
34
|
packageName: "@atlaskit/profilecard",
|
|
35
|
-
packageVersion: "20.
|
|
35
|
+
packageVersion: "20.6.0",
|
|
36
36
|
...attributes,
|
|
37
37
|
firedAt: Math.round(getPageTime())
|
|
38
38
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
6
|
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
7
|
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
|
-
import { isFedRamp } from '@atlaskit/atlassian-context';
|
|
8
|
+
import { getATLContextUrl, isFedRamp } from '@atlaskit/atlassian-context';
|
|
7
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
10
|
import RovoAgentCardClient from './RovoAgentCardClient';
|
|
9
11
|
import TeamCentralCardClient from './TeamCentralCardClient';
|
|
@@ -55,18 +57,75 @@ var ProfileCardClient = /*#__PURE__*/function () {
|
|
|
55
57
|
}
|
|
56
58
|
}, {
|
|
57
59
|
key: "getTeamCentralBaseUrl",
|
|
58
|
-
value: function
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
value: function () {
|
|
61
|
+
var _getTeamCentralBaseUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
62
|
+
var _this$tcClient3, isGlobalExperienceWorkspace;
|
|
63
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
64
|
+
while (1) switch (_context.prev = _context.next) {
|
|
65
|
+
case 0:
|
|
66
|
+
if (fg('enable_ptc_sharded_townsquare_calls')) {
|
|
67
|
+
_context.next = 2;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return _context.abrupt("return", Promise.resolve((_this$tcClient3 = this.tcClient) === null || _this$tcClient3 === void 0 ? void 0 : _this$tcClient3.options.teamCentralBaseUrl));
|
|
71
|
+
case 2:
|
|
72
|
+
if (!(this.tcClient === undefined)) {
|
|
73
|
+
_context.next = 4;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
return _context.abrupt("return", Promise.resolve(undefined));
|
|
77
|
+
case 4:
|
|
78
|
+
_context.next = 6;
|
|
79
|
+
return this.tcClient.getIsGlobalExperienceWorkspace();
|
|
80
|
+
case 6:
|
|
81
|
+
isGlobalExperienceWorkspace = _context.sent;
|
|
82
|
+
return _context.abrupt("return", Promise.resolve(isGlobalExperienceWorkspace ? getATLContextUrl('home') : getATLContextUrl('team')));
|
|
83
|
+
case 8:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context.stop();
|
|
86
|
+
}
|
|
87
|
+
}, _callee, this);
|
|
88
|
+
}));
|
|
89
|
+
function getTeamCentralBaseUrl() {
|
|
90
|
+
return _getTeamCentralBaseUrl.apply(this, arguments);
|
|
91
|
+
}
|
|
92
|
+
return getTeamCentralBaseUrl;
|
|
93
|
+
}()
|
|
62
94
|
}, {
|
|
63
95
|
key: "shouldShowGiveKudos",
|
|
64
|
-
value: function
|
|
65
|
-
|
|
66
|
-
return
|
|
96
|
+
value: function () {
|
|
97
|
+
var _shouldShowGiveKudos = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
98
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
99
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
100
|
+
case 0:
|
|
101
|
+
_context2.t0 = !this.tcClient;
|
|
102
|
+
if (_context2.t0) {
|
|
103
|
+
_context2.next = 5;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
_context2.next = 4;
|
|
107
|
+
return this.getTeamCentralBaseUrl();
|
|
108
|
+
case 4:
|
|
109
|
+
_context2.t0 = !_context2.sent;
|
|
110
|
+
case 5:
|
|
111
|
+
if (!_context2.t0) {
|
|
112
|
+
_context2.next = 7;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
return _context2.abrupt("return", Promise.resolve(false));
|
|
116
|
+
case 7:
|
|
117
|
+
return _context2.abrupt("return", this.tcClient.checkWorkspaceExists());
|
|
118
|
+
case 8:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context2.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee2, this);
|
|
123
|
+
}));
|
|
124
|
+
function shouldShowGiveKudos() {
|
|
125
|
+
return _shouldShowGiveKudos.apply(this, arguments);
|
|
67
126
|
}
|
|
68
|
-
return
|
|
69
|
-
}
|
|
127
|
+
return shouldShowGiveKudos;
|
|
128
|
+
}()
|
|
70
129
|
}, {
|
|
71
130
|
key: "getRovoAgentProfile",
|
|
72
131
|
value: function getRovoAgentProfile(id, analytics) {
|
|
@@ -19,6 +19,7 @@ export var buildReportingLinesQuery = function buildReportingLinesQuery(aaid) {
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
var isTCReadyPromiseMap = new Map();
|
|
22
|
+
var globalExperiencePromiseCache = new Map();
|
|
22
23
|
var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
23
24
|
_inherits(TeamCentralCardClient, _CachingClient);
|
|
24
25
|
var _super = _createSuper(TeamCentralCardClient);
|
|
@@ -38,6 +39,7 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
38
39
|
_this.options = options;
|
|
39
40
|
_this.bypassOnFailure = false;
|
|
40
41
|
_this.isTCReadyPromise = _this.createTcReadyPromise(options);
|
|
42
|
+
_this.isGlobalExperienceWorkspacePromise = _this.preloadIsGlobalExperienceWorkspace(options.cloudId);
|
|
41
43
|
return _this;
|
|
42
44
|
}
|
|
43
45
|
_createClass(TeamCentralCardClient, [{
|
|
@@ -168,18 +170,88 @@ var TeamCentralCardClient = /*#__PURE__*/function (_CachingClient) {
|
|
|
168
170
|
return Promise.resolve(false);
|
|
169
171
|
});
|
|
170
172
|
}
|
|
173
|
+
}, {
|
|
174
|
+
key: "getIsGlobalExperienceWorkspace",
|
|
175
|
+
value: function getIsGlobalExperienceWorkspace() {
|
|
176
|
+
return this.isGlobalExperienceWorkspacePromise;
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "preloadIsGlobalExperienceWorkspace",
|
|
180
|
+
value: function preloadIsGlobalExperienceWorkspace(cloudId) {
|
|
181
|
+
if (!fg('enable_ptc_sharded_townsquare_calls')) {
|
|
182
|
+
return Promise.resolve(false);
|
|
183
|
+
}
|
|
184
|
+
if (cloudId === undefined) {
|
|
185
|
+
return Promise.resolve(false);
|
|
186
|
+
}
|
|
187
|
+
var maybeIsGlobalExperienceWorkspaceForCloudIdPromise = globalExperiencePromiseCache.get(cloudId);
|
|
188
|
+
if (maybeIsGlobalExperienceWorkspaceForCloudIdPromise !== undefined) {
|
|
189
|
+
return maybeIsGlobalExperienceWorkspaceForCloudIdPromise;
|
|
190
|
+
}
|
|
191
|
+
var isGlobalExperienceWorkspaceForCloudIdPromise = this.isGlobalExperienceWorkspaceForCloudId(cloudId);
|
|
192
|
+
globalExperiencePromiseCache.set(cloudId, isGlobalExperienceWorkspaceForCloudIdPromise);
|
|
193
|
+
return isGlobalExperienceWorkspaceForCloudIdPromise;
|
|
194
|
+
}
|
|
171
195
|
}, {
|
|
172
196
|
key: "hasTCWorkspace",
|
|
173
197
|
value: function hasTCWorkspace(config) {
|
|
174
198
|
if (config.cloudId) {
|
|
175
|
-
var
|
|
176
|
-
return fetch("
|
|
199
|
+
var maybeShardedApiPath = this.getMaybeShardedApiPath(config.cloudId);
|
|
200
|
+
return fetch("".concat(maybeShardedApiPath, "/organization/containsAnyWorkspace?cloudId=").concat(config.cloudId)).then(function (res) {
|
|
177
201
|
return !res || res && res.ok;
|
|
178
202
|
});
|
|
179
203
|
} else {
|
|
180
204
|
return Promise.resolve(false);
|
|
181
205
|
}
|
|
182
206
|
}
|
|
207
|
+
}, {
|
|
208
|
+
key: "isGlobalExperienceWorkspaceForCloudId",
|
|
209
|
+
value: function () {
|
|
210
|
+
var _isGlobalExperienceWorkspaceForCloudId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cloudId) {
|
|
211
|
+
var maybeShardedApiPath, response, workspaceType;
|
|
212
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
213
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
214
|
+
case 0:
|
|
215
|
+
maybeShardedApiPath = this.getMaybeShardedApiPath(cloudId);
|
|
216
|
+
_context2.prev = 1;
|
|
217
|
+
_context2.next = 4;
|
|
218
|
+
return fetch("".concat(maybeShardedApiPath, "/workspace/existsWithWorkspaceType?cloudId=").concat(cloudId), {
|
|
219
|
+
credentials: 'include'
|
|
220
|
+
});
|
|
221
|
+
case 4:
|
|
222
|
+
response = _context2.sent;
|
|
223
|
+
if (!response.ok) {
|
|
224
|
+
_context2.next = 10;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
_context2.next = 8;
|
|
228
|
+
return response.text();
|
|
229
|
+
case 8:
|
|
230
|
+
workspaceType = _context2.sent;
|
|
231
|
+
return _context2.abrupt("return", Promise.resolve(workspaceType === 'GLOBAL_EXPERIENCE'));
|
|
232
|
+
case 10:
|
|
233
|
+
return _context2.abrupt("return", Promise.resolve(false));
|
|
234
|
+
case 13:
|
|
235
|
+
_context2.prev = 13;
|
|
236
|
+
_context2.t0 = _context2["catch"](1);
|
|
237
|
+
return _context2.abrupt("return", Promise.resolve(false));
|
|
238
|
+
case 16:
|
|
239
|
+
case "end":
|
|
240
|
+
return _context2.stop();
|
|
241
|
+
}
|
|
242
|
+
}, _callee2, this, [[1, 13]]);
|
|
243
|
+
}));
|
|
244
|
+
function isGlobalExperienceWorkspaceForCloudId(_x2) {
|
|
245
|
+
return _isGlobalExperienceWorkspaceForCloudId.apply(this, arguments);
|
|
246
|
+
}
|
|
247
|
+
return isGlobalExperienceWorkspaceForCloudId;
|
|
248
|
+
}()
|
|
249
|
+
}, {
|
|
250
|
+
key: "getMaybeShardedApiPath",
|
|
251
|
+
value: function getMaybeShardedApiPath(cloudId) {
|
|
252
|
+
var maybeShardedPath = fg('enable_ptc_sharded_townsquare_calls') ? "/townsquare/s/".concat(cloudId) : '/watermelon';
|
|
253
|
+
return "/gateway/api".concat(maybeShardedPath);
|
|
254
|
+
}
|
|
183
255
|
}, {
|
|
184
256
|
key: "filterReportingLinesUser",
|
|
185
257
|
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', "20.
|
|
51
|
+
headers.append('atl-client-version', "20.6.0");
|
|
52
52
|
return headers;
|
|
53
53
|
};
|
|
54
54
|
export function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -176,7 +176,7 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
|
|
|
176
176
|
var fireEvent = function fireEvent(event) {
|
|
177
177
|
_this.fireAnalytics(event);
|
|
178
178
|
};
|
|
179
|
-
var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos()]);
|
|
179
|
+
var requests = Promise.all([_this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl()]);
|
|
180
180
|
requests.then(function (res) {
|
|
181
181
|
var _this2;
|
|
182
182
|
return (_this2 = _this).handleClientSuccess.apply(_this2, _toConsumableArray(res));
|
|
@@ -299,7 +299,7 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
|
|
|
299
299
|
}
|
|
300
300
|
}, {
|
|
301
301
|
key: "handleClientSuccess",
|
|
302
|
-
value: function handleClientSuccess(team, shouldShowGiveKudos) {
|
|
302
|
+
value: function handleClientSuccess(team, shouldShowGiveKudos, teamCentralBaseUrl) {
|
|
303
303
|
if (!this._isMounted) {
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
@@ -308,7 +308,7 @@ export var TeamProfileCardTriggerInternal = /*#__PURE__*/function (_React$PureCo
|
|
|
308
308
|
hasError: false,
|
|
309
309
|
data: team,
|
|
310
310
|
shouldShowGiveKudos: shouldShowGiveKudos,
|
|
311
|
-
teamCentralBaseUrl:
|
|
311
|
+
teamCentralBaseUrl: teamCentralBaseUrl
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
314
|
}, {
|
|
@@ -39,7 +39,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
39
39
|
data: null,
|
|
40
40
|
reportingLinesData: undefined,
|
|
41
41
|
isKudosEnabled: false,
|
|
42
|
-
kudosDrawerOpen: false
|
|
42
|
+
kudosDrawerOpen: false,
|
|
43
|
+
teamCentralBaseUrl: undefined
|
|
43
44
|
});
|
|
44
45
|
_defineProperty(_assertThisInitialized(_this), "fireAnalytics", function (payload) {
|
|
45
46
|
// Don't fire analytics if the component is unmounted
|
|
@@ -64,7 +65,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
64
65
|
hasError: false,
|
|
65
66
|
data: null
|
|
66
67
|
}, function () {
|
|
67
|
-
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos()]);
|
|
68
|
+
var requests = Promise.all([_this.props.resourceClient.getProfile(cloudId, userId, _this.fireAnalytics), _this.props.resourceClient.getReportingLines(userId), _this.props.resourceClient.shouldShowGiveKudos(), _this.props.resourceClient.getTeamCentralBaseUrl()]);
|
|
68
69
|
requests.then(function (res) {
|
|
69
70
|
var _this2;
|
|
70
71
|
return (_this2 = _this).handleClientSuccess.apply(_this2, _toConsumableArray(res));
|
|
@@ -116,7 +117,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
116
117
|
}
|
|
117
118
|
}, {
|
|
118
119
|
key: "handleClientSuccess",
|
|
119
|
-
value: function handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
120
|
+
value: function handleClientSuccess(profileData, reportingLinesData, shouldShowGiveKudos, teamCentralBaseUrl) {
|
|
120
121
|
if (!this._isMounted) {
|
|
121
122
|
return;
|
|
122
123
|
}
|
|
@@ -125,7 +126,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
125
126
|
hasError: false,
|
|
126
127
|
data: profileData,
|
|
127
128
|
reportingLinesData: reportingLinesData,
|
|
128
|
-
isKudosEnabled: shouldShowGiveKudos
|
|
129
|
+
isKudosEnabled: shouldShowGiveKudos,
|
|
130
|
+
teamCentralBaseUrl: teamCentralBaseUrl
|
|
129
131
|
});
|
|
130
132
|
}
|
|
131
133
|
}, {
|
|
@@ -149,7 +151,8 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
149
151
|
error = _this$state.error,
|
|
150
152
|
data = _this$state.data,
|
|
151
153
|
reportingLinesData = _this$state.reportingLinesData,
|
|
152
|
-
isKudosEnabled = _this$state.isKudosEnabled
|
|
154
|
+
isKudosEnabled = _this$state.isKudosEnabled,
|
|
155
|
+
teamCentralBaseUrl = _this$state.teamCentralBaseUrl;
|
|
153
156
|
var _this$props3 = this.props,
|
|
154
157
|
onReportingLinesClick = _this$props3.onReportingLinesClick,
|
|
155
158
|
cloudId = _this$props3.cloudId,
|
|
@@ -180,7 +183,7 @@ var ProfileCardResourced = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
180
183
|
addFlag: addFlag
|
|
181
184
|
}, data), {}, {
|
|
182
185
|
isKudosEnabled: isKudosEnabled,
|
|
183
|
-
teamCentralBaseUrl:
|
|
186
|
+
teamCentralBaseUrl: teamCentralBaseUrl,
|
|
184
187
|
openKudosDrawer: this.openKudosDrawer
|
|
185
188
|
});
|
|
186
189
|
return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && /*#__PURE__*/React.createElement(Suspense, {
|
|
@@ -181,7 +181,7 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
181
181
|
setVisible(false);
|
|
182
182
|
onVisibilityChange && onVisibilityChange(false);
|
|
183
183
|
}, [setTriggeredUsingKeyboard, setVisible, onVisibilityChange]);
|
|
184
|
-
var handleClientSuccess = useCallback(function (profileData, reportingLinesData, shouldShowGiveKudos) {
|
|
184
|
+
var handleClientSuccess = useCallback(function (profileData, reportingLinesData, shouldShowGiveKudos, teamCentralBaseUrl) {
|
|
185
185
|
if (!isMounted.current) {
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
@@ -189,6 +189,7 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
189
189
|
setHasError(false);
|
|
190
190
|
setData(profileData);
|
|
191
191
|
setReportingLinesData(reportingLinesData);
|
|
192
|
+
setTeamCentralBaseUrl(teamCentralBaseUrl);
|
|
192
193
|
setShouldShowGiveKudos(shouldShowGiveKudos);
|
|
193
194
|
}, [setHasError, setIsLoading, setData, setReportingLinesData, setShouldShowGiveKudos]);
|
|
194
195
|
var handleClientError = useCallback(function (err) {
|
|
@@ -210,29 +211,28 @@ export default function ProfilecardTriggerNext(_ref2) {
|
|
|
210
211
|
}
|
|
211
212
|
return _context.abrupt("return");
|
|
212
213
|
case 2:
|
|
213
|
-
setTeamCentralBaseUrl(resourceClient.getTeamCentralBaseUrl());
|
|
214
214
|
setIsLoading(true);
|
|
215
215
|
setHasError(false);
|
|
216
216
|
setError(null);
|
|
217
217
|
setData(null);
|
|
218
|
-
_context.prev =
|
|
219
|
-
requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos()]);
|
|
220
|
-
_context.next =
|
|
218
|
+
_context.prev = 6;
|
|
219
|
+
requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl()]);
|
|
220
|
+
_context.next = 10;
|
|
221
221
|
return requests;
|
|
222
|
-
case
|
|
222
|
+
case 10:
|
|
223
223
|
responses = _context.sent;
|
|
224
224
|
handleClientSuccess.apply(void 0, _toConsumableArray(responses));
|
|
225
|
-
_context.next =
|
|
225
|
+
_context.next = 17;
|
|
226
226
|
break;
|
|
227
|
-
case
|
|
228
|
-
_context.prev =
|
|
229
|
-
_context.t0 = _context["catch"](
|
|
227
|
+
case 14:
|
|
228
|
+
_context.prev = 14;
|
|
229
|
+
_context.t0 = _context["catch"](6);
|
|
230
230
|
handleClientError(_context.t0);
|
|
231
|
-
case
|
|
231
|
+
case 17:
|
|
232
232
|
case "end":
|
|
233
233
|
return _context.stop();
|
|
234
234
|
}
|
|
235
|
-
}, _callee, null, [[
|
|
235
|
+
}, _callee, null, [[6, 14]]);
|
|
236
236
|
})), [cloudId, fireAnalytics, isLoading, resourceClient, userId, handleClientSuccess, handleClientError]);
|
|
237
237
|
var showProfilecard = useCallback(function () {
|
|
238
238
|
clearTimeout(hideTimer.current);
|
|
@@ -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: "20.
|
|
42
|
+
packageVersion: "20.6.0"
|
|
43
43
|
}, attributes), {}, {
|
|
44
44
|
firedAt: Math.round(getPageTime())
|
|
45
45
|
})
|
|
@@ -14,7 +14,7 @@ declare class ProfileCardClient implements ProfileClient {
|
|
|
14
14
|
getProfile(cloudId: string, userId: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<any>;
|
|
15
15
|
getTeamProfile(teamId: string, orgId?: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").Team>;
|
|
16
16
|
getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
17
|
-
getTeamCentralBaseUrl(): string | undefined
|
|
17
|
+
getTeamCentralBaseUrl(): Promise<string | undefined>;
|
|
18
18
|
shouldShowGiveKudos(): Promise<boolean>;
|
|
19
19
|
getRovoAgentProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").RovoAgent>;
|
|
20
20
|
deleteAgent(id: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
|
|
@@ -29,6 +29,7 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
|
|
|
29
29
|
*/
|
|
30
30
|
bypassOnFailure: boolean;
|
|
31
31
|
isTCReadyPromise: Promise<boolean>;
|
|
32
|
+
private isGlobalExperienceWorkspacePromise;
|
|
32
33
|
constructor(options: TeamCentralCardClientOptions);
|
|
33
34
|
createTcReadyPromise(config: TeamCentralCardClientOptions): Promise<boolean>;
|
|
34
35
|
getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
@@ -37,7 +38,11 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
|
|
|
37
38
|
*/
|
|
38
39
|
makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
39
40
|
checkWorkspaceExists(): Promise<boolean>;
|
|
41
|
+
getIsGlobalExperienceWorkspace(): Promise<boolean>;
|
|
42
|
+
private preloadIsGlobalExperienceWorkspace;
|
|
40
43
|
private hasTCWorkspace;
|
|
44
|
+
private isGlobalExperienceWorkspaceForCloudId;
|
|
45
|
+
private getMaybeShardedApiPath;
|
|
41
46
|
private filterReportingLinesUser;
|
|
42
47
|
}
|
|
43
48
|
export default TeamCentralCardClient;
|
|
@@ -37,7 +37,7 @@ export declare class TeamProfileCardTriggerInternal extends React.PureComponent<
|
|
|
37
37
|
componentWillUnmount(): void;
|
|
38
38
|
clientFetchProfile: () => void;
|
|
39
39
|
onErrorBoundary: () => void;
|
|
40
|
-
handleClientSuccess(team: Team, shouldShowGiveKudos: boolean): void;
|
|
40
|
+
handleClientSuccess(team: Team, shouldShowGiveKudos: boolean, teamCentralBaseUrl: string | undefined): void;
|
|
41
41
|
handleClientError(err: any): void;
|
|
42
42
|
filterActions(): ProfileCardAction[];
|
|
43
43
|
renderProfileCard: () => JSX.Element;
|
|
@@ -10,7 +10,7 @@ declare class ProfileCardResourced extends React.PureComponent<ProfileCardResour
|
|
|
10
10
|
componentDidUpdate(prevProps: ProfileCardResourcedProps): void;
|
|
11
11
|
componentWillUnmount(): void;
|
|
12
12
|
clientFetchProfile: () => void;
|
|
13
|
-
handleClientSuccess(profileData: ProfileCardClientData, reportingLinesData: TeamCentralReportingLinesData, shouldShowGiveKudos: boolean): void;
|
|
13
|
+
handleClientSuccess(profileData: ProfileCardClientData, reportingLinesData: TeamCentralReportingLinesData, shouldShowGiveKudos: boolean, teamCentralBaseUrl?: string): void;
|
|
14
14
|
handleClientError(err: any): void;
|
|
15
15
|
filterActions: () => ProfileCardAction[];
|
|
16
16
|
openKudosDrawer: () => void;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -141,6 +141,7 @@ export interface ProfileCardResourcedState {
|
|
|
141
141
|
reportingLinesData?: TeamCentralReportingLinesData;
|
|
142
142
|
isKudosEnabled?: boolean;
|
|
143
143
|
kudosDrawerOpen: boolean;
|
|
144
|
+
teamCentralBaseUrl?: string;
|
|
144
145
|
}
|
|
145
146
|
export interface ProfileCardTriggerProps {
|
|
146
147
|
userId: string;
|
|
@@ -438,7 +439,7 @@ export interface ProfileClient {
|
|
|
438
439
|
getTeamProfile: (teamId: string, orgId?: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<Team>;
|
|
439
440
|
getReportingLines: (userId: string) => Promise<TeamCentralReportingLinesData>;
|
|
440
441
|
shouldShowGiveKudos: () => Promise<boolean>;
|
|
441
|
-
getTeamCentralBaseUrl: () => string | undefined
|
|
442
|
+
getTeamCentralBaseUrl: () => Promise<string | undefined>;
|
|
442
443
|
getRovoAgentProfile: (id: AgentIdType, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<RovoAgent>;
|
|
443
444
|
deleteAgent: (id: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
|
|
444
445
|
setFavouriteAgent: (id: string, isFavourite: boolean, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
|
|
@@ -14,7 +14,7 @@ declare class ProfileCardClient implements ProfileClient {
|
|
|
14
14
|
getProfile(cloudId: string, userId: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<any>;
|
|
15
15
|
getTeamProfile(teamId: string, orgId?: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").Team>;
|
|
16
16
|
getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
17
|
-
getTeamCentralBaseUrl(): string | undefined
|
|
17
|
+
getTeamCentralBaseUrl(): Promise<string | undefined>;
|
|
18
18
|
shouldShowGiveKudos(): Promise<boolean>;
|
|
19
19
|
getRovoAgentProfile(id: AgentIdType, analytics?: (event: AnalyticsEventPayload) => void): Promise<import("../types").RovoAgent>;
|
|
20
20
|
deleteAgent(id: string, analytics?: (event: AnalyticsEventPayload) => void): Promise<void>;
|
|
@@ -29,6 +29,7 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
|
|
|
29
29
|
*/
|
|
30
30
|
bypassOnFailure: boolean;
|
|
31
31
|
isTCReadyPromise: Promise<boolean>;
|
|
32
|
+
private isGlobalExperienceWorkspacePromise;
|
|
32
33
|
constructor(options: TeamCentralCardClientOptions);
|
|
33
34
|
createTcReadyPromise(config: TeamCentralCardClientOptions): Promise<boolean>;
|
|
34
35
|
getReportingLines(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
@@ -37,7 +38,11 @@ declare class TeamCentralCardClient extends CachingClient<TeamCentralReportingLi
|
|
|
37
38
|
*/
|
|
38
39
|
makeRequest(userId: string): Promise<TeamCentralReportingLinesData>;
|
|
39
40
|
checkWorkspaceExists(): Promise<boolean>;
|
|
41
|
+
getIsGlobalExperienceWorkspace(): Promise<boolean>;
|
|
42
|
+
private preloadIsGlobalExperienceWorkspace;
|
|
40
43
|
private hasTCWorkspace;
|
|
44
|
+
private isGlobalExperienceWorkspaceForCloudId;
|
|
45
|
+
private getMaybeShardedApiPath;
|
|
41
46
|
private filterReportingLinesUser;
|
|
42
47
|
}
|
|
43
48
|
export default TeamCentralCardClient;
|
|
@@ -37,7 +37,7 @@ export declare class TeamProfileCardTriggerInternal extends React.PureComponent<
|
|
|
37
37
|
componentWillUnmount(): void;
|
|
38
38
|
clientFetchProfile: () => void;
|
|
39
39
|
onErrorBoundary: () => void;
|
|
40
|
-
handleClientSuccess(team: Team, shouldShowGiveKudos: boolean): void;
|
|
40
|
+
handleClientSuccess(team: Team, shouldShowGiveKudos: boolean, teamCentralBaseUrl: string | undefined): void;
|
|
41
41
|
handleClientError(err: any): void;
|
|
42
42
|
filterActions(): ProfileCardAction[];
|
|
43
43
|
renderProfileCard: () => JSX.Element;
|
|
@@ -10,7 +10,7 @@ declare class ProfileCardResourced extends React.PureComponent<ProfileCardResour
|
|
|
10
10
|
componentDidUpdate(prevProps: ProfileCardResourcedProps): void;
|
|
11
11
|
componentWillUnmount(): void;
|
|
12
12
|
clientFetchProfile: () => void;
|
|
13
|
-
handleClientSuccess(profileData: ProfileCardClientData, reportingLinesData: TeamCentralReportingLinesData, shouldShowGiveKudos: boolean): void;
|
|
13
|
+
handleClientSuccess(profileData: ProfileCardClientData, reportingLinesData: TeamCentralReportingLinesData, shouldShowGiveKudos: boolean, teamCentralBaseUrl?: string): void;
|
|
14
14
|
handleClientError(err: any): void;
|
|
15
15
|
filterActions: () => ProfileCardAction[];
|
|
16
16
|
openKudosDrawer: () => void;
|
|
@@ -141,6 +141,7 @@ export interface ProfileCardResourcedState {
|
|
|
141
141
|
reportingLinesData?: TeamCentralReportingLinesData;
|
|
142
142
|
isKudosEnabled?: boolean;
|
|
143
143
|
kudosDrawerOpen: boolean;
|
|
144
|
+
teamCentralBaseUrl?: string;
|
|
144
145
|
}
|
|
145
146
|
export interface ProfileCardTriggerProps {
|
|
146
147
|
userId: string;
|
|
@@ -444,7 +445,7 @@ export interface ProfileClient {
|
|
|
444
445
|
getTeamProfile: (teamId: string, orgId?: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<Team>;
|
|
445
446
|
getReportingLines: (userId: string) => Promise<TeamCentralReportingLinesData>;
|
|
446
447
|
shouldShowGiveKudos: () => Promise<boolean>;
|
|
447
|
-
getTeamCentralBaseUrl: () => string | undefined
|
|
448
|
+
getTeamCentralBaseUrl: () => Promise<string | undefined>;
|
|
448
449
|
getRovoAgentProfile: (id: AgentIdType, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<RovoAgent>;
|
|
449
450
|
deleteAgent: (id: string, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
|
|
450
451
|
setFavouriteAgent: (id: string, isFavourite: boolean, fireAnalytics?: (event: AnalyticsEventPayload) => void) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.6.0",
|
|
4
4
|
"description": "A React component to display a card with user information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"@atlassian/feature-flags-test-utils": "*",
|
|
90
90
|
"@atlassian/ptc-test-utils": "^0.8.0",
|
|
91
91
|
"@testing-library/react": "^12.1.5",
|
|
92
|
+
"@testing-library/user-event": "^14.4.3",
|
|
92
93
|
"enzyme": "^3.10.0",
|
|
93
94
|
"es6-promise": "^4.0.5",
|
|
94
95
|
"fetch-mock": "^8.0.0",
|