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.mjs CHANGED
@@ -13287,7 +13287,7 @@ function ProductCard({
13287
13287
  return selectedVariant ? selectedVariant.inventoryCount : product.variants?.[0]?.inventoryCount;
13288
13288
  }, [selectedVariant, product.variants]);
13289
13289
  const imageSource = useMemo(() => {
13290
- const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.jpg";
13290
+ const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.png";
13291
13291
  return {
13292
13292
  src,
13293
13293
  alt: product.name || "Product image"
@@ -14590,7 +14590,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
14590
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(
14591
14591
  Image4,
14592
14592
  {
14593
- src: product.media?.[0]?.file || "/placeholder-product.jpg",
14593
+ src: product.media?.[0]?.file || "/placeholder-product.png",
14594
14594
  alt: product.name,
14595
14595
  fill: true,
14596
14596
  className: "object-cover transition duration-500 group-hover:scale-105"
@@ -15510,7 +15510,7 @@ function ProductDetailScreen({ productId }) {
15510
15510
  /* @__PURE__ */ jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
15511
15511
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant) => {
15512
15512
  const isSelected = selectedVariant?._id === variant._id;
15513
- const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.jpg";
15513
+ const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.png";
15514
15514
  return /* @__PURE__ */ jsxs(
15515
15515
  "button",
15516
15516
  {
@@ -15717,7 +15717,7 @@ function CartItem({ item }) {
15717
15717
  /* @__PURE__ */ jsx("div", { className: "w-28 h-28 rounded-[16px] overflow-hidden bg-gray-50 shrink-0", children: /* @__PURE__ */ jsx(
15718
15718
  Image4,
15719
15719
  {
15720
- src: item.productVariantData.media[0]?.file || "/placeholder-product.jpg",
15720
+ src: item.productVariantData.media[0]?.file || "/placeholder-product.png",
15721
15721
  alt: item.productVariantData.name,
15722
15722
  className: "w-full h-full object-cover",
15723
15723
  height: 112,
@@ -17134,7 +17134,7 @@ function CheckoutScreen() {
17134
17134
  /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
17135
17135
  Image4,
17136
17136
  {
17137
- src: rate.providerImage75 || "/placeholder-product.jpg",
17137
+ src: rate.providerImage75 || "/placeholder-product.png",
17138
17138
  alt: rate.provider,
17139
17139
  className: "w-12 h-12 rounded-lg object-contain bg-white border border-gray-200 p-1",
17140
17140
  onError: (e) => {
@@ -17219,7 +17219,7 @@ function CheckoutScreen() {
17219
17219
  /* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
17220
17220
  /* @__PURE__ */ jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
17221
17221
  /* @__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 || "/placeholder-product.jpg", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
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 }) }),
17223
17223
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
17224
17224
  /* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
17225
17225
  /* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
@@ -18401,7 +18401,7 @@ function AccountOrdersTab() {
18401
18401
  /* @__PURE__ */ jsx("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsx(
18402
18402
  Image4,
18403
18403
  {
18404
- src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
18404
+ src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
18405
18405
  alt: item?.productVariantData?.name || "Product image",
18406
18406
  fill: true,
18407
18407
  className: "object-cover",
@@ -18424,94 +18424,6 @@ function AccountOrdersTab() {
18424
18424
  );
18425
18425
  }) });
18426
18426
  }
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
18427
  function ConfirmModal({
18516
18428
  isOpen,
18517
18429
  onClose,
@@ -18916,7 +18828,6 @@ var tabs = [
18916
18828
  { id: "overview", label: "Overview", icon: User },
18917
18829
  { id: "orders", label: "Orders", icon: Package },
18918
18830
  { id: "reviews", label: "My Reviews", icon: Star },
18919
- { id: "saved-items", label: "Saved Items", icon: Heart },
18920
18831
  // { id: 'payment', label: 'Payment', icon: CreditCard },
18921
18832
  { id: "addresses", label: "Addresses", icon: MapPin },
18922
18833
  { id: "settings", label: "Settings", icon: Settings }
@@ -18950,8 +18861,8 @@ function AccountPage() {
18950
18861
  return /* @__PURE__ */ jsx(AccountOrdersTab, {});
18951
18862
  case "reviews":
18952
18863
  return /* @__PURE__ */ jsx(AccountReviewsTab, {});
18953
- case "saved-items":
18954
- return /* @__PURE__ */ jsx(AccountSavedItemsTab, {});
18864
+ // case 'saved-items':
18865
+ // return <AccountSavedItemsTab />;
18955
18866
  // case 'payment':
18956
18867
  // return <AccountPaymentTab />;
18957
18868
  case "addresses":
@@ -19046,7 +18957,7 @@ function OrderCard({ order, onDelete }) {
19046
18957
  /* @__PURE__ */ jsx("div", { className: "relative w-12 h-12 rounded-sm bg-gray-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsx(
19047
18958
  Image4,
19048
18959
  {
19049
- src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
18960
+ src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
19050
18961
  alt: item?.productVariantData?.name || "Product image",
19051
18962
  fill: true,
19052
18963
  className: "object-cover",
@@ -20014,6 +19925,53 @@ You can add it back at any time.`
20014
19925
  )
20015
19926
  ] });
20016
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
+ }
20017
19975
  var SORT_OPTIONS = [
20018
19976
  { value: "featured", label: "Most loved" },
20019
19977
  { value: "price-low", label: "Price: Low to High" },
@@ -20268,7 +20226,7 @@ function WishlistScreen() {
20268
20226
  Image4,
20269
20227
  {
20270
20228
  fill: true,
20271
- src: product.media?.[0]?.file || "/placeholder-product.jpg",
20229
+ src: product.media?.[0]?.file || "/placeholder-product.png",
20272
20230
  alt: product.name || "Wishlist item",
20273
20231
  className: "h-full w-full object-cover"
20274
20232
  }
@@ -21714,7 +21672,7 @@ function OrderDetailScreen({ id }) {
21714
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(
21715
21673
  Image4,
21716
21674
  {
21717
- src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
21675
+ src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
21718
21676
  alt: item.productVariantData?.name || "Item",
21719
21677
  fill: true,
21720
21678
  className: "object-cover",