@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
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { CustomBlock, PreviewBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
|
|
3
|
+
import { toMessage } from '../../../../utils/intl-utils';
|
|
5
4
|
import { R300 } from '@atlaskit/theme/colors';
|
|
6
5
|
import { messages } from '../../../../messages';
|
|
7
6
|
import LockIcon from '@atlaskit/icon/glyph/lock';
|
|
8
|
-
import BlockCardFooter from '../../components/flexible/footer';
|
|
9
7
|
import { ForbiddenAction } from '../../actions/flexible/ForbiddenAction';
|
|
10
8
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
11
|
-
import { MediaPlacement, SmartLinkSize } from '../../../../constants';
|
|
12
9
|
import { getForbiddenJsonLd } from '../../../../utils/jsonld';
|
|
13
10
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
11
|
+
import UnresolvedView from './unresolved-view';
|
|
14
12
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
15
13
|
import { extractRequestAccessContextImproved } from '../../../../extractors/common/context/extractAccessContext';
|
|
16
|
-
import {
|
|
17
|
-
import { forbiddenViewTitleStyle } from './styled';
|
|
14
|
+
import { useIntl } from 'react-intl-next';
|
|
18
15
|
import extractHostname from '../../../../extractors/common/hostname/extractHostname';
|
|
19
16
|
|
|
20
17
|
/**
|
|
@@ -25,17 +22,16 @@ import extractHostname from '../../../../extractors/common/hostname/extractHostn
|
|
|
25
22
|
* @see FlexibleCardProps
|
|
26
23
|
*/
|
|
27
24
|
const FlexibleForbiddenView = ({
|
|
28
|
-
anchorTarget,
|
|
29
|
-
cardState,
|
|
30
|
-
onAuthorize,
|
|
31
|
-
onClick,
|
|
32
|
-
onError,
|
|
33
25
|
testId = 'smart-block-forbidden-view',
|
|
34
|
-
|
|
35
|
-
titleBlockProps
|
|
26
|
+
...props
|
|
36
27
|
}) => {
|
|
37
28
|
var _details$meta;
|
|
38
|
-
const
|
|
29
|
+
const intl = useIntl();
|
|
30
|
+
const {
|
|
31
|
+
cardState,
|
|
32
|
+
onAuthorize,
|
|
33
|
+
url
|
|
34
|
+
} = props;
|
|
39
35
|
const details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
40
36
|
const cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
41
37
|
const provider = extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
@@ -54,11 +50,12 @@ const FlexibleForbiddenView = ({
|
|
|
54
50
|
product: providerName
|
|
55
51
|
});
|
|
56
52
|
}, [cardMetadata, providerName, url]);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
const title = useMemo(() => {
|
|
54
|
+
const descriptor = toMessage(messages.invalid_permissions, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.titleMessageKey);
|
|
55
|
+
return intl.formatMessage(descriptor, {
|
|
56
|
+
product: providerName
|
|
57
|
+
});
|
|
58
|
+
}, [intl, providerName, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.titleMessageKey]);
|
|
62
59
|
const actions = useMemo(() => {
|
|
63
60
|
let actionFromAccessContext = [];
|
|
64
61
|
const tryAnotherAccountAction = onAuthorize ? [ForbiddenAction(onAuthorize, 'try_another_account')] : [];
|
|
@@ -67,34 +64,16 @@ const FlexibleForbiddenView = ({
|
|
|
67
64
|
action,
|
|
68
65
|
callToActionMessageKey
|
|
69
66
|
} = requestAccessContext;
|
|
70
|
-
actionFromAccessContext = action && callToActionMessageKey ? [ForbiddenAction(action.promise, callToActionMessageKey, messageContext, buttonDisabled)] : [];
|
|
67
|
+
actionFromAccessContext = action && callToActionMessageKey ? [ForbiddenAction(action.promise, callToActionMessageKey, messageContext, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.buttonDisabled)] : [];
|
|
71
68
|
}
|
|
72
69
|
return [...tryAnotherAccountAction, ...actionFromAccessContext];
|
|
73
|
-
}, [onAuthorize, requestAccessContext, messageContext
|
|
74
|
-
return /*#__PURE__*/React.createElement(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
onAuthorize: onAuthorize,
|
|
78
|
-
onClick: onClick,
|
|
79
|
-
onError: onError,
|
|
70
|
+
}, [onAuthorize, requestAccessContext, messageContext]);
|
|
71
|
+
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
72
|
+
actions: actions,
|
|
73
|
+
showPreview: true,
|
|
80
74
|
testId: testId,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
size: SmartLinkSize.Medium
|
|
84
|
-
},
|
|
85
|
-
url: url
|
|
86
|
-
}, titleMessageKey ? /*#__PURE__*/React.createElement(CustomBlock, {
|
|
87
|
-
overrideCss: forbiddenViewTitleStyle,
|
|
88
|
-
testId: `${testId}-title`
|
|
89
|
-
}, /*#__PURE__*/React.createElement("a", {
|
|
90
|
-
target: anchorTarget,
|
|
91
|
-
href: url
|
|
92
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[titleMessageKey], {
|
|
93
|
-
values: messageContext
|
|
94
|
-
})))) : /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
95
|
-
hideRetry: true,
|
|
96
|
-
anchorTarget: anchorTarget
|
|
97
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
75
|
+
title: title
|
|
76
|
+
}), /*#__PURE__*/React.createElement(LockIcon, {
|
|
98
77
|
label: "forbidden-lock-icon",
|
|
99
78
|
size: "small",
|
|
100
79
|
primaryColor: `var(--ds-icon-danger, ${R300})`,
|
|
@@ -102,15 +81,9 @@ const FlexibleForbiddenView = ({
|
|
|
102
81
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
103
82
|
maxLines: 2,
|
|
104
83
|
message: {
|
|
105
|
-
descriptor: messages
|
|
84
|
+
descriptor: toMessage(messages.invalid_permissions_description, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.descriptiveMessageKey),
|
|
106
85
|
values: messageContext
|
|
107
86
|
}
|
|
108
|
-
}))
|
|
109
|
-
placement: MediaPlacement.Right,
|
|
110
|
-
ignoreContainerPadding: true
|
|
111
|
-
}), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
112
|
-
actions: actions,
|
|
113
|
-
status: status
|
|
114
|
-
})));
|
|
87
|
+
}));
|
|
115
88
|
};
|
|
116
89
|
export default withFlexibleUIBlockCardStyle(FlexibleForbiddenView);
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import FlexibleCard from '../../../FlexibleCard';
|
|
4
|
-
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
5
|
-
import { CustomBlock } from '../../../FlexibleCard/components/blocks';
|
|
6
3
|
import { R300 } from '@atlaskit/theme/colors';
|
|
7
4
|
import { messages } from '../../../../messages';
|
|
8
5
|
import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
9
|
-
import BlockCardFooter from '../../components/flexible/footer';
|
|
10
6
|
import { ForbiddenAction } from '../../actions/flexible/ForbiddenAction';
|
|
11
7
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
12
8
|
import { getForbiddenJsonLd } from '../../../../utils/jsonld';
|
|
13
9
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
14
10
|
import { extractRequestAccessContext } from '../../../../extractors/common/context';
|
|
11
|
+
import UnresolvedView from './unresolved-view';
|
|
15
12
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
16
13
|
|
|
17
14
|
/**
|
|
@@ -20,17 +17,15 @@ import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardSty
|
|
|
20
17
|
* @deprecated Replaced by FlexibleForbiddenView
|
|
21
18
|
*/
|
|
22
19
|
const FlexibleForbiddenView = ({
|
|
23
|
-
anchorTarget,
|
|
24
|
-
cardState,
|
|
25
|
-
onAuthorize,
|
|
26
|
-
onClick,
|
|
27
|
-
onError,
|
|
28
20
|
testId = 'smart-block-forbidden-view',
|
|
29
|
-
|
|
30
|
-
titleBlockProps
|
|
21
|
+
...props
|
|
31
22
|
}) => {
|
|
32
23
|
var _details$meta;
|
|
33
|
-
const
|
|
24
|
+
const {
|
|
25
|
+
cardState,
|
|
26
|
+
onAuthorize,
|
|
27
|
+
url
|
|
28
|
+
} = props;
|
|
34
29
|
const details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
35
30
|
const cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
36
31
|
const provider = extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
@@ -55,21 +50,10 @@ const FlexibleForbiddenView = ({
|
|
|
55
50
|
}
|
|
56
51
|
return [...tryAnotherAccountAction, ...actionFromAccessContext];
|
|
57
52
|
}, [onAuthorize, requestAccessContext, providerName]);
|
|
58
|
-
return /*#__PURE__*/React.createElement(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
onClick: onClick,
|
|
63
|
-
onError: onError,
|
|
64
|
-
testId: testId,
|
|
65
|
-
ui: {
|
|
66
|
-
hideElevation: true
|
|
67
|
-
},
|
|
68
|
-
url: url
|
|
69
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
70
|
-
hideRetry: true,
|
|
71
|
-
anchorTarget: anchorTarget
|
|
72
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(LockIcon, {
|
|
53
|
+
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
54
|
+
actions: actions,
|
|
55
|
+
testId: testId
|
|
56
|
+
}), /*#__PURE__*/React.createElement(LockIcon, {
|
|
73
57
|
label: "forbidden-lock-icon",
|
|
74
58
|
size: "small",
|
|
75
59
|
primaryColor: `var(--ds-icon-danger, ${R300})`,
|
|
@@ -81,10 +65,7 @@ const FlexibleForbiddenView = ({
|
|
|
81
65
|
context: providerName
|
|
82
66
|
}
|
|
83
67
|
}
|
|
84
|
-
}))
|
|
85
|
-
actions: actions,
|
|
86
|
-
status: status
|
|
87
|
-
})));
|
|
68
|
+
}));
|
|
88
69
|
};
|
|
89
70
|
|
|
90
71
|
/**
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import FlexibleCard from '../../../FlexibleCard';
|
|
4
|
-
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
5
3
|
import { messages } from '../../../../messages';
|
|
6
4
|
import WarningIcon from '@atlaskit/icon/glyph/warning';
|
|
7
5
|
import { R300 } from '@atlaskit/theme/colors';
|
|
8
|
-
import BlockCardFooter from '../../components/flexible/footer';
|
|
9
6
|
import Text from '../../../FlexibleCard/components/elements/text';
|
|
10
|
-
import
|
|
7
|
+
import UnresolvedView from './unresolved-view';
|
|
11
8
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
12
9
|
|
|
13
10
|
/**
|
|
@@ -17,42 +14,19 @@ import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardSty
|
|
|
17
14
|
* @see FlexibleCardProps
|
|
18
15
|
*/
|
|
19
16
|
const FlexibleNotFoundView = ({
|
|
20
|
-
anchorTarget,
|
|
21
|
-
cardState,
|
|
22
|
-
onAuthorize,
|
|
23
|
-
onError,
|
|
24
|
-
url,
|
|
25
|
-
onClick,
|
|
26
17
|
testId = 'smart-block-not-found-view',
|
|
27
|
-
|
|
28
|
-
}) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
42
|
-
hideRetry: true,
|
|
43
|
-
anchorTarget: anchorTarget
|
|
44
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(WarningIcon, {
|
|
45
|
-
label: "not-found-warning-icon",
|
|
46
|
-
size: "small",
|
|
47
|
-
primaryColor: `var(--ds-icon-warning, ${R300})`,
|
|
48
|
-
testId: `${testId}-warning-icon`
|
|
49
|
-
}), /*#__PURE__*/React.createElement(Text, {
|
|
50
|
-
message: {
|
|
51
|
-
descriptor: messages.not_found_description
|
|
52
|
-
},
|
|
53
|
-
testId: `${testId}-message`
|
|
54
|
-
})), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
55
|
-
status: status
|
|
56
|
-
})));
|
|
57
|
-
};
|
|
18
|
+
...props
|
|
19
|
+
}) => /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
20
|
+
testId: testId
|
|
21
|
+
}), /*#__PURE__*/React.createElement(WarningIcon, {
|
|
22
|
+
label: "not-found-warning-icon",
|
|
23
|
+
size: "small",
|
|
24
|
+
primaryColor: `var(--ds-icon-warning, ${R300})`,
|
|
25
|
+
testId: `${testId}-warning-icon`
|
|
26
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
27
|
+
message: {
|
|
28
|
+
descriptor: messages.not_found_description
|
|
29
|
+
},
|
|
30
|
+
testId: `${testId}-message`
|
|
31
|
+
}));
|
|
58
32
|
export default withFlexibleUIBlockCardStyle(FlexibleNotFoundView);
|
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import FlexibleCard from '../../../FlexibleCard';
|
|
4
4
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
|
|
5
|
-
import { metadataBlockCss
|
|
6
|
-
import { ActionName, ElementName,
|
|
7
|
-
import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
|
|
5
|
+
import { metadataBlockCss } from './styled';
|
|
6
|
+
import { ActionName, ElementName, SmartLinkPosition } from '../../../../constants';
|
|
7
|
+
import { getSimulatedMetadata, getSimulatedBetterMetadata, getTitleBlockOptions, getFooterBlockOptions, PreviewBlockOptions, FlexibleCardUiOptions } from './utils';
|
|
8
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
10
10
|
/**
|
|
@@ -18,11 +18,9 @@ const FlexibleResolvedView = ({
|
|
|
18
18
|
onError,
|
|
19
19
|
onResolve,
|
|
20
20
|
showServerActions,
|
|
21
|
-
anchorTarget,
|
|
22
21
|
testId = 'smart-block-resolved-view',
|
|
23
22
|
url,
|
|
24
|
-
analytics
|
|
25
|
-
titleBlockProps
|
|
23
|
+
analytics
|
|
26
24
|
}) => {
|
|
27
25
|
const [isPreviewBlockErrored, setIsPreviewBlockErrored] = useState(false);
|
|
28
26
|
useEffect(() => {
|
|
@@ -55,20 +53,15 @@ const FlexibleResolvedView = ({
|
|
|
55
53
|
onResolve: onResolve,
|
|
56
54
|
showServerActions: showServerActions,
|
|
57
55
|
testId: testId,
|
|
58
|
-
ui:
|
|
59
|
-
hideElevation: true
|
|
60
|
-
},
|
|
56
|
+
ui: FlexibleCardUiOptions,
|
|
61
57
|
url: url
|
|
62
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
63
|
-
position: SmartLinkPosition.Center,
|
|
58
|
+
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, getTitleBlockOptions(), {
|
|
64
59
|
metadata: titleMetadata,
|
|
65
|
-
hideRetry: true,
|
|
66
60
|
subtitle: [{
|
|
67
61
|
name: ElementName.Location
|
|
68
62
|
}],
|
|
69
|
-
metadataPosition: SmartLinkPosition.Top
|
|
70
|
-
|
|
71
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
63
|
+
metadataPosition: SmartLinkPosition.Top
|
|
64
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
72
65
|
primary: topMetadata,
|
|
73
66
|
maxLines: 1
|
|
74
67
|
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
@@ -77,15 +70,11 @@ const FlexibleResolvedView = ({
|
|
|
77
70
|
primary: bottomMetadata,
|
|
78
71
|
maxLines: 1,
|
|
79
72
|
overrideCss: metadataBlockCss
|
|
80
|
-
}), !isPreviewBlockErrored ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
81
|
-
placement: MediaPlacement.Right,
|
|
82
|
-
ignoreContainerPadding: true,
|
|
73
|
+
}), !isPreviewBlockErrored ? /*#__PURE__*/React.createElement(PreviewBlock, _extends({}, PreviewBlockOptions, {
|
|
83
74
|
onError: () => {
|
|
84
75
|
setIsPreviewBlockErrored(true);
|
|
85
76
|
}
|
|
86
|
-
}) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({},
|
|
87
|
-
overrideCss: footerBlockCss
|
|
88
|
-
}, {
|
|
77
|
+
})) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({}, getFooterBlockOptions(), {
|
|
89
78
|
actions: footerActions
|
|
90
79
|
})));
|
|
91
80
|
};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
3
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
-
import
|
|
6
|
+
import { getExtensionKey } from '../../../../state/helpers';
|
|
5
7
|
import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
|
|
6
|
-
import BlockCardFooter from '../../components/flexible/footer';
|
|
7
|
-
import { CustomBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
|
|
8
|
-
import { SmartLinkStatus } from '../../../../constants';
|
|
9
8
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
10
9
|
import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
|
|
11
|
-
import { css } from '@emotion/react';
|
|
12
|
-
import { tokens } from '../../../../utils/token';
|
|
13
10
|
import { messages } from '../../../../messages';
|
|
11
|
+
import UnresolvedView from './unresolved-view';
|
|
14
12
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
15
13
|
const contentStyles = css`
|
|
16
|
-
color: ${
|
|
14
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
17
15
|
margin-top: 0.5rem;
|
|
18
16
|
font-size: 0.75rem;
|
|
19
17
|
`;
|
|
@@ -26,59 +24,42 @@ const contentStyles = css`
|
|
|
26
24
|
* @see FlexibleCardProps
|
|
27
25
|
*/
|
|
28
26
|
const FlexibleUnauthorisedView = ({
|
|
29
|
-
anchorTarget,
|
|
30
|
-
analytics,
|
|
31
|
-
cardState,
|
|
32
|
-
extensionKey = '',
|
|
33
|
-
onAuthorize,
|
|
34
|
-
onClick,
|
|
35
|
-
onError,
|
|
36
27
|
testId = 'smart-block-unauthorized-view',
|
|
37
|
-
|
|
38
|
-
titleBlockProps
|
|
28
|
+
...props
|
|
39
29
|
}) => {
|
|
40
|
-
var _cardState$details, _extractProvider;
|
|
30
|
+
var _getExtensionKey, _cardState$details, _extractProvider;
|
|
31
|
+
const {
|
|
32
|
+
analytics,
|
|
33
|
+
cardState,
|
|
34
|
+
onAuthorize
|
|
35
|
+
} = props;
|
|
36
|
+
const extensionKey = (_getExtensionKey = getExtensionKey(cardState === null || cardState === void 0 ? void 0 : cardState.details)) !== null && _getExtensionKey !== void 0 ? _getExtensionKey : '';
|
|
41
37
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
42
38
|
const providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
43
39
|
const handleAuthorize = useCallback(() => {
|
|
44
40
|
if (onAuthorize) {
|
|
45
|
-
analytics.track.appAccountAuthStarted({
|
|
41
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
|
|
46
42
|
extensionKey
|
|
47
43
|
});
|
|
48
44
|
onAuthorize();
|
|
49
45
|
}
|
|
50
|
-
}, [onAuthorize, extensionKey, analytics.track]);
|
|
51
|
-
const content = useMemo(() => onAuthorize ?
|
|
46
|
+
}, [onAuthorize, extensionKey, analytics === null || analytics === void 0 ? void 0 : analytics.track]);
|
|
47
|
+
const content = useMemo(() => onAuthorize ? jsx(UnauthorisedViewContent, {
|
|
52
48
|
providerName: providerName,
|
|
53
49
|
analytics: analytics,
|
|
54
50
|
testId: testId
|
|
55
|
-
}) :
|
|
51
|
+
}) : jsx(FormattedMessage, _extends({}, messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
|
|
56
52
|
values: {
|
|
57
53
|
context: providerName
|
|
58
54
|
}
|
|
59
55
|
})), [analytics, onAuthorize, providerName, testId]);
|
|
60
56
|
const actions = useMemo(() => onAuthorize ? [AuthorizeAction(handleAuthorize, providerName)] : [], [handleAuthorize, onAuthorize, providerName]);
|
|
61
|
-
return
|
|
62
|
-
appearance: "block",
|
|
63
|
-
cardState: cardState,
|
|
64
|
-
onAuthorize: onAuthorize,
|
|
65
|
-
onClick: onClick,
|
|
66
|
-
onError: onError,
|
|
67
|
-
testId: testId,
|
|
68
|
-
ui: {
|
|
69
|
-
hideElevation: true
|
|
70
|
-
},
|
|
71
|
-
url: url
|
|
72
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
73
|
-
hideRetry: true,
|
|
74
|
-
anchorTarget: anchorTarget
|
|
75
|
-
}, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
76
|
-
overrideCss: contentStyles,
|
|
77
|
-
testId: `${testId}-content`
|
|
78
|
-
}, /*#__PURE__*/React.createElement("div", null, content)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
57
|
+
return jsx(UnresolvedView, _extends({}, props, {
|
|
79
58
|
actions: actions,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
59
|
+
testId: testId
|
|
60
|
+
}), jsx("div", {
|
|
61
|
+
css: contentStyles,
|
|
62
|
+
"data-testid": `${testId}-content`
|
|
63
|
+
}, content));
|
|
83
64
|
};
|
|
84
65
|
export default withFlexibleUIBlockCardStyle(FlexibleUnauthorisedView);
|
|
@@ -4,11 +4,13 @@ import { N40 } from '@atlaskit/theme/colors';
|
|
|
4
4
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
|
|
6
6
|
// in editor prosemirror adds padding-left so we need to overwrite it
|
|
7
|
+
// renderer overwrites the margin-right so we need to add it here
|
|
7
8
|
export const metadataBlockCss = css`
|
|
8
9
|
/* primary element group */
|
|
9
10
|
span[data-smart-element-avatar-group] {
|
|
10
11
|
> ul {
|
|
11
12
|
padding-left: 0px;
|
|
13
|
+
margin-right: 0.5rem;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
[data-smart-element-group] {
|
|
@@ -44,7 +46,4 @@ const refreshedFlexibleBlockCardStyle = css`
|
|
|
44
46
|
border: 1px solid ${`var(--ds-border, ${N40})`};
|
|
45
47
|
}
|
|
46
48
|
`;
|
|
47
|
-
export const flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
|
|
48
|
-
export const forbiddenViewTitleStyle = css`
|
|
49
|
-
font-weight: 600;
|
|
50
|
-
`;
|
|
49
|
+
export const flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { CustomBlock, PreviewBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import FlexibleCard from '../../../../FlexibleCard';
|
|
5
|
+
import { InternalFooterBlock } from '../../../../FlexibleCard/components/blocks';
|
|
6
|
+
import { FlexibleCardUiOptions, getFooterBlockOptions, PreviewBlockOptions, getTitleBlockOptions } from '../utils';
|
|
7
|
+
const UnresolvedView = ({
|
|
8
|
+
actions,
|
|
9
|
+
cardState,
|
|
10
|
+
children,
|
|
11
|
+
onAuthorize,
|
|
12
|
+
onClick,
|
|
13
|
+
onError,
|
|
14
|
+
showPreview = false,
|
|
15
|
+
testId,
|
|
16
|
+
title,
|
|
17
|
+
url
|
|
18
|
+
}) => /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
19
|
+
appearance: "block",
|
|
20
|
+
cardState: cardState,
|
|
21
|
+
onAuthorize: onAuthorize,
|
|
22
|
+
onClick: onClick,
|
|
23
|
+
onError: onError,
|
|
24
|
+
testId: testId,
|
|
25
|
+
ui: FlexibleCardUiOptions,
|
|
26
|
+
url: url
|
|
27
|
+
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, getTitleBlockOptions(), {
|
|
28
|
+
text: title
|
|
29
|
+
})), /*#__PURE__*/React.createElement(CustomBlock, null, children), showPreview && /*#__PURE__*/React.createElement(PreviewBlock, PreviewBlockOptions), /*#__PURE__*/React.createElement(InternalFooterBlock, _extends({}, getFooterBlockOptions(), {
|
|
30
|
+
actions: actions,
|
|
31
|
+
testId: "smart-block-card-footer"
|
|
32
|
+
})));
|
|
33
|
+
export default UnresolvedView;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { ElementName, MediaPlacement, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
|
|
2
3
|
import { extractOwnedBy } from '../../../../../extractors/flexible/utils';
|
|
3
4
|
import { getExtensionKey } from '../../../../../state/helpers';
|
|
5
|
+
import { footerBlockCss, titleBlockCss } from '../styled';
|
|
4
6
|
const baseTopMetadata = [{
|
|
5
7
|
name: ElementName.ModifiedOn
|
|
6
8
|
}, {
|
|
@@ -134,4 +136,27 @@ export const getSimulatedMetadata = cardDetails => {
|
|
|
134
136
|
titleMetadata,
|
|
135
137
|
topMetadata
|
|
136
138
|
};
|
|
137
|
-
};
|
|
139
|
+
};
|
|
140
|
+
export const FlexibleCardUiOptions = {
|
|
141
|
+
hideElevation: true
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Due to the use of getBooleanFF(), this has to be a function.
|
|
145
|
+
// Make this a const object after ff cleanup.
|
|
146
|
+
export const getTitleBlockOptions = () => ({
|
|
147
|
+
anchorTarget: getBooleanFF('platform.linking-platform.smart-card.enable-block-card-clicks-opening-in-same-tab') ? '_self' : undefined,
|
|
148
|
+
position: SmartLinkPosition.Center,
|
|
149
|
+
overrideCss: titleBlockCss,
|
|
150
|
+
hideRetry: true,
|
|
151
|
+
size: getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? SmartLinkSize.Large : undefined
|
|
152
|
+
});
|
|
153
|
+
export const PreviewBlockOptions = {
|
|
154
|
+
placement: MediaPlacement.Right,
|
|
155
|
+
ignoreContainerPadding: true
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// Due to the use of getBooleanFF(), this has to be a function.
|
|
159
|
+
// Make this a const object after ff cleanup.
|
|
160
|
+
export const getFooterBlockOptions = () => ({
|
|
161
|
+
overrideCss: getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? footerBlockCss : undefined
|
|
162
|
+
});
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import Block from '../block';
|
|
6
|
-
import ElementGroup from '../element-group';
|
|
7
|
-
import { Provider } from '../../elements';
|
|
8
|
-
import ActionGroup from '../action-group';
|
|
9
|
-
import { filterActionItems } from '../utils';
|
|
10
|
-
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
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
|
-
};
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import FooterBlockResolvedView from './resolved';
|
|
4
|
+
import { SmartLinkStatus } from '../../../../../constants';
|
|
21
5
|
|
|
22
6
|
/**
|
|
23
7
|
* Represents a FooterBlock, designed to contain elements and actions that should appear
|
|
@@ -26,43 +10,16 @@ const getActionGroupStyles = size => {
|
|
|
26
10
|
* @param {FooterBlockProps} FooterBlockProps
|
|
27
11
|
* @see Block
|
|
28
12
|
*/
|
|
29
|
-
const FooterBlock =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
testId = 'smart-footer-block',
|
|
35
|
-
onActionMenuOpenChange
|
|
36
|
-
} = props;
|
|
37
|
-
const context = useFlexibleUiContext();
|
|
38
|
-
const hasActions = useMemo(() => {
|
|
39
|
-
var _filterActionItems;
|
|
40
|
-
return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
|
|
41
|
-
}, [actions, context]);
|
|
42
|
-
const onDropdownOpenChange = useCallback(isOpen => {
|
|
43
|
-
if (onActionMenuOpenChange) {
|
|
44
|
-
onActionMenuOpenChange({
|
|
45
|
-
isOpen
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}, [onActionMenuOpenChange]);
|
|
13
|
+
const FooterBlock = ({
|
|
14
|
+
status,
|
|
15
|
+
testId = 'smart-footer-block',
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
49
18
|
if (status !== SmartLinkStatus.Resolved) {
|
|
50
19
|
return null;
|
|
51
20
|
}
|
|
52
|
-
return /*#__PURE__*/React.createElement(
|
|
53
|
-
testId:
|
|
54
|
-
})
|
|
55
|
-
testId: `${testId}-provider`
|
|
56
|
-
}), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
|
|
57
|
-
testId: "smart-element-group-actions",
|
|
58
|
-
align: SmartLinkAlignment.Right,
|
|
59
|
-
direction: SmartLinkDirection.Horizontal,
|
|
60
|
-
overrideCss: getActionGroupStyles(size),
|
|
61
|
-
width: SmartLinkWidth.Flexible
|
|
62
|
-
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
63
|
-
onDropdownOpenChange: onDropdownOpenChange,
|
|
64
|
-
items: actions,
|
|
65
|
-
appearance: "default"
|
|
66
|
-
})) : null);
|
|
21
|
+
return /*#__PURE__*/React.createElement(FooterBlockResolvedView, _extends({}, props, {
|
|
22
|
+
testId: testId
|
|
23
|
+
}));
|
|
67
24
|
};
|
|
68
25
|
export default FooterBlock;
|