@atlaskit/smart-card 38.8.0 → 38.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/extractors/common/context/index.js +2 -1
- package/dist/cjs/extractors/embed/index.js +4 -16
- package/dist/cjs/extractors/flexible/extract-link-title.js +2 -4
- package/dist/cjs/extractors/flexible/index.js +12 -14
- package/dist/cjs/extractors/inline/index.js +7 -18
- package/dist/cjs/state/hooks/use-resolve/index.js +1 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/index.js +4 -2
- package/dist/cjs/view/BlockCard/views/ForbiddenView.js +1 -1
- package/dist/cjs/view/BlockCard/views/NotFoundView.js +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +3 -1
- package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +2 -3
- package/dist/cjs/view/CardWithUrl/component.js +15 -10
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +47 -15
- package/dist/cjs/view/FlexibleCard/components/elements/common/base-icon-element/index.js +7 -3
- package/dist/cjs/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-trigger/index.js +5 -3
- package/dist/cjs/view/FlexibleCard/utils.js +5 -8
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -1
- package/dist/cjs/view/HoverCard/components/ImagePreview.js +2 -15
- package/dist/cjs/view/HoverCard/components/views/forbidden/index.js +3 -4
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +2 -3
- package/dist/cjs/view/InlineCard/ErroredView/index.js +3 -3
- package/dist/cjs/view/InlineCard/index.js +3 -5
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/common/context/index.js +2 -1
- package/dist/es2019/extractors/embed/index.js +6 -19
- package/dist/es2019/extractors/flexible/extract-link-title.js +3 -5
- package/dist/es2019/extractors/flexible/index.js +15 -15
- package/dist/es2019/extractors/inline/index.js +8 -22
- package/dist/es2019/state/hooks/use-resolve/index.js +1 -2
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/index.js +4 -2
- package/dist/es2019/view/BlockCard/views/ForbiddenView.js +2 -2
- package/dist/es2019/view/BlockCard/views/NotFoundView.js +2 -2
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +3 -1
- package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +3 -4
- package/dist/es2019/view/CardWithUrl/component.js +16 -11
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +49 -22
- package/dist/es2019/view/FlexibleCard/components/elements/common/base-icon-element/index.js +7 -4
- package/dist/es2019/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-trigger/index.js +5 -3
- package/dist/es2019/view/FlexibleCard/utils.js +7 -8
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +2 -1
- package/dist/es2019/view/HoverCard/components/ImagePreview.js +2 -15
- package/dist/es2019/view/HoverCard/components/views/forbidden/index.js +4 -5
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +3 -4
- package/dist/es2019/view/InlineCard/ErroredView/index.js +4 -4
- package/dist/es2019/view/InlineCard/index.js +5 -7
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/common/context/index.js +2 -1
- package/dist/esm/extractors/embed/index.js +6 -18
- package/dist/esm/extractors/flexible/extract-link-title.js +3 -5
- package/dist/esm/extractors/flexible/index.js +15 -15
- package/dist/esm/extractors/inline/index.js +8 -21
- package/dist/esm/state/hooks/use-resolve/index.js +1 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/index.js +4 -2
- package/dist/esm/view/BlockCard/views/ForbiddenView.js +2 -2
- package/dist/esm/view/BlockCard/views/NotFoundView.js +2 -2
- package/dist/esm/view/BlockCard/views/ResolvedView.js +3 -1
- package/dist/esm/view/BlockCard/views/UnauthorisedView.js +3 -4
- package/dist/esm/view/CardWithUrl/component.js +16 -11
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +4 -2
- package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +46 -14
- package/dist/esm/view/FlexibleCard/components/elements/common/base-icon-element/index.js +7 -3
- package/dist/esm/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-trigger/index.js +5 -3
- package/dist/esm/view/FlexibleCard/utils.js +7 -8
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +2 -1
- package/dist/esm/view/HoverCard/components/ImagePreview.js +2 -15
- package/dist/esm/view/HoverCard/components/views/forbidden/index.js +4 -5
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +3 -4
- package/dist/esm/view/InlineCard/ErroredView/index.js +4 -4
- package/dist/esm/view/InlineCard/index.js +5 -7
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/ssr.d.ts +1 -0
- package/dist/types/view/BlockCard/index.d.ts +1 -1
- package/dist/types/view/BlockCard/types.d.ts +1 -0
- package/dist/types/view/BlockCard/views/types.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +1 -0
- package/dist/types/view/CardWithUrl/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/common/image-icon/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/common/image-icon/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/elements/common/base-icon-element/index.d.ts +5 -1
- package/dist/types/view/FlexibleCard/types.d.ts +4 -0
- package/dist/types-ts4.5/ssr.d.ts +1 -0
- package/dist/types-ts4.5/view/BlockCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/BlockCard/types.d.ts +1 -0
- package/dist/types-ts4.5/view/BlockCard/views/types.d.ts +1 -1
- package/dist/types-ts4.5/view/Card/types.d.ts +1 -0
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/common/image-icon/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/common/image-icon/types.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/common/base-icon-element/index.d.ts +5 -1
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +4 -0
- package/package.json +10 -4
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
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
|
-
import { extractEntityProvider,
|
|
5
|
-
// extractSmartLinkIcon,
|
|
6
|
-
extractSmartLinkTitle, extractSmartLinkUrl, extractTitle, extractType, isEntityPresent } from '@atlaskit/link-extractors';
|
|
4
|
+
import { extractEntityProvider, extractProvider, extractSmartLinkTitle, extractSmartLinkUrl, extractType, isEntityPresent } from '@atlaskit/link-extractors';
|
|
7
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { getEmptyJsonLd } from '../../utils/jsonld';
|
|
8
7
|
import { extractIcon } from '../common/icon';
|
|
9
8
|
import { extractLozenge } from '../common/lozenge';
|
|
10
9
|
import { extractTitleTextColor } from '../common/primitives';
|
|
@@ -37,29 +36,17 @@ var extractSmartLinkInlineIcon = function extractSmartLinkInlineIcon(response) {
|
|
|
37
36
|
// see: https://product-fabric.atlassian.net/browse/EDM-12375
|
|
38
37
|
// return extractSmartLinkIcon(response);
|
|
39
38
|
}
|
|
40
|
-
return extractInlineIcon(response === null || response === void 0 ? void 0 : response.data, showLabel);
|
|
39
|
+
return extractInlineIcon((response === null || response === void 0 ? void 0 : response.data) || getEmptyJsonLd(), showLabel);
|
|
41
40
|
};
|
|
42
41
|
export var extractInlineProps = function extractInlineProps(response, renderers, removeTextHighlightingFromTitle) {
|
|
43
42
|
var showLabel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
44
|
-
var jsonLd = response === null || response === void 0 ? void 0 : response.data;
|
|
45
|
-
if (fg('smart_links_noun_support')) {
|
|
46
|
-
return _objectSpread({
|
|
47
|
-
link: extractSmartLinkUrl(response),
|
|
48
|
-
title: extractSmartLinkTitle(response, removeTextHighlightingFromTitle),
|
|
49
|
-
icon: extractSmartLinkInlineIcon(response, showLabel),
|
|
50
|
-
// As we migrate to support more entities we can incorporate these fields
|
|
51
|
-
lozenge: extractLozenge(jsonLd),
|
|
52
|
-
titleTextColor: extractTitleTextColor(jsonLd),
|
|
53
|
-
titlePrefix: extractTitlePrefix(jsonLd, renderers, 'inline')
|
|
54
|
-
}, fg('platform-linking-visual-refresh-v2') && {
|
|
55
|
-
type: extractType(jsonLd)
|
|
56
|
-
});
|
|
57
|
-
}
|
|
43
|
+
var jsonLd = (response === null || response === void 0 ? void 0 : response.data) || getEmptyJsonLd();
|
|
58
44
|
return _objectSpread({
|
|
59
|
-
link:
|
|
60
|
-
title:
|
|
45
|
+
link: extractSmartLinkUrl(response),
|
|
46
|
+
title: extractSmartLinkTitle(response, removeTextHighlightingFromTitle),
|
|
47
|
+
icon: extractSmartLinkInlineIcon(response, showLabel),
|
|
48
|
+
// As we migrate to support more entities we can incorporate these fields
|
|
61
49
|
lozenge: extractLozenge(jsonLd),
|
|
62
|
-
icon: extractInlineIcon(jsonLd, showLabel),
|
|
63
50
|
titleTextColor: extractTitleTextColor(jsonLd),
|
|
64
51
|
titlePrefix: extractTitlePrefix(jsonLd, renderers, 'inline')
|
|
65
52
|
}, fg('platform-linking-visual-refresh-v2') && {
|
|
@@ -3,7 +3,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { isEntityPresent } from '@atlaskit/link-extractors';
|
|
5
5
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { SmartLinkStatus } from '../../../constants';
|
|
8
7
|
import { addMetadataToExperience } from '../../analytics';
|
|
9
8
|
import useResponse from '../use-response';
|
|
@@ -38,7 +37,7 @@ var useResolve = function useResolve() {
|
|
|
38
37
|
status: SmartLinkStatus.Pending,
|
|
39
38
|
details: undefined
|
|
40
39
|
}, details = _ref2.details;
|
|
41
|
-
hasData =
|
|
40
|
+
hasData = !!(details && details.data || isEntityPresent(details));
|
|
42
41
|
if (!(isReloading || !hasData || isMetadataRequest)) {
|
|
43
42
|
_context.next = 9;
|
|
44
43
|
break;
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "38.
|
|
7
|
+
packageVersion: "38.9.1"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -23,7 +23,8 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
23
23
|
onError = _ref.onError,
|
|
24
24
|
testId = _ref.testId,
|
|
25
25
|
actionOptions = _ref.actionOptions,
|
|
26
|
-
CompetitorPrompt = _ref.CompetitorPrompt
|
|
26
|
+
CompetitorPrompt = _ref.CompetitorPrompt,
|
|
27
|
+
hideIconLoadingSkeleton = _ref.hideIconLoadingSkeleton;
|
|
27
28
|
var status = cardState.status;
|
|
28
29
|
var blockCardProps = {
|
|
29
30
|
id: id,
|
|
@@ -37,7 +38,8 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
37
38
|
onResolve: onResolve,
|
|
38
39
|
renderers: renderers,
|
|
39
40
|
actionOptions: actionOptions,
|
|
40
|
-
CompetitorPrompt: CompetitorPrompt
|
|
41
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
42
|
+
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
41
43
|
};
|
|
42
44
|
var _useControlDataExport = useControlDataExportConfig(),
|
|
43
45
|
_useControlDataExport2 = _useControlDataExport.shouldControlDataExport,
|
|
@@ -11,7 +11,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
11
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
12
|
import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
|
|
13
13
|
import LegacyLockIcon from '@atlaskit/icon/glyph/lock';
|
|
14
|
-
import {
|
|
14
|
+
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
15
15
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
16
|
import { extractRequestAccessContextImproved } from '../../../extractors/common/context/extractAccessContext';
|
|
17
17
|
import extractHostname from '../../../extractors/common/hostname/extractHostname';
|
|
@@ -44,7 +44,7 @@ var ForbiddenView = function ForbiddenView(_ref) {
|
|
|
44
44
|
url = props.url;
|
|
45
45
|
var details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
46
46
|
var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
47
|
-
var provider =
|
|
47
|
+
var provider = extractSmartLinkProvider(details);
|
|
48
48
|
var providerName = (provider === null || provider === void 0 ? void 0 : provider.text) || '';
|
|
49
49
|
var messageContext = useMemo(function () {
|
|
50
50
|
var hostname = /*#__PURE__*/React.createElement("b", null, extractHostname(url));
|
|
@@ -9,7 +9,7 @@ import { useMemo } from 'react';
|
|
|
9
9
|
import { useIntl } from 'react-intl-next';
|
|
10
10
|
import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
|
|
11
11
|
import LegacyLockIcon from '@atlaskit/icon/glyph/lock';
|
|
12
|
-
import {
|
|
12
|
+
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { messages } from '../../../messages';
|
|
15
15
|
import Text from '../../FlexibleCard/components/elements/common/base-text-element';
|
|
@@ -31,7 +31,7 @@ var NotFoundView = function NotFoundView(_ref) {
|
|
|
31
31
|
var details = props.cardState.details;
|
|
32
32
|
var product = useMemo(function () {
|
|
33
33
|
var _provider$text;
|
|
34
|
-
var provider =
|
|
34
|
+
var provider = extractSmartLinkProvider(details);
|
|
35
35
|
return (_provider$text = provider === null || provider === void 0 ? void 0 : provider.text) !== null && _provider$text !== void 0 ? _provider$text : '';
|
|
36
36
|
}, [details]);
|
|
37
37
|
var title = useMemo(function () {
|
|
@@ -33,7 +33,8 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
33
33
|
_ref$testId = _ref.testId,
|
|
34
34
|
testId = _ref$testId === void 0 ? 'smart-block-resolved-view' : _ref$testId,
|
|
35
35
|
url = _ref.url,
|
|
36
|
-
CompetitorPrompt = _ref.CompetitorPrompt
|
|
36
|
+
CompetitorPrompt = _ref.CompetitorPrompt,
|
|
37
|
+
hideIconLoadingSkeleton = _ref.hideIconLoadingSkeleton;
|
|
37
38
|
var _useState = useState(false),
|
|
38
39
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
40
|
isPreviewBlockErrored = _useState2[0],
|
|
@@ -91,6 +92,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
91
92
|
}, {
|
|
92
93
|
CompetitorPrompt: CompetitorPrompt,
|
|
93
94
|
url: url,
|
|
95
|
+
hideIconLoadingSkeleton: hideIconLoadingSkeleton,
|
|
94
96
|
className: ax([fg('platform-linking-visual-refresh-v1') ? "_zulpu2gc _13mh1pd9 _2yhz14q2" : "_zulpcxkx _13mh1pd9"])
|
|
95
97
|
})), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
96
98
|
primary: topMetadata,
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { useCallback, useMemo } from 'react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
10
|
-
import {
|
|
10
|
+
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
13
13
|
import { messages } from '../../../messages';
|
|
@@ -27,14 +27,13 @@ var contentStyles = null;
|
|
|
27
27
|
* @see FlexibleCardProps
|
|
28
28
|
*/
|
|
29
29
|
var UnauthorisedView = function UnauthorisedView(_ref) {
|
|
30
|
-
var
|
|
30
|
+
var _extractSmartLinkProv;
|
|
31
31
|
var _ref$testId = _ref.testId,
|
|
32
32
|
testId = _ref$testId === void 0 ? 'smart-block-unauthorized-view' : _ref$testId,
|
|
33
33
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
34
|
var cardState = props.cardState,
|
|
35
35
|
onAuthorize = props.onAuthorize;
|
|
36
|
-
var
|
|
37
|
-
var providerName = fg('smart_links_noun_support') ? (_extractSmartLinkProv = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
36
|
+
var providerName = (_extractSmartLinkProv = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text;
|
|
38
37
|
var isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
|
|
39
38
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
40
39
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
@@ -7,7 +7,7 @@ import { useSmartLink } from '../../state';
|
|
|
7
7
|
import { succeedUfoExperience } from '../../state/analytics';
|
|
8
8
|
import { getClickUrl, getDefinitionId, getExtensionKey, getObjectAri, getObjectIconUrl, getObjectName, getResourceType, getServices, isFinalState } from '../../state/helpers';
|
|
9
9
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
10
|
-
import { isSpecialEvent } from '../../utils';
|
|
10
|
+
import { isSpecialClick, isSpecialEvent, isSpecialKey } from '../../utils';
|
|
11
11
|
import { combineActionOptions } from '../../utils/actions/combine-action-options';
|
|
12
12
|
import { fireLinkClickedEvent } from '../../utils/analytics/click';
|
|
13
13
|
import { SmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
|
|
@@ -41,7 +41,8 @@ function Component(_ref) {
|
|
|
41
41
|
removeTextHighlightingFromTitle = _ref.removeTextHighlightingFromTitle,
|
|
42
42
|
resolvingPlaceholder = _ref.resolvingPlaceholder,
|
|
43
43
|
truncateInline = _ref.truncateInline,
|
|
44
|
-
CompetitorPrompt = _ref.CompetitorPrompt
|
|
44
|
+
CompetitorPrompt = _ref.CompetitorPrompt,
|
|
45
|
+
hideIconLoadingSkeleton = _ref.hideIconLoadingSkeleton;
|
|
45
46
|
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
46
47
|
createAnalyticsEvent = _useAnalyticsEventsNe.createAnalyticsEvent;
|
|
47
48
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
@@ -71,12 +72,7 @@ function Component(_ref) {
|
|
|
71
72
|
|
|
72
73
|
// Setup UI handlers.
|
|
73
74
|
var handleClickWrapper = useCallback(function (event) {
|
|
74
|
-
var isModifierKeyPressed =
|
|
75
|
-
// Ctrl+left click on mac typically doesn't trigger onClick
|
|
76
|
-
// The event could have potentially had `e.preventDefault()` called on it by now
|
|
77
|
-
// event by smart card internally
|
|
78
|
-
// If it has been called then only then can `isModifierKeyPressed` be true.
|
|
79
|
-
var target = isModifierKeyPressed ? '_blank' : '_self';
|
|
75
|
+
var isModifierKeyPressed = isSpecialKey(event) || isSpecialClick(event);
|
|
80
76
|
fireEvent('ui.smartLink.clicked', {
|
|
81
77
|
id: id,
|
|
82
78
|
display: isFlexibleUi ? CardDisplay.Flexible : appearance,
|
|
@@ -88,9 +84,11 @@ function Component(_ref) {
|
|
|
88
84
|
// delegate the click to the glance panel handler
|
|
89
85
|
if (
|
|
90
86
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
91
|
-
fg('fun-1765_wire_up_glance_panel_to_smart_cards') &&
|
|
87
|
+
fg('fun-1765_wire_up_glance_panel_to_smart_cards') && !isModifierKeyPressed && ari && openGlancePanel && isGlancePanelAvailable !== null && isGlancePanelAvailable !== void 0 && isGlancePanelAvailable({
|
|
92
88
|
ari: ari
|
|
93
|
-
})
|
|
89
|
+
})) {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
event.stopPropagation();
|
|
94
92
|
openGlancePanel({
|
|
95
93
|
url: url,
|
|
96
94
|
ari: ari,
|
|
@@ -104,6 +102,12 @@ function Component(_ref) {
|
|
|
104
102
|
});
|
|
105
103
|
} else if (!onClick && !isFlexibleUi) {
|
|
106
104
|
var clickUrl = getClickUrl(url, state.details);
|
|
105
|
+
|
|
106
|
+
// Ctrl+left click on mac typically doesn't trigger onClick
|
|
107
|
+
// The event could have potentially had `e.preventDefault()` called on it by now
|
|
108
|
+
// event by smart card internally
|
|
109
|
+
// If it has been called then only then can `isSpecialEvent` be true.
|
|
110
|
+
var target = isSpecialEvent(event) ? '_blank' : '_self';
|
|
107
111
|
window.open(clickUrl, target);
|
|
108
112
|
fireLinkClickedEvent(createAnalyticsEvent)(event, {
|
|
109
113
|
attributes: {
|
|
@@ -259,7 +263,8 @@ function Component(_ref) {
|
|
|
259
263
|
onError: onError,
|
|
260
264
|
testId: testId,
|
|
261
265
|
actionOptions: actionOptions,
|
|
262
|
-
CompetitorPrompt: CompetitorPrompt
|
|
266
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
267
|
+
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
263
268
|
});
|
|
264
269
|
case 'embed':
|
|
265
270
|
return /*#__PURE__*/React.createElement(EmbedCard, {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "./index.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import ErrorIcon from '@atlaskit/icon/
|
|
5
|
+
import ErrorIcon from '@atlaskit/icon/core/migration/error';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
8
8
|
import MotionWrapper from '../../../common/motion-wrapper';
|
|
@@ -22,7 +22,8 @@ var getIcon = function getIcon(appearance) {
|
|
|
22
22
|
label: "Error",
|
|
23
23
|
LEGACY_size: "small",
|
|
24
24
|
testId: "action-error-icon",
|
|
25
|
-
LEGACY_margin: "0 ".concat("var(--ds-space-negative-025, -2px)")
|
|
25
|
+
LEGACY_margin: "0 ".concat("var(--ds-space-negative-025, -2px)"),
|
|
26
|
+
size: "small"
|
|
26
27
|
});
|
|
27
28
|
default:
|
|
28
29
|
return null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "status", "showActionOnHover", "testId", "text", "icon", "theme", "hideRetry", "metadataPosition", "hideIcon", "className", "anchorRef", "CompetitorPrompt", "url"];
|
|
5
|
+
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "status", "showActionOnHover", "testId", "text", "icon", "theme", "hideRetry", "metadataPosition", "hideIcon", "className", "anchorRef", "CompetitorPrompt", "url", "hideIconLoadingSkeleton"];
|
|
6
6
|
import "./index.compiled.css";
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -71,6 +71,7 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
71
71
|
anchorRef = _ref.anchorRef,
|
|
72
72
|
CompetitorPrompt = _ref.CompetitorPrompt,
|
|
73
73
|
url = _ref.url,
|
|
74
|
+
hideIconLoadingSkeleton = _ref.hideIconLoadingSkeleton,
|
|
74
75
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
75
76
|
var cardContext = fg('platform-linking-flexible-card-context') ?
|
|
76
77
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -130,6 +131,7 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
130
131
|
hideRetry: hideRetry
|
|
131
132
|
} : undefined, {
|
|
132
133
|
icon: icon,
|
|
134
|
+
hideIconLoadingSkeleton: hideIconLoadingSkeleton,
|
|
133
135
|
size: fg('platform-linking-flexible-card-context') ? (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : ui === null || ui === void 0 ? void 0 : ui.size : props === null || props === void 0 ? void 0 : props.size
|
|
134
136
|
}, fg('platform-linking-flexible-card-context') ? undefined : {
|
|
135
137
|
theme: theme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "text", "icon", "title", "metadataPosition", "hideIcon", "CompetitorPrompt", "url"];
|
|
4
|
+
var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "text", "icon", "title", "metadataPosition", "hideIcon", "CompetitorPrompt", "url", "hideIconLoadingSkeleton"];
|
|
5
5
|
import "./index.compiled.css";
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -37,6 +37,7 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
|
37
37
|
hideIcon = _ref.hideIcon,
|
|
38
38
|
CompetitorPrompt = _ref.CompetitorPrompt,
|
|
39
39
|
url = _ref.url,
|
|
40
|
+
hideIconLoadingSkeleton = _ref.hideIconLoadingSkeleton,
|
|
40
41
|
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
41
42
|
var size = blockProps.size;
|
|
42
43
|
var metadataElements = renderElementItems(metadata);
|
|
@@ -46,7 +47,8 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
|
46
47
|
}), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, {
|
|
47
48
|
overrideIcon: icon,
|
|
48
49
|
position: position,
|
|
49
|
-
size: size
|
|
50
|
+
size: size,
|
|
51
|
+
hideLoadingSkeleton: hideIconLoadingSkeleton
|
|
50
52
|
}), /*#__PURE__*/React.createElement(ElementGroup, {
|
|
51
53
|
direction: SmartLinkDirection.Vertical,
|
|
52
54
|
width: SmartLinkWidth.Flexible,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import "./index.compiled.css";
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
5
7
|
import ImageLoader from 'react-render-image';
|
|
6
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
import { LoadingSkeleton } from '../loading-skeleton';
|
|
@@ -17,15 +19,23 @@ var ImageIcon = function ImageIcon(_ref) {
|
|
|
17
19
|
_ref$appearance = _ref.appearance,
|
|
18
20
|
appearance = _ref$appearance === void 0 ? 'square' : _ref$appearance,
|
|
19
21
|
onError = _ref.onError,
|
|
20
|
-
onLoad = _ref.onLoad
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
onLoad = _ref.onLoad,
|
|
23
|
+
_ref$hideLoadingSkele = _ref.hideLoadingSkeleton,
|
|
24
|
+
hideLoadingSkeleton = _ref$hideLoadingSkele === void 0 ? false : _ref$hideLoadingSkele;
|
|
25
|
+
var _useState = useState(false),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
hasImageErrored = _useState2[0],
|
|
28
|
+
setHasImageErrored = _useState2[1];
|
|
29
|
+
|
|
30
|
+
// If url changes, reset state
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
setHasImageErrored(false);
|
|
33
|
+
}, [url]);
|
|
34
|
+
if (hasImageErrored) {
|
|
35
|
+
return defaultIcon;
|
|
36
|
+
}
|
|
37
|
+
if (hideLoadingSkeleton && fg('platform_fix_block_card_img_icon_vc')) {
|
|
38
|
+
return /*#__PURE__*/React.createElement("img", {
|
|
29
39
|
src: url,
|
|
30
40
|
"data-testid": "".concat(testId, "-image"),
|
|
31
41
|
alt: "",
|
|
@@ -33,11 +43,33 @@ var ImageIcon = function ImageIcon(_ref) {
|
|
|
33
43
|
width: width,
|
|
34
44
|
height: height
|
|
35
45
|
},
|
|
46
|
+
onError: function onError() {
|
|
47
|
+
return setHasImageErrored(true);
|
|
48
|
+
},
|
|
36
49
|
className: ax([appearance === 'round' && fg('platform-linking-visual-refresh-v2') && styles.roundImg])
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
return /*#__PURE__*/React.createElement(ImageLoader, {
|
|
53
|
+
src: url,
|
|
54
|
+
loading: /*#__PURE__*/React.createElement(LoadingSkeleton, {
|
|
55
|
+
testId: "".concat(testId, "-loading"),
|
|
56
|
+
width: width,
|
|
57
|
+
height: height
|
|
58
|
+
}),
|
|
59
|
+
loaded: /*#__PURE__*/React.createElement("img", {
|
|
60
|
+
src: url,
|
|
61
|
+
"data-testid": "".concat(testId, "-image"),
|
|
62
|
+
alt: "",
|
|
63
|
+
style: {
|
|
64
|
+
width: width,
|
|
65
|
+
height: height
|
|
66
|
+
},
|
|
67
|
+
className: ax([appearance === 'round' && fg('platform-linking-visual-refresh-v2') && styles.roundImg])
|
|
68
|
+
}),
|
|
69
|
+
errored: defaultIcon,
|
|
70
|
+
onError: onError,
|
|
71
|
+
onLoad: onLoad
|
|
72
|
+
});
|
|
73
|
+
}
|
|
42
74
|
};
|
|
43
75
|
export default ImageIcon;
|
|
@@ -57,6 +57,7 @@ var renderDefaultIcon = function renderDefaultIcon(label, testId) {
|
|
|
57
57
|
var renderImageIcon = function renderImageIcon(defaultIcon, url, testId) {
|
|
58
58
|
var size = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : SmartLinkSize.Medium;
|
|
59
59
|
var appearance = arguments.length > 4 ? arguments[4] : undefined;
|
|
60
|
+
var hideLoadingSkeleton = arguments.length > 5 ? arguments[5] : undefined;
|
|
60
61
|
var width = size === SmartLinkSize.Large ? "var(--ds-space-300, 24px)" : "var(--ds-space-200, 16px)";
|
|
61
62
|
if (url) {
|
|
62
63
|
return /*#__PURE__*/React.createElement(ImageIcon, _extends({
|
|
@@ -67,6 +68,8 @@ var renderImageIcon = function renderImageIcon(defaultIcon, url, testId) {
|
|
|
67
68
|
height: width
|
|
68
69
|
}, fg('platform-linking-visual-refresh-v2') && {
|
|
69
70
|
appearance: appearance
|
|
71
|
+
}, {
|
|
72
|
+
hideLoadingSkeleton: hideLoadingSkeleton
|
|
70
73
|
}));
|
|
71
74
|
}
|
|
72
75
|
};
|
|
@@ -93,11 +96,12 @@ var IconElement = function IconElement(_ref) {
|
|
|
93
96
|
testId = _ref$testId === void 0 ? 'smart-element-icon' : _ref$testId,
|
|
94
97
|
url = _ref.url,
|
|
95
98
|
_ref$appearance = _ref.appearance,
|
|
96
|
-
appearance = _ref$appearance === void 0 ? 'square' : _ref$appearance
|
|
99
|
+
appearance = _ref$appearance === void 0 ? 'square' : _ref$appearance,
|
|
100
|
+
hideLoadingSkeleton = _ref.hideLoadingSkeleton;
|
|
97
101
|
var element = useMemo(function () {
|
|
98
102
|
var defaultIcon = renderDefaultIcon(label, testId);
|
|
99
|
-
return overrideIcon || (render === null || render === void 0 ? void 0 : render()) || renderImageIcon(defaultIcon, url, testId, size, fg('platform-linking-visual-refresh-v2') ? appearance : undefined) || renderAtlaskitIcon(icon, testId, size) || defaultIcon;
|
|
100
|
-
}, [label, testId, overrideIcon, render, url, size, appearance, icon]);
|
|
103
|
+
return overrideIcon || (render === null || render === void 0 ? void 0 : render()) || renderImageIcon(defaultIcon, url, testId, size, fg('platform-linking-visual-refresh-v2') ? appearance : undefined, hideLoadingSkeleton) || renderAtlaskitIcon(icon, testId, size) || defaultIcon;
|
|
104
|
+
}, [label, testId, overrideIcon, render, url, size, appearance, hideLoadingSkeleton, icon]);
|
|
101
105
|
var width = getIconWidth(size);
|
|
102
106
|
return /*#__PURE__*/React.createElement("div", _extends({}, fg('platform-linking-visual-refresh-v1') ? {} : _defineProperty({}, 'data-fit-to-content', true), {
|
|
103
107
|
"data-smart-element": name,
|
|
@@ -11,7 +11,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
11
11
|
|
|
12
12
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
13
13
|
import { cx } from '@compiled/react';
|
|
14
|
-
import ChevronDownIcon from '@atlaskit/icon/
|
|
14
|
+
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
15
15
|
import { withFeatureFlaggedComponent } from '@atlaskit/linking-common';
|
|
16
16
|
import Lozenge from '@atlaskit/lozenge';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -53,7 +53,8 @@ var LozengeActionTriggerOld = function LozengeActionTriggerOld(_ref) {
|
|
|
53
53
|
color: "currentColor",
|
|
54
54
|
label: "options",
|
|
55
55
|
LEGACY_size: "medium",
|
|
56
|
-
LEGACY_margin: "-4px -8px -4px -7px"
|
|
56
|
+
LEGACY_margin: "-4px -8px -4px -7px",
|
|
57
|
+
size: "small"
|
|
57
58
|
}))));
|
|
58
59
|
}, [appearance, isBold, text]);
|
|
59
60
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
@@ -143,7 +144,8 @@ var LozengeActionTrigger = function LozengeActionTrigger(_ref2) {
|
|
|
143
144
|
color: "currentColor",
|
|
144
145
|
label: "options",
|
|
145
146
|
LEGACY_size: "medium",
|
|
146
|
-
LEGACY_margin: "-4px -8px -4px -7px"
|
|
147
|
+
LEGACY_margin: "-4px -8px -4px -7px",
|
|
148
|
+
size: "small"
|
|
147
149
|
})))));
|
|
148
150
|
}, [appearance, isHovering, isPressing, text, isOpen, lozengeBackgroundColor, lozengeForegroundColor]);
|
|
149
151
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { InternalActionName, SmartLinkStatus } from '../../constants';
|
|
5
5
|
import { extractRequestAccessContextImproved } from '../../extractors/common/context';
|
|
6
6
|
import extractFlexibleUiContext from '../../extractors/flexible';
|
|
7
7
|
import extractLinkTitle from '../../extractors/flexible/extract-link-title';
|
|
8
|
-
import
|
|
8
|
+
import { extractSmartLinkPreviewImage } from '../../extractors/flexible/extract-preview';
|
|
9
9
|
import { extractErrorIcon } from '../../extractors/flexible/icon';
|
|
10
|
-
import
|
|
10
|
+
import { extractSmartLinkProviderIcon } from '../../extractors/flexible/icon/extract-provider-icon';
|
|
11
11
|
import { messages } from '../../messages';
|
|
12
12
|
import { handleOnClick } from '../../utils';
|
|
13
|
-
import {
|
|
13
|
+
import { getForbiddenJsonLd } from '../../utils/jsonld';
|
|
14
14
|
export var getContextByStatus = function getContextByStatus(params) {
|
|
15
15
|
var _ref = params !== null && params !== void 0 ? params : {},
|
|
16
16
|
onClick = _ref.onClick,
|
|
@@ -40,8 +40,8 @@ export var getContextByStatus = function getContextByStatus(params) {
|
|
|
40
40
|
title: fg('platform-linking-flexible-card-context') ? undefined : url,
|
|
41
41
|
linkIcon: extractErrorIcon(response, status),
|
|
42
42
|
linkTitle: fg('platform-linking-flexible-card-context') ? extractLinkTitle(status, url, response, onClick) : undefined,
|
|
43
|
-
preview:
|
|
44
|
-
provider:
|
|
43
|
+
preview: extractSmartLinkPreviewImage(response),
|
|
44
|
+
provider: extractSmartLinkProviderIcon(response),
|
|
45
45
|
actions: fg('platform-linking-flexible-card-unresolved-action') ? _defineProperty({}, InternalActionName.UnresolvedAction, getRetryOptions(url, status, response, params.onAuthorize)) : undefined
|
|
46
46
|
};
|
|
47
47
|
}
|
|
@@ -66,8 +66,7 @@ var getForbiddenMessageKey = function getForbiddenMessageKey(meta) {
|
|
|
66
66
|
};
|
|
67
67
|
export var getRetryOptions = function getRetryOptions(url, status, response, onAuthorize) {
|
|
68
68
|
var _response$meta, _access$action, _access$buttonDisable;
|
|
69
|
-
var
|
|
70
|
-
var provider = fg('smart_links_noun_support') ? extractSmartLinkProvider(response) : extractProvider(data);
|
|
69
|
+
var provider = extractSmartLinkProvider(response);
|
|
71
70
|
var context = provider === null || provider === void 0 ? void 0 : provider.text;
|
|
72
71
|
var values = context ? {
|
|
73
72
|
context: context
|
|
@@ -232,6 +232,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
232
232
|
label: label
|
|
233
233
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
234
234
|
,
|
|
235
|
-
popupComponent: CustomPopupContainer
|
|
235
|
+
popupComponent: CustomPopupContainer,
|
|
236
|
+
shouldRenderToParent: fg('should-render-to-parent-should-be-true-linking-pla')
|
|
236
237
|
});
|
|
237
238
|
};
|
|
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
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; }
|
|
5
5
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import
|
|
7
|
+
import { extractSmartLinkPreviewImage } from '../../../extractors/flexible/extract-preview';
|
|
8
8
|
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
9
9
|
var ImagePreview = function ImagePreview(_ref) {
|
|
10
10
|
var fallbackElementHeight = _ref.fallbackElementHeight,
|
|
@@ -19,7 +19,6 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
19
19
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
20
|
dynamicStyles = _useState4[0],
|
|
21
21
|
setDynamicStyles = _useState4[1];
|
|
22
|
-
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
23
22
|
|
|
24
23
|
// Set Preview to a fixed height to enable transitions
|
|
25
24
|
var onPreviewRender = useCallback(function () {
|
|
@@ -49,19 +48,7 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
49
48
|
var onPreviewTransitionEnd = useCallback(function () {
|
|
50
49
|
setShowPreview(false);
|
|
51
50
|
}, []);
|
|
52
|
-
|
|
53
|
-
return showPreview && extractSmartLinkPreviewImage(response) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
54
|
-
onError: onPreviewError,
|
|
55
|
-
ignoreContainerPadding: true,
|
|
56
|
-
onTransitionEnd: onPreviewTransitionEnd,
|
|
57
|
-
blockRef: previewBlockRef,
|
|
58
|
-
onRender: onPreviewRender
|
|
59
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
60
|
-
,
|
|
61
|
-
style: dynamicStyles
|
|
62
|
-
}) : null;
|
|
63
|
-
}
|
|
64
|
-
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
51
|
+
return showPreview && extractSmartLinkPreviewImage(response) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
65
52
|
onError: onPreviewError,
|
|
66
53
|
ignoreContainerPadding: true,
|
|
67
54
|
onTransitionEnd: onPreviewTransitionEnd,
|
|
@@ -7,7 +7,7 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
7
7
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
8
8
|
import ButtonOld from '@atlaskit/button';
|
|
9
9
|
import Button from '@atlaskit/button/new';
|
|
10
|
-
import {
|
|
10
|
+
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
13
13
|
import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
|
|
@@ -24,7 +24,7 @@ var connectButtonStyles = null;
|
|
|
24
24
|
var basePreviewStylesOld = null;
|
|
25
25
|
var basePreviewStyles = null;
|
|
26
26
|
var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
|
|
27
|
-
var _cardState$details,
|
|
27
|
+
var _cardState$details, _extractSmartLinkProv, _extractSmartLinkProv2, _extractRequestAccess;
|
|
28
28
|
var flexibleCardProps = _ref.flexibleCardProps,
|
|
29
29
|
_ref$testId = _ref.testId,
|
|
30
30
|
testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
|
|
@@ -32,9 +32,8 @@ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
|
|
|
32
32
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
33
33
|
var cardState = flexibleCardProps.cardState,
|
|
34
34
|
url = flexibleCardProps.url;
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var product = fg('smart_links_noun_support') ? (_extractSmartLinkProv = (_extractSmartLinkProv2 = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv2 === void 0 ? void 0 : _extractSmartLinkProv2.text) !== null && _extractSmartLinkProv !== void 0 ? _extractSmartLinkProv : '' : (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
|
|
35
|
+
var meta = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.meta;
|
|
36
|
+
var product = (_extractSmartLinkProv = (_extractSmartLinkProv2 = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv2 === void 0 ? void 0 : _extractSmartLinkProv2.text) !== null && _extractSmartLinkProv !== void 0 ? _extractSmartLinkProv : '';
|
|
38
37
|
var hostname = /*#__PURE__*/React.createElement("b", null, extractHostname(url));
|
|
39
38
|
var _ref2 = (_extractRequestAccess = extractRequestAccessContextImproved({
|
|
40
39
|
jsonLd: meta,
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
|
-
import {
|
|
8
|
+
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
11
11
|
import { ActionName, CardDisplay } from '../../../../../constants';
|
|
@@ -24,7 +24,7 @@ var titleBlockStyles = null;
|
|
|
24
24
|
var mainTextStylesOld = null;
|
|
25
25
|
var mainTextStyles = null;
|
|
26
26
|
var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
27
|
-
var
|
|
27
|
+
var _extractSmartLinkProv;
|
|
28
28
|
var _ref$id = _ref.id,
|
|
29
29
|
id = _ref$id === void 0 ? '' : _ref$id,
|
|
30
30
|
flexibleCardProps = _ref.flexibleCardProps,
|
|
@@ -32,8 +32,7 @@ var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
|
|
|
32
32
|
testId = _ref$testId === void 0 ? 'hover-card-unauthorised-view' : _ref$testId,
|
|
33
33
|
url = _ref.url;
|
|
34
34
|
var cardState = flexibleCardProps.cardState;
|
|
35
|
-
var
|
|
36
|
-
var providerName = fg('smart_links_noun_support') ? (_extractSmartLinkProv = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
35
|
+
var providerName = (_extractSmartLinkProv = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text;
|
|
37
36
|
var isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
|
|
38
37
|
var _useSmartCardActions = useSmartCardActions(id, url),
|
|
39
38
|
authorize = _useSmartCardActions.authorize;
|