UNPKG

@open-tender/store

Version:

A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API

14 lines (13 loc) 960 B
import React, { useCallback } from 'react'; import { useAppSelector } from '../app/hooks'; import { selectKioskConfig } from '../slices'; import { default as CartItemContainer } from './CartItem'; var CheckoutCart = function (_a) { var cart = _a.cart, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView, CartItemView = _a.CartItemView; var config = useAppSelector(selectKioskConfig).checkoutCart; var renderCartItem = useCallback(function (item, index) { return (React.createElement(CartItemContainer, { QuantityView: QuantityView, navigate: navigate, children: CartItemView, key: "".concat(item.id, "-").concat(index), item: item, isLast: index + 1 === cart.length, isEditable: false, isCheckout: true })); }, [QuantityView, navigate, CartItemView, cart.length]); if (!config) return null; return children({ config: config, cart: cart, renderCartItem: renderCartItem }); }; export default CheckoutCart;