import Clipboard from '@react-native-clipboard/clipboard';
import { useBottomSheet } from '../../../core/stores/slices/bottomSheetSlice';
import { useToast } from '../../../core/stores/slices/toastSlice';
import { useAmityElement } from '../../hooks';
import { ComponentID, ElementID } from '../../enums';
import MenuAction from '../MenuAction/MenuAction';
import { link as linkIcon } from '../../../core/assets/icons';
import { TOAST } from '../../../core/constants';
export function CopyLinkAction({
  link,
  pageId,
  componentId = ComponentID.WildCardComponent,
  onPress,
  dark
}) {
  const {
    showToast
  } = useToast();
  const {
    closeBottomSheet
  } = useBottomSheet();
  const {
    config,
    isExcluded
  } = useAmityElement({
    pageId,
    componentId,
    elementId: ElementID.copy_link
  });
  if (isExcluded) return null;
  return /*#__PURE__*/React.createElement(MenuAction, {
    gap: "small",
    dark: dark,
    iconProps: {
      xml: linkIcon()
    },
    label: (config === null || config === void 0 ? void 0 : config.text) ?? 'Copy link',
    onPress: () => {
      onPress ? onPress() : closeBottomSheet();
      Clipboard.setString(link);
      showToast({
        message: TOAST.SHARE.COPY.SUCCESS,
        type: 'success'
      });
    }
  });
}
//# sourceMappingURL=CopyLinkAction.js.map