{"version":3,"file":"QuotedMessagePreview.mjs","names":[],"sources":["../../../../src/components/MessageComposer/QuotedMessagePreview.tsx"],"sourcesContent":["import React, {\n  type ComponentType,\n  type KeyboardEvent,\n  type MouseEventHandler,\n  type ReactElement,\n  type ReactNode,\n  useMemo,\n} from 'react';\n\nimport { displayDuration, SUPPORTED_VIDEO_FORMATS } from '../Attachment';\n\nimport { useChatContext } from '../../context/ChatContext';\nimport { useTranslationContext } from '../../context/TranslationContext';\n\nimport { useStateStore } from '../../store';\nimport { useMessageComposerController } from './hooks';\nimport {\n  type Attachment,\n  type GiphyVersions,\n  isAudioAttachment,\n  isFileAttachment,\n  isGiphyAttachment,\n  isImageAttachment,\n  isScrapedContent,\n  isVideoAttachment,\n  isVoiceRecordingAttachment,\n  type LocalMessage,\n  type MessageComposerState,\n  type MessageResponse,\n  type PollResponseData,\n  type SharedLocationResponseData,\n  type TranslationLanguage,\n  type VoiceRecordingAttachment,\n} from 'stream-chat';\nimport { useAttachmentContext } from '../../context/AttachmentContext';\nimport type { MessageContextValue } from '../../context';\nimport { RemoveAttachmentPreviewButton } from './RemoveAttachmentPreviewButton';\nimport clsx from 'clsx';\nimport { type BaseImageProps, BaseImage as DefaultBaseImage } from '../BaseImage';\nimport { FileIcon } from '../FileIcon';\nimport { QuotedMessageIndicator } from './QuotedMessageIndicator';\nimport { getRenderTextMentionEntities } from '../Message/renderText/rehypePlugins';\nimport { isDeletedMessage } from '../MessageList';\nimport { useComponentContext, useComponentContextIcons } from '../../context';\nimport type { IconSlots } from '../Icons/slots';\n\nconst messageComposerStateStoreSelector = (state: MessageComposerState) => ({\n  quotedMessage: state.quotedMessage,\n});\n\nexport type QuotedMessagePreviewProps = {\n  getQuotedMessageAuthor?: (message: LocalMessage | MessageResponse) => string;\n  renderText?: MessageContextValue['renderText'];\n};\n\nconst NullAttachmentIcon = () => null;\n\nconst QUOTED_GIPHY_PREVIEW_LABEL = 'Giphy';\n\ntype AttachmentType = 'documents' | 'images' | 'links' | 'videos' | 'voiceRecordings';\n\n/** Giphy GIFs: only native type (e.g. /giphy command) is recognized as Giphy. */\nconst isQuotedGiphyAttachment = (attachment: Attachment) => isGiphyAttachment(attachment);\n\nconst getAttachmentType = (attachment: Attachment) => {\n  if (isQuotedGiphyAttachment(attachment)) {\n    return 'giphy';\n  }\n  if (isScrapedContent(attachment)) {\n    return 'link';\n  } else if (isVideoAttachment(attachment, SUPPORTED_VIDEO_FORMATS)) {\n    return 'video';\n  } else if (isImageAttachment(attachment)) {\n    return 'image';\n  } else if (isAudioAttachment(attachment)) {\n    return 'audio';\n  } else if (isVoiceRecordingAttachment(attachment)) {\n    return 'voiceRecording';\n  } else if (isFileAttachment(attachment, SUPPORTED_VIDEO_FORMATS)) {\n    return 'file';\n  }\n\n  return 'unsupported';\n};\n\ntype GroupedAttachments = Record<AttachmentType, Attachment[]> & {\n  giphies: Attachment[];\n  locations: SharedLocationResponseData[];\n  polls: PollResponseData[];\n  total: number;\n};\n\nconst getGroupedAttachments = (quotedMessage: LocalMessage | MessageResponse | null) => {\n  const groupedAttachments = {\n    documents: [],\n    giphies: [],\n    images: [],\n    links: [],\n    locations: [],\n    polls: [],\n    total: 0,\n    videos: [],\n    voiceRecordings: [],\n  };\n\n  if (!quotedMessage || !quotedMessage.attachments) return groupedAttachments;\n\n  const result = quotedMessage.attachments.reduce<GroupedAttachments>(\n    (count, attachment) => {\n      switch (getAttachmentType(attachment)) {\n        case 'giphy':\n          count.giphies.push(attachment);\n          count.total += 1;\n          break;\n        case 'link':\n          count.links.push(attachment);\n          count.total += 1;\n          break;\n        case 'video':\n          count.videos.push(attachment);\n          count.total += 1;\n          break;\n        case 'voiceRecording':\n          count.voiceRecordings.push(attachment);\n          count.total += 1;\n          break;\n        case 'audio':\n        case 'file':\n          count.documents.push(attachment);\n          count.total += 1;\n          break;\n        default:\n          if (isImageAttachment(attachment)) {\n            count.images.push(attachment);\n            count.total += 1;\n          }\n      }\n\n      return count;\n    },\n    groupedAttachments,\n  );\n  if (quotedMessage.shared_location) {\n    result.locations.push(quotedMessage.shared_location);\n    result.total += 1;\n  } else if (quotedMessage.poll) {\n    result.polls.push(quotedMessage.poll);\n    result.total += 1;\n  }\n\n  return result;\n};\n\ntype PreviewType =\n  | 'voice'\n  | 'file'\n  | 'image'\n  | 'giphy'\n  | 'link'\n  | 'location'\n  | 'poll'\n  | 'video'\n  | 'mixed';\n\nconst getAttachmentIconWithType = (\n  quotedMessage: LocalMessage | MessageResponse | null,\n  giphyVersionName: GiphyVersions,\n  // Passed in rather than read from the hooks: this plain helper runs inside a `useMemo`, where\n  // hooks cannot be called.\n  icons: Required<IconSlots>,\n  BaseImage: ComponentType<BaseImageProps>,\n): {\n  groupedAttachments: GroupedAttachments;\n  Icon: ComponentType;\n  PreviewImage: ReactElement | null;\n  previewType: PreviewType | null;\n} => {\n  const {\n    IconCamera,\n    IconFile,\n    IconLink,\n    IconLocation,\n    IconNoSign,\n    IconPlayFill,\n    IconPoll,\n    IconVideo,\n    IconVoice,\n  } = icons;\n  const groupedAttachments = getGroupedAttachments(quotedMessage);\n  const result = {\n    groupedAttachments,\n    Icon: NullAttachmentIcon,\n    PreviewImage: null,\n    previewType: null,\n  };\n  if (isDeletedMessage(quotedMessage)) {\n    return { ...result, Icon: IconNoSign };\n  }\n  if (!groupedAttachments.total || isDeletedMessage(quotedMessage)) return result;\n  if (groupedAttachments.polls.length > 0)\n    return { ...result, Icon: IconPoll, previewType: 'poll' };\n  if (groupedAttachments.locations.length > 0)\n    // todo: we do not generate the location preview image\n    return { ...result, Icon: IconLocation, previewType: 'location' };\n  if (\n    groupedAttachments.giphies.length > 0 &&\n    groupedAttachments.giphies.length === groupedAttachments.total\n  ) {\n    const giphyAttachment = groupedAttachments.giphies[0] as Attachment & {\n      giphy?: Record<string, { url?: string } | undefined>;\n    };\n    const giphyVersion =\n      giphyAttachment.giphy?.[giphyVersionName as keyof NonNullable<Attachment['giphy']>];\n    const src =\n      giphyVersion?.url || giphyAttachment.thumb_url || giphyAttachment.image_url || '';\n    return {\n      ...result,\n      Icon: IconFile,\n      PreviewImage: (\n        <BaseImage\n          alt={QUOTED_GIPHY_PREVIEW_LABEL}\n          className='str-chat__attachment-preview__thumbnail'\n          src={src}\n          title={QUOTED_GIPHY_PREVIEW_LABEL}\n        />\n      ),\n      previewType: 'giphy',\n    };\n  }\n  if (\n    groupedAttachments.documents.length === groupedAttachments.total &&\n    groupedAttachments.documents.length === 1\n  ) {\n    const fileAttachment = groupedAttachments.documents[0] as Attachment;\n    return {\n      ...result,\n      Icon: IconFile,\n      PreviewImage: (\n        <FileIcon\n          fileName={fileAttachment.title}\n          mimeType={fileAttachment.custom?.mime_type}\n        />\n      ),\n      previewType: 'file',\n    };\n  }\n  if (groupedAttachments.links.length === groupedAttachments.total) {\n    const linkAttachment = groupedAttachments.links[0];\n    return {\n      ...result,\n      Icon: IconLink,\n      PreviewImage: (\n        <BaseImage\n          alt={linkAttachment.title}\n          className='str-chat__attachment-preview__thumbnail'\n          src={linkAttachment.thumb_url || linkAttachment.image_url}\n          title={linkAttachment.title}\n        />\n      ),\n      previewType: 'link',\n    };\n  }\n  if (groupedAttachments.videos.length === groupedAttachments.total) {\n    const videoAttachment = groupedAttachments.videos[0];\n    return {\n      ...result,\n      Icon: IconVideo,\n      PreviewImage: (\n        <>\n          <BaseImage\n            alt={videoAttachment.asset_url}\n            className='str-chat__attachment-preview__thumbnail'\n            src={videoAttachment.thumb_url}\n            title={videoAttachment.title}\n          />\n          <div className='str-chat__attachment-preview__thumbnail__play-indicator'>\n            <IconPlayFill />\n          </div>\n        </>\n      ),\n      previewType: 'video',\n    };\n  }\n  if (groupedAttachments.images.length === groupedAttachments.total) {\n    const imageAttachment = groupedAttachments.images[0];\n    return {\n      ...result,\n      Icon: IconCamera,\n      PreviewImage: (\n        <BaseImage\n          alt={imageAttachment.fallback}\n          className='str-chat__attachment-preview__thumbnail'\n          src={imageAttachment.image_url}\n          title={imageAttachment.title}\n        />\n      ),\n      previewType: 'image',\n    };\n  }\n  if (groupedAttachments.voiceRecordings.length === groupedAttachments.total)\n    return { ...result, Icon: IconVoice, previewType: 'voice' };\n\n  return { ...result, Icon: IconFile, previewType: 'mixed' };\n};\n\nexport const QuotedMessagePreview = ({\n  getQuotedMessageAuthor,\n  renderText,\n}: QuotedMessagePreviewProps) => {\n  const messageComposer = useMessageComposerController();\n  const { quotedMessage } = useStateStore(\n    messageComposer.state,\n    messageComposerStateStoreSelector,\n  );\n\n  return quotedMessage ? (\n    <div className='str-chat__message-composer__quoted-message-preview-slot'>\n      <QuotedMessagePreviewUI\n        getQuotedMessageAuthor={getQuotedMessageAuthor}\n        onRemove={() => messageComposer.setQuotedMessage(null)}\n        quotedMessage={quotedMessage}\n        renderText={renderText}\n      />\n    </div>\n  ) : null;\n};\n\ntype QuotedMessagePreviewUIProps = QuotedMessagePreviewProps & {\n  quotedMessage: LocalMessage | MessageResponse;\n  authorLabel?: ReactNode;\n  className?: string;\n  onClick?: MouseEventHandler<HTMLDivElement>;\n  onRemove?: () => void;\n};\n\nexport const QuotedMessagePreviewUI = ({\n  authorLabel,\n  className,\n  getQuotedMessageAuthor,\n  onClick,\n  onRemove,\n  quotedMessage,\n  renderText,\n}: QuotedMessagePreviewUIProps) => {\n  const { client } = useChatContext();\n  const { t, userLanguage } = useTranslationContext();\n  const { giphyVersion: giphyVersionName = 'fixed_height' } = useAttachmentContext();\n  const icons = useComponentContextIcons();\n  const { BaseImage = DefaultBaseImage } = useComponentContext();\n\n  const quotedMessageText = useMemo(\n    () =>\n      quotedMessage?.i18n?.[`${userLanguage}_text` as `${TranslationLanguage}_text`] ||\n      quotedMessage?.text,\n    [quotedMessage?.i18n, quotedMessage?.text, userLanguage],\n  );\n  const quotedMessageMentionEntities = useMemo(\n    () =>\n      getRenderTextMentionEntities({\n        mentioned_channel: quotedMessage?.mentioned_channel,\n        mentioned_groups: quotedMessage?.mentioned_groups,\n        mentioned_here: quotedMessage?.mentioned_here,\n        mentioned_roles: quotedMessage?.mentioned_roles,\n        mentioned_users: quotedMessage?.mentioned_users,\n      }),\n    [\n      quotedMessage?.mentioned_channel,\n      quotedMessage?.mentioned_groups,\n      quotedMessage?.mentioned_here,\n      quotedMessage?.mentioned_roles,\n      quotedMessage?.mentioned_users,\n    ],\n  );\n\n  const { AttachmentIcon, PreviewImage, renderedText } = useMemo(() => {\n    if (!quotedMessage) return { AttachmentIcon: NullAttachmentIcon, renderedText: null };\n\n    const {\n      groupedAttachments,\n      Icon: AttachmentIcon,\n      PreviewImage,\n      previewType,\n    } = getAttachmentIconWithType(quotedMessage, giphyVersionName, icons, BaseImage);\n\n    let renderedText: ReactNode | undefined;\n\n    if (isDeletedMessage(quotedMessage)) {\n      renderedText = t('common.messageDeleted.text', 'Message deleted');\n    } else if (!quotedMessageText) {\n      if (previewType === 'poll') {\n        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n        renderedText = quotedMessage.poll!.name;\n      } else if (previewType === 'location') {\n        renderedText = t('common.liveLocation.text', 'Live location');\n      } else if (previewType === 'voice') {\n        {\n          const voiceRecording = groupedAttachments\n            .voiceRecordings[0] as VoiceRecordingAttachment;\n          renderedText = t(\n            'messageComposer.quotedMessagePreview.voiceMessage.label',\n            'Voice message {{ duration }}',\n            {\n              duration: displayDuration(voiceRecording?.custom?.duration),\n            },\n          );\n        }\n      } else if (previewType === 'giphy') {\n        renderedText = QUOTED_GIPHY_PREVIEW_LABEL;\n      } else if (previewType === 'link') {\n        renderedText = groupedAttachments.links[0].title;\n      } else if (previewType === 'mixed') {\n        renderedText = t('messageComposer.quotedMessagePreview.files.label', {\n          count: groupedAttachments.total,\n          defaultValue_one: '{{ count }} file',\n          defaultValue_other: '{{ count }} files',\n        });\n      } else if (previewType === 'video') {\n        renderedText =\n          groupedAttachments.videos.length === 1\n            ? t('messageComposer.quotedMessagePreview.video.label', 'Video')\n            : t('messageComposer.quotedMessagePreview.videos.label', {\n                count: groupedAttachments.videos.length,\n                defaultValue_one: '{{ count }} video',\n                defaultValue_other: '{{ count }} videos',\n              });\n      } else if (previewType === 'file') {\n        renderedText = groupedAttachments.documents[0].title;\n      } else if (previewType === 'image') {\n        renderedText =\n          groupedAttachments.images.length === 1\n            ? t('messageComposer.quotedMessagePreview.photo.label', 'Photo')\n            : t('messageComposer.quotedMessagePreview.photos.label', {\n                count: groupedAttachments.images.length,\n                defaultValue_one: '{{ count }} photo',\n                defaultValue_other: '{{ count }} photos',\n              });\n      }\n    } else if (renderText) {\n      renderedText = renderText(quotedMessageText, {\n        messageMentionEntities: quotedMessageMentionEntities,\n      });\n    } else {\n      renderedText = quotedMessageText;\n    }\n\n    return {\n      AttachmentIcon,\n      PreviewImage,\n      renderedText,\n    };\n  }, [\n    BaseImage,\n    giphyVersionName,\n    icons,\n    quotedMessage,\n    quotedMessageMentionEntities,\n    quotedMessageText,\n    renderText,\n    t,\n  ]);\n\n  const isOwnMessage = client.user?.id === quotedMessage?.user?.id;\n  const isInteractive = !!onClick;\n\n  const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n    if (!onClick || (event.key !== 'Enter' && event.key !== ' ')) return;\n\n    event.preventDefault();\n    onClick(event as unknown as Parameters<NonNullable<typeof onClick>>[0]);\n  };\n\n  if (!renderedText && !AttachmentIcon && !PreviewImage) return null;\n\n  const authorName = getQuotedMessageAuthor?.(quotedMessage) ?? quotedMessage.user?.name;\n  return (\n    <div\n      aria-label={\n        isInteractive\n          ? t(\n              'messageComposer.quotedMessagePreview.jumpQuotedMessage.ariaLabel',\n              'Jump to quoted message',\n            )\n          : undefined\n      }\n      className={clsx('str-chat__quoted-message-preview', className, {\n        'str-chat__quoted-message-preview--own': isOwnMessage,\n      })}\n      data-testid='quoted-message-preview'\n      onClick={onClick}\n      onKeyDown={isInteractive ? handleKeyDown : undefined}\n      role={isInteractive ? 'button' : undefined}\n      tabIndex={isInteractive ? 0 : undefined}\n    >\n      <QuotedMessageIndicator isOwnMessage={isOwnMessage} />\n      <div className='str-chat__quoted-message-preview__content'>\n        <div className='str-chat__quoted-message-preview__author'>\n          {authorLabel ??\n            (isOwnMessage\n              ? t('common.you.label', 'You')\n              : authorName\n                ? t(\n                    'messageComposer.quotedMessagePreview.reply.withAuthorName.text',\n                    'Reply to {{ authorName }}',\n                    { authorName },\n                  )\n                : t('messageComposer.quotedMessagePreview.reply.text', 'Reply'))}\n        </div>\n\n        <div\n          className='str-chat__quoted-message-preview__message'\n          data-testid='quoted-message-text'\n        >\n          <AttachmentIcon />\n          <div className='str-chat__quoted-message-preview__message-text'>\n            {renderedText}\n          </div>\n        </div>\n      </div>\n      {PreviewImage && (\n        <div className='str-chat__quoted-message-preview__image'>{PreviewImage}</div>\n      )}\n\n      {onRemove && (\n        <RemoveAttachmentPreviewButton\n          aria-label={t(\n            'messageComposer.quotedMessagePreview.cancelReply.ariaLabel',\n            'Cancel Reply',\n          )}\n          data-testid='quoted-message-preview-dismiss-btn'\n          onClick={onRemove}\n        />\n      )}\n    </div>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CA,IAAM,qCAAqC,WAAiC,EAC1E,eAAe,MAAM,cACvB;AAOA,IAAM,2BAA2B;AAEjC,IAAM,6BAA6B;;AAKnC,IAAM,2BAA2B,eAA2B,kBAAkB,UAAU;AAExF,IAAM,qBAAqB,eAA2B;CACpD,IAAI,wBAAwB,UAAU,GACpC,OAAO;CAET,IAAI,iBAAiB,UAAU,GAC7B,OAAO;MACF,IAAI,kBAAkB,YAAY,uBAAuB,GAC9D,OAAO;MACF,IAAI,kBAAkB,UAAU,GACrC,OAAO;MACF,IAAI,kBAAkB,UAAU,GACrC,OAAO;MACF,IAAI,2BAA2B,UAAU,GAC9C,OAAO;MACF,IAAI,iBAAiB,YAAY,uBAAuB,GAC7D,OAAO;CAGT,OAAO;AACT;AASA,IAAM,yBAAyB,kBAAyD;CACtF,MAAM,qBAAqB;EACzB,WAAW,CAAC;EACZ,SAAS,CAAC;EACV,QAAQ,CAAC;EACT,OAAO,CAAC;EACR,WAAW,CAAC;E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