@atlaskit/smart-card 26.70.0 → 26.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +2 -2
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/utils.js +31 -1
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +87 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +14 -78
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +11 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +3 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -3
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/utils.js +30 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +79 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +15 -80
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +5 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +8 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +3 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -3
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/utils.js +30 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +78 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +14 -75
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +5 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +11 -2
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +4 -2
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +3 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/utils.d.ts +7 -0
- package/dist/types/view/BlockCard/index.d.ts +2 -2
- package/dist/types/view/BlockCard/views/flexible/unresolved-view/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/action-button.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +3 -3
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +2 -5
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +10 -5
- package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +7 -2
- package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/link/types.d.ts +3 -3
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/utils.d.ts +7 -0
- package/dist/types-ts4.5/view/BlockCard/index.d.ts +2 -2
- package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/action-button.d.ts +12 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +3 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +2 -5
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +5 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/types.d.ts +10 -5
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/icon/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/icon/types.d.ts +7 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/link/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/link/types.d.ts +3 -3
- package/package.json +2 -2
|
@@ -1,87 +1,22 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import { Box, Inline, xcss } from '@atlaskit/primitives';
|
|
3
|
-
import Spinner from '@atlaskit/spinner';
|
|
4
2
|
import Tooltip from '@atlaskit/tooltip';
|
|
5
|
-
import React
|
|
6
|
-
import
|
|
7
|
-
import ActionIcon from '../action-icon';
|
|
8
|
-
const buttonStyles = xcss({
|
|
9
|
-
all: 'unset',
|
|
10
|
-
cursor: 'pointer',
|
|
11
|
-
padding: 'space.050',
|
|
12
|
-
width: '100%',
|
|
13
|
-
':focus:not(:focus-visible)': {
|
|
14
|
-
outline: 'none'
|
|
15
|
-
},
|
|
16
|
-
':focus': {
|
|
17
|
-
outlineColor: 'color.border.focused',
|
|
18
|
-
// xcss outlineOffset does not support space.negative.025
|
|
19
|
-
// @ts-ignore-next-line TS2322: Type "var(--ds-space-negative-025)" is not assignable to type
|
|
20
|
-
outlineOffset: "var(--ds-space-negative-025, -2px)",
|
|
21
|
-
outlineStyle: 'solid',
|
|
22
|
-
outlineWidth: 'border.width.outline'
|
|
23
|
-
},
|
|
24
|
-
':hover': {
|
|
25
|
-
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
26
|
-
},
|
|
27
|
-
':active': {
|
|
28
|
-
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const contentStyles = xcss({
|
|
32
|
-
color: 'color.text',
|
|
33
|
-
// Replace with font token once it becomes stable (currently alpha)
|
|
34
|
-
// font: 'font.body.small',
|
|
35
|
-
fontSize: '12px',
|
|
36
|
-
fontStyle: 'normal',
|
|
37
|
-
fontWeight: '400',
|
|
38
|
-
lineHeight: '20px'
|
|
39
|
-
});
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import ActionButton from './action-button';
|
|
40
5
|
const ActionStackItem = ({
|
|
41
6
|
content,
|
|
42
|
-
icon: iconOption,
|
|
43
|
-
isDisabled,
|
|
44
|
-
isLoading,
|
|
45
|
-
onClick: onClickCallback,
|
|
46
|
-
size,
|
|
47
|
-
space: spaceOption,
|
|
48
|
-
testId,
|
|
49
7
|
tooltipMessage,
|
|
50
|
-
xcss,
|
|
51
8
|
tooltipOnHide,
|
|
52
|
-
hideTooltipOnMouseDown
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
size: size
|
|
66
|
-
}) : iconOption;
|
|
67
|
-
|
|
68
|
-
// Replace Box with Pressable once it becomes stable (currently beta)
|
|
69
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
70
|
-
content: tooltipMessage || content,
|
|
71
|
-
onHide: tooltipOnHide,
|
|
72
|
-
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
73
|
-
}, tooltipProps => /*#__PURE__*/React.createElement(Box, _extends({
|
|
74
|
-
as: "button",
|
|
75
|
-
xcss: [buttonStyles, xcss]
|
|
76
|
-
}, tooltipProps, {
|
|
77
|
-
onClick: onClick,
|
|
78
|
-
testId: testId
|
|
79
|
-
}), /*#__PURE__*/React.createElement(Inline, {
|
|
80
|
-
alignBlock: "center",
|
|
81
|
-
grow: "fill",
|
|
82
|
-
space: space
|
|
83
|
-
}, icon, /*#__PURE__*/React.createElement(Box, {
|
|
84
|
-
xcss: contentStyles
|
|
85
|
-
}, content))));
|
|
86
|
-
};
|
|
9
|
+
hideTooltipOnMouseDown,
|
|
10
|
+
hideTooltip,
|
|
11
|
+
...props
|
|
12
|
+
}) => hideTooltip ? /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
|
|
13
|
+
content: content
|
|
14
|
+
})) : /*#__PURE__*/React.createElement(Tooltip, {
|
|
15
|
+
content: tooltipMessage || content,
|
|
16
|
+
onHide: tooltipOnHide,
|
|
17
|
+
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
18
|
+
}, tooltipProps => /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
|
|
19
|
+
content: content,
|
|
20
|
+
tooltipProps: tooltipProps
|
|
21
|
+
})));
|
|
87
22
|
export default ActionStackItem;
|
|
@@ -25,6 +25,7 @@ const Action = ({
|
|
|
25
25
|
spaceInline,
|
|
26
26
|
tooltipMessage,
|
|
27
27
|
tooltipOnHide,
|
|
28
|
+
hideTooltip,
|
|
28
29
|
hideTooltipOnMouseDown,
|
|
29
30
|
xcss,
|
|
30
31
|
asDropDownItem,
|
|
@@ -61,7 +62,8 @@ const Action = ({
|
|
|
61
62
|
tooltipMessage: tooltipMessage || content,
|
|
62
63
|
xcss: xcss,
|
|
63
64
|
tooltipOnHide: tooltipOnHide,
|
|
64
|
-
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
65
|
+
hideTooltipOnMouseDown: hideTooltipOnMouseDown,
|
|
66
|
+
hideTooltip: hideTooltip
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
if (isDropdownItem) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
import { di } from 'react-magnetic-di';
|
|
4
4
|
import { useAISummary } from '../../../../../state/hooks/use-ai-summary';
|
|
5
5
|
import { CopySummaryAction } from './copy-summary-action';
|
|
@@ -9,6 +9,7 @@ export const AISummaryActionComponent = props => {
|
|
|
9
9
|
url,
|
|
10
10
|
ari,
|
|
11
11
|
product,
|
|
12
|
+
onLoadingChange,
|
|
12
13
|
testId = 'smart-action-ai-summary-action'
|
|
13
14
|
} = props;
|
|
14
15
|
const {
|
|
@@ -22,6 +23,9 @@ export const AISummaryActionComponent = props => {
|
|
|
22
23
|
ari,
|
|
23
24
|
product
|
|
24
25
|
});
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
onLoadingChange === null || onLoadingChange === void 0 ? void 0 : onLoadingChange(status === 'loading');
|
|
28
|
+
}, [onLoadingChange, status]);
|
|
25
29
|
return status === 'done' ? /*#__PURE__*/React.createElement(CopySummaryAction, _extends({}, props, {
|
|
26
30
|
testId: testId,
|
|
27
31
|
content: content
|
|
@@ -41,6 +41,10 @@ const ActionBlock = ({
|
|
|
41
41
|
const context = useFlexibleUiContext();
|
|
42
42
|
const ui = useFlexibleUiOptionContext();
|
|
43
43
|
const [message, setMessage] = useState();
|
|
44
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
45
|
+
const onLoadingChange = useCallback(isLoading => {
|
|
46
|
+
setIsLoading(isLoading);
|
|
47
|
+
}, [setIsLoading]);
|
|
44
48
|
const padding = !(ui !== null && ui !== void 0 && ui.hidePadding) ? getPrimitivesPaddingSpaceBySize((ui === null || ui === void 0 ? void 0 : ui.size) || SmartLinkSize.Medium) : undefined;
|
|
45
49
|
const onClick = useCallback(name => {
|
|
46
50
|
setMessage(undefined);
|
|
@@ -63,13 +67,15 @@ const ActionBlock = ({
|
|
|
63
67
|
key: name,
|
|
64
68
|
onClick: () => onClick(name),
|
|
65
69
|
onError: onError,
|
|
70
|
+
onLoadingChange: onLoadingChange,
|
|
66
71
|
size: size,
|
|
67
72
|
xcss: xcss({
|
|
68
73
|
paddingInline: padding
|
|
69
|
-
})
|
|
74
|
+
}),
|
|
75
|
+
hideTooltip: isLoading
|
|
70
76
|
}) : null;
|
|
71
77
|
});
|
|
72
|
-
}, [context === null || context === void 0 ? void 0 : context.actions, onClick, onError, padding, size, spaceInline]);
|
|
78
|
+
}, [context === null || context === void 0 ? void 0 : context.actions, onClick, onError, padding, size, spaceInline, isLoading, onLoadingChange]);
|
|
73
79
|
return actions ? jsx("div", {
|
|
74
80
|
css: ignoreContainerPaddingStyles,
|
|
75
81
|
ref: blockRef,
|
|
@@ -41,6 +41,7 @@ const TitleBlockErroredView = ({
|
|
|
41
41
|
position,
|
|
42
42
|
testId,
|
|
43
43
|
title,
|
|
44
|
+
icon,
|
|
44
45
|
hideIcon,
|
|
45
46
|
...blockProps
|
|
46
47
|
}) => {
|
|
@@ -56,6 +57,7 @@ const TitleBlockErroredView = ({
|
|
|
56
57
|
return jsx(Block, _extends({}, blockProps, {
|
|
57
58
|
testId: `${testId}-errored-view`
|
|
58
59
|
}), !hideIcon && jsx(LinkIcon, {
|
|
60
|
+
overrideIcon: icon,
|
|
59
61
|
position: position
|
|
60
62
|
}), title, descriptor && jsx(ElementGroup, {
|
|
61
63
|
direction: SmartLinkDirection.Horizontal,
|
|
@@ -61,6 +61,7 @@ const TitleBlock = ({
|
|
|
61
61
|
showActionOnHover,
|
|
62
62
|
testId = 'smart-block-title',
|
|
63
63
|
text,
|
|
64
|
+
icon,
|
|
64
65
|
theme,
|
|
65
66
|
hideRetry,
|
|
66
67
|
metadataPosition,
|
|
@@ -105,7 +106,8 @@ const TitleBlock = ({
|
|
|
105
106
|
testId: testId,
|
|
106
107
|
title: title,
|
|
107
108
|
metadataPosition: metadataPosition,
|
|
108
|
-
hideIcon: hideIcon
|
|
109
|
+
hideIcon: hideIcon,
|
|
110
|
+
icon: icon
|
|
109
111
|
}));
|
|
110
112
|
};
|
|
111
113
|
export default TitleBlock;
|
|
@@ -19,6 +19,7 @@ const TitleBlockResolvedView = ({
|
|
|
19
19
|
subtitle = [],
|
|
20
20
|
testId,
|
|
21
21
|
text,
|
|
22
|
+
icon,
|
|
22
23
|
title,
|
|
23
24
|
metadataPosition,
|
|
24
25
|
hideIcon,
|
|
@@ -29,6 +30,7 @@ const TitleBlockResolvedView = ({
|
|
|
29
30
|
return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
|
|
30
31
|
testId: `${testId}-resolved-view`
|
|
31
32
|
}), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, {
|
|
33
|
+
overrideIcon: icon,
|
|
32
34
|
position: position
|
|
33
35
|
}), /*#__PURE__*/React.createElement(ElementGroup, {
|
|
34
36
|
direction: SmartLinkDirection.Vertical,
|
|
@@ -64,6 +64,7 @@ const renderImageIcon = (defaultIcon, url, testId) => {
|
|
|
64
64
|
*/
|
|
65
65
|
const Icon = ({
|
|
66
66
|
icon,
|
|
67
|
+
overrideIcon,
|
|
67
68
|
label = 'Link',
|
|
68
69
|
name,
|
|
69
70
|
position = SmartLinkPosition.Top,
|
|
@@ -75,8 +76,8 @@ const Icon = ({
|
|
|
75
76
|
}) => {
|
|
76
77
|
const element = useMemo(() => {
|
|
77
78
|
const defaultIcon = renderDefaultIcon(label, testId);
|
|
78
|
-
return (render === null || render === void 0 ? void 0 : render()) || renderImageIcon(defaultIcon, url, testId) || renderAtlaskitIcon(icon, label, testId) || defaultIcon;
|
|
79
|
-
}, [icon, label, render, testId, url]);
|
|
79
|
+
return overrideIcon || (render === null || render === void 0 ? void 0 : render()) || renderImageIcon(defaultIcon, url, testId) || renderAtlaskitIcon(icon, label, testId) || defaultIcon;
|
|
80
|
+
}, [overrideIcon, icon, label, render, testId, url]);
|
|
80
81
|
const width = getIconWidth(size);
|
|
81
82
|
const styles = getIconStyles(position, width);
|
|
82
83
|
const renderStyles = render ? getCustomRenderStyles(width) : undefined;
|
|
@@ -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.
|
|
10
|
+
packageVersion: "26.72.0",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -12,14 +12,14 @@ function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symb
|
|
|
12
12
|
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); }
|
|
13
13
|
import uuid from 'uuid';
|
|
14
14
|
import { errorMessages } from './types';
|
|
15
|
-
import { addPath } from './utils';
|
|
15
|
+
import { addPath, getXProductHeaderValue } from './utils';
|
|
16
16
|
import { readStream } from './readStream';
|
|
17
17
|
import { getBaseUrl } from '@atlaskit/linking-common';
|
|
18
18
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
19
19
|
export var AISummaryService = /*#__PURE__*/function () {
|
|
20
20
|
function AISummaryService(props) {
|
|
21
21
|
var _this = this,
|
|
22
|
-
|
|
22
|
+
_getXProductHeaderVal;
|
|
23
23
|
_classCallCheck(this, AISummaryService);
|
|
24
24
|
_defineProperty(this, "state", {
|
|
25
25
|
content: '',
|
|
@@ -78,7 +78,7 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
78
78
|
headers: _objectSpread({
|
|
79
79
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
80
80
|
'x-experience-id': 'smart-link',
|
|
81
|
-
'x-product': ((
|
|
81
|
+
'x-product': ((_getXProductHeaderVal = getXProductHeaderValue(props.product)) === null || _getXProductHeaderVal === void 0 ? void 0 : _getXProductHeaderVal.toLowerCase()) || 'confluence'
|
|
82
82
|
}, props.headers)
|
|
83
83
|
};
|
|
84
84
|
this.url = props.url;
|
|
@@ -9,4 +9,34 @@ export var addPath = function addPath(baseUrl, path) {
|
|
|
9
9
|
var pathWithoutLeadingSlash = !path.startsWith('/') ? path : path.substring(1, path.length);
|
|
10
10
|
var url = [urlWithTrailingSlash, pathWithoutLeadingSlash].join('');
|
|
11
11
|
return url;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Subset of a map of Jira `ProductTypes` to AI Mate expected values
|
|
16
|
+
* See for more info: https://atlassian.slack.com/archives/C066UP0G0G3/p1716341647677829?thread_ts=1716338063.255939&cid=C066UP0G0G3
|
|
17
|
+
*/
|
|
18
|
+
var AiMateJiraXProduct = {
|
|
19
|
+
JSM: 'JSM',
|
|
20
|
+
JSW: 'JIRA-SOFTWARE',
|
|
21
|
+
JWM: 'JIRA-CORE',
|
|
22
|
+
JPD: 'JPD'
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Checks if `product` is a Jira related product.
|
|
26
|
+
*/
|
|
27
|
+
var isJiraProduct = function isJiraProduct(product) {
|
|
28
|
+
var JIRA_PRODUCTS = ['JPD', 'JSM', 'JSW', 'JWM'];
|
|
29
|
+
return product !== undefined && JIRA_PRODUCTS.includes(product);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Converts a `ProductType` to the expected `x-product` header value for AI Mate.
|
|
34
|
+
*
|
|
35
|
+
* @see https://developer.atlassian.com/platform/assistance-service/security/entitlements/#approach
|
|
36
|
+
*/
|
|
37
|
+
export var getXProductHeaderValue = function getXProductHeaderValue(product) {
|
|
38
|
+
if (isJiraProduct(product)) {
|
|
39
|
+
return AiMateJiraXProduct[product];
|
|
40
|
+
}
|
|
41
|
+
return product;
|
|
12
42
|
};
|
|
@@ -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.
|
|
18
|
+
packageVersion: "26.72.0"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { xcss } from '@atlaskit/primitives';
|
|
3
|
+
import { Box, Inline } from '@atlaskit/primitives';
|
|
4
|
+
import Spinner from '@atlaskit/spinner';
|
|
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
|
+
cursor: 'pointer',
|
|
11
|
+
padding: 'space.050',
|
|
12
|
+
width: '100%',
|
|
13
|
+
':focus:not(:focus-visible)': {
|
|
14
|
+
outline: 'none'
|
|
15
|
+
},
|
|
16
|
+
':focus': {
|
|
17
|
+
outlineColor: 'color.border.focused',
|
|
18
|
+
// xcss outlineOffset does not support space.negative.025
|
|
19
|
+
// @ts-ignore-next-line TS2322: Type "var(--ds-space-negative-025)" is not assignable to type
|
|
20
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)",
|
|
21
|
+
outlineStyle: 'solid',
|
|
22
|
+
outlineWidth: 'border.width.outline'
|
|
23
|
+
},
|
|
24
|
+
':hover': {
|
|
25
|
+
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
26
|
+
},
|
|
27
|
+
':active': {
|
|
28
|
+
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var contentStyles = xcss({
|
|
32
|
+
color: 'color.text',
|
|
33
|
+
// Replace with font token once it becomes stable (currently alpha)
|
|
34
|
+
// font: 'font.body.small',
|
|
35
|
+
fontSize: '12px',
|
|
36
|
+
fontStyle: 'normal',
|
|
37
|
+
fontWeight: '400',
|
|
38
|
+
lineHeight: '20px'
|
|
39
|
+
});
|
|
40
|
+
var ActionButton = function ActionButton(_ref) {
|
|
41
|
+
var content = _ref.content,
|
|
42
|
+
iconOption = _ref.icon,
|
|
43
|
+
isDisabled = _ref.isDisabled,
|
|
44
|
+
isLoading = _ref.isLoading,
|
|
45
|
+
onClickCallback = _ref.onClick,
|
|
46
|
+
size = _ref.size,
|
|
47
|
+
spaceOption = _ref.space,
|
|
48
|
+
testId = _ref.testId,
|
|
49
|
+
tooltipProps = _ref.tooltipProps,
|
|
50
|
+
xcss = _ref.xcss;
|
|
51
|
+
var space = spaceOption !== null && spaceOption !== void 0 ? spaceOption : getPrimitivesInlineSpaceBySize(size);
|
|
52
|
+
var onClick = useCallback(function () {
|
|
53
|
+
if (!isDisabled && !isLoading && onClickCallback) {
|
|
54
|
+
onClickCallback();
|
|
55
|
+
}
|
|
56
|
+
}, [isDisabled, isLoading, onClickCallback]);
|
|
57
|
+
var icon = iconOption && isLoading ? /*#__PURE__*/React.createElement(ActionIcon, {
|
|
58
|
+
asStackItemIcon: true,
|
|
59
|
+
icon: /*#__PURE__*/React.createElement(Spinner, {
|
|
60
|
+
testId: "".concat(testId, "-loading")
|
|
61
|
+
}),
|
|
62
|
+
size: size
|
|
63
|
+
}) : iconOption;
|
|
64
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
65
|
+
as: "button",
|
|
66
|
+
xcss: [buttonStyles, xcss]
|
|
67
|
+
}, tooltipProps, {
|
|
68
|
+
onClick: onClick,
|
|
69
|
+
testId: testId
|
|
70
|
+
}), /*#__PURE__*/React.createElement(Inline, {
|
|
71
|
+
alignBlock: "center",
|
|
72
|
+
grow: "fill",
|
|
73
|
+
space: space
|
|
74
|
+
}, icon, /*#__PURE__*/React.createElement(Box, {
|
|
75
|
+
xcss: contentStyles
|
|
76
|
+
}, content)));
|
|
77
|
+
};
|
|
78
|
+
export default ActionButton;
|
|
@@ -1,88 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["content", "tooltipMessage", "tooltipOnHide", "hideTooltipOnMouseDown", "hideTooltip"];
|
|
4
4
|
import Tooltip from '@atlaskit/tooltip';
|
|
5
|
-
import React
|
|
6
|
-
import
|
|
7
|
-
import ActionIcon from '../action-icon';
|
|
8
|
-
var buttonStyles = xcss({
|
|
9
|
-
all: 'unset',
|
|
10
|
-
cursor: 'pointer',
|
|
11
|
-
padding: 'space.050',
|
|
12
|
-
width: '100%',
|
|
13
|
-
':focus:not(:focus-visible)': {
|
|
14
|
-
outline: 'none'
|
|
15
|
-
},
|
|
16
|
-
':focus': {
|
|
17
|
-
outlineColor: 'color.border.focused',
|
|
18
|
-
// xcss outlineOffset does not support space.negative.025
|
|
19
|
-
// @ts-ignore-next-line TS2322: Type "var(--ds-space-negative-025)" is not assignable to type
|
|
20
|
-
outlineOffset: "var(--ds-space-negative-025, -2px)",
|
|
21
|
-
outlineStyle: 'solid',
|
|
22
|
-
outlineWidth: 'border.width.outline'
|
|
23
|
-
},
|
|
24
|
-
':hover': {
|
|
25
|
-
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
26
|
-
},
|
|
27
|
-
':active': {
|
|
28
|
-
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
var contentStyles = xcss({
|
|
32
|
-
color: 'color.text',
|
|
33
|
-
// Replace with font token once it becomes stable (currently alpha)
|
|
34
|
-
// font: 'font.body.small',
|
|
35
|
-
fontSize: '12px',
|
|
36
|
-
fontStyle: 'normal',
|
|
37
|
-
fontWeight: '400',
|
|
38
|
-
lineHeight: '20px'
|
|
39
|
-
});
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ActionButton from './action-button';
|
|
40
7
|
var ActionStackItem = function ActionStackItem(_ref) {
|
|
41
8
|
var content = _ref.content,
|
|
42
|
-
iconOption = _ref.icon,
|
|
43
|
-
isDisabled = _ref.isDisabled,
|
|
44
|
-
isLoading = _ref.isLoading,
|
|
45
|
-
onClickCallback = _ref.onClick,
|
|
46
|
-
size = _ref.size,
|
|
47
|
-
spaceOption = _ref.space,
|
|
48
|
-
testId = _ref.testId,
|
|
49
9
|
tooltipMessage = _ref.tooltipMessage,
|
|
50
|
-
xcss = _ref.xcss,
|
|
51
10
|
tooltipOnHide = _ref.tooltipOnHide,
|
|
52
|
-
hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}, [isDisabled, isLoading, onClickCallback]);
|
|
59
|
-
var icon = iconOption && isLoading ? /*#__PURE__*/React.createElement(ActionIcon, {
|
|
60
|
-
asStackItemIcon: true,
|
|
61
|
-
icon: /*#__PURE__*/React.createElement(Spinner, {
|
|
62
|
-
testId: "".concat(testId, "-loading")
|
|
63
|
-
}),
|
|
64
|
-
size: size
|
|
65
|
-
}) : iconOption;
|
|
66
|
-
|
|
67
|
-
// Replace Box with Pressable once it becomes stable (currently beta)
|
|
68
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
11
|
+
hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown,
|
|
12
|
+
hideTooltip = _ref.hideTooltip,
|
|
13
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
return hideTooltip ? /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
|
|
15
|
+
content: content
|
|
16
|
+
})) : /*#__PURE__*/React.createElement(Tooltip, {
|
|
69
17
|
content: tooltipMessage || content,
|
|
70
18
|
onHide: tooltipOnHide,
|
|
71
19
|
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
72
20
|
}, function (tooltipProps) {
|
|
73
|
-
return /*#__PURE__*/React.createElement(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
onClick: onClick,
|
|
78
|
-
testId: testId
|
|
79
|
-
}), /*#__PURE__*/React.createElement(Inline, {
|
|
80
|
-
alignBlock: "center",
|
|
81
|
-
grow: "fill",
|
|
82
|
-
space: space
|
|
83
|
-
}, icon, /*#__PURE__*/React.createElement(Box, {
|
|
84
|
-
xcss: contentStyles
|
|
85
|
-
}, content)));
|
|
21
|
+
return /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
|
|
22
|
+
content: content,
|
|
23
|
+
tooltipProps: tooltipProps
|
|
24
|
+
}));
|
|
86
25
|
});
|
|
87
26
|
};
|
|
88
27
|
export default ActionStackItem;
|
|
@@ -30,6 +30,7 @@ var Action = function Action(_ref) {
|
|
|
30
30
|
spaceInline = _ref.spaceInline,
|
|
31
31
|
tooltipMessage = _ref.tooltipMessage,
|
|
32
32
|
tooltipOnHide = _ref.tooltipOnHide,
|
|
33
|
+
hideTooltip = _ref.hideTooltip,
|
|
33
34
|
hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown,
|
|
34
35
|
xcss = _ref.xcss,
|
|
35
36
|
asDropDownItem = _ref.asDropDownItem,
|
|
@@ -65,7 +66,8 @@ var Action = function Action(_ref) {
|
|
|
65
66
|
tooltipMessage: tooltipMessage || content,
|
|
66
67
|
xcss: xcss,
|
|
67
68
|
tooltipOnHide: tooltipOnHide,
|
|
68
|
-
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
69
|
+
hideTooltipOnMouseDown: hideTooltipOnMouseDown,
|
|
70
|
+
hideTooltip: hideTooltip
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
if (isDropdownItem) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
import { di } from 'react-magnetic-di';
|
|
4
4
|
import { useAISummary } from '../../../../../state/hooks/use-ai-summary';
|
|
5
5
|
import { CopySummaryAction } from './copy-summary-action';
|
|
@@ -8,6 +8,7 @@ export var AISummaryActionComponent = function AISummaryActionComponent(props) {
|
|
|
8
8
|
var url = props.url,
|
|
9
9
|
ari = props.ari,
|
|
10
10
|
product = props.product,
|
|
11
|
+
onLoadingChange = props.onLoadingChange,
|
|
11
12
|
_props$testId = props.testId,
|
|
12
13
|
testId = _props$testId === void 0 ? 'smart-action-ai-summary-action' : _props$testId;
|
|
13
14
|
var _useAISummary = useAISummary({
|
|
@@ -19,6 +20,9 @@ export var AISummaryActionComponent = function AISummaryActionComponent(props) {
|
|
|
19
20
|
status = _useAISummary$state.status,
|
|
20
21
|
content = _useAISummary$state.content,
|
|
21
22
|
summariseUrl = _useAISummary.summariseUrl;
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
onLoadingChange === null || onLoadingChange === void 0 || onLoadingChange(status === 'loading');
|
|
25
|
+
}, [onLoadingChange, status]);
|
|
22
26
|
return status === 'done' ? /*#__PURE__*/React.createElement(CopySummaryAction, _extends({}, props, {
|
|
23
27
|
testId: testId,
|
|
24
28
|
content: content
|
|
@@ -45,6 +45,13 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
45
45
|
_useState2 = _slicedToArray(_useState, 2),
|
|
46
46
|
message = _useState2[0],
|
|
47
47
|
setMessage = _useState2[1];
|
|
48
|
+
var _useState3 = useState(false),
|
|
49
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
50
|
+
isLoading = _useState4[0],
|
|
51
|
+
setIsLoading = _useState4[1];
|
|
52
|
+
var onLoadingChange = useCallback(function (isLoading) {
|
|
53
|
+
setIsLoading(isLoading);
|
|
54
|
+
}, [setIsLoading]);
|
|
48
55
|
var padding = !(ui !== null && ui !== void 0 && ui.hidePadding) ? getPrimitivesPaddingSpaceBySize((ui === null || ui === void 0 ? void 0 : ui.size) || SmartLinkSize.Medium) : undefined;
|
|
49
56
|
var _onClick = useCallback(function (name) {
|
|
50
57
|
setMessage(undefined);
|
|
@@ -69,13 +76,15 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
69
76
|
return _onClick(name);
|
|
70
77
|
},
|
|
71
78
|
onError: onError,
|
|
79
|
+
onLoadingChange: onLoadingChange,
|
|
72
80
|
size: size,
|
|
73
81
|
xcss: xcss({
|
|
74
82
|
paddingInline: padding
|
|
75
|
-
})
|
|
83
|
+
}),
|
|
84
|
+
hideTooltip: isLoading
|
|
76
85
|
}) : null;
|
|
77
86
|
});
|
|
78
|
-
}, [context === null || context === void 0 ? void 0 : context.actions, _onClick, onError, padding, size, spaceInline]);
|
|
87
|
+
}, [context === null || context === void 0 ? void 0 : context.actions, _onClick, onError, padding, size, spaceInline, isLoading, onLoadingChange]);
|
|
79
88
|
return actions ? jsx("div", {
|
|
80
89
|
css: ignoreContainerPaddingStyles,
|
|
81
90
|
ref: blockRef,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["actionGroup", "retry", "position", "testId", "title", "hideIcon"];
|
|
3
|
+
var _excluded = ["actionGroup", "retry", "position", "testId", "title", "icon", "hideIcon"];
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { FormattedMessage } from 'react-intl-next';
|
|
@@ -43,6 +43,7 @@ var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
|
|
|
43
43
|
position = _ref.position,
|
|
44
44
|
testId = _ref.testId,
|
|
45
45
|
title = _ref.title,
|
|
46
|
+
icon = _ref.icon,
|
|
46
47
|
hideIcon = _ref.hideIcon,
|
|
47
48
|
blockProps = _objectWithoutProperties(_ref, _excluded);
|
|
48
49
|
var _ref2 = retry || {},
|
|
@@ -55,6 +56,7 @@ var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
|
|
|
55
56
|
return jsx(Block, _extends({}, blockProps, {
|
|
56
57
|
testId: "".concat(testId, "-errored-view")
|
|
57
58
|
}), !hideIcon && jsx(LinkIcon, {
|
|
59
|
+
overrideIcon: icon,
|
|
58
60
|
position: position
|
|
59
61
|
}), title, descriptor && jsx(ElementGroup, {
|
|
60
62
|
direction: SmartLinkDirection.Horizontal,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme", "hideRetry", "metadataPosition", "hideIcon"];
|
|
4
|
+
var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "icon", "theme", "hideRetry", "metadataPosition", "hideIcon"];
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
import { css } from '@emotion/react';
|
|
7
7
|
import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
|
|
@@ -67,6 +67,7 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
67
67
|
_ref$testId = _ref.testId,
|
|
68
68
|
testId = _ref$testId === void 0 ? 'smart-block-title' : _ref$testId,
|
|
69
69
|
text = _ref.text,
|
|
70
|
+
icon = _ref.icon,
|
|
70
71
|
theme = _ref.theme,
|
|
71
72
|
hideRetry = _ref.hideRetry,
|
|
72
73
|
metadataPosition = _ref.metadataPosition,
|
|
@@ -114,7 +115,8 @@ var TitleBlock = function TitleBlock(_ref) {
|
|
|
114
115
|
testId: testId,
|
|
115
116
|
title: title,
|
|
116
117
|
metadataPosition: metadataPosition,
|
|
117
|
-
hideIcon: hideIcon
|
|
118
|
+
hideIcon: hideIcon,
|
|
119
|
+
icon: icon
|
|
118
120
|
}));
|
|
119
121
|
};
|
|
120
122
|
export default TitleBlock;
|