@atlaskit/smart-card 26.50.0 → 26.50.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.50.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#80939](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80939) [`fd0808b220fd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fd0808b220fd) - Use the URL provided by the smart card for AI Link Summary in Hover Card to avoid inconsistencies between the short and resolved links.
8
+ - Updated dependencies
9
+
10
+ ## 26.50.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [#81356](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81356) [`1b8f940e9229`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1b8f940e9229) - AI Summary: Handle error response during streaming
15
+
3
16
  ## 26.50.0
4
17
 
5
18
  ### Minor Changes
@@ -109,6 +109,7 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
109
109
  _iterator3,
110
110
  _step3,
111
111
  subscriber,
112
+ _chunk$message,
112
113
  _this$onError,
113
114
  _iterator4,
114
115
  _step4,
@@ -150,7 +151,7 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
150
151
  return _iterator.next();
151
152
  case 17:
152
153
  if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
153
- _context2.next = 24;
154
+ _context2.next = 26;
154
155
  break;
155
156
  }
156
157
  chunk = _step.value;
@@ -175,55 +176,60 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
175
176
  if (chunk.type === 'FINAL_RESPONSE') {
176
177
  bufferContent = chunk.message.message.content;
177
178
  }
178
- case 21:
179
+ if (!(chunk.type === 'ERROR')) {
180
+ _context2.next = 23;
181
+ break;
182
+ }
183
+ throw new Error(chunk === null || chunk === void 0 || (_chunk$message = chunk.message) === null || _chunk$message === void 0 ? void 0 : _chunk$message.message_template);
184
+ case 23:
179
185
  _iteratorAbruptCompletion = false;
180
186
  _context2.next = 15;
181
187
  break;
182
- case 24:
183
- _context2.next = 30;
184
- break;
185
188
  case 26:
186
- _context2.prev = 26;
189
+ _context2.next = 32;
190
+ break;
191
+ case 28:
192
+ _context2.prev = 28;
187
193
  _context2.t0 = _context2["catch"](13);
188
194
  _didIteratorError = true;
189
195
  _iteratorError = _context2.t0;
190
- case 30:
191
- _context2.prev = 30;
192
- _context2.prev = 31;
196
+ case 32:
197
+ _context2.prev = 32;
198
+ _context2.prev = 33;
193
199
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
194
- _context2.next = 35;
200
+ _context2.next = 37;
195
201
  break;
196
202
  }
197
- _context2.next = 35;
203
+ _context2.next = 37;
198
204
  return _iterator.return();
199
- case 35:
200
- _context2.prev = 35;
205
+ case 37:
206
+ _context2.prev = 37;
201
207
  if (!_didIteratorError) {
202
- _context2.next = 38;
208
+ _context2.next = 40;
203
209
  break;
204
210
  }
205
211
  throw _iteratorError;
206
- case 38:
207
- return _context2.finish(35);
208
- case 39:
209
- return _context2.finish(30);
210
212
  case 40:
213
+ return _context2.finish(37);
214
+ case 41:
215
+ return _context2.finish(32);
216
+ case 42:
211
217
  (_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 || _this$onSuccess.call(this, id);
212
218
  this.state = {
213
219
  status: 'done',
214
220
  content: bufferContent
215
221
  };
216
- _context2.next = 48;
222
+ _context2.next = 50;
217
223
  break;
218
- case 44:
219
- _context2.prev = 44;
224
+ case 46:
225
+ _context2.prev = 46;
220
226
  _context2.t1 = _context2["catch"](5);
221
227
  (_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, 'generic');
222
228
  this.state = {
223
229
  status: 'error',
224
230
  content: ''
225
231
  };
226
- case 48:
232
+ case 50:
227
233
  _iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
228
234
  try {
229
235
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -235,11 +241,11 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
235
241
  } finally {
236
242
  _iterator4.f();
237
243
  }
238
- case 50:
244
+ case 52:
239
245
  case "end":
240
246
  return _context2.stop();
241
247
  }
242
- }, _callee2, this, [[5, 44], [13, 26, 30, 40], [31,, 35, 39]]);
248
+ }, _callee2, this, [[5, 46], [13, 28, 32, 42], [33,, 37, 41]]);
243
249
  }));
244
250
  function summariseUrl() {
245
251
  return _summariseUrl.apply(this, arguments);
@@ -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.0"
25
+ packageVersion: "26.50.2"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -15,18 +15,23 @@ var _styled = require("../styled");
15
15
  var _aiPrism = _interopRequireDefault(require("../../common/ai-prism"));
16
16
  var _HoverCardContent = require("./HoverCardContent");
17
17
  var _useAiSummary = require("../../../state/hooks/use-ai-summary");
18
+ var _store = require("../../../state/store");
19
+ var _linkExtractors = require("@atlaskit/link-extractors");
18
20
  var _excluded = ["children", "isAIEnabled", "testId", "url"],
19
21
  _excluded2 = ["children", "isAIEnabled", "testId", "url"];
20
22
  /** @jsx jsx */
21
23
  var ConnectedAIPrismContainer = function ConnectedAIPrismContainer(_ref) {
24
+ var _extractLink, _cardState$details;
22
25
  var children = _ref.children,
23
26
  _ref$isAIEnabled = _ref.isAIEnabled,
24
27
  isAIEnabled = _ref$isAIEnabled === void 0 ? false : _ref$isAIEnabled,
25
28
  testId = _ref.testId,
26
29
  url = _ref.url,
27
30
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
+ var cardState = (0, _store.useSmartCardState)(url);
32
+ var dataUrl = (_extractLink = (0, _linkExtractors.extractLink)(cardState === null || cardState === void 0 || (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data)) !== null && _extractLink !== void 0 ? _extractLink : '';
28
33
  var _useAISummary = (0, _useAiSummary.useAISummary)({
29
- url: url
34
+ url: dataUrl
30
35
  }),
31
36
  status = _useAISummary.state.status;
32
37
  var _useState = (0, _react2.useState)(status === 'loading'),
@@ -21,6 +21,7 @@ var _reactIntlNext = require("react-intl-next");
21
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
22
  var _helpers = require("../../../../../state/helpers");
23
23
  var _useAiSummary = require("../../../../../state/hooks/use-ai-summary");
24
+ var _linkExtractors = require("@atlaskit/link-extractors");
24
25
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
25
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
27
  var toFooterActions = exports.toFooterActions = function toFooterActions(cardActions, onActionClick) {
@@ -61,16 +62,14 @@ var toFooterActions = exports.toFooterActions = function toFooterActions(cardAct
61
62
  //This component encapsulates useAISummary hook under the AI Summary FF 'platform.linking-platform.smart-card.hover-card-ai-summaries'
62
63
  var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
63
64
  var bottomPrimary = _ref.bottomPrimary,
64
- url = _ref.url,
65
- imagePreview = _ref.imagePreview;
65
+ imagePreview = _ref.imagePreview,
66
+ url = _ref.url;
66
67
  var aiSummary = (0, _useAiSummary.useAISummary)({
67
68
  url: url
68
69
  });
69
70
  var aiStatus = aiSummary.state.status;
70
71
  var showData = aiStatus === 'ready' || aiStatus === 'error';
71
- return showData ? /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, {
72
- direction: _constants.SmartLinkDirection.Vertical
73
- }, !imagePreview && /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
72
+ return showData ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !imagePreview && /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
74
73
  status: _constants.SmartLinkStatus.Resolved
75
74
  }), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
76
75
  primary: bottomPrimary,
@@ -81,7 +80,7 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
81
80
  })) : null;
82
81
  };
83
82
  var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
84
- var _cardState$details;
83
+ var _cardState$details, _extractLink;
85
84
  var flexibleCardProps = _ref2.flexibleCardProps,
86
85
  titleBlockProps = _ref2.titleBlockProps,
87
86
  analytics = _ref2.analytics,
@@ -106,6 +105,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
106
105
  return toFooterActions(cardActions, onActionClick);
107
106
  }, [cardActions, onActionClick]);
108
107
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
108
+ var dataUrl = (_extractLink = (0, _linkExtractors.extractLink)(data)) !== null && _extractLink !== void 0 ? _extractLink : '';
109
109
  var _useMemo = (0, _react.useMemo)(function () {
110
110
  var betterMetadata = (0, _utils.getSimulatedBetterMetadata)(extensionKey, data);
111
111
  return {
@@ -154,7 +154,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
154
154
  blockRef: connectedAIBlockRef
155
155
  }, /*#__PURE__*/_react.default.createElement(ConnectedAIBlock, {
156
156
  imagePreview: !!imagePreview,
157
- url: url,
157
+ url: dataUrl,
158
158
  bottomPrimary: bottomPrimary
159
159
  })), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
160
160
  status: _constants.SmartLinkStatus.Resolved
@@ -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.0",
20
+ packageVersion: "26.50.2",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -79,6 +79,10 @@ export class AISummaryService {
79
79
  if (chunk.type === 'FINAL_RESPONSE') {
80
80
  bufferContent = chunk.message.message.content;
81
81
  }
82
+ if (chunk.type === 'ERROR') {
83
+ var _chunk$message;
84
+ throw new Error(chunk === null || chunk === void 0 ? void 0 : (_chunk$message = chunk.message) === null || _chunk$message === void 0 ? void 0 : _chunk$message.message_template);
85
+ }
82
86
  }
83
87
  (_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 ? void 0 : _this$onSuccess.call(this, id);
84
88
  this.state = {
@@ -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.0"
7
+ packageVersion: "26.50.2"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -7,6 +7,8 @@ import { HoverCardContainer, popupContainerStyles } from '../styled';
7
7
  import AIPrism from '../../common/ai-prism';
8
8
  import { hoverCardClassName } from './HoverCardContent';
9
9
  import { useAISummary } from '../../../state/hooks/use-ai-summary';
10
+ import { useSmartCardState } from '../../../state/store';
11
+ import { extractLink } from '@atlaskit/link-extractors';
10
12
  const ConnectedAIPrismContainer = ({
11
13
  children,
12
14
  isAIEnabled = false,
@@ -14,12 +16,15 @@ const ConnectedAIPrismContainer = ({
14
16
  url,
15
17
  ...props
16
18
  }) => {
19
+ var _extractLink, _cardState$details;
20
+ const cardState = useSmartCardState(url);
21
+ const dataUrl = (_extractLink = extractLink(cardState === null || cardState === void 0 ? void 0 : (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data)) !== null && _extractLink !== void 0 ? _extractLink : '';
17
22
  const {
18
23
  state: {
19
24
  status
20
25
  }
21
26
  } = useAISummary({
22
- url
27
+ url: dataUrl
23
28
  });
24
29
  const [showPrism, setShowPrism] = useState(status === 'loading');
25
30
  useEffect(() => {
@@ -12,6 +12,7 @@ import { FormattedMessage } from 'react-intl-next';
12
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
13
  import { getCanBeDatasource } from '../../../../../state/helpers';
14
14
  import { useAISummary } from '../../../../../state/hooks/use-ai-summary';
15
+ import { extractLink } from '@atlaskit/link-extractors';
15
16
  import { SmartLinkStatus } from '../../../../../constants';
16
17
  export const toFooterActions = (cardActions, onActionClick) => {
17
18
  const followAction = {
@@ -51,17 +52,15 @@ export const toFooterActions = (cardActions, onActionClick) => {
51
52
  //This component encapsulates useAISummary hook under the AI Summary FF 'platform.linking-platform.smart-card.hover-card-ai-summaries'
52
53
  const ConnectedAIBlock = ({
53
54
  bottomPrimary,
54
- url,
55
- imagePreview
55
+ imagePreview,
56
+ url
56
57
  }) => {
57
58
  const aiSummary = useAISummary({
58
59
  url
59
60
  });
60
61
  const aiStatus = aiSummary.state.status;
61
62
  const showData = aiStatus === 'ready' || aiStatus === 'error';
62
- return showData ? /*#__PURE__*/React.createElement(CustomBlock, {
63
- direction: SmartLinkDirection.Vertical
64
- }, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
63
+ return showData ? /*#__PURE__*/React.createElement(React.Fragment, null, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
65
64
  status: SmartLinkStatus.Resolved
66
65
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
67
66
  primary: bottomPrimary,
@@ -82,7 +81,7 @@ const HoverCardResolvedView = ({
82
81
  extensionKey,
83
82
  url
84
83
  }) => {
85
- var _cardState$details;
84
+ var _cardState$details, _extractLink;
86
85
  const canBeDatasource = getCanBeDatasource(cardState.details);
87
86
  useEffect(() => {
88
87
  // Since this hover view is only rendered on resolved status,
@@ -95,6 +94,7 @@ const HoverCardResolvedView = ({
95
94
  }, [analytics.ui, cardState.status, canBeDatasource]);
96
95
  const footerActions = useMemo(() => toFooterActions(cardActions, onActionClick), [cardActions, onActionClick]);
97
96
  const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
97
+ const dataUrl = (_extractLink = extractLink(data)) !== null && _extractLink !== void 0 ? _extractLink : '';
98
98
  const {
99
99
  topPrimary,
100
100
  topSecondary,
@@ -144,7 +144,7 @@ const HoverCardResolvedView = ({
144
144
  blockRef: connectedAIBlockRef
145
145
  }, /*#__PURE__*/React.createElement(ConnectedAIBlock, {
146
146
  imagePreview: !!imagePreview,
147
- url: url,
147
+ url: dataUrl,
148
148
  bottomPrimary: bottomPrimary
149
149
  })), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
150
150
  status: SmartLinkStatus.Resolved
@@ -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.0",
10
+ packageVersion: "26.50.2",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -102,6 +102,7 @@ export var AISummaryService = /*#__PURE__*/function () {
102
102
  _iterator3,
103
103
  _step3,
104
104
  subscriber,
105
+ _chunk$message,
105
106
  _this$onError,
106
107
  _iterator4,
107
108
  _step4,
@@ -143,7 +144,7 @@ export var AISummaryService = /*#__PURE__*/function () {
143
144
  return _iterator.next();
144
145
  case 17:
145
146
  if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
146
- _context2.next = 24;
147
+ _context2.next = 26;
147
148
  break;
148
149
  }
149
150
  chunk = _step.value;
@@ -168,55 +169,60 @@ export var AISummaryService = /*#__PURE__*/function () {
168
169
  if (chunk.type === 'FINAL_RESPONSE') {
169
170
  bufferContent = chunk.message.message.content;
170
171
  }
171
- case 21:
172
+ if (!(chunk.type === 'ERROR')) {
173
+ _context2.next = 23;
174
+ break;
175
+ }
176
+ throw new Error(chunk === null || chunk === void 0 || (_chunk$message = chunk.message) === null || _chunk$message === void 0 ? void 0 : _chunk$message.message_template);
177
+ case 23:
172
178
  _iteratorAbruptCompletion = false;
173
179
  _context2.next = 15;
174
180
  break;
175
- case 24:
176
- _context2.next = 30;
177
- break;
178
181
  case 26:
179
- _context2.prev = 26;
182
+ _context2.next = 32;
183
+ break;
184
+ case 28:
185
+ _context2.prev = 28;
180
186
  _context2.t0 = _context2["catch"](13);
181
187
  _didIteratorError = true;
182
188
  _iteratorError = _context2.t0;
183
- case 30:
184
- _context2.prev = 30;
185
- _context2.prev = 31;
189
+ case 32:
190
+ _context2.prev = 32;
191
+ _context2.prev = 33;
186
192
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
187
- _context2.next = 35;
193
+ _context2.next = 37;
188
194
  break;
189
195
  }
190
- _context2.next = 35;
196
+ _context2.next = 37;
191
197
  return _iterator.return();
192
- case 35:
193
- _context2.prev = 35;
198
+ case 37:
199
+ _context2.prev = 37;
194
200
  if (!_didIteratorError) {
195
- _context2.next = 38;
201
+ _context2.next = 40;
196
202
  break;
197
203
  }
198
204
  throw _iteratorError;
199
- case 38:
200
- return _context2.finish(35);
201
- case 39:
202
- return _context2.finish(30);
203
205
  case 40:
206
+ return _context2.finish(37);
207
+ case 41:
208
+ return _context2.finish(32);
209
+ case 42:
204
210
  (_this$onSuccess = this.onSuccess) === null || _this$onSuccess === void 0 || _this$onSuccess.call(this, id);
205
211
  this.state = {
206
212
  status: 'done',
207
213
  content: bufferContent
208
214
  };
209
- _context2.next = 48;
215
+ _context2.next = 50;
210
216
  break;
211
- case 44:
212
- _context2.prev = 44;
217
+ case 46:
218
+ _context2.prev = 46;
213
219
  _context2.t1 = _context2["catch"](5);
214
220
  (_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, 'generic');
215
221
  this.state = {
216
222
  status: 'error',
217
223
  content: ''
218
224
  };
219
- case 48:
225
+ case 50:
220
226
  _iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
221
227
  try {
222
228
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -228,11 +234,11 @@ export var AISummaryService = /*#__PURE__*/function () {
228
234
  } finally {
229
235
  _iterator4.f();
230
236
  }
231
- case 50:
237
+ case 52:
232
238
  case "end":
233
239
  return _context2.stop();
234
240
  }
235
- }, _callee2, this, [[5, 44], [13, 26, 30, 40], [31,, 35, 39]]);
241
+ }, _callee2, this, [[5, 46], [13, 28, 32, 42], [33,, 37, 41]]);
236
242
  }));
237
243
  function summariseUrl() {
238
244
  return _summariseUrl.apply(this, arguments);
@@ -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.0"
18
+ packageVersion: "26.50.2"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -11,15 +11,20 @@ import { HoverCardContainer, popupContainerStyles } from '../styled';
11
11
  import AIPrism from '../../common/ai-prism';
12
12
  import { hoverCardClassName } from './HoverCardContent';
13
13
  import { useAISummary } from '../../../state/hooks/use-ai-summary';
14
+ import { useSmartCardState } from '../../../state/store';
15
+ import { extractLink } from '@atlaskit/link-extractors';
14
16
  var ConnectedAIPrismContainer = function ConnectedAIPrismContainer(_ref) {
17
+ var _extractLink, _cardState$details;
15
18
  var children = _ref.children,
16
19
  _ref$isAIEnabled = _ref.isAIEnabled,
17
20
  isAIEnabled = _ref$isAIEnabled === void 0 ? false : _ref$isAIEnabled,
18
21
  testId = _ref.testId,
19
22
  url = _ref.url,
20
23
  props = _objectWithoutProperties(_ref, _excluded);
24
+ var cardState = useSmartCardState(url);
25
+ var dataUrl = (_extractLink = extractLink(cardState === null || cardState === void 0 || (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data)) !== null && _extractLink !== void 0 ? _extractLink : '';
21
26
  var _useAISummary = useAISummary({
22
- url: url
27
+ url: dataUrl
23
28
  }),
24
29
  status = _useAISummary.state.status;
25
30
  var _useState = useState(status === 'loading'),
@@ -13,6 +13,7 @@ import { FormattedMessage } from 'react-intl-next';
13
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
14
  import { getCanBeDatasource } from '../../../../../state/helpers';
15
15
  import { useAISummary } from '../../../../../state/hooks/use-ai-summary';
16
+ import { extractLink } from '@atlaskit/link-extractors';
16
17
  import { SmartLinkStatus } from '../../../../../constants';
17
18
  export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
18
19
  var followAction = {
@@ -52,16 +53,14 @@ export var toFooterActions = function toFooterActions(cardActions, onActionClick
52
53
  //This component encapsulates useAISummary hook under the AI Summary FF 'platform.linking-platform.smart-card.hover-card-ai-summaries'
53
54
  var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
54
55
  var bottomPrimary = _ref.bottomPrimary,
55
- url = _ref.url,
56
- imagePreview = _ref.imagePreview;
56
+ imagePreview = _ref.imagePreview,
57
+ url = _ref.url;
57
58
  var aiSummary = useAISummary({
58
59
  url: url
59
60
  });
60
61
  var aiStatus = aiSummary.state.status;
61
62
  var showData = aiStatus === 'ready' || aiStatus === 'error';
62
- return showData ? /*#__PURE__*/React.createElement(CustomBlock, {
63
- direction: SmartLinkDirection.Vertical
64
- }, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
63
+ return showData ? /*#__PURE__*/React.createElement(React.Fragment, null, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
65
64
  status: SmartLinkStatus.Resolved
66
65
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
67
66
  primary: bottomPrimary,
@@ -72,7 +71,7 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
72
71
  })) : null;
73
72
  };
74
73
  var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
75
- var _cardState$details;
74
+ var _cardState$details, _extractLink;
76
75
  var flexibleCardProps = _ref2.flexibleCardProps,
77
76
  titleBlockProps = _ref2.titleBlockProps,
78
77
  analytics = _ref2.analytics,
@@ -97,6 +96,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
97
96
  return toFooterActions(cardActions, onActionClick);
98
97
  }, [cardActions, onActionClick]);
99
98
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
99
+ var dataUrl = (_extractLink = extractLink(data)) !== null && _extractLink !== void 0 ? _extractLink : '';
100
100
  var _useMemo = useMemo(function () {
101
101
  var betterMetadata = getSimulatedBetterMetadata(extensionKey, data);
102
102
  return {
@@ -145,7 +145,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
145
145
  blockRef: connectedAIBlockRef
146
146
  }, /*#__PURE__*/React.createElement(ConnectedAIBlock, {
147
147
  imagePreview: !!imagePreview,
148
- url: url,
148
+ url: dataUrl,
149
149
  bottomPrimary: bottomPrimary
150
150
  })), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
151
151
  status: SmartLinkStatus.Resolved
@@ -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.0",
13
+ packageVersion: "26.50.2",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
+ children?: React.ReactNode;
3
4
  embedIframeRef: React.RefObject<HTMLIFrameElement>;
4
5
  onHeightUpdate: (height: number) => void;
5
6
  }
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  interface Props {
3
+ children?: React.ReactNode;
3
4
  embedIframeRef: React.RefObject<HTMLIFrameElement>;
4
5
  onHeightUpdate: (height: number) => void;
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.50.0",
3
+ "version": "26.50.2",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/link-analytics": "^8.3.0",
44
44
  "@atlaskit/link-client-extension": "^1.8.0",
45
45
  "@atlaskit/link-extractors": "^1.2.0",
46
- "@atlaskit/linking-common": "^5.4.0",
46
+ "@atlaskit/linking-common": "^5.5.0",
47
47
  "@atlaskit/linking-types": "^8.7.0",
48
48
  "@atlaskit/logo": "^13.15.0",
49
49
  "@atlaskit/lozenge": "^11.6.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/outbound-auth-flow-client": "^3.4.0",
52
52
  "@atlaskit/platform-feature-flags": "^0.2.1",
53
53
  "@atlaskit/popup": "^1.13.0",
54
- "@atlaskit/primitives": "^4.1.0",
54
+ "@atlaskit/primitives": "^5.0.0",
55
55
  "@atlaskit/spinner": "^16.0.0",
56
56
  "@atlaskit/theme": "^12.6.0",
57
57
  "@atlaskit/tokens": "^1.41.0",