@atlaskit/smart-card 26.28.2 → 26.30.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +405 -389
  2. package/dist/cjs/extractors/common/context/extractAccessContext.js +2 -1
  3. package/dist/cjs/extractors/flexible/extract-preview.js +3 -0
  4. package/dist/cjs/messages.js +11 -15
  5. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +4 -5
  6. package/dist/cjs/utils/analytics/LinkAnalyticsContext.js +1 -3
  7. package/dist/cjs/utils/analytics/analytics.js +1 -1
  8. package/dist/cjs/utils/mocks.js +4 -3
  9. package/dist/cjs/view/BlockCard/views/ResolvedView.js +1 -2
  10. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -2
  11. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +1 -2
  12. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
  13. package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +6 -6
  14. package/dist/cjs/view/FlexibleCard/utils.js +4 -1
  15. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +1 -1
  16. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +9 -0
  17. package/dist/cjs/view/HoverCard/components/views/forbidden/index.js +82 -0
  18. package/dist/cjs/view/HoverCard/components/views/forbidden/styled.js +18 -0
  19. package/dist/cjs/view/HoverCard/components/views/forbidden/types.js +5 -0
  20. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +0 -3
  21. package/dist/cjs/view/HoverCard/styled.js +2 -2
  22. package/dist/cjs/view/LinkUrl/index.js +1 -1
  23. package/dist/es2019/extractors/common/context/extractAccessContext.js +2 -1
  24. package/dist/es2019/extractors/flexible/extract-preview.js +3 -0
  25. package/dist/es2019/messages.js +11 -15
  26. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +1 -2
  27. package/dist/es2019/utils/analytics/LinkAnalyticsContext.js +0 -1
  28. package/dist/es2019/utils/analytics/analytics.js +1 -1
  29. package/dist/es2019/utils/mocks.js +3 -0
  30. package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -2
  31. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +0 -1
  32. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +1 -2
  33. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
  34. package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +6 -6
  35. package/dist/es2019/view/FlexibleCard/utils.js +4 -1
  36. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -1
  37. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +9 -0
  38. package/dist/es2019/view/HoverCard/components/views/forbidden/index.js +72 -0
  39. package/dist/es2019/view/HoverCard/components/views/forbidden/styled.js +17 -0
  40. package/dist/es2019/view/HoverCard/components/views/forbidden/types.js +1 -0
  41. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +0 -2
  42. package/dist/es2019/view/HoverCard/styled.js +3 -2
  43. package/dist/es2019/view/LinkUrl/index.js +1 -1
  44. package/dist/esm/extractors/common/context/extractAccessContext.js +2 -1
  45. package/dist/esm/extractors/flexible/extract-preview.js +3 -0
  46. package/dist/esm/messages.js +11 -15
  47. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +4 -5
  48. package/dist/esm/utils/analytics/LinkAnalyticsContext.js +1 -3
  49. package/dist/esm/utils/analytics/analytics.js +1 -1
  50. package/dist/esm/utils/mocks.js +4 -3
  51. package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -2
  52. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -2
  53. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +1 -2
  54. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
  55. package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +6 -6
  56. package/dist/esm/view/FlexibleCard/utils.js +4 -1
  57. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -1
  58. package/dist/esm/view/HoverCard/components/HoverCardContent.js +9 -0
  59. package/dist/esm/view/HoverCard/components/views/forbidden/index.js +71 -0
  60. package/dist/esm/view/HoverCard/components/views/forbidden/styled.js +8 -0
  61. package/dist/esm/view/HoverCard/components/views/forbidden/types.js +1 -0
  62. package/dist/esm/view/HoverCard/components/views/resolved/index.js +0 -3
  63. package/dist/esm/view/HoverCard/styled.js +2 -2
  64. package/dist/esm/view/LinkUrl/index.js +1 -1
  65. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +3 -5
  66. package/dist/types/state/hooks/useSmartLink.d.ts +2 -4
  67. package/dist/types/utils/analytics/LinkAnalyticsContext.d.ts +1 -1
  68. package/dist/types/utils/mocks.d.ts +2 -4
  69. package/dist/types/view/BlockCard/views/ResolvedView.d.ts +1 -1
  70. package/dist/types/view/HoverCard/components/views/forbidden/index.d.ts +4 -0
  71. package/dist/types/view/HoverCard/components/views/forbidden/styled.d.ts +3 -0
  72. package/dist/types/view/HoverCard/components/views/forbidden/types.d.ts +13 -0
  73. package/dist/types/view/HoverCard/styled.d.ts +1 -1
  74. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +3 -5
  75. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +2 -4
  76. package/dist/types-ts4.5/utils/analytics/LinkAnalyticsContext.d.ts +1 -1
  77. package/dist/types-ts4.5/utils/mocks.d.ts +2 -4
  78. package/dist/types-ts4.5/view/BlockCard/views/ResolvedView.d.ts +1 -1
  79. package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/index.d.ts +4 -0
  80. package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/styled.d.ts +3 -0
  81. package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/types.d.ts +13 -0
  82. package/dist/types-ts4.5/view/HoverCard/styled.d.ts +1 -1
  83. package/package.json +7 -3
  84. package/report.api.md +1 -6
  85. package/tmp/api-report-tmp.d.ts +2 -4
@@ -6,7 +6,7 @@ import { SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
6
6
  import AtlaskitIcon from '../../common/atlaskit-icon';
7
7
  import ImageIcon from '../../common/image-icon';
8
8
  import { getIconSizeStyles, getIconWidth, getTruncateStyles } from '../../utils';
9
- const getPositionStyles = (size, position) => {
9
+ const getPositionStyles = position => {
10
10
  switch (position) {
11
11
  case SmartLinkPosition.Center:
12
12
  return css`
@@ -20,8 +20,8 @@ const getPositionStyles = (size, position) => {
20
20
  `;
21
21
  }
22
22
  };
23
- const getIconStyles = (size, position, width) => css`
24
- ${getPositionStyles(size, position)}
23
+ const getIconStyles = (position, width) => css`
24
+ ${getPositionStyles(position)}
25
25
  ${getIconSizeStyles(width)}
26
26
  `;
27
27
  const getCustomRenderStyles = value => css`
@@ -50,7 +50,7 @@ const renderDefaultIcon = (label, testId) => jsx(LinkIcon, {
50
50
  label: label,
51
51
  testId: `${testId}-default`
52
52
  });
53
- const renderImageIcon = (defaultIcon, icon, url, testId) => {
53
+ const renderImageIcon = (defaultIcon, url, testId) => {
54
54
  if (url) {
55
55
  return jsx(ImageIcon, {
56
56
  defaultIcon: defaultIcon,
@@ -79,10 +79,10 @@ const Icon = ({
79
79
  }) => {
80
80
  const element = useMemo(() => {
81
81
  const defaultIcon = renderDefaultIcon(label, testId);
82
- return (render === null || render === void 0 ? void 0 : render()) || renderImageIcon(defaultIcon, icon, url, testId) || renderAtlaskitIcon(icon, label, testId) || defaultIcon;
82
+ return (render === null || render === void 0 ? void 0 : render()) || renderImageIcon(defaultIcon, url, testId) || renderAtlaskitIcon(icon, label, testId) || defaultIcon;
83
83
  }, [icon, label, render, testId, url]);
84
84
  const width = getIconWidth(size);
85
- const styles = getIconStyles(size, position, width);
85
+ const styles = getIconStyles(position, width);
86
86
  const renderStyles = render ? getCustomRenderStyles(width) : undefined;
87
87
  return jsx("div", {
88
88
  css: [styles, renderStyles, overrideCss],
@@ -7,6 +7,7 @@ import { extractErrorIcon } from '../../extractors/flexible/icon';
7
7
  import { handleOnClick } from '../../utils';
8
8
  import { extractProvider } from '@atlaskit/link-extractors';
9
9
  import extractProviderIcon from '../../extractors/flexible/icon/extract-provider-icon';
10
+ import extractPreview from '../../extractors/flexible/extract-preview';
10
11
  export const getContextByStatus = params => {
11
12
  const {
12
13
  response,
@@ -28,13 +29,15 @@ export const getContextByStatus = params => {
28
29
  case SmartLinkStatus.Errored:
29
30
  case SmartLinkStatus.Fallback:
30
31
  default:
32
+ const preview = extractPreview(response === null || response === void 0 ? void 0 : response.data);
31
33
  const linkIcon = extractErrorIcon(response, status);
32
34
  const provider = extractProviderIcon(response === null || response === void 0 ? void 0 : response.data);
33
35
  return {
34
36
  linkIcon,
35
37
  title: url,
36
38
  url,
37
- provider
39
+ provider,
40
+ preview
38
41
  };
39
42
  }
40
43
  };
@@ -192,7 +192,7 @@ export const HoverCardComponent = ({
192
192
  id: id,
193
193
  source: HOVER_CARD_SOURCE
194
194
  }, jsx(HoverCardContent, hoverCardContentProps));
195
- }, [initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
195
+ }, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
196
196
  const trigger = useCallback(triggerProps => jsx("span", {
197
197
  ref: parentSpan
198
198
  }, jsx("span", _extends({}, triggerProps, {
@@ -17,6 +17,8 @@ import { FormattedMessage } from 'react-intl-next';
17
17
  import { messages } from '../../../messages';
18
18
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
19
19
  import { useSmartCardState } from '../../../state/store';
20
+ import HoverCardForbiddenView from './views/forbidden';
21
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
20
22
  export const hoverCardClassName = 'smart-links-hover-preview';
21
23
  export const getCopyAction = url => ({
22
24
  name: ActionName.CustomAction,
@@ -141,6 +143,13 @@ const HoverCardContent = ({
141
143
  url: url
142
144
  });
143
145
  }
146
+ if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
147
+ if (cardState.status === 'forbidden') {
148
+ return jsx(HoverCardForbiddenView, {
149
+ flexibleCardProps: flexibleCardProps
150
+ });
151
+ }
152
+ }
144
153
  if (cardState.status === 'resolved') {
145
154
  return jsx(HoverCardResolvedView, {
146
155
  id: id,
@@ -0,0 +1,72 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useMemo } from 'react';
3
+ import { FormattedMessage } from 'react-intl-next';
4
+ import FlexibleCard from '../../../../FlexibleCard';
5
+ import { messages } from '../../../../../messages';
6
+ import { CustomBlock, PreviewBlock } from '../../../../FlexibleCard/components/blocks';
7
+ import { extractProvider } from '@atlaskit/link-extractors';
8
+ import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
9
+ import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
10
+ import { ActionName } from '../../../../../constants';
11
+ import { getPreviewBlockStyles } from '../../../styled';
12
+ import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
13
+ const HoverCardForbiddenView = ({
14
+ flexibleCardProps,
15
+ testId = 'hover-card-forbidden-view'
16
+ }) => {
17
+ var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider;
18
+ const {
19
+ cardState,
20
+ url
21
+ } = flexibleCardProps;
22
+ const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
23
+ const meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
24
+ const product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
25
+ const hostname = new URL(url).hostname;
26
+ const {
27
+ action,
28
+ descriptiveMessageKey,
29
+ titleMessageKey
30
+ } = extractRequestAccessContextImproved({
31
+ jsonLd: meta,
32
+ url,
33
+ product
34
+ });
35
+ const actions = useMemo(() => [{
36
+ name: ActionName.CustomAction,
37
+ content: action === null || action === void 0 ? void 0 : action.text,
38
+ onClick: action === null || action === void 0 ? void 0 : action.promise
39
+ }], [action]);
40
+ if (!titleMessageKey || !descriptiveMessageKey) {
41
+ return null;
42
+ }
43
+ return /*#__PURE__*/React.createElement(FlexibleCard, _extends({}, flexibleCardProps, {
44
+ testId: testId
45
+ }), /*#__PURE__*/React.createElement(PreviewBlock, {
46
+ ignoreContainerPadding: true,
47
+ overrideCss: getPreviewBlockStyles(),
48
+ testId: testId
49
+ }), /*#__PURE__*/React.createElement(CustomBlock, {
50
+ overrideCss: titleBlockStyles,
51
+ testId: `${testId}-title`
52
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[titleMessageKey], {
53
+ values: {
54
+ product
55
+ }
56
+ }))), /*#__PURE__*/React.createElement(CustomBlock, {
57
+ overrideCss: mainTextStyles,
58
+ testId: `${testId}-content`
59
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[descriptiveMessageKey], {
60
+ values: {
61
+ product,
62
+ hostname
63
+ }
64
+ }))), action && /*#__PURE__*/React.createElement(CustomBlock, {
65
+ overrideCss: connectButtonStyles,
66
+ testId: `${testId}-button`
67
+ }, /*#__PURE__*/React.createElement(ActionGroup, {
68
+ items: actions,
69
+ appearance: "primary"
70
+ })));
71
+ };
72
+ export default HoverCardForbiddenView;
@@ -0,0 +1,17 @@
1
+ import { css } from '@emotion/react';
2
+ const blockGap = '0rem';
3
+ const titleFontWeight = '600';
4
+ export const titleBlockStyles = css`
5
+ justify-content: center;
6
+ font-weight: ${titleFontWeight};
7
+ `;
8
+ export const mainTextStyles = css`
9
+ justify-content: center;
10
+ margin-top: ${blockGap};
11
+ font-size: 0.75rem;
12
+ text-align: center;
13
+ `;
14
+ export const connectButtonStyles = css`
15
+ justify-content: center;
16
+ margin-top: ${blockGap};
17
+ `;
@@ -49,8 +49,6 @@ const HoverCardResolvedView = ({
49
49
  flexibleCardProps,
50
50
  titleBlockProps,
51
51
  analytics,
52
- id = '',
53
- url,
54
52
  cardState,
55
53
  cardActions = [],
56
54
  onActionClick,
@@ -76,8 +76,9 @@ export const popupContainerStyles = css`
76
76
  dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
77
77
  })()};
78
78
  `;
79
- export const getPreviewBlockStyles = snippetHeight => css`
80
- height: ${snippetHeight}px;
79
+ export const getPreviewBlockStyles = previewHeight => css`
80
+ ${previewHeight ? `height: ${previewHeight}px;` : ''}
81
+
81
82
  ${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-200, 8px)"};
82
83
  border-top-right-radius: ${"var(--ds-border-radius-200, 8px)"};
83
84
  margin-bottom: ${blockGap};
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  const PACKAGE_DATA = {
10
10
  packageName: "@atlaskit/smart-card",
11
- packageVersion: "26.28.2",
11
+ packageVersion: "26.30.0",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');
@@ -96,7 +96,8 @@ export var extractRequestAccessContextImproved = function extractRequestAccessCo
96
96
  });
97
97
  case 'FORBIDDEN':
98
98
  return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
99
- descriptiveMessageKey: 'forbidden_description'
99
+ titleMessageKey: 'forbidden_title_crossjoin',
100
+ descriptiveMessageKey: 'forbidden_description_crossjoin'
100
101
  });
101
102
  default:
102
103
  return jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess;
@@ -1,6 +1,9 @@
1
1
  import { extractImage } from '@atlaskit/link-extractors';
2
2
  import { MediaType } from '../../constants';
3
3
  var extractPreview = function extractPreview(data) {
4
+ if (!data) {
5
+ return undefined;
6
+ }
4
7
  var url = extractImage(data);
5
8
  return url ? {
6
9
  type: MediaType.Image,
@@ -474,7 +474,7 @@ export var messages = defineMessages({
474
474
  },
475
475
  direct_access_description_crossjoin: {
476
476
  id: 'fabric.linking.direct_access_description_crossjoin',
477
- defaultMessage: 'All {emailDomain} emails are approved to access {hostname} in {product}.',
477
+ defaultMessage: 'All accounts with your same email domain are approved to access {hostname} in {product}.',
478
478
  description: 'Informs the user that they have access to this product, and can sign up or join right away.'
479
479
  },
480
480
  direct_access_crossjoin: {
@@ -526,19 +526,15 @@ export var messages = defineMessages({
526
526
  id: 'fabric.linking.not_found_title_crossjoin',
527
527
  defaultMessage: "We can't show you this {product} page",
528
528
  description: 'Error case for when a provided link is not found'
529
+ },
530
+ forbidden_title_crossjoin: {
531
+ id: 'fabric.linking.forbidden_title_crossjoin',
532
+ defaultMessage: "You don't have access to this content",
533
+ description: 'Informs the user that they do not have access to the linked content.'
534
+ },
535
+ forbidden_description_crossjoin: {
536
+ id: 'fabric.linking.forbidden_description_crossjoin',
537
+ defaultMessage: 'Contact your admin to request access.',
538
+ description: 'Informs the user that they must contact the site administrator for access.'
529
539
  }
530
-
531
- // Pending designs:
532
- // forbidden_access_crossjoin: {
533
- // id: 'fabric.linking.forbidden_access_crossjoin',
534
- // defaultMessage: 'Your access is forbidden',
535
- // description:
536
- // 'Shown when a user does not have access to a resource behind the link.',
537
- // },
538
- // forbidden_description_crossjoin: {
539
- // id: 'fabric.linking.forbidden_description_crossjoin',
540
- // defaultMessage:
541
- // "You don't have access to this preview. Contact the site admin if you need access.",
542
- // description: 'Informs the user that they cannot view this content.',
543
- // },
544
540
  });
@@ -14,10 +14,10 @@ var applyCommonAttributes = function applyCommonAttributes(event, commonAttribut
14
14
  if (event && event.attributes) {
15
15
  for (var _i = 0, _Object$entries = Object.entries(commonAttributes); _i < _Object$entries.length; _i++) {
16
16
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
17
- _key = _Object$entries$_i[0],
17
+ key = _Object$entries$_i[0],
18
18
  value = _Object$entries$_i[1];
19
- if (event.attributes[_key] === undefined) {
20
- event.attributes[_key] = value;
19
+ if (event.attributes[key] === undefined) {
20
+ event.attributes[key] = value;
21
21
  }
22
22
  }
23
23
  }
@@ -254,7 +254,6 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
254
254
  var id = _ref6.id,
255
255
  actionType = _ref6.actionType,
256
256
  display = _ref6.display,
257
- invokeType = _ref6.invokeType,
258
257
  overrideExtensionKey = _ref6.extensionKey,
259
258
  definitionId = _ref6.definitionId,
260
259
  resourceType = _ref6.resourceType,
@@ -751,7 +750,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
751
750
  * Removed in EDM-5153: This is an even from an experiment.
752
751
  * @deprecated
753
752
  */
754
- linkUpdated: function linkUpdated(props) {},
753
+ linkUpdated: function linkUpdated() {},
755
754
  /**
756
755
  * This fires a tracking event before an action invoke api call is made
757
756
  */
@@ -4,9 +4,7 @@ import { AnalyticsContext } from '@atlaskit/analytics-next';
4
4
  * Provides an analytics context to supply attributes to events based on a URL
5
5
  */
6
6
  export var LinkAnalyticsContext = function LinkAnalyticsContext(_ref) {
7
- var _ref$url = _ref.url,
8
- url = _ref$url === void 0 ? '' : _ref$url,
9
- display = _ref.display,
7
+ var display = _ref.display,
10
8
  id = _ref.id,
11
9
  children = _ref.children,
12
10
  source = _ref.source;
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "26.28.2"
18
+ packageVersion: "26.30.0"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -197,7 +197,8 @@ export var fakeFactory = function fakeFactory(implementation, implementationPost
197
197
  }
198
198
  _createClass(CustomClient, [{
199
199
  key: "fetchData",
200
- value: function () {
200
+ value: // @ts-ignore
201
+ function () {
201
202
  var _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
202
203
  return _regeneratorRuntime.wrap(function _callee$(_context) {
203
204
  while (1) switch (_context.prev = _context.next) {
@@ -216,7 +217,7 @@ export var fakeFactory = function fakeFactory(implementation, implementationPost
216
217
  return _fetchData.apply(this, arguments);
217
218
  }
218
219
  return fetchData;
219
- }()
220
+ }() // @ts-ignore
220
221
  }, {
221
222
  key: "postData",
222
223
  value: function () {
@@ -238,7 +239,7 @@ export var fakeFactory = function fakeFactory(implementation, implementationPost
238
239
  return _postData.apply(this, arguments);
239
240
  }
240
241
  return postData;
241
- }()
242
+ }() // @ts-ignore
242
243
  }, {
243
244
  key: "prefetchData",
244
245
  value: function () {
@@ -53,8 +53,7 @@ export var ResolvedView = function ResolvedView(_ref) {
53
53
  _ref$testId = _ref.testId,
54
54
  testId = _ref$testId === void 0 ? 'block-card-resolved-view' : _ref$testId,
55
55
  _ref$showActions = _ref.showActions,
56
- showActions = _ref$showActions === void 0 ? true : _ref$showActions,
57
- isSupportTheming = _ref.isSupportTheming;
56
+ showActions = _ref$showActions === void 0 ? true : _ref$showActions;
58
57
  var resolvedMetadata = details.length > 0 ? jsx(MetadataList, {
59
58
  testId: testId ? "".concat(testId, "-meta") : undefined,
60
59
  items: details
@@ -14,8 +14,7 @@ import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardSty
14
14
  * @see FlexibleCardProps
15
15
  */
16
16
  var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
17
- var id = _ref.id,
18
- cardState = _ref.cardState,
17
+ var cardState = _ref.cardState,
19
18
  onClick = _ref.onClick,
20
19
  onError = _ref.onError,
21
20
  onResolve = _ref.onResolve,
@@ -53,8 +53,7 @@ var ActionGroup = function ActionGroup(_ref) {
53
53
  appearance = _ref.appearance,
54
54
  _ref$visibleButtonsNu = _ref.visibleButtonsNum,
55
55
  visibleButtonsNum = _ref$visibleButtonsNu === void 0 ? 2 : _ref$visibleButtonsNu,
56
- onDropdownOpenChange = _ref.onDropdownOpenChange,
57
- testId = _ref.testId;
56
+ onDropdownOpenChange = _ref.onDropdownOpenChange;
58
57
  var context = useFlexibleUiContext();
59
58
  var ui = useFlexibleUiOptionContext();
60
59
  var _useState = useState(false),
@@ -20,9 +20,6 @@ var PreviewBlock = function PreviewBlock(_ref) {
20
20
  testId = _ref$testId === void 0 ? 'smart-block-preview' : _ref$testId,
21
21
  overrideUrl = _ref.overrideUrl,
22
22
  blockProps = _objectWithoutProperties(_ref, _excluded);
23
- if (status !== SmartLinkStatus.Resolved) {
24
- return null;
25
- }
26
23
  return jsx(PreviewBlockResolvedView, _extends({}, blockProps, {
27
24
  testId: testId,
28
25
  overrideUrl: overrideUrl
@@ -8,7 +8,7 @@ import { SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
8
8
  import AtlaskitIcon from '../../common/atlaskit-icon';
9
9
  import ImageIcon from '../../common/image-icon';
10
10
  import { getIconSizeStyles, getIconWidth, getTruncateStyles } from '../../utils';
11
- var getPositionStyles = function getPositionStyles(size, position) {
11
+ var getPositionStyles = function getPositionStyles(position) {
12
12
  switch (position) {
13
13
  case SmartLinkPosition.Center:
14
14
  return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-self: center;\n "])));
@@ -17,8 +17,8 @@ var getPositionStyles = function getPositionStyles(size, position) {
17
17
  return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n align-self: flex-start;\n margin: 0;\n "])));
18
18
  }
19
19
  };
20
- var getIconStyles = function getIconStyles(size, position, width) {
21
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), getPositionStyles(size, position), getIconSizeStyles(width));
20
+ var getIconStyles = function getIconStyles(position, width) {
21
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), getPositionStyles(position), getIconSizeStyles(width));
22
22
  };
23
23
  var getCustomRenderStyles = function getCustomRenderStyles(value) {
24
24
  return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n line-height: ", ";\n font-size: ", ";\n text-align: center;\n text-overflow: clip;\n -webkit-box-orient: unset;\n span {\n margin: 0;\n padding: 0;\n vertical-align: baseline;\n }\n"])), getTruncateStyles(1, value), value, value);
@@ -38,7 +38,7 @@ var renderDefaultIcon = function renderDefaultIcon(label, testId) {
38
38
  testId: "".concat(testId, "-default")
39
39
  });
40
40
  };
41
- var renderImageIcon = function renderImageIcon(defaultIcon, icon, url, testId) {
41
+ var renderImageIcon = function renderImageIcon(defaultIcon, url, testId) {
42
42
  if (url) {
43
43
  return jsx(ImageIcon, {
44
44
  defaultIcon: defaultIcon,
@@ -70,10 +70,10 @@ var Icon = function Icon(_ref) {
70
70
  url = _ref.url;
71
71
  var element = useMemo(function () {
72
72
  var defaultIcon = renderDefaultIcon(label, testId);
73
- return (render === null || render === void 0 ? void 0 : render()) || renderImageIcon(defaultIcon, icon, url, testId) || renderAtlaskitIcon(icon, label, testId) || defaultIcon;
73
+ return (render === null || render === void 0 ? void 0 : render()) || renderImageIcon(defaultIcon, url, testId) || renderAtlaskitIcon(icon, label, testId) || defaultIcon;
74
74
  }, [icon, label, render, testId, url]);
75
75
  var width = getIconWidth(size);
76
- var styles = getIconStyles(size, position, width);
76
+ var styles = getIconStyles(position, width);
77
77
  var renderStyles = render ? getCustomRenderStyles(width) : undefined;
78
78
  return jsx("div", {
79
79
  css: [styles, renderStyles, overrideCss],
@@ -7,6 +7,7 @@ import { extractErrorIcon } from '../../extractors/flexible/icon';
7
7
  import { handleOnClick } from '../../utils';
8
8
  import { extractProvider } from '@atlaskit/link-extractors';
9
9
  import extractProviderIcon from '../../extractors/flexible/icon/extract-provider-icon';
10
+ import extractPreview from '../../extractors/flexible/extract-preview';
10
11
  export var getContextByStatus = function getContextByStatus(params) {
11
12
  var _ref = params !== null && params !== void 0 ? params : {},
12
13
  response = _ref.response,
@@ -27,13 +28,15 @@ export var getContextByStatus = function getContextByStatus(params) {
27
28
  case SmartLinkStatus.Errored:
28
29
  case SmartLinkStatus.Fallback:
29
30
  default:
31
+ var preview = extractPreview(response === null || response === void 0 ? void 0 : response.data);
30
32
  var linkIcon = extractErrorIcon(response, status);
31
33
  var provider = extractProviderIcon(response === null || response === void 0 ? void 0 : response.data);
32
34
  return {
33
35
  linkIcon: linkIcon,
34
36
  title: url,
35
37
  url: url,
36
- provider: provider
38
+ provider: provider,
39
+ preview: preview
37
40
  };
38
41
  }
39
42
  };
@@ -208,7 +208,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
208
208
  id: id,
209
209
  source: HOVER_CARD_SOURCE
210
210
  }, jsx(HoverCardContent, hoverCardContentProps));
211
- }, [initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
211
+ }, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
212
212
  var trigger = useCallback(function (triggerProps) {
213
213
  return jsx("span", {
214
214
  ref: parentSpan
@@ -19,6 +19,8 @@ import { FormattedMessage } from 'react-intl-next';
19
19
  import { messages } from '../../../messages';
20
20
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
21
21
  import { useSmartCardState } from '../../../state/store';
22
+ import HoverCardForbiddenView from './views/forbidden';
23
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
22
24
  export var hoverCardClassName = 'smart-links-hover-preview';
23
25
  export var getCopyAction = function getCopyAction(url) {
24
26
  return {
@@ -169,6 +171,13 @@ var HoverCardContent = function HoverCardContent(_ref) {
169
171
  url: url
170
172
  });
171
173
  }
174
+ if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
175
+ if (cardState.status === 'forbidden') {
176
+ return jsx(HoverCardForbiddenView, {
177
+ flexibleCardProps: flexibleCardProps
178
+ });
179
+ }
180
+ }
172
181
  if (cardState.status === 'resolved') {
173
182
  return jsx(HoverCardResolvedView, {
174
183
  id: id,
@@ -0,0 +1,71 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useMemo } from 'react';
3
+ import { FormattedMessage } from 'react-intl-next';
4
+ import FlexibleCard from '../../../../FlexibleCard';
5
+ import { messages } from '../../../../../messages';
6
+ import { CustomBlock, PreviewBlock } from '../../../../FlexibleCard/components/blocks';
7
+ import { extractProvider } from '@atlaskit/link-extractors';
8
+ import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
9
+ import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
10
+ import { ActionName } from '../../../../../constants';
11
+ import { getPreviewBlockStyles } from '../../../styled';
12
+ import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
13
+ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
14
+ var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider;
15
+ var flexibleCardProps = _ref.flexibleCardProps,
16
+ _ref$testId = _ref.testId,
17
+ testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
18
+ var cardState = flexibleCardProps.cardState,
19
+ url = flexibleCardProps.url;
20
+ var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
21
+ var meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
22
+ var product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
23
+ var hostname = new URL(url).hostname;
24
+ var _extractRequestAccess = extractRequestAccessContextImproved({
25
+ jsonLd: meta,
26
+ url: url,
27
+ product: product
28
+ }),
29
+ action = _extractRequestAccess.action,
30
+ descriptiveMessageKey = _extractRequestAccess.descriptiveMessageKey,
31
+ titleMessageKey = _extractRequestAccess.titleMessageKey;
32
+ var actions = useMemo(function () {
33
+ return [{
34
+ name: ActionName.CustomAction,
35
+ content: action === null || action === void 0 ? void 0 : action.text,
36
+ onClick: action === null || action === void 0 ? void 0 : action.promise
37
+ }];
38
+ }, [action]);
39
+ if (!titleMessageKey || !descriptiveMessageKey) {
40
+ return null;
41
+ }
42
+ return /*#__PURE__*/React.createElement(FlexibleCard, _extends({}, flexibleCardProps, {
43
+ testId: testId
44
+ }), /*#__PURE__*/React.createElement(PreviewBlock, {
45
+ ignoreContainerPadding: true,
46
+ overrideCss: getPreviewBlockStyles(),
47
+ testId: testId
48
+ }), /*#__PURE__*/React.createElement(CustomBlock, {
49
+ overrideCss: titleBlockStyles,
50
+ testId: "".concat(testId, "-title")
51
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[titleMessageKey], {
52
+ values: {
53
+ product: product
54
+ }
55
+ }))), /*#__PURE__*/React.createElement(CustomBlock, {
56
+ overrideCss: mainTextStyles,
57
+ testId: "".concat(testId, "-content")
58
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[descriptiveMessageKey], {
59
+ values: {
60
+ product: product,
61
+ hostname: hostname
62
+ }
63
+ }))), action && /*#__PURE__*/React.createElement(CustomBlock, {
64
+ overrideCss: connectButtonStyles,
65
+ testId: "".concat(testId, "-button")
66
+ }, /*#__PURE__*/React.createElement(ActionGroup, {
67
+ items: actions,
68
+ appearance: "primary"
69
+ })));
70
+ };
71
+ export default HoverCardForbiddenView;
@@ -0,0 +1,8 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3;
3
+ import { css } from '@emotion/react';
4
+ var blockGap = '0rem';
5
+ var titleFontWeight = '600';
6
+ export var titleBlockStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n justify-content: center;\n font-weight: ", ";\n"])), titleFontWeight);
7
+ export var mainTextStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n justify-content: center;\n margin-top: ", ";\n font-size: 0.75rem;\n text-align: center;\n"])), blockGap);
8
+ export var connectButtonStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n justify-content: center;\n margin-top: ", ";\n"])), blockGap);
@@ -51,9 +51,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
51
51
  var flexibleCardProps = _ref.flexibleCardProps,
52
52
  titleBlockProps = _ref.titleBlockProps,
53
53
  analytics = _ref.analytics,
54
- _ref$id = _ref.id,
55
- id = _ref$id === void 0 ? '' : _ref$id,
56
- url = _ref.url,
57
54
  cardState = _ref.cardState,
58
55
  _ref$cardActions = _ref.cardActions,
59
56
  cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
@@ -40,6 +40,6 @@ export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _t
40
40
  light: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
41
41
  dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
42
42
  })());
43
- export var getPreviewBlockStyles = function getPreviewBlockStyles(snippetHeight) {
44
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px;\n ", "\n"])), snippetHeight, getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-200, 8px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
43
+ export var getPreviewBlockStyles = function getPreviewBlockStyles(previewHeight) {
44
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n"])), previewHeight ? "height: ".concat(previewHeight, "px;") : '', getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-200, 8px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
45
45
  };
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
11
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
12
  var PACKAGE_DATA = {
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "26.28.2",
14
+ packageVersion: "26.30.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');