hey-pharmacist-ecommerce 1.1.3 → 1.1.4
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 +205 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -120
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Footer.tsx +17 -15
- package/src/components/Header.tsx +14 -12
- package/src/components/OrderCard.tsx +3 -1
- package/src/lib/api-adapter/config.ts +8 -5
- package/src/providers/AuthProvider.tsx +19 -5
- package/src/providers/FavoritesProvider.tsx +12 -2
- package/src/screens/CartScreen.tsx +5 -3
- package/src/screens/CategoriesScreen.tsx +4 -2
- package/src/screens/CheckoutScreen.tsx +6 -4
- package/src/screens/CurrentOrdersScreen.tsx +4 -2
- package/src/screens/HomeScreen.tsx +4 -4
- package/src/screens/LoginScreen.tsx +3 -1
- package/src/screens/OrdersScreen.tsx +3 -1
- package/src/screens/ProductDetailScreen.tsx +5 -3
- package/src/screens/ProfileScreen.tsx +10 -8
- package/src/screens/RegisterScreen.tsx +3 -1
- package/src/screens/ShopScreen.tsx +2 -2
- package/src/screens/WishlistScreen.tsx +4 -4
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,111 @@ import { useForm } from 'react-hook-form';
|
|
|
13
13
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
var __defProp = Object.defineProperty;
|
|
17
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
18
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
19
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
+
var __esm = (fn, res) => function __init() {
|
|
21
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
22
|
+
};
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
|
|
37
|
+
// src/lib/Apis/configuration.ts
|
|
38
|
+
var Configuration;
|
|
39
|
+
var init_configuration = __esm({
|
|
40
|
+
"src/lib/Apis/configuration.ts"() {
|
|
41
|
+
Configuration = class {
|
|
42
|
+
constructor(param = {}) {
|
|
43
|
+
this.apiKey = param.apiKey;
|
|
44
|
+
this.username = param.username;
|
|
45
|
+
this.password = param.password;
|
|
46
|
+
this.accessToken = param.accessToken;
|
|
47
|
+
this.basePath = param.basePath;
|
|
48
|
+
this.baseOptions = param.baseOptions;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// src/lib/api-adapter/config.ts
|
|
55
|
+
var config_exports = {};
|
|
56
|
+
__export(config_exports, {
|
|
57
|
+
clearAuthToken: () => clearAuthToken,
|
|
58
|
+
getApiConfiguration: () => getApiConfiguration,
|
|
59
|
+
getAuthToken: () => getAuthToken,
|
|
60
|
+
getCurrentConfig: () => getCurrentConfig,
|
|
61
|
+
initializeApiAdapter: () => initializeApiAdapter,
|
|
62
|
+
setAuthToken: () => setAuthToken
|
|
63
|
+
});
|
|
64
|
+
function initializeApiAdapter(config) {
|
|
65
|
+
currentConfig = config;
|
|
66
|
+
apiConfiguration = new Configuration({
|
|
67
|
+
basePath: config.apiBaseUrl,
|
|
68
|
+
apiKey: () => config.storeId,
|
|
69
|
+
// x-store-key header
|
|
70
|
+
accessToken: () => getAuthToken() || ""
|
|
71
|
+
// Bearer token
|
|
72
|
+
});
|
|
73
|
+
return apiConfiguration;
|
|
74
|
+
}
|
|
75
|
+
function getApiConfiguration() {
|
|
76
|
+
if (!apiConfiguration) {
|
|
77
|
+
throw new Error("API adapter not initialized. Call initializeApiAdapter first.");
|
|
78
|
+
}
|
|
79
|
+
return apiConfiguration;
|
|
80
|
+
}
|
|
81
|
+
function getCurrentConfig() {
|
|
82
|
+
if (!currentConfig) {
|
|
83
|
+
throw new Error("API adapter not initialized.");
|
|
84
|
+
}
|
|
85
|
+
return currentConfig;
|
|
86
|
+
}
|
|
87
|
+
function getTokenKey() {
|
|
88
|
+
const storeId = currentConfig?.storeId || "default";
|
|
89
|
+
return `ecommerce_access_token_${storeId}`;
|
|
90
|
+
}
|
|
91
|
+
function setAuthToken(token) {
|
|
92
|
+
if (typeof window !== "undefined") {
|
|
93
|
+
localStorage.setItem(getTokenKey(), token);
|
|
94
|
+
if (apiConfiguration) {
|
|
95
|
+
apiConfiguration.accessToken = () => token;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function getAuthToken() {
|
|
100
|
+
if (typeof window !== "undefined") {
|
|
101
|
+
return localStorage.getItem(getTokenKey());
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
function clearAuthToken() {
|
|
106
|
+
if (typeof window !== "undefined") {
|
|
107
|
+
localStorage.removeItem(getTokenKey());
|
|
108
|
+
if (apiConfiguration) {
|
|
109
|
+
apiConfiguration.accessToken = () => "";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
var apiConfiguration, currentConfig;
|
|
114
|
+
var init_config = __esm({
|
|
115
|
+
"src/lib/api-adapter/config.ts"() {
|
|
116
|
+
init_configuration();
|
|
117
|
+
apiConfiguration = null;
|
|
118
|
+
currentConfig = null;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
17
121
|
|
|
18
122
|
// src/lib/utils/colors.ts
|
|
19
123
|
function hexToRgb(hex) {
|
|
@@ -97,67 +201,8 @@ function ThemeProvider({ config, children }) {
|
|
|
97
201
|
return /* @__PURE__ */ React20.createElement(ThemeContext.Provider, { value: { config } }, children);
|
|
98
202
|
}
|
|
99
203
|
|
|
100
|
-
// src/
|
|
101
|
-
|
|
102
|
-
constructor(param = {}) {
|
|
103
|
-
this.apiKey = param.apiKey;
|
|
104
|
-
this.username = param.username;
|
|
105
|
-
this.password = param.password;
|
|
106
|
-
this.accessToken = param.accessToken;
|
|
107
|
-
this.basePath = param.basePath;
|
|
108
|
-
this.baseOptions = param.baseOptions;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
// src/lib/api-adapter/config.ts
|
|
113
|
-
var apiConfiguration = null;
|
|
114
|
-
var currentConfig = null;
|
|
115
|
-
function initializeApiAdapter(config) {
|
|
116
|
-
currentConfig = config;
|
|
117
|
-
apiConfiguration = new Configuration({
|
|
118
|
-
basePath: config.apiBaseUrl,
|
|
119
|
-
apiKey: () => config.storeId,
|
|
120
|
-
// x-store-key header
|
|
121
|
-
accessToken: () => getAuthToken() || ""
|
|
122
|
-
// Bearer token
|
|
123
|
-
});
|
|
124
|
-
return apiConfiguration;
|
|
125
|
-
}
|
|
126
|
-
function getApiConfiguration() {
|
|
127
|
-
if (!apiConfiguration) {
|
|
128
|
-
throw new Error("API adapter not initialized. Call initializeApiAdapter first.");
|
|
129
|
-
}
|
|
130
|
-
return apiConfiguration;
|
|
131
|
-
}
|
|
132
|
-
function getCurrentConfig() {
|
|
133
|
-
if (!currentConfig) {
|
|
134
|
-
throw new Error("API adapter not initialized.");
|
|
135
|
-
}
|
|
136
|
-
return currentConfig;
|
|
137
|
-
}
|
|
138
|
-
var TOKEN_KEY = "ecommerce_access_token";
|
|
139
|
-
function setAuthToken(token) {
|
|
140
|
-
if (typeof window !== "undefined") {
|
|
141
|
-
localStorage.setItem(TOKEN_KEY, token);
|
|
142
|
-
if (apiConfiguration) {
|
|
143
|
-
apiConfiguration.accessToken = () => token;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function getAuthToken() {
|
|
148
|
-
if (typeof window !== "undefined") {
|
|
149
|
-
return localStorage.getItem(TOKEN_KEY);
|
|
150
|
-
}
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
function clearAuthToken() {
|
|
154
|
-
if (typeof window !== "undefined") {
|
|
155
|
-
localStorage.removeItem(TOKEN_KEY);
|
|
156
|
-
if (apiConfiguration) {
|
|
157
|
-
apiConfiguration.accessToken = () => "";
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
204
|
+
// src/providers/AuthProvider.tsx
|
|
205
|
+
init_config();
|
|
161
206
|
var BASE_PATH = "/".replace(/\/+$/, "");
|
|
162
207
|
var BaseAPI = class {
|
|
163
208
|
constructor(configuration, basePath = BASE_PATH, axios = globalAxios4) {
|
|
@@ -1896,7 +1941,17 @@ function useAuth() {
|
|
|
1896
1941
|
function AuthProvider({ children }) {
|
|
1897
1942
|
const [user, setUser] = useState(null);
|
|
1898
1943
|
const [isLoading, setIsLoading] = useState(true);
|
|
1899
|
-
const
|
|
1944
|
+
const getUserKey = () => {
|
|
1945
|
+
if (typeof window === "undefined") return "ecommerce_user";
|
|
1946
|
+
const token = getAuthToken();
|
|
1947
|
+
if (!token) return "ecommerce_user";
|
|
1948
|
+
try {
|
|
1949
|
+
const config = (init_config(), __toCommonJS(config_exports)).getCurrentConfig();
|
|
1950
|
+
return `ecommerce_user_${config?.storeId || "default"}`;
|
|
1951
|
+
} catch {
|
|
1952
|
+
return "ecommerce_user";
|
|
1953
|
+
}
|
|
1954
|
+
};
|
|
1900
1955
|
const refreshUser = useCallback(async () => {
|
|
1901
1956
|
try {
|
|
1902
1957
|
const token = getAuthToken();
|
|
@@ -1914,7 +1969,8 @@ function AuthProvider({ children }) {
|
|
|
1914
1969
|
useEffect(() => {
|
|
1915
1970
|
if (typeof window !== "undefined") {
|
|
1916
1971
|
try {
|
|
1917
|
-
const
|
|
1972
|
+
const userKey = getUserKey();
|
|
1973
|
+
const cached = localStorage.getItem(userKey);
|
|
1918
1974
|
if (cached) {
|
|
1919
1975
|
const parsed = JSON.parse(cached);
|
|
1920
1976
|
setUser(parsed);
|
|
@@ -1934,7 +1990,7 @@ function AuthProvider({ children }) {
|
|
|
1934
1990
|
}
|
|
1935
1991
|
setUser(response.data.userData);
|
|
1936
1992
|
if (typeof window !== "undefined") {
|
|
1937
|
-
localStorage.setItem(
|
|
1993
|
+
localStorage.setItem(getUserKey(), JSON.stringify(response.data.userData));
|
|
1938
1994
|
}
|
|
1939
1995
|
return response.data;
|
|
1940
1996
|
} finally {
|
|
@@ -1950,7 +2006,7 @@ function AuthProvider({ children }) {
|
|
|
1950
2006
|
}
|
|
1951
2007
|
setUser(response.data.userData);
|
|
1952
2008
|
if (typeof window !== "undefined") {
|
|
1953
|
-
localStorage.setItem(
|
|
2009
|
+
localStorage.setItem(getUserKey(), JSON.stringify(response.data.userData));
|
|
1954
2010
|
}
|
|
1955
2011
|
return response.data;
|
|
1956
2012
|
} finally {
|
|
@@ -1963,7 +2019,7 @@ function AuthProvider({ children }) {
|
|
|
1963
2019
|
clearAuthToken();
|
|
1964
2020
|
setUser(null);
|
|
1965
2021
|
if (typeof window !== "undefined") {
|
|
1966
|
-
localStorage.removeItem(
|
|
2022
|
+
localStorage.removeItem(getUserKey());
|
|
1967
2023
|
}
|
|
1968
2024
|
} finally {
|
|
1969
2025
|
setIsLoading(false);
|
|
@@ -6660,6 +6716,9 @@ var WishlistApi = class extends BaseAPI {
|
|
|
6660
6716
|
}
|
|
6661
6717
|
};
|
|
6662
6718
|
|
|
6719
|
+
// src/lib/Apis/index.ts
|
|
6720
|
+
init_configuration();
|
|
6721
|
+
|
|
6663
6722
|
// src/lib/Apis/models/manual-order-dto.ts
|
|
6664
6723
|
var ManualOrderDTOOrderStatusEnum = /* @__PURE__ */ ((ManualOrderDTOOrderStatusEnum2) => {
|
|
6665
6724
|
ManualOrderDTOOrderStatusEnum2["Pending"] = "Pending";
|
|
@@ -6696,6 +6755,9 @@ var PaymentPaymentStatusEnum = /* @__PURE__ */ ((PaymentPaymentStatusEnum2) => {
|
|
|
6696
6755
|
return PaymentPaymentStatusEnum2;
|
|
6697
6756
|
})(PaymentPaymentStatusEnum || {});
|
|
6698
6757
|
|
|
6758
|
+
// src/lib/api-adapter/index.ts
|
|
6759
|
+
init_config();
|
|
6760
|
+
|
|
6699
6761
|
// src/providers/CartProvider.tsx
|
|
6700
6762
|
var CartContext = createContext(void 0);
|
|
6701
6763
|
function useCart() {
|
|
@@ -6784,6 +6846,11 @@ function CartProvider({ children }) {
|
|
|
6784
6846
|
};
|
|
6785
6847
|
return /* @__PURE__ */ React20.createElement(CartContext.Provider, { value }, children);
|
|
6786
6848
|
}
|
|
6849
|
+
|
|
6850
|
+
// src/lib/Apis/wrapper.ts
|
|
6851
|
+
init_configuration();
|
|
6852
|
+
init_config();
|
|
6853
|
+
init_config();
|
|
6787
6854
|
var BaseUrl = "https://api.heypharmacist.com";
|
|
6788
6855
|
globalAxios4.interceptors.request.use(async (config) => {
|
|
6789
6856
|
if (!config?.headers) {
|
|
@@ -7371,7 +7438,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
7371
7438
|
e.preventDefault();
|
|
7372
7439
|
if (searchQuery.trim()) {
|
|
7373
7440
|
setIsSearching(true);
|
|
7374
|
-
router.push(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
|
|
7441
|
+
router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
|
|
7375
7442
|
}
|
|
7376
7443
|
};
|
|
7377
7444
|
const handleInputChange = (e) => {
|
|
@@ -7381,7 +7448,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
7381
7448
|
if (e.key === "Enter" && searchQuery.trim()) {
|
|
7382
7449
|
e.preventDefault();
|
|
7383
7450
|
setIsSearching(true);
|
|
7384
|
-
router.push(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
|
|
7451
|
+
router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
|
|
7385
7452
|
}
|
|
7386
7453
|
};
|
|
7387
7454
|
const priceRanges = useMemo(
|
|
@@ -8183,6 +8250,7 @@ var safeFormatDate = (date, format = "long") => {
|
|
|
8183
8250
|
};
|
|
8184
8251
|
function ProductDetailScreen({ productId }) {
|
|
8185
8252
|
const router = useRouter();
|
|
8253
|
+
const { buildPath } = useBasePath();
|
|
8186
8254
|
const { product: productData, isLoading } = useProduct(productId);
|
|
8187
8255
|
const { addToCart } = useCart();
|
|
8188
8256
|
const [selectedVariant, setSelectedVariant] = useState(null);
|
|
@@ -8362,11 +8430,11 @@ function ProductDetailScreen({ productId }) {
|
|
|
8362
8430
|
{
|
|
8363
8431
|
variant: "ghost",
|
|
8364
8432
|
className: "text-white hover:bg-white/10",
|
|
8365
|
-
onClick: () => router.push("/shop")
|
|
8433
|
+
onClick: () => router.push(buildPath("/shop"))
|
|
8366
8434
|
},
|
|
8367
8435
|
/* @__PURE__ */ React20.createElement(ArrowLeft, { className: "h-5 w-5" }),
|
|
8368
8436
|
"Continue shopping"
|
|
8369
|
-
), /* @__PURE__ */ React20.createElement("div", { className: "hidden items-center gap-3 text-sm text-white/80 md:flex" }, /* @__PURE__ */ React20.createElement(Link8, { href: "/", className: "transition hover:text-white" }, "Home"), /* @__PURE__ */ React20.createElement(ChevronRight, { className: "h-4 w-4" }), /* @__PURE__ */ React20.createElement(Link8, { href: "/shop", className: "transition hover:text-white" }, "Shop"), /* @__PURE__ */ React20.createElement(ChevronRight, { className: "h-4 w-4" }), /* @__PURE__ */ React20.createElement("span", { className: "truncate font-medium text-white" }, product.name))), /* @__PURE__ */ React20.createElement(
|
|
8437
|
+
), /* @__PURE__ */ React20.createElement("div", { className: "hidden items-center gap-3 text-sm text-white/80 md:flex" }, /* @__PURE__ */ React20.createElement(Link8, { href: buildPath("/"), className: "transition hover:text-white" }, "Home"), /* @__PURE__ */ React20.createElement(ChevronRight, { className: "h-4 w-4" }), /* @__PURE__ */ React20.createElement(Link8, { href: buildPath("/shop"), className: "transition hover:text-white" }, "Shop"), /* @__PURE__ */ React20.createElement(ChevronRight, { className: "h-4 w-4" }), /* @__PURE__ */ React20.createElement("span", { className: "truncate font-medium text-white" }, product.name))), /* @__PURE__ */ React20.createElement(
|
|
8370
8438
|
motion.div,
|
|
8371
8439
|
{
|
|
8372
8440
|
initial: { opacity: 0, y: 24 },
|
|
@@ -8571,6 +8639,7 @@ function CartItem({ item }) {
|
|
|
8571
8639
|
function CartScreen() {
|
|
8572
8640
|
const router = useRouter();
|
|
8573
8641
|
const { cart, isLoading } = useCart();
|
|
8642
|
+
const { buildPath } = useBasePath();
|
|
8574
8643
|
if (!cart || cart.cartBody.items.length === 0) {
|
|
8575
8644
|
return /* @__PURE__ */ React20.createElement("div", { className: "min-h-screen bg-gradient-to-br from-primary-700 via-primary-600 to-secondary-600 flex items-center justify-center" }, /* @__PURE__ */ React20.createElement("div", { className: "mx-auto px-20 py-5 bg-white rounded-3xl" }, /* @__PURE__ */ React20.createElement(
|
|
8576
8645
|
EmptyState,
|
|
@@ -8579,7 +8648,7 @@ function CartScreen() {
|
|
|
8579
8648
|
title: "Your bag feels a little empty",
|
|
8580
8649
|
description: "Add pharmacy favorites to unlock quick shipping, curated bundles, and personalized recommendations.",
|
|
8581
8650
|
actionLabel: "Discover products",
|
|
8582
|
-
onAction: () => router.push("/shop")
|
|
8651
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
8583
8652
|
}
|
|
8584
8653
|
)));
|
|
8585
8654
|
}
|
|
@@ -8620,7 +8689,7 @@ function CartScreen() {
|
|
|
8620
8689
|
{
|
|
8621
8690
|
size: "lg",
|
|
8622
8691
|
className: "mt-6 w-full",
|
|
8623
|
-
onClick: () => router.push("/checkout")
|
|
8692
|
+
onClick: () => router.push(buildPath("/checkout"))
|
|
8624
8693
|
},
|
|
8625
8694
|
"Secure checkout",
|
|
8626
8695
|
/* @__PURE__ */ React20.createElement(ArrowRight, { className: "h-5 w-5" })
|
|
@@ -8628,7 +8697,7 @@ function CartScreen() {
|
|
|
8628
8697
|
"button",
|
|
8629
8698
|
{
|
|
8630
8699
|
type: "button",
|
|
8631
|
-
onClick: () => router.push("/shop"),
|
|
8700
|
+
onClick: () => router.push(buildPath("/shop")),
|
|
8632
8701
|
className: "mt-4 w-full text-sm font-semibold text-primary-600 transition hover:text-primary-700"
|
|
8633
8702
|
},
|
|
8634
8703
|
"Continue shopping"
|
|
@@ -8942,6 +9011,7 @@ function CheckoutScreen() {
|
|
|
8942
9011
|
const router = useRouter();
|
|
8943
9012
|
const { cart, clearCart } = useCart();
|
|
8944
9013
|
const { isAuthenticated, user } = useAuth();
|
|
9014
|
+
const { buildPath } = useBasePath();
|
|
8945
9015
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
8946
9016
|
const [isDelivery, setIsDelivery] = useState(true);
|
|
8947
9017
|
const [paymentMethod, setPaymentMethod] = useState("Card");
|
|
@@ -9084,7 +9154,7 @@ function CheckoutScreen() {
|
|
|
9084
9154
|
setError(null);
|
|
9085
9155
|
if (!isAuthenticated) {
|
|
9086
9156
|
toast.error("Please login to continue");
|
|
9087
|
-
setTimeout(() => router.push("/login?redirect=/checkout"), 50);
|
|
9157
|
+
setTimeout(() => router.push(buildPath("/login?redirect=/checkout")), 50);
|
|
9088
9158
|
return;
|
|
9089
9159
|
}
|
|
9090
9160
|
if (!cart || cart?.cartBody?.items?.length === 0 || !cart?.cartBody?.items) {
|
|
@@ -9179,11 +9249,11 @@ function CheckoutScreen() {
|
|
|
9179
9249
|
}
|
|
9180
9250
|
toast.success("Order placed successfully!");
|
|
9181
9251
|
await clearCart();
|
|
9182
|
-
router.push(`/orders/${response.data?.id}`);
|
|
9252
|
+
router.push(buildPath(`/orders/${response.data?.id}`));
|
|
9183
9253
|
} else {
|
|
9184
9254
|
toast.success("Order placed successfully!");
|
|
9185
9255
|
await clearCart();
|
|
9186
|
-
router.push(`/orders/${response.data?.id}`);
|
|
9256
|
+
router.push(buildPath(`/orders/${response.data?.id}`));
|
|
9187
9257
|
}
|
|
9188
9258
|
} catch (err) {
|
|
9189
9259
|
const msg = err?.message || err?.response?.data?.message || "Failed to place order";
|
|
@@ -9194,7 +9264,7 @@ function CheckoutScreen() {
|
|
|
9194
9264
|
}
|
|
9195
9265
|
};
|
|
9196
9266
|
if (!cart || cart?.cartBody?.items?.length === 0 || !cart?.cartBody?.items) {
|
|
9197
|
-
router.push("/cart");
|
|
9267
|
+
router.push(buildPath("/cart"));
|
|
9198
9268
|
return null;
|
|
9199
9269
|
}
|
|
9200
9270
|
const subtotal = cart.total;
|
|
@@ -9467,8 +9537,9 @@ var loginSchema = z.object({
|
|
|
9467
9537
|
});
|
|
9468
9538
|
function LoginScreen() {
|
|
9469
9539
|
const router = useRouter();
|
|
9540
|
+
const { buildPath } = useBasePath();
|
|
9470
9541
|
const searchParams = useSearchParams();
|
|
9471
|
-
const redirectUrl = searchParams?.get("redirect") || "/";
|
|
9542
|
+
const redirectUrl = searchParams?.get("redirect") || buildPath("/");
|
|
9472
9543
|
const { login } = useAuth();
|
|
9473
9544
|
const [showPassword, setShowPassword] = useState(false);
|
|
9474
9545
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
@@ -9588,6 +9659,7 @@ var BENEFITS = [
|
|
|
9588
9659
|
function RegisterScreen() {
|
|
9589
9660
|
const router = useRouter();
|
|
9590
9661
|
const { register: registerUser } = useAuth();
|
|
9662
|
+
const { buildPath } = useBasePath();
|
|
9591
9663
|
const [showPassword, setShowPassword] = useState(false);
|
|
9592
9664
|
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
|
|
9593
9665
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
@@ -9609,7 +9681,7 @@ function RegisterScreen() {
|
|
|
9609
9681
|
role: "User" /* User */
|
|
9610
9682
|
});
|
|
9611
9683
|
toast.success("Account created successfully!");
|
|
9612
|
-
router.push("/");
|
|
9684
|
+
router.push(buildPath("/"));
|
|
9613
9685
|
} catch (error) {
|
|
9614
9686
|
toast.error(error.response?.data?.message || "Failed to create account");
|
|
9615
9687
|
} finally {
|
|
@@ -9752,6 +9824,7 @@ var profileSchema = z.object({
|
|
|
9752
9824
|
function ProfileScreen() {
|
|
9753
9825
|
const router = useRouter();
|
|
9754
9826
|
const { user, updateUser, logout } = useAuth();
|
|
9827
|
+
const { buildPath } = useBasePath();
|
|
9755
9828
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
9756
9829
|
const {
|
|
9757
9830
|
register,
|
|
@@ -9780,10 +9853,10 @@ function ProfileScreen() {
|
|
|
9780
9853
|
const handleLogout = async () => {
|
|
9781
9854
|
await logout();
|
|
9782
9855
|
toast.success("Logged out successfully");
|
|
9783
|
-
router.push("/");
|
|
9856
|
+
router.push(buildPath("/"));
|
|
9784
9857
|
};
|
|
9785
9858
|
if (!user) {
|
|
9786
|
-
router.push("/login");
|
|
9859
|
+
router.push(buildPath("/login"));
|
|
9787
9860
|
return null;
|
|
9788
9861
|
}
|
|
9789
9862
|
const quickLinks = [
|
|
@@ -9791,19 +9864,19 @@ function ProfileScreen() {
|
|
|
9791
9864
|
icon: Package,
|
|
9792
9865
|
label: "Order history",
|
|
9793
9866
|
description: "Track shipments and download invoices",
|
|
9794
|
-
href: "/orders"
|
|
9867
|
+
href: buildPath("/orders")
|
|
9795
9868
|
},
|
|
9796
9869
|
{
|
|
9797
9870
|
icon: Heart,
|
|
9798
9871
|
label: "Wishlist",
|
|
9799
9872
|
description: "Curate go-to remedies and favorites",
|
|
9800
|
-
href: "/wishlist"
|
|
9873
|
+
href: buildPath("/wishlist")
|
|
9801
9874
|
},
|
|
9802
9875
|
{
|
|
9803
9876
|
icon: MapPin,
|
|
9804
9877
|
label: "Delivery addresses",
|
|
9805
9878
|
description: "Manage saved delivery locations",
|
|
9806
|
-
href: "/account/addresses"
|
|
9879
|
+
href: buildPath("/account/addresses")
|
|
9807
9880
|
}
|
|
9808
9881
|
];
|
|
9809
9882
|
return /* @__PURE__ */ React20.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React20.createElement("section", { className: "relative overflow-hidden bg-gradient-to-br from-[rgb(var(--header-from))] via-[rgb(var(--header-via))] to-[rgb(var(--header-to))] text-white mb-8" }, /* @__PURE__ */ React20.createElement("div", { className: "absolute inset-0 bg-[radial-gradient(circle_at_top_left,_rgba(255,255,255,0.35),_transparent_60%)]" }), /* @__PURE__ */ React20.createElement("div", { className: "relative container mx-auto px-4 py-16" }, /* @__PURE__ */ React20.createElement(
|
|
@@ -9819,7 +9892,7 @@ function ProfileScreen() {
|
|
|
9819
9892
|
{
|
|
9820
9893
|
variant: "ghost",
|
|
9821
9894
|
className: "text-white hover:bg-white/20",
|
|
9822
|
-
onClick: () => router.push("/account/change-password")
|
|
9895
|
+
onClick: () => router.push(buildPath("/account/change-password"))
|
|
9823
9896
|
},
|
|
9824
9897
|
"Change password"
|
|
9825
9898
|
))
|
|
@@ -9880,7 +9953,7 @@ function ProfileScreen() {
|
|
|
9880
9953
|
type: "button",
|
|
9881
9954
|
variant: "outline",
|
|
9882
9955
|
size: "lg",
|
|
9883
|
-
onClick: () => router.push("/orders")
|
|
9956
|
+
onClick: () => router.push(buildPath("/orders"))
|
|
9884
9957
|
},
|
|
9885
9958
|
"View recent orders"
|
|
9886
9959
|
)))),
|
|
@@ -9906,7 +9979,7 @@ function ProfileScreen() {
|
|
|
9906
9979
|
{
|
|
9907
9980
|
variant: "outline",
|
|
9908
9981
|
className: "mt-4 w-full",
|
|
9909
|
-
onClick: () => router.push("/account/preferences")
|
|
9982
|
+
onClick: () => router.push(buildPath("/account/preferences"))
|
|
9910
9983
|
},
|
|
9911
9984
|
"Manage preferences"
|
|
9912
9985
|
)),
|
|
@@ -9923,6 +9996,7 @@ function ProfileScreen() {
|
|
|
9923
9996
|
)))));
|
|
9924
9997
|
}
|
|
9925
9998
|
function OrderCard({ order }) {
|
|
9999
|
+
const { buildPath } = useBasePath();
|
|
9926
10000
|
const config = order.orderStatus;
|
|
9927
10001
|
return /* @__PURE__ */ React20.createElement(
|
|
9928
10002
|
motion.div,
|
|
@@ -10167,6 +10241,7 @@ var STATUS_FILTERS = ["All", ...Object.values(ManualOrderDTOOrderStatusEnum)];
|
|
|
10167
10241
|
var PAYMENT_FILTERS = ["All", ...Object.values(PaymentPaymentStatusEnum)];
|
|
10168
10242
|
function OrdersScreen() {
|
|
10169
10243
|
const router = useRouter();
|
|
10244
|
+
const { buildPath } = useBasePath();
|
|
10170
10245
|
const [page, setPage] = useState(1);
|
|
10171
10246
|
const [selectedFilter, setSelectedFilter] = useState("All");
|
|
10172
10247
|
const [selectedPaymentFilter, setSelectedPaymentFilter] = useState("All");
|
|
@@ -10258,7 +10333,7 @@ function OrdersScreen() {
|
|
|
10258
10333
|
title: "No orders found for these filters",
|
|
10259
10334
|
description: "Adjust the status or payment filters, or browse the shop for new essentials.",
|
|
10260
10335
|
actionLabel: "Shop products",
|
|
10261
|
-
onAction: () => router.push("/shop")
|
|
10336
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
10262
10337
|
}
|
|
10263
10338
|
)),
|
|
10264
10339
|
!isLoading && pagination.totalPages > 1 && hasOrders && /* @__PURE__ */ React20.createElement("div", { className: "mt-10 flex flex-wrap items-center justify-center gap-4" }, /* @__PURE__ */ React20.createElement(
|
|
@@ -10285,6 +10360,7 @@ function OrdersScreen() {
|
|
|
10285
10360
|
function CurrentOrdersScreen() {
|
|
10286
10361
|
const router = useRouter();
|
|
10287
10362
|
const { orders, isLoading } = useCurrentOrders();
|
|
10363
|
+
const { buildPath } = useBasePath();
|
|
10288
10364
|
const hasOrders = orders.length > 0;
|
|
10289
10365
|
return /* @__PURE__ */ React20.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React20.createElement("section", { className: "relative overflow-hidden bg-gradient-to-br from-[rgb(var(--header-from))] via-[rgb(var(--header-via))] to-[rgb(var(--header-to))] text-white" }, /* @__PURE__ */ React20.createElement("div", { className: "absolute inset-0 bg-[radial-gradient(circle_at_top_left,_rgba(255,255,255,0.35),_transparent_60%)]" }), /* @__PURE__ */ React20.createElement("div", { className: "relative container mx-auto px-4 py-16" }, /* @__PURE__ */ React20.createElement("div", { className: "flex flex-col gap-6 md:flex-row md:items-center md:justify-between" }, /* @__PURE__ */ React20.createElement(
|
|
10290
10366
|
motion.div,
|
|
@@ -10308,7 +10384,7 @@ function CurrentOrdersScreen() {
|
|
|
10308
10384
|
/* @__PURE__ */ React20.createElement("div", { className: "mt-4 space-y-3 text-sm text-white/80" }, /* @__PURE__ */ React20.createElement(
|
|
10309
10385
|
Link8,
|
|
10310
10386
|
{
|
|
10311
|
-
href: "/orders",
|
|
10387
|
+
href: buildPath("/orders"),
|
|
10312
10388
|
className: "flex items-center justify-between rounded-2xl bg-white/10 px-4 py-3 transition hover:bg-white/20"
|
|
10313
10389
|
},
|
|
10314
10390
|
/* @__PURE__ */ React20.createElement("span", { className: "font-semibold text-white" }, "View order history"),
|
|
@@ -10328,7 +10404,7 @@ function CurrentOrdersScreen() {
|
|
|
10328
10404
|
title: "No active orders",
|
|
10329
10405
|
description: "Start a new order to see live preparation, packing, and delivery updates here.",
|
|
10330
10406
|
actionLabel: "Shop wellness essentials",
|
|
10331
|
-
onAction: () => router.push("/shop")
|
|
10407
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
10332
10408
|
}
|
|
10333
10409
|
))),
|
|
10334
10410
|
/* @__PURE__ */ React20.createElement("aside", { className: "space-y-6" }, /* @__PURE__ */ React20.createElement("div", { className: "rounded-3xl border border-slate-100 bg-white p-6 shadow-lg shadow-primary-50" }, /* @__PURE__ */ React20.createElement("h2", { className: "text-lg font-semibold text-slate-900" }, "Real-time milestones"), /* @__PURE__ */ React20.createElement("div", { className: "mt-4 space-y-4 text-sm text-slate-600" }, /* @__PURE__ */ React20.createElement("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4" }, /* @__PURE__ */ React20.createElement(Warehouse, { className: "h-5 w-5 text-primary-500" }), /* @__PURE__ */ React20.createElement("div", null, /* @__PURE__ */ React20.createElement("p", { className: "font-semibold text-slate-800" }, "Preparation"), /* @__PURE__ */ React20.createElement("p", null, "Our pharmacists verify ingredients and pack thermo-sensitive items."))), /* @__PURE__ */ React20.createElement("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4" }, /* @__PURE__ */ React20.createElement(Truck, { className: "h-5 w-5 text-primary-500" }), /* @__PURE__ */ React20.createElement("div", null, /* @__PURE__ */ React20.createElement("p", { className: "font-semibold text-slate-800" }, "In transit"), /* @__PURE__ */ React20.createElement("p", null, "Track live courier location with ETA updates tailored to your delivery window."))), /* @__PURE__ */ React20.createElement("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4" }, /* @__PURE__ */ React20.createElement(BellRing, { className: "h-5 w-5 text-primary-500" }), /* @__PURE__ */ React20.createElement("div", null, /* @__PURE__ */ React20.createElement("p", { className: "font-semibold text-slate-800" }, "Arrival alerts"), /* @__PURE__ */ React20.createElement("p", null, "Receive SMS and email notifications when parcels are out for delivery."))))), /* @__PURE__ */ React20.createElement("div", { className: "rounded-3xl border border-primary-100 bg-primary-50/70 p-6 text-sm text-primary-700 shadow-sm" }, /* @__PURE__ */ React20.createElement("p", { className: "font-semibold uppercase tracking-[0.3em]" }, "Need support?"), /* @__PURE__ */ React20.createElement("p", { className: "mt-3 leading-relaxed" }, "Our fulfillment team is online 7 days a week. Message us if you need to adjust delivery instructions or review dosage guidance.")))
|
|
@@ -10825,7 +10901,7 @@ function WishlistScreen() {
|
|
|
10825
10901
|
animate: { opacity: 1, y: 0 },
|
|
10826
10902
|
className: "rounded-3xl border border-slate-100 bg-white p-6 shadow-xl shadow-primary-50"
|
|
10827
10903
|
},
|
|
10828
|
-
/* @__PURE__ */ React20.createElement("div", { className: "flex flex-col gap-6" }, !isAuthenticated && /* @__PURE__ */ React20.createElement("div", { className: "flex min-h-[40vh] items-center justify-center" }, /* @__PURE__ */ React20.createElement("div", { className: "max-w-lg rounded-3xl border border-slate-100 bg-white p-10 text-center shadow-lg shadow-primary-50" }, /* @__PURE__ */ React20.createElement("div", { className: "mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-primary-50 text-primary-600" }, /* @__PURE__ */ React20.createElement(Heart, { className: "h-8 w-8" })), /* @__PURE__ */ React20.createElement("h2", { className: "mt-6 text-3xl font-bold text-slate-900" }, "Sign in to see your favourites"), /* @__PURE__ */ React20.createElement("p", { className: "mt-3 text-slate-500" }, "Create your curated shelf of products and we'll keep them ready whenever you return."), /* @__PURE__ */ React20.createElement(Button, { className: "mt-6", onClick: () => router.push("/login") }, "Sign In"))), isAuthenticated && /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement("div", { className: "flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between" }, /* @__PURE__ */ React20.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ React20.createElement("h2", { className: "text-2xl font-semibold text-slate-900" }, "Your saved collection"), /* @__PURE__ */ React20.createElement("p", { className: "text-sm text-slate-500" }, "Total value: ", /* @__PURE__ */ React20.createElement("span", { className: "font-semibold text-primary-600" }, formatPrice(totalValue)), onlyInStock && " \u2022 Showing items ready to ship")), /* @__PURE__ */ React20.createElement("div", { className: "flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React20.createElement("label", { className: "inline-flex cursor-pointer items-center gap-2 rounded-full border border-slate-200 bg-slate-50 px-3 py-1.5 text-sm font-medium text-slate-600 transition hover:border-primary-200 hover:text-primary-600" }, /* @__PURE__ */ React20.createElement(
|
|
10904
|
+
/* @__PURE__ */ React20.createElement("div", { className: "flex flex-col gap-6" }, !isAuthenticated && /* @__PURE__ */ React20.createElement("div", { className: "flex min-h-[40vh] items-center justify-center" }, /* @__PURE__ */ React20.createElement("div", { className: "max-w-lg rounded-3xl border border-slate-100 bg-white p-10 text-center shadow-lg shadow-primary-50" }, /* @__PURE__ */ React20.createElement("div", { className: "mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-primary-50 text-primary-600" }, /* @__PURE__ */ React20.createElement(Heart, { className: "h-8 w-8" })), /* @__PURE__ */ React20.createElement("h2", { className: "mt-6 text-3xl font-bold text-slate-900" }, "Sign in to see your favourites"), /* @__PURE__ */ React20.createElement("p", { className: "mt-3 text-slate-500" }, "Create your curated shelf of products and we'll keep them ready whenever you return."), /* @__PURE__ */ React20.createElement(Button, { className: "mt-6", onClick: () => router.push(buildPath("/login")) }, "Sign In"))), isAuthenticated && /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement("div", { className: "flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between" }, /* @__PURE__ */ React20.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ React20.createElement("h2", { className: "text-2xl font-semibold text-slate-900" }, "Your saved collection"), /* @__PURE__ */ React20.createElement("p", { className: "text-sm text-slate-500" }, "Total value: ", /* @__PURE__ */ React20.createElement("span", { className: "font-semibold text-primary-600" }, formatPrice(totalValue)), onlyInStock && " \u2022 Showing items ready to ship")), /* @__PURE__ */ React20.createElement("div", { className: "flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React20.createElement("label", { className: "inline-flex cursor-pointer items-center gap-2 rounded-full border border-slate-200 bg-slate-50 px-3 py-1.5 text-sm font-medium text-slate-600 transition hover:border-primary-200 hover:text-primary-600" }, /* @__PURE__ */ React20.createElement(
|
|
10829
10905
|
"input",
|
|
10830
10906
|
{
|
|
10831
10907
|
type: "checkbox",
|
|
@@ -10874,7 +10950,7 @@ function WishlistScreen() {
|
|
|
10874
10950
|
key: index,
|
|
10875
10951
|
className: "h-72 animate-pulse rounded-2xl border border-slate-200 bg-slate-100"
|
|
10876
10952
|
}
|
|
10877
|
-
))), !isLoading && wishlistCount === 0 && /* @__PURE__ */ React20.createElement("div", { className: "flex min-h-[30vh] items-center justify-center" }, /* @__PURE__ */ React20.createElement("div", { className: "max-w-2xl rounded-3xl border border-slate-100 bg-white p-12 text-center shadow-xl shadow-primary-50" }, /* @__PURE__ */ React20.createElement("div", { className: "mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-primary-100 text-primary-600" }, /* @__PURE__ */ React20.createElement(Sparkles, { className: "h-10 w-10" })), /* @__PURE__ */ React20.createElement("h2", { className: "mt-6 text-4xl font-bold text-slate-900" }, "Start your wellness wishlist"), /* @__PURE__ */ React20.createElement("p", { className: "mt-4 text-lg text-slate-500" }, "Bookmark pharmacy essentials, supplements, or skincare picks and we'll keep them safe until you're ready to checkout."), /* @__PURE__ */ React20.createElement("div", { className: "mt-8 flex flex-wrap justify-center gap-3" }, /* @__PURE__ */ React20.createElement(Button, { onClick: () => router.push("/shop") }, "Discover products"), /* @__PURE__ */ React20.createElement(Button, { variant: "outline", onClick: () => router.push("/categories") }, "Browse categories")))), !isLoading && processedProducts.length > 0 && /* @__PURE__ */ React20.createElement(React20.Fragment, null, viewMode === "grid" ? /* @__PURE__ */ React20.createElement(
|
|
10953
|
+
))), !isLoading && wishlistCount === 0 && /* @__PURE__ */ React20.createElement("div", { className: "flex min-h-[30vh] items-center justify-center" }, /* @__PURE__ */ React20.createElement("div", { className: "max-w-2xl rounded-3xl border border-slate-100 bg-white p-12 text-center shadow-xl shadow-primary-50" }, /* @__PURE__ */ React20.createElement("div", { className: "mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-primary-100 text-primary-600" }, /* @__PURE__ */ React20.createElement(Sparkles, { className: "h-10 w-10" })), /* @__PURE__ */ React20.createElement("h2", { className: "mt-6 text-4xl font-bold text-slate-900" }, "Start your wellness wishlist"), /* @__PURE__ */ React20.createElement("p", { className: "mt-4 text-lg text-slate-500" }, "Bookmark pharmacy essentials, supplements, or skincare picks and we'll keep them safe until you're ready to checkout."), /* @__PURE__ */ React20.createElement("div", { className: "mt-8 flex flex-wrap justify-center gap-3" }, /* @__PURE__ */ React20.createElement(Button, { onClick: () => router.push(buildPath("/shop")) }, "Discover products"), /* @__PURE__ */ React20.createElement(Button, { variant: "outline", onClick: () => router.push(buildPath("/categories")) }, "Browse categories")))), !isLoading && processedProducts.length > 0 && /* @__PURE__ */ React20.createElement(React20.Fragment, null, viewMode === "grid" ? /* @__PURE__ */ React20.createElement(
|
|
10878
10954
|
motion.div,
|
|
10879
10955
|
{
|
|
10880
10956
|
layout: true,
|
|
@@ -10924,7 +11000,7 @@ function WishlistScreen() {
|
|
|
10924
11000
|
Button,
|
|
10925
11001
|
{
|
|
10926
11002
|
size: "sm",
|
|
10927
|
-
onClick: () => router.push(`/products/${product.id}`)
|
|
11003
|
+
onClick: () => router.push(buildPath(`/products/${product.id}`))
|
|
10928
11004
|
},
|
|
10929
11005
|
"View details"
|
|
10930
11006
|
), /* @__PURE__ */ React20.createElement(
|
|
@@ -11050,6 +11126,7 @@ function SearchPage() {
|
|
|
11050
11126
|
function CategoriesScreen() {
|
|
11051
11127
|
const { categories, isLoading } = useCategories();
|
|
11052
11128
|
const router = useRouter();
|
|
11129
|
+
const { buildPath } = useBasePath();
|
|
11053
11130
|
return /* @__PURE__ */ React20.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React20.createElement("section", { className: "relative overflow-hidden bg-gradient-to-br from-[rgb(var(--header-from))] via-[rgb(var(--header-via))] to-[rgb(var(--header-to))] text-white mb-8" }, /* @__PURE__ */ React20.createElement("div", { className: "absolute inset-0 bg-[radial-gradient(circle_at_top_left,_rgba(255,255,255,0.35),_transparent_60%)]" }), /* @__PURE__ */ React20.createElement("div", { className: "relative container mx-auto px-4 py-16" }, /* @__PURE__ */ React20.createElement(
|
|
11054
11131
|
motion.div,
|
|
11055
11132
|
{
|
|
@@ -11071,7 +11148,7 @@ function CategoriesScreen() {
|
|
|
11071
11148
|
Link8,
|
|
11072
11149
|
{
|
|
11073
11150
|
key: category.id,
|
|
11074
|
-
href: `/shop?category=${category.name}
|
|
11151
|
+
href: buildPath(`/shop?category=${category.name}`),
|
|
11075
11152
|
className: "group block overflow-hidden rounded-xl border border-gray-100 bg-white p-4 text-center transition hover:shadow-lg hover:border-primary-500"
|
|
11076
11153
|
},
|
|
11077
11154
|
/* @__PURE__ */ React20.createElement("div", { className: "relative aspect-square w-full overflow-hidden rounded-lg bg-gray-50 mb-3" }, category.image ? /* @__PURE__ */ React20.createElement(
|
|
@@ -11093,7 +11170,7 @@ function CategoriesScreen() {
|
|
|
11093
11170
|
description: "There are currently no product categories available.",
|
|
11094
11171
|
icon: Package,
|
|
11095
11172
|
actionLabel: "Shop products",
|
|
11096
|
-
onAction: () => router.push("/shop")
|
|
11173
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
11097
11174
|
}
|
|
11098
11175
|
)
|
|
11099
11176
|
))));
|
|
@@ -11245,14 +11322,15 @@ function Header() {
|
|
|
11245
11322
|
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
|
11246
11323
|
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
|
11247
11324
|
const [searchQuery, setSearchQuery] = useState("");
|
|
11325
|
+
const { buildPath } = useBasePath();
|
|
11248
11326
|
const navLinks = [
|
|
11249
|
-
{ href: "/shop", label: "Shop" },
|
|
11250
|
-
{ href: "/categories", label: "Categories" },
|
|
11251
|
-
{ href: "/orders", label: "Orders" },
|
|
11252
|
-
{ href: "/about", label: "About" },
|
|
11253
|
-
{ href: "/contact", label: "Contact" }
|
|
11327
|
+
{ href: buildPath("/shop"), label: "Shop" },
|
|
11328
|
+
{ href: buildPath("/categories"), label: "Categories" },
|
|
11329
|
+
{ href: buildPath("/orders"), label: "Orders" },
|
|
11330
|
+
{ href: buildPath("/about"), label: "About" },
|
|
11331
|
+
{ href: buildPath("/contact"), label: "Contact" }
|
|
11254
11332
|
];
|
|
11255
|
-
return /* @__PURE__ */ React20.createElement("header", { className: "sticky top-0 z-40 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-sm" }, /* @__PURE__ */ React20.createElement("div", { className: "container mx-auto px-4" }, /* @__PURE__ */ React20.createElement("div", { className: "flex items-center justify-between h-20" }, /* @__PURE__ */ React20.createElement(Link8, { href: "/", className: "flex items-center gap-3" }, /* @__PURE__ */ React20.createElement("div", { className: "relative w-12 h-12" }, /* @__PURE__ */ React20.createElement(
|
|
11333
|
+
return /* @__PURE__ */ React20.createElement("header", { className: "sticky top-0 z-40 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-sm" }, /* @__PURE__ */ React20.createElement("div", { className: "container mx-auto px-4" }, /* @__PURE__ */ React20.createElement("div", { className: "flex items-center justify-between h-20" }, /* @__PURE__ */ React20.createElement(Link8, { href: buildPath("/"), className: "flex items-center gap-3" }, /* @__PURE__ */ React20.createElement("div", { className: "relative w-12 h-12" }, /* @__PURE__ */ React20.createElement(
|
|
11256
11334
|
Image3,
|
|
11257
11335
|
{
|
|
11258
11336
|
src: config.logo,
|
|
@@ -11293,7 +11371,7 @@ function Header() {
|
|
|
11293
11371
|
onChange: (e) => setSearchQuery(e.target.value),
|
|
11294
11372
|
onKeyDown: (e) => {
|
|
11295
11373
|
if (e.key === "Enter" && searchQuery.trim()) {
|
|
11296
|
-
window.location.href = `/search?q=${encodeURIComponent(searchQuery.trim())}
|
|
11374
|
+
window.location.href = buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
|
|
11297
11375
|
}
|
|
11298
11376
|
},
|
|
11299
11377
|
placeholder: "Search products...",
|
|
@@ -11308,17 +11386,17 @@ function Header() {
|
|
|
11308
11386
|
},
|
|
11309
11387
|
/* @__PURE__ */ React20.createElement(X, { className: "w-4 h-4" })
|
|
11310
11388
|
))
|
|
11311
|
-
))), /* @__PURE__ */ React20.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React20.createElement(Link8, { href: "/wishlist", className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors" }, /* @__PURE__ */ React20.createElement(Heart, { className: "w-6 h-6" }), wishlistCount > 0 && /* @__PURE__ */ React20.createElement("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" }, wishlistCount)), /* @__PURE__ */ React20.createElement(Link8, { href: "/cart", className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors" }, /* @__PURE__ */ React20.createElement(ShoppingCart, { className: "w-6 h-6" }), cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ React20.createElement("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" }, cart.cartBody?.items?.length) : null), isAuthenticated ? /* @__PURE__ */ React20.createElement(
|
|
11389
|
+
))), /* @__PURE__ */ React20.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React20.createElement(Link8, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors" }, /* @__PURE__ */ React20.createElement(Heart, { className: "w-6 h-6" }), wishlistCount > 0 && /* @__PURE__ */ React20.createElement("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" }, wishlistCount)), /* @__PURE__ */ React20.createElement(Link8, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors" }, /* @__PURE__ */ React20.createElement(ShoppingCart, { className: "w-6 h-6" }), cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ React20.createElement("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" }, cart.cartBody?.items?.length) : null), isAuthenticated ? /* @__PURE__ */ React20.createElement(
|
|
11312
11390
|
Link8,
|
|
11313
11391
|
{
|
|
11314
|
-
href: "/account",
|
|
11392
|
+
href: buildPath("/account"),
|
|
11315
11393
|
className: "p-2 hover:bg-gray-100 rounded-lg transition-colors"
|
|
11316
11394
|
},
|
|
11317
11395
|
/* @__PURE__ */ React20.createElement(User, { className: "w-6 h-6 text-gray-700" })
|
|
11318
11396
|
) : /* @__PURE__ */ React20.createElement(
|
|
11319
11397
|
Link8,
|
|
11320
11398
|
{
|
|
11321
|
-
href: "/login",
|
|
11399
|
+
href: buildPath("/login"),
|
|
11322
11400
|
className: "hidden sm:block px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium"
|
|
11323
11401
|
},
|
|
11324
11402
|
"Sign In"
|
|
@@ -11349,7 +11427,7 @@ function Header() {
|
|
|
11349
11427
|
)), !isAuthenticated && /* @__PURE__ */ React20.createElement(
|
|
11350
11428
|
Link8,
|
|
11351
11429
|
{
|
|
11352
|
-
href: "/login",
|
|
11430
|
+
href: buildPath("/login"),
|
|
11353
11431
|
onClick: () => setIsMobileMenuOpen(false),
|
|
11354
11432
|
className: "px-4 py-3 text-primary-600 hover:bg-gray-50 rounded-lg font-medium"
|
|
11355
11433
|
},
|
|
@@ -11359,25 +11437,32 @@ function Header() {
|
|
|
11359
11437
|
}
|
|
11360
11438
|
function Footer() {
|
|
11361
11439
|
const { config } = useTheme();
|
|
11440
|
+
const { buildPath } = useBasePath();
|
|
11362
11441
|
const footerLinks = {
|
|
11363
11442
|
shop: [
|
|
11364
|
-
{ label: "All Products", href: "/shop" },
|
|
11365
|
-
{ label: "Categories", href: "/categories" },
|
|
11366
|
-
{ label: "Featured", href: "/featured" },
|
|
11367
|
-
{ label: "New Arrivals", href: "/new" }
|
|
11443
|
+
{ label: "All Products", href: buildPath("/shop") },
|
|
11444
|
+
{ label: "Categories", href: buildPath("/categories") },
|
|
11445
|
+
{ label: "Featured", href: buildPath("/featured") },
|
|
11446
|
+
{ label: "New Arrivals", href: buildPath("/new") }
|
|
11368
11447
|
],
|
|
11369
11448
|
account: [
|
|
11370
|
-
{ label: "My Account", href: "/account" },
|
|
11371
|
-
{ label: "Orders", href: "/orders" },
|
|
11372
|
-
{ label: "Wishlist", href: "/wishlist" },
|
|
11373
|
-
{ label: "Cart", href: "/cart" }
|
|
11449
|
+
{ label: "My Account", href: buildPath("/account") },
|
|
11450
|
+
{ label: "Orders", href: buildPath("/orders") },
|
|
11451
|
+
{ label: "Wishlist", href: buildPath("/wishlist") },
|
|
11452
|
+
{ label: "Cart", href: buildPath("/cart") }
|
|
11374
11453
|
],
|
|
11375
11454
|
support: [
|
|
11376
|
-
{ label: "Contact Us", href: "/contact" },
|
|
11377
|
-
{ label: "FAQs", href: "/faqs" },
|
|
11378
|
-
{ label: "Shipping Info", href: "/shipping" },
|
|
11379
|
-
{ label: "Returns", href: "/returns" }
|
|
11380
|
-
]
|
|
11455
|
+
{ label: "Contact Us", href: buildPath("/contact") },
|
|
11456
|
+
{ label: "FAQs", href: buildPath("/faqs") },
|
|
11457
|
+
{ label: "Shipping Info", href: buildPath("/shipping") },
|
|
11458
|
+
{ label: "Returns", href: buildPath("/returns") }
|
|
11459
|
+
],
|
|
11460
|
+
legal: [
|
|
11461
|
+
{ label: "Privacy Policy", href: buildPath("/privacy") },
|
|
11462
|
+
{ label: "Terms of Service", href: buildPath("/terms") },
|
|
11463
|
+
{ label: "Cookie Policy", href: buildPath("/cookies") }
|
|
11464
|
+
]
|
|
11465
|
+
};
|
|
11381
11466
|
return /* @__PURE__ */ React20.createElement("footer", { className: "bg-gray-900 text-gray-300" }, /* @__PURE__ */ React20.createElement("div", { className: "container mx-auto px-4 py-16" }, /* @__PURE__ */ React20.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-12" }, /* @__PURE__ */ React20.createElement("div", { className: "lg:col-span-2" }, /* @__PURE__ */ React20.createElement("h3", { className: "text-2xl font-bold text-white mb-4" }, config.storeName), /* @__PURE__ */ React20.createElement("p", { className: "text-gray-400 mb-6 max-w-md" }, "Your trusted online store for quality products. We deliver excellence with every order."), /* @__PURE__ */ React20.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React20.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React20.createElement(Mail, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React20.createElement("span", null, "support@", config.storeName.toLowerCase().replace(/\s+/g, ""), ".com")), /* @__PURE__ */ React20.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React20.createElement(Phone, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React20.createElement("span", null, "+1 (555) 123-4567")), /* @__PURE__ */ React20.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React20.createElement(MapPin, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React20.createElement("span", null, "123 Store Street, City, Country")))), /* @__PURE__ */ React20.createElement("div", null, /* @__PURE__ */ React20.createElement("h4", { className: "text-lg font-semibold text-white mb-4" }, "Shop"), /* @__PURE__ */ React20.createElement("ul", { className: "space-y-2" }, footerLinks.shop.map((link) => /* @__PURE__ */ React20.createElement("li", { key: link.href }, /* @__PURE__ */ React20.createElement(
|
|
11382
11467
|
Link8,
|
|
11383
11468
|
{
|