How to use the @shopgate/engage/core.useWidgetSettings function in @shopgate/engage

To help you get started, we’ve selected a few @shopgate/engage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shopgate / pwa / themes / theme-gmd / components / AppBar / presets / DefaultBar / components / CartBadge / index.jsx View on Github external
const CartButtonBadge = ({ count, style }) => {
  const settings = useWidgetSettings('@shopgate/engage/components/AppBar');

  const badgeStyle = {
    ...style,
    boxShadow: settings.buttonCartBadgeShadow,
  };

  const productCount = count > CART_MAX_ITEMS ? `${CART_MAX_ITEMS}+` : count;

  return (
    <div style="{badgeStyle}">{productCount}</div>
  );
};
github shopgate / pwa / libraries / engage / product / components / OrderQuantityHint / index.jsx View on Github external
const OrderQuantityHint = ({ stock }) =&gt; {
  if (!isBeta()) {
    return null;
  }

  const settings = useWidgetSettings('@shopgate/engage/product/OrderQuantityHint');

  return (
    
      {settings.show &amp;&amp; stock &amp;&amp; !!stock.minOrderQuantity &amp;&amp;
        <div>
          
        </div>
        }
      {settings.show &amp;&amp; stock &amp;&amp; !!stock.maxOrderQuantity &amp;&amp;
        <div>
          </div>
github shopgate / pwa / themes / theme-gmd / pages / ProductGallery / components / Content / components / ImagesSlider / index.jsx View on Github external
const ProductGalleryImages = ({ initialSlide, images }) =&gt; {
  if (!Array.isArray(images) || images.length === 0) {
    return <div>;
  }

  const imagesByIndex = getImagesByIndex(images);

  const { zoom = {} } = useWidgetSettings('@shopgate/engage/product/Gallery') || {};

  return (
    <div>
       1}
        disabled={imagesByIndex.length === 1}
        zoom={{
          ...GALLERY_SLIDER_ZOOM,
          ...zoom,
        }}
      &gt;
        {imagesByIndex.map(imagesInIndex =&gt; (</div></div>
github shopgate / pwa / libraries / engage / product / components / EffectivityDates / index.jsx View on Github external
const EffectivityDates = ({ dates, children, productNotAvailable }) =&gt; {
  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 }) =&gt; {
        if (before) {
          return showStartDateHint(settings, startDate)
            ? 
            : children;
        }

        if (between) {
          return (
github shopgate / pwa / themes / theme-gmd / pages / ProductGallery / components / Content / components / MediaSlider / index.jsx View on Github external
const ProductGalleryMedia = ({ initialSlide, media }) =&gt; {
  if (!Array.isArray(media) || media.length === 0) {
    return <div>;
  }

  const settings = useWidgetSettings('@shopgate/engage/product/Gallery');

  return (
    <div>
       1}
        disabled={media.length === 1}
        zoom={{
          ...GALLERY_SLIDER_ZOOM,
          ...settings.zoom,
        }}
      &gt;
        {media.map(singleMedia =&gt; (</div></div>
github shopgate / pwa / themes / theme-ios11 / components / AppBar / components / CartButton / components / CartBadge / index.jsx View on Github external
const CartButtonBadge = ({ count, style }) =&gt; {
  const settings = useWidgetSettings('@shopgate/engage/components/AppBar');

  if (!count) {
    return null;
  }

  const badgeStyle = {
    ...style,
    boxShadow: settings.buttonCartBadgeShadow,
  };

  const productCount = count &gt; CART_MAX_ITEMS ? `${CART_MAX_ITEMS}+` : count;

  return (
    <div data-test-id="badge" style="{badgeStyle}">{productCount}</div>
  );
};
github shopgate / pwa / libraries / engage / product / components / MapPriceHint / index.jsx View on Github external
const MapPriceHint = ({ price, mapPrice }) =&gt; {
  if (!isBeta()) {
    return null;
  }

  const settings = useWidgetSettings('@shopgate/engage/product/MapPrice');
  if (!settings.showHint || !settings.hint) {
    return null;
  }

  const styles = useWidgetStyles('@shopgate/engage/product/MapPrice');

  return (
    
      {showHint(price, mapPrice) &amp;&amp;
        
          {({ between }) =&gt; (
            between &amp;&amp;