import { Checkbox, FormControlLabel, Grid, Typography } from '@mui/material';
import { Box } from '@mui/system';
import { useRouter } from 'next/router';
import { setCookie } from 'nookies';
import { useState } from 'react';
import {
useCheckoutData,
useCheckoutDataUpdate,
} from '../../store/checkout-context';
import { stripe } from '../../utils/helpers/stripe';
//import DataCardS from '../cards/data-card-shipping/DataCardS';
import DataCard from '../cards/data-card/DataCard';
import StepTitle from '../layout/steps-title/StepTitle';
import ButtonGroup from './shipping-btnGroup/ButtonGroup';
import ShippingData from './shipping-data/ShippingData';
import ShippingModal from './shipping-modal/ShippingModal';
const ShippingContent = () => {
const { checkoutStorage } = useCheckoutData();
const { changeContact, changeShippingData } = useCheckoutDataUpdate();
const [open, setOpen] = useState({ isOpen: false, type: '' });
const router = useRouter();
const handleOpen = (type) => setOpen({ isOpen: true, type });
const handleClose = () => setOpen({ isOpen: false, type: '' });
const handleChangeShipping = (values) => {
changeShippingData(values);
handleClose();
};
const handleChangeContact = (values) => {
changeContact(values);
handleClose();
};
const handleStripePayment = () => {
stripe({
lineItems: [
{
price: 'price_1Lg4MsDY7dvAcw2f1CGQaFFR',
quantity: 1,
},
],
});
setCookie(null, 'review-session', 'active', {
maxAge: 3600,
expires: new Date(Date.now() + 3600),
path: '/',
});
};
const handleBackToCart = () => {
router.replace('/cart');
};
const mapProductsToDom = () => {
return checkoutStorage?.products?.map((entry, i) => (
));
};
return (
The following fields will be used as the shipping details for your
order
}
label="Free Shipping"
sx={{ color: 'black', ml: 2 }}
/>
{mapProductsToDom()}
);
};
export default ShippingContent;