hey-pharmacist-ecommerce 1.1.31 → 1.1.33

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
@@ -3,7 +3,7 @@ import React12, { createContext, forwardRef, useContext, useEffect, useState, us
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
  import globalAxios21 from 'axios';
5
5
  import { motion, AnimatePresence, useMotionValue, useTransform } from 'framer-motion';
6
- import { Trash2, X, CheckCheck, Settings, BellOff, Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, Package, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, Clock, User, MessageCircle, Filter, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, MapPin, CreditCard, Edit3, AlertCircle, Lock, EyeOff, UserPlus, Mail, Send, ArrowLeft, MessageSquare, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, Loader2, Bell, Zap, LogOut, Menu, Facebook, Twitter, Instagram, Shirt, Pill, Box, TrendingDown, ExternalLink, Gift, Tag, Globe, Home, CheckCircle, Edit, AlertTriangle, Info, XCircle } from 'lucide-react';
6
+ import { Trash2, X, CheckCheck, Settings, BellOff, Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, Package, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, Clock, User, MessageCircle, Filter, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, MapPin, CreditCard, Edit3, AlertCircle, Lock, EyeOff, UserPlus, Mail, Send, ArrowLeft, MessageSquare, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, Loader2, Calendar, ExternalLink, Info, Bell, LogOut, Menu, Facebook, Twitter, Instagram, Shirt, Pill, Box, TrendingDown, Gift, Tag, Globe, Home, CheckCircle, Edit, AlertTriangle, XCircle } from 'lucide-react';
7
7
  import { QueryClient, QueryClientProvider, useQuery } from '@tanstack/react-query';
8
8
  import { useRouter, useSearchParams, useParams } from 'next/navigation';
9
9
  import Image4 from 'next/image';
@@ -12434,13 +12434,6 @@ function NotificationCenterProvider({ children }) {
12434
12434
  setIsLoading(true);
12435
12435
  try {
12436
12436
  const response = await notificationsApi.current.getNotifications(pageNum, 20, false);
12437
- console.log("Raw API response:", {
12438
- fullResponse: response,
12439
- data: response.data,
12440
- dataType: typeof response.data,
12441
- isArray: Array.isArray(response.data),
12442
- keys: response.data ? Object.keys(response.data) : []
12443
- });
12444
12437
  const data = response.data;
12445
12438
  let rawNotifications = [];
12446
12439
  if (Array.isArray(data)) {
@@ -12460,13 +12453,6 @@ function NotificationCenterProvider({ children }) {
12460
12453
  createdAt: n.createdAt,
12461
12454
  data: n.data
12462
12455
  }));
12463
- console.log("Fetched and mapped notifications:", {
12464
- pageNum,
12465
- append,
12466
- rawCount: rawNotifications.length,
12467
- mappedCount: newNotifications.length,
12468
- firstNotification: newNotifications[0]
12469
- });
12470
12456
  if (append) {
12471
12457
  setNotifications((prev) => [...prev, ...newNotifications]);
12472
12458
  } else {
@@ -12485,7 +12471,6 @@ function NotificationCenterProvider({ children }) {
12485
12471
  setIsLoading(true);
12486
12472
  try {
12487
12473
  const response = await notificationsApi.current.getSettings();
12488
- console.log("Settings API response raw:", response);
12489
12474
  const rawData = response.data;
12490
12475
  let finalSettings = null;
12491
12476
  if (rawData) {
@@ -12530,7 +12515,6 @@ function NotificationCenterProvider({ children }) {
12530
12515
  finalSettings = rawData;
12531
12516
  }
12532
12517
  }
12533
- console.log("Parsed settings:", finalSettings);
12534
12518
  setSettings(finalSettings);
12535
12519
  } catch (error) {
12536
12520
  console.error("Failed to fetch settings:", error);
@@ -12546,11 +12530,12 @@ function NotificationCenterProvider({ children }) {
12546
12530
  }
12547
12531
  return;
12548
12532
  }
12549
- const token = getAuthToken();
12550
- if (!token) return;
12551
12533
  try {
12552
12534
  const config = getCurrentConfig();
12553
- const sseUrl = `${config.apiBaseUrl}/notifications/stream?token=${encodeURIComponent(token)}`;
12535
+ const token = getAuthToken();
12536
+ if (!token) return;
12537
+ const baseUrl = config.apiBaseUrl.endsWith("/") ? config.apiBaseUrl.slice(0, -1) : config.apiBaseUrl;
12538
+ const sseUrl = `${baseUrl}/notifications/stream?token=${encodeURIComponent(token)}`;
12554
12539
  const eventSource = new EventSource(sseUrl);
12555
12540
  eventSourceRef.current = eventSource;
12556
12541
  eventSource.onmessage = (event) => {
@@ -12671,14 +12656,13 @@ function NotificationCenterProvider({ children }) {
12671
12656
  }
12672
12657
  }))
12673
12658
  };
12674
- console.log("Updating settings with payload:", payload);
12675
12659
  await notificationsApi.current.updateSettings(payload);
12676
- setSettings(newSettings);
12660
+ await fetchSettings();
12677
12661
  } catch (error) {
12678
12662
  console.error("Failed to update settings:", error);
12679
12663
  throw error;
12680
12664
  }
12681
- }, []);
12665
+ }, [fetchSettings]);
12682
12666
  const value = {
12683
12667
  notifications,
12684
12668
  unreadCount,
@@ -12846,14 +12830,6 @@ function NotificationDrawer() {
12846
12830
  const router = useRouter();
12847
12831
  const { buildPath } = useBasePath();
12848
12832
  const scrollContainerRef = useRef(null);
12849
- console.log("NotificationDrawer render:", {
12850
- isDrawerOpen,
12851
- notificationsCount: notifications.length,
12852
- notifications: notifications.slice(0, 2),
12853
- // First 2 for brevity
12854
- unreadCount,
12855
- isLoading
12856
- });
12857
12833
  const handleScroll = () => {
12858
12834
  if (!scrollContainerRef.current || isLoading || !hasMore) return;
12859
12835
  const { scrollTop, scrollHeight, clientHeight } = scrollContainerRef.current;
@@ -12885,6 +12861,7 @@ function NotificationDrawer() {
12885
12861
  closeDrawer();
12886
12862
  router.push(buildPath("/account/notifications"));
12887
12863
  };
12864
+ console.log(notifications);
12888
12865
  return /* @__PURE__ */ jsx(AnimatePresence, { children: isDrawerOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
12889
12866
  /* @__PURE__ */ jsx(
12890
12867
  motion.div,
@@ -13381,7 +13358,7 @@ function ProductCard({
13381
13358
  /* @__PURE__ */ jsx("h3", { className: "text-sm font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] line-clamp-2", children: product.name }),
13382
13359
  selectedVariant && /* @__PURE__ */ jsx("p", { className: "text-xs font-['Poppins',sans-serif] text-[#676c80]", children: selectedVariant.name })
13383
13360
  ] }),
13384
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 ", children: [
13361
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 my-2", children: [
13385
13362
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsx(
13386
13363
  Star,
13387
13364
  {
@@ -13389,7 +13366,7 @@ function ProductCard({
13389
13366
  },
13390
13367
  i
13391
13368
  )) }),
13392
- /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] text-[10px] text-[#676c80] mt-4", children: [
13369
+ /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] text-[10px] text-[#676c80] ", children: [
13393
13370
  "(",
13394
13371
  product.summary?.reviewCount || 0,
13395
13372
  ")"
@@ -13475,7 +13452,7 @@ function ProductCard({
13475
13452
  }
13476
13453
  },
13477
13454
  disabled: isAddingToCart || variantImages.length > 0 && !selectedVariantId || displayInventoryCount === 0,
13478
- className: "w-full font-['Poppins',sans-serif] font-medium text-[11px] px-3 py-2 rounded-full bg-[#5B9BD5] text-white hover:bg-[#4a8ac4] hover:shadow-lg transition-all duration-300 flex items-center justify-center gap-1.5 disabled:opacity-50 disabled:cursor-not-allowed",
13455
+ className: "w-full font-['Poppins',sans-serif] font-medium text-[11px] px-3 py-2 rounded-full bg-[#5B9BD5] text-white hover:bg-[#4a8ac4] hover:shadow-lg transition-all duration-300 flex items-center justify-center gap-1.5 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",
13479
13456
  children: [
13480
13457
  /* @__PURE__ */ jsx(ShoppingCart, { className: "h-4 w-4" }),
13481
13458
  displayInventoryCount === 0 ? "Out of Stock" : "Add to Cart"
@@ -13539,7 +13516,7 @@ function Button({
13539
13516
  children,
13540
13517
  ...props
13541
13518
  }) {
13542
- const baseStyles = "font-medium rounded-full transition-all duration-200 inline-flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary-500";
13519
+ const baseStyles = "font-medium rounded-full transition-all duration-200 inline-flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary-500 hover:cursor-pointer";
13543
13520
  const variants = {
13544
13521
  primary: "bg-primary-600 text-white hover:bg-primary-700 shadow-lg shadow-primary-500/30 hover:shadow-xl hover:shadow-primary-500/40",
13545
13522
  secondary: "bg-secondary-600 text-white hover:bg-secondary-700 shadow-lg shadow-secondary-500/30 hover:shadow-xl hover:shadow-secondary-500/40",
@@ -18067,7 +18044,7 @@ function TabNavigation({ tabs: tabs2, activeTab, onTabChange }) {
18067
18044
  {
18068
18045
  onClick: () => onTabChange(tab.id),
18069
18046
  className: `
18070
- flex items-center gap-2 px-6 py-3 text-sm font-medium whitespace-nowrap
18047
+ flex items-center gap-2 px-6 py-3 mt-2 text-sm font-medium whitespace-nowrap
18071
18048
  border-b-2 transition-colors
18072
18049
  ${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"}
18073
18050
  `,
@@ -18747,9 +18724,6 @@ function AccountSettingsTab() {
18747
18724
  const router = useRouter();
18748
18725
  const { buildPath } = useBasePath();
18749
18726
  const { logout } = useAuth();
18750
- const [emailNotifications, setEmailNotifications] = useState(true);
18751
- const [orderUpdates, setOrderUpdates] = useState(true);
18752
- const [promotionalEmails, setPromotionalEmails] = useState(false);
18753
18727
  const [showDeleteModal, setShowDeleteModal] = useState(false);
18754
18728
  const [isDeleting, setIsDeleting] = useState(false);
18755
18729
  const [deleteError, setDeleteError] = useState(null);
@@ -18769,59 +18743,6 @@ function AccountSettingsTab() {
18769
18743
  }
18770
18744
  };
18771
18745
  return /* @__PURE__ */ jsxs("div", { className: "p-6 space-y-6", children: [
18772
- /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white p-6", children: [
18773
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
18774
- /* @__PURE__ */ jsx(Bell, { className: "h-5 w-5 text-secondary" }),
18775
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-secondary", children: "Account Preferences" })
18776
- ] }),
18777
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
18778
- /* @__PURE__ */ jsxs("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3", children: [
18779
- /* @__PURE__ */ jsxs("div", { children: [
18780
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-secondary", children: "Email Notifications" }),
18781
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted", children: "Receive updates about your orders" })
18782
- ] }),
18783
- /* @__PURE__ */ jsx(
18784
- "input",
18785
- {
18786
- type: "checkbox",
18787
- checked: emailNotifications,
18788
- onChange: (e) => setEmailNotifications(e.target.checked),
18789
- className: "h-4 w-4 rounded-sm border-primary-300 text-secondary focus:ring-primary-500"
18790
- }
18791
- )
18792
- ] }),
18793
- /* @__PURE__ */ jsxs("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3", children: [
18794
- /* @__PURE__ */ jsxs("div", { children: [
18795
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-secondary", children: "Order Updates" }),
18796
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted", children: "Get notified about shipping status" })
18797
- ] }),
18798
- /* @__PURE__ */ jsx(
18799
- "input",
18800
- {
18801
- type: "checkbox",
18802
- checked: orderUpdates,
18803
- onChange: (e) => setOrderUpdates(e.target.checked),
18804
- className: "h-4 w-4 rounded-sm border-primary-300 text-secondary focus:ring-primary-500"
18805
- }
18806
- )
18807
- ] }),
18808
- /* @__PURE__ */ jsxs("label", { className: "flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3", children: [
18809
- /* @__PURE__ */ jsxs("div", { children: [
18810
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-secondary", children: "Promotional Emails" }),
18811
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted", children: "Receive special offers and discounts" })
18812
- ] }),
18813
- /* @__PURE__ */ jsx(
18814
- "input",
18815
- {
18816
- type: "checkbox",
18817
- checked: promotionalEmails,
18818
- onChange: (e) => setPromotionalEmails(e.target.checked),
18819
- className: "h-4 w-4 rounded-sm border-primary-300 text-secondary focus:ring-primary-500"
18820
- }
18821
- )
18822
- ] })
18823
- ] })
18824
- ] }),
18825
18746
  /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white p-6", children: [
18826
18747
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
18827
18748
  /* @__PURE__ */ jsx(Lock, { className: "h-5 w-5 text-secondary" }),
@@ -21453,7 +21374,6 @@ function OrderReviewsScreen() {
21453
21374
  var NOTIFICATION_CATEGORIES = [
21454
21375
  {
21455
21376
  name: "Order Updates",
21456
- icon: Package,
21457
21377
  types: [
21458
21378
  {
21459
21379
  type: "ORDER_CONFIRMATION" /* ORDERCONFIRMATION */,
@@ -21474,7 +21394,6 @@ var NOTIFICATION_CATEGORIES = [
21474
21394
  },
21475
21395
  {
21476
21396
  name: "Payments",
21477
- icon: CreditCard,
21478
21397
  types: [
21479
21398
  {
21480
21399
  type: "PAYMENT_FAILED" /* PAYMENTFAILED */,
@@ -21490,7 +21409,6 @@ var NOTIFICATION_CATEGORIES = [
21490
21409
  },
21491
21410
  {
21492
21411
  name: "Security",
21493
- icon: Shield,
21494
21412
  types: [
21495
21413
  {
21496
21414
  type: "PASSWORD_RESET" /* PASSWORDRESET */,
@@ -21513,7 +21431,6 @@ var NOTIFICATION_CATEGORIES = [
21513
21431
  },
21514
21432
  {
21515
21433
  name: "Marketing",
21516
- icon: Bell,
21517
21434
  types: [
21518
21435
  {
21519
21436
  type: "ABANDONED_CART_REMINDER" /* ABANDONEDCARTREMINDER */,
@@ -21536,31 +21453,29 @@ var NOTIFICATION_CATEGORIES = [
21536
21453
  ]
21537
21454
  }
21538
21455
  ];
21456
+ var Switch = ({ checked, onChange, disabled }) => /* @__PURE__ */ jsx(
21457
+ "button",
21458
+ {
21459
+ onClick: () => !disabled && onChange(!checked),
21460
+ className: `relative w-9 h-5 rounded-full transition-colors duration-200 ease-in-out focus:outline-none ${checked ? "bg-black" : "bg-slate-200"} ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
21461
+ children: /* @__PURE__ */ jsx(
21462
+ "span",
21463
+ {
21464
+ className: `absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-transform duration-200 ease-in-out ${checked ? "translate-x-4" : "translate-x-0"}`
21465
+ }
21466
+ )
21467
+ }
21468
+ );
21539
21469
  function NotificationSettingsScreen() {
21540
21470
  const { settings, updateSettings, isLoading } = useNotificationCenter();
21541
21471
  const [localSettings, setLocalSettings] = useState(settings);
21542
- const [expandedCategories, setExpandedCategories] = useState(
21543
- new Set(NOTIFICATION_CATEGORIES.map((cat) => cat.name))
21544
- );
21545
21472
  const [isSaving, setIsSaving] = useState(false);
21546
21473
  const [hasChanges, setHasChanges] = useState(false);
21547
21474
  useEffect(() => {
21548
- console.log("NotificationSettingsScreen: settings updated:", settings);
21549
21475
  if (settings) {
21550
21476
  setLocalSettings(settings);
21551
21477
  }
21552
21478
  }, [settings]);
21553
- const toggleCategory = (categoryName) => {
21554
- setExpandedCategories((prev) => {
21555
- const next = new Set(prev);
21556
- if (next.has(categoryName)) {
21557
- next.delete(categoryName);
21558
- } else {
21559
- next.add(categoryName);
21560
- }
21561
- return next;
21562
- });
21563
- };
21564
21479
  const getChannelSetting = (type, channel) => {
21565
21480
  const activeSettings = hasChanges ? localSettings : settings;
21566
21481
  if (!activeSettings?.preferences || !Array.isArray(activeSettings.preferences)) {
@@ -21616,175 +21531,428 @@ function NotificationSettingsScreen() {
21616
21531
  setIsSaving(false);
21617
21532
  }
21618
21533
  };
21619
- const disableAllChannel = (channel) => {
21620
- setLocalSettings((prev) => {
21621
- const currentSettings = prev || { preferences: [] };
21622
- const prefIsArray = Array.isArray(currentSettings.preferences);
21623
- const preferences = NOTIFICATION_CATEGORIES.flatMap(
21624
- (cat) => cat.types.filter((t) => !t.isComingSoon).map((t) => t.type)
21625
- ).map((type) => {
21626
- const existing = prefIsArray ? currentSettings.preferences.find((p) => p.type === type) : void 0;
21627
- return {
21628
- type,
21629
- settings: {
21630
- email: channel === "email" ? false : existing?.settings?.email ?? true,
21631
- push: channel === "push" ? false : existing?.settings?.push ?? true,
21632
- inApp: existing?.settings?.inApp ?? true
21633
- }
21634
- };
21635
- });
21636
- return { ...currentSettings, preferences };
21637
- });
21638
- setHasChanges(true);
21639
- };
21640
21534
  if (isLoading && !settings) {
21641
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center min-h-[400px] bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB]", children: [
21642
- /* @__PURE__ */ jsx(Loader2, { className: "w-10 h-10 text-primary animate-spin mb-4" }),
21643
- /* @__PURE__ */ jsx("p", { className: "text-muted font-medium", children: "Loading preferences..." })
21644
- ] });
21535
+ return /* @__PURE__ */ jsx("div", { className: "flex h-[50vh] flex-col items-center justify-center", children: /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin text-slate-400" }) });
21645
21536
  }
21646
- return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB]", children: [
21647
- /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto", children: [
21648
- /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold text-secondary", children: "Notification Preferences" }),
21649
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted", children: "Manage how you receive notifications for different events" })
21537
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-4xl px-6 py-8", children: [
21538
+ /* @__PURE__ */ jsx("div", { className: "mb-6 flex items-end justify-between border-b border-slate-100 pb-4", children: /* @__PURE__ */ jsxs("div", { children: [
21539
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold tracking-tight text-slate-900", children: "Notifications" }),
21540
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-slate-500", children: "Manage your notification preferences across all channels." })
21650
21541
  ] }) }),
21651
- /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto px-4 pb-32", children: [
21652
- /* @__PURE__ */ jsx("div", { className: "space-y-4 mb-8", children: NOTIFICATION_CATEGORIES.map((category) => /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl border border-slate-200 shadow-xs overflow-hidden", children: [
21542
+ /* @__PURE__ */ jsxs("div", { className: "hidden grid-cols-12 gap-4 border-b border-slate-100 pb-3 text-xs font-medium uppercase tracking-wider text-slate-400 sm:grid", children: [
21543
+ /* @__PURE__ */ jsx("div", { className: "col-span-8", children: "Topic" }),
21544
+ /* @__PURE__ */ jsx("div", { className: "col-span-2 text-center", children: "Email" }),
21545
+ /* @__PURE__ */ jsx("div", { className: "col-span-2 text-center", children: "Push" })
21546
+ ] }),
21547
+ /* @__PURE__ */ jsx("div", { className: "space-y-8 py-4", children: NOTIFICATION_CATEGORIES.map((category) => /* @__PURE__ */ jsxs("section", { children: [
21548
+ /* @__PURE__ */ jsx("h2", { className: "mb-6 text-sm font-semibold text-slate-900", children: category.name }),
21549
+ /* @__PURE__ */ jsx("div", { className: "space-y-4", children: category.types.map((notifType) => /* @__PURE__ */ jsxs("div", { className: "group grid grid-cols-1 sm:grid-cols-12 gap-y-3 sm:gap-x-4 items-start sm:items-center", children: [
21550
+ /* @__PURE__ */ jsxs("div", { className: "col-span-8 pr-4", children: [
21551
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
21552
+ /* @__PURE__ */ jsx("span", { className: `text-sm font-medium ${notifType.isComingSoon ? "text-slate-400" : "text-slate-700"}`, children: notifType.label }),
21553
+ notifType.isComingSoon && /* @__PURE__ */ jsx("span", { className: "rounded bg-slate-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-slate-500", children: "Soon" })
21554
+ ] }),
21555
+ /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-slate-500", children: notifType.description })
21556
+ ] }),
21557
+ /* @__PURE__ */ jsxs("div", { className: "col-span-4 grid grid-cols-2 gap-4", children: [
21558
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between sm:justify-center", children: [
21559
+ /* @__PURE__ */ jsx("span", { className: "sm:hidden text-xs text-slate-400", children: "Email" }),
21560
+ /* @__PURE__ */ jsx(
21561
+ Switch,
21562
+ {
21563
+ checked: getChannelSetting(notifType.type, "email"),
21564
+ onChange: (checked) => updateChannelSetting(notifType.type, "email", checked),
21565
+ disabled: notifType.isComingSoon
21566
+ }
21567
+ )
21568
+ ] }),
21569
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between sm:justify-center", children: [
21570
+ /* @__PURE__ */ jsx("span", { className: "sm:hidden text-xs text-slate-400", children: "Push" }),
21571
+ /* @__PURE__ */ jsx(
21572
+ Switch,
21573
+ {
21574
+ checked: getChannelSetting(notifType.type, "push"),
21575
+ onChange: (checked) => updateChannelSetting(notifType.type, "push", checked),
21576
+ disabled: notifType.isComingSoon
21577
+ }
21578
+ )
21579
+ ] })
21580
+ ] })
21581
+ ] }, notifType.type)) })
21582
+ ] }, category.name)) }),
21583
+ /* @__PURE__ */ jsx("div", { className: "mt-12 border-t border-slate-100 pt-8 text-center sm:text-left", children: /* @__PURE__ */ jsx(
21584
+ Button,
21585
+ {
21586
+ variant: "ghost",
21587
+ className: "text-xs text-slate-400 hover:text-red-600 px-0",
21588
+ onClick: () => {
21589
+ if (confirm("Are you sure you want to disable all notifications?")) {
21590
+ localSettings?.preferences ? [...localSettings.preferences] : [];
21591
+ alert("Feature to disable all coming in next update");
21592
+ }
21593
+ },
21594
+ children: "Disable all notifications"
21595
+ }
21596
+ ) }),
21597
+ hasChanges && /* @__PURE__ */ jsxs("div", { className: "bg-white/80 backdrop-blur-sm fixed bottom-6 left-1/2 -translate-x-1/2 z-50 rounded-xl shadow-lg border border-slate-200 p-2 px-4 flex items-center gap-4 animate-in slide-in-from-bottom-2 fade-in duration-300", children: [
21598
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-600", children: "Unsaved changes" }),
21599
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-slate-200" }),
21600
+ /* @__PURE__ */ jsx(
21601
+ Button,
21602
+ {
21603
+ onClick: handleSave,
21604
+ isLoading: isSaving,
21605
+ disabled: isSaving,
21606
+ variant: "primary",
21607
+ className: "h-8 rounded-lg px-4 text-xs font-medium bg-black text-white bg-slate-800 hover:bg-slate-700",
21608
+ children: "Save"
21609
+ }
21610
+ )
21611
+ ] })
21612
+ ] });
21613
+ }
21614
+ function OrderDetailScreen({ id }) {
21615
+ const router = useRouter();
21616
+ const { buildPath } = useBasePath();
21617
+ const { order, isLoading, error } = useOrder(id);
21618
+ if (isLoading) {
21619
+ return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-slate-50 flex flex-col items-center justify-center p-4", children: [
21620
+ /* @__PURE__ */ jsx("div", { className: "w-16 h-16 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb-4" }),
21621
+ /* @__PURE__ */ jsx("p", { className: "text-muted font-medium animate-pulse", children: "Retrieving order details..." })
21622
+ ] });
21623
+ }
21624
+ if (error || !order) {
21625
+ return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-slate-50 flex flex-col items-center justify-center p-4", children: [
21626
+ /* @__PURE__ */ jsx("div", { className: "p-4 bg-red-50 rounded-full mb-4", children: /* @__PURE__ */ jsx(AlertCircle, { className: "w-10 h-10 text-red-500" }) }),
21627
+ /* @__PURE__ */ jsx("h1", { className: "text-xl font-bold text-secondary mb-2", children: "Order Not Found" }),
21628
+ /* @__PURE__ */ jsx("p", { className: "text-muted mb-6", children: "We couldn't find the order you're looking for." }),
21629
+ /* @__PURE__ */ jsx(Button, { onClick: () => router.push(buildPath("/account")), children: "Back to Account" })
21630
+ ] });
21631
+ }
21632
+ const items = order.items || [];
21633
+ const status = order.orderStatus || "Pending";
21634
+ const isDelivery = order.orderType === "Delivery";
21635
+ const getStatusVariant = (status2) => {
21636
+ switch (status2.toLowerCase()) {
21637
+ case "pending":
21638
+ return "warning";
21639
+ case "delivered":
21640
+ case "fulfilled":
21641
+ case "picked up":
21642
+ return "success";
21643
+ case "shipped":
21644
+ return "primary";
21645
+ case "cancelled":
21646
+ return "danger";
21647
+ default:
21648
+ return "gray";
21649
+ }
21650
+ };
21651
+ const shippingAddress = order.shippingInfo?.addressTo;
21652
+ const pickupAddress = order.pickUpAddress;
21653
+ const activeAddress = isDelivery ? shippingAddress : pickupAddress;
21654
+ return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB] pb-20", children: [
21655
+ /* @__PURE__ */ jsxs("div", { className: "container mx-auto px-4 pt-8 max-w-6xl", children: [
21656
+ /* @__PURE__ */ jsxs(
21657
+ "button",
21658
+ {
21659
+ onClick: () => router.back(),
21660
+ className: "group flex items-center gap-2 text-muted hover:text-secondary transition-colors mb-6",
21661
+ children: [
21662
+ /* @__PURE__ */ jsx("div", { className: "p-1.5 rounded-full bg-white shadow-xs group-hover:shadow-md transition-all", children: /* @__PURE__ */ jsx(ChevronLeft, { className: "w-4 h-4" }) }),
21663
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: "Back to History" })
21664
+ ]
21665
+ }
21666
+ ),
21667
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8", children: [
21668
+ /* @__PURE__ */ jsxs("div", { children: [
21669
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
21670
+ /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold text-secondary", children: "Order Details" }),
21671
+ /* @__PURE__ */ jsx(Badge, { variant: getStatusVariant(status), children: status }),
21672
+ /* @__PURE__ */ jsx(Badge, { variant: "primary", className: "bg-primary-100 text-primary-700 border-primary-200", children: order.orderType || "Pickup" })
21673
+ ] }),
21674
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-2 text-sm text-muted", children: [
21675
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 font-medium", children: [
21676
+ /* @__PURE__ */ jsx("span", { className: "opacity-60 text-xs uppercase tracking-widest font-bold", children: "ID:" }),
21677
+ /* @__PURE__ */ jsxs("span", { className: "text-secondary font-mono tracking-tight", children: [
21678
+ "#",
21679
+ id.toUpperCase()
21680
+ ] })
21681
+ ] }),
21682
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 font-medium", children: [
21683
+ /* @__PURE__ */ jsx(Calendar, { className: "w-4 h-4 opacity-60" }),
21684
+ formatDate(order.createdAt || /* @__PURE__ */ new Date(), "long")
21685
+ ] })
21686
+ ] })
21687
+ ] }),
21688
+ /* @__PURE__ */ jsx("div", { className: "flex gap-3", children: order.payment?.hostedInvoiceUrl && /* @__PURE__ */ jsxs(Button, { size: "sm", onClick: () => window.open(order.payment?.hostedInvoiceUrl, "_blank"), className: "bg-accent hover:bg-accent-dark border-none", children: [
21689
+ /* @__PURE__ */ jsx(ExternalLink, { className: "w-4 h-4" }),
21690
+ "Payment Details"
21691
+ ] }) })
21692
+ ] })
21693
+ ] }),
21694
+ /* @__PURE__ */ jsxs("div", { className: "container mx-auto px-4 max-w-6xl grid grid-cols-1 lg:grid-cols-3 gap-8", children: [
21695
+ /* @__PURE__ */ jsxs("div", { className: "lg:col-span-2 space-y-6", children: [
21653
21696
  /* @__PURE__ */ jsxs(
21654
- "button",
21697
+ motion.div,
21655
21698
  {
21656
- onClick: () => toggleCategory(category.name),
21657
- className: "w-full flex items-center justify-between p-6 hover:bg-slate-50 transition-colors",
21699
+ initial: { opacity: 0, y: 20 },
21700
+ animate: { opacity: 1, y: 0 },
21701
+ className: "bg-white rounded-3xl border border-slate-200 shadow-xs overflow-hidden",
21658
21702
  children: [
21659
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
21660
- /* @__PURE__ */ jsx("div", { className: "p-2 bg-slate-100 rounded-lg group-hover:bg-white transition-colors", children: /* @__PURE__ */ jsx(category.icon, { className: "w-5 h-5 text-secondary" }) }),
21661
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-secondary", children: category.name })
21703
+ /* @__PURE__ */ jsxs("div", { className: "p-6 border-b border-slate-100 bg-slate-50/50 flex items-center justify-between", children: [
21704
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
21705
+ /* @__PURE__ */ jsx(Package, { className: "w-5 h-5 text-secondary" }),
21706
+ /* @__PURE__ */ jsx("h2", { className: "font-bold text-secondary", children: "Order Items" })
21707
+ ] }),
21708
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-bold bg-slate-200 text-muted px-2.5 py-1 rounded-full", children: [
21709
+ items.length,
21710
+ " ",
21711
+ items.length === 1 ? "Product" : "Products"
21712
+ ] })
21662
21713
  ] }),
21663
- expandedCategories.has(category.name) ? /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 text-muted" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "w-5 h-5 text-muted" })
21664
- ]
21665
- }
21666
- ),
21667
- /* @__PURE__ */ jsx(AnimatePresence, { children: expandedCategories.has(category.name) && /* @__PURE__ */ jsx(
21668
- motion.div,
21669
- {
21670
- initial: { height: 0, opacity: 0 },
21671
- animate: { height: "auto", opacity: 1 },
21672
- exit: { height: 0, opacity: 0 },
21673
- transition: { duration: 0.2 },
21674
- className: "border-t border-slate-100",
21675
- children: /* @__PURE__ */ jsx("div", { className: "p-6 space-y-4", children: category.types.map((notifType) => /* @__PURE__ */ jsx(
21676
- "div",
21677
- {
21678
- className: `rounded-xl border border-slate-200 bg-slate-50 p-4 transition-all hover:bg-white hover:shadow-sm ${notifType.isComingSoon ? "opacity-50 grayscale select-none" : ""}`,
21679
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center justify-between gap-6", children: [
21680
- /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
21681
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
21682
- /* @__PURE__ */ jsx("h3", { className: "font-semibold text-secondary", children: notifType.label }),
21683
- notifType.isComingSoon && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold uppercase tracking-wider bg-slate-200 text-muted px-2 py-0.5 rounded-full", children: "Soon" })
21684
- ] }),
21685
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted mt-1 leading-relaxed", children: notifType.description })
21714
+ /* @__PURE__ */ jsx("div", { className: "divide-y divide-slate-100", children: items.map((item, idx) => /* @__PURE__ */ jsxs("div", { className: "p-6 flex gap-6 group hover:bg-slate-50/50 transition-colors", children: [
21715
+ /* @__PURE__ */ jsx("div", { className: "relative w-20 h-20 bg-slate-100 rounded-2xl overflow-hidden shrink-0 border border-slate-100 group-hover:scale-105 transition-transform duration-300", children: /* @__PURE__ */ jsx(
21716
+ Image4,
21717
+ {
21718
+ src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
21719
+ alt: item.productVariantData?.name || "Item",
21720
+ fill: true,
21721
+ className: "object-cover",
21722
+ sizes: "80px"
21723
+ }
21724
+ ) }),
21725
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col justify-between py-1", children: [
21726
+ /* @__PURE__ */ jsxs("div", { children: [
21727
+ /* @__PURE__ */ jsx("h3", { className: "font-bold text-secondary text-lg group-hover:text-primary transition-colors leading-snug mb-1", children: item.productVariantData?.name }),
21728
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted", children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
21729
+ /* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-300" }),
21730
+ "Quantity: ",
21731
+ /* @__PURE__ */ jsx("span", { className: "text-secondary font-bold", children: item.quantity })
21732
+ ] }) })
21686
21733
  ] }),
21687
- !notifType.isComingSoon && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 sm:border-l sm:border-slate-200 sm:pl-6", children: [
21688
- /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer group/label", children: [
21689
- /* @__PURE__ */ jsx(
21690
- "input",
21691
- {
21692
- type: "checkbox",
21693
- checked: getChannelSetting(notifType.type, "email"),
21694
- onChange: (e) => updateChannelSetting(notifType.type, "email", e.target.checked),
21695
- className: "w-4 h-4 text-primary border-slate-300 rounded-sm focus:ring-primary focus:ring-offset-0"
21696
- }
21697
- ),
21698
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted uppercase tracking-wider group-hover/label:text-primary transition-colors", children: "Email" })
21699
- ] }),
21700
- /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer group/label", children: [
21701
- /* @__PURE__ */ jsx(
21702
- "input",
21703
- {
21704
- type: "checkbox",
21705
- checked: getChannelSetting(notifType.type, "push"),
21706
- onChange: (e) => updateChannelSetting(notifType.type, "push", e.target.checked),
21707
- className: "w-4 h-4 text-primary border-slate-300 rounded-sm focus:ring-primary focus:ring-offset-0"
21708
- }
21709
- ),
21710
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted uppercase tracking-wider group-hover/label:text-primary transition-colors", children: "Push" })
21734
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
21735
+ /* @__PURE__ */ jsxs("span", { className: "text-muted text-sm", children: [
21736
+ formatPrice(item.productVariantData?.finalPrice || 0),
21737
+ " per unit"
21711
21738
  ] }),
21712
- /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer group/label", children: [
21713
- /* @__PURE__ */ jsx(
21714
- "input",
21715
- {
21716
- type: "checkbox",
21717
- checked: getChannelSetting(notifType.type, "inApp"),
21718
- onChange: (e) => updateChannelSetting(notifType.type, "inApp", e.target.checked),
21719
- className: "w-4 h-4 text-primary border-slate-300 rounded-sm focus:ring-primary focus:ring-offset-0"
21720
- }
21721
- ),
21722
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted uppercase tracking-wider group-hover/label:text-primary transition-colors", children: "In-App" })
21723
- ] })
21739
+ /* @__PURE__ */ jsx("span", { className: "font-black text-secondary", children: formatPrice((item.productVariantData?.finalPrice || 0) * item.quantity) })
21724
21740
  ] })
21725
21741
  ] })
21726
- },
21727
- notifType.type
21728
- )) })
21742
+ ] }, item._id || idx)) })
21743
+ ]
21729
21744
  }
21730
- ) })
21731
- ] }, category.name)) }),
21732
- /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl p-6 border border-slate-200 mb-8 shadow-xs", children: [
21733
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
21734
- /* @__PURE__ */ jsx(Zap, { className: "h-5 w-5 text-accent" }),
21735
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-secondary", children: "Quick Actions" })
21745
+ ),
21746
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
21747
+ /* @__PURE__ */ jsxs("div", { className: "bg-white p-6 rounded-3xl border border-slate-200 shadow-xs", children: [
21748
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
21749
+ /* @__PURE__ */ jsx(MapPin, { className: "w-5 h-5 text-accent" }),
21750
+ /* @__PURE__ */ jsx("h3", { className: "font-bold text-secondary", children: isDelivery ? "Shipping Address" : "Pickup Location" })
21751
+ ] }),
21752
+ activeAddress ? /* @__PURE__ */ jsxs("div", { className: "text-sm text-muted leading-relaxed", children: [
21753
+ /* @__PURE__ */ jsx("p", { className: "font-bold text-secondary text-base mb-1", children: activeAddress.name }),
21754
+ /* @__PURE__ */ jsx("p", { children: activeAddress.street1 }),
21755
+ activeAddress.street2 && /* @__PURE__ */ jsx("p", { children: activeAddress.street2 }),
21756
+ /* @__PURE__ */ jsxs("p", { children: [
21757
+ activeAddress.city,
21758
+ ", ",
21759
+ activeAddress.state,
21760
+ " ",
21761
+ activeAddress.zip
21762
+ ] }),
21763
+ /* @__PURE__ */ jsx("p", { children: activeAddress.country })
21764
+ ] }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-muted italic", children: "No address recorded" })
21765
+ ] }),
21766
+ /* @__PURE__ */ jsxs("div", { className: "bg-white p-6 rounded-3xl border border-slate-200 shadow-xs", children: [
21767
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
21768
+ /* @__PURE__ */ jsx(CreditCard, { className: "w-5 h-5 text-accent" }),
21769
+ /* @__PURE__ */ jsx("h3", { className: "font-bold text-secondary", children: "Payment Method" })
21770
+ ] }),
21771
+ /* @__PURE__ */ jsxs("div", { className: "text-sm text-muted leading-relaxed", children: [
21772
+ /* @__PURE__ */ jsx("p", { className: "font-bold text-secondary text-base mb-1", children: order.payment?.paymentMethod ? order.payment.paymentMethod.replace("_", " ").toUpperCase() : "N/A" }),
21773
+ /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 mt-2", children: [
21774
+ /* @__PURE__ */ jsx("span", { className: "opacity-60", children: "Status:" }),
21775
+ /* @__PURE__ */ jsx(Badge, { variant: order.payment?.paymentStatus === "Paid" ? "success" : "warning", children: order.payment?.paymentStatus || "Processing" })
21776
+ ] }),
21777
+ order.payment?.transactionId && /* @__PURE__ */ jsxs("p", { className: "mt-3 text-[10px] font-bold text-slate-400 uppercase tracking-tighter", children: [
21778
+ "Ref: ",
21779
+ order.payment.transactionId
21780
+ ] })
21781
+ ] })
21782
+ ] })
21783
+ ] })
21784
+ ] }),
21785
+ /* @__PURE__ */ jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsxs(
21786
+ motion.div,
21787
+ {
21788
+ initial: { opacity: 0, x: 20 },
21789
+ animate: { opacity: 1, x: 0 },
21790
+ className: "bg-secondary p-8 rounded-[2rem] text-white shadow-xl shadow-secondary/20 sticky top-8",
21791
+ children: [
21792
+ /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold mb-6 flex items-center gap-2", children: "Summary View" }),
21793
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 mb-8", children: [
21794
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
21795
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Subtotal" }),
21796
+ /* @__PURE__ */ jsx("span", { className: "font-bold text-white", children: formatPrice(order.subTotal || 0) })
21797
+ ] }),
21798
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
21799
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Shipping" }),
21800
+ /* @__PURE__ */ jsx("span", { className: "font-bold text-white", children: formatPrice(order.shippingCost || 0) })
21801
+ ] }),
21802
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
21803
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Tax" }),
21804
+ /* @__PURE__ */ jsx("span", { className: "font-bold text-white", children: formatPrice(order.tax || 0) })
21805
+ ] }),
21806
+ order.discountedAmount !== void 0 && order.discountedAmount > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-primary", children: [
21807
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Discount" }),
21808
+ /* @__PURE__ */ jsxs("span", { className: "font-bold", children: [
21809
+ "-",
21810
+ formatPrice(order.discountedAmount)
21811
+ ] })
21812
+ ] }),
21813
+ /* @__PURE__ */ jsx("div", { className: "pt-4 border-t border-white/10 mt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-end", children: [
21814
+ /* @__PURE__ */ jsxs("div", { children: [
21815
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-black uppercase tracking-[0.2em] text-white/40 mb-1", children: "Grand Total" }),
21816
+ /* @__PURE__ */ jsx("p", { className: "text-3xl font-black", children: formatPrice(order.grandTotal || 0) })
21817
+ ] }),
21818
+ /* @__PURE__ */ jsx("div", { className: "px-3 py-1 bg-white/10 rounded-lg text-[10px] font-black uppercase tracking-wider text-white/60", children: "USD" })
21819
+ ] }) })
21820
+ ] }),
21821
+ order.orderStatus === "Pending" && /* @__PURE__ */ jsx("div", { className: "p-4 bg-white/5 rounded-2xl border border-white/10 mb-8", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
21822
+ /* @__PURE__ */ jsx(Info, { className: "w-5 h-5 text-primary shrink-0 mt-0.5" }),
21823
+ /* @__PURE__ */ jsxs("div", { children: [
21824
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-bold mb-1", children: "Order is processing" }),
21825
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-white/60 leading-relaxed", children: "We've received your request and our pharmacists are reviewing it for safety and accuracy." })
21826
+ ] })
21827
+ ] }) })
21828
+ ]
21829
+ }
21830
+ ) })
21831
+ ] })
21832
+ ] });
21833
+ }
21834
+ init_config();
21835
+ var changePasswordSchema = z.object({
21836
+ currentPassword: z.string().min(6, "Current password is required"),
21837
+ newPassword: z.string().min(8, "Password must be at least 8 characters"),
21838
+ confirmPassword: z.string().min(8, "Confirm your new password")
21839
+ }).refine((data) => data.newPassword === data.confirmPassword, {
21840
+ path: ["confirmPassword"],
21841
+ message: "Passwords do not match"
21842
+ });
21843
+ function ChangePasswordScreen() {
21844
+ const router = useRouter();
21845
+ const { user } = useAuth();
21846
+ const { buildPath } = useBasePath();
21847
+ const [isSubmitting, setIsSubmitting] = useState(false);
21848
+ const [status, setStatus] = useState(
21849
+ null
21850
+ );
21851
+ const {
21852
+ register,
21853
+ handleSubmit,
21854
+ formState: { errors }
21855
+ } = useForm({
21856
+ resolver: zodResolver(changePasswordSchema)
21857
+ });
21858
+ if (!user) {
21859
+ router.push(buildPath("/login"));
21860
+ return null;
21861
+ }
21862
+ const onSubmit = async (data) => {
21863
+ setIsSubmitting(true);
21864
+ setStatus(null);
21865
+ try {
21866
+ await changePassword(data.currentPassword, data.newPassword);
21867
+ setStatus({ type: "success", message: "Password updated successfully" });
21868
+ setTimeout(() => router.push(buildPath("/account")), 600);
21869
+ } catch (error) {
21870
+ setStatus({
21871
+ type: "error",
21872
+ message: error?.response?.data?.message || "Unable to update password"
21873
+ });
21874
+ } finally {
21875
+ setIsSubmitting(false);
21876
+ }
21877
+ };
21878
+ return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-slate-50 text-slate-900", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 pb-16 pt-10", children: /* @__PURE__ */ jsxs(
21879
+ motion.div,
21880
+ {
21881
+ initial: { opacity: 0, y: 18 },
21882
+ animate: { opacity: 1, y: 0 },
21883
+ className: "mx-auto max-w-2xl rounded-3xl border border-slate-200 bg-white p-8 shadow-xl shadow-primary-50",
21884
+ children: [
21885
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
21886
+ /* @__PURE__ */ jsx("span", { className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-primary-50 text-primary-600", children: /* @__PURE__ */ jsx(Lock, { className: "h-5 w-5" }) }),
21887
+ /* @__PURE__ */ jsxs("div", { children: [
21888
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-[0.32em] text-slate-500", children: "Security" }),
21889
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold text-slate-900", children: "Change password" })
21890
+ ] })
21736
21891
  ] }),
21737
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
21892
+ /* @__PURE__ */ jsx("p", { className: "mt-3 text-sm text-slate-600", children: "Use a strong password that you have not used elsewhere. Updating your password will sign you out of other active sessions." }),
21893
+ status && /* @__PURE__ */ jsxs(
21894
+ "div",
21895
+ {
21896
+ className: `mt-4 flex items-start gap-2 rounded-2xl border px-4 py-3 text-sm ${status.type === "success" ? "border-green-200 bg-green-50 text-green-800" : "border-red-200 bg-red-50 text-red-700"}`,
21897
+ children: [
21898
+ /* @__PURE__ */ jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
21899
+ /* @__PURE__ */ jsx("span", { children: status.message })
21900
+ ]
21901
+ }
21902
+ ),
21903
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "mt-8 space-y-5", children: [
21738
21904
  /* @__PURE__ */ jsx(
21739
- Button,
21905
+ Input,
21740
21906
  {
21741
- variant: "outline-solid",
21742
- size: "sm",
21743
- onClick: () => disableAllChannel("email"),
21744
- className: "rounded-xl border-slate-200 hover:bg-slate-50",
21745
- children: "Disable All Emails"
21907
+ type: "password",
21908
+ label: "Current password",
21909
+ placeholder: "Enter current password",
21910
+ ...register("currentPassword"),
21911
+ error: errors.currentPassword?.message
21746
21912
  }
21747
21913
  ),
21748
21914
  /* @__PURE__ */ jsx(
21749
- Button,
21915
+ Input,
21750
21916
  {
21751
- variant: "outline-solid",
21752
- size: "sm",
21753
- onClick: () => disableAllChannel("push"),
21754
- className: "rounded-xl border-slate-200 hover:bg-slate-50",
21755
- children: "Disable All Push"
21917
+ type: "password",
21918
+ label: "New password",
21919
+ placeholder: "Enter new password",
21920
+ ...register("newPassword"),
21921
+ error: errors.newPassword?.message
21756
21922
  }
21757
- )
21758
- ] })
21759
- ] }),
21760
- /* @__PURE__ */ jsx(AnimatePresence, { children: hasChanges && /* @__PURE__ */ jsx(
21761
- motion.div,
21762
- {
21763
- initial: { opacity: 0, y: 100 },
21764
- animate: { opacity: 1, y: 0 },
21765
- exit: { opacity: 0, y: 100 },
21766
- className: "fixed bottom-10 left-0 right-0 flex justify-center z-50 pointer-events-none",
21767
- children: /* @__PURE__ */ jsxs("div", { className: "pointer-events-auto px-6 py-4 bg-secondary shadow-lg rounded-3xl flex items-center gap-8 max-w-xl mx-auto transform hover:scale-[1.02] transition-all duration-300 ease-out border border-white/10", children: [
21768
- /* @__PURE__ */ jsxs("div", { className: "hidden sm:block", children: [
21769
- /* @__PURE__ */ jsx("p", { className: "text-sm font-bold text-white leading-tight tracking-wide italic", children: "Changes Pending" }),
21770
- /* @__PURE__ */ jsx("p", { className: "text-[11px] text-white/60 font-medium", children: "Click to synchronize with account" })
21771
- ] }),
21923
+ ),
21924
+ /* @__PURE__ */ jsx(
21925
+ Input,
21926
+ {
21927
+ type: "password",
21928
+ label: "Confirm new password",
21929
+ placeholder: "Re-type new password",
21930
+ ...register("confirmPassword"),
21931
+ error: errors.confirmPassword?.message
21932
+ }
21933
+ ),
21934
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
21935
+ /* @__PURE__ */ jsx(Button, { type: "submit", size: "lg", isLoading: isSubmitting, children: "Save password" }),
21772
21936
  /* @__PURE__ */ jsx(
21773
21937
  Button,
21774
21938
  {
21775
- onClick: handleSave,
21776
- isLoading: isSaving,
21777
- disabled: isSaving,
21778
- variant: "secondary",
21779
- className: "px-8 py-3 bg-accent border-none text-white rounded-2xl font-bold text-xs uppercase tracking-widest hover:bg-accent-dark transition-all active:scale-95 shadow-lg shadow-accent/25 min-w-[180px]",
21780
- children: isSaving ? "Saving..." : "Sync Changes"
21939
+ type: "button",
21940
+ variant: "outline-solid",
21941
+ size: "lg",
21942
+ className: "border-slate-300 text-slate-800 hover:bg-slate-50",
21943
+ onClick: () => router.push(buildPath("/account")),
21944
+ children: "Cancel"
21781
21945
  }
21782
21946
  )
21783
21947
  ] })
21784
- }
21785
- ) })
21786
- ] })
21787
- ] });
21948
+ ] }),
21949
+ /* @__PURE__ */ jsxs("div", { className: "mt-6 flex items-center gap-2 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-600", children: [
21950
+ /* @__PURE__ */ jsx(ShieldCheck, { className: "h-4 w-4 text-primary-600" }),
21951
+ "Strong passwords and up-to-date contact details help pharmacists verify changes quickly."
21952
+ ] })
21953
+ ]
21954
+ }
21955
+ ) }) });
21788
21956
  }
21789
21957
  function NotificationBell() {
21790
21958
  const { unreadCount, openDrawer } = useNotificationCenter();
@@ -22154,6 +22322,6 @@ function Footer() {
22154
22322
  ] }) });
22155
22323
  }
22156
22324
 
22157
- export { AccountReviewsTab, AddressAddressTypeEnum, AddressCreatedRequestAddressTypeEnum, AddressesScreen, ApiKeyInfoDtoKeyTypeEnum, AuthProvider, Badge, BulkChannelToggleDtoCategoryEnum, Button, CampaignDraftDtoStatusEnum, CampaignDraftScheduleDtoStatusEnum, CampaignDraftSendingDtoStatusEnum, CartItem, CartProvider, CartScreen, CheckoutScreen, CreateAddressDtoAddressTypeEnum, CreateDiscountDtoStateEnum, CreateDiscountDtoTypeEnum, CreateDiscountDtoValueTypeEnum, CreateStoreAddressDtoAddressTypeEnum, CreateUserDtoCustomerTypeEnum, CreateUserDtoRoleEnum, CurrentOrdersScreen, DiscountStateEnum, DiscountTypeEnum, DiscountValueTypeEnum, EcommerceProvider, EditProfileScreen, EmptyState, Footer, ForgotPasswordScreen, Header, Input, LoginScreen, ManualDiscountDtoValueTypeEnum, ManualOrderDTOOrderStatusEnum, ManualOrderDTOPaymentMethodEnum, ManualOrderDTOPaymentStatusEnum, Modal, NewAddressPage as NewAddressScreen, NotificationBell, NotificationCard, NotificationCenterProvider, NotificationDrawer, NotificationSettingsScreen, OrderCard, OrderCardSkeleton, OrderOrderTypeEnum, OrderReviewsScreen, OrderTimeLineDTOTypeEnum, OrderTypeEnum, OrdersScreen, PaymentPaymentMethodEnum, PaymentPaymentStatusEnum, PaymentTimeLineDTOTitleEnum, PopulatedDiscountStateEnum, PopulatedDiscountTypeEnum, PopulatedDiscountValueTypeEnum, PopulatedOrderOrderTypeEnum, PopulatedOrderTypeEnum, PreferenceUpdateItemTypeEnum, ProductCard, ProductCardSkeleton, ProductDetailScreen, ProductReviewsSection, ProductVariantInventoryStatusEnum, AccountPage as ProfileScreen, RatingDistribution, RegisterScreen, ReorderProductsDtoContainerTypeEnum, ResetPasswordScreen, ReviewCard, ReviewForm, ReviewPromptBanner, ReviewsList, SearchPage as SearchResultsScreen, ShipmentDetailsDtoStatusEnum, ShippingInfoStatusEnum, ShopScreen, SingleProductMediaTypeEnum, Skeleton, StarRating, ThemeProvider, UpdateAddressDtoAddressTypeEnum, UpdateDiscountDtoStateEnum, UpdateDiscountDtoTypeEnum, UpdateDiscountDtoValueTypeEnum, UpdateManualShipmentStatusDtoStatusEnum, UpdateUserDtoCustomerTypeEnum, UpdateUserDtoRoleEnum, UserEntityCustomerTypeEnum, UserEntityRoleEnum, UserWithNoIdCustomerTypeEnum, UserWithNoIdRoleEnum, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCreateReview, useCurrentOrders, useDeleteReview, useNotificationCenter, useOrder, useOrders, useProduct, useProductReviews, useProducts, useReviewStats, useReviewsByRating, useStoreCapabilities, useTheme, useUpdateReview, useUserReviews, useWishlist };
22325
+ export { AccountReviewsTab, AddressAddressTypeEnum, AddressCreatedRequestAddressTypeEnum, AddressesScreen, ApiKeyInfoDtoKeyTypeEnum, AuthProvider, Badge, BulkChannelToggleDtoCategoryEnum, Button, CampaignDraftDtoStatusEnum, CampaignDraftScheduleDtoStatusEnum, CampaignDraftSendingDtoStatusEnum, CartItem, CartProvider, CartScreen, ChangePasswordScreen, CheckoutScreen, CreateAddressDtoAddressTypeEnum, CreateDiscountDtoStateEnum, CreateDiscountDtoTypeEnum, CreateDiscountDtoValueTypeEnum, CreateStoreAddressDtoAddressTypeEnum, CreateUserDtoCustomerTypeEnum, CreateUserDtoRoleEnum, CurrentOrdersScreen, DiscountStateEnum, DiscountTypeEnum, DiscountValueTypeEnum, EcommerceProvider, EditProfileScreen, EmptyState, Footer, ForgotPasswordScreen, Header, Input, LoginScreen, ManualDiscountDtoValueTypeEnum, ManualOrderDTOOrderStatusEnum, ManualOrderDTOPaymentMethodEnum, ManualOrderDTOPaymentStatusEnum, Modal, NewAddressPage as NewAddressScreen, NotificationBell, NotificationCard, NotificationCenterProvider, NotificationDrawer, NotificationSettingsScreen, OrderCard, OrderCardSkeleton, OrderDetailScreen, OrderOrderTypeEnum, OrderReviewsScreen, OrderTimeLineDTOTypeEnum, OrderTypeEnum, OrdersScreen, PaymentPaymentMethodEnum, PaymentPaymentStatusEnum, PaymentTimeLineDTOTitleEnum, PopulatedDiscountStateEnum, PopulatedDiscountTypeEnum, PopulatedDiscountValueTypeEnum, PopulatedOrderOrderTypeEnum, PopulatedOrderTypeEnum, PreferenceUpdateItemTypeEnum, ProductCard, ProductCardSkeleton, ProductDetailScreen, ProductReviewsSection, ProductVariantInventoryStatusEnum, AccountPage as ProfileScreen, RatingDistribution, RegisterScreen, ReorderProductsDtoContainerTypeEnum, ResetPasswordScreen, ReviewCard, ReviewForm, ReviewPromptBanner, ReviewsList, SearchPage as SearchResultsScreen, ShipmentDetailsDtoStatusEnum, ShippingInfoStatusEnum, ShopScreen, SingleProductMediaTypeEnum, Skeleton, StarRating, ThemeProvider, UpdateAddressDtoAddressTypeEnum, UpdateDiscountDtoStateEnum, UpdateDiscountDtoTypeEnum, UpdateDiscountDtoValueTypeEnum, UpdateManualShipmentStatusDtoStatusEnum, UpdateUserDtoCustomerTypeEnum, UpdateUserDtoRoleEnum, UserEntityCustomerTypeEnum, UserEntityRoleEnum, UserWithNoIdCustomerTypeEnum, UserWithNoIdRoleEnum, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCreateReview, useCurrentOrders, useDeleteReview, useNotificationCenter, useOrder, useOrders, useProduct, useProductReviews, useProducts, useReviewStats, useReviewsByRating, useStoreCapabilities, useTheme, useUpdateReview, useUserReviews, useWishlist };
22158
22326
  //# sourceMappingURL=index.mjs.map
22159
22327
  //# sourceMappingURL=index.mjs.map