UNPKG

@shopgate/engage

Version:
42 lines (41 loc) 1.23 kB
import React from 'react'; import PropTypes from 'prop-types'; 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} */ import { jsx as _jsx } from "react/jsx-runtime"; const OrderHistoryLoader = ({ wrapper, iterator }) => { const { orders, totalOrderCount, fetchOrderHistory } = useOrderHistory(); return /*#__PURE__*/_jsx(ViewContext.Consumer, { children: ({ getContentRef }) => /*#__PURE__*/_jsx(InfiniteContainer, { containerRef: getContentRef(), wrapper: wrapper, iterator: iterator, loader: offset => fetchOrderHistory({ limit: ITEMS_PER_LOAD, offset }), items: orders, loadingIndicator: /*#__PURE__*/_jsx(LoadingIndicator, {}), totalItems: totalOrderCount, initialLimit: ITEMS_PER_LOAD, limit: ITEMS_PER_LOAD }) }); }; export default OrderHistoryLoader;