"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.OnAddToWishlistCTA = exports.OnAddToBagCTA = void 0;

var _react = _interopRequireDefault(require("react"));

var _link = _interopRequireDefault(require("next/link"));

var _ = require("../../../");

var _lib = require("@sentecacommerce-theme/lib");

var OnAddToBagCTA = function OnAddToBagCTA(_ref) {
  var isAuthenticated = _ref.isAuthenticated,
      handleClose = _ref.handleClose;

  var _useConfigState = (0, _lib.useConfigState)(),
      views = _useConfigState.views;

  var bagCount = (0, _lib.useBasketTotalCount)();

  var _useUIFunctions = (0, _lib.useUIFunctions)(),
      enqueueView = _useUIFunctions.enqueueView;

  var handleClick = function handleClick() {
    enqueueView(views.auth, {
      isCheckout: true
    });
    handleClose();
  };

  var _useGlobalLabels = (0, _lib.useGlobalLabels)(),
      buttons = _useGlobalLabels.buttons;

  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_link["default"], {
    href: "/basket",
    prefetch: false
  }, /*#__PURE__*/_react["default"].createElement(_.Button, {
    variant: "light",
    bordered: true,
    onClick: handleClose
  }, buttons.viewBag, " (", bagCount, ")")), isAuthenticated ? /*#__PURE__*/_react["default"].createElement(_link["default"], {
    href: "/checkout",
    prefetch: false
  }, /*#__PURE__*/_react["default"].createElement(_.Button, {
    className: "ml-sm-4",
    variant: "primary",
    onClick: handleClose
  }, buttons.checkout)) : /*#__PURE__*/_react["default"].createElement(_.Button, {
    onClick: handleClick,
    className: "ml-sm-4",
    variant: "primary"
  }, buttons.checkout));
};

exports.OnAddToBagCTA = OnAddToBagCTA;

var OnAddToWishlistCTA = function OnAddToWishlistCTA(_ref2) {
  var handleClose = _ref2.handleClose;
  return /*#__PURE__*/_react["default"].createElement(_link["default"], {
    href: "/favorites",
    prefetch: false
  }, /*#__PURE__*/_react["default"].createElement(_.Button, {
    variant: "primary",
    fullWidth: true,
    borderRadius: "large",
    onClick: handleClose
  }, "View Favorites"));
};

exports.OnAddToWishlistCTA = OnAddToWishlistCTA;
//# sourceMappingURL=index.js.map