From 256137c7b9a189a0dc806c8bff8666015f0f6c6c Mon Sep 17 00:00:00 2001 From: Riqwan Thamir Date: Thu, 21 Nov 2024 21:32:58 +0100 Subject: [PATCH 1/2] feat(backend,storefront): add transfer cart on register and login --- package.json | 2 +- src/app/[countryCode]/(main)/layout.tsx | 11 +- src/lib/data/cart.ts | 6 +- src/lib/data/customer.ts | 32 +- .../components/cart-mismatch-banner/index.tsx | 57 + yarn.lock | 13744 ++++++++++------ 6 files changed, 8423 insertions(+), 5429 deletions(-) create mode 100644 src/modules/layout/components/cart-mismatch-banner/index.tsx diff --git a/package.json b/package.json index 61d31ecfc..e2d0b506d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dependencies": { "@headlessui/react": "^1.6.1", "@hookform/error-message": "^2.0.0", - "@medusajs/js-sdk": "2.0.0", + "@medusajs/js-sdk": "2.0.5-preview-20241120121037", "@medusajs/ui": "2.0.0", "@meilisearch/instant-meilisearch": "^0.7.1", "@paypal/paypal-js": "^5.0.6", diff --git a/src/app/[countryCode]/(main)/layout.tsx b/src/app/[countryCode]/(main)/layout.tsx index ec979d494..dfc94702d 100644 --- a/src/app/[countryCode]/(main)/layout.tsx +++ b/src/app/[countryCode]/(main)/layout.tsx @@ -1,17 +1,26 @@ import { Metadata } from "next" +import { retrieveCart } from "@lib/data/cart" +import { getCustomer } from "@lib/data/customer" +import { getBaseURL } from "@lib/util/env" +import CartMismatchBanner from "@modules/layout/components/cart-mismatch-banner" import Footer from "@modules/layout/templates/footer" import Nav from "@modules/layout/templates/nav" -import { getBaseURL } from "@lib/util/env" export const metadata: Metadata = { metadataBase: new URL(getBaseURL()), } export default async function PageLayout(props: { children: React.ReactNode }) { + const customer = await getCustomer() + const cart = await retrieveCart() + return ( <>