import { useMemo } from 'react';
import { Iconfont } from '@pisell/materials';
import classNames from 'classnames';
// import { useShallowEqualSelector } from '@/hooks';
// import { getText } from '@/utils/formatMessage';
import styles from "./index.less";
// import { callPhone, sendEmail } from '@/utils/index';

export var defaultBookingConfig = {
  booking_mode_after_cut_off: 'booking_closed'
};
var CallToBook = function CallToBook(props) {
  var show = props.show,
    type = props.type,
    shop = props.shop;
  // const { shop }: any = useShallowEqualSelector(({ global }: any) => global);
  // const { customPageData }: any = useShallowEqualSelector(
  //   ({ bookingOrder }: any) => bookingOrder
  // );

  // const type = useMemo(() => {
  //   let _setting = customPageData?.block?.find((d) => d.type === 'product_list')
  //     ?.setting?.bookingConfig;
  //   _setting = {
  //     ...defaultBookingConfig,
  //     ..._setting,
  //   };
  //   return _setting.booking_mode_after_cut_off;
  // }, [customPageData]);

  var message = useMemo(function () {
    if (type === 'booking_closed') {
      return null;
    }
    if (type === 'call_to_book' && shop.phone) {
      return /*#__PURE__*/React.createElement("div", {
        className: styles['sales-close-tip']
      }, "\u5173\u95ED", /*#__PURE__*/React.createElement("a", {
        className: styles['sales-close-tel']
        // onClick={() => {
        //   callPhone(`+${shop.country_calling_code}${shop.phone}`);
        // }}
      }, "+", shop.country_calling_code, " ", shop.phone));
    }
    if (type === 'email_to_book' && shop.contact_email) {
      return /*#__PURE__*/React.createElement("div", {
        className: styles['sales-close-tip']
      }, "4", /*#__PURE__*/React.createElement("a", {
        className: styles['sales-close-tel']
        // onClick={() => {
        //   sendEmail(shop.contact_email);
        // }}
      }, shop.contact_email));
    }
    return null;
  }, [type]);
  return show ? /*#__PURE__*/React.createElement("div", {
    className: styles['sales-close']
  }, /*#__PURE__*/React.createElement(Iconfont, {
    className: classNames('iconshangjia', styles['sales-icon'])
  }), /*#__PURE__*/React.createElement("div", {
    className: styles['sales-close-tip']
  }, "6"), message) : null;
};
export default CallToBook;