@atlaskit/smart-card 27.4.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 +8 -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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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/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/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 +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 27.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#105414](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105414)
|
|
8
|
+
[`23d96f7c2ad9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/23d96f7c2ad9) -
|
|
9
|
+
Remove product and resourceType logic from the FE.
|
|
10
|
+
|
|
3
11
|
## 27.4.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -1,53 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.extractAutomationAction = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
-
var
|
|
11
|
-
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; }
|
|
12
|
-
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; }
|
|
13
|
-
// This action will not be enabled by default for smart cards, which is opposite of the default behavior for actions.
|
|
14
|
-
// The AutomationAction will only appear if product/resourceType combination is handled by this function.
|
|
15
|
-
var getProductData = function getProductData(meta) {
|
|
16
|
-
var _ProductData$product;
|
|
17
|
-
var tenantId = meta.tenantId;
|
|
18
|
-
var product = meta.product;
|
|
19
|
-
var resourceType = meta.resourceType;
|
|
20
|
-
var ProductData = {
|
|
21
|
-
'confluence': {
|
|
22
|
-
'page': {
|
|
23
|
-
//TODO extract to server
|
|
24
|
-
siteAri: "ari:cloud:confluence::site/".concat(tenantId),
|
|
25
|
-
//TODO Move to AutomationAction
|
|
26
|
-
modalTitle: _messages.messages.automation_action_confluence_page_modal_title,
|
|
27
|
-
modalDescription: _messages.messages.automation_action_confluence_page_modal_description
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
return ProductData === null || ProductData === void 0 || (_ProductData$product = ProductData[product]) === null || _ProductData$product === void 0 ? void 0 : _ProductData$product[resourceType];
|
|
32
|
-
};
|
|
8
|
+
var _constants = require("../../../constants");
|
|
33
9
|
var extractAutomationAction = exports.extractAutomationAction = function extractAutomationAction(response) {
|
|
10
|
+
var _response$meta;
|
|
34
11
|
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platfom.smart-card.confluence.page.automation-action_xcdoi') || !response.data) {
|
|
35
12
|
return undefined;
|
|
36
13
|
}
|
|
14
|
+
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(_constants.ActionName.AutomationAction))) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
37
17
|
var data = response.data;
|
|
38
18
|
var meta = response.meta;
|
|
39
19
|
var name = data.name,
|
|
40
20
|
objectAri = data["atlassian:ari"];
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
21
|
+
var product = meta.product,
|
|
22
|
+
tenantId = meta.tenantId,
|
|
23
|
+
resourceType = meta.resourceType;
|
|
24
|
+
return {
|
|
25
|
+
product: product,
|
|
26
|
+
resourceType: resourceType,
|
|
27
|
+
siteAri: "ari:cloud:".concat(product, "::site/").concat(tenantId),
|
|
46
28
|
objectName: name,
|
|
47
29
|
objectAri: objectAri,
|
|
48
30
|
// TODO: The admin experience will be a follow up
|
|
49
31
|
canManageAutomation: false,
|
|
50
32
|
baseAutomationUrl: '',
|
|
51
33
|
analyticsSource: 'smartCard'
|
|
52
|
-
}
|
|
34
|
+
};
|
|
53
35
|
};
|
|
@@ -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: "27.4.
|
|
25
|
+
packageVersion: "27.4.1"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -52,7 +52,7 @@ var AutomationModal = exports.AutomationModal = function AutomationModal(_ref) {
|
|
|
52
52
|
emptyStateDescription: emptyStateDescription,
|
|
53
53
|
emptyStateAdminDescription: emptyStateAdminDescription,
|
|
54
54
|
onRuleInvocationSuccess: onClose,
|
|
55
|
-
|
|
55
|
+
onRuleInvocationFailure: function onRuleInvocationFailure() {
|
|
56
56
|
return setSelectedRule(undefined);
|
|
57
57
|
}
|
|
58
58
|
}, function () {
|
|
@@ -15,6 +15,7 @@ var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
|
15
15
|
var _modal = require("../../../../../state/modal");
|
|
16
16
|
var _constants = require("../../../../../constants");
|
|
17
17
|
var _messages = require("../../../../../messages");
|
|
18
|
+
var _utils = require("./utils");
|
|
18
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); }
|
|
19
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2.default)(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; }
|
|
20
21
|
var AutomationModal = /*#__PURE__*/(0, _react.lazy)(function () {
|
|
@@ -27,19 +28,23 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
27
28
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
28
29
|
formatMessage = _useIntl.formatMessage;
|
|
29
30
|
var modal = (0, _modal.useSmartLinkModal)();
|
|
31
|
+
var onClickCallback = props.onClick;
|
|
30
32
|
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
31
33
|
var automationActionData = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[_constants.ActionName.AutomationAction];
|
|
32
34
|
var automationActionOnClick = (0, _react.useCallback)(function (automationActionData) {
|
|
33
|
-
var
|
|
35
|
+
var product = automationActionData.product,
|
|
36
|
+
resourceType = automationActionData.resourceType,
|
|
37
|
+
baseAutomationUrl = automationActionData.baseAutomationUrl,
|
|
34
38
|
objectAri = automationActionData.objectAri,
|
|
35
39
|
siteAri = automationActionData.siteAri,
|
|
36
40
|
canManageAutomation = automationActionData.canManageAutomation,
|
|
37
41
|
analyticsSource = automationActionData.analyticsSource,
|
|
38
|
-
modalTitle = automationActionData.modalTitle,
|
|
39
|
-
modalDescription = automationActionData.modalDescription,
|
|
40
42
|
objectName = automationActionData.objectName;
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
+
var _ref = (0, _utils.getModalContent)(product, resourceType) || {},
|
|
44
|
+
modalTitle = _ref.modalTitle,
|
|
45
|
+
modalDescription = _ref.modalDescription;
|
|
46
|
+
var automationModalTitle = modalTitle ? /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, modalTitle) : undefined;
|
|
47
|
+
var automationModalDescription = modalDescription ? /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, modalDescription, {
|
|
43
48
|
values: {
|
|
44
49
|
name: objectName,
|
|
45
50
|
b: function b(chunks) {
|
|
@@ -47,7 +52,7 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
47
52
|
},
|
|
48
53
|
br: /*#__PURE__*/_react.default.createElement("br", null)
|
|
49
54
|
}
|
|
50
|
-
}));
|
|
55
|
+
})) : undefined;
|
|
51
56
|
modal.open( /*#__PURE__*/_react.default.createElement(AutomationModal, {
|
|
52
57
|
baseAutomationUrl: baseAutomationUrl,
|
|
53
58
|
objectAri: objectAri,
|
|
@@ -60,7 +65,8 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
60
65
|
return modal.close();
|
|
61
66
|
}
|
|
62
67
|
}));
|
|
63
|
-
|
|
68
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
69
|
+
}, [modal, onClickCallback]);
|
|
64
70
|
if (!automationActionData) {
|
|
65
71
|
return null;
|
|
66
72
|
}
|
|
@@ -74,7 +80,7 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
74
80
|
}),
|
|
75
81
|
testId: "smart-action-automation-action",
|
|
76
82
|
tooltipMessage: automationActionTooltip
|
|
77
|
-
},
|
|
83
|
+
}, props, {
|
|
78
84
|
onClick: function onClick() {
|
|
79
85
|
return automationActionOnClick(automationActionData);
|
|
80
86
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getModalContent = void 0;
|
|
7
|
+
var _messages = require("../../../../../../messages");
|
|
8
|
+
var getModalContent = exports.getModalContent = function getModalContent(product, resourceType) {
|
|
9
|
+
var _modalContentMap$prod;
|
|
10
|
+
var modalContentMap = {
|
|
11
|
+
'confluence': {
|
|
12
|
+
'page': {
|
|
13
|
+
modalTitle: _messages.messages.automation_action_confluence_page_modal_title,
|
|
14
|
+
modalDescription: _messages.messages.automation_action_confluence_page_modal_description
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return modalContentMap === null || modalContentMap === void 0 || (_modalContentMap$prod = modalContentMap[product]) === null || _modalContentMap$prod === void 0 ? void 0 : _modalContentMap$prod[resourceType];
|
|
19
|
+
};
|
|
@@ -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: "27.4.
|
|
20
|
+
packageVersion: "27.4.1",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -1,43 +1,28 @@
|
|
|
1
1
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import {
|
|
3
|
-
// This action will not be enabled by default for smart cards, which is opposite of the default behavior for actions.
|
|
4
|
-
// The AutomationAction will only appear if product/resourceType combination is handled by this function.
|
|
5
|
-
const getProductData = meta => {
|
|
6
|
-
var _ProductData$product;
|
|
7
|
-
const {
|
|
8
|
-
tenantId
|
|
9
|
-
} = meta;
|
|
10
|
-
const product = meta.product;
|
|
11
|
-
const resourceType = meta.resourceType;
|
|
12
|
-
const ProductData = {
|
|
13
|
-
'confluence': {
|
|
14
|
-
'page': {
|
|
15
|
-
//TODO extract to server
|
|
16
|
-
siteAri: `ari:cloud:confluence::site/${tenantId}`,
|
|
17
|
-
//TODO Move to AutomationAction
|
|
18
|
-
modalTitle: messages.automation_action_confluence_page_modal_title,
|
|
19
|
-
modalDescription: messages.automation_action_confluence_page_modal_description
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return ProductData === null || ProductData === void 0 ? void 0 : (_ProductData$product = ProductData[product]) === null || _ProductData$product === void 0 ? void 0 : _ProductData$product[resourceType];
|
|
24
|
-
};
|
|
2
|
+
import { ActionName } from '../../../constants';
|
|
25
3
|
export const extractAutomationAction = response => {
|
|
4
|
+
var _response$meta, _response$meta$suppor;
|
|
26
5
|
if (!getBooleanFF('platform.linking-platfom.smart-card.confluence.page.automation-action_xcdoi') || !response.data) {
|
|
27
6
|
return undefined;
|
|
28
7
|
}
|
|
8
|
+
if (!(response !== null && response !== void 0 && (_response$meta = response.meta) !== null && _response$meta !== void 0 && (_response$meta$suppor = _response$meta.supportedFeature) !== null && _response$meta$suppor !== void 0 && _response$meta$suppor.includes(ActionName.AutomationAction))) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
29
11
|
const data = response.data;
|
|
30
12
|
const meta = response.meta;
|
|
31
13
|
const {
|
|
32
14
|
name,
|
|
33
15
|
"atlassian:ari": objectAri
|
|
34
16
|
} = data;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
const {
|
|
18
|
+
product,
|
|
19
|
+
tenantId,
|
|
20
|
+
resourceType
|
|
21
|
+
} = meta;
|
|
39
22
|
return {
|
|
40
|
-
|
|
23
|
+
product: product,
|
|
24
|
+
resourceType: resourceType,
|
|
25
|
+
siteAri: `ari:cloud:${product}::site/${tenantId}`,
|
|
41
26
|
objectName: name,
|
|
42
27
|
objectAri: objectAri,
|
|
43
28
|
// TODO: The admin experience will be a follow up
|
|
@@ -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: "27.4.
|
|
7
|
+
packageVersion: "27.4.1"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -40,7 +40,7 @@ export const AutomationModal = ({
|
|
|
40
40
|
emptyStateDescription: emptyStateDescription,
|
|
41
41
|
emptyStateAdminDescription: emptyStateAdminDescription,
|
|
42
42
|
onRuleInvocationSuccess: onClose,
|
|
43
|
-
|
|
43
|
+
onRuleInvocationFailure: () => setSelectedRule(undefined)
|
|
44
44
|
}, () => {
|
|
45
45
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
46
46
|
onClose: onClose,
|
|
@@ -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.4.
|
|
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.4.
|
|
18
|
+
packageVersion: "27.4.1"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -42,7 +42,7 @@ export var AutomationModal = function AutomationModal(_ref) {
|
|
|
42
42
|
emptyStateDescription: emptyStateDescription,
|
|
43
43
|
emptyStateAdminDescription: emptyStateAdminDescription,
|
|
44
44
|
onRuleInvocationSuccess: onClose,
|
|
45
|
-
|
|
45
|
+
onRuleInvocationFailure: function onRuleInvocationFailure() {
|
|
46
46
|
return setSelectedRule(undefined);
|
|
47
47
|
}
|
|
48
48
|
}, function () {
|
|
@@ -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.4.
|
|
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,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,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 {};
|