@shopgate/engage
Version:
Shopgate's ENGAGE library.
42 lines (41 loc) • 1.16 kB
JavaScript
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { ROPIS
// BOPIS,
} from '@shopgate/engage/locations';
import { I18n } from '@shopgate/engage/components';
import { useCartItemProduct } from "./CartItem.hooks";
import { caption } from "./CartItemProductPriceCaption.style";
/**
* @returns {JSX.Element}
*/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const CartItemProductPriceCaption = ({
className
}) => {
const {
cartItem
} = useCartItemProduct();
const label = useMemo(() => {
const labels = {
[ROPIS]: 'cart.price_caption.reservation'
// [BOPIS]: 'cart.price_caption.pay_in_store',
};
const fulfillmentMethod = cartItem?.fulfillment?.method || null;
return labels[fulfillmentMethod];
}, [cartItem]);
if (!label) {
return null;
}
return /*#__PURE__*/_jsxs("span", {
className: classNames(caption, className),
children: ["(", /*#__PURE__*/_jsx(I18n.Text, {
string: label
}), ")"]
});
};
CartItemProductPriceCaption.defaultProps = {
className: null
};
export { CartItemProductPriceCaption };