@atlaskit/smart-card 26.46.5 → 26.47.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/extractors/common/meta/extractIsTrusted.js +0 -7
  3. package/dist/cjs/utils/analytics/analytics.js +1 -1
  4. package/dist/cjs/utils/index.js +0 -5
  5. package/dist/cjs/view/BlockCard/components/Content.js +6 -0
  6. package/dist/cjs/view/BlockCard/components/ContentHeader.js +6 -0
  7. package/dist/cjs/view/BlockCard/components/Name.js +6 -0
  8. package/dist/cjs/view/BlockCard/views/ErroredView.js +6 -0
  9. package/dist/cjs/view/BlockCard/views/ForbiddenView.js +13 -0
  10. package/dist/cjs/view/BlockCard/views/NotFoundView.js +6 -0
  11. package/dist/cjs/view/BlockCard/views/ResolvedView.js +12 -0
  12. package/dist/cjs/view/BlockCard/views/ResolvingView.js +6 -0
  13. package/dist/cjs/view/CardWithUrl/component.js +3 -2
  14. package/dist/cjs/view/CardWithUrl/loader.js +4 -2
  15. package/dist/cjs/view/HoverCard/components/ContentContainer.js +43 -0
  16. package/dist/cjs/view/HoverCard/components/CustomPopupContainer.js +7 -1
  17. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +18 -3
  18. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +6 -7
  19. package/dist/cjs/view/HoverCard/styled.js +4 -2
  20. package/dist/cjs/view/HoverCard/utils.js +7 -1
  21. package/dist/cjs/view/LinkUrl/index.js +1 -1
  22. package/dist/cjs/view/common/Icon.js +6 -0
  23. package/dist/es2019/extractors/common/meta/extractIsTrusted.js +0 -7
  24. package/dist/es2019/utils/analytics/analytics.js +1 -1
  25. package/dist/es2019/utils/index.js +0 -5
  26. package/dist/es2019/view/BlockCard/components/Content.js +6 -0
  27. package/dist/es2019/view/BlockCard/components/ContentHeader.js +6 -0
  28. package/dist/es2019/view/BlockCard/components/Name.js +6 -0
  29. package/dist/es2019/view/BlockCard/views/ErroredView.js +6 -0
  30. package/dist/es2019/view/BlockCard/views/ForbiddenView.js +13 -0
  31. package/dist/es2019/view/BlockCard/views/NotFoundView.js +6 -0
  32. package/dist/es2019/view/BlockCard/views/ResolvedView.js +12 -0
  33. package/dist/es2019/view/BlockCard/views/ResolvingView.js +6 -0
  34. package/dist/es2019/view/CardWithUrl/component.js +3 -2
  35. package/dist/es2019/view/CardWithUrl/loader.js +4 -2
  36. package/dist/es2019/view/HoverCard/components/ContentContainer.js +33 -0
  37. package/dist/es2019/view/HoverCard/components/CustomPopupContainer.js +8 -1
  38. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +18 -6
  39. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +6 -8
  40. package/dist/es2019/view/HoverCard/styled.js +4 -1
  41. package/dist/es2019/view/HoverCard/utils.js +4 -0
  42. package/dist/es2019/view/LinkUrl/index.js +1 -1
  43. package/dist/es2019/view/common/Icon.js +6 -0
  44. package/dist/esm/extractors/common/meta/extractIsTrusted.js +0 -7
  45. package/dist/esm/utils/analytics/analytics.js +1 -1
  46. package/dist/esm/utils/index.js +0 -5
  47. package/dist/esm/view/BlockCard/components/Content.js +6 -0
  48. package/dist/esm/view/BlockCard/components/ContentHeader.js +6 -0
  49. package/dist/esm/view/BlockCard/components/Name.js +6 -0
  50. package/dist/esm/view/BlockCard/views/ErroredView.js +6 -0
  51. package/dist/esm/view/BlockCard/views/ForbiddenView.js +13 -0
  52. package/dist/esm/view/BlockCard/views/NotFoundView.js +6 -0
  53. package/dist/esm/view/BlockCard/views/ResolvedView.js +12 -0
  54. package/dist/esm/view/BlockCard/views/ResolvingView.js +6 -0
  55. package/dist/esm/view/CardWithUrl/component.js +3 -2
  56. package/dist/esm/view/CardWithUrl/loader.js +4 -2
  57. package/dist/esm/view/HoverCard/components/ContentContainer.js +36 -0
  58. package/dist/esm/view/HoverCard/components/CustomPopupContainer.js +8 -1
  59. package/dist/esm/view/HoverCard/components/HoverCardContent.js +21 -6
  60. package/dist/esm/view/HoverCard/components/views/resolved/index.js +6 -7
  61. package/dist/esm/view/HoverCard/styled.js +4 -1
  62. package/dist/esm/view/HoverCard/utils.js +6 -0
  63. package/dist/esm/view/LinkUrl/index.js +1 -1
  64. package/dist/esm/view/common/Icon.js +6 -0
  65. package/dist/types/utils/index.d.ts +1 -1
  66. package/dist/types/view/BlockCard/components/Content.d.ts +6 -0
  67. package/dist/types/view/BlockCard/components/ContentHeader.d.ts +6 -0
  68. package/dist/types/view/BlockCard/components/Name.d.ts +6 -0
  69. package/dist/types/view/BlockCard/views/ErroredView.d.ts +6 -0
  70. package/dist/types/view/BlockCard/views/ForbiddenView.d.ts +12 -0
  71. package/dist/types/view/BlockCard/views/NotFoundView.d.ts +6 -0
  72. package/dist/types/view/BlockCard/views/ResolvedView.d.ts +12 -0
  73. package/dist/types/view/BlockCard/views/ResolvingView.d.ts +6 -0
  74. package/dist/types/view/Card/index.d.ts +1 -1
  75. package/dist/types/view/Card/types.d.ts +6 -0
  76. package/dist/types/view/CardWithUrl/types.d.ts +1 -0
  77. package/dist/types/view/HoverCard/components/ContentContainer.d.ts +4 -0
  78. package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +5 -0
  79. package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +3 -0
  80. package/dist/types/view/HoverCard/styled.d.ts +1 -0
  81. package/dist/types/view/HoverCard/types.d.ts +5 -0
  82. package/dist/types/view/HoverCard/utils.d.ts +2 -1
  83. package/dist/types/view/common/Icon.d.ts +6 -0
  84. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  85. package/dist/types-ts4.5/view/BlockCard/components/Content.d.ts +6 -0
  86. package/dist/types-ts4.5/view/BlockCard/components/ContentHeader.d.ts +6 -0
  87. package/dist/types-ts4.5/view/BlockCard/components/Name.d.ts +6 -0
  88. package/dist/types-ts4.5/view/BlockCard/views/ErroredView.d.ts +6 -0
  89. package/dist/types-ts4.5/view/BlockCard/views/ForbiddenView.d.ts +12 -0
  90. package/dist/types-ts4.5/view/BlockCard/views/NotFoundView.d.ts +6 -0
  91. package/dist/types-ts4.5/view/BlockCard/views/ResolvedView.d.ts +12 -0
  92. package/dist/types-ts4.5/view/BlockCard/views/ResolvingView.d.ts +6 -0
  93. package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
  94. package/dist/types-ts4.5/view/Card/types.d.ts +6 -0
  95. package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +1 -0
  96. package/dist/types-ts4.5/view/HoverCard/components/ContentContainer.d.ts +4 -0
  97. package/dist/types-ts4.5/view/HoverCard/components/CustomPopupContainer.d.ts +5 -0
  98. package/dist/types-ts4.5/view/HoverCard/components/views/resolved/types.d.ts +3 -0
  99. package/dist/types-ts4.5/view/HoverCard/styled.d.ts +1 -0
  100. package/dist/types-ts4.5/view/HoverCard/types.d.ts +5 -0
  101. package/dist/types-ts4.5/view/HoverCard/utils.d.ts +2 -1
  102. package/dist/types-ts4.5/view/common/Icon.d.ts +6 -0
  103. package/package.json +2 -8
@@ -15,7 +15,20 @@ import { ContentHeader } from '../components/ContentHeader';
15
15
  import { handleClickCommon } from '../utils/handlers';
16
16
  import { Link } from '../components/Link';
17
17
  import { UnresolvedText } from '../components/UnresolvedText';
18
+ /**
19
+ * Class name for selecting non-flexible forbidden block card
20
+ *
21
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
22
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
23
+ */
18
24
  export const blockCardForbiddenViewClassName = 'block-card-forbidden-view';
25
+
26
+ /**
27
+ * Class name for selecting link inside non-flexible forbidden block card
28
+ *
29
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
30
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
31
+ */
19
32
  export const blockCardForbiddenViewLinkClassName = 'block-card-forbidden-view-link';
20
33
  export const ForbiddenView = ({
21
34
  context = {
@@ -17,6 +17,12 @@ import { handleClickCommon } from '../utils/handlers';
17
17
  const textDescriptionProps = {
18
18
  ...messages.not_found_description
19
19
  };
20
+ /**
21
+ * Class name for selecting non-flexible not-found block card
22
+ *
23
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
24
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
25
+ */
20
26
  export const blockCardNotFoundViewClassName = 'block-card-not-found-view';
21
27
  export const NotFoundView = ({
22
28
  context = {
@@ -17,7 +17,19 @@ import { ContentHeader } from '../components/ContentHeader';
17
17
  import { ContentFooter } from '../components/ContentFooter';
18
18
  import { gs } from '../../common/utils';
19
19
  import { handleClickCommon } from '../utils/handlers';
20
+ /**
21
+ * Class name for selecting non-flexible resolved block card
22
+ *
23
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
24
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
25
+ */
20
26
  export const blockCardResolvedViewClassName = 'block-card-resolved-view';
27
+ /**
28
+ * Class name for selecting non-flexible resolved byline
29
+ *
30
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
31
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
32
+ */
21
33
  export const blockCardResolvedViewByClassName = 'block-card-resolved-view-by';
22
34
  export const ResolvedView = ({
23
35
  icon = {},
@@ -7,6 +7,12 @@ import { Frame } from '../components/Frame';
7
7
  import { gs } from '../../common/utils';
8
8
  import { FormattedMessage } from 'react-intl-next';
9
9
  import { messages } from '../../../messages';
10
+ /**
11
+ * Class name for selecting non-flexible resolving block card
12
+ *
13
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
14
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
15
+ */
10
16
  export const blockCardResolvingViewClassName = 'block-card-resolving-view';
11
17
  export const ResolvingView = ({
12
18
  isSelected = false,
@@ -39,7 +39,8 @@ function Component({
39
39
  children,
40
40
  showHoverPreview,
41
41
  showAuthTooltip,
42
- analyticsEvents
42
+ analyticsEvents,
43
+ useLegacyBlockCard
43
44
  }) {
44
45
  const {
45
46
  createAnalyticsEvent
@@ -233,7 +234,7 @@ function Component({
233
234
  testId: testId,
234
235
  actionOptions: actionOptions,
235
236
  platform: platform,
236
- enableFlexibleBlockCard: enableFlexibleBlockCardFlag
237
+ enableFlexibleBlockCard: enableFlexibleBlockCardFlag && useLegacyBlockCard !== true
237
238
  });
238
239
  case 'embed':
239
240
  return /*#__PURE__*/React.createElement(EmbedCard, {
@@ -42,7 +42,8 @@ export function CardWithURLRenderer(props) {
42
42
  showAuthTooltip,
43
43
  analyticsEvents,
44
44
  placeholder,
45
- fallbackComponent
45
+ fallbackComponent,
46
+ useLegacyBlockCard
46
47
  } = props;
47
48
  const analytics = useSmartLinkAnalytics(url !== null && url !== void 0 ? url : '', undefined, id);
48
49
  const isFlexibleUi = isFlexibleUiCard(children);
@@ -109,7 +110,8 @@ export function CardWithURLRenderer(props) {
109
110
  showHoverPreview,
110
111
  showAuthTooltip,
111
112
  analyticsEvents,
112
- placeholder
113
+ placeholder,
114
+ useLegacyBlockCard
113
115
  };
114
116
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
115
117
  FallbackComponent: ErrorFallback,
@@ -0,0 +1,33 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { jsx } from '@emotion/react';
4
+ import React from 'react';
5
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
+ import { HoverCardContainer, popupContainerStyles } from '../styled';
7
+ import AIPrism from '../../common/ai-prism';
8
+ import { hoverCardClassName } from './HoverCardContent';
9
+ const ContentContainer = ({
10
+ children,
11
+ isAIEnabled = false,
12
+ showPrism = false,
13
+ testId,
14
+ ...props
15
+ }) => {
16
+ if (getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries')) {
17
+ const container = jsx("div", _extends({
18
+ className: hoverCardClassName,
19
+ css: [HoverCardContainer, isAIEnabled && showPrism ? undefined : popupContainerStyles],
20
+ "data-testid": testId
21
+ }, props), children);
22
+ return isAIEnabled ? jsx(AIPrism, {
23
+ isVisible: showPrism,
24
+ testId: `${testId}-prism`
25
+ }, container) : container;
26
+ }
27
+ return jsx("div", _extends({
28
+ className: hoverCardClassName,
29
+ css: HoverCardContainer,
30
+ "data-testid": testId
31
+ }, props), children);
32
+ };
33
+ export default ContentContainer;
@@ -1,13 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import React from 'react';
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
5
  import { popupContainerStyles } from '../styled';
5
6
  import { jsx } from '@emotion/react';
7
+
8
+ /**
9
+ * The purpose of this component is to hide the default Popup border.
10
+ * HoverCard border implementation is in ContentContainer where it can
11
+ * change between the default border and prism border during runtime.
12
+ */
6
13
  const CustomPopupContainer = /*#__PURE__*/React.forwardRef(({
7
14
  children,
8
15
  ...props
9
16
  }, ref) => jsx("div", _extends({
10
- css: popupContainerStyles
17
+ css: getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') ? undefined : popupContainerStyles
11
18
  }, props, {
12
19
  ref: ref
13
20
  }), children));
@@ -2,14 +2,15 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
4
  import CopyIcon from '@atlaskit/icon/glyph/copy';
5
- import React, { useCallback, useEffect, useMemo, useRef } from 'react';
5
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
+ import { useSmartLinkContext } from '@atlaskit/link-provider';
6
7
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
7
8
  import { extractMetadata } from '../../../extractors/hover/extractMetadata';
8
9
  import { useSmartLinkAnalytics } from '../../../state/analytics';
9
10
  import { getExtensionKey, getServices } from '../../../state/helpers';
10
11
  import { isSpecialEvent } from '../../../utils';
11
- import { HoverCardContainer, flexibleUiOptions, titleBlockCss } from '../styled';
12
- import { getSimulatedMetadata } from '../utils';
12
+ import { flexibleUiOptions, titleBlockCss } from '../styled';
13
+ import { getSimulatedMetadata, getIsAISummaryEnabled } from '../utils';
13
14
  import HoverCardLoadingView from './views/resolving';
14
15
  import HoverCardUnauthorisedView from './views/unauthorised';
15
16
  import HoverCardResolvedView from './views/resolved';
@@ -18,6 +19,7 @@ import { messages } from '../../../messages';
18
19
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
19
20
  import { useSmartCardState } from '../../../state/store';
20
21
  import HoverCardForbiddenView from './views/forbidden';
22
+ import ContentContainer from './ContentContainer';
21
23
  export const hoverCardClassName = 'smart-links-hover-preview';
22
24
  export const getCopyAction = url => ({
23
25
  name: ActionName.CustomAction,
@@ -52,9 +54,14 @@ const HoverCardContent = ({
52
54
  const extensionKey = useMemo(() => getExtensionKey(cardState.details), [cardState.details]);
53
55
  const linkState = useSmartCardState(url);
54
56
  const linkStatus = (_linkState$status = linkState.status) !== null && _linkState$status !== void 0 ? _linkState$status : 'pending';
57
+ const {
58
+ isAdminHubAIEnabled
59
+ } = useSmartLinkContext();
60
+ const isAISummaryEnabled = getIsAISummaryEnabled(isAdminHubAIEnabled, cardState.details);
55
61
  const services = getServices(linkState.details);
56
62
  const statusRef = useRef(linkStatus);
57
63
  const analyticsRef = useRef(analytics);
64
+ const [showPrism, setShowPrism] = useState(false);
58
65
  useEffect(() => {
59
66
  /**
60
67
  * Must access current analytics object value via ref because its not stable
@@ -124,6 +131,9 @@ const HoverCardContent = ({
124
131
  analytics
125
132
  };
126
133
  const onClickStopPropagation = useCallback(e => e.stopPropagation(), []);
134
+ const onAIActionChange = useCallback(state => {
135
+ setShowPrism(state === 'loading');
136
+ }, []);
127
137
  const getCardView = cardState => {
128
138
  if (cardState.metadataStatus === 'pending') {
129
139
  return jsx(HoverCardLoadingView, {
@@ -154,19 +164,21 @@ const HoverCardContent = ({
154
164
  cardActions: cardActions,
155
165
  cardState: cardState,
156
166
  flexibleCardProps: flexibleCardProps,
167
+ isAISummaryEnabled: isAISummaryEnabled,
157
168
  onActionClick: onActionClick,
169
+ onAIActionChange: onAIActionChange,
158
170
  titleBlockProps: titleBlockProps
159
171
  });
160
172
  }
161
173
  return null;
162
174
  };
163
175
  const cardView = getCardView(cardState);
164
- return cardView ? jsx("div", {
176
+ return cardView ? jsx(ContentContainer, {
165
177
  onMouseEnter: onMouseEnter,
166
178
  onMouseLeave: onMouseLeave,
167
179
  onClick: onClickStopPropagation,
168
- className: hoverCardClassName,
169
- css: HoverCardContainer
180
+ isAIEnabled: isAISummaryEnabled,
181
+ showPrism: showPrism
170
182
  }, cardView) : null;
171
183
  };
172
184
  export default HoverCardContent;
@@ -11,7 +11,6 @@ import { messages } from '../../../../../messages';
11
11
  import { FormattedMessage } from 'react-intl-next';
12
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
13
  import { getCanBeDatasource } from '../../../../../state/helpers';
14
- import { useSmartLinkContext } from '../../../../../state';
15
14
  export const toFooterActions = (cardActions, onActionClick) => {
16
15
  const followAction = {
17
16
  hideIcon: true,
@@ -52,11 +51,13 @@ const HoverCardResolvedView = ({
52
51
  analytics,
53
52
  cardState,
54
53
  cardActions = [],
54
+ isAISummaryEnabled,
55
55
  onActionClick,
56
+ onAIActionChange,
56
57
  extensionKey,
57
58
  url
58
59
  }) => {
59
- var _cardState$details, _cardState$details2, _cardState$details2$m, _cardState$details2$m2;
60
+ var _cardState$details;
60
61
  const canBeDatasource = getCanBeDatasource(cardState.details);
61
62
  useEffect(() => {
62
63
  // Since this hover view is only rendered on resolved status,
@@ -91,10 +92,6 @@ const HoverCardResolvedView = ({
91
92
  data: data,
92
93
  fallbackElementHeight: snippetHeight.current
93
94
  });
94
- const {
95
- isAdminHubAIEnabled
96
- } = useSmartLinkContext();
97
- const showAiView = getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && ((_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : (_cardState$details2$m = _cardState$details2.meta) === null || _cardState$details2$m === void 0 ? void 0 : (_cardState$details2$m2 = _cardState$details2$m.supportedFeatures) === null || _cardState$details2$m2 === void 0 ? void 0 : _cardState$details2$m2.includes('AISummary'));
98
95
  return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
99
96
  metadataPosition: SmartLinkPosition.Top
100
97
  })), /*#__PURE__*/React.createElement(MetadataBlock, {
@@ -116,11 +113,12 @@ const HoverCardResolvedView = ({
116
113
  }), getBooleanFF('platform.linking-platform.smart-card.enable-hover-card-related-urls') && /*#__PURE__*/React.createElement(RelatedUrlsBlock, {
117
114
  url: url,
118
115
  size: SmartLinkSize.Small
119
- }), showAiView ? /*#__PURE__*/React.createElement(AISummaryBlock, {
116
+ }), isAISummaryEnabled ? /*#__PURE__*/React.createElement(AISummaryBlock, {
120
117
  metadata: [{
121
118
  name: ElementName.Provider
122
119
  }],
123
- actions: footerActions
120
+ actions: footerActions,
121
+ onAIActionChange: onAIActionChange
124
122
  }) : /*#__PURE__*/React.createElement(FooterBlock, {
125
123
  actions: footerActions,
126
124
  size: SmartLinkSize.Large,
@@ -2,6 +2,8 @@ import { css } from '@emotion/react';
2
2
  import { loadingPlaceholderClassName } from '../../index';
3
3
  import { SmartLinkSize } from '../../constants';
4
4
  import { layers } from '@atlaskit/theme/constants';
5
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
+
5
7
  // Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
6
8
  export const HOVER_CARD_Z_INDEX = layers.modal();
7
9
  export const flexibleUiOptions = {
@@ -12,6 +14,7 @@ export const flexibleUiOptions = {
12
14
  zIndex: HOVER_CARD_Z_INDEX + 1
13
15
  };
14
16
  export const CARD_WIDTH_REM = 24;
17
+ export const NEW_CARD_WIDTH_REM = 28;
15
18
  // gap between mouse cursor and hover card
16
19
  export const CARD_GAP_PX = 10;
17
20
  const blockGap = '0.5rem';
@@ -25,7 +28,7 @@ export const HoverCardContainer = css`
25
28
  background: none;
26
29
  border-width: 0;
27
30
  box-sizing: border-box;
28
- width: ${CARD_WIDTH_REM}rem;
31
+ width: ${getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') ? NEW_CARD_WIDTH_REM : CARD_WIDTH_REM}rem;
29
32
 
30
33
  .${loadingPlaceholderClassName} {
31
34
  display: none;
@@ -201,4 +201,8 @@ export const getSimulatedBetterMetadata = (extensionKey = '', data) => {
201
201
  default:
202
202
  return defaultMetadata;
203
203
  }
204
+ };
205
+ export const getIsAISummaryEnabled = (isAdminHubAIEnabled = false, response) => {
206
+ var _response$meta, _response$meta$suppor;
207
+ return Boolean(getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && (response === null || response === void 0 ? void 0 : (_response$meta = response.meta) === null || _response$meta === void 0 ? void 0 : (_response$meta$suppor = _response$meta.supportedFeatures) === null || _response$meta$suppor === void 0 ? void 0 : _response$meta$suppor.includes('AISummary')));
204
208
  };
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "26.46.5",
10
+ packageVersion: "26.47.1",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -4,6 +4,12 @@ import React from 'react';
4
4
  import ImageLoader from 'react-render-image';
5
5
  import LinkIcon from '@atlaskit/icon/glyph/link';
6
6
  import { gs } from './utils';
7
+ /**
8
+ * Class name for selecting non-flexible block card icon image
9
+ *
10
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
11
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
12
+ */
7
13
  export const blockCardIconImageClassName = 'block-card-icon-image';
8
14
  const getImageStyles = isFlexibleUi => {
9
15
  if (isFlexibleUi) {
@@ -1,10 +1,3 @@
1
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
1
  export var extractIsTrusted = function extractIsTrusted(meta) {
3
- if (getBooleanFF('platform.linking-platform.smart-card.fix-is-trusted-pop')) {
4
- if (!(meta !== null && meta !== void 0 && meta.key)) {
5
- return false;
6
- }
7
- return !['iframely-object-provider', 'public-object-provider'].includes(meta.key);
8
- }
9
2
  return Boolean((meta === null || meta === void 0 ? void 0 : meta.key) && meta.key !== 'iframely-object-provider');
10
3
  };
@@ -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.46.5"
18
+ packageVersion: "26.47.1"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -3,7 +3,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import React from 'react';
5
5
  import Loadable from 'react-loadable';
6
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
6
  export var isCardWithData = function isCardWithData(props) {
8
7
  return !!props.data;
9
8
  };
@@ -226,10 +225,6 @@ export var getIframeSandboxAttribute = function getIframeSandboxAttribute(isTrus
226
225
  return undefined;
227
226
  }
228
227
  var sandboxPermissions = 'allow-downloads allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts';
229
- var allowStorageAccess = 'allow-storage-access-by-user-activation';
230
- if (getBooleanFF('platform.linking-platform.smart-card.iframes-allow-storage-access-by-user-activation')) {
231
- return "".concat(sandboxPermissions, " ").concat(allowStorageAccess);
232
- }
233
228
  return sandboxPermissions;
234
229
  };
235
230
  export var handleOnClick = function handleOnClick(handler) {
@@ -1,6 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import { gs, mq } from '../../common/utils';
4
+ /**
5
+ * Class name for selecting non-flexible block card content
6
+ *
7
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
8
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
9
+ */
4
10
  export var blockCardContentClassName = 'block-card-content';
5
11
  export var Content = function Content(_ref) {
6
12
  var children = _ref.children,
@@ -1,6 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import { useMouseDownEvent } from '../../../state/analytics/useLinkClicked';
4
+ /**
5
+ * Class name for selecting non-flexible block card header
6
+ *
7
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
8
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
9
+ */
4
10
  export var blockCardContentHeaderClassName = 'block-card-content-header';
5
11
  export var ContentHeader = function ContentHeader(_ref) {
6
12
  var onClick = _ref.onClick,
@@ -2,6 +2,12 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  import { fontSize } from '@atlaskit/theme/constants';
4
4
  import { gs } from '../../common/utils';
5
+ /**
6
+ * Class name for selecting non-flexible block card header name
7
+ *
8
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
9
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
10
+ */
5
11
  export var blockCardContentHeaderNameClassName = 'block-card-content-header-name';
6
12
  export var Name = function Name(_ref) {
7
13
  var name = _ref.name,
@@ -19,6 +19,12 @@ import { Link } from '../components/Link';
19
19
  import { UnresolvedText } from '../components/UnresolvedText';
20
20
  import { RetryAction } from '../actions/RetryAction';
21
21
  var textDescriptionProps = _objectSpread({}, messages.could_not_load_link);
22
+ /**
23
+ * Class name for selecting non-flexible errored block card
24
+ *
25
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
26
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
27
+ */
22
28
  export var blockCardErroredViewClassName = 'block-card-errored-view';
23
29
  export var ErroredView = function ErroredView(_ref) {
24
30
  var _ref$isSelected = _ref.isSelected,
@@ -16,7 +16,20 @@ import { ContentHeader } from '../components/ContentHeader';
16
16
  import { handleClickCommon } from '../utils/handlers';
17
17
  import { Link } from '../components/Link';
18
18
  import { UnresolvedText } from '../components/UnresolvedText';
19
+ /**
20
+ * Class name for selecting non-flexible forbidden block card
21
+ *
22
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
23
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
24
+ */
19
25
  export var blockCardForbiddenViewClassName = 'block-card-forbidden-view';
26
+
27
+ /**
28
+ * Class name for selecting link inside non-flexible forbidden block card
29
+ *
30
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
31
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
32
+ */
20
33
  export var blockCardForbiddenViewLinkClassName = 'block-card-forbidden-view-link';
21
34
  export var ForbiddenView = function ForbiddenView(_ref) {
22
35
  var _ref$context = _ref.context,
@@ -18,6 +18,12 @@ import { Link } from '../components/Link';
18
18
  import { UnresolvedText } from '../components/UnresolvedText';
19
19
  import { handleClickCommon } from '../utils/handlers';
20
20
  var textDescriptionProps = _objectSpread({}, messages.not_found_description);
21
+ /**
22
+ * Class name for selecting non-flexible not-found block card
23
+ *
24
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
25
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
26
+ */
21
27
  export var blockCardNotFoundViewClassName = 'block-card-not-found-view';
22
28
  export var NotFoundView = function NotFoundView(_ref) {
23
29
  var _ref$context = _ref.context,
@@ -17,7 +17,19 @@ import { ContentHeader } from '../components/ContentHeader';
17
17
  import { ContentFooter } from '../components/ContentFooter';
18
18
  import { gs } from '../../common/utils';
19
19
  import { handleClickCommon } from '../utils/handlers';
20
+ /**
21
+ * Class name for selecting non-flexible resolved block card
22
+ *
23
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
24
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
25
+ */
20
26
  export var blockCardResolvedViewClassName = 'block-card-resolved-view';
27
+ /**
28
+ * Class name for selecting non-flexible resolved byline
29
+ *
30
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
31
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
32
+ */
21
33
  export var blockCardResolvedViewByClassName = 'block-card-resolved-view-by';
22
34
  export var ResolvedView = function ResolvedView(_ref) {
23
35
  var _ref$icon = _ref.icon,
@@ -7,6 +7,12 @@ import { Frame } from '../components/Frame';
7
7
  import { gs } from '../../common/utils';
8
8
  import { FormattedMessage } from 'react-intl-next';
9
9
  import { messages } from '../../../messages';
10
+ /**
11
+ * Class name for selecting non-flexible resolving block card
12
+ *
13
+ * @deprecated {@link https://hello.jira.atlassian.cloud/browse/ENGHEALTH-6878 Internal documentation for deprecation (no external access)}
14
+ * Using this selctor is deprecated as once the flexible block card feature flag is removed, this class will no longer be used.
15
+ */
10
16
  export var blockCardResolvingViewClassName = 'block-card-resolving-view';
11
17
  export var ResolvingView = function ResolvingView(_ref) {
12
18
  var _ref$isSelected = _ref.isSelected,
@@ -39,7 +39,8 @@ function Component(_ref) {
39
39
  children = _ref.children,
40
40
  showHoverPreview = _ref.showHoverPreview,
41
41
  showAuthTooltip = _ref.showAuthTooltip,
42
- analyticsEvents = _ref.analyticsEvents;
42
+ analyticsEvents = _ref.analyticsEvents,
43
+ useLegacyBlockCard = _ref.useLegacyBlockCard;
43
44
  var _useAnalyticsEvents = useAnalyticsEvents(),
44
45
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
45
46
 
@@ -236,7 +237,7 @@ function Component(_ref) {
236
237
  testId: testId,
237
238
  actionOptions: actionOptions,
238
239
  platform: platform,
239
- enableFlexibleBlockCard: enableFlexibleBlockCardFlag
240
+ enableFlexibleBlockCard: enableFlexibleBlockCardFlag && useLegacyBlockCard !== true
240
241
  });
241
242
  case 'embed':
242
243
  return /*#__PURE__*/React.createElement(EmbedCard, {
@@ -50,7 +50,8 @@ export function CardWithURLRenderer(props) {
50
50
  showAuthTooltip = props.showAuthTooltip,
51
51
  analyticsEvents = props.analyticsEvents,
52
52
  placeholder = props.placeholder,
53
- fallbackComponent = props.fallbackComponent;
53
+ fallbackComponent = props.fallbackComponent,
54
+ useLegacyBlockCard = props.useLegacyBlockCard;
54
55
  var analytics = useSmartLinkAnalytics(url !== null && url !== void 0 ? url : '', undefined, id);
55
56
  var isFlexibleUi = isFlexibleUiCard(children);
56
57
  var errorHandler = useCallback(function (error, info) {
@@ -118,7 +119,8 @@ export function CardWithURLRenderer(props) {
118
119
  showHoverPreview: showHoverPreview,
119
120
  showAuthTooltip: showAuthTooltip,
120
121
  analyticsEvents: analyticsEvents,
121
- placeholder: placeholder
122
+ placeholder: placeholder,
123
+ useLegacyBlockCard: useLegacyBlockCard
122
124
  };
123
125
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
124
126
  FallbackComponent: ErrorFallback,
@@ -0,0 +1,36 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "isAIEnabled", "showPrism", "testId"];
4
+ /** @jsx jsx */
5
+ import { jsx } from '@emotion/react';
6
+ import React from 'react';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { HoverCardContainer, popupContainerStyles } from '../styled';
9
+ import AIPrism from '../../common/ai-prism';
10
+ import { hoverCardClassName } from './HoverCardContent';
11
+ var ContentContainer = function ContentContainer(_ref) {
12
+ var children = _ref.children,
13
+ _ref$isAIEnabled = _ref.isAIEnabled,
14
+ isAIEnabled = _ref$isAIEnabled === void 0 ? false : _ref$isAIEnabled,
15
+ _ref$showPrism = _ref.showPrism,
16
+ showPrism = _ref$showPrism === void 0 ? false : _ref$showPrism,
17
+ testId = _ref.testId,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ if (getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries')) {
20
+ var container = jsx("div", _extends({
21
+ className: hoverCardClassName,
22
+ css: [HoverCardContainer, isAIEnabled && showPrism ? undefined : popupContainerStyles],
23
+ "data-testid": testId
24
+ }, props), children);
25
+ return isAIEnabled ? jsx(AIPrism, {
26
+ isVisible: showPrism,
27
+ testId: "".concat(testId, "-prism")
28
+ }, container) : container;
29
+ }
30
+ return jsx("div", _extends({
31
+ className: hoverCardClassName,
32
+ css: HoverCardContainer,
33
+ "data-testid": testId
34
+ }, props), children);
35
+ };
36
+ export default ContentContainer;
@@ -3,13 +3,20 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["children"];
4
4
  /** @jsx jsx */
5
5
  import React from 'react';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
7
  import { popupContainerStyles } from '../styled';
7
8
  import { jsx } from '@emotion/react';
9
+
10
+ /**
11
+ * The purpose of this component is to hide the default Popup border.
12
+ * HoverCard border implementation is in ContentContainer where it can
13
+ * change between the default border and prism border during runtime.
14
+ */
8
15
  var CustomPopupContainer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
9
16
  var children = _ref.children,
10
17
  props = _objectWithoutProperties(_ref, _excluded);
11
18
  return jsx("div", _extends({
12
- css: popupContainerStyles
19
+ css: getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') ? undefined : popupContainerStyles
13
20
  }, props, {
14
21
  ref: ref
15
22
  }), children);