@atlaskit/smart-card 26.44.2 → 26.45.1
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/block/index.js +3 -2
- package/dist/cjs/extractors/common/actions/extractActions.js +15 -2
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +8 -1
- package/dist/cjs/extractors/flexible/actions/extract-download-action.js +7 -2
- package/dist/cjs/extractors/flexible/actions/extract-follow-action.js +4 -2
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +6 -1
- package/dist/cjs/extractors/flexible/actions/extract-view-action.js +6 -1
- package/dist/cjs/extractors/flexible/extract-state.js +5 -2
- package/dist/cjs/extractors/flexible/index.js +6 -6
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +16 -23
- package/dist/cjs/utils/actions/can-show-action.js +16 -0
- package/dist/cjs/utils/actions/combine-action-options.js +35 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/index.js +6 -7
- package/dist/cjs/view/BlockCard/views/ForbiddenView.js +3 -4
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +2 -4
- package/dist/cjs/view/BlockCard/views/UnauthorizedView.js +2 -3
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +2 -2
- package/dist/cjs/view/Card/types.js +10 -1
- package/dist/cjs/view/CardWithData/component.js +2 -4
- package/dist/cjs/view/CardWithData/loader.js +1 -3
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +2 -6
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +1 -5
- package/dist/cjs/view/CardWithUrl/component.js +10 -9
- package/dist/cjs/view/CardWithUrl/loader.js +2 -0
- package/dist/cjs/view/EmbedCard/index.js +4 -4
- package/dist/cjs/view/FlexibleCard/components/container/hover-card-control/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/container/index.js +2 -3
- package/dist/cjs/view/FlexibleCard/index.js +4 -4
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +8 -5
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +2 -2
- package/dist/cjs/view/InlineCard/ResolvedView/index.js +3 -4
- package/dist/cjs/view/InlineCard/index.js +2 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/block/index.js +3 -2
- package/dist/es2019/extractors/common/actions/extractActions.js +13 -2
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +8 -1
- package/dist/es2019/extractors/flexible/actions/extract-download-action.js +7 -2
- package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +4 -2
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +6 -1
- package/dist/es2019/extractors/flexible/actions/extract-view-action.js +6 -1
- package/dist/es2019/extractors/flexible/extract-state.js +5 -2
- package/dist/es2019/extractors/flexible/index.js +6 -6
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +15 -18
- package/dist/es2019/utils/actions/can-show-action.js +10 -0
- package/dist/es2019/utils/actions/combine-action-options.js +27 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/index.js +6 -7
- package/dist/es2019/view/BlockCard/views/ForbiddenView.js +3 -3
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +2 -3
- package/dist/es2019/view/BlockCard/views/UnauthorizedView.js +2 -2
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +2 -2
- package/dist/es2019/view/Card/types.js +8 -1
- package/dist/es2019/view/CardWithData/component.js +2 -4
- package/dist/es2019/view/CardWithData/loader.js +1 -3
- package/dist/es2019/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +1 -5
- package/dist/es2019/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +1 -5
- package/dist/es2019/view/CardWithUrl/component.js +10 -9
- package/dist/es2019/view/CardWithUrl/loader.js +2 -0
- package/dist/es2019/view/EmbedCard/index.js +4 -4
- package/dist/es2019/view/FlexibleCard/components/container/hover-card-control/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/container/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/index.js +4 -4
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +8 -4
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +2 -2
- package/dist/es2019/view/InlineCard/ResolvedView/index.js +3 -3
- package/dist/es2019/view/InlineCard/index.js +2 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/block/index.js +3 -2
- package/dist/esm/extractors/common/actions/extractActions.js +15 -2
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +8 -1
- package/dist/esm/extractors/flexible/actions/extract-download-action.js +7 -2
- package/dist/esm/extractors/flexible/actions/extract-follow-action.js +4 -2
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +6 -1
- package/dist/esm/extractors/flexible/actions/extract-view-action.js +6 -1
- package/dist/esm/extractors/flexible/extract-state.js +5 -2
- package/dist/esm/extractors/flexible/index.js +6 -6
- package/dist/esm/index.js +1 -0
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +17 -24
- package/dist/esm/utils/actions/can-show-action.js +10 -0
- package/dist/esm/utils/actions/combine-action-options.js +28 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/index.js +6 -7
- package/dist/esm/view/BlockCard/views/ForbiddenView.js +3 -4
- package/dist/esm/view/BlockCard/views/ResolvedView.js +2 -4
- package/dist/esm/view/BlockCard/views/UnauthorizedView.js +2 -3
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +2 -2
- package/dist/esm/view/Card/types.js +8 -1
- package/dist/esm/view/CardWithData/component.js +2 -4
- package/dist/esm/view/CardWithData/loader.js +1 -3
- package/dist/esm/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +2 -6
- package/dist/esm/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +1 -5
- package/dist/esm/view/CardWithUrl/component.js +10 -9
- package/dist/esm/view/CardWithUrl/loader.js +2 -0
- package/dist/esm/view/EmbedCard/index.js +4 -4
- package/dist/esm/view/FlexibleCard/components/container/hover-card-control/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/container/index.js +2 -3
- package/dist/esm/view/FlexibleCard/index.js +4 -4
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +8 -5
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +2 -2
- package/dist/esm/view/InlineCard/ResolvedView/index.js +3 -4
- package/dist/esm/view/InlineCard/index.js +2 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/block/types.d.ts +2 -1
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +1 -0
- package/dist/types/extractors/common/actions/extractActions.d.ts +2 -1
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +2 -1
- package/dist/types/extractors/flexible/actions/extract-follow-action.d.ts +2 -1
- package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +2 -1
- package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +2 -1
- package/dist/types/extractors/flexible/extract-state.d.ts +2 -1
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +10 -2
- package/dist/types/utils/actions/can-show-action.d.ts +2 -0
- package/dist/types/utils/actions/combine-action-options.d.ts +2 -0
- package/dist/types/view/BlockCard/types.d.ts +2 -3
- package/dist/types/view/BlockCard/views/ForbiddenView.d.ts +3 -2
- package/dist/types/view/BlockCard/views/ResolvedView.d.ts +1 -2
- package/dist/types/view/BlockCard/views/UnauthorizedView.d.ts +3 -2
- package/dist/types/view/BlockCard/views/flexible/types.d.ts +1 -1
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +20 -2
- package/dist/types/view/CardWithData/types.d.ts +7 -1
- package/dist/types/view/CardWithUrl/types.d.ts +12 -1
- package/dist/types/view/EmbedCard/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/container/hover-card-control/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/container/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/types.d.ts +4 -4
- package/dist/types/view/HoverCard/types.d.ts +9 -2
- package/dist/types/view/InlineCard/ResolvedView/index.d.ts +3 -2
- package/dist/types/view/InlineCard/types.d.ts +2 -1
- package/dist/types-ts4.5/extractors/block/types.d.ts +2 -1
- package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +1 -0
- package/dist/types-ts4.5/extractors/common/actions/extractActions.d.ts +2 -1
- package/dist/types-ts4.5/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +2 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-follow-action.d.ts +2 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +2 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +2 -1
- package/dist/types-ts4.5/extractors/flexible/extract-state.d.ts +2 -1
- package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/state/hooks-external/useSmartLinkActions.d.ts +10 -2
- package/dist/types-ts4.5/utils/actions/can-show-action.d.ts +2 -0
- package/dist/types-ts4.5/utils/actions/combine-action-options.d.ts +2 -0
- package/dist/types-ts4.5/view/BlockCard/types.d.ts +2 -3
- package/dist/types-ts4.5/view/BlockCard/views/ForbiddenView.d.ts +3 -2
- package/dist/types-ts4.5/view/BlockCard/views/ResolvedView.d.ts +1 -2
- package/dist/types-ts4.5/view/BlockCard/views/UnauthorizedView.d.ts +3 -2
- package/dist/types-ts4.5/view/BlockCard/views/flexible/types.d.ts +1 -1
- package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.5/view/Card/types.d.ts +20 -2
- package/dist/types-ts4.5/view/CardWithData/types.d.ts +7 -1
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +12 -1
- package/dist/types-ts4.5/view/EmbedCard/types.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/container/hover-card-control/types.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/container/types.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +4 -4
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +9 -2
- package/dist/types-ts4.5/view/InlineCard/ResolvedView/index.d.ts +3 -2
- package/dist/types-ts4.5/view/InlineCard/types.d.ts +2 -1
- package/package.json +8 -5
|
@@ -37,11 +37,10 @@ export const BlockCard = ({
|
|
|
37
37
|
onResolve,
|
|
38
38
|
onError,
|
|
39
39
|
testId,
|
|
40
|
-
showActions,
|
|
41
40
|
platform,
|
|
42
41
|
analytics,
|
|
43
42
|
enableFlexibleBlockCard,
|
|
44
|
-
|
|
43
|
+
actionOptions
|
|
45
44
|
}) => {
|
|
46
45
|
var _details$meta, _forbiddenViewProps$c;
|
|
47
46
|
const {
|
|
@@ -55,7 +54,8 @@ export const BlockCard = ({
|
|
|
55
54
|
analytics,
|
|
56
55
|
origin: 'smartLinkCard',
|
|
57
56
|
handleInvoke,
|
|
58
|
-
extensionKey
|
|
57
|
+
extensionKey,
|
|
58
|
+
actionOptions
|
|
59
59
|
};
|
|
60
60
|
if (enableFlexibleBlockCard) {
|
|
61
61
|
const flexibleBlockCardProps = {
|
|
@@ -67,7 +67,7 @@ export const BlockCard = ({
|
|
|
67
67
|
onError,
|
|
68
68
|
onResolve,
|
|
69
69
|
renderers,
|
|
70
|
-
|
|
70
|
+
actionOptions,
|
|
71
71
|
analytics
|
|
72
72
|
};
|
|
73
73
|
switch (status) {
|
|
@@ -130,7 +130,6 @@ export const BlockCard = ({
|
|
|
130
130
|
return jsx(BlockCardResolvedView, _extends({}, resolvedViewProps, {
|
|
131
131
|
isSelected: isSelected,
|
|
132
132
|
testId: testId,
|
|
133
|
-
showActions: showActions,
|
|
134
133
|
onClick: handleFrameClick
|
|
135
134
|
}));
|
|
136
135
|
case 'unauthorized':
|
|
@@ -144,8 +143,8 @@ export const BlockCard = ({
|
|
|
144
143
|
return jsx(BlockCardUnauthorisedView, _extends({}, unauthorizedViewProps, {
|
|
145
144
|
isSelected: isSelected,
|
|
146
145
|
testId: testId,
|
|
147
|
-
showActions: showActions,
|
|
148
146
|
actions: handleAuthorize ? [AuthorizeAction(handleAuthorize)] : [],
|
|
147
|
+
actionOptions: actionOptions,
|
|
149
148
|
onClick: handleFrameClick
|
|
150
149
|
}));
|
|
151
150
|
case 'forbidden':
|
|
@@ -164,8 +163,8 @@ export const BlockCard = ({
|
|
|
164
163
|
});
|
|
165
164
|
return jsx(BlockCardForbiddenView, _extends({}, forbiddenViewProps, {
|
|
166
165
|
isSelected: isSelected,
|
|
167
|
-
showActions: showActions,
|
|
168
166
|
actions: handleAuthorize ? [ForbiddenAction(handleAuthorize)] : [],
|
|
167
|
+
actionOptions: actionOptions,
|
|
169
168
|
onClick: handleFrameClick,
|
|
170
169
|
requestAccessContext: requestAccessContext
|
|
171
170
|
}));
|
|
@@ -24,10 +24,10 @@ export const ForbiddenView = ({
|
|
|
24
24
|
isSelected = false,
|
|
25
25
|
actions = [],
|
|
26
26
|
testId = 'block-card-forbidden-view',
|
|
27
|
-
showActions = true,
|
|
28
27
|
link = '',
|
|
29
28
|
onClick = () => {},
|
|
30
|
-
requestAccessContext = {}
|
|
29
|
+
requestAccessContext = {},
|
|
30
|
+
actionOptions
|
|
31
31
|
}) => {
|
|
32
32
|
const handleClick = event => handleClickCommon(event, onClick);
|
|
33
33
|
const {
|
|
@@ -64,7 +64,7 @@ export const ForbiddenView = ({
|
|
|
64
64
|
}))), jsx(ContentFooter, null, jsx(Provider, {
|
|
65
65
|
name: context.text,
|
|
66
66
|
icon: context.icon
|
|
67
|
-
}),
|
|
67
|
+
}), !(actionOptions !== null && actionOptions !== void 0 && actionOptions.hide) && jsx(ActionList, {
|
|
68
68
|
items: items
|
|
69
69
|
}))));
|
|
70
70
|
};
|
|
@@ -38,8 +38,7 @@ export const ResolvedView = ({
|
|
|
38
38
|
byline = '',
|
|
39
39
|
lozenge,
|
|
40
40
|
details = [],
|
|
41
|
-
testId = 'block-card-resolved-view'
|
|
42
|
-
showActions = true
|
|
41
|
+
testId = 'block-card-resolved-view'
|
|
43
42
|
}) => {
|
|
44
43
|
const resolvedMetadata = details.length > 0 ? jsx(MetadataList, {
|
|
45
44
|
testId: testId ? `${testId}-meta` : undefined,
|
|
@@ -50,7 +49,7 @@ export const ResolvedView = ({
|
|
|
50
49
|
className: blockCardResolvedViewByClassName
|
|
51
50
|
}, byline);
|
|
52
51
|
const handleClick = event => handleClickCommon(event, onClick);
|
|
53
|
-
const hasActions =
|
|
52
|
+
const hasActions = actions.length > 0;
|
|
54
53
|
return jsx(Frame, {
|
|
55
54
|
isSelected: isSelected,
|
|
56
55
|
testId: testId,
|
|
@@ -22,7 +22,7 @@ export const UnauthorizedView = ({
|
|
|
22
22
|
isSelected = false,
|
|
23
23
|
actions = [],
|
|
24
24
|
testId = 'block-card-unauthorized-view',
|
|
25
|
-
|
|
25
|
+
actionOptions,
|
|
26
26
|
link = '',
|
|
27
27
|
onClick = () => {}
|
|
28
28
|
}) => {
|
|
@@ -49,7 +49,7 @@ export const UnauthorizedView = ({
|
|
|
49
49
|
})), jsx(ContentFooter, null, jsx(Provider, {
|
|
50
50
|
name: context.text,
|
|
51
51
|
icon: context.icon
|
|
52
|
-
}),
|
|
52
|
+
}), !(actionOptions !== null && actionOptions !== void 0 && actionOptions.hide) && jsx(ActionList, {
|
|
53
53
|
items: actions
|
|
54
54
|
}))));
|
|
55
55
|
};
|
|
@@ -16,7 +16,7 @@ const FlexibleResolvedView = ({
|
|
|
16
16
|
onClick,
|
|
17
17
|
onError,
|
|
18
18
|
onResolve,
|
|
19
|
-
|
|
19
|
+
actionOptions,
|
|
20
20
|
testId = 'smart-block-resolved-view',
|
|
21
21
|
url,
|
|
22
22
|
analytics
|
|
@@ -50,7 +50,7 @@ const FlexibleResolvedView = ({
|
|
|
50
50
|
onClick: onClick,
|
|
51
51
|
onError: onError,
|
|
52
52
|
onResolve: onResolve,
|
|
53
|
-
|
|
53
|
+
actionOptions: actionOptions,
|
|
54
54
|
testId: testId,
|
|
55
55
|
ui: FlexibleCardUiOptions,
|
|
56
56
|
url: url
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export let CardAction = /*#__PURE__*/function (CardAction) {
|
|
2
|
+
CardAction["DownloadAction"] = "DownloadAction";
|
|
3
|
+
CardAction["PreviewAction"] = "PreviewAction";
|
|
4
|
+
CardAction["ViewAction"] = "ViewAction";
|
|
5
|
+
CardAction["ChangeStatusAction"] = "ChangeStatusAction";
|
|
6
|
+
CardAction["FollowAction"] = "FollowAction";
|
|
7
|
+
return CardAction;
|
|
8
|
+
}({});
|
|
@@ -13,8 +13,7 @@ export class CardWithDataContent extends React.Component {
|
|
|
13
13
|
appearance,
|
|
14
14
|
onClick,
|
|
15
15
|
onResolve,
|
|
16
|
-
testId
|
|
17
|
-
showActions
|
|
16
|
+
testId
|
|
18
17
|
} = this.props;
|
|
19
18
|
if (appearance === 'inline') {
|
|
20
19
|
const props = extractInlineProps(details || getEmptyJsonLd());
|
|
@@ -37,8 +36,7 @@ export class CardWithDataContent extends React.Component {
|
|
|
37
36
|
}
|
|
38
37
|
return /*#__PURE__*/React.createElement(BlockCardResolvedView, _extends({}, props, {
|
|
39
38
|
isSelected: isSelected,
|
|
40
|
-
onClick: onClick
|
|
41
|
-
showActions: showActions
|
|
39
|
+
onClick: onClick
|
|
42
40
|
}));
|
|
43
41
|
}
|
|
44
42
|
}
|
|
@@ -21,7 +21,6 @@ export class CardWithDataRenderer extends React.PureComponent {
|
|
|
21
21
|
onClick,
|
|
22
22
|
onResolve,
|
|
23
23
|
testId,
|
|
24
|
-
showActions,
|
|
25
24
|
inlinePreloaderStyle
|
|
26
25
|
} = this.props;
|
|
27
26
|
if (!data) {
|
|
@@ -36,8 +35,7 @@ export class CardWithDataRenderer extends React.PureComponent {
|
|
|
36
35
|
isSelected: isSelected,
|
|
37
36
|
onClick: onClick,
|
|
38
37
|
onResolve: onResolve,
|
|
39
|
-
testId: testId
|
|
40
|
-
showActions: showActions
|
|
38
|
+
testId: testId
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
41
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import React, { useCallback, useState } from 'react';
|
|
3
2
|
import { usePrefetch } from '../../../state';
|
|
4
3
|
import { CardWithUrlContent } from '../component';
|
|
@@ -13,7 +12,6 @@ const ROOT_MARGIN_VERTICAL = '360px';
|
|
|
13
12
|
export function LazyIntersectionObserverCard(props) {
|
|
14
13
|
const [isIntersecting, setIsIntersecting] = useState(false);
|
|
15
14
|
const {
|
|
16
|
-
showActions,
|
|
17
15
|
appearance,
|
|
18
16
|
url,
|
|
19
17
|
id
|
|
@@ -41,9 +39,7 @@ export function LazyIntersectionObserverCard(props) {
|
|
|
41
39
|
intersectionObserver.observe(element);
|
|
42
40
|
return () => intersectionObserver.disconnect();
|
|
43
41
|
}, [onIntersection]);
|
|
44
|
-
const content = isIntersecting ? /*#__PURE__*/React.createElement(CardWithUrlContent,
|
|
45
|
-
showActions: showActions
|
|
46
|
-
})) : /*#__PURE__*/React.createElement(ComponentObserver, {
|
|
42
|
+
const content = isIntersecting ? /*#__PURE__*/React.createElement(CardWithUrlContent, props) : /*#__PURE__*/React.createElement(ComponentObserver, {
|
|
47
43
|
ref: onRef
|
|
48
44
|
}, /*#__PURE__*/React.createElement(LoadingCardLink, props));
|
|
49
45
|
return /*#__PURE__*/React.createElement(Component, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import React, { useState } from 'react';
|
|
3
2
|
import LazilyRender from 'react-lazily-render';
|
|
4
3
|
import { CardWithUrlContent } from '../component';
|
|
@@ -8,7 +7,6 @@ export function LazyLazilyRenderCard(props) {
|
|
|
8
7
|
const {
|
|
9
8
|
appearance,
|
|
10
9
|
container,
|
|
11
|
-
showActions,
|
|
12
10
|
id
|
|
13
11
|
} = props;
|
|
14
12
|
const offset = Math.ceil(window.innerHeight / 4);
|
|
@@ -22,8 +20,6 @@ export function LazyLazilyRenderCard(props) {
|
|
|
22
20
|
className: "loader-wrapper",
|
|
23
21
|
placeholder: /*#__PURE__*/React.createElement(LoadingCardLink, props),
|
|
24
22
|
scrollContainer: container,
|
|
25
|
-
content: /*#__PURE__*/React.createElement(CardWithUrlContent,
|
|
26
|
-
showActions: showActions
|
|
27
|
-
}))
|
|
23
|
+
content: /*#__PURE__*/React.createElement(CardWithUrlContent, props)
|
|
28
24
|
});
|
|
29
25
|
}
|
|
@@ -12,6 +12,7 @@ import { isFlexibleUiCard } from '../../utils/flexible';
|
|
|
12
12
|
import FlexibleCard from '../FlexibleCard';
|
|
13
13
|
import { CardDisplay } from '../../constants';
|
|
14
14
|
import { fireLinkClickedEvent } from '../../utils/analytics/click';
|
|
15
|
+
import { combineActionOptions } from '../../utils/actions/combine-action-options';
|
|
15
16
|
import { SmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
|
|
16
17
|
function Component({
|
|
17
18
|
id,
|
|
@@ -29,6 +30,7 @@ function Component({
|
|
|
29
30
|
testId,
|
|
30
31
|
showActions,
|
|
31
32
|
showServerActions: showServerActionsProp,
|
|
33
|
+
actionOptions: actionOptionsProp,
|
|
32
34
|
inheritDimensions,
|
|
33
35
|
embedIframeRef,
|
|
34
36
|
embedIframeUrlType,
|
|
@@ -62,7 +64,8 @@ function Component({
|
|
|
62
64
|
const canBeDatasource = getCanBeDatasource(state.details);
|
|
63
65
|
let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
|
|
64
66
|
const enableFlexibleBlockCardFlag = Boolean(useFeatureFlag('enableFlexibleBlockCard'));
|
|
65
|
-
const
|
|
67
|
+
const hideServerActions = showServerActionsProp === false || platform === 'mobile';
|
|
68
|
+
const actionOptions = combineActionOptions(actionOptionsProp, !hideServerActions, showActions);
|
|
66
69
|
|
|
67
70
|
// Setup UI handlers.
|
|
68
71
|
const handleClickWrapper = useCallback(event => {
|
|
@@ -180,7 +183,7 @@ function Component({
|
|
|
180
183
|
ui: ui,
|
|
181
184
|
showHoverPreview: showHoverPreview,
|
|
182
185
|
showAuthTooltip: showAuthTooltip,
|
|
183
|
-
|
|
186
|
+
actionOptions: actionOptions,
|
|
184
187
|
url: url,
|
|
185
188
|
testId: testId,
|
|
186
189
|
onResolve: onResolve,
|
|
@@ -195,7 +198,7 @@ function Component({
|
|
|
195
198
|
}
|
|
196
199
|
switch (appearance) {
|
|
197
200
|
case 'inline':
|
|
198
|
-
|
|
201
|
+
return /*#__PURE__*/React.createElement(InlineCard, {
|
|
199
202
|
analytics: analytics,
|
|
200
203
|
id: id,
|
|
201
204
|
url: url,
|
|
@@ -211,9 +214,8 @@ function Component({
|
|
|
211
214
|
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
212
215
|
showHoverPreview: showHoverPreview,
|
|
213
216
|
showAuthTooltip: showAuthTooltip,
|
|
214
|
-
|
|
215
|
-
};
|
|
216
|
-
return /*#__PURE__*/React.createElement(InlineCard, inlineProps);
|
|
217
|
+
actionOptions: actionOptions
|
|
218
|
+
});
|
|
217
219
|
case 'block':
|
|
218
220
|
return /*#__PURE__*/React.createElement(BlockCard, {
|
|
219
221
|
id: id,
|
|
@@ -230,8 +232,7 @@ function Component({
|
|
|
230
232
|
onResolve: onResolve,
|
|
231
233
|
onError: onError,
|
|
232
234
|
testId: testId,
|
|
233
|
-
|
|
234
|
-
showServerActions: showServerActions,
|
|
235
|
+
actionOptions: actionOptions,
|
|
235
236
|
platform: platform,
|
|
236
237
|
enableFlexibleBlockCard: enableFlexibleBlockCardFlag
|
|
237
238
|
});
|
|
@@ -254,7 +255,7 @@ function Component({
|
|
|
254
255
|
onError: onError,
|
|
255
256
|
testId: testId,
|
|
256
257
|
inheritDimensions: inheritDimensions,
|
|
257
|
-
|
|
258
|
+
actionOptions: actionOptions,
|
|
258
259
|
ref: embedIframeRef,
|
|
259
260
|
onIframeDwell: onIframeDwell,
|
|
260
261
|
onIframeFocus: onIframeFocus
|
|
@@ -30,6 +30,7 @@ export function CardWithURLRenderer(props) {
|
|
|
30
30
|
testId,
|
|
31
31
|
showActions,
|
|
32
32
|
showServerActions,
|
|
33
|
+
actionOptions,
|
|
33
34
|
inheritDimensions,
|
|
34
35
|
platform,
|
|
35
36
|
embedIframeRef,
|
|
@@ -98,6 +99,7 @@ export function CardWithURLRenderer(props) {
|
|
|
98
99
|
testId,
|
|
99
100
|
showActions,
|
|
100
101
|
showServerActions,
|
|
102
|
+
actionOptions,
|
|
101
103
|
inheritDimensions,
|
|
102
104
|
platform,
|
|
103
105
|
embedIframeRef,
|
|
@@ -25,7 +25,6 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
25
25
|
handleFrameClick,
|
|
26
26
|
analytics,
|
|
27
27
|
handleInvoke,
|
|
28
|
-
showActions,
|
|
29
28
|
isSelected,
|
|
30
29
|
isFrameVisible,
|
|
31
30
|
frameStyle,
|
|
@@ -36,7 +35,8 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
36
35
|
inheritDimensions,
|
|
37
36
|
onIframeDwell,
|
|
38
37
|
onIframeFocus,
|
|
39
|
-
iframeUrlType
|
|
38
|
+
iframeUrlType,
|
|
39
|
+
actionOptions
|
|
40
40
|
}, iframeRef) => {
|
|
41
41
|
var _details$meta, _forbiddenViewProps$c, _forbiddenViewProps$c2, _notFoundViewProps$co, _notFoundViewProps$co2;
|
|
42
42
|
const {
|
|
@@ -89,12 +89,12 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
89
89
|
analytics,
|
|
90
90
|
origin: 'smartLinkEmbed',
|
|
91
91
|
handleInvoke,
|
|
92
|
-
extensionKey
|
|
92
|
+
extensionKey,
|
|
93
|
+
actionOptions
|
|
93
94
|
});
|
|
94
95
|
return /*#__PURE__*/React.createElement(BlockCardResolvedView, _extends({}, resolvedBlockViewProps, {
|
|
95
96
|
isSelected: isSelected,
|
|
96
97
|
testId: testId,
|
|
97
|
-
showActions: showActions,
|
|
98
98
|
onClick: handleFrameClick
|
|
99
99
|
}));
|
|
100
100
|
}
|
|
@@ -7,7 +7,7 @@ const HoverCardControl = ({
|
|
|
7
7
|
hideHoverCardPreviewButton,
|
|
8
8
|
isHoverPreview,
|
|
9
9
|
isAuthTooltip,
|
|
10
|
-
|
|
10
|
+
actionOptions,
|
|
11
11
|
testId,
|
|
12
12
|
url,
|
|
13
13
|
delay = FLEXIBLE_HOVER_CARD_CAN_OPEN_DELAY
|
|
@@ -54,7 +54,7 @@ const HoverCardControl = ({
|
|
|
54
54
|
canOpen: canOpen,
|
|
55
55
|
closeOnChildClick: true,
|
|
56
56
|
hidePreviewButton: hideHoverCardPreviewButton,
|
|
57
|
-
|
|
57
|
+
actionOptions: actionOptions,
|
|
58
58
|
url: url
|
|
59
59
|
}, /*#__PURE__*/React.createElement("span", {
|
|
60
60
|
onMouseLeave: onMouseLeave,
|
|
@@ -179,7 +179,7 @@ const Container = ({
|
|
|
179
179
|
retry,
|
|
180
180
|
showAuthTooltip = false,
|
|
181
181
|
showHoverPreview = false,
|
|
182
|
-
|
|
182
|
+
actionOptions,
|
|
183
183
|
size = SmartLinkSize.Medium,
|
|
184
184
|
status,
|
|
185
185
|
testId = 'smart-links-container',
|
|
@@ -201,7 +201,7 @@ const Container = ({
|
|
|
201
201
|
hideHoverCardPreviewButton: hideHoverCardPreviewButton,
|
|
202
202
|
isHoverPreview: canShowHoverPreview,
|
|
203
203
|
isAuthTooltip: canShowAuthTooltip,
|
|
204
|
-
|
|
204
|
+
actionOptions: actionOptions,
|
|
205
205
|
testId: testId,
|
|
206
206
|
url: context.url
|
|
207
207
|
}, container);
|
|
@@ -24,7 +24,7 @@ const FlexibleCard = ({
|
|
|
24
24
|
renderers,
|
|
25
25
|
showAuthTooltip,
|
|
26
26
|
showHoverPreview,
|
|
27
|
-
|
|
27
|
+
actionOptions,
|
|
28
28
|
testId,
|
|
29
29
|
ui,
|
|
30
30
|
url
|
|
@@ -39,10 +39,10 @@ const FlexibleCard = ({
|
|
|
39
39
|
response: details,
|
|
40
40
|
id,
|
|
41
41
|
renderers,
|
|
42
|
-
|
|
42
|
+
actionOptions,
|
|
43
43
|
status,
|
|
44
44
|
url
|
|
45
|
-
}), [details, id, renderers,
|
|
45
|
+
}), [details, id, renderers, actionOptions, status, url]);
|
|
46
46
|
const retry = getRetryOptions(url, status, details, onAuthorize);
|
|
47
47
|
const {
|
|
48
48
|
title
|
|
@@ -91,7 +91,7 @@ const FlexibleCard = ({
|
|
|
91
91
|
onClick: onClick,
|
|
92
92
|
retry: retry,
|
|
93
93
|
showHoverPreview: showHoverPreview,
|
|
94
|
-
|
|
94
|
+
actionOptions: actionOptions,
|
|
95
95
|
showAuthTooltip: showAuthTooltip,
|
|
96
96
|
status: status
|
|
97
97
|
}), children))));
|
|
@@ -11,6 +11,7 @@ import CustomPopupContainer from '../components/CustomPopupContainer';
|
|
|
11
11
|
import { CARD_GAP_PX, HOVER_CARD_Z_INDEX } from '../styled';
|
|
12
12
|
import { CardDisplay } from '../../../constants';
|
|
13
13
|
import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
14
|
+
import { combineActionOptions } from '../../../utils/actions/combine-action-options';
|
|
14
15
|
import { useSmartCardActions } from '../../../state/actions';
|
|
15
16
|
import { useSmartLinkAnalytics } from '../../../state/analytics';
|
|
16
17
|
const HOVER_CARD_SOURCE = 'smartLinkPreviewHoverCard';
|
|
@@ -25,7 +26,8 @@ export const HoverCardComponent = ({
|
|
|
25
26
|
canOpen = true,
|
|
26
27
|
closeOnChildClick = false,
|
|
27
28
|
hidePreviewButton = false,
|
|
28
|
-
showServerActions
|
|
29
|
+
showServerActions,
|
|
30
|
+
actionOptions: actionOptionsProp,
|
|
29
31
|
allowEventPropagation = false,
|
|
30
32
|
zIndex = HOVER_CARD_Z_INDEX,
|
|
31
33
|
noFadeDelay = false
|
|
@@ -43,6 +45,7 @@ export const HoverCardComponent = ({
|
|
|
43
45
|
const {
|
|
44
46
|
loadMetadata
|
|
45
47
|
} = useSmartCardActions(id, url, analytics);
|
|
48
|
+
const actionOptions = combineActionOptions(actionOptionsProp, showServerActions);
|
|
46
49
|
const setMousePosition = useCallback(event => {
|
|
47
50
|
if (isOpen && canOpen) {
|
|
48
51
|
return;
|
|
@@ -143,7 +146,8 @@ export const HoverCardComponent = ({
|
|
|
143
146
|
url,
|
|
144
147
|
appearance: CardDisplay.HoverCardPreview,
|
|
145
148
|
analyticsHandler,
|
|
146
|
-
origin: HOVER_CARD_SOURCE
|
|
149
|
+
origin: HOVER_CARD_SOURCE,
|
|
150
|
+
actionOptions
|
|
147
151
|
});
|
|
148
152
|
const filteredActions = useMemo(() => {
|
|
149
153
|
return hidePreviewButton ? linkActions.filter(action => action.id !== 'preview-content') : linkActions;
|
|
@@ -176,7 +180,7 @@ export const HoverCardComponent = ({
|
|
|
176
180
|
onActionClick,
|
|
177
181
|
onResolve: update,
|
|
178
182
|
renderers,
|
|
179
|
-
|
|
183
|
+
actionOptions,
|
|
180
184
|
url,
|
|
181
185
|
id
|
|
182
186
|
};
|
|
@@ -186,7 +190,7 @@ export const HoverCardComponent = ({
|
|
|
186
190
|
id: id,
|
|
187
191
|
source: HOVER_CARD_SOURCE
|
|
188
192
|
}, jsx(HoverCardContent, hoverCardContentProps));
|
|
189
|
-
}, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers,
|
|
193
|
+
}, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers, actionOptions, url, id]);
|
|
190
194
|
const trigger = useCallback(triggerProps => jsx("span", {
|
|
191
195
|
ref: parentSpan
|
|
192
196
|
}, jsx("span", _extends({}, triggerProps, {
|
|
@@ -41,7 +41,7 @@ const HoverCardContent = ({
|
|
|
41
41
|
url,
|
|
42
42
|
onMouseEnter,
|
|
43
43
|
onMouseLeave,
|
|
44
|
-
|
|
44
|
+
actionOptions
|
|
45
45
|
}) => {
|
|
46
46
|
var _linkState$status, _cardState$details;
|
|
47
47
|
const {
|
|
@@ -117,7 +117,7 @@ const HoverCardContent = ({
|
|
|
117
117
|
onClick: onClick,
|
|
118
118
|
onResolve: onResolve,
|
|
119
119
|
renderers: renderers,
|
|
120
|
-
|
|
120
|
+
actionOptions,
|
|
121
121
|
ui: flexibleUiOptions,
|
|
122
122
|
url: url,
|
|
123
123
|
children: {},
|
|
@@ -31,7 +31,7 @@ export class InlineCardResolvedView extends React.Component {
|
|
|
31
31
|
titleTextColor,
|
|
32
32
|
titlePrefix,
|
|
33
33
|
showHoverPreview = false,
|
|
34
|
-
|
|
34
|
+
actionOptions
|
|
35
35
|
} = this.props;
|
|
36
36
|
const inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
|
|
37
37
|
testId: testId,
|
|
@@ -48,8 +48,8 @@ export class InlineCardResolvedView extends React.Component {
|
|
|
48
48
|
if (showHoverPreview && link) {
|
|
49
49
|
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
50
50
|
id: id,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
url: link,
|
|
52
|
+
actionOptions: actionOptions
|
|
53
53
|
}, inlineCardResolvedView);
|
|
54
54
|
}
|
|
55
55
|
return inlineCardResolvedView;
|
|
@@ -31,7 +31,7 @@ export const InlineCard = ({
|
|
|
31
31
|
inlinePreloaderStyle,
|
|
32
32
|
showHoverPreview,
|
|
33
33
|
showAuthTooltip,
|
|
34
|
-
|
|
34
|
+
actionOptions
|
|
35
35
|
}) => {
|
|
36
36
|
var _details$meta, _providerForbidden$te;
|
|
37
37
|
const {
|
|
@@ -85,7 +85,7 @@ export const InlineCard = ({
|
|
|
85
85
|
return /*#__PURE__*/React.createElement(InlineCardResolvedView, _extends({}, resolvedProps, {
|
|
86
86
|
id: id,
|
|
87
87
|
showHoverPreview: showHoverPreview,
|
|
88
|
-
|
|
88
|
+
actionOptions: actionOptions,
|
|
89
89
|
link: url,
|
|
90
90
|
isSelected: isSelected,
|
|
91
91
|
isHovered: isHovered,
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "26.
|
|
10
|
+
packageVersion: "26.45.1",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -30,8 +30,9 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
|
|
|
30
30
|
};
|
|
31
31
|
export var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform, meta) {
|
|
32
32
|
if (opts) {
|
|
33
|
-
var handleInvoke = opts.handleInvoke
|
|
34
|
-
|
|
33
|
+
var handleInvoke = opts.handleInvoke,
|
|
34
|
+
actionOptions = opts.actionOptions;
|
|
35
|
+
var actions = extractClientActions(jsonLd, handleInvoke, actionOptions);
|
|
35
36
|
var previewAction = extractPreviewAction(_objectSpread(_objectSpread({}, opts), {}, {
|
|
36
37
|
viewProps: props,
|
|
37
38
|
jsonLd: jsonLd,
|
|
@@ -3,6 +3,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { ViewAction } from '../../../view/BlockCard/actions/ViewAction';
|
|
5
5
|
import { DownloadAction } from '../../../view/BlockCard/actions/DownloadAction';
|
|
6
|
+
import { CardAction } from '../../../view/Card/types';
|
|
7
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
6
8
|
var isClientAction = function isClientAction(action) {
|
|
7
9
|
return ['ViewAction', 'DownloadAction'].indexOf(action['@type']) > -1;
|
|
8
10
|
};
|
|
@@ -18,6 +20,15 @@ var getClientAction = function getClientAction(jsonLd, action) {
|
|
|
18
20
|
});
|
|
19
21
|
}
|
|
20
22
|
};
|
|
23
|
+
var isActionEnabled = function isActionEnabled(action, actionOptions) {
|
|
24
|
+
switch (action['@type']) {
|
|
25
|
+
case 'ViewAction':
|
|
26
|
+
return canShowAction(CardAction.ViewAction, actionOptions);
|
|
27
|
+
case 'DownloadAction':
|
|
28
|
+
return canShowAction(CardAction.DownloadAction, actionOptions);
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
};
|
|
21
32
|
var getClientActionProps = function getClientActionProps(jsonLd, action, handler) {
|
|
22
33
|
var clientAction = getClientAction(jsonLd, action);
|
|
23
34
|
var clientActionInvokeOpts = {
|
|
@@ -46,9 +57,11 @@ export var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
|
|
|
46
57
|
}
|
|
47
58
|
return actions;
|
|
48
59
|
};
|
|
49
|
-
export function extractClientActions(jsonLd, handler) {
|
|
60
|
+
export function extractClientActions(jsonLd, handler, actionOptions) {
|
|
50
61
|
var actions = getActionsFromJsonLd(jsonLd);
|
|
51
|
-
var clientActions = actions.filter(
|
|
62
|
+
var clientActions = actions.filter(function (action) {
|
|
63
|
+
return isClientAction(action) && isActionEnabled(action, actionOptions);
|
|
64
|
+
});
|
|
52
65
|
var clientActionImpls = clientActions.map(function (action) {
|
|
53
66
|
return getClientActionProps(jsonLd, action, handler);
|
|
54
67
|
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { CardAction } from '../../../view/Card/types';
|
|
4
5
|
import { extractDownloadUrl } from '../detail';
|
|
5
6
|
import { extractPreview, extractProvider } from '@atlaskit/link-extractors';
|
|
6
7
|
import { PreviewAction } from '../../../view/BlockCard';
|
|
7
8
|
import { CardDisplay } from '../../../constants';
|
|
8
9
|
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
10
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
9
11
|
var getMetadataFromJsonLd = function getMetadataFromJsonLd(jsonLd, platform) {
|
|
10
12
|
var download = extractDownloadUrl(jsonLd);
|
|
11
13
|
var provider = extractProvider(jsonLd);
|
|
@@ -57,7 +59,12 @@ export var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
57
59
|
_ref$source = _ref.source,
|
|
58
60
|
source = _ref$source === void 0 ? 'block' : _ref$source,
|
|
59
61
|
analytics = _ref.analytics,
|
|
60
|
-
meta = _ref.meta
|
|
62
|
+
meta = _ref.meta,
|
|
63
|
+
actionOptions = _ref.actionOptions;
|
|
64
|
+
if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
// Extract metadata from view props & raw JSON-LD.
|
|
62
69
|
var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
63
70
|
var metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
2
|
+
import { CardAction } from '../../../view/Card/types';
|
|
1
3
|
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
2
4
|
import { extractDownloadUrl } from '../../common/detail';
|
|
3
|
-
export var extractDownloadAction = function extractDownloadAction(data) {
|
|
5
|
+
export var extractDownloadAction = function extractDownloadAction(data, actionOptions) {
|
|
6
|
+
if (!canShowAction(CardAction.DownloadAction, actionOptions)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
4
9
|
var downloadActionExists = getActionsFromJsonLd(data).find(function (action) {
|
|
5
10
|
return action['@type'] === 'DownloadAction';
|
|
6
11
|
});
|
|
@@ -9,5 +14,5 @@ export var extractDownloadAction = function extractDownloadAction(data) {
|
|
|
9
14
|
downloadUrl: extractDownloadUrl(data)
|
|
10
15
|
};
|
|
11
16
|
}
|
|
12
|
-
return
|
|
17
|
+
return;
|
|
13
18
|
};
|
|
@@ -2,9 +2,11 @@ import { extractLink } from '@atlaskit/link-extractors';
|
|
|
2
2
|
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
3
3
|
import { getExtensionKey } from '../../../state/helpers';
|
|
4
4
|
import extractServerAction from '../extract-server-action';
|
|
5
|
-
|
|
5
|
+
import { CardAction } from '../../../view/Card/types';
|
|
6
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
7
|
+
var extractFollowAction = function extractFollowAction(response, actionOptions, id) {
|
|
6
8
|
var _action$dataUpdateAct;
|
|
7
|
-
if (!
|
|
9
|
+
if (!canShowAction(CardAction.FollowAction, actionOptions)) {
|
|
8
10
|
return;
|
|
9
11
|
}
|
|
10
12
|
var extensionKey = getExtensionKey(response);
|