hey-pharmacist-ecommerce 1.1.27 → 1.1.29

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.
Files changed (61) hide show
  1. package/dist/index.d.mts +344 -640
  2. package/dist/index.d.ts +344 -640
  3. package/dist/index.js +1814 -835
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1814 -837
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/AccountOrdersTab.tsx +1 -1
  9. package/src/components/AccountSettingsTab.tsx +88 -6
  10. package/src/components/CartItem.tsx +1 -1
  11. package/src/components/Header.tsx +8 -2
  12. package/src/components/OrderCard.tsx +4 -4
  13. package/src/components/ProductCard.tsx +59 -42
  14. package/src/components/QuickViewModal.tsx +13 -13
  15. package/src/hooks/useAddresses.ts +4 -1
  16. package/src/hooks/usePaymentMethods.ts +26 -31
  17. package/src/hooks/useProducts.ts +63 -64
  18. package/src/hooks/useWishlistProducts.ts +4 -5
  19. package/src/index.ts +2 -0
  20. package/src/lib/Apis/api.ts +0 -1
  21. package/src/lib/Apis/apis/auth-api.ts +18 -29
  22. package/src/lib/Apis/apis/products-api.ts +845 -405
  23. package/src/lib/Apis/models/category-populated.ts +0 -12
  24. package/src/lib/Apis/models/category-sub-category-populated.ts +2 -2
  25. package/src/lib/Apis/models/category.ts +0 -18
  26. package/src/lib/Apis/models/{table-cell-dto.ts → change-password-dto.ts} +6 -6
  27. package/src/lib/Apis/models/create-product-dto.ts +30 -23
  28. package/src/lib/Apis/models/create-sub-category-dto.ts +6 -0
  29. package/src/lib/Apis/models/create-variant-dto.ts +29 -29
  30. package/src/lib/Apis/models/index.ts +5 -7
  31. package/src/lib/Apis/models/paginated-products-dto.ts +6 -6
  32. package/src/lib/Apis/models/product-summary.ts +69 -0
  33. package/src/lib/Apis/models/product-variant.ts +34 -65
  34. package/src/lib/Apis/models/product.ts +138 -0
  35. package/src/lib/Apis/models/products-insights-dto.ts +12 -0
  36. package/src/lib/Apis/models/single-product-media.ts +0 -12
  37. package/src/lib/Apis/models/sub-category.ts +6 -12
  38. package/src/lib/Apis/models/update-product-dto.ts +30 -19
  39. package/src/lib/Apis/models/update-sub-category-dto.ts +6 -0
  40. package/src/lib/Apis/models/{update-product-variant-dto.ts → update-variant-dto.ts} +51 -45
  41. package/src/lib/Apis/models/{shallow-parent-category-dto.ts → variant-id-inventory-body.ts} +5 -11
  42. package/src/lib/api-adapter/config.ts +53 -0
  43. package/src/lib/validations/address.ts +1 -1
  44. package/src/providers/FavoritesProvider.tsx +5 -5
  45. package/src/providers/WishlistProvider.tsx +4 -4
  46. package/src/screens/CartScreen.tsx +1 -1
  47. package/src/screens/ChangePasswordScreen.tsx +2 -6
  48. package/src/screens/CheckoutScreen.tsx +40 -11
  49. package/src/screens/EditProfileScreen.tsx +5 -1
  50. package/src/screens/ForgotPasswordScreen.tsx +153 -0
  51. package/src/screens/ProductDetailScreen.tsx +51 -60
  52. package/src/screens/RegisterScreen.tsx +31 -31
  53. package/src/screens/ResetPasswordScreen.tsx +202 -0
  54. package/src/screens/SearchResultsScreen.tsx +264 -26
  55. package/src/screens/ShopScreen.tsx +42 -45
  56. package/src/screens/WishlistScreen.tsx +35 -31
  57. package/src/lib/Apis/apis/product-variants-api.ts +0 -552
  58. package/src/lib/Apis/models/create-single-variant-product-dto.ts +0 -154
  59. package/src/lib/Apis/models/extended-product-dto.ts +0 -206
  60. package/src/lib/Apis/models/frequently-bought-product-dto.ts +0 -71
  61. package/src/lib/Apis/models/table-dto.ts +0 -34
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import React8, { createContext, forwardRef, useContext, useEffect, useState, useCallback, useRef, useMemo } from 'react';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
- import globalAxios4 from 'axios';
4
+ import globalAxios18 from 'axios';
5
5
  import { motion, AnimatePresence } from 'framer-motion';
6
- import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, Package, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, AlertCircle, Lock, EyeOff, UserPlus, User, Settings, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, ArrowLeft, Mail, LogOut, Menu, Facebook, Twitter, Instagram, Shirt, Pill, Box, ExternalLink, Globe, Home, CheckCircle, Edit, Bell, AlertTriangle, Info, XCircle } from 'lucide-react';
7
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
8
- import { useRouter, useSearchParams } from 'next/navigation';
6
+ import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, Package, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, AlertCircle, Lock, EyeOff, UserPlus, Mail, Send, ArrowLeft, User, Settings, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, LogOut, Menu, Facebook, Twitter, Instagram, Shirt, Pill, Box, ExternalLink, Globe, Home, CheckCircle, Edit, Bell, AlertTriangle, Info, XCircle } from 'lucide-react';
7
+ import { QueryClient, QueryClientProvider, useQuery } from '@tanstack/react-query';
8
+ import { useRouter, useSearchParams, useParams } from 'next/navigation';
9
9
  import Image4 from 'next/image';
10
- import Link7 from 'next/link';
10
+ import Link9 from 'next/link';
11
11
  import dynamic from 'next/dynamic';
12
12
  import { useForm } from 'react-hook-form';
13
13
  import { zodResolver } from '@hookform/resolvers/zod';
@@ -69,6 +69,7 @@ var init_sharedConfig = __esm({
69
69
  // src/lib/api-adapter/config.ts
70
70
  var config_exports = {};
71
71
  __export(config_exports, {
72
+ changePassword: () => changePassword,
72
73
  clearAuthToken: () => clearAuthToken,
73
74
  getApiConfiguration: () => getApiConfiguration,
74
75
  getAuthToken: () => getAuthToken,
@@ -124,6 +125,48 @@ function clearAuthToken() {
124
125
  AXIOS_CONFIG.accessToken = () => "";
125
126
  }
126
127
  }
128
+ async function changePassword(oldPassword, newPassword) {
129
+ if (!currentConfig) {
130
+ throw new Error("API adapter not initialized.");
131
+ }
132
+ const token = getAuthToken();
133
+ if (!token) {
134
+ throw new Error("User is not authenticated");
135
+ }
136
+ const url = `${currentConfig.apiBaseUrl}/auth/change-password`;
137
+ console.log("Change Password Request:", {
138
+ url,
139
+ storeId: currentConfig.storeId,
140
+ hasToken: !!token,
141
+ tokenPrefix: token.substring(0, 20) + "..."
142
+ });
143
+ const response = await fetch(url, {
144
+ method: "POST",
145
+ headers: {
146
+ "Content-Type": "application/json",
147
+ "X-Store-Key": currentConfig.storeId,
148
+ "Authorization": `Bearer ${token}`
149
+ },
150
+ body: JSON.stringify({
151
+ oldPassword,
152
+ newPassword
153
+ })
154
+ });
155
+ console.log("Change Password Response:", {
156
+ status: response.status,
157
+ statusText: response.statusText
158
+ });
159
+ if (!response.ok) {
160
+ const errorData = await response.json().catch(() => ({}));
161
+ console.error("Change Password Error:", errorData);
162
+ throw {
163
+ response: {
164
+ data: errorData,
165
+ status: response.status
166
+ }
167
+ };
168
+ }
169
+ }
127
170
  var apiConfiguration, currentConfig;
128
171
  var init_config = __esm({
129
172
  "src/lib/api-adapter/config.ts"() {
@@ -217,7 +260,7 @@ function ThemeProvider({ config, children }) {
217
260
  init_config();
218
261
  var BASE_PATH = "/".replace(/\/+$/, "");
219
262
  var BaseAPI = class {
220
- constructor(configuration, basePath = BASE_PATH, axios = globalAxios4) {
263
+ constructor(configuration, basePath = BASE_PATH, axios = globalAxios18) {
221
264
  this.basePath = basePath;
222
265
  this.axios = axios;
223
266
  if (configuration) {
@@ -888,7 +931,7 @@ var UsersApiFp = function(configuration) {
888
931
  */
889
932
  async allowUserCredit(body, userId, options) {
890
933
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).allowUserCredit(body, userId, options);
891
- return (axios = globalAxios4, basePath = BASE_PATH) => {
934
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
892
935
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
893
936
  return axios.request(axiosRequestArgs);
894
937
  };
@@ -902,7 +945,7 @@ var UsersApiFp = function(configuration) {
902
945
  */
903
946
  async changeUserEmail(body, options) {
904
947
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).changeUserEmail(body, options);
905
- return (axios = globalAxios4, basePath = BASE_PATH) => {
948
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
906
949
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
907
950
  return axios.request(axiosRequestArgs);
908
951
  };
@@ -916,7 +959,7 @@ var UsersApiFp = function(configuration) {
916
959
  */
917
960
  async createUser(body, options) {
918
961
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).createUser(body, options);
919
- return (axios = globalAxios4, basePath = BASE_PATH) => {
962
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
920
963
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
921
964
  return axios.request(axiosRequestArgs);
922
965
  };
@@ -929,7 +972,7 @@ var UsersApiFp = function(configuration) {
929
972
  */
930
973
  async deleteMyProfile(options) {
931
974
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).deleteMyProfile(options);
932
- return (axios = globalAxios4, basePath = BASE_PATH) => {
975
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
933
976
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
934
977
  return axios.request(axiosRequestArgs);
935
978
  };
@@ -943,7 +986,7 @@ var UsersApiFp = function(configuration) {
943
986
  */
944
987
  async deleteUser(id, options) {
945
988
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).deleteUser(id, options);
946
- return (axios = globalAxios4, basePath = BASE_PATH) => {
989
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
947
990
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
948
991
  return axios.request(axiosRequestArgs);
949
992
  };
@@ -957,7 +1000,7 @@ var UsersApiFp = function(configuration) {
957
1000
  */
958
1001
  async disableUserCredit(userId, options) {
959
1002
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).disableUserCredit(userId, options);
960
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1003
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
961
1004
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
962
1005
  return axios.request(axiosRequestArgs);
963
1006
  };
@@ -978,7 +1021,7 @@ var UsersApiFp = function(configuration) {
978
1021
  */
979
1022
  async getAllUsers(role, sortingOrder, sortingColumn, createdBefore, createdAfter, search, limit, page, options) {
980
1023
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).getAllUsers(role, sortingOrder, sortingColumn, createdBefore, createdAfter, search, limit, page, options);
981
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1024
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
982
1025
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
983
1026
  return axios.request(axiosRequestArgs);
984
1027
  };
@@ -992,7 +1035,7 @@ var UsersApiFp = function(configuration) {
992
1035
  */
993
1036
  async getInsights(groupId, options) {
994
1037
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).getInsights(groupId, options);
995
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1038
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
996
1039
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
997
1040
  return axios.request(axiosRequestArgs);
998
1041
  };
@@ -1005,7 +1048,7 @@ var UsersApiFp = function(configuration) {
1005
1048
  */
1006
1049
  async getMyProfile(options) {
1007
1050
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).getMyProfile(options);
1008
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1051
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1009
1052
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1010
1053
  return axios.request(axiosRequestArgs);
1011
1054
  };
@@ -1019,7 +1062,7 @@ var UsersApiFp = function(configuration) {
1019
1062
  */
1020
1063
  async getSingleUser(id, options) {
1021
1064
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).getSingleUser(id, options);
1022
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1065
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1023
1066
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1024
1067
  return axios.request(axiosRequestArgs);
1025
1068
  };
@@ -1032,7 +1075,7 @@ var UsersApiFp = function(configuration) {
1032
1075
  */
1033
1076
  async sendOTP(options) {
1034
1077
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).sendOTP(options);
1035
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1078
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1036
1079
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1037
1080
  return axios.request(axiosRequestArgs);
1038
1081
  };
@@ -1046,7 +1089,7 @@ var UsersApiFp = function(configuration) {
1046
1089
  */
1047
1090
  async updateMyProfile(body, options) {
1048
1091
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).updateMyProfile(body, options);
1049
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1092
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1050
1093
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1051
1094
  return axios.request(axiosRequestArgs);
1052
1095
  };
@@ -1061,7 +1104,7 @@ var UsersApiFp = function(configuration) {
1061
1104
  */
1062
1105
  async updateUser(body, id, options) {
1063
1106
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).updateUser(body, id, options);
1064
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1107
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1065
1108
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1066
1109
  return axios.request(axiosRequestArgs);
1067
1110
  };
@@ -1074,7 +1117,7 @@ var UsersApiFp = function(configuration) {
1074
1117
  */
1075
1118
  async verifyOTP(options) {
1076
1119
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).verifyOTP(options);
1077
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1120
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1078
1121
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1079
1122
  return axios.request(axiosRequestArgs);
1080
1123
  };
@@ -1289,17 +1332,13 @@ var AuthApiAxiosParamCreator = function(configuration) {
1289
1332
  /**
1290
1333
  *
1291
1334
  * @summary Change user password
1292
- * @param {string} oldPassword
1293
- * @param {string} newPassword
1335
+ * @param {ChangePasswordDto} body
1294
1336
  * @param {*} [options] Override http request option.
1295
1337
  * @throws {RequiredError}
1296
1338
  */
1297
- changePassword: async (oldPassword, newPassword, options = {}) => {
1298
- if (oldPassword === null || oldPassword === void 0) {
1299
- throw new RequiredError("oldPassword", "Required parameter oldPassword was null or undefined when calling changePassword.");
1300
- }
1301
- if (newPassword === null || newPassword === void 0) {
1302
- throw new RequiredError("newPassword", "Required parameter newPassword was null or undefined when calling changePassword.");
1339
+ changePassword: async (body, options = {}) => {
1340
+ if (body === null || body === void 0) {
1341
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling changePassword.");
1303
1342
  }
1304
1343
  const localVarPath = `/auth/change-password`;
1305
1344
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
@@ -1314,12 +1353,7 @@ var AuthApiAxiosParamCreator = function(configuration) {
1314
1353
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
1315
1354
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
1316
1355
  }
1317
- if (oldPassword !== void 0 && oldPassword !== null) {
1318
- localVarHeaderParameter["oldPassword"] = String(oldPassword);
1319
- }
1320
- if (newPassword !== void 0 && newPassword !== null) {
1321
- localVarHeaderParameter["newPassword"] = String(newPassword);
1322
- }
1356
+ localVarHeaderParameter["Content-Type"] = "application/json";
1323
1357
  const query = new URLSearchParams(localVarUrlObj.search);
1324
1358
  for (const key in localVarQueryParameter) {
1325
1359
  query.set(key, localVarQueryParameter[key]);
@@ -1330,6 +1364,8 @@ var AuthApiAxiosParamCreator = function(configuration) {
1330
1364
  localVarUrlObj.search = new URLSearchParams(query).toString();
1331
1365
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1332
1366
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1367
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
1368
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
1333
1369
  return {
1334
1370
  url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
1335
1371
  options: localVarRequestOptions
@@ -1691,7 +1727,7 @@ var AuthApiFp = function(configuration) {
1691
1727
  */
1692
1728
  async changeEmail(body, options) {
1693
1729
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).changeEmail(body, options);
1694
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1730
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1695
1731
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1696
1732
  return axios.request(axiosRequestArgs);
1697
1733
  };
@@ -1699,14 +1735,13 @@ var AuthApiFp = function(configuration) {
1699
1735
  /**
1700
1736
  *
1701
1737
  * @summary Change user password
1702
- * @param {string} oldPassword
1703
- * @param {string} newPassword
1738
+ * @param {ChangePasswordDto} body
1704
1739
  * @param {*} [options] Override http request option.
1705
1740
  * @throws {RequiredError}
1706
1741
  */
1707
- async changePassword(oldPassword, newPassword, options) {
1708
- const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).changePassword(oldPassword, newPassword, options);
1709
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1742
+ async changePassword(body, options) {
1743
+ const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).changePassword(body, options);
1744
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1710
1745
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1711
1746
  return axios.request(axiosRequestArgs);
1712
1747
  };
@@ -1720,7 +1755,7 @@ var AuthApiFp = function(configuration) {
1720
1755
  */
1721
1756
  async dashboardLogin(body, options) {
1722
1757
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).dashboardLogin(body, options);
1723
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1758
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1724
1759
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1725
1760
  return axios.request(axiosRequestArgs);
1726
1761
  };
@@ -1735,7 +1770,7 @@ var AuthApiFp = function(configuration) {
1735
1770
  */
1736
1771
  async resetPassword(newPassword, token, options) {
1737
1772
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).resetPassword(newPassword, token, options);
1738
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1773
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1739
1774
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1740
1775
  return axios.request(axiosRequestArgs);
1741
1776
  };
@@ -1749,7 +1784,7 @@ var AuthApiFp = function(configuration) {
1749
1784
  */
1750
1785
  async sendForgetPasswordEmail(body, options) {
1751
1786
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).sendForgetPasswordEmail(body, options);
1752
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1787
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1753
1788
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1754
1789
  return axios.request(axiosRequestArgs);
1755
1790
  };
@@ -1763,7 +1798,7 @@ var AuthApiFp = function(configuration) {
1763
1798
  */
1764
1799
  async signin(body, options) {
1765
1800
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).signin(body, options);
1766
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1801
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1767
1802
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1768
1803
  return axios.request(axiosRequestArgs);
1769
1804
  };
@@ -1777,7 +1812,7 @@ var AuthApiFp = function(configuration) {
1777
1812
  */
1778
1813
  async signinWithGmail(body, options) {
1779
1814
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).signinWithGmail(body, options);
1780
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1815
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1781
1816
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1782
1817
  return axios.request(axiosRequestArgs);
1783
1818
  };
@@ -1791,7 +1826,7 @@ var AuthApiFp = function(configuration) {
1791
1826
  */
1792
1827
  async signup(body, options) {
1793
1828
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).signup(body, options);
1794
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1829
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1795
1830
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1796
1831
  return axios.request(axiosRequestArgs);
1797
1832
  };
@@ -1805,7 +1840,7 @@ var AuthApiFp = function(configuration) {
1805
1840
  */
1806
1841
  async signupWithGmail(body, options) {
1807
1842
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).signupWithGmail(body, options);
1808
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1843
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1809
1844
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1810
1845
  return axios.request(axiosRequestArgs);
1811
1846
  };
@@ -1819,7 +1854,7 @@ var AuthApiFp = function(configuration) {
1819
1854
  */
1820
1855
  async verifyUserEmail(body, options) {
1821
1856
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).verifyUserEmail(body, options);
1822
- return (axios = globalAxios4, basePath = BASE_PATH) => {
1857
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
1823
1858
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1824
1859
  return axios.request(axiosRequestArgs);
1825
1860
  };
@@ -1841,14 +1876,13 @@ var AuthApi = class extends BaseAPI {
1841
1876
  /**
1842
1877
  *
1843
1878
  * @summary Change user password
1844
- * @param {string} oldPassword
1845
- * @param {string} newPassword
1879
+ * @param {ChangePasswordDto} body
1846
1880
  * @param {*} [options] Override http request option.
1847
1881
  * @throws {RequiredError}
1848
1882
  * @memberof AuthApi
1849
1883
  */
1850
- async changePassword(oldPassword, newPassword, options) {
1851
- return AuthApiFp(this.configuration).changePassword(oldPassword, newPassword, options).then((request) => request(this.axios, this.basePath));
1884
+ async changePassword(body, options) {
1885
+ return AuthApiFp(this.configuration).changePassword(body, options).then((request) => request(this.axios, this.basePath));
1852
1886
  }
1853
1887
  /**
1854
1888
  *
@@ -2740,7 +2774,7 @@ var AddressesApiFp = function(configuration) {
2740
2774
  */
2741
2775
  async adminCreateAddressForUser(body, userId, options) {
2742
2776
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).adminCreateAddressForUser(body, userId, options);
2743
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2777
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2744
2778
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2745
2779
  return axios.request(axiosRequestArgs);
2746
2780
  };
@@ -2754,7 +2788,7 @@ var AddressesApiFp = function(configuration) {
2754
2788
  */
2755
2789
  async adminDeleteUserAddress(addressId, options) {
2756
2790
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).adminDeleteUserAddress(addressId, options);
2757
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2791
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2758
2792
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2759
2793
  return axios.request(axiosRequestArgs);
2760
2794
  };
@@ -2768,7 +2802,7 @@ var AddressesApiFp = function(configuration) {
2768
2802
  */
2769
2803
  async adminGetSingleUserAddresses(userId, options) {
2770
2804
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).adminGetSingleUserAddresses(userId, options);
2771
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2805
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2772
2806
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2773
2807
  return axios.request(axiosRequestArgs);
2774
2808
  };
@@ -2783,7 +2817,7 @@ var AddressesApiFp = function(configuration) {
2783
2817
  */
2784
2818
  async adminUpdateUserAddress(body, addressId, options) {
2785
2819
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).adminUpdateUserAddress(body, addressId, options);
2786
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2820
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2787
2821
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2788
2822
  return axios.request(axiosRequestArgs);
2789
2823
  };
@@ -2797,7 +2831,7 @@ var AddressesApiFp = function(configuration) {
2797
2831
  */
2798
2832
  async createAddressForStore(body, options) {
2799
2833
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).createAddressForStore(body, options);
2800
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2834
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2801
2835
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2802
2836
  return axios.request(axiosRequestArgs);
2803
2837
  };
@@ -2811,7 +2845,7 @@ var AddressesApiFp = function(configuration) {
2811
2845
  */
2812
2846
  async createAddressForUser(body, options) {
2813
2847
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).createAddressForUser(body, options);
2814
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2848
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2815
2849
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2816
2850
  return axios.request(axiosRequestArgs);
2817
2851
  };
@@ -2825,7 +2859,7 @@ var AddressesApiFp = function(configuration) {
2825
2859
  */
2826
2860
  async deleteUserAddress(addressId, options) {
2827
2861
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).deleteUserAddress(addressId, options);
2828
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2862
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2829
2863
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2830
2864
  return axios.request(axiosRequestArgs);
2831
2865
  };
@@ -2839,7 +2873,7 @@ var AddressesApiFp = function(configuration) {
2839
2873
  */
2840
2874
  async getAllStoreAddresses(storeId, options) {
2841
2875
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAllStoreAddresses(storeId, options);
2842
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2876
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2843
2877
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2844
2878
  return axios.request(axiosRequestArgs);
2845
2879
  };
@@ -2852,7 +2886,7 @@ var AddressesApiFp = function(configuration) {
2852
2886
  */
2853
2887
  async getAllUserAddresses(options) {
2854
2888
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAllUserAddresses(options);
2855
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2889
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2856
2890
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2857
2891
  return axios.request(axiosRequestArgs);
2858
2892
  };
@@ -2865,7 +2899,7 @@ var AddressesApiFp = function(configuration) {
2865
2899
  */
2866
2900
  async getMyAddresses(options) {
2867
2901
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getMyAddresses(options);
2868
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2902
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2869
2903
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2870
2904
  return axios.request(axiosRequestArgs);
2871
2905
  };
@@ -2878,7 +2912,7 @@ var AddressesApiFp = function(configuration) {
2878
2912
  */
2879
2913
  async getMyDefaultAddress(options) {
2880
2914
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getMyDefaultAddress(options);
2881
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2915
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2882
2916
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2883
2917
  return axios.request(axiosRequestArgs);
2884
2918
  };
@@ -2892,7 +2926,7 @@ var AddressesApiFp = function(configuration) {
2892
2926
  */
2893
2927
  async getSingleAddress(addressId, options) {
2894
2928
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getSingleAddress(addressId, options);
2895
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2929
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2896
2930
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2897
2931
  return axios.request(axiosRequestArgs);
2898
2932
  };
@@ -2907,7 +2941,7 @@ var AddressesApiFp = function(configuration) {
2907
2941
  */
2908
2942
  async setDefaultShippingAddress(userId, addressId, options) {
2909
2943
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).setDefaultShippingAddress(userId, addressId, options);
2910
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2944
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2911
2945
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2912
2946
  return axios.request(axiosRequestArgs);
2913
2947
  };
@@ -2921,7 +2955,7 @@ var AddressesApiFp = function(configuration) {
2921
2955
  */
2922
2956
  async updateDefaultAddress(addressId, options) {
2923
2957
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).updateDefaultAddress(addressId, options);
2924
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2958
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2925
2959
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2926
2960
  return axios.request(axiosRequestArgs);
2927
2961
  };
@@ -2936,7 +2970,7 @@ var AddressesApiFp = function(configuration) {
2936
2970
  */
2937
2971
  async updateUserAddress(body, addressId, options) {
2938
2972
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).updateUserAddress(body, addressId, options);
2939
- return (axios = globalAxios4, basePath = BASE_PATH) => {
2973
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
2940
2974
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2941
2975
  return axios.request(axiosRequestArgs);
2942
2976
  };
@@ -3318,7 +3352,7 @@ var CartApiFp = function(configuration) {
3318
3352
  */
3319
3353
  async clearCart(options) {
3320
3354
  const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).clearCart(options);
3321
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3355
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3322
3356
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3323
3357
  return axios.request(axiosRequestArgs);
3324
3358
  };
@@ -3332,7 +3366,7 @@ var CartApiFp = function(configuration) {
3332
3366
  */
3333
3367
  async getUserCart(rateId, options) {
3334
3368
  const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).getUserCart(rateId, options);
3335
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3369
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3336
3370
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3337
3371
  return axios.request(axiosRequestArgs);
3338
3372
  };
@@ -3346,7 +3380,7 @@ var CartApiFp = function(configuration) {
3346
3380
  */
3347
3381
  async handleUserCart(body, options) {
3348
3382
  const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).handleUserCart(body, options);
3349
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3383
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3350
3384
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3351
3385
  return axios.request(axiosRequestArgs);
3352
3386
  };
@@ -3364,7 +3398,7 @@ var CartApiFp = function(configuration) {
3364
3398
  */
3365
3399
  async handleVisitorCart(body, isDelivery, userId, rateId, addressId, options) {
3366
3400
  const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).handleVisitorCart(body, isDelivery, userId, rateId, addressId, options);
3367
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3401
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3368
3402
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3369
3403
  return axios.request(axiosRequestArgs);
3370
3404
  };
@@ -3750,7 +3784,7 @@ var CategoriesApiFp = function(configuration) {
3750
3784
  */
3751
3785
  async createCategory(body, options) {
3752
3786
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).createCategory(body, options);
3753
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3787
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3754
3788
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3755
3789
  return axios.request(axiosRequestArgs);
3756
3790
  };
@@ -3764,7 +3798,7 @@ var CategoriesApiFp = function(configuration) {
3764
3798
  */
3765
3799
  async deleteCategory(id, options) {
3766
3800
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).deleteCategory(id, options);
3767
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3801
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3768
3802
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3769
3803
  return axios.request(axiosRequestArgs);
3770
3804
  };
@@ -3780,7 +3814,7 @@ var CategoriesApiFp = function(configuration) {
3780
3814
  */
3781
3815
  async getAllCategories(search, limit, page, options) {
3782
3816
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).getAllCategories(search, limit, page, options);
3783
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3817
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3784
3818
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3785
3819
  return axios.request(axiosRequestArgs);
3786
3820
  };
@@ -3793,7 +3827,7 @@ var CategoriesApiFp = function(configuration) {
3793
3827
  */
3794
3828
  async getCategoreisAndSubCategories(options) {
3795
3829
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).getCategoreisAndSubCategories(options);
3796
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3830
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3797
3831
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3798
3832
  return axios.request(axiosRequestArgs);
3799
3833
  };
@@ -3807,7 +3841,7 @@ var CategoriesApiFp = function(configuration) {
3807
3841
  */
3808
3842
  async getCategoryFilters(id, options) {
3809
3843
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).getCategoryFilters(id, options);
3810
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3844
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3811
3845
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3812
3846
  return axios.request(axiosRequestArgs);
3813
3847
  };
@@ -3821,7 +3855,7 @@ var CategoriesApiFp = function(configuration) {
3821
3855
  */
3822
3856
  async getSingleCategory(id, options) {
3823
3857
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).getSingleCategory(id, options);
3824
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3858
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3825
3859
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3826
3860
  return axios.request(axiosRequestArgs);
3827
3861
  };
@@ -3836,7 +3870,7 @@ var CategoriesApiFp = function(configuration) {
3836
3870
  */
3837
3871
  async updateCategory(body, id, options) {
3838
3872
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).updateCategory(body, id, options);
3839
- return (axios = globalAxios4, basePath = BASE_PATH) => {
3873
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
3840
3874
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3841
3875
  return axios.request(axiosRequestArgs);
3842
3876
  };
@@ -4554,7 +4588,7 @@ var OrdersApiFp = function(configuration) {
4554
4588
  */
4555
4589
  async assignPaymentMethod(orderId, paymentMethod, billingAddressId, options) {
4556
4590
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).assignPaymentMethod(orderId, paymentMethod, billingAddressId, options);
4557
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4591
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4558
4592
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4559
4593
  return axios.request(axiosRequestArgs);
4560
4594
  };
@@ -4568,7 +4602,7 @@ var OrdersApiFp = function(configuration) {
4568
4602
  */
4569
4603
  async cancelOrder(id, options) {
4570
4604
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).cancelOrder(id, options);
4571
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4605
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4572
4606
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4573
4607
  return axios.request(axiosRequestArgs);
4574
4608
  };
@@ -4586,7 +4620,7 @@ var OrdersApiFp = function(configuration) {
4586
4620
  */
4587
4621
  async createCheckout(body, isDelivery, userId, rateId, billingAddressId, options) {
4588
4622
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).createCheckout(body, isDelivery, userId, rateId, billingAddressId, options);
4589
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4623
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4590
4624
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4591
4625
  return axios.request(axiosRequestArgs);
4592
4626
  };
@@ -4600,7 +4634,7 @@ var OrdersApiFp = function(configuration) {
4600
4634
  */
4601
4635
  async deleteOrder(id, options) {
4602
4636
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).deleteOrder(id, options);
4603
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4637
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4604
4638
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4605
4639
  return axios.request(axiosRequestArgs);
4606
4640
  };
@@ -4621,7 +4655,7 @@ var OrdersApiFp = function(configuration) {
4621
4655
  */
4622
4656
  async getAllOrders(paymentStatus, orderStatus, page, limit, search, createdAfter, createdBefore, userId, options) {
4623
4657
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).getAllOrders(paymentStatus, orderStatus, page, limit, search, createdAfter, createdBefore, userId, options);
4624
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4658
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4625
4659
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4626
4660
  return axios.request(axiosRequestArgs);
4627
4661
  };
@@ -4635,7 +4669,7 @@ var OrdersApiFp = function(configuration) {
4635
4669
  */
4636
4670
  async getSingleOrder(id, options) {
4637
4671
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).getSingleOrder(id, options);
4638
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4672
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4639
4673
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4640
4674
  return axios.request(axiosRequestArgs);
4641
4675
  };
@@ -4648,7 +4682,7 @@ var OrdersApiFp = function(configuration) {
4648
4682
  */
4649
4683
  async getStoreOrderInsights(options) {
4650
4684
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).getStoreOrderInsights(options);
4651
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4685
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4652
4686
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4653
4687
  return axios.request(axiosRequestArgs);
4654
4688
  };
@@ -4661,7 +4695,7 @@ var OrdersApiFp = function(configuration) {
4661
4695
  */
4662
4696
  async getUserOrders(options) {
4663
4697
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).getUserOrders(options);
4664
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4698
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4665
4699
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4666
4700
  return axios.request(axiosRequestArgs);
4667
4701
  };
@@ -4675,7 +4709,7 @@ var OrdersApiFp = function(configuration) {
4675
4709
  */
4676
4710
  async payOrder(orderId, options) {
4677
4711
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).payOrder(orderId, options);
4678
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4712
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4679
4713
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4680
4714
  return axios.request(axiosRequestArgs);
4681
4715
  };
@@ -4689,7 +4723,7 @@ var OrdersApiFp = function(configuration) {
4689
4723
  */
4690
4724
  async sendOrderEmail(body, options) {
4691
4725
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).sendOrderEmail(body, options);
4692
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4726
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4693
4727
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4694
4728
  return axios.request(axiosRequestArgs);
4695
4729
  };
@@ -4710,7 +4744,7 @@ var OrdersApiFp = function(configuration) {
4710
4744
  */
4711
4745
  async updateOrder(body, isDelivery, id, paymentMethod, userId, rateId, addressId, billingAddressId, options) {
4712
4746
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).updateOrder(body, isDelivery, id, paymentMethod, userId, rateId, addressId, billingAddressId, options);
4713
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4747
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4714
4748
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4715
4749
  return axios.request(axiosRequestArgs);
4716
4750
  };
@@ -4725,7 +4759,7 @@ var OrdersApiFp = function(configuration) {
4725
4759
  */
4726
4760
  async updateOrderStatus(id, orderStatus, options) {
4727
4761
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).updateOrderStatus(id, orderStatus, options);
4728
- return (axios = globalAxios4, basePath = BASE_PATH) => {
4762
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
4729
4763
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4730
4764
  return axios.request(axiosRequestArgs);
4731
4765
  };
@@ -4889,7 +4923,57 @@ var ProductsApiAxiosParamCreator = function(configuration) {
4889
4923
  return {
4890
4924
  /**
4891
4925
  *
4892
- * @summary Create a product
4926
+ * @summary Add a new variant to a product
4927
+ * @param {CreateVariantDto} body
4928
+ * @param {string} productId Product ID
4929
+ * @param {*} [options] Override http request option.
4930
+ * @throws {RequiredError}
4931
+ */
4932
+ addVariant: async (body, productId, options = {}) => {
4933
+ if (body === null || body === void 0) {
4934
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling addVariant.");
4935
+ }
4936
+ if (productId === null || productId === void 0) {
4937
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling addVariant.");
4938
+ }
4939
+ const localVarPath = `/products/{productId}/variants`.replace(`{${"productId"}}`, encodeURIComponent(String(productId)));
4940
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
4941
+ let baseOptions;
4942
+ if (configuration) {
4943
+ baseOptions = configuration.baseOptions;
4944
+ }
4945
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
4946
+ const localVarHeaderParameter = {};
4947
+ const localVarQueryParameter = {};
4948
+ if (configuration && configuration.accessToken) {
4949
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
4950
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
4951
+ }
4952
+ if (configuration && configuration.apiKey) {
4953
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
4954
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
4955
+ }
4956
+ localVarHeaderParameter["Content-Type"] = "application/json";
4957
+ const query = new URLSearchParams(localVarUrlObj.search);
4958
+ for (const key in localVarQueryParameter) {
4959
+ query.set(key, localVarQueryParameter[key]);
4960
+ }
4961
+ for (const key in options.params) {
4962
+ query.set(key, options.params[key]);
4963
+ }
4964
+ localVarUrlObj.search = new URLSearchParams(query).toString();
4965
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
4966
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
4967
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
4968
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
4969
+ return {
4970
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
4971
+ options: localVarRequestOptions
4972
+ };
4973
+ },
4974
+ /**
4975
+ *
4976
+ * @summary Create a new product with variants
4893
4977
  * @param {CreateProductDto} body
4894
4978
  * @param {*} [options] Override http request option.
4895
4979
  * @throws {RequiredError}
@@ -4898,7 +4982,7 @@ var ProductsApiAxiosParamCreator = function(configuration) {
4898
4982
  if (body === null || body === void 0) {
4899
4983
  throw new RequiredError("body", "Required parameter body was null or undefined when calling createProduct.");
4900
4984
  }
4901
- const localVarPath = `/products/create`;
4985
+ const localVarPath = `/products`;
4902
4986
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
4903
4987
  let baseOptions;
4904
4988
  if (configuration) {
@@ -4935,16 +5019,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
4935
5019
  },
4936
5020
  /**
4937
5021
  *
4938
- * @summary Create a Product that has a single variant
4939
- * @param {CreateSingleVariantProductDTO} body
5022
+ * @summary [DEPRECATED] Use POST /products instead
5023
+ * @param {CreateProductDto} body
4940
5024
  * @param {*} [options] Override http request option.
4941
5025
  * @throws {RequiredError}
4942
5026
  */
4943
- createSingleVariantProduct: async (body, options = {}) => {
5027
+ createProductLegacy: async (body, options = {}) => {
4944
5028
  if (body === null || body === void 0) {
4945
- throw new RequiredError("body", "Required parameter body was null or undefined when calling createSingleVariantProduct.");
5029
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling createProductLegacy.");
4946
5030
  }
4947
- const localVarPath = `/products/create-single-variant`;
5031
+ const localVarPath = `/products/create`;
4948
5032
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
4949
5033
  let baseOptions;
4950
5034
  if (configuration) {
@@ -4981,8 +5065,8 @@ var ProductsApiAxiosParamCreator = function(configuration) {
4981
5065
  },
4982
5066
  /**
4983
5067
  *
4984
- * @summary Delete a product
4985
- * @param {string} id
5068
+ * @summary Delete a product and all its variants
5069
+ * @param {string} id Product ID
4986
5070
  * @param {*} [options] Override http request option.
4987
5071
  * @throws {RequiredError}
4988
5072
  */
@@ -5024,32 +5108,26 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5024
5108
  },
5025
5109
  /**
5026
5110
  *
5027
- * @summary Get all products of a specific category
5028
- * @param {string} categoryId Category ID
5029
- * @param {string} [searchTerm] OpenAI Search Query
5030
- * @param {number} [maxPrice] highest price to filter with
5031
- * @param {number} [minPrice] lowest price to filter with
5032
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5033
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5034
- * @param {string} [sort] specifies which attribute to sort with
5035
- * @param {boolean} [includeNoVariantProducts]
5036
- * @param {boolean} [isActive]
5037
- * @param {number} [limit]
5038
- * @param {number} [page]
5111
+ * @summary Delete a variant from a product
5112
+ * @param {string} productId Product ID
5113
+ * @param {string} variantId Variant ID
5039
5114
  * @param {*} [options] Override http request option.
5040
5115
  * @throws {RequiredError}
5041
5116
  */
5042
- getAllCategoryProducts: async (categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options = {}) => {
5043
- if (categoryId === null || categoryId === void 0) {
5044
- throw new RequiredError("categoryId", "Required parameter categoryId was null or undefined when calling getAllCategoryProducts.");
5117
+ deleteVariant: async (productId, variantId, options = {}) => {
5118
+ if (productId === null || productId === void 0) {
5119
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling deleteVariant.");
5045
5120
  }
5046
- const localVarPath = `/products/allCategoryProducts/{categoryId}`.replace(`{${"categoryId"}}`, encodeURIComponent(String(categoryId)));
5121
+ if (variantId === null || variantId === void 0) {
5122
+ throw new RequiredError("variantId", "Required parameter variantId was null or undefined when calling deleteVariant.");
5123
+ }
5124
+ const localVarPath = `/products/{productId}/variants/{variantId}`.replace(`{${"productId"}}`, encodeURIComponent(String(productId))).replace(`{${"variantId"}}`, encodeURIComponent(String(variantId)));
5047
5125
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5048
5126
  let baseOptions;
5049
5127
  if (configuration) {
5050
5128
  baseOptions = configuration.baseOptions;
5051
5129
  }
5052
- const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
5130
+ const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
5053
5131
  const localVarHeaderParameter = {};
5054
5132
  const localVarQueryParameter = {};
5055
5133
  if (configuration && configuration.accessToken) {
@@ -5060,35 +5138,48 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5060
5138
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5061
5139
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5062
5140
  }
5063
- if (searchTerm !== void 0) {
5064
- localVarQueryParameter["searchTerm"] = searchTerm;
5065
- }
5066
- if (maxPrice !== void 0) {
5067
- localVarQueryParameter["maxPrice"] = maxPrice;
5068
- }
5069
- if (minPrice !== void 0) {
5070
- localVarQueryParameter["minPrice"] = minPrice;
5071
- }
5072
- if (brandFilter !== void 0) {
5073
- localVarQueryParameter["brandFilter"] = brandFilter;
5074
- }
5075
- if (availability !== void 0) {
5076
- localVarQueryParameter["availability"] = availability;
5141
+ const query = new URLSearchParams(localVarUrlObj.search);
5142
+ for (const key in localVarQueryParameter) {
5143
+ query.set(key, localVarQueryParameter[key]);
5077
5144
  }
5078
- if (sort !== void 0) {
5079
- localVarQueryParameter["sort"] = sort;
5145
+ for (const key in options.params) {
5146
+ query.set(key, options.params[key]);
5080
5147
  }
5081
- if (includeNoVariantProducts !== void 0) {
5082
- localVarQueryParameter["includeNoVariantProducts"] = includeNoVariantProducts;
5148
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5149
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5150
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5151
+ return {
5152
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5153
+ options: localVarRequestOptions
5154
+ };
5155
+ },
5156
+ /**
5157
+ *
5158
+ * @summary [DEPRECATED] Use GET /products/all?categoryId=:id instead
5159
+ * @param {string} categoryId
5160
+ * @param {*} [options] Override http request option.
5161
+ * @throws {RequiredError}
5162
+ */
5163
+ getAllCategoryProducts: async (categoryId, options = {}) => {
5164
+ if (categoryId === null || categoryId === void 0) {
5165
+ throw new RequiredError("categoryId", "Required parameter categoryId was null or undefined when calling getAllCategoryProducts.");
5083
5166
  }
5084
- if (isActive !== void 0) {
5085
- localVarQueryParameter["isActive"] = isActive;
5167
+ const localVarPath = `/products/allCategoryProducts/{categoryId}`.replace(`{${"categoryId"}}`, encodeURIComponent(String(categoryId)));
5168
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5169
+ let baseOptions;
5170
+ if (configuration) {
5171
+ baseOptions = configuration.baseOptions;
5086
5172
  }
5087
- if (limit !== void 0) {
5088
- localVarQueryParameter["limit"] = limit;
5173
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
5174
+ const localVarHeaderParameter = {};
5175
+ const localVarQueryParameter = {};
5176
+ if (configuration && configuration.accessToken) {
5177
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5178
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5089
5179
  }
5090
- if (page !== void 0) {
5091
- localVarQueryParameter["page"] = page;
5180
+ if (configuration && configuration.apiKey) {
5181
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5182
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5092
5183
  }
5093
5184
  const query = new URLSearchParams(localVarUrlObj.search);
5094
5185
  for (const key in localVarQueryParameter) {
@@ -5107,12 +5198,12 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5107
5198
  },
5108
5199
  /**
5109
5200
  *
5110
- * @summary Get all filters for products
5201
+ * @summary Get all available filters (brands, price range)
5111
5202
  * @param {*} [options] Override http request option.
5112
5203
  * @throws {RequiredError}
5113
5204
  */
5114
5205
  getAllFilters: async (options = {}) => {
5115
- const localVarPath = `/products/allFilters`;
5206
+ const localVarPath = `/products/filters`;
5116
5207
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5117
5208
  let baseOptions;
5118
5209
  if (configuration) {
@@ -5146,26 +5237,23 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5146
5237
  },
5147
5238
  /**
5148
5239
  *
5149
- * @summary Get all products of a specific sub category
5150
- * @param {string} subCategoryId Sub Category ID
5151
- * @param {string} [searchTerm] OpenAI Search Query
5152
- * @param {number} [maxPrice] highest price to filter with
5153
- * @param {number} [minPrice] lowest price to filter with
5154
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5155
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5156
- * @param {string} [sort] specifies which attribute to sort with
5157
- * @param {boolean} [includeNoVariantProducts]
5240
+ * @summary Get all products with filtering and pagination
5241
+ * @param {string} [searchTerm]
5242
+ * @param {number} [maxPrice]
5243
+ * @param {number} [minPrice]
5244
+ * @param {string} [brandFilter] Comma-separated brand names
5245
+ * @param {string} [availability]
5246
+ * @param {string} [sort]
5247
+ * @param {string} [subCategoryId]
5248
+ * @param {string} [categoryId]
5158
5249
  * @param {boolean} [isActive]
5159
5250
  * @param {number} [limit]
5160
5251
  * @param {number} [page]
5161
5252
  * @param {*} [options] Override http request option.
5162
5253
  * @throws {RequiredError}
5163
5254
  */
5164
- getAllProducts: async (subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options = {}) => {
5165
- if (subCategoryId === null || subCategoryId === void 0) {
5166
- throw new RequiredError("subCategoryId", "Required parameter subCategoryId was null or undefined when calling getAllProducts.");
5167
- }
5168
- const localVarPath = `/products/allProducts/{subCategoryId}`.replace(`{${"subCategoryId"}}`, encodeURIComponent(String(subCategoryId)));
5255
+ getAllProducts: async (searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options = {}) => {
5256
+ const localVarPath = `/products/all`;
5169
5257
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5170
5258
  let baseOptions;
5171
5259
  if (configuration) {
@@ -5200,8 +5288,11 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5200
5288
  if (sort !== void 0) {
5201
5289
  localVarQueryParameter["sort"] = sort;
5202
5290
  }
5203
- if (includeNoVariantProducts !== void 0) {
5204
- localVarQueryParameter["includeNoVariantProducts"] = includeNoVariantProducts;
5291
+ if (subCategoryId !== void 0) {
5292
+ localVarQueryParameter["subCategoryId"] = subCategoryId;
5293
+ }
5294
+ if (categoryId !== void 0) {
5295
+ localVarQueryParameter["categoryId"] = categoryId;
5205
5296
  }
5206
5297
  if (isActive !== void 0) {
5207
5298
  localVarQueryParameter["isActive"] = isActive;
@@ -5229,24 +5320,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5229
5320
  },
5230
5321
  /**
5231
5322
  *
5232
- * @summary Get all products
5233
- * @param {string} [searchTerm] OpenAI Search Query
5234
- * @param {string} [productType] Product Type
5235
- * @param {string} [categoryId] Category ID
5236
- * @param {number} [maxPrice] highest price to filter with
5237
- * @param {number} [minPrice] lowest price to filter with
5238
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5239
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5240
- * @param {string} [sort] specifies which attribute to sort with
5241
- * @param {boolean} [includeNoVariantProducts]
5242
- * @param {boolean} [isActive]
5243
- * @param {number} [limit]
5244
- * @param {number} [page]
5323
+ * @summary [DEPRECATED] Use GET /products/all?subCategoryId=:id instead
5324
+ * @param {string} subCategoryId
5245
5325
  * @param {*} [options] Override http request option.
5246
5326
  * @throws {RequiredError}
5247
5327
  */
5248
- getAllProductsForStore: async (searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options = {}) => {
5249
- const localVarPath = `/products/all`;
5328
+ getAllProductsBySubCategory: async (subCategoryId, options = {}) => {
5329
+ if (subCategoryId === null || subCategoryId === void 0) {
5330
+ throw new RequiredError("subCategoryId", "Required parameter subCategoryId was null or undefined when calling getAllProductsBySubCategory.");
5331
+ }
5332
+ const localVarPath = `/products/allProducts/{subCategoryId}`.replace(`{${"subCategoryId"}}`, encodeURIComponent(String(subCategoryId)));
5250
5333
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5251
5334
  let baseOptions;
5252
5335
  if (configuration) {
@@ -5263,42 +5346,6 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5263
5346
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5264
5347
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5265
5348
  }
5266
- if (searchTerm !== void 0) {
5267
- localVarQueryParameter["searchTerm"] = searchTerm;
5268
- }
5269
- if (productType !== void 0) {
5270
- localVarQueryParameter["productType"] = productType;
5271
- }
5272
- if (categoryId !== void 0) {
5273
- localVarQueryParameter["categoryId"] = categoryId;
5274
- }
5275
- if (maxPrice !== void 0) {
5276
- localVarQueryParameter["maxPrice"] = maxPrice;
5277
- }
5278
- if (minPrice !== void 0) {
5279
- localVarQueryParameter["minPrice"] = minPrice;
5280
- }
5281
- if (brandFilter !== void 0) {
5282
- localVarQueryParameter["brandFilter"] = brandFilter;
5283
- }
5284
- if (availability !== void 0) {
5285
- localVarQueryParameter["availability"] = availability;
5286
- }
5287
- if (sort !== void 0) {
5288
- localVarQueryParameter["sort"] = sort;
5289
- }
5290
- if (includeNoVariantProducts !== void 0) {
5291
- localVarQueryParameter["includeNoVariantProducts"] = includeNoVariantProducts;
5292
- }
5293
- if (isActive !== void 0) {
5294
- localVarQueryParameter["isActive"] = isActive;
5295
- }
5296
- if (limit !== void 0) {
5297
- localVarQueryParameter["limit"] = limit;
5298
- }
5299
- if (page !== void 0) {
5300
- localVarQueryParameter["page"] = page;
5301
- }
5302
5349
  const query = new URLSearchParams(localVarUrlObj.search);
5303
5350
  for (const key in localVarQueryParameter) {
5304
5351
  query.set(key, localVarQueryParameter[key]);
@@ -5355,7 +5402,7 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5355
5402
  },
5356
5403
  /**
5357
5404
  *
5358
- * @summary Get insights on store Products
5405
+ * @summary Get product insights for the store
5359
5406
  * @param {*} [options] Override http request option.
5360
5407
  * @throws {RequiredError}
5361
5408
  */
@@ -5395,15 +5442,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5395
5442
  /**
5396
5443
  *
5397
5444
  * @summary Get related products
5398
- * @param {string} productId Product ID
5445
+ * @param {string} id Product ID
5446
+ * @param {number} [limit]
5399
5447
  * @param {*} [options] Override http request option.
5400
5448
  * @throws {RequiredError}
5401
5449
  */
5402
- getRelatedProducts: async (productId, options = {}) => {
5403
- if (productId === null || productId === void 0) {
5404
- throw new RequiredError("productId", "Required parameter productId was null or undefined when calling getRelatedProducts.");
5450
+ getRelatedProducts: async (id, limit, options = {}) => {
5451
+ if (id === null || id === void 0) {
5452
+ throw new RequiredError("id", "Required parameter id was null or undefined when calling getRelatedProducts.");
5405
5453
  }
5406
- const localVarPath = `/products/relatedProducts/{productId}`.replace(`{${"productId"}}`, encodeURIComponent(String(productId)));
5454
+ const localVarPath = `/products/{id}/related`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5407
5455
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5408
5456
  let baseOptions;
5409
5457
  if (configuration) {
@@ -5420,6 +5468,9 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5420
5468
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5421
5469
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5422
5470
  }
5471
+ if (limit !== void 0) {
5472
+ localVarQueryParameter["limit"] = limit;
5473
+ }
5423
5474
  const query = new URLSearchParams(localVarUrlObj.search);
5424
5475
  for (const key in localVarQueryParameter) {
5425
5476
  query.set(key, localVarQueryParameter[key]);
@@ -5437,16 +5488,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5437
5488
  },
5438
5489
  /**
5439
5490
  *
5440
- * @summary Get a single product
5441
- * @param {string} id Product ID
5491
+ * @summary [DEPRECATED] Use GET /products/:id/related instead
5492
+ * @param {string} productId
5442
5493
  * @param {*} [options] Override http request option.
5443
5494
  * @throws {RequiredError}
5444
5495
  */
5445
- getSingleProduct: async (id, options = {}) => {
5446
- if (id === null || id === void 0) {
5447
- throw new RequiredError("id", "Required parameter id was null or undefined when calling getSingleProduct.");
5496
+ getRelatedProductsLegacy: async (productId, options = {}) => {
5497
+ if (productId === null || productId === void 0) {
5498
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling getRelatedProductsLegacy.");
5448
5499
  }
5449
- const localVarPath = `/products/singleProduct/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5500
+ const localVarPath = `/products/relatedProducts/{productId}`.replace(`{${"productId"}}`, encodeURIComponent(String(productId)));
5450
5501
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5451
5502
  let baseOptions;
5452
5503
  if (configuration) {
@@ -5480,16 +5531,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5480
5531
  },
5481
5532
  /**
5482
5533
  *
5483
- * @summary Get top selling products
5484
- * @param {number} [limit]
5485
- * @param {number} [page]
5486
- * @param {boolean} [isActive]
5487
- * @param {boolean} [includeNoVariantProducts]
5534
+ * @summary Get a single product with all details
5535
+ * @param {string} id Product ID
5488
5536
  * @param {*} [options] Override http request option.
5489
5537
  * @throws {RequiredError}
5490
5538
  */
5491
- getTopSellingProducts: async (limit, page, isActive, includeNoVariantProducts, options = {}) => {
5492
- const localVarPath = `/products/top-selling`;
5539
+ getSingleProduct: async (id, options = {}) => {
5540
+ if (id === null || id === void 0) {
5541
+ throw new RequiredError("id", "Required parameter id was null or undefined when calling getSingleProduct.");
5542
+ }
5543
+ const localVarPath = `/products/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5493
5544
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5494
5545
  let baseOptions;
5495
5546
  if (configuration) {
@@ -5506,18 +5557,6 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5506
5557
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5507
5558
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5508
5559
  }
5509
- if (limit !== void 0) {
5510
- localVarQueryParameter["limit"] = limit;
5511
- }
5512
- if (page !== void 0) {
5513
- localVarQueryParameter["page"] = page;
5514
- }
5515
- if (isActive !== void 0) {
5516
- localVarQueryParameter["isActive"] = isActive;
5517
- }
5518
- if (includeNoVariantProducts !== void 0) {
5519
- localVarQueryParameter["includeNoVariantProducts"] = includeNoVariantProducts;
5520
- }
5521
5560
  const query = new URLSearchParams(localVarUrlObj.search);
5522
5561
  for (const key in localVarQueryParameter) {
5523
5562
  query.set(key, localVarQueryParameter[key]);
@@ -5535,26 +5574,22 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5535
5574
  },
5536
5575
  /**
5537
5576
  *
5538
- * @summary Update a product
5539
- * @param {UpdateProductDto} body
5577
+ * @summary [DEPRECATED] Use GET /products/:id instead
5540
5578
  * @param {string} id Product ID
5541
5579
  * @param {*} [options] Override http request option.
5542
5580
  * @throws {RequiredError}
5543
5581
  */
5544
- updateProduct: async (body, id, options = {}) => {
5545
- if (body === null || body === void 0) {
5546
- throw new RequiredError("body", "Required parameter body was null or undefined when calling updateProduct.");
5547
- }
5582
+ getSingleProductLegacy: async (id, options = {}) => {
5548
5583
  if (id === null || id === void 0) {
5549
- throw new RequiredError("id", "Required parameter id was null or undefined when calling updateProduct.");
5584
+ throw new RequiredError("id", "Required parameter id was null or undefined when calling getSingleProductLegacy.");
5550
5585
  }
5551
- const localVarPath = `/products/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5586
+ const localVarPath = `/products/singleProduct/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5552
5587
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5553
5588
  let baseOptions;
5554
5589
  if (configuration) {
5555
5590
  baseOptions = configuration.baseOptions;
5556
5591
  }
5557
- const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
5592
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
5558
5593
  const localVarHeaderParameter = {};
5559
5594
  const localVarQueryParameter = {};
5560
5595
  if (configuration && configuration.accessToken) {
@@ -5565,7 +5600,6 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5565
5600
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5566
5601
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5567
5602
  }
5568
- localVarHeaderParameter["Content-Type"] = "application/json";
5569
5603
  const query = new URLSearchParams(localVarUrlObj.search);
5570
5604
  for (const key in localVarQueryParameter) {
5571
5605
  query.set(key, localVarQueryParameter[key]);
@@ -5576,141 +5610,353 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5576
5610
  localVarUrlObj.search = new URLSearchParams(query).toString();
5577
5611
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5578
5612
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5579
- const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
5580
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
5581
5613
  return {
5582
5614
  url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5583
5615
  options: localVarRequestOptions
5584
5616
  };
5585
- }
5586
- };
5587
- };
5588
- var ProductsApiFp = function(configuration) {
5589
- return {
5590
- /**
5591
- *
5592
- * @summary Create a product
5593
- * @param {CreateProductDto} body
5594
- * @param {*} [options] Override http request option.
5595
- * @throws {RequiredError}
5596
- */
5597
- async createProduct(body, options) {
5598
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).createProduct(body, options);
5599
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5600
- const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5601
- return axios.request(axiosRequestArgs);
5602
- };
5603
5617
  },
5604
5618
  /**
5605
5619
  *
5606
- * @summary Create a Product that has a single variant
5607
- * @param {CreateSingleVariantProductDTO} body
5620
+ * @summary Get top selling products
5621
+ * @param {number} [limit]
5622
+ * @param {number} [page]
5608
5623
  * @param {*} [options] Override http request option.
5609
5624
  * @throws {RequiredError}
5610
5625
  */
5611
- async createSingleVariantProduct(body, options) {
5612
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).createSingleVariantProduct(body, options);
5613
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5626
+ getTopSellingProducts: async (limit, page, options = {}) => {
5627
+ const localVarPath = `/products/top-selling`;
5628
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5629
+ let baseOptions;
5630
+ if (configuration) {
5631
+ baseOptions = configuration.baseOptions;
5632
+ }
5633
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
5634
+ const localVarHeaderParameter = {};
5635
+ const localVarQueryParameter = {};
5636
+ if (configuration && configuration.accessToken) {
5637
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5638
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5639
+ }
5640
+ if (configuration && configuration.apiKey) {
5641
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5642
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5643
+ }
5644
+ if (limit !== void 0) {
5645
+ localVarQueryParameter["limit"] = limit;
5646
+ }
5647
+ if (page !== void 0) {
5648
+ localVarQueryParameter["page"] = page;
5649
+ }
5650
+ const query = new URLSearchParams(localVarUrlObj.search);
5651
+ for (const key in localVarQueryParameter) {
5652
+ query.set(key, localVarQueryParameter[key]);
5653
+ }
5654
+ for (const key in options.params) {
5655
+ query.set(key, options.params[key]);
5656
+ }
5657
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5658
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5659
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5660
+ return {
5661
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5662
+ options: localVarRequestOptions
5663
+ };
5664
+ },
5665
+ /**
5666
+ *
5667
+ * @summary Update variant inventory (add or subtract)
5668
+ * @param {VariantIdInventoryBody} body
5669
+ * @param {string} productId Product ID
5670
+ * @param {string} variantId Variant ID
5671
+ * @param {*} [options] Override http request option.
5672
+ * @throws {RequiredError}
5673
+ */
5674
+ updateInventory: async (body, productId, variantId, options = {}) => {
5675
+ if (body === null || body === void 0) {
5676
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling updateInventory.");
5677
+ }
5678
+ if (productId === null || productId === void 0) {
5679
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling updateInventory.");
5680
+ }
5681
+ if (variantId === null || variantId === void 0) {
5682
+ throw new RequiredError("variantId", "Required parameter variantId was null or undefined when calling updateInventory.");
5683
+ }
5684
+ const localVarPath = `/products/{productId}/variants/{variantId}/inventory`.replace(`{${"productId"}}`, encodeURIComponent(String(productId))).replace(`{${"variantId"}}`, encodeURIComponent(String(variantId)));
5685
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5686
+ let baseOptions;
5687
+ if (configuration) {
5688
+ baseOptions = configuration.baseOptions;
5689
+ }
5690
+ const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
5691
+ const localVarHeaderParameter = {};
5692
+ const localVarQueryParameter = {};
5693
+ if (configuration && configuration.accessToken) {
5694
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5695
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5696
+ }
5697
+ if (configuration && configuration.apiKey) {
5698
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5699
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5700
+ }
5701
+ localVarHeaderParameter["Content-Type"] = "application/json";
5702
+ const query = new URLSearchParams(localVarUrlObj.search);
5703
+ for (const key in localVarQueryParameter) {
5704
+ query.set(key, localVarQueryParameter[key]);
5705
+ }
5706
+ for (const key in options.params) {
5707
+ query.set(key, options.params[key]);
5708
+ }
5709
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5710
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5711
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5712
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
5713
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
5714
+ return {
5715
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5716
+ options: localVarRequestOptions
5717
+ };
5718
+ },
5719
+ /**
5720
+ *
5721
+ * @summary Update a product (not variants)
5722
+ * @param {UpdateProductDto} body
5723
+ * @param {string} id Product ID
5724
+ * @param {*} [options] Override http request option.
5725
+ * @throws {RequiredError}
5726
+ */
5727
+ updateProduct: async (body, id, options = {}) => {
5728
+ if (body === null || body === void 0) {
5729
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling updateProduct.");
5730
+ }
5731
+ if (id === null || id === void 0) {
5732
+ throw new RequiredError("id", "Required parameter id was null or undefined when calling updateProduct.");
5733
+ }
5734
+ const localVarPath = `/products/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5735
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5736
+ let baseOptions;
5737
+ if (configuration) {
5738
+ baseOptions = configuration.baseOptions;
5739
+ }
5740
+ const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
5741
+ const localVarHeaderParameter = {};
5742
+ const localVarQueryParameter = {};
5743
+ if (configuration && configuration.accessToken) {
5744
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5745
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5746
+ }
5747
+ if (configuration && configuration.apiKey) {
5748
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5749
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5750
+ }
5751
+ localVarHeaderParameter["Content-Type"] = "application/json";
5752
+ const query = new URLSearchParams(localVarUrlObj.search);
5753
+ for (const key in localVarQueryParameter) {
5754
+ query.set(key, localVarQueryParameter[key]);
5755
+ }
5756
+ for (const key in options.params) {
5757
+ query.set(key, options.params[key]);
5758
+ }
5759
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5760
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5761
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5762
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
5763
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
5764
+ return {
5765
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5766
+ options: localVarRequestOptions
5767
+ };
5768
+ },
5769
+ /**
5770
+ *
5771
+ * @summary Update a variant
5772
+ * @param {UpdateVariantDto} body
5773
+ * @param {string} productId Product ID
5774
+ * @param {string} variantId Variant ID
5775
+ * @param {*} [options] Override http request option.
5776
+ * @throws {RequiredError}
5777
+ */
5778
+ updateVariant: async (body, productId, variantId, options = {}) => {
5779
+ if (body === null || body === void 0) {
5780
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling updateVariant.");
5781
+ }
5782
+ if (productId === null || productId === void 0) {
5783
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling updateVariant.");
5784
+ }
5785
+ if (variantId === null || variantId === void 0) {
5786
+ throw new RequiredError("variantId", "Required parameter variantId was null or undefined when calling updateVariant.");
5787
+ }
5788
+ const localVarPath = `/products/{productId}/variants/{variantId}`.replace(`{${"productId"}}`, encodeURIComponent(String(productId))).replace(`{${"variantId"}}`, encodeURIComponent(String(variantId)));
5789
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5790
+ let baseOptions;
5791
+ if (configuration) {
5792
+ baseOptions = configuration.baseOptions;
5793
+ }
5794
+ const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
5795
+ const localVarHeaderParameter = {};
5796
+ const localVarQueryParameter = {};
5797
+ if (configuration && configuration.accessToken) {
5798
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5799
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5800
+ }
5801
+ if (configuration && configuration.apiKey) {
5802
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5803
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5804
+ }
5805
+ localVarHeaderParameter["Content-Type"] = "application/json";
5806
+ const query = new URLSearchParams(localVarUrlObj.search);
5807
+ for (const key in localVarQueryParameter) {
5808
+ query.set(key, localVarQueryParameter[key]);
5809
+ }
5810
+ for (const key in options.params) {
5811
+ query.set(key, options.params[key]);
5812
+ }
5813
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5814
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5815
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5816
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
5817
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
5818
+ return {
5819
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5820
+ options: localVarRequestOptions
5821
+ };
5822
+ }
5823
+ };
5824
+ };
5825
+ var ProductsApiFp = function(configuration) {
5826
+ return {
5827
+ /**
5828
+ *
5829
+ * @summary Add a new variant to a product
5830
+ * @param {CreateVariantDto} body
5831
+ * @param {string} productId Product ID
5832
+ * @param {*} [options] Override http request option.
5833
+ * @throws {RequiredError}
5834
+ */
5835
+ async addVariant(body, productId, options) {
5836
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).addVariant(body, productId, options);
5837
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5614
5838
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5615
5839
  return axios.request(axiosRequestArgs);
5616
5840
  };
5617
5841
  },
5618
5842
  /**
5619
5843
  *
5620
- * @summary Delete a product
5621
- * @param {string} id
5844
+ * @summary Create a new product with variants
5845
+ * @param {CreateProductDto} body
5846
+ * @param {*} [options] Override http request option.
5847
+ * @throws {RequiredError}
5848
+ */
5849
+ async createProduct(body, options) {
5850
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).createProduct(body, options);
5851
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5852
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5853
+ return axios.request(axiosRequestArgs);
5854
+ };
5855
+ },
5856
+ /**
5857
+ *
5858
+ * @summary [DEPRECATED] Use POST /products instead
5859
+ * @param {CreateProductDto} body
5860
+ * @param {*} [options] Override http request option.
5861
+ * @throws {RequiredError}
5862
+ */
5863
+ async createProductLegacy(body, options) {
5864
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).createProductLegacy(body, options);
5865
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5866
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5867
+ return axios.request(axiosRequestArgs);
5868
+ };
5869
+ },
5870
+ /**
5871
+ *
5872
+ * @summary Delete a product and all its variants
5873
+ * @param {string} id Product ID
5622
5874
  * @param {*} [options] Override http request option.
5623
5875
  * @throws {RequiredError}
5624
5876
  */
5625
5877
  async deleteProduct(id, options) {
5626
5878
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).deleteProduct(id, options);
5627
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5879
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5628
5880
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5629
5881
  return axios.request(axiosRequestArgs);
5630
5882
  };
5631
5883
  },
5632
5884
  /**
5633
5885
  *
5634
- * @summary Get all products of a specific category
5635
- * @param {string} categoryId Category ID
5636
- * @param {string} [searchTerm] OpenAI Search Query
5637
- * @param {number} [maxPrice] highest price to filter with
5638
- * @param {number} [minPrice] lowest price to filter with
5639
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5640
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5641
- * @param {string} [sort] specifies which attribute to sort with
5642
- * @param {boolean} [includeNoVariantProducts]
5643
- * @param {boolean} [isActive]
5644
- * @param {number} [limit]
5645
- * @param {number} [page]
5886
+ * @summary Delete a variant from a product
5887
+ * @param {string} productId Product ID
5888
+ * @param {string} variantId Variant ID
5889
+ * @param {*} [options] Override http request option.
5890
+ * @throws {RequiredError}
5891
+ */
5892
+ async deleteVariant(productId, variantId, options) {
5893
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).deleteVariant(productId, variantId, options);
5894
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5895
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5896
+ return axios.request(axiosRequestArgs);
5897
+ };
5898
+ },
5899
+ /**
5900
+ *
5901
+ * @summary [DEPRECATED] Use GET /products/all?categoryId=:id instead
5902
+ * @param {string} categoryId
5646
5903
  * @param {*} [options] Override http request option.
5647
5904
  * @throws {RequiredError}
5648
5905
  */
5649
- async getAllCategoryProducts(categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5650
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllCategoryProducts(categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options);
5651
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5906
+ async getAllCategoryProducts(categoryId, options) {
5907
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllCategoryProducts(categoryId, options);
5908
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5652
5909
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5653
5910
  return axios.request(axiosRequestArgs);
5654
5911
  };
5655
5912
  },
5656
5913
  /**
5657
5914
  *
5658
- * @summary Get all filters for products
5915
+ * @summary Get all available filters (brands, price range)
5659
5916
  * @param {*} [options] Override http request option.
5660
5917
  * @throws {RequiredError}
5661
5918
  */
5662
5919
  async getAllFilters(options) {
5663
5920
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllFilters(options);
5664
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5921
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5665
5922
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5666
5923
  return axios.request(axiosRequestArgs);
5667
5924
  };
5668
5925
  },
5669
5926
  /**
5670
5927
  *
5671
- * @summary Get all products of a specific sub category
5672
- * @param {string} subCategoryId Sub Category ID
5673
- * @param {string} [searchTerm] OpenAI Search Query
5674
- * @param {number} [maxPrice] highest price to filter with
5675
- * @param {number} [minPrice] lowest price to filter with
5676
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5677
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5678
- * @param {string} [sort] specifies which attribute to sort with
5679
- * @param {boolean} [includeNoVariantProducts]
5928
+ * @summary Get all products with filtering and pagination
5929
+ * @param {string} [searchTerm]
5930
+ * @param {number} [maxPrice]
5931
+ * @param {number} [minPrice]
5932
+ * @param {string} [brandFilter] Comma-separated brand names
5933
+ * @param {string} [availability]
5934
+ * @param {string} [sort]
5935
+ * @param {string} [subCategoryId]
5936
+ * @param {string} [categoryId]
5680
5937
  * @param {boolean} [isActive]
5681
5938
  * @param {number} [limit]
5682
5939
  * @param {number} [page]
5683
5940
  * @param {*} [options] Override http request option.
5684
5941
  * @throws {RequiredError}
5685
5942
  */
5686
- async getAllProducts(subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5687
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProducts(subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options);
5688
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5943
+ async getAllProducts(searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options) {
5944
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProducts(searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options);
5945
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5689
5946
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5690
5947
  return axios.request(axiosRequestArgs);
5691
5948
  };
5692
5949
  },
5693
5950
  /**
5694
5951
  *
5695
- * @summary Get all products
5696
- * @param {string} [searchTerm] OpenAI Search Query
5697
- * @param {string} [productType] Product Type
5698
- * @param {string} [categoryId] Category ID
5699
- * @param {number} [maxPrice] highest price to filter with
5700
- * @param {number} [minPrice] lowest price to filter with
5701
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5702
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5703
- * @param {string} [sort] specifies which attribute to sort with
5704
- * @param {boolean} [includeNoVariantProducts]
5705
- * @param {boolean} [isActive]
5706
- * @param {number} [limit]
5707
- * @param {number} [page]
5952
+ * @summary [DEPRECATED] Use GET /products/all?subCategoryId=:id instead
5953
+ * @param {string} subCategoryId
5708
5954
  * @param {*} [options] Override http request option.
5709
5955
  * @throws {RequiredError}
5710
5956
  */
5711
- async getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5712
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options);
5713
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5957
+ async getAllProductsBySubCategory(subCategoryId, options) {
5958
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProductsBySubCategory(subCategoryId, options);
5959
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5714
5960
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5715
5961
  return axios.request(axiosRequestArgs);
5716
5962
  };
@@ -5723,20 +5969,20 @@ var ProductsApiFp = function(configuration) {
5723
5969
  */
5724
5970
  async getFeaturedProduct(options) {
5725
5971
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getFeaturedProduct(options);
5726
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5972
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5727
5973
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5728
5974
  return axios.request(axiosRequestArgs);
5729
5975
  };
5730
5976
  },
5731
5977
  /**
5732
5978
  *
5733
- * @summary Get insights on store Products
5979
+ * @summary Get product insights for the store
5734
5980
  * @param {*} [options] Override http request option.
5735
5981
  * @throws {RequiredError}
5736
5982
  */
5737
5983
  async getProductsInsights(options) {
5738
5984
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getProductsInsights(options);
5739
- return (axios = globalAxios4, basePath = BASE_PATH) => {
5985
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5740
5986
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5741
5987
  return axios.request(axiosRequestArgs);
5742
5988
  };
@@ -5744,27 +5990,56 @@ var ProductsApiFp = function(configuration) {
5744
5990
  /**
5745
5991
  *
5746
5992
  * @summary Get related products
5747
- * @param {string} productId Product ID
5993
+ * @param {string} id Product ID
5994
+ * @param {number} [limit]
5995
+ * @param {*} [options] Override http request option.
5996
+ * @throws {RequiredError}
5997
+ */
5998
+ async getRelatedProducts(id, limit, options) {
5999
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getRelatedProducts(id, limit, options);
6000
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6001
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6002
+ return axios.request(axiosRequestArgs);
6003
+ };
6004
+ },
6005
+ /**
6006
+ *
6007
+ * @summary [DEPRECATED] Use GET /products/:id/related instead
6008
+ * @param {string} productId
5748
6009
  * @param {*} [options] Override http request option.
5749
6010
  * @throws {RequiredError}
5750
6011
  */
5751
- async getRelatedProducts(productId, options) {
5752
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getRelatedProducts(productId, options);
5753
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6012
+ async getRelatedProductsLegacy(productId, options) {
6013
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getRelatedProductsLegacy(productId, options);
6014
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5754
6015
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5755
6016
  return axios.request(axiosRequestArgs);
5756
6017
  };
5757
6018
  },
5758
6019
  /**
5759
6020
  *
5760
- * @summary Get a single product
6021
+ * @summary Get a single product with all details
5761
6022
  * @param {string} id Product ID
5762
6023
  * @param {*} [options] Override http request option.
5763
6024
  * @throws {RequiredError}
5764
6025
  */
5765
6026
  async getSingleProduct(id, options) {
5766
6027
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getSingleProduct(id, options);
5767
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6028
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6029
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6030
+ return axios.request(axiosRequestArgs);
6031
+ };
6032
+ },
6033
+ /**
6034
+ *
6035
+ * @summary [DEPRECATED] Use GET /products/:id instead
6036
+ * @param {string} id Product ID
6037
+ * @param {*} [options] Override http request option.
6038
+ * @throws {RequiredError}
6039
+ */
6040
+ async getSingleProductLegacy(id, options) {
6041
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getSingleProductLegacy(id, options);
6042
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5768
6043
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5769
6044
  return axios.request(axiosRequestArgs);
5770
6045
  };
@@ -5774,29 +6049,59 @@ var ProductsApiFp = function(configuration) {
5774
6049
  * @summary Get top selling products
5775
6050
  * @param {number} [limit]
5776
6051
  * @param {number} [page]
5777
- * @param {boolean} [isActive]
5778
- * @param {boolean} [includeNoVariantProducts]
5779
6052
  * @param {*} [options] Override http request option.
5780
6053
  * @throws {RequiredError}
5781
6054
  */
5782
- async getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options) {
5783
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options);
5784
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6055
+ async getTopSellingProducts(limit, page, options) {
6056
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getTopSellingProducts(limit, page, options);
6057
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5785
6058
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5786
6059
  return axios.request(axiosRequestArgs);
5787
6060
  };
5788
6061
  },
5789
6062
  /**
5790
6063
  *
5791
- * @summary Update a product
5792
- * @param {UpdateProductDto} body
5793
- * @param {string} id Product ID
6064
+ * @summary Update variant inventory (add or subtract)
6065
+ * @param {VariantIdInventoryBody} body
6066
+ * @param {string} productId Product ID
6067
+ * @param {string} variantId Variant ID
5794
6068
  * @param {*} [options] Override http request option.
5795
6069
  * @throws {RequiredError}
5796
6070
  */
5797
- async updateProduct(body, id, options) {
5798
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).updateProduct(body, id, options);
5799
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6071
+ async updateInventory(body, productId, variantId, options) {
6072
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).updateInventory(body, productId, variantId, options);
6073
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6074
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6075
+ return axios.request(axiosRequestArgs);
6076
+ };
6077
+ },
6078
+ /**
6079
+ *
6080
+ * @summary Update a product (not variants)
6081
+ * @param {UpdateProductDto} body
6082
+ * @param {string} id Product ID
6083
+ * @param {*} [options] Override http request option.
6084
+ * @throws {RequiredError}
6085
+ */
6086
+ async updateProduct(body, id, options) {
6087
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).updateProduct(body, id, options);
6088
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6089
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6090
+ return axios.request(axiosRequestArgs);
6091
+ };
6092
+ },
6093
+ /**
6094
+ *
6095
+ * @summary Update a variant
6096
+ * @param {UpdateVariantDto} body
6097
+ * @param {string} productId Product ID
6098
+ * @param {string} variantId Variant ID
6099
+ * @param {*} [options] Override http request option.
6100
+ * @throws {RequiredError}
6101
+ */
6102
+ async updateVariant(body, productId, variantId, options) {
6103
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).updateVariant(body, productId, variantId, options);
6104
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
5800
6105
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5801
6106
  return axios.request(axiosRequestArgs);
5802
6107
  };
@@ -5806,7 +6111,19 @@ var ProductsApiFp = function(configuration) {
5806
6111
  var ProductsApi = class extends BaseAPI {
5807
6112
  /**
5808
6113
  *
5809
- * @summary Create a product
6114
+ * @summary Add a new variant to a product
6115
+ * @param {CreateVariantDto} body
6116
+ * @param {string} productId Product ID
6117
+ * @param {*} [options] Override http request option.
6118
+ * @throws {RequiredError}
6119
+ * @memberof ProductsApi
6120
+ */
6121
+ async addVariant(body, productId, options) {
6122
+ return ProductsApiFp(this.configuration).addVariant(body, productId, options).then((request) => request(this.axios, this.basePath));
6123
+ }
6124
+ /**
6125
+ *
6126
+ * @summary Create a new product with variants
5810
6127
  * @param {CreateProductDto} body
5811
6128
  * @param {*} [options] Override http request option.
5812
6129
  * @throws {RequiredError}
@@ -5817,19 +6134,19 @@ var ProductsApi = class extends BaseAPI {
5817
6134
  }
5818
6135
  /**
5819
6136
  *
5820
- * @summary Create a Product that has a single variant
5821
- * @param {CreateSingleVariantProductDTO} body
6137
+ * @summary [DEPRECATED] Use POST /products instead
6138
+ * @param {CreateProductDto} body
5822
6139
  * @param {*} [options] Override http request option.
5823
6140
  * @throws {RequiredError}
5824
6141
  * @memberof ProductsApi
5825
6142
  */
5826
- async createSingleVariantProduct(body, options) {
5827
- return ProductsApiFp(this.configuration).createSingleVariantProduct(body, options).then((request) => request(this.axios, this.basePath));
6143
+ async createProductLegacy(body, options) {
6144
+ return ProductsApiFp(this.configuration).createProductLegacy(body, options).then((request) => request(this.axios, this.basePath));
5828
6145
  }
5829
6146
  /**
5830
6147
  *
5831
- * @summary Delete a product
5832
- * @param {string} id
6148
+ * @summary Delete a product and all its variants
6149
+ * @param {string} id Product ID
5833
6150
  * @param {*} [options] Override http request option.
5834
6151
  * @throws {RequiredError}
5835
6152
  * @memberof ProductsApi
@@ -5839,28 +6156,30 @@ var ProductsApi = class extends BaseAPI {
5839
6156
  }
5840
6157
  /**
5841
6158
  *
5842
- * @summary Get all products of a specific category
5843
- * @param {string} categoryId Category ID
5844
- * @param {string} [searchTerm] OpenAI Search Query
5845
- * @param {number} [maxPrice] highest price to filter with
5846
- * @param {number} [minPrice] lowest price to filter with
5847
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5848
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5849
- * @param {string} [sort] specifies which attribute to sort with
5850
- * @param {boolean} [includeNoVariantProducts]
5851
- * @param {boolean} [isActive]
5852
- * @param {number} [limit]
5853
- * @param {number} [page]
6159
+ * @summary Delete a variant from a product
6160
+ * @param {string} productId Product ID
6161
+ * @param {string} variantId Variant ID
6162
+ * @param {*} [options] Override http request option.
6163
+ * @throws {RequiredError}
6164
+ * @memberof ProductsApi
6165
+ */
6166
+ async deleteVariant(productId, variantId, options) {
6167
+ return ProductsApiFp(this.configuration).deleteVariant(productId, variantId, options).then((request) => request(this.axios, this.basePath));
6168
+ }
6169
+ /**
6170
+ *
6171
+ * @summary [DEPRECATED] Use GET /products/all?categoryId=:id instead
6172
+ * @param {string} categoryId
5854
6173
  * @param {*} [options] Override http request option.
5855
6174
  * @throws {RequiredError}
5856
6175
  * @memberof ProductsApi
5857
6176
  */
5858
- async getAllCategoryProducts(categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5859
- return ProductsApiFp(this.configuration).getAllCategoryProducts(categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options).then((request) => request(this.axios, this.basePath));
6177
+ async getAllCategoryProducts(categoryId, options) {
6178
+ return ProductsApiFp(this.configuration).getAllCategoryProducts(categoryId, options).then((request) => request(this.axios, this.basePath));
5860
6179
  }
5861
6180
  /**
5862
6181
  *
5863
- * @summary Get all filters for products
6182
+ * @summary Get all available filters (brands, price range)
5864
6183
  * @param {*} [options] Override http request option.
5865
6184
  * @throws {RequiredError}
5866
6185
  * @memberof ProductsApi
@@ -5870,15 +6189,15 @@ var ProductsApi = class extends BaseAPI {
5870
6189
  }
5871
6190
  /**
5872
6191
  *
5873
- * @summary Get all products of a specific sub category
5874
- * @param {string} subCategoryId Sub Category ID
5875
- * @param {string} [searchTerm] OpenAI Search Query
5876
- * @param {number} [maxPrice] highest price to filter with
5877
- * @param {number} [minPrice] lowest price to filter with
5878
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5879
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5880
- * @param {string} [sort] specifies which attribute to sort with
5881
- * @param {boolean} [includeNoVariantProducts]
6192
+ * @summary Get all products with filtering and pagination
6193
+ * @param {string} [searchTerm]
6194
+ * @param {number} [maxPrice]
6195
+ * @param {number} [minPrice]
6196
+ * @param {string} [brandFilter] Comma-separated brand names
6197
+ * @param {string} [availability]
6198
+ * @param {string} [sort]
6199
+ * @param {string} [subCategoryId]
6200
+ * @param {string} [categoryId]
5882
6201
  * @param {boolean} [isActive]
5883
6202
  * @param {number} [limit]
5884
6203
  * @param {number} [page]
@@ -5886,30 +6205,19 @@ var ProductsApi = class extends BaseAPI {
5886
6205
  * @throws {RequiredError}
5887
6206
  * @memberof ProductsApi
5888
6207
  */
5889
- async getAllProducts(subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5890
- return ProductsApiFp(this.configuration).getAllProducts(subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options).then((request) => request(this.axios, this.basePath));
6208
+ async getAllProducts(searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options) {
6209
+ return ProductsApiFp(this.configuration).getAllProducts(searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options).then((request) => request(this.axios, this.basePath));
5891
6210
  }
5892
6211
  /**
5893
6212
  *
5894
- * @summary Get all products
5895
- * @param {string} [searchTerm] OpenAI Search Query
5896
- * @param {string} [productType] Product Type
5897
- * @param {string} [categoryId] Category ID
5898
- * @param {number} [maxPrice] highest price to filter with
5899
- * @param {number} [minPrice] lowest price to filter with
5900
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5901
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5902
- * @param {string} [sort] specifies which attribute to sort with
5903
- * @param {boolean} [includeNoVariantProducts]
5904
- * @param {boolean} [isActive]
5905
- * @param {number} [limit]
5906
- * @param {number} [page]
6213
+ * @summary [DEPRECATED] Use GET /products/all?subCategoryId=:id instead
6214
+ * @param {string} subCategoryId
5907
6215
  * @param {*} [options] Override http request option.
5908
6216
  * @throws {RequiredError}
5909
6217
  * @memberof ProductsApi
5910
6218
  */
5911
- async getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5912
- return ProductsApiFp(this.configuration).getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options).then((request) => request(this.axios, this.basePath));
6219
+ async getAllProductsBySubCategory(subCategoryId, options) {
6220
+ return ProductsApiFp(this.configuration).getAllProductsBySubCategory(subCategoryId, options).then((request) => request(this.axios, this.basePath));
5913
6221
  }
5914
6222
  /**
5915
6223
  *
@@ -5923,7 +6231,7 @@ var ProductsApi = class extends BaseAPI {
5923
6231
  }
5924
6232
  /**
5925
6233
  *
5926
- * @summary Get insights on store Products
6234
+ * @summary Get product insights for the store
5927
6235
  * @param {*} [options] Override http request option.
5928
6236
  * @throws {RequiredError}
5929
6237
  * @memberof ProductsApi
@@ -5934,17 +6242,29 @@ var ProductsApi = class extends BaseAPI {
5934
6242
  /**
5935
6243
  *
5936
6244
  * @summary Get related products
5937
- * @param {string} productId Product ID
6245
+ * @param {string} id Product ID
6246
+ * @param {number} [limit]
6247
+ * @param {*} [options] Override http request option.
6248
+ * @throws {RequiredError}
6249
+ * @memberof ProductsApi
6250
+ */
6251
+ async getRelatedProducts(id, limit, options) {
6252
+ return ProductsApiFp(this.configuration).getRelatedProducts(id, limit, options).then((request) => request(this.axios, this.basePath));
6253
+ }
6254
+ /**
6255
+ *
6256
+ * @summary [DEPRECATED] Use GET /products/:id/related instead
6257
+ * @param {string} productId
5938
6258
  * @param {*} [options] Override http request option.
5939
6259
  * @throws {RequiredError}
5940
6260
  * @memberof ProductsApi
5941
6261
  */
5942
- async getRelatedProducts(productId, options) {
5943
- return ProductsApiFp(this.configuration).getRelatedProducts(productId, options).then((request) => request(this.axios, this.basePath));
6262
+ async getRelatedProductsLegacy(productId, options) {
6263
+ return ProductsApiFp(this.configuration).getRelatedProductsLegacy(productId, options).then((request) => request(this.axios, this.basePath));
5944
6264
  }
5945
6265
  /**
5946
6266
  *
5947
- * @summary Get a single product
6267
+ * @summary Get a single product with all details
5948
6268
  * @param {string} id Product ID
5949
6269
  * @param {*} [options] Override http request option.
5950
6270
  * @throws {RequiredError}
@@ -5953,23 +6273,45 @@ var ProductsApi = class extends BaseAPI {
5953
6273
  async getSingleProduct(id, options) {
5954
6274
  return ProductsApiFp(this.configuration).getSingleProduct(id, options).then((request) => request(this.axios, this.basePath));
5955
6275
  }
6276
+ /**
6277
+ *
6278
+ * @summary [DEPRECATED] Use GET /products/:id instead
6279
+ * @param {string} id Product ID
6280
+ * @param {*} [options] Override http request option.
6281
+ * @throws {RequiredError}
6282
+ * @memberof ProductsApi
6283
+ */
6284
+ async getSingleProductLegacy(id, options) {
6285
+ return ProductsApiFp(this.configuration).getSingleProductLegacy(id, options).then((request) => request(this.axios, this.basePath));
6286
+ }
5956
6287
  /**
5957
6288
  *
5958
6289
  * @summary Get top selling products
5959
6290
  * @param {number} [limit]
5960
6291
  * @param {number} [page]
5961
- * @param {boolean} [isActive]
5962
- * @param {boolean} [includeNoVariantProducts]
5963
6292
  * @param {*} [options] Override http request option.
5964
6293
  * @throws {RequiredError}
5965
6294
  * @memberof ProductsApi
5966
6295
  */
5967
- async getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options) {
5968
- return ProductsApiFp(this.configuration).getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options).then((request) => request(this.axios, this.basePath));
6296
+ async getTopSellingProducts(limit, page, options) {
6297
+ return ProductsApiFp(this.configuration).getTopSellingProducts(limit, page, options).then((request) => request(this.axios, this.basePath));
6298
+ }
6299
+ /**
6300
+ *
6301
+ * @summary Update variant inventory (add or subtract)
6302
+ * @param {VariantIdInventoryBody} body
6303
+ * @param {string} productId Product ID
6304
+ * @param {string} variantId Variant ID
6305
+ * @param {*} [options] Override http request option.
6306
+ * @throws {RequiredError}
6307
+ * @memberof ProductsApi
6308
+ */
6309
+ async updateInventory(body, productId, variantId, options) {
6310
+ return ProductsApiFp(this.configuration).updateInventory(body, productId, variantId, options).then((request) => request(this.axios, this.basePath));
5969
6311
  }
5970
6312
  /**
5971
6313
  *
5972
- * @summary Update a product
6314
+ * @summary Update a product (not variants)
5973
6315
  * @param {UpdateProductDto} body
5974
6316
  * @param {string} id Product ID
5975
6317
  * @param {*} [options] Override http request option.
@@ -5979,6 +6321,19 @@ var ProductsApi = class extends BaseAPI {
5979
6321
  async updateProduct(body, id, options) {
5980
6322
  return ProductsApiFp(this.configuration).updateProduct(body, id, options).then((request) => request(this.axios, this.basePath));
5981
6323
  }
6324
+ /**
6325
+ *
6326
+ * @summary Update a variant
6327
+ * @param {UpdateVariantDto} body
6328
+ * @param {string} productId Product ID
6329
+ * @param {string} variantId Variant ID
6330
+ * @param {*} [options] Override http request option.
6331
+ * @throws {RequiredError}
6332
+ * @memberof ProductsApi
6333
+ */
6334
+ async updateVariant(body, productId, variantId, options) {
6335
+ return ProductsApiFp(this.configuration).updateVariant(body, productId, variantId, options).then((request) => request(this.axios, this.basePath));
6336
+ }
5982
6337
  };
5983
6338
  var ShippingApiAxiosParamCreator = function(configuration) {
5984
6339
  return {
@@ -6204,7 +6559,7 @@ var ShippingApiFp = function(configuration) {
6204
6559
  */
6205
6560
  async getAllShipments(options) {
6206
6561
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getAllShipments(options);
6207
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6562
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6208
6563
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6209
6564
  return axios.request(axiosRequestArgs);
6210
6565
  };
@@ -6217,7 +6572,7 @@ var ShippingApiFp = function(configuration) {
6217
6572
  */
6218
6573
  async getAllUserShipments(options) {
6219
6574
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getAllUserShipments(options);
6220
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6575
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6221
6576
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6222
6577
  return axios.request(axiosRequestArgs);
6223
6578
  };
@@ -6231,7 +6586,7 @@ var ShippingApiFp = function(configuration) {
6231
6586
  */
6232
6587
  async getOrderShipment(orderId, options) {
6233
6588
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getOrderShipment(orderId, options);
6234
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6589
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6235
6590
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6236
6591
  return axios.request(axiosRequestArgs);
6237
6592
  };
@@ -6246,7 +6601,7 @@ var ShippingApiFp = function(configuration) {
6246
6601
  */
6247
6602
  async getShippingRates(body, addressId, options) {
6248
6603
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getShippingRates(body, addressId, options);
6249
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6604
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6250
6605
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6251
6606
  return axios.request(axiosRequestArgs);
6252
6607
  };
@@ -6259,7 +6614,7 @@ var ShippingApiFp = function(configuration) {
6259
6614
  */
6260
6615
  async getStoreAddress(options) {
6261
6616
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getStoreAddress(options);
6262
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6617
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6263
6618
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6264
6619
  return axios.request(axiosRequestArgs);
6265
6620
  };
@@ -6519,7 +6874,7 @@ var WishlistApiFp = function(configuration) {
6519
6874
  */
6520
6875
  async addToWishlist(productId, options) {
6521
6876
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).addToWishlist(productId, options);
6522
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6877
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6523
6878
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6524
6879
  return axios.request(axiosRequestArgs);
6525
6880
  };
@@ -6532,7 +6887,7 @@ var WishlistApiFp = function(configuration) {
6532
6887
  */
6533
6888
  async clearWishlist(options) {
6534
6889
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).clearWishlist(options);
6535
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6890
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6536
6891
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6537
6892
  return axios.request(axiosRequestArgs);
6538
6893
  };
@@ -6545,7 +6900,7 @@ var WishlistApiFp = function(configuration) {
6545
6900
  */
6546
6901
  async getWishlist(options) {
6547
6902
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).getWishlist(options);
6548
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6903
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6549
6904
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6550
6905
  return axios.request(axiosRequestArgs);
6551
6906
  };
@@ -6558,7 +6913,7 @@ var WishlistApiFp = function(configuration) {
6558
6913
  */
6559
6914
  async getWishlistItemCount(options) {
6560
6915
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).getWishlistItemCount(options);
6561
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6916
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6562
6917
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6563
6918
  return axios.request(axiosRequestArgs);
6564
6919
  };
@@ -6572,7 +6927,7 @@ var WishlistApiFp = function(configuration) {
6572
6927
  */
6573
6928
  async removeFromWishlist(productId, options) {
6574
6929
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).removeFromWishlist(productId, options);
6575
- return (axios = globalAxios4, basePath = BASE_PATH) => {
6930
+ return (axios = globalAxios18, basePath = BASE_PATH) => {
6576
6931
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6577
6932
  return axios.request(axiosRequestArgs);
6578
6933
  };
@@ -7021,7 +7376,7 @@ init_config();
7021
7376
  init_config();
7022
7377
  init_sharedConfig();
7023
7378
  init_sharedConfig();
7024
- globalAxios4.interceptors.request.use(async (config) => {
7379
+ globalAxios18.interceptors.request.use(async (config) => {
7025
7380
  if (!config?.headers) {
7026
7381
  throw new Error(
7027
7382
  `Expected 'config' and 'config.headers' not to be undefined`
@@ -7224,38 +7579,6 @@ function EcommerceProvider({ config, children, withToaster = true, basePath = ""
7224
7579
  );
7225
7580
  return /* @__PURE__ */ jsx(QueryClientProvider, { client, children: /* @__PURE__ */ jsx(ThemeProvider, { config, children: /* @__PURE__ */ jsx(BasePathProvider, { basePath, children: /* @__PURE__ */ jsx(AuthProvider, { children: /* @__PURE__ */ jsx(NotificationProvider, { children: /* @__PURE__ */ jsx(CartProvider, { children: /* @__PURE__ */ jsx(WishlistProvider, { children }) }) }) }) }) }) });
7226
7581
  }
7227
-
7228
- // src/lib/utils/format.ts
7229
- function formatPrice(price, currency = "USD") {
7230
- return new Intl.NumberFormat("en-US", {
7231
- style: "currency",
7232
- currency
7233
- }).format(price);
7234
- }
7235
- function formatDate(date, format = "short") {
7236
- const d = typeof date === "string" ? new Date(date) : date;
7237
- if (format === "long") {
7238
- return new Intl.DateTimeFormat("en-US", {
7239
- year: "numeric",
7240
- month: "long",
7241
- day: "numeric",
7242
- hour: "2-digit",
7243
- minute: "2-digit"
7244
- }).format(d);
7245
- }
7246
- return new Intl.DateTimeFormat("en-US", {
7247
- year: "numeric",
7248
- month: "short",
7249
- day: "numeric"
7250
- }).format(d);
7251
- }
7252
- function truncate(text, maxLength) {
7253
- if (text.length <= maxLength) return text;
7254
- return text.slice(0, maxLength) + "...";
7255
- }
7256
- function getInitials(firstName, lastName) {
7257
- return `${firstName?.charAt(0)}${lastName?.charAt(0)}`.toUpperCase();
7258
- }
7259
7582
  function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7260
7583
  const [selectedVariantIndex, setSelectedVariantIndex] = useState(0);
7261
7584
  const [selectedSizeIndex, setSelectedSizeIndex] = useState(0);
@@ -7270,8 +7593,8 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7270
7593
  setQuantity(newQuantity);
7271
7594
  }
7272
7595
  };
7273
- const selectedVariant = product.productVariants[selectedVariantIndex];
7274
- selectedVariant.productMedia[selectedSizeIndex];
7596
+ const selectedVariant = product.variants[selectedVariantIndex];
7597
+ selectedVariant.media[selectedSizeIndex];
7275
7598
  const displayPrice = selectedVariant.finalPrice;
7276
7599
  const displayOriginalPrice = selectedVariant.retailPrice;
7277
7600
  const isDiscounted = selectedVariant.isDiscounted;
@@ -7313,24 +7636,20 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7313
7636
  children: /* @__PURE__ */ jsxs("div", { className: "p-8", children: [
7314
7637
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between mb-6", children: [
7315
7638
  /* @__PURE__ */ jsxs("div", { children: [
7316
- /* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-primary uppercase tracking-wide font-medium mb-2", children: [
7317
- product.brand,
7318
- " \u2022 ",
7319
- product.parentCategories?.[0]?.name || "Uncategorized"
7320
- ] }),
7639
+ /* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] text-[11px] text-primary uppercase tracking-wide font-medium mb-2", children: product.brand }),
7321
7640
  /* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-secondary tracking-[-1px]", children: displayName }),
7322
7641
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
7323
7642
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsx(
7324
7643
  Star,
7325
7644
  {
7326
- className: `size-4 ${i < Math.floor(product.rating ? product.rating : 0) ? "text-accent fill-accent" : "text-gray-300"}`
7645
+ className: `size-4 ${i < Math.floor(product.summary?.averageRating || 0) ? "text-accent fill-accent" : "text-gray-300"}`
7327
7646
  },
7328
7647
  i
7329
7648
  )) }),
7330
7649
  /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] text-[13px] text-muted", children: [
7331
- product.rating,
7650
+ product.summary?.averageRating || 0,
7332
7651
  " (",
7333
- product.reviews ? product.reviews.length : 0,
7652
+ product.summary?.reviewCount || 0,
7334
7653
  " reviews)"
7335
7654
  ] })
7336
7655
  ] })
@@ -7350,7 +7669,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7350
7669
  /* @__PURE__ */ jsx(
7351
7670
  "img",
7352
7671
  {
7353
- src: selectedVariant.productMedia[selectedImageIndex]?.file || selectedVariant.productMedia[0]?.file,
7672
+ src: selectedVariant.media[selectedImageIndex]?.file || selectedVariant.media[0]?.file,
7354
7673
  alt: product.name,
7355
7674
  className: "w-full h-full object-contain"
7356
7675
  }
@@ -7361,7 +7680,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7361
7680
  "%"
7362
7681
  ] }) }) })
7363
7682
  ] }),
7364
- selectedVariant.productMedia.length > 1 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-3", children: selectedVariant.productMedia.map((image, index) => /* @__PURE__ */ jsx(
7683
+ selectedVariant.media.length > 1 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-3", children: selectedVariant.media.map((image, index) => /* @__PURE__ */ jsx(
7365
7684
  "div",
7366
7685
  {
7367
7686
  className: `aspect-square rounded-xl overflow-hidden cursor-pointer transition-opacity ${selectedImageIndex === index ? "ring-2 ring-primary" : "bg-gray-50 hover:opacity-75"}`,
@@ -7408,9 +7727,9 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7408
7727
  /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
7409
7728
  /* @__PURE__ */ jsxs("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[13px] text-secondary mb-3", children: [
7410
7729
  "Selected Variant: ",
7411
- /* @__PURE__ */ jsx("span", { className: "font-normal text-muted", children: product.productVariants[selectedVariantIndex].name })
7730
+ /* @__PURE__ */ jsx("span", { className: "font-normal text-muted", children: product.variants[selectedVariantIndex].name })
7412
7731
  ] }),
7413
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: product.productVariants.map((variant, index) => /* @__PURE__ */ jsx(
7732
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant, index) => /* @__PURE__ */ jsx(
7414
7733
  "button",
7415
7734
  {
7416
7735
  onClick: () => {
@@ -7424,7 +7743,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7424
7743
  children: /* @__PURE__ */ jsx(
7425
7744
  Image4,
7426
7745
  {
7427
- src: variant.productMedia?.[0]?.file || "",
7746
+ src: variant.media?.[0]?.file || "",
7428
7747
  alt: variant.color || `Variant ${index + 1}`,
7429
7748
  className: "object-cover",
7430
7749
  height: 32,
@@ -7482,7 +7801,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7482
7801
  ] })
7483
7802
  }
7484
7803
  ),
7485
- /* @__PURE__ */ jsx(Link7, { href: `/products/${product._id}`, children: /* @__PURE__ */ jsxs(
7804
+ /* @__PURE__ */ jsx(Link9, { href: `/products/${product._id}`, children: /* @__PURE__ */ jsxs(
7486
7805
  "button",
7487
7806
  {
7488
7807
  onClick: () => {
@@ -7512,7 +7831,8 @@ function ProductCard({
7512
7831
  showFavoriteButton = true,
7513
7832
  className
7514
7833
  }) {
7515
- useRouter();
7834
+ const router = useRouter();
7835
+ const { isAuthenticated } = useAuth();
7516
7836
  const { buildPath } = useBasePath();
7517
7837
  const [isFavorite, setIsFavorite] = useState(isFavorited);
7518
7838
  const { addToWishlist, removeFromWishlist, isInWishlist } = useWishlist();
@@ -7539,14 +7859,14 @@ function ProductCard({
7539
7859
  setSelectedVariantImage(null);
7540
7860
  setSelectedVariantId(null);
7541
7861
  setIsImageLoaded(false);
7542
- if (product.productVariants && product.productVariants.length > 0) {
7543
- const firstVariant = product.productVariants[0];
7544
- if (firstVariant.productMedia && firstVariant.productMedia.length > 0) {
7545
- setSelectedVariantImage(firstVariant.productMedia[0].file);
7862
+ if (product.variants && product.variants.length > 0) {
7863
+ const firstVariant = product.variants[0];
7864
+ if (firstVariant.media && firstVariant.media.length > 0) {
7865
+ setSelectedVariantImage(firstVariant.media[0].file);
7546
7866
  setSelectedVariantId(firstVariant.id || firstVariant._id || null);
7547
7867
  }
7548
7868
  }
7549
- }, [product._id, product.productVariants]);
7869
+ }, [product._id, product.variants]);
7550
7870
  const handleKeyDown = (e) => {
7551
7871
  if (e.key === "Enter" || e.key === " ") {
7552
7872
  e.preventDefault();
@@ -7554,46 +7874,43 @@ function ProductCard({
7554
7874
  }
7555
7875
  };
7556
7876
  const variantImages = useMemo(() => {
7557
- if (!product.productVariants || product.productVariants.length === 0) {
7877
+ if (!product.variants || product.variants.length === 0) {
7558
7878
  return [];
7559
7879
  }
7560
- return product.productVariants.filter((variant) => variant.productMedia && variant.productMedia.length > 0).map((variant) => ({
7880
+ return product.variants.filter((variant) => variant.media && variant.media.length > 0).map((variant) => ({
7561
7881
  variantId: variant.id || variant._id,
7562
7882
  variantName: variant.name,
7563
- image: variant.productMedia[0].file
7883
+ image: variant.media[0].file
7564
7884
  }));
7565
- }, [product.productVariants]);
7885
+ }, [product.variants]);
7566
7886
  const selectedVariant = useMemo(() => {
7567
- if (!selectedVariantId || !product.productVariants) return null;
7568
- return product.productVariants.find(
7887
+ if (!selectedVariantId || !product.variants) return null;
7888
+ return product.variants.find(
7569
7889
  (variant) => (variant.id || variant._id) === selectedVariantId
7570
7890
  );
7571
- }, [selectedVariantId, product.productVariants]);
7572
- const displayName = useMemo(() => {
7573
- return selectedVariant?.name || product.name;
7574
- }, [selectedVariant, product.name]);
7891
+ }, [selectedVariantId, product.variants]);
7575
7892
  const displayFinalPrice = useMemo(() => {
7576
- return selectedVariant?.finalPrice ?? product.finalPrice;
7577
- }, [selectedVariant, product.finalPrice]);
7893
+ return selectedVariant?.finalPrice ?? product.variants?.[0]?.finalPrice ?? 0;
7894
+ }, [selectedVariant, product.variants]);
7578
7895
  const displayPriceBeforeDiscount = useMemo(() => {
7579
- return selectedVariant?.retailPrice ?? product.priceBeforeDiscount;
7580
- }, [selectedVariant, product.priceBeforeDiscount]);
7896
+ return selectedVariant?.retailPrice ?? product.variants?.[0]?.retailPrice ?? 0;
7897
+ }, [selectedVariant, product.variants]);
7581
7898
  const displayIsDiscounted = useMemo(() => {
7582
- return selectedVariant ? selectedVariant.isDiscounted : product.isDiscounted;
7583
- }, [selectedVariant, product.isDiscounted]);
7899
+ return selectedVariant ? selectedVariant.isDiscounted : product.variants?.[0]?.isDiscounted;
7900
+ }, [selectedVariant, product.variants]);
7584
7901
  const displayDiscountAmount = useMemo(() => {
7585
- return selectedVariant ? selectedVariant.discountAmount : product.discountAmount;
7586
- }, [selectedVariant, product.discountAmount]);
7902
+ return selectedVariant ? selectedVariant.discountAmount : product.variants?.[0]?.discountAmount;
7903
+ }, [selectedVariant, product.variants]);
7587
7904
  const displayInventoryCount = useMemo(() => {
7588
- return selectedVariant ? selectedVariant.inventoryCount : product.inventoryCount;
7589
- }, [selectedVariant, product.inventoryCount]);
7905
+ return selectedVariant ? selectedVariant.inventoryCount : product.variants?.[0]?.inventoryCount;
7906
+ }, [selectedVariant, product.variants]);
7590
7907
  const imageSource = useMemo(() => {
7591
- const src = selectedVariantImage || product.productMedia?.[0]?.file || "/placeholder-product.jpg";
7908
+ const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.jpg";
7592
7909
  return {
7593
7910
  src,
7594
7911
  alt: product.name || "Product image"
7595
7912
  };
7596
- }, [product.productMedia, product.name, selectedVariantImage]);
7913
+ }, [product.media, product.name, selectedVariantImage]);
7597
7914
  useEffect(() => {
7598
7915
  setIsImageLoaded(false);
7599
7916
  }, [imageSource.src]);
@@ -7654,18 +7971,21 @@ function ProductCard({
7654
7971
  "%"
7655
7972
  ] }) }) }),
7656
7973
  /* @__PURE__ */ jsx("div", { className: "mb-1", children: /* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] text-xs text-[#5B9BD5] uppercase tracking-wide font-medium", children: product.brand }) }),
7657
- /* @__PURE__ */ jsx("div", { className: "h-[40px] mb-3", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] line-clamp-2", children: displayName }) }),
7658
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mb-2", children: [
7974
+ /* @__PURE__ */ jsxs("div", { className: "h-[40px] mb-3", children: [
7975
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] line-clamp-2", children: product.name }),
7976
+ selectedVariant && /* @__PURE__ */ jsx("p", { className: "text-xs font-['Poppins',sans-serif] text-[#676c80]", children: selectedVariant.name })
7977
+ ] }),
7978
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 ", children: [
7659
7979
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsx(
7660
7980
  Star,
7661
7981
  {
7662
- className: `size-4 ${i < Math.floor(product.rating ? product.rating : 0) ? "text-[#E67E50] fill-[#E67E50]" : "text-gray-300"}`
7982
+ className: `size-4 ${i < Math.floor(product.summary?.averageRating || 0) ? "text-[#E67E50] fill-[#E67E50]" : "text-gray-300"}`
7663
7983
  },
7664
7984
  i
7665
7985
  )) }),
7666
- /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] text-[10px] text-[#676c80]", children: [
7986
+ /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] text-[10px] text-[#676c80] mt-4", children: [
7667
7987
  "(",
7668
- product.reviews?.length || 0,
7988
+ product.summary?.reviewCount || 0,
7669
7989
  ")"
7670
7990
  ] })
7671
7991
  ] }),
@@ -7676,7 +7996,7 @@ function ProductCard({
7676
7996
  ] }),
7677
7997
  displayIsDiscounted && /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] text-sm text-[#676c80] line-through", children: [
7678
7998
  "$",
7679
- formatPrice(displayPriceBeforeDiscount)
7999
+ displayPriceBeforeDiscount.toFixed(2)
7680
8000
  ] })
7681
8001
  ] }),
7682
8002
  variantImages.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 mb-3", children: variantImages.map((variant, index) => /* @__PURE__ */ jsx(
@@ -7723,6 +8043,21 @@ function ProductCard({
7723
8043
  );
7724
8044
  return;
7725
8045
  }
8046
+ if (displayInventoryCount === 0) {
8047
+ notification.error(
8048
+ "Out of Stock",
8049
+ "This item is currently out of stock."
8050
+ );
8051
+ return;
8052
+ }
8053
+ if (!isAuthenticated) {
8054
+ notification.error(
8055
+ "Sign-in required",
8056
+ "Please sign in to add items to your cart."
8057
+ );
8058
+ router.push(buildPath(`/login?redirect=${encodeURIComponent(window.location.pathname + window.location.search)}`));
8059
+ return;
8060
+ }
7726
8061
  try {
7727
8062
  await addToCart(
7728
8063
  product._id || product.id,
@@ -7870,81 +8205,75 @@ var Input = forwardRef(
7870
8205
  );
7871
8206
  Input.displayName = "Input";
7872
8207
  function useProducts(filters, page = 1, limit = 20) {
7873
- const [products, setProducts] = useState([]);
7874
- const [isLoading, setIsLoading] = useState(true);
7875
- const [error, setError] = useState(null);
7876
- const [pagination, setPagination] = useState({
7877
- page: 1,
7878
- limit: 20,
7879
- total: 0,
7880
- totalPages: 0
7881
- });
7882
- const fetchProducts = useCallback(async () => {
7883
- setIsLoading(true);
7884
- setError(null);
7885
- try {
7886
- let response;
7887
- if (filters?.subCategory) {
7888
- response = await new ProductsApi(AXIOS_CONFIG).getAllProducts(
7889
- filters.subCategory,
7890
- filters?.search,
7891
- filters?.maxPrice,
7892
- filters?.minPrice,
7893
- void 0,
7894
- // brandFilter
7895
- filters?.inStock !== void 0 ? filters.inStock ? "in-stock" : "out-of-stock" : void 0,
7896
- void 0,
7897
- // sort
7898
- true,
7899
- // includeNoVariantProducts
7900
- true,
7901
- // isActive
7902
- limit,
7903
- page
7904
- );
7905
- } else {
7906
- response = await new ProductsApi(AXIOS_CONFIG).getAllProductsForStore(
7907
- filters?.search,
7908
- void 0,
7909
- // productType
7910
- filters?.category,
7911
- filters?.maxPrice,
7912
- filters?.minPrice,
7913
- void 0,
7914
- // brandFilter
7915
- filters?.inStock !== void 0 ? filters.inStock ? "in-stock" : "out-of-stock" : void 0,
7916
- void 0,
7917
- // sort
7918
- true,
7919
- // includeNoVariantProducts
7920
- true,
7921
- // isActive
7922
- limit,
7923
- page
7924
- );
7925
- }
7926
- setProducts(response.data.data);
7927
- setPagination({
7928
- page: response.data.currentPage || page,
7929
- limit: response.data.limit || limit,
7930
- total: products.length,
7931
- // Use filtered count
7932
- totalPages: Math.ceil(products.length / limit)
7933
- });
7934
- } catch (err) {
7935
- setError(err);
8208
+ const { data, isLoading, error, refetch } = useQuery({
8209
+ queryKey: [
8210
+ "products",
8211
+ filters?.search,
8212
+ filters?.category,
8213
+ filters?.subCategory,
8214
+ filters?.maxPrice,
8215
+ filters?.minPrice,
8216
+ filters?.inStock,
8217
+ page,
8218
+ limit
8219
+ ],
8220
+ queryFn: async () => {
8221
+ const response = await new ProductsApi(AXIOS_CONFIG).getAllProducts(
8222
+ filters?.search ?? "",
8223
+ // searchTerm
8224
+ filters?.maxPrice,
8225
+ // maxPrice
8226
+ filters?.minPrice,
8227
+ // minPrice
8228
+ void 0,
8229
+ // brandFilter
8230
+ filters?.inStock !== void 0 ? filters.inStock ? "in-stock" : "out-of-stock" : void 0,
8231
+ // availability
8232
+ "createdAt",
8233
+ // sort
8234
+ filters?.subCategory,
8235
+ // subCategoryId
8236
+ filters?.category,
8237
+ // categoryId
8238
+ true,
8239
+ // isActive
8240
+ limit,
8241
+ // limit
8242
+ page
8243
+ // page
8244
+ );
8245
+ const res = response.data;
8246
+ console.log("Products API response:", res);
8247
+ return {
8248
+ products: res.data || [],
8249
+ pagination: {
8250
+ page: res.currentPage || page,
8251
+ limit: res.limit || limit,
8252
+ total: res.totalItems || 0,
8253
+ totalPages: res.totalPages || 0
8254
+ }
8255
+ };
7936
8256
  }
7937
- setIsLoading(false);
7938
- }, [filters, page, limit]);
7939
- useEffect(() => {
7940
- fetchProducts();
7941
- }, [fetchProducts]);
7942
- return { products, isLoading, error, pagination };
8257
+ });
8258
+ console.log("useProducts data:", data);
8259
+ return {
8260
+ products: data?.products || [],
8261
+ isLoading,
8262
+ error,
8263
+ pagination: data?.pagination || {
8264
+ page: 1,
8265
+ limit: 20,
8266
+ total: 0,
8267
+ totalPages: 0
8268
+ },
8269
+ refetch
8270
+ };
7943
8271
  }
7944
8272
  function useProduct(id) {
7945
8273
  const [product, setProduct] = useState(null);
7946
8274
  const [isLoading, setIsLoading] = useState(true);
7947
8275
  const [error, setError] = useState(null);
8276
+ console.log("product", product);
7948
8277
  useEffect(() => {
7949
8278
  const fetchProduct = async () => {
7950
8279
  setIsLoading(true);
@@ -7982,6 +8311,38 @@ function useCategories() {
7982
8311
  }, []);
7983
8312
  return { categories, isLoading, error };
7984
8313
  }
8314
+
8315
+ // src/lib/utils/format.ts
8316
+ function formatPrice(price, currency = "USD") {
8317
+ return new Intl.NumberFormat("en-US", {
8318
+ style: "currency",
8319
+ currency
8320
+ }).format(price);
8321
+ }
8322
+ function formatDate(date, format = "short") {
8323
+ const d = typeof date === "string" ? new Date(date) : date;
8324
+ if (format === "long") {
8325
+ return new Intl.DateTimeFormat("en-US", {
8326
+ year: "numeric",
8327
+ month: "long",
8328
+ day: "numeric",
8329
+ hour: "2-digit",
8330
+ minute: "2-digit"
8331
+ }).format(d);
8332
+ }
8333
+ return new Intl.DateTimeFormat("en-US", {
8334
+ year: "numeric",
8335
+ month: "short",
8336
+ day: "numeric"
8337
+ }).format(d);
8338
+ }
8339
+ function truncate(text, maxLength) {
8340
+ if (text.length <= maxLength) return text;
8341
+ return text.slice(0, maxLength) + "...";
8342
+ }
8343
+ function getInitials(firstName, lastName) {
8344
+ return `${firstName?.charAt(0)}${lastName?.charAt(0)}`.toUpperCase();
8345
+ }
7985
8346
  function ShopScreen({ initialFilters = {}, categoryName }) {
7986
8347
  const router = useRouter();
7987
8348
  const { buildPath } = useBasePath();
@@ -8006,19 +8367,23 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8006
8367
  const { categories, isLoading: isLoadingCategories } = useCategories();
8007
8368
  const handleSearch = (e) => {
8008
8369
  e.preventDefault();
8009
- if (searchQuery.trim()) {
8370
+ const sanitized = searchQuery.trim().replace(/\s+/g, " ");
8371
+ if (sanitized) {
8010
8372
  setIsSearching(true);
8011
- router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
8373
+ router.push(buildPath(`/search?q=${encodeURIComponent(sanitized)}`));
8012
8374
  }
8013
8375
  };
8014
8376
  const handleInputChange = (e) => {
8015
8377
  setSearchQuery(e.target.value);
8016
8378
  };
8017
8379
  const handleKeyDown = (e) => {
8018
- if (e.key === "Enter" && searchQuery.trim()) {
8380
+ if (e.key === "Enter") {
8019
8381
  e.preventDefault();
8020
- setIsSearching(true);
8021
- router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
8382
+ const sanitized = searchQuery.trim().replace(/\s+/g, " ");
8383
+ if (sanitized) {
8384
+ setIsSearching(true);
8385
+ router.push(buildPath(`/search?q=${encodeURIComponent(sanitized)}`));
8386
+ }
8022
8387
  }
8023
8388
  };
8024
8389
  const priceRanges = useMemo(
@@ -8041,9 +8406,10 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8041
8406
  if (filters.category) updates[filters.category] = true;
8042
8407
  if (filters.subCategory) {
8043
8408
  const parent = categories.find(
8044
- (c) => c.categorySubCategories?.some((sc) => sc.id === filters.subCategory)
8409
+ (c) => c.categorySubCategories?.some((sc) => (sc._id ?? sc.id) === filters.subCategory)
8045
8410
  );
8046
- if (parent?.id) updates[parent.id] = true;
8411
+ const parentId = parent?._id ?? parent?.id;
8412
+ if (parentId) updates[parentId] = true;
8047
8413
  }
8048
8414
  if (Object.keys(updates).length) {
8049
8415
  setExpandedCategories((prev) => ({ ...prev, ...updates }));
@@ -8068,7 +8434,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8068
8434
  let newArrivals2 = 0;
8069
8435
  let inStockCount = 0;
8070
8436
  products.forEach((product) => {
8071
- if (product.inventoryCount > 0) inStockCount += 1;
8437
+ if (product.summary?.totalInventory > 0) inStockCount += 1;
8072
8438
  if (new Date(product.createdAt).getTime() >= monthAgo) newArrivals2 += 1;
8073
8439
  });
8074
8440
  return { newArrivals: newArrivals2, inStockCount };
@@ -8128,9 +8494,9 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8128
8494
  const items = [...filteredProducts];
8129
8495
  switch (sortOption) {
8130
8496
  case "price-low-high":
8131
- return items.sort((a, b) => a.finalPrice - b.finalPrice);
8497
+ return items.sort((a, b) => (a.variants?.[0]?.finalPrice ?? 0) - (b.variants?.[0]?.finalPrice ?? 0));
8132
8498
  case "price-high-low":
8133
- return items.sort((a, b) => b.finalPrice - a.finalPrice);
8499
+ return items.sort((a, b) => (b.variants?.[0]?.finalPrice ?? 0) - (a.variants?.[0]?.finalPrice ?? 0));
8134
8500
  case "newest":
8135
8501
  return items.sort(
8136
8502
  (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
@@ -8388,7 +8754,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8388
8754
  let subName;
8389
8755
  let parentName;
8390
8756
  categories.forEach((cat) => {
8391
- const found = cat.categorySubCategories?.find((sc) => sc.id === subCategoryFilter);
8757
+ const found = cat.categorySubCategories?.find((sc) => (sc._id ?? sc.id) === subCategoryFilter);
8392
8758
  if (found) {
8393
8759
  subName = found.name;
8394
8760
  parentName = cat.name;
@@ -8400,7 +8766,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8400
8766
  onRemove: handleRemoveSubCategory
8401
8767
  });
8402
8768
  if (categoryFilter) {
8403
- const catObj = categories.find((c) => c.id === categoryFilter);
8769
+ const catObj = categories.find((c) => (c._id ?? c.id) === categoryFilter);
8404
8770
  chips.push({
8405
8771
  key: "category",
8406
8772
  label: `Category: ${catObj?.name ?? parentName ?? categoryFilter}`,
@@ -8408,7 +8774,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8408
8774
  });
8409
8775
  }
8410
8776
  } else if (categoryFilter) {
8411
- const category = categories.find((cat) => cat.id === categoryFilter);
8777
+ const category = categories.find((cat) => (cat._id ?? cat.id) === categoryFilter);
8412
8778
  chips.push({
8413
8779
  key: "category",
8414
8780
  label: `Category: ${category?.name ?? categoryFilter}`,
@@ -8521,15 +8887,16 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8521
8887
  }
8522
8888
  ),
8523
8889
  expandedFilterSections.category && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: sortedCategories.map((category) => {
8524
- const isCategoryActive = categoryFilter === category.id;
8525
- const isExpanded = !!expandedCategories[category.id];
8890
+ const categoryId = category._id ?? category.id ?? "";
8891
+ const isCategoryActive = categoryFilter === categoryId;
8892
+ const isExpanded = !!expandedCategories[categoryId];
8526
8893
  const Icon = getCategoryIconForFilter(category.name ?? "");
8527
8894
  return /* @__PURE__ */ jsxs(
8528
8895
  "button",
8529
8896
  {
8530
8897
  onClick: () => {
8531
- if (!isExpanded) toggleCategoryExpand(category.id ?? "");
8532
- handleCategoryChange(category.id ?? "");
8898
+ if (!isExpanded) toggleCategoryExpand(categoryId);
8899
+ handleCategoryChange(categoryId);
8533
8900
  },
8534
8901
  className: `w-full text-left px-4 py-3 rounded-xl font-['Poppins',sans-serif] text-[13px] transition-all flex items-center gap-3 ${isCategoryActive ? "bg-primary text-white shadow-lg" : "text-secondary hover:bg-gray-50 border-2 border-gray-100"}`,
8535
8902
  children: [
@@ -8537,7 +8904,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8537
8904
  category.name
8538
8905
  ]
8539
8906
  },
8540
- category.id
8907
+ categoryId
8541
8908
  );
8542
8909
  }) })
8543
8910
  ] }),
@@ -8719,14 +9086,15 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8719
9086
  ),
8720
9087
  displayCategories.map((category, index) => {
8721
9088
  const Icon = getCategoryIcon(category.name ?? "");
8722
- const isSelected = categoryFilter === category.id;
9089
+ const categoryId = category._id ?? category.id ?? "";
9090
+ const isSelected = categoryFilter === categoryId;
8723
9091
  return /* @__PURE__ */ jsx(
8724
9092
  motion.button,
8725
9093
  {
8726
9094
  initial: { opacity: 0, y: 20 },
8727
9095
  animate: { opacity: 1, y: 0 },
8728
9096
  transition: { delay: index * 0.1 },
8729
- onClick: () => handleCategoryChange(category.id ?? ""),
9097
+ onClick: () => handleCategoryChange(categoryId),
8730
9098
  className: `group relative overflow-hidden rounded-[24px] p-6 min-h-[180px] min-w-[170px] transition-all duration-300 ${isSelected ? "bg-linear-to-br from-primary to-secondary text-white shadow-xl scale-105" : "bg-linear-to-br from-gray-50 to-white hover:shadow-lg border-2 border-gray-100 hover:border-primary"}`,
8731
9099
  children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
8732
9100
  /* @__PURE__ */ jsx("div", { className: `size-12 rounded-full mb-3 mx-auto flex items-center justify-center transition-all ${isSelected ? "bg-white/20" : "bg-linear-to-br from-primary/10 to-secondary/10 group-hover:scale-110"}`, children: /* @__PURE__ */ jsx(Icon, { className: `size-6 ${isSelected ? "text-white" : "text-primary"}` }) }),
@@ -8734,7 +9102,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8734
9102
  /* @__PURE__ */ jsx("p", { className: `font-['Poppins',sans-serif] text-[11px] ${isSelected ? "text-white/80" : "text-muted"}`, children: category.description })
8735
9103
  ] })
8736
9104
  },
8737
- category.id
9105
+ categoryId
8738
9106
  );
8739
9107
  })
8740
9108
  ] })
@@ -8825,9 +9193,11 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8825
9193
  }
8826
9194
  }
8827
9195
  ) }, product._id)) }) : /* @__PURE__ */ jsx("div", { className: "space-y-4", children: displayedProducts.map((product) => {
8828
- product.priceBeforeDiscount && product.priceBeforeDiscount > product.finalPrice ? Math.round(
8829
- (product.priceBeforeDiscount - product.finalPrice) / product.priceBeforeDiscount * 100
8830
- ) : 0;
9196
+ const firstVariant = product.variants?.[0];
9197
+ const displayFinalPrice = firstVariant?.finalPrice ?? 0;
9198
+ const displayRetailPrice = firstVariant?.retailPrice ?? 0;
9199
+ const displayIsDiscounted = firstVariant?.isDiscounted ?? false;
9200
+ const displayInventoryCount = firstVariant?.inventoryCount ?? 0;
8831
9201
  return /* @__PURE__ */ jsxs(
8832
9202
  motion.div,
8833
9203
  {
@@ -8838,29 +9208,26 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8838
9208
  /* @__PURE__ */ jsx("div", { className: "relative h-48 w-full overflow-hidden rounded-2xl bg-gray-100 md:h-40 md:w-40", children: /* @__PURE__ */ jsx(
8839
9209
  Image4,
8840
9210
  {
8841
- src: product.productMedia[0]?.file || "/placeholder-product.jpg",
9211
+ src: product.media?.[0]?.file || "/placeholder-product.jpg",
8842
9212
  alt: product.name,
8843
9213
  fill: true,
8844
9214
  className: "object-cover transition duration-500 group-hover:scale-105"
8845
9215
  }
8846
9216
  ) }),
8847
9217
  /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-3", children: [
8848
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 text-xs font-semibold uppercase tracking-wide text-primary-600", children: [
8849
- product.parentCategories.length > 0 && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-primary-50 px-3 py-1 text-primary-700", children: product.parentCategories.map((category) => category?.name).join(", ") }),
8850
- product.tags?.slice(0, 3).map((tag) => /* @__PURE__ */ jsx(
8851
- "span",
8852
- {
8853
- className: "rounded-full bg-slate-100 px-3 py-1 text-gray-600",
8854
- children: tag
8855
- },
8856
- tag
8857
- ))
8858
- ] }),
9218
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2 text-xs font-semibold uppercase tracking-wide text-primary-600", children: product.tags?.slice(0, 3).map((tag) => /* @__PURE__ */ jsx(
9219
+ "span",
9220
+ {
9221
+ className: "rounded-full bg-slate-100 px-3 py-1 text-gray-600",
9222
+ children: tag
9223
+ },
9224
+ tag
9225
+ )) }),
8859
9226
  /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-gray-900 line-clamp-2", children: product.name }),
8860
9227
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4 text-sm text-gray-500", children: [
8861
9228
  /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2 font-medium text-primary-600", children: [
8862
9229
  /* @__PURE__ */ jsx(ShieldCheck, { className: "h-4 w-4" }),
8863
- product.inventoryCount > 0 ? "In stock & ready to ship" : "Restocking soon"
9230
+ displayInventoryCount > 0 ? "In stock & ready to ship" : "Restocking soon"
8864
9231
  ] }),
8865
9232
  /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
8866
9233
  /* @__PURE__ */ jsx(Clock, { className: "h-4 w-4 text-primary-500" }),
@@ -8871,8 +9238,8 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8871
9238
  ] }),
8872
9239
  /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col items-end gap-3 md:w-auto", children: [
8873
9240
  /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
8874
- /* @__PURE__ */ jsx("p", { className: "text-3xl font-semibold text-gray-900", children: formatPrice(product.finalPrice) }),
8875
- product.isDiscounted && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-400 line-through", children: formatPrice(product.priceBeforeDiscount) })
9241
+ /* @__PURE__ */ jsx("p", { className: "text-3xl font-semibold text-gray-900", children: formatPrice(displayFinalPrice) }),
9242
+ displayIsDiscounted && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-400 line-through", children: formatPrice(displayRetailPrice) })
8876
9243
  ] }),
8877
9244
  /* @__PURE__ */ jsx(
8878
9245
  "button",
@@ -8964,21 +9331,21 @@ function ProductDetailScreen({ productId }) {
8964
9331
  return initialProductData;
8965
9332
  }
8966
9333
  if (!productData) return null;
8967
- if (productData.productVariants?.length && selectedVariant) {
9334
+ if (productData.variants?.length && selectedVariant) {
8968
9335
  return {
8969
9336
  ...productData,
8970
9337
  price: selectedVariant.finalPrice,
8971
9338
  inStock: selectedVariant.isActive,
8972
9339
  sku: selectedVariant.sku || productData.sku,
8973
- variantId: selectedVariant.id,
9340
+ variantId: selectedVariant._id,
8974
9341
  variantName: selectedVariant.name
8975
9342
  };
8976
9343
  }
8977
9344
  return productData;
8978
9345
  }, [productData, selectedVariant, initialProductData]);
8979
9346
  const getVariantImages = () => {
8980
- if (selectedVariant?.productMedia?.length) {
8981
- return selectedVariant.productMedia.map((media) => ({
9347
+ if (selectedVariant?.media?.length) {
9348
+ return selectedVariant.media.map((media) => ({
8982
9349
  src: media.file,
8983
9350
  width: 800,
8984
9351
  height: 1e3,
@@ -8987,8 +9354,8 @@ function ProductDetailScreen({ productId }) {
8987
9354
  url: media.file
8988
9355
  }));
8989
9356
  }
8990
- if (product?.productMedia?.length) {
8991
- return product.productMedia.map((media) => ({
9357
+ if (product?.media?.length) {
9358
+ return product.media.map((media) => ({
8992
9359
  src: media.file,
8993
9360
  width: 800,
8994
9361
  height: 1e3,
@@ -8997,14 +9364,14 @@ function ProductDetailScreen({ productId }) {
8997
9364
  url: media.file
8998
9365
  }));
8999
9366
  }
9000
- if (product?.images?.length) {
9001
- return product.images.map((image) => ({
9002
- src: image,
9367
+ if (product?.media?.length) {
9368
+ return product.media.map((media) => ({
9369
+ src: media.file,
9003
9370
  width: 800,
9004
9371
  height: 1e3,
9005
9372
  alt: product?.name || "Product image",
9006
- url: image,
9007
- file: image,
9373
+ url: media.file,
9374
+ file: media.file,
9008
9375
  type: "image"
9009
9376
  }));
9010
9377
  }
@@ -9040,23 +9407,18 @@ function ProductDetailScreen({ productId }) {
9040
9407
  }
9041
9408
  }, [product?.productVariants]);
9042
9409
  useEffect(() => {
9043
- if (!product?.id) return;
9410
+ if (!product?._id) return;
9044
9411
  const fetchRelated = async () => {
9045
9412
  try {
9046
- const response = await new ProductsApi(AXIOS_CONFIG).getRelatedProducts(product.id, {
9047
- params: {
9048
- limit: 4
9049
- }
9050
- });
9413
+ const response = await new ProductsApi(AXIOS_CONFIG).getRelatedProducts(product._id, 4);
9414
+ console.log("response.data", response.data);
9051
9415
  setRelatedProducts(response.data || []);
9052
9416
  } catch (error) {
9053
9417
  console.error("Failed to fetch related products", error);
9054
9418
  }
9055
9419
  };
9056
9420
  fetchRelated();
9057
- return () => {
9058
- };
9059
- }, [product?.id]);
9421
+ }, [product?._id]);
9060
9422
  const handleVariantSelect = async (variant) => {
9061
9423
  setSelectedVariant(variant);
9062
9424
  setActiveImageIndex(0);
@@ -9074,9 +9436,9 @@ function ProductDetailScreen({ productId }) {
9074
9436
  setIsAddingToCart(true);
9075
9437
  try {
9076
9438
  await addToCart(
9077
- product.id,
9439
+ product._id,
9078
9440
  quantity,
9079
- selectedVariant.id
9441
+ selectedVariant._id
9080
9442
  );
9081
9443
  notification.success(
9082
9444
  "Added to cart",
@@ -9095,14 +9457,14 @@ function ProductDetailScreen({ productId }) {
9095
9457
  const { addToWishlist, removeFromWishlist, isInWishlist } = useWishlist();
9096
9458
  useEffect(() => {
9097
9459
  if (product) {
9098
- setIsFavorited(isInWishlist(product.id));
9460
+ setIsFavorited(isInWishlist(product._id));
9099
9461
  }
9100
9462
  }, [product, isInWishlist]);
9101
9463
  const handleToggleFavorite = async () => {
9102
9464
  if (!product) return;
9103
9465
  try {
9104
9466
  if (isFavorited) {
9105
- await removeFromWishlist(product.id);
9467
+ await removeFromWishlist(product._id);
9106
9468
  notification.info(
9107
9469
  "Removed from saved items",
9108
9470
  `${product.name} was removed from your saved items.`
@@ -9143,7 +9505,7 @@ function ProductDetailScreen({ productId }) {
9143
9505
  /* @__PURE__ */ jsx(Sparkles, { className: "mx-auto h-10 w-10 text-primary-500" }),
9144
9506
  /* @__PURE__ */ jsx("h1", { className: "mt-6 text-2xl font-semibold text-gray-900", children: "Product not found" }),
9145
9507
  /* @__PURE__ */ jsx("p", { className: "mt-2 text-gray-600", children: "It may have been removed or is temporarily unavailable. Discover other pharmacy essentials in our catalogue." }),
9146
- /* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsx(Link7, { href: "/shop", className: "inline-block", children: /* @__PURE__ */ jsx(Button, { children: "Browse products" }) }) })
9508
+ /* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsx(Link9, { href: "/shop", className: "inline-block", children: /* @__PURE__ */ jsx(Button, { children: "Browse products" }) }) })
9147
9509
  ] }) }) });
9148
9510
  }
9149
9511
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-white", children: [
@@ -9197,7 +9559,7 @@ function ProductDetailScreen({ productId }) {
9197
9559
  ] }) }) })
9198
9560
  ]
9199
9561
  },
9200
- selectedVariant?.id || "default"
9562
+ selectedVariant?._id || "default"
9201
9563
  ),
9202
9564
  variantImages.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-8 gap-2", children: variantImages.map((image, index) => /* @__PURE__ */ jsx(
9203
9565
  "button",
@@ -9225,7 +9587,7 @@ function ProductDetailScreen({ productId }) {
9225
9587
  /* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[12px] text-primary uppercase tracking-wide font-medium mb-2", children: [
9226
9588
  product.brand,
9227
9589
  " \u2022 ",
9228
- product.parentCategories?.[0]?.name || "Uncategorized"
9590
+ product.categoryIds?.[0]?.name || "Uncategorized"
9229
9591
  ] }),
9230
9592
  /* @__PURE__ */ jsx("h1", { className: "text-3xl font-['Poppins',sans-serif] font-semibold text-secondary tracking-[-1.5px] mb-3", children: selectedVariant?.name || product.name }),
9231
9593
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
@@ -9243,7 +9605,7 @@ function ProductDetailScreen({ productId }) {
9243
9605
  " reviews)"
9244
9606
  ] })
9245
9607
  ] }),
9246
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-6 pb-6 border-b-2 border-gray-100", children: [
9608
+ selectedVariant && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-6 pb-6 border-b-2 border-gray-100", children: [
9247
9609
  /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] font-bold text-[40px] text-[#E67E50]", children: [
9248
9610
  "$",
9249
9611
  variantPrice.toFixed(2)
@@ -9260,10 +9622,10 @@ function ProductDetailScreen({ productId }) {
9260
9622
  ] })
9261
9623
  ] }),
9262
9624
  selectedVariant && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
9263
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 mb-2", children: selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */ || selectedVariant.inventoryStatus === "LOW_STOCK" /* LOWSTOCK */ ? /* @__PURE__ */ jsxs(Fragment, { children: [
9625
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 mb-2", children: selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */ ? /* @__PURE__ */ jsxs(Fragment, { children: [
9264
9626
  /* @__PURE__ */ jsx("div", { className: "size-3 rounded-full bg-red-500" }),
9265
9627
  /* @__PURE__ */ jsx("span", { className: "font-['Poppins',sans-serif] text-[13px] text-red-600 font-medium", children: "Out of Stock" })
9266
- ] }) : selectedVariant.inventoryCount <= 10 ? /* @__PURE__ */ jsxs(Fragment, { children: [
9628
+ ] }) : selectedVariant.inventoryStatus === "LOW_STOCK" /* LOWSTOCK */ || selectedVariant.inventoryCount <= 10 ? /* @__PURE__ */ jsxs(Fragment, { children: [
9267
9629
  /* @__PURE__ */ jsx("div", { className: "size-3 rounded-full bg-primary animate-pulse" }),
9268
9630
  /* @__PURE__ */ jsxs("span", { className: "font-['Poppins',sans-serif] text-[13px] text-primary font-medium", children: [
9269
9631
  "Only ",
@@ -9276,7 +9638,7 @@ function ProductDetailScreen({ productId }) {
9276
9638
  ] }) }),
9277
9639
  /* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[12px] text-muted", children: [
9278
9640
  "SKU: ",
9279
- selectedVariant?.sku
9641
+ selectedVariant?.sku || product?.sku
9280
9642
  ] })
9281
9643
  ] }),
9282
9644
  product.description && /* @__PURE__ */ jsx(
@@ -9286,11 +9648,11 @@ function ProductDetailScreen({ productId }) {
9286
9648
  dangerouslySetInnerHTML: { __html: product.description }
9287
9649
  }
9288
9650
  ),
9289
- product?.productVariants && product.productVariants.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
9651
+ product?.variants && product.variants.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
9290
9652
  /* @__PURE__ */ jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
9291
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: product.productVariants.map((variant) => {
9292
- const isSelected = selectedVariant?.id === variant.id;
9293
- const variantImage = variant.productMedia?.[0]?.file || product.productMedia?.[0]?.file || product.images?.[0] || "/placeholder-product.jpg";
9653
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant) => {
9654
+ const isSelected = selectedVariant?._id === variant._id;
9655
+ const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.jpg";
9294
9656
  return /* @__PURE__ */ jsxs(
9295
9657
  "button",
9296
9658
  {
@@ -9318,7 +9680,7 @@ function ProductDetailScreen({ productId }) {
9318
9680
  isSelected && /* @__PURE__ */ jsx(Check, { className: "h-5 w-5 text-secondary shrink-0" })
9319
9681
  ]
9320
9682
  },
9321
- variant.id
9683
+ variant._id
9322
9684
  );
9323
9685
  }) })
9324
9686
  ] }),
@@ -9359,13 +9721,13 @@ function ProductDetailScreen({ productId }) {
9359
9721
  {
9360
9722
  className: "flex-1 font-['Poppins',sans-serif] font-medium text-[14px] px-8 py-4 rounded-full transition-all duration-300 flex items-center justify-center gap-3 bg-[#E67E50] text-white hover:bg-[#d66f45] hover:shadow-lg disabled:opacity-50 disabled:cursor-not-allowed",
9361
9723
  onClick: handleAddToCart,
9362
- disabled: !selectedVariant || selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */,
9724
+ disabled: !selectedVariant || selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */ || isAddingToCart,
9363
9725
  children: isAddingToCart ? /* @__PURE__ */ jsxs(Fragment, { children: [
9364
9726
  /* @__PURE__ */ jsxs("svg", { className: "animate-spin h-5 w-5", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
9365
9727
  /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
9366
9728
  /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
9367
9729
  ] }),
9368
- "Loading..."
9730
+ "Adding..."
9369
9731
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9370
9732
  /* @__PURE__ */ jsx(ShoppingCart, { className: "h-4 w-4" }),
9371
9733
  !selectedVariant ? "Select a variant" : selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */ ? "Out of Stock" : "Add to Cart"
@@ -9467,7 +9829,7 @@ function ProductDetailScreen({ productId }) {
9467
9829
  router.push(buildPath(`/products/${item._id || item.id}`));
9468
9830
  }
9469
9831
  },
9470
- relatedProduct.id
9832
+ relatedProduct._id
9471
9833
  )) })
9472
9834
  ] })
9473
9835
  ] }) }) })
@@ -9508,7 +9870,7 @@ function CartItem({ item }) {
9508
9870
  /* @__PURE__ */ jsx("div", { className: "w-28 h-28 rounded-[16px] overflow-hidden bg-gray-50 shrink-0", children: /* @__PURE__ */ jsx(
9509
9871
  Image4,
9510
9872
  {
9511
- src: item.productVariantData.productMedia[0]?.file || "/placeholder-product.jpg",
9873
+ src: item.productVariantData.media[0]?.file || "/placeholder-product.jpg",
9512
9874
  alt: item.productVariantData.name,
9513
9875
  className: "w-full h-full object-cover",
9514
9876
  height: 112,
@@ -9619,7 +9981,7 @@ function CartScreen() {
9619
9981
  }
9620
9982
  ) }) }) }) });
9621
9983
  }
9622
- const subtotal = cart.total;
9984
+ const subtotal = cart.cartBody.items.reduce((total2, item) => total2 + item.productVariantData.finalPrice * item.quantity, 0);
9623
9985
  const shipping = 0;
9624
9986
  const tax = 0;
9625
9987
  const total = subtotal + shipping + tax;
@@ -9746,7 +10108,9 @@ function useAddresses() {
9746
10108
  const sortedAddresses = useMemo(() => {
9747
10109
  return [...addresses].sort((a, b) => {
9748
10110
  if (a.isDefault === b.isDefault) {
9749
- return (b.updatedAt.toISOString() || "").localeCompare(a.updatedAt.toISOString() || "");
10111
+ const dateA = a.updatedAt || "";
10112
+ const dateB = b.updatedAt || "";
10113
+ return dateB.toString().localeCompare(dateA.toString());
9750
10114
  }
9751
10115
  return a.isDefault ? -1 : 1;
9752
10116
  });
@@ -9849,7 +10213,7 @@ var addressSchema = z.object({
9849
10213
  state: z.string().min(2, "State is required"),
9850
10214
  zip: z.string().min(4, "ZIP code is required"),
9851
10215
  country: z.string().min(2, "Country is required"),
9852
- phone: z.string().min(10, "Phone number is required")
10216
+ phone: z.string().min(10, "Phone number must be at least 10 characters").optional().or(z.literal(""))
9853
10217
  });
9854
10218
  function AddressFormModal({ isOpen, onClose, onAddressAdded, onAddressUpdated, initialAddress }) {
9855
10219
  const [isSubmitting, setIsSubmitting] = useState(false);
@@ -10106,13 +10470,21 @@ function CheckoutScreen() {
10106
10470
  sameAsShipping: true,
10107
10471
  shipping: {
10108
10472
  name: user ? `${user.firstname} ${user.lastname}` : "",
10109
- phone: user?.phoneNumber || void 0,
10473
+ phone: user?.phoneNumber || "",
10110
10474
  country: "United States"
10475
+ // street1: '',
10476
+ // city: '',
10477
+ // state: '',
10478
+ // zip: '',
10111
10479
  },
10112
10480
  billing: {
10113
10481
  name: user ? `${user.firstname} ${user.lastname}` : "",
10114
- phone: user?.phoneNumber || void 0,
10482
+ phone: user?.phoneNumber || "",
10115
10483
  country: "United States"
10484
+ // street1: '',
10485
+ // city: '',
10486
+ // state: '',
10487
+ // zip: '',
10116
10488
  }
10117
10489
  }
10118
10490
  });
@@ -10133,7 +10505,7 @@ function CheckoutScreen() {
10133
10505
  if (defaultAddress && !selectedAddressId) {
10134
10506
  setSelectedAddressId(defaultAddress.id);
10135
10507
  setValue("shipping.name", defaultAddress.name);
10136
- setValue("shipping.phone", defaultAddress.phone || void 0);
10508
+ setValue("shipping.phone", defaultAddress.phone || "");
10137
10509
  setValue("shipping.street1", defaultAddress.street1);
10138
10510
  setValue("shipping.street2", defaultAddress.street2 || "");
10139
10511
  setValue("shipping.city", defaultAddress.city);
@@ -10281,7 +10653,6 @@ function CheckoutScreen() {
10281
10653
  items,
10282
10654
  paymentMethod,
10283
10655
  orderStatus: "Pending",
10284
- chargeTax: true,
10285
10656
  orderRemindingDates: [],
10286
10657
  shippingAddress: data.shipping,
10287
10658
  billingAddress: sameAsShipping ? data.shipping : data.billing
@@ -10290,7 +10661,8 @@ function CheckoutScreen() {
10290
10661
  const response = await api.createCheckout(
10291
10662
  orderDTO,
10292
10663
  isDelivery,
10293
- user?.id,
10664
+ void 0,
10665
+ // dont pass userId
10294
10666
  isDelivery ? selectedShippingRateId || void 0 : void 0,
10295
10667
  billingAddressId
10296
10668
  );
@@ -10359,7 +10731,7 @@ function CheckoutScreen() {
10359
10731
  router.push(buildPath("/cart"));
10360
10732
  return null;
10361
10733
  }
10362
- const subtotal = cart.total;
10734
+ const subtotal = cart.cartBody.items.reduce((total2, item) => total2 + item.productVariantData.finalPrice * item.quantity, 0);
10363
10735
  const tax = 0;
10364
10736
  const total = subtotal + shippingPrice + tax;
10365
10737
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-white pb-16", children: [
@@ -10422,7 +10794,7 @@ function CheckoutScreen() {
10422
10794
  onChange: () => {
10423
10795
  setSelectedAddressId(addr.id);
10424
10796
  setValue("shipping.name", addr.name);
10425
- setValue("shipping.phone", addr.phone || void 0);
10797
+ setValue("shipping.phone", addr.phone || "");
10426
10798
  setValue("shipping.street1", addr.street1);
10427
10799
  setValue("shipping.street2", addr.street2 || "");
10428
10800
  setValue("shipping.city", addr.city);
@@ -10728,7 +11100,7 @@ function CheckoutScreen() {
10728
11100
  /* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
10729
11101
  /* @__PURE__ */ jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
10730
11102
  /* @__PURE__ */ jsx("div", { className: "space-y-4 mb-6", children: cart?.cartBody?.items?.map((item) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
10731
- /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsx(Image4, { src: item.productVariantData.productMedia?.[0]?.file || "/placeholder-product.jpg", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
11103
+ /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsx(Image4, { src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
10732
11104
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
10733
11105
  /* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
10734
11106
  /* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
@@ -10738,7 +11110,7 @@ function CheckoutScreen() {
10738
11110
  ] }),
10739
11111
  /* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] font-semibold text-[12px] text-[#E67E50] mt-1", children: formatPrice(item.productVariantData.finalPrice * item.quantity) })
10740
11112
  ] })
10741
- ] }, `${item.productId}-${item.color}-${item.size}`)) }),
11113
+ ] }, item.productVariantId || item.id)) }),
10742
11114
  /* @__PURE__ */ jsx("div", { className: "h-px bg-[#5B9BD5]/20 my-4" }),
10743
11115
  /* @__PURE__ */ jsxs("div", { className: "text-sm text-slate-600 space-y-3 py-4", children: [
10744
11116
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
@@ -10768,11 +11140,35 @@ function CheckoutScreen() {
10768
11140
  /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4 shrink-0 mt-0.5" }),
10769
11141
  /* @__PURE__ */ jsx("span", { children: error })
10770
11142
  ] }) }),
11143
+ Object.keys(errors).length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-4 p-4 rounded-xl bg-amber-50 border border-amber-200 text-amber-700 text-sm font-medium", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
11144
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4 shrink-0 mt-0.5" }),
11145
+ /* @__PURE__ */ jsxs("div", { children: [
11146
+ /* @__PURE__ */ jsx("p", { className: "font-semibold mb-1", children: "Please fix the following errors:" }),
11147
+ /* @__PURE__ */ jsxs("ul", { className: "list-disc list-inside space-y-1", children: [
11148
+ errors.shipping?.name && /* @__PURE__ */ jsx("li", { children: errors.shipping.name.message }),
11149
+ errors.shipping?.phone && /* @__PURE__ */ jsx("li", { children: errors.shipping.phone.message }),
11150
+ errors.shipping?.street1 && /* @__PURE__ */ jsx("li", { children: errors.shipping.street1.message }),
11151
+ errors.shipping?.city && /* @__PURE__ */ jsx("li", { children: errors.shipping.city.message }),
11152
+ errors.shipping?.state && /* @__PURE__ */ jsx("li", { children: errors.shipping.state.message }),
11153
+ errors.shipping?.zip && /* @__PURE__ */ jsx("li", { children: errors.shipping.zip.message }),
11154
+ errors.shipping?.country && /* @__PURE__ */ jsx("li", { children: errors.shipping.country.message }),
11155
+ !sameAsShipping && errors.billing?.name && /* @__PURE__ */ jsxs("li", { children: [
11156
+ "Billing: ",
11157
+ errors.billing.name.message
11158
+ ] }),
11159
+ !sameAsShipping && errors.billing?.street1 && /* @__PURE__ */ jsxs("li", { children: [
11160
+ "Billing: ",
11161
+ errors.billing.street1.message
11162
+ ] })
11163
+ ] })
11164
+ ] })
11165
+ ] }) }),
10771
11166
  /* @__PURE__ */ jsxs(
10772
11167
  "button",
10773
11168
  {
10774
11169
  type: "submit",
10775
- className: "font-['Poppins',sans-serif] font-medium text-[14px] px-6 py-3 rounded-full text-white hover:bg-[#d66f45] hover:shadow-lg transition-all duration-300 mt-4 w-full bg-[#E67E50] hover:bg-[#2B4B7C] flex items-center justify-center gap-2",
11170
+ disabled: isSubmitting,
11171
+ className: "font-['Poppins',sans-serif] font-medium text-[14px] px-6 py-3 rounded-full text-white hover:bg-[#d66f45] hover:shadow-lg transition-all duration-300 mt-4 w-full bg-[#E67E50] hover:bg-[#2B4B7C] flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",
10776
11172
  children: [
10777
11173
  /* @__PURE__ */ jsx(CreditCard, { className: "h-5 w-5" }),
10778
11174
  isSubmitting ? "Placing order..." : "Place Secure Order"
@@ -10797,7 +11193,7 @@ function CheckoutScreen() {
10797
11193
  refresh().then(() => {
10798
11194
  setSelectedAddressId(addr.id);
10799
11195
  setValue("shipping.name", addr.name);
10800
- setValue("shipping.phone", addr.phone || void 0);
11196
+ setValue("shipping.phone", addr.phone || "");
10801
11197
  setValue("shipping.street1", addr.street1);
10802
11198
  setValue("shipping.street2", addr.street2 || "");
10803
11199
  setValue("shipping.city", addr.city);
@@ -10939,7 +11335,7 @@ function LoginScreen() {
10939
11335
  "Remember me"
10940
11336
  ] }),
10941
11337
  /* @__PURE__ */ jsx(
10942
- Link7,
11338
+ Link9,
10943
11339
  {
10944
11340
  href: buildPath("/forgot-password"),
10945
11341
  className: "font-medium text-primary transition hover:opacity-80",
@@ -10961,15 +11357,15 @@ function LoginScreen() {
10961
11357
  ),
10962
11358
  /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs("p", { className: "text-muted", children: [
10963
11359
  "Don't have an account? ",
10964
- /* @__PURE__ */ jsx(Link7, { href: buildPath("/register"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign up" })
11360
+ /* @__PURE__ */ jsx(Link9, { href: buildPath("/register"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign up" })
10965
11361
  ] }) })
10966
11362
  ] })
10967
11363
  }
10968
11364
  ) }) });
10969
11365
  }
10970
11366
  var registerSchema = z.object({
10971
- firstName: z.string().min(2, "First name is required"),
10972
- lastName: z.string().min(2, "Last name is required"),
11367
+ firstname: z.string().min(2, "First name is required"),
11368
+ lastname: z.string().min(2, "Last name is required"),
10973
11369
  email: z.string().email("Enter a valid email"),
10974
11370
  phone: z.string().optional(),
10975
11371
  password: z.string().min(6, "Password must be at least 6 characters"),
@@ -11024,90 +11420,411 @@ function RegisterScreen() {
11024
11420
  animate: { opacity: 1, x: 0 },
11025
11421
  transition: { duration: 0.4 },
11026
11422
  className: "flex items-center justify-center px-6 py-12 lg:px-16",
11027
- children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-xl space-y-10 text-center", children: [
11423
+ children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-xl space-y-10 text-center", children: [
11424
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
11425
+ /* @__PURE__ */ jsx(UserPlus, { strokeWidth: 2, className: "h-16 w-16 mx-auto text-white rounded-full bg-primary m-2 mb-4 px-4" }),
11426
+ /* @__PURE__ */ jsx("h2", { className: "text-4xl text-secondary", children: "Create Your Account" }),
11427
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted", children: "Join Holmdel Pharmacy Care for convenient healthcare access" })
11428
+ ] }),
11429
+ /* @__PURE__ */ jsxs(
11430
+ "form",
11431
+ {
11432
+ onSubmit: handleSubmit(onSubmit),
11433
+ className: "text-start space-y-6 rounded-3xl border border-slate-100 bg-white p-8 shadow-lg shadow-primary-50",
11434
+ style: {
11435
+ boxShadow: "0px 4px 6px -4px #0000001A, 0px 10px 15px -3px #0000001A"
11436
+ },
11437
+ children: [
11438
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2 text-start", children: [
11439
+ /* @__PURE__ */ jsxs("div", { children: [
11440
+ /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11441
+ "First name ",
11442
+ /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11443
+ ] }),
11444
+ /* @__PURE__ */ jsx(
11445
+ Input,
11446
+ {
11447
+ placeholder: "Alex",
11448
+ ...register("firstname"),
11449
+ error: errors.firstname?.message
11450
+ }
11451
+ )
11452
+ ] }),
11453
+ /* @__PURE__ */ jsxs("div", { children: [
11454
+ /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11455
+ "Last name ",
11456
+ /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11457
+ ] }),
11458
+ /* @__PURE__ */ jsx(
11459
+ Input,
11460
+ {
11461
+ placeholder: "Morgan",
11462
+ ...register("lastname"),
11463
+ error: errors.lastname?.message
11464
+ }
11465
+ )
11466
+ ] })
11467
+ ] }),
11468
+ /* @__PURE__ */ jsxs("div", { children: [
11469
+ /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11470
+ "Email Address ",
11471
+ /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11472
+ ] }),
11473
+ /* @__PURE__ */ jsx(
11474
+ Input,
11475
+ {
11476
+ type: "email",
11477
+ placeholder: "you@example.com",
11478
+ ...register("email"),
11479
+ error: errors.email?.message
11480
+ }
11481
+ )
11482
+ ] }),
11483
+ /* @__PURE__ */ jsxs("div", { children: [
11484
+ /* @__PURE__ */ jsx("h2", { className: "text-sm text-secondary mb-3", children: "Phone Number" }),
11485
+ /* @__PURE__ */ jsx(
11486
+ Input,
11487
+ {
11488
+ type: "tel",
11489
+ placeholder: "+1 (555) 123-4567",
11490
+ ...register("phone"),
11491
+ error: errors.phone?.message
11492
+ }
11493
+ )
11494
+ ] }),
11495
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
11496
+ /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11497
+ "Password ",
11498
+ /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11499
+ ] }),
11500
+ /* @__PURE__ */ jsx(
11501
+ Input,
11502
+ {
11503
+ type: showPassword ? "text" : "password",
11504
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
11505
+ ...register("password"),
11506
+ error: errors.password?.message
11507
+ }
11508
+ ),
11509
+ /* @__PURE__ */ jsx(
11510
+ "button",
11511
+ {
11512
+ type: "button",
11513
+ onClick: () => setShowPassword((prev) => !prev),
11514
+ className: "absolute right-3 top-[42px] text-slate-400 transition hover:text-slate-600",
11515
+ children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx(Eye, { className: "h-5 w-5" })
11516
+ }
11517
+ )
11518
+ ] }),
11519
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
11520
+ /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11521
+ "Confirm Password ",
11522
+ /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11523
+ ] }),
11524
+ /* @__PURE__ */ jsx(
11525
+ Input,
11526
+ {
11527
+ type: showConfirmPassword ? "text" : "password",
11528
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
11529
+ ...register("confirmPassword"),
11530
+ error: errors.confirmPassword?.message
11531
+ }
11532
+ ),
11533
+ /* @__PURE__ */ jsx(
11534
+ "button",
11535
+ {
11536
+ type: "button",
11537
+ onClick: () => setShowConfirmPassword((prev) => !prev),
11538
+ className: "absolute right-3 top-[42px] text-slate-400 transition hover:text-slate-600",
11539
+ children: showConfirmPassword ? /* @__PURE__ */ jsx(EyeOff, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx(Eye, { className: "h-5 w-5" })
11540
+ }
11541
+ )
11542
+ ] }),
11543
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4 text-sm text-slate-600", children: [
11544
+ /* @__PURE__ */ jsx(Shield, { strokeWidth: 2, className: "mt-0.5 h-8 w-8 text-primary" }),
11545
+ /* @__PURE__ */ jsxs("span", { children: [
11546
+ "By creating an account, you agree to our",
11547
+ " ",
11548
+ /* @__PURE__ */ jsx(Link9, { href: buildPath("/terms"), className: "font-semibold text-primary hover:opacity-70", children: "Terms of Service" }),
11549
+ " ",
11550
+ "and",
11551
+ " ",
11552
+ /* @__PURE__ */ jsx(
11553
+ Link9,
11554
+ {
11555
+ href: buildPath("/privacy"),
11556
+ className: "font-semibold text-primary hover:opacity-70",
11557
+ children: "Privacy Policy"
11558
+ }
11559
+ ),
11560
+ ". We protect your information with bank-level encryption."
11561
+ ] })
11562
+ ] }),
11563
+ /* @__PURE__ */ jsx(
11564
+ "button",
11565
+ {
11566
+ type: "submit",
11567
+ disabled: isSubmitting,
11568
+ className: "w-full bg-secondary hover:opacity-80 text-white font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-70 disabled:cursor-not-allowed",
11569
+ children: isSubmitting ? "Creating account..." : "Create my account"
11570
+ }
11571
+ )
11572
+ ]
11573
+ }
11574
+ ),
11575
+ /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs("p", { className: "text-muted", children: [
11576
+ "Already have an account? ",
11577
+ /* @__PURE__ */ jsx(Link9, { href: buildPath("/login"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign in" })
11578
+ ] }) })
11579
+ ] })
11580
+ }
11581
+ ) }) });
11582
+ }
11583
+ init_sharedConfig();
11584
+ var forgotPasswordSchema = z.object({
11585
+ email: z.string().email("Enter a valid email address")
11586
+ });
11587
+ function ForgotPasswordScreen() {
11588
+ const { buildPath } = useBasePath();
11589
+ const [isSubmitting, setIsSubmitting] = useState(false);
11590
+ const [status, setStatus] = useState(
11591
+ null
11592
+ );
11593
+ const {
11594
+ register,
11595
+ handleSubmit,
11596
+ formState: { errors }
11597
+ } = useForm({
11598
+ resolver: zodResolver(forgotPasswordSchema)
11599
+ });
11600
+ const onSubmit = async (data) => {
11601
+ setIsSubmitting(true);
11602
+ setStatus(null);
11603
+ try {
11604
+ const authApi = new AuthApi(AXIOS_CONFIG);
11605
+ await authApi.sendForgetPasswordEmail({ email: data.email });
11606
+ setStatus({
11607
+ type: "success",
11608
+ message: "Password reset link sent! Check your email inbox."
11609
+ });
11610
+ } catch (error) {
11611
+ setStatus({
11612
+ type: "error",
11613
+ message: error?.response?.data?.message || "Unable to send reset email. Please try again."
11614
+ });
11615
+ } finally {
11616
+ setIsSubmitting(false);
11617
+ }
11618
+ };
11619
+ return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB]", children: /* @__PURE__ */ jsx("div", { className: "grid min-h-screen overflow-hidden pb-12", children: /* @__PURE__ */ jsx(
11620
+ motion.section,
11621
+ {
11622
+ initial: { opacity: 0, x: 24 },
11623
+ animate: { opacity: 1, x: 0 },
11624
+ transition: { duration: 0.4 },
11625
+ className: "flex items-center justify-center px-6 py-12 lg:px-16",
11626
+ children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-lg space-y-10 text-center", children: [
11627
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
11628
+ /* @__PURE__ */ jsx(
11629
+ Mail,
11630
+ {
11631
+ strokeWidth: 2,
11632
+ className: "h-16 w-16 mx-auto text-white rounded-full bg-secondary m-2 mb-4 px-4"
11633
+ }
11634
+ ),
11635
+ /* @__PURE__ */ jsx("h2", { className: "text-4xl text-secondary", children: "Forgot Password?" }),
11636
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted", children: "No worries! Enter your email and we'll send you reset instructions." })
11637
+ ] }),
11638
+ /* @__PURE__ */ jsxs(
11639
+ "form",
11640
+ {
11641
+ onSubmit: handleSubmit(onSubmit),
11642
+ className: "space-y-6 rounded-3xl border bg-white p-8",
11643
+ style: {
11644
+ boxShadow: "0px 4px 6px -4px #0000001A, 0px 10px 15px -3px #0000001A"
11645
+ },
11646
+ children: [
11647
+ status && /* @__PURE__ */ jsxs(
11648
+ "div",
11649
+ {
11650
+ className: `flex items-start gap-2 rounded-2xl border px-4 py-3 text-sm ${status.type === "success" ? "border-green-200 bg-green-50 text-green-800" : "border-red-200 bg-red-50 text-red-700"}`,
11651
+ children: [
11652
+ /* @__PURE__ */ jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
11653
+ /* @__PURE__ */ jsx("span", { children: status.message })
11654
+ ]
11655
+ }
11656
+ ),
11657
+ /* @__PURE__ */ jsxs("div", { className: "text-start text-secondary", children: [
11658
+ /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11659
+ "Email Address ",
11660
+ /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11661
+ ] }),
11662
+ /* @__PURE__ */ jsx(
11663
+ Input,
11664
+ {
11665
+ type: "email",
11666
+ placeholder: "you@example.com",
11667
+ ...register("email"),
11668
+ error: errors.email?.message,
11669
+ className: "text-secondary"
11670
+ }
11671
+ )
11672
+ ] }),
11673
+ /* @__PURE__ */ jsx(
11674
+ "button",
11675
+ {
11676
+ type: "submit",
11677
+ disabled: isSubmitting,
11678
+ className: "w-full bg-secondary hover:opacity-80 text-white font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-70 disabled:cursor-not-allowed flex items-center justify-center gap-2",
11679
+ children: isSubmitting ? "Sending..." : /* @__PURE__ */ jsxs(Fragment, { children: [
11680
+ /* @__PURE__ */ jsx(Send, { className: "h-4 w-4" }),
11681
+ "Send Reset Link"
11682
+ ] })
11683
+ }
11684
+ ),
11685
+ /* @__PURE__ */ jsx("div", { className: "pt-4 border-t border-slate-200", children: /* @__PURE__ */ jsxs(
11686
+ Link9,
11687
+ {
11688
+ href: buildPath("/login"),
11689
+ className: "flex items-center justify-center gap-2 text-sm font-medium text-primary transition hover:opacity-80",
11690
+ children: [
11691
+ /* @__PURE__ */ jsx(ArrowLeft, { className: "h-4 w-4" }),
11692
+ "Back to login"
11693
+ ]
11694
+ }
11695
+ ) })
11696
+ ]
11697
+ }
11698
+ ),
11699
+ /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs("p", { className: "text-muted", children: [
11700
+ "Don't have an account?",
11701
+ " ",
11702
+ /* @__PURE__ */ jsx(
11703
+ Link9,
11704
+ {
11705
+ href: buildPath("/register"),
11706
+ className: "font-medium text-primary transition hover:opacity-90",
11707
+ children: "Sign up"
11708
+ }
11709
+ )
11710
+ ] }) })
11711
+ ] })
11712
+ }
11713
+ ) }) });
11714
+ }
11715
+ init_sharedConfig();
11716
+ var resetPasswordSchema = z.object({
11717
+ newPassword: z.string().min(8, "Password must be at least 8 characters"),
11718
+ confirmPassword: z.string().min(8, "Confirm your new password")
11719
+ }).refine((data) => data.newPassword === data.confirmPassword, {
11720
+ path: ["confirmPassword"],
11721
+ message: "Passwords do not match"
11722
+ });
11723
+ function ResetPasswordScreen() {
11724
+ const router = useRouter();
11725
+ const { buildPath } = useBasePath();
11726
+ const params = useParams();
11727
+ const token = params?.token;
11728
+ params?.storeId;
11729
+ const [showPassword, setShowPassword] = useState(false);
11730
+ const [showConfirmPassword, setShowConfirmPassword] = useState(false);
11731
+ const [isSubmitting, setIsSubmitting] = useState(false);
11732
+ const [status, setStatus] = useState(
11733
+ null
11734
+ );
11735
+ const {
11736
+ register,
11737
+ handleSubmit,
11738
+ formState: { errors }
11739
+ } = useForm({
11740
+ resolver: zodResolver(resetPasswordSchema)
11741
+ });
11742
+ useEffect(() => {
11743
+ if (!token) {
11744
+ setStatus({
11745
+ type: "error",
11746
+ message: "Invalid or missing reset token. Please request a new password reset link."
11747
+ });
11748
+ }
11749
+ }, [token]);
11750
+ const onSubmit = async (data) => {
11751
+ if (!token) {
11752
+ setStatus({
11753
+ type: "error",
11754
+ message: "Reset token is missing. Please use the link from your email."
11755
+ });
11756
+ return;
11757
+ }
11758
+ setIsSubmitting(true);
11759
+ setStatus(null);
11760
+ try {
11761
+ const authApi = new AuthApi(AXIOS_CONFIG);
11762
+ await authApi.resetPassword(data.newPassword, token);
11763
+ setStatus({
11764
+ type: "success",
11765
+ message: "Password reset successfully! Redirecting to login..."
11766
+ });
11767
+ setTimeout(() => router.push(buildPath("/login")), 2e3);
11768
+ } catch (error) {
11769
+ setStatus({
11770
+ type: "error",
11771
+ message: error?.response?.data?.message || "Unable to reset password. The link may have expired."
11772
+ });
11773
+ } finally {
11774
+ setIsSubmitting(false);
11775
+ }
11776
+ };
11777
+ return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB]", children: /* @__PURE__ */ jsx("div", { className: "grid min-h-screen overflow-hidden pb-12", children: /* @__PURE__ */ jsx(
11778
+ motion.section,
11779
+ {
11780
+ initial: { opacity: 0, x: 24 },
11781
+ animate: { opacity: 1, x: 0 },
11782
+ transition: { duration: 0.4 },
11783
+ className: "flex items-center justify-center px-6 py-12 lg:px-16",
11784
+ children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-lg space-y-10 text-center", children: [
11028
11785
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
11029
- /* @__PURE__ */ jsx(UserPlus, { strokeWidth: 2, className: "h-16 w-16 mx-auto text-white rounded-full bg-primary m-2 mb-4 px-4" }),
11030
- /* @__PURE__ */ jsx("h2", { className: "text-4xl text-secondary", children: "Create Your Account" }),
11031
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted", children: "Join Holmdel Pharmacy Care for convenient healthcare access" })
11786
+ /* @__PURE__ */ jsx(
11787
+ Lock,
11788
+ {
11789
+ strokeWidth: 2,
11790
+ className: "h-16 w-16 mx-auto text-white rounded-full bg-secondary m-2 mb-4 px-4"
11791
+ }
11792
+ ),
11793
+ /* @__PURE__ */ jsx("h2", { className: "text-4xl text-secondary", children: "Reset Password" }),
11794
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted", children: "Enter your new password below to reset your account password." })
11032
11795
  ] }),
11033
11796
  /* @__PURE__ */ jsxs(
11034
11797
  "form",
11035
11798
  {
11036
11799
  onSubmit: handleSubmit(onSubmit),
11037
- className: "text-start space-y-6 rounded-3xl border border-slate-100 bg-white p-8 shadow-lg shadow-primary-50",
11800
+ className: "space-y-6 rounded-3xl border bg-white p-8",
11038
11801
  style: {
11039
11802
  boxShadow: "0px 4px 6px -4px #0000001A, 0px 10px 15px -3px #0000001A"
11040
11803
  },
11041
11804
  children: [
11042
- /* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2 text-start", children: [
11043
- /* @__PURE__ */ jsxs("div", { children: [
11044
- /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11045
- "First name ",
11046
- /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11047
- ] }),
11048
- /* @__PURE__ */ jsx(
11049
- Input,
11050
- {
11051
- placeholder: "Alex",
11052
- ...register("firstName"),
11053
- error: errors.firstName?.message
11054
- }
11055
- )
11056
- ] }),
11057
- /* @__PURE__ */ jsxs("div", { children: [
11058
- /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11059
- "Last name ",
11060
- /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11061
- ] }),
11062
- /* @__PURE__ */ jsx(
11063
- Input,
11064
- {
11065
- placeholder: "Morgan",
11066
- ...register("lastName"),
11067
- error: errors.lastName?.message
11068
- }
11069
- )
11070
- ] })
11071
- ] }),
11072
- /* @__PURE__ */ jsxs("div", { children: [
11073
- /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11074
- "Email Address ",
11075
- /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11076
- ] }),
11077
- /* @__PURE__ */ jsx(
11078
- Input,
11079
- {
11080
- type: "email",
11081
- placeholder: "you@example.com",
11082
- ...register("email"),
11083
- error: errors.email?.message
11084
- }
11085
- )
11086
- ] }),
11087
- /* @__PURE__ */ jsxs("div", { children: [
11088
- /* @__PURE__ */ jsx("h2", { className: "text-sm text-secondary mb-3", children: "Phone Number" }),
11089
- /* @__PURE__ */ jsx(
11090
- Input,
11091
- {
11092
- type: "tel",
11093
- placeholder: "+1 (555) 123-4567",
11094
- ...register("phone"),
11095
- error: errors.phone?.message
11096
- }
11097
- )
11098
- ] }),
11099
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
11805
+ status && /* @__PURE__ */ jsxs(
11806
+ "div",
11807
+ {
11808
+ className: `flex items-start gap-2 rounded-2xl border px-4 py-3 text-sm ${status.type === "success" ? "border-green-200 bg-green-50 text-green-800" : "border-red-200 bg-red-50 text-red-700"}`,
11809
+ children: [
11810
+ /* @__PURE__ */ jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
11811
+ /* @__PURE__ */ jsx("span", { children: status.message })
11812
+ ]
11813
+ }
11814
+ ),
11815
+ /* @__PURE__ */ jsxs("div", { className: "relative text-start text-secondary", children: [
11100
11816
  /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11101
- "Password ",
11817
+ "New Password ",
11102
11818
  /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
11103
11819
  ] }),
11104
11820
  /* @__PURE__ */ jsx(
11105
11821
  Input,
11106
11822
  {
11107
11823
  type: showPassword ? "text" : "password",
11108
- placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
11109
- ...register("password"),
11110
- error: errors.password?.message
11824
+ placeholder: "Enter new password (min. 8 characters)",
11825
+ ...register("newPassword"),
11826
+ error: errors.newPassword?.message,
11827
+ className: "text-secondary"
11111
11828
  }
11112
11829
  ),
11113
11830
  /* @__PURE__ */ jsx(
@@ -11120,7 +11837,7 @@ function RegisterScreen() {
11120
11837
  }
11121
11838
  )
11122
11839
  ] }),
11123
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
11840
+ /* @__PURE__ */ jsxs("div", { className: "relative text-start text-secondary", children: [
11124
11841
  /* @__PURE__ */ jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11125
11842
  "Confirm Password ",
11126
11843
  /* @__PURE__ */ jsx("span", { className: "text-primary-500", children: "*" })
@@ -11129,9 +11846,10 @@ function RegisterScreen() {
11129
11846
  Input,
11130
11847
  {
11131
11848
  type: showConfirmPassword ? "text" : "password",
11132
- placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
11849
+ placeholder: "Re-enter new password",
11133
11850
  ...register("confirmPassword"),
11134
- error: errors.confirmPassword?.message
11851
+ error: errors.confirmPassword?.message,
11852
+ className: "text-secondary"
11135
11853
  }
11136
11854
  ),
11137
11855
  /* @__PURE__ */ jsx(
@@ -11144,42 +11862,30 @@ function RegisterScreen() {
11144
11862
  }
11145
11863
  )
11146
11864
  ] }),
11147
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4 text-sm text-slate-600", children: [
11148
- /* @__PURE__ */ jsx(Shield, { strokeWidth: 2, className: "mt-0.5 h-8 w-8 text-primary" }),
11149
- /* @__PURE__ */ jsxs("span", { children: [
11150
- "By creating an account, you agree to our",
11151
- " ",
11152
- /* @__PURE__ */ jsx(Link7, { href: buildPath("/terms"), className: "font-semibold text-primary hover:opacity-70", children: "Terms of Service" }),
11153
- " ",
11154
- "and",
11155
- " ",
11156
- /* @__PURE__ */ jsx(
11157
- Link7,
11158
- {
11159
- href: buildPath("/privacy"),
11160
- className: "font-semibold text-primary hover:opacity-70",
11161
- children: "Privacy Policy"
11162
- }
11163
- ),
11164
- ". We protect your information with bank-level encryption."
11165
- ] })
11166
- ] }),
11167
11865
  /* @__PURE__ */ jsx(
11168
11866
  "button",
11169
11867
  {
11170
11868
  type: "submit",
11171
- disabled: isSubmitting,
11869
+ disabled: isSubmitting || !token,
11172
11870
  className: "w-full bg-secondary hover:opacity-80 text-white font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-70 disabled:cursor-not-allowed",
11173
- children: isSubmitting ? "Creating account..." : "Create my account"
11871
+ children: isSubmitting ? "Resetting Password..." : "Reset Password"
11174
11872
  }
11175
- )
11873
+ ),
11874
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-600", children: [
11875
+ /* @__PURE__ */ jsx(ShieldCheck, { className: "h-4 w-4 text-primary-600" }),
11876
+ "Use a strong password that you haven't used elsewhere."
11877
+ ] }),
11878
+ /* @__PURE__ */ jsx("div", { className: "pt-4 border-t border-slate-200", children: /* @__PURE__ */ jsx(
11879
+ Link9,
11880
+ {
11881
+ href: buildPath("/login"),
11882
+ className: "text-sm font-medium text-primary transition hover:opacity-80",
11883
+ children: "Back to login"
11884
+ }
11885
+ ) })
11176
11886
  ]
11177
11887
  }
11178
- ),
11179
- /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs("p", { className: "text-muted", children: [
11180
- "Already have an account? ",
11181
- /* @__PURE__ */ jsx(Link7, { href: buildPath("/login"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign in" })
11182
- ] }) })
11888
+ )
11183
11889
  ] })
11184
11890
  }
11185
11891
  ) }) });
@@ -11540,7 +12246,7 @@ function AccountOrdersTab() {
11540
12246
  /* @__PURE__ */ jsx("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsx(
11541
12247
  Image4,
11542
12248
  {
11543
- src: item?.productVariantData?.productMedia?.[0]?.file || "/placeholder-product.jpg",
12249
+ src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
11544
12250
  alt: item?.productVariantData?.name || "Product image",
11545
12251
  fill: true,
11546
12252
  className: "object-cover",
@@ -11857,12 +12563,32 @@ function AccountAddressesTab() {
11857
12563
  )
11858
12564
  ] });
11859
12565
  }
12566
+ init_sharedConfig();
11860
12567
  function AccountSettingsTab() {
11861
12568
  const router = useRouter();
11862
12569
  const { buildPath } = useBasePath();
12570
+ const { logout } = useAuth();
11863
12571
  const [emailNotifications, setEmailNotifications] = useState(true);
11864
12572
  const [orderUpdates, setOrderUpdates] = useState(true);
11865
12573
  const [promotionalEmails, setPromotionalEmails] = useState(false);
12574
+ const [showDeleteModal, setShowDeleteModal] = useState(false);
12575
+ const [isDeleting, setIsDeleting] = useState(false);
12576
+ const [deleteError, setDeleteError] = useState(null);
12577
+ const handleDeleteAccount = async () => {
12578
+ setIsDeleting(true);
12579
+ setDeleteError(null);
12580
+ try {
12581
+ const usersApi = new UsersApi(AXIOS_CONFIG);
12582
+ await usersApi.deleteMyProfile();
12583
+ logout();
12584
+ router.push(buildPath("/"));
12585
+ } catch (error) {
12586
+ setDeleteError(
12587
+ error?.response?.data?.message || "Failed to delete account. Please try again."
12588
+ );
12589
+ setIsDeleting(false);
12590
+ }
12591
+ };
11866
12592
  return /* @__PURE__ */ jsxs("div", { className: "p-6 space-y-6", children: [
11867
12593
  /* @__PURE__ */ jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white p-6", children: [
11868
12594
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
@@ -11949,11 +12675,7 @@ function AccountSettingsTab() {
11949
12675
  variant: "outline-solid",
11950
12676
  size: "sm",
11951
12677
  className: "border-red-200 text-red-600 hover:bg-red-50",
11952
- onClick: () => {
11953
- if (confirm("Are you sure you want to delete your account? This action cannot be undone.")) {
11954
- alert("Account deletion functionality coming soon");
11955
- }
11956
- },
12678
+ onClick: () => setShowDeleteModal(true),
11957
12679
  children: [
11958
12680
  /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" }),
11959
12681
  "Delete"
@@ -11962,7 +12684,63 @@ function AccountSettingsTab() {
11962
12684
  )
11963
12685
  ] })
11964
12686
  ] })
11965
- ] })
12687
+ ] }),
12688
+ /* @__PURE__ */ jsx(
12689
+ Modal,
12690
+ {
12691
+ isOpen: showDeleteModal,
12692
+ onClose: () => {
12693
+ setShowDeleteModal(false);
12694
+ setDeleteError(null);
12695
+ },
12696
+ title: "Delete Account",
12697
+ children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
12698
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-lg border border-red-200 bg-red-50 p-4", children: [
12699
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "h-5 w-5 text-red-600 mt-0.5 flex-shrink-0" }),
12700
+ /* @__PURE__ */ jsxs("div", { children: [
12701
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-red-900", children: "Warning: This action is permanent" }),
12702
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-red-700 mt-1", children: "Deleting your account will permanently remove all your data, including:" }),
12703
+ /* @__PURE__ */ jsxs("ul", { className: "text-sm text-red-700 mt-2 ml-4 list-disc space-y-1", children: [
12704
+ /* @__PURE__ */ jsx("li", { children: "Personal information and profile" }),
12705
+ /* @__PURE__ */ jsx("li", { children: "Order history and tracking" }),
12706
+ /* @__PURE__ */ jsx("li", { children: "Saved addresses and payment methods" }),
12707
+ /* @__PURE__ */ jsx("li", { children: "Wishlist items" })
12708
+ ] })
12709
+ ] })
12710
+ ] }),
12711
+ deleteError && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700", children: [
12712
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Error: " }),
12713
+ deleteError
12714
+ ] }),
12715
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-600", children: "Are you absolutely sure you want to delete your account? This action cannot be undone." }),
12716
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-3 pt-2", children: [
12717
+ /* @__PURE__ */ jsx(
12718
+ Button,
12719
+ {
12720
+ variant: "outline-solid",
12721
+ onClick: () => {
12722
+ setShowDeleteModal(false);
12723
+ setDeleteError(null);
12724
+ },
12725
+ disabled: isDeleting,
12726
+ className: "flex-1",
12727
+ children: "Cancel"
12728
+ }
12729
+ ),
12730
+ /* @__PURE__ */ jsx(
12731
+ Button,
12732
+ {
12733
+ onClick: handleDeleteAccount,
12734
+ isLoading: isDeleting,
12735
+ disabled: isDeleting,
12736
+ className: "flex-1 bg-red-600 hover:bg-red-700 text-white",
12737
+ children: isDeleting ? "Deleting..." : "Delete Account"
12738
+ }
12739
+ )
12740
+ ] })
12741
+ ] })
12742
+ }
12743
+ )
11966
12744
  ] });
11967
12745
  }
11968
12746
  var tabs = [
@@ -12058,7 +12836,7 @@ function OrderCard({ order }) {
12058
12836
  /* @__PURE__ */ jsx("div", { className: "relative w-12 h-12 rounded-sm bg-gray-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsx(
12059
12837
  Image4,
12060
12838
  {
12061
- src: item?.productVariantData?.productMedia?.[0]?.file || "/placeholder-product.jpg",
12839
+ src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
12062
12840
  alt: item?.productVariantData?.name || "Product image",
12063
12841
  fill: true,
12064
12842
  className: "object-cover",
@@ -12392,7 +13170,7 @@ function CurrentOrdersScreen() {
12392
13170
  /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold uppercase tracking-[0.35em] text-white/70", children: "Quick actions" }),
12393
13171
  /* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-3 text-sm text-white/80", children: [
12394
13172
  /* @__PURE__ */ jsxs(
12395
- Link7,
13173
+ Link9,
12396
13174
  {
12397
13175
  href: buildPath("/orders"),
12398
13176
  className: "flex items-center justify-between rounded-2xl bg-white/10 px-4 py-3 transition hover:bg-white/20",
@@ -12968,43 +13746,45 @@ function WishlistScreen() {
12968
13746
  }
12969
13747
  };
12970
13748
  const totalValue = useMemo(
12971
- () => wishlistProducts.reduce((sum, product) => sum + (product.finalPrice ?? 0), 0),
13749
+ () => wishlistProducts.reduce((sum, product) => sum + (product.summary?.minPrice ?? 0), 0),
12972
13750
  [wishlistProducts]
12973
13751
  );
12974
13752
  useMemo(
12975
13753
  () => wishlistProducts.reduce((sum, product) => {
12976
- const before = product.priceBeforeDiscount ?? product.finalPrice ?? 0;
12977
- const after = product.finalPrice ?? 0;
12978
- const savings = Math.max(before - after, 0);
12979
- return sum + savings;
13754
+ if (product.summary?.hasDiscount) {
13755
+ const maxPrice = product.summary?.maxPrice ?? 0;
13756
+ const minPrice = product.summary?.minPrice ?? 0;
13757
+ return sum + (maxPrice - minPrice);
13758
+ }
13759
+ return sum;
12980
13760
  }, 0),
12981
13761
  [wishlistProducts]
12982
13762
  );
12983
13763
  useMemo(
12984
- () => wishlistProducts.filter((product) => (product.inventoryCount ?? 0) > 0).length,
13764
+ () => wishlistProducts.filter((product) => (product.summary?.totalInventory ?? 0) > 0).length,
12985
13765
  [wishlistProducts]
12986
13766
  );
12987
13767
  const processedProducts = useMemo(() => {
12988
13768
  let list = [...wishlistProducts];
12989
13769
  if (onlyInStock) {
12990
- list = list.filter((product) => (product.inventoryCount ?? 0) > 0);
13770
+ list = list.filter((product) => (product.summary?.totalInventory ?? 0) > 0);
12991
13771
  }
12992
13772
  switch (sortOption) {
12993
13773
  case "price-low":
12994
- list.sort((a, b) => (a.finalPrice ?? 0) - (b.finalPrice ?? 0));
13774
+ list.sort((a, b) => (a.summary?.minPrice ?? 0) - (b.summary?.minPrice ?? 0));
12995
13775
  break;
12996
13776
  case "price-high":
12997
- list.sort((a, b) => (b.finalPrice ?? 0) - (a.finalPrice ?? 0));
13777
+ list.sort((a, b) => (b.summary?.maxPrice ?? 0) - (a.summary?.maxPrice ?? 0));
12998
13778
  break;
12999
13779
  case "name":
13000
13780
  list.sort((a, b) => (a.name || "").localeCompare(b.name || ""));
13001
13781
  break;
13002
13782
  case "availability":
13003
- list.sort((a, b) => (b.inventoryCount ?? 0) - (a.inventoryCount ?? 0));
13783
+ list.sort((a, b) => (b.summary?.totalInventory ?? 0) - (a.summary?.totalInventory ?? 0));
13004
13784
  break;
13005
13785
  case "featured":
13006
13786
  default:
13007
- list.sort((a, b) => (b.totalSold ?? 0) - (a.totalSold ?? 0));
13787
+ list.sort((a, b) => (b.summary?.totalSold ?? 0) - (a.summary?.totalSold ?? 0));
13008
13788
  break;
13009
13789
  }
13010
13790
  return list;
@@ -13145,8 +13925,8 @@ function WishlistScreen() {
13145
13925
  ProductCard,
13146
13926
  {
13147
13927
  product,
13148
- onClickProduct: (p) => router.push(buildPath(`/products/${p.id}`)),
13149
- onFavorite: () => handleRemoveFromWishlist(product.id),
13928
+ onClickProduct: (p) => router.push(buildPath(`/products/${p._id}`)),
13929
+ onFavorite: () => handleRemoveFromWishlist(product._id || product.id || ""),
13150
13930
  isFavorited: true
13151
13931
  }
13152
13932
  )
@@ -13168,7 +13948,7 @@ function WishlistScreen() {
13168
13948
  Image4,
13169
13949
  {
13170
13950
  fill: true,
13171
- src: product.productMedia?.[0]?.file || "/placeholder-product.jpg",
13951
+ src: product.media?.[0]?.file || "/placeholder-product.jpg",
13172
13952
  alt: product.name || "Wishlist item",
13173
13953
  className: "h-full w-full object-cover"
13174
13954
  }
@@ -13177,24 +13957,24 @@ function WishlistScreen() {
13177
13957
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
13178
13958
  /* @__PURE__ */ jsxs("div", { children: [
13179
13959
  /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-secondary", children: product.name }),
13180
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted", children: product.parentCategories?.map((category) => category?.name).join(", ") || "General wellness" })
13960
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted", children: "General wellness" })
13181
13961
  ] }),
13182
13962
  /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
13183
- /* @__PURE__ */ jsx("p", { className: "text-lg font-bold text-primary", children: formatPrice(product.finalPrice ?? 0) }),
13184
- product.isDiscounted && /* @__PURE__ */ jsxs("p", { className: "text-xs text-emerald-500", children: [
13963
+ /* @__PURE__ */ jsx("p", { className: "text-lg font-bold text-primary", children: formatPrice(product.summary?.minPrice ?? 0) }),
13964
+ product.summary?.hasDiscount && /* @__PURE__ */ jsxs("p", { className: "text-xs text-emerald-500", children: [
13185
13965
  "You save ",
13186
- formatPrice(Math.max((product.priceBeforeDiscount ?? 0) - (product.finalPrice ?? 0), 0))
13966
+ formatPrice(Math.max((product.summary?.maxPrice ?? 0) - (product.summary?.minPrice ?? 0), 0))
13187
13967
  ] })
13188
13968
  ] })
13189
13969
  ] }),
13190
13970
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3 text-xs text-slate-500", children: [
13191
- /* @__PURE__ */ jsxs("span", { className: `inline-flex items-center gap-1 rounded-full px-2.5 py-1 font-medium ${product.inventoryCount > 0 ? "bg-emerald-100 text-emerald-700" : "bg-rose-100 text-rose-700"}`, children: [
13971
+ /* @__PURE__ */ jsxs("span", { className: `inline-flex items-center gap-1 rounded-full px-2.5 py-1 font-medium ${(product.summary?.totalInventory ?? 0) > 0 ? "bg-emerald-100 text-emerald-700" : "bg-rose-100 text-rose-700"}`, children: [
13192
13972
  /* @__PURE__ */ jsx(Package, { className: "h-3.5 w-3.5" }),
13193
- product.inventoryCount > 0 ? "In stock" : "Backordered"
13973
+ (product.summary?.totalInventory ?? 0) > 0 ? "In stock" : "Backordered"
13194
13974
  ] }),
13195
- product.totalSold > 0 && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-slate-200 px-2.5 py-1 font-medium text-slate-700", children: [
13975
+ (product.summary?.totalSold ?? 0) > 0 && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-slate-200 px-2.5 py-1 font-medium text-slate-700", children: [
13196
13976
  /* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5" }),
13197
- product.totalSold,
13977
+ product.summary?.totalSold,
13198
13978
  "+ purchased"
13199
13979
  ] })
13200
13980
  ] }),
@@ -13203,17 +13983,16 @@ function WishlistScreen() {
13203
13983
  Button,
13204
13984
  {
13205
13985
  size: "sm",
13206
- onClick: () => router.push(buildPath(`/products/${product.id}`)),
13986
+ onClick: () => router.push(buildPath(`/products/${product._id}`)),
13987
+ className: "bg-primary/90 text-white hover:bg-primary/70",
13207
13988
  children: "View details"
13208
13989
  }
13209
13990
  ),
13210
13991
  /* @__PURE__ */ jsx(
13211
- Button,
13992
+ "button",
13212
13993
  {
13213
- size: "sm",
13214
- variant: "outline-solid",
13215
- onClick: () => handleRemoveFromWishlist(product.id),
13216
- className: "text-secondary",
13994
+ onClick: () => handleRemoveFromWishlist(product._id || product.id || ""),
13995
+ className: "text-red-500 hover:text-red-600 hover:bg-red-50 transition-colors cursor-pointer border border-red-500 rounded-full px-4 py-1 text-sm flex-row",
13217
13996
  children: "Remove"
13218
13997
  }
13219
13998
  )
@@ -13252,34 +14031,85 @@ function SearchPage() {
13252
14031
  const [searchInput, setSearchInput] = useState(searchQuery);
13253
14032
  const [hasSearched, setHasSearched] = useState(false);
13254
14033
  const { isInWishlist } = useWishlist();
14034
+ const [suggestions, setSuggestions] = useState([]);
14035
+ const [showSuggestions, setShowSuggestions] = useState(false);
14036
+ const [recentSearches, setRecentSearches] = useState([]);
14037
+ useEffect(() => {
14038
+ const stored = localStorage.getItem("recent_searches");
14039
+ if (stored) {
14040
+ try {
14041
+ setRecentSearches(JSON.parse(stored));
14042
+ } catch (e) {
14043
+ console.error("Failed to parse recent searches", e);
14044
+ }
14045
+ }
14046
+ }, []);
14047
+ const saveRecentSearch = useCallback((query) => {
14048
+ if (!query.trim()) return;
14049
+ setRecentSearches((prev) => {
14050
+ const updated = [query, ...prev.filter((s) => s !== query)].slice(0, 5);
14051
+ localStorage.setItem("recent_searches", JSON.stringify(updated));
14052
+ return updated;
14053
+ });
14054
+ }, []);
14055
+ const generateSuggestions = useMemo(() => {
14056
+ if (!searchInput.trim() || searchInput.length < 2) {
14057
+ return [];
14058
+ }
14059
+ const query = searchInput.toLowerCase().trim();
14060
+ const suggestionSet = /* @__PURE__ */ new Set();
14061
+ products.forEach((product) => {
14062
+ if (product.name?.toLowerCase().includes(query)) {
14063
+ suggestionSet.add(product.name);
14064
+ }
14065
+ if (product.brand?.toLowerCase().includes(query)) {
14066
+ suggestionSet.add(product.brand);
14067
+ }
14068
+ product.tags?.forEach((tag) => {
14069
+ if (tag.toLowerCase().includes(query)) {
14070
+ suggestionSet.add(tag);
14071
+ }
14072
+ });
14073
+ });
14074
+ return Array.from(suggestionSet).slice(0, 5);
14075
+ }, [searchInput, products]);
14076
+ useEffect(() => {
14077
+ setSuggestions(generateSuggestions);
14078
+ }, [generateSuggestions]);
14079
+ const sanitizeSearchInput = useCallback((input) => {
14080
+ let sanitized = input.trim();
14081
+ sanitized = sanitized.replace(/\s+/g, " ");
14082
+ return sanitized;
14083
+ }, []);
13255
14084
  useEffect(() => {
13256
14085
  const fetchSearchResults = async () => {
13257
- if (!searchQuery.trim()) {
14086
+ const sanitizedQuery = sanitizeSearchInput(searchQuery);
14087
+ if (!sanitizedQuery) {
13258
14088
  setProducts([]);
13259
14089
  setIsLoading(false);
14090
+ setHasSearched(false);
13260
14091
  return;
13261
14092
  }
13262
14093
  try {
13263
14094
  setIsLoading(true);
13264
14095
  const api = new ProductsApi(AXIOS_CONFIG);
13265
- const response = await api.getAllProductsForStore(
13266
- searchQuery,
13267
- void 0,
13268
- // productType
13269
- void 0,
13270
- // categoryId
14096
+ let response = await api.getAllProducts(
14097
+ sanitizedQuery,
14098
+ // searchTerm
13271
14099
  void 0,
13272
14100
  // maxPrice
13273
14101
  void 0,
13274
14102
  // minPrice
13275
14103
  void 0,
13276
14104
  // brandFilter
13277
- "in-stock",
14105
+ void 0,
13278
14106
  // availability
13279
14107
  "relevance",
13280
14108
  // sort
13281
- true,
13282
- // includeNoVariantProducts
14109
+ void 0,
14110
+ // subCategoryId
14111
+ void 0,
14112
+ // categoryId
13283
14113
  true,
13284
14114
  // isActive
13285
14115
  20,
@@ -13287,33 +14117,64 @@ function SearchPage() {
13287
14117
  1
13288
14118
  // page
13289
14119
  );
14120
+ console.log("Search API Response:", {
14121
+ query: sanitizedQuery,
14122
+ status: response.status,
14123
+ dataLength: response.data?.data?.length,
14124
+ totalItems: response.data?.totalItems
14125
+ });
13290
14126
  if (response.data?.data) {
13291
14127
  const transformedProducts = response.data.data.map((item) => ({
13292
14128
  ...item,
13293
14129
  id: item._id || ""
13294
14130
  }));
13295
14131
  setProducts(transformedProducts);
14132
+ if (transformedProducts.length > 0) {
14133
+ saveRecentSearch(sanitizedQuery);
14134
+ }
13296
14135
  } else {
13297
14136
  setProducts([]);
13298
14137
  }
13299
14138
  setHasSearched(true);
13300
14139
  } catch (error) {
13301
14140
  console.error("Error fetching search results:", error);
14141
+ if (error instanceof Error) {
14142
+ console.error("Error details:", error.message);
14143
+ }
13302
14144
  setProducts([]);
14145
+ setHasSearched(true);
13303
14146
  } finally {
13304
14147
  setIsLoading(false);
13305
14148
  }
13306
14149
  };
13307
14150
  fetchSearchResults();
13308
- }, [searchQuery]);
14151
+ }, [searchQuery, sanitizeSearchInput, saveRecentSearch]);
13309
14152
  const handleSearch = (e) => {
13310
14153
  e.preventDefault();
13311
- if (searchInput.trim()) {
13312
- window.location.href = `/search?q=${encodeURIComponent(searchInput.trim())}`;
14154
+ const sanitized = sanitizeSearchInput(searchInput);
14155
+ if (sanitized) {
14156
+ setShowSuggestions(false);
14157
+ router.push(buildPath(`/search?q=${encodeURIComponent(sanitized)}`));
13313
14158
  }
13314
14159
  };
13315
14160
  const clearSearch = () => {
13316
14161
  setSearchInput("");
14162
+ setShowSuggestions(false);
14163
+ };
14164
+ const handleSuggestionClick = (suggestion) => {
14165
+ setSearchInput(suggestion);
14166
+ setShowSuggestions(false);
14167
+ router.push(buildPath(`/search?q=${encodeURIComponent(suggestion)}`));
14168
+ };
14169
+ const handleInputChange = (e) => {
14170
+ const value = e.target.value;
14171
+ setSearchInput(value);
14172
+ setShowSuggestions(value.trim().length >= 2);
14173
+ };
14174
+ const handleInputFocus = () => {
14175
+ if (searchInput.trim().length >= 2) {
14176
+ setShowSuggestions(true);
14177
+ }
13317
14178
  };
13318
14179
  return /* @__PURE__ */ jsxs("div", { className: "container mx-auto px-4 py-8", children: [
13319
14180
  /* @__PURE__ */ jsx("div", { className: "max-w-2xl mx-auto mb-8", children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSearch, className: "relative", children: [
@@ -13324,9 +14185,12 @@ function SearchPage() {
13324
14185
  {
13325
14186
  type: "text",
13326
14187
  value: searchInput,
13327
- onChange: (e) => setSearchInput(e.target.value),
14188
+ onChange: handleInputChange,
14189
+ onFocus: handleInputFocus,
14190
+ onBlur: () => setTimeout(() => setShowSuggestions(false), 200),
13328
14191
  placeholder: "Search for products...",
13329
- className: "pl-10 pr-10 py-6 text-base rounded-lg border-gray-300 focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
14192
+ className: "pl-10 pr-10 py-6 text-base rounded-lg border-gray-300 focus:ring-2 focus:ring-primary-500 focus:border-primary-500",
14193
+ autoComplete: "off"
13330
14194
  }
13331
14195
  ),
13332
14196
  searchInput && /* @__PURE__ */ jsx(
@@ -13337,13 +14201,64 @@ function SearchPage() {
13337
14201
  className: "absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",
13338
14202
  children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
13339
14203
  }
13340
- )
14204
+ ),
14205
+ /* @__PURE__ */ jsx(AnimatePresence, { children: showSuggestions && (suggestions.length > 0 || recentSearches.length > 0) && /* @__PURE__ */ jsxs(
14206
+ motion.div,
14207
+ {
14208
+ initial: { opacity: 0, y: -10 },
14209
+ animate: { opacity: 1, y: 0 },
14210
+ exit: { opacity: 0, y: -10 },
14211
+ transition: { duration: 0.2 },
14212
+ className: "absolute z-50 w-full mt-2 bg-white rounded-lg shadow-lg border border-gray-200 overflow-hidden",
14213
+ children: [
14214
+ suggestions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "p-2", children: [
14215
+ /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2", children: [
14216
+ /* @__PURE__ */ jsx(TrendingUp, { className: "h-3 w-3" }),
14217
+ "Suggestions"
14218
+ ] }),
14219
+ suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs(
14220
+ "button",
14221
+ {
14222
+ type: "button",
14223
+ onClick: () => handleSuggestionClick(suggestion),
14224
+ className: "w-full text-left px-3 py-2.5 hover:bg-gray-50 rounded-md transition-colors flex items-center gap-2 group",
14225
+ children: [
14226
+ /* @__PURE__ */ jsx(Search, { className: "h-4 w-4 text-gray-400 group-hover:text-primary-500" }),
14227
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-700 group-hover:text-gray-900", children: suggestion })
14228
+ ]
14229
+ },
14230
+ index
14231
+ ))
14232
+ ] }),
14233
+ recentSearches.length > 0 && !searchInput.trim() && /* @__PURE__ */ jsxs("div", { className: "p-2 border-t border-gray-100", children: [
14234
+ /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2", children: [
14235
+ /* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
14236
+ "Recent Searches"
14237
+ ] }),
14238
+ recentSearches.map((search, index) => /* @__PURE__ */ jsxs(
14239
+ "button",
14240
+ {
14241
+ type: "button",
14242
+ onClick: () => handleSuggestionClick(search),
14243
+ className: "w-full text-left px-3 py-2.5 hover:bg-gray-50 rounded-md transition-colors flex items-center gap-2 group",
14244
+ children: [
14245
+ /* @__PURE__ */ jsx(Clock, { className: "h-4 w-4 text-gray-400 group-hover:text-primary-500" }),
14246
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-700 group-hover:text-gray-900", children: search })
14247
+ ]
14248
+ },
14249
+ index
14250
+ ))
14251
+ ] })
14252
+ ]
14253
+ }
14254
+ ) })
13341
14255
  ] }),
13342
14256
  /* @__PURE__ */ jsx(
13343
14257
  "button",
13344
14258
  {
13345
14259
  type: "submit",
13346
- className: "mt-4 w-full bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-4 rounded-lg transition-colors",
14260
+ className: "mt-4 w-full bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
14261
+ disabled: !searchInput.trim(),
13347
14262
  children: "Search"
13348
14263
  }
13349
14264
  )
@@ -13363,17 +14278,63 @@ function SearchPage() {
13363
14278
  },
13364
14279
  product.id
13365
14280
  )) }) : hasSearched ? /* @__PURE__ */ jsxs("div", { className: "text-center py-12", children: [
13366
- /* @__PURE__ */ jsxs("div", { className: "text-gray-500 text-lg mb-4", children: [
13367
- 'No products found for "',
13368
- searchQuery,
13369
- '"'
14281
+ /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
14282
+ /* @__PURE__ */ jsx("div", { className: "w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4", children: /* @__PURE__ */ jsx(Search, { className: "h-8 w-8 text-gray-400" }) }),
14283
+ /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-gray-900 mb-2", children: "No products found" }),
14284
+ /* @__PURE__ */ jsxs("p", { className: "text-gray-500 text-base mb-1", children: [
14285
+ `We couldn't find any products matching "`,
14286
+ searchQuery,
14287
+ '"'
14288
+ ] }),
14289
+ /* @__PURE__ */ jsx(
14290
+ "button",
14291
+ {
14292
+ onClick: clearSearch,
14293
+ className: "px-6 py-2.5 mt-4 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors font-medium border border-gray-300 bg-white cursor-pointer",
14294
+ children: "Clear Search"
14295
+ }
14296
+ )
13370
14297
  ] }),
13371
- /* @__PURE__ */ jsxs("p", { className: "text-gray-500 mb-6", children: [
13372
- "Try different keywords or check out our",
13373
- " ",
13374
- /* @__PURE__ */ jsx(Link7, { href: "/shop", className: "text-primary-600 hover:underline ml-1 font-medium", children: "featured products" })
14298
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col sm:flex-row gap-3 justify-center items-center", children: /* @__PURE__ */ jsx(
14299
+ Link9,
14300
+ {
14301
+ href: buildPath("/shop"),
14302
+ className: "px-6 py-2.5 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium",
14303
+ children: "Browse All Products"
14304
+ }
14305
+ ) }),
14306
+ recentSearches.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-8 pt-8 border-t border-gray-200", children: [
14307
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700 mb-3", children: "Recent Searches:" }),
14308
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 justify-center", children: recentSearches.map((search, index) => /* @__PURE__ */ jsx(
14309
+ "button",
14310
+ {
14311
+ onClick: () => handleSuggestionClick(search),
14312
+ className: "px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-full text-sm transition-colors",
14313
+ children: search
14314
+ },
14315
+ index
14316
+ )) })
14317
+ ] })
14318
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "text-center py-12", children: [
14319
+ /* @__PURE__ */ jsx("div", { className: "w-16 h-16 bg-primary-50 rounded-full flex items-center justify-center mx-auto mb-4", children: /* @__PURE__ */ jsx(Search, { className: "h-8 w-8 text-primary-500" }) }),
14320
+ /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Start Searching" }),
14321
+ /* @__PURE__ */ jsx("p", { className: "text-gray-500 mb-6", children: "Enter a search term above to find products" }),
14322
+ recentSearches.length > 0 && /* @__PURE__ */ jsxs("div", { className: "max-w-md mx-auto", children: [
14323
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700 mb-3", children: "Recent Searches:" }),
14324
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 justify-center", children: recentSearches.map((search, index) => /* @__PURE__ */ jsxs(
14325
+ "button",
14326
+ {
14327
+ onClick: () => handleSuggestionClick(search),
14328
+ className: "px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-full text-sm transition-colors flex items-center gap-2",
14329
+ children: [
14330
+ /* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
14331
+ search
14332
+ ]
14333
+ },
14334
+ index
14335
+ )) })
13375
14336
  ] })
13376
- ] }) : /* @__PURE__ */ jsx("div", { className: "text-center py-12", children: /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "Enter a search term to find products" }) })
14337
+ ] })
13377
14338
  ] })
13378
14339
  ] });
13379
14340
  }
@@ -13674,7 +14635,17 @@ function EditProfileScreen() {
13674
14635
  /* @__PURE__ */ jsx(Phone, { className: "absolute left-3 top-[38px] h-4 w-4 text-slate-400" })
13675
14636
  ] }),
13676
14637
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
13677
- /* @__PURE__ */ jsx(Button, { type: "submit", size: "lg", isLoading: isSubmitting, children: "Save changes" }),
14638
+ /* @__PURE__ */ jsx(
14639
+ Button,
14640
+ {
14641
+ type: "submit",
14642
+ size: "lg",
14643
+ isLoading: isSubmitting,
14644
+ className: "border-slate-300 text-slate-800 hover:bg-slate-50",
14645
+ variant: "outline-solid",
14646
+ children: "Save changes"
14647
+ }
14648
+ ),
13678
14649
  /* @__PURE__ */ jsx(
13679
14650
  Button,
13680
14651
  {
@@ -13721,7 +14692,7 @@ function Header() {
13721
14692
  { href: buildPath("/shop"), label: "Shop" }
13722
14693
  ];
13723
14694
  return /* @__PURE__ */ jsx("header", { className: "sticky top-0 z-10 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-xs", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between h-20", children: [
13724
- /* @__PURE__ */ jsx(Link7, { href: buildPath("/"), className: "flex items-center gap-3", children: /* @__PURE__ */ jsx("div", { className: "relative w-12 h-12", children: /* @__PURE__ */ jsx(
14695
+ /* @__PURE__ */ jsx(Link9, { href: buildPath("/"), className: "flex items-center gap-3", children: /* @__PURE__ */ jsx("div", { className: "relative w-12 h-12", children: /* @__PURE__ */ jsx(
13725
14696
  Image4,
13726
14697
  {
13727
14698
  src: config.logo,
@@ -13731,7 +14702,7 @@ function Header() {
13731
14702
  }
13732
14703
  ) }) }),
13733
14704
  /* @__PURE__ */ jsx("nav", { className: "hidden lg:flex items-center gap-8", children: navLinks.map((link) => /* @__PURE__ */ jsxs(
13734
- Link7,
14705
+ Link9,
13735
14706
  {
13736
14707
  href: link.href,
13737
14708
  className: "text-gray-700 hover:text-primary-600 font-medium transition-colors relative group",
@@ -13769,13 +14740,19 @@ function Header() {
13769
14740
  value: searchQuery,
13770
14741
  onChange: (e) => setSearchQuery(e.target.value),
13771
14742
  onKeyDown: (e) => {
13772
- if (e.key === "Enter" && searchQuery.trim()) {
13773
- window.location.href = buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
14743
+ if (e.key === "Enter") {
14744
+ const sanitized = searchQuery.trim().replace(/\s+/g, " ");
14745
+ if (sanitized) {
14746
+ router.push(buildPath(`/search?q=${encodeURIComponent(sanitized)}`));
14747
+ setIsSearchOpen(false);
14748
+ setSearchQuery("");
14749
+ }
13774
14750
  }
13775
14751
  },
13776
14752
  placeholder: "Search products...",
13777
14753
  className: "w-full outline-hidden text-gray-700",
13778
- autoFocus: true
14754
+ autoFocus: true,
14755
+ autoComplete: "off"
13779
14756
  }
13780
14757
  ),
13781
14758
  searchQuery && /* @__PURE__ */ jsx(
@@ -13791,11 +14768,11 @@ function Header() {
13791
14768
  ) })
13792
14769
  ] }),
13793
14770
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
13794
- /* @__PURE__ */ jsxs(Link7, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors", children: [
14771
+ /* @__PURE__ */ jsxs(Link9, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors", children: [
13795
14772
  /* @__PURE__ */ jsx(Heart, { className: "w-6 h-6" }),
13796
14773
  wishlistCount > 0 && /* @__PURE__ */ jsx("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center", children: wishlistCount })
13797
14774
  ] }),
13798
- /* @__PURE__ */ jsxs(Link7, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors", children: [
14775
+ /* @__PURE__ */ jsxs(Link9, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors", children: [
13799
14776
  /* @__PURE__ */ jsx(ShoppingCart, { className: "w-6 h-6" }),
13800
14777
  cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ jsx("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center", children: cart.cartBody?.items?.length }) : null
13801
14778
  ] }),
@@ -13829,7 +14806,7 @@ function Header() {
13829
14806
  /* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500 truncate", children: user?.email })
13830
14807
  ] }),
13831
14808
  /* @__PURE__ */ jsxs(
13832
- Link7,
14809
+ Link9,
13833
14810
  {
13834
14811
  href: buildPath("/account"),
13835
14812
  onClick: () => setIsDropdownOpen(false),
@@ -13856,7 +14833,7 @@ function Header() {
13856
14833
  ] }) })
13857
14834
  ] })
13858
14835
  ] }) : /* @__PURE__ */ jsx(
13859
- Link7,
14836
+ Link9,
13860
14837
  {
13861
14838
  href: buildPath("/login"),
13862
14839
  className: "hidden sm:block px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium",
@@ -13882,7 +14859,7 @@ function Header() {
13882
14859
  className: "lg:hidden overflow-hidden border-t border-gray-200",
13883
14860
  children: /* @__PURE__ */ jsxs("nav", { className: "flex flex-col gap-1 py-2", children: [
13884
14861
  navLinks.map((link) => /* @__PURE__ */ jsx(
13885
- Link7,
14862
+ Link9,
13886
14863
  {
13887
14864
  href: link.href,
13888
14865
  className: "px-4 py-3 text-gray-700 hover:bg-gray-50 rounded-lg font-medium",
@@ -13892,7 +14869,7 @@ function Header() {
13892
14869
  link.href
13893
14870
  )),
13894
14871
  !isAuthenticated && /* @__PURE__ */ jsx(
13895
- Link7,
14872
+ Link9,
13896
14873
  {
13897
14874
  href: buildPath("/login"),
13898
14875
  onClick: () => setIsMobileMenuOpen(false),
@@ -13960,7 +14937,7 @@ function Footer() {
13960
14937
  /* @__PURE__ */ jsxs("div", { children: [
13961
14938
  /* @__PURE__ */ jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Shop" }),
13962
14939
  /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: footerLinks.shop.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
13963
- Link7,
14940
+ Link9,
13964
14941
  {
13965
14942
  href: link.href,
13966
14943
  className: "hover:text-primary-500 transition-colors",
@@ -13971,7 +14948,7 @@ function Footer() {
13971
14948
  /* @__PURE__ */ jsxs("div", { children: [
13972
14949
  /* @__PURE__ */ jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Account" }),
13973
14950
  /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: footerLinks.account.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
13974
- Link7,
14951
+ Link9,
13975
14952
  {
13976
14953
  href: link.href,
13977
14954
  className: "hover:text-primary-500 transition-colors",
@@ -13982,7 +14959,7 @@ function Footer() {
13982
14959
  /* @__PURE__ */ jsxs("div", { children: [
13983
14960
  /* @__PURE__ */ jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Support" }),
13984
14961
  /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: footerLinks.support.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
13985
- Link7,
14962
+ Link9,
13986
14963
  {
13987
14964
  href: link.href,
13988
14965
  className: "hover:text-primary-500 transition-colors",
@@ -14029,6 +15006,6 @@ function Footer() {
14029
15006
  ] }) });
14030
15007
  }
14031
15008
 
14032
- export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, CheckoutScreen, CurrentOrdersScreen, EcommerceProvider, EditProfileScreen, EmptyState, Footer, Header, Input, LoginScreen, Modal, NewAddressPage as NewAddressScreen, OrderCard, OrderCardSkeleton, OrdersScreen, ProductCard, ProductCardSkeleton, ProductDetailScreen, AccountPage as ProfileScreen, RegisterScreen, SearchPage as SearchResultsScreen, ShopScreen, Skeleton, ThemeProvider, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCurrentOrders, useOrder, useOrders, useProduct, useProducts, useTheme, useWishlist };
15009
+ export { AddressesScreen, AuthProvider, Badge, Button, CartItem, CartProvider, CartScreen, CheckoutScreen, CurrentOrdersScreen, EcommerceProvider, EditProfileScreen, EmptyState, Footer, ForgotPasswordScreen, Header, Input, LoginScreen, Modal, NewAddressPage as NewAddressScreen, OrderCard, OrderCardSkeleton, OrdersScreen, ProductCard, ProductCardSkeleton, ProductDetailScreen, AccountPage as ProfileScreen, RegisterScreen, ResetPasswordScreen, SearchPage as SearchResultsScreen, ShopScreen, Skeleton, ThemeProvider, WishlistProvider, WishlistScreen, formatDate, formatPrice, generateColorShades, getApiConfiguration, getInitials, hexToRgb, initializeApiAdapter, truncate, useAddresses, useAuth, useBasePath, useCart, useCategories, useCurrentOrders, useOrder, useOrders, useProduct, useProducts, useTheme, useWishlist };
14033
15010
  //# sourceMappingURL=index.mjs.map
14034
15011
  //# sourceMappingURL=index.mjs.map