hey-pharmacist-ecommerce 1.1.32 → 1.1.34
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.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +356 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +356 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/NotificationDrawer.tsx +2 -2
- package/src/components/ui/Button.tsx +1 -1
- package/src/index.ts +3 -0
- package/src/screens/ChangePasswordScreen.tsx +3 -1
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, LogOut, Menu, Facebook, Twitter, Instagram, Shirt, Pill, Box, TrendingDown,
|
|
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';
|
|
@@ -12861,7 +12861,6 @@ function NotificationDrawer() {
|
|
|
12861
12861
|
closeDrawer();
|
|
12862
12862
|
router.push(buildPath("/account/notifications"));
|
|
12863
12863
|
};
|
|
12864
|
-
console.log(notifications);
|
|
12865
12864
|
return /* @__PURE__ */ jsx(AnimatePresence, { children: isDrawerOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12866
12865
|
/* @__PURE__ */ jsx(
|
|
12867
12866
|
motion.div,
|
|
@@ -12880,7 +12879,7 @@ function NotificationDrawer() {
|
|
|
12880
12879
|
animate: { x: 0 },
|
|
12881
12880
|
exit: { x: "100%" },
|
|
12882
12881
|
transition: { type: "spring", damping: 25, stiffness: 200 },
|
|
12883
|
-
className: "fixed right-0 top-0 bottom-0 w-full sm:w-[480px] bg-white shadow-2xl z-50 flex flex-col",
|
|
12882
|
+
className: "fixed right-0 top-0 bottom-0 w-full sm:w-[480px] bg-white shadow-2xl z-50 flex flex-col max-w-[480px]",
|
|
12884
12883
|
children: [
|
|
12885
12884
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 bg-white", children: [
|
|
12886
12885
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
@@ -13518,7 +13517,7 @@ function Button({
|
|
|
13518
13517
|
}) {
|
|
13519
13518
|
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";
|
|
13520
13519
|
const variants = {
|
|
13521
|
-
primary: "bg-
|
|
13520
|
+
primary: "bg-[#0E172B] text-white hover:bg-[#0E172B]/80 shadow-lg shadow-[#0E172B]/30 hover:shadow-xl hover:shadow-[#0E172B]/40",
|
|
13522
13521
|
secondary: "bg-secondary-600 text-white hover:bg-secondary-700 shadow-lg shadow-secondary-500/30 hover:shadow-xl hover:shadow-secondary-500/40",
|
|
13523
13522
|
"outline-solid": "border-2 border-primary-600 text-primary-600 hover:bg-primary-50",
|
|
13524
13523
|
ghost: "text-gray-700 hover:bg-gray-100"
|
|
@@ -21611,6 +21610,358 @@ function NotificationSettingsScreen() {
|
|
|
21611
21610
|
] })
|
|
21612
21611
|
] });
|
|
21613
21612
|
}
|
|
21613
|
+
function OrderDetailScreen({ id }) {
|
|
21614
|
+
const router = useRouter();
|
|
21615
|
+
const { buildPath } = useBasePath();
|
|
21616
|
+
const { order, isLoading, error } = useOrder(id);
|
|
21617
|
+
if (isLoading) {
|
|
21618
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-slate-50 flex flex-col items-center justify-center p-4", children: [
|
|
21619
|
+
/* @__PURE__ */ jsx("div", { className: "w-16 h-16 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb-4" }),
|
|
21620
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted font-medium animate-pulse", children: "Retrieving order details..." })
|
|
21621
|
+
] });
|
|
21622
|
+
}
|
|
21623
|
+
if (error || !order) {
|
|
21624
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-slate-50 flex flex-col items-center justify-center p-4", children: [
|
|
21625
|
+
/* @__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" }) }),
|
|
21626
|
+
/* @__PURE__ */ jsx("h1", { className: "text-xl font-bold text-secondary mb-2", children: "Order Not Found" }),
|
|
21627
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted mb-6", children: "We couldn't find the order you're looking for." }),
|
|
21628
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => router.push(buildPath("/account")), children: "Back to Account" })
|
|
21629
|
+
] });
|
|
21630
|
+
}
|
|
21631
|
+
const items = order.items || [];
|
|
21632
|
+
const status = order.orderStatus || "Pending";
|
|
21633
|
+
const isDelivery = order.orderType === "Delivery";
|
|
21634
|
+
const getStatusVariant = (status2) => {
|
|
21635
|
+
switch (status2.toLowerCase()) {
|
|
21636
|
+
case "pending":
|
|
21637
|
+
return "warning";
|
|
21638
|
+
case "delivered":
|
|
21639
|
+
case "fulfilled":
|
|
21640
|
+
case "picked up":
|
|
21641
|
+
return "success";
|
|
21642
|
+
case "shipped":
|
|
21643
|
+
return "primary";
|
|
21644
|
+
case "cancelled":
|
|
21645
|
+
return "danger";
|
|
21646
|
+
default:
|
|
21647
|
+
return "gray";
|
|
21648
|
+
}
|
|
21649
|
+
};
|
|
21650
|
+
const shippingAddress = order.shippingInfo?.addressTo;
|
|
21651
|
+
const pickupAddress = order.pickUpAddress;
|
|
21652
|
+
const activeAddress = isDelivery ? shippingAddress : pickupAddress;
|
|
21653
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB] pb-20", children: [
|
|
21654
|
+
/* @__PURE__ */ jsxs("div", { className: "container mx-auto px-4 pt-8 max-w-6xl", children: [
|
|
21655
|
+
/* @__PURE__ */ jsxs(
|
|
21656
|
+
"button",
|
|
21657
|
+
{
|
|
21658
|
+
onClick: () => router.back(),
|
|
21659
|
+
className: "group flex items-center gap-2 text-muted hover:text-secondary transition-colors mb-6",
|
|
21660
|
+
children: [
|
|
21661
|
+
/* @__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" }) }),
|
|
21662
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: "Back to History" })
|
|
21663
|
+
]
|
|
21664
|
+
}
|
|
21665
|
+
),
|
|
21666
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8", children: [
|
|
21667
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
21668
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
21669
|
+
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold text-secondary", children: "Order Details" }),
|
|
21670
|
+
/* @__PURE__ */ jsx(Badge, { variant: getStatusVariant(status), children: status }),
|
|
21671
|
+
/* @__PURE__ */ jsx(Badge, { variant: "primary", className: "bg-primary-100 text-primary-700 border-primary-200", children: order.orderType || "Pickup" })
|
|
21672
|
+
] }),
|
|
21673
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-2 text-sm text-muted", children: [
|
|
21674
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 font-medium", children: [
|
|
21675
|
+
/* @__PURE__ */ jsx("span", { className: "opacity-60 text-xs uppercase tracking-widest font-bold", children: "ID:" }),
|
|
21676
|
+
/* @__PURE__ */ jsxs("span", { className: "text-secondary font-mono tracking-tight", children: [
|
|
21677
|
+
"#",
|
|
21678
|
+
id.toUpperCase()
|
|
21679
|
+
] })
|
|
21680
|
+
] }),
|
|
21681
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 font-medium", children: [
|
|
21682
|
+
/* @__PURE__ */ jsx(Calendar, { className: "w-4 h-4 opacity-60" }),
|
|
21683
|
+
formatDate(order.createdAt || /* @__PURE__ */ new Date(), "long")
|
|
21684
|
+
] })
|
|
21685
|
+
] })
|
|
21686
|
+
] }),
|
|
21687
|
+
/* @__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: [
|
|
21688
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "w-4 h-4" }),
|
|
21689
|
+
"Payment Details"
|
|
21690
|
+
] }) })
|
|
21691
|
+
] })
|
|
21692
|
+
] }),
|
|
21693
|
+
/* @__PURE__ */ jsxs("div", { className: "container mx-auto px-4 max-w-6xl grid grid-cols-1 lg:grid-cols-3 gap-8", children: [
|
|
21694
|
+
/* @__PURE__ */ jsxs("div", { className: "lg:col-span-2 space-y-6", children: [
|
|
21695
|
+
/* @__PURE__ */ jsxs(
|
|
21696
|
+
motion.div,
|
|
21697
|
+
{
|
|
21698
|
+
initial: { opacity: 0, y: 20 },
|
|
21699
|
+
animate: { opacity: 1, y: 0 },
|
|
21700
|
+
className: "bg-white rounded-3xl border border-slate-200 shadow-xs overflow-hidden",
|
|
21701
|
+
children: [
|
|
21702
|
+
/* @__PURE__ */ jsxs("div", { className: "p-6 border-b border-slate-100 bg-slate-50/50 flex items-center justify-between", children: [
|
|
21703
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
21704
|
+
/* @__PURE__ */ jsx(Package, { className: "w-5 h-5 text-secondary" }),
|
|
21705
|
+
/* @__PURE__ */ jsx("h2", { className: "font-bold text-secondary", children: "Order Items" })
|
|
21706
|
+
] }),
|
|
21707
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-bold bg-slate-200 text-muted px-2.5 py-1 rounded-full", children: [
|
|
21708
|
+
items.length,
|
|
21709
|
+
" ",
|
|
21710
|
+
items.length === 1 ? "Product" : "Products"
|
|
21711
|
+
] })
|
|
21712
|
+
] }),
|
|
21713
|
+
/* @__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: [
|
|
21714
|
+
/* @__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(
|
|
21715
|
+
Image4,
|
|
21716
|
+
{
|
|
21717
|
+
src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
|
|
21718
|
+
alt: item.productVariantData?.name || "Item",
|
|
21719
|
+
fill: true,
|
|
21720
|
+
className: "object-cover",
|
|
21721
|
+
sizes: "80px"
|
|
21722
|
+
}
|
|
21723
|
+
) }),
|
|
21724
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col justify-between py-1", children: [
|
|
21725
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
21726
|
+
/* @__PURE__ */ jsx("h3", { className: "font-bold text-secondary text-lg group-hover:text-primary transition-colors leading-snug mb-1", children: item.productVariantData?.name }),
|
|
21727
|
+
/* @__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: [
|
|
21728
|
+
/* @__PURE__ */ jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-slate-300" }),
|
|
21729
|
+
"Quantity: ",
|
|
21730
|
+
/* @__PURE__ */ jsx("span", { className: "text-secondary font-bold", children: item.quantity })
|
|
21731
|
+
] }) })
|
|
21732
|
+
] }),
|
|
21733
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
21734
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted text-sm", children: [
|
|
21735
|
+
formatPrice(item.productVariantData?.finalPrice || 0),
|
|
21736
|
+
" per unit"
|
|
21737
|
+
] }),
|
|
21738
|
+
/* @__PURE__ */ jsx("span", { className: "font-black text-secondary", children: formatPrice((item.productVariantData?.finalPrice || 0) * item.quantity) })
|
|
21739
|
+
] })
|
|
21740
|
+
] })
|
|
21741
|
+
] }, item._id || idx)) })
|
|
21742
|
+
]
|
|
21743
|
+
}
|
|
21744
|
+
),
|
|
21745
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
|
|
21746
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-white p-6 rounded-3xl border border-slate-200 shadow-xs", children: [
|
|
21747
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
21748
|
+
/* @__PURE__ */ jsx(MapPin, { className: "w-5 h-5 text-accent" }),
|
|
21749
|
+
/* @__PURE__ */ jsx("h3", { className: "font-bold text-secondary", children: isDelivery ? "Shipping Address" : "Pickup Location" })
|
|
21750
|
+
] }),
|
|
21751
|
+
activeAddress ? /* @__PURE__ */ jsxs("div", { className: "text-sm text-muted leading-relaxed", children: [
|
|
21752
|
+
/* @__PURE__ */ jsx("p", { className: "font-bold text-secondary text-base mb-1", children: activeAddress.name }),
|
|
21753
|
+
/* @__PURE__ */ jsx("p", { children: activeAddress.street1 }),
|
|
21754
|
+
activeAddress.street2 && /* @__PURE__ */ jsx("p", { children: activeAddress.street2 }),
|
|
21755
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
21756
|
+
activeAddress.city,
|
|
21757
|
+
", ",
|
|
21758
|
+
activeAddress.state,
|
|
21759
|
+
" ",
|
|
21760
|
+
activeAddress.zip
|
|
21761
|
+
] }),
|
|
21762
|
+
/* @__PURE__ */ jsx("p", { children: activeAddress.country })
|
|
21763
|
+
] }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-muted italic", children: "No address recorded" })
|
|
21764
|
+
] }),
|
|
21765
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-white p-6 rounded-3xl border border-slate-200 shadow-xs", children: [
|
|
21766
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
21767
|
+
/* @__PURE__ */ jsx(CreditCard, { className: "w-5 h-5 text-accent" }),
|
|
21768
|
+
/* @__PURE__ */ jsx("h3", { className: "font-bold text-secondary", children: "Payment Method" })
|
|
21769
|
+
] }),
|
|
21770
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm text-muted leading-relaxed", children: [
|
|
21771
|
+
/* @__PURE__ */ jsx("p", { className: "font-bold text-secondary text-base mb-1", children: order.payment?.paymentMethod ? order.payment.paymentMethod.replace("_", " ").toUpperCase() : "N/A" }),
|
|
21772
|
+
/* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 mt-2", children: [
|
|
21773
|
+
/* @__PURE__ */ jsx("span", { className: "opacity-60", children: "Status:" }),
|
|
21774
|
+
/* @__PURE__ */ jsx(Badge, { variant: order.payment?.paymentStatus === "Paid" ? "success" : "warning", children: order.payment?.paymentStatus || "Processing" })
|
|
21775
|
+
] }),
|
|
21776
|
+
order.payment?.transactionId && /* @__PURE__ */ jsxs("p", { className: "mt-3 text-[10px] font-bold text-slate-400 uppercase tracking-tighter", children: [
|
|
21777
|
+
"Ref: ",
|
|
21778
|
+
order.payment.transactionId
|
|
21779
|
+
] })
|
|
21780
|
+
] })
|
|
21781
|
+
] })
|
|
21782
|
+
] })
|
|
21783
|
+
] }),
|
|
21784
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsxs(
|
|
21785
|
+
motion.div,
|
|
21786
|
+
{
|
|
21787
|
+
initial: { opacity: 0, x: 20 },
|
|
21788
|
+
animate: { opacity: 1, x: 0 },
|
|
21789
|
+
className: "bg-secondary p-8 rounded-[2rem] text-white shadow-xl shadow-secondary/20 sticky top-8",
|
|
21790
|
+
children: [
|
|
21791
|
+
/* @__PURE__ */ jsx("h2", { className: "text-xl font-bold mb-6 flex items-center gap-2", children: "Summary View" }),
|
|
21792
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4 mb-8", children: [
|
|
21793
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
|
|
21794
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Subtotal" }),
|
|
21795
|
+
/* @__PURE__ */ jsx("span", { className: "font-bold text-white", children: formatPrice(order.subTotal || 0) })
|
|
21796
|
+
] }),
|
|
21797
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
|
|
21798
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Shipping" }),
|
|
21799
|
+
/* @__PURE__ */ jsx("span", { className: "font-bold text-white", children: formatPrice(order.shippingCost || 0) })
|
|
21800
|
+
] }),
|
|
21801
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-white/70", children: [
|
|
21802
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Tax" }),
|
|
21803
|
+
/* @__PURE__ */ jsx("span", { className: "font-bold text-white", children: formatPrice(order.tax || 0) })
|
|
21804
|
+
] }),
|
|
21805
|
+
order.discountedAmount !== void 0 && order.discountedAmount > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-primary", children: [
|
|
21806
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Discount" }),
|
|
21807
|
+
/* @__PURE__ */ jsxs("span", { className: "font-bold", children: [
|
|
21808
|
+
"-",
|
|
21809
|
+
formatPrice(order.discountedAmount)
|
|
21810
|
+
] })
|
|
21811
|
+
] }),
|
|
21812
|
+
/* @__PURE__ */ jsx("div", { className: "pt-4 border-t border-white/10 mt-4", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-end", children: [
|
|
21813
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
21814
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-black uppercase tracking-[0.2em] text-white/40 mb-1", children: "Grand Total" }),
|
|
21815
|
+
/* @__PURE__ */ jsx("p", { className: "text-3xl font-black", children: formatPrice(order.grandTotal || 0) })
|
|
21816
|
+
] }),
|
|
21817
|
+
/* @__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" })
|
|
21818
|
+
] }) })
|
|
21819
|
+
] }),
|
|
21820
|
+
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: [
|
|
21821
|
+
/* @__PURE__ */ jsx(Info, { className: "w-5 h-5 text-primary shrink-0 mt-0.5" }),
|
|
21822
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
21823
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-bold mb-1", children: "Order is processing" }),
|
|
21824
|
+
/* @__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." })
|
|
21825
|
+
] })
|
|
21826
|
+
] }) })
|
|
21827
|
+
]
|
|
21828
|
+
}
|
|
21829
|
+
) })
|
|
21830
|
+
] })
|
|
21831
|
+
] });
|
|
21832
|
+
}
|
|
21833
|
+
init_config();
|
|
21834
|
+
var changePasswordSchema = z.object({
|
|
21835
|
+
currentPassword: z.string().min(6, "Current password is required"),
|
|
21836
|
+
newPassword: z.string().min(8, "Password must be at least 8 characters"),
|
|
21837
|
+
confirmPassword: z.string().min(8, "Confirm your new password")
|
|
21838
|
+
}).refine((data) => data.newPassword === data.confirmPassword, {
|
|
21839
|
+
path: ["confirmPassword"],
|
|
21840
|
+
message: "Passwords do not match"
|
|
21841
|
+
});
|
|
21842
|
+
function ChangePasswordScreen() {
|
|
21843
|
+
const router = useRouter();
|
|
21844
|
+
const { user } = useAuth();
|
|
21845
|
+
const { buildPath } = useBasePath();
|
|
21846
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
21847
|
+
const [status, setStatus] = useState(
|
|
21848
|
+
null
|
|
21849
|
+
);
|
|
21850
|
+
const {
|
|
21851
|
+
register,
|
|
21852
|
+
handleSubmit,
|
|
21853
|
+
formState: { errors }
|
|
21854
|
+
} = useForm({
|
|
21855
|
+
resolver: zodResolver(changePasswordSchema)
|
|
21856
|
+
});
|
|
21857
|
+
if (!user) {
|
|
21858
|
+
router.push(buildPath("/login"));
|
|
21859
|
+
return null;
|
|
21860
|
+
}
|
|
21861
|
+
const onSubmit = async (data) => {
|
|
21862
|
+
setIsSubmitting(true);
|
|
21863
|
+
setStatus(null);
|
|
21864
|
+
try {
|
|
21865
|
+
await changePassword(data.currentPassword, data.newPassword);
|
|
21866
|
+
setStatus({ type: "success", message: "Password updated successfully" });
|
|
21867
|
+
setTimeout(() => router.push(buildPath("/account")), 600);
|
|
21868
|
+
} catch (error) {
|
|
21869
|
+
setStatus({
|
|
21870
|
+
type: "error",
|
|
21871
|
+
message: error?.response?.data?.message || "Unable to update password"
|
|
21872
|
+
});
|
|
21873
|
+
} finally {
|
|
21874
|
+
setIsSubmitting(false);
|
|
21875
|
+
}
|
|
21876
|
+
};
|
|
21877
|
+
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(
|
|
21878
|
+
motion.div,
|
|
21879
|
+
{
|
|
21880
|
+
initial: { opacity: 0, y: 18 },
|
|
21881
|
+
animate: { opacity: 1, y: 0 },
|
|
21882
|
+
className: "mx-auto max-w-2xl rounded-3xl border border-slate-200 bg-white p-8 shadow-xl shadow-primary-50",
|
|
21883
|
+
children: [
|
|
21884
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
21885
|
+
/* @__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" }) }),
|
|
21886
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
21887
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-[0.32em] text-slate-500", children: "Security" }),
|
|
21888
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold text-slate-900", children: "Change password" })
|
|
21889
|
+
] })
|
|
21890
|
+
] }),
|
|
21891
|
+
/* @__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." }),
|
|
21892
|
+
status && /* @__PURE__ */ jsxs(
|
|
21893
|
+
"div",
|
|
21894
|
+
{
|
|
21895
|
+
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"}`,
|
|
21896
|
+
children: [
|
|
21897
|
+
/* @__PURE__ */ jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
|
|
21898
|
+
/* @__PURE__ */ jsx("span", { children: status.message })
|
|
21899
|
+
]
|
|
21900
|
+
}
|
|
21901
|
+
),
|
|
21902
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "mt-8 space-y-5", children: [
|
|
21903
|
+
/* @__PURE__ */ jsx(
|
|
21904
|
+
Input,
|
|
21905
|
+
{
|
|
21906
|
+
type: "password",
|
|
21907
|
+
label: "Current password",
|
|
21908
|
+
placeholder: "Enter current password",
|
|
21909
|
+
...register("currentPassword"),
|
|
21910
|
+
error: errors.currentPassword?.message
|
|
21911
|
+
}
|
|
21912
|
+
),
|
|
21913
|
+
/* @__PURE__ */ jsx(
|
|
21914
|
+
Input,
|
|
21915
|
+
{
|
|
21916
|
+
type: "password",
|
|
21917
|
+
label: "New password",
|
|
21918
|
+
placeholder: "Enter new password",
|
|
21919
|
+
...register("newPassword"),
|
|
21920
|
+
error: errors.newPassword?.message
|
|
21921
|
+
}
|
|
21922
|
+
),
|
|
21923
|
+
/* @__PURE__ */ jsx(
|
|
21924
|
+
Input,
|
|
21925
|
+
{
|
|
21926
|
+
type: "password",
|
|
21927
|
+
label: "Confirm new password",
|
|
21928
|
+
placeholder: "Re-type new password",
|
|
21929
|
+
...register("confirmPassword"),
|
|
21930
|
+
error: errors.confirmPassword?.message
|
|
21931
|
+
}
|
|
21932
|
+
),
|
|
21933
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
|
|
21934
|
+
/* @__PURE__ */ jsx(
|
|
21935
|
+
Button,
|
|
21936
|
+
{
|
|
21937
|
+
variant: "primary",
|
|
21938
|
+
type: "submit",
|
|
21939
|
+
size: "lg",
|
|
21940
|
+
isLoading: isSubmitting,
|
|
21941
|
+
children: "Save password"
|
|
21942
|
+
}
|
|
21943
|
+
),
|
|
21944
|
+
/* @__PURE__ */ jsx(
|
|
21945
|
+
Button,
|
|
21946
|
+
{
|
|
21947
|
+
type: "button",
|
|
21948
|
+
variant: "outline-solid",
|
|
21949
|
+
size: "lg",
|
|
21950
|
+
className: "border-slate-300 text-slate-800 hover:bg-slate-50",
|
|
21951
|
+
onClick: () => router.push(buildPath("/account")),
|
|
21952
|
+
children: "Cancel"
|
|
21953
|
+
}
|
|
21954
|
+
)
|
|
21955
|
+
] })
|
|
21956
|
+
] }),
|
|
21957
|
+
/* @__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: [
|
|
21958
|
+
/* @__PURE__ */ jsx(ShieldCheck, { className: "h-4 w-4 text-primary-600" }),
|
|
21959
|
+
"Strong passwords and up-to-date contact details help pharmacists verify changes quickly."
|
|
21960
|
+
] })
|
|
21961
|
+
]
|
|
21962
|
+
}
|
|
21963
|
+
) }) });
|
|
21964
|
+
}
|
|
21614
21965
|
function NotificationBell() {
|
|
21615
21966
|
const { unreadCount, openDrawer } = useNotificationCenter();
|
|
21616
21967
|
return /* @__PURE__ */ jsxs(
|
|
@@ -21979,6 +22330,6 @@ function Footer() {
|
|
|
21979
22330
|
] }) });
|
|
21980
22331
|
}
|
|
21981
22332
|
|
|
21982
|
-
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 };
|
|
22333
|
+
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 };
|
|
21983
22334
|
//# sourceMappingURL=index.mjs.map
|
|
21984
22335
|
//# sourceMappingURL=index.mjs.map
|