@atlaskit/smart-card 43.1.10 → 43.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/extractors/flexible/extract-placeholder-data.js +16 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +1 -17
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +4 -8
- package/dist/cjs/view/FlexibleCard/index.js +14 -10
- package/dist/cjs/view/HoverCard/components/ImagePreview.js +5 -3
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/extract-placeholder-data.js +8 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +1 -15
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +4 -8
- package/dist/es2019/view/FlexibleCard/index.js +12 -10
- package/dist/es2019/view/HoverCard/components/ImagePreview.js +4 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/extract-placeholder-data.js +10 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +1 -17
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +4 -8
- package/dist/esm/view/FlexibleCard/index.js +14 -10
- package/dist/esm/view/HoverCard/components/ImagePreview.js +5 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/flexible/extract-placeholder-data.d.ts +3 -0
- package/dist/types/ssr.d.ts +2 -0
- package/dist/types/view/CardWithUrl/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/index.d.ts +1 -13
- package/dist/types/view/FlexibleCard/types.d.ts +6 -0
- package/dist/types-ts4.5/extractors/flexible/extract-placeholder-data.d.ts +3 -0
- package/dist/types-ts4.5/ssr.d.ts +2 -0
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/index.d.ts +1 -13
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +6 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6f1b276e3b112`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6f1b276e3b112) -
|
|
8
|
+
Adds the new `placeholderData` property to the Smart Card (SSR) component. The card will display
|
|
9
|
+
using the respective object for the first render while still resolving `url` in the background.
|
|
10
|
+
Placeholder data should be considered a transient state and it will be replaced by the actual data
|
|
11
|
+
when the given `url` is resolved.
|
|
12
|
+
|
|
13
|
+
## 43.1.11
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`f1542b8bcb4d3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f1542b8bcb4d3) -
|
|
18
|
+
[ux] NAVX-1910 removing dynamic image margin to improve performance metrics
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 43.1.10
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractPlaceHolderCardState = void 0;
|
|
7
|
+
var isValidPlaceholderData = function isValidPlaceholderData(placeholderData) {
|
|
8
|
+
return (placeholderData === null || placeholderData === void 0 ? void 0 : placeholderData.data) && 'url' in placeholderData.data && 'name' in placeholderData.data;
|
|
9
|
+
};
|
|
10
|
+
var extractPlaceHolderCardState = exports.extractPlaceHolderCardState = function extractPlaceHolderCardState(placeholderData) {
|
|
11
|
+
return isValidPlaceholderData(placeholderData) ? {
|
|
12
|
+
status: 'resolved',
|
|
13
|
+
metadataStatus: undefined,
|
|
14
|
+
details: placeholderData
|
|
15
|
+
} : undefined;
|
|
16
|
+
};
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "43.1.
|
|
14
|
+
packageVersion: "43.1.11"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -31,9 +31,6 @@ var _InlineCard = require("../InlineCard");
|
|
|
31
31
|
var _useSmartLinkEvents = require("../SmartLinkEvents/useSmartLinkEvents");
|
|
32
32
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
33
33
|
var thirdPartyARIPrefix = 'ari:third-party';
|
|
34
|
-
var isValidPlaceholderData = function isValidPlaceholderData(placeholderData) {
|
|
35
|
-
return (placeholderData === null || placeholderData === void 0 ? void 0 : placeholderData.data) && 'url' in placeholderData.data && 'name' in placeholderData.data;
|
|
36
|
-
};
|
|
37
34
|
function Component(_ref) {
|
|
38
35
|
var id = _ref.id,
|
|
39
36
|
url = _ref.url,
|
|
@@ -235,19 +232,6 @@ function Component(_ref) {
|
|
|
235
232
|
display: isFlexibleUi ? 'flexible' : appearance
|
|
236
233
|
});
|
|
237
234
|
}, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
|
|
238
|
-
var structuredPlaceholderData = (0, _platformFeatureFlags.fg)('platform_initial_data_for_smart_cards') ?
|
|
239
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
240
|
-
(0, _react.useMemo)(function () {
|
|
241
|
-
// execute some basic validation logic to ensure we should consider using placeholder data
|
|
242
|
-
if (isFlexibleUi && isValidPlaceholderData(placeholderData)) {
|
|
243
|
-
var data = {
|
|
244
|
-
status: 'resolved',
|
|
245
|
-
metadataStatus: undefined,
|
|
246
|
-
details: placeholderData
|
|
247
|
-
};
|
|
248
|
-
return data;
|
|
249
|
-
}
|
|
250
|
-
}, [isFlexibleUi, placeholderData]) : undefined;
|
|
251
235
|
if (isFlexibleUi) {
|
|
252
236
|
var cardState = state;
|
|
253
237
|
if (error) {
|
|
@@ -262,7 +246,7 @@ function Component(_ref) {
|
|
|
262
246
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
|
|
263
247
|
id: id,
|
|
264
248
|
cardState: cardState,
|
|
265
|
-
placeholderData: (0, _platformFeatureFlags.fg)('platform_initial_data_for_smart_cards') ?
|
|
249
|
+
placeholderData: (0, _platformFeatureFlags.fg)('platform_initial_data_for_smart_cards') ? placeholderData : undefined,
|
|
266
250
|
onAuthorize: services.length && handleAuthorize || undefined,
|
|
267
251
|
onClick: handleClickWrapper,
|
|
268
252
|
origin: "smartLinkCard",
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.EmbedCardResolvedView = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _link = _interopRequireDefault(require("@atlaskit/icon/core/migration/link"));
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var _tokens = require("@atlaskit/tokens");
|
|
12
11
|
var _utils = require("../../../utils");
|
|
13
12
|
var _ExpandedFrame = require("../components/ExpandedFrame");
|
|
@@ -55,13 +54,10 @@ var EmbedCardResolvedView = exports.EmbedCardResolvedView = /*#__PURE__*/_react.
|
|
|
55
54
|
hideLoadingSkeleton: hideIconLoadingSkeleton
|
|
56
55
|
});
|
|
57
56
|
}, [iconFromContext, src, linkGlyph, type, hideIconLoadingSkeleton]);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
embedIframeRef: embedIframeRef
|
|
63
|
-
});
|
|
64
|
-
}
|
|
57
|
+
(0, _useEmbedResolvePostMessageListener.useEmbedResolvePostMessageListener)({
|
|
58
|
+
url: link,
|
|
59
|
+
embedIframeRef: embedIframeRef
|
|
60
|
+
});
|
|
65
61
|
var themeState = (0, _tokens.useThemeObserver)();
|
|
66
62
|
var previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
67
63
|
if (previewUrl && isSupportTheming) {
|
|
@@ -12,6 +12,7 @@ var _linkProvider = require("@atlaskit/link-provider");
|
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
13
|
var _useAnalyticsEvents2 = require("../../common/analytics/generated/use-analytics-events");
|
|
14
14
|
var _constants = require("../../constants");
|
|
15
|
+
var _extractPlaceholderData = require("../../extractors/flexible/extract-placeholder-data");
|
|
15
16
|
var _flexibleUiContext = require("../../state/flexible-ui-context");
|
|
16
17
|
var _useAiSummaryConfig = require("../../state/hooks/use-ai-summary-config");
|
|
17
18
|
var _useResolve = _interopRequireDefault(require("../../state/hooks/use-resolve"));
|
|
@@ -31,7 +32,6 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
31
32
|
var _ref$appearance = _ref.appearance,
|
|
32
33
|
appearance = _ref$appearance === void 0 ? 'flexible' : _ref$appearance,
|
|
33
34
|
cardState = _ref.cardState,
|
|
34
|
-
placeholderData = _ref.placeholderData,
|
|
35
35
|
children = _ref.children,
|
|
36
36
|
id = _ref.id,
|
|
37
37
|
onAuthorize = _ref.onAuthorize,
|
|
@@ -39,6 +39,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
39
39
|
onError = _ref.onError,
|
|
40
40
|
onResolve = _ref.onResolve,
|
|
41
41
|
origin = _ref.origin,
|
|
42
|
+
placeholderData = _ref.placeholderData,
|
|
42
43
|
renderers = _ref.renderers,
|
|
43
44
|
showHoverPreview = _ref.showHoverPreview,
|
|
44
45
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
@@ -56,16 +57,19 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
56
57
|
var cardType = cardState.status,
|
|
57
58
|
details = cardState.details;
|
|
58
59
|
var status = cardType;
|
|
59
|
-
|
|
60
|
-
// if we have placeholder
|
|
61
|
-
// as resolved data until the actual data comes back as one of the final statuses
|
|
62
|
-
var
|
|
60
|
+
|
|
61
|
+
// if we have placeholder state it means we can internally use it
|
|
62
|
+
// as temporary resolved data until the actual data comes back as one of the final statuses
|
|
63
|
+
var placeholderCardState = (0, _react.useMemo)(function () {
|
|
64
|
+
return PENDING_LINK_STATUSES.includes(status) && placeholderData && (0, _platformFeatureFlags.fg)('platform_initial_data_for_smart_cards') ? (0, _extractPlaceholderData.extractPlaceHolderCardState)(placeholderData) : undefined;
|
|
65
|
+
}, [placeholderData, status]);
|
|
66
|
+
var placeHolderStatus = placeholderCardState === null || placeholderCardState === void 0 ? void 0 : placeholderCardState.status;
|
|
63
67
|
var context = (0, _react.useMemo)(function () {
|
|
64
68
|
return (0, _utils.getContextByStatus)({
|
|
65
69
|
aiSummaryConfig: aiSummaryConfig,
|
|
66
70
|
appearance: appearance,
|
|
67
71
|
fireEvent: fireEvent,
|
|
68
|
-
response:
|
|
72
|
+
response: placeholderCardState ? placeholderCardState.details : details,
|
|
69
73
|
id: id,
|
|
70
74
|
onAuthorize: onAuthorize,
|
|
71
75
|
onClick: onClick,
|
|
@@ -73,19 +77,19 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
73
77
|
renderers: renderers,
|
|
74
78
|
resolve: resolve,
|
|
75
79
|
actionOptions: actionOptions,
|
|
76
|
-
status:
|
|
80
|
+
status: placeholderCardState ? placeHolderStatus : status,
|
|
77
81
|
url: url,
|
|
78
82
|
isPreviewPanelAvailable: isPreviewPanelAvailable,
|
|
79
83
|
openPreviewPanel: openPreviewPanel
|
|
80
84
|
});
|
|
81
|
-
}, [aiSummaryConfig, appearance,
|
|
85
|
+
}, [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, onAuthorize, onClick, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, renderers, resolve, status, url, fireEvent]);
|
|
82
86
|
var flexibleCardContext = (0, _react.useMemo)(function () {
|
|
83
87
|
return {
|
|
84
88
|
data: context,
|
|
85
|
-
status: (0, _platformFeatureFlags.fg)('platform_initial_data_for_smart_cards') ?
|
|
89
|
+
status: (0, _platformFeatureFlags.fg)('platform_initial_data_for_smart_cards') ? placeHolderStatus !== null && placeHolderStatus !== void 0 ? placeHolderStatus : status : status,
|
|
86
90
|
ui: ui
|
|
87
91
|
};
|
|
88
|
-
}, [context,
|
|
92
|
+
}, [context, placeHolderStatus, status, ui]);
|
|
89
93
|
var _ref2 = context || {},
|
|
90
94
|
linkTitle = _ref2.linkTitle;
|
|
91
95
|
var title = linkTitle === null || linkTitle === void 0 ? void 0 : linkTitle.text;
|
|
@@ -9,6 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _extractPreview = require("../../../extractors/flexible/extract-preview");
|
|
13
14
|
var _blocks = require("../../FlexibleCard/components/blocks");
|
|
14
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -33,11 +34,12 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
33
34
|
if (previewBlockRef.current) {
|
|
34
35
|
var _previewBlockRef$curr;
|
|
35
36
|
var previewHeight = (_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height;
|
|
36
|
-
setDynamicStyles(_objectSpread({
|
|
37
|
+
setDynamicStyles(_objectSpread(_objectSpread({
|
|
37
38
|
borderTopLeftRadius: "var(--ds-radius-large, 8px)",
|
|
38
|
-
borderTopRightRadius: "var(--ds-radius-large, 8px)"
|
|
39
|
+
borderTopRightRadius: "var(--ds-radius-large, 8px)"
|
|
40
|
+
}, (0, _platformFeatureFlags.fg)('navx-1910-fix-hovercard-performance-metrics') ? {} : {
|
|
39
41
|
marginBottom: "var(--ds-space-100, 8px)"
|
|
40
|
-
}, previewHeight ? {
|
|
42
|
+
}), previewHeight ? {
|
|
41
43
|
height: "".concat(previewHeight, "px")
|
|
42
44
|
} : {}));
|
|
43
45
|
}
|
|
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
22
22
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
23
23
|
var PACKAGE_DATA = {
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "43.1.
|
|
25
|
+
packageVersion: "43.1.11",
|
|
26
26
|
componentName: 'linkUrl'
|
|
27
27
|
};
|
|
28
28
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const isValidPlaceholderData = placeholderData => (placeholderData === null || placeholderData === void 0 ? void 0 : placeholderData.data) && 'url' in placeholderData.data && 'name' in placeholderData.data;
|
|
2
|
+
export const extractPlaceHolderCardState = placeholderData => {
|
|
3
|
+
return isValidPlaceholderData(placeholderData) ? {
|
|
4
|
+
status: 'resolved',
|
|
5
|
+
metadataStatus: undefined,
|
|
6
|
+
details: placeholderData
|
|
7
|
+
} : undefined;
|
|
8
|
+
};
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card",
|
|
5
|
-
packageVersion: "43.1.
|
|
5
|
+
packageVersion: "43.1.11"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -22,7 +22,6 @@ import FlexibleCard from '../FlexibleCard';
|
|
|
22
22
|
import { InlineCard } from '../InlineCard';
|
|
23
23
|
import { useFire3PWorkflowsClickEvent } from '../SmartLinkEvents/useSmartLinkEvents';
|
|
24
24
|
const thirdPartyARIPrefix = 'ari:third-party';
|
|
25
|
-
const isValidPlaceholderData = placeholderData => (placeholderData === null || placeholderData === void 0 ? void 0 : placeholderData.data) && 'url' in placeholderData.data && 'name' in placeholderData.data;
|
|
26
25
|
function Component({
|
|
27
26
|
id,
|
|
28
27
|
url,
|
|
@@ -222,19 +221,6 @@ function Component({
|
|
|
222
221
|
display: isFlexibleUi ? 'flexible' : appearance
|
|
223
222
|
});
|
|
224
223
|
}, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
|
|
225
|
-
const structuredPlaceholderData = fg('platform_initial_data_for_smart_cards') ?
|
|
226
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
227
|
-
useMemo(() => {
|
|
228
|
-
// execute some basic validation logic to ensure we should consider using placeholder data
|
|
229
|
-
if (isFlexibleUi && isValidPlaceholderData(placeholderData)) {
|
|
230
|
-
const data = {
|
|
231
|
-
status: 'resolved',
|
|
232
|
-
metadataStatus: undefined,
|
|
233
|
-
details: placeholderData
|
|
234
|
-
};
|
|
235
|
-
return data;
|
|
236
|
-
}
|
|
237
|
-
}, [isFlexibleUi, placeholderData]) : undefined;
|
|
238
224
|
if (isFlexibleUi) {
|
|
239
225
|
let cardState = state;
|
|
240
226
|
if (error) {
|
|
@@ -249,7 +235,7 @@ function Component({
|
|
|
249
235
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
250
236
|
id: id,
|
|
251
237
|
cardState: cardState,
|
|
252
|
-
placeholderData: fg('platform_initial_data_for_smart_cards') ?
|
|
238
|
+
placeholderData: fg('platform_initial_data_for_smart_cards') ? placeholderData : undefined,
|
|
253
239
|
onAuthorize: services.length && handleAuthorize || undefined,
|
|
254
240
|
onClick: handleClickWrapper,
|
|
255
241
|
origin: "smartLinkCard",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import LinkGlyph from '@atlaskit/icon/core/migration/link';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
5
4
|
import { getPreviewUrlWithTheme, isProfileType } from '../../../utils';
|
|
6
5
|
import { ExpandedFrame } from '../components/ExpandedFrame';
|
|
@@ -46,13 +45,10 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
46
45
|
hideLoadingSkeleton: hideIconLoadingSkeleton
|
|
47
46
|
});
|
|
48
47
|
}, [iconFromContext, src, linkGlyph, type, hideIconLoadingSkeleton]);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
embedIframeRef
|
|
54
|
-
});
|
|
55
|
-
}
|
|
48
|
+
useEmbedResolvePostMessageListener({
|
|
49
|
+
url: link,
|
|
50
|
+
embedIframeRef
|
|
51
|
+
});
|
|
56
52
|
const themeState = useThemeObserver();
|
|
57
53
|
let previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
58
54
|
if (previewUrl && isSupportTheming) {
|
|
@@ -4,6 +4,7 @@ import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
6
6
|
import { InternalActionName, SmartLinkStatus } from '../../constants';
|
|
7
|
+
import { extractPlaceHolderCardState } from '../../extractors/flexible/extract-placeholder-data';
|
|
7
8
|
import { FlexibleCardContext } from '../../state/flexible-ui-context';
|
|
8
9
|
import { useAISummaryConfig } from '../../state/hooks/use-ai-summary-config';
|
|
9
10
|
import useResolve from '../../state/hooks/use-resolve';
|
|
@@ -20,7 +21,6 @@ const PENDING_LINK_STATUSES = [SmartLinkStatus.Pending, SmartLinkStatus.Resolvin
|
|
|
20
21
|
const FlexibleCard = ({
|
|
21
22
|
appearance = 'flexible',
|
|
22
23
|
cardState,
|
|
23
|
-
placeholderData,
|
|
24
24
|
children,
|
|
25
25
|
id,
|
|
26
26
|
onAuthorize,
|
|
@@ -28,6 +28,7 @@ const FlexibleCard = ({
|
|
|
28
28
|
onError,
|
|
29
29
|
onResolve,
|
|
30
30
|
origin,
|
|
31
|
+
placeholderData,
|
|
31
32
|
renderers,
|
|
32
33
|
showHoverPreview,
|
|
33
34
|
hoverPreviewOptions,
|
|
@@ -51,15 +52,16 @@ const FlexibleCard = ({
|
|
|
51
52
|
details
|
|
52
53
|
} = cardState;
|
|
53
54
|
const status = cardType;
|
|
54
|
-
|
|
55
|
-
// if we have placeholder
|
|
56
|
-
// as resolved data until the actual data comes back as one of the final statuses
|
|
57
|
-
const
|
|
55
|
+
|
|
56
|
+
// if we have placeholder state it means we can internally use it
|
|
57
|
+
// as temporary resolved data until the actual data comes back as one of the final statuses
|
|
58
|
+
const placeholderCardState = useMemo(() => PENDING_LINK_STATUSES.includes(status) && placeholderData && fg('platform_initial_data_for_smart_cards') ? extractPlaceHolderCardState(placeholderData) : undefined, [placeholderData, status]);
|
|
59
|
+
const placeHolderStatus = placeholderCardState === null || placeholderCardState === void 0 ? void 0 : placeholderCardState.status;
|
|
58
60
|
const context = useMemo(() => getContextByStatus({
|
|
59
61
|
aiSummaryConfig,
|
|
60
62
|
appearance,
|
|
61
63
|
fireEvent,
|
|
62
|
-
response:
|
|
64
|
+
response: placeholderCardState ? placeholderCardState.details : details,
|
|
63
65
|
id,
|
|
64
66
|
onAuthorize,
|
|
65
67
|
onClick,
|
|
@@ -67,16 +69,16 @@ const FlexibleCard = ({
|
|
|
67
69
|
renderers,
|
|
68
70
|
resolve,
|
|
69
71
|
actionOptions,
|
|
70
|
-
status:
|
|
72
|
+
status: placeholderCardState ? placeHolderStatus : status,
|
|
71
73
|
url,
|
|
72
74
|
isPreviewPanelAvailable,
|
|
73
75
|
openPreviewPanel
|
|
74
|
-
}), [aiSummaryConfig, appearance,
|
|
76
|
+
}), [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, onAuthorize, onClick, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, renderers, resolve, status, url, fireEvent]);
|
|
75
77
|
const flexibleCardContext = useMemo(() => ({
|
|
76
78
|
data: context,
|
|
77
|
-
status: fg('platform_initial_data_for_smart_cards') ?
|
|
79
|
+
status: fg('platform_initial_data_for_smart_cards') ? placeHolderStatus !== null && placeHolderStatus !== void 0 ? placeHolderStatus : status : status,
|
|
78
80
|
ui
|
|
79
|
-
}), [context,
|
|
81
|
+
}), [context, placeHolderStatus, status, ui]);
|
|
80
82
|
const {
|
|
81
83
|
linkTitle
|
|
82
84
|
} = context || {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useState } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { extractSmartLinkPreviewImage } from '../../../extractors/flexible/extract-preview';
|
|
3
4
|
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
4
5
|
const ImagePreview = ({
|
|
@@ -18,7 +19,9 @@ const ImagePreview = ({
|
|
|
18
19
|
setDynamicStyles({
|
|
19
20
|
borderTopLeftRadius: "var(--ds-radius-large, 8px)",
|
|
20
21
|
borderTopRightRadius: "var(--ds-radius-large, 8px)",
|
|
21
|
-
|
|
22
|
+
...(fg('navx-1910-fix-hovercard-performance-metrics') ? {} : {
|
|
23
|
+
marginBottom: "var(--ds-space-100, 8px)"
|
|
24
|
+
}),
|
|
22
25
|
...(previewHeight ? {
|
|
23
26
|
height: `${previewHeight}px`
|
|
24
27
|
} : {})
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
const PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "43.1.
|
|
15
|
+
packageVersion: "43.1.11",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var isValidPlaceholderData = function isValidPlaceholderData(placeholderData) {
|
|
2
|
+
return (placeholderData === null || placeholderData === void 0 ? void 0 : placeholderData.data) && 'url' in placeholderData.data && 'name' in placeholderData.data;
|
|
3
|
+
};
|
|
4
|
+
export var extractPlaceHolderCardState = function extractPlaceHolderCardState(placeholderData) {
|
|
5
|
+
return isValidPlaceholderData(placeholderData) ? {
|
|
6
|
+
status: 'resolved',
|
|
7
|
+
metadataStatus: undefined,
|
|
8
|
+
details: placeholderData
|
|
9
|
+
} : undefined;
|
|
10
|
+
};
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "43.1.
|
|
7
|
+
packageVersion: "43.1.11"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -22,9 +22,6 @@ import FlexibleCard from '../FlexibleCard';
|
|
|
22
22
|
import { InlineCard } from '../InlineCard';
|
|
23
23
|
import { useFire3PWorkflowsClickEvent } from '../SmartLinkEvents/useSmartLinkEvents';
|
|
24
24
|
var thirdPartyARIPrefix = 'ari:third-party';
|
|
25
|
-
var isValidPlaceholderData = function isValidPlaceholderData(placeholderData) {
|
|
26
|
-
return (placeholderData === null || placeholderData === void 0 ? void 0 : placeholderData.data) && 'url' in placeholderData.data && 'name' in placeholderData.data;
|
|
27
|
-
};
|
|
28
25
|
function Component(_ref) {
|
|
29
26
|
var id = _ref.id,
|
|
30
27
|
url = _ref.url,
|
|
@@ -226,19 +223,6 @@ function Component(_ref) {
|
|
|
226
223
|
display: isFlexibleUi ? 'flexible' : appearance
|
|
227
224
|
});
|
|
228
225
|
}, [id, appearance, definitionId, isFlexibleUi, fireEvent]);
|
|
229
|
-
var structuredPlaceholderData = fg('platform_initial_data_for_smart_cards') ?
|
|
230
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
231
|
-
useMemo(function () {
|
|
232
|
-
// execute some basic validation logic to ensure we should consider using placeholder data
|
|
233
|
-
if (isFlexibleUi && isValidPlaceholderData(placeholderData)) {
|
|
234
|
-
var data = {
|
|
235
|
-
status: 'resolved',
|
|
236
|
-
metadataStatus: undefined,
|
|
237
|
-
details: placeholderData
|
|
238
|
-
};
|
|
239
|
-
return data;
|
|
240
|
-
}
|
|
241
|
-
}, [isFlexibleUi, placeholderData]) : undefined;
|
|
242
226
|
if (isFlexibleUi) {
|
|
243
227
|
var cardState = state;
|
|
244
228
|
if (error) {
|
|
@@ -253,7 +237,7 @@ function Component(_ref) {
|
|
|
253
237
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
254
238
|
id: id,
|
|
255
239
|
cardState: cardState,
|
|
256
|
-
placeholderData: fg('platform_initial_data_for_smart_cards') ?
|
|
240
|
+
placeholderData: fg('platform_initial_data_for_smart_cards') ? placeholderData : undefined,
|
|
257
241
|
onAuthorize: services.length && handleAuthorize || undefined,
|
|
258
242
|
onClick: handleClickWrapper,
|
|
259
243
|
origin: "smartLinkCard",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import LinkGlyph from '@atlaskit/icon/core/migration/link';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
5
4
|
import { getPreviewUrlWithTheme, isProfileType } from '../../../utils';
|
|
6
5
|
import { ExpandedFrame } from '../components/ExpandedFrame';
|
|
@@ -48,13 +47,10 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
|
48
47
|
hideLoadingSkeleton: hideIconLoadingSkeleton
|
|
49
48
|
});
|
|
50
49
|
}, [iconFromContext, src, linkGlyph, type, hideIconLoadingSkeleton]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
embedIframeRef: embedIframeRef
|
|
56
|
-
});
|
|
57
|
-
}
|
|
50
|
+
useEmbedResolvePostMessageListener({
|
|
51
|
+
url: link,
|
|
52
|
+
embedIframeRef: embedIframeRef
|
|
53
|
+
});
|
|
58
54
|
var themeState = useThemeObserver();
|
|
59
55
|
var previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
60
56
|
if (previewUrl && isSupportTheming) {
|
|
@@ -4,6 +4,7 @@ import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
6
6
|
import { InternalActionName, SmartLinkStatus } from '../../constants';
|
|
7
|
+
import { extractPlaceHolderCardState } from '../../extractors/flexible/extract-placeholder-data';
|
|
7
8
|
import { FlexibleCardContext } from '../../state/flexible-ui-context';
|
|
8
9
|
import { useAISummaryConfig } from '../../state/hooks/use-ai-summary-config';
|
|
9
10
|
import useResolve from '../../state/hooks/use-resolve';
|
|
@@ -22,7 +23,6 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
22
23
|
var _ref$appearance = _ref.appearance,
|
|
23
24
|
appearance = _ref$appearance === void 0 ? 'flexible' : _ref$appearance,
|
|
24
25
|
cardState = _ref.cardState,
|
|
25
|
-
placeholderData = _ref.placeholderData,
|
|
26
26
|
children = _ref.children,
|
|
27
27
|
id = _ref.id,
|
|
28
28
|
onAuthorize = _ref.onAuthorize,
|
|
@@ -30,6 +30,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
30
30
|
onError = _ref.onError,
|
|
31
31
|
onResolve = _ref.onResolve,
|
|
32
32
|
origin = _ref.origin,
|
|
33
|
+
placeholderData = _ref.placeholderData,
|
|
33
34
|
renderers = _ref.renderers,
|
|
34
35
|
showHoverPreview = _ref.showHoverPreview,
|
|
35
36
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
@@ -47,16 +48,19 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
47
48
|
var cardType = cardState.status,
|
|
48
49
|
details = cardState.details;
|
|
49
50
|
var status = cardType;
|
|
50
|
-
|
|
51
|
-
// if we have placeholder
|
|
52
|
-
// as resolved data until the actual data comes back as one of the final statuses
|
|
53
|
-
var
|
|
51
|
+
|
|
52
|
+
// if we have placeholder state it means we can internally use it
|
|
53
|
+
// as temporary resolved data until the actual data comes back as one of the final statuses
|
|
54
|
+
var placeholderCardState = useMemo(function () {
|
|
55
|
+
return PENDING_LINK_STATUSES.includes(status) && placeholderData && fg('platform_initial_data_for_smart_cards') ? extractPlaceHolderCardState(placeholderData) : undefined;
|
|
56
|
+
}, [placeholderData, status]);
|
|
57
|
+
var placeHolderStatus = placeholderCardState === null || placeholderCardState === void 0 ? void 0 : placeholderCardState.status;
|
|
54
58
|
var context = useMemo(function () {
|
|
55
59
|
return getContextByStatus({
|
|
56
60
|
aiSummaryConfig: aiSummaryConfig,
|
|
57
61
|
appearance: appearance,
|
|
58
62
|
fireEvent: fireEvent,
|
|
59
|
-
response:
|
|
63
|
+
response: placeholderCardState ? placeholderCardState.details : details,
|
|
60
64
|
id: id,
|
|
61
65
|
onAuthorize: onAuthorize,
|
|
62
66
|
onClick: onClick,
|
|
@@ -64,19 +68,19 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
64
68
|
renderers: renderers,
|
|
65
69
|
resolve: resolve,
|
|
66
70
|
actionOptions: actionOptions,
|
|
67
|
-
status:
|
|
71
|
+
status: placeholderCardState ? placeHolderStatus : status,
|
|
68
72
|
url: url,
|
|
69
73
|
isPreviewPanelAvailable: isPreviewPanelAvailable,
|
|
70
74
|
openPreviewPanel: openPreviewPanel
|
|
71
75
|
});
|
|
72
|
-
}, [aiSummaryConfig, appearance,
|
|
76
|
+
}, [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, onAuthorize, onClick, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, renderers, resolve, status, url, fireEvent]);
|
|
73
77
|
var flexibleCardContext = useMemo(function () {
|
|
74
78
|
return {
|
|
75
79
|
data: context,
|
|
76
|
-
status: fg('platform_initial_data_for_smart_cards') ?
|
|
80
|
+
status: fg('platform_initial_data_for_smart_cards') ? placeHolderStatus !== null && placeHolderStatus !== void 0 ? placeHolderStatus : status : status,
|
|
77
81
|
ui: ui
|
|
78
82
|
};
|
|
79
|
-
}, [context,
|
|
83
|
+
}, [context, placeHolderStatus, status, ui]);
|
|
80
84
|
var _ref2 = context || {},
|
|
81
85
|
linkTitle = _ref2.linkTitle;
|
|
82
86
|
var title = linkTitle === null || linkTitle === void 0 ? void 0 : linkTitle.text;
|
|
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { extractSmartLinkPreviewImage } from '../../../extractors/flexible/extract-preview';
|
|
7
8
|
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
8
9
|
var ImagePreview = function ImagePreview(_ref) {
|
|
@@ -24,11 +25,12 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
24
25
|
if (previewBlockRef.current) {
|
|
25
26
|
var _previewBlockRef$curr;
|
|
26
27
|
var previewHeight = (_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height;
|
|
27
|
-
setDynamicStyles(_objectSpread({
|
|
28
|
+
setDynamicStyles(_objectSpread(_objectSpread({
|
|
28
29
|
borderTopLeftRadius: "var(--ds-radius-large, 8px)",
|
|
29
|
-
borderTopRightRadius: "var(--ds-radius-large, 8px)"
|
|
30
|
+
borderTopRightRadius: "var(--ds-radius-large, 8px)"
|
|
31
|
+
}, fg('navx-1910-fix-hovercard-performance-metrics') ? {} : {
|
|
30
32
|
marginBottom: "var(--ds-space-100, 8px)"
|
|
31
|
-
}, previewHeight ? {
|
|
33
|
+
}), previewHeight ? {
|
|
32
34
|
height: "".concat(previewHeight, "px")
|
|
33
35
|
} : {}));
|
|
34
36
|
}
|
|
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
15
15
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
16
16
|
var PACKAGE_DATA = {
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "43.1.
|
|
18
|
+
packageVersion: "43.1.11",
|
|
19
19
|
componentName: 'linkUrl'
|
|
20
20
|
};
|
|
21
21
|
var Anchor = withLinkClickedEvent('a');
|
package/dist/types/ssr.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { SmartLinkResponse } from '@atlaskit/linking-types';
|
|
2
3
|
import type { CardProps } from './types';
|
|
3
4
|
export type CardSSRProps = CardProps & {
|
|
4
5
|
hideIconLoadingSkeleton?: boolean;
|
|
6
|
+
placeholderData?: SmartLinkResponse;
|
|
5
7
|
url: string;
|
|
6
8
|
};
|
|
7
9
|
export declare const CardSSR: (props: CardSSRProps) => React.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type EventHandler, type KeyboardEvent, type MouseEvent } from 'react';
|
|
2
|
+
import type { SmartLinkResponse } from '@atlaskit/linking-types';
|
|
2
3
|
import type { CardActionOptions, CardAppearance, CardPlatform, EmbedIframeUrlType, OnResolveCallback } from '../Card/types';
|
|
3
4
|
import { type FrameStyle } from '../EmbedCard/types';
|
|
4
5
|
import { type FlexibleUiOptions } from '../FlexibleCard/types';
|
|
@@ -28,6 +29,7 @@ export type CardWithUrlContentProps = {
|
|
|
28
29
|
onError?: OnErrorCallback;
|
|
29
30
|
onResolve?: OnResolveCallback;
|
|
30
31
|
placeholder?: string;
|
|
32
|
+
placeholderData?: SmartLinkResponse;
|
|
31
33
|
platform?: CardPlatform;
|
|
32
34
|
removeTextHighlightingFromTitle?: boolean;
|
|
33
35
|
resolvingPlaceholder?: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { CardState } from '@atlaskit/linking-common';
|
|
3
2
|
import { type FlexibleCardProps } from './types';
|
|
4
3
|
/**
|
|
5
4
|
* This represents a Flexible Card: a link represented by a card with metadata.
|
|
@@ -7,16 +6,5 @@ import { type FlexibleCardProps } from './types';
|
|
|
7
6
|
* Note: TitleBlock is mandatory for a Flexible Card to render.
|
|
8
7
|
* @see Container
|
|
9
8
|
*/
|
|
10
|
-
declare const FlexibleCard: ({ appearance, cardState,
|
|
11
|
-
/**
|
|
12
|
-
* @experimental
|
|
13
|
-
* This is a new prop that is not part of the public API - DO NOT USE.
|
|
14
|
-
* If provided, the card will display using the respective object for the first render (particularly useful for SSR),
|
|
15
|
-
* while still resolving `url` in the background.
|
|
16
|
-
* Placeholder data should be considered a transient state - in the sense that it will not persisted to the main store -
|
|
17
|
-
* and it will be replaced by the actual data when the given `url` is resolved.
|
|
18
|
-
* ANIP-288: Expose this prop to the public API
|
|
19
|
-
*/
|
|
20
|
-
placeholderData?: CardState;
|
|
21
|
-
}) => React.JSX.Element;
|
|
9
|
+
declare const FlexibleCard: ({ appearance, cardState, children, id, onAuthorize, onClick, onError, onResolve, origin, placeholderData, renderers, showHoverPreview, hoverPreviewOptions, actionOptions, testId, ui, url, }: FlexibleCardProps) => React.JSX.Element;
|
|
22
10
|
export default FlexibleCard;
|
|
@@ -72,6 +72,12 @@ export type FlexibleCardProps = {
|
|
|
72
72
|
* Smart links origin for analytics purposes
|
|
73
73
|
*/
|
|
74
74
|
origin?: AnalyticsOrigin;
|
|
75
|
+
/**
|
|
76
|
+
* Placeholder data to be used when the card is in a pending state.
|
|
77
|
+
* This allows the card to render with some data until the actual data is fetched, useful for SSR.
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
placeholderData?: SmartLinkResponse;
|
|
75
81
|
/**
|
|
76
82
|
* Any additional renderers required by Flexible UI. Currently used by icon
|
|
77
83
|
* to render Emoji.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { SmartLinkResponse } from '@atlaskit/linking-types';
|
|
2
3
|
import type { CardProps } from './types';
|
|
3
4
|
export type CardSSRProps = CardProps & {
|
|
4
5
|
hideIconLoadingSkeleton?: boolean;
|
|
6
|
+
placeholderData?: SmartLinkResponse;
|
|
5
7
|
url: string;
|
|
6
8
|
};
|
|
7
9
|
export declare const CardSSR: (props: CardSSRProps) => React.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type EventHandler, type KeyboardEvent, type MouseEvent } from 'react';
|
|
2
|
+
import type { SmartLinkResponse } from '@atlaskit/linking-types';
|
|
2
3
|
import type { CardActionOptions, CardAppearance, CardPlatform, EmbedIframeUrlType, OnResolveCallback } from '../Card/types';
|
|
3
4
|
import { type FrameStyle } from '../EmbedCard/types';
|
|
4
5
|
import { type FlexibleUiOptions } from '../FlexibleCard/types';
|
|
@@ -28,6 +29,7 @@ export type CardWithUrlContentProps = {
|
|
|
28
29
|
onError?: OnErrorCallback;
|
|
29
30
|
onResolve?: OnResolveCallback;
|
|
30
31
|
placeholder?: string;
|
|
32
|
+
placeholderData?: SmartLinkResponse;
|
|
31
33
|
platform?: CardPlatform;
|
|
32
34
|
removeTextHighlightingFromTitle?: boolean;
|
|
33
35
|
resolvingPlaceholder?: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { CardState } from '@atlaskit/linking-common';
|
|
3
2
|
import { type FlexibleCardProps } from './types';
|
|
4
3
|
/**
|
|
5
4
|
* This represents a Flexible Card: a link represented by a card with metadata.
|
|
@@ -7,16 +6,5 @@ import { type FlexibleCardProps } from './types';
|
|
|
7
6
|
* Note: TitleBlock is mandatory for a Flexible Card to render.
|
|
8
7
|
* @see Container
|
|
9
8
|
*/
|
|
10
|
-
declare const FlexibleCard: ({ appearance, cardState,
|
|
11
|
-
/**
|
|
12
|
-
* @experimental
|
|
13
|
-
* This is a new prop that is not part of the public API - DO NOT USE.
|
|
14
|
-
* If provided, the card will display using the respective object for the first render (particularly useful for SSR),
|
|
15
|
-
* while still resolving `url` in the background.
|
|
16
|
-
* Placeholder data should be considered a transient state - in the sense that it will not persisted to the main store -
|
|
17
|
-
* and it will be replaced by the actual data when the given `url` is resolved.
|
|
18
|
-
* ANIP-288: Expose this prop to the public API
|
|
19
|
-
*/
|
|
20
|
-
placeholderData?: CardState;
|
|
21
|
-
}) => React.JSX.Element;
|
|
9
|
+
declare const FlexibleCard: ({ appearance, cardState, children, id, onAuthorize, onClick, onError, onResolve, origin, placeholderData, renderers, showHoverPreview, hoverPreviewOptions, actionOptions, testId, ui, url, }: FlexibleCardProps) => React.JSX.Element;
|
|
22
10
|
export default FlexibleCard;
|
|
@@ -72,6 +72,12 @@ export type FlexibleCardProps = {
|
|
|
72
72
|
* Smart links origin for analytics purposes
|
|
73
73
|
*/
|
|
74
74
|
origin?: AnalyticsOrigin;
|
|
75
|
+
/**
|
|
76
|
+
* Placeholder data to be used when the card is in a pending state.
|
|
77
|
+
* This allows the card to render with some data until the actual data is fetched, useful for SSR.
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
placeholderData?: SmartLinkResponse;
|
|
75
81
|
/**
|
|
76
82
|
* Any additional renderers required by Flexible UI. Currently used by icon
|
|
77
83
|
* to render Emoji.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "43.
|
|
3
|
+
"version": "43.2.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@atlaskit/outbound-auth-flow-client": "^3.4.0",
|
|
64
64
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
65
65
|
"@atlaskit/popup": "^4.4.0",
|
|
66
|
-
"@atlaskit/primitives": "^
|
|
66
|
+
"@atlaskit/primitives": "^16.0.0",
|
|
67
67
|
"@atlaskit/section-message": "^8.7.0",
|
|
68
68
|
"@atlaskit/select": "^21.3.0",
|
|
69
69
|
"@atlaskit/spinner": "^19.0.0",
|
|
@@ -214,9 +214,6 @@
|
|
|
214
214
|
"platform_smartlink_3pclick_analytics": {
|
|
215
215
|
"type": "boolean"
|
|
216
216
|
},
|
|
217
|
-
"ptc-enable-embed-team-smart-links": {
|
|
218
|
-
"type": "boolean"
|
|
219
|
-
},
|
|
220
217
|
"platform_deprecate_lp_cc_embed": {
|
|
221
218
|
"type": "boolean"
|
|
222
219
|
},
|
|
@@ -234,6 +231,9 @@
|
|
|
234
231
|
},
|
|
235
232
|
"jfp-magma-platform-lozenge-jump-fix": {
|
|
236
233
|
"type": "boolean"
|
|
234
|
+
},
|
|
235
|
+
"navx-1910-fix-hovercard-performance-metrics": {
|
|
236
|
+
"type": "boolean"
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
239
|
"compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/f74ef1bc-7240-4aac-9dc8-9dc43b502089"
|