import _extends from "@babel/runtime/helpers/extends";
import React, { useMemo } from 'react';
import WarningIcon from '@atlaskit/icon/core/status-warning';
import { messages } from '../../../messages';
import Text from '../../FlexibleCard/components/elements/common/base-text-element';
import { RetryAction } from '../actions/RetryAction';
import UnresolvedView from './unresolved-view';
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';

/**
 * This view represents a Block Card with an 'Errored' status.
 *
 * @see SmartLinkStatus
 * @see FlexibleCardProps
 */
const ErroredView = ({
  testId = 'smart-block-errored-view',
  ...props
}) => {
  const actions = useMemo(() => props.onAuthorize ? [RetryAction(props.onAuthorize)] : [], [props.onAuthorize]);
  return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
    actions: actions,
    testId: testId
  }), /*#__PURE__*/React.createElement(WarningIcon, {
    label: "errored-warning-icon",
    color: "var(--ds-icon-warning, #E06C00)",
    testId: `${testId}-warning-icon`
  }), /*#__PURE__*/React.createElement(Text, {
    maxLines: 3,
    message: {
      descriptor: messages.could_not_load_link
    }
  }));
};
const _default_1 = withFlexibleUIBlockCardStyle(ErroredView);
export default _default_1;