@atlaskit/smart-card 26.38.0 → 26.39.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 +13 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
- package/dist/cjs/view/BlockCard/index.js +5 -18
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +12 -34
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenView.js +25 -51
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +13 -32
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +9 -31
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +7 -18
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +28 -51
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +5 -5
- package/dist/cjs/view/BlockCard/views/flexible/unresolved-view/index.js +41 -0
- package/dist/cjs/view/BlockCard/views/flexible/utils/index.js +30 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +12 -57
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +65 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +5 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +1 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +3 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
- package/dist/es2019/view/BlockCard/index.js +1 -15
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +8 -32
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenView.js +25 -52
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +12 -31
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +15 -41
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +10 -21
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +24 -43
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +3 -4
- package/dist/es2019/view/BlockCard/views/flexible/unresolved-view/index.js +33 -0
- package/dist/es2019/view/BlockCard/views/flexible/utils/index.js +27 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +11 -54
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +56 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/index.js +4 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +2 -1
- 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 +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +2 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
- package/dist/esm/view/BlockCard/index.js +3 -18
- package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +12 -34
- package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenView.js +26 -52
- package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +13 -32
- package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +9 -31
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +10 -21
- package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +25 -45
- package/dist/esm/view/BlockCard/views/flexible/styled.js +4 -4
- package/dist/esm/view/BlockCard/views/flexible/unresolved-view/index.js +35 -0
- package/dist/esm/view/BlockCard/views/flexible/utils/index.js +30 -1
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +13 -54
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +55 -0
- package/dist/esm/view/FlexibleCard/components/blocks/index.js +4 -1
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +5 -2
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +1 -2
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +3 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +3 -1
- package/dist/types/view/BlockCard/views/flexible/styled.d.ts +0 -1
- package/dist/types/view/BlockCard/views/flexible/types.d.ts +2 -83
- package/dist/types/view/BlockCard/views/flexible/unresolved-view/index.d.ts +4 -0
- package/dist/types/view/BlockCard/views/flexible/unresolved-view/types.d.ts +7 -0
- package/dist/types/view/BlockCard/views/flexible/utils/index.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/resolved/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +3 -1
- package/dist/types-ts4.5/view/BlockCard/views/flexible/styled.d.ts +0 -1
- package/dist/types-ts4.5/view/BlockCard/views/flexible/types.d.ts +2 -83
- package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/index.d.ts +4 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/types.d.ts +7 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/utils/index.d.ts +8 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/footer-block/resolved/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/view/BlockCard/components/flexible/footer/index.js +0 -56
- package/dist/es2019/view/BlockCard/components/flexible/footer/index.js +0 -52
- package/dist/esm/view/BlockCard/components/flexible/footer/index.js +0 -49
- package/dist/types/view/BlockCard/components/flexible/footer/index.d.ts +0 -12
- package/dist/types/view/BlockCard/components/flexible/footer/types.d.ts +0 -5
- package/dist/types-ts4.5/view/BlockCard/components/flexible/footer/index.d.ts +0 -12
- package/dist/types-ts4.5/view/BlockCard/components/flexible/footer/types.d.ts +0 -5
- /package/dist/cjs/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
- /package/dist/es2019/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
- /package/dist/esm/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import React, { useCallback, useMemo } from 'react';
|
|
4
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
5
|
+
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
6
|
+
import { Provider } from '../../../elements';
|
|
7
|
+
import ActionGroup from '../../action-group';
|
|
8
|
+
import Block from '../../block';
|
|
9
|
+
import ElementGroup from '../../element-group';
|
|
10
|
+
import { filterActionItems } from '../../utils';
|
|
11
|
+
const getActionGroupStyles = size => {
|
|
12
|
+
if (size === SmartLinkSize.XLarge) {
|
|
13
|
+
// The biggest height of the action button exceeds the max line-height
|
|
14
|
+
// of the elements causing the action on the block with x-large size to
|
|
15
|
+
// get cut at the bottom.
|
|
16
|
+
return css`
|
|
17
|
+
max-height: 2rem;
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const FooterBlockResolvedView = props => {
|
|
22
|
+
const {
|
|
23
|
+
actions,
|
|
24
|
+
testId,
|
|
25
|
+
onActionMenuOpenChange,
|
|
26
|
+
size = SmartLinkSize.Medium
|
|
27
|
+
} = props;
|
|
28
|
+
const context = useFlexibleUiContext();
|
|
29
|
+
const hasActions = useMemo(() => {
|
|
30
|
+
var _filterActionItems;
|
|
31
|
+
return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
|
|
32
|
+
}, [actions, context]);
|
|
33
|
+
const onDropdownOpenChange = useCallback(isOpen => {
|
|
34
|
+
if (onActionMenuOpenChange) {
|
|
35
|
+
onActionMenuOpenChange({
|
|
36
|
+
isOpen
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}, [onActionMenuOpenChange]);
|
|
40
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
41
|
+
testId: `${testId}-resolved-view`
|
|
42
|
+
}), /*#__PURE__*/React.createElement(Provider, {
|
|
43
|
+
testId: `${testId}-provider`
|
|
44
|
+
}), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
45
|
+
testId: "smart-element-group-actions",
|
|
46
|
+
align: SmartLinkAlignment.Right,
|
|
47
|
+
direction: SmartLinkDirection.Horizontal,
|
|
48
|
+
overrideCss: getActionGroupStyles(size),
|
|
49
|
+
width: SmartLinkWidth.Flexible
|
|
50
|
+
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
51
|
+
onDropdownOpenChange: onDropdownOpenChange,
|
|
52
|
+
items: actions,
|
|
53
|
+
appearance: "default"
|
|
54
|
+
})) : null);
|
|
55
|
+
};
|
|
56
|
+
export default FooterBlockResolvedView;
|
|
@@ -3,4 +3,7 @@ export { default as MetadataBlock } from './metadata-block';
|
|
|
3
3
|
export { default as PreviewBlock } from './preview-block';
|
|
4
4
|
export { default as SnippetBlock } from './snippet-block';
|
|
5
5
|
export { default as TitleBlock } from './title-block';
|
|
6
|
-
export { default as CustomBlock } from './block';
|
|
6
|
+
export { default as CustomBlock } from './block';
|
|
7
|
+
|
|
8
|
+
// Internal components to be used within @atlaskit/smart-card only.
|
|
9
|
+
export { default as InternalFooterBlock } from './footer-block/resolved';
|
|
@@ -44,6 +44,7 @@ const TitleBlockErroredView = ({
|
|
|
44
44
|
position,
|
|
45
45
|
testId,
|
|
46
46
|
title,
|
|
47
|
+
hideIcon,
|
|
47
48
|
...blockProps
|
|
48
49
|
}) => {
|
|
49
50
|
const {
|
|
@@ -57,7 +58,7 @@ const TitleBlockErroredView = ({
|
|
|
57
58
|
const hasAction = onClick !== undefined;
|
|
58
59
|
return jsx(Block, _extends({}, blockProps, {
|
|
59
60
|
testId: `${testId}-errored-view`
|
|
60
|
-
}), jsx(LinkIcon, {
|
|
61
|
+
}), !hideIcon && jsx(LinkIcon, {
|
|
61
62
|
position: position
|
|
62
63
|
}), title, descriptor && jsx(ElementGroup, {
|
|
63
64
|
direction: SmartLinkDirection.Horizontal,
|
|
@@ -66,6 +66,7 @@ const TitleBlock = ({
|
|
|
66
66
|
theme,
|
|
67
67
|
hideRetry,
|
|
68
68
|
metadataPosition,
|
|
69
|
+
hideIcon = false,
|
|
69
70
|
...props
|
|
70
71
|
}) => {
|
|
71
72
|
if (hideRetry && props.retry) {
|
|
@@ -107,7 +108,8 @@ const TitleBlock = ({
|
|
|
107
108
|
overrideCss: combinedCss,
|
|
108
109
|
testId: testId,
|
|
109
110
|
title: title,
|
|
110
|
-
metadataPosition: metadataPosition
|
|
111
|
+
metadataPosition: metadataPosition,
|
|
112
|
+
hideIcon: hideIcon
|
|
111
113
|
}));
|
|
112
114
|
};
|
|
113
115
|
export default TitleBlock;
|
|
@@ -17,6 +17,7 @@ const TitleBlockResolvingView = ({
|
|
|
17
17
|
actionGroup,
|
|
18
18
|
testId,
|
|
19
19
|
title,
|
|
20
|
+
hideIcon,
|
|
20
21
|
...blockProps
|
|
21
22
|
}) => {
|
|
22
23
|
const {
|
|
@@ -26,7 +27,7 @@ const TitleBlockResolvingView = ({
|
|
|
26
27
|
const iconStyles = getIconSizeStyles(iconWidth);
|
|
27
28
|
return jsx(Block, _extends({}, blockProps, {
|
|
28
29
|
testId: `${testId}-resolving-view`
|
|
29
|
-
}), jsx("span", {
|
|
30
|
+
}), !hideIcon && jsx("span", {
|
|
30
31
|
css: iconStyles,
|
|
31
32
|
"data-testid": `${testId}-icon`
|
|
32
33
|
}, jsx(LoadingSkeleton, {
|
|
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
8
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
const PACKAGE_DATA = {
|
|
10
10
|
packageName: "@atlaskit/smart-card",
|
|
11
|
-
packageVersion: "26.
|
|
11
|
+
packageVersion: "26.39.0",
|
|
12
12
|
componentName: 'linkUrl'
|
|
13
13
|
};
|
|
14
14
|
const Link = withLinkClickedEvent('a');
|
|
@@ -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.39.0"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -13,6 +13,7 @@ import { messages } from '../../../../messages';
|
|
|
13
13
|
*/
|
|
14
14
|
export var AuthorizeAction = function AuthorizeAction(onAuthorize, providerName) {
|
|
15
15
|
return {
|
|
16
|
+
appearance: 'primary',
|
|
16
17
|
name: ActionName.CustomAction,
|
|
17
18
|
content: providerName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
|
|
18
19
|
values: {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
2
|
/** @jsx jsx */
|
|
6
3
|
|
|
7
4
|
import { getExtensionKey } from '../../state/helpers';
|
|
@@ -26,8 +23,6 @@ import FlexibleErroredView from './views/flexible/FlexibleErroredView';
|
|
|
26
23
|
import { jsx } from '@emotion/react';
|
|
27
24
|
import { handleClickCommon } from './utils/handlers';
|
|
28
25
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
29
|
-
import { titleBlockCss } from './views/flexible/styled';
|
|
30
|
-
import { SmartLinkSize } from '../../constants';
|
|
31
26
|
export { default as PreviewAction } from './actions/PreviewAction';
|
|
32
27
|
export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
|
|
33
28
|
export var BlockCard = function BlockCard(_ref) {
|
|
@@ -62,13 +57,7 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
62
57
|
extensionKey: extensionKey
|
|
63
58
|
};
|
|
64
59
|
if (enableFlexibleBlockCard) {
|
|
65
|
-
var
|
|
66
|
-
var titleBlockProps = _objectSpread({
|
|
67
|
-
overrideCss: titleBlockCss
|
|
68
|
-
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
69
|
-
size: SmartLinkSize.Large
|
|
70
|
-
});
|
|
71
|
-
var flexibleBlockCardProps = _objectSpread({
|
|
60
|
+
var flexibleBlockCardProps = {
|
|
72
61
|
id: id,
|
|
73
62
|
cardState: cardState,
|
|
74
63
|
url: url,
|
|
@@ -80,12 +69,8 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
80
69
|
onResolve: onResolve,
|
|
81
70
|
renderers: renderers,
|
|
82
71
|
showServerActions: showServerActions,
|
|
83
|
-
analytics: analytics
|
|
84
|
-
|
|
85
|
-
titleBlockProps: titleBlockProps
|
|
86
|
-
}, anchorTarget ? {
|
|
87
|
-
anchorTarget: anchorTarget
|
|
88
|
-
} : {});
|
|
72
|
+
analytics: analytics
|
|
73
|
+
};
|
|
89
74
|
switch (status) {
|
|
90
75
|
case 'pending':
|
|
91
76
|
case 'resolving':
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["testId"];
|
|
2
4
|
import React, { useMemo } from 'react';
|
|
3
|
-
import FlexibleCard from '../../../FlexibleCard';
|
|
4
|
-
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
5
5
|
import { messages } from '../../../../messages';
|
|
6
6
|
import { R300 } from '@atlaskit/theme/colors';
|
|
7
7
|
import WarningIcon from '@atlaskit/icon/glyph/warning';
|
|
8
|
-
import BlockCardFooter from '../../components/flexible/footer';
|
|
9
8
|
import { RetryAction } from '../../actions/flexible/RetryAction';
|
|
10
|
-
import { CustomBlock } from '../../../FlexibleCard/components/blocks';
|
|
11
9
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
10
|
+
import UnresolvedView from './unresolved-view';
|
|
12
11
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -18,34 +17,16 @@ import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardSty
|
|
|
18
17
|
* @see FlexibleCardProps
|
|
19
18
|
*/
|
|
20
19
|
var FlexibleErroredView = function FlexibleErroredView(_ref) {
|
|
21
|
-
var
|
|
22
|
-
cardState = _ref.cardState,
|
|
23
|
-
onAuthorize = _ref.onAuthorize,
|
|
24
|
-
onError = _ref.onError,
|
|
25
|
-
url = _ref.url,
|
|
26
|
-
onClick = _ref.onClick,
|
|
27
|
-
_ref$testId = _ref.testId,
|
|
20
|
+
var _ref$testId = _ref.testId,
|
|
28
21
|
testId = _ref$testId === void 0 ? 'smart-block-errored-view' : _ref$testId,
|
|
29
|
-
|
|
30
|
-
var status = cardState.status;
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
23
|
var actions = useMemo(function () {
|
|
32
|
-
return onAuthorize ? [RetryAction(onAuthorize)] : [];
|
|
33
|
-
}, [onAuthorize]);
|
|
34
|
-
return /*#__PURE__*/React.createElement(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
onClick: onClick,
|
|
39
|
-
onError: onError,
|
|
40
|
-
testId: testId,
|
|
41
|
-
ui: {
|
|
42
|
-
hideElevation: true
|
|
43
|
-
},
|
|
44
|
-
url: url
|
|
45
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
46
|
-
hideRetry: true,
|
|
47
|
-
anchorTarget: anchorTarget
|
|
48
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(WarningIcon, {
|
|
24
|
+
return props.onAuthorize ? [RetryAction(props.onAuthorize)] : [];
|
|
25
|
+
}, [props.onAuthorize]);
|
|
26
|
+
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
27
|
+
actions: actions,
|
|
28
|
+
testId: testId
|
|
29
|
+
}), /*#__PURE__*/React.createElement(WarningIcon, {
|
|
49
30
|
label: "errored-warning-icon",
|
|
50
31
|
size: "small",
|
|
51
32
|
primaryColor: "var(--ds-icon-warning, ".concat(R300, ")"),
|
|
@@ -54,9 +35,6 @@ var FlexibleErroredView = function FlexibleErroredView(_ref) {
|
|
|
54
35
|
message: {
|
|
55
36
|
descriptor: messages.could_not_load_link
|
|
56
37
|
}
|
|
57
|
-
}))
|
|
58
|
-
actions: actions,
|
|
59
|
-
status: status
|
|
60
|
-
})));
|
|
38
|
+
}));
|
|
61
39
|
};
|
|
62
40
|
export default withFlexibleUIBlockCardStyle(FlexibleErroredView);
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["testId"];
|
|
3
5
|
import React, { useMemo } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import { CustomBlock, PreviewBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
|
|
6
|
+
import { toMessage } from '../../../../utils/intl-utils';
|
|
6
7
|
import { R300 } from '@atlaskit/theme/colors';
|
|
7
8
|
import { messages } from '../../../../messages';
|
|
8
9
|
import LockIcon from '@atlaskit/icon/glyph/lock';
|
|
9
|
-
import BlockCardFooter from '../../components/flexible/footer';
|
|
10
10
|
import { ForbiddenAction } from '../../actions/flexible/ForbiddenAction';
|
|
11
11
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
12
|
-
import { MediaPlacement, SmartLinkSize } from '../../../../constants';
|
|
13
12
|
import { getForbiddenJsonLd } from '../../../../utils/jsonld';
|
|
14
13
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
14
|
+
import UnresolvedView from './unresolved-view';
|
|
15
15
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
16
16
|
import { extractRequestAccessContextImproved } from '../../../../extractors/common/context/extractAccessContext';
|
|
17
|
-
import {
|
|
18
|
-
import { forbiddenViewTitleStyle } from './styled';
|
|
17
|
+
import { useIntl } from 'react-intl-next';
|
|
19
18
|
import extractHostname from '../../../../extractors/common/hostname/extractHostname';
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -27,16 +26,13 @@ import extractHostname from '../../../../extractors/common/hostname/extractHostn
|
|
|
27
26
|
*/
|
|
28
27
|
var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
29
28
|
var _details$meta;
|
|
30
|
-
var
|
|
31
|
-
cardState = _ref.cardState,
|
|
32
|
-
onAuthorize = _ref.onAuthorize,
|
|
33
|
-
onClick = _ref.onClick,
|
|
34
|
-
onError = _ref.onError,
|
|
35
|
-
_ref$testId = _ref.testId,
|
|
29
|
+
var _ref$testId = _ref.testId,
|
|
36
30
|
testId = _ref$testId === void 0 ? 'smart-block-forbidden-view' : _ref$testId,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var
|
|
31
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
var intl = useIntl();
|
|
33
|
+
var cardState = props.cardState,
|
|
34
|
+
onAuthorize = props.onAuthorize,
|
|
35
|
+
url = props.url;
|
|
40
36
|
var details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
41
37
|
var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
42
38
|
var provider = extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
@@ -55,44 +51,28 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
|
55
51
|
product: providerName
|
|
56
52
|
});
|
|
57
53
|
}, [cardMetadata, providerName, url]);
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
var title = useMemo(function () {
|
|
55
|
+
var descriptor = toMessage(messages.invalid_permissions, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.titleMessageKey);
|
|
56
|
+
return intl.formatMessage(descriptor, {
|
|
57
|
+
product: providerName
|
|
58
|
+
});
|
|
59
|
+
}, [intl, providerName, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.titleMessageKey]);
|
|
62
60
|
var actions = useMemo(function () {
|
|
63
61
|
var actionFromAccessContext = [];
|
|
64
62
|
var tryAnotherAccountAction = onAuthorize ? [ForbiddenAction(onAuthorize, 'try_another_account')] : [];
|
|
65
63
|
if (requestAccessContext) {
|
|
66
64
|
var action = requestAccessContext.action,
|
|
67
65
|
callToActionMessageKey = requestAccessContext.callToActionMessageKey;
|
|
68
|
-
actionFromAccessContext = action && callToActionMessageKey ? [ForbiddenAction(action.promise, callToActionMessageKey, messageContext, buttonDisabled)] : [];
|
|
66
|
+
actionFromAccessContext = action && callToActionMessageKey ? [ForbiddenAction(action.promise, callToActionMessageKey, messageContext, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.buttonDisabled)] : [];
|
|
69
67
|
}
|
|
70
68
|
return [].concat(tryAnotherAccountAction, _toConsumableArray(actionFromAccessContext));
|
|
71
|
-
}, [onAuthorize, requestAccessContext, messageContext
|
|
72
|
-
return /*#__PURE__*/React.createElement(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
onAuthorize: onAuthorize,
|
|
76
|
-
onClick: onClick,
|
|
77
|
-
onError: onError,
|
|
69
|
+
}, [onAuthorize, requestAccessContext, messageContext]);
|
|
70
|
+
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
71
|
+
actions: actions,
|
|
72
|
+
showPreview: true,
|
|
78
73
|
testId: testId,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
size: SmartLinkSize.Medium
|
|
82
|
-
},
|
|
83
|
-
url: url
|
|
84
|
-
}, titleMessageKey ? /*#__PURE__*/React.createElement(CustomBlock, {
|
|
85
|
-
overrideCss: forbiddenViewTitleStyle,
|
|
86
|
-
testId: "".concat(testId, "-title")
|
|
87
|
-
}, /*#__PURE__*/React.createElement("a", {
|
|
88
|
-
target: anchorTarget,
|
|
89
|
-
href: url
|
|
90
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[titleMessageKey], {
|
|
91
|
-
values: messageContext
|
|
92
|
-
})))) : /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
93
|
-
hideRetry: true,
|
|
94
|
-
anchorTarget: anchorTarget
|
|
95
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
74
|
+
title: title
|
|
75
|
+
}), /*#__PURE__*/React.createElement(LockIcon, {
|
|
96
76
|
label: "forbidden-lock-icon",
|
|
97
77
|
size: "small",
|
|
98
78
|
primaryColor: "var(--ds-icon-danger, ".concat(R300, ")"),
|
|
@@ -100,15 +80,9 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
|
100
80
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
101
81
|
maxLines: 2,
|
|
102
82
|
message: {
|
|
103
|
-
descriptor: messages
|
|
83
|
+
descriptor: toMessage(messages.invalid_permissions_description, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.descriptiveMessageKey),
|
|
104
84
|
values: messageContext
|
|
105
85
|
}
|
|
106
|
-
}))
|
|
107
|
-
placement: MediaPlacement.Right,
|
|
108
|
-
ignoreContainerPadding: true
|
|
109
|
-
}), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
110
|
-
actions: actions,
|
|
111
|
-
status: status
|
|
112
|
-
})));
|
|
86
|
+
}));
|
|
113
87
|
};
|
|
114
88
|
export default withFlexibleUIBlockCardStyle(FlexibleForbiddenView);
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["testId"];
|
|
3
5
|
import React, { useMemo } from 'react';
|
|
4
|
-
import FlexibleCard from '../../../FlexibleCard';
|
|
5
|
-
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
6
|
-
import { CustomBlock } from '../../../FlexibleCard/components/blocks';
|
|
7
6
|
import { R300 } from '@atlaskit/theme/colors';
|
|
8
7
|
import { messages } from '../../../../messages';
|
|
9
8
|
import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
10
|
-
import BlockCardFooter from '../../components/flexible/footer';
|
|
11
9
|
import { ForbiddenAction } from '../../actions/flexible/ForbiddenAction';
|
|
12
10
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
13
11
|
import { getForbiddenJsonLd } from '../../../../utils/jsonld';
|
|
14
12
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
15
13
|
import { extractRequestAccessContext } from '../../../../extractors/common/context';
|
|
14
|
+
import UnresolvedView from './unresolved-view';
|
|
16
15
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -22,16 +21,12 @@ import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardSty
|
|
|
22
21
|
*/
|
|
23
22
|
var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
24
23
|
var _details$meta;
|
|
25
|
-
var
|
|
26
|
-
cardState = _ref.cardState,
|
|
27
|
-
onAuthorize = _ref.onAuthorize,
|
|
28
|
-
onClick = _ref.onClick,
|
|
29
|
-
onError = _ref.onError,
|
|
30
|
-
_ref$testId = _ref.testId,
|
|
24
|
+
var _ref$testId = _ref.testId,
|
|
31
25
|
testId = _ref$testId === void 0 ? 'smart-block-forbidden-view' : _ref$testId,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
var cardState = props.cardState,
|
|
28
|
+
onAuthorize = props.onAuthorize,
|
|
29
|
+
url = props.url;
|
|
35
30
|
var details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
36
31
|
var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
37
32
|
var provider = extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
@@ -54,21 +49,10 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
|
54
49
|
}
|
|
55
50
|
return [].concat(tryAnotherAccountAction, _toConsumableArray(actionFromAccessContext));
|
|
56
51
|
}, [onAuthorize, requestAccessContext, providerName]);
|
|
57
|
-
return /*#__PURE__*/React.createElement(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
onClick: onClick,
|
|
62
|
-
onError: onError,
|
|
63
|
-
testId: testId,
|
|
64
|
-
ui: {
|
|
65
|
-
hideElevation: true
|
|
66
|
-
},
|
|
67
|
-
url: url
|
|
68
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
69
|
-
hideRetry: true,
|
|
70
|
-
anchorTarget: anchorTarget
|
|
71
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
52
|
+
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
53
|
+
actions: actions,
|
|
54
|
+
testId: testId
|
|
55
|
+
}), /*#__PURE__*/React.createElement(LockIcon, {
|
|
72
56
|
label: "forbidden-lock-icon",
|
|
73
57
|
size: "small",
|
|
74
58
|
primaryColor: "var(--ds-icon-danger, ".concat(R300, ")"),
|
|
@@ -80,10 +64,7 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
|
|
|
80
64
|
context: providerName
|
|
81
65
|
}
|
|
82
66
|
}
|
|
83
|
-
}))
|
|
84
|
-
actions: actions,
|
|
85
|
-
status: status
|
|
86
|
-
})));
|
|
67
|
+
}));
|
|
87
68
|
};
|
|
88
69
|
|
|
89
70
|
/**
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["testId"];
|
|
2
4
|
import React from 'react';
|
|
3
|
-
import FlexibleCard from '../../../FlexibleCard';
|
|
4
|
-
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
5
5
|
import { messages } from '../../../../messages';
|
|
6
6
|
import WarningIcon from '@atlaskit/icon/glyph/warning';
|
|
7
7
|
import { R300 } from '@atlaskit/theme/colors';
|
|
8
|
-
import BlockCardFooter from '../../components/flexible/footer';
|
|
9
8
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
10
|
-
import
|
|
9
|
+
import UnresolvedView from './unresolved-view';
|
|
11
10
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -17,31 +16,12 @@ import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardSty
|
|
|
17
16
|
* @see FlexibleCardProps
|
|
18
17
|
*/
|
|
19
18
|
var FlexibleNotFoundView = function FlexibleNotFoundView(_ref) {
|
|
20
|
-
var
|
|
21
|
-
cardState = _ref.cardState,
|
|
22
|
-
onAuthorize = _ref.onAuthorize,
|
|
23
|
-
onError = _ref.onError,
|
|
24
|
-
url = _ref.url,
|
|
25
|
-
onClick = _ref.onClick,
|
|
26
|
-
_ref$testId = _ref.testId,
|
|
19
|
+
var _ref$testId = _ref.testId,
|
|
27
20
|
testId = _ref$testId === void 0 ? 'smart-block-not-found-view' : _ref$testId,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
cardState: cardState,
|
|
33
|
-
onAuthorize: onAuthorize,
|
|
34
|
-
onClick: onClick,
|
|
35
|
-
onError: onError,
|
|
36
|
-
testId: testId,
|
|
37
|
-
ui: {
|
|
38
|
-
hideElevation: true
|
|
39
|
-
},
|
|
40
|
-
url: url
|
|
41
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
42
|
-
hideRetry: true,
|
|
43
|
-
anchorTarget: anchorTarget
|
|
44
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(WarningIcon, {
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
23
|
+
testId: testId
|
|
24
|
+
}), /*#__PURE__*/React.createElement(WarningIcon, {
|
|
45
25
|
label: "not-found-warning-icon",
|
|
46
26
|
size: "small",
|
|
47
27
|
primaryColor: "var(--ds-icon-warning, ".concat(R300, ")"),
|
|
@@ -51,8 +31,6 @@ var FlexibleNotFoundView = function FlexibleNotFoundView(_ref) {
|
|
|
51
31
|
descriptor: messages.not_found_description
|
|
52
32
|
},
|
|
53
33
|
testId: "".concat(testId, "-message")
|
|
54
|
-
}))
|
|
55
|
-
status: status
|
|
56
|
-
})));
|
|
34
|
+
}));
|
|
57
35
|
};
|
|
58
36
|
export default withFlexibleUIBlockCardStyle(FlexibleNotFoundView);
|
|
@@ -3,9 +3,9 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import FlexibleCard from '../../../FlexibleCard';
|
|
5
5
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
|
|
6
|
-
import { metadataBlockCss
|
|
7
|
-
import { ActionName, ElementName,
|
|
8
|
-
import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
|
|
6
|
+
import { metadataBlockCss } from './styled';
|
|
7
|
+
import { ActionName, ElementName, SmartLinkPosition } from '../../../../constants';
|
|
8
|
+
import { getSimulatedMetadata, getSimulatedBetterMetadata, getTitleBlockOptions, getFooterBlockOptions, PreviewBlockOptions, FlexibleCardUiOptions } from './utils';
|
|
9
9
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
11
11
|
/**
|
|
@@ -19,12 +19,10 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
19
19
|
onError = _ref.onError,
|
|
20
20
|
onResolve = _ref.onResolve,
|
|
21
21
|
showServerActions = _ref.showServerActions,
|
|
22
|
-
anchorTarget = _ref.anchorTarget,
|
|
23
22
|
_ref$testId = _ref.testId,
|
|
24
23
|
testId = _ref$testId === void 0 ? 'smart-block-resolved-view' : _ref$testId,
|
|
25
24
|
url = _ref.url,
|
|
26
|
-
analytics = _ref.analytics
|
|
27
|
-
titleBlockProps = _ref.titleBlockProps;
|
|
25
|
+
analytics = _ref.analytics;
|
|
28
26
|
var _useState = useState(false),
|
|
29
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
28
|
isPreviewBlockErrored = _useState2[0],
|
|
@@ -60,20 +58,15 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
60
58
|
onResolve: onResolve,
|
|
61
59
|
showServerActions: showServerActions,
|
|
62
60
|
testId: testId,
|
|
63
|
-
ui:
|
|
64
|
-
hideElevation: true
|
|
65
|
-
},
|
|
61
|
+
ui: FlexibleCardUiOptions,
|
|
66
62
|
url: url
|
|
67
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
68
|
-
position: SmartLinkPosition.Center,
|
|
63
|
+
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, getTitleBlockOptions(), {
|
|
69
64
|
metadata: titleMetadata,
|
|
70
|
-
hideRetry: true,
|
|
71
65
|
subtitle: [{
|
|
72
66
|
name: ElementName.Location
|
|
73
67
|
}],
|
|
74
|
-
metadataPosition: SmartLinkPosition.Top
|
|
75
|
-
|
|
76
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
68
|
+
metadataPosition: SmartLinkPosition.Top
|
|
69
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
77
70
|
primary: topMetadata,
|
|
78
71
|
maxLines: 1
|
|
79
72
|
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
@@ -82,15 +75,11 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
82
75
|
primary: bottomMetadata,
|
|
83
76
|
maxLines: 1,
|
|
84
77
|
overrideCss: metadataBlockCss
|
|
85
|
-
}), !isPreviewBlockErrored ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
86
|
-
placement: MediaPlacement.Right,
|
|
87
|
-
ignoreContainerPadding: true,
|
|
78
|
+
}), !isPreviewBlockErrored ? /*#__PURE__*/React.createElement(PreviewBlock, _extends({}, PreviewBlockOptions, {
|
|
88
79
|
onError: function onError() {
|
|
89
80
|
setIsPreviewBlockErrored(true);
|
|
90
81
|
}
|
|
91
|
-
}) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({},
|
|
92
|
-
overrideCss: footerBlockCss
|
|
93
|
-
}, {
|
|
82
|
+
})) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({}, getFooterBlockOptions(), {
|
|
94
83
|
actions: footerActions
|
|
95
84
|
})));
|
|
96
85
|
};
|