'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var clsx = require('clsx');
var StatusIcon = require('../../statusIcon/StatusIcon.js');
var Body = require('../../body/Body.js');
var Button_resolver = require('../../button/Button.resolver.js');
require('../../common/theme.js');
require('../../common/direction.js');
require('../../common/propsValues/control.js');
var breakpoint = require('../../common/propsValues/breakpoint.js');
require('../../common/propsValues/size.js');
var typography = require('../../common/propsValues/typography.js');
require('../../common/propsValues/width.js');
require('../../common/propsValues/type.js');
require('../../common/propsValues/dateMode.js');
require('../../common/propsValues/monthFormat.js');
require('../../common/propsValues/position.js');
require('../../common/propsValues/layouts.js');
require('../../common/propsValues/status.js');
require('../../common/propsValues/sentiment.js');
require('../../common/propsValues/profileType.js');
require('../../common/propsValues/variant.js');
require('../../common/propsValues/scroll.js');
require('../../common/propsValues/markdownNodeType.js');
require('../../common/fileType.js');
var icons = require('@transferwise/icons');
require('react');
require('react-intl');
require('../../common/closeButton/CloseButton.messages.js');
var jsxRuntime = require('react/jsx-runtime');
var AvatarView = require('../../avatarView/AvatarView.js');
var Image = require('../../image/Image.js');
var PrimitivePrompt = require('../PrimitivePrompt/PrimitivePrompt.js');
var useScreenSize = require('../../common/hooks/useScreenSize.js');

const ActionPrompt = ({
  sentiment = 'neutral',
  title,
  description,
  onDismiss,
  media,
  action,
  actionSecondary,
  id,
  className,
  'data-testid': testId
}) => {
  const isMobile = !useScreenSize.useScreenSize(breakpoint.Breakpoint.MEDIUM);
  const renderMedia = () => {
    if (media?.imgSrc) {
      return /*#__PURE__*/jsxRuntime.jsx(Image.default, {
        src: media.imgSrc,
        className: "wds-action-prompt--media-image",
        alt: media['aria-label'] ?? ''
      });
    }
    if (media?.avatar) {
      const badge = media.avatar.badge ? media.avatar.badge : sentiment === 'proposition' ? {} : {
        status: sentiment
      };
      return /*#__PURE__*/jsxRuntime.jsx(AvatarView.default, {
        ...media.avatar,
        badge: badge,
        size: 48,
        children: media.avatar.asset
      });
    }
    return sentiment === 'proposition' ? /*#__PURE__*/jsxRuntime.jsx(AvatarView.default, {
      size: 48,
      children: /*#__PURE__*/jsxRuntime.jsx(icons.GiftBox, {})
    }) : /*#__PURE__*/jsxRuntime.jsx(StatusIcon.default, {
      size: 48,
      sentiment: sentiment
    });
  };
  return /*#__PURE__*/jsxRuntime.jsx(PrimitivePrompt.PrimitivePrompt, {
    id: id,
    sentiment: sentiment,
    "data-testid": testId,
    className: clsx.clsx('wds-action-prompt', {
      'wds-action-prompt--with-two-actions': !!actionSecondary
    }, className),
    media: renderMedia(),
    actions: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
      children: [actionSecondary &&
      /*#__PURE__*/
      // @ts-expect-error onClick type mismatch
      jsxRuntime.jsx(Button_resolver.default, {
        v2: true,
        size: "md",
        priority: "secondary",
        href: actionSecondary.href,
        block: isMobile,
        onClick: actionSecondary?.onClick,
        children: actionSecondary.label
      }), /*#__PURE__*/jsxRuntime.jsx(Button_resolver.default, {
        v2: true,
        size: "md",
        priority: "primary",
        href: action.href,
        block: isMobile,
        onClick: action.onClick,
        children: action.label
      })]
    }),
    onDismiss: onDismiss,
    children: /*#__PURE__*/jsxRuntime.jsxs("div", {
      className: clsx.clsx('d-flex', 'flex-column', 'justify-content-center'),
      children: [/*#__PURE__*/jsxRuntime.jsx(Body.default, {
        type: typography.Typography.BODY_LARGE_BOLD,
        children: title
      }), description && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
        children: description
      })]
    })
  });
};

exports.ActionPrompt = ActionPrompt;
exports.default = ActionPrompt;
//# sourceMappingURL=ActionPrompt.js.map
