@atlaskit/teams-public 0.35.0 → 0.36.1
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 +17 -0
- package/dist/cjs/common/ui/container-icon/index.compiled.css +16 -0
- package/dist/cjs/common/ui/container-icon/index.js +46 -0
- package/dist/cjs/common/utils/get-container-properties.js +17 -9
- package/dist/cjs/common/utils/team-web-link-converters.js +9 -3
- package/dist/cjs/controllers/hooks/use-team-links-and-containers/index.js +3 -2
- package/dist/cjs/controllers/hooks/use-team-web-links/index.js +148 -43
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/ui/team-containers/add-container-card/index.js +5 -1
- package/dist/cjs/ui/team-containers/linked-container-card/index.js +7 -14
- package/dist/cjs/ui/team-containers/team-link-card/index.compiled.css +0 -4
- package/dist/cjs/ui/team-containers/team-link-card/index.js +9 -28
- package/dist/es2019/common/ui/container-icon/index.compiled.css +16 -0
- package/dist/es2019/common/ui/container-icon/index.js +39 -0
- package/dist/es2019/common/utils/get-container-properties.js +17 -9
- package/dist/es2019/common/utils/team-web-link-converters.js +7 -4
- package/dist/es2019/controllers/hooks/use-team-links-and-containers/index.js +2 -1
- package/dist/es2019/controllers/hooks/use-team-web-links/index.js +79 -15
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/ui/team-containers/add-container-card/index.js +5 -1
- package/dist/es2019/ui/team-containers/linked-container-card/index.js +5 -12
- package/dist/es2019/ui/team-containers/team-link-card/index.compiled.css +0 -4
- package/dist/es2019/ui/team-containers/team-link-card/index.js +7 -26
- package/dist/esm/common/ui/container-icon/index.compiled.css +16 -0
- package/dist/esm/common/ui/container-icon/index.js +39 -0
- package/dist/esm/common/utils/get-container-properties.js +17 -9
- package/dist/esm/common/utils/team-web-link-converters.js +9 -3
- package/dist/esm/controllers/hooks/use-team-links-and-containers/index.js +3 -2
- package/dist/esm/controllers/hooks/use-team-web-links/index.js +148 -43
- package/dist/esm/index.js +1 -0
- package/dist/esm/ui/team-containers/add-container-card/index.js +5 -1
- package/dist/esm/ui/team-containers/linked-container-card/index.js +5 -12
- package/dist/esm/ui/team-containers/team-link-card/index.compiled.css +0 -4
- package/dist/esm/ui/team-containers/team-link-card/index.js +7 -26
- package/dist/types/common/ui/container-icon/index.d.ts +10 -0
- package/dist/types/common/utils/get-container-properties.d.ts +2 -1
- package/dist/types/common/utils/team-web-link-converters.d.ts +7 -2
- package/dist/types/controllers/hooks/use-team-web-links/index.d.ts +12 -9
- package/dist/types/controllers/hooks/use-team-web-links/types.d.ts +8 -2
- package/dist/types/index.d.ts +3 -1
- package/dist/types-ts4.5/common/ui/container-icon/index.d.ts +10 -0
- package/dist/types-ts4.5/common/utils/get-container-properties.d.ts +2 -1
- package/dist/types-ts4.5/common/utils/team-web-link-converters.d.ts +7 -2
- package/dist/types-ts4.5/controllers/hooks/use-team-web-links/index.d.ts +12 -9
- package/dist/types-ts4.5/controllers/hooks/use-team-web-links/types.d.ts +8 -2
- package/dist/types-ts4.5/index.d.ts +3 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/teams-public
|
|
2
2
|
|
|
3
|
+
## 0.36.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#167764](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/167764)
|
|
8
|
+
[`92745994b66b4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/92745994b66b4) -
|
|
9
|
+
[ux] NO-ISSUE Update team container icons to medium size and make team links open in a new tab
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 0.36.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#165970](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165970)
|
|
17
|
+
[`2f04674b589a3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2f04674b589a3) -
|
|
18
|
+
[ux] PTC-11538 Render team web link card in team profile card && fetch team web link icons
|
|
19
|
+
|
|
3
20
|
## 0.35.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko1hkb{border-radius:var(--ds-border-radius-050,4px)}
|
|
3
|
+
._2rkoop52{border-radius:var(--ds-border-radius-100,8px)}._12jimuej{outline-color:var(--ds-border,#091e4224)}
|
|
4
|
+
._18u0v77o{margin-left:var(--ds-space-025,2px)}
|
|
5
|
+
._19pkv77o{margin-top:var(--ds-space-025,2px)}
|
|
6
|
+
._1bah1h6o{justify-content:center}
|
|
7
|
+
._1bsb1tcg{width:24px}
|
|
8
|
+
._1bsb1u1b{width:34px}
|
|
9
|
+
._1e0c1txw{display:flex}
|
|
10
|
+
._1qu2nqa1{outline-style:solid}
|
|
11
|
+
._2hwxv77o{margin-right:var(--ds-space-025,2px)}
|
|
12
|
+
._4cvr1h6o{align-items:center}
|
|
13
|
+
._4t3i1tcg{height:24px}
|
|
14
|
+
._4t3i1u1b{height:34px}
|
|
15
|
+
._bfhkqbzx{background-color:var(--ds-surface-sunken,#f7f8f9)}
|
|
16
|
+
._otyrv77o{margin-bottom:var(--ds-space-025,2px)}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ContainerIcon = void 0;
|
|
9
|
+
require("./index.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
|
|
13
|
+
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
14
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
15
|
+
var _loomAvatar = require("../loom-avatar");
|
|
16
|
+
var styles = {
|
|
17
|
+
linkIconWrapperMedium: "_2rkoop52 _1bsb1u1b _4t3i1u1b _1e0c1txw _4cvr1h6o _1bah1h6o _12jimuej _1qu2nqa1 _bfhkqbzx",
|
|
18
|
+
linkIconWrapperSmall: "_2rko1hkb _1bsb1tcg _4t3i1tcg _1e0c1txw _4cvr1h6o _1bah1h6o _19pkv77o _2hwxv77o _otyrv77o _18u0v77o _12jimuej _1qu2nqa1 _bfhkqbzx"
|
|
19
|
+
};
|
|
20
|
+
var ContainerIcon = exports.ContainerIcon = function ContainerIcon(_ref) {
|
|
21
|
+
var containerType = _ref.containerType,
|
|
22
|
+
title = _ref.title,
|
|
23
|
+
containerIcon = _ref.containerIcon,
|
|
24
|
+
_ref$size = _ref.size,
|
|
25
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size;
|
|
26
|
+
if (containerType === 'LoomSpace') {
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_loomAvatar.LoomSpaceAvatar, {
|
|
28
|
+
spaceName: title,
|
|
29
|
+
size: size === 'medium' ? 'large' : size
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (containerType === 'WebLink' && !containerIcon) {
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
34
|
+
xcss: size === 'medium' ? styles.linkIconWrapperMedium : styles.linkIconWrapperSmall
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
36
|
+
label: "",
|
|
37
|
+
testId: "linked-container-WebLink-icon"
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_avatar.default, {
|
|
41
|
+
appearance: "square",
|
|
42
|
+
size: size,
|
|
43
|
+
src: containerIcon,
|
|
44
|
+
testId: "linked-container-".concat(containerType, "-icon")
|
|
45
|
+
});
|
|
46
|
+
};
|
|
@@ -12,6 +12,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
var _reactIntlNext = require("react-intl-next");
|
|
14
14
|
var _globe = _interopRequireDefault(require("@atlaskit/icon/core/globe"));
|
|
15
|
+
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
15
16
|
var _image = _interopRequireDefault(require("@atlaskit/image"));
|
|
16
17
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
18
|
var _ConfluenceIcon = _interopRequireDefault(require("../assets/ConfluenceIcon.svg"));
|
|
@@ -128,14 +129,19 @@ var getJiraContainerProperties = function getJiraContainerProperties(_ref) {
|
|
|
128
129
|
return baseProperties;
|
|
129
130
|
}
|
|
130
131
|
};
|
|
131
|
-
var
|
|
132
|
-
var isEmptyContainer = _ref3.isEmptyContainer
|
|
132
|
+
var getWebLinkContainerProperties = function getWebLinkContainerProperties(_ref3) {
|
|
133
|
+
var isEmptyContainer = _ref3.isEmptyContainer,
|
|
134
|
+
isDisplayedOnProfileCard = _ref3.isDisplayedOnProfileCard;
|
|
133
135
|
return {
|
|
134
136
|
description: isEmptyContainer ? /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
135
137
|
size: "medium",
|
|
136
138
|
weight: "medium"
|
|
137
139
|
}, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, messages.emptyWebLinkContainerDescription)) : /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, messages.webLinkContainerDescription),
|
|
138
|
-
icon: isEmptyContainer ? null : /*#__PURE__*/_react.default.createElement(
|
|
140
|
+
icon: isEmptyContainer ? null : isDisplayedOnProfileCard ? /*#__PURE__*/_react.default.createElement(_linkExternal.default, {
|
|
141
|
+
label: "",
|
|
142
|
+
size: "small",
|
|
143
|
+
testId: "team-link-card-external-link-icon"
|
|
144
|
+
}) : /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
139
145
|
xcss: styles.globeIconWrapper,
|
|
140
146
|
testId: "team-link-card-globe-icon"
|
|
141
147
|
}, /*#__PURE__*/_react.default.createElement(_globe.default, {
|
|
@@ -151,7 +157,8 @@ var getContainerProperties = exports.getContainerProperties = function getContai
|
|
|
151
157
|
_ref4$iconSize = _ref4.iconSize,
|
|
152
158
|
iconSize = _ref4$iconSize === void 0 ? 'small' : _ref4$iconSize,
|
|
153
159
|
containerTypeProperties = _ref4.containerTypeProperties,
|
|
154
|
-
isEmptyContainer = _ref4.isEmptyContainer
|
|
160
|
+
isEmptyContainer = _ref4.isEmptyContainer,
|
|
161
|
+
isDisplayedOnProfileCard = _ref4.isDisplayedOnProfileCard;
|
|
155
162
|
switch (containerType) {
|
|
156
163
|
case 'ConfluenceSpace':
|
|
157
164
|
return {
|
|
@@ -163,7 +170,7 @@ var getContainerProperties = exports.getContainerProperties = function getContai
|
|
|
163
170
|
alt: "",
|
|
164
171
|
testId: "confluence-space-container-icon"
|
|
165
172
|
})),
|
|
166
|
-
title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, messages.
|
|
173
|
+
title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, messages.addConfluenceContainerTitle),
|
|
167
174
|
containerTypeText: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, messages.spaceContainerText)
|
|
168
175
|
};
|
|
169
176
|
case 'LoomSpace':
|
|
@@ -174,9 +181,9 @@ var getContainerProperties = exports.getContainerProperties = function getContai
|
|
|
174
181
|
}, /*#__PURE__*/_react.default.createElement(_image.default, {
|
|
175
182
|
src: _LoomIcon.default,
|
|
176
183
|
alt: "",
|
|
177
|
-
testId: "
|
|
184
|
+
testId: "loom-space-container-icon"
|
|
178
185
|
})),
|
|
179
|
-
title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, messages.
|
|
186
|
+
title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, messages.addLoomContainerTitle),
|
|
180
187
|
containerTypeText: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, messages.spaceContainerText)
|
|
181
188
|
};
|
|
182
189
|
case 'JiraProject':
|
|
@@ -185,8 +192,9 @@ var getContainerProperties = exports.getContainerProperties = function getContai
|
|
|
185
192
|
iconSize: iconSize
|
|
186
193
|
});
|
|
187
194
|
case 'WebLink':
|
|
188
|
-
return
|
|
189
|
-
isEmptyContainer: isEmptyContainer
|
|
195
|
+
return getWebLinkContainerProperties({
|
|
196
|
+
isEmptyContainer: isEmptyContainer,
|
|
197
|
+
isDisplayedOnProfileCard: isDisplayedOnProfileCard
|
|
190
198
|
});
|
|
191
199
|
default:
|
|
192
200
|
return {
|
|
@@ -11,17 +11,23 @@ var containerToNewWebLink = exports.containerToNewWebLink = function containerTo
|
|
|
11
11
|
linkUri: container.link || ''
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
var webLinkToContainer = exports.webLinkToContainer = function webLinkToContainer(link) {
|
|
14
|
+
var webLinkToContainer = exports.webLinkToContainer = function webLinkToContainer(link, iconData) {
|
|
15
15
|
return {
|
|
16
16
|
id: link.linkId,
|
|
17
17
|
type: 'WebLink',
|
|
18
18
|
name: link.contentTitle,
|
|
19
|
-
icon: null,
|
|
19
|
+
icon: (iconData === null || iconData === void 0 ? void 0 : iconData.iconUrl) || null,
|
|
20
20
|
link: link.linkUri
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
var webLinksToContainers = exports.webLinksToContainers = function webLinksToContainers(links) {
|
|
24
|
-
|
|
24
|
+
var linkIcons = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
25
|
+
return links.map(function (link) {
|
|
26
|
+
var iconData = linkIcons.find(function (icon) {
|
|
27
|
+
return icon.linkUrl === link.linkUri;
|
|
28
|
+
});
|
|
29
|
+
return webLinkToContainer(link, iconData);
|
|
30
|
+
});
|
|
25
31
|
};
|
|
26
32
|
var isNewTeamWebLink = exports.isNewTeamWebLink = function isNewTeamWebLink(input) {
|
|
27
33
|
return 'contentTitle' in input && 'linkUri' in input && !('type' in input) && !('id' in input);
|
|
@@ -30,6 +30,7 @@ var useTeamLinksAndContainers = exports.useTeamLinksAndContainers = function use
|
|
|
30
30
|
_useTeamWebLinks2 = (0, _slicedToArray2.default)(_useTeamWebLinks, 2),
|
|
31
31
|
_useTeamWebLinks2$ = _useTeamWebLinks2[0],
|
|
32
32
|
links = _useTeamWebLinks2$.links,
|
|
33
|
+
linkIcons = _useTeamWebLinks2$.linkIcons,
|
|
33
34
|
webLinksLoading = _useTeamWebLinks2$.isLoading,
|
|
34
35
|
webLinksError = _useTeamWebLinks2$.hasError,
|
|
35
36
|
webLinksHasLoaded = _useTeamWebLinks2$.hasLoaded,
|
|
@@ -42,8 +43,8 @@ var useTeamLinksAndContainers = exports.useTeamLinksAndContainers = function use
|
|
|
42
43
|
getTeamWebLinks(teamId);
|
|
43
44
|
}, [getTeamWebLinks, teamId]);
|
|
44
45
|
var webLinkContainers = (0, _react.useMemo)(function () {
|
|
45
|
-
return (0, _teamWebLinkConverters.webLinksToContainers)(links);
|
|
46
|
-
}, [links]);
|
|
46
|
+
return (0, _teamWebLinkConverters.webLinksToContainers)(links, linkIcons);
|
|
47
|
+
}, [links, linkIcons]);
|
|
47
48
|
var allContainers = (0, _react.useMemo)(function () {
|
|
48
49
|
return [].concat((0, _toConsumableArray2.default)(teamContainers), (0, _toConsumableArray2.default)(webLinkContainers));
|
|
49
50
|
}, [teamContainers, webLinkContainers]);
|
|
@@ -20,17 +20,20 @@ var _initialState = {
|
|
|
20
20
|
hasError: false,
|
|
21
21
|
shouldReload: false,
|
|
22
22
|
errorType: null,
|
|
23
|
-
links: []
|
|
23
|
+
links: [],
|
|
24
|
+
linkIcons: [],
|
|
25
|
+
iconsLoading: false,
|
|
26
|
+
iconsError: false
|
|
24
27
|
};
|
|
25
28
|
var actions = exports.actions = {
|
|
26
29
|
getTeamWebLinks: function getTeamWebLinks(teamId) {
|
|
27
30
|
return /*#__PURE__*/function () {
|
|
28
31
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
29
|
-
var getState, setState, _getState, links, currentTeamId, initialLinks, _yield$teamsClient$ge, entities;
|
|
32
|
+
var getState, setState, dispatch, _getState, links, currentTeamId, initialLinks, _yield$teamsClient$ge, entities;
|
|
30
33
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
31
34
|
while (1) switch (_context.prev = _context.next) {
|
|
32
35
|
case 0:
|
|
33
|
-
getState = _ref.getState, setState = _ref.setState;
|
|
36
|
+
getState = _ref.getState, setState = _ref.setState, dispatch = _ref.dispatch;
|
|
34
37
|
_getState = getState(), links = _getState.links, currentTeamId = _getState.teamId;
|
|
35
38
|
initialLinks = teamId === currentTeamId ? links : [];
|
|
36
39
|
setState({
|
|
@@ -60,17 +63,20 @@ var actions = exports.actions = {
|
|
|
60
63
|
shouldReload: false,
|
|
61
64
|
links: entities
|
|
62
65
|
});
|
|
63
|
-
|
|
66
|
+
if (entities.length > 0) {
|
|
67
|
+
dispatch(actions.getTeamWebLinkIcons(teamId));
|
|
68
|
+
}
|
|
69
|
+
_context.next = 20;
|
|
64
70
|
break;
|
|
65
|
-
case
|
|
66
|
-
_context.prev =
|
|
71
|
+
case 15:
|
|
72
|
+
_context.prev = 15;
|
|
67
73
|
_context.t0 = _context["catch"](4);
|
|
68
74
|
if (!(getState().teamId !== teamId)) {
|
|
69
|
-
_context.next =
|
|
75
|
+
_context.next = 19;
|
|
70
76
|
break;
|
|
71
77
|
}
|
|
72
78
|
return _context.abrupt("return");
|
|
73
|
-
case
|
|
79
|
+
case 19:
|
|
74
80
|
setState({
|
|
75
81
|
isLoading: false,
|
|
76
82
|
hasLoaded: true,
|
|
@@ -79,69 +85,115 @@ var actions = exports.actions = {
|
|
|
79
85
|
shouldReload: false,
|
|
80
86
|
links: []
|
|
81
87
|
});
|
|
82
|
-
case
|
|
88
|
+
case 20:
|
|
83
89
|
case "end":
|
|
84
90
|
return _context.stop();
|
|
85
91
|
}
|
|
86
|
-
}, _callee, null, [[4,
|
|
92
|
+
}, _callee, null, [[4, 15]]);
|
|
87
93
|
}));
|
|
88
94
|
return function (_x) {
|
|
89
95
|
return _ref2.apply(this, arguments);
|
|
90
96
|
};
|
|
91
97
|
}();
|
|
92
98
|
},
|
|
93
|
-
|
|
99
|
+
getTeamWebLinkIcons: function getTeamWebLinkIcons(teamId) {
|
|
94
100
|
return /*#__PURE__*/function () {
|
|
95
101
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref3) {
|
|
96
|
-
var getState, setState,
|
|
102
|
+
var getState, setState, _getState2, links, currentIcons, linkUrls, uncachedUrls, newIconData;
|
|
97
103
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
98
104
|
while (1) switch (_context2.prev = _context2.next) {
|
|
99
105
|
case 0:
|
|
100
106
|
getState = _ref3.getState, setState = _ref3.setState;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
_getState2 = getState(), links = _getState2.links, currentIcons = _getState2.linkIcons;
|
|
108
|
+
if (!(links.length === 0)) {
|
|
109
|
+
_context2.next = 4;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return _context2.abrupt("return");
|
|
113
|
+
case 4:
|
|
114
|
+
linkUrls = links.map(function (link) {
|
|
115
|
+
return link.linkUri;
|
|
116
|
+
});
|
|
117
|
+
uncachedUrls = linkUrls.filter(function (url) {
|
|
118
|
+
return !currentIcons.some(function (icon) {
|
|
119
|
+
return icon.linkUrl === url;
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
if (!(uncachedUrls.length > 0)) {
|
|
123
|
+
_context2.next = 20;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
_context2.prev = 7;
|
|
127
|
+
setState({
|
|
128
|
+
iconsLoading: true,
|
|
129
|
+
iconsError: false
|
|
130
|
+
});
|
|
131
|
+
_context2.next = 11;
|
|
132
|
+
return _teamsClient.teamsClient.getTeamLinkIcons(uncachedUrls);
|
|
133
|
+
case 11:
|
|
134
|
+
newIconData = _context2.sent;
|
|
135
|
+
if (getState().teamId === teamId) {
|
|
107
136
|
setState({
|
|
108
|
-
|
|
137
|
+
linkIcons: [].concat((0, _toConsumableArray2.default)(currentIcons), (0, _toConsumableArray2.default)(newIconData || [])),
|
|
138
|
+
iconsLoading: false,
|
|
139
|
+
iconsError: false
|
|
109
140
|
});
|
|
110
141
|
}
|
|
111
|
-
|
|
112
|
-
|
|
142
|
+
_context2.next = 18;
|
|
143
|
+
break;
|
|
144
|
+
case 15:
|
|
145
|
+
_context2.prev = 15;
|
|
146
|
+
_context2.t0 = _context2["catch"](7);
|
|
147
|
+
if (getState().teamId === teamId) {
|
|
148
|
+
setState({
|
|
149
|
+
iconsLoading: false,
|
|
150
|
+
iconsError: true
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
case 18:
|
|
154
|
+
_context2.next = 21;
|
|
155
|
+
break;
|
|
156
|
+
case 20:
|
|
157
|
+
setState({
|
|
158
|
+
iconsLoading: false,
|
|
159
|
+
iconsError: false
|
|
160
|
+
});
|
|
161
|
+
case 21:
|
|
113
162
|
case "end":
|
|
114
163
|
return _context2.stop();
|
|
115
164
|
}
|
|
116
|
-
}, _callee2);
|
|
165
|
+
}, _callee2, null, [[7, 15]]);
|
|
117
166
|
}));
|
|
118
167
|
return function (_x2) {
|
|
119
168
|
return _ref4.apply(this, arguments);
|
|
120
169
|
};
|
|
121
170
|
}();
|
|
122
171
|
},
|
|
123
|
-
|
|
172
|
+
createTeamWebLink: function createTeamWebLink(teamId, newLink) {
|
|
124
173
|
return /*#__PURE__*/function () {
|
|
125
174
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref5) {
|
|
126
|
-
var getState, setState, result, currentState;
|
|
175
|
+
var getState, setState, dispatch, result, currentState;
|
|
127
176
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
128
177
|
while (1) switch (_context3.prev = _context3.next) {
|
|
129
178
|
case 0:
|
|
130
|
-
getState = _ref5.getState, setState = _ref5.setState;
|
|
179
|
+
getState = _ref5.getState, setState = _ref5.setState, dispatch = _ref5.dispatch;
|
|
131
180
|
_context3.next = 3;
|
|
132
|
-
return _teamsClient.teamsClient.
|
|
181
|
+
return _teamsClient.teamsClient.createTeamLink(teamId, newLink);
|
|
133
182
|
case 3:
|
|
134
183
|
result = _context3.sent;
|
|
135
184
|
currentState = getState();
|
|
136
|
-
if (currentState.teamId
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return link.linkId === linkId ? result : link;
|
|
140
|
-
})
|
|
141
|
-
});
|
|
185
|
+
if (!(currentState.teamId !== teamId)) {
|
|
186
|
+
_context3.next = 7;
|
|
187
|
+
break;
|
|
142
188
|
}
|
|
143
189
|
return _context3.abrupt("return", result);
|
|
144
190
|
case 7:
|
|
191
|
+
setState({
|
|
192
|
+
links: [].concat((0, _toConsumableArray2.default)(currentState.links), [result])
|
|
193
|
+
});
|
|
194
|
+
dispatch(actions.getTeamWebLinkIcons(teamId));
|
|
195
|
+
return _context3.abrupt("return", result);
|
|
196
|
+
case 10:
|
|
145
197
|
case "end":
|
|
146
198
|
return _context3.stop();
|
|
147
199
|
}
|
|
@@ -152,26 +204,45 @@ var actions = exports.actions = {
|
|
|
152
204
|
};
|
|
153
205
|
}();
|
|
154
206
|
},
|
|
155
|
-
|
|
207
|
+
updateTeamWebLink: function updateTeamWebLink(teamId, linkId, newLink) {
|
|
156
208
|
return /*#__PURE__*/function () {
|
|
157
209
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(_ref7) {
|
|
158
|
-
var getState, setState, currentState;
|
|
210
|
+
var getState, setState, dispatch, result, currentState, oldLink, urlChanged, updatedIcons;
|
|
159
211
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
160
212
|
while (1) switch (_context4.prev = _context4.next) {
|
|
161
213
|
case 0:
|
|
162
|
-
getState = _ref7.getState, setState = _ref7.setState;
|
|
214
|
+
getState = _ref7.getState, setState = _ref7.setState, dispatch = _ref7.dispatch;
|
|
163
215
|
_context4.next = 3;
|
|
164
|
-
return _teamsClient.teamsClient.
|
|
216
|
+
return _teamsClient.teamsClient.updateTeamLink(teamId, linkId, newLink);
|
|
165
217
|
case 3:
|
|
218
|
+
result = _context4.sent;
|
|
166
219
|
currentState = getState();
|
|
167
|
-
if (currentState.teamId
|
|
220
|
+
if (!(currentState.teamId !== teamId)) {
|
|
221
|
+
_context4.next = 7;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
return _context4.abrupt("return", result);
|
|
225
|
+
case 7:
|
|
226
|
+
oldLink = currentState.links.find(function (link) {
|
|
227
|
+
return link.linkId === linkId;
|
|
228
|
+
});
|
|
229
|
+
urlChanged = oldLink && oldLink.linkUri !== result.linkUri;
|
|
230
|
+
setState({
|
|
231
|
+
links: currentState.links.map(function (link) {
|
|
232
|
+
return link.linkId === linkId ? result : link;
|
|
233
|
+
})
|
|
234
|
+
});
|
|
235
|
+
if (urlChanged) {
|
|
236
|
+
updatedIcons = currentState.linkIcons.filter(function (icon) {
|
|
237
|
+
return icon.linkUrl !== oldLink.linkUri;
|
|
238
|
+
});
|
|
168
239
|
setState({
|
|
169
|
-
|
|
170
|
-
return link.linkId !== linkId;
|
|
171
|
-
})
|
|
240
|
+
linkIcons: updatedIcons
|
|
172
241
|
});
|
|
242
|
+
dispatch(actions.getTeamWebLinkIcons(teamId));
|
|
173
243
|
}
|
|
174
|
-
|
|
244
|
+
return _context4.abrupt("return", result);
|
|
245
|
+
case 12:
|
|
175
246
|
case "end":
|
|
176
247
|
return _context4.stop();
|
|
177
248
|
}
|
|
@@ -182,9 +253,43 @@ var actions = exports.actions = {
|
|
|
182
253
|
};
|
|
183
254
|
}();
|
|
184
255
|
},
|
|
256
|
+
removeWebLink: function removeWebLink(teamId, linkId) {
|
|
257
|
+
return /*#__PURE__*/function () {
|
|
258
|
+
var _ref0 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(_ref9) {
|
|
259
|
+
var getState, setState, currentState;
|
|
260
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
261
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
262
|
+
case 0:
|
|
263
|
+
getState = _ref9.getState, setState = _ref9.setState;
|
|
264
|
+
currentState = getState();
|
|
265
|
+
if (!(currentState.teamId !== teamId)) {
|
|
266
|
+
_context5.next = 4;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
return _context5.abrupt("return");
|
|
270
|
+
case 4:
|
|
271
|
+
_context5.next = 6;
|
|
272
|
+
return _teamsClient.teamsClient.deleteTeamLink(teamId, linkId);
|
|
273
|
+
case 6:
|
|
274
|
+
setState({
|
|
275
|
+
links: currentState.links.filter(function (link) {
|
|
276
|
+
return link.linkId !== linkId;
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
case 7:
|
|
280
|
+
case "end":
|
|
281
|
+
return _context5.stop();
|
|
282
|
+
}
|
|
283
|
+
}, _callee5);
|
|
284
|
+
}));
|
|
285
|
+
return function (_x5) {
|
|
286
|
+
return _ref0.apply(this, arguments);
|
|
287
|
+
};
|
|
288
|
+
}();
|
|
289
|
+
},
|
|
185
290
|
initialState: function initialState(state) {
|
|
186
|
-
return function (
|
|
187
|
-
var setState =
|
|
291
|
+
return function (_ref1) {
|
|
292
|
+
var setState = _ref1.setState;
|
|
188
293
|
setState(_objectSpread(_objectSpread({}, _initialState), state));
|
|
189
294
|
};
|
|
190
295
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "ConfluenceIcon", {
|
|
|
9
9
|
return _assets.ConfluenceIcon;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "ContainerIcon", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _containerIcon.ContainerIcon;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(exports, "JiraIcon", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function get() {
|
|
@@ -76,6 +82,7 @@ Object.defineProperty(exports, "useTeamWebLinksActions", {
|
|
|
76
82
|
}
|
|
77
83
|
});
|
|
78
84
|
var _teamContainers = require("./ui/team-containers");
|
|
85
|
+
var _containerIcon = require("./common/ui/container-icon");
|
|
79
86
|
var _useTeamContainers = require("./controllers/hooks/use-team-containers");
|
|
80
87
|
var _useTeamWebLinks = require("./controllers/hooks/use-team-web-links");
|
|
81
88
|
var _useTeamLinksAndContainers = require("./controllers/hooks/use-team-links-and-containers");
|
|
@@ -14,6 +14,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _new = require("@atlaskit/button/new");
|
|
16
16
|
var _add = _interopRequireDefault(require("@atlaskit/icon/core/add"));
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
18
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
18
19
|
var _getContainerProperties = require("../../../common/utils/get-container-properties");
|
|
19
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -48,6 +49,7 @@ var AddContainerCard = exports.AddContainerCard = function AddContainerCard(_ref
|
|
|
48
49
|
onAddAContainerClick = _ref2.onAddAContainerClick;
|
|
49
50
|
var _getContainerProperti = (0, _getContainerProperties.getContainerProperties)({
|
|
50
51
|
containerType: containerType,
|
|
52
|
+
iconSize: (0, _platformFeatureFlags.fg)('enable_medium_size_icons_for_team_link_cards') ? 'medium' : undefined,
|
|
51
53
|
isEmptyContainer: true
|
|
52
54
|
}),
|
|
53
55
|
description = _getContainerProperti.description,
|
|
@@ -73,7 +75,9 @@ var AddContainerCard = exports.AddContainerCard = function AddContainerCard(_ref
|
|
|
73
75
|
onAddAContainerClick(e);
|
|
74
76
|
e.stopPropagation();
|
|
75
77
|
}
|
|
76
|
-
})), /*#__PURE__*/_react.default.createElement(_compiled.Stack,
|
|
78
|
+
})), /*#__PURE__*/_react.default.createElement(_compiled.Stack, (0, _platformFeatureFlags.fg)('enable_medium_size_icons_for_team_link_cards') ? {
|
|
79
|
+
space: "space.025"
|
|
80
|
+
} : {}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
77
81
|
maxLines: 1,
|
|
78
82
|
weight: "medium",
|
|
79
83
|
color: "color.text"
|
|
@@ -16,10 +16,9 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
16
16
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
17
17
|
var _avatar = _interopRequireDefault(require("@atlaskit/avatar"));
|
|
18
18
|
var _new = require("@atlaskit/button/new");
|
|
19
|
-
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
20
19
|
var _close = _interopRequireDefault(require("@atlaskit/icon/core/close"));
|
|
21
|
-
var _link = _interopRequireDefault(require("@atlaskit/
|
|
22
|
-
var
|
|
20
|
+
var _link = _interopRequireDefault(require("@atlaskit/link"));
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
22
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
24
23
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
25
24
|
var _loomAvatar = require("../../../common/ui/loom-avatar");
|
|
@@ -40,7 +39,6 @@ var styles = {
|
|
|
40
39
|
crossIconWrapper: "_1e0c1txw _4cvr1h6o _1bahesu3 _18u01wug",
|
|
41
40
|
linkIconWrapper: "_2rkoop52 _1bsb1u1b _4t3i1u1b _1e0c1txw _4cvr1h6o _1bah1h6o _12jimuej _1qu2nqa1 _bfhkqbzx"
|
|
42
41
|
};
|
|
43
|
-
var isSupportingAddWebLink = _featureGateJsClient.default.initializeCompleted() && _featureGateJsClient.default.getExperimentValue('team_and_container_web_link', 'isEnabled', false);
|
|
44
42
|
var LinkedCardWrapper = function LinkedCardWrapper(_ref) {
|
|
45
43
|
var children = _ref.children,
|
|
46
44
|
href = _ref.href,
|
|
@@ -70,7 +68,7 @@ var LinkedCardWrapper = function LinkedCardWrapper(_ref) {
|
|
|
70
68
|
onMouseEnter: onMouseEnter,
|
|
71
69
|
onMouseLeave: onMouseLeave,
|
|
72
70
|
testId: "linked-container-card-inner"
|
|
73
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
74
72
|
href: href,
|
|
75
73
|
appearance: "subtle",
|
|
76
74
|
onClick: function onClick() {
|
|
@@ -95,13 +93,6 @@ var getContainerIcon = function getContainerIcon(containerType, title, container
|
|
|
95
93
|
size: 'large'
|
|
96
94
|
});
|
|
97
95
|
}
|
|
98
|
-
if (isSupportingAddWebLink && containerType === 'WebLink') {
|
|
99
|
-
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
100
|
-
xcss: styles.linkIconWrapper
|
|
101
|
-
}, /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
102
|
-
label: ""
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
96
|
return /*#__PURE__*/_react.default.createElement(_avatar.default, {
|
|
106
97
|
appearance: "square",
|
|
107
98
|
size: "medium",
|
|
@@ -121,7 +112,7 @@ var LinkedContainerCard = exports.LinkedContainerCard = function LinkedContainer
|
|
|
121
112
|
createAnalyticsEvent = _useAnalyticsEvents2.createAnalyticsEvent;
|
|
122
113
|
var _getContainerProperti = (0, _getContainerProperties.getContainerProperties)({
|
|
123
114
|
containerType: containerType,
|
|
124
|
-
iconSize: 'small',
|
|
115
|
+
iconSize: (0, _platformFeatureFlags.fg)('enable_medium_size_icons_for_team_link_cards') ? 'medium' : 'small',
|
|
125
116
|
containerTypeProperties: containerTypeProperties
|
|
126
117
|
}),
|
|
127
118
|
description = _getContainerProperti.description,
|
|
@@ -148,7 +139,9 @@ var LinkedContainerCard = exports.LinkedContainerCard = function LinkedContainer
|
|
|
148
139
|
}, /*#__PURE__*/_react.default.createElement(_compiled.Inline, {
|
|
149
140
|
space: "space.100",
|
|
150
141
|
xcss: styles.card
|
|
151
|
-
}, getContainerIcon(containerType, title, containerIcon), /*#__PURE__*/_react.default.createElement(_compiled.Stack,
|
|
142
|
+
}, getContainerIcon(containerType, title, containerIcon), /*#__PURE__*/_react.default.createElement(_compiled.Stack, (0, _platformFeatureFlags.fg)('enable_medium_size_icons_for_team_link_cards') ? {
|
|
143
|
+
space: "space.025"
|
|
144
|
+
} : {}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
152
145
|
maxLines: 1,
|
|
153
146
|
weight: "medium",
|
|
154
147
|
color: "color.text"
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
._16jlkb7n{flex-grow:1}
|
|
6
6
|
._18u01wug{margin-left:auto}
|
|
7
7
|
._19bvutpp{padding-left:var(--ds-space-150,9pt)}
|
|
8
|
-
._1bah1h6o{justify-content:center}
|
|
9
8
|
._1bahesu3{justify-content:flex-end}
|
|
10
9
|
._1bsb1osq{width:100%}
|
|
11
|
-
._1bsb1u1b{width:34px}
|
|
12
10
|
._1bsbzwfg{width:2pc}
|
|
13
11
|
._1e0c1txw{display:flex}
|
|
14
12
|
._1o9zkb7n{flex-shrink:1}
|
|
@@ -16,9 +14,7 @@
|
|
|
16
14
|
._1tkezwfg{min-height:2pc}
|
|
17
15
|
._1ul9zwfg{min-width:2pc}
|
|
18
16
|
._4cvr1h6o{align-items:center}
|
|
19
|
-
._4t3i1u1b{height:34px}
|
|
20
17
|
._4t3izwfg{height:2pc}
|
|
21
|
-
._bfhkqbzx{background-color:var(--ds-surface-sunken,#f7f8f9)}
|
|
22
18
|
._ca0qutpp{padding-top:var(--ds-space-150,9pt)}
|
|
23
19
|
._i0dlf1ug{flex-basis:0%}
|
|
24
20
|
._n3tdutpp{padding-bottom:var(--ds-space-150,9pt)}
|