hey-pharmacist-ecommerce 1.1.34 → 1.1.36
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 +62 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -101
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountOrdersTab.tsx +3 -1
- package/src/components/CartItem.tsx +6 -2
- package/src/components/OrderCard.tsx +3 -1
- package/src/components/ProductCard.tsx +6 -1
- package/src/lib/constants/assets.ts +1 -0
- package/src/screens/CheckoutScreen.tsx +6 -4
- package/src/screens/OrderDetailScreen.tsx +5 -1
- package/src/screens/ProductDetailScreen.tsx +3 -1
- package/src/screens/ProfileScreen.tsx +2 -4
- package/src/screens/ShopScreen.tsx +3 -1
- package/src/screens/WishlistScreen.tsx +3 -1
- package/src/components/AccountSavedItemsTab.tsx +0 -75
package/dist/index.mjs
CHANGED
|
@@ -12961,6 +12961,9 @@ function EcommerceProvider({ config, children, withToaster = true, basePath = ""
|
|
|
12961
12961
|
/* @__PURE__ */ jsx(NotificationDrawer, {})
|
|
12962
12962
|
] }) }) }) }) }) }) }) }) });
|
|
12963
12963
|
}
|
|
12964
|
+
|
|
12965
|
+
// src/lib/constants/assets.ts
|
|
12966
|
+
var PLACEHOLDER_IMAGE_SRC = `data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+CiAgPHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIyNCIgZmlsbD0iIzljYTNhZiIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSI+Tm8gSW1hZ2U8L3RleHQ+CiAgPHJlY3QgeD0iMTUwIiB5PSIxMjAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBzdHJva2U9IiM5Y2EzYWYiIHN0cm9rZS13aWR0aD0iNCIgZmlsbD0ibm9uZSIgcng9IjgiLz4KICA8cGF0aCBkPSJNMTUwIDE4MCBMMTcwIDE2MCBMMjAwIDE5MCBMMjIwIDE3MCBMMjUwIDIwMCBMMjUwIDIyMCBMMTUwIDIyMCBaIiBmaWxsPSIjOWNhM2FmIiBvcGFjaXR5PSIwLjUiLz4KPC9zdmc+`;
|
|
12964
12967
|
function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
12965
12968
|
const [selectedVariantIndex, setSelectedVariantIndex] = useState(0);
|
|
12966
12969
|
const [selectedSizeIndex, setSelectedSizeIndex] = useState(0);
|
|
@@ -13287,7 +13290,7 @@ function ProductCard({
|
|
|
13287
13290
|
return selectedVariant ? selectedVariant.inventoryCount : product.variants?.[0]?.inventoryCount;
|
|
13288
13291
|
}, [selectedVariant, product.variants]);
|
|
13289
13292
|
const imageSource = useMemo(() => {
|
|
13290
|
-
const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file ||
|
|
13293
|
+
const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC;
|
|
13291
13294
|
return {
|
|
13292
13295
|
src,
|
|
13293
13296
|
alt: product.name || "Product image"
|
|
@@ -14590,7 +14593,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
14590
14593
|
/* @__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(
|
|
14591
14594
|
Image4,
|
|
14592
14595
|
{
|
|
14593
|
-
src: product.media?.[0]?.file ||
|
|
14596
|
+
src: product.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
14594
14597
|
alt: product.name,
|
|
14595
14598
|
fill: true,
|
|
14596
14599
|
className: "object-cover transition duration-500 group-hover:scale-105"
|
|
@@ -15510,7 +15513,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
15510
15513
|
/* @__PURE__ */ jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
|
|
15511
15514
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant) => {
|
|
15512
15515
|
const isSelected = selectedVariant?._id === variant._id;
|
|
15513
|
-
const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] ||
|
|
15516
|
+
const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || PLACEHOLDER_IMAGE_SRC;
|
|
15514
15517
|
return /* @__PURE__ */ jsxs(
|
|
15515
15518
|
"button",
|
|
15516
15519
|
{
|
|
@@ -15717,7 +15720,7 @@ function CartItem({ item }) {
|
|
|
15717
15720
|
/* @__PURE__ */ jsx("div", { className: "w-28 h-28 rounded-[16px] overflow-hidden bg-gray-50 shrink-0", children: /* @__PURE__ */ jsx(
|
|
15718
15721
|
Image4,
|
|
15719
15722
|
{
|
|
15720
|
-
src: item.productVariantData.media[0]?.file ||
|
|
15723
|
+
src: item.productVariantData.media[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
15721
15724
|
alt: item.productVariantData.name,
|
|
15722
15725
|
className: "w-full h-full object-cover",
|
|
15723
15726
|
height: 112,
|
|
@@ -17134,7 +17137,7 @@ function CheckoutScreen() {
|
|
|
17134
17137
|
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
17135
17138
|
Image4,
|
|
17136
17139
|
{
|
|
17137
|
-
src: rate.providerImage75 ||
|
|
17140
|
+
src: rate.providerImage75 || PLACEHOLDER_IMAGE_SRC,
|
|
17138
17141
|
alt: rate.provider,
|
|
17139
17142
|
className: "w-12 h-12 rounded-lg object-contain bg-white border border-gray-200 p-1",
|
|
17140
17143
|
onError: (e) => {
|
|
@@ -17219,7 +17222,7 @@ function CheckoutScreen() {
|
|
|
17219
17222
|
/* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
|
|
17220
17223
|
/* @__PURE__ */ jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
|
|
17221
17224
|
/* @__PURE__ */ jsx("div", { className: "space-y-4 mb-6", children: cart?.cartBody?.items?.map((item) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
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 ||
|
|
17225
|
+
/* @__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_IMAGE_SRC, alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
|
|
17223
17226
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
17224
17227
|
/* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
|
|
17225
17228
|
/* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
|
|
@@ -18401,7 +18404,7 @@ function AccountOrdersTab() {
|
|
|
18401
18404
|
/* @__PURE__ */ jsx("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
18402
18405
|
Image4,
|
|
18403
18406
|
{
|
|
18404
|
-
src: item?.productVariantData?.media?.[0]?.file ||
|
|
18407
|
+
src: item?.productVariantData?.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
18405
18408
|
alt: item?.productVariantData?.name || "Product image",
|
|
18406
18409
|
fill: true,
|
|
18407
18410
|
className: "object-cover",
|
|
@@ -18424,94 +18427,6 @@ function AccountOrdersTab() {
|
|
|
18424
18427
|
);
|
|
18425
18428
|
}) });
|
|
18426
18429
|
}
|
|
18427
|
-
function useWishlistProducts(productIds = []) {
|
|
18428
|
-
const [products, setProducts] = useState([]);
|
|
18429
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
18430
|
-
const [error, setError] = useState(null);
|
|
18431
|
-
const [cache] = useState(() => /* @__PURE__ */ new Map());
|
|
18432
|
-
const uniqueIds = useMemo(
|
|
18433
|
-
() => Array.from(new Set((productIds || []).filter(Boolean))),
|
|
18434
|
-
[productIds]
|
|
18435
|
-
);
|
|
18436
|
-
const fetchProducts = useCallback(async () => {
|
|
18437
|
-
if (uniqueIds.length === 0) {
|
|
18438
|
-
setProducts([]);
|
|
18439
|
-
setIsLoading(false);
|
|
18440
|
-
setError(null);
|
|
18441
|
-
return;
|
|
18442
|
-
}
|
|
18443
|
-
setIsLoading(true);
|
|
18444
|
-
setError(null);
|
|
18445
|
-
try {
|
|
18446
|
-
const api = new ProductsApi(AXIOS_CONFIG);
|
|
18447
|
-
const results = await Promise.all(
|
|
18448
|
-
uniqueIds.map(async (id) => {
|
|
18449
|
-
if (cache.has(id)) return cache.get(id);
|
|
18450
|
-
const response = await api.getSingleProduct(id?._id || id || "");
|
|
18451
|
-
const product = response.data;
|
|
18452
|
-
cache.set(id, product);
|
|
18453
|
-
return product;
|
|
18454
|
-
})
|
|
18455
|
-
);
|
|
18456
|
-
setProducts(results);
|
|
18457
|
-
} catch (err) {
|
|
18458
|
-
setError(err);
|
|
18459
|
-
console.error("Failed to load wishlist products", err);
|
|
18460
|
-
} finally {
|
|
18461
|
-
setIsLoading(false);
|
|
18462
|
-
}
|
|
18463
|
-
}, [cache, uniqueIds]);
|
|
18464
|
-
useEffect(() => {
|
|
18465
|
-
fetchProducts();
|
|
18466
|
-
}, [fetchProducts]);
|
|
18467
|
-
return {
|
|
18468
|
-
products,
|
|
18469
|
-
isLoading,
|
|
18470
|
-
error,
|
|
18471
|
-
refetch: fetchProducts
|
|
18472
|
-
};
|
|
18473
|
-
}
|
|
18474
|
-
function AccountSavedItemsTab() {
|
|
18475
|
-
const { products: wishlistProductIds } = useWishlist();
|
|
18476
|
-
const { products: wishlistProducts, isLoading, error } = useWishlistProducts(
|
|
18477
|
-
wishlistProductIds
|
|
18478
|
-
);
|
|
18479
|
-
const products = wishlistProducts || [];
|
|
18480
|
-
if (isLoading) {
|
|
18481
|
-
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(
|
|
18482
|
-
"div",
|
|
18483
|
-
{
|
|
18484
|
-
className: "h-80 animate-pulse rounded-lg border border-slate-100 bg-slate-50"
|
|
18485
|
-
},
|
|
18486
|
-
index
|
|
18487
|
-
)) }) });
|
|
18488
|
-
}
|
|
18489
|
-
if (error) {
|
|
18490
|
-
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 }) });
|
|
18491
|
-
}
|
|
18492
|
-
if (products.length === 0) {
|
|
18493
|
-
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsx(
|
|
18494
|
-
EmptyState,
|
|
18495
|
-
{
|
|
18496
|
-
icon: Heart,
|
|
18497
|
-
title: "No saved items",
|
|
18498
|
-
description: "Items you save will appear here for easy access later."
|
|
18499
|
-
}
|
|
18500
|
-
) });
|
|
18501
|
-
}
|
|
18502
|
-
return /* @__PURE__ */ jsx("div", { className: "pb-24 p-6", children: /* @__PURE__ */ jsxs("div", { className: "p-6 bg-white rounded-xl", children: [
|
|
18503
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
|
|
18504
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-secondary", children: "Saved for Later" }),
|
|
18505
|
-
/* @__PURE__ */ jsxs("p", { className: "text-sm text-secondary", children: [
|
|
18506
|
-
products.length,
|
|
18507
|
-
" ",
|
|
18508
|
-
products.length === 1 ? "item" : "items",
|
|
18509
|
-
" saved"
|
|
18510
|
-
] })
|
|
18511
|
-
] }),
|
|
18512
|
-
/* @__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)) })
|
|
18513
|
-
] }) });
|
|
18514
|
-
}
|
|
18515
18430
|
function ConfirmModal({
|
|
18516
18431
|
isOpen,
|
|
18517
18432
|
onClose,
|
|
@@ -18916,7 +18831,6 @@ var tabs = [
|
|
|
18916
18831
|
{ id: "overview", label: "Overview", icon: User },
|
|
18917
18832
|
{ id: "orders", label: "Orders", icon: Package },
|
|
18918
18833
|
{ id: "reviews", label: "My Reviews", icon: Star },
|
|
18919
|
-
{ id: "saved-items", label: "Saved Items", icon: Heart },
|
|
18920
18834
|
// { id: 'payment', label: 'Payment', icon: CreditCard },
|
|
18921
18835
|
{ id: "addresses", label: "Addresses", icon: MapPin },
|
|
18922
18836
|
{ id: "settings", label: "Settings", icon: Settings }
|
|
@@ -18950,8 +18864,8 @@ function AccountPage() {
|
|
|
18950
18864
|
return /* @__PURE__ */ jsx(AccountOrdersTab, {});
|
|
18951
18865
|
case "reviews":
|
|
18952
18866
|
return /* @__PURE__ */ jsx(AccountReviewsTab, {});
|
|
18953
|
-
case
|
|
18954
|
-
|
|
18867
|
+
// case 'saved-items':
|
|
18868
|
+
// return <AccountSavedItemsTab />;
|
|
18955
18869
|
// case 'payment':
|
|
18956
18870
|
// return <AccountPaymentTab />;
|
|
18957
18871
|
case "addresses":
|
|
@@ -19046,7 +18960,7 @@ function OrderCard({ order, onDelete }) {
|
|
|
19046
18960
|
/* @__PURE__ */ jsx("div", { className: "relative w-12 h-12 rounded-sm bg-gray-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
19047
18961
|
Image4,
|
|
19048
18962
|
{
|
|
19049
|
-
src: item?.productVariantData?.media?.[0]?.file ||
|
|
18963
|
+
src: item?.productVariantData?.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
19050
18964
|
alt: item?.productVariantData?.name || "Product image",
|
|
19051
18965
|
fill: true,
|
|
19052
18966
|
className: "object-cover",
|
|
@@ -20014,6 +19928,53 @@ You can add it back at any time.`
|
|
|
20014
19928
|
)
|
|
20015
19929
|
] });
|
|
20016
19930
|
}
|
|
19931
|
+
function useWishlistProducts(productIds = []) {
|
|
19932
|
+
const [products, setProducts] = useState([]);
|
|
19933
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
19934
|
+
const [error, setError] = useState(null);
|
|
19935
|
+
const [cache] = useState(() => /* @__PURE__ */ new Map());
|
|
19936
|
+
const uniqueIds = useMemo(
|
|
19937
|
+
() => Array.from(new Set((productIds || []).filter(Boolean))),
|
|
19938
|
+
[productIds]
|
|
19939
|
+
);
|
|
19940
|
+
const fetchProducts = useCallback(async () => {
|
|
19941
|
+
if (uniqueIds.length === 0) {
|
|
19942
|
+
setProducts([]);
|
|
19943
|
+
setIsLoading(false);
|
|
19944
|
+
setError(null);
|
|
19945
|
+
return;
|
|
19946
|
+
}
|
|
19947
|
+
setIsLoading(true);
|
|
19948
|
+
setError(null);
|
|
19949
|
+
try {
|
|
19950
|
+
const api = new ProductsApi(AXIOS_CONFIG);
|
|
19951
|
+
const results = await Promise.all(
|
|
19952
|
+
uniqueIds.map(async (id) => {
|
|
19953
|
+
if (cache.has(id)) return cache.get(id);
|
|
19954
|
+
const response = await api.getSingleProduct(id?._id || id || "");
|
|
19955
|
+
const product = response.data;
|
|
19956
|
+
cache.set(id, product);
|
|
19957
|
+
return product;
|
|
19958
|
+
})
|
|
19959
|
+
);
|
|
19960
|
+
setProducts(results);
|
|
19961
|
+
} catch (err) {
|
|
19962
|
+
setError(err);
|
|
19963
|
+
console.error("Failed to load wishlist products", err);
|
|
19964
|
+
} finally {
|
|
19965
|
+
setIsLoading(false);
|
|
19966
|
+
}
|
|
19967
|
+
}, [cache, uniqueIds]);
|
|
19968
|
+
useEffect(() => {
|
|
19969
|
+
fetchProducts();
|
|
19970
|
+
}, [fetchProducts]);
|
|
19971
|
+
return {
|
|
19972
|
+
products,
|
|
19973
|
+
isLoading,
|
|
19974
|
+
error,
|
|
19975
|
+
refetch: fetchProducts
|
|
19976
|
+
};
|
|
19977
|
+
}
|
|
20017
19978
|
var SORT_OPTIONS = [
|
|
20018
19979
|
{ value: "featured", label: "Most loved" },
|
|
20019
19980
|
{ value: "price-low", label: "Price: Low to High" },
|
|
@@ -20268,7 +20229,7 @@ function WishlistScreen() {
|
|
|
20268
20229
|
Image4,
|
|
20269
20230
|
{
|
|
20270
20231
|
fill: true,
|
|
20271
|
-
src: product.media?.[0]?.file ||
|
|
20232
|
+
src: product.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
20272
20233
|
alt: product.name || "Wishlist item",
|
|
20273
20234
|
className: "h-full w-full object-cover"
|
|
20274
20235
|
}
|
|
@@ -21714,7 +21675,7 @@ function OrderDetailScreen({ id }) {
|
|
|
21714
21675
|
/* @__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
21676
|
Image4,
|
|
21716
21677
|
{
|
|
21717
|
-
src: item.productVariantData?.media?.[0]?.file ||
|
|
21678
|
+
src: item.productVariantData?.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
21718
21679
|
alt: item.productVariantData?.name || "Item",
|
|
21719
21680
|
fill: true,
|
|
21720
21681
|
className: "object-cover",
|