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.js
CHANGED
|
@@ -12971,6 +12971,9 @@ function EcommerceProvider({ config, children, withToaster = true, basePath = ""
|
|
|
12971
12971
|
/* @__PURE__ */ jsxRuntime.jsx(NotificationDrawer, {})
|
|
12972
12972
|
] }) }) }) }) }) }) }) }) });
|
|
12973
12973
|
}
|
|
12974
|
+
|
|
12975
|
+
// src/lib/constants/assets.ts
|
|
12976
|
+
var PLACEHOLDER_IMAGE_SRC = `data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+CiAgPHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIyNCIgZmlsbD0iIzljYTNhZiIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSI+Tm8gSW1hZ2U8L3RleHQ+CiAgPHJlY3QgeD0iMTUwIiB5PSIxMjAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBzdHJva2U9IiM5Y2EzYWYiIHN0cm9rZS13aWR0aD0iNCIgZmlsbD0ibm9uZSIgcng9IjgiLz4KICA8cGF0aCBkPSJNMTUwIDE4MCBMMTcwIDE2MCBMMjAwIDE5MCBMMjIwIDE3MCBMMjUwIDIwMCBMMjUwIDIyMCBMMTUwIDIyMCBaIiBmaWxsPSIjOWNhM2FmIiBvcGFjaXR5PSIwLjUiLz4KPC9zdmc+`;
|
|
12974
12977
|
function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
12975
12978
|
const [selectedVariantIndex, setSelectedVariantIndex] = React12.useState(0);
|
|
12976
12979
|
const [selectedSizeIndex, setSelectedSizeIndex] = React12.useState(0);
|
|
@@ -13297,7 +13300,7 @@ function ProductCard({
|
|
|
13297
13300
|
return selectedVariant ? selectedVariant.inventoryCount : product.variants?.[0]?.inventoryCount;
|
|
13298
13301
|
}, [selectedVariant, product.variants]);
|
|
13299
13302
|
const imageSource = React12.useMemo(() => {
|
|
13300
|
-
const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file ||
|
|
13303
|
+
const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC;
|
|
13301
13304
|
return {
|
|
13302
13305
|
src,
|
|
13303
13306
|
alt: product.name || "Product image"
|
|
@@ -14600,7 +14603,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
14600
14603
|
/* @__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
14604
|
Image4__default.default,
|
|
14602
14605
|
{
|
|
14603
|
-
src: product.media?.[0]?.file ||
|
|
14606
|
+
src: product.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
14604
14607
|
alt: product.name,
|
|
14605
14608
|
fill: true,
|
|
14606
14609
|
className: "object-cover transition duration-500 group-hover:scale-105"
|
|
@@ -15520,7 +15523,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
15520
15523
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
|
|
15521
15524
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant) => {
|
|
15522
15525
|
const isSelected = selectedVariant?._id === variant._id;
|
|
15523
|
-
const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] ||
|
|
15526
|
+
const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || PLACEHOLDER_IMAGE_SRC;
|
|
15524
15527
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15525
15528
|
"button",
|
|
15526
15529
|
{
|
|
@@ -15727,7 +15730,7 @@ function CartItem({ item }) {
|
|
|
15727
15730
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-28 h-28 rounded-[16px] overflow-hidden bg-gray-50 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15728
15731
|
Image4__default.default,
|
|
15729
15732
|
{
|
|
15730
|
-
src: item.productVariantData.media[0]?.file ||
|
|
15733
|
+
src: item.productVariantData.media[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
15731
15734
|
alt: item.productVariantData.name,
|
|
15732
15735
|
className: "w-full h-full object-cover",
|
|
15733
15736
|
height: 112,
|
|
@@ -17144,7 +17147,7 @@ function CheckoutScreen() {
|
|
|
17144
17147
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17145
17148
|
Image4__default.default,
|
|
17146
17149
|
{
|
|
17147
|
-
src: rate.providerImage75 ||
|
|
17150
|
+
src: rate.providerImage75 || PLACEHOLDER_IMAGE_SRC,
|
|
17148
17151
|
alt: rate.provider,
|
|
17149
17152
|
className: "w-12 h-12 rounded-lg object-contain bg-white border border-gray-200 p-1",
|
|
17150
17153
|
onError: (e) => {
|
|
@@ -17229,7 +17232,7 @@ function CheckoutScreen() {
|
|
|
17229
17232
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
|
|
17230
17233
|
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
|
|
17231
17234
|
/* @__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 ||
|
|
17235
|
+
/* @__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_IMAGE_SRC, alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
|
|
17233
17236
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
17234
17237
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
|
|
17235
17238
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
|
|
@@ -18411,7 +18414,7 @@ function AccountOrdersTab() {
|
|
|
18411
18414
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18412
18415
|
Image4__default.default,
|
|
18413
18416
|
{
|
|
18414
|
-
src: item?.productVariantData?.media?.[0]?.file ||
|
|
18417
|
+
src: item?.productVariantData?.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
18415
18418
|
alt: item?.productVariantData?.name || "Product image",
|
|
18416
18419
|
fill: true,
|
|
18417
18420
|
className: "object-cover",
|
|
@@ -18434,94 +18437,6 @@ function AccountOrdersTab() {
|
|
|
18434
18437
|
);
|
|
18435
18438
|
}) });
|
|
18436
18439
|
}
|
|
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
18440
|
function ConfirmModal({
|
|
18526
18441
|
isOpen,
|
|
18527
18442
|
onClose,
|
|
@@ -18926,7 +18841,6 @@ var tabs = [
|
|
|
18926
18841
|
{ id: "overview", label: "Overview", icon: lucideReact.User },
|
|
18927
18842
|
{ id: "orders", label: "Orders", icon: lucideReact.Package },
|
|
18928
18843
|
{ id: "reviews", label: "My Reviews", icon: lucideReact.Star },
|
|
18929
|
-
{ id: "saved-items", label: "Saved Items", icon: lucideReact.Heart },
|
|
18930
18844
|
// { id: 'payment', label: 'Payment', icon: CreditCard },
|
|
18931
18845
|
{ id: "addresses", label: "Addresses", icon: lucideReact.MapPin },
|
|
18932
18846
|
{ id: "settings", label: "Settings", icon: lucideReact.Settings }
|
|
@@ -18960,8 +18874,8 @@ function AccountPage() {
|
|
|
18960
18874
|
return /* @__PURE__ */ jsxRuntime.jsx(AccountOrdersTab, {});
|
|
18961
18875
|
case "reviews":
|
|
18962
18876
|
return /* @__PURE__ */ jsxRuntime.jsx(AccountReviewsTab, {});
|
|
18963
|
-
case
|
|
18964
|
-
|
|
18877
|
+
// case 'saved-items':
|
|
18878
|
+
// return <AccountSavedItemsTab />;
|
|
18965
18879
|
// case 'payment':
|
|
18966
18880
|
// return <AccountPaymentTab />;
|
|
18967
18881
|
case "addresses":
|
|
@@ -19056,7 +18970,7 @@ function OrderCard({ order, onDelete }) {
|
|
|
19056
18970
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12 rounded-sm bg-gray-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19057
18971
|
Image4__default.default,
|
|
19058
18972
|
{
|
|
19059
|
-
src: item?.productVariantData?.media?.[0]?.file ||
|
|
18973
|
+
src: item?.productVariantData?.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
19060
18974
|
alt: item?.productVariantData?.name || "Product image",
|
|
19061
18975
|
fill: true,
|
|
19062
18976
|
className: "object-cover",
|
|
@@ -20024,6 +19938,53 @@ You can add it back at any time.`
|
|
|
20024
19938
|
)
|
|
20025
19939
|
] });
|
|
20026
19940
|
}
|
|
19941
|
+
function useWishlistProducts(productIds = []) {
|
|
19942
|
+
const [products, setProducts] = React12.useState([]);
|
|
19943
|
+
const [isLoading, setIsLoading] = React12.useState(false);
|
|
19944
|
+
const [error, setError] = React12.useState(null);
|
|
19945
|
+
const [cache] = React12.useState(() => /* @__PURE__ */ new Map());
|
|
19946
|
+
const uniqueIds = React12.useMemo(
|
|
19947
|
+
() => Array.from(new Set((productIds || []).filter(Boolean))),
|
|
19948
|
+
[productIds]
|
|
19949
|
+
);
|
|
19950
|
+
const fetchProducts = React12.useCallback(async () => {
|
|
19951
|
+
if (uniqueIds.length === 0) {
|
|
19952
|
+
setProducts([]);
|
|
19953
|
+
setIsLoading(false);
|
|
19954
|
+
setError(null);
|
|
19955
|
+
return;
|
|
19956
|
+
}
|
|
19957
|
+
setIsLoading(true);
|
|
19958
|
+
setError(null);
|
|
19959
|
+
try {
|
|
19960
|
+
const api = new ProductsApi(AXIOS_CONFIG);
|
|
19961
|
+
const results = await Promise.all(
|
|
19962
|
+
uniqueIds.map(async (id) => {
|
|
19963
|
+
if (cache.has(id)) return cache.get(id);
|
|
19964
|
+
const response = await api.getSingleProduct(id?._id || id || "");
|
|
19965
|
+
const product = response.data;
|
|
19966
|
+
cache.set(id, product);
|
|
19967
|
+
return product;
|
|
19968
|
+
})
|
|
19969
|
+
);
|
|
19970
|
+
setProducts(results);
|
|
19971
|
+
} catch (err) {
|
|
19972
|
+
setError(err);
|
|
19973
|
+
console.error("Failed to load wishlist products", err);
|
|
19974
|
+
} finally {
|
|
19975
|
+
setIsLoading(false);
|
|
19976
|
+
}
|
|
19977
|
+
}, [cache, uniqueIds]);
|
|
19978
|
+
React12.useEffect(() => {
|
|
19979
|
+
fetchProducts();
|
|
19980
|
+
}, [fetchProducts]);
|
|
19981
|
+
return {
|
|
19982
|
+
products,
|
|
19983
|
+
isLoading,
|
|
19984
|
+
error,
|
|
19985
|
+
refetch: fetchProducts
|
|
19986
|
+
};
|
|
19987
|
+
}
|
|
20027
19988
|
var SORT_OPTIONS = [
|
|
20028
19989
|
{ value: "featured", label: "Most loved" },
|
|
20029
19990
|
{ value: "price-low", label: "Price: Low to High" },
|
|
@@ -20278,7 +20239,7 @@ function WishlistScreen() {
|
|
|
20278
20239
|
Image4__default.default,
|
|
20279
20240
|
{
|
|
20280
20241
|
fill: true,
|
|
20281
|
-
src: product.media?.[0]?.file ||
|
|
20242
|
+
src: product.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
20282
20243
|
alt: product.name || "Wishlist item",
|
|
20283
20244
|
className: "h-full w-full object-cover"
|
|
20284
20245
|
}
|
|
@@ -21724,7 +21685,7 @@ function OrderDetailScreen({ id }) {
|
|
|
21724
21685
|
/* @__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
21686
|
Image4__default.default,
|
|
21726
21687
|
{
|
|
21727
|
-
src: item.productVariantData?.media?.[0]?.file ||
|
|
21688
|
+
src: item.productVariantData?.media?.[0]?.file || PLACEHOLDER_IMAGE_SRC,
|
|
21728
21689
|
alt: item.productVariantData?.name || "Item",
|
|
21729
21690
|
fill: true,
|
|
21730
21691
|
className: "object-cover",
|