@atlaskit/smart-card 26.50.8 → 26.50.10

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 (31) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/state/hooks/use-ai-summary/index.js +2 -3
  3. package/dist/cjs/utils/analytics/analytics.js +1 -1
  4. package/dist/cjs/view/EmbedCard/components/styled.js +1 -1
  5. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +1 -1
  6. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +4 -1
  7. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/styled.js +1 -1
  8. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -1
  9. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +10 -5
  10. package/dist/cjs/view/LinkUrl/index.js +1 -1
  11. package/dist/es2019/state/hooks/use-ai-summary/index.js +2 -2
  12. package/dist/es2019/utils/analytics/analytics.js +1 -1
  13. package/dist/es2019/view/EmbedCard/components/styled.js +1 -1
  14. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +2 -1
  15. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +4 -1
  16. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/styled.js +1 -1
  17. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -1
  18. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +10 -3
  19. package/dist/es2019/view/LinkUrl/index.js +1 -1
  20. package/dist/esm/state/hooks/use-ai-summary/index.js +2 -3
  21. package/dist/esm/utils/analytics/analytics.js +1 -1
  22. package/dist/esm/view/EmbedCard/components/styled.js +1 -1
  23. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +2 -1
  24. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +4 -1
  25. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/styled.js +1 -1
  26. package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -1
  27. package/dist/esm/view/HoverCard/components/views/resolved/index.js +10 -5
  28. package/dist/esm/view/LinkUrl/index.js +1 -1
  29. package/dist/types/view/HoverCard/components/HoverCardContent.d.ts +3 -2
  30. package/dist/types-ts4.5/view/HoverCard/components/HoverCardContent.d.ts +3 -2
  31. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.50.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#83297](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83297) [`6b1707c169e0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b1707c169e0) - The internal composition of this component has changed. There is no expected change in behaviour.
8
+
9
+ ## 26.50.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [#82969](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82969) [`cae58d4129ff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cae58d4129ff) - Display the AI Summary component only when there is summary content available
14
+ - [#83188](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83188) [`cd5d06cd3329`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cd5d06cd3329) - Minor adjustments to improve compatibility with React 18
15
+
3
16
  ## 26.50.8
4
17
 
5
18
  ### Patch Changes
@@ -34,10 +34,9 @@ var useAISummary = exports.useAISummary = function useAISummary(props) {
34
34
  fireEvent('operational.summary.success', {});
35
35
  (0, _analytics.succeedUfoExperience)(EXPERIENCE_NAME, id);
36
36
  }, [fireEvent]);
37
- var onError = (0, _react.useCallback)(function (id) {
38
- var reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
37
+ var onError = (0, _react.useCallback)(function (id, reason) {
39
38
  fireEvent('operational.summary.failed', {
40
- reason: reason
39
+ reason: reason || null
41
40
  });
42
41
  (0, _analytics.failUfoExperience)(EXPERIENCE_NAME, id);
43
42
  }, [fireEvent]);
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
22
22
  var context = exports.context = {
23
23
  componentName: 'smart-cards',
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "26.50.8"
25
+ packageVersion: "26.50.10"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -86,7 +86,7 @@ var Wrapper = exports.Wrapper = _styled.default.div(function (props) {
86
86
  }, {
87
87
  // We are keeping this margin as a hardcoded variable as it is not a standard token size and needs
88
88
  // to be thoroughly checked with a designer so that we do not miss an unintended visual change
89
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
89
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-space
90
90
  marginTop: '10px'
91
91
  });
92
92
  var embedHeaderHeight = exports.embedHeaderHeight = 32;
@@ -31,7 +31,7 @@ var styles = (0, _react2.css)({
31
31
  '> div': {
32
32
  alignItems: 'center',
33
33
  'button:focus-visible': {
34
- outlineOffset: '-2px'
34
+ outlineOffset: "var(--ds-space-negative-025, -2px)"
35
35
  }
36
36
  }
37
37
  });
@@ -49,7 +49,9 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
49
49
  _useAISummary$state = _useAISummary.state,
50
50
  content = _useAISummary$state.content,
51
51
  status = _useAISummary$state.status;
52
- var showAISummary = status !== 'ready' && status !== 'error';
52
+ var showAISummary = status === 'done' ||
53
+ // We want to display the AI Summary component only when there is content available during the loading process.
54
+ status === 'loading' && !!content;
53
55
  var isSummarisedOnMountRef = (0, _react.useRef)(status === 'done');
54
56
  var isErroredOnMountRef = (0, _react.useRef)(status === 'error');
55
57
  var _useState = (0, _react.useState)(false),
@@ -95,6 +97,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
95
97
  }), status === 'done' && /*#__PURE__*/_react.default.createElement(_aiEventSummaryViewed.default, {
96
98
  fromCache: isSummarisedOnMountRef.current
97
99
  }), showAISummary && /*#__PURE__*/_react.default.createElement(_aiSummary.default, {
100
+ testId: "".concat(testId, "-ai-summary"),
98
101
  minHeight: aiSummaryMinHeight,
99
102
  content: content,
100
103
  showIcon: isSummarisedOnMountRef.current
@@ -18,7 +18,7 @@ var dropdownItemGroupStyles = exports.dropdownItemGroupStyles = (0, _react.css)(
18
18
  });
19
19
  var sharedBlockStyles = (0, _react.css)({
20
20
  display: 'flex',
21
- gap: '0.5rem',
21
+ gap: "var(--ds-space-100, 0.5rem)",
22
22
  lineHeight: '1rem',
23
23
  minWidth: 0,
24
24
  overflow: 'hidden',
@@ -162,7 +162,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
162
162
  actionOptions: actionOptions,
163
163
  ui: _styled.flexibleUiOptions,
164
164
  url: url,
165
- children: {},
165
+ children: null,
166
166
  analytics: analytics
167
167
  };
168
168
  var onClickStopPropagation = (0, _react2.useCallback)(function (e) {
@@ -64,12 +64,17 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
64
64
  var bottomPrimary = _ref.bottomPrimary,
65
65
  imagePreview = _ref.imagePreview,
66
66
  url = _ref.url;
67
- var aiSummary = (0, _useAiSummary.useAISummary)({
68
- url: url
69
- });
70
- var aiStatus = aiSummary.state.status;
71
- var showData = aiStatus === 'ready' || aiStatus === 'error';
67
+ var _useAISummary = (0, _useAiSummary.useAISummary)({
68
+ url: url
69
+ }),
70
+ _useAISummary$state = _useAISummary.state,
71
+ status = _useAISummary$state.status,
72
+ content = _useAISummary$state.content;
73
+ var showData = status === 'ready' || status === 'error' ||
74
+ // Description & bottom metadata should only disappear when we start getting summary content
75
+ !content && status === 'loading';
72
76
  return showData ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !imagePreview && /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
77
+ testId: 'connected-AI',
73
78
  status: _constants.SmartLinkStatus.Resolved
74
79
  }), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
75
80
  primary: bottomPrimary,
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
17
17
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
18
18
  var PACKAGE_DATA = {
19
19
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "26.50.8",
20
+ packageVersion: "26.50.10",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -26,9 +26,9 @@ export const useAISummary = props => {
26
26
  fireEvent('operational.summary.success', {});
27
27
  succeedUfoExperience(EXPERIENCE_NAME, id);
28
28
  }, [fireEvent]);
29
- const onError = useCallback((id, reason = null) => {
29
+ const onError = useCallback((id, reason) => {
30
30
  fireEvent('operational.summary.failed', {
31
- reason
31
+ reason: reason || null
32
32
  });
33
33
  failUfoExperience(EXPERIENCE_NAME, id);
34
34
  }, [fireEvent]);
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "26.50.8"
7
+ packageVersion: "26.50.10"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -146,7 +146,7 @@ export const LinkWrapper = styled.div`
146
146
  export const Wrapper = styled.div(props => wrapperStyles(props), {
147
147
  // We are keeping this margin as a hardcoded variable as it is not a standard token size and needs
148
148
  // to be thoroughly checked with a designer so that we do not miss an unintended visual change
149
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
149
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-space
150
150
  marginTop: '10px'
151
151
  });
152
152
  export const embedHeaderHeight = 32;
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
+
3
4
  import { useCallback, useMemo, useState } from 'react';
4
5
  import { FormattedMessage } from 'react-intl-next';
5
6
  import { css, jsx } from '@emotion/react';
@@ -21,7 +22,7 @@ const styles = css({
21
22
  '> div': {
22
23
  alignItems: 'center',
23
24
  'button:focus-visible': {
24
- outlineOffset: '-2px'
25
+ outlineOffset: "var(--ds-space-negative-025, -2px)"
25
26
  }
26
27
  }
27
28
  });
@@ -40,7 +40,9 @@ const AISummaryBlockResolvedView = props => {
40
40
  } = useAISummary({
41
41
  url
42
42
  });
43
- const showAISummary = status !== 'ready' && status !== 'error';
43
+ const showAISummary = status === 'done' ||
44
+ // We want to display the AI Summary component only when there is content available during the loading process.
45
+ status === 'loading' && !!content;
44
46
  const isSummarisedOnMountRef = useRef(status === 'done');
45
47
  let isErroredOnMountRef = useRef(status === 'error');
46
48
  const [showAISummaryErrorMessage, setShowAISummaryErrorMessage] = useState(false);
@@ -83,6 +85,7 @@ const AISummaryBlockResolvedView = props => {
83
85
  }), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
84
86
  fromCache: isSummarisedOnMountRef.current
85
87
  }), showAISummary && /*#__PURE__*/React.createElement(AISummary, {
88
+ testId: `${testId}-ai-summary`,
86
89
  minHeight: aiSummaryMinHeight,
87
90
  content: content,
88
91
  showIcon: isSummarisedOnMountRef.current
@@ -12,7 +12,7 @@ export const dropdownItemGroupStyles = css({
12
12
  });
13
13
  const sharedBlockStyles = css({
14
14
  display: 'flex',
15
- gap: '0.5rem',
15
+ gap: "var(--ds-space-100, 0.5rem)",
16
16
  lineHeight: '1rem',
17
17
  minWidth: 0,
18
18
  overflow: 'hidden',
@@ -126,7 +126,7 @@ const HoverCardContent = ({
126
126
  actionOptions,
127
127
  ui: flexibleUiOptions,
128
128
  url: url,
129
- children: {},
129
+ children: null,
130
130
  analytics
131
131
  };
132
132
  const onClickStopPropagation = useCallback(e => e.stopPropagation(), []);
@@ -55,12 +55,19 @@ const ConnectedAIBlock = ({
55
55
  imagePreview,
56
56
  url
57
57
  }) => {
58
- const aiSummary = useAISummary({
58
+ const {
59
+ state: {
60
+ status,
61
+ content
62
+ }
63
+ } = useAISummary({
59
64
  url
60
65
  });
61
- const aiStatus = aiSummary.state.status;
62
- const showData = aiStatus === 'ready' || aiStatus === 'error';
66
+ const showData = status === 'ready' || status === 'error' ||
67
+ // Description & bottom metadata should only disappear when we start getting summary content
68
+ !content && status === 'loading';
63
69
  return showData ? /*#__PURE__*/React.createElement(React.Fragment, null, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
70
+ testId: 'connected-AI',
64
71
  status: SmartLinkStatus.Resolved
65
72
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
66
73
  primary: bottomPrimary,
@@ -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.50.8",
10
+ packageVersion: "26.50.10",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -27,10 +27,9 @@ export var useAISummary = function useAISummary(props) {
27
27
  fireEvent('operational.summary.success', {});
28
28
  succeedUfoExperience(EXPERIENCE_NAME, id);
29
29
  }, [fireEvent]);
30
- var onError = useCallback(function (id) {
31
- var reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
30
+ var onError = useCallback(function (id, reason) {
32
31
  fireEvent('operational.summary.failed', {
33
- reason: reason
32
+ reason: reason || null
34
33
  });
35
34
  failUfoExperience(EXPERIENCE_NAME, id);
36
35
  }, [fireEvent]);
@@ -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.50.8"
18
+ packageVersion: "26.50.10"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -76,7 +76,7 @@ export var Wrapper = styled.div(function (props) {
76
76
  }, {
77
77
  // We are keeping this margin as a hardcoded variable as it is not a standard token size and needs
78
78
  // to be thoroughly checked with a designer so that we do not miss an unintended visual change
79
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
79
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-space
80
80
  marginTop: '10px'
81
81
  });
82
82
  export var embedHeaderHeight = 32;
@@ -3,6 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  var _excluded = ["triggerRef"];
5
5
  /** @jsx jsx */
6
+
6
7
  import { useCallback, useMemo, useState } from 'react';
7
8
  import { FormattedMessage } from 'react-intl-next';
8
9
  import { css, jsx } from '@emotion/react';
@@ -24,7 +25,7 @@ var styles = css({
24
25
  '> div': {
25
26
  alignItems: 'center',
26
27
  'button:focus-visible': {
27
- outlineOffset: '-2px'
28
+ outlineOffset: "var(--ds-space-negative-025, -2px)"
28
29
  }
29
30
  }
30
31
  });
@@ -39,7 +39,9 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
39
39
  _useAISummary$state = _useAISummary.state,
40
40
  content = _useAISummary$state.content,
41
41
  status = _useAISummary$state.status;
42
- var showAISummary = status !== 'ready' && status !== 'error';
42
+ var showAISummary = status === 'done' ||
43
+ // We want to display the AI Summary component only when there is content available during the loading process.
44
+ status === 'loading' && !!content;
43
45
  var isSummarisedOnMountRef = useRef(status === 'done');
44
46
  var isErroredOnMountRef = useRef(status === 'error');
45
47
  var _useState = useState(false),
@@ -85,6 +87,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
85
87
  }), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
86
88
  fromCache: isSummarisedOnMountRef.current
87
89
  }), showAISummary && /*#__PURE__*/React.createElement(AISummary, {
90
+ testId: "".concat(testId, "-ai-summary"),
88
91
  minHeight: aiSummaryMinHeight,
89
92
  content: content,
90
93
  showIcon: isSummarisedOnMountRef.current
@@ -12,7 +12,7 @@ export var dropdownItemGroupStyles = css({
12
12
  });
13
13
  var sharedBlockStyles = css({
14
14
  display: 'flex',
15
- gap: '0.5rem',
15
+ gap: "var(--ds-space-100, 0.5rem)",
16
16
  lineHeight: '1rem',
17
17
  minWidth: 0,
18
18
  overflow: 'hidden',
@@ -151,7 +151,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
151
151
  actionOptions: actionOptions,
152
152
  ui: flexibleUiOptions,
153
153
  url: url,
154
- children: {},
154
+ children: null,
155
155
  analytics: analytics
156
156
  };
157
157
  var onClickStopPropagation = useCallback(function (e) {
@@ -55,12 +55,17 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
55
55
  var bottomPrimary = _ref.bottomPrimary,
56
56
  imagePreview = _ref.imagePreview,
57
57
  url = _ref.url;
58
- var aiSummary = useAISummary({
59
- url: url
60
- });
61
- var aiStatus = aiSummary.state.status;
62
- var showData = aiStatus === 'ready' || aiStatus === 'error';
58
+ var _useAISummary = useAISummary({
59
+ url: url
60
+ }),
61
+ _useAISummary$state = _useAISummary.state,
62
+ status = _useAISummary$state.status,
63
+ content = _useAISummary$state.content;
64
+ var showData = status === 'ready' || status === 'error' ||
65
+ // Description & bottom metadata should only disappear when we start getting summary content
66
+ !content && status === 'loading';
63
67
  return showData ? /*#__PURE__*/React.createElement(React.Fragment, null, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
68
+ testId: 'connected-AI',
64
69
  status: SmartLinkStatus.Resolved
65
70
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
66
71
  primary: bottomPrimary,
@@ -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.50.8",
13
+ packageVersion: "26.50.10",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -1,7 +1,8 @@
1
- import React from 'react';
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import { ActionItem } from '../../FlexibleCard/components/blocks/types';
3
4
  import { HoverCardContentProps } from '../types';
4
5
  export declare const hoverCardClassName = "smart-links-hover-preview";
5
6
  export declare const getCopyAction: (url: string) => ActionItem;
6
- declare const HoverCardContent: React.FC<HoverCardContentProps>;
7
+ declare const HoverCardContent: ({ id, analytics: _analytics, cardActions, cardState, onActionClick, onResolve, renderers, url, onMouseEnter, onMouseLeave, actionOptions, }: HoverCardContentProps) => jsx.JSX.Element | null;
7
8
  export default HoverCardContent;
@@ -1,7 +1,8 @@
1
- import React from 'react';
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import { ActionItem } from '../../FlexibleCard/components/blocks/types';
3
4
  import { HoverCardContentProps } from '../types';
4
5
  export declare const hoverCardClassName = "smart-links-hover-preview";
5
6
  export declare const getCopyAction: (url: string) => ActionItem;
6
- declare const HoverCardContent: React.FC<HoverCardContentProps>;
7
+ declare const HoverCardContent: ({ id, analytics: _analytics, cardActions, cardState, onActionClick, onResolve, renderers, url, onMouseEnter, onMouseLeave, actionOptions, }: HoverCardContentProps) => jsx.JSX.Element | null;
7
8
  export default HoverCardContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.50.8",
3
+ "version": "26.50.10",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"