@atlaskit/smart-card 36.10.0 → 36.11.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 +21 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/mocks.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +1 -1
- package/dist/cjs/view/HoverCard/components/ImagePreview.js +16 -3
- package/dist/cjs/view/HoverCard/components/views/forbidden/index.js +2 -2
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -2
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +2 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/mocks.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +1 -1
- package/dist/es2019/view/HoverCard/components/ImagePreview.js +16 -3
- package/dist/es2019/view/HoverCard/components/views/forbidden/index.js +3 -3
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +2 -2
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +3 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/mocks.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +1 -1
- package/dist/esm/view/HoverCard/components/ImagePreview.js +16 -3
- package/dist/esm/view/HoverCard/components/views/forbidden/index.js +3 -3
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +2 -2
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +3 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/HoverCard/components/ImagePreview.d.ts +1 -1
- package/dist/types/view/HoverCard/types.d.ts +2 -2
- package/dist/types-ts4.5/view/HoverCard/components/ImagePreview.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +2 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 36.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#147390](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/147390)
|
|
8
|
+
[`936db03f49922`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/936db03f49922) -
|
|
9
|
+
[ux] EDM-12440 fixing regression with position styles introduced with SL icon migration
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 36.10.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#146749](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146749)
|
|
20
|
+
[`7f825b2dc9207`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7f825b2dc9207) -
|
|
21
|
+
Enable resolve hovercard view with nounData behind ff: smart_links_noun_support
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 36.10.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "36.
|
|
14
|
+
packageVersion: "36.11.0"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
package/dist/cjs/utils/mocks.js
CHANGED
|
@@ -118,7 +118,7 @@ var Icon = function Icon(_ref) {
|
|
|
118
118
|
"data-testid": testId
|
|
119
119
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
120
120
|
,
|
|
121
|
-
className: (0, _runtime.ax)([(0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v1') && styles.container, !(0, _platformFeatureFlags.fg)('platform-smart-card-icon-migration') && iconStylesMapOld[size],
|
|
121
|
+
className: (0, _runtime.ax)([(0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v1') && styles.container, !(0, _platformFeatureFlags.fg)('platform-smart-card-icon-migration') && iconStylesMapOld[size], positionStyleMap[position], render && !(0, _platformFeatureFlags.fg)('platform-smart-card-icon-migration') && customRenderStyleMapOld[size], render && (0, _platformFeatureFlags.fg)('platform-smart-card-icon-migration') && customRenderStyleMapNew[size], className])
|
|
122
122
|
}), (0, _platformFeatureFlags.fg)('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
123
123
|
xcss: styles.iconWrapperStyle,
|
|
124
124
|
style: {
|
|
@@ -10,15 +10,15 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _extractPreview =
|
|
13
|
+
var _extractPreview = _interopRequireWildcard(require("../../../extractors/flexible/extract-preview"));
|
|
14
14
|
var _blocks = require("../../FlexibleCard/components/blocks");
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
17
17
|
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; }
|
|
18
18
|
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; }
|
|
19
19
|
var ImagePreview = function ImagePreview(_ref) {
|
|
20
|
-
var
|
|
21
|
-
|
|
20
|
+
var fallbackElementHeight = _ref.fallbackElementHeight,
|
|
21
|
+
response = _ref.response;
|
|
22
22
|
var transitionStarted = (0, _react.useRef)(false);
|
|
23
23
|
var previewBlockRef = (0, _react.useRef)(null);
|
|
24
24
|
var _useState = (0, _react.useState)(true),
|
|
@@ -29,6 +29,7 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
29
29
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
30
30
|
dynamicStyles = _useState4[0],
|
|
31
31
|
setDynamicStyles = _useState4[1];
|
|
32
|
+
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
32
33
|
|
|
33
34
|
// Set Preview to a fixed height to enable transitions
|
|
34
35
|
var onPreviewRender = (0, _react.useCallback)(function () {
|
|
@@ -58,6 +59,18 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
58
59
|
var onPreviewTransitionEnd = (0, _react.useCallback)(function () {
|
|
59
60
|
setShowPreview(false);
|
|
60
61
|
}, []);
|
|
62
|
+
if ((0, _platformFeatureFlags.fg)('smart_links_noun_support')) {
|
|
63
|
+
return showPreview && (0, _extractPreview.extractSmartLinkPreviewImage)(response) ? /*#__PURE__*/_react.default.createElement(_blocks.PreviewBlock, {
|
|
64
|
+
onError: onPreviewError,
|
|
65
|
+
ignoreContainerPadding: true,
|
|
66
|
+
onTransitionEnd: onPreviewTransitionEnd,
|
|
67
|
+
blockRef: previewBlockRef,
|
|
68
|
+
onRender: onPreviewRender
|
|
69
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
70
|
+
,
|
|
71
|
+
style: dynamicStyles
|
|
72
|
+
}) : null;
|
|
73
|
+
}
|
|
61
74
|
return showPreview && data && (0, _extractPreview.default)(data) ? /*#__PURE__*/_react.default.createElement(_blocks.PreviewBlock, {
|
|
62
75
|
onError: onPreviewError,
|
|
63
76
|
ignoreContainerPadding: true,
|
|
@@ -33,7 +33,7 @@ var connectButtonStyles = null;
|
|
|
33
33
|
var basePreviewStylesOld = null;
|
|
34
34
|
var basePreviewStyles = null;
|
|
35
35
|
var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
|
|
36
|
-
var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider, _extractRequestAccess;
|
|
36
|
+
var _cardState$details, _cardState$details2, _extractSmartLinkProv, _extractSmartLinkProv2, _extractProvider$text, _extractProvider, _extractRequestAccess;
|
|
37
37
|
var flexibleCardProps = _ref.flexibleCardProps,
|
|
38
38
|
_ref$testId = _ref.testId,
|
|
39
39
|
testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
|
|
@@ -43,7 +43,7 @@ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
|
|
|
43
43
|
url = flexibleCardProps.url;
|
|
44
44
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
45
45
|
var meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
|
|
46
|
-
var product = (_extractProvider$text = (_extractProvider = (0, _linkExtractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
|
|
46
|
+
var product = (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (_extractSmartLinkProv = (_extractSmartLinkProv2 = (0, _linkExtractors.extractSmartLinkProvider)(cardState.details)) === null || _extractSmartLinkProv2 === void 0 ? void 0 : _extractSmartLinkProv2.text) !== null && _extractSmartLinkProv !== void 0 ? _extractSmartLinkProv : '' : (_extractProvider$text = (_extractProvider = (0, _linkExtractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
|
|
47
47
|
var hostname = /*#__PURE__*/React.createElement("b", null, (0, _extractHostname.default)(url));
|
|
48
48
|
var _ref2 = (_extractRequestAccess = (0, _extractAccessContext.extractRequestAccessContextImproved)({
|
|
49
49
|
jsonLd: meta,
|
|
@@ -71,8 +71,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
71
71
|
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
72
72
|
}, []);
|
|
73
73
|
var imagePreview = (0, _ImagePreview.default)({
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
fallbackElementHeight: snippetHeight.current,
|
|
75
|
+
response: cardState.details
|
|
76
76
|
});
|
|
77
77
|
var snippet = imagePreview ? null : /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
|
|
78
78
|
status: _constants.SmartLinkStatus.Resolved,
|
|
@@ -34,7 +34,7 @@ var titleBlockStyles = null;
|
|
|
34
34
|
var mainTextStylesOld = null;
|
|
35
35
|
var mainTextStyles = null;
|
|
36
36
|
var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
37
|
-
var _cardState$details, _extractProvider;
|
|
37
|
+
var _cardState$details, _extractSmartLinkProv, _extractProvider;
|
|
38
38
|
var _ref$id = _ref.id,
|
|
39
39
|
id = _ref$id === void 0 ? '' : _ref$id,
|
|
40
40
|
flexibleCardProps = _ref.flexibleCardProps,
|
|
@@ -43,7 +43,7 @@ var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
|
43
43
|
url = _ref.url;
|
|
44
44
|
var cardState = flexibleCardProps.cardState;
|
|
45
45
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
46
|
-
var providerName = (_extractProvider = (0, _linkExtractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
46
|
+
var providerName = (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (_extractSmartLinkProv = (0, _linkExtractors.extractSmartLinkProvider)(cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = (0, _linkExtractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
47
47
|
var isProductIntegrationSupported = (0, _helpers.hasAuthScopeOverrides)(cardState.details);
|
|
48
48
|
var _useSmartCardActions = (0, _actions.useSmartCardActions)(id, url),
|
|
49
49
|
authorize = _useSmartCardActions.authorize;
|
|
@@ -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.11.0",
|
|
24
24
|
componentName: 'linkUrl'
|
|
25
25
|
};
|
|
26
26
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card",
|
|
5
|
-
packageVersion: "36.
|
|
5
|
+
packageVersion: "36.11.0"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -103,7 +103,7 @@ const Icon = ({
|
|
|
103
103
|
"data-testid": testId
|
|
104
104
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
105
105
|
,
|
|
106
|
-
className: ax([fg('platform-linking-visual-refresh-v1') && styles.container, !fg('platform-smart-card-icon-migration') && iconStylesMapOld[size],
|
|
106
|
+
className: ax([fg('platform-linking-visual-refresh-v1') && styles.container, !fg('platform-smart-card-icon-migration') && iconStylesMapOld[size], positionStyleMap[position], render && !fg('platform-smart-card-icon-migration') && customRenderStyleMapOld[size], render && fg('platform-smart-card-icon-migration') && customRenderStyleMapNew[size], className])
|
|
107
107
|
}), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(Box, {
|
|
108
108
|
xcss: styles.iconWrapperStyle,
|
|
109
109
|
style: {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useState } from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
-
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
3
|
+
import extractPreview, { extractSmartLinkPreviewImage } from '../../../extractors/flexible/extract-preview';
|
|
4
4
|
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
5
5
|
const ImagePreview = ({
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
fallbackElementHeight,
|
|
7
|
+
response
|
|
8
8
|
}) => {
|
|
9
9
|
const transitionStarted = useRef(false);
|
|
10
10
|
const previewBlockRef = useRef(null);
|
|
11
11
|
const [showPreview, setShowPreview] = useState(true);
|
|
12
12
|
const [dynamicStyles, setDynamicStyles] = useState({});
|
|
13
|
+
const data = response === null || response === void 0 ? void 0 : response.data;
|
|
13
14
|
|
|
14
15
|
// Set Preview to a fixed height to enable transitions
|
|
15
16
|
const onPreviewRender = useCallback(() => {
|
|
@@ -40,6 +41,18 @@ const ImagePreview = ({
|
|
|
40
41
|
const onPreviewTransitionEnd = useCallback(() => {
|
|
41
42
|
setShowPreview(false);
|
|
42
43
|
}, []);
|
|
44
|
+
if (fg('smart_links_noun_support')) {
|
|
45
|
+
return showPreview && extractSmartLinkPreviewImage(response) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
46
|
+
onError: onPreviewError,
|
|
47
|
+
ignoreContainerPadding: true,
|
|
48
|
+
onTransitionEnd: onPreviewTransitionEnd,
|
|
49
|
+
blockRef: previewBlockRef,
|
|
50
|
+
onRender: onPreviewRender
|
|
51
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
52
|
+
,
|
|
53
|
+
style: dynamicStyles
|
|
54
|
+
}) : null;
|
|
55
|
+
}
|
|
43
56
|
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
44
57
|
onError: onPreviewError,
|
|
45
58
|
ignoreContainerPadding: true,
|
|
@@ -6,7 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
6
6
|
import { FormattedMessage } from 'react-intl-next';
|
|
7
7
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
8
8
|
import Button from '@atlaskit/button';
|
|
9
|
-
import { extractProvider } from '@atlaskit/link-extractors';
|
|
9
|
+
import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
12
12
|
import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
|
|
@@ -26,7 +26,7 @@ const HoverCardForbiddenView = ({
|
|
|
26
26
|
flexibleCardProps,
|
|
27
27
|
testId = 'hover-card-forbidden-view'
|
|
28
28
|
}) => {
|
|
29
|
-
var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider, _extractRequestAccess;
|
|
29
|
+
var _cardState$details, _cardState$details2, _extractSmartLinkProv, _extractSmartLinkProv2, _extractProvider$text, _extractProvider, _extractRequestAccess;
|
|
30
30
|
const {
|
|
31
31
|
createAnalyticsEvent
|
|
32
32
|
} = useAnalyticsEvents();
|
|
@@ -36,7 +36,7 @@ const HoverCardForbiddenView = ({
|
|
|
36
36
|
} = flexibleCardProps;
|
|
37
37
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
38
38
|
const meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
|
|
39
|
-
const product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
|
|
39
|
+
const product = fg('smart_links_noun_support') ? (_extractSmartLinkProv = (_extractSmartLinkProv2 = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv2 === void 0 ? void 0 : _extractSmartLinkProv2.text) !== null && _extractSmartLinkProv !== void 0 ? _extractSmartLinkProv : '' : (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
|
|
40
40
|
const hostname = /*#__PURE__*/React.createElement("b", null, extractHostname(url));
|
|
41
41
|
const {
|
|
42
42
|
action,
|
|
@@ -64,8 +64,8 @@ const HoverCardResolvedView = ({
|
|
|
64
64
|
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
65
65
|
}, []);
|
|
66
66
|
const imagePreview = ImagePreview({
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
fallbackElementHeight: snippetHeight.current,
|
|
68
|
+
response: cardState.details
|
|
69
69
|
});
|
|
70
70
|
const snippet = imagePreview ? null : /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
71
71
|
status: SmartLinkStatus.Resolved,
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
|
-
import { extractProvider } from '@atlaskit/link-extractors';
|
|
8
|
+
import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
11
11
|
import { ActionName, CardDisplay } from '../../../../../constants';
|
|
@@ -29,12 +29,12 @@ const HoverCardUnauthorisedView = ({
|
|
|
29
29
|
testId = 'hover-card-unauthorised-view',
|
|
30
30
|
url
|
|
31
31
|
}) => {
|
|
32
|
-
var _cardState$details, _extractProvider;
|
|
32
|
+
var _cardState$details, _extractSmartLinkProv, _extractProvider;
|
|
33
33
|
const {
|
|
34
34
|
cardState
|
|
35
35
|
} = flexibleCardProps;
|
|
36
36
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
37
|
-
const providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
37
|
+
const providerName = fg('smart_links_noun_support') ? (_extractSmartLinkProv = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
38
38
|
const isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
|
|
39
39
|
const {
|
|
40
40
|
authorize
|
|
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
10
10
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
11
11
|
const PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "36.
|
|
13
|
+
packageVersion: "36.11.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "36.
|
|
7
|
+
packageVersion: "36.11.0"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
package/dist/esm/utils/mocks.js
CHANGED
|
@@ -109,7 +109,7 @@ var Icon = function Icon(_ref) {
|
|
|
109
109
|
"data-testid": testId
|
|
110
110
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
111
111
|
,
|
|
112
|
-
className: ax([fg('platform-linking-visual-refresh-v1') && styles.container, !fg('platform-smart-card-icon-migration') && iconStylesMapOld[size],
|
|
112
|
+
className: ax([fg('platform-linking-visual-refresh-v1') && styles.container, !fg('platform-smart-card-icon-migration') && iconStylesMapOld[size], positionStyleMap[position], render && !fg('platform-smart-card-icon-migration') && customRenderStyleMapOld[size], render && fg('platform-smart-card-icon-migration') && customRenderStyleMapNew[size], className])
|
|
113
113
|
}), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(Box, {
|
|
114
114
|
xcss: styles.iconWrapperStyle,
|
|
115
115
|
style: {
|
|
@@ -4,11 +4,11 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
7
|
+
import extractPreview, { extractSmartLinkPreviewImage } from '../../../extractors/flexible/extract-preview';
|
|
8
8
|
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
9
9
|
var ImagePreview = function ImagePreview(_ref) {
|
|
10
|
-
var
|
|
11
|
-
|
|
10
|
+
var fallbackElementHeight = _ref.fallbackElementHeight,
|
|
11
|
+
response = _ref.response;
|
|
12
12
|
var transitionStarted = useRef(false);
|
|
13
13
|
var previewBlockRef = useRef(null);
|
|
14
14
|
var _useState = useState(true),
|
|
@@ -19,6 +19,7 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
19
19
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
20
|
dynamicStyles = _useState4[0],
|
|
21
21
|
setDynamicStyles = _useState4[1];
|
|
22
|
+
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
22
23
|
|
|
23
24
|
// Set Preview to a fixed height to enable transitions
|
|
24
25
|
var onPreviewRender = useCallback(function () {
|
|
@@ -48,6 +49,18 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
48
49
|
var onPreviewTransitionEnd = useCallback(function () {
|
|
49
50
|
setShowPreview(false);
|
|
50
51
|
}, []);
|
|
52
|
+
if (fg('smart_links_noun_support')) {
|
|
53
|
+
return showPreview && extractSmartLinkPreviewImage(response) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
54
|
+
onError: onPreviewError,
|
|
55
|
+
ignoreContainerPadding: true,
|
|
56
|
+
onTransitionEnd: onPreviewTransitionEnd,
|
|
57
|
+
blockRef: previewBlockRef,
|
|
58
|
+
onRender: onPreviewRender
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
60
|
+
,
|
|
61
|
+
style: dynamicStyles
|
|
62
|
+
}) : null;
|
|
63
|
+
}
|
|
51
64
|
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
52
65
|
onError: onPreviewError,
|
|
53
66
|
ignoreContainerPadding: true,
|
|
@@ -6,7 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
6
6
|
import { FormattedMessage } from 'react-intl-next';
|
|
7
7
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
8
8
|
import Button from '@atlaskit/button';
|
|
9
|
-
import { extractProvider } from '@atlaskit/link-extractors';
|
|
9
|
+
import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
12
12
|
import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
|
|
@@ -23,7 +23,7 @@ var connectButtonStyles = null;
|
|
|
23
23
|
var basePreviewStylesOld = null;
|
|
24
24
|
var basePreviewStyles = null;
|
|
25
25
|
var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
|
|
26
|
-
var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider, _extractRequestAccess;
|
|
26
|
+
var _cardState$details, _cardState$details2, _extractSmartLinkProv, _extractSmartLinkProv2, _extractProvider$text, _extractProvider, _extractRequestAccess;
|
|
27
27
|
var flexibleCardProps = _ref.flexibleCardProps,
|
|
28
28
|
_ref$testId = _ref.testId,
|
|
29
29
|
testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
|
|
@@ -33,7 +33,7 @@ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
|
|
|
33
33
|
url = flexibleCardProps.url;
|
|
34
34
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
35
35
|
var meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
|
|
36
|
-
var product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
|
|
36
|
+
var product = fg('smart_links_noun_support') ? (_extractSmartLinkProv = (_extractSmartLinkProv2 = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv2 === void 0 ? void 0 : _extractSmartLinkProv2.text) !== null && _extractSmartLinkProv !== void 0 ? _extractSmartLinkProv : '' : (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
|
|
37
37
|
var hostname = /*#__PURE__*/React.createElement("b", null, extractHostname(url));
|
|
38
38
|
var _ref2 = (_extractRequestAccess = extractRequestAccessContextImproved({
|
|
39
39
|
jsonLd: meta,
|
|
@@ -61,8 +61,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
61
61
|
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
62
62
|
}, []);
|
|
63
63
|
var imagePreview = ImagePreview({
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
fallbackElementHeight: snippetHeight.current,
|
|
65
|
+
response: cardState.details
|
|
66
66
|
});
|
|
67
67
|
var snippet = imagePreview ? null : /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
68
68
|
status: SmartLinkStatus.Resolved,
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
|
-
import { extractProvider } from '@atlaskit/link-extractors';
|
|
8
|
+
import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
11
11
|
import { ActionName, CardDisplay } from '../../../../../constants';
|
|
@@ -24,7 +24,7 @@ var titleBlockStyles = null;
|
|
|
24
24
|
var mainTextStylesOld = null;
|
|
25
25
|
var mainTextStyles = null;
|
|
26
26
|
var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
27
|
-
var _cardState$details, _extractProvider;
|
|
27
|
+
var _cardState$details, _extractSmartLinkProv, _extractProvider;
|
|
28
28
|
var _ref$id = _ref.id,
|
|
29
29
|
id = _ref$id === void 0 ? '' : _ref$id,
|
|
30
30
|
flexibleCardProps = _ref.flexibleCardProps,
|
|
@@ -33,7 +33,7 @@ var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
|
33
33
|
url = _ref.url;
|
|
34
34
|
var cardState = flexibleCardProps.cardState;
|
|
35
35
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
36
|
-
var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
36
|
+
var providerName = fg('smart_links_noun_support') ? (_extractSmartLinkProv = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
37
37
|
var isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
|
|
38
38
|
var _useSmartCardActions = useSmartCardActions(id, url),
|
|
39
39
|
authorize = _useSmartCardActions.authorize;
|
|
@@ -13,7 +13,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
13
13
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
14
14
|
var PACKAGE_DATA = {
|
|
15
15
|
packageName: "@atlaskit/smart-card",
|
|
16
|
-
packageVersion: "36.
|
|
16
|
+
packageVersion: "36.11.0",
|
|
17
17
|
componentName: 'linkUrl'
|
|
18
18
|
};
|
|
19
19
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ImagePreviewProps } from '../types';
|
|
3
|
-
declare const ImagePreview: ({
|
|
3
|
+
declare const ImagePreview: ({ fallbackElementHeight, response }: ImagePreviewProps) => React.JSX.Element | null;
|
|
4
4
|
export default ImagePreview;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type MouseEventHandler, type ReactElement } from 'react';
|
|
2
2
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { type JsonLd } from '@atlaskit/json-ld-types';
|
|
4
3
|
import { type CardProviderRenderers } from '@atlaskit/link-provider';
|
|
5
4
|
import { type CardState } from '@atlaskit/linking-common';
|
|
5
|
+
import { type SmartLinkResponse } from '@atlaskit/linking-types';
|
|
6
6
|
import type { ActionName } from '../../constants';
|
|
7
7
|
import { type AnalyticsHandler } from '../../utils/types';
|
|
8
8
|
import type { CardActionOptions } from '../Card/types';
|
|
@@ -101,8 +101,8 @@ export type ContentContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
101
101
|
url: string;
|
|
102
102
|
};
|
|
103
103
|
export type ImagePreviewProps = {
|
|
104
|
-
data: JsonLd.Data.BaseData;
|
|
105
104
|
fallbackElementHeight: number;
|
|
105
|
+
response?: SmartLinkResponse;
|
|
106
106
|
};
|
|
107
107
|
export interface HoverPreviewOptions {
|
|
108
108
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ImagePreviewProps } from '../types';
|
|
3
|
-
declare const ImagePreview: ({
|
|
3
|
+
declare const ImagePreview: ({ fallbackElementHeight, response }: ImagePreviewProps) => React.JSX.Element | null;
|
|
4
4
|
export default ImagePreview;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type MouseEventHandler, type ReactElement } from 'react';
|
|
2
2
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { type JsonLd } from '@atlaskit/json-ld-types';
|
|
4
3
|
import { type CardProviderRenderers } from '@atlaskit/link-provider';
|
|
5
4
|
import { type CardState } from '@atlaskit/linking-common';
|
|
5
|
+
import { type SmartLinkResponse } from '@atlaskit/linking-types';
|
|
6
6
|
import type { ActionName } from '../../constants';
|
|
7
7
|
import { type AnalyticsHandler } from '../../utils/types';
|
|
8
8
|
import type { CardActionOptions } from '../Card/types';
|
|
@@ -101,8 +101,8 @@ export type ContentContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
101
101
|
url: string;
|
|
102
102
|
};
|
|
103
103
|
export type ImagePreviewProps = {
|
|
104
|
-
data: JsonLd.Data.BaseData;
|
|
105
104
|
fallbackElementHeight: number;
|
|
105
|
+
response?: SmartLinkResponse;
|
|
106
106
|
};
|
|
107
107
|
export interface HoverPreviewOptions {
|
|
108
108
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.11.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/link-client-extension": "^4.0.0",
|
|
53
53
|
"@atlaskit/link-extractors": "^2.3.0",
|
|
54
54
|
"@atlaskit/linking-common": "^8.0.0",
|
|
55
|
-
"@atlaskit/linking-types": "^9.
|
|
55
|
+
"@atlaskit/linking-types": "^9.10.0",
|
|
56
56
|
"@atlaskit/logo": "^16.0.0",
|
|
57
57
|
"@atlaskit/lozenge": "^12.2.0",
|
|
58
58
|
"@atlaskit/menu": "^3.2.0",
|
|
@@ -91,15 +91,15 @@
|
|
|
91
91
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@af/integration-testing": "
|
|
95
|
-
"@af/visual-regression": "
|
|
94
|
+
"@af/integration-testing": "workspace:^",
|
|
95
|
+
"@af/visual-regression": "workspace:^",
|
|
96
96
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
97
97
|
"@atlaskit/css-reset": "^7.2.0",
|
|
98
98
|
"@atlaskit/link-test-helpers": "^8.0.0",
|
|
99
99
|
"@atlaskit/media-test-helpers": "^35.0.0",
|
|
100
|
-
"@atlaskit/react-ufo": "^3.
|
|
101
|
-
"@atlaskit/ssr": "
|
|
102
|
-
"@atlaskit/visual-regression": "
|
|
100
|
+
"@atlaskit/react-ufo": "^3.8.0",
|
|
101
|
+
"@atlaskit/ssr": "workspace:^",
|
|
102
|
+
"@atlaskit/visual-regression": "workspace:^",
|
|
103
103
|
"@atlassian/analytics-tooling": "^0.5.0",
|
|
104
104
|
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
105
105
|
"@atlassian/gemini": "^1.17.0",
|