hey-pharmacist-ecommerce 1.1.15 → 1.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,12 +2,12 @@
2
2
  import React21, { createContext, forwardRef, useContext, useEffect, useState, useCallback, useMemo, useRef } from 'react';
3
3
  import globalAxios4 from 'axios';
4
4
  import { motion, AnimatePresence } from 'framer-motion';
5
- import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, Package, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, Lock, EyeOff, UserPlus, LogOut, HeartPulse, Mail, Phone, User, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Grid, List, ArrowLeft, Menu, Facebook, Twitter, Instagram, Shirt, Pill, Box, ExternalLink, Globe, Home, Info, AlertCircle, XCircle } from 'lucide-react';
5
+ import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, Package, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, Lock, EyeOff, UserPlus, User, Settings, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, ArrowLeft, LogOut, Menu, Mail, Facebook, Twitter, Instagram, Shirt, Pill, Box, ExternalLink, Globe, Home, CheckCircle, Edit, Bell, AlertTriangle, Info, AlertCircle, XCircle } from 'lucide-react';
6
6
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
7
7
  import { useRouter, useSearchParams } from 'next/navigation';
8
8
  import Image4 from 'next/image';
9
9
  import dynamic from 'next/dynamic';
10
- import Link7 from 'next/link';
10
+ import Link6 from 'next/link';
11
11
  import { useForm } from 'react-hook-form';
12
12
  import { zodResolver } from '@hookform/resolvers/zod';
13
13
  import { z } from 'zod';
@@ -8820,7 +8820,7 @@ function ProductDetailScreen({ productId }) {
8820
8820
  return /* @__PURE__ */ React21.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React21.createElement("div", { className: "container mx-auto px-4 py-16" }, /* @__PURE__ */ React21.createElement("div", { className: "grid gap-10 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]" }, /* @__PURE__ */ React21.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ React21.createElement("div", { className: "h-[520px] animate-pulse rounded-3xl bg-slate-200" }), /* @__PURE__ */ React21.createElement("div", { className: "grid grid-cols-3 gap-4" }, Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ React21.createElement("div", { key: index, className: "h-32 animate-pulse rounded-2xl bg-slate-200" })))), /* @__PURE__ */ React21.createElement("div", { className: "space-y-4 rounded-3xl bg-white p-6 shadow-sm" }, /* @__PURE__ */ React21.createElement("div", { className: "h-8 w-32 animate-pulse rounded-full bg-slate-200" }), /* @__PURE__ */ React21.createElement("div", { className: "h-10 w-48 animate-pulse rounded-full bg-slate-200" }), /* @__PURE__ */ React21.createElement("div", { className: "h-6 w-full animate-pulse rounded-full bg-slate-200" }), /* @__PURE__ */ React21.createElement("div", { className: "h-12 w-full animate-pulse rounded-2xl bg-slate-200" }), /* @__PURE__ */ React21.createElement("div", { className: "h-12 w-full animate-pulse rounded-2xl bg-slate-200" })))));
8821
8821
  }
8822
8822
  if (!product) {
8823
- return /* @__PURE__ */ React21.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React21.createElement("div", { className: "container mx-auto px-4 py-16" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-3xl bg-white p-10 text-center shadow-sm" }, /* @__PURE__ */ React21.createElement(Sparkles, { className: "mx-auto h-10 w-10 text-primary-500" }), /* @__PURE__ */ React21.createElement("h1", { className: "mt-6 text-2xl font-semibold text-gray-900" }, "Product not found"), /* @__PURE__ */ React21.createElement("p", { className: "mt-2 text-gray-600" }, "It may have been removed or is temporarily unavailable. Discover other pharmacy essentials in our catalogue."), /* @__PURE__ */ React21.createElement("div", { className: "mt-6" }, /* @__PURE__ */ React21.createElement(Link7, { href: "/shop", className: "inline-block" }, /* @__PURE__ */ React21.createElement(Button, null, "Browse products"))))));
8823
+ return /* @__PURE__ */ React21.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React21.createElement("div", { className: "container mx-auto px-4 py-16" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-3xl bg-white p-10 text-center shadow-sm" }, /* @__PURE__ */ React21.createElement(Sparkles, { className: "mx-auto h-10 w-10 text-primary-500" }), /* @__PURE__ */ React21.createElement("h1", { className: "mt-6 text-2xl font-semibold text-gray-900" }, "Product not found"), /* @__PURE__ */ React21.createElement("p", { className: "mt-2 text-gray-600" }, "It may have been removed or is temporarily unavailable. Discover other pharmacy essentials in our catalogue."), /* @__PURE__ */ React21.createElement("div", { className: "mt-6" }, /* @__PURE__ */ React21.createElement(Link6, { href: "/shop", className: "inline-block" }, /* @__PURE__ */ React21.createElement(Button, null, "Browse products"))))));
8824
8824
  }
8825
8825
  return /* @__PURE__ */ React21.createElement("div", { className: "min-h-screen bg-white" }, /* @__PURE__ */ React21.createElement("div", { className: "bg-gray-50 border-b border-gray-200 py-4" }, /* @__PURE__ */ React21.createElement("div", { className: "max-w-[1400px] mx-auto px-8 md:px-12" }, /* @__PURE__ */ React21.createElement(
8826
8826
  "button",
@@ -10069,7 +10069,7 @@ function LoginScreen() {
10069
10069
  className: "h-4 w-4 rounded border-slate-300 text-primary-600 focus:ring-primary-500"
10070
10070
  }
10071
10071
  ), "Remember me"), /* @__PURE__ */ React21.createElement(
10072
- Link7,
10072
+ Link6,
10073
10073
  {
10074
10074
  href: buildPath("/forgot-password"),
10075
10075
  className: "font-medium text-primary transition hover:opacity-80"
@@ -10085,7 +10085,7 @@ function LoginScreen() {
10085
10085
  },
10086
10086
  isSubmitting ? "Signing in..." : "Sign in"
10087
10087
  )
10088
- ), /* @__PURE__ */ React21.createElement("div", { className: "mt-4" }, /* @__PURE__ */ React21.createElement("p", { className: "text-muted" }, "Don't have an account? ", /* @__PURE__ */ React21.createElement(Link7, { href: buildPath("/register"), className: "font-medium text-primary transition hover:opacity-90" }, "Sign up"))))
10088
+ ), /* @__PURE__ */ React21.createElement("div", { className: "mt-4" }, /* @__PURE__ */ React21.createElement("p", { className: "text-muted" }, "Don't have an account? ", /* @__PURE__ */ React21.createElement(Link6, { href: buildPath("/register"), className: "font-medium text-primary transition hover:opacity-90" }, "Sign up"))))
10089
10089
  )));
10090
10090
  }
10091
10091
  var registerSchema = z.object({
@@ -10222,8 +10222,8 @@ function RegisterScreen() {
10222
10222
  },
10223
10223
  showConfirmPassword ? /* @__PURE__ */ React21.createElement(EyeOff, { className: "h-5 w-5" }) : /* @__PURE__ */ React21.createElement(Eye, { className: "h-5 w-5" })
10224
10224
  )),
10225
- /* @__PURE__ */ React21.createElement("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4 text-sm text-slate-600" }, /* @__PURE__ */ React21.createElement(Shield, { strokeWidth: 2, className: "mt-0.5 h-8 w-8 text-primary" }), /* @__PURE__ */ React21.createElement("span", null, "By creating an account, you agree to our", " ", /* @__PURE__ */ React21.createElement(Link7, { href: buildPath("/terms"), className: "font-semibold text-primary hover:opacity-70" }, "Terms of Service"), " ", "and", " ", /* @__PURE__ */ React21.createElement(
10226
- Link7,
10225
+ /* @__PURE__ */ React21.createElement("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4 text-sm text-slate-600" }, /* @__PURE__ */ React21.createElement(Shield, { strokeWidth: 2, className: "mt-0.5 h-8 w-8 text-primary" }), /* @__PURE__ */ React21.createElement("span", null, "By creating an account, you agree to our", " ", /* @__PURE__ */ React21.createElement(Link6, { href: buildPath("/terms"), className: "font-semibold text-primary hover:opacity-70" }, "Terms of Service"), " ", "and", " ", /* @__PURE__ */ React21.createElement(
10226
+ Link6,
10227
10227
  {
10228
10228
  href: buildPath("/privacy"),
10229
10229
  className: "font-semibold text-primary hover:opacity-70"
@@ -10239,191 +10239,29 @@ function RegisterScreen() {
10239
10239
  },
10240
10240
  isSubmitting ? "Creating account..." : "Create my account"
10241
10241
  )
10242
- ), /* @__PURE__ */ React21.createElement("div", { className: "mt-4" }, /* @__PURE__ */ React21.createElement("p", { className: "text-muted" }, "Already have an account? ", /* @__PURE__ */ React21.createElement(Link7, { href: buildPath("/login"), className: "font-medium text-primary transition hover:opacity-90" }, "Sign in"))))
10242
+ ), /* @__PURE__ */ React21.createElement("div", { className: "mt-4" }, /* @__PURE__ */ React21.createElement("p", { className: "text-muted" }, "Already have an account? ", /* @__PURE__ */ React21.createElement(Link6, { href: buildPath("/login"), className: "font-medium text-primary transition hover:opacity-90" }, "Sign in"))))
10243
10243
  )));
10244
10244
  }
10245
- function ProfileScreen() {
10246
- const router = useRouter();
10247
- const { user, logout, isLoading } = useAuth();
10248
- const { buildPath } = useBasePath();
10249
- const [isLoggingOut, setIsLoggingOut] = useState(false);
10250
- const [logoutError, setLogoutError] = useState(null);
10251
- const handleLogout = async () => {
10252
- setIsLoggingOut(true);
10253
- setLogoutError(null);
10254
- try {
10255
- await logout();
10256
- router.push(buildPath("/"));
10257
- } catch (error) {
10258
- setLogoutError(error?.response?.data?.message || "Failed to logout. Please try again.");
10259
- } finally {
10260
- setIsLoggingOut(false);
10261
- }
10262
- };
10263
- if (!user) {
10264
- if (isLoading) return null;
10265
- router.push(buildPath("/login"));
10266
- return null;
10267
- }
10268
- const quickLinks = [
10269
- {
10270
- icon: Package,
10271
- label: "Orders & invoices",
10272
- description: "Track shipments, invoices, and receipts",
10273
- href: buildPath("/orders")
10274
- },
10275
- {
10276
- icon: Heart,
10277
- label: "Wishlist",
10278
- description: "Curate go-to remedies and favorites",
10279
- href: buildPath("/wishlist")
10280
- },
10281
- {
10282
- icon: MapPin,
10283
- label: "Delivery addresses",
10284
- description: "Manage saved delivery locations",
10285
- href: buildPath("/account/addresses")
10286
- }
10287
- ];
10288
- return /* @__PURE__ */ React21.createElement("div", { className: "min-h-screen bg-slate-50 text-slate-900" }, /* @__PURE__ */ React21.createElement("div", { className: "relative container mx-auto px-4 pb-16 pt-10" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-3xl border border-slate-200 bg-white/95 p-8 shadow-xl shadow-primary-50 backdrop-blur" }, /* @__PURE__ */ React21.createElement("div", { className: "mb-6 flex flex-wrap items-center justify-between gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "text-sm text-slate-500" }, "Stay signed in to keep prescriptions and deliveries synced."), /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, logoutError && /* @__PURE__ */ React21.createElement("div", { className: "flex items-start gap-2 rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700" }, /* @__PURE__ */ React21.createElement(ShieldCheck, { className: "mt-[1px] h-4 w-4 text-red-500" }), /* @__PURE__ */ React21.createElement("span", null, logoutError)), /* @__PURE__ */ React21.createElement(
10289
- Button,
10290
- {
10291
- type: "button",
10292
- variant: "outline",
10293
- size: "sm",
10294
- className: "border-red-200 text-red-600 hover:bg-red-50",
10295
- onClick: handleLogout,
10296
- disabled: isLoggingOut
10297
- },
10298
- /* @__PURE__ */ React21.createElement(LogOut, { className: "h-4 w-4" }),
10299
- isLoggingOut ? "Logging out..." : "Log out"
10300
- ))), /* @__PURE__ */ React21.createElement(
10301
- motion.div,
10302
- {
10303
- initial: { opacity: 0, y: 18 },
10304
- animate: { opacity: 1, y: 0 },
10305
- className: "grid gap-8 md:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)] md:items-center"
10306
- },
10307
- /* @__PURE__ */ React21.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ React21.createElement("div", { className: "inline-flex items-center gap-2 rounded-full bg-slate-900 text-white px-4 py-1 text-xs font-semibold uppercase tracking-[0.32em]" }, /* @__PURE__ */ React21.createElement(HeartPulse, { className: "h-4 w-4" }), "Account"), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("h1", { className: "text-4xl font-semibold md:text-5xl" }, "Welcome back, ", user.firstname, " ", user.lastname), /* @__PURE__ */ React21.createElement("p", { className: "mt-3 max-w-2xl text-base text-slate-600" }, "Keep your identity and delivery details accurate for smoother refills, faster shipping, and timely pharmacist guidance.")), /* @__PURE__ */ React21.createElement("div", { className: "flex flex-wrap gap-3 text-sm text-slate-600" }, /* @__PURE__ */ React21.createElement("span", { className: "inline-flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 px-3 py-2" }, /* @__PURE__ */ React21.createElement(ShieldCheck, { className: "h-4 w-4 text-primary-600" }), "Secure login enabled"), /* @__PURE__ */ React21.createElement("span", { className: "inline-flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 px-3 py-2" }, /* @__PURE__ */ React21.createElement(Mail, { className: "h-4 w-4 text-primary-600" }), user.email), /* @__PURE__ */ React21.createElement("span", { className: "inline-flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 px-3 py-2" }, /* @__PURE__ */ React21.createElement(Phone, { className: "h-4 w-4 text-primary-600" }), user.phoneNumber || "Add phone for urgent updates"))),
10308
- /* @__PURE__ */ React21.createElement("div", { className: "flex flex-col gap-4 rounded-2xl border border-slate-200 bg-slate-50/70 p-6 shadow-sm" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React21.createElement("div", { className: "flex h-16 w-16 items-center justify-center rounded-2xl bg-white text-2xl font-semibold text-slate-900 shadow-sm" }, getInitials(user?.firstname || "", user?.lastname || "") || ""), /* @__PURE__ */ React21.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-slate-500" }, "Signed in as"), /* @__PURE__ */ React21.createElement("p", { className: "text-lg font-semibold text-slate-900" }, user.firstname), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-slate-500" }, user.email))), /* @__PURE__ */ React21.createElement("div", { className: "grid gap-3 sm:grid-cols-2" }, /* @__PURE__ */ React21.createElement(
10309
- Button,
10310
- {
10311
- variant: "outline",
10312
- size: "md",
10313
- className: "border-slate-300 text-slate-800 hover:bg-white",
10314
- onClick: () => router.push(buildPath("/account/edit"))
10315
- },
10316
- "Edit profile"
10317
- ), /* @__PURE__ */ React21.createElement(
10318
- Button,
10319
- {
10320
- variant: "ghost",
10321
- size: "md",
10322
- className: "text-slate-700 hover:bg-white",
10323
- onClick: () => router.push(buildPath("/account/change-password"))
10324
- },
10325
- "Change password"
10326
- )))
10327
- )), /* @__PURE__ */ React21.createElement("div", { className: "mt-10 grid gap-8 lg:grid-cols-[minmax(0,1.08fr)_minmax(0,0.92fr)] items-stretch" }, /* @__PURE__ */ React21.createElement(
10328
- motion.div,
10329
- {
10330
- initial: { opacity: 0, y: 18 },
10331
- animate: { opacity: 1, y: 0 },
10332
- className: "space-y-6"
10333
- },
10334
- /* @__PURE__ */ React21.createElement("section", { className: "rounded-3xl border border-slate-200 bg-white p-7 shadow-lg shadow-primary-50/40 min-h-[420px] h-full flex flex-col" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between gap-3" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-xs font-semibold uppercase tracking-[0.3em] text-slate-400" }, "Essentials"), /* @__PURE__ */ React21.createElement("h2", { className: "mt-1 text-xl font-semibold text-slate-900" }, "Profile snapshot")), /* @__PURE__ */ React21.createElement(Sparkles, { className: "h-5 w-5 text-primary-500" })), /* @__PURE__ */ React21.createElement("div", { className: "mt-6 grid gap-4 md:grid-cols-2" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-2xl border border-slate-200 bg-slate-50/70 p-5" }, /* @__PURE__ */ React21.createElement("p", { className: "text-xs font-semibold uppercase tracking-[0.28em] text-slate-500" }, "Contact"), /* @__PURE__ */ React21.createElement("div", { className: "mt-3 space-y-2 text-sm text-slate-600" }, /* @__PURE__ */ React21.createElement("p", { className: "flex items-center gap-2 font-semibold text-slate-900" }, /* @__PURE__ */ React21.createElement(User, { className: "h-4 w-4 text-primary-500" }), user.firstname, " ", user.lastname), /* @__PURE__ */ React21.createElement("p", { className: "flex items-center gap-2" }, /* @__PURE__ */ React21.createElement(Mail, { className: "h-4 w-4 text-primary-500" }), user.email), /* @__PURE__ */ React21.createElement("p", { className: "flex items-center gap-2" }, /* @__PURE__ */ React21.createElement(Phone, { className: "h-4 w-4 text-primary-500" }), user.phoneNumber || "Not provided")), /* @__PURE__ */ React21.createElement(
10335
- Button,
10336
- {
10337
- variant: "outline",
10338
- size: "md",
10339
- className: "mt-4 w-full border-slate-300 text-slate-800 hover:bg-white",
10340
- onClick: () => router.push(buildPath("/account/edit"))
10341
- },
10342
- "Update information"
10343
- )), /* @__PURE__ */ React21.createElement("div", { className: "rounded-2xl border border-slate-200 bg-slate-50/70 p-5" }, /* @__PURE__ */ React21.createElement("p", { className: "text-xs font-semibold uppercase tracking-[0.28em] text-slate-500" }, "Security"), /* @__PURE__ */ React21.createElement("div", { className: "mt-3 space-y-2 text-sm text-slate-600" }, /* @__PURE__ */ React21.createElement("p", { className: "flex items-center gap-2 font-semibold text-slate-900" }, /* @__PURE__ */ React21.createElement(ShieldCheck, { className: "h-4 w-4 text-primary-500" }), "Multi-factor ready"), /* @__PURE__ */ React21.createElement("p", null, "Protect your account with a fresh password and keep notifications on.")), /* @__PURE__ */ React21.createElement(
10344
- Button,
10345
- {
10346
- variant: "primary",
10347
- size: "md",
10348
- className: "mt-4 w-full",
10349
- onClick: () => router.push(buildPath("/account/change-password"))
10350
- },
10351
- "Change password"
10352
- ))))
10353
- ), /* @__PURE__ */ React21.createElement(
10354
- motion.aside,
10355
- {
10356
- initial: { opacity: 0, y: 18 },
10357
- animate: { opacity: 1, y: 0 },
10358
- transition: { delay: 0.05 },
10359
- className: "space-y-4 h-full"
10360
- },
10361
- /* @__PURE__ */ React21.createElement("section", { className: "rounded-3xl border border-slate-200 bg-white p-6 shadow-sm min-h-[420px] h-full flex flex-col" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-xs font-semibold uppercase tracking-[0.3em] text-slate-400" }, "Quick links"), /* @__PURE__ */ React21.createElement("h3", { className: "mt-1 text-lg font-semibold text-slate-900" }, "Next steps")), /* @__PURE__ */ React21.createElement(Heart, { className: "h-5 w-5 text-primary-500" })), /* @__PURE__ */ React21.createElement("div", { className: "mt-5 grid gap-3" }, quickLinks.map((item) => /* @__PURE__ */ React21.createElement(
10362
- Link7,
10363
- {
10364
- key: item.href,
10365
- href: item.href,
10366
- className: "group relative flex items-start gap-3 rounded-2xl border border-slate-200 bg-slate-50/70 p-4 transition duration-200 hover:-translate-y-0.5 hover:border-primary-200 hover:bg-white hover:shadow-md"
10367
- },
10368
- /* @__PURE__ */ React21.createElement("span", { className: "flex h-11 w-11 items-center justify-center rounded-xl bg-white text-primary-600 shadow-sm group-hover:bg-primary-600 group-hover:text-white" }, /* @__PURE__ */ React21.createElement(item.icon, { className: "h-5 w-5" })),
10369
- /* @__PURE__ */ React21.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React21.createElement("p", { className: "flex items-center gap-2 text-base font-semibold text-slate-900 group-hover:text-primary-700" }, item.label, /* @__PURE__ */ React21.createElement(ArrowRight, { className: "h-4 w-4 opacity-0 transition group-hover:opacity-100" })), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-slate-500" }, item.description))
10370
- ))))
10371
- ))));
10372
- }
10373
- function Badge({ children, variant = "primary", size = "md", className = "" }) {
10374
- const variants = {
10375
- primary: "bg-primary-100 text-primary-700 border-primary-200",
10376
- secondary: "bg-secondary-100 text-secondary-700 border-secondary-200",
10377
- success: "bg-green-100 text-green-700 border-green-200",
10378
- warning: "bg-yellow-100 text-yellow-700 border-yellow-200",
10379
- danger: "bg-red-100 text-red-700 border-red-200",
10380
- gray: "bg-gray-100 text-gray-700 border-gray-200"
10381
- };
10382
- const sizes = {
10383
- sm: "px-2 py-1 text-xs",
10384
- md: "px-3 py-1 text-sm"
10385
- };
10386
- return /* @__PURE__ */ React21.createElement("span", { className: `inline-flex items-center font-medium rounded-full border ${variants[variant]} ${sizes[size]} ${className}` }, children);
10387
- }
10388
- function OrderCard({ order }) {
10389
- const config = order.orderStatus;
10390
- const itemCount = order.items?.length || 0;
10391
- const showPriceBreakdown = order.shippingCost && order.shippingCost > 0 || order.tax && order.tax > 0 || order.discountedAmount && order.discountedAmount > 0;
10392
- return /* @__PURE__ */ React21.createElement(
10393
- motion.div,
10394
- {
10395
- initial: { opacity: 0, y: 20 },
10396
- animate: { opacity: 1, y: 0 },
10397
- className: "rounded-lg border border-slate-200 bg-white p-4 shadow-sm hover:shadow-md transition-shadow"
10398
- },
10399
- /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between mb-4 pb-4 border-b border-gray-200" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("h3", { className: "text-base font-bold text-slate-900" }, "Order #", order?._id?.slice(0, 8) || ""), /* @__PURE__ */ React21.createElement(Badge, { variant: config }, config), /* @__PURE__ */ React21.createElement("span", { className: "text-xs text-gray-500" }, formatDate(order.createdAt || /* @__PURE__ */ new Date(), "short"))), /* @__PURE__ */ React21.createElement("div", { className: "text-right" }, /* @__PURE__ */ React21.createElement("p", { className: "text-lg font-bold text-slate-900" }, formatPrice(order.grandTotal || 0)), itemCount > 0 && /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-gray-500" }, itemCount, " ", itemCount === 1 ? "item" : "items"))),
10400
- /* @__PURE__ */ React21.createElement("div", { className: "space-y-2 mb-4" }, order.items && order.items.length > 0 ? order.items.slice(0, 3).map((item) => {
10401
- const itemPrice = item.productVariantData?.finalPrice || 0;
10402
- const itemTotal = itemPrice * item.quantity;
10403
- return /* @__PURE__ */ React21.createElement("div", { key: item.productVariantId || item._id, className: "flex items-center gap-2 text-sm" }, /* @__PURE__ */ React21.createElement("div", { className: "relative w-12 h-12 rounded bg-gray-100 flex-shrink-0 overflow-hidden" }, /* @__PURE__ */ React21.createElement(
10404
- Image4,
10405
- {
10406
- src: item?.productVariantData?.productMedia?.[0]?.file || "/placeholder-product.jpg",
10407
- alt: item?.productVariantData?.name || "Product image",
10408
- fill: true,
10409
- className: "object-cover",
10410
- sizes: "48px"
10411
- }
10412
- )), /* @__PURE__ */ React21.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React21.createElement("p", { className: "font-medium text-slate-900 truncate text-sm" }, item.productVariantData?.name || "Unknown Product"), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-gray-500" }, "Qty: ", item.quantity)), /* @__PURE__ */ React21.createElement("p", { className: "font-semibold text-slate-900 text-sm" }, formatPrice(itemTotal)));
10413
- }) : /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-gray-500 text-center py-2" }, "No items found"), order.items && order.items.length > 3 && /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-gray-500 text-center pt-1" }, "+", order.items.length - 3, " more ", order.items.length - 3 === 1 ? "item" : "items")),
10414
- showPriceBreakdown && /* @__PURE__ */ React21.createElement("div", { className: "mb-4 pb-4 border-b border-gray-200 space-y-1 text-xs" }, order.shippingCost !== void 0 && order.shippingCost > 0 && /* @__PURE__ */ React21.createElement("div", { className: "flex justify-between text-gray-600" }, /* @__PURE__ */ React21.createElement("span", null, "Shipping"), /* @__PURE__ */ React21.createElement("span", null, formatPrice(order.shippingCost))), order.tax !== void 0 && order.tax > 0 && /* @__PURE__ */ React21.createElement("div", { className: "flex justify-between text-gray-600" }, /* @__PURE__ */ React21.createElement("span", null, "Tax"), /* @__PURE__ */ React21.createElement("span", null, formatPrice(order.tax))), order.discountedAmount !== void 0 && order.discountedAmount > 0 && /* @__PURE__ */ React21.createElement("div", { className: "flex justify-between text-green-600" }, /* @__PURE__ */ React21.createElement("span", null, "Discount"), /* @__PURE__ */ React21.createElement("span", null, "-", formatPrice(order.discountedAmount)))),
10415
- order.payment?.paymentStatus !== "Paid" /* Paid */ && order.payment?.paymentMethod === "Card" /* Card */ && /* @__PURE__ */ React21.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ React21.createElement(
10245
+ function TabNavigation({ tabs: tabs2, activeTab, onTabChange }) {
10246
+ return /* @__PURE__ */ React21.createElement("div", { className: "mx-auto flex items-center max-w-7xl px-4 py-4" }, /* @__PURE__ */ React21.createElement("nav", { className: "flex overflow-x-auto scrollbar-hide justify-center gap-4", "aria-label": "Account tabs" }, tabs2.map((tab) => {
10247
+ const isActive = activeTab === tab.id;
10248
+ const Icon = tab.icon;
10249
+ return /* @__PURE__ */ React21.createElement(
10416
10250
  "button",
10417
10251
  {
10418
- onClick: () => {
10419
- window.open(order?.payment?.hostedInvoiceUrl || "", "_blank");
10420
- },
10421
- className: "inline-flex items-center gap-2 rounded-full border-2 border-primary-500 bg-primary-500 hover:bg-primary-600 text-white px-4 py-2 text-sm font-medium transition-colors"
10252
+ key: tab.id,
10253
+ onClick: () => onTabChange(tab.id),
10254
+ className: `
10255
+ flex items-center gap-2 px-6 py-3 text-sm font-medium whitespace-nowrap
10256
+ border-b-2 transition-colors
10257
+ ${isActive ? "bg-secondary text-white rounded-xl hover:transition-all hover:duration-300 hover:ease-in-out hover:-translate-y-1" : "bg-white text-muted rounded-xl hover:text-secondary hover:transition-all hover:duration-150 hover:ease-in-out hover:-translate-y-1"}
10258
+ `,
10259
+ "aria-current": isActive ? "page" : void 0
10422
10260
  },
10423
- /* @__PURE__ */ React21.createElement(CreditCard, { className: "w-4 h-4" }),
10424
- "Pay Now"
10425
- ))
10426
- );
10261
+ /* @__PURE__ */ React21.createElement(Icon, { className: "h-5 w-5" }),
10262
+ tab.label
10263
+ );
10264
+ })));
10427
10265
  }
10428
10266
  function useOrders(page = 1, limit = 10, orderStatus, paymentStatus) {
10429
10267
  const [orders, setOrders] = useState([]);
@@ -10520,6 +10358,552 @@ function useCurrentOrders() {
10520
10358
  }, [fetchCurrentOrders]);
10521
10359
  return { orders, isLoading, error, refetch: fetchCurrentOrders };
10522
10360
  }
10361
+ function Badge({ children, variant = "primary", size = "md", className = "" }) {
10362
+ const variants = {
10363
+ primary: "bg-primary-100 text-primary-700 border-primary-200",
10364
+ secondary: "bg-secondary-100 text-secondary-700 border-secondary-200",
10365
+ success: "bg-green-100 text-green-700 border-green-200",
10366
+ warning: "bg-yellow-100 text-yellow-700 border-yellow-200",
10367
+ danger: "bg-red-100 text-red-700 border-red-200",
10368
+ gray: "bg-gray-100 text-gray-700 border-gray-200"
10369
+ };
10370
+ const sizes = {
10371
+ sm: "px-2 py-1 text-xs",
10372
+ md: "px-3 py-1 text-sm"
10373
+ };
10374
+ return /* @__PURE__ */ React21.createElement("span", { className: `inline-flex items-center font-medium rounded-full border ${variants[variant]} ${sizes[size]} ${className}` }, children);
10375
+ }
10376
+ function AccountOverviewTab() {
10377
+ const { user } = useAuth();
10378
+ const { orders, isLoading: ordersLoading } = useCurrentOrders();
10379
+ const { getWishlistCount } = useWishlist();
10380
+ const router = useRouter();
10381
+ const { buildPath } = useBasePath();
10382
+ if (!user) return null;
10383
+ const totalOrders = orders?.length || 0;
10384
+ const deliveredOrders = orders?.filter((order) => order.orderStatus === "Delivered")?.length || 0;
10385
+ const inTransitOrders = orders?.filter((order) => order.orderStatus === "In Transit")?.length || 0;
10386
+ const savedItemsCount = getWishlistCount();
10387
+ const recentOrders = orders?.slice(0, 3) || [];
10388
+ const stats = [
10389
+ {
10390
+ icon: Package,
10391
+ label: "Total Orders",
10392
+ value: totalOrders,
10393
+ color: "bg-[#DBEAFE] text-[#5B9BD5]"
10394
+ },
10395
+ {
10396
+ icon: CheckCircle,
10397
+ label: "Delivered",
10398
+ value: deliveredOrders,
10399
+ color: "bg-[#DCFCE7] text-[#00A63E]"
10400
+ },
10401
+ {
10402
+ icon: Heart,
10403
+ label: "Saved Items",
10404
+ value: savedItemsCount,
10405
+ color: "bg-[#FFEDD4] text-[#FF6B35]"
10406
+ },
10407
+ {
10408
+ icon: Clock,
10409
+ label: "In Transit",
10410
+ value: inTransitOrders,
10411
+ color: "bg-[#F3E8FF] text-[#9810FA]"
10412
+ }
10413
+ ];
10414
+ return /* @__PURE__ */ React21.createElement("div", { className: "py-6 px-3 space-y-6 pb-24" }, /* @__PURE__ */ React21.createElement("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4" }, stats.map((stat, index) => {
10415
+ const Icon = stat.icon;
10416
+ return /* @__PURE__ */ React21.createElement(
10417
+ "div",
10418
+ {
10419
+ key: index,
10420
+ className: "rounded-xl border border-slate-200 bg-white p-4 hover:shadow-md transition-shadow"
10421
+ },
10422
+ /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: `flex h-12 w-12 items-center justify-center rounded-lg ${stat.color}` }, /* @__PURE__ */ React21.createElement(Icon, { className: "h-6 w-6" })), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-2xl font-bold text-secondary" }, stat.value), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-slate-600" }, stat.label)))
10423
+ );
10424
+ })), /* @__PURE__ */ React21.createElement("div", { className: "rounded-xl border border-slate-200 bg-white p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between mb-4" }, /* @__PURE__ */ React21.createElement("h3", { className: "text-lg font-semibold text-secondary" }, "Profile Information"), /* @__PURE__ */ React21.createElement(
10425
+ "button",
10426
+ {
10427
+ onClick: () => router.push(buildPath("/account/edit")),
10428
+ className: "flex items-center gap-1 text-sm text-primary-600 hover:text-primary-700"
10429
+ },
10430
+ /* @__PURE__ */ React21.createElement(Edit, { className: "h-4 w-4" }),
10431
+ "Edit"
10432
+ )), /* @__PURE__ */ React21.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-[#DBEAFE]" }, /* @__PURE__ */ React21.createElement(User, { className: "h-5 w-5 text-[#5B9BD5]" })), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "Full Name"), /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, user.firstname, " ", user.lastname))), /* @__PURE__ */ React21.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-[#DBEAFE]" }, /* @__PURE__ */ React21.createElement(Mail, { className: "h-5 w-5 text-[#5B9BD5]" })), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "E-mail Address"), /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, user.email))), /* @__PURE__ */ React21.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-[#DBEAFE]" }, /* @__PURE__ */ React21.createElement(Phone, { className: "h-5 w-5 text-[#5B9BD5]" })), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "Phone Number"), /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, user.phoneNumber || "Not provided"))), /* @__PURE__ */ React21.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-[#DBEAFE]" }, /* @__PURE__ */ React21.createElement(MapPin, { className: "h-5 w-5 text-[#5B9BD5]" })), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "Date of Birth"), /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, "Not provided"))))), /* @__PURE__ */ React21.createElement("div", { className: "rounded-xl border border-slate-200 bg-white p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between mb-4" }, /* @__PURE__ */ React21.createElement("h3", { className: "text-lg font-semibold text-secondary" }, "Recent Orders"), /* @__PURE__ */ React21.createElement(
10433
+ "button",
10434
+ {
10435
+ onClick: () => {
10436
+ const event = new CustomEvent("switchTab", { detail: "orders" });
10437
+ window.dispatchEvent(event);
10438
+ },
10439
+ className: "text-sm text-primary-600 hover:text-primary-700"
10440
+ },
10441
+ "View All \u2192"
10442
+ )), ordersLoading ? /* @__PURE__ */ React21.createElement("div", { className: "space-y-3" }, Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ React21.createElement(
10443
+ "div",
10444
+ {
10445
+ key: index,
10446
+ className: "h-16 animate-pulse rounded-lg bg-slate-50"
10447
+ }
10448
+ ))) : recentOrders.length === 0 ? /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-muted text-center py-8" }, "No orders yet") : /* @__PURE__ */ React21.createElement("div", { className: "space-y-3" }, recentOrders.map((order) => /* @__PURE__ */ React21.createElement(
10449
+ "div",
10450
+ {
10451
+ key: order._id,
10452
+ className: "flex items-center justify-between rounded-lg bg-slate-50 p-4 hover:bg-slate-100 transition-colors"
10453
+ },
10454
+ /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-white" }, /* @__PURE__ */ React21.createElement(Package, { className: "h-5 w-5 text-slate-600" })), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, "ORD-", order._id?.slice(-6).toUpperCase()), /* @__PURE__ */ React21.createElement(
10455
+ Badge,
10456
+ {
10457
+ className: "p-1 text-xs",
10458
+ variant: order.orderStatus === "Delivered" ? "success" : order.orderStatus === "In Transit" ? "primary" : order.orderStatus === "Pending" ? "warning" : "gray"
10459
+ },
10460
+ order.orderStatus
10461
+ )), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, formatDate(order.createdAt || /* @__PURE__ */ new Date(), "short")))),
10462
+ /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-semibold text-secondary" }, formatPrice(order.grandTotal || 0)))
10463
+ )))));
10464
+ }
10465
+ function AccountOrdersTab() {
10466
+ const { orders, isLoading, error } = useCurrentOrders();
10467
+ if (isLoading) {
10468
+ return /* @__PURE__ */ React21.createElement("div", { className: "py-6 px-3 pb-24" }, /* @__PURE__ */ React21.createElement("div", { className: "space-y-4" }, Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ React21.createElement(
10469
+ "div",
10470
+ {
10471
+ key: index,
10472
+ className: "h-64 animate-pulse rounded-xl bg-slate-50"
10473
+ }
10474
+ ))));
10475
+ }
10476
+ if (error) {
10477
+ return /* @__PURE__ */ React21.createElement("div", { className: "py-6 px-3 pb-24" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-lg border border-red-100 bg-red-50 p-6 text-sm text-red-700" }, error.message));
10478
+ }
10479
+ if (orders.length === 0) {
10480
+ return /* @__PURE__ */ React21.createElement("div", { className: "py-6 px-3 pb-24" }, /* @__PURE__ */ React21.createElement(
10481
+ EmptyState,
10482
+ {
10483
+ icon: Package,
10484
+ title: "No orders yet",
10485
+ description: "When you place orders, they'll appear here for easy tracking."
10486
+ }
10487
+ ));
10488
+ }
10489
+ return /* @__PURE__ */ React21.createElement("div", { className: "py-6 px-3 space-y-4 pb-24" }, orders.map((order) => {
10490
+ order.items?.length || 0;
10491
+ return /* @__PURE__ */ React21.createElement(
10492
+ "div",
10493
+ {
10494
+ key: order._id,
10495
+ className: "rounded-xl border border-slate-200 bg-white p-6 hover:shadow-md transition-shadow"
10496
+ },
10497
+ /* @__PURE__ */ React21.createElement("div", { className: "flex items-start justify-between mb-4 pb-4 border-b border-slate-200" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("h3", { className: "text-base font-semibold text-secondary" }, "Order ORD-", order._id?.slice(-6).toUpperCase()), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted mb-4" }, "Placed on ", formatDate(order.createdAt || /* @__PURE__ */ new Date(), "long"))), /* @__PURE__ */ React21.createElement(
10498
+ Badge,
10499
+ {
10500
+ className: "text-xs",
10501
+ variant: order.orderStatus === "Delivered" ? "success" : order.orderStatus === "In Transit" ? "primary" : order.orderStatus === "Pending" ? "warning" : "gray"
10502
+ },
10503
+ order.orderStatus
10504
+ )), /* @__PURE__ */ React21.createElement("div", { className: "text-right" }, /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted mb-1" }, "Total Amount"), /* @__PURE__ */ React21.createElement("p", { className: "text-lg font-bold text-secondary" }, formatPrice(order.grandTotal || 0)))),
10505
+ /* @__PURE__ */ React21.createElement("div", { className: "space-y-3 mb-4" }, order.items && order.items.length > 0 ? order.items.map((item, index) => {
10506
+ const itemPrice = item.productVariantData?.finalPrice || 0;
10507
+ const itemTotal = itemPrice * item.quantity;
10508
+ return /* @__PURE__ */ React21.createElement("div", { key: item.productVariantId || index, className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 flex-shrink-0 overflow-hidden" }, /* @__PURE__ */ React21.createElement(
10509
+ Image4,
10510
+ {
10511
+ src: item?.productVariantData?.productMedia?.[0]?.file || "/placeholder-product.jpg",
10512
+ alt: item?.productVariantData?.name || "Product image",
10513
+ fill: true,
10514
+ className: "object-cover",
10515
+ sizes: "48px"
10516
+ }
10517
+ )), /* @__PURE__ */ React21.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React21.createElement("p", { className: "font-medium text-secondary text-sm truncate" }, item.productVariantData?.name || "Unknown Product"), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "Qty: ", item.quantity)), /* @__PURE__ */ React21.createElement("p", { className: "font-semibold text-secondary text-sm" }, formatPrice(itemTotal)));
10518
+ }) : /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-muted text-center py-2" }, "No items found"))
10519
+ );
10520
+ }));
10521
+ }
10522
+ function useWishlistProducts(productIds = []) {
10523
+ const [products, setProducts] = useState([]);
10524
+ const [isLoading, setIsLoading] = useState(false);
10525
+ const [error, setError] = useState(null);
10526
+ const [cache] = useState(() => /* @__PURE__ */ new Map());
10527
+ const uniqueIds = useMemo(
10528
+ () => Array.from(new Set((productIds || []).filter(Boolean))),
10529
+ [productIds]
10530
+ );
10531
+ const fetchProducts = useCallback(async () => {
10532
+ if (uniqueIds.length === 0) {
10533
+ setProducts([]);
10534
+ setIsLoading(false);
10535
+ setError(null);
10536
+ return;
10537
+ }
10538
+ setIsLoading(true);
10539
+ setError(null);
10540
+ try {
10541
+ const api = new ProductsApi(AXIOS_CONFIG);
10542
+ const results = await Promise.all(
10543
+ uniqueIds.map(async (id) => {
10544
+ if (cache.has(id)) return cache.get(id);
10545
+ const response = await api.getSingleProduct(id?._id || id || "");
10546
+ const product = response.data;
10547
+ cache.set(id, product);
10548
+ return product;
10549
+ })
10550
+ );
10551
+ setProducts(results);
10552
+ } catch (err) {
10553
+ setError(err);
10554
+ console.error("Failed to load wishlist products", err);
10555
+ } finally {
10556
+ setIsLoading(false);
10557
+ }
10558
+ }, [cache, uniqueIds]);
10559
+ useEffect(() => {
10560
+ fetchProducts();
10561
+ }, [fetchProducts]);
10562
+ return {
10563
+ products,
10564
+ isLoading,
10565
+ error,
10566
+ refetch: fetchProducts
10567
+ };
10568
+ }
10569
+
10570
+ // src/components/AccountSavedItemsTab.tsx
10571
+ function AccountSavedItemsTab() {
10572
+ const { products: wishlistProductIds } = useWishlist();
10573
+ const { products: wishlistProducts, isLoading, error } = useWishlistProducts(
10574
+ wishlistProductIds
10575
+ );
10576
+ const products = wishlistProducts || [];
10577
+ console.log(products);
10578
+ if (isLoading) {
10579
+ return /* @__PURE__ */ React21.createElement("div", { className: "p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3" }, Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ React21.createElement(
10580
+ "div",
10581
+ {
10582
+ key: index,
10583
+ className: "h-80 animate-pulse rounded-lg border border-slate-100 bg-slate-50"
10584
+ }
10585
+ ))));
10586
+ }
10587
+ if (error) {
10588
+ return /* @__PURE__ */ React21.createElement("div", { className: "p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-lg border border-red-100 bg-red-50 p-6 text-sm text-red-700" }, error.message));
10589
+ }
10590
+ if (products.length === 0) {
10591
+ return /* @__PURE__ */ React21.createElement("div", { className: "p-6" }, /* @__PURE__ */ React21.createElement(
10592
+ EmptyState,
10593
+ {
10594
+ icon: Heart,
10595
+ title: "No saved items",
10596
+ description: "Items you save will appear here for easy access later."
10597
+ }
10598
+ ));
10599
+ }
10600
+ return /* @__PURE__ */ React21.createElement("div", { className: "pb-24 p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "p-6 bg-white rounded-xl" }, /* @__PURE__ */ React21.createElement("div", { className: "mb-4" }, /* @__PURE__ */ React21.createElement("h3", { className: "text-lg font-semibold text-secondary" }, "Saved for Later"), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-secondary" }, products.length, " ", products.length === 1 ? "item" : "items", " saved")), /* @__PURE__ */ React21.createElement("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3" }, products.map((product) => /* @__PURE__ */ React21.createElement(ProductCard, { key: product._id, product })))));
10601
+ }
10602
+ function ConfirmModal({
10603
+ isOpen,
10604
+ onClose,
10605
+ onConfirm,
10606
+ title,
10607
+ message,
10608
+ confirmText = "Confirm",
10609
+ cancelText = "Cancel",
10610
+ variant = "danger",
10611
+ isLoading = false
10612
+ }) {
10613
+ const handleConfirm = () => {
10614
+ onConfirm();
10615
+ };
10616
+ const variantStyles = {
10617
+ danger: {
10618
+ icon: "text-red-600 bg-red-100",
10619
+ button: "secondary"
10620
+ },
10621
+ warning: {
10622
+ icon: "text-amber-600 bg-amber-100",
10623
+ button: "primary"
10624
+ },
10625
+ info: {
10626
+ icon: "text-secondary bg-blue-100",
10627
+ button: "primary"
10628
+ }
10629
+ };
10630
+ const style = variantStyles[variant];
10631
+ return /* @__PURE__ */ React21.createElement(Modal, { isOpen, onClose, size: "sm" }, /* @__PURE__ */ React21.createElement("div", { className: "flex flex-col items-center text-center" }, /* @__PURE__ */ React21.createElement("div", { className: `w-12 h-12 rounded-full ${style.icon} flex items-center justify-center mb-4` }, /* @__PURE__ */ React21.createElement(AlertTriangle, { className: "w-6 h-6" })), /* @__PURE__ */ React21.createElement("h3", { className: "text-xl font-semibold text-secondary mb-2" }, title), /* @__PURE__ */ React21.createElement("p", { className: "text-muted mb-6" }, message), /* @__PURE__ */ React21.createElement("div", { className: "flex gap-3 w-full justify-center" }, /* @__PURE__ */ React21.createElement(
10632
+ "button",
10633
+ {
10634
+ className: "px-6 py-2 border border-slate-200 rounded-full text-slate-700 hover:bg-slate-100 transition-colors",
10635
+ onClick: onClose
10636
+ },
10637
+ cancelText
10638
+ ), /* @__PURE__ */ React21.createElement(
10639
+ "button",
10640
+ {
10641
+ className: "px-6 py-2 border border-red-600 rounded-full text-red-600 hover:bg-red-100 transition-colors bg-red-50",
10642
+ onClick: handleConfirm
10643
+ },
10644
+ confirmText
10645
+ ))));
10646
+ }
10647
+
10648
+ // src/components/AccountAddressesTab.tsx
10649
+ function AccountAddressesTab() {
10650
+ const { addresses, isLoading, error, removeAddress, markAsDefault, refresh } = useAddresses();
10651
+ const [deletingId, setDeletingId] = useState(null);
10652
+ const [editingAddress, setEditingAddress] = useState(void 0);
10653
+ const [isAddressModalOpen, setIsAddressModalOpen] = useState(false);
10654
+ const [selectedAddressId, setSelectedAddressId] = useState(null);
10655
+ const [addressToDelete, setAddressToDelete] = useState(null);
10656
+ const notification = useNotification();
10657
+ const handleConfirmDelete = async () => {
10658
+ if (!addressToDelete) return;
10659
+ setDeletingId(addressToDelete.id);
10660
+ try {
10661
+ await removeAddress(addressToDelete.id);
10662
+ if (selectedAddressId === addressToDelete.id) {
10663
+ setSelectedAddressId(null);
10664
+ }
10665
+ notification.success("Address deleted successfully");
10666
+ } catch (error2) {
10667
+ console.error("Failed to delete address:", error2);
10668
+ notification.error("Failed to delete address. Please try again.");
10669
+ } finally {
10670
+ setDeletingId(null);
10671
+ setAddressToDelete(null);
10672
+ }
10673
+ };
10674
+ if (isLoading) {
10675
+ return /* @__PURE__ */ React21.createElement("div", { className: "p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "grid gap-4 sm:grid-cols-2" }, Array.from({ length: 2 }).map((_, index) => /* @__PURE__ */ React21.createElement(
10676
+ "div",
10677
+ {
10678
+ key: index,
10679
+ className: "h-48 animate-pulse rounded-lg border border-slate-100 bg-slate-50"
10680
+ }
10681
+ ))));
10682
+ }
10683
+ if (error) {
10684
+ return /* @__PURE__ */ React21.createElement("div", { className: "p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-lg border border-red-100 bg-red-50 p-6 text-sm text-red-700" }, error.message));
10685
+ }
10686
+ return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement("div", { className: "p-6 bg-white rounded-xl" }, /* @__PURE__ */ React21.createElement("div", { className: "mb-6 flex items-center justify-between" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("h3", { className: "text-lg font-semibold text-secondary" }, "Saved Addresses"), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-muted" }, "Manage your delivery and billing addresses")), /* @__PURE__ */ React21.createElement(
10687
+ "button",
10688
+ {
10689
+ className: "flex flex-row items-center gap-2 px-6 py-2 border border-slate-200 rounded-xl text-slate-700 hover:opacity-80 transition-colors bg-secondary text-white text-sm",
10690
+ onClick: () => {
10691
+ setEditingAddress(void 0);
10692
+ setIsAddressModalOpen(true);
10693
+ }
10694
+ },
10695
+ /* @__PURE__ */ React21.createElement(Plus, { className: "h-4 w-4" }),
10696
+ "Add Address"
10697
+ )), addresses.length === 0 ? /* @__PURE__ */ React21.createElement(
10698
+ EmptyState,
10699
+ {
10700
+ icon: MapPin,
10701
+ title: "No addresses yet",
10702
+ description: "Save a shipping or billing address to speed through checkout.",
10703
+ actionLabel: "Add your first address",
10704
+ onAction: () => {
10705
+ setEditingAddress(void 0);
10706
+ setIsAddressModalOpen(true);
10707
+ }
10708
+ }
10709
+ ) : /* @__PURE__ */ React21.createElement("div", { className: "grid gap-4 sm:grid-cols-2" }, addresses.map((address) => /* @__PURE__ */ React21.createElement(
10710
+ "div",
10711
+ {
10712
+ key: address.id,
10713
+ className: "relative rounded-xl border border-slate-200 bg-white p-4 hover:shadow-md transition-shadow"
10714
+ },
10715
+ /* @__PURE__ */ React21.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React21.createElement("div", { className: "justify-between flex items-center" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-x-2" }, /* @__PURE__ */ React21.createElement(MapPin, { className: "h-4 w-4 text-secondary" }), /* @__PURE__ */ React21.createElement("p", { className: "font-semibold text-secondary" }, address.name), address.isDefault && /* @__PURE__ */ React21.createElement("span", { className: "inline-flex items-center gap-1 rounded-full bg-green-100 px-2 py-1 text-xs font-semibold text-green-700" }, "Default")), /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-x-2" }, /* @__PURE__ */ React21.createElement(
10716
+ "button",
10717
+ {
10718
+ onClick: () => {
10719
+ setEditingAddress(address);
10720
+ setIsAddressModalOpen(true);
10721
+ },
10722
+ className: "inline-flex items-center gap-1 rounded-full border border-slate-200 px-2 py-1 text-xs font-medium text-muted transition hover:border-primary-300 hover:text-primary-600"
10723
+ },
10724
+ /* @__PURE__ */ React21.createElement(Edit3, { className: "h-3 w-3" })
10725
+ ), /* @__PURE__ */ React21.createElement(
10726
+ "button",
10727
+ {
10728
+ onClick: () => setAddressToDelete(address),
10729
+ disabled: deletingId === address.id,
10730
+ className: "inline-flex items-center gap-1 rounded-full border border-red-200 px-2 py-1 text-xs font-semibold text-red-600 transition hover:border-red-300 hover:text-red-700 disabled:opacity-50"
10731
+ },
10732
+ /* @__PURE__ */ React21.createElement(Trash2, { className: "h-3 w-3" })
10733
+ ))), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-muted mt-1" }, address.street1, address.street2 && `, ${address.street2}`), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-muted" }, address.city, ", ", address.state, " ", address.zip), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-muted" }, address.country), address.phone && /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-slate-500 mt-1" }, address.phone))
10734
+ )))), /* @__PURE__ */ React21.createElement(
10735
+ AddressFormModal,
10736
+ {
10737
+ isOpen: isAddressModalOpen,
10738
+ onClose: () => setIsAddressModalOpen(false),
10739
+ initialAddress: editingAddress,
10740
+ onAddressAdded: () => {
10741
+ refresh();
10742
+ },
10743
+ onAddressUpdated: () => {
10744
+ refresh();
10745
+ }
10746
+ }
10747
+ ), /* @__PURE__ */ React21.createElement(
10748
+ ConfirmModal,
10749
+ {
10750
+ isOpen: !!addressToDelete,
10751
+ onClose: () => setAddressToDelete(null),
10752
+ onConfirm: handleConfirmDelete,
10753
+ title: "Delete Address",
10754
+ message: `Are you sure you want to delete ${addressToDelete?.name}'s address? This action cannot be undone.`,
10755
+ confirmText: "Delete",
10756
+ cancelText: "Cancel",
10757
+ variant: "danger",
10758
+ isLoading: deletingId === addressToDelete?.id
10759
+ }
10760
+ ));
10761
+ }
10762
+ function AccountSettingsTab() {
10763
+ const router = useRouter();
10764
+ const { buildPath } = useBasePath();
10765
+ const [emailNotifications, setEmailNotifications] = useState(true);
10766
+ const [orderUpdates, setOrderUpdates] = useState(true);
10767
+ const [promotionalEmails, setPromotionalEmails] = useState(false);
10768
+ return /* @__PURE__ */ React21.createElement("div", { className: "p-6 space-y-6" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-2xl border border-slate-200 bg-white p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-2 mb-4" }, /* @__PURE__ */ React21.createElement(Bell, { className: "h-5 w-5 text-secondary" }), /* @__PURE__ */ React21.createElement("h3", { className: "text-lg font-semibold text-secondary" }, "Account Preferences")), /* @__PURE__ */ React21.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ React21.createElement("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, "Email Notifications"), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "Receive updates about your orders")), /* @__PURE__ */ React21.createElement(
10769
+ "input",
10770
+ {
10771
+ type: "checkbox",
10772
+ checked: emailNotifications,
10773
+ onChange: (e) => setEmailNotifications(e.target.checked),
10774
+ className: "h-4 w-4 rounded border-primary-300 text-secondary focus:ring-primary-500"
10775
+ }
10776
+ )), /* @__PURE__ */ React21.createElement("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, "Order Updates"), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "Get notified about shipping status")), /* @__PURE__ */ React21.createElement(
10777
+ "input",
10778
+ {
10779
+ type: "checkbox",
10780
+ checked: orderUpdates,
10781
+ onChange: (e) => setOrderUpdates(e.target.checked),
10782
+ className: "h-4 w-4 rounded border-primary-300 text-secondary focus:ring-primary-500"
10783
+ }
10784
+ )), /* @__PURE__ */ React21.createElement("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, "Promotional Emails"), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "Receive special offers and discounts")), /* @__PURE__ */ React21.createElement(
10785
+ "input",
10786
+ {
10787
+ type: "checkbox",
10788
+ checked: promotionalEmails,
10789
+ onChange: (e) => setPromotionalEmails(e.target.checked),
10790
+ className: "h-4 w-4 rounded border-primary-300 text-secondary focus:ring-primary-500"
10791
+ }
10792
+ )))), /* @__PURE__ */ React21.createElement("div", { className: "rounded-2xl border border-slate-200 bg-white p-6" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-2 mb-4" }, /* @__PURE__ */ React21.createElement(Lock, { className: "h-5 w-5 text-secondary" }), /* @__PURE__ */ React21.createElement("h3", { className: "text-lg font-semibold text-secondary" }, "Security")), /* @__PURE__ */ React21.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between rounded-lg border border-slate-200 bg-slate-50 px-4 py-3" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary" }, "Change Password"), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-muted" }, "Update your account password")), /* @__PURE__ */ React21.createElement(
10793
+ Button,
10794
+ {
10795
+ variant: "outline",
10796
+ size: "sm",
10797
+ onClick: () => router.push(buildPath("/account/change-password"))
10798
+ },
10799
+ "Change"
10800
+ )), /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between rounded-lg border border-red-100 bg-red-50 px-4 py-3" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-red-900" }, "Delete Account"), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-red-600" }, "Permanently delete your account and data")), /* @__PURE__ */ React21.createElement(
10801
+ Button,
10802
+ {
10803
+ variant: "outline",
10804
+ size: "sm",
10805
+ className: "border-red-200 text-red-600 hover:bg-red-50",
10806
+ onClick: () => {
10807
+ if (confirm("Are you sure you want to delete your account? This action cannot be undone.")) {
10808
+ alert("Account deletion functionality coming soon");
10809
+ }
10810
+ }
10811
+ },
10812
+ /* @__PURE__ */ React21.createElement(Trash2, { className: "h-4 w-4" }),
10813
+ "Delete"
10814
+ )))));
10815
+ }
10816
+
10817
+ // src/screens/ProfileScreen.tsx
10818
+ var tabs = [
10819
+ { id: "overview", label: "Overview", icon: User },
10820
+ { id: "orders", label: "Orders", icon: Package },
10821
+ { id: "saved-items", label: "Saved Items", icon: Heart },
10822
+ // { id: 'payment', label: 'Payment', icon: CreditCard },
10823
+ { id: "addresses", label: "Addresses", icon: MapPin },
10824
+ { id: "settings", label: "Settings", icon: Settings }
10825
+ ];
10826
+ function AccountPage() {
10827
+ const router = useRouter();
10828
+ const { user, logout, isLoading } = useAuth();
10829
+ const { buildPath } = useBasePath();
10830
+ const [activeTab, setActiveTab] = useState("overview");
10831
+ const [isDropdownOpen, setIsDropdownOpen] = useState(false);
10832
+ const [isLoggingOut, setIsLoggingOut] = useState(false);
10833
+ React21.useEffect(() => {
10834
+ const handleTabSwitch = (event) => {
10835
+ setActiveTab(event.detail);
10836
+ };
10837
+ window.addEventListener("switchTab", handleTabSwitch);
10838
+ return () => {
10839
+ window.removeEventListener("switchTab", handleTabSwitch);
10840
+ };
10841
+ }, []);
10842
+ if (!user) {
10843
+ if (isLoading) return null;
10844
+ router.push(buildPath("/login"));
10845
+ return null;
10846
+ }
10847
+ const renderTabContent = () => {
10848
+ switch (activeTab) {
10849
+ case "overview":
10850
+ return /* @__PURE__ */ React21.createElement(AccountOverviewTab, null);
10851
+ case "orders":
10852
+ return /* @__PURE__ */ React21.createElement(AccountOrdersTab, null);
10853
+ case "saved-items":
10854
+ return /* @__PURE__ */ React21.createElement(AccountSavedItemsTab, null);
10855
+ // case 'payment':
10856
+ // return <AccountPaymentTab />;
10857
+ case "addresses":
10858
+ return /* @__PURE__ */ React21.createElement(AccountAddressesTab, null);
10859
+ case "settings":
10860
+ return /* @__PURE__ */ React21.createElement(AccountSettingsTab, null);
10861
+ default:
10862
+ return /* @__PURE__ */ React21.createElement(AccountOverviewTab, null);
10863
+ }
10864
+ };
10865
+ return /* @__PURE__ */ React21.createElement("div", { className: "min-h-screen bg-gradient-to-b from-[#F8FAFC] to-[#EBF4FB]" }, /* @__PURE__ */ React21.createElement("div", { className: "" }, /* @__PURE__ */ React21.createElement("div", { className: "container mx-auto px-4 py-4" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("h1", { className: "text-2xl font-semibold text-secondary" }, "My Account"), /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-muted" }, "Manage your profile, orders, and preferences"))))), /* @__PURE__ */ React21.createElement(TabNavigation, { tabs, activeTab, onTabChange: setActiveTab }), /* @__PURE__ */ React21.createElement("div", { className: "container mx-auto max-w-7xl" }, /* @__PURE__ */ React21.createElement("div", { className: "rounded-2xl shadow-sm" }, renderTabContent())));
10866
+ }
10867
+ function OrderCard({ order }) {
10868
+ const config = order.orderStatus;
10869
+ const itemCount = order.items?.length || 0;
10870
+ const showPriceBreakdown = order.shippingCost && order.shippingCost > 0 || order.tax && order.tax > 0 || order.discountedAmount && order.discountedAmount > 0;
10871
+ return /* @__PURE__ */ React21.createElement(
10872
+ motion.div,
10873
+ {
10874
+ initial: { opacity: 0, y: 20 },
10875
+ animate: { opacity: 1, y: 0 },
10876
+ className: "rounded-lg border border-slate-200 bg-white p-4 shadow-sm hover:shadow-md transition-shadow"
10877
+ },
10878
+ /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between mb-4 pb-4 border-b border-gray-200" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("h3", { className: "text-base font-bold text-slate-900" }, "Order #", order?._id?.slice(0, 8) || ""), /* @__PURE__ */ React21.createElement(Badge, { variant: config }, config), /* @__PURE__ */ React21.createElement("span", { className: "text-xs text-gray-500" }, formatDate(order.createdAt || /* @__PURE__ */ new Date(), "short"))), /* @__PURE__ */ React21.createElement("div", { className: "text-right" }, /* @__PURE__ */ React21.createElement("p", { className: "text-lg font-bold text-slate-900" }, formatPrice(order.grandTotal || 0)), itemCount > 0 && /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-gray-500" }, itemCount, " ", itemCount === 1 ? "item" : "items"))),
10879
+ /* @__PURE__ */ React21.createElement("div", { className: "space-y-2 mb-4" }, order.items && order.items.length > 0 ? order.items.slice(0, 3).map((item) => {
10880
+ const itemPrice = item.productVariantData?.finalPrice || 0;
10881
+ const itemTotal = itemPrice * item.quantity;
10882
+ return /* @__PURE__ */ React21.createElement("div", { key: item.productVariantId || item._id, className: "flex items-center gap-2 text-sm" }, /* @__PURE__ */ React21.createElement("div", { className: "relative w-12 h-12 rounded bg-gray-100 flex-shrink-0 overflow-hidden" }, /* @__PURE__ */ React21.createElement(
10883
+ Image4,
10884
+ {
10885
+ src: item?.productVariantData?.productMedia?.[0]?.file || "/placeholder-product.jpg",
10886
+ alt: item?.productVariantData?.name || "Product image",
10887
+ fill: true,
10888
+ className: "object-cover",
10889
+ sizes: "48px"
10890
+ }
10891
+ )), /* @__PURE__ */ React21.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React21.createElement("p", { className: "font-medium text-slate-900 truncate text-sm" }, item.productVariantData?.name || "Unknown Product"), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-gray-500" }, "Qty: ", item.quantity)), /* @__PURE__ */ React21.createElement("p", { className: "font-semibold text-slate-900 text-sm" }, formatPrice(itemTotal)));
10892
+ }) : /* @__PURE__ */ React21.createElement("p", { className: "text-sm text-gray-500 text-center py-2" }, "No items found"), order.items && order.items.length > 3 && /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-gray-500 text-center pt-1" }, "+", order.items.length - 3, " more ", order.items.length - 3 === 1 ? "item" : "items")),
10893
+ showPriceBreakdown && /* @__PURE__ */ React21.createElement("div", { className: "mb-4 pb-4 border-b border-gray-200 space-y-1 text-xs" }, order.shippingCost !== void 0 && order.shippingCost > 0 && /* @__PURE__ */ React21.createElement("div", { className: "flex justify-between text-gray-600" }, /* @__PURE__ */ React21.createElement("span", null, "Shipping"), /* @__PURE__ */ React21.createElement("span", null, formatPrice(order.shippingCost))), order.tax !== void 0 && order.tax > 0 && /* @__PURE__ */ React21.createElement("div", { className: "flex justify-between text-gray-600" }, /* @__PURE__ */ React21.createElement("span", null, "Tax"), /* @__PURE__ */ React21.createElement("span", null, formatPrice(order.tax))), order.discountedAmount !== void 0 && order.discountedAmount > 0 && /* @__PURE__ */ React21.createElement("div", { className: "flex justify-between text-green-600" }, /* @__PURE__ */ React21.createElement("span", null, "Discount"), /* @__PURE__ */ React21.createElement("span", null, "-", formatPrice(order.discountedAmount)))),
10894
+ order.payment?.paymentStatus !== "Paid" /* Paid */ && order.payment?.paymentMethod === "Card" /* Card */ && /* @__PURE__ */ React21.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ React21.createElement(
10895
+ "button",
10896
+ {
10897
+ onClick: () => {
10898
+ window.open(order?.payment?.hostedInvoiceUrl || "", "_blank");
10899
+ },
10900
+ className: "inline-flex items-center gap-2 rounded-full border-2 border-primary-500 bg-primary-500 hover:bg-primary-600 text-white px-4 py-2 text-sm font-medium transition-colors"
10901
+ },
10902
+ /* @__PURE__ */ React21.createElement(CreditCard, { className: "w-4 h-4" }),
10903
+ "Pay Now"
10904
+ ))
10905
+ );
10906
+ }
10523
10907
  function FilterChips({
10524
10908
  label,
10525
10909
  icon: Icon,
@@ -10741,7 +11125,7 @@ function CurrentOrdersScreen() {
10741
11125
  },
10742
11126
  /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-semibold uppercase tracking-[0.35em] text-white/70" }, "Quick actions"),
10743
11127
  /* @__PURE__ */ React21.createElement("div", { className: "mt-4 space-y-3 text-sm text-white/80" }, /* @__PURE__ */ React21.createElement(
10744
- Link7,
11128
+ Link6,
10745
11129
  {
10746
11130
  href: buildPath("/orders"),
10747
11131
  className: "flex items-center justify-between rounded-2xl bg-white/10 px-4 py-3 transition hover:bg-white/20"
@@ -11126,53 +11510,6 @@ You can add it back at any time.`
11126
11510
  ))), /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-end gap-3" }, /* @__PURE__ */ React21.createElement(Button, { type: "button", variant: "outline", onClick: closeModal }, "Cancel"), /* @__PURE__ */ React21.createElement(Button, { type: "submit", isLoading: isSubmitting }, editingAddress ? "Save changes" : "Save address")))
11127
11511
  ));
11128
11512
  }
11129
- function useWishlistProducts(productIds = []) {
11130
- const [products, setProducts] = useState([]);
11131
- const [isLoading, setIsLoading] = useState(false);
11132
- const [error, setError] = useState(null);
11133
- const [cache] = useState(() => /* @__PURE__ */ new Map());
11134
- const uniqueIds = useMemo(
11135
- () => Array.from(new Set((productIds || []).filter(Boolean))),
11136
- [productIds]
11137
- );
11138
- const fetchProducts = useCallback(async () => {
11139
- if (uniqueIds.length === 0) {
11140
- setProducts([]);
11141
- setIsLoading(false);
11142
- setError(null);
11143
- return;
11144
- }
11145
- setIsLoading(true);
11146
- setError(null);
11147
- try {
11148
- const api = new ProductsApi(AXIOS_CONFIG);
11149
- const results = await Promise.all(
11150
- uniqueIds.map(async (id) => {
11151
- if (cache.has(id)) return cache.get(id);
11152
- const response = await api.getSingleProduct(id?._id || id || "");
11153
- const product = response.data;
11154
- cache.set(id, product);
11155
- return product;
11156
- })
11157
- );
11158
- setProducts(results);
11159
- } catch (err) {
11160
- setError(err);
11161
- console.error("Failed to load wishlist products", err);
11162
- } finally {
11163
- setIsLoading(false);
11164
- }
11165
- }, [cache, uniqueIds]);
11166
- useEffect(() => {
11167
- fetchProducts();
11168
- }, [fetchProducts]);
11169
- return {
11170
- products,
11171
- isLoading,
11172
- error,
11173
- refetch: fetchProducts
11174
- };
11175
- }
11176
11513
  var SORT_OPTIONS = [
11177
11514
  { value: "featured", label: "Most loved" },
11178
11515
  { value: "price-low", label: "Price: Low to High" },
@@ -11518,7 +11855,7 @@ function SearchPage() {
11518
11855
  isFavorited: isInWishlist(product.id),
11519
11856
  onClickProduct: (p) => router.push(buildPath(`/products/${p.id}`))
11520
11857
  }
11521
- ))) : hasSearched ? /* @__PURE__ */ React.createElement("div", { className: "text-center py-12" }, /* @__PURE__ */ React.createElement("div", { className: "text-gray-500 text-lg mb-4" }, 'No products found for "', searchQuery, '"'), /* @__PURE__ */ React.createElement("p", { className: "text-gray-500 mb-6" }, "Try different keywords or check out our", " ", /* @__PURE__ */ React.createElement(Link7, { href: "/shop", className: "text-primary-600 hover:underline ml-1 font-medium" }, "featured products"))) : /* @__PURE__ */ React.createElement("div", { className: "text-center py-12" }, /* @__PURE__ */ React.createElement("p", { className: "text-gray-500" }, "Enter a search term to find products"))));
11858
+ ))) : hasSearched ? /* @__PURE__ */ React.createElement("div", { className: "text-center py-12" }, /* @__PURE__ */ React.createElement("div", { className: "text-gray-500 text-lg mb-4" }, 'No products found for "', searchQuery, '"'), /* @__PURE__ */ React.createElement("p", { className: "text-gray-500 mb-6" }, "Try different keywords or check out our", " ", /* @__PURE__ */ React.createElement(Link6, { href: "/shop", className: "text-primary-600 hover:underline ml-1 font-medium" }, "featured products"))) : /* @__PURE__ */ React.createElement("div", { className: "text-center py-12" }, /* @__PURE__ */ React.createElement("p", { className: "text-gray-500" }, "Enter a search term to find products"))));
11522
11859
  }
11523
11860
  function NewAddressPage() {
11524
11861
  const router = useRouter();
@@ -11692,7 +12029,7 @@ function Header() {
11692
12029
  const navLinks = [
11693
12030
  { href: buildPath("/shop"), label: "Shop" }
11694
12031
  ];
11695
- return /* @__PURE__ */ React21.createElement("header", { className: "sticky top-0 z-10 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-sm" }, /* @__PURE__ */ React21.createElement("div", { className: "container mx-auto px-4" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between h-20" }, /* @__PURE__ */ React21.createElement(Link7, { href: buildPath("/"), className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "relative w-12 h-12" }, /* @__PURE__ */ React21.createElement(
12032
+ return /* @__PURE__ */ React21.createElement("header", { className: "sticky top-0 z-10 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-sm" }, /* @__PURE__ */ React21.createElement("div", { className: "container mx-auto px-4" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center justify-between h-20" }, /* @__PURE__ */ React21.createElement(Link6, { href: buildPath("/"), className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement("div", { className: "relative w-12 h-12" }, /* @__PURE__ */ React21.createElement(
11696
12033
  Image4,
11697
12034
  {
11698
12035
  src: config.logo,
@@ -11701,7 +12038,7 @@ function Header() {
11701
12038
  className: "object-contain"
11702
12039
  }
11703
12040
  ))), /* @__PURE__ */ React21.createElement("nav", { className: "hidden lg:flex items-center gap-8" }, navLinks.map((link) => /* @__PURE__ */ React21.createElement(
11704
- Link7,
12041
+ Link6,
11705
12042
  {
11706
12043
  key: link.href,
11707
12044
  href: link.href,
@@ -11748,7 +12085,7 @@ function Header() {
11748
12085
  },
11749
12086
  /* @__PURE__ */ React21.createElement(X, { className: "w-4 h-4" })
11750
12087
  ))
11751
- ))), /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React21.createElement(Link7, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors" }, /* @__PURE__ */ React21.createElement(Heart, { className: "w-6 h-6" }), wishlistCount > 0 && /* @__PURE__ */ React21.createElement("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center" }, wishlistCount)), /* @__PURE__ */ React21.createElement(Link7, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors" }, /* @__PURE__ */ React21.createElement(ShoppingCart, { className: "w-6 h-6" }), cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ React21.createElement("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center" }, cart.cartBody?.items?.length) : null), isAuthenticated ? /* @__PURE__ */ React21.createElement("div", { className: "relative" }, /* @__PURE__ */ React21.createElement(
12088
+ ))), /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React21.createElement(Link6, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors" }, /* @__PURE__ */ React21.createElement(Heart, { className: "w-6 h-6" }), wishlistCount > 0 && /* @__PURE__ */ React21.createElement("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center" }, wishlistCount)), /* @__PURE__ */ React21.createElement(Link6, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors" }, /* @__PURE__ */ React21.createElement(ShoppingCart, { className: "w-6 h-6" }), cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ React21.createElement("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center" }, cart.cartBody?.items?.length) : null), isAuthenticated ? /* @__PURE__ */ React21.createElement("div", { className: "relative" }, /* @__PURE__ */ React21.createElement(
11752
12089
  "button",
11753
12090
  {
11754
12091
  onClick: () => setIsDropdownOpen(!isDropdownOpen),
@@ -11763,7 +12100,7 @@ function Header() {
11763
12100
  onClick: () => setIsDropdownOpen(false)
11764
12101
  }
11765
12102
  ), /* @__PURE__ */ React21.createElement("div", { className: "absolute right-0 top-full mt-2 w-56 rounded-lg border border-slate-200 bg-white shadow-lg z-20" }, /* @__PURE__ */ React21.createElement("div", { className: "p-2" }, /* @__PURE__ */ React21.createElement("div", { className: "px-3 py-2 border-b border-slate-200 mb-1" }, /* @__PURE__ */ React21.createElement("p", { className: "text-sm font-medium text-secondary truncate" }, user?.firstname, " ", user?.lastname), /* @__PURE__ */ React21.createElement("p", { className: "text-xs text-slate-500 truncate" }, user?.email)), /* @__PURE__ */ React21.createElement(
11766
- Link7,
12103
+ Link6,
11767
12104
  {
11768
12105
  href: buildPath("/account"),
11769
12106
  onClick: () => setIsDropdownOpen(false),
@@ -11781,7 +12118,7 @@ function Header() {
11781
12118
  /* @__PURE__ */ React21.createElement(LogOut, { className: "h-4 w-4" }),
11782
12119
  isLoggingOut ? "Signing out..." : "Sign Out"
11783
12120
  ))))) : /* @__PURE__ */ React21.createElement(
11784
- Link7,
12121
+ Link6,
11785
12122
  {
11786
12123
  href: buildPath("/login"),
11787
12124
  className: "hidden sm:block px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium"
@@ -11803,7 +12140,7 @@ function Header() {
11803
12140
  className: "lg:hidden overflow-hidden border-t border-gray-200"
11804
12141
  },
11805
12142
  /* @__PURE__ */ React21.createElement("nav", { className: "flex flex-col gap-1 py-2" }, navLinks.map((link) => /* @__PURE__ */ React21.createElement(
11806
- Link7,
12143
+ Link6,
11807
12144
  {
11808
12145
  key: link.href,
11809
12146
  href: link.href,
@@ -11812,7 +12149,7 @@ function Header() {
11812
12149
  },
11813
12150
  link.label
11814
12151
  )), !isAuthenticated && /* @__PURE__ */ React21.createElement(
11815
- Link7,
12152
+ Link6,
11816
12153
  {
11817
12154
  href: buildPath("/login"),
11818
12155
  onClick: () => setIsMobileMenuOpen(false),
@@ -11851,21 +12188,21 @@ function Footer() {
11851
12188
  ]
11852
12189
  };
11853
12190
  return /* @__PURE__ */ React21.createElement("footer", { className: "bg-gray-900 text-gray-300" }, /* @__PURE__ */ React21.createElement("div", { className: "container mx-auto px-4 py-16" }, /* @__PURE__ */ React21.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-12" }, /* @__PURE__ */ React21.createElement("div", { className: "lg:col-span-2" }, /* @__PURE__ */ React21.createElement("h3", { className: "text-2xl font-bold text-white mb-4" }, config.storeName), /* @__PURE__ */ React21.createElement("p", { className: "text-gray-400 mb-6 max-w-md" }, "Your trusted online store for quality products. We deliver excellence with every order."), /* @__PURE__ */ React21.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement(Mail, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React21.createElement("span", null, "support@", config.storeName.toLowerCase().replace(/\s+/g, ""), ".com")), /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement(Phone, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React21.createElement("span", null, "+1 (555) 123-4567")), /* @__PURE__ */ React21.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React21.createElement(MapPin, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React21.createElement("span", null, "123 Store Street, City, Country")))), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("h4", { className: "text-lg font-semibold text-white mb-4" }, "Shop"), /* @__PURE__ */ React21.createElement("ul", { className: "space-y-2" }, footerLinks.shop.map((link) => /* @__PURE__ */ React21.createElement("li", { key: link.href }, /* @__PURE__ */ React21.createElement(
11854
- Link7,
12191
+ Link6,
11855
12192
  {
11856
12193
  href: link.href,
11857
12194
  className: "hover:text-primary-500 transition-colors"
11858
12195
  },
11859
12196
  link.label
11860
12197
  ))))), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("h4", { className: "text-lg font-semibold text-white mb-4" }, "Account"), /* @__PURE__ */ React21.createElement("ul", { className: "space-y-2" }, footerLinks.account.map((link) => /* @__PURE__ */ React21.createElement("li", { key: link.href }, /* @__PURE__ */ React21.createElement(
11861
- Link7,
12198
+ Link6,
11862
12199
  {
11863
12200
  href: link.href,
11864
12201
  className: "hover:text-primary-500 transition-colors"
11865
12202
  },
11866
12203
  link.label
11867
12204
  ))))), /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("h4", { className: "text-lg font-semibold text-white mb-4" }, "Support"), /* @__PURE__ */ React21.createElement("ul", { className: "space-y-2" }, footerLinks.support.map((link) => /* @__PURE__ */ React21.createElement("li", { key: link.href }, /* @__PURE__ */ React21.createElement(
11868
- Link7,
12205
+ Link6,
11869
12206
  {
11870
12207
  href: link.href,
11871
12208
  className: "hover:text-primary-500 transition-colors"
@@ -11895,6 +12232,6 @@ function Footer() {
11895
12232
  )))));
11896
12233
  }
11897
12234
 
11898
- export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, CheckoutScreen, CurrentOrdersScreen, EcommerceProvider, EmptyState, Footer, Header, Input, LoginScreen, Modal, NewAddressPage as NewAddressScreen, OrderCard, OrderCardSkeleton, OrdersScreen, ProductCard, ProductCardSkeleton, ProductDetailScreen, ProfileScreen, RegisterScreen, SearchPage as SearchResultsScreen, ShopScreen, Skeleton, ThemeProvider, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCurrentOrders, useOrder, useOrders, useProduct, useProducts, useTheme, useWishlist };
12235
+ export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, CheckoutScreen, CurrentOrdersScreen, EcommerceProvider, EmptyState, Footer, Header, Input, LoginScreen, Modal, NewAddressPage as NewAddressScreen, OrderCard, OrderCardSkeleton, OrdersScreen, ProductCard, ProductCardSkeleton, ProductDetailScreen, AccountPage as ProfileScreen, RegisterScreen, SearchPage as SearchResultsScreen, ShopScreen, Skeleton, ThemeProvider, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCurrentOrders, useOrder, useOrders, useProduct, useProducts, useTheme, useWishlist };
11899
12236
  //# sourceMappingURL=index.mjs.map
11900
12237
  //# sourceMappingURL=index.mjs.map