{"version":3,"file":"ChannelMemberActions.defaults.mjs","names":[],"sources":["../../../../../../src/plugins/ChannelDetail/Views/ChannelMemberDetailView/ChannelMemberActions.defaults.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport debounce from 'lodash.debounce';\nimport React, {\n  createContext,\n  useCallback,\n  useContext,\n  useEffect,\n  useMemo,\n  useState,\n} from 'react';\nimport type { ChannelMemberResponse } from 'stream-chat';\n\nimport {\n  useChatContext,\n  useComponentContext,\n  useComponentContextIcons,\n  useTranslationContext,\n  useWorkspaceNavigation,\n} from '../../../../context';\nimport { useStableCallback } from '../../../../utils';\nimport { useStateStore } from '../../../../store';\nimport { Alert } from '../../../../components/Dialog';\nimport { Button } from '../../../../components/Button';\nimport { Switch } from '../../../../components/Form';\nimport { ListItemLayout } from '../../../../components/ListItemLayout';\nimport { GlobalModal } from '../../../../components/Modal';\nimport { useNotificationApi } from '../../../../components/Notifications';\nimport { useChannelDetailContext } from '../../ChannelDetailContext';\n\nexport type ChannelMemberActionType =\n  | 'blockUser'\n  | 'muteUser'\n  | 'removeUser'\n  | 'sendMessage'\n  | (string & {});\n\nexport type ChannelMemberActionItem = {\n  Component: React.ComponentType;\n  type: ChannelMemberActionType;\n};\n\ntype ChannelMemberActionContextValue = {\n  member: ChannelMemberResponse;\n  memberDisplayName: string;\n  targetUserId?: string;\n};\n\nconst ChannelMemberActionContext = createContext<\n  ChannelMemberActionContextValue | undefined\n>(undefined);\n\nexport const ChannelMemberActionProvider = ({\n  children,\n  value,\n}: React.PropsWithChildren<{ value: ChannelMemberActionContextValue }>) => (\n  <ChannelMemberActionContext.Provider value={value}>\n    {children}\n  </ChannelMemberActionContext.Provider>\n);\n\nexport const useChannelMemberActionContext = () => {\n  const contextValue = useContext(ChannelMemberActionContext);\n  if (!contextValue) {\n    throw new Error(\n      'The useChannelMemberActionContext hook was called outside of ChannelMemberActionProvider.',\n    );\n  }\n\n  return contextValue;\n};\n\nconst toError = (error: unknown) =>\n  error instanceof Error ? error : new Error('An unknown error occurred');\n\nconst MemberMuteActionIcon = () => {\n  const { IconMute } = useComponentContextIcons();\n\n  return (\n    <IconMute className='str-chat__channel-detail__action-icon str-chat__channel-detail__action-icon--mute' />\n  );\n};\n\nconst MemberUnmuteActionIcon = () => {\n  const { IconAudio } = useComponentContextIcons();\n\n  return (\n    <IconAudio className='str-chat__channel-detail__action-icon str-chat__channel-detail__action-icon--unmute' />\n  );\n};\n\nconst SendDirectMessageActionIcon = () => {\n  const { IconMessageBubble } = useComponentContextIcons();\n\n  return <IconMessageBubble className='str-chat__channel-detail__action-icon' />;\n};\n\nconst BlockUserActionIcon = () => {\n  const { IconNoSign } = useComponentContextIcons();\n\n  return (\n    <IconNoSign className='str-chat__icon--destructive str-chat__channel-detail__action-icon str-chat__channel-detail__action-icon--block-user' />\n  );\n};\n\nconst RemoveUserActionIcon = () => {\n  const { IconUserRemove } = useComponentContextIcons();\n\n  return (\n    <IconUserRemove className='str-chat__icon--destructive str-chat__channel-detail__action-icon str-chat__channel-detail__action-icon--remove-user' />\n  );\n};\n\nconst channelMemberDetailActionClassName = 'str-chat__channel-member-detail-action';\n\nconst blockedUsersSelector = ({ userIds }: { userIds: string[] }) => ({ userIds });\n\ntype ChannelMemberConfirmationAlertProps = {\n  action: 'blockUser' | 'removeUser';\n  cancelLabel: string;\n  confirmLabel: string;\n  description: string;\n  isSubmitting?: boolean;\n  onCancel: () => void;\n  onConfirm: () => void;\n  testId: string;\n  title: string;\n};\n\nconst ChannelMemberConfirmationAlert = ({\n  action,\n  cancelLabel,\n  confirmLabel,\n  description,\n  isSubmitting,\n  onCancel,\n  onConfirm,\n  testId,\n  title,\n}: ChannelMemberConfirmationAlertProps) => (\n  <Alert.Root\n    className={clsx('str-chat__channel-member-confirmation-alert', {\n      [`str-chat__channel-member-confirmation-alert--${action}`]: action,\n    })}\n    data-testid={testId}\n  >\n    <Alert.Header description={description} title={title} />\n    <Alert.Actions>\n      <Button\n        appearance='solid'\n        data-testid={`${testId}-confirm-button`}\n        disabled={isSubmitting}\n        onClick={onConfirm}\n        size='md'\n        variant='danger'\n      >\n        {confirmLabel}\n      </Button>\n      <Button\n        appearance='outline'\n        autoFocus\n        data-testid={`${testId}-cancel-button`}\n        disabled={isSubmitting}\n        onClick={onCancel}\n        size='md'\n        variant='secondary'\n      >\n        {cancelLabel}\n      </Button>\n    </Alert.Actions>\n  </Alert.Root>\n);\n\nconst useChannelMemberActionFilterState = () => {\n  const { client } = useChatContext();\n  const { channel } = useChannelDetailContext();\n  const { targetUserId } = useChannelMemberActionContext();\n  const ownCapabilities = channel.data?.own_capabilities;\n  const isCurrentUser = targetUserId === client.user?.id;\n\n  return {\n    // Blocking is a personal, per-user action (`client.blockUser`), independent of channel\n    // moderation capabilities like 'ban-channel-members'.\n    canBlockUser: !isCurrentUser && !!targetUserId,\n    canMuteUser: !isCurrentUser && !!targetUserId,\n    canRemoveUser:\n      !isCurrentUser &&\n      !!targetUserId &&\n      ownCapabilities?.includes('update-channel-members'),\n    canSendMessage: !isCurrentUser && !!targetUserId,\n  };\n};\n\nexport const useBaseChannelMemberActionSetFilter = (\n  channelMemberActionSet: ChannelMemberActionItem[],\n) => {\n  const { canBlockUser, canMuteUser, canRemoveUser, canSendMessage } =\n    useChannelMemberActionFilterState();\n\n  return useMemo(\n    () =>\n      channelMemberActionSet.filter((action) => {\n        switch (action.type) {\n          case 'blockUser':\n            return canBlockUser;\n          case 'muteUser':\n            return canMuteUser;\n          case 'removeUser':\n            return canRemoveUser;\n          case 'sendMessage':\n            return canSendMessage;\n          default:\n            return true;\n        }\n      }),\n    [canBlockUser, canMuteUser, canRemoveUser, canSendMessage, channelMemberActionSet],\n  );\n};\n\nconst SendDirectMessageAction = () => {\n  const { channelManager, client } = useChatContext();\n  const { openChannel } = useWorkspaceNavigation();\n  const { channel, close } = useChannelDetailContext();\n  const { addNotification } = useNotificationApi();\n  const { t } = useTranslationContext();\n  const { targetUserId } = useChannelMemberActionContext();\n  const [isSending, setIsSending] = useState(false);\n\n  const openDirectMessage = useCallback(async () => {\n    if (!client.userID || !targetUserId || isSending) return;\n\n    setIsSending(true);\n    try {\n      const directMessageChannel = client.channel(channel.type, {\n        members: [client.userID, targetUserId].map((user_id) => ({ user_id })),\n      });\n      // The stored instance, which differs from `directMessageChannel` if another instance took the\n      // DM's `cid` while the watch was in flight.\n      const dm = await directMessageChannel.watch();\n      // Open the DM in the workspace (a `ChatView` slot, or whatever a custom\n      // `WorkspaceNavigationProvider` does), then ingest it into the channel list(s) that should\n      // own it so it appears without a re-query.\n      openChannel(dm);\n      channelManager.ingestChannel(dm);\n      close?.();\n    } catch (error) {\n      addNotification({\n        context: { channel },\n        emitter: 'ChannelMemberDetail',\n        error: toError(error),\n        message: t(\n          'channelDetail.channelMemberActions.errorOpeningDirectMessage.text',\n          'Error opening direct message',\n        ),\n        severity: 'error',\n        type: 'api:channel:watch:failed',\n      });\n    } finally {\n      setIsSending(false);\n    }\n  }, [\n    addNotification,\n    channel,\n    client,\n    close,\n    channelManager,\n    isSending,\n    openChannel,\n    t,\n    targetUserId,\n  ]);\n\n  const rootProps = useMemo(\n    () => ({\n      className: channelMemberDetailActionClassName,\n      disabled: isSending,\n      onClick: openDirectMessage,\n    }),\n    [isSending, openDirectMessage],\n  );\n\n  return (\n    <ListItemLayout\n      LeadingIcon={SendDirectMessageActionIcon}\n      RootElement='button'\n      rootProps={rootProps}\n      title={t(\n        'channelDetail.channelMemberActions.sendDirectMessage.title',\n        'Send direct message',\n      )}\n    />\n  );\n};\n\nconst UserMuteAction = () => {\n  const { channel } = useChannelDetailContext();\n  const { client, mutes } = useChatContext();\n  const { addNotification } = useNotificationApi();\n  const { t } = useTranslationContext();\n  const { targetUserId } = useChannelMemberActionContext();\n  const userMuted =\n    !!targetUserId && mutes.some((mute) => mute.target?.id === targetUserId);\n  const [optimisticUserMuted, setOptimisticUserMuted] = useState(userMuted);\n\n  useEffect(() => {\n    setOptimisticUserMuted(userMuted);\n  }, [userMuted]);\n\n  const toggleUserMuteRequest = useStableCallback(\n    (nextMuted: boolean, userId?: string) => {\n      if (!userId) return;\n\n      if (!nextMuted) {\n        return client.moderation\n          .unmute({ target_ids: [userId] })\n          .then(() =>\n            addNotification({\n              context: { channel },\n              emitter: 'ChannelMemberDetail',\n              message: t(\n                'channelDetail.channelManagementActions.userUnmuted.text',\n                'User unmuted',\n              ),\n              severity: 'success',\n              type: 'api:user:unmute:success',\n            }),\n          )\n          .catch((error) => {\n            // Resync with the source of truth: the debounced request may follow several optimistic\n            // flips, so a fixed boolean could be wrong.\n            setOptimisticUserMuted(userMuted);\n            return addNotification({\n              context: { channel },\n              emitter: 'ChannelMemberDetail',\n              error: toError(error),\n              message: t(\n                'channelDetail.channelManagementActions.errorUnmutingUser.text',\n                'Error unmuting user',\n              ),\n              severity: 'error',\n              type: 'api:user:unmute:failed',\n            });\n          });\n      }\n\n      return client.moderation\n        .mute({ target_ids: [userId] })\n        .then(() =>\n          addNotification({\n            context: { channel },\n            emitter: 'ChannelMemberDetail',\n            message: t(\n              'channelDetail.channelManagementActions.userMuted.text',\n              'User muted',\n            ),\n            severity: 'success',\n            type: 'api:user:mute:success',\n          }),\n        )\n        .catch((error) => {\n          setOptimisticUserMuted(userMuted);\n          return addNotification({\n            context: { channel },\n            emitter: 'ChannelMemberDetail',\n            error: toError(error),\n            message: t(\n              'channelDetail.channelManagementActions.errorMutingUser.text',\n              'Error muting user',\n            ),\n            severity: 'error',\n            type: 'api:user:mute:failed',\n          });\n        });\n    },\n  );\n\n  const toggleUserMute = useMemo(\n    () => debounce(toggleUserMuteRequest, 1000),\n    [toggleUserMuteRequest],\n  );\n\n  useEffect(\n    () => () => {\n      toggleUserMute.cancel();\n    },\n    [toggleUserMute],\n  );\n\n  const toggleOptimisticUserMute = useCallback(() => {\n    const nextMuted = !optimisticUserMuted;\n    setOptimisticUserMuted(nextMuted);\n    toggleUserMute(nextMuted, targetUserId);\n  }, [optimisticUserMuted, targetUserId, toggleUserMute]);\n\n  const rootProps = useMemo(\n    () => ({\n      'aria-pressed': optimisticUserMuted,\n      className: clsx('str-chat__form__switch-field', channelMemberDetailActionClassName),\n      onClick: toggleOptimisticUserMute,\n    }),\n    [optimisticUserMuted, toggleOptimisticUserMute],\n  );\n  const TrailingSlot = useMemo(() => {\n    function UserMuteSwitch() {\n      return <Switch on={optimisticUserMuted} presentation />;\n    }\n\n    return UserMuteSwitch;\n  }, [optimisticUserMuted]);\n\n  return (\n    <ListItemLayout\n      LeadingIcon={optimisticUserMuted ? MemberUnmuteActionIcon : MemberMuteActionIcon}\n      RootElement='button'\n      rootProps={rootProps}\n      title={\n        optimisticUserMuted\n          ? t('channelDetail.channelManagementActions.unmuteUser.title', 'Unmute user')\n          : t('channelDetail.channelManagementActions.muteUser.title', 'Mute user')\n      }\n      TrailingSlot={TrailingSlot}\n    />\n  );\n};\n\nconst BlockUserAction = () => {\n  const { client } = useChatContext();\n  const { Modal = GlobalModal } = useComponentContext();\n  const { channel } = useChannelDetailContext();\n  const { addNotification } = useNotificationApi();\n  const { t } = useTranslationContext();\n  const { memberDisplayName, targetUserId } = useChannelMemberActionContext();\n  const { userIds: blockedUserIds } = useStateStore(\n    client.blockedUsers,\n    blockedUsersSelector,\n  );\n  const isBlocked = !!targetUserId && new Set(blockedUserIds).has(targetUserId);\n  const [alertOpen, setAlertOpen] = useState(false);\n  const [userBlockInProgress, setUserBlockInProgress] = useState(false);\n\n  const closeBlockUserAlert = useCallback(() => {\n    setAlertOpen(false);\n  }, []);\n\n  const openBlockUserAlert = useCallback(() => {\n    setAlertOpen(true);\n  }, []);\n\n  const unblockUser = useCallback(async () => {\n    if (!targetUserId) return;\n\n    try {\n      setUserBlockInProgress(true);\n      await client.unblockUser(targetUserId);\n      addNotification({\n        context: { channel },\n        emitter: 'ChannelMemberDetail',\n        message: t('common.userUnblocked.text', 'User unblocked'),\n        severity: 'success',\n        type: 'api:user:unblock:success',\n      });\n    } catch (error) {\n      addNotification({\n        context: { channel },\n        emitter: 'ChannelMemberDetail',\n        error: toError(error),\n        message: t(\n          'channelDetail.channelManagementActions.errorUnblockingUser.text',\n          'Error unblocking user',\n        ),\n        severity: 'error',\n        type: 'api:user:unblock:failed',\n      });\n    } finally {\n      setAlertOpen(false);\n      setUserBlockInProgress(false);\n    }\n  }, [addNotification, channel, client, t, targetUserId]);\n\n  const blockUser = useCallback(async () => {\n    if (!targetUserId) return;\n\n    try {\n      setUserBlockInProgress(true);\n      await client.blockUser(targetUserId);\n      addNotification({\n        context: { channel },\n        emitter: 'ChannelMemberDetail',\n        message: t('common.userBlocked.text', 'User blocked'),\n        severity: 'success',\n        type: 'api:user:block:success',\n      });\n    } catch (error) {\n      addNotification({\n        context: { channel },\n        emitter: 'ChannelMemberDetail',\n        error: toError(error),\n        message: t(\n          'channelDetail.channelManagementActions.errorBlockingUser.text',\n          'Error blocking user',\n        ),\n        severity: 'error',\n        type: 'api:user:block:failed',\n      });\n    } finally {\n      setAlertOpen(false);\n      setUserBlockInProgress(false);\n    }\n  }, [addNotification, channel, client, t, targetUserId]);\n\n  const rootProps = useMemo(\n    () => ({\n      className: channelMemberDetailActionClassName,\n      disabled: userBlockInProgress,\n      onClick: openBlockUserAlert,\n    }),\n    [openBlockUserAlert, userBlockInProgress],\n  );\n\n  return (\n    <>\n      <ListItemLayout\n        destructive\n        LeadingIcon={BlockUserActionIcon}\n        RootElement='button'\n        rootProps={rootProps}\n        title={\n          isBlocked\n            ? t('channelDetail.channelMemberActions.unblockUser.title', 'Unblock user')\n            : t('channelDetail.channelManagementActions.blockUser.title', 'Block user')\n        }\n      />\n      <Modal open={alertOpen} role='alertdialog'>\n        <ChannelMemberConfirmationAlert\n          action='blockUser'\n          cancelLabel={t('common.cancel.label', 'Cancel')}\n          confirmLabel={\n            isBlocked\n              ? t('channelDetail.channelMemberActions.unblockUser.title', 'Unblock user')\n              : t('channelDetail.channelManagementActions.blockUser.title', 'Block user')\n          }\n          description={\n            isBlocked\n              ? t(\n                  'channelDetail.channelMemberActions.ableMessageAgain.description',\n                  '{{ member }} will be able to message you again.',\n                  {\n                    member: memberDisplayName,\n                  },\n                )\n              : t(\n                  'channelDetail.channelMemberActions.wonTAbleMessage.description',\n                  \"{{ member }} won't be able to message you anymore.\",\n                  {\n                    member: memberDisplayName,\n                  },\n                )\n          }\n          isSubmitting={userBlockInProgress}\n          onCancel={closeBlockUserAlert}\n          onConfirm={isBlocked ? unblockUser : blockUser}\n          testId='channel-detail-block-member-alert'\n          title={\n            isBlocked\n              ? t('channelDetail.channelMemberActions.unblockUser.title', 'Unblock user')\n              : t('channelDetail.channelManagementActions.blockUser.title', 'Block user')\n          }\n        />\n      </Modal>\n    </>\n  );\n};\n\nconst RemoveUserAction = () => {\n  const { Modal = GlobalModal } = useComponentContext();\n  const { channel } = useChannelDetailContext();\n  const { addNotification } = useNotificationApi();\n  const { t } = useTranslationContext();\n  const { memberDisplayName, targetUserId } = useChannelMemberActionContext();\n  const [alertOpen, setAlertOpen] = useState(false);\n  const [removeMemberInProgress, setRemoveMemberInProgress] = useState(false);\n\n  const closeRemoveUserAlert = useCallback(() => {\n    setAlertOpen(false);\n  }, []);\n\n  const openRemoveUserAlert = useCallback(() => {\n    setAlertOpen(true);\n  }, []);\n\n  const removeUser = useCallback(async () => {\n    if (!targetUserId) return;\n\n    try {\n      setRemoveMemberInProgress(true);\n      await channel.removeMembers({ members: [targetUserId] });\n      addNotification({\n        context: { channel },\n        emitter: 'ChannelMemberDetail',\n        message: t('channelDetail.channelMemberActions.userRemoved.text', 'User removed'),\n        severity: 'success',\n        type: 'api:channel:remove-members:success',\n      });\n      setAlertOpen(false);\n    } catch (error) {\n      addNotification({\n        context: { channel },\n        emitter: 'ChannelMemberDetail',\n        error: toError(error),\n        message: t(\n          'channelDetail.channelMemberActions.errorRemovingUser.text',\n          'Error removing user',\n        ),\n        severity: 'error',\n        type: 'api:channel:remove-members:failed',\n      });\n    } finally {\n      setRemoveMemberInProgress(false);\n    }\n  }, [addNotification, channel, t, targetUserId]);\n\n  const rootProps = useMemo(\n    () => ({\n      className: channelMemberDetailActionClassName,\n      disabled: removeMemberInProgress,\n      onClick: openRemoveUserAlert,\n    }),\n    [openRemoveUserAlert, removeMemberInProgress],\n  );\n\n  return (\n    <>\n      <ListItemLayout\n        destructive\n        LeadingIcon={RemoveUserActionIcon}\n        RootElement='button'\n        rootProps={rootProps}\n        title={t('channelDetail.channelMemberActions.removeUser.title', 'Remove user')}\n      />\n      <Modal open={alertOpen} role='alertdialog'>\n        <ChannelMemberConfirmationAlert\n          action='removeUser'\n          cancelLabel={t('common.cancel.label', 'Cancel')}\n          confirmLabel={t(\n            'channelDetail.channelMemberActions.removeUser.title',\n            'Remove user',\n          )}\n          description={t(\n            'channelDetail.channelMemberActions.removeChannel.description',\n            'Remove {{ member }} from this channel?',\n            {\n              member: memberDisplayName,\n            },\n          )}\n          isSubmitting={removeMemberInProgress}\n          onCancel={closeRemoveUserAlert}\n          onConfirm={removeUser}\n          testId='channel-detail-remove-member-alert'\n          title={t('channelDetail.channelMemberActions.removeUser.title', 'Remove user')}\n        />\n      </Modal>\n    </>\n  );\n};\n\nexport const DefaultChannelMemberActions = {\n  BlockUser: BlockUserAction,\n  MuteUser: UserMuteAction,\n  RemoveUser: RemoveUserAction,\n  SendDirectMessage: SendDirectMessageAction,\n};\n\nexport const defaultChannelMemberActionSet: ChannelMemberActionItem[] = [\n  {\n    Component: DefaultChannelMemberActions.SendDirectMessage,\n    type: 'sendMessage',\n  },\n  {\n    Component: DefaultChannelMemberActions.MuteUser,\n    type: 'muteUser',\n  },\n  {\n    Component: DefaultChannelMemberActions.BlockUser,\n    type: 'blockUser',\n  },\n  {\n    Component: DefaultChannelMemberActions.RemoveUser,\n    type: 'removeUser',\n  },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,IAAM,6BAA6B,cAEjC,KAAA,CAAS;AAEX,IAAa,+BAA+B,EAC1C,UACA,YAEA,oBAAC,2BAA2B,UAA5B;CAA4C;CACzC;AACkC,CAAA;AAGvC,IAAa,sC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