@atlaskit/smart-card 26.55.1 → 26.55.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 +7 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/index.js +55 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/types.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +22 -8
- package/dist/cjs/view/HoverCard/components/ContentContainer.js +5 -1
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +12 -10
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +2 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/index.js +39 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/types.js +0 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +27 -15
- package/dist/es2019/view/HoverCard/components/ContentContainer.js +6 -1
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +13 -10
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/index.js +45 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/types.js +0 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +22 -8
- package/dist/esm/view/HoverCard/components/ContentContainer.js +5 -1
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +12 -10
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/types.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts +3 -2
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/types.d.ts +6 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.55.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#90354](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90354) [`3a735d1c33fb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3a735d1c33fb) - Call the useAISummary hook with a product name when it`s available in SmartLinkContext
|
|
8
|
+
- [#87479](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87479) [`d2e75f4df537`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d2e75f4df537) - AI summary: Add transition animation
|
|
9
|
+
|
|
3
10
|
## 26.55.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -23,7 +23,8 @@ function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symb
|
|
|
23
23
|
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
24
24
|
var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
25
25
|
function AISummaryService(props) {
|
|
26
|
-
var _this = this
|
|
26
|
+
var _this = this,
|
|
27
|
+
_props$product;
|
|
27
28
|
(0, _classCallCheck2.default)(this, AISummaryService);
|
|
28
29
|
(0, _defineProperty2.default)(this, "state", {
|
|
29
30
|
content: '',
|
|
@@ -73,7 +74,7 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
73
74
|
headers: _objectSpread({
|
|
74
75
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
75
76
|
'x-experience-id': 'smart-link',
|
|
76
|
-
'x-product': props.product || 'confluence'
|
|
77
|
+
'x-product': ((_props$product = props.product) === null || _props$product === void 0 ? void 0 : _props$product.toLowerCase()) || 'confluence'
|
|
77
78
|
}, props.headers)
|
|
78
79
|
};
|
|
79
80
|
this.url = props.url;
|
|
@@ -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.55.
|
|
25
|
+
packageVersion: "26.55.2"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.AIMotionWrapper = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _primitives = require("@atlaskit/primitives");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
var AIMotionWrapper = exports.AIMotionWrapper = function AIMotionWrapper(_ref) {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
_ref$isFadeIn = _ref.isFadeIn,
|
|
17
|
+
isFadeIn = _ref$isFadeIn === void 0 ? false : _ref$isFadeIn,
|
|
18
|
+
_ref$minHeight = _ref.minHeight,
|
|
19
|
+
minHeight = _ref$minHeight === void 0 ? 0 : _ref$minHeight,
|
|
20
|
+
show = _ref.show,
|
|
21
|
+
_ref$showTransition = _ref.showTransition,
|
|
22
|
+
showTransition = _ref$showTransition === void 0 ? false : _ref$showTransition;
|
|
23
|
+
var _useState = (0, _react.useState)(0),
|
|
24
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
|
+
height = _useState2[0],
|
|
26
|
+
setHeight = _useState2[1];
|
|
27
|
+
var ref = (0, _react.useRef)(null);
|
|
28
|
+
var transition = isFadeIn ? 'height, opacity' : 'height';
|
|
29
|
+
(0, _react.useEffect)(function () {
|
|
30
|
+
if (show && ref.current) {
|
|
31
|
+
// set the height of the error message container explicitly to the height
|
|
32
|
+
// of its contents (including anything hidden due to overflow) so that we
|
|
33
|
+
// can animate the height of the container
|
|
34
|
+
setHeight(ref.current.scrollHeight);
|
|
35
|
+
} else {
|
|
36
|
+
setHeight(0);
|
|
37
|
+
}
|
|
38
|
+
}, [children, show]);
|
|
39
|
+
return show ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
40
|
+
style: {
|
|
41
|
+
height: height,
|
|
42
|
+
minHeight: minHeight,
|
|
43
|
+
lineHeight: 0,
|
|
44
|
+
overflow: 'hidden',
|
|
45
|
+
// a fit for purpose state variable to control when the 'visible' styles should be appled
|
|
46
|
+
opacity: height > 0 ? 1 : 0,
|
|
47
|
+
// we only want to transition opacity and height when the error message is initially shown
|
|
48
|
+
// not if its to be shown on mount
|
|
49
|
+
transitionProperty: showTransition ? transition : 'none',
|
|
50
|
+
transitionDuration: '0.3s'
|
|
51
|
+
},
|
|
52
|
+
ref: ref
|
|
53
|
+
}, children) : null;
|
|
54
|
+
};
|
|
55
|
+
var _default = exports.default = AIMotionWrapper;
|
package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -15,11 +15,13 @@ var _constants = require("../../../../../../constants");
|
|
|
15
15
|
var _actionGroup = _interopRequireDefault(require("../../action-group"));
|
|
16
16
|
var _block = _interopRequireDefault(require("../../block"));
|
|
17
17
|
var _elementGroup = _interopRequireDefault(require("../../element-group"));
|
|
18
|
+
var _aiMotionWrapper = _interopRequireDefault(require("../ai-motion-wrapper"));
|
|
18
19
|
var _aiStateIndicator = _interopRequireDefault(require("../ai-state-indicator"));
|
|
19
20
|
var _utils = require("../../utils");
|
|
20
21
|
var _messages = require("../../../../../../messages");
|
|
21
22
|
var _useAiSummary = require("../../../../../../state/hooks/use-ai-summary");
|
|
22
23
|
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
24
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
23
25
|
var _aiIcon = _interopRequireDefault(require("../../../../../common/ai-icon"));
|
|
24
26
|
var _aiSummary = _interopRequireDefault(require("../../../../../common/ai-summary"));
|
|
25
27
|
var _useAnalyticsEvents2 = require("../../../../../../common/analytics/generated/use-analytics-events");
|
|
@@ -31,16 +33,19 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
31
33
|
var AISummaryBlockErrorIndicator = exports.AISummaryBlockErrorIndicator = function AISummaryBlockErrorIndicator(_ref) {
|
|
32
34
|
var showErrorIndicator = _ref.showErrorIndicator,
|
|
33
35
|
error = _ref.error,
|
|
36
|
+
showTransition = _ref.showTransition,
|
|
34
37
|
testId = _ref.testId;
|
|
35
|
-
return
|
|
36
|
-
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_aiMotionWrapper.default, {
|
|
39
|
+
isFadeIn: true,
|
|
40
|
+
show: showErrorIndicator,
|
|
41
|
+
showTransition: showTransition
|
|
37
42
|
}, /*#__PURE__*/_react.default.createElement(_aiEventErrorViewed.default, {
|
|
38
43
|
reason: error
|
|
39
44
|
}), /*#__PURE__*/_react.default.createElement(_aiStateIndicator.default, {
|
|
40
45
|
error: error,
|
|
41
|
-
state:
|
|
46
|
+
state: "error",
|
|
42
47
|
testId: testId
|
|
43
|
-
}))
|
|
48
|
+
}));
|
|
44
49
|
};
|
|
45
50
|
var AISummaryBlockStatusIndicator = exports.AISummaryBlockStatusIndicator = function AISummaryBlockStatusIndicator(_ref2) {
|
|
46
51
|
var showStatusIndicator = _ref2.showStatusIndicator,
|
|
@@ -63,16 +68,20 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
63
68
|
_props$size = props.size,
|
|
64
69
|
size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size,
|
|
65
70
|
testId = props.testId,
|
|
66
|
-
|
|
71
|
+
_props$aiSummaryMinHe = props.aiSummaryMinHeight,
|
|
72
|
+
aiSummaryMinHeight = _props$aiSummaryMinHe === void 0 ? 0 : _props$aiSummaryMinHe,
|
|
67
73
|
metadata = props.metadata;
|
|
68
74
|
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
69
75
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
70
76
|
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
71
77
|
var url = (context === null || context === void 0 ? void 0 : context.url) || '';
|
|
72
78
|
var ari = (context === null || context === void 0 ? void 0 : context.ari) || '';
|
|
79
|
+
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
80
|
+
product = _useSmartLinkContext.product;
|
|
73
81
|
var _useAISummary = (0, _useAiSummary.useAISummary)({
|
|
74
82
|
url: url,
|
|
75
|
-
ari: ari
|
|
83
|
+
ari: ari,
|
|
84
|
+
product: product
|
|
76
85
|
}),
|
|
77
86
|
summariseUrl = _useAISummary.summariseUrl,
|
|
78
87
|
_useAISummary$state = _useAISummary.state,
|
|
@@ -126,12 +135,16 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
126
135
|
testId: "".concat(testId, "-resolved-view")
|
|
127
136
|
}), status === 'done' && /*#__PURE__*/_react.default.createElement(_aiEventSummaryViewed.default, {
|
|
128
137
|
fromCache: isSummarisedOnMountRef.current
|
|
129
|
-
}),
|
|
138
|
+
}), /*#__PURE__*/_react.default.createElement(_aiMotionWrapper.default, {
|
|
139
|
+
minHeight: aiSummaryMinHeight,
|
|
140
|
+
show: showAISummary,
|
|
141
|
+
showTransition: !isSummarisedOnMountRef.current
|
|
142
|
+
}, /*#__PURE__*/_react.default.createElement(_aiSummary.default, {
|
|
130
143
|
testId: "".concat(testId, "-ai-summary"),
|
|
131
144
|
minHeight: aiSummaryMinHeight,
|
|
132
145
|
content: content,
|
|
133
146
|
showIcon: isSummarisedOnMountRef.current
|
|
134
|
-
}), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
147
|
+
})), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
135
148
|
alignBlock: "center",
|
|
136
149
|
alignInline: "end",
|
|
137
150
|
grow: "fill",
|
|
@@ -148,6 +161,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
148
161
|
size: size
|
|
149
162
|
}))), /*#__PURE__*/_react.default.createElement(AISummaryBlockErrorIndicator, {
|
|
150
163
|
showErrorIndicator: !isErroredOnMountRef.current && status === 'error',
|
|
164
|
+
showTransition: !isErroredOnMountRef.current,
|
|
151
165
|
error: error,
|
|
152
166
|
testId: testId
|
|
153
167
|
}));
|
|
@@ -16,6 +16,7 @@ var _aiPrism = _interopRequireDefault(require("../../common/ai-prism"));
|
|
|
16
16
|
var _HoverCardContent = require("./HoverCardContent");
|
|
17
17
|
var _useAiSummary = require("../../../state/hooks/use-ai-summary");
|
|
18
18
|
var _store = require("../../../state/store");
|
|
19
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
19
20
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
20
21
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
21
22
|
var _excluded = ["children", "isAIEnabled", "testId", "url"],
|
|
@@ -35,9 +36,12 @@ var ConnectedAIPrismContainer = function ConnectedAIPrismContainer(_ref) {
|
|
|
35
36
|
//The data is undefined while the link is resolving.
|
|
36
37
|
var dataUrl = data ? (0, _linkExtractors.extractLink)(data) : null;
|
|
37
38
|
var dataAri = data ? (0, _linkExtractors.extractAri)(data) : null;
|
|
39
|
+
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
40
|
+
product = _useSmartLinkContext.product;
|
|
38
41
|
var _useAISummary = (0, _useAiSummary.useAISummary)({
|
|
39
42
|
url: dataUrl || '',
|
|
40
|
-
ari: dataAri || ''
|
|
43
|
+
ari: dataAri || '',
|
|
44
|
+
product: product
|
|
41
45
|
}),
|
|
42
46
|
status = _useAISummary.state.status;
|
|
43
47
|
var _useState = (0, _react2.useState)(status === 'loading'),
|
|
@@ -22,6 +22,7 @@ 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
24
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
25
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
25
26
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
26
27
|
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); }
|
|
27
28
|
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; }
|
|
@@ -64,11 +65,15 @@ var toFooterActions = exports.toFooterActions = function toFooterActions(cardAct
|
|
|
64
65
|
var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
|
|
65
66
|
var bottomPrimary = _ref.bottomPrimary,
|
|
66
67
|
imagePreview = _ref.imagePreview,
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
data = _ref.data;
|
|
69
|
+
var dataUrl = data ? (0, _linkExtractors.extractLink)(data) : null;
|
|
70
|
+
var dataAri = data ? (0, _linkExtractors.extractAri)(data) : null;
|
|
71
|
+
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
72
|
+
product = _useSmartLinkContext.product;
|
|
69
73
|
var _useAISummary = (0, _useAiSummary.useAISummary)({
|
|
70
|
-
url:
|
|
71
|
-
ari:
|
|
74
|
+
url: dataUrl || '',
|
|
75
|
+
ari: dataAri || '',
|
|
76
|
+
product: product
|
|
72
77
|
}),
|
|
73
78
|
_useAISummary$state = _useAISummary.state,
|
|
74
79
|
status = _useAISummary$state.status,
|
|
@@ -88,7 +93,7 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
|
|
|
88
93
|
})) : null;
|
|
89
94
|
};
|
|
90
95
|
var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
91
|
-
var _cardState$details
|
|
96
|
+
var _cardState$details;
|
|
92
97
|
var flexibleCardProps = _ref2.flexibleCardProps,
|
|
93
98
|
titleBlockProps = _ref2.titleBlockProps,
|
|
94
99
|
analytics = _ref2.analytics,
|
|
@@ -113,8 +118,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
113
118
|
return toFooterActions(cardActions, onActionClick);
|
|
114
119
|
}, [cardActions, onActionClick]);
|
|
115
120
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
116
|
-
var dataUrl = (_extractLink = (0, _linkExtractors.extractLink)(data)) !== null && _extractLink !== void 0 ? _extractLink : '';
|
|
117
|
-
var dataAri = (_extractAri = (0, _linkExtractors.extractAri)(data)) !== null && _extractAri !== void 0 ? _extractAri : '';
|
|
118
121
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
119
122
|
var betterMetadata = (0, _utils.getSimulatedBetterMetadata)(extensionKey, data);
|
|
120
123
|
return {
|
|
@@ -163,9 +166,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
163
166
|
blockRef: connectedAIBlockRef
|
|
164
167
|
}, /*#__PURE__*/_react.default.createElement(ConnectedAIBlock, {
|
|
165
168
|
imagePreview: !!imagePreview,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
bottomPrimary: bottomPrimary
|
|
169
|
+
bottomPrimary: bottomPrimary,
|
|
170
|
+
data: data
|
|
169
171
|
})), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
|
|
170
172
|
status: _constants.SmartLinkStatus.Resolved
|
|
171
173
|
}), /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
|
|
@@ -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.55.
|
|
20
|
+
packageVersion: "26.55.2",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -5,6 +5,7 @@ import { addPath } from './utils';
|
|
|
5
5
|
import { readStream } from './readStream';
|
|
6
6
|
export class AISummaryService {
|
|
7
7
|
constructor(props) {
|
|
8
|
+
var _props$product;
|
|
8
9
|
_defineProperty(this, "state", {
|
|
9
10
|
content: '',
|
|
10
11
|
status: 'ready'
|
|
@@ -39,7 +40,7 @@ export class AISummaryService {
|
|
|
39
40
|
headers: {
|
|
40
41
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
41
42
|
'x-experience-id': 'smart-link',
|
|
42
|
-
'x-product': props.product || 'confluence',
|
|
43
|
+
'x-product': ((_props$product = props.product) === null || _props$product === void 0 ? void 0 : _props$product.toLowerCase()) || 'confluence',
|
|
43
44
|
...props.headers
|
|
44
45
|
}
|
|
45
46
|
};
|
|
@@ -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.55.
|
|
7
|
+
packageVersion: "26.55.2"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Box } from '@atlaskit/primitives';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
export const AIMotionWrapper = ({
|
|
4
|
+
children,
|
|
5
|
+
isFadeIn = false,
|
|
6
|
+
minHeight = 0,
|
|
7
|
+
show,
|
|
8
|
+
showTransition = false
|
|
9
|
+
}) => {
|
|
10
|
+
const [height, setHeight] = useState(0);
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const transition = isFadeIn ? 'height, opacity' : 'height';
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (show && ref.current) {
|
|
15
|
+
// set the height of the error message container explicitly to the height
|
|
16
|
+
// of its contents (including anything hidden due to overflow) so that we
|
|
17
|
+
// can animate the height of the container
|
|
18
|
+
setHeight(ref.current.scrollHeight);
|
|
19
|
+
} else {
|
|
20
|
+
setHeight(0);
|
|
21
|
+
}
|
|
22
|
+
}, [children, show]);
|
|
23
|
+
return show ? /*#__PURE__*/React.createElement(Box, {
|
|
24
|
+
style: {
|
|
25
|
+
height,
|
|
26
|
+
minHeight,
|
|
27
|
+
lineHeight: 0,
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
// a fit for purpose state variable to control when the 'visible' styles should be appled
|
|
30
|
+
opacity: height > 0 ? 1 : 0,
|
|
31
|
+
// we only want to transition opacity and height when the error message is initially shown
|
|
32
|
+
// not if its to be shown on mount
|
|
33
|
+
transitionProperty: showTransition ? transition : 'none',
|
|
34
|
+
transitionDuration: '0.3s'
|
|
35
|
+
},
|
|
36
|
+
ref: ref
|
|
37
|
+
}, children) : null;
|
|
38
|
+
};
|
|
39
|
+
export default AIMotionWrapper;
|
package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/types.js
ADDED
|
File without changes
|
|
@@ -6,11 +6,13 @@ import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '.
|
|
|
6
6
|
import ActionGroup from '../../action-group';
|
|
7
7
|
import Block from '../../block';
|
|
8
8
|
import ElementGroup from '../../element-group';
|
|
9
|
+
import AIMotionWrapper from '../ai-motion-wrapper';
|
|
9
10
|
import AIStateIndicator from '../ai-state-indicator';
|
|
10
11
|
import { renderElementItems } from '../../utils';
|
|
11
12
|
import { messages } from '../../../../../../messages';
|
|
12
13
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
13
14
|
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
15
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
14
16
|
import AIIcon from '../../../../../common/ai-icon';
|
|
15
17
|
import AISummary from '../../../../../common/ai-summary';
|
|
16
18
|
import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
|
|
@@ -20,18 +22,19 @@ import { di } from 'react-magnetic-di';
|
|
|
20
22
|
export const AISummaryBlockErrorIndicator = ({
|
|
21
23
|
showErrorIndicator,
|
|
22
24
|
error,
|
|
25
|
+
showTransition,
|
|
23
26
|
testId
|
|
24
|
-
}) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
27
|
+
}) => /*#__PURE__*/React.createElement(AIMotionWrapper, {
|
|
28
|
+
isFadeIn: true,
|
|
29
|
+
show: showErrorIndicator,
|
|
30
|
+
showTransition: showTransition
|
|
31
|
+
}, /*#__PURE__*/React.createElement(AIEventErrorViewed, {
|
|
32
|
+
reason: error
|
|
33
|
+
}), /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
34
|
+
error: error,
|
|
35
|
+
state: "error",
|
|
36
|
+
testId: testId
|
|
37
|
+
}));
|
|
35
38
|
export const AISummaryBlockStatusIndicator = ({
|
|
36
39
|
showStatusIndicator,
|
|
37
40
|
metadata,
|
|
@@ -53,7 +56,7 @@ const AISummaryBlockResolvedView = props => {
|
|
|
53
56
|
onActionMenuOpenChange,
|
|
54
57
|
size = SmartLinkSize.Medium,
|
|
55
58
|
testId,
|
|
56
|
-
aiSummaryMinHeight,
|
|
59
|
+
aiSummaryMinHeight = 0,
|
|
57
60
|
metadata
|
|
58
61
|
} = props;
|
|
59
62
|
const {
|
|
@@ -62,6 +65,9 @@ const AISummaryBlockResolvedView = props => {
|
|
|
62
65
|
const context = useFlexibleUiContext();
|
|
63
66
|
const url = (context === null || context === void 0 ? void 0 : context.url) || '';
|
|
64
67
|
const ari = (context === null || context === void 0 ? void 0 : context.ari) || '';
|
|
68
|
+
const {
|
|
69
|
+
product
|
|
70
|
+
} = useSmartLinkContext();
|
|
65
71
|
const {
|
|
66
72
|
summariseUrl,
|
|
67
73
|
state: {
|
|
@@ -71,7 +77,8 @@ const AISummaryBlockResolvedView = props => {
|
|
|
71
77
|
}
|
|
72
78
|
} = useAISummary({
|
|
73
79
|
url,
|
|
74
|
-
ari
|
|
80
|
+
ari,
|
|
81
|
+
product
|
|
75
82
|
});
|
|
76
83
|
const showAISummary = status === 'done' ||
|
|
77
84
|
// We want to display the AI Summary component only when there is content available during the loading process.
|
|
@@ -120,12 +127,16 @@ const AISummaryBlockResolvedView = props => {
|
|
|
120
127
|
testId: `${testId}-resolved-view`
|
|
121
128
|
}), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
|
|
122
129
|
fromCache: isSummarisedOnMountRef.current
|
|
123
|
-
}),
|
|
130
|
+
}), /*#__PURE__*/React.createElement(AIMotionWrapper, {
|
|
131
|
+
minHeight: aiSummaryMinHeight,
|
|
132
|
+
show: showAISummary,
|
|
133
|
+
showTransition: !isSummarisedOnMountRef.current
|
|
134
|
+
}, /*#__PURE__*/React.createElement(AISummary, {
|
|
124
135
|
testId: `${testId}-ai-summary`,
|
|
125
136
|
minHeight: aiSummaryMinHeight,
|
|
126
137
|
content: content,
|
|
127
138
|
showIcon: isSummarisedOnMountRef.current
|
|
128
|
-
}), /*#__PURE__*/React.createElement(Inline, {
|
|
139
|
+
})), /*#__PURE__*/React.createElement(Inline, {
|
|
129
140
|
alignBlock: "center",
|
|
130
141
|
alignInline: "end",
|
|
131
142
|
grow: "fill",
|
|
@@ -142,6 +153,7 @@ const AISummaryBlockResolvedView = props => {
|
|
|
142
153
|
size: size
|
|
143
154
|
}))), /*#__PURE__*/React.createElement(AISummaryBlockErrorIndicator, {
|
|
144
155
|
showErrorIndicator: !isErroredOnMountRef.current && status === 'error',
|
|
156
|
+
showTransition: !isErroredOnMountRef.current,
|
|
145
157
|
error: error,
|
|
146
158
|
testId: testId
|
|
147
159
|
}));
|
|
@@ -8,6 +8,7 @@ import AIPrism from '../../common/ai-prism';
|
|
|
8
8
|
import { hoverCardClassName } from './HoverCardContent';
|
|
9
9
|
import { useAISummary } from '../../../state/hooks/use-ai-summary';
|
|
10
10
|
import { useSmartCardState } from '../../../state/store';
|
|
11
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
11
12
|
import { extractAri, extractLink } from '@atlaskit/link-extractors';
|
|
12
13
|
import { di } from 'react-magnetic-di';
|
|
13
14
|
const ConnectedAIPrismContainer = ({
|
|
@@ -24,13 +25,17 @@ const ConnectedAIPrismContainer = ({
|
|
|
24
25
|
//The data is undefined while the link is resolving.
|
|
25
26
|
const dataUrl = data ? extractLink(data) : null;
|
|
26
27
|
const dataAri = data ? extractAri(data) : null;
|
|
28
|
+
const {
|
|
29
|
+
product
|
|
30
|
+
} = useSmartLinkContext();
|
|
27
31
|
const {
|
|
28
32
|
state: {
|
|
29
33
|
status
|
|
30
34
|
}
|
|
31
35
|
} = useAISummary({
|
|
32
36
|
url: dataUrl || '',
|
|
33
|
-
ari: dataAri || ''
|
|
37
|
+
ari: dataAri || '',
|
|
38
|
+
product: product
|
|
34
39
|
});
|
|
35
40
|
const [showPrism, setShowPrism] = useState(status === 'loading');
|
|
36
41
|
useEffect(() => {
|
|
@@ -13,6 +13,7 @@ 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
15
|
import { extractAri, extractLink } from '@atlaskit/link-extractors';
|
|
16
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
16
17
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
17
18
|
import { di } from 'react-magnetic-di';
|
|
18
19
|
export const toFooterActions = (cardActions, onActionClick) => {
|
|
@@ -54,17 +55,22 @@ export const toFooterActions = (cardActions, onActionClick) => {
|
|
|
54
55
|
const ConnectedAIBlock = ({
|
|
55
56
|
bottomPrimary,
|
|
56
57
|
imagePreview,
|
|
57
|
-
|
|
58
|
-
ari
|
|
58
|
+
data
|
|
59
59
|
}) => {
|
|
60
|
+
const dataUrl = data ? extractLink(data) : null;
|
|
61
|
+
const dataAri = data ? extractAri(data) : null;
|
|
62
|
+
const {
|
|
63
|
+
product
|
|
64
|
+
} = useSmartLinkContext();
|
|
60
65
|
const {
|
|
61
66
|
state: {
|
|
62
67
|
status,
|
|
63
68
|
content
|
|
64
69
|
}
|
|
65
70
|
} = useAISummary({
|
|
66
|
-
url,
|
|
67
|
-
ari
|
|
71
|
+
url: dataUrl || '',
|
|
72
|
+
ari: dataAri || '',
|
|
73
|
+
product
|
|
68
74
|
});
|
|
69
75
|
const showData = status === 'ready' || status === 'error' ||
|
|
70
76
|
// Description & bottom metadata should only disappear when we start getting summary content
|
|
@@ -91,7 +97,7 @@ const HoverCardResolvedView = ({
|
|
|
91
97
|
extensionKey,
|
|
92
98
|
url
|
|
93
99
|
}) => {
|
|
94
|
-
var _cardState$details
|
|
100
|
+
var _cardState$details;
|
|
95
101
|
const canBeDatasource = getCanBeDatasource(cardState.details);
|
|
96
102
|
useEffect(() => {
|
|
97
103
|
// Since this hover view is only rendered on resolved status,
|
|
@@ -104,8 +110,6 @@ const HoverCardResolvedView = ({
|
|
|
104
110
|
}, [analytics.ui, cardState.status, canBeDatasource]);
|
|
105
111
|
const footerActions = useMemo(() => toFooterActions(cardActions, onActionClick), [cardActions, onActionClick]);
|
|
106
112
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
107
|
-
const dataUrl = (_extractLink = extractLink(data)) !== null && _extractLink !== void 0 ? _extractLink : '';
|
|
108
|
-
const dataAri = (_extractAri = extractAri(data)) !== null && _extractAri !== void 0 ? _extractAri : '';
|
|
109
113
|
const {
|
|
110
114
|
topPrimary,
|
|
111
115
|
topSecondary,
|
|
@@ -155,9 +159,8 @@ const HoverCardResolvedView = ({
|
|
|
155
159
|
blockRef: connectedAIBlockRef
|
|
156
160
|
}, /*#__PURE__*/React.createElement(ConnectedAIBlock, {
|
|
157
161
|
imagePreview: !!imagePreview,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
bottomPrimary: bottomPrimary
|
|
162
|
+
bottomPrimary: bottomPrimary,
|
|
163
|
+
data: data
|
|
161
164
|
})), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
162
165
|
status: SmartLinkStatus.Resolved
|
|
163
166
|
}), /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
@@ -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.55.
|
|
10
|
+
packageVersion: "26.55.2",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -16,7 +16,8 @@ import { addPath } from './utils';
|
|
|
16
16
|
import { readStream } from './readStream';
|
|
17
17
|
export var AISummaryService = /*#__PURE__*/function () {
|
|
18
18
|
function AISummaryService(props) {
|
|
19
|
-
var _this = this
|
|
19
|
+
var _this = this,
|
|
20
|
+
_props$product;
|
|
20
21
|
_classCallCheck(this, AISummaryService);
|
|
21
22
|
_defineProperty(this, "state", {
|
|
22
23
|
content: '',
|
|
@@ -66,7 +67,7 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
66
67
|
headers: _objectSpread({
|
|
67
68
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
68
69
|
'x-experience-id': 'smart-link',
|
|
69
|
-
'x-product': props.product || 'confluence'
|
|
70
|
+
'x-product': ((_props$product = props.product) === null || _props$product === void 0 ? void 0 : _props$product.toLowerCase()) || 'confluence'
|
|
70
71
|
}, props.headers)
|
|
71
72
|
};
|
|
72
73
|
this.url = props.url;
|
|
@@ -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.55.
|
|
18
|
+
packageVersion: "26.55.2"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { Box } from '@atlaskit/primitives';
|
|
3
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
4
|
+
export var AIMotionWrapper = function AIMotionWrapper(_ref) {
|
|
5
|
+
var children = _ref.children,
|
|
6
|
+
_ref$isFadeIn = _ref.isFadeIn,
|
|
7
|
+
isFadeIn = _ref$isFadeIn === void 0 ? false : _ref$isFadeIn,
|
|
8
|
+
_ref$minHeight = _ref.minHeight,
|
|
9
|
+
minHeight = _ref$minHeight === void 0 ? 0 : _ref$minHeight,
|
|
10
|
+
show = _ref.show,
|
|
11
|
+
_ref$showTransition = _ref.showTransition,
|
|
12
|
+
showTransition = _ref$showTransition === void 0 ? false : _ref$showTransition;
|
|
13
|
+
var _useState = useState(0),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
height = _useState2[0],
|
|
16
|
+
setHeight = _useState2[1];
|
|
17
|
+
var ref = useRef(null);
|
|
18
|
+
var transition = isFadeIn ? 'height, opacity' : 'height';
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
if (show && ref.current) {
|
|
21
|
+
// set the height of the error message container explicitly to the height
|
|
22
|
+
// of its contents (including anything hidden due to overflow) so that we
|
|
23
|
+
// can animate the height of the container
|
|
24
|
+
setHeight(ref.current.scrollHeight);
|
|
25
|
+
} else {
|
|
26
|
+
setHeight(0);
|
|
27
|
+
}
|
|
28
|
+
}, [children, show]);
|
|
29
|
+
return show ? /*#__PURE__*/React.createElement(Box, {
|
|
30
|
+
style: {
|
|
31
|
+
height: height,
|
|
32
|
+
minHeight: minHeight,
|
|
33
|
+
lineHeight: 0,
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
// a fit for purpose state variable to control when the 'visible' styles should be appled
|
|
36
|
+
opacity: height > 0 ? 1 : 0,
|
|
37
|
+
// we only want to transition opacity and height when the error message is initially shown
|
|
38
|
+
// not if its to be shown on mount
|
|
39
|
+
transitionProperty: showTransition ? transition : 'none',
|
|
40
|
+
transitionDuration: '0.3s'
|
|
41
|
+
},
|
|
42
|
+
ref: ref
|
|
43
|
+
}, children) : null;
|
|
44
|
+
};
|
|
45
|
+
export default AIMotionWrapper;
|
package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-motion-wrapper/types.js
ADDED
|
File without changes
|
|
@@ -7,11 +7,13 @@ import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '.
|
|
|
7
7
|
import ActionGroup from '../../action-group';
|
|
8
8
|
import Block from '../../block';
|
|
9
9
|
import ElementGroup from '../../element-group';
|
|
10
|
+
import AIMotionWrapper from '../ai-motion-wrapper';
|
|
10
11
|
import AIStateIndicator from '../ai-state-indicator';
|
|
11
12
|
import { renderElementItems } from '../../utils';
|
|
12
13
|
import { messages } from '../../../../../../messages';
|
|
13
14
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
14
15
|
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
16
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
15
17
|
import AIIcon from '../../../../../common/ai-icon';
|
|
16
18
|
import AISummary from '../../../../../common/ai-summary';
|
|
17
19
|
import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
|
|
@@ -21,16 +23,19 @@ import { di } from 'react-magnetic-di';
|
|
|
21
23
|
export var AISummaryBlockErrorIndicator = function AISummaryBlockErrorIndicator(_ref) {
|
|
22
24
|
var showErrorIndicator = _ref.showErrorIndicator,
|
|
23
25
|
error = _ref.error,
|
|
26
|
+
showTransition = _ref.showTransition,
|
|
24
27
|
testId = _ref.testId;
|
|
25
|
-
return
|
|
26
|
-
|
|
28
|
+
return /*#__PURE__*/React.createElement(AIMotionWrapper, {
|
|
29
|
+
isFadeIn: true,
|
|
30
|
+
show: showErrorIndicator,
|
|
31
|
+
showTransition: showTransition
|
|
27
32
|
}, /*#__PURE__*/React.createElement(AIEventErrorViewed, {
|
|
28
33
|
reason: error
|
|
29
34
|
}), /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
30
35
|
error: error,
|
|
31
|
-
state:
|
|
36
|
+
state: "error",
|
|
32
37
|
testId: testId
|
|
33
|
-
}))
|
|
38
|
+
}));
|
|
34
39
|
};
|
|
35
40
|
export var AISummaryBlockStatusIndicator = function AISummaryBlockStatusIndicator(_ref2) {
|
|
36
41
|
var showStatusIndicator = _ref2.showStatusIndicator,
|
|
@@ -53,16 +58,20 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
53
58
|
_props$size = props.size,
|
|
54
59
|
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
|
|
55
60
|
testId = props.testId,
|
|
56
|
-
|
|
61
|
+
_props$aiSummaryMinHe = props.aiSummaryMinHeight,
|
|
62
|
+
aiSummaryMinHeight = _props$aiSummaryMinHe === void 0 ? 0 : _props$aiSummaryMinHe,
|
|
57
63
|
metadata = props.metadata;
|
|
58
64
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
59
65
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
60
66
|
var context = useFlexibleUiContext();
|
|
61
67
|
var url = (context === null || context === void 0 ? void 0 : context.url) || '';
|
|
62
68
|
var ari = (context === null || context === void 0 ? void 0 : context.ari) || '';
|
|
69
|
+
var _useSmartLinkContext = useSmartLinkContext(),
|
|
70
|
+
product = _useSmartLinkContext.product;
|
|
63
71
|
var _useAISummary = useAISummary({
|
|
64
72
|
url: url,
|
|
65
|
-
ari: ari
|
|
73
|
+
ari: ari,
|
|
74
|
+
product: product
|
|
66
75
|
}),
|
|
67
76
|
summariseUrl = _useAISummary.summariseUrl,
|
|
68
77
|
_useAISummary$state = _useAISummary.state,
|
|
@@ -116,12 +125,16 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
116
125
|
testId: "".concat(testId, "-resolved-view")
|
|
117
126
|
}), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
|
|
118
127
|
fromCache: isSummarisedOnMountRef.current
|
|
119
|
-
}),
|
|
128
|
+
}), /*#__PURE__*/React.createElement(AIMotionWrapper, {
|
|
129
|
+
minHeight: aiSummaryMinHeight,
|
|
130
|
+
show: showAISummary,
|
|
131
|
+
showTransition: !isSummarisedOnMountRef.current
|
|
132
|
+
}, /*#__PURE__*/React.createElement(AISummary, {
|
|
120
133
|
testId: "".concat(testId, "-ai-summary"),
|
|
121
134
|
minHeight: aiSummaryMinHeight,
|
|
122
135
|
content: content,
|
|
123
136
|
showIcon: isSummarisedOnMountRef.current
|
|
124
|
-
}), /*#__PURE__*/React.createElement(Inline, {
|
|
137
|
+
})), /*#__PURE__*/React.createElement(Inline, {
|
|
125
138
|
alignBlock: "center",
|
|
126
139
|
alignInline: "end",
|
|
127
140
|
grow: "fill",
|
|
@@ -138,6 +151,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
138
151
|
size: size
|
|
139
152
|
}))), /*#__PURE__*/React.createElement(AISummaryBlockErrorIndicator, {
|
|
140
153
|
showErrorIndicator: !isErroredOnMountRef.current && status === 'error',
|
|
154
|
+
showTransition: !isErroredOnMountRef.current,
|
|
141
155
|
error: error,
|
|
142
156
|
testId: testId
|
|
143
157
|
}));
|
|
@@ -12,6 +12,7 @@ import AIPrism from '../../common/ai-prism';
|
|
|
12
12
|
import { hoverCardClassName } from './HoverCardContent';
|
|
13
13
|
import { useAISummary } from '../../../state/hooks/use-ai-summary';
|
|
14
14
|
import { useSmartCardState } from '../../../state/store';
|
|
15
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
15
16
|
import { extractAri, extractLink } from '@atlaskit/link-extractors';
|
|
16
17
|
import { di } from 'react-magnetic-di';
|
|
17
18
|
var ConnectedAIPrismContainer = function ConnectedAIPrismContainer(_ref) {
|
|
@@ -28,9 +29,12 @@ var ConnectedAIPrismContainer = function ConnectedAIPrismContainer(_ref) {
|
|
|
28
29
|
//The data is undefined while the link is resolving.
|
|
29
30
|
var dataUrl = data ? extractLink(data) : null;
|
|
30
31
|
var dataAri = data ? extractAri(data) : null;
|
|
32
|
+
var _useSmartLinkContext = useSmartLinkContext(),
|
|
33
|
+
product = _useSmartLinkContext.product;
|
|
31
34
|
var _useAISummary = useAISummary({
|
|
32
35
|
url: dataUrl || '',
|
|
33
|
-
ari: dataAri || ''
|
|
36
|
+
ari: dataAri || '',
|
|
37
|
+
product: product
|
|
34
38
|
}),
|
|
35
39
|
status = _useAISummary.state.status;
|
|
36
40
|
var _useState = useState(status === 'loading'),
|
|
@@ -14,6 +14,7 @@ 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
16
|
import { extractAri, extractLink } from '@atlaskit/link-extractors';
|
|
17
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
17
18
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
18
19
|
import { di } from 'react-magnetic-di';
|
|
19
20
|
export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
|
|
@@ -55,11 +56,15 @@ export var toFooterActions = function toFooterActions(cardActions, onActionClick
|
|
|
55
56
|
var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
|
|
56
57
|
var bottomPrimary = _ref.bottomPrimary,
|
|
57
58
|
imagePreview = _ref.imagePreview,
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
data = _ref.data;
|
|
60
|
+
var dataUrl = data ? extractLink(data) : null;
|
|
61
|
+
var dataAri = data ? extractAri(data) : null;
|
|
62
|
+
var _useSmartLinkContext = useSmartLinkContext(),
|
|
63
|
+
product = _useSmartLinkContext.product;
|
|
60
64
|
var _useAISummary = useAISummary({
|
|
61
|
-
url:
|
|
62
|
-
ari:
|
|
65
|
+
url: dataUrl || '',
|
|
66
|
+
ari: dataAri || '',
|
|
67
|
+
product: product
|
|
63
68
|
}),
|
|
64
69
|
_useAISummary$state = _useAISummary.state,
|
|
65
70
|
status = _useAISummary$state.status,
|
|
@@ -79,7 +84,7 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
|
|
|
79
84
|
})) : null;
|
|
80
85
|
};
|
|
81
86
|
var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
82
|
-
var _cardState$details
|
|
87
|
+
var _cardState$details;
|
|
83
88
|
var flexibleCardProps = _ref2.flexibleCardProps,
|
|
84
89
|
titleBlockProps = _ref2.titleBlockProps,
|
|
85
90
|
analytics = _ref2.analytics,
|
|
@@ -104,8 +109,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
104
109
|
return toFooterActions(cardActions, onActionClick);
|
|
105
110
|
}, [cardActions, onActionClick]);
|
|
106
111
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
107
|
-
var dataUrl = (_extractLink = extractLink(data)) !== null && _extractLink !== void 0 ? _extractLink : '';
|
|
108
|
-
var dataAri = (_extractAri = extractAri(data)) !== null && _extractAri !== void 0 ? _extractAri : '';
|
|
109
112
|
var _useMemo = useMemo(function () {
|
|
110
113
|
var betterMetadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
111
114
|
return {
|
|
@@ -154,9 +157,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
154
157
|
blockRef: connectedAIBlockRef
|
|
155
158
|
}, /*#__PURE__*/React.createElement(ConnectedAIBlock, {
|
|
156
159
|
imagePreview: !!imagePreview,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
bottomPrimary: bottomPrimary
|
|
160
|
+
bottomPrimary: bottomPrimary,
|
|
161
|
+
data: data
|
|
160
162
|
})), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
161
163
|
status: SmartLinkStatus.Resolved
|
|
162
164
|
}), /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
@@ -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.55.
|
|
13
|
+
packageVersion: "26.55.2",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="filesystem" />
|
|
2
|
+
import type { ProductType } from '@atlaskit/linking-common';
|
|
2
3
|
export interface AISummaryServiceInt {
|
|
3
4
|
summariseUrl: () => Promise<void>;
|
|
4
5
|
state: AISummaryState;
|
|
@@ -22,7 +23,6 @@ export type AISummaryServiceConfig = {
|
|
|
22
23
|
headers: Record<string, string>;
|
|
23
24
|
};
|
|
24
25
|
export type AISummaryStatus = 'ready' | 'loading' | 'error' | 'done';
|
|
25
|
-
export type ProductType = 'confluence' | 'atlas' | 'jpd' | 'jsm' | 'jsw' | 'jwm' | 'bitbucket' | 'trello';
|
|
26
26
|
export type PostAgentPayload = {
|
|
27
27
|
recipient_agent_named_id: string;
|
|
28
28
|
agent_input_context: AgentInputContext;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AISummaryBlockProps } from '../types';
|
|
3
3
|
import type { AISummaryStatus, ErrorMessage } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
|
|
4
|
-
export declare const AISummaryBlockErrorIndicator: ({ showErrorIndicator, error, testId, }: {
|
|
4
|
+
export declare const AISummaryBlockErrorIndicator: ({ showErrorIndicator, error, showTransition, testId, }: {
|
|
5
5
|
showErrorIndicator: boolean;
|
|
6
6
|
error?: "NETWORK_ERROR" | "NO_ANSWER" | "RATE_LIMIT" | "NO_AGENT" | "PLUGIN_ERRORED" | "OPENAI_RATE_LIMIT_USER_ABUSE" | "ACCEPTABLE_USE_VIOLATIONS" | "AI_DISABLED" | "UNEXPECTED" | undefined;
|
|
7
|
-
|
|
7
|
+
showTransition: boolean;
|
|
8
|
+
} & Pick<AISummaryBlockProps, "testId">) => JSX.Element;
|
|
8
9
|
export declare const AISummaryBlockStatusIndicator: ({ showStatusIndicator, metadata, status, testId, }: {
|
|
9
10
|
showStatusIndicator: boolean;
|
|
10
11
|
status: AISummaryStatus;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="filesystem" />
|
|
2
|
+
import type { ProductType } from '@atlaskit/linking-common';
|
|
2
3
|
export interface AISummaryServiceInt {
|
|
3
4
|
summariseUrl: () => Promise<void>;
|
|
4
5
|
state: AISummaryState;
|
|
@@ -22,7 +23,6 @@ export type AISummaryServiceConfig = {
|
|
|
22
23
|
headers: Record<string, string>;
|
|
23
24
|
};
|
|
24
25
|
export type AISummaryStatus = 'ready' | 'loading' | 'error' | 'done';
|
|
25
|
-
export type ProductType = 'confluence' | 'atlas' | 'jpd' | 'jsm' | 'jsw' | 'jwm' | 'bitbucket' | 'trello';
|
|
26
26
|
export type PostAgentPayload = {
|
|
27
27
|
recipient_agent_named_id: string;
|
|
28
28
|
agent_input_context: AgentInputContext;
|
package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AISummaryBlockProps } from '../types';
|
|
3
3
|
import type { AISummaryStatus, ErrorMessage } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
|
|
4
|
-
export declare const AISummaryBlockErrorIndicator: ({ showErrorIndicator, error, testId, }: {
|
|
4
|
+
export declare const AISummaryBlockErrorIndicator: ({ showErrorIndicator, error, showTransition, testId, }: {
|
|
5
5
|
showErrorIndicator: boolean;
|
|
6
6
|
error?: "NETWORK_ERROR" | "NO_ANSWER" | "RATE_LIMIT" | "NO_AGENT" | "PLUGIN_ERRORED" | "OPENAI_RATE_LIMIT_USER_ABUSE" | "ACCEPTABLE_USE_VIOLATIONS" | "AI_DISABLED" | "UNEXPECTED" | undefined;
|
|
7
|
-
|
|
7
|
+
showTransition: boolean;
|
|
8
|
+
} & Pick<AISummaryBlockProps, "testId">) => JSX.Element;
|
|
8
9
|
export declare const AISummaryBlockStatusIndicator: ({ showStatusIndicator, metadata, status, testId, }: {
|
|
9
10
|
showStatusIndicator: boolean;
|
|
10
11
|
status: AISummaryStatus;
|