diff --git a/.env.example b/.env.example index a51f9f81..5d6e98ce 100644 --- a/.env.example +++ b/.env.example @@ -7,6 +7,7 @@ SPREE_PUBLISHABLE_KEY=your_publishable_api_key # Set these to your store's default_country_iso and default_locale NEXT_PUBLIC_DEFAULT_COUNTRY=us NEXT_PUBLIC_DEFAULT_LOCALE=en +NEXT_PUBLIC_STORE_NAME=Spree Store # Google Tag Manager (leave empty to disable) GTM_ID= diff --git a/package-lock.json b/package-lock.json index e0f672c2..90b9c20c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,8 @@ "dependencies": { "@next/third-parties": "^16.1.6", "@sentry/nextjs": "^10.38.0", - "@spree/next": "^0.6.7", - "@spree/sdk": "^0.6.7", + "@spree/next": "^0.6.8", + "@spree/sdk": "^0.6.8", "@stripe/react-stripe-js": "^5.6.0", "@stripe/stripe-js": "^8.7.0", "next": "^16", @@ -4728,20 +4728,20 @@ } }, "node_modules/@spree/next": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/@spree/next/-/next-0.6.7.tgz", - "integrity": "sha512-3huii/iDgvt58GMlnK/zgDP8Wd98Elsf4fdLm3DdetMJNeYL9cinGTaJrG59CybN12Chac727i/F7ukqtHwvVA==", + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@spree/next/-/next-0.6.8.tgz", + "integrity": "sha512-u363RFctbXZfX//7q/FZwqgT73czkiAtneyOtEiuURvVjfgaaNLl4XJGZAPDV7qUVWuVc/O69yBYRbYprO2ghg==", "license": "MIT", "peerDependencies": { - "@spree/sdk": ">=0.6.7", + "@spree/sdk": ">=0.6.8", "next": ">=15.0.0", "react": ">=19.0.0" } }, "node_modules/@spree/sdk": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/@spree/sdk/-/sdk-0.6.7.tgz", - "integrity": "sha512-gGrC49omgJLgtoxOYreHvw8eXLmhCtVNl1JFTJz6klMNYJX/ZkUIz7yiOIDHAaFYhsG8eQmKhFqALPYi+v5oWg==", + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@spree/sdk/-/sdk-0.6.8.tgz", + "integrity": "sha512-GDJL4KZBZg6yy7upl0PRX9pBii8hZmezpqTyQB68o/HXmfghwmRCP/uHvPfuKvwxtIRPMSG7bLKhmEUTZYZquQ==", "license": "MIT", "engines": { "node": ">=18.0.0" diff --git a/package.json b/package.json index 46f54ae3..f0bf3ee3 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "dependencies": { "@next/third-parties": "^16.1.6", "@sentry/nextjs": "^10.38.0", - "@spree/next": "^0.6.7", - "@spree/sdk": "^0.6.7", + "@spree/next": "^0.6.8", + "@spree/sdk": "^0.6.8", "@stripe/react-stripe-js": "^5.6.0", "@stripe/stripe-js": "^8.7.0", "next": "^16", diff --git a/src/app/[country]/[locale]/(checkout)/layout.tsx b/src/app/[country]/[locale]/(checkout)/layout.tsx index b7a1ae07..2175d534 100644 --- a/src/app/[country]/[locale]/(checkout)/layout.tsx +++ b/src/app/[country]/[locale]/(checkout)/layout.tsx @@ -9,9 +9,10 @@ import { ShoppingBagIcon, } from "@/components/icons"; import { CheckoutProvider, CheckoutSummary } from "@/contexts/CheckoutContext"; -import { useStore } from "@/contexts/StoreContext"; import { extractBasePath } from "@/lib/utils/path"; +const storeName = process.env.NEXT_PUBLIC_STORE_NAME || "Spree Store"; + function CheckoutHeader() { const pathname = usePathname(); const basePath = extractBasePath(pathname); @@ -33,14 +34,12 @@ function CheckoutHeader() { } function CheckoutFooter() { - const { store } = useStore(); const currentYear = new Date().getFullYear(); return ( ); diff --git a/src/app/[country]/[locale]/(storefront)/account/gift-cards/page.tsx b/src/app/[country]/[locale]/(storefront)/account/gift-cards/page.tsx index 53dd46b4..d2127201 100644 --- a/src/app/[country]/[locale]/(storefront)/account/gift-cards/page.tsx +++ b/src/app/[country]/[locale]/(storefront)/account/gift-cards/page.tsx @@ -1,5 +1,6 @@ "use client"; +import type { StoreGiftCard } from "@spree/sdk"; import { useEffect, useState } from "react"; import { CheckIcon, @@ -9,27 +10,6 @@ import { } from "@/components/icons"; import { getGiftCards } from "@/lib/data/gift-cards"; -// Gift card type (matches SDK StoreGiftCard) -interface GiftCard { - id: string; - code: string; - state: string; - currency: string; - amount: number; - amount_used: number; - amount_authorized: number; - amount_remaining: number; - display_amount: string; - display_amount_used: string; - display_amount_remaining: string; - expires_at: string | null; - redeemed_at: string | null; - expired: boolean; - active: boolean; - created_at: string; - updated_at: string; -} - function getStateColor(state: string, expired: boolean): string { if (expired) return "bg-gray-100 text-gray-800"; switch (state) { @@ -115,9 +95,11 @@ function CopyButton({ code }: { code: string }) { ); } -function GiftCardItem({ card }: { card: GiftCard }) { +function GiftCardItem({ card }: { card: StoreGiftCard }) { const usagePercentage = - card.amount > 0 ? Math.round((card.amount_used / card.amount) * 100) : 0; + Number(card.amount) > 0 + ? Math.round((Number(card.amount_used) / Number(card.amount)) * 100) + : 0; return (