How to use the @shopgate/engage/core.getThemeSettings 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 / libraries / engage / product / helpers / redirects.js View on Github external
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) {
      // Forbid redirect if endDate is expired
      if (effectivityDates.endDate
        && isAfter(new Date(), new Date(effectivityDates.endDate))) {
        return null;
      }
github shopgate / pwa / libraries / engage / product / components / EffectivityDates / helpers.js View on Github external
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: {
      showScheduled,
    },
  };
};
github shopgate / pwa / libraries / commerce / product / subscriptions / index.js View on Github external
subscribe(productNotAvailableEffDatesPDP$, ({
    action, getState, dispatch, events,
  }) => {
    const { effectivityDates: { accessExpired } = {} } = getThemeSettings('product') || {};
    if (accessExpired === false) {
      const { productId } = action;
      dispatch(historyPop());
      const name = getProductName(getState(), { productId });
      events.emit(ToastProvider.ADD, {
        id: 'product.available.not_search_similar',
        message: 'product.available.not_search_similar',
        messageParams: {
          name,
        },
        action: () => dispatch(historyPush({
          pathname: getSearchRoute(name),
        })),
      });
    }
  });
github shopgate / pwa / libraries / engage / product / components / LocationStockInfo / index.jsx View on Github external
const LocationStockInfo = ({ location, className, showStoreName }) => {
  const { locationStockInfo } = getThemeSettings('product');
  const settings = defaultsDeep(locationStockInfo, defaultSettings);

  const { availabilityText = '', availabilityTextColor = 'inherit' } =
    getAvailabilitySettings(settings, location.visibleInventory, location.inventoryBlind);

  const defaultClassName = css({
    color: availabilityTextColor,
    fontSize: '0.875rem',
    margin: 0,
  });

  return (