"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CopyLinkAction = CopyLinkAction;
var _clipboard = _interopRequireDefault(require("@react-native-clipboard/clipboard"));
var _bottomSheetSlice = require("../../../core/stores/slices/bottomSheetSlice");
var _toastSlice = require("../../../core/stores/slices/toastSlice");
var _hooks = require("../../hooks");
var _enums = require("../../enums");
var _MenuAction = _interopRequireDefault(require("../MenuAction/MenuAction"));
var _icons = require("../../../core/assets/icons");
var _constants = require("../../../core/constants");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function CopyLinkAction({
  link,
  pageId,
  componentId = _enums.ComponentID.WildCardComponent,
  onPress,
  dark
}) {
  const {
    showToast
  } = (0, _toastSlice.useToast)();
  const {
    closeBottomSheet
  } = (0, _bottomSheetSlice.useBottomSheet)();
  const {
    config,
    isExcluded
  } = (0, _hooks.useAmityElement)({
    pageId,
    componentId,
    elementId: _enums.ElementID.copy_link
  });
  if (isExcluded) return null;
  return /*#__PURE__*/React.createElement(_MenuAction.default, {
    gap: "small",
    dark: dark,
    iconProps: {
      xml: (0, _icons.link)()
    },
    label: (config === null || config === void 0 ? void 0 : config.text) ?? 'Copy link',
    onPress: () => {
      onPress ? onPress() : closeBottomSheet();
      _clipboard.default.setString(link);
      showToast({
        message: _constants.TOAST.SHARE.COPY.SUCCESS,
        type: 'success'
      });
    }
  });
}
//# sourceMappingURL=CopyLinkAction.js.map