@atlaskit/smart-card 43.25.12 → 43.25.14
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 +15 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +10 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +5 -2
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +11 -17
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +11 -2
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +5 -2
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +8 -16
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +11 -2
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +5 -2
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +11 -17
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +0 -4
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +0 -4
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/types.d.ts +2 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.25.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 43.25.13
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`e6df89ffb41e9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e6df89ffb41e9) -
|
|
14
|
+
[ux] Fix Rovo AI Summery render on none target link, behind fg
|
|
15
|
+
platform_sl_3p_auth_rovo_action_kill_switch
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 43.25.12
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -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.25.
|
|
14
|
+
packageVersion: "43.25.13"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -75,14 +75,23 @@ var RovoSummaryBlockResolvedView = exports.RovoSummaryBlockResolvedView = functi
|
|
|
75
75
|
var _useAISummaryAction2 = (0, _useAiSummaryAction.default)(url),
|
|
76
76
|
_useAISummaryAction2$ = _useAISummaryAction2.state,
|
|
77
77
|
content = _useAISummaryAction2$.content,
|
|
78
|
-
status = _useAISummaryAction2$.status
|
|
78
|
+
status = _useAISummaryAction2$.status,
|
|
79
|
+
summariseUrl = _useAISummaryAction2.summariseUrl;
|
|
79
80
|
var showAISummary = status === 'done' ||
|
|
80
81
|
// We want to display the AI Summary component only when there is content available during the loading process.
|
|
81
82
|
status === 'loading' && !!content;
|
|
82
83
|
var isSummarisedOnMountRef = (0, _react.useRef)(status === 'done');
|
|
84
|
+
(0, _react.useEffect)(function () {
|
|
85
|
+
if (status !== 'ready' || isSummarisedOnMountRef.current) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
isSummarisedOnMountRef.current = true;
|
|
89
|
+
summariseUrl();
|
|
90
|
+
}, [status, summariseUrl]);
|
|
83
91
|
var minHeight = isSummarisedOnMountRef.current ? 0 : aiSummaryMinHeight;
|
|
84
92
|
if (!showAISummary) {
|
|
85
93
|
return /*#__PURE__*/React.createElement(_compiled.Inline, {
|
|
94
|
+
testId: "".concat(testId, "-placeholder"),
|
|
86
95
|
xcss: newStyles.placeholderWrapper
|
|
87
96
|
}, /*#__PURE__*/React.createElement("div", {
|
|
88
97
|
className: (0, _runtime.ax)([newStyles.iconWrapper])
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.hoverCardClassName = exports.default = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
@@ -171,7 +172,9 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
171
172
|
});
|
|
172
173
|
}
|
|
173
174
|
if (cardState.status === 'resolved') {
|
|
174
|
-
return /*#__PURE__*/_react.default.createElement(_resolved.default, {
|
|
175
|
+
return /*#__PURE__*/_react.default.createElement(_resolved.default, (0, _extends2.default)({}, (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ? {
|
|
176
|
+
actionOptions: actionOptions
|
|
177
|
+
} : undefined, {
|
|
175
178
|
cardState: cardState,
|
|
176
179
|
extensionKey: extensionKey,
|
|
177
180
|
flexibleCardProps: flexibleCardProps,
|
|
@@ -179,7 +182,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
179
182
|
onActionClick: onActionClick,
|
|
180
183
|
titleBlockProps: titleBlockProps,
|
|
181
184
|
url: url
|
|
182
|
-
});
|
|
185
|
+
}));
|
|
183
186
|
}
|
|
184
187
|
return null;
|
|
185
188
|
};
|
|
@@ -15,6 +15,7 @@ var _reactMagneticDi = require("react-magnetic-di");
|
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _useAnalyticsEvents2 = require("../../../../../common/analytics/generated/use-analytics-events");
|
|
17
17
|
var _constants = require("../../../../../constants");
|
|
18
|
+
var _extractRovoChatAction = _interopRequireDefault(require("../../../../../extractors/flexible/actions/extract-rovo-chat-action"));
|
|
18
19
|
var _analytics = require("../../../../../state/analytics");
|
|
19
20
|
var _useAiSummaryAction = _interopRequireDefault(require("../../../../../state/hooks/use-ai-summary-action"));
|
|
20
21
|
var _useRovoConfig = _interopRequireDefault(require("../../../../../state/hooks/use-rovo-config"));
|
|
@@ -30,7 +31,8 @@ var snippetBlockCss = null;
|
|
|
30
31
|
var actionBlockCss = null;
|
|
31
32
|
var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
32
33
|
var _cardState$details;
|
|
33
|
-
var
|
|
34
|
+
var actionOptions = _ref.actionOptions,
|
|
35
|
+
cardState = _ref.cardState,
|
|
34
36
|
extensionKey = _ref.extensionKey,
|
|
35
37
|
flexibleCardProps = _ref.flexibleCardProps,
|
|
36
38
|
isAISummaryEnabled = _ref.isAISummaryEnabled,
|
|
@@ -40,7 +42,14 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
40
42
|
url = _ref.url;
|
|
41
43
|
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
42
44
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
43
|
-
var rovoConfig = (0,
|
|
45
|
+
var rovoConfig = (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
46
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
47
|
+
(0, _useRovoConfig.default)() : undefined;
|
|
48
|
+
var isRovoSummaryEnabled = (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
49
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
50
|
+
(0, _react.useMemo)(function () {
|
|
51
|
+
return (cardState === null || cardState === void 0 ? void 0 : cardState.details) && (0, _extractRovoChatAction.default)(cardState.details, rovoConfig, actionOptions);
|
|
52
|
+
}, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, rovoConfig]) : false;
|
|
44
53
|
(0, _react.useEffect)(function () {
|
|
45
54
|
// Since this hover view is only rendered on resolved status,
|
|
46
55
|
// there is no need to check for statuses.
|
|
@@ -77,20 +86,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
77
86
|
className: (0, _runtime.ax)(["_ca0q1b66"])
|
|
78
87
|
});
|
|
79
88
|
var aiSummaryMinHeight = snippet ? snippetHeight.current : 0;
|
|
80
|
-
var isRovoSummaryEnabled = (rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.isRovoEnabled) && extensionKey === 'google-object-provider' && (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch');
|
|
81
|
-
var aiSummaryProps = (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
82
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
83
|
-
(0, _useAiSummaryAction.default)(url) : undefined;
|
|
84
|
-
var hasSummarised = (0, _react.useRef)(false);
|
|
85
|
-
(0, _react.useEffect)(function () {
|
|
86
|
-
if ((0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch')) {
|
|
87
|
-
if ((aiSummaryProps === null || aiSummaryProps === void 0 ? void 0 : aiSummaryProps.state.status) !== 'ready' || hasSummarised.current) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
hasSummarised.current = true;
|
|
91
|
-
aiSummaryProps === null || aiSummaryProps === void 0 || aiSummaryProps.summariseUrl();
|
|
92
|
-
}
|
|
93
|
-
}, [aiSummaryProps, isRovoSummaryEnabled]);
|
|
94
89
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, flexibleCardProps, imagePreview, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, (0, _extends2.default)({}, titleBlockProps, {
|
|
95
90
|
metadataPosition: _constants.SmartLinkPosition.Top,
|
|
96
91
|
className: (0, _runtime.ax)(["_zulpu2gc _quenze3t _oebj1txw _13mh1pd9"])
|
|
@@ -101,7 +96,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
101
96
|
size: _constants.SmartLinkSize.Medium
|
|
102
97
|
}), isRovoSummaryEnabled ? /*#__PURE__*/_react.default.createElement(_aiSummaryBlock.RovoSummaryBlock, {
|
|
103
98
|
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
104
|
-
placeholder: snippet,
|
|
105
99
|
url: url
|
|
106
100
|
}) : isAISummaryEnabled ? /*#__PURE__*/_react.default.createElement(_blocks.AISummaryBlock, {
|
|
107
101
|
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
@@ -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.25.
|
|
25
|
+
packageVersion: "43.25.13",
|
|
26
26
|
componentName: 'linkUrl'
|
|
27
27
|
};
|
|
28
28
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -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.25.
|
|
5
|
+
packageVersion: "43.25.13"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import "./index.compiled.css";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
-
import { Fragment, useRef } from 'react';
|
|
6
|
+
import { Fragment, useEffect, useRef } from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import { di } from 'react-magnetic-di';
|
|
9
9
|
import { RovoIcon } from '@atlaskit/logo';
|
|
@@ -71,15 +71,24 @@ export const RovoSummaryBlockResolvedView = props => {
|
|
|
71
71
|
state: {
|
|
72
72
|
content,
|
|
73
73
|
status
|
|
74
|
-
}
|
|
74
|
+
},
|
|
75
|
+
summariseUrl
|
|
75
76
|
} = useAISummaryAction(url);
|
|
76
77
|
const showAISummary = status === 'done' ||
|
|
77
78
|
// We want to display the AI Summary component only when there is content available during the loading process.
|
|
78
79
|
status === 'loading' && !!content;
|
|
79
80
|
const isSummarisedOnMountRef = useRef(status === 'done');
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (status !== 'ready' || isSummarisedOnMountRef.current) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
isSummarisedOnMountRef.current = true;
|
|
86
|
+
summariseUrl();
|
|
87
|
+
}, [status, summariseUrl]);
|
|
80
88
|
const minHeight = isSummarisedOnMountRef.current ? 0 : aiSummaryMinHeight;
|
|
81
89
|
if (!showAISummary) {
|
|
82
90
|
return /*#__PURE__*/React.createElement(Inline, {
|
|
91
|
+
testId: `${testId}-placeholder`,
|
|
83
92
|
xcss: newStyles.placeholderWrapper
|
|
84
93
|
}, /*#__PURE__*/React.createElement("div", {
|
|
85
94
|
className: ax([newStyles.iconWrapper])
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
3
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
4
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
@@ -158,7 +159,9 @@ const HoverCardContent = ({
|
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
161
|
if (cardState.status === 'resolved') {
|
|
161
|
-
return /*#__PURE__*/React.createElement(HoverCardResolvedView, {
|
|
162
|
+
return /*#__PURE__*/React.createElement(HoverCardResolvedView, _extends({}, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
|
|
163
|
+
actionOptions
|
|
164
|
+
} : undefined, {
|
|
162
165
|
cardState: cardState,
|
|
163
166
|
extensionKey: extensionKey,
|
|
164
167
|
flexibleCardProps: flexibleCardProps,
|
|
@@ -166,7 +169,7 @@ const HoverCardContent = ({
|
|
|
166
169
|
onActionClick: onActionClick,
|
|
167
170
|
titleBlockProps: titleBlockProps,
|
|
168
171
|
url: url
|
|
169
|
-
});
|
|
172
|
+
}));
|
|
170
173
|
}
|
|
171
174
|
return null;
|
|
172
175
|
};
|
|
@@ -7,6 +7,7 @@ import { di } from 'react-magnetic-di';
|
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
9
9
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
|
|
10
|
+
import extractRovoChatAction from '../../../../../extractors/flexible/actions/extract-rovo-chat-action';
|
|
10
11
|
import { succeedUfoExperience } from '../../../../../state/analytics';
|
|
11
12
|
import useAISummaryAction from '../../../../../state/hooks/use-ai-summary-action';
|
|
12
13
|
import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
|
|
@@ -20,6 +21,7 @@ const titleBlockStyles = null;
|
|
|
20
21
|
const snippetBlockCss = null;
|
|
21
22
|
const actionBlockCss = null;
|
|
22
23
|
const HoverCardResolvedView = ({
|
|
24
|
+
actionOptions,
|
|
23
25
|
cardState,
|
|
24
26
|
extensionKey,
|
|
25
27
|
flexibleCardProps,
|
|
@@ -33,7 +35,12 @@ const HoverCardResolvedView = ({
|
|
|
33
35
|
const {
|
|
34
36
|
fireEvent
|
|
35
37
|
} = useAnalyticsEvents();
|
|
36
|
-
const rovoConfig =
|
|
38
|
+
const rovoConfig = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
39
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
40
|
+
useRovoConfig() : undefined;
|
|
41
|
+
const isRovoSummaryEnabled = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
42
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
43
|
+
useMemo(() => (cardState === null || cardState === void 0 ? void 0 : cardState.details) && extractRovoChatAction(cardState.details, rovoConfig, actionOptions), [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, rovoConfig]) : false;
|
|
37
44
|
useEffect(() => {
|
|
38
45
|
// Since this hover view is only rendered on resolved status,
|
|
39
46
|
// there is no need to check for statuses.
|
|
@@ -71,20 +78,6 @@ const HoverCardResolvedView = ({
|
|
|
71
78
|
className: ax(["_ca0q1b66"])
|
|
72
79
|
});
|
|
73
80
|
const aiSummaryMinHeight = snippet ? snippetHeight.current : 0;
|
|
74
|
-
const isRovoSummaryEnabled = (rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.isRovoEnabled) && extensionKey === 'google-object-provider' && fg('platform_sl_3p_auth_rovo_action_kill_switch');
|
|
75
|
-
const aiSummaryProps = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
76
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
77
|
-
useAISummaryAction(url) : undefined;
|
|
78
|
-
const hasSummarised = useRef(false);
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
if (fg('platform_sl_3p_auth_rovo_action_kill_switch')) {
|
|
81
|
-
if ((aiSummaryProps === null || aiSummaryProps === void 0 ? void 0 : aiSummaryProps.state.status) !== 'ready' || hasSummarised.current) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
hasSummarised.current = true;
|
|
85
|
-
aiSummaryProps === null || aiSummaryProps === void 0 ? void 0 : aiSummaryProps.summariseUrl();
|
|
86
|
-
}
|
|
87
|
-
}, [aiSummaryProps, isRovoSummaryEnabled]);
|
|
88
81
|
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
89
82
|
metadataPosition: SmartLinkPosition.Top,
|
|
90
83
|
className: ax(["_zulpu2gc _quenze3t _oebj1txw _13mh1pd9"])
|
|
@@ -95,7 +88,6 @@ const HoverCardResolvedView = ({
|
|
|
95
88
|
size: SmartLinkSize.Medium
|
|
96
89
|
}), isRovoSummaryEnabled ? /*#__PURE__*/React.createElement(RovoSummaryBlock, {
|
|
97
90
|
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
98
|
-
placeholder: snippet,
|
|
99
91
|
url: url
|
|
100
92
|
}) : isAISummaryEnabled ? /*#__PURE__*/React.createElement(AISummaryBlock, {
|
|
101
93
|
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
@@ -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.25.
|
|
15
|
+
packageVersion: "43.25.13",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -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.25.
|
|
7
|
+
packageVersion: "43.25.13"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import "./index.compiled.css";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
-
import { Fragment, useRef } from 'react';
|
|
6
|
+
import { Fragment, useEffect, useRef } from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import { di } from 'react-magnetic-di';
|
|
9
9
|
import { RovoIcon } from '@atlaskit/logo';
|
|
@@ -66,14 +66,23 @@ export var RovoSummaryBlockResolvedView = function RovoSummaryBlockResolvedView(
|
|
|
66
66
|
var _useAISummaryAction2 = useAISummaryAction(url),
|
|
67
67
|
_useAISummaryAction2$ = _useAISummaryAction2.state,
|
|
68
68
|
content = _useAISummaryAction2$.content,
|
|
69
|
-
status = _useAISummaryAction2$.status
|
|
69
|
+
status = _useAISummaryAction2$.status,
|
|
70
|
+
summariseUrl = _useAISummaryAction2.summariseUrl;
|
|
70
71
|
var showAISummary = status === 'done' ||
|
|
71
72
|
// We want to display the AI Summary component only when there is content available during the loading process.
|
|
72
73
|
status === 'loading' && !!content;
|
|
73
74
|
var isSummarisedOnMountRef = useRef(status === 'done');
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
if (status !== 'ready' || isSummarisedOnMountRef.current) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
isSummarisedOnMountRef.current = true;
|
|
80
|
+
summariseUrl();
|
|
81
|
+
}, [status, summariseUrl]);
|
|
74
82
|
var minHeight = isSummarisedOnMountRef.current ? 0 : aiSummaryMinHeight;
|
|
75
83
|
if (!showAISummary) {
|
|
76
84
|
return /*#__PURE__*/React.createElement(Inline, {
|
|
85
|
+
testId: "".concat(testId, "-placeholder"),
|
|
77
86
|
xcss: newStyles.placeholderWrapper
|
|
78
87
|
}, /*#__PURE__*/React.createElement("div", {
|
|
79
88
|
className: ax([newStyles.iconWrapper])
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
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; }
|
|
3
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; }
|
|
@@ -162,7 +163,9 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
162
163
|
});
|
|
163
164
|
}
|
|
164
165
|
if (cardState.status === 'resolved') {
|
|
165
|
-
return /*#__PURE__*/React.createElement(HoverCardResolvedView, {
|
|
166
|
+
return /*#__PURE__*/React.createElement(HoverCardResolvedView, _extends({}, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
|
|
167
|
+
actionOptions: actionOptions
|
|
168
|
+
} : undefined, {
|
|
166
169
|
cardState: cardState,
|
|
167
170
|
extensionKey: extensionKey,
|
|
168
171
|
flexibleCardProps: flexibleCardProps,
|
|
@@ -170,7 +173,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
170
173
|
onActionClick: onActionClick,
|
|
171
174
|
titleBlockProps: titleBlockProps,
|
|
172
175
|
url: url
|
|
173
|
-
});
|
|
176
|
+
}));
|
|
174
177
|
}
|
|
175
178
|
return null;
|
|
176
179
|
};
|
|
@@ -7,6 +7,7 @@ import { di } from 'react-magnetic-di';
|
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
9
9
|
import { CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
|
|
10
|
+
import extractRovoChatAction from '../../../../../extractors/flexible/actions/extract-rovo-chat-action';
|
|
10
11
|
import { succeedUfoExperience } from '../../../../../state/analytics';
|
|
11
12
|
import useAISummaryAction from '../../../../../state/hooks/use-ai-summary-action';
|
|
12
13
|
import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
|
|
@@ -21,7 +22,8 @@ var snippetBlockCss = null;
|
|
|
21
22
|
var actionBlockCss = null;
|
|
22
23
|
var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
23
24
|
var _cardState$details;
|
|
24
|
-
var
|
|
25
|
+
var actionOptions = _ref.actionOptions,
|
|
26
|
+
cardState = _ref.cardState,
|
|
25
27
|
extensionKey = _ref.extensionKey,
|
|
26
28
|
flexibleCardProps = _ref.flexibleCardProps,
|
|
27
29
|
isAISummaryEnabled = _ref.isAISummaryEnabled,
|
|
@@ -31,7 +33,14 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
31
33
|
url = _ref.url;
|
|
32
34
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
33
35
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
34
|
-
var rovoConfig =
|
|
36
|
+
var rovoConfig = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
37
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
38
|
+
useRovoConfig() : undefined;
|
|
39
|
+
var isRovoSummaryEnabled = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
40
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
41
|
+
useMemo(function () {
|
|
42
|
+
return (cardState === null || cardState === void 0 ? void 0 : cardState.details) && extractRovoChatAction(cardState.details, rovoConfig, actionOptions);
|
|
43
|
+
}, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, rovoConfig]) : false;
|
|
35
44
|
useEffect(function () {
|
|
36
45
|
// Since this hover view is only rendered on resolved status,
|
|
37
46
|
// there is no need to check for statuses.
|
|
@@ -68,20 +77,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
68
77
|
className: ax(["_ca0q1b66"])
|
|
69
78
|
});
|
|
70
79
|
var aiSummaryMinHeight = snippet ? snippetHeight.current : 0;
|
|
71
|
-
var isRovoSummaryEnabled = (rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.isRovoEnabled) && extensionKey === 'google-object-provider' && fg('platform_sl_3p_auth_rovo_action_kill_switch');
|
|
72
|
-
var aiSummaryProps = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
73
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
74
|
-
useAISummaryAction(url) : undefined;
|
|
75
|
-
var hasSummarised = useRef(false);
|
|
76
|
-
useEffect(function () {
|
|
77
|
-
if (fg('platform_sl_3p_auth_rovo_action_kill_switch')) {
|
|
78
|
-
if ((aiSummaryProps === null || aiSummaryProps === void 0 ? void 0 : aiSummaryProps.state.status) !== 'ready' || hasSummarised.current) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
hasSummarised.current = true;
|
|
82
|
-
aiSummaryProps === null || aiSummaryProps === void 0 || aiSummaryProps.summariseUrl();
|
|
83
|
-
}
|
|
84
|
-
}, [aiSummaryProps, isRovoSummaryEnabled]);
|
|
85
80
|
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
86
81
|
metadataPosition: SmartLinkPosition.Top,
|
|
87
82
|
className: ax(["_zulpu2gc _quenze3t _oebj1txw _13mh1pd9"])
|
|
@@ -92,7 +87,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
92
87
|
size: SmartLinkSize.Medium
|
|
93
88
|
}), isRovoSummaryEnabled ? /*#__PURE__*/React.createElement(RovoSummaryBlock, {
|
|
94
89
|
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
95
|
-
placeholder: snippet,
|
|
96
90
|
url: url
|
|
97
91
|
}) : isAISummaryEnabled ? /*#__PURE__*/React.createElement(AISummaryBlock, {
|
|
98
92
|
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
@@ -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.25.
|
|
18
|
+
packageVersion: "43.25.13",
|
|
19
19
|
componentName: 'linkUrl'
|
|
20
20
|
};
|
|
21
21
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -15,9 +15,5 @@ export type RovoSummaryBlockProps = {
|
|
|
15
15
|
* Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
|
|
16
16
|
*/
|
|
17
17
|
aiSummaryMinHeight?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Placeholder to show when summary is not available
|
|
20
|
-
*/
|
|
21
|
-
placeholder?: ReactNode;
|
|
22
18
|
url?: string;
|
|
23
19
|
} & BlockProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type HoverCardResolvedProps } from './types';
|
|
2
|
-
declare const HoverCardResolvedView: ({ cardState, extensionKey, flexibleCardProps, isAISummaryEnabled, onActionClick, titleBlockProps, id, url, }: HoverCardResolvedProps) => JSX.Element;
|
|
2
|
+
declare const HoverCardResolvedView: ({ actionOptions, cardState, extensionKey, flexibleCardProps, isAISummaryEnabled, onActionClick, titleBlockProps, id, url, }: HoverCardResolvedProps) => JSX.Element;
|
|
3
3
|
export default HoverCardResolvedView;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type CardState } from '@atlaskit/linking-common';
|
|
2
2
|
import type { ActionName } from '../../../../../constants';
|
|
3
3
|
import { type LinkAction } from '../../../../../state/hooks-external/useSmartLinkActions';
|
|
4
|
+
import type { InternalCardActionOptions } from '../../../../Card/types.ts';
|
|
4
5
|
import { type HoverCardLoadingViewProps } from '../resolving/types';
|
|
5
6
|
export type HoverCardResolvedProps = {
|
|
7
|
+
actionOptions?: InternalCardActionOptions;
|
|
6
8
|
cardActions?: LinkAction[];
|
|
7
9
|
cardState: CardState;
|
|
8
10
|
extensionKey?: string;
|
|
@@ -15,9 +15,5 @@ export type RovoSummaryBlockProps = {
|
|
|
15
15
|
* Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
|
|
16
16
|
*/
|
|
17
17
|
aiSummaryMinHeight?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Placeholder to show when summary is not available
|
|
20
|
-
*/
|
|
21
|
-
placeholder?: ReactNode;
|
|
22
18
|
url?: string;
|
|
23
19
|
} & BlockProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type HoverCardResolvedProps } from './types';
|
|
2
|
-
declare const HoverCardResolvedView: ({ cardState, extensionKey, flexibleCardProps, isAISummaryEnabled, onActionClick, titleBlockProps, id, url, }: HoverCardResolvedProps) => JSX.Element;
|
|
2
|
+
declare const HoverCardResolvedView: ({ actionOptions, cardState, extensionKey, flexibleCardProps, isAISummaryEnabled, onActionClick, titleBlockProps, id, url, }: HoverCardResolvedProps) => JSX.Element;
|
|
3
3
|
export default HoverCardResolvedView;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type CardState } from '@atlaskit/linking-common';
|
|
2
2
|
import type { ActionName } from '../../../../../constants';
|
|
3
3
|
import { type LinkAction } from '../../../../../state/hooks-external/useSmartLinkActions';
|
|
4
|
+
import type { InternalCardActionOptions } from '../../../../Card/types.ts';
|
|
4
5
|
import { type HoverCardLoadingViewProps } from '../resolving/types';
|
|
5
6
|
export type HoverCardResolvedProps = {
|
|
7
|
+
actionOptions?: InternalCardActionOptions;
|
|
6
8
|
cardActions?: LinkAction[];
|
|
7
9
|
cardState: CardState;
|
|
8
10
|
extensionKey?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "43.25.
|
|
3
|
+
"version": "43.25.14",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/dropdown-menu": "^16.5.0",
|
|
40
40
|
"@atlaskit/embedded-confluence": "^4.5.0",
|
|
41
41
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
42
|
-
"@atlaskit/form": "^15.
|
|
42
|
+
"@atlaskit/form": "^15.4.0",
|
|
43
43
|
"@atlaskit/frontend-utilities": "^3.2.0",
|
|
44
44
|
"@atlaskit/heading": "^5.3.0",
|
|
45
45
|
"@atlaskit/icon": "^32.0.0",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"@atlaskit/textfield": "^8.2.0",
|
|
73
73
|
"@atlaskit/theme": "^22.0.0",
|
|
74
74
|
"@atlaskit/tile": "^1.0.0",
|
|
75
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
75
|
+
"@atlaskit/tmp-editor-statsig": "^33.0.0",
|
|
76
76
|
"@atlaskit/tokens": "^11.0.0",
|
|
77
77
|
"@atlaskit/tooltip": "^20.14.0",
|
|
78
78
|
"@atlaskit/ufo": "^0.4.0",
|
|
79
79
|
"@babel/runtime": "^7.0.0",
|
|
80
|
-
"@compiled/react": "^0.
|
|
80
|
+
"@compiled/react": "^0.20.0",
|
|
81
81
|
"@formatjs/intl-utils": "^3.8.4",
|
|
82
82
|
"facepaint": "^1.2.1",
|
|
83
83
|
"lru_map": "^0.4.1",
|