How to use the @shopgate/pwa-core.Conditioner function in @shopgate/pwa-core

To help you get started, we’ve selected a few @shopgate/pwa-core 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-ios11 / pages / Product / __mocks__ / context.js View on Github external
import React from 'react';
import { Conditioner } from '@shopgate/pwa-core';

export const defaultContext = {
  productId: null,
  variantId: null,
  options: {},
  characteristics: {},
  setCharacteristic: jest.fn(),
  conditioner: new Conditioner(),
};

let context;

export const ProductContext = ({
  Provider(props) {
    /* eslint-disable react/prop-types */
    context = props.value || defaultContext;
    return React.createElement('div', null, props.children);
    /* eslint-enable react/prop-types */
  },
  Consumer(props) {
    return props.children(context || defaultContext);
  },
});
github shopgate / pwa / themes / theme-ios11 / pages / Product / components / Content / index.jsx View on Github external
constructor(props) {
    super(props);

    this.baseContextValue = {
      conditioner: new Conditioner(),
    };

    this.state = {
      currency: props.currency,
      options: {},
      optionsPrices: {},
      productId: props.variantId ? props.baseProductId : props.productId,
      variantId: props.variantId ? props.variantId : null,
      characteristics: null,
      quantity: 1,
    };
  }
github shopgate / pwa / themes / theme-gmd / pages / Product / components / Content / index.jsx View on Github external
constructor(props) {
    super(props);

    this.baseContextValue = {
      conditioner: new Conditioner(),
    };

    this.state = {
      currency: props.currency,
      options: {},
      optionsPrices: {},
      productId: props.variantId ? props.baseProductId : props.productId,
      variantId: props.variantId ? props.variantId : null,
      characteristics: null,
      quantity: 1,
    };
  }