@shopgate/engage
Version:
Shopgate's ENGAGE library.
4 lines • 1.26 kB
JavaScript
import React from'react';import PropTypes from'prop-types';import{hot}from'react-hot-loader/root';import{ITEMS_PER_LOAD}from'@shopgate/pwa-common/constants/DisplayOptions';import InfiniteContainer from'@shopgate/pwa-common/components/InfiniteContainer';import LoadingIndicator from'@shopgate/pwa-ui-shared/LoadingIndicator';import{ViewContext}from'@shopgate/engage/components/View';import{useOrderHistory}from"../../hooks";/**
* The OrderDetails components
* @returns {JSX}
*/var OrderHistoryLoader=function OrderHistoryLoader(_ref){var wrapper=_ref.wrapper,iterator=_ref.iterator;var _useOrderHistory=useOrderHistory(),orders=_useOrderHistory.orders,totalOrderCount=_useOrderHistory.totalOrderCount,fetchOrderHistory=_useOrderHistory.fetchOrderHistory;return React.createElement(ViewContext.Consumer,null,function(_ref2){var getContentRef=_ref2.getContentRef;return React.createElement(InfiniteContainer,{containerRef:getContentRef(),wrapper:wrapper,iterator:iterator,loader:function loader(offset){return fetchOrderHistory({limit:ITEMS_PER_LOAD,offset:offset});},items:orders,loadingIndicator:React.createElement(LoadingIndicator,null),totalItems:totalOrderCount,initialLimit:ITEMS_PER_LOAD,limit:ITEMS_PER_LOAD});});};export default hot(OrderHistoryLoader);