@atlaskit/smart-card 26.49.0 → 26.49.2

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 (80) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +39 -27
  3. package/dist/cjs/state/hooks/use-ai-summary/index.js +16 -38
  4. package/dist/cjs/utils/analytics/analytics.js +1 -1
  5. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +37 -29
  6. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +1 -4
  7. package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +8 -9
  8. package/dist/cjs/view/HoverCard/components/ContentContainer.js +39 -13
  9. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -10
  10. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +63 -16
  11. package/dist/cjs/view/LinkUrl/index.js +1 -1
  12. package/dist/cjs/view/common/ai-prism/index.js +0 -1
  13. package/dist/cjs/view/common/ai-summary/index.js +9 -3
  14. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +14 -5
  15. package/dist/es2019/state/hooks/use-ai-summary/index.js +17 -35
  16. package/dist/es2019/utils/analytics/analytics.js +1 -1
  17. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +33 -26
  18. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +1 -1
  19. package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +0 -1
  20. package/dist/es2019/view/HoverCard/components/ContentContainer.js +35 -10
  21. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +2 -7
  22. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +56 -7
  23. package/dist/es2019/view/LinkUrl/index.js +1 -1
  24. package/dist/es2019/view/common/ai-prism/index.js +0 -1
  25. package/dist/es2019/view/common/ai-summary/index.js +7 -3
  26. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +39 -27
  27. package/dist/esm/state/hooks/use-ai-summary/index.js +17 -39
  28. package/dist/esm/utils/analytics/analytics.js +1 -1
  29. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +38 -30
  30. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +1 -1
  31. package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +0 -1
  32. package/dist/esm/view/HoverCard/components/ContentContainer.js +39 -13
  33. package/dist/esm/view/HoverCard/components/HoverCardContent.js +2 -11
  34. package/dist/esm/view/HoverCard/components/views/resolved/index.js +66 -18
  35. package/dist/esm/view/LinkUrl/index.js +1 -1
  36. package/dist/esm/view/common/ai-prism/index.js +0 -1
  37. package/dist/esm/view/common/ai-summary/index.js +9 -3
  38. package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +3 -1
  39. package/dist/types/state/hooks/use-ai-summary/index.d.ts +0 -1
  40. package/dist/types/view/BlockCard/views/flexible/unresolved-view/index.d.ts +2 -2
  41. package/dist/types/view/BlockCard/views/flexible/unresolved-view/types.d.ts +3 -2
  42. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.d.ts +1 -2
  43. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -2
  44. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +2 -3
  45. package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +2 -3
  46. package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +2 -3
  47. package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +3 -2
  48. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +3 -3
  49. package/dist/types/view/FlexibleCard/components/container/hover-card-control/index.d.ts +2 -2
  50. package/dist/types/view/FlexibleCard/components/container/hover-card-control/types.d.ts +3 -2
  51. package/dist/types/view/FlexibleCard/components/container/index.d.ts +2 -4
  52. package/dist/types/view/FlexibleCard/components/container/types.d.ts +3 -2
  53. package/dist/types/view/HoverCard/components/ContentContainer.d.ts +3 -2
  54. package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +0 -2
  55. package/dist/types/view/HoverCard/types.d.ts +1 -1
  56. package/dist/types/view/common/ai-prism/index.d.ts +3 -2
  57. package/dist/types/view/common/ai-prism/types.d.ts +3 -2
  58. package/dist/types/view/common/ai-summary/index.d.ts +4 -0
  59. package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +3 -1
  60. package/dist/types-ts4.5/state/hooks/use-ai-summary/index.d.ts +0 -1
  61. package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/index.d.ts +2 -2
  62. package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/types.d.ts +3 -2
  63. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.d.ts +1 -2
  64. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -2
  65. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +2 -3
  66. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/block/index.d.ts +2 -3
  67. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/element-group/index.d.ts +2 -3
  68. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/element-group/types.d.ts +3 -2
  69. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +3 -3
  70. package/dist/types-ts4.5/view/FlexibleCard/components/container/hover-card-control/index.d.ts +2 -2
  71. package/dist/types-ts4.5/view/FlexibleCard/components/container/hover-card-control/types.d.ts +3 -2
  72. package/dist/types-ts4.5/view/FlexibleCard/components/container/index.d.ts +2 -4
  73. package/dist/types-ts4.5/view/FlexibleCard/components/container/types.d.ts +3 -2
  74. package/dist/types-ts4.5/view/HoverCard/components/ContentContainer.d.ts +3 -2
  75. package/dist/types-ts4.5/view/HoverCard/components/views/resolved/types.d.ts +0 -2
  76. package/dist/types-ts4.5/view/HoverCard/types.d.ts +1 -1
  77. package/dist/types-ts4.5/view/common/ai-prism/index.d.ts +3 -2
  78. package/dist/types-ts4.5/view/common/ai-prism/types.d.ts +3 -2
  79. package/dist/types-ts4.5/view/common/ai-summary/index.d.ts +4 -0
  80. package/package.json +5 -5
@@ -1,8 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
4
- import { ActionName, CardDisplay, ElementName, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
5
- import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock } from '../../../../FlexibleCard/components/blocks';
4
+ import { ActionName, CardDisplay, ElementName, SmartLinkPosition, SmartLinkSize, SmartLinkDirection } from '../../../../../constants';
5
+ import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock } from '../../../../FlexibleCard/components/blocks';
6
6
  import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
7
7
  import FlexibleCard from '../../../../FlexibleCard';
8
8
  import { getSimulatedBetterMetadata } from '../../../utils';
@@ -12,6 +12,8 @@ import { messages } from '../../../../../messages';
12
12
  import { FormattedMessage } from 'react-intl-next';
13
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
14
  import { getCanBeDatasource } from '../../../../../state/helpers';
15
+ import { useAISummary } from '../../../../../state/hooks/use-ai-summary';
16
+ import { SmartLinkStatus } from '../../../../../constants';
15
17
  export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
16
18
  var followAction = {
17
19
  hideIcon: true,
@@ -46,19 +48,41 @@ export var toFooterActions = function toFooterActions(cardActions, onActionClick
46
48
  });
47
49
  return [followAction].concat(_toConsumableArray(actions));
48
50
  };
49
- var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
51
+
52
+ //This component encapsulates useAISummary hook under the AI Summary FF 'platform.linking-platform.smart-card.hover-card-ai-summaries'
53
+ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
54
+ var bottomPrimary = _ref.bottomPrimary,
55
+ url = _ref.url,
56
+ imagePreview = _ref.imagePreview;
57
+ var aiSummary = useAISummary({
58
+ url: url
59
+ });
60
+ var aiStatus = aiSummary.state.status;
61
+ var showData = aiStatus === 'ready' || aiStatus === 'error';
62
+ return showData ? /*#__PURE__*/React.createElement(CustomBlock, {
63
+ direction: SmartLinkDirection.Vertical
64
+ }, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
65
+ status: SmartLinkStatus.Resolved
66
+ }), /*#__PURE__*/React.createElement(MetadataBlock, {
67
+ primary: bottomPrimary,
68
+ size: SmartLinkSize.Large,
69
+ overrideCss: metadataBlockCss,
70
+ maxLines: 1,
71
+ status: SmartLinkStatus.Resolved
72
+ })) : null;
73
+ };
74
+ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
50
75
  var _cardState$details;
51
- var flexibleCardProps = _ref.flexibleCardProps,
52
- titleBlockProps = _ref.titleBlockProps,
53
- analytics = _ref.analytics,
54
- cardState = _ref.cardState,
55
- _ref$cardActions = _ref.cardActions,
56
- cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
57
- isAISummaryEnabled = _ref.isAISummaryEnabled,
58
- onActionClick = _ref.onActionClick,
59
- onAIActionChange = _ref.onAIActionChange,
60
- extensionKey = _ref.extensionKey,
61
- url = _ref.url;
76
+ var flexibleCardProps = _ref2.flexibleCardProps,
77
+ titleBlockProps = _ref2.titleBlockProps,
78
+ analytics = _ref2.analytics,
79
+ cardState = _ref2.cardState,
80
+ _ref2$cardActions = _ref2.cardActions,
81
+ cardActions = _ref2$cardActions === void 0 ? [] : _ref2$cardActions,
82
+ isAISummaryEnabled = _ref2.isAISummaryEnabled,
83
+ onActionClick = _ref2.onActionClick,
84
+ extensionKey = _ref2.extensionKey,
85
+ url = _ref2.url;
62
86
  var canBeDatasource = getCanBeDatasource(cardState.details);
63
87
  useEffect(function () {
64
88
  // Since this hover view is only rendered on resolved status,
@@ -90,6 +114,15 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
90
114
  var _snippetBlockRef$curr, _snippetBlockRef$curr2;
91
115
  snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
92
116
  }, []);
117
+
118
+ // We want to maintain the height of the HoverCard while summarizing and pass this height to the AISummaryBlock.
119
+ // This approach will prevent any abrupt changes in the height of the HoverCard.
120
+ var connectedAIBlockHeight = React.useRef(0);
121
+ var connectedAIBlockRef = useRef(null);
122
+ var onConnectedAIBlockRender = useCallback(function () {
123
+ var _connectedAIBlockRef$, _connectedAIBlockRef$2;
124
+ connectedAIBlockHeight.current = (_connectedAIBlockRef$ = (_connectedAIBlockRef$2 = connectedAIBlockRef.current) === null || _connectedAIBlockRef$2 === void 0 ? void 0 : _connectedAIBlockRef$2.getBoundingClientRect().height) !== null && _connectedAIBlockRef$ !== void 0 ? _connectedAIBlockRef$ : 0;
125
+ }, []);
93
126
  var imagePreview = ImagePreview({
94
127
  data: data,
95
128
  fallbackElementHeight: snippetHeight.current
@@ -102,16 +135,31 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
102
135
  overrideCss: metadataBlockCss,
103
136
  maxLines: 1,
104
137
  size: SmartLinkSize.Medium
105
- }), !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, {
138
+ }), isAISummaryEnabled &&
139
+ /*#__PURE__*/
140
+ // All custom elements should be contained within a CustomBlock.
141
+ // Flex Container components check whether the direct child is a flex blocks. It removes anything that isn't
142
+ React.createElement(CustomBlock, {
143
+ direction: SmartLinkDirection.Vertical,
144
+ onRender: onConnectedAIBlockRender,
145
+ blockRef: connectedAIBlockRef
146
+ }, /*#__PURE__*/React.createElement(ConnectedAIBlock, {
147
+ imagePreview: !!imagePreview,
148
+ url: url,
149
+ bottomPrimary: bottomPrimary
150
+ })), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
151
+ status: SmartLinkStatus.Resolved
152
+ }), /*#__PURE__*/React.createElement(SnippetBlock, {
106
153
  testId: 'hidden-snippet',
107
154
  onRender: onSnippetRender,
108
155
  blockRef: snippetBlockRef,
109
156
  overrideCss: hiddenSnippetStyles
110
- }), /*#__PURE__*/React.createElement(MetadataBlock, {
157
+ }), !isAISummaryEnabled && /*#__PURE__*/React.createElement(MetadataBlock, {
111
158
  primary: bottomPrimary,
112
159
  size: SmartLinkSize.Large,
113
160
  overrideCss: metadataBlockCss,
114
- maxLines: 1
161
+ maxLines: 1,
162
+ status: SmartLinkStatus.Resolved
115
163
  }), getBooleanFF('platform.linking-platform.smart-card.enable-hover-card-related-urls') && /*#__PURE__*/React.createElement(RelatedUrlsBlock, {
116
164
  url: url,
117
165
  size: SmartLinkSize.Small
@@ -120,7 +168,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
120
168
  name: ElementName.Provider
121
169
  }],
122
170
  actions: footerActions,
123
- onAIActionChange: onAIActionChange
171
+ aiSummaryMinHeight: connectedAIBlockHeight.current
124
172
  }) : /*#__PURE__*/React.createElement(FooterBlock, {
125
173
  actions: footerActions,
126
174
  size: SmartLinkSize.Large,
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
10
10
  import LinkWarningModal from './LinkWarningModal';
11
11
  var PACKAGE_DATA = {
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "26.49.0",
13
+ packageVersion: "26.49.2",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -1,6 +1,5 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
- import React from 'react';
4
3
  import { useThemeObserver } from '@atlaskit/tokens';
5
4
  import { AI_BORDER_PALETTE, INNER_BORDER_RADIUS } from './constants';
6
5
  import AIGlowingBorder from './ai-glowing-border';
@@ -23,14 +23,17 @@ var AISummaryCSS = css({
23
23
  */
24
24
 
25
25
  var AISummary = function AISummary(_ref) {
26
- var content = _ref.content,
26
+ var _ref$content = _ref.content,
27
+ content = _ref$content === void 0 ? '' : _ref$content,
27
28
  _ref$showIcon = _ref.showIcon,
28
29
  showIcon = _ref$showIcon === void 0 ? false : _ref$showIcon,
29
30
  iconComponent = _ref.iconComponent,
30
31
  overrideCss = _ref.overrideCss,
31
32
  _ref$testId = _ref.testId,
32
- testId = _ref$testId === void 0 ? 'ai-summary' : _ref$testId;
33
- if (!content) {
33
+ testId = _ref$testId === void 0 ? 'ai-summary' : _ref$testId,
34
+ _ref$minHeight = _ref.minHeight,
35
+ minHeight = _ref$minHeight === void 0 ? 0 : _ref$minHeight;
36
+ if (!content && minHeight === 0) {
34
37
  return null;
35
38
  }
36
39
  return jsx(Markdown, {
@@ -42,6 +45,9 @@ var AISummary = function AISummary(_ref) {
42
45
  overrides: {
43
46
  Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon
44
47
  }
48
+ },
49
+ style: {
50
+ minHeight: minHeight
45
51
  }
46
52
  });
47
53
  };
@@ -34,7 +34,9 @@ export type StateSetter = (state: AISummaryState) => any;
34
34
  export type StreamMessage = StreamTrace | StreamAnswerPart | StreamResponse | StreamError;
35
35
  export type StreamResponse = {
36
36
  type: 'FINAL_RESPONSE';
37
- message: Message;
37
+ message: {
38
+ message: Message;
39
+ };
38
40
  millisOffset?: number;
39
41
  metadata?: {
40
42
  request_id?: string;
@@ -1,6 +1,5 @@
1
1
  import type { AISummaryServiceProps, AISummaryStatus } from './ai-summary-service/types';
2
2
  export declare const useAISummary: (props: AISummaryServiceProps) => {
3
- isSummarisedOnMount: boolean;
4
3
  summariseUrl: () => Promise<void> | undefined;
5
4
  state: {
6
5
  status: AISummaryStatus;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ /// <reference types="react" />
2
2
  import { UnresolvedViewProps } from './types';
3
- declare const UnresolvedView: FC<UnresolvedViewProps>;
3
+ declare const UnresolvedView: ({ actions, cardState, children, onAuthorize, onClick, onError, showPreview, testId, title, url, }: UnresolvedViewProps) => JSX.Element;
4
4
  export default UnresolvedView;
@@ -1,7 +1,8 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import type { ActionItem } from '../../../../FlexibleCard/components/blocks/types';
2
3
  import type { FlexibleBlockCardProps } from '../types';
3
- export type UnresolvedViewProps = FlexibleBlockCardProps & {
4
+ export type UnresolvedViewProps = PropsWithChildren<FlexibleBlockCardProps & {
4
5
  actions?: ActionItem[];
5
6
  showPreview?: boolean;
6
7
  title?: string;
7
- };
8
+ }>;
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- declare const AIEventErrorViewed: React.FC;
1
+ declare const AIEventErrorViewed: () => null;
3
2
  export default AIEventErrorViewed;
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import type { XCSS } from '@atlaskit/primitives';
3
3
  import type { TooltipProps } from '@atlaskit/tooltip';
4
- import type { AIState } from '../types';
4
+ import type { AISummaryStatus } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
5
5
  export type AIStateAppearance = 'default' | 'icon-only';
6
6
  export type AIStateIndicatorProps = {
7
7
  appearance?: AIStateAppearance;
8
- state: AIState;
8
+ state: AISummaryStatus;
9
9
  testId?: string;
10
10
  };
11
11
  export type AIIndicatorContainerProps = {
@@ -1,6 +1,5 @@
1
1
  import { ActionItem, BlockProps, ElementItem } from '../types';
2
2
  import { OnActionMenuOpenChangeOptions } from '../types';
3
- export type AIState = 'ready' | 'loading' | 'error' | 'done';
4
3
  export type AISummaryBlockProps = {
5
4
  /**
6
5
  * An array of actions to be displayed on the right
@@ -18,7 +17,7 @@ export type AISummaryBlockProps = {
18
17
  */
19
18
  onActionMenuOpenChange?: (options: OnActionMenuOpenChangeOptions) => void;
20
19
  /**
21
- * Function to be called when AI Summary state changed.
20
+ * Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
22
21
  */
23
- onAIActionChange?: (state: AIState) => void;
22
+ aiSummaryMinHeight?: number;
24
23
  } & BlockProps;
@@ -1,5 +1,4 @@
1
- /** @jsx jsx */
2
- import React from 'react';
1
+ import { jsx } from '@emotion/react';
3
2
  import { BlockProps } from '../types';
4
3
  /**
5
4
  * A block represents a collection of elements and actions that are arranged
@@ -8,5 +7,5 @@ import { BlockProps } from '../types';
8
7
  * @param {ActionGroupProps} ActionGroupProps
9
8
  * @see Action
10
9
  */
11
- declare const Block: React.FC<BlockProps>;
10
+ declare const Block: ({ children, direction, size, testId, overrideCss, blockRef, onRender, onTransitionEnd, }: BlockProps) => jsx.JSX.Element;
12
11
  export default Block;
@@ -1,6 +1,5 @@
1
1
  /** @jsx jsx */
2
- import React from 'react';
3
- import { SerializedStyles } from '@emotion/react';
2
+ import { jsx, SerializedStyles } from '@emotion/react';
4
3
  import { ElementGroupProps } from './types';
5
4
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
6
5
  export declare const getElementGroupStyles: (direction: SmartLinkDirection, size: SmartLinkSize, align: SmartLinkAlignment, width: SmartLinkWidth, position: SmartLinkPosition) => SerializedStyles;
@@ -11,5 +10,5 @@ export declare const getElementGroupStyles: (direction: SmartLinkDirection, size
11
10
  * @param {ActionGroupProps} ActionGroupProps
12
11
  * @see Action
13
12
  */
14
- declare const ElementGroup: React.FC<ElementGroupProps>;
13
+ declare const ElementGroup: ({ align, children, overrideCss, direction, size, testId, width, position, }: ElementGroupProps) => jsx.JSX.Element;
15
14
  export default ElementGroup;
@@ -1,6 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import { SerializedStyles } from '@emotion/react';
2
3
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
3
- export type ElementGroupProps = {
4
+ export type ElementGroupProps = PropsWithChildren<{
4
5
  align?: SmartLinkAlignment;
5
6
  direction?: SmartLinkDirection;
6
7
  overrideCss?: SerializedStyles;
@@ -8,4 +9,4 @@ export type ElementGroupProps = {
8
9
  width?: SmartLinkWidth;
9
10
  testId?: string;
10
11
  position?: SmartLinkPosition;
11
- };
12
+ }>;
@@ -1,8 +1,8 @@
1
1
  import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize, SmartLinkStatus } from '../../../../constants';
2
2
  import { SerializedStyles } from '@emotion/react';
3
3
  import { ActionProps } from '../actions/action/types';
4
- import { Ref } from 'react';
5
- export type BlockProps = {
4
+ import { PropsWithChildren, Ref } from 'react';
5
+ export type BlockProps = PropsWithChildren<{
6
6
  /**
7
7
  * The direction that the block should arrange it's elements. Can be vertical
8
8
  * or horizontal. Default is horizontal.
@@ -44,7 +44,7 @@ export type BlockProps = {
44
44
  * @internal
45
45
  */
46
46
  onTransitionEnd?: () => void;
47
- };
47
+ }>;
48
48
  /**
49
49
  * Used to represent a metadata element to be rendered.
50
50
  */
@@ -1,4 +1,4 @@
1
- import type { FC } from 'react';
1
+ /// <reference types="react" />
2
2
  import { HoverCardDelayProps } from './types';
3
- declare const HoverCardControl: FC<HoverCardDelayProps>;
3
+ declare const HoverCardControl: ({ children, hideHoverCardPreviewButton, isHoverPreview, isAuthTooltip, actionOptions, testId, url, delay, }: HoverCardDelayProps) => JSX.Element;
4
4
  export default HoverCardControl;
@@ -1,8 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import { ContainerProps } from '../types';
2
- export type HoverCardDelayProps = Pick<ContainerProps, 'hideHoverCardPreviewButton' | 'actionOptions'> & {
3
+ export type HoverCardDelayProps = PropsWithChildren<Pick<ContainerProps, 'hideHoverCardPreviewButton' | 'actionOptions'> & {
3
4
  isHoverPreview?: boolean;
4
5
  isAuthTooltip?: boolean;
5
6
  testId?: string;
6
7
  url: string;
7
8
  delay?: number;
8
- };
9
+ }>;
@@ -1,6 +1,4 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { SerializedStyles } from '@emotion/react';
1
+ import { jsx, SerializedStyles } from '@emotion/react';
4
2
  import { SmartLinkSize } from '../../../../constants';
5
3
  import { ChildrenOptions, ContainerProps } from './types';
6
4
  export declare const getContainerStyles: (size: SmartLinkSize, hideBackground: boolean, hideElevation: boolean, hidePadding: boolean, clickableContainer: boolean, childrenOptions: ChildrenOptions) => SerializedStyles;
@@ -12,5 +10,5 @@ export declare const getContainerStyles: (size: SmartLinkSize, hideBackground: b
12
10
  * @internal
13
11
  * @see Block
14
12
  */
15
- declare const Container: React.FC<ContainerProps>;
13
+ declare const Container: ({ children, clickableContainer, hideBackground, hideElevation, hideHoverCardPreviewButton, hidePadding, onClick, retry, showAuthTooltip, showHoverPreview, actionOptions, size, status, testId, theme, }: ContainerProps) => jsx.JSX.Element;
16
14
  export default Container;
@@ -1,6 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import { SmartLinkStatus } from '../../../../constants';
2
3
  import { FlexibleCardProps, FlexibleUiOptions, RetryOptions } from '../../types';
3
- export type ContainerProps = Pick<FlexibleCardProps, 'onClick' | 'showHoverPreview' | 'actionOptions' | 'showAuthTooltip'> & FlexibleUiOptions & {
4
+ export type ContainerProps = PropsWithChildren<Pick<FlexibleCardProps, 'onClick' | 'showHoverPreview' | 'actionOptions' | 'showAuthTooltip'> & FlexibleUiOptions & {
4
5
  /**
5
6
  * The options that determine the retry behaviour when a Smart Link errors.
6
7
  */
@@ -16,7 +17,7 @@ export type ContainerProps = Pick<FlexibleCardProps, 'onClick' | 'showHoverPrevi
16
17
  * serving as a hook for automated tests
17
18
  */
18
19
  testId?: string;
19
- };
20
+ }>;
20
21
  export type ChildrenOptions = {
21
22
  previewOnLeft?: boolean;
22
23
  previewOnRight?: boolean;
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import type { ContentContainerProps } from '../types';
3
- declare const ContentContainer: React.FC<ContentContainerProps>;
4
+ declare const ContentContainer: ({ children, isAIEnabled, testId, url, ...props }: ContentContainerProps) => jsx.JSX.Element;
4
5
  export default ContentContainer;
@@ -2,7 +2,6 @@ import { AnalyticsFacade } from '../../../../../state/analytics';
2
2
  import { LinkAction } from '../../../../../state/hooks-external/useSmartLinkActions';
3
3
  import { CardState } from '@atlaskit/linking-common';
4
4
  import { HoverCardLoadingViewProps } from '../resolving/types';
5
- import { AISummaryBlockProps } from '../../../../FlexibleCard/components/blocks/ai-summary-block/types';
6
5
  export type HoverCardResolvedProps = {
7
6
  extensionKey?: string;
8
7
  id?: string;
@@ -12,5 +11,4 @@ export type HoverCardResolvedProps = {
12
11
  cardState: CardState;
13
12
  isAISummaryEnabled?: boolean;
14
13
  onActionClick: (actionId: string) => void;
15
- onAIActionChange?: AISummaryBlockProps['onAIActionChange'];
16
14
  } & HoverCardLoadingViewProps;
@@ -101,8 +101,8 @@ export type HoverCardContentProps = {
101
101
  };
102
102
  export type ContentContainerProps = React.HTMLAttributes<HTMLDivElement> & {
103
103
  isAIEnabled?: boolean;
104
- showPrism?: boolean;
105
104
  testId?: string;
105
+ url: string;
106
106
  };
107
107
  export type ImagePreviewProps = {
108
108
  data: JsonLd.Data.BaseData;
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import type { AIPrismProps } from './types';
3
- declare const AIPrism: React.FC<AIPrismProps>;
4
+ declare const AIPrism: ({ children, isGlowing, isMoving, isVisible, testId, }: AIPrismProps) => jsx.JSX.Element;
4
5
  export default AIPrism;
@@ -1,7 +1,8 @@
1
+ import { type PropsWithChildren } from 'react';
1
2
  import { AIGlowingBorderProps } from './ai-glowing-border/types';
2
- export type AIPrismProps = Pick<AIGlowingBorderProps, 'isMoving' | 'isGlowing' | 'testId'> & {
3
+ export type AIPrismProps = PropsWithChildren<Pick<AIGlowingBorderProps, 'isMoving' | 'isGlowing' | 'testId'> & {
3
4
  isVisible?: boolean;
4
- };
5
+ }>;
5
6
  export type AIBorderPalette = {
6
7
  blue: string;
7
8
  yellow: string;
@@ -12,6 +12,10 @@ type AISummaryProps = {
12
12
  * serving as a hook for automated tests
13
13
  */
14
14
  testId?: string;
15
+ /**
16
+ * Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
17
+ */
18
+ minHeight?: number;
15
19
  };
16
20
  /**
17
21
  * A component to render a response from AI in markdown text.
@@ -34,7 +34,9 @@ export type StateSetter = (state: AISummaryState) => any;
34
34
  export type StreamMessage = StreamTrace | StreamAnswerPart | StreamResponse | StreamError;
35
35
  export type StreamResponse = {
36
36
  type: 'FINAL_RESPONSE';
37
- message: Message;
37
+ message: {
38
+ message: Message;
39
+ };
38
40
  millisOffset?: number;
39
41
  metadata?: {
40
42
  request_id?: string;
@@ -1,6 +1,5 @@
1
1
  import type { AISummaryServiceProps, AISummaryStatus } from './ai-summary-service/types';
2
2
  export declare const useAISummary: (props: AISummaryServiceProps) => {
3
- isSummarisedOnMount: boolean;
4
3
  summariseUrl: () => Promise<void> | undefined;
5
4
  state: {
6
5
  status: AISummaryStatus;
@@ -1,4 +1,4 @@
1
- import { type FC } from 'react';
1
+ /// <reference types="react" />
2
2
  import { UnresolvedViewProps } from './types';
3
- declare const UnresolvedView: FC<UnresolvedViewProps>;
3
+ declare const UnresolvedView: ({ actions, cardState, children, onAuthorize, onClick, onError, showPreview, testId, title, url, }: UnresolvedViewProps) => JSX.Element;
4
4
  export default UnresolvedView;
@@ -1,7 +1,8 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import type { ActionItem } from '../../../../FlexibleCard/components/blocks/types';
2
3
  import type { FlexibleBlockCardProps } from '../types';
3
- export type UnresolvedViewProps = FlexibleBlockCardProps & {
4
+ export type UnresolvedViewProps = PropsWithChildren<FlexibleBlockCardProps & {
4
5
  actions?: ActionItem[];
5
6
  showPreview?: boolean;
6
7
  title?: string;
7
- };
8
+ }>;
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- declare const AIEventErrorViewed: React.FC;
1
+ declare const AIEventErrorViewed: () => null;
3
2
  export default AIEventErrorViewed;
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import type { XCSS } from '@atlaskit/primitives';
3
3
  import type { TooltipProps } from '@atlaskit/tooltip';
4
- import type { AIState } from '../types';
4
+ import type { AISummaryStatus } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
5
5
  export type AIStateAppearance = 'default' | 'icon-only';
6
6
  export type AIStateIndicatorProps = {
7
7
  appearance?: AIStateAppearance;
8
- state: AIState;
8
+ state: AISummaryStatus;
9
9
  testId?: string;
10
10
  };
11
11
  export type AIIndicatorContainerProps = {
@@ -1,6 +1,5 @@
1
1
  import { ActionItem, BlockProps, ElementItem } from '../types';
2
2
  import { OnActionMenuOpenChangeOptions } from '../types';
3
- export type AIState = 'ready' | 'loading' | 'error' | 'done';
4
3
  export type AISummaryBlockProps = {
5
4
  /**
6
5
  * An array of actions to be displayed on the right
@@ -18,7 +17,7 @@ export type AISummaryBlockProps = {
18
17
  */
19
18
  onActionMenuOpenChange?: (options: OnActionMenuOpenChangeOptions) => void;
20
19
  /**
21
- * Function to be called when AI Summary state changed.
20
+ * Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
22
21
  */
23
- onAIActionChange?: (state: AIState) => void;
22
+ aiSummaryMinHeight?: number;
24
23
  } & BlockProps;
@@ -1,5 +1,4 @@
1
- /** @jsx jsx */
2
- import React from 'react';
1
+ import { jsx } from '@emotion/react';
3
2
  import { BlockProps } from '../types';
4
3
  /**
5
4
  * A block represents a collection of elements and actions that are arranged
@@ -8,5 +7,5 @@ import { BlockProps } from '../types';
8
7
  * @param {ActionGroupProps} ActionGroupProps
9
8
  * @see Action
10
9
  */
11
- declare const Block: React.FC<BlockProps>;
10
+ declare const Block: ({ children, direction, size, testId, overrideCss, blockRef, onRender, onTransitionEnd, }: BlockProps) => jsx.JSX.Element;
12
11
  export default Block;
@@ -1,6 +1,5 @@
1
1
  /** @jsx jsx */
2
- import React from 'react';
3
- import { SerializedStyles } from '@emotion/react';
2
+ import { jsx, SerializedStyles } from '@emotion/react';
4
3
  import { ElementGroupProps } from './types';
5
4
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
6
5
  export declare const getElementGroupStyles: (direction: SmartLinkDirection, size: SmartLinkSize, align: SmartLinkAlignment, width: SmartLinkWidth, position: SmartLinkPosition) => SerializedStyles;
@@ -11,5 +10,5 @@ export declare const getElementGroupStyles: (direction: SmartLinkDirection, size
11
10
  * @param {ActionGroupProps} ActionGroupProps
12
11
  * @see Action
13
12
  */
14
- declare const ElementGroup: React.FC<ElementGroupProps>;
13
+ declare const ElementGroup: ({ align, children, overrideCss, direction, size, testId, width, position, }: ElementGroupProps) => jsx.JSX.Element;
15
14
  export default ElementGroup;
@@ -1,6 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import { SerializedStyles } from '@emotion/react';
2
3
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
3
- export type ElementGroupProps = {
4
+ export type ElementGroupProps = PropsWithChildren<{
4
5
  align?: SmartLinkAlignment;
5
6
  direction?: SmartLinkDirection;
6
7
  overrideCss?: SerializedStyles;
@@ -8,4 +9,4 @@ export type ElementGroupProps = {
8
9
  width?: SmartLinkWidth;
9
10
  testId?: string;
10
11
  position?: SmartLinkPosition;
11
- };
12
+ }>;
@@ -1,8 +1,8 @@
1
1
  import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize, SmartLinkStatus } from '../../../../constants';
2
2
  import { SerializedStyles } from '@emotion/react';
3
3
  import { ActionProps } from '../actions/action/types';
4
- import { Ref } from 'react';
5
- export type BlockProps = {
4
+ import { PropsWithChildren, Ref } from 'react';
5
+ export type BlockProps = PropsWithChildren<{
6
6
  /**
7
7
  * The direction that the block should arrange it's elements. Can be vertical
8
8
  * or horizontal. Default is horizontal.
@@ -44,7 +44,7 @@ export type BlockProps = {
44
44
  * @internal
45
45
  */
46
46
  onTransitionEnd?: () => void;
47
- };
47
+ }>;
48
48
  /**
49
49
  * Used to represent a metadata element to be rendered.
50
50
  */
@@ -1,4 +1,4 @@
1
- import type { FC } from 'react';
1
+ /// <reference types="react" />
2
2
  import { HoverCardDelayProps } from './types';
3
- declare const HoverCardControl: FC<HoverCardDelayProps>;
3
+ declare const HoverCardControl: ({ children, hideHoverCardPreviewButton, isHoverPreview, isAuthTooltip, actionOptions, testId, url, delay, }: HoverCardDelayProps) => JSX.Element;
4
4
  export default HoverCardControl;
@@ -1,8 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
1
2
  import { ContainerProps } from '../types';
2
- export type HoverCardDelayProps = Pick<ContainerProps, 'hideHoverCardPreviewButton' | 'actionOptions'> & {
3
+ export type HoverCardDelayProps = PropsWithChildren<Pick<ContainerProps, 'hideHoverCardPreviewButton' | 'actionOptions'> & {
3
4
  isHoverPreview?: boolean;
4
5
  isAuthTooltip?: boolean;
5
6
  testId?: string;
6
7
  url: string;
7
8
  delay?: number;
8
- };
9
+ }>;