@atlaskit/smart-card 27.3.0 → 27.4.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 +16 -0
- package/dist/cjs/extractors/flexible/actions/extract-automation-action.js +13 -31
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +7 -3
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +21 -5
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/main.js +43 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +14 -8
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/utils/index.js +19 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/extract-automation-action.js +13 -28
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +5 -3
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +16 -4
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/main.js +37 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +16 -7
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/utils/index.js +13 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/extract-automation-action.js +13 -30
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +7 -3
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +22 -6
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +2 -2
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/main.js +36 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +2 -2
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +14 -8
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/utils/index.js +13 -0
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +2 -3
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +4 -1
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/main.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/actions/automation-action/utils/index.d.ts +7 -0
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +2 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +4 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/main.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/utils/index.d.ts +7 -0
- package/package.json +2 -1
|
@@ -7,6 +7,7 @@ import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
|
7
7
|
import { useSmartLinkModal } from '../../../../../state/modal';
|
|
8
8
|
import { ActionName } from '../../../../../constants';
|
|
9
9
|
import { messages } from '../../../../../messages';
|
|
10
|
+
import { getModalContent } from './utils';
|
|
10
11
|
const AutomationModal = /*#__PURE__*/lazy(() => import( /* webpackChunkName: "@atlaskit-internal_smart-card-automation-modal" */'./automation-manual-triggers/manual-triggers-modal'));
|
|
11
12
|
const AutomationAction = props => {
|
|
12
13
|
var _context$actions;
|
|
@@ -14,27 +15,34 @@ const AutomationAction = props => {
|
|
|
14
15
|
formatMessage
|
|
15
16
|
} = useIntl();
|
|
16
17
|
const modal = useSmartLinkModal();
|
|
18
|
+
const {
|
|
19
|
+
onClick: onClickCallback
|
|
20
|
+
} = props;
|
|
17
21
|
const context = useFlexibleUiContext();
|
|
18
22
|
const automationActionData = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.AutomationAction];
|
|
19
23
|
const automationActionOnClick = useCallback(automationActionData => {
|
|
20
24
|
const {
|
|
25
|
+
product,
|
|
26
|
+
resourceType,
|
|
21
27
|
baseAutomationUrl,
|
|
22
28
|
objectAri,
|
|
23
29
|
siteAri,
|
|
24
30
|
canManageAutomation,
|
|
25
31
|
analyticsSource,
|
|
26
|
-
modalTitle,
|
|
27
|
-
modalDescription,
|
|
28
32
|
objectName
|
|
29
33
|
} = automationActionData;
|
|
30
|
-
const
|
|
31
|
-
|
|
34
|
+
const {
|
|
35
|
+
modalTitle,
|
|
36
|
+
modalDescription
|
|
37
|
+
} = getModalContent(product, resourceType) || {};
|
|
38
|
+
const automationModalTitle = modalTitle ? /*#__PURE__*/React.createElement(FormattedMessage, modalTitle) : undefined;
|
|
39
|
+
const automationModalDescription = modalDescription ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, modalDescription, {
|
|
32
40
|
values: {
|
|
33
41
|
name: objectName,
|
|
34
42
|
b: chunks => /*#__PURE__*/React.createElement("strong", null, chunks),
|
|
35
43
|
br: /*#__PURE__*/React.createElement("br", null)
|
|
36
44
|
}
|
|
37
|
-
}));
|
|
45
|
+
})) : undefined;
|
|
38
46
|
modal.open( /*#__PURE__*/React.createElement(AutomationModal, {
|
|
39
47
|
baseAutomationUrl: baseAutomationUrl,
|
|
40
48
|
objectAri: objectAri,
|
|
@@ -45,7 +53,8 @@ const AutomationAction = props => {
|
|
|
45
53
|
modalDescription: automationModalDescription,
|
|
46
54
|
onClose: () => modal.close()
|
|
47
55
|
}));
|
|
48
|
-
|
|
56
|
+
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
57
|
+
}, [modal, onClickCallback]);
|
|
49
58
|
if (!automationActionData) {
|
|
50
59
|
return null;
|
|
51
60
|
}
|
|
@@ -59,7 +68,7 @@ const AutomationAction = props => {
|
|
|
59
68
|
}),
|
|
60
69
|
testId: "smart-action-automation-action",
|
|
61
70
|
tooltipMessage: automationActionTooltip
|
|
62
|
-
},
|
|
71
|
+
}, props, {
|
|
63
72
|
onClick: () => automationActionOnClick(automationActionData)
|
|
64
73
|
})));
|
|
65
74
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { messages } from '../../../../../../messages';
|
|
2
|
+
export const getModalContent = (product, resourceType) => {
|
|
3
|
+
var _modalContentMap$prod;
|
|
4
|
+
const modalContentMap = {
|
|
5
|
+
'confluence': {
|
|
6
|
+
'page': {
|
|
7
|
+
modalTitle: messages.automation_action_confluence_page_modal_title,
|
|
8
|
+
modalDescription: messages.automation_action_confluence_page_modal_description
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return modalContentMap === null || modalContentMap === void 0 ? void 0 : (_modalContentMap$prod = modalContentMap[product]) === null || _modalContentMap$prod === void 0 ? void 0 : _modalContentMap$prod[resourceType];
|
|
13
|
+
};
|
|
@@ -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: "27.
|
|
10
|
+
packageVersion: "27.4.1",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -1,46 +1,29 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
1
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
import {
|
|
6
|
-
// This action will not be enabled by default for smart cards, which is opposite of the default behavior for actions.
|
|
7
|
-
// The AutomationAction will only appear if product/resourceType combination is handled by this function.
|
|
8
|
-
var getProductData = function getProductData(meta) {
|
|
9
|
-
var _ProductData$product;
|
|
10
|
-
var tenantId = meta.tenantId;
|
|
11
|
-
var product = meta.product;
|
|
12
|
-
var resourceType = meta.resourceType;
|
|
13
|
-
var ProductData = {
|
|
14
|
-
'confluence': {
|
|
15
|
-
'page': {
|
|
16
|
-
//TODO extract to server
|
|
17
|
-
siteAri: "ari:cloud:confluence::site/".concat(tenantId),
|
|
18
|
-
//TODO Move to AutomationAction
|
|
19
|
-
modalTitle: messages.automation_action_confluence_page_modal_title,
|
|
20
|
-
modalDescription: messages.automation_action_confluence_page_modal_description
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
return ProductData === null || ProductData === void 0 || (_ProductData$product = ProductData[product]) === null || _ProductData$product === void 0 ? void 0 : _ProductData$product[resourceType];
|
|
25
|
-
};
|
|
2
|
+
import { ActionName } from '../../../constants';
|
|
26
3
|
export var extractAutomationAction = function extractAutomationAction(response) {
|
|
4
|
+
var _response$meta;
|
|
27
5
|
if (!getBooleanFF('platform.linking-platfom.smart-card.confluence.page.automation-action_xcdoi') || !response.data) {
|
|
28
6
|
return undefined;
|
|
29
7
|
}
|
|
8
|
+
if (!(response !== null && response !== void 0 && (_response$meta = response.meta) !== null && _response$meta !== void 0 && (_response$meta = _response$meta.supportedFeature) !== null && _response$meta !== void 0 && _response$meta.includes(ActionName.AutomationAction))) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
30
11
|
var data = response.data;
|
|
31
12
|
var meta = response.meta;
|
|
32
13
|
var name = data.name,
|
|
33
14
|
objectAri = data["atlassian:ari"];
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
15
|
+
var product = meta.product,
|
|
16
|
+
tenantId = meta.tenantId,
|
|
17
|
+
resourceType = meta.resourceType;
|
|
18
|
+
return {
|
|
19
|
+
product: product,
|
|
20
|
+
resourceType: resourceType,
|
|
21
|
+
siteAri: "ari:cloud:".concat(product, "::site/").concat(tenantId),
|
|
39
22
|
objectName: name,
|
|
40
23
|
objectAri: objectAri,
|
|
41
24
|
// TODO: The admin experience will be a follow up
|
|
42
25
|
canManageAutomation: false,
|
|
43
26
|
baseAutomationUrl: '',
|
|
44
27
|
analyticsSource: 'smartCard'
|
|
45
|
-
}
|
|
28
|
+
};
|
|
46
29
|
};
|
|
@@ -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: "27.
|
|
18
|
+
packageVersion: "27.4.1"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,9 +3,10 @@ import React, { useEffect, useState } from 'react';
|
|
|
3
3
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
4
|
import Modal, { ModalBody, ModalFooter } from '@atlaskit/modal-dialog';
|
|
5
5
|
import { AutomationMenuContextContainer } from './menu-context';
|
|
6
|
+
import { AutomationModalHeader } from './sub-components/header';
|
|
6
7
|
import { AutomationModalBody } from './sub-components/body';
|
|
8
|
+
import { AutomationModalExecutionState } from './sub-components/execution-state-message';
|
|
7
9
|
import { AutomationModalFooter } from './sub-components/footer';
|
|
8
|
-
import { AutomationModalHeader } from './sub-components/header';
|
|
9
10
|
export var AutomationModal = function AutomationModal(_ref) {
|
|
10
11
|
var baseAutomationUrl = _ref.baseAutomationUrl,
|
|
11
12
|
siteAri = _ref.siteAri,
|
|
@@ -40,7 +41,10 @@ export var AutomationModal = function AutomationModal(_ref) {
|
|
|
40
41
|
analyticsSource: analyticsSource,
|
|
41
42
|
emptyStateDescription: emptyStateDescription,
|
|
42
43
|
emptyStateAdminDescription: emptyStateAdminDescription,
|
|
43
|
-
|
|
44
|
+
onRuleInvocationSuccess: onClose,
|
|
45
|
+
onRuleInvocationFailure: function onRuleInvocationFailure() {
|
|
46
|
+
return setSelectedRule(undefined);
|
|
47
|
+
}
|
|
44
48
|
}, function () {
|
|
45
49
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
46
50
|
onClose: onClose,
|
|
@@ -54,7 +58,7 @@ export var AutomationModal = function AutomationModal(_ref) {
|
|
|
54
58
|
}), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(AutomationModalBody, {
|
|
55
59
|
selectedRule: selectedRule,
|
|
56
60
|
setSelectedRule: setSelectedRule
|
|
57
|
-
})), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(AutomationModalFooter, {
|
|
61
|
+
})), /*#__PURE__*/React.createElement(AutomationModalExecutionState, null), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(AutomationModalFooter, {
|
|
58
62
|
selectedRule: selectedRule,
|
|
59
63
|
onClose: onClose
|
|
60
64
|
})));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
// This is another layer on top of the AFE ManualRulesContainer.
|
|
5
6
|
// It is necessary that this container wraps the entire "automation" component and not nested. Else the user input form will not render correctly.
|
|
6
7
|
// This container provides an automation context to all children components through the useAutomationMenu hook.
|
|
7
|
-
import React, { createContext, useContext } from 'react';
|
|
8
|
+
import React, { createContext, useContext, useState } from 'react';
|
|
8
9
|
import { ManualRulesContainer } from '../../manual-triggers-container';
|
|
9
10
|
var AutomationMenuContext = /*#__PURE__*/createContext(undefined);
|
|
10
11
|
var AutomationMenuProvider = function AutomationMenuProvider(_ref) {
|
|
@@ -32,25 +33,40 @@ export var AutomationMenuContextContainer = function AutomationMenuContextContai
|
|
|
32
33
|
children = _ref2.children,
|
|
33
34
|
emptyStateDescription = _ref2.emptyStateDescription,
|
|
34
35
|
emptyStateAdminDescription = _ref2.emptyStateAdminDescription,
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
_onRuleInvocationSuccess = _ref2.onRuleInvocationSuccess,
|
|
37
|
+
_onRuleInvocationFailure = _ref2.onRuleInvocationFailure,
|
|
37
38
|
onRuleInvocationLifecycleDone = _ref2.onRuleInvocationLifecycleDone;
|
|
39
|
+
var _useState = useState('NONE'),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
ruleExecutionState = _useState2[0],
|
|
42
|
+
setRuleExecutionState = _useState2[1];
|
|
38
43
|
return /*#__PURE__*/React.createElement(ManualRulesContainer, {
|
|
39
44
|
site: siteAri,
|
|
40
45
|
query: {
|
|
41
46
|
objects: [objectAri]
|
|
42
47
|
},
|
|
48
|
+
onRuleInvocationLifecycleStarted: function onRuleInvocationLifecycleStarted() {
|
|
49
|
+
setRuleExecutionState('NONE');
|
|
50
|
+
},
|
|
43
51
|
onRuleInvocationLifecycleDone: onRuleInvocationLifecycleDone,
|
|
44
|
-
onRuleInvocationSuccess: onRuleInvocationSuccess
|
|
45
|
-
|
|
52
|
+
onRuleInvocationSuccess: function onRuleInvocationSuccess() {
|
|
53
|
+
setRuleExecutionState('SUCCEED');
|
|
54
|
+
_onRuleInvocationSuccess === null || _onRuleInvocationSuccess === void 0 || _onRuleInvocationSuccess();
|
|
55
|
+
},
|
|
56
|
+
onRuleInvocationFailure: function onRuleInvocationFailure() {
|
|
57
|
+
setRuleExecutionState('FAILURE');
|
|
58
|
+
_onRuleInvocationFailure === null || _onRuleInvocationFailure === void 0 || _onRuleInvocationFailure();
|
|
59
|
+
}
|
|
46
60
|
}, function (props) {
|
|
47
61
|
var contextValue = _objectSpread(_objectSpread({}, props), {}, {
|
|
62
|
+
fetchError: props.error,
|
|
48
63
|
analyticsSource: analyticsSource,
|
|
49
64
|
objectAri: objectAri,
|
|
50
65
|
baseAutomationUrl: baseAutomationUrl,
|
|
51
66
|
canManageAutomation: canManageAutomation,
|
|
52
67
|
emptyStateDescription: emptyStateDescription,
|
|
53
|
-
emptyStateAdminDescription: emptyStateAdminDescription
|
|
68
|
+
emptyStateAdminDescription: emptyStateAdminDescription,
|
|
69
|
+
ruleExecutionState: ruleExecutionState
|
|
54
70
|
});
|
|
55
71
|
return /*#__PURE__*/React.createElement(AutomationMenuProvider, {
|
|
56
72
|
value: contextValue
|
|
@@ -10,7 +10,7 @@ export var AutomationModalBody = function AutomationModalBody(_ref) {
|
|
|
10
10
|
triggerFetch = _useAutomationMenu.triggerFetch,
|
|
11
11
|
initialised = _useAutomationMenu.initialised,
|
|
12
12
|
rules = _useAutomationMenu.rules,
|
|
13
|
-
|
|
13
|
+
fetchError = _useAutomationMenu.fetchError;
|
|
14
14
|
useEffect(function () {
|
|
15
15
|
void triggerFetch();
|
|
16
16
|
// Want to ensure that triggerFetch is only called once when the component is mounted.
|
|
@@ -20,7 +20,7 @@ export var AutomationModalBody = function AutomationModalBody(_ref) {
|
|
|
20
20
|
return /*#__PURE__*/React.createElement(Skeleton, {
|
|
21
21
|
lineCount: 10
|
|
22
22
|
});
|
|
23
|
-
} else if (
|
|
23
|
+
} else if (fetchError && rules.length === 0) {
|
|
24
24
|
return /*#__PURE__*/React.createElement(AutomationModalErrorState, null);
|
|
25
25
|
}
|
|
26
26
|
return /*#__PURE__*/React.createElement(AutomationModalRuleList, {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { defineMessages, FormattedMessage } from 'react-intl-next';
|
|
3
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
4
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
5
|
+
import { useAutomationMenu } from '../../menu-context';
|
|
6
|
+
var i18n = defineMessages({
|
|
7
|
+
ruleExecutionSuccessMessage: {
|
|
8
|
+
id: 'automation-menu.success-state.message',
|
|
9
|
+
defaultMessage: 'Your automation is in progress',
|
|
10
|
+
description: 'Message that is displayed when a users automation rule has been successfully queued.'
|
|
11
|
+
},
|
|
12
|
+
ruleExecutionErrorMessage: {
|
|
13
|
+
id: 'automation-menu.modal.error.description',
|
|
14
|
+
defaultMessage: 'Oops we ran into a problem',
|
|
15
|
+
description: "Description for the error section shown when rules can't be executed"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var messageStyling = xcss({
|
|
19
|
+
marginInline: 'space.300',
|
|
20
|
+
marginTop: 'space.100',
|
|
21
|
+
// The ModalFooter comes with a lot of built in margin, want to nudge the error message in to the footer a bit
|
|
22
|
+
marginBottom: 'space.negative.100'
|
|
23
|
+
});
|
|
24
|
+
export var AutomationModalExecutionState = function AutomationModalExecutionState() {
|
|
25
|
+
var _useAutomationMenu = useAutomationMenu(),
|
|
26
|
+
ruleExecutionState = _useAutomationMenu.ruleExecutionState;
|
|
27
|
+
if (ruleExecutionState === 'FAILURE') {
|
|
28
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
29
|
+
xcss: messageStyling
|
|
30
|
+
}, /*#__PURE__*/React.createElement(SectionMessage, {
|
|
31
|
+
appearance: "error"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, i18n.ruleExecutionErrorMessage)));
|
|
33
|
+
} else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -37,7 +37,7 @@ export var AutomationModalFooter = function AutomationModalFooter(_ref) {
|
|
|
37
37
|
invokeRuleOrShowDialog = _useAutomationMenu.invokeRuleOrShowDialog,
|
|
38
38
|
invokingRuleId = _useAutomationMenu.invokingRuleId,
|
|
39
39
|
rules = _useAutomationMenu.rules,
|
|
40
|
-
|
|
40
|
+
fetchError = _useAutomationMenu.fetchError,
|
|
41
41
|
baseAutomationUrl = _useAutomationMenu.baseAutomationUrl,
|
|
42
42
|
analyticsSource = _useAutomationMenu.analyticsSource;
|
|
43
43
|
var sendFooterAnalyticsEvent = function sendFooterAnalyticsEvent(actionSubjectId, ruleId) {
|
|
@@ -102,7 +102,7 @@ export var AutomationModalFooter = function AutomationModalFooter(_ref) {
|
|
|
102
102
|
// Empty admin scenario -> cancel and Create Automation buttons
|
|
103
103
|
// Empty end user and error scenario -> Ok button
|
|
104
104
|
if (rules.length < 1) {
|
|
105
|
-
if (
|
|
105
|
+
if (fetchError || !canManageAutomation) {
|
|
106
106
|
modalButtons.push(okButton);
|
|
107
107
|
} else {
|
|
108
108
|
modalButtons.push(cancelButton, createAutomationButton);
|
|
@@ -7,6 +7,7 @@ import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
|
7
7
|
import { useSmartLinkModal } from '../../../../../state/modal';
|
|
8
8
|
import { ActionName } from '../../../../../constants';
|
|
9
9
|
import { messages } from '../../../../../messages';
|
|
10
|
+
import { getModalContent } from './utils';
|
|
10
11
|
var AutomationModal = /*#__PURE__*/lazy(function () {
|
|
11
12
|
return import( /* webpackChunkName: "@atlaskit-internal_smart-card-automation-modal" */'./automation-manual-triggers/manual-triggers-modal');
|
|
12
13
|
});
|
|
@@ -15,19 +16,23 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
15
16
|
var _useIntl = useIntl(),
|
|
16
17
|
formatMessage = _useIntl.formatMessage;
|
|
17
18
|
var modal = useSmartLinkModal();
|
|
19
|
+
var onClickCallback = props.onClick;
|
|
18
20
|
var context = useFlexibleUiContext();
|
|
19
21
|
var automationActionData = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.AutomationAction];
|
|
20
22
|
var automationActionOnClick = useCallback(function (automationActionData) {
|
|
21
|
-
var
|
|
23
|
+
var product = automationActionData.product,
|
|
24
|
+
resourceType = automationActionData.resourceType,
|
|
25
|
+
baseAutomationUrl = automationActionData.baseAutomationUrl,
|
|
22
26
|
objectAri = automationActionData.objectAri,
|
|
23
27
|
siteAri = automationActionData.siteAri,
|
|
24
28
|
canManageAutomation = automationActionData.canManageAutomation,
|
|
25
29
|
analyticsSource = automationActionData.analyticsSource,
|
|
26
|
-
modalTitle = automationActionData.modalTitle,
|
|
27
|
-
modalDescription = automationActionData.modalDescription,
|
|
28
30
|
objectName = automationActionData.objectName;
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
+
var _ref = getModalContent(product, resourceType) || {},
|
|
32
|
+
modalTitle = _ref.modalTitle,
|
|
33
|
+
modalDescription = _ref.modalDescription;
|
|
34
|
+
var automationModalTitle = modalTitle ? /*#__PURE__*/React.createElement(FormattedMessage, modalTitle) : undefined;
|
|
35
|
+
var automationModalDescription = modalDescription ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, modalDescription, {
|
|
31
36
|
values: {
|
|
32
37
|
name: objectName,
|
|
33
38
|
b: function b(chunks) {
|
|
@@ -35,7 +40,7 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
35
40
|
},
|
|
36
41
|
br: /*#__PURE__*/React.createElement("br", null)
|
|
37
42
|
}
|
|
38
|
-
}));
|
|
43
|
+
})) : undefined;
|
|
39
44
|
modal.open( /*#__PURE__*/React.createElement(AutomationModal, {
|
|
40
45
|
baseAutomationUrl: baseAutomationUrl,
|
|
41
46
|
objectAri: objectAri,
|
|
@@ -48,7 +53,8 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
48
53
|
return modal.close();
|
|
49
54
|
}
|
|
50
55
|
}));
|
|
51
|
-
|
|
56
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
57
|
+
}, [modal, onClickCallback]);
|
|
52
58
|
if (!automationActionData) {
|
|
53
59
|
return null;
|
|
54
60
|
}
|
|
@@ -62,7 +68,7 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
62
68
|
}),
|
|
63
69
|
testId: "smart-action-automation-action",
|
|
64
70
|
tooltipMessage: automationActionTooltip
|
|
65
|
-
},
|
|
71
|
+
}, props, {
|
|
66
72
|
onClick: function onClick() {
|
|
67
73
|
return automationActionOnClick(automationActionData);
|
|
68
74
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { messages } from '../../../../../../messages';
|
|
2
|
+
export var getModalContent = function getModalContent(product, resourceType) {
|
|
3
|
+
var _modalContentMap$prod;
|
|
4
|
+
var modalContentMap = {
|
|
5
|
+
'confluence': {
|
|
6
|
+
'page': {
|
|
7
|
+
modalTitle: messages.automation_action_confluence_page_modal_title,
|
|
8
|
+
modalDescription: messages.automation_action_confluence_page_modal_description
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return modalContentMap === null || modalContentMap === void 0 || (_modalContentMap$prod = modalContentMap[product]) === null || _modalContentMap$prod === void 0 ? void 0 : _modalContentMap$prod[resourceType];
|
|
13
|
+
};
|
|
@@ -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: "27.
|
|
13
|
+
packageVersion: "27.4.1",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -5,7 +5,6 @@ import { type InvokeRequestWithCardDetails } from '../hooks/use-invoke/types';
|
|
|
5
5
|
import type { CardInnerAppearance } from '../../view/Card/types';
|
|
6
6
|
import type { AnalyticsFacade } from '../analytics';
|
|
7
7
|
import type { ProductType } from '@atlaskit/linking-common';
|
|
8
|
-
import { type MessageDescriptor } from 'react-intl-next';
|
|
9
8
|
/**
|
|
10
9
|
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
11
10
|
* underlying elements.
|
|
@@ -275,14 +274,14 @@ export type AISummaryActionData = {
|
|
|
275
274
|
url: string;
|
|
276
275
|
};
|
|
277
276
|
export type AutomationActionData = {
|
|
277
|
+
product: string;
|
|
278
|
+
resourceType: string;
|
|
278
279
|
baseAutomationUrl: string;
|
|
279
280
|
objectAri: any;
|
|
280
281
|
siteAri: any;
|
|
281
282
|
canManageAutomation: boolean;
|
|
282
283
|
analyticsSource: string;
|
|
283
284
|
objectName?: string;
|
|
284
|
-
modalTitle: MessageDescriptor;
|
|
285
|
-
modalDescription: MessageDescriptor;
|
|
286
285
|
};
|
|
287
286
|
export type ViewRelatedLinksActionData = {
|
|
288
287
|
url: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AutomationMenuContextContainer, useAutomationMenu, } from './main';
|
|
1
|
+
export { AutomationMenuContextContainer, useAutomationMenu, type RuleExecutionState, } from './main';
|
|
@@ -13,13 +13,16 @@ type AutomationMenuContextContainerProps = {
|
|
|
13
13
|
onRuleInvocationFailure?: () => void;
|
|
14
14
|
onRuleInvocationLifecycleDone?: () => void;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
16
|
+
export type RuleExecutionState = 'SUCCEED' | 'FAILURE' | 'NONE';
|
|
17
|
+
export type MenuContext = Omit<ManualRulesData, 'error'> & {
|
|
18
|
+
fetchError: any;
|
|
17
19
|
analyticsSource: string;
|
|
18
20
|
objectAri: string;
|
|
19
21
|
baseAutomationUrl: string;
|
|
20
22
|
canManageAutomation: boolean;
|
|
21
23
|
emptyStateDescription?: React.ReactNode;
|
|
22
24
|
emptyStateAdminDescription?: React.ReactNode;
|
|
25
|
+
ruleExecutionState: RuleExecutionState;
|
|
23
26
|
};
|
|
24
27
|
export declare const useAutomationMenu: () => MenuContext;
|
|
25
28
|
export declare const AutomationMenuContextContainer: ({ baseAutomationUrl, analyticsSource, objectAri, siteAri, canManageAutomation, children, emptyStateDescription, emptyStateAdminDescription, onRuleInvocationSuccess, onRuleInvocationFailure, onRuleInvocationLifecycleDone, }: AutomationMenuContextContainerProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type AutomationModalHeaderProps = {
|
|
3
|
-
modalTitle
|
|
3
|
+
modalTitle?: React.ReactNode;
|
|
4
4
|
modalDescription?: React.ReactNode;
|
|
5
5
|
};
|
|
6
6
|
export declare const AutomationModalHeader: ({ modalTitle, modalDescription, }: AutomationModalHeaderProps) => JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type MessageDescriptor } from "react-intl-next";
|
|
2
|
+
type ModalContent = {
|
|
3
|
+
modalTitle: MessageDescriptor;
|
|
4
|
+
modalDescription: MessageDescriptor;
|
|
5
|
+
};
|
|
6
|
+
export declare const getModalContent: (product: string, resourceType: string) => ModalContent | undefined;
|
|
7
|
+
export {};
|
|
@@ -5,7 +5,6 @@ import { type InvokeRequestWithCardDetails } from '../hooks/use-invoke/types';
|
|
|
5
5
|
import type { CardInnerAppearance } from '../../view/Card/types';
|
|
6
6
|
import type { AnalyticsFacade } from '../analytics';
|
|
7
7
|
import type { ProductType } from '@atlaskit/linking-common';
|
|
8
|
-
import { type MessageDescriptor } from 'react-intl-next';
|
|
9
8
|
/**
|
|
10
9
|
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
11
10
|
* underlying elements.
|
|
@@ -275,14 +274,14 @@ export type AISummaryActionData = {
|
|
|
275
274
|
url: string;
|
|
276
275
|
};
|
|
277
276
|
export type AutomationActionData = {
|
|
277
|
+
product: string;
|
|
278
|
+
resourceType: string;
|
|
278
279
|
baseAutomationUrl: string;
|
|
279
280
|
objectAri: any;
|
|
280
281
|
siteAri: any;
|
|
281
282
|
canManageAutomation: boolean;
|
|
282
283
|
analyticsSource: string;
|
|
283
284
|
objectName?: string;
|
|
284
|
-
modalTitle: MessageDescriptor;
|
|
285
|
-
modalDescription: MessageDescriptor;
|
|
286
285
|
};
|
|
287
286
|
export type ViewRelatedLinksActionData = {
|
|
288
287
|
url: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AutomationMenuContextContainer, useAutomationMenu, } from './main';
|
|
1
|
+
export { AutomationMenuContextContainer, useAutomationMenu, type RuleExecutionState, } from './main';
|
|
@@ -13,13 +13,16 @@ type AutomationMenuContextContainerProps = {
|
|
|
13
13
|
onRuleInvocationFailure?: () => void;
|
|
14
14
|
onRuleInvocationLifecycleDone?: () => void;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
16
|
+
export type RuleExecutionState = 'SUCCEED' | 'FAILURE' | 'NONE';
|
|
17
|
+
export type MenuContext = Omit<ManualRulesData, 'error'> & {
|
|
18
|
+
fetchError: any;
|
|
17
19
|
analyticsSource: string;
|
|
18
20
|
objectAri: string;
|
|
19
21
|
baseAutomationUrl: string;
|
|
20
22
|
canManageAutomation: boolean;
|
|
21
23
|
emptyStateDescription?: React.ReactNode;
|
|
22
24
|
emptyStateAdminDescription?: React.ReactNode;
|
|
25
|
+
ruleExecutionState: RuleExecutionState;
|
|
23
26
|
};
|
|
24
27
|
export declare const useAutomationMenu: () => MenuContext;
|
|
25
28
|
export declare const AutomationMenuContextContainer: ({ baseAutomationUrl, analyticsSource, objectAri, siteAri, canManageAutomation, children, emptyStateDescription, emptyStateAdminDescription, onRuleInvocationSuccess, onRuleInvocationFailure, onRuleInvocationLifecycleDone, }: AutomationMenuContextContainerProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type AutomationModalHeaderProps = {
|
|
3
|
-
modalTitle
|
|
3
|
+
modalTitle?: React.ReactNode;
|
|
4
4
|
modalDescription?: React.ReactNode;
|
|
5
5
|
};
|
|
6
6
|
export declare const AutomationModalHeader: ({ modalTitle, modalDescription, }: AutomationModalHeaderProps) => JSX.Element;
|
package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/utils/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type MessageDescriptor } from "react-intl-next";
|
|
2
|
+
type ModalContent = {
|
|
3
|
+
modalTitle: MessageDescriptor;
|
|
4
|
+
modalDescription: MessageDescriptor;
|
|
5
|
+
};
|
|
6
|
+
export declare const getModalContent: (product: string, resourceType: string) => ModalContent | undefined;
|
|
7
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.4.1",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
57
57
|
"@atlaskit/popup": "^1.17.0",
|
|
58
58
|
"@atlaskit/primitives": "^6.3.0",
|
|
59
|
+
"@atlaskit/section-message": "^6.5.0",
|
|
59
60
|
"@atlaskit/select": "^17.10.0",
|
|
60
61
|
"@atlaskit/spinner": "^16.1.0",
|
|
61
62
|
"@atlaskit/textarea": "^5.4.0",
|