@atlaskit/smart-card 26.48.2 → 26.48.4
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 +12 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +79 -33
- package/dist/cjs/state/hooks/use-ai-summary/index.js +41 -16
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/index.js +15 -2
- package/dist/cjs/view/CardWithUrl/component.js +2 -2
- package/dist/cjs/view/EmbedCard/components/ExpandedFrame.js +6 -11
- package/dist/cjs/view/EmbedCard/index.js +4 -3
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +0 -2
- package/dist/cjs/view/EmbedCard/views/unresolved-view/index.js +10 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +1 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +2 -3
- package/dist/cjs/view/FlexibleCard/components/container/index.js +1 -2
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -3
- package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +1 -2
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +2 -3
- package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +1 -2
- package/dist/cjs/view/HoverCard/utils.js +1 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +17 -8
- package/dist/es2019/state/hooks/use-ai-summary/index.js +38 -17
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/index.js +13 -0
- package/dist/es2019/view/CardWithUrl/component.js +3 -3
- package/dist/es2019/view/EmbedCard/components/ExpandedFrame.js +4 -6
- package/dist/es2019/view/EmbedCard/index.js +4 -3
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +0 -2
- package/dist/es2019/view/EmbedCard/views/unresolved-view/index.js +10 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +1 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +3 -4
- package/dist/es2019/view/FlexibleCard/components/container/index.js +1 -2
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -3
- package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +1 -2
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +6 -7
- package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +1 -2
- package/dist/es2019/view/HoverCard/utils.js +1 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +79 -33
- package/dist/esm/state/hooks/use-ai-summary/index.js +42 -17
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/index.js +14 -1
- package/dist/esm/view/CardWithUrl/component.js +3 -3
- package/dist/esm/view/EmbedCard/components/ExpandedFrame.js +5 -8
- package/dist/esm/view/EmbedCard/index.js +4 -3
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +0 -2
- package/dist/esm/view/EmbedCard/views/unresolved-view/index.js +10 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +1 -4
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +2 -3
- package/dist/esm/view/FlexibleCard/components/container/index.js +1 -2
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -3
- package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +1 -2
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +2 -3
- package/dist/esm/view/FlexibleCard/components/elements/text/index.js +1 -2
- package/dist/esm/view/HoverCard/utils.js +1 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -2
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +1 -1
- package/dist/types/state/hooks/use-ai-summary/index.d.ts +1 -1
- package/dist/types/utils/index.d.ts +7 -1
- package/dist/types/view/EmbedCard/components/ExpandedFrame.d.ts +0 -2
- package/dist/types/view/EmbedCard/types.d.ts +0 -1
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +0 -2
- package/dist/types/view/EmbedCard/views/forbidden-view/types.d.ts +4 -4
- package/dist/types/view/EmbedCard/views/not-found-view/types.d.ts +4 -4
- package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +3 -3
- package/dist/types/view/EmbedCard/views/unresolved-view/types.d.ts +5 -12
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -2
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/index.d.ts +7 -1
- package/dist/types-ts4.5/view/EmbedCard/components/ExpandedFrame.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/types.d.ts +0 -1
- package/dist/types-ts4.5/view/EmbedCard/views/ResolvedView.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/views/forbidden-view/types.d.ts +4 -4
- package/dist/types-ts4.5/view/EmbedCard/views/not-found-view/types.d.ts +4 -4
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +3 -3
- package/dist/types-ts4.5/view/EmbedCard/views/unresolved-view/types.d.ts +5 -12
- package/package.json +2 -2
- package/dist/cjs/utils/token.js +0 -27
- package/dist/cjs/view/EmbedCard/views/UnresolvedView.js +0 -82
- package/dist/es2019/utils/token.js +0 -21
- package/dist/es2019/view/EmbedCard/views/UnresolvedView.js +0 -75
- package/dist/esm/utils/token.js +0 -21
- package/dist/esm/view/EmbedCard/views/UnresolvedView.js +0 -74
- package/dist/types/utils/token.d.ts +0 -21
- package/dist/types/view/EmbedCard/views/UnresolvedView.d.ts +0 -22
- package/dist/types-ts4.5/utils/token.d.ts +0 -21
- package/dist/types-ts4.5/view/EmbedCard/views/UnresolvedView.d.ts +0 -22
|
@@ -9,11 +9,10 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _utils = require("../../utils");
|
|
12
|
-
var _token = require("../../../../../utils/token");
|
|
13
12
|
var _templateObject;
|
|
14
13
|
/** @jsx jsx */
|
|
15
14
|
var getStyles = function getStyles(maxLines) {
|
|
16
|
-
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n white-space: normal;\n ", "\n"])),
|
|
15
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n white-space: normal;\n ", "\n"])), "var(--ds-text-subtlest, #626F86)", (0, _utils.getTruncateStyles)(maxLines));
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -210,5 +210,5 @@ var getIsAISummaryEnabled = exports.getIsAISummaryEnabled = function getIsAISumm
|
|
|
210
210
|
var _response$meta;
|
|
211
211
|
var isAdminHubAIEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
212
212
|
var response = arguments.length > 1 ? arguments[1] : undefined;
|
|
213
|
-
return Boolean((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && (response === null || response === void 0 || (_response$meta = response.meta) === null || _response$meta === void 0 || (_response$meta = _response$meta.
|
|
213
|
+
return Boolean((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && (response === null || response === void 0 || (_response$meta = response.meta) === null || _response$meta === void 0 || (_response$meta = _response$meta.supportedFeature) === null || _response$meta === void 0 ? void 0 : _response$meta.includes('AISummary')));
|
|
214
214
|
};
|
|
@@ -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.48.
|
|
20
|
+
packageVersion: "26.48.4",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -6,7 +6,7 @@ export class AISummaryService {
|
|
|
6
6
|
content: '',
|
|
7
7
|
status: 'ready'
|
|
8
8
|
});
|
|
9
|
-
_defineProperty(this, "
|
|
9
|
+
_defineProperty(this, "subscribedStateSetters", new Set());
|
|
10
10
|
_defineProperty(this, "fetchStream", async summaryStyle => {
|
|
11
11
|
const payload = {
|
|
12
12
|
recipient_agent_named_id: 'summary_agent',
|
|
@@ -47,25 +47,34 @@ export class AISummaryService {
|
|
|
47
47
|
...this.state,
|
|
48
48
|
status: 'loading'
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
for (const subscriber of this.subscribedStateSetters) {
|
|
51
|
+
subscriber(this.state);
|
|
52
|
+
}
|
|
51
53
|
const stream = await this.fetchStream(summaryStyle);
|
|
52
54
|
let bufferContent = '';
|
|
53
55
|
for await (const chunk of stream) {
|
|
54
56
|
if (chunk.type === 'ANSWER_PART') {
|
|
55
57
|
bufferContent += chunk.message.content;
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
for (const subscriber of this.subscribedStateSetters) {
|
|
59
|
+
subscriber({
|
|
60
|
+
...this.state,
|
|
61
|
+
content: bufferContent
|
|
62
|
+
});
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
this.state = {
|
|
63
67
|
status: 'done',
|
|
64
68
|
content: bufferContent
|
|
65
69
|
};
|
|
66
|
-
|
|
70
|
+
for (const subscriber of this.subscribedStateSetters) {
|
|
71
|
+
subscriber(this.state);
|
|
72
|
+
}
|
|
67
73
|
}
|
|
68
74
|
subscribe(stateSetter) {
|
|
69
|
-
this.
|
|
75
|
+
this.subscribedStateSetters.add(stateSetter);
|
|
76
|
+
return () => {
|
|
77
|
+
this.subscribedStateSetters.delete(stateSetter);
|
|
78
|
+
};
|
|
70
79
|
}
|
|
71
80
|
}
|
|
@@ -1,34 +1,55 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
1
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import { AISummariesStore } from './ai-summary-service/store';
|
|
3
3
|
import { AISummaryService } from './ai-summary-service';
|
|
4
4
|
export const useAISummary = props => {
|
|
5
|
+
var _AISummariesStore$get;
|
|
5
6
|
const {
|
|
6
|
-
url
|
|
7
|
+
url,
|
|
8
|
+
baseUrl,
|
|
9
|
+
product,
|
|
10
|
+
headers
|
|
7
11
|
} = props;
|
|
8
|
-
const
|
|
9
|
-
const isAISummaryServiceInitiated = !!aISummaryService;
|
|
10
|
-
const [state, setState] = useState(isAISummaryServiceInitiated ? aISummaryService.state : {
|
|
12
|
+
const [state, setState] = useState(((_AISummariesStore$get = AISummariesStore.get(url)) === null || _AISummariesStore$get === void 0 ? void 0 : _AISummariesStore$get.state) || {
|
|
11
13
|
status: 'ready',
|
|
12
14
|
content: ''
|
|
13
15
|
});
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
// Can be used to know the summary status upon mounting a component (HoverCard UI state for example).
|
|
18
|
+
// For other scenarios, opt for dynamic status updates via state.status.
|
|
19
|
+
const isSummarisedOnMount = useMemo(() => {
|
|
20
|
+
var _AISummariesStore$get2;
|
|
21
|
+
return ((_AISummariesStore$get2 = AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.state.status) === 'done';
|
|
22
|
+
}, [url]);
|
|
15
23
|
useEffect(() => {
|
|
16
|
-
if
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
// Create or subscribe to an AI service only if a summary has not been previously generated.
|
|
25
|
+
// Otherwise, use the data from the current state synchronized with a cache (AISummariesStore).
|
|
26
|
+
if (!isSummarisedOnMount) {
|
|
27
|
+
const aISummaryService = AISummariesStore.get(url);
|
|
28
|
+
const isAISummaryServiceInitiated = !!aISummaryService;
|
|
29
|
+
if (isAISummaryServiceInitiated) {
|
|
30
|
+
//if we want to subscribe to updates from an existing AI service that has not yet provided a summary or is currently in progress.
|
|
31
|
+
const unsubscribe = aISummaryService.subscribe(setState);
|
|
32
|
+
return () => unsubscribe();
|
|
33
|
+
} else {
|
|
34
|
+
var _AISummariesStore$get3;
|
|
35
|
+
//if we want to create a new AI service and wish to subscribe for updates
|
|
36
|
+
AISummariesStore.set(url, new AISummaryService({
|
|
37
|
+
url,
|
|
38
|
+
baseUrl,
|
|
39
|
+
product,
|
|
40
|
+
headers
|
|
41
|
+
}));
|
|
42
|
+
const unsubscribe = (_AISummariesStore$get3 = AISummariesStore.get(url)) === null || _AISummariesStore$get3 === void 0 ? void 0 : _AISummariesStore$get3.subscribe(setState);
|
|
43
|
+
return () => unsubscribe && unsubscribe();
|
|
20
44
|
}
|
|
21
|
-
return (_AISummariesStore$get = AISummariesStore.get(url)) === null || _AISummariesStore$get === void 0 ? void 0 : _AISummariesStore$get.subscribe(setState);
|
|
22
45
|
}
|
|
23
|
-
}, [
|
|
46
|
+
}, [isSummarisedOnMount, url, baseUrl, product, headers]);
|
|
24
47
|
const summariseUrl = () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
return;
|
|
48
|
+
var _AISummariesStore$get4;
|
|
49
|
+
return (_AISummariesStore$get4 = AISummariesStore.get(url)) === null || _AISummariesStore$get4 === void 0 ? void 0 : _AISummariesStore$get4.summariseUrl();
|
|
29
50
|
};
|
|
30
51
|
return {
|
|
31
|
-
|
|
52
|
+
isSummarisedOnMount,
|
|
32
53
|
summariseUrl,
|
|
33
54
|
state
|
|
34
55
|
};
|
|
@@ -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.48.
|
|
7
|
+
packageVersion: "26.48.4"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -154,4 +154,17 @@ export const openUrl = async url => {
|
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
window.open(url, '_blank', 'noopener=yes');
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Migrate internal usages of the deprecated isFrameVisible to frameStyle
|
|
161
|
+
* This function is to be removed on deprecation of isFrameVisible.
|
|
162
|
+
*/
|
|
163
|
+
export const combineFrameStyle = (frameStyle, isFrameVisible) => {
|
|
164
|
+
if (frameStyle !== undefined) {
|
|
165
|
+
return frameStyle;
|
|
166
|
+
}
|
|
167
|
+
if (isFrameVisible) {
|
|
168
|
+
return 'show';
|
|
169
|
+
}
|
|
157
170
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
4
|
-
import { isSpecialEvent } from '../../utils';
|
|
4
|
+
import { combineFrameStyle, isSpecialEvent } from '../../utils';
|
|
5
5
|
import * as measure from '../../utils/performance';
|
|
6
6
|
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct, getCanBeDatasource } from '../../state/helpers';
|
|
7
7
|
import { useSmartLink } from '../../state';
|
|
@@ -20,7 +20,7 @@ function Component({
|
|
|
20
20
|
isSelected,
|
|
21
21
|
isHovered,
|
|
22
22
|
isFrameVisible,
|
|
23
|
-
frameStyle,
|
|
23
|
+
frameStyle: frameStyleProp,
|
|
24
24
|
platform,
|
|
25
25
|
onClick,
|
|
26
26
|
appearance,
|
|
@@ -66,6 +66,7 @@ function Component({
|
|
|
66
66
|
let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
|
|
67
67
|
const enableFlexibleBlockCardFlag = Boolean(useFeatureFlag('enableFlexibleBlockCard'));
|
|
68
68
|
const actionOptions = combineActionOptions(actionOptionsProp, showServerActions, showActions, platform);
|
|
69
|
+
const frameStyle = combineFrameStyle(frameStyleProp, isFrameVisible);
|
|
69
70
|
|
|
70
71
|
// Setup UI handlers.
|
|
71
72
|
const handleClickWrapper = useCallback(event => {
|
|
@@ -248,7 +249,6 @@ function Component({
|
|
|
248
249
|
handleInvoke: handleInvoke,
|
|
249
250
|
analytics: analytics,
|
|
250
251
|
isSelected: isSelected,
|
|
251
|
-
isFrameVisible: isFrameVisible,
|
|
252
252
|
frameStyle: frameStyle,
|
|
253
253
|
platform: platform,
|
|
254
254
|
onResolve: onResolve,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { className, LinkWrapper, Wrapper, Header, IconWrapper, TextWrapper, Content } from './styled';
|
|
3
3
|
import { handleClickCommon } from '../../BlockCard/utils/handlers';
|
|
4
4
|
import { useMouseDownEvent } from '../../../state/analytics/useLinkClicked';
|
|
@@ -9,8 +9,7 @@ export const ExpandedFrame = ({
|
|
|
9
9
|
icon,
|
|
10
10
|
text,
|
|
11
11
|
isSelected,
|
|
12
|
-
|
|
13
|
-
frameStyle,
|
|
12
|
+
frameStyle = 'showOnHover',
|
|
14
13
|
href,
|
|
15
14
|
minWidth,
|
|
16
15
|
maxWidth,
|
|
@@ -21,7 +20,6 @@ export const ExpandedFrame = ({
|
|
|
21
20
|
const isInteractive = () => !isPlaceholder && (Boolean(href) || Boolean(onClick));
|
|
22
21
|
const handleClick = event => handleClickCommon(event, onClick);
|
|
23
22
|
const handleMouseDown = useMouseDownEvent();
|
|
24
|
-
const calculatedFrameStyle = useMemo(() => frameStyle !== undefined ? frameStyle : isFrameVisible ? 'show' : 'showOnHover', [frameStyle, isFrameVisible]);
|
|
25
23
|
const renderHeader = () => /*#__PURE__*/React.createElement(Header, {
|
|
26
24
|
className: "embed-header",
|
|
27
25
|
frameStyle: frameStyle
|
|
@@ -45,7 +43,7 @@ export const ExpandedFrame = ({
|
|
|
45
43
|
className: className,
|
|
46
44
|
isInteractive: isInteractive(),
|
|
47
45
|
isSelected: isSelected,
|
|
48
|
-
frameStyle:
|
|
46
|
+
frameStyle: frameStyle,
|
|
49
47
|
minWidth: minWidth,
|
|
50
48
|
maxWidth: maxWidth,
|
|
51
49
|
"data-testid": testId,
|
|
@@ -61,7 +59,7 @@ export const ExpandedFrame = ({
|
|
|
61
59
|
isInteractive: isInteractive(),
|
|
62
60
|
isSelected: isSelected,
|
|
63
61
|
minWidth: minWidth,
|
|
64
|
-
frameStyle:
|
|
62
|
+
frameStyle: frameStyle,
|
|
65
63
|
maxWidth: maxWidth,
|
|
66
64
|
"data-testid": testId,
|
|
67
65
|
"data-trello-do-not-use-override": testId,
|
|
@@ -26,7 +26,6 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
26
26
|
analytics,
|
|
27
27
|
handleInvoke,
|
|
28
28
|
isSelected,
|
|
29
|
-
isFrameVisible,
|
|
30
29
|
frameStyle,
|
|
31
30
|
platform,
|
|
32
31
|
onResolve,
|
|
@@ -67,7 +66,6 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
67
66
|
if (resolvedViewProps.preview) {
|
|
68
67
|
return /*#__PURE__*/React.createElement(EmbedCardResolvedView, _extends({}, resolvedViewProps, {
|
|
69
68
|
isSelected: isSelected,
|
|
70
|
-
isFrameVisible: isFrameVisible,
|
|
71
69
|
frameStyle: frameStyle,
|
|
72
70
|
inheritDimensions: inheritDimensions,
|
|
73
71
|
onClick: handleFrameClick,
|
|
@@ -110,6 +108,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
110
108
|
analytics: analytics,
|
|
111
109
|
context: unauthorisedViewProps.context,
|
|
112
110
|
extensionKey: extensionKey,
|
|
111
|
+
frameStyle: frameStyle,
|
|
113
112
|
isProductIntegrationSupported: isProductIntegrationSupported,
|
|
114
113
|
inheritDimensions: inheritDimensions,
|
|
115
114
|
isSelected: isSelected,
|
|
@@ -130,8 +129,8 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
130
129
|
if (forbiddenViewProps.preview) {
|
|
131
130
|
return /*#__PURE__*/React.createElement(EmbedCardResolvedView, _extends({}, forbiddenViewProps, {
|
|
132
131
|
title: forbiddenViewProps.link,
|
|
132
|
+
frameStyle: frameStyle,
|
|
133
133
|
isSelected: isSelected,
|
|
134
|
-
isFrameVisible: isFrameVisible,
|
|
135
134
|
inheritDimensions: inheritDimensions,
|
|
136
135
|
onClick: handleFrameClick,
|
|
137
136
|
ref: iframeRef
|
|
@@ -145,6 +144,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
145
144
|
});
|
|
146
145
|
return /*#__PURE__*/React.createElement(ForbiddenView, {
|
|
147
146
|
context: forbiddenViewProps.context,
|
|
147
|
+
frameStyle: frameStyle,
|
|
148
148
|
inheritDimensions: inheritDimensions,
|
|
149
149
|
isSelected: isSelected,
|
|
150
150
|
onAuthorize: handleAuthorize,
|
|
@@ -168,6 +168,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
168
168
|
}) : undefined;
|
|
169
169
|
return /*#__PURE__*/React.createElement(NotFoundView, {
|
|
170
170
|
context: notFoundViewProps.context,
|
|
171
|
+
frameStyle: frameStyle,
|
|
171
172
|
inheritDimensions: inheritDimensions,
|
|
172
173
|
isSelected: isSelected,
|
|
173
174
|
onClick: handleFrameClick,
|
|
@@ -11,7 +11,6 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
11
11
|
context,
|
|
12
12
|
onClick,
|
|
13
13
|
isSelected,
|
|
14
|
-
isFrameVisible,
|
|
15
14
|
frameStyle,
|
|
16
15
|
preview,
|
|
17
16
|
title,
|
|
@@ -48,7 +47,6 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
48
47
|
}
|
|
49
48
|
return jsx(ExpandedFrame, {
|
|
50
49
|
isSelected: isSelected,
|
|
51
|
-
isFrameVisible: isFrameVisible,
|
|
52
50
|
frameStyle: frameStyle,
|
|
53
51
|
href: link,
|
|
54
52
|
testId: testId,
|
|
@@ -8,6 +8,7 @@ import { containerStyles, contentStyles, descriptionStyles, imageStyles, titleSt
|
|
|
8
8
|
const UnresolvedView = ({
|
|
9
9
|
button,
|
|
10
10
|
description,
|
|
11
|
+
frameStyle,
|
|
11
12
|
icon: iconUrlOrElement,
|
|
12
13
|
image,
|
|
13
14
|
inheritDimensions,
|
|
@@ -32,8 +33,15 @@ const UnresolvedView = ({
|
|
|
32
33
|
});
|
|
33
34
|
}, [iconUrlOrElement]);
|
|
34
35
|
return jsx(ExpandedFrame, {
|
|
35
|
-
allowScrollBar: true
|
|
36
|
-
|
|
36
|
+
allowScrollBar: true
|
|
37
|
+
// EDM-9259: Fix embed frame showing on unresolved views when frameStyle is set to hide.
|
|
38
|
+
// Set fallback to 'show' here to maintain the current behaviour when platform.editor.show-embed-card-frame-renderer is OFF.
|
|
39
|
+
// Remove 'show' on platform.editor.show-embed-card-frame-renderer cleanup as frameStyle will be set to 'show' both in renderer and editor.
|
|
40
|
+
// We want all views to be consistent and respect frameStyle instead of
|
|
41
|
+
// having resolved view default to showOnHover and unresolved view default to show.
|
|
42
|
+
// Default frameStyle is set inside <ExpandedFrame />
|
|
43
|
+
,
|
|
44
|
+
frameStyle: frameStyle !== null && frameStyle !== void 0 ? frameStyle : 'show',
|
|
37
45
|
href: url,
|
|
38
46
|
icon: icon,
|
|
39
47
|
inheritDimensions: inheritDimensions,
|
|
@@ -2,8 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Action from '../index';
|
|
4
4
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
5
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
6
|
-
import { messages } from '../../../../../../messages';
|
|
7
5
|
import { openEmbedModalWithFlexibleUiIcon } from '../../../utils';
|
|
8
6
|
import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
|
|
9
7
|
import { ActionName } from '../../../../../../constants';
|
|
@@ -51,8 +49,7 @@ const PreviewAction = props => {
|
|
|
51
49
|
if (onClick) {
|
|
52
50
|
onClick();
|
|
53
51
|
}
|
|
54
|
-
}
|
|
55
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview_improved)
|
|
52
|
+
}
|
|
56
53
|
};
|
|
57
54
|
return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
|
|
58
55
|
appearance: appearance,
|
|
@@ -8,11 +8,10 @@ import Block from '../../block';
|
|
|
8
8
|
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize } from '../../../../../../constants';
|
|
9
9
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles } from '../../../utils';
|
|
10
10
|
import ElementGroup from '../../element-group';
|
|
11
|
-
import { tokens } from '../../../../../../utils/token';
|
|
12
11
|
const actionStyles = css`
|
|
13
12
|
cursor: pointer;
|
|
14
13
|
:hover {
|
|
15
|
-
color: ${
|
|
14
|
+
color: ${"var(--ds-text-subtle, #8993A4)"};
|
|
16
15
|
text-decoration: underline;
|
|
17
16
|
}
|
|
18
17
|
`;
|
|
@@ -24,9 +23,9 @@ const getMessageStyles = (size, hasAction) => {
|
|
|
24
23
|
${hasAction ? actionStyles : ''}
|
|
25
24
|
${sizeStyles}
|
|
26
25
|
${getTruncateStyles(1, getLinkLineHeight(size))}
|
|
27
|
-
color: ${
|
|
26
|
+
color: ${"var(--ds-text-disabled, #6B778C)"};
|
|
28
27
|
:focus {
|
|
29
|
-
outline: ${
|
|
28
|
+
outline: ${"var(--ds-border-focused, #388BFF)"} solid 2px;
|
|
30
29
|
}
|
|
31
30
|
`;
|
|
32
31
|
};
|
|
@@ -3,7 +3,6 @@ import React, { useContext } from 'react';
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
|
|
5
5
|
import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock } from '../../../../utils/flexible';
|
|
6
|
-
import { tokens } from '../../../../utils/token';
|
|
7
6
|
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
8
7
|
import LayeredLink from './layered-link';
|
|
9
8
|
import HoverCardControl from './hover-card-control';
|
|
@@ -99,7 +98,7 @@ export const getContainerStyles = (size, hideBackground, hideElevation, hidePadd
|
|
|
99
98
|
min-width: 0;
|
|
100
99
|
overflow-x: hidden;
|
|
101
100
|
position: relative;
|
|
102
|
-
${hideBackground ? '' : `background-color: ${
|
|
101
|
+
${hideBackground ? '' : `background-color: ${"var(--ds-surface-raised, #FFFFFF)"};`}
|
|
103
102
|
${paddingCss}
|
|
104
103
|
${hideElevation ? '' : elevationStyles}
|
|
105
104
|
${clickableContainer ? clickableContainerStyles : ''}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { tokens } from '../../../../../utils/token';
|
|
5
4
|
import { getFormattedMessage, getIconSizeStyles } from '../../utils';
|
|
6
5
|
import { IconType } from '../../../../../constants';
|
|
7
6
|
import { messages } from '../../../../../messages';
|
|
@@ -13,7 +12,7 @@ const badgeStyles = css`
|
|
|
13
12
|
min-width: fit-content;
|
|
14
13
|
`;
|
|
15
14
|
const iconStyles = css`
|
|
16
|
-
color: ${
|
|
15
|
+
color: ${"var(--ds-icon-subtle, #626F86)"};
|
|
17
16
|
line-height: 0;
|
|
18
17
|
vertical-align: middle;
|
|
19
18
|
${getIconSizeStyles('1rem')}
|
|
@@ -25,7 +24,7 @@ const iconStyles = css`
|
|
|
25
24
|
}
|
|
26
25
|
`;
|
|
27
26
|
const labelStyles = css`
|
|
28
|
-
color: ${
|
|
27
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
29
28
|
font-size: 0.75rem;
|
|
30
29
|
line-height: 1rem;
|
|
31
30
|
padding-left: 0.125rem;
|
|
@@ -4,11 +4,10 @@ import React from 'react';
|
|
|
4
4
|
import { useIntl, FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { getTruncateStyles } from '../../utils';
|
|
7
|
-
import { tokens } from '../../../../../utils/token';
|
|
8
7
|
import { selectUnit } from '@formatjs/intl-utils';
|
|
9
8
|
import { messages } from '../../../../../messages';
|
|
10
9
|
const styles = css`
|
|
11
|
-
color: ${
|
|
10
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
12
11
|
font-size: 0.75rem;
|
|
13
12
|
line-height: 1rem;
|
|
14
13
|
${getTruncateStyles(1)}
|
|
@@ -5,7 +5,6 @@ import { css, jsx } from '@emotion/react';
|
|
|
5
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
6
|
import { SmartLinkInternalTheme, SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
|
|
7
7
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles, hasWhiteSpace } from '../../utils';
|
|
8
|
-
import { tokens } from '../../../../../utils/token';
|
|
9
8
|
import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
|
|
10
9
|
const DEFAULT_MAX_LINES = 2;
|
|
11
10
|
const MAXIMUM_MAX_LINES = 2;
|
|
@@ -34,24 +33,24 @@ const getThemeStyles = theme => {
|
|
|
34
33
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
35
34
|
case SmartLinkTheme.Black:
|
|
36
35
|
return css`
|
|
37
|
-
color: ${
|
|
36
|
+
color: ${"var(--ds-text-subtle, #44546F)"};
|
|
38
37
|
:active {
|
|
39
|
-
color: ${
|
|
38
|
+
color: ${"var(--ds-text, #172B4D)"};
|
|
40
39
|
}
|
|
41
40
|
:hover {
|
|
42
|
-
color: ${
|
|
41
|
+
color: ${"var(--ds-text-subtle, #44546F)"};
|
|
43
42
|
text-decoration: underline;
|
|
44
43
|
}
|
|
45
44
|
`;
|
|
46
45
|
case SmartLinkTheme.Link:
|
|
47
46
|
default:
|
|
48
47
|
return css`
|
|
49
|
-
color: ${
|
|
48
|
+
color: ${"var(--ds-link, #0C66E4)"};
|
|
50
49
|
:active {
|
|
51
|
-
color: ${
|
|
50
|
+
color: ${"var(--ds-link-pressed, #0055CC)"};
|
|
52
51
|
}
|
|
53
52
|
:hover {
|
|
54
|
-
color: ${
|
|
53
|
+
color: ${"var(--ds-link, #0C66E4)"};
|
|
55
54
|
text-decoration: underline;
|
|
56
55
|
}
|
|
57
56
|
`;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { getFormattedMessage, getTruncateStyles } from '../../utils';
|
|
5
|
-
import { tokens } from '../../../../../utils/token';
|
|
6
5
|
const getStyles = maxLines => css`
|
|
7
|
-
color: ${
|
|
6
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
8
7
|
font-size: 0.75rem;
|
|
9
8
|
line-height: 1rem;
|
|
10
9
|
white-space: normal;
|
|
@@ -204,5 +204,5 @@ export const getSimulatedBetterMetadata = (extensionKey = '', data) => {
|
|
|
204
204
|
};
|
|
205
205
|
export const getIsAISummaryEnabled = (isAdminHubAIEnabled = false, response) => {
|
|
206
206
|
var _response$meta, _response$meta$suppor;
|
|
207
|
-
return Boolean(getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && (response === null || response === void 0 ? void 0 : (_response$meta = response.meta) === null || _response$meta === void 0 ? void 0 : (_response$meta$suppor = _response$meta.
|
|
207
|
+
return Boolean(getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && (response === null || response === void 0 ? void 0 : (_response$meta = response.meta) === null || _response$meta === void 0 ? void 0 : (_response$meta$suppor = _response$meta.supportedFeature) === null || _response$meta$suppor === void 0 ? void 0 : _response$meta$suppor.includes('AISummary')));
|
|
208
208
|
};
|
|
@@ -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.48.
|
|
10
|
+
packageVersion: "26.48.4",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|