@atlaskit/smart-card 32.7.0 → 32.7.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 +7 -0
- package/analytics.spec.yaml +63 -9
- package/dist/cjs/common/analytics/types.js +5 -0
- package/dist/cjs/extractors/action/extract-invoke-copy-link-action.js +53 -0
- package/dist/cjs/extractors/action/extract-invoke-download-action.js +57 -0
- package/dist/cjs/extractors/action/extract-invoke-preview-action.js +78 -0
- package/dist/cjs/extractors/action/extract-invoke-view-action.js +60 -0
- package/dist/cjs/extractors/action/extractDownloadActionProps.js +4 -0
- package/dist/cjs/extractors/action/extractPreviewActionProps.js +4 -0
- package/dist/cjs/extractors/action/extractViewActionProps.js +4 -0
- package/dist/cjs/extractors/action/types.js +5 -0
- package/dist/cjs/extractors/flexible/actions/extract-copy-link-action.js +12 -1
- package/dist/cjs/extractors/flexible/actions/extract-download-action.js +12 -1
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +12 -1
- package/dist/cjs/extractors/flexible/actions/extract-view-action.js +3 -0
- package/dist/cjs/extractors/flexible/actions/index.js +40 -3
- package/dist/cjs/extractors/flexible/extract-state.js +19 -5
- package/dist/cjs/extractors/flexible/index.js +22 -8
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +56 -17
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +22 -3
- package/dist/cjs/utils/analytics/LinkAnalyticsContext.js +7 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/mocks.js +4 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
- package/dist/cjs/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
- package/dist/cjs/view/CardWithUrl/component.js +1 -0
- package/dist/cjs/view/EmbedModal/index.js +72 -51
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +65 -32
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +36 -28
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +40 -32
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +13 -6
- package/dist/cjs/view/FlexibleCard/components/utils.js +4 -0
- package/dist/cjs/view/FlexibleCard/index.js +11 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/common/analytics/types.js +1 -0
- package/dist/es2019/extractors/action/extract-invoke-copy-link-action.js +29 -0
- package/dist/es2019/extractors/action/extract-invoke-download-action.js +31 -0
- package/dist/es2019/extractors/action/extract-invoke-preview-action.js +57 -0
- package/dist/es2019/extractors/action/extract-invoke-view-action.js +34 -0
- package/dist/es2019/extractors/action/extractDownloadActionProps.js +5 -0
- package/dist/es2019/extractors/action/extractPreviewActionProps.js +5 -0
- package/dist/es2019/extractors/action/extractViewActionProps.js +5 -0
- package/dist/es2019/extractors/action/types.js +1 -0
- package/dist/es2019/extractors/flexible/actions/extract-copy-link-action.js +11 -0
- package/dist/es2019/extractors/flexible/actions/extract-download-action.js +12 -0
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +12 -0
- package/dist/es2019/extractors/flexible/actions/extract-view-action.js +4 -0
- package/dist/es2019/extractors/flexible/actions/index.js +48 -3
- package/dist/es2019/extractors/flexible/extract-state.js +17 -5
- package/dist/es2019/extractors/flexible/index.js +17 -6
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +91 -43
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +21 -3
- package/dist/es2019/utils/analytics/LinkAnalyticsContext.js +3 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/mocks.js +4 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
- package/dist/es2019/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
- package/dist/es2019/view/CardWithUrl/component.js +1 -0
- package/dist/es2019/view/EmbedModal/index.js +41 -20
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +31 -16
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +20 -12
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +25 -17
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +14 -7
- package/dist/es2019/view/FlexibleCard/components/utils.js +4 -0
- package/dist/es2019/view/FlexibleCard/index.js +12 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/common/analytics/types.js +1 -0
- package/dist/esm/extractors/action/extract-invoke-copy-link-action.js +46 -0
- package/dist/esm/extractors/action/extract-invoke-download-action.js +50 -0
- package/dist/esm/extractors/action/extract-invoke-preview-action.js +71 -0
- package/dist/esm/extractors/action/extract-invoke-view-action.js +53 -0
- package/dist/esm/extractors/action/extractDownloadActionProps.js +5 -0
- package/dist/esm/extractors/action/extractPreviewActionProps.js +5 -0
- package/dist/esm/extractors/action/extractViewActionProps.js +5 -0
- package/dist/esm/extractors/action/types.js +1 -0
- package/dist/esm/extractors/flexible/actions/extract-copy-link-action.js +11 -0
- package/dist/esm/extractors/flexible/actions/extract-download-action.js +12 -0
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +12 -0
- package/dist/esm/extractors/flexible/actions/extract-view-action.js +4 -0
- package/dist/esm/extractors/flexible/actions/index.js +42 -5
- package/dist/esm/extractors/flexible/extract-state.js +19 -5
- package/dist/esm/extractors/flexible/index.js +19 -8
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +56 -17
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +22 -3
- package/dist/esm/utils/analytics/LinkAnalyticsContext.js +7 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/mocks.js +4 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
- package/dist/esm/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
- package/dist/esm/view/CardWithUrl/component.js +1 -0
- package/dist/esm/view/EmbedModal/index.js +73 -52
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +65 -32
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +36 -28
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +40 -32
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +13 -6
- package/dist/esm/view/FlexibleCard/components/utils.js +4 -0
- package/dist/esm/view/FlexibleCard/index.js +11 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/common/analytics/generated/analytics.types.d.ts +63 -2
- package/dist/types/common/analytics/types.d.ts +2 -0
- package/dist/types/extractors/action/extract-invoke-copy-link-action.d.ts +3 -0
- package/dist/types/extractors/action/extract-invoke-download-action.d.ts +3 -0
- package/dist/types/extractors/action/extract-invoke-preview-action.d.ts +11 -0
- package/dist/types/extractors/action/extract-invoke-view-action.d.ts +3 -0
- package/dist/types/extractors/action/extractDownloadActionProps.d.ts +4 -0
- package/dist/types/extractors/action/extractPreviewActionProps.d.ts +5 -1
- package/dist/types/extractors/action/extractViewActionProps.d.ts +4 -0
- package/dist/types/extractors/action/types.d.ts +9 -0
- package/dist/types/extractors/flexible/actions/extract-copy-link-action.d.ts +6 -0
- package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +6 -0
- package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +6 -0
- package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +3 -0
- package/dist/types/extractors/flexible/actions/index.d.ts +21 -4
- package/dist/types/extractors/flexible/extract-state.d.ts +5 -2
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +9 -3
- package/dist/types/state/hooks/use-invoke/types.d.ts +7 -1
- package/dist/types/state/hooks/use-invoke-client-action/index.d.ts +2 -2
- package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +24 -2
- package/dist/types/state/hooks/use-resolve/index.d.ts +1 -0
- package/dist/types/view/EmbedModal/index.d.ts +4 -0
- package/dist/types/view/EmbedModal/types.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/utils.d.ts +3 -0
- package/dist/types/view/FlexibleCard/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/types.d.ts +12 -3
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +63 -2
- package/dist/types-ts4.5/common/analytics/types.d.ts +2 -0
- package/dist/types-ts4.5/extractors/action/extract-invoke-copy-link-action.d.ts +3 -0
- package/dist/types-ts4.5/extractors/action/extract-invoke-download-action.d.ts +3 -0
- package/dist/types-ts4.5/extractors/action/extract-invoke-preview-action.d.ts +11 -0
- package/dist/types-ts4.5/extractors/action/extract-invoke-view-action.d.ts +3 -0
- package/dist/types-ts4.5/extractors/action/extractDownloadActionProps.d.ts +4 -0
- package/dist/types-ts4.5/extractors/action/extractPreviewActionProps.d.ts +5 -1
- package/dist/types-ts4.5/extractors/action/extractViewActionProps.d.ts +4 -0
- package/dist/types-ts4.5/extractors/action/types.d.ts +9 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-copy-link-action.d.ts +6 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +6 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +6 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +3 -0
- package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +21 -4
- package/dist/types-ts4.5/extractors/flexible/extract-state.d.ts +5 -2
- package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +9 -3
- package/dist/types-ts4.5/state/hooks/use-invoke/types.d.ts +7 -1
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/index.d.ts +2 -2
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/types.d.ts +24 -2
- package/dist/types-ts4.5/state/hooks/use-resolve/index.d.ts +1 -0
- package/dist/types-ts4.5/view/EmbedModal/index.d.ts +8 -0
- package/dist/types-ts4.5/view/EmbedModal/types.d.ts +7 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +6 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +12 -3
- package/package.json +4 -1
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import LinkIcon from '@atlaskit/icon/core/migration/link';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { ActionName } from '../../../../../constants';
|
|
6
7
|
import { messages } from '../../../../../messages';
|
|
7
8
|
import { useFlexibleUiAnalyticsContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
@@ -20,22 +21,36 @@ const CopyLinkAction = ({
|
|
|
20
21
|
const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.CopyLinkAction];
|
|
21
22
|
const [tooltipMessage, setTooltipMessage] = useState(messages.copy_url_to_clipboard);
|
|
22
23
|
const onClick = useCallback(() => {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
25
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
26
|
+
invoke({
|
|
27
|
+
...data.invokeAction,
|
|
28
|
+
actionFn: async () => {
|
|
29
|
+
var _data$invokeAction;
|
|
30
|
+
await ((_data$invokeAction = data.invokeAction) === null || _data$invokeAction === void 0 ? void 0 : _data$invokeAction.actionFn());
|
|
31
|
+
setTooltipMessage(messages.copied_url_to_clipboard);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
if (data && data.url) {
|
|
38
|
+
invoke({
|
|
39
|
+
actionType: ActionName.CopyLinkAction,
|
|
40
|
+
actionFn: async () => {
|
|
41
|
+
var _data$url;
|
|
42
|
+
await navigator.clipboard.writeText((_data$url = data.url) !== null && _data$url !== void 0 ? _data$url : '');
|
|
43
|
+
setTooltipMessage(messages.copied_url_to_clipboard);
|
|
44
|
+
},
|
|
45
|
+
// These values have already been set in analytics context.
|
|
46
|
+
// We only pass these here for ufo experience.
|
|
47
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
48
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (onClickCallback) {
|
|
52
|
+
onClickCallback();
|
|
53
|
+
}
|
|
39
54
|
}
|
|
40
55
|
}, [analytics, data, invoke, onClickCallback]);
|
|
41
56
|
return data ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { ActionName } from '../../../../../constants';
|
|
6
7
|
import { messages } from '../../../../../messages';
|
|
7
8
|
import { useFlexibleUiAnalyticsContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
@@ -20,20 +21,27 @@ const DownloadAction = ({
|
|
|
20
21
|
});
|
|
21
22
|
const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.DownloadAction];
|
|
22
23
|
const onClick = useCallback(() => {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
25
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
26
|
+
invoke(data.invokeAction);
|
|
27
|
+
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
if (data !== null && data !== void 0 && data.downloadUrl) {
|
|
31
|
+
invoke({
|
|
32
|
+
actionType: ActionName.DownloadAction,
|
|
33
|
+
actionFn: async () => download(data === null || data === void 0 ? void 0 : data.downloadUrl),
|
|
34
|
+
// These values have already been set in analytics context.
|
|
35
|
+
// We only pass these here for ufo experience.
|
|
36
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
37
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
38
|
+
});
|
|
39
|
+
if (onClickCallback) {
|
|
40
|
+
onClickCallback();
|
|
41
|
+
}
|
|
34
42
|
}
|
|
35
43
|
}
|
|
36
|
-
}, [analytics, data
|
|
44
|
+
}, [analytics, data, invoke, onClickCallback]);
|
|
37
45
|
const isStackItem = props.as === 'stack-item';
|
|
38
46
|
const label = isStackItem ? messages.download_file : messages.download;
|
|
39
47
|
const tooltipMessage = isStackItem ? messages.download_description : messages.download;
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import MediaServicesActualSizeIcon from '@atlaskit/icon/core/migration/grow-diagonal--media-services-actual-size';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { ActionName } from '../../../../../constants';
|
|
6
7
|
import { messages } from '../../../../../messages';
|
|
7
8
|
import { useFlexibleUiAnalyticsContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
@@ -20,23 +21,30 @@ const PreviewAction = ({
|
|
|
20
21
|
});
|
|
21
22
|
const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.PreviewAction];
|
|
22
23
|
const onClick = useCallback(() => {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
25
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
26
|
+
invoke(data.invokeAction);
|
|
27
|
+
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
if (data) {
|
|
31
|
+
invoke({
|
|
32
|
+
actionType: ActionName.PreviewAction,
|
|
33
|
+
actionFn: async () => openEmbedModalWithFlexibleUiIcon({
|
|
34
|
+
download: data === null || data === void 0 ? void 0 : data.downloadUrl,
|
|
35
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey,
|
|
36
|
+
analytics,
|
|
37
|
+
...data
|
|
38
|
+
}),
|
|
39
|
+
// These values have already been set in analytics context.
|
|
40
|
+
// We only pass these here for ufo experience.
|
|
41
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
42
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (onClickCallback) {
|
|
46
|
+
onClickCallback();
|
|
47
|
+
}
|
|
40
48
|
}
|
|
41
49
|
}, [analytics, data, invoke, onClickCallback]);
|
|
42
50
|
const isStackItem = props.as === 'stack-item';
|
|
@@ -14,6 +14,7 @@ import { R50, R500 } from '@atlaskit/theme/colors';
|
|
|
14
14
|
import { useAnalyticsEvents } from '../../../../../../../common/analytics/generated/use-analytics-events';
|
|
15
15
|
import { messages } from '../../../../../../../messages';
|
|
16
16
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../../state/flexible-ui-context';
|
|
17
|
+
import useInvokeClientAction from '../../../../../../../state/hooks/use-invoke-client-action';
|
|
17
18
|
import useResolve from '../../../../../../../state/hooks/use-resolve';
|
|
18
19
|
import { getFormattedMessage, openEmbedModalWithFlexibleUiIcon } from '../../../../utils';
|
|
19
20
|
import { contentStyles, dropdownItemGroupStyles, linkStyles, textStyles } from './styled';
|
|
@@ -22,6 +23,7 @@ const LozengeActionError = ({
|
|
|
22
23
|
errorMessage,
|
|
23
24
|
testId,
|
|
24
25
|
maxLineNumber = MAX_LINE_NUMBER,
|
|
26
|
+
invokePreviewAction,
|
|
25
27
|
url,
|
|
26
28
|
previewData
|
|
27
29
|
}) => {
|
|
@@ -30,7 +32,8 @@ const LozengeActionError = ({
|
|
|
30
32
|
} = useAnalyticsEvents();
|
|
31
33
|
const reload = useResolve();
|
|
32
34
|
const analytics = useFlexibleUiAnalyticsContext();
|
|
33
|
-
const
|
|
35
|
+
const invoke = useInvokeClientAction({});
|
|
36
|
+
const isPreviewAvailable = fg('platform-smart-card-migrate-embed-modal-analytics') ? invokePreviewAction !== undefined : previewData && previewData.src !== undefined;
|
|
34
37
|
const handlePreviewClose = useCallback(() => {
|
|
35
38
|
if (url) {
|
|
36
39
|
reload(url, true);
|
|
@@ -43,13 +46,17 @@ const LozengeActionError = ({
|
|
|
43
46
|
} else {
|
|
44
47
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkLozengeActionErrorOpenPreviewClickedEvent();
|
|
45
48
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
50
|
+
invokePreviewAction && invoke(invokePreviewAction);
|
|
51
|
+
} else {
|
|
52
|
+
return openEmbedModalWithFlexibleUiIcon({
|
|
53
|
+
...previewData,
|
|
54
|
+
analytics,
|
|
55
|
+
onClose: handlePreviewClose
|
|
56
|
+
});
|
|
57
|
+
}
|
|
51
58
|
}
|
|
52
|
-
}, [analytics, handlePreviewClose, isPreviewAvailable, previewData, fireEvent]);
|
|
59
|
+
}, [analytics, handlePreviewClose, isPreviewAvailable, invoke, invokePreviewAction, previewData, fireEvent]);
|
|
53
60
|
const content = useMemo(() => {
|
|
54
61
|
return jsx(Fragment, null, jsx("div", {
|
|
55
62
|
css: contentStyles
|
|
@@ -198,6 +198,10 @@ export const getTruncateStyles = (maxLines, lineHeight = '1rem', wordBreak = 'br
|
|
|
198
198
|
export const hasWhiteSpace = str => {
|
|
199
199
|
return str.search(/\s/) >= 0;
|
|
200
200
|
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
204
|
+
*/
|
|
201
205
|
export const openEmbedModalWithFlexibleUiIcon = ({
|
|
202
206
|
linkIcon,
|
|
203
207
|
...props
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useEffect, useMemo } from 'react';
|
|
3
|
+
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
3
4
|
import { SmartLinkStatus } from '../../constants';
|
|
4
5
|
import { FlexibleUiAnalyticsContext, FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
5
6
|
import { useAISummaryConfig } from '../../state/hooks/use-ai-summary-config';
|
|
7
|
+
import useResolve from '../../state/hooks/use-resolve';
|
|
6
8
|
import Container from './components/container';
|
|
7
9
|
import { getContextByStatus, getRetryOptions } from './utils';
|
|
8
10
|
|
|
@@ -22,6 +24,7 @@ const FlexibleCard = ({
|
|
|
22
24
|
onClick,
|
|
23
25
|
onError,
|
|
24
26
|
onResolve,
|
|
27
|
+
origin,
|
|
25
28
|
renderers,
|
|
26
29
|
showAuthTooltip,
|
|
27
30
|
showHoverPreview,
|
|
@@ -33,6 +36,10 @@ const FlexibleCard = ({
|
|
|
33
36
|
}) => {
|
|
34
37
|
var _details$meta2;
|
|
35
38
|
const aiSummaryConfig = useAISummaryConfig();
|
|
39
|
+
const resolve = useResolve();
|
|
40
|
+
const {
|
|
41
|
+
fireEvent
|
|
42
|
+
} = useAnalyticsEvents();
|
|
36
43
|
const {
|
|
37
44
|
status: cardType,
|
|
38
45
|
details
|
|
@@ -40,13 +47,17 @@ const FlexibleCard = ({
|
|
|
40
47
|
const status = cardType;
|
|
41
48
|
const context = useMemo(() => getContextByStatus({
|
|
42
49
|
aiSummaryConfig,
|
|
50
|
+
appearance,
|
|
51
|
+
fireEvent,
|
|
43
52
|
response: details,
|
|
44
53
|
id,
|
|
54
|
+
origin,
|
|
45
55
|
renderers,
|
|
56
|
+
resolve,
|
|
46
57
|
actionOptions,
|
|
47
58
|
status,
|
|
48
59
|
url
|
|
49
|
-
}), [aiSummaryConfig, details, id, renderers, actionOptions, status, url]);
|
|
60
|
+
}), [aiSummaryConfig, appearance, details, fireEvent, id, origin, renderers, actionOptions, resolve, status, url]);
|
|
50
61
|
const retry = getRetryOptions(url, status, details, onAuthorize);
|
|
51
62
|
const {
|
|
52
63
|
title
|
|
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
10
10
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
11
11
|
const PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "32.7.
|
|
13
|
+
packageVersion: "32.7.1",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { extractLink } from '@atlaskit/link-extractors';
|
|
4
|
+
import { ActionName, CardAction } from '../../index';
|
|
5
|
+
import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
|
|
6
|
+
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
7
|
+
export var extractInvokeCopyLinkAction = function extractInvokeCopyLinkAction(_ref) {
|
|
8
|
+
var actionOptions = _ref.actionOptions,
|
|
9
|
+
appearance = _ref.appearance,
|
|
10
|
+
id = _ref.id,
|
|
11
|
+
response = _ref.response;
|
|
12
|
+
if (!canShowAction(CardAction.CopyLinkAction, actionOptions)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
var data = response.data;
|
|
16
|
+
var url = extractLink(data);
|
|
17
|
+
if (!url) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
actionFn: function () {
|
|
22
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
23
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
return _context.abrupt("return", navigator.clipboard.writeText(url));
|
|
27
|
+
case 1:
|
|
28
|
+
case "end":
|
|
29
|
+
return _context.stop();
|
|
30
|
+
}
|
|
31
|
+
}, _callee);
|
|
32
|
+
}));
|
|
33
|
+
function actionFn() {
|
|
34
|
+
return _actionFn.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
return actionFn;
|
|
37
|
+
}(),
|
|
38
|
+
actionSubjectId: 'copyLink',
|
|
39
|
+
actionType: ActionName.CopyLinkAction,
|
|
40
|
+
definitionId: getDefinitionId(response),
|
|
41
|
+
display: appearance,
|
|
42
|
+
extensionKey: getExtensionKey(response),
|
|
43
|
+
id: id,
|
|
44
|
+
resourceType: getResourceType(response)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { ActionName, CardAction } from '../../index';
|
|
4
|
+
import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
|
|
5
|
+
import { downloadUrl as download } from '../../utils';
|
|
6
|
+
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
7
|
+
import { getActionsFromJsonLd } from '../common/actions/extractActions';
|
|
8
|
+
import { extractDownloadUrl } from '../common/detail';
|
|
9
|
+
export var extractInvokeDownloadAction = function extractInvokeDownloadAction(_ref) {
|
|
10
|
+
var actionOptions = _ref.actionOptions,
|
|
11
|
+
appearance = _ref.appearance,
|
|
12
|
+
id = _ref.id,
|
|
13
|
+
response = _ref.response;
|
|
14
|
+
if (!canShowAction(CardAction.DownloadAction, actionOptions)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var data = response.data;
|
|
18
|
+
var downloadActionExists = getActionsFromJsonLd(data).find(function (action) {
|
|
19
|
+
return action['@type'] === 'DownloadAction';
|
|
20
|
+
});
|
|
21
|
+
if (downloadActionExists) {
|
|
22
|
+
var downloadUrl = extractDownloadUrl(data);
|
|
23
|
+
return {
|
|
24
|
+
actionFn: function () {
|
|
25
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
26
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
27
|
+
while (1) switch (_context.prev = _context.next) {
|
|
28
|
+
case 0:
|
|
29
|
+
return _context.abrupt("return", download(downloadUrl));
|
|
30
|
+
case 1:
|
|
31
|
+
case "end":
|
|
32
|
+
return _context.stop();
|
|
33
|
+
}
|
|
34
|
+
}, _callee);
|
|
35
|
+
}));
|
|
36
|
+
function actionFn() {
|
|
37
|
+
return _actionFn.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
return actionFn;
|
|
40
|
+
}(),
|
|
41
|
+
actionSubjectId: 'downloadDocument',
|
|
42
|
+
actionType: ActionName.DownloadAction,
|
|
43
|
+
definitionId: getDefinitionId(response),
|
|
44
|
+
display: appearance,
|
|
45
|
+
extensionKey: getExtensionKey(response),
|
|
46
|
+
id: id,
|
|
47
|
+
resourceType: getResourceType(response)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { extractLink, extractPreview as extractPreviewData, extractProvider, extractTitle } from '@atlaskit/link-extractors';
|
|
4
|
+
import { ActionName, CardAction } from '../../index';
|
|
5
|
+
import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
|
|
6
|
+
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
7
|
+
import { openEmbedModal } from '../../view/EmbedModal/utils';
|
|
8
|
+
import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
|
|
9
|
+
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
10
|
+
import { extractLinkIcon } from '../flexible/icon';
|
|
11
|
+
import { extractInvokeDownloadAction } from './extract-invoke-download-action';
|
|
12
|
+
import { extractInvokeViewAction } from './extract-invoke-view-action';
|
|
13
|
+
export var extractInvokePreviewAction = function extractInvokePreviewAction(param) {
|
|
14
|
+
var _extractPreviewData;
|
|
15
|
+
var actionOptions = param.actionOptions,
|
|
16
|
+
display = param.appearance,
|
|
17
|
+
fireEvent = param.fireEvent,
|
|
18
|
+
onClose = param.onClose,
|
|
19
|
+
id = param.id,
|
|
20
|
+
origin = param.origin,
|
|
21
|
+
response = param.response;
|
|
22
|
+
if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
var data = response.data;
|
|
26
|
+
var meta = response.meta;
|
|
27
|
+
var src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
28
|
+
if (src) {
|
|
29
|
+
var url = extractLink(data);
|
|
30
|
+
return {
|
|
31
|
+
actionFn: function () {
|
|
32
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
33
|
+
var _extractProvider;
|
|
34
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
|
+
while (1) switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
return _context.abrupt("return", openEmbedModal({
|
|
38
|
+
fireEvent: fireEvent,
|
|
39
|
+
invokeDownloadAction: extractInvokeDownloadAction(param),
|
|
40
|
+
isSupportTheming: extractIsSupportTheming(meta),
|
|
41
|
+
isTrusted: extractIsTrusted(meta),
|
|
42
|
+
linkIcon: extractLinkIcon(response),
|
|
43
|
+
providerName: (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
|
|
44
|
+
onClose: onClose,
|
|
45
|
+
origin: origin,
|
|
46
|
+
src: src,
|
|
47
|
+
title: extractTitle(data),
|
|
48
|
+
url: url,
|
|
49
|
+
invokeViewAction: extractInvokeViewAction(param, true)
|
|
50
|
+
}));
|
|
51
|
+
case 1:
|
|
52
|
+
case "end":
|
|
53
|
+
return _context.stop();
|
|
54
|
+
}
|
|
55
|
+
}, _callee);
|
|
56
|
+
}));
|
|
57
|
+
function actionFn() {
|
|
58
|
+
return _actionFn.apply(this, arguments);
|
|
59
|
+
}
|
|
60
|
+
return actionFn;
|
|
61
|
+
}(),
|
|
62
|
+
actionSubjectId: 'invokePreviewScreen',
|
|
63
|
+
actionType: ActionName.PreviewAction,
|
|
64
|
+
definitionId: getDefinitionId(response),
|
|
65
|
+
display: display,
|
|
66
|
+
extensionKey: getExtensionKey(response),
|
|
67
|
+
id: id,
|
|
68
|
+
resourceType: getResourceType(response)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { extractLink } from '@atlaskit/link-extractors';
|
|
4
|
+
import { CardAction } from '../../index';
|
|
5
|
+
import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
|
|
6
|
+
import { openUrl } from '../../utils';
|
|
7
|
+
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
8
|
+
import { getActionsFromJsonLd } from '../common/actions/extractActions';
|
|
9
|
+
export var extractInvokeViewAction = function extractInvokeViewAction(_ref, force) {
|
|
10
|
+
var actionOptions = _ref.actionOptions,
|
|
11
|
+
appearance = _ref.appearance,
|
|
12
|
+
id = _ref.id,
|
|
13
|
+
response = _ref.response;
|
|
14
|
+
if (!canShowAction(CardAction.ViewAction, actionOptions)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var data = response.data;
|
|
18
|
+
if (!data) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
var url = extractLink(data);
|
|
22
|
+
var viewActionExists = getActionsFromJsonLd(data).find(function (action) {
|
|
23
|
+
return action['@type'] === 'ViewAction';
|
|
24
|
+
});
|
|
25
|
+
if (url && (viewActionExists || force)) {
|
|
26
|
+
return {
|
|
27
|
+
actionFn: function () {
|
|
28
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
29
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
30
|
+
while (1) switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
return _context.abrupt("return", openUrl(url));
|
|
33
|
+
case 1:
|
|
34
|
+
case "end":
|
|
35
|
+
return _context.stop();
|
|
36
|
+
}
|
|
37
|
+
}, _callee);
|
|
38
|
+
}));
|
|
39
|
+
function actionFn() {
|
|
40
|
+
return _actionFn.apply(this, arguments);
|
|
41
|
+
}
|
|
42
|
+
return actionFn;
|
|
43
|
+
}(),
|
|
44
|
+
actionSubjectId: 'shortcutGoToLink',
|
|
45
|
+
actionType: 'ViewAction',
|
|
46
|
+
definitionId: getDefinitionId(response),
|
|
47
|
+
display: appearance,
|
|
48
|
+
extensionKey: getExtensionKey(response),
|
|
49
|
+
id: id,
|
|
50
|
+
resourceType: getResourceType(response)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { ActionName } from '../../constants';
|
|
2
2
|
import { downloadUrl } from '../../utils';
|
|
3
3
|
import { extractDownloadAction as extractDownloadActionData } from '../flexible/actions/extract-download-action';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
7
|
+
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
8
|
+
*/
|
|
4
9
|
export var extractDownloadActionProps = function extractDownloadActionProps(_ref) {
|
|
5
10
|
var response = _ref.response,
|
|
6
11
|
actionOptions = _ref.actionOptions,
|
|
@@ -4,6 +4,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { ActionName } from '../../constants';
|
|
5
5
|
import { openEmbedModal } from '../../view/EmbedModal/utils';
|
|
6
6
|
import { extractPreviewAction as extractPreviewActionData } from '../flexible/actions/extract-preview-action';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
10
|
+
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
11
|
+
*/
|
|
7
12
|
export var extractPreviewActionProps = function extractPreviewActionProps(_ref) {
|
|
8
13
|
var response = _ref.response,
|
|
9
14
|
analytics = _ref.analytics,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { openUrl } from '../../utils';
|
|
2
2
|
import { extractViewAction as extractViewActionData } from '../flexible/actions/extract-view-action';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
6
|
+
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
7
|
+
*/
|
|
3
8
|
export var extractViewActionProps = function extractViewActionProps(_ref) {
|
|
4
9
|
var response = _ref.response,
|
|
5
10
|
actionOptions = _ref.actionOptions,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { extractLink } from '@atlaskit/link-extractors';
|
|
2
2
|
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
3
|
import { CardAction } from '../../../view/Card/types';
|
|
4
|
+
import { extractInvokeCopyLinkAction } from '../../action/extract-invoke-copy-link-action';
|
|
5
|
+
/**
|
|
6
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
7
|
+
* Replaced with extractCopyLinkClientAction()
|
|
8
|
+
*/
|
|
4
9
|
export var extractCopyLinkAction = function extractCopyLinkAction(data, actionOptions) {
|
|
5
10
|
if (!canShowAction(CardAction.CopyLinkAction, actionOptions)) {
|
|
6
11
|
return;
|
|
@@ -12,4 +17,10 @@ export var extractCopyLinkAction = function extractCopyLinkAction(data, actionOp
|
|
|
12
17
|
return {
|
|
13
18
|
url: url
|
|
14
19
|
};
|
|
20
|
+
};
|
|
21
|
+
export var extractCopyLinkClientAction = function extractCopyLinkClientAction(param) {
|
|
22
|
+
var invokeAction = extractInvokeCopyLinkAction(param);
|
|
23
|
+
return invokeAction ? {
|
|
24
|
+
invokeAction: invokeAction
|
|
25
|
+
} : undefined;
|
|
15
26
|
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
2
2
|
import { CardAction } from '../../../view/Card/types';
|
|
3
|
+
import { extractInvokeDownloadAction } from '../../action/extract-invoke-download-action';
|
|
3
4
|
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
4
5
|
import { extractDownloadUrl } from '../../common/detail';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
9
|
+
* Replaced with extractDownloadClientAction()
|
|
10
|
+
*/
|
|
5
11
|
export var extractDownloadAction = function extractDownloadAction(data, actionOptions) {
|
|
6
12
|
if (!canShowAction(CardAction.DownloadAction, actionOptions)) {
|
|
7
13
|
return;
|
|
@@ -15,4 +21,10 @@ export var extractDownloadAction = function extractDownloadAction(data, actionOp
|
|
|
15
21
|
};
|
|
16
22
|
}
|
|
17
23
|
return;
|
|
24
|
+
};
|
|
25
|
+
export var extractDownloadClientAction = function extractDownloadClientAction(param) {
|
|
26
|
+
var invokeAction = extractInvokeDownloadAction(param);
|
|
27
|
+
return invokeAction ? {
|
|
28
|
+
invokeAction: invokeAction
|
|
29
|
+
} : undefined;
|
|
18
30
|
};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { extractLink, extractPreview as extractPreviewData, extractProvider, extractTitle } from '@atlaskit/link-extractors';
|
|
2
2
|
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
3
|
import { CardAction } from '../../../view/Card/types';
|
|
4
|
+
import { extractInvokePreviewAction } from '../../action/extract-invoke-preview-action';
|
|
4
5
|
import { extractDownloadUrl } from '../../common/detail';
|
|
5
6
|
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
6
7
|
import { extractIsTrusted } from '../../common/meta/extractIsTrusted';
|
|
7
8
|
import { extractLinkIcon } from '../icon';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
12
|
+
* Replaced with extractPreviewClientAction()
|
|
13
|
+
*/
|
|
8
14
|
export var extractPreviewAction = function extractPreviewAction(response, actionOptions) {
|
|
9
15
|
var _extractPreviewData;
|
|
10
16
|
if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
|
|
@@ -26,4 +32,10 @@ export var extractPreviewAction = function extractPreviewAction(response, action
|
|
|
26
32
|
isTrusted: extractIsTrusted(meta)
|
|
27
33
|
};
|
|
28
34
|
}
|
|
35
|
+
};
|
|
36
|
+
export var extractPreviewClientAction = function extractPreviewClientAction(param) {
|
|
37
|
+
var invokeAction = extractInvokePreviewAction(param);
|
|
38
|
+
return invokeAction ? {
|
|
39
|
+
invokeAction: invokeAction
|
|
40
|
+
} : undefined;
|
|
29
41
|
};
|