@atlaskit/smart-card 21.1.2 → 21.2.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 +28 -0
- package/dist/cjs/extractors/block/index.js +3 -2
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +2 -0
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +12 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/actions/PreviewAction.js +1 -1
- package/dist/cjs/view/BlockCard/index.js +10 -0
- package/dist/cjs/view/CardWithUrl/component.js +1 -1
- package/dist/cjs/view/EmbedModal/components/embed-content/index.js +1 -1
- package/dist/cjs/view/EmbedModal/components/link-info/index.js +4 -2
- package/dist/cjs/view/EmbedModal/components/link-info/link-info-button/index.js +1 -0
- package/dist/cjs/view/EmbedModal/components/link-info/styled.js +7 -14
- package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +41 -0
- package/dist/cjs/view/EmbedModal/components/size-experiment/types.js +5 -0
- package/dist/cjs/view/EmbedModal/index.js +7 -3
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +20 -8
- package/dist/es2019/extractors/block/index.js +2 -1
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +2 -1
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +11 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/actions/PreviewAction.js +1 -1
- package/dist/es2019/view/BlockCard/index.js +9 -0
- package/dist/es2019/view/CardWithUrl/component.js +1 -1
- package/dist/es2019/view/EmbedModal/components/embed-content/index.js +1 -1
- package/dist/es2019/view/EmbedModal/components/link-info/index.js +4 -2
- package/dist/es2019/view/EmbedModal/components/link-info/link-info-button/index.js +1 -0
- package/dist/es2019/view/EmbedModal/components/link-info/styled.js +24 -19
- package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +28 -0
- package/dist/es2019/view/EmbedModal/components/size-experiment/types.js +1 -0
- package/dist/es2019/view/EmbedModal/index.js +5 -3
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +17 -6
- package/dist/esm/extractors/block/index.js +3 -2
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -0
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +11 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -1
- package/dist/esm/view/BlockCard/index.js +9 -0
- package/dist/esm/view/CardWithUrl/component.js +1 -1
- package/dist/esm/view/EmbedModal/components/embed-content/index.js +1 -1
- package/dist/esm/view/EmbedModal/components/link-info/index.js +4 -2
- package/dist/esm/view/EmbedModal/components/link-info/link-info-button/index.js +1 -0
- package/dist/esm/view/EmbedModal/components/link-info/styled.js +6 -9
- package/dist/esm/view/EmbedModal/components/size-experiment/index.js +28 -0
- package/dist/esm/view/EmbedModal/components/size-experiment/types.js +1 -0
- package/dist/esm/view/EmbedModal/index.js +6 -3
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +18 -8
- package/dist/types/extractors/block/types.d.ts +2 -0
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +2 -1
- package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +4 -2
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/EmbedModal/components/link-info/styled.d.ts +0 -1
- package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +6 -0
- package/dist/types/view/EmbedModal/components/size-experiment/types.d.ts +4 -0
- package/dist/types/view/EmbedModal/index.d.ts +1 -1
- package/dist/types/view/EmbedModal/types.d.ts +4 -0
- package/package.json +5 -5
- package/report.api.md +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Modal from '../../../common/Modal';
|
|
4
|
+
import { MAX_MODAL_SIZE, MIN_MODAL_SIZE } from '../../constants';
|
|
5
|
+
|
|
6
|
+
const withSizeExperiment = Component => props => {
|
|
7
|
+
const {
|
|
8
|
+
featureFlags = {},
|
|
9
|
+
closeLabel = 'Close Preview'
|
|
10
|
+
} = props;
|
|
11
|
+
const {
|
|
12
|
+
embedModalSize
|
|
13
|
+
} = featureFlags; // Experiment
|
|
14
|
+
|
|
15
|
+
if (embedModalSize === 'large' || embedModalSize === 'small') {
|
|
16
|
+
const size = embedModalSize === 'large' ? MAX_MODAL_SIZE : MIN_MODAL_SIZE;
|
|
17
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
18
|
+
size: size
|
|
19
|
+
}));
|
|
20
|
+
} // Control
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
return /*#__PURE__*/React.createElement(Modal, _extends({}, props, {
|
|
24
|
+
closeLabel: closeLabel
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default withSizeExperiment;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import LinkInfo from './components/link-info';
|
|
|
4
4
|
import { MAX_MODAL_SIZE, MIN_MODAL_SIZE } from './constants';
|
|
5
5
|
import EmbedContent from './components/embed-content';
|
|
6
6
|
import withErrorBoundary from './components/error-boundary';
|
|
7
|
+
import withSizeExperiment from './components/size-experiment';
|
|
7
8
|
|
|
8
9
|
const EmbedModal = ({
|
|
9
10
|
download: downloadUrl,
|
|
@@ -16,13 +17,14 @@ const EmbedModal = ({
|
|
|
16
17
|
onViewActionClick,
|
|
17
18
|
providerName,
|
|
18
19
|
showModal,
|
|
20
|
+
size: defaultSize = MIN_MODAL_SIZE,
|
|
19
21
|
src,
|
|
20
|
-
testId = 'smart-
|
|
22
|
+
testId = 'smart-embed-preview-modal',
|
|
21
23
|
title,
|
|
22
24
|
url
|
|
23
25
|
}) => {
|
|
24
26
|
const [isOpen, setIsOpen] = useState(showModal);
|
|
25
|
-
const [size, setSize] = useState(
|
|
27
|
+
const [size, setSize] = useState(defaultSize);
|
|
26
28
|
const handleOnClose = useCallback(() => setIsOpen(false), []);
|
|
27
29
|
const handleOnSizeClick = useCallback(() => {
|
|
28
30
|
const newSize = size === MIN_MODAL_SIZE ? MAX_MODAL_SIZE : MIN_MODAL_SIZE;
|
|
@@ -54,4 +56,4 @@ const EmbedModal = ({
|
|
|
54
56
|
}))));
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
export default withErrorBoundary(EmbedModal);
|
|
59
|
+
export default withSizeExperiment(withErrorBoundary(EmbedModal));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Loadable from 'react-loadable';
|
|
3
3
|
import { B200, B400, N700, R400 } from '@atlaskit/theme/colors';
|
|
4
|
+
import DocumentIcon from '@atlaskit/icon-file-type/glyph/document/16';
|
|
5
|
+
import BlogIcon from '@atlaskit/icon-object/glyph/blog/16';
|
|
4
6
|
import { IconType } from '../../../../../constants';
|
|
5
7
|
import { token } from '@atlaskit/tokens'; // prettier-ignore
|
|
6
8
|
|
|
@@ -11,15 +13,9 @@ const importIconMapper = {
|
|
|
11
13
|
[IconType.Audio]: () => import(
|
|
12
14
|
/* webpackChunkName: "glyphAudio" */
|
|
13
15
|
'@atlaskit/icon-file-type/glyph/audio/16'),
|
|
14
|
-
[IconType.Blog]: () => import(
|
|
15
|
-
/* webpackChunkName: "glyphBlog" */
|
|
16
|
-
'@atlaskit/icon-object/glyph/blog/16'),
|
|
17
16
|
[IconType.Code]: () => import(
|
|
18
17
|
/* webpackChunkName: "glyphCode" */
|
|
19
18
|
'@atlaskit/icon-file-type/glyph/source-code/16'),
|
|
20
|
-
[IconType.Document]: () => import(
|
|
21
|
-
/* webpackChunkName: "glyphDocument" */
|
|
22
|
-
'@atlaskit/icon-file-type/glyph/document/16'),
|
|
23
19
|
[IconType.Executable]: () => import(
|
|
24
20
|
/* webpackChunkName: "glyphExecutable" */
|
|
25
21
|
'@atlaskit/icon-file-type/glyph/executable/16'),
|
|
@@ -214,6 +210,21 @@ const AtlaskitIcon = ({
|
|
|
214
210
|
label,
|
|
215
211
|
testId
|
|
216
212
|
}) => {
|
|
213
|
+
// Check for synchonously loaded icons first for SSR purposes
|
|
214
|
+
switch (icon) {
|
|
215
|
+
case IconType.Document:
|
|
216
|
+
return /*#__PURE__*/React.createElement(DocumentIcon, {
|
|
217
|
+
label: label || 'document',
|
|
218
|
+
testId: testId
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
case IconType.Blog:
|
|
222
|
+
return /*#__PURE__*/React.createElement(BlogIcon, {
|
|
223
|
+
label: label || 'blog',
|
|
224
|
+
testId: testId
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
217
228
|
const importFn = getIconImportFn(icon);
|
|
218
229
|
|
|
219
230
|
if (!importFn) {
|
|
@@ -37,13 +37,14 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
|
|
|
37
37
|
|
|
38
38
|
export var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform) {
|
|
39
39
|
if (opts) {
|
|
40
|
-
var
|
|
40
|
+
var featureFlags = opts.featureFlags,
|
|
41
|
+
handleInvoke = opts.handleInvoke,
|
|
41
42
|
handleAnalytics = opts.handleAnalytics,
|
|
42
43
|
extensionKey = opts.extensionKey,
|
|
43
44
|
source = opts.source,
|
|
44
45
|
testId = opts.testId;
|
|
45
46
|
var actions = extractActions(jsonLd, handleInvoke);
|
|
46
|
-
var previewAction = extractPreviewAction(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform, source); // The previewAction should always be the last action
|
|
47
|
+
var previewAction = extractPreviewAction(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform, source, featureFlags); // The previewAction should always be the last action
|
|
47
48
|
|
|
48
49
|
if (previewAction) {
|
|
49
50
|
actions.push(previewAction);
|
|
@@ -60,6 +60,7 @@ export var extractPreviewAction = function extractPreviewAction() {
|
|
|
60
60
|
var testId = arguments.length > 5 ? arguments[5] : undefined;
|
|
61
61
|
var platform = arguments.length > 6 ? arguments[6] : undefined;
|
|
62
62
|
var source = arguments.length > 7 ? arguments[7] : undefined;
|
|
63
|
+
var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
|
|
63
64
|
// Extract metadata from view props & raw JSON-LD.
|
|
64
65
|
var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
65
66
|
var metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -71,6 +72,7 @@ export var extractPreviewAction = function extractPreviewAction() {
|
|
|
71
72
|
// Build action using instrumentation hooks.
|
|
72
73
|
var key = extensionKey;
|
|
73
74
|
var previewAction = PreviewAction(_objectSpread(_objectSpread({}, metadata), {}, {
|
|
75
|
+
featureFlags: featureFlags,
|
|
74
76
|
testId: testId,
|
|
75
77
|
onOpen: function onOpen() {
|
|
76
78
|
handleAnalytics(uiRenderSuccessEvent('preview', 'resolved', key));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import uuid from 'uuid';
|
|
4
|
+
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
4
5
|
import { extractBlockProps as extractCardProps } from '../../extractors/block';
|
|
5
6
|
import { useSmartCardActions as useLinkActions } from '../actions';
|
|
6
7
|
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
@@ -23,13 +24,21 @@ export function useSmartLinkActions(_ref) {
|
|
|
23
24
|
|
|
24
25
|
var linkState = useLinkState(url);
|
|
25
26
|
var linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
|
|
26
|
-
var linkActions = useLinkActions(id, url, linkAnalytics);
|
|
27
|
+
var linkActions = useLinkActions(id, url, linkAnalytics); // Actions do not have access to the react tree, so we need to obtain
|
|
28
|
+
// feature flags here where we still can access SmartLinkContext context
|
|
29
|
+
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
30
|
+
|
|
31
|
+
var embedModalSize = useFeatureFlag('embedModalSize');
|
|
27
32
|
useEffect(function () {
|
|
28
33
|
if (!linkState.details) {
|
|
29
34
|
return;
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
var featureFlags = {
|
|
38
|
+
embedModalSize: embedModalSize
|
|
39
|
+
};
|
|
32
40
|
var cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
|
|
41
|
+
featureFlags: featureFlags,
|
|
33
42
|
handleInvoke: function handleInvoke(opts) {
|
|
34
43
|
return linkActions.invoke(opts, appearance);
|
|
35
44
|
},
|
|
@@ -50,6 +59,6 @@ export function useSmartLinkActions(_ref) {
|
|
|
50
59
|
};
|
|
51
60
|
});
|
|
52
61
|
setActions(cardActions);
|
|
53
|
-
}, [linkState, linkActions, analyticsHandler, appearance, platform]);
|
|
62
|
+
}, [linkState, linkActions, analyticsHandler, appearance, platform, embedModalSize]);
|
|
54
63
|
return actions;
|
|
55
64
|
}
|
package/dist/esm/version.json
CHANGED
|
@@ -14,6 +14,7 @@ import { ResolvingView as BlockCardResolvingView } from './views/ResolvingView';
|
|
|
14
14
|
import { UnauthorizedView as BlockCardUnauthorisedView } from './views/UnauthorizedView';
|
|
15
15
|
import { ForbiddenView as BlockCardForbiddenView } from './views/ForbiddenView';
|
|
16
16
|
import { ErroredView as BlockCardErroredView } from './views/ErroredView';
|
|
17
|
+
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
17
18
|
export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
|
|
18
19
|
export var BlockCard = function BlockCard(_ref) {
|
|
19
20
|
var _details$meta, _forbiddenViewProps$c;
|
|
@@ -35,9 +36,17 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
35
36
|
testId = _ref.testId,
|
|
36
37
|
showActions = _ref.showActions,
|
|
37
38
|
platform = _ref.platform;
|
|
39
|
+
// Actions do not have access to the react tree, so we need to obtain
|
|
40
|
+
// feature flags here where we still can access SmartLinkContext context
|
|
41
|
+
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
42
|
+
var embedModalSize = useFeatureFlag('embedModalSize');
|
|
43
|
+
var featureFlags = {
|
|
44
|
+
embedModalSize: embedModalSize
|
|
45
|
+
};
|
|
38
46
|
var data = details && details.data || getEmptyJsonLd();
|
|
39
47
|
var meta = details && details.meta;
|
|
40
48
|
var extractorOpts = {
|
|
49
|
+
featureFlags: featureFlags,
|
|
41
50
|
handleAnalytics: handleAnalytics,
|
|
42
51
|
handleInvoke: handleInvoke,
|
|
43
52
|
extensionKey: getExtensionKey(details)
|
|
@@ -53,7 +53,7 @@ export function CardWithUrlContent(_ref) {
|
|
|
53
53
|
var showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
|
|
54
54
|
|
|
55
55
|
if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
|
|
56
|
-
showHoverPreview = showHoverPreviewFlag;
|
|
56
|
+
showHoverPreview = Boolean(showHoverPreviewFlag);
|
|
57
57
|
} // Setup UI handlers.
|
|
58
58
|
|
|
59
59
|
|
|
@@ -6,7 +6,7 @@ var _templateObject;
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import { css, jsx } from '@emotion/core';
|
|
8
8
|
import { getIframeSandboxAttribute } from '../../../../utils';
|
|
9
|
-
var iframeCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: calc(100vh -
|
|
9
|
+
var iframeCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: calc(100vh - 208px);\n"])));
|
|
10
10
|
|
|
11
11
|
var EmbedContent = function EmbedContent(_ref) {
|
|
12
12
|
var isTrusted = _ref.isTrusted,
|
|
@@ -65,12 +65,14 @@ var LinkInfo = function LinkInfo(_ref) {
|
|
|
65
65
|
}) : jsx(VidFullScreenOnIcon, {
|
|
66
66
|
label: message.defaultMessage
|
|
67
67
|
});
|
|
68
|
-
return jsx(
|
|
68
|
+
return jsx("span", {
|
|
69
|
+
className: "smart-link-resize-button"
|
|
70
|
+
}, jsx(LinkInfoButton, {
|
|
69
71
|
content: jsx(FormattedMessage, message),
|
|
70
72
|
icon: icon,
|
|
71
73
|
onClick: onResizeButtonClick,
|
|
72
74
|
testId: "".concat(testId, "-resize")
|
|
73
|
-
});
|
|
75
|
+
}));
|
|
74
76
|
}, [onResizeButtonClick, size, testId]);
|
|
75
77
|
return jsx("div", {
|
|
76
78
|
css: containerStyles
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/core';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { N100 } from '@atlaskit/theme/colors';
|
|
9
|
-
export var containerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n gap: ", ";\n justify-content: space-between;\n padding: ", " ", ";\n"])), gs(2), gs(2), gs(3));
|
|
10
|
-
var iconSize = '32px';
|
|
6
|
+
export var containerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n gap: 8px;\n justify-content: space-between;\n // AK ModalBody has 2px padding top and bottom.\n // Using 14px here to create 16px gap between\n // link info and iframe\n padding: 24px 24px 14px 24px;\n"])));
|
|
7
|
+
var iconSize = '24px';
|
|
11
8
|
export var iconCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n img,\n span,\n svg {\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n }\n"])), iconSize, iconSize, iconSize, iconSize, iconSize, iconSize);
|
|
12
|
-
|
|
13
|
-
export var
|
|
14
|
-
export var actionCss = css(
|
|
9
|
+
var height = '20px';
|
|
10
|
+
export var titleCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n\n h3 {\n flex: 1 1 auto;\n font-size: 16px;\n font-weight: 400;\n line-height: ", ";\n\n display: -webkit-box;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n // Fallback options\n @supports not (-webkit-line-clamp: 1) {\n max-height: ", ";\n }\n }\n"])), height, height);
|
|
11
|
+
export var actionCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n gap: 4px;\n line-height: ", ";\n span {\n line-height: ", ";\n }\n\n @media only screen and (max-width: 980px) {\n // Hide resize button if the screen is smaller than the min width\n // or too small to have enough impact to matter.\n .smart-link-resize-button {\n display: none;\n }\n }\n"])), height, height);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Modal from '../../../common/Modal';
|
|
4
|
+
import { MAX_MODAL_SIZE, MIN_MODAL_SIZE } from '../../constants';
|
|
5
|
+
|
|
6
|
+
var withSizeExperiment = function withSizeExperiment(Component) {
|
|
7
|
+
return function (props) {
|
|
8
|
+
var _props$featureFlags = props.featureFlags,
|
|
9
|
+
featureFlags = _props$featureFlags === void 0 ? {} : _props$featureFlags,
|
|
10
|
+
_props$closeLabel = props.closeLabel,
|
|
11
|
+
closeLabel = _props$closeLabel === void 0 ? 'Close Preview' : _props$closeLabel;
|
|
12
|
+
var embedModalSize = featureFlags.embedModalSize; // Experiment
|
|
13
|
+
|
|
14
|
+
if (embedModalSize === 'large' || embedModalSize === 'small') {
|
|
15
|
+
var size = embedModalSize === 'large' ? MAX_MODAL_SIZE : MIN_MODAL_SIZE;
|
|
16
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
17
|
+
size: size
|
|
18
|
+
}));
|
|
19
|
+
} // Control
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
return /*#__PURE__*/React.createElement(Modal, _extends({}, props, {
|
|
23
|
+
closeLabel: closeLabel
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default withSizeExperiment;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,7 @@ import LinkInfo from './components/link-info';
|
|
|
5
5
|
import { MAX_MODAL_SIZE, MIN_MODAL_SIZE } from './constants';
|
|
6
6
|
import EmbedContent from './components/embed-content';
|
|
7
7
|
import withErrorBoundary from './components/error-boundary';
|
|
8
|
+
import withSizeExperiment from './components/size-experiment';
|
|
8
9
|
|
|
9
10
|
var EmbedModal = function EmbedModal(_ref) {
|
|
10
11
|
var downloadUrl = _ref.download,
|
|
@@ -18,9 +19,11 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
18
19
|
onViewActionClick = _ref.onViewActionClick,
|
|
19
20
|
providerName = _ref.providerName,
|
|
20
21
|
showModal = _ref.showModal,
|
|
22
|
+
_ref$size = _ref.size,
|
|
23
|
+
defaultSize = _ref$size === void 0 ? MIN_MODAL_SIZE : _ref$size,
|
|
21
24
|
src = _ref.src,
|
|
22
25
|
_ref$testId = _ref.testId,
|
|
23
|
-
testId = _ref$testId === void 0 ? 'smart-
|
|
26
|
+
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
24
27
|
title = _ref.title,
|
|
25
28
|
url = _ref.url;
|
|
26
29
|
|
|
@@ -29,7 +32,7 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
29
32
|
isOpen = _useState2[0],
|
|
30
33
|
setIsOpen = _useState2[1];
|
|
31
34
|
|
|
32
|
-
var _useState3 = useState(
|
|
35
|
+
var _useState3 = useState(defaultSize),
|
|
33
36
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
37
|
size = _useState4[0],
|
|
35
38
|
setSize = _useState4[1];
|
|
@@ -67,4 +70,4 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
67
70
|
}))));
|
|
68
71
|
};
|
|
69
72
|
|
|
70
|
-
export default withErrorBoundary(EmbedModal);
|
|
73
|
+
export default withSizeExperiment(withErrorBoundary(EmbedModal));
|
|
@@ -5,6 +5,8 @@ var _importIconMapper;
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import Loadable from 'react-loadable';
|
|
7
7
|
import { B200, B400, N700, R400 } from '@atlaskit/theme/colors';
|
|
8
|
+
import DocumentIcon from '@atlaskit/icon-file-type/glyph/document/16';
|
|
9
|
+
import BlogIcon from '@atlaskit/icon-object/glyph/blog/16';
|
|
8
10
|
import { IconType } from '../../../../../constants';
|
|
9
11
|
import { token } from '@atlaskit/tokens'; // prettier-ignore
|
|
10
12
|
|
|
@@ -16,18 +18,10 @@ var importIconMapper = (_importIconMapper = {}, _defineProperty(_importIconMappe
|
|
|
16
18
|
return import(
|
|
17
19
|
/* webpackChunkName: "glyphAudio" */
|
|
18
20
|
'@atlaskit/icon-file-type/glyph/audio/16');
|
|
19
|
-
}), _defineProperty(_importIconMapper, IconType.Blog, function () {
|
|
20
|
-
return import(
|
|
21
|
-
/* webpackChunkName: "glyphBlog" */
|
|
22
|
-
'@atlaskit/icon-object/glyph/blog/16');
|
|
23
21
|
}), _defineProperty(_importIconMapper, IconType.Code, function () {
|
|
24
22
|
return import(
|
|
25
23
|
/* webpackChunkName: "glyphCode" */
|
|
26
24
|
'@atlaskit/icon-file-type/glyph/source-code/16');
|
|
27
|
-
}), _defineProperty(_importIconMapper, IconType.Document, function () {
|
|
28
|
-
return import(
|
|
29
|
-
/* webpackChunkName: "glyphDocument" */
|
|
30
|
-
'@atlaskit/icon-file-type/glyph/document/16');
|
|
31
25
|
}), _defineProperty(_importIconMapper, IconType.Executable, function () {
|
|
32
26
|
return import(
|
|
33
27
|
/* webpackChunkName: "glyphExecutable" */
|
|
@@ -281,6 +275,22 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
|
|
|
281
275
|
var icon = _ref3.icon,
|
|
282
276
|
label = _ref3.label,
|
|
283
277
|
testId = _ref3.testId;
|
|
278
|
+
|
|
279
|
+
// Check for synchonously loaded icons first for SSR purposes
|
|
280
|
+
switch (icon) {
|
|
281
|
+
case IconType.Document:
|
|
282
|
+
return /*#__PURE__*/React.createElement(DocumentIcon, {
|
|
283
|
+
label: label || 'document',
|
|
284
|
+
testId: testId
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
case IconType.Blog:
|
|
288
|
+
return /*#__PURE__*/React.createElement(BlogIcon, {
|
|
289
|
+
label: label || 'blog',
|
|
290
|
+
testId: testId
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
284
294
|
var importFn = getIconImportFn(icon);
|
|
285
295
|
|
|
286
296
|
if (!importFn) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
1
2
|
import { InvokeHandler } from '../../model/invoke-handler';
|
|
2
3
|
import { AnalyticsHandler } from '../../utils/types';
|
|
3
4
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
@@ -5,6 +6,7 @@ export interface ExtractBlockOpts {
|
|
|
5
6
|
handleInvoke: InvokeHandler;
|
|
6
7
|
handleAnalytics: AnalyticsHandler;
|
|
7
8
|
extensionKey?: string;
|
|
9
|
+
featureFlags?: Partial<LinkingPlatformFeatureFlags>;
|
|
8
10
|
source?: CardInnerAppearance;
|
|
9
11
|
testId?: string;
|
|
10
12
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
2
3
|
import { InvokeHandler } from '../../../model/invoke-handler';
|
|
3
4
|
import { CardInnerAppearance } from '../../../view/Card/types';
|
|
4
5
|
import { AnalyticsHandler } from '../../../utils/types';
|
|
5
6
|
import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
|
|
6
|
-
export declare const extractPreviewAction: (extensionKey: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: JsonLd.Primitives.Platforms | undefined, source?: CardInnerAppearance | undefined) => import("../../../view/BlockCard/components/Action").ActionProps | undefined;
|
|
7
|
+
export declare const extractPreviewAction: (extensionKey: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: JsonLd.Primitives.Platforms | undefined, source?: CardInnerAppearance | undefined, featureFlags?: Partial<LinkingPlatformFeatureFlags> | undefined) => import("../../../view/BlockCard/components/Action").ActionProps | undefined;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { ErrorInfo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
3
|
+
import { EmbedModalWithExperimentProps } from '../../EmbedModal/types';
|
|
3
4
|
import { ActionProps } from '../components/Action';
|
|
4
5
|
import { IconProps } from '../../common/Icon';
|
|
5
6
|
import { MetadataProps } from '../../common/Metadata';
|
|
6
|
-
export interface PreviewFunctionArg extends
|
|
7
|
+
export interface PreviewFunctionArg extends EmbedModalWithExperimentProps {
|
|
7
8
|
popupMountPointId: string;
|
|
8
9
|
}
|
|
9
10
|
export declare function previewFunction({ popupMountPointId, onClose, ...rest }: PreviewFunctionArg): Promise<void>;
|
|
@@ -21,6 +22,7 @@ declare type PreviewInfo = {
|
|
|
21
22
|
onDownloadActionClick?: () => void;
|
|
22
23
|
onOpen?: () => void;
|
|
23
24
|
onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
25
|
+
featureFlags?: Partial<LinkingPlatformFeatureFlags>;
|
|
24
26
|
};
|
|
25
27
|
declare const _default: ({ details, ...rest }: PreviewInfo) => ActionProps;
|
|
26
28
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CardAppearance, CardPlatform, CardProps } from './types';
|
|
3
3
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
-
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "id" | "placeholder" | "onError" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "
|
|
4
|
+
export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "children" | "data" | "appearance" | "testId" | "isSelected" | "inheritDimensions" | "id" | "placeholder" | "onError" | "onClick" | "analyticsContext" | "key" | "url" | "ui" | "showHoverPreview" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "inlinePreloaderStyle" | "importer" | "container" | "analyticsEvents" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const containerStyles: import("@emotion/utils").SerializedStyles;
|
|
2
2
|
export declare const iconCss: import("@emotion/utils").SerializedStyles;
|
|
3
3
|
export declare const titleCss: import("@emotion/utils").SerializedStyles;
|
|
4
|
-
export declare const subtitleCss: import("@emotion/utils").SerializedStyles;
|
|
5
4
|
export declare const actionCss: import("@emotion/utils").SerializedStyles;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ModalProps } from '../../../common/Modal';
|
|
3
|
+
import { EmbedModalProps } from '../../types';
|
|
4
|
+
import { WithSizeExperimentProps } from './types';
|
|
5
|
+
declare const withSizeExperiment: (Component: React.ComponentType<EmbedModalProps>) => React.FC<(EmbedModalProps | ModalProps) & WithSizeExperimentProps>;
|
|
6
|
+
export default withSizeExperiment;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EmbedModalProps } from './types';
|
|
3
|
-
declare const _default: React.FC<EmbedModalProps>;
|
|
3
|
+
declare const _default: React.FC<(import("../common/Modal").ModalProps | EmbedModalProps) & import("./components/size-experiment/types").WithSizeExperimentProps>;
|
|
4
4
|
export default _default;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ErrorInfo } from 'react';
|
|
2
2
|
import { IconProps } from '../common/Icon';
|
|
3
|
+
import { WithSizeExperimentProps } from './components/size-experiment/types';
|
|
4
|
+
import { ModalProps } from '../common/Modal';
|
|
3
5
|
export declare type EmbedModalProps = {
|
|
4
6
|
closeLabel?: string;
|
|
5
7
|
download?: string;
|
|
@@ -13,8 +15,10 @@ export declare type EmbedModalProps = {
|
|
|
13
15
|
onViewActionClick?: () => void;
|
|
14
16
|
providerName?: string;
|
|
15
17
|
showModal?: boolean;
|
|
18
|
+
size?: string;
|
|
16
19
|
src?: string;
|
|
17
20
|
testId?: string;
|
|
18
21
|
title?: string;
|
|
19
22
|
url?: string;
|
|
20
23
|
};
|
|
24
|
+
export declare type EmbedModalWithExperimentProps = EmbedModalProps & ModalProps & WithSizeExperimentProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.2.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@atlaskit/icon-object": "^6.2.0",
|
|
34
34
|
"@atlaskit/icon-priority": "^6.3.0",
|
|
35
35
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
36
|
-
"@atlaskit/linking-common": "^1.
|
|
36
|
+
"@atlaskit/linking-common": "^1.6.0",
|
|
37
37
|
"@atlaskit/logo": "^13.8.0",
|
|
38
38
|
"@atlaskit/lozenge": "^11.1.0",
|
|
39
39
|
"@atlaskit/media-common": "^2.16.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"uuid": "^3.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/link-provider": "^1.2.
|
|
61
|
+
"@atlaskit/link-provider": "^1.2.4",
|
|
62
62
|
"react": "^16.8.0",
|
|
63
63
|
"react-dom": "^16.8.0",
|
|
64
64
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"react-dom": "^16.8.0",
|
|
110
110
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
111
111
|
"react-test-renderer": "^16.8.0",
|
|
112
|
-
"ts-jest": "
|
|
113
|
-
"typescript": "4.
|
|
112
|
+
"ts-jest": "26.5.6",
|
|
113
|
+
"typescript": "4.3.5",
|
|
114
114
|
"xhr-mock": "^2.4.0"
|
|
115
115
|
},
|
|
116
116
|
"af:exports": {
|
package/report.api.md
CHANGED
|
@@ -263,12 +263,12 @@ export declare const Card: React_2.ForwardRefExoticComponent<
|
|
|
263
263
|
| 'key'
|
|
264
264
|
| 'url'
|
|
265
265
|
| 'ui'
|
|
266
|
+
| 'showHoverPreview'
|
|
266
267
|
| 'showActions'
|
|
267
268
|
| 'onResolve'
|
|
268
269
|
| 'platform'
|
|
269
270
|
| 'isFrameVisible'
|
|
270
271
|
| 'embedIframeRef'
|
|
271
|
-
| 'showHoverPreview'
|
|
272
272
|
| 'inlinePreloaderStyle'
|
|
273
273
|
| 'importer'
|
|
274
274
|
| 'container'
|