hey-pharmacist-ecommerce 1.1.34 → 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 +59 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -101
- 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/OrderCard.tsx +1 -1
- package/src/components/ProductCard.tsx +1 -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.js
CHANGED
|
@@ -13297,7 +13297,7 @@ function ProductCard({
|
|
|
13297
13297
|
return selectedVariant ? selectedVariant.inventoryCount : product.variants?.[0]?.inventoryCount;
|
|
13298
13298
|
}, [selectedVariant, product.variants]);
|
|
13299
13299
|
const imageSource = React12.useMemo(() => {
|
|
13300
|
-
const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.
|
|
13300
|
+
const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.png";
|
|
13301
13301
|
return {
|
|
13302
13302
|
src,
|
|
13303
13303
|
alt: product.name || "Product image"
|
|
@@ -14600,7 +14600,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
14600
14600
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-48 w-full overflow-hidden rounded-2xl bg-gray-100 md:h-40 md:w-40", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14601
14601
|
Image4__default.default,
|
|
14602
14602
|
{
|
|
14603
|
-
src: product.media?.[0]?.file || "/placeholder-product.
|
|
14603
|
+
src: product.media?.[0]?.file || "/placeholder-product.png",
|
|
14604
14604
|
alt: product.name,
|
|
14605
14605
|
fill: true,
|
|
14606
14606
|
className: "object-cover transition duration-500 group-hover:scale-105"
|
|
@@ -15520,7 +15520,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
15520
15520
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
|
|
15521
15521
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant) => {
|
|
15522
15522
|
const isSelected = selectedVariant?._id === variant._id;
|
|
15523
|
-
const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.
|
|
15523
|
+
const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.png";
|
|
15524
15524
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15525
15525
|
"button",
|
|
15526
15526
|
{
|
|
@@ -15727,7 +15727,7 @@ function CartItem({ item }) {
|
|
|
15727
15727
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-28 h-28 rounded-[16px] overflow-hidden bg-gray-50 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15728
15728
|
Image4__default.default,
|
|
15729
15729
|
{
|
|
15730
|
-
src: item.productVariantData.media[0]?.file || "/placeholder-product.
|
|
15730
|
+
src: item.productVariantData.media[0]?.file || "/placeholder-product.png",
|
|
15731
15731
|
alt: item.productVariantData.name,
|
|
15732
15732
|
className: "w-full h-full object-cover",
|
|
15733
15733
|
height: 112,
|
|
@@ -17144,7 +17144,7 @@ function CheckoutScreen() {
|
|
|
17144
17144
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17145
17145
|
Image4__default.default,
|
|
17146
17146
|
{
|
|
17147
|
-
src: rate.providerImage75 || "/placeholder-product.
|
|
17147
|
+
src: rate.providerImage75 || "/placeholder-product.png",
|
|
17148
17148
|
alt: rate.provider,
|
|
17149
17149
|
className: "w-12 h-12 rounded-lg object-contain bg-white border border-gray-200 p-1",
|
|
17150
17150
|
onError: (e) => {
|
|
@@ -17229,7 +17229,7 @@ function CheckoutScreen() {
|
|
|
17229
17229
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
|
|
17230
17230
|
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
|
|
17231
17231
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4 mb-6", children: cart?.cartBody?.items?.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
17232
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(Image4__default.default, { src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.
|
|
17232
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(Image4__default.default, { src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.png", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
|
|
17233
17233
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
17234
17234
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
|
|
17235
17235
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
|
|
@@ -18411,7 +18411,7 @@ function AccountOrdersTab() {
|
|
|
18411
18411
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18412
18412
|
Image4__default.default,
|
|
18413
18413
|
{
|
|
18414
|
-
src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.
|
|
18414
|
+
src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
|
|
18415
18415
|
alt: item?.productVariantData?.name || "Product image",
|
|
18416
18416
|
fill: true,
|
|
18417
18417
|
className: "object-cover",
|
|
@@ -18434,94 +18434,6 @@ function AccountOrdersTab() {
|
|
|
18434
18434
|
);
|
|
18435
18435
|
}) });
|
|
18436
18436
|
}
|
|
18437
|
-
function useWishlistProducts(productIds = []) {
|
|
18438
|
-
const [products, setProducts] = React12.useState([]);
|
|
18439
|
-
const [isLoading, setIsLoading] = React12.useState(false);
|
|
18440
|
-
const [error, setError] = React12.useState(null);
|
|
18441
|
-
const [cache] = React12.useState(() => /* @__PURE__ */ new Map());
|
|
18442
|
-
const uniqueIds = React12.useMemo(
|
|
18443
|
-
() => Array.from(new Set((productIds || []).filter(Boolean))),
|
|
18444
|
-
[productIds]
|
|
18445
|
-
);
|
|
18446
|
-
const fetchProducts = React12.useCallback(async () => {
|
|
18447
|
-
if (uniqueIds.length === 0) {
|
|
18448
|
-
setProducts([]);
|
|
18449
|
-
setIsLoading(false);
|
|
18450
|
-
setError(null);
|
|
18451
|
-
return;
|
|
18452
|
-
}
|
|
18453
|
-
setIsLoading(true);
|
|
18454
|
-
setError(null);
|
|
18455
|
-
try {
|
|
18456
|
-
const api = new ProductsApi(AXIOS_CONFIG);
|
|
18457
|
-
const results = await Promise.all(
|
|
18458
|
-
uniqueIds.map(async (id) => {
|
|
18459
|
-
if (cache.has(id)) return cache.get(id);
|
|
18460
|
-
const response = await api.getSingleProduct(id?._id || id || "");
|
|
18461
|
-
const product = response.data;
|
|
18462
|
-
cache.set(id, product);
|
|
18463
|
-
return product;
|
|
18464
|
-
})
|
|
18465
|
-
);
|
|
18466
|
-
setProducts(results);
|
|
18467
|
-
} catch (err) {
|
|
18468
|
-
setError(err);
|
|
18469
|
-
console.error("Failed to load wishlist products", err);
|
|
18470
|
-
} finally {
|
|
18471
|
-
setIsLoading(false);
|
|
18472
|
-
}
|
|
18473
|
-
}, [cache, uniqueIds]);
|
|
18474
|
-
React12.useEffect(() => {
|
|
18475
|
-
fetchProducts();
|
|
18476
|
-
}, [fetchProducts]);
|
|
18477
|
-
return {
|
|
18478
|
-
products,
|
|
18479
|
-
isLoading,
|
|
18480
|
-
error,
|
|
18481
|
-
refetch: fetchProducts
|
|
18482
|
-
};
|
|
18483
|
-
}
|
|
18484
|
-
function AccountSavedItemsTab() {
|
|
18485
|
-
const { products: wishlistProductIds } = useWishlist();
|
|
18486
|
-
const { products: wishlistProducts, isLoading, error } = useWishlistProducts(
|
|
18487
|
-
wishlistProductIds
|
|
18488
|
-
);
|
|
18489
|
-
const products = wishlistProducts || [];
|
|
18490
|
-
if (isLoading) {
|
|
18491
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
18492
|
-
"div",
|
|
18493
|
-
{
|
|
18494
|
-
className: "h-80 animate-pulse rounded-lg border border-slate-100 bg-slate-50"
|
|
18495
|
-
},
|
|
18496
|
-
index
|
|
18497
|
-
)) }) });
|
|
18498
|
-
}
|
|
18499
|
-
if (error) {
|
|
18500
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-red-100 bg-red-50 p-6 text-sm text-red-700", children: error.message }) });
|
|
18501
|
-
}
|
|
18502
|
-
if (products.length === 0) {
|
|
18503
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18504
|
-
EmptyState,
|
|
18505
|
-
{
|
|
18506
|
-
icon: lucideReact.Heart,
|
|
18507
|
-
title: "No saved items",
|
|
18508
|
-
description: "Items you save will appear here for easy access later."
|
|
18509
|
-
}
|
|
18510
|
-
) });
|
|
18511
|
-
}
|
|
18512
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-24 p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 bg-white rounded-xl", children: [
|
|
18513
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
|
|
18514
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-secondary", children: "Saved for Later" }),
|
|
18515
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-secondary", children: [
|
|
18516
|
-
products.length,
|
|
18517
|
-
" ",
|
|
18518
|
-
products.length === 1 ? "item" : "items",
|
|
18519
|
-
" saved"
|
|
18520
|
-
] })
|
|
18521
|
-
] }),
|
|
18522
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: products.map((product) => /* @__PURE__ */ jsxRuntime.jsx(ProductCard, { product }, product._id)) })
|
|
18523
|
-
] }) });
|
|
18524
|
-
}
|
|
18525
18437
|
function ConfirmModal({
|
|
18526
18438
|
isOpen,
|
|
18527
18439
|
onClose,
|
|
@@ -18926,7 +18838,6 @@ var tabs = [
|
|
|
18926
18838
|
{ id: "overview", label: "Overview", icon: lucideReact.User },
|
|
18927
18839
|
{ id: "orders", label: "Orders", icon: lucideReact.Package },
|
|
18928
18840
|
{ id: "reviews", label: "My Reviews", icon: lucideReact.Star },
|
|
18929
|
-
{ id: "saved-items", label: "Saved Items", icon: lucideReact.Heart },
|
|
18930
18841
|
// { id: 'payment', label: 'Payment', icon: CreditCard },
|
|
18931
18842
|
{ id: "addresses", label: "Addresses", icon: lucideReact.MapPin },
|
|
18932
18843
|
{ id: "settings", label: "Settings", icon: lucideReact.Settings }
|
|
@@ -18960,8 +18871,8 @@ function AccountPage() {
|
|
|
18960
18871
|
return /* @__PURE__ */ jsxRuntime.jsx(AccountOrdersTab, {});
|
|
18961
18872
|
case "reviews":
|
|
18962
18873
|
return /* @__PURE__ */ jsxRuntime.jsx(AccountReviewsTab, {});
|
|
18963
|
-
case
|
|
18964
|
-
|
|
18874
|
+
// case 'saved-items':
|
|
18875
|
+
// return <AccountSavedItemsTab />;
|
|
18965
18876
|
// case 'payment':
|
|
18966
18877
|
// return <AccountPaymentTab />;
|
|
18967
18878
|
case "addresses":
|
|
@@ -19056,7 +18967,7 @@ function OrderCard({ order, onDelete }) {
|
|
|
19056
18967
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12 rounded-sm bg-gray-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19057
18968
|
Image4__default.default,
|
|
19058
18969
|
{
|
|
19059
|
-
src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.
|
|
18970
|
+
src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
|
|
19060
18971
|
alt: item?.productVariantData?.name || "Product image",
|
|
19061
18972
|
fill: true,
|
|
19062
18973
|
className: "object-cover",
|
|
@@ -20024,6 +19935,53 @@ You can add it back at any time.`
|
|
|
20024
19935
|
)
|
|
20025
19936
|
] });
|
|
20026
19937
|
}
|
|
19938
|
+
function useWishlistProducts(productIds = []) {
|
|
19939
|
+
const [products, setProducts] = React12.useState([]);
|
|
19940
|
+
const [isLoading, setIsLoading] = React12.useState(false);
|
|
19941
|
+
const [error, setError] = React12.useState(null);
|
|
19942
|
+
const [cache] = React12.useState(() => /* @__PURE__ */ new Map());
|
|
19943
|
+
const uniqueIds = React12.useMemo(
|
|
19944
|
+
() => Array.from(new Set((productIds || []).filter(Boolean))),
|
|
19945
|
+
[productIds]
|
|
19946
|
+
);
|
|
19947
|
+
const fetchProducts = React12.useCallback(async () => {
|
|
19948
|
+
if (uniqueIds.length === 0) {
|
|
19949
|
+
setProducts([]);
|
|
19950
|
+
setIsLoading(false);
|
|
19951
|
+
setError(null);
|
|
19952
|
+
return;
|
|
19953
|
+
}
|
|
19954
|
+
setIsLoading(true);
|
|
19955
|
+
setError(null);
|
|
19956
|
+
try {
|
|
19957
|
+
const api = new ProductsApi(AXIOS_CONFIG);
|
|
19958
|
+
const results = await Promise.all(
|
|
19959
|
+
uniqueIds.map(async (id) => {
|
|
19960
|
+
if (cache.has(id)) return cache.get(id);
|
|
19961
|
+
const response = await api.getSingleProduct(id?._id || id || "");
|
|
19962
|
+
const product = response.data;
|
|
19963
|
+
cache.set(id, product);
|
|
19964
|
+
return product;
|
|
19965
|
+
})
|
|
19966
|
+
);
|
|
19967
|
+
setProducts(results);
|
|
19968
|
+
} catch (err) {
|
|
19969
|
+
setError(err);
|
|
19970
|
+
console.error("Failed to load wishlist products", err);
|
|
19971
|
+
} finally {
|
|
19972
|
+
setIsLoading(false);
|
|
19973
|
+
}
|
|
19974
|
+
}, [cache, uniqueIds]);
|
|
19975
|
+
React12.useEffect(() => {
|
|
19976
|
+
fetchProducts();
|
|
19977
|
+
}, [fetchProducts]);
|
|
19978
|
+
return {
|
|
19979
|
+
products,
|
|
19980
|
+
isLoading,
|
|
19981
|
+
error,
|
|
19982
|
+
refetch: fetchProducts
|
|
19983
|
+
};
|
|
19984
|
+
}
|
|
20027
19985
|
var SORT_OPTIONS = [
|
|
20028
19986
|
{ value: "featured", label: "Most loved" },
|
|
20029
19987
|
{ value: "price-low", label: "Price: Low to High" },
|
|
@@ -20278,7 +20236,7 @@ function WishlistScreen() {
|
|
|
20278
20236
|
Image4__default.default,
|
|
20279
20237
|
{
|
|
20280
20238
|
fill: true,
|
|
20281
|
-
src: product.media?.[0]?.file || "/placeholder-product.
|
|
20239
|
+
src: product.media?.[0]?.file || "/placeholder-product.png",
|
|
20282
20240
|
alt: product.name || "Wishlist item",
|
|
20283
20241
|
className: "h-full w-full object-cover"
|
|
20284
20242
|
}
|
|
@@ -21724,7 +21682,7 @@ function OrderDetailScreen({ id }) {
|
|
|
21724
21682
|
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
|
|
21725
21683
|
Image4__default.default,
|
|
21726
21684
|
{
|
|
21727
|
-
src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.
|
|
21685
|
+
src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
|
|
21728
21686
|
alt: item.productVariantData?.name || "Item",
|
|
21729
21687
|
fill: true,
|
|
21730
21688
|
className: "object-cover",
|