/* index.tsx generated by @compiled/babel-plugin v0.38.1 */
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
require("./index.compiled.css");
var _runtime = require("@compiled/react/runtime");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
var _compiled = require("@atlaskit/primitives/compiled");
var _constants = require("../../../../../../constants");
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
var _actions = require("../../../actions");
var _elements = require("../../../elements");
var _block = _interopRequireDefault(require("../../block"));
var _elementGroup = _interopRequireDefault(require("../../element-group"));
var _excluded = ["actionGroup", "hideRetry", "retry", "position", "testId", "title", "icon", "hideIcon", "CompetitorPrompt"];
var styles = {
  titleBoxCard: "_1e0c1txw _2lx2vrvc _4cvr1h6o _1bsb1osq"
};

/**
 * Represents an Errored TitleBlock view.
 * This will render when a Smart Link did not successfully resolve.
 * This may be a result of a Smart Link not having the correct credentials,
 * or the backend response was errored or malformed.
 * @see TitleBlock
 */
var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
  var _context$actions;
  var actionGroup = _ref.actionGroup,
    hideRetry = _ref.hideRetry,
    retry = _ref.retry,
    position = _ref.position,
    testId = _ref.testId,
    title = _ref.title,
    icon = _ref.icon,
    hideIcon = _ref.hideIcon,
    CompetitorPrompt = _ref.CompetitorPrompt,
    blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var context = (0, _flexibleUiContext.useFlexibleUiContext)();
  var showRetry = !hideRetry && Boolean(context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[_constants.InternalActionName.UnresolvedAction]);
  var competitorPrompt = CompetitorPrompt && context !== null && context !== void 0 && context.url && (0, _platformFeatureFlags.fg)('prompt_whiteboard_competitor_link_gate') ? /*#__PURE__*/_react.default.createElement(CompetitorPrompt, {
    sourceUrl: context === null || context === void 0 ? void 0 : context.url,
    linkType: 'card'
  }) : null;
  return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, blockProps, {
    testId: "".concat(testId, "-errored-view")
  }), !hideIcon && /*#__PURE__*/_react.default.createElement(_elements.LinkIcon, {
    overrideIcon: icon,
    position: position
  }), competitorPrompt ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
    xcss: styles.titleBoxCard
  }, title, competitorPrompt) : title, showRetry && /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
    align: _constants.SmartLinkAlignment.Right
  }, /*#__PURE__*/_react.default.createElement(_actions.UnresolvedAction, {
    testId: testId
  })), actionGroup);
};
var _default = exports.default = TitleBlockErroredView;