@atlaskit/smart-card 26.28.2 → 26.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +399 -389
- package/dist/cjs/extractors/common/context/extractAccessContext.js +2 -1
- package/dist/cjs/extractors/flexible/extract-preview.js +3 -0
- package/dist/cjs/messages.js +11 -15
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
- package/dist/cjs/view/FlexibleCard/utils.js +4 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +1 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +9 -0
- package/dist/cjs/view/HoverCard/components/views/forbidden/index.js +82 -0
- package/dist/cjs/view/HoverCard/components/views/forbidden/styled.js +18 -0
- package/dist/cjs/view/HoverCard/components/views/forbidden/types.js +5 -0
- package/dist/cjs/view/HoverCard/styled.js +2 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/common/context/extractAccessContext.js +2 -1
- package/dist/es2019/extractors/flexible/extract-preview.js +3 -0
- package/dist/es2019/messages.js +11 -15
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
- package/dist/es2019/view/FlexibleCard/utils.js +4 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +9 -0
- package/dist/es2019/view/HoverCard/components/views/forbidden/index.js +72 -0
- package/dist/es2019/view/HoverCard/components/views/forbidden/styled.js +17 -0
- package/dist/es2019/view/HoverCard/components/views/forbidden/types.js +1 -0
- package/dist/es2019/view/HoverCard/styled.js +3 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/common/context/extractAccessContext.js +2 -1
- package/dist/esm/extractors/flexible/extract-preview.js +3 -0
- package/dist/esm/messages.js +11 -15
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
- package/dist/esm/view/FlexibleCard/utils.js +4 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +9 -0
- package/dist/esm/view/HoverCard/components/views/forbidden/index.js +71 -0
- package/dist/esm/view/HoverCard/components/views/forbidden/styled.js +8 -0
- package/dist/esm/view/HoverCard/components/views/forbidden/types.js +1 -0
- package/dist/esm/view/HoverCard/styled.js +2 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/HoverCard/components/views/forbidden/index.d.ts +4 -0
- package/dist/types/view/HoverCard/components/views/forbidden/styled.d.ts +3 -0
- package/dist/types/view/HoverCard/components/views/forbidden/types.d.ts +13 -0
- package/dist/types/view/HoverCard/styled.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/index.d.ts +4 -0
- package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/styled.d.ts +3 -0
- package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/types.d.ts +13 -0
- package/dist/types-ts4.5/view/HoverCard/styled.d.ts +1 -1
- package/package.json +6 -3
|
@@ -7,6 +7,7 @@ import { extractErrorIcon } from '../../extractors/flexible/icon';
|
|
|
7
7
|
import { handleOnClick } from '../../utils';
|
|
8
8
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
9
9
|
import extractProviderIcon from '../../extractors/flexible/icon/extract-provider-icon';
|
|
10
|
+
import extractPreview from '../../extractors/flexible/extract-preview';
|
|
10
11
|
export var getContextByStatus = function getContextByStatus(params) {
|
|
11
12
|
var _ref = params !== null && params !== void 0 ? params : {},
|
|
12
13
|
response = _ref.response,
|
|
@@ -27,13 +28,15 @@ export var getContextByStatus = function getContextByStatus(params) {
|
|
|
27
28
|
case SmartLinkStatus.Errored:
|
|
28
29
|
case SmartLinkStatus.Fallback:
|
|
29
30
|
default:
|
|
31
|
+
var preview = extractPreview(response === null || response === void 0 ? void 0 : response.data);
|
|
30
32
|
var linkIcon = extractErrorIcon(response, status);
|
|
31
33
|
var provider = extractProviderIcon(response === null || response === void 0 ? void 0 : response.data);
|
|
32
34
|
return {
|
|
33
35
|
linkIcon: linkIcon,
|
|
34
36
|
title: url,
|
|
35
37
|
url: url,
|
|
36
|
-
provider: provider
|
|
38
|
+
provider: provider,
|
|
39
|
+
preview: preview
|
|
37
40
|
};
|
|
38
41
|
}
|
|
39
42
|
};
|
|
@@ -208,7 +208,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
208
208
|
id: id,
|
|
209
209
|
source: HOVER_CARD_SOURCE
|
|
210
210
|
}, jsx(HoverCardContent, hoverCardContentProps));
|
|
211
|
-
}, [
|
|
211
|
+
}, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
|
|
212
212
|
var trigger = useCallback(function (triggerProps) {
|
|
213
213
|
return jsx("span", {
|
|
214
214
|
ref: parentSpan
|
|
@@ -19,6 +19,8 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
19
19
|
import { messages } from '../../../messages';
|
|
20
20
|
import { fireLinkClickedEvent } from '../../../utils/analytics/click';
|
|
21
21
|
import { useSmartCardState } from '../../../state/store';
|
|
22
|
+
import HoverCardForbiddenView from './views/forbidden';
|
|
23
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
22
24
|
export var hoverCardClassName = 'smart-links-hover-preview';
|
|
23
25
|
export var getCopyAction = function getCopyAction(url) {
|
|
24
26
|
return {
|
|
@@ -169,6 +171,13 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
169
171
|
url: url
|
|
170
172
|
});
|
|
171
173
|
}
|
|
174
|
+
if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
|
|
175
|
+
if (cardState.status === 'forbidden') {
|
|
176
|
+
return jsx(HoverCardForbiddenView, {
|
|
177
|
+
flexibleCardProps: flexibleCardProps
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
172
181
|
if (cardState.status === 'resolved') {
|
|
173
182
|
return jsx(HoverCardResolvedView, {
|
|
174
183
|
id: id,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
+
import FlexibleCard from '../../../../FlexibleCard';
|
|
5
|
+
import { messages } from '../../../../../messages';
|
|
6
|
+
import { CustomBlock, PreviewBlock } from '../../../../FlexibleCard/components/blocks';
|
|
7
|
+
import { extractProvider } from '@atlaskit/link-extractors';
|
|
8
|
+
import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
|
|
9
|
+
import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
|
|
10
|
+
import { ActionName } from '../../../../../constants';
|
|
11
|
+
import { getPreviewBlockStyles } from '../../../styled';
|
|
12
|
+
import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
|
|
13
|
+
var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
|
|
14
|
+
var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider;
|
|
15
|
+
var flexibleCardProps = _ref.flexibleCardProps,
|
|
16
|
+
_ref$testId = _ref.testId,
|
|
17
|
+
testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
|
|
18
|
+
var cardState = flexibleCardProps.cardState,
|
|
19
|
+
url = flexibleCardProps.url;
|
|
20
|
+
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
21
|
+
var meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
|
|
22
|
+
var product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
|
|
23
|
+
var hostname = new URL(url).hostname;
|
|
24
|
+
var _extractRequestAccess = extractRequestAccessContextImproved({
|
|
25
|
+
jsonLd: meta,
|
|
26
|
+
url: url,
|
|
27
|
+
product: product
|
|
28
|
+
}),
|
|
29
|
+
action = _extractRequestAccess.action,
|
|
30
|
+
descriptiveMessageKey = _extractRequestAccess.descriptiveMessageKey,
|
|
31
|
+
titleMessageKey = _extractRequestAccess.titleMessageKey;
|
|
32
|
+
var actions = useMemo(function () {
|
|
33
|
+
return [{
|
|
34
|
+
name: ActionName.CustomAction,
|
|
35
|
+
content: action === null || action === void 0 ? void 0 : action.text,
|
|
36
|
+
onClick: action === null || action === void 0 ? void 0 : action.promise
|
|
37
|
+
}];
|
|
38
|
+
}, [action]);
|
|
39
|
+
if (!titleMessageKey || !descriptiveMessageKey) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return /*#__PURE__*/React.createElement(FlexibleCard, _extends({}, flexibleCardProps, {
|
|
43
|
+
testId: testId
|
|
44
|
+
}), /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
45
|
+
ignoreContainerPadding: true,
|
|
46
|
+
overrideCss: getPreviewBlockStyles(),
|
|
47
|
+
testId: testId
|
|
48
|
+
}), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
49
|
+
overrideCss: titleBlockStyles,
|
|
50
|
+
testId: "".concat(testId, "-title")
|
|
51
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[titleMessageKey], {
|
|
52
|
+
values: {
|
|
53
|
+
product: product
|
|
54
|
+
}
|
|
55
|
+
}))), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
56
|
+
overrideCss: mainTextStyles,
|
|
57
|
+
testId: "".concat(testId, "-content")
|
|
58
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[descriptiveMessageKey], {
|
|
59
|
+
values: {
|
|
60
|
+
product: product,
|
|
61
|
+
hostname: hostname
|
|
62
|
+
}
|
|
63
|
+
}))), action && /*#__PURE__*/React.createElement(CustomBlock, {
|
|
64
|
+
overrideCss: connectButtonStyles,
|
|
65
|
+
testId: "".concat(testId, "-button")
|
|
66
|
+
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
67
|
+
items: actions,
|
|
68
|
+
appearance: "primary"
|
|
69
|
+
})));
|
|
70
|
+
};
|
|
71
|
+
export default HoverCardForbiddenView;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
var blockGap = '0rem';
|
|
5
|
+
var titleFontWeight = '600';
|
|
6
|
+
export var titleBlockStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n justify-content: center;\n font-weight: ", ";\n"])), titleFontWeight);
|
|
7
|
+
export var mainTextStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n justify-content: center;\n margin-top: ", ";\n font-size: 0.75rem;\n text-align: center;\n"])), blockGap);
|
|
8
|
+
export var connectButtonStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n justify-content: center;\n margin-top: ", ";\n"])), blockGap);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -40,6 +40,6 @@ export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _t
|
|
|
40
40
|
light: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
41
41
|
dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
|
|
42
42
|
})());
|
|
43
|
-
export var getPreviewBlockStyles = function getPreviewBlockStyles(
|
|
44
|
-
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n
|
|
43
|
+
export var getPreviewBlockStyles = function getPreviewBlockStyles(previewHeight) {
|
|
44
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n"])), previewHeight ? "height: ".concat(previewHeight, "px;") : '', 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 }") : "");
|
|
45
45
|
};
|
|
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
11
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
var PACKAGE_DATA = {
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "26.
|
|
14
|
+
packageVersion: "26.29.0",
|
|
15
15
|
componentName: 'linkUrl'
|
|
16
16
|
};
|
|
17
17
|
var Link = withLinkClickedEvent('a');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FlexibleCardProps } from '../../../../FlexibleCard/types';
|
|
2
|
+
export type HoverCardForbiddenProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Data required for rendering a Flexible Card
|
|
5
|
+
*/
|
|
6
|
+
flexibleCardProps: FlexibleCardProps;
|
|
7
|
+
/**
|
|
8
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
9
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
10
|
+
* serving as a hook for automated tests
|
|
11
|
+
*/
|
|
12
|
+
testId?: string;
|
|
13
|
+
};
|
|
@@ -8,4 +8,4 @@ export declare const HoverCardContainer: import("@emotion/react").SerializedStyl
|
|
|
8
8
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
9
9
|
export declare const getTransitionStyles: (snippetHeight: number) => import("@emotion/react").SerializedStyles;
|
|
10
10
|
export declare const popupContainerStyles: import("@emotion/react").SerializedStyles;
|
|
11
|
-
export declare const getPreviewBlockStyles: (
|
|
11
|
+
export declare const getPreviewBlockStyles: (previewHeight?: number) => import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FlexibleCardProps } from '../../../../FlexibleCard/types';
|
|
2
|
+
export type HoverCardForbiddenProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Data required for rendering a Flexible Card
|
|
5
|
+
*/
|
|
6
|
+
flexibleCardProps: FlexibleCardProps;
|
|
7
|
+
/**
|
|
8
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
9
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
10
|
+
* serving as a hook for automated tests
|
|
11
|
+
*/
|
|
12
|
+
testId?: string;
|
|
13
|
+
};
|
|
@@ -8,4 +8,4 @@ export declare const HoverCardContainer: import("@emotion/react").SerializedStyl
|
|
|
8
8
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
9
9
|
export declare const getTransitionStyles: (snippetHeight: number) => import("@emotion/react").SerializedStyles;
|
|
10
10
|
export declare const popupContainerStyles: import("@emotion/react").SerializedStyles;
|
|
11
|
-
export declare const getPreviewBlockStyles: (
|
|
11
|
+
export declare const getPreviewBlockStyles: (previewHeight?: number) => import("@emotion/react").SerializedStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.29.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@atlaskit/in-product-testing": "^0.2.0",
|
|
38
38
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
39
39
|
"@atlaskit/link-client-extension": "^1.7.0",
|
|
40
|
-
"@atlaskit/link-extractors": "^1.
|
|
40
|
+
"@atlaskit/link-extractors": "^1.2.0",
|
|
41
41
|
"@atlaskit/linking-common": "^4.10.0",
|
|
42
|
-
"@atlaskit/linking-types": "^8.
|
|
42
|
+
"@atlaskit/linking-types": "^8.4.0",
|
|
43
43
|
"@atlaskit/logo": "^13.14.0",
|
|
44
44
|
"@atlaskit/lozenge": "^11.4.0",
|
|
45
45
|
"@atlaskit/modal-dialog": "^12.7.0",
|
|
@@ -154,6 +154,9 @@
|
|
|
154
154
|
},
|
|
155
155
|
"platform.linking-platform.smart-card.iframes-allow-storage-access-by-user-activation": {
|
|
156
156
|
"type": "boolean"
|
|
157
|
+
},
|
|
158
|
+
"platform.linking-platform.smart-card.cross-join": {
|
|
159
|
+
"type": "boolean"
|
|
157
160
|
}
|
|
158
161
|
},
|
|
159
162
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|