diff --git a/components/cart/CartSidebarView/CartSidebarView.tsx b/components/cart/CartSidebarView/CartSidebarView.tsx
index fe5c8721b..ef6e6a69b 100644
--- a/components/cart/CartSidebarView/CartSidebarView.tsx
+++ b/components/cart/CartSidebarView/CartSidebarView.tsx
@@ -26,13 +26,106 @@ const CartSidebarView: FC = () => {
// currencyCode: data.currency.code,
// }
// )
- // const handleClose = () => closeSidebar()
+ const handleClose = () => closeSidebar()
// const goToCheckout = () => setSidebarView('CHECKOUT_VIEW')
// const error = null
// const success = null
- return
+ return (
+
+ {/* {isLoading || isEmpty ? (
+
+
+
+
+
+ Your cart is empty
+
+
+ Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.
+
+
+ ) : error ? (
+
+
+
+
+
+ We couldn’t process the purchase. Please check your card information
+ and try again.
+
+
+ ) : success ? (
+
+
+
+
+
+ Thank you for your order.
+
+
+ ) : (
+ <>
+
+
+
+
+ My Cart
+
+
+
+
+ {data!.lineItems.map((item: any) => (
+
+ ))}
+
+
+
+
+
+ -
+ Subtotal
+ {subTotal}
+
+ -
+ Taxes
+ Calculated at checkout
+
+ -
+ Shipping
+ FREE
+
+
+
+ Total
+ {total}
+
+
+ {process.env.COMMERCE_CUSTOMCHECKOUT_ENABLED ? (
+
+ ) : (
+
+ )}
+
+
+ >
+ )} */}
+
+ )
}
export default CartSidebarView
diff --git a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx
index a13aed92e..4aa607a53 100644
--- a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx
+++ b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx
@@ -1,30 +1,39 @@
-import cn from 'classnames'
import Link from 'next/link'
import { FC } from 'react'
import CartItem from '@components/cart/CartItem'
import { Button, Text } from '@components/ui'
import { useUI } from '@components/ui/context'
+import SidebarLayout from '@components/common/SidebarLayout'
// import useCart from '@framework/cart/use-cart'
// import usePrice from '@framework/product/use-price'
+// import useCheckout from '@framework/checkout/use-checkout'
import ShippingWidget from '../ShippingWidget'
import PaymentWidget from '../PaymentWidget'
-import SidebarLayout from '@components/common/SidebarLayout'
import s from './CheckoutSidebarView.module.css'
const CheckoutSidebarView: FC = () => {
- const { setSidebarView } = useUI()
- // const { data } = useCart()
+ const { setSidebarView, closeSidebar } = useUI()
+ // const { data: cartData } = useCart()
+ // const { data: checkoutData, submit: onCheckout } = useCheckout()
+
+ // async function handleSubmit(event: React.ChangeEvent
) {
+ // event.preventDefault()
+
+ // await onCheckout()
+
+ // closeSidebar()
+ // }
// const { price: subTotal } = usePrice(
- // data && {
- // amount: Number(data.subtotalPrice),
- // currencyCode: data.currency.code,
+ // cartData && {
+ // amount: Number(cartData.subtotalPrice),
+ // currencyCode: cartData.currency.code,
// }
// )
// const { price: total } = usePrice(
- // data && {
- // amount: Number(data.totalPrice),
- // currencyCode: data.currency.code,
+ // cartData && {
+ // amount: Number(cartData.totalPrice),
+ // currencyCode: cartData.currency.code,
// }
// )
@@ -35,25 +44,36 @@ const CheckoutSidebarView: FC = () => {
>
-
Checkout
+
+ Checkout
+
-
setSidebarView('PAYMENT_VIEW')} />
- setSidebarView('SHIPPING_VIEW')} />
+ {/* setSidebarView('PAYMENT_VIEW')}
+ />
+ setSidebarView('SHIPPING_VIEW')}
+ /> */}
- {/* {data!.lineItems.map((item: any) => (
+ {/* {cartData!.lineItems.map((item: any) => (
))} */}
-
{/* Once data is correcly filled */}
- {/* */}
-
-
+
)
}
diff --git a/components/checkout/PaymentMethodView/PaymentMethodView.tsx b/components/checkout/PaymentMethodView/PaymentMethodView.tsx
index a5f6f4b51..972073756 100644
--- a/components/checkout/PaymentMethodView/PaymentMethodView.tsx
+++ b/components/checkout/PaymentMethodView/PaymentMethodView.tsx
@@ -1,83 +1,129 @@
import { FC } from 'react'
import cn from 'classnames'
+
+import useAddCard from '@framework/customer/card/use-add-item'
import { Button, Text } from '@components/ui'
import { useUI } from '@components/ui/context'
-import s from './PaymentMethodView.module.css'
import SidebarLayout from '@components/common/SidebarLayout'
+import s from './PaymentMethodView.module.css'
+
+interface Form extends HTMLFormElement {
+ cardHolder: HTMLInputElement
+ cardNumber: HTMLInputElement
+ cardExpireDate: HTMLInputElement
+ cardCvc: HTMLInputElement
+ firstName: HTMLInputElement
+ lastName: HTMLInputElement
+ company: HTMLInputElement
+ streetNumber: HTMLInputElement
+ zipCode: HTMLInputElement
+ city: HTMLInputElement
+ country: HTMLSelectElement
+}
+
const PaymentMethodView: FC = () => {
const { setSidebarView } = useUI()
+ const addCard = useAddCard()
+
+ async function handleSubmit(event: React.ChangeEvent