@atlaskit/smart-card 36.9.0 → 36.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/extractors/common/context/index.js +41 -1
- package/dist/cjs/extractors/common/icon/extractIconFromDocument.js +7 -61
- package/dist/cjs/extractors/embed/index.js +3 -35
- package/dist/cjs/extractors/flexible/extract-preview.js +24 -2
- package/dist/cjs/extractors/flexible/icon/extract-provider-icon.js +40 -2
- package/dist/cjs/extractors/flexible/icon/index.js +15 -1
- package/dist/cjs/extractors/flexible/index.js +77 -3
- package/dist/cjs/extractors/inline/index.js +5 -1
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/index.js +2 -256
- package/dist/cjs/utils/mocks.js +12 -2
- package/dist/cjs/view/BlockCard/views/ErroredView.js +1 -12
- package/dist/cjs/view/BlockCard/views/ForbiddenView.js +2 -11
- package/dist/cjs/view/BlockCard/views/NotFoundView.js +5 -15
- package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +3 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -5
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +12 -36
- package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -17
- package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
- package/dist/cjs/view/FlexibleCard/utils.js +21 -10
- package/dist/cjs/view/HoverCard/components/views/resolving/index.js +5 -18
- package/dist/cjs/view/InlineCard/ErroredView/index.js +5 -15
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +1 -7
- package/dist/cjs/view/InlineCard/Icon.compiled.css +0 -1
- package/dist/cjs/view/InlineCard/Icon.js +4 -24
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +7 -15
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/common/context/index.js +36 -1
- package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +6 -61
- package/dist/es2019/extractors/embed/index.js +2 -35
- package/dist/es2019/extractors/flexible/extract-preview.js +25 -2
- package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +42 -2
- package/dist/es2019/extractors/flexible/icon/index.js +14 -0
- package/dist/es2019/extractors/flexible/index.js +75 -5
- package/dist/es2019/extractors/inline/index.js +5 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/index.js +2 -56
- package/dist/es2019/utils/mocks.js +13 -2
- package/dist/es2019/view/BlockCard/views/ErroredView.js +1 -12
- package/dist/es2019/view/BlockCard/views/ForbiddenView.js +3 -12
- package/dist/es2019/view/BlockCard/views/NotFoundView.js +8 -16
- package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +4 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +4 -6
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +11 -33
- package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +5 -18
- package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
- package/dist/es2019/view/FlexibleCard/utils.js +19 -11
- package/dist/es2019/view/HoverCard/components/views/resolving/index.js +5 -18
- package/dist/es2019/view/InlineCard/ErroredView/index.js +5 -15
- package/dist/es2019/view/InlineCard/ForbiddenView/index.js +2 -8
- package/dist/es2019/view/InlineCard/Icon.compiled.css +0 -1
- package/dist/es2019/view/InlineCard/Icon.js +0 -19
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +8 -16
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/common/context/index.js +38 -1
- package/dist/esm/extractors/common/icon/extractIconFromDocument.js +6 -61
- package/dist/esm/extractors/embed/index.js +2 -34
- package/dist/esm/extractors/flexible/extract-preview.js +25 -2
- package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +41 -2
- package/dist/esm/extractors/flexible/icon/index.js +14 -0
- package/dist/esm/extractors/flexible/index.js +76 -5
- package/dist/esm/extractors/inline/index.js +5 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/index.js +2 -156
- package/dist/esm/utils/mocks.js +12 -2
- package/dist/esm/view/BlockCard/views/ErroredView.js +1 -12
- package/dist/esm/view/BlockCard/views/ForbiddenView.js +3 -12
- package/dist/esm/view/BlockCard/views/NotFoundView.js +6 -16
- package/dist/esm/view/BlockCard/views/UnauthorisedView.js +4 -4
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -5
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +11 -33
- package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +5 -18
- package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
- package/dist/esm/view/FlexibleCard/utils.js +19 -11
- package/dist/esm/view/HoverCard/components/views/resolving/index.js +5 -18
- package/dist/esm/view/InlineCard/ErroredView/index.js +5 -15
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +2 -8
- package/dist/esm/view/InlineCard/Icon.compiled.css +0 -1
- package/dist/esm/view/InlineCard/Icon.js +3 -23
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +8 -16
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/__fixtures__/figma-entity.d.ts +58 -0
- package/dist/types/extractors/common/context/index.d.ts +8 -0
- package/dist/types/extractors/flexible/extract-preview.d.ts +5 -0
- package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +5 -0
- package/dist/types/extractors/flexible/icon/index.d.ts +13 -0
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +2 -6
- package/dist/types/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +2 -4
- package/dist/types/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +1 -17
- package/dist/types/view/FlexibleCard/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/utils.d.ts +2 -2
- package/dist/types/view/InlineCard/Icon.d.ts +0 -1
- package/dist/types-ts4.5/__fixtures__/figma-entity.d.ts +58 -0
- package/dist/types-ts4.5/extractors/common/context/index.d.ts +8 -0
- package/dist/types-ts4.5/extractors/flexible/extract-preview.d.ts +5 -0
- package/dist/types-ts4.5/extractors/flexible/icon/extract-provider-icon.d.ts +5 -0
- package/dist/types-ts4.5/extractors/flexible/icon/index.d.ts +13 -0
- package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +2 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +2 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +1 -17
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/utils.d.ts +2 -2
- package/dist/types-ts4.5/view/InlineCard/Icon.d.ts +0 -1
- package/package.json +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -10,12 +11,14 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
10
11
|
var _constants = require("../../constants");
|
|
11
12
|
var _context = require("../../extractors/common/context");
|
|
12
13
|
var _flexible = _interopRequireDefault(require("../../extractors/flexible"));
|
|
13
|
-
var _extractPreview =
|
|
14
|
+
var _extractPreview = _interopRequireWildcard(require("../../extractors/flexible/extract-preview"));
|
|
14
15
|
var _icon = require("../../extractors/flexible/icon");
|
|
15
|
-
var _extractProviderIcon =
|
|
16
|
+
var _extractProviderIcon = _interopRequireWildcard(require("../../extractors/flexible/icon/extract-provider-icon"));
|
|
16
17
|
var _messages = require("../../messages");
|
|
17
18
|
var _utils = require("../../utils");
|
|
18
19
|
var _jsonld = require("../../utils/jsonld");
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
22
|
var getContextByStatus = exports.getContextByStatus = function getContextByStatus(params) {
|
|
20
23
|
var _ref = params !== null && params !== void 0 ? params : {},
|
|
21
24
|
response = _ref.response,
|
|
@@ -36,15 +39,23 @@ var getContextByStatus = exports.getContextByStatus = function getContextByStatu
|
|
|
36
39
|
case _constants.SmartLinkStatus.Errored:
|
|
37
40
|
case _constants.SmartLinkStatus.Fallback:
|
|
38
41
|
default:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
if ((0, _platformFeatureFlags.fg)('smart_links_noun_support')) {
|
|
43
|
+
if ((0, _linkExtractors.isEntityPresent)(response)) {
|
|
44
|
+
return {
|
|
45
|
+
url: url,
|
|
46
|
+
title: url,
|
|
47
|
+
linkIcon: (0, _icon.extractErrorIcon)(response, status),
|
|
48
|
+
preview: (0, _extractPreview.extractSmartLinkPreviewImage)(response),
|
|
49
|
+
provider: (0, _extractProviderIcon.extractSmartLinkProviderIcon)(response)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
42
53
|
return {
|
|
43
|
-
linkIcon: linkIcon,
|
|
44
|
-
title: url,
|
|
45
54
|
url: url,
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
title: url,
|
|
56
|
+
linkIcon: (0, _icon.extractErrorIcon)(response, status),
|
|
57
|
+
preview: (0, _extractPreview.default)(response === null || response === void 0 ? void 0 : response.data),
|
|
58
|
+
provider: (0, _extractProviderIcon.default)(response === null || response === void 0 ? void 0 : response.data)
|
|
48
59
|
};
|
|
49
60
|
}
|
|
50
61
|
};
|
|
@@ -69,7 +80,7 @@ var getForbiddenMessageKey = function getForbiddenMessageKey(meta) {
|
|
|
69
80
|
var getRetryOptions = exports.getRetryOptions = function getRetryOptions(url, status, response, onAuthorize) {
|
|
70
81
|
var _response$meta, _access$action, _access$buttonDisable;
|
|
71
82
|
var data = response && response.data || (0, _jsonld.getEmptyJsonLd)();
|
|
72
|
-
var provider = (0, _linkExtractors.extractProvider)(data);
|
|
83
|
+
var provider = (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (0, _linkExtractors.extractSmartLinkProvider)(response) : (0, _linkExtractors.extractProvider)(data);
|
|
73
84
|
var context = provider === null || provider === void 0 ? void 0 : provider.text;
|
|
74
85
|
var values = context ? {
|
|
75
86
|
context: context
|
|
@@ -10,7 +10,6 @@ require("./index.compiled.css");
|
|
|
10
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _blocks = require("../../../../FlexibleCard/components/blocks");
|
|
15
14
|
var _actionGroup = _interopRequireDefault(require("../../../../FlexibleCard/components/blocks/action-group"));
|
|
16
15
|
var _loadingSkeleton = require("../../../../FlexibleCard/components/common/loading-skeleton");
|
|
@@ -31,7 +30,6 @@ var HoverCardLoadingView = function HoverCardLoadingView(_ref) {
|
|
|
31
30
|
items: actions,
|
|
32
31
|
visibleButtonsNum: 2
|
|
33
32
|
});
|
|
34
|
-
var LoadingSkeleton = (0, _platformFeatureFlags.fg)('platform-smart-card-icon-migration') ? _loadingSkeleton.LoadingSkeletonNew : _loadingSkeleton.LoadingSkeletonOld;
|
|
35
33
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
34
|
"data-testid": testId,
|
|
37
35
|
className: (0, _runtime.ax)(["_1e0c1txw _2lx21bp4 _ca0q1e9d _u5f31e9d _n3td1e9d _19bv1e9d"])
|
|
@@ -42,34 +40,23 @@ var HoverCardLoadingView = function HoverCardLoadingView(_ref) {
|
|
|
42
40
|
className: (0, _runtime.ax)(["_zulpcxkx _1bsb1osq"])
|
|
43
41
|
}), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
44
42
|
render: function render() {
|
|
45
|
-
return /*#__PURE__*/_react.default.createElement(LoadingSkeleton, null);
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeleton, null);
|
|
46
44
|
},
|
|
47
45
|
size: size
|
|
48
46
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
49
47
|
"data-testid": "".concat(testId, "-title"),
|
|
50
48
|
className: (0, _runtime.ax)(["_16jlkb7n _1o9zidpf _i0dl1wug _4t3i1k92 _e2oo1osq"])
|
|
51
|
-
},
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeleton, {
|
|
52
50
|
height: "".concat(lineHeightRem, "rem")
|
|
53
|
-
})
|
|
54
|
-
height: lineHeightRem
|
|
55
|
-
})), actionGroup), (0, _platformFeatureFlags.fg)('platform-smart-card-icon-migration') ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeletonNew, {
|
|
51
|
+
})), actionGroup), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeleton, {
|
|
56
52
|
width: "".concat(skeletonWidth, "rem"),
|
|
57
53
|
height: "".concat(lineHeightRem, "rem")
|
|
58
|
-
}), /*#__PURE__*/_react.default.createElement(_loadingSkeleton.
|
|
54
|
+
}), /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeleton, {
|
|
59
55
|
width: "".concat(skeletonWidth, "rem"),
|
|
60
56
|
height: "".concat(lineHeightRem * 3, "rem")
|
|
61
|
-
}), /*#__PURE__*/_react.default.createElement(_loadingSkeleton.
|
|
57
|
+
}), /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeleton, {
|
|
62
58
|
width: "".concat(skeletonWidth, "rem"),
|
|
63
59
|
height: "".concat(lineHeightRem, "rem")
|
|
64
|
-
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeletonOld, {
|
|
65
|
-
width: skeletonWidth,
|
|
66
|
-
height: lineHeightRem
|
|
67
|
-
}), /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeletonOld, {
|
|
68
|
-
width: skeletonWidth,
|
|
69
|
-
height: lineHeightRem * 3
|
|
70
|
-
}), /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeletonOld, {
|
|
71
|
-
width: skeletonWidth,
|
|
72
|
-
height: lineHeightRem
|
|
73
60
|
}))));
|
|
74
61
|
};
|
|
75
62
|
var _default = exports.default = HoverCardLoadingView;
|
|
@@ -15,12 +15,10 @@ var _error = _interopRequireDefault(require("@atlaskit/icon/core/migration/error
|
|
|
15
15
|
var _error2 = _interopRequireDefault(require("@atlaskit/icon/utility/migration/error"));
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
17
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
18
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
19
18
|
var _messages = require("../../../messages");
|
|
20
19
|
var _HoverCard = require("../../HoverCard");
|
|
21
20
|
var _actionButton = require("../common/action-button");
|
|
22
21
|
var _Frame = require("../Frame");
|
|
23
|
-
var _Icon = require("../Icon");
|
|
24
22
|
var _IconAndTitleLayout = require("../IconAndTitleLayout");
|
|
25
23
|
var _styled = require("../styled");
|
|
26
24
|
var _withFrameStyleControl = _interopRequireDefault(require("../utils/withFrameStyleControl"));
|
|
@@ -36,21 +34,13 @@ var fallbackIcon = function fallbackIcon() {
|
|
|
36
34
|
testId: "errored-view-default-icon"
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
color: "var(--ds-icon-danger, #C9372C)",
|
|
45
|
-
label: "error",
|
|
46
|
-
LEGACY_size: "small",
|
|
47
|
-
testId: "errored-view-default-icon"
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
return /*#__PURE__*/_react.default.createElement(_Icon.AKIconWrapper, null, /*#__PURE__*/_react.default.createElement(_error2.default, {
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
38
|
+
as: "span",
|
|
39
|
+
xcss: styles.iconWrapper
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(_error2.default, {
|
|
41
|
+
color: "var(--ds-icon-danger, #C9372C)",
|
|
51
42
|
label: "error",
|
|
52
43
|
LEGACY_size: "small",
|
|
53
|
-
color: "var(--ds-icon-danger, ".concat(_colors.R300, ")"),
|
|
54
44
|
testId: "errored-view-default-icon"
|
|
55
45
|
}));
|
|
56
46
|
};
|
|
@@ -23,7 +23,6 @@ var _messages = require("../../../messages");
|
|
|
23
23
|
var _HoverCard = require("../../HoverCard");
|
|
24
24
|
var _actionButton = require("../common/action-button");
|
|
25
25
|
var _Frame = require("../Frame");
|
|
26
|
-
var _Icon = require("../Icon");
|
|
27
26
|
var _IconAndTitleLayout = require("../IconAndTitleLayout");
|
|
28
27
|
var _styled = require("../styled");
|
|
29
28
|
var _withFrameStyleControl = _interopRequireDefault(require("../utils/withFrameStyleControl"));
|
|
@@ -41,7 +40,7 @@ var fallbackForbiddenIcon = function fallbackForbiddenIcon() {
|
|
|
41
40
|
testId: "forbidden-view-fallback-icon"
|
|
42
41
|
});
|
|
43
42
|
}
|
|
44
|
-
return
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
45
44
|
as: "span",
|
|
46
45
|
xcss: styles.iconWrapper
|
|
47
46
|
}, /*#__PURE__*/_react.default.createElement(_lockLocked.default, {
|
|
@@ -50,11 +49,6 @@ var fallbackForbiddenIcon = function fallbackForbiddenIcon() {
|
|
|
50
49
|
LEGACY_fallbackIcon: _lockFilled.default,
|
|
51
50
|
LEGACY_size: "small",
|
|
52
51
|
testId: "forbidden-view-fallback-icon"
|
|
53
|
-
})) : /*#__PURE__*/_react.default.createElement(_Icon.AKIconWrapper, null, /*#__PURE__*/_react.default.createElement(_lockFilled.default, {
|
|
54
|
-
label: "error",
|
|
55
|
-
size: "small",
|
|
56
|
-
primaryColor: "var(--ds-icon-danger, ".concat(_colors.R400, ")"),
|
|
57
|
-
testId: "forbidden-view-fallback-icon"
|
|
58
52
|
}));
|
|
59
53
|
};
|
|
60
54
|
var InlineCardForbiddenView = exports.InlineCardForbiddenView = function InlineCardForbiddenView(_ref) {
|
|
@@ -6,15 +6,14 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.Shimmer = exports.Icon =
|
|
9
|
+
exports.Shimmer = exports.Icon = void 0;
|
|
10
10
|
require("./Icon.compiled.css");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
15
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
16
|
-
var _excluded = ["as", "style"]
|
|
17
|
-
_excluded2 = ["as", "style"];
|
|
16
|
+
var _excluded = ["as", "style"];
|
|
18
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
19
|
// TODO: Figure out a more scalable/responsive solution
|
|
@@ -34,30 +33,11 @@ var Icon = exports.Icon = (0, _react.forwardRef)(function (_ref, __cmplr) {
|
|
|
34
33
|
className: (0, _runtime.ax)(["_2rkoyh40 _4t3i7vkz _1bsb7vkz _2hwx1b66 _uiztglyw _kqswstnw _154i1ssb _1ltv1ssb _t9ec1ooe", __cmplp.className])
|
|
35
34
|
}));
|
|
36
35
|
});
|
|
37
|
-
|
|
38
|
-
// TODO: Remove on platform-smart-card-icon-migration cleanup
|
|
39
|
-
// Used for 'untrue' icons which claim to be 16x16 but
|
|
40
|
-
// are less than that in height/width.
|
|
41
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
42
36
|
if (process.env.NODE_ENV !== 'production') {
|
|
43
37
|
Icon.displayName = 'Icon';
|
|
44
38
|
}
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
C = _ref2$as === void 0 ? "span" : _ref2$as,
|
|
48
|
-
__cmpls = _ref2.style,
|
|
49
|
-
__cmplp = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
50
|
-
return /*#__PURE__*/_react.default.createElement(C, (0, _extends2.default)({}, __cmplp, {
|
|
51
|
-
style: __cmpls,
|
|
52
|
-
ref: __cmplr,
|
|
53
|
-
className: (0, _runtime.ax)(["_2hwx1i6y", __cmplp.className])
|
|
54
|
-
}));
|
|
55
|
-
});
|
|
56
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
57
|
-
AKIconWrapper.displayName = 'AKIconWrapper';
|
|
58
|
-
}
|
|
59
|
-
var Shimmer = exports.Shimmer = function Shimmer(_ref3) {
|
|
60
|
-
var testId = _ref3.testId;
|
|
39
|
+
var Shimmer = exports.Shimmer = function Shimmer(_ref2) {
|
|
40
|
+
var testId = _ref2.testId;
|
|
61
41
|
var skeletonCustomStyles = {
|
|
62
42
|
position: 'absolute',
|
|
63
43
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
@@ -22,7 +22,6 @@ var _messages = require("../../../messages");
|
|
|
22
22
|
var _HoverCard = require("../../HoverCard");
|
|
23
23
|
var _actionButton = require("../common/action-button");
|
|
24
24
|
var _Frame = require("../Frame");
|
|
25
|
-
var _Icon = require("../Icon");
|
|
26
25
|
var _IconAndTitleLayout = require("../IconAndTitleLayout");
|
|
27
26
|
var _styled = require("../styled");
|
|
28
27
|
var _withFrameStyleControl = _interopRequireDefault(require("../utils/withFrameStyleControl"));
|
|
@@ -38,21 +37,14 @@ var fallbackUnauthorizedIcon = function fallbackUnauthorizedIcon() {
|
|
|
38
37
|
LEGACY_size: "small"
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
color: "var(--ds-icon-danger, #C9372C)",
|
|
47
|
-
label: "error",
|
|
48
|
-
LEGACY_fallbackIcon: _lockFilled.default,
|
|
49
|
-
LEGACY_size: "small"
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
return /*#__PURE__*/_react.default.createElement(_Icon.AKIconWrapper, null, /*#__PURE__*/_react.default.createElement(_lockFilled.default, {
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
41
|
+
as: "span",
|
|
42
|
+
xcss: styles.iconWrapper
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_lockLocked.default, {
|
|
44
|
+
color: "var(--ds-icon-danger, #C9372C)",
|
|
53
45
|
label: "error",
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
LEGACY_fallbackIcon: _lockFilled.default,
|
|
47
|
+
LEGACY_size: "small"
|
|
56
48
|
}));
|
|
57
49
|
};
|
|
58
50
|
var InlineCardUnauthorizedView = exports.InlineCardUnauthorizedView = function InlineCardUnauthorizedView(_ref) {
|
|
@@ -20,7 +20,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
20
20
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
21
21
|
var PACKAGE_DATA = {
|
|
22
22
|
packageName: "@atlaskit/smart-card",
|
|
23
|
-
packageVersion: "36.
|
|
23
|
+
packageVersion: "36.10.0",
|
|
24
24
|
componentName: 'linkUrl'
|
|
25
25
|
};
|
|
26
26
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -1 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import { extractEntityProvider, extractProvider, extractProviderIcon, extractUrlFromIconJsonLd, isEntityPresent } from '@atlaskit/link-extractors';
|
|
2
|
+
import { prioritiseIcon } from '../icon/prioritiseIcon';
|
|
3
|
+
export { extractRequestAccessContextImproved } from './extractAccessContext';
|
|
4
|
+
export function generateContext(jsonLd) {
|
|
5
|
+
const provider = extractProvider(jsonLd);
|
|
6
|
+
if (!provider) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// If no icon is supplied, return existing context
|
|
11
|
+
if (!jsonLd.icon) {
|
|
12
|
+
return provider;
|
|
13
|
+
}
|
|
14
|
+
const generator = jsonLd.generator;
|
|
15
|
+
const icon = prioritiseIcon({
|
|
16
|
+
fileFormatIcon: undefined,
|
|
17
|
+
documentTypeIcon: undefined,
|
|
18
|
+
urlIcon: extractUrlFromIconJsonLd(jsonLd.icon),
|
|
19
|
+
// We still attempt to follow the icon priority function even if no generator (and therefore provider icon) is defined
|
|
20
|
+
providerIcon: generator && typeof generator !== 'string' && generator['@type'] !== 'Link' && extractProviderIcon(generator.icon)
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
...provider,
|
|
24
|
+
icon: icon ? icon : provider.icon
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Should be moved to link-extractors when jsonLd is deprecated
|
|
30
|
+
*/
|
|
31
|
+
export function extractSmartLinkContext(response) {
|
|
32
|
+
if (isEntityPresent(response)) {
|
|
33
|
+
return extractEntityProvider(response);
|
|
34
|
+
}
|
|
35
|
+
return generateContext(response === null || response === void 0 ? void 0 : response.data);
|
|
36
|
+
}
|
|
@@ -1,69 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import FileIconOld from '@atlaskit/icon-file-type/glyph/generic/16';
|
|
4
|
-
import PresentationIconOld from '@atlaskit/icon-file-type/glyph/presentation/16';
|
|
5
|
-
import SpreadsheetIconOld from '@atlaskit/icon-file-type/glyph/spreadsheet/16';
|
|
6
|
-
import BlogIconOld from '@atlaskit/icon-object/glyph/blog/16';
|
|
7
|
-
import DocumentFilledIconNew from '@atlaskit/icon/core/migration/file--document-filled';
|
|
8
|
-
import DocumentFilledIconOld from '@atlaskit/icon/core/migration/page--document-filled';
|
|
2
|
+
import DocumentFilledIcon from '@atlaskit/icon/core/migration/file--document-filled';
|
|
9
3
|
import { isConfluenceGenerator } from '@atlaskit/link-extractors';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import SpreadsheetIconNew from '../../../common/ui/icons/list-bullet-icon';
|
|
4
|
+
import BlogIcon from '../../../common/ui/icons/blog-icon';
|
|
5
|
+
import PresentationIcon from '../../../common/ui/icons/chart-bar-icon';
|
|
6
|
+
import FileIcon from '../../../common/ui/icons/file-icon';
|
|
7
|
+
import SpreadsheetIcon from '../../../common/ui/icons/list-bullet-icon';
|
|
15
8
|
import LiveDocumentIcon from '../../../common/ui/icons/live-document-icon';
|
|
16
|
-
import
|
|
9
|
+
import DocumentIcon from '../../../common/ui/icons/page-icon';
|
|
17
10
|
import { getIconForFileType } from '../../../utils';
|
|
18
11
|
import { prioritiseIcon } from './prioritiseIcon';
|
|
19
|
-
|
|
20
|
-
// TODO Delete this and rename BlogIconNew to BlogIcon when cleaning platform-smart-card-icon-migration
|
|
21
|
-
const BlogIcon = props => {
|
|
22
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
23
|
-
return /*#__PURE__*/React.createElement(BlogIconNew, props);
|
|
24
|
-
}
|
|
25
|
-
return /*#__PURE__*/React.createElement(BlogIconOld, props);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// TODO Delete this and rename FileIconNew to FileIcon when cleaning platform-smart-card-icon-migration
|
|
29
|
-
const FileIcon = props => {
|
|
30
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
31
|
-
return /*#__PURE__*/React.createElement(FileIconNew, props);
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/React.createElement(FileIconOld, props);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// TODO Delete this and rename DocumentIconNew to DocumentIcon when cleaning platform-smart-card-icon-migration
|
|
37
|
-
const DocumentIcon = props => {
|
|
38
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
39
|
-
return /*#__PURE__*/React.createElement(DocumentIconNew, props);
|
|
40
|
-
}
|
|
41
|
-
return /*#__PURE__*/React.createElement(DocumentIconOld, props);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// TODO Delete this and rename PresentationIconNew to PresentationIcon when cleaning platform-smart-card-icon-migration
|
|
45
|
-
const PresentationIcon = props => {
|
|
46
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(PresentationIconNew, props);
|
|
48
|
-
}
|
|
49
|
-
return /*#__PURE__*/React.createElement(PresentationIconOld, props);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// TODO Delete this and rename SpreadsheetIconNew to SpreadsheetIcon when cleaning platform-smart-card-icon-migration
|
|
53
|
-
const SpreadsheetIcon = props => {
|
|
54
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
55
|
-
return /*#__PURE__*/React.createElement(SpreadsheetIconNew, props);
|
|
56
|
-
}
|
|
57
|
-
return /*#__PURE__*/React.createElement(SpreadsheetIconOld, props);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// TODO Delete this and rename DocumentFilledIconNew to DocumentFilledIcon when cleaning platform-smart-card-icon-migration
|
|
61
|
-
const DocumentFilledIcon = props => {
|
|
62
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
63
|
-
return /*#__PURE__*/React.createElement(DocumentFilledIconNew, props);
|
|
64
|
-
}
|
|
65
|
-
return /*#__PURE__*/React.createElement(DocumentFilledIconOld, props);
|
|
66
|
-
};
|
|
67
12
|
/**
|
|
68
13
|
* Extracts an icon for a document pbject
|
|
69
14
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extractLink, extractPreview, extractSmartLinkEmbed, extractSmartLinkTitle, extractSmartLinkUrl, extractTitle } from '@atlaskit/link-extractors';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { getEmptyJsonLd } from '../../utils/jsonld';
|
|
4
|
-
import {
|
|
4
|
+
import { extractSmartLinkContext, generateContext } from '../common/context';
|
|
5
5
|
import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
|
|
6
6
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
7
7
|
const extractEmbedPreview = (jsonLd, platform, iframeUrlType) => {
|
|
@@ -13,39 +13,6 @@ const extractEmbedPreview = (jsonLd, platform, iframeUrlType) => {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
function generateContext(jsonLd) {
|
|
17
|
-
const provider = extractProvider(jsonLd);
|
|
18
|
-
if (!provider) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// If no icon is supplied, return existing context
|
|
23
|
-
if (!jsonLd.icon) {
|
|
24
|
-
return provider;
|
|
25
|
-
}
|
|
26
|
-
const generator = jsonLd.generator;
|
|
27
|
-
const icon = prioritiseIcon({
|
|
28
|
-
fileFormatIcon: undefined,
|
|
29
|
-
documentTypeIcon: undefined,
|
|
30
|
-
urlIcon: extractUrlFromIconJsonLd(jsonLd.icon),
|
|
31
|
-
// We still attempt to follow the icon priority function even if no generator (and therefore provider icon) is defined
|
|
32
|
-
providerIcon: generator && typeof generator !== 'string' && generator['@type'] !== 'Link' && extractProviderIcon(generator.icon)
|
|
33
|
-
});
|
|
34
|
-
return {
|
|
35
|
-
...provider,
|
|
36
|
-
icon: icon ? icon : provider.icon
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* We can migrate this to link extractors once we have deprecated JsonLd
|
|
42
|
-
*/
|
|
43
|
-
function extractSmartLinkContext(response) {
|
|
44
|
-
if (isEntityPresent(response)) {
|
|
45
|
-
return extractEntityProvider(response);
|
|
46
|
-
}
|
|
47
|
-
return generateContext(response === null || response === void 0 ? void 0 : response.data);
|
|
48
|
-
}
|
|
49
16
|
export const extractEmbedProps = (response, platform, iframeUrlType) => {
|
|
50
17
|
const meta = response === null || response === void 0 ? void 0 : response.meta;
|
|
51
18
|
const jsonLd = (response === null || response === void 0 ? void 0 : response.data) || getEmptyJsonLd();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractImage } from '@atlaskit/link-extractors';
|
|
1
|
+
import { extractEntity, extractEntityProvider, extractImage, isEntityPresent } from '@atlaskit/link-extractors';
|
|
2
2
|
import { MediaType } from '../../constants';
|
|
3
3
|
const extractPreview = data => {
|
|
4
4
|
if (!data) {
|
|
@@ -10,4 +10,27 @@ const extractPreview = data => {
|
|
|
10
10
|
url
|
|
11
11
|
} : undefined;
|
|
12
12
|
};
|
|
13
|
-
export default extractPreview;
|
|
13
|
+
export default extractPreview;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Should be moved to link-extractors when jsonLd is deprecated
|
|
17
|
+
*/
|
|
18
|
+
export const extractSmartLinkPreviewImage = response => {
|
|
19
|
+
if (!response || !(response !== null && response !== void 0 && response.data)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
if (isEntityPresent(response)) {
|
|
23
|
+
var _entity$thumbnail;
|
|
24
|
+
const entity = extractEntity(response);
|
|
25
|
+
let url = entity === null || entity === void 0 ? void 0 : (_entity$thumbnail = entity.thumbnail) === null || _entity$thumbnail === void 0 ? void 0 : _entity$thumbnail.externalUrl;
|
|
26
|
+
if (!url) {
|
|
27
|
+
const provider = extractEntityProvider(response);
|
|
28
|
+
url = provider === null || provider === void 0 ? void 0 : provider.image;
|
|
29
|
+
}
|
|
30
|
+
return url ? {
|
|
31
|
+
type: MediaType.Image,
|
|
32
|
+
url
|
|
33
|
+
} : undefined;
|
|
34
|
+
}
|
|
35
|
+
return extractPreview(response.data);
|
|
36
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractTitle } from '@atlaskit/link-extractors';
|
|
1
|
+
import { extractEntity, extractEntityProvider, extractTitle, isEntityPresent } from '@atlaskit/link-extractors';
|
|
2
2
|
import { IconType } from '../../../constants';
|
|
3
3
|
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
4
4
|
import extractUrlIcon from './extract-url-icon';
|
|
@@ -34,4 +34,44 @@ const extractProviderIcon = data => {
|
|
|
34
34
|
}
|
|
35
35
|
return extractUrlIcon(icon, label);
|
|
36
36
|
};
|
|
37
|
-
export default extractProviderIcon;
|
|
37
|
+
export default extractProviderIcon;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Should be moved to link-extractors when jsonLd is deprecated
|
|
41
|
+
*/
|
|
42
|
+
export const extractSmartLinkProviderIcon = response => {
|
|
43
|
+
var _extractEntity, _generator$icon;
|
|
44
|
+
if (!response || !(response !== null && response !== void 0 && response.data)) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
if (isEntityPresent(response)) {
|
|
48
|
+
const provider = extractEntityProvider(response);
|
|
49
|
+
if (!provider) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
switch (provider.id) {
|
|
53
|
+
case CONFLUENCE_GENERATOR_ID:
|
|
54
|
+
return {
|
|
55
|
+
icon: IconType.Confluence,
|
|
56
|
+
label: provider.text || 'Confluence'
|
|
57
|
+
};
|
|
58
|
+
case JIRA_GENERATOR_ID:
|
|
59
|
+
return {
|
|
60
|
+
icon: IconType.Jira,
|
|
61
|
+
label: provider.text || 'Jira'
|
|
62
|
+
};
|
|
63
|
+
default:
|
|
64
|
+
const {
|
|
65
|
+
generator
|
|
66
|
+
} = response.meta;
|
|
67
|
+
if (!generator) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
label: generator.name || ((_extractEntity = extractEntity(response)) === null || _extractEntity === void 0 ? void 0 : _extractEntity.displayName),
|
|
72
|
+
url: (_generator$icon = generator.icon) === null || _generator$icon === void 0 ? void 0 : _generator$icon.url
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return extractProviderIcon(response.data);
|
|
77
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { extractEntityIcon, isEntityPresent } from '@atlaskit/link-extractors';
|
|
1
2
|
import { IconType, SmartLinkStatus } from '../../../constants';
|
|
2
3
|
import extractIconRenderer from './extract-icon-renderer';
|
|
3
4
|
import extractJsonldDataIcon from './extract-jsonld-data-icon';
|
|
@@ -44,4 +45,17 @@ export const extractErrorIcon = (response, status) => {
|
|
|
44
45
|
icon: IconType.Default
|
|
45
46
|
};
|
|
46
47
|
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Should be moved to link-extractors when jsonLd is deprecated
|
|
52
|
+
*/
|
|
53
|
+
export const extractSmartLinkIcon = (response, renderers) => {
|
|
54
|
+
if (!response || !(response !== null && response !== void 0 && response.data)) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (isEntityPresent(response)) {
|
|
58
|
+
return extractEntityIcon(response);
|
|
59
|
+
}
|
|
60
|
+
return extractLinkIcon(response, renderers);
|
|
47
61
|
};
|