@atlaskit/smart-card 21.1.4 → 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 +11 -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/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/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/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/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 +2 -2
- package/report.api.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
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
|
+
|
|
3
14
|
## 21.1.4
|
|
4
15
|
|
|
5
16
|
### 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
|
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -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 };
|
|
@@ -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",
|
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'
|