@atlaskit/teams-public 0.28.0 → 0.29.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/common/utils/team-web-link-converters.js +25 -0
  3. package/dist/cjs/controllers/hooks/use-team-web-links/index.js +162 -0
  4. package/dist/cjs/controllers/hooks/use-team-web-links/types.js +5 -0
  5. package/dist/cjs/controllers/index.js +13 -0
  6. package/dist/cjs/index.js +13 -0
  7. package/dist/es2019/common/utils/team-web-link-converters.js +19 -0
  8. package/dist/es2019/controllers/hooks/use-team-web-links/index.js +86 -0
  9. package/dist/es2019/controllers/hooks/use-team-web-links/types.js +1 -0
  10. package/dist/es2019/controllers/index.js +1 -0
  11. package/dist/es2019/index.js +1 -0
  12. package/dist/esm/common/utils/team-web-link-converters.js +19 -0
  13. package/dist/esm/controllers/hooks/use-team-web-links/index.js +155 -0
  14. package/dist/esm/controllers/hooks/use-team-web-links/types.js +1 -0
  15. package/dist/esm/controllers/index.js +1 -0
  16. package/dist/esm/index.js +1 -0
  17. package/dist/types/common/types.d.ts +9 -1
  18. package/dist/types/common/utils/team-web-link-converters.d.ts +4 -0
  19. package/dist/types/controllers/hooks/use-team-web-links/index.d.ts +24 -0
  20. package/dist/types/controllers/hooks/use-team-web-links/types.d.ts +14 -0
  21. package/dist/types/controllers/index.d.ts +1 -0
  22. package/dist/types/index.d.ts +1 -0
  23. package/dist/types-ts4.5/common/types.d.ts +9 -1
  24. package/dist/types-ts4.5/common/utils/team-web-link-converters.d.ts +4 -0
  25. package/dist/types-ts4.5/controllers/hooks/use-team-web-links/index.d.ts +24 -0
  26. package/dist/types-ts4.5/controllers/hooks/use-team-web-links/types.d.ts +14 -0
  27. package/dist/types-ts4.5/controllers/index.d.ts +1 -0
  28. package/dist/types-ts4.5/index.d.ts +1 -0
  29. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/teams-public
2
2
 
3
+ ## 0.29.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#156784](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/156784)
8
+ [`a614e25bb80c9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a614e25bb80c9) -
9
+ PTC-11532 Add useTeamWebLink in teams-public, allow get/delete/update team web links in
10
+ teams-public
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 0.28.0
4
17
 
5
18
  ### Minor Changes
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.webLinksToContainers = exports.webLinkToContainer = exports.containerToNewWebLink = void 0;
7
+ var containerToNewWebLink = exports.containerToNewWebLink = function containerToNewWebLink(container) {
8
+ return {
9
+ contentTitle: container.name,
10
+ description: '',
11
+ linkUri: container.link || ''
12
+ };
13
+ };
14
+ var webLinkToContainer = exports.webLinkToContainer = function webLinkToContainer(link) {
15
+ return {
16
+ id: link.linkId,
17
+ type: 'WebLink',
18
+ name: link.contentTitle,
19
+ icon: null,
20
+ link: link.linkUri
21
+ };
22
+ };
23
+ var webLinksToContainers = exports.webLinksToContainers = function webLinksToContainers(links) {
24
+ return links.map(webLinkToContainer);
25
+ };
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useTeamWebLinksActions = exports.useTeamWebLinks = exports.actions = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _reactSweetState = require("react-sweet-state");
12
+ var _teamsClient = require("@atlaskit/teams-client");
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; }
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; }
15
+ var _initialState = {
16
+ teamId: '',
17
+ isLoading: false,
18
+ hasLoaded: false,
19
+ hasError: false,
20
+ shouldReload: false,
21
+ errorType: null,
22
+ links: []
23
+ };
24
+ var actions = exports.actions = {
25
+ getTeamWebLinks: function getTeamWebLinks(teamId) {
26
+ return /*#__PURE__*/function () {
27
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
28
+ var getState, setState, _getState, links, currentTeamId, initialLinks, _yield$teamsClient$ge, entities;
29
+ return _regenerator.default.wrap(function _callee$(_context) {
30
+ while (1) switch (_context.prev = _context.next) {
31
+ case 0:
32
+ getState = _ref.getState, setState = _ref.setState;
33
+ _getState = getState(), links = _getState.links, currentTeamId = _getState.teamId;
34
+ initialLinks = teamId === currentTeamId ? links : [];
35
+ setState({
36
+ teamId: teamId,
37
+ isLoading: true,
38
+ hasLoaded: false,
39
+ hasError: false,
40
+ shouldReload: false,
41
+ links: initialLinks
42
+ });
43
+ _context.prev = 4;
44
+ _context.next = 7;
45
+ return _teamsClient.teamsClient.getTeamLinksByTeamId(teamId);
46
+ case 7:
47
+ _yield$teamsClient$ge = _context.sent;
48
+ entities = _yield$teamsClient$ge.entities;
49
+ if (!(getState().teamId !== teamId)) {
50
+ _context.next = 11;
51
+ break;
52
+ }
53
+ return _context.abrupt("return");
54
+ case 11:
55
+ setState({
56
+ isLoading: false,
57
+ hasLoaded: true,
58
+ hasError: false,
59
+ shouldReload: false,
60
+ links: entities
61
+ });
62
+ _context.next = 19;
63
+ break;
64
+ case 14:
65
+ _context.prev = 14;
66
+ _context.t0 = _context["catch"](4);
67
+ if (!(getState().teamId !== teamId)) {
68
+ _context.next = 18;
69
+ break;
70
+ }
71
+ return _context.abrupt("return");
72
+ case 18:
73
+ setState({
74
+ isLoading: false,
75
+ hasLoaded: true,
76
+ hasError: true,
77
+ errorType: _context.t0 instanceof Error ? _context.t0 : undefined,
78
+ shouldReload: false,
79
+ links: []
80
+ });
81
+ case 19:
82
+ case "end":
83
+ return _context.stop();
84
+ }
85
+ }, _callee, null, [[4, 14]]);
86
+ }));
87
+ return function (_x) {
88
+ return _ref2.apply(this, arguments);
89
+ };
90
+ }();
91
+ },
92
+ createTeamWebLink: function createTeamWebLink(teamId, newLink) {
93
+ return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
94
+ return _regenerator.default.wrap(function _callee2$(_context2) {
95
+ while (1) switch (_context2.prev = _context2.next) {
96
+ case 0:
97
+ _context2.next = 2;
98
+ return _teamsClient.teamsClient.createTeamLink(teamId, newLink);
99
+ case 2:
100
+ return _context2.abrupt("return", _context2.sent);
101
+ case 3:
102
+ case "end":
103
+ return _context2.stop();
104
+ }
105
+ }, _callee2);
106
+ }));
107
+ },
108
+ updateTeamWebLink: function updateTeamWebLink(teamId, linkId, newLink) {
109
+ return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
110
+ return _regenerator.default.wrap(function _callee3$(_context3) {
111
+ while (1) switch (_context3.prev = _context3.next) {
112
+ case 0:
113
+ _context3.next = 2;
114
+ return _teamsClient.teamsClient.updateTeamLink(teamId, linkId, newLink);
115
+ case 2:
116
+ return _context3.abrupt("return", _context3.sent);
117
+ case 3:
118
+ case "end":
119
+ return _context3.stop();
120
+ }
121
+ }, _callee3);
122
+ }));
123
+ },
124
+ removeWebLink: function removeWebLink(teamId, linkId) {
125
+ return /*#__PURE__*/function () {
126
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(_ref5) {
127
+ var dispatch;
128
+ return _regenerator.default.wrap(function _callee4$(_context4) {
129
+ while (1) switch (_context4.prev = _context4.next) {
130
+ case 0:
131
+ dispatch = _ref5.dispatch;
132
+ _context4.next = 3;
133
+ return _teamsClient.teamsClient.deleteTeamLink(teamId, linkId);
134
+ case 3:
135
+ _context4.next = 5;
136
+ return dispatch(actions.getTeamWebLinks(teamId));
137
+ case 5:
138
+ case "end":
139
+ return _context4.stop();
140
+ }
141
+ }, _callee4);
142
+ }));
143
+ return function (_x2) {
144
+ return _ref6.apply(this, arguments);
145
+ };
146
+ }();
147
+ },
148
+ initialState: function initialState(state) {
149
+ return function (_ref7) {
150
+ var setState = _ref7.setState;
151
+ setState(_objectSpread(_objectSpread({}, _initialState), state));
152
+ };
153
+ }
154
+ };
155
+ var TeamWebLinksStore = (0, _reactSweetState.createStore)({
156
+ initialState: _initialState,
157
+ actions: actions
158
+ });
159
+ var useTeamWebLinks = exports.useTeamWebLinks = (0, _reactSweetState.createHook)(TeamWebLinksStore);
160
+ var useTeamWebLinksActions = exports.useTeamWebLinksActions = (0, _reactSweetState.createHook)(TeamWebLinksStore, {
161
+ selector: null
162
+ });
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -15,5 +15,18 @@ Object.defineProperty(exports, "useTeamContainers", {
15
15
  return _useTeamContainers.useTeamContainers;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "useTeamWebLinks", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _useTeamWebLinks.useTeamWebLinks;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "useTeamWebLinksActions", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _useTeamWebLinks.useTeamWebLinksActions;
28
+ }
29
+ });
18
30
  var _useTeamContainers = require("./hooks/use-team-containers");
31
+ var _useTeamWebLinks = require("./hooks/use-team-web-links");
19
32
  var _utils = require("./product-permission/utils");
package/dist/cjs/index.js CHANGED
@@ -57,8 +57,21 @@ Object.defineProperty(exports, "useTeamContainers", {
57
57
  return _useTeamContainers.useTeamContainers;
58
58
  }
59
59
  });
60
+ Object.defineProperty(exports, "useTeamWebLinks", {
61
+ enumerable: true,
62
+ get: function get() {
63
+ return _useTeamWebLinks.useTeamWebLinks;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "useTeamWebLinksActions", {
67
+ enumerable: true,
68
+ get: function get() {
69
+ return _useTeamWebLinks.useTeamWebLinksActions;
70
+ }
71
+ });
60
72
  var _teamContainers = require("./ui/team-containers");
61
73
  var _useTeamContainers = require("./controllers/hooks/use-team-containers");
74
+ var _useTeamWebLinks = require("./controllers/hooks/use-team-web-links");
62
75
  var _useProductPermission = require("./controllers/hooks/use-product-permission");
63
76
  var _utils = require("./controllers/product-permission/utils");
64
77
  var _getContainerProperties = require("./common/utils/get-container-properties");
@@ -0,0 +1,19 @@
1
+ export const containerToNewWebLink = container => {
2
+ return {
3
+ contentTitle: container.name,
4
+ description: '',
5
+ linkUri: container.link || ''
6
+ };
7
+ };
8
+ export const webLinkToContainer = link => {
9
+ return {
10
+ id: link.linkId,
11
+ type: 'WebLink',
12
+ name: link.contentTitle,
13
+ icon: null,
14
+ link: link.linkUri
15
+ };
16
+ };
17
+ export const webLinksToContainers = links => {
18
+ return links.map(webLinkToContainer);
19
+ };
@@ -0,0 +1,86 @@
1
+ import { createHook, createStore } from 'react-sweet-state';
2
+ import { teamsClient } from '@atlaskit/teams-client';
3
+ const initialState = {
4
+ teamId: '',
5
+ isLoading: false,
6
+ hasLoaded: false,
7
+ hasError: false,
8
+ shouldReload: false,
9
+ errorType: null,
10
+ links: []
11
+ };
12
+ export const actions = {
13
+ getTeamWebLinks: teamId => async ({
14
+ getState,
15
+ setState
16
+ }) => {
17
+ const {
18
+ links,
19
+ teamId: currentTeamId
20
+ } = getState();
21
+ const initialLinks = teamId === currentTeamId ? links : [];
22
+ setState({
23
+ teamId,
24
+ isLoading: true,
25
+ hasLoaded: false,
26
+ hasError: false,
27
+ shouldReload: false,
28
+ links: initialLinks
29
+ });
30
+ try {
31
+ const {
32
+ entities
33
+ } = await teamsClient.getTeamLinksByTeamId(teamId);
34
+ if (getState().teamId !== teamId) {
35
+ return;
36
+ }
37
+ setState({
38
+ isLoading: false,
39
+ hasLoaded: true,
40
+ hasError: false,
41
+ shouldReload: false,
42
+ links: entities
43
+ });
44
+ } catch (e) {
45
+ if (getState().teamId !== teamId) {
46
+ return;
47
+ }
48
+ setState({
49
+ isLoading: false,
50
+ hasLoaded: true,
51
+ hasError: true,
52
+ errorType: e instanceof Error ? e : undefined,
53
+ shouldReload: false,
54
+ links: []
55
+ });
56
+ }
57
+ },
58
+ createTeamWebLink: (teamId, newLink) => async () => {
59
+ return await teamsClient.createTeamLink(teamId, newLink);
60
+ },
61
+ updateTeamWebLink: (teamId, linkId, newLink) => async () => {
62
+ return await teamsClient.updateTeamLink(teamId, linkId, newLink);
63
+ },
64
+ removeWebLink: (teamId, linkId) => async ({
65
+ dispatch
66
+ }) => {
67
+ await teamsClient.deleteTeamLink(teamId, linkId);
68
+ await dispatch(actions.getTeamWebLinks(teamId));
69
+ },
70
+ initialState: state => ({
71
+ setState
72
+ }) => {
73
+ setState({
74
+ ...initialState,
75
+ ...state
76
+ });
77
+ }
78
+ };
79
+ const TeamWebLinksStore = createStore({
80
+ initialState,
81
+ actions
82
+ });
83
+ export const useTeamWebLinks = createHook(TeamWebLinksStore);
84
+ export const useTeamWebLinksActions = createHook(TeamWebLinksStore, {
85
+ selector: null
86
+ });
@@ -1,2 +1,3 @@
1
1
  export { useTeamContainers } from './hooks/use-team-containers';
2
+ export { useTeamWebLinks, useTeamWebLinksActions } from './hooks/use-team-web-links';
2
3
  export { hasProductPermission } from './product-permission/utils';
@@ -1,5 +1,6 @@
1
1
  export { TeamContainers } from './ui/team-containers';
2
2
  export { useTeamContainers, useConnectedTeams } from './controllers/hooks/use-team-containers';
3
+ export { useTeamWebLinks, useTeamWebLinksActions } from './controllers/hooks/use-team-web-links';
3
4
  export { useProductPermissions } from './controllers/hooks/use-product-permission';
4
5
  export { hasProductPermission } from './controllers/product-permission/utils';
5
6
  export { getContainerProperties } from './common/utils/get-container-properties';
@@ -0,0 +1,19 @@
1
+ export var containerToNewWebLink = function containerToNewWebLink(container) {
2
+ return {
3
+ contentTitle: container.name,
4
+ description: '',
5
+ linkUri: container.link || ''
6
+ };
7
+ };
8
+ export var webLinkToContainer = function webLinkToContainer(link) {
9
+ return {
10
+ id: link.linkId,
11
+ type: 'WebLink',
12
+ name: link.contentTitle,
13
+ icon: null,
14
+ link: link.linkUri
15
+ };
16
+ };
17
+ export var webLinksToContainers = function webLinksToContainers(links) {
18
+ return links.map(webLinkToContainer);
19
+ };
@@ -0,0 +1,155 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ 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
+ 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; }
5
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ import { createHook, createStore } from 'react-sweet-state';
7
+ import { teamsClient } from '@atlaskit/teams-client';
8
+ var _initialState = {
9
+ teamId: '',
10
+ isLoading: false,
11
+ hasLoaded: false,
12
+ hasError: false,
13
+ shouldReload: false,
14
+ errorType: null,
15
+ links: []
16
+ };
17
+ export var actions = {
18
+ getTeamWebLinks: function getTeamWebLinks(teamId) {
19
+ return /*#__PURE__*/function () {
20
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
21
+ var getState, setState, _getState, links, currentTeamId, initialLinks, _yield$teamsClient$ge, entities;
22
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
23
+ while (1) switch (_context.prev = _context.next) {
24
+ case 0:
25
+ getState = _ref.getState, setState = _ref.setState;
26
+ _getState = getState(), links = _getState.links, currentTeamId = _getState.teamId;
27
+ initialLinks = teamId === currentTeamId ? links : [];
28
+ setState({
29
+ teamId: teamId,
30
+ isLoading: true,
31
+ hasLoaded: false,
32
+ hasError: false,
33
+ shouldReload: false,
34
+ links: initialLinks
35
+ });
36
+ _context.prev = 4;
37
+ _context.next = 7;
38
+ return teamsClient.getTeamLinksByTeamId(teamId);
39
+ case 7:
40
+ _yield$teamsClient$ge = _context.sent;
41
+ entities = _yield$teamsClient$ge.entities;
42
+ if (!(getState().teamId !== teamId)) {
43
+ _context.next = 11;
44
+ break;
45
+ }
46
+ return _context.abrupt("return");
47
+ case 11:
48
+ setState({
49
+ isLoading: false,
50
+ hasLoaded: true,
51
+ hasError: false,
52
+ shouldReload: false,
53
+ links: entities
54
+ });
55
+ _context.next = 19;
56
+ break;
57
+ case 14:
58
+ _context.prev = 14;
59
+ _context.t0 = _context["catch"](4);
60
+ if (!(getState().teamId !== teamId)) {
61
+ _context.next = 18;
62
+ break;
63
+ }
64
+ return _context.abrupt("return");
65
+ case 18:
66
+ setState({
67
+ isLoading: false,
68
+ hasLoaded: true,
69
+ hasError: true,
70
+ errorType: _context.t0 instanceof Error ? _context.t0 : undefined,
71
+ shouldReload: false,
72
+ links: []
73
+ });
74
+ case 19:
75
+ case "end":
76
+ return _context.stop();
77
+ }
78
+ }, _callee, null, [[4, 14]]);
79
+ }));
80
+ return function (_x) {
81
+ return _ref2.apply(this, arguments);
82
+ };
83
+ }();
84
+ },
85
+ createTeamWebLink: function createTeamWebLink(teamId, newLink) {
86
+ return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
87
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
88
+ while (1) switch (_context2.prev = _context2.next) {
89
+ case 0:
90
+ _context2.next = 2;
91
+ return teamsClient.createTeamLink(teamId, newLink);
92
+ case 2:
93
+ return _context2.abrupt("return", _context2.sent);
94
+ case 3:
95
+ case "end":
96
+ return _context2.stop();
97
+ }
98
+ }, _callee2);
99
+ }));
100
+ },
101
+ updateTeamWebLink: function updateTeamWebLink(teamId, linkId, newLink) {
102
+ return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
103
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
104
+ while (1) switch (_context3.prev = _context3.next) {
105
+ case 0:
106
+ _context3.next = 2;
107
+ return teamsClient.updateTeamLink(teamId, linkId, newLink);
108
+ case 2:
109
+ return _context3.abrupt("return", _context3.sent);
110
+ case 3:
111
+ case "end":
112
+ return _context3.stop();
113
+ }
114
+ }, _callee3);
115
+ }));
116
+ },
117
+ removeWebLink: function removeWebLink(teamId, linkId) {
118
+ return /*#__PURE__*/function () {
119
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
120
+ var dispatch;
121
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
122
+ while (1) switch (_context4.prev = _context4.next) {
123
+ case 0:
124
+ dispatch = _ref5.dispatch;
125
+ _context4.next = 3;
126
+ return teamsClient.deleteTeamLink(teamId, linkId);
127
+ case 3:
128
+ _context4.next = 5;
129
+ return dispatch(actions.getTeamWebLinks(teamId));
130
+ case 5:
131
+ case "end":
132
+ return _context4.stop();
133
+ }
134
+ }, _callee4);
135
+ }));
136
+ return function (_x2) {
137
+ return _ref6.apply(this, arguments);
138
+ };
139
+ }();
140
+ },
141
+ initialState: function initialState(state) {
142
+ return function (_ref7) {
143
+ var setState = _ref7.setState;
144
+ setState(_objectSpread(_objectSpread({}, _initialState), state));
145
+ };
146
+ }
147
+ };
148
+ var TeamWebLinksStore = createStore({
149
+ initialState: _initialState,
150
+ actions: actions
151
+ });
152
+ export var useTeamWebLinks = createHook(TeamWebLinksStore);
153
+ export var useTeamWebLinksActions = createHook(TeamWebLinksStore, {
154
+ selector: null
155
+ });
@@ -1,2 +1,3 @@
1
1
  export { useTeamContainers } from './hooks/use-team-containers';
2
+ export { useTeamWebLinks, useTeamWebLinksActions } from './hooks/use-team-web-links';
2
3
  export { hasProductPermission } from './product-permission/utils';
package/dist/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { TeamContainers } from './ui/team-containers';
2
2
  export { useTeamContainers, useConnectedTeams } from './controllers/hooks/use-team-containers';
3
+ export { useTeamWebLinks, useTeamWebLinksActions } from './controllers/hooks/use-team-web-links';
3
4
  export { useProductPermissions } from './controllers/hooks/use-product-permission';
4
5
  export { hasProductPermission } from './controllers/product-permission/utils';
5
6
  export { getContainerProperties } from './common/utils/get-container-properties';
@@ -12,13 +12,21 @@ export type TeamContainer = {
12
12
  type: ContainerTypes;
13
13
  name: string;
14
14
  icon?: string | null;
15
- createdDate: Date;
15
+ createdDate?: Date;
16
16
  link?: string | null;
17
17
  containerTypeProperties?: {
18
18
  subType?: ContainerSubTypes;
19
19
  name?: string;
20
20
  };
21
21
  };
22
+ export interface TeamWebLink {
23
+ contentTitle: string;
24
+ description: string;
25
+ linkUri: string;
26
+ linkId: string;
27
+ teamId?: string;
28
+ }
29
+ export type NewTeamWebLink = Omit<TeamWebLink, 'linkId'>;
22
30
  export declare const USER_ARI_PREFIX: "ari:cloud:identity::user/";
23
31
  export type UserARI = `${typeof USER_ARI_PREFIX}${string}`;
24
32
  export declare const TEAM_ARI_PREFIX: "ari:cloud:identity::team/";
@@ -0,0 +1,4 @@
1
+ import { type NewTeamWebLink, type TeamContainer, type TeamWebLink } from '../types';
2
+ export declare const containerToNewWebLink: (container: TeamContainer) => NewTeamWebLink;
3
+ export declare const webLinkToContainer: (link: TeamWebLink) => TeamContainer;
4
+ export declare const webLinksToContainers: (links: TeamWebLink[]) => TeamContainer[];
@@ -0,0 +1,24 @@
1
+ /// <reference types="react-sweet-state" />
2
+ import { type NewTeamWebLink } from '../../../common/types';
3
+ import { type StoreApi, type TeamWebLinksState } from './types';
4
+ export declare const actions: {
5
+ getTeamWebLinks: (teamId: string) => ({ getState, setState }: StoreApi) => Promise<void>;
6
+ createTeamWebLink: (teamId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
7
+ updateTeamWebLink: (teamId: string, linkId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
8
+ removeWebLink: (teamId: string, linkId: string) => ({ dispatch }: StoreApi) => Promise<void>;
9
+ initialState: (state: Partial<TeamWebLinksState>) => ({ setState }: StoreApi) => void;
10
+ };
11
+ export declare const useTeamWebLinks: import("react-sweet-state").HookFunction<TeamWebLinksState, import("react-sweet-state").BoundActions<TeamWebLinksState, {
12
+ getTeamWebLinks: (teamId: string) => ({ getState, setState }: StoreApi) => Promise<void>;
13
+ createTeamWebLink: (teamId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
14
+ updateTeamWebLink: (teamId: string, linkId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
15
+ removeWebLink: (teamId: string, linkId: string) => ({ dispatch }: StoreApi) => Promise<void>;
16
+ initialState: (state: Partial<TeamWebLinksState>) => ({ setState }: StoreApi) => void;
17
+ }>, void>;
18
+ export declare const useTeamWebLinksActions: import("react-sweet-state").HookFunction<TeamWebLinksState, import("react-sweet-state").BoundActions<TeamWebLinksState, {
19
+ getTeamWebLinks: (teamId: string) => ({ getState, setState }: StoreApi) => Promise<void>;
20
+ createTeamWebLink: (teamId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
21
+ updateTeamWebLink: (teamId: string, linkId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
22
+ removeWebLink: (teamId: string, linkId: string) => ({ dispatch }: StoreApi) => Promise<void>;
23
+ initialState: (state: Partial<TeamWebLinksState>) => ({ setState }: StoreApi) => void;
24
+ }>, void>;
@@ -0,0 +1,14 @@
1
+ import { type StoreActionApi } from 'react-sweet-state';
2
+ import { type TeamWebLink } from '../../../common/types';
3
+ import { actions } from './index';
4
+ export interface TeamWebLinksState {
5
+ teamId: string;
6
+ isLoading: boolean;
7
+ hasLoaded: boolean;
8
+ hasError: boolean;
9
+ errorType: Error | null;
10
+ shouldReload: boolean;
11
+ links: TeamWebLink[];
12
+ }
13
+ export type StoreApi = StoreActionApi<TeamWebLinksState>;
14
+ export type Actions = typeof actions;
@@ -1,2 +1,3 @@
1
1
  export { useTeamContainers } from './hooks/use-team-containers';
2
+ export { useTeamWebLinks, useTeamWebLinksActions } from './hooks/use-team-web-links';
2
3
  export { hasProductPermission } from './product-permission/utils';
@@ -3,6 +3,7 @@ export type { LinkedContainerCardProps } from './ui/team-containers';
3
3
  export type { TeamContainersSkeletonProps } from './ui/team-containers';
4
4
  export type { TeamContainerProps } from './ui/team-containers/types';
5
5
  export { useTeamContainers, useConnectedTeams } from './controllers/hooks/use-team-containers';
6
+ export { useTeamWebLinks, useTeamWebLinksActions } from './controllers/hooks/use-team-web-links';
6
7
  export type { TeamContainer, ContainerSubTypes } from './common/types';
7
8
  export { useProductPermissions } from './controllers/hooks/use-product-permission';
8
9
  export { hasProductPermission } from './controllers/product-permission/utils';
@@ -12,13 +12,21 @@ export type TeamContainer = {
12
12
  type: ContainerTypes;
13
13
  name: string;
14
14
  icon?: string | null;
15
- createdDate: Date;
15
+ createdDate?: Date;
16
16
  link?: string | null;
17
17
  containerTypeProperties?: {
18
18
  subType?: ContainerSubTypes;
19
19
  name?: string;
20
20
  };
21
21
  };
22
+ export interface TeamWebLink {
23
+ contentTitle: string;
24
+ description: string;
25
+ linkUri: string;
26
+ linkId: string;
27
+ teamId?: string;
28
+ }
29
+ export type NewTeamWebLink = Omit<TeamWebLink, 'linkId'>;
22
30
  export declare const USER_ARI_PREFIX: "ari:cloud:identity::user/";
23
31
  export type UserARI = `${typeof USER_ARI_PREFIX}${string}`;
24
32
  export declare const TEAM_ARI_PREFIX: "ari:cloud:identity::team/";
@@ -0,0 +1,4 @@
1
+ import { type NewTeamWebLink, type TeamContainer, type TeamWebLink } from '../types';
2
+ export declare const containerToNewWebLink: (container: TeamContainer) => NewTeamWebLink;
3
+ export declare const webLinkToContainer: (link: TeamWebLink) => TeamContainer;
4
+ export declare const webLinksToContainers: (links: TeamWebLink[]) => TeamContainer[];
@@ -0,0 +1,24 @@
1
+ /// <reference types="react-sweet-state" />
2
+ import { type NewTeamWebLink } from '../../../common/types';
3
+ import { type StoreApi, type TeamWebLinksState } from './types';
4
+ export declare const actions: {
5
+ getTeamWebLinks: (teamId: string) => ({ getState, setState }: StoreApi) => Promise<void>;
6
+ createTeamWebLink: (teamId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
7
+ updateTeamWebLink: (teamId: string, linkId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
8
+ removeWebLink: (teamId: string, linkId: string) => ({ dispatch }: StoreApi) => Promise<void>;
9
+ initialState: (state: Partial<TeamWebLinksState>) => ({ setState }: StoreApi) => void;
10
+ };
11
+ export declare const useTeamWebLinks: import("react-sweet-state").HookFunction<TeamWebLinksState, import("react-sweet-state").BoundActions<TeamWebLinksState, {
12
+ getTeamWebLinks: (teamId: string) => ({ getState, setState }: StoreApi) => Promise<void>;
13
+ createTeamWebLink: (teamId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
14
+ updateTeamWebLink: (teamId: string, linkId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
15
+ removeWebLink: (teamId: string, linkId: string) => ({ dispatch }: StoreApi) => Promise<void>;
16
+ initialState: (state: Partial<TeamWebLinksState>) => ({ setState }: StoreApi) => void;
17
+ }>, void>;
18
+ export declare const useTeamWebLinksActions: import("react-sweet-state").HookFunction<TeamWebLinksState, import("react-sweet-state").BoundActions<TeamWebLinksState, {
19
+ getTeamWebLinks: (teamId: string) => ({ getState, setState }: StoreApi) => Promise<void>;
20
+ createTeamWebLink: (teamId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
21
+ updateTeamWebLink: (teamId: string, linkId: string, newLink: NewTeamWebLink) => () => Promise<import("@atlaskit/teams-client/types").TeamLink>;
22
+ removeWebLink: (teamId: string, linkId: string) => ({ dispatch }: StoreApi) => Promise<void>;
23
+ initialState: (state: Partial<TeamWebLinksState>) => ({ setState }: StoreApi) => void;
24
+ }>, void>;
@@ -0,0 +1,14 @@
1
+ import { type StoreActionApi } from 'react-sweet-state';
2
+ import { type TeamWebLink } from '../../../common/types';
3
+ import { actions } from './index';
4
+ export interface TeamWebLinksState {
5
+ teamId: string;
6
+ isLoading: boolean;
7
+ hasLoaded: boolean;
8
+ hasError: boolean;
9
+ errorType: Error | null;
10
+ shouldReload: boolean;
11
+ links: TeamWebLink[];
12
+ }
13
+ export type StoreApi = StoreActionApi<TeamWebLinksState>;
14
+ export type Actions = typeof actions;
@@ -1,2 +1,3 @@
1
1
  export { useTeamContainers } from './hooks/use-team-containers';
2
+ export { useTeamWebLinks, useTeamWebLinksActions } from './hooks/use-team-web-links';
2
3
  export { hasProductPermission } from './product-permission/utils';
@@ -3,6 +3,7 @@ export type { LinkedContainerCardProps } from './ui/team-containers';
3
3
  export type { TeamContainersSkeletonProps } from './ui/team-containers';
4
4
  export type { TeamContainerProps } from './ui/team-containers/types';
5
5
  export { useTeamContainers, useConnectedTeams } from './controllers/hooks/use-team-containers';
6
+ export { useTeamWebLinks, useTeamWebLinksActions } from './controllers/hooks/use-team-web-links';
6
7
  export type { TeamContainer, ContainerSubTypes } from './common/types';
7
8
  export { useProductPermissions } from './controllers/hooks/use-product-permission';
8
9
  export { hasProductPermission } from './controllers/product-permission/utils';
package/package.json CHANGED
@@ -42,6 +42,7 @@
42
42
  "@atlaskit/people-teams-ui-public": "^3.1.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/primitives": "^14.7.0",
45
+ "@atlaskit/teams-client": "^4.2.0",
45
46
  "@atlaskit/theme": "^18.0.0",
46
47
  "@atlaskit/tokens": "^4.8.0",
47
48
  "@atlaskit/tooltip": "^20.0.0",
@@ -107,7 +108,7 @@
107
108
  }
108
109
  },
109
110
  "name": "@atlaskit/teams-public",
110
- "version": "0.28.0",
111
+ "version": "0.29.0",
111
112
  "description": "Public components related to teams",
112
113
  "author": "Atlassian Pty Ltd",
113
114
  "license": "Apache-2.0",