"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireWildcard(require("react"));
var _statusWarning = _interopRequireDefault(require("@atlaskit/icon/core/status-warning"));
var _messages = require("../../../messages");
var _baseTextElement = _interopRequireDefault(require("../../FlexibleCard/components/elements/common/base-text-element"));
var _RetryAction = require("../actions/RetryAction");
var _unresolvedView = _interopRequireDefault(require("./unresolved-view"));
var _withFlexibleUIBlockCardStyle = require("./utils/withFlexibleUIBlockCardStyle");
var _excluded = ["testId"];
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
/**
 * This view represents a Block Card with an 'Errored' status.
 *
 * @see SmartLinkStatus
 * @see FlexibleCardProps
 */
var ErroredView = function ErroredView(_ref) {
  var _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'smart-block-errored-view' : _ref$testId,
    props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var actions = (0, _react.useMemo)(function () {
    return props.onAuthorize ? [(0, _RetryAction.RetryAction)(props.onAuthorize)] : [];
  }, [props.onAuthorize]);
  return /*#__PURE__*/_react.default.createElement(_unresolvedView.default, (0, _extends2.default)({}, props, {
    actions: actions,
    testId: testId
  }), /*#__PURE__*/_react.default.createElement(_statusWarning.default, {
    label: "errored-warning-icon",
    color: "var(--ds-icon-warning, #E06C00)",
    testId: "".concat(testId, "-warning-icon")
  }), /*#__PURE__*/_react.default.createElement(_baseTextElement.default, {
    maxLines: 3,
    message: {
      descriptor: _messages.messages.could_not_load_link
    }
  }));
};
var _default = exports.default = (0, _withFlexibleUIBlockCardStyle.withFlexibleUIBlockCardStyle)(ErroredView);