react#PureComponent JavaScript Examples

The following examples show how to use react#PureComponent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ManyOptions.js    From VTour with MIT License 6 votes vote down vote up
Option =
/*#__PURE__*/
function (_PureComponent) {
  _inheritsLoose(Option, _PureComponent);

  function Option() {
    return _PureComponent.apply(this, arguments) || this;
  }

  var _proto = Option.prototype;

  _proto.render = function render() {
    var _this$props = this.props,
        value = _this$props.value,
        selected = _this$props.selected;
    return React.createElement(Box, {
      direction: "row",
      gap: "small",
      align: "center",
      pad: "xsmall"
    }, React.createElement(CheckBox, {
      tabIndex: "-1",
      checked: selected,
      onChange: function onChange() {}
    }), value);
  };

  return Option;
}(PureComponent)
Example #2
Source File: Flag.js    From smart-contracts with MIT License 6 votes vote down vote up
Flag = /*#__PURE__*/function (_PureComponent) {
  _inheritsLoose(Flag, _PureComponent);

  function Flag() {
    return _PureComponent.apply(this, arguments) || this;
  }

  var _proto = Flag.prototype;

  _proto.render = function render() {
    var _this$props = this.props,
        className = _this$props.className,
        name = _this$props.name;
    var classes = cx(name, 'flag', className);
    var rest = getUnhandledProps(Flag, this.props);
    var ElementType = getElementType(Flag, this.props);
    return /*#__PURE__*/React.createElement(ElementType, _extends({}, rest, {
      className: classes
    }));
  };

  return Flag;
}(PureComponent)
Example #3
Source File: Flag.js    From spring-boot-ecommerce with Apache License 2.0 6 votes vote down vote up
Flag =
/*#__PURE__*/
function (_PureComponent) {
  _inherits(Flag, _PureComponent);

  function Flag() {
    _classCallCheck(this, Flag);

    return _possibleConstructorReturn(this, _getPrototypeOf(Flag).apply(this, arguments));
  }

  _createClass(Flag, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          className = _this$props.className,
          name = _this$props.name;
      var classes = cx(name, 'flag', className);
      var rest = getUnhandledProps(Flag, this.props);
      var ElementType = getElementType(Flag, this.props);
      return React.createElement(ElementType, _extends({}, rest, {
        className: classes
      }));
    }
  }]);

  return Flag;
}(PureComponent)
Example #4
Source File: index.js    From hzero-front with Apache License 2.0 6 votes vote down vote up
/**
 * 消息查询数据展示列表
 * @extends {PureComponent} - React.PureComponent
 * @reactProps {Object} formValues - 查询表单值
 * @reactProps {Object} recordData - 表格中信息的一条记录
 * @return React.element
 */

function getRefFieldsValue(ref) {
  if (ref.current) {
    return ref.current.props.form.getFieldsValue();
  }
  return {};
}
Example #5
Source File: pure.js    From Nextjs-ja-translation-docs with MIT License 5 votes vote down vote up
export default function (Comp) {
  return class extends PureComponent {
    render() {
      return <Comp {...this.props} />;
    }
  };
}
Example #6
Source File: button.js    From Nextjs-ja-translation-docs with MIT License 5 votes vote down vote up
function withPure(Comp) {
  return class extends PureComponent {
    render() {
      return <Comp {...this.props} />;
    }
  };
}
Example #7
Source File: Icon.js    From smart-contracts with MIT License 5 votes vote down vote up
Icon = /*#__PURE__*/function (_PureComponent) {
  _inheritsLoose(Icon, _PureComponent);

  function Icon() {
    var _this;

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;

    _this.handleClick = function (e) {
      var disabled = _this.props.disabled;

      if (disabled) {
        e.preventDefault();
        return;
      }

      _invoke(_this.props, 'onClick', e, _this.props);
    };

    return _this;
  }

  var _proto = Icon.prototype;

  _proto.getIconAriaOptions = function getIconAriaOptions() {
    var ariaOptions = {};
    var _this$props = this.props,
        ariaLabel = _this$props['aria-label'],
        ariaHidden = _this$props['aria-hidden'];

    if (_isNil(ariaLabel)) {
      ariaOptions['aria-hidden'] = 'true';
    } else {
      ariaOptions['aria-label'] = ariaLabel;
    }

    if (!_isNil(ariaHidden)) {
      ariaOptions['aria-hidden'] = ariaHidden;
    }

    return ariaOptions;
  };

  _proto.render = function render() {
    var _this$props2 = this.props,
        bordered = _this$props2.bordered,
        circular = _this$props2.circular,
        className = _this$props2.className,
        color = _this$props2.color,
        corner = _this$props2.corner,
        disabled = _this$props2.disabled,
        fitted = _this$props2.fitted,
        flipped = _this$props2.flipped,
        inverted = _this$props2.inverted,
        link = _this$props2.link,
        loading = _this$props2.loading,
        name = _this$props2.name,
        rotated = _this$props2.rotated,
        size = _this$props2.size;
    var classes = cx(color, name, size, useKeyOnly(bordered, 'bordered'), useKeyOnly(circular, 'circular'), useKeyOnly(disabled, 'disabled'), useKeyOnly(fitted, 'fitted'), useKeyOnly(inverted, 'inverted'), useKeyOnly(link, 'link'), useKeyOnly(loading, 'loading'), useKeyOrValueAndKey(corner, 'corner'), useValueAndKey(flipped, 'flipped'), useValueAndKey(rotated, 'rotated'), 'icon', className);
    var rest = getUnhandledProps(Icon, this.props);
    var ElementType = getElementType(Icon, this.props);
    var ariaOptions = this.getIconAriaOptions();
    return /*#__PURE__*/React.createElement(ElementType, _extends({}, rest, ariaOptions, {
      className: classes,
      onClick: this.handleClick
    }));
  };

  return Icon;
}(PureComponent)
Example #8
Source File: localeHOC.js    From scalable-form-platform with MIT License 5 votes vote down vote up
export default function localeMessagesWrapper(YComponent) {
    return class extends PureComponent {
        static propTypes = {
            locale: PropTypes.string
        };

        static defaultProps = {
            locale: navigator.language.toLocaleLowerCase()
        };

        constructor(props) {
            super(props);
            this.getWrappedInstance = this.getWrappedInstance.bind(this);
            this.handleFormPreview = this.handleFormPreview.bind(this);
            this.handleFormSave = this.handleFormSave.bind(this);
            this.state = {
                locale: props.locale
            };
        }

        componentWillReceiveProps(nextProps) {
            if (nextProps.locale !== this.props.locale) {
                this.setState({
                    locale: nextProps.locale
                });
            }
        }

        getWrappedInstance() {
            return this.refs.wrappedInstance;
        }

        handleFormPreview() {
            this.getWrappedInstance().handleFormPreview();
        }

        handleFormSave() {
            this.getWrappedInstance().handleFormSave();
        }

        render() {
            const locale = this.state.locale;
            return (
                <YComponent
                    ref="wrappedInstance"
                    messages={messages[locale] || messages['en-us']}
                    {...this.props}
                />
            );
        }
    }
}
Example #9
Source File: Icon.js    From spring-boot-ecommerce with Apache License 2.0 4 votes vote down vote up
Icon =
/*#__PURE__*/
function (_PureComponent) {
  _inherits(Icon, _PureComponent);

  function Icon() {
    var _getPrototypeOf2;

    var _this;

    _classCallCheck(this, Icon);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Icon)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
      var disabled = _this.props.disabled;

      if (disabled) {
        e.preventDefault();
        return;
      }

      _invoke(_this.props, 'onClick', e, _this.props);
    });

    return _this;
  }

  _createClass(Icon, [{
    key: "getIconAriaOptions",
    value: function getIconAriaOptions() {
      var ariaOptions = {};
      var _this$props = this.props,
          ariaLabel = _this$props['aria-label'],
          ariaHidden = _this$props['aria-hidden'];

      if (_isNil(ariaLabel)) {
        ariaOptions['aria-hidden'] = 'true';
      } else {
        ariaOptions['aria-label'] = ariaLabel;
      }

      if (!_isNil(ariaHidden)) {
        ariaOptions['aria-hidden'] = ariaHidden;
      }

      return ariaOptions;
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props2 = this.props,
          bordered = _this$props2.bordered,
          circular = _this$props2.circular,
          className = _this$props2.className,
          color = _this$props2.color,
          corner = _this$props2.corner,
          disabled = _this$props2.disabled,
          fitted = _this$props2.fitted,
          flipped = _this$props2.flipped,
          inverted = _this$props2.inverted,
          link = _this$props2.link,
          loading = _this$props2.loading,
          name = _this$props2.name,
          rotated = _this$props2.rotated,
          size = _this$props2.size;
      var classes = cx(color, name, size, useKeyOnly(bordered, 'bordered'), useKeyOnly(circular, 'circular'), useKeyOnly(disabled, 'disabled'), useKeyOnly(fitted, 'fitted'), useKeyOnly(inverted, 'inverted'), useKeyOnly(link, 'link'), useKeyOnly(loading, 'loading'), useKeyOrValueAndKey(corner, 'corner'), useValueAndKey(flipped, 'flipped'), useValueAndKey(rotated, 'rotated'), 'icon', className);
      var rest = getUnhandledProps(Icon, this.props);
      var ElementType = getElementType(Icon, this.props);
      var ariaOptions = this.getIconAriaOptions();
      return React.createElement(ElementType, _extends({}, rest, ariaOptions, {
        className: classes,
        onClick: this.handleClick
      }));
    }
  }]);

  return Icon;
}(PureComponent)
Example #10
Source File: SortablePageList.js    From dnd-builder with MIT License 4 votes vote down vote up
SortablePageList = Component => {
  class ReactWindowList extends PureComponent {
    constructor(props) {
      super(props);

      this.sortablePageListRef = createRef();
      this.sortableOuterRef = createRef();
    }

    get itemData() {
      const {
        acceptedItems,
        additionalPageItems,
        disableInteraction,
        hashCode,
        itemAccessor,
        onAnEventTrigger,
        onPageAdd,
        onPageClick,
        onPageDuplicate,
        onPageRemove,
        pageContainerStyle,
        pageGetter,
        selectedPageIndex,
      } = this.props;
      return createItemData(
        acceptedItems,
        additionalPageItems,
        disableInteraction,
        hashCode,
        itemAccessor,
        onAnEventTrigger,
        onPageAdd,
        onPageClick,
        onPageDuplicate,
        onPageRemove,
        pageContainerStyle,
        pageGetter,
        selectedPageIndex,
      );
    }

    render() {
      const { height, pageCount, width } = this.props;

      return (
        <Component
          ref={this.sortablePageListRef}
          height={height}
          itemCount={pageCount}
          itemData={this.itemData}
          itemSize={127}
          outerRef={this.sortableOuterRef}
          width={width}
        >
          {SortablePageItemRenderer}
        </Component>
      );
    }
  }

  ReactWindowList.propTypes = {
    acceptedItems: PropTypes.shape({}),
    additionalPageItems: PropTypes.arrayOf(PropTypes.node),
    disableInteraction: PropTypes.arrayOf(PropTypes.string),
    hashCode: PropTypes.string,
    height: PropTypes.number,
    itemAccessor: PropTypes.func,
    onAnEventTrigger: PropTypes.func,
    onPageAdd: PropTypes.func,
    onPageClick: PropTypes.func,
    onPageDuplicate: PropTypes.func,
    onPageRemove: PropTypes.func,
    pageContainerStyle: PropTypes.shape({}),
    pageCount: PropTypes.number,
    pageGetter: PropTypes.func,
    selectedPageIndex: PropTypes.number,
    width: PropTypes.number,
  };

  ReactWindowList.defaultProps = {
    acceptedItems: {},
    additionalPageItems: [],
    disableInteraction: [],
    hashCode: '',
    height: 0,
    itemAccessor: () => {},
    onAnEventTrigger: () => {},
    onPageAdd: () => {},
    onPageClick: () => {},
    onPageDuplicate: () => {},
    onPageRemove: () => {},
    pageContainerStyle: {},
    pageCount: 0,
    pageGetter: () => {},
    selectedPageIndex: 1,
    width: 0,
  };

  return SortableContainer(ReactWindowList, { withRef: true });
}
Example #11
Source File: index.esm.js    From dynamic-virtualized-list with MIT License 4 votes vote down vote up
DynamicSizeList = /*#__PURE__*/function (_PureComponent) {
  _inheritsLoose(DynamicSizeList, _PureComponent);

  // Always use explicit constructor for React components.
  // It produces less code after transpilation. (#26)
  // eslint-disable-next-line no-useless-constructor
  function DynamicSizeList(_props) {
    var _this;

    _this = _PureComponent.call(this, _props) || this;
    _this._listMetaData = {
      itemOffsetMap: {},
      itemSizeMap: {},
      totalMeasuredSize: 0,
      atBottom: true
    };
    _this._itemStyleCache = {};
    _this._outerRef = void 0;
    _this._scrollCorrectionInProgress = false;
    _this._scrollByCorrection = null;
    _this._keepScrollPosition = false;
    _this._keepScrollToBottom = false;
    _this._mountingCorrections = 0;
    _this._correctedInstances = 0;
    _this.state = {
      scrollDirection: 'backward',
      scrollOffset: typeof _this.props.initialScrollOffset === 'number' ? _this.props.initialScrollOffset : 0,
      scrollUpdateWasRequested: false,
      scrollDelta: 0,
      scrollHeight: 0,
      localOlderPostsToRender: []
    };

    _this.scrollBy = function (scrollOffset, scrollBy) {
      return function () {
        var element = _this._outerRef;

        if (typeof element.scrollBy === 'function' && scrollBy) {
          element.scrollBy(0, scrollBy);
        } else if (scrollOffset) {
          element.scrollTop = scrollOffset;
        }

        _this._scrollCorrectionInProgress = false;
      };
    };

    _this._callOnItemsRendered = memoizeOne(function (overscanStartIndex, overscanStopIndex, visibleStartIndex, visibleStopIndex) {
      return _this.props.onItemsRendered({
        overscanStartIndex: overscanStartIndex,
        overscanStopIndex: overscanStopIndex,
        visibleStartIndex: visibleStartIndex,
        visibleStopIndex: visibleStopIndex
      });
    });
    _this._callOnScroll = memoizeOne(function (scrollDirection, scrollOffset, scrollUpdateWasRequested, scrollHeight, clientHeight) {
      return _this.props.onScroll({
        scrollDirection: scrollDirection,
        scrollOffset: scrollOffset,
        scrollUpdateWasRequested: scrollUpdateWasRequested,
        scrollHeight: scrollHeight,
        clientHeight: clientHeight
      });
    });

    _this._commitHook = function () {
      if (!_this.state.scrolledToInitIndex && Object.keys(_this._listMetaData.itemOffsetMap).length) {
        var _this$props$initScrol = _this.props.initScrollToIndex(),
            index = _this$props$initScrol.index,
            position = _this$props$initScrol.position,
            offset = _this$props$initScrol.offset;

        _this.scrollToItem(index, position, offset);

        _this.setState({
          scrolledToInitIndex: true
        });

        if (index === 0) {
          _this._keepScrollToBottom = true;
        } else {
          _this._keepScrollPosition = true;
        }
      }
    };

    _this._dataChange = function () {
      if (_this._listMetaData.totalMeasuredSize < _this.props.height) {
        _this.props.canLoadMorePosts();
      }
    };

    _this._heightChange = function (prevHeight, prevOffset) {
      var wasAtBottom = prevOffset + prevHeight >= _this._listMetaData.totalMeasuredSize - atBottomMargin;

      if (window.logDSLEvents) {
        console.log('DynamicSizeList._heightChange', 'prevHeight=' + prevHeight, 'prevOffset=' + prevOffset, 'totalMeasuredSize=' + _this._listMetaData.totalMeasuredSize, 'wasAtBottom=' + wasAtBottom);
      }

      if (wasAtBottom) {
        if (window.logDSLEvents) {
          console.log('DynamicSizeList._heightChange - keeping at end');
        }

        _this.scrollToItem(0, 'end');

        return;
      } else {
        if (window.logDSLEvents) {
          console.log('DynamicSizeList._heightChange - not keeping at end');
        }
      }
    };

    _this._widthChange = function (prevHeight, prevOffset) {
      var wasAtBottom = prevOffset + prevHeight >= _this._listMetaData.totalMeasuredSize - atBottomMargin;

      if (window.logDSLEvents) {
        console.log('DynamicSizeList._widthChange', 'prevHeight=' + prevHeight, 'prevOffset=' + prevOffset, 'totalMeasuredSize=' + _this._listMetaData.totalMeasuredSize, 'wasAtBottom=' + (prevOffset + prevHeight >= _this._listMetaData.totalMeasuredSize - atBottomMargin));
      }

      if (wasAtBottom) {
        if (window.logDSLEvents) {
          console.log('DynamicSizeList._widthChange - keeping at end');
        }

        _this.scrollToItem(0, 'end');

        return;
      } else {
        if (window.logDSLEvents) {
          console.log('DynamicSizeList._widthChange - not keeping at end');
        }
      }
    };

    _this._getItemStyle = function (index) {
      var itemData = _this.props.itemData;
      var itemStyleCache = _this._itemStyleCache;
      var style;

      if (itemStyleCache.hasOwnProperty(itemData[index])) {
        style = itemStyleCache[itemData[index]];
      } else {
        itemStyleCache[itemData[index]] = style = {
          left: 0,
          top: getItemOffset(_this.props, index, _this._listMetaData),
          height: getItemSize(_this.props, index, _this._listMetaData),
          width: '100%'
        };
      }

      return style;
    };

    _this._correctScroll = function () {
      var scrollOffset = _this.state.scrollOffset;
      var element = _this._outerRef;

      if (element) {
        element.scrollTop = scrollOffset;
        _this._scrollCorrectionInProgress = false;
        _this._correctedInstances = 0;
        _this._mountingCorrections = 0;
      }
    };

    _this._generateOffsetMeasurements = function () {
      var _this$_listMetaData = _this._listMetaData,
          itemOffsetMap = _this$_listMetaData.itemOffsetMap,
          itemSizeMap = _this$_listMetaData.itemSizeMap;
      var itemData = _this.props.itemData;
      _this._listMetaData.totalMeasuredSize = 0;

      for (var i = itemData.length - 1; i >= 0; i--) {
        var prevOffset = itemOffsetMap[itemData[i + 1]] || 0; // In some browsers (e.g. Firefox) fast scrolling may skip rows.
        // In this case, our assumptions about last measured indices may be incorrect.
        // Handle this edge case to prevent NaN values from breaking styles.
        // Slow scrolling back over these skipped rows will adjust their sizes.

        var prevSize = itemSizeMap[itemData[i + 1]] || 0;
        itemOffsetMap[itemData[i]] = prevOffset + prevSize;
        _this._listMetaData.totalMeasuredSize += itemSizeMap[itemData[i]] || 0; // Reset cached style to clear stale position.

        delete _this._itemStyleCache[itemData[i]];
      }
    };

    _this._handleNewMeasurements = function (key, newSize, forceScrollCorrection) {
      var itemSizeMap = _this._listMetaData.itemSizeMap;
      var itemData = _this.props.itemData;
      var index = itemData.findIndex(function (item) {
        return item === key;
      }); // In some browsers (e.g. Firefox) fast scrolling may skip rows.
      // In this case, our assumptions about last measured indices may be incorrect.
      // Handle this edge case to prevent NaN values from breaking styles.
      // Slow scrolling back over these skipped rows will adjust their sizes.

      var oldSize = itemSizeMap[key] || 0;

      if (oldSize === newSize) {
        return;
      }

      itemSizeMap[key] = newSize;

      if (!_this.state.scrolledToInitIndex) {
        _this._generateOffsetMeasurements();

        return;
      }

      var element = _this._outerRef;
      var wasAtBottom = _this.props.height + element.scrollTop >= _this._listMetaData.totalMeasuredSize - atBottomMargin;

      if (window.logDSLEvents) {
        console.log('DynamicSizeList._handleNewMeasurements', 'props.height=' + _this.props.height, 'element.scrollTop=' + element.scrollTop, 'totalMeasuredSize=' + _this._listMetaData.totalMeasuredSize, 'wasAtBottom=' + wasAtBottom, '_keepScrollToBottom=' + _this._keepScrollToBottom, 'props.correctScrollToBottom=' + _this.props.correctScrollToBottom);
      }

      if ((wasAtBottom || _this._keepScrollToBottom) && _this.props.correctScrollToBottom) {
        if (window.logDSLEvents) {
          console.log('DynamicSizeList._handleNewMeasurements - keeping at end');
        }

        _this._generateOffsetMeasurements();

        _this.scrollToItem(0, 'end');

        _this.forceUpdate();

        return;
      } else {
        if (window.logDSLEvents) {
          console.log('DynamicSizeList._handleNewMeasurements - not keeping at end');
        }
      }

      if (forceScrollCorrection || _this._keepScrollPosition) {
        var delta = newSize - oldSize;

        var _this$_getRangeToRend = _this._getRangeToRender(_this.state.scrollOffset),
            _visibleStartIndex = _this$_getRangeToRend[2];

        _this._generateOffsetMeasurements();

        if (index < _visibleStartIndex + 1) {
          return;
        }

        _this._scrollCorrectionInProgress = true;

        _this.setState(function (prevState) {
          var deltaValue;

          if (_this._mountingCorrections === 0) {
            deltaValue = delta;
          } else {
            deltaValue = prevState.scrollDelta + delta;
          }

          _this._mountingCorrections++;
          var newOffset = prevState.scrollOffset + delta;
          return {
            scrollOffset: newOffset,
            scrollDelta: deltaValue
          };
        }, function () {
          // $FlowFixMe Property scrollBy is missing in HTMLDivElement
          _this._correctedInstances++;

          if (_this._mountingCorrections === _this._correctedInstances) {
            _this._correctScroll();
          }
        });

        return;
      }

      _this._generateOffsetMeasurements();
    };

    _this._onItemRowUnmount = function (itemId, index) {
      var _assertThisInitialize = _assertThisInitialized(_this),
          props = _assertThisInitialize.props;

      if (props.itemData[index] === itemId) {
        return;
      }

      var doesItemExist = props.itemData.includes(itemId);

      if (!doesItemExist) {
        delete _this._listMetaData.itemSizeMap[itemId];
        delete _this._listMetaData.itemOffsetMap[itemId];
        var element = _this._outerRef;
        var atBottom = element.offsetHeight + element.scrollTop >= _this._listMetaData.totalMeasuredSize - atBottomMargin;

        if (window.logDSLEvents) {
          console.log('DynamicSizeList._onItemRowUnmount', 'element.offsetHeight=' + element.offsetHeight, 'element.scrollTop=' + element.scrollTop, 'totalMeasuredSize=' + _this._listMetaData.totalMeasuredSize, 'atBottom=' + atBottom, '_keepScrollToBottom=' + _this._keepScrollToBottom, 'props.correctScrollToBottom=' + _this.props.correctScrollToBottom);
        }

        _this._generateOffsetMeasurements();

        if (atBottom) {
          if (window.logDSLEvents) {
            console.log('DynamicSizeList._onItemRowUnmount - keeping at end');
          }

          _this.scrollToItem(0, 'end');
        } else {
          if (window.logDSLEvents) {
            console.log('DynamicSizeList._onItemRowUnmount - not keeping at end at end');
          }
        }

        _this.forceUpdate();
      }
    };

    _this._renderItems = function () {
      var _this$props = _this.props,
          children = _this$props.children,
          direction = _this$props.direction,
          itemData = _this$props.itemData,
          loaderId = _this$props.loaderId;
      var width = _this.innerRefWidth;

      var _this$_getRangeToRend2 = _this._getRangeToRender(),
          startIndex = _this$_getRangeToRend2[0],
          stopIndex = _this$_getRangeToRend2[1];

      var itemCount = itemData.length;
      var items = [];

      if (itemCount > 0) {
        for (var index = itemCount - 1; index >= 0; index--) {
          var _getItemMetadata = getItemMetadata(_this.props, index, _this._listMetaData),
              size = _getItemMetadata.size;

          var _this$state$localOlde = _this.state.localOlderPostsToRender,
              localOlderPostsToRenderStartIndex = _this$state$localOlde[0],
              localOlderPostsToRenderStopIndex = _this$state$localOlde[1];
          var isItemInLocalPosts = index >= localOlderPostsToRenderStartIndex && index < localOlderPostsToRenderStopIndex + 1 && localOlderPostsToRenderStartIndex === stopIndex + 1;
          var isLoader = itemData[index] === loaderId;
          var itemId = itemData[index]; // It's important to read style after fetching item metadata.
          // getItemMetadata() will clear stale styles.

          var style = _this._getItemStyle(index);

          if (index >= startIndex && index < stopIndex + 1 || isItemInLocalPosts || isLoader) {
            var item = createElement(children, {
              data: itemData,
              itemId: itemId
            }); // Always wrap children in a ItemMeasurer to detect changes in size.

            items.push(createElement(ItemMeasurer, {
              direction: direction,
              handleNewMeasurements: _this._handleNewMeasurements,
              index: index,
              item: item,
              key: itemId,
              size: size,
              itemId: itemId,
              width: width,
              onUnmount: _this._onItemRowUnmount,
              itemCount: itemCount
            }));
          } else {
            items.push(createElement('div', {
              key: itemId,
              style: style
            }));
          }
        }
      }

      return items;
    };

    _this._onScrollVertical = function (event) {
      if (!_this.state.scrolledToInitIndex) {
        return;
      }

      var _event$currentTarget = event.currentTarget,
          scrollTop = _event$currentTarget.scrollTop,
          scrollHeight = _event$currentTarget.scrollHeight;

      if (_this._scrollCorrectionInProgress) {
        if (_this.state.scrollUpdateWasRequested) {
          _this.setState(function () {
            return {
              scrollUpdateWasRequested: false
            };
          });
        }

        return;
      }

      if (scrollHeight !== _this.state.scrollHeight) {
        _this.setState({
          scrollHeight: scrollHeight
        });
      }

      _this.setState(function (prevState) {
        if (prevState.scrollOffset === scrollTop) {
          // Scroll position may have been updated by cDM/cDU,
          // In which case we don't need to trigger another render,
          return null;
        }

        return {
          scrollDirection: prevState.scrollOffset < scrollTop ? 'forward' : 'backward',
          scrollOffset: scrollTop,
          scrollUpdateWasRequested: false,
          scrollHeight: scrollHeight,
          scrollTop: scrollTop,
          scrollDelta: 0
        };
      });
    };

    _this._outerRefSetter = function (ref) {
      var outerRef = _this.props.outerRef;
      _this.innerRefWidth = _this.props.innerRef.current.clientWidth;
      _this._outerRef = ref;

      if (typeof outerRef === 'function') {
        outerRef(ref);
      } else if (outerRef != null && typeof outerRef === 'object' && outerRef.hasOwnProperty('current')) {
        outerRef.current = ref;
      }
    };

    return _this;
  }

  DynamicSizeList.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
    validateProps(props);
    return null;
  };

  var _proto = DynamicSizeList.prototype;

  _proto.scrollTo = function scrollTo(scrollOffset, scrollByValue, useAnimationFrame) {
    var _this2 = this;

    if (useAnimationFrame === void 0) {
      useAnimationFrame = false;
    }

    this._scrollCorrectionInProgress = true;
    this.setState(function (prevState) {
      return {
        scrollDirection: prevState.scrollOffset >= scrollOffset ? 'backward' : 'forward',
        scrollOffset: scrollOffset,
        scrollUpdateWasRequested: true,
        scrollByValue: scrollByValue
      };
    }, function () {
      if (useAnimationFrame) {
        _this2._scrollByCorrection = window.requestAnimationFrame(_this2.scrollBy(_this2.state.scrollOffset, _this2.state.scrollByValue));
      } else {
        _this2.scrollBy(_this2.state.scrollOffset, _this2.state.scrollByValue)();
      }
    });
    this.forceUpdate();
  };

  _proto.scrollToItem = function scrollToItem(index, align, offset) {
    if (align === void 0) {
      align = 'auto';
    }

    if (offset === void 0) {
      offset = 0;
    }

    var scrollOffset = this.state.scrollOffset; //Ideally the below scrollTo works fine but firefox has 6px issue and stays 6px from bottom when corrected
    //so manually keeping scroll position bottom for now

    var element = this._outerRef;

    if (index === 0 && align === 'end') {
      this.scrollTo(element.scrollHeight - this.props.height);
      return;
    }

    var offsetOfItem = getOffsetForIndexAndAlignment(this.props, index, align, scrollOffset, this._listMetaData);

    if (!offsetOfItem) {
      var itemSize = getItemSize(this.props, index, this._listMetaData);

      if (!itemSize && this.props.scrollToFailed) {
        if (this.state.scrolledToInitIndex) {
          this.props.scrollToFailed(index);
        } else {
          console.warn('Failed to do initial scroll correction', this.props.initRangeToRender, index);
        }
      }
    }

    this.scrollTo(offsetOfItem + offset);
  };

  _proto.componentDidMount = function componentDidMount() {
    var initialScrollOffset = this.props.initialScrollOffset;

    if (typeof initialScrollOffset === 'number' && this._outerRef !== null) {
      var element = this._outerRef;
      element.scrollTop = initialScrollOffset;
    }

    this._commitHook();
  };

  _proto.getSnapshotBeforeUpdate = function getSnapshotBeforeUpdate(prevProps, prevState) {
    if (prevState.localOlderPostsToRender[0] !== this.state.localOlderPostsToRender[0] || prevState.localOlderPostsToRender[1] !== this.state.localOlderPostsToRender[1]) {
      var element = this._outerRef;
      var previousScrollTop = element.scrollTop;
      var previousScrollHeight = element.scrollHeight;
      return {
        previousScrollTop: previousScrollTop,
        previousScrollHeight: previousScrollHeight
      };
    }

    return null;
  };

  _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState, snapshot) {
    if (this.state.scrolledToInitIndex) {
      var _this$state = this.state,
          _scrollDirection = _this$state.scrollDirection,
          _scrollOffset = _this$state.scrollOffset,
          _scrollUpdateWasRequested = _this$state.scrollUpdateWasRequested,
          _scrollHeight = _this$state.scrollHeight;
      var prevScrollDirection = prevState.scrollDirection,
          prevScrollOffset = prevState.scrollOffset,
          prevScrollUpdateWasRequested = prevState.scrollUpdateWasRequested,
          previousScrollHeight = prevState.scrollHeight;

      if (_scrollDirection !== prevScrollDirection || _scrollOffset !== prevScrollOffset || _scrollUpdateWasRequested !== prevScrollUpdateWasRequested || _scrollHeight !== previousScrollHeight) {
        this._callPropsCallbacks();
      }

      if (!prevState.scrolledToInitIndex) {
        this._keepScrollPosition = false;
        this._keepScrollToBottom = false;
      }
    }

    this._commitHook();

    if (prevProps.itemData !== this.props.itemData) {
      this._dataChange();
    }

    if (prevProps.height !== this.props.height) {
      this._heightChange(prevProps.height, prevState.scrollOffset);
    }

    if (prevState.scrolledToInitIndex !== this.state.scrolledToInitIndex) {
      this._dataChange(); // though this is not data change we are checking for first load change

    }

    if (prevProps.width !== this.props.width) {
      this.innerRefWidth = this.props.innerRef.current.clientWidth;

      this._widthChange(prevProps.height, prevState.scrollOffset);
    }

    if (prevState.localOlderPostsToRender[0] !== this.state.localOlderPostsToRender[0] || prevState.localOlderPostsToRender[1] !== this.state.localOlderPostsToRender[1]) {
      var postlistScrollHeight = this._outerRef.scrollHeight;
      var scrollValue = snapshot.previousScrollTop + (postlistScrollHeight - snapshot.previousScrollHeight);
      this.scrollTo(scrollValue, scrollValue - snapshot.previousScrollTop, true);
    }
  };

  _proto.componentWillUnmount = function componentWillUnmount() {
    if (this._scrollByCorrection) {
      window.cancelAnimationFrame(this._scrollByCorrection);
    }
  };

  _proto.render = function render() {
    var _this$props2 = this.props,
        className = _this$props2.className,
        innerRef = _this$props2.innerRef,
        innerTagName = _this$props2.innerTagName,
        outerTagName = _this$props2.outerTagName,
        style = _this$props2.style,
        innerListStyle = _this$props2.innerListStyle;
    var onScroll = this._onScrollVertical;

    var items = this._renderItems();

    return createElement(outerTagName, {
      className: className,
      onScroll: onScroll,
      ref: this._outerRefSetter,
      style: _extends({
        WebkitOverflowScrolling: 'touch',
        overflowY: 'auto',
        overflowAnchor: 'none',
        willChange: 'transform',
        width: '100%'
      }, style)
    }, createElement(innerTagName, {
      children: items,
      ref: innerRef,
      style: innerListStyle
    }));
  };

  _proto._callPropsCallbacks = function _callPropsCallbacks() {
    var _this$props3 = this.props,
        itemData = _this$props3.itemData,
        height = _this$props3.height;
    var _this$state2 = this.state,
        scrollDirection = _this$state2.scrollDirection,
        scrollOffset = _this$state2.scrollOffset,
        scrollUpdateWasRequested = _this$state2.scrollUpdateWasRequested,
        scrollHeight = _this$state2.scrollHeight;
    var itemCount = itemData.length;

    if (typeof this.props.onItemsRendered === 'function') {
      if (itemCount > 0) {
        var _this$_getRangeToRend3 = this._getRangeToRender(),
            _overscanStartIndex = _this$_getRangeToRend3[0],
            _overscanStopIndex = _this$_getRangeToRend3[1],
            _visibleStartIndex2 = _this$_getRangeToRend3[2],
            _visibleStopIndex = _this$_getRangeToRend3[3];

        this._callOnItemsRendered(_overscanStartIndex, _overscanStopIndex, _visibleStartIndex2, _visibleStopIndex);

        if (scrollDirection === 'backward' && scrollOffset < 1000 && _overscanStopIndex !== itemCount - 1) {
          var sizeOfNextElement = getItemSize(this.props, _overscanStopIndex + 1, this._listMetaData).size;

          if (!sizeOfNextElement && this.state.scrolledToInitIndex) {
            this.setState(function (prevState) {
              if (prevState.localOlderPostsToRender[0] !== _overscanStopIndex + 1) {
                return {
                  localOlderPostsToRender: [_overscanStopIndex + 1, _overscanStopIndex + 50]
                };
              }

              return null;
            });
          }
        }
      }
    }

    if (typeof this.props.onScroll === 'function') {
      this._callOnScroll(scrollDirection, scrollOffset, scrollUpdateWasRequested, scrollHeight, height);
    }
  } // This method is called after mount and update.
  // List implementations can override this method to be notified.
  ;

  _proto._getRangeToRender = function _getRangeToRender(scrollTop, scrollHeight) {
    var _this$props4 = this.props,
        itemData = _this$props4.itemData,
        overscanCountForward = _this$props4.overscanCountForward,
        overscanCountBackward = _this$props4.overscanCountBackward;
    var _this$state3 = this.state,
        scrollDirection = _this$state3.scrollDirection,
        scrollOffset = _this$state3.scrollOffset;
    var itemCount = itemData.length;

    if (itemCount === 0) {
      return [0, 0, 0, 0];
    }

    var scrollOffsetValue = scrollTop >= 0 ? scrollTop : scrollOffset;
    var startIndex = getStartIndexForOffset(this.props, scrollOffsetValue, this._listMetaData);
    var stopIndex = getStopIndexForStartIndex(this.props, startIndex, scrollOffsetValue, this._listMetaData); // Overscan by one item in each direction so that tab/focus works.
    // If there isn't at least one extra item, tab loops back around.

    var overscanBackward = scrollDirection === 'backward' ? overscanCountBackward : Math.max(1, overscanCountForward);
    var overscanForward = scrollDirection === 'forward' ? overscanCountBackward : Math.max(1, overscanCountForward);
    var minValue = Math.max(0, stopIndex - overscanBackward);
    var maxValue = Math.max(0, Math.min(itemCount - 1, startIndex + overscanForward));

    while (!getItemSize(this.props, maxValue, this._listMetaData) && maxValue > 0 && this._listMetaData.totalMeasuredSize > this.props.height) {
      maxValue--;
    }

    if (!this.state.scrolledToInitIndex && this.props.initRangeToRender.length) {
      return this.props.initRangeToRender;
    }

    return [minValue, maxValue, startIndex, stopIndex];
  };

  return DynamicSizeList;
}(PureComponent)
Example #12
Source File: TermsOfServicePage.jsx    From pooltogether-landing-site with MIT License 4 votes vote down vote up
TermsOfServicePage = class _TermsOfServicePage extends PureComponent {

  render () {
    return <>
      <div
        className='pool-container mx-auto flex flex-col text-base h-full z-10 relative mb-20'
      >

        <h2
          className='mb-6'
        >
          Terms of Service
        </h2>

        <p>
          Welcome to PoolTogether.com, a website of PoolTogether LLC (“PoolTogether”, “we”, “our”, or “us”). This page explains the terms by which you may use our website (the “Site”). By accessing or using the Site, you signify that you have read, understood, and agree to be bound by this Terms of Service Agreement (“Agreement”), whether or not you are a registered user of our Site. PoolTogether reserves the right to make unilateral modifications to these terms and will provide notice of these changes as described below. This Agreement applies to all visitors, users, and others who access the Site (“Users”).
        </p>

        <p>
          Please read this Agreement carefully to ensure that you understand each provision. This agreement contains a mandatory individual arbitration and class action/jury trial waiver provision that requires the use of arbitration on an individual basis to resolve disputes, rather than jury trials or class actions.
        </p>

        <h3>PoolTogether Site.</h3>

        <p>
          As part of the Site, PoolTogether provides access to a decentralized money saving and reward tool (“Protocol”) on the Ethereum blockchain, that allows participants to use Ethereum assets (“Assets”) to transact using smart contracts (“Smart Contracts”).
        </p>

        <h3>Use of Our Site.</h3>

        <h4>A. Eligibility</h4>

        <p>
          This is a contract between you and PoolTogether. You must read and agree to these terms before using the Site. If you do not agree, you may not use the Site. You may use the Site only if you can form a binding contract with PoolTogether, and only in compliance with this Agreement and all applicable local, state, national, and international laws, rules and regulations. Any use or access to the Site by anyone under eighteen (18) years of age is strictly prohibited and in violation of this Agreement. The Site is not available to any Users previously removed from the Site by PoolTogether.
        </p>

        <h4>B. Access and Use of the Site and Smart Contracts</h4>
        <p>
          Subject to the terms and conditions of this Agreement, you are hereby granted a non-exclusive, limited, non-transferable, freely revocable license to use the Site as permitted by the features of the Site. PoolTogether reserves all rights not expressly granted herein in the Site and the PoolTogether Content (as defined below). PoolTogether may terminate this license, in whole or in part, at any time for any reason or no reason.
        </p>

        <h4>C. Site Rules</h4>

        <p>
          You agree not to engage in any of the following prohibited activities: (i) copying, distributing, or disclosing any part of the Site in any medium, including without limitation by any automated or non-automated “scraping”; (ii) using any automated system, including without limitation “robots,” “spiders,” “offline readers,” etc., to access the Site in a manner that sends more request messages to the PoolTogether servers than a human can reasonably produce in the same period of time by using a conventional on-line web browser (except that PoolTogether grants the operators of public search engines revocable permission to use spiders to copy publically available materials from PoolTogether.com for the sole purpose of and solely to the extent necessary for creating publicly available searchable indices of the materials, but not caches or archives of such materials); (iii) transmitting spam, chain letters, or other unsolicited email; (iv) attempting to interfere with, compromise the system integrity or security or decipher any transmissions to or from the servers running the Site; (v) taking any action that imposes, or may impose at our sole discretion an unreasonable or disproportionately large load on our infrastructure; (vi) uploading invalid data, viruses, worms, or other software agents through the Site; (vii) collecting or harvesting any personally identifiable information, including account names, from the Site; (viii) using the Site for any commercial solicitation purposes; (ix) impersonating another person or otherwise misrepresenting your affiliation with a person or entity, conducting fraud, hiding or attempting to hide your identity; (x) interfering with the proper working of the Site; (xi) accessing any content on the Site through any technology or means other than those provided or authorized by the Site; or (xii) bypassing the measures we may use to prevent or restrict access to the Site, including without limitation features that prevent or restrict use or copying of any content or enforce limitations on use of the Site or the content therein.
        </p>
        <p>
          We may, without prior notice, change the Site; stop providing the Site or features of the Site, to you or to Users generally; or create usage limits for the Site. We may permanently or temporarily terminate or suspend your access to the Site without notice and liability for any reason, including if in our sole determination you violate any provision of this Agreement, or for no reason. Upon termination for any reason or no reason, you continue to be bound by this Agreement.
        </p>
        <p>
          You are solely responsible for your interactions with other PoolTogether Users and Protocol Users. We reserve the right, but have no obligation, to monitor disputes between you and other Users. PoolTogether shall have no liability for your interactions with other Users, or for any User’s action or inaction.
        </p>
        <h4>D. Site Location</h4>

        <p>
          The Site is controlled and operated from facilities in the United States. PoolTogether makes no representations that the Site is appropriate or available for use any locations. Those who access or use the Site from any jurisdictions do so at their own volition and are entirely responsible for compliance with all applicable United States and local laws and regulations, including but not limited to export and import regulations. You may not use the Site if you are a resident of a country embargoed by the United States, or are a foreign person or entity blocked or denied by the United States government. Unless otherwise explicitly stated, all materials found on the Site are solely directed to individuals, companies, or other entities located in the United States.
        </p>
        <h3>Our Proprietary Rights.</h3>

        <p>
          The Site and all materials therein or transferred thereby, including, without limitation, software, images, text, graphics, illustrations, logos, patents, trademarks, service marks, copyrights, photographs, audio, videos, music, and User Content belonging to other Users (the “PoolTogether Content”), and all Intellectual Property Rights related thereto, are the exclusive property of PoolTogether and its licensors. Except as explicitly provided herein, nothing in this Agreement shall be deemed to create a license in or under any such Intellectual Property Rights, and you agree not to sell, license, rent, modify, distribute, copy, reproduce, transmit, publicly display, publicly perform, publish, adapt, edit or create derivative works from any PoolTogether Content. Use of the PoolTogether Content for any purpose not expressly permitted by this Agreement is strictly prohibited.
        </p>
        <p>
          You may choose to or we may invite you to submit comments or ideas about the Site, including without limitation about how to improve the Site or our products (“Ideas”). By submitting any Idea, you agree that your disclosure is gratuitous, unsolicited and without restriction and will not place PoolTogether under any fiduciary or other obligation, and that we are free to use the Idea without any additional compensation to you, and/or to disclose the Idea on a non-confidential basis or otherwise to anyone. You further acknowledge that, by acceptance of your submission, PoolTogether does not waive any rights to use similar or related ideas previously known to PoolTogether, or developed by its employees, or obtained from sources other than you.
        </p>
        <h3>No Professional Advice.</h3>


        <p>
          If the Site provides professional information (for example, medical, legal, or financial), such information is for informational purposes only and should not be construed as professional advice. No action should be taken based upon any information contained in the Site. You should seek independent professional advice from a person who is licensed and/or qualified in the applicable area.
        </p>
        <h3>Privacy.</h3>


        <p>
          We care about the privacy of our Users. You understand that by using the Sites you consent to the collection, use and disclosure of personally identifiable information and aggregate data, and to have your personally identifiable information collected, used, transferred to and processed in the United States.
        </p>
        <h3>Security.</h3>


        <p>
          PoolTogether uses commercially reasonable physical, managerial, and technical safeguards to preserve the integrity and security of your personal information and implement your privacy settings. However, we cannot guarantee that unauthorized third parties will never be able to defeat our security measures or use your personal information for improper purposes. You acknowledge that you provide your personal information at your own risk.
        </p>
        <h3>Third-Party Links and Information.</h3>


        <p>
          The Site may contain links to third-party materials that are not owned or controlled by PoolTogether. PoolTogether does not endorse or assume any responsibility for any such third-party sites, information, materials, products, or services. If you access a third-party website or service from the Site on or through any third-party website or service, you do so at your own risk, and you understand that this Agreement and PoolTogether Privacy Policy do not apply to your use of such sites. You expressly relieve PoolTogether from any and all liability arising from your use of any third-party website, service, or content. Additionally, your dealings with or participation in promotions of advertisers found on the Site, including payment and delivery of goods, and any other terms (such as warranties) are solely between you and such advertisers. You agree that PoolTogether shall not be responsible for any loss or damage of any sort relating to your dealings with such advertisers.
        </p>
        <h3>Indemnity.</h3>


        <p>
          You agree to defend, indemnify and hold harmless PoolTogether and its subsidiaries, agents, licensors, managers, and other affiliated companies, and their employees, contractors, agents, officers and directors, from and against any and all claims, damages, obligations, losses, liabilities, costs or debt, and expenses (including but not limited to attorney’s fees) arising from: (i) your use of and access to the Site, including any data or content transmitted or received by you; (ii) your violation of any term of this Agreement, including without limitation your breach of any of the representations and warranties above; (iii) your violation of any third-party right, including without limitation any right of privacy or Intellectual Property Rights; (iv) your violation of any applicable law, rule or regulation; (v) any content that you submit to the Site including without limitation misleading, false, or inaccurate information; (vi) your willful misconduct; or (vii) any other party’s access and use of the Site with your unique username, password or other appropriate security code.
        </p>
        <h3>Assumption of Risk; Release of Claims.</h3>


        <p>
          You acknowledge that the Site (including without limitation the Protocol and the Smart Contracts) and your use of the Site contain certain risks, including without limitation the following risks: That any Smart Contracts you interact with are entirely your own responsibility / liability, and PoolTogether is not a party to the Smart Contracts;At any time, your access to your Assets may be suspended or terminated or there may be a delay in your access or use of your Assets which may result in the Assets diminishing in value or you being unable to complete a Smart Contract and the Protocol may be suspended or terminated for any or no reason, which may limit your access to your Assets.
        </p>

        <p>
          Accordingly, you expressly agree that: (A) you assume all risk in connection with your access and use of the Site, the Protocol and the Smart Contracts; and (B) that you expressly waive and release PoolTogether from any and all liability, claims, causes of action, or damages arising from or in any way related to your use of the Site, the Protocol or the Smart Contracts. If you are a California resident, you waive California Civil Code §1542, which says: “A GENERAL RELEASE DOES NOT EXTEND TO CLAIMS WHICH THE CREDITOR DOES NOT KNOW OR SUSPECT TO EXIST IN HIS OR HER FAVOR AT THE TIME OF EXECUTING THE RELEASE, WHICH IF KNOWN BY HIM OR HER MUST HAVE MATERIALLY AFFECTED HIS OR HER SETTLEMENT WITH THE DEBTOR.”
        </p>
        <h3>No Warranty.</h3>


        <p>
          The Site is provided on an “as is” and “as available” basis. Use of the Site is at your own risk. To the maximum extent permitted by applicable law, the Site is provided without warranties of any kind, whether express or implied, including, but not limited to, implied warranties of merchantability, fitness for a particular purpose, or non-infringement. No advice or information, whether oral or written, obtained by you from PoolTogether or through the Site will create any warranty not expressly stated herein. Without limiting the foregoing, PoolTogether, its subsidiaries, its affiliates, and its licensors do not warrant that the content is accurate, reliable or correct; that the Site will meet your requirements; that the Site will be available at any particular time or location, uninterrupted or secure; that any defects or errors will be corrected; or that the Site is free of viruses or other harmful components. Any content downloaded or otherwise obtained through the use of the Site is downloaded at your own risk and you will be solely responsible for any damage to your computer system or mobile device or loss of data that results from such download or your use of the Site.
        </p>

        <p>
          PoolTogether does not warrant, endorse, guarantee, or assume responsibility for any product or site advertised or offered by a third party through the Site or any hyperlinked website or site, and PoolTogether will not be a party to or in any way monitor any transaction between you and third-party providers of products or services.
        </p>
        <h3>Limitation of Liability.</h3>


        <p>
          To the maximum extent permitted by applicable law, in no event shall PoolTogether, its affiliates, agents, directors, employees, suppliers or licensors be liable for any indirect, punitive, incidental, special, consequential or exemplary damages, including without limitation damages for loss of profits, goodwill, use, data or other intangible losses, arising out of or relating to the use of, or inability to use, this Site. Under no circumstances will PoolTogether be responsible for any damage, loss or injury resulting from hacking, tampering or other unauthorized access or use of the Site or the information contained therein.To the maximum extent permitted by applicable law, PoolTogether assumes no liability or responsibility for any (i) errors, mistakes, or inaccuracies of content; (ii) personal injury or property damage, of any nature whatsoever, resulting from your access to or use of our site; (iii) any unauthorized access to or use of our secure servers and/or any and all personal information stored therein; (iv) any interruption or cessation of transmission to or from the Site; (v) any bugs, viruses, trojan horses, or the like that may be transmitted to or through our site by any third party; (vi) any errors or omissions in any content or for any loss or damage incurred as a result of the use of any content posted, emailed, transmitted, or otherwise made available through the Site; and/or (vii) User Content or the defamatory, offensive, or illegal conduct of any third party. In no event shall PoolTogether, its affiliates, agents, directors, employees, suppliers, or licensors be liable to you for any claims, proceedings, liabilities, obligations, damages, losses or costs in an amount exceeding the amount you paid to PoolTogether hereunder or $100.00, whichever is greater.
        </p>

        <p>
          This limitation of liability section applies whether the alleged liability is based on contract, tort, negligence, strict liability, or any other basis, even if PoolTogether has been advised of the possibility of such damage. The foregoing limitation of liability shall apply to the fullest extent permitted by law in the applicable jurisdiction.
        </p>
        <h3>Limitations as Allowed by Law.</h3>


        <p>
          Federal law, some states, provinces and other jurisdictions do not allow the exclusion and limitations of certain implied warranties, or the exclusion or limitation of incidental or consequential damages, so the above limitations or exclusions may not apply to you. This agreement gives you specific legal rights, and you may also have other rights which vary from state to state. The disclaimers, exclusions, and limitations of liability under this agreement will not apply to the extent prohibited by applicable law.
        </p>
        <h3>Governing Law, Arbitration, and Class Action/Jury Trial Waiver.</h3>


        <p>
          Arbitration. Read this section carefully because it requires the parties to arbitrate their disputes and limits the manner in which you can seek relief from PoolTogether. For any dispute with Pooltogether, you agree to first contact us at [email protected] and attempt to resolve the dispute with us informally. In the unlikely event that PoolTogether has not been able to resolve a dispute it has with you after sixty (60) days, we each agree to resolve any claim, dispute, or controversy (excluding any claims for injunctive or other equitable relief as provided below) arising out of or in connection with or relating to this Agreement, or the breach or alleged breach thereof (collectively, “Claims”), by binding arbitration by JAMS, under the Optional Expedited Arbitration Procedures then in effect for JAMS, except as provided herein. JAMS may be contacted at www.jamsadr.com. The arbitration will be conducted in New York, New York, unless you and PoolTogether agree otherwise. If you are using the Site for commercial purposes, each party will be responsible for paying any JAMS filing, administrative and arbitrator fees in accordance with JAMS rules, and the award rendered by the arbitrator shall include costs of arbitration, reasonable attorneys’ fees and reasonable costs for expert and other witnesses. If you are an individual using the Site for non-commercial purposes: (i) JAMS may require you to pay a fee for the initiation of your case, unless you apply for and successfully obtain a fee waiver from JAMS; (ii) the award rendered by the arbitrator may include your costs of arbitration, your reasonable attorney’s fees, and your reasonable costs for expert and other witnesses; and (iii) you may sue in a small claims court of competent jurisdiction without first engaging in arbitration, but this does not absolve you of your commitment to engage in the informal dispute resolution process. Any judgment on the award rendered by the arbitrator may be entered in any court of competent jurisdiction. Nothing in this Section shall be deemed as preventing PoolTogether from seeking injunctive or other equitable relief from the courts as necessary to prevent the actual or threatened infringement, misappropriation, or violation of our data security, Intellectual Property Rights or other proprietary rights.
        </p>

        <p>
          Class Action/Jury Trial Waiver. With respect to all persons and entities, regardless of whether they have obtained or used the site for personal, commercial or other purposes, all Claims must be brought in the parties’ individual capacity, and not as a plaintiff or class member in any purported class action, collective action, private attorney general action or other representative proceeding. This waiver applies to class arbitration, and, unless we agree otherwise, the arbitrator may not consolidate more than one person’s claims. You agree that, by entering into this agreement, you and PoolTogether are each waiving the right to a trial by jury or to participate in a class action, collective action, private attorney general action, or other representative proceeding of any kind.
        </p>
      </div>
    </>
  }

}
Example #13
Source File: ConnectedRouter.js    From the-eye-knows-the-garbage with MIT License 4 votes vote down vote up
createConnectedRouter = function createConnectedRouter(structure) {
  var _createSelectors = createSelectors(structure),
      getLocation = _createSelectors.getLocation;
  /*
   * ConnectedRouter listens to a history object passed from props.
   * When history is changed, it dispatches action to redux store.
   * Then, store will pass props to component to render.
   * This creates uni-directional flow from history->store->router->components.
   */


  var ConnectedRouter =
  /*#__PURE__*/
  function (_PureComponent) {
    _inherits(ConnectedRouter, _PureComponent);

    function ConnectedRouter(props) {
      var _this;

      _classCallCheck(this, ConnectedRouter);

      _this = _possibleConstructorReturn(this, _getPrototypeOf(ConnectedRouter).call(this, props));
      var store = props.store,
          history = props.history,
          onLocationChanged = props.onLocationChanged;
      _this.inTimeTravelling = false; // Subscribe to store changes to check if we are in time travelling

      _this.unsubscribe = store.subscribe(function () {
        // Extract store's location
        var _getLocation = getLocation(store.getState()),
            pathnameInStore = _getLocation.pathname,
            searchInStore = _getLocation.search,
            hashInStore = _getLocation.hash; // Extract history's location


        var _history$location = history.location,
            pathnameInHistory = _history$location.pathname,
            searchInHistory = _history$location.search,
            hashInHistory = _history$location.hash; // If we do time travelling, the location in store is changed but location in history is not changed

        if (pathnameInHistory !== pathnameInStore || searchInHistory !== searchInStore || hashInHistory !== hashInStore) {
          _this.inTimeTravelling = true; // Update history's location to match store's location

          history.push({
            pathname: pathnameInStore,
            search: searchInStore,
            hash: hashInStore
          });
        }
      });

      var handleLocationChange = function handleLocationChange(location, action) {
        var isFirstRendering = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

        // Dispatch onLocationChanged except when we're in time travelling
        if (!_this.inTimeTravelling) {
          onLocationChanged(location, action, isFirstRendering);
        } else {
          _this.inTimeTravelling = false;
        }
      }; // Listen to history changes


      _this.unlisten = history.listen(handleLocationChange); // Dispatch a location change action for the initial location.
      // This makes it backward-compatible with react-router-redux.
      // But, we add `isFirstRendering` to `true` to prevent double-rendering.

      handleLocationChange(history.location, history.action, true);
      return _this;
    }

    _createClass(ConnectedRouter, [{
      key: "componentWillUnmount",
      value: function componentWillUnmount() {
        this.unlisten();
        this.unsubscribe();
      }
    }, {
      key: "render",
      value: function render() {
        var _this$props = this.props,
            history = _this$props.history,
            children = _this$props.children;
        return React.createElement(Router, {
          history: history
        }, children);
      }
    }]);

    return ConnectedRouter;
  }(PureComponent);

  ConnectedRouter.propTypes = {
    store: PropTypes.shape({
      getState: PropTypes.func.isRequired,
      subscribe: PropTypes.func.isRequired
    }).isRequired,
    history: PropTypes.shape({
      action: PropTypes.string.isRequired,
      listen: PropTypes.func.isRequired,
      location: PropTypes.object.isRequired,
      push: PropTypes.func.isRequired
    }).isRequired,
    basename: PropTypes.string,
    children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
    onLocationChanged: PropTypes.func.isRequired
  };

  var mapDispatchToProps = function mapDispatchToProps(dispatch) {
    return {
      onLocationChanged: function onLocationChanged(location, action, isFirstRendering) {
        return dispatch(_onLocationChanged(location, action, isFirstRendering));
      }
    };
  };

  var ConnectedRouterWithContext = function ConnectedRouterWithContext(props) {
    var Context = props.context || ReactReduxContext;

    if (Context == null) {
      throw 'Please upgrade to react-redux v6';
    }

    return React.createElement(Context.Consumer, null, function (_ref) {
      var store = _ref.store;
      return React.createElement(ConnectedRouter, _extends({
        store: store
      }, props));
    });
  };

  ConnectedRouterWithContext.propTypes = {
    context: PropTypes.object
  };
  return connect(null, mapDispatchToProps)(ConnectedRouterWithContext);
}
Example #14
Source File: index.es.js    From the-eye-knows-the-garbage with MIT License 4 votes vote down vote up
function withSideEffect(reducePropsToState, handleStateChangeOnClient, mapStateOnServer) {
  if (typeof reducePropsToState !== 'function') {
    throw new Error('Expected reducePropsToState to be a function.');
  }

  if (typeof handleStateChangeOnClient !== 'function') {
    throw new Error('Expected handleStateChangeOnClient to be a function.');
  }

  if (typeof mapStateOnServer !== 'undefined' && typeof mapStateOnServer !== 'function') {
    throw new Error('Expected mapStateOnServer to either be undefined or a function.');
  }

  function getDisplayName(WrappedComponent) {
    return WrappedComponent.displayName || WrappedComponent.name || 'Component';
  }

  return function wrap(WrappedComponent) {
    if (typeof WrappedComponent !== 'function') {
      throw new Error('Expected WrappedComponent to be a React component.');
    }

    var mountedInstances = [];
    var state;

    function emitChange() {
      state = reducePropsToState(mountedInstances.map(function (instance) {
        return instance.props;
      }));

      if (SideEffect.canUseDOM) {
        handleStateChangeOnClient(state);
      } else if (mapStateOnServer) {
        state = mapStateOnServer(state);
      }
    }

    var SideEffect =
    /*#__PURE__*/
    function (_PureComponent) {
      _inheritsLoose(SideEffect, _PureComponent);

      function SideEffect() {
        return _PureComponent.apply(this, arguments) || this;
      }

      // Try to use displayName of wrapped component
      // Expose canUseDOM so tests can monkeypatch it
      SideEffect.peek = function peek() {
        return state;
      };

      SideEffect.rewind = function rewind() {
        if (SideEffect.canUseDOM) {
          throw new Error('You may only call rewind() on the server. Call peek() to read the current state.');
        }

        var recordedState = state;
        state = undefined;
        mountedInstances = [];
        return recordedState;
      };

      var _proto = SideEffect.prototype;

      _proto.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() {
        mountedInstances.push(this);
        emitChange();
      };

      _proto.componentDidUpdate = function componentDidUpdate() {
        emitChange();
      };

      _proto.componentWillUnmount = function componentWillUnmount() {
        var index = mountedInstances.indexOf(this);
        mountedInstances.splice(index, 1);
        emitChange();
      };

      _proto.render = function render() {
        return React.createElement(WrappedComponent, this.props);
      };

      return SideEffect;
    }(PureComponent);

    _defineProperty(SideEffect, "displayName", "SideEffect(" + getDisplayName(WrappedComponent) + ")");

    _defineProperty(SideEffect, "canUseDOM", canUseDOM);

    return SideEffect;
  };
}