hey-pharmacist-ecommerce 1.1.33 → 1.1.35
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.js +71 -105
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -105
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountOrdersTab.tsx +1 -1
- package/src/components/CartItem.tsx +1 -1
- package/src/components/NotificationDrawer.tsx +2 -2
- package/src/components/OrderCard.tsx +1 -1
- package/src/components/ProductCard.tsx +1 -1
- package/src/components/ui/Button.tsx +1 -1
- package/src/screens/ChangePasswordScreen.tsx +3 -1
- package/src/screens/CheckoutScreen.tsx +2 -2
- package/src/screens/OrderDetailScreen.tsx +1 -1
- package/src/screens/ProductDetailScreen.tsx +1 -1
- package/src/screens/ProfileScreen.tsx +2 -4
- package/src/screens/ShopScreen.tsx +1 -1
- package/src/screens/WishlistScreen.tsx +1 -1
- package/src/components/AccountSavedItemsTab.tsx +0 -75
package/dist/index.mjs
CHANGED
|
@@ -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: [
|
|
@@ -13288,7 +13287,7 @@ function ProductCard({
|
|
|
13288
13287
|
return selectedVariant ? selectedVariant.inventoryCount : product.variants?.[0]?.inventoryCount;
|
|
13289
13288
|
}, [selectedVariant, product.variants]);
|
|
13290
13289
|
const imageSource = useMemo(() => {
|
|
13291
|
-
const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.
|
|
13290
|
+
const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.png";
|
|
13292
13291
|
return {
|
|
13293
13292
|
src,
|
|
13294
13293
|
alt: product.name || "Product image"
|
|
@@ -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"
|
|
@@ -14591,7 +14590,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
14591
14590
|
/* @__PURE__ */ jsx("div", { className: "relative h-48 w-full overflow-hidden rounded-2xl bg-gray-100 md:h-40 md:w-40", children: /* @__PURE__ */ jsx(
|
|
14592
14591
|
Image4,
|
|
14593
14592
|
{
|
|
14594
|
-
src: product.media?.[0]?.file || "/placeholder-product.
|
|
14593
|
+
src: product.media?.[0]?.file || "/placeholder-product.png",
|
|
14595
14594
|
alt: product.name,
|
|
14596
14595
|
fill: true,
|
|
14597
14596
|
className: "object-cover transition duration-500 group-hover:scale-105"
|
|
@@ -15511,7 +15510,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
15511
15510
|
/* @__PURE__ */ jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
|
|
15512
15511
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant) => {
|
|
15513
15512
|
const isSelected = selectedVariant?._id === variant._id;
|
|
15514
|
-
const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.
|
|
15513
|
+
const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.png";
|
|
15515
15514
|
return /* @__PURE__ */ jsxs(
|
|
15516
15515
|
"button",
|
|
15517
15516
|
{
|
|
@@ -15718,7 +15717,7 @@ function CartItem({ item }) {
|
|
|
15718
15717
|
/* @__PURE__ */ jsx("div", { className: "w-28 h-28 rounded-[16px] overflow-hidden bg-gray-50 shrink-0", children: /* @__PURE__ */ jsx(
|
|
15719
15718
|
Image4,
|
|
15720
15719
|
{
|
|
15721
|
-
src: item.productVariantData.media[0]?.file || "/placeholder-product.
|
|
15720
|
+
src: item.productVariantData.media[0]?.file || "/placeholder-product.png",
|
|
15722
15721
|
alt: item.productVariantData.name,
|
|
15723
15722
|
className: "w-full h-full object-cover",
|
|
15724
15723
|
height: 112,
|
|
@@ -17135,7 +17134,7 @@ function CheckoutScreen() {
|
|
|
17135
17134
|
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
17136
17135
|
Image4,
|
|
17137
17136
|
{
|
|
17138
|
-
src: rate.providerImage75 || "/placeholder-product.
|
|
17137
|
+
src: rate.providerImage75 || "/placeholder-product.png",
|
|
17139
17138
|
alt: rate.provider,
|
|
17140
17139
|
className: "w-12 h-12 rounded-lg object-contain bg-white border border-gray-200 p-1",
|
|
17141
17140
|
onError: (e) => {
|
|
@@ -17220,7 +17219,7 @@ function CheckoutScreen() {
|
|
|
17220
17219
|
/* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
|
|
17221
17220
|
/* @__PURE__ */ jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
|
|
17222
17221
|
/* @__PURE__ */ jsx("div", { className: "space-y-4 mb-6", children: cart?.cartBody?.items?.map((item) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
17223
|
-
/* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsx(Image4, { src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.
|
|
17222
|
+
/* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsx(Image4, { src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.png", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
|
|
17224
17223
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
17225
17224
|
/* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
|
|
17226
17225
|
/* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
|
|
@@ -18402,7 +18401,7 @@ function AccountOrdersTab() {
|
|
|
18402
18401
|
/* @__PURE__ */ jsx("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
18403
18402
|
Image4,
|
|
18404
18403
|
{
|
|
18405
|
-
src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.
|
|
18404
|
+
src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
|
|
18406
18405
|
alt: item?.productVariantData?.name || "Product image",
|
|
18407
18406
|
fill: true,
|
|
18408
18407
|
className: "object-cover",
|
|
@@ -18425,94 +18424,6 @@ function AccountOrdersTab() {
|
|
|
18425
18424
|
);
|
|
18426
18425
|
}) });
|
|
18427
18426
|
}
|
|
18428
|
-
function useWishlistProducts(productIds = []) {
|
|
18429
|
-
const [products, setProducts] = useState([]);
|
|
18430
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
18431
|
-
const [error, setError] = useState(null);
|
|
18432
|
-
const [cache] = useState(() => /* @__PURE__ */ new Map());
|
|
18433
|
-
const uniqueIds = useMemo(
|
|
18434
|
-
() => Array.from(new Set((productIds || []).filter(Boolean))),
|
|
18435
|
-
[productIds]
|
|
18436
|
-
);
|
|
18437
|
-
const fetchProducts = useCallback(async () => {
|
|
18438
|
-
if (uniqueIds.length === 0) {
|
|
18439
|
-
setProducts([]);
|
|
18440
|
-
setIsLoading(false);
|
|
18441
|
-
setError(null);
|
|
18442
|
-
return;
|
|
18443
|
-
}
|
|
18444
|
-
setIsLoading(true);
|
|
18445
|
-
setError(null);
|
|
18446
|
-
try {
|
|
18447
|
-
const api = new ProductsApi(AXIOS_CONFIG);
|
|
18448
|
-
const results = await Promise.all(
|
|
18449
|
-
uniqueIds.map(async (id) => {
|
|
18450
|
-
if (cache.has(id)) return cache.get(id);
|
|
18451
|
-
const response = await api.getSingleProduct(id?._id || id || "");
|
|
18452
|
-
const product = response.data;
|
|
18453
|
-
cache.set(id, product);
|
|
18454
|
-
return product;
|
|
18455
|
-
})
|
|
18456
|
-
);
|
|
18457
|
-
setProducts(results);
|
|
18458
|
-
} catch (err) {
|
|
18459
|
-
setError(err);
|
|
18460
|
-
console.error("Failed to load wishlist products", err);
|
|
18461
|
-
} finally {
|
|
18462
|
-
setIsLoading(false);
|
|
18463
|
-
}
|
|
18464
|
-
}, [cache, uniqueIds]);
|
|
18465
|
-
useEffect(() => {
|
|
18466
|
-
fetchProducts();
|
|
18467
|
-
}, [fetchProducts]);
|
|
18468
|
-
return {
|
|
18469
|
-
products,
|
|
18470
|
-
isLoading,
|
|
18471
|
-
error,
|
|
18472
|
-
refetch: fetchProducts
|
|
18473
|
-
};
|
|
18474
|
-
}
|
|
18475
|
-
function AccountSavedItemsTab() {
|
|
18476
|
-
const { products: wishlistProductIds } = useWishlist();
|
|
18477
|
-
const { products: wishlistProducts, isLoading, error } = useWishlistProducts(
|
|
18478
|
-
wishlistProductIds
|
|
18479
|
-
);
|
|
18480
|
-
const products = wishlistProducts || [];
|
|
18481
|
-
if (isLoading) {
|
|
18482
|
-
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsx(
|
|
18483
|
-
"div",
|
|
18484
|
-
{
|
|
18485
|
-
className: "h-80 animate-pulse rounded-lg border border-slate-100 bg-slate-50"
|
|
18486
|
-
},
|
|
18487
|
-
index
|
|
18488
|
-
)) }) });
|
|
18489
|
-
}
|
|
18490
|
-
if (error) {
|
|
18491
|
-
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-red-100 bg-red-50 p-6 text-sm text-red-700", children: error.message }) });
|
|
18492
|
-
}
|
|
18493
|
-
if (products.length === 0) {
|
|
18494
|
-
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsx(
|
|
18495
|
-
EmptyState,
|
|
18496
|
-
{
|
|
18497
|
-
icon: Heart,
|
|
18498
|
-
title: "No saved items",
|
|
18499
|
-
description: "Items you save will appear here for easy access later."
|
|
18500
|
-
}
|
|
18501
|
-
) });
|
|
18502
|
-
}
|
|
18503
|
-
return /* @__PURE__ */ jsx("div", { className: "pb-24 p-6", children: /* @__PURE__ */ jsxs("div", { className: "p-6 bg-white rounded-xl", children: [
|
|
18504
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
|
|
18505
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-secondary", children: "Saved for Later" }),
|
|
18506
|
-
/* @__PURE__ */ jsxs("p", { className: "text-sm text-secondary", children: [
|
|
18507
|
-
products.length,
|
|
18508
|
-
" ",
|
|
18509
|
-
products.length === 1 ? "item" : "items",
|
|
18510
|
-
" saved"
|
|
18511
|
-
] })
|
|
18512
|
-
] }),
|
|
18513
|
-
/* @__PURE__ */ jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: products.map((product) => /* @__PURE__ */ jsx(ProductCard, { product }, product._id)) })
|
|
18514
|
-
] }) });
|
|
18515
|
-
}
|
|
18516
18427
|
function ConfirmModal({
|
|
18517
18428
|
isOpen,
|
|
18518
18429
|
onClose,
|
|
@@ -18917,7 +18828,6 @@ var tabs = [
|
|
|
18917
18828
|
{ id: "overview", label: "Overview", icon: User },
|
|
18918
18829
|
{ id: "orders", label: "Orders", icon: Package },
|
|
18919
18830
|
{ id: "reviews", label: "My Reviews", icon: Star },
|
|
18920
|
-
{ id: "saved-items", label: "Saved Items", icon: Heart },
|
|
18921
18831
|
// { id: 'payment', label: 'Payment', icon: CreditCard },
|
|
18922
18832
|
{ id: "addresses", label: "Addresses", icon: MapPin },
|
|
18923
18833
|
{ id: "settings", label: "Settings", icon: Settings }
|
|
@@ -18951,8 +18861,8 @@ function AccountPage() {
|
|
|
18951
18861
|
return /* @__PURE__ */ jsx(AccountOrdersTab, {});
|
|
18952
18862
|
case "reviews":
|
|
18953
18863
|
return /* @__PURE__ */ jsx(AccountReviewsTab, {});
|
|
18954
|
-
case
|
|
18955
|
-
|
|
18864
|
+
// case 'saved-items':
|
|
18865
|
+
// return <AccountSavedItemsTab />;
|
|
18956
18866
|
// case 'payment':
|
|
18957
18867
|
// return <AccountPaymentTab />;
|
|
18958
18868
|
case "addresses":
|
|
@@ -19047,7 +18957,7 @@ function OrderCard({ order, onDelete }) {
|
|
|
19047
18957
|
/* @__PURE__ */ jsx("div", { className: "relative w-12 h-12 rounded-sm bg-gray-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
19048
18958
|
Image4,
|
|
19049
18959
|
{
|
|
19050
|
-
src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.
|
|
18960
|
+
src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
|
|
19051
18961
|
alt: item?.productVariantData?.name || "Product image",
|
|
19052
18962
|
fill: true,
|
|
19053
18963
|
className: "object-cover",
|
|
@@ -20015,6 +19925,53 @@ You can add it back at any time.`
|
|
|
20015
19925
|
)
|
|
20016
19926
|
] });
|
|
20017
19927
|
}
|
|
19928
|
+
function useWishlistProducts(productIds = []) {
|
|
19929
|
+
const [products, setProducts] = useState([]);
|
|
19930
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
19931
|
+
const [error, setError] = useState(null);
|
|
19932
|
+
const [cache] = useState(() => /* @__PURE__ */ new Map());
|
|
19933
|
+
const uniqueIds = useMemo(
|
|
19934
|
+
() => Array.from(new Set((productIds || []).filter(Boolean))),
|
|
19935
|
+
[productIds]
|
|
19936
|
+
);
|
|
19937
|
+
const fetchProducts = useCallback(async () => {
|
|
19938
|
+
if (uniqueIds.length === 0) {
|
|
19939
|
+
setProducts([]);
|
|
19940
|
+
setIsLoading(false);
|
|
19941
|
+
setError(null);
|
|
19942
|
+
return;
|
|
19943
|
+
}
|
|
19944
|
+
setIsLoading(true);
|
|
19945
|
+
setError(null);
|
|
19946
|
+
try {
|
|
19947
|
+
const api = new ProductsApi(AXIOS_CONFIG);
|
|
19948
|
+
const results = await Promise.all(
|
|
19949
|
+
uniqueIds.map(async (id) => {
|
|
19950
|
+
if (cache.has(id)) return cache.get(id);
|
|
19951
|
+
const response = await api.getSingleProduct(id?._id || id || "");
|
|
19952
|
+
const product = response.data;
|
|
19953
|
+
cache.set(id, product);
|
|
19954
|
+
return product;
|
|
19955
|
+
})
|
|
19956
|
+
);
|
|
19957
|
+
setProducts(results);
|
|
19958
|
+
} catch (err) {
|
|
19959
|
+
setError(err);
|
|
19960
|
+
console.error("Failed to load wishlist products", err);
|
|
19961
|
+
} finally {
|
|
19962
|
+
setIsLoading(false);
|
|
19963
|
+
}
|
|
19964
|
+
}, [cache, uniqueIds]);
|
|
19965
|
+
useEffect(() => {
|
|
19966
|
+
fetchProducts();
|
|
19967
|
+
}, [fetchProducts]);
|
|
19968
|
+
return {
|
|
19969
|
+
products,
|
|
19970
|
+
isLoading,
|
|
19971
|
+
error,
|
|
19972
|
+
refetch: fetchProducts
|
|
19973
|
+
};
|
|
19974
|
+
}
|
|
20018
19975
|
var SORT_OPTIONS = [
|
|
20019
19976
|
{ value: "featured", label: "Most loved" },
|
|
20020
19977
|
{ value: "price-low", label: "Price: Low to High" },
|
|
@@ -20269,7 +20226,7 @@ function WishlistScreen() {
|
|
|
20269
20226
|
Image4,
|
|
20270
20227
|
{
|
|
20271
20228
|
fill: true,
|
|
20272
|
-
src: product.media?.[0]?.file || "/placeholder-product.
|
|
20229
|
+
src: product.media?.[0]?.file || "/placeholder-product.png",
|
|
20273
20230
|
alt: product.name || "Wishlist item",
|
|
20274
20231
|
className: "h-full w-full object-cover"
|
|
20275
20232
|
}
|
|
@@ -21715,7 +21672,7 @@ function OrderDetailScreen({ id }) {
|
|
|
21715
21672
|
/* @__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
21673
|
Image4,
|
|
21717
21674
|
{
|
|
21718
|
-
src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.
|
|
21675
|
+
src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
|
|
21719
21676
|
alt: item.productVariantData?.name || "Item",
|
|
21720
21677
|
fill: true,
|
|
21721
21678
|
className: "object-cover",
|
|
@@ -21932,7 +21889,16 @@ function ChangePasswordScreen() {
|
|
|
21932
21889
|
}
|
|
21933
21890
|
),
|
|
21934
21891
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
|
|
21935
|
-
/* @__PURE__ */ jsx(
|
|
21892
|
+
/* @__PURE__ */ jsx(
|
|
21893
|
+
Button,
|
|
21894
|
+
{
|
|
21895
|
+
variant: "primary",
|
|
21896
|
+
type: "submit",
|
|
21897
|
+
size: "lg",
|
|
21898
|
+
isLoading: isSubmitting,
|
|
21899
|
+
children: "Save password"
|
|
21900
|
+
}
|
|
21901
|
+
),
|
|
21936
21902
|
/* @__PURE__ */ jsx(
|
|
21937
21903
|
Button,
|
|
21938
21904
|
{
|