text: import { connect } from 'react-redux';
  import { reduxForm, change } from 'redux-form';
  import DepositFormComponent from './DepositFormComponent';
  import {
    fetchAllProductDepositTemplates,
    createDepositTicket,
    fetchProductDepositTemplate,
  } from '../../redux/actions/depositActions';
  import { openModal, MODAL_TYPES } from '../../redux/actions/modalActions';
  import config from '../../config';
  import { productPositionAssetsSelector } from '../../redux/selectors/productPositionSelectors';
  
  const formName = 'createDeposit';
  
  const mapStateToProps = (state, { product }) => {
    return {
      products: productPositionAssetsSelector(state),
      deposit: state.deposit,
    };
  };
  
  const mapDispatchToProps = (dispatch) => ({
    selectDepositProduct: (productId) =>
      dispatch(fetchAllProductDepositTemplates(productId)),
    selectDepositTemplate: (productId, templateType) =>
      dispatch(fetchProductDepositTemplate(productId, templateType)),
    changeFieldValue: (field, value) => dispatch(change(formName, field, value)),
  });
  
  const DepositFormContainer = connect(
    mapStateToProps,
    mapDispatchToProps
  )(DepositFormComponent);
  
  export default reduxForm({
    form: formName,
    onSubmit: (payload, dispatch, { product: { ProductId, Product } }) => {
      dispatch(createDepositTicket({ ...payload, ProductId }));
      if (config.Deposit.showDepositIdModal) {
        dispatch(
          openModal(MODAL_TYPES.DEPOSIT_REFERENCE_ID, {
            ProductSymbol: Product,
          })
        );
      }
    },
  })(DepositFormContainer);
  