@atlaskit/smart-card 27.2.3 → 27.4.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +10 -13
  3. package/dist/cjs/utils/analytics/analytics.js +1 -1
  4. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +7 -3
  5. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +21 -5
  6. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +2 -2
  7. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +1 -1
  8. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/index.js +12 -0
  9. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/main.js +43 -0
  10. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +2 -2
  11. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +4 -2
  12. package/dist/cjs/view/LinkUrl/index.js +1 -1
  13. package/dist/cjs/view/RelatedLinksModal/components/related-link-item/index.js +2 -1
  14. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +2 -6
  15. package/dist/es2019/utils/analytics/analytics.js +1 -1
  16. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +5 -3
  17. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +16 -4
  18. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +2 -2
  19. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +1 -1
  20. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/index.js +2 -0
  21. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/main.js +37 -0
  22. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +2 -2
  23. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -1
  24. package/dist/es2019/view/LinkUrl/index.js +1 -1
  25. package/dist/es2019/view/RelatedLinksModal/components/related-link-item/index.js +2 -1
  26. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +11 -14
  27. package/dist/esm/utils/analytics/analytics.js +1 -1
  28. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +7 -3
  29. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +22 -6
  30. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +2 -2
  31. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +1 -1
  32. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/index.js +2 -0
  33. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/execution-state-message/main.js +36 -0
  34. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +2 -2
  35. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +4 -2
  36. package/dist/esm/view/LinkUrl/index.js +1 -1
  37. package/dist/esm/view/RelatedLinksModal/components/related-link-item/index.js +2 -1
  38. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.d.ts +1 -1
  39. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +4 -1
  40. 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
  41. 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
  42. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +2 -1
  43. package/dist/types/view/FlexibleCard/components/elements/badge/index.d.ts +2 -3
  44. package/dist/types/view/FlexibleCard/components/elements/badge/types.d.ts +6 -1
  45. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.d.ts +1 -1
  46. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +4 -1
  47. 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
  48. 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
  49. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +2 -1
  50. package/dist/types-ts4.5/view/FlexibleCard/components/elements/badge/index.d.ts +2 -3
  51. package/dist/types-ts4.5/view/FlexibleCard/components/elements/badge/types.d.ts +6 -1
  52. package/package.json +2 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 27.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#104944](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104944)
8
+ [`2254e1b73d47`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2254e1b73d47) -
9
+ [ux] Error message for failed automation rule invocation.
10
+
11
+ ## 27.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#105107](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105107)
16
+ [`7f17454f0c3e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7f17454f0c3e) -
17
+ Remove FF for AI Summaries base url
18
+ - [#104259](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104259)
19
+ [`25205c2df930`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/25205c2df930) -
20
+ Added option to hide badge icon for Provider element
21
+
3
22
  ## 27.2.3
4
23
 
5
24
  ### Patch Changes
@@ -15,7 +15,6 @@ var _types = require("./types");
15
15
  var _utils = require("./utils");
16
16
  var _readStream = require("./readStream");
17
17
  var _linkingCommon = require("@atlaskit/linking-common");
18
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
18
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
20
19
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
20
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -42,7 +41,7 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
42
41
  return (0, _utils.addPath)('/gateway/api/', path);
43
42
  });
44
43
  (0, _defineProperty2.default)(this, "fetchStream", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
45
- var payload, options, requestURL, response;
44
+ var payload, options, response;
46
45
  return _regenerator.default.wrap(function _callee$(_context) {
47
46
  while (1) switch (_context.prev = _context.next) {
48
47
  case 0:
@@ -55,26 +54,24 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
55
54
  summary_output_mimetype: 'text/markdown'
56
55
  }
57
56
  };
58
- options = _objectSpread({
57
+ options = {
59
58
  method: 'POST',
60
59
  headers: _this.config.headers,
61
- body: JSON.stringify(payload)
62
- }, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.ai-summary-service-base-url') && {
60
+ body: JSON.stringify(payload),
63
61
  credentials: 'include'
64
- });
65
- requestURL = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.ai-summary-service-base-url') ? _this.config.requestUrl : '/gateway/api/assist/chat/v1/invoke_agent/stream';
66
- _context.next = 5;
67
- return fetch(requestURL, options);
68
- case 5:
62
+ };
63
+ _context.next = 4;
64
+ return fetch(_this.config.requestUrl, options);
65
+ case 4:
69
66
  response = _context.sent;
70
67
  if (!(!response.ok || response.status >= 400)) {
71
- _context.next = 10;
68
+ _context.next = 9;
72
69
  break;
73
70
  }
74
71
  throw new Error("Status: ".concat(response.status, "\n URL: ").concat(_this.url, "\n StatusText ").concat(response.statusText));
75
- case 10:
72
+ case 9:
76
73
  return _context.abrupt("return", (0, _readStream.readStream)(response));
77
- case 11:
74
+ case 10:
78
75
  case "end":
79
76
  return _context.stop();
80
77
  }
@@ -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.2.3"
25
+ packageVersion: "27.4.0"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -11,9 +11,10 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var _analyticsNext = require("@atlaskit/analytics-next");
12
12
  var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
13
13
  var _menuContext = require("./menu-context");
14
+ var _header = require("./sub-components/header");
14
15
  var _body = require("./sub-components/body");
16
+ var _executionStateMessage = require("./sub-components/execution-state-message");
15
17
  var _footer = require("./sub-components/footer");
16
- var _header = require("./sub-components/header");
17
18
  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); }
18
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(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; }
19
20
  var AutomationModal = exports.AutomationModal = function AutomationModal(_ref) {
@@ -50,7 +51,10 @@ var AutomationModal = exports.AutomationModal = function AutomationModal(_ref) {
50
51
  analyticsSource: analyticsSource,
51
52
  emptyStateDescription: emptyStateDescription,
52
53
  emptyStateAdminDescription: emptyStateAdminDescription,
53
- onRuleInvocationLifecycleDone: onClose
54
+ onRuleInvocationSuccess: onClose,
55
+ onRuleInvocationLifecycleDone: function onRuleInvocationLifecycleDone() {
56
+ return setSelectedRule(undefined);
57
+ }
54
58
  }, function () {
55
59
  return /*#__PURE__*/_react.default.createElement(_modalDialog.default, {
56
60
  onClose: onClose,
@@ -64,7 +68,7 @@ var AutomationModal = exports.AutomationModal = function AutomationModal(_ref) {
64
68
  }), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, /*#__PURE__*/_react.default.createElement(_body.AutomationModalBody, {
65
69
  selectedRule: selectedRule,
66
70
  setSelectedRule: setSelectedRule
67
- })), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_footer.AutomationModalFooter, {
71
+ })), /*#__PURE__*/_react.default.createElement(_executionStateMessage.AutomationModalExecutionState, null), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_footer.AutomationModalFooter, {
68
72
  selectedRule: selectedRule,
69
73
  onClose: onClose
70
74
  })));
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.useAutomationMenu = exports.AutomationMenuContextContainer = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
11
  var _react = _interopRequireWildcard(require("react"));
11
12
  var _manualTriggersContainer = require("../../manual-triggers-container");
12
13
  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); }
@@ -41,25 +42,40 @@ var AutomationMenuContextContainer = exports.AutomationMenuContextContainer = fu
41
42
  children = _ref2.children,
42
43
  emptyStateDescription = _ref2.emptyStateDescription,
43
44
  emptyStateAdminDescription = _ref2.emptyStateAdminDescription,
44
- onRuleInvocationSuccess = _ref2.onRuleInvocationSuccess,
45
- onRuleInvocationFailure = _ref2.onRuleInvocationFailure,
45
+ _onRuleInvocationSuccess = _ref2.onRuleInvocationSuccess,
46
+ _onRuleInvocationFailure = _ref2.onRuleInvocationFailure,
46
47
  onRuleInvocationLifecycleDone = _ref2.onRuleInvocationLifecycleDone;
48
+ var _useState = (0, _react.useState)('NONE'),
49
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
50
+ ruleExecutionState = _useState2[0],
51
+ setRuleExecutionState = _useState2[1];
47
52
  return /*#__PURE__*/_react.default.createElement(_manualTriggersContainer.ManualRulesContainer, {
48
53
  site: siteAri,
49
54
  query: {
50
55
  objects: [objectAri]
51
56
  },
57
+ onRuleInvocationLifecycleStarted: function onRuleInvocationLifecycleStarted() {
58
+ setRuleExecutionState('NONE');
59
+ },
52
60
  onRuleInvocationLifecycleDone: onRuleInvocationLifecycleDone,
53
- onRuleInvocationSuccess: onRuleInvocationSuccess,
54
- onRuleInvocationFailure: onRuleInvocationFailure
61
+ onRuleInvocationSuccess: function onRuleInvocationSuccess() {
62
+ setRuleExecutionState('SUCCEED');
63
+ _onRuleInvocationSuccess === null || _onRuleInvocationSuccess === void 0 || _onRuleInvocationSuccess();
64
+ },
65
+ onRuleInvocationFailure: function onRuleInvocationFailure() {
66
+ setRuleExecutionState('FAILURE');
67
+ _onRuleInvocationFailure === null || _onRuleInvocationFailure === void 0 || _onRuleInvocationFailure();
68
+ }
55
69
  }, function (props) {
56
70
  var contextValue = _objectSpread(_objectSpread({}, props), {}, {
71
+ fetchError: props.error,
57
72
  analyticsSource: analyticsSource,
58
73
  objectAri: objectAri,
59
74
  baseAutomationUrl: baseAutomationUrl,
60
75
  canManageAutomation: canManageAutomation,
61
76
  emptyStateDescription: emptyStateDescription,
62
- emptyStateAdminDescription: emptyStateAdminDescription
77
+ emptyStateAdminDescription: emptyStateAdminDescription,
78
+ ruleExecutionState: ruleExecutionState
63
79
  });
64
80
  return /*#__PURE__*/_react.default.createElement(AutomationMenuProvider, {
65
81
  value: contextValue
@@ -19,7 +19,7 @@ var AutomationModalBody = exports.AutomationModalBody = function AutomationModal
19
19
  triggerFetch = _useAutomationMenu.triggerFetch,
20
20
  initialised = _useAutomationMenu.initialised,
21
21
  rules = _useAutomationMenu.rules,
22
- error = _useAutomationMenu.error;
22
+ fetchError = _useAutomationMenu.fetchError;
23
23
  (0, _react.useEffect)(function () {
24
24
  void triggerFetch();
25
25
  // Want to ensure that triggerFetch is only called once when the component is mounted.
@@ -29,7 +29,7 @@ var AutomationModalBody = exports.AutomationModalBody = function AutomationModal
29
29
  return /*#__PURE__*/_react.default.createElement(_skeleton.Skeleton, {
30
30
  lineCount: 10
31
31
  });
32
- } else if (error && rules.length === 0) {
32
+ } else if (fetchError && rules.length === 0) {
33
33
  return /*#__PURE__*/_react.default.createElement(_errorState.AutomationModalErrorState, null);
34
34
  }
35
35
  return /*#__PURE__*/_react.default.createElement(_ruleList.AutomationModalRuleList, {
@@ -29,7 +29,7 @@ var imageContainerStyles = (0, _primitives.xcss)({
29
29
  display: 'block',
30
30
  maxWidth: '116px',
31
31
  maxHeight: '156px',
32
- marginBottom: "var(--ds-space-300, 24px)",
32
+ marginBottom: 'space.300',
33
33
  marginTop: 'space.050'
34
34
  });
35
35
  var descriptionStyles = (0, _primitives.xcss)({
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AutomationModalExecutionState", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _main.AutomationModalExecutionState;
10
+ }
11
+ });
12
+ var _main = require("./main");
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AutomationModalExecutionState = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _primitives = require("@atlaskit/primitives");
11
+ var _sectionMessage = _interopRequireDefault(require("@atlaskit/section-message"));
12
+ var _menuContext = require("../../menu-context");
13
+ var i18n = (0, _reactIntlNext.defineMessages)({
14
+ ruleExecutionSuccessMessage: {
15
+ id: 'automation-menu.success-state.message',
16
+ defaultMessage: 'Your automation is in progress',
17
+ description: 'Message that is displayed when a users automation rule has been successfully queued.'
18
+ },
19
+ ruleExecutionErrorMessage: {
20
+ id: 'automation-menu.modal.error.description',
21
+ defaultMessage: 'Oops we ran into a problem',
22
+ description: "Description for the error section shown when rules can't be executed"
23
+ }
24
+ });
25
+ var messageStyling = (0, _primitives.xcss)({
26
+ marginInline: 'space.300',
27
+ marginTop: 'space.100',
28
+ // The ModalFooter comes with a lot of built in margin, want to nudge the error message in to the footer a bit
29
+ marginBottom: 'space.negative.100'
30
+ });
31
+ var AutomationModalExecutionState = exports.AutomationModalExecutionState = function AutomationModalExecutionState() {
32
+ var _useAutomationMenu = (0, _menuContext.useAutomationMenu)(),
33
+ ruleExecutionState = _useAutomationMenu.ruleExecutionState;
34
+ if (ruleExecutionState === 'FAILURE') {
35
+ return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
36
+ xcss: messageStyling
37
+ }, /*#__PURE__*/_react.default.createElement(_sectionMessage.default, {
38
+ appearance: "error"
39
+ }, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, i18n.ruleExecutionErrorMessage)));
40
+ } else {
41
+ return null;
42
+ }
43
+ };
@@ -44,7 +44,7 @@ var AutomationModalFooter = exports.AutomationModalFooter = function AutomationM
44
44
  invokeRuleOrShowDialog = _useAutomationMenu.invokeRuleOrShowDialog,
45
45
  invokingRuleId = _useAutomationMenu.invokingRuleId,
46
46
  rules = _useAutomationMenu.rules,
47
- error = _useAutomationMenu.error,
47
+ fetchError = _useAutomationMenu.fetchError,
48
48
  baseAutomationUrl = _useAutomationMenu.baseAutomationUrl,
49
49
  analyticsSource = _useAutomationMenu.analyticsSource;
50
50
  var sendFooterAnalyticsEvent = function sendFooterAnalyticsEvent(actionSubjectId, ruleId) {
@@ -109,7 +109,7 @@ var AutomationModalFooter = exports.AutomationModalFooter = function AutomationM
109
109
  // Empty admin scenario -> cancel and Create Automation buttons
110
110
  // Empty end user and error scenario -> Ok button
111
111
  if (rules.length < 1) {
112
- if (error || !canManageAutomation) {
112
+ if (fetchError || !canManageAutomation) {
113
113
  modalButtons.push(okButton);
114
114
  } else {
115
115
  modalButtons.push(cancelButton, createAutomationButton);
@@ -74,7 +74,9 @@ var renderImageIcon = function renderImageIcon(url, testId) {
74
74
  * @see Provider
75
75
  */
76
76
  var Badge = function Badge(_ref) {
77
- var icon = _ref.icon,
77
+ var _ref$hideIcon = _ref.hideIcon,
78
+ hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
79
+ icon = _ref.icon,
78
80
  label = _ref.label,
79
81
  name = _ref.name,
80
82
  overrideCss = _ref.overrideCss,
@@ -92,7 +94,7 @@ var Badge = function Badge(_ref) {
92
94
  "data-smart-element": name,
93
95
  "data-smart-element-badge": true,
94
96
  "data-testid": testId
95
- }, (0, _react2.jsx)("span", {
97
+ }, !hideIcon && (0, _react2.jsx)("span", {
96
98
  css: iconStyles
97
99
  }, badgeIcon), (0, _react2.jsx)("span", {
98
100
  css: labelStyles,
@@ -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.2.3",
20
+ packageVersion: "27.4.0",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -27,7 +27,8 @@ var RelatedLinkItem = function RelatedLinkItem(_ref) {
27
27
  var url = _ref.url,
28
28
  testId = _ref.testId;
29
29
  var subtitle = [{
30
- name: _index.ElementName.Provider
30
+ name: _index.ElementName.Provider,
31
+ hideIcon: true
31
32
  }];
32
33
  var ui = {
33
34
  hideElevation: true,
@@ -4,7 +4,6 @@ import { errorMessages } from './types';
4
4
  import { addPath, getXProductHeaderValue } from './utils';
5
5
  import { readStream } from './readStream';
6
6
  import { getBaseUrl } from '@atlaskit/linking-common';
7
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
7
  export class AISummaryService {
9
8
  constructor(props) {
10
9
  var _getXProductHeaderVal;
@@ -35,12 +34,9 @@ export class AISummaryService {
35
34
  method: 'POST',
36
35
  headers: this.config.headers,
37
36
  body: JSON.stringify(payload),
38
- ...(getBooleanFF('platform.linking-platform.smart-card.ai-summary-service-base-url') && {
39
- credentials: 'include'
40
- })
37
+ credentials: 'include'
41
38
  };
42
- const requestURL = getBooleanFF('platform.linking-platform.smart-card.ai-summary-service-base-url') ? this.config.requestUrl : '/gateway/api/assist/chat/v1/invoke_agent/stream';
43
- const response = await fetch(requestURL, options);
39
+ const response = await fetch(this.config.requestUrl, options);
44
40
  if (!response.ok || response.status >= 400) {
45
41
  throw new Error(`Status: ${response.status}\n URL: ${this.url}\n StatusText ${response.statusText}`);
46
42
  } else {
@@ -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.2.3"
7
+ packageVersion: "27.4.0"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -2,9 +2,10 @@ import React, { useEffect, useState } from 'react';
2
2
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
3
3
  import Modal, { ModalBody, ModalFooter } from '@atlaskit/modal-dialog';
4
4
  import { AutomationMenuContextContainer } from './menu-context';
5
+ import { AutomationModalHeader } from './sub-components/header';
5
6
  import { AutomationModalBody } from './sub-components/body';
7
+ import { AutomationModalExecutionState } from './sub-components/execution-state-message';
6
8
  import { AutomationModalFooter } from './sub-components/footer';
7
- import { AutomationModalHeader } from './sub-components/header';
8
9
  export const AutomationModal = ({
9
10
  baseAutomationUrl,
10
11
  siteAri,
@@ -38,7 +39,8 @@ export const AutomationModal = ({
38
39
  analyticsSource: analyticsSource,
39
40
  emptyStateDescription: emptyStateDescription,
40
41
  emptyStateAdminDescription: emptyStateAdminDescription,
41
- onRuleInvocationLifecycleDone: onClose
42
+ onRuleInvocationSuccess: onClose,
43
+ onRuleInvocationLifecycleDone: () => setSelectedRule(undefined)
42
44
  }, () => {
43
45
  return /*#__PURE__*/React.createElement(Modal, {
44
46
  onClose: onClose,
@@ -52,7 +54,7 @@ export const AutomationModal = ({
52
54
  }), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(AutomationModalBody, {
53
55
  selectedRule: selectedRule,
54
56
  setSelectedRule: setSelectedRule
55
- })), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(AutomationModalFooter, {
57
+ })), /*#__PURE__*/React.createElement(AutomationModalExecutionState, null), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(AutomationModalFooter, {
56
58
  selectedRule: selectedRule,
57
59
  onClose: onClose
58
60
  })));
@@ -1,7 +1,7 @@
1
1
  // This is another layer on top of the AFE ManualRulesContainer.
2
2
  // It is necessary that this container wraps the entire "automation" component and not nested. Else the user input form will not render correctly.
3
3
  // This container provides an automation context to all children components through the useAutomationMenu hook.
4
- import React, { createContext, useContext } from 'react';
4
+ import React, { createContext, useContext, useState } from 'react';
5
5
  import { ManualRulesContainer } from '../../manual-triggers-container';
6
6
  const AutomationMenuContext = /*#__PURE__*/createContext(undefined);
7
7
  const AutomationMenuProvider = ({
@@ -34,23 +34,35 @@ export const AutomationMenuContextContainer = ({
34
34
  onRuleInvocationFailure,
35
35
  onRuleInvocationLifecycleDone
36
36
  }) => {
37
+ const [ruleExecutionState, setRuleExecutionState] = useState('NONE');
37
38
  return /*#__PURE__*/React.createElement(ManualRulesContainer, {
38
39
  site: siteAri,
39
40
  query: {
40
41
  objects: [objectAri]
41
42
  },
43
+ onRuleInvocationLifecycleStarted: () => {
44
+ setRuleExecutionState('NONE');
45
+ },
42
46
  onRuleInvocationLifecycleDone: onRuleInvocationLifecycleDone,
43
- onRuleInvocationSuccess: onRuleInvocationSuccess,
44
- onRuleInvocationFailure: onRuleInvocationFailure
47
+ onRuleInvocationSuccess: () => {
48
+ setRuleExecutionState('SUCCEED');
49
+ onRuleInvocationSuccess === null || onRuleInvocationSuccess === void 0 ? void 0 : onRuleInvocationSuccess();
50
+ },
51
+ onRuleInvocationFailure: () => {
52
+ setRuleExecutionState('FAILURE');
53
+ onRuleInvocationFailure === null || onRuleInvocationFailure === void 0 ? void 0 : onRuleInvocationFailure();
54
+ }
45
55
  }, props => {
46
56
  const contextValue = {
47
57
  ...props,
58
+ fetchError: props.error,
48
59
  analyticsSource,
49
60
  objectAri,
50
61
  baseAutomationUrl,
51
62
  canManageAutomation,
52
63
  emptyStateDescription,
53
- emptyStateAdminDescription
64
+ emptyStateAdminDescription,
65
+ ruleExecutionState
54
66
  };
55
67
  return /*#__PURE__*/React.createElement(AutomationMenuProvider, {
56
68
  value: contextValue
@@ -11,7 +11,7 @@ export const AutomationModalBody = ({
11
11
  triggerFetch,
12
12
  initialised,
13
13
  rules,
14
- error
14
+ fetchError
15
15
  } = useAutomationMenu();
16
16
  useEffect(() => {
17
17
  void triggerFetch();
@@ -22,7 +22,7 @@ export const AutomationModalBody = ({
22
22
  return /*#__PURE__*/React.createElement(Skeleton, {
23
23
  lineCount: 10
24
24
  });
25
- } else if (error && rules.length === 0) {
25
+ } else if (fetchError && rules.length === 0) {
26
26
  return /*#__PURE__*/React.createElement(AutomationModalErrorState, null);
27
27
  }
28
28
  return /*#__PURE__*/React.createElement(AutomationModalRuleList, {
@@ -22,7 +22,7 @@ const imageContainerStyles = xcss({
22
22
  display: 'block',
23
23
  maxWidth: '116px',
24
24
  maxHeight: '156px',
25
- marginBottom: "var(--ds-space-300, 24px)",
25
+ marginBottom: 'space.300',
26
26
  marginTop: 'space.050'
27
27
  });
28
28
  const descriptionStyles = xcss({
@@ -0,0 +1,2 @@
1
+ import { AutomationModalExecutionState } from './main';
2
+ export { AutomationModalExecutionState };
@@ -0,0 +1,37 @@
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
+ const 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
+ const 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 const AutomationModalExecutionState = () => {
25
+ const {
26
+ ruleExecutionState
27
+ } = useAutomationMenu();
28
+ if (ruleExecutionState === 'FAILURE') {
29
+ return /*#__PURE__*/React.createElement(Box, {
30
+ xcss: messageStyling
31
+ }, /*#__PURE__*/React.createElement(SectionMessage, {
32
+ appearance: "error"
33
+ }, /*#__PURE__*/React.createElement(FormattedMessage, i18n.ruleExecutionErrorMessage)));
34
+ } else {
35
+ return null;
36
+ }
37
+ };
@@ -39,7 +39,7 @@ export const AutomationModalFooter = ({
39
39
  invokeRuleOrShowDialog,
40
40
  invokingRuleId,
41
41
  rules,
42
- error,
42
+ fetchError,
43
43
  baseAutomationUrl,
44
44
  analyticsSource
45
45
  } = useAutomationMenu();
@@ -105,7 +105,7 @@ export const AutomationModalFooter = ({
105
105
  // Empty admin scenario -> cancel and Create Automation buttons
106
106
  // Empty end user and error scenario -> Ok button
107
107
  if (rules.length < 1) {
108
- if (error || !canManageAutomation) {
108
+ if (fetchError || !canManageAutomation) {
109
109
  modalButtons.push(okButton);
110
110
  } else {
111
111
  modalButtons.push(cancelButton, createAutomationButton);
@@ -87,6 +87,7 @@ const renderImageIcon = (url, testId) => {
87
87
  * @see Provider
88
88
  */
89
89
  const Badge = ({
90
+ hideIcon = false,
90
91
  icon,
91
92
  label,
92
93
  name,
@@ -105,7 +106,7 @@ const Badge = ({
105
106
  "data-smart-element": name,
106
107
  "data-smart-element-badge": true,
107
108
  "data-testid": testId
108
- }, jsx("span", {
109
+ }, !hideIcon && jsx("span", {
109
110
  css: iconStyles
110
111
  }, badgeIcon), jsx("span", {
111
112
  css: labelStyles,
@@ -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.2.3",
10
+ packageVersion: "27.4.0",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -21,7 +21,8 @@ const RelatedLinkItem = ({
21
21
  testId
22
22
  }) => {
23
23
  const subtitle = [{
24
- name: ElementName.Provider
24
+ name: ElementName.Provider,
25
+ hideIcon: true
25
26
  }];
26
27
  const ui = {
27
28
  hideElevation: true,
@@ -5,9 +5,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
7
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
- import _regeneratorRuntime from "@babel/runtime/regenerator";
9
8
  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; }
10
9
  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; }
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
12
12
  function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
13
13
  import uuid from 'uuid';
@@ -15,7 +15,6 @@ import { errorMessages } from './types';
15
15
  import { addPath, getXProductHeaderValue } from './utils';
16
16
  import { readStream } from './readStream';
17
17
  import { getBaseUrl } from '@atlaskit/linking-common';
18
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
19
18
  export var AISummaryService = /*#__PURE__*/function () {
20
19
  function AISummaryService(props) {
21
20
  var _this = this,
@@ -35,7 +34,7 @@ export var AISummaryService = /*#__PURE__*/function () {
35
34
  return addPath('/gateway/api/', path);
36
35
  });
37
36
  _defineProperty(this, "fetchStream", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
38
- var payload, options, requestURL, response;
37
+ var payload, options, response;
39
38
  return _regeneratorRuntime.wrap(function _callee$(_context) {
40
39
  while (1) switch (_context.prev = _context.next) {
41
40
  case 0:
@@ -48,26 +47,24 @@ export var AISummaryService = /*#__PURE__*/function () {
48
47
  summary_output_mimetype: 'text/markdown'
49
48
  }
50
49
  };
51
- options = _objectSpread({
50
+ options = {
52
51
  method: 'POST',
53
52
  headers: _this.config.headers,
54
- body: JSON.stringify(payload)
55
- }, getBooleanFF('platform.linking-platform.smart-card.ai-summary-service-base-url') && {
53
+ body: JSON.stringify(payload),
56
54
  credentials: 'include'
57
- });
58
- requestURL = getBooleanFF('platform.linking-platform.smart-card.ai-summary-service-base-url') ? _this.config.requestUrl : '/gateway/api/assist/chat/v1/invoke_agent/stream';
59
- _context.next = 5;
60
- return fetch(requestURL, options);
61
- case 5:
55
+ };
56
+ _context.next = 4;
57
+ return fetch(_this.config.requestUrl, options);
58
+ case 4:
62
59
  response = _context.sent;
63
60
  if (!(!response.ok || response.status >= 400)) {
64
- _context.next = 10;
61
+ _context.next = 9;
65
62
  break;
66
63
  }
67
64
  throw new Error("Status: ".concat(response.status, "\n URL: ").concat(_this.url, "\n StatusText ").concat(response.statusText));
68
- case 10:
65
+ case 9:
69
66
  return _context.abrupt("return", readStream(response));
70
- case 11:
67
+ case 10:
71
68
  case "end":
72
69
  return _context.stop();
73
70
  }
@@ -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.2.3"
18
+ packageVersion: "27.4.0"
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
- onRuleInvocationLifecycleDone: onClose
44
+ onRuleInvocationSuccess: onClose,
45
+ onRuleInvocationLifecycleDone: function onRuleInvocationLifecycleDone() {
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
- onRuleInvocationSuccess = _ref2.onRuleInvocationSuccess,
36
- onRuleInvocationFailure = _ref2.onRuleInvocationFailure,
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
- onRuleInvocationFailure: onRuleInvocationFailure
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
- error = _useAutomationMenu.error;
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 (error && rules.length === 0) {
23
+ } else if (fetchError && rules.length === 0) {
24
24
  return /*#__PURE__*/React.createElement(AutomationModalErrorState, null);
25
25
  }
26
26
  return /*#__PURE__*/React.createElement(AutomationModalRuleList, {
@@ -22,7 +22,7 @@ var imageContainerStyles = xcss({
22
22
  display: 'block',
23
23
  maxWidth: '116px',
24
24
  maxHeight: '156px',
25
- marginBottom: "var(--ds-space-300, 24px)",
25
+ marginBottom: 'space.300',
26
26
  marginTop: 'space.050'
27
27
  });
28
28
  var descriptionStyles = xcss({
@@ -0,0 +1,2 @@
1
+ import { AutomationModalExecutionState } from './main';
2
+ export { AutomationModalExecutionState };
@@ -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
- error = _useAutomationMenu.error,
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 (error || !canManageAutomation) {
105
+ if (fetchError || !canManageAutomation) {
106
106
  modalButtons.push(okButton);
107
107
  } else {
108
108
  modalButtons.push(cancelButton, createAutomationButton);
@@ -67,7 +67,9 @@ var renderImageIcon = function renderImageIcon(url, testId) {
67
67
  * @see Provider
68
68
  */
69
69
  var Badge = function Badge(_ref) {
70
- var icon = _ref.icon,
70
+ var _ref$hideIcon = _ref.hideIcon,
71
+ hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
72
+ icon = _ref.icon,
71
73
  label = _ref.label,
72
74
  name = _ref.name,
73
75
  overrideCss = _ref.overrideCss,
@@ -85,7 +87,7 @@ var Badge = function Badge(_ref) {
85
87
  "data-smart-element": name,
86
88
  "data-smart-element-badge": true,
87
89
  "data-testid": testId
88
- }, jsx("span", {
90
+ }, !hideIcon && jsx("span", {
89
91
  css: iconStyles
90
92
  }, badgeIcon), jsx("span", {
91
93
  css: labelStyles,
@@ -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.2.3",
13
+ packageVersion: "27.4.0",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -20,7 +20,8 @@ var RelatedLinkItem = function RelatedLinkItem(_ref) {
20
20
  var url = _ref.url,
21
21
  testId = _ref.testId;
22
22
  var subtitle = [{
23
- name: ElementName.Provider
23
+ name: ElementName.Provider,
24
+ hideIcon: true
24
25
  }];
25
26
  var ui = {
26
27
  hideElevation: true,
@@ -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 MenuContext = ManualRulesData & {
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;
@@ -0,0 +1,2 @@
1
+ import { AutomationModalExecutionState } from './main';
2
+ export { AutomationModalExecutionState };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const AutomationModalExecutionState: () => JSX.Element | null;
@@ -357,11 +357,12 @@ export type ProgrammingLanguage = {
357
357
  name: ElementName.ProgrammingLanguage;
358
358
  };
359
359
  /**
360
- * Represents the props available for an Provider element.
360
+ * Represents the props available for a Provider element.
361
361
  * @see Provider
362
362
  */
363
363
  export type Provider = {
364
364
  name: ElementName.Provider;
365
+ hideIcon?: boolean;
365
366
  };
366
367
  /**
367
368
  * Represents the props available for an ReactCount element.
@@ -1,5 +1,4 @@
1
- /** @jsx jsx */
2
- import React from 'react';
1
+ import { jsx } from '@emotion/react';
3
2
  import { type BadgeProps } from './types';
4
3
  /**
5
4
  * A base element that displays some text with an associated icon.
@@ -14,5 +13,5 @@ import { type BadgeProps } from './types';
14
13
  * @see ProgrammingLanguage
15
14
  * @see Provider
16
15
  */
17
- declare const Badge: React.FC<BadgeProps>;
16
+ declare const Badge: ({ hideIcon, icon, label, name, overrideCss, testId, url, }: BadgeProps) => jsx.JSX.Element | null;
18
17
  export default Badge;
@@ -1,6 +1,11 @@
1
1
  import { type ElementProps } from '../types';
2
2
  import { type IconType } from '../../../../../constants';
3
3
  export type BadgeProps = ElementProps & {
4
+ /**
5
+ * Determines whether the badge icon should be hidden. When set to true,
6
+ * the badge will be displayed without the icon, showing only the label text.
7
+ */
8
+ hideIcon?: boolean;
4
9
  /**
5
10
  * The Atlaskit Icon to display next to the label. If this is not supplied,
6
11
  * then the badge icon will fallback to the URL provided.
@@ -11,7 +16,7 @@ export type BadgeProps = ElementProps & {
11
16
  */
12
17
  url?: string;
13
18
  /**
14
- * The text to display for the badge
19
+ * The text to display for the badge.
15
20
  */
16
21
  label?: string;
17
22
  };
@@ -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 MenuContext = ManualRulesData & {
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;
@@ -0,0 +1,2 @@
1
+ import { AutomationModalExecutionState } from './main';
2
+ export { AutomationModalExecutionState };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const AutomationModalExecutionState: () => JSX.Element | null;
@@ -357,11 +357,12 @@ export type ProgrammingLanguage = {
357
357
  name: ElementName.ProgrammingLanguage;
358
358
  };
359
359
  /**
360
- * Represents the props available for an Provider element.
360
+ * Represents the props available for a Provider element.
361
361
  * @see Provider
362
362
  */
363
363
  export type Provider = {
364
364
  name: ElementName.Provider;
365
+ hideIcon?: boolean;
365
366
  };
366
367
  /**
367
368
  * Represents the props available for an ReactCount element.
@@ -1,5 +1,4 @@
1
- /** @jsx jsx */
2
- import React from 'react';
1
+ import { jsx } from '@emotion/react';
3
2
  import { type BadgeProps } from './types';
4
3
  /**
5
4
  * A base element that displays some text with an associated icon.
@@ -14,5 +13,5 @@ import { type BadgeProps } from './types';
14
13
  * @see ProgrammingLanguage
15
14
  * @see Provider
16
15
  */
17
- declare const Badge: React.FC<BadgeProps>;
16
+ declare const Badge: ({ hideIcon, icon, label, name, overrideCss, testId, url, }: BadgeProps) => jsx.JSX.Element | null;
18
17
  export default Badge;
@@ -1,6 +1,11 @@
1
1
  import { type ElementProps } from '../types';
2
2
  import { type IconType } from '../../../../../constants';
3
3
  export type BadgeProps = ElementProps & {
4
+ /**
5
+ * Determines whether the badge icon should be hidden. When set to true,
6
+ * the badge will be displayed without the icon, showing only the label text.
7
+ */
8
+ hideIcon?: boolean;
4
9
  /**
5
10
  * The Atlaskit Icon to display next to the label. If this is not supplied,
6
11
  * then the badge icon will fallback to the URL provided.
@@ -11,7 +16,7 @@ export type BadgeProps = ElementProps & {
11
16
  */
12
17
  url?: string;
13
18
  /**
14
- * The text to display for the badge
19
+ * The text to display for the badge.
15
20
  */
16
21
  label?: string;
17
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "27.2.3",
3
+ "version": "27.4.0",
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",
@@ -164,9 +165,6 @@
164
165
  "platform.linking-platform.smart-card.hover-card-ai-summaries-release-stable": {
165
166
  "type": "boolean"
166
167
  },
167
- "platform.linking-platform.smart-card.ai-summary-service-base-url": {
168
- "type": "boolean"
169
- },
170
168
  "platform.linking-platform.smart-card.enable-embed-card-header-tooltip_g9saw": {
171
169
  "type": "boolean"
172
170
  },