@atlaskit/smart-card 33.1.0 → 33.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/extractors/flexible/actions/extract-copy-link-action.js +1 -20
- package/dist/cjs/extractors/flexible/actions/extract-download-action.js +1 -23
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +1 -34
- package/dist/cjs/extractors/flexible/actions/index.js +2 -15
- package/dist/cjs/extractors/flexible/extract-state.js +1 -5
- package/dist/cjs/extractors/flexible/index.js +3 -7
- package/dist/cjs/state/actions/index.js +2 -4
- package/dist/cjs/state/analytics/index.js +1 -8
- package/dist/cjs/state/flexible-ui-context/index.js +1 -10
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/cjs/state/hooks/useSmartLink.js +1 -4
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/cjs/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/cjs/state/index.js +1 -8
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/cjs/utils/analytics/analytics.js +2 -144
- package/dist/cjs/utils/analytics/index.js +0 -30
- package/dist/cjs/utils/analytics/types.js +1 -5
- package/dist/cjs/utils/mocks.js +1 -23
- package/dist/cjs/view/BlockCard/index.js +1 -3
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +2 -4
- package/dist/cjs/view/CardWithUrl/component.js +13 -33
- package/dist/cjs/view/CardWithUrl/loader.js +10 -22
- package/dist/cjs/view/EmbedCard/index.js +0 -4
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +3 -5
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/cjs/view/EmbedModal/index.js +9 -68
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +27 -67
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +5 -44
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +5 -51
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +10 -26
- package/dist/cjs/view/FlexibleCard/components/utils.js +1 -28
- package/dist/cjs/view/FlexibleCard/index.js +3 -17
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +3 -5
- package/dist/cjs/view/HoverCard/index.js +10 -22
- package/dist/cjs/view/InlineCard/index.js +1 -3
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/extract-copy-link-action.js +0 -19
- package/dist/es2019/extractors/flexible/actions/extract-download-action.js +0 -21
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +0 -34
- package/dist/es2019/extractors/flexible/actions/index.js +4 -23
- package/dist/es2019/extractors/flexible/extract-state.js +1 -5
- package/dist/es2019/extractors/flexible/index.js +3 -4
- package/dist/es2019/state/actions/index.js +2 -4
- package/dist/es2019/state/analytics/index.js +1 -2
- package/dist/es2019/state/flexible-ui-context/index.js +0 -7
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/es2019/state/hooks/useSmartLink.js +1 -4
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/es2019/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/es2019/state/index.js +1 -2
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -40
- package/dist/es2019/utils/analytics/analytics.js +2 -145
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/utils/analytics/types.js +0 -1
- package/dist/es2019/utils/mocks.js +1 -23
- package/dist/es2019/view/BlockCard/index.js +1 -3
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +1 -3
- package/dist/es2019/view/CardWithUrl/component.js +14 -34
- package/dist/es2019/view/CardWithUrl/loader.js +11 -23
- package/dist/es2019/view/EmbedCard/index.js +0 -4
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +1 -3
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +39 -88
- package/dist/es2019/view/EmbedModal/index.js +10 -35
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +13 -37
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +6 -27
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +6 -32
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -24
- package/dist/es2019/view/FlexibleCard/components/utils.js +0 -25
- package/dist/es2019/view/FlexibleCard/index.js +3 -15
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +12 -25
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +2 -4
- package/dist/es2019/view/HoverCard/index.js +11 -23
- package/dist/es2019/view/InlineCard/index.js +0 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/extract-copy-link-action.js +0 -19
- package/dist/esm/extractors/flexible/actions/extract-download-action.js +0 -23
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +0 -34
- package/dist/esm/extractors/flexible/actions/index.js +4 -17
- package/dist/esm/extractors/flexible/extract-state.js +1 -5
- package/dist/esm/extractors/flexible/index.js +3 -4
- package/dist/esm/state/actions/index.js +2 -4
- package/dist/esm/state/analytics/index.js +1 -2
- package/dist/esm/state/flexible-ui-context/index.js +0 -9
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/esm/state/hooks/useSmartLink.js +1 -4
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/esm/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/esm/state/index.js +1 -2
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/esm/utils/analytics/analytics.js +1 -143
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/utils/analytics/types.js +0 -1
- package/dist/esm/utils/mocks.js +0 -22
- package/dist/esm/view/BlockCard/index.js +1 -3
- package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/esm/view/BlockCard/views/UnauthorisedView.js +2 -4
- package/dist/esm/view/CardWithUrl/component.js +14 -34
- package/dist/esm/view/CardWithUrl/loader.js +10 -22
- package/dist/esm/view/EmbedCard/index.js +0 -4
- package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +3 -5
- package/dist/esm/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/esm/view/EmbedModal/index.js +11 -70
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +28 -68
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +6 -45
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +6 -52
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -26
- package/dist/esm/view/FlexibleCard/components/utils.js +0 -27
- package/dist/esm/view/FlexibleCard/index.js +4 -18
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +3 -5
- package/dist/esm/view/HoverCard/index.js +10 -22
- package/dist/esm/view/InlineCard/index.js +1 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/common/actions/types.d.ts +0 -2
- package/dist/types/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/index.d.ts +0 -6
- package/dist/types/state/actions/index.d.ts +1 -2
- package/dist/types/state/analytics/index.d.ts +0 -2
- package/dist/types/state/flexible-ui-context/index.d.ts +1 -7
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -25
- package/dist/types/state/hooks/use-invoke/types.d.ts +0 -6
- package/dist/types/state/hooks/use-invoke-client-action/index.d.ts +1 -1
- package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +0 -6
- package/dist/types/state/hooks/useSmartLink.d.ts +0 -22
- package/dist/types/state/index.d.ts +0 -1
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types/utils/analytics/analytics.d.ts +0 -6
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/analytics/types.d.ts +0 -42
- package/dist/types/utils/mocks.d.ts +0 -22
- package/dist/types/view/BlockCard/index.d.ts +1 -1
- package/dist/types/view/BlockCard/types.d.ts +0 -2
- package/dist/types/view/BlockCard/views/types.d.ts +1 -1
- package/dist/types/view/CardWithUrl/types.d.ts +0 -2
- package/dist/types/view/EmbedCard/types.d.ts +0 -2
- package/dist/types/view/EmbedCard/views/unauthorized-view/index.d.ts +1 -1
- package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +0 -2
- package/dist/types/view/EmbedModal/components/analytics/types.d.ts +0 -2
- package/dist/types/view/EmbedModal/index.d.ts +0 -2
- package/dist/types/view/EmbedModal/types.d.ts +0 -3
- 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 +0 -6
- package/dist/types/view/FlexibleCard/components/utils.d.ts +0 -6
- package/dist/types/view/FlexibleCard/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/types.d.ts +0 -6
- package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types/view/HoverCard/components/HoverCardContent.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +0 -2
- package/dist/types/view/HoverCard/components/views/unauthorised/index.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/unauthorised/types.d.ts +0 -5
- package/dist/types/view/HoverCard/types.d.ts +0 -3
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +0 -3
- package/dist/types/view/InlineCard/index.d.ts +1 -1
- package/dist/types/view/InlineCard/types.d.ts +0 -2
- package/dist/types/view/common/UnauthorisedViewContent.d.ts +0 -6
- package/dist/types-ts4.5/extractors/common/actions/types.d.ts +0 -2
- package/dist/types-ts4.5/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +0 -6
- package/dist/types-ts4.5/state/actions/index.d.ts +1 -2
- package/dist/types-ts4.5/state/analytics/index.d.ts +0 -2
- package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +1 -7
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +4 -25
- package/dist/types-ts4.5/state/hooks/use-invoke/types.d.ts +0 -6
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/index.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/types.d.ts +0 -6
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +0 -22
- package/dist/types-ts4.5/state/index.d.ts +0 -1
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +0 -6
- package/dist/types-ts4.5/utils/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/types.d.ts +0 -42
- package/dist/types-ts4.5/utils/mocks.d.ts +0 -22
- package/dist/types-ts4.5/view/BlockCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/BlockCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/BlockCard/views/types.d.ts +1 -1
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/index.d.ts +1 -1
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedModal/components/analytics/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedModal/index.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedModal/types.d.ts +0 -3
- 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 +0 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +0 -6
- package/dist/types-ts4.5/view/FlexibleCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +0 -6
- package/dist/types-ts4.5/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/HoverCardContent.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/types.d.ts +0 -2
- package/dist/types-ts4.5/view/HoverCard/components/views/unauthorised/index.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/unauthorised/types.d.ts +0 -5
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +0 -3
- package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +0 -3
- package/dist/types-ts4.5/view/InlineCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/common/UnauthorisedViewContent.d.ts +0 -6
- package/package.json +1 -4
- package/dist/cjs/extractors/action/extractDownloadActionProps.js +0 -32
- package/dist/cjs/extractors/action/extractPreviewActionProps.js +0 -47
- package/dist/cjs/extractors/action/extractViewActionProps.js +0 -31
- package/dist/cjs/extractors/flexible/actions/extract-view-action.js +0 -27
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +0 -311
- package/dist/es2019/extractors/action/extractDownloadActionProps.js +0 -24
- package/dist/es2019/extractors/action/extractPreviewActionProps.js +0 -36
- package/dist/es2019/extractors/action/extractViewActionProps.js +0 -23
- package/dist/es2019/extractors/flexible/actions/extract-view-action.js +0 -20
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +0 -296
- package/dist/esm/extractors/action/extractDownloadActionProps.js +0 -27
- package/dist/esm/extractors/action/extractPreviewActionProps.js +0 -41
- package/dist/esm/extractors/action/extractViewActionProps.js +0 -26
- package/dist/esm/extractors/flexible/actions/extract-view-action.js +0 -22
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +0 -304
- package/dist/types/extractors/action/extractDownloadActionProps.d.ts +0 -7
- package/dist/types/extractors/action/extractPreviewActionProps.d.ts +0 -7
- package/dist/types/extractors/action/extractViewActionProps.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +0 -7
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +0 -91
- package/dist/types/utils/analytics/__mocks__/analytics.d.ts +0 -2
- package/dist/types/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
- package/dist/types-ts4.5/extractors/action/extractDownloadActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/action/extractPreviewActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/action/extractViewActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +0 -7
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +0 -91
- package/dist/types-ts4.5/utils/analytics/__mocks__/analytics.d.ts +0 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
|
@@ -2,12 +2,10 @@ 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';
|
|
6
5
|
import { ActionName } from '../../../../../constants';
|
|
7
6
|
import { messages } from '../../../../../messages';
|
|
8
|
-
import {
|
|
7
|
+
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
9
8
|
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
10
|
-
import { openEmbedModalWithFlexibleUiIcon } from '../../utils';
|
|
11
9
|
import Action from '../action';
|
|
12
10
|
const PreviewAction = ({
|
|
13
11
|
onClick: onClickCallback,
|
|
@@ -15,38 +13,14 @@ const PreviewAction = ({
|
|
|
15
13
|
}) => {
|
|
16
14
|
var _context$actions;
|
|
17
15
|
const context = useFlexibleUiContext();
|
|
18
|
-
const
|
|
19
|
-
const invoke = useInvokeClientAction({
|
|
20
|
-
analytics
|
|
21
|
-
});
|
|
16
|
+
const invoke = useInvokeClientAction({});
|
|
22
17
|
const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.PreviewAction];
|
|
23
18
|
const onClick = useCallback(() => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
}
|
|
19
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
20
|
+
invoke(data.invokeAction);
|
|
21
|
+
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
48
22
|
}
|
|
49
|
-
}, [
|
|
23
|
+
}, [data, invoke, onClickCallback]);
|
|
50
24
|
const isStackItem = props.as === 'stack-item';
|
|
51
25
|
const tooltipMessage = isStackItem ? messages.preview_description : messages.preview_improved;
|
|
52
26
|
return data ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
@@ -55,7 +55,7 @@ const LozengeAction = ({
|
|
|
55
55
|
const {
|
|
56
56
|
url,
|
|
57
57
|
id: linkId,
|
|
58
|
-
|
|
58
|
+
invokePreviewAction
|
|
59
59
|
} = (action === null || action === void 0 ? void 0 : (_action$update = action.update) === null || _action$update === void 0 ? void 0 : _action$update.details) || {};
|
|
60
60
|
const handleOpenChange = useCallback(async args => {
|
|
61
61
|
setIsOpen(args.isOpen);
|
|
@@ -135,7 +135,7 @@ const LozengeAction = ({
|
|
|
135
135
|
errorMessage: errorMessage,
|
|
136
136
|
testId: testId,
|
|
137
137
|
url: url,
|
|
138
|
-
|
|
138
|
+
invokePreviewAction: invokePreviewAction
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
if (items && items.length > 0) {
|
|
@@ -145,7 +145,7 @@ const LozengeAction = ({
|
|
|
145
145
|
onClick: handleItemClick
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
}, [errorMessage, handleItemClick, items,
|
|
148
|
+
}, [errorMessage, handleItemClick, items, invokePreviewAction, testId, url]);
|
|
149
149
|
return jsx(DropdownMenu, {
|
|
150
150
|
isLoading: isLoading,
|
|
151
151
|
isOpen: isOpen,
|
|
@@ -9,50 +9,32 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
10
10
|
import { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
11
11
|
import ErrorIcon from '@atlaskit/icon/core/migration/error';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { R50, R500 } from '@atlaskit/theme/colors';
|
|
14
13
|
import { useAnalyticsEvents } from '../../../../../../../common/analytics/generated/use-analytics-events';
|
|
15
14
|
import { messages } from '../../../../../../../messages';
|
|
16
|
-
import { useFlexibleUiAnalyticsContext } from '../../../../../../../state/flexible-ui-context';
|
|
17
15
|
import useInvokeClientAction from '../../../../../../../state/hooks/use-invoke-client-action';
|
|
18
|
-
import
|
|
19
|
-
import { getFormattedMessage, openEmbedModalWithFlexibleUiIcon } from '../../../../utils';
|
|
16
|
+
import { getFormattedMessage } from '../../../../utils';
|
|
20
17
|
import { contentStyles, dropdownItemGroupStyles, linkStyles, textStyles } from './styled';
|
|
21
18
|
const MAX_LINE_NUMBER = 8;
|
|
22
19
|
const LozengeActionError = ({
|
|
23
20
|
errorMessage,
|
|
24
21
|
testId,
|
|
25
22
|
maxLineNumber = MAX_LINE_NUMBER,
|
|
26
|
-
invokePreviewAction
|
|
27
|
-
url,
|
|
28
|
-
previewData
|
|
23
|
+
invokePreviewAction
|
|
29
24
|
}) => {
|
|
30
25
|
const {
|
|
31
26
|
fireEvent
|
|
32
27
|
} = useAnalyticsEvents();
|
|
33
|
-
const reload = useResolve();
|
|
34
|
-
const analytics = useFlexibleUiAnalyticsContext();
|
|
35
28
|
const invoke = useInvokeClientAction({});
|
|
36
|
-
const isPreviewAvailable =
|
|
37
|
-
const handlePreviewClose = useCallback(() => {
|
|
38
|
-
if (url) {
|
|
39
|
-
reload(url, true);
|
|
40
|
-
}
|
|
41
|
-
}, [reload, url]);
|
|
29
|
+
const isPreviewAvailable = invokePreviewAction !== undefined;
|
|
42
30
|
const handlePreviewOpen = useCallback(() => {
|
|
43
31
|
if (isPreviewAvailable) {
|
|
44
32
|
fireEvent('ui.button.clicked.smartLinkStatusOpenPreview', {});
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
} else {
|
|
48
|
-
return openEmbedModalWithFlexibleUiIcon({
|
|
49
|
-
...previewData,
|
|
50
|
-
analytics,
|
|
51
|
-
onClose: handlePreviewClose
|
|
52
|
-
});
|
|
33
|
+
if (invokePreviewAction) {
|
|
34
|
+
invoke(invokePreviewAction);
|
|
53
35
|
}
|
|
54
36
|
}
|
|
55
|
-
}, [
|
|
37
|
+
}, [isPreviewAvailable, invoke, invokePreviewAction, fireEvent]);
|
|
56
38
|
const content = useMemo(() => {
|
|
57
39
|
return jsx(Fragment, null, jsx("div", {
|
|
58
40
|
css: contentStyles
|
|
@@ -6,8 +6,6 @@ import { css } from '@emotion/react';
|
|
|
6
6
|
import { FormattedMessage } from 'react-intl-next';
|
|
7
7
|
import Loadable from 'react-loadable';
|
|
8
8
|
import { SmartLinkSize } from '../../../constants';
|
|
9
|
-
import { openEmbedModal } from '../../EmbedModal/utils';
|
|
10
|
-
import Icon from './elements/icon';
|
|
11
9
|
export const sizeToButtonSpacing = {
|
|
12
10
|
[SmartLinkSize.Small]: 'none',
|
|
13
11
|
[SmartLinkSize.Medium]: 'compact',
|
|
@@ -194,27 +192,4 @@ export const getTruncateStyles = (maxLines, lineHeight = '1rem', wordBreak = 'br
|
|
|
194
192
|
});
|
|
195
193
|
export const hasWhiteSpace = str => {
|
|
196
194
|
return str.search(/\s/) >= 0;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
201
|
-
*/
|
|
202
|
-
export const openEmbedModalWithFlexibleUiIcon = ({
|
|
203
|
-
linkIcon,
|
|
204
|
-
...props
|
|
205
|
-
}) => {
|
|
206
|
-
const icon = {
|
|
207
|
-
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
208
|
-
size: SmartLinkSize.Large
|
|
209
|
-
})),
|
|
210
|
-
isFlexibleUi: true
|
|
211
|
-
};
|
|
212
|
-
return openEmbedModal({
|
|
213
|
-
...props,
|
|
214
|
-
icon,
|
|
215
|
-
// Flex should not send origin as block card. It should be able to support
|
|
216
|
-
// its internal parent components like hover card, block card and
|
|
217
|
-
// itself as a standalone. To be investigated and fix in EDM-7520.
|
|
218
|
-
origin: 'smartLinkCard'
|
|
219
|
-
});
|
|
220
195
|
};
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useEffect, useMemo } from 'react';
|
|
3
3
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
4
4
|
import { SmartLinkStatus } from '../../constants';
|
|
5
|
-
import {
|
|
5
|
+
import { FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
6
6
|
import { useAISummaryConfig } from '../../state/hooks/use-ai-summary-config';
|
|
7
7
|
import useResolve from '../../state/hooks/use-resolve';
|
|
8
8
|
import Container from './components/container';
|
|
@@ -15,7 +15,6 @@ import { getContextByStatus, getRetryOptions } from './utils';
|
|
|
15
15
|
* @see Container
|
|
16
16
|
*/
|
|
17
17
|
const FlexibleCard = ({
|
|
18
|
-
analytics,
|
|
19
18
|
appearance = 'flexible',
|
|
20
19
|
cardState,
|
|
21
20
|
children,
|
|
@@ -33,7 +32,6 @@ const FlexibleCard = ({
|
|
|
33
32
|
ui,
|
|
34
33
|
url
|
|
35
34
|
}) => {
|
|
36
|
-
var _details$meta2;
|
|
37
35
|
const aiSummaryConfig = useAISummaryConfig();
|
|
38
36
|
const resolve = useResolve();
|
|
39
37
|
const {
|
|
@@ -61,14 +59,6 @@ const FlexibleCard = ({
|
|
|
61
59
|
const {
|
|
62
60
|
title
|
|
63
61
|
} = context || {};
|
|
64
|
-
const analyticsContext = useMemo(() => {
|
|
65
|
-
var _details$meta;
|
|
66
|
-
return analytics ? {
|
|
67
|
-
...analytics,
|
|
68
|
-
display: appearance,
|
|
69
|
-
extensionKey: details === null || details === void 0 ? void 0 : (_details$meta = details.meta) === null || _details$meta === void 0 ? void 0 : _details$meta.key
|
|
70
|
-
} : undefined;
|
|
71
|
-
}, [analytics, appearance, details === null || details === void 0 ? void 0 : (_details$meta2 = details.meta) === null || _details$meta2 === void 0 ? void 0 : _details$meta2.key]);
|
|
72
62
|
useEffect(() => {
|
|
73
63
|
switch (status) {
|
|
74
64
|
case SmartLinkStatus.Resolved:
|
|
@@ -93,9 +83,7 @@ const FlexibleCard = ({
|
|
|
93
83
|
break;
|
|
94
84
|
}
|
|
95
85
|
}, [onError, onResolve, status, title, url]);
|
|
96
|
-
return /*#__PURE__*/React.createElement(
|
|
97
|
-
value: analyticsContext
|
|
98
|
-
}, /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
|
|
86
|
+
return /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
|
|
99
87
|
value: ui
|
|
100
88
|
}, /*#__PURE__*/React.createElement(FlexibleUiContext.Provider, {
|
|
101
89
|
value: context
|
|
@@ -108,6 +96,6 @@ const FlexibleCard = ({
|
|
|
108
96
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
109
97
|
actionOptions: actionOptions,
|
|
110
98
|
status: status
|
|
111
|
-
}), children)))
|
|
99
|
+
}), children)));
|
|
112
100
|
};
|
|
113
101
|
export default FlexibleCard;
|
|
@@ -10,7 +10,6 @@ import { jsx } from '@emotion/react';
|
|
|
10
10
|
import Popup from '@atlaskit/popup';
|
|
11
11
|
import { ActionName, CardDisplay } from '../../../constants';
|
|
12
12
|
import { useSmartCardActions } from '../../../state/actions';
|
|
13
|
-
import { useSmartLinkAnalytics } from '../../../state/analytics';
|
|
14
13
|
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
15
14
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
16
15
|
import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
|
|
@@ -44,10 +43,9 @@ export const HoverCardComponent = ({
|
|
|
44
43
|
const parentSpan = useRef(null);
|
|
45
44
|
const renderers = useSmartLinkRenderers();
|
|
46
45
|
const linkState = useLinkState(url);
|
|
47
|
-
const analytics = useSmartLinkAnalytics(url, id);
|
|
48
46
|
const {
|
|
49
47
|
loadMetadata
|
|
50
|
-
} = useSmartCardActions(id, url
|
|
48
|
+
} = useSmartCardActions(id, url);
|
|
51
49
|
const setMousePosition = useCallback(event => {
|
|
52
50
|
if (isOpen && canOpen) {
|
|
53
51
|
return;
|
|
@@ -10,7 +10,6 @@ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytic
|
|
|
10
10
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
11
11
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
12
12
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
13
|
-
import { useSmartLinkAnalytics } from '../../../state/analytics';
|
|
14
13
|
import { getDefinitionId, getExtensionKey, getServices } from '../../../state/helpers';
|
|
15
14
|
import { useSmartCardState } from '../../../state/store';
|
|
16
15
|
import { isSpecialEvent } from '../../../utils';
|
|
@@ -26,7 +25,6 @@ import HoverCardUnauthorisedView from './views/unauthorised';
|
|
|
26
25
|
export const hoverCardClassName = 'smart-links-hover-preview';
|
|
27
26
|
const HoverCardContent = ({
|
|
28
27
|
id = '',
|
|
29
|
-
analytics: _analytics,
|
|
30
28
|
cardState,
|
|
31
29
|
onActionClick,
|
|
32
30
|
onResolve,
|
|
@@ -43,8 +41,6 @@ const HoverCardContent = ({
|
|
|
43
41
|
const {
|
|
44
42
|
fireEvent
|
|
45
43
|
} = useAnalyticsEvents();
|
|
46
|
-
const defaultAnalytics = useSmartLinkAnalytics(url, id);
|
|
47
|
-
const analytics = _analytics !== null && _analytics !== void 0 ? _analytics : defaultAnalytics;
|
|
48
44
|
const extensionKey = useMemo(() => getExtensionKey(cardState.details), [cardState.details]);
|
|
49
45
|
const linkState = useSmartCardState(url);
|
|
50
46
|
const linkStatus = (_linkState$status = linkState.status) !== null && _linkState$status !== void 0 ? _linkState$status : 'pending';
|
|
@@ -126,8 +122,7 @@ const HoverCardContent = ({
|
|
|
126
122
|
actionOptions,
|
|
127
123
|
ui: flexibleUiOptions,
|
|
128
124
|
url: url,
|
|
129
|
-
children: null
|
|
130
|
-
analytics
|
|
125
|
+
children: null
|
|
131
126
|
};
|
|
132
127
|
const onClickStopPropagation = useCallback(e => e.stopPropagation(), []);
|
|
133
128
|
const getCardView = cardState => {
|
|
@@ -139,7 +134,6 @@ const HoverCardContent = ({
|
|
|
139
134
|
}
|
|
140
135
|
if (cardState.status === 'unauthorized' && services !== null && services !== void 0 && services.length) {
|
|
141
136
|
return jsx(HoverCardUnauthorisedView, {
|
|
142
|
-
analytics: analytics,
|
|
143
137
|
extensionKey: extensionKey,
|
|
144
138
|
id: id,
|
|
145
139
|
flexibleCardProps: flexibleCardProps,
|
|
@@ -153,7 +147,6 @@ const HoverCardContent = ({
|
|
|
153
147
|
}
|
|
154
148
|
if (cardState.status === 'resolved') {
|
|
155
149
|
return jsx(HoverCardResolvedView, {
|
|
156
|
-
analytics: analytics,
|
|
157
150
|
cardState: cardState,
|
|
158
151
|
extensionKey: extensionKey,
|
|
159
152
|
flexibleCardProps: flexibleCardProps,
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
5
4
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize, SmartLinkStatus } from '../../../../../constants';
|
|
6
5
|
import { succeedUfoExperience } from '../../../../../state/analytics';
|
|
7
|
-
import { getCanBeDatasource, getDefinitionId } from '../../../../../state/helpers';
|
|
8
6
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
9
7
|
import { ActionBlock, AIFooterBlock, AISummaryBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
10
8
|
import { getMetadata } from '../../../utils';
|
|
11
9
|
import ImagePreview from '../../ImagePreview';
|
|
12
10
|
import { hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
13
11
|
const HoverCardResolvedView = ({
|
|
14
|
-
analytics,
|
|
15
12
|
cardState,
|
|
16
13
|
extensionKey,
|
|
17
14
|
flexibleCardProps,
|
|
@@ -24,32 +21,22 @@ const HoverCardResolvedView = ({
|
|
|
24
21
|
const {
|
|
25
22
|
fireEvent
|
|
26
23
|
} = useAnalyticsEvents();
|
|
27
|
-
const definitionId = React.useMemo(() => getDefinitionId(cardState.details), [cardState.details]);
|
|
28
|
-
const canBeDatasource = React.useMemo(() => getCanBeDatasource(cardState.details), [cardState.details]);
|
|
29
24
|
useEffect(() => {
|
|
30
25
|
// Since this hover view is only rendered on resolved status,
|
|
31
26
|
// there is no need to check for statuses.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
27
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
28
|
+
extensionKey,
|
|
29
|
+
display: CardDisplay.HoverCardPreview
|
|
30
|
+
});
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
analytics.ui.renderSuccessEvent({
|
|
47
|
-
display: CardDisplay.HoverCardPreview,
|
|
48
|
-
status: cardState.status,
|
|
49
|
-
canBeDatasource
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}, [analytics.ui, cardState.status, canBeDatasource, fireEvent, definitionId, extensionKey, id]);
|
|
32
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
33
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
34
|
+
display: CardDisplay.HoverCardPreview
|
|
35
|
+
});
|
|
36
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
37
|
+
display: CardDisplay.HoverCardPreview
|
|
38
|
+
});
|
|
39
|
+
}, [extensionKey, fireEvent, id]);
|
|
53
40
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
54
41
|
const {
|
|
55
42
|
primary,
|
|
@@ -14,7 +14,6 @@ import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group
|
|
|
14
14
|
import { LinkIcon } from '../../../../FlexibleCard/components/elements';
|
|
15
15
|
import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
|
|
16
16
|
const HoverCardUnauthorisedView = ({
|
|
17
|
-
analytics,
|
|
18
17
|
id = '',
|
|
19
18
|
flexibleCardProps,
|
|
20
19
|
testId = 'hover-card-unauthorised-view',
|
|
@@ -29,7 +28,7 @@ const HoverCardUnauthorisedView = ({
|
|
|
29
28
|
const isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
|
|
30
29
|
const {
|
|
31
30
|
authorize
|
|
32
|
-
} = useSmartCardActions(id, url
|
|
31
|
+
} = useSmartCardActions(id, url);
|
|
33
32
|
const {
|
|
34
33
|
fireEvent
|
|
35
34
|
} = useAnalyticsEvents();
|
|
@@ -62,8 +61,7 @@ const HoverCardUnauthorisedView = ({
|
|
|
62
61
|
testId: `${testId}-content`
|
|
63
62
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
64
63
|
providerName: providerName,
|
|
65
|
-
isProductIntegrationSupported: isProductIntegrationSupported
|
|
66
|
-
analytics: analytics
|
|
64
|
+
isProductIntegrationSupported: isProductIntegrationSupported
|
|
67
65
|
}))), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
68
66
|
overrideCss: connectButtonStyles,
|
|
69
67
|
testId: `${testId}-button`
|
|
@@ -9,10 +9,8 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
10
10
|
import { di } from 'react-magnetic-di';
|
|
11
11
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
14
13
|
import { CardDisplay } from '../../constants';
|
|
15
|
-
import { useSmartLinkAnalytics } from '../../state';
|
|
16
14
|
import { failUfoExperience, startUfoExperience } from '../../state/analytics';
|
|
17
15
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
18
16
|
import { useSmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
|
|
@@ -26,7 +24,6 @@ const HoverCardWithErrorBoundary = props => {
|
|
|
26
24
|
id,
|
|
27
25
|
children
|
|
28
26
|
} = props;
|
|
29
|
-
const analytics = useSmartLinkAnalytics(url, id);
|
|
30
27
|
const analyticsContext = useSmartLinkAnalyticsContext({
|
|
31
28
|
display: CardDisplay.HoverCardPreview,
|
|
32
29
|
id,
|
|
@@ -34,26 +31,17 @@ const HoverCardWithErrorBoundary = props => {
|
|
|
34
31
|
url
|
|
35
32
|
});
|
|
36
33
|
const onError = useCallback((error, info) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} else {
|
|
49
|
-
analytics.ui.renderFailedEvent({
|
|
50
|
-
display: CardDisplay.HoverCardPreview,
|
|
51
|
-
id,
|
|
52
|
-
error,
|
|
53
|
-
errorInfo: info
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}, [analytics.ui, analyticsContext, id, fireEvent]);
|
|
34
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
35
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
36
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
37
|
+
fireEvent('ui.smartLink.renderFailed', {
|
|
38
|
+
...(analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes),
|
|
39
|
+
display: CardDisplay.HoverCardPreview,
|
|
40
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
41
|
+
error: error,
|
|
42
|
+
errorInfo: info
|
|
43
|
+
});
|
|
44
|
+
}, [analyticsContext, id, fireEvent]);
|
|
57
45
|
return jsx(ErrorBoundary, {
|
|
58
46
|
fallback: children,
|
|
59
47
|
onError: onError
|
|
@@ -16,7 +16,6 @@ import { InlineCardResolvingView } from './ResolvingView';
|
|
|
16
16
|
import { InlineCardUnauthorizedView } from './UnauthorisedView';
|
|
17
17
|
export { InlineCardResolvedView, InlineCardResolvingView, InlineCardErroredView, InlineCardForbiddenView, InlineCardUnauthorizedView };
|
|
18
18
|
export const InlineCard = ({
|
|
19
|
-
analytics,
|
|
20
19
|
id,
|
|
21
20
|
url,
|
|
22
21
|
cardState,
|
|
@@ -111,7 +110,6 @@ export const InlineCard = ({
|
|
|
111
110
|
testId: testIdWithStatus,
|
|
112
111
|
showHoverPreview: showHoverPreview,
|
|
113
112
|
id: id,
|
|
114
|
-
analytics: analytics,
|
|
115
113
|
extensionKey: extensionKey,
|
|
116
114
|
truncateInline: truncateInline
|
|
117
115
|
});
|
|
@@ -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: "33.
|
|
13
|
+
packageVersion: "33.3.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import { extractLink } from '@atlaskit/link-extractors';
|
|
2
|
-
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
|
-
import { CardAction } from '../../../view/Card/types';
|
|
4
1
|
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
|
-
*/
|
|
9
|
-
export var extractCopyLinkAction = function extractCopyLinkAction(data, actionOptions) {
|
|
10
|
-
if (!canShowAction(CardAction.CopyLinkAction, actionOptions)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
var url = extractLink(data);
|
|
14
|
-
if (!url) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
url: url
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
2
|
export var extractCopyLinkClientAction = function extractCopyLinkClientAction(param) {
|
|
22
3
|
var invokeAction = extractInvokeCopyLinkAction(param);
|
|
23
4
|
return invokeAction ? {
|
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
2
|
-
import { CardAction } from '../../../view/Card/types';
|
|
3
1
|
import { extractInvokeDownloadAction } from '../../action/extract-invoke-download-action';
|
|
4
|
-
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
5
|
-
import { extractDownloadUrl } from '../../common/download/extractDownloadUrl';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
9
|
-
* Replaced with extractDownloadClientAction()
|
|
10
|
-
*/
|
|
11
|
-
export var extractDownloadAction = function extractDownloadAction(data, actionOptions) {
|
|
12
|
-
if (!canShowAction(CardAction.DownloadAction, actionOptions)) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
var downloadActionExists = getActionsFromJsonLd(data).find(function (action) {
|
|
16
|
-
return action['@type'] === 'DownloadAction';
|
|
17
|
-
});
|
|
18
|
-
if (downloadActionExists) {
|
|
19
|
-
return {
|
|
20
|
-
downloadUrl: extractDownloadUrl(data)
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return;
|
|
24
|
-
};
|
|
25
2
|
export var extractDownloadClientAction = function extractDownloadClientAction(param) {
|
|
26
3
|
var invokeAction = extractInvokeDownloadAction(param);
|
|
27
4
|
return invokeAction ? {
|
|
@@ -1,38 +1,4 @@
|
|
|
1
|
-
import { extractLink, extractPreview as extractPreviewData, extractProvider, extractTitle } from '@atlaskit/link-extractors';
|
|
2
|
-
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
|
-
import { CardAction } from '../../../view/Card/types';
|
|
4
1
|
import { extractInvokePreviewAction } from '../../action/extract-invoke-preview-action';
|
|
5
|
-
import { extractDownloadUrl } from '../../common/download/extractDownloadUrl';
|
|
6
|
-
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
7
|
-
import { extractIsTrusted } from '../../common/meta/extractIsTrusted';
|
|
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
|
-
*/
|
|
14
|
-
export var extractPreviewAction = function extractPreviewAction(response, actionOptions) {
|
|
15
|
-
var _extractPreviewData;
|
|
16
|
-
if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
var data = response.data;
|
|
20
|
-
var meta = response.meta;
|
|
21
|
-
var src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
22
|
-
if (src) {
|
|
23
|
-
var _extractProvider;
|
|
24
|
-
return {
|
|
25
|
-
downloadUrl: extractDownloadUrl(data),
|
|
26
|
-
providerName: (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
|
|
27
|
-
src: src,
|
|
28
|
-
title: extractTitle(data),
|
|
29
|
-
linkIcon: extractLinkIcon(response),
|
|
30
|
-
url: extractLink(data),
|
|
31
|
-
isSupportTheming: extractIsSupportTheming(meta),
|
|
32
|
-
isTrusted: extractIsTrusted(meta)
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
2
|
export var extractPreviewClientAction = function extractPreviewClientAction(param) {
|
|
37
3
|
var invokeAction = extractInvokePreviewAction(param);
|
|
38
4
|
return invokeAction ? {
|
|
@@ -2,10 +2,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import { ActionName, InternalActionName } from '../../../constants';
|
|
3
3
|
import { extractAISummaryAction } from './extract-ai-summary-action';
|
|
4
4
|
import { extractAutomationAction } from './extract-automation-action';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { extractCopyLinkClientAction } from './extract-copy-link-action';
|
|
6
|
+
import { extractDownloadClientAction } from './extract-download-action';
|
|
7
7
|
import extractFollowAction from './extract-follow-action';
|
|
8
|
-
import {
|
|
8
|
+
import { extractPreviewClientAction } from './extract-preview-action';
|
|
9
9
|
import { extractViewRelatedLinksAction } from './extract-view-related-links-action';
|
|
10
10
|
export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref) {
|
|
11
11
|
var actionOptions = _ref.actionOptions,
|
|
@@ -37,17 +37,4 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
|
|
|
37
37
|
return Object.values(action).some(function (value) {
|
|
38
38
|
return Boolean(value);
|
|
39
39
|
}) ? action : undefined;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
44
|
-
* Replaced with extractFlexibleCardActions()
|
|
45
|
-
*/
|
|
46
|
-
var extractActions = function extractActions(response, url, actionOptions, id, aiSummaryConfig) {
|
|
47
|
-
var data = response.data;
|
|
48
|
-
var action = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ActionName.CopyLinkAction, extractCopyLinkAction(data, actionOptions)), ActionName.DownloadAction, extractDownloadAction(data, actionOptions)), ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), ActionName.PreviewAction, extractPreviewAction(response, actionOptions)), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), InternalActionName.ViewRelatedLinksAction, extractViewRelatedLinksAction(response));
|
|
49
|
-
return Object.values(action).some(function (value) {
|
|
50
|
-
return Boolean(value);
|
|
51
|
-
}) ? action : undefined;
|
|
52
|
-
};
|
|
53
|
-
export default extractActions;
|
|
40
|
+
};
|
|
@@ -2,13 +2,11 @@ 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
4
|
import { extractLink } from '@atlaskit/link-extractors';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { getExtensionKey } from '../../state/helpers';
|
|
7
6
|
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
8
7
|
import { CardAction } from '../../view/Card/types';
|
|
9
8
|
import { extractInvokePreviewAction } from '../action/extract-invoke-preview-action';
|
|
10
9
|
import { extractLozenge } from '../common/lozenge';
|
|
11
|
-
import { extractPreviewAction } from './actions/extract-preview-action';
|
|
12
10
|
import extractServerAction from './extract-server-action';
|
|
13
11
|
var toInvokeRequest = function toInvokeRequest(extensionKey, resourceIdentifiers, actionType, details) {
|
|
14
12
|
if (!actionType) {
|
|
@@ -39,8 +37,7 @@ var extractAction = function extractAction(response, id, actionOptions, appearan
|
|
|
39
37
|
}
|
|
40
38
|
var read = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataRetrieval = action.dataRetrievalAction) === null || _action$dataRetrieval === void 0 ? void 0 : _action$dataRetrieval.name);
|
|
41
39
|
var url = extractLink(data);
|
|
42
|
-
var
|
|
43
|
-
var invokePreviewAction = response && fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokePreviewAction({
|
|
40
|
+
var invokePreviewAction = response ? extractInvokePreviewAction({
|
|
44
41
|
actionOptions: actionOptions,
|
|
45
42
|
appearance: appearance,
|
|
46
43
|
fireEvent: fireEvent,
|
|
@@ -54,7 +51,6 @@ var extractAction = function extractAction(response, id, actionOptions, appearan
|
|
|
54
51
|
var details = {
|
|
55
52
|
id: id,
|
|
56
53
|
url: url,
|
|
57
|
-
previewData: previewData,
|
|
58
54
|
invokePreviewAction: invokePreviewAction
|
|
59
55
|
};
|
|
60
56
|
var update = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name, details);
|