@atlaskit/smart-card 26.52.2 → 26.52.3
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/extractors/flexible/actions/index.js +1 -1
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +72 -102
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-icon/index.js +23 -6
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +94 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +36 -20
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +19 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +72 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/container/index.js +26 -5
- package/dist/cjs/view/FlexibleCard/components/utils.js +76 -8
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/index.js +2 -2
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +4 -4
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-icon/index.js +21 -6
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +83 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +34 -17
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +10 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +61 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/container/index.js +23 -24
- package/dist/es2019/view/FlexibleCard/components/utils.js +73 -38
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/index.js +1 -1
- package/dist/esm/messages.js +5 -0
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +72 -102
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-icon/index.js +22 -6
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +84 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +35 -18
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +6 -2
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +12 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +63 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +6 -0
- package/dist/esm/view/FlexibleCard/components/container/index.js +26 -5
- package/dist/esm/view/FlexibleCard/components/utils.js +75 -7
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/messages.d.ts +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 +4 -4
- package/dist/types/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +4 -3
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +10 -0
- package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +3 -6
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +24 -16
- package/dist/types/view/FlexibleCard/components/actions/preview-action/preview-icon/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-block/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-block/types.d.ts +17 -0
- package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/utils.d.ts +11 -0
- package/dist/types-ts4.5/messages.d.ts +1 -1
- 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 +4 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +4 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +10 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/index.d.ts +3 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +24 -16
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/preview-action/preview-icon/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/types.d.ts +17 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +5 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +11 -0
- package/package.json +4 -1
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject;
|
|
3
1
|
/** @jsx jsx */
|
|
4
2
|
import React from 'react';
|
|
5
3
|
import { css, jsx } from '@emotion/react';
|
|
@@ -16,16 +14,34 @@ var getIconWidth = function getIconWidth(size) {
|
|
|
16
14
|
return '1rem';
|
|
17
15
|
}
|
|
18
16
|
};
|
|
19
|
-
var getIconStyles = function getIconStyles(
|
|
20
|
-
return css(
|
|
17
|
+
var getIconStyles = function getIconStyles(isDisabled) {
|
|
18
|
+
return css({
|
|
19
|
+
color: isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)"
|
|
20
|
+
});
|
|
21
21
|
};
|
|
22
|
+
var backgroundStyles = css({
|
|
23
|
+
backgroundColor: "var(--ds-background-brand-subtlest, #E9F2FF)",
|
|
24
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
25
|
+
color: "var(--ds-icon-brand, #0C66E4)",
|
|
26
|
+
display: 'inline-block',
|
|
27
|
+
lineHeight: 0,
|
|
28
|
+
padding: "var(--ds-space-025, 2px)",
|
|
29
|
+
'span,svg,img': {
|
|
30
|
+
lineHeight: 0
|
|
31
|
+
},
|
|
32
|
+
// Use !important to win over `style` prop specificity in DS Spinner. :(
|
|
33
|
+
circle: {
|
|
34
|
+
stroke: "var(--ds-icon-brand, #0C66E4)".concat(" !important")
|
|
35
|
+
}
|
|
36
|
+
});
|
|
22
37
|
var ActionIcon = function ActionIcon(_ref) {
|
|
23
38
|
var size = _ref.size,
|
|
24
39
|
testId = _ref.testId,
|
|
25
40
|
icon = _ref.icon,
|
|
26
|
-
isDisabled = _ref.isDisabled
|
|
41
|
+
isDisabled = _ref.isDisabled,
|
|
42
|
+
showBackground = _ref.showBackground;
|
|
27
43
|
return jsx("span", {
|
|
28
|
-
css: getIconStyles(
|
|
44
|
+
css: [getIconStyles(isDisabled), getIconSizeStyles(getIconWidth(size)), showBackground && backgroundStyles],
|
|
29
45
|
"data-testid": "".concat(testId, "-icon")
|
|
30
46
|
}, icon);
|
|
31
47
|
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { Box, Inline, xcss } from '@atlaskit/primitives';
|
|
3
|
+
import Spinner from '@atlaskit/spinner';
|
|
4
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
import { getPrimitivesInlineSpaceBySize } from '../../../utils';
|
|
7
|
+
import ActionIcon from '../action-icon';
|
|
8
|
+
var buttonStyles = xcss({
|
|
9
|
+
all: 'unset',
|
|
10
|
+
padding: 'space.050',
|
|
11
|
+
width: '100%',
|
|
12
|
+
':focus:not(:focus-visible)': {
|
|
13
|
+
outline: 'none'
|
|
14
|
+
},
|
|
15
|
+
':focus': {
|
|
16
|
+
outlineColor: 'color.border.focused',
|
|
17
|
+
// xcss outlineOffset does not support space.negative.025
|
|
18
|
+
// @ts-ignore-next-line TS2322: Type "var(--ds-space-negative-025)" is not assignable to type
|
|
19
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)",
|
|
20
|
+
outlineStyle: 'solid',
|
|
21
|
+
outlineWidth: 'border.width.outline'
|
|
22
|
+
},
|
|
23
|
+
':hover': {
|
|
24
|
+
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
25
|
+
},
|
|
26
|
+
':active': {
|
|
27
|
+
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var contentStyles = xcss({
|
|
31
|
+
color: 'color.text',
|
|
32
|
+
// Replace with font token once it becomes stable (currently alpha)
|
|
33
|
+
// font: 'font.body.small',
|
|
34
|
+
fontSize: '12px',
|
|
35
|
+
fontStyle: 'normal',
|
|
36
|
+
fontWeight: '400',
|
|
37
|
+
lineHeight: '20px'
|
|
38
|
+
});
|
|
39
|
+
var ActionStackItem = function ActionStackItem(_ref) {
|
|
40
|
+
var content = _ref.content,
|
|
41
|
+
iconOption = _ref.icon,
|
|
42
|
+
isDisabled = _ref.isDisabled,
|
|
43
|
+
isLoading = _ref.isLoading,
|
|
44
|
+
onClickCallback = _ref.onClick,
|
|
45
|
+
size = _ref.size,
|
|
46
|
+
spaceOption = _ref.space,
|
|
47
|
+
testId = _ref.testId,
|
|
48
|
+
tooltipMessage = _ref.tooltipMessage,
|
|
49
|
+
xcss = _ref.xcss;
|
|
50
|
+
var space = spaceOption !== null && spaceOption !== void 0 ? spaceOption : getPrimitivesInlineSpaceBySize(size);
|
|
51
|
+
var onClick = useCallback(function () {
|
|
52
|
+
if (!isDisabled && !isLoading && onClickCallback) {
|
|
53
|
+
onClickCallback();
|
|
54
|
+
}
|
|
55
|
+
}, [isDisabled, isLoading, onClickCallback]);
|
|
56
|
+
var icon = iconOption && isLoading ? /*#__PURE__*/React.createElement(ActionIcon, {
|
|
57
|
+
icon: /*#__PURE__*/React.createElement(Spinner, {
|
|
58
|
+
testId: "".concat(testId, "-loading")
|
|
59
|
+
}),
|
|
60
|
+
showBackground: true,
|
|
61
|
+
size: size
|
|
62
|
+
}) : iconOption;
|
|
63
|
+
|
|
64
|
+
// Replace Box with Pressable once it becomes stable (currently beta)
|
|
65
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
66
|
+
content: tooltipMessage || content,
|
|
67
|
+
hideTooltipOnMouseDown: true
|
|
68
|
+
}, function (tooltipProps) {
|
|
69
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
70
|
+
as: "button",
|
|
71
|
+
xcss: [buttonStyles, xcss]
|
|
72
|
+
}, tooltipProps, {
|
|
73
|
+
onClick: onClick
|
|
74
|
+
}), /*#__PURE__*/React.createElement(Inline, {
|
|
75
|
+
alignBlock: "center",
|
|
76
|
+
grow: "fill",
|
|
77
|
+
space: space,
|
|
78
|
+
testId: testId
|
|
79
|
+
}, icon, /*#__PURE__*/React.createElement(Box, {
|
|
80
|
+
xcss: contentStyles
|
|
81
|
+
}, content)));
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
export default ActionStackItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { SmartLinkSize } from '../../../../../constants';
|
|
5
|
+
import ActionStackItem from './action-stack-item';
|
|
5
6
|
import ActionButton from './action-button';
|
|
6
7
|
import ActionDropdownItem from './action-dropdown-item';
|
|
7
8
|
import ActionIcon from './action-icon';
|
|
@@ -10,12 +11,10 @@ import ActionIcon from './action-icon';
|
|
|
10
11
|
* A base action that can be triggered with an on click.
|
|
11
12
|
* @internal
|
|
12
13
|
* @param {ActionProps} ActionProps - The props necessary for the Action.
|
|
13
|
-
* @see DeleteAction
|
|
14
|
-
* @see EditAction
|
|
15
|
-
* @see CustomAction
|
|
16
14
|
*/
|
|
17
15
|
var Action = function Action(_ref) {
|
|
18
|
-
var
|
|
16
|
+
var as = _ref.as,
|
|
17
|
+
_ref$appearance = _ref.appearance,
|
|
19
18
|
appearance = _ref$appearance === void 0 ? 'subtle' : _ref$appearance,
|
|
20
19
|
content = _ref.content,
|
|
21
20
|
_ref$isLoading = _ref.isLoading,
|
|
@@ -28,44 +27,62 @@ var Action = function Action(_ref) {
|
|
|
28
27
|
icon = _ref.icon,
|
|
29
28
|
_ref$iconPosition = _ref.iconPosition,
|
|
30
29
|
iconPosition = _ref$iconPosition === void 0 ? 'before' : _ref$iconPosition,
|
|
30
|
+
spaceInline = _ref.spaceInline,
|
|
31
31
|
tooltipMessage = _ref.tooltipMessage,
|
|
32
|
+
xcss = _ref.xcss,
|
|
32
33
|
asDropDownItem = _ref.asDropDownItem,
|
|
33
34
|
overrideCss = _ref.overrideCss,
|
|
34
35
|
isDisabled = _ref.isDisabled;
|
|
35
36
|
if (!onClick) {
|
|
36
37
|
return null;
|
|
37
38
|
}
|
|
39
|
+
var isStackItem = as === 'stack-item';
|
|
40
|
+
var isDropdownItem = as === 'dropdown-item' || asDropDownItem;
|
|
38
41
|
var actionIcon = icon && jsx(ActionIcon, {
|
|
39
42
|
isDisabled: isDisabled,
|
|
40
43
|
icon: icon,
|
|
41
44
|
size: size,
|
|
45
|
+
showBackground: isStackItem,
|
|
42
46
|
testId: testId
|
|
43
47
|
});
|
|
44
48
|
var iconBefore = icon && iconPosition === 'before' ? actionIcon : undefined;
|
|
45
49
|
var iconAfter = icon && iconPosition === 'after' ? actionIcon : undefined;
|
|
46
|
-
if (
|
|
47
|
-
return jsx(
|
|
50
|
+
if (isStackItem) {
|
|
51
|
+
return jsx(ActionStackItem, {
|
|
48
52
|
content: content,
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
icon: actionIcon,
|
|
54
|
+
space: spaceInline,
|
|
55
|
+
isDisabled: isDisabled,
|
|
51
56
|
isLoading: isLoading,
|
|
52
57
|
onClick: onClick,
|
|
53
|
-
|
|
58
|
+
size: size,
|
|
59
|
+
testId: testId,
|
|
60
|
+
tooltipMessage: tooltipMessage || content,
|
|
61
|
+
xcss: xcss
|
|
54
62
|
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
}
|
|
64
|
+
if (isDropdownItem) {
|
|
65
|
+
return jsx(ActionDropdownItem, {
|
|
58
66
|
content: content,
|
|
59
67
|
iconAfter: iconAfter,
|
|
60
68
|
iconBefore: iconBefore,
|
|
61
69
|
isLoading: isLoading,
|
|
62
70
|
onClick: onClick,
|
|
63
|
-
|
|
64
|
-
size: size,
|
|
65
|
-
testId: testId,
|
|
66
|
-
tooltipMessage: tooltipMessage || content,
|
|
67
|
-
isDisabled: isDisabled
|
|
71
|
+
testId: testId
|
|
68
72
|
});
|
|
69
73
|
}
|
|
74
|
+
return jsx(ActionButton, {
|
|
75
|
+
appearance: appearance,
|
|
76
|
+
content: content,
|
|
77
|
+
iconAfter: iconAfter,
|
|
78
|
+
iconBefore: iconBefore,
|
|
79
|
+
isLoading: isLoading,
|
|
80
|
+
onClick: onClick,
|
|
81
|
+
overrideCss: overrideCss,
|
|
82
|
+
size: size,
|
|
83
|
+
testId: testId,
|
|
84
|
+
tooltipMessage: tooltipMessage || content,
|
|
85
|
+
isDisabled: isDisabled
|
|
86
|
+
});
|
|
70
87
|
};
|
|
71
88
|
export default Action;
|
|
@@ -15,6 +15,7 @@ import { useFlexibleUiAnalyticsContext, useFlexibleUiContext } from '../../../..
|
|
|
15
15
|
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
16
16
|
import { openEmbedModalWithFlexibleUiIcon } from '../../utils';
|
|
17
17
|
import Action from '../action';
|
|
18
|
+
import PreviewIcon from './preview-icon';
|
|
18
19
|
var PreviewAction = function PreviewAction(_ref) {
|
|
19
20
|
var _context$actions;
|
|
20
21
|
var onClickCallback = _ref.onClick,
|
|
@@ -60,14 +61,17 @@ var PreviewAction = function PreviewAction(_ref) {
|
|
|
60
61
|
onClickCallback();
|
|
61
62
|
}
|
|
62
63
|
}, [analytics, data, invoke, onClickCallback]);
|
|
64
|
+
var isStackItem = props.as === 'stack-item';
|
|
65
|
+
var Icon = isStackItem ? PreviewIcon : VidFullScreenOnIcon;
|
|
66
|
+
var tooltipMessage = isStackItem ? messages.preview_description : messages.preview_improved;
|
|
63
67
|
return data ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
64
68
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview_improved),
|
|
65
|
-
icon: /*#__PURE__*/React.createElement(
|
|
69
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
66
70
|
label: "Open preview"
|
|
67
71
|
}),
|
|
68
72
|
onClick: onClick,
|
|
69
73
|
testId: "smart-action-preview-action",
|
|
70
|
-
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage,
|
|
74
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage)
|
|
71
75
|
}, data, props)) : null;
|
|
72
76
|
};
|
|
73
77
|
export default PreviewAction;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import EditorExpandIcon from '@atlaskit/icon/glyph/editor/expand';
|
|
2
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
var iconStyles = xcss({
|
|
5
|
+
transform: 'rotate(-45deg)'
|
|
6
|
+
});
|
|
7
|
+
var PreviewIcon = function PreviewIcon(props) {
|
|
8
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
9
|
+
xcss: iconStyles
|
|
10
|
+
}, /*#__PURE__*/React.createElement(EditorExpandIcon, props));
|
|
11
|
+
};
|
|
12
|
+
export default PreviewIcon;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Stack, xcss } from '@atlaskit/primitives';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { SmartLinkSize } from '../../../../../constants';
|
|
4
|
+
import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
5
|
+
import * as Actions from '../../actions';
|
|
6
|
+
import { getPrimitivesPaddingSpaceBySize } from '../../utils';
|
|
7
|
+
// We have to find a better way to ignore container padding
|
|
8
|
+
// This has become more and more of a common use case.
|
|
9
|
+
var ignoreContainerPaddingStyles = xcss({
|
|
10
|
+
marginLeft: 'calc(var(--container-gap-left) * -1)',
|
|
11
|
+
marginRight: 'calc(var(--container-gap-right) * -1)'
|
|
12
|
+
});
|
|
13
|
+
var ActionBlock = function ActionBlock(_ref) {
|
|
14
|
+
var blockRef = _ref.blockRef,
|
|
15
|
+
onClickCallback = _ref.onClick,
|
|
16
|
+
size = _ref.size,
|
|
17
|
+
sort = _ref.sort,
|
|
18
|
+
spaceInline = _ref.spaceInline,
|
|
19
|
+
_ref$testId = _ref.testId,
|
|
20
|
+
testId = _ref$testId === void 0 ? 'smart-block-action' : _ref$testId;
|
|
21
|
+
var context = useFlexibleUiContext();
|
|
22
|
+
var ui = useFlexibleUiOptionContext();
|
|
23
|
+
var padding = !(ui !== null && ui !== void 0 && ui.hidePadding) ? getPrimitivesPaddingSpaceBySize((ui === null || ui === void 0 ? void 0 : ui.size) || SmartLinkSize.Medium) : undefined;
|
|
24
|
+
var actions = useMemo(function () {
|
|
25
|
+
if (!(context !== null && context !== void 0 && context.actions)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var arr = Object.keys(context.actions);
|
|
29
|
+
if (sort) {
|
|
30
|
+
arr.sort(sort);
|
|
31
|
+
}
|
|
32
|
+
return arr.map(function (name) {
|
|
33
|
+
var Action = Actions[name];
|
|
34
|
+
return Action ? /*#__PURE__*/React.createElement(Action, {
|
|
35
|
+
as: "stack-item",
|
|
36
|
+
spaceInline: spaceInline,
|
|
37
|
+
key: name,
|
|
38
|
+
onClick: function onClick() {
|
|
39
|
+
return onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(name);
|
|
40
|
+
},
|
|
41
|
+
size: size
|
|
42
|
+
// Remove url once ViewAction is retired.
|
|
43
|
+
// This seems to be a typescript workaround
|
|
44
|
+
// because ViewAction marks it as required,
|
|
45
|
+
// which does not reflect actual implementation as the url
|
|
46
|
+
// came from data context and not all actions require url.
|
|
47
|
+
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
48
|
+
,
|
|
49
|
+
url: "",
|
|
50
|
+
xcss: xcss({
|
|
51
|
+
paddingInline: padding
|
|
52
|
+
})
|
|
53
|
+
}) : null;
|
|
54
|
+
});
|
|
55
|
+
}, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, sort, spaceInline]);
|
|
56
|
+
return actions ? /*#__PURE__*/React.createElement(Stack, {
|
|
57
|
+
grow: "fill",
|
|
58
|
+
xcss: ignoreContainerPaddingStyles,
|
|
59
|
+
ref: blockRef,
|
|
60
|
+
testId: testId
|
|
61
|
+
}, actions) : null;
|
|
62
|
+
};
|
|
63
|
+
export default ActionBlock;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,4 +8,5 @@ export { default as CustomBlock } from './block';
|
|
|
8
8
|
// Internal components to be used within @atlaskit/smart-card only.
|
|
9
9
|
export { default as InternalFooterBlock } from './footer-block/resolved';
|
|
10
10
|
export { default as RelatedUrlsBlock } from './related-urls-block';
|
|
11
|
-
export { default as AISummaryBlock } from './ai-summary-block';
|
|
11
|
+
export { default as AISummaryBlock } from './ai-summary-block';
|
|
12
|
+
export { default as ActionBlock } from './action-block';
|
|
@@ -31,6 +31,12 @@ var getDirectionStyles = function getDirectionStyles(direction) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get gap size between elements inside a block
|
|
37
|
+
* Equivalent version for DS primitives space token is getPrimitivesInlineSpaceBySize()
|
|
38
|
+
* at view/FlexibleCard/components/utils.tsx
|
|
39
|
+
*/
|
|
34
40
|
export var getGapSize = function getGapSize(size) {
|
|
35
41
|
switch (size) {
|
|
36
42
|
case SmartLinkSize.XLarge:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject
|
|
2
|
+
var _templateObject;
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
@@ -11,7 +11,11 @@ import HoverCardControl from './hover-card-control';
|
|
|
11
11
|
import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
|
|
12
12
|
import { N40 } from '@atlaskit/theme/colors';
|
|
13
13
|
import { di } from 'react-magnetic-di';
|
|
14
|
-
var elevationStyles = css(
|
|
14
|
+
var elevationStyles = css({
|
|
15
|
+
border: "1px solid ".concat("var(--ds-border, ".concat(N40, ")")),
|
|
16
|
+
borderRadius: "var(--ds-border-radius-200, 8px)",
|
|
17
|
+
margin: "var(--ds-space-025, 2px)"
|
|
18
|
+
});
|
|
15
19
|
var getGap = function getGap(size) {
|
|
16
20
|
switch (size) {
|
|
17
21
|
case SmartLinkSize.XLarge:
|
|
@@ -25,6 +29,12 @@ var getGap = function getGap(size) {
|
|
|
25
29
|
return '.25rem';
|
|
26
30
|
}
|
|
27
31
|
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get container padding based on smart link size
|
|
35
|
+
* Equivalent version for DS primitives space token is getPrimitivesPaddingSpaceBySize()
|
|
36
|
+
* at view/FlexibleCard/components/utils.tsx
|
|
37
|
+
*/
|
|
28
38
|
var getPadding = function getPadding(size) {
|
|
29
39
|
switch (size) {
|
|
30
40
|
case SmartLinkSize.XLarge:
|
|
@@ -38,13 +48,24 @@ var getPadding = function getPadding(size) {
|
|
|
38
48
|
return '.5rem';
|
|
39
49
|
}
|
|
40
50
|
};
|
|
41
|
-
var clickableContainerStyles = css(
|
|
51
|
+
var clickableContainerStyles = css({
|
|
52
|
+
'a, button, .has-action': {
|
|
53
|
+
position: 'relative',
|
|
54
|
+
zIndex: 1
|
|
55
|
+
}
|
|
56
|
+
});
|
|
42
57
|
var getContainerPaddingStyles = function getContainerPaddingStyles(size, hidePadding, childrenOptions) {
|
|
43
58
|
var padding = hidePadding ? '0rem' : getPadding(size);
|
|
44
59
|
var gap = getGap(size);
|
|
45
60
|
var previewOnLeft = childrenOptions.previewOnLeft,
|
|
46
61
|
previewOnRight = childrenOptions.previewOnRight;
|
|
47
|
-
return css(
|
|
62
|
+
return css({
|
|
63
|
+
'--container-padding': padding,
|
|
64
|
+
'--container-gap-left': previewOnLeft ? gap : padding,
|
|
65
|
+
'--container-gap-right': previewOnRight ? gap : padding,
|
|
66
|
+
'--preview-block-width': '30%',
|
|
67
|
+
padding: padding
|
|
68
|
+
}, previewOnLeft ? "padding-left: calc(var(--preview-block-width) + ".concat(gap, ");") : '', previewOnRight ? "padding-right: calc(var(--preview-block-width) + ".concat(gap, ");") : '');
|
|
48
69
|
};
|
|
49
70
|
var getChildrenOptions = function getChildrenOptions(children, context) {
|
|
50
71
|
var options = {};
|
|
@@ -67,7 +88,7 @@ var getChildrenOptions = function getChildrenOptions(children, context) {
|
|
|
67
88
|
};
|
|
68
89
|
export var getContainerStyles = function getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions) {
|
|
69
90
|
var paddingCss = getContainerPaddingStyles(size, hidePadding, childrenOptions);
|
|
70
|
-
return css(
|
|
91
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: ", " 0;\n flex-direction: column;\n min-width: 0;\n overflow-x: hidden;\n position: relative;\n ", "\n ", "\n ", "\n ", "\n &:hover ~ .actions-button-group {\n opacity: 1;\n }\n a:focus,\n .has-action:focus {\n outline-offset: -2px;\n }\n "])), getGap(size), hideBackground ? '' : "background-color: ".concat("var(--ds-surface-raised, #FFFFFF)", ";"), paddingCss, hideElevation ? '' : elevationStyles, clickableContainer ? clickableContainerStyles : '');
|
|
71
92
|
};
|
|
72
93
|
var renderChildren = function renderChildren(children, containerSize, containerTheme, status, retry, onClick) {
|
|
73
94
|
return React.Children.map(children, function (child) {
|
|
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
var _excluded = ["linkIcon"];
|
|
6
|
-
var _sizeToButtonSpacing, _templateObject
|
|
6
|
+
var _sizeToButtonSpacing, _templateObject;
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
9
9
|
import React from 'react';
|
|
@@ -29,11 +29,18 @@ export var getFormattedMessageAsString = function getFormattedMessageAsString(in
|
|
|
29
29
|
}) : '';
|
|
30
30
|
};
|
|
31
31
|
var getIconDimensionStyles = function getIconDimensionStyles(value) {
|
|
32
|
-
return css(
|
|
32
|
+
return css({
|
|
33
|
+
height: value,
|
|
34
|
+
minHeight: value,
|
|
35
|
+
maxHeight: value,
|
|
36
|
+
width: value,
|
|
37
|
+
minWidth: value,
|
|
38
|
+
maxWidth: value
|
|
39
|
+
});
|
|
33
40
|
};
|
|
34
41
|
export var getIconSizeStyles = function getIconSizeStyles(width) {
|
|
35
42
|
var sizeStyles = getIconDimensionStyles(width);
|
|
36
|
-
return css(
|
|
43
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n ", "\n span,\n svg,\n img {\n ", "\n }\n svg {\n padding: 0;\n }\n "])), sizeStyles, sizeStyles);
|
|
37
44
|
};
|
|
38
45
|
export var getIconWidth = function getIconWidth(size) {
|
|
39
46
|
switch (size) {
|
|
@@ -62,13 +69,28 @@ export var getLinkLineHeight = function getLinkLineHeight(size) {
|
|
|
62
69
|
export var getLinkSizeStyles = function getLinkSizeStyles(size) {
|
|
63
70
|
switch (size) {
|
|
64
71
|
case SmartLinkSize.XLarge:
|
|
65
|
-
return css(
|
|
72
|
+
return css({
|
|
73
|
+
fontSize: '1.25rem',
|
|
74
|
+
fontWeight: 400,
|
|
75
|
+
letterSpacing: '-0.008em',
|
|
76
|
+
lineHeight: getLinkLineHeight(size)
|
|
77
|
+
});
|
|
66
78
|
case SmartLinkSize.Large:
|
|
67
79
|
case SmartLinkSize.Medium:
|
|
68
|
-
return css(
|
|
80
|
+
return css({
|
|
81
|
+
fontSize: '0.875rem',
|
|
82
|
+
fontWeight: 400,
|
|
83
|
+
letterSpacing: '-0.003em',
|
|
84
|
+
lineHeight: getLinkLineHeight(size)
|
|
85
|
+
});
|
|
69
86
|
case SmartLinkSize.Small:
|
|
70
87
|
default:
|
|
71
|
-
return css(
|
|
88
|
+
return css({
|
|
89
|
+
fontSize: '0.75rem',
|
|
90
|
+
fontWeight: 400,
|
|
91
|
+
letterSpacing: '0em',
|
|
92
|
+
lineHeight: getLinkLineHeight(size)
|
|
93
|
+
});
|
|
72
94
|
}
|
|
73
95
|
};
|
|
74
96
|
export var getMaxLineHeight = function getMaxLineHeight(size) {
|
|
@@ -93,10 +115,56 @@ export var getMaxLines = function getMaxLines(value, defaultValue, max, min) {
|
|
|
93
115
|
}
|
|
94
116
|
return value;
|
|
95
117
|
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* A space between element based on smart link size
|
|
121
|
+
* To replace blocks/utils.tsz getGapSize() with space token for primitives
|
|
122
|
+
*/
|
|
123
|
+
export var getPrimitivesInlineSpaceBySize = function getPrimitivesInlineSpaceBySize(size) {
|
|
124
|
+
switch (size) {
|
|
125
|
+
case SmartLinkSize.XLarge:
|
|
126
|
+
return 'space.250';
|
|
127
|
+
case SmartLinkSize.Large:
|
|
128
|
+
return 'space.200';
|
|
129
|
+
case SmartLinkSize.Medium:
|
|
130
|
+
return 'space.100';
|
|
131
|
+
case SmartLinkSize.Small:
|
|
132
|
+
default:
|
|
133
|
+
return 'space.050';
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get container padding based on smart link size
|
|
139
|
+
* To replace container/index.tsx getPadding() with space token for primitives
|
|
140
|
+
*/
|
|
141
|
+
export var getPrimitivesPaddingSpaceBySize = function getPrimitivesPaddingSpaceBySize(size) {
|
|
142
|
+
switch (size) {
|
|
143
|
+
case SmartLinkSize.XLarge:
|
|
144
|
+
return 'space.300';
|
|
145
|
+
case SmartLinkSize.Large:
|
|
146
|
+
return 'space.250';
|
|
147
|
+
case SmartLinkSize.Medium:
|
|
148
|
+
return 'space.200';
|
|
149
|
+
case SmartLinkSize.Small:
|
|
150
|
+
default:
|
|
151
|
+
return 'space.100';
|
|
152
|
+
}
|
|
153
|
+
};
|
|
96
154
|
export var getTruncateStyles = function getTruncateStyles(maxLines) {
|
|
97
155
|
var lineHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1rem';
|
|
98
156
|
var wordBreak = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'break-word';
|
|
99
|
-
return css(
|
|
157
|
+
return css({
|
|
158
|
+
display: '-webkit-box',
|
|
159
|
+
overflow: 'hidden',
|
|
160
|
+
textOverflow: 'ellipsis',
|
|
161
|
+
wordBreak: wordBreak,
|
|
162
|
+
WebkitLineClamp: maxLines,
|
|
163
|
+
WebkitBoxOrient: 'vertical',
|
|
164
|
+
'@supports not (-webkit-line-clamp: 1)': {
|
|
165
|
+
maxHeight: "calc(".concat(maxLines, " * ").concat(lineHeight, ")")
|
|
166
|
+
}
|
|
167
|
+
});
|
|
100
168
|
};
|
|
101
169
|
export var hasWhiteSpace = function hasWhiteSpace(str) {
|
|
102
170
|
return str.search(/\s/) >= 0;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { ActionName, CardDisplay, ElementName, SmartLinkPosition, SmartLinkSize, SmartLinkDirection } from '../../../../../constants';
|
|
5
|
-
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock } from '../../../../FlexibleCard/components/blocks';
|
|
5
|
+
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock, ActionBlock } from '../../../../FlexibleCard/components/blocks';
|
|
6
6
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
7
7
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
8
8
|
import { getSimulatedBetterMetadata } from '../../../utils';
|
|
@@ -183,6 +183,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
183
183
|
actions: footerActions,
|
|
184
184
|
size: SmartLinkSize.Large,
|
|
185
185
|
overrideCss: footerBlockCss
|
|
186
|
+
}), getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && /*#__PURE__*/React.createElement(ActionBlock, {
|
|
187
|
+
spaceInline: "space.150"
|
|
186
188
|
}));
|
|
187
189
|
};
|
|
188
190
|
export default HoverCardResolvedView;
|
|
@@ -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.52.
|
|
13
|
+
packageVersion: "26.52.3",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MessageDescriptor } from 'react-intl-next';
|
|
2
2
|
export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_title' | 'request_access_pending_description' | 'request_denied_description' | 'default_no_access_title' | 'direct_access_title' | 'direct_access_description' | 'direct_access' | 'access_exists_description' | 'not_found_description' | 'not_found_title';
|
|
3
|
-
export type MessageKey = 'assigned_to' | 'ai_summarize' | 'ai_summarized' | 'ai_summarized_abbreviation' | 'ai_summarized_info' | 'ai_summarizing' | 'ai_summary_error_generic' | 'ai_summary_error_acceptable_use_violation' | 'beta' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'follow' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'learn_more_about_connecting_account' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related_work_items_not_found' | 'last_mentioned_in' | 'related' | 'generic_error_message';
|
|
3
|
+
export type MessageKey = 'assigned_to' | 'ai_summarize' | 'ai_summarized' | 'ai_summarized_abbreviation' | 'ai_summarized_info' | 'ai_summarizing' | 'ai_summary_error_generic' | 'ai_summary_error_acceptable_use_violation' | 'beta' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'follow' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'learn_more_about_connecting_account' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_description' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related_work_items_not_found' | 'last_mentioned_in' | 'related' | 'generic_error_message';
|
|
4
4
|
type Messages = {
|
|
5
5
|
[K in MessageKey]: MessageDescriptor;
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AISummaryServiceProps, type AISummaryServiceInt, type AISummaryState, type StateSetter
|
|
1
|
+
import { type AISummaryServiceProps, type AISummaryServiceInt, type AISummaryState, type StateSetter } from './types';
|
|
2
2
|
export declare class AISummaryService implements AISummaryServiceInt {
|
|
3
3
|
state: AISummaryState;
|
|
4
4
|
private config;
|
|
@@ -10,7 +10,7 @@ export declare class AISummaryService implements AISummaryServiceInt {
|
|
|
10
10
|
private onError?;
|
|
11
11
|
constructor(props: AISummaryServiceProps);
|
|
12
12
|
private fetchStream;
|
|
13
|
-
summariseUrl(
|
|
13
|
+
summariseUrl(): Promise<void>;
|
|
14
14
|
private isExpectedError;
|
|
15
15
|
subscribe(stateSetter: StateSetter): () => void;
|
|
16
16
|
}
|
|
@@ -28,10 +28,10 @@ export type PostAgentPayload = {
|
|
|
28
28
|
export type AgentInputContext = {
|
|
29
29
|
content_url: string;
|
|
30
30
|
content_ari?: string;
|
|
31
|
-
|
|
31
|
+
prompt_id: PromptId;
|
|
32
32
|
summary_output_mimetype?: SummaryOutputMimeType;
|
|
33
33
|
};
|
|
34
|
-
export type
|
|
34
|
+
export type PromptId = 'smart_links';
|
|
35
35
|
export type SummaryOutputMimeType = 'text/adf' | 'text/markdown' | 'text/json';
|
|
36
36
|
export declare const errorMessages: readonly ["NETWORK_ERROR", "NO_ANSWER", "RATE_LIMIT", "NO_AGENT", "PLUGIN_ERRORED", "OPENAI_RATE_LIMIT_USER_ABUSE", "ACCEPTABLE_USE_VIOLATIONS", "AI_DISABLED", "UNEXPECTED"];
|
|
37
37
|
export type ErrorMessage = (typeof errorMessages)[number];
|
|
@@ -124,7 +124,7 @@ export type Message = {
|
|
|
124
124
|
content: string;
|
|
125
125
|
content_mime_type: ContentType;
|
|
126
126
|
conversation_channel_id?: string;
|
|
127
|
-
experience_id:
|
|
127
|
+
experience_id: ExperienceId;
|
|
128
128
|
message_metadata?: Metadata;
|
|
129
129
|
plugin_invocations: PluginInvocationMessage[];
|
|
130
130
|
role: Role;
|
|
@@ -134,7 +134,7 @@ export type Message = {
|
|
|
134
134
|
sources?: Sources;
|
|
135
135
|
};
|
|
136
136
|
export type ContentType = 'text/markdown';
|
|
137
|
-
export type
|
|
137
|
+
export type ExperienceId = 'ai-mate' | 'smart-link';
|
|
138
138
|
export type Role = 'ASSISTANT';
|
|
139
139
|
export type Appendices = Array<Appendix>;
|
|
140
140
|
export type Appendix = {
|