@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 21.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`d2439a3c65d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d2439a3c65d) - [ux] Embed Preview Modal: Add experiment modal with new UX and resize functionality (behind feature flag)
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`6dd64ce82a8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6dd64ce82a8) - [ux] This changes icon loading for Flexible Smart Links. Previously, all `@atlaskit/icon-file-type/glyph/` icons in Flexible Smart Links would be loaded asynchronously. This change makes it so that the `@atlaskit/icon-file-type/glyph/blog` and `@atlaskit/icon-file-type/glyph/document`icons load synchronously in order to better support SSR use cases.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 21.1.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
21
|
+
## 21.1.3
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [`d0b3a262e03`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d0b3a262e03) - [ux] Embed Preview: Update the new embed preview modal UX
|
|
26
|
+
|
|
27
|
+
- Make title smaller
|
|
28
|
+
- Reduce gap between element
|
|
29
|
+
- Hide resize button on smaller screen
|
|
30
|
+
|
|
3
31
|
## 21.1.2
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -55,13 +55,14 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
|
|
|
55
55
|
|
|
56
56
|
var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform) {
|
|
57
57
|
if (opts) {
|
|
58
|
-
var
|
|
58
|
+
var featureFlags = opts.featureFlags,
|
|
59
|
+
handleInvoke = opts.handleInvoke,
|
|
59
60
|
handleAnalytics = opts.handleAnalytics,
|
|
60
61
|
extensionKey = opts.extensionKey,
|
|
61
62
|
source = opts.source,
|
|
62
63
|
testId = opts.testId;
|
|
63
64
|
var actions = (0, _extractActions.extractActions)(jsonLd, handleInvoke);
|
|
64
|
-
var previewAction = (0, _extractPreviewAction.extractPreviewAction)(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform, source); // The previewAction should always be the last action
|
|
65
|
+
var previewAction = (0, _extractPreviewAction.extractPreviewAction)(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform, source, featureFlags); // The previewAction should always be the last action
|
|
65
66
|
|
|
66
67
|
if (previewAction) {
|
|
67
68
|
actions.push(previewAction);
|
|
@@ -72,6 +72,7 @@ var extractPreviewAction = function extractPreviewAction() {
|
|
|
72
72
|
var testId = arguments.length > 5 ? arguments[5] : undefined;
|
|
73
73
|
var platform = arguments.length > 6 ? arguments[6] : undefined;
|
|
74
74
|
var source = arguments.length > 7 ? arguments[7] : undefined;
|
|
75
|
+
var featureFlags = arguments.length > 8 ? arguments[8] : undefined;
|
|
75
76
|
// Extract metadata from view props & raw JSON-LD.
|
|
76
77
|
var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
77
78
|
var metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -83,6 +84,7 @@ var extractPreviewAction = function extractPreviewAction() {
|
|
|
83
84
|
// Build action using instrumentation hooks.
|
|
84
85
|
var key = extensionKey;
|
|
85
86
|
var previewAction = (0, _BlockCard.PreviewAction)(_objectSpread(_objectSpread({}, metadata), {}, {
|
|
87
|
+
featureFlags: featureFlags,
|
|
86
88
|
testId: testId,
|
|
87
89
|
onOpen: function onOpen() {
|
|
88
90
|
handleAnalytics((0, _analytics.uiRenderSuccessEvent)('preview', 'resolved', key));
|
|
@@ -13,6 +13,8 @@ var _react = require("react");
|
|
|
13
13
|
|
|
14
14
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
15
15
|
|
|
16
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
17
|
+
|
|
16
18
|
var _block = require("../../extractors/block");
|
|
17
19
|
|
|
18
20
|
var _actions = require("../actions");
|
|
@@ -40,13 +42,21 @@ function useSmartLinkActions(_ref) {
|
|
|
40
42
|
|
|
41
43
|
var linkState = (0, _store.useSmartCardState)(url);
|
|
42
44
|
var linkAnalytics = (0, _analytics.useSmartLinkAnalytics)(url, analyticsHandler, id);
|
|
43
|
-
var linkActions = (0, _actions.useSmartCardActions)(id, url, linkAnalytics);
|
|
45
|
+
var linkActions = (0, _actions.useSmartCardActions)(id, url, linkAnalytics); // Actions do not have access to the react tree, so we need to obtain
|
|
46
|
+
// feature flags here where we still can access SmartLinkContext context
|
|
47
|
+
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
48
|
+
|
|
49
|
+
var embedModalSize = (0, _linkProvider.useFeatureFlag)('embedModalSize');
|
|
44
50
|
(0, _react.useEffect)(function () {
|
|
45
51
|
if (!linkState.details) {
|
|
46
52
|
return;
|
|
47
53
|
}
|
|
48
54
|
|
|
55
|
+
var featureFlags = {
|
|
56
|
+
embedModalSize: embedModalSize
|
|
57
|
+
};
|
|
49
58
|
var cardProperties = (0, _block.extractBlockProps)(linkState.details.data, linkState.details.meta, {
|
|
59
|
+
featureFlags: featureFlags,
|
|
50
60
|
handleInvoke: function handleInvoke(opts) {
|
|
51
61
|
return linkActions.invoke(opts, appearance);
|
|
52
62
|
},
|
|
@@ -67,6 +77,6 @@ function useSmartLinkActions(_ref) {
|
|
|
67
77
|
};
|
|
68
78
|
});
|
|
69
79
|
setActions(cardActions);
|
|
70
|
-
}, [linkState, linkActions, analyticsHandler, appearance, platform]);
|
|
80
|
+
}, [linkState, linkActions, analyticsHandler, appearance, platform, embedModalSize]);
|
|
71
81
|
return actions;
|
|
72
82
|
}
|
package/dist/cjs/version.json
CHANGED
|
@@ -93,6 +93,8 @@ var _ForbiddenView = require("./views/ForbiddenView");
|
|
|
93
93
|
|
|
94
94
|
var _ErroredView = require("./views/ErroredView");
|
|
95
95
|
|
|
96
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
97
|
+
|
|
96
98
|
var BlockCard = function BlockCard(_ref) {
|
|
97
99
|
var _details$meta, _forbiddenViewProps$c;
|
|
98
100
|
|
|
@@ -113,9 +115,17 @@ var BlockCard = function BlockCard(_ref) {
|
|
|
113
115
|
testId = _ref.testId,
|
|
114
116
|
showActions = _ref.showActions,
|
|
115
117
|
platform = _ref.platform;
|
|
118
|
+
// Actions do not have access to the react tree, so we need to obtain
|
|
119
|
+
// feature flags here where we still can access SmartLinkContext context
|
|
120
|
+
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
121
|
+
var embedModalSize = (0, _linkProvider.useFeatureFlag)('embedModalSize');
|
|
122
|
+
var featureFlags = {
|
|
123
|
+
embedModalSize: embedModalSize
|
|
124
|
+
};
|
|
116
125
|
var data = details && details.data || (0, _jsonld.getEmptyJsonLd)();
|
|
117
126
|
var meta = details && details.meta;
|
|
118
127
|
var extractorOpts = {
|
|
128
|
+
featureFlags: featureFlags,
|
|
119
129
|
handleAnalytics: handleAnalytics,
|
|
120
130
|
handleInvoke: handleInvoke,
|
|
121
131
|
extensionKey: (0, _helpers.getExtensionKey)(details)
|
|
@@ -80,7 +80,7 @@ function CardWithUrlContent(_ref) {
|
|
|
80
80
|
var showHoverPreviewFlag = (0, _linkProvider.useFeatureFlag)('showHoverPreview');
|
|
81
81
|
|
|
82
82
|
if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
|
|
83
|
-
showHoverPreview = showHoverPreviewFlag;
|
|
83
|
+
showHoverPreview = Boolean(showHoverPreviewFlag);
|
|
84
84
|
} // Setup UI handlers.
|
|
85
85
|
|
|
86
86
|
|
|
@@ -17,7 +17,7 @@ var _utils = require("../../../../utils");
|
|
|
17
17
|
|
|
18
18
|
var _templateObject;
|
|
19
19
|
|
|
20
|
-
var iframeCss = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: calc(100vh -
|
|
20
|
+
var iframeCss = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: calc(100vh - 208px);\n"])));
|
|
21
21
|
|
|
22
22
|
var EmbedContent = function EmbedContent(_ref) {
|
|
23
23
|
var isTrusted = _ref.isTrusted,
|
|
@@ -93,12 +93,14 @@ var LinkInfo = function LinkInfo(_ref) {
|
|
|
93
93
|
}) : (0, _core.jsx)(_vidFullScreenOn.default, {
|
|
94
94
|
label: message.defaultMessage
|
|
95
95
|
});
|
|
96
|
-
return (0, _core.jsx)(
|
|
96
|
+
return (0, _core.jsx)("span", {
|
|
97
|
+
className: "smart-link-resize-button"
|
|
98
|
+
}, (0, _core.jsx)(_linkInfoButton.default, {
|
|
97
99
|
content: (0, _core.jsx)(_reactIntlNext.FormattedMessage, message),
|
|
98
100
|
icon: icon,
|
|
99
101
|
onClick: onResizeButtonClick,
|
|
100
102
|
testId: "".concat(testId, "-resize")
|
|
101
|
-
});
|
|
103
|
+
}));
|
|
102
104
|
}, [onResizeButtonClick, size, testId]);
|
|
103
105
|
return (0, _core.jsx)("div", {
|
|
104
106
|
css: _styled.containerStyles
|
|
@@ -5,28 +5,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.titleCss = exports.
|
|
8
|
+
exports.titleCss = exports.iconCss = exports.containerStyles = exports.actionCss = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
12
12
|
var _core = require("@emotion/core");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
19
|
-
|
|
20
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
21
|
-
|
|
22
|
-
var containerStyles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: flex;\n gap: ", ";\n justify-content: space-between;\n padding: ", " ", ";\n"])), (0, _utils.gs)(2), (0, _utils.gs)(2), (0, _utils.gs)(3));
|
|
16
|
+
var containerStyles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])));
|
|
23
17
|
exports.containerStyles = containerStyles;
|
|
24
|
-
var iconSize = '
|
|
18
|
+
var iconSize = '24px';
|
|
25
19
|
var iconCss = (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\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);
|
|
26
20
|
exports.iconCss = iconCss;
|
|
27
|
-
var
|
|
21
|
+
var height = '20px';
|
|
22
|
+
var titleCss = (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\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);
|
|
28
23
|
exports.titleCss = titleCss;
|
|
29
|
-
var
|
|
30
|
-
exports.subtitleCss = subtitleCss;
|
|
31
|
-
var actionCss = (0, _core.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n"])));
|
|
24
|
+
var actionCss = (0, _core.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\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);
|
|
32
25
|
exports.actionCss = actionCss;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _Modal = _interopRequireDefault(require("../../../common/Modal"));
|
|
15
|
+
|
|
16
|
+
var _constants = require("../../constants");
|
|
17
|
+
|
|
18
|
+
var withSizeExperiment = function withSizeExperiment(Component) {
|
|
19
|
+
return function (props) {
|
|
20
|
+
var _props$featureFlags = props.featureFlags,
|
|
21
|
+
featureFlags = _props$featureFlags === void 0 ? {} : _props$featureFlags,
|
|
22
|
+
_props$closeLabel = props.closeLabel,
|
|
23
|
+
closeLabel = _props$closeLabel === void 0 ? 'Close Preview' : _props$closeLabel;
|
|
24
|
+
var embedModalSize = featureFlags.embedModalSize; // Experiment
|
|
25
|
+
|
|
26
|
+
if (embedModalSize === 'large' || embedModalSize === 'small') {
|
|
27
|
+
var size = embedModalSize === 'large' ? _constants.MAX_MODAL_SIZE : _constants.MIN_MODAL_SIZE;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, props, {
|
|
29
|
+
size: size
|
|
30
|
+
}));
|
|
31
|
+
} // Control
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_Modal.default, (0, _extends2.default)({}, props, {
|
|
35
|
+
closeLabel: closeLabel
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var _default = withSizeExperiment;
|
|
41
|
+
exports.default = _default;
|
|
@@ -23,6 +23,8 @@ var _embedContent = _interopRequireDefault(require("./components/embed-content")
|
|
|
23
23
|
|
|
24
24
|
var _errorBoundary = _interopRequireDefault(require("./components/error-boundary"));
|
|
25
25
|
|
|
26
|
+
var _sizeExperiment = _interopRequireDefault(require("./components/size-experiment"));
|
|
27
|
+
|
|
26
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
29
|
|
|
28
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -39,9 +41,11 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
39
41
|
onViewActionClick = _ref.onViewActionClick,
|
|
40
42
|
providerName = _ref.providerName,
|
|
41
43
|
showModal = _ref.showModal,
|
|
44
|
+
_ref$size = _ref.size,
|
|
45
|
+
defaultSize = _ref$size === void 0 ? _constants.MIN_MODAL_SIZE : _ref$size,
|
|
42
46
|
src = _ref.src,
|
|
43
47
|
_ref$testId = _ref.testId,
|
|
44
|
-
testId = _ref$testId === void 0 ? 'smart-
|
|
48
|
+
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
45
49
|
title = _ref.title,
|
|
46
50
|
url = _ref.url;
|
|
47
51
|
|
|
@@ -50,7 +54,7 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
50
54
|
isOpen = _useState2[0],
|
|
51
55
|
setIsOpen = _useState2[1];
|
|
52
56
|
|
|
53
|
-
var _useState3 = (0, _react.useState)(
|
|
57
|
+
var _useState3 = (0, _react.useState)(defaultSize),
|
|
54
58
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
55
59
|
size = _useState4[0],
|
|
56
60
|
setSize = _useState4[1];
|
|
@@ -88,6 +92,6 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
88
92
|
}))));
|
|
89
93
|
};
|
|
90
94
|
|
|
91
|
-
var _default = (0, _errorBoundary.default)(EmbedModal);
|
|
95
|
+
var _default = (0, _sizeExperiment.default)((0, _errorBoundary.default)(EmbedModal));
|
|
92
96
|
|
|
93
97
|
exports.default = _default;
|
|
@@ -17,6 +17,10 @@ var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
|
17
17
|
|
|
18
18
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
19
|
|
|
20
|
+
var _ = _interopRequireDefault(require("@atlaskit/icon-file-type/glyph/document/16"));
|
|
21
|
+
|
|
22
|
+
var _2 = _interopRequireDefault(require("@atlaskit/icon-object/glyph/blog/16"));
|
|
23
|
+
|
|
20
24
|
var _constants = require("../../../../../constants");
|
|
21
25
|
|
|
22
26
|
var _tokens = require("@atlaskit/tokens");
|
|
@@ -36,18 +40,10 @@ var importIconMapper = (_importIconMapper = {}, (0, _defineProperty2.default)(_i
|
|
|
36
40
|
return Promise.resolve().then(function () {
|
|
37
41
|
return _interopRequireWildcard(require('@atlaskit/icon-file-type/glyph/audio/16'));
|
|
38
42
|
});
|
|
39
|
-
}), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.Blog, function () {
|
|
40
|
-
return Promise.resolve().then(function () {
|
|
41
|
-
return _interopRequireWildcard(require('@atlaskit/icon-object/glyph/blog/16'));
|
|
42
|
-
});
|
|
43
43
|
}), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.Code, function () {
|
|
44
44
|
return Promise.resolve().then(function () {
|
|
45
45
|
return _interopRequireWildcard(require('@atlaskit/icon-file-type/glyph/source-code/16'));
|
|
46
46
|
});
|
|
47
|
-
}), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.Document, function () {
|
|
48
|
-
return Promise.resolve().then(function () {
|
|
49
|
-
return _interopRequireWildcard(require('@atlaskit/icon-file-type/glyph/document/16'));
|
|
50
|
-
});
|
|
51
47
|
}), (0, _defineProperty2.default)(_importIconMapper, _constants.IconType.Executable, function () {
|
|
52
48
|
return Promise.resolve().then(function () {
|
|
53
49
|
return _interopRequireWildcard(require('@atlaskit/icon-file-type/glyph/executable/16'));
|
|
@@ -301,6 +297,22 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
|
|
|
301
297
|
var icon = _ref3.icon,
|
|
302
298
|
label = _ref3.label,
|
|
303
299
|
testId = _ref3.testId;
|
|
300
|
+
|
|
301
|
+
// Check for synchonously loaded icons first for SSR purposes
|
|
302
|
+
switch (icon) {
|
|
303
|
+
case _constants.IconType.Document:
|
|
304
|
+
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
305
|
+
label: label || 'document',
|
|
306
|
+
testId: testId
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
case _constants.IconType.Blog:
|
|
310
|
+
return /*#__PURE__*/_react.default.createElement(_2.default, {
|
|
311
|
+
label: label || 'blog',
|
|
312
|
+
testId: testId
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
|
|
304
316
|
var importFn = getIconImportFn(icon);
|
|
305
317
|
|
|
306
318
|
if (!importFn) {
|
|
@@ -28,6 +28,7 @@ const extractBlockDetails = jsonLd => [extractCommentCount(jsonLd), extractProgr
|
|
|
28
28
|
export const extractBlockActions = (props, jsonLd, opts, platform) => {
|
|
29
29
|
if (opts) {
|
|
30
30
|
const {
|
|
31
|
+
featureFlags,
|
|
31
32
|
handleInvoke,
|
|
32
33
|
handleAnalytics,
|
|
33
34
|
extensionKey,
|
|
@@ -35,7 +36,7 @@ export const extractBlockActions = (props, jsonLd, opts, platform) => {
|
|
|
35
36
|
testId
|
|
36
37
|
} = opts;
|
|
37
38
|
const actions = extractActions(jsonLd, handleInvoke);
|
|
38
|
-
const previewAction = extractPreviewAction(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform, source); // The previewAction should always be the last action
|
|
39
|
+
const previewAction = extractPreviewAction(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform, source, featureFlags); // The previewAction should always be the last action
|
|
39
40
|
|
|
40
41
|
if (previewAction) {
|
|
41
42
|
actions.push(previewAction);
|
|
@@ -39,7 +39,7 @@ const getInvokeOpts = (key, action, source) => ({
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
export const extractPreviewAction = (extensionKey = 'empty-object-provider', viewProps, jsonLd, handleInvoke, handleAnalytics, testId, platform, source) => {
|
|
42
|
+
export const extractPreviewAction = (extensionKey = 'empty-object-provider', viewProps, jsonLd, handleInvoke, handleAnalytics, testId, platform, source, featureFlags) => {
|
|
43
43
|
// Extract metadata from view props & raw JSON-LD.
|
|
44
44
|
const metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
45
45
|
const metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -51,6 +51,7 @@ export const extractPreviewAction = (extensionKey = 'empty-object-provider', vie
|
|
|
51
51
|
// Build action using instrumentation hooks.
|
|
52
52
|
const key = extensionKey;
|
|
53
53
|
const previewAction = PreviewAction({ ...metadata,
|
|
54
|
+
featureFlags,
|
|
54
55
|
testId,
|
|
55
56
|
onOpen: () => {
|
|
56
57
|
handleAnalytics(uiRenderSuccessEvent('preview', 'resolved', key));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import uuid from 'uuid';
|
|
3
|
+
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
3
4
|
import { extractBlockProps as extractCardProps } from '../../extractors/block';
|
|
4
5
|
import { useSmartCardActions as useLinkActions } from '../actions';
|
|
5
6
|
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
@@ -15,13 +16,21 @@ export function useSmartLinkActions({
|
|
|
15
16
|
const [actions, setActions] = useState([]);
|
|
16
17
|
const linkState = useLinkState(url);
|
|
17
18
|
const linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
|
|
18
|
-
const linkActions = useLinkActions(id, url, linkAnalytics);
|
|
19
|
+
const linkActions = useLinkActions(id, url, linkAnalytics); // Actions do not have access to the react tree, so we need to obtain
|
|
20
|
+
// feature flags here where we still can access SmartLinkContext context
|
|
21
|
+
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
22
|
+
|
|
23
|
+
const embedModalSize = useFeatureFlag('embedModalSize');
|
|
19
24
|
useEffect(() => {
|
|
20
25
|
if (!linkState.details) {
|
|
21
26
|
return;
|
|
22
27
|
}
|
|
23
28
|
|
|
29
|
+
const featureFlags = {
|
|
30
|
+
embedModalSize
|
|
31
|
+
};
|
|
24
32
|
const cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
|
|
33
|
+
featureFlags,
|
|
25
34
|
handleInvoke: opts => linkActions.invoke(opts, appearance),
|
|
26
35
|
handleAnalytics: analyticsHandler,
|
|
27
36
|
extensionKey: getExtensionKey(linkState.details),
|
|
@@ -38,6 +47,6 @@ export function useSmartLinkActions({
|
|
|
38
47
|
invoke: action.promise
|
|
39
48
|
}));
|
|
40
49
|
setActions(cardActions);
|
|
41
|
-
}, [linkState, linkActions, analyticsHandler, appearance, platform]);
|
|
50
|
+
}, [linkState, linkActions, analyticsHandler, appearance, platform, embedModalSize]);
|
|
42
51
|
return actions;
|
|
43
52
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -32,7 +32,7 @@ export async function previewFunction({
|
|
|
32
32
|
document.body.appendChild(popupMountPoint);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
let Modal = await import('../../
|
|
35
|
+
let Modal = await import('../../EmbedModal');
|
|
36
36
|
ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
|
|
37
37
|
locale: "en"
|
|
38
38
|
}, /*#__PURE__*/React.createElement(Modal.default, _extends({}, rest, {
|
|
@@ -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 const BlockCard = ({
|
|
19
20
|
url,
|
|
@@ -37,9 +38,17 @@ export const BlockCard = ({
|
|
|
37
38
|
}) => {
|
|
38
39
|
var _details$meta, _forbiddenViewProps$c;
|
|
39
40
|
|
|
41
|
+
// Actions do not have access to the react tree, so we need to obtain
|
|
42
|
+
// feature flags here where we still can access SmartLinkContext context
|
|
43
|
+
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
44
|
+
const embedModalSize = useFeatureFlag('embedModalSize');
|
|
45
|
+
const featureFlags = {
|
|
46
|
+
embedModalSize
|
|
47
|
+
};
|
|
40
48
|
const data = details && details.data || getEmptyJsonLd();
|
|
41
49
|
const meta = details && details.meta;
|
|
42
50
|
const extractorOpts = {
|
|
51
|
+
featureFlags,
|
|
43
52
|
handleAnalytics,
|
|
44
53
|
handleInvoke,
|
|
45
54
|
extensionKey: getExtensionKey(details)
|
|
@@ -51,7 +51,7 @@ export function CardWithUrlContent({
|
|
|
51
51
|
const showHoverPreviewFlag = useFeatureFlag('showHoverPreview');
|
|
52
52
|
|
|
53
53
|
if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
|
|
54
|
-
showHoverPreview = showHoverPreviewFlag;
|
|
54
|
+
showHoverPreview = Boolean(showHoverPreviewFlag);
|
|
55
55
|
} // Setup UI handlers.
|
|
56
56
|
|
|
57
57
|
|
|
@@ -65,12 +65,14 @@ const LinkInfo = ({
|
|
|
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: `${testId}-resize`
|
|
73
|
-
});
|
|
75
|
+
}));
|
|
74
76
|
}, [onResizeButtonClick, size, testId]);
|
|
75
77
|
return jsx("div", {
|
|
76
78
|
css: containerStyles
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { css } from '@emotion/core';
|
|
2
|
-
import { gs } from '../../../common/utils';
|
|
3
|
-
import { token } from '@atlaskit/tokens';
|
|
4
|
-
import { N100 } from '@atlaskit/theme/colors';
|
|
5
2
|
export const containerStyles = css`
|
|
6
3
|
align-items: center;
|
|
7
4
|
display: flex;
|
|
8
|
-
gap:
|
|
5
|
+
gap: 8px;
|
|
9
6
|
justify-content: space-between;
|
|
10
|
-
padding
|
|
7
|
+
// AK ModalBody has 2px padding top and bottom.
|
|
8
|
+
// Using 14px here to create 16px gap between
|
|
9
|
+
// link info and iframe
|
|
10
|
+
padding: 24px 24px 14px 24px;
|
|
11
11
|
`;
|
|
12
|
-
const iconSize = '
|
|
12
|
+
const iconSize = '24px';
|
|
13
13
|
export const iconCss = css`
|
|
14
14
|
img,
|
|
15
15
|
span,
|
|
@@ -22,16 +22,15 @@ export const iconCss = css`
|
|
|
22
22
|
max-width: ${iconSize};
|
|
23
23
|
}
|
|
24
24
|
`;
|
|
25
|
+
const height = '20px';
|
|
25
26
|
export const titleCss = css`
|
|
26
27
|
flex: 1 1 auto;
|
|
27
28
|
|
|
28
29
|
h3 {
|
|
29
30
|
flex: 1 1 auto;
|
|
30
|
-
|
|
31
|
-
// EDM-42336: UX is not finalised yet.
|
|
32
|
-
font-size: 20px;
|
|
31
|
+
font-size: 16px;
|
|
33
32
|
font-weight: 400;
|
|
34
|
-
line-height:
|
|
33
|
+
line-height: ${height};
|
|
35
34
|
|
|
36
35
|
display: -webkit-box;
|
|
37
36
|
overflow: hidden;
|
|
@@ -41,18 +40,24 @@ export const titleCss = css`
|
|
|
41
40
|
-webkit-box-orient: vertical;
|
|
42
41
|
// Fallback options
|
|
43
42
|
@supports not (-webkit-line-clamp: 1) {
|
|
44
|
-
max-height:
|
|
43
|
+
max-height: ${height};
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
`;
|
|
48
|
-
export const subtitleCss = css`
|
|
49
|
-
color: ${token('color.text.subtlest', N100)};
|
|
50
|
-
|
|
51
|
-
// EDM-42336: UX is not finalised yet.
|
|
52
|
-
font-size: 12px;
|
|
53
|
-
font-weight: 400;
|
|
54
|
-
line-height: 16px;
|
|
55
|
-
`;
|
|
56
47
|
export const actionCss = css`
|
|
48
|
+
display: flex;
|
|
57
49
|
flex: 0 0 auto;
|
|
50
|
+
gap: 4px;
|
|
51
|
+
line-height: ${height};
|
|
52
|
+
span {
|
|
53
|
+
line-height: ${height};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media only screen and (max-width: 980px) {
|
|
57
|
+
// Hide resize button if the screen is smaller than the min width
|
|
58
|
+
// or too small to have enough impact to matter.
|
|
59
|
+
.smart-link-resize-button {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
58
63
|
`;
|