hey-pharmacist-ecommerce 1.1.22 → 1.1.24
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 +80 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -154
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountSavedItemsTab.tsx +0 -1
- package/src/components/ProductCard.tsx +5 -3
- package/src/components/QuickViewModal.tsx +66 -67
- package/src/hooks/useOrders.ts +0 -1
- package/src/hooks/useProducts.ts +3 -3
- package/src/lib/Apis/apis/products-api.ts +0 -104
- package/src/providers/CartProvider.tsx +0 -6
- package/src/providers/EcommerceProvider.tsx +16 -16
- package/src/screens/NewAddressScreen.tsx +9 -10
- package/src/screens/ProductDetailScreen.tsx +9 -11
- package/src/screens/SearchResultsScreen.tsx +2 -3
- package/src/screens/ShopScreen.tsx +57 -62
package/dist/index.mjs
CHANGED
|
@@ -3,12 +3,12 @@ import React8, { createContext, forwardRef, useContext, useEffect, useState, use
|
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import globalAxios4 from 'axios';
|
|
5
5
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
6
|
-
import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock,
|
|
6
|
+
import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, Package, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, AlertCircle, Lock, EyeOff, UserPlus, User, Settings, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, ArrowLeft, LogOut, Menu, Mail, Facebook, Twitter, Instagram, Shirt, Pill, Box, ExternalLink, Globe, Home, CheckCircle, Edit, Bell, AlertTriangle, Info, XCircle } from 'lucide-react';
|
|
7
7
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
8
8
|
import { useRouter, useSearchParams } from 'next/navigation';
|
|
9
9
|
import Image4 from 'next/image';
|
|
10
|
+
import Link7 from 'next/link';
|
|
10
11
|
import dynamic from 'next/dynamic';
|
|
11
|
-
import Link6 from 'next/link';
|
|
12
12
|
import { useForm } from 'react-hook-form';
|
|
13
13
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
14
14
|
import { z } from 'zod';
|
|
@@ -5537,56 +5537,6 @@ var ProductsApiAxiosParamCreator = function(configuration) {
|
|
|
5537
5537
|
options: localVarRequestOptions
|
|
5538
5538
|
};
|
|
5539
5539
|
},
|
|
5540
|
-
/**
|
|
5541
|
-
*
|
|
5542
|
-
* @summary Set or unset a product as featured for home screen
|
|
5543
|
-
* @param {string} id Product ID
|
|
5544
|
-
* @param {boolean} featured Whether to set the product as featured
|
|
5545
|
-
* @param {*} [options] Override http request option.
|
|
5546
|
-
* @throws {RequiredError}
|
|
5547
|
-
*/
|
|
5548
|
-
setFeaturedProduct: async (id, featured, options = {}) => {
|
|
5549
|
-
if (id === null || id === void 0) {
|
|
5550
|
-
throw new RequiredError("id", "Required parameter id was null or undefined when calling setFeaturedProduct.");
|
|
5551
|
-
}
|
|
5552
|
-
if (featured === null || featured === void 0) {
|
|
5553
|
-
throw new RequiredError("featured", "Required parameter featured was null or undefined when calling setFeaturedProduct.");
|
|
5554
|
-
}
|
|
5555
|
-
const localVarPath = `/products/{id}/featured`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
5556
|
-
const localVarUrlObj = new URL(localVarPath, "https://example.com");
|
|
5557
|
-
let baseOptions;
|
|
5558
|
-
if (configuration) {
|
|
5559
|
-
baseOptions = configuration.baseOptions;
|
|
5560
|
-
}
|
|
5561
|
-
const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
|
|
5562
|
-
const localVarHeaderParameter = {};
|
|
5563
|
-
const localVarQueryParameter = {};
|
|
5564
|
-
if (configuration && configuration.accessToken) {
|
|
5565
|
-
const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
|
|
5566
|
-
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
|
5567
|
-
}
|
|
5568
|
-
if (configuration && configuration.apiKey) {
|
|
5569
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
|
|
5570
|
-
localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
|
|
5571
|
-
}
|
|
5572
|
-
if (featured !== void 0) {
|
|
5573
|
-
localVarQueryParameter["featured"] = featured;
|
|
5574
|
-
}
|
|
5575
|
-
const query = new URLSearchParams(localVarUrlObj.search);
|
|
5576
|
-
for (const key in localVarQueryParameter) {
|
|
5577
|
-
query.set(key, localVarQueryParameter[key]);
|
|
5578
|
-
}
|
|
5579
|
-
for (const key in options.params) {
|
|
5580
|
-
query.set(key, options.params[key]);
|
|
5581
|
-
}
|
|
5582
|
-
localVarUrlObj.search = new URLSearchParams(query).toString();
|
|
5583
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
5584
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
5585
|
-
return {
|
|
5586
|
-
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
|
5587
|
-
options: localVarRequestOptions
|
|
5588
|
-
};
|
|
5589
|
-
},
|
|
5590
5540
|
/**
|
|
5591
5541
|
*
|
|
5592
5542
|
* @summary Update a product
|
|
@@ -5841,21 +5791,6 @@ var ProductsApiFp = function(configuration) {
|
|
|
5841
5791
|
return axios.request(axiosRequestArgs);
|
|
5842
5792
|
};
|
|
5843
5793
|
},
|
|
5844
|
-
/**
|
|
5845
|
-
*
|
|
5846
|
-
* @summary Set or unset a product as featured for home screen
|
|
5847
|
-
* @param {string} id Product ID
|
|
5848
|
-
* @param {boolean} featured Whether to set the product as featured
|
|
5849
|
-
* @param {*} [options] Override http request option.
|
|
5850
|
-
* @throws {RequiredError}
|
|
5851
|
-
*/
|
|
5852
|
-
async setFeaturedProduct(id, featured, options) {
|
|
5853
|
-
const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).setFeaturedProduct(id, featured, options);
|
|
5854
|
-
return (axios = globalAxios4, basePath = BASE_PATH) => {
|
|
5855
|
-
const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
|
|
5856
|
-
return axios.request(axiosRequestArgs);
|
|
5857
|
-
};
|
|
5858
|
-
},
|
|
5859
5794
|
/**
|
|
5860
5795
|
*
|
|
5861
5796
|
* @summary Update a product
|
|
@@ -6038,18 +5973,6 @@ var ProductsApi = class extends BaseAPI {
|
|
|
6038
5973
|
async getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options) {
|
|
6039
5974
|
return ProductsApiFp(this.configuration).getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options).then((request) => request(this.axios, this.basePath));
|
|
6040
5975
|
}
|
|
6041
|
-
/**
|
|
6042
|
-
*
|
|
6043
|
-
* @summary Set or unset a product as featured for home screen
|
|
6044
|
-
* @param {string} id Product ID
|
|
6045
|
-
* @param {boolean} featured Whether to set the product as featured
|
|
6046
|
-
* @param {*} [options] Override http request option.
|
|
6047
|
-
* @throws {RequiredError}
|
|
6048
|
-
* @memberof ProductsApi
|
|
6049
|
-
*/
|
|
6050
|
-
async setFeaturedProduct(id, featured, options) {
|
|
6051
|
-
return ProductsApiFp(this.configuration).setFeaturedProduct(id, featured, options).then((request) => request(this.axios, this.basePath));
|
|
6052
|
-
}
|
|
6053
5976
|
/**
|
|
6054
5977
|
*
|
|
6055
5978
|
* @summary Update a product
|
|
@@ -7162,7 +7085,6 @@ function CartProvider({ children }) {
|
|
|
7162
7085
|
_id: oldCart.cartBody._id,
|
|
7163
7086
|
items: simplifiedItems
|
|
7164
7087
|
};
|
|
7165
|
-
console.log("payload", payload);
|
|
7166
7088
|
const response = await new CartApi(getApiConfiguration()).handleUserCart(payload);
|
|
7167
7089
|
if (response.data) {
|
|
7168
7090
|
setCart(response.data);
|
|
@@ -7194,16 +7116,13 @@ function CartProvider({ children }) {
|
|
|
7194
7116
|
};
|
|
7195
7117
|
});
|
|
7196
7118
|
try {
|
|
7197
|
-
console.log("Removing item with productVariantId:", productId);
|
|
7198
7119
|
const itemsToKeep = currentCart.cartBody.items.filter((item) => String(item.productVariantId) !== String(productId));
|
|
7199
|
-
console.log("Items to keep count:", itemsToKeep.length);
|
|
7200
7120
|
const simplifiedItems = itemsToKeep.map((item) => ({
|
|
7201
7121
|
_id: item._id,
|
|
7202
7122
|
productVariantId: item.productVariantId,
|
|
7203
7123
|
quantity: item.quantity
|
|
7204
7124
|
}));
|
|
7205
7125
|
if (simplifiedItems.length === 0) {
|
|
7206
|
-
console.log("Cart will be empty, calling clearCart");
|
|
7207
7126
|
await new CartApi(getApiConfiguration()).clearCart();
|
|
7208
7127
|
setCart(null);
|
|
7209
7128
|
} else {
|
|
@@ -7211,9 +7130,7 @@ function CartProvider({ children }) {
|
|
|
7211
7130
|
_id: currentCart.cartBody._id,
|
|
7212
7131
|
items: simplifiedItems
|
|
7213
7132
|
};
|
|
7214
|
-
console.log("Remove from cart payload:", JSON.stringify(payload, null, 2));
|
|
7215
7133
|
const response = await new CartApi(getApiConfiguration()).handleUserCart(payload);
|
|
7216
|
-
console.log("Remove from cart response:", response.status, response.data);
|
|
7217
7134
|
if (response.data) {
|
|
7218
7135
|
setCart(response.data);
|
|
7219
7136
|
}
|
|
@@ -7453,7 +7370,7 @@ function useBasePath() {
|
|
|
7453
7370
|
return ctx;
|
|
7454
7371
|
}
|
|
7455
7372
|
function EcommerceProvider({ config, children, withToaster = true, basePath = "" }) {
|
|
7456
|
-
|
|
7373
|
+
React8.useMemo(() => {
|
|
7457
7374
|
initializeApiAdapter(config);
|
|
7458
7375
|
}, [config]);
|
|
7459
7376
|
const [client] = React8.useState(
|
|
@@ -7518,7 +7435,6 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
|
7518
7435
|
if (!product || !selectedVariant) return;
|
|
7519
7436
|
setIsAddingToCart(true);
|
|
7520
7437
|
try {
|
|
7521
|
-
console.log(selectedVariant);
|
|
7522
7438
|
await addToCart(
|
|
7523
7439
|
product.id,
|
|
7524
7440
|
quantity,
|
|
@@ -7554,7 +7470,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
|
7554
7470
|
/* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-primary uppercase tracking-wide font-medium mb-2", children: [
|
|
7555
7471
|
product.brand,
|
|
7556
7472
|
" \u2022 ",
|
|
7557
|
-
product.parentCategories[0]
|
|
7473
|
+
product.parentCategories?.[0]?.name || "Uncategorized"
|
|
7558
7474
|
] }),
|
|
7559
7475
|
/* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-secondary tracking-[-1px]", children: displayName }),
|
|
7560
7476
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
@@ -7590,7 +7506,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
|
7590
7506
|
{
|
|
7591
7507
|
src: selectedVariant.productMedia[selectedImageIndex]?.file || selectedVariant.productMedia[0]?.file,
|
|
7592
7508
|
alt: product.name,
|
|
7593
|
-
className: "w-full h-full object-
|
|
7509
|
+
className: "w-full h-full object-contain"
|
|
7594
7510
|
}
|
|
7595
7511
|
),
|
|
7596
7512
|
/* @__PURE__ */ jsx("div", { className: "absolute top-4 left-4 flex flex-col gap-2", children: isDiscounted && /* @__PURE__ */ jsx("div", { className: "bg-accent text-white rounded-full px-3 py-1.5", children: /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] font-bold text-[11px] uppercase", children: [
|
|
@@ -7609,7 +7525,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
|
7609
7525
|
{
|
|
7610
7526
|
src: image.file,
|
|
7611
7527
|
alt: `${product.name} ${index + 1}`,
|
|
7612
|
-
className: "w-full h-full object-
|
|
7528
|
+
className: "w-full h-full object-contain"
|
|
7613
7529
|
}
|
|
7614
7530
|
)
|
|
7615
7531
|
},
|
|
@@ -7636,7 +7552,13 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
|
7636
7552
|
/* @__PURE__ */ jsx(Package, { className: "size-3" }),
|
|
7637
7553
|
"In Stock"
|
|
7638
7554
|
] }) }),
|
|
7639
|
-
/* @__PURE__ */ jsx(
|
|
7555
|
+
/* @__PURE__ */ jsx(
|
|
7556
|
+
"div",
|
|
7557
|
+
{
|
|
7558
|
+
className: "font-['Poppins',sans-serif] text-[14px] text-muted leading-[1.7] mb-6 max-w-full overflow-hidden break-words",
|
|
7559
|
+
dangerouslySetInnerHTML: { __html: product.description }
|
|
7560
|
+
}
|
|
7561
|
+
),
|
|
7640
7562
|
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
7641
7563
|
/* @__PURE__ */ jsxs("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[13px] text-secondary mb-3", children: [
|
|
7642
7564
|
"Selected Variant: ",
|
|
@@ -7714,12 +7636,11 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
|
7714
7636
|
] })
|
|
7715
7637
|
}
|
|
7716
7638
|
),
|
|
7717
|
-
/* @__PURE__ */ jsxs(
|
|
7639
|
+
/* @__PURE__ */ jsx(Link7, { href: `/products/${product._id}`, children: /* @__PURE__ */ jsxs(
|
|
7718
7640
|
"button",
|
|
7719
7641
|
{
|
|
7720
7642
|
onClick: () => {
|
|
7721
7643
|
onClose();
|
|
7722
|
-
onNavigateToProduct?.(product.id);
|
|
7723
7644
|
},
|
|
7724
7645
|
className: "w-full font-['Poppins',sans-serif] font-medium text-[13px] px-6 py-3 rounded-full bg-white text-secondary border-2 border-primary hover:bg-gray-50 transition-all flex items-center justify-center gap-2",
|
|
7725
7646
|
children: [
|
|
@@ -7727,7 +7648,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
|
|
|
7727
7648
|
/* @__PURE__ */ jsx(ExternalLink, { className: "size-4" })
|
|
7728
7649
|
]
|
|
7729
7650
|
}
|
|
7730
|
-
)
|
|
7651
|
+
) })
|
|
7731
7652
|
] })
|
|
7732
7653
|
] })
|
|
7733
7654
|
] })
|
|
@@ -7888,7 +7809,7 @@ function ProductCard({
|
|
|
7888
7809
|
"%"
|
|
7889
7810
|
] }) }) }),
|
|
7890
7811
|
/* @__PURE__ */ jsx("div", { className: "mb-1", children: /* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] text-xs text-[#5B9BD5] uppercase tracking-wide font-medium", children: product.brand }) }),
|
|
7891
|
-
/* @__PURE__ */ jsx("h3", { className: "text-sm font-['Poppins',sans-serif] font-semibold text-[#2B4B7C]
|
|
7812
|
+
/* @__PURE__ */ jsx("div", { className: "h-[40px] mb-3", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] line-clamp-2", children: displayName }) }),
|
|
7892
7813
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-2", children: [
|
|
7893
7814
|
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsx(
|
|
7894
7815
|
Star,
|
|
@@ -8157,12 +8078,13 @@ function useProducts(filters, page = 1, limit = 20) {
|
|
|
8157
8078
|
page
|
|
8158
8079
|
);
|
|
8159
8080
|
}
|
|
8160
|
-
setProducts(response.data.data
|
|
8081
|
+
setProducts(response.data.data);
|
|
8161
8082
|
setPagination({
|
|
8162
8083
|
page: response.data.currentPage || page,
|
|
8163
8084
|
limit: response.data.limit || limit,
|
|
8164
|
-
total:
|
|
8165
|
-
|
|
8085
|
+
total: products.length,
|
|
8086
|
+
// Use filtered count
|
|
8087
|
+
totalPages: Math.ceil(products.length / limit)
|
|
8166
8088
|
});
|
|
8167
8089
|
} catch (err) {
|
|
8168
8090
|
setError(err);
|
|
@@ -8935,33 +8857,32 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
8935
8857
|
) }) }),
|
|
8936
8858
|
/* @__PURE__ */ jsx("section", { className: "py-8 bg-white", children: /* @__PURE__ */ jsxs("div", { className: "container mx-auto px-4", children: [
|
|
8937
8859
|
/* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-['Poppins',sans-serif] font-semibold text-secondary mb-6", children: "Shop by Category" }),
|
|
8938
|
-
/* @__PURE__ */
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
{
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
className: `
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
/* @__PURE__ */ jsx(
|
|
8860
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4", children: [
|
|
8861
|
+
/* @__PURE__ */ jsx(
|
|
8862
|
+
motion.button,
|
|
8863
|
+
{
|
|
8864
|
+
onClick: handleClearCategory,
|
|
8865
|
+
initial: { opacity: 0, y: 20 },
|
|
8866
|
+
animate: { opacity: 1, y: 0 },
|
|
8867
|
+
className: `group relative overflow-hidden rounded-[24px] p-6 min-h-[180px] min-w-[170px] transition-all duration-300 ${!categoryFilter ? "bg-linear-to-br from-primary to-secondary text-white shadow-xl scale-105" : "bg-linear-to-br from-gray-50 to-white hover:shadow-lg border-2 border-gray-100 hover:border-primary"}`,
|
|
8868
|
+
children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
8869
|
+
/* @__PURE__ */ jsx("div", { className: `size-12 rounded-full mb-3 mx-auto flex items-center justify-center transition-all ${!categoryFilter ? "bg-white/20" : "bg-linear-to-br from-primary/10 to-secondary/10 group-hover:scale-110"}`, children: /* @__PURE__ */ jsx(Package, { className: `size-6 ${!categoryFilter ? "text-white" : "text-primary"}` }) }),
|
|
8870
|
+
/* @__PURE__ */ jsx("h3", { className: `font-['Poppins',sans-serif] font-semibold text-[14px] mb-1.5 ${!categoryFilter ? "text-white" : "text-secondary"}`, children: "All Products" }),
|
|
8871
|
+
/* @__PURE__ */ jsx("p", { className: `font-['Poppins',sans-serif] text-[11px] ${!categoryFilter ? "text-white/80" : "text-muted"}`, children: "Browse Everything" })
|
|
8872
|
+
] })
|
|
8873
|
+
}
|
|
8874
|
+
),
|
|
8875
|
+
displayCategories.map((category, index) => {
|
|
8876
|
+
const Icon = getCategoryIcon(category.name ?? "");
|
|
8877
|
+
const isSelected = categoryFilter === category.id;
|
|
8878
|
+
return /* @__PURE__ */ jsx(
|
|
8958
8879
|
motion.button,
|
|
8959
8880
|
{
|
|
8960
8881
|
initial: { opacity: 0, y: 20 },
|
|
8961
8882
|
animate: { opacity: 1, y: 0 },
|
|
8962
8883
|
transition: { delay: index * 0.1 },
|
|
8963
8884
|
onClick: () => handleCategoryChange(category.id ?? ""),
|
|
8964
|
-
className: `group relative overflow-hidden rounded-[24px] p-6 transition-all duration-300 ${isSelected ? "bg-linear-to-br from-primary to-secondary text-white shadow-xl scale-105" : "bg-linear-to-br from-gray-50 to-white hover:shadow-lg border-2 border-gray-100 hover:border-primary"}`,
|
|
8885
|
+
className: `group relative overflow-hidden rounded-[24px] p-6 min-h-[180px] min-w-[170px] transition-all duration-300 ${isSelected ? "bg-linear-to-br from-primary to-secondary text-white shadow-xl scale-105" : "bg-linear-to-br from-gray-50 to-white hover:shadow-lg border-2 border-gray-100 hover:border-primary"}`,
|
|
8965
8886
|
children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
8966
8887
|
/* @__PURE__ */ jsx("div", { className: `size-12 rounded-full mb-3 mx-auto flex items-center justify-center transition-all ${isSelected ? "bg-white/20" : "bg-linear-to-br from-primary/10 to-secondary/10 group-hover:scale-110"}`, children: /* @__PURE__ */ jsx(Icon, { className: `size-6 ${isSelected ? "text-white" : "text-primary"}` }) }),
|
|
8967
8888
|
/* @__PURE__ */ jsx("h3", { className: `font-['Poppins',sans-serif] font-semibold text-[14px] mb-1.5 ${isSelected ? "text-white" : "text-secondary"}`, children: category.name }),
|
|
@@ -8969,9 +8890,9 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
8969
8890
|
] })
|
|
8970
8891
|
},
|
|
8971
8892
|
category.id
|
|
8972
|
-
)
|
|
8973
|
-
|
|
8974
|
-
|
|
8893
|
+
);
|
|
8894
|
+
})
|
|
8895
|
+
] })
|
|
8975
8896
|
] }) }),
|
|
8976
8897
|
/* @__PURE__ */ jsx("div", { className: "relative pb-16 mt-8", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8 lg:flex-row", children: [
|
|
8977
8898
|
/* @__PURE__ */ jsx("aside", { className: "hidden w-72 shrink-0 lg:block", children: /* @__PURE__ */ jsx("div", { className: "sticky top-24 rounded-lg bg-white", children: renderFiltersPanel() }) }),
|
|
@@ -9058,7 +8979,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
9058
8979
|
router.push(buildPath(`/products/${item._id}`));
|
|
9059
8980
|
}
|
|
9060
8981
|
}
|
|
9061
|
-
) }, product.
|
|
8982
|
+
) }, product._id)) }) : /* @__PURE__ */ jsx("div", { className: "space-y-4", children: displayedProducts.map((product) => {
|
|
9062
8983
|
product.priceBeforeDiscount && product.priceBeforeDiscount > product.finalPrice ? Math.round(
|
|
9063
8984
|
(product.priceBeforeDiscount - product.finalPrice) / product.priceBeforeDiscount * 100
|
|
9064
8985
|
) : 0;
|
|
@@ -9090,7 +9011,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
9090
9011
|
tag
|
|
9091
9012
|
))
|
|
9092
9013
|
] }),
|
|
9093
|
-
/* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-gray-900", children: product.name }),
|
|
9014
|
+
/* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-gray-900 line-clamp-2", children: product.name }),
|
|
9094
9015
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4 text-sm text-gray-500", children: [
|
|
9095
9016
|
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2 font-medium text-primary-600", children: [
|
|
9096
9017
|
/* @__PURE__ */ jsx(ShieldCheck, { className: "h-4 w-4" }),
|
|
@@ -9122,7 +9043,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
9122
9043
|
] })
|
|
9123
9044
|
]
|
|
9124
9045
|
},
|
|
9125
|
-
product.
|
|
9046
|
+
product._id
|
|
9126
9047
|
);
|
|
9127
9048
|
}) }) : /* @__PURE__ */ jsx(
|
|
9128
9049
|
EmptyState,
|
|
@@ -9194,9 +9115,6 @@ function ProductDetailScreen({ productId }) {
|
|
|
9194
9115
|
setActiveImageIndex(0);
|
|
9195
9116
|
}, [selectedVariant]);
|
|
9196
9117
|
const product = useMemo(() => {
|
|
9197
|
-
console.log("productData", productData);
|
|
9198
|
-
console.log("selectedVariant", selectedVariant);
|
|
9199
|
-
console.log("initialProductData", initialProductData);
|
|
9200
9118
|
if (initialProductData && !productData) {
|
|
9201
9119
|
return initialProductData;
|
|
9202
9120
|
}
|
|
@@ -9380,7 +9298,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
9380
9298
|
/* @__PURE__ */ jsx(Sparkles, { className: "mx-auto h-10 w-10 text-primary-500" }),
|
|
9381
9299
|
/* @__PURE__ */ jsx("h1", { className: "mt-6 text-2xl font-semibold text-gray-900", children: "Product not found" }),
|
|
9382
9300
|
/* @__PURE__ */ jsx("p", { className: "mt-2 text-gray-600", children: "It may have been removed or is temporarily unavailable. Discover other pharmacy essentials in our catalogue." }),
|
|
9383
|
-
/* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsx(
|
|
9301
|
+
/* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsx(Link7, { href: "/shop", className: "inline-block", children: /* @__PURE__ */ jsx(Button, { children: "Browse products" }) }) })
|
|
9384
9302
|
] }) }) });
|
|
9385
9303
|
}
|
|
9386
9304
|
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-white", children: [
|
|
@@ -9462,7 +9380,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
9462
9380
|
/* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[12px] text-primary uppercase tracking-wide font-medium mb-2", children: [
|
|
9463
9381
|
product.brand,
|
|
9464
9382
|
" \u2022 ",
|
|
9465
|
-
product.parentCategories?.[0]
|
|
9383
|
+
product.parentCategories?.[0]?.name || "Uncategorized"
|
|
9466
9384
|
] }),
|
|
9467
9385
|
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-['Poppins',sans-serif] font-semibold text-secondary tracking-[-1.5px] mb-3", children: selectedVariant?.name || product.name }),
|
|
9468
9386
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
@@ -9516,7 +9434,13 @@ function ProductDetailScreen({ productId }) {
|
|
|
9516
9434
|
selectedVariant?.sku
|
|
9517
9435
|
] })
|
|
9518
9436
|
] }),
|
|
9519
|
-
product.description && /* @__PURE__ */ jsx(
|
|
9437
|
+
product.description && /* @__PURE__ */ jsx(
|
|
9438
|
+
"div",
|
|
9439
|
+
{
|
|
9440
|
+
className: "font-['Poppins',sans-serif] text-[14px] text-muted leading-[1.7] mb-8 max-w-full overflow-hidden break-words",
|
|
9441
|
+
dangerouslySetInnerHTML: { __html: product.description }
|
|
9442
|
+
}
|
|
9443
|
+
),
|
|
9520
9444
|
product?.productVariants && product.productVariants.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
9521
9445
|
/* @__PURE__ */ jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
|
|
9522
9446
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: product.productVariants.map((variant) => {
|
|
@@ -9658,7 +9582,13 @@ function ProductDetailScreen({ productId }) {
|
|
|
9658
9582
|
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-[24px] p-8 border-2 border-gray-100", children: [
|
|
9659
9583
|
activeTab === "description" && /* @__PURE__ */ jsxs("div", { children: [
|
|
9660
9584
|
/* @__PURE__ */ jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-secondary mb-4", children: "Product Description" }),
|
|
9661
|
-
/* @__PURE__ */ jsx(
|
|
9585
|
+
/* @__PURE__ */ jsx(
|
|
9586
|
+
"div",
|
|
9587
|
+
{
|
|
9588
|
+
className: "font-['Poppins',sans-serif] text-[14px] text-muted leading-[1.8] mb-4 max-w-full overflow-hidden break-words",
|
|
9589
|
+
dangerouslySetInnerHTML: { __html: product.description }
|
|
9590
|
+
}
|
|
9591
|
+
),
|
|
9662
9592
|
/* @__PURE__ */ jsxs("div", { className: "mt-6", children: [
|
|
9663
9593
|
/* @__PURE__ */ jsx("h4", { className: "font-['Poppins',sans-serif] font-semibold text-[13px] text-secondary mb-3", children: "Last updated:" }),
|
|
9664
9594
|
/* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] text-[14px] text-muted", children: lastUpdatedLabel })
|
|
@@ -11195,7 +11125,7 @@ function LoginScreen() {
|
|
|
11195
11125
|
"Remember me"
|
|
11196
11126
|
] }),
|
|
11197
11127
|
/* @__PURE__ */ jsx(
|
|
11198
|
-
|
|
11128
|
+
Link7,
|
|
11199
11129
|
{
|
|
11200
11130
|
href: buildPath("/forgot-password"),
|
|
11201
11131
|
className: "font-medium text-primary transition hover:opacity-80",
|
|
@@ -11217,7 +11147,7 @@ function LoginScreen() {
|
|
|
11217
11147
|
),
|
|
11218
11148
|
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs("p", { className: "text-muted", children: [
|
|
11219
11149
|
"Don't have an account? ",
|
|
11220
|
-
/* @__PURE__ */ jsx(
|
|
11150
|
+
/* @__PURE__ */ jsx(Link7, { href: buildPath("/register"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign up" })
|
|
11221
11151
|
] }) })
|
|
11222
11152
|
] })
|
|
11223
11153
|
}
|
|
@@ -11405,12 +11335,12 @@ function RegisterScreen() {
|
|
|
11405
11335
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
11406
11336
|
"By creating an account, you agree to our",
|
|
11407
11337
|
" ",
|
|
11408
|
-
/* @__PURE__ */ jsx(
|
|
11338
|
+
/* @__PURE__ */ jsx(Link7, { href: buildPath("/terms"), className: "font-semibold text-primary hover:opacity-70", children: "Terms of Service" }),
|
|
11409
11339
|
" ",
|
|
11410
11340
|
"and",
|
|
11411
11341
|
" ",
|
|
11412
11342
|
/* @__PURE__ */ jsx(
|
|
11413
|
-
|
|
11343
|
+
Link7,
|
|
11414
11344
|
{
|
|
11415
11345
|
href: buildPath("/privacy"),
|
|
11416
11346
|
className: "font-semibold text-primary hover:opacity-70",
|
|
@@ -11434,7 +11364,7 @@ function RegisterScreen() {
|
|
|
11434
11364
|
),
|
|
11435
11365
|
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs("p", { className: "text-muted", children: [
|
|
11436
11366
|
"Already have an account? ",
|
|
11437
|
-
/* @__PURE__ */ jsx(
|
|
11367
|
+
/* @__PURE__ */ jsx(Link7, { href: buildPath("/login"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign in" })
|
|
11438
11368
|
] }) })
|
|
11439
11369
|
] })
|
|
11440
11370
|
}
|
|
@@ -11490,7 +11420,6 @@ function useOrders(page = 1, limit = 10, orderStatus, paymentStatus) {
|
|
|
11490
11420
|
resolvedUserId
|
|
11491
11421
|
);
|
|
11492
11422
|
setOrders(response.data.data || []);
|
|
11493
|
-
console.log(response.data);
|
|
11494
11423
|
setPagination({
|
|
11495
11424
|
page: response.data.page || page,
|
|
11496
11425
|
limit: response.data.limit || limit,
|
|
@@ -11873,7 +11802,6 @@ function AccountSavedItemsTab() {
|
|
|
11873
11802
|
wishlistProductIds
|
|
11874
11803
|
);
|
|
11875
11804
|
const products = wishlistProducts || [];
|
|
11876
|
-
console.log(products);
|
|
11877
11805
|
if (isLoading) {
|
|
11878
11806
|
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(
|
|
11879
11807
|
"div",
|
|
@@ -12650,7 +12578,7 @@ function CurrentOrdersScreen() {
|
|
|
12650
12578
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold uppercase tracking-[0.35em] text-white/70", children: "Quick actions" }),
|
|
12651
12579
|
/* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-3 text-sm text-white/80", children: [
|
|
12652
12580
|
/* @__PURE__ */ jsxs(
|
|
12653
|
-
|
|
12581
|
+
Link7,
|
|
12654
12582
|
{
|
|
12655
12583
|
href: buildPath("/orders"),
|
|
12656
12584
|
className: "flex items-center justify-between rounded-2xl bg-white/10 px-4 py-3 transition hover:bg-white/20",
|
|
@@ -13519,7 +13447,6 @@ function SearchPage() {
|
|
|
13519
13447
|
}
|
|
13520
13448
|
try {
|
|
13521
13449
|
setIsLoading(true);
|
|
13522
|
-
console.log(searchQuery);
|
|
13523
13450
|
const api = new ProductsApi(AXIOS_CONFIG);
|
|
13524
13451
|
const response = await api.getAllProductsForStore(
|
|
13525
13452
|
searchQuery,
|
|
@@ -13630,7 +13557,7 @@ function SearchPage() {
|
|
|
13630
13557
|
/* @__PURE__ */ jsxs("p", { className: "text-gray-500 mb-6", children: [
|
|
13631
13558
|
"Try different keywords or check out our",
|
|
13632
13559
|
" ",
|
|
13633
|
-
/* @__PURE__ */ jsx(
|
|
13560
|
+
/* @__PURE__ */ jsx(Link7, { href: "/shop", className: "text-primary-600 hover:underline ml-1 font-medium", children: "featured products" })
|
|
13634
13561
|
] })
|
|
13635
13562
|
] }) : /* @__PURE__ */ jsx("div", { className: "text-center py-12", children: /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "Enter a search term to find products" }) })
|
|
13636
13563
|
] })
|
|
@@ -13653,7 +13580,6 @@ function NewAddressPage() {
|
|
|
13653
13580
|
const onSubmit = async (data) => {
|
|
13654
13581
|
setIsSubmitting(true);
|
|
13655
13582
|
try {
|
|
13656
|
-
console.log("Submitting address data:", data);
|
|
13657
13583
|
const api = new AddressesApi(AXIOS_CONFIG);
|
|
13658
13584
|
const response = await api.createAddressForUser({
|
|
13659
13585
|
name: data.name,
|
|
@@ -13841,7 +13767,7 @@ function Header() {
|
|
|
13841
13767
|
{ href: buildPath("/shop"), label: "Shop" }
|
|
13842
13768
|
];
|
|
13843
13769
|
return /* @__PURE__ */ jsx("header", { className: "sticky top-0 z-10 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-xs", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between h-20", children: [
|
|
13844
|
-
/* @__PURE__ */ jsx(
|
|
13770
|
+
/* @__PURE__ */ jsx(Link7, { href: buildPath("/"), className: "flex items-center gap-3", children: /* @__PURE__ */ jsx("div", { className: "relative w-12 h-12", children: /* @__PURE__ */ jsx(
|
|
13845
13771
|
Image4,
|
|
13846
13772
|
{
|
|
13847
13773
|
src: config.logo,
|
|
@@ -13851,7 +13777,7 @@ function Header() {
|
|
|
13851
13777
|
}
|
|
13852
13778
|
) }) }),
|
|
13853
13779
|
/* @__PURE__ */ jsx("nav", { className: "hidden lg:flex items-center gap-8", children: navLinks.map((link) => /* @__PURE__ */ jsxs(
|
|
13854
|
-
|
|
13780
|
+
Link7,
|
|
13855
13781
|
{
|
|
13856
13782
|
href: link.href,
|
|
13857
13783
|
className: "text-gray-700 hover:text-primary-600 font-medium transition-colors relative group",
|
|
@@ -13911,11 +13837,11 @@ function Header() {
|
|
|
13911
13837
|
) })
|
|
13912
13838
|
] }),
|
|
13913
13839
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
13914
|
-
/* @__PURE__ */ jsxs(
|
|
13840
|
+
/* @__PURE__ */ jsxs(Link7, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors", children: [
|
|
13915
13841
|
/* @__PURE__ */ jsx(Heart, { className: "w-6 h-6" }),
|
|
13916
13842
|
wishlistCount > 0 && /* @__PURE__ */ jsx("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center", children: wishlistCount })
|
|
13917
13843
|
] }),
|
|
13918
|
-
/* @__PURE__ */ jsxs(
|
|
13844
|
+
/* @__PURE__ */ jsxs(Link7, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors", children: [
|
|
13919
13845
|
/* @__PURE__ */ jsx(ShoppingCart, { className: "w-6 h-6" }),
|
|
13920
13846
|
cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ jsx("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center", children: cart.cartBody?.items?.length }) : null
|
|
13921
13847
|
] }),
|
|
@@ -13949,7 +13875,7 @@ function Header() {
|
|
|
13949
13875
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500 truncate", children: user?.email })
|
|
13950
13876
|
] }),
|
|
13951
13877
|
/* @__PURE__ */ jsxs(
|
|
13952
|
-
|
|
13878
|
+
Link7,
|
|
13953
13879
|
{
|
|
13954
13880
|
href: buildPath("/account"),
|
|
13955
13881
|
onClick: () => setIsDropdownOpen(false),
|
|
@@ -13976,7 +13902,7 @@ function Header() {
|
|
|
13976
13902
|
] }) })
|
|
13977
13903
|
] })
|
|
13978
13904
|
] }) : /* @__PURE__ */ jsx(
|
|
13979
|
-
|
|
13905
|
+
Link7,
|
|
13980
13906
|
{
|
|
13981
13907
|
href: buildPath("/login"),
|
|
13982
13908
|
className: "hidden sm:block px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium",
|
|
@@ -14002,7 +13928,7 @@ function Header() {
|
|
|
14002
13928
|
className: "lg:hidden overflow-hidden border-t border-gray-200",
|
|
14003
13929
|
children: /* @__PURE__ */ jsxs("nav", { className: "flex flex-col gap-1 py-2", children: [
|
|
14004
13930
|
navLinks.map((link) => /* @__PURE__ */ jsx(
|
|
14005
|
-
|
|
13931
|
+
Link7,
|
|
14006
13932
|
{
|
|
14007
13933
|
href: link.href,
|
|
14008
13934
|
className: "px-4 py-3 text-gray-700 hover:bg-gray-50 rounded-lg font-medium",
|
|
@@ -14012,7 +13938,7 @@ function Header() {
|
|
|
14012
13938
|
link.href
|
|
14013
13939
|
)),
|
|
14014
13940
|
!isAuthenticated && /* @__PURE__ */ jsx(
|
|
14015
|
-
|
|
13941
|
+
Link7,
|
|
14016
13942
|
{
|
|
14017
13943
|
href: buildPath("/login"),
|
|
14018
13944
|
onClick: () => setIsMobileMenuOpen(false),
|
|
@@ -14080,7 +14006,7 @@ function Footer() {
|
|
|
14080
14006
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
14081
14007
|
/* @__PURE__ */ jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Shop" }),
|
|
14082
14008
|
/* @__PURE__ */ jsx("ul", { className: "space-y-2", children: footerLinks.shop.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
14083
|
-
|
|
14009
|
+
Link7,
|
|
14084
14010
|
{
|
|
14085
14011
|
href: link.href,
|
|
14086
14012
|
className: "hover:text-primary-500 transition-colors",
|
|
@@ -14091,7 +14017,7 @@ function Footer() {
|
|
|
14091
14017
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
14092
14018
|
/* @__PURE__ */ jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Account" }),
|
|
14093
14019
|
/* @__PURE__ */ jsx("ul", { className: "space-y-2", children: footerLinks.account.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
14094
|
-
|
|
14020
|
+
Link7,
|
|
14095
14021
|
{
|
|
14096
14022
|
href: link.href,
|
|
14097
14023
|
className: "hover:text-primary-500 transition-colors",
|
|
@@ -14102,7 +14028,7 @@ function Footer() {
|
|
|
14102
14028
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
14103
14029
|
/* @__PURE__ */ jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Support" }),
|
|
14104
14030
|
/* @__PURE__ */ jsx("ul", { className: "space-y-2", children: footerLinks.support.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
14105
|
-
|
|
14031
|
+
Link7,
|
|
14106
14032
|
{
|
|
14107
14033
|
href: link.href,
|
|
14108
14034
|
className: "hover:text-primary-500 transition-colors",
|