@atlaskit/smart-card 33.0.0 → 33.2.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 +20 -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/analytics/useSmartLinkAnalytics.js +18 -190
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +12 -28
- package/dist/cjs/view/CardWithUrl/loader.js +10 -24
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/cjs/view/EmbedModal/index.js +8 -65
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +4 -40
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
- package/dist/cjs/view/FlexibleCard/components/container/index.js +1 -4
- 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 +0 -3
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/cjs/view/HoverCard/index.js +10 -22
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +1 -4
- package/dist/cjs/view/InlineCard/index.js +0 -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/analytics/useSmartLinkAnalytics.js +2 -172
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -40
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +13 -29
- package/dist/es2019/view/CardWithUrl/loader.js +11 -25
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +39 -88
- package/dist/es2019/view/EmbedModal/index.js +10 -33
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +11 -32
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +4 -22
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +4 -27
- package/dist/es2019/view/FlexibleCard/components/container/index.js +1 -3
- 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 +0 -3
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +12 -25
- package/dist/es2019/view/HoverCard/index.js +11 -23
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +1 -3
- package/dist/es2019/view/InlineCard/index.js +0 -3
- 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/analytics/useSmartLinkAnalytics.js +19 -191
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +13 -29
- package/dist/esm/view/CardWithUrl/loader.js +10 -24
- package/dist/esm/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/esm/view/EmbedModal/index.js +10 -67
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +4 -40
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
- package/dist/esm/view/FlexibleCard/components/container/index.js +1 -4
- 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 +0 -3
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/esm/view/HoverCard/index.js +10 -22
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +1 -4
- package/dist/esm/view/InlineCard/index.js +0 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- 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/analytics/useSmartLinkAnalytics.d.ts +2 -60
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -19
- 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/useSmartLink.d.ts +1 -16
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types/utils/mocks.d.ts +1 -16
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +0 -5
- package/dist/types/view/CardWithUrl/types.d.ts +0 -4
- 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/container/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/container/types.d.ts +1 -1
- 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/views/resolved/index.d.ts +1 -1
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +1 -6
- package/dist/types/view/InlineCard/index.d.ts +1 -1
- package/dist/types/view/InlineCard/types.d.ts +0 -4
- 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/analytics/useSmartLinkAnalytics.d.ts +2 -60
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +4 -19
- 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/useSmartLink.d.ts +1 -16
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types-ts4.5/utils/mocks.d.ts +1 -16
- package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.5/view/Card/types.d.ts +0 -5
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +0 -4
- 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/container/index.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/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/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +1 -6
- package/dist/types-ts4.5/view/InlineCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/types.d.ts +0 -4
- package/package.json +2 -8
- 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/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/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/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/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/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
|
@@ -6,9 +6,7 @@ import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
|
|
|
6
6
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
7
7
|
import { di } from 'react-magnetic-di';
|
|
8
8
|
import uuid from 'uuid';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
11
|
-
import { useSmartLinkAnalytics } from '../../state';
|
|
12
10
|
import { failUfoExperience, startUfoExperience } from '../../state/analytics';
|
|
13
11
|
import { importWithRetry } from '../../utils';
|
|
14
12
|
import { useSmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
|
|
@@ -55,13 +53,11 @@ export function CardWithURLRenderer(props) {
|
|
|
55
53
|
ui = props.ui,
|
|
56
54
|
showHoverPreview = props.showHoverPreview,
|
|
57
55
|
hoverPreviewOptions = props.hoverPreviewOptions,
|
|
58
|
-
showAuthTooltip = props.showAuthTooltip,
|
|
59
56
|
placeholder = props.placeholder,
|
|
60
57
|
fallbackComponent = props.fallbackComponent,
|
|
61
58
|
removeTextHighlightingFromTitle = props.removeTextHighlightingFromTitle,
|
|
62
59
|
resolvingPlaceholder = props.resolvingPlaceholder,
|
|
63
60
|
truncateInline = props.truncateInline;
|
|
64
|
-
var analytics = useSmartLinkAnalytics(url !== null && url !== void 0 ? url : '', id);
|
|
65
61
|
var isFlexibleUi = isFlexibleUiCard(children);
|
|
66
62
|
var analyticsContext = useSmartLinkAnalyticsContext({
|
|
67
63
|
display: isFlexibleUi ? 'flexible' : appearance,
|
|
@@ -86,31 +82,22 @@ export function CardWithURLRenderer(props) {
|
|
|
86
82
|
definitionId: null
|
|
87
83
|
}));
|
|
88
84
|
} else if (error.name !== 'APIError') {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}));
|
|
99
|
-
} else {
|
|
100
|
-
analytics.ui.renderFailedEvent({
|
|
101
|
-
display: isFlexibleUi ? 'flexible' : appearance,
|
|
102
|
-
id: id,
|
|
103
|
-
error: error,
|
|
104
|
-
errorInfo: errorInfo
|
|
105
|
-
});
|
|
106
|
-
}
|
|
85
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
86
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
87
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
88
|
+
fireEvent('ui.smartLink.renderFailed', _objectSpread(_objectSpread({}, analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes), {}, {
|
|
89
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
90
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
91
|
+
error: error,
|
|
92
|
+
errorInfo: errorInfo
|
|
93
|
+
}));
|
|
107
94
|
}
|
|
108
95
|
onError && onError({
|
|
109
96
|
status: 'errored',
|
|
110
97
|
url: url !== null && url !== void 0 ? url : '',
|
|
111
98
|
err: error
|
|
112
99
|
});
|
|
113
|
-
}, [
|
|
100
|
+
}, [analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes, appearance, fireEvent, id, isFlexibleUi, onError, url]);
|
|
114
101
|
if (!url) {
|
|
115
102
|
throw new Error('@atlaskit/smart-card: url property is missing.');
|
|
116
103
|
}
|
|
@@ -142,7 +129,6 @@ export function CardWithURLRenderer(props) {
|
|
|
142
129
|
ui: ui,
|
|
143
130
|
showHoverPreview: showHoverPreview,
|
|
144
131
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
145
|
-
showAuthTooltip: fg('platform_deprecate-showauthtooltip-smart-card') ? undefined : showAuthTooltip,
|
|
146
132
|
placeholder: placeholder,
|
|
147
133
|
removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
|
|
148
134
|
resolvingPlaceholder: resolvingPlaceholder,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { CardDisplay } from '../../../../constants';
|
|
5
4
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../../../state/analytics';
|
|
6
5
|
import { EmbedModalSize } from '../../types';
|
|
@@ -9,8 +8,7 @@ var getResizeFrom = function getResizeFrom(size) {
|
|
|
9
8
|
};
|
|
10
9
|
var withAnalytics = function withAnalytics(Component) {
|
|
11
10
|
return function (props) {
|
|
12
|
-
var
|
|
13
|
-
fireEvent = props.fireEvent,
|
|
11
|
+
var fireEvent = props.fireEvent,
|
|
14
12
|
extensionKey = props.extensionKey,
|
|
15
13
|
id = props.id,
|
|
16
14
|
onClose = props.onClose,
|
|
@@ -19,108 +17,61 @@ var withAnalytics = function withAnalytics(Component) {
|
|
|
19
17
|
onResize = props.onResize,
|
|
20
18
|
origin = props.origin;
|
|
21
19
|
var handleOnOpen = useCallback(function (context) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
attributes: {
|
|
31
|
-
origin: origin,
|
|
32
|
-
size: context.size
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
37
|
-
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
38
|
-
extensionKey: extensionKey,
|
|
39
|
-
display: CardDisplay.EmbedPreview
|
|
40
|
-
});
|
|
20
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('screen.embedPreviewModal.viewed', {
|
|
21
|
+
origin: origin !== null && origin !== void 0 ? origin : null,
|
|
22
|
+
size: context.size
|
|
23
|
+
});
|
|
24
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
25
|
+
extensionKey: extensionKey,
|
|
26
|
+
display: CardDisplay.EmbedPreview
|
|
27
|
+
});
|
|
41
28
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} else {
|
|
50
|
-
analytics === null || analytics === void 0 || analytics.ui.renderSuccessEvent({
|
|
51
|
-
status: 'resolved',
|
|
52
|
-
display: CardDisplay.EmbedPreview
|
|
53
|
-
});
|
|
54
|
-
}
|
|
29
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
30
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
31
|
+
display: CardDisplay.EmbedPreview
|
|
32
|
+
});
|
|
33
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('ui.smartLink.renderSuccess', {
|
|
34
|
+
display: CardDisplay.EmbedPreview
|
|
35
|
+
});
|
|
55
36
|
if (onOpen) {
|
|
56
37
|
onOpen(context);
|
|
57
38
|
}
|
|
58
|
-
}, [
|
|
39
|
+
}, [fireEvent, extensionKey, id, onOpen, origin]);
|
|
59
40
|
var handleOnOpenFailed = useCallback(function (error, errorInfo) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
} else {
|
|
71
|
-
analytics === null || analytics === void 0 || analytics.ui.renderFailedEvent({
|
|
72
|
-
display: CardDisplay.EmbedPreview,
|
|
73
|
-
error: error,
|
|
74
|
-
errorInfo: errorInfo
|
|
75
|
-
});
|
|
76
|
-
}
|
|
41
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
42
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
43
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
44
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('ui.smartLink.renderFailed', {
|
|
45
|
+
display: CardDisplay.EmbedPreview,
|
|
46
|
+
error: error,
|
|
47
|
+
errorInfo: errorInfo,
|
|
48
|
+
id: id !== null && id !== void 0 ? id : null
|
|
49
|
+
});
|
|
77
50
|
if (onOpenFailed) {
|
|
78
51
|
onOpenFailed(error, errorInfo);
|
|
79
52
|
}
|
|
80
|
-
}, [
|
|
53
|
+
}, [fireEvent, id, onOpenFailed]);
|
|
81
54
|
var handleOnClose = useCallback(function (context) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
analytics === null || analytics === void 0 || analytics.ui.modalClosedEvent({
|
|
91
|
-
actionSubjectId: 'embedPreview',
|
|
92
|
-
attributes: {
|
|
93
|
-
origin: origin,
|
|
94
|
-
previewTime: context.duration,
|
|
95
|
-
size: context.size
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
55
|
+
var _context$duration;
|
|
56
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('ui.modal.closed.embedPreview', {
|
|
57
|
+
origin: origin !== null && origin !== void 0 ? origin : null,
|
|
58
|
+
previewTime: (_context$duration = context.duration) !== null && _context$duration !== void 0 ? _context$duration : null,
|
|
59
|
+
size: context.size
|
|
60
|
+
});
|
|
99
61
|
if (onClose) {
|
|
100
62
|
onClose(context);
|
|
101
63
|
}
|
|
102
|
-
}, [
|
|
64
|
+
}, [fireEvent, onClose, origin]);
|
|
103
65
|
var handleOnResize = useCallback(function (context) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
} else {
|
|
111
|
-
analytics === null || analytics === void 0 || analytics.ui.buttonClickedEvent({
|
|
112
|
-
actionSubjectId: 'embedPreviewResize',
|
|
113
|
-
attributes: {
|
|
114
|
-
newSize: context.size,
|
|
115
|
-
origin: origin,
|
|
116
|
-
previousSize: getResizeFrom(context.size)
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
66
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('ui.button.clicked.embedPreviewResize', {
|
|
67
|
+
newSize: context.size,
|
|
68
|
+
origin: origin !== null && origin !== void 0 ? origin : null,
|
|
69
|
+
previousSize: getResizeFrom(context.size)
|
|
70
|
+
});
|
|
120
71
|
if (onResize) {
|
|
121
72
|
onResize(context);
|
|
122
73
|
}
|
|
123
|
-
}, [
|
|
74
|
+
}, [fireEvent, onResize, origin]);
|
|
124
75
|
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
125
76
|
onClose: handleOnClose,
|
|
126
77
|
onOpen: handleOnOpen,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
3
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
4
|
import ModalDialog, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
5
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
9
|
-
import {
|
|
6
|
+
import { SmartLinkSize } from '../../constants';
|
|
10
7
|
import useInvokeClientAction from '../../state/hooks/use-invoke-client-action';
|
|
11
|
-
import {
|
|
8
|
+
import { getPreviewUrlWithTheme } from '../../utils';
|
|
12
9
|
import Icon from '../FlexibleCard/components/elements/icon';
|
|
13
10
|
import withAnalytics from './components/analytics';
|
|
14
11
|
import EmbedContent from './components/embed-content';
|
|
@@ -24,11 +21,8 @@ var toWidth = function toWidth(size) {
|
|
|
24
21
|
};
|
|
25
22
|
var EmbedModal = function EmbedModal(_ref) {
|
|
26
23
|
var analytics = _ref.analytics,
|
|
27
|
-
download = _ref.download,
|
|
28
24
|
invokeDownloadAction = _ref.invokeDownloadAction,
|
|
29
|
-
extensionKey = _ref.extensionKey,
|
|
30
25
|
fireEvent = _ref.fireEvent,
|
|
31
|
-
icon = _ref.icon,
|
|
32
26
|
iframeName = _ref.iframeName,
|
|
33
27
|
isSupportTheming = _ref.isSupportTheming,
|
|
34
28
|
_ref$isTrusted = _ref.isTrusted,
|
|
@@ -45,7 +39,6 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
45
39
|
_ref$testId = _ref.testId,
|
|
46
40
|
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
47
41
|
title = _ref.title,
|
|
48
|
-
url = _ref.url,
|
|
49
42
|
invokeViewAction = _ref.invokeViewAction;
|
|
50
43
|
var defaultWidth = toWidth(size);
|
|
51
44
|
var _useState = useState(showModal),
|
|
@@ -93,61 +86,11 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
93
86
|
var themeState = useThemeObserver();
|
|
94
87
|
var previewUrl = src;
|
|
95
88
|
var handleOnViewActionClick = useCallback(function () {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} else {
|
|
99
|
-
invoke({
|
|
100
|
-
actionType: 'ViewAction',
|
|
101
|
-
actionFn: function () {
|
|
102
|
-
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
103
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
104
|
-
while (1) switch (_context.prev = _context.next) {
|
|
105
|
-
case 0:
|
|
106
|
-
return _context.abrupt("return", openUrl(url));
|
|
107
|
-
case 1:
|
|
108
|
-
case "end":
|
|
109
|
-
return _context.stop();
|
|
110
|
-
}
|
|
111
|
-
}, _callee);
|
|
112
|
-
}));
|
|
113
|
-
function actionFn() {
|
|
114
|
-
return _actionFn.apply(this, arguments);
|
|
115
|
-
}
|
|
116
|
-
return actionFn;
|
|
117
|
-
}(),
|
|
118
|
-
display: CardDisplay.EmbedPreview,
|
|
119
|
-
extensionKey: extensionKey
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}, [extensionKey, invoke, url, invokeViewAction]);
|
|
89
|
+
invokeViewAction && invoke(invokeViewAction);
|
|
90
|
+
}, [invoke, invokeViewAction]);
|
|
123
91
|
var handleOnDownloadActionClick = useCallback(function () {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} else {
|
|
127
|
-
invoke({
|
|
128
|
-
actionType: ActionName.DownloadAction,
|
|
129
|
-
actionFn: function () {
|
|
130
|
-
var _actionFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
131
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
132
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
133
|
-
case 0:
|
|
134
|
-
return _context2.abrupt("return", downloadUrl(download));
|
|
135
|
-
case 1:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context2.stop();
|
|
138
|
-
}
|
|
139
|
-
}, _callee2);
|
|
140
|
-
}));
|
|
141
|
-
function actionFn() {
|
|
142
|
-
return _actionFn2.apply(this, arguments);
|
|
143
|
-
}
|
|
144
|
-
return actionFn;
|
|
145
|
-
}(),
|
|
146
|
-
display: CardDisplay.EmbedPreview,
|
|
147
|
-
extensionKey: extensionKey
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}, [download, invokeDownloadAction, extensionKey, invoke]);
|
|
92
|
+
invokeDownloadAction && invoke(invokeDownloadAction);
|
|
93
|
+
}, [invokeDownloadAction, invoke]);
|
|
151
94
|
if (previewUrl && isSupportTheming) {
|
|
152
95
|
previewUrl = getPreviewUrlWithTheme(previewUrl, themeState);
|
|
153
96
|
}
|
|
@@ -159,15 +102,15 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
159
102
|
testId: testId,
|
|
160
103
|
width: width
|
|
161
104
|
}, /*#__PURE__*/React.createElement(LinkInfo, {
|
|
162
|
-
icon:
|
|
105
|
+
icon: linkIcon && {
|
|
163
106
|
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
164
107
|
size: SmartLinkSize.Large
|
|
165
108
|
})),
|
|
166
109
|
isFlexibleUi: true
|
|
167
|
-
}
|
|
110
|
+
},
|
|
168
111
|
providerName: providerName,
|
|
169
|
-
onViewButtonClick:
|
|
170
|
-
onDownloadButtonClick:
|
|
112
|
+
onViewButtonClick: invokeViewAction ? handleOnViewActionClick : undefined,
|
|
113
|
+
onDownloadButtonClick: invokeDownloadAction ? handleOnDownloadActionClick : undefined,
|
|
171
114
|
onResizeButtonClick: handleOnResizeClick,
|
|
172
115
|
size: width,
|
|
173
116
|
title: title,
|
|
@@ -10,7 +10,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
10
|
import React, { useCallback, useState } from 'react';
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
12
|
import LinkIcon from '@atlaskit/icon/core/migration/link';
|
|
13
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { ActionName } from '../../../../../constants';
|
|
15
14
|
import { messages } from '../../../../../messages';
|
|
16
15
|
import { useFlexibleUiAnalyticsContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
@@ -31,69 +30,33 @@ var CopyLinkAction = function CopyLinkAction(_ref) {
|
|
|
31
30
|
tooltipMessage = _useState2[0],
|
|
32
31
|
setTooltipMessage = _useState2[1];
|
|
33
32
|
var onClick = useCallback(function () {
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
if (data && data.url) {
|
|
63
|
-
invoke({
|
|
64
|
-
actionType: ActionName.CopyLinkAction,
|
|
65
|
-
actionFn: function () {
|
|
66
|
-
var _actionFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
67
|
-
var _data$url;
|
|
68
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
69
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
70
|
-
case 0:
|
|
71
|
-
_context2.next = 2;
|
|
72
|
-
return navigator.clipboard.writeText((_data$url = data.url) !== null && _data$url !== void 0 ? _data$url : '');
|
|
73
|
-
case 2:
|
|
74
|
-
setTooltipMessage(messages.copied_url_to_clipboard);
|
|
75
|
-
case 3:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context2.stop();
|
|
78
|
-
}
|
|
79
|
-
}, _callee2);
|
|
80
|
-
}));
|
|
81
|
-
function actionFn() {
|
|
82
|
-
return _actionFn2.apply(this, arguments);
|
|
83
|
-
}
|
|
84
|
-
return actionFn;
|
|
85
|
-
}(),
|
|
86
|
-
// These values have already been set in analytics context.
|
|
87
|
-
// We only pass these here for ufo experience.
|
|
88
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
89
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
if (onClickCallback) {
|
|
93
|
-
onClickCallback();
|
|
94
|
-
}
|
|
33
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
34
|
+
invoke(_objectSpread(_objectSpread({}, data.invokeAction), {}, {
|
|
35
|
+
actionFn: function () {
|
|
36
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
37
|
+
var _data$invokeAction;
|
|
38
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
_context.next = 2;
|
|
42
|
+
return (_data$invokeAction = data.invokeAction) === null || _data$invokeAction === void 0 ? void 0 : _data$invokeAction.actionFn();
|
|
43
|
+
case 2:
|
|
44
|
+
setTooltipMessage(messages.copied_url_to_clipboard);
|
|
45
|
+
case 3:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context.stop();
|
|
48
|
+
}
|
|
49
|
+
}, _callee);
|
|
50
|
+
}));
|
|
51
|
+
function actionFn() {
|
|
52
|
+
return _actionFn.apply(this, arguments);
|
|
53
|
+
}
|
|
54
|
+
return actionFn;
|
|
55
|
+
}()
|
|
56
|
+
}));
|
|
57
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
95
58
|
}
|
|
96
|
-
}, [
|
|
59
|
+
}, [data, invoke, onClickCallback]);
|
|
97
60
|
return data ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
98
61
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.copy_url_to_clipboard),
|
|
99
62
|
icon: /*#__PURE__*/React.createElement(LinkIcon, {
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
3
|
var _excluded = ["onClick"];
|
|
5
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
4
|
import React, { useCallback } from 'react';
|
|
7
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
6
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
7
|
import { ActionName } from '../../../../../constants';
|
|
11
8
|
import { messages } from '../../../../../messages';
|
|
12
9
|
import { useFlexibleUiAnalyticsContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
13
10
|
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
14
|
-
import { downloadUrl as download } from '../../../../../utils';
|
|
15
11
|
import Action from '../action';
|
|
16
12
|
var DownloadAction = function DownloadAction(_ref) {
|
|
17
13
|
var _context$actions;
|
|
@@ -24,43 +20,11 @@ var DownloadAction = function DownloadAction(_ref) {
|
|
|
24
20
|
});
|
|
25
21
|
var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.DownloadAction];
|
|
26
22
|
var onClick = useCallback(function () {
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
if (data !== null && data !== void 0 && data.downloadUrl) {
|
|
34
|
-
invoke({
|
|
35
|
-
actionType: ActionName.DownloadAction,
|
|
36
|
-
actionFn: function () {
|
|
37
|
-
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
38
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) switch (_context.prev = _context.next) {
|
|
40
|
-
case 0:
|
|
41
|
-
return _context.abrupt("return", download(data === null || data === void 0 ? void 0 : data.downloadUrl));
|
|
42
|
-
case 1:
|
|
43
|
-
case "end":
|
|
44
|
-
return _context.stop();
|
|
45
|
-
}
|
|
46
|
-
}, _callee);
|
|
47
|
-
}));
|
|
48
|
-
function actionFn() {
|
|
49
|
-
return _actionFn.apply(this, arguments);
|
|
50
|
-
}
|
|
51
|
-
return actionFn;
|
|
52
|
-
}(),
|
|
53
|
-
// These values have already been set in analytics context.
|
|
54
|
-
// We only pass these here for ufo experience.
|
|
55
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
56
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
57
|
-
});
|
|
58
|
-
if (onClickCallback) {
|
|
59
|
-
onClickCallback();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
23
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
24
|
+
invoke(data.invokeAction);
|
|
25
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
62
26
|
}
|
|
63
|
-
}, [
|
|
27
|
+
}, [data, invoke, onClickCallback]);
|
|
64
28
|
var isStackItem = props.as === 'stack-item';
|
|
65
29
|
var label = isStackItem ? messages.download_file : messages.download;
|
|
66
30
|
var tooltipMessage = isStackItem ? messages.download_description : messages.download;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
3
|
var _excluded = ["onClick"];
|
|
6
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
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; }
|
|
8
|
-
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; }
|
|
9
4
|
import React, { useCallback } from 'react';
|
|
10
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
11
6
|
import MediaServicesActualSizeIcon from '@atlaskit/icon/core/migration/grow-diagonal--media-services-actual-size';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
7
|
import { ActionName } from '../../../../../constants';
|
|
14
8
|
import { messages } from '../../../../../messages';
|
|
15
9
|
import { useFlexibleUiAnalyticsContext, useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
16
10
|
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
17
|
-
import { openEmbedModalWithFlexibleUiIcon } from '../../utils';
|
|
18
11
|
import Action from '../action';
|
|
19
12
|
var PreviewAction = function PreviewAction(_ref) {
|
|
20
13
|
var _context$actions;
|
|
@@ -27,47 +20,11 @@ var PreviewAction = function PreviewAction(_ref) {
|
|
|
27
20
|
});
|
|
28
21
|
var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.PreviewAction];
|
|
29
22
|
var onClick = useCallback(function () {
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
if (data) {
|
|
37
|
-
invoke({
|
|
38
|
-
actionType: ActionName.PreviewAction,
|
|
39
|
-
actionFn: function () {
|
|
40
|
-
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
41
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) switch (_context.prev = _context.next) {
|
|
43
|
-
case 0:
|
|
44
|
-
return _context.abrupt("return", openEmbedModalWithFlexibleUiIcon(_objectSpread({
|
|
45
|
-
download: data === null || data === void 0 ? void 0 : data.downloadUrl,
|
|
46
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey,
|
|
47
|
-
analytics: analytics
|
|
48
|
-
}, data)));
|
|
49
|
-
case 1:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context.stop();
|
|
52
|
-
}
|
|
53
|
-
}, _callee);
|
|
54
|
-
}));
|
|
55
|
-
function actionFn() {
|
|
56
|
-
return _actionFn.apply(this, arguments);
|
|
57
|
-
}
|
|
58
|
-
return actionFn;
|
|
59
|
-
}(),
|
|
60
|
-
// These values have already been set in analytics context.
|
|
61
|
-
// We only pass these here for ufo experience.
|
|
62
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
63
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (onClickCallback) {
|
|
67
|
-
onClickCallback();
|
|
68
|
-
}
|
|
23
|
+
if (data !== null && data !== void 0 && data.invokeAction) {
|
|
24
|
+
invoke(data.invokeAction);
|
|
25
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
69
26
|
}
|
|
70
|
-
}, [
|
|
27
|
+
}, [data, invoke, onClickCallback]);
|
|
71
28
|
var isStackItem = props.as === 'stack-item';
|
|
72
29
|
var tooltipMessage = isStackItem ? messages.preview_description : messages.preview_improved;
|
|
73
30
|
return data ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
@@ -9,7 +9,6 @@ import React, { useContext } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { di } from 'react-magnetic-di';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { N40 } from '@atlaskit/theme/colors';
|
|
14
13
|
import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
|
|
15
14
|
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
@@ -176,8 +175,6 @@ var Container = function Container(_ref3) {
|
|
|
176
175
|
hidePadding = _ref3$hidePadding === void 0 ? false : _ref3$hidePadding,
|
|
177
176
|
onClick = _ref3.onClick,
|
|
178
177
|
retry = _ref3.retry,
|
|
179
|
-
_ref3$showAuthTooltip = _ref3.showAuthTooltip,
|
|
180
|
-
showAuthTooltip = _ref3$showAuthTooltip === void 0 ? false : _ref3$showAuthTooltip,
|
|
181
178
|
_ref3$showHoverPrevie = _ref3.showHoverPreview,
|
|
182
179
|
showHoverPreview = _ref3$showHoverPrevie === void 0 ? false : _ref3$showHoverPrevie,
|
|
183
180
|
hoverPreviewOptions = _ref3.hoverPreviewOptions,
|
|
@@ -194,7 +191,7 @@ var Container = function Container(_ref3) {
|
|
|
194
191
|
var canShowHoverPreview = showHoverPreview && status === 'resolved';
|
|
195
192
|
// `retry` object contains action that can be performed on
|
|
196
193
|
// unresolved link (unauthorized, forbidden, not found, etc.)
|
|
197
|
-
var canShowAuthTooltip =
|
|
194
|
+
var canShowAuthTooltip = showHoverPreview && status === 'unauthorized' && retry !== undefined;
|
|
198
195
|
var container = jsx("div", {
|
|
199
196
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
200
197
|
css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions),
|