hey-pharmacist-ecommerce 1.1.26 → 1.1.27
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +141 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/providers/WishlistProvider.tsx +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import React8, { createContext, forwardRef, useContext, useEffect, useState, use
|
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import globalAxios4 from 'axios';
|
|
5
5
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
6
|
-
import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, Package, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, AlertCircle, Lock, EyeOff, UserPlus, User, Settings, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, ArrowLeft, LogOut, Menu,
|
|
6
|
+
import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, Package, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, AlertCircle, Lock, EyeOff, UserPlus, User, Settings, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, ArrowLeft, Mail, LogOut, Menu, Facebook, Twitter, Instagram, Shirt, Pill, Box, ExternalLink, Globe, Home, CheckCircle, Edit, Bell, AlertTriangle, Info, XCircle } from 'lucide-react';
|
|
7
7
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
8
8
|
import { useRouter, useSearchParams } from 'next/navigation';
|
|
9
9
|
import Image4 from 'next/image';
|
|
@@ -13552,6 +13552,146 @@ function NewAddressPage() {
|
|
|
13552
13552
|
] }) }) }) })
|
|
13553
13553
|
] });
|
|
13554
13554
|
}
|
|
13555
|
+
var profileSchema = z.object({
|
|
13556
|
+
firstname: z.string().min(2, "First name is required"),
|
|
13557
|
+
lastname: z.string().min(2, "Last name is required"),
|
|
13558
|
+
email: z.string().email("Enter a valid email address"),
|
|
13559
|
+
phoneNumber: z.string().optional()
|
|
13560
|
+
});
|
|
13561
|
+
function EditProfileScreen() {
|
|
13562
|
+
const router = useRouter();
|
|
13563
|
+
const { user, updateUser } = useAuth();
|
|
13564
|
+
const { buildPath } = useBasePath();
|
|
13565
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
13566
|
+
const [status, setStatus] = useState(
|
|
13567
|
+
null
|
|
13568
|
+
);
|
|
13569
|
+
const {
|
|
13570
|
+
register,
|
|
13571
|
+
handleSubmit,
|
|
13572
|
+
formState: { errors }
|
|
13573
|
+
} = useForm({
|
|
13574
|
+
resolver: zodResolver(profileSchema),
|
|
13575
|
+
defaultValues: {
|
|
13576
|
+
firstname: user?.firstname || "",
|
|
13577
|
+
lastname: user?.lastname || "",
|
|
13578
|
+
email: user?.email || "",
|
|
13579
|
+
phoneNumber: user?.phoneNumber || ""
|
|
13580
|
+
}
|
|
13581
|
+
});
|
|
13582
|
+
if (!user) {
|
|
13583
|
+
router.push(buildPath("/login"));
|
|
13584
|
+
return null;
|
|
13585
|
+
}
|
|
13586
|
+
const onSubmit = async (data) => {
|
|
13587
|
+
setIsSubmitting(true);
|
|
13588
|
+
setStatus(null);
|
|
13589
|
+
try {
|
|
13590
|
+
await updateUser(data);
|
|
13591
|
+
setStatus({ type: "success", message: "Profile updated successfully" });
|
|
13592
|
+
router.push(buildPath("/account"));
|
|
13593
|
+
} catch (error) {
|
|
13594
|
+
setStatus({
|
|
13595
|
+
type: "error",
|
|
13596
|
+
message: error.response?.data?.message || "Failed to update profile"
|
|
13597
|
+
});
|
|
13598
|
+
} finally {
|
|
13599
|
+
setIsSubmitting(false);
|
|
13600
|
+
}
|
|
13601
|
+
};
|
|
13602
|
+
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(
|
|
13603
|
+
motion.div,
|
|
13604
|
+
{
|
|
13605
|
+
initial: { opacity: 0, y: 18 },
|
|
13606
|
+
animate: { opacity: 1, y: 0 },
|
|
13607
|
+
className: "mx-auto max-w-3xl rounded-3xl border border-slate-200 bg-white p-8 shadow-xl shadow-primary-50",
|
|
13608
|
+
children: [
|
|
13609
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
13610
|
+
/* @__PURE__ */ jsx("span", { className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-primary-50 text-primary-600", children: /* @__PURE__ */ jsx(User, { className: "h-5 w-5" }) }),
|
|
13611
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
13612
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-[0.32em] text-slate-500", children: "Profile" }),
|
|
13613
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold text-slate-900", children: "Edit core information" })
|
|
13614
|
+
] })
|
|
13615
|
+
] }),
|
|
13616
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-sm text-slate-600", children: "Update your name, email, and contact information so we can keep your deliveries and pharmacist support aligned with your preferences." }),
|
|
13617
|
+
status && /* @__PURE__ */ jsxs(
|
|
13618
|
+
"div",
|
|
13619
|
+
{
|
|
13620
|
+
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"}`,
|
|
13621
|
+
children: [
|
|
13622
|
+
/* @__PURE__ */ jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
|
|
13623
|
+
/* @__PURE__ */ jsx("span", { children: status.message })
|
|
13624
|
+
]
|
|
13625
|
+
}
|
|
13626
|
+
),
|
|
13627
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "mt-8 space-y-6", children: [
|
|
13628
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
13629
|
+
/* @__PURE__ */ jsx(
|
|
13630
|
+
Input,
|
|
13631
|
+
{
|
|
13632
|
+
label: "First name",
|
|
13633
|
+
placeholder: "Taylor",
|
|
13634
|
+
...register("firstname"),
|
|
13635
|
+
error: errors.firstname?.message
|
|
13636
|
+
}
|
|
13637
|
+
),
|
|
13638
|
+
/* @__PURE__ */ jsx(
|
|
13639
|
+
Input,
|
|
13640
|
+
{
|
|
13641
|
+
label: "Last name",
|
|
13642
|
+
placeholder: "Reed",
|
|
13643
|
+
...register("lastname"),
|
|
13644
|
+
error: errors.lastname?.message
|
|
13645
|
+
}
|
|
13646
|
+
)
|
|
13647
|
+
] }),
|
|
13648
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
13649
|
+
/* @__PURE__ */ jsx(
|
|
13650
|
+
Input,
|
|
13651
|
+
{
|
|
13652
|
+
type: "email",
|
|
13653
|
+
label: "Email address",
|
|
13654
|
+
placeholder: "you@example.com",
|
|
13655
|
+
className: "pl-10",
|
|
13656
|
+
...register("email"),
|
|
13657
|
+
error: errors.email?.message
|
|
13658
|
+
}
|
|
13659
|
+
),
|
|
13660
|
+
/* @__PURE__ */ jsx(Mail, { className: "absolute left-3 top-[38px] h-4 w-4 text-slate-400" })
|
|
13661
|
+
] }),
|
|
13662
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
13663
|
+
/* @__PURE__ */ jsx(
|
|
13664
|
+
Input,
|
|
13665
|
+
{
|
|
13666
|
+
type: "tel",
|
|
13667
|
+
label: "Phone number",
|
|
13668
|
+
placeholder: "+1 (555) 123-4567",
|
|
13669
|
+
className: "pl-10",
|
|
13670
|
+
...register("phoneNumber"),
|
|
13671
|
+
error: errors.phoneNumber?.message
|
|
13672
|
+
}
|
|
13673
|
+
),
|
|
13674
|
+
/* @__PURE__ */ jsx(Phone, { className: "absolute left-3 top-[38px] h-4 w-4 text-slate-400" })
|
|
13675
|
+
] }),
|
|
13676
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
|
|
13677
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", size: "lg", isLoading: isSubmitting, children: "Save changes" }),
|
|
13678
|
+
/* @__PURE__ */ jsx(
|
|
13679
|
+
Button,
|
|
13680
|
+
{
|
|
13681
|
+
type: "button",
|
|
13682
|
+
variant: "outline-solid",
|
|
13683
|
+
size: "lg",
|
|
13684
|
+
className: "border-slate-300 text-slate-800 hover:bg-slate-50",
|
|
13685
|
+
onClick: () => router.push(buildPath("/account")),
|
|
13686
|
+
children: "Cancel"
|
|
13687
|
+
}
|
|
13688
|
+
)
|
|
13689
|
+
] })
|
|
13690
|
+
] })
|
|
13691
|
+
]
|
|
13692
|
+
}
|
|
13693
|
+
) }) });
|
|
13694
|
+
}
|
|
13555
13695
|
function Header() {
|
|
13556
13696
|
const { config } = useTheme();
|
|
13557
13697
|
const { user, isAuthenticated, logout } = useAuth();
|
|
@@ -13889,6 +14029,6 @@ function Footer() {
|
|
|
13889
14029
|
] }) });
|
|
13890
14030
|
}
|
|
13891
14031
|
|
|
13892
|
-
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 };
|
|
14032
|
+
export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, CheckoutScreen, CurrentOrdersScreen, EcommerceProvider, EditProfileScreen, 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 };
|
|
13893
14033
|
//# sourceMappingURL=index.mjs.map
|
|
13894
14034
|
//# sourceMappingURL=index.mjs.map
|