@shopgate/engage
Version:
Shopgate's ENGAGE library.
33 lines (32 loc) • 984 B
JavaScript
import * as React from 'react';
import noop from 'lodash/noop';
import { I18n, ContextMenu } from '@shopgate/engage/components';
import connect from "./CartContextMenuItemChangeFulfillment.connector";
/**
* @param {Object} props The component props.
* @property {Function} props.onClick onClick
* @property {Function} props.closeMenu closeMenu
* @returns {JSX}
*/
import { jsx as _jsx } from "react/jsx-runtime";
export const CartContextMenuItemChangeFulfillment = connect(props => {
const {
onClick,
closeMenu,
enabledFulfillmentMethods
} = props;
if (!Array.isArray(enabledFulfillmentMethods) || enabledFulfillmentMethods.length <= 1) {
return null;
}
return /*#__PURE__*/_jsx(ContextMenu.Item, {
onClick: onClick,
closeMenu: closeMenu,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: "locations.change_fulfillment_method"
})
});
});
CartContextMenuItemChangeFulfillment.defaultProps = {
onClick: noop,
closeMenu: noop
};