@atlaskit/smart-card 26.23.2 → 26.25.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 +20 -0
- package/dist/cjs/constants.js +1 -0
- package/dist/cjs/extractors/block/index.js +1 -1
- package/dist/cjs/extractors/common/actions/extractActions.js +3 -31
- package/dist/cjs/extractors/flexible/actions/extract-follow-action.js +53 -0
- package/dist/cjs/extractors/flexible/index.js +3 -0
- package/dist/cjs/messages.js +10 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +7 -15
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +20 -14
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -45
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +2 -2
- package/dist/cjs/view/EmbedCard/components/styled.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/index.js +33 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +41 -15
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
- package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +33 -1
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +43 -0
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +40 -0
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +10 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +22 -1
- package/dist/cjs/view/FlexibleCard/components/utils.js +9 -20
- package/dist/cjs/view/FlexibleCard/index.js +14 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/cjs/view/HoverCard/styled.js +2 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +1 -1
- package/dist/cjs/view/RedesignedInlineCard/styled.js +1 -1
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/extractors/block/index.js +2 -2
- package/dist/es2019/extractors/common/actions/extractActions.js +2 -23
- package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +45 -0
- package/dist/es2019/extractors/flexible/index.js +3 -0
- package/dist/es2019/messages.js +10 -0
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -15
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +14 -8
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -42
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +10 -1
- package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/index.js +15 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +18 -7
- package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +15 -1
- package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +31 -0
- package/dist/es2019/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +28 -0
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +3 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +2 -17
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +19 -1
- package/dist/es2019/view/FlexibleCard/components/utils.js +3 -17
- package/dist/es2019/view/FlexibleCard/index.js +11 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/es2019/view/HoverCard/styled.js +3 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +1 -1
- package/dist/es2019/view/RedesignedInlineCard/styled.js +1 -1
- package/dist/esm/constants.js +1 -0
- package/dist/esm/extractors/block/index.js +2 -2
- package/dist/esm/extractors/common/actions/extractActions.js +2 -30
- package/dist/esm/extractors/flexible/actions/extract-follow-action.js +45 -0
- package/dist/esm/extractors/flexible/index.js +3 -0
- package/dist/esm/messages.js +10 -0
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +7 -15
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +20 -14
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -46
- package/dist/esm/view/BlockCard/views/flexible/styled.js +2 -2
- package/dist/esm/view/EmbedCard/components/styled.js +2 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/download-action/index.js +33 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +41 -15
- package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
- package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +33 -1
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +32 -0
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +32 -0
- package/dist/esm/view/FlexibleCard/components/actions/index.js +3 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +21 -1
- package/dist/esm/view/FlexibleCard/components/utils.js +9 -20
- package/dist/esm/view/FlexibleCard/index.js +14 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/esm/view/HoverCard/styled.js +2 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +1 -1
- package/dist/esm/view/RedesignedInlineCard/styled.js +1 -1
- package/dist/types/__fixtures__/atlas-project.d.ts +68 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +3 -1
- package/dist/types/extractors/common/actions/extractActions.d.ts +1 -1
- package/dist/types/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +4 -4
- package/dist/types/state/flexible-ui-context/index.d.ts +3 -119
- package/dist/types/state/flexible-ui-context/types.d.ts +17 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +3 -3
- package/dist/types/utils/analytics/types.d.ts +3 -3
- package/dist/types/utils/mocks.d.ts +3 -3
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
- package/dist/types/view/FlexibleCard/components/utils.d.ts +2 -63
- package/dist/types/view/FlexibleCard/types.d.ts +2 -3
- package/dist/types-ts4.5/__fixtures__/atlas-project.d.ts +68 -0
- package/dist/types-ts4.5/constants.d.ts +1 -0
- package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +3 -1
- package/dist/types-ts4.5/extractors/common/actions/extractActions.d.ts +1 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +4 -4
- package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +3 -119
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +17 -0
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +3 -3
- package/dist/types-ts4.5/utils/analytics/types.d.ts +3 -3
- package/dist/types-ts4.5/utils/mocks.d.ts +3 -3
- package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +2 -63
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -3
- package/package.json +2 -2
- package/report.api.md +9 -6
- package/tmp/api-report-tmp.d.ts +9 -7
|
@@ -5,11 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
var _index = _interopRequireDefault(require("../index"));
|
|
12
14
|
var _utils = require("../../../../../../utils");
|
|
15
|
+
var _constants = require("../../../../../../constants");
|
|
16
|
+
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
17
|
+
var _useInvokeClientAction = _interopRequireDefault(require("../../../../../../state/hooks/use-invoke-client-action"));
|
|
13
18
|
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
19
|
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
20
|
var ViewAction = function ViewAction(props) {
|
|
@@ -19,10 +24,37 @@ var ViewAction = function ViewAction(props) {
|
|
|
19
24
|
_onClick = props.onClick,
|
|
20
25
|
viewUrl = props.viewUrl,
|
|
21
26
|
url = props.url;
|
|
27
|
+
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)();
|
|
28
|
+
var invoke = (0, _useInvokeClientAction.default)({
|
|
29
|
+
analytics: analytics
|
|
30
|
+
});
|
|
22
31
|
if (viewUrl && url) {
|
|
23
32
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
24
33
|
onClick: function onClick() {
|
|
25
|
-
(
|
|
34
|
+
invoke({
|
|
35
|
+
actionType: _constants.ActionName.ViewAction,
|
|
36
|
+
actionFn: function () {
|
|
37
|
+
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
38
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
39
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
return _context.abrupt("return", (0, _utils.openUrl)(viewUrl));
|
|
42
|
+
case 1:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
function actionFn() {
|
|
49
|
+
return _actionFn.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
return actionFn;
|
|
52
|
+
}(),
|
|
53
|
+
// These values have already been set in analytics context.
|
|
54
|
+
// We only pass these here for ufo experience.
|
|
55
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
56
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
57
|
+
});
|
|
26
58
|
if (_onClick) {
|
|
27
59
|
_onClick();
|
|
28
60
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _inviteTeam = _interopRequireDefault(require("@atlaskit/icon/glyph/invite-team"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _reactIntlNext = require("react-intl-next");
|
|
14
|
+
var _messages = require("../../../../../messages");
|
|
15
|
+
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
16
|
+
var _serverAction = _interopRequireDefault(require("../action/server-action"));
|
|
17
|
+
var _unfollowIcon = _interopRequireDefault(require("./unfollow-icon"));
|
|
18
|
+
var _excluded = ["value"];
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
var FollowAction = function FollowAction(props) {
|
|
22
|
+
var context = (0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
|
|
23
|
+
if (!context || !context.followAction) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
var _context$followAction = context.followAction,
|
|
27
|
+
value = _context$followAction.value,
|
|
28
|
+
data = (0, _objectWithoutProperties2.default)(_context$followAction, _excluded);
|
|
29
|
+
var message = value ? _messages.messages.follow : _messages.messages.unfollow;
|
|
30
|
+
var icon = value ? /*#__PURE__*/_react.default.createElement(_inviteTeam.default, {
|
|
31
|
+
label: "Follow"
|
|
32
|
+
}) : /*#__PURE__*/_react.default.createElement(_unfollowIcon.default, {
|
|
33
|
+
label: "Unfollow"
|
|
34
|
+
});
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_serverAction.default, (0, _extends2.default)({
|
|
36
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, message),
|
|
37
|
+
icon: icon,
|
|
38
|
+
testId: "smart-action-follow-action",
|
|
39
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, message)
|
|
40
|
+
}, data, props));
|
|
41
|
+
};
|
|
42
|
+
var _default = FollowAction;
|
|
43
|
+
exports.default = _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _icon = _interopRequireDefault(require("@atlaskit/icon"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var UnfollowGlyph = function UnfollowGlyph(props) {
|
|
12
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
13
|
+
width: "16",
|
|
14
|
+
height: "16",
|
|
15
|
+
viewBox: "0 0 16 16",
|
|
16
|
+
"data-testid": props['data-testid'],
|
|
17
|
+
"aria-label": props['aria-label'],
|
|
18
|
+
className: props.className,
|
|
19
|
+
role: "presentation",
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
22
|
+
d: "M14 4.66667H11.3333C10.9652 4.66667 10.6667 4.96514 10.6667 5.33333C10.6667 5.70152 10.9652 6 11.3333 6H14C14.3682 6 14.6667 5.70152 14.6667 5.33333C14.6667 4.96514 14.3682 4.66667 14 4.66667Z",
|
|
23
|
+
fill: "currentColor"
|
|
24
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
25
|
+
fillRule: "evenodd",
|
|
26
|
+
clipRule: "evenodd",
|
|
27
|
+
d: "M3.33334 9.33333C3.33334 8.59667 3.93468 8 4.67268 8H9.99401C10.734 8 11.3333 8.596 11.3333 9.33733V12.2973C11.3333 14.5673 3.33334 14.5673 3.33334 12.2973V9.33333Z",
|
|
28
|
+
fill: "currentColor"
|
|
29
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
30
|
+
d: "M7.33334 7.33333C8.8061 7.33333 10 6.13943 10 4.66667C10 3.19391 8.8061 2 7.33334 2C5.86058 2 4.66668 3.19391 4.66668 4.66667C4.66668 6.13943 5.86058 7.33333 7.33334 7.33333Z",
|
|
31
|
+
fill: "currentColor"
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
var UnfollowIcon = function UnfollowIcon(props) {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({
|
|
36
|
+
glyph: UnfollowGlyph
|
|
37
|
+
}, props));
|
|
38
|
+
};
|
|
39
|
+
var _default = UnfollowIcon;
|
|
40
|
+
exports.default = _default;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.
|
|
7
|
+
exports.EditAction = exports.DownloadAction = exports.DeleteAction = exports.CustomAction = void 0;
|
|
8
|
+
Object.defineProperty(exports, "FollowAction", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _followAction.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
exports.ViewAction = exports.PreviewAction = void 0;
|
|
7
15
|
var _constants = require("../../../../constants");
|
|
8
16
|
var _utils = require("./utils");
|
|
17
|
+
var _followAction = _interopRequireDefault(require("./follow-action"));
|
|
9
18
|
// Attention: Keep the export name and action name the same.
|
|
10
19
|
// This will help reducing the code for mapping action inside
|
|
11
20
|
// createAction and renderActionItems
|
|
@@ -22,6 +22,7 @@ var _utils = require("../../utils");
|
|
|
22
22
|
var _messages = require("../../../../../messages");
|
|
23
23
|
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
24
24
|
var _actionGroupItem = _interopRequireDefault(require("./action-group-item"));
|
|
25
|
+
var _utils2 = require("../utils");
|
|
25
26
|
var _excluded = ["triggerRef"];
|
|
26
27
|
var _templateObject;
|
|
27
28
|
/** @jsx jsx */
|
|
@@ -43,24 +44,6 @@ var renderActionItems = function renderActionItems() {
|
|
|
43
44
|
});
|
|
44
45
|
});
|
|
45
46
|
};
|
|
46
|
-
var filterActionItems = function filterActionItems() {
|
|
47
|
-
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
48
|
-
var context = arguments.length > 1 ? arguments[1] : undefined;
|
|
49
|
-
return items.filter(function (item) {
|
|
50
|
-
switch (item.name) {
|
|
51
|
-
// Action that require data from the data context to render.
|
|
52
|
-
case _constants.ActionName.DownloadAction:
|
|
53
|
-
return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
|
|
54
|
-
case _constants.ActionName.PreviewAction:
|
|
55
|
-
return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
|
|
56
|
-
case _constants.ActionName.ViewAction:
|
|
57
|
-
return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
|
|
58
|
-
default:
|
|
59
|
-
// Named and custom actions that user defines.
|
|
60
|
-
return Boolean(_constants.ActionName[item.name]);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
47
|
|
|
65
48
|
/**
|
|
66
49
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
@@ -86,7 +69,7 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
86
69
|
isOpen = _useState2[0],
|
|
87
70
|
setIsOpen = _useState2[1];
|
|
88
71
|
var renderableActionItems = (0, _react.useMemo)(function () {
|
|
89
|
-
return filterActionItems(items, context);
|
|
72
|
+
return (0, _utils2.filterActionItems)(items, context);
|
|
90
73
|
}, [context, items]);
|
|
91
74
|
var isMoreThenTwoItems = renderableActionItems.length > visibleButtonsNum;
|
|
92
75
|
var onOpenChange = (0, _react.useCallback)(function (attrs) {
|
|
@@ -15,6 +15,8 @@ var _block = _interopRequireDefault(require("../block"));
|
|
|
15
15
|
var _elementGroup = _interopRequireDefault(require("../element-group"));
|
|
16
16
|
var _elements = require("../../elements");
|
|
17
17
|
var _actionGroup = _interopRequireDefault(require("../action-group"));
|
|
18
|
+
var _utils = require("../utils");
|
|
19
|
+
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
18
20
|
var _templateObject;
|
|
19
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -42,6 +44,11 @@ var FooterBlock = function FooterBlock(props) {
|
|
|
42
44
|
_props$testId = props.testId,
|
|
43
45
|
testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId,
|
|
44
46
|
onActionMenuOpenChange = props.onActionMenuOpenChange;
|
|
47
|
+
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
48
|
+
var hasActions = (0, _react.useMemo)(function () {
|
|
49
|
+
var _filterActionItems;
|
|
50
|
+
return ((_filterActionItems = (0, _utils.filterActionItems)(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
|
|
51
|
+
}, [actions, context]);
|
|
45
52
|
var onDropdownOpenChange = (0, _react.useCallback)(function (isOpen) {
|
|
46
53
|
if (onActionMenuOpenChange) {
|
|
47
54
|
onActionMenuOpenChange({
|
|
@@ -56,7 +63,7 @@ var FooterBlock = function FooterBlock(props) {
|
|
|
56
63
|
testId: "".concat(testId, "-resolved-view")
|
|
57
64
|
}), /*#__PURE__*/_react.default.createElement(_elements.Provider, {
|
|
58
65
|
testId: "".concat(testId, "-provider")
|
|
59
|
-
}), actions &&
|
|
66
|
+
}), actions && hasActions ? /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
|
|
60
67
|
testId: "smart-element-group-actions",
|
|
61
68
|
align: _constants.SmartLinkAlignment.Right,
|
|
62
69
|
direction: _constants.SmartLinkDirection.Horizontal,
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.renderElementItems = exports.renderChildren = exports.isJSXElementNull = exports.highlightRemoveStyles = exports.getGapSize = exports.getBaseStyles = exports.ElementDisplaySchema = void 0;
|
|
8
|
+
exports.renderElementItems = exports.renderChildren = exports.isJSXElementNull = exports.highlightRemoveStyles = exports.getGapSize = exports.getBaseStyles = exports.filterActionItems = exports.ElementDisplaySchema = void 0;
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -69,6 +69,27 @@ exports.isJSXElementNull = isJSXElementNull;
|
|
|
69
69
|
var isElementOrElementGroup = function isElementOrElementGroup(node) {
|
|
70
70
|
return /*#__PURE__*/_react.default.isValidElement(node) && ((0, _flexible.isFlexibleUiElement)(node) || node.type === _elementGroup.default);
|
|
71
71
|
};
|
|
72
|
+
var filterActionItems = function filterActionItems() {
|
|
73
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
74
|
+
var context = arguments.length > 1 ? arguments[1] : undefined;
|
|
75
|
+
return items.filter(function (item) {
|
|
76
|
+
switch (item.name) {
|
|
77
|
+
// Action that require data from the data context to render.
|
|
78
|
+
case _constants.ActionName.DownloadAction:
|
|
79
|
+
return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
|
|
80
|
+
case _constants.ActionName.FollowAction:
|
|
81
|
+
return Boolean(context === null || context === void 0 ? void 0 : context.followAction);
|
|
82
|
+
case _constants.ActionName.PreviewAction:
|
|
83
|
+
return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
|
|
84
|
+
case _constants.ActionName.ViewAction:
|
|
85
|
+
return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
|
|
86
|
+
default:
|
|
87
|
+
// Named and custom actions that user defines.
|
|
88
|
+
return Boolean(_constants.ActionName[item.name]);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
exports.filterActionItems = filterActionItems;
|
|
72
93
|
var renderChildren = function renderChildren(children, size) {
|
|
73
94
|
return _react.default.Children.map(children, function (child) {
|
|
74
95
|
if (isElementOrElementGroup(child) || isActionGroup(child)) {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.sizeToButtonSpacing = exports.openEmbedModalWithFlexibleUiIcon = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessageAsString = exports.getFormattedMessage = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
8
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -14,7 +15,10 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
14
15
|
var _constants = require("../../../constants");
|
|
15
16
|
var _icon = _interopRequireDefault(require("./elements/icon"));
|
|
16
17
|
var _utils = require("../../EmbedModal/utils");
|
|
18
|
+
var _excluded = ["linkIcon"];
|
|
17
19
|
var _sizeToButtonSpacing, _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
20
|
+
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; }
|
|
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; }
|
|
18
22
|
var sizeToButtonSpacing = (_sizeToButtonSpacing = {}, (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Small, 'none'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Medium, 'compact'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Large, 'compact'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.XLarge, 'default'), _sizeToButtonSpacing);
|
|
19
23
|
exports.sizeToButtonSpacing = sizeToButtonSpacing;
|
|
20
24
|
var getFormattedMessage = function getFormattedMessage(message) {
|
|
@@ -116,35 +120,20 @@ var hasWhiteSpace = function hasWhiteSpace(str) {
|
|
|
116
120
|
};
|
|
117
121
|
exports.hasWhiteSpace = hasWhiteSpace;
|
|
118
122
|
var openEmbedModalWithFlexibleUiIcon = function openEmbedModalWithFlexibleUiIcon(_ref) {
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
linkIcon = _ref.linkIcon,
|
|
122
|
-
onClose = _ref.onClose,
|
|
123
|
-
providerName = _ref.providerName,
|
|
124
|
-
src = _ref.src,
|
|
125
|
-
title = _ref.title,
|
|
126
|
-
url = _ref.url,
|
|
127
|
-
isSupportTheming = _ref.isSupportTheming;
|
|
123
|
+
var linkIcon = _ref.linkIcon,
|
|
124
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
128
125
|
var icon = {
|
|
129
126
|
icon: /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({}, linkIcon, {
|
|
130
127
|
size: _constants.SmartLinkSize.Large
|
|
131
128
|
})),
|
|
132
129
|
isFlexibleUi: true
|
|
133
130
|
};
|
|
134
|
-
return (0, _utils.openEmbedModal)({
|
|
135
|
-
analytics: analytics,
|
|
136
|
-
download: downloadUrl,
|
|
131
|
+
return (0, _utils.openEmbedModal)(_objectSpread(_objectSpread({}, props), {}, {
|
|
137
132
|
icon: icon,
|
|
138
133
|
// Flex should not send origin as block card. It should be able to support
|
|
139
134
|
// its internal parent components like hover card, block card and
|
|
140
135
|
// itself as a standalone. To be investigated and fix in EDM-7520.
|
|
141
|
-
origin: 'smartLinkCard'
|
|
142
|
-
|
|
143
|
-
onClose: onClose,
|
|
144
|
-
src: src,
|
|
145
|
-
title: title,
|
|
146
|
-
url: url,
|
|
147
|
-
isSupportTheming: isSupportTheming
|
|
148
|
-
});
|
|
136
|
+
origin: 'smartLinkCard'
|
|
137
|
+
}));
|
|
149
138
|
};
|
|
150
139
|
exports.openEmbedModalWithFlexibleUiIcon = openEmbedModalWithFlexibleUiIcon;
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _constants = require("../../constants");
|
|
12
13
|
var _container = _interopRequireDefault(require("./components/container"));
|
|
@@ -14,6 +15,8 @@ var _flexibleUiContext = require("../../state/flexible-ui-context");
|
|
|
14
15
|
var _utils = require("./utils");
|
|
15
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
17
20
|
/**
|
|
18
21
|
* This represents a Flexible Card: a link represented by a card with metadata.
|
|
19
22
|
* This is the container in which all Flexible UI Blocks and Elements exist.
|
|
@@ -21,7 +24,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
24
|
* @see Container
|
|
22
25
|
*/
|
|
23
26
|
var FlexibleCard = function FlexibleCard(_ref) {
|
|
27
|
+
var _details$meta2;
|
|
24
28
|
var analytics = _ref.analytics,
|
|
29
|
+
_ref$appearance = _ref.appearance,
|
|
30
|
+
appearance = _ref$appearance === void 0 ? 'flexible' : _ref$appearance,
|
|
25
31
|
cardState = _ref.cardState,
|
|
26
32
|
children = _ref.children,
|
|
27
33
|
id = _ref.id,
|
|
@@ -52,6 +58,13 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
52
58
|
var retry = (0, _utils.getRetryOptions)(url, status, details, onAuthorize);
|
|
53
59
|
var _ref2 = context || {},
|
|
54
60
|
title = _ref2.title;
|
|
61
|
+
var analyticsContext = (0, _react.useMemo)(function () {
|
|
62
|
+
var _details$meta;
|
|
63
|
+
return analytics ? _objectSpread(_objectSpread({}, analytics), {}, {
|
|
64
|
+
display: appearance,
|
|
65
|
+
extensionKey: details === null || details === void 0 ? void 0 : (_details$meta = details.meta) === null || _details$meta === void 0 ? void 0 : _details$meta.key
|
|
66
|
+
}) : undefined;
|
|
67
|
+
}, [analytics, appearance, details === null || details === void 0 ? void 0 : (_details$meta2 = details.meta) === null || _details$meta2 === void 0 ? void 0 : _details$meta2.key]);
|
|
55
68
|
(0, _react.useEffect)(function () {
|
|
56
69
|
switch (status) {
|
|
57
70
|
case _constants.SmartLinkStatus.Resolved:
|
|
@@ -77,7 +90,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
77
90
|
}
|
|
78
91
|
}, [onError, onResolve, status, title, url]);
|
|
79
92
|
return /*#__PURE__*/_react.default.createElement(_flexibleUiContext.FlexibleUiAnalyticsContext.Provider, {
|
|
80
|
-
value:
|
|
93
|
+
value: analyticsContext
|
|
81
94
|
}, /*#__PURE__*/_react.default.createElement(_flexibleUiContext.FlexibleUiOptionContext.Provider, {
|
|
82
95
|
value: ui
|
|
83
96
|
}, /*#__PURE__*/_react.default.createElement(_flexibleUiContext.FlexibleUiContext.Provider, {
|
|
@@ -47,7 +47,7 @@ var getTransitionStyles = function getTransitionStyles(snippetHeight) {
|
|
|
47
47
|
return (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
|
|
48
48
|
};
|
|
49
49
|
exports.getTransitionStyles = getTransitionStyles;
|
|
50
|
-
var popupContainerStyles = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-
|
|
50
|
+
var popupContainerStyles = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-200, 8px)", (0, _components.themed)({
|
|
51
51
|
light: "var(--ds-surface-raised, white)",
|
|
52
52
|
dark: "var(--ds-surface-raised, #262B31)"
|
|
53
53
|
})(), (0, _components.themed)({
|
|
@@ -56,6 +56,6 @@ var popupContainerStyles = (0, _react.css)(_templateObject5 || (_templateObject5
|
|
|
56
56
|
})());
|
|
57
57
|
exports.popupContainerStyles = popupContainerStyles;
|
|
58
58
|
var getPreviewBlockStyles = function getPreviewBlockStyles(snippetHeight) {
|
|
59
|
-
return (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n ", "\n"])), snippetHeight, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-
|
|
59
|
+
return (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n ", "\n"])), snippetHeight, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-200, 8px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
|
|
60
60
|
};
|
|
61
61
|
exports.getPreviewBlockStyles = getPreviewBlockStyles;
|
|
@@ -18,7 +18,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
18
18
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
19
19
|
var PACKAGE_DATA = {
|
|
20
20
|
packageName: "@atlaskit/smart-card",
|
|
21
|
-
packageVersion: "26.
|
|
21
|
+
packageVersion: "26.25.0",
|
|
22
22
|
componentName: 'linkUrl'
|
|
23
23
|
};
|
|
24
24
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -48,7 +48,7 @@ var isSelected = function isSelected(_ref2) {
|
|
|
48
48
|
// NB: `display: inline` required for `box-decoration-break` to work.
|
|
49
49
|
// NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
|
|
50
50
|
var baseWrapperStyle = function baseWrapperStyle(props) {
|
|
51
|
-
return "\n line-height: 22px;\n padding: 2px 0px;\n ".concat(props.withoutBackground ? "padding-left: 0; margin-left:-2px;" : '', "\n display: inline;\n box-decoration-break: clone;\n border-radius: ", "var(--ds-border-radius-100,
|
|
51
|
+
return "\n line-height: 22px;\n padding: 2px 0px;\n ".concat(props.withoutBackground ? "padding-left: 0; margin-left:-2px;" : '', "\n display: inline;\n box-decoration-break: clone;\n border-radius: ", "var(--ds-border-radius-100, 4px)", ";\n color: ").concat((0, _components.themed)({
|
|
52
52
|
light: "var(--ds-link, ".concat(_colors.B400, ")"),
|
|
53
53
|
dark: "var(--ds-link, #4794FF)"
|
|
54
54
|
})(props), ";\n\n background-color: ").concat(props.withoutBackground ? '' : (0, _components.themed)({
|
|
@@ -14,7 +14,7 @@ var LINK_COLOR_DARK = '#4794FF';
|
|
|
14
14
|
|
|
15
15
|
// By default buttons will hide overflow and ellipsis content instead of wrapping.
|
|
16
16
|
// This basically turns the button back into inline content
|
|
17
|
-
var IconStyledButton = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &&& {\n text-align: initial;\n display: inline;\n vertical-align: baseline;\n border-radius: ", ";\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n padding: ", " ", ";\n background-clip: padding-box;\n box-decoration-break: clone;\n }\n > span {\n display: inline;\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])), "var(--ds-border-radius-100,
|
|
17
|
+
var IconStyledButton = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &&& {\n text-align: initial;\n display: inline;\n vertical-align: baseline;\n border-radius: ", ";\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n padding: ", " ", ";\n background-clip: padding-box;\n box-decoration-break: clone;\n }\n > span {\n display: inline;\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])), "var(--ds-border-radius-100, 4px)", "var(--ds-space-025, 2px)", "var(--ds-space-075, 6px)");
|
|
18
18
|
exports.IconStyledButton = IconStyledButton;
|
|
19
19
|
var NoLinkAppearance = _styled.default.span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n margin-left: ", ";\n"])), (0, _components.themed)({
|
|
20
20
|
light: "var(--ds-text-subtlest, ".concat(_colors.N200, ")"),
|
package/dist/es2019/constants.js
CHANGED
|
@@ -143,6 +143,7 @@ export let ElementName = /*#__PURE__*/function (ElementName) {
|
|
|
143
143
|
export let ActionName = /*#__PURE__*/function (ActionName) {
|
|
144
144
|
ActionName["DeleteAction"] = "DeleteAction";
|
|
145
145
|
ActionName["EditAction"] = "EditAction";
|
|
146
|
+
ActionName["FollowAction"] = "FollowAction";
|
|
146
147
|
ActionName["PreviewAction"] = "PreviewAction";
|
|
147
148
|
ActionName["ViewAction"] = "ViewAction";
|
|
148
149
|
ActionName["DownloadAction"] = "DownloadAction";
|
|
@@ -5,7 +5,7 @@ import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount
|
|
|
5
5
|
import { extractLink, extractTitle, extractProvider, extractMembers, extractPersonAssignedTo, extractPersonCreatedBy, extractPersonUpdatedBy, extractImage } from '@atlaskit/link-extractors';
|
|
6
6
|
import { extractByline } from '../common/byline/extractByline';
|
|
7
7
|
import { extractTitlePrefix } from '../common/title-prefix/extractTitlePrefix';
|
|
8
|
-
import {
|
|
8
|
+
import { extractClientActions } from '../common/actions/extractActions';
|
|
9
9
|
import { extractPreviewAction } from '../common/actions/extractPreviewAction';
|
|
10
10
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
11
11
|
const extractBlockIcon = jsonLd => {
|
|
@@ -26,7 +26,7 @@ export const extractBlockActions = (props, jsonLd, opts, platform, meta) => {
|
|
|
26
26
|
const {
|
|
27
27
|
handleInvoke
|
|
28
28
|
} = opts;
|
|
29
|
-
const actions =
|
|
29
|
+
const actions = extractClientActions(jsonLd, handleInvoke);
|
|
30
30
|
const previewAction = extractPreviewAction({
|
|
31
31
|
...opts,
|
|
32
32
|
viewProps: props,
|
|
@@ -30,25 +30,6 @@ const getClientActionProps = (jsonLd, action, handler) => {
|
|
|
30
30
|
promise: () => handler(clientActionInvokeOpts)
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
const getServerActionProps = (jsonLd, action, handler) => {
|
|
34
|
-
const id = action['@id'] || action['@type'];
|
|
35
|
-
const data = {
|
|
36
|
-
type: 'server',
|
|
37
|
-
key: action.identifier,
|
|
38
|
-
action: {
|
|
39
|
-
type: action['@type'],
|
|
40
|
-
payload: {
|
|
41
|
-
id,
|
|
42
|
-
context: jsonLd.context
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
id,
|
|
48
|
-
text: action.name,
|
|
49
|
-
promise: () => handler(data)
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
33
|
export const getActionsFromJsonLd = jsonLd => {
|
|
53
34
|
let actions = jsonLd && jsonLd['schema:potentialAction'];
|
|
54
35
|
if (!actions) {
|
|
@@ -59,11 +40,9 @@ export const getActionsFromJsonLd = jsonLd => {
|
|
|
59
40
|
}
|
|
60
41
|
return actions;
|
|
61
42
|
};
|
|
62
|
-
export function
|
|
43
|
+
export function extractClientActions(jsonLd, handler) {
|
|
63
44
|
const actions = getActionsFromJsonLd(jsonLd);
|
|
64
45
|
const clientActions = actions.filter(isClientAction);
|
|
65
|
-
const serverActions = actions.filter(action => !isClientAction(action));
|
|
66
46
|
const clientActionImpls = clientActions.map(action => getClientActionProps(jsonLd, action, handler));
|
|
67
|
-
|
|
68
|
-
return [...clientActionImpls, ...serverActionImpls];
|
|
47
|
+
return clientActionImpls;
|
|
69
48
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { extractLink } from '@atlaskit/link-extractors';
|
|
2
|
+
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
3
|
+
import { getExtensionKey } from '../../../state/helpers';
|
|
4
|
+
import extractServerAction from '../extract-server-action';
|
|
5
|
+
const extractFollowAction = (response, showServerActions, id) => {
|
|
6
|
+
var _action$dataUpdateAct;
|
|
7
|
+
if (!showServerActions) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const extensionKey = getExtensionKey(response);
|
|
11
|
+
const data = response === null || response === void 0 ? void 0 : response.data;
|
|
12
|
+
const actions = extractServerAction(data);
|
|
13
|
+
if (!extensionKey || actions.length === 0) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const action = actions.find(item => {
|
|
17
|
+
if ((item === null || item === void 0 ? void 0 : item.name) === 'UpdateAction') {
|
|
18
|
+
var _dataUpdateAction;
|
|
19
|
+
const actionName = item === null || item === void 0 ? void 0 : (_dataUpdateAction = item.dataUpdateAction) === null || _dataUpdateAction === void 0 ? void 0 : _dataUpdateAction.name;
|
|
20
|
+
return actionName === SmartLinkActionType.FollowEntityAction || actionName === SmartLinkActionType.UnfollowEntityAction;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
});
|
|
24
|
+
if (!action || !action.resourceIdentifiers) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const url = extractLink(data);
|
|
28
|
+
const reload = url ? {
|
|
29
|
+
id,
|
|
30
|
+
url
|
|
31
|
+
} : undefined;
|
|
32
|
+
const actionType = (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name;
|
|
33
|
+
return {
|
|
34
|
+
action: {
|
|
35
|
+
action: {
|
|
36
|
+
actionType,
|
|
37
|
+
resourceIdentifiers: action.resourceIdentifiers
|
|
38
|
+
},
|
|
39
|
+
providerKey: extensionKey,
|
|
40
|
+
reload
|
|
41
|
+
},
|
|
42
|
+
value: actionType === SmartLinkActionType.FollowEntityAction
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export default extractFollowAction;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { extractSummary } from '../common/primitives';
|
|
3
|
+
import extractFollowAction from './actions/extract-follow-action';
|
|
2
4
|
import { extractLinkIcon } from './icon';
|
|
3
5
|
import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractLocation, extractOwnedBy, extractAssignedTo, extractSubTasksProgress, extractStoryPoints, extractReadTime, extractSentOn, extractPersonAssignedToAsArray } from './utils';
|
|
4
6
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
@@ -38,6 +40,7 @@ const extractFlexibleUiContext = ({
|
|
|
38
40
|
assignedTo: extractAssignedTo(data),
|
|
39
41
|
createdOn: extractDateCreated(data),
|
|
40
42
|
dueOn: extractDueOn(data),
|
|
43
|
+
followAction: getBooleanFF('platform.linking-platform.smart-card.follow-button') ? extractFollowAction(response, showServerActions, id) : undefined,
|
|
41
44
|
previewAction: extractPreviewAction(response),
|
|
42
45
|
viewAction: extractViewAction(data),
|
|
43
46
|
downloadAction: extractDownloadAction(data),
|
package/dist/es2019/messages.js
CHANGED
|
@@ -140,6 +140,11 @@ export const messages = defineMessages({
|
|
|
140
140
|
defaultMessage: 'Edit',
|
|
141
141
|
description: 'Allow a user to edit a link'
|
|
142
142
|
},
|
|
143
|
+
follow: {
|
|
144
|
+
id: 'fabric.linking.follow',
|
|
145
|
+
defaultMessage: 'Follow',
|
|
146
|
+
description: 'Click to follow a project.'
|
|
147
|
+
},
|
|
143
148
|
forbidden_description: {
|
|
144
149
|
id: 'fabric.linking.forbidden_description',
|
|
145
150
|
defaultMessage: 'You don’t have access to this preview. Contact the site admin if you need access.',
|
|
@@ -425,6 +430,11 @@ export const messages = defineMessages({
|
|
|
425
430
|
defaultMessage: 'Unassigned',
|
|
426
431
|
description: 'Shown as a tooltip text for a default unassigned fallback avatar'
|
|
427
432
|
},
|
|
433
|
+
unfollow: {
|
|
434
|
+
id: 'fabric.linking.unfollow',
|
|
435
|
+
defaultMessage: 'Unfollow',
|
|
436
|
+
description: 'Click to unfollow a project.'
|
|
437
|
+
},
|
|
428
438
|
unlink_account: {
|
|
429
439
|
id: 'fabric.linking.unlink_account',
|
|
430
440
|
defaultMessage: 'Unlink Account',
|