@atlaskit/teams-client 4.32.0 → 4.32.2

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/teams-client
2
2
 
3
+ ## 4.32.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7fb5bfbafb83e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7fb5bfbafb83e) -
8
+ Enrol people-and-teams packages into the React Compiler with platform gating via
9
+ isReactCompilerActivePlatform
10
+
11
+ ## 4.32.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`a45dd5a6666e8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a45dd5a6666e8) -
16
+ Fix invalid ARI being sent in X-Query-Context header when cloudId is unavailable. Previously, an
17
+ uninitialised cloudId defaulted to the string 'None', causing requests to include a malformed
18
+ header value of `ari:cloud:platform::site/None`. The client now defaults to an empty string so no
19
+ header is sent until a valid cloudId is set.
20
+
3
21
  ## 4.32.0
4
22
 
5
23
  ### Minor Changes
@@ -27,7 +27,7 @@ var allPermissions = exports.allPermissions = function allPermissions(defaultPer
27
27
  DELETE_TEAM: defaultPermission,
28
28
  EDIT_TEAM_SETTINGS: defaultPermission,
29
29
  EDIT_TEAM_MEMBERSHIP: defaultPermission,
30
- EDIT_TEAM_TYPE: defaultPermission && isOrgAdmin,
30
+ EDIT_TEAM_TYPE: defaultPermission && (isOrgAdmin || (0, _platformFeatureFlags.fg)('ptc-enable-team-type-permission-enabled')),
31
31
  REMOVE_AGENT_FROM_TEAM: defaultPermission,
32
32
  ADD_AGENT_TO_TEAM: defaultPermission,
33
33
  ARCHIVE_TEAM: defaultPermission && isMember,
@@ -70,14 +70,12 @@ var SCIMSyncTeamPermissions = exports.SCIMSyncTeamPermissions = function SCIMSyn
70
70
  var getDisbandedTeamPermissionMap = function getDisbandedTeamPermissionMap(settings, permission, isMember, isOrgAdmin) {
71
71
  // Base permission map - all actions disabled for disbanded teams
72
72
  var basePermissions = allPermissions(false, false, false);
73
-
74
- // UNARCHIVE_TEAM permission based on team settings
75
- var canUnarchive = false;
73
+ var canUnarchive;
76
74
  if (settings === 'EXTERNAL' || settings === 'ORG_ADMIN_MANAGED') {
77
75
  // For EXTERNAL and ORG_ADMIN_MANAGED teams, only org admins can unarchive
78
76
  canUnarchive = isOrgAdmin;
79
- } else if (settings === 'OPEN' || settings === 'MEMBER_INVITE') {
80
- // For OPEN and MEMBER_INVITE teams, members with FULL_WRITE can unarchive
77
+ } else {
78
+ // For OPEN and MEMBER_INVITE teams, members with FULL_WRITE (or org admins) can unarchive
81
79
  canUnarchive = (isMember || isOrgAdmin) && permission === 'FULL_WRITE';
82
80
  }
83
81
  return _objectSpread(_objectSpread({}, basePermissions), {}, {
@@ -52,7 +52,7 @@ var TeamsUFOExperience = exports.TeamsUFOExperience = /*#__PURE__*/function (_UF
52
52
  return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
53
53
  metadata: {
54
54
  error: (0, _utils.createErrorMetadata)(error),
55
- packageVersion: "0.0.0-development",
55
+ packageVersion: "4.32.1",
56
56
  packageName: "@atlaskit/teams-client"
57
57
  }
58
58
  }]);
@@ -60,7 +60,7 @@ var TeamsUFOExperience = exports.TeamsUFOExperience = /*#__PURE__*/function (_UF
60
60
  return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
61
61
  metadata: {
62
62
  error: 'unknown error',
63
- packageVersion: "0.0.0-development",
63
+ packageVersion: "4.32.1",
64
64
  packageName: "@atlaskit/teams-client"
65
65
  }
66
66
  }]);
@@ -8,6 +8,7 @@ exports.BaseClient = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _sentry = require("../sentry");
12
13
  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; }
13
14
  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; }
@@ -22,14 +23,14 @@ var BaseClient = exports.BaseClient = /*#__PURE__*/function () {
22
23
  });
23
24
  this.config = config;
24
25
  this.context = {
25
- cloudId: 'None'
26
+ cloudId: (0, _platformFeatureFlags.fg)('teams-app_client_fix-invalid-ari') ? '' : 'None'
26
27
  };
27
28
  }
28
29
  return (0, _createClass2.default)(BaseClient, [{
29
30
  key: "setContext",
30
31
  value: function setContext(context) {
31
32
  this.context = _objectSpread(_objectSpread({}, context), {}, {
32
- cloudId: context.cloudId || 'None'
33
+ cloudId: (0, _platformFeatureFlags.fg)('teams-app_client_fix-invalid-ari') ? context.cloudId || '' : context.cloudId || 'None'
33
34
  });
34
35
  }
35
36
  }, {
@@ -13,6 +13,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _error = require("../../common/utils/error");
17
18
  var _baseClient = require("../base-client");
18
19
  var _utils = require("./utils");
@@ -20,6 +21,24 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
20
21
  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
22
  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
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
24
+ /**
25
+ * Validates that a siteId (cloudId) conforms to the format expected by
26
+ * PlatformSiteAri from `@atlassian/ari/platform`.
27
+ *
28
+ * We inline this instead of importing `@atlassian/ari` because that package
29
+ * is private and `teams-client` is a public package - public packages cannot
30
+ * depend on private packages.
31
+ *
32
+ * The regex matches the `resourceIdSegmentFormats.siteId` rule from the
33
+ * PlatformSiteAri manifest: `/[a-zA-Z0-9_\-.]{1,255}/`
34
+ */
35
+ var SITE_ID_PATTERN = /^[a-zA-Z0-9_\-.]{1,255}$/;
36
+ function createPlatformSiteAri(siteId) {
37
+ if (!SITE_ID_PATTERN.test(siteId)) {
38
+ throw new Error("Invalid siteId: ".concat(siteId));
39
+ }
40
+ return "ari:cloud:platform::site/".concat(siteId);
41
+ }
23
42
  var BaseGraphQlClient = exports.BaseGraphQlClient = /*#__PURE__*/function (_BaseClient) {
24
43
  function BaseGraphQlClient(serviceUrl, config) {
25
44
  var _this;
@@ -36,7 +55,10 @@ var BaseGraphQlClient = exports.BaseGraphQlClient = /*#__PURE__*/function (_Base
36
55
  }
37
56
 
38
57
  /**
39
- * Creates query context headers if cloudId is available.
58
+ * Creates query context headers if cloudId is available and valid.
59
+ * When the fix-invalid-ari flag is enabled, validates the cloudId before
60
+ * constructing the ARI, preventing invalid ARIs like
61
+ * `ari:cloud:platform::site/None` from being sent.
40
62
  */
41
63
  }, {
42
64
  key: "createQueryContextHeaders",
@@ -44,6 +66,16 @@ var BaseGraphQlClient = exports.BaseGraphQlClient = /*#__PURE__*/function (_Base
44
66
  if (!cloudId) {
45
67
  return undefined;
46
68
  }
69
+ if ((0, _platformFeatureFlags.fg)('teams-app_client_fix-invalid-ari')) {
70
+ try {
71
+ var ari = createPlatformSiteAri(cloudId);
72
+ return {
73
+ 'X-Query-Context': ari
74
+ };
75
+ } catch (_unused) {
76
+ return undefined;
77
+ }
78
+ }
47
79
  return {
48
80
  'X-Query-Context': "ari:cloud:platform::site/".concat(cloudId)
49
81
  };
@@ -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("0.0.0-development") ||
39
+ release: "".concat("@atlaskit/teams-client", "@").concat("4.32.1") ||
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) || '---',
@@ -16,7 +16,7 @@ export const allPermissions = (defaultPermission, isMember, isOrgAdmin) => ({
16
16
  DELETE_TEAM: defaultPermission,
17
17
  EDIT_TEAM_SETTINGS: defaultPermission,
18
18
  EDIT_TEAM_MEMBERSHIP: defaultPermission,
19
- EDIT_TEAM_TYPE: defaultPermission && isOrgAdmin,
19
+ EDIT_TEAM_TYPE: defaultPermission && (isOrgAdmin || fg('ptc-enable-team-type-permission-enabled')),
20
20
  REMOVE_AGENT_FROM_TEAM: defaultPermission,
21
21
  ADD_AGENT_TO_TEAM: defaultPermission,
22
22
  ARCHIVE_TEAM: defaultPermission && isMember,
@@ -52,14 +52,12 @@ export const SCIMSyncTeamPermissions = (isMember, isOrgAdmin, source) => ({
52
52
  const getDisbandedTeamPermissionMap = (settings, permission, isMember, isOrgAdmin) => {
53
53
  // Base permission map - all actions disabled for disbanded teams
54
54
  const basePermissions = allPermissions(false, false, false);
55
-
56
- // UNARCHIVE_TEAM permission based on team settings
57
- let canUnarchive = false;
55
+ let canUnarchive;
58
56
  if (settings === 'EXTERNAL' || settings === 'ORG_ADMIN_MANAGED') {
59
57
  // For EXTERNAL and ORG_ADMIN_MANAGED teams, only org admins can unarchive
60
58
  canUnarchive = isOrgAdmin;
61
- } else if (settings === 'OPEN' || settings === 'MEMBER_INVITE') {
62
- // For OPEN and MEMBER_INVITE teams, members with FULL_WRITE can unarchive
59
+ } else {
60
+ // For OPEN and MEMBER_INVITE teams, members with FULL_WRITE (or org admins) can unarchive
63
61
  canUnarchive = (isMember || isOrgAdmin) && permission === 'FULL_WRITE';
64
62
  }
65
63
  return {
@@ -27,7 +27,7 @@ export class TeamsUFOExperience extends UFOExperience {
27
27
  return super.failure({
28
28
  metadata: {
29
29
  error: createErrorMetadata(error),
30
- packageVersion: "0.0.0-development",
30
+ packageVersion: "4.32.1",
31
31
  packageName: "@atlaskit/teams-client"
32
32
  }
33
33
  });
@@ -35,7 +35,7 @@ export class TeamsUFOExperience extends UFOExperience {
35
35
  return super.failure({
36
36
  metadata: {
37
37
  error: 'unknown error',
38
- packageVersion: "0.0.0-development",
38
+ packageVersion: "4.32.1",
39
39
  packageName: "@atlaskit/teams-client"
40
40
  }
41
41
  });
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { logException } from '../sentry';
3
4
  export class BaseClient {
4
5
  constructor(config) {
@@ -9,13 +10,13 @@ export class BaseClient {
9
10
  });
10
11
  this.config = config;
11
12
  this.context = {
12
- cloudId: 'None'
13
+ cloudId: fg('teams-app_client_fix-invalid-ari') ? '' : 'None'
13
14
  };
14
15
  }
15
16
  setContext(context) {
16
17
  this.context = {
17
18
  ...context,
18
- cloudId: context.cloudId || 'None'
19
+ cloudId: fg('teams-app_client_fix-invalid-ari') ? context.cloudId || '' : context.cloudId || 'None'
19
20
  };
20
21
  }
21
22
  getContext() {
@@ -1,6 +1,26 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  import { DefaultError, GraphQLError } from '../../common/utils/error';
2
3
  import { BaseClient } from '../base-client';
3
4
  import { handleGraphQLRequest } from './utils';
5
+
6
+ /**
7
+ * Validates that a siteId (cloudId) conforms to the format expected by
8
+ * PlatformSiteAri from `@atlassian/ari/platform`.
9
+ *
10
+ * We inline this instead of importing `@atlassian/ari` because that package
11
+ * is private and `teams-client` is a public package - public packages cannot
12
+ * depend on private packages.
13
+ *
14
+ * The regex matches the `resourceIdSegmentFormats.siteId` rule from the
15
+ * PlatformSiteAri manifest: `/[a-zA-Z0-9_\-.]{1,255}/`
16
+ */
17
+ const SITE_ID_PATTERN = /^[a-zA-Z0-9_\-.]{1,255}$/;
18
+ function createPlatformSiteAri(siteId) {
19
+ if (!SITE_ID_PATTERN.test(siteId)) {
20
+ throw new Error(`Invalid siteId: ${siteId}`);
21
+ }
22
+ return `ari:cloud:platform::site/${siteId}`;
23
+ }
4
24
  export class BaseGraphQlClient extends BaseClient {
5
25
  constructor(serviceUrl, config) {
6
26
  super(config);
@@ -11,12 +31,25 @@ export class BaseGraphQlClient extends BaseClient {
11
31
  }
12
32
 
13
33
  /**
14
- * Creates query context headers if cloudId is available.
34
+ * Creates query context headers if cloudId is available and valid.
35
+ * When the fix-invalid-ari flag is enabled, validates the cloudId before
36
+ * constructing the ARI, preventing invalid ARIs like
37
+ * `ari:cloud:platform::site/None` from being sent.
15
38
  */
16
39
  createQueryContextHeaders(cloudId) {
17
40
  if (!cloudId) {
18
41
  return undefined;
19
42
  }
43
+ if (fg('teams-app_client_fix-invalid-ari')) {
44
+ try {
45
+ const ari = createPlatformSiteAri(cloudId);
46
+ return {
47
+ 'X-Query-Context': ari
48
+ };
49
+ } catch {
50
+ return undefined;
51
+ }
52
+ }
20
53
  return {
21
54
  'X-Query-Context': `ari:cloud:platform::site/${cloudId}`
22
55
  };
@@ -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"}@${"0.0.0-development"}` ||
31
+ release: `${"@atlaskit/teams-client"}@${"4.32.1"}` ||
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) || '---',
@@ -20,7 +20,7 @@ export var allPermissions = function allPermissions(defaultPermission, isMember,
20
20
  DELETE_TEAM: defaultPermission,
21
21
  EDIT_TEAM_SETTINGS: defaultPermission,
22
22
  EDIT_TEAM_MEMBERSHIP: defaultPermission,
23
- EDIT_TEAM_TYPE: defaultPermission && isOrgAdmin,
23
+ EDIT_TEAM_TYPE: defaultPermission && (isOrgAdmin || fg('ptc-enable-team-type-permission-enabled')),
24
24
  REMOVE_AGENT_FROM_TEAM: defaultPermission,
25
25
  ADD_AGENT_TO_TEAM: defaultPermission,
26
26
  ARCHIVE_TEAM: defaultPermission && isMember,
@@ -63,14 +63,12 @@ export var SCIMSyncTeamPermissions = function SCIMSyncTeamPermissions(isMember,
63
63
  var getDisbandedTeamPermissionMap = function getDisbandedTeamPermissionMap(settings, permission, isMember, isOrgAdmin) {
64
64
  // Base permission map - all actions disabled for disbanded teams
65
65
  var basePermissions = allPermissions(false, false, false);
66
-
67
- // UNARCHIVE_TEAM permission based on team settings
68
- var canUnarchive = false;
66
+ var canUnarchive;
69
67
  if (settings === 'EXTERNAL' || settings === 'ORG_ADMIN_MANAGED') {
70
68
  // For EXTERNAL and ORG_ADMIN_MANAGED teams, only org admins can unarchive
71
69
  canUnarchive = isOrgAdmin;
72
- } else if (settings === 'OPEN' || settings === 'MEMBER_INVITE') {
73
- // For OPEN and MEMBER_INVITE teams, members with FULL_WRITE can unarchive
70
+ } else {
71
+ // For OPEN and MEMBER_INVITE teams, members with FULL_WRITE (or org admins) can unarchive
74
72
  canUnarchive = (isMember || isOrgAdmin) && permission === 'FULL_WRITE';
75
73
  }
76
74
  return _objectSpread(_objectSpread({}, basePermissions), {}, {
@@ -45,7 +45,7 @@ export var TeamsUFOExperience = /*#__PURE__*/function (_UFOExperience) {
45
45
  return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
46
46
  metadata: {
47
47
  error: createErrorMetadata(error),
48
- packageVersion: "0.0.0-development",
48
+ packageVersion: "4.32.1",
49
49
  packageName: "@atlaskit/teams-client"
50
50
  }
51
51
  }]);
@@ -53,7 +53,7 @@ export var TeamsUFOExperience = /*#__PURE__*/function (_UFOExperience) {
53
53
  return _superPropGet(TeamsUFOExperience, "failure", this, 3)([{
54
54
  metadata: {
55
55
  error: 'unknown error',
56
- packageVersion: "0.0.0-development",
56
+ packageVersion: "4.32.1",
57
57
  packageName: "@atlaskit/teams-client"
58
58
  }
59
59
  }]);
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { logException } from '../sentry';
7
8
  export var BaseClient = /*#__PURE__*/function () {
8
9
  function BaseClient(config) {
@@ -15,14 +16,14 @@ export var BaseClient = /*#__PURE__*/function () {
15
16
  });
16
17
  this.config = config;
17
18
  this.context = {
18
- cloudId: 'None'
19
+ cloudId: fg('teams-app_client_fix-invalid-ari') ? '' : 'None'
19
20
  };
20
21
  }
21
22
  return _createClass(BaseClient, [{
22
23
  key: "setContext",
23
24
  value: function setContext(context) {
24
25
  this.context = _objectSpread(_objectSpread({}, context), {}, {
25
- cloudId: context.cloudId || 'None'
26
+ cloudId: fg('teams-app_client_fix-invalid-ari') ? context.cloudId || '' : context.cloudId || 'None'
26
27
  });
27
28
  }
28
29
  }, {
@@ -10,9 +10,29 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
10
10
  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; }
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
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { DefaultError, GraphQLError } from '../../common/utils/error';
14
15
  import { BaseClient } from '../base-client';
15
16
  import { handleGraphQLRequest } from './utils';
17
+
18
+ /**
19
+ * Validates that a siteId (cloudId) conforms to the format expected by
20
+ * PlatformSiteAri from `@atlassian/ari/platform`.
21
+ *
22
+ * We inline this instead of importing `@atlassian/ari` because that package
23
+ * is private and `teams-client` is a public package - public packages cannot
24
+ * depend on private packages.
25
+ *
26
+ * The regex matches the `resourceIdSegmentFormats.siteId` rule from the
27
+ * PlatformSiteAri manifest: `/[a-zA-Z0-9_\-.]{1,255}/`
28
+ */
29
+ var SITE_ID_PATTERN = /^[a-zA-Z0-9_\-.]{1,255}$/;
30
+ function createPlatformSiteAri(siteId) {
31
+ if (!SITE_ID_PATTERN.test(siteId)) {
32
+ throw new Error("Invalid siteId: ".concat(siteId));
33
+ }
34
+ return "ari:cloud:platform::site/".concat(siteId);
35
+ }
16
36
  export var BaseGraphQlClient = /*#__PURE__*/function (_BaseClient) {
17
37
  function BaseGraphQlClient(serviceUrl, config) {
18
38
  var _this;
@@ -29,7 +49,10 @@ export var BaseGraphQlClient = /*#__PURE__*/function (_BaseClient) {
29
49
  }
30
50
 
31
51
  /**
32
- * Creates query context headers if cloudId is available.
52
+ * Creates query context headers if cloudId is available and valid.
53
+ * When the fix-invalid-ari flag is enabled, validates the cloudId before
54
+ * constructing the ARI, preventing invalid ARIs like
55
+ * `ari:cloud:platform::site/None` from being sent.
33
56
  */
34
57
  }, {
35
58
  key: "createQueryContextHeaders",
@@ -37,6 +60,16 @@ export var BaseGraphQlClient = /*#__PURE__*/function (_BaseClient) {
37
60
  if (!cloudId) {
38
61
  return undefined;
39
62
  }
63
+ if (fg('teams-app_client_fix-invalid-ari')) {
64
+ try {
65
+ var ari = createPlatformSiteAri(cloudId);
66
+ return {
67
+ 'X-Query-Context': ari
68
+ };
69
+ } catch (_unused) {
70
+ return undefined;
71
+ }
72
+ }
40
73
  return {
41
74
  'X-Query-Context': "ari:cloud:platform::site/".concat(cloudId)
42
75
  };
@@ -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("0.0.0-development") ||
32
+ release: "".concat("@atlaskit/teams-client", "@").concat("4.32.1") ||
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) || '---',
@@ -5,7 +5,10 @@ export declare class BaseGraphQlClient extends BaseClient {
5
5
  constructor(serviceUrl: string, config: ClientConfig);
6
6
  setServiceUrl(serviceUrl: string): void;
7
7
  /**
8
- * Creates query context headers if cloudId is available.
8
+ * Creates query context headers if cloudId is available and valid.
9
+ * When the fix-invalid-ari flag is enabled, validates the cloudId before
10
+ * constructing the ARI, preventing invalid ARIs like
11
+ * `ari:cloud:platform::site/None` from being sent.
9
12
  */
10
13
  private createQueryContextHeaders;
11
14
  makeGraphQLRequest<Key extends string, Data = unknown, Variables = unknown>(body: Body<Variables>, options?: Options): Promise<ResultResponse<Key, Data>>;
@@ -5,7 +5,10 @@ export declare class BaseGraphQlClient extends BaseClient {
5
5
  constructor(serviceUrl: string, config: ClientConfig);
6
6
  setServiceUrl(serviceUrl: string): void;
7
7
  /**
8
- * Creates query context headers if cloudId is available.
8
+ * Creates query context headers if cloudId is available and valid.
9
+ * When the fix-invalid-ari flag is enabled, validates the cloudId before
10
+ * constructing the ARI, preventing invalid ARIs like
11
+ * `ari:cloud:platform::site/None` from being sent.
9
12
  */
10
13
  private createQueryContextHeaders;
11
14
  makeGraphQLRequest<Key extends string, Data = unknown, Variables = unknown>(body: Body<Variables>, options?: Options): Promise<ResultResponse<Key, Data>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/teams-client",
3
- "version": "4.32.0",
3
+ "version": "4.32.2",
4
4
  "description": "A client to retrieve team related data",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -8,6 +8,13 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
+ "react-compiler": {
12
+ "enabled": true,
13
+ "gating": {
14
+ "source": "@atlassian/react-compiler-gating",
15
+ "importSpecifierName": "isReactCompilerActivePlatform"
16
+ }
17
+ },
11
18
  "team": "People and Teams Collective"
12
19
  },
13
20
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-monorepo",
@@ -49,6 +56,7 @@
49
56
  "@atlaskit/feature-gate-js-client": "^5.5.0",
50
57
  "@atlassian/codegen": "^0.1.0",
51
58
  "@atlassian/ptc-test-utils": "^0.12.0",
59
+ "@atlassian/react-compiler-gating": "workspace:^",
52
60
  "@testing-library/react": "^16.3.0",
53
61
  "@types/faker": "^4.1.8",
54
62
  "react-dom": "^18.2.0",
@@ -93,6 +101,12 @@
93
101
  "platform-feature-flags": {
94
102
  "enable_edit_team_name_external_type_teams": {
95
103
  "type": "boolean"
104
+ },
105
+ "teams-app_client_fix-invalid-ari": {
106
+ "type": "boolean"
107
+ },
108
+ "ptc-enable-team-type-permission-enabled": {
109
+ "type": "boolean"
96
110
  }
97
111
  }
98
112
  }