@atlaskit/smart-card 23.1.2 → 23.1.4
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 +12 -0
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +0 -2
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +2 -12
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/actions/PreviewAction.js +1 -5
- package/dist/cjs/view/BlockCard/index.js +0 -10
- package/dist/cjs/view/EmbedModal/index.js +2 -4
- package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -1
- package/dist/cjs/view/InlineCard/Icon.js +1 -1
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +0 -2
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +2 -11
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/actions/PreviewAction.js +0 -4
- package/dist/es2019/view/BlockCard/index.js +0 -9
- package/dist/es2019/view/EmbedModal/index.js +2 -3
- package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +3 -3
- package/dist/es2019/view/InlineCard/Icon.js +3 -3
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +0 -2
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +2 -11
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -5
- package/dist/esm/view/BlockCard/index.js +0 -9
- package/dist/esm/view/EmbedModal/index.js +2 -3
- package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -1
- package/dist/esm/view/InlineCard/Icon.js +1 -1
- package/dist/types/extractors/block/types.d.ts +0 -2
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +0 -2
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/EmbedModal/index.d.ts +1 -3
- package/dist/types/view/EmbedModal/types.d.ts +1 -4
- package/dist/types-ts4.0/extractors/block/types.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types-ts4.0/view/BlockCard/actions/PreviewAction.d.ts +0 -2
- package/dist/types-ts4.0/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.0/view/EmbedModal/index.d.ts +1 -3
- package/dist/types-ts4.0/view/EmbedModal/types.d.ts +1 -4
- package/package.json +3 -3
- package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +0 -36
- package/dist/cjs/view/EmbedModal/components/size-experiment/types.js +0 -5
- package/dist/cjs/view/common/Modal.js +0 -158
- package/dist/cjs/view/common/ModalHeader.js +0 -114
- package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +0 -24
- package/dist/es2019/view/EmbedModal/components/size-experiment/types.js +0 -1
- package/dist/es2019/view/common/Modal.js +0 -115
- package/dist/es2019/view/common/ModalHeader.js +0 -88
- package/dist/esm/view/EmbedModal/components/size-experiment/index.js +0 -23
- package/dist/esm/view/EmbedModal/components/size-experiment/types.js +0 -1
- package/dist/esm/view/common/Modal.js +0 -148
- package/dist/esm/view/common/ModalHeader.js +0 -89
- package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +0 -7
- package/dist/types/view/EmbedModal/components/size-experiment/types.d.ts +0 -4
- package/dist/types/view/common/Modal.d.ts +0 -26
- package/dist/types/view/common/ModalHeader.d.ts +0 -19
- package/dist/types-ts4.0/view/EmbedModal/components/size-experiment/index.d.ts +0 -7
- package/dist/types-ts4.0/view/EmbedModal/components/size-experiment/types.d.ts +0 -4
- package/dist/types-ts4.0/view/common/Modal.d.ts +0 -26
- package/dist/types-ts4.0/view/common/ModalHeader.d.ts +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 23.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e6d8d32e33e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e6d8d32e33e) - [ux] Update token usages in the loading shimmer effect to be smoother for inline cards. Updated appearances only visible in applications configured to use the new Tokens API (currently in alpha).
|
|
8
|
+
|
|
9
|
+
## 23.1.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`558e0af2263`](https://bitbucket.org/atlassian/atlassian-frontend/commits/558e0af2263) - Embed Preview: Clean up experiment
|
|
14
|
+
|
|
3
15
|
## 23.1.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -72,7 +72,6 @@ var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
72
72
|
origin = _ref.origin,
|
|
73
73
|
_ref$source = _ref.source,
|
|
74
74
|
source = _ref$source === void 0 ? 'block' : _ref$source,
|
|
75
|
-
featureFlags = _ref.featureFlags,
|
|
76
75
|
analytics = _ref.analytics;
|
|
77
76
|
// Extract metadata from view props & raw JSON-LD.
|
|
78
77
|
var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
@@ -87,7 +86,6 @@ var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
87
86
|
var previewAction = (0, _BlockCard.PreviewAction)(_objectSpread(_objectSpread({}, metadata), {}, {
|
|
88
87
|
analytics: analytics,
|
|
89
88
|
origin: origin,
|
|
90
|
-
featureFlags: featureFlags,
|
|
91
89
|
testId: testId,
|
|
92
90
|
onDownloadActionClick: function onDownloadActionClick() {
|
|
93
91
|
handleInvoke(getInvokeOpts(key, 'DownloadAction'));
|
|
@@ -13,8 +13,6 @@ var _react = require("react");
|
|
|
13
13
|
|
|
14
14
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
15
15
|
|
|
16
|
-
var _linkProvider = require("@atlaskit/link-provider");
|
|
17
|
-
|
|
18
16
|
var _block = require("../../extractors/block");
|
|
19
17
|
|
|
20
18
|
var _actions = require("../actions");
|
|
@@ -43,21 +41,13 @@ function useSmartLinkActions(_ref) {
|
|
|
43
41
|
|
|
44
42
|
var linkState = (0, _store.useSmartCardState)(url);
|
|
45
43
|
var linkAnalytics = (0, _analytics.useSmartLinkAnalytics)(url, analyticsHandler, id);
|
|
46
|
-
var linkActions = (0, _actions.useSmartCardActions)(id, url, linkAnalytics);
|
|
47
|
-
// feature flags here where we still can access SmartLinkContext context
|
|
48
|
-
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
49
|
-
|
|
50
|
-
var embedModalSize = (0, _linkProvider.useFeatureFlag)('embedModalSize');
|
|
44
|
+
var linkActions = (0, _actions.useSmartCardActions)(id, url, linkAnalytics);
|
|
51
45
|
(0, _react.useEffect)(function () {
|
|
52
46
|
if (!linkState.details) {
|
|
53
47
|
return;
|
|
54
48
|
}
|
|
55
49
|
|
|
56
|
-
var featureFlags = {
|
|
57
|
-
embedModalSize: embedModalSize
|
|
58
|
-
};
|
|
59
50
|
var cardProperties = (0, _block.extractBlockProps)(linkState.details.data, linkState.details.meta, {
|
|
60
|
-
featureFlags: featureFlags,
|
|
61
51
|
handleInvoke: function handleInvoke(opts) {
|
|
62
52
|
return linkActions.invoke(opts, appearance);
|
|
63
53
|
},
|
|
@@ -79,6 +69,6 @@ function useSmartLinkActions(_ref) {
|
|
|
79
69
|
};
|
|
80
70
|
});
|
|
81
71
|
setActions(cardActions);
|
|
82
|
-
}, [linkState, linkActions, linkAnalytics, appearance, platform,
|
|
72
|
+
}, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
|
|
83
73
|
return actions;
|
|
84
74
|
}
|
package/dist/cjs/version.json
CHANGED
|
@@ -119,13 +119,9 @@ var _default = function _default(_ref2) {
|
|
|
119
119
|
return previewFunction(_objectSpread({
|
|
120
120
|
popupMountPointId: 'twp-editor-preview-iframe',
|
|
121
121
|
providerName: 'Preview',
|
|
122
|
-
closeLabel: 'Close Preview',
|
|
123
122
|
showModal: true,
|
|
124
123
|
iframeName: 'twp-editor-preview-iframe',
|
|
125
|
-
onClose: function onClose() {}
|
|
126
|
-
metadata: {
|
|
127
|
-
items: details || []
|
|
128
|
-
}
|
|
124
|
+
onClose: function onClose() {}
|
|
129
125
|
}, rest));
|
|
130
126
|
}
|
|
131
127
|
};
|
|
@@ -91,8 +91,6 @@ var _ForbiddenView = require("./views/ForbiddenView");
|
|
|
91
91
|
|
|
92
92
|
var _ErroredView = require("./views/ErroredView");
|
|
93
93
|
|
|
94
|
-
var _linkProvider = require("@atlaskit/link-provider");
|
|
95
|
-
|
|
96
94
|
var _PreviewAction = _interopRequireDefault(require("./actions/PreviewAction"));
|
|
97
95
|
|
|
98
96
|
var BlockCard = function BlockCard(_ref) {
|
|
@@ -115,19 +113,11 @@ var BlockCard = function BlockCard(_ref) {
|
|
|
115
113
|
showActions = _ref.showActions,
|
|
116
114
|
platform = _ref.platform,
|
|
117
115
|
analytics = _ref.analytics;
|
|
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
|
-
};
|
|
125
116
|
var data = details && details.data || (0, _jsonld.getEmptyJsonLd)();
|
|
126
117
|
var meta = details && details.meta;
|
|
127
118
|
var extractorOpts = {
|
|
128
119
|
analytics: analytics,
|
|
129
120
|
origin: 'smartLinkCard',
|
|
130
|
-
featureFlags: featureFlags,
|
|
131
121
|
handleInvoke: handleInvoke,
|
|
132
122
|
extensionKey: (0, _helpers.getExtensionKey)(details)
|
|
133
123
|
};
|
|
@@ -25,8 +25,6 @@ var _types = require("./types");
|
|
|
25
25
|
|
|
26
26
|
var _errorBoundary = _interopRequireDefault(require("./components/error-boundary"));
|
|
27
27
|
|
|
28
|
-
var _sizeExperiment = _interopRequireDefault(require("./components/size-experiment"));
|
|
29
|
-
|
|
30
28
|
var _analytics = _interopRequireDefault(require("./components/analytics"));
|
|
31
29
|
|
|
32
30
|
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); }
|
|
@@ -55,7 +53,7 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
55
53
|
providerName = _ref.providerName,
|
|
56
54
|
showModal = _ref.showModal,
|
|
57
55
|
_ref$size = _ref.size,
|
|
58
|
-
size = _ref$size === void 0 ? _types.EmbedModalSize.
|
|
56
|
+
size = _ref$size === void 0 ? _types.EmbedModalSize.Large : _ref$size,
|
|
59
57
|
src = _ref.src,
|
|
60
58
|
_ref$testId = _ref.testId,
|
|
61
59
|
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
@@ -131,6 +129,6 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
131
129
|
}))));
|
|
132
130
|
};
|
|
133
131
|
|
|
134
|
-
var _default = (0,
|
|
132
|
+
var _default = (0, _analytics.default)((0, _errorBoundary.default)(EmbedModal));
|
|
135
133
|
|
|
136
134
|
exports.default = _default;
|
|
@@ -22,7 +22,7 @@ var LoadingSkeleton = function LoadingSkeleton(_ref) {
|
|
|
22
22
|
width = _ref.width,
|
|
23
23
|
height = _ref.height;
|
|
24
24
|
var animationNameStyles = (0, _react2.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n 0% { background-position: 50% 0; }\n 100% { background-position: -50% 0; }\n "])));
|
|
25
|
-
var styles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: ", "rem;\n height: ", "rem;\n border-radius: 2px;\n user-select: none;\n background: ", ";\n background-image: linear-gradient(\n to right,\n
|
|
25
|
+
var styles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: ", "rem;\n height: ", "rem;\n border-radius: 2px;\n user-select: none;\n background: ", ";\n background-image: linear-gradient(\n to right,\n transparent 0%,\n ", " 20%,\n transparent 40%,\n transparent 100%\n );\n background-repeat: no-repeat;\n background-size: 280% 100%;\n display: inline-block;\n\n animation-duration: 1s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: ", ";\n animation-timing-function: linear;\n "])), width, height, (0, _tokens.token)('color.skeleton.subtle', '#f6f7f8'), (0, _tokens.token)('color.skeleton', '#edeef1'), animationNameStyles);
|
|
26
26
|
return (0, _react2.jsx)("span", {
|
|
27
27
|
css: styles,
|
|
28
28
|
"data-testid": testId
|
|
@@ -34,6 +34,6 @@ var AKIconWrapper = _styled.default.span(_templateObject3 || (_templateObject3 =
|
|
|
34
34
|
|
|
35
35
|
exports.AKIconWrapper = AKIconWrapper;
|
|
36
36
|
|
|
37
|
-
var Shimmer = _styled.default.span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n height: 14px;\n width: 14px;\n margin-right: 4px;\n border-radius: 2px;\n user-select: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: ", ";\n background-image: linear-gradient(\n to right,\n
|
|
37
|
+
var Shimmer = _styled.default.span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n height: 14px;\n width: 14px;\n margin-right: 4px;\n border-radius: 2px;\n user-select: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: ", ";\n background-image: linear-gradient(\n to right,\n transparent 0%,\n ", " 20%,\n transparent 40%,\n transparent 100%\n );\n background-repeat: no-repeat;\n background-size: 40px 14px;\n display: inline-block;\n\n animation-duration: 1s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: ", ";\n animation-timing-function: linear;\n"])), (0, _tokens.token)('color.skeleton.subtle', '#f6f7f8'), (0, _tokens.token)('color.skeleton', '#edeef1'), placeholderShimmer);
|
|
38
38
|
|
|
39
39
|
exports.Shimmer = Shimmer;
|
|
@@ -47,7 +47,6 @@ export const extractPreviewAction = ({
|
|
|
47
47
|
platform,
|
|
48
48
|
origin,
|
|
49
49
|
source = 'block',
|
|
50
|
-
featureFlags,
|
|
51
50
|
analytics
|
|
52
51
|
}) => {
|
|
53
52
|
// Extract metadata from view props & raw JSON-LD.
|
|
@@ -63,7 +62,6 @@ export const extractPreviewAction = ({
|
|
|
63
62
|
const previewAction = PreviewAction({ ...metadata,
|
|
64
63
|
analytics,
|
|
65
64
|
origin,
|
|
66
|
-
featureFlags,
|
|
67
65
|
testId,
|
|
68
66
|
onDownloadActionClick: () => {
|
|
69
67
|
handleInvoke(getInvokeOpts(key, 'DownloadAction'));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import uuid from 'uuid';
|
|
3
|
-
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
4
3
|
import { extractBlockProps as extractCardProps } from '../../extractors/block';
|
|
5
4
|
import { useSmartCardActions as useLinkActions } from '../actions';
|
|
6
5
|
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
@@ -17,21 +16,13 @@ export function useSmartLinkActions({
|
|
|
17
16
|
const [actions, setActions] = useState([]);
|
|
18
17
|
const linkState = useLinkState(url);
|
|
19
18
|
const linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
|
|
20
|
-
const linkActions = useLinkActions(id, url, linkAnalytics);
|
|
21
|
-
// feature flags here where we still can access SmartLinkContext context
|
|
22
|
-
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
23
|
-
|
|
24
|
-
const embedModalSize = useFeatureFlag('embedModalSize');
|
|
19
|
+
const linkActions = useLinkActions(id, url, linkAnalytics);
|
|
25
20
|
useEffect(() => {
|
|
26
21
|
if (!linkState.details) {
|
|
27
22
|
return;
|
|
28
23
|
}
|
|
29
24
|
|
|
30
|
-
const featureFlags = {
|
|
31
|
-
embedModalSize
|
|
32
|
-
};
|
|
33
25
|
const cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
|
|
34
|
-
featureFlags,
|
|
35
26
|
handleInvoke: opts => linkActions.invoke(opts, appearance),
|
|
36
27
|
analytics: linkAnalytics,
|
|
37
28
|
origin,
|
|
@@ -49,6 +40,6 @@ export function useSmartLinkActions({
|
|
|
49
40
|
invoke: action.promise
|
|
50
41
|
}));
|
|
51
42
|
setActions(cardActions);
|
|
52
|
-
}, [linkState, linkActions, linkAnalytics, appearance, platform,
|
|
43
|
+
}, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
|
|
53
44
|
return actions;
|
|
54
45
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -58,13 +58,9 @@ export default (({
|
|
|
58
58
|
promise: () => previewFunction({
|
|
59
59
|
popupMountPointId: 'twp-editor-preview-iframe',
|
|
60
60
|
providerName: 'Preview',
|
|
61
|
-
closeLabel: 'Close Preview',
|
|
62
61
|
showModal: true,
|
|
63
62
|
iframeName: 'twp-editor-preview-iframe',
|
|
64
63
|
onClose: () => {},
|
|
65
|
-
metadata: {
|
|
66
|
-
items: details || []
|
|
67
|
-
},
|
|
68
64
|
...rest
|
|
69
65
|
})
|
|
70
66
|
}));
|
|
@@ -13,7 +13,6 @@ import { ResolvingView as BlockCardResolvingView } from './views/ResolvingView';
|
|
|
13
13
|
import { UnauthorizedView as BlockCardUnauthorisedView } from './views/UnauthorizedView';
|
|
14
14
|
import { ForbiddenView as BlockCardForbiddenView } from './views/ForbiddenView';
|
|
15
15
|
import { ErroredView as BlockCardErroredView } from './views/ErroredView';
|
|
16
|
-
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
17
16
|
export { default as PreviewAction } from './actions/PreviewAction';
|
|
18
17
|
export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
|
|
19
18
|
export const BlockCard = ({
|
|
@@ -38,19 +37,11 @@ export const BlockCard = ({
|
|
|
38
37
|
}) => {
|
|
39
38
|
var _details$meta, _forbiddenViewProps$c;
|
|
40
39
|
|
|
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
|
-
};
|
|
48
40
|
const data = details && details.data || getEmptyJsonLd();
|
|
49
41
|
const meta = details && details.meta;
|
|
50
42
|
const extractorOpts = {
|
|
51
43
|
analytics,
|
|
52
44
|
origin: 'smartLinkCard',
|
|
53
|
-
featureFlags,
|
|
54
45
|
handleInvoke,
|
|
55
46
|
extensionKey: getExtensionKey(details)
|
|
56
47
|
};
|
|
@@ -5,7 +5,6 @@ import { MAX_MODAL_SIZE, MIN_MODAL_SIZE } from './constants';
|
|
|
5
5
|
import EmbedContent from './components/embed-content';
|
|
6
6
|
import { EmbedModalSize } from './types';
|
|
7
7
|
import withErrorBoundary from './components/error-boundary';
|
|
8
|
-
import withSizeExperiment from './components/size-experiment';
|
|
9
8
|
import withAnalytics from './components/analytics';
|
|
10
9
|
|
|
11
10
|
const toSize = width => width === MAX_MODAL_SIZE ? EmbedModalSize.Large : EmbedModalSize.Small;
|
|
@@ -24,7 +23,7 @@ const EmbedModal = ({
|
|
|
24
23
|
onViewActionClick,
|
|
25
24
|
providerName,
|
|
26
25
|
showModal,
|
|
27
|
-
size = EmbedModalSize.
|
|
26
|
+
size = EmbedModalSize.Large,
|
|
28
27
|
src,
|
|
29
28
|
testId = 'smart-embed-preview-modal',
|
|
30
29
|
title,
|
|
@@ -89,4 +88,4 @@ const EmbedModal = ({
|
|
|
89
88
|
}))));
|
|
90
89
|
};
|
|
91
90
|
|
|
92
|
-
export default
|
|
91
|
+
export default withAnalytics(withErrorBoundary(EmbedModal));
|
|
@@ -20,10 +20,10 @@ const LoadingSkeleton = ({
|
|
|
20
20
|
background: ${token('color.skeleton.subtle', '#f6f7f8')};
|
|
21
21
|
background-image: linear-gradient(
|
|
22
22
|
to right,
|
|
23
|
-
|
|
23
|
+
transparent 0%,
|
|
24
24
|
${token('color.skeleton', '#edeef1')} 20%,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
transparent 40%,
|
|
26
|
+
transparent 100%
|
|
27
27
|
);
|
|
28
28
|
background-repeat: no-repeat;
|
|
29
29
|
background-size: 280% 100%;
|
|
@@ -45,10 +45,10 @@ export const Shimmer = styled.span`
|
|
|
45
45
|
background: ${token('color.skeleton.subtle', '#f6f7f8')};
|
|
46
46
|
background-image: linear-gradient(
|
|
47
47
|
to right,
|
|
48
|
-
|
|
48
|
+
transparent 0%,
|
|
49
49
|
${token('color.skeleton', '#edeef1')} 20%,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
transparent 40%,
|
|
51
|
+
transparent 100%
|
|
52
52
|
);
|
|
53
53
|
background-repeat: no-repeat;
|
|
54
54
|
background-size: 40px 14px;
|
|
@@ -61,7 +61,6 @@ export var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
61
61
|
origin = _ref.origin,
|
|
62
62
|
_ref$source = _ref.source,
|
|
63
63
|
source = _ref$source === void 0 ? 'block' : _ref$source,
|
|
64
|
-
featureFlags = _ref.featureFlags,
|
|
65
64
|
analytics = _ref.analytics;
|
|
66
65
|
// Extract metadata from view props & raw JSON-LD.
|
|
67
66
|
var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
@@ -76,7 +75,6 @@ export var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
76
75
|
var previewAction = PreviewAction(_objectSpread(_objectSpread({}, metadata), {}, {
|
|
77
76
|
analytics: analytics,
|
|
78
77
|
origin: origin,
|
|
79
|
-
featureFlags: featureFlags,
|
|
80
78
|
testId: testId,
|
|
81
79
|
onDownloadActionClick: function onDownloadActionClick() {
|
|
82
80
|
handleInvoke(getInvokeOpts(key, 'DownloadAction'));
|
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
import { extractBlockProps as extractCardProps } from '../../extractors/block';
|
|
6
5
|
import { useSmartCardActions as useLinkActions } from '../actions';
|
|
7
6
|
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
@@ -25,21 +24,13 @@ export function useSmartLinkActions(_ref) {
|
|
|
25
24
|
|
|
26
25
|
var linkState = useLinkState(url);
|
|
27
26
|
var linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
|
|
28
|
-
var linkActions = useLinkActions(id, url, linkAnalytics);
|
|
29
|
-
// feature flags here where we still can access SmartLinkContext context
|
|
30
|
-
// and pass the flags down to the extractor. See PreviewAction.tsx for details.
|
|
31
|
-
|
|
32
|
-
var embedModalSize = useFeatureFlag('embedModalSize');
|
|
27
|
+
var linkActions = useLinkActions(id, url, linkAnalytics);
|
|
33
28
|
useEffect(function () {
|
|
34
29
|
if (!linkState.details) {
|
|
35
30
|
return;
|
|
36
31
|
}
|
|
37
32
|
|
|
38
|
-
var featureFlags = {
|
|
39
|
-
embedModalSize: embedModalSize
|
|
40
|
-
};
|
|
41
33
|
var cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
|
|
42
|
-
featureFlags: featureFlags,
|
|
43
34
|
handleInvoke: function handleInvoke(opts) {
|
|
44
35
|
return linkActions.invoke(opts, appearance);
|
|
45
36
|
},
|
|
@@ -61,6 +52,6 @@ export function useSmartLinkActions(_ref) {
|
|
|
61
52
|
};
|
|
62
53
|
});
|
|
63
54
|
setActions(cardActions);
|
|
64
|
-
}, [linkState, linkActions, linkAnalytics, appearance, platform,
|
|
55
|
+
}, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
|
|
65
56
|
return actions;
|
|
66
57
|
}
|
package/dist/esm/version.json
CHANGED
|
@@ -92,13 +92,9 @@ export default (function (_ref2) {
|
|
|
92
92
|
return previewFunction(_objectSpread({
|
|
93
93
|
popupMountPointId: 'twp-editor-preview-iframe',
|
|
94
94
|
providerName: 'Preview',
|
|
95
|
-
closeLabel: 'Close Preview',
|
|
96
95
|
showModal: true,
|
|
97
96
|
iframeName: 'twp-editor-preview-iframe',
|
|
98
|
-
onClose: function onClose() {}
|
|
99
|
-
metadata: {
|
|
100
|
-
items: details || []
|
|
101
|
-
}
|
|
97
|
+
onClose: function onClose() {}
|
|
102
98
|
}, rest));
|
|
103
99
|
}
|
|
104
100
|
};
|
|
@@ -13,7 +13,6 @@ import { ResolvingView as BlockCardResolvingView } from './views/ResolvingView';
|
|
|
13
13
|
import { UnauthorizedView as BlockCardUnauthorisedView } from './views/UnauthorizedView';
|
|
14
14
|
import { ForbiddenView as BlockCardForbiddenView } from './views/ForbiddenView';
|
|
15
15
|
import { ErroredView as BlockCardErroredView } from './views/ErroredView';
|
|
16
|
-
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
17
16
|
export { default as PreviewAction } from './actions/PreviewAction';
|
|
18
17
|
export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
|
|
19
18
|
export var BlockCard = function BlockCard(_ref) {
|
|
@@ -36,19 +35,11 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
36
35
|
showActions = _ref.showActions,
|
|
37
36
|
platform = _ref.platform,
|
|
38
37
|
analytics = _ref.analytics;
|
|
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
|
-
};
|
|
46
38
|
var data = details && details.data || getEmptyJsonLd();
|
|
47
39
|
var meta = details && details.meta;
|
|
48
40
|
var extractorOpts = {
|
|
49
41
|
analytics: analytics,
|
|
50
42
|
origin: 'smartLinkCard',
|
|
51
|
-
featureFlags: featureFlags,
|
|
52
43
|
handleInvoke: handleInvoke,
|
|
53
44
|
extensionKey: getExtensionKey(details)
|
|
54
45
|
};
|
|
@@ -6,7 +6,6 @@ import { MAX_MODAL_SIZE, MIN_MODAL_SIZE } from './constants';
|
|
|
6
6
|
import EmbedContent from './components/embed-content';
|
|
7
7
|
import { EmbedModalSize } from './types';
|
|
8
8
|
import withErrorBoundary from './components/error-boundary';
|
|
9
|
-
import withSizeExperiment from './components/size-experiment';
|
|
10
9
|
import withAnalytics from './components/analytics';
|
|
11
10
|
|
|
12
11
|
var toSize = function toSize(width) {
|
|
@@ -31,7 +30,7 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
31
30
|
providerName = _ref.providerName,
|
|
32
31
|
showModal = _ref.showModal,
|
|
33
32
|
_ref$size = _ref.size,
|
|
34
|
-
size = _ref$size === void 0 ? EmbedModalSize.
|
|
33
|
+
size = _ref$size === void 0 ? EmbedModalSize.Large : _ref$size,
|
|
35
34
|
src = _ref.src,
|
|
36
35
|
_ref$testId = _ref.testId,
|
|
37
36
|
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
@@ -107,4 +106,4 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
107
106
|
}))));
|
|
108
107
|
};
|
|
109
108
|
|
|
110
|
-
export default
|
|
109
|
+
export default withAnalytics(withErrorBoundary(EmbedModal));
|
|
@@ -12,7 +12,7 @@ var LoadingSkeleton = function LoadingSkeleton(_ref) {
|
|
|
12
12
|
width = _ref.width,
|
|
13
13
|
height = _ref.height;
|
|
14
14
|
var animationNameStyles = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% { background-position: 50% 0; }\n 100% { background-position: -50% 0; }\n "])));
|
|
15
|
-
var styles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "rem;\n height: ", "rem;\n border-radius: 2px;\n user-select: none;\n background: ", ";\n background-image: linear-gradient(\n to right,\n
|
|
15
|
+
var styles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "rem;\n height: ", "rem;\n border-radius: 2px;\n user-select: none;\n background: ", ";\n background-image: linear-gradient(\n to right,\n transparent 0%,\n ", " 20%,\n transparent 40%,\n transparent 100%\n );\n background-repeat: no-repeat;\n background-size: 280% 100%;\n display: inline-block;\n\n animation-duration: 1s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: ", ";\n animation-timing-function: linear;\n "])), width, height, token('color.skeleton.subtle', '#f6f7f8'), token('color.skeleton', '#edeef1'), animationNameStyles);
|
|
16
16
|
return jsx("span", {
|
|
17
17
|
css: styles,
|
|
18
18
|
"data-testid": testId
|
|
@@ -16,4 +16,4 @@ export var Icon = styled.img(_templateObject2 || (_templateObject2 = _taggedTemp
|
|
|
16
16
|
// TODO: Replace this override with proper AtlasKit solution.
|
|
17
17
|
|
|
18
18
|
export var AKIconWrapper = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-right: -2px;\n"])));
|
|
19
|
-
export var Shimmer = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: 14px;\n width: 14px;\n margin-right: 4px;\n border-radius: 2px;\n user-select: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: ", ";\n background-image: linear-gradient(\n to right,\n
|
|
19
|
+
export var Shimmer = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: 14px;\n width: 14px;\n margin-right: 4px;\n border-radius: 2px;\n user-select: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: ", ";\n background-image: linear-gradient(\n to right,\n transparent 0%,\n ", " 20%,\n transparent 40%,\n transparent 100%\n );\n background-repeat: no-repeat;\n background-size: 40px 14px;\n display: inline-block;\n\n animation-duration: 1s;\n animation-fill-mode: forwards;\n animation-iteration-count: infinite;\n animation-name: ", ";\n animation-timing-function: linear;\n"])), token('color.skeleton.subtle', '#f6f7f8'), token('color.skeleton', '#edeef1'), placeholderShimmer);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
2
1
|
import { InvokeHandler } from '../../model/invoke-handler';
|
|
3
2
|
import { AnalyticsFacade } from '../../state/analytics';
|
|
4
3
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
@@ -8,7 +7,6 @@ export interface ExtractBlockOpts {
|
|
|
8
7
|
analytics: AnalyticsFacade;
|
|
9
8
|
origin?: AnalyticsOrigin;
|
|
10
9
|
extensionKey?: string;
|
|
11
|
-
featureFlags?: Partial<LinkingPlatformFeatureFlags>;
|
|
12
10
|
source?: CardInnerAppearance;
|
|
13
11
|
testId?: string;
|
|
14
12
|
}
|
|
@@ -2,7 +2,7 @@ import { JsonLd } from 'json-ld-types';
|
|
|
2
2
|
import { CardPlatform } from '../../../view/Card/types';
|
|
3
3
|
import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
|
|
4
4
|
import { ExtractBlockOpts } from '../../block/types';
|
|
5
|
-
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source,
|
|
5
|
+
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, }: ExtractBlockOpts & {
|
|
6
6
|
viewProps: BlockCardResolvedViewProps;
|
|
7
7
|
jsonLd: JsonLd.Data.BaseData;
|
|
8
8
|
platform?: JsonLd.Primitives.Platforms | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { ErrorInfo } from 'react';
|
|
2
|
-
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
3
2
|
import { AnalyticsFacade } from '../../../state/analytics';
|
|
4
3
|
import { EmbedModalWithExperimentProps } from '../../EmbedModal/types';
|
|
5
4
|
import { ActionProps } from '../components/Action';
|
|
@@ -24,7 +23,6 @@ declare type PreviewInfo = {
|
|
|
24
23
|
onDownloadActionClick?: () => void;
|
|
25
24
|
onOpen?: () => void;
|
|
26
25
|
onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
27
|
-
featureFlags?: Partial<LinkingPlatformFeatureFlags>;
|
|
28
26
|
analytics: AnalyticsFacade;
|
|
29
27
|
origin?: AnalyticsOrigin;
|
|
30
28
|
};
|
|
@@ -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, "url" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "appearance" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "ui" | "showActions" | "
|
|
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, "url" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "appearance" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "ui" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "showHoverPreview" | "inlinePreloaderStyle" | "importer" | "container" | "analyticsEvents" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EmbedModalProps } from './types';
|
|
3
|
-
declare const _default: React.FC<EmbedModalProps & import("./components/analytics/types").WithAnalytics
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
} & import("./components/size-experiment/types").WithSizeExperimentProps>;
|
|
3
|
+
declare const _default: React.FC<EmbedModalProps & import("./components/analytics/types").WithAnalytics>;
|
|
6
4
|
export default _default;
|
|
@@ -1,7 +1,5 @@
|
|
|
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';
|
|
5
3
|
import { WithAnalytics } from './components/analytics/types';
|
|
6
4
|
export declare enum EmbedModalSize {
|
|
7
5
|
Large = "large",
|
|
@@ -12,7 +10,6 @@ export declare type EmbedModalContext = {
|
|
|
12
10
|
size: EmbedModalSize;
|
|
13
11
|
};
|
|
14
12
|
export declare type EmbedModalProps = {
|
|
15
|
-
closeLabel?: string;
|
|
16
13
|
download?: string;
|
|
17
14
|
icon?: IconProps;
|
|
18
15
|
iframeName: string;
|
|
@@ -31,4 +28,4 @@ export declare type EmbedModalProps = {
|
|
|
31
28
|
title?: string;
|
|
32
29
|
url?: string;
|
|
33
30
|
};
|
|
34
|
-
export declare type EmbedModalWithExperimentProps = EmbedModalProps &
|
|
31
|
+
export declare type EmbedModalWithExperimentProps = EmbedModalProps & WithAnalytics;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
2
1
|
import { InvokeHandler } from '../../model/invoke-handler';
|
|
3
2
|
import { AnalyticsFacade } from '../../state/analytics';
|
|
4
3
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
@@ -8,7 +7,6 @@ export interface ExtractBlockOpts {
|
|
|
8
7
|
analytics: AnalyticsFacade;
|
|
9
8
|
origin?: AnalyticsOrigin;
|
|
10
9
|
extensionKey?: string;
|
|
11
|
-
featureFlags?: Partial<LinkingPlatformFeatureFlags>;
|
|
12
10
|
source?: CardInnerAppearance;
|
|
13
11
|
testId?: string;
|
|
14
12
|
}
|
|
@@ -2,7 +2,7 @@ import { JsonLd } from 'json-ld-types';
|
|
|
2
2
|
import { CardPlatform } from '../../../view/Card/types';
|
|
3
3
|
import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
|
|
4
4
|
import { ExtractBlockOpts } from '../../block/types';
|
|
5
|
-
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source,
|
|
5
|
+
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, }: ExtractBlockOpts & {
|
|
6
6
|
viewProps: BlockCardResolvedViewProps;
|
|
7
7
|
jsonLd: JsonLd.Data.BaseData;
|
|
8
8
|
platform?: JsonLd.Primitives.Platforms | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { ErrorInfo } from 'react';
|
|
2
|
-
import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
|
|
3
2
|
import { AnalyticsFacade } from '../../../state/analytics';
|
|
4
3
|
import { EmbedModalWithExperimentProps } from '../../EmbedModal/types';
|
|
5
4
|
import { ActionProps } from '../components/Action';
|
|
@@ -24,7 +23,6 @@ declare type PreviewInfo = {
|
|
|
24
23
|
onDownloadActionClick?: () => void;
|
|
25
24
|
onOpen?: () => void;
|
|
26
25
|
onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
27
|
-
featureFlags?: Partial<LinkingPlatformFeatureFlags>;
|
|
28
26
|
analytics: AnalyticsFacade;
|
|
29
27
|
origin?: AnalyticsOrigin;
|
|
30
28
|
};
|
|
@@ -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, "url" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "appearance" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "ui" | "showActions" | "
|
|
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, "url" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "appearance" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "ui" | "showActions" | "onResolve" | "platform" | "isFrameVisible" | "embedIframeRef" | "showHoverPreview" | "inlinePreloaderStyle" | "importer" | "container" | "analyticsEvents" | "forwardedRef"> & React.RefAttributes<any>>;
|
|
5
5
|
export type { CardAppearance, CardProps, CardPlatform };
|