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.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"
|
|
@@ -8952,6 +9021,7 @@ function CheckoutScreen() {
|
|
|
8952
9021
|
const router = navigation.useRouter();
|
|
8953
9022
|
const { cart, clearCart } = useCart();
|
|
8954
9023
|
const { isAuthenticated, user } = useAuth();
|
|
9024
|
+
const { buildPath } = useBasePath();
|
|
8955
9025
|
const [isSubmitting, setIsSubmitting] = React20.useState(false);
|
|
8956
9026
|
const [isDelivery, setIsDelivery] = React20.useState(true);
|
|
8957
9027
|
const [paymentMethod, setPaymentMethod] = React20.useState("Card");
|
|
@@ -9094,7 +9164,7 @@ function CheckoutScreen() {
|
|
|
9094
9164
|
setError(null);
|
|
9095
9165
|
if (!isAuthenticated) {
|
|
9096
9166
|
sonner.toast.error("Please login to continue");
|
|
9097
|
-
setTimeout(() => router.push("/login?redirect=/checkout"), 50);
|
|
9167
|
+
setTimeout(() => router.push(buildPath("/login?redirect=/checkout")), 50);
|
|
9098
9168
|
return;
|
|
9099
9169
|
}
|
|
9100
9170
|
if (!cart || cart?.cartBody?.items?.length === 0 || !cart?.cartBody?.items) {
|
|
@@ -9189,11 +9259,11 @@ function CheckoutScreen() {
|
|
|
9189
9259
|
}
|
|
9190
9260
|
sonner.toast.success("Order placed successfully!");
|
|
9191
9261
|
await clearCart();
|
|
9192
|
-
router.push(`/orders/${response.data?.id}`);
|
|
9262
|
+
router.push(buildPath(`/orders/${response.data?.id}`));
|
|
9193
9263
|
} else {
|
|
9194
9264
|
sonner.toast.success("Order placed successfully!");
|
|
9195
9265
|
await clearCart();
|
|
9196
|
-
router.push(`/orders/${response.data?.id}`);
|
|
9266
|
+
router.push(buildPath(`/orders/${response.data?.id}`));
|
|
9197
9267
|
}
|
|
9198
9268
|
} catch (err) {
|
|
9199
9269
|
const msg = err?.message || err?.response?.data?.message || "Failed to place order";
|
|
@@ -9204,7 +9274,7 @@ function CheckoutScreen() {
|
|
|
9204
9274
|
}
|
|
9205
9275
|
};
|
|
9206
9276
|
if (!cart || cart?.cartBody?.items?.length === 0 || !cart?.cartBody?.items) {
|
|
9207
|
-
router.push("/cart");
|
|
9277
|
+
router.push(buildPath("/cart"));
|
|
9208
9278
|
return null;
|
|
9209
9279
|
}
|
|
9210
9280
|
const subtotal = cart.total;
|
|
@@ -9477,8 +9547,9 @@ var loginSchema = zod.z.object({
|
|
|
9477
9547
|
});
|
|
9478
9548
|
function LoginScreen() {
|
|
9479
9549
|
const router = navigation.useRouter();
|
|
9550
|
+
const { buildPath } = useBasePath();
|
|
9480
9551
|
const searchParams = navigation.useSearchParams();
|
|
9481
|
-
const redirectUrl = searchParams?.get("redirect") || "/";
|
|
9552
|
+
const redirectUrl = searchParams?.get("redirect") || buildPath("/");
|
|
9482
9553
|
const { login } = useAuth();
|
|
9483
9554
|
const [showPassword, setShowPassword] = React20.useState(false);
|
|
9484
9555
|
const [isSubmitting, setIsSubmitting] = React20.useState(false);
|
|
@@ -9598,6 +9669,7 @@ var BENEFITS = [
|
|
|
9598
9669
|
function RegisterScreen() {
|
|
9599
9670
|
const router = navigation.useRouter();
|
|
9600
9671
|
const { register: registerUser } = useAuth();
|
|
9672
|
+
const { buildPath } = useBasePath();
|
|
9601
9673
|
const [showPassword, setShowPassword] = React20.useState(false);
|
|
9602
9674
|
const [showConfirmPassword, setShowConfirmPassword] = React20.useState(false);
|
|
9603
9675
|
const [isSubmitting, setIsSubmitting] = React20.useState(false);
|
|
@@ -9619,7 +9691,7 @@ function RegisterScreen() {
|
|
|
9619
9691
|
role: "User" /* User */
|
|
9620
9692
|
});
|
|
9621
9693
|
sonner.toast.success("Account created successfully!");
|
|
9622
|
-
router.push("/");
|
|
9694
|
+
router.push(buildPath("/"));
|
|
9623
9695
|
} catch (error) {
|
|
9624
9696
|
sonner.toast.error(error.response?.data?.message || "Failed to create account");
|
|
9625
9697
|
} finally {
|
|
@@ -9762,6 +9834,7 @@ var profileSchema = zod.z.object({
|
|
|
9762
9834
|
function ProfileScreen() {
|
|
9763
9835
|
const router = navigation.useRouter();
|
|
9764
9836
|
const { user, updateUser, logout } = useAuth();
|
|
9837
|
+
const { buildPath } = useBasePath();
|
|
9765
9838
|
const [isSubmitting, setIsSubmitting] = React20.useState(false);
|
|
9766
9839
|
const {
|
|
9767
9840
|
register,
|
|
@@ -9790,10 +9863,10 @@ function ProfileScreen() {
|
|
|
9790
9863
|
const handleLogout = async () => {
|
|
9791
9864
|
await logout();
|
|
9792
9865
|
sonner.toast.success("Logged out successfully");
|
|
9793
|
-
router.push("/");
|
|
9866
|
+
router.push(buildPath("/"));
|
|
9794
9867
|
};
|
|
9795
9868
|
if (!user) {
|
|
9796
|
-
router.push("/login");
|
|
9869
|
+
router.push(buildPath("/login"));
|
|
9797
9870
|
return null;
|
|
9798
9871
|
}
|
|
9799
9872
|
const quickLinks = [
|
|
@@ -9801,19 +9874,19 @@ function ProfileScreen() {
|
|
|
9801
9874
|
icon: lucideReact.Package,
|
|
9802
9875
|
label: "Order history",
|
|
9803
9876
|
description: "Track shipments and download invoices",
|
|
9804
|
-
href: "/orders"
|
|
9877
|
+
href: buildPath("/orders")
|
|
9805
9878
|
},
|
|
9806
9879
|
{
|
|
9807
9880
|
icon: lucideReact.Heart,
|
|
9808
9881
|
label: "Wishlist",
|
|
9809
9882
|
description: "Curate go-to remedies and favorites",
|
|
9810
|
-
href: "/wishlist"
|
|
9883
|
+
href: buildPath("/wishlist")
|
|
9811
9884
|
},
|
|
9812
9885
|
{
|
|
9813
9886
|
icon: lucideReact.MapPin,
|
|
9814
9887
|
label: "Delivery addresses",
|
|
9815
9888
|
description: "Manage saved delivery locations",
|
|
9816
|
-
href: "/account/addresses"
|
|
9889
|
+
href: buildPath("/account/addresses")
|
|
9817
9890
|
}
|
|
9818
9891
|
];
|
|
9819
9892
|
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 +9902,7 @@ function ProfileScreen() {
|
|
|
9829
9902
|
{
|
|
9830
9903
|
variant: "ghost",
|
|
9831
9904
|
className: "text-white hover:bg-white/20",
|
|
9832
|
-
onClick: () => router.push("/account/change-password")
|
|
9905
|
+
onClick: () => router.push(buildPath("/account/change-password"))
|
|
9833
9906
|
},
|
|
9834
9907
|
"Change password"
|
|
9835
9908
|
))
|
|
@@ -9890,7 +9963,7 @@ function ProfileScreen() {
|
|
|
9890
9963
|
type: "button",
|
|
9891
9964
|
variant: "outline",
|
|
9892
9965
|
size: "lg",
|
|
9893
|
-
onClick: () => router.push("/orders")
|
|
9966
|
+
onClick: () => router.push(buildPath("/orders"))
|
|
9894
9967
|
},
|
|
9895
9968
|
"View recent orders"
|
|
9896
9969
|
)))),
|
|
@@ -9916,7 +9989,7 @@ function ProfileScreen() {
|
|
|
9916
9989
|
{
|
|
9917
9990
|
variant: "outline",
|
|
9918
9991
|
className: "mt-4 w-full",
|
|
9919
|
-
onClick: () => router.push("/account/preferences")
|
|
9992
|
+
onClick: () => router.push(buildPath("/account/preferences"))
|
|
9920
9993
|
},
|
|
9921
9994
|
"Manage preferences"
|
|
9922
9995
|
)),
|
|
@@ -9933,6 +10006,7 @@ function ProfileScreen() {
|
|
|
9933
10006
|
)))));
|
|
9934
10007
|
}
|
|
9935
10008
|
function OrderCard({ order }) {
|
|
10009
|
+
const { buildPath } = useBasePath();
|
|
9936
10010
|
const config = order.orderStatus;
|
|
9937
10011
|
return /* @__PURE__ */ React20__default.default.createElement(
|
|
9938
10012
|
framerMotion.motion.div,
|
|
@@ -10177,6 +10251,7 @@ var STATUS_FILTERS = ["All", ...Object.values(ManualOrderDTOOrderStatusEnum)];
|
|
|
10177
10251
|
var PAYMENT_FILTERS = ["All", ...Object.values(PaymentPaymentStatusEnum)];
|
|
10178
10252
|
function OrdersScreen() {
|
|
10179
10253
|
const router = navigation.useRouter();
|
|
10254
|
+
const { buildPath } = useBasePath();
|
|
10180
10255
|
const [page, setPage] = React20.useState(1);
|
|
10181
10256
|
const [selectedFilter, setSelectedFilter] = React20.useState("All");
|
|
10182
10257
|
const [selectedPaymentFilter, setSelectedPaymentFilter] = React20.useState("All");
|
|
@@ -10268,7 +10343,7 @@ function OrdersScreen() {
|
|
|
10268
10343
|
title: "No orders found for these filters",
|
|
10269
10344
|
description: "Adjust the status or payment filters, or browse the shop for new essentials.",
|
|
10270
10345
|
actionLabel: "Shop products",
|
|
10271
|
-
onAction: () => router.push("/shop")
|
|
10346
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
10272
10347
|
}
|
|
10273
10348
|
)),
|
|
10274
10349
|
!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 +10370,7 @@ function OrdersScreen() {
|
|
|
10295
10370
|
function CurrentOrdersScreen() {
|
|
10296
10371
|
const router = navigation.useRouter();
|
|
10297
10372
|
const { orders, isLoading } = useCurrentOrders();
|
|
10373
|
+
const { buildPath } = useBasePath();
|
|
10298
10374
|
const hasOrders = orders.length > 0;
|
|
10299
10375
|
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
10376
|
framerMotion.motion.div,
|
|
@@ -10318,7 +10394,7 @@ function CurrentOrdersScreen() {
|
|
|
10318
10394
|
/* @__PURE__ */ React20__default.default.createElement("div", { className: "mt-4 space-y-3 text-sm text-white/80" }, /* @__PURE__ */ React20__default.default.createElement(
|
|
10319
10395
|
Link8__default.default,
|
|
10320
10396
|
{
|
|
10321
|
-
href: "/orders",
|
|
10397
|
+
href: buildPath("/orders"),
|
|
10322
10398
|
className: "flex items-center justify-between rounded-2xl bg-white/10 px-4 py-3 transition hover:bg-white/20"
|
|
10323
10399
|
},
|
|
10324
10400
|
/* @__PURE__ */ React20__default.default.createElement("span", { className: "font-semibold text-white" }, "View order history"),
|
|
@@ -10338,7 +10414,7 @@ function CurrentOrdersScreen() {
|
|
|
10338
10414
|
title: "No active orders",
|
|
10339
10415
|
description: "Start a new order to see live preparation, packing, and delivery updates here.",
|
|
10340
10416
|
actionLabel: "Shop wellness essentials",
|
|
10341
|
-
onAction: () => router.push("/shop")
|
|
10417
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
10342
10418
|
}
|
|
10343
10419
|
))),
|
|
10344
10420
|
/* @__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 +10911,7 @@ function WishlistScreen() {
|
|
|
10835
10911
|
animate: { opacity: 1, y: 0 },
|
|
10836
10912
|
className: "rounded-3xl border border-slate-100 bg-white p-6 shadow-xl shadow-primary-50"
|
|
10837
10913
|
},
|
|
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(
|
|
10914
|
+
/* @__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
10915
|
"input",
|
|
10840
10916
|
{
|
|
10841
10917
|
type: "checkbox",
|
|
@@ -10884,7 +10960,7 @@ function WishlistScreen() {
|
|
|
10884
10960
|
key: index,
|
|
10885
10961
|
className: "h-72 animate-pulse rounded-2xl border border-slate-200 bg-slate-100"
|
|
10886
10962
|
}
|
|
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(
|
|
10963
|
+
))), !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
10964
|
framerMotion.motion.div,
|
|
10889
10965
|
{
|
|
10890
10966
|
layout: true,
|
|
@@ -10934,7 +11010,7 @@ function WishlistScreen() {
|
|
|
10934
11010
|
Button,
|
|
10935
11011
|
{
|
|
10936
11012
|
size: "sm",
|
|
10937
|
-
onClick: () => router.push(`/products/${product.id}`)
|
|
11013
|
+
onClick: () => router.push(buildPath(`/products/${product.id}`))
|
|
10938
11014
|
},
|
|
10939
11015
|
"View details"
|
|
10940
11016
|
), /* @__PURE__ */ React20__default.default.createElement(
|
|
@@ -11060,6 +11136,7 @@ function SearchPage() {
|
|
|
11060
11136
|
function CategoriesScreen() {
|
|
11061
11137
|
const { categories, isLoading } = useCategories();
|
|
11062
11138
|
const router = navigation.useRouter();
|
|
11139
|
+
const { buildPath } = useBasePath();
|
|
11063
11140
|
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
11141
|
framerMotion.motion.div,
|
|
11065
11142
|
{
|
|
@@ -11081,7 +11158,7 @@ function CategoriesScreen() {
|
|
|
11081
11158
|
Link8__default.default,
|
|
11082
11159
|
{
|
|
11083
11160
|
key: category.id,
|
|
11084
|
-
href: `/shop?category=${category.name}
|
|
11161
|
+
href: buildPath(`/shop?category=${category.name}`),
|
|
11085
11162
|
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
11163
|
},
|
|
11087
11164
|
/* @__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 +11180,7 @@ function CategoriesScreen() {
|
|
|
11103
11180
|
description: "There are currently no product categories available.",
|
|
11104
11181
|
icon: lucideReact.Package,
|
|
11105
11182
|
actionLabel: "Shop products",
|
|
11106
|
-
onAction: () => router.push("/shop")
|
|
11183
|
+
onAction: () => router.push(buildPath("/shop"))
|
|
11107
11184
|
}
|
|
11108
11185
|
)
|
|
11109
11186
|
))));
|
|
@@ -11255,14 +11332,15 @@ function Header() {
|
|
|
11255
11332
|
const [isMobileMenuOpen, setIsMobileMenuOpen] = React20.useState(false);
|
|
11256
11333
|
const [isSearchOpen, setIsSearchOpen] = React20.useState(false);
|
|
11257
11334
|
const [searchQuery, setSearchQuery] = React20.useState("");
|
|
11335
|
+
const { buildPath } = useBasePath();
|
|
11258
11336
|
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" }
|
|
11337
|
+
{ href: buildPath("/shop"), label: "Shop" },
|
|
11338
|
+
{ href: buildPath("/categories"), label: "Categories" },
|
|
11339
|
+
{ href: buildPath("/orders"), label: "Orders" },
|
|
11340
|
+
{ href: buildPath("/about"), label: "About" },
|
|
11341
|
+
{ href: buildPath("/contact"), label: "Contact" }
|
|
11264
11342
|
];
|
|
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(
|
|
11343
|
+
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
11344
|
Image3__default.default,
|
|
11267
11345
|
{
|
|
11268
11346
|
src: config.logo,
|
|
@@ -11303,7 +11381,7 @@ function Header() {
|
|
|
11303
11381
|
onChange: (e) => setSearchQuery(e.target.value),
|
|
11304
11382
|
onKeyDown: (e) => {
|
|
11305
11383
|
if (e.key === "Enter" && searchQuery.trim()) {
|
|
11306
|
-
window.location.href = `/search?q=${encodeURIComponent(searchQuery.trim())}
|
|
11384
|
+
window.location.href = buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
|
|
11307
11385
|
}
|
|
11308
11386
|
},
|
|
11309
11387
|
placeholder: "Search products...",
|
|
@@ -11318,17 +11396,17 @@ function Header() {
|
|
|
11318
11396
|
},
|
|
11319
11397
|
/* @__PURE__ */ React20__default.default.createElement(lucideReact.X, { className: "w-4 h-4" })
|
|
11320
11398
|
))
|
|
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(
|
|
11399
|
+
))), /* @__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
11400
|
Link8__default.default,
|
|
11323
11401
|
{
|
|
11324
|
-
href: "/account",
|
|
11402
|
+
href: buildPath("/account"),
|
|
11325
11403
|
className: "p-2 hover:bg-gray-100 rounded-lg transition-colors"
|
|
11326
11404
|
},
|
|
11327
11405
|
/* @__PURE__ */ React20__default.default.createElement(lucideReact.User, { className: "w-6 h-6 text-gray-700" })
|
|
11328
11406
|
) : /* @__PURE__ */ React20__default.default.createElement(
|
|
11329
11407
|
Link8__default.default,
|
|
11330
11408
|
{
|
|
11331
|
-
href: "/login",
|
|
11409
|
+
href: buildPath("/login"),
|
|
11332
11410
|
className: "hidden sm:block px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium"
|
|
11333
11411
|
},
|
|
11334
11412
|
"Sign In"
|
|
@@ -11359,7 +11437,7 @@ function Header() {
|
|
|
11359
11437
|
)), !isAuthenticated && /* @__PURE__ */ React20__default.default.createElement(
|
|
11360
11438
|
Link8__default.default,
|
|
11361
11439
|
{
|
|
11362
|
-
href: "/login",
|
|
11440
|
+
href: buildPath("/login"),
|
|
11363
11441
|
onClick: () => setIsMobileMenuOpen(false),
|
|
11364
11442
|
className: "px-4 py-3 text-primary-600 hover:bg-gray-50 rounded-lg font-medium"
|
|
11365
11443
|
},
|
|
@@ -11369,25 +11447,32 @@ function Header() {
|
|
|
11369
11447
|
}
|
|
11370
11448
|
function Footer() {
|
|
11371
11449
|
const { config } = useTheme();
|
|
11450
|
+
const { buildPath } = useBasePath();
|
|
11372
11451
|
const footerLinks = {
|
|
11373
11452
|
shop: [
|
|
11374
|
-
{ label: "All Products", href: "/shop" },
|
|
11375
|
-
{ label: "Categories", href: "/categories" },
|
|
11376
|
-
{ label: "Featured", href: "/featured" },
|
|
11377
|
-
{ label: "New Arrivals", href: "/new" }
|
|
11453
|
+
{ label: "All Products", href: buildPath("/shop") },
|
|
11454
|
+
{ label: "Categories", href: buildPath("/categories") },
|
|
11455
|
+
{ label: "Featured", href: buildPath("/featured") },
|
|
11456
|
+
{ label: "New Arrivals", href: buildPath("/new") }
|
|
11378
11457
|
],
|
|
11379
11458
|
account: [
|
|
11380
|
-
{ label: "My Account", href: "/account" },
|
|
11381
|
-
{ label: "Orders", href: "/orders" },
|
|
11382
|
-
{ label: "Wishlist", href: "/wishlist" },
|
|
11383
|
-
{ label: "Cart", href: "/cart" }
|
|
11459
|
+
{ label: "My Account", href: buildPath("/account") },
|
|
11460
|
+
{ label: "Orders", href: buildPath("/orders") },
|
|
11461
|
+
{ label: "Wishlist", href: buildPath("/wishlist") },
|
|
11462
|
+
{ label: "Cart", href: buildPath("/cart") }
|
|
11384
11463
|
],
|
|
11385
11464
|
support: [
|
|
11386
|
-
{ label: "Contact Us", href: "/contact" },
|
|
11387
|
-
{ label: "FAQs", href: "/faqs" },
|
|
11388
|
-
{ label: "Shipping Info", href: "/shipping" },
|
|
11389
|
-
{ label: "Returns", href: "/returns" }
|
|
11390
|
-
]
|
|
11465
|
+
{ label: "Contact Us", href: buildPath("/contact") },
|
|
11466
|
+
{ label: "FAQs", href: buildPath("/faqs") },
|
|
11467
|
+
{ label: "Shipping Info", href: buildPath("/shipping") },
|
|
11468
|
+
{ label: "Returns", href: buildPath("/returns") }
|
|
11469
|
+
],
|
|
11470
|
+
legal: [
|
|
11471
|
+
{ label: "Privacy Policy", href: buildPath("/privacy") },
|
|
11472
|
+
{ label: "Terms of Service", href: buildPath("/terms") },
|
|
11473
|
+
{ label: "Cookie Policy", href: buildPath("/cookies") }
|
|
11474
|
+
]
|
|
11475
|
+
};
|
|
11391
11476
|
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
11477
|
Link8__default.default,
|
|
11393
11478
|
{
|