Files
the-pet-loft/apps/storefront/src/proxy.ts
ianshaloom 5f7c3cece9 feat(orders): implement return request functionality and order timeline
- Added RequestReturnDialog component for initiating return requests.
- Enhanced OrderDetailPageView to handle return requests and display order timeline.
- Updated OrderActions to include return request button based on order status.
- Introduced OrderTimeline component to visualize order events.
- Modified order-related types and constants to support return functionality.
- Updated UI components for better styling and user experience.

This commit improves the order management system by allowing users to request returns and view the timeline of their orders.
2026-03-07 19:47:55 +03:00

33 lines
1023 B
TypeScript

import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
import { NextResponse } from "next/server";
import {
GUEST_SESSION_COOKIE_NAME,
GUEST_SESSION_MAX_AGE_SECONDS,
} from "@/lib/session/constants";
const isProtectedRoute = createRouteMatcher(["/account(.*)", "/checkout(.*)"]);
export default clerkMiddleware(async (auth, req) => {
if (isProtectedRoute(req)) await auth.protect();
const response = NextResponse.next();
const existing = req.cookies.get(GUEST_SESSION_COOKIE_NAME)?.value;
if (!existing?.trim()) {
const sessionId = crypto.randomUUID();
response.cookies.set(GUEST_SESSION_COOKIE_NAME, sessionId, {
path: "/",
maxAge: GUEST_SESSION_MAX_AGE_SECONDS,
sameSite: "lax",
secure: process.env.NODE_ENV === "production",
});
}
return response;
});
export const config = {
matcher: [
"/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)",
"/(api|trpc)(.*)",
],
};