@atlaskit/teams-client 5.5.0 → 5.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 +22 -0
- package/dist/cjs/common/utils/error/isAuthError.js +1 -1
- package/dist/cjs/common/utils/ufo/index.js +2 -2
- package/dist/cjs/services/invitations-client/InvitationsClient.js +1 -1
- package/dist/cjs/services/sentry/utils/get-sentry-config.js +1 -1
- package/dist/cjs/services/teams-in-slack-client/TeamsInSlackClient.js +106 -21
- package/dist/es2019/common/utils/ari.js +1 -0
- package/dist/es2019/common/utils/error/index.js +1 -0
- package/dist/es2019/common/utils/error/isAuthError.js +1 -1
- package/dist/es2019/common/utils/index.js +1 -0
- package/dist/es2019/common/utils/permissions/index.js +1 -0
- package/dist/es2019/common/utils/team.js +1 -0
- package/dist/es2019/common/utils/ufo/index.js +2 -2
- package/dist/es2019/mocks/endpoints.js +1 -0
- package/dist/es2019/mocks/generate-data.js +1 -0
- package/dist/es2019/mocks/index.js +1 -0
- package/dist/es2019/services/agg-client/index.js +1 -0
- package/dist/es2019/services/hooks/use-teams-client-setup.js +1 -0
- package/dist/es2019/services/invitations-client/InvitationsClient.js +1 -1
- package/dist/es2019/services/public-api-client/index.js +1 -0
- package/dist/es2019/services/sentry/index.js +1 -0
- package/dist/es2019/services/sentry/main.js +1 -0
- package/dist/es2019/services/sentry/utils/get-sentry-config.js +1 -1
- package/dist/es2019/services/teams-in-slack-client/TeamsInSlackClient.js +47 -0
- package/dist/es2019/services/use-query-light/index.js +1 -0
- package/dist/es2019/services/use-query-light/main.js +1 -0
- package/dist/esm/common/utils/ari.js +1 -0
- package/dist/esm/common/utils/error/index.js +1 -0
- package/dist/esm/common/utils/error/isAuthError.js +1 -1
- package/dist/esm/common/utils/index.js +1 -0
- package/dist/esm/common/utils/permissions/index.js +1 -0
- package/dist/esm/common/utils/team.js +1 -0
- package/dist/esm/common/utils/ufo/index.js +2 -2
- package/dist/esm/mocks/endpoints.js +1 -0
- package/dist/esm/mocks/generate-data.js +1 -0
- package/dist/esm/mocks/index.js +1 -0
- package/dist/esm/services/agg-client/index.js +1 -0
- package/dist/esm/services/hooks/use-teams-client-setup.js +1 -0
- package/dist/esm/services/invitations-client/InvitationsClient.js +1 -1
- package/dist/esm/services/public-api-client/index.js +1 -0
- package/dist/esm/services/sentry/index.js +1 -0
- package/dist/esm/services/sentry/main.js +1 -0
- package/dist/esm/services/sentry/utils/get-sentry-config.js +1 -1
- package/dist/esm/services/teams-in-slack-client/TeamsInSlackClient.js +106 -21
- package/dist/esm/services/use-query-light/index.js +1 -0
- package/dist/esm/services/use-query-light/main.js +1 -0
- package/dist/types/mocks/with-faker.d.ts +2 -2
- package/dist/types/services/agg-client/index.d.ts +2 -2
- package/dist/types/services/legion-client/index.d.ts +1 -1
- package/dist/types/services/public-api-client/PublicApiClient.d.ts +1 -1
- package/dist/types/services/teams-in-slack-client/TeamsInSlackClient.d.ts +20 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/teams-client
|
|
2
2
|
|
|
3
|
+
## 5.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5b39d8c208f0f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5b39d8c208f0f) -
|
|
8
|
+
Migrate `TeamsInSlackClient` to Staffy Global Edge URL with staff auth handling.
|
|
9
|
+
|
|
10
|
+
When `ptc-onboard-teams-slack-app-to-global-edge-url` is ON, all `/api/team/{teamId}` calls (GET,
|
|
11
|
+
POST, DELETE) are routed to `https://teams-slack-app.services.atlassian.com` instead of the
|
|
12
|
+
Stargate path `/gateway/api/teamsslack/api/team`.
|
|
13
|
+
|
|
14
|
+
To handle the case where the user has no Staffy SST cookie (which would cause a silent fetch
|
|
15
|
+
failure due to a `302 → Okta` redirect being followed inside `fetch()`), a pre-flight
|
|
16
|
+
`GET /api/authping` probe is made before each call. If the probe fails, the client performs a
|
|
17
|
+
top-level `window.location.assign()` to `/staffy/login?return_to=<current URL>` so the browser
|
|
18
|
+
completes the Okta SSO flow and sets the SST cookie before retrying. An in-memory flag prevents
|
|
19
|
+
infinite redirect loops.
|
|
20
|
+
|
|
21
|
+
Falls back to Stargate when the gate is OFF. No changes to `RestClient` or any other client.
|
|
22
|
+
|
|
23
|
+
Also adds `teamsInSlackServiceUrl` to `TeamsClientConfig` to allow per-environment URL overrides.
|
|
24
|
+
|
|
3
25
|
## 5.5.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isAuthError = isAuthError;
|
|
7
|
-
var _isErrorStatusCode = require("./isErrorStatusCode");
|
|
8
7
|
var _index = require("./index");
|
|
8
|
+
var _isErrorStatusCode = require("./isErrorStatusCode");
|
|
9
9
|
function isAuthError(error) {
|
|
10
10
|
return (0, _isErrorStatusCode.isErrorStatusCode)(_index.StatusCode.UNAUTHORIZED, error) || (0, _isErrorStatusCode.isErrorStatusCode)(_index.StatusCode.FORBIDDEN, error);
|
|
11
11
|
}
|
|
@@ -56,7 +56,7 @@ var TeamsUFOExperience = exports.TeamsUFOExperience = /*#__PURE__*/function (_UF
|
|
|
56
56
|
return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
|
|
57
57
|
metadata: {
|
|
58
58
|
error: (0, _createErrorMetadata.createErrorMetadata)(error),
|
|
59
|
-
packageVersion: "5.
|
|
59
|
+
packageVersion: "5.5.0",
|
|
60
60
|
packageName: "@atlaskit/teams-client"
|
|
61
61
|
}
|
|
62
62
|
}]);
|
|
@@ -64,7 +64,7 @@ var TeamsUFOExperience = exports.TeamsUFOExperience = /*#__PURE__*/function (_UF
|
|
|
64
64
|
return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
|
|
65
65
|
metadata: {
|
|
66
66
|
error: 'unknown error',
|
|
67
|
-
packageVersion: "5.
|
|
67
|
+
packageVersion: "5.5.0",
|
|
68
68
|
packageName: "@atlaskit/teams-client"
|
|
69
69
|
}
|
|
70
70
|
}]);
|
|
@@ -13,8 +13,8 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
13
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
15
|
var _restClient = require("../rest-client");
|
|
16
|
-
var _utils = require("./utils");
|
|
17
16
|
var _index = require("./index");
|
|
17
|
+
var _utils = require("./utils");
|
|
18
18
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
19
19
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
20
|
var ALL_SUPPORTED_PRODUCTS = ['confluence', 'jira', 'jira-core', 'jira-servicedesk', 'jira-software', 'jira-incident-manager', 'jira-product-discovery', 'opsgenie', 'statuspage', 'avocado', 'townsquare', 'compass', 'avp', 'beacon', 'mercury'];
|
|
@@ -36,7 +36,7 @@ function getSentryConfig(options) {
|
|
|
36
36
|
return _objectSpread(_objectSpread(_objectSpread({}, otherOptions), DEFAULT_SENTRY_CONFIG), {}, {
|
|
37
37
|
// Standalone __VERSION__ is set from `bin/set-release-version.sh`
|
|
38
38
|
// when building to deploy to production
|
|
39
|
-
release: "".concat("@atlaskit/teams-client", "@").concat("5.
|
|
39
|
+
release: "".concat("@atlaskit/teams-client", "@").concat("5.5.0") ||
|
|
40
40
|
// @ts-ignore Jira - window.BUILD_KEY
|
|
41
41
|
window.BUILD_KEY || ( // @ts-ignore Confluence - window.__buildInfo
|
|
42
42
|
(_window$__buildInfo = window.__buildInfo) === null || _window$__buildInfo === void 0 ? void 0 : _window$__buildInfo.FRONTEND_VERSION) || '---',
|
|
@@ -14,41 +14,120 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
16
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
|
+
var _SLOIgnoreError = require("../../common/utils/error/SLOIgnoreError");
|
|
17
18
|
var _constants = require("../constants");
|
|
18
19
|
var _restClient = require("../rest-client");
|
|
20
|
+
var _redirectCount = require("../rest-client/utils/redirect-count");
|
|
19
21
|
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; }
|
|
20
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
23
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
22
24
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
25
|
+
var GLOBAL_EDGE_ORIGIN = new URL(_constants.DEFAULT_CONFIG.teamsInSlackServiceUrl).origin;
|
|
23
26
|
var defaultConfig = {
|
|
24
27
|
get serviceUrl() {
|
|
25
28
|
return (0, _fg.fg)('ptc-onboard-teams-slack-app-to-global-edge-url') ? _constants.DEFAULT_CONFIG.teamsInSlackServiceUrl : "".concat(_constants.DEFAULT_CONFIG.stargateRoot, "/teamsslack/api/team");
|
|
26
29
|
}
|
|
27
30
|
};
|
|
31
|
+
|
|
32
|
+
// Shared in-flight probe: concurrent callers coalesce onto one fetch rather
|
|
33
|
+
// than each firing their own and racing on the flag.
|
|
34
|
+
var staffyAuthProbe = null;
|
|
35
|
+
|
|
36
|
+
// Prevents an infinite redirect loop if Okta completes but auth still fails.
|
|
37
|
+
// Resets on full page reload — correct, since a reload after login should retry.
|
|
38
|
+
var staffyAuthAttempted = false;
|
|
28
39
|
var TeamsInSlackClient = exports.TeamsInSlackClient = /*#__PURE__*/function (_RestClient) {
|
|
29
40
|
function TeamsInSlackClient() {
|
|
30
41
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
31
42
|
(0, _classCallCheck2.default)(this, TeamsInSlackClient);
|
|
32
43
|
return _callSuper(this, TeamsInSlackClient, [_objectSpread(_objectSpread({}, defaultConfig), config)]);
|
|
33
44
|
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Pre-flight auth probe for Staffy Global Edge calls (COMMIT-27483).
|
|
48
|
+
* Fetches /api/authping with credentials:'include'. On failure (302→Okta),
|
|
49
|
+
* navigates to /staffy/login?return_to=<current URL> for top-level Okta SSO.
|
|
50
|
+
* No-op when the gate is OFF (Stargate path).
|
|
51
|
+
*/
|
|
34
52
|
(0, _inherits2.default)(TeamsInSlackClient, _RestClient);
|
|
35
53
|
return (0, _createClass2.default)(TeamsInSlackClient, [{
|
|
36
|
-
key: "
|
|
37
|
-
value: function () {
|
|
38
|
-
var
|
|
54
|
+
key: "ensureStaffyAuth",
|
|
55
|
+
value: (function () {
|
|
56
|
+
var _ensureStaffyAuth = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
57
|
+
var authenticated, returnTo;
|
|
39
58
|
return _regenerator.default.wrap(function (_context) {
|
|
40
59
|
while (1) switch (_context.prev = _context.next) {
|
|
41
60
|
case 0:
|
|
42
|
-
|
|
61
|
+
if ((0, _fg.fg)('ptc-onboard-teams-slack-app-to-global-edge-url')) {
|
|
62
|
+
_context.next = 1;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
return _context.abrupt("return");
|
|
66
|
+
case 1:
|
|
67
|
+
staffyAuthProbe !== null && staffyAuthProbe !== void 0 ? staffyAuthProbe : staffyAuthProbe = fetch("".concat(GLOBAL_EDGE_ORIGIN, "/api/authping"), {
|
|
68
|
+
credentials: 'include'
|
|
69
|
+
}).then(function (r) {
|
|
70
|
+
return r.ok;
|
|
71
|
+
}).catch(function () {
|
|
72
|
+
return false;
|
|
73
|
+
}).finally(function () {
|
|
74
|
+
staffyAuthProbe = null;
|
|
75
|
+
});
|
|
76
|
+
_context.next = 2;
|
|
77
|
+
return staffyAuthProbe;
|
|
78
|
+
case 2:
|
|
79
|
+
authenticated = _context.sent;
|
|
80
|
+
if (!authenticated) {
|
|
81
|
+
_context.next = 3;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
staffyAuthAttempted = false;
|
|
85
|
+
return _context.abrupt("return");
|
|
86
|
+
case 3:
|
|
87
|
+
if (!staffyAuthAttempted) {
|
|
88
|
+
_context.next = 4;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
return _context.abrupt("return");
|
|
92
|
+
case 4:
|
|
93
|
+
staffyAuthAttempted = true;
|
|
94
|
+
_redirectCount.redirectCount.increment();
|
|
95
|
+
returnTo = encodeURIComponent(window.location.href);
|
|
96
|
+
window.location.assign("".concat(GLOBAL_EDGE_ORIGIN, "/staffy/login?return_to=").concat(returnTo));
|
|
97
|
+
throw new _SLOIgnoreError.SLOIgnoreError({
|
|
98
|
+
message: 'Redirecting to Staffy login'
|
|
99
|
+
});
|
|
100
|
+
case 5:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context.stop();
|
|
103
|
+
}
|
|
104
|
+
}, _callee);
|
|
105
|
+
}));
|
|
106
|
+
function ensureStaffyAuth() {
|
|
107
|
+
return _ensureStaffyAuth.apply(this, arguments);
|
|
108
|
+
}
|
|
109
|
+
return ensureStaffyAuth;
|
|
110
|
+
}())
|
|
111
|
+
}, {
|
|
112
|
+
key: "getTeamInSlack",
|
|
113
|
+
value: function () {
|
|
114
|
+
var _getTeamInSlack = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(teamId, teamName) {
|
|
115
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
116
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
_context2.next = 1;
|
|
119
|
+
return this.ensureStaffyAuth();
|
|
120
|
+
case 1:
|
|
121
|
+
return _context2.abrupt("return", this.getResource("/".concat(teamId, "?teamName=").concat(encodeURIComponent(teamName))).then(function (response) {
|
|
43
122
|
return _objectSpread({
|
|
44
123
|
id: teamId
|
|
45
124
|
}, response);
|
|
46
125
|
}));
|
|
47
|
-
case
|
|
126
|
+
case 2:
|
|
48
127
|
case "end":
|
|
49
|
-
return
|
|
128
|
+
return _context2.stop();
|
|
50
129
|
}
|
|
51
|
-
},
|
|
130
|
+
}, _callee2, this);
|
|
52
131
|
}));
|
|
53
132
|
function getTeamInSlack(_x, _x2) {
|
|
54
133
|
return _getTeamInSlack.apply(this, arguments);
|
|
@@ -58,20 +137,23 @@ var TeamsInSlackClient = exports.TeamsInSlackClient = /*#__PURE__*/function (_Re
|
|
|
58
137
|
}, {
|
|
59
138
|
key: "disconnectTeamInSlack",
|
|
60
139
|
value: function () {
|
|
61
|
-
var _disconnectTeamInSlack = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
62
|
-
return _regenerator.default.wrap(function (
|
|
63
|
-
while (1) switch (
|
|
140
|
+
var _disconnectTeamInSlack = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(teamId) {
|
|
141
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
142
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
64
143
|
case 0:
|
|
65
|
-
|
|
144
|
+
_context3.next = 1;
|
|
145
|
+
return this.ensureStaffyAuth();
|
|
146
|
+
case 1:
|
|
147
|
+
return _context3.abrupt("return", this.deleteResource("/".concat(teamId)).then(function (response) {
|
|
66
148
|
return _objectSpread({
|
|
67
149
|
id: teamId
|
|
68
150
|
}, response);
|
|
69
151
|
}));
|
|
70
|
-
case
|
|
152
|
+
case 2:
|
|
71
153
|
case "end":
|
|
72
|
-
return
|
|
154
|
+
return _context3.stop();
|
|
73
155
|
}
|
|
74
|
-
},
|
|
156
|
+
}, _callee3, this);
|
|
75
157
|
}));
|
|
76
158
|
function disconnectTeamInSlack(_x3) {
|
|
77
159
|
return _disconnectTeamInSlack.apply(this, arguments);
|
|
@@ -81,20 +163,23 @@ var TeamsInSlackClient = exports.TeamsInSlackClient = /*#__PURE__*/function (_Re
|
|
|
81
163
|
}, {
|
|
82
164
|
key: "updateTeamInSlack",
|
|
83
165
|
value: function () {
|
|
84
|
-
var _updateTeamInSlack = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
85
|
-
return _regenerator.default.wrap(function (
|
|
86
|
-
while (1) switch (
|
|
166
|
+
var _updateTeamInSlack = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(teamId, channelId, usergroupHandle) {
|
|
167
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
168
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
87
169
|
case 0:
|
|
88
|
-
|
|
170
|
+
_context4.next = 1;
|
|
171
|
+
return this.ensureStaffyAuth();
|
|
172
|
+
case 1:
|
|
173
|
+
return _context4.abrupt("return", this.postResource("/".concat(teamId, "?channel=").concat(channelId, "&groupName=").concat(usergroupHandle)).then(function (response) {
|
|
89
174
|
return _objectSpread({
|
|
90
175
|
id: teamId
|
|
91
176
|
}, response);
|
|
92
177
|
}));
|
|
93
|
-
case
|
|
178
|
+
case 2:
|
|
94
179
|
case "end":
|
|
95
|
-
return
|
|
180
|
+
return _context4.stop();
|
|
96
181
|
}
|
|
97
|
-
},
|
|
182
|
+
}, _callee4, this);
|
|
98
183
|
}));
|
|
99
184
|
function updateTeamInSlack(_x4, _x5, _x6) {
|
|
100
185
|
return _updateTeamInSlack.apply(this, arguments);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
|
|
2
3
|
export let ErrorCategory = /*#__PURE__*/function (ErrorCategory) {
|
|
3
4
|
ErrorCategory["NotFound"] = "NotFound";
|
|
4
5
|
ErrorCategory["NotPermitted"] = "NotPermitted";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isErrorStatusCode } from './isErrorStatusCode';
|
|
2
1
|
import { StatusCode } from './index';
|
|
2
|
+
import { isErrorStatusCode } from './isErrorStatusCode';
|
|
3
3
|
export function isAuthError(error) {
|
|
4
4
|
return isErrorStatusCode(StatusCode.UNAUTHORIZED, error) || isErrorStatusCode(StatusCode.FORBIDDEN, error);
|
|
5
5
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use `import { hasPermissionForAction } from '@atlaskit/teams-client/has-permission-for-action'` instead.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export { hasPermissionForAction } from './has-permission-for-action';
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `import { hasPermission } from '@atlaskit/teams-client/has-permission'` instead.
|
|
@@ -31,7 +31,7 @@ export class TeamsUFOExperience extends UFOExperience {
|
|
|
31
31
|
return super.failure({
|
|
32
32
|
metadata: {
|
|
33
33
|
error: createErrorMetadata(error),
|
|
34
|
-
packageVersion: "5.
|
|
34
|
+
packageVersion: "5.5.0",
|
|
35
35
|
packageName: "@atlaskit/teams-client"
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -39,7 +39,7 @@ export class TeamsUFOExperience extends UFOExperience {
|
|
|
39
39
|
return super.failure({
|
|
40
40
|
metadata: {
|
|
41
41
|
error: 'unknown error',
|
|
42
|
-
packageVersion: "5.
|
|
42
|
+
packageVersion: "5.5.0",
|
|
43
43
|
packageName: "@atlaskit/teams-client"
|
|
44
44
|
}
|
|
45
45
|
});
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use `import { mockTeamsClientEndpoints } from '@atlaskit/teams-client/mock-teams-client-endpoints'` instead.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
export { mockTeamsClientEndpoints } from './mock-teams-client-endpoints';
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use `import { mockTeamsClientRequestingToJoinEndpoints } from '@atlaskit/teams-client/mock-teams-client-requesting-to-join-endpoints'` instead.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use `import { randomTeamMembership } from '@atlaskit/teams-client/random-team-membership'` instead.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
export { randomTeamMembership } from './random-team-membership';
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use `import { randomTeamMemberships } from '@atlaskit/teams-client/random-team-memberships'` instead.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use `import { mockTeamsClientAdminEndpoints } from '@atlaskit/teams-client/mock-teams-client-admin-endpoints'` instead.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export { mockTeamsClientAdminEndpoints } from './mock-teams-client-admin-endpoints';
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `import { mockTeamsClientEndpoints } from '@atlaskit/teams-client/mock-teams-client-endpoints'` instead.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
|
|
2
3
|
import { toTeamARI } from '../../common/utils/to-team-ari';
|
|
3
4
|
import { toUserId } from '../../common/utils/to-user-id';
|
|
4
5
|
import { DEFAULT_CONFIG } from '../constants';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RestClient } from '../rest-client';
|
|
2
|
-
import { removeDuplicateRecommendations } from './utils';
|
|
3
2
|
import { PRODUCT_JOIN_OR_REQUEST_BULK, PRODUCT_RECCOMENDATIONS } from './index';
|
|
3
|
+
import { removeDuplicateRecommendations } from './utils';
|
|
4
4
|
const ALL_SUPPORTED_PRODUCTS = ['confluence', 'jira', 'jira-core', 'jira-servicedesk', 'jira-software', 'jira-incident-manager', 'jira-product-discovery', 'opsgenie', 'statuspage', 'avocado', 'townsquare', 'compass', 'avp', 'beacon', 'mercury'];
|
|
5
5
|
export class InvitationsClient extends RestClient {
|
|
6
6
|
constructor(serviceUrl, config) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use `import { addBreadcrumb } from '@atlaskit/teams-client/add-breadcrumb'` instead.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export { addBreadcrumb } from './addBreadcrumb';
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `import { createErrorHandler } from '@atlaskit/teams-client/create-error-handler'` instead.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use `import { logException } from '@atlaskit/teams-client/log-exception'` instead.
|
|
6
6
|
*/
|
|
7
|
+
|
|
7
8
|
export { logException } from './logException';
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated Use `import { logErrorMessage } from '@atlaskit/teams-client/log-error-message'` instead.
|
|
@@ -28,7 +28,7 @@ export function getSentryConfig(options) {
|
|
|
28
28
|
...DEFAULT_SENTRY_CONFIG,
|
|
29
29
|
// Standalone __VERSION__ is set from `bin/set-release-version.sh`
|
|
30
30
|
// when building to deploy to production
|
|
31
|
-
release: `${"@atlaskit/teams-client"}@${"5.
|
|
31
|
+
release: `${"@atlaskit/teams-client"}@${"5.5.0"}` ||
|
|
32
32
|
// @ts-ignore Jira - window.BUILD_KEY
|
|
33
33
|
window.BUILD_KEY || ( // @ts-ignore Confluence - window.__buildInfo
|
|
34
34
|
(_window$__buildInfo = window.__buildInfo) === null || _window$__buildInfo === void 0 ? void 0 : _window$__buildInfo.FRONTEND_VERSION) || '---',
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
+
import { SLOIgnoreError } from '../../common/utils/error/SLOIgnoreError';
|
|
2
3
|
import { DEFAULT_CONFIG } from '../constants';
|
|
3
4
|
import { RestClient } from '../rest-client';
|
|
5
|
+
import { redirectCount } from '../rest-client/utils/redirect-count';
|
|
6
|
+
const GLOBAL_EDGE_ORIGIN = new URL(DEFAULT_CONFIG.teamsInSlackServiceUrl).origin;
|
|
4
7
|
const defaultConfig = {
|
|
5
8
|
get serviceUrl() {
|
|
6
9
|
return fg('ptc-onboard-teams-slack-app-to-global-edge-url') ? DEFAULT_CONFIG.teamsInSlackServiceUrl : `${DEFAULT_CONFIG.stargateRoot}/teamsslack/api/team`;
|
|
7
10
|
}
|
|
8
11
|
};
|
|
12
|
+
|
|
13
|
+
// Shared in-flight probe: concurrent callers coalesce onto one fetch rather
|
|
14
|
+
// than each firing their own and racing on the flag.
|
|
15
|
+
let staffyAuthProbe = null;
|
|
16
|
+
|
|
17
|
+
// Prevents an infinite redirect loop if Okta completes but auth still fails.
|
|
18
|
+
// Resets on full page reload — correct, since a reload after login should retry.
|
|
19
|
+
let staffyAuthAttempted = false;
|
|
9
20
|
export class TeamsInSlackClient extends RestClient {
|
|
10
21
|
constructor(config = {}) {
|
|
11
22
|
super({
|
|
@@ -13,19 +24,55 @@ export class TeamsInSlackClient extends RestClient {
|
|
|
13
24
|
...config
|
|
14
25
|
});
|
|
15
26
|
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Pre-flight auth probe for Staffy Global Edge calls (COMMIT-27483).
|
|
30
|
+
* Fetches /api/authping with credentials:'include'. On failure (302→Okta),
|
|
31
|
+
* navigates to /staffy/login?return_to=<current URL> for top-level Okta SSO.
|
|
32
|
+
* No-op when the gate is OFF (Stargate path).
|
|
33
|
+
*/
|
|
34
|
+
async ensureStaffyAuth() {
|
|
35
|
+
if (!fg('ptc-onboard-teams-slack-app-to-global-edge-url')) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
staffyAuthProbe ??= fetch(`${GLOBAL_EDGE_ORIGIN}/api/authping`, {
|
|
39
|
+
credentials: 'include'
|
|
40
|
+
}).then(r => r.ok).catch(() => false).finally(() => {
|
|
41
|
+
staffyAuthProbe = null;
|
|
42
|
+
});
|
|
43
|
+
const authenticated = await staffyAuthProbe;
|
|
44
|
+
if (authenticated) {
|
|
45
|
+
staffyAuthAttempted = false;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (staffyAuthAttempted) {
|
|
49
|
+
// Already redirected once — let the call proceed and surface the error.
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
staffyAuthAttempted = true;
|
|
53
|
+
redirectCount.increment();
|
|
54
|
+
const returnTo = encodeURIComponent(window.location.href);
|
|
55
|
+
window.location.assign(`${GLOBAL_EDGE_ORIGIN}/staffy/login?return_to=${returnTo}`);
|
|
56
|
+
throw new SLOIgnoreError({
|
|
57
|
+
message: 'Redirecting to Staffy login'
|
|
58
|
+
});
|
|
59
|
+
}
|
|
16
60
|
async getTeamInSlack(teamId, teamName) {
|
|
61
|
+
await this.ensureStaffyAuth();
|
|
17
62
|
return this.getResource(`/${teamId}?teamName=${encodeURIComponent(teamName)}`).then(response => ({
|
|
18
63
|
id: teamId,
|
|
19
64
|
...response
|
|
20
65
|
}));
|
|
21
66
|
}
|
|
22
67
|
async disconnectTeamInSlack(teamId) {
|
|
68
|
+
await this.ensureStaffyAuth();
|
|
23
69
|
return this.deleteResource(`/${teamId}`).then(response => ({
|
|
24
70
|
id: teamId,
|
|
25
71
|
...response
|
|
26
72
|
}));
|
|
27
73
|
}
|
|
28
74
|
async updateTeamInSlack(teamId, channelId, usergroupHandle) {
|
|
75
|
+
await this.ensureStaffyAuth();
|
|
29
76
|
return this.postResource(`/${teamId}?channel=${channelId}&groupName=${usergroupHandle}`).then(response => ({
|
|
30
77
|
id: teamId,
|
|
31
78
|
...response
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use `import { useLazyQueryLight } from '@atlaskit/teams-client/use-query-light/use-lazy-query-light'` instead.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export { useLazyQueryLight } from './useLazyQueryLight';
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `import { useQueryLight } from '@atlaskit/teams-client/use-query-light/use-query-light'` instead.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use `import { useQueryLight } from '@atlaskit/teams-client/use-query-light/use-query-light'` instead.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
export { useQueryLight } from './useQueryLight';
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use `import { useLazyQueryLight } from '@atlaskit/teams-client/use-query-light/use-lazy-query-light'` instead.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
2
|
+
|
|
2
3
|
export var ErrorCategory = /*#__PURE__*/function (ErrorCategory) {
|
|
3
4
|
ErrorCategory["NotFound"] = "NotFound";
|
|
4
5
|
ErrorCategory["NotPermitted"] = "NotPermitted";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isErrorStatusCode } from './isErrorStatusCode';
|
|
2
1
|
import { StatusCode } from './index';
|
|
2
|
+
import { isErrorStatusCode } from './isErrorStatusCode';
|
|
3
3
|
export function isAuthError(error) {
|
|
4
4
|
return isErrorStatusCode(StatusCode.UNAUTHORIZED, error) || isErrorStatusCode(StatusCode.FORBIDDEN, error);
|
|
5
5
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use `import { hasPermissionForAction } from '@atlaskit/teams-client/has-permission-for-action'` instead.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export { hasPermissionForAction } from './has-permission-for-action';
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `import { hasPermission } from '@atlaskit/teams-client/has-permission'` instead.
|
|
@@ -49,7 +49,7 @@ export var TeamsUFOExperience = /*#__PURE__*/function (_UFOExperience) {
|
|
|
49
49
|
return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
|
|
50
50
|
metadata: {
|
|
51
51
|
error: createErrorMetadata(error),
|
|
52
|
-
packageVersion: "5.
|
|
52
|
+
packageVersion: "5.5.0",
|
|
53
53
|
packageName: "@atlaskit/teams-client"
|
|
54
54
|
}
|
|
55
55
|
}]);
|
|
@@ -57,7 +57,7 @@ export var TeamsUFOExperience = /*#__PURE__*/function (_UFOExperience) {
|
|
|
57
57
|
return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
|
|
58
58
|
metadata: {
|
|
59
59
|
error: 'unknown error',
|
|
60
|
-
packageVersion: "5.
|
|
60
|
+
packageVersion: "5.5.0",
|
|
61
61
|
packageName: "@atlaskit/teams-client"
|
|
62
62
|
}
|
|
63
63
|
}]);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use `import { mockTeamsClientEndpoints } from '@atlaskit/teams-client/mock-teams-client-endpoints'` instead.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
export { mockTeamsClientEndpoints } from './mock-teams-client-endpoints';
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use `import { mockTeamsClientRequestingToJoinEndpoints } from '@atlaskit/teams-client/mock-teams-client-requesting-to-join-endpoints'` instead.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use `import { randomTeamMembership } from '@atlaskit/teams-client/random-team-membership'` instead.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
export { randomTeamMembership } from './random-team-membership';
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use `import { randomTeamMemberships } from '@atlaskit/teams-client/random-team-memberships'` instead.
|
package/dist/esm/mocks/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use `import { mockTeamsClientAdminEndpoints } from '@atlaskit/teams-client/mock-teams-client-admin-endpoints'` instead.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export { mockTeamsClientAdminEndpoints } from './mock-teams-client-admin-endpoints';
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `import { mockTeamsClientEndpoints } from '@atlaskit/teams-client/mock-teams-client-endpoints'` instead.
|
|
@@ -11,6 +11,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
12
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
/* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
|
|
14
|
+
|
|
14
15
|
import { toTeamARI } from '../../common/utils/to-team-ari';
|
|
15
16
|
import { toUserId } from '../../common/utils/to-user-id';
|
|
16
17
|
import { DEFAULT_CONFIG } from '../constants';
|
|
@@ -8,8 +8,8 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, 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
10
|
import { RestClient } from '../rest-client';
|
|
11
|
-
import { removeDuplicateRecommendations } from './utils';
|
|
12
11
|
import { PRODUCT_JOIN_OR_REQUEST_BULK, PRODUCT_RECCOMENDATIONS } from './index';
|
|
12
|
+
import { removeDuplicateRecommendations } from './utils';
|
|
13
13
|
var ALL_SUPPORTED_PRODUCTS = ['confluence', 'jira', 'jira-core', 'jira-servicedesk', 'jira-software', 'jira-incident-manager', 'jira-product-discovery', 'opsgenie', 'statuspage', 'avocado', 'townsquare', 'compass', 'avp', 'beacon', 'mercury'];
|
|
14
14
|
export var InvitationsClient = /*#__PURE__*/function (_RestClient) {
|
|
15
15
|
function InvitationsClient(serviceUrl, config) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use `import { addBreadcrumb } from '@atlaskit/teams-client/add-breadcrumb'` instead.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export { addBreadcrumb } from './addBreadcrumb';
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `import { createErrorHandler } from '@atlaskit/teams-client/create-error-handler'` instead.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use `import { logException } from '@atlaskit/teams-client/log-exception'` instead.
|
|
6
6
|
*/
|
|
7
|
+
|
|
7
8
|
export { logException } from './logException';
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated Use `import { logErrorMessage } from '@atlaskit/teams-client/log-error-message'` instead.
|
|
@@ -29,7 +29,7 @@ export function getSentryConfig(options) {
|
|
|
29
29
|
return _objectSpread(_objectSpread(_objectSpread({}, otherOptions), DEFAULT_SENTRY_CONFIG), {}, {
|
|
30
30
|
// Standalone __VERSION__ is set from `bin/set-release-version.sh`
|
|
31
31
|
// when building to deploy to production
|
|
32
|
-
release: "".concat("@atlaskit/teams-client", "@").concat("5.
|
|
32
|
+
release: "".concat("@atlaskit/teams-client", "@").concat("5.5.0") ||
|
|
33
33
|
// @ts-ignore Jira - window.BUILD_KEY
|
|
34
34
|
window.BUILD_KEY || ( // @ts-ignore Confluence - window.__buildInfo
|
|
35
35
|
(_window$__buildInfo = window.__buildInfo) === null || _window$__buildInfo === void 0 ? void 0 : _window$__buildInfo.FRONTEND_VERSION) || '---',
|
|
@@ -11,37 +11,116 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
12
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
14
|
+
import { SLOIgnoreError } from '../../common/utils/error/SLOIgnoreError';
|
|
14
15
|
import { DEFAULT_CONFIG } from '../constants';
|
|
15
16
|
import { RestClient } from '../rest-client';
|
|
17
|
+
import { redirectCount } from '../rest-client/utils/redirect-count';
|
|
18
|
+
var GLOBAL_EDGE_ORIGIN = new URL(DEFAULT_CONFIG.teamsInSlackServiceUrl).origin;
|
|
16
19
|
var defaultConfig = {
|
|
17
20
|
get serviceUrl() {
|
|
18
21
|
return fg('ptc-onboard-teams-slack-app-to-global-edge-url') ? DEFAULT_CONFIG.teamsInSlackServiceUrl : "".concat(DEFAULT_CONFIG.stargateRoot, "/teamsslack/api/team");
|
|
19
22
|
}
|
|
20
23
|
};
|
|
24
|
+
|
|
25
|
+
// Shared in-flight probe: concurrent callers coalesce onto one fetch rather
|
|
26
|
+
// than each firing their own and racing on the flag.
|
|
27
|
+
var staffyAuthProbe = null;
|
|
28
|
+
|
|
29
|
+
// Prevents an infinite redirect loop if Okta completes but auth still fails.
|
|
30
|
+
// Resets on full page reload — correct, since a reload after login should retry.
|
|
31
|
+
var staffyAuthAttempted = false;
|
|
21
32
|
export var TeamsInSlackClient = /*#__PURE__*/function (_RestClient) {
|
|
22
33
|
function TeamsInSlackClient() {
|
|
23
34
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
24
35
|
_classCallCheck(this, TeamsInSlackClient);
|
|
25
36
|
return _callSuper(this, TeamsInSlackClient, [_objectSpread(_objectSpread({}, defaultConfig), config)]);
|
|
26
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Pre-flight auth probe for Staffy Global Edge calls (COMMIT-27483).
|
|
41
|
+
* Fetches /api/authping with credentials:'include'. On failure (302→Okta),
|
|
42
|
+
* navigates to /staffy/login?return_to=<current URL> for top-level Okta SSO.
|
|
43
|
+
* No-op when the gate is OFF (Stargate path).
|
|
44
|
+
*/
|
|
27
45
|
_inherits(TeamsInSlackClient, _RestClient);
|
|
28
46
|
return _createClass(TeamsInSlackClient, [{
|
|
29
|
-
key: "
|
|
30
|
-
value: function () {
|
|
31
|
-
var
|
|
47
|
+
key: "ensureStaffyAuth",
|
|
48
|
+
value: (function () {
|
|
49
|
+
var _ensureStaffyAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
50
|
+
var authenticated, returnTo;
|
|
32
51
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
33
52
|
while (1) switch (_context.prev = _context.next) {
|
|
34
53
|
case 0:
|
|
35
|
-
|
|
54
|
+
if (fg('ptc-onboard-teams-slack-app-to-global-edge-url')) {
|
|
55
|
+
_context.next = 1;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
return _context.abrupt("return");
|
|
59
|
+
case 1:
|
|
60
|
+
staffyAuthProbe !== null && staffyAuthProbe !== void 0 ? staffyAuthProbe : staffyAuthProbe = fetch("".concat(GLOBAL_EDGE_ORIGIN, "/api/authping"), {
|
|
61
|
+
credentials: 'include'
|
|
62
|
+
}).then(function (r) {
|
|
63
|
+
return r.ok;
|
|
64
|
+
}).catch(function () {
|
|
65
|
+
return false;
|
|
66
|
+
}).finally(function () {
|
|
67
|
+
staffyAuthProbe = null;
|
|
68
|
+
});
|
|
69
|
+
_context.next = 2;
|
|
70
|
+
return staffyAuthProbe;
|
|
71
|
+
case 2:
|
|
72
|
+
authenticated = _context.sent;
|
|
73
|
+
if (!authenticated) {
|
|
74
|
+
_context.next = 3;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
staffyAuthAttempted = false;
|
|
78
|
+
return _context.abrupt("return");
|
|
79
|
+
case 3:
|
|
80
|
+
if (!staffyAuthAttempted) {
|
|
81
|
+
_context.next = 4;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return _context.abrupt("return");
|
|
85
|
+
case 4:
|
|
86
|
+
staffyAuthAttempted = true;
|
|
87
|
+
redirectCount.increment();
|
|
88
|
+
returnTo = encodeURIComponent(window.location.href);
|
|
89
|
+
window.location.assign("".concat(GLOBAL_EDGE_ORIGIN, "/staffy/login?return_to=").concat(returnTo));
|
|
90
|
+
throw new SLOIgnoreError({
|
|
91
|
+
message: 'Redirecting to Staffy login'
|
|
92
|
+
});
|
|
93
|
+
case 5:
|
|
94
|
+
case "end":
|
|
95
|
+
return _context.stop();
|
|
96
|
+
}
|
|
97
|
+
}, _callee);
|
|
98
|
+
}));
|
|
99
|
+
function ensureStaffyAuth() {
|
|
100
|
+
return _ensureStaffyAuth.apply(this, arguments);
|
|
101
|
+
}
|
|
102
|
+
return ensureStaffyAuth;
|
|
103
|
+
}())
|
|
104
|
+
}, {
|
|
105
|
+
key: "getTeamInSlack",
|
|
106
|
+
value: function () {
|
|
107
|
+
var _getTeamInSlack = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(teamId, teamName) {
|
|
108
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
109
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
110
|
+
case 0:
|
|
111
|
+
_context2.next = 1;
|
|
112
|
+
return this.ensureStaffyAuth();
|
|
113
|
+
case 1:
|
|
114
|
+
return _context2.abrupt("return", this.getResource("/".concat(teamId, "?teamName=").concat(encodeURIComponent(teamName))).then(function (response) {
|
|
36
115
|
return _objectSpread({
|
|
37
116
|
id: teamId
|
|
38
117
|
}, response);
|
|
39
118
|
}));
|
|
40
|
-
case
|
|
119
|
+
case 2:
|
|
41
120
|
case "end":
|
|
42
|
-
return
|
|
121
|
+
return _context2.stop();
|
|
43
122
|
}
|
|
44
|
-
},
|
|
123
|
+
}, _callee2, this);
|
|
45
124
|
}));
|
|
46
125
|
function getTeamInSlack(_x, _x2) {
|
|
47
126
|
return _getTeamInSlack.apply(this, arguments);
|
|
@@ -51,20 +130,23 @@ export var TeamsInSlackClient = /*#__PURE__*/function (_RestClient) {
|
|
|
51
130
|
}, {
|
|
52
131
|
key: "disconnectTeamInSlack",
|
|
53
132
|
value: function () {
|
|
54
|
-
var _disconnectTeamInSlack = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
55
|
-
return _regeneratorRuntime.wrap(function (
|
|
56
|
-
while (1) switch (
|
|
133
|
+
var _disconnectTeamInSlack = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(teamId) {
|
|
134
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
135
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
57
136
|
case 0:
|
|
58
|
-
|
|
137
|
+
_context3.next = 1;
|
|
138
|
+
return this.ensureStaffyAuth();
|
|
139
|
+
case 1:
|
|
140
|
+
return _context3.abrupt("return", this.deleteResource("/".concat(teamId)).then(function (response) {
|
|
59
141
|
return _objectSpread({
|
|
60
142
|
id: teamId
|
|
61
143
|
}, response);
|
|
62
144
|
}));
|
|
63
|
-
case
|
|
145
|
+
case 2:
|
|
64
146
|
case "end":
|
|
65
|
-
return
|
|
147
|
+
return _context3.stop();
|
|
66
148
|
}
|
|
67
|
-
},
|
|
149
|
+
}, _callee3, this);
|
|
68
150
|
}));
|
|
69
151
|
function disconnectTeamInSlack(_x3) {
|
|
70
152
|
return _disconnectTeamInSlack.apply(this, arguments);
|
|
@@ -74,20 +156,23 @@ export var TeamsInSlackClient = /*#__PURE__*/function (_RestClient) {
|
|
|
74
156
|
}, {
|
|
75
157
|
key: "updateTeamInSlack",
|
|
76
158
|
value: function () {
|
|
77
|
-
var _updateTeamInSlack = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
78
|
-
return _regeneratorRuntime.wrap(function (
|
|
79
|
-
while (1) switch (
|
|
159
|
+
var _updateTeamInSlack = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(teamId, channelId, usergroupHandle) {
|
|
160
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
161
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
80
162
|
case 0:
|
|
81
|
-
|
|
163
|
+
_context4.next = 1;
|
|
164
|
+
return this.ensureStaffyAuth();
|
|
165
|
+
case 1:
|
|
166
|
+
return _context4.abrupt("return", this.postResource("/".concat(teamId, "?channel=").concat(channelId, "&groupName=").concat(usergroupHandle)).then(function (response) {
|
|
82
167
|
return _objectSpread({
|
|
83
168
|
id: teamId
|
|
84
169
|
}, response);
|
|
85
170
|
}));
|
|
86
|
-
case
|
|
171
|
+
case 2:
|
|
87
172
|
case "end":
|
|
88
|
-
return
|
|
173
|
+
return _context4.stop();
|
|
89
174
|
}
|
|
90
|
-
},
|
|
175
|
+
}, _callee4, this);
|
|
91
176
|
}));
|
|
92
177
|
function updateTeamInSlack(_x4, _x5, _x6) {
|
|
93
178
|
return _updateTeamInSlack.apply(this, arguments);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated Use `import { useLazyQueryLight } from '@atlaskit/teams-client/use-query-light/use-lazy-query-light'` instead.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
export { useLazyQueryLight } from './useLazyQueryLight';
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `import { useQueryLight } from '@atlaskit/teams-client/use-query-light/use-query-light'` instead.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use `import { useQueryLight } from '@atlaskit/teams-client/use-query-light/use-query-light'` instead.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
export { useQueryLight } from './useQueryLight';
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use `import { useLazyQueryLight } from '@atlaskit/teams-client/use-query-light/use-lazy-query-light'` instead.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type FakerType from 'faker';
|
|
2
|
-
import type { Team, TeamWithImageUrls } from '../types/team';
|
|
3
|
-
import type { TeamWithMemberships } from '../types/membership';
|
|
4
2
|
import type { TeamLink } from '../types/links';
|
|
3
|
+
import type { TeamWithMemberships } from '../types/membership';
|
|
4
|
+
import type { Team, TeamWithImageUrls } from '../types/team';
|
|
5
5
|
type MockConfig = {
|
|
6
6
|
faker: typeof FakerType;
|
|
7
7
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type MembershipState, type TeamMembership, type TeamWithMemberships } from '../../types/membership';
|
|
2
1
|
import { type TeamAgentAssociation } from '../../types/association';
|
|
2
|
+
import { type MembershipState, type TeamMembership, type TeamWithMemberships } from '../../types/membership';
|
|
3
3
|
import { type ClientConfig } from '../base-client';
|
|
4
4
|
import { BaseGraphQlClient } from '../graphql-client/main';
|
|
5
|
+
import { type TeamContainers } from './TeamContainers';
|
|
5
6
|
import { type AGGPageInfoVariables, type ResultWithPageInfo } from './types';
|
|
6
7
|
import { type UnlinkContainerMutationResponse } from './utils/mutations/unlink-container-mutation';
|
|
7
8
|
import { type TeamsUserQueryResponse } from './utils/queries/user-query';
|
|
8
|
-
import { type TeamContainers } from './TeamContainers';
|
|
9
9
|
export declare class AGGClient extends BaseGraphQlClient {
|
|
10
10
|
constructor(baseUrl: string, config: ClientConfig);
|
|
11
11
|
setBaseUrl(baseUrl: string): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type InvitedUser, type TeamMembership, type TeamWithMemberships } from '../../types/membership';
|
|
2
1
|
import { type LinkOrder, type NewTeamLink, type TeamLink } from '../../types/links';
|
|
3
2
|
import { type ReadMediaTokenResponse } from '../../types/media';
|
|
3
|
+
import { type InvitedUser, type TeamMembership, type TeamWithMemberships } from '../../types/membership';
|
|
4
4
|
import type { AlignmentPermission, AssignedTeamsResponse, AssignTeamsToSitesResponse, ExternalReference, LinkedTeamsBulkResponse, LinkedTeamsProfileDetails, OrgScope, SoftDeletedTeam, TeamEnabledSitesResponse, TeamSiteAssignmentOrgDetailsResponse, TeamsPermissionFromApi, TeamsToBeClonedToJsmSitesResponse, UnassignedTeamsResponse, Team, TeamMembershipSettings, TeamWithImageUrls } from '../../types/team';
|
|
5
5
|
import { type ApiTeamContainerCreationPayload, type ApiTeamContainerResponse } from '../../types/team-container';
|
|
6
6
|
import { type UserInSiteUserbase } from '../../types/user';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RestClient } from '../rest-client';
|
|
2
2
|
import type { AddMembershipReponse } from './AddMembershipReponse';
|
|
3
|
+
import { type PublicApiTeamResponse, type PublicApiTeamResponseWithMembers } from './generated/data-contracts';
|
|
3
4
|
import type { Member } from './Member';
|
|
4
5
|
import type { RemoveMembershipReponse } from './RemoveMembershipReponse';
|
|
5
|
-
import { type PublicApiTeamResponse, type PublicApiTeamResponseWithMembers } from './generated/data-contracts';
|
|
6
6
|
export declare class PublicApiClient extends RestClient {
|
|
7
7
|
constructor(serviceUrlRoot: string);
|
|
8
8
|
addUsersToTeam(teamId: string, members: Member[]): Promise<AddMembershipReponse>;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import { RestClient } from '../rest-client';
|
|
2
|
+
interface TeamInSlackResponse {
|
|
3
|
+
connected: boolean;
|
|
4
|
+
slackChannelId: string;
|
|
5
|
+
slackChannelName: string;
|
|
6
|
+
usergroupHandle: string;
|
|
7
|
+
}
|
|
8
|
+
type TeamInSlackResult = TeamInSlackResponse & {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
2
11
|
export declare class TeamsInSlackClient extends RestClient {
|
|
3
12
|
constructor(config?: {});
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
slackChannelName: string;
|
|
15
|
-
usergroupHandle: string;
|
|
16
|
-
id: string;
|
|
17
|
-
}>;
|
|
18
|
-
updateTeamInSlack(teamId: string, channelId: string, usergroupHandle: string): Promise<{
|
|
19
|
-
connected: boolean;
|
|
20
|
-
slackChannelId: string;
|
|
21
|
-
slackChannelName: string;
|
|
22
|
-
usergroupHandle: string;
|
|
23
|
-
id: string;
|
|
24
|
-
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Pre-flight auth probe for Staffy Global Edge calls (COMMIT-27483).
|
|
15
|
+
* Fetches /api/authping with credentials:'include'. On failure (302→Okta),
|
|
16
|
+
* navigates to /staffy/login?return_to=<current URL> for top-level Okta SSO.
|
|
17
|
+
* No-op when the gate is OFF (Stargate path).
|
|
18
|
+
*/
|
|
19
|
+
private ensureStaffyAuth;
|
|
20
|
+
getTeamInSlack(teamId: string, teamName: string): Promise<TeamInSlackResult>;
|
|
21
|
+
disconnectTeamInSlack(teamId: string): Promise<TeamInSlackResult>;
|
|
22
|
+
updateTeamInSlack(teamId: string, channelId: string, usergroupHandle: string): Promise<TeamInSlackResult>;
|
|
25
23
|
}
|
|
24
|
+
export {};
|