diff --git a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx index 3be28ddf7..13a523288 100644 --- a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx +++ b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx @@ -3,25 +3,25 @@ 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 ShippingWidget from '../ShippingWidget' 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, closeSidebar } = useUI() const { data: cartData } = useCart() - const { data: checkoutData, submit: onCheckout } = useCheckout(); + const { data: checkoutData, submit: onCheckout } = useCheckout() async function handleSubmit(event: React.ChangeEvent) { - event.preventDefault(); + event.preventDefault() - await onCheckout(); + await onCheckout() - closeSidebar(); + closeSidebar() } const { price: subTotal } = usePrice( @@ -47,8 +47,14 @@ const CheckoutSidebarView: FC = () => { Checkout - setSidebarView('PAYMENT_VIEW')} /> - setSidebarView('SHIPPING_VIEW')} /> + setSidebarView('PAYMENT_VIEW')} + /> + setSidebarView('SHIPPING_VIEW')} + />
    {cartData!.lineItems.map((item: any) => ( @@ -62,7 +68,10 @@ const CheckoutSidebarView: FC = () => {
-
+
  • Subtotal @@ -83,7 +92,11 @@ const CheckoutSidebarView: FC = () => {
    {/* Once data is correcly filled */} -
    diff --git a/components/checkout/PaymentMethodView/PaymentMethodView.tsx b/components/checkout/PaymentMethodView/PaymentMethodView.tsx index dfa452e58..972073756 100644 --- a/components/checkout/PaymentMethodView/PaymentMethodView.tsx +++ b/components/checkout/PaymentMethodView/PaymentMethodView.tsx @@ -27,7 +27,7 @@ const PaymentMethodView: FC = () => { const addCard = useAddCard() async function handleSubmit(event: React.ChangeEvent) { - event.preventDefault(); + event.preventDefault() await addCard({ cardHolder: event.target.cardHolder.value, @@ -40,8 +40,8 @@ const PaymentMethodView: FC = () => { streetNumber: event.target.streetNumber.value, zipCode: event.target.zipCode.value, city: event.target.city.value, - country: event.target.country.value - }); + country: event.target.country.value, + }) setSidebarView('CHECKOUT_VIEW') } @@ -63,7 +63,11 @@ const PaymentMethodView: FC = () => {
    - +
    @@ -90,7 +94,9 @@ const PaymentMethodView: FC = () => {
    - +
    diff --git a/components/checkout/PaymentWidget/PaymentWidget.tsx b/components/checkout/PaymentWidget/PaymentWidget.tsx index 09afe4158..9b496bb44 100644 --- a/components/checkout/PaymentWidget/PaymentWidget.tsx +++ b/components/checkout/PaymentWidget/PaymentWidget.tsx @@ -3,8 +3,8 @@ import s from './PaymentWidget.module.css' import { ChevronRight, CreditCard, Check } from '@components/icons' interface ComponentProps { - onClick?: () => any; - isValid?: boolean; + onClick?: () => any + isValid?: boolean } const PaymentWidget: FC = ({ onClick, isValid }) => { @@ -20,9 +20,7 @@ const PaymentWidget: FC = ({ onClick, isValid }) => { {/* VISA #### #### #### 2345 */}
    -
    - {isValid ? : } -
    +
    {isValid ? : }
    ) } diff --git a/components/checkout/ShippingView/ShippingView.tsx b/components/checkout/ShippingView/ShippingView.tsx index 696172b61..ed82bc8a2 100644 --- a/components/checkout/ShippingView/ShippingView.tsx +++ b/components/checkout/ShippingView/ShippingView.tsx @@ -27,7 +27,7 @@ const PaymentMethodView: FC = () => { const addAddress = useAddAddress() async function handleSubmit(event: React.ChangeEvent) { - event.preventDefault(); + event.preventDefault() await addAddress({ type: event.target.type.value, @@ -38,8 +38,8 @@ const PaymentMethodView: FC = () => { apartments: event.target.streetNumber.value, zipCode: event.target.zipCode.value, city: event.target.city.value, - country: event.target.country.value - }); + country: event.target.country.value, + }) setSidebarView('CHECKOUT_VIEW') } @@ -82,7 +82,9 @@ const PaymentMethodView: FC = () => {
    - +
    diff --git a/components/checkout/ShippingWidget/ShippingWidget.tsx b/components/checkout/ShippingWidget/ShippingWidget.tsx index b7684a1b1..557a69a8b 100644 --- a/components/checkout/ShippingWidget/ShippingWidget.tsx +++ b/components/checkout/ShippingWidget/ShippingWidget.tsx @@ -5,7 +5,7 @@ import cn from 'classnames' interface ComponentProps { onClick?: () => any - isValid?: boolean; + isValid?: boolean } const ShippingWidget: FC = ({ onClick, isValid }) => { @@ -24,9 +24,7 @@ const ShippingWidget: FC = ({ onClick, isValid }) => { San Franssisco, California */}
    -
    - {isValid ? : } -
    +
    {isValid ? : }
    ) } diff --git a/framework/bigcommerce/checkout/use-checkout.tsx b/framework/bigcommerce/checkout/use-checkout.tsx index bbfb3c28f..942f85b83 100644 --- a/framework/bigcommerce/checkout/use-checkout.tsx +++ b/framework/bigcommerce/checkout/use-checkout.tsx @@ -8,5 +8,7 @@ export const handler: SWRHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ useData }) => async (input) => ({}) + useHook: + ({ useData }) => + async (input) => ({}), } diff --git a/framework/bigcommerce/customer/address/use-add-item.tsx b/framework/bigcommerce/customer/address/use-add-item.tsx index 152d64567..ac9dcd5cf 100644 --- a/framework/bigcommerce/customer/address/use-add-item.tsx +++ b/framework/bigcommerce/customer/address/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/bigcommerce/customer/card/use-add-item.tsx b/framework/bigcommerce/customer/card/use-add-item.tsx index d84e279fa..7e3afa9c5 100644 --- a/framework/bigcommerce/customer/card/use-add-item.tsx +++ b/framework/bigcommerce/customer/card/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/commerce/checkout/use-submit-checkout.tsx b/framework/commerce/checkout/use-submit-checkout.tsx index da609b906..a5d865002 100644 --- a/framework/commerce/checkout/use-submit-checkout.tsx +++ b/framework/commerce/checkout/use-submit-checkout.tsx @@ -6,7 +6,9 @@ import { useHook, useMutationHook } from '../utils/use-hook' import { mutationFetcher } from '../utils/default-fetcher' export type UseSubmitCheckout< - H extends MutationHook> = MutationHook + H extends MutationHook< + SubmitCheckoutHook + > = MutationHook > = ReturnType export const fetcher: HookFetcherFn = mutationFetcher diff --git a/framework/local/checkout/use-checkout.tsx b/framework/local/checkout/use-checkout.tsx index bbfb3c28f..942f85b83 100644 --- a/framework/local/checkout/use-checkout.tsx +++ b/framework/local/checkout/use-checkout.tsx @@ -8,5 +8,7 @@ export const handler: SWRHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ useData }) => async (input) => ({}) + useHook: + ({ useData }) => + async (input) => ({}), } diff --git a/framework/local/customer/address/use-add-item.tsx b/framework/local/customer/address/use-add-item.tsx index 152d64567..ac9dcd5cf 100644 --- a/framework/local/customer/address/use-add-item.tsx +++ b/framework/local/customer/address/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/local/customer/card/use-add-item.tsx b/framework/local/customer/card/use-add-item.tsx index d84e279fa..7e3afa9c5 100644 --- a/framework/local/customer/card/use-add-item.tsx +++ b/framework/local/customer/card/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/saleor/api/endpoints/checkout/index.ts b/framework/saleor/api/endpoints/checkout/index.ts index 018665548..385283ea7 100644 --- a/framework/saleor/api/endpoints/checkout/index.ts +++ b/framework/saleor/api/endpoints/checkout/index.ts @@ -6,11 +6,7 @@ export type CheckoutAPI = GetAPISchema export type CheckoutEndpoint = CheckoutAPI['endpoint'] -const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ - req, - res, - config, -}) => { +const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ req, res, config }) => { try { const html = ` diff --git a/framework/saleor/checkout/use-checkout.tsx b/framework/saleor/checkout/use-checkout.tsx index bbfb3c28f..942f85b83 100644 --- a/framework/saleor/checkout/use-checkout.tsx +++ b/framework/saleor/checkout/use-checkout.tsx @@ -8,5 +8,7 @@ export const handler: SWRHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ useData }) => async (input) => ({}) + useHook: + ({ useData }) => + async (input) => ({}), } diff --git a/framework/saleor/customer/address/use-add-item.tsx b/framework/saleor/customer/address/use-add-item.tsx index 152d64567..ac9dcd5cf 100644 --- a/framework/saleor/customer/address/use-add-item.tsx +++ b/framework/saleor/customer/address/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/saleor/customer/card/use-add-item.tsx b/framework/saleor/customer/card/use-add-item.tsx index d84e279fa..7e3afa9c5 100644 --- a/framework/saleor/customer/card/use-add-item.tsx +++ b/framework/saleor/customer/card/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/shopify/checkout/use-checkout.tsx b/framework/shopify/checkout/use-checkout.tsx index bbfb3c28f..942f85b83 100644 --- a/framework/shopify/checkout/use-checkout.tsx +++ b/framework/shopify/checkout/use-checkout.tsx @@ -8,5 +8,7 @@ export const handler: SWRHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ useData }) => async (input) => ({}) + useHook: + ({ useData }) => + async (input) => ({}), } diff --git a/framework/shopify/customer/address/use-add-item.tsx b/framework/shopify/customer/address/use-add-item.tsx index 152d64567..ac9dcd5cf 100644 --- a/framework/shopify/customer/address/use-add-item.tsx +++ b/framework/shopify/customer/address/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/shopify/customer/card/use-add-item.tsx b/framework/shopify/customer/card/use-add-item.tsx index d84e279fa..7e3afa9c5 100644 --- a/framework/shopify/customer/card/use-add-item.tsx +++ b/framework/shopify/customer/card/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/swell/checkout/use-checkout.tsx b/framework/swell/checkout/use-checkout.tsx index bbfb3c28f..942f85b83 100644 --- a/framework/swell/checkout/use-checkout.tsx +++ b/framework/swell/checkout/use-checkout.tsx @@ -8,5 +8,7 @@ export const handler: SWRHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ useData }) => async (input) => ({}) + useHook: + ({ useData }) => + async (input) => ({}), } diff --git a/framework/swell/customer/address/use-add-item.tsx b/framework/swell/customer/address/use-add-item.tsx index 152d64567..ac9dcd5cf 100644 --- a/framework/swell/customer/address/use-add-item.tsx +++ b/framework/swell/customer/address/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/swell/customer/card/use-add-item.tsx b/framework/swell/customer/card/use-add-item.tsx index d84e279fa..7e3afa9c5 100644 --- a/framework/swell/customer/card/use-add-item.tsx +++ b/framework/swell/customer/card/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/vendure/checkout/use-checkout.tsx b/framework/vendure/checkout/use-checkout.tsx index bbfb3c28f..942f85b83 100644 --- a/framework/vendure/checkout/use-checkout.tsx +++ b/framework/vendure/checkout/use-checkout.tsx @@ -8,5 +8,7 @@ export const handler: SWRHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ useData }) => async (input) => ({}) + useHook: + ({ useData }) => + async (input) => ({}), } diff --git a/framework/vendure/customer/address/use-add-item.tsx b/framework/vendure/customer/address/use-add-item.tsx index 152d64567..ac9dcd5cf 100644 --- a/framework/vendure/customer/address/use-add-item.tsx +++ b/framework/vendure/customer/address/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), } diff --git a/framework/vendure/customer/card/use-add-item.tsx b/framework/vendure/customer/card/use-add-item.tsx index d84e279fa..7e3afa9c5 100644 --- a/framework/vendure/customer/card/use-add-item.tsx +++ b/framework/vendure/customer/card/use-add-item.tsx @@ -8,5 +8,8 @@ export const handler: MutationHook = { query: '', }, async fetcher({ input, options, fetch }) {}, - useHook: ({ fetch }) => () => async () => ({}) + useHook: + ({ fetch }) => + () => + async () => ({}), }