first commit

This commit is contained in:
Nermin Karic
2026-11-22 21:49:17 +01:00
commit f5e2fcbf98
693 changed files with 82975 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{
"semi": false
}

View File

@@ -0,0 +1,9 @@
<!-- BEGIN:nextjs-agent-rules -->
# This is NOT the Next.js you know
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
<!-- END:nextjs-agent-rules -->

View File

@@ -0,0 +1 @@
@AGENTS.md

View File

@@ -0,0 +1,40 @@
const c = require("ansi-colors");
const requiredEnvs = [
{
key: "NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY",
// TODO: we need a good doc to point this to
description:
"Learn how to create a publishable key: https://docs.medusajs.com/v2/resources/storefront-development/publishable-api-keys",
},
];
function checkEnvVariables() {
const missingEnvs = requiredEnvs.filter(function (env) {
c;
return !process.env[env.key];
});
if (missingEnvs.length > 0) {
console.error(
c.red.bold("\n🚫 Error: Missing required environment variables\n")
);
missingEnvs.forEach(function (env) {
console.error(c.yellow(` ${c.bold(env.key)}`));
if (env.description) {
console.error(c.dim(` ${env.description}\n`));
}
});
console.error(
c.yellow(
"\nPlease set these variables in your .env file or environment before starting the application.\n"
)
);
process.exit(1);
}
}
module.exports = checkEnvVariables;

View File

@@ -0,0 +1,25 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "radix-nova",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/styles/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"iconLibrary": "lucide",
"rtl": false,
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"menuColor": "default",
"menuAccent": "subtle",
"registries": {}
}

View File

@@ -0,0 +1,31 @@
import { defineConfig, globalIgnores } from "eslint/config"
import nextVitals from "eslint-config-next/core-web-vitals"
import nextTs from "eslint-config-next/typescript"
export default defineConfig([
...nextVitals,
...nextTs,
{
rules: {
"react-hooks/set-state-in-effect": "warn",
"react-hooks/refs": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
},
},
globalIgnores([
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
"*.config.js",
"check-env-variables.js",
"next-sitemap.js",
]),
])

7
apps/suman-bosna/next-env.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/dev/types/root-params.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -0,0 +1,91 @@
const checkEnvVariables = require("./check-env-variables")
checkEnvVariables()
/**
* Medusa Cloud-related environment variables
*/
const S3_HOSTNAME = process.env.MEDUSA_CLOUD_S3_HOSTNAME
const S3_PATHNAME = process.env.MEDUSA_CLOUD_S3_PATHNAME
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode: true,
async headers() {
return [
{
source: "/:path*",
headers: [{ key: "Link", value: '</.well-known/ucp>; rel="ucp"' }],
},
{
source: "/:countryCode/products/:handle",
headers: [{ key: "Vary", value: "Accept" }],
},
]
},
async rewrites() {
return {
beforeFiles: [
{
source: "/:countryCode/products/:handle([^/.]+).md",
destination: "/:countryCode/products/:handle/markdown",
},
{
source: "/:countryCode/products/:handle([^/.]+)",
has: [{ type: "header", key: "accept", value: ".*text/markdown.*" }],
destination: "/:countryCode/products/:handle/markdown",
},
],
}
},
logging: {
fetches: {
fullUrl: true,
},
},
typescript: {
ignoreBuildErrors: true,
},
images: {
unoptimized: true,
remotePatterns: [
{
protocol: "http",
hostname: "localhost",
},
{
protocol: "https",
hostname: "placehold.co",
},
{
protocol: "https",
hostname: "suman.ba",
},
{
protocol: "https",
hostname: "images.unsplash.com",
},
{
protocol: "https",
hostname: "*.s3.*.amazonaws.com",
},
{
protocol: "https",
hostname: "*.s3.amazonaws.com",
},
...(S3_HOSTNAME && S3_PATHNAME
? [
{
protocol: "https",
hostname: S3_HOSTNAME,
pathname: S3_PATHNAME,
},
]
: []),
],
},
}
module.exports = nextConfig

View File

@@ -0,0 +1,72 @@
{
"name": "@dtc/suman-bosna",
"version": "1.0.3",
"private": true,
"author": "Kasper Fabricius Kristensen <kasper@medusajs.com> & Victor Gerbrands <victor@medusajs.com> (https://www.medusajs.com)",
"description": "Next.js Starter to be used with Medusa V2",
"keywords": [
"medusa-storefront"
],
"scripts": {
"dev": "next dev -p 8000",
"build": "next build",
"start": "next start -p 8000",
"lint": "eslint .",
"analyze": "ANALYZE=true next build"
},
"dependencies": {
"@adyen/adyen-web": "^6.46.0",
"@headlessui/react": "^2.2.0",
"@medusajs/icons": "2.22.3",
"@medusajs/instantsearch-adapter": "2.22.3",
"@medusajs/js-sdk": "2.22.3",
"@medusajs/ui-preset": "2.22.3",
"@radix-ui/react-accordion": "^1.2.3",
"@radix-ui/react-avatar": "^1.3.1",
"@radix-ui/react-dialog": "^1.3.1",
"@radix-ui/react-dropdown-menu": "^2.2.1",
"@radix-ui/react-select": "^2.4.1",
"@radix-ui/react-separator": "^1.2.0",
"@radix-ui/react-slider": "^1.4.7",
"@radix-ui/react-slot": "^1.5.0",
"@radix-ui/react-tabs": "^1.2.1",
"@stripe/react-stripe-js": "^5.3.0",
"@stripe/stripe-js": "^8.2.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"instantsearch.js": "4.113.0",
"lodash": "^4.17.21",
"lucide-react": "^1.70.0",
"next": "16.3.8",
"pg": "^8.11.3",
"qs": "^6.12.1",
"react": "19.0.5",
"react-country-flag": "^3.1.0",
"react-dom": "19.0.5",
"react-instantsearch": "^7.46.0",
"server-only": "^0.0.1",
"tailwind-merge": "^2.6.1",
"tailwindcss-animate": "^1.0.7",
"tailwindcss-radix": "^2.8.0"
},
"devDependencies": {
"@babel/core": "^7.17.5",
"@medusajs/types": "2.22.3",
"@types/lodash": "^4.14.195",
"@types/node": "17.0.21",
"@types/pg": "^8.11.0",
"@types/react": "19.0.5",
"@types/react-dom": "19.0.5",
"@types/react-instantsearch-dom": "^6.12.3",
"ansi-colors": "^4.1.3",
"autoprefixer": "^10.4.2",
"babel-loader": "^8.2.3",
"eslint": "^9.13.0",
"eslint-config-next": "16.3.8",
"postcss": "^8.4.8",
"prettier": "^2.8.8",
"tailwindcss": "^3.0.23",
"typescript": "^5.3.2"
},
"packageManager": "npm@11.19.0"
}

View File

@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -0,0 +1 @@
Pergola_transitioning_from_day_t…_bdaf7175_1080 p.mp4

View File

@@ -0,0 +1,63 @@
import {
UCP_CAPABILITIES,
UCP_MCP_PATH,
UCP_REST_BASE_PATH,
UCP_VERSION,
} from "@lib/ucp/ucp"
import { getRequestOrigin } from "@lib/util/site"
export const GET = (request: Request) => {
const origin = getRequestOrigin(request)
const overview = `https://ucp.dev/${UCP_VERSION}/specification/overview/`
const capabilities = Object.fromEntries(
Object.entries(UCP_CAPABILITIES).map(([name, { spec, schema }]) => [
name,
[{ version: UCP_VERSION, spec, schema }],
])
)
return Response.json(
{
ucp: {
version: UCP_VERSION,
services: {
"dev.ucp.shopping": [
{
version: UCP_VERSION,
spec: overview,
transport: "mcp",
endpoint: `${origin}${UCP_MCP_PATH}`,
schema: `https://ucp.dev/${UCP_VERSION}/services/shopping/mcp.openrpc.json`,
},
{
version: UCP_VERSION,
spec: overview,
transport: "rest",
endpoint: `${origin}${UCP_REST_BASE_PATH}`,
schema: `https://ucp.dev/${UCP_VERSION}/services/shopping/rest.openapi.json`,
},
],
},
capabilities: {
...capabilities,
"dev.ucp.shopping.permalink": [
{
version: UCP_VERSION,
spec: `https://ucp.dev/${UCP_VERSION}/specification/permalink`,
schema: `https://ucp.dev/${UCP_VERSION}/schemas/shopping/permalink.json`,
config: { endpoint: `${origin}/buy` },
},
],
},
payment_handlers: {},
},
},
{
headers: {
"Cache-Control": "public, max-age=300",
"Access-Control-Allow-Origin": "*",
},
}
)
}

View File

@@ -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 (
<div className="grid grid-cols-1 small:grid-cols-[1fr_416px] content-container gap-x-40 py-12">
<PaymentWrapper cart={cart}>
<CheckoutForm cart={cart} customer={customer} />
</PaymentWrapper>
<CheckoutSummary cart={cart} />
</div>
)
}

View File

@@ -0,0 +1,43 @@
import LocalizedClientLink from "@modules/common/components/localized-client-link"
import ChevronDown from "@modules/common/icons/chevron-down"
import MedusaCTA from "@modules/layout/components/medusa-cta"
export default function CheckoutLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<div className="w-full bg-white relative small:min-h-screen">
<div className="h-16 bg-white border-b ">
<nav className="flex h-full items-center content-container justify-between">
<LocalizedClientLink
href="/cart"
className="text-small-semi text-ui-fg-base flex items-center gap-x-2 uppercase flex-1 basis-0"
data-testid="back-to-cart-link"
>
<ChevronDown className="rotate-90" size={16} />
<span className="mt-px hidden small:block txt-compact-plus text-ui-fg-subtle hover:text-ui-fg-base ">
Back to shopping cart
</span>
<span className="mt-px block small:hidden txt-compact-plus text-ui-fg-subtle hover:text-ui-fg-base">
Back
</span>
</LocalizedClientLink>
<LocalizedClientLink
href="/"
className="txt-compact-xlarge-plus text-ui-fg-subtle hover:text-ui-fg-base uppercase"
data-testid="store-link"
>
Medusa Store
</LocalizedClientLink>
<div className="flex-1 basis-0" />
</nav>
</div>
<div className="relative" data-testid="checkout-container">{children}</div>
<div className="py-4 w-full flex items-center justify-center">
<MedusaCTA />
</div>
</div>
)
}

View File

@@ -0,0 +1,19 @@
import InteractiveLink from "@modules/common/components/interactive-link"
import { Metadata } from "next"
export const metadata: Metadata = {
title: "404",
description: "Something went wrong",
}
export default async function NotFound() {
return (
<div className="flex flex-col gap-4 items-center justify-center min-h-[calc(100vh-64px)]">
<h1 className="text-2xl-semi text-ui-fg-base">Page not found</h1>
<p className="text-small-regular text-ui-fg-base">
The page you tried to access does not exist.
</p>
<InteractiveLink href="/">Go to frontpage</InteractiveLink>
</div>
)
}

View File

@@ -0,0 +1,38 @@
import { Metadata } from "next"
import { notFound } from "next/navigation"
import AddressBook from "@modules/account/components/address-book"
import { getRegion } from "@lib/data/regions"
import { retrieveCustomer } from "@lib/data/customer"
export const metadata: Metadata = {
title: "Addresses",
description: "View your addresses",
}
export default async function Addresses(props: {
params: Promise<{ countryCode: string }>
}) {
const params = await props.params
const { countryCode } = params
const customer = await retrieveCustomer()
const region = await getRegion(countryCode)
if (!customer || !region) {
notFound()
}
return (
<div className="w-full" data-testid="addresses-page-wrapper">
<div className="mb-8 flex flex-col gap-y-4">
<h1 className="text-2xl-semi">Shipping Addresses</h1>
<p className="text-base-regular">
View and update your shipping addresses, you can add as many as you
like. Saving your addresses will make them available during checkout.
</p>
</div>
<AddressBook customer={customer} region={region} />
</div>
)
}

View File

@@ -0,0 +1,3 @@
export default function Default() {
return null
}

View File

@@ -0,0 +1,9 @@
import Spinner from "@modules/common/icons/spinner"
export default function Loading() {
return (
<div className="flex items-center justify-center w-full h-full text-ui-fg-base">
<Spinner size={36} />
</div>
)
}

View File

@@ -0,0 +1,33 @@
import { retrieveOrder } from "@lib/data/orders"
import OrderDetailsTemplate from "@modules/order/templates/order-details-template"
import { Metadata } from "next"
import { notFound } from "next/navigation"
type Props = {
params: Promise<{ id: string }>
}
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params
const order = await retrieveOrder(params.id).catch(() => null)
if (!order) {
notFound()
}
return {
title: `Order #${order.display_id}`,
description: `View your order`,
}
}
export default async function OrderDetailPage(props: Props) {
const params = await props.params
const order = await retrieveOrder(params.id).catch(() => null)
if (!order) {
notFound()
}
return <OrderDetailsTemplate order={order} />
}

View File

@@ -0,0 +1,37 @@
import { Metadata } from "next"
import OrderOverview from "@modules/account/components/order-overview"
import { notFound } from "next/navigation"
import { listOrders } from "@lib/data/orders"
import Divider from "@modules/common/components/divider"
import TransferRequestForm from "@modules/account/components/transfer-request-form"
export const metadata: Metadata = {
title: "Orders",
description: "Overview of your previous orders.",
}
export default async function Orders() {
const orders = await listOrders()
if (!orders) {
notFound()
}
return (
<div className="w-full" data-testid="orders-page-wrapper">
<div className="mb-8 flex flex-col gap-y-4">
<h1 className="text-2xl-semi">Orders</h1>
<p className="text-base-regular">
View your previous orders and their status. You can also create
returns or exchanges for your orders if needed.
</p>
</div>
<div>
<OrderOverview orders={orders} />
<Divider className="mb-8 mt-8" />
<TransferRequestForm />
</div>
</div>
)
}

View File

@@ -0,0 +1,22 @@
import { Metadata } from "next"
import Overview from "@modules/account/components/overview"
import { notFound } from "next/navigation"
import { retrieveCustomer } from "@lib/data/customer"
import { listOrders } from "@lib/data/orders"
export const metadata: Metadata = {
title: "Account",
description: "Overview of your account activity.",
}
export default async function OverviewTemplate() {
const customer = await retrieveCustomer().catch(() => null)
const orders = (await listOrders().catch(() => null)) || null
if (!customer) {
notFound()
}
return <Overview customer={customer} orders={orders} />
}

View File

@@ -0,0 +1,51 @@
import { Metadata } from "next"
import ProfilePhone from "@modules/account//components/profile-phone"
import ProfileBillingAddress from "@modules/account/components/profile-billing-address"
import ProfileEmail from "@modules/account/components/profile-email"
import ProfileName from "@modules/account/components/profile-name"
import { notFound } from "next/navigation"
import { listRegions } from "@lib/data/regions"
import { retrieveCustomer } from "@lib/data/customer"
export const metadata: Metadata = {
title: "Profile",
description: "View and edit your Medusa Store profile.",
}
export default async function Profile() {
const customer = await retrieveCustomer()
const regions = await listRegions()
if (!customer || !regions) {
notFound()
}
return (
<div className="w-full" data-testid="profile-page-wrapper">
<div className="mb-8 flex flex-col gap-y-4">
<h1 className="text-2xl-semi">Profile</h1>
<p className="text-base-regular">
View and update your profile information, including your name, email,
and phone number. You can also update your billing address, or change
your password.
</p>
</div>
<div className="flex flex-col gap-y-8 w-full">
<ProfileName customer={customer} />
<Divider />
<ProfileEmail customer={customer} />
<Divider />
<ProfilePhone customer={customer} />
<Divider />
{/* <ProfilePassword customer={customer} />
<Divider /> */}
<ProfileBillingAddress customer={customer} regions={regions} />
</div>
</div>
)
}
const Divider = () => {
return <div className="w-full h-px bg-gray-200" />
}

View File

@@ -0,0 +1 @@
export { default, metadata } from "./page"

View File

@@ -0,0 +1,12 @@
import { Metadata } from "next"
import LoginTemplate from "@modules/account/templates/login-template"
export const metadata: Metadata = {
title: "Sign in",
description: "Sign in to your Medusa Store account.",
}
export default function Login() {
return <LoginTemplate />
}

View File

@@ -0,0 +1,20 @@
import { retrieveCustomer } from "@lib/data/customer"
// TODO: Re-add Toaster component when needed
import AccountLayout from "@modules/account/templates/account-layout"
export default async function AccountPageLayout({
dashboard,
login,
}: {
dashboard?: React.ReactNode
login?: React.ReactNode
}) {
const customer = await retrieveCustomer().catch(() => null)
return (
<AccountLayout customer={customer}>
{customer ? dashboard : login}
{/* TODO: Re-add Toaster component when needed */}
</AccountLayout>
)
}

View File

@@ -0,0 +1,9 @@
import Spinner from "@modules/common/icons/spinner"
export default function Loading() {
return (
<div className="flex items-center justify-center w-full h-full text-ui-fg-base">
<Spinner size={36} />
</div>
)
}

View File

@@ -0,0 +1,103 @@
import { sdk } from "@lib/config"
import { getCartId } from "@lib/data/cookies"
import { getRegion } from "@lib/data/regions"
import { HttpTypes } from "@medusajs/types"
import { activateCart, MAX_LINE_ITEM_QUANTITY } from "@lib/util/server-cart"
import { getRequestOrigin } from "@lib/util/site"
import { isEqual } from "lodash"
import { NextRequest, NextResponse } from "next/server"
const resolveVariantId = async (form: FormData, regionId: string) => {
const productId = form.get("product_id")?.toString()
const selectedOptions: Record<string, string> = {}
form.forEach((value, key) => {
const match = key.match(/^options\[(.+)\]$/)
if (match) {
selectedOptions[match[1]] = value.toString()
}
})
if (!productId || Object.keys(selectedOptions).length === 0) {
return form.get("variant_id")?.toString() || undefined
}
const { product } = await sdk.store.product.retrieve(productId, {
region_id: regionId,
fields: "id,*variants,*variants.options",
})
return product.variants?.find((variant: HttpTypes.StoreProductVariant) =>
isEqual(
Object.fromEntries(
(variant.options ?? []).map((o) => [o.option_id, o.value])
),
selectedOptions
)
)?.id
}
const addLineItem = async (
cartId: string | undefined,
regionId: string,
variantId: string,
quantity: number
) => {
const id =
cartId ?? (await sdk.store.cart.create({ region_id: regionId })).cart.id
await sdk.store.cart.createLineItem(id, { variant_id: variantId, quantity })
return id
}
const errorMessage = (error: unknown) =>
error instanceof Error ? error.message : "Could not add item to cart"
/** No-JavaScript add-to-cart: the product page form posts here. */
export async function POST(
request: NextRequest,
{ params }: { params: Promise<{ countryCode: string }> }
) {
const { countryCode } = await params
const region = await getRegion(countryCode)
if (!region) {
return new NextResponse("Unknown country code", { status: 404 })
}
const form = await request.formData()
const quantity = Math.min(
Math.max(parseInt(form.get("quantity")?.toString() ?? "1", 10) || 1, 1),
MAX_LINE_ITEM_QUANTITY
)
let variantId: string | undefined
try {
variantId = await resolveVariantId(form, region.id)
} catch {
return new NextResponse("Product not found", { status: 404 })
}
if (!variantId) {
return new NextResponse("Select a valid product variant", { status: 400 })
}
const existingCartId = await getCartId()
let cartId: string
try {
cartId = await addLineItem(existingCartId, region.id, variantId, quantity)
} catch (error) {
if (!existingCartId) {
return new NextResponse(errorMessage(error), { status: 400 })
}
// The stored cart may be completed or belong to another region.
try {
cartId = await addLineItem(undefined, region.id, variantId, quantity)
} catch (retryError) {
return new NextResponse(errorMessage(retryError), { status: 400 })
}
}
await activateCart(cartId)
return NextResponse.redirect(
`${getRequestOrigin(request)}/${countryCode}/cart`,
303
)
}

View File

@@ -0,0 +1,5 @@
import SkeletonCartPage from "@modules/skeletons/templates/skeleton-cart-page"
export default function Loading() {
return <SkeletonCartPage />
}

View File

@@ -0,0 +1,21 @@
import { Metadata } from "next"
import InteractiveLink from "@modules/common/components/interactive-link"
export const metadata: Metadata = {
title: "404",
description: "Something went wrong",
}
export default function NotFound() {
return (
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)]">
<h1 className="text-2xl-semi text-ui-fg-base">Page not found</h1>
<p className="text-small-regular text-ui-fg-base">
The cart you tried to access does not exist. Clear your cookies and try
again.
</p>
<InteractiveLink href="/">Go to frontpage</InteractiveLink>
</div>
)
}

View File

@@ -0,0 +1,21 @@
import { retrieveCart } from "@lib/data/cart"
import { retrieveCustomer } from "@lib/data/customer"
import CartTemplate from "@modules/cart/templates"
import { Metadata } from "next"
import { notFound } from "next/navigation"
export const metadata: Metadata = {
title: "Cart",
description: "View your cart",
}
export default async function Cart() {
const cart = await retrieveCart().catch((error) => {
console.error(error)
return notFound()
})
const customer = await retrieveCustomer()
return <CartTemplate cart={cart} customer={customer} />
}

View File

@@ -0,0 +1,35 @@
import { sdk } from "@lib/config"
import { activateCart } from "@lib/util/server-cart"
import { getRequestOrigin } from "@lib/util/site"
import { NextResponse } from "next/server"
const NO_STORE = { "Cache-Control": "no-store", "Referrer-Policy": "no-referrer" }
/** UCP checkout `continue_url`: hands an agent-built cart to the buyer for payment. */
export async function GET(
request: Request,
{ params }: { params: Promise<{ countryCode: string; cartId: string }> }
) {
const { countryCode, cartId } = await params
try {
const { cart } = await sdk.store.cart.retrieve(cartId, {
fields: "id,completed_at,metadata",
})
if (cart.completed_at || cart.metadata?.ucp_canceled === true) {
throw new Error("Cart is no longer open")
}
} catch {
return new NextResponse("This cart link has expired", {
status: 410,
headers: NO_STORE,
})
}
await activateCart(cartId)
return NextResponse.redirect(
`${getRequestOrigin(request)}/${countryCode}/checkout`,
{ status: 303, headers: NO_STORE }
)
}

View File

@@ -0,0 +1,62 @@
import { Metadata } from "next"
import { notFound } from "next/navigation"
import { getCategoryByHandle } from "@lib/data/categories"
import CategoryTemplate from "@modules/categories/templates"
import { SortOptions } from "@modules/store/components/refinement-list/sort-products"
import { parseOptionValueIds } from "@lib/util/product-option-filters"
type Props = {
params: Promise<{ category: string[]; countryCode: string }>
searchParams: Promise<
Record<string, string | string[] | undefined> & {
sortBy?: SortOptions
page?: string
optionValueIds?: string | string[]
}
>
}
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params
try {
const productCategory = await getCategoryByHandle(params.category)
const title = productCategory.name + " | Medusa Store"
const description = productCategory.description ?? `${title} category.`
return {
title: `${title} | Medusa Store`,
description,
alternates: {
canonical: `${params.category.join("/")}`,
},
}
} catch {
notFound()
}
}
export default async function CategoryPage(props: Props) {
const searchParams = await props.searchParams
const params = await props.params
const { sortBy, page } = searchParams
const optionValueIds = parseOptionValueIds(searchParams)
const productCategory = await getCategoryByHandle(params.category)
if (!productCategory) {
notFound()
}
return (
<CategoryTemplate
category={productCategory}
sortBy={sortBy}
page={page}
countryCode={params.countryCode}
optionValueIds={optionValueIds}
/>
)
}

View File

@@ -0,0 +1,59 @@
import { Metadata } from "next"
import { notFound } from "next/navigation"
import { getCollectionByHandle } from "@lib/data/collections"
import CollectionTemplate from "@modules/collections/templates"
import { SortOptions } from "@modules/store/components/refinement-list/sort-products"
import { parseOptionValueIds } from "@lib/util/product-option-filters"
type Props = {
params: Promise<{ handle: string; countryCode: string }>
searchParams: Promise<
Record<string, string | string[] | undefined> & {
page?: string
sortBy?: SortOptions
optionValueIds?: string | string[]
}
>
}
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params
const collection = await getCollectionByHandle(params.handle)
if (!collection) {
notFound()
}
const metadata = {
title: `${collection.title} | Medusa Store`,
description: `${collection.title} collection`,
} as Metadata
return metadata
}
export default async function CollectionPage(props: Props) {
const searchParams = await props.searchParams
const params = await props.params
const { sortBy, page } = searchParams
const optionValueIds = parseOptionValueIds(searchParams)
const collection = await getCollectionByHandle(params.handle).then(
(collection) => collection,
)
if (!collection) {
notFound()
}
return (
<CollectionTemplate
collection={collection}
page={page}
sortBy={sortBy}
countryCode={params.countryCode}
optionValueIds={optionValueIds}
/>
)
}

View File

@@ -0,0 +1,24 @@
import { Metadata } from "next"
import { STORE_NAME } from "@lib/util/site"
import { PlaceholderNotice, PolicyPage } from "@modules/policies/templates"
export const dynamic = "force-static"
export const revalidate = 60
export const metadata: Metadata = {
title: "Contact",
description: `How to contact ${STORE_NAME}.`,
}
export default function ContactPage() {
return (
<PolicyPage title="Contact">
<PlaceholderNotice />
<p>
Questions about an order, shipping or returns? Contact {STORE_NAME}{" "}
customer service and include your order number.
</p>
</PolicyPage>
)
}

View File

@@ -0,0 +1,45 @@
import { Metadata } from "next"
import { listCartOptions, retrieveCart } from "@lib/data/cart"
import { retrieveCustomer } from "@lib/data/customer"
import { getBaseURL } from "@lib/util/env"
import { StoreCartShippingOption } from "@medusajs/types"
import CartMismatchBanner from "@modules/layout/components/cart-mismatch-banner"
import Footer from "@modules/layout/templates/footer"
import Nav from "@modules/layout/templates/nav"
import FreeShippingPriceNudge from "@modules/shipping/components/free-shipping-price-nudge"
export const metadata: Metadata = {
metadataBase: new URL(getBaseURL()),
}
export default async function PageLayout(props: { children: React.ReactNode }) {
const customer = await retrieveCustomer()
const cart = await retrieveCart()
let shippingOptions: StoreCartShippingOption[] = []
if (cart) {
const { shipping_options } = await listCartOptions()
shippingOptions = shipping_options
}
return (
<>
<Nav />
{customer && cart && (
<CartMismatchBanner customer={customer} cart={cart} />
)}
{cart && (
<FreeShippingPriceNudge
variant="popup"
cart={cart}
shippingOptions={shippingOptions}
/>
)}
{props.children}
<Footer />
</>
)
}

View File

@@ -0,0 +1,20 @@
import { Metadata } from "next"
import InteractiveLink from "@modules/common/components/interactive-link"
export const metadata: Metadata = {
title: "404",
description: "Something went wrong",
}
export default function NotFound() {
return (
<div className="flex flex-col gap-4 items-center justify-center min-h-[calc(100vh-64px)]">
<h1 className="text-2xl-semi text-ui-fg-base">Page not found</h1>
<p className="text-small-regular text-ui-fg-base">
The page you tried to access does not exist.
</p>
<InteractiveLink href="/">Go to frontpage</InteractiveLink>
</div>
)
}

View File

@@ -0,0 +1,5 @@
import SkeletonOrderConfirmed from "@modules/skeletons/templates/skeleton-order-confirmed"
export default function Loading() {
return <SkeletonOrderConfirmed />
}

View File

@@ -0,0 +1,23 @@
import { retrieveOrder } from "@lib/data/orders"
import OrderCompletedTemplate from "@modules/order/templates/order-completed-template"
import { Metadata } from "next"
import { notFound } from "next/navigation"
type Props = {
params: Promise<{ id: string }>
}
export const metadata: Metadata = {
title: "Order Confirmed",
description: "You purchase was successful",
}
export default async function OrderConfirmedPage(props: Props) {
const params = await props.params
const order = await retrieveOrder(params.id).catch(() => null)
if (!order) {
return notFound()
}
return <OrderCompletedTemplate order={order} />
}

View File

@@ -0,0 +1,41 @@
import { acceptTransferRequest } from "@lib/data/orders"
import { Heading, Text } from "@modules/common/components/ui"
import TransferImage from "@modules/order/components/transfer-image"
export default async function TransferPage({
params,
}: {
params: Promise<{ id: string; token: string }>
}) {
const { id, token } = await params
const { success, error } = await acceptTransferRequest(id, token)
return (
<div className="flex flex-col gap-y-4 items-start w-2/5 mx-auto mt-10 mb-20">
<TransferImage />
<div className="flex flex-col gap-y-6">
{success && (
<>
<Heading level="h1" className="text-xl text-zinc-900">
Order transfered!
</Heading>
<Text className="text-zinc-600">
Order {id} has been successfully transfered to the new owner.
</Text>
</>
)}
{!success && (
<>
<Text className="text-zinc-600">
There was an error accepting the transfer. Please try again.
</Text>
{error && (
<Text className="text-red-500">Error message: {error}</Text>
)}
</>
)}
</div>
</div>
)
}

View File

@@ -0,0 +1,41 @@
import { declineTransferRequest } from "@lib/data/orders"
import { Heading, Text } from "@modules/common/components/ui"
import TransferImage from "@modules/order/components/transfer-image"
export default async function TransferPage({
params,
}: {
params: Promise<{ id: string; token: string }>
}) {
const { id, token } = await params
const { success, error } = await declineTransferRequest(id, token)
return (
<div className="flex flex-col gap-y-4 items-start w-2/5 mx-auto mt-10 mb-20">
<TransferImage />
<div className="flex flex-col gap-y-6">
{success && (
<>
<Heading level="h1" className="text-xl text-zinc-900">
Order transfer declined!
</Heading>
<Text className="text-zinc-600">
Transfer of order {id} has been successfully declined.
</Text>
</>
)}
{!success && (
<>
<Text className="text-zinc-600">
There was an error declining the transfer. Please try again.
</Text>
{error && (
<Text className="text-red-500">Error message: {error}</Text>
)}
</>
)}
</div>
</div>
)
}

View File

@@ -0,0 +1,38 @@
import { Heading, Text } from "@modules/common/components/ui"
import TransferActions from "@modules/order/components/transfer-actions"
import TransferImage from "@modules/order/components/transfer-image"
export default async function TransferPage({
params,
}: {
params: Promise<{ id: string; token: string }>
}) {
const { id, token } = await params
return (
<div className="flex flex-col gap-y-4 items-start w-2/5 mx-auto mt-10 mb-20">
<TransferImage />
<div className="flex flex-col gap-y-6">
<Heading level="h1" className="text-xl text-zinc-900">
Transfer request for order {id}
</Heading>
<Text className="text-zinc-600">
You&#39;ve received a request to transfer ownership of your order ({id}).
If you agree to this request, you can approve the transfer by clicking
the button below.
</Text>
<div className="w-full h-px bg-zinc-200" />
<Text className="text-zinc-600">
If you accept, the new owner will take over all responsibilities and
permissions associated with this order.
</Text>
<Text className="text-zinc-600">
If you do not recognize this request or wish to retain ownership, no
further action is required.
</Text>
<div className="w-full h-px bg-zinc-200" />
<TransferActions id={id} token={token} />
</div>
</div>
)
}

View File

@@ -0,0 +1,106 @@
import { Metadata } from "next"
import Hero from "@modules/home/components/hero"
import PartnersTicker from "@modules/home/components/partners-ticker"
import ProductShowcase from "@modules/home/components/product-showcase"
import MissionSection from "@modules/home/components/mission-section"
import CtaBanner from "@modules/home/components/cta-banner"
import LatestNews from "@modules/home/components/latest-news"
import FaqSection from "@modules/home/components/faq-section"
import { listCollections } from "@lib/data/collections"
import { getRegion, listRegions } from "@lib/data/regions"
import { toJsonLd } from "@lib/util/product-structured-data"
import { getSiteOrigin, listCountryCodes, STORE_NAME } from "@lib/util/site"
import { buildRegionsReturnPolicies } from "@lib/util/store-policies"
import siteConfig from "@/config/site.json"
export const dynamic = "force-static"
export const revalidate = 60
export async function generateMetadata(props: {
params: Promise<{ countryCode: string }>
}): Promise<Metadata> {
const { countryCode } = await props.params
const [origin, regions] = await Promise.all([getSiteOrigin(), listRegions()])
return {
title: siteConfig.title,
description: siteConfig.description,
alternates: {
canonical: `${origin}/${countryCode}`,
languages: {
...Object.fromEntries(
listCountryCodes(regions).map((code) => [
`en-${code.toUpperCase()}`,
`${origin}/${code}`,
])
),
"x-default": origin,
},
},
}
}
export default async function Home(props: {
params: Promise<{ countryCode: string }>
}) {
const params = await props.params
const { countryCode } = params
const region = await getRegion(countryCode)
const { collections } = await listCollections({
fields: "id, handle, title",
})
if (!collections || !region) {
return null
}
const [origin, regions] = await Promise.all([getSiteOrigin(), listRegions()])
const homeUrl = `${origin}/${countryCode}`
const returnPolicies = buildRegionsReturnPolicies(regions)
const structuredData = [
{
"@context": "https://schema.org",
"@type": "Organization",
name: STORE_NAME,
url: origin,
...(returnPolicies.length
? { hasMerchantReturnPolicy: returnPolicies }
: {}),
},
{
"@context": "https://schema.org",
"@type": "WebSite",
name: STORE_NAME,
url: homeUrl,
potentialAction: {
"@type": "SearchAction",
target: {
"@type": "EntryPoint",
urlTemplate: `${homeUrl}/search?q={search_term_string}`,
},
"query-input": "required name=search_term_string",
},
},
]
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: toJsonLd(structuredData) }}
/>
<Hero />
<PartnersTicker />
<ProductShowcase />
<MissionSection />
<CtaBanner />
<LatestNews />
<FaqSection />
</>
)
}

View File

@@ -0,0 +1,29 @@
import { Metadata } from "next"
import { STORE_NAME } from "@lib/util/site"
import { PlaceholderNotice, PolicyPage } from "@modules/policies/templates"
export const dynamic = "force-static"
export const revalidate = 60
export const metadata: Metadata = {
title: "Privacy policy",
description: `How ${STORE_NAME} collects and uses personal data.`,
}
export default function PrivacyPage() {
return (
<PolicyPage title="Privacy policy">
<PlaceholderNotice />
<p>
{STORE_NAME} collects the information you provide at checkout, such as
your name, email address and shipping address, to process and deliver
your order.
</p>
<p>
Payment details are handled by our payment provider and are not stored
by the store. Cookies are used to keep your cart and sign-in session.
</p>
</PolicyPage>
)
}

View File

@@ -0,0 +1,38 @@
import { listProducts } from "@lib/data/products"
import { getRegion } from "@lib/data/regions"
import { renderProductMarkdown } from "@lib/util/product-markdown"
import { getRequestOrigin } from "@lib/util/site"
const HEADERS = {
"Content-Type": "text/markdown; charset=utf-8",
"Cache-Control": "public, max-age=0, s-maxage=60, stale-while-revalidate=600",
Vary: "Accept",
}
/** Served for `<product-url>.md` and `Accept: text/markdown` via rewrites in next.config.js. */
export async function GET(
request: Request,
{ params }: { params: Promise<{ countryCode: string; handle: string }> }
) {
const { countryCode, handle } = await params
const region = await getRegion(countryCode)
const product = region
? await listProducts({ countryCode, queryParams: { handle } })
.then(({ response }) => response.products[0])
.catch(() => undefined)
: undefined
if (!region || !product) {
return new Response("# Product not found\n", { status: 404, headers: HEADERS })
}
return new Response(
renderProductMarkdown({
product,
region,
origin: getRequestOrigin(request),
countryCode,
}),
{ headers: HEADERS }
)
}

View File

@@ -0,0 +1,145 @@
import { Metadata } from "next"
import { notFound } from "next/navigation"
import { listProducts } from "@lib/data/products"
import { getRegion, listRegions } from "@lib/data/regions"
import ProductTemplate from "@modules/products/templates"
import { HttpTypes } from "@medusajs/types"
import { isVariantInStock } from "@lib/util/inventory"
import {
buildProductStructuredData,
getPricedVariants,
toJsonLd,
} from "@lib/util/product-structured-data"
import { getSiteOrigin, listCountryCodes, STORE_NAME } from "@lib/util/site"
type Props = {
params: Promise<{ countryCode: string; handle: string }>
}
export const dynamic = "force-static"
export const revalidate = 60
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params
const { handle } = params
const region = await getRegion(params.countryCode)
if (!region) {
notFound()
}
const product = await listProducts({
countryCode: params.countryCode,
queryParams: { handle },
}).then(({ response }) => response.products[0])
if (!product) {
notFound()
}
const [origin, regions] = await Promise.all([getSiteOrigin(), listRegions()])
const path = `/products/${product.handle}`
const productUrl = `${origin}/${params.countryCode}${path}`
const description = product.description || product.title
return {
title: `${product.title} | ${STORE_NAME}`,
description,
alternates: {
canonical: productUrl,
languages: Object.fromEntries(
listCountryCodes(regions).map((code) => [
`en-${code.toUpperCase()}`,
`${origin}/${code}${path}`,
])
),
types: { "text/markdown": `${productUrl}.md` },
},
openGraph: {
title: `${product.title} | ${STORE_NAME}`,
description,
url: productUrl,
images: product.thumbnail ? [product.thumbnail] : [],
},
}
}
const ProductMetaTags = ({
product,
region,
}: {
product: HttpTypes.StoreProduct
region: HttpTypes.StoreRegion
}) => {
const variants = getPricedVariants(product)
const cheapest = variants.reduce<HttpTypes.StoreProductVariant | undefined>(
(min, v) =>
!min ||
v.calculated_price!.calculated_amount! <
min.calculated_price!.calculated_amount!
? v
: min,
undefined
)
const currency = region.currency_code.toUpperCase()
const amount = cheapest?.calculated_price?.calculated_amount?.toFixed(2)
return (
<>
<meta property="og:type" content="product" />
{amount && (
<>
<meta property="product:price:amount" content={amount} />
<meta property="product:price:currency" content={currency} />
<meta property="og:price:amount" content={amount} />
<meta property="og:price:currency" content={currency} />
</>
)}
<meta
property="product:availability"
content={variants.some(isVariantInStock) ? "in stock" : "out of stock"}
/>
</>
)
}
export default async function ProductPage(props: Props) {
const params = await props.params
const region = await getRegion(params.countryCode)
if (!region) {
notFound()
}
const pricedProduct = await listProducts({
countryCode: params.countryCode,
queryParams: { handle: params.handle },
}).then(({ response }) => response.products[0])
if (!pricedProduct) {
notFound()
}
const origin = await getSiteOrigin()
const structuredData = buildProductStructuredData({
product: pricedProduct,
region,
countryCode: params.countryCode,
productUrl: `${origin}/${params.countryCode}/products/${pricedProduct.handle}`,
})
return (
<>
<ProductMetaTags product={pricedProduct} region={region} />
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: toJsonLd(structuredData) }}
/>
<ProductTemplate
product={pricedProduct}
region={region}
countryCode={params.countryCode}
/>
</>
)
}

View File

@@ -0,0 +1,39 @@
import { Metadata } from "next"
import { getStorePolicies } from "@lib/data/store-policies"
import { PoliciesUnavailable, PolicyPage } from "@modules/policies/templates"
export const dynamic = "force-static"
export const revalidate = 60
export const metadata: Metadata = {
title: "Return policy",
description: "How to return items and get a refund.",
}
export default async function ReturnsPage(props: {
params: Promise<{ countryCode: string }>
}) {
const { countryCode } = await props.params
const { current } = await getStorePolicies(countryCode)
return (
<PolicyPage title="Return policy">
{current ? (
<>
<p>
You can return items within {current.returnWindowDays} days of
delivery. Items are returned by mail.
</p>
<p>
{current.freeReturns
? "Return shipping is free."
: "Return shipping costs are paid by the customer."}
</p>
</>
) : (
<PoliciesUnavailable />
)}
</PolicyPage>
)
}

View File

@@ -0,0 +1,72 @@
import { Metadata } from "next"
import { notFound } from "next/navigation"
import { listProducts } from "@lib/data/products"
import { getRegion } from "@lib/data/regions"
import ProductPreview from "@modules/products/components/product-preview"
import SearchForm from "@modules/search/components/search-form"
const RESULT_LIMIT = 24
type Props = {
params: Promise<{ countryCode: string }>
searchParams: Promise<{ q?: string | string[] }>
}
const getQuery = (q?: string | string[]) =>
(Array.isArray(q) ? q[0] : q)?.trim().slice(0, 200) ?? ""
export async function generateMetadata(props: Props): Promise<Metadata> {
const query = getQuery((await props.searchParams).q)
return {
title: query ? `Search results for "${query}"` : "Search",
robots: { index: false, follow: true },
}
}
export default async function SearchPage(props: Props) {
const { countryCode } = await props.params
const query = getQuery((await props.searchParams).q)
const region = await getRegion(countryCode)
if (!region) {
notFound()
}
const { response } = query
? await listProducts({
countryCode,
queryParams: { q: query, limit: RESULT_LIMIT },
})
: { response: { products: [], count: 0 } }
return (
<div className="content-container py-6" data-testid="search-container">
<h1 className="text-2xl-semi mb-6">
{query ? `Search results for "${query}"` : "Search"}
</h1>
<SearchForm countryCode={countryCode} defaultValue={query} className="mb-8 max-w-xl" />
{query && (
<p className="text-small-regular text-ui-fg-subtle mb-6">
{response.count} {response.count === 1 ? "product" : "products"} found
</p>
)}
{query && response.products.length === 0 ? (
<p className="text-ui-fg-subtle">
No products match your search. Try a different keyword.
</p>
) : (
<ul
className="grid grid-cols-2 w-full small:grid-cols-3 medium:grid-cols-4 gap-x-6 gap-y-8"
data-testid="search-results"
>
{response.products.map((product) => (
<li key={product.id}>
<ProductPreview product={product} region={region} />
</li>
))}
</ul>
)}
</div>
)
}

View File

@@ -0,0 +1,42 @@
import { Metadata } from "next"
import { getStorePolicies } from "@lib/data/store-policies"
import {
PoliciesUnavailable,
PolicyPage,
ShippingSummary,
} from "@modules/policies/templates"
export const dynamic = "force-static"
export const revalidate = 60
export const metadata: Metadata = {
title: "Shipping information",
description: "Shipping rates and delivery times.",
}
export default async function ShippingPage(props: {
params: Promise<{ countryCode: string }>
}) {
const { countryCode } = await props.params
const { current, currencyCode } = await getStorePolicies(countryCode)
return (
<PolicyPage title="Shipping information">
{current ? (
<>
<p>
Orders to {countryCode.toUpperCase()} ship with the following rates
and delivery times.
</p>
<ShippingSummary policies={current} currencyCode={currencyCode} />
<p className="text-ui-fg-subtle">
Available shipping methods and final costs are shown at checkout.
</p>
</>
) : (
<PoliciesUnavailable />
)}
</PolicyPage>
)
}

View File

@@ -0,0 +1,23 @@
import { Metadata } from "next"
import { notFound } from "next/navigation"
import { getRegion } from "@lib/data/regions"
import StoreTemplate from "@modules/store/templates"
export const metadata: Metadata = {
title: "Store",
description: "Explore all of our products.",
}
export default async function StorePage(props: {
params: Promise<{ countryCode: string }>
}) {
const { countryCode } = await props.params
const region = await getRegion(countryCode)
if (!region) {
notFound()
}
return <StoreTemplate currencyCode={region.currency_code} />
}

View File

@@ -0,0 +1,29 @@
import { Metadata } from "next"
import { STORE_NAME } from "@lib/util/site"
import { PlaceholderNotice, PolicyPage } from "@modules/policies/templates"
export const dynamic = "force-static"
export const revalidate = 60
export const metadata: Metadata = {
title: "Terms of service",
description: `Terms that apply to purchases from ${STORE_NAME}.`,
}
export default function TermsPage() {
return (
<PolicyPage title="Terms of service">
<PlaceholderNotice />
<p>
By placing an order with {STORE_NAME} you agree to these terms. Prices,
product availability and shipping options are shown on the product
pages and at checkout, and may change without notice.
</p>
<p>
Orders are confirmed by email once payment is received. Returns and
refunds are handled according to our return policy.
</p>
</PolicyPage>
)
}

View File

@@ -0,0 +1,25 @@
import { Metadata } from "next"
import { Suspense } from "react"
import VerifyAccount from "@modules/account/components/verify-account"
export const metadata: Metadata = {
title: "Verify your email",
description: "Verify your email address to complete your registration.",
}
export default function VerifyAccountPage() {
return (
<div className="w-full flex justify-center px-8 py-12">
<Suspense
fallback={
<p className="text-base-regular text-ui-fg-base">
Verifying your email...
</p>
}
>
<VerifyAccount />
</Suspense>
</div>
)
}

View File

@@ -0,0 +1,103 @@
import { sdk } from "@lib/config"
import { submitAdyenPayment } from "@lib/data/adyen"
import { placeOrder } from "@lib/data/cart"
import { getAuthHeaders, setCartId } from "@lib/data/cookies"
import { HttpTypes } from "@medusajs/types"
import { unstable_rethrow } from "next/navigation"
import { NextRequest, NextResponse } from "next/server"
export async function GET(req: NextRequest) {
const { origin, searchParams } = req.nextUrl
const cartId = searchParams.get("cart_id")
const countryCode = searchParams.get("country_code")
const paymentIntent = searchParams.get("payment_intent")
const paymentIntentClientSecret = searchParams.get(
"payment_intent_client_secret"
)
const redirectStatus = searchParams.get("redirect_status")
// Without a country code the middleware resolves the customer's region and
// prefixes it; either way every redirect below stays on this origin.
const prefix = countryCode ? `/${countryCode}` : ""
const rejected = () =>
NextResponse.redirect(`${origin}${prefix}/cart?error=payment_failed`)
// Adyen returns the shopper here after a redirect, for example to their bank's
// authentication page, with the result to submit to the payment session.
const redirectResult = searchParams.get("redirectResult")
if (cartId && redirectResult) {
await setCartId(cartId)
try {
// Redirects to the order confirmation once the payment is authorized.
await submitAdyenPayment({ details: { redirectResult } }, cartId)
} catch (error) {
unstable_rethrow(error)
}
return rejected()
}
if (!cartId || !paymentIntent || !paymentIntentClientSecret) {
return rejected()
}
const cart = await sdk.client
.fetch<HttpTypes.StoreCartResponse>(`/store/carts/${cartId}`, {
method: "GET",
query: { fields: "payment_collection.payment_sessions.data" },
headers: { ...(await getAuthHeaders()) },
cache: "no-store",
})
.then(({ cart }) => cart)
.catch(() => null)
const paymentSession = cart?.payment_collection?.payment_sessions?.find(
(session) => session.data?.id === paymentIntent
)
if (
!paymentSession ||
paymentSession.data?.client_secret !== paymentIntentClientSecret
) {
return rejected()
}
await setCartId(cartId)
// The customer backed out or the bank declined. Stripe puts the PaymentIntent
// back into `requires_payment_method`, so the Payment Element can mount
// against it again — return to the payment step and let them retry.
if (redirectStatus === "failed") {
const params = new URLSearchParams({ step: "payment" })
// Forward Stripe's own return parameters so the checkout step can tell how
// the off-site authorization ended.
for (const key of [
"payment_intent",
"payment_intent_client_secret",
"redirect_status",
]) {
const value = searchParams.get(key)
if (value) {
params.set(key, value)
}
}
return NextResponse.redirect(`${origin}${prefix}/checkout?${params}`)
}
try {
await placeOrder(cartId)
} catch (error) {
unstable_rethrow(error)
return NextResponse.redirect(`${origin}${prefix}/cart?error=order_failed`)
}
// Only reached when the cart did not convert into an order.
return NextResponse.redirect(`${origin}${prefix}/cart?error=order_failed`)
}

View File

@@ -0,0 +1,72 @@
import {
activateCart,
createCartWithItems,
findMissingVariantIds,
MAX_LINE_ITEM_QUANTITY,
resolveRegion,
} from "@lib/util/server-cart"
import { getRequestOrigin } from "@lib/util/site"
import { NextResponse } from "next/server"
const ITEM_PATTERN = /^([A-Za-z0-9._-]+|~[A-Za-z0-9_-]+):([1-9][0-9]*)$/
const NO_STORE = { "Cache-Control": "no-store", "Referrer-Policy": "no-referrer" }
const decodeItemId = (token: string) =>
token.startsWith("~")
? Buffer.from(token.slice(1), "base64url").toString("utf8")
: token
const parseItems = (raw: string) => {
const items: { variant_id: string; quantity: number }[] = []
for (const pair of decodeURIComponent(raw).split(",")) {
const match = pair.match(ITEM_PATTERN)
if (!match) {
return null
}
const quantity = Number(match[2])
if (quantity > MAX_LINE_ITEM_QUANTITY) {
return null
}
items.push({ variant_id: decodeItemId(match[1]), quantity })
}
return items.length ? items : null
}
const textResponse = (body: string, status: number) =>
new NextResponse(body, { status, headers: NO_STORE })
/** UCP cart permalink: /buy/{variant_id}:{quantity},... builds a cart and opens checkout. */
export async function GET(
request: Request,
{ params }: { params: Promise<{ items: string }> }
) {
const items = parseItems((await params).items)
if (!items) {
return textResponse("Malformed permalink. Use /buy/{variant_id}:{quantity},...", 400)
}
const country = new URL(request.url).searchParams.get("context/address_country")
const resolved = await resolveRegion(country ?? undefined)
if (!resolved) {
return textResponse("This store does not ship to the requested country", 400)
}
const missing = await findMissingVariantIds(items.map((item) => item.variant_id))
if (missing.length) {
return textResponse(`Unknown items: ${missing.join(", ")}`, 404)
}
let cartId: string
try {
cartId = await createCartWithItems(resolved.region.id, items)
} catch {
return textResponse("One or more items in this link can't be purchased", 400)
}
await activateCart(cartId)
return NextResponse.redirect(
`${getRequestOrigin(request)}/${resolved.countryCode}/checkout`,
{ status: 303, headers: NO_STORE }
)
}

View File

@@ -0,0 +1,28 @@
import { getBaseURL } from "@lib/util/env"
import { Metadata } from "next"
import { Plus_Jakarta_Sans } from "next/font/google"
import { cn } from "@/lib/utils"
import "styles/globals.css"
const fontSans = Plus_Jakarta_Sans({
subsets: ["latin", "latin-ext"],
variable: "--font-sans",
display: "swap",
})
export const metadata: Metadata = {
metadataBase: new URL(getBaseURL()),
}
export default function RootLayout(props: { children: React.ReactNode }) {
return (
<html lang="bs" data-mode="light" className={fontSans.variable}>
<head>
<link rel="ucp" href="/.well-known/ucp" />
</head>
<body className="min-h-screen bg-background font-sans text-foreground antialiased selection:bg-secondary selection:text-secondary-foreground">
<main className="relative">{props.children}</main>
</body>
</html>
)
}

View File

@@ -0,0 +1,72 @@
import { listCategories } from "@lib/data/categories"
import { listCollections } from "@lib/data/collections"
import { listRegions } from "@lib/data/regions"
import { UCP_MCP_PATH, UCP_REST_BASE_PATH } from "@lib/ucp/ucp"
import {
getDefaultCountryCode,
getRequestOrigin,
listCountryCodes,
STORE_NAME,
} from "@lib/util/site"
export async function GET(request: Request) {
const origin = getRequestOrigin(request)
const [regions, categories, { collections }] = await Promise.all([
listRegions(),
listCategories({ fields: "name,handle,parent_category_id", limit: 50 }),
listCollections({ fields: "title,handle", limit: "50" }),
])
const countries = listCountryCodes(regions)
const base = `${origin}/${getDefaultCountryCode(regions)}`
const currencies = Array.from(
new Set(regions.map((r) => r.currency_code?.toUpperCase()).filter(Boolean))
)
const links = [
...categories
.filter((c) => !c.parent_category_id)
.map((c) => `- [${c.name}](${base}/categories/${c.handle})`),
...collections.map((c) => `- [${c.title}](${base}/collections/${c.handle})`),
]
const body = `# ${STORE_NAME}
> Online store. Ships to ${countries.length} countries. Prices in ${currencies.join(", ")}.
URLs are prefixed with a two-letter country code that sets currency and pricing, for example \`${base}\`. Available country codes: ${countries.join(", ")}.
## Shop
- [All products](${base}/store)
${links.join("\n")}
- Search: ${base}/search?q={query}
## Buying
- Product pages contain an add-to-cart form that posts \`variant_id\` and \`quantity\` to ${base}/cart/add.
- Preselect a variant with \`?v_id={variant_id}\` on a product URL.
- Append \`.md\` to a product URL (or send \`Accept: text/markdown\`) for a Markdown version with variant IDs, prices and stock.
- Checkout link: ${origin}/buy/{variant_id}:{quantity},{variant_id}:{quantity}
- [Cart](${base}/cart)
## Policies
- [Shipping information](${base}/shipping)
- [Return policy](${base}/returns)
- [Terms of service](${base}/terms)
- [Privacy policy](${base}/privacy)
- [Contact](${base}/contact)
## For agents
- [Sitemap](${origin}/sitemap.xml)
- [UCP profile](${origin}/.well-known/ucp)
- UCP MCP endpoint: ${origin}${UCP_MCP_PATH}
- UCP REST endpoint: ${origin}${UCP_REST_BASE_PATH}
`
return new Response(body, {
headers: {
"Content-Type": "text/markdown; charset=utf-8",
"Cache-Control": "public, max-age=3600",
},
})
}

View File

@@ -0,0 +1,31 @@
import { ArrowRight } from "lucide-react"
import { Metadata } from "next"
import Link from "next/link"
import { Button } from "@/components/ui/button"
export const metadata: Metadata = {
title: "404 - Stranica nije pronađena",
description: "Tražena stranica ne postoji na Suman d.o.o.",
}
export default function NotFound() {
return (
<div className="flex flex-col items-center justify-center min-h-[70vh] text-center px-4">
<span className="text-sm font-semibold uppercase tracking-widest text-primary">
Greška 404
</span>
<h1 className="mt-2 text-3xl sm:text-4xl font-extrabold tracking-tight text-foreground">
Stranica nije pronađena
</h1>
<p className="mt-3 text-sm text-muted-foreground max-w-md">
Stranica koju tražite ne postoji ili je premještena. Pregledajte naš asortiman suncobrana i pergola na početnoj stranici.
</p>
<Link href="/" className="mt-6">
<Button size="lg" className="gap-2">
<span>Povratak na početnu</span>
<ArrowRight className="h-4 w-4" />
</Button>
</Link>
</div>
)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

View File

@@ -0,0 +1,21 @@
import { getSiteOrigin } from "@lib/util/site"
import type { MetadataRoute } from "next"
export default async function robots(): Promise<MetadataRoute.Robots> {
const origin = await getSiteOrigin()
return {
rules: {
userAgent: "*",
allow: "/",
disallow: [
"/*/cart",
"/*/checkout",
"/*/account",
"/*/order/",
"/buy/",
],
},
sitemap: `${origin}/sitemap.xml`,
}
}

View File

@@ -0,0 +1,72 @@
import { sdk } from "@lib/config"
import { listRegions } from "@lib/data/regions"
import { getSiteOrigin, listCountryCodes } from "@lib/util/site"
import type { MetadataRoute } from "next"
const STATIC_PATHS = [
"",
"/store",
"/shipping",
"/returns",
"/terms",
"/privacy",
"/contact",
]
const PAGE_SIZE = 200
type Page<T> = { items: T[]; count: number }
async function listAll<T>(fetchPage: (offset: number) => Promise<Page<T>>) {
const all: T[] = []
for (let offset = 0; ; offset += PAGE_SIZE) {
const { items, count } = await fetchPage(offset)
all.push(...items)
if (offset + PAGE_SIZE >= count || !items.length) {
return all
}
}
}
type Entry = { handle?: string | null; updated_at?: string | Date | null }
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const query = { fields: "handle,updated_at", limit: PAGE_SIZE }
const [origin, regions, products, categories, collections] = await Promise.all([
getSiteOrigin(),
listRegions(),
listAll<Entry>((offset) =>
sdk.store.product
.list({ ...query, offset })
.then((res) => ({ items: res.products, count: res.count }))
),
listAll<Entry>((offset) =>
sdk.store.category
.list({ ...query, offset })
.then((res) => ({ items: res.product_categories, count: res.count }))
),
listAll<Entry>((offset) =>
sdk.store.collection
.list({ ...query, offset })
.then((res) => ({ items: res.collections, count: res.count }))
),
])
const toEntries = (base: string, prefix: string, items: Entry[]) =>
items
.filter((item) => item.handle)
.map((item) => ({
url: `${base}/${prefix}/${item.handle}`,
lastModified: item.updated_at ? new Date(item.updated_at) : undefined,
}))
return listCountryCodes(regions).flatMap((countryCode) => {
const base = `${origin}/${countryCode}`
return [
...STATIC_PATHS.map((path) => ({ url: `${base}${path}` })),
...toEntries(base, "products", products),
...toEntries(base, "categories", categories),
...toEntries(base, "collections", collections),
]
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

View File

@@ -0,0 +1,6 @@
import { handleMcpRequest } from "@lib/ucp/mcp"
export const POST = (request: Request) => handleMcpRequest(request)
export const GET = () =>
new Response("Method Not Allowed", { status: 405, headers: { Allow: "POST" } })

View File

@@ -0,0 +1,15 @@
import { cancelCart, getCart, updateCart } from "@lib/ucp/operations"
import { readJsonBody, toResponse } from "@lib/ucp/ucp"
type Context = { params: Promise<{ cartId: string }> }
export const GET = async (request: Request, { params }: Context) =>
toResponse(await getCart(request, (await params).cartId))
export const PUT = async (request: Request, { params }: Context) =>
toResponse(
await updateCart(request, (await params).cartId, (await readJsonBody(request)) ?? {})
)
export const DELETE = async (request: Request, { params }: Context) =>
toResponse(await cancelCart(request, (await params).cartId))

View File

@@ -0,0 +1,11 @@
import { createCart } from "@lib/ucp/operations"
import { readJsonBody, toResponse } from "@lib/ucp/ucp"
export const POST = async (request: Request) =>
toResponse(
await createCart(
request,
(await readJsonBody(request)) ?? {},
request.headers.get("idempotency-key")
)
)

View File

@@ -0,0 +1,5 @@
import { lookupCatalog } from "@lib/ucp/operations"
import { readJsonBody, toResponse } from "@lib/ucp/ucp"
export const POST = async (request: Request) =>
toResponse(await lookupCatalog(request, (await readJsonBody(request)) ?? {}))

View File

@@ -0,0 +1,5 @@
import { searchCatalog } from "@lib/ucp/operations"
import { readJsonBody, toResponse } from "@lib/ucp/ucp"
export const POST = async (request: Request) =>
toResponse(await searchCatalog(request, (await readJsonBody(request)) ?? {}))

View File

@@ -0,0 +1,7 @@
import { cancelCheckout } from "@lib/ucp/operations"
import { toResponse } from "@lib/ucp/ucp"
export const POST = async (
request: Request,
{ params }: { params: Promise<{ id: string }> }
) => toResponse(await cancelCheckout(request, (await params).id))

View File

@@ -0,0 +1,7 @@
import { completeCheckout } from "@lib/ucp/operations"
import { toResponse } from "@lib/ucp/ucp"
export const POST = async (
request: Request,
{ params }: { params: Promise<{ id: string }> }
) => toResponse(await completeCheckout(request, (await params).id))

View File

@@ -0,0 +1,12 @@
import { getCheckout, updateCheckout } from "@lib/ucp/operations"
import { readJsonBody, toResponse } from "@lib/ucp/ucp"
type Context = { params: Promise<{ id: string }> }
export const GET = async (request: Request, { params }: Context) =>
toResponse(await getCheckout(request, (await params).id))
export const PUT = async (request: Request, { params }: Context) =>
toResponse(
await updateCheckout(request, (await params).id, (await readJsonBody(request)) ?? {})
)

View File

@@ -0,0 +1,11 @@
import { createCheckout } from "@lib/ucp/operations"
import { readJsonBody, toResponse } from "@lib/ucp/ucp"
export const POST = async (request: Request) =>
toResponse(
await createCheckout(
request,
(await readJsonBody(request)) ?? {},
request.headers.get("idempotency-key")
)
)

View File

@@ -0,0 +1,26 @@
import { handleMcpRequest } from "@lib/ucp/mcp"
import { UCP_MCP_PATH, UCP_REST_BASE_PATH, UCP_VERSION } from "@lib/ucp/ucp"
import { getRequestOrigin } from "@lib/util/site"
export const GET = (request: Request) => {
const origin = getRequestOrigin(request)
const base = `${origin}${UCP_REST_BASE_PATH}`
return Response.json({
ucp: { version: UCP_VERSION },
profile: `${origin}/.well-known/ucp`,
mcp: `${origin}${UCP_MCP_PATH}`,
operations: [
`POST ${base}/catalog/search`,
`POST ${base}/catalog/lookup`,
`POST ${base}/cart`,
`GET|PUT|DELETE ${base}/cart/{id}`,
`POST ${base}/checkout-sessions`,
`GET|PUT ${base}/checkout-sessions/{id}`,
`POST ${base}/checkout-sessions/{id}/complete`,
`POST ${base}/checkout-sessions/{id}/cancel`,
],
})
}
// Agents that only know the service URL may probe it with MCP JSON-RPC.
export const POST = (request: Request) => handleMcpRequest(request)

View File

@@ -0,0 +1,57 @@
"use client"
import * as React from "react"
import * as AccordionPrimitive from "@radix-ui/react-accordion"
import { ChevronDown } from "lucide-react"
import { cn } from "@/lib/utils"
const Accordion = AccordionPrimitive.Root
const AccordionItem = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
>(({ className, ...props }, ref) => (
<AccordionPrimitive.Item
ref={ref}
className={cn("border-b", className)}
{...props}
/>
))
AccordionItem.displayName = "AccordionItem"
const AccordionTrigger = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Header className="flex">
<AccordionPrimitive.Trigger
ref={ref}
className={cn(
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",
className
)}
{...props}
>
{children}
<ChevronDown className="size-4 shrink-0 text-muted-foreground transition-transform duration-200" />
</AccordionPrimitive.Trigger>
</AccordionPrimitive.Header>
))
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
const AccordionContent = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Content
ref={ref}
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
{...props}
>
<div className={cn("pb-4 pt-0", className)}>{children}</div>
</AccordionPrimitive.Content>
))
AccordionContent.displayName = AccordionPrimitive.Content.displayName
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }

View File

@@ -0,0 +1,36 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const badgeVariants = cva(
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {
default:
"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
secondary:
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
outline: "text-foreground",
},
},
defaultVariants: {
variant: "default",
},
}
)
export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
)
}
export { Badge, badgeVariants }

View File

@@ -0,0 +1,74 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { Loader2 } from "lucide-react"
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
outline:
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
lg: "h-10 rounded-md px-8 text-base",
icon: "size-9",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
isLoading?: boolean
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
(
{
className,
variant,
size,
asChild = false,
isLoading = false,
disabled,
children,
...props
},
ref
) => {
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
disabled={disabled || isLoading}
{...props}
>
{isLoading && <Loader2 className="h-4 w-4 animate-spin" />}
{children}
</Comp>
)
}
)
Button.displayName = "Button"
export { Button, buttonVariants }

View File

@@ -0,0 +1,76 @@
import * as React from "react"
import { cn } from "@/lib/utils"
const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-xl border bg-card text-card-foreground shadow",
className
)}
{...props}
/>
))
Card.displayName = "Card"
const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props}
/>
))
CardHeader.displayName = "CardHeader"
const CardTitle = React.forwardRef<
HTMLHeadingElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn("font-semibold leading-none tracking-tight", className)}
{...props}
/>
))
CardTitle.displayName = "CardTitle"
const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
CardDescription.displayName = "CardDescription"
const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
))
CardContent.displayName = "CardContent"
const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex items-center p-6 pt-0", className)}
{...props}
/>
))
CardFooter.displayName = "CardFooter"
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }

View File

@@ -0,0 +1,121 @@
import * as React from "react"
import * as DialogPrimitive from "@radix-ui/react-dialog"
import { X } from "lucide-react"
import { cn } from "@/lib/utils"
const Dialog = DialogPrimitive.Root
const DialogTrigger = DialogPrimitive.Trigger
const DialogPortal = DialogPrimitive.Portal
const DialogClose = DialogPrimitive.Close
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
/>
))
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName
const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className
)}
{...props}
/>
)
DialogHeader.displayName = "DialogHeader"
const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
DialogFooter.displayName = "DialogFooter"
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
DialogTitle.displayName = DialogPrimitive.Title.displayName
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DialogDescription.displayName = DialogPrimitive.Description.displayName
export {
Dialog,
DialogPortal,
DialogOverlay,
DialogClose,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
}

View File

@@ -0,0 +1,185 @@
import * as React from "react"
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
import { Check, ChevronRight, Circle } from "lucide-react"
import { cn } from "@/lib/utils"
const DropdownMenu = DropdownMenuPrimitive.Root
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
const DropdownMenuGroup = DropdownMenuPrimitive.Group
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
const DropdownMenuSub = DropdownMenuPrimitive.Sub
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
const DropdownMenuSubTrigger = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
inset?: boolean
}
>(({ className, inset, children, ...props }, ref) => (
<DropdownMenuPrimitive.SubTrigger
ref={ref}
className={cn(
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
inset && "pl-8",
className
)}
{...props}
>
{children}
<ChevronRight className="ml-auto h-4 w-4" />
</DropdownMenuPrimitive.SubTrigger>
))
DropdownMenuSubTrigger.displayName =
DropdownMenuPrimitive.SubTrigger.displayName
const DropdownMenuSubContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.SubContent
ref={ref}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)}
{...props}
/>
))
DropdownMenuSubContent.displayName =
DropdownMenuPrimitive.SubContent.displayName
const DropdownMenuContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<DropdownMenuPrimitive.Portal>
<DropdownMenuPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)}
{...props}
/>
</DropdownMenuPrimitive.Portal>
))
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
const DropdownMenuItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean
}
>(({ className, inset, ...props }, ref) => (
<DropdownMenuPrimitive.Item
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
inset && "pl-8",
className
)}
{...props}
/>
))
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
const DropdownMenuCheckboxItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
>(({ className, children, checked, ...props }, ref) => (
<DropdownMenuPrimitive.CheckboxItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
checked={checked}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
</DropdownMenuPrimitive.CheckboxItem>
))
DropdownMenuCheckboxItem.displayName =
DropdownMenuPrimitive.CheckboxItem.displayName
const DropdownMenuRadioItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
>(({ className, children, ...props }, ref) => (
<DropdownMenuPrimitive.RadioItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<Circle className="h-2 w-2 fill-current" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
</DropdownMenuPrimitive.RadioItem>
))
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
const DropdownMenuLabel = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
inset?: boolean
}
>(({ className, inset, ...props }, ref) => (
<DropdownMenuPrimitive.Label
ref={ref}
className={cn(
"px-2 py-1.5 text-sm font-semibold",
inset && "pl-8",
className
)}
{...props}
/>
))
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
const DropdownMenuSeparator = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.Separator
ref={ref}
className={cn("-mx-1 my-1 h-px bg-muted", className)}
{...props}
/>
))
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
export {
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuCheckboxItem,
DropdownMenuRadioItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuGroup,
DropdownMenuPortal,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuRadioGroup,
}

View File

@@ -0,0 +1,56 @@
import React from "react"
import {
Award,
ShieldCheck,
SunMedium,
Wrench,
Truck,
RotateCcw,
MapPin,
Phone,
Mail,
Shield,
User,
ShoppingBag,
Search,
Menu,
ChevronRight,
ArrowRight,
Sparkles,
HelpCircle,
Factory,
Eye,
type LucideProps,
} from "lucide-react"
const iconsMap: Record<string, React.ComponentType<LucideProps>> = {
Award,
ShieldCheck,
SunMedium,
Wrench,
Truck,
RotateCcw,
MapPin,
Phone,
Mail,
Shield,
User,
ShoppingBag,
Search,
Menu,
ChevronRight,
ArrowRight,
Sparkles,
HelpCircle,
Factory,
Eye,
}
export function DynamicIcon({
name,
...props
}: { name: string } & LucideProps) {
const IconComponent = iconsMap[name] || HelpCircle
return <IconComponent {...props} />
}

View File

@@ -0,0 +1,25 @@
import * as React from "react"
import { cn } from "@/lib/utils"
export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
return (
<input
type={type}
className={cn(
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className
)}
ref={ref}
{...props}
/>
)
}
)
Input.displayName = "Input"
export { Input }

View File

@@ -0,0 +1,24 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
)
const Label = React.forwardRef<
HTMLLabelElement,
React.LabelHTMLAttributes<HTMLLabelElement> &
VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
<label
ref={ref}
className={cn(labelVariants(), className)}
{...props}
/>
))
Label.displayName = "Label"
export { Label }

View File

@@ -0,0 +1,32 @@
import Image from "next/image"
import { cn } from "@/lib/utils"
export interface LogoProps {
className?: string
width?: number
height?: number
priority?: boolean
alt?: string
}
export function Logo({
className,
width = 160,
height = 68,
priority = true,
alt = "Suman d.o.o.",
}: LogoProps) {
return (
<Image
src="/logo.png"
alt={alt}
width={width}
height={height}
priority={priority}
className={cn("h-9 w-auto object-contain transition-opacity duration-200 group-hover:opacity-90", className)}
/>
)
}
export default Logo

View File

@@ -0,0 +1,71 @@
import React from "react"
import { cn } from "@/lib/utils"
export interface SectionHeaderProps {
kicker?: string
title: string
description?: string
action?: React.ReactNode
className?: string
titleClassName?: string
kickerClassName?: string
}
/**
* SectionHeader / SectionHeader1
* Unificirana komponenta sa podijeljenim zaglavljem:
* - Lijevo: Kicker / oznaka sekcije (npr. "Naši Proizvodi", "Naša Misija")
* - Desno: Veliki naslov i opcioni opis ili CTA
*/
export function SectionHeader({
kicker,
title,
description,
action,
className,
titleClassName,
kickerClassName,
}: SectionHeaderProps) {
return (
<div
className={cn(
"flex flex-col lg:flex-row lg:items-start justify-between gap-6 mb-10 sm:mb-12",
className
)}
>
{/* Left Column: Kicker */}
{kicker && (
<div
className={cn(
"text-sm font-semibold tracking-wide text-muted-foreground uppercase shrink-0 pt-1.5",
kickerClassName
)}
>
{kicker}
</div>
)}
{/* Right Column: Title & Description */}
<div className="max-w-2xl space-y-3">
<h2
className={cn(
"text-3xl sm:text-4xl lg:text-5xl font-medium tracking-tight text-foreground leading-[1.18]",
titleClassName
)}
>
{title}
</h2>
{description && (
<p className="text-base sm:text-lg text-muted-foreground leading-relaxed">
{description}
</p>
)}
{action && <div className="pt-2">{action}</div>}
</div>
</div>
)
}
export const SectionHeader1 = SectionHeader
export default SectionHeader

View File

@@ -0,0 +1,31 @@
"use client"
import * as React from "react"
import * as SeparatorPrimitive from "@radix-ui/react-separator"
import { cn } from "@/lib/utils"
const Separator = React.forwardRef<
React.ElementRef<typeof SeparatorPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
>(
(
{ className, orientation = "horizontal", decorative = true, ...props },
ref
) => (
<SeparatorPrimitive.Root
ref={ref}
decorative={decorative}
orientation={orientation}
className={cn(
"shrink-0 bg-border",
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
className
)}
{...props}
/>
)
)
Separator.displayName = SeparatorPrimitive.Root.displayName
export { Separator }

View File

@@ -0,0 +1,140 @@
"use client"
import * as React from "react"
import * as SheetPrimitive from "@radix-ui/react-dialog"
import { cva, type VariantProps } from "class-variance-authority"
import { X } from "lucide-react"
import { cn } from "@/lib/utils"
const Sheet = SheetPrimitive.Root
const SheetTrigger = SheetPrimitive.Trigger
const SheetClose = SheetPrimitive.Close
const SheetPortal = SheetPrimitive.Portal
const SheetOverlay = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Overlay
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
ref={ref}
/>
))
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
const sheetVariants = cva(
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
{
variants: {
side: {
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
bottom:
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
right:
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
},
},
defaultVariants: {
side: "right",
},
}
)
interface SheetContentProps
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
VariantProps<typeof sheetVariants> {}
const SheetContent = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Content>,
SheetContentProps
>(({ side = "right", className, children, ...props }, ref) => (
<SheetPortal>
<SheetOverlay />
<SheetPrimitive.Content
ref={ref}
className={cn(sheetVariants({ side }), className)}
{...props}
>
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
<X className="size-4" />
<span className="sr-only">Close</span>
</SheetPrimitive.Close>
{children}
</SheetPrimitive.Content>
</SheetPortal>
))
SheetContent.displayName = SheetPrimitive.Content.displayName
const SheetHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-2 text-center sm:text-left",
className
)}
{...props}
/>
)
SheetHeader.displayName = "SheetHeader"
const SheetFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
SheetFooter.displayName = "SheetFooter"
const SheetTitle = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Title
ref={ref}
className={cn("text-lg font-semibold text-foreground", className)}
{...props}
/>
))
SheetTitle.displayName = SheetPrimitive.Title.displayName
const SheetDescription = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
SheetDescription.displayName = SheetPrimitive.Description.displayName
export {
Sheet,
SheetPortal,
SheetOverlay,
SheetTrigger,
SheetClose,
SheetContent,
SheetHeader,
SheetFooter,
SheetTitle,
SheetDescription,
}

View File

@@ -0,0 +1,16 @@
import { cn } from "@/lib/utils"
function Skeleton({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
className={cn("animate-pulse rounded-md bg-primary/10", className)}
{...props}
/>
)
}
export { Skeleton }

View File

@@ -0,0 +1,118 @@
import * as React from "react"
import { cn } from "@/lib/utils"
const Table = React.forwardRef<
HTMLTableElement,
React.HTMLAttributes<HTMLTableElement>
>(({ className, ...props }, ref) => (
<div className="relative w-full overflow-auto">
<table
ref={ref}
className={cn("w-full caption-bottom text-sm", className)}
{...props}
/>
</div>
))
Table.displayName = "Table"
const TableHeader = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
))
TableHeader.displayName = "TableHeader"
const TableBody = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<tbody
ref={ref}
className={cn("[&_tr:last-child]:border-0", className)}
{...props}
/>
))
TableBody.displayName = "TableBody"
const TableFooter = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<tfoot
ref={ref}
className={cn(
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
className
)}
{...props}
/>
))
TableFooter.displayName = "TableFooter"
const TableRow = React.forwardRef<
HTMLTableRowElement,
React.HTMLAttributes<HTMLTableRowElement>
>(({ className, ...props }, ref) => (
<tr
ref={ref}
className={cn(
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
className
)}
{...props}
/>
))
TableRow.displayName = "TableRow"
const TableHead = React.forwardRef<
HTMLTableCellElement,
React.ThHTMLAttributes<HTMLTableCellElement>
>(({ className, ...props }, ref) => (
<th
ref={ref}
className={cn(
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
))
TableHead.displayName = "TableHead"
const TableCell = React.forwardRef<
HTMLTableCellElement,
React.TdHTMLAttributes<HTMLTableCellElement>
>(({ className, ...props }, ref) => (
<td
ref={ref}
className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
{...props}
/>
))
TableCell.displayName = "TableCell"
const TableCaption = React.forwardRef<
HTMLTableCaptionElement,
React.HTMLAttributes<HTMLTableCaptionElement>
>(({ className, ...props }, ref) => (
<caption
ref={ref}
className={cn("mt-4 text-sm text-muted-foreground", className)}
{...props}
/>
))
TableCaption.displayName = "TableCaption"
export {
Table,
TableHeader,
TableBody,
TableFooter,
TableHead,
TableCell,
TableRow,
TableCaption,
}

View File

@@ -0,0 +1,55 @@
"use client"
import * as React from "react"
import * as TabsPrimitive from "@radix-ui/react-tabs"
import { cn } from "@/lib/utils"
const Tabs = TabsPrimitive.Root
const TabsList = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.List>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
>(({ className, ...props }, ref) => (
<TabsPrimitive.List
ref={ref}
className={cn(
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
className
)}
{...props}
/>
))
TabsList.displayName = TabsPrimitive.List.displayName
const TabsTrigger = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Trigger
ref={ref}
className={cn(
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
className
)}
{...props}
/>
))
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
const TabsContent = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Content
ref={ref}
className={cn(
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
className
)}
{...props}
/>
))
TabsContent.displayName = TabsPrimitive.Content.displayName
export { Tabs, TabsList, TabsTrigger, TabsContent }

View File

@@ -0,0 +1,9 @@
{
"title": "Opremite vašu terasu ili ugostiteljski prostor vrhunskim sistemima za zaštitu od sunca.",
"image": "https://placehold.co/1920x800",
"cta": {
"label": "Zatražite Ponudu",
"href": "/contact"
}
}

View File

@@ -0,0 +1,32 @@
{
"kicker": "FAQ",
"titleLine1": "Vaša Pitanja,",
"titleLine2": "Naši Odgovori.",
"cta": {
"label": "Postavite Pitanje",
"href": "/contact"
},
"items": [
{
"question": "Od kojih materijala se proizvode Suman suncobrani i pergole?",
"answer": "Svi naši sistemi izrađuju se od 100% visokootpornog plastificiranog aluminija sa nehrđajućim inox spojnim elementima. Koristimo vrhunska Sattler i Dickson akrilna platna visoke gustoće sa trajnom UV zaštitom i hidrofobnim premazom."
},
{
"question": "Da li su platna na suncobranima i tendama vodootporna?",
"answer": "Da, sva naša platna posjeduju certifikovan vodeni stub i specijalni premaz koji u potpunosti sprječava prodiranje vode, prljanje i stvaranje plijesni."
},
{
"question": "Koliko traje rok izrade, isporuke i montaže?",
"answer": "Za tipske suncobrane i zglobne tende rok isporuke je obično 7 do 15 radnih dana, dok se za kompleksne bioklimatske pergole rok precizno definiše nakon izlaska tehničkog tima na teren."
},
{
"question": "Da li obezbjeđujete servis i rezervne dijelove?",
"answer": "Kao proizvođač, na našem centralnom lageru u Gračanici uvijek imamo dostupne sve zamjenske komponente: krakove, spojnice, mehanizme, motore i nova platna."
},
{
"question": "Mogu li se suncobrani i tende brendirati logotipom?",
"answer": "Apsolutno. Vršimo profesionalno brendiranje visoko postojanim tehnikama štampe koje garantuju postojanost boja i otpornost na habanje i sunčevo zračenje."
}
]
}

View File

@@ -0,0 +1,53 @@
{
"banner": {
"title": "Postanite Naš Partner",
"subtitle": "Pridružite se mreži zadovoljnih ugostitelja i partnera uz vrhunska rješenja zaštite od sunca.",
"image": "https://placehold.co/1600x600",
"cta": {
"label": "Zatražite Ponudu",
"href": "/contact"
}
},
"brand": {
"description": "Vodeći proizvođač profesionalnih ugostiteljskih suncobrana, bioklimatskih pergola i tendi u Bosni i Hercegovini. Tradicija kvaliteta i pouzdanosti.",
"socials": [
{ "name": "instagram", "href": "https://instagram.com" },
{ "name": "facebook", "href": "https://facebook.com" },
{ "name": "x", "href": "https://twitter.com" },
{ "name": "linkedin", "href": "https://linkedin.com" }
]
},
"columns": [
{
"title": "Kompanija",
"links": [
{ "title": "Početna", "href": "/" },
{ "title": "O Nama", "href": "/about" },
{ "title": "Proizvodi", "href": "/store" },
{ "title": "Reference", "href": "/categories/suncobrani" }
]
},
{
"title": "Podrška",
"links": [
{ "title": "Naša Priča", "href": "/about" },
{ "title": "Dostava i Montaža", "href": "/shipping" },
{ "title": "Garancija i Servis", "href": "/terms" },
{ "title": "B2B Saradnja", "href": "/contact" }
]
}
],
"contact": {
"title": "Kontakt",
"phone": "+387 (0)35 706 000",
"email": "info@suman.ba",
"address": "Branilaca grada bb, Gračanica 75320"
},
"bottomBar": {
"copyright": "Suman d.o.o. Sva prava zadržana.",
"links": [
{ "title": "Uvjeti korištenja", "href": "/terms" },
{ "title": "Politika privatnosti", "href": "/privacy" }
]
}
}

View File

@@ -0,0 +1,14 @@
{
"video": "/pergola-hero.mp4",
"image": "https://placehold.co/1920x1080",
"title": "Profesionalni suncobrani, bioklimatske pergole i tende",
"subtitle": "Suman d.o.o. proizvodi vrhunska rješenja za ugostiteljske objekte, hotele i privatne terase. Spoj dugotrajnosti, robusnog aluminija i vrhunske estetike.",
"primaryCta": {
"label": "Pogledajte Katalog",
"href": "/store"
},
"secondaryCta": {
"label": "Ugostiteljski Suncobrani",
"href": "/categories/suncobrani"
}
}

View File

@@ -0,0 +1,28 @@
{
"kicker": "Naša Misija",
"title": "Povezujemo inovaciju, preciznu proizvodnju i vrhunske materijale za dugotrajna rješenja zaštite od sunca.",
"statCard": {
"topLabel": "Kapacitet Proizvodnje",
"badge": "Godišnji cilj",
"number": "10.000+",
"subtext": "Instaliranih jedinica širom regije i EU",
"icon": "Factory"
},
"visionCard": {
"title": "Naša Vizija",
"description": "Biti vodeći regionalni partner u arhitektonskim rješenjima zaštite od sunca, uz najviši nivo zadovoljstva svakog klijenta.",
"image": "https://images.unsplash.com/photo-1504307651254-35680f356dfd?auto=format&fit=crop&w=1000&q=80",
"icon": "Eye"
},
"qualityCard": {
"title": "Stalan fokus na vrhunski kvalitet materijala i besprijekornu završnu obradu",
"tags": [
"#brzadostava",
"#istraživanjeirazvoj",
"#stručnitim",
"#garancijakvaliteta",
"#vlastitilager"
]
}
}

View File

@@ -0,0 +1,61 @@
{
"headerVersion": "floating",
"brand": {
"name": "SUMAN",
"badge": "",
"tagline": "Profesionalni suncobrani i pergole"
},
"desktopNav": [
{
"title": "Početna",
"href": "/"
},
{
"title": "Svi Proizvodi",
"href": "/store"
},
{
"title": "Suncobrani",
"href": "/categories/suncobrani"
},
{
"title": "Pergole",
"href": "/categories/pergole"
},
{
"title": "Tende",
"href": "/categories/tende"
}
],
"mobileMenu": [
{
"title": "Početna",
"href": "/"
},
{
"title": "Svi Proizvodi",
"href": "/store"
},
{
"title": "Suncobrani",
"href": "/categories/suncobrani"
},
{
"title": "Pergole",
"href": "/categories/pergole"
},
{
"title": "Tende",
"href": "/categories/tende"
},
{
"title": "Moj Račun",
"href": "/account"
},
{
"title": "Korpa",
"href": "/cart"
}
]
}

View File

@@ -0,0 +1,35 @@
{
"kicker": "Najnovije informacije",
"title": "Sve novosti, inspiracije i priče koje oblikuju vanjske prostore",
"cta": {
"label": "Pogledajte sve",
"href": "/blog"
},
"articles": [
{
"date": "19. August 2026",
"title": "Suman na sajmu HoReCa opreme: Nova generacija aluminijskih pergola",
"image": "https://images.unsplash.com/photo-1540555700478-4be289fbecef?auto=format&fit=crop&w=900&q=80",
"href": "/blog/suman-horeca-sajam"
},
{
"date": "12. August 2026",
"title": "Profesionalni suncobrani velikih dimenzija: Pametno rješenje za moderne terase",
"image": "https://images.unsplash.com/photo-1507652313519-d4e9174996dd?auto=format&fit=crop&w=900&q=80",
"href": "/blog/profesionalni-suncobrani"
},
{
"date": "05. August 2026",
"title": "Bioklimatske pergole sa rotirajućim lamelama: Spoj estetike i zaštite",
"image": "https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=900&q=80",
"href": "/blog/bioklimatske-pergole"
},
{
"date": "28. Juli 2026",
"title": "Kako pravilno odabrati platno i konstrukciju za dugotrajnu otpornost na vjetar",
"image": "https://images.unsplash.com/photo-1513694203232-719a280e022f?auto=format&fit=crop&w=900&q=80",
"href": "/blog/odabir-platna-i-konstrukcije"
}
]
}

View File

@@ -0,0 +1,30 @@
{
"title": "",
"items": [
{
"name": "WSKT",
"id": "wskt"
},
{
"name": "FLUOR",
"id": "fluor"
},
{
"name": "VINCI",
"id": "vinci"
},
{
"name": "sinarmas land",
"id": "sinarmas"
},
{
"name": "PAKUWON GROUP",
"id": "pakuwon"
},
{
"name": "Metland",
"id": "metland"
}
]
}

View File

@@ -0,0 +1,66 @@
{
"tabs": {
"specsTitle": "Tehničke Specifikacije i Detalji",
"shippingTitle": "Dostava i Garancija Suman d.o.o."
},
"defaultSpecs": {
"material": "Aluminij / Akrilno platno",
"origin": "Bosna i Hercegovina",
"type": "Ugostiteljski program",
"weight": "Standardna robusna"
},
"specLabels": {
"uv_protection": "UV Zaštita",
"wind_resistance": "Otpornost na vjetar",
"fabric_weight": "Gramaža i platno",
"water_column": "Vodeni stub",
"mast_diameter": "Nosivi profil / Stub",
"warranty_years": "Garancija",
"origin": "Porijeklo",
"special_feature": "Posebna funkcionalnost",
"design_system": "Sistem dizajna",
"ribs_profile": "Profil krakova",
"opening_mechanism": "Mehanizam otvaranja",
"motor": "Motorizacija i upravljanje",
"canvas": "Platno / Pokrov",
"profile": "Profili i nosači",
"drainage": "Odvodnjavanje i oluci",
"lamellas": "Lamele",
"snow_load": "Nosivost na snijeg",
"automation": "Automatizacija i senzori",
"construction": "Konstrukcija",
"four_seasons": "Sezonalnost",
"zip_compatible": "Kompatibilnost sa zatvaranjem",
"arms": "Zglobne ruke",
"fabric": "Platno",
"tilt_angle": "Ugao nagiba",
"system": "Sistem vođenja",
"insulation": "Izolacija",
"frame": "Konstrukcijski ram",
"branding": "Brendiranje i štampa",
"free_space": "Iskoristivost prostora",
"rotation": "Rotacija",
"mast_construction": "Konstrukcija stuba",
"wind_vent": "Odušak za vjetar",
"durability": "Otpornost",
"options_available": "Dodatne opcije"
},
"shippingFeatures": [
{
"icon": "Truck",
"title": "Dostava i Montaža",
"description": "Isporuka vlastitim vozilima ili brzom poštom širom Bosne i Hercegovine. Mogućnost profesionalne montaže i ankerisanja za ugostiteljske objekte."
},
{
"icon": "ShieldCheck",
"title": "Tvornička Garancija",
"description": "Svi Suman suncobrani i pergole dolaze sa višegodišnjom garancijom na konstrukciju, postojanost boje platna i mehanizme."
},
{
"icon": "RotateCcw",
"title": "Servis i Zamjena Platna",
"description": "Osigurana zamjena dotrajalih platana, štampa logotipa i brendiranje, kao i svi originalni rezervni dijelovi direktno iz fabrike."
}
]
}

View File

@@ -0,0 +1,63 @@
{
"kicker": "Naši Proizvodi",
"title": "Nudimo vrhunski asortiman sistema za zaštitu od sunca.",
"items": [
{
"number": "01",
"title": "Suncobran Console",
"description": "Viseći bočni stub za maksimalno iskorišten prostor",
"image": "https://placehold.co/1080x1920",
"href": "/products/suncobran-console"
},
{
"number": "02",
"title": "Suncobran Advance",
"description": "Premium robusni suncobran za ugostiteljske terase",
"image": "https://suman.ba/assets/photos/products/original/1557424992-advance.jpg",
"href": "/products/suncobran-advance"
},
{
"number": "03",
"title": "Bioklimatska Pergola",
"description": "Aluminijska pergola sa pokretnim rotirajućim lamelama",
"image": "https://suman.ba/assets/photos/products/original/1557425154-bioklimatska.jpg",
"href": "/products/bioklimatska-tenda"
},
{
"number": "04",
"title": "Ravna Zglobna Tenda",
"description": "Elegantna zaštita od sunca za privatne i ugostiteljske objekte",
"image": "https://suman.ba/assets/photos/products/original/1557425231-ravna.jpg",
"href": "/products/ravna-zglobna-tenda"
},
{
"number": "05",
"title": "Suncobran Magnum",
"description": "Velikoformatni suncobran za prostrane bašte i hotele",
"image": "https://suman.ba/assets/photos/products/original/1557425052-magnum.jpg",
"href": "/products/suncobran-magnum"
},
{
"number": "06",
"title": "Regulus Bioklimatska Pergola",
"description": "Luksuzna bioklimatska pergola sa integrisanom LED rasvjetom",
"image": "https://suman.ba/assets/photos/products/original/1557425178-regulus.jpg",
"href": "/products/regulus-bioklimatska"
},
{
"number": "07",
"title": "Suncobran Prestige",
"description": "Vrhunska estetika i pouzdanost za hotelske i ugostiteljske komplekse",
"image": "https://suman.ba/assets/photos/products/original/1557425028-prestige.jpg",
"href": "/products/suncobran-prestige"
},
{
"number": "08",
"title": "Kupolasta Tenda",
"description": "Tradicionalni luksuzni dizajn za portale i prozore",
"image": "https://suman.ba/assets/photos/products/original/1557425283-kupolasta.jpg",
"href": "/products/kupolasta-tenda"
}
]
}

View File

@@ -0,0 +1,11 @@
{
"name": "Suman d.o.o.",
"shortName": "Suman",
"title": "Suman d.o.o. | Profesionalni suncobrani, pergole i tende",
"description": "Vrhunski profesionalni suncobrani, bioklimatske pergole i tende proizvedeni u Bosni i Hercegovini. Suman d.o.o. Gračanica.",
"countryCode": "ba",
"countryName": "Bosna i Hercegovina",
"currencyCode": "BAM",
"city": "Gračanica"
}

Some files were not shown because too many files have changed in this diff Show More