hey-pharmacist-ecommerce 1.1.3 → 1.1.5
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 +206 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -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/components/ui/Modal.tsx +2 -0
- 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.js
CHANGED
|
@@ -23,7 +23,111 @@ var Image3__default = /*#__PURE__*/_interopDefault(Image3);
|
|
|
23
23
|
var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
|
|
24
24
|
var Link8__default = /*#__PURE__*/_interopDefault(Link8);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
var __defProp = Object.defineProperty;
|
|
27
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
28
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
29
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
30
|
+
var __esm = (fn, res) => function __init() {
|
|
31
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
32
|
+
};
|
|
33
|
+
var __export = (target, all) => {
|
|
34
|
+
for (var name in all)
|
|
35
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
36
|
+
};
|
|
37
|
+
var __copyProps = (to, from, except, desc) => {
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (let key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
41
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
42
|
+
}
|
|
43
|
+
return to;
|
|
44
|
+
};
|
|
45
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
+
|
|
47
|
+
// src/lib/Apis/configuration.ts
|
|
48
|
+
var Configuration;
|
|
49
|
+
var init_configuration = __esm({
|
|
50
|
+
"src/lib/Apis/configuration.ts"() {
|
|
51
|
+
Configuration = class {
|
|
52
|
+
constructor(param = {}) {
|
|
53
|
+
this.apiKey = param.apiKey;
|
|
54
|
+
this.username = param.username;
|
|
55
|
+
this.password = param.password;
|
|
56
|
+
this.accessToken = param.accessToken;
|
|
57
|
+
this.basePath = param.basePath;
|
|
58
|
+
this.baseOptions = param.baseOptions;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// src/lib/api-adapter/config.ts
|
|
65
|
+
var config_exports = {};
|
|
66
|
+
__export(config_exports, {
|
|
67
|
+
clearAuthToken: () => clearAuthToken,
|
|
68
|
+
getApiConfiguration: () => getApiConfiguration,
|
|
69
|
+
getAuthToken: () => getAuthToken,
|
|
70
|
+
getCurrentConfig: () => getCurrentConfig,
|
|
71
|
+
initializeApiAdapter: () => initializeApiAdapter,
|
|
72
|
+
setAuthToken: () => setAuthToken
|
|
73
|
+
});
|
|
74
|
+
function initializeApiAdapter(config) {
|
|
75
|
+
currentConfig = config;
|
|
76
|
+
apiConfiguration = new Configuration({
|
|
77
|
+
basePath: config.apiBaseUrl,
|
|
78
|
+
apiKey: () => config.storeId,
|
|
79
|
+
// x-store-key header
|
|
80
|
+
accessToken: () => getAuthToken() || ""
|
|
81
|
+
// Bearer token
|
|
82
|
+
});
|
|
83
|
+
return apiConfiguration;
|
|
84
|
+
}
|
|
85
|
+
function getApiConfiguration() {
|
|
86
|
+
if (!apiConfiguration) {
|
|
87
|
+
throw new Error("API adapter not initialized. Call initializeApiAdapter first.");
|
|
88
|
+
}
|
|
89
|
+
return apiConfiguration;
|
|
90
|
+
}
|
|
91
|
+
function getCurrentConfig() {
|
|
92
|
+
if (!currentConfig) {
|
|
93
|
+
throw new Error("API adapter not initialized.");
|
|
94
|
+
}
|
|
95
|
+
return currentConfig;
|
|
96
|
+
}
|
|
97
|
+
function getTokenKey() {
|
|
98
|
+
const storeId = currentConfig?.storeId || "default";
|
|
99
|
+
return `ecommerce_access_token_${storeId}`;
|
|
100
|
+
}
|
|
101
|
+
function setAuthToken(token) {
|
|
102
|
+
if (typeof window !== "undefined") {
|
|
103
|
+
localStorage.setItem(getTokenKey(), token);
|
|
104
|
+
if (apiConfiguration) {
|
|
105
|
+
apiConfiguration.accessToken = () => token;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function getAuthToken() {
|
|
110
|
+
if (typeof window !== "undefined") {
|
|
111
|
+
return localStorage.getItem(getTokenKey());
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
function clearAuthToken() {
|
|
116
|
+
if (typeof window !== "undefined") {
|
|
117
|
+
localStorage.removeItem(getTokenKey());
|
|
118
|
+
if (apiConfiguration) {
|
|
119
|
+
apiConfiguration.accessToken = () => "";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
var apiConfiguration, currentConfig;
|
|
124
|
+
var init_config = __esm({
|
|
125
|
+
"src/lib/api-adapter/config.ts"() {
|
|
126
|
+
init_configuration();
|
|
127
|
+
apiConfiguration = null;
|
|
128
|
+
currentConfig = null;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
27
131
|
|
|
28
132
|
// src/lib/utils/colors.ts
|
|
29
133
|
function hexToRgb(hex) {
|
|
@@ -107,67 +211,8 @@ function ThemeProvider({ config, children }) {
|
|
|
107
211
|
return /* @__PURE__ */ React20__default.default.createElement(ThemeContext.Provider, { value: { config } }, children);
|
|
108
212
|
}
|
|
109
213
|
|
|
110
|
-
// src/
|
|
111
|
-
|
|
112
|
-
constructor(param = {}) {
|
|
113
|
-
this.apiKey = param.apiKey;
|
|
114
|
-
this.username = param.username;
|
|
115
|
-
this.password = param.password;
|
|
116
|
-
this.accessToken = param.accessToken;
|
|
117
|
-
this.basePath = param.basePath;
|
|
118
|
-
this.baseOptions = param.baseOptions;
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// src/lib/api-adapter/config.ts
|
|
123
|
-
var apiConfiguration = null;
|
|
124
|
-
var currentConfig = null;
|
|
125
|
-
function initializeApiAdapter(config) {
|
|
126
|
-
currentConfig = config;
|
|
127
|
-
apiConfiguration = new Configuration({
|
|
128
|
-
basePath: config.apiBaseUrl,
|
|
129
|
-
apiKey: () => config.storeId,
|
|
130
|
-
// x-store-key header
|
|
131
|
-
accessToken: () => getAuthToken() || ""
|
|
132
|
-
// Bearer token
|
|
133
|
-
});
|
|
134
|
-
return apiConfiguration;
|
|
135
|
-
}
|
|
136
|
-
function getApiConfiguration() {
|
|
137
|
-
if (!apiConfiguration) {
|
|
138
|
-
throw new Error("API adapter not initialized. Call initializeApiAdapter first.");
|
|
139
|
-
}
|
|
140
|
-
return apiConfiguration;
|
|
141
|
-
}
|
|
142
|
-
function getCurrentConfig() {
|
|
143
|
-
if (!currentConfig) {
|
|
144
|
-
throw new Error("API adapter not initialized.");
|
|
145
|
-
}
|
|
146
|
-
return currentConfig;
|
|
147
|
-
}
|
|
148
|
-
var TOKEN_KEY = "ecommerce_access_token";
|
|
149
|
-
function setAuthToken(token) {
|
|
150
|
-
if (typeof window !== "undefined") {
|
|
151
|
-
localStorage.setItem(TOKEN_KEY, token);
|
|
152
|
-
if (apiConfiguration) {
|
|
153
|
-
apiConfiguration.accessToken = () => token;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function getAuthToken() {
|
|
158
|
-
if (typeof window !== "undefined") {
|
|
159
|
-
return localStorage.getItem(TOKEN_KEY);
|
|
160
|
-
}
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
function clearAuthToken() {
|
|
164
|
-
if (typeof window !== "undefined") {
|
|
165
|
-
localStorage.removeItem(TOKEN_KEY);
|
|
166
|
-
if (apiConfiguration) {
|
|
167
|
-
apiConfiguration.accessToken = () => "";
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
214
|
+
// src/providers/AuthProvider.tsx
|
|
215
|
+
init_config();
|
|
171
216
|
var BASE_PATH = "/".replace(/\/+$/, "");
|
|
172
217
|
var BaseAPI = class {
|
|
173
218
|
constructor(configuration, basePath = BASE_PATH, axios = globalAxios4__default.default) {
|
|
@@ -1906,7 +1951,17 @@ function useAuth() {
|
|
|
1906
1951
|
function AuthProvider({ children }) {
|
|
1907
1952
|
const [user, setUser] = React20.useState(null);
|
|
1908
1953
|
const [isLoading, setIsLoading] = React20.useState(true);
|
|
1909
|
-
const
|
|
1954
|
+
const getUserKey = () => {
|
|
1955
|
+
if (typeof window === "undefined") return "ecommerce_user";
|
|
1956
|
+
const token = getAuthToken();
|
|
1957
|
+
if (!token) return "ecommerce_user";
|
|
1958
|
+
try {
|
|
1959
|
+
const config = (init_config(), __toCommonJS(config_exports)).getCurrentConfig();
|
|
1960
|
+
return `ecommerce_user_${config?.storeId || "default"}`;
|
|
1961
|
+
} catch {
|
|
1962
|
+
return "ecommerce_user";
|
|
1963
|
+
}
|
|
1964
|
+
};
|
|
1910
1965
|
const refreshUser = React20.useCallback(async () => {
|
|
1911
1966
|
try {
|
|
1912
1967
|
const token = getAuthToken();
|
|
@@ -1924,7 +1979,8 @@ function AuthProvider({ children }) {
|
|
|
1924
1979
|
React20.useEffect(() => {
|
|
1925
1980
|
if (typeof window !== "undefined") {
|
|
1926
1981
|
try {
|
|
1927
|
-
const
|
|
1982
|
+
const userKey = getUserKey();
|
|
1983
|
+
const cached = localStorage.getItem(userKey);
|
|
1928
1984
|
if (cached) {
|
|
1929
1985
|
const parsed = JSON.parse(cached);
|
|
1930
1986
|
setUser(parsed);
|
|
@@ -1944,7 +2000,7 @@ function AuthProvider({ children }) {
|
|
|
1944
2000
|
}
|
|
1945
2001
|
setUser(response.data.userData);
|
|
1946
2002
|
if (typeof window !== "undefined") {
|
|
1947
|
-
localStorage.setItem(
|
|
2003
|
+
localStorage.setItem(getUserKey(), JSON.stringify(response.data.userData));
|
|
1948
2004
|
}
|
|
1949
2005
|
return response.data;
|
|
1950
2006
|
} finally {
|
|
@@ -1960,7 +2016,7 @@ function AuthProvider({ children }) {
|
|
|
1960
2016
|
}
|
|
1961
2017
|
setUser(response.data.userData);
|
|
1962
2018
|
if (typeof window !== "undefined") {
|
|
1963
|
-
localStorage.setItem(
|
|
2019
|
+
localStorage.setItem(getUserKey(), JSON.stringify(response.data.userData));
|
|
1964
2020
|
}
|
|
1965
2021
|
return response.data;
|
|
1966
2022
|
} finally {
|
|
@@ -1973,7 +2029,7 @@ function AuthProvider({ children }) {
|
|
|
1973
2029
|
clearAuthToken();
|
|
1974
2030
|
setUser(null);
|
|
1975
2031
|
if (typeof window !== "undefined") {
|
|
1976
|
-
localStorage.removeItem(
|
|
2032
|
+
localStorage.removeItem(getUserKey());
|
|
1977
2033
|
}
|
|
1978
2034
|
} finally {
|
|
1979
2035
|
setIsLoading(false);
|
|
@@ -6670,6 +6726,9 @@ var WishlistApi = class extends BaseAPI {
|
|
|
6670
6726
|
}
|
|
6671
6727
|
};
|
|
6672
6728
|
|
|
6729
|
+
// src/lib/Apis/index.ts
|
|
6730
|
+
init_configuration();
|
|
6731
|
+
|
|
6673
6732
|
// src/lib/Apis/models/manual-order-dto.ts
|
|
6674
6733
|
var ManualOrderDTOOrderStatusEnum = /* @__PURE__ */ ((ManualOrderDTOOrderStatusEnum2) => {
|
|
6675
6734
|
ManualOrderDTOOrderStatusEnum2["Pending"] = "Pending";
|
|
@@ -6706,6 +6765,9 @@ var PaymentPaymentStatusEnum = /* @__PURE__ */ ((PaymentPaymentStatusEnum2) => {
|
|
|
6706
6765
|
return PaymentPaymentStatusEnum2;
|
|
6707
6766
|
})(PaymentPaymentStatusEnum || {});
|
|
6708
6767
|
|
|
6768
|
+
// src/lib/api-adapter/index.ts
|
|
6769
|
+
init_config();
|
|
6770
|
+
|
|
6709
6771
|
// src/providers/CartProvider.tsx
|
|
6710
6772
|
var CartContext = React20.createContext(void 0);
|
|
6711
6773
|
function useCart() {
|
|
@@ -6794,6 +6856,11 @@ function CartProvider({ children }) {
|
|
|
6794
6856
|
};
|
|
6795
6857
|
return /* @__PURE__ */ React20__default.default.createElement(CartContext.Provider, { value }, children);
|
|
6796
6858
|
}
|
|
6859
|
+
|
|
6860
|
+
// src/lib/Apis/wrapper.ts
|
|
6861
|
+
init_configuration();
|
|
6862
|
+
init_config();
|
|
6863
|
+
init_config();
|
|
6797
6864
|
var BaseUrl = "https://api.heypharmacist.com";
|
|
6798
6865
|
globalAxios4__default.default.interceptors.request.use(async (config) => {
|
|
6799
6866
|
if (!config?.headers) {
|
|
@@ -7381,7 +7448,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
7381
7448
|
e.preventDefault();
|
|
7382
7449
|
if (searchQuery.trim()) {
|
|
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 handleInputChange = (e) => {
|
|
@@ -7391,7 +7458,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
|
|
|
7391
7458
|
if (e.key === "Enter" && searchQuery.trim()) {
|
|
7392
7459
|
e.preventDefault();
|
|
7393
7460
|
setIsSearching(true);
|
|
7394
|
-
router.push(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
|
|
7461
|
+
router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
|
|
7395
7462
|
}
|
|
7396
7463
|
};
|
|
7397
7464
|
const priceRanges = React20.useMemo(
|
|
@@ -8193,6 +8260,7 @@ var safeFormatDate = (date, format = "long") => {
|
|
|
8193
8260
|
};
|
|
8194
8261
|
function ProductDetailScreen({ productId }) {
|
|
8195
8262
|
const router = navigation.useRouter();
|
|
8263
|
+
const { buildPath } = useBasePath();
|
|
8196
8264
|
const { product: productData, isLoading } = useProduct(productId);
|
|
8197
8265
|
const { addToCart } = useCart();
|
|
8198
8266
|
const [selectedVariant, setSelectedVariant] = React20.useState(null);
|
|
@@ -8372,11 +8440,11 @@ function ProductDetailScreen({ productId }) {
|
|
|
8372
8440
|
{
|
|
8373
8441
|
variant: "ghost",
|
|
8374
8442
|
className: "text-white hover:bg-white/10",
|
|
8375
|
-
onClick: () => router.push("/shop")
|
|
8443
|
+
onClick: () => router.push(buildPath("/shop"))
|
|
8376
8444
|
},
|
|
8377
8445
|
/* @__PURE__ */ React20__default.default.createElement(lucideReact.ArrowLeft, { className: "h-5 w-5" }),
|
|
8378
8446
|
"Continue shopping"
|
|
8379
|
-
), /* @__PURE__ */ React20__default.default.createElement("div", { className: "hidden items-center gap-3 text-sm text-white/80 md:flex" }, /* @__PURE__ */ React20__default.default.createElement(Link8__default.default, { href: "/", className: "transition hover:text-white" }, "Home"), /* @__PURE__ */ React20__default.default.createElement(lucideReact.ChevronRight, { className: "h-4 w-4" }), /* @__PURE__ */ React20__default.default.createElement(Link8__default.default, { href: "/shop", className: "transition hover:text-white" }, "Shop"), /* @__PURE__ */ React20__default.default.createElement(lucideReact.ChevronRight, { className: "h-4 w-4" }), /* @__PURE__ */ React20__default.default.createElement("span", { className: "truncate font-medium text-white" }, product.name))), /* @__PURE__ */ React20__default.default.createElement(
|
|
8447
|
+
), /* @__PURE__ */ React20__default.default.createElement("div", { className: "hidden items-center gap-3 text-sm text-white/80 md:flex" }, /* @__PURE__ */ React20__default.default.createElement(Link8__default.default, { href: buildPath("/"), className: "transition hover:text-white" }, "Home"), /* @__PURE__ */ React20__default.default.createElement(lucideReact.ChevronRight, { className: "h-4 w-4" }), /* @__PURE__ */ React20__default.default.createElement(Link8__default.default, { href: buildPath("/shop"), className: "transition hover:text-white" }, "Shop"), /* @__PURE__ */ React20__default.default.createElement(lucideReact.ChevronRight, { className: "h-4 w-4" }), /* @__PURE__ */ React20__default.default.createElement("span", { className: "truncate font-medium text-white" }, product.name))), /* @__PURE__ */ React20__default.default.createElement(
|
|
8380
8448
|
framerMotion.motion.div,
|
|
8381
8449
|
{
|
|
8382
8450
|
initial: { opacity: 0, y: 24 },
|
|
@@ -8581,6 +8649,7 @@ function CartItem({ item }) {
|
|
|
8581
8649
|
function CartScreen() {
|
|
8582
8650
|
const router = navigation.useRouter();
|
|
8583
8651
|
const { cart, isLoading } = useCart();
|
|
8652
|
+
const { buildPath } = useBasePath();
|
|
8584
8653
|
if (!cart || cart.cartBody.items.length === 0) {
|
|
8585
8654
|
return /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "mx-auto px-20 py-5 bg-white rounded-3xl" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
8586
8655
|
EmptyState,
|
|
@@ -8589,7 +8658,7 @@ function CartScreen() {
|
|
|
8589
8658
|
title: "Your bag feels a little empty",
|
|
8590
8659
|
description: "Add pharmacy favorites to unlock quick shipping, curated bundles, and personalized recommendations.",
|
|
8591
8660
|
actionLabel: "Discover products",
|
|
8592
|
-
onAction: () => router.push("/shop")
|
|
8661
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
8593
8662
|
}
|
|
8594
8663
|
)));
|
|
8595
8664
|
}
|
|
@@ -8630,7 +8699,7 @@ function CartScreen() {
|
|
|
8630
8699
|
{
|
|
8631
8700
|
size: "lg",
|
|
8632
8701
|
className: "mt-6 w-full",
|
|
8633
|
-
onClick: () => router.push("/checkout")
|
|
8702
|
+
onClick: () => router.push(buildPath("/checkout"))
|
|
8634
8703
|
},
|
|
8635
8704
|
"Secure checkout",
|
|
8636
8705
|
/* @__PURE__ */ React20__default.default.createElement(lucideReact.ArrowRight, { className: "h-5 w-5" })
|
|
@@ -8638,7 +8707,7 @@ function CartScreen() {
|
|
|
8638
8707
|
"button",
|
|
8639
8708
|
{
|
|
8640
8709
|
type: "button",
|
|
8641
|
-
onClick: () => router.push("/shop"),
|
|
8710
|
+
onClick: () => router.push(buildPath("/shop")),
|
|
8642
8711
|
className: "mt-4 w-full text-sm font-semibold text-primary-600 transition hover:text-primary-700"
|
|
8643
8712
|
},
|
|
8644
8713
|
"Continue shopping"
|
|
@@ -8715,6 +8784,7 @@ function Card({ className = "", ...props }) {
|
|
|
8715
8784
|
}
|
|
8716
8785
|
function Modal({ isOpen, onClose, title, children, size = "md" }) {
|
|
8717
8786
|
React20.useEffect(() => {
|
|
8787
|
+
if (typeof window === "undefined") return;
|
|
8718
8788
|
if (isOpen) {
|
|
8719
8789
|
document.body.style.overflow = "hidden";
|
|
8720
8790
|
} else {
|
|
@@ -8952,6 +9022,7 @@ function CheckoutScreen() {
|
|
|
8952
9022
|
const router = navigation.useRouter();
|
|
8953
9023
|
const { cart, clearCart } = useCart();
|
|
8954
9024
|
const { isAuthenticated, user } = useAuth();
|
|
9025
|
+
const { buildPath } = useBasePath();
|
|
8955
9026
|
const [isSubmitting, setIsSubmitting] = React20.useState(false);
|
|
8956
9027
|
const [isDelivery, setIsDelivery] = React20.useState(true);
|
|
8957
9028
|
const [paymentMethod, setPaymentMethod] = React20.useState("Card");
|
|
@@ -9094,7 +9165,7 @@ function CheckoutScreen() {
|
|
|
9094
9165
|
setError(null);
|
|
9095
9166
|
if (!isAuthenticated) {
|
|
9096
9167
|
sonner.toast.error("Please login to continue");
|
|
9097
|
-
setTimeout(() => router.push("/login?redirect=/checkout"), 50);
|
|
9168
|
+
setTimeout(() => router.push(buildPath("/login?redirect=/checkout")), 50);
|
|
9098
9169
|
return;
|
|
9099
9170
|
}
|
|
9100
9171
|
if (!cart || cart?.cartBody?.items?.length === 0 || !cart?.cartBody?.items) {
|
|
@@ -9189,11 +9260,11 @@ function CheckoutScreen() {
|
|
|
9189
9260
|
}
|
|
9190
9261
|
sonner.toast.success("Order placed successfully!");
|
|
9191
9262
|
await clearCart();
|
|
9192
|
-
router.push(`/orders/${response.data?.id}`);
|
|
9263
|
+
router.push(buildPath(`/orders/${response.data?.id}`));
|
|
9193
9264
|
} else {
|
|
9194
9265
|
sonner.toast.success("Order placed successfully!");
|
|
9195
9266
|
await clearCart();
|
|
9196
|
-
router.push(`/orders/${response.data?.id}`);
|
|
9267
|
+
router.push(buildPath(`/orders/${response.data?.id}`));
|
|
9197
9268
|
}
|
|
9198
9269
|
} catch (err) {
|
|
9199
9270
|
const msg = err?.message || err?.response?.data?.message || "Failed to place order";
|
|
@@ -9204,7 +9275,7 @@ function CheckoutScreen() {
|
|
|
9204
9275
|
}
|
|
9205
9276
|
};
|
|
9206
9277
|
if (!cart || cart?.cartBody?.items?.length === 0 || !cart?.cartBody?.items) {
|
|
9207
|
-
router.push("/cart");
|
|
9278
|
+
router.push(buildPath("/cart"));
|
|
9208
9279
|
return null;
|
|
9209
9280
|
}
|
|
9210
9281
|
const subtotal = cart.total;
|
|
@@ -9477,8 +9548,9 @@ var loginSchema = zod.z.object({
|
|
|
9477
9548
|
});
|
|
9478
9549
|
function LoginScreen() {
|
|
9479
9550
|
const router = navigation.useRouter();
|
|
9551
|
+
const { buildPath } = useBasePath();
|
|
9480
9552
|
const searchParams = navigation.useSearchParams();
|
|
9481
|
-
const redirectUrl = searchParams?.get("redirect") || "/";
|
|
9553
|
+
const redirectUrl = searchParams?.get("redirect") || buildPath("/");
|
|
9482
9554
|
const { login } = useAuth();
|
|
9483
9555
|
const [showPassword, setShowPassword] = React20.useState(false);
|
|
9484
9556
|
const [isSubmitting, setIsSubmitting] = React20.useState(false);
|
|
@@ -9598,6 +9670,7 @@ var BENEFITS = [
|
|
|
9598
9670
|
function RegisterScreen() {
|
|
9599
9671
|
const router = navigation.useRouter();
|
|
9600
9672
|
const { register: registerUser } = useAuth();
|
|
9673
|
+
const { buildPath } = useBasePath();
|
|
9601
9674
|
const [showPassword, setShowPassword] = React20.useState(false);
|
|
9602
9675
|
const [showConfirmPassword, setShowConfirmPassword] = React20.useState(false);
|
|
9603
9676
|
const [isSubmitting, setIsSubmitting] = React20.useState(false);
|
|
@@ -9619,7 +9692,7 @@ function RegisterScreen() {
|
|
|
9619
9692
|
role: "User" /* User */
|
|
9620
9693
|
});
|
|
9621
9694
|
sonner.toast.success("Account created successfully!");
|
|
9622
|
-
router.push("/");
|
|
9695
|
+
router.push(buildPath("/"));
|
|
9623
9696
|
} catch (error) {
|
|
9624
9697
|
sonner.toast.error(error.response?.data?.message || "Failed to create account");
|
|
9625
9698
|
} finally {
|
|
@@ -9762,6 +9835,7 @@ var profileSchema = zod.z.object({
|
|
|
9762
9835
|
function ProfileScreen() {
|
|
9763
9836
|
const router = navigation.useRouter();
|
|
9764
9837
|
const { user, updateUser, logout } = useAuth();
|
|
9838
|
+
const { buildPath } = useBasePath();
|
|
9765
9839
|
const [isSubmitting, setIsSubmitting] = React20.useState(false);
|
|
9766
9840
|
const {
|
|
9767
9841
|
register,
|
|
@@ -9790,10 +9864,10 @@ function ProfileScreen() {
|
|
|
9790
9864
|
const handleLogout = async () => {
|
|
9791
9865
|
await logout();
|
|
9792
9866
|
sonner.toast.success("Logged out successfully");
|
|
9793
|
-
router.push("/");
|
|
9867
|
+
router.push(buildPath("/"));
|
|
9794
9868
|
};
|
|
9795
9869
|
if (!user) {
|
|
9796
|
-
router.push("/login");
|
|
9870
|
+
router.push(buildPath("/login"));
|
|
9797
9871
|
return null;
|
|
9798
9872
|
}
|
|
9799
9873
|
const quickLinks = [
|
|
@@ -9801,19 +9875,19 @@ function ProfileScreen() {
|
|
|
9801
9875
|
icon: lucideReact.Package,
|
|
9802
9876
|
label: "Order history",
|
|
9803
9877
|
description: "Track shipments and download invoices",
|
|
9804
|
-
href: "/orders"
|
|
9878
|
+
href: buildPath("/orders")
|
|
9805
9879
|
},
|
|
9806
9880
|
{
|
|
9807
9881
|
icon: lucideReact.Heart,
|
|
9808
9882
|
label: "Wishlist",
|
|
9809
9883
|
description: "Curate go-to remedies and favorites",
|
|
9810
|
-
href: "/wishlist"
|
|
9884
|
+
href: buildPath("/wishlist")
|
|
9811
9885
|
},
|
|
9812
9886
|
{
|
|
9813
9887
|
icon: lucideReact.MapPin,
|
|
9814
9888
|
label: "Delivery addresses",
|
|
9815
9889
|
description: "Manage saved delivery locations",
|
|
9816
|
-
href: "/account/addresses"
|
|
9890
|
+
href: buildPath("/account/addresses")
|
|
9817
9891
|
}
|
|
9818
9892
|
];
|
|
9819
9893
|
return /* @__PURE__ */ React20__default.default.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "absolute inset-0 bg-[radial-gradient(circle_at_top_left,_rgba(255,255,255,0.35),_transparent_60%)]" }), /* @__PURE__ */ React20__default.default.createElement("div", { className: "relative container mx-auto px-4 py-16" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
@@ -9829,7 +9903,7 @@ function ProfileScreen() {
|
|
|
9829
9903
|
{
|
|
9830
9904
|
variant: "ghost",
|
|
9831
9905
|
className: "text-white hover:bg-white/20",
|
|
9832
|
-
onClick: () => router.push("/account/change-password")
|
|
9906
|
+
onClick: () => router.push(buildPath("/account/change-password"))
|
|
9833
9907
|
},
|
|
9834
9908
|
"Change password"
|
|
9835
9909
|
))
|
|
@@ -9890,7 +9964,7 @@ function ProfileScreen() {
|
|
|
9890
9964
|
type: "button",
|
|
9891
9965
|
variant: "outline",
|
|
9892
9966
|
size: "lg",
|
|
9893
|
-
onClick: () => router.push("/orders")
|
|
9967
|
+
onClick: () => router.push(buildPath("/orders"))
|
|
9894
9968
|
},
|
|
9895
9969
|
"View recent orders"
|
|
9896
9970
|
)))),
|
|
@@ -9916,7 +9990,7 @@ function ProfileScreen() {
|
|
|
9916
9990
|
{
|
|
9917
9991
|
variant: "outline",
|
|
9918
9992
|
className: "mt-4 w-full",
|
|
9919
|
-
onClick: () => router.push("/account/preferences")
|
|
9993
|
+
onClick: () => router.push(buildPath("/account/preferences"))
|
|
9920
9994
|
},
|
|
9921
9995
|
"Manage preferences"
|
|
9922
9996
|
)),
|
|
@@ -9933,6 +10007,7 @@ function ProfileScreen() {
|
|
|
9933
10007
|
)))));
|
|
9934
10008
|
}
|
|
9935
10009
|
function OrderCard({ order }) {
|
|
10010
|
+
const { buildPath } = useBasePath();
|
|
9936
10011
|
const config = order.orderStatus;
|
|
9937
10012
|
return /* @__PURE__ */ React20__default.default.createElement(
|
|
9938
10013
|
framerMotion.motion.div,
|
|
@@ -10177,6 +10252,7 @@ var STATUS_FILTERS = ["All", ...Object.values(ManualOrderDTOOrderStatusEnum)];
|
|
|
10177
10252
|
var PAYMENT_FILTERS = ["All", ...Object.values(PaymentPaymentStatusEnum)];
|
|
10178
10253
|
function OrdersScreen() {
|
|
10179
10254
|
const router = navigation.useRouter();
|
|
10255
|
+
const { buildPath } = useBasePath();
|
|
10180
10256
|
const [page, setPage] = React20.useState(1);
|
|
10181
10257
|
const [selectedFilter, setSelectedFilter] = React20.useState("All");
|
|
10182
10258
|
const [selectedPaymentFilter, setSelectedPaymentFilter] = React20.useState("All");
|
|
@@ -10268,7 +10344,7 @@ function OrdersScreen() {
|
|
|
10268
10344
|
title: "No orders found for these filters",
|
|
10269
10345
|
description: "Adjust the status or payment filters, or browse the shop for new essentials.",
|
|
10270
10346
|
actionLabel: "Shop products",
|
|
10271
|
-
onAction: () => router.push("/shop")
|
|
10347
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
10272
10348
|
}
|
|
10273
10349
|
)),
|
|
10274
10350
|
!isLoading && pagination.totalPages > 1 && hasOrders && /* @__PURE__ */ React20__default.default.createElement("div", { className: "mt-10 flex flex-wrap items-center justify-center gap-4" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
@@ -10295,6 +10371,7 @@ function OrdersScreen() {
|
|
|
10295
10371
|
function CurrentOrdersScreen() {
|
|
10296
10372
|
const router = navigation.useRouter();
|
|
10297
10373
|
const { orders, isLoading } = useCurrentOrders();
|
|
10374
|
+
const { buildPath } = useBasePath();
|
|
10298
10375
|
const hasOrders = orders.length > 0;
|
|
10299
10376
|
return /* @__PURE__ */ React20__default.default.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "absolute inset-0 bg-[radial-gradient(circle_at_top_left,_rgba(255,255,255,0.35),_transparent_60%)]" }), /* @__PURE__ */ React20__default.default.createElement("div", { className: "relative container mx-auto px-4 py-16" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex flex-col gap-6 md:flex-row md:items-center md:justify-between" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
10300
10377
|
framerMotion.motion.div,
|
|
@@ -10318,7 +10395,7 @@ function CurrentOrdersScreen() {
|
|
|
10318
10395
|
/* @__PURE__ */ React20__default.default.createElement("div", { className: "mt-4 space-y-3 text-sm text-white/80" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
10319
10396
|
Link8__default.default,
|
|
10320
10397
|
{
|
|
10321
|
-
href: "/orders",
|
|
10398
|
+
href: buildPath("/orders"),
|
|
10322
10399
|
className: "flex items-center justify-between rounded-2xl bg-white/10 px-4 py-3 transition hover:bg-white/20"
|
|
10323
10400
|
},
|
|
10324
10401
|
/* @__PURE__ */ React20__default.default.createElement("span", { className: "font-semibold text-white" }, "View order history"),
|
|
@@ -10338,7 +10415,7 @@ function CurrentOrdersScreen() {
|
|
|
10338
10415
|
title: "No active orders",
|
|
10339
10416
|
description: "Start a new order to see live preparation, packing, and delivery updates here.",
|
|
10340
10417
|
actionLabel: "Shop wellness essentials",
|
|
10341
|
-
onAction: () => router.push("/shop")
|
|
10418
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
10342
10419
|
}
|
|
10343
10420
|
))),
|
|
10344
10421
|
/* @__PURE__ */ React20__default.default.createElement("aside", { className: "space-y-6" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "rounded-3xl border border-slate-100 bg-white p-6 shadow-lg shadow-primary-50" }, /* @__PURE__ */ React20__default.default.createElement("h2", { className: "text-lg font-semibold text-slate-900" }, "Real-time milestones"), /* @__PURE__ */ React20__default.default.createElement("div", { className: "mt-4 space-y-4 text-sm text-slate-600" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Warehouse, { className: "h-5 w-5 text-primary-500" }), /* @__PURE__ */ React20__default.default.createElement("div", null, /* @__PURE__ */ React20__default.default.createElement("p", { className: "font-semibold text-slate-800" }, "Preparation"), /* @__PURE__ */ React20__default.default.createElement("p", null, "Our pharmacists verify ingredients and pack thermo-sensitive items."))), /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Truck, { className: "h-5 w-5 text-primary-500" }), /* @__PURE__ */ React20__default.default.createElement("div", null, /* @__PURE__ */ React20__default.default.createElement("p", { className: "font-semibold text-slate-800" }, "In transit"), /* @__PURE__ */ React20__default.default.createElement("p", null, "Track live courier location with ETA updates tailored to your delivery window."))), /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.BellRing, { className: "h-5 w-5 text-primary-500" }), /* @__PURE__ */ React20__default.default.createElement("div", null, /* @__PURE__ */ React20__default.default.createElement("p", { className: "font-semibold text-slate-800" }, "Arrival alerts"), /* @__PURE__ */ React20__default.default.createElement("p", null, "Receive SMS and email notifications when parcels are out for delivery."))))), /* @__PURE__ */ React20__default.default.createElement("div", { className: "rounded-3xl border border-primary-100 bg-primary-50/70 p-6 text-sm text-primary-700 shadow-sm" }, /* @__PURE__ */ React20__default.default.createElement("p", { className: "font-semibold uppercase tracking-[0.3em]" }, "Need support?"), /* @__PURE__ */ React20__default.default.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.")))
|
|
@@ -10835,7 +10912,7 @@ function WishlistScreen() {
|
|
|
10835
10912
|
animate: { opacity: 1, y: 0 },
|
|
10836
10913
|
className: "rounded-3xl border border-slate-100 bg-white p-6 shadow-xl shadow-primary-50"
|
|
10837
10914
|
},
|
|
10838
|
-
/* @__PURE__ */ React20__default.default.createElement("div", { className: "flex flex-col gap-6" }, !isAuthenticated && /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex min-h-[40vh] items-center justify-center" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-primary-50 text-primary-600" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Heart, { className: "h-8 w-8" })), /* @__PURE__ */ React20__default.default.createElement("h2", { className: "mt-6 text-3xl font-bold text-slate-900" }, "Sign in to see your favourites"), /* @__PURE__ */ React20__default.default.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__default.default.createElement(Button, { className: "mt-6", onClick: () => router.push("/login") }, "Sign In"))), isAuthenticated && /* @__PURE__ */ React20__default.default.createElement(React20__default.default.Fragment, null, /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ React20__default.default.createElement("h2", { className: "text-2xl font-semibold text-slate-900" }, "Your saved collection"), /* @__PURE__ */ React20__default.default.createElement("p", { className: "text-sm text-slate-500" }, "Total value: ", /* @__PURE__ */ React20__default.default.createElement("span", { className: "font-semibold text-primary-600" }, formatPrice(totalValue)), onlyInStock && " \u2022 Showing items ready to ship")), /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement(
|
|
10915
|
+
/* @__PURE__ */ React20__default.default.createElement("div", { className: "flex flex-col gap-6" }, !isAuthenticated && /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex min-h-[40vh] items-center justify-center" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-primary-50 text-primary-600" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Heart, { className: "h-8 w-8" })), /* @__PURE__ */ React20__default.default.createElement("h2", { className: "mt-6 text-3xl font-bold text-slate-900" }, "Sign in to see your favourites"), /* @__PURE__ */ React20__default.default.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__default.default.createElement(Button, { className: "mt-6", onClick: () => router.push(buildPath("/login")) }, "Sign In"))), isAuthenticated && /* @__PURE__ */ React20__default.default.createElement(React20__default.default.Fragment, null, /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ React20__default.default.createElement("h2", { className: "text-2xl font-semibold text-slate-900" }, "Your saved collection"), /* @__PURE__ */ React20__default.default.createElement("p", { className: "text-sm text-slate-500" }, "Total value: ", /* @__PURE__ */ React20__default.default.createElement("span", { className: "font-semibold text-primary-600" }, formatPrice(totalValue)), onlyInStock && " \u2022 Showing items ready to ship")), /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement(
|
|
10839
10916
|
"input",
|
|
10840
10917
|
{
|
|
10841
10918
|
type: "checkbox",
|
|
@@ -10884,7 +10961,7 @@ function WishlistScreen() {
|
|
|
10884
10961
|
key: index,
|
|
10885
10962
|
className: "h-72 animate-pulse rounded-2xl border border-slate-200 bg-slate-100"
|
|
10886
10963
|
}
|
|
10887
|
-
))), !isLoading && wishlistCount === 0 && /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex min-h-[30vh] items-center justify-center" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-primary-100 text-primary-600" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Sparkles, { className: "h-10 w-10" })), /* @__PURE__ */ React20__default.default.createElement("h2", { className: "mt-6 text-4xl font-bold text-slate-900" }, "Start your wellness wishlist"), /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "mt-8 flex flex-wrap justify-center gap-3" }, /* @__PURE__ */ React20__default.default.createElement(Button, { onClick: () => router.push("/shop") }, "Discover products"), /* @__PURE__ */ React20__default.default.createElement(Button, { variant: "outline", onClick: () => router.push("/categories") }, "Browse categories")))), !isLoading && processedProducts.length > 0 && /* @__PURE__ */ React20__default.default.createElement(React20__default.default.Fragment, null, viewMode === "grid" ? /* @__PURE__ */ React20__default.default.createElement(
|
|
10964
|
+
))), !isLoading && wishlistCount === 0 && /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex min-h-[30vh] items-center justify-center" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-primary-100 text-primary-600" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Sparkles, { className: "h-10 w-10" })), /* @__PURE__ */ React20__default.default.createElement("h2", { className: "mt-6 text-4xl font-bold text-slate-900" }, "Start your wellness wishlist"), /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "mt-8 flex flex-wrap justify-center gap-3" }, /* @__PURE__ */ React20__default.default.createElement(Button, { onClick: () => router.push(buildPath("/shop")) }, "Discover products"), /* @__PURE__ */ React20__default.default.createElement(Button, { variant: "outline", onClick: () => router.push(buildPath("/categories")) }, "Browse categories")))), !isLoading && processedProducts.length > 0 && /* @__PURE__ */ React20__default.default.createElement(React20__default.default.Fragment, null, viewMode === "grid" ? /* @__PURE__ */ React20__default.default.createElement(
|
|
10888
10965
|
framerMotion.motion.div,
|
|
10889
10966
|
{
|
|
10890
10967
|
layout: true,
|
|
@@ -10934,7 +11011,7 @@ function WishlistScreen() {
|
|
|
10934
11011
|
Button,
|
|
10935
11012
|
{
|
|
10936
11013
|
size: "sm",
|
|
10937
|
-
onClick: () => router.push(`/products/${product.id}`)
|
|
11014
|
+
onClick: () => router.push(buildPath(`/products/${product.id}`))
|
|
10938
11015
|
},
|
|
10939
11016
|
"View details"
|
|
10940
11017
|
), /* @__PURE__ */ React20__default.default.createElement(
|
|
@@ -11060,6 +11137,7 @@ function SearchPage() {
|
|
|
11060
11137
|
function CategoriesScreen() {
|
|
11061
11138
|
const { categories, isLoading } = useCategories();
|
|
11062
11139
|
const router = navigation.useRouter();
|
|
11140
|
+
const { buildPath } = useBasePath();
|
|
11063
11141
|
return /* @__PURE__ */ React20__default.default.createElement("div", { className: "min-h-screen bg-slate-50" }, /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "absolute inset-0 bg-[radial-gradient(circle_at_top_left,_rgba(255,255,255,0.35),_transparent_60%)]" }), /* @__PURE__ */ React20__default.default.createElement("div", { className: "relative container mx-auto px-4 py-16" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
11064
11142
|
framerMotion.motion.div,
|
|
11065
11143
|
{
|
|
@@ -11081,7 +11159,7 @@ function CategoriesScreen() {
|
|
|
11081
11159
|
Link8__default.default,
|
|
11082
11160
|
{
|
|
11083
11161
|
key: category.id,
|
|
11084
|
-
href: `/shop?category=${category.name}
|
|
11162
|
+
href: buildPath(`/shop?category=${category.name}`),
|
|
11085
11163
|
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"
|
|
11086
11164
|
},
|
|
11087
11165
|
/* @__PURE__ */ React20__default.default.createElement("div", { className: "relative aspect-square w-full overflow-hidden rounded-lg bg-gray-50 mb-3" }, category.image ? /* @__PURE__ */ React20__default.default.createElement(
|
|
@@ -11103,7 +11181,7 @@ function CategoriesScreen() {
|
|
|
11103
11181
|
description: "There are currently no product categories available.",
|
|
11104
11182
|
icon: lucideReact.Package,
|
|
11105
11183
|
actionLabel: "Shop products",
|
|
11106
|
-
onAction: () => router.push("/shop")
|
|
11184
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
11107
11185
|
}
|
|
11108
11186
|
)
|
|
11109
11187
|
))));
|
|
@@ -11255,14 +11333,15 @@ function Header() {
|
|
|
11255
11333
|
const [isMobileMenuOpen, setIsMobileMenuOpen] = React20.useState(false);
|
|
11256
11334
|
const [isSearchOpen, setIsSearchOpen] = React20.useState(false);
|
|
11257
11335
|
const [searchQuery, setSearchQuery] = React20.useState("");
|
|
11336
|
+
const { buildPath } = useBasePath();
|
|
11258
11337
|
const navLinks = [
|
|
11259
|
-
{ href: "/shop", label: "Shop" },
|
|
11260
|
-
{ href: "/categories", label: "Categories" },
|
|
11261
|
-
{ href: "/orders", label: "Orders" },
|
|
11262
|
-
{ href: "/about", label: "About" },
|
|
11263
|
-
{ href: "/contact", label: "Contact" }
|
|
11338
|
+
{ href: buildPath("/shop"), label: "Shop" },
|
|
11339
|
+
{ href: buildPath("/categories"), label: "Categories" },
|
|
11340
|
+
{ href: buildPath("/orders"), label: "Orders" },
|
|
11341
|
+
{ href: buildPath("/about"), label: "About" },
|
|
11342
|
+
{ href: buildPath("/contact"), label: "Contact" }
|
|
11264
11343
|
];
|
|
11265
|
-
return /* @__PURE__ */ React20__default.default.createElement("header", { className: "sticky top-0 z-40 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-sm" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "container mx-auto px-4" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-center justify-between h-20" }, /* @__PURE__ */ React20__default.default.createElement(Link8__default.default, { href: "/", className: "flex items-center gap-3" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "relative w-12 h-12" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
11344
|
+
return /* @__PURE__ */ React20__default.default.createElement("header", { className: "sticky top-0 z-40 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-sm" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "container mx-auto px-4" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-center justify-between h-20" }, /* @__PURE__ */ React20__default.default.createElement(Link8__default.default, { href: buildPath("/"), className: "flex items-center gap-3" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "relative w-12 h-12" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
11266
11345
|
Image3__default.default,
|
|
11267
11346
|
{
|
|
11268
11347
|
src: config.logo,
|
|
@@ -11303,7 +11382,7 @@ function Header() {
|
|
|
11303
11382
|
onChange: (e) => setSearchQuery(e.target.value),
|
|
11304
11383
|
onKeyDown: (e) => {
|
|
11305
11384
|
if (e.key === "Enter" && searchQuery.trim()) {
|
|
11306
|
-
window.location.href = `/search?q=${encodeURIComponent(searchQuery.trim())}
|
|
11385
|
+
window.location.href = buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
|
|
11307
11386
|
}
|
|
11308
11387
|
},
|
|
11309
11388
|
placeholder: "Search products...",
|
|
@@ -11318,17 +11397,17 @@ function Header() {
|
|
|
11318
11397
|
},
|
|
11319
11398
|
/* @__PURE__ */ React20__default.default.createElement(lucideReact.X, { className: "w-4 h-4" })
|
|
11320
11399
|
))
|
|
11321
|
-
))), /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React20__default.default.createElement(Link8__default.default, { href: "/wishlist", className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Heart, { className: "w-6 h-6" }), wishlistCount > 0 && /* @__PURE__ */ React20__default.default.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__default.default.createElement(Link8__default.default, { href: "/cart", className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.ShoppingCart, { className: "w-6 h-6" }), cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ React20__default.default.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__default.default.createElement(
|
|
11400
|
+
))), /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React20__default.default.createElement(Link8__default.default, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Heart, { className: "w-6 h-6" }), wishlistCount > 0 && /* @__PURE__ */ React20__default.default.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__default.default.createElement(Link8__default.default, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.ShoppingCart, { className: "w-6 h-6" }), cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ React20__default.default.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__default.default.createElement(
|
|
11322
11401
|
Link8__default.default,
|
|
11323
11402
|
{
|
|
11324
|
-
href: "/account",
|
|
11403
|
+
href: buildPath("/account"),
|
|
11325
11404
|
className: "p-2 hover:bg-gray-100 rounded-lg transition-colors"
|
|
11326
11405
|
},
|
|
11327
11406
|
/* @__PURE__ */ React20__default.default.createElement(lucideReact.User, { className: "w-6 h-6 text-gray-700" })
|
|
11328
11407
|
) : /* @__PURE__ */ React20__default.default.createElement(
|
|
11329
11408
|
Link8__default.default,
|
|
11330
11409
|
{
|
|
11331
|
-
href: "/login",
|
|
11410
|
+
href: buildPath("/login"),
|
|
11332
11411
|
className: "hidden sm:block px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium"
|
|
11333
11412
|
},
|
|
11334
11413
|
"Sign In"
|
|
@@ -11359,7 +11438,7 @@ function Header() {
|
|
|
11359
11438
|
)), !isAuthenticated && /* @__PURE__ */ React20__default.default.createElement(
|
|
11360
11439
|
Link8__default.default,
|
|
11361
11440
|
{
|
|
11362
|
-
href: "/login",
|
|
11441
|
+
href: buildPath("/login"),
|
|
11363
11442
|
onClick: () => setIsMobileMenuOpen(false),
|
|
11364
11443
|
className: "px-4 py-3 text-primary-600 hover:bg-gray-50 rounded-lg font-medium"
|
|
11365
11444
|
},
|
|
@@ -11369,25 +11448,32 @@ function Header() {
|
|
|
11369
11448
|
}
|
|
11370
11449
|
function Footer() {
|
|
11371
11450
|
const { config } = useTheme();
|
|
11451
|
+
const { buildPath } = useBasePath();
|
|
11372
11452
|
const footerLinks = {
|
|
11373
11453
|
shop: [
|
|
11374
|
-
{ label: "All Products", href: "/shop" },
|
|
11375
|
-
{ label: "Categories", href: "/categories" },
|
|
11376
|
-
{ label: "Featured", href: "/featured" },
|
|
11377
|
-
{ label: "New Arrivals", href: "/new" }
|
|
11454
|
+
{ label: "All Products", href: buildPath("/shop") },
|
|
11455
|
+
{ label: "Categories", href: buildPath("/categories") },
|
|
11456
|
+
{ label: "Featured", href: buildPath("/featured") },
|
|
11457
|
+
{ label: "New Arrivals", href: buildPath("/new") }
|
|
11378
11458
|
],
|
|
11379
11459
|
account: [
|
|
11380
|
-
{ label: "My Account", href: "/account" },
|
|
11381
|
-
{ label: "Orders", href: "/orders" },
|
|
11382
|
-
{ label: "Wishlist", href: "/wishlist" },
|
|
11383
|
-
{ label: "Cart", href: "/cart" }
|
|
11460
|
+
{ label: "My Account", href: buildPath("/account") },
|
|
11461
|
+
{ label: "Orders", href: buildPath("/orders") },
|
|
11462
|
+
{ label: "Wishlist", href: buildPath("/wishlist") },
|
|
11463
|
+
{ label: "Cart", href: buildPath("/cart") }
|
|
11384
11464
|
],
|
|
11385
11465
|
support: [
|
|
11386
|
-
{ label: "Contact Us", href: "/contact" },
|
|
11387
|
-
{ label: "FAQs", href: "/faqs" },
|
|
11388
|
-
{ label: "Shipping Info", href: "/shipping" },
|
|
11389
|
-
{ label: "Returns", href: "/returns" }
|
|
11390
|
-
]
|
|
11466
|
+
{ label: "Contact Us", href: buildPath("/contact") },
|
|
11467
|
+
{ label: "FAQs", href: buildPath("/faqs") },
|
|
11468
|
+
{ label: "Shipping Info", href: buildPath("/shipping") },
|
|
11469
|
+
{ label: "Returns", href: buildPath("/returns") }
|
|
11470
|
+
],
|
|
11471
|
+
legal: [
|
|
11472
|
+
{ label: "Privacy Policy", href: buildPath("/privacy") },
|
|
11473
|
+
{ label: "Terms of Service", href: buildPath("/terms") },
|
|
11474
|
+
{ label: "Cookie Policy", href: buildPath("/cookies") }
|
|
11475
|
+
]
|
|
11476
|
+
};
|
|
11391
11477
|
return /* @__PURE__ */ React20__default.default.createElement("footer", { className: "bg-gray-900 text-gray-300" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "container mx-auto px-4 py-16" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-12" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "lg:col-span-2" }, /* @__PURE__ */ React20__default.default.createElement("h3", { className: "text-2xl font-bold text-white mb-4" }, config.storeName), /* @__PURE__ */ React20__default.default.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__default.default.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Mail, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React20__default.default.createElement("span", null, "support@", config.storeName.toLowerCase().replace(/\s+/g, ""), ".com")), /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.Phone, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React20__default.default.createElement("span", null, "+1 (555) 123-4567")), /* @__PURE__ */ React20__default.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React20__default.default.createElement(lucideReact.MapPin, { className: "w-5 h-5 text-primary-500" }), /* @__PURE__ */ React20__default.default.createElement("span", null, "123 Store Street, City, Country")))), /* @__PURE__ */ React20__default.default.createElement("div", null, /* @__PURE__ */ React20__default.default.createElement("h4", { className: "text-lg font-semibold text-white mb-4" }, "Shop"), /* @__PURE__ */ React20__default.default.createElement("ul", { className: "space-y-2" }, footerLinks.shop.map((link) => /* @__PURE__ */ React20__default.default.createElement("li", { key: link.href }, /* @__PURE__ */ React20__default.default.createElement(
|
|
11392
11478
|
Link8__default.default,
|
|
11393
11479
|
{
|