@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
|
@@ -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
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useEffect, useMemo } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
4
|
import { SmartLinkStatus } from '../../constants';
|
|
6
5
|
import { FlexibleUiAnalyticsContext, FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
|
|
@@ -27,7 +26,6 @@ const FlexibleCard = ({
|
|
|
27
26
|
onResolve,
|
|
28
27
|
origin,
|
|
29
28
|
renderers,
|
|
30
|
-
showAuthTooltip,
|
|
31
29
|
showHoverPreview,
|
|
32
30
|
hoverPreviewOptions,
|
|
33
31
|
actionOptions,
|
|
@@ -109,7 +107,6 @@ const FlexibleCard = ({
|
|
|
109
107
|
showHoverPreview: showHoverPreview,
|
|
110
108
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
111
109
|
actionOptions: actionOptions,
|
|
112
|
-
showAuthTooltip: fg('platform_deprecate-showauthtooltip-smart-card') ? undefined : showAuthTooltip,
|
|
113
110
|
status: status
|
|
114
111
|
}), children))));
|
|
115
112
|
};
|
|
@@ -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,
|
|
@@ -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
|
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import Button from '@atlaskit/button';
|
|
5
5
|
import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { N500, R400 } from '@atlaskit/theme/colors';
|
|
8
7
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
9
8
|
import { messages } from '../../../messages';
|
|
@@ -26,7 +25,6 @@ export const InlineCardUnauthorizedView = ({
|
|
|
26
25
|
onClick,
|
|
27
26
|
isSelected,
|
|
28
27
|
testId = 'inline-card-unauthorized-view',
|
|
29
|
-
showAuthTooltip = false,
|
|
30
28
|
showHoverPreview = false,
|
|
31
29
|
truncateInline,
|
|
32
30
|
context
|
|
@@ -68,7 +66,7 @@ export const InlineCardUnauthorizedView = ({
|
|
|
68
66
|
onClick: onClick,
|
|
69
67
|
titleColor: `var(--ds-text-subtle, ${N500})`
|
|
70
68
|
}), renderActionButton());
|
|
71
|
-
if (onAuthorise &&
|
|
69
|
+
if (onAuthorise && showHoverPreview) {
|
|
72
70
|
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
73
71
|
url: url,
|
|
74
72
|
id: id
|
|
@@ -3,7 +3,6 @@ import React, { useEffect } from 'react';
|
|
|
3
3
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
4
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
5
5
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { SmartLinkStatus } from '../../constants';
|
|
8
7
|
import { extractRequestAccessContextImproved } from '../../extractors/common/context/extractAccessContext';
|
|
9
8
|
import { extractInlineProps } from '../../extractors/inline';
|
|
@@ -32,7 +31,6 @@ export const InlineCard = ({
|
|
|
32
31
|
inlinePreloaderStyle,
|
|
33
32
|
showHoverPreview,
|
|
34
33
|
hoverPreviewOptions,
|
|
35
|
-
showAuthTooltip,
|
|
36
34
|
actionOptions,
|
|
37
35
|
removeTextHighlightingFromTitle,
|
|
38
36
|
resolvingPlaceholder,
|
|
@@ -111,7 +109,6 @@ export const InlineCard = ({
|
|
|
111
109
|
onClick: handleFrameClick,
|
|
112
110
|
onAuthorise: handleAuthorize,
|
|
113
111
|
testId: testIdWithStatus,
|
|
114
|
-
showAuthTooltip: fg('platform_deprecate-showauthtooltip-smart-card') ? undefined : showAuthTooltip,
|
|
115
112
|
showHoverPreview: showHoverPreview,
|
|
116
113
|
id: id,
|
|
117
114
|
analytics: analytics,
|
|
@@ -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.2.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);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["appearance", "fireEvent", "id", "origin", "renderers", "resolve", "actionOptions", "response", "aiSummaryConfig"];
|
|
3
3
|
import { extractAri, extractDateCreated, extractDateUpdated, extractLink, extractPersonCreatedBy, extractPersonOwnedBy, extractTitle } from '@atlaskit/link-extractors';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { extractSummary } from '../common/primitives';
|
|
6
|
-
import
|
|
5
|
+
import { extractFlexibleCardActions } from './actions';
|
|
7
6
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
8
7
|
import extractPreview from './extract-preview';
|
|
9
8
|
import extractPriority from './extract-priority';
|
|
@@ -30,7 +29,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
30
29
|
var data = response.data;
|
|
31
30
|
var url = extractLink(data);
|
|
32
31
|
return {
|
|
33
|
-
actions:
|
|
32
|
+
actions: extractFlexibleCardActions({
|
|
34
33
|
actionOptions: actionOptions,
|
|
35
34
|
aiSummaryConfig: aiSummaryConfig,
|
|
36
35
|
appearance: appearance,
|
|
@@ -39,7 +38,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
39
38
|
origin: origin,
|
|
40
39
|
response: response,
|
|
41
40
|
url: props.url // Use the original URL in edge cases, such as short links for AI summary and copy link actions.
|
|
42
|
-
})
|
|
41
|
+
}),
|
|
43
42
|
assignedToGroup: extractPersonAssignedToAsArray(data),
|
|
44
43
|
attachmentCount: extractAttachmentCount(data),
|
|
45
44
|
authorGroup: extractPersonCreatedBy(data),
|