import * as React from 'react'; import { useTheme } from 'styled-components/native'; import Box from '@wcpos/components/src/box'; import ErrorBoundary from '@wcpos/components/src/error-boundary'; import Customer from './customer'; import { useT } from '../../../../contexts/translations'; import { AddNewCustomer } from '../../components/customer/add-new'; import CustomerSelect from '../../components/customer-select'; import UISettings from '../../components/ui-settings'; import { useUISettings } from '../../contexts/ui-settings'; import { useAddCustomer } from '../hooks/use-add-customer'; /** * */ const CartHeader = () => { const { uiSettings } = useUISettings('pos-cart'); const theme = useTheme(); const { addCustomer } = useAddCustomer(); const [showCustomerSelect, setShowCustomerSelect] = React.useState(false); const t = useT(); /** * */ const handleSelectCustomer = React.useCallback( (customer) => { if (customer) { addCustomer(customer); } setShowCustomerSelect(false); }, [addCustomer] ); /** * */ return ( {showCustomerSelect ? ( ) : ( )} addCustomer(customer)} /> ); }; export default CartHeader;