@atlaskit/teams-public 0.9.0 → 0.10.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/teams-public
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#123606](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/123606)
8
+ [`65d70a1e2362d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/65d70a1e2362d) -
9
+ [ux] Open team containers popup on add click in add container card - Fix accessibility issue
10
+
3
11
  ## 0.9.0
4
12
 
5
13
  ### Minor Changes
@@ -19,46 +19,56 @@ var initialState = {
19
19
  teamContainers: [],
20
20
  loading: true,
21
21
  error: null,
22
- unlinkError: null
22
+ unlinkError: null,
23
+ teamId: null
23
24
  };
24
25
  var actions = {
25
26
  fetchTeamContainers: function fetchTeamContainers(teamId) {
26
27
  return /*#__PURE__*/function () {
27
28
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
28
- var setState, containers;
29
+ var setState, getState, _getState, currentTeamId, containers;
29
30
  return _regenerator.default.wrap(function _callee$(_context) {
30
31
  while (1) switch (_context.prev = _context.next) {
31
32
  case 0:
32
- setState = _ref.setState;
33
+ setState = _ref.setState, getState = _ref.getState;
34
+ _getState = getState(), currentTeamId = _getState.teamId;
35
+ if (!(currentTeamId === teamId)) {
36
+ _context.next = 4;
37
+ break;
38
+ }
39
+ return _context.abrupt("return");
40
+ case 4:
33
41
  setState({
34
42
  loading: true,
35
- error: null
43
+ error: null,
44
+ teamContainers: [],
45
+ teamId: teamId
36
46
  });
37
- _context.prev = 2;
38
- _context.next = 5;
47
+ _context.prev = 5;
48
+ _context.next = 8;
39
49
  return _services.teamsClient.getTeamContainers(teamId);
40
- case 5:
50
+ case 8:
41
51
  containers = _context.sent;
42
52
  setState({
43
53
  teamContainers: containers,
44
54
  loading: false,
45
55
  error: null
46
56
  });
47
- _context.next = 12;
57
+ _context.next = 15;
48
58
  break;
49
- case 9:
50
- _context.prev = 9;
51
- _context.t0 = _context["catch"](2);
59
+ case 12:
60
+ _context.prev = 12;
61
+ _context.t0 = _context["catch"](5);
52
62
  setState({
53
63
  teamContainers: [],
54
64
  error: _context.t0,
55
65
  loading: false
56
66
  });
57
- case 12:
67
+ case 15:
58
68
  case "end":
59
69
  return _context.stop();
60
70
  }
61
- }, _callee, null, [[2, 9]]);
71
+ }, _callee, null, [[5, 12]]);
62
72
  }));
63
73
  return function (_x) {
64
74
  return _ref2.apply(this, arguments);
@@ -68,11 +78,11 @@ var actions = {
68
78
  unlinkTeamContainers: function unlinkTeamContainers(teamId, containerId) {
69
79
  return /*#__PURE__*/function () {
70
80
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref3) {
71
- var setState, dispatch, mutationResult;
81
+ var setState, getState, mutationResult, _getState2, teamContainers, newContainers;
72
82
  return _regenerator.default.wrap(function _callee2$(_context2) {
73
83
  while (1) switch (_context2.prev = _context2.next) {
74
84
  case 0:
75
- setState = _ref3.setState, dispatch = _ref3.dispatch;
85
+ setState = _ref3.setState, getState = _ref3.getState;
76
86
  setState({
77
87
  unlinkError: null
78
88
  });
@@ -87,7 +97,13 @@ var actions = {
87
97
  unlinkError: mutationResult.deleteTeamConnectedToContainer.errors[0]
88
98
  });
89
99
  } else {
90
- dispatch(actions.fetchTeamContainers(teamId));
100
+ _getState2 = getState(), teamContainers = _getState2.teamContainers;
101
+ newContainers = teamContainers.filter(function (container) {
102
+ return container.id !== containerId;
103
+ });
104
+ setState({
105
+ teamContainers: newContainers
106
+ });
91
107
  }
92
108
  _context2.next = 12;
93
109
  break;
@@ -111,12 +127,12 @@ var actions = {
111
127
  addTeamContainer: function addTeamContainer(teamContainer) {
112
128
  return /*#__PURE__*/function () {
113
129
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref5) {
114
- var setState, getState, _getState, teamContainers, containerExists;
130
+ var setState, getState, _getState3, teamContainers, containerExists;
115
131
  return _regenerator.default.wrap(function _callee3$(_context3) {
116
132
  while (1) switch (_context3.prev = _context3.next) {
117
133
  case 0:
118
134
  setState = _ref5.setState, getState = _ref5.getState;
119
- _getState = getState(), teamContainers = _getState.teamContainers;
135
+ _getState3 = getState(), teamContainers = _getState3.teamContainers;
120
136
  containerExists = teamContainers.some(function (container) {
121
137
  return container.id === teamContainer.id;
122
138
  });
@@ -5,16 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.transformPermissions = exports.hasProductPermission = exports.getProductPermissionRequestBody = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
9
  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; }
11
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) { (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; }
11
+ var PRODUCTS = ['confluence', 'jira', 'jira-core', 'jira-software', 'jira-servicedesk', 'jira-product-discovery'];
12
12
  var transformPermissions = exports.transformPermissions = function transformPermissions(permissions) {
13
13
  return permissions.reduce(function (acc, permission) {
14
14
  if (permission.resourceId.includes('jira')) {
15
- acc['jira'] = _objectSpread(_objectSpread({}, acc['jira']), {}, (0, _defineProperty2.default)({}, permission.permissionId, permission.permitted));
15
+ var _acc$jira;
16
+ acc['jira'] = _objectSpread(_objectSpread({}, acc['jira']), {}, (0, _defineProperty2.default)({}, permission.permissionId, ((_acc$jira = acc['jira']) === null || _acc$jira === void 0 ? void 0 : _acc$jira[permission.permissionId]) || permission.permitted));
16
17
  } else if (permission.resourceId.includes('confluence')) {
17
- acc['confluence'] = _objectSpread(_objectSpread({}, acc['confluence']), {}, (0, _defineProperty2.default)({}, permission.permissionId, permission.permitted));
18
+ var _acc$confluence;
19
+ acc['confluence'] = _objectSpread(_objectSpread({}, acc['confluence']), {}, (0, _defineProperty2.default)({}, permission.permissionId, ((_acc$confluence = acc['confluence']) === null || _acc$confluence === void 0 ? void 0 : _acc$confluence[permission.permissionId]) || permission.permitted));
18
20
  }
19
21
  return acc;
20
22
  }, {});
@@ -27,11 +29,12 @@ var getProductPermissionRequestBody = exports.getProductPermissionRequestBody =
27
29
  principalId: "ari:cloud:identity::user/".concat(userId),
28
30
  dontRequirePrincipalInSite: true
29
31
  };
30
- return [].concat((0, _toConsumableArray2.default)(acc), [_objectSpread(_objectSpread({}, permission), {}, {
31
- resourceId: "ari:cloud:confluence::site/".concat(cloudId)
32
- }), _objectSpread(_objectSpread({}, permission), {}, {
33
- resourceId: "ari:cloud:jira::site/".concat(cloudId)
34
- })]);
32
+ PRODUCTS.forEach(function (product) {
33
+ acc.push(_objectSpread(_objectSpread({}, permission), {}, {
34
+ resourceId: "ari:cloud:".concat(product, "::site/").concat(cloudId)
35
+ }));
36
+ });
37
+ return acc;
35
38
  }, []);
36
39
  return JSON.stringify(body);
37
40
  };
@@ -5,15 +5,25 @@ const initialState = {
5
5
  teamContainers: [],
6
6
  loading: true,
7
7
  error: null,
8
- unlinkError: null
8
+ unlinkError: null,
9
+ teamId: null
9
10
  };
10
11
  const actions = {
11
12
  fetchTeamContainers: teamId => async ({
12
- setState
13
+ setState,
14
+ getState
13
15
  }) => {
16
+ const {
17
+ teamId: currentTeamId
18
+ } = getState();
19
+ if (currentTeamId === teamId) {
20
+ return;
21
+ }
14
22
  setState({
15
23
  loading: true,
16
- error: null
24
+ error: null,
25
+ teamContainers: [],
26
+ teamId
17
27
  });
18
28
  try {
19
29
  const containers = await teamsClient.getTeamContainers(teamId);
@@ -32,7 +42,7 @@ const actions = {
32
42
  },
33
43
  unlinkTeamContainers: (teamId, containerId) => async ({
34
44
  setState,
35
- dispatch
45
+ getState
36
46
  }) => {
37
47
  setState({
38
48
  unlinkError: null
@@ -45,7 +55,13 @@ const actions = {
45
55
  unlinkError: mutationResult.deleteTeamConnectedToContainer.errors[0]
46
56
  });
47
57
  } else {
48
- dispatch(actions.fetchTeamContainers(teamId));
58
+ const {
59
+ teamContainers
60
+ } = getState();
61
+ const newContainers = teamContainers.filter(container => container.id !== containerId);
62
+ setState({
63
+ teamContainers: newContainers
64
+ });
49
65
  }
50
66
  } catch (err) {
51
67
  setState({
@@ -1,14 +1,17 @@
1
+ const PRODUCTS = ['confluence', 'jira', 'jira-core', 'jira-software', 'jira-servicedesk', 'jira-product-discovery'];
1
2
  export const transformPermissions = permissions => {
2
3
  return permissions.reduce((acc, permission) => {
3
4
  if (permission.resourceId.includes('jira')) {
5
+ var _acc$jira;
4
6
  acc['jira'] = {
5
7
  ...acc['jira'],
6
- [permission.permissionId]: permission.permitted
8
+ [permission.permissionId]: ((_acc$jira = acc['jira']) === null || _acc$jira === void 0 ? void 0 : _acc$jira[permission.permissionId]) || permission.permitted
7
9
  };
8
10
  } else if (permission.resourceId.includes('confluence')) {
11
+ var _acc$confluence;
9
12
  acc['confluence'] = {
10
13
  ...acc['confluence'],
11
- [permission.permissionId]: permission.permitted
14
+ [permission.permissionId]: ((_acc$confluence = acc['confluence']) === null || _acc$confluence === void 0 ? void 0 : _acc$confluence[permission.permissionId]) || permission.permitted
12
15
  };
13
16
  }
14
17
  return acc;
@@ -22,13 +25,13 @@ export const getProductPermissionRequestBody = (cloudId, userId, permissionIds)
22
25
  principalId: `ari:cloud:identity::user/${userId}`,
23
26
  dontRequirePrincipalInSite: true
24
27
  };
25
- return [...acc, {
26
- ...permission,
27
- resourceId: `ari:cloud:confluence::site/${cloudId}`
28
- }, {
29
- ...permission,
30
- resourceId: `ari:cloud:jira::site/${cloudId}`
31
- }];
28
+ PRODUCTS.forEach(product => {
29
+ acc.push({
30
+ ...permission,
31
+ resourceId: `ari:cloud:${product}::site/${cloudId}`
32
+ });
33
+ });
34
+ return acc;
32
35
  }, []);
33
36
  return JSON.stringify(body);
34
37
  };
@@ -12,46 +12,56 @@ var initialState = {
12
12
  teamContainers: [],
13
13
  loading: true,
14
14
  error: null,
15
- unlinkError: null
15
+ unlinkError: null,
16
+ teamId: null
16
17
  };
17
18
  var actions = {
18
19
  fetchTeamContainers: function fetchTeamContainers(teamId) {
19
20
  return /*#__PURE__*/function () {
20
21
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
21
- var setState, containers;
22
+ var setState, getState, _getState, currentTeamId, containers;
22
23
  return _regeneratorRuntime.wrap(function _callee$(_context) {
23
24
  while (1) switch (_context.prev = _context.next) {
24
25
  case 0:
25
- setState = _ref.setState;
26
+ setState = _ref.setState, getState = _ref.getState;
27
+ _getState = getState(), currentTeamId = _getState.teamId;
28
+ if (!(currentTeamId === teamId)) {
29
+ _context.next = 4;
30
+ break;
31
+ }
32
+ return _context.abrupt("return");
33
+ case 4:
26
34
  setState({
27
35
  loading: true,
28
- error: null
36
+ error: null,
37
+ teamContainers: [],
38
+ teamId: teamId
29
39
  });
30
- _context.prev = 2;
31
- _context.next = 5;
40
+ _context.prev = 5;
41
+ _context.next = 8;
32
42
  return teamsClient.getTeamContainers(teamId);
33
- case 5:
43
+ case 8:
34
44
  containers = _context.sent;
35
45
  setState({
36
46
  teamContainers: containers,
37
47
  loading: false,
38
48
  error: null
39
49
  });
40
- _context.next = 12;
50
+ _context.next = 15;
41
51
  break;
42
- case 9:
43
- _context.prev = 9;
44
- _context.t0 = _context["catch"](2);
52
+ case 12:
53
+ _context.prev = 12;
54
+ _context.t0 = _context["catch"](5);
45
55
  setState({
46
56
  teamContainers: [],
47
57
  error: _context.t0,
48
58
  loading: false
49
59
  });
50
- case 12:
60
+ case 15:
51
61
  case "end":
52
62
  return _context.stop();
53
63
  }
54
- }, _callee, null, [[2, 9]]);
64
+ }, _callee, null, [[5, 12]]);
55
65
  }));
56
66
  return function (_x) {
57
67
  return _ref2.apply(this, arguments);
@@ -61,11 +71,11 @@ var actions = {
61
71
  unlinkTeamContainers: function unlinkTeamContainers(teamId, containerId) {
62
72
  return /*#__PURE__*/function () {
63
73
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
64
- var setState, dispatch, mutationResult;
74
+ var setState, getState, mutationResult, _getState2, teamContainers, newContainers;
65
75
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
66
76
  while (1) switch (_context2.prev = _context2.next) {
67
77
  case 0:
68
- setState = _ref3.setState, dispatch = _ref3.dispatch;
78
+ setState = _ref3.setState, getState = _ref3.getState;
69
79
  setState({
70
80
  unlinkError: null
71
81
  });
@@ -80,7 +90,13 @@ var actions = {
80
90
  unlinkError: mutationResult.deleteTeamConnectedToContainer.errors[0]
81
91
  });
82
92
  } else {
83
- dispatch(actions.fetchTeamContainers(teamId));
93
+ _getState2 = getState(), teamContainers = _getState2.teamContainers;
94
+ newContainers = teamContainers.filter(function (container) {
95
+ return container.id !== containerId;
96
+ });
97
+ setState({
98
+ teamContainers: newContainers
99
+ });
84
100
  }
85
101
  _context2.next = 12;
86
102
  break;
@@ -104,12 +120,12 @@ var actions = {
104
120
  addTeamContainer: function addTeamContainer(teamContainer) {
105
121
  return /*#__PURE__*/function () {
106
122
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
107
- var setState, getState, _getState, teamContainers, containerExists;
123
+ var setState, getState, _getState3, teamContainers, containerExists;
108
124
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
109
125
  while (1) switch (_context3.prev = _context3.next) {
110
126
  case 0:
111
127
  setState = _ref5.setState, getState = _ref5.getState;
112
- _getState = getState(), teamContainers = _getState.teamContainers;
128
+ _getState3 = getState(), teamContainers = _getState3.teamContainers;
113
129
  containerExists = teamContainers.some(function (container) {
114
130
  return container.id === teamContainer.id;
115
131
  });
@@ -1,13 +1,15 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  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; }
4
3
  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; }
4
+ var PRODUCTS = ['confluence', 'jira', 'jira-core', 'jira-software', 'jira-servicedesk', 'jira-product-discovery'];
5
5
  export var transformPermissions = function transformPermissions(permissions) {
6
6
  return permissions.reduce(function (acc, permission) {
7
7
  if (permission.resourceId.includes('jira')) {
8
- acc['jira'] = _objectSpread(_objectSpread({}, acc['jira']), {}, _defineProperty({}, permission.permissionId, permission.permitted));
8
+ var _acc$jira;
9
+ acc['jira'] = _objectSpread(_objectSpread({}, acc['jira']), {}, _defineProperty({}, permission.permissionId, ((_acc$jira = acc['jira']) === null || _acc$jira === void 0 ? void 0 : _acc$jira[permission.permissionId]) || permission.permitted));
9
10
  } else if (permission.resourceId.includes('confluence')) {
10
- acc['confluence'] = _objectSpread(_objectSpread({}, acc['confluence']), {}, _defineProperty({}, permission.permissionId, permission.permitted));
11
+ var _acc$confluence;
12
+ acc['confluence'] = _objectSpread(_objectSpread({}, acc['confluence']), {}, _defineProperty({}, permission.permissionId, ((_acc$confluence = acc['confluence']) === null || _acc$confluence === void 0 ? void 0 : _acc$confluence[permission.permissionId]) || permission.permitted));
11
13
  }
12
14
  return acc;
13
15
  }, {});
@@ -20,11 +22,12 @@ export var getProductPermissionRequestBody = function getProductPermissionReques
20
22
  principalId: "ari:cloud:identity::user/".concat(userId),
21
23
  dontRequirePrincipalInSite: true
22
24
  };
23
- return [].concat(_toConsumableArray(acc), [_objectSpread(_objectSpread({}, permission), {}, {
24
- resourceId: "ari:cloud:confluence::site/".concat(cloudId)
25
- }), _objectSpread(_objectSpread({}, permission), {}, {
26
- resourceId: "ari:cloud:jira::site/".concat(cloudId)
27
- })]);
25
+ PRODUCTS.forEach(function (product) {
26
+ acc.push(_objectSpread(_objectSpread({}, permission), {}, {
27
+ resourceId: "ari:cloud:".concat(product, "::site/").concat(cloudId)
28
+ }));
29
+ });
30
+ return acc;
28
31
  }, []);
29
32
  return JSON.stringify(body);
30
33
  };
@@ -6,6 +6,7 @@ type State = {
6
6
  loading: boolean;
7
7
  error: Error | null;
8
8
  unlinkError: UnlinkContainerMutationError | null;
9
+ teamId: string | null;
9
10
  };
10
11
  export declare const useTeamContainersHook: import("react-sweet-state").HookFunction<State, import("react-sweet-state").BoundActions<State, {
11
12
  fetchTeamContainers: (teamId: string) => Action<State>;
@@ -18,5 +19,6 @@ export declare const useTeamContainers: (teamId: string) => {
18
19
  loading: boolean;
19
20
  error: Error | null;
20
21
  unlinkError: UnlinkContainerMutationError | null;
22
+ teamId: string | null;
21
23
  };
22
24
  export {};
@@ -6,6 +6,7 @@ type State = {
6
6
  loading: boolean;
7
7
  error: Error | null;
8
8
  unlinkError: UnlinkContainerMutationError | null;
9
+ teamId: string | null;
9
10
  };
10
11
  export declare const useTeamContainersHook: import("react-sweet-state").HookFunction<State, import("react-sweet-state").BoundActions<State, {
11
12
  fetchTeamContainers: (teamId: string) => Action<State>;
@@ -18,5 +19,6 @@ export declare const useTeamContainers: (teamId: string) => {
18
19
  loading: boolean;
19
20
  error: Error | null;
20
21
  unlinkError: UnlinkContainerMutationError | null;
22
+ teamId: string | null;
21
23
  };
22
24
  export {};
package/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/modal-dialog": "^13.0.0",
41
41
  "@atlaskit/primitives": "^14.1.0",
42
42
  "@atlaskit/theme": "^18.0.0",
43
- "@atlaskit/tokens": "^4.3.0",
43
+ "@atlaskit/tokens": "^4.4.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@compiled/react": "^0.18.2",
46
46
  "graphql": "^15.8.0",
@@ -103,7 +103,7 @@
103
103
  }
104
104
  },
105
105
  "name": "@atlaskit/teams-public",
106
- "version": "0.9.0",
106
+ "version": "0.10.0",
107
107
  "description": "Public components related to teams",
108
108
  "author": "Atlassian Pty Ltd",
109
109
  "license": "Apache-2.0",