diff --git a/.env b/.env index f279691..d26da95 100644 --- a/.env +++ b/.env @@ -51,4 +51,7 @@ LOGGER=pino NEXT_PUBLIC_DEFAULT_LOCALE=et NEXT_PUBLIC_TEAM_NAVIGATION_STYLE=custom -NEXT_PUBLIC_USER_NAVIGATION_STYLE=custom \ No newline at end of file +NEXT_PUBLIC_USER_NAVIGATION_STYLE=custom + +# MEDUSA +NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY= \ No newline at end of file diff --git a/.env.example b/.env.example index 2a3d662..1b78f4e 100644 --- a/.env.example +++ b/.env.example @@ -16,4 +16,6 @@ EMAIL_USER= # refer to your email provider's documentation EMAIL_PASSWORD= # refer to your email provider's documentation EMAIL_HOST= # refer to your email provider's documentation EMAIL_PORT= # or 465 for SSL -EMAIL_TLS= # or false for SSL (see provider documentation) \ No newline at end of file +EMAIL_TLS= # or false for SSL (see provider documentation) + +NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY= \ No newline at end of file diff --git a/README.md b/README.md index dde3485..21d54ba 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ pnpm clean pnpm i ``` +if you get missing dependency error do `pnpm i --force` + ## Adding new dependency ```bash @@ -70,3 +72,9 @@ To update database types run: ```bash npm run supabase:typegen:app ``` + +## Medusa store + +To get medusa store working you need to update the env's to your running medusa app and migrate the tables from medusa project to your supabase project + +You can get `NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY` from your medusa app settings diff --git a/app/store/[countryCode]/(checkout)/checkout/page.tsx b/app/store/[countryCode]/(checkout)/checkout/page.tsx new file mode 100644 index 0000000..6244a1d --- /dev/null +++ b/app/store/[countryCode]/(checkout)/checkout/page.tsx @@ -0,0 +1,30 @@ +import { retrieveCart } from "@lib/data/cart" +import { retrieveCustomer } from "@lib/data/customer" +import PaymentWrapper from "@modules/checkout/components/payment-wrapper" +import CheckoutForm from "@modules/checkout/templates/checkout-form" +import CheckoutSummary from "@modules/checkout/templates/checkout-summary" +import { Metadata } from "next" +import { notFound } from "next/navigation" + +export const metadata: Metadata = { + title: "Checkout", +} + +export default async function Checkout() { + const cart = await retrieveCart() + + if (!cart) { + return notFound() + } + + const customer = await retrieveCustomer() + + return ( +
+ The page you tried to access does not exist. +
++ View and update your shipping addresses, you can add as many as you + like. Saving your addresses will make them available during checkout. +
++ View your previous orders and their status. You can also create + returns or exchanges for your orders if needed. +
++ View and update your profile information, including your name, email, + and phone number. You can also update your billing address, or change + your password. +
++ The cart you tried to access does not exist. Clear your cookies and try + again. +
++ The page you tried to access does not exist. +
++ The page you tried to access does not exist. +
+ +
+
+
+
+Combine Medusa's modules for your commerce backend with the newest Next.js 15 features for a performant storefront.
+ + + +### Prerequisites + +To use the [Next.js Starter Template](https://medusajs.com/nextjs-commerce/), you should have a Medusa server running locally on port 9000. +For a quick setup, run: + +```shell +npx create-medusa-app@latest +``` + +Check out [create-medusa-app docs](https://docs.medusajs.com/learn/installation) for more details and troubleshooting. + +# Overview + +The Medusa Next.js Starter is built with: + +- [Next.js](https://nextjs.org/) +- [Tailwind CSS](https://tailwindcss.com/) +- [Typescript](https://www.typescriptlang.org/) +- [Medusa](https://medusajs.com/) + +Features include: + +- Full ecommerce support: + - Product Detail Page + - Product Overview Page + - Product Collections + - Cart + - Checkout with Stripe + - User Accounts + - Order Details +- Full Next.js 15 support: + - App Router + - Next fetching/caching + - Server Components + - Server Actions + - Streaming + - Static Pre-Rendering + +# Quickstart + +### Setting up the environment variables + +Navigate into your projects directory and get your environment variables ready: + +```shell +cd nextjs-starter-medusa/ +mv .env.template .env.local +``` + +### Install dependencies + +Use Yarn to install all dependencies. + +```shell +yarn +``` + +### Start developing + +You are now ready to start up your project. + +```shell +yarn dev +``` + +### Open the code and start customizing + +Your site is now running at http://localhost:8000! + +# Payment integrations + +By default this starter supports the following payment integrations + +- [Stripe](https://stripe.com/) + +To enable the integrations you need to add the following to your `.env.local` file: + +```shell +NEXT_PUBLIC_STRIPE_KEY=+ Sign in to access an enhanced shopping experience. +
+ + + Not a member?{" "} + + . + ++ You don't have any orders yet, let us change that {":)"} +
++ Create your Medusa Store Member profile, and get access to an enhanced + shopping experience. +
+ + + Already a member?{" "} + + . + +{category.description}
++ {`Hi ${customer.first_name}, do you want to use one of your saved addresses?`} +
++ {style === "default" && ( + Original: + )} + + {convertToLocale({ + amount: originalPrice, + currency_code: currencyCode, + })} + +
+ {style === "default" && ( + + -{getPercentageDiff(originalPrice, currentPrice || 0)}% + + )} + > + )} + + {convertToLocale({ + amount: currentPrice, + currency_code: currencyCode, + })} + ++ {style === "default" && ( + Original: + )} + + {convertToLocale({ + amount: original_total / item.quantity, + currency_code: currencyCode, + })} + +
+ {style === "default" && ( + -{percentage_diff}% + )} + > + )} + + {convertToLocale({ + amount: total / item.quantity, + currency_code: currencyCode, + })} + ++ + {selectedPrice.original_price} + +
+ )} + + {selectedPrice.calculated_price} + ++ Original: + + {selectedPrice.original_price} + +
+ + -{selectedPrice.percentage_diff}% + + > + )} +{product.material ? product.material : "-"}
+{product.origin_country ? product.origin_country : "-"}
+{product.type ? product.type.value : "-"}
+{product.weight ? `${product.weight} g` : "-"}
++ {product.length && product.width && product.height + ? `${product.length}L x ${product.width}W x ${product.height}H` + : "-"} +
++ Your package will arrive in 3-5 business days at your pick up + location or in the comfort of your home. +
++ Is the fit not quite right? No worries - we'll exchange your + product for a new one. +
++ Just return your product and we'll refund your money. No + questions asked – we'll do our best to make sure your return + is hassle-free. +
++ You might also want to check out these products. +
+