import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["testId", "alwaysShow"];
import React from 'react';
import { SmartLinkStatus } from '../../../../../constants';
import { useFlexibleCardContext } from '../../../../../state/flexible-ui-context';
import FooterBlockResolvedView from './resolved';
/**
 * Represents a FooterBlock, designed to contain elements and actions that should appear
 * at the bottom of a link card.
 * @public
 * @param {FooterBlockProps} FooterBlockProps
 * @see Block
 */
var FooterBlock = function FooterBlock(_ref) {
  var _props$size, _cardContext$ui;
  var _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'smart-footer-block' : _ref$testId,
    alwaysShow = _ref.alwaysShow,
    props = _objectWithoutProperties(_ref, _excluded);
  var cardContext = useFlexibleCardContext();
  if ((cardContext === null || cardContext === void 0 ? void 0 : cardContext.status) !== SmartLinkStatus.Resolved && !alwaysShow) {
    return null;
  }
  return /*#__PURE__*/React.createElement(FooterBlockResolvedView, _extends({}, props, {
    size: (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : cardContext === null || cardContext === void 0 || (_cardContext$ui = cardContext.ui) === null || _cardContext$ui === void 0 ? void 0 : _cardContext$ui.size,
    testId: testId
  }));
};
export default FooterBlock;