import { clsx } from 'clsx';
import StatusIcon from '../../statusIcon/StatusIcon.mjs';
import Body from '../../body/Body.mjs';
import Button from '../../button/Button.resolver.mjs';
import '../../common/theme.mjs';
import '../../common/direction.mjs';
import '../../common/propsValues/control.mjs';
import { Breakpoint } from '../../common/propsValues/breakpoint.mjs';
import '../../common/propsValues/size.mjs';
import { Typography } from '../../common/propsValues/typography.mjs';
import '../../common/propsValues/width.mjs';
import '../../common/propsValues/type.mjs';
import '../../common/propsValues/dateMode.mjs';
import '../../common/propsValues/monthFormat.mjs';
import '../../common/propsValues/position.mjs';
import '../../common/propsValues/layouts.mjs';
import '../../common/propsValues/status.mjs';
import '../../common/propsValues/sentiment.mjs';
import '../../common/propsValues/profileType.mjs';
import '../../common/propsValues/variant.mjs';
import '../../common/propsValues/scroll.mjs';
import '../../common/propsValues/markdownNodeType.mjs';
import '../../common/fileType.mjs';
import { GiftBox } from '@transferwise/icons';
import 'react';
import 'react-intl';
import '../../common/closeButton/CloseButton.messages.mjs';
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import AvatarView from '../../avatarView/AvatarView.mjs';
import Image from '../../image/Image.mjs';
import { PrimitivePrompt } from '../PrimitivePrompt/PrimitivePrompt.mjs';
import { useScreenSize } from '../../common/hooks/useScreenSize.mjs';

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

export { ActionPrompt, ActionPrompt as default };
//# sourceMappingURL=ActionPrompt.mjs.map
