Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const buildShowScheduledParams = () => {
if (!isBeta()) {
return {};
}
let cachedTime = null;
let { effectivityDates: { showScheduled } = {} } = getThemeSettings('product') || {};
if (showScheduled === ALWAYS) {
showScheduled = 'P1Y';
} else if (showScheduled === NEVER) {
showScheduled = 'PT0S';
cachedTime = 60000; // 1 minute min effective precision
}
return {
cachedTime,
params: {
{/* This feature is currently in BETA testing.
It should only be used for approved BETA Client Projects */}
{isBeta() && }
);
renderer = (props) => {
if (isBeta() && !!props.swatch) {
return ;
}
return ;
};
const EffectivityDates = ({ dates, children, productNotAvailable }) => {
if (!isBeta() || !dates) {
return children;
}
const settings = useWidgetSettings('@shopgate/engage/product/EffectivityDates');
const startDate = new Date(dates.startDate);
const endDate = new Date(dates.endDate);
return (
{({ before, between, after }) => {
if (before) {
return showStartDateHint(settings, startDate)
?
: children;
}
hideRating,
titleRows,
}) {
const {
featuredImageUrl,
featuredMedia,
id,
name,
price,
rating,
} = product;
return (
{isBeta() && featuredMedia
?
:
}
{(!hidePrice && price.discount > 0) && }
{(!(hidePrice && hideRating)) && (
<div>
{(!hideRating && rating && rating.average > 0) && (
)}
{!hideName && (</div>
function ProductCard(props) {
const {
product, hidePrice, hideRating, hideName, titleRows,
} = props;
return (
{isBeta() && product.featuredMedia
?
:
}
{!!(!hidePrice && product.price.discount) && (
<div>
</div>
)}
const OrderQuantityHint = ({ stock }) => {
if (!isBeta()) {
return null;
}
const settings = useWidgetSettings('@shopgate/engage/product/OrderQuantityHint');
return (
{settings.show && stock && !!stock.minOrderQuantity &&
<div>
</div>
}
{settings.show && stock && !!stock.maxOrderQuantity &&
const Item = ({ product, display }) => (
{isBeta() && product.featuredMedia
?
:
}
export const enableRedirectHandler = () => {
if (!isBeta()) {
return;
}
/** Effectivity dates */
const { effectivityDates: { accessExpired } = {} } = getThemeSettings('product') || {};
if (accessExpired) {
return;
}
const getProductEffectivityDates = makeGetProductEffectivityDates();
redirects.set(ITEM_PATTERN, ({ action, getState }) => {
const { params: { pathname }, route: { state: { productId } } } = action;
const effectivityDates = getProductEffectivityDates(getState(), { productId });
if (effectivityDates) {
export const setDefaultProductFetchParams = () => {
if (!isBeta()) {
return;
}
configuration.set(DEFAULT_PRODUCTS_FETCH_PARAMS, {
characteristics: true,
});
};