@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
|
@@ -20,6 +20,7 @@ var _flexible = require("../../utils/flexible");
|
|
|
20
20
|
var _FlexibleCard = _interopRequireDefault(require("../FlexibleCard"));
|
|
21
21
|
var _constants = require("../../constants");
|
|
22
22
|
var _click = require("../../utils/analytics/click");
|
|
23
|
+
var _combineActionOptions = require("../../utils/actions/combine-action-options");
|
|
23
24
|
var _SmartLinkAnalyticsContext = require("../../utils/analytics/SmartLinkAnalyticsContext");
|
|
24
25
|
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); }
|
|
25
26
|
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,6 +40,7 @@ function Component(_ref) {
|
|
|
39
40
|
testId = _ref.testId,
|
|
40
41
|
showActions = _ref.showActions,
|
|
41
42
|
showServerActionsProp = _ref.showServerActions,
|
|
43
|
+
actionOptionsProp = _ref.actionOptions,
|
|
42
44
|
inheritDimensions = _ref.inheritDimensions,
|
|
43
45
|
embedIframeRef = _ref.embedIframeRef,
|
|
44
46
|
embedIframeUrlType = _ref.embedIframeUrlType,
|
|
@@ -71,7 +73,8 @@ function Component(_ref) {
|
|
|
71
73
|
return (0, _flexible.isFlexibleUiCard)(children);
|
|
72
74
|
}, [children]);
|
|
73
75
|
var enableFlexibleBlockCardFlag = Boolean((0, _linkProvider.useFeatureFlag)('enableFlexibleBlockCard'));
|
|
74
|
-
var
|
|
76
|
+
var hideServerActions = showServerActionsProp === false || platform === 'mobile';
|
|
77
|
+
var actionOptions = (0, _combineActionOptions.combineActionOptions)(actionOptionsProp, !hideServerActions, showActions);
|
|
75
78
|
|
|
76
79
|
// Setup UI handlers.
|
|
77
80
|
var handleClickWrapper = (0, _react.useCallback)(function (event) {
|
|
@@ -193,7 +196,7 @@ function Component(_ref) {
|
|
|
193
196
|
ui: ui,
|
|
194
197
|
showHoverPreview: showHoverPreview,
|
|
195
198
|
showAuthTooltip: showAuthTooltip,
|
|
196
|
-
|
|
199
|
+
actionOptions: actionOptions,
|
|
197
200
|
url: url,
|
|
198
201
|
testId: testId,
|
|
199
202
|
onResolve: onResolve,
|
|
@@ -208,7 +211,7 @@ function Component(_ref) {
|
|
|
208
211
|
}
|
|
209
212
|
switch (appearance) {
|
|
210
213
|
case 'inline':
|
|
211
|
-
|
|
214
|
+
return /*#__PURE__*/_react.default.createElement(_InlineCard.InlineCard, {
|
|
212
215
|
analytics: analytics,
|
|
213
216
|
id: id,
|
|
214
217
|
url: url,
|
|
@@ -224,9 +227,8 @@ function Component(_ref) {
|
|
|
224
227
|
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
225
228
|
showHoverPreview: showHoverPreview,
|
|
226
229
|
showAuthTooltip: showAuthTooltip,
|
|
227
|
-
|
|
228
|
-
};
|
|
229
|
-
return /*#__PURE__*/_react.default.createElement(_InlineCard.InlineCard, inlineProps);
|
|
230
|
+
actionOptions: actionOptions
|
|
231
|
+
});
|
|
230
232
|
case 'block':
|
|
231
233
|
return /*#__PURE__*/_react.default.createElement(_BlockCard.BlockCard, {
|
|
232
234
|
id: id,
|
|
@@ -243,8 +245,7 @@ function Component(_ref) {
|
|
|
243
245
|
onResolve: onResolve,
|
|
244
246
|
onError: onError,
|
|
245
247
|
testId: testId,
|
|
246
|
-
|
|
247
|
-
showServerActions: showServerActions,
|
|
248
|
+
actionOptions: actionOptions,
|
|
248
249
|
platform: platform,
|
|
249
250
|
enableFlexibleBlockCard: enableFlexibleBlockCardFlag
|
|
250
251
|
});
|
|
@@ -267,7 +268,7 @@ function Component(_ref) {
|
|
|
267
268
|
onError: onError,
|
|
268
269
|
testId: testId,
|
|
269
270
|
inheritDimensions: inheritDimensions,
|
|
270
|
-
|
|
271
|
+
actionOptions: actionOptions,
|
|
271
272
|
ref: embedIframeRef,
|
|
272
273
|
onIframeDwell: onIframeDwell,
|
|
273
274
|
onIframeFocus: onIframeFocus
|
|
@@ -50,6 +50,7 @@ function CardWithURLRenderer(props) {
|
|
|
50
50
|
testId = props.testId,
|
|
51
51
|
showActions = props.showActions,
|
|
52
52
|
showServerActions = props.showServerActions,
|
|
53
|
+
actionOptions = props.actionOptions,
|
|
53
54
|
inheritDimensions = props.inheritDimensions,
|
|
54
55
|
platform = props.platform,
|
|
55
56
|
embedIframeRef = props.embedIframeRef,
|
|
@@ -119,6 +120,7 @@ function CardWithURLRenderer(props) {
|
|
|
119
120
|
testId: testId,
|
|
120
121
|
showActions: showActions,
|
|
121
122
|
showServerActions: showServerActions,
|
|
123
|
+
actionOptions: actionOptions,
|
|
122
124
|
inheritDimensions: inheritDimensions,
|
|
123
125
|
platform: platform,
|
|
124
126
|
embedIframeRef: embedIframeRef,
|
|
@@ -32,7 +32,6 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
|
|
|
32
32
|
handleFrameClick = _ref.handleFrameClick,
|
|
33
33
|
analytics = _ref.analytics,
|
|
34
34
|
handleInvoke = _ref.handleInvoke,
|
|
35
|
-
showActions = _ref.showActions,
|
|
36
35
|
isSelected = _ref.isSelected,
|
|
37
36
|
isFrameVisible = _ref.isFrameVisible,
|
|
38
37
|
frameStyle = _ref.frameStyle,
|
|
@@ -43,7 +42,8 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
|
|
|
43
42
|
inheritDimensions = _ref.inheritDimensions,
|
|
44
43
|
onIframeDwell = _ref.onIframeDwell,
|
|
45
44
|
onIframeFocus = _ref.onIframeFocus,
|
|
46
|
-
iframeUrlType = _ref.iframeUrlType
|
|
45
|
+
iframeUrlType = _ref.iframeUrlType,
|
|
46
|
+
actionOptions = _ref.actionOptions;
|
|
47
47
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
48
48
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
49
49
|
var data = details && details.data || (0, _jsonld.getEmptyJsonLd)();
|
|
@@ -93,12 +93,12 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
|
|
|
93
93
|
analytics: analytics,
|
|
94
94
|
origin: 'smartLinkEmbed',
|
|
95
95
|
handleInvoke: handleInvoke,
|
|
96
|
-
extensionKey: extensionKey
|
|
96
|
+
extensionKey: extensionKey,
|
|
97
|
+
actionOptions: actionOptions
|
|
97
98
|
});
|
|
98
99
|
return /*#__PURE__*/_react.default.createElement(_BlockCard.BlockCardResolvedView, (0, _extends2.default)({}, resolvedBlockViewProps, {
|
|
99
100
|
isSelected: isSelected,
|
|
100
101
|
testId: testId,
|
|
101
|
-
showActions: showActions,
|
|
102
102
|
onClick: handleFrameClick
|
|
103
103
|
}));
|
|
104
104
|
}
|
|
@@ -18,7 +18,7 @@ var HoverCardControl = function HoverCardControl(_ref) {
|
|
|
18
18
|
hideHoverCardPreviewButton = _ref.hideHoverCardPreviewButton,
|
|
19
19
|
isHoverPreview = _ref.isHoverPreview,
|
|
20
20
|
isAuthTooltip = _ref.isAuthTooltip,
|
|
21
|
-
|
|
21
|
+
actionOptions = _ref.actionOptions,
|
|
22
22
|
testId = _ref.testId,
|
|
23
23
|
url = _ref.url,
|
|
24
24
|
_ref$delay = _ref.delay,
|
|
@@ -68,7 +68,7 @@ var HoverCardControl = function HoverCardControl(_ref) {
|
|
|
68
68
|
canOpen: canOpen,
|
|
69
69
|
closeOnChildClick: true,
|
|
70
70
|
hidePreviewButton: hideHoverCardPreviewButton,
|
|
71
|
-
|
|
71
|
+
actionOptions: actionOptions,
|
|
72
72
|
url: url
|
|
73
73
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
74
74
|
onMouseLeave: onMouseLeave,
|
|
@@ -155,8 +155,7 @@ var Container = function Container(_ref3) {
|
|
|
155
155
|
showAuthTooltip = _ref3$showAuthTooltip === void 0 ? false : _ref3$showAuthTooltip,
|
|
156
156
|
_ref3$showHoverPrevie = _ref3.showHoverPreview,
|
|
157
157
|
showHoverPreview = _ref3$showHoverPrevie === void 0 ? false : _ref3$showHoverPrevie,
|
|
158
|
-
|
|
159
|
-
showServerActions = _ref3$showServerActio === void 0 ? false : _ref3$showServerActio,
|
|
158
|
+
actionOptions = _ref3.actionOptions,
|
|
160
159
|
_ref3$size = _ref3.size,
|
|
161
160
|
size = _ref3$size === void 0 ? _constants.SmartLinkSize.Medium : _ref3$size,
|
|
162
161
|
status = _ref3.status,
|
|
@@ -180,7 +179,7 @@ var Container = function Container(_ref3) {
|
|
|
180
179
|
hideHoverCardPreviewButton: hideHoverCardPreviewButton,
|
|
181
180
|
isHoverPreview: canShowHoverPreview,
|
|
182
181
|
isAuthTooltip: canShowAuthTooltip,
|
|
183
|
-
|
|
182
|
+
actionOptions: actionOptions,
|
|
184
183
|
testId: testId,
|
|
185
184
|
url: context.url
|
|
186
185
|
}, container);
|
|
@@ -38,7 +38,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
38
38
|
renderers = _ref.renderers,
|
|
39
39
|
showAuthTooltip = _ref.showAuthTooltip,
|
|
40
40
|
showHoverPreview = _ref.showHoverPreview,
|
|
41
|
-
|
|
41
|
+
actionOptions = _ref.actionOptions,
|
|
42
42
|
testId = _ref.testId,
|
|
43
43
|
ui = _ref.ui,
|
|
44
44
|
url = _ref.url;
|
|
@@ -50,11 +50,11 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
50
50
|
response: details,
|
|
51
51
|
id: id,
|
|
52
52
|
renderers: renderers,
|
|
53
|
-
|
|
53
|
+
actionOptions: actionOptions,
|
|
54
54
|
status: status,
|
|
55
55
|
url: url
|
|
56
56
|
});
|
|
57
|
-
}, [details, id, renderers,
|
|
57
|
+
}, [details, id, renderers, actionOptions, status, url]);
|
|
58
58
|
var retry = (0, _utils.getRetryOptions)(url, status, details, onAuthorize);
|
|
59
59
|
var _ref2 = context || {},
|
|
60
60
|
title = _ref2.title;
|
|
@@ -101,7 +101,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
101
101
|
onClick: onClick,
|
|
102
102
|
retry: retry,
|
|
103
103
|
showHoverPreview: showHoverPreview,
|
|
104
|
-
|
|
104
|
+
actionOptions: actionOptions,
|
|
105
105
|
showAuthTooltip: showAuthTooltip,
|
|
106
106
|
status: status
|
|
107
107
|
}), children))));
|
|
@@ -19,6 +19,7 @@ var _CustomPopupContainer = _interopRequireDefault(require("../components/Custom
|
|
|
19
19
|
var _styled = require("../styled");
|
|
20
20
|
var _constants = require("../../../constants");
|
|
21
21
|
var _SmartLinkAnalyticsContext = require("../../../utils/analytics/SmartLinkAnalyticsContext");
|
|
22
|
+
var _combineActionOptions = require("../../../utils/actions/combine-action-options");
|
|
22
23
|
var _actions = require("../../../state/actions");
|
|
23
24
|
var _analytics = require("../../../state/analytics");
|
|
24
25
|
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); }
|
|
@@ -41,8 +42,8 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
41
42
|
closeOnChildClick = _ref$closeOnChildClic === void 0 ? false : _ref$closeOnChildClic,
|
|
42
43
|
_ref$hidePreviewButto = _ref.hidePreviewButton,
|
|
43
44
|
hidePreviewButton = _ref$hidePreviewButto === void 0 ? false : _ref$hidePreviewButto,
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
showServerActions = _ref.showServerActions,
|
|
46
|
+
actionOptionsProp = _ref.actionOptions,
|
|
46
47
|
_ref$allowEventPropag = _ref.allowEventPropagation,
|
|
47
48
|
allowEventPropagation = _ref$allowEventPropag === void 0 ? false : _ref$allowEventPropag,
|
|
48
49
|
_ref$zIndex = _ref.zIndex,
|
|
@@ -64,6 +65,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
64
65
|
var analytics = (0, _analytics.useSmartLinkAnalytics)(url, undefined, id);
|
|
65
66
|
var _useSmartCardActions = (0, _actions.useSmartCardActions)(id, url, analytics),
|
|
66
67
|
loadMetadata = _useSmartCardActions.loadMetadata;
|
|
68
|
+
var actionOptions = (0, _combineActionOptions.combineActionOptions)(actionOptionsProp, showServerActions);
|
|
67
69
|
var setMousePosition = (0, _react2.useCallback)(function (event) {
|
|
68
70
|
if (isOpen && canOpen) {
|
|
69
71
|
return;
|
|
@@ -165,7 +167,8 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
165
167
|
url: url,
|
|
166
168
|
appearance: _constants.CardDisplay.HoverCardPreview,
|
|
167
169
|
analyticsHandler: analyticsHandler,
|
|
168
|
-
origin: HOVER_CARD_SOURCE
|
|
170
|
+
origin: HOVER_CARD_SOURCE,
|
|
171
|
+
actionOptions: actionOptions
|
|
169
172
|
});
|
|
170
173
|
var filteredActions = (0, _react2.useMemo)(function () {
|
|
171
174
|
return hidePreviewButton ? linkActions.filter(function (action) {
|
|
@@ -203,7 +206,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
203
206
|
onActionClick: onActionClick,
|
|
204
207
|
onResolve: update,
|
|
205
208
|
renderers: renderers,
|
|
206
|
-
|
|
209
|
+
actionOptions: actionOptions,
|
|
207
210
|
url: url,
|
|
208
211
|
id: id
|
|
209
212
|
};
|
|
@@ -213,7 +216,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
213
216
|
id: id,
|
|
214
217
|
source: HOVER_CARD_SOURCE
|
|
215
218
|
}, (0, _react.jsx)(_HoverCardContent.default, hoverCardContentProps));
|
|
216
|
-
}, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers,
|
|
219
|
+
}, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers, actionOptions, url, id]);
|
|
217
220
|
var trigger = (0, _react2.useCallback)(function (triggerProps) {
|
|
218
221
|
return (0, _react.jsx)("span", {
|
|
219
222
|
ref: parentSpan
|
|
@@ -78,7 +78,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
78
78
|
url = _ref.url,
|
|
79
79
|
onMouseEnter = _ref.onMouseEnter,
|
|
80
80
|
onMouseLeave = _ref.onMouseLeave,
|
|
81
|
-
|
|
81
|
+
actionOptions = _ref.actionOptions;
|
|
82
82
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
83
83
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
84
84
|
var defaultAnalytics = (0, _analytics2.useSmartLinkAnalytics)(url, undefined, id);
|
|
@@ -154,7 +154,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
154
154
|
onClick: onClick,
|
|
155
155
|
onResolve: onResolve,
|
|
156
156
|
renderers: renderers,
|
|
157
|
-
|
|
157
|
+
actionOptions: actionOptions,
|
|
158
158
|
ui: _styled.flexibleUiOptions,
|
|
159
159
|
url: url,
|
|
160
160
|
children: {},
|
|
@@ -56,8 +56,7 @@ var InlineCardResolvedView = exports.InlineCardResolvedView = /*#__PURE__*/funct
|
|
|
56
56
|
titlePrefix = _this$props.titlePrefix,
|
|
57
57
|
_this$props$showHover = _this$props.showHoverPreview,
|
|
58
58
|
showHoverPreview = _this$props$showHover === void 0 ? false : _this$props$showHover,
|
|
59
|
-
|
|
60
|
-
showServerActions = _this$props$showServe === void 0 ? false : _this$props$showServe;
|
|
59
|
+
actionOptions = _this$props.actionOptions;
|
|
61
60
|
var inlineCardResolvedView = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
|
|
62
61
|
testId: testId,
|
|
63
62
|
link: link,
|
|
@@ -73,8 +72,8 @@ var InlineCardResolvedView = exports.InlineCardResolvedView = /*#__PURE__*/funct
|
|
|
73
72
|
if (showHoverPreview && link) {
|
|
74
73
|
return /*#__PURE__*/_react.default.createElement(_index.HoverCard, {
|
|
75
74
|
id: id,
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
url: link,
|
|
76
|
+
actionOptions: actionOptions
|
|
78
77
|
}, inlineCardResolvedView);
|
|
79
78
|
}
|
|
80
79
|
return inlineCardResolvedView;
|
|
@@ -71,7 +71,7 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
|
|
|
71
71
|
inlinePreloaderStyle = _ref.inlinePreloaderStyle,
|
|
72
72
|
showHoverPreview = _ref.showHoverPreview,
|
|
73
73
|
showAuthTooltip = _ref.showAuthTooltip,
|
|
74
|
-
|
|
74
|
+
actionOptions = _ref.actionOptions;
|
|
75
75
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
76
76
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
77
77
|
var status = cardState.status,
|
|
@@ -120,7 +120,7 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
|
|
|
120
120
|
return /*#__PURE__*/_react.default.createElement(_ResolvedView.InlineCardResolvedView, (0, _extends2.default)({}, resolvedProps, {
|
|
121
121
|
id: id,
|
|
122
122
|
showHoverPreview: showHoverPreview,
|
|
123
|
-
|
|
123
|
+
actionOptions: actionOptions,
|
|
124
124
|
link: url,
|
|
125
125
|
isSelected: isSelected,
|
|
126
126
|
isHovered: isHovered,
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "26.
|
|
20
|
+
packageVersion: "26.45.1",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -24,9 +24,10 @@ const extractBlockDetails = jsonLd => [extractCommentCount(jsonLd), extractProgr
|
|
|
24
24
|
export const extractBlockActions = (props, jsonLd, opts, platform, meta) => {
|
|
25
25
|
if (opts) {
|
|
26
26
|
const {
|
|
27
|
-
handleInvoke
|
|
27
|
+
handleInvoke,
|
|
28
|
+
actionOptions
|
|
28
29
|
} = opts;
|
|
29
|
-
const actions = extractClientActions(jsonLd, handleInvoke);
|
|
30
|
+
const actions = extractClientActions(jsonLd, handleInvoke, actionOptions);
|
|
30
31
|
const previewAction = extractPreviewAction({
|
|
31
32
|
...opts,
|
|
32
33
|
viewProps: props,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ViewAction } from '../../../view/BlockCard/actions/ViewAction';
|
|
2
2
|
import { DownloadAction } from '../../../view/BlockCard/actions/DownloadAction';
|
|
3
|
+
import { CardAction } from '../../../view/Card/types';
|
|
4
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
5
|
const isClientAction = action => ['ViewAction', 'DownloadAction'].indexOf(action['@type']) > -1;
|
|
4
6
|
const getClientAction = (jsonLd, action) => {
|
|
5
7
|
switch (action['@type']) {
|
|
@@ -13,6 +15,15 @@ const getClientAction = (jsonLd, action) => {
|
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
17
|
};
|
|
18
|
+
const isActionEnabled = (action, actionOptions) => {
|
|
19
|
+
switch (action['@type']) {
|
|
20
|
+
case 'ViewAction':
|
|
21
|
+
return canShowAction(CardAction.ViewAction, actionOptions);
|
|
22
|
+
case 'DownloadAction':
|
|
23
|
+
return canShowAction(CardAction.DownloadAction, actionOptions);
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
16
27
|
const getClientActionProps = (jsonLd, action, handler) => {
|
|
17
28
|
const clientAction = getClientAction(jsonLd, action);
|
|
18
29
|
const clientActionInvokeOpts = {
|
|
@@ -40,9 +51,9 @@ export const getActionsFromJsonLd = jsonLd => {
|
|
|
40
51
|
}
|
|
41
52
|
return actions;
|
|
42
53
|
};
|
|
43
|
-
export function extractClientActions(jsonLd, handler) {
|
|
54
|
+
export function extractClientActions(jsonLd, handler, actionOptions) {
|
|
44
55
|
const actions = getActionsFromJsonLd(jsonLd);
|
|
45
|
-
const clientActions = actions.filter(isClientAction);
|
|
56
|
+
const clientActions = actions.filter(action => isClientAction(action) && isActionEnabled(action, actionOptions));
|
|
46
57
|
const clientActionImpls = clientActions.map(action => getClientActionProps(jsonLd, action, handler));
|
|
47
58
|
return clientActionImpls;
|
|
48
59
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { CardAction } from '../../../view/Card/types';
|
|
1
2
|
import { extractDownloadUrl } from '../detail';
|
|
2
3
|
import { extractPreview, extractProvider } from '@atlaskit/link-extractors';
|
|
3
4
|
import { PreviewAction } from '../../../view/BlockCard';
|
|
4
5
|
import { CardDisplay } from '../../../constants';
|
|
5
6
|
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
7
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
6
8
|
const getMetadataFromJsonLd = (jsonLd, platform) => {
|
|
7
9
|
const download = extractDownloadUrl(jsonLd);
|
|
8
10
|
const provider = extractProvider(jsonLd);
|
|
@@ -46,8 +48,13 @@ export const extractPreviewAction = ({
|
|
|
46
48
|
origin,
|
|
47
49
|
source = 'block',
|
|
48
50
|
analytics,
|
|
49
|
-
meta
|
|
51
|
+
meta,
|
|
52
|
+
actionOptions
|
|
50
53
|
}) => {
|
|
54
|
+
if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
51
58
|
// Extract metadata from view props & raw JSON-LD.
|
|
52
59
|
const metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
53
60
|
const metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -1,11 +1,16 @@
|
|
|
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 const extractDownloadAction = data => {
|
|
5
|
+
export const extractDownloadAction = (data, actionOptions) => {
|
|
6
|
+
if (!canShowAction(CardAction.DownloadAction, actionOptions)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
4
9
|
const downloadActionExists = getActionsFromJsonLd(data).find(action => action['@type'] === 'DownloadAction');
|
|
5
10
|
if (downloadActionExists) {
|
|
6
11
|
return {
|
|
7
12
|
downloadUrl: extractDownloadUrl(data)
|
|
8
13
|
};
|
|
9
14
|
}
|
|
10
|
-
return
|
|
15
|
+
return;
|
|
11
16
|
};
|
|
@@ -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
|
+
const extractFollowAction = (response, actionOptions, id) => {
|
|
6
8
|
var _action$dataUpdateAct;
|
|
7
|
-
if (!
|
|
9
|
+
if (!canShowAction(CardAction.FollowAction, actionOptions)) {
|
|
8
10
|
return;
|
|
9
11
|
}
|
|
10
12
|
const extensionKey = getExtensionKey(response);
|
|
@@ -2,8 +2,13 @@ import { extractDownloadUrl } from '../../common/detail';
|
|
|
2
2
|
import { extractPreview as extractPreviewData, extractLink, extractProvider, extractTitle } from '@atlaskit/link-extractors';
|
|
3
3
|
import { extractLinkIcon } from '../icon';
|
|
4
4
|
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
5
|
-
|
|
5
|
+
import { CardAction } from '../../../view/Card/types';
|
|
6
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
7
|
+
export const extractPreviewAction = (response, actionOptions) => {
|
|
6
8
|
var _extractPreviewData;
|
|
9
|
+
if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
7
12
|
const data = response.data;
|
|
8
13
|
const meta = response.meta;
|
|
9
14
|
const src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { extractLink } from '@atlaskit/link-extractors';
|
|
2
2
|
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
3
|
-
|
|
3
|
+
import { CardAction } from '../../../view/Card/types';
|
|
4
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
5
|
+
export const extractViewAction = (data, actionOptions) => {
|
|
6
|
+
if (!canShowAction(CardAction.ViewAction, actionOptions)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
4
9
|
const viewActionExists = getActionsFromJsonLd(data).find(action => action['@type'] === 'ViewAction');
|
|
5
10
|
if (viewActionExists) {
|
|
6
11
|
return {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { extractLozenge } from '../common/lozenge';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { getExtensionKey } from '../../state/helpers';
|
|
3
4
|
import extractServerAction from './extract-server-action';
|
|
4
5
|
import { extractLink } from '@atlaskit/link-extractors';
|
|
5
6
|
import { extractPreviewAction } from './actions/extract-preview-action';
|
|
7
|
+
import { CardAction } from '../../view/Card/types';
|
|
8
|
+
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
6
9
|
const toInvokeRequest = (extensionKey, resourceIdentifiers, actionType, details) => {
|
|
7
10
|
if (!actionType) {
|
|
8
11
|
return;
|
|
@@ -42,7 +45,7 @@ const extractAction = (response, id) => {
|
|
|
42
45
|
update
|
|
43
46
|
} : undefined;
|
|
44
47
|
};
|
|
45
|
-
const extractState = (response,
|
|
48
|
+
const extractState = (response, actionOptions, id) => {
|
|
46
49
|
if (!response || !response.data) {
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
@@ -50,7 +53,7 @@ const extractState = (response, showServerActions, id) => {
|
|
|
50
53
|
if (!lozenge) {
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
|
-
if (!
|
|
56
|
+
if (!canShowAction(CardAction.ChangeStatusAction, actionOptions) || getBooleanFF('platform.linking-platform.smart-card.disable-jira-status-action')) {
|
|
54
57
|
return lozenge;
|
|
55
58
|
}
|
|
56
59
|
const action = extractAction(response, id);
|
|
@@ -16,7 +16,7 @@ import { extractViewAction } from './actions/extract-view-action';
|
|
|
16
16
|
const extractFlexibleUiContext = ({
|
|
17
17
|
id,
|
|
18
18
|
renderers,
|
|
19
|
-
|
|
19
|
+
actionOptions,
|
|
20
20
|
response
|
|
21
21
|
} = {}) => {
|
|
22
22
|
if (!response) {
|
|
@@ -40,10 +40,10 @@ const extractFlexibleUiContext = ({
|
|
|
40
40
|
assignedTo: extractAssignedTo(data),
|
|
41
41
|
createdOn: extractDateCreated(data),
|
|
42
42
|
dueOn: extractDueOn(data),
|
|
43
|
-
followAction: getBooleanFF('platform.linking-platform.smart-card.follow-button') ? extractFollowAction(response,
|
|
44
|
-
previewAction: extractPreviewAction(response),
|
|
45
|
-
viewAction: extractViewAction(data),
|
|
46
|
-
downloadAction: extractDownloadAction(data),
|
|
43
|
+
followAction: getBooleanFF('platform.linking-platform.smart-card.follow-button') ? extractFollowAction(response, actionOptions, id) : undefined,
|
|
44
|
+
previewAction: extractPreviewAction(response, actionOptions),
|
|
45
|
+
viewAction: extractViewAction(data, actionOptions),
|
|
46
|
+
downloadAction: extractDownloadAction(data, actionOptions),
|
|
47
47
|
latestCommit: extractLatestCommit(data),
|
|
48
48
|
linkIcon: extractLinkIcon(response, renderers),
|
|
49
49
|
location: extractLocation(data),
|
|
@@ -58,7 +58,7 @@ const extractFlexibleUiContext = ({
|
|
|
58
58
|
snippet: extractSummary(data) || undefined,
|
|
59
59
|
// Explicitly set here to remove an empty string
|
|
60
60
|
sourceBranch: extractSourceBranch(data),
|
|
61
|
-
state: extractState(response,
|
|
61
|
+
state: extractState(response, actionOptions, id),
|
|
62
62
|
subscriberCount: extractSubscriberCount(data),
|
|
63
63
|
subTasksProgress: extractSubTasksProgress(data),
|
|
64
64
|
storyPoints: extractStoryPoints(data),
|
package/dist/es2019/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { SmartCardProvider as Provider, SmartCardContext, useSmartLinkAnalytics
|
|
|
2
2
|
export { APIError } from '@atlaskit/linking-common';
|
|
3
3
|
export { CardClient as Client } from '@atlaskit/link-provider';
|
|
4
4
|
export { Card } from './view/Card';
|
|
5
|
+
export { CardAction } from './view/Card/types';
|
|
5
6
|
export { SmartCardContext as Context } from '@atlaskit/link-provider';
|
|
6
7
|
export { EmbedResizeMessageListener } from './view/EmbedCard/EmbedResizeMessageListener';
|
|
7
8
|
export { embedHeaderHeight } from './view/EmbedCard/components/styled';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { extractBlockProps as extractCardProps } from '../../extractors/block';
|
|
4
4
|
import { useSmartCardActions as useLinkActions } from '../actions';
|
|
@@ -10,33 +10,30 @@ export function useSmartLinkActions({
|
|
|
10
10
|
appearance,
|
|
11
11
|
analyticsHandler,
|
|
12
12
|
platform = 'web',
|
|
13
|
-
origin
|
|
13
|
+
origin,
|
|
14
|
+
actionOptions
|
|
14
15
|
}) {
|
|
15
16
|
const id = useMemo(() => uuid(), []);
|
|
16
|
-
const [actions, setActions] = useState([]);
|
|
17
17
|
const linkState = useLinkState(url);
|
|
18
18
|
const linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
|
|
19
19
|
const linkActions = useLinkActions(id, url, linkAnalytics);
|
|
20
|
-
|
|
21
|
-
if (!linkState.details) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
20
|
+
if (linkState.details && !(actionOptions !== null && actionOptions !== void 0 && actionOptions.hide)) {
|
|
24
21
|
const cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
|
|
25
22
|
handleInvoke: opts => linkActions.invoke(opts, appearance),
|
|
26
23
|
analytics: linkAnalytics,
|
|
27
24
|
origin,
|
|
28
25
|
extensionKey: getExtensionKey(linkState.details),
|
|
29
|
-
source: appearance
|
|
26
|
+
source: appearance,
|
|
27
|
+
actionOptions
|
|
30
28
|
}, undefined, platform);
|
|
31
|
-
if (
|
|
32
|
-
|
|
29
|
+
if (cardProperties.actions && cardProperties.actions.length > 0) {
|
|
30
|
+
const cardActions = cardProperties.actions.map(action => ({
|
|
31
|
+
id: action.id,
|
|
32
|
+
text: action.text,
|
|
33
|
+
invoke: action.promise
|
|
34
|
+
}));
|
|
35
|
+
return cardActions;
|
|
33
36
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
text: action.text,
|
|
37
|
-
invoke: action.promise
|
|
38
|
-
}));
|
|
39
|
-
setActions(cardActions);
|
|
40
|
-
}, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
|
|
41
|
-
return actions;
|
|
37
|
+
}
|
|
38
|
+
return [];
|
|
42
39
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const canShowAction = (action, actionOptions) => {
|
|
2
|
+
var _actionOptions$exclud;
|
|
3
|
+
if (typeof actionOptions === 'undefined') {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
if (actionOptions.hide || (_actionOptions$exclud = actionOptions.exclude) !== null && _actionOptions$exclud !== void 0 && _actionOptions$exclud.includes(action)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return true;
|
|
10
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CardAction } from '../../view/Card/types';
|
|
2
|
+
export const combineActionOptions = (actionOptions, showServerActions, showActions) => {
|
|
3
|
+
if (typeof actionOptions !== 'undefined') {
|
|
4
|
+
return actionOptions;
|
|
5
|
+
}
|
|
6
|
+
if (showServerActions === false && showActions === false) {
|
|
7
|
+
return {
|
|
8
|
+
hide: true
|
|
9
|
+
};
|
|
10
|
+
} else if (showServerActions && showActions) {
|
|
11
|
+
return {
|
|
12
|
+
hide: false
|
|
13
|
+
};
|
|
14
|
+
} else {
|
|
15
|
+
let exclude = [];
|
|
16
|
+
if (showServerActions === false) {
|
|
17
|
+
exclude = [...exclude, CardAction.FollowAction, CardAction.ChangeStatusAction];
|
|
18
|
+
}
|
|
19
|
+
if (showActions === false) {
|
|
20
|
+
exclude = [...exclude, CardAction.DownloadAction, CardAction.PreviewAction, CardAction.ViewAction];
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
hide: false,
|
|
24
|
+
exclude
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.
|
|
7
|
+
packageVersion: "26.45.1"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|