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 CHANGED
@@ -12871,7 +12871,6 @@ function NotificationDrawer() {
12871
12871
  closeDrawer();
12872
12872
  router.push(buildPath("/account/notifications"));
12873
12873
  };
12874
- console.log(notifications);
12875
12874
  return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isDrawerOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12876
12875
  /* @__PURE__ */ jsxRuntime.jsx(
12877
12876
  framerMotion.motion.div,
@@ -12890,7 +12889,7 @@ function NotificationDrawer() {
12890
12889
  animate: { x: 0 },
12891
12890
  exit: { x: "100%" },
12892
12891
  transition: { type: "spring", damping: 25, stiffness: 200 },
12893
- className: "fixed right-0 top-0 bottom-0 w-full sm:w-[480px] bg-white shadow-2xl z-50 flex flex-col",
12892
+ 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]",
12894
12893
  children: [
12895
12894
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 bg-white", children: [
12896
12895
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
@@ -13298,7 +13297,7 @@ function ProductCard({
13298
13297
  return selectedVariant ? selectedVariant.inventoryCount : product.variants?.[0]?.inventoryCount;
13299
13298
  }, [selectedVariant, product.variants]);
13300
13299
  const imageSource = React12.useMemo(() => {
13301
- const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.jpg";
13300
+ const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.png";
13302
13301
  return {
13303
13302
  src,
13304
13303
  alt: product.name || "Product image"
@@ -13528,7 +13527,7 @@ function Button({
13528
13527
  }) {
13529
13528
  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";
13530
13529
  const variants = {
13531
- primary: "bg-primary-600 text-white hover:bg-primary-700 shadow-lg shadow-primary-500/30 hover:shadow-xl hover:shadow-primary-500/40",
13530
+ primary: "bg-[#0E172B] text-white hover:bg-[#0E172B]/80 shadow-lg shadow-[#0E172B]/30 hover:shadow-xl hover:shadow-[#0E172B]/40",
13532
13531
  secondary: "bg-secondary-600 text-white hover:bg-secondary-700 shadow-lg shadow-secondary-500/30 hover:shadow-xl hover:shadow-secondary-500/40",
13533
13532
  "outline-solid": "border-2 border-primary-600 text-primary-600 hover:bg-primary-50",
13534
13533
  ghost: "text-gray-700 hover:bg-gray-100"
@@ -14601,7 +14600,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
14601
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(
14602
14601
  Image4__default.default,
14603
14602
  {
14604
- src: product.media?.[0]?.file || "/placeholder-product.jpg",
14603
+ src: product.media?.[0]?.file || "/placeholder-product.png",
14605
14604
  alt: product.name,
14606
14605
  fill: true,
14607
14606
  className: "object-cover transition duration-500 group-hover:scale-105"
@@ -15521,7 +15520,7 @@ function ProductDetailScreen({ productId }) {
15521
15520
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
15522
15521
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant) => {
15523
15522
  const isSelected = selectedVariant?._id === variant._id;
15524
- const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.jpg";
15523
+ const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.png";
15525
15524
  return /* @__PURE__ */ jsxRuntime.jsxs(
15526
15525
  "button",
15527
15526
  {
@@ -15728,7 +15727,7 @@ function CartItem({ item }) {
15728
15727
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-28 h-28 rounded-[16px] overflow-hidden bg-gray-50 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
15729
15728
  Image4__default.default,
15730
15729
  {
15731
- src: item.productVariantData.media[0]?.file || "/placeholder-product.jpg",
15730
+ src: item.productVariantData.media[0]?.file || "/placeholder-product.png",
15732
15731
  alt: item.productVariantData.name,
15733
15732
  className: "w-full h-full object-cover",
15734
15733
  height: 112,
@@ -17145,7 +17144,7 @@ function CheckoutScreen() {
17145
17144
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
17146
17145
  Image4__default.default,
17147
17146
  {
17148
- src: rate.providerImage75 || "/placeholder-product.jpg",
17147
+ src: rate.providerImage75 || "/placeholder-product.png",
17149
17148
  alt: rate.provider,
17150
17149
  className: "w-12 h-12 rounded-lg object-contain bg-white border border-gray-200 p-1",
17151
17150
  onError: (e) => {
@@ -17230,7 +17229,7 @@ function CheckoutScreen() {
17230
17229
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
17231
17230
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
17232
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: [
17233
- /* @__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.jpg", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
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 }) }),
17234
17233
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
17235
17234
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
17236
17235
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
@@ -18412,7 +18411,7 @@ function AccountOrdersTab() {
18412
18411
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
18413
18412
  Image4__default.default,
18414
18413
  {
18415
- src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
18414
+ src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
18416
18415
  alt: item?.productVariantData?.name || "Product image",
18417
18416
  fill: true,
18418
18417
  className: "object-cover",
@@ -18435,94 +18434,6 @@ function AccountOrdersTab() {
18435
18434
  );
18436
18435
  }) });
18437
18436
  }
18438
- function useWishlistProducts(productIds = []) {
18439
- const [products, setProducts] = React12.useState([]);
18440
- const [isLoading, setIsLoading] = React12.useState(false);
18441
- const [error, setError] = React12.useState(null);
18442
- const [cache] = React12.useState(() => /* @__PURE__ */ new Map());
18443
- const uniqueIds = React12.useMemo(
18444
- () => Array.from(new Set((productIds || []).filter(Boolean))),
18445
- [productIds]
18446
- );
18447
- const fetchProducts = React12.useCallback(async () => {
18448
- if (uniqueIds.length === 0) {
18449
- setProducts([]);
18450
- setIsLoading(false);
18451
- setError(null);
18452
- return;
18453
- }
18454
- setIsLoading(true);
18455
- setError(null);
18456
- try {
18457
- const api = new ProductsApi(AXIOS_CONFIG);
18458
- const results = await Promise.all(
18459
- uniqueIds.map(async (id) => {
18460
- if (cache.has(id)) return cache.get(id);
18461
- const response = await api.getSingleProduct(id?._id || id || "");
18462
- const product = response.data;
18463
- cache.set(id, product);
18464
- return product;
18465
- })
18466
- );
18467
- setProducts(results);
18468
- } catch (err) {
18469
- setError(err);
18470
- console.error("Failed to load wishlist products", err);
18471
- } finally {
18472
- setIsLoading(false);
18473
- }
18474
- }, [cache, uniqueIds]);
18475
- React12.useEffect(() => {
18476
- fetchProducts();
18477
- }, [fetchProducts]);
18478
- return {
18479
- products,
18480
- isLoading,
18481
- error,
18482
- refetch: fetchProducts
18483
- };
18484
- }
18485
- function AccountSavedItemsTab() {
18486
- const { products: wishlistProductIds } = useWishlist();
18487
- const { products: wishlistProducts, isLoading, error } = useWishlistProducts(
18488
- wishlistProductIds
18489
- );
18490
- const products = wishlistProducts || [];
18491
- if (isLoading) {
18492
- 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(
18493
- "div",
18494
- {
18495
- className: "h-80 animate-pulse rounded-lg border border-slate-100 bg-slate-50"
18496
- },
18497
- index
18498
- )) }) });
18499
- }
18500
- if (error) {
18501
- 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 }) });
18502
- }
18503
- if (products.length === 0) {
18504
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsx(
18505
- EmptyState,
18506
- {
18507
- icon: lucideReact.Heart,
18508
- title: "No saved items",
18509
- description: "Items you save will appear here for easy access later."
18510
- }
18511
- ) });
18512
- }
18513
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-24 p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 bg-white rounded-xl", children: [
18514
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
18515
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-secondary", children: "Saved for Later" }),
18516
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-secondary", children: [
18517
- products.length,
18518
- " ",
18519
- products.length === 1 ? "item" : "items",
18520
- " saved"
18521
- ] })
18522
- ] }),
18523
- /* @__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)) })
18524
- ] }) });
18525
- }
18526
18437
  function ConfirmModal({
18527
18438
  isOpen,
18528
18439
  onClose,
@@ -18927,7 +18838,6 @@ var tabs = [
18927
18838
  { id: "overview", label: "Overview", icon: lucideReact.User },
18928
18839
  { id: "orders", label: "Orders", icon: lucideReact.Package },
18929
18840
  { id: "reviews", label: "My Reviews", icon: lucideReact.Star },
18930
- { id: "saved-items", label: "Saved Items", icon: lucideReact.Heart },
18931
18841
  // { id: 'payment', label: 'Payment', icon: CreditCard },
18932
18842
  { id: "addresses", label: "Addresses", icon: lucideReact.MapPin },
18933
18843
  { id: "settings", label: "Settings", icon: lucideReact.Settings }
@@ -18961,8 +18871,8 @@ function AccountPage() {
18961
18871
  return /* @__PURE__ */ jsxRuntime.jsx(AccountOrdersTab, {});
18962
18872
  case "reviews":
18963
18873
  return /* @__PURE__ */ jsxRuntime.jsx(AccountReviewsTab, {});
18964
- case "saved-items":
18965
- return /* @__PURE__ */ jsxRuntime.jsx(AccountSavedItemsTab, {});
18874
+ // case 'saved-items':
18875
+ // return <AccountSavedItemsTab />;
18966
18876
  // case 'payment':
18967
18877
  // return <AccountPaymentTab />;
18968
18878
  case "addresses":
@@ -19057,7 +18967,7 @@ function OrderCard({ order, onDelete }) {
19057
18967
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12 rounded-sm bg-gray-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
19058
18968
  Image4__default.default,
19059
18969
  {
19060
- src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
18970
+ src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
19061
18971
  alt: item?.productVariantData?.name || "Product image",
19062
18972
  fill: true,
19063
18973
  className: "object-cover",
@@ -20025,6 +19935,53 @@ You can add it back at any time.`
20025
19935
  )
20026
19936
  ] });
20027
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
+ }
20028
19985
  var SORT_OPTIONS = [
20029
19986
  { value: "featured", label: "Most loved" },
20030
19987
  { value: "price-low", label: "Price: Low to High" },
@@ -20279,7 +20236,7 @@ function WishlistScreen() {
20279
20236
  Image4__default.default,
20280
20237
  {
20281
20238
  fill: true,
20282
- src: product.media?.[0]?.file || "/placeholder-product.jpg",
20239
+ src: product.media?.[0]?.file || "/placeholder-product.png",
20283
20240
  alt: product.name || "Wishlist item",
20284
20241
  className: "h-full w-full object-cover"
20285
20242
  }
@@ -21725,7 +21682,7 @@ function OrderDetailScreen({ id }) {
21725
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(
21726
21683
  Image4__default.default,
21727
21684
  {
21728
- src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
21685
+ src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.png",
21729
21686
  alt: item.productVariantData?.name || "Item",
21730
21687
  fill: true,
21731
21688
  className: "object-cover",
@@ -21942,7 +21899,16 @@ function ChangePasswordScreen() {
21942
21899
  }
21943
21900
  ),
21944
21901
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-3", children: [
21945
- /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", size: "lg", isLoading: isSubmitting, children: "Save password" }),
21902
+ /* @__PURE__ */ jsxRuntime.jsx(
21903
+ Button,
21904
+ {
21905
+ variant: "primary",
21906
+ type: "submit",
21907
+ size: "lg",
21908
+ isLoading: isSubmitting,
21909
+ children: "Save password"
21910
+ }
21911
+ ),
21946
21912
  /* @__PURE__ */ jsxRuntime.jsx(
21947
21913
  Button,
21948
21914
  {