@atlaskit/smart-card 26.53.0 → 26.54.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 +6 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +0 -3
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +1 -10
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +2 -10
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -10
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +4 -6
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +0 -3
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +1 -10
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +2 -10
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -10
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +4 -6
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +0 -3
- package/dist/esm/view/FlexibleCard/components/actions/index.js +1 -10
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +2 -10
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -10
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +4 -6
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +0 -8
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +7 -1
- package/dist/types-ts4.5/constants.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +0 -8
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +7 -1
- package/package.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +0 -72
- package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/types.js +0 -5
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +0 -64
- package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +0 -47
- package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/types.js +0 -1
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +0 -55
- package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +0 -65
- package/dist/esm/view/FlexibleCard/components/actions/action/view-action/types.js +0 -1
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +0 -54
- package/dist/types/view/FlexibleCard/components/actions/action/view-action/index.d.ts +0 -4
- package/dist/types/view/FlexibleCard/components/actions/action/view-action/types.d.ts +0 -5
- package/dist/types/view/FlexibleCard/components/actions/utils.d.ts +0 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/view-action/index.d.ts +0 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/view-action/types.d.ts +0 -5
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/utils.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.54.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#88849](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88849) [`45f940ac839e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/45f940ac839e) - [ux] Deprecate ActionName.ViewAction for FlexibleCard and remove usage except for public API
|
|
8
|
+
|
|
3
9
|
## 26.53.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
22
22
|
var context = exports.context = {
|
|
23
23
|
componentName: 'smart-cards',
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "26.
|
|
25
|
+
packageVersion: "26.54.0"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -50,9 +50,6 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
50
50
|
}, {
|
|
51
51
|
name: _constants.ActionName.PreviewAction,
|
|
52
52
|
hideIcon: true
|
|
53
|
-
}, {
|
|
54
|
-
name: _constants.ActionName.ViewAction,
|
|
55
|
-
hideIcon: true
|
|
56
53
|
}, {
|
|
57
54
|
name: _constants.ActionName.DownloadAction,
|
|
58
55
|
hideIcon: true
|
|
@@ -40,18 +40,9 @@ Object.defineProperty(exports, "PreviewAction", {
|
|
|
40
40
|
return _previewAction.default;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
exports.ViewAction = void 0;
|
|
44
|
-
var _constants = require("../../../../constants");
|
|
45
|
-
var _utils = require("./utils");
|
|
46
43
|
var _action = _interopRequireDefault(require("./action"));
|
|
47
44
|
var _deleteAction = _interopRequireDefault(require("./delete-action"));
|
|
48
45
|
var _editAction = _interopRequireDefault(require("./edit-action"));
|
|
49
46
|
var _downloadAction = _interopRequireDefault(require("./download-action"));
|
|
50
47
|
var _followAction = _interopRequireDefault(require("./follow-action"));
|
|
51
|
-
var _previewAction = _interopRequireDefault(require("./preview-action"));
|
|
52
|
-
/**
|
|
53
|
-
* Creates a ViewAction component. Accepts default ViewActionProps, and defaults
|
|
54
|
-
* to the text 'View' inside the button.
|
|
55
|
-
* @see Action
|
|
56
|
-
*/
|
|
57
|
-
var ViewAction = exports.ViewAction = (0, _utils.createDataAction)(_constants.ActionName.ViewAction);
|
|
48
|
+
var _previewAction = _interopRequireDefault(require("./preview-action"));
|
|
@@ -39,7 +39,7 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
39
39
|
arr.sort(sort);
|
|
40
40
|
}
|
|
41
41
|
return arr.map(function (name) {
|
|
42
|
-
var Action = Actions[name];
|
|
42
|
+
var Action = name in Actions ? Actions[name] : undefined;
|
|
43
43
|
return Action ? /*#__PURE__*/_react.default.createElement(Action, {
|
|
44
44
|
as: "stack-item",
|
|
45
45
|
spaceInline: spaceInline,
|
|
@@ -47,15 +47,7 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
47
47
|
onClick: function onClick() {
|
|
48
48
|
return onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(name);
|
|
49
49
|
},
|
|
50
|
-
size: size
|
|
51
|
-
// Remove url once ViewAction is retired.
|
|
52
|
-
// This seems to be a typescript workaround
|
|
53
|
-
// because ViewAction marks it as required,
|
|
54
|
-
// which does not reflect actual implementation as the url
|
|
55
|
-
// came from data context and not all actions require url.
|
|
56
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
57
|
-
,
|
|
58
|
-
url: "",
|
|
50
|
+
size: size,
|
|
59
51
|
xcss: (0, _primitives.xcss)({
|
|
60
52
|
paddingInline: padding
|
|
61
53
|
})
|
package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var ActionGroupItem = function ActionGroupItem(_ref) {
|
|
|
38
38
|
onClick();
|
|
39
39
|
}
|
|
40
40
|
}, [onActionItemClick, onClick]);
|
|
41
|
-
var Action = Actions[name];
|
|
41
|
+
var Action = name in Actions ? Actions[name] : undefined;
|
|
42
42
|
if (!Action) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
@@ -49,15 +49,7 @@ var ActionGroupItem = function ActionGroupItem(_ref) {
|
|
|
49
49
|
if (hideIcon) {
|
|
50
50
|
actionProps.icon = undefined;
|
|
51
51
|
}
|
|
52
|
-
return (0, _react.jsx)(Action
|
|
53
|
-
// Remove url once ViewAction is retired.
|
|
54
|
-
// This seems to be a typescript workaround
|
|
55
|
-
// because ViewAction marks it as required,
|
|
56
|
-
// which does not reflect actual implementation as the url
|
|
57
|
-
// came from data context and not all actions require url.
|
|
58
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
59
|
-
, (0, _extends2.default)({
|
|
60
|
-
url: "",
|
|
52
|
+
return (0, _react.jsx)(Action, (0, _extends2.default)({
|
|
61
53
|
asDropDownItem: asDropDownItems,
|
|
62
54
|
size: size,
|
|
63
55
|
appearance: appearance,
|
|
@@ -107,20 +107,18 @@ var filterActionItems = exports.filterActionItems = function filterActionItems()
|
|
|
107
107
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
108
108
|
var context = arguments.length > 1 ? arguments[1] : undefined;
|
|
109
109
|
return items.filter(function (item) {
|
|
110
|
-
var _context$actions;
|
|
111
110
|
switch (item.name) {
|
|
112
111
|
case _constants.ActionName.DeleteAction:
|
|
113
112
|
case _constants.ActionName.EditAction:
|
|
114
113
|
case _constants.ActionName.CustomAction:
|
|
115
114
|
// Named and custom actions that user defines.
|
|
116
115
|
return Boolean(_constants.ActionName[item.name]);
|
|
117
|
-
// Remove once ViewAction is retired
|
|
118
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
119
|
-
case _constants.ActionName.ViewAction:
|
|
120
|
-
return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
|
|
121
116
|
default:
|
|
122
117
|
// Action that require data from the data context to render.
|
|
123
|
-
|
|
118
|
+
if ((context === null || context === void 0 ? void 0 : context.actions) === undefined) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return Boolean(item.name in context.actions ? context.actions[item.name] : undefined);
|
|
124
122
|
}
|
|
125
123
|
});
|
|
126
124
|
};
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "26.
|
|
20
|
+
packageVersion: "26.54.0",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.
|
|
7
|
+
packageVersion: "26.54.0"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { ActionName } from '../../../../constants';
|
|
2
|
-
import { createDataAction } from './utils';
|
|
3
1
|
export { default as CustomAction } from './action';
|
|
4
2
|
export { default as DeleteAction } from './delete-action';
|
|
5
3
|
export { default as EditAction } from './edit-action';
|
|
6
4
|
export { default as DownloadAction } from './download-action';
|
|
7
5
|
export { default as FollowAction } from './follow-action';
|
|
8
|
-
export { default as PreviewAction } from './preview-action';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Creates a ViewAction component. Accepts default ViewActionProps, and defaults
|
|
12
|
-
* to the text 'View' inside the button.
|
|
13
|
-
* @see Action
|
|
14
|
-
*/
|
|
15
|
-
export const ViewAction = createDataAction(ActionName.ViewAction);
|
|
6
|
+
export { default as PreviewAction } from './preview-action';
|
|
@@ -30,21 +30,13 @@ const ActionBlock = ({
|
|
|
30
30
|
arr.sort(sort);
|
|
31
31
|
}
|
|
32
32
|
return arr.map(name => {
|
|
33
|
-
const Action = Actions[name];
|
|
33
|
+
const Action = name in Actions ? Actions[name] : undefined;
|
|
34
34
|
return Action ? /*#__PURE__*/React.createElement(Action, {
|
|
35
35
|
as: "stack-item",
|
|
36
36
|
spaceInline: spaceInline,
|
|
37
37
|
key: name,
|
|
38
38
|
onClick: () => onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(name),
|
|
39
|
-
size: size
|
|
40
|
-
// Remove url once ViewAction is retired.
|
|
41
|
-
// This seems to be a typescript workaround
|
|
42
|
-
// because ViewAction marks it as required,
|
|
43
|
-
// which does not reflect actual implementation as the url
|
|
44
|
-
// came from data context and not all actions require url.
|
|
45
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
46
|
-
,
|
|
47
|
-
url: "",
|
|
39
|
+
size: size,
|
|
48
40
|
xcss: xcss({
|
|
49
41
|
paddingInline: padding
|
|
50
42
|
})
|
package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js
CHANGED
|
@@ -26,7 +26,7 @@ const ActionGroupItem = ({
|
|
|
26
26
|
onClick();
|
|
27
27
|
}
|
|
28
28
|
}, [onActionItemClick, onClick]);
|
|
29
|
-
const Action = Actions[name];
|
|
29
|
+
const Action = name in Actions ? Actions[name] : undefined;
|
|
30
30
|
if (!Action) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
@@ -39,15 +39,7 @@ const ActionGroupItem = ({
|
|
|
39
39
|
if (hideIcon) {
|
|
40
40
|
actionProps.icon = undefined;
|
|
41
41
|
}
|
|
42
|
-
return jsx(Action
|
|
43
|
-
// Remove url once ViewAction is retired.
|
|
44
|
-
// This seems to be a typescript workaround
|
|
45
|
-
// because ViewAction marks it as required,
|
|
46
|
-
// which does not reflect actual implementation as the url
|
|
47
|
-
// came from data context and not all actions require url.
|
|
48
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
49
|
-
, _extends({
|
|
50
|
-
url: "",
|
|
42
|
+
return jsx(Action, _extends({
|
|
51
43
|
asDropDownItem: asDropDownItems,
|
|
52
44
|
size: size,
|
|
53
45
|
appearance: appearance,
|
|
@@ -129,20 +129,18 @@ export const getActionGroupStyles = size => {
|
|
|
129
129
|
};
|
|
130
130
|
export const filterActionItems = (items = [], context) => {
|
|
131
131
|
return items.filter(item => {
|
|
132
|
-
var _context$actions;
|
|
133
132
|
switch (item.name) {
|
|
134
133
|
case ActionName.DeleteAction:
|
|
135
134
|
case ActionName.EditAction:
|
|
136
135
|
case ActionName.CustomAction:
|
|
137
136
|
// Named and custom actions that user defines.
|
|
138
137
|
return Boolean(ActionName[item.name]);
|
|
139
|
-
// Remove once ViewAction is retired
|
|
140
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
141
|
-
case ActionName.ViewAction:
|
|
142
|
-
return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
|
|
143
138
|
default:
|
|
144
139
|
// Action that require data from the data context to render.
|
|
145
|
-
|
|
140
|
+
if ((context === null || context === void 0 ? void 0 : context.actions) === undefined) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
return Boolean(item.name in context.actions ? context.actions[item.name] : undefined);
|
|
146
144
|
}
|
|
147
145
|
});
|
|
148
146
|
};
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "26.
|
|
10
|
+
packageVersion: "26.54.0",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
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.54.0"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { ActionName } from '../../../../constants';
|
|
2
|
-
import { createDataAction } from './utils';
|
|
3
1
|
export { default as CustomAction } from './action';
|
|
4
2
|
export { default as DeleteAction } from './delete-action';
|
|
5
3
|
export { default as EditAction } from './edit-action';
|
|
6
4
|
export { default as DownloadAction } from './download-action';
|
|
7
5
|
export { default as FollowAction } from './follow-action';
|
|
8
|
-
export { default as PreviewAction } from './preview-action';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Creates a ViewAction component. Accepts default ViewActionProps, and defaults
|
|
12
|
-
* to the text 'View' inside the button.
|
|
13
|
-
* @see Action
|
|
14
|
-
*/
|
|
15
|
-
export var ViewAction = createDataAction(ActionName.ViewAction);
|
|
6
|
+
export { default as PreviewAction } from './preview-action';
|
|
@@ -30,7 +30,7 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
30
30
|
arr.sort(sort);
|
|
31
31
|
}
|
|
32
32
|
return arr.map(function (name) {
|
|
33
|
-
var Action = Actions[name];
|
|
33
|
+
var Action = name in Actions ? Actions[name] : undefined;
|
|
34
34
|
return Action ? /*#__PURE__*/React.createElement(Action, {
|
|
35
35
|
as: "stack-item",
|
|
36
36
|
spaceInline: spaceInline,
|
|
@@ -38,15 +38,7 @@ var ActionBlock = function ActionBlock(_ref) {
|
|
|
38
38
|
onClick: function onClick() {
|
|
39
39
|
return onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(name);
|
|
40
40
|
},
|
|
41
|
-
size: size
|
|
42
|
-
// Remove url once ViewAction is retired.
|
|
43
|
-
// This seems to be a typescript workaround
|
|
44
|
-
// because ViewAction marks it as required,
|
|
45
|
-
// which does not reflect actual implementation as the url
|
|
46
|
-
// came from data context and not all actions require url.
|
|
47
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
48
|
-
,
|
|
49
|
-
url: "",
|
|
41
|
+
size: size,
|
|
50
42
|
xcss: xcss({
|
|
51
43
|
paddingInline: padding
|
|
52
44
|
})
|
package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var ActionGroupItem = function ActionGroupItem(_ref) {
|
|
|
28
28
|
onClick();
|
|
29
29
|
}
|
|
30
30
|
}, [onActionItemClick, onClick]);
|
|
31
|
-
var Action = Actions[name];
|
|
31
|
+
var Action = name in Actions ? Actions[name] : undefined;
|
|
32
32
|
if (!Action) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
@@ -39,15 +39,7 @@ var ActionGroupItem = function ActionGroupItem(_ref) {
|
|
|
39
39
|
if (hideIcon) {
|
|
40
40
|
actionProps.icon = undefined;
|
|
41
41
|
}
|
|
42
|
-
return jsx(Action
|
|
43
|
-
// Remove url once ViewAction is retired.
|
|
44
|
-
// This seems to be a typescript workaround
|
|
45
|
-
// because ViewAction marks it as required,
|
|
46
|
-
// which does not reflect actual implementation as the url
|
|
47
|
-
// came from data context and not all actions require url.
|
|
48
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
49
|
-
, _extends({
|
|
50
|
-
url: "",
|
|
42
|
+
return jsx(Action, _extends({
|
|
51
43
|
asDropDownItem: asDropDownItems,
|
|
52
44
|
size: size,
|
|
53
45
|
appearance: appearance,
|
|
@@ -98,20 +98,18 @@ export var filterActionItems = function filterActionItems() {
|
|
|
98
98
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
99
99
|
var context = arguments.length > 1 ? arguments[1] : undefined;
|
|
100
100
|
return items.filter(function (item) {
|
|
101
|
-
var _context$actions;
|
|
102
101
|
switch (item.name) {
|
|
103
102
|
case ActionName.DeleteAction:
|
|
104
103
|
case ActionName.EditAction:
|
|
105
104
|
case ActionName.CustomAction:
|
|
106
105
|
// Named and custom actions that user defines.
|
|
107
106
|
return Boolean(ActionName[item.name]);
|
|
108
|
-
// Remove once ViewAction is retired
|
|
109
|
-
// https://product-fabric.atlassian.net/browse/EDM-9547
|
|
110
|
-
case ActionName.ViewAction:
|
|
111
|
-
return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
|
|
112
107
|
default:
|
|
113
108
|
// Action that require data from the data context to render.
|
|
114
|
-
|
|
109
|
+
if ((context === null || context === void 0 ? void 0 : context.actions) === undefined) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return Boolean(item.name in context.actions ? context.actions[item.name] : undefined);
|
|
115
113
|
}
|
|
116
114
|
});
|
|
117
115
|
};
|
|
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
10
10
|
import LinkWarningModal from './LinkWarningModal';
|
|
11
11
|
var PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "26.
|
|
13
|
+
packageVersion: "26.54.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -131,6 +131,9 @@ export declare enum ActionName {
|
|
|
131
131
|
EditAction = "EditAction",
|
|
132
132
|
FollowAction = "FollowAction",
|
|
133
133
|
PreviewAction = "PreviewAction",
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-8954 Internal documentation for deprecation (no external access)}
|
|
136
|
+
*/
|
|
134
137
|
ViewAction = "ViewAction",
|
|
135
138
|
DownloadAction = "DownloadAction",
|
|
136
139
|
CustomAction = "CustomAction"
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ViewActionProps } from './action/view-action/types';
|
|
3
1
|
export { default as CustomAction } from './action';
|
|
4
2
|
export { default as DeleteAction } from './delete-action';
|
|
5
3
|
export { default as EditAction } from './edit-action';
|
|
6
4
|
export { default as DownloadAction } from './download-action';
|
|
7
5
|
export { default as FollowAction } from './follow-action';
|
|
8
6
|
export { default as PreviewAction } from './preview-action';
|
|
9
|
-
/**
|
|
10
|
-
* Creates a ViewAction component. Accepts default ViewActionProps, and defaults
|
|
11
|
-
* to the text 'View' inside the button.
|
|
12
|
-
* @see Action
|
|
13
|
-
*/
|
|
14
|
-
export declare const ViewAction: import("react").FC<ViewActionProps>;
|
|
@@ -161,7 +161,13 @@ export type BaseDataActionItem = {
|
|
|
161
161
|
* renders a preview modal when clicked.
|
|
162
162
|
*/
|
|
163
163
|
export type NamedDataActionItem = BaseDataActionItem & {
|
|
164
|
-
name: ActionName.FollowAction | ActionName.PreviewAction | ActionName.DownloadAction
|
|
164
|
+
name: ActionName.FollowAction | ActionName.PreviewAction | ActionName.DownloadAction
|
|
165
|
+
/**
|
|
166
|
+
* To be removed once ActionName.ViewAction is retired
|
|
167
|
+
* Currently left in to maintain backwards compatibility with public API
|
|
168
|
+
* https://product-fabric.atlassian.net/browse/EDM-9665
|
|
169
|
+
*/
|
|
170
|
+
| ActionName.ViewAction;
|
|
165
171
|
};
|
|
166
172
|
/**
|
|
167
173
|
* This represents an action that does not fetch data where Icon and Content are provided implicitly.
|
|
@@ -131,6 +131,9 @@ export declare enum ActionName {
|
|
|
131
131
|
EditAction = "EditAction",
|
|
132
132
|
FollowAction = "FollowAction",
|
|
133
133
|
PreviewAction = "PreviewAction",
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-8954 Internal documentation for deprecation (no external access)}
|
|
136
|
+
*/
|
|
134
137
|
ViewAction = "ViewAction",
|
|
135
138
|
DownloadAction = "DownloadAction",
|
|
136
139
|
CustomAction = "CustomAction"
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ViewActionProps } from './action/view-action/types';
|
|
3
1
|
export { default as CustomAction } from './action';
|
|
4
2
|
export { default as DeleteAction } from './delete-action';
|
|
5
3
|
export { default as EditAction } from './edit-action';
|
|
6
4
|
export { default as DownloadAction } from './download-action';
|
|
7
5
|
export { default as FollowAction } from './follow-action';
|
|
8
6
|
export { default as PreviewAction } from './preview-action';
|
|
9
|
-
/**
|
|
10
|
-
* Creates a ViewAction component. Accepts default ViewActionProps, and defaults
|
|
11
|
-
* to the text 'View' inside the button.
|
|
12
|
-
* @see Action
|
|
13
|
-
*/
|
|
14
|
-
export declare const ViewAction: import("react").FC<ViewActionProps>;
|
|
@@ -161,7 +161,13 @@ export type BaseDataActionItem = {
|
|
|
161
161
|
* renders a preview modal when clicked.
|
|
162
162
|
*/
|
|
163
163
|
export type NamedDataActionItem = BaseDataActionItem & {
|
|
164
|
-
name: ActionName.FollowAction | ActionName.PreviewAction | ActionName.DownloadAction
|
|
164
|
+
name: ActionName.FollowAction | ActionName.PreviewAction | ActionName.DownloadAction
|
|
165
|
+
/**
|
|
166
|
+
* To be removed once ActionName.ViewAction is retired
|
|
167
|
+
* Currently left in to maintain backwards compatibility with public API
|
|
168
|
+
* https://product-fabric.atlassian.net/browse/EDM-9665
|
|
169
|
+
*/
|
|
170
|
+
| ActionName.ViewAction;
|
|
165
171
|
};
|
|
166
172
|
/**
|
|
167
173
|
* This represents an action that does not fetch data where Icon and Content are provided implicitly.
|
package/package.json
CHANGED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
var _index = _interopRequireDefault(require("../index"));
|
|
14
|
-
var _utils = require("../../../../../../utils");
|
|
15
|
-
var _constants = require("../../../../../../constants");
|
|
16
|
-
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
17
|
-
var _useInvokeClientAction = _interopRequireDefault(require("../../../../../../state/hooks/use-invoke-client-action"));
|
|
18
|
-
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; }
|
|
19
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
20
|
-
var ViewAction = function ViewAction(props) {
|
|
21
|
-
var appearance = props.appearance,
|
|
22
|
-
asDropDownItem = props.asDropDownItem,
|
|
23
|
-
testId = props.testId,
|
|
24
|
-
_onClick = props.onClick,
|
|
25
|
-
viewUrl = props.viewUrl,
|
|
26
|
-
url = props.url;
|
|
27
|
-
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)();
|
|
28
|
-
var invoke = (0, _useInvokeClientAction.default)({
|
|
29
|
-
analytics: analytics
|
|
30
|
-
});
|
|
31
|
-
if (viewUrl && url) {
|
|
32
|
-
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
33
|
-
onClick: function onClick() {
|
|
34
|
-
invoke({
|
|
35
|
-
actionType: _constants.ActionName.ViewAction,
|
|
36
|
-
actionFn: function () {
|
|
37
|
-
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
38
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) switch (_context.prev = _context.next) {
|
|
40
|
-
case 0:
|
|
41
|
-
return _context.abrupt("return", (0, _utils.openUrl)(viewUrl));
|
|
42
|
-
case 1:
|
|
43
|
-
case "end":
|
|
44
|
-
return _context.stop();
|
|
45
|
-
}
|
|
46
|
-
}, _callee);
|
|
47
|
-
}));
|
|
48
|
-
function actionFn() {
|
|
49
|
-
return _actionFn.apply(this, arguments);
|
|
50
|
-
}
|
|
51
|
-
return actionFn;
|
|
52
|
-
}(),
|
|
53
|
-
// These values have already been set in analytics context.
|
|
54
|
-
// We only pass these here for ufo experience.
|
|
55
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
56
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
57
|
-
});
|
|
58
|
-
if (_onClick) {
|
|
59
|
-
_onClick();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({}, action, {
|
|
64
|
-
appearance: appearance,
|
|
65
|
-
asDropDownItem: asDropDownItem,
|
|
66
|
-
testId: testId
|
|
67
|
-
}));
|
|
68
|
-
} else {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var _default = exports.default = ViewAction;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createDataAction = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _constants = require("../../../../constants");
|
|
13
|
-
var _flexibleUiContext = require("../../../../state/flexible-ui-context");
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var _reactIntlNext = require("react-intl-next");
|
|
16
|
-
var _messages = require("../../../../messages");
|
|
17
|
-
var _viewAction = _interopRequireDefault(require("./action/view-action"));
|
|
18
|
-
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
19
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
-
var actionMappings = (0, _defineProperty2.default)({}, _constants.ActionName.ViewAction, {
|
|
22
|
-
component: _viewAction.default,
|
|
23
|
-
props: {
|
|
24
|
-
testId: 'smart-action-view-action',
|
|
25
|
-
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.view),
|
|
26
|
-
icon: /*#__PURE__*/_react.default.createElement(_shortcut.default, {
|
|
27
|
-
label: "View"
|
|
28
|
-
}),
|
|
29
|
-
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.view)
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
var getContextKey = function getContextKey(name) {
|
|
33
|
-
// Attempt to predict context prop name in advance to reduce the amount of
|
|
34
|
-
// code run during runtime
|
|
35
|
-
return name.length > 0 ? name.charAt(0).toLowerCase() + name.slice(1) : undefined;
|
|
36
|
-
};
|
|
37
|
-
var getActionData = function getActionData(actionName, contextKey, context) {
|
|
38
|
-
if (!context) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
var data = context[contextKey];
|
|
42
|
-
switch (actionName) {
|
|
43
|
-
case _constants.ActionName.ViewAction:
|
|
44
|
-
return data;
|
|
45
|
-
default:
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var createDataAction = exports.createDataAction = function createDataAction(name) {
|
|
50
|
-
var _ref = actionMappings[name] || {},
|
|
51
|
-
BaseAction = _ref.component,
|
|
52
|
-
props = _ref.props;
|
|
53
|
-
var contextKey = getContextKey(name);
|
|
54
|
-
if (!BaseAction) {
|
|
55
|
-
throw Error("Action ".concat(name, " does not exist."));
|
|
56
|
-
}
|
|
57
|
-
return function (overrides) {
|
|
58
|
-
var context = (0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
|
|
59
|
-
var data = getActionData(name, contextKey, context);
|
|
60
|
-
return data && (0, _typeof2.default)(data) === 'object' ? /*#__PURE__*/_react.default.createElement(BaseAction, (0, _extends2.default)({}, props, data, overrides, {
|
|
61
|
-
url: context === null || context === void 0 ? void 0 : context.url
|
|
62
|
-
})) : null;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import Action from '../index';
|
|
4
|
-
import { openUrl } from '../../../../../../utils';
|
|
5
|
-
import { ActionName } from '../../../../../../constants';
|
|
6
|
-
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
7
|
-
import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
|
|
8
|
-
const ViewAction = props => {
|
|
9
|
-
const {
|
|
10
|
-
appearance,
|
|
11
|
-
asDropDownItem,
|
|
12
|
-
testId,
|
|
13
|
-
onClick,
|
|
14
|
-
viewUrl,
|
|
15
|
-
url
|
|
16
|
-
} = props;
|
|
17
|
-
const analytics = useFlexibleUiAnalyticsContext();
|
|
18
|
-
const invoke = useInvokeClientAction({
|
|
19
|
-
analytics
|
|
20
|
-
});
|
|
21
|
-
if (viewUrl && url) {
|
|
22
|
-
const action = {
|
|
23
|
-
...props,
|
|
24
|
-
onClick: () => {
|
|
25
|
-
invoke({
|
|
26
|
-
actionType: ActionName.ViewAction,
|
|
27
|
-
actionFn: async () => openUrl(viewUrl),
|
|
28
|
-
// These values have already been set in analytics context.
|
|
29
|
-
// We only pass these here for ufo experience.
|
|
30
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
31
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
32
|
-
});
|
|
33
|
-
if (onClick) {
|
|
34
|
-
onClick();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
|
|
39
|
-
appearance: appearance,
|
|
40
|
-
asDropDownItem: asDropDownItem,
|
|
41
|
-
testId: testId
|
|
42
|
-
}));
|
|
43
|
-
} else {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export default ViewAction;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import { ActionName } from '../../../../constants';
|
|
3
|
-
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
4
|
-
import React, { useContext } from 'react';
|
|
5
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
6
|
-
import { messages } from '../../../../messages';
|
|
7
|
-
import ViewAction from './action/view-action';
|
|
8
|
-
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
9
|
-
const actionMappings = {
|
|
10
|
-
[ActionName.ViewAction]: {
|
|
11
|
-
component: ViewAction,
|
|
12
|
-
props: {
|
|
13
|
-
testId: 'smart-action-view-action',
|
|
14
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.view),
|
|
15
|
-
icon: /*#__PURE__*/React.createElement(ShortcutIcon, {
|
|
16
|
-
label: "View"
|
|
17
|
-
}),
|
|
18
|
-
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.view)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const getContextKey = name => {
|
|
23
|
-
// Attempt to predict context prop name in advance to reduce the amount of
|
|
24
|
-
// code run during runtime
|
|
25
|
-
return name.length > 0 ? name.charAt(0).toLowerCase() + name.slice(1) : undefined;
|
|
26
|
-
};
|
|
27
|
-
const getActionData = (actionName, contextKey, context) => {
|
|
28
|
-
if (!context) {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
const data = context[contextKey];
|
|
32
|
-
switch (actionName) {
|
|
33
|
-
case ActionName.ViewAction:
|
|
34
|
-
return data;
|
|
35
|
-
default:
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const createDataAction = name => {
|
|
40
|
-
const {
|
|
41
|
-
component: BaseAction,
|
|
42
|
-
props
|
|
43
|
-
} = actionMappings[name] || {};
|
|
44
|
-
const contextKey = getContextKey(name);
|
|
45
|
-
if (!BaseAction) {
|
|
46
|
-
throw Error(`Action ${name} does not exist.`);
|
|
47
|
-
}
|
|
48
|
-
return overrides => {
|
|
49
|
-
const context = useContext(FlexibleUiContext);
|
|
50
|
-
const data = getActionData(name, contextKey, context);
|
|
51
|
-
return data && typeof data === 'object' ? /*#__PURE__*/React.createElement(BaseAction, _extends({}, props, data, overrides, {
|
|
52
|
-
url: context === null || context === void 0 ? void 0 : context.url
|
|
53
|
-
})) : null;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import Action from '../index';
|
|
9
|
-
import { openUrl } from '../../../../../../utils';
|
|
10
|
-
import { ActionName } from '../../../../../../constants';
|
|
11
|
-
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
12
|
-
import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
|
|
13
|
-
var ViewAction = function ViewAction(props) {
|
|
14
|
-
var appearance = props.appearance,
|
|
15
|
-
asDropDownItem = props.asDropDownItem,
|
|
16
|
-
testId = props.testId,
|
|
17
|
-
_onClick = props.onClick,
|
|
18
|
-
viewUrl = props.viewUrl,
|
|
19
|
-
url = props.url;
|
|
20
|
-
var analytics = useFlexibleUiAnalyticsContext();
|
|
21
|
-
var invoke = useInvokeClientAction({
|
|
22
|
-
analytics: analytics
|
|
23
|
-
});
|
|
24
|
-
if (viewUrl && url) {
|
|
25
|
-
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
26
|
-
onClick: function onClick() {
|
|
27
|
-
invoke({
|
|
28
|
-
actionType: ActionName.ViewAction,
|
|
29
|
-
actionFn: function () {
|
|
30
|
-
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
31
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
32
|
-
while (1) switch (_context.prev = _context.next) {
|
|
33
|
-
case 0:
|
|
34
|
-
return _context.abrupt("return", openUrl(viewUrl));
|
|
35
|
-
case 1:
|
|
36
|
-
case "end":
|
|
37
|
-
return _context.stop();
|
|
38
|
-
}
|
|
39
|
-
}, _callee);
|
|
40
|
-
}));
|
|
41
|
-
function actionFn() {
|
|
42
|
-
return _actionFn.apply(this, arguments);
|
|
43
|
-
}
|
|
44
|
-
return actionFn;
|
|
45
|
-
}(),
|
|
46
|
-
// These values have already been set in analytics context.
|
|
47
|
-
// We only pass these here for ufo experience.
|
|
48
|
-
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
49
|
-
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
50
|
-
});
|
|
51
|
-
if (_onClick) {
|
|
52
|
-
_onClick();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
|
|
57
|
-
appearance: appearance,
|
|
58
|
-
asDropDownItem: asDropDownItem,
|
|
59
|
-
testId: testId
|
|
60
|
-
}));
|
|
61
|
-
} else {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
export default ViewAction;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
import { ActionName } from '../../../../constants';
|
|
5
|
-
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
6
|
-
import React, { useContext } from 'react';
|
|
7
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
8
|
-
import { messages } from '../../../../messages';
|
|
9
|
-
import ViewAction from './action/view-action';
|
|
10
|
-
import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
|
|
11
|
-
var actionMappings = _defineProperty({}, ActionName.ViewAction, {
|
|
12
|
-
component: ViewAction,
|
|
13
|
-
props: {
|
|
14
|
-
testId: 'smart-action-view-action',
|
|
15
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.view),
|
|
16
|
-
icon: /*#__PURE__*/React.createElement(ShortcutIcon, {
|
|
17
|
-
label: "View"
|
|
18
|
-
}),
|
|
19
|
-
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.view)
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
var getContextKey = function getContextKey(name) {
|
|
23
|
-
// Attempt to predict context prop name in advance to reduce the amount of
|
|
24
|
-
// code run during runtime
|
|
25
|
-
return name.length > 0 ? name.charAt(0).toLowerCase() + name.slice(1) : undefined;
|
|
26
|
-
};
|
|
27
|
-
var getActionData = function getActionData(actionName, contextKey, context) {
|
|
28
|
-
if (!context) {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
var data = context[contextKey];
|
|
32
|
-
switch (actionName) {
|
|
33
|
-
case ActionName.ViewAction:
|
|
34
|
-
return data;
|
|
35
|
-
default:
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export var createDataAction = function createDataAction(name) {
|
|
40
|
-
var _ref = actionMappings[name] || {},
|
|
41
|
-
BaseAction = _ref.component,
|
|
42
|
-
props = _ref.props;
|
|
43
|
-
var contextKey = getContextKey(name);
|
|
44
|
-
if (!BaseAction) {
|
|
45
|
-
throw Error("Action ".concat(name, " does not exist."));
|
|
46
|
-
}
|
|
47
|
-
return function (overrides) {
|
|
48
|
-
var context = useContext(FlexibleUiContext);
|
|
49
|
-
var data = getActionData(name, contextKey, context);
|
|
50
|
-
return data && _typeof(data) === 'object' ? /*#__PURE__*/React.createElement(BaseAction, _extends({}, props, data, overrides, {
|
|
51
|
-
url: context === null || context === void 0 ? void 0 : context.url
|
|
52
|
-
})) : null;
|
|
53
|
-
};
|
|
54
|
-
};
|