@atlaskit/smart-card 23.7.0 → 23.7.1
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 +6 -0
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/actions/flexible/AuthorizeAction.js +10 -3
- package/dist/cjs/view/BlockCard/components/flexible/footer/index.js +4 -2
- package/dist/cjs/view/BlockCard/components/flexible/footer/types.js +5 -0
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +31 -21
- package/dist/cjs/view/common/UnauthorisedViewContent.js +2 -2
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/actions/flexible/AuthorizeAction.js +9 -3
- package/dist/es2019/view/BlockCard/components/flexible/footer/index.js +3 -2
- package/dist/es2019/view/BlockCard/components/flexible/footer/types.js +1 -0
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +25 -17
- package/dist/es2019/view/common/UnauthorisedViewContent.js +2 -2
- package/dist/esm/messages.js +5 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/actions/flexible/AuthorizeAction.js +9 -3
- package/dist/esm/view/BlockCard/components/flexible/footer/index.js +4 -2
- package/dist/esm/view/BlockCard/components/flexible/footer/types.js +1 -0
- package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +26 -19
- package/dist/esm/view/common/UnauthorisedViewContent.js +2 -2
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/view/BlockCard/actions/flexible/AuthorizeAction.d.ts +3 -2
- package/dist/types/view/BlockCard/components/flexible/footer/index.d.ts +2 -2
- package/dist/types/view/BlockCard/components/flexible/footer/types.d.ts +5 -0
- package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 23.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`33e0b942925`](https://bitbucket.org/atlassian/atlassian-frontend/commits/33e0b942925) - [ux] Flexible Card: Update unauthorised view text messages and connect button
|
|
8
|
+
|
|
3
9
|
## 23.7.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/cjs/messages.js
CHANGED
|
@@ -88,6 +88,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
88
88
|
defaultMessage: 'Connect {context} to Atlassian to view more details from your work and collaboration from one place.',
|
|
89
89
|
description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
|
|
90
90
|
},
|
|
91
|
+
connect_unauthorised_account_description_no_provider: {
|
|
92
|
+
id: 'fabric.linking.connect_unauthorised_account_description',
|
|
93
|
+
defaultMessage: 'Connect to Atlassian to view more details from your work and collaboration from one place.',
|
|
94
|
+
description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
|
|
95
|
+
},
|
|
91
96
|
could_not_load_link: {
|
|
92
97
|
id: 'fabric.linking.couldnt_load_link',
|
|
93
98
|
defaultMessage: "We couldn't load this link for an unknown reason.",
|
package/dist/cjs/version.json
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.AuthorizeAction = void 0;
|
|
9
9
|
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
|
12
14
|
var _reactIntlNext = require("react-intl-next");
|
|
@@ -16,15 +18,20 @@ var _constants = require("../../../../constants");
|
|
|
16
18
|
var _messages = require("../../../../messages");
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
|
-
* Returns a CustomActionItem with a "Connect"
|
|
21
|
+
* Returns a CustomActionItem with a "Connect to <providerName>" message
|
|
20
22
|
*
|
|
21
23
|
* @see CustomActionItem
|
|
22
24
|
* @param onAuthorize a function that will be called on the click of the button
|
|
25
|
+
* @param providerName a string which is inserted into the message of the button
|
|
23
26
|
*/
|
|
24
|
-
var AuthorizeAction = function AuthorizeAction(onAuthorize) {
|
|
27
|
+
var AuthorizeAction = function AuthorizeAction(onAuthorize, providerName) {
|
|
25
28
|
return {
|
|
26
29
|
name: _constants.ActionName.CustomAction,
|
|
27
|
-
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.
|
|
30
|
+
content: providerName ? /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.connect_unauthorised_account_action, {
|
|
31
|
+
values: {
|
|
32
|
+
context: providerName
|
|
33
|
+
}
|
|
34
|
+
})) : /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.connect_link_account_card),
|
|
28
35
|
onClick: onAuthorize
|
|
29
36
|
};
|
|
30
37
|
};
|
|
@@ -47,7 +47,9 @@ var BlockCardFooter = function BlockCardFooter(props) {
|
|
|
47
47
|
_props$size = props.size,
|
|
48
48
|
size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size,
|
|
49
49
|
_props$testId = props.testId,
|
|
50
|
-
testId = _props$testId === void 0 ? 'smart-block-card-footer' : _props$testId
|
|
50
|
+
testId = _props$testId === void 0 ? 'smart-block-card-footer' : _props$testId,
|
|
51
|
+
_props$actionGroupApp = props.actionGroupAppearance,
|
|
52
|
+
actionGroupAppearance = _props$actionGroupApp === void 0 ? 'default' : _props$actionGroupApp;
|
|
51
53
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_elements.Provider, {
|
|
52
54
|
testId: "".concat(testId, "-provider"),
|
|
53
55
|
overrideCss: providerStyles
|
|
@@ -59,7 +61,7 @@ var BlockCardFooter = function BlockCardFooter(props) {
|
|
|
59
61
|
width: _constants.SmartLinkWidth.Flexible
|
|
60
62
|
}, /*#__PURE__*/_react.default.createElement(_actionGroup.default, {
|
|
61
63
|
items: actions,
|
|
62
|
-
appearance:
|
|
64
|
+
appearance: actionGroupAppearance
|
|
63
65
|
})) : null);
|
|
64
66
|
};
|
|
65
67
|
|
|
@@ -9,26 +9,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
12
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
14
16
|
var _FlexibleCard = _interopRequireDefault(require("../../../FlexibleCard"));
|
|
15
17
|
|
|
16
|
-
var _titleBlock = _interopRequireDefault(require("../../../FlexibleCard/components/blocks/title-block"));
|
|
17
|
-
|
|
18
|
-
var _messages = require("../../../../messages");
|
|
19
|
-
|
|
20
|
-
var _text = _interopRequireDefault(require("../../../FlexibleCard/components/elements/text"));
|
|
21
|
-
|
|
22
18
|
var _AuthorizeAction = require("../../actions/flexible/AuthorizeAction");
|
|
23
19
|
|
|
24
20
|
var _footer = _interopRequireDefault(require("../../components/flexible/footer"));
|
|
25
21
|
|
|
26
22
|
var _blocks = require("../../../FlexibleCard/components/blocks");
|
|
27
23
|
|
|
24
|
+
var _constants = require("../../../../constants");
|
|
25
|
+
|
|
26
|
+
var _extractors = require("@atlaskit/linking-common/extractors");
|
|
27
|
+
|
|
28
|
+
var _UnauthorisedViewContent = _interopRequireDefault(require("../../../common/UnauthorisedViewContent"));
|
|
29
|
+
|
|
30
|
+
var _react2 = require("@emotion/react");
|
|
31
|
+
|
|
32
|
+
var _token = require("../../../../utils/token");
|
|
33
|
+
|
|
34
|
+
var _templateObject;
|
|
35
|
+
|
|
28
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
37
|
|
|
30
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
39
|
|
|
40
|
+
var contentStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])), _token.tokens.text);
|
|
32
41
|
/**
|
|
33
42
|
* This view represents a Block card that has an 'Unauthorized' status .
|
|
34
43
|
* It should have a "Connect" button that will allow a user to connect their account and view the block card.
|
|
@@ -36,10 +45,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
36
45
|
* @see SmartLinkStatus
|
|
37
46
|
* @see FlexibleCardProps
|
|
38
47
|
*/
|
|
48
|
+
|
|
39
49
|
var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
|
|
50
|
+
var _cardState$details, _extractProvider;
|
|
51
|
+
|
|
40
52
|
var cardState = _ref.cardState,
|
|
41
|
-
_ref$providerName = _ref.providerName,
|
|
42
|
-
providerName = _ref$providerName === void 0 ? '' : _ref$providerName,
|
|
43
53
|
onAuthorize = _ref.onAuthorize,
|
|
44
54
|
onClick = _ref.onClick,
|
|
45
55
|
onError = _ref.onError,
|
|
@@ -47,10 +57,11 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
|
|
|
47
57
|
testId = _ref$testId === void 0 ? 'smart-block-unauthorized-view' : _ref$testId,
|
|
48
58
|
ui = _ref.ui,
|
|
49
59
|
url = _ref.url;
|
|
50
|
-
var
|
|
60
|
+
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
61
|
+
var providerName = (_extractProvider = (0, _extractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
51
62
|
var actions = (0, _react.useMemo)(function () {
|
|
52
|
-
return onAuthorize ? [(0, _AuthorizeAction.AuthorizeAction)(onAuthorize)] : [];
|
|
53
|
-
}, [onAuthorize]);
|
|
63
|
+
return onAuthorize ? [(0, _AuthorizeAction.AuthorizeAction)(onAuthorize, providerName)] : [];
|
|
64
|
+
}, [onAuthorize, providerName]);
|
|
54
65
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
|
|
55
66
|
appearance: "block",
|
|
56
67
|
cardState: cardState,
|
|
@@ -60,18 +71,17 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
|
|
|
60
71
|
testId: testId,
|
|
61
72
|
ui: ui,
|
|
62
73
|
url: url
|
|
63
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, {
|
|
64
75
|
hideRetry: true
|
|
65
|
-
}), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
})), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, null, /*#__PURE__*/_react.default.createElement(_footer.default, {
|
|
76
|
+
}), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, {
|
|
77
|
+
overrideCss: contentStyles,
|
|
78
|
+
testId: "".concat(testId, "-content")
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
|
|
80
|
+
providerName: providerName
|
|
81
|
+
}))), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, null, /*#__PURE__*/_react.default.createElement(_footer.default, {
|
|
73
82
|
actions: actions,
|
|
74
|
-
status:
|
|
83
|
+
status: _constants.SmartLinkStatus.Unauthorized,
|
|
84
|
+
actionGroupAppearance: "primary"
|
|
75
85
|
})));
|
|
76
86
|
};
|
|
77
87
|
|
|
@@ -25,11 +25,11 @@ var UnauthorisedViewContent = function UnauthorisedViewContent(_ref) {
|
|
|
25
25
|
var providerName = _ref.providerName,
|
|
26
26
|
_ref$testId = _ref.testId,
|
|
27
27
|
testId = _ref$testId === void 0 ? 'unauthorised-view-content' : _ref$testId;
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.connect_unauthorised_account_description, {
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, providerName ? /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.connect_unauthorised_account_description, {
|
|
29
29
|
values: {
|
|
30
30
|
context: providerName
|
|
31
31
|
}
|
|
32
|
-
})), ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
32
|
+
})) : /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.connect_unauthorised_account_description_no_provider), ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
33
33
|
href: _constants.CONTENT_URL_SECURITY_AND_PERMISSIONS,
|
|
34
34
|
target: "_blank",
|
|
35
35
|
"data-testid": "".concat(testId, "-learn-more")
|
package/dist/es2019/messages.js
CHANGED
|
@@ -80,6 +80,11 @@ export const messages = defineMessages({
|
|
|
80
80
|
defaultMessage: 'Connect {context} to Atlassian to view more details from your work and collaboration from one place.',
|
|
81
81
|
description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
|
|
82
82
|
},
|
|
83
|
+
connect_unauthorised_account_description_no_provider: {
|
|
84
|
+
id: 'fabric.linking.connect_unauthorised_account_description',
|
|
85
|
+
defaultMessage: 'Connect to Atlassian to view more details from your work and collaboration from one place.',
|
|
86
|
+
description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
|
|
87
|
+
},
|
|
83
88
|
could_not_load_link: {
|
|
84
89
|
id: 'fabric.linking.couldnt_load_link',
|
|
85
90
|
defaultMessage: "We couldn't load this link for an unknown reason.",
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
3
4
|
import { ActionName } from '../../../../constants';
|
|
4
5
|
import { messages } from '../../../../messages';
|
|
5
6
|
/**
|
|
6
|
-
* Returns a CustomActionItem with a "Connect"
|
|
7
|
+
* Returns a CustomActionItem with a "Connect to <providerName>" message
|
|
7
8
|
*
|
|
8
9
|
* @see CustomActionItem
|
|
9
10
|
* @param onAuthorize a function that will be called on the click of the button
|
|
11
|
+
* @param providerName a string which is inserted into the message of the button
|
|
10
12
|
*/
|
|
11
13
|
|
|
12
|
-
export const AuthorizeAction = onAuthorize => ({
|
|
14
|
+
export const AuthorizeAction = (onAuthorize, providerName) => ({
|
|
13
15
|
name: ActionName.CustomAction,
|
|
14
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.
|
|
16
|
+
content: providerName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
|
|
17
|
+
values: {
|
|
18
|
+
context: providerName
|
|
19
|
+
}
|
|
20
|
+
})) : /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_link_account_card),
|
|
15
21
|
onClick: onAuthorize
|
|
16
22
|
});
|
|
@@ -34,7 +34,8 @@ const BlockCardFooter = props => {
|
|
|
34
34
|
const {
|
|
35
35
|
actions,
|
|
36
36
|
size = SmartLinkSize.Medium,
|
|
37
|
-
testId = 'smart-block-card-footer'
|
|
37
|
+
testId = 'smart-block-card-footer',
|
|
38
|
+
actionGroupAppearance = 'default'
|
|
38
39
|
} = props;
|
|
39
40
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Provider, {
|
|
40
41
|
testId: `${testId}-provider`,
|
|
@@ -47,7 +48,7 @@ const BlockCardFooter = props => {
|
|
|
47
48
|
width: SmartLinkWidth.Flexible
|
|
48
49
|
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
49
50
|
items: actions,
|
|
50
|
-
appearance:
|
|
51
|
+
appearance: actionGroupAppearance
|
|
51
52
|
})) : null);
|
|
52
53
|
};
|
|
53
54
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import FlexibleCard from '../../../FlexibleCard';
|
|
3
|
-
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
4
|
-
import { messages } from '../../../../messages';
|
|
5
|
-
import Text from '../../../FlexibleCard/components/elements/text';
|
|
6
3
|
import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
|
|
7
4
|
import BlockCardFooter from '../../components/flexible/footer';
|
|
8
|
-
import { CustomBlock } from '../../../FlexibleCard/components/blocks';
|
|
9
|
-
|
|
5
|
+
import { CustomBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
|
|
6
|
+
import { SmartLinkStatus } from '../../../../constants';
|
|
7
|
+
import { extractProvider } from '@atlaskit/linking-common/extractors';
|
|
8
|
+
import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { tokens } from '../../../../utils/token';
|
|
11
|
+
const contentStyles = css`
|
|
12
|
+
color: ${tokens.text};
|
|
13
|
+
margin-top: 0.5rem;
|
|
14
|
+
font-size: 0.75rem;
|
|
15
|
+
`;
|
|
10
16
|
/**
|
|
11
17
|
* This view represents a Block card that has an 'Unauthorized' status .
|
|
12
18
|
* It should have a "Connect" button that will allow a user to connect their account and view the block card.
|
|
@@ -14,9 +20,9 @@ import { CustomBlock } from '../../../FlexibleCard/components/blocks';
|
|
|
14
20
|
* @see SmartLinkStatus
|
|
15
21
|
* @see FlexibleCardProps
|
|
16
22
|
*/
|
|
23
|
+
|
|
17
24
|
const FlexibleUnauthorisedView = ({
|
|
18
25
|
cardState,
|
|
19
|
-
providerName = '',
|
|
20
26
|
onAuthorize,
|
|
21
27
|
onClick,
|
|
22
28
|
onError,
|
|
@@ -24,8 +30,11 @@ const FlexibleUnauthorisedView = ({
|
|
|
24
30
|
ui,
|
|
25
31
|
url
|
|
26
32
|
}) => {
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
var _cardState$details, _extractProvider;
|
|
34
|
+
|
|
35
|
+
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
36
|
+
const providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
37
|
+
const actions = useMemo(() => onAuthorize ? [AuthorizeAction(onAuthorize, providerName)] : [], [onAuthorize, providerName]);
|
|
29
38
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
30
39
|
appearance: "block",
|
|
31
40
|
cardState: cardState,
|
|
@@ -37,16 +46,15 @@ const FlexibleUnauthorisedView = ({
|
|
|
37
46
|
url: url
|
|
38
47
|
}, /*#__PURE__*/React.createElement(TitleBlock, {
|
|
39
48
|
hideRetry: true
|
|
40
|
-
}), /*#__PURE__*/React.createElement(CustomBlock,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
})), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
49
|
+
}), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
50
|
+
overrideCss: contentStyles,
|
|
51
|
+
testId: `${testId}-content`
|
|
52
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
53
|
+
providerName: providerName
|
|
54
|
+
}))), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
48
55
|
actions: actions,
|
|
49
|
-
status:
|
|
56
|
+
status: SmartLinkStatus.Unauthorized,
|
|
57
|
+
actionGroupAppearance: "primary"
|
|
50
58
|
})));
|
|
51
59
|
};
|
|
52
60
|
|
|
@@ -11,11 +11,11 @@ import { CONTENT_URL_SECURITY_AND_PERMISSIONS } from '../../constants';
|
|
|
11
11
|
const UnauthorisedViewContent = ({
|
|
12
12
|
providerName,
|
|
13
13
|
testId = 'unauthorised-view-content'
|
|
14
|
-
}) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_description, {
|
|
14
|
+
}) => /*#__PURE__*/React.createElement(React.Fragment, null, providerName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_description, {
|
|
15
15
|
values: {
|
|
16
16
|
context: providerName
|
|
17
17
|
}
|
|
18
|
-
})), ' ', /*#__PURE__*/React.createElement("a", {
|
|
18
|
+
})) : /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_unauthorised_account_description_no_provider), ' ', /*#__PURE__*/React.createElement("a", {
|
|
19
19
|
href: CONTENT_URL_SECURITY_AND_PERMISSIONS,
|
|
20
20
|
target: "_blank",
|
|
21
21
|
"data-testid": `${testId}-learn-more`
|
package/dist/esm/messages.js
CHANGED
|
@@ -80,6 +80,11 @@ export var messages = defineMessages({
|
|
|
80
80
|
defaultMessage: 'Connect {context} to Atlassian to view more details from your work and collaboration from one place.',
|
|
81
81
|
description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
|
|
82
82
|
},
|
|
83
|
+
connect_unauthorised_account_description_no_provider: {
|
|
84
|
+
id: 'fabric.linking.connect_unauthorised_account_description',
|
|
85
|
+
defaultMessage: 'Connect to Atlassian to view more details from your work and collaboration from one place.',
|
|
86
|
+
description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
|
|
87
|
+
},
|
|
83
88
|
could_not_load_link: {
|
|
84
89
|
id: 'fabric.linking.couldnt_load_link',
|
|
85
90
|
defaultMessage: "We couldn't load this link for an unknown reason.",
|
package/dist/esm/version.json
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
3
4
|
import { ActionName } from '../../../../constants';
|
|
4
5
|
import { messages } from '../../../../messages';
|
|
5
6
|
/**
|
|
6
|
-
* Returns a CustomActionItem with a "Connect"
|
|
7
|
+
* Returns a CustomActionItem with a "Connect to <providerName>" message
|
|
7
8
|
*
|
|
8
9
|
* @see CustomActionItem
|
|
9
10
|
* @param onAuthorize a function that will be called on the click of the button
|
|
11
|
+
* @param providerName a string which is inserted into the message of the button
|
|
10
12
|
*/
|
|
11
13
|
|
|
12
|
-
export var AuthorizeAction = function AuthorizeAction(onAuthorize) {
|
|
14
|
+
export var AuthorizeAction = function AuthorizeAction(onAuthorize, providerName) {
|
|
13
15
|
return {
|
|
14
16
|
name: ActionName.CustomAction,
|
|
15
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.
|
|
17
|
+
content: providerName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
|
|
18
|
+
values: {
|
|
19
|
+
context: providerName
|
|
20
|
+
}
|
|
21
|
+
})) : /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_link_account_card),
|
|
16
22
|
onClick: onAuthorize
|
|
17
23
|
};
|
|
18
24
|
};
|
|
@@ -33,7 +33,9 @@ var BlockCardFooter = function BlockCardFooter(props) {
|
|
|
33
33
|
_props$size = props.size,
|
|
34
34
|
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
|
|
35
35
|
_props$testId = props.testId,
|
|
36
|
-
testId = _props$testId === void 0 ? 'smart-block-card-footer' : _props$testId
|
|
36
|
+
testId = _props$testId === void 0 ? 'smart-block-card-footer' : _props$testId,
|
|
37
|
+
_props$actionGroupApp = props.actionGroupAppearance,
|
|
38
|
+
actionGroupAppearance = _props$actionGroupApp === void 0 ? 'default' : _props$actionGroupApp;
|
|
37
39
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Provider, {
|
|
38
40
|
testId: "".concat(testId, "-provider"),
|
|
39
41
|
overrideCss: providerStyles
|
|
@@ -45,7 +47,7 @@ var BlockCardFooter = function BlockCardFooter(props) {
|
|
|
45
47
|
width: SmartLinkWidth.Flexible
|
|
46
48
|
}, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
47
49
|
items: actions,
|
|
48
|
-
appearance:
|
|
50
|
+
appearance: actionGroupAppearance
|
|
49
51
|
})) : null);
|
|
50
52
|
};
|
|
51
53
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
1
5
|
import React, { useMemo } from 'react';
|
|
2
6
|
import FlexibleCard from '../../../FlexibleCard';
|
|
3
|
-
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
4
|
-
import { messages } from '../../../../messages';
|
|
5
|
-
import Text from '../../../FlexibleCard/components/elements/text';
|
|
6
7
|
import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
|
|
7
8
|
import BlockCardFooter from '../../components/flexible/footer';
|
|
8
|
-
import { CustomBlock } from '../../../FlexibleCard/components/blocks';
|
|
9
|
-
|
|
9
|
+
import { CustomBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
|
|
10
|
+
import { SmartLinkStatus } from '../../../../constants';
|
|
11
|
+
import { extractProvider } from '@atlaskit/linking-common/extractors';
|
|
12
|
+
import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
|
|
13
|
+
import { css } from '@emotion/react';
|
|
14
|
+
import { tokens } from '../../../../utils/token';
|
|
15
|
+
var contentStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])), tokens.text);
|
|
10
16
|
/**
|
|
11
17
|
* This view represents a Block card that has an 'Unauthorized' status .
|
|
12
18
|
* It should have a "Connect" button that will allow a user to connect their account and view the block card.
|
|
@@ -14,10 +20,11 @@ import { CustomBlock } from '../../../FlexibleCard/components/blocks';
|
|
|
14
20
|
* @see SmartLinkStatus
|
|
15
21
|
* @see FlexibleCardProps
|
|
16
22
|
*/
|
|
23
|
+
|
|
17
24
|
var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
|
|
25
|
+
var _cardState$details, _extractProvider;
|
|
26
|
+
|
|
18
27
|
var cardState = _ref.cardState,
|
|
19
|
-
_ref$providerName = _ref.providerName,
|
|
20
|
-
providerName = _ref$providerName === void 0 ? '' : _ref$providerName,
|
|
21
28
|
onAuthorize = _ref.onAuthorize,
|
|
22
29
|
onClick = _ref.onClick,
|
|
23
30
|
onError = _ref.onError,
|
|
@@ -25,10 +32,11 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
|
|
|
25
32
|
testId = _ref$testId === void 0 ? 'smart-block-unauthorized-view' : _ref$testId,
|
|
26
33
|
ui = _ref.ui,
|
|
27
34
|
url = _ref.url;
|
|
28
|
-
var
|
|
35
|
+
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
36
|
+
var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
29
37
|
var actions = useMemo(function () {
|
|
30
|
-
return onAuthorize ? [AuthorizeAction(onAuthorize)] : [];
|
|
31
|
-
}, [onAuthorize]);
|
|
38
|
+
return onAuthorize ? [AuthorizeAction(onAuthorize, providerName)] : [];
|
|
39
|
+
}, [onAuthorize, providerName]);
|
|
32
40
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
33
41
|
appearance: "block",
|
|
34
42
|
cardState: cardState,
|
|
@@ -40,16 +48,15 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
|
|
|
40
48
|
url: url
|
|
41
49
|
}, /*#__PURE__*/React.createElement(TitleBlock, {
|
|
42
50
|
hideRetry: true
|
|
43
|
-
}), /*#__PURE__*/React.createElement(CustomBlock,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
})), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
51
|
+
}), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
52
|
+
overrideCss: contentStyles,
|
|
53
|
+
testId: "".concat(testId, "-content")
|
|
54
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
55
|
+
providerName: providerName
|
|
56
|
+
}))), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
51
57
|
actions: actions,
|
|
52
|
-
status:
|
|
58
|
+
status: SmartLinkStatus.Unauthorized,
|
|
59
|
+
actionGroupAppearance: "primary"
|
|
53
60
|
})));
|
|
54
61
|
};
|
|
55
62
|
|
|
@@ -12,11 +12,11 @@ var UnauthorisedViewContent = function UnauthorisedViewContent(_ref) {
|
|
|
12
12
|
var providerName = _ref.providerName,
|
|
13
13
|
_ref$testId = _ref.testId,
|
|
14
14
|
testId = _ref$testId === void 0 ? 'unauthorised-view-content' : _ref$testId;
|
|
15
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_description, {
|
|
15
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, providerName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_description, {
|
|
16
16
|
values: {
|
|
17
17
|
context: providerName
|
|
18
18
|
}
|
|
19
|
-
})), ' ', /*#__PURE__*/React.createElement("a", {
|
|
19
|
+
})) : /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_unauthorised_account_description_no_provider), ' ', /*#__PURE__*/React.createElement("a", {
|
|
20
20
|
href: CONTENT_URL_SECURITY_AND_PERMISSIONS,
|
|
21
21
|
target: "_blank",
|
|
22
22
|
"data-testid": "".concat(testId, "-learn-more")
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MessageDescriptor } from 'react-intl-next';
|
|
2
2
|
export declare type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
|
|
3
|
-
export declare type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'could_not_load_link' | 'download' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'delete' | 'edit' | 'learn_more_about_smart_links_security' | 'loading' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_link_in_a_new_tab' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'try_again' | 'try_another_account' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
|
|
3
|
+
export declare type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'could_not_load_link' | 'download' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'delete' | 'edit' | 'learn_more_about_smart_links_security' | 'loading' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_link_in_a_new_tab' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'try_again' | 'try_another_account' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
|
|
4
4
|
declare type Messages = {
|
|
5
5
|
[K in MessageKey]: MessageDescriptor;
|
|
6
6
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CustomActionItem } from '../../../FlexibleCard/components/blocks/types';
|
|
2
2
|
/**
|
|
3
|
-
* Returns a CustomActionItem with a "Connect"
|
|
3
|
+
* Returns a CustomActionItem with a "Connect to <providerName>" message
|
|
4
4
|
*
|
|
5
5
|
* @see CustomActionItem
|
|
6
6
|
* @param onAuthorize a function that will be called on the click of the button
|
|
7
|
+
* @param providerName a string which is inserted into the message of the button
|
|
7
8
|
*/
|
|
8
|
-
export declare const AuthorizeAction: (onAuthorize: () => void) => CustomActionItem;
|
|
9
|
+
export declare const AuthorizeAction: (onAuthorize: () => void, providerName?: string | undefined) => CustomActionItem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BlockCardFooterProps } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* This Components is a footer that is used in a Block Card with Flexible UI.
|
|
5
5
|
* It contains a provider icon if provider is present and an actions list if one is passed.
|
|
@@ -8,5 +8,5 @@ import { FooterBlockProps } from '../../../../FlexibleCard/components/blocks/foo
|
|
|
8
8
|
* @see CustomBlock
|
|
9
9
|
* @param props are the data required for the block, such as actions to be displayed.
|
|
10
10
|
*/
|
|
11
|
-
declare const BlockCardFooter: React.FC<
|
|
11
|
+
declare const BlockCardFooter: React.FC<BlockCardFooterProps>;
|
|
12
12
|
export default BlockCardFooter;
|
|
@@ -7,5 +7,5 @@ import { FlexibleBlockCardProps } from './types';
|
|
|
7
7
|
* @see SmartLinkStatus
|
|
8
8
|
* @see FlexibleCardProps
|
|
9
9
|
*/
|
|
10
|
-
declare const FlexibleUnauthorisedView: ({ cardState,
|
|
10
|
+
declare const FlexibleUnauthorisedView: ({ cardState, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
|
|
11
11
|
export default FlexibleUnauthorisedView;
|
|
@@ -56,7 +56,7 @@ export declare type TitleBlockProps = {
|
|
|
56
56
|
*/
|
|
57
57
|
retry?: RetryOptions;
|
|
58
58
|
/**
|
|
59
|
-
* This option
|
|
59
|
+
* This option determines whenever we show any of the links and messages on the right side of the block,
|
|
60
60
|
* like "connect to preview" or "Can't find link" or "Restricted link, try another account" etc.
|
|
61
61
|
* Default is false.
|
|
62
62
|
*/
|